Mercurial > wow > kbf
comparison KBF.lua @ 37:15b9e97ab2d2
hacked in very, very basic consolidated buff support. Needs *much* clean up, get side effects out of functions that don't want them, get the hide/show anchor logic into a secure state thingy
| author | Chris Mellon <arkanes@gmail.com> |
|---|---|
| date | Fri, 31 Dec 2010 08:36:30 -0600 |
| parents | 758987dad08c |
| children | 0addebdd412f |
comparison
equal
deleted
inserted
replaced
| 36:758987dad08c | 37:15b9e97ab2d2 |
|---|---|
| 80 -- Don't forget to refresh shown tooltips | 80 -- Don't forget to refresh shown tooltips |
| 81 if ( GameTooltip:IsOwned(frame) ) then | 81 if ( GameTooltip:IsOwned(frame) ) then |
| 82 self:OnEnter(frame) | 82 self:OnEnter(frame) |
| 83 end | 83 end |
| 84 end | 84 end |
| 85 | |
| 86 -- consolidated buffs | |
| 87 if self.consolidateProxy:IsShown() then | |
| 88 self.consolidateHeader:Show() -- *** STATE DRIVEN | |
| 89 for idx=1,99 do | |
| 90 local frame = self.consolidateHeader:GetAttribute("child"..idx) | |
| 91 if not (frame and frame:IsShown()) then break end | |
| 92 if self.dirty then | |
| 93 if self:BindBarToBuff(frame, unit) then break end | |
| 94 end | |
| 95 self:UpdateBarExpirationTime(frame) | |
| 96 -- Don't forget to refresh shown tooltips | |
| 97 if ( GameTooltip:IsOwned(frame) ) then | |
| 98 self:OnEnter(frame) | |
| 99 end | |
| 100 end | |
| 101 else | |
| 102 self.consolidateHeader:Hide() -- *** STATE DRIVEN | |
| 103 end | |
| 104 | |
| 85 -- temporary enchants | 105 -- temporary enchants |
| 86 local tempEnchant = self.secureFrame:GetAttribute("tempEnchant1") | 106 local tempEnchant = self.secureFrame:GetAttribute("tempEnchant1") |
| 87 if tempEnchant and tempEnchant:IsShown() then | 107 if tempEnchant and tempEnchant:IsShown() then |
| 88 if self.dirty or true then | 108 if self.dirty or true then |
| 89 self:BindBarToWeaponEnchant(tempEnchant, 16) | 109 self:BindBarToWeaponEnchant(tempEnchant, 16) |
| 365 anchor:SetScript("OnDragStop", anchor.StopMovingOrSizing) | 385 anchor:SetScript("OnDragStop", anchor.StopMovingOrSizing) |
| 366 anchor:ClearAllPoints() | 386 anchor:ClearAllPoints() |
| 367 anchor:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", 0, 0) | 387 anchor:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", 0, 0) |
| 368 anchor:Hide() | 388 anchor:Hide() |
| 369 | 389 |
| 370 local frame = CreateFrame("FRAME", "KBFBuffFrame", UIParent, "SecureAuraHeaderTemplate") | 390 self.secureFrame = self:CreateSecureHeaderFrame("KBFBuffFrame", "SecureAuraHeaderTemplate") |
| 371 --local frame = anchor | 391 self.secureFrame:SetPoint("TOP", anchor, "TOP", 0, 0) |
| 392 self.secureFrame:SetAttribute("consolidateTo", 1) | |
| 393 -- pre-create the consolidated proxy & headers so I can decide what they look like | |
| 394 -- lazy - just make it a regular bar for now | |
| 395 self.consolidateProxy = self:ConstructBar() | |
| 396 self.secureFrame:SetAttribute("consolidateProxy", self.consolidateProxy) | |
| 397 self.secureFrame:SetAttribute("frameref-proxy", GetFrameHandle(self.consolidateProxy)) | |
| 398 -- pre-create the consolidated header | |
| 399 self.consolidateHeader = self:CreateSecureHeaderFrame("KBFConsolidatedAnchorFrame") | |
| 400 self.secureFrame:SetAttribute("consolidateHeader", self.consolidateHeader) | |
| 401 self.consolidateHeader:SetPoint("RIGHT", self.consolidateProxy, "LEFT", 0, 0) | |
| 402 self.consolidateHeader:SetBackdrop({bgFile = "Interface/Tooltips/UI-Tooltip-Background", | |
| 403 edgeFile = "Interface/Tooltips/UI-Tooltip-Border", | |
| 404 tile = true, tileSize = 16, edgeSize = 12, | |
| 405 insets = { left = 4, right = 4, top = 4, bottom = 4 }, | |
| 406 }) | |
| 407 self.consolidateHeader:SetWidth(200 +16) | |
| 408 self.consolidateHeader:SetHeight(16) | |
| 409 self.consolidateHeader:Show() | |
| 410 self.consolidateProxy:SetAttribute("header", self.consolidateHeader); | |
| 411 self.consolidateProxy:SetAttribute("frameref-header", GetFrameHandle(self.consolidateHeader)) | |
| 412 return anchor | |
| 413 end | |
| 414 | |
| 415 function kbf:CreateSecureHeaderFrame(name, template) | |
| 416 local frame = CreateFrame("FRAME", name, UIParent, template) | |
| 372 frame:SetAttribute("filter", "HELPFUL") | 417 frame:SetAttribute("filter", "HELPFUL") |
| 373 frame:SetAttribute("toggleForVehicle", true) -- this doesn't actually work right now, but maybe it eventually will | 418 frame:SetAttribute("toggleForVehicle", true) -- this doesn't actually work right now, but maybe it eventually will |
| 374 frame:SetAttribute("template", "KBFSecureUnitAuraTemplate") | 419 frame:SetAttribute("template", "KBFSecureUnitAuraTemplate") |
| 375 frame:SetAttribute("point", "TOP") | 420 frame:SetAttribute("point", "TOP") |
| 376 frame:SetAttribute("wrapAfter", 100) -- required due to bugs in secure header | 421 frame:SetAttribute("wrapAfter", 100) -- required due to bugs in secure header |
| 377 frame:SetAttribute("consolidateTo", nil) | |
| 378 frame:SetAttribute("xOffset", 0) | 422 frame:SetAttribute("xOffset", 0) |
| 379 frame:SetAttribute("yOffset", -16) | 423 frame:SetAttribute("yOffset", -16) |
| 380 frame:SetAttribute("minWidth", 216) | 424 frame:SetAttribute("minWidth", 216) |
| 381 frame:SetAttribute("minHeight", 16) | 425 frame:SetAttribute("minHeight", 16) |
| 382 frame:SetAttribute("unit", "player") | 426 frame:SetAttribute("unit", "player") |
| 383 frame:SetAttribute("sortMethod", "NAME") | 427 frame:SetAttribute("sortMethod", "NAME") |
| 384 frame:SetAttribute("sortOrder", "-") | 428 frame:SetAttribute("sortOrder", "-") |
| 385 -- TODO: SecureAuraHeader doesn't correcltly implement the temp enchants | 429 -- TODO: SecureAuraHeader doesn't correcltly implement the temp enchants |
| 386 frame:SetAttribute("weaponTemplate", "KBFSecureUnitAuraTemplate") | 430 frame:SetAttribute("weaponTemplate", "KBFSecureUnitAuraTemplate") |
| 387 frame:SetAttribute("includeWeapons", 1) | 431 frame:SetAttribute("includeWeapons", 1) |
| 388 frame:SetPoint("TOP", anchor, "TOP", 0, 0) | |
| 389 frame:Show() -- has to be shown, otherwise the child frames don't show | 432 frame:Show() -- has to be shown, otherwise the child frames don't show |
| 390 self.secureFrame = frame | 433 return frame |
| 391 return anchor | |
| 392 end | 434 end |
| 393 | 435 |
| 394 function kbf:ShowAnchor() | 436 function kbf:ShowAnchor() |
| 395 self.secureFrame:ClearAllPoints() | 437 self.secureFrame:ClearAllPoints() |
| 396 self.secureFrame:SetPoint("TOP", self.anchor, "BOTTOM", 0, 0) | 438 self.secureFrame:SetPoint("TOP", self.anchor, "BOTTOM", 0, 0) |
