aboutsummaryrefslogtreecommitdiff
path: root/internal/player/stats.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/player/stats.go')
-rw-r--r--internal/player/stats.go27
1 files changed, 27 insertions, 0 deletions
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++
+}