# HG changeset patch # User Chris Mellon # Date 1295136749 21600 # Node ID 15a0ceebbd83e69e38901c2330189902dd0bd128 # Parent 5def7d0617380433fe0544ef4ce0731acc0c6dc2 Updates to weapon enchant handling - add a phantom frame for the third enchant, move them to the bottom diff -r 5def7d061738 -r 15a0ceebbd83 KBF.lua --- a/KBF.lua Tue Jan 11 18:09:33 2011 -0600 +++ b/KBF.lua Sat Jan 15 18:12:29 2011 -0600 @@ -93,7 +93,6 @@ -- consolidated buffs if self.consolidateProxy:IsShown() then - --self.consolidateHeader:Show() -- *** STATE DRIVEN for idx=1,99 do local frame = self.consolidateHeader:GetAttribute("child"..idx) if not (frame and frame:IsShown()) then break end @@ -106,24 +105,19 @@ self:OnEnter(frame) end end - else - --self.consolidateHeader:Hide() -- *** STATE DRIVEN + buffCount = buffCount+1 end -- temporary enchants local tempEnchant = self.secureHeader:GetAttribute("tempEnchant1") if tempEnchant and tempEnchant:IsShown() then - if self.dirty or true then - self:BindBarToWeaponEnchant(tempEnchant, 16) - end + self:BindBarToWeaponEnchant(tempEnchant, 16) self:UpdateBarExpirationTime(tempEnchant) buffCount = buffCount + 1 end tempEnchant = self.secureHeader:GetAttribute("tempEnchant2") if tempEnchant and tempEnchant:IsShown() then - if self.dirty or true then - self:BindBarToWeaponEnchant(tempEnchant, 17) - end + self:BindBarToWeaponEnchant(tempEnchant, 17) self:UpdateBarExpirationTime(tempEnchant) buffCount = buffCount + 1 -- SAH binds the offhand enchant to the main hand for removal purposes. @@ -133,11 +127,31 @@ tempEnchant:SetAttribute('target-slot', 17) end end - -- there's also a third temp enchant for thrown weapons, which the - -- current SAH doesn't support at all. - -- Since I can't insert bars into the flow, can't support this - -- until I either go to multiple secure headers & figure out how to position them - -- or blizz fixes SAH + -- make a fake third buff bar. It can't be used to cancel the buff, but + -- at least you can see it. + + local thirdWeaponInfo = select(7, GetWeaponEnchantInfo()) + if thirdWeaponInfo then + if not self.tempEnchant3 then + -- largely copy/pasted code from SAH to bind to third weapon + self.tempEnchant3 = CreateFrame("Button", nil, self.secureHeader); + self.tempEnchant3:SetWidth(200+16) + self.tempEnchant3:SetHeight(16) + self.tempEnchant3:Show() + end + self.tempEnchant3:Show() + end + if self.tempEnchant3 and not thirdWeaponInfo then + self.tempEnchant3:Hide() + end + tempEnchant = self.tempEnchant3 + if tempEnchant and tempEnchant:IsShown() then + self.tempEnchant3:ClearAllPoints() + self.tempEnchant3:SetPoint("TOP", self.secureHeader, "TOP", 0, (buffCount * -16)) + self:BindBarToWeaponEnchant(tempEnchant, 18) + self:UpdateBarExpirationTime(tempEnchant) + buffCount = buffCount + 1 + end -- debuffs -- Since debuffs aren't cancellable, don't need to use the secure header @@ -162,7 +176,7 @@ self:SetBarAppearance(frame, name, icon, stacks, duration, expirationTime) frame:ClearAllPoints() -- position it under all the buffs, with a half-bar spacing - frame:SetPoint("TOP", self.anchor, "BOTTOM", 0, (buffCount * -16)) + frame:SetPoint("TOP", self.secureHeader, "TOP", 0, (buffCount * -16) - 8) frame:Show() frame.filter = "HARMFUL" frame.unit = unit @@ -199,7 +213,6 @@ end function kbf:BindBarToWeaponEnchant(parentFrame, slotOverride) - local index = parentFrame:GetAttribute("index") -- allow passing of explicit slot in order to work around aura header bug local slot = slotOverride or parentFrame:GetAttribute("target-slot") local itemIndex = slot - 15 -- 1MH, 2OF @@ -450,9 +463,9 @@ frame:SetAttribute("unit", "player") frame:SetAttribute("sortMethod", "NAME") frame:SetAttribute("sortOrder", "-") - -- TODO: SecureAuraHeader doesn't correcltly implement the temp enchants + -- TODO: SecureAuraHeader doesn't correctly implement the temp enchants frame:SetAttribute("weaponTemplate", "KBFSecureUnitAuraTemplate") - frame:SetAttribute("includeWeapons", 1) + frame:SetAttribute("includeWeapons", 100) frame:Show() -- has to be shown, otherwise the child frames don't show return frame end