From 1dcb9b43428afeb0d7627a3122445c7575c4629c Mon Sep 17 00:00:00 2001 From: Relintai Date: Wed, 11 May 2016 14:52:59 +0200 Subject: [PATCH] -I added a dependeny to the TBC version, Here are the modified files, so they are the same. (Trinkettracker, it's not needed here, as in WotLK the pvptrinket fires a SPELL_CAST_SUCCESS event). --- Rekt.lua | 16 ++++++++++++++++ data/global.lua | 29 +++++++++++++++++++++++++++++ data/optiontable.lua | 22 ++++++++++++++++++++++ 3 files changed, 67 insertions(+) diff --git a/Rekt.lua b/Rekt.lua index 0ba765e..d99fa96 100644 --- a/Rekt.lua +++ b/Rekt.lua @@ -221,6 +221,9 @@ function Rekt:OnInitialize() aceCDialog:AddToBlizOptions("Rekt"); self:RegisterChatCommand("Rekt", "ChatCommand"); + for k, v in pairs(Rekt.modules) do + v["Initialise"](); + end end function Rekt:OnEnable() @@ -230,6 +233,7 @@ function Rekt:OnEnable() self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED"); self:RegisterEvent("PLAYER_TARGET_CHANGED"); self:RegisterEvent("PLAYER_FOCUS_CHANGED"); + --self:RegisterEvent("CHAT_MSG_ADDON"); self:CreateFrames("target"); self:CreateFrames("focus"); self:CreateDRFrames("targetdr"); @@ -273,6 +277,7 @@ function Rekt:OnDisable() self:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED"); self:UnregisterEvent("PLAYER_TARGET_CHANGED"); self:UnregisterEvent("PLAYER_FOCUS_CHANGED"); + --self:UnregisterEvent("CHAT_MSG_ADDON"); self.Reset(); end @@ -399,6 +404,17 @@ function Rekt:ZONE_CHANGED_NEW_AREA() end end +--[[ +function Rekt:CHAT_MSG_ADDON(prefix, message, channel, sender) + --self:Print(prefix .. " " .. message .. " " .. channel .. " " .. sender); + if message == "GladdyTrinketUsed" then + --Rekt:AddCd(srcGUID, spellID, eventType, srcFlags); + --SendAddonMessage("GladdyTrinketUsed", destGUID) + Rekt:AddCd(channel, 42292, "SPELL_CAST_SUCCESS", 0); + end +end +]]-- + function Rekt:ApplySettings() local db = Rekt.db.profile; diff --git a/data/global.lua b/data/global.lua index 82a34c1..93cf87d 100644 --- a/data/global.lua +++ b/data/global.lua @@ -4,6 +4,35 @@ Rekt.appName = "Rekt" Rekt.dbName = "RektDB" Rekt.version = "1.05" +Rekt.modules = {} + +function Rekt:NewTrinketTrackerModule(name, priority, defaults) + local module = CreateFrame("Frame") + module.name = name + module.priority = priority or 0 + module.defaults = defaults or {} + module.messages = {} + + module.RegisterMessage = function(self, message, func) + self.messages[message] = func or message + end + + module.GetOptions = function() + return nil + end + + if defaults then + for k, v in pairs(defaults) do + self:Print(k); + Rekt.defaults.profile[k] = v; + end + end + + self.modules[name] = module + + return module +end + function Rekt:HideFrames() for i = 1, 23 do local frame = self.frames["target"][i]["frame"]; diff --git a/data/optiontable.lua b/data/optiontable.lua index e0acccd..ebf078a 100644 --- a/data/optiontable.lua +++ b/data/optiontable.lua @@ -720,6 +720,28 @@ function Rekt:getGlobalOptions() end }, } + + --[[ + --100+ (Modules) + local ordern = 1; + for k, v in pairs(self.modules) do + local options = v:GetOptions() + + args["moduleheader" .. ordern] = { + type = "header", name = "Other settings", order = 100 * ordern + }; + + local orderic = 1; + for k1, v1 in pairs(options) do + args[k1] = { + type = v1["type"], name = v1["name"], order = (100 * ordern) + orderic + }; + end + + ordern = ordern + 1 + end + ]]-- + return args; end