diff options
| author | historia <[not public]> | 2026-06-19 18:20:26 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-06-19 18:20:26 -0400 |
| commit | 0ea4eec5dd2122c6704216971eb1249276297867 (patch) | |
| tree | 430fbbef04e837820f1d031c190f52ecd6112e25 /internal/game/cmd_autotrigger.go | |
| parent | 3a58125d14bb307f861b38c6c5b0a63babde7e08 (diff) | |
| download | thehouseoficarus-0ea4eec5dd2122c6704216971eb1249276297867.tar.gz | |
shop fixes, 'toggle' completely removed, movement speed increased
Diffstat (limited to 'internal/game/cmd_autotrigger.go')
| -rw-r--r-- | internal/game/cmd_autotrigger.go | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/internal/game/cmd_autotrigger.go b/internal/game/cmd_autotrigger.go new file mode 100644 index 0000000..3c41735 --- /dev/null +++ b/internal/game/cmd_autotrigger.go @@ -0,0 +1,54 @@ +package game + +import ( + "fmt" + "strings" + + "thehouseoficarus/internal/net" + "thehouseoficarus/internal/player" +) + +func (g *Game) doAutotrigger(sess *net.Session, input string) { + p := sess.Player + input = strings.TrimSpace(input) + + if input == "" { + if p.AutotriggerMod == "" { + sess.WriteLine("No autotrigger mod set. Use 'autotrigger <mod>' to set one.") + } else { + mod := GetMod(p.AutotriggerMod) + if mod == nil { + sess.WriteLine("Autotrigger: none (invalid mod)") + p.AutotriggerMod = "" + } else { + sess.WriteLine(fmt.Sprintf("Autotrigger: %s (Lv%d)", mod.Name, mod.Level)) + } + } + return + } + + if strings.ToLower(input) == "off" { + p.AutotriggerMod = "" + sess.WriteLine("Autotrigger disabled.") + return + } + + mod := FindMod(strings.ToLower(input)) + if mod == nil { + sess.WriteLine("Unknown mod.") + return + } + + if mod.Category != ModCombat { + sess.WriteLine("You can only autotrigger combat mods.") + return + } + + if p.Level(player.Science) < mod.Level { + sess.WriteLine(fmt.Sprintf("You need level %d science to autotrigger %s.", mod.Level, mod.Name)) + return + } + + p.AutotriggerMod = mod.ID + sess.WriteLine(fmt.Sprintf("Autotrigger set to: %s", mod.Name)) +} |
