aboutsummaryrefslogtreecommitdiff
path: root/internal/game/sys_labor.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/game/sys_labor.go')
-rw-r--r--internal/game/sys_labor.go36
1 files changed, 2 insertions, 34 deletions
diff --git a/internal/game/sys_labor.go b/internal/game/sys_labor.go
index 102c54e..43f7bb2 100644
--- a/internal/game/sys_labor.go
+++ b/internal/game/sys_labor.go
@@ -2,7 +2,6 @@ package game
import (
"fmt"
- "strings"
"thehouseoficarus/internal/net"
"thehouseoficarus/internal/player"
@@ -23,31 +22,7 @@ func taskWorkVerb(mob *world.MobInstance) string {
// inverse of hpBar. It is used for task worksites whose internal HP drains to 0
// to complete the work (progress = MaxHP - HP).
func (g *Game) progressBar(sess *net.Session, progress, max int) string {
- if max <= 0 {
- max = 1
- }
- if progress < 0 {
- progress = 0
- }
- if progress > max {
- progress = max
- }
-
- pct := float64(progress) / float64(max) * 100.0
- var fgColor int
- switch {
- case pct >= 70:
- fgColor = 82
- case pct >= 40:
- fgColor = 220
- default:
- fgColor = 39
- }
-
- unicode := sess.Player != nil && sess.Player.OptionBool("unicode")
- style := &BarStyle{FilledColor: fgColor, EmptyColor: 238, EmptyDim: true}
- bar := RenderColoredBar(progress, max, 10, unicode, style, g.colorMode(sess))
- return "[" + bar + "]"
+ return g.renderBar(sess, progress, max, 39)
}
// writeTaskProgress prints the per-tick progress line for a task worksite,
@@ -69,13 +44,6 @@ func (g *Game) writeTaskProgress(sess *net.Session, p *player.Player, mob *world
prefix := fmt.Sprintf("You advance the %s on %s.", noun, g.colorize(sess, "mob", mobDisplayName(mob, true)))
line := fmt.Sprintf("%s %s %3d%%", prefix, g.progressBar(sess, progress, mob.MaxHP), pct)
-
- if p.OptionBool("xp_drops") && len(gains) > 0 {
- var parts []string
- for _, gain := range gains {
- parts = append(parts, fmt.Sprintf("+%dxp %s", gain.XP, player.SkillAbbr[player.SkillName(gain.Skill)]))
- }
- line += g.colorize(sess, "xp", " ("+strings.Join(parts, ", ")+")")
- }
+ line += g.formatXpDrop(sess, p, gains)
sess.WriteLine(line)
}