/branches
local L = LibStub("AceLocale-3.0"):GetLocale("Broadcaster") |
local player = UnitName("player") |
local Broadcaster.db.profile = db |
local BroadcasterMageMsgs = msgs |
local spell, spell2 |
local polySpellID = { [118] = true, --rank 1 sheep |
[12824] = true, --rank 2 sheep |
--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) |
--IS THE ADDON IN STANDBY?-- |
if not Broadcaster.db.profile.standby then |
if not db.standby then |
--FILTER THE COMBAT LOG-- |
-- local isDestEnemy = (bit.band(dstFlags, COMBATLOG_OBJECT_REACTION_HOSTILE) == COMBATLOG_OBJECT_REACTION_HOSTILE) |
-- local isDestTarget = (bit.band(dstFlags, COMBATLOG_OBJECT_TARGET) == COMBATLOG_OBJECT_TARGET) |
spell = spellID |
end |
--CHECK FOR RITUAL OF REFRESHMENT-- |
if spellID == 43987 and BroadcasterChannel then |
local max = #BroadcasterMageMsgs.Table |
if spellID == 43987 then |
local max = #msgs.Table |
local random = math.random(max) |
SendChatMessage(BroadcasterMageMsgs.Table[random] , Broadcaster.db.profile.channel) |
if db.channel == "Self" then |
SendChatMessage(msgs.Table[random] , db.channel) |
end |
end |
--AM I CASTING?-- |
if spell == spell2 then --and BroadcasterChannel then |
--IF PIG, THEN PIGGIE MESSAGE-- |
if spell2 == 28272 then |
local max = #BroadcasterMageMsgs.PolyPig |
local max = #msgs.PolyPig |
local random = math.random(max) |
SendChatMessage(BroadcasterMageMsgs.PolyPig[random] , Broadcaster.db.profile.channel) |
SendChatMessage(msgs.PolyPig[random] , db.channel) |
--IF TURTLE, THEN TURTLE MESSAGE-- |
elseif spell2 == 28271 then |
local max = #BroadcasterMageMsgs.PolyTurtle |
local max = #msgs.PolyTurtle |
local random = math.random(max) |
SendChatMessage(BroadcasterMageMsgs.PolyTurtle[random] , Broadcaster.db.profile.channel) |
SendChatMessage(msgs.PolyTurtle[random] , db.channel) |
--IF SHEEP, THEN SHEEP MESSAGE-- |
else |
local max = #BroadcasterMageMsgs.PolySheep |
local max = #msgs.PolySheep |
local random = math.random(max) |
SendChatMessage(BroadcasterMageMsgs.PolySheep[random] , Broadcaster.db.profile.channel) |
SendChatMessage(msgs.PolySheep[random] , db.channel) |
end |
--CLEAR SPELL IDs JUST IN CASE ANOTHER MAGE RESHEEPS MY FOCUS-- |
spell, spell2 = nil |
--PORTAL MESSAGES-- |
function Broadcaster:UNIT_SPELLCAST_START() |
--IS THE ADDON IN STANDBY AND AM I IN A GROUP?-- |
if not Broadcaster.db.profile.standby and Broadcaster.db.profile.channel then |
if not db.standby and db.channel then |
--LOOK FOR PORTAL SPELL CAST BY ME-- |
if arg1 == "player" and string.match(arg2, L["Portal:"]) then |
--TRIM SPELL NAME TO GET DESTINATION-- |
local dest = strtrim(select(2, strsplit(":", arg2))) |
--GET RANDOM MESSAGE AND REPLACE %d WITH DEST-- |
local max = #BroadcasterMageMsgs.Portals |
local max = #msgs.Portals |
local random = math.random(max) |
local msg,_ = string.gsub(BroadcasterMageMsgs.Portals[random], "%%d", dest) |
SendChatMessage(msg , Broadcaster.db.profile.channel) |
local msg,_ = string.gsub(msgs.Portals[random], "%%d", dest) |
SendChatMessage(msg , db.channel) |
end |
end |
end |
args = { |
standby = { |
name = L["Standby"], |
desc = L["Puts the addon into standby mode, so no messages are sent."], |
desc = L["Enable/disable the addon, so no messages are sent."], |
type = "toggle", |
get = function() return Broadcaster.db.profile.standby end, |
set = function() Broadcaster.db.profile.standby = not Broadcaster.db.profile.standby end |
get = function() |
return Broadcaster.db.profile.standby |
end, |
set = function() |
Broadcaster.db.profile.standby = not Broadcaster.db.profile.standby |
Broadcaster:AddMessage("Standby mode is now set to: "..Broadcaster.db.profile.standby) |
if Broadcaster.db.profile.standby = false then |
Broadcaster:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED") |
else |
Broadcaster:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") |
end |
end, |
}, |
config = { |
name = L["Config"], |
type = "execute", |
func = function() |
LibStub("AceConfigDialog-3.0"):Open("Broadcaster") |
end |
end, |
guiHidden = true, |
}, |
channel = { |
name = "Channel", |