-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsteamodded.lua
241 lines (231 loc) · 6.01 KB
/
steamodded.lua
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
--- STEAMODDED HEADER
--- MOD_NAME: Hey, Listen!
--- MOD_ID: HeyListen
--- MOD_AUTHOR: [SleepyG11]
--- MOD_DESCRIPTION: You have voucher to buy!
--- PRIORITY: 0
--- DISPLAY_NAME: Hey, Listen!
--- PREFIX: HeyListen
--- VERSION: 1.0.2
----------------------------------------------
------------MOD CODE -------------------------
--- Merge target table with source tables
--- @param target table
--- @param ... table[]
--- @return table
local function table_merge(target, ...)
assert(type(target) == "table", "Target is not a table")
local tables_to_merge = { ... }
if #tables_to_merge == 0 then
return target
end
for k, t in ipairs(tables_to_merge) do
assert(type(t) == "table", string.format("Expected a table as parameter %d", k))
end
for i = 1, #tables_to_merge do
local from = tables_to_merge[i]
for k, v in pairs(from) do
if type(k) == "number" then
table.insert(target, v)
elseif type(k) == "string" then
if type(v) == "table" then
target[k] = target[k] or {}
target[k] = table_merge(target[k], v)
else
target[k] = v
end
end
end
end
return target
end
HeyListen.current_mod = SMODS.current_mod
HeyListen.config = table_merge(HeyListen.config, SMODS.current_mod.config or {})
SMODS.current_mod.config = HeyListen.config
function HeyListen.save_config()
SMODS.save_mod_config(HeyListen.current_mod)
end
function G.FUNCS.hey_listen_set_notification_level(arg)
HeyListen.config.notification_levels[arg.cycle_config.listener] = arg.to_key
HeyListen.save_config()
end
HeyListen.UI = {}
HeyListen.UI.PARTS = {
create_config_section = function(label, nodes)
return {
n = G.UIT.R,
config = { align = "cm", padding = 0.05, colour = G.C.BLACK, r = 0.5, minw = 5 },
nodes = {
{
n = G.UIT.R,
config = { align = "cm", padding = 0.1 },
nodes = {
{
n = G.UIT.T,
config = {
align = "cm",
text = label,
colour = G.C.WHITE,
scale = 0.45,
shadow = true,
},
},
},
},
{
n = G.UIT.R,
config = { align = "cm" },
nodes = nodes,
},
},
}
end,
create_section_separator = function()
return {
n = G.UIT.R,
config = { h = 0.1 },
}
end,
}
HeyListen.current_mod.extra_tabs = function()
return {
{
label = "Shop",
tab_definition_function = function()
return {
n = G.UIT.ROOT,
config = { align = "cm", padding = 0.05, colour = G.C.CLEAR },
nodes = {
HeyListen.UI.PARTS.create_config_section("On buy", {
create_option_cycle({
w = 4,
label = "Discount vouchers",
scale = 0.6,
options = {
"Never",
"Once per ante",
"Once per shop",
},
opt_callback = "hey_listen_set_notification_level",
listener = "sale_voucher",
current_option = HeyListen.config.notification_levels.sale_voucher,
}),
}),
HeyListen.UI.PARTS.create_section_separator(),
HeyListen.UI.PARTS.create_config_section("On shop reroll", {
{
n = G.UIT.C,
config = { align = "cm" },
nodes = {
create_option_cycle({
w = 4,
label = "Overstock vouchers",
scale = 0.6,
options = {
"Never",
"Once per ante",
"Once per shop",
},
opt_callback = "hey_listen_set_notification_level",
listener = "overstock_voucher",
current_option = HeyListen.config.notification_levels.overstock_voucher,
}),
},
},
{
n = G.UIT.C,
config = { align = "cm" },
nodes = {
create_option_cycle({
w = 4,
label = "Reroll discount vouchers",
scale = 0.6,
options = {
"Never",
"Once per ante",
"Once per shop",
},
opt_callback = "hey_listen_set_notification_level",
listener = "surplus_voucher",
current_option = HeyListen.config.notification_levels.surplus_voucher,
}),
},
},
}),
HeyListen.UI.PARTS.create_section_separator(),
HeyListen.UI.PARTS.create_config_section("On booster skip", {
create_option_cycle({
w = 4,
label = "Constellation on Celestial pack",
scale = 0.6,
options = {
"Never",
"Once per ante",
"Once per booster",
},
opt_callback = "hey_listen_set_notification_level",
listener = "constellation_joker",
current_option = HeyListen.config.notification_levels.constellation_joker,
}),
}),
},
}
end,
},
{
label = "Blind",
tab_definition_function = function()
return {
n = G.UIT.ROOT,
config = { align = "cm", padding = 0.05, colour = G.C.CLEAR },
nodes = {
HeyListen.UI.PARTS.create_config_section("On blind select", {
create_option_cycle({
w = 4,
label = "Ceremonial Dagger",
scale = 0.6,
options = {
"Never",
"Once per ante",
"Once per round",
},
opt_callback = "hey_listen_set_notification_level",
listener = "dagger_joker",
current_option = HeyListen.config.notification_levels.dagger_joker,
}),
}),
HeyListen.UI.PARTS.create_section_separator(),
HeyListen.UI.PARTS.create_config_section("On hand play", {
{
n = G.UIT.C,
config = { align = "cm" },
nodes = {
create_option_cycle({
w = 4,
label = "The Psychic boss blind",
scale = 0.6,
options = {
"Never",
"Once per ante",
},
opt_callback = "hey_listen_set_notification_level",
listener = "psychic_blind",
current_option = HeyListen.config.notification_levels.psychic_blind,
}),
},
},
}),
},
}
end,
},
}
end
SMODS.Atlas({
key = "modicon",
path = "icon.png",
px = 47,
py = 47,
})
----------------------------------------------
------------MOD CODE END----------------------