From a1b6613c6c6a2f8d6e1ecd47e766bd40f92ac295 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Sun, 28 Jun 2026 02:40:30 -0400 Subject: feat: admin accounts, god mode, OLC commands like dig/room, 'inline' objects changed to 'local' objects --- internal/game/cmd_god.go | 63 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 internal/game/cmd_god.go (limited to 'internal/game/cmd_god.go') 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 +} -- cgit v1.2.3