aboutsummaryrefslogtreecommitdiff
path: root/internal/action/behavior.go
blob: 4071f0d29ce9a2b01323cc399dfeccda7e41e886 (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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
package action

type GatherConfig struct {
	Skill            string         `yaml:"skill"`
	Level            int            `yaml:"level"`
	XP               int            `yaml:"xp"`
	BaseWait         float64        `yaml:"base_wait"`
	Tools            []string       `yaml:"tools"`
	Bait             string         `yaml:"bait"`
	Success          SuccessFormula `yaml:"success"`
	GatherMsg        string         `yaml:"gather_message"`
	DepletedMessage  string         `yaml:"depleted_message"`
	ExhaustedMessage string         `yaml:"exhausted_message"`
	FailMsg          string         `yaml:"fail_message"`
	Drops            []DropEntry    `yaml:"drops"`
	RespawnTimer     float64        `yaml:"respawn_timer"`
	RespawnBroadcast string         `yaml:"respawn_broadcast"`
	DepleteTimer     float64        `yaml:"deplete_timer"`
	NestChance       int            `yaml:"nest_chance"`
}

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"`
	SetPlayerFlags map[string]any `yaml:"set_player_flags"`
	GiveItem       string         `yaml:"give_item"`
	TakeItem       string         `yaml:"take_item"`
	Teleport       int            `yaml:"teleport"`
	Heal           int            `yaml:"heal"`
	Cost           int            `yaml:"cost"`
	Shop           *ShopConfig    `yaml:"shop"`
	AssignTask     bool           `yaml:"assign_task"`
	SkipTask       bool           `yaml:"skip_task"`
	ExtendTask     bool           `yaml:"extend_task"`
	ReputationCost int            `yaml:"reputation_cost"`
	Sawmill        bool           `yaml:"sawmill"`
}

type ShopConfig struct {
	Message string     `yaml:"message"`
	Items   []ShopItem `yaml:"items"`
}

type ShopItem struct {
	ItemID    string `yaml:"item_id"`
	BuyPrice  int    `yaml:"buy_price"`
	SellPrice int    `yaml:"sell_price"`
}

type Condition struct {
	Flag       string       `yaml:"flag"`
	Value      any          `yaml:"value"`
	Not        bool         `yaml:"not"`
	PlayerFlag string       `yaml:"player_flag"`
	HasItem    string       `yaml:"has_item"`
	MinCredits int          `yaml:"min_credits"`
	AllOf      []Condition  `yaml:"all_of"`
	AnyOf      []Condition  `yaml:"any_of"`
}

type UseConfig struct {
	Message string          `yaml:"message"`
	Wait    float64         `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"`
	XP      int             `yaml:"xp"`
}