Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local bufficons = {
- 'Interface\\Icons\\spell_nature_regeneration', --stats
- 'Interface\\Icons\\spell_holy_wordfortitude', --stamina
- 'Interface\\Icons\\ability_warrior_battleshout', --attack power
- 'Interface\\Icons\\ability_rogue_disembowel', --haste
- 'Interface\\Icons\\spell_holy_magicalsentry', --spell power
- 'Interface\\Icons\\spell_nature_unyeildingstamina', --crit
- 'Interface\\Icons\\spell_holy_greaterblessingofkings',--mastery
- 'Interface\\Icons\\inv_elemental_mote_air01', --multistrike
- 'Interface\\Icons\\spell_holy_mindvision', --versatility
- 'Interface\\Icons\\trade_alchemy_dpotion_c12', --flask
- 'Interface\\Icons\\spell_misc_food', --well fed
- }
- local MMCBFrame = CreateFrame("Frame", nil, UIParent) --parent it to minimap so whenever the minimap hides (pet battles) this hides too, even if we're in a group
- MMCBFrame:SetSize(18,1) --should always be 2 + the size of the icon in spellicons table to keep 1 px border
- MMCBFrame:SetPoint("TOPRIGHT", Minimap, "TOPLEFT", 6, 1) --account for the 1px backdrop around minimap
- MMCBFrame:SetPoint("BOTTOMRIGHT", Minimap, "BOTTOMLEFT", 6, -1) --account for the 1px backdrop around minimap
- MMCBFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
- MMCBFrame:RegisterEvent("GROUP_ROSTER_UPDATE") --register these two events to match blizz functionality for the consolidated buffsrame
- MMCBFrame:RegisterEvent("PLAYER_SPECIALIZATION_CHANGED")
- MMCBFrame:SetBackdrop(backdrop)
- MMCBFrame:SetBackdropColor(0, 0, 0)
- MMCBFrame:SetBackdropBorderColor(0, 0, 0)
- local function CreateButton(i)
- local iconFrame = CreateFrame("Frame", "MMCBButton"..i, MMCBFrame)
- iconFrame:SetFrameStrata("Medium")
- iconFrame:SetSize(18, 18)
- local iconTexture = iconFrame:CreateTexture(nil,"OVERLAY")
- iconTexture:SetAllPoints(iconFrame)
- iconTexture:SetTexture(bufficons[i])
- iconTexture:SetTexCoord(0.07, 0.93, 0.07, 0.93)
- return iconFrame
- end
- for i = 1, 9 do --9 is number of buff categories
- MMCBFrame[i] = CreateButton(i)
- if i == 1 then
- MMCBFrame[i]:SetPoint("TOP", MMCBFrame, "TOP", -1, 0) --start with the first one 1 pixel left
- else
- MMCBFrame[i]:SetPoint("TOP", MMCBFrame[i-1], "BOTTOM", 0, -1) --space each one 1 pxl down
- end
- end
- MMCBFrame:SetScript('OnEvent', function(self, event)
- if event == "UNIT_AURA" or (event == "PLAYER_ENTERING_WORLD" and ShouldShowConsolidatedBuffFrame()) then
- for i = 1, 9 do
- local spellName = GetRaidBuffTrayAuraInfo(i)
- if spellName then --indicative that we have this buff, therefore, we want to make the icon not bright
- MMCBFrame[i]:SetAlpha(0.3)
- else
- MMCBFrame[i]:SetAlpha(1) --indicative that we are missing the buff, make the icon bright, alerting us to request buff
- end
- end
- else --should fire when our comp changes or i switch specs? I don't get why blizzard registered the spec swap in the check for their conoslidatedbuffs:show/hide code
- if ShouldShowConsolidatedBuffFrame() then --we're in a group want to start looking at buffs
- MMCBFrame:RegisterUnitEvent("UNIT_AURA", "player") --unit register unitaura for the player only
- MMCBFrame:Show() --show the frame, cause you know, we dont code 40 lines for nothing
- else
- MMCBFrame:UnregisterEvent("UNIT_AURA") --we either left the group or the group disbanded, no senseless polling of cpu resources
- MMCBFrame:Hide() --hide the frame, cause, it doesn't help us visually during solo
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement