blob: 2b63558a8d5cf3247d146c329b0ddd736c03e53d (
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
|
package player
type PlayerStats struct {
RoomsVisited RoomSet `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) {
s.RoomsVisited.Add(roomID)
}
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++
}
|