1
0
Fork 0

Fixed the Prat and RBS modules detecting their respective addons

This commit is contained in:
pigmonkey 2011-05-30 19:32:56 -04:00
parent f81b074aac
commit 9099e06a0d
2 changed files with 46 additions and 47 deletions

View file

@ -9,51 +9,54 @@ local options = {
function mod:OnInitialize() function mod:OnInitialize()
db = core.db.profile[self:GetName()] or {} db = core.db.profile[self:GetName()] or {}
self:RegisterEvent("ADDON_LOADED")
end end
function mod:ADDON_LOADED(_, name) function mod:OnEnable()
if name == "Prat" then if Prat then
local module = Prat.Addon:GetModule('AltNames') self:ModifyPrat()
Prat.RegisterMessageItem('ALTNAMES', 'PLAYER') self.OnEnable = nil
module.padfmt = '||%s' end
module.setMainPos = function() end end
-- Prevent dropdown menu option from being displayed function mod:ModifyPrat()
module.menusAdded = true local module = Prat.Addon:GetModule('AltNames')
Prat.RegisterMessageItem('ALTNAMES', 'PLAYER')
module.padfmt = '||%s'
module.setMainPos = function() end
-- /run Prat.Addon:ChatFrame_MessageEventHandler(ChatFrame1, "CHAT_MSG_SYSTEM", "Batche has gone offline.", "", "", "", "", "", 0, 0, "", 0, 3991, "", 0, true, false) -- Prevent dropdown menu option from being displayed
-- PreAddMessage hook to limit main print to 3 characters and make sure player is added for logouts module.menusAdded = true
local PreAddMessage = module.Prat_PreAddMessage
module.Prat_PreAddMessage = function(self, e, message, frame, event, ...)
-- check to see if we have a log off
if event == "CHAT_MSG_SYSTEM" then
-- .MESSAGE contains modified message with color, .OUTPUT contains raw
local p, m = message.OUTPUT:match("(%S+)( has gone offline.*)")
if p then
local class = Prat.Addon:GetModule('PlayerNames'):GetData(p)
-- inline coloring won't work (fires before) so we do it manually
-- set PLAYERLINK for AltNames to read
message.MESSAGE, message.PLAYER, message.PLAYERLINK = m, Prat.CLR:Player(p, p:lower(), class), p
end
end
-- call normal -- /run Prat.Addon:ChatFrame_MessageEventHandler(ChatFrame1, "CHAT_MSG_SYSTEM", "Batche has gone offline.", "", "", "", "", "", 0, 0, "", 0, 3991, "", 0, true, false)
PreAddMessage(self, e, message, frame, event, ...) -- PreAddMessage hook to limit main print to 3 characters and make sure player is added for logouts
local PreAddMessage = module.Prat_PreAddMessage
-- unset PLAYERLINK if we have a log off so as not to have it display module.Prat_PreAddMessage = function(self, e, message, frame, event, ...)
if not message.lL or message.lL == "" then -- check to see if we have a log off
message.PLAYERLINK = nil if event == "CHAT_MSG_SYSTEM" then
end -- .MESSAGE contains modified message with color, .OUTPUT contains raw
local p, m = message.OUTPUT:match("(%S+)( has gone offline.*)")
-- limit to 3 characters in the main if p then
if message.ALTNAMES and message.ALTNAMES ~= "" then local class = Prat.Addon:GetModule('PlayerNames'):GetData(p)
-- 12 characters of color padding; so sub(1, 12+length) -- inline coloring won't work (fires before) so we do it manually
self.ALTNAMES = self.ALTNAMES:sub(1, 15).."|r" -- set PLAYERLINK for AltNames to read
message.ALTNAMES = self.ALTNAMES message.MESSAGE, message.PLAYER, message.PLAYERLINK = m, Prat.CLR:Player(p, p:lower(), class), p
end end
end end
self:UnregisterEvent("ADDON_LOADED") -- call normal
PreAddMessage(self, e, message, frame, event, ...)
-- unset PLAYERLINK if we have a log off so as not to have it display
if not message.lL or message.lL == "" then
message.PLAYERLINK = nil
end
-- limit to 3 characters in the main
if message.ALTNAMES and message.ALTNAMES ~= "" then
-- 12 characters of color padding; so sub(1, 12+length)
self.ALTNAMES = self.ALTNAMES:sub(1, 15).."|r"
message.ALTNAMES = self.ALTNAMES
end
end end
end end

View file

@ -9,23 +9,19 @@ local options = {
function mod:OnInitialize() function mod:OnInitialize()
db = core.db.profile[self:GetName()] or {} db = core.db.profile[self:GetName()] or {}
self:RegisterEvent("ADDON_LOADED")
end end
function mod:ADDON_LOADED(_, name) function mod:OnEnable()
if name == "RaidBuffStatus" then if RaidBuffStatus then
if RaidBuffStatus then self:SecureHook(RaidBuffStatus, "SetupFrames", "SetupRBS")
self:SecureHook(RaidBuffStatus, "SetupFrames", "SetupRBS") end
end
self:UnregisterEvent("ADDON_LOADED")
end
end end
function mod:RunMacro(name) function mod:RunMacro(name)
local macros = core:GetModule("Macros") local macros = core:GetModule("Macros")
if not macros or not macros[name] then return end if not macros or not macros[name] then return end
macros[name]() macros[name](macros)
end end
local didSetup = false local didSetup = false