- fixed an issue where right-clicking weapon buffs in the PlayerInfo module wasn't canceling weapon buffs

- fixed an issue where weapon buff cooldowns would flicker every second in PlayerInfo
- fixed an issue where canceling weapon buffs would sometimes cause a duplicate to stick around in PlayerInfo
This commit is contained in:
Parnic
2010-07-22 05:58:08 +00:00
parent 2ad38ae8e7
commit 54476799a4

View File

@ -64,7 +64,15 @@ function PlayerInfo.prototype:CreateIconFrames(parent, direction, buffs, type)
for i = 1, IceCore.BuffLimit do for i = 1, IceCore.BuffLimit do
if (self.moduleSettings.mouseBuff) then if (self.moduleSettings.mouseBuff) then
buffs[i]:SetScript("OnMouseUp", function( self, button) buffs[i]:SetScript("OnMouseUp", function( self, button)
if( button == "RightButton" ) then CancelUnitBuff("player", i) end if( button == "RightButton" ) then
if buffs[i].type == "mh" then
CancelItemTempEnchantment(1)
elseif buffs[i].type == "oh" then
CancelItemTempEnchantment(2)
else
CancelUnitBuff("player", i)
end
end
end) end)
else else
buffs[i]:SetScript("OnMouseUp", nil) buffs[i]:SetScript("OnMouseUp", nil)
@ -108,20 +116,27 @@ function PlayerInfo.prototype:UpdateBuffs(unit, fromRepeated)
PlayerInfo.super.prototype.UpdateBuffs(self) PlayerInfo.super.prototype.UpdateBuffs(self)
end end
local hasMainHandEnchant, mainHandExpiration, mainHandCharges, hasOffHandEnchant, offHandExpiration, offHandCharges
= GetWeaponEnchantInfo()
local startingNum = 0 local startingNum = 0
for i=1, IceCore.BuffLimit do for i=1, IceCore.BuffLimit do
if not self.frame.buffFrame.buffs[i]:IsVisible() if not self.frame.buffFrame.buffs[i]:IsVisible()
or self.frame.buffFrame.buffs[i].type == "mh" or self.frame.buffFrame.buffs[i].type == "mh"
or self.frame.buffFrame.buffs[i].type == "oh" then or self.frame.buffFrame.buffs[i].type == "oh" then
if startingNum == 0 then
startingNum = i startingNum = i
break
end end
end end
local hasMainHandEnchant, mainHandExpiration, mainHandCharges, if self.frame.buffFrame.buffs[i]:IsVisible() then
hasOffHandEnchant, offHandExpiration, offHandCharges if (self.frame.buffFrame.buffs[i].type == "mh" and not hasMainHandEnchant)
= GetWeaponEnchantInfo() or (self.frame.buffFrame.buffs[i].type == "oh" and not hasOffHandEnchant) then
self.frame.buffFrame.buffs[i]:Hide()
end
end
end
if hasMainHandEnchant or hasOffHandEnchant then if hasMainHandEnchant or hasOffHandEnchant then
local CurrTime = GetTime() local CurrTime = GetTime()
@ -133,6 +148,7 @@ function PlayerInfo.prototype:UpdateBuffs(unit, fromRepeated)
self.mainHandEnchantTimeSet = CurrTime self.mainHandEnchantTimeSet = CurrTime
end end
if not self.frame.buffFrame.buffs[startingNum]:IsVisible() or self.frame.buffFrame.buffs[startingNum].type ~= "mh" then
self:SetUpBuff(startingNum, self:SetUpBuff(startingNum,
GetInventoryItemTexture(self.unit, GetInventorySlotInfo("MainHandSlot")), GetInventoryItemTexture(self.unit, GetInventorySlotInfo("MainHandSlot")),
self.mainHandEnchantEndTime, self.mainHandEnchantEndTime,
@ -140,6 +156,7 @@ function PlayerInfo.prototype:UpdateBuffs(unit, fromRepeated)
true, true,
mainHandCharges, mainHandCharges,
"mh") "mh")
end
startingNum = startingNum + 1 startingNum = startingNum + 1
end end
@ -151,6 +168,7 @@ function PlayerInfo.prototype:UpdateBuffs(unit, fromRepeated)
self.offHandEnchantTimeSet = CurrTime self.offHandEnchantTimeSet = CurrTime
end end
if not self.frame.buffFrame.buffs[startingNum]:IsVisible() or self.frame.buffFrame.buffs[startingNum].type ~= "oh" then
self:SetUpBuff(startingNum, self:SetUpBuff(startingNum,
GetInventoryItemTexture(self.unit, GetInventorySlotInfo("SecondaryHandSlot")), GetInventoryItemTexture(self.unit, GetInventorySlotInfo("SecondaryHandSlot")),
self.offHandEnchantEndTime, self.offHandEnchantEndTime,
@ -158,10 +176,17 @@ function PlayerInfo.prototype:UpdateBuffs(unit, fromRepeated)
true, true,
offHandCharges, offHandCharges,
"oh") "oh")
end
startingNum = startingNum + 1 startingNum = startingNum + 1
end end
for i=startingNum, IceCore.BuffLimit do
if self.frame.buffFrame.buffs[i]:IsVisible() then
self.frame.buffFrame.buffs[i]:Hide()
end
end
local direction = self.moduleSettings.buffGrowDirection == "Left" and -1 or 1 local direction = self.moduleSettings.buffGrowDirection == "Left" and -1 or 1
self.frame.buffFrame.buffs = self:CreateIconFrames(self.frame.buffFrame, direction, self.frame.buffFrame.buffs, "buff") self.frame.buffFrame.buffs = self:CreateIconFrames(self.frame.buffFrame, direction, self.frame.buffFrame.buffs, "buff")
end end