From fae979b75e37b6ad57e57062a1b637a37ec87174 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Thu, 18 Jun 2026 02:34:56 -0400 Subject: cleaned up various crafting menus --- internal/game/cmd_smelt.go | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'internal/game/cmd_smelt.go') diff --git a/internal/game/cmd_smelt.go b/internal/game/cmd_smelt.go index e0889f6..1cd5436 100644 --- a/internal/game/cmd_smelt.go +++ b/internal/game/cmd_smelt.go @@ -37,10 +37,7 @@ func (g *Game) doSmelt(sess *net.Session, input string) { unique := uniqueItemNames(matches) if len(unique) > 1 { - sess.WriteLine("Which one?") - for _, name := range unique { - sess.WriteLine(fmt.Sprintf(" - %s", name)) - } + g.showWhichOne(sess, matches) return } @@ -69,11 +66,11 @@ func (g *Game) doSmelt(sess *net.Session, input string) { sess.PendingMenu = recipeMenuData(recipes) sess.State = net.StateRecipeChoice - sess.WriteLine("\nWhat would you like to smelt?") - for i, r := range recipes { - sess.WriteLine(fmt.Sprintf(" %d) %s", i+1, g.recipeName(sess, &r))) + var names []string + for _, r := range recipes { + names = append(names, g.recipeName(sess, &r)) } - sess.WriteLine(fmt.Sprintf(" %d) Nothing", len(recipes)+1)) + g.showMenuTable(sess, "What would you like to smelt?", names) } func (g *Game) showSmeltMenu(sess *net.Session, p *player.Player, allRecipes []action.RecipeDef, stationDefID, stationName string) { @@ -102,10 +99,10 @@ func (g *Game) showSmeltMenu(sess *net.Session, p *player.Player, allRecipes []a } sess.State = net.StateRecipeChoice - sess.WriteLine("\nWhat would you like to smelt?") - for i, e := range entries { - sess.WriteLine(fmt.Sprintf(" %d) %s", i+1, e.ItemName)) + var names []string + for _, e := range entries { + names = append(names, e.ItemName) } - sess.WriteLine(fmt.Sprintf(" %d) Nothing", len(entries)+1)) + g.showMenuTable(sess, "What would you like to smelt?", names) sess.PendingMenu = entryMenuData(entries) } -- cgit v1.2.3