Skip to content

Commit

Permalink
feat: buyable considering Bastille
Browse files Browse the repository at this point in the history
  • Loading branch information
dd84ai committed Apr 7, 2024
1 parent 9fd8a4d commit 8af9a4b
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion darkstat/front/engines.templ
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ templ Engines(engines []configs_export.Engine) {
>
<td>{ engine.Name }</td>
<td>{ strconv.Itoa(engine.Price) } </td>
<td>{ strconv.FormatBool(len(engine.Bases) > 0) }</td>
<td>{ strconv.FormatBool(Buyable(engine.Bases)) }</td>
<td>{ fmt.Sprintf("%.2f",engine.ImpulseSpeed) } </td>
<td>{ strconv.Itoa(engine.CruiseSpeed) }</td>
<td>{ engine.HpType }</td>
Expand Down
2 changes: 1 addition & 1 deletion darkstat/front/guns.templ
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ templ GunsT(guns []configs_export.Gun, mode GunTabMode) {
<td>{ gun.Type }</td>
<td>{ gun.DamageType }</td>
<td>{ strconv.Itoa(gun.Price) } </td>
<td>{ strconv.FormatBool(len(gun.Bases) > 0) }</td>
<td>{ strconv.FormatBool(Buyable(gun.Bases)) }</td>
<td>{ strconv.Itoa(gun.HullDamage) }</td>
<td>{ strconv.Itoa(gun.ShieldDamage) }</td>
<td>{ fmt.Sprintf("%.2f", gun.PowerUsage) }</td>
Expand Down
2 changes: 1 addition & 1 deletion darkstat/front/mines.templ
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ templ MinesT(mines []configs_export.Mine) {
>
<td>{ mine.Name }</td>
<td>{ strconv.Itoa(mine.Price) } </td>
<td>{ strconv.FormatBool(len(mine.Bases) > 0) }</td>
<td>{ strconv.FormatBool(Buyable(mine.Bases)) }</td>
<td>{ strconv.Itoa(mine.AmmoPrice) } </td>
<td>{ strconv.Itoa(mine.HullDamage) }</td>
<td>{ strconv.Itoa(mine.ShieldDamage) }</td>
Expand Down
11 changes: 11 additions & 0 deletions darkstat/front/shared.templ
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/darklab8/fl-configs/configs/configs_export"
"strconv"
"fmt"
"strings"
)

templ TabContent() {
Expand Down Expand Up @@ -247,3 +248,13 @@ templ GoodAtBaseInfoT(base_infos []configs_export.GoodAtBase, show_price_per_vol
}
}
}

func Buyable(Bases []configs_export.GoodAtBase) bool {
for _, base := range Bases {
if !strings.Contains(base.SystemName, "Bastille") {
return true
}
}

return false
}
2 changes: 1 addition & 1 deletion darkstat/front/shields.templ
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ templ ShieldT(shields []configs_export.Shield) {
<td>{ shield.Type }</td>
<td>{ shield.Technology }</td>
<td>{ strconv.Itoa(shield.Price) } </td>
<td>{ strconv.FormatBool(len(shield.Bases) > 0) }</td>
<td>{ strconv.FormatBool(Buyable(shield.Bases)) }</td>
<td>{ strconv.Itoa(shield.Capacity) } </td>
<td>{ strconv.Itoa(shield.RegenerationRate) }</td>
<td>{ strconv.Itoa(shield.ConstantPowerDraw) }</td>
Expand Down
2 changes: 1 addition & 1 deletion darkstat/front/ships.templ
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ templ ShipsT(ships []configs_export.Ship, mode ShipTabMode) {
<td>{ strconv.Itoa(ship.Class) }</td>
<td>{ ship.Type }</td>
<td>{ strconv.Itoa(ship.Price) }</td>
<td>{ strconv.FormatBool(len(ship.Bases) > 0) }</td>
<td>{ strconv.FormatBool(Buyable(ship.Bases)) }</td>
<td>{ strconv.Itoa(ship.Armor) } </td>
<td>{ strconv.Itoa(ship.HoldSize) } </td>
<td>{ strconv.Itoa(ship.Nanobots) }</td>
Expand Down
2 changes: 1 addition & 1 deletion darkstat/front/thrusters.templ
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ templ ThrusterT(thrusters []configs_export.Thruster) {
>
<td>{ thruster.Name }</td>
<td>{ strconv.Itoa(thruster.Price) } </td>
<td>{ strconv.FormatBool(len(thruster.Bases) > 0) }</td>
<td>{ strconv.FormatBool(Buyable(thruster.Bases)) }</td>
<td>{ strconv.Itoa(thruster.MaxForce) } </td>
<td>{ strconv.Itoa(thruster.PowerUsage) }</td>
<td>{ fmt.Sprintf("%.2f",thruster.Efficiency) }</td>
Expand Down
2 changes: 1 addition & 1 deletion darkstat/front/tractors.templ
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ templ TractorsT(tractors []configs_export.Tractor) {
>
<td>{ tractor.Name }</td>
<td>{ strconv.Itoa(tractor.Price) } </td>
<td>{ strconv.FormatBool(len(tractor.Bases) > 0) }</td>
<td>{ strconv.FormatBool(Buyable(tractor.Bases)) }</td>
<td>{ strconv.Itoa(tractor.MaxLength) } </td>
<td>{ strconv.Itoa(tractor.ReachSpeed) }</td>
<td>{ strconv.FormatBool(tractor.Lootable) }</td>
Expand Down

0 comments on commit 8af9a4b

Please sign in to comment.