Mercurial > wow > turok
comparison Turok/Modules/Timer/Icon.lua @ 9:9400a0ff8540
Ugh
Timer:
- container update directionality
- talent update iterates over a non-volatile table to carry out updates
- index management steps organized
- talentRow status implemented, returns the spell associated with the talent chosen from that row
CombatLog:
- sort out font controls and unbork arguments
author | Nenue |
---|---|
date | Sun, 21 Feb 2016 13:08:30 -0500 |
parents | a9b8b0866ece |
children |
comparison
equal
deleted
inserted
replaced
8:7790dff0fe13 | 9:9400a0ff8540 |
---|---|
12 local print = function(...) | 12 local print = function(...) |
13 if _G.Devian and _G.DevianDB.workspace ~= 1 then | 13 if _G.Devian and _G.DevianDB.workspace ~= 1 then |
14 _G.print('Icon', ...) | 14 _G.print('Icon', ...) |
15 end | 15 end |
16 end | 16 end |
17 print('Peep!', ...) | |
18 --@end-debug@ | 17 --@end-debug@ |
19 local GetPrint = function(trace) | 18 local GetPrint = function(trace) |
20 if trace then | 19 if trace then |
21 return print | 20 return print |
22 else | 21 else |
78 end | 77 end |
79 print('icon texture=', self.spellIcon or self.itemIcon) | 78 print('icon texture=', self.spellIcon or self.itemIcon) |
80 self.icon:SetTexture(self.spellIcon or self.itemIcon) | 79 self.icon:SetTexture(self.spellIcon or self.itemIcon) |
81 end | 80 end |
82 | 81 |
82 local function Icon_UpdateCooldown(self) | |
83 self.spiral:Show() | |
84 self.spiral:SetCooldown(self.charges and self.chargeStart or (self.override and self.override_start or self.start), self.charges and self.chargeDuration or (self.override and self.override_duration or self.duration)) | |
85 print('spiral:Play() new', self.charges and self.chargeStart or self.start, self.charges and self.chargeDuration or self.duration) | |
86 end | |
83 | 87 |
84 --- Advances the display state, applying any visual transitions as necessary; | 88 --- Advances the display state, applying any visual transitions as necessary; |
85 -- @param self frame object | 89 -- @param self frame object |
86 -- @param newState state value; 1 for inactive, 2 for untimed active, 3 for timed active | 90 -- @param newState state value; 1 for inactive, 2 for untimed active, 3 for timed active |
87 -- @param forcePrevious force the frame's lastState to this value to block off OnUpdate difference tests | 91 -- @param forcePrevious force the frame's lastState to this value to block off OnUpdate difference tests |
128 | 132 |
129 if newState == ACTIVE then | 133 if newState == ACTIVE then |
130 | 134 |
131 -- and is ACTIVE | 135 -- and is ACTIVE |
132 self:Show() | 136 self:Show() |
133 self.spiral:Show() | 137 Icon_UpdateCooldown(self) |
134 self.spiral:SetCooldown(self.charges and self.chargeStart or self.start, self.charges and self.chargeDuration or self.duration) | |
135 print('spiral:Play() new', self.charges and self.chargeStart or self.start, self.charges and self.chargeDuration or self.duration) | |
136 end | 138 end |
137 | 139 |
138 if previous and previous ~= HIDDEN then | 140 if previous and previous ~= HIDDEN then |
139 print(cText(' from vis')) | 141 print(cText(' from vis')) |
140 -- from visible | 142 -- from visible |
141 if self.event then | 143 if self.event then |
142 self.refresh = true | 144 self.refresh = true |
143 self.Retro:Play() | |
144 end | 145 end |
145 else | 146 else |
146 print(cText(' from non-vis')) | 147 print(cText(' from non-vis')) |
147 if self.event then | 148 if self.event then |
148 self.Intro:Play() | 149 self.Intro:Play() |
153 end | 154 end |
154 else | 155 else |
155 --- No-change transitions | 156 --- No-change transitions |
156 if newState == ACTIVE then | 157 if newState == ACTIVE then |
157 -- ACTIVE to ACTIVE | 158 -- ACTIVE to ACTIVE |
158 print(cText('')) | 159 Icon_UpdateCooldown(self) |
159 self.spiral:Show() | |
160 self.spiral:SetCooldown(self.charges and self.chargeStart or self.start, self.charges and self.chargeDuration or self.duration) | |
161 print('spiral:Play() new', self.charges and self.chargeStart or self.start, self.charges and self.chargeDuration or self.duration) | |
162 else | 160 else |
163 print(cPink('stopping spiral')) | 161 print(cPink('stopping spiral')) |
164 self.spiral:Hide() | 162 self.spiral:Hide() |
165 end | 163 end |
166 | 164 |
167 -- non-HIDDEN to non-HIDDEN and not a dry fire | 165 -- non-HIDDEN to non-HIDDEN and not a dry fire |
168 if self.event and newState ~= HIDDEN then | 166 if self.event and newState ~= HIDDEN then |
169 self.refresh = true | 167 self.refresh = true |
170 self.Retro:Play() | |
171 end | 168 end |
172 end | 169 end |
173 | 170 |
174 if newState ~= HIDDEN then | 171 if newState ~= HIDDEN then |
175 print(cText(' CVars:')) | 172 print(cText(' CVars:')) |
176 local c | 173 local c |
177 if newState == ACTIVE then | 174 if newState == ACTIVE then |
178 print('apply active profile') | 175 if self.override then |
179 c = self.cvars.active | 176 c = self.cvars.override |
177 print('apply override profile') | |
178 else | |
179 print('apply active profile') | |
180 c = self.cvars.active | |
181 end | |
182 | |
180 self.fillState = 1 | 183 self.fillState = 1 |
181 else | 184 else |
182 print('apply passive profile') | 185 print('apply passive profile') |
183 c = self.cvars.passive | 186 c = self.cvars.passive |
184 self.fillState = 2 | 187 self.fillState = 2 |
218 self.refresh = nil | 221 self.refresh = nil |
219 end | 222 end |
220 -- prevState is set externally | 223 -- prevState is set externally |
221 local time = GetTime() | 224 local time = GetTime() |
222 if self.expires <= time and self.charges == self.maxCharges then | 225 if self.expires <= time and self.charges == self.maxCharges then |
223 _G.print(self.cvars.type, 'timer expired, set to', (self.cvars.persist and self.flags.passive or self.flags.hidden)) | 226 print(self.cvars.type, 'timer expired, set to', (self.cvars.persist and self.flags.passive or self.flags.hidden)) |
224 self.percent = 1 | 227 self.percent = 1 |
225 self.duration = 0 | 228 self.duration = 0 |
226 self.expires = 0 | 229 self.expires = 0 |
227 self.start= 0 | 230 self.start= 0 |
228 self.valueFull = self.duration | 231 self.valueFull = self.duration |
229 self.value = self.duration | 232 self.value = self.duration |
230 self.elapsed = self.duration | 233 self.elapsed = self.duration |
231 self.remaining = 0 | 234 self.remaining = 0 |
232 self:SetState(self.cvars.persist and self.flags.passive or self.flags.hidden) | 235 self:SetState(self.cvars.persist and self.flags.passive or self.flags.hidden) |
233 else | 236 else |
234 self.percent = (self.charges and self.charges < self.maxCharges) and ((time - self.chargeStart) / self.chargeDuration) or ((time - self.start) / self.duration) | 237 -- unit_aura is too ambiguous |
235 self.valueFull = self.expires - time | 238 if self.override and self.override_expires < time then |
239 self.override = nil | |
240 self:SetState(self.flags.active) | |
241 end | |
242 | |
243 if self.override then | |
244 self.valueFull = self.override_start + self.override_duration - time | |
245 self.percent = (time - self.override_start) / self.override_duration | |
246 elseif self.charges and self.charges < self.charges_max then | |
247 self.valueFull = self.charge_expires - time | |
248 self.percent = (time - self.charge_start) / self.charge_duration | |
249 else | |
250 self.valueFull = self.expires - time | |
251 self.percent = (time - self.start) / self.duration | |
252 end | |
253 | |
236 self.elapsed = time - self.start | 254 self.elapsed = time - self.start |
237 self.remaining = self.duration - time | 255 self.remaining = self.duration - time |
238 | 256 |
239 self.value = floor(self.valueFull) | 257 self.value = floor(self.valueFull) |
240 end | 258 end |