Guest User


a guest
Nov 10th, 2015
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local bufficons = {
  2.     '|TInterface\\Icons\\spell_nature_regeneration:22:22:0:0:22:22:2:20:2:20|t',        --stats
  3.     '|TInterface\\Icons\\spell_holy_wordfortitude:22:22:0:0:22:22:2:20:2:20|t',         --stamina
  4.     '|TInterface\\Icons\\ability_warrior_battleshout:22:22:0:0:22:22:2:20:2:20|t',      --attack power
  5.     '|TInterface\\Icons\\ability_rogue_disembowel:22:22:0:0:22:22:2:20:2:20|t',         --haste
  6.     '|TInterface\\Icons\\spell_holy_magicalsentry:22:22:0:0:22:22:2:20:2:20|t',         --spell power
  7.     '|TInterface\\Icons\\spell_nature_unyeildingstamina:22:22:0:0:22:22:2:20:2:20|t',   --crit
  8.     '|TInterface\\Icons\\spell_holy_greaterblessingofkings:22:22:0:0:22:22:2:20:2:20|t',--mastery
  9.     '|TInterface\\Icons\\inv_elemental_mote_air01:22:22:0:0:22:22:2:20:2:20|t',         --multistrike
  10.     '|TInterface\\Icons\\spell_holy_mindvision:22:22:0:0:22:22:2:20:2:20|t',            --versatility
  11.     '|TInterface\\Icons\\trade_alchemy_dpotion_c12:22:22:0:0:22:22:2:20:2:20|t',        --flask
  12.     '|TInterface\\Icons\\spell_misc_food:22:22:0:0:22:22:2:20:2:20|t',                  --well fed
  13. }
  15. local MMCBFrame = CreateFrame("Frame", nil, UIParent)   --parent it to uiparent so whenever the minimap hides (pet battles) this hides too, even if we're in a group
  16. MMCBFrame:SetWidth(22)                                  --should always be 2 + the size of the icon in spellicons table to keep 1 px border
  17. MMCBFrame:SetPoint("TOPRIGHT", Minimap, "TOPLEFT", -1, 1)   --account for the 1px backdrop around minimap
  18. MMCBFrame:SetPoint("BOTTOMRIGHT", Minimap, "BOTTOMLEFT", 1, -1) --account for the 1px backdrop around minimap
  19. MMCBFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
  20. MMCBFrame:RegisterEvent("GROUP_ROSTER_UPDATE")          --register these two events to match blizz functionality for the consolidated buffsrame
  23. for i = 1, 9 do --9 is number of buff categories
  24.     MMCBFrame.i = CreateFrame("Button", "MMCBButton..i", MMCBFrame) --make 9 buttons on the mmcbframe
  25.     if i == 1 then
  26.         MMCBFrame.i:SetPoint("TOP", MMCBFrame, "TOP", 0, -1)    --start with the first one 1 pixel down to keep the 1 px border
  27.     else
  28.         MMCBFrame.i:SetPoint("TOP", MMCBFrame[i-1], "BOTTOM")   --possibly need to add a spacer in between each one
  29.     end
  30.     MMCBFrame.i.fs = MMCBFrame.i:CreateFontString(nil, "OVERLAY")   --create a texture on each individual button
  31.     MMCBFrame.i.fs:SetAllPoints()
  32.     MMCBFrame.i.fs:SetFont('Fonts\\MORPHEUS.ttf', 10)
  33.     MMCBFrame.i.fs:SetText(bufficons.i)                     --assign the respective texture to each button
  34. end
  36. MMCBFrame:SetScript('OnEvent', function(self, event)
  37.     if event == "UNIT_AURA" then                            --should only be registered when we are in a group (aka the consolidated buff frame should be shown)
  38.         for i = 1, 9 do                                     --parse over the 9 possible classes of buffs
  39.             local spellName = GetRaidBuffTrayAuraInfo(i)    --assign this variable to the first value this Get returns (spellName)
  40.             if spellName then                               --indicative that we have this buff, therefore, we want to make the icon not bright
  41.                 MMCBFrame.i.fs:SetAlpha(0.3)
  42.             else
  43.                 MMCBFrame.i.fs:SetAlpha(1)                  --indicative that we are missing the buff, make the icon bright, alerting us to request buff
  44.             end
  45.         end
  46.     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
  47.         if ShouldShowConsolidatedBuffFrame() then               --we're in a group want to start looking at buffs
  48.             MMCBFrame:RegisterUnitEvent("UNIT_AURA", "player")  --unit register unitaura for the player only
  49.             MMCBFrame:Show()                                    --show the frame, cause you know, we dont code 40 lines for nothing
  50.         else
  51.             MMCBFrame:UnregisterEvent("UNIT_AURA")              --we either left the group or the group disbanded, no senseless polling of cpu resources
  52.             MMCBFrame:Hide()                                    --hide the frame, cause, it doesn't help us visually during solo
  53.         end
  54.     end
  55. end)
RAW Paste Data