aboutsummaryrefslogtreecommitdiff
path: root/internal/game/cmd_wear.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-06-21 01:05:35 -0400
committerhistoria <[not public]>2026-06-21 01:05:35 -0400
commitc36c1dc0c65e65b4d6ee53df6bbcc3a860eb6e4b (patch)
treeea5b796d7b8ce6ae422b30542e0da97e818207e8 /internal/game/cmd_wear.go
parent470bc5bd99b793e46305310b5fbeb3068eba45f1 (diff)
downloadthehouseoficarus-c36c1dc0c65e65b4d6ee53df6bbcc3a860eb6e4b.tar.gz
Added %i, %n, %b to production skill messages to consistent color inputs, item names, and byproducts
Diffstat (limited to 'internal/game/cmd_wear.go')
-rw-r--r--internal/game/cmd_wear.go18
1 files changed, 12 insertions, 6 deletions
diff --git a/internal/game/cmd_wear.go b/internal/game/cmd_wear.go
index f2fd84c..8f8117f 100644
--- a/internal/game/cmd_wear.go
+++ b/internal/game/cmd_wear.go
@@ -13,7 +13,7 @@ func (g *Game) executeWear(sess *net.Session, args []string, rawInput string) {
g.doWear(sess, strings.Join(args, " "))
}
-func (g *Game) checkRequirements(p *player.Player, def *object.ItemDef) string {
+func (g *Game) checkRequirements(sess *net.Session, p *player.Player, def *object.ItemDef) string {
if len(def.Requirements) == 0 {
return ""
}
@@ -26,7 +26,7 @@ func (g *Game) checkRequirements(p *player.Player, def *object.ItemDef) string {
if len(unmet) == 0 {
return ""
}
- return fmt.Sprintf("You need %s to wear %s.", strings.Join(unmet, ", "), def.Name)
+ return fmt.Sprintf("You need %s to wear %s.", strings.Join(unmet, ", "), g.itemColorize(sess, def, def.Name))
}
func (g *Game) doWear(sess *net.Session, input string) {
@@ -56,8 +56,14 @@ func (g *Game) doWear(sess *net.Session, input string) {
unique := uniqueItemNames(matches)
if len(unique) > 1 {
sess.WriteLine("Equip what?")
- for _, name := range unique {
- sess.WriteLine(fmt.Sprintf(" - %s", name))
+ seen := make(map[string]bool)
+ for _, m := range matches {
+ if seen[m.Name] {
+ continue
+ }
+ seen[m.Name] = true
+ def, _ := g.ItemStore.Load(m.ID)
+ sess.WriteLine(fmt.Sprintf(" - %s", g.itemColorize(sess, def, m.Name)))
}
return
}
@@ -74,7 +80,7 @@ func (g *Game) doWear(sess *net.Session, input string) {
return
}
- if msg := g.checkRequirements(p, def); msg != "" {
+ if msg := g.checkRequirements(sess, p, def); msg != "" {
sess.WriteLine(msg)
return
}
@@ -190,7 +196,7 @@ func (g *Game) doWearAll(sess *net.Session) {
if err != nil || def.EquipSlot == "" {
continue
}
- if g.checkRequirements(p, def) != "" {
+ if g.checkRequirements(sess, p, def) != "" {
continue
}
current, exists := bestPerSlot[def.EquipSlot]