blob: 82b741c252b256c5503de33d360da29d55fad4bc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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++
}
|