diff options
Diffstat (limited to 'internal/game/action_burn.go')
| -rw-r--r-- | internal/game/action_burn.go | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/internal/game/action_burn.go b/internal/game/action_burn.go index 0230f24..4d8b65e 100644 --- a/internal/game/action_burn.go +++ b/internal/game/action_burn.go @@ -13,9 +13,9 @@ import ( func (g *Game) doBurn(sess *net.Session, p *player.Player, input string) { if p.Action != nil { - g.CancelAction(p) + g.cancelAction(p) } - g.CancelBackgroundAction(p) + g.cancelBackgroundAction(p) itemID, fromGround, ambiguous := g.resolveBurnTarget(p, input) if ambiguous { @@ -32,9 +32,9 @@ func (g *Game) doBurn(sess *net.Session, p *player.Player, input string) { func (g *Game) doStoke(sess *net.Session, p *player.Player, input string) { if p.Action != nil { - g.CancelAction(p) + g.cancelAction(p) } - g.CancelBackgroundAction(p) + g.cancelBackgroundAction(p) if !g.hasFireObject(p.RoomID) { sess.WriteLine("There's no fire here to stoke.") @@ -183,14 +183,14 @@ func (g *Game) advanceBurn(sess *net.Session, p *player.Player) { logDef, err := g.ItemStore.Load(itemID) if err != nil { - g.CancelAction(p) + g.cancelAction(p) return } if phase == 0 { if !p.HasItem(itemID) { sess.WriteLine(fmt.Sprintf("You're out of %s.", g.itemColorize(sess, logDef, logDef.Name))) - g.CancelAction(p) + g.cancelAction(p) return } p.RemoveItem(itemID, 1) @@ -208,7 +208,7 @@ func (g *Game) advanceBurn(sess *net.Session, p *player.Player) { ground := g.World.GroundItems(p.RoomID) if ground[itemID] <= 0 { sess.WriteLine("The thing you were trying to burn is gone.") - g.CancelAction(p) + g.cancelAction(p) return } @@ -235,13 +235,11 @@ func (g *Game) advanceBurn(sess *net.Session, p *player.Player) { xp := logDef.FireXP if xp > 0 { - if newLevel := p.AddSkillXP(player.Firemaking, xp); newLevel > 0 { - sess.WriteLine(g.colorize(sess, "level_up", fmt.Sprintf("*** You are now level %d firemaking! ***", newLevel))) - } + g.awardSkillXP(sess, p, player.Firemaking, xp) } g.AccountStore.SaveCharacter(p) - g.CancelAction(p) + g.cancelAction(p) msg := g.colorize(sess, "fire", "You manage to get a fire going!") if xp > 0 && p.OptionBool("xp_drops") { @@ -273,7 +271,7 @@ func (g *Game) advanceStoke(sess *net.Session, p *player.Player) { st := g.World.GetObjStateByKey(fireKey) if st == nil || st.Quality <= 0 { sess.WriteLine("The fire went out!") - g.CancelAction(p) + g.cancelAction(p) return } @@ -285,7 +283,7 @@ func (g *Game) advanceStoke(sess *net.Session, p *player.Player) { if !p.HasItem(itemID) { sess.WriteLine(g.colorize(sess, "fire", fmt.Sprintf("You're out of %s and the fire is roaring.", g.itemColorize(sess, logDef, name)))) - g.CancelAction(p) + g.cancelAction(p) return } @@ -293,9 +291,7 @@ func (g *Game) advanceStoke(sess *net.Session, p *player.Player) { st.Quality += burnTicks / 2 if xp > 0 { - if newLevel := p.AddSkillXP(player.Firemaking, xp); newLevel > 0 { - sess.WriteLine(g.colorize(sess, "level_up", fmt.Sprintf("*** You are now level %d firemaking! ***", newLevel))) - } + g.awardSkillXP(sess, p, player.Firemaking, xp) } g.AccountStore.SaveCharacter(p) @@ -308,7 +304,7 @@ func (g *Game) advanceStoke(sess *net.Session, p *player.Player) { if !p.HasItem(itemID) { sess.WriteLine(g.colorize(sess, "fire", fmt.Sprintf("You're out of %s and the fire is roaring.", g.itemColorize(sess, logDef, name)))) - g.CancelAction(p) + g.cancelAction(p) return } @@ -416,8 +412,8 @@ func (g *Game) hasFireObject(roomID int) bool { func (g *Game) broadcastDrop(p *player.Player, itemName string) { for _, other := range g.Hub.PlayersInRoom(p.RoomID) { - op, ok := other.Player.(*player.Player) - if ok && op.Name != p.Name { + op := other.Player + if op != nil && op.Name != p.Name { other.WriteLine(fmt.Sprintf("\n%s drops a %s.", p.Name, itemName)) } } @@ -438,10 +434,10 @@ func (g *Game) FireTick() { func (g *Game) cancelStokers(roomID int) { for _, other := range g.Hub.PlayersInRoom(roomID) { - op, ok := other.Player.(*player.Player) - if ok && op.Action != nil && op.Action.Type == "stoke" { + op := other.Player + if op != nil && op.Action != nil && op.Action.Type == "stoke" { other.WriteLine("The fire went out!") - g.CancelAction(op) + g.cancelAction(op) g.writePrompt(other) } } |
