WoWInterface SVN NaturCombatTimers

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 23 to Rev 24
    Reverse comparison

Rev 23 → Rev 24

trunk/NaturCombat/NaturCombat.toc
1,9 → 1,9
## Interface: 20400
## Title: NaturCombat
## Version: 9.0BETA3
## Version: wowi:revision
## Author: Macca, Beladona
## Notes: Enemy cast bars for cooldowns, buffs, debuffs and casts for both pvp and pve
## OptionalDeps: LibStub, LibWombat, GTB-1.0, LibSharedMedia-3.0
## OptionalDeps: LibStub, LibWombat, NaturGTB, LibSharedMedia-3.0
## SavedVariables: NaturDB
 
embed\LibStub\LibStub.lua
12,15 → 12,5
embed\LibSharedMedia-3.0\LibSharedMedia-3.0.lua
 
addon\spells.lua
addon\spells\Druid.lua
addon\spells\Rogue.lua
addon\spells\Priest.lua
addon\spells\Paladin.lua
addon\spells\Hunter.lua
addon\spells\Shaman.lua
addon\spells\Mage.lua
addon\spells\Warlock.lua
addon\spells\Warrior.lua
 
addon\generator.lua
addon\parser.lua
\ No newline at end of file
trunk/NaturCombat/addon/parser.lua
1,353 → 1,464
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,Sounds=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 = addon.colors["GREY"];
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? only on target.
if (dstGUID == UnitGUID("target")) and (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(...);
--Quick fix for refreshing spells until 2.4.3 SPELL_AURA_REFRESH
if (spell) and (spell.duration) then
if (dstGUID == UnitGUID("target") or dstGUID == UnitGUID("focus")) and (dstGUID ~= UnitGUID("player")) then
addon.group:SetTime(dstGUID..spell.id, spell.duration);
end
end
-----------
if (spell.special) and (srcGUID == UnitGUID("player")) then -- show this even tho the player casted it.
local color = addon.colors["FRIENDLYBUFF"];
local text = spell.name .. " - " .. srcName;
addon.group:RegisterBar(srcGUID..spell.id, text, spell.duration, nil, spell.icon, color.r, color.g, color.b);
end
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
CDTable[dstGUID..k.."CD"] = nil;
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) and (NaturDB.Sounds) 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;
\ No newline at end of file +local addon = LibStub("NaturCombat"); -- Get our library +LibStub("LibWombat"):NewParser(addon); -- Set addon as our parser for Wombat +---------------------------------------------------------------------------------------------------- +-- START PARSING +---------------------------------------------------------------------------------------------------- +addon:StartParsing("VARIABLES_LOADED", function() + -- Wipe saved variables of the old beta. + local ver = GetAddOnMetadata("NaturCombat", "Version"); + if (ver ~= NaturDB.Version) then + NaturDB = addon.default; + end + -- Check to see if the user has chosen to display separate groups or a single one. + addon.groups["NATUR"] = addon:CreateBarGroup("NaturCombat"); + for name, group in pairs(addon.bargroups) do + addon.groups[name] = addon:CreateBarGroup(group); + if (not NaturDB.Groups) then + addon.groups[name]:SetDisplayGroup("NaturCombat"); + addon.groups[name]:SetAnchorVisible(false); + else + addon.groups["NATUR"]:SetAnchorVisible(false); + end + end +end); +---------------------------------------------------------------------------------------------------- +-- PLAYER_ENTERING_WORLD +-- Wipe all bars when entering an arena game. +---------------------------------------------------------------------------------------------------- +addon:StartParsing("PLAYER_ENTERING_WORLD", function() + local _, zone = IsInInstance(); + if (zone == "arena") then -- Player is in an arena match + for anchor, _ in pairs(addon.groups) do + addon.groups[anchor]:UnregisterAllBars(); -- Delete ALL Bars + end + for id, _ in pairs(addon.CDTable) do + addon.CDTable[id] = nil; -- Remove an active cooldown from the cooldown table + end + end +end); +---------------------------------------------------------------------------------------------------- +-- SPELL_AURA_APPLIED +-- Create Timer's for abilites from our spell DB +---------------------------------------------------------------------------------------------------- +addon:StartParsing("SPELL_AURA_APPLIED", function(when, what, srcGUID, srcName, srcFlags, dstGUID, dstName, dstFlags, ...) + local spell = addon:GetSpellData(...); -- Get spelldata on the spell applied. + local auraType = select(4, ...); + -- Check to see if we have 'only track our debuffs' option active + if (NaturDB.Track) then return; end -- Enabled so don't do anything in this function + if (UnitGUID("player") == dstGUID) then return; end + if (NaturDB.TargetFocus and UnitGUID("target") ~= dstGUID and UnitGUID("focus") ~= dstGUID) then return; end + if (spell and spell.duration) then -- Check that this spell is currently in our spell DB (spells.lua) + --Does this debuff get affected by talents? This is a PLAYER only feature + -- To understand the numbers - 1,2,3,4,5 = Tree #, Talent number in Tree, Original Duration of spell, Modifier of the duration, Class + 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 + -- Does this spell have a different duration on a PVP Enabled player? + local duration = 0; + if (spell.pvpdur and (bit.band(strsub(dstGUID, 1, 5), 0x00F) == 0)) then -- Is this target a player? And does this spell have a pvp duration? + duration = spell.pvpdur; + else + duration = spell.duration; + end + -- TODO: Diminishing Returns + --Combo point ability? + if (spell.combo) then CPAura = true; end + local barID = dstGUID .. spell.id; + local text = spell.name .. " - " .. addon:StripName(dstName); + local color = NaturDB.Colors["GREY"]; + local anchor = "DEBUFFS"; + if (auraType == "BUFF") then + if (CombatLog_Object_IsA(dstFlags, COMBATLOG_FILTER_HOSTILE_PLAYERS)) then + color = NaturDB.Colors["HOSTILEBUFF"]; + anchor = "HOSTILEGAIN"; + elseif (CombatLog_Object_IsA(dstFlags, COMBATLOG_FILTER_FRIENDLY_UNITS)) then + color = NaturDB.Colors["FRIENDLYBUFF"]; + anchor = "FRIENDLYGAIN"; + end + elseif (auraType == "DEBUFF") then + anchor = "DEBUFFS"; + if (spell.stun) then + color = NaturDB.Colors["STUN"]; + elseif (spell.dot) then + color = NaturDB.Colors["DOT"]; + else + color = NaturDB.Colors["DEBUFF"]; + end + end + local ticon = nil; + if (NaturDB.Icon) then -- Are we shoing Target and Focus icons? + if (dstGUID == UnitGUID("target")) then + ticon = addon.media:Fetch("icon", "Target"); + elseif (dstGUID == UnitGUID("focus")) then + ticon = addon.media:Fetch("icon", "Focus"); + end + end + addon.groups[anchor]:RegisterBar(barID, text, duration, nil, spell.icon, ticon, color.r, color.g, color.b); + end +end); +---------------------------------------------------------------------------------------------------- +-- SPELL_CAST_SUCCESS +-- Deal with Instant casts and also Cooldowns +---------------------------------------------------------------------------------------------------- +addon:StartParsing("SPELL_CAST_SUCCESS", function(when, what, srcGUID, srcName, srcFlags, dstGUID, dstName, dstFlags, ...) + local spell = addon:GetSpellData(...); + if (NaturDB.Track) then return end; + if (spell and spell.duration) then + if (NaturDB.TargetFocus and UnitGUID("target") == dstGUID or UnitGUID("focus") == dstGUID) then + -- No way to determine anchor + for k, v in pairs(addon.groups) do + addon.groups[k]:SetTime(dstGUID..spell.id, spell.duration); + end + end + end + if (spell.special and srcGUID == UnitGUID("player")) then -- show timer for player + local barID = srcGUID .. spell.id; + local color = NaturDB.Colors["FRIENDLYBUFF"]; + local text = spell.name .. " - " .. srcName; + addon.groups["FRIENDLYGAIN"]:RegisterBar(barID, text, spell.duration, nil, spell.icon, nil, color.r, color.g, color.b); + end + if (UnitGUID("player") == srcGUID) then return; end + if (spell and spell.cooldown) then -- Track CDS of current target/focus + if (NaturDB.Cooldowns) then + local barID = srcGUID .. spell.id .. "CD"; + local color = NaturDB.Colors["COOLDOWN"]; + local text = spell.name .. " [CD] - " .. addon:StripName(srcName); + local ticon = nil; + if (NaturDB.Icon) then + if (srcGUID == UnitGUID("target")) then + ticon = addon.media:Fetch("icon", "Target"); + elseif (srcGUID == UnitGUID("focus")) then + ticon = addon.media:Fetch("icon", "Focus"); + end + end + if (NaturDB.TargetFocus and UnitGUID("target") ~= srcGUID and UnitGUID("focus") ~= srcGUID) then + addon.CDTable[barID] = {srcGUID, spell.cooldown}; + addon.groups["COOLDOWNS"]:RegisterBar(barID, text, spell.cooldown, nil, spell.icon, ticon, color.r, color.g, color.b); + addon.groups["COOLDOWNS"]:HideBar(barID); + else + addon.CDTable[barID] = {srcGUID, spell.cooldown}; + addon.groups["COOLDOWNS"]:RegisterBar(barID, text, spell.cooldown, nil, spell.icon, ticon, color.r, color.g, color.b); + end + end + end +end); +---------------------------------------------------------------------------------------------------- +-- SPELL_AURA_REMOVED +-- Remove a bar with an aura is applied +---------------------------------------------------------------------------------------------------- +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 + for k, v in pairs(addon.groups) do + addon.groups[k]:UnregisterBar(dstGUID .. spell.id); + end + end +end); +---------------------------------------------------------------------------------------------------- +-- SPELL_INTERRUPT +-- Deal with interupt abilites +---------------------------------------------------------------------------------------------------- +addon:StartParsing("SPELL_INTERRUPT", function(when, what, srcGUID, srcName, srcFlags, dstGUID, dstName, dstFlags, ...) + local inter = addon:GetSpellData(...); + local spell = addon:GetSpellData(select(12, ...)); + if (NaturDB.Track) then return; end + if (UnitGUID("player") == dstGUID) then return; end + if (NaturDB.TargetFocus and UnitGUID("target") ~= dstGUID and UnitGUID("focus") ~= dstGUID) then return; end + if (inter and inter.interrupt) then + local barID = dstGUID .. inter.id; + local color = NaturDB.Colors["DEBUFF"]; + local text = inter.name .. " - " .. addon:StripName(dstName); + local ticon = nil; + if (NaturDB.Icon) then + if (dstGUID == UnitGUID("target")) then + ticon = addon.media:Fetch("icon", "Target"); + elseif (dstGUID == UnitGUID("focus")) then + ticon = addon.media:Fetch("icon", "Focus"); + end + end + addon.groups["DEBUFFS"]:RegisterBar(barID, text, inter.duration, nil, inter.icon, ticon, color.r, color.g, color.b); + end + if (spell and spell.duration) then + for k, v in pairs(addon.groups) do + addon.groups[k]:UnregisterBar(dstGUID .. spell.id); + end + end +end); +---------------------------------------------------------------------------------------------------- +-- SPELL_AURA_APPLIED_DOSE +-- Deal with abilites which stack +---------------------------------------------------------------------------------------------------- +addon:StartParsing("SPELL_AURA_APPLIED_DOSE", function(when, what, srcGUID, srcName, srcFlags, dstGUID, dstName, dstFlags, ...) + local spell = addon:GetSpellData(...); + local stack = select(5, ...); + local auraType = select(4, ...); + if (UnitGUID("player") == dstGUID) then return; end + if (NaturDB.TargetFocus and UnitGUID("target") ~= dstGUID and UnitGUID("focus") ~= dstGUID) then return; end + if (NaturDB.Track) then return; end + if (spell and spell.duration and spell.stacks) then + local barID = dstGUID .. spell.id; + local text = "(" .. stack .. ") " .. spell.name .. " - " .. addon:StripName(dstName); + local anchor; + if (auraType == "BUFF") then + if (CombatLog_Object_IsA(dstFlags, COMBATLOG_FILTER_HOSTILE_PLAYERS)) then + anchor = "HOSTILEGAIN"; + elseif (CombatLog_Object_IsA(dstFlags, COMBATLOG_FILTER_FRIENDLY_UNITS)) then + anchor = "FRIENDLYGAIN"; + end + elseif (auraType == "DEBUFF") then + anchor = "DEBUFFS"; + end + addon.groups[anchor]:SetBarText(barID, text); + addon.groups[anchor]:SetTime(barID, spell.duration); + end +end); +---------------------------------------------------------------------------------------------------- +-- SPELL_AURA_REMOVED_DOSE +---------------------------------------------------------------------------------------------------- +addon:StartParsing("SPELL_AURA_REMOVED_DOSE", function(when, what, srcGUID, srcName, srcFlags, dstGUID, dstName, dstFlags, ...) + local spell = addon:GetSpellData(...); + local stack = select(5, ...); + local auraType = select(4, ...); + if (UnitGUID("player") == dstGUID) then return; end + if (NaturDB.TargetFocus and UnitGUID("target") ~= dstGUID and UnitGUID("focus") ~= dstGUID) then return; end + if (NaturDB.Track) then return; end + if (spell and spell.duration and spell.stacks) then + local barID = dstGUID .. spell.id; + local text = "(" .. stack .. ") " .. spell.name .. " - " .. addon:StripName(dstName); + local anchor; + if (auraType == "BUFF") then + if (CombatLog_Object_IsA(dstFlags, COMBATLOG_FILTER_HOSTILE_PLAYERS)) then + anchor = "HOSTILEGAIN"; + elseif (CombatLog_Object_IsA(dstFlags, COMBATLOG_FILTER_FRIENDLY_UNITS)) then + anchor = "FRIENDLYGAIN"; + end + elseif (auraType == "DEBUFF") then + anchor = "DEBUFFS"; + end + addon.groups[anchor]:SetBarText(barID, text); + end +end); +---------------------------------------------------------------------------------------------------- +-- UNIT_DIED +-- Delete all bars we had assoiciated with the unit who died +---------------------------------------------------------------------------------------------------- +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 + for a, b in pairs(addon.groups) do + addon.groups[a]:UnregisterBar(dstGUID..k); + addon.groups[a]:UnregisterBar(dstGUID..k.."CD"); + addon.CDTable[dstGUID..k.."CD"] = nil; + end + end +end); +---------------------------------------------------------------------------------------------------- +-- PLAYER_TARGET_CHANGED +---------------------------------------------------------------------------------------------------- +addon:StartParsing("PLAYER_TARGET_CHANGED", function() + for k, v in pairs(addon.CDTable) do + if (UnitGUID("target") ~= v[1]) then + addon.groups["COOLDOWNS"]:HideBar(k); + else + addon.groups["COOLDOWNS"]:ShowBar(k, v[2]); + end + end +end); +---------------------------------------------------------------------------------------------------- +-- PLAYER_FOCUS_CHANGED +---------------------------------------------------------------------------------------------------- +addon:StartParsing("PLAYER_FOCUS_CHANGED", function() + for k, v in pairs(addon.CDTable) do + if (UnitGUID("focus") ~= v[1]) then + addon.groups["COOLDOWNS"]:HideBar(k); + else + addon.groups["COOLDOWNS"]:ShowBar(k, v[2]); + end + end +end); +---------------------------------------------------------------------------------------------------- +-- PARTY_KILL +-- When you score a killing blow +---------------------------------------------------------------------------------------------------- +addon:StartParsing("PARTY_KILL", function(when, what, srcGUID, srcName, srcFlags, dstGUID, dstName, dstFlags, ...) + if (srcGUID == UnitGUID("player") and (bit.band(strsub(dstGUID, 1, 5), 0x00F) == 0) and NaturDB.Sounds) then + if (not addon.killtimer) or (GetTime() - addon.killtimer > 60) then + PlaySoundFile(addon.media:Fetch("sound", "First Blood")); + addon.killcounter = 0; + elseif (GetTime() - addon.killtimer <= 60) then + addon.killcounter = addon.killcounter + 1 + if (addon.killcounter == 1) then + PlaySoundFile(addon.media:Fetch("sound", "Dominating")); + elseif (addon.killcounter == 2) then + PlaySoundFile(addon.media:Fetch("sound", "Killing Spree")); + elseif (addon.killcounter == 3) then + PlaySoundFile(addon.media:Fetch("sound", "Unstoppable")); + elseif (addon.killcounter == 4) then + PlaySoundFile(addon.media:Fetch("sound", "Monster Kill")); + elseif (addon.killcounter > 4) then + PlaySoundFile(addon.media:Fetch("sound", "Godlike")); + end + end + addon.killtimer = GetTime(); + end +end); +---------------------------------------------------------------------------------------------------- +-- UNIT_AURA +---------------------------------------------------------------------------------------------------- +addon:StartParsing("UNIT_AURA", function(unitid) + if (UnitGUID(unitid) == UnitGUID("player")) then return; end + if (NaturDB.TargetFocus and UnitGUID("target") ~= dstGUID and UnitGUID("focus") ~= dstGUID) then return; end + if (not NaturDB.Track) then -- Deal with normal player combo point abilites + if (not CPAura) then return; end + local id = 0; + while (true) do + id = id + 1; + local name, _, _, _, _, duration = UnitDebuff(unitid, id); + if (not name) then return; end + local keys, data = addon.spellkeys, addon.spelldata; + if (keys[name]) then + if (data[keys[name]].combo and data[keys[name]].duration) then + if (not duration) then duration = data[keys[name]].duration; end + addon.groups["DEBUFFS"]:SetTime(UnitGUID(unitid)..data[keys[name]].id, duration); + CPAura = false; + end + end + end + else -- Track our stuff + local id = 0; + while (true) do + id = id + 1; + local keys, data = addon.spellkeys, addon.spelldata; + -- BUFFS + local buffName, _, buffIcon, buffCount, buffDuration = UnitBuff(unitid, id); + if (not buffName) then return; end + if (buffName and buffDuration) then + if (keys[buffName]) then -- This buff is in our database + local barID = UnitGUID(unitid) .. data[keys[buffName]].id; + -- Check that we don't already have a timer for this ability + if (addon.timers[barID]) then return; end + local text = buffName .. " - " .. addon:StripName(UnitName(unitid)); + local ticon = nil; + local color = NaturDB.Colors["FRIENDLYBUFF"]; + if (NaturDB.Icon) then + if (unitid == "target") then + ticon = addon.media:Fetch("icon", "Target"); + elseif (unitid == "focus") then + ticon = addon.media:Fetch("icon", "Focus"); + end + end + addon.groups["FRIENDLYGAIN"]:RegisterBar(barID, text, buffDuration, nil, buffIcon, ticon, color.r, color.g, color.b); + addon.timers[barID] = buffName; + end + end + -- DEBUFFS + local debuffName, _, debuffIcon, debuffStack, _, debuffDuration = UnitDebuff(unitid, id); + if (not debuffName) then return; end + if (debuffName and debuffDuration) then + if (keys[debuffName]) then + local barID = UnitGUID(unitid) .. data[keys[debuffName]].id; + if (addon.timers[barID]) then return end; + local text = debuffName .. " - " .. addon:StripName(UnitName(unitid)); + local ticon = nil; + local color = NaturDB.Colors["DEBUFF"]; + if (data[keys[debuffName]].stun) then + color = NaturDB.Colors["STUN"]; + elseif (data[keys[debuffName]].dot) then + color = NaturDB.Colors["DOT"]; + end + if (NaturDB.Icon) then + if (unitid == "target") then + ticon = addon.media:Fetch("icon", "Target"); + elseif (unitid == "focus") then + ticon = addon.media:Fetch("icon", "Focus"); + end + end + addon.groups["DEBUFFS"]:RegisterBar(barID, text, debuffDuration, nil, debuffIcon, ticon, color.r, color.g, color.b); + addon.timers[barID] = debuffName; + end + end + end + end +end); +---------------------------------------------------------------------------------------------------- +-- UNIT_SPELLCAST_START +---------------------------------------------------------------------------------------------------- +addon:StartParsing("UNIT_SPELLCAST_START", function(unitid, spell, ...) + if (UnitGUID(unitid) == UnitGUID("player")) then return; end + if (not NaturDB.Casting) then return; end + if (NaturDB.Casting and unitid ~= "target" and unitid ~= "focus") then return; end + local color = NaturDB.Colors["GREY"]; + local anchor = "FRIENDLYCAST"; + if (UnitReaction(unitid, "player") < 4) then -- Hostile Player + color = NaturDB.Colors["HOSTILECAST"]; + anchor = "HOSTILECAST"; + else + color = NaturDB.Colors["FRIENDLYCAST"]; + anchor = "FRIENDLYCAST"; + end + local barID = UnitGUID(unitid) .. "Cast"; + local icon, sTime, eTime = select(4, UnitCastingInfo(unitid)); + sTime, eTime = sTime / 1000, eTime / 1000; + local text = spell .. " - " .. addon:StripName(UnitName(unitid)); + local ticon = nil; + if (NaturDB.Icon) then + if (unitid == "target") then + ticon = addon.media:Fetch("icon", "Target"); + elseif (unitid == "focus") then + ticon = addon.media:Fetch("icon", "Focus"); + end + end + addon.groups[anchor]:RegisterBar(barID, text, eTime - sTime, nil, icon, ticon, color.r, color.g, color.b); +end); +---------------------------------------------------------------------------------------------------- +-- UNIT_SPELLCAST_STOP +---------------------------------------------------------------------------------------------------- +addon:StartParsing("UNIT_SPELLCAST_STOP", function(unitid) -- This is meant to return the spell and rank aswell according to the wiki + if (NaturDB.Casting and unitid ~= "target" and unitid ~= "focus") then return; end + addon.groups["FRIENDLYCAST"]:UnregisterBar(UnitGUID(unitid).."Cast"); + addon.groups["HOSTILECAST"]:UnregisterBar(UnitGUID(unitid).."Cast"); +end); +---------------------------------------------------------------------------------------------------- +-- UNIT_SPELLCAST_CHANNEL_START +---------------------------------------------------------------------------------------------------- +addon:StartParsing("UNIT_SPELLCAST_CHANNEL_START", function(unitid, spell, ...) + if (UnitGUID(unitid) == UnitGUID("player")) then return; end + if (not NaturDB.Casting) then return; end + if (NaturDB.Casting and unitid ~= "target" and unitid ~= "focus") then return; end + local color = NaturDB.Colors["GREY"]; + local anchor = "FRIENDLYCAST"; + if (UnitReaction(unitid, "player") < 4) then -- Hostile Player + color = NaturDB.Colors["HOSTILECAST"]; + anchor = "HOSTILECAST"; + else + color = NaturDB.Colors["FRIENDLYCAST"]; + anchor = "FRIENDLYCAST"; + end + local barID = UnitGUID(unitid) .. "Channel"; + local icon, sTime, eTime = select(4, UnitChannelInfo(unitid)); + sTime, eTime = sTime / 1000, eTime / 1000; + local text = spell .. " - " .. addon:StripName(UnitName(unitid)); + local ticon = nil; + if (NaturDB.Icon) then + if (unitid == "target") then + ticon = addon.media:Fetch("icon", "Target"); + elseif (unitid == "focus") then + ticon = addon.media:Fetch("icon", "Focus"); + end + end + addon.groups[anchor]:RegisterBar(barID, text, eTime - sTime, nil, icon, ticon, color.r, color.g, color.b); +end); +---------------------------------------------------------------------------------------------------- +-- UNIT_SPELLCAST_CHANNEL_STOP +---------------------------------------------------------------------------------------------------- +addon:StartParsing("UNIT_SPELLCAST_CHANNEL_STOP", function(unitid) + if (NaturDB.Casting and unitid ~= "target" and unitid ~= "focus") then return; end + addon.groups["FRIENDLYCAST"]:UnregisterBar(UnitGUID(unitid).."Channel"); + addon.groups["HOSTILECAST"]:UnregisterBar(UnitGUID(unitid).."Channel"); +end); \ No newline at end of file
trunk/NaturCombat/addon/spells.lua
1,34 → 1,223
local addon = LibStub:NewLibrary("NaturCombat",20080514);
assert(addon,"NaturCombatTimers failed to load in 'NaturCombatTimers\addon\spells.lua' on line 1");
local addon = LibStub:NewLibrary("NaturCombat", 20080716);
----------------------------------------------------------------------------------------------------
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)
addon.spelldata = {}; -- Lookup table for data, stored by spellid
addon.spellkeys = {}; -- Lookup table for spell names that default to a spellid
addon.spellmeta = {}; -- Metatable
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);
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;
data.id, data.name, data.rank, data.icon, data.castTime = key, name, rank, icon, castTime / 1000;
return data;
end;
addon.spells = setmetatable({},addon.spellmeta);
local spells = setmetatable({}, addon.spellmeta);
function addon:GetSpellData(id)
if (id) then return addon.spells[id]; end
end;
if (id) then return 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
\ No newline at end of file +-- SPELL DATABASE +-- INFORMATION +-- duration cooldown dot stun combo pvpdur talent +-- EXAMPLE: spells[SPELLID] = { duration = TIME, cooldown = TIME}; +---------------------------------------------------------------------------------------------------- +-- RACIAL ABILITES +spells[20600] = {duration = 20, cooldown = 180}; -- Perception +spells[7744] = {duration = 5, cooldown = 120}; -- WotF +spells[20594] = {duration = 8, cooldown = 180}; -- Stoneform +spells[26297] = {duration = 10, cooldown = 180}; -- Berserking +spells[28880] = {duration = 15, cooldown = 180}; -- GotN +spells[20549] = {duration = 2, cooldown = 120}; -- War Stomp +spells[25467] = {duration = 24, dot = true}; -- Dev. Plague +spells[25446] = {duration = 15, dot = true}; -- Starshards +spells[44047] = {duration = 2, cooldown = 30}; -- Chastise +spells[20589] = {cooldown = 105}; -- Escape Artist +spells[19275] = {duration = 15, cooldown = 180}; -- Feedback +-- MISC & TRINKETS +spells[5530] = {duration = 3, stun = true}; -- Mace Stun +spells[44055] = {duration = 15, cooldown = 180}; -- Battlemaster's Trinkets +spells[35166] = {duration = 20, cooldown = 120}; -- Bloodlust Brooch +spells[43716] = {duration = 20, cooldown = 120}; -- Berserker's Call +spells[40402] = {duration = 20, cooldown = 120}; -- Earring of Soulful Meditation +spells[46784] = {duration = 15, cooldown = 90}; -- Shadowsong Panther +spells[40396] = {duration = 20, cooldown = 120}; -- Skull of Guldan +spells[35163] = {duration = 20, cooldown = 120}; -- Icon of the silver crescent +spells[30458] = {duration = 8, cooldown = 300}; -- Nigh Invuln. Belt +spells[35476] = {duration = 30, cooldown = 120, special = true}; -- Drums of Battle +spells[35474] = {duration = 2, cooldown = 120}; -- Drums of Panic +spells[35475] = {duration = 30, cooldown = 120, special = true}; -- Drums of War +-- DRUIDS +spells[33831] = {cooldown = 180}; -- FoN +spells[26980] = {duration = 21}; -- Regrowth +spells[33357] = {duration = 15, cooldown = 300}; -- Dash +spells[22812] = {duration = 12, cooldown = 60}; -- BarkS +spells[29166] = {duration = 20, cooldown = 360}; -- Innerv. +spells[26999] = {duration = 10, cooldown = 180}; -- Frenz. Reg. +spells[25299] = {duration = 12}; -- Rejuv +spells[2893] = {duration = 7}; -- Abolish Poi. +spells[27009] = {duration = 45, cooldown = 60}; -- NG +spells[33763] = {duration = 7, stacks = true}; -- Lifebloom +spells[17116] = {cooldown = 180}; -- NS +spells[33786] = {duration = 6}; -- Cyclone +spells[26989] = {duration = 15, pvpdur = 10}; -- Ent. Root +spells[27013] = {duration = 12, dot = true}; -- Ins. Swarm +spells[18658] = {duration = 40, pvpdur = 10}; -- Hiber. +spells[26993] = {duration = 40}; -- FF +spells[17392] = {duration = 40}; -- FF (F) +spells[9898] = {duration = 30}; -- Demo. Roar +spells[33986] = {duration = 12}; -- Mangle +spells[33982] = {duration = 12}; -- Mangle +spells[16979] = {duration = 4, cooldown = 15}; -- Feral Charge +spells[33745] = {duration = 15, stacks = true, dot = true}; -- Lacerate +spells[26988] = {duration = 12, dot = true}; -- MF +spells[27008] = {duration = 12, dot = true}; -- Rip +spells[1823] = {duration = 9, dot = true}; -- Rake +spells[27006] = {duration = 4, stun = true, combo = true, talent = {2, 4, 4, 0.5, "DRUID"}}; -- Pounce +spells[27007] = {duration = 18, dot = true}; -- Pounce bleed +spells[22570] = {duration = 7, stun = true, combo = true}; -- Maim +spells[6798] = {duration = 5, cooldown = 60, stun = true, talent = {2, 4, 5, 0.5, "DRUID"}}; -- Bash +-- ROGUE +spells[11305] = {duration = 15, cooldown = 300}; -- Sprint +spells[26669] = {duration = 15, cooldown = 300}; -- Evasion +spells[26889] = {duration = 10, cooldown = 210}; -- Vanish +spells[13877] = {duration = 15, cooldown = 120}; -- Blade flurry +spells[13750] = {duration = 15, cooldown = 300}; -- ARush +spells[31224] = {duration = 4, cooldown = 60}; -- Cloak of Shadows +spells[36554] = {duration = 10, cooldown = 30}; -- Shadowstep +spells[26679] = {duration = 5}; -- Deadly Throw +spells[2094] = {duration = 10, cooldown = 180}; -- Blind +spells[8629] = {duration = 4, talent = {2, 1, 4, 0.5, "ROGUE"}, stun = true}; -- Gouge +spells[8643] = {duration = 6, combo = true, stun = true}; -- Kidney Shot +spells[1833] = {duration = 4, stun = true}; -- Cheap Shot +spells[26867] = {duration = 16, combo = true, dot = true}; -- Rupture +spells[8632] = {duration = 18, dot = true}; -- Garrote +spells[1330] = {duration = 3, dot = true}; -- Garrote silence +spells[38768] = {duration = 5, interrupt = true}; -- Kick +spells[2070] = {duration = 45, pvpdur = 10, stun = true}; -- Sap +spells[26866] = {duration = 30}; -- Expose Armor +spells[3420] = {duration = 12}; -- Crip +spells[3421] = {duration = 12}; -- Crip II +spells[13220] = {duration = 15, stacks = true}; -- Wound +spells[13228] = {duration = 15, stacks = true}; -- Wound II +spells[13229] = {duration = 15, stacks = true}; -- Wound III +spells[13230] = {duration = 15, stacks = true}; -- Wound IV +spells[27283] = {duration = 15, stacks = true}; -- Wound V +spells[5763] = {duration = 10}; -- Mind +spells[8694] = {duration = 10}; -- Mind +spells[11400] = {duration = 10}; -- Mind +spells[2835] = {duration = 12, stacks = true, dot = true}; -- Deadly +spells[2837] = {duration = 12, stacks = true, dot = true}; -- Deadly +spells[11357] = {duration = 12, stacks = true, dot = true}; -- Deadly +spells[11358] = {duration = 12, stacks = true, dot = true}; -- Deadly +spells[25347] = {duration = 12, stacks = true, dot = true}; -- Deadly +spells[26969] = {duration = 12, stacks = true, dot = true}; -- Deadly +spells[27282] = {duration = 12, stacks = true, dot = true}; -- Deadly +-- MAGE +spells[10225] = {duration = 30}; -- Fire Ward +spells[32796] = {duration = 30}; -- Frost Ward +spells[12051] = {duration = 8, cooldown = 480}; -- Evocation +spells[45438] = {duration = 10, cooldown = 300}; -- Ice Block +spells[33405] = {duration = 60, cooldown = 30}; -- Ice Barrier +spells[66] = {duration = 8, cooldown = 300}; -- Invisibility +spells[12043] = {cooldown = 180}; -- PoM +spells[12472] = {duration = 20, cooldown = 180}; -- Icy Veins +spells[31642] = {duration = 8}; -- Blazing Speed +spells[12042] = {duration = 15, cooldown = 180}; -- AP +spells[33042] = {duration = 3}; -- DB +spells[27088] = {duration = 8}; -- Frost Nova +spells[12497] = {duration = 5}; -- Frostbite +spells[10161] = {duration = 8}; -- CoC +spells[28594] = {duration = 15, stacks = true}; -- Winter's Chill +spells[22959] = {duration = 30, stacks = true}; -- Fire Vuln. +spells[12359] = {duration = 2, stun = true}; -- Impact +spells[12825] = {duration = 50, pvpdur = 10}; -- Poly +spells[28271] = {duration = 50, pvpdur = 10}; -- Poly +spells[28272] = {duration = 50, pvpdur = 10}; -- Poly +spells[30942] = {duration = 9}; -- Frostbolt +spells[1953] = {cooldown = 15}; -- Blink +spells[31687] = {duration = 45, cooldown = 180, special = true}; -- Water Elemental +spells[11985] = {cooldown = 600}; -- Cold Snap +spells[2139] = {duration = 8, cooldown = 24, interrupt = true}; +spells[18469] = {duration = 4, cooldown = 24}; +-- HUNTER +spells[14327] = {cooldown = 30}; -- Scare Beast +spells[3054] = {duration = 15, cooldown = 300}; -- Rapid fire +spells[19263] = {duration = 10, cooldown = 300}; -- Deterence +spells[34692] = {duration = 18, cooldown = 120}; -- The Beast Within +spells[19574] = {duration = 18, cooldown = 120}; -- Beastial Wraith +spells[14268] = {duration = 10}; -- Wing Clip +spells[19233] = {duration = 5}; -- RNG, Imp. WC +spells[27018] = {duration = 8, dot = true}; -- Viper Sting +spells[20904] = {duration = 10}; -- Aimed Shot +spells[34490] = {duration = 3, cooldown = 20}; -- Silenecing Shot +spells[25295] = {duration = 15, dot = true}; -- Serpent Sting +spells[19503] = {duration = 4, cooldown = 30}; -- Scatter shot +spells[14309] = {duration = 20, pvpdur = 10, cooldown = 30}; -- Freezing Trap +spells[13810] = {duration = 30, cooldown = 30}; -- Frost Trap +-- PALADIN +spells[1020] = {duration = 12, cooldown = 300}; -- Divine Shield +spells[10278] = {duration = 10, cooldown = 300}; -- BoP +spells[1044] = {duration = 16, cooldown = 25}; -- BoF +spells[27184] = {duration = 30}; -- BoS +spells[20059] = {duration = 30, stacks = true}; -- Vengeance +spells[31884] = {duration = 20, cooldown = 180}; -- Wings! +spells[31842] = {duration = 15, cooldown = 180}; -- Divine Illum +spells[20216] = {cooldown = 120}; -- Divine Favor +spells[10308] = {duration = 5, stun = true, cooldown = 60}; -- HoJ +spells[27180] = {cooldown = 6}; -- HoW +-- PRIEST +spells[25221] = {duration = 15}; -- Renew +spells[10060] = {duration = 15, cooldown = 180}; -- PI +spells[25218] = {duration = 30, cooldown = 15}; -- PW: Shield +spells[14751] = {cooldown = 180}; -- Inner Focus +spells[33206] = {duration = 8, cooldown = 120}; -- Pain Supp. +spells[25368] = {duration = 18, dot = true}; -- SW: Pain +spells[32996] = {cooldown = 12}; -- SW: Death +spells[34433] = {duration = 15, cooldown = 300, special = true}; -- Shadowfiend +spells[10890] = {duration = 8, cooldown = 27}; -- Fear +spells[15286] = {duration = 60, cooldown = 10}; -- Vampiric Embrace +spells[34917] = {duration = 15}; -- Vampiric Touch +-- SHAMAN +spells[32182] = {duration = 30, cooldown = 600}; -- Heroism +spells[2825] = {duration = 30, cooldown = 600}; -- Bloodlust +spells[25464] = {duration = 8, cooldown = 6}; -- Frost Shock +spells[25457] = {duration = 12, cooldown = 6}; -- Flame Shock +spells[8046] = {duration = 2, interrupt = true, cooldown = 6}; -- Earth Shock +spells[25442] = {cooldown = 6}; -- Chain Lightning +spells[16190] = {duration = 12, cooldown = 300}; -- Mana Tide Totem +-- WARLOCK +spells[18288] = {cooldown = 180}; -- Amplify Curse +spells[18708] = {duration = 15, cooldown = 900}; -- Fel Dom +spells[34939] = {duration = 8}; -- Backlash +spells[18095] = {duration = 10}; -- Night Fall +spells[1094] = {duration = 15, dot = true}; -- Immolate +spells[7651] = {duration = 5, dot = true}; -- Drian Life +spells[27221] = {duration = 5, dot = true}; -- Drain Mana +spells[7648] = {duration = 18, dot = true}; -- Corruption +spells[6217] = {duration = 25, dot = true}; -- CoA +spells[18880] = {duration = 30, dot = true}; -- Siphon Life +spells[17962] = {duration = 3, cooldown = 120}; -- Death Coil +spells[6213] = {duration = 20, pvpdur = 10}; -- Fear +spells[17928] = {duration = 8}; -- HoT +spells[18223] = {duration = 12}; -- CoE +spells[11719] = {duration = 30, pvpdur = 10}; -- CoT +-- WARRIOR +spells[2687] = {duration = 10, cooldown = 60}; -- Bloodrage +spells[18499] = {duration = 10, cooldown = 30}; -- Berserker Rage +spells[12292] = {duration = 30, cooldown = 180}; -- Death Wish +spells[23920] = {duration = 5, cooldon = 10}; -- spell Reflect +spells[29838] = {duration = 10}; -- Second Wind +spells[25212] = {duration = 10}; -- Hamstring +spells[23695] = {duration = 5}; -- RNG LOL Imp. Hamstring +spells[12323] = {duration = 6}; -- PH +spells[5246] = {duration = 8, cooldown = 180}; -- Itim. Shout +spells[30330] = {duration = 10}; -- MS +spells[25225] = {duration = 30, stacks = true}; -- Sunder +spells[43104] = {duration = 12, dot = true}; -- Deep Wound +spells[25208] = {duration = 21, dot = true}; -- Rend +spells[25203] = {duration = 30}; -- Demo Shout +spells[30633] = {duration = 10}; -- Thunderclap \ No newline at end of file
trunk/NaturCombat/addon/generator.lua
1,22 → 1,43
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");
local addon = LibStub("NaturCombat"); -- Our Library
addon.bar = LibStub("NaturGTB"); -- Bar Library
addon.media = LibStub("LibSharedMedia-3.0"); -- Textures/Icons
----------------------------------------------------------------------------------------------------
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.colors["GREY"] = { r = 0.8, g = 0.8, b = 0.8};
-- DEFAULT VARIABLES
----------------------------------------------------------------------------------------------------
addon.default = { Version=GetAddOnMetadata("NaturCombat", "Version"), Height=20, Width=270, Scale=1, FontSize=15, MaxBars=10, Lock=true, Icon=true,
Growth="UP", Invert=true, Texture="NaturGlaze", Vertical=0, Cooldowns=true, Diminish=true, Sounds=true, Groups=false, Track=false, TargetFocus=true, Casting=true,
Colors = {
["HOSTILECAST"] = {r = 1, g = 0, b = 0},
["FRIENDLYCAST"] = {r = 0, g= 1, b = 0},
["COOLDOWN"] = {r = 0, g = 0, b = 1},
["HOSTILEBUFF"] = {r = 0.5, g = 0, b = 0.65},
["FRIENDLYBUFF"] = {r = 1, g = 0, b = 1},
["STUN"] = {r = 0.5, g = 0.2, b = 0.1},
["DOT"] = {r = 0, g = 0.8, b = 0.8},
["DEBUFF"] = {r = 0.8, g = 0.8, b = 0},
["GREY"] = { r = 0.8, g = 0.8, b = 0.8},
},};
NaturDB = NaturDB or addon.default;
addon.killcounter, addon.killtimer, addon.timers = 0, nil, {};
----------------------------------------------------------------------------------------------------
-- BAR GROUPS
----------------------------------------------------------------------------------------------------
addon.bargroups = {
["COOLDOWNS"] = "Cooldowns";
["DEBUFFS"] = "Debuffs";
["HOSTILEGAIN"] = "Hostile Gains";
["FRIENDLYGAIN"] = "Friendly Gains";
["HOSTILECAST"] = "Hostile Casts";
["FRIENDLYCAST"] = "Friendly Casts";
};
addon.groups = {}; -- Table for bar anchors
addon.CDTable = {}; -- Table for cooldowns
----------------------------------------------------------------------------------------------------
-- REGISTER MEDIA FILES
----------------------------------------------------------------------------------------------------
addon.media:Register("statusbar", "NaturGlaze", [[Interface\AddOns\NaturCombat\media\glaze]]);
addon.media:Register("icon", "Target", [[Interface\AddOns\NaturCombat\media\Target]]);
addon.media:Register("icon", "Focus", [[Interface\AddOns\NaturCombat\media\Focus]]);
----------------------------------------------------------------------------------------------------
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]]);
25,18 → 46,53
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
-- FUNCTIONS
----------------------------------------------------------------------------------------------------
local f = CreateFrame("Frame", nil, InterfaceOptionsFrame)
function addon:StripName(str)
return string.match(str, "[^-]*");
end;
----------------------------------------------------------------------------------------------------
function addon:CreateBarGroup(name)
local group = addon.bar:RegisterGroup(name, addon.media:Fetch("statusbar", NaturDB.Texture));
group:SetScale(NaturDB.Scale);
group:SetWidth(NaturDB.Width);
group:SetHeight(NaturDB.Height);
group:SetAnchorVisible(NaturDB.Lock);
group:SetMaxBars(NaturDB.MaxBars);
group:SetBarGrowth(NaturDB.Growth);
group:SetInvert(NaturDB.Invert);
group:SetVerticalSpacing(NaturDB.Vertical);
group:SetPoint("CENTER");
group:RegisterOnFade(addon, "OnFade");
return group;
end;
----------------------------------------------------------------------------------------------------
function addon:OnFade(barID)
if (addon.CDTable[barID]) then
addon.CDTable[barID] = nil;
end
end;
----------------------------------------------------------------------------------------------------
function addon:GetColor(type) -- USED BY OPTIONS
if (not NaturDB.Colors[type]) then return; end
return NaturDB.Colors[type].r, NaturDB.Colors[type].g, NaturDB.Colors[type].b;
end;
----------------------------------------------------------------------------------------------------
function addon:SetColor(type, ...) -- USED BY OPTIONS
if (not NaturDB.Colors[type]) then return; end
NaturDB.Colors[type] = {r = select(1, ...), g = select(2, ...), b = select(3, ...)};
end;
----------------------------------------------------------------------------------------------------
-- OPTIONS SLASH COMMAND
-- /necb, /natur, /nct
----------------------------------------------------------------------------------------------------
local f = CreateFrame("Frame", nil, InterfaceOptionsMenu);
f:SetScript("OnShow", function(self) LoadAddOn("NaturOptions"); self:SetScript("OnShow", nil) end);
SlashCmdList["NaturCombat"] = function()
SlashCmdList["NaturCombat"] = function(cmd)
if (LoadAddOn("NaturOptions")) then
InterfaceOptionsFrame_OpenToFrame("NaturCombat");
end
end;
SLASH_NaturCombat1 = "/necb";
SLASH_NaturCombat2 = "/natur";
\ No newline at end of file +SLASH_NaturCombat1 = "/natur"; +SLASH_NaturCombat2 = "/necb"; +SLASH_NaturCombat3 = "/naturcombat"; \ No newline at end of file
trunk/NaturCombat/embed/LibWombat/LibWombat.lua
12,6 → 12,7
watcher:RegisterEvent("UNIT_SPELLCAST_CHANNEL_STOP");
watcher:RegisterEvent("UNIT_AURA");
watcher:RegisterEvent("PLAYER_TARGET_CHANGED");
watcher:RegisterEvent("PLAYER_FOCUS_CHANGED");
--
wombat.parser = wombat.parser or {};
local CleanParser = function()
trunk/NaturCombat/embed/GTB/GTB.lua
1,4 → 1,4
local major = "GTB-1.0"
local major = "NaturGTB"
local minor = tonumber(string.match("$Revision: 752 $", "(%d+)") or 1)
 
assert(LibStub, string.format("%s requires LibStub.", major))
11,7 → 11,7
["MUST_CALL"] = "You must call '%s' from a registered GTB object.",
["GROUP_EXISTS"] = "The group '%s' already exists.",
["BAD_FUNC"] = "You must pass an actual handler and function to '%s'.",
["ALT_DRAG"] = "ALT + Drag to move the frame anchor.",
["ALT_DRAG"] = "Drag to move the frame anchor.",
}
 
-- Validation for passed arguments
41,8 → 41,8
 
local framePool = GTB.framePool
local groups = GTB.groups
local methods = {"RegisterOnMove", "SetAnchorVisible", "GetReversed", "GetGrowth", "GetMaxBars", "GetScale", "GetFontSize", "GetWidth", "GetHeight", "SetMaxBars", "SetBaseColor", "EnableGradient", "SetPoint", "SetScale", "SetWidth", "SetHeight", "SetTexture", "SetBarGrowth", "SetIconPosition", "SetTextColor", "HideBar", "ShowBar", "SortBars",
"SetTimerColor", "SetFadeTime", "RegisterOnFade", "RegisterOnClick", "SetGroupFontSize", "SetInvert", "SetDisplayGroup", "GetDisplayGroup", "RegisterBar", "UnregisterBar", "SetRepeatingTimer", "UnregisterAllBars", "SetBarIcon", "SetTime", "SetBarText"}
local methods = {"RegisterOnMove", "SetAnchorVisible", "SetAlpha", "GetAlpha", "SetFlashTime", "GetFlashTime", "GetReversed", "GetGrowth", "GetMaxBars", "GetScale", "GetFontSize", "GetWidth", "GetHeight", "SetMaxBars", "SetBaseColor", "EnableGradient", "SetPoint", "SetScale", "SetWidth", "SetHeight", "SetTexture", "SetBarGrowth", "SetIconPosition", "SetTextColor", "HideBar", "ShowBar", "SortBars",
"SetTimerColor", "SetFadeTime", "RegisterOnFade", "RegisterOnClick", "GetVertical", "SetVerticalSpacing", "SetGroupFontSize", "SetInvert", "SetDisplayGroup", "GetDisplayGroup", "RegisterBar", "UnregisterBar", "SetRepeatingTimer", "UnregisterAllBars", "SetBarIcon", "SetTime", "SetBarText"}
 
-- Internal functions for managing bars
local function getFrame()
75,6 → 75,9
-- Create icon
frame.icon = frame:CreateTexture(nil, "ARTWORK")
 
-- Create Focus/Target Icon
frame.ticon = frame:CreateTexture(nil, "ARTWORK")
 
-- Sparky
frame.spark = frame:CreateTexture(nil, "OVERLAY")
frame.spark:SetTexture("Interface\\CastingBar\\UI-CastingBar-Spark")
124,6 → 127,8
end
end
 
 
 
-- Fadeout OnUpdate
local function fadeOnUpdate(self, elapsed)
local time = GetTime()
161,14 → 166,7
-- Reposition the group
-- edited for NaturCombat
local function sortBars(a, b)
local group = groups["NaturCombat"]
for id, bar in pairs(group.bars) do
if (not bar:IsShown()) then -- this specific bar exists.. but it's hidden
return false
else
return a.endTime < b.endTime
end
end
return a.endTime < b.endTime
end
 
local function repositionFrames(group)
184,9 → 182,9
 
if( i > 1 ) then
if( group.barGrowth == "DOWN" ) then
bar:SetPoint("TOPLEFT", group.usedBars[i - 1], "BOTTOMLEFT", 0, 0)
bar:SetPoint("TOPLEFT", group.usedBars[i - 1], "BOTTOMLEFT", 0, group.vertical)
else
bar:SetPoint("BOTTOMLEFT", group.usedBars[i - 1], "TOPLEFT", 0, 0)
bar:SetPoint("BOTTOMLEFT", group.usedBars[i - 1], "TOPLEFT", 0, group.vertical)
end
elseif( group.barGrowth == "UP" ) then
bar:SetPoint("BOTTOMLEFT", group.frame, "TOPLEFT", offset, 0)
224,7 → 222,9
fadeoutBar(self)
return
end
 
--flashTime = 5
 
self:SetAlpha(NaturDB.Alpha)
-- Timer text, need to see if this can be optimized a bit later
local hour = floor(self.secondsLeft / 3600)
local minutes = self.secondsLeft - (hour * 3600)
270,10 → 270,8
 
-- Dragging functions
local function OnDragStart(self)
if( IsAltKeyDown() ) then
self.isMoving = true
self:StartMoving()
end
self.isMoving = true
self:StartMoving()
end
 
local function OnDragStop(self)
305,12 → 303,24
GameTooltip:Hide()
end
 
function GTB:UnregisterAllBarGroups()
for a, _ in pairs(groups) do
groups[a] = nil;
end
end
 
function GTB:UnregisterGroup(name)
if groups[name] then
groups[name] = nil;
end
end
 
function GTB:RegisterGroup(name, texture)
argcheck(name, 1, "string")
argcheck(texture, 2, "string")
assert(3, not groups[name], string.format(L["GROUP_EXISTS"], name))
 
local obj = {name = name, frame = CreateFrame("Frame", name, UIParent), fontSize = 11, height = 16, obj = obj, bars = {}, usedBars = {}, reversed = false}
local obj = {name = name, frame = CreateFrame("Frame", name, UIParent), fontSize = 11, height = 16, obj = obj, bars = {}, usedBars = {}, vertical = 0}
 
-- Inject our methods
for _, func in pairs(methods) do
346,6 → 356,7
obj:SetScale(1.0)
obj:SetWidth(200)
obj:SetFadeTime(0.25)
--obj:SetFlashTime(5)
obj:SetMaxBars(20)
obj:EnableGradient(true)
obj:SetAnchorVisible(true)
509,6 → 520,9
 
--Edit the timer value of a bar
function GTB.SetTime(group, id, value)
if( group.redirectTo and groups[group.redirectTo] ) then
group = groups[group.redirectTo]
end
if not group.bars[id] then return end
group.bars[id].timer:SetText(value)
group.bars[id].secondsLeft = value
519,26 → 533,38
-- Edit the text on an active bar
local origBarID = {}
function GTB.SetBarText(group, id, text)
if( group.redirectTo and groups[group.redirectTo] ) then
group = groups[group.redirectTo]
end
if not group.bars[id] then return end
group.bars[id].text:SetText(text)
group.bars[id].barText = text
end
 
function GTB.HideBar(group, id)
if( group.redirectTo and groups[group.redirectTo] ) then
group = groups[group.redirectTo]
end
if not group.bars[id] then return end
--Keep record of this timer
origBarID[id] = {update=group.bars[id].lastUpdate,text=group.bars[id].barText,timer=group.bars[id].secondsLeft,icon=group.bars[id].iconPath,color={r=group.bars[id].r,g=group.bars[id].g,b=group.bars[id].b}}
origBarID[id] = {update=group.bars[id].lastUpdate,text=group.bars[id].barText,timer=group.bars[id].secondsLeft,icon=group.bars[id].iconPath,ticon=group.bars[id].ticonPath,color={r=group.bars[id].r,g=group.bars[id].g,b=group.bars[id].b}}
GTB.UnregisterBar(group, id)
end
 
function GTB.ShowBar(group, id, timer)
if( group.redirectTo and groups[group.redirectTo] ) then
group = groups[group.redirectTo]
end
if not origBarID[id] then return end
local time = origBarID[id].timer - (GetTime() - origBarID[id].update)
-- group, id, text, 60, 54, icon, r, g, b
GTB.RegisterBar(group, id, origBarID[id].text, time, timer, origBarID[id].icon, origBarID[id].color.r, origBarID[id].color.g, origBarID[id].color.b)
GTB.RegisterBar(group, id, origBarID[id].text, time, timer, origBarID[id].icon, origBarID[id].ticon, origBarID[id].color.r, origBarID[id].color.g, origBarID[id].color.b)
end
 
function GTB.SetInvert(group, value)
if( group.redirectTo and groups[group.redirectTo] ) then
group = groups[group.redirectTo]
end
group.reversed = value
end
function GTB.GetReversed(group)
556,18 → 582,43
function GTB.GetScale(group)
return group.scale
end
 
function GTB.GetFontSize(group)
return group.fontSize
end
 
function GTB.GetMaxBars(group)
return group.maxBars
end
 
function GTB.GetGrowth(group)
return group.barGrowth
end
 
function GTB.SetVerticalSpacing(group, val)
if( group.redirectTo and groups[group.redirectTo] ) then
group = groups[group.redirectTo]
end
group.vertical = val
end
function GTB.GetVertical(group)
return group.vertical
end
 
function GTB.SetAlpha(group, val)
if( group.redirectTo and groups[group.redirectTo] ) then
group = groups[group.redirectTo]
end
for k, v in pairs(group.bars) do
group.bars[k]:SetAlpha(val);
end
end
 
-- Change the font size of the group
function GTB.SetGroupFontSize(group, size)
if( group.redirectTo and groups[group.redirectTo] ) then
group = groups[group.redirectTo]
end
group.fontSize = size
end
 
651,6 → 702,19
group.fadeTime = seconds
end
 
-- When should we start flashing the bar
function GTB.SetFlashTime(group, seconds)
argcheck(seconds, 2, "number")
assert(3, group.name and groups[group.name], string.format(L["MUST_CALL"], "SetFadeTime"))
 
group.flasherTime = seconds
end
 
function GTB.GetFlashTime(group)
return group.flasherTime
end
 
 
-- Redirect everything to the specified group
function GTB.SetDisplayGroup(group, name)
argcheck(name, 2, "string", "nil")
681,14 → 745,15
--------------------
 
-- Register
function GTB.RegisterBar(group, id, text, seconds, startSeconds, icon, r, g, b)
function GTB.RegisterBar(group, id, text, seconds, startSeconds, icon, ticon, r, g, b)
argcheck(id, 2, "string", "number")
argcheck(text, 3, "string")
argcheck(seconds, 4, "number")
argcheck(icon, 5, "string", "nil")
argcheck(r, 6, "number", "nil")
argcheck(g, 7, "number", "nil")
argcheck(b, 8, "number", "nil")
argcheck(icon, 5, "string", "number", "nil")
argcheck(ticon, 6, "string", "nil")
argcheck(r, 7, "number", "nil")
argcheck(g, 8, "number", "nil")
argcheck(b, 9, "number", "nil")
assert(3, group.name and groups[group.name], string.format(L["MUST_CALL"], "RegisterBar"))
 
local originalOwner = group.name
737,6 → 802,11
 
-- Update icon
if( icon ) then
 
if (type(icon) == "number") then
icon = select(3, GetSpellInfo(icon));
end
 
frame.icon:SetTexture(icon)
 
if( frame.icon:GetTexture() ) then
757,6 → 827,20
frame.icon:Hide()
end
 
-- Update Target/Focus Icon
if ( ticon ~= type("string") ) then
frame.ticon:SetTexture(ticon)
if (frame.ticon:GetTexture()) then
frame.ticon:SetWidth(group.height)
frame.ticon:SetHeight(group.height)
frame.ticon:SetTexCoord(0.07, 0.93, 0.07, 0.93)
frame.ticon:SetPoint("TOPLEFT", frame, "TOPRIGHT", offset, 0)
frame.ticon:Show()
else
frame.ticon:Hide()
end
end
 
-- Set info the bar needs to know
frame.r = r or group.baseColor.r
frame.g = g or group.baseColor.g
771,11 → 855,13
frame.gradients = group.gradients
frame.groupName = group.name
frame.iconPath = icon
frame.ticonPath = ticon
frame.barText = text
frame.barID = id
frame.group = group
frame.reversed = group.reversed
 
frame.vertical = group.vertical
 
-- Setup background
frame.bg:SetStatusBarTexture(group.texture)
frame.bg:SetStatusBarColor(0.0, 0.5, 0.5, 0.5)
784,17 → 870,17
 
-- Start it up
frame:SetStatusBarTexture(group.texture)
frame:SetStatusBarColor(frame.r, frame.g, frame.b)
frame:SetStatusBarColor(r, g, b)
frame:SetWidth(group.width)
frame:SetHeight(group.height)
frame:SetScale(group.scale)
frame:SetScript("OnUpdate", barOnUpdate)
--[[frame.button:SetScript("OnClick", function(self, button)
frame.button:SetScript("OnClick", function(self, button)
if (button == "RightButton") then
-- delete bar
GTB.UnregisterBar(group, id)
end
end)]]
end)
 
-- Reposition this group
repositionFrames(group)
trunk/NaturOptions/NaturOptions.toc
1,6 → 1,6
## Interface: 20400
## Title: NaturCombat Options
## Version: 9.0BETA2
## Version: 1.wowi:revision
## Notes: Options for NaturCombat
## Author: Macca, Beladona
## LoadOnDemand: 1
trunk/NaturOptions/NaturOptions.lua
7,12 → 7,50
function NaturOptions:OnLoad()
self.name = "NaturCombat";
 
local bar = self:CreateBarPanel();
bar:SetPoint("TOPLEFT", 10, -60);
local header = self:CreateHeader(self, "NaturCombat");
header:SetPoint("TOPLEFT", 16, -16);
 
local general = self:CreateGeneralPanel();
general:SetPoint("BOTTOMLEFT", 10, 10);
local tab1 = self:CreateTab("Tab1", self, "General", "General Options");
tab1:SetPoint("TOPLEFT", 10, -60);
local tab2 = self:CreateTab("Tab2", self, "Bar", "Bar Options");
tab2:SetPoint("LEFT", tab1, "RIGHT", -15, 0);
 
local tab1page = self:CreateGeneralPanel(tab1);
tab1page:SetPoint("TOPLEFT", 5, -50);
 
 
local tab2page = self:CreateBarPanel(tab2);
tab2page:SetPoint("TOPLEFT", -58, -50);
tab2page:Hide();
 
local colorp = self:CreateColorPanel(tab1);
colorp:SetPoint("TOPLEFT", tab1page, "BOTTOMLEFT", 0, -20);
 
local tab1spacer = self:CreateSpacer(270, self);
tab1spacer:SetPoint("LEFT", tab2, "BOTTOMRIGHT", -10, 2);
local tab2spacer = self:CreateSpacer(26, self);
tab2spacer:SetPoint("LEFT", tab1, "BOTTOMRIGHT", -10, 2);
local tab3spacer = self:CreateSpacer(35, self);
tab3spacer:SetPoint("RIGHT", tab1, "BOTTOMLEFT", 12, 2);
PanelTemplates_SetNumTabs(self, 2);
PanelTemplates_SetTab(self, 1);
tab1:SetScript("OnClick", function()
PanelTemplates_SetTab(self, 1);
tab1.spacer:Hide();
tab1page:Show();
tab2page:Hide();
colorp:Show();
tab2.spacer:Show();
end);
tab2:SetScript("OnClick", function()
PanelTemplates_SetTab(self, 2);
tab2.spacer:Hide();
tab2page:Show();
tab1page:Hide();
colorp:Hide();
tab1.spacer:Show();
end);
 
InterfaceOptions_AddCategory(self);
end
----------------------------------------------------------------------------------------------------
27,10 → 65,10
end
----------------------------------------------------------------------------------------------------
-- Create options
function NaturOptions:CreateGeneralPanel()
local p = self:CreatePanel("General Options");
p:SetHeight(120);
p:SetWidth(367);
function NaturOptions:CreateGeneralPanel(parent)
local p = self:CreatePanel("General Options", parent);
p:SetHeight(170);
p:SetWidth(357);
 
-- Locked (CHECKBOX)
local lock = self:CreateCheckBox("Locked", p, "Unlock/Lock the bars.");
43,7 → 81,14
else
NaturDB.Lock = true;
end
addon.group:SetAnchorVisible(NaturDB.Lock);
for k, v in pairs(addon.groups) do
if (NaturDB.Groups) then
addon.groups[k]:SetAnchorVisible(NaturDB.Lock);
addon.groups["NATUR"]:SetAnchorVisible(false);
else
addon.groups["NATUR"]:SetAnchorVisible(NaturDB.Lock);
end
end
end);
lock:SetPoint("TOPLEFT", 10, -8);
-- Cooldowns (CHECKBOX)
74,10 → 119,10
dr:SetPoint("LEFT", lock, "RIGHT", 100, 0);
-- Test Bars (BUTTON)
local test = self:CreateButton(p, "Test Bars", "Create 3 bars to test settings.");
test:SetPoint("TOPLEFT", lock, "BOTTOMLEFT", 0, -40);
test:SetPoint("TOPLEFT", lock, "BOTTOMLEFT", 0, -80);
test:SetScript("OnClick", function(self)
for i = 1, 3 do
addon.group:RegisterBar("Testing"..i, "Testing NaturCombat Bar #"..i, 10, nil, "Interface\\Icons\\Spell_Holy_HolyProtection", 0, 1, 0);
addon.groups["FRIENDLYCAST"]:RegisterBar("Testing"..i, "Testing NaturCombat Bar #"..i, 10, nil, "Interface\\Icons\\Spell_Holy_HolyProtection", nil, 0, 1, 0);
end
end);
local sound = self:CreateCheckBox("Killing Blow Sounds", p, "Turn on/off sounds when you get a killing blow.");
92,28 → 137,188
end
end);
sound:SetPoint("TOPLEFT", dr, "BOTTOMLEFT", 0, 0);
 
local track = self:CreateCheckBox("Track only my abilites", p, "Show only your debuffs and buffs rather then everyones.");
track:SetScript("OnShow", function(self)
self:SetChecked(NaturDB.Track);
end);
track:SetScript("OnClick", function(self)
if (self:GetChecked()) then
NaturDB.Track = true;
else
NaturDB.Track = false;
end
end);
track:SetPoint("TOPLEFT", sound, "BOTTOMLEFT", 0, 0);
 
local focus = self:CreateCheckBox("Track all units.", p, "Track everyone in range of your Combat Log.\n|cffff2020WARING:|r This may be inaccurate and can display a lot of bars.");
focus:SetScript("OnShow", function(self)
self:SetChecked(not NaturDB.TargetFocus);
end);
focus:SetScript("OnClick", function(self)
if (self:GetChecked()) then
NaturDB.TargetFocus = false;
else
NaturDB.TargetFocus = true;
end
end);
focus:SetPoint("TOPLEFT", track, "BOTTOMLEFT", 0, 0);
 
local cast = self:CreateCheckBox("Enable Cast bars", p, "Enable/Disable cast bars");
cast:SetScript("OnShow", function(self)
self:SetChecked(NaturDB.Casting);
end);
cast:SetScript("OnClick", function(self)
if (self:GetChecked()) then
NaturDB.Casting = true;
else
NaturDB.Casting = false;
end
end);
cast:SetPoint("TOPLEFT", focus, "BOTTOMLEFT", 0, 0);
 
local groups = self:CreateCheckBox("Separate Groups", p, "Show multiple bar groups or only one");
groups:SetScript("OnShow", function(self)
self:SetChecked(NaturDB.Groups);
end);
groups:SetScript("OnClick", function(self)
if (self:GetChecked()) then
NaturDB.Groups = true;
for k, v in pairs(addon.groups) do
addon.groups[k]:SetDisplayGroup(nil);
addon.groups[k]:SetAnchorVisible(true);
end
addon.groups["NATUR"]:SetAnchorVisible(false);
NaturDB.Lock = true;
lock:SetChecked(false);
else
for k, v in pairs(addon.groups) do
addon.groups[k]:SetDisplayGroup("NaturCombat");
addon.groups[k]:SetAnchorVisible(false);
end
addon.groups["NATUR"]:SetAnchorVisible(true);
NaturDB.Groups = false;
NaturDB.Lock = true;
lock:SetChecked(false);
end
end);
groups:SetPoint("TOPLEFT", cd, "BOTTOMLEFT", 0, 0);
 
return p;
end
----------------------------------------------------------------------------------------------------
function NaturOptions:CreateBarPanel()
local p = self:CreatePanel("Bar Options");
p:SetWidth(367);
p:SetHeight(200);
-----------------------------------------------------------------------------------------------------
function NaturOptions:CreateColorPanel(parent)
local p = self:CreatePanel("Color Options", parent);
p:SetWidth(250);
p:SetHeight(100);
 
local fc = self:CreateColorButton(p, "Friendly Cast", "FRIENDLYCAST");
fc:SetPoint("TOPLEFT", p, "TOPLEFT", 10, -8)
local hc = self:CreateColorButton(p, "Hostile Cast", "HOSTILECAST");
hc:SetPoint("TOPLEFT", fc, "BOTTOMLEFT", 0, -3);
local fg = self:CreateColorButton(p, "Friendly Gain", "FRIENDLYBUFF");
fg:SetPoint("TOPLEFT", hc, "BOTTOMLEFT", 0, -3);
local hg = self:CreateColorButton(p, "Hostile Gain", "HOSTILEBUFF");
hg:SetPoint("TOPLEFT", fg, "BOTTOMLEFT", 0, -3);
local st = self:CreateColorButton(p, "Stuns", "STUN");
st:SetPoint("LEFT", fc, "RIGHT", 90, 0);
local dt = self:CreateColorButton(p, "DoTs", "DOT");
dt:SetPoint("TOPLEFT", st, "BOTTOMLEFT", 0, -3);
local cd = self:CreateColorButton(p, "Cooldowns", "COOLDOWN");
cd:SetPoint("TOPLEFT", dt, "BOTTOMLEFT", 0, -3);
local db = self:CreateColorButton(p, "Debuffs", "DEBUFF");
db:SetPoint("TOPLEFT", cd, "BOTTOMLEFT", 0, -3);
local rd = self:CreateButton(p, "Reset", "Reset to default colors.");
rd:SetPoint("LEFT", st, "RIGHT", 60, 0);
rd:SetWidth(50);
rd:SetHeight(20);
rd:SetScript("OnClick", function(self)
for a, b in pairs(NaturDB.Colors) do
NaturDB.Colors[a] = addon.default.Colors[a];
fc:Hide(); fc:Show();
hc:Hide(); hc:Show();
fg:Hide(); fg:Show();
hg:Hide(); hg:Show();
cd:Hide(); cd:Show();
db:Hide(); db:Show();
st:Hide(); st:Show();
dt:Hide(); dt:Show();
end
end);
 
return p;
end
-----------------------------------------------------------------------------------------------------
local colorSelectors, colorCopier;
function NaturOptions:CreateColorButton(parent, name, type)
local f = CreateFrame("Button", parent:GetName()..name, parent);
f:SetWidth(16);
f:SetHeight(16);
f:SetNormalTexture("Interface\\ChatFrame\\ChatFrameColorSwatch");
f.type = type;
local t = f:CreateFontString(nil, "BACKGROUND");
t:SetFontObject("GameFontHighlightSmall");
t:SetPoint("LEFT", f, "RIGHT", 7, 0);
f.Text = t;
local b = f:CreateTexture(nil, "BACKGROUND");
b:SetWidth(14);
b:SetHeight(14);
b:SetTexture(1, 1, 1);
b:SetPoint("CENTER");
f.bg = b;
f.SetColor = function(self, ...) self:GetNormalTexture():SetVertexColor(...); addon:SetColor(self.type, ...); end
f.swatchFunc = function() f:SetColor(ColorPickerFrame:GetColorRGB()); end
f.cancelFunc = function() f:SetColor(f.r, f.g, f.b); end
f:SetScript("OnClick", function(self)
if (ColorPickerFrame:IsShown()) then
ColorPickerFrame:Hide();
else
self.r, self.g, self.b = addon:GetColor(self.type);
UIDropDownMenuButton_OpenColorPicker(self)
ColorPickerFrame:SetFrameStrata("TOOLTIP");
ColorPickerFrame:Raise();
end
end);
f:SetScript("OnEnter", function(self)
local c = NORMAL_FONT_COLOR
self.bg:SetVertexColor(c.r, c.g, c.b);
end);
f:SetScript("OnLeave", function(self)
local c = HIGHLIGHT_FONT_COLOR;
self.bg:SetVertexColor(c.r, c.g, c.b);
end);
f:SetScript("OnShow", function(self)
self.r, self.g, self.b = addon:GetColor(self.type);
f:GetNormalTexture():SetVertexColor(self.r, self.g, self.b);
f.Text:SetText(name);
end);
if colorSelectors then
tinsert(colorSelectors, f);
else
colorSelectors = {f};
end
return f;
end
-----------------------------------------------------------------------------------------------------
function NaturOptions:CreateBarPanel(parent)
local p = self:CreatePanel("Bar Options", parent);
p:SetWidth(357);
p:SetHeight(280);
-- Header!
local header = self:CreateHeader(self, "NaturCombat");
header:SetPoint("TOPLEFT", 16, -16);
 
-- Height (SLIDER)
local height = self:CreateSlider("Height", p, 0, 30, 1, "Change the height of the bars");
height:SetScript("OnShow", function(self)
self.onShow = true;
self:SetValue(addon.group:GetHeight());
self:SetValue(addon.groups["NATUR"]:GetHeight());
self.onShow = nil;
end);
height:SetScript("OnValueChanged", function(self, v)
self.valText:SetText(format("%.1f", v));
if not self.onShow then
addon.group:SetHeight(v);
for k, b in pairs(addon.groups) do
addon.groups[k]:SetHeight(v);
end
NaturDB.Height = v;
end
end);
123,29 → 328,50
local width = self:CreateSlider("Width", p, 50, 300, 1, "Change the width of the bars");
width:SetScript("OnShow", function(self)
self.onShow = true;
self:SetValue(addon.group:GetWidth());
self:SetValue(addon.groups["NATUR"]:GetWidth());
self.onShow = nil;
end);
width:SetScript("OnValueChanged", function(self, v)
self.valText:SetText(format("%.1f", v));
if not self.onShow then
addon.group:SetWidth(v);
for k, b in pairs(addon.groups) do
addon.groups[k]:SetWidth(v);
end
NaturDB.Width = v;
end
end);
width:SetPoint("TOPLEFT", height, "BOTTOMLEFT", 0, -20);
 
local vert = self:CreateSlider("Vertical Spacing", p, 0, 20, 1, "Change the space between bars.");
vert:SetScript("OnShow", function(self)
self.onShow = true;
self:SetValue(addon.groups["NATUR"]:GetVertical());
self.onShow = nil;
end);
vert:SetScript("OnValueChanged", function(self, v)
self.valText:SetText(format("%.1f",v));
if not self.onShow then
for k, b in pairs(addon.groups) do
addon.groups[k]:SetVerticalSpacing(v);
end
NaturDB.Vertical = v;
end
end);
vert:SetPoint("TOPLEFT", width, "BOTTOMLEFT", 0, -20);
 
-- Scale (SLIDER)
local scale = self:CreateSlider("Scale", p, 1, 5, 1, "Change the scale of the bars");
local scale = self:CreateSlider("Scale", p, 0.1, 5, 0.1, "Change the scale of the bars");
scale:SetScript("OnShow", function(self)
self.onShow = true;
self:SetValue(addon.group:GetScale());
self:SetValue(addon.groups["NATUR"]:GetScale());
self.onShow = nil;
end);
scale:SetScript("OnValueChanged", function(self, v)
self.valText:SetText(format("%.1f",v));
if not self.onShow then
addon.group:SetScale(v);
for k, b in pairs(addon.groups) do
addon.groups[k]:SetScale(v);
end
NaturDB.Scale = v;
end
end);
155,13 → 381,15
local font = self:CreateSlider("Font Size", p, 1, 30, 1, "Change the font size on the bars");
font:SetScript("OnShow", function(self)
self.onShow = true;
self:SetValue(addon.group:GetFontSize());
self:SetValue(addon.groups["NATUR"]:GetFontSize());
self.onShow = nil;
end);
font:SetScript("OnValueChanged", function(self, v)
self.valText:SetText(format("%.1f",v));
if not self.onShow then
addon.group:SetGroupFontSize(v);
for k, b in pairs(addon.groups) do
addon.groups[k]:SetGroupFontSize(v);
end
NaturDB.FontSize = v;
end
end);
171,35 → 399,65
local maxbars = self:CreateSlider("Max Bars", p, 1, 20, 1, "Change how many bars are shown at one time");
maxbars:SetScript("OnShow", function(self)
self.onShow = true;
self:SetValue(addon.group:GetMaxBars());
self:SetValue(addon.groups["NATUR"]:GetMaxBars());
self.onShow = nil;
end);
maxbars:SetScript("OnValueChanged", function(self, v)
self.valText:SetText(format("%.1f",v));
if not self.onShow then
addon.group:SetMaxBars(v);
for k, b in pairs(addon.groups) do
addon.groups[k]:SetMaxBars(v);
end
NaturDB.MaxBars = v;
end
end);
maxbars:SetPoint("TOPLEFT", font, "BOTTOMLEFT", 0, -20);
 
local alpha = self:CreateSlider("Alpha", p, 0, 1, 0.1, "Change the alpha of the bars");
alpha:SetScript("OnShow", function(self)
self.onShow = true;
self:SetValue(NaturDB.Alpha);
self.onShow = nil;
end);
alpha:SetScript("OnValueChanged", function(self, v)
self.valText:SetText(format("%.1f",v));
if not self.onShow then
for k, b in pairs(addon.groups) do
addon.groups[k]:SetAlpha(v);
end
NaturDB.Alpha = v;
end
end);
alpha:SetPoint("TOPLEFT", maxbars, "BOTTOMLEFT", 0, -20);
 
--Invert (CHECKBOX)
local invert = self:CreateCheckBox("Invert", p, "Set the fill of the bar to be inverted");
invert:SetScript("OnShow", function(self) self:SetChecked(addon.group:GetReversed()); end);
invert:SetScript("OnShow", function(self) self:SetChecked(addon.groups["NATUR"]:GetReversed()); end);
invert:SetScript("OnClick", function(self)
if (self:GetChecked()) then
addon.group:SetInvert(true);
for k,b in pairs(addon.groups) do
addon.groups[k]:SetInvert(true);
end
NaturDB.Invert = true;
else
addon.group:SetInvert(false);
for k,b in pairs(addon.groups) do
addon.groups[k]:SetInvert(false);
end
NaturDB.Invert = false
end
end);
invert:SetPoint("TOPLEFT", width, "BOTTOMLEFT", 0, -10);
invert:SetPoint("TOPLEFT", vert, "BOTTOMLEFT", 0, -10);
 
-- Growth (CHECKBOX)
local growth = self:CreateCheckBox("Grow Up", p, "Set whether the bars grow up or down");
growth:SetScript("OnShow", function(self) self:SetChecked(addon.group:GetGrowth()); end);
growth:SetScript("OnShow", function(self)
local val = addon.groups["NATUR"]:GetGrowth();
if (val == "UP") then
self:SetChecked(true);
else
self:SetChecked(false);
end
end);
growth:SetScript("OnClick", function(self)
local val = self:GetChecked();
local value;
208,23 → 466,40
else
value = "DOWN";
end
addon.group:SetBarGrowth(value);
for k, v in pairs(addon.groups) do
addon.groups[k]:SetBarGrowth(value);
end
NaturDB.Growth = value;
end);
growth:SetPoint("TOPLEFT", invert, "BOTTOMLEFT", 0, 0);
 
local icon = self:CreateCheckBox("Show Target/Focus Icons", p, "Set whether to show the target/focus icons.");
icon:SetScript("OnShow", function(self)
self:SetChecked(NaturDB.Icon);
end);
icon:SetScript("OnClick", function(self)
local v = self:GetChecked();
if (v == 1) then
NaturDB.Icon = true;
else
NaturDB.Icon = false;
end
end);
icon:SetPoint("TOPLEFT", growth, "BOTTOMLEFT", 0, 0);
 
-- Texture (DROPDOWN) --yuck
local texture = self:CreateDropDown("Texture", p);
texture:SetPoint("TOPLEFT", maxbars, "BOTTOMLEFT", 0, -40);
local texture = self:CreateTextureDropDown("Texture", p);
texture:SetPoint("TOPLEFT", maxbars, "BOTTOMLEFT", -10, -60);
 
return p;
end
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
function NaturOptions:CreateButton(panel, name, tiptext)
local f = CreateFrame("Button", panel:GetName().."Buttons", panel, "UIPanelButtonTemplate");
local f = CreateFrame("Button", panel:GetName()..name, panel, "UIPanelButtonTemplate");
f:SetHeight(30);
f:SetWidth(100);
getglobal(panel:GetName().."Buttons".."Text"):SetText(name);
getglobal(panel:GetName()..name.."Text"):SetText(name);
f:SetScript("OnEnter", ShowTooltip);
f:SetScript("OnLeave", HideTooltip);
f.tiptext = tiptext;
264,7 → 539,7
return b;
end
----------------------------------------------------------------------------------------------------
function NaturOptions:CreateDropDown(name, panel)
function NaturOptions:CreateTextureDropDown(name, panel)
local f = CreateFrame("Frame", panel:GetName()..name, panel, "UIDropDownMenuTemplate");
local t = f:CreateFontString(nil, "BACKGROUND");
t:SetPoint("BOTTOMLEFT", f, "TOPLEFT", 21, 0);
275,7 → 550,10
getglobal(self:GetName().."Text"):SetText(NaturDB.Texture);
end);
local function ListButton_OnClick(self)
addon.group:SetTexture(media:Fetch("statusbar", self.texture));
--addon.group:SetTexture(media:Fetch("statusbar", self.texture));
for k, v in pairs(addon.groups) do
addon.groups[k]:SetTexture(media:Fetch("statusbar", self.texture));
end
NaturDB.Texture = self.texture;
local p = self:GetParent();
p:Hide();
401,13 → 679,31
return f;
end
----------------------------------------------------------------------------------------------------
function NaturOptions:CreatePanel(name)
local p = CreateFrame("Frame", self:GetName()..name, self, "OptionFrameBoxTemplate");
function NaturOptions:CreatePanel(name, parent)
local p = CreateFrame("Frame", self:GetName()..name, parent, "OptionFrameBoxTemplate");
p:SetBackdropBorderColor(.4, .4, .4);
p:SetBackdropColor(.15, .15, .15, .75);
getglobal(p:GetName().."Title"):SetText(name);
return p;
end
----------------------------------------------------------------------------------------------------
function NaturOptions:CreateTab(name, parent, text, tooltip)
local p = CreateFrame("Button", parent:GetName()..name, parent, "OptionsFrameTabButtonTemplate");
p:SetText(text);
p:SetScript("OnEnter", ShowTooltip);
p:SetScript("OnLeave", HideTooltip);
p.tiptext = tooltip;
PanelTemplates_TabResize(0, p);
local s = self:CreateSpacer(p:GetWidth(), p);
p.spacer = s;
return p;
end
function NaturOptions:CreateSpacer(width, parent)
local s = parent:CreateTexture(nil, "ARTWORK");
s:SetTexture("Interface\\OptionsFrame\\UI-OptionsFrame-Spacer");
s:SetHeight(16);
s:SetWidth(width-20);
return s;
end
-- Go!
NaturOptions:OnLoad();
\ No newline at end of file