diff --git a/AuraFilter.lua b/AuraFilter.lua new file mode 100644 index 0000000..6a128df --- /dev/null +++ b/AuraFilter.lua @@ -0,0 +1,686 @@ +--[[-------------------------------------------------------------------- + Credits and thanks to Phanx for this filter configuration. + (Phanx < addons@phanx.net >) +------------------------------------------------------------------------ + Values: + 1 = by anyone on anyone + 2 = by player on anyone + 3 = by anyone on friendly + 4 = by anyone on player +----------------------------------------------------------------------]] + +local playerClass = select(2, UnitClass('player')) +local playerRace = select(2, UnitRace('player')) + +local auras = {} + +local function addAuras(t) + for k, v in pairs(t) do + if not auras[k] then + auras[k] = v + end + end +end + +------------------------------------------------------------------------ +-- Buffed + +addAuras({ + [90355] = 4, -- Ancient Hysteria [hunter core hound] + [2825] = 4, -- Bloodlust + [1022] = 4, -- Hand of Protection + [32182] = 4, -- Heroism + [29166] = 4, -- Innervate + [55503] = 4, -- Lifeblood [herbalism] + [80353] = 4, -- Time Warp + [33206] = 4, -- Pain Suppression + [10060] = 4, -- Power Infusion + [49016] = 4, -- Unholy Frenzy +}) + +------------------------------------------------------------------------ +-- Armor reduced + +if playerClass == 'DRUID' or playerClass == 'WARRIOR' then addAuras({ + [35387] = 1, -- Corrosive Spit [hunter serpent] + [91565] = 1, -- Faerie Fire + [8647] = 1, -- Expose Armor + [7386] = 1, -- Sunder Armor + [50498] = 1, -- Tear Armor [hunter raptor] +}) end + +------------------------------------------------------------------------ +-- Attack speed reduced + +if playerClass == 'WARRIOR' then addAuras({ + [54404] = 1, -- Dust Cloud [hunter tallstrider] + [8042] = 1, -- Earth Shock + [55095] = 1, -- Frost Fever + [58179] = 1, -- Infected Wounds [Rank 1] + [58180] = 1, -- Infected Wounds [Rank 2] + [68055] = 1, -- Judgements of the Just + [14251] = 1, -- Riposte + [90315] = 1, -- Tailspin [hunter fox] + [6343] = 1, -- Thunder Clap +}) end + +------------------------------------------------------------------------ +-- Bleed damage taken increased + +if playerClass == 'DRUID' or playerClass == 'ROGUE' then addAuras({ + [35290] = 1, -- Gore [hunter boar] -- NEEDS CHECK + [16511] = 1, -- Hemorrhage + [33878] = 1, -- Mangle [Bear Form] + [33876] = 1, -- Mangle [Cat Form] + [57386] = 1, -- Stampede [hunter rhino] + [50271] = 1, -- Tendon Rip [hunter hyena] + [46857] = 1, -- Trauma <== Blood Frenzy +}) end + +------------------------------------------------------------------------ +-- Casting speed reduced + +if playerClass == 'MAGE' or playerClass == 'ROGUE' or playerClass == 'WARLOCK' then addAuras({ + [1714] = 1, -- Curse of Tongues + [58604] = 1, -- Lava Breath [hunter core hound] + [5760] = 1, -- Mind-Numbing Poison + [31589] = 1, -- Slow + [50274] = 1, -- Spore Cloud [hunter sporebat] +}) end + +------------------------------------------------------------------------ +-- Healing effects reduced + +if playerClass == 'HUNTER' or playerClass == 'ROGUE' or playerClass == 'WARRIOR' then addAuras({ + [56112] = 1, -- Furious Attacks + [48301] = 1, -- Mind Trauma <== Improved Mind Blast + [30213] = 1, -- Legion Strike [warlock felguard] + [54680] = 1, -- Monstrous Bite [hunter devilsaur] + [12294] = 1, -- Mortal Strike + [82654] = 1, -- Widow Venom + [13218] = 1, -- Wound Poison +}) end + +------------------------------------------------------------------------ +-- Physical damage dealt reduced + +if playerClass == 'DEATHKNIGHT' or playerClass == 'DRUID' or playerClass == 'WARRIOR' then addAuras({ + [702] = 1, -- Curse of Weakness + [99] = 1, -- Demoralizing Roar + [50256] = 1, -- Demoralizing Roar [hunter bear] + [1160] = 1, -- Demoralizing Shout + [81130] = 1, -- Scarlet Fever + [26017] = 1, -- Vindication +}) end + +------------------------------------------------------------------------ +-- Disarmed + +if playerClass == '' then addAuras({ + [50541] = 1, -- Clench (hunter scorpid) + [676] = 1, -- Disarm (warrior) + [51722] = 1, -- Dismantle (rogue) + [64058] = 1, -- Psychic Horror (priest) + [91644] = 1, -- Snatch (hunter bird of prey) +}) end + +------------------------------------------------------------------------ +-- Silenced + +if playerClass == '' then addAuras({ + [25046] = 1, -- Arcane Torrent (blood elf) + [31935] = 1, -- Avenger's Shield (paladin) + [1330] = 1, -- Garrote - Silence (rogue) + [50479] = 1, -- Nether Shock (hunter nether ray) + [15487] = 1, -- Silence (priest) + [18498] = 1, -- Silenced - Gag Order (warrior) + [18469] = 1, -- Silenced - Improved Counterspell (mage) + [18425] = 1, -- Silenced - Improved Kick (rogue) + [34490] = 1, -- Silencing Shot (hunter) + [81261] = 1, -- Solar Beam (druid) + [24259] = 1, -- Spell Lock (warlock felhunter) + [47476] = 1, -- Strangulate (death knight) +}) end + +------------------------------------------------------------------------ +-- Spell-locked + +if playerClass == '' then addAuras({ + [2139] = 1, -- Counterspell (mage) + [1766] = 1, -- Kick (rogue) + [47528] = 1, -- Mind Freeze (death knight) + [6552] = 1, -- Pummel (warrior) + [26090] = 1, -- Pummel (hunter gorilla) + [50318] = 1, -- Serenity Dust (hunter moth) + [72] = 1, -- Shield Bash (warrior) + [80964] = 1, -- Skull Bash (Bear) (druid) + [80965] = 1, -- Skull Bash (Cat) (druid) + [57994] = 1, -- Wind Shear (shaman) +}) end + +------------------------------------------------------------------------ +-- Taunted + +if playerClass == 'DEATHKNIGHT' or playerClass == 'DRUID' or playerClass == 'PALADIN' or playerClass == 'WARRIOR' then addAuras({ + [5209] = 1, -- Challenging Roar + [1161] = 1, -- Challenging Shout + [56222] = 1, -- Dark Command + [57604] = 1, -- Death Grip -- NEEDS CHECK 57603 + [20736] = 1, -- Distracting Shot + [6794] = 1, -- Growl + [62124] = 1, -- Hand of Reckoning + [31790] = 1, -- Righteous Defense + [355] = 1, -- Taunt + [58857] = 1, -- Twin Howl [shaman spirit wolves] +}) end + +------------------------------------------------------------------------ +-- Crowd controlled + +addAuras({ + [710] = 1, -- Banish + [76780] = 1, -- Bind Elemental + [33786] = 1, -- Cyclone + [339] = 1, -- Entangling Roots + [5782] = 1, -- Fear + [3355] = 1, -- Freezing Trap -- NEEDS CHECK 31932 43415 55041 + [51514] = 1, -- Hex + [2637] = 1, -- Hibernate + [118] = 1, -- Polymorph + [61305] = 1, -- Polymorph [Black Cat] + [28272] = 1, -- Polymorph [Pig] + [61721] = 1, -- Polymorph [Rabbit] + [61780] = 1, -- Polymorph [Turkey] + [28271] = 1, -- Polymorph [Turtle] + [20066] = 1, -- Repentance + [6770] = 1, -- Sap + [6358] = 1, -- Seduction + [9484] = 1, -- Shackle Undead + [10326] = 1, -- Turn Evil + [19386] = 1, -- Wyvern Sting +}) + +------------------------------------------------------------------------ +-- Death Knight + +if playerClass == 'DEATHKNIGHT' then addAuras({ + [55078] = 2, -- Blood Plague + [45524] = 1, -- Chains of Ice + [77606] = 2, -- Dark Simulacrum + [43265] = 2, -- Death and Decay + [65142] = 2, -- Ebon Plague + [55095] = 2, -- Frost Fever + [49203] = 1, -- Hungering Cold + [81130] = 2, -- Scarlet Fever + [50536] = 2, -- Unholy Blight -- NEEDS CHECK + + [48707] = 4, -- Anti-Magic Shell + [81141] = 4, -- Blood Swarm <== Crimson Scourge + [49222] = 4, -- Bone Shield + [81256] = 4, -- Dancing Rune Weapon + [59052] = 4, -- Freezing Fog <== Rime + [48792] = 4, -- Icebound Fortitude + [51124] = 4, -- Killing Machine + [49039] = 4, -- Lichborne + [51271] = 4, -- Pillar of Frost + [50421] = 4, -- Scent of Blood + [81340] = 4, -- Sudden Doom + [55233] = 4, -- Vampiric Blood + [81162] = 4, -- Will of the Necropolis -- NEEDS CHECK + + [49016] = 1, -- Unholy Frenzy +}) end + +------------------------------------------------------------------------ +-- Druid + +if playerClass == 'DRUID' then addAuras({ + [5211] = 2, -- Bash + [33786] = 2, -- Cyclone + [339] = 2, -- Entangling Roots + [45334] = 2, -- Feral Charge Effect [Bear Form] + [61138] = 2, -- Feral Charge - Cat -- NEEDS CHECK + [2637] = 2, -- Hibernate + [5570] = 2, -- Insect Swarm + [33745] = 2, -- Lacerate + [22570] = 2, -- Maim + [8921] = 2, -- Moonfire + [9005] = 2, -- Pounce + [9007] = 2, -- Pounce Bleed + [1822] = 2, -- Rake + [1079] = 2, -- Rip + [93402] = 2, -- Sunfire + [77758] = 2, -- Thrash + + [22812] = 4, -- Barkskin + [50334] = 4, -- Berserk + [16870] = 4, -- Clearcasting <== Omen of Clarity + [1850] = 4, -- Dash + [5229] = 4, -- Enrage + [48518] = 4, -- Eclipse (Lunar) + [48517] = 4, -- Eclipse (Solar) + [22842] = 4, -- Frenzied Regeneration + [81093] = 4, -- Fury of Stormrage + [81192] = 4, -- Lunar Shower + [16886] = 4, -- Nature's Grace + [16689] = 4, -- Nature's Grasp + [17116] = 4, -- Nature's Swiftness + [80951] = 4, -- Pulverize + [52610] = 4, -- Savage Roar + [93400] = 4, -- Shooting Stars + [81021] = 4, -- Stampede [Ravage effect] + [81022] = 4, -- Stampede [Ravage effect] + [61336] = 4, -- Survival Instincts + [5217] = 4, -- Tiger's Fury + [33891] = 4, -- Tree of Life + [61391] = 4, -- Typhoon + + [33763] = 2, -- Lifebloom + [94447] = 2, -- Lifebloom [Tree of Life version] + [8936] = 2, -- Regrowth + [774] = 2, -- Rejuvenation + [77764] = 1, -- Stampeding Roar + [467] = 1, -- Thorns + [48438] = 2, -- Wild Growth +}) end + +------------------------------------------------------------------------ +-- Hunter + +if playerClass == 'HUNTER' then addAuras({ + [50433] = 2, -- Ankle Crack [crocolisk] + [3674] = 2, -- Black Arrow + [35101] = 2, -- Concussive Barrage + [5116] = 2, -- Concussive Shot + [19306] = 2, -- Counterattack + [20736] = 2, -- Distracting Shot + [64803] = 2, -- Entrapment + [53301] = 2, -- Explosive Shot + [13812] = 2, -- Explosive Trap -- NEEDS CHECK 43446 + [3355] = 2, -- Freezing Trap -- NEEDS CHECK 31932 43415 55041 + [1130] = 1, -- Hunter's Mark + [13810] = 2, -- Ice Trap + [13797] = 2, -- Immolation Trap -- NEEDS CHECK 51740 + [24394] = 2, -- Intimidation + [88691] = 1, -- Marked for Death + [63468] = 2, -- Piercing Shots + [1513] = 2, -- Scare Beast + [19503] = 2, -- Scatter Shot + [1978] = 2, -- Serpent Sting + [82654] = 1, -- Widow Venom + [2974] = 2, -- Wing Clip + [19386] = 2, -- Wyvern Sting + + [82921] = 4, -- Bombardment + [51755] = 4, -- Camouflage + [15571] = 4, -- Dazed <== Aspect of the Cheetah + [19263] = 4, -- Deterrence + [5384] = 4, -- Feign Death + [82926] = 4, -- Fire! <== Lock and Load + [64418] = 4, -- Sniper Training [Rank 1] + [64419] = 4, -- Sniper Training [Rank 2] + [64420] = 4, -- Sniper Training [Rank 3] + [56453] = 4, -- Lock and Load + [34477] = 4, -- Misdirection + [3045] = 4, -- Rapid Fire + [35099] = 4, -- Rapid Killing +-- [82925] = 4, -- Ready, Set, Aim... + + [19574] = 2, -- Bestial Wrath + [1539] = 2, -- Feed Pet + [136] = 2, -- Mend Pet +}) end + +------------------------------------------------------------------------ +-- Mage + +if playerClass == 'MAGE' then addAuras({ + [11113] = 2, -- Blast Wave + [12486] = 2, -- Chilled <== Blizzard <== Ice Shards -- NEEDS CHECK + [7321] = 2, -- Chilled <== Frost Aura + [83853] = 2, -- Combustion + [120] = 2, -- Cone of Cold + [44572] = 2, -- Deep Freeze + [31661] = 2, -- Dragon's Breath + [122] = 2, -- Frost Nova + [116] = 2, -- Frostbolt + [44614] = 2, -- Frostfire Bolt + [12654] = 2, -- Ignite + [12355] = 2, -- Impact + [83301] = 2, -- Improved Cone of Cold [Rank 1] + [83302] = 2, -- Improved Cone of Cold [Rank 2] + [44457] = 2, -- Living Bomb + [118] = 2, -- Polymorph + [61305] = 2, -- Polymorph [Black Cat] + [28272] = 2, -- Polymorph [Pig] + [61721] = 2, -- Polymorph [Rabbit] + [61780] = 2, -- Polymorph [Turkey] + [28271] = 2, -- Polymorph [Turtle] + [82691] = 2, -- Ring of Frost + [31589] = 2, -- Slow + + [36032] = 4, -- Arcane Blast + [79683] = 4, -- Arcane Missiles! + [12042] = 4, -- Arcane Power + [31643] = 4, -- Blazing Speed + [57761] = 4, -- Brain Freeze + [44544] = 4, -- Fingers of Frost + [48108] = 4, -- Hot Streak + [11426] = 4, -- Ice Barrier + [45438] = 4, -- Ice Block + [12472] = 4, -- Icy Veins + [64343] = 4, -- Impact + [66] = 4, -- Invisibility + [543] = 4, -- Mage Ward + [1436] = 4, -- Mana Shield + [12043] = 4, -- Presence of Mind + + [54646] = 2, -- Focus Magic + [130] = 2, -- Slow Fall +}) end + +------------------------------------------------------------------------ +-- Paladin + +if playerClass == 'PALADIN' then addAuras({ + [31935] = 2, -- Avenger's Shield + [31803] = 2, -- Censure <== Seal of Truth + [25771] = 1, -- Forbearance + [853] = 2, -- Hammer of Justice + [2812] = 2, -- Holy Wrath + [20066] = 2, -- Repentance + [10326] = 2, -- Turn Evil + + [86701] = 4, -- Ancient Crusader <== Guardian of Ancient Kings + [86657] = 4, -- Ancient Guardian <== Guardian of Ancient Kings + [86674] = 4, -- Ancient Healer <== Guardian of Ancient Kings + [31850] = 4, -- Ardent Defender + [31821] = 4, -- Aura Mastery + [31884] = 4, -- Avenging Wrath + [88819] = 4, -- Daybreak + [85509] = 4, -- Denounce + [31842] = 4, -- Divine Favor + [54428] = 4, -- Divine Plea + [498] = 4, -- Divine Protection + [642] = 4, -- Divine Shield + [82327] = 4, -- Holy Radiance + [20925] = 4, -- Holy Shield + [54149] = 4, -- Infusion of Light + [84963] = 4, -- Inquisition + [85433] = 4, -- Sacred Duty + [85497] = 4, -- Speed of Light [haste effect] + [59578] = 4, -- The Art of War + [85696] = 4, -- Zealotry + + [53563] = 2, -- Beacon of Light + [70940] = 1, -- Divine Guardian + [1044] = 1, -- Hand of Freedom + [1022] = 1, -- Hand of Protection + [6940] = 1, -- Hand of Sacrifice + [1038] = 1, -- Hand of Salvation +}) end + +------------------------------------------------------------------------ +-- Priest + +if playerClass == 'PRIEST' then addAuras({ + [2944] = 2, -- Devouring Plague + [88625] = 2, -- Holy Word: Chastise + [605] = 2, -- Mind Control + [453] = 1, -- Mind Soothe + [87178] = 2, -- Mind Spike + [87193] = 2, -- Paralysis [Rank 1] + [87194] = 2, -- Paralysis [Rank 2] + [64044] = 2, -- Psychic Horror + [8122] = 2, -- Psychic Scream + [9484] = 2, -- Shackle Undead + [589] = 2, -- Shadow Word: Pain + [34914] = 2, -- Vampiric Touch + [6788] = 1, -- Weakened Soul + + [81700] = 4, -- Archangel + [14751] = 4, -- Chakra + [81208] = 4, -- Chakra: Heal + [81206] = 4, -- Chakra: Prayer of Healing + [81207] = 4, -- Chakra: Renew + [81209] = 4, -- Chakra: Smite + [87153] = 4, -- Dark Archangel + [87117] = 4, -- Dark Evangelism -- NEEDS CHECK + [87118] = 4, -- Dark Evangelism -- NEEDS CHECK + [47585] = 4, -- Dispersion + [81660] = 4, -- Evangelism -- NEEDS CHECK + [81661] = 4, -- Evangelism -- NEEDS CHECK + [586] = 4, -- Fade + [89485] = 4, -- Inner Focus + [81292] = 4, -- Mind Melt [Rank 1] + [87160] = 4, -- Mind Melt [Rank 2] + [88688] = 4, -- Surge of Light + + [6346] = 1, -- Fear Ward + [77613] = 2, -- Grace + [47788] = 2, -- Guardian Spirit + [88682] = 2, -- Holy Word: Aspire + [33206] = 2, -- Pain Suppression + [10060] = 2, -- Power Infusion + [17] = 1, -- Power Word: Shield + [41635] = 2, -- Prayer of Mending + [139] = 2, -- Renew +}) end + +------------------------------------------------------------------------ +-- Rogue + +if playerClass == 'ROGUE' then addAuras({ + [51585] = 2, -- Blade Twisting + [2094] = 2, -- Blind + [1833] = 2, -- Cheap Shot + [3409] = 2, -- Crippling Poison + [2818] = 2, -- Deadly Poison + [26679] = 2, -- Deadly Throw + [51722] = 2, -- Dismantle + [8647] = 1, -- Expose Armor + [703] = 2, -- Garrote + [1776] = 2, -- Gouge + [89775] = 2, -- Hemorrhage [dot from glyph] + [408] = 2, -- Kidney Shot + [84617] = 2, -- Revealing Strike + [14251] = 1, -- Riposte + [1943] = 2, -- Rupture + [79140] = 2, -- Vendetta + [13218] = 2, -- Wound Poison + + [13750] = 4, -- Adrenaline Rush + [13877] = 4, -- Blade Flurry + [31224] = 4, -- Cloak of Shadows + [14177] = 4, -- Cold Blood + [84590] = 4, -- Deadly Momentum + [5277] = 4, -- Evasion + [73651] = 4, -- Recuperate + [5171] = 4, -- Slice and Dice + [2983] = 4, -- Sprint + [57934] = 4, -- Tricks of the Trade +}) end + +------------------------------------------------------------------------ +-- Shaman + +if playerClass == 'SHAMAN' then addAuras({ + [76780] = 2, -- Bind Elemental + [8042] = 2, -- Earth Shock + [3600] = 1, -- Earthbind + [56425] = 1, -- Earth's Grasp -- NEEDS CHECK + [8050] = 2, -- Flame Shock + [8056] = 2, -- Frost Shock + [8034] = 2, -- Frostbrand Attack -- NEEDS CHECK + [89523] = 1, -- Grounding Totem [reflect] + [8178] = 1, -- Grounding Totem Effect + [51514] = 2, -- Hex + [77661] = 1, -- Searing Flames + [39796] = 1, -- Stoneclaw Stun + [17364] = 2, -- Stormstrike + + [16166] = 4, -- Elemental Mastery [instant cast] + [77800] = 4, -- Focused Insight + [65264] = 4, -- Lava Flows -- NEEDS CHECK + [31616] = 4, -- Nature's Guardian + [16188] = 4, -- Nature's Swiftness + [30823] = 4, -- Shamanistic Rage + [79206] = 4, -- Spiritwalker's Grace + [53390] = 4, -- Tidal Waves + + [974] = 2, -- Earth Shield + [61295] = 2, -- Riptide +}) end + +------------------------------------------------------------------------ +-- Warlock + +if playerClass == 'WARLOCK' then addAuras({ + [93986] = 2, -- Aura of Foreboding [stun effect] -- NEEDS CHECK 93975 + [93987] = 2, -- Aura of Foreboding [root effect] -- NEEDS CHECK 93974 + [980] = 2, -- Bane of Agony + [603] = 2, -- Bane of Doom + [80240] = 2, -- Bane of Havoc + [710] = 2, -- Banish + [172] = 2, -- Corruption + [29539] = 1, -- Curse of Exhaustion + [1490] = 1, -- Curse of the Elements + [1714] = 1, -- Curse of Tongues + [702] = 1, -- Curse of Weakness + [5782] = 2, -- Fear + [48181] = 2, -- Haunt + [5484] = 2, -- Howl of Terror + [348] = 2, -- Immolate + [60947] = 2, -- Nightmare <== Improved Fear -- NEEDS CHECK 60946 + [27243] = 2, -- Seed of Corruption + [47960] = 2, -- Shadowflame -- NEEDS CHECK 47897 + [30283] = 2, -- Shadowfury + [63311] = 2, -- Shadowsnare <== Glyph of Shadowflame + [30108] = 2, -- Unstable Affliction + + [54277] = 4, -- Backdraft + [34936] = 4, -- Backlash + [79462] = 4, -- Demon Soul: Felguard + [79460] = 4, -- Demon Soul: Felhunter + [79459] = 4, -- Demon Soul: Imp + [79463] = 4, -- Demon Soul: Succubus + [79464] = 4, -- Demon Soul: Voidwalker + [88448] = 4, -- Demonic Rebirth + [47283] = 4, -- Empowered Imp + [64371] = 4, -- Eradication + [50589] = 4, -- Immolation Aura + [47241] = 4, -- Metamorphosis + [71165] = 4, -- Molten Core + [54373] = 4, -- Nether Protection (Arcane) + [54371] = 4, -- Nether Protection (Fire) + [54372] = 4, -- Nether Protection (Frost) + [54370] = 4, -- Nether Protection (Holy) + [54375] = 4, -- Nether Protection (Nature) + [54374] = 4, -- Nether Protection (Shadow) + [91711] = 4, -- Nether Ward + [7812] = 4, -- Sacrifice + [17941] = 4, -- Shadow Trance <== Nightfall + [6229] = 4, -- Shadow Ward + [86211] = 4, -- Soul Swap + [74434] = 4, -- Soulburn + + [85767] = 2, -- Dark Intent + [20707] = 1, -- Soulstone Resurrection +}) end + +------------------------------------------------------------------------ +-- Warrior + +if playerClass == 'WARRIOR' then addAuras({ + [86346] = 2, -- Colossus Smash + [12809] = 2, -- Concussion Blow + [1160] = 1, -- Demoralizing Shout + [676] = 1, -- Disarm + [1715] = 2, -- Hamstring + [20511] = 2, -- Intimidating Shout + [12294] = 2, -- Mortal Strike + [12323] = 2, -- Piercing Howl + [94009] = 2, -- Rend + [64382] = 1, -- Shattering Throw + [46968] = 2, -- Shockwave + [58567] = 2, -- Sunder Armor + [85388] = 2, -- Throwdown + [6343] = 2, -- Thunder Clap + + [12964] = 4, -- Battle Trance + [18499] = 4, -- Berserker Rage + [46924] = 4, -- Bladestorm + [46916] = 4, -- Bloodsurge + [23885] = 4, -- Bloodthirst -- NEEDS CHECK + [85730] = 4, -- Deadly Calm + [12292] = 4, -- Death Wish + [55694] = 4, -- Enraged Regeneration + [1134] = 4, -- Inner Rage + [65156] = 4, -- Juggernaut + [12976] = 4, -- Last Stand + [1719] = 4, -- Recklessness + [20230] = 4, -- Retaliation + [2565] = 4, -- Shield Block + [871] = 4, -- Shield Wall + [23920] = 4, -- Spell Reflection + [50227] = 4, -- Sword and Board + [87069] = 4, -- Thunderstruck + [32216] = 4, -- Victory Rush + + [3411] = 2, -- Intervene + [50720] = 2, -- Vigilance +}) end + +------------------------------------------------------------------------ +-- Racials + +if playerRace == 'Draenei' then + auras[59545] = 4 -- Gift of the Naaru (death knight) + auras[59543] = 4 -- Gift of the Naaru (hunter) + auras[59548] = 4 -- Gift of the Naaru (mage) + auras[59542] = 4 -- Gift of the Naaru (paladin) + auras[59544] = 4 -- Gift of the Naaru (priest) + auras[59547] = 4 -- Gift of the Naaru (shaman) + auras[28880] = 4 -- Gift of the Naaru (warrior) +elseif playerRace == 'Dwarf' then + auras[20594] = 4 -- Stoneform +elseif playerRace == 'NightElf' then + auras[58984] = 4 -- Shadowmeld +elseif playerRace == 'Orc' then + auras[20572] = 4 -- Blood Fury (attack power) + auras[33702] = 4 -- Blood Fury (spell power) + auras[33697] = 4 -- Blood Fury (attack power and spell damage) +elseif playerRace == 'Scourge' then + auras[7744] = 4 -- Will of the Forsaken +elseif playerRace == 'Tauren' then + auras[20549] = 1 -- War Stomp +elseif playerRace == 'Troll' then + auras[26297] = 4 -- Berserking +elseif playerRace == 'Worgen' then + auras[68992] = 4 -- Darkflight +end + +------------------------------------------------------------------------ + +local unitIsPlayer = { player = true, pet = true, vehicle = true } + +local filters = { + [1] = function( self, unit, caster ) return true end, + [2] = function( self, unit, caster ) return unitIsPlayer[ caster ] end, + [3] = function( self, unit, caster ) return UnitIsFriend( unit, 'player' ) and UnitPlayerControlled( unit ) end, + [4] = function( self, unit, caster ) return unit == 'player' and not self.__owner.isGroupFrame end, +} + +CustomAuraFilter = function( self, unit, icon, name, rank, texture, count, dtype, duration, timeLeft, caster, isStealable, shouldConsolidate, spellID ) + local v = auras[ spellID ] + + -- print( 'CustomAuraFilter', unit, caster, name, spellID, v ) + + if v and filters[ v ] then + return filters[ v ]( self, unit, caster ) + else + return ( not caster or caster == unit ) and UnitCanAttack( unit, 'player' ) and not UnitPlayerControlled( unit ) + end +end + +AuraList = auras \ No newline at end of file diff --git a/Borders.lua b/Borders.lua new file mode 100644 index 0000000..39971be --- /dev/null +++ b/Borders.lua @@ -0,0 +1,113 @@ +--[[ + Border and Shadow generation, color-alteration, size-changing, and parenting + Copyright © 2010-2011 Lanerra. See LICENSE file for license terms. +]] + +-- Create Border Function +function AddBorder(self, size, offset) + if type(self) ~= 'table' or not self.CreateTexture or self.BorderTextures then return end + + local t = { } + + for i = 1, 8 do + t[i] = self:CreateTexture(nil, 'BORDER') + t[i]:SetTexture('Interface\\AddOns\\oUF_Lanerra\\media\\Border.tga') + end + + t[1].name = 'TOPLEFT' + t[1]:SetTexCoord(0, 1/3, 0, 1/3) + + t[2].name = 'TOPRIGHT' + t[2]:SetTexCoord(2/3, 1, 0, 1/3) + + t[3].name = 'TOP' + t[3]:SetTexCoord(1/3, 2/3, 0, 1/3) + + t[4].name = 'BOTTOMLEFT' + t[4]:SetTexCoord(0, 1/3, 2/3, 1) + + t[5].name = 'BOTTOMRIGHT' + t[5]:SetTexCoord(2/3, 1, 2/3, 1) + + t[6].name = 'BOTTOM' + t[6]:SetTexCoord(1/3, 2/3, 2/3, 1) + + t[7].name = 'LEFT' + t[7]:SetTexCoord(0, 1/3, 1/3, 2/3) + + t[8].name = 'RIGHT' + t[8]:SetTexCoord(2/3, 1, 1/3, 2/3) + + self.BorderTextures = t + + self.SetBorderColor = SetBorderColor + self.SetBorderParent = SetBorderParent + self.SetBorderSize = SetBorderSize + + if self.SetBackdropBorderColor then + self.SetBackdropBorderColor = SetBorderColor + end + + SetBorderColor(self) + SetBorderSize(self, size, offset) +end + +-- Border Color Function +function SetBorderColor(frame, r, g, b, a) + local t = frame.BorderTextures + if not t then return end + + if not r or not g or not b or a == 0 then + r, g, b = unpack(Settings.Media.BorderColor) + end + + for i, tex in ipairs(t) do + tex:SetVertexColor(r, g, b) + end +end + +-- Border Parent Function +function SetBorderParent(self, parent) + local t = self.BorderTextures + if not t then return end + + for i, tex in ipairs(t) do + tex:SetParent(parent or self) + end +end + +-- Border Size Function +function SetBorderSize(self, size, offset) + local t = self.BorderTextures + if not t then return end + + if not size then + size = Settings.Media.BorderSize + end + + local d = offset or (floor(size / 2 + 0.5) - 2) + + for i, tex in ipairs(t) do + tex:SetSize(size, size) + end + + t[1]:SetPoint('TOPLEFT', self, -d, d) + + t[2]:SetPoint('TOPRIGHT', self, d, d) + + t[3]:SetPoint('LEFT', t[1], 'TOPRIGHT') + t[3]:SetPoint('TOPRIGHT', t[2], 'TOPLEFT') + + t[4]:SetPoint('BOTTOMLEFT', self, -d, -d) + + t[5]:SetPoint('BOTTOMRIGHT', self, d, -d) + + t[6]:SetPoint('BOTTOMLEFT', t[4], 'BOTTOMRIGHT') + t[6]:SetPoint('BOTTOMRIGHT', t[5], 'BOTTOMLEFT') + + t[7]:SetPoint('TOPLEFT', t[1], 'BOTTOMLEFT') + t[7]:SetPoint('BOTTOMLEFT', t[4], 'TOPLEFT') + + t[8]:SetPoint('TOPRIGHT', t[2], 'BOTTOMRIGHT') + t[8]:SetPoint('BOTTOMRIGHT', t[5], 'TOPRIGHT') +end diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..3b62529 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,21 @@ +Copyright © 2010-2011 Lanerra. + +The contents of this addon, excluding third-party resources, are +copyrighted to its author with all rights reserved, under United +States copyright law and various international treaties. + +In particular, please note that you may not distribute this addon in +any form, with or without modifications, including as part of a +compilation, without prior written permission from its author. + +The author of this addon hereby grants you the following rights: + +1. You may make modifications to this addon for private use only. + +2. You may use source code from this addon for any purpose, provided +that the names of this addon and its author are not used to promote +your project, and do not appear in the title, source code, or file +names of your project, outside of an optional credits notation. + +All rights not explicitly addressed in this license are reserved by +the copyright holder. \ No newline at end of file diff --git a/Tags.lua b/Tags.lua new file mode 100644 index 0000000..b271ecb --- /dev/null +++ b/Tags.lua @@ -0,0 +1,130 @@ +-- Copyright © 2010-2011 Lanerra. See LICENSE file for license terms. +-- Define some custom oUF tags +oUF.Tags['LanPvPTime'] = function(unit) + return UnitIsPVP(unit) and not IsPVPTimerRunning() and '*' or IsPVPTimerRunning() and ('%d:%02d'):format((GetPVPTimer() / 1000) / 60, (GetPVPTimer() / 1000) % 60) +end + +oUF.TagEvents['LanThreat'] = 'UNIT_THREAT_LIST_UPDATE' +oUF.Tags['LanThreat'] = function() + local _, _, perc = UnitDetailedThreatSituation('player', 'target') + return perc and ('%s%d%%|r'):format(hex(GetThreatStatusColor(UnitThreatSituation('player', 'target'))), perc) +end + +oUF.Tags['LanLevel'] = function(unit) + local level = UnitLevel(unit) + local colorL = GetQuestDifficultyColor(level) + + if (level < 0) then + r, g, b = 1, 0, 0 + level = '??' + elseif (level == 0) then + r, g, b = colorL.r, colorL.g, colorL.b + level = '?' + else + r, g, b = colorL.r, colorL.g, colorL.b + level = level + end + + return format('|cff%02x%02x%02x%s|r', r*255, g*255, b*255, level) +end + +oUF.TagEvents['LanName'] = 'UNIT_NAME_UPDATE UNIT_HEALTH' +oUF.Tags['LanName'] = function(unit) + local colorA + local UnitName, UnitRealm = UnitName(unit) + local _, class = UnitClass(unit) + + if (UnitRealm) and (UnitRealm ~= '') then + UnitName = UnitName + end + + colorA = {1, 1, 1} + + r, g, b = colorA[1], colorA[2], colorA[3] + + return format('|cff%02x%02x%02x%s|r', r*255, g*255, b*255, UnitName) +end + +oUF.TagEvents['LanRaidName'] = 'UNIT_NAME_UPDATE UNIT_HEALTH' +oUF.Tags['LanRaidName'] = function(unit) + local Name = string.sub(UnitName(unit), 1, 4) + return Name +end + +oUF.TagEvents['LanPower'] = 'UNIT_ENERGY UNIT_FOCUS UNIT_MANA UNIT_RAGE UNIT_MAXRUNIC_POWER UNIT_RUNIC_POWER' +oUF.Tags['LanPower'] = function(unit) + local min = UnitPower(unit) + return min +end + +oUF.TagEvents['LanCombat'] = 'PLAYER_REGEN_DISABLED PLAYER_REGEN_ENABLED' +oUF.Tags['LanCombat'] = function(unit) + if unit == 'player' and UnitAffectingCombat('player') then + return [[|TInterface\CharacterFrame\UI-StateIcon:0:0:0:0:64:64:37:58:5:26|t]] + end +end +oUF.UnitlessTagEvents['PLAYER_REGEN_DISABLED'] = true +oUF.UnitlessTagEvents['PLAYER_REGEN_ENABLED'] = true + +oUF.TagEvents['LanLeader'] = 'PARTY_LEADER_CHANGED PARTY_MEMBERS_CHANGED' +oUF.Tags['LanLeader'] = function(unit) + if UnitIsPartyLeader(unit) then + return [[|TInterface\GroupFrame\UI-Group-LeaderIcon:0|t]] + elseif UnitInRaid(unit) and UnitIsRaidOfficer(unit) then + return [[|TInterface\GroupFrame\UI-Group-AssistantIcon:0|t]] + end +end + +oUF.TagEvents['LanMaster'] = 'PARTY_LOOT_METHOD_CHANGED PARTY_MEMBERS_CHANGED' +oUF.Tags['LanMaster'] = function(unit) + local method, pid, rid = GetLootMethod() + if method ~= 'master' then return end + local munit + if pid then + if pid == 0 then + munit = 'player' + else + munit = 'party' .. pid + end + elseif rid then + munit = 'raid' .. rid + end + if munit and UnitIsUnit(munit, unit) then + return [[|TInterface\GroupFrame\UI-Group-MasterLooter:0:0:0:2|t]] + end +end + +oUF.TagEvents['LanResting'] = 'PLAYER_UPDATE_RESTING' +oUF.Tags['LanResting'] = function(unit) + if unit == 'player' and IsResting() then + return [[|TInterface\CharacterFrame\UI-StateIcon:0:0:0:-6:64:64:28:6:6:28|t]] + end +end + + +oUF.Tags['LanHolyPower'] = function(unit) + local hp = UnitPower('player', SPELL_POWER_HOLY_POWER) + + if hp > 0 then + return string.format('|c50f58cba%d|r', hp) + end +end +oUF.TagEvents['LanHolyPower'] = 'UNIT_POWER' + +oUF.Tags['LanShards'] = function(unit) + local hp = UnitPower('player', SPELL_POWER_SOUL_SHARDS) + + if hp > 0 then + return string.format('|c909482c9%d|r', hp) + end +end +oUF.TagEvents['LanShards'] = 'UNIT_POWER' + +oUF.Tags['LanCombo'] = function(unit) + local cp = GetComboPoints('player', 'target') + + if cp > 0 then + return string.format('|cffffff00%d|r', cp) + end +end +oUF.TagEvents['LanCombo'] = 'UNIT_COMBO_POINTS' diff --git a/media/Border.tga b/media/Border.tga new file mode 100644 index 0000000..080087e Binary files /dev/null and b/media/Border.tga differ diff --git a/media/ComboPoint.blp b/media/ComboPoint.blp new file mode 100644 index 0000000..1578d0c Binary files /dev/null and b/media/ComboPoint.blp differ diff --git a/media/borderBackground.tga b/media/borderBackground.tga new file mode 100644 index 0000000..6ab8cf0 Binary files /dev/null and b/media/borderBackground.tga differ diff --git a/media/debuffGlow.tga b/media/debuffGlow.tga new file mode 100644 index 0000000..baa831e Binary files /dev/null and b/media/debuffGlow.tga differ diff --git a/media/font.ttf b/media/font.ttf new file mode 100644 index 0000000..1ca255c Binary files /dev/null and b/media/font.ttf differ diff --git a/media/statusbarTexture.tga b/media/statusbarTexture.tga new file mode 100644 index 0000000..ddf3e54 Binary files /dev/null and b/media/statusbarTexture.tga differ diff --git a/modules/DispellableDebuffs.lua b/modules/DispellableDebuffs.lua new file mode 100644 index 0000000..47ee443 --- /dev/null +++ b/modules/DispellableDebuffs.lua @@ -0,0 +1,118 @@ +--[[-------------------------------------------------------------------- + oUF_DispelHighlight + Highlights oUF frames by dispellable debuff type. + Originally based on Ammo's oUF_DebuffHighlight. + + You may embed this module in your own layout, but please do not + distribute it as a standalone plugin. + + To have your frame's health bar highlighted: + frame.DispelHighlight = true + + To use your own highlighting function: + frame.DispelHighlight = function(frame, event, unit, debuffType, canDispel) + -- debuffType : string or nil : type of the highest priority debuff, nil if no debuffs + -- canDispel : boolean : indicates whether the player can dispel the debuff + end + + To highlight only debuffs you can dispel: + frame.DispelHighlightFilter = true +----------------------------------------------------------------------]] + +if not oUF then return end +if select(4, GetAddOnInfo('oUF_DispelHighlight')) then return end + +local _, playerClass = UnitClass('player') + +local canDispel +if playerClass == 'DRUID' then + canDispel = { Curse = true, Poison = true } +elseif playerClass == 'MAGE' then + canDispel = { Curse = true } +elseif playerClass == 'PALADIN' then + canDispel = { Disease = true, Magic = true, Poison = true } +elseif playerClass == 'PRIEST' then + canDispel = { Disease = true, Magic = true } +elseif playerClass == 'SHAMAN' then + canDispel = { Curse = true, Disease = true, Poison = true } +end + +local DebuffPriority = { } +for type, priority in pairs({ Curse = 2, Disease = 4, Magic = 1, Poison = 3 }) do + table.insert(DebuffPriority, type) + DebuffPriority[type] = ((canDispel and canDispel[type]) and 10 or 5) - priority +end +table.sort(DebuffPriority, function(a, b) return DebuffPriority[a] > DebuffPriority[b] end) + +local DebuffTypeColor = { } +for type, color in pairs(_G.DebuffTypeColor) do + DebuffTypeColor[type] = { color.r, color.g, color.b } +end + +------------------------------------------------------------------------ + +local unitDebuffType = { } + +local function applyDispelHighlight(self, event, unit, bar) + local debuffType = unitDebuffType[unit] + if debuffType then + bar:SetStatusBarColor(unpack(DebuffTypeColor[debuffType])) + end +end + +local function Update(self, event, unit) + if self.unit ~= unit then return end + -- print('Update', unit) + + if not UnitCanAssist('player', unit) then return end + -- print('not UnitCanAssist') + + local debuffType + + local i = 1 + while true do + local name, _, _, _, type = UnitAura(unit, i, 'HARMFUL') + if not name then break end + -- print('UnitAura', unit, i, name or 'NONE', type or 'NONE') + if type and (not debuffType or DebuffPriority[type] > DebuffPriority[debuffType]) then + -- print('debuffType', type) + debuffType = type + end + i = i + 1 + end + + if unitDebuffType[unit] ~= debuffType then + -- print('unitDebuffType', unitDebuffType[unit] or 'NONE', 'debuffType', debuffType or 'NONE') + + unitDebuffType[unit] = debuffType + + if type(self.DispelHighlight) == 'function' then + self:DispelHighlight(event, unit, debuffType, canDispel and canDispel[debuffType]) + else + if debuffType and self.DispelHighlightFilter and not (canDispel and canDispel[debuffType]) then return end + applyDispelHighlight(self, event, unit, self.Health) + end + end +end + +local function Enable(self) + if not self.DispelHighlight or (self.DispelHighlightFilter and not canDispel) then return end + + self:RegisterEvent('UNIT_AURA', Update) + + if type(self.DispelHighlight) ~= 'function' then + local o = self.PostUpdateHealth + self.PostUpdateHealth = function(...) + if o then o(...) end + applyDispelHighlight(...) + end + end +end + +local function Disable(self) + if not self.DispelHighlight or not canDispel then return end + + self:UnregisterEvent('UNIT_AURA', Update) +end + +oUF:AddElement('DispelHighlight', Update, Enable, Disable) diff --git a/modules/Smooth.lua b/modules/Smooth.lua new file mode 100644 index 0000000..0272e55 --- /dev/null +++ b/modules/Smooth.lua @@ -0,0 +1,45 @@ +if not oUF then return end + +local smoothing = {} +local function Smooth(self, value) + if value ~= self:GetValue() or value == 0 then + smoothing[self] = value + else + smoothing[self] = nil + end +end + +local function SmoothBar(self, bar) + bar.SetValue_ = bar.SetValue + bar.SetValue = Smooth +end + +local function hook(frame) + frame.SmoothBar = SmoothBar + if frame.Health and frame.Health.Smooth then + frame:SmoothBar(frame.Health) + end + if frame.Power and frame.Power.Smooth then + frame:SmoothBar(frame.Power) + end +end + +for i, frame in ipairs(oUF.objects) do hook(frame) end +oUF:RegisterInitCallback(hook) + +local f, min, max = CreateFrame('Frame'), math.min, math.max +f:SetScript('OnUpdate', function() + local limit = 30/GetFramerate() + for bar, value in pairs(smoothing) do + local cur = bar:GetValue() + local new = cur + min((value-cur)/3, max(value-cur, limit)) + if new ~= new then + new = value + end + bar:SetValue_(new) + if cur == value or abs(new - value) < 2 then + bar:SetValue_(value) + smoothing[bar] = nil + end + end +end) \ No newline at end of file diff --git a/modules/Threat.lua b/modules/Threat.lua new file mode 100644 index 0000000..6c0b28b --- /dev/null +++ b/modules/Threat.lua @@ -0,0 +1,67 @@ +--[[-------------------------------------------------------------------- + oUF_ThreatHighlight + Highlights oUF frames by threat level. + + Simple usage: + self.ThreatHighlight = true + + Advanced usage: + self.ThreatHighlight = function(self, unit, status) end +----------------------------------------------------------------------]] + +local _, ns = ... +local oUF = ns.oUF or oUF +if not oUF then return end + +local unitThreatStatus = { } + +local function applyThreatHighlight(self, unit) + local status = unitThreatStatus[unit] + if status then + local r, g, b = GetThreatStatusColor(status) + self:SetStatusBarColor(r, g, b) + end +end + +local function Update(self, event, unit) + if self.unit ~= unit then return end + + local status = UnitThreatSituation(unit) + -- local status = UnitIsFriend(unit, 'player') and UnitThreatSituation(unit) or UnitThreatSituation('player', unit) + -- print('ThreatHighlight Update', event, unit, status) + + if status and status > 0 then + if type(self.ThreatHighlight) == 'function' then + self.ThreatHighlight(self, unit, status) + else + unitThreatStatus[unit] = status + applyThreatHighlight(self.Health, unit) + end + elseif type(self.ThreatHighlight) == 'function' then + self.ThreatHighlight(self, unit, 0) + end +end + +local function Enable(self) + if not self.ThreatHighlight then return end + + self:RegisterEvent('UNIT_THREAT_SITUATION_UPDATE', Update) + + if type(self.ThreatHighlight) ~= 'function' then + local o = self.Health.PostUpdate + self.Health.PostUpdate = function(...) + if o then o(...) end + applyThreatHighlight(...) + end + end + + return true +end + +local function Disable(self) + if not self.ThreatHighlight then return end + + self:UnregisterEvent('UNIT_THREAT_SITUATION_UPDATE', Update) +end + +oUF:AddElement('ThreatHighlight', Update, Enable, Disable) diff --git a/oUF_Lanerra.lua b/oUF_Lanerra.lua new file mode 100644 index 0000000..4dcfe68 --- /dev/null +++ b/oUF_Lanerra.lua @@ -0,0 +1,1392 @@ +--[[ + Version = 1.13 + + Copyright © 2010-2011 Lanerra. See LICENSE file for license terms. + + Special thanks to P3lim for inspiration, Neav for textures and inspiration, + Game92 for inspiration, and Phanx for inspiration and an inline border method +--]] + +---- Lazy Stuff Goes Here! +local _, ns = ... + +local playerClass = select(2, UnitClass('player')) +local isHealer = (playerClass == 'DRUID' or playerClass == 'PALADIN' or playerClass == 'PRIEST' or playerClass == 'SHAMAN') + +-- A little backdrop local to save us some typing...because I'm lazy +local backdrop = { + bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], + insets = {top = -1, left = -1, bottom = -1, right = -1}, +} + +local PlayerUnits = { player = true, pet = true, vehicle = true } + +-- Dummy function +local noop = function() return end + +fontstrings = { } + +-- Custom power colors +local PowerBarColor = PowerBarColor + +PowerBarColor['MANA'] = { r = 0/255, g = 0.55, b = 1 } +PowerBarColor['RAGE'] = { r = 240/255, g = 45/255, b = 75/255 } +PowerBarColor['FOCUS'] = { r = 255/255, g = 175/255, b = 0 } +PowerBarColor['ENERGY'] = { r = 1, g = 1, b = 35/255 } +PowerBarColor['RUNIC_POWER'] = { r = 0.45, g = 0.85, b = 1 } + +local Colors = oUF.colors + +-- Threat color handling +oUF.colors.threat = { } +for i = 1, 3 do + local r, g, b = GetThreatStatusColor(i) + oUF.colors.threat[i] = { r, g, b } +end + +-- Debuff color handling +Colors.Debuff = { } +for type, color in pairs(DebuffTypeColor) do + if (type ~= 'none') then + Colors.Debuff[type] = { color.r, color.g, color.b } + end +end + +-- Color conversion function +function hex(r, g, b) + if(type(r) == 'table') then + if(r.r) then r, g, b = r.r, r.g, r.b else r, g, b = unpack(r) end + end + return ('|cff%02x%02x%02x'):format(r * 255, g * 255, b * 255) +end + +---- No More Lazy Stuff! + +-- Border update function +local function UpdateBorder(self) + local Threat, Debuff, Dispellable = self.threatLevel, self.debuffType, self.debuffDispellable + + local Color + if Debuff and Dispellable then + Color = Colors.Debuff[Debuff] + elseif Threat and Threat > 1 then + Color = oUF.colors.threat[Threat] + elseif Debuff then + Color = Colors.Debuff[Debuff] + elseif Threat and Threat > 0 then + Color = oUF.colors.threat[Threat] + end + + if Color then + self:SetBackdropBorderColor(Color[1], Color[2], Color[3], 1) + else + self:SetBackdropBorderColor(0, 0, 0, 0) + end +end + +-- Formatting function for the display of health and power text +local function ShortValue(value) + if value >= 1e7 then + return ('%.1fm'):format(value / 1e6):gsub('%.?0+([km])$', '%1') + elseif value >= 1e6 then + return ('%.2fm'):format(value / 1e6):gsub('%.?0+([km])$', '%1') + elseif value >= 1e5 then + return ('%.0fk'):format(value / 1e3) + elseif value >= 1e3 then + return ('%.1fk'):format(value / 1e3):gsub('%.?0+([km])$', '%1') + else + return value + end +end + +-- Dropdown menu function for our unit frames +local function CreateDropDown(self) + local unit = self.unit:gsub('(.)', string.upper, 1) + if _G[unit..'FrameDropDown'] then + ToggleDropDownMenu(1, nil, _G[unit..'FrameDropDown'], 'cursor') + elseif (self.unit:match('party')) then + ToggleDropDownMenu(1, nil, _G['PartyMemberFrame'..self.id..'DropDown'], 'cursor') + else + FriendsDropDown.unit = self.unit + FriendsDropDown.id = self.id + FriendsDropDown.initialize = RaidFrameDropDown_Initialize + ToggleDropDownMenu(1, nil, FriendsDropDown, 'cursor') + end +end + +-- And now for our custom channeling function for our castbars +local function UpdateChannelStart(self, event, unit, name, rank, text) + self.Castbar.SafeZone:SetDrawLayer('ARTWORK') + self.Castbar.SafeZone:ClearAllPoints() + self.Castbar.SafeZone:SetPoint('TOPLEFT', self.Castbar) + self.Castbar.SafeZone:SetPoint('BOTTOMLEFT', self.Castbar) +end + +-- Now, the custom casting function +local function UpdateCastStart(self, event, unit, name, rank, text, castid) + self.Castbar.SafeZone:SetDrawLayer('BORDER') + self.Castbar.SafeZone:ClearAllPoints() + self.Castbar.SafeZone:SetPoint('TOPRIGHT', self.Castbar) + self.Castbar.SafeZone:SetPoint('BOTTOMRIGHT', self.Castbar) +end + +-- Health update function of doom! +local UpdateHealth = function(Health, unit, min, max) + if (Health:GetParent().unit ~= unit) then + return + end + + if (not unit == 'pet' or unit == 'focus' or unit == 'targettarget') then + if (not UnitIsConnected(unit)) then + Health:SetValue(0) + Health.Value:SetText('|cffD7BEA5'..'Offline') + + return + elseif (UnitIsDead(unit)) then + Health:SetValue(0) + Health.Value:SetText('|cffD7BEA5'..'Dead') + + return + elseif (UnitIsGhost(unit)) then + Health:SetValue(0) + Health.Value:SetText('|cffD7BEA5'..'Ghost') + + return + end + end + + if (unit == 'player') then + if (Settings.Units.Player.Health.Percent) then + Health.Value:SetText((min / max * 100 < 100 and format('%d%%', min / max * 100)) or '') + elseif (Settings.Units.Player.Health.Deficit) then + Health.Value:SetText((min ~= max) and format('%d', min - max) or '') + elseif (Settings.Units.Player.Health.Current) then + Health.Value:SetText((min ~= max) and format('%d', min) or '') + else + Health.Value:SetText() + end + elseif (unit == 'target') then + if (Settings.Units.Target.Health.Percent) then + Health.Value:SetText((min / max * 100 < 100 and format('%d%%', min / max * 100)) or '') + elseif (Settings.Units.Target.Health.Deficit) then + Health.Value:SetText((min ~= max) and format('%d', min - max) or '') + elseif (Settings.Units.Target.Health.Current) then + Health.Value:SetText(ShortValue(min)) + else + Health.Value:SetText() + end + elseif (unit == 'targettarget') then + if (Settings.Units.ToT.Health.Percent) then + Health.Value:SetText((min / max * 100 < 100 and format('%d%%', min / max * 100)) or '') + elseif (Settings.Units.ToT.Health.Deficit) then + Health.Value:SetText((min ~= max) and format('%d', min - max) or '') + elseif (Settings.Units.ToT.Health.Current) then + Health.Value:SetText((min ~= max) and format('%d', min) or '') + else + Health.Value:SetText() + end + elseif (unit == 'pet') then + if (Settings.Units.Pet.Health.Percent) then + Health.Value:SetText((min / max * 100 < 100 and format('%d%%', min / max * 100)) or '') + elseif (Settings.Units.Pet.Health.Deficit) then + Health.Value:SetText((min ~= max) and format('%d', min - max) or '') + elseif (Settings.Units.Pet.Health.Current) then + Health.Value:SetText((min ~= max) and format('%d', min) or '') + else + Health.Value:SetText() + end + elseif (unit == 'focus') then + if (Settings.Units.Focus.Health.Percent) then + Health.Value:SetText((min / max * 100 < 100 and format('%d%%', min / max * 100)) or '') + elseif (Settings.Units.Focus.Health.Deficit) then + Health.Value:SetText((min ~= max) and format('%d', min - max) or '') + elseif (Settings.Units.Focus.Health.Current) then + Health.Value:SetText((min ~= max) and format('%d', min) or '') + else + Health.Value:SetText() + end + end + + -- Bar Color Stuff + Health:SetStatusBarColor(.25, .25, .25) +end + +-- Group update health function +local function UpdateGroupHealth(Health, unit, min, max) + if (Health:GetParent().unit ~= unit) then + return + end + + if (not UnitIsConnected(unit)) then + Health:SetValue(0) + Health.Value:SetText('|cffD7BEA5'..'Offline') + elseif (UnitIsDead(unit)) then + Health.Value:SetText('|cffD7BEA5'..'Dead') + elseif (UnitIsGhost(unit)) then + Health.Value:SetText('|cffD7BEA5'..'Ghost') + end + + if (Settings.Units.Party.Health.Percent) then + Health.Value:SetText((min / max * 100 < 100 and format('%d%%', min / max * 100)) or '') + elseif (Settings.Units.Party.Health.Deficit) then + Health.Value:SetText((min ~= max) and format('%d', min - max) or '') + elseif (Settings.Units.Party.Health.Current) then + Health.Value:SetText((min ~= max) and format('%d', min) or '') + else + Health.Value:SetText() + end + + local color = RAID_CLASS_COLORS[select(2, UnitClass(unit))] + if (Settings.Units.Party.Health.ClassColor) then + Health.colorClass = true + else + Health:SetStatusBarColor(.25, .25, .25) + end +end + +-- Raid update health function +local function UpdateRaidHealth(Health, unit, min, max) + if (Health:GetParent().unit ~= unit) then + return + end + + if (UnitIsDead(unit) or UnitIsGhost(unit) or not UnitIsConnected(unit)) then + Health.Value:SetText((UnitIsDead(unit) and 'Dead') or (UnitIsGhost(unit) and 'Ghost') or (not UnitIsConnected(unit) and 'Offline')) + Health.Value:SetTextColor(.5, .5, .5) + Health:SetStatusBarColor(.5, .5, .5) + else + if (Settings.Units.Raid.Health.Percent) then + Health.Value:SetText((min / max * 100 < 100 and format('%d%%', min / max * 100)) or '') + elseif (Settings.Units.Raid.Health.Deficit) then + Health.Value:SetText((min ~= max) and format('%d', min - max) or '') + elseif (Settings.Units.Raid.Health.Current) then + Health.Value:SetText((min ~= max) and format('%d', min) or '') + else + Health.Value:SetText() + end + + local color = RAID_CLASS_COLORS[select(2, UnitClass(unit))] + if (Settings.Units.Raid.Health.ClassColor) then + Health.colorClass = true + else + Health:SetStatusBarColor(.25, .25, .25) + end + end +end + +-- Now for the update power function +local UpdatePower = function(Power, unit, min, max) + local self = Power:GetParent() + + local UnitHappiness = self.colors.happiness[GetPetHappiness()] + local _, PowerType, altR, altG, altB = UnitPowerType(unit) + local UnitPower = PowerBarColor[PowerType] + + if (min == 0 or UnitIsDead(unit) or UnitIsGhost(unit) or unit == 'pet' or unit == 'focus' or unit ~= 'player' or not UnitIsConnected(unit)) then + Power.Value:SetText() + else + Power.Value:SetText(min) + end + + if (unit == 'pet' and GetPetHappiness()) then + Power:SetStatusBarColor(UnitHappiness[1], UnitHappiness[2], UnitHappiness[3]) + else + Power:SetStatusBarColor(UnitPower.r, UnitPower.g, UnitPower.b) + end +end + +-- Add DruidPower support +local function UpdateDruidPower(self, event, unit) + if (unit and unit ~= self.unit) then + return + end + + local unitPower = PowerBarColor['MANA'] + local mana = UnitPowerType('player') == 0 + local index = GetShapeshiftForm() + + if (index == 1 or index == 3) then + if (unitPower) then + self.Druid.Power:SetStatusBarColor(unitPower.r, unitPower.g, unitPower.b) + end + + self.Druid.Power:SetAlpha(1) + + local min, max = UnitPower('player', 0), UnitPowerMax('player', 0) + + self.Druid.Power:SetMinMaxValues(0, max) + self.Druid.Power:SetValue(min) + else + self.Druid.Power:SetAlpha(0) + end +end + +-- Aura Icons for our unit frames +-- Aura Icon Show +local AuraIconCD_OnShow = function(cd) + local button = cd:GetParent() + button:SetBorderParent(cd) + button.count:SetParent(cd) +end + +-- Aura Icon Hide +local AuraIconCD_OnHide = function(cd) + local button = cd:GetParent() + button:SetBorderParent(button) + button.count:SetParent(button) +end + +-- Aura Icon Overlay +local AuraIconOverlay_SetBorderColor = function(overlay, r, g, b) + if not r or not g or not b then + r, g, b = unpack(Settings.Media.BorderColor) + end + overlay:GetParent():SetBorderColor(r, g, b) +end + +-- Aura Icon Creation Function +local function PostCreateAuraIcon(iconframe, button) + AddBorder(button, Settings.Media.BorderSize) + + button.cd:SetReverse(true) + button.cd:SetScript('OnHide', AuraIconCD_OnHide) + button.cd:SetScript('OnShow', AuraIconCD_OnShow) + if button.cd:IsShown() then + AuraIconCD_OnShow(button.cd) + end + + button.icon:SetTexCoord(0.03, 0.97, 0.03, 0.97) + + button.overlay:Hide() + button.overlay.Hide = AuraIconOverlay_SetBorderColor + button.overlay.SetVertexColor = AuraIconOverlay_SetBorderColor + button.overlay.Show = noop +end + +-- Aura Icon Update Function +local function PostUpdateAuraIcon(iconframe, unit, button, index, offset) + local name, _, texture, count, type, duration, timeLeft, caster, isStealable, shouldConsolidate, spellID = UnitAura(unit, index, button.filter) + + if PlayerUnits[caster] then + button.icon:SetDesaturated(false) + else + button.icon:SetDesaturated(true) + end + + if button.timer then return end + + if OmniCC then + for i = 1, button:GetNumChildren() do + local child = select(i, button:GetChildren()) + if child.text and (child.icon == button.icon or child.cooldown == button.cd) then + -- found it! + child.SetAlpha = noop + child.SetScale = noop + + child.text:ClearAllPoints() + child.text:SetPoint('CENTER', button, 'TOP', 0, 2) + + child.text:SetFont(Settings.Media.Font, unit:match('^party') and 14 or 18) + child.text.SetFont = noop + + child.text:SetTextColor(1, 0.8, 0) + child.text.SetTextColor = noop + child.text.SetVertexColor = noop + + tinsert(fontstrings, child.text) + + button.timer = child.text + + return + end + end + else + button.timer = true + end +end + +-- Dispel highlighting function +local function UpdateDispelHighlight(self, event, unit, debuffType, canDispel) + if (self.unit ~= unit) then + return + end + + if (self.debuffType == debuffType) then + return + end + + self.debuffType = debuffType + self.debuffDispellable = canDispel + + self:UpdateBorder() +end + +-- Threat highlighting function +local function UpdateThreatHighlight(self, unit, status) + if self.threatLevel == status then return end + + self.threatLevel = status + self:UpdateBorder() +end + +-- Time to give our solo unit frames some style! +local Stylish = function(self, unit, isSingle) + self.menu = CreateDropDown + self.ignoreHealComm = true + + self:EnableMouse(true) + self:RegisterForClicks('AnyUp') + + -- Health Bar-specific stylings + self.Health = CreateFrame('StatusBar', '$parentHealthBar', self) + self.Health:SetHeight(Settings.Units.Player.Height * .75) + self.Health:SetStatusBarTexture(Settings.Media.StatusBar) + + -- Turn on the smoothness + self.Health.Smooth = true + + self.Health.frequentUpdates = true + + self.Health:SetParent(self) + self.Health:SetPoint('TOP') + self.Health:SetPoint('LEFT') + self.Health:SetPoint('RIGHT') + + self:SetBackdrop(backdrop) + self:SetBackdropColor(0, 0, 0, .75) + + if (unit == 'player') then + local info = self.Health:CreateFontString('$parentInfo', 'OVERLAY', 'GameFontHighlightSmall') + info:SetPoint('CENTER', self.Health) + info.frequentUpdates = .25 + self:Tag(info, '[LanThreat] |cffff0000[LanPvPTime]|r') + end + + -- Setup our health text + self.Health.Value = self.Health:CreateFontString('$parentHealthValue', 'OVERLAY') + self.Health.Value:SetFont(Settings.Media.Font, Settings.Media.FontSize) + self.Health.Value:SetShadowOffset(1, -1) + self.Health.Value:SetTextColor(1, 1, 1) + self.Health.Value:SetPoint('RIGHT', self.Health, -2, 0) + + self.Health.PostUpdate = UpdateHealth + + -- And now for the power bar and text stuff + self.Power = CreateFrame('StatusBar', '$parentPowerBar', self) + self.Power:SetHeight(Settings.Units.Player.Height * .22) + self.Power:SetStatusBarTexture(Settings.Media.StatusBar) + + self.Power.colorTapping = true + self.Power.colorHappiness = true + self.Power.colorClass = true + self.Power.colorReaction = true + + -- We like to keep things smooth here + self.Power.frequentUpdates = true + + self.Power:SetParent(self) + self.Power:SetPoint('BOTTOM') + self.Power:SetPoint('LEFT', .2, 0) + self.Power:SetPoint('RIGHT', -.2, 0) + + -- Now, the power bar's text + self.Power.Value = self.Power:CreateFontString('$parentPowerValue', 'OVERLAY') + self.Power.Value:SetFont(Settings.Media.Font, Settings.Media.FontSize) + self.Power.Value:SetShadowOffset(1, -1) + self.Power.Value:SetPoint('LEFT', self.Health.Value, 'RIGHT', -195, 0) + self.Power.Value:SetTextColor(1, 1, 1) + self.Power.Value:SetJustifyH('LEFT') + self.Power.Value.frequentUpdates = 0.1 + + if (Settings.Units.Player.ShowPowerText) then + if (unit == 'player') then + local _, power = UnitPowerType(unit) + local c = PowerBarColor[power] + self:Tag(self.Power.Value, '[LanPower]') + self.Power.Value:SetTextColor(c.r, c.g, c.b) + end + else + if (unit == 'player') then + self.Power.Value:Hide() + self.Power.Value.Show = self.Power.Value.Hide + end + end + + if (Settings.Units.Target.ShowPowerText) then + if (unit == 'target') then + local _, power = UnitPowerType(unit) + local c = PowerBarColor[power] + self:Tag(self.Power.Value, '[LanPower]') + self.Power.Value:SetTextColor(c.r, c.g, c.b) + end + else + if (unit == 'target') then + self.Power.Value:Hide() + self.Power.Value.Show = self.Power.Value.Hide + end + end + + self.PostUpdatePower = UpdatePower + + if (unit == 'targettarget') then + self.Power:Hide() + self.Power.Show = self.Power.Hide + self.Health:SetAllPoints(self) + end + + if (unit == 'focus') then + self.Power:Hide() + self.Power.Show = self.Power.Hide + self.Health:SetAllPoints(self) + self.Health:SetOrientation('VERTICAL') + else + self.Health:SetOrientation('HORIZONTAL') + end + + -- Improve border drawing + self.Overlay = CreateFrame('Frame', nil, self) + self.Overlay:SetAllPoints(self) + self.Overlay:SetFrameLevel(self.Health:GetFrameLevel() + (self.Power and 3 or 2)) + + -- Now, to hammer out our castbars + if (Settings.Show.CastBars) then + if (unit == 'player') then + self.Castbar = CreateFrame('StatusBar', '$parentCastBar', self) + self.Castbar:SetStatusBarTexture(Settings.Media.StatusBar) + self.Castbar:SetScale(Settings.CastBars.Player.Scale) + self.Castbar:SetStatusBarColor(unpack(Settings.CastBars.Player.Color)) + + self.Border = CreateFrame('Frame', nil, self.Castbar) + self.Border:SetAllPoints(self.Castbar) + self.Border:SetFrameLevel(self.Castbar:GetFrameLevel() + 2) + + AddBorder(self.Border, Settings.Media.BorderSize) + + self.Castbar:SetHeight(Settings.CastBars.Player.Height) + self.Castbar:SetWidth(Settings.CastBars.Player.Width) + self.Castbar:SetParent(self) + self.Castbar:SetPoint(unpack(Settings.CastBars.Player.Position)) + + self.Castbar.Bg = self.Castbar:CreateTexture('$parentCastBarBackground', 'BACKGROUND') + self.Castbar.Bg:SetAllPoints(self.Castbar) + self.Castbar.Bg:SetTexture(Settings.Media.StatusBar) + self.Castbar.Bg:SetVertexColor(.1, .1, .1, .7) + + self.Castbar.Text = self.Castbar:CreateFontString('$parentCastBarText', 'OVERLAY') + self.Castbar.Text:SetFont(Settings.Media.Font, 13) + self.Castbar.Text:SetShadowOffset(1, -1) + self.Castbar.Text:SetPoint('LEFT', self.Castbar, 'LEFT', 2, 0) + self.Castbar.Text:SetHeight(Settings.Media.FontSize) + self.Castbar.Text:SetWidth(130) + self.Castbar.Text:SetJustifyH('LEFT') + self.Castbar.Text:SetParent(self.Castbar) + self.Castbar.CustomTimeText = function(self, duration) + self.Time:SetFormattedText('%.1f/%.1f', duration, self.max) + end + + self.Castbar.Time = self.Castbar:CreateFontString('$parentCastBarTime', 'OVERLAY') + self.Castbar.Time:SetFont(Settings.Media.Font, 13) + self.Castbar.Time:SetShadowOffset(1, -1) + self.Castbar.Time:SetPoint('RIGHT', self.Castbar, 'RIGHT', -2, 0) + self.Castbar.Time:SetParent(self.Castbar) + self.Castbar.Time:SetJustifyH('RIGHT') + self.Castbar.CustomDelayText = function(self, duration) + self.Time:SetFormattedText('[|cffff0000-%.1f|r] %.1f/%.1f', self.delay, duration, self.max) + end + + self.Castbar.SafeZone = self.Castbar:CreateTexture('$parentCastBarSafeZone', 'OVERLAY') + self.Castbar.SafeZone:SetTexture('Interface\\Buttons\\WHITE8x8') + self.Castbar.SafeZone:SetVertexColor(1, .5, 0, .25) + + self.PostChannelStart = UpdateChannelStart + self.PostCastStart = UpdateCastStart + elseif (unit == 'target') then + self.Castbar = CreateFrame('StatusBar', '$parentCastBar', self) + self.Castbar:SetStatusBarTexture(Settings.Media.StatusBar) + self.Castbar:SetStatusBarColor(unpack(Settings.CastBars.Target.Color)) + self.Castbar:SetWidth(Settings.CastBars.Target.Width) + self.Castbar:SetScale(Settings.CastBars.Target.Scale) + + self.Border = CreateFrame('Frame', nil, self.Castbar) + self.Border:SetAllPoints(self.Castbar) + self.Border:SetFrameLevel(self.Castbar:GetFrameLevel() + 2) + + AddBorder(self.Border, Settings.Media.BorderSize) + + self.Castbar:SetHeight(Settings.CastBars.Target.Height) + self.Castbar:SetParent(self) + self.Castbar:SetPoint(unpack(Settings.CastBars.Target.Position)) + + self.Castbar.Bg = self.Castbar:CreateTexture('$parentCastBarBackground', 'BORDER') + self.Castbar.Bg:SetAllPoints(self.Castbar) + self.Castbar.Bg:SetTexture(.1, .1, .1, .7) + + self.Castbar.Text = self.Castbar:CreateFontString('$parentCastBarText', 'OVERLAY') + self.Castbar.Text:SetFont(Settings.Media.Font, 13) + self.Castbar.Text:SetShadowOffset(1, -1) + self.Castbar.Text:SetPoint('LEFT', self.Castbar, 'LEFT', 2, 0) + self.Castbar.Text:SetHeight(Settings.Media.FontSize) + self.Castbar.Text:SetWidth(130) + self.Castbar.Text:SetJustifyH('LEFT') + + self.Castbar.Time = self.Castbar:CreateFontString('$parentCastBarTime', 'OVERLAY') + self.Castbar.Time:SetFont(Settings.Media.Font, 13) + self.Castbar.Time:SetShadowOffset(1, -1) + self.Castbar.Time:SetPoint('RIGHT', self.Castbar, 'RIGHT', -2, 0) + self.Castbar.CustomTimeText = function(self, duration) + if (self.casting) then + self.Time:SetFormattedText('%.1f', self.max - duration) + elseif (self.channeling) then + self.Time:SetFormattedText('%.1f', duration) + end + end + + self.PostChannelStart = UpdateChannelStart + self.PostCastStart = UpdateCastStart + end + end + + -- Now to skin and setup our Mirror Timers + for _, bar in pairs({ + 'MirrorTimer1', + 'MirrorTimer2', + 'MirrorTimer3', + }) do + for i, region in pairs({_G[bar]:GetRegions()}) do + if (region.GetTexture and region:GetTexture() == 'SolidTexture') then + region:Hide() + end + end + + MirrorBorder = CreateFrame('Frame', nil, _G[bar]) + MirrorBorder:SetAllPoints(_G[bar]) + MirrorBorder:SetFrameLevel(_G[bar]:GetFrameLevel() + 2) + AddBorder(MirrorBorder, Settings.Media.BorderSize) + + _G[bar..'Border']:Hide() + + _G[bar]:SetParent(UIParent) + _G[bar]:SetScale(1.135) + _G[bar]:SetHeight(18) + _G[bar]:SetWidth(200) + + _G[bar..'Background'] = _G[bar]:CreateTexture(bar..'Background', 'BACKGROUND', _G[bar]) + _G[bar..'Background']:SetTexture('Interface\\Buttons\\WHITE8x8') + _G[bar..'Background']:SetAllPoints(bar) + _G[bar..'Background']:SetVertexColor(0, 0, 0, .5) + + _G[bar..'Text']:SetFont(CastingBarFrameText:GetFont(), 13) + _G[bar..'Text']:ClearAllPoints() + _G[bar..'Text']:SetPoint('CENTER', MirrorTimer1StatusBar, 0, 1) + + _G[bar..'StatusBar']:SetAllPoints(_G[bar]) + end + + -- Display the names + if (unit ~= 'player') then + local name = self.Health:CreateFontString('$parentName', 'OVERLAY') + if (unit == 'targettarget' or unit == 'pet') then + name:SetPoint('CENTER') + else + name:SetPoint('LEFT', self.Health, 'LEFT', 1, 0) + name:SetJustifyH('LEFT') + end + + name:SetFont(Settings.Media.Font, Settings.Media.FontSize) + name:SetShadowOffset(1, -1) + name:SetTextColor(1, 1, 1) + name:SetWidth(130) + name:SetParent(self.Overlay) + name:SetHeight(Settings.Media.FontSize) + self.Info = name + if (unit == 'target') then + self:Tag(self.Info, '[LanLevel] [LanName]') + elseif (unit == 'focus') then + name:SetText() + else + self:Tag(self.Info, '[LanName]') + end + end + + if (isHealer) then + if (unit == 'target') then + local MHPB = CreateFrame('StatusBar', nil, self.Health) + MHPB:SetOrientation('HORIZONTAL') + MHPB:SetPoint('LEFT', self.Health:GetStatusBarTexture(), 'RIGHT', 0, 0) + MHPB:SetStatusBarTexture(Settings.Media.StatusBar) + MHPB:SetWidth(200) + MHPB:SetHeight(22) + MHPB:SetStatusBarColor(0, 1, 0.5, 0.25) + + local OHPB = CreateFrame('StatusBar', nil, self.Health) + OHPB:SetOrientation('HORIZONTAL') + OHPB:SetPoint('LEFT', MHPB:GetStatusBarTexture(), 'RIGHT', 0, 0) + OHPB:SetStatusBarTexture(Settings.Media.StatusBar) + OHPB:SetWidth(200) + OHPB:SetHeight(22) + OHPB:SetStatusBarColor(0, 1, 0, 0.25) + + self.HealPrediction = { + myBar = MHPB, + otherBar = OHPB, + maxOverflow = 1, + } + end + end + + -- Display icons + if (unit == 'player') then + self.Status = self.Health:CreateFontString(nil, 'OVERLAY') + self.Status:SetParent(self.Overlay) + self.Status:SetFont(Settings.Media.Font, Settings.Media.FontSize) + self.Status:SetPoint('LEFT', self.Health, 'TOPLEFT', 2, 2) + + self:Tag(self.Status, '[LanLeader][LanMaster]') + + self.Resting = self.Overlay:CreateTexture(nil, 'OVERLAY') + self.Resting:SetParent(self.Overlay) + self.Resting:SetPoint('CENTER', self.Health, 'BOTTOMLEFT', 0, -4) + self.Resting:SetSize(20, 20) + + self.Combat = self.Health:CreateTexture(nil, 'OVERLAY') + self.Combat:SetParent(self.Overlay) + self.Combat:SetPoint('CENTER', self.Health, 'BOTTOMRIGHT', 0, -4) + self.Combat:SetSize(24, 24) + end + + -- Aura/buff/debuff handling, update those suckers! + if (unit == 'player') then + local GAP = 6 + + self.Buffs = CreateFrame('Frame', nil, self) + self.Buffs:SetPoint('BOTTOMLEFT', self, 'TOPLEFT', 0, 10) + self.Buffs:SetPoint('BOTTOMRIGHT', self, 'TOPRIGHT', 0, 10) + self.Buffs:SetHeight(30) + + self.Buffs['growth-x'] = 'LEFT' + self.Buffs['growth-y'] = 'UP' + self.Buffs['initialAnchor'] = 'BOTTOMRIGHT' + self.Buffs['num'] = math.floor((Settings.Units.Player.Width - 4 + GAP) / (30 + GAP)) + self.Buffs['size'] = 30 + self.Buffs['spacing-x'] = GAP + self.Buffs['spacing-y'] = GAP + + self.Buffs.CustomFilter = CustomAuraFilter + self.Buffs.PostCreateIcon = PostCreateAuraIcon + self.Buffs.PostUpdateIcon = PostUpdateAuraIcon + + self.Buffs.parent = self + elseif (unit == 'target') then + local GAP = 6 + +-- local MAX_ICONS = math.floor((Settings.Units.Target.Width - 4 + GAP) / (Settings.Units.Target.Height + GAP)) - 1 + local MAX_ICONS = 10 +-- local NUM_BUFFS = math.max(2, math.floor(MAX_ICONS * 0.4)) + local NUM_BUFFS = 4 +-- local NUM_DEBUFFS = math.min(MAX_ICONS - 1, math.floor(MAX_ICONS * 0.8)) + local NUM_DEBUFFS = 6 + + self.Debuffs = CreateFrame('Frame', nil, self) + + self.Debuffs['growth-x'] = 'RIGHT' + self.Debuffs['growth-y'] = 'UP' + self.Debuffs['initialAnchor'] = 'BOTTOMLEFT' + self.Debuffs['num'] = NUM_DEBUFFS + self.Debuffs['showType'] = false + self.Debuffs['size'] = 30 + self.Debuffs['spacing-x'] = GAP + self.Debuffs['spacing-y'] = GAP * 2 + + self.Debuffs:SetPoint('BOTTOMLEFT', self, 'TOPLEFT', 0, 10) + self.Debuffs:SetWidth((Settings.Units.Target.Height * NUM_DEBUFFS) + (GAP * (NUM_DEBUFFS - 1))) + self.Debuffs:SetHeight((Settings.Units.Target.Height * 2) + (GAP * 2)) + + self.Debuffs.CustomFilter = CustomAuraFilter + self.Debuffs.PostCreateIcon = PostCreateAuraIcon + self.Debuffs.PostUpdateIcon = PostUpdateAuraIcon + + self.Debuffs.parent = self + + self.Buffs = CreateFrame('Frame', nil, self) + + self.Buffs['growth-x'] = 'LEFT' + self.Buffs['growth-y'] = 'UP' + self.Buffs['initialAnchor'] = 'BOTTOMRIGHT' + self.Buffs['num'] = NUM_BUFFS + self.Buffs['showType'] = false + self.Buffs['size'] = 30 + self.Buffs['spacing-x'] = GAP + self.Buffs['spacing-y'] = GAP * 2 + + self.Buffs:SetPoint('BOTTOMRIGHT', self, 'TOPRIGHT', 0, 10) + self.Buffs:SetWidth((Settings.Units.Target.Height * NUM_BUFFS) + (GAP * (NUM_BUFFS - 1))) + self.Buffs:SetHeight((Settings.Units.Target.Height * 2) + (GAP * 2)) + + self.Buffs.CustomFilter = CustomAuraFilter + self.Buffs.PostCreateIcon = PostCreateAuraIcon + self.Buffs.PostUpdateIcon = PostUpdateAuraIcon + + self.Buffs.parent = self + end + + -- DebuffHighlight Support + self.DebuffHighlightBackdrop = false + self.DebuffHighlightFilter = false + + -- Various oUF plugins support + if (unit == 'player') then + + -- oUF_RuneBar support + if(IsAddOnLoaded('oUF_RuneBar') and class == 'DEATHKNIGHT') then + self.RuneBar = {} + for i = 1, 6 do + self.RuneBar[i] = CreateFrame('StatusBar', '$parentRuneBar', self) + if(i == 1) then + self.RuneBar[i]:SetPoint('TOPLEFT', self, 'BOTTOMLEFT', 0, -1) + else + self.RuneBar[i]:SetPoint('TOPLEFT', self.RuneBar[i-1], 'TOPRIGHT', 1, 0) + end + self.RuneBar[i]:SetStatusBarTexture(Settings.Media.StatusBar) + self.RuneBar[i]:SetHeight(5) + self.RuneBar[i]:SetWidth(200/6 - .85) + self.RuneBar[i]:SetBackdrop(backdrop) + self.RuneBar[i]:SetBackdropColor(0, 0, 0, .5) + self.RuneBar[i]:SetMinMaxValues(0, 1) + + self.RuneBar[i].bg = self.RuneBar[i]:CreateTexture('$parentRuneBackground', 'BORDER') + self.RuneBar[i].bg:SetAllPoints(self.RuneBar[i]) + self.RuneBar[i].bg:SetTexture(.1, .1, .1) + end + end + + -- DruidPower Support + if (select(2, UnitClass('player')) == 'DRUID') then + self.Druid = CreateFrame('Frame') + self.Druid:SetParent(self) + self.Druid:SetFrameStrata('LOW') + + self.Druid.Power = CreateFrame('StatusBar', nil, self) + self.Druid.Power:SetPoint('TOP', self.Power, 'BOTTOM', 0, -7) + self.Druid.Power:SetStatusBarTexture(Settings.Media.StatusBar) + self.Druid.Power:SetFrameStrata('LOW') + self.Druid.Power:SetFrameLevel(self.Druid:GetFrameLevel() - 1) + self.Druid.Power:SetHeight(10) + self.Druid.Power:SetWidth(200) + self.Druid.Power:SetBackdrop(backdrop) + self.Druid.Power:SetBackdropColor(0, 0, 0, 0.5) + + self.DruidBorder = CreateFrame('Frame', nil, self.Druid.Power) + self.DruidBorder:SetAllPoints(self.Druid.Power) + self.DruidBorder:SetFrameLevel(self.Druid.Power:GetFrameLevel() + 2) + + AddBorder(self.DruidBorder, Settings.Media.BorderSize) + + table.insert(self.__elements, UpdateDruidPower) + self:RegisterEvent('UNIT_MANA', UpdateDruidPower) + self:RegisterEvent('UNIT_RAGE', UpdateDruidPower) + self:RegisterEvent('UNIT_ENERGY', UpdateDruidPower) + self:RegisterEvent('UPDATE_SHAPESHIFT_FORM', UpdateDruidPower) + end + + -- Eclipse Bar Support + if (select(2, UnitClass('player')) == 'DRUID') then + local EclipseBar = CreateFrame('Frame', nil, self) + EclipseBar:SetPoint('TOPLEFT', self, 'BOTTOMLEFT', 0, -10) + EclipseBar:SetPoint('TOPRIGHT', self, 'BOTTOMRIGHT', 0, -10) + EclipseBar:SetSize(200, 10) + EclipseBar:SetBackdrop(backdrop) + EclipseBar:SetBackdropColor(0, 0, 0, 0.6) + + local EclipseBarBorder = CreateFrame('Frame', nil, EclipseBar) + EclipseBarBorder:SetAllPoints(EclipseBar) + EclipseBarBorder:SetFrameLevel(EclipseBar:GetFrameLevel() + 2) + + AddBorder(EclipseBarBorder, Settings.Media.BorderSize) + + local LunarBar = CreateFrame('StatusBar', nil, EclipseBar) + LunarBar:SetPoint('LEFT', EclipseBar, 'LEFT', 0, 0) + LunarBar:SetSize(200, 10) + LunarBar:SetStatusBarTexture(Settings.Media.StatusBar) + LunarBar:SetStatusBarColor(1, 1, 1) + EclipseBar.LunarBar = LunarBar + + local SolarBar = CreateFrame('StatusBar', nil, EclipseBar) + SolarBar:SetPoint('LEFT', LunarBar:GetStatusBarTexture(), 'RIGHT', 0, 0) + SolarBar:SetSize(200, 10) + SolarBar:SetStatusBarTexture(Settings.Media.StatusBar) + SolarBar:SetStatusBarColor(1, 3/5, 0) + EclipseBar.SolarBar = SolarBar + + local EclipseBarText = EclipseBarBorder:CreateFontString(nil, 'OVERLAY') + EclipseBarText:SetPoint('CENTER', EclipseBarBorder, 'CENTER', 0, 0) + EclipseBarText:SetFont(Settings.Media.Font, Settings.Media.FontSize, 'OUTLINE') + self:Tag(EclipseBarText, '[pereclipse]%') + + self.EclipseBar = EclipseBar + end + + -- Soul Shard Support + if (select(2, UnitClass('player')) == 'WARLOCK') then + local Shards = self:CreateFontString(nil, 'OVERLAY') + Shards:SetPoint('CENTER', self, 'RIGHT', 17, -2) + Shards:SetFont(Settings.Media.Font, 24, 'OUTLINE') + Shards:SetJustifyH('CENTER') + self:Tag(Shards, '[LanShards]') + end + + -- Holy Power Support + if (select(2, UnitClass('player')) == 'PALADIN') then + local HolyPower = self:CreateFontString(nil, 'OVERLAY') + HolyPower:SetPoint('CENTER', self, 'RIGHT', 17, -2) + HolyPower:SetFont(Settings.Media.Font, 24, 'OUTLINE') + HolyPower:SetJustifyH('CENTER') + self:Tag(HolyPower, '[LanHolyPower]') + end + + -- Combo points display + if (select(2, UnitClass('player')) == 'ROGUE') or (select(2, UnitClass('player')) == 'DRUID') then + local ComboPoints = self:CreateFontString(nil, 'OVERLAY') + ComboPoints:SetPoint('CENTER', self, 'RIGHT', 17, -2) + ComboPoints:SetFont(Settings.Media.Font, 24, 'OUTLINE') + ComboPoints:SetJustifyH('CENTER') + self:Tag(ComboPoints, '[LanCombo]') + end + end + + -- Custom sizes for our frames + if (isSingle) then + if (unit == 'player') then + self:SetSize(Settings.Units.Player.Width, Settings.Units.Player.Height) + elseif (unit == 'target') then + self:SetSize(Settings.Units.Target.Width, Settings.Units.Target.Height) + elseif (unit == 'pet') then + self:SetSize(Settings.Units.Pet.Width, Settings.Units.Pet.Height) + end + + if (Settings.Show.ToT) then + if (unit == 'targettarget') then + self:SetSize(Settings.Units.ToT.Width, Settings.Units.ToT.Height) + end + end + + if (Settings.Show.Focus) then + if (unit == 'focus') then + self:SetSize(Settings.Units.Focus.Width, Settings.Units.Focus.Height) + end + end + end + + -- Hardcore border action! + AddBorder(self, Settings.Media.BorderSize) + self:SetBorderParent(self.Overlay) + + self.UpdateBorder = UpdateBorder + + -- Dispel highlight support + self.DispelHighlight = UpdateDispelHighlight + + -- Threat highlight support + self.threatLevel = 0 + self.ThreatHighlight = UpdateThreatHighlight + + return self +end + +-- First build the group style +local function StylishGroup(self, unit) + self.menu = CreateDropDown + self.ignoreHealComm = true + + self:EnableMouse(true) + self:RegisterForClicks('AnyUp') + + if (Settings.Show.Party) then + if (Settings.Units.Party.Healer) then + self:SetSize(100, 35) + else + self:SetSize(Settings.Units.Party.Width, Settings.Units.Party.Height) + end + end + + -- Health bar display for group frames + self.Health = CreateFrame('StatusBar', '$parentHealthBar', self) + self.Health:SetStatusBarTexture(Settings.Media.StatusBar, 'ARTWORK') + + self.Health:SetParent(self) + self.Health:SetPoint('TOPRIGHT') + self.Health:SetPoint('BOTTOMLEFT', 0, -1) + + self:SetBackdrop(backdrop) + self:SetBackdropColor(0, 0, 0, .5) + + self.Health.PostUpdate = UpdateGroupHealth + + if (Settings.Units.Party.Health.ClassColor) then + self.Health.colorClass = true + end + + self.Health.Smooth = true + + -- Health bar background display for group frames + self.Health.Background = self.Health:CreateTexture('$parentHealthBackground', 'BORDER') + self.Health.Background:SetAllPoints(self.Health) + + -- Background Color + self.Health.Background:SetTexture(.08, .08, .08) + + -- Health value settings + self.Health.Value = self.Health:CreateFontString('$parentHealthValue', 'OVERLAY') + self.Health.Value:SetFont(Settings.Media.Font, Settings.Media.FontSize) + + -- Improve border drawing + self.Overlay = CreateFrame('Frame', nil, self) + self.Overlay:SetAllPoints(self) + self.Overlay:SetFrameLevel(self.Health:GetFrameLevel() + (self.Power and 3 or 2)) + + -- Display group names + self.Name = self.Health:CreateFontString('$parentName', 'OVERLAY') + self.Name:SetPoint('LEFT', self.Health, 5, 1) + self.Name:SetFont(Settings.Media.Font, 13) + self.Name:SetShadowOffset(1, -1) + self:Tag(self.Name, '|cffffffff[LanName]|r') + + if (Settings.Units.Party.Healer) then + self.Name:SetPoint('CENTER', self.Health) + end + + if isHealer then + local MHPB = CreateFrame('StatusBar', nil, self.Health) + MHPB:SetOrientation('HORIZONTAL') + MHPB:SetPoint('LEFT', self.Health:GetStatusBarTexture(), 'RIGHT', 0, 0) + MHPB:SetStatusBarTexture(Settings.Media.StatusBar) + MHPB:SetWidth(100) + MHPB:SetHeight(35) + MHPB:SetStatusBarColor(0, 1, 0.5, 0.25) + + local OHPB = CreateFrame('StatusBar', nil, self.Health) + OHPB:SetOrientation('HORIZONTAL') + OHPB:SetPoint('LEFT', MHPB:GetStatusBarTexture(), 'RIGHT', 0, 0) + OHPB:SetStatusBarTexture(Settings.Media.StatusBar) + OHPB:SetWidth(100) + OHPB:SetHeight(35) + OHPB:SetStatusBarColor(0, 1, 0, 0.25) + + self.HealPrediction = { + myBar = MHPB, + otherBar = OHPB, + maxOverflow = 1, + } + end + + if unit == 'party' or unit == 'target' then + self.Status = self.Overlay:CreateFontString(nil, 'OVERLAY') + self.Status:SetFont(Settings.Media.Font, Settings.Media.FontSize) + self.Status:SetPoint('RIGHT', self.Health, 'BOTTOMRIGHT', -2, 0) + + self:Tag(self.Status, '[LanMaster][LanLeader]') + end + + -- Raid Icons + self.RaidIcon = self.Overlay:CreateTexture('$parentRaidIcon', 'ARTWORK') + self.RaidIcon:SetHeight(18) + self.RaidIcon:SetWidth(18) + self.RaidIcon:SetPoint('CENTER', self.Overlay, 'TOP') + self.RaidIcon:SetTexture('Interface\\TargettingFrame\\UI-RaidTargetingIcons') + + -- LFD Role + self.LFDRole = self.Overlay:CreateTexture(nil, 'OVERLAY') + self.LFDRole:SetPoint('CENTER', self, 'RIGHT', 2, 0) + self.LFDRole:SetSize(16, 16) + + -- Buffs + local GAP = 6 + + self.Buffs = CreateFrame('Frame', nil, self) + self.Buffs:SetPoint('BOTTOMRIGHT', self, 'TOPRIGHT', 0, 10) + self.Buffs:SetHeight(Settings.Units.Party.Height) + self.Buffs:SetWidth((Settings.Units.Party.Height * 4) + (GAP * 3)) + + self.Buffs['growth-x'] = 'LEFT' + self.Buffs['growth-y'] = 'DOWN' + self.Buffs['initialAnchor'] = 'TOPRIGHT' + self.Buffs['num'] = 4 + self.Buffs['size'] = Settings.Units.Party.Height + self.Buffs['spacing-x'] = GAP + self.Buffs['spacing-y'] = GAP + + self.Buffs.CustomFilter = CustomAuraFilter + self.Buffs.PostCreateIcon = PostCreateAuraIcon + self.Buffs.PostUpdateIcon = PostUpdateAuraIcon + + self.Buffs.parent = self + + -- Range-finding support + self.Range = { + insideAlpha = 1, + outsideAlpha = .3, + } + + self.SpellRange = true + + -- Hardcore border action! + AddBorder(self, Settings.Media.BorderSize) + self:SetBorderParent(self.Overlay) + + self.UpdateBorder = UpdateBorder + + -- Dispel highlight support + self.DispelHighlight = UpdateDispelHighlight + + -- Threat highlight support + self.threatLevel = 0 + self.ThreatHighlight = UpdateThreatHighlight + + return self +end + +-- Now the raid style +local function StylishRaid(self, unit) + self.menu = CreateDropDown + self.ignoreHealComm = true + + self:EnableMouse(true) + self:RegisterForClicks('AnyUp') + + if (Settings.Show.Raid) then + if (Settings.Units.Raid.Healer) then + self:SetSize(75, 35) + else + self:SetSize(Settings.Units.Raid.Width, Settings.Units.Raid.Height) + end + end + + -- Health bar display for group frames + self.Health = CreateFrame('StatusBar', '$parentHealthBar', self) + self.Health:SetStatusBarTexture(Settings.Media.StatusBar, 'ARTWORK') + + self.Health:SetParent(self) + self.Health:SetPoint('TOPRIGHT') + self.Health:SetPoint('BOTTOMLEFT', 0, -1) + + self:SetBackdrop(backdrop) + self:SetBackdropColor(0, 0, 0, .5) + + self.Health.PostUpdate = UpdateRaidHealth + + if (Settings.Units.Raid.Health.ClassColor) then + self.Health.colorClass = true + end + + self.Health.Smooth = true + + -- Health bar background display for group frames + self.Health.Background = self.Health:CreateTexture('$parentHealthBackground', 'BORDER') + self.Health.Background:SetAllPoints(self.Health) + + -- Background Color + self.Health.Background:SetTexture(.08, .08, .08) + + -- Health value settings + self.Health.Value = self.Health:CreateFontString('$parentHealthValue', 'OVERLAY') + self.Health.Value:SetFont(Settings.Media.Font, Settings.Media.FontSize) + + -- Improve border drawing + self.Overlay = CreateFrame('Frame', nil, self) + self.Overlay:SetAllPoints(self) + self.Overlay:SetFrameLevel(self.Health:GetFrameLevel() + (self.Power and 3 or 2)) + + -- Display group names + if (Settings.Units.Raid.Healer) then + self.Name = self.Health:CreateFontString('$parentName', 'OVERLAY') + self.Name:SetPoint('TOP', 0, -2) + self.Name:SetFont(Settings.Media.Font, 13) + self.Name:SetShadowOffset(1, -1) + self.Name:SetJustifyH('CENTER') + self:Tag(self.Name, '|cffffffff[LanRaidName]|r') + else + self.Name = self.Health:CreateFontString('$parentName', 'OVERLAY') + self.Name:SetPoint('LEFT', self.Health, 5, 1) + self.Name:SetFont(Settings.Media.Font, 13) + self.Name:SetShadowOffset(1, -1) + self:Tag(self.Name, '|cffffffff[LanName]|r') + self.Health:SetOrientation('HORIZONTAL') + end + + if isHealer then + local MHPB = CreateFrame('StatusBar', nil, self.Health) + MHPB:SetPoint('BOTTOM', self.Health:GetStatusBarTexture(), 'TOP', 0, 0) + MHPB:SetStatusBarTexture(Settings.Media.StatusBar) + MHPB:SetWidth(75) + MHPB:SetHeight(35) + MHPB:SetStatusBarColor(0, 1, 0.5, 0.25) + + local OHPB = CreateFrame('StatusBar', nil, self.Health) + OHPB:SetPoint('BOTTOM', MHPB:GetStatusBarTexture(), 'TOP', 0, 0) + OHPB:SetStatusBarTexture(Settings.Media.StatusBar) + OHPB:SetWidth(75) + OHPB:SetHeight(35) + OHPB:SetStatusBarColor(0, 1, 0, 0.25) + + self.HealPrediction = { + myBar = MHPB, + otherBar = OHPB, + maxOverflow = 1, + } + end + + -- Status Icons Display + self.Status = self.Overlay:CreateFontString(nil, 'OVERLAY') + self.Status:SetFont(Settings.Media.Font, Settings.Media.FontSize) + self.Status:SetPoint('RIGHT', self.Health, 'BOTTOMRIGHT', -2, 0) + + self:Tag(self.Status, '[LanMaster][LanLeader]') + + -- Raid Icons + self.RaidIcon = self.Overlay:CreateTexture('$parentRaidIcon', 'ARTWORK') + self.RaidIcon:SetHeight(18) + self.RaidIcon:SetWidth(18) + self.RaidIcon:SetPoint('CENTER', self.Overlay, 'TOP') + self.RaidIcon:SetTexture('Interface\\TargettingFrame\\UI-RaidTargetingIcons') + + -- Range-finding support + self.Range = { + insideAlpha = 1, + outsideAlpha = .3, + } + + self.SpellRange = true + + -- Hardcore border action! + AddBorder(self, Settings.Media.BorderSize) + self:SetBorderParent(self.Overlay) + + self.UpdateBorder = UpdateBorder + + -- Dispel highlight support + self.DispelHighlight = UpdateDispelHighlight + + return self +end + +-- Now, actually bring it all together by actually spawning the frames +-- First spawn the group and raid stuff +oUF:RegisterStyle('oUF_Lanerra_Group', StylishGroup) +oUF:RegisterStyle('oUF_Lanerra_Raid', StylishRaid) + +-- First up are the group frames +oUF:Factory(function(self) + if (Settings.Units.Party.Healer) then + local group = oUF:SpawnHeader('oUF_Lanerra_Group', nil, nil, 'showParty', true, 'showFocus', true, 'columnSpacing', 10, 'unitsPerColumn', 1, 'maxColumns', 5, 'columnAnchorPoint', 'LEFT', 'groupFilter', i) + group:SetPoint('CENTER', UIParent, 0, -240) + else + local group = oUF:SpawnHeader('oUF_Lanerra_Group', nil, nil, 'showParty', true, 'showPlayer', true, 'showFocus', true, 'yOffset', -10) + if (IsAddOnLoaded('Skada')) then + group:SetPoint(unpack(Settings.Units.Party.TinyPosition)) + else + group:SetPoint(unpack(Settings.Units.Party.Position)) + end + end +end) + +-- Now for the raid frames +oUF:Factory(function(self) + self:SetActiveStyle('oUF_Lanerra_Raid') + + if (Settings.Units.Raid.Healer) then + raid = oUF:SpawnHeader('oUF_Lanerra_Raid', nil, nil, 'showPlayer', true, 'showRaid', true, 'xOffset', 10, 'yOffset', -5, 'point', 'LEFT', 'groupFilter', '1,2,3,4,5', 'groupingOrder', '1,2,3,4,5', 'groupBy', 'GROUP', 'maxColumns', 10, 'unitsPerColumn', 5, 'columnSpacing', 10, 'columnAnchorPoint', 'TOP') + raid:SetPoint('CENTER', UIParent, 0, -310) + + if (Settings.Units.Raid.Healer) then + local RaidShift, raid = false + do + local UpdateRaid = CreateFrame'Frame' + UpdateRaid:RegisterEvent('RAID_ROSTER_UPDATE') + UpdateRaid:SetScript('OnEvent', function(self) + if RaidShift == false then return end + if(InCombatLockdown()) then + self:RegisterEvent('PLAYER_REGEN_ENABLED') + else + self:UnregisterEvent('PLAYER_REGEN_ENABLED') + if (GetNumRaidMembers() < 26 and GetNumRaidMembers() > 10) then + raid:SetPoint('CENTER', UIParent, -105, -200) + elseif (GetNumRaidMembers() < 11) then + raid:SetPoint('CENTER', UIParent, -21, -200) + end + end + end) + end + end + else + raid = {} + for i = 1, 5 do + raid[i] = oUF:SpawnHeader('oUF_Lanerra_Raid'..i, nil, nil, 'groupFilter', i, 'showRaid', true, 'showParty', true, 'showFocus', true, 'yOffset', -10) + table.insert(raid, raid[i]) + if (i == 1) then + if (IsAddOnLoaded('TinyDPS')) then + raid[i]:SetPoint(unpack(Settings.Units.Raid.TinyPosition)) + else + raid[i]:SetPoint(unpack(Settings.Units.Raid.Position)) + end + else + raid[i]:SetPoint('TOP', raid[i-1], 'BOTTOM', 0, -10) + end + raid[i]:Show() + end + end +end) + +-- Now all the solo stuff +oUF:RegisterStyle('oUF_Lanerra', Stylish) +oUF:Factory(function(self) + self:SetActiveStyle('oUF_Lanerra') + self:Spawn('player', 'oUF_Lanerra_Player'):SetPoint(unpack(Settings.Units.Player.Position)) + self:Spawn('target', 'oUF_Lanerra_Target'):SetPoint(unpack(Settings.Units.Target.Position)) + self:Spawn('targettarget', 'oUF_Lanerra_ToT'):SetPoint(unpack(Settings.Units.ToT.Position)) + self:Spawn('pet', 'oUF_Lanerra_Pet'):SetPoint(unpack(Settings.Units.Pet.Position)) + self:Spawn('focus', 'oUF_Lanerra_Focus'):SetPoint(unpack(Settings.Units.Focus.Position)) +end) + +-- Handling, whether the Raid- or the Party-frame is shown +-- FIX: Quick'n'dirty fix until the oUF-conditions work again +local partyToggle = CreateFrame('Frame') +partyToggle:RegisterEvent('PLAYER_LOGIN') +partyToggle:RegisterEvent('RAID_ROSTER_UPDATE') +partyToggle:RegisterEvent('PARTY_LEADER_CHANGED') +partyToggle:RegisterEvent('PARTY_MEMBERS_CHANGED') +partyToggle:SetScript('OnEvent', function(self) + if(InCombatLockdown()) then + self:RegisterEvent('PLAYER_REGEN_ENABLED') + else + self:UnregisterEvent('PLAYER_REGEN_ENABLED') + + --[[ This results in the following behavior: If you're in a raid, the party frame will be hidden, no matter how many members + your raid already has. This means, the party will be hidden if the party leader clicks the button to create a raid. + If you want to switch to raid view later (meaning, if the members no longer fit into the party frame), you may change the following line accordingly.--]] + + if (Settings.Units.Raid.Healer) and (Settings.Units.Party.Healer) then + if(GetNumRaidMembers() > 0) then + _G['oUF_Lanerra_Group']:Hide() + _G['oUF_Lanerra_Raid']:Show() + else + _G['oUF_Lanerra_Group']:Show() + _G['oUF_Lanerra_Raid']:Hide() + end + else + if(GetNumRaidMembers() > 0) then + _G['oUF_Lanerra_Group']:Hide() + _G['oUF_Lanerra_Raid1']:Show() + _G['oUF_Lanerra_Raid2']:Show() + _G['oUF_Lanerra_Raid3']:Show() + _G['oUF_Lanerra_Raid4']:Show() + _G['oUF_Lanerra_Raid5']:Show() + else + _G['oUF_Lanerra_Group']:Show() + _G['oUF_Lanerra_Raid1']:Hide() + _G['oUF_Lanerra_Raid2']:Hide() + _G['oUF_Lanerra_Raid3']:Hide() + _G['oUF_Lanerra_Raid4']:Hide() + _G['oUF_Lanerra_Raid5']:Hide() + end + end + end +end) \ No newline at end of file diff --git a/oUF_Lanerra.toc b/oUF_Lanerra.toc new file mode 100644 index 0000000..915afdf --- /dev/null +++ b/oUF_Lanerra.toc @@ -0,0 +1,21 @@ +## Interface: 40000 +## Version: 1.14 + +## Title: oUF_Lanerra +## Notes: oUF layout by Lanerra +## Author: Lanerra +## X-Copyright: Copyright © 2010 Lanerra. +## X-License: See LICENSE file for license terms. +## RequiredDeps: oUF +## OptionalDeps: oUF_DebuffHighlight, oUF_RuneBar + + +modules\Smooth.lua +modules\DispellableDebuffs.lua +modules\Threat.lua + +oUF_Lanerra.lua +oUF_Lanerra_Config.lua +AuraFilter.lua +Borders.lua +Tags.lua \ No newline at end of file diff --git a/oUF_Lanerra_Config.lua b/oUF_Lanerra_Config.lua new file mode 100644 index 0000000..afb2558 --- /dev/null +++ b/oUF_Lanerra_Config.lua @@ -0,0 +1,124 @@ +-- Copyright © 2010-2011 Lanerra. See LICENSE file for license terms. +Settings = { + Show = { + CastBars = true, + Focus = true, + ToT = true, + Party = true, + Raid = true, + }, + Media = { + Border = 'Interface\\Addons\\oUF_Lanerra\\media\\borderTexture.tga', + StatusBar = 'Interface\\Addons\\oUF_Lanerra\\media\\statusbarTexture.tga', + Font = 'Interface\\Addons\\oUF_Lanerra\\media\\font.ttf', + FontSize = 15, + BorderSize = 14, + BorderColor = { .65, .65, .65 }, + }, + Units = { + Player = { + Height = 30, + Width = 200, + Position = {'CENTER', UIParent, -325, -175}, + Health = { + Percent = false, + Deficit = false, + Current = true, + }, + ShowPowerText = true, + }, + Pet = { + Height = 30, + Width = 80, + Position = {'CENTER', UIParent, -485, -175}, + Health = { + Percent = false, + Deficit = false, + Current = false, + }, + }, + Target = { + Height = 30, + Width = 200, + Position = {'CENTER', UIParent, 325, -175}, + Health = { + Percent = true, + Deficit = false, + Current = false, + }, + ShowPowerText = false, + }, + ToT = { + Height = 30, + Width = 80, + Position = {'CENTER', UIParent, 485, -175}, + Health = { + Percent = false, + Deficit = false, + Current = false, + }, + }, + Focus = { + Height = 30, + Width = 30, + Position = {'CENTER', UIParent, 0, -175}, + Health = { + Percent = false, + Deficit = false, + Current = false, + }, + }, + Party = { + Height = 20, + Width = 100, + TinyPosition = {'TOPLEFT', UIParent, 25, -210}, + Position = {'TOPLEFT', UIParent, 25, -25}, + Health = { + Percent = true, + Deficit = false, + Current = false, + ClassColor = true, + }, + HidePower = true, -- Reserved for future use + Healer = true, + }, + Raid = { + Height = 18, + Width = 100, + TinyPosition = {'TOPLEFT', UIParent, 25, -210}, + Position = {'TOPLEFT', UIParent, 25, -25}, + Health = { + Percent = false, + Deficit = true, + Current = false, + ClassColor = true, + }, + HidePower = true, -- Reserved for future use + Healer = true, + }, + }, + CastBars = { + Player = { + Show = true, + Height = 25, + Width = 200, + Scale = 1, + Position = {'CENTER', UIParent, -325, -232}, + ClassColor = false, + SafeZone = true, + Latency = false, + Color = {.25, .25, .25}, + }, + Target = { + Show = true, + Height = 25, + Width = 200, + Scale = 1, + Position = {'CENTER', UIParent, 325, -232}, + ClassColor = false, + Color = {.25, .25, .25}, + InterruptHighlight = false, + InterruptColor = {1, 0, 1}, + }, + }, +} \ No newline at end of file