diff --git a/SVUI_!Core/libs/_SVUI_Lib/Events.lua b/SVUI_!Core/libs/_SVUI_Lib/Events.lua
index c4e2a58..1a1409b 100644
--- a/SVUI_!Core/libs/_SVUI_Lib/Events.lua
+++ b/SVUI_!Core/libs/_SVUI_Lib/Events.lua
@@ -57,249 +57,12 @@ if not lib then return end -- No upgrade needed
local CoreName, CoreObject = ...
-local LOG_EVENT, _R, _T = {},{},{};
-local COMBAT_LOG_EVENTS = {
- SWING_DAMAGE = function (...)
- wipe(LOG_EVENT);
- LOG_EVENT.type = "damage";
- LOG_EVENT.amount, LOG_EVENT.overkill, LOG_EVENT.damage, LOG_EVENT.resisted, LOG_EVENT.blocked,
- LOG_EVENT.absorbed, LOG_EVENT.crit, LOG_EVENT.glancing, LOG_EVENT.crushing, LOG_EVENT.multi = ...;
- end,
- RANGE_DAMAGE = function (...)
- wipe(LOG_EVENT);
- LOG_EVENT.type = "damage";
- LOG_EVENT.ranged = true;
- LOG_EVENT.spellID, LOG_EVENT.spellName, LOG_EVENT.school, LOG_EVENT.amount, LOG_EVENT.overkill,
- LOG_EVENT.damage, LOG_EVENT.resisted, LOG_EVENT.blocked, LOG_EVENT.absorbed, LOG_EVENT.crit,
- LOG_EVENT.glancing, LOG_EVENT.crushing, LOG_EVENT.offhand, LOG_EVENT.multi = ...;
- end,
- DAMAGE_SPLIT = function (...)
- wipe(LOG_EVENT);
- LOG_EVENT.type = "damage";
- LOG_EVENT.spellID, LOG_EVENT.spellName, LOG_EVENT.school, LOG_EVENT.amount, LOG_EVENT.overkill,
- LOG_EVENT.damage, LOG_EVENT.resisted, LOG_EVENT.blocked, LOG_EVENT.absorbed, LOG_EVENT.crit,
- LOG_EVENT.glancing, LOG_EVENT.crushing, LOG_EVENT.offhand, LOG_EVENT.multi = ...;
- end,
- SPELL_DAMAGE = function (...)
- wipe(LOG_EVENT);
- LOG_EVENT.type = "damage";
- LOG_EVENT.spellID, LOG_EVENT.spellName, LOG_EVENT.school, LOG_EVENT.amount, LOG_EVENT.overkill,
- LOG_EVENT.damage, LOG_EVENT.resisted, LOG_EVENT.blocked, LOG_EVENT.absorbed, LOG_EVENT.crit,
- LOG_EVENT.glancing, LOG_EVENT.crushing, LOG_EVENT.offhand, LOG_EVENT.multi = ...;
- end,
- SPELL_PERIODIC_DAMAGE = function (...)
- wipe(LOG_EVENT);
- LOG_EVENT.type = "damage";
- LOG_EVENT.dot = true;
- LOG_EVENT.spellID, LOG_EVENT.spellName, LOG_EVENT.school, LOG_EVENT.amount, LOG_EVENT.overkill,
- LOG_EVENT.damage, LOG_EVENT.resisted, LOG_EVENT.blocked, LOG_EVENT.absorbed, LOG_EVENT.crit,
- LOG_EVENT.glancing, LOG_EVENT.crushing, LOG_EVENT.offhand, LOG_EVENT.multi = ...;
- end,
- SPELL_BUILDING_DAMAGE = function (...)
- wipe(LOG_EVENT);
- LOG_EVENT.type = "damage";
- LOG_EVENT.spellID, LOG_EVENT.spellName, LOG_EVENT.school, LOG_EVENT.amount, LOG_EVENT.overkill,
- LOG_EVENT.damage, LOG_EVENT.resisted, LOG_EVENT.blocked, LOG_EVENT.absorbed, LOG_EVENT.crit,
- LOG_EVENT.glancing, LOG_EVENT.crushing = ...;
- end,
- DAMAGE_SHIELD = function (...)
- wipe(LOG_EVENT);
- LOG_EVENT.type = "damage";
- LOG_EVENT.shield = true;
- LOG_EVENT.spellID, LOG_EVENT.spellName, LOG_EVENT.school, LOG_EVENT.amount, LOG_EVENT.overkill,
- LOG_EVENT.damage, LOG_EVENT.resisted, LOG_EVENT.blocked, LOG_EVENT.absorbed, LOG_EVENT.crit,
- LOG_EVENT.glancing, LOG_EVENT.crushing = ...;
- end,
- SWING_MISSED = function (...)
- wipe(LOG_EVENT);
- LOG_EVENT.type = "miss";
- LOG_EVENT.miss, LOG_EVENT.offhand, LOG_EVENT.multi, LOG_EVENT.amount = ...;
- end,
- RANGE_MISSED = function (...)
- wipe(LOG_EVENT);
- LOG_EVENT.type = "miss";
- LOG_EVENT.ranged = true;
- LOG_EVENT.spellID, LOG_EVENT.spellName, LOG_EVENT.school, LOG_EVENT.miss,
- LOG_EVENT.offhand, LOG_EVENT.multi, LOG_EVENT.amount = ...;
- end,
- SPELL_MISSED = function (...)
- wipe(LOG_EVENT);
- LOG_EVENT.type = "miss";
- LOG_EVENT.spellID, LOG_EVENT.spellName, LOG_EVENT.school, LOG_EVENT.miss,
- LOG_EVENT.offhand, LOG_EVENT.multi, LOG_EVENT.amount = ...;
- end,
- SPELL_PERIODIC_MISSED = function (...)
- wipe(LOG_EVENT);
- LOG_EVENT.type = "miss";
- LOG_EVENT.spellID, LOG_EVENT.spellName, LOG_EVENT.school, LOG_EVENT.miss,
- LOG_EVENT.offhand, LOG_EVENT.multi, LOG_EVENT.amount = ...;
- end,
- DAMAGE_SHIELD_MISSED = function (...)
- wipe(LOG_EVENT);
- LOG_EVENT.type = "miss";
- LOG_EVENT.shield = true;
- LOG_EVENT.spellID, LOG_EVENT.spellName, LOG_EVENT.school, LOG_EVENT.miss,
- LOG_EVENT.offhand, LOG_EVENT.multi, LOG_EVENT.amount = ...;
- end,
- SPELL_DISPEL_FAILED = function (...)
- wipe(LOG_EVENT);
- LOG_EVENT.type = "miss";
- LOG_EVENT.miss = "RESIST";
- LOG_EVENT.spellID, LOG_EVENT.spellName, LOG_EVENT.school, LOG_EVENT.spellID2,
- LOG_EVENT.spellName2, LOG_EVENT.school2 = ...;
- end,
- SPELL_PERIODIC_ENERGIZE = function (...)
- wipe(LOG_EVENT);
- LOG_EVENT.type = "power";
- LOG_EVENT.gain = true;
- LOG_EVENT.spellID, LOG_EVENT.spellName, LOG_EVENT.school, LOG_EVENT.amount, LOG_EVENT.powerType = ...;
- end,
- SPELL_PERIODIC_DRAIN = function (...)
- wipe(LOG_EVENT);
- LOG_EVENT.type = "power";
- LOG_EVENT.drain = true;
- LOG_EVENT.spellID, LOG_EVENT.spellName, LOG_EVENT.school, LOG_EVENT.amount,
- LOG_EVENT.powerType, LOG_EVENT.amount2 = ...;
- end,
- SPELL_PERIODIC_LEECH = function (...)
- wipe(LOG_EVENT);
- LOG_EVENT.type = "power";
- LOG_EVENT.leech = true;
- LOG_EVENT.spellID, LOG_EVENT.spellName, LOG_EVENT.school, LOG_EVENT.amount,
- LOG_EVENT.powerType, LOG_EVENT.amount2 = ...;
- end,
- SPELL_ENERGIZE = function (...)
- wipe(LOG_EVENT);
- LOG_EVENT.type = "power";
- LOG_EVENT.gain = true;
- LOG_EVENT.spellID, LOG_EVENT.spellName, LOG_EVENT.school, LOG_EVENT.amount, LOG_EVENT.powerType = ...;
- end,
- SPELL_DRAIN = function (...)
- wipe(LOG_EVENT);
- LOG_EVENT.type = "power";
- LOG_EVENT.drain = true;
- LOG_EVENT.spellID, LOG_EVENT.spellName, LOG_EVENT.school, LOG_EVENT.amount,
- LOG_EVENT.powerType, LOG_EVENT.amount2 = ...;
- end,
- SPELL_LEECH = function (...)
- wipe(LOG_EVENT);
- LOG_EVENT.type = "power";
- LOG_EVENT.leech = true;
- LOG_EVENT.spellID, LOG_EVENT.spellName, LOG_EVENT.school, LOG_EVENT.amount,
- LOG_EVENT.powerType, LOG_EVENT.amount2 = ...;
- end,
- SPELL_STOLEN = function (...)
- wipe(LOG_EVENT);
- LOG_EVENT.type = "dispel";
- LOG_EVENT.spellID, LOG_EVENT.spellName, LOG_EVENT.school, LOG_EVENT.spellID2,
- LOG_EVENT.spellName2, LOG_EVENT.school2, LOG_EVENT.aura = ...;
- end,
- SPELL_DISPEL = function (...)
- wipe(LOG_EVENT);
- LOG_EVENT.type = "dispel";
- LOG_EVENT.spellID, LOG_EVENT.spellName, LOG_EVENT.school, LOG_EVENT.spellID2,
- LOG_EVENT.spellName2, LOG_EVENT.school2, LOG_EVENT.aura = ...;
- end,
- SPELL_HEAL = function (...)
- wipe(LOG_EVENT);
- LOG_EVENT.type = "heal";
- LOG_EVENT.spellID, LOG_EVENT.spellName, LOG_EVENT.school, LOG_EVENT.amount,
- LOG_EVENT.overheal, LOG_EVENT.absorbed, LOG_EVENT.crit, LOG_EVENT.multi = ...;
- end,
- SPELL_PERIODIC_HEAL = function (...)
- wipe(LOG_EVENT);
- LOG_EVENT.type = "heal";
- LOG_EVENT.hot = true;
- LOG_EVENT.spellID, LOG_EVENT.spellName, LOG_EVENT.school, LOG_EVENT.amount,
- LOG_EVENT.overheal, LOG_EVENT.absorbed, LOG_EVENT.crit, LOG_EVENT.multi = ...;
- end,
- ENVIRONMENTAL_DAMAGE = function (...)
- wipe(LOG_EVENT);
- LOG_EVENT.type = "environmental";
- LOG_EVENT.hazard, LOG_EVENT.amount, LOG_EVENT.overkill, LOG_EVENT.damage,
- LOG_EVENT.resisted, LOG_EVENT.blocked, LOG_EVENT.absorbed, LOG_EVENT.crit,
- LOG_EVENT.glancing, LOG_EVENT.crushing = ...;
- end,
- SPELL_INTERRUPT = function (...)
- wipe(LOG_EVENT);
- LOG_EVENT.type = "interrupt";
- LOG_EVENT.spellID, LOG_EVENT.spellName, LOG_EVENT.school, LOG_EVENT.spellID2,
- LOG_EVENT.spellName2, LOG_EVENT.school2 = ...;
- end,
- SPELL_AURA_APPLIED = function (...)
- wipe(LOG_EVENT);
- LOG_EVENT.type = "aura";
- LOG_EVENT.spellID, LOG_EVENT.spellName, LOG_EVENT.school, LOG_EVENT.aura, LOG_EVENT.amount = ...;
- end,
- SPELL_AURA_APPLIED_DOSE = function (...)
- wipe(LOG_EVENT);
- LOG_EVENT.type = "aura";
- LOG_EVENT.dose = true;
- LOG_EVENT.spellID, LOG_EVENT.spellName, LOG_EVENT.school, LOG_EVENT.aura, LOG_EVENT.amount = ...;
- end,
- SPELL_AURA_REMOVED = function (...)
- wipe(LOG_EVENT);
- LOG_EVENT.type = "aura";
- LOG_EVENT.faded = true;
- LOG_EVENT.spellID, LOG_EVENT.spellName, LOG_EVENT.school, LOG_EVENT.aura, LOG_EVENT.amount = ...;
- end,
- SPELL_AURA_REMOVED_DOSE = function (...)
- wipe(LOG_EVENT);
- LOG_EVENT.type = "aura";
- LOG_EVENT.faded = true;
- LOG_EVENT.dose = true;
- LOG_EVENT.spellID, LOG_EVENT.spellName, LOG_EVENT.school, LOG_EVENT.aura, LOG_EVENT.amount = ...;
- end,
- ENCHANT_APPLIED = function (...)
- wipe(LOG_EVENT);
- LOG_EVENT.type = "enchant";
- LOG_EVENT.spellName, LOG_EVENT.itemID, LOG_EVENT.itemName = ...;
- end,
- ENCHANT_REMOVED = function (...)
- wipe(LOG_EVENT);
- LOG_EVENT.type = "enchant";
- LOG_EVENT.faded = true;
- LOG_EVENT.spellName, LOG_EVENT.itemID, LOG_EVENT.itemName = ...;
- end,
- SPELL_CAST_START = function (...)
- wipe(LOG_EVENT);
- LOG_EVENT.type = "cast";
- LOG_EVENT.spellID, LOG_EVENT.spellName, LOG_EVENT.school = ...;
- end,
- PARTY_KILL = function (...)
- wipe(LOG_EVENT);
- LOG_EVENT.type = "kill";
- end,
- SPELL_EXTRA_ATTACKS = function (...)
- wipe(LOG_EVENT);
- LOG_EVENT.type = "extraattacks";
- LOG_EVENT.spellID, LOG_EVENT.spellName, LOG_EVENT.school, LOG_EVENT.amount = ...;
- end
-};
-local FULL_PARSE = {
- SPELL_AURA_APPLIED = true,
- SPELL_AURA_REMOVED = true,
- SPELL_AURA_APPLIED_DOSE = true,
- SPELL_AURA_REMOVED_DOSE = true,
- SPELL_CAST_START = true,
-};
-local PROXY_UNITS = { player = true, pet = true };
-
-local function flagTest(a, b, c)
- if(c) then
- if(bit_band(a, b) > 0) then return true end
- else
- if(bit_band(a, b) == b) then return true end
- end
-end
-
--[[ LIB CALLBACK STORAGE ]]--
lib.Triggers = {};
lib.FireOnce = {};
lib.LockCallback = {};
lib.UnlockCallback = {};
-lib.EventCallback = {};
--[[ EVENT TRIGGERING ]]--
@@ -392,89 +155,6 @@ function lib:OnUnlock(callback)
end
end
-function lib:Register(event, obj, callback)
- local key = obj.Schema
- if(not self.EventCallback[event]) then
- self.EventCallback[event] = {}
- end
- self.EventCallback[event][key] = callback;
-end;
-
-function lib:Unregister(event, obj)
- local key = obj.Schema
- if((not self.EventCallback[event]) or (not self.EventCallback[event][key])) then
- return
- end
- self.EventCallback[event][key] = nil;
-end;
-
-function lib:BroadCast(event)
- if(not self.EventCallback[event]) then return end;
- for key,fn in pairs(self.EventCallback[event]) do
- local obj = CoreObject[key];
- local _, catch = pcall(fn, obj, LOG_EVENT)
- if(catch) then
- CoreObject:HandleError("Librarian:Events", "BroadCast", catch)
- end
- end
-end;
-
---[[ COMBAT LOG PARSING ]]--
-
-function lib:COMBAT_LOG_EVENT_UNFILTERED(timestamp, event, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags, ...)
- local fn = COMBAT_LOG_EVENTS[event]
- if (not fn) then return end
-
- if (sourceGUID == destGUID and _T[destGUID] and event == "SPELL_DAMAGE") then
- local skillID = ...
- if (skillID == _R[destGUID]) then
- _T[destGUID] = nil;
- _R[destGUID] = nil;
- sourceGUID = playerGUID;
- sourceName = playerName;
- sourceFlags = FLAGS_ME;
- end
- end
-
- local sourceUnit = unitMap[sourceGUID] or petMap[sourceGUID];
- local destUnit = unitMap[destGUID] or petMap[destGUID];
- if ((not sourceUnit) and flagTest(sourceFlags, FLAGS_MINE)) then
- sourceUnit = flagTest(sourceFlags, FLAGS_MY_GUARDIAN) and "pet" or "player";
- end
- if ((not destUnit) and flagTest(destFlags, FLAGS_MINE)) then
- destUnit = flagTest(destFlags, FLAGS_MY_GUARDIAN) and "pet" or "player";
- end
- if ((not FULL_PARSE[event]) and (not PROXY_UNITS[sourceUnit]) and (not PROXY_UNITS[destUnit])) then
- return;
- end
-
- fn(...)
-
- LOG_EVENT.hostile = flagTest(sourceFlags, COMBATLOG_OBJECT_REACTION_HOSTILE)
- LOG_EVENT.sourceGUID = sourceGUID
- LOG_EVENT.sourceName = sourceName
- LOG_EVENT.sourceFlags = sourceFlags
- LOG_EVENT.sourceUnit = sourceUnit
- LOG_EVENT.destGUID = destGUID
- LOG_EVENT.destName = destName
- LOG_EVENT.destFlags = destFlags
- LOG_EVENT.destUnit = destUnit
-
- if (LOG_EVENT.type == "miss" and LOG_EVENT.miss == "REFLECT" and LOG_EVENT.destUnit == "player") then
- for guid, reflectTime in pairs(_T) do
- if (timestamp - reflectTime > REFLECT_HOLD_TIME) then
- _T[guid] = nil
- _R[guid] = nil
- end
- end
-
- _T[sourceGUID] = timestamp
- _R[sourceGUID] = LOG_EVENT.spellID
- end
-
- self:BroadCast()
-end
-
--[[ COMMON EVENTS ]]--
function lib:PLAYER_REGEN_DISABLED(...)
@@ -516,5 +196,4 @@ end
lib.EventManager = CreateFrame("Frame", nil)
lib.EventManager:RegisterEvent("PLAYER_REGEN_DISABLED")
lib.EventManager:RegisterEvent("PLAYER_REGEN_ENABLED")
-lib.EventManager:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
lib.EventManager:SetScript("OnEvent", Library_OnEvent)
diff --git a/SVUI_!Core/libs/_SVUI_Lib/Parser.lua b/SVUI_!Core/libs/_SVUI_Lib/Parser.lua
index ef5bba6..2045127 100644
--- a/SVUI_!Core/libs/_SVUI_Lib/Parser.lua
+++ b/SVUI_!Core/libs/_SVUI_Lib/Parser.lua
@@ -95,16 +95,14 @@ local lib = Librarian:NewLibrary("Parser")
if not lib then return end -- No upgrade needed
--- timeStamp, event, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags, ...
-
--[[ LIB STORAGE ]]--
-lib.Callbacks = {};
+lib.EventCallback = {};
--[[ EVENT HANDLING ]]--
local LOG_EVENT, _R, _T = {},{},{};
-local COMBAT_EVENT_HANDLERS = {
+local COMBAT_LOG_EVENTS = {
SWING_DAMAGE = function (...)
wipe(LOG_EVENT);
LOG_EVENT.type = "damage";
@@ -329,10 +327,7 @@ local FULL_PARSE = {
SPELL_AURA_REMOVED_DOSE = true,
SPELL_CAST_START = true,
};
-local PROXY_UNITS = {
- player = true,
- pet = true,
-};
+local PROXY_UNITS = { player = true, pet = true };
local function flagTest(a, b, c)
if(c) then
@@ -341,20 +336,31 @@ local function flagTest(a, b, c)
if(bit_band(a, b) == b) then return true end
end
end
-
--[[ LIB METHODS ]]--
-function lib:Register(obj, fn)
+function lib:Register(event, obj, callback)
+ local key = obj.Schema
+ if(not self.EventCallback[event]) then
+ self.EventCallback[event] = {}
+ end
+ self.EventCallback[event][key] = callback;
+end;
+
+function lib:Unregister(event, obj)
local key = obj.Schema
- self.Callbacks[key] = fn;
+ if((not self.EventCallback[event]) or (not self.EventCallback[event][key])) then
+ return
+ end
+ self.EventCallback[event][key] = nil;
end;
function lib:BroadCast(event)
- for key,fn in pairs(self.Callbacks) do
+ if(not self.EventCallback[event]) then return end;
+ for key,fn in pairs(self.EventCallback[event]) do
local obj = CoreObject[key];
local _, catch = pcall(fn, obj, LOG_EVENT)
if(catch) then
- CoreObject:HandleError("Parser", "BroadCast", catch)
+ CoreObject:HandleError("Librarian:Parser", "BroadCast", catch)
end
end
end;
@@ -362,7 +368,7 @@ end;
--[[ COMBAT LOG PARSING ]]--
function lib:COMBAT_LOG_EVENT_UNFILTERED(timestamp, event, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags, ...)
- local fn = COMBAT_EVENT_HANDLERS[event]
+ local fn = COMBAT_LOG_EVENTS[event]
if (not fn) then return end
if (sourceGUID == destGUID and _T[destGUID] and event == "SPELL_DAMAGE") then
@@ -422,7 +428,7 @@ local Library_OnEvent = function(self, event, ...)
if(fn and type(fn) == "function") then
local _, catch = pcall(fn, self, ...)
if(catch) then
- CoreObject:HandleError("Parser", event, catch)
+ CoreObject:HandleError("Librarian:Parser", event, catch)
end
end
end
diff --git a/SVUI_!Core/system/misc.lua b/SVUI_!Core/system/misc.lua
index bff2e6e..e58ec7b 100644
--- a/SVUI_!Core/system/misc.lua
+++ b/SVUI_!Core/system/misc.lua
@@ -521,145 +521,8 @@ local function StupidHatEventHandler()
end
end
--- local function ChatLogEventHandler(...)
--- local _, subEvent, _, sourceGUID, sourceName, _, _, destGUID, destName, _, _, spellID, _, _, otherSpellID = ...
---
--- if not sourceName then return end
---
--- if(REACTION_INTERRUPT) then
--- if ((spellID == 6770) and (destName == PlayerName) and (subEvent == "SPELL_AURA_APPLIED" or subEvent == "SPELL_AURA_REFRESH")) then
--- local msg = SAPPED_MESSAGE[random(1,6)]
--- SendChatMessage(msg, "SAY")
--- SV:AddonMessage("Sapped by: "..sourceName)
--- DoEmote("CRACK", sourceName)
--- elseif(subEvent == "SPELL_INTERRUPT" and sourceGUID == UnitGUID("player") and IsInGroup()) then
--- SendChatMessage(INTERRUPTED.." "..destName..": "..GetSpellLink(otherSpellID), MsgTest())
--- end
--- end
---
--- if(REACTION_WOOT) then
--- for key, value in pairs(Reactions.Woot) do
--- if spellID == key and value == true and destName == PlayerName and sourceName ~= PlayerName and (subEvent == "SPELL_AURA_APPLIED" or subEvent == "SPELL_CAST_SUCCESS") then
--- Thanks_Emote(sourceName)
--- --SendChatMessage(L["Thanks for "]..GetSpellLink(spellID)..", "..sourceName, "WHISPER", nil, sourceName)
--- print(GetSpellLink(spellID)..L[" received from "]..sourceName)
--- end
--- end
--- end
---
--- if(REACTION_LOOKY) then
--- local outbound;
--- local spells = Reactions.LookWhatICanDo
--- local _, _, difficultyID = GetInstanceInfo()
---
--- if(difficultyID ~= 0 and subEvent == "SPELL_CAST_SUCCESS") then
--- if(not (sourceGUID == UnitGUID("player") and sourceName == PlayerName)) then
--- for i, spells in pairs(spells) do
--- if(spellID == spells) then
--- if(destName == nil) then
--- outbound = (L["%s used a %s."]):format(sourceName, GetSpellLink(spellID))
--- else
--- outbound = (L["%s used a %s."]):format(sourceName, GetSpellLink(spellID).." -> "..destName)
--- end
--- if(REACTION_CHAT) then
--- SendChatMessage(outbound, MsgTest())
--- else
--- print(outbound)
--- end
--- end
--- end
--- else
--- if(not (sourceGUID == UnitGUID("player") and sourceName == PlayerName)) then return end
--- for i, spells in pairs(spells) do
--- if(spellID == spells) then
--- if(destName == nil) then
--- outbound = (L["%s used a %s."]):format(sourceName, GetSpellLink(spellID))
--- else
--- outbound = GetSpellLink(spellID).." -> "..destName
--- end
--- if(REACTION_CHAT) then
--- SendChatMessage(outbound, MsgTest())
--- else
--- print(outbound)
--- end
--- end
--- end
--- end
--- end
--- end
---
--- if(REACTION_SHARE) then
--- if not IsInGroup() or InCombatLockdown() or not subEvent or not spellID then return end
--- if not UnitInRaid(sourceName) and not UnitInParty(sourceName) then return end
---
--- local sourceName = format(sourceName:gsub("%-[^|]+", ""))
--- if(not sourceName) then return end
--- local thanks = false
--- local outbound
--- if subEvent == "SPELL_CAST_SUCCESS" then
--- -- Feasts
--- if (spellID == 126492 or spellID == 126494) then
--- outbound = (L["%s has prepared a %s - [%s]."]):format(sourceName, GetSpellLink(spellID), SPELL_STAT1_NAME)
--- elseif (spellID == 126495 or spellID == 126496) then
--- outbound = (L["%s has prepared a %s - [%s]."]):format(sourceName, GetSpellLink(spellID), SPELL_STAT2_NAME)
--- elseif (spellID == 126501 or spellID == 126502) then
--- outbound = (L["%s has prepared a %s - [%s]."]):format(sourceName, GetSpellLink(spellID), SPELL_STAT3_NAME)
--- elseif (spellID == 126497 or spellID == 126498) then
--- outbound = (L["%s has prepared a %s - [%s]."]):format(sourceName, GetSpellLink(spellID), SPELL_STAT4_NAME)
--- elseif (spellID == 126499 or spellID == 126500) then
--- outbound = (L["%s has prepared a %s - [%s]."]):format(sourceName, GetSpellLink(spellID), SPELL_STAT5_NAME)
--- elseif (spellID == 104958 or spellID == 105193 or spellID == 126503 or spellID == 126504 or spellID == 145166 or spellID == 145169 or spellID == 145196) then
--- outbound = (L["%s has prepared a %s."]):format(sourceName, GetSpellLink(spellID))
--- -- Refreshment Table
--- elseif spellID == 43987 then
--- outbound = (L["%s has prepared a %s."]):format(sourceName, GetSpellLink(spellID))
--- -- Ritual of Summoning
--- elseif spellID == 698 then
--- outbound = (L["%s is casting %s. Click!"]):format(sourceName, GetSpellLink(spellID))
--- -- Piccolo of the Flaming Fire
--- elseif spellID == 18400 then
--- outbound = (L["%s used a %s."]):format(sourceName, GetSpellLink(spellID))
--- end
--- if(outbound) then thanks = true end
--- elseif subEvent == "SPELL_SUMMON" then
--- -- Repair Bots
--- if Reactions.Bots[spellID] then
--- outbound = (L["%s has put down a %s."]):format(sourceName, GetSpellLink(spellID))
--- thanks = true
--- end
--- elseif subEvent == "SPELL_CREATE" then
--- -- Ritual of Souls and MOLL-E
--- if (spellID == 29893 or spellID == 54710) then
--- outbound = (L["%s has put down a %s."]):format(sourceName, GetSpellLink(spellID))
--- thanks = true
--- -- Toys
--- elseif Reactions.Toys[spellID] then
--- outbound = (L["%s has put down a %s."]):format(sourceName, GetSpellLink(spellID))
--- -- Portals
--- elseif Reactions.Portals[spellID] then
--- outbound = (L["%s is casting %s."]):format(sourceName, GetSpellLink(spellID))
--- end
--- elseif subEvent == "SPELL_AURA_APPLIED" then
--- -- Turkey Feathers and Party G.R.E.N.A.D.E.
--- if (spellID == 61781 or ((spellID == 51508 or spellID == 51510) and destName == PlayerName)) then
--- outbound = (L["%s used a %s."]):format(sourceName, GetSpellLink(spellID))
--- end
--- end
---
--- if(outbound) then
--- if(REACTION_CHAT) then
--- SendChatMessage(outbound, MsgTest(true))
--- else
--- print(outbound)
--- end
--- if(thanks and sourceName) then
--- Thanks_Emote(sourceName)
--- end
--- end
--- end
--- end
-local ChatLogEventHandler = function(self, EVENT)
- local subEvent, sourceGUID, sourceName, destGUID, destName, spellID, otherSpellID = EVENT.type, EVENT.sourceGUID, EVENT.sourceName, EVENT.destGUID, EVENT.destName, EVENT.spellID, EVENT.spellID2;
+local function ChatLogEventHandler(...)
+ local _, subEvent, _, sourceGUID, sourceName, _, _, destGUID, destName, _, _, spellID, _, _, otherSpellID = ...
if not sourceName then return end
@@ -795,40 +658,12 @@ local ChatLogEventHandler = function(self, EVENT)
end
end
end
--- local ReactionListener_OnEvent = function(self, event, ...)
--- if(event == "ZONE_CHANGED_NEW_AREA") then
--- StupidHatEventHandler()
--- elseif(event == "COMBAT_LOG_EVENT_UNFILTERED") then
--- ChatLogEventHandler(...)
--- end
--- end
---
--- function SV:ToggleReactions()
--- local settings = SV.db.Extras
---
--- REACTION_INTERRUPT = settings.pvpinterrupt
--- REACTION_WOOT = settings.woot
--- REACTION_LOOKY = settings.lookwhaticando
--- REACTION_SHARE = settings.sharingiscaring
--- REACTION_EMOTE = settings.reactionEmote
--- REACTION_CHAT = settings.reactionChat
---
--- if(settings.stupidhat) then
--- ReactionListener:RegisterEvent("ZONE_CHANGED_NEW_AREA")
--- else
--- ReactionListener:UnregisterEvent("ZONE_CHANGED_NEW_AREA")
--- end
---
--- if(not REACTION_SHARE) and (not REACTION_INTERRUPT) and (not REACTION_WOOT) and (not REACTION_LOOKY) then
--- ReactionListener:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
--- else
--- ReactionListener:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
--- end
--- end
local ReactionListener_OnEvent = function(self, event, ...)
if(event == "ZONE_CHANGED_NEW_AREA") then
StupidHatEventHandler()
+ elseif(event == "COMBAT_LOG_EVENT_UNFILTERED") then
+ ChatLogEventHandler(...)
end
end
@@ -849,9 +684,9 @@ function SV:ToggleReactions()
end
if(not REACTION_SHARE) and (not REACTION_INTERRUPT) and (not REACTION_WOOT) and (not REACTION_LOOKY) then
- SV.Events:Unregister("COMBAT_LOG_EVENT_UNFILTERED", SV)
+ ReactionListener:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
else
- SV.Events:Register("COMBAT_LOG_EVENT_UNFILTERED", SV, ChatLogEventHandler)
+ ReactionListener:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
end
end
diff --git a/SVUI_Maps/Loader.lua b/SVUI_Maps/Loader.lua
index 50307cb..5f00a83 100644
--- a/SVUI_Maps/Loader.lua
+++ b/SVUI_Maps/Loader.lua
@@ -67,6 +67,7 @@ SV.defaults[Schema] = {
["enable"] = true,
["styleType"] = "HORIZONTAL",
["layoutDirection"] = "NORMAL",
+ ["perRow"] = 5,
["buttonSize"] = 28,
["mouseover"] = false,
},
diff --git a/SVUI_Maps/SVUI_Maps.lua b/SVUI_Maps/SVUI_Maps.lua
index a5c8c4f..baedab7 100644
--- a/SVUI_Maps/SVUI_Maps.lua
+++ b/SVUI_Maps/SVUI_Maps.lua
@@ -61,6 +61,7 @@ local MM_COLOR = "darkest"
local MM_BRDR = 0
local MM_SIZE = 240
local MM_BTN_SIZE = 30
+local MM_BTN_ROW = 5
local MM_OFFSET_TOP = (MM_SIZE * 0.07)
local MM_OFFSET_BOTTOM = (MM_SIZE * 0.11)
local MM_WIDTH = MM_SIZE + (MM_BRDR * 2)
@@ -127,9 +128,8 @@ do
MMBBar:SetFrameStrata("LOW")
MMBBar:SetFrameLevel(0)
- local lastButton, anchor, relative, xPos, yPos;
local list = MOD.MinimapButtons
- local count = 1
+ local count,column = 1,0;
for name,btn in pairs(list) do
local preset = btn.preset;
@@ -157,26 +157,21 @@ do
btn:SetFrameStrata("LOW")
btn:SetFrameLevel(20)
btn:SetSize(MM_BTN_SIZE, MM_BTN_SIZE)
+ local xPos, yPos = 0,0;
+ local row = floor(count / MM_BTN_ROW);
if SV.db.Maps.minimapbar.styleType == "HORIZONTAL"then
- anchor = "RIGHT"
- relative = "LEFT"
- xPos = -2;
- yPos = 0
+ xPos = ((MM_BTN_SIZE + 2) * column);
+ yPos = ((MM_BTN_SIZE + 2) * row);
else
- anchor = "TOP"
- relative = "BOTTOM"
- xPos = 0;
- yPos = -2
- end
- if not lastButton then
- btn:SetPoint(anchor, MMBBar, anchor, xPos, yPos)
- else
- btn:SetPoint(anchor, lastButton, relative, xPos, yPos)
+ xPos = ((MM_BTN_SIZE + 2) * row);
+ yPos = ((MM_BTN_SIZE + 2) * column);
end
+ btn:SetPoint("TOPRIGHT", MMBBar, "TOPRIGHT", -xPos, -yPos)
end
- lastButton = btn
- count = count + 1
+ column = column + 1;
+ count = count + 1;
end
+
if (SV.db.Maps.minimapbar.styleType ~= "NOANCHOR" and (count > 0)) then
if SV.db.Maps.minimapbar.styleType == "HORIZONTAL" then
MMBBar:SetWidth((MM_BTN_SIZE * count) + count * 2)
@@ -769,6 +764,7 @@ function MOD:UpdateLocals()
MM_WIDTH = MM_SIZE + (MM_BRDR * 2)
MM_SHAPE = db.mapShape;
MM_BTN_SIZE = db.minimapbar.buttonSize;
+ MM_BTN_ROW = db.minimapbar.perRow;
MM_HEIGHT = (MM_SHAPE == 'RECTANGLE') and (MM_SIZE - (MM_OFFSET_TOP + MM_OFFSET_BOTTOM) + (MM_BRDR * 2)) or MM_WIDTH
WM_ALPHA = GetCVarBool("mapFade")
end