Skip to content

Commit

Permalink
Added stacksize slider and cdclock animation
Browse files Browse the repository at this point in the history
  • Loading branch information
tdymel committed Jun 25, 2017
1 parent c4471d8 commit 7bd1e2a
Show file tree
Hide file tree
Showing 8 changed files with 172 additions and 14 deletions.
6 changes: 6 additions & 0 deletions Animation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ end
function MPOWA:FHide(key)
local p = MPOWA_SAVE[key]
if self.frames[key][1]:IsVisible() and not self.testall and not p["test"] then
if p["cdclockanimout"] then
self.frames[key][5]:SetCooldown(0, 0)
end
if p["batmananimout"] then
self:PlayAnim("batmananimout", key, "batmananimout")
elseif p["shrinkanim"] then
Expand Down Expand Up @@ -78,6 +81,9 @@ function MPOWA:FShow(key)
elseif p["groupnumber"] and tnbr(p["groupnumber"])>0 then
self:ApplyDynamicGroup(tnbr(p["groupnumber"]))
end
if p["cdclockanimin"] then
self.frames[key][5]:SetCooldown(GT(), p["animduration"])
end
self.frames[key][1]:Show()
if p["batmananimin"] then
self:PlayAnim("batmananimin", key, "batmananimin")
Expand Down
61 changes: 53 additions & 8 deletions Auras.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ local UnitAffectingCombat = UnitAffectingCombat
local UnitInRaid = UnitInRaid
local UnitBuff = UnitBuff
local UnitDebuff = UnitDebuff
local UnitMana = UnitMana
local strsub = strsub
local strlower = strlower
local GetComboPoints = GetComboPoints
Expand All @@ -25,6 +26,7 @@ local GetContainerNumSlots = GetContainerNumSlots
local GetSpellName = GetSpellName

local UpdateTime, LastUpdate = 0.05, 0
local cdset = {}

function MPOWA:OnUpdate(elapsed)
LastUpdate = LastUpdate + elapsed
Expand All @@ -36,6 +38,10 @@ function MPOWA:OnUpdate(elapsed)
self.frames[cat][4]:Hide()
if path["cooldown"] then
local duration = self:GetCooldown(path["buffname"]) or 0
if path["cdclockanimout"] and duration<=path["animduration"]+0.4 and duration>=path["animduration"] and (not cdset[cat] or cdset[cat]+0.5<GT()) then
cdset[cat] = GT()
self.frames[cat][5]:SetCooldown(GT(), path["animduration"])
end
if path["timer"] then
if duration > 0 then
self.frames[cat][3]:SetText(self:FormatDuration(duration, path))
Expand Down Expand Up @@ -116,6 +122,10 @@ function MPOWA:OnUpdate(elapsed)
end
-- Duration
timeLeft = timeLeft or 0
if path["cdclockanimout"] and timeLeft<=path["animduration"]+0.4 and timeLeft>=path["animduration"] and (not cdset[cat] or cdset[cat]+0.5<GT()) then
cdset[cat] = GT()
self.frames[cat][5]:SetCooldown(GT(), path["animduration"])
end
if path["timer"] then
if timeLeft > 0 then
self.frames[cat][3]:SetText(self:FormatDuration(timeLeft, path))
Expand All @@ -124,7 +134,7 @@ function MPOWA:OnUpdate(elapsed)
end
end
self:Flash(elapsed, cat, timeLeft)
if path["inverse"] then
if path["inverse"] and (path["buffname"] ~= "unitpower" and not path["inverse"]) then
self:FHide(cat)
else
if path["secsleft"] then
Expand Down Expand Up @@ -152,7 +162,7 @@ end

function MPOWA:SetTexture(key, texture)
local p = MPOWA_SAVE[key]
if p["texture"] == "Interface\\AddOns\\zzzModifiedPowerAuras\\images\\dummy.tga" then
if texture and p["texture"] == "Interface\\AddOns\\zzzModifiedPowerAuras\\images\\dummy.tga" then
p["texture"] = texture
self.frames[key][2]:SetTexture(texture)
end
Expand Down Expand Up @@ -239,6 +249,22 @@ function MPOWA:Iterate(unit)
self:InInstance()
end

for cat, val in pairs(MPOWA_SAVE) do
if (val["buffname"] == "unitpower") then
local tarid = 44
if (unit == "target") then
tarid = 45
elseif (string.find(unit,"raid")) then
local a,b = string.find(unit,"raid")
tarid = tonumber(string.sub(unit, b+1))+45
elseif (string.find(unit,"party")) then
local a,b = string.find(unit,"party")
tarid = tonumber(string.sub(unit, b+1))+45
end
self:Push("unitpower", unit, tarid, false)
end
end

for i=1, 40 do
local buff, debuff, castbyme
buff,_,_,_,_,_,castbyme = UnitBuff(unit, i)
Expand Down Expand Up @@ -327,17 +353,36 @@ function MPOWA:IsStacks(count, id, kind)
if MPOWA_SAVE[id][kind] ~= "" then
local con = strsub(MPOWA_SAVE[id][kind], 1, 2)
local amount = tnbr(strsub(MPOWA_SAVE[id][kind], 3))
if not con then
con = strsub(MPOWA_SAVE[id][kind], 1, 1)
amount = tnbr(strsub(MPOWA_SAVE[id][kind], 2))
end

if MPOWA_SAVE[id]["buffname"] == "unitpower" then
count = UnitMana(MPOWA_SAVE[id]["unit"] or "player")
if MPOWA_SAVE[id]["inverse"] then
if (con == ">=") then
con = "<"
elseif (con == "<=") then
con = ">"
elseif con == ">" then
con = "<="
elseif (con == "<") then
con = ">="
elseif (con == "=") then
con = "!"
elseif (con == "!") then
con = "="
end
end
end

if amount ~= nil and con ~= nil then
if con == ">=" and count >= amount then
return true
elseif con == "<=" and count <= amount then
return true
end
end
con = strsub(MPOWA_SAVE[id][kind], 1, 1)
amount = tnbr(strsub(MPOWA_SAVE[id][kind], 2))
if amount ~= nil and con ~= nil then
if con == "<" and count < amount then
elseif con == "<" and count < amount then
return true
elseif con == ">" and count > amount then
return true
Expand Down
11 changes: 11 additions & 0 deletions GUI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,8 @@ function MPOWA:CreateIcon(i)
self.frames[i][2] = _G("TextureFrame"..i.."_Icon")
self.frames[i][3] = _G("TextureFrame"..i.."_Timer")
self.frames[i][4] = _G("TextureFrame"..i.."_Count")
self.frames[i][5] = CreateFrame("Cooldown", "TextureFrame"..i.."_Cooldown", self.frames[i][1], "CooldownFrameTemplate")
self.frames[i][5]:SetAllPoints(self.frames[i][1])
self.frames[i][1]:SetID(i)
self.frames[i][1]:EnableMouse(0)
self.frames[i][1]:Hide()
Expand All @@ -494,6 +496,7 @@ function MPOWA:ApplyConfig(i)
self.frames[i][1]:SetScale(val["size"])
self.frames[i][3]:SetFont(timerfont[val["timerfont"] or 1], val["fontsize"]*12, "OUTLINE")
self.frames[i][3]:SetAlpha(val["fontalpha"])
self.frames[i][4]:SetFont(timerfont[val["timerfont"] or 1], val["timerfontsize"]*12, "OUTLINE")
self.frames[i][3]:ClearAllPoints()
self.frames[i][3]:SetPoint("CENTER", self.frames[i][1], "CENTER", val["fontoffsetx"], val["fontoffsety"])
self.frames[i][2]:SetVertexColor(val.icon_r or 1, val.icon_g or 1, val.icon_b or 1)
Expand Down Expand Up @@ -847,6 +850,8 @@ function MPOWA:Edit()
MPowa_ConfigFrame_Container_5_EscapeOut:SetChecked(MPOWA_SAVE[self.CurEdit].escapeanimout)
MPowa_ConfigFrame_Container_5_BatmanOut:SetChecked(MPOWA_SAVE[self.CurEdit].batmananimout)
MPowa_ConfigFrame_Container_5_Translate:SetChecked(MPOWA_SAVE[self.CurEdit].translateanim)
MPowa_ConfigFrame_Container_5_CooldownClockIn:SetChecked(MPOWA_SAVE[self.CurEdit].cdclockanimin)
MPowa_ConfigFrame_Container_5_CooldownClockOut:SetChecked(MPOWA_SAVE[self.CurEdit].cdclockanimout)
-- ANIM END

MPowa_ConfigFrame_Container_6_IsDynamicGroup:SetChecked(MPOWA_SAVE[self.CurEdit].isdynamicgroup)
Expand All @@ -864,6 +869,8 @@ function MPOWA:Edit()

MPowa_ConfigFrame_Container_2_2_Slider_Font:SetValue(tnbr(MPOWA_SAVE[self.CurEdit].timerfont))
MPowa_ConfigFrame_Container_2_2_Slider_FontText:SetText(MPOWA_SLIDER_FONT..MPowa_ConfigFrame_Container_2_2_Slider_Font.valuetext[tnbr(MPOWA_SAVE[self.CurEdit].timerfont)])
MPowa_ConfigFrame_Container_2_2_Slider_FontSize:SetValue(tnbr(MPOWA_SAVE[self.CurEdit].timerfontsize))
MPowa_ConfigFrame_Container_2_2_Slider_FontSizeText:SetText(MPOWA_SLIDER_FONTSIZE..tnbr(MPOWA_SAVE[self.CurEdit].timerfontsize))

if MPOWA_SAVE[self.CurEdit].flashanim then
MPowa_ConfigFrame_Container_2_2_Editbox_FlashAnim:Show()
Expand Down Expand Up @@ -893,6 +900,10 @@ function MPOWA:Edit()
MPowa_ConfigFrame_Container_1_2_Editbox:SetPoint("TOP", MPowa_ConfigFrame_Container_1_2, "TOP", 0, -20)
MPowa_ConfigFrame_Container_1_2_Editbox_SecondSpecifier:Hide()
end

MPowa_ConfigFrame_Container_1_Editbox_PosX:SetText(MPOWA_SAVE[self.CurEdit].x)
MPowa_ConfigFrame_Container_1_Editbox_PosY:SetText(MPOWA_SAVE[self.CurEdit].y)

MPOWA:TernarySetState(MPowa_ConfigFrame_Container_1_2_Checkbutton_Alive, MPOWA_SAVE[self.CurEdit].alive)
MPOWA:TernarySetState(MPowa_ConfigFrame_Container_1_2_Checkbutton_Mounted, MPOWA_SAVE[self.CurEdit].mounted)
MPOWA:TernarySetState(MPowa_ConfigFrame_Container_1_2_Checkbutton_InCombat, MPOWA_SAVE[self.CurEdit].incombat)
Expand Down
15 changes: 14 additions & 1 deletion Init.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CreateFrame("Frame", "MPOWA", UIParent)
MPOWA.Build = 49
MPOWA.Build = 50
MPOWA.Cloaded = false
MPOWA.loaded = false
MPOWA.selected = 1
Expand Down Expand Up @@ -118,6 +118,19 @@ function MPOWA:OnEvent(event, arg1)
else
self:Iterate("player")
end
elseif event == "UNIT_MANA" or event == "UNIT_RAGE" or event == "UNIT_ENERGY" then
local tarid = 44
local unit = arg1
if (unit == "target") then
tarid = 45
elseif (string.find(unit,"raid")) then
local a,b = string.find(unit,"raid")
tarid = tonumber(string.sub(unit, b+1))+45
elseif (string.find(unit,"party")) then
local a,b = string.find(unit,"party")
tarid = tonumber(string.sub(unit, b+1))+45
end
self:Push("unitpower", unit, tarid, false)
else
self:Init()
self.loaded = true
Expand Down
65 changes: 64 additions & 1 deletion ModifiedPowerAuras.xml
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,7 @@
elseif value == (min + 25) then
SLIDER_POSX_MIN = true
end
MPowa_ConfigFrame_Container_1_Editbox_PosX:SetText(MPOWA_SAVE[MPOWA.CurEdit].x)
end
</OnValueChanged>
<OnMouseUp>
Expand Down Expand Up @@ -818,6 +819,7 @@
elseif value == (min + 25) then
SLIDER_POSY_MIN = true
end
MPowa_ConfigFrame_Container_1_Editbox_PosY:SetText(MPOWA_SAVE[MPOWA.CurEdit].y)
end
</OnValueChanged>
<OnMouseUp>
Expand Down Expand Up @@ -1323,7 +1325,7 @@
getglobal(this:GetName().."Text"):SetText(MPOWA_CHECKBUTTON_SHOWIFNOTACTIVE)
</OnLoad>
<OnClick>
if not MPOWA_SAVE[MPOWA.CurEdit]["inverse"] then
if not MPOWA_SAVE[MPOWA.CurEdit]["inverse"] and MPOWA_SAVE[MPOWA.CurEdit]["buffname"] ~= "unitpower" then
MPOWA.NeedUpdate[MPOWA.CurEdit] = true
else
if not MPOWA_SAVE[MPOWA.CurEdit]["cooldown"] then
Expand Down Expand Up @@ -1833,6 +1835,35 @@
</OnValueChanged>
</Scripts>
</Slider>
<Slider name="$parent_Slider_FontSize" inherits="MPowa_SliderTemplate">
<Size x="130" y="16" />
<Anchors>
<Anchor point="TOP" relativeTo="$parent_Slider_Font" relativePoint="BOTTOM">
<Offset x="0" y="-25" />
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
this.aide = MPOWA_SLIDER_FONTSIZE_TOOLTIP
this:SetMinMaxValues(1,3)
this:SetValue(0.1)
this:SetValueStep(0.1)
getglobal(this:GetName().."Text"):SetText(MPOWA_SLIDER_FONTSIZE)
getglobal(this:GetName().."Low"):SetText("1")
getglobal(this:GetName().."High"):SetText("3")
</OnLoad>
<OnValueChanged>
if MPOWA.loaded and this:GetValue() then
local value = tonumber(this:GetValue())
if value > 0 then
getglobal(this:GetName().."Text"):SetText(MPOWA_SLIDER_FONTSIZE..value)
MPOWA_SAVE[MPOWA.CurEdit]["timerfontsize"] = value
MPOWA:ApplyConfig(MPOWA.CurEdit)
end
end
</OnValueChanged>
</Scripts>
</Slider>
</Frames>
</Frame>
<Frame name="$parent_3" hidden="true" inherits="MPowa_ContainerTemplate">
Expand Down Expand Up @@ -2295,6 +2326,22 @@
</OnClick>
</Scripts>
</CheckButton>
<CheckButton name="$parent_CooldownClockIn" inherits="MPowa_CheckTemplate">
<Anchors>
<Anchor point="TOP" relativeTo="$parent_BatmanIn" relativePoint="BOTTOM">
<Offset x="0" y="1" />
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
this.tooltipText = MPOWA_CHECKBUTTON_CDCLOCK_TOOLTIP
getglobal(this:GetName().."Text"):SetText(MPOWA_CHECKBUTTON_CDCLOCK)
</OnLoad>
<OnClick>
MPOWA:Checkbutton("cdclockanimin")
</OnClick>
</Scripts>
</CheckButton>
<CheckButton name="$parent_FadeOut" inherits="MPowa_CheckTemplate">
<Anchors>
<Anchor point="RIGHT" relativeTo="$parent_FadeIn" relativePoint="LEFT">
Expand Down Expand Up @@ -2414,6 +2461,22 @@
</OnClick>
</Scripts>
</CheckButton>
<CheckButton name="$parent_CooldownClockOut" inherits="MPowa_CheckTemplate">
<Anchors>
<Anchor point="TOP" relativeTo="$parent_Translate" relativePoint="BOTTOM">
<Offset x="0" y="1" />
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
this.tooltipText = MPOWA_CHECKBUTTON_CDCLOCK_TOOLTIP
getglobal(this:GetName().."Text"):SetText(MPOWA_CHECKBUTTON_CDCLOCK)
</OnLoad>
<OnClick>
MPOWA:Checkbutton("cdclockanimout")
</OnClick>
</Scripts>
</CheckButton>
</Frames>
<Scripts>
<OnLoad>
Expand Down
14 changes: 11 additions & 3 deletions Start.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ function MPOWA:CreateSave(i)
timerfont = 1,
dynamicspacing = 5,
blendmode = 1,
minutes = false
minutes = false,
timerfontsize = 16,
}
end

Expand Down Expand Up @@ -102,7 +103,7 @@ function MPOWA:Init()
end
tinsert(self.auras[val["buffname"]], cat)

if val["inverse"] or val["cooldown"] then
if (val["inverse"] or val["cooldown"]) and val["buffname"] ~= "unitpower" then
self.NeedUpdate[cat] = true
end

Expand Down Expand Up @@ -167,6 +168,10 @@ function MPOWA:Init()
if not val["blendmode"] then
MPOWA_SAVE[cat]["blendmode"] = 1
end

if not val["timerfontsize"] then
MPOWA_SAVE[cat]["timerfontsize"] = 1
end

self:CreateIcon(cat)
self:ApplyConfig(cat)
Expand Down Expand Up @@ -248,4 +253,7 @@ MPOWA:RegisterEvent("RAID_ROSTER_UPDATE")
MPOWA:RegisterEvent("PARTY_MEMBERS_CHANGED")
MPOWA:RegisterEvent("PLAYER_AURAS_CHANGED")
MPOWA:RegisterEvent("PLAYER_REGEN_DISABLED")
MPOWA:RegisterEvent("PLAYER_REGEN_ENABLED")
MPOWA:RegisterEvent("PLAYER_REGEN_ENABLED")
MPOWA:RegisterEvent("UNIT_MANA")
MPOWA:RegisterEvent("UNIT_RAGE")
MPOWA:RegisterEvent("UNIT_ENERGY")
6 changes: 6 additions & 0 deletions localization/deDE.lua
Original file line number Diff line number Diff line change
Expand Up @@ -175,4 +175,10 @@ if (GetLocale() == "deDE") then

MPOWA_CHECKBUTTON_MINUTES = "Minuten >60"
MPOWA_CHECKBUTTON_MINUTES_TOOLTIP = "Zeige Minuten, wenn mehr als 60 Sekunden verbleiben."

MPOWA_SLIDER_FONTSIZE_TOOLTIP = "Bewege das, um die Stack-Schriftgröße des Timers zu ändern."
MPOWA_SLIDER_FONTSIZE = "Stack-Schriftgröße: "

MPOWA_CHECKBUTTON_CDCLOCK_TOOLTIP = "Aktiviere das, um die CD-Uhr zu aktivieren. Animationszeit=0 => Nur die Blitzanimation"
MPOWA_CHECKBUTTON_CDCLOCK = "CD-Uhr"
end
8 changes: 7 additions & 1 deletion localization/enUs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -175,4 +175,10 @@ MPOWA_SLIDER_BLENDMODE = "Render: "
MPOWA_SLIDER_BLENDMODE_TOOLTIP = "Slide to change the blend mode of the aura."

MPOWA_CHECKBUTTON_MINUTES = "Show minutes >60"
MPOWA_CHECKBUTTON_MINUTES_TOOLTIP = "Show minutes when there is more than 60 seconds left."
MPOWA_CHECKBUTTON_MINUTES_TOOLTIP = "Show minutes when there is more than 60 seconds left."

MPOWA_SLIDER_FONTSIZE_TOOLTIP = "Slide this to change the timer stackfont size."
MPOWA_SLIDER_FONTSIZE = "Stackfontsize: "

MPOWA_CHECKBUTTON_CDCLOCK_TOOLTIP = "Check this to activate the cooldown clock. Duration=0 => Only flash"
MPOWA_CHECKBUTTON_CDCLOCK = "Cooldownclock"

0 comments on commit 7bd1e2a

Please sign in to comment.