diff options
| author | historia <[not public]> | 2026-06-28 02:40:30 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-06-28 02:40:30 -0400 |
| commit | a1b6613c6c6a2f8d6e1ecd47e766bd40f92ac295 (patch) | |
| tree | 4ff8fefb029c93f2aa3db7361658b0b4e9805b66 /internal/game/cmd_god.go | |
| parent | 87dacfbb3dd16e7f55a82361eace98f9a39d75c8 (diff) | |
| download | thehouseoficarus-a1b6613c6c6a2f8d6e1ecd47e766bd40f92ac295.tar.gz | |
feat: admin accounts, god mode, OLC commands like dig/room, 'inline' objects changed to 'local' objects
Diffstat (limited to 'internal/game/cmd_god.go')
| -rw-r--r-- | internal/game/cmd_god.go | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/internal/game/cmd_god.go b/internal/game/cmd_god.go new file mode 100644 index 0000000..0545c3f --- /dev/null +++ b/internal/game/cmd_god.go @@ -0,0 +1,63 @@ +package game + +import ( + "thehouseoficarus/internal/net" + "thehouseoficarus/internal/player" +) + +func (g *Game) executeGod(sess *net.Session, args []string, rawInput string) { + if !g.checkAdmin(sess) { + sess.WriteLine("Unknown command.") + return + } + p := sess.Player + if p == nil { + return + } + if p.GodMode { + sess.WriteLine("You are already in god mode.") + return + } + + p.GodBackup = make(map[player.SkillName]int, len(p.Skills)) + for k, v := range p.Skills { + p.GodBackup[k] = v + } + + lvl99xp := player.XPForLevel(99) + for _, s := range player.AllSkills { + p.Skills[s] = lvl99xp + } + p.GodMode = true + p.HP = p.MaxHP() + + sess.WriteLine("God mode activated. All skills set to 99.") +} + +func (g *Game) executeUnGod(sess *net.Session, args []string, rawInput string) { + if !g.checkAdmin(sess) { + sess.WriteLine("Unknown command.") + return + } + p := sess.Player + if p == nil { + return + } + if !p.GodMode { + sess.WriteLine("You are not in god mode.") + return + } + g.restoreGodPlayer(p) + sess.WriteLine("God mode deactivated. Skills restored.") +} + +func (g *Game) restoreGodPlayer(p *player.Player) { + if p == nil || !p.GodMode { + return + } + if p.GodBackup != nil { + p.Skills = p.GodBackup + } + p.GodMode = false + p.GodBackup = nil +} |
