aboutsummaryrefslogtreecommitdiff
path: root/internal/game/cmd_cook.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/game/cmd_cook.go')
-rw-r--r--internal/game/cmd_cook.go21
1 files changed, 9 insertions, 12 deletions
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)
}