aboutsummaryrefslogtreecommitdiff
path: root/internal/game/render_xpdrop.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-06-25 15:40:48 -0400
committerhistoria <[not public]>2026-06-25 15:40:48 -0400
commitabd612c15799f604e671e83dc7c410ed2b44185f (patch)
tree0597ca92350de73aac2a7cf26b2f2d6595dac0cc /internal/game/render_xpdrop.go
parent2725e2927a1595c7b100d942d1f14146252adeb7 (diff)
downloadthehouseoficarus-abd612c15799f604e671e83dc7c410ed2b44185f.tar.gz
slop refactor
Diffstat (limited to 'internal/game/render_xpdrop.go')
-rw-r--r--internal/game/render_xpdrop.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/internal/game/render_xpdrop.go b/internal/game/render_xpdrop.go
new file mode 100644
index 0000000..a9bff23
--- /dev/null
+++ b/internal/game/render_xpdrop.go
@@ -0,0 +1,31 @@
+package game
+
+import (
+ "fmt"
+ "strings"
+
+ "thehouseoficarus/internal/net"
+ "thehouseoficarus/internal/player"
+)
+
+// formatXpDrop returns the colored XP-drop suffix for a slice of gains, or ""
+// if xp_drops are disabled or there are no gains.
+func (g *Game) formatXpDrop(sess *net.Session, p *player.Player, gains []xpGain) string {
+ if !p.OptionBool("xp_drops") || len(gains) == 0 {
+ return ""
+ }
+ var parts []string
+ for _, gain := range gains {
+ parts = append(parts, fmt.Sprintf("+%dxp %s", gain.XP, player.SkillAbbr[player.SkillName(gain.Skill)]))
+ }
+ return g.colorize(sess, "xp", " ("+strings.Join(parts, ", ")+")")
+}
+
+// formatXpDropSingle returns the colored XP-drop suffix for a single skill, or ""
+// if xp_drops are disabled or xp is 0.
+func (g *Game) formatXpDropSingle(sess *net.Session, p *player.Player, skill player.SkillName, xp int) string {
+ if !p.OptionBool("xp_drops") || xp <= 0 {
+ return ""
+ }
+ return g.colorize(sess, "xp", fmt.Sprintf(" (+%dxp %s)", xp, player.SkillAbbr[skill]))
+}