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])) }