aboutsummaryrefslogtreecommitdiff
path: root/internal/action/behavior.go
blob: d7f683aa6c2fa1c7c21d758429c5d22b9873fce4 (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
60
61
62
63
64
65
66
67
68
package action

type GatherConfig struct {
	Skill            string         `yaml:"skill"`
	Level            int            `yaml:"level"`
	BaseWait         int            `yaml:"base_wait"`
	Tool             string         `yaml:"tool"`
	Success          SuccessFormula `yaml:"success"`
	GatherMsg        string         `yaml:"gather_message"`
	FailMsg          string         `yaml:"fail_message"`
	Drops            []DropEntry    `yaml:"drops"`
	DepleteDelay     int            `yaml:"deplete_delay"`
	RespawnMsg       string         `yaml:"respawn_message"`
	RespawnBroadcast string         `yaml:"respawn_broadcast"`
}

type SuccessFormula struct {
	Base     float64 `yaml:"base"`
	PerLevel float64 `yaml:"per_level"`
	Cap      float64 `yaml:"cap"`
}

type TalkConfig struct {
	Nodes map[string]TalkNode `yaml:"nodes"`
}

type TalkNode struct {
	Message string       `yaml:"message"`
	Options []TalkOption `yaml:"options"`
	Action  *NodeAction  `yaml:"action"`
}

type TalkOption struct {
	Text      string     `yaml:"text"`
	Goto      string     `yaml:"goto"`
	End       bool       `yaml:"end"`
	Condition *Condition `yaml:"condition"`
}

type NodeAction struct {
	SetFlags map[string]any `yaml:"set_flags"`
	GiveItem string         `yaml:"give_item"`
	TakeItem string         `yaml:"take_item"`
}

type Condition struct {
	Flag    string `yaml:"flag"`
	Value   any    `yaml:"value"`
	Not     bool   `yaml:"not"`
	HasItem string `yaml:"has_item"`
}

type UseConfig struct {
	Message string         `yaml:"message"`
	Wait    int            `yaml:"wait"`
	Consume map[string]int `yaml:"consume"`
	Reward  DropEntry      `yaml:"reward"`
	FailMsg string         `yaml:"fail_message"`
	Success *SuccessFormula `yaml:"success"`
	Skill   string         `yaml:"skill"`
	Level   int            `yaml:"level"`
}

type ToggleConfig struct {
	Message  string         `yaml:"message"`
	SetFlags map[string]any `yaml:"set_flags"`
	Check    *Condition     `yaml:"check"`
}