blob: acfa76e17461839de5fe34e1c7e94de7856022ab (
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
55
56
57
58
59
|
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
}
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, " "))
}
|