Allow players to cancel their buffs outside of combat

This commit is contained in:
Thyraxion
2014-10-22 20:07:57 +02:00
parent 996942ae0e
commit 149d22ad3a

View File

@ -60,30 +60,31 @@ StaticPopupDialogs["ICEHUD_BUFF_DISMISS_UNAVAILABLE"] =
hideOnEscape = 0, hideOnEscape = 0,
} }
local function OnBuffMouseUp(frame, button) -- playerinfo buffclick event handle
if IceHUD.WowVer >= 40000 then function PlayerInfo.prototype:BuffClick(this,event)
if button == "RightButton" then -- We want to catch the rightbutton click.
StaticPopup_Show("ICEHUD_BUFF_DISMISS_UNAVAILABLE") -- We also need to check for combat lockdown. The api won't allow cancelling during combat lockdown.
end if( event == "RightButton" ) and not InCombatLockdown() then
else if this.type == "mh" then
--[[ if( button == "RightButton" ) then CancelItemTempEnchantment(1)
if buffs[i].type == "mh" then elseif this.type == "oh" then
CancelItemTempEnchantment(1) CancelItemTempEnchantment(2)
elseif buffs[i].type == "oh" then else
CancelItemTempEnchantment(2) CancelUnitBuff(self.unit, this.id)
else end
CancelUnitBuff("player", i)
end
end]]
end end
end end
function PlayerInfo.prototype:CreateIconFrames(parent, direction, buffs, type) function PlayerInfo.prototype:CreateIconFrames(parent, direction, buffs, type)
local buffs = PlayerInfo.super.prototype.CreateIconFrames(self, parent, direction, buffs, type) local buffs = PlayerInfo.super.prototype.CreateIconFrames(self, parent, direction, buffs, type)
if not self.MyOnClickBuffFunc then
self.MyOnClickBuffFunc = function(this,event) self:BuffClick(this,event) end
end
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", OnBuffMouseUp) buffs[i]:SetScript("OnMouseUp", self.MyOnClickBuffFunc)
else else
buffs[i]:SetScript("OnMouseUp", nil) buffs[i]:SetScript("OnMouseUp", nil)
end end