diff options
| author | historia <[not public]> | 2026-07-01 22:39:42 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-07-01 22:39:42 -0400 |
| commit | 778157981cccb8cb4856e3ab5a72085830c59120 (patch) | |
| tree | 95a69bd1586609cdc960a1e721cbde0b4cfa1b9a /internal/player/store.go | |
| parent | c14c2e403c75a913e1a6d962fb6fe64f013adae5 (diff) | |
| download | thehouseoficarus-778157981cccb8cb4856e3ab5a72085830c59120.tar.gz | |
feat: god <level> lets admins set all stats to level
Diffstat (limited to 'internal/player/store.go')
| -rw-r--r-- | internal/player/store.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/internal/player/store.go b/internal/player/store.go index bcadf3b..bc5db11 100644 --- a/internal/player/store.go +++ b/internal/player/store.go @@ -103,6 +103,18 @@ func (s *AccountStore) LoadCharacter(name string) (*Player, error) { func (s *AccountStore) SaveCharacter(p *Player) error { path := s.CharPath(p.Name) + if p.GodMode && p.GodBackup != nil { + buffedSkills := p.Skills + buffedHP := p.HP + p.Skills = p.GodBackup + if p.HP > p.MaxHP() { + p.HP = p.MaxHP() + } + defer func() { + p.Skills = buffedSkills + p.HP = buffedHP + }() + } data, err := yaml.Marshal(p) if err != nil { return err |
