Skip to content

Commit

Permalink
lua erros, show minutes option, Issue 4-8
Browse files Browse the repository at this point in the history
  • Loading branch information
tdymel committed Jun 7, 2017
1 parent 0a80766 commit 1989772
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 24 deletions.
12 changes: 12 additions & 0 deletions Animation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ function MPOWA:AddAnimRotateOut(frame)
self.frames[frame][1].rotateanimout:SetLooping("NONE")
self.frames[frame][1].rotateanimout:SetScript("OnFinished", function()
MPOWA.frames[frame][1].rotateanimout:Stop()
MPOWA.frames[frame][2]:SetAllPoints()
MPOWA.frames[frame][2]:SetTexture(MPOWA_SAVE[frame]["texture"])
MPOWA.frames[frame][2]:SetTexCoord(0,0,0,1,1,0,1,1)
MPOWA.frames[frame][1]:Hide()
MPOWA:AfterAnimationDynamicGroup(frame)
end)
Expand Down Expand Up @@ -264,6 +267,9 @@ function MPOWA:AddAnimRotateShrinkFadeOut(frame)
self.frames[frame][1].batmananimout:SetScript("OnFinished", function()
MPOWA.frames[frame][1].batmananimout:Stop()
MPOWA.frames[frame][1]:SetAlpha(tnbr(MPOWA_SAVE[frame]["alpha"]))
MPOWA.frames[frame][2]:SetAllPoints()
MPOWA.frames[frame][2]:SetTexture(MPOWA_SAVE[frame]["texture"])
MPOWA.frames[frame][2]:SetTexCoord(0,0,0,1,1,0,1,1)
MPOWA.frames[frame][1]:SetWidth(64)
MPOWA.frames[frame][1]:SetHeight(64)
MPOWA.frames[frame][1]:Hide()
Expand Down Expand Up @@ -307,6 +313,9 @@ function MPOWA:AddAnimRotateIn(frame)
self.frames[frame][1].rotateanimin:SetLooping("NONE")
self.frames[frame][1].rotateanimin:SetScript("OnFinished", function()
MPOWA.frames[frame][1].rotateanimin:Stop()
MPOWA.frames[frame][2]:SetAllPoints()
MPOWA.frames[frame][2]:SetTexture(MPOWA_SAVE[frame]["texture"])
MPOWA.frames[frame][2]:SetTexCoord(0,0,0,1,1,0,1,1)
MPOWA.frames[frame][1]:Show()
end)

Expand All @@ -325,6 +334,9 @@ function MPOWA:AddAnimRotateShrinkFadeIn(frame)
end)
self.frames[frame][1].batmananimin:SetScript("OnFinished", function()
MPOWA.frames[frame][1].batmananimin:Stop()
MPOWA.frames[frame][2]:SetAllPoints()
MPOWA.frames[frame][2]:SetTexture(MPOWA_SAVE[frame]["texture"])
MPOWA.frames[frame][2]:SetTexCoord(0,0,0,1,1,0,1,1)
MPOWA.frames[frame][1]:SetWidth(64)
MPOWA.frames[frame][1]:SetHeight(64)
MPOWA.frames[frame][1]:Show()
Expand Down
21 changes: 11 additions & 10 deletions Auras.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,7 @@ function MPOWA:OnUpdate(elapsed)
local duration = self:GetCooldown(path["buffname"]) or 0
if path["timer"] then
if duration > 0 then
if path["hundredth"] then
self.frames[cat][3]:SetText(strform("%.2f", duration))
else
self.frames[cat][3]:SetText(flr(duration))
end
self.frames[cat][3]:SetText(self:FormatDuration(duration))
if path["inverse"] then
self:FHide(cat)
self.frames[cat][3]:Hide()
Expand Down Expand Up @@ -122,11 +118,7 @@ function MPOWA:OnUpdate(elapsed)
timeLeft = timeLeft or 0
if path["timer"] then
if timeLeft > 0 then
if path["hundredth"] then -- check it
self.frames[cat][3]:SetText(strform("%.2f", timeLeft))
else
self.frames[cat][3]:SetText(flr(timeLeft))
end
self.frames[cat][3]:SetText(self:FormatDuration(timeLeft))
else
self.frames[cat][3]:Hide()
end
Expand Down Expand Up @@ -166,6 +158,15 @@ function MPOWA:SetTexture(key, texture)
end
end

function MPOWA:FormatDuration(duration)
if path["minutes"] and duration >60 then
return ceil(duration/60).."m"
elseif path["hundredth"] then
return strform("%.2f", duration)
end
return flr(duration)
end

function MPOWA:GetCooldown(buff)
-- Get Spellcooldown
local start, duration, enabled = GetSpellCooldown(self:GetSpellSlot(buff), "spell")
Expand Down
14 changes: 8 additions & 6 deletions GUI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -468,11 +468,12 @@ function MPOWA:CreateButton(i)
MPOWA:ApplyAttributesToButton(i, button)
end

local AG = LibStub('AnimationGroup-1.0')
function MPOWA:CreateIcon(i)
if not self.frames[i] then
self.frames[i] = {}
end
CreateFrame("Frame", "TextureFrame"..i, UIParent, "MPowa_IconTemplate")
AG:CreateFrame("Frame", "TextureFrame"..i, UIParent, "MPowa_IconTemplate")
self.frames[i][1] = _G("TextureFrame"..i)
self.frames[i][2] = _G("TextureFrame"..i.."_Icon")
self.frames[i][3] = _G("TextureFrame"..i.."_Timer")
Expand Down Expand Up @@ -625,7 +626,7 @@ function MPOWA:ApplyAttributesToButton(i, button)
p = i
bool = true
end
if not _G("ConfigButton"..p.."_Icon") then return end
if not _G("ConfigButton"..p) or not MPOWA_SAVE[i] then return end
button:ClearAllPoints()
button:SetPoint("TOPLEFT",MPowa_ButtonContainer,"TOPLEFT",42*(p-1)+6 - floor((p-1)/7)*7*42,-11-floor((p-1)/7)*41)
button:SetID(i)
Expand Down Expand Up @@ -678,7 +679,7 @@ function MPOWA:DeselectAll()
end

function MPOWA:Remove()
if ConfigButton1 then
if ConfigButton1 and ConfigButton1:IsVisible() then
local coeff = (self.Page - 1)*49
self.NumBuffs = self.NumBuffs - 1
if (self.selected+coeff) == self.CurEdit then
Expand Down Expand Up @@ -799,6 +800,7 @@ function MPOWA:Edit()
MPowa_ConfigFrame_Container_1_2_Checkbutton_Mine:SetChecked(MPOWA_SAVE[self.CurEdit].castbyme)
MPowa_ConfigFrame_Container_1_2_Checkbutton_ShowIfNotActive:SetChecked(MPOWA_SAVE[self.CurEdit].inverse)
MPowa_ConfigFrame_Container_2_2_Checkbutton_Timer:SetChecked(MPOWA_SAVE[self.CurEdit].timer)
MPowa_ConfigFrame_Container_2_2_Checkbutton_Minutes:SetChecked(MPOWA_SAVE[self.CurEdit].minutes)
MPowa_ConfigFrame_Container_1_2_Checkbutton_ShowCooldowns:SetChecked(MPOWA_SAVE[self.CurEdit].cooldown)
MPowa_ConfigFrame_Container_1_2_Checkbutton_EnemyTarget:SetChecked(MPOWA_SAVE[self.CurEdit].enemytarget)
MPowa_ConfigFrame_Container_1_2_Checkbutton_FriendlyTarget:SetChecked(MPOWA_SAVE[self.CurEdit].friendlytarget)
Expand Down Expand Up @@ -861,7 +863,7 @@ function MPOWA:Edit()
MPowa_ConfigFrame_Container_1_Icon_Texture:SetBlendMode(MPowa_ConfigFrame_Container_1_Slider_BlendMode.valuetext[tnbr(MPOWA_SAVE[self.CurEdit].blendmode)])

MPowa_ConfigFrame_Container_2_2_Slider_Font:SetValue(tnbr(MPOWA_SAVE[self.CurEdit].timerfont))
MPowa_ConfigFrame_Container_2_2_Slider_FontText:SetText(MPOWA_SLIDER_DYNAMICORIENTATION..MPowa_ConfigFrame_Container_2_2_Slider_Font.valuetext[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)])

if MPOWA_SAVE[self.CurEdit].flashanim then
MPowa_ConfigFrame_Container_2_2_Editbox_FlashAnim:Show()
Expand Down Expand Up @@ -1015,8 +1017,8 @@ function MPOWA:OpenColorPicker(n)

ColorPickerFrame:SetMovable()
ColorPickerFrame:EnableMouse()
ColorPickerFrame:SetScript("OnMouseDown", function() ColorPickerFrame:StartMoving() end)
ColorPickerFrame:SetScript("OnMouseUp", function() ColorPickerFrame:StopMovingOrSizing() end)
--ColorPickerFrameHeader:SetScript("OnMouseDown", function() ColorPickerFrame:StartMoving() end)
--ColorPickerFrameHeader:SetScript("OnMouseUp", function() ColorPickerFrame:StopMovingOrSizing() end)

ColorPickerFrame:Show()
end
Expand Down
2 changes: 1 addition & 1 deletion Init.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CreateFrame("Frame", "MPOWA", UIParent)
MPOWA.Build = 47
MPOWA.Build = 48
MPOWA.Cloaded = false
MPOWA.loaded = false
MPOWA.selected = 1
Expand Down
16 changes: 16 additions & 0 deletions ModifiedPowerAuras.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1607,6 +1607,22 @@
</OnClick>
</Scripts>
</CheckButton>
<CheckButton name="$parent_Checkbutton_Minutes" inherits="MPowa_CheckTemplate">
<Anchors>
<Anchor point="LEFT" relativeTo="$parent_Checkbutton_Hundreds" relativePoint="RIGHT">
<Offset x="130" y="-26" />
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
this.tooltipText = MPOWA_CHECKBUTTON_MINUTES_TOOLTIP
getglobal(this:GetName().."Text"):SetText(MPOWA_CHECKBUTTON_MINUTES)
</OnLoad>
<OnClick>
MPOWA:Checkbutton("minutes")
</OnClick>
</Scripts>
</CheckButton>
<CheckButton name="$parent_Checkbutton_FlashAnim" inherits="MPowa_CheckTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parent_Checkbutton_Timer" relativePoint="BOTTOMLEFT">
Expand Down
5 changes: 3 additions & 2 deletions Start.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ function MPOWA:CreateSave(i)
dynamicorientation = 1,
timerfont = 1,
dynamicspacing = 5,
blendmode = 1
blendmode = 1,
minutes = false
}
end

Expand Down Expand Up @@ -112,7 +113,7 @@ function MPOWA:Init()
end

if val["used"] then
self.NumBuffs = cat
self.NumBuffs = self.NumBuffs + 1
end

if val["rgmname"] then
Expand Down
5 changes: 2 additions & 3 deletions libs/AnimationGroup/AnimationGroup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@ local function CreateAnimationGroup(self, name, inherits_from)
return ag
end

local _CreateFrame = CreateFrame
function CreateFrame(frameType, name, parent, inheritFrame)
local frame = _CreateFrame(frameType, name, parent, inheritFrame)
function AG:CreateFrame(frameType, name, parent, inheritFrame)
local frame = CreateFrame(frameType, name, parent, inheritFrame)

frame.CreateAnimationGroup = CreateAnimationGroup

Expand Down
3 changes: 3 additions & 0 deletions localization/deDE.lua
Original file line number Diff line number Diff line change
Expand Up @@ -172,4 +172,7 @@ if (GetLocale() == "deDE") then

MPOWA_SLIDER_BLENDMODE = "Render: "
MPOWA_SLIDER_BLENDMODE_TOOLTIP = "Verschiebe, um den alpha Modus zu ändern."

MPOWA_CHECKBUTTON_MINUTES = "Minuten >60"
MPOWA_CHECKBUTTON_MINUTES_TOOLTIP = "Zeige Minuten, wenn mehr als 60 Sekunden verbleiben."
end
5 changes: 4 additions & 1 deletion localization/enUs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -172,4 +172,7 @@ MPOWA_SLIDER_SPACING = "Spacing: "
MPOWA_SLIDER_SPACING_TOOLTIP = "Slide to change the spacing between the auras."

MPOWA_SLIDER_BLENDMODE = "Render: "
MPOWA_SLIDER_BLENDMODE_TOOLTIP = "Slide to change the blend mode of the aura."
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."
1 change: 0 additions & 1 deletion zzzModifiedPowerAuras.toc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

libs\LibStub\LibStub.lua
libs\Classy-1.0\Classy-1.0.lua
libs\Sol\Sol.lua
libs\AnimationGroup\AnimationGroup.lua
libs\AnimationGroup\curves.lua
libs\AnimationGroup\group.lua
Expand Down

0 comments on commit 1989772

Please sign in to comment.