aboutsummaryrefslogtreecommitdiff
path: root/internal/game/action_fletch.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-06-19 18:20:26 -0400
committerhistoria <[not public]>2026-06-19 18:20:26 -0400
commit0ea4eec5dd2122c6704216971eb1249276297867 (patch)
tree430fbbef04e837820f1d031c190f52ecd6112e25 /internal/game/action_fletch.go
parent3a58125d14bb307f861b38c6c5b0a63babde7e08 (diff)
downloadthehouseoficarus-0ea4eec5dd2122c6704216971eb1249276297867.tar.gz
shop fixes, 'toggle' completely removed, movement speed increased
Diffstat (limited to 'internal/game/action_fletch.go')
-rw-r--r--internal/game/action_fletch.go22
1 files changed, 8 insertions, 14 deletions
diff --git a/internal/game/action_fletch.go b/internal/game/action_fletch.go
index ddb4d2c..aa5dfc7 100644
--- a/internal/game/action_fletch.go
+++ b/internal/game/action_fletch.go
@@ -10,9 +10,7 @@ import (
)
func (g *Game) startFletchAction(sess *net.Session, p *player.Player, recipe *action.RecipeDef, count int) {
- if p.Flags == nil {
- p.Flags = make(map[string]any)
- }
+ p.EnsureFlags()
p.Flags["last_fletch"] = recipe.ID
g.AccountStore.SaveCharacter(p)
@@ -61,9 +59,7 @@ func (g *Game) doInstantFletch(sess *net.Session, p *player.Player, recipe *acti
}
if recipe.XP > 0 {
- if newLevel := p.AddSkillXP(skill, recipe.XP); newLevel > 0 {
- sess.WriteLine(g.colorize(sess, "level_up", fmt.Sprintf("*** You are now level %d %s! ***", newLevel, recipe.EffectiveSkill())))
- }
+ g.awardSkillXP(sess, p, skill, recipe.XP)
}
batches++
@@ -138,7 +134,7 @@ func (g *Game) advanceFletch(sess *net.Session, p *player.Player) {
recipe := g.loadProductionRecipe(recipeID)
if recipe == nil {
- g.CancelBackgroundAction(p)
+ g.cancelBackgroundAction(p)
return
}
@@ -150,7 +146,7 @@ func (g *Game) advanceFletch(sess *net.Session, p *player.Player) {
if !g.canDoFletchRecipe(p, recipe) {
sess.WriteLine("\nYou've run out of fletching materials.")
- g.CancelBackgroundAction(p)
+ g.cancelBackgroundAction(p)
return
}
@@ -179,16 +175,14 @@ func (g *Game) advanceFletch(sess *net.Session, p *player.Player) {
freeSlot := p.FirstFreeSlot()
if freeSlot == -1 {
sess.WriteLine("\nYour inventory is too full!")
- g.CancelBackgroundAction(p)
+ g.cancelBackgroundAction(p)
return
}
p.SetInvSlot(freeSlot, &player.InventorySlot{ItemID: recipe.Output, Quantity: outputQty})
}
if recipe.XP > 0 {
- if newLevel := p.AddSkillXP(skill, recipe.XP); newLevel > 0 {
- sess.WriteLine(g.colorize(sess, "level_up", fmt.Sprintf("*** You are now level %d %s! ***", newLevel, recipe.EffectiveSkill())))
- }
+ g.awardSkillXP(sess, p, skill, recipe.XP)
}
g.AccountStore.SaveCharacter(p)
@@ -211,14 +205,14 @@ func (g *Game) advanceFletch(sess *net.Session, p *player.Player) {
p.BackgroundAction.Data["remaining"] = remaining
if remaining <= 0 {
sess.WriteLine("\nYou've finished fletching.")
- g.CancelBackgroundAction(p)
+ g.cancelBackgroundAction(p)
return
}
}
if !g.canContinueProduction(p, recipe) {
sess.WriteLine("\nYou've run out of fletching materials.")
- g.CancelBackgroundAction(p)
+ g.cancelBackgroundAction(p)
return
}