Mercurial > wow > kbf
comparison KBF.lua @ 64:e5c07fdfb70b
remove the old hacked weapon enchant stuff since SAH properly supports it now, but turn it off because due to bugs either in KBF or SAH (both?), you get overlapping messed up displays whenever you have extra, non-buff frames
author | Chris Mellon <arkanes@gmail.com> |
---|---|
date | Fri, 02 Dec 2011 06:15:35 -0600 |
parents | 31eac67dd283 |
children | e19d0380b9f3 |
comparison
equal
deleted
inserted
replaced
63:626f592fb5e5 | 64:e5c07fdfb70b |
---|---|
96 local unit = self.secureHeader:GetAttribute("unit") | 96 local unit = self.secureHeader:GetAttribute("unit") |
97 local buffCount = 0 | 97 local buffCount = 0 |
98 for idx=1,99 do | 98 for idx=1,99 do |
99 local frame = self.secureHeader:GetAttribute("child"..idx) | 99 local frame = self.secureHeader:GetAttribute("child"..idx) |
100 if not (frame and frame:IsShown()) then break end | 100 if not (frame and frame:IsShown()) then break end |
101 local hasbuff = UnitAura(unit, frame:GetAttribute("index")) | |
101 buffCount = buffCount + 1 | 102 buffCount = buffCount + 1 |
102 if self.dirty then | 103 if self.dirty then |
103 if self:BindBarToBuff(frame, unit) then break end | 104 if self:BindBarToBuff(frame, unit) then break end |
104 end | 105 end |
105 self:UpdateBarExpirationTime(frame) | 106 self:UpdateBarExpirationTime(frame) |
106 -- Don't forget to refresh shown tooltips | 107 -- Don't forget to refresh shown tooltips |
107 if (GameTooltip:IsOwned(frame)) then | 108 if (GameTooltip:IsOwned(frame)) then |
108 self:OnEnter(frame) | 109 self:OnEnter(frame) |
109 end | 110 end |
110 end | 111 end |
111 | |
112 -- consolidated buffs | 112 -- consolidated buffs |
113 if self.consolidateProxy:IsShown() then | 113 if self.consolidateProxy:IsShown() then |
114 for idx=1,99 do | 114 for idx=1,99 do |
115 local frame = self.consolidateHeader:GetAttribute("child"..idx) | 115 local frame = self.consolidateHeader:GetAttribute("child"..idx) |
116 if not (frame and frame:IsShown()) then break end | 116 if not (frame and frame:IsShown()) then break end |
123 self:OnEnter(frame) | 123 self:OnEnter(frame) |
124 end | 124 end |
125 end | 125 end |
126 buffCount = buffCount+1 | 126 buffCount = buffCount+1 |
127 end | 127 end |
128 -- SAH correctly binds the weapon enchant templates now, but when temp enchants | |
129 -- are present and used, it seems that it doesn't correctly hide un-bound | |
130 -- buff frames, which breaks all the layout and so forth. | |
131 for weapon=3,1,-1 do | |
132 local tempEnchant = self.secureHeader:GetAttribute("tempEnchant"..weapon) | |
133 if tempEnchant and tempEnchant:IsShown() then | |
134 self:BindBarToWeaponEnchant(tempEnchant) | |
135 self:UpdateBarExpirationTime(tempEnchant) | |
136 buffCount = buffCount + 1 | |
137 end | |
138 end | |
128 | 139 |
129 -- temporary enchants | 140 -- debuffs |
130 -- TODO: So much copy/paste here. I really need to clean this up. | 141 -- Since debuffs aren't cancellable, don't need to use the secure header |
131 local tempEnchant = self.secureHeader:GetAttribute("tempEnchant1") | 142 -- for them. This could be rewritten to support useful features like |
132 if tempEnchant and tempEnchant:IsShown() then | 143 -- sorting & scaling and stuff. Honestly, should at least be alphabetical. |
133 self:BindBarToWeaponEnchant(tempEnchant, 16) | |
134 self:UpdateBarExpirationTime(tempEnchant) | |
135 buffCount = buffCount + 1 | |
136 end | |
137 if ( tempEnchant and GameTooltip:IsOwned(tempEnchant) ) then | |
138 self:OnEnter(tempEnchant) | |
139 end | |
140 tempEnchant = self.secureHeader:GetAttribute("tempEnchant2") | |
141 if tempEnchant and tempEnchant:IsShown() then | |
142 self:BindBarToWeaponEnchant(tempEnchant, 17) | |
143 self:UpdateBarExpirationTime(tempEnchant) | |
144 buffCount = buffCount + 1 | |
145 -- SAH binds the offhand enchant to the main hand for removal purposes. | |
146 -- fix it up if we're out of combat | |
147 -- TODO: maybe this should only happen if we're dirty | |
148 self:QueueForOOC(function() self.secureHeader:GetAttribute("tempEnchant2"):SetAttribute('target-slot', 17) end) | |
149 end | |
150 if ( tempEnchant and GameTooltip:IsOwned(tempEnchant) ) then | |
151 self:OnEnter(tempEnchant) | |
152 end | |
153 -- make a fake third buff bar. It can't be used to cancel the buff, but | |
154 -- at least you can see it. | |
155 local thirdWeaponInfo = select(7, GetWeaponEnchantInfo()) | |
156 if thirdWeaponInfo then | |
157 if not self.tempEnchant3 then | |
158 -- largely copy/pasted code from SAH to bind to third weapon | |
159 self.tempEnchant3 = CreateFrame("Button", nil, self.secureHeader); | |
160 self.tempEnchant3.unit = "player" | |
161 self.tempEnchant3:SetWidth(200+16) | |
162 self.tempEnchant3:SetHeight(16) | |
163 self.tempEnchant3:Show() | |
164 self.tempEnchant3:SetScript("OnEnter", function() kbf:OnEnter(self.tempEnchant3) end) | |
165 self.tempEnchant3:SetScript("OnLeave", function() GameTooltip:Hide() end) | |
166 self.tempEnchant3:EnableMouse(true) | |
167 --TODO: queue up for setting when leaving combat | |
168 self:QueueForOOC(function() self.tempEnchant3:SetAttribute('target-slot', 18) end) | |
169 -- set up the tooltip | |
170 end | |
171 -- most likely: it stays visible but stops moving. | |
172 -- in this case, maybe parent it to the OH enchant also | |
173 -- so it vanishes and gets out of the way. | |
174 | |
175 self.tempEnchant3:Show() | |
176 end | |
177 if self.tempEnchant3 and not thirdWeaponInfo then | |
178 self.tempEnchant3:Hide() | |
179 end | |
180 tempEnchant = self.tempEnchant3 | |
181 if tempEnchant and tempEnchant:IsShown() then | |
182 self.tempEnchant3:ClearAllPoints() | |
183 self.tempEnchant3:SetPoint("TOP", self.secureHeader, "TOP", 0, (buffCount * -16)) | |
184 self:BindBarToWeaponEnchant(tempEnchant, 18) | |
185 self:UpdateBarExpirationTime(tempEnchant) | |
186 buffCount = buffCount + 1 | |
187 end | |
188 if ( tempEnchant and GameTooltip:IsOwned(tempEnchant) ) then | |
189 self:OnEnter(tempEnchant) | |
190 end | |
191 -- debuffs | |
192 -- Since debuffs aren't cancellable, don't need to use the secure header | |
193 -- for them. This could be rewritten to support useful features like | |
194 -- sorting & scaling and stuff. Honestly, should at least be alphabetical. | |
195 for idx=1,99 do | 144 for idx=1,99 do |
196 local frame = self.debuffFrames[idx] | 145 local frame = self.debuffFrames[idx] |
197 if self.dirty then | 146 if self.dirty then |
198 local name, rank, icon, stacks, debuffType, duration, expirationTime = UnitAura(unit, idx, "HARMFUL") | 147 local name, rank, icon, stacks, debuffType, duration, expirationTime = UnitAura(unit, idx, "HARMFUL") |
199 if not name then | 148 if not name then |
548 frame:SetAttribute("minWidth", 216) | 497 frame:SetAttribute("minWidth", 216) |
549 frame:SetAttribute("minHeight", 16) | 498 frame:SetAttribute("minHeight", 16) |
550 frame:SetAttribute("unit", "player") | 499 frame:SetAttribute("unit", "player") |
551 frame:SetAttribute("sortMethod", "NAME") | 500 frame:SetAttribute("sortMethod", "NAME") |
552 frame:SetAttribute("sortOrder", "-") | 501 frame:SetAttribute("sortOrder", "-") |
553 -- TODO: SecureAuraHeader doesn't correctly implement the temp enchants | 502 |
554 frame:SetAttribute("weaponTemplate", "KBFSecureUnitAuraTemplate") | 503 frame:SetAttribute("weaponTemplate", "KBFSecureUnitAuraTemplate") |
555 frame:SetAttribute("includeWeapons", 100) | 504 -- TODO: Enabling temp enchant support breaks layout for regular buffs |
505 frame:SetAttribute("includeWeapons", nil) | |
556 frame:Show() -- has to be shown, otherwise the child frames don't show | 506 frame:Show() -- has to be shown, otherwise the child frames don't show |
557 return frame | 507 return frame |
558 end | 508 end |
559 | 509 |
560 function kbf:ShowAnchor() | 510 function kbf:ShowAnchor() |