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_cook.go | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'internal/game/cmd_cook.go') diff --git a/internal/game/cmd_cook.go b/internal/game/cmd_cook.go index ce33ccd..b27b293 100644 --- a/internal/game/cmd_cook.go +++ b/internal/game/cmd_cook.go @@ -40,10 +40,7 @@ func (g *Game) doCook(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 } @@ -71,11 +68,11 @@ func (g *Game) doCook(sess *net.Session, input string) { sess.PendingMenu = recipeMenuData(recipes) sess.State = net.StateRecipeChoice - sess.WriteLine(fmt.Sprintf("\nWhat would you like to cook on the %s?", stationName)) - 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, fmt.Sprintf("What would you like to cook on the %s?", stationName), names) } func (g *Game) showCookMenu(sess *net.Session, p *player.Player, allRecipes []action.RecipeDef, stationDefID, stationName string) { @@ -110,11 +107,11 @@ func (g *Game) showCookMenu(sess *net.Session, p *player.Player, allRecipes []ac } sess.State = net.StateRecipeChoice - sess.WriteLine(fmt.Sprintf("\nWhat would you like to cook on the %s?", stationName)) - 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, fmt.Sprintf("What would you like to cook on the %s?", stationName), names) sess.PendingMenu = entryMenuData(entries) } -- cgit v1.2.3