From a19e6b6ab01670a5932308c7bd0e0e5eed8cbcad Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Fri, 12 Jun 2026 23:52:06 -0400 Subject: feat: firemaking skill implemented. overhauled how ground items and despawn are handled. --- internal/game/action_gather.go | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'internal/game/action_gather.go') diff --git a/internal/game/action_gather.go b/internal/game/action_gather.go index 2ca2e82..7e53e87 100644 --- a/internal/game/action_gather.go +++ b/internal/game/action_gather.go @@ -214,7 +214,9 @@ func (g *Game) advanceGather(sess *net.Session, p *player.Player) { xp = cfg.XP } if xp > 0 { - p.AddXP(player.SkillName(cfg.Skill), xp) + if newLevel := p.AddSkillXP(player.SkillName(cfg.Skill), xp); newLevel > 0 { + sess.WriteLine(fmt.Sprintf("*** You are now level %d %s! ***", newLevel, cfg.Skill)) + } } g.AccountStore.SaveCharacter(p) @@ -232,7 +234,7 @@ func (g *Game) advanceGather(sess *net.Session, p *player.Player) { if shared { st := g.World.GetObjStateByKey(instanceKey) if st != nil && st.SharedTimer <= 0 { - g.depleteSharedTree(sess, p, st, cfg.DepleteDelay, instanceKey) + g.depleteSharedTree(sess, p, st, cfg, instanceKey) return } } @@ -301,12 +303,17 @@ func filterDropsByLevel(drops []action.DropEntry, level int) []action.DropEntry return eligible } -func (g *Game) depleteSharedTree(sess *net.Session, p *player.Player, st *world.ObjState, respawnTicks int, instanceKey string) { +func (g *Game) depleteSharedTree(sess *net.Session, p *player.Player, st *world.ObjState, cfg *action.GatherConfig, instanceKey string) { st.Depleted = true - st.DepleteTimer = respawnTicks + st.DepleteTimer = cfg.DepleteDelay st.SharedTimer = 0 - sess.WriteLine(fmt.Sprintf("\nThe %s falls to the ground!", p.Action.TargetName)) + msg := cfg.ExhaustedMessage + if msg == "" { + msg = fmt.Sprintf("The %s falls to the ground!", p.Action.TargetName) + } + + sess.WriteLine(fmt.Sprintf("\n%s", msg)) for _, other := range g.Hub.PlayersInRoom(p.RoomID) { if other == sess { @@ -317,7 +324,7 @@ func (g *Game) depleteSharedTree(sess *net.Session, p *player.Player, st *world. continue } if op.Action.Data["instance_key"] == instanceKey { - other.WriteLine(fmt.Sprintf("\nThe %s falls to the ground!", p.Action.TargetName)) + other.WriteLine(fmt.Sprintf("\n%s", msg)) g.CancelAction(op) } } -- cgit v1.2.3