diff options
| author | historia <[not public]> | 2026-06-12 23:52:06 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-06-12 23:52:06 -0400 |
| commit | a19e6b6ab01670a5932308c7bd0e0e5eed8cbcad (patch) | |
| tree | 80a2e46c3e6cc98bb8b4f708cc403949b14742eb /internal/player | |
| parent | f3a6ae488bbd2128af8356b0da016699c5abb70e (diff) | |
| download | thehouseoficarus-a19e6b6ab01670a5932308c7bd0e0e5eed8cbcad.tar.gz | |
feat: firemaking skill implemented. overhauled how ground items and despawn are handled.
Diffstat (limited to 'internal/player')
| -rw-r--r-- | internal/player/player.go | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/internal/player/player.go b/internal/player/player.go index 97874e3..332656c 100644 --- a/internal/player/player.go +++ b/internal/player/player.go @@ -82,8 +82,10 @@ func (s Skill) Level() int { } type InventorySlot struct { - ItemID string `yaml:"item_id"` - Quantity int `yaml:"quantity"` + ItemID string `yaml:"item_id"` + Quantity int `yaml:"quantity"` + Quality int `yaml:"quality,omitempty"` + MaxQuality int `yaml:"max_quality,omitempty"` } type OptionType int @@ -113,6 +115,7 @@ var OptionDefs = []OptionDef{ {"mobspawn", OptBool, true, nil, "Messages when mobs spawn in the area"}, {"reserve", OptBool, true, nil, "Show full reserved item details"}, {"depletion", OptBool, false, nil, "Show depletion and despawn timers"}, + {"despawn", OptBool, false, nil, "Show ground item despawn timers"}, {"color", OptString, "none", []string{"none", "ansi", "xterm256"}, "Color output mode"}, {"mapwidth", OptInt, 30, nil, "Map width for the map command"}, {"mapheight", OptInt, 20, nil, "Map height for the map command"}, @@ -138,6 +141,7 @@ type Player struct { Skills map[SkillName]int `yaml:"skills"` Inventory map[int]*InventorySlot `yaml:"inventory"` Equipment map[object.EquipSlot]string `yaml:"equipment"` + EquipQuality map[string]int `yaml:"equip_quality,omitempty"` RoomID int `yaml:"room_id"` HP int `yaml:"hp"` Credits int `yaml:"credits"` @@ -273,6 +277,16 @@ func (p *Player) AddXP(s SkillName, amount int) { p.Skills[s] += amount } +func (p *Player) AddSkillXP(s SkillName, amount int) int { + oldLevel := p.Level(s) + p.AddXP(s, amount) + newLevel := p.Level(s) + if newLevel > oldLevel { + return newLevel + } + return 0 +} + func (p *Player) CombatLevel() int { base := 0.25 * float64(p.Level(Defense)+p.Level(Hitpoints)+p.Level(Science)) att := float64(p.Level(Attack)) |
