diff options
| author | historia <[not public]> | 2026-06-09 17:15:13 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-06-09 17:15:13 -0400 |
| commit | 9edc568e16741d443b67fbd23b0d91790085ced9 (patch) | |
| tree | d54be40531ba124dcf8299f9e94bfba4ece273ae /internal/player | |
| parent | 56be6a3f45830594225a765b406816e6179ccde1 (diff) | |
| download | thehouseoficarus-9edc568e16741d443b67fbd23b0d91790085ced9.tar.gz | |
combat, mobs, parsing, toggles, hard disconnect handling
Diffstat (limited to 'internal/player')
| -rw-r--r-- | internal/player/player.go | 62 |
1 files changed, 52 insertions, 10 deletions
diff --git a/internal/player/player.go b/internal/player/player.go index 33689c5..581fc04 100644 --- a/internal/player/player.go +++ b/internal/player/player.go @@ -33,6 +33,29 @@ var AllSkills = []SkillName{ Alchemy, Thieving, Agility, Construction, Scavenging, Hunter, } +var SkillAbbr = map[SkillName]string{ + Attack: "atk", + Strength: "str", + Defense: "def", + Hitpoints: "hp", + Ranged: "rng", + Science: "sci", + Technology: "tec", + Fishing: "fis", + Cooking: "cok", + Woodcutting: "wct", + Mining: "min", + Smithing: "smt", + Crafting: "cft", + Fletching: "flt", + Alchemy: "alc", + Thieving: "thv", + Agility: "agl", + Construction: "con", + Scavenging: "scv", + Hunter: "hnt", +} + type AttackStyle string const ( @@ -57,15 +80,18 @@ type InventorySlot struct { } type Player struct { - Name string `yaml:"name"` - Skills map[SkillName]int `yaml:"skills"` // xp - Inventory map[int]*InventorySlot `yaml:"inventory"` // slot 0-27 -> item - Equipment map[object.EquipSlot]string `yaml:"equipment"` // slot -> item_id - Toolbelt []string `yaml:"toolbelt"` // item_ids - RoomID int `yaml:"room_id"` - HP int `yaml:"hp"` - Credits int `yaml:"credits"` - AttackStyle AttackStyle `yaml:"attack_style"` + Name string `yaml:"name"` + Skills map[SkillName]int `yaml:"skills"` // xp + Inventory map[int]*InventorySlot `yaml:"inventory"` // slot 0-27 -> item + Equipment map[object.EquipSlot]string `yaml:"equipment"` // slot -> item_id + Toolbelt []string `yaml:"toolbelt"` // item_ids + RoomID int `yaml:"room_id"` + HP int `yaml:"hp"` + Credits int `yaml:"credits"` + Description string `yaml:"description"` + AttackStyle AttackStyle `yaml:"attack_style"` + Toggles map[string]bool `yaml:"toggles"` + RegenerateTick int } func (p *Player) InvSlot(i int) *InventorySlot { @@ -106,7 +132,17 @@ func New(name string) *Player { Skills: make(map[SkillName]int), Equipment: make(map[object.EquipSlot]string), AttackStyle: Accurate, - RoomID: 0, + Toggles: map[string]bool{ + "description": true, + "tinymap": true, + "xpdrops": true, + "exits": true, + "mobenter": true, + "mobleave": true, + "mobspawn": true, + "reserve": true, + }, + RoomID: 0, } for _, s := range AllSkills { p.Skills[s] = 0 @@ -145,3 +181,9 @@ func (p *Player) CombatLevel() int { func (p *Player) MaxHP() int { return p.Level(Hitpoints) } + +func (p *Player) StartRegen() { + if p.RegenerateTick == 0 { + p.RegenerateTick = 100 + } +} |
