comparison KBF.lua @ 69:b467bba0224d

okay, now do vehicle swapping in a better, simpler way that will also show debuffs
author Chris Mellon <arkanes@gmail.com>
date Sat, 30 Jun 2012 18:27:23 -0500
parents f5bd73181349
children dbf17a303006
comparison
equal deleted inserted replaced
68:f5bd73181349 69:b467bba0224d
123 if ( GameTooltip:IsOwned(frame) ) then 123 if ( GameTooltip:IsOwned(frame) ) then
124 self:OnEnter(frame) 124 self:OnEnter(frame)
125 end 125 end
126 end 126 end
127 buffCount = buffCount+1 127 buffCount = buffCount+1
128 end
129
130 if self.vehicleHeader:IsShown() then
131 local unit = "vehicle"
132 for idx=1,99 do
133 local frame = self.vehicleHeader:GetAttribute("child"..idx)
134 if not (frame and frame:IsShown()) then break end
135 if true then
136 if self:BindBarToBuff(frame, unit) then break end
137 end
138 self:UpdateBarExpirationTime(frame)
139 -- Don't forget to refresh shown tooltips
140 if ( GameTooltip:IsOwned(frame) ) then
141 self:OnEnter(frame)
142 end
143 end
144 end 128 end
145 129
146 -- SAH correctly binds the weapon enchant templates now, but when temp enchants 130 -- SAH correctly binds the weapon enchant templates now, but when temp enchants
147 -- are present and used, it seems that it doesn't correctly hide un-bound 131 -- are present and used, it seems that it doesn't correctly hide un-bound
148 -- buff frames, which breaks all the layout and so forth. 132 -- buff frames, which breaks all the layout and so forth.
502 -- position it relative to the proxy, so it can appear where we want it 486 -- position it relative to the proxy, so it can appear where we want it
503 consolidateHeader:SetPoint("TOPRIGHT", anchor, "TOPLEFT", 0, 0) 487 consolidateHeader:SetPoint("TOPRIGHT", anchor, "TOPLEFT", 0, 0)
504 consolidateHeader:SetWidth(height + width) 488 consolidateHeader:SetWidth(height + width)
505 consolidateHeader:SetHeight(height) 489 consolidateHeader:SetHeight(height)
506 consolidateHeader:Show() 490 consolidateHeader:Show()
507 491
508 local vehicleHeader = CreateFrame("FRAME", "KBFBuffFrame", UIParent, "SecureAuraHeaderTemplate") 492
509 self:SetCommonSecureHeaderAttributes(vehicleHeader) 493 local vehicleSwapper = CreateFrame("FRAME", "KBFVehicleSwapper", UIParent, "SecureHandlerStateTemplate")
510 vehicleHeader:SetAttribute("unit", "vehicle") 494 vehicleSwapper:SetAttribute("unit", "vehicle")
511 vehicleHeader:SetPoint("TOP", anchor, "TOP", 0, 0) 495 vehicleSwapper:SetFrameRef("secureHeader", secureHeader)
512 vehicleHeader:SetWidth(height + width) 496 vehicleSwapper:SetAttribute("_onstate-unitexists", [[
513 vehicleHeader:SetHeight(height) 497 local frame = self:GetFrameRef("secureHeader")
514 RegisterUnitWatch(vehicleHeader) 498 if newstate then
515 499 frame:SetAttribute("unit", "vehicle")
516 500 else
517 local frameHider = CreateFrame("FRAME", "KBFFrameHider", UIParent, "SecureHandlerStateTemplate") 501 frame:SetAttribute("unit", "player")
518 frameHider:SetAttribute("unit", "vehicle")
519 frameHider:SetFrameRef("frame1", secureHeader)
520 frameHider:SetFrameRef("frame2", consolidateHeader)
521 frameHider:SetFrameRef("frame3", consolidateProxy)
522 frameHider:SetAttribute("_onstate-unitexists", [[
523 for idx=1,99 do
524 local frame = self:GetFrameRef("frame"..idx)
525 if frame then
526 if newstate then
527 frame:Hide()
528 else
529 frame:Show()
530 end
531 end
532 end 502 end
533 ]]) 503 ]])
534 RegisterUnitWatch(frameHider, true) 504 RegisterUnitWatch(vehicleSwapper, true)
535 505
536 506
537 return anchor, secureHeader, consolidateHeader, consolidateProxy, vehicleHeader 507 return anchor, secureHeader, consolidateHeader, consolidateProxy
538 end 508 end
539 509
540 --- sets the attributes needed by all the headers 510 --- sets the attributes needed by all the headers
541 function kbf:SetCommonSecureHeaderAttributes(frame) 511 function kbf:SetCommonSecureHeaderAttributes(frame)
542 frame:SetAttribute("filter", "HELPFUL") 512 frame:SetAttribute("filter", "HELPFUL")