blob: 3c417350f69c4b0b63307021ddd5be44a93dae1e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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))
}
|