-Found, and implemented a fix for the combatlog stuck bug. (Rarely happens here, but it happened a few times.)

-Empty string as the type i spells.lua is a bad idea, just spent an hour tracking down a bug because of that.
--(it errors in the sorters), added a type everywhere, and also documented it.
(Commit ported from TBC version)
This commit is contained in:
Relintai 2016-05-10 11:04:53 +02:00
parent db89d1beed
commit 4c9292cfa0
3 changed files with 45 additions and 10 deletions

View File

@ -6,6 +6,11 @@ local aceConfig = LibStub("AceConfig-3.0");
local libSharedMedia = LibStub("LibSharedMedia-3.0"); local libSharedMedia = LibStub("LibSharedMedia-3.0");
local libDRData = LibStub('DRData-1.0'); local libDRData = LibStub('DRData-1.0');
Rect.CombatlogFixTimerData = {
["lasttick"] = 0,
["timesinceclear"] = 0
}
Rect.MovableFrames = nil Rect.MovableFrames = nil
Rect.targets = { Rect.targets = {
@ -194,15 +199,16 @@ function Rect:OnInitialize()
aceConfig:RegisterOptionsTable("Rect", self:GetRectOptions()); aceConfig:RegisterOptionsTable("Rect", self:GetRectOptions());
aceCDialog:AddToBlizOptions("Rect"); aceCDialog:AddToBlizOptions("Rect");
self:RegisterChatCommand("Rect", "ChatCommand"); self:RegisterChatCommand("Rect", "ChatCommand");
end end
function Rect:OnEnable() function Rect:OnEnable()
self:Reset() self:Reset()
self:RegisterEvent("PLAYER_ENTERING_WORLD") self:RegisterEvent("PLAYER_ENTERING_WORLD");
self:RegisterEvent("ZONE_CHANGED_NEW_AREA") self:RegisterEvent("ZONE_CHANGED_NEW_AREA");
self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED");
self:RegisterEvent("PLAYER_TARGET_CHANGED") self:RegisterEvent("PLAYER_TARGET_CHANGED");
self:RegisterEvent("PLAYER_FOCUS_CHANGED") self:RegisterEvent("PLAYER_FOCUS_CHANGED");
self:CreateFrames("target"); self:CreateFrames("target");
self:CreateFrames("focus"); self:CreateFrames("focus");
self:CreateDRFrames("targetdr"); self:CreateDRFrames("targetdr");
@ -210,15 +216,41 @@ function Rect:OnEnable()
self:CreateDRFrames("selfdr"); self:CreateDRFrames("selfdr");
self:ApplySettings(); self:ApplySettings();
self.targets["self"] = UnitGUID("player"); self.targets["self"] = UnitGUID("player");
--cause, and basic fix from:
--from http://www.arenajunkies.com/topic/125096-combat-log-error-screwing-up-your-addons-supposed-fix/
local f = CreateFrame("Frame", nil, UIParent);
f:SetScript("OnUpdate", function() self:CombatLogClearFix() end);
end end
function Rect:CombatLogClearFix()
--delta is in seconds
local delta = GetTime() - Rect.CombatlogFixTimerData["lasttick"];
--this will happen on the first run, this is here, becouse on the first test,
--the first clear on load just bugged the addon, until the second clear
if delta > 30 then
return;
end
local tslc = Rect.CombatlogFixTimerData["timesinceclear"] + delta;
--30 seconds should be enough
if tslc >= 30 then
CombatLogClearEntries();
tslc = 0;
end
Rect.CombatlogFixTimerData["timesinceclear"] = tslc;
Rect.CombatlogFixTimerData["lasttick"] = GetTime();
end
function Rect:OnDisable() function Rect:OnDisable()
self:UnregisterEvent("PLAYER_ENTERING_WORLD") self:UnregisterEvent("PLAYER_ENTERING_WORLD");
self:UnregisterEvent("ZONE_CHANGED_NEW_AREA") self:UnregisterEvent("ZONE_CHANGED_NEW_AREA");
self:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED") self:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED");
self:UnregisterEvent("PLAYER_TARGET_CHANGED") self:UnregisterEvent("PLAYER_TARGET_CHANGED");
self:UnregisterEvent("PLAYER_FOCUS_CHANGED") self:UnregisterEvent("PLAYER_FOCUS_CHANGED");
self.Reset(); self.Reset();
end end

View File

@ -40,6 +40,7 @@ function Rect:ReassignCds(which)
if (db[which]["colorframeenabled"]) then if (db[which]["colorframeenabled"]) then
local colorframe = Rect.frames[which][i]["colorframe"]; local colorframe = Rect.frames[which][i]["colorframe"];
--self:Print(v["spellID"] .. " cat: " .. v["spellCategory"]); --self:Print(v["spellID"] .. " cat: " .. v["spellCategory"]);
colorframe:SetBackdropColor(db["color"][v["spellCategory"]]["r"], colorframe:SetBackdropColor(db["color"][v["spellCategory"]]["r"],
db["color"][v["spellCategory"]]["g"], db["color"][v["spellCategory"]]["g"],
db["color"][v["spellCategory"]]["b"], db["color"][v["spellCategory"]]["b"],

View File

@ -2,6 +2,8 @@
-- [42292] ={120, nil, 120, 120, 120, 0, "", "anticc", false}, --PvP Trinket -- [42292] ={120, nil, 120, 120, 120, 0, "", "anticc", false}, --PvP Trinket
-- spellid cd reset spec1cd, spec2cd, spec3cd, spec, class, type, ispetspell --comment -- spellid cd reset spec1cd, spec2cd, spec3cd, spec, class, type, ispetspell --comment
--!IMPORTANT type, has to match one from the list below, nor can it be empty, you will get Lua errors from Sorters!
--spellid -> the spell's id --spellid -> the spell's id
--cd -> base cooldown for the spell, this will be used until the spec is detected (if its on, else this will be used) --cd -> base cooldown for the spell, this will be used until the spec is detected (if its on, else this will be used)
-- NOTE: cds are in seconds, and if the tooltip shows like 2.1M then you convert it like this: 2.1 * 60 = 126 -- NOTE: cds are in seconds, and if the tooltip shows like 2.1M then you convert it like this: 2.1 * 60 = 126