local T, C, L = unpack(Tukui) -- Import: T - functions, constants, variables; C - config; L - locales if C.classbar.arcaneBlast[1] ~= true or T.myclass ~= "MAGE" then return end local tbWidth, tbHeight = C.classbar.arcaneBlast[2], C.classbar.arcaneBlast[3] local colors = { { 0/255, 75/255, 1, 1}, { 0/255, 100/255, 1, 1}, { 0/255, 125/255, 1, 1}, { 0/255, 150/255, 1, 1}, } local mover = CreateFrame("Frame", "TukuiArcaneBlastMover", UIParent) mover:Width(tbWidth+4) mover:Height(tbHeight+4) mover:Point("TOP", UIParent, "CENTER", 0, -150) mover:SetTemplate("Thick") mover:SetBackdropBorderColor(1,0,0) mover:SetClampedToScreen(true) mover:SetMovable(true) mover:SetFrameStrata("HIGH") mover:AddText("text", "Move Arcane Blast", "CENTER") mover:Hide() tinsert(T.AllowFrameMoving, mover) local aBlast = CreateFrame("Frame", "TukuiArcaneBlast", UIParent) aBlast:Width(tbWidth) aBlast:Height(tbHeight) aBlast:Point("CENTER", mover) local stacks = {} for i=1,4 do stacks[i] = CreateFrame("Frame", "TukuiArcaneBlast_Stack"..i, aBlast) stacks[i]:SetWidth((tbWidth-3) / 4) stacks[i]:SetHeight(tbHeight) stacks[i]:CreateBackdrop("Transparent") stacks[i].backdrop:ThickBorder() stacks[i].tex = stacks[i]:CreateTexture(nil, "OVERLAY") stacks[i].tex:SetTexture(C.media.normTex) stacks[i].tex:SetVertexColor(unpack(colors[i])) stacks[i].tex:AllPoints(stacks[i]) if i==1 then stacks[i]:SetPoint("LEFT", aBlast, "LEFT", 0, 0) else stacks[i]:SetPoint("LEFT", stacks[i-1], "RIGHT", 5, 0) end end local function UpdateStacks(self, event, unit) if (event ~= "PLAYER_ENTERING_WORLD") and (unit ~= "player") then return end local _, _, _, numStacks, _, duration, expires = UnitDebuff("player", "Arcane Blast") if numStacks == nil then numStacks = 0 end for i = 1, 4 do if (i <= numStacks) then stacks[i].tex:Show() else stacks[i].tex:Hide() end end if numStacks == 0 then aBlast:Hide() else aBlast:Show() end end aBlast:RegisterEvent("UNIT_AURA") aBlast:RegisterEvent("PLAYER_ENTERING_WORLD") aBlast:SetScript("OnEvent", UpdateStacks) local vehicle = CreateFrame("Frame") vehicle:RegisterEvent("VEHICLE_UPDATE") vehicle:SetScript("OnEvent", function() if UnitHasVehicleUI("player") then aBlast:Hide() else aBlast:Show() end end)