diff options
| author | historia <[not public]> | 2026-07-01 03:21:52 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-07-01 03:21:52 -0400 |
| commit | fbe5090ac3325ff8ea6989cdf4515c7f077c975b (patch) | |
| tree | 1811ad9c6a596e7177bb2c42944c389c0a120066 /internal/game/act_gather.go | |
| parent | 5f37dc9b6f6b79da04da70ae0c33ec8d02998587 (diff) | |
| download | thehouseoficarus-fbe5090ac3325ff8ea6989cdf4515c7f077c975b.tar.gz | |
feat: item messaging standardized, custom messages for production paths implemented
Diffstat (limited to 'internal/game/act_gather.go')
| -rw-r--r-- | internal/game/act_gather.go | 25 |
1 files changed, 16 insertions, 9 deletions
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) |
