/branches/WotLK
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) |
local db = Broadcaster.db.profile |
local msgs = BroadcasterMageMsgs |
--IS THE ADDON IN STANDBY?-- |
if not db.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) |
local max = #msgs.Table |
local random = math.random(max) |
if db.channel == "Self" then |
SendChatMessage(msgs.Table[random] , db.channel) |
self:Print(msgs.Table[random]) |
else |
SendChatMessage(msgs.Table[random] , db.channel) |
end |
end |
end |
--AM I CASTING?-- |
if spell2 == 28272 then |
local max = #msgs.PolyPig |
local random = math.random(max) |
SendChatMessage(msgs.PolyPig[random] , db.channel) |
if db.channel == "Self" then |
self:Print(msgs.PolyPig[random]) |
else |
SendChatMessage(msgs.PolyPig[random] , db.channel) |
end |
--IF TURTLE, THEN TURTLE MESSAGE-- |
elseif spell2 == 28271 then |
local max = #msgs.PolyTurtle |
local random = math.random(max) |
SendChatMessage(msgs.PolyTurtle[random] , db.channel) |
if db.channel == "Self" then |
self:Print(msgs.PolyTurtle[random]) |
else |
SendChatMessage(msgs.PolyTurtle[random] , db.channel) |
end |
--IF SHEEP, THEN SHEEP MESSAGE-- |
else |
local max = #msgs.PolySheep |
local random = math.random(max) |
SendChatMessage(msgs.PolySheep[random] , db.channel) |
if db.channel == "Self" then |
self:Print(msgs.PolySheep[random]) |
else |
SendChatMessage(msgs.PolySheep[random] , db.channel) |
end |
end |
--CLEAR SPELL IDs JUST IN CASE ANOTHER MAGE RESHEEPS MY FOCUS-- |
spell, spell2 = nil |
end |
end |
end |
end |
-- end |
end |
--PORTAL MESSAGES-- |
function Broadcaster:UNIT_SPELLCAST_START() |
function Broadcaster:UNIT_SPELLCAST_START(source, spell) |
local db = Broadcaster.db.profile |
local msgs = BroadcasterMageMsgs |
--IS THE ADDON IN STANDBY AND AM I IN A GROUP?-- |
if not db.standby and db.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 |
if source == "player" and string.match(spell, 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 dest = strtrim(select(2, strsplit(":", spell))) |
--GET RANDOM MESSAGE AND REPLACE %%d WITH DEST-- |
local max = #msgs.Portals |
local random = math.random(max) |
local msg,_ = string.gsub(msgs.Portals[random], "%%d", dest) |
SendChatMessage(msg , db.channel) |
if db.channel == "Self" then |
self:Print(msg) |
else |
SendChatMessage(msg , db.channel) |
end |
end |
end |
-- end |
end |
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: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 |
Broadcaster:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") |
--OPTIONS-- |
L["Standby"] = true |
L["Puts the addon into standby mode, so no messages are sent."] = true |
L["Enable/disable the addon, so no messages are sent."] = true |
L["Config"] = true |
L["Opens the options window."] = true |