-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.lua
197 lines (174 loc) · 3.74 KB
/
main.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
--- STEAMODDED HEADER
--- MOD_NAME: Deselect All
--- MOD_ID: deselect-all
--- MOD_AUTHOR: [Zei33]
--- MOD_DESCRIPTION: Adds a button to deselect all highlighted cards.
--- BADGE_COLOUR: 3576de
--- VERSION: 1.0.0
--- PREFIX: zeid
local deselect_all_timer = 0;
local original_create_UIBox_buttons = nil;
original_create_UIBox_buttons = create_UIBox_buttons
function create_UIBox_buttons()
local text_scale = 0.45
local button_height = 1.3
local deselect_button_text = {
n=G.UIT.T,
config={
text = "Deselect",
scale = text_scale,
colour = G.C.UI.TEXT_LIGHT,
func = 'set_button_pip'
}
}
local deselect_button = {
n=G.UIT.C,
config={
id = 'deselect_button',
align = "tm",
minw = 2.5,
padding = 0.3,
r = 0.1,
hover = true,
colour = G.C.ORANGE,
button = "deselect_all_highlighted",
shadow = true,
func = "deselect_all_some_highlighted",
deselect_button_text = deselect_button_text
},
nodes={
{
n=G.UIT.R,
config={
align = "bcm",
padding = 0
},
nodes={
deselect_button_text
}
},
}
}
local t = original_create_UIBox_buttons()
table.insert(t.nodes, deselect_button)
return t
end
original_create_UIBox_arcana_pack = create_UIBox_arcana_pack
function create_UIBox_arcana_pack()
local deselect_button_text = {
n=G.UIT.T,
config={
text = "Deselect",
scale = 0.5,
colour = G.C.WHITE,
shadow = true,
func = 'set_button_pip'
}
}
local deselect_button = {
n=G.UIT.C,
config={
align = "tm",
padding = 0.05,
minw = 2.4
},
nodes={
{
n=G.UIT.R,
config={minh=0.2},
nodes={}
},
{
n=G.UIT.R,
config={
align = "tr",
padding = 0.2,
minh = 1.2,
minw = 1.8,
r=0.15,
colour = G.C.ORANGE,
button = 'deselect_all_highlighted',
hover = true,
shadow = true,
func = 'deselect_all_some_highlighted',
deselect_button_text = deselect_button_text
},
nodes = {
deselect_button_text
}
}
}
}
local t = original_create_UIBox_arcana_pack()
t.nodes[1].nodes[3].nodes[1] = deselect_button
return t
end
original_create_UIBox_spectral_pack = create_UIBox_spectral_pack
function create_UIBox_spectral_pack()
local deselect_button_text = {
n=G.UIT.T,
config={
text = "Deselect",
scale = 0.5,
colour = G.C.WHITE,
shadow = true,
func = 'set_button_pip'
}
}
local deselect_button = {
n=G.UIT.C,
config={
align = "tm",
padding = 0.05,
minw = 2.4
},
nodes={
{
n=G.UIT.R,
config={minh=0.2},
nodes={}
},
{
n=G.UIT.R,
config={
align = "tr",
padding = 0.2,
minh = 1.2,
minw = 1.8,
r=0.15,
colour = G.C.ORANGE,
button = 'deselect_all_highlighted',
hover = true,
shadow = true,
func = 'deselect_all_some_highlighted',
deselect_button_text = deselect_button_text
},
nodes = {
deselect_button_text
}
}
}
}
local t = original_create_UIBox_spectral_pack()
t.nodes[1].nodes[3].nodes[1] = deselect_button
return t
end
G.FUNCS.deselect_all_some_highlighted = function(e)
if #G.hand.highlighted > 0 then
e.config.colour = G.C.ORANGE
e.config.button = 'deselect_all_highlighted'
e.config.deselect_button_text.config.colour = G.C.UI.TEXT_LIGHT
elseif deselect_all_timer > 0 then
e.config.colour = G.C.UI.BACKGROUND_INACTIVE
e.config.button = '' -- Needs to be done to get button back into normal state
deselect_all_timer = deselect_all_timer - 1
else
e.config.colour = G.C.UI.BACKGROUND_INACTIVE
e.config.button = nil
end
end
G.FUNCS.deselect_all_highlighted = function(e)
deselect_all_timer = 7
G.hand:unhighlight_all()
e.config.deselect_button_text.config.colour = G.C.UI.TEXT_DARK
end