Skip to content

Commit

Permalink
Cast Flash
Browse files Browse the repository at this point in the history
  • Loading branch information
d87 committed Feb 2, 2020
1 parent de61cc7 commit dd5f92e
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 9 deletions.
31 changes: 31 additions & 0 deletions Frame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,37 @@ function NugKeyFeedback:CreateFeedbackButton(autoKeyup)
mirror:Show()
mirror._elapsed = 0

local glow = CreateFrame("Frame", nil, mirror)
glow:SetPoint("TOPLEFT", -16, 16)
glow:SetPoint("BOTTOMRIGHT", 16, -16)
local gtex = glow:CreateTexture(nil, "OVERLAY")
gtex:SetTexture([[Interface\SpellActivationOverlay\IconAlert]])
gtex:SetTexCoord(0, 66/128, 136/256, 202/256)
gtex:SetVertexColor(0,1,0)
gtex:SetAllPoints(glow)
mirror.glow = glow
glow:Hide()

local ag = glow:CreateAnimationGroup()
glow.blink = ag

local a1 = ag:CreateAnimation("Alpha")
a1:SetFromAlpha(0)
a1:SetToAlpha(1)
a1:SetDuration(0.14)
a1:SetOrder(2)

local a2 = ag:CreateAnimation("Alpha")
a2:SetFromAlpha(1)
a2:SetToAlpha(0)
a2:SetSmoothing("OUT")
a2:SetDuration(0.3)
a2:SetOrder(2)

ag:SetScript("OnFinished", function(self)
self:GetParent():Hide()
end)

if autoKeyup then
mirror:SetScript("OnUpdate", function(self, elapsed)
self._elapsed = self._elapsed + elapsed
Expand Down
23 changes: 14 additions & 9 deletions NugKeyFeedback.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ local defaults = {
x = 0, y = 0,
enableCastLine = true,
enableCooldown = true,
enableCastFlash = true,
lineIconSize = 38,
mirrorSize = 50,
lineDirection = "LEFT",
Expand Down Expand Up @@ -146,13 +147,19 @@ end
function NugKeyFeedback:UNIT_SPELLCAST_SUCCEEDED(event, unit, lineID, spellID)
if IsPlayerSpell(spellID) then
if spellID == 75 then return end -- Autoshot
local frame, isNew = self.iconPool:Acquire()

local texture = select(3,GetSpellInfo(spellID))
frame.icon:SetTexture(texture)
frame:Show()
frame.ag:Play()
-- self.flash.ag:Play()
if self.db.enableCastLine then
local frame, isNew = self.iconPool:Acquire()
local texture = select(3,GetSpellInfo(spellID))
frame.icon:SetTexture(texture)
frame:Show()
frame.ag:Play()
end

if self.db.enableCastFlash then
self.mirror.glow:Show()
self.mirror.glow.blink:Play()
end
end
end

Expand All @@ -163,8 +170,8 @@ function NugKeyFeedback:RefreshSettings()
self.mirror.masqueGroup:ReSkin()
end

self:RegisterUnitEvent("UNIT_SPELLCAST_SUCCEEDED", "player")
if db.enableCastLine then
self:RegisterUnitEvent("UNIT_SPELLCAST_SUCCEEDED", "player")
if not self.iconPool then
self.iconPool = self:CreateLastSpellIconLine(self.mirror)
end
Expand All @@ -179,8 +186,6 @@ function NugKeyFeedback:RefreshSettings()
if pool.masqueGroup then
pool.masqueGroup:ReSkin()
end
else
self:UnregisterEvent("UNIT_SPELLCAST_SUCCEEDED")
end

if db.enableCooldown then
Expand Down
11 changes: 11 additions & 0 deletions Options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,17 @@ function NugKeyFeedback:CreateGUI()
NugKeyFeedback:RefreshSettings()
end
},
enableCastFlash = {
name = L"Cast Flash",
type = "toggle",
width = "full",
order = 4.6,
get = function(info) return NugKeyFeedback.db.enableCastFlash end,
set = function(info, v)
NugKeyFeedback.db.enableCastFlash = not NugKeyFeedback.db.enableCastFlash
NugKeyFeedback:RefreshSettings()
end
},
lineIconSize = {
name = L"Cast Line Icon Size",
type = "range",
Expand Down

0 comments on commit dd5f92e

Please sign in to comment.