/
local addon = LibStub:GetLibrary("NaturCombat"); |
addon.spells[14327] = {cooldown=30,instant=true,type="CAST"}; -- Scare Beast |
addon.spells[3054] = {duraton=15,cooldown=300,type="BUFF"}; -- Rapid Fire |
addon.spells[19263] = {duration=10,cooldown=300,type="BUFF"}; -- Deterrence |
addon.spells[34692] = {duration=18,cooldown=120,type="BUFF"}; -- The Beast Within |
addon.spells[19574] = {duration=18,cooldown=120,type="BUFF"}; -- Beasial Wrath |
addon.spells[14268] = {duration=10,type="DEBUFF"}; -- Wing Clip |
addon.spells[19233] = {duration=5,type="DEBUFF"}; -- Wing Clip Improved |
addon.spells[27018] = {duration=8,dot=true,type="DEBUFF"}; -- Viper Sting |
addon.spells[20904] = {duration=10,type="DEBUFF"}; -- Aimed Shot |
addon.spells[34490] = {duration=3,type="DEBUFF"}; -- Silencing Shot |
addon.spells[25295] = {duration=15,dot=true,type="DEBUFF"}; -- Serpent Sting |
addon.spells[14311] = {duration=20,pvpdur=10,type="DEBUFF"}; -- Freezing Trap |
addon.spells[19503] = {duration=4,type="DEBUFF"}; -- Scatter Shot |
local addon = LibStub:GetLibrary("NaturCombat"); |
addon.spells[2687] = {duration=10,cooldown=60,type="BUFF"}; -- Bloodrage |
addon.spells[18499] = {duration=10,cooldown=30,type="BUFF"}; -- Berserker Rage |
addon.spells[12292] = {duration=30,cooldown=180,type="BUFF"}; -- Deathwish |
addon.spells[23920] = {duration=5,cooldown=10,type="BUFF"}; -- Spell Reflection |
addon.spells[29838] = {duration=10,type="BUFF"}; -- Second Wind |
addon.spells[25212] = {duration=10,type="DEBUFF"}; -- Hamstring |
addon.spells[23695] = {duration=5,type="DEBUFF"}; -- Imp. HS |
addon.spells[12323] = {duration=6,type="DEBUFF"}; -- P. Howl |
addon.spells[5246] = {duration=8,type="DEBUFF"}; -- Itim. Shout |
addon.spells[30330] = {duration=10,type="DEBUFF"}; -- MS |
addon.spells[25225] = {duration=30,stacks=true,type="DEBUFF"}; -- Sunder Armor |
addon.spells[43104] = {duration=12,dot=true,type="DEBUFF"}; -- Deep Wound |
addon.spells[25208] = {duration=21,dot=true,type="DEBUFF"}; -- Rend |
local addon = LibStub:GetLibrary("NaturCombat"); |
addon.spells[25221] = {duration=15,type="BUFF"}; -- Renew |
addon.spells[19275] = {duration=15,cooldown=180,type="BUFF"}; -- Feedback |
addon.spells[10060] = {duration=15,cooldown=180,type="BUFF"}; -- Power Infusion |
addon.spells[25218] = {duration=30,cooldown=15,type="BUFF"}; -- PW: Shield |
addon.spells[14751] = {cooldown=180,instant=true,type="CAST"}; -- Inner Focus |
addon.spells[33206] = {duration=8,cooldown=120,type="BUFF"}; -- Pain Suppression |
addon.spells[25368] = {duration=18,type="DEBUFF"}; -- SW: Pain |
addon.spells[32996] = {cooldown=12,instant=true,type="CAST"}; -- SW: Death |
addon.spells[25375] = {cooldown=8,instant=true,type="CAST"}; -- Mind blast |
addon.spells[34433] = {duration=15,cooldown=300,instant=true,type="CAST"}; -- Shadowfiend |
addon.spells[10890] = {duration=8,cooldown=27,instant=true,type="CAST"}; -- Fear |
local addon = LibStub:GetLibrary("NaturCombat"); |
addon.spells[33831] = {cooldown=180,instant=true,type="CAST"}; -- Force of Nature |
addon.spells[26980] = {duration=21,type="BUFF"}; -- Regrowth |
addon.spells[33357] = {duration=15,cooldown=300,type="BUFF"}; -- Dash |
addon.spells[22812] = {duration=12,cooldown=60,type="BUFF"}; -- Barkskin |
addon.spells[29166] = {duration=20,cooldown=360,type="BUFF"}; -- Innervate |
addon.spells[26999] = {duration=10,cooldown=180,type="BUFF"}; -- Frenzied Regeneration |
addon.spells[25299] = {duration=12,type="BUFF"}; -- Rejuvenation |
addon.spells[2893] = {duration=7,type="BUFF"}; -- Abolish Poison |
addon.spells[27009] = {duration=45,cooldown=60,type="BUFF"}; -- Nature's Grasp |
addon.spells[33763] = {duration=7,stacks=true,type="BUFF"}; -- Lifebloom |
addon.spells[17116] = {cooldown=180,instant=true,type="CAST"}; -- Nature's Swiftness |
addon.spells[33786] = {duration=6,type="DEBUFF",drcat="Cyclone"}; -- Cyclone |
addon.spells[26989] = {duration=45,pvpdur=10,type="DEBUFF",drcat="Root"}; -- Entangling Roots |
addon.spells[27013] = {duration=12,dot=true,type="DEBUFF"}; -- Insect Swarm |
addon.spells[18658] = {duration=40,pvpdur=10,type="DEBUFF",drcat="SLeep"}; -- Hibernate |
addon.spells[26993] = {duration=40,type="DEBUFF"}; -- Faeire Fire |
addon.spells[17392] = {duration=40,type="DEBUFF"}; -- Feral Faeire Fire |
addon.spells[9898] = {duration=30,type="DEBUFF"}; -- Demo. Roar |
addon.spells[33986] = {duration=12,type="DEBUFF"}; -- Mangle (Bear) |
addon.spells[33982] = {duration=12,type="DEBUFF"}; -- Mangle (Cat) |
addon.spells[45334] = {duration=4,type="DEBUFF"}; -- Feral Charge |
addon.spells[33745] = {duration=15,stacks=true,dot=true,type="DEBUFF"}; -- Lacerate |
addon.spells[9834] = {duration=12,dot=true,type="DEBUFF"}; -- Moonfire |
addon.spells[27008] = {duration=12,dot=true,type="DEBUFF"}; -- Rip |
addon.spells[1823] = {duration=9,dot=true,type="DEBUFF"}; -- Rake |
addon.spells[27006] = {duration=4,stun=true,combo=true,talent={2,4,4,0.5,"DRUID"},type="DEBUFF",drcat="Stun"}; -- Pounce |
addon.spells[27007] = {duration=18,dot=true,type="DEBUFF"}; -- Pounce Bleed |
addon.spells[22570] = {duration=7,stun=true,combo={1,7},type="DEBUFF",drcat="Disorient"}; -- Maim |
addon.spells[6798] = {duration=5,stun=true,talent={2,4,5,0.5,"DRUID"},type="DEBUFF",drcat="Stun"}; -- Bash |
local addon = LibStub:GetLibrary("NaturCombat"); |
addon.spells[32182] = {duration=30,cooldown=600,type="BUFF"}; -- Heroism |
addon.spells[2825] = {duration=30,cooldown=600,type="BUFF"}; -- Bloodlust |
addon.spells[25464] = {duration=8,type="DEBUFF"}; -- Frost Shock |
addon.spells[25457] = {duration=12,type="DEBUFF"}; -- Flame Shock |
addon.spells[25442] = {cooldown=6,type="CAST"}; -- CLightning |
addon.spells[16190] = {duration=12,cooldown=300,instant=true,type="CAST"}; -- Mana Tide Totme |
local addon = LibStub:GetLibrary("NaturCombat"); |
addon.spells[1020] = {duration=12,cooldown=300,type="BUFF"}; -- Divine Shield |
addon.spells[10278] = {duration=10,cooldown=300,type="BUFF"}; -- BoP |
addon.spells[1044] = {duration=16,cooldown=25,type="BUFF"}; -- BoF |
addon.spells[27184] = {duration=30,type="BUFF"}; -- BoS |
addon.spells[20059] = {duration=30,stacks=true,type="BUFF"}; -- Vengeance |
addon.spells[31884] = {duration=20,cooldown=180,type="BUFF"}; -- Avenging Wrath |
addon.spells[31842] = {duration=15,cooldown=180,type="BUFF"}; -- Divine Illumination |
addon.spells[20216] = {cooldown=120,instant=true,type="CAST"}; -- Divine Favor |
addon.spells[10308] = {duration=5,stun=true,type="DEBUFF"}; -- HoJ |
addon.spells[27180] = {cooldown=6,instant=true,type="CAST"}; -- HoW |
local addon = LibStub:GetLibrary("NaturCombat"); |
addon.spells[10225] = {duration=30,type="BUFF"}; -- Fire Ward |
addon.spells[32796] = {duration=30,type="BUFF"}; -- Frost Ward |
addon.spells[12051] = {duration=8,cooldown=480,type="BUFF"}; -- Evocation |
addon.spells[45438] = {duration=10,cooldown=300,type="BUFF"}; -- Ice Block |
addon.spells[33405] = {duration=30,type="BUFF"}; -- Ice Barrier |
addon.spells[66] = {duration=8,cooldown=300,type="BUFF"}; -- Invisibility |
addon.spells[12043] = {cooldown=180,instant=true,type="CAST"}; -- Pressence of Mind |
addon.spells[12472] = {duraton=20,cooldown=180,type="BUFF"}; -- Icy Veins |
addon.spells[31642] = {duration=8,type="BUFF"}; -- Blazing Speed |
addon.spells[12042] = {duration=15,cooldown=180,type="BUFF"}; -- Arcane Power |
addon.spells[33042] = {duration=3,type="DEBUFF"}; -- Dragon's Breath |
addon.spells[27088] = {duration=8,type="DEBUFF"}; -- Frost Nova |
addon.spells[12497] = {duration=5,type="DEBUFF"}; -- Frostbite |
addon.spells[10161] = {duration=8,type="DEBUFF"}; -- Cone of Cold |
addon.spells[28594] = {duration=15,stacks=true,type="DEBUFF"}; -- Winter's Chill |
addon.spells[22959] = {duration=30,stacks=true,type="DEBUFF"}; -- Fire Vulnerability |
addon.spells[12359] = {duration=2,stun=true,type="DEBUFF"}; -- Impact |
addon.spells[12825] = {duration=50,pvpdur=10,type="DEBUFF",drcat="Disorient"}; -- Polymorph |
addon.spells[28272] = {duration=50,pvpdur=10,type="DEBUFF",drcat="Disorient"}; -- Polymorph: Pig |
addon.spells[28271] = {duration=40,pvpdur=10,type="DEBUFF",drcat="Disorient"}; -- Polymorph: Turtle |
addon.spells[30942] = {duration=9,type="DEBUFF"}; -- Frostbolt |
addon.spells[1953] = {cooldown=15,instant=true,type="CAST"}; -- blink |
addon.spells[31687] = {duration=45,cooldown=180,instant=true,type="CAST"}; -- Water Ele |
addon.spells[11985] = {cooldown=600,instant=true,type="CAST"}; -- Cold Snap |
local addon = LibStub:GetLibrary("NaturCombat"); |
addon.spells[11305] = {duration=15,cooldown=300,type="BUFF"}; -- Sprint |
addon.spells[26669] = {duration=15,cooldown=300,type="BUFF"}; -- Evasion |
addon.spells[26889] = {duration=10,cooldown=210,type="BUFF"}; -- Vanish |
addon.spells[13877] = {duration=15,cooldown=120,type="BUFF"}; -- Blade Flurry |
addon.spells[13750] = {duration=15,cooldown=300,type="BUFF"}; -- Adren. Rush |
addon.spells[31224] = {duration=4,cooldown=60,type="BUFF"}; -- CloS |
addon.spells[36554] = {duration=10,cooldown=30,type="BUFF"}; -- Shadowstep |
addon.spells[26679] = {duration=5,type="DEBUFF"}; -- Deadly Throw |
addon.spells[2094] = {duration=10,type="DEBUFF",drcat="Cyclone"}; -- Blind |
addon.spells[8629] = {duration=4,talent={2,1,4,0.5,"ROGUE"},stun=true,type="DEBUFF",drcat="Disorient"}; -- Gouge |
addon.spells[8643] = {duration=6,combo=true,stun=true,type="DEBUFF",drcat="Kidney Shot"}; -- Kidney shot |
addon.spells[1833] = {duration=4,stun=true,type="DEBUFF",drcat="Stun"}; -- Cheapshot |
addon.spells[26867] = {duration=16,combo=true,dot=true,type="DEBUFF"}; -- Rupture |
addon.spells[8632] = {duration=18,dot=true,type="DEBUFF"}; -- Garrote |
addon.spells[2070] = {duration=45,pvpdur=10,stun=true,type="DEBUFF",drcat="Disorient"}; -- Sap |
addon.spells[26866] = {duration=30,type="DEBUFF"}; -- Expose Armor |
addon.spells[3420] = {duration=12,type="DEBUFF"}; -- Crip Poison |
addon.spells[3421] = {duration=12,type="DEBUFF"}; -- Crip Poison 2 |
addon.spells[13220] = {duration=15,stacks=true,type="DEBUFF"}; -- Wound |
addon.spells[13228] = {duration=15,stacks=true,type="DEBUFF"}; -- Wound |
addon.spells[13229] = {duration=15,stacks=true,type="DEBUFF"}; -- Wound |
addon.spells[13230] = {duration=15,stacks=true,type="DEBUFF"}; -- Wound |
addon.spells[27283] = {duration=15,stacks=true,type="DEBUFF"}; -- Wound |
addon.spells[5763] = {duration=10,type="DEBUFF"}; -- Mind |
addon.spells[8694] = {duration=10,type="DEBUFF"}; -- Mind |
addon.spells[11400] = {duration=10,type="DEBUFF"}; -- Mind |
addon.spells[2835] = {duration=12,stacks=true,dot=true,type="DEBUFF"}; -- Deadly |
addon.spells[2837] = {duration=12,stacks=true,dot=true,type="DEBUFF"}; -- Deadly |
addon.spells[11357] = {duration=12,stacks=true,dot=true,type="DEBUFF"}; -- Deadly |
addon.spells[11358] = {duration=12,stacks=true,dot=true,type="DEBUFF"}; -- Deadly |
addon.spells[25347] = {duration=12,stacks=true,dot=true,type="DEBUFF"}; -- Deadly |
addon.spells[26969] = {duration=12,stacks=true,dot=true,type="DEBUFF"}; -- Deadly |
addon.spells[27282] = {duration=12,stacks=true,dot=true,type="DEBUFF"}; -- Deadly |
local addon = LibStub:GetLibrary("NaturCombat"); |
addon.spells[18288] = {cooldown=180,instant=true,type="CAST"}; -- Amp. Curse |
addon.spells[18708] = {duration=15,cooldown=900,type="BUFF"}; -- Fel Domination |
addon.spells[34939] = {duration=8,type="BUFF"}; -- Backlash |
addon.spells[18095] = {duration=10,type="BUFF"}; -- Nightfall |
addon.spells[1094] = {duration=15,dot=true,type="DEBUFF"}; -- Immolate |
addon.spells[7651] = {duration=5,dot=true,type="DEBUFF"}; -- Drain Life |
addon.spells[27221] = {duration=5,dot=true,type="DEBUFF"}; -- Drain Mana |
addon.spells[7648] = {duration=18,dot=true,type="DEBUFF"}; -- Corruption |
addon.spells[6217] = {duration=25,dot=true,type="DEBUFF"}; -- CoA |
addon.spells[18880] = {duration=30,dot=true,type="DEBUFF"}; -- Siphon Life |
addon.spells[17962] = {duration=3,type="DEBUFF"}; -- Death Coil |
addon.spells[6213] = {duration=20,pvpdur=10,type="DEBUFF"}; -- Fear |
addon.spells[17928] = {duration=8,type="DEBUFF"}; -- HoT |
addon.spells[18223] = {duration=12,type="DEBUFF"}; -- CoE |
addon.spells[11719] = {duration=30,pvpdur=10,type="DEBUFF"}; -- CoT |
local addon = LibStub:NewLibrary("NaturCombat",20080514); |
assert(addon,"NaturCombatTimers failed to load in 'NaturCombatTimers\addon\spells.lua' on line 1"); |
---------------------------------------------------------------------------------------------------- |
addon.spelldata = {}; -- lookup table used for data storage, stored by spellid |
addon.spellkeys = {}; -- lookup table used for spell names that default to a spellid |
addon.spellmeta = {}; |
addon.spellmeta.__newindex = function(tbl,key,value) |
local name = GetSpellInfo(key); |
if (not addon.spelldata[key]) then addon.spelldata[key] = value; end |
if (not addon.spellkeys[name]) then addon.spellkeys[name] = key; end |
end; |
addon.spellmeta.__index = function(tbl,key) |
local name,rank,icon,_,_,_,castTime = GetSpellInfo(key); |
if (not addon.spelldata[key]) then key = addon.spellkeys[name]; end |
local data = addon.spelldata[key] or {}; |
data.id, data.name, data.rank, data.icon, data.castTime = key, name, rank, icon, castTime/1000; |
return data; |
end; |
addon.spells = setmetatable({},addon.spellmeta); |
function addon:GetSpellData(id) |
if (id) then return addon.spells[id]; end |
end; |
---------------------------------------------------------------------------------------------------- |
-- RACIALS |
addon.spells[20600] = {duration=20,cooldown=180,type="BUFF"}; -- Perception |
addon.spells[7744] = {duration=5,cooldown=120,type="BUFF"}; -- Will of the Forsaken |
addon.spells[20594] = {duration=8,cooldown=180,type="BUFF"}; -- Stoneform |
addon.spells[26297] = {duration=10,cooldown=180,type="BUFF"}; -- Berseking |
addon.spells[28880] = {duration=15,cooldown=180,type="BUFF"}; -- Gift of the Naaru |
addon.spells[20549] = {duration=2,type="DEBUFF"}; -- War Stomp |
addon.spells[25467] = {duration=24,dot=true,type="DEBUFF"}; -- Devouring Plague |
addon.spells[25446] = {duration=15,dot=true,type="DEBUFF"}; -- Starshards |
-- Misc. |
addon.spells[5530] = {duration=3,stun=true,type="DEBUFF"}; -- Mace Stun |
local addon = LibStub:GetLibrary("NaturCombat"); |
assert(addon,"NaturCombat failed to load in 'NaturCombat\addon\generator.lua' on line 1"); |
addon.bar = LibStub:GetLibrary("GTB-1.0"); |
assert(addon.bar,"GTB-1.0 failed to load in 'NaturCombat\addon\generator.lua' on line 3"); |
addon.media = LibStub:GetLibrary("LibSharedMedia-3.0"); |
assert(addon.media, "LibSharedMedia-3.0 failed to load in 'NaturCombat\addon\generator.lua' on line 5"); |
---------------------------------------------------------------------------------------------------- |
addon.colors = {}; |
addon.colors["HOSTILECAST"] = {r = 1, g = 0, b = 0}; |
addon.colors["FRIENDLYCAST"] = {r = 0, g= 1, b = 0}; |
addon.colors["COOLDOWN"] = {r = 0, g = 0, b = 1}; |
addon.colors["HOSTILEBUFF"] = {r = 0.5, g = 0, b = 0.65}; |
addon.colors["FRIENDLYBUFF"] = {r = 1, g = 0, b = 1}; |
addon.colors["STUN"] = {r = 0.5, g = 0.2, b = 0.1}; |
addon.colors["DOT"] = {r = 0, g = 0.8, b = 0.8}; |
addon.colors["DEBUFF"] = {r = 0.8, g = 0.8, b = 0}; |
---------------------------------------------------------------------------------------------------- |
addon.media:Register("statusbar", "NaturGlaze", [[Interface\AddOns\NaturCombat\media\glaze]]); |
---------------------------------------------------------------------------------------------------- |
addon.media:Register("sound", "First Blood", [[Interface\AddOns\NaturCombat\media\sounds\firstblood.mp3]]); |
addon.media:Register("sound", "Dominating", [[Interface\AddOns\NaturCombat\media\sounds\dominating.mp3]]); |
addon.media:Register("sound", "Killing Spree", [[Interface\AddOns\NaturCombat\media\sounds\killingspree.mp3]]); |
addon.media:Register("sound", "Unstoppable", [[Interface\AddOns\NaturCombat\media\sounds\unstoppable.mp3]]); |
addon.media:Register("sound", "Monster Kill", [[Interface\AddOns\NaturCombat\media\sounds\monsterkill.mp3]]); |
addon.media:Register("sound", "Godlike", [[Interface\AddOns\NaturCombat\media\sounds\godlike.mp3]]); |
---------------------------------------------------------------------------------------------------- |
-- This is to deal with realm names from cross realm battlegroups |
function addon:StripName(name) |
name = string.match(name, "[^-]*"); |
return name; |
end |
---------------------------------------------------------------------------------------------------- |
local f = CreateFrame("Frame", nil, InterfaceOptionsFrame) |
f:SetScript("OnShow", function(self) LoadAddOn("NaturOptions"); self:SetScript("OnShow", nil) end); |
SlashCmdList["NaturCombat"] = function() |
if (LoadAddOn("NaturOptions")) then |
InterfaceOptionsFrame_OpenToFrame("NaturCombat"); |
end |
end; |
SLASH_NaturCombat1 = "/necb"; |
SLASH_NaturCombat2 = "/natur"; |
local addon = LibStub:GetLibrary("NaturCombat"); |
assert(addon,"NaturCombatTimers failed to load in 'NaturCombat\addon\parser.lua' on line 1"); |
LibStub:GetLibrary("LibWombat"):NewParser(addon); |
assert(addon.StartParsing,"LibWombat failed to load in 'NaturCombat\addon\parser.lua' on line 3"); |
NaturDB = NaturDB or {Height=20,Width=270,Scale=1,FontSize=15,MaxBars=10,Lock=true,Growth="UP",Invert=true,Texture="NaturGlaze",Cooldowns=true,Diminishing=true}; |
addon.factor = 1; |
local CPAura, KillCounter, KillTimer = false, 0; |
local expTime, activeDR = {}, {}; |
local CDTable = {}; |
---------------------------------------------------------------------------------------------------- |
addon:StartParsing("VARIABLES_LOADED", function() |
addon.group = addon.bar:RegisterGroup("NaturCombat", addon.media:Fetch("statusbar", NaturDB.Texture)); |
addon.group:SetScale(NaturDB.Scale); |
addon.group:SetWidth(NaturDB.Width); |
addon.group:SetHeight(NaturDB.Height); |
addon.group:SetDisplayGroup("NaturCombat"); -- This redirects every bar to this certain group. |
addon.group:SetAnchorVisible(NaturDB.Lock); |
addon.group:SetGroupFontSize(NaturDB.FontSize); |
addon.group:SetMaxBars(NaturDB.MaxBars); |
addon.group:SetBarGrowth(NaturDB.Growth); |
addon.group:SetInvert(NaturDB.Invert); |
addon.group:SetPoint("CENTER"); |
addon.group:RegisterOnFade(addon, "OnFade"); |
end); |
---------------------------------------------------------------------------------------------------- |
addon:StartParsing("PLAYER_ENTERING_WORLD", function() |
local _, z = IsInInstance(); |
if (z == "arena") then -- Player is in an arena, clean bars |
addon.group:UnregisterAllBars(); |
end |
end); |
---------------------------------------------------------------------------------------------------- |
addon:StartParsing("SPELL_AURA_APPLIED", function(when,what,srcGUID,srcName,srcFlags,dstGUID,dstName,dstFlags,...) |
local spell = addon:GetSpellData(...); |
if (dstGUID == UnitGUID("target") or dstGUID == UnitGUID("focus")) and (dstGUID ~= UnitGUID("player")) then |
if (spell) and (spell.duration) then |
-- Talents? |
if (spell.talent) then |
if (spell.talent[5] == select(2,UnitClass("player"))) then |
local _, _, _, _, rank = GetTalentInfo(spell.talent[1], spell.talent[2]); |
if (rank) and (rank > 0) then |
spell.duration = spell.talent[3] + rank * spell.talent[4]; |
end |
end |
end |
-- Set Bar Color |
local color; |
if (spell.type == "BUFF") then |
if (CombatLog_Object_IsA(dstFlags, COMBATLOG_FILTER_HOSTILE_PLAYERS)) then |
color = addon.colors["HOSTILEBUFF"]; |
elseif (CombatLog_Object_IsA(dstFlags, COMBATLOG_FILTER_FRIENDLY_UNITS)) then |
color = addon.colors["FRIENDLYBUFF"]; |
end |
elseif (spell.type == "DEBUFF") then |
if (spell.stun) then |
color = addon.colors["STUN"]; |
elseif (spell.dot) then |
color = addon.colors["DOT"]; |
else |
color = addon.colors["DEBUFF"]; |
end |
end |
-- PVP Duration? |
local duration = 1; |
local guid = strsub(dstGUID, 1 ,5); |
if (spell.pvpdur) and (bit.band(guid, 0x00F) == 0) then -- Player? |
duration = spell.pvpdur; |
else |
duration = spell.duration; |
end |
-- DR? |
if (spell.drcat) and (NaturDB.Diminishing) then |
addon:ApplyDiminish(spell.id, dstName, dstGUID); |
duration = duration * addon.factor; |
end |
-- Combo? |
if (spell.combo) then CPAura = true; end |
local text = spell.name .. " - " .. addon:StripName(dstName); |
addon.group:RegisterBar(dstGUID..spell.id, text, duration, nil, spell.icon, color.r, color.g, color.b); |
end |
end |
end); |
---------------------------------------------------------------------------------------------------- |
-- Deal with cooldowns and instant casts |
-- Add cooldown to the CDTable so we can remove/show on target change |
addon:StartParsing("SPELL_CAST_SUCCESS", function(when,what,srcGUID,srcName,srcFlags,dstGUID,dstName,dstFlags,...) |
local spell = addon:GetSpellData(...); |
if (srcGUID == UnitGUID("player")) then return; end |
if (srcGUID == UnitGUID("target")) then --We don't want to show cooldowns for our focus.. maybe change this if someone requests it. |
if (spell) and (spell.cooldown) then |
if (spell.type == "CAST") and (spell.instant) then |
if (spell.duration) then |
local color; |
if (CombatLog_Object_IsA(srcFlags, COMBATLOG_FILTER_HOSTILE_PLAYERS)) then |
color = addon.colors["HOSTILEBUFF"]; |
elseif (CombatLog_Object_IsA(srcFlags, COMBATLOG_FILTER_FRIENDLY_UNITS)) then |
color = addon.colors["FRIENDLYBUFF"]; |
end |
local text = spell.name .. " - " .. addon:StripName(srcName); |
addon.group:RegisterBar(srcGUID..spell.id, text, spell.duration, nil, spell.icon, color.r, color.g, color.b); |
end |
if (NaturDB.Cooldowns) then |
local color = addon.colors["COOLDOWN"]; |
local text = spell.name .. " [CD] - " .. addon:StripName(srcName); |
addon.group:RegisterBar(srcGUID..spell.id.."CD", text, spell.cooldown, nil, spell.icon, color.r, color.g, color.b); |
--Add to CDTable |
CDTable[srcGUID..spell.id.."CD"] = {srcGUID,spell.cooldown}; |
end |
elseif (spell.type == "BUFF") then |
if (NaturDB.Cooldowns) then |
local color = addon.colors["COOLDOWN"]; |
local text = spell.name .. " [CD] - " .. addon:StripName(srcName); |
addon.group:RegisterBar(srcGUID..spell.id.."CD", text, spell.cooldown, nil, spell.icon, color.r, color.g, color.b); |
-- Add to DB |
CDTable[srcGUID..spell.id.."CD"] = {srcGUID,spell.cooldown}; |
end |
end |
end |
end |
end); |
---------------------------------------------------------------------------------------------------- |
addon:StartParsing("SPELL_AURA_REMOVED", function(when,what,srcGUID,srcName,srcFlags,dstGUID,dstName,dstFlags,...) |
local spell = addon:GetSpellData(...); |
if (spell) and (spell.duration) then |
if (spell.combo) then CPAura = false; end |
if (spell.drcat) then |
addon:RemoveDiminish(spell.id, dstName, dstGUID); |
end |
addon.group:UnregisterBar(dstGUID..spell.id); |
end |
end); |
---------------------------------------------------------------------------------------------------- |
addon:StartParsing("SPELL_AURA_DISPELLED", function(when,what,srcGUID,srcName,srcFlags,dstGUID,dstName,dstFlags,...) |
local spell = addon:GetSpellData(select(12, ...)); |
if (spell) and (spell.duration) then |
addon.group:UnregisterBar(dstGUID..spell.id); |
end |
end); |
---------------------------------------------------------------------------------------------------- |
addon:StartParsing("SPELL_INTERRUPT", function(when,what,srcGUID,srcName,srcFlags,dstGUID,dstName,dstFlags,...) |
local spell = addon:GetSpellData(select(12, ...)); |
if (spell) and (spell.duration) then |
addon.group:UnregisterBar(dstGUID..spell.id); |
end |
end); |
---------------------------------------------------------------------------------------------------- |
addon:StartParsing("SPELL_MISSED", function(when,what,srcGUID,srcName,srcFlags,dstGUID,dstName,dstFlags,...) |
local spell = addon:GetSpellData(...); |
if (spell) and (spell.duration) then |
addon.group:UnregisterBar(dstGUID..spell.id); |
end |
end); |
---------------------------------------------------------------------------------------------------- |
addon:StartParsing("SPELL_AURA_APPLIED_DOSE", function(when,what,srcGUID,srcName,srcFlags,dstGUID,dstName,dstFlags,...) |
local spell = addon:GetSpellData(...); |
local stack = select(5, ...); |
if (dstGUID == UnitGUID("player")) then return; end |
if (dstGUID == UnitGUID("target")) or (dstGUID == UnitGUID("focus")) then |
if (spell) and (spell.stacks) and (spell.duration) then |
local text = "(" .. stack .. ") " .. spell.name .. " - " .. addon:StripName(dstName); |
addon.group:SetBarText(dstGUID..spell.id, text); |
addon.group:SetTime(dstGUID..spell.id, spell.duration); |
end |
end |
end); |
---------------------------------------------------------------------------------------------------- |
addon:StartParsing("SPELL_AURA_REMOVED_DOSE", function(when,what,srcGUID,srcName,srcFlags,dstGUID,dstName,dstFlags,...) |
local spell = addon:GetSpellData(...); |
local stack = select(5, ...); |
if (dstGUID == UnitGUID("player")) then return; end |
if (dstGUID == UnitGUID("target")) or (dstGUID == UnitGUID("focus")) then |
if (spell) and (spell.stacks) and (spell.duration) then |
local text = "(" .. stack .. ") " .. spell.name .. " - " .. addon:StripName(dstName); |
addon.group:SetBarText(dstGUID..spell.id, text); |
end |
end |
end); |
---------------------------------------------------------------------------------------------------- |
addon:StartParsing("UNIT_DIED", function(when,what,srcGUID,srcName,srcFlags,dstGUID,dstName,dstFlags,...) |
if (dstGUID == UnitGUID("player")) then return; end |
for k, v in pairs(addon.spelldata) do |
addon.group:UnregisterBar(dstGUID..k); |
addon.group:UnregisterBar(dstGUID..k.."CD"); |
if (addon.spelldata[k].drcat) then |
addon.group:UnregisterBar(dstGUID..addon.spelldata[k].drcat); |
end |
end |
end); |
---------------------------------------------------------------------------------------------------- |
addon:StartParsing("UNIT_SPELLCAST_START", function(unitid, spell, ...) |
if (UnitGUID(unitid) == UnitGUID("player")) then return; end |
if (unitid == "target" and spell) or (unitid == "focus" and spell) then |
local color; |
if (UnitReaction(unitid, "player") < 4) then -- Hostile |
color = addon.colors["HOSTILECAST"]; |
else |
color = addon.colors["FRIENDLYCAST"]; |
end |
local icon, sTime, eTime = select(4, UnitCastingInfo(unitid)); |
local text = spell .. " - " .. addon:StripName(UnitName(unitid)); |
sTime, eTime = sTime/1000, eTime/1000; |
addon.group:RegisterBar(UnitGUID(unitid).."cast", text, eTime - sTime, nil, icon, color.r, color.g, color.b); |
end |
end); |
addon:StartParsing("UNIT_SPELLCAST_STOP", function(unitid, ...) -- This is suppose to return the spellname yet fails to do so.. |
if (UnitGUID(unitid) == UnitGUID("player")) then return; end |
if (unitid == "target") or (unitid == "focus") then |
addon.group:UnregisterBar(UnitGUID(unitid).."cast"); |
end |
end); |
---------------------------------------------------------------------------------------------------- |
addon:StartParsing("UNIT_SPELLCAST_CHANNEL_START", function(unitid, spell, ...) |
if (UnitGUID(unitid) == UnitGUID("player")) then return; end |
if (unitid == "target" and spell) or (unitid == "focus" and spell) then |
local color; |
if (UnitReaction(unitid, "player") < 4) then -- Hostile |
color = addon.colors["HOSTILECAST"]; |
else |
color = addon.colors["FRIENDLYCAST"]; |
end |
local icon, sTime, eTime = select(4, UnitChannelInfo(unitid)); |
local text = spell .. " - " .. addon:StripName(UnitName(unitid)); |
sTime, eTime = sTime/1000, eTime/1000; |
addon.group:RegisterBar(UnitGUID(unitid).."channel", text, eTime - sTime, nil, icon, color.r, color.g, color.b); |
end |
end); |
---------------------------------------------------------------------------------------------------- |
addon:StartParsing("UNIT_SPELLCAST_CHANNEL_STOP", function(unitid, spell, ...) |
if (UnitGUID(unitid) == UnitGUID("player")) then return; end |
if (unitid == "target") or (unitid == "focus") then |
addon.group:UnregisterBar(UnitGUID(unitid).."channel"); |
end |
end); |
---------------------------------------------------------------------------------------------------- |
-- NOTE: There has to be a better way to deal with combo point abilites :/ |
addon:StartParsing("UNIT_AURA", function(unitid) |
if (UnitGUID(unitid) == UnitGUID("player")) then return; end |
if (unitid == "target") or (unitid == "focus") then |
local name, duration; |
if (not CPAura) then return; end |
local id = 0; |
while (true) do |
id = id + 1; |
name, _, _, _, _, duration = UnitDebuff(unitid, id); |
if (not name) then break; end |
if (addon.spellkeys[name]) then |
if (addon.spelldata[addon.spellkeys[name]].combo) and (addon.spelldata[addon.spellkeys[name]].duration) then |
local text = name .. " - " .. addon:StripName(UnitName(unitid)); |
if (not duration) then |
duration = addon.spelldata[addon.spellkeys[name]].duration; |
end |
addon.group:SetTime(UnitGUID(unitid)..addon.spelldata[addon.spellkeys[name]].id, duration); |
CPAura = false; |
end |
end |
end |
end |
end); |
---------------------------------------------------------------------------------------------------- |
addon:StartParsing("PLAYER_TARGET_CHANGED", function() |
-- Remove CD's from old target |
for id, cooldown in pairs(CDTable) do |
if (UnitGUID("target") ~= cooldown[1]) then |
addon.group:HideBar(id); |
else |
addon.group:ShowBar(id, cooldown[2]); |
end |
end |
end); |
---------------------------------------------------------------------------------------------------- |
addon:StartParsing("PARTY_KILL", function(when,what,srcGUID,srcName,srcFlags,dstGUID,dstName,dstFlags,...) |
local guid = strsub(dstGUID, 1, 5); |
if (srcGUID == UnitGUID("player")) and (bit.band(guid, 0x00F) == 0) then |
if (not KillTimer) or (GetTime() - KillTimer > 60) then |
PlaySoundFile(addon.media:Fetch("sound", "First Blood")); |
KillCounter = 0; |
elseif (GetTime() - KillTimer <= 60) then |
KillCounter = KillCounter + 1 |
if (KillCounter == 1) then |
PlaySoundFile(addon.media:Fetch("sound", "Dominating")); |
elseif (KillCounter == 2) then |
PlaySoundFile(addon.media:Fetch("sound", "Killing Spree")); |
elseif (KillCounter == 3) then |
PlaySoundFile(addon.media:Fetch("sound", "Unstoppable")); |
elseif (KillCounter == 4) then |
PlaySoundFile(addon.media:Fetch("sound", "Monster Kill")); |
elseif (KillCounter > 4) then |
PlaySoundFile(addon.media:Fetch("sound", "Godlike")); |
end |
end |
KillTimer = GetTime(); |
end |
end); |
---------------------------------------------------------------------------------------------------- |
-- TODO: Look over DR code and improve it. |
-- Massive thanks to Shadowd the author of DR Tracker. |
function addon:ApplyDiminish(spellID, dstName, dstGUID) |
local spell = addon:GetSpellData(spellID); |
local id = dstGUID .. spell.drcat; |
local time = GetTime(); |
local diminished = 100; |
if (expTime[id] and expTime[id] >= time) then |
diminished = self:GetDR(activeDR[id]); |
addon.factor = select(3, self:GetDR(activeDR[id])); |
activeDR[id] = diminished; |
expTime[id] = GetTime() + 15; |
addon.group:UnregisterBar(id); |
elseif (not expTime[id] or expTime[id] <= time) then |
activeDR[id] = diminished; |
addon.factor = 1; |
expTime[id] = GetTime() + 15; |
end |
end; |
---------------------------------------------------------------------------------------------------- |
function addon:RemoveDiminish(spellId, dstName, dstGUID) |
local spell = addon:GetSpellData(spellId); |
local id = dstGUID .. spell.drcat; |
if (activeDR[id]) then |
local text = spell.name .. " [".. spell.drcat .." |cffff2020DR " .. select(2,addon:GetDR(activeDR[id])) .. "/3|r] - " .. addon:StripName(dstName); |
local color = addon.colors["COOLDOWN"]; |
addon.group:RegisterBar(id, text, 15, nil, spell.icon, color.r, color.g, color.b); |
end |
expTime[id] = GetTime() + 15; |
end; |
---------------------------------------------------------------------------------------------------- |
function addon:GetDR(dr) |
if (dr == 100) then |
return 50, 1, 0.5; |
elseif (dr == 50) then |
return 25, 2, 0.25; |
elseif (dr == 25) then |
return 0, "Immune! 3", 0; |
end |
end; |
---------------------------------------------------------------------------------------------------- |
function addon:OnFade(barid) |
if (CDTable[barid]) then |
CDTable[barid] = nil; |
end |
end; |