diff options
| author | historia <[not public]> | 2026-06-21 03:46:25 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-06-21 03:46:25 -0400 |
| commit | 84072ffe6365ad57c4976e9272762aa6db41de7e (patch) | |
| tree | d911389fd91e129871c23ec539e67a2666d9f78a /internal/player | |
| parent | e4bc2de6e6aa507044a6a75b4c1954974539a857 (diff) | |
| download | thehouseoficarus-84072ffe6365ad57c4976e9272762aa6db41de7e.tar.gz | |
feat: better score output
Diffstat (limited to 'internal/player')
| -rw-r--r-- | internal/player/player.go | 5 | ||||
| -rw-r--r-- | internal/player/stats.go | 27 |
2 files changed, 32 insertions, 0 deletions
diff --git a/internal/player/player.go b/internal/player/player.go index 1ddb3ea..7953691 100644 --- a/internal/player/player.go +++ b/internal/player/player.go @@ -189,6 +189,7 @@ type Player struct { Sneaking bool `yaml:"-"` SneakNotified map[string]bool `yaml:"-"` ActiveBuffs []PotionBuff `yaml:"-"` + Stats PlayerStats `yaml:"stats"` } type PotionBuff struct { @@ -311,6 +312,10 @@ func New(name string) *Player { AttackStyle: Accurate, Prompt: "> ", RoomID: 0, + Stats: PlayerStats{ + RoomsVisited: make(map[int]bool), + MobKills: make(map[string]int), + }, } for _, s := range AllSkills { p.Skills[s] = 0 diff --git a/internal/player/stats.go b/internal/player/stats.go new file mode 100644 index 0000000..82b741c --- /dev/null +++ b/internal/player/stats.go @@ -0,0 +1,27 @@ +package player + +type PlayerStats struct { + RoomsVisited map[int]bool `yaml:"rooms_visited,omitempty"` + MobKills map[string]int `yaml:"mob_kills,omitempty"` + TotalKills int `yaml:"total_kills"` + Deaths int `yaml:"deaths"` +} + +func (s *PlayerStats) RecordRoomVisit(roomID int) { + if s.RoomsVisited == nil { + s.RoomsVisited = make(map[int]bool) + } + s.RoomsVisited[roomID] = true +} + +func (s *PlayerStats) RecordMobKill(mobDefID string) { + if s.MobKills == nil { + s.MobKills = make(map[string]int) + } + s.MobKills[mobDefID]++ + s.TotalKills++ +} + +func (s *PlayerStats) RecordDeath() { + s.Deaths++ +} |
