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 ' 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 } lower := strings.ToLower(input) if lower == "off" || lower == "none" { p.AutotriggerMod = "" sess.WriteLine("Autotrigger disabled.") return } mod := FindModForPlayer(lower, p.Level(player.Science)) 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)) } func (g *Game) executeAutotrigger(sess *net.Session, args []string, rawInput string) { g.doAutotrigger(sess, strings.Join(args, " ")) }