Nenue@1
|
1 addon, T_ = ...
|
Nenue@1
|
2 -- User: Krakyn
|
Nenue@1
|
3 -- Created: 12/4/2015 11:17 PM
|
Nenue@1
|
4 local T = LibStub("AceAddon-3.0"):GetAddon("Turok")
|
Nenue@1
|
5 local TL = 'Tek'
|
Nenue@1
|
6 local mod = T:NewModule("Tek")
|
Nenue@1
|
7 local print = function(...)
|
Nenue@1
|
8 _G.print('Tek', ...)
|
Nenue@1
|
9 end
|
Nenue@1
|
10 local time = _G.ct
|
Nenue@1
|
11
|
Nenue@1
|
12 -- events & units
|
Nenue@1
|
13 local TRACKED_UNITS = {'player', 'target', 'focus', 'pet'}
|
Nenue@1
|
14 local TRACKED_EVENTS = {'UNIT_SPELLCAST_START', 'UNIT_SPELLCAST_DELAYED', 'UNIT_SPELLCAST_STOP', 'UNIT_SPELLCAST_FAILED', 'UNIT_SPELLCAST_FAILED_QUIET',
|
Nenue@1
|
15 'UNIT_SPELLCAST_INTERRUPTED', 'UNIT_SPELLCAST_SUCCEEDED', 'UNIT_SPELLCAST_CHANNEL_START', 'UNIT_SPELLCAST_CHANNEL_STOP', 'UNIT_SPELLCAST_CHANNEL_UPDATE' }
|
Nenue@1
|
16
|
Nenue@1
|
17 local FADE_OUT_TIME, FADE_IN_TIME = 1000, 200 -- animation timings
|
Nenue@1
|
18
|
Nenue@1
|
19 -- values MUST be in chronological order
|
Nenue@1
|
20 local CHANNEL_START, CAST_START, CAST_INTERRUPTED, CAST_SUCCEEDED, CAST_STOPPED, CAST_FAILED, CHANNEL_STOPPED = 1, 2, 3, 4, 5, 6, 7
|
Nenue@1
|
21 local TEXTURE_SUFFIX = {
|
Nenue@1
|
22 [CHANNEL_START] = '_channeling',
|
Nenue@1
|
23 [CAST_START] = '_casting',
|
Nenue@1
|
24 [CAST_INTERRUPTED] = '_interrupted',
|
Nenue@1
|
25 [CAST_SUCCEEDED] = '_finished',
|
Nenue@1
|
26 [CAST_STOPPED] = '_failed',
|
Nenue@1
|
27 [CAST_FAILED] = '_failed',
|
Nenue@1
|
28 [CHANNEL_STOPPED] = ''
|
Nenue@1
|
29 }
|
Nenue@1
|
30 local inv = T.anchor_inverse
|
Nenue@1
|
31 local d = T.direction_coord
|
Nenue@1
|
32 local a = T.anchor_direction
|
Nenue@1
|
33 local c = {}
|
Nenue@1
|
34 -- c[unit]=nil is used by frame update, thus any indexing from a valid frame is implied to be for new casting info
|
Nenue@1
|
35 setmetatable(c, {
|
Nenue@1
|
36 __index = function(t,k)
|
Nenue@1
|
37 t[k] = {}
|
Nenue@1
|
38 return t[k]
|
Nenue@1
|
39 end
|
Nenue@1
|
40 })
|
Nenue@1
|
41
|
Nenue@1
|
42 function mod:OnEnable()
|
Nenue@1
|
43 local db = T.db
|
Nenue@1
|
44
|
Nenue@1
|
45 db.castbar = {
|
Nenue@1
|
46 --T.defaults.castbar = {
|
Nenue@1
|
47 width = 300, height = 24,
|
Nenue@1
|
48 anchor = 'TOP', parent = 'TkFocusBar', anchorTo = 'BOTTOM',
|
Nenue@1
|
49 posX = 0, posY = -2,
|
Nenue@1
|
50 foreground_casting = {0.80784313725, 0.87843137254, 0.0156862745, 1},
|
Nenue@1
|
51 background_casting = {0,0,0,0.4},
|
Nenue@1
|
52 background_interrupted = {1,0,0,1},
|
Nenue@1
|
53 background_failed = {0.60784313725, 0.87843137254, 0.0156862745, 1},
|
Nenue@1
|
54 foreground_interrupted = {1, 0.5, 0, 1},
|
Nenue@1
|
55 foreground_failed = {0,0,0,1},
|
Nenue@1
|
56 foreground_finished = {0.60784313725, 0.87843137254, 0.0156862745, 1},
|
Nenue@1
|
57 background_finished = {0.60784313725, 0.87843137254, 0.0156862745, 1},
|
Nenue@1
|
58 foreground_inset = -1,
|
Nenue@1
|
59 fill_direction = 'RIGHT',
|
Nenue@1
|
60 fill_inverse = false,
|
Nenue@1
|
61 glow_texture = "Tooltip-BigBorder",
|
Nenue@1
|
62 glow_size = 2,
|
Nenue@1
|
63 spark_texture = "Tooltip-BigBorder",
|
Nenue@1
|
64 spark_size = 2,
|
Nenue@1
|
65 ['player'] = {},
|
Nenue@1
|
66 ['target'] = {
|
Nenue@1
|
67 width = 300, height = 24,
|
Nenue@1
|
68 anchor = 'BOTTOMLEFT', parent = 'TkplayerCastBar', anchorTo = 'TOPRIGHT',
|
Nenue@1
|
69 posX = 4, posY = 4,
|
Nenue@1
|
70 },
|
Nenue@1
|
71 ['focus'] = {
|
Nenue@1
|
72 width = 300, height = 24,
|
Nenue@1
|
73 anchor = 'TOPLEFT', parent = 'TkplayerCastBar', anchorTo='BOTTOMRIGHT',
|
Nenue@1
|
74 posX = 2, posY = -2
|
Nenue@1
|
75 },
|
Nenue@1
|
76 ['pet'] = {
|
Nenue@1
|
77 width = 300, height = 24,
|
Nenue@1
|
78 anchor = 'TOPRIGHT', parent = 'TkFocusBar', anchorTo='TOPLEFT',
|
Nenue@1
|
79 posX = -2, posY = 0
|
Nenue@1
|
80 },
|
Nenue@1
|
81 }
|
Nenue@1
|
82
|
Nenue@1
|
83 self.casting = c
|
Nenue@1
|
84 self.castbar = {}
|
Nenue@1
|
85
|
Nenue@1
|
86
|
Nenue@1
|
87 for _, unit in pairs(TRACKED_UNITS) do
|
Nenue@1
|
88 local cdb = db.castbar[unit]
|
Nenue@1
|
89 print('|cFFFF44FF' .. unit .. '|r castbar creation')
|
Nenue@1
|
90
|
Nenue@1
|
91
|
Nenue@1
|
92 -- State info
|
Nenue@1
|
93 c[unit] = {}
|
Nenue@1
|
94
|
Nenue@1
|
95 -- Set frames
|
Nenue@1
|
96 local fn = 'Tk' .. unit .. 'CastBar'
|
Nenue@1
|
97 self.castbar[unit] = T:CreateBar(fn, cdb)
|
Nenue@1
|
98 local pc = self.castbar[unit]
|
Nenue@1
|
99 pc:Hide()
|
Nenue@1
|
100 pc:SetAlpha(0)
|
Nenue@1
|
101
|
Nenue@1
|
102 T:AddLabel(pc, cdb, 'spelltext')
|
Nenue@1
|
103 local casttime = T:AddLabel(pc, cdb, 'casttime')
|
Nenue@1
|
104 local latency = T:AddLabel(pc, cdb, 'latency')
|
Nenue@1
|
105 pc.foreground:SetWidth(0)
|
Nenue@1
|
106
|
Nenue@1
|
107 casttime:SetPoint('RIGHT', pc, 'RIGHT')
|
Nenue@1
|
108 casttime:SetJustifyH('RIGHT')
|
Nenue@1
|
109 latency:SetPoint('TOPRIGHT', pc.casttime, 'BOTTOMRIGHT')
|
Nenue@1
|
110 latency:SetJustifyH('RIGHT')
|
Nenue@1
|
111
|
Nenue@1
|
112 pc.transpt = a[cdb.fill_direction]
|
Nenue@1
|
113 pc.xtrans = function() return math.min((cdb.width + cdb.foreground_inset) * pc.percent * d[pc.transpt][1], cdb.width) end
|
Nenue@1
|
114 pc.ytrans = function() return math.min((cdb.height + cdb.foreground_inset) * pc.percent * d[pc.transpt][2], cdb.height) end
|
Nenue@1
|
115
|
Nenue@1
|
116 pc.movement_x = 1
|
Nenue@1
|
117 pc.moving_end = 'LEFT'
|
Nenue@1
|
118
|
Nenue@1
|
119 local glow = pc:CreateTexture('glow', 'OVERLAY')
|
Nenue@1
|
120 glow:SetTexture(CASTBAR_TAILGLOW)
|
Nenue@1
|
121 glow:SetPoint('TOPLEFT', pc, 'TOPLEFT', -5, 5)
|
Nenue@1
|
122 glow:SetPoint('BOTTOMRIGHT', pc, 'BOTTOMRIGHT', 5, -5)
|
Nenue@1
|
123 pc.glow = glow
|
Nenue@1
|
124
|
Nenue@1
|
125 local icon = pc:CreateTexture('icon', 'ARTWORK')
|
Nenue@1
|
126 icon:SetPoint('RIGHT', pc, 'LEFT', -2, 0)
|
Nenue@1
|
127 icon:SetWidth(pc.foreground:GetHeight())
|
Nenue@1
|
128 icon:SetHeight(pc.foreground:GetHeight())
|
Nenue@1
|
129 icon:SetTexture(0,0,0,1)
|
Nenue@1
|
130 pc.icon = icon
|
Nenue@1
|
131
|
Nenue@1
|
132 pc.unit = unit
|
Nenue@1
|
133 T:Bar_SetUpdateHandler(pc, self.TekUpdate)
|
Nenue@1
|
134
|
Nenue@1
|
135
|
Nenue@1
|
136
|
Nenue@1
|
137 --print('created', fn)
|
Nenue@1
|
138 end
|
Nenue@1
|
139
|
Nenue@1
|
140 -- Casting table events
|
Nenue@1
|
141 for i, event in pairs(TRACKED_EVENTS) do
|
Nenue@1
|
142 print('listening to |cFF00FFFF' .. event .. '|r')
|
Nenue@1
|
143 self:RegisterEvent(event, 'TekEvent')
|
Nenue@1
|
144 end
|
Nenue@1
|
145
|
Nenue@1
|
146 -- Extra events
|
Nenue@1
|
147 self:RegisterEvent('PLAYER_TARGET_CHANGED')
|
Nenue@1
|
148 self:RegisterEvent('PLAYER_FOCUS_CHANGED')
|
Nenue@1
|
149
|
Nenue@1
|
150 CastingBarFrame:SetScript('OnUpdate', nil)
|
Nenue@1
|
151 CastingBarFrame:SetScript('OnEvent', nil)
|
Nenue@1
|
152 CastingBarFrame:Hide()
|
Nenue@1
|
153 end
|
Nenue@1
|
154
|
Nenue@1
|
155 -- Update handler for castbar
|
Nenue@1
|
156 function mod:TekUpdate()
|
Nenue@1
|
157 local glow = self.glow
|
Nenue@1
|
158 local foreground = self.foreground
|
Nenue@1
|
159 local background = self.background
|
Nenue@1
|
160 local latency = self.latency
|
Nenue@1
|
161 local time = GetTime() * 1000
|
Nenue@1
|
162 local spelltext = self.spelltext
|
Nenue@1
|
163 local timetext = self.timetext
|
Nenue@1
|
164 local cdb = self.db
|
Nenue@1
|
165 if mod.casting[self.unit] ~= nil then
|
Nenue@1
|
166
|
Nenue@1
|
167 local u = self.unit
|
Nenue@1
|
168 local s = mod.casting[u]
|
Nenue@1
|
169 local alpha = self:GetAlpha()
|
Nenue@1
|
170
|
Nenue@1
|
171 -- is something casting at all?
|
Nenue@1
|
172 if s.casting <= CAST_START then
|
Nenue@1
|
173
|
Nenue@1
|
174 -- start = true whenever a new spell cast could be active (i.e. target switching)
|
Nenue@1
|
175 if s.init then
|
Nenue@1
|
176 print('|cFFDD77DD'..u..'|r init_cast (spell='..s.displayName..', startTime='..s.startTime..', endTime='..s.endTime..', channel=',s.channel,')')
|
Nenue@1
|
177 print(self:GetName(), self:IsVisible(), self:IsShown())
|
Nenue@1
|
178
|
Nenue@1
|
179 -- update translation point
|
Nenue@1
|
180 if s.casting == CHANNEL_START and not cdb.fill_inverse then
|
Nenue@1
|
181 self.transpt = inv[a[cdb.fill_direction]]
|
Nenue@1
|
182 else
|
Nenue@1
|
183 self.transpt = a[cdb.fill_direction]
|
Nenue@1
|
184 end
|
Nenue@1
|
185
|
Nenue@1
|
186 -- update frame contents
|
Nenue@1
|
187 foreground:SetTexture(unpack(cdb['foreground' .. TEXTURE_SUFFIX[s.casting]] and cdb['foreground' .. TEXTURE_SUFFIX[s.casting]] or cdb.foreground_color))
|
Nenue@1
|
188 background:SetTexture(unpack(cdb['background' .. TEXTURE_SUFFIX[s.casting]] and cdb['background' .. TEXTURE_SUFFIX[s.casting]] or cdb.background_color))
|
Nenue@1
|
189
|
Nenue@1
|
190 self.icon:SetTexture(s.texture)
|
Nenue@1
|
191 spelltext:SetText(s.displayName)
|
Nenue@1
|
192 latency:SetText(s.latency)
|
Nenue@1
|
193 self.duration = s.endTime - s.startTime
|
Nenue@1
|
194 self.fadeIn = s.startTime + (1-alpha) * FADE_IN_TIME
|
Nenue@1
|
195 self.fadeOut = s.endTime + FADE_OUT_TIME -- needs to exist for target changes
|
Nenue@1
|
196
|
Nenue@1
|
197 print(s.startTime, self.fadeIn, self.fadeIn - s.startTime)
|
Nenue@1
|
198 -- clear 'start'
|
Nenue@1
|
199 s.init = nil
|
Nenue@1
|
200 end
|
Nenue@1
|
201
|
Nenue@1
|
202 -- if we're checking this and start was never flipped, then something happened
|
Nenue@1
|
203 if time <= self.fadeIn then
|
Nenue@1
|
204 alpha = 1- ((self.fadeIn - time) / FADE_IN_TIME)
|
Nenue@1
|
205 self:SetAlpha(alpha)
|
Nenue@1
|
206 elseif alpha ~= 1 then
|
Nenue@1
|
207 self:SetAlpha(1)
|
Nenue@1
|
208 end
|
Nenue@1
|
209 self.value = time - s.startTime
|
Nenue@1
|
210 self.percent = self.value / self.duration
|
Nenue@1
|
211 self.casttime:SetText(format("%.1f", self.value / 1000))
|
Nenue@1
|
212
|
Nenue@1
|
213 -- s.casting is nil when the spellcast has finished
|
Nenue@1
|
214 else
|
Nenue@1
|
215 -- something set a term flag
|
Nenue@1
|
216 if s.casting < CHANNEL_STOPPED and s.fade then
|
Nenue@1
|
217 print(TL, '|cFFDD77DD'..u..'|r init_fadeout (spell='..s.displayName..', startTime='..s.startTime..', endTime='..s.endTime..', channel=',s.channel,')')
|
Nenue@1
|
218 self.fadeOut = time + FADE_OUT_TIME
|
Nenue@1
|
219 foreground:SetTexture(unpack(cdb['foreground' .. TEXTURE_SUFFIX[s.casting]] and cdb['foreground' .. TEXTURE_SUFFIX[s.casting]] or cdb.foreground_color))
|
Nenue@1
|
220 background:SetTexture(unpack(cdb['background' .. TEXTURE_SUFFIX[s.casting]] and cdb['background' .. TEXTURE_SUFFIX[s.casting]] or cdb.background_color))
|
Nenue@1
|
221 s.fade = nil
|
Nenue@1
|
222 self.value = self.duration
|
Nenue@1
|
223 self.percent = 1
|
Nenue@1
|
224 end
|
Nenue@1
|
225
|
Nenue@1
|
226 if time < self.fadeOut then
|
Nenue@1
|
227 alpha = (self.fadeOut - time) / FADE_OUT_TIME
|
Nenue@1
|
228 self:SetAlpha(alpha)
|
Nenue@1
|
229 else
|
Nenue@1
|
230 alpha = 0
|
Nenue@1
|
231 self:Hide()
|
Nenue@1
|
232 self:SetAlpha(alpha)
|
Nenue@1
|
233 self.casttime:SetText(nil)
|
Nenue@1
|
234 self.spelltext:SetText(nil)
|
Nenue@1
|
235 self.latency:SetText(nil)
|
Nenue@1
|
236 self.debugged = false
|
Nenue@1
|
237 self.percent = 0
|
Nenue@1
|
238 mod.casting[self.unit] = nil
|
Nenue@1
|
239 print('|cFFDD77DD'..u..'|r work complete, hiding...')
|
Nenue@1
|
240 end
|
Nenue@1
|
241 -- hide and wait until we're pulled out again
|
Nenue@1
|
242 end
|
Nenue@1
|
243 self.foreground:SetPoint('RIGHT', self, self.transpt, self.xtrans(), self.ytrans())
|
Nenue@1
|
244 end
|
Nenue@1
|
245 end
|
Nenue@1
|
246
|
Nenue@1
|
247
|
Nenue@1
|
248 -- event stub, filters out unwanted cast events
|
Nenue@1
|
249 function mod:TekEvent(e, unit, ...)
|
Nenue@1
|
250 if not self.castbar[unit] then
|
Nenue@1
|
251 return
|
Nenue@1
|
252 end
|
Nenue@1
|
253 if not self[e] then
|
Nenue@1
|
254 error('No method signature for event ' .. tostring(e))
|
Nenue@1
|
255 end
|
Nenue@1
|
256 print('popped |cFF00FFFF' .. e .. '|r: ', unit, ...)
|
Nenue@1
|
257 self[e](self, e, unit, ...)
|
Nenue@1
|
258 end
|
Nenue@1
|
259
|
Nenue@1
|
260 function mod:PLAYER_TARGET_CHANGED (e, cause)
|
Nenue@1
|
261 print(e)
|
Nenue@1
|
262 self:UpdateUnit('target')
|
Nenue@1
|
263 end
|
Nenue@1
|
264 function mod:PLAYER_FOCUS_CHANGED (e, cause)
|
Nenue@1
|
265 print(e)
|
Nenue@1
|
266 self:UpdateUnit('focus')
|
Nenue@1
|
267 end
|
Nenue@1
|
268 function mod:UpdateUnit(unit)
|
Nenue@1
|
269 if UnitCastingInfo(unit) then
|
Nenue@1
|
270 mod:UNIT_SPELLCAST_START('UNIT_SPELLCAST_START', unit)
|
Nenue@1
|
271 elseif UnitChannelInfo(unit) then
|
Nenue@1
|
272 mod:UNIT_SPELLCAST_CHANNEL_START('UNIT_SPELLCAST_CHANNEL_START', unit)
|
Nenue@1
|
273 else
|
Nenue@1
|
274 mod.castbar[unit]:Hide()
|
Nenue@1
|
275 end
|
Nenue@1
|
276 end
|
Nenue@1
|
277
|
Nenue@1
|
278 -- Spell event handlers
|
Nenue@1
|
279 function mod:UNIT_SPELLCAST_SENT(e, unit, spellname, rank, target)
|
Nenue@1
|
280 -- triggered an action buttton tied to a cast
|
Nenue@1
|
281 c[unit].sentTime = math.floor(GetTime() * 1000)
|
Nenue@1
|
282 print('|cFF44FF44',e,':|r', unit, spellname, c[unit].sentTime)
|
Nenue@1
|
283 c[unit].spell = spellname
|
Nenue@1
|
284 c[unit].rank = rank
|
Nenue@1
|
285 c[unit].target = target
|
Nenue@1
|
286 end
|
Nenue@1
|
287
|
Nenue@1
|
288 function mod:UNIT_SPELLCAST_START(e, unit) -- Server says: someone started casting
|
Nenue@1
|
289 local spellname, rank, displayName, texture, startTime, endTime, isTradeSkill, castID, nonInterruptible = UnitCastingInfo(unit)
|
Nenue@1
|
290 print('casting['..unit..'] state updated (=start): spellname='.. spellname ..', startTime='.. startTime ..', endTime='.. endTime)
|
Nenue@1
|
291
|
Nenue@1
|
292 c[unit].castID = castID
|
Nenue@1
|
293 c[unit].spell = spellname
|
Nenue@1
|
294 c[unit].rank = rank
|
Nenue@1
|
295 c[unit].displayName = displayName
|
Nenue@1
|
296 c[unit].texture = texture
|
Nenue@1
|
297 c[unit].startTime = startTime
|
Nenue@1
|
298 c[unit].endTime = endTime
|
Nenue@1
|
299 c[unit].nonInterruptible = nonInterruptible
|
Nenue@1
|
300 c[unit].isTradeSkill = isTradeSkill
|
Nenue@1
|
301 if c[unit].sentTime then
|
Nenue@1
|
302 c[unit].latency = c[unit].startTime - c[unit].sentTime
|
Nenue@1
|
303 end
|
Nenue@1
|
304
|
Nenue@1
|
305 -- set state and show
|
Nenue@1
|
306 c[unit].casting = CAST_START
|
Nenue@1
|
307 c[unit].init = true
|
Nenue@1
|
308 self.castbar[unit]:Show()
|
Nenue@1
|
309 end
|
Nenue@1
|
310
|
Nenue@1
|
311 function mod:UNIT_SPELLCAST_DELAYED(e, unit, spellname, rank, castID, target) -- Server says: they're still casting but it'll take longer
|
Nenue@1
|
312 local spellname, rank, displayName, texture, startTime, endTime, isTradeSkill, castID, nonInterruptible = UnitCastingInfo(unit)
|
Nenue@1
|
313 print('casting['..unit..'] state updated (=delayed): spellname='.. spellname ..', startTime='.. startTime ..', endTime='.. endTime)
|
Nenue@1
|
314 c[unit].castID = castID
|
Nenue@1
|
315 c[unit].channel = false
|
Nenue@1
|
316 c[unit].startTime = startTime
|
Nenue@1
|
317 c[unit].endTime = endTime
|
Nenue@1
|
318 -- just update timing data, frame script will adjust
|
Nenue@1
|
319 end
|
Nenue@1
|
320
|
Nenue@1
|
321 -- set exit states
|
Nenue@1
|
322 function mod:UNIT_SPELLCAST_STOP(e, unit, spellname, rank, castID, target) -- Server says: someone stopped casting for some reason
|
Nenue@1
|
323 --c[unit].casting = CAST_STOPPED
|
Nenue@1
|
324 end
|
Nenue@1
|
325
|
Nenue@1
|
326 function mod:UNIT_SPELLCAST_INTERRUPTED(e, unit, spellname, rank, castID, target) -- Server says: someone got interrupted
|
Nenue@1
|
327 c[unit].casting = CAST_INTERRUPTED
|
Nenue@1
|
328 c[unit].fade = true
|
Nenue@1
|
329 end
|
Nenue@1
|
330
|
Nenue@1
|
331 function mod:UNIT_SPELLCAST_SUCCEEDED(e, unit, spellname, rank, castID, target) -- Server says: they stopped because they're done
|
Nenue@1
|
332
|
Nenue@1
|
333 if c[unit].castID == castID and c[unit].casting ~= CHANNEL_START then
|
Nenue@1
|
334 c[unit].casting = CAST_SUCCEEDED
|
Nenue@1
|
335 c[unit].fade = true
|
Nenue@1
|
336 end
|
Nenue@1
|
337 end
|
Nenue@1
|
338
|
Nenue@1
|
339 function mod:UNIT_SPELLCAST_FAILED(e, unit, spellname, rank, castID, target) -- Server says: someone tried to cast something but they weren't allowed
|
Nenue@1
|
340 if c[unit].castID ~= castID then -- can fire from keybind spam
|
Nenue@1
|
341 return
|
Nenue@1
|
342 end
|
Nenue@1
|
343 c[unit].casting = CAST_FAILED
|
Nenue@1
|
344 c[unit].fade = true
|
Nenue@1
|
345 end
|
Nenue@1
|
346
|
Nenue@1
|
347 function mod:UNIT_SPELLCAST_FAILED_QUIET(e, unit, spellname, rank, castID, target) -- Server says: someone tried to cast something but they weren't allowed
|
Nenue@1
|
348 if c[unit].castID == castID and c[unit].casting == CAST_START then
|
Nenue@1
|
349 c[unit].casting = CAST_FAILED
|
Nenue@1
|
350 end
|
Nenue@1
|
351 end
|
Nenue@1
|
352
|
Nenue@1
|
353 function mod:UNIT_SPELLCAST_INTERRUPTIBLE(e, unit)
|
Nenue@1
|
354 c[unit].notInterruptible = false
|
Nenue@1
|
355 end
|
Nenue@1
|
356 function mod:UNIT_SPELLCAST_NOT_INTERRUPTIBLE(e, unit)
|
Nenue@1
|
357 c[unit].notInterruptible = true
|
Nenue@1
|
358 end
|
Nenue@1
|
359
|
Nenue@1
|
360 function mod:UNIT_SPELLCAST_CHANNEL_START(e, unit, spellname, rank, castID, spellID)
|
Nenue@1
|
361 local spellname, rank, displayName, texture, startTime, endTime, isTradeSkill, nonInterruptible = UnitChannelInfo(unit)
|
Nenue@1
|
362 displayName = spellname -- channels sometimes just appear as 'Channeling' according to Quartz author
|
Nenue@1
|
363 print('casting['..unit..'] state updated (=start, channel): spellname='.. spellname ..', startTime='.. startTime ..', endTime='.. endTime)
|
Nenue@1
|
364 c[unit].casting = CHANNEL_START
|
Nenue@1
|
365 c[unit].spellname = spellname
|
Nenue@1
|
366 c[unit].rank = rank
|
Nenue@1
|
367 c[unit].displayName = displayName
|
Nenue@1
|
368 c[unit].texture = texture
|
Nenue@1
|
369 c[unit].startTime = startTime
|
Nenue@1
|
370 c[unit].endTime = endTime
|
Nenue@1
|
371 c[unit].nonInterruptible = nonInterruptible
|
Nenue@1
|
372 c[unit].isTradeSkill = isTradeSkill
|
Nenue@1
|
373 c[unit].init = true
|
Nenue@1
|
374 mod.castbar[unit]:Show()
|
Nenue@1
|
375 end -- start up
|
Nenue@1
|
376 function mod:UNIT_SPELLCAST_CHANNEL_STOP(e, unit, spellname, rank, castID, spellID)
|
Nenue@1
|
377 c[unit].casting = CHANNEL_STOPPED
|
Nenue@1
|
378 end
|
Nenue@1
|
379 function mod:UNIT_SPELLCAST_CHANNEL_UPDATE(e, unit, spellname, rank, castID, spellID)
|
Nenue@1
|
380 spellname, rank, displayName, texture, startTime, endTime, isTradeSkill, nonInterruptible = UnitChannelInfo(unit)
|
Nenue@1
|
381 displayName = spellname -- channels sometimes just appear as 'Channeling' according to Quartz author
|
Nenue@1
|
382 c[unit].channel = true
|
Nenue@1
|
383 end -- recalc
|
Nenue@1
|
384
|
Nenue@1
|
385
|
Nenue@1
|
386
|
Nenue@1
|
387
|