comparison Turok/Modules/Combat/Castbar.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
6 -- @file-revision@ @file-hash@ 6 -- @file-revision@ @file-hash@
7 -- Deals with casting events and works the castingbar interface 7 -- Deals with casting events and works the castingbar interface
8 local print, tostring, tonumber, rep, pairs, min, format, unpack, select, strpad = print, tostring, tonumber, string.rep, pairs, math.min, string.format, unpack, select, string.rep 8 local print, tostring, tonumber, rep, pairs, min, format, unpack, select, strpad = print, tostring, tonumber, string.rep, pairs, math.min, string.format, unpack, select, string.rep
9 local GetTime, UnitCastingInfo, UnitChannelInfo, GetSpellInfo, GetSpellTabInfo = GetTime, UnitCastingInfo, UnitChannelInfo, GetSpellInfo, GetSpellTabInfo 9 local GetTime, UnitCastingInfo, UnitChannelInfo, GetSpellInfo, GetSpellTabInfo = GetTime, UnitCastingInfo, UnitChannelInfo, GetSpellInfo, GetSpellTabInfo
10 local floor = math.floor 10 local floor = math.floor
11 local T = Turok 11 local T, _G = Turok, _G
12 local db 12 local db
13 local PING_CEILING = 190 -- transpacific 13 local PING_CEILING = 190 -- transpacific
14 local PING_MIDLINE = 100 14 local PING_MIDLINE = 100
15 local PING_FLOOR = 10 -- transcontinental 15 local PING_FLOOR = 10 -- transcontinental
16 --@debug 16 --@debug
17 local cType, cText, cNum, cWord, cKey, cPink, cBool = cType, cText, cNum, cWord, cKey, cPink, cBool 17 local cType, cText, cNum, cWord, cKey, cPink, cBool = cType, cText, cNum, cWord, cKey, cPink, cBool
18 local print = function(...) 18 local print = function(...)
19 if _G.Devian and _G.DevianDB.workspace ~= 1 then 19 if _G.Devian and _G.DevianDB.workspace ~= 1 then
20 _G.print('Tek', ...) 20 _G.print('Tek', ...)
21 end
22 end
23 local uprint = function(...)
24 if _G.Devian and _G.DevianDB.workspace ~= 1 then
25 _G.print('Update', ...)
26 end
27 end
28 local mprint = function(...)
29 if _G.Devian and _G.DevianDB.workspace ~= 1 then
30 _G.print('Main', ...)
21 end 31 end
22 end 32 end
23 33
24 local EVENT_COLOR = '|cFF44FF44' 34 local EVENT_COLOR = '|cFF44FF44'
25 local EVENT_COLOR2 = '|cFF88FF88' 35 local EVENT_COLOR2 = '|cFF88FF88'
447 if time > s.endTime then 457 if time > s.endTime then
448 self.value = self.fill_inverse and 0 or s.duration 458 self.value = self.fill_inverse and 0 or s.duration
449 self.percent = self.fill_inverse and 0 or 1 459 self.percent = self.fill_inverse and 0 or 1
450 self.elapsed = time - s.endTime 460 self.elapsed = time - s.endTime
451 end 461 end
452 --_G.print('Update',' ',self.unit, self.value, self.percent) 462 uprint(' ',self.unit, self.value, self.percent)
453 else 463 else
454 self.value = 1000 464 self.value = 1000
455 self.percent = 1 465 self.percent = 1
456 end 466 end
457 self.casttime:SetText(format("%.2f", self.value / 1000)) 467 self.casttime:SetText(format("%.2f", self.value / 1000))
462 --- Refresh the CastingBar for things like target change, pet despawn, etc. 472 --- Refresh the CastingBar for things like target change, pet despawn, etc.
463 -- Will attempt to flush out any existing cast action data, then re-invoke SpellCastEvent() with as much data can be acquired. 473 -- Will attempt to flush out any existing cast action data, then re-invoke SpellCastEvent() with as much data can be acquired.
464 -- There is no event data such as spellID directly available, so this is essentially the biggest constraint we have on what 474 -- There is no event data such as spellID directly available, so this is essentially the biggest constraint we have on what
465 -- the castingbar can depend on. 475 -- the castingbar can depend on.
466 function mod:UpdateUnit(unit) 476 function mod:UpdateUnit(unit)
467 local print = function(...) _G.print('Update', ...) end 477 local print = function(...) uprint(...) end
468 print(cText 'GUID changed:|cFFFFFF99', unit) 478 print(cText 'GUID changed:|cFFFFFF99', unit)
469 local c = mod.castbar[unit] 479 local c = mod.castbar[unit]
470 if c.channeling or c.casting then 480 if c.channeling or c.casting then
471 print(cText ' was casting a spell, run STOP event and hide completely') 481 print(cText ' was casting a spell, run STOP event and hide completely')
472 c:SetState(c.casting and 'STOP' or 'CHANNEL_STOP') 482 c:SetState(c.casting and 'STOP' or 'CHANNEL_STOP')
500 if unit == 'player' then 510 if unit == 'player' then
501 self:UpdateUnit('pet') 511 self:UpdateUnit('pet')
502 end 512 end
503 end 513 end
504 mod.PLAYER_TARGET_CHANGED = function(self, ...) 514 mod.PLAYER_TARGET_CHANGED = function(self, ...)
505 _G.print('Main', cPink(self),...) 515 mprint(cPink(self),...)
506 self:UpdateUnit('target') 516 self:UpdateUnit('target')
507 end 517 end
508 mod.PLAYER_FOCUS_CHANGED = function(self) 518 mod.PLAYER_FOCUS_CHANGED = function(self)
509 self:UpdateUnit('focus') 519 self:UpdateUnit('focus')
510 end 520 end