From fbe5090ac3325ff8ea6989cdf4515c7f077c975b Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Wed, 1 Jul 2026 03:21:52 -0400 Subject: feat: item messaging standardized, custom messages for production paths implemented --- internal/game/act_gather.go | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'internal/game/act_gather.go') diff --git a/internal/game/act_gather.go b/internal/game/act_gather.go index ab59de0..c34c6ae 100644 --- a/internal/game/act_gather.go +++ b/internal/game/act_gather.go @@ -106,7 +106,12 @@ func (g *Game) startGather(sess *net.Session, p *player.Player, obj *object.Obje verb = "chopping" } - g.broadcastAction(sess, "%s starts %s the %s.", p.Name, verb, obj.Name) + if cfg.BroadcastMessage != "" { + bcMsg := strings.ReplaceAll(cfg.BroadcastMessage, "%o", obj.Name) + g.broadcastAction(sess, bcMsg, p.Name) + } else { + g.broadcastAction(sess, "%s starts %s the %s.", p.Name, verb, obj.Name) + } d := &behavior.GatherData{ ObjDefID: obj.ID, @@ -158,7 +163,7 @@ func (g *Game) advanceGather(sess *net.Session, p *player.Player) { return } } - sess.WriteLine(fmt.Sprintf("%s", cfg.GatherMsg)) + sess.WriteLine(fmt.Sprintf("%s", cfg.GatherMessage)) d.Step = 1 p.Action.WaitLeft = engine.ToTicks(wait) return @@ -220,12 +225,14 @@ func (g *Game) advanceGather(sess *net.Session, p *player.Player) { } g.AccountStore.SaveCharacter(p) - msg := drop.Message - if msg == "" { - msg = fmt.Sprintf("You manage to get some %s.", g.itemColorize(sess, itemDef, itemName)) - } else { - msg = color.ExpandTags(g.colorMode(sess), msg) - } + msg := drop.SuccessMessage + coloredName := g.itemColorize(sess, itemDef, itemName) + if msg == "" { + msg = fmt.Sprintf("You manage to get some %s.", coloredName) + } else { + msg = strings.ReplaceAll(msg, "%n", coloredName) + msg = color.ExpandTags(g.colorMode(sess), msg) + } if xp > 0 && p.OptionBool("xp_drops") { msg += g.formatXpDropSingle(sess, p, player.SkillName(cfg.Skill), xp) } @@ -294,7 +301,7 @@ func (g *Game) advanceGather(sess *net.Session, p *player.Player) { } } - sess.WriteLine(cfg.FailMsg) + sess.WriteLine(cfg.FailMessage) if p.FirstFreeSlot() == -1 { sess.WriteLine(g.colorize(sess, "error", "Your inventory is too full!")) g.cancelAction(p) -- cgit v1.2.3