aboutsummaryrefslogtreecommitdiff
path: root/internal/game/cmd_craft.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/game/cmd_craft.go')
-rw-r--r--internal/game/cmd_craft.go34
1 files changed, 17 insertions, 17 deletions
diff --git a/internal/game/cmd_craft.go b/internal/game/cmd_craft.go
index 447d980..d061a9c 100644
--- a/internal/game/cmd_craft.go
+++ b/internal/game/cmd_craft.go
@@ -17,14 +17,14 @@ func (g *Game) executeConstruct(sess *net.Session, args []string, rawInput strin
}
func (g *Game) doCraft(sess *net.Session, input string) {
- g.doGenericStationSkill(sess, input, "crafting", player.Crafting, "last_craft", "Crafting", "craft", "Craft")
+ g.doStationSkill(sess, input, "crafting", player.Crafting, "last_craft", "Crafting", "craft", "Craft")
}
func (g *Game) doConstruct(sess *net.Session, input string) {
- g.doGenericStationSkill(sess, input, "construction", player.Construction, "last_construct", "Construction", "construct", "Construct")
+ g.doStationSkill(sess, input, "construction", player.Construction, "last_construct", "Construction", "construct", "Construct")
}
-func (g *Game) doGenericStationSkill(sess *net.Session, input string, recipeType string, skill player.SkillName, flagKey, label, verbPast, verbCap string) {
+func (g *Game) doStationSkill(sess *net.Session, input string, recipeType string, skill player.SkillName, flagKey, label, verbPast, verbCap string) {
p := sess.Player
g.cancelAction(p)
@@ -39,14 +39,14 @@ func (g *Game) doGenericStationSkill(sess *net.Session, input string, recipeType
if r.Type != recipeType {
continue
}
- if !g.genericRecipeVisible(p, &r) {
+ if !g.recipeVisible(p, &r) {
continue
}
recipes = append(recipes, r)
}
if input != "" {
- g.doGenericWithInput(sess, p, recipes, input, skill, flagKey, label, verbCap)
+ g.doWithInput(sess, p, recipes, input, skill, flagKey, label, verbCap)
return
}
@@ -55,8 +55,8 @@ func (g *Game) doGenericStationSkill(sess *net.Session, input string, recipeType
for i := range recipes {
if recipes[i].ID == lastRecipeID {
r := &recipes[i]
- if g.canDoGenericRecipe(p, r, skill) {
- g.startGenericRecipe(sess, p, r, 0, flagKey)
+ if g.canDoRecipe(p, r, skill) {
+ g.startRecipe(sess, p, r, 0, flagKey)
return
}
break
@@ -64,7 +64,7 @@ func (g *Game) doGenericStationSkill(sess *net.Session, input string, recipeType
}
}
- available := g.availableGenericRecipes(p, recipes)
+ available := g.availableRecipes(p, recipes)
if len(available) == 0 {
sess.WriteLine("You don't have any materials to " + verbPast + ".")
return
@@ -72,14 +72,14 @@ func (g *Game) doGenericStationSkill(sess *net.Session, input string, recipeType
optionKey := verbPast + "_all"
if p.OptionBool(optionKey) && len(available) == 1 {
- g.startGenericRecipe(sess, p, &available[0], 0, flagKey)
+ g.startRecipe(sess, p, &available[0], 0, flagKey)
return
}
g.showProductionTable(sess, p, available, label, recipeType, flagKey, verbCap, false)
}
-func (g *Game) doGenericWithInput(sess *net.Session, p *player.Player, recipes []action.RecipeDef, input string, skill player.SkillName, flagKey, label, verbCap string) {
+func (g *Game) doWithInput(sess *net.Session, p *player.Player, recipes []action.RecipeDef, input string, skill player.SkillName, flagKey, label, verbCap string) {
qty, productName := parseQty(input)
productName = strings.TrimSpace(productName)
@@ -102,7 +102,7 @@ func (g *Game) doGenericWithInput(sess *net.Session, p *player.Player, recipes [
var available []action.RecipeDef
for _, r := range matched {
- if g.canDoGenericRecipe(p, &r, skill) {
+ if g.canDoRecipe(p, &r, skill) {
available = append(available, r)
}
}
@@ -113,14 +113,14 @@ func (g *Game) doGenericWithInput(sess *net.Session, p *player.Player, recipes [
}
if len(available) == 1 {
- g.startGenericRecipe(sess, p, &available[0], qty, flagKey)
+ g.startRecipe(sess, p, &available[0], qty, flagKey)
return
}
g.showProductionTable(sess, p, available, label, label, flagKey, verbCap, false)
}
-func (g *Game) genericRecipeVisible(p *player.Player, r *action.RecipeDef) bool {
+func (g *Game) recipeVisible(p *player.Player, r *action.RecipeDef) bool {
if len(r.Station) > 0 {
stID, _ := g.findStation(p.RoomID, r.Station)
if stID == "" {
@@ -133,7 +133,7 @@ func (g *Game) genericRecipeVisible(p *player.Player, r *action.RecipeDef) bool
return true
}
-func (g *Game) canDoGenericRecipe(p *player.Player, r *action.RecipeDef, skill player.SkillName) bool {
+func (g *Game) canDoRecipe(p *player.Player, r *action.RecipeDef, skill player.SkillName) bool {
if p.Level(skill) < r.Level {
return false
}
@@ -152,7 +152,7 @@ func (g *Game) canDoGenericRecipe(p *player.Player, r *action.RecipeDef, skill p
return true
}
-func (g *Game) availableGenericRecipes(p *player.Player, allRecipes []action.RecipeDef) []action.RecipeDef {
+func (g *Game) availableRecipes(p *player.Player, allRecipes []action.RecipeDef) []action.RecipeDef {
var result []action.RecipeDef
for _, r := range allRecipes {
if r.HasAllItemsQty(p.CountItem) {
@@ -162,7 +162,7 @@ func (g *Game) availableGenericRecipes(p *player.Player, allRecipes []action.Rec
return result
}
-func (g *Game) startGenericRecipe(sess *net.Session, p *player.Player, recipe *action.RecipeDef, count int, flagKey string) {
+func (g *Game) startRecipe(sess *net.Session, p *player.Player, recipe *action.RecipeDef, count int, flagKey string) {
p.EnsureFlags()
p.Flags[flagKey] = recipe.ID
g.AccountStore.SaveCharacter(p)
@@ -170,7 +170,7 @@ func (g *Game) startGenericRecipe(sess *net.Session, p *player.Player, recipe *a
g.startProductionFromRecipe(sess, p, recipe, count)
}
-func (g *Game) findCraftRecipesForItems(p *player.Player, itemAID, itemBID string) []action.RecipeDef {
+func (g *Game) findCraftRecipes(p *player.Player, itemAID, itemBID string) []action.RecipeDef {
allRecipes, err := g.RecipeStore.LoadAll()
if err != nil {
return nil