/branches
--DEFINE MY LOCALS-- |
local Broadcaster = LibStub("AceAddon-3.0"):GetAddon("Broadcaster") |
local Mage = Broadcaster:NewModule("Mage", "AceEvent-3.0", "AceConsole-3.0") |
local MODNAME = "Mage" |
------------------- |
local L = LibStub("AceLocale-3.0"):GetLocale("Broadcaster") |
local db, msgs |
local player = UnitName("player") |
local spell, spell2 |
local polySpellID = { [118] = true, --rank 1 sheep |
local options = { |
mage = { |
name = "Mage", |
type = "group", |
args = { |
config = { |
name = L["Config"], |
desc = L["Opens the options window."], |
type = "execute", |
func = function() |
LibStub("AceConfigDialog-3.0"):Open("Broadcaster") |
end, |
guiHidden = true, |
poly = { |
name = "Polymorph", |
type = "group", |
arg = MODNAME, |
args = { |
enable = { |
name = "Enable", |
desc = "Announce messages for polymorph.", |
type = "toggle", |
get = function() |
return db.polyenable |
end, |
set = function() |
db.magepolyenable = not db.polyenable |
Broadcaster:Print("Polymorph enabled: "..db.polyenable) |
end, |
}, |
}, |
}, |
port = { |
name = "Portals", |
type = "group", |
arg = MODNAME, |
args = { |
enable = { |
name = "Enable", |
desc = "Announce messages for portals.", |
type = "toggle", |
get = function() |
return db.portenable |
end, |
set = function() |
db.portenable = not db.portenable |
Broadcaster:Print("Polymorph enabled: "..db.portenable) |
end, |
}, |
}, |
}, |
} |
-------------------------------------- |
--VOODOO MAGIC STUFF-- |
-------------------------------------- |
function Mage:OnInitialize() |
self.db = Broadcaster.db:RegisterNamespace(MODNAME, defaults) |
db = self.db.profile |
coredb = Broadcaster.db.profile |
msgs = BroadcasterMageMsgs |
Broadcaster:InjectOptions(MODNAME, options) |
end |
function Mage:OnEnable() |
self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") |
self:RegisterEvent("UNIT_SPELLCAST_START") |
end |
--function Broadcaster:COMBAT_LOG_EVENT_UNFILTERED(event, timestamp, eventType, srcGUID, srcName, srcFlags, dstGUID, dstName, dstFlags, spellID, spellName, spellSchool, eID, eName) |
function Broadcaster:COMBAT_LOG_EVENT_UNFILTERED(event, _, eventType, _, srcName, _, _, _, dstFlags, spellID, spellName, spellSchool, eID, eName) |
local db = Broadcaster.db.profile |
local msgs = BroadcasterMageMsgs |
function Mage:COMBAT_LOG_EVENT_UNFILTERED(event, _, eventType, _, srcName, _, _, _, dstFlags, spellID, spellName, spellSchool, eID, eName) |
--IS THE ADDON IN STANDBY?-- |
-- if not db.standby then |
--FILTER THE COMBAT LOG-- |
end |
--PORTAL MESSAGES-- |
function Broadcaster:UNIT_SPELLCAST_START(source, spell) |
local db = Broadcaster.db.profile |
local msgs = BroadcasterMageMsgs |
function Mage:UNIT_SPELLCAST_START(source, spell) |
--IS THE ADDON IN STANDBY AND AM I IN A GROUP?-- |
-- if not db.standby and db.channel then |
--LOOK FOR PORTAL SPELL CAST BY ME-- |
local options = { |
name = "Broadcaster", |
-- handler = Broadcaster, |
plugins = {}, |
plugins = {}, |
childGroups = "tree", |
type = "group", |
args = { |
standby = { |
--[[standby = { |
name = L["Standby"], |
desc = L["Enable/disable the addon, so no messages are sent."], |
type = "toggle", |
end, |
set = function() |
Broadcaster.db.profile.standby = not Broadcaster.db.profile.standby |
Broadcaster:Print("Standby mode is now set to: "..Broadcaster.db.profile.standby) |
self:Print("Standby mode is now set to: "..Broadcaster.db.profile.standby) |
if Broadcaster.db.profile.standby == false then |
Broadcaster:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED") |
else |
LibStub("AceConfigDialog-3.0"):Open("Broadcaster") |
end, |
guiHidden = true, |
}, |
},]]-- |
channel = { |
name = "Channel", |
desc = "The channel to broadcast your messages to.", |
function Broadcaster:OnInitialize() |
self.db = LibStub("AceDB-3.0"):New("BroadcasterDB", defaults, "Default") |
LibStub("AceConfig-3.0"):RegisterOptionsTable("Broadcaster", options, {"broadcaster", "bc"}) |
LibStub("AceConfig-3.0"):RegisterOptionsTable("Broadcaster", options) --, {"broadcaster", "bc"}) |
self.optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("Broadcaster", "Broadcaster") |
self:RegisterChatCommand("bc", function() LibStub("AceConfigDialog-3.0"):Open("Broadcaster") end) |
self:RegisterChatCommand("broadcaster", function() LibStub("AceConfigDialog-3.0"):Open("Broadcaster") end) |
end |
function Broadcaster:OnEnable() |
--[[function Broadcaster:OnEnable() |
self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") |
--[[ self:RegisterEvent("PARTY_MEMBERS_CHANGED") |
self:RegisterEvent("PARTY_MEMBERS_CHANGED") |
self:RegisterEvent("RAID_ROSTER_UPDATE") |
-- self:RegisterEvent("UNIT_SPELLCAST_START") |
--CHECK IF I'M ALREADY IN A PARTY OR RAID (FROM A RELOAD UI OR DISCONNECT)-- |
BroadcasterChannel = "PARTY" |
elseif GetNumRaidMembers() > 0 then |
BroadcasterChannel = "RAID" |
end]]-- |
end |
end]]-- |
function Broadcaster:InjectOptions(name, opts) |
options.plugins[name] = opts |
end |
--[[ |
--AM I IN A PARTY?-- |
function Broadcaster:PARTY_MEMBERS_CHANGED() |