From c36c1dc0c65e65b4d6ee53df6bbcc3a860eb6e4b Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Sun, 21 Jun 2026 01:05:35 -0400 Subject: Added %i, %n, %b to production skill messages to consistent color inputs, item names, and byproducts --- internal/game/cmd_wear.go | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'internal/game/cmd_wear.go') 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] -- cgit v1.2.3