/branches
local class = select(2, UnitClass("player")) |
--ARE YOU A PALADIN?-- |
if select(2, UnitClass("player")) ~= "PALADIN" then |
if class ~= "PALADIN" then |
return |
end |
--DEFINE MY LOCALS-- |
--local L = LibStub("AceLocale-3.0"):GetLocale("Broadcaster") |
local Broadcaster = LibStub("AceAddon-3.0"):GetAddon("Broadcaster") |
local Paladin = Broadcaster:NewModule("Paladin", "AceEvent-3.0", "AceConsole-3.0") |
------------------- |
local L = LibStub("AceLocale-3.0"):GetLocale("Broadcaster") |
local db, msgs |
local list, replacee, replacer, custom, msg |
local pick = {"Default", "Custom", "Both"} |
local player = UnitName("player") |
--local spell, spell2 |
local redemptionSpellID = { [7328] = true, --rank 1 redemption |
[10322] = true, --rank 2 redemption |
[10324] = true, --rank 3 redemption |
[20773] = true, --rank 5 redemption |
} |
local defaults = { |
profile = { |
redemptenable = true, |
redemptchoose = "Default", |
}, |
} |
local options = { |
redempt = { |
name = "Redemption", |
type = "group", |
arg = class, |
args = { |
enable = { |
name = "Enable", |
desc = "Announce messages for redemption.", |
type = "toggle", |
order = 1, |
get = function() |
return db.redemptenable |
end, |
set = function() |
db.redemptenable = not db.redemptenable |
end, |
}, |
pick = { |
name = "Pull messages from...", |
desc = "Use the default messages, your own, or both.", |
type = "select", |
order = 2, |
values = {"Default", "Custom", "Both"}, |
get = function() |
for k, v in pairs(pick) do |
if db.redemptchoose == v then |
return k |
end |
end |
end, |
set = function(_, choose) |
db.redemptchoose = pick[choose] |
end, |
}, |
custom = { |
name = "Custom messages", |
desc = "Enter in any custom messages you would like to use, one per line.", |
type = "input", |
order = 3, |
multiline = true, |
width = "double", |
get = function() return db.customredempt end, |
set = function(_, value) db.customredempt = value end, |
}, |
}, |
}, |
} |
-- INITIALIZE ADDON -- |
function Paladin:OnInitialize() |
self.db = Broadcaster.db:RegisterNamespace(class, defaults) |
db = self.db.profile |
coredb = Broadcaster.db.profile |
msgs = BroadcasterPaladinMsgs |
Broadcaster:InjectOptions(class, options) |
end |
function Paladin:OnEnable() |
self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") |
end |
-- CREATE AND SEND MESSAGES -- |
function Paladin:CompileMessage(list, replacee, replacer, custom) |
if custom then |
local pool = (#list + #custom) |
if math.random(pool) <= #custom then |
list = custom |
end |
end |
local max = #list |
local random = math.random(max) |
if replacee and replacer then |
msg = string.gsub(list[random], replacee, replacer) |
else |
msg = list[random] |
end |
if coredb.channel == "Self" then |
self:Print(msg) |
else |
SendChatMessage(msg, coredb.channel) |
end |
replacee, replacer, custom = nil |
end |
-------------------------------------- |
--VOODOO MAGIC STUFF-- |
-------------------------------------- |
--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 |
--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 isDestFocus = (bit.band(dstFlags, COMBATLOG_OBJECT_FOCUS) == COMBATLOG_OBJECT_FOCUS) |
--AM I CASTING?-- |
if eventType == "SPELL_CAST_START" and srcName == player then |
--AND AM I CASTING REDEMPTION?-- |
if redemptionSpellID[spellID] then |
local max = #BroadcasterPaladinMsgs.Redemption |
local random = math.random(max) |
SendChatMessage(BroadcasterPaladinMsgs.Redemption[random] , Broadcaster.db.profile.channel) |
--AM I CASTING?-- |
if eventType == "SPELL_CAST_START" and srcName == player then |
--AND AM I CASTING REDEMPTION?-- |
if redemptionSpellID[spellID] then |
list = msgs.Redemption |
if db.redemptchoose == "Custom" then |
list = {strsplit("\n", db.customredempt)} |
elseif db.redemptchoose == "Both" then |
custom = {strsplit("\n", db.customredempt)} |
end |
self:CompileMessage(list, custom) |
end |
end |
end |
local class = select(2, UnitClass("player")) |
--ARE YOU A MAGE?-- |
if select(2, UnitClass("player")) ~= "MAGE" then |
if class ~= "MAGE" then |
return |
end |
--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 list, replacee, replacer, custom, msg |
local pick = {"Default", "Custom", "Both"} |
local player = UnitName("player") |
local spell, spell2 |
local polySpellID = { [118] = true, --rank 1 sheep |
[28271] = true, --rank 1 turtle |
[28272] = true --rank 1 pig |
} |
local portSpellID = { [11419] = true, --Darnassus |
[32266] = true, --Exodar |
[11416] = true, --Ironforge |
[11417] = true, --Orgrimmar |
[33691] = true, --Shattrath (Alliance) |
[35717] = true, --Shattrath (Horde) |
[32267] = true, --Silvermoon |
[49361] = true, --Stonard |
[10059] = true, --Stormwind |
[49360] = true, --Theramore |
[11420] = true, --Thunder Bluff |
[11418] = true --Undercity |
} |
local defaults = { |
profile = { |
polyenable = true, |
polychoose = "Default", |
portenable = true, |
portchoose = "Default", |
tableenable = true, |
tablechoose = "Default", |
}, |
} |
local options = { |
poly = { |
name = "Polymorph", |
type = "group", |
arg = MODNAME, |
arg = class, |
args = { |
enable = { |
name = "Enable", |
desc = "Announce messages for polymorph.", |
type = "toggle", |
order = 1, |
get = function() |
return db.polyenable |
end, |
set = function() |
db.magepolyenable = not db.polyenable |
Broadcaster:Print("Polymorph enabled: "..db.polyenable) |
db.polyenable = not db.polyenable |
end, |
}, |
pick = { |
name = "Pull messages from...", |
desc = "Use the default messages, your own, or both.", |
type = "select", |
order = 2, |
values = {"Default", "Custom", "Both"}, |
get = function() |
for k, v in pairs(pick) do |
if db.polychoose == v then |
return k |
end |
end |
end, |
set = function(_, choose) |
db.polychoose = pick[choose] |
end, |
}, |
custom = { |
name = "Custom messages", |
desc = "Enter in any custom messages you would like to use, one per line.", |
type = "input", |
order = 3, |
multiline = true, |
width = "double", |
get = function() return db.custompoly end, |
set = function(_, value) db.custompoly = value end, |
}, |
}, |
}, |
port = { |
name = "Portals", |
type = "group", |
arg = MODNAME, |
arg = class, |
args = { |
enable = { |
name = "Enable", |
desc = "Announce messages for portals.", |
type = "toggle", |
order = 1, |
get = function() |
return db.portenable |
end, |
set = function() |
db.portenable = not db.portenable |
Broadcaster:Print("Polymorph enabled: "..db.portenable) |
end, |
}, |
pick = { |
name = "Pull messages from...", |
desc = "Use the default messages, your own, or both.", |
type = "select", |
order = 2, |
values = {"Default", "Custom", "Both"}, |
get = function() |
for k, v in pairs(pick) do |
if db.portchoose == v then |
return k |
end |
end |
end, |
set = function(_, choose) |
db.portchoose = pick[choose] |
end, |
}, |
custom = { |
name = "Custom messages", |
desc = "Enter in any custom messages you would like to use, one per line.", |
type = "input", |
order = 3, |
multiline = true, |
width = "double", |
get = function() return db.customport end, |
set = function(_, value) db.customport = value end, |
}, |
}, |
}, |
table = { |
name = "Ritual of Refreshment", |
type = "group", |
arg = class, |
args = { |
enable = { |
name = "Enable", |
desc = "Announce messages for tables.", |
type = "toggle", |
order = 1, |
get = function() |
return db.tableenable |
end, |
set = function() |
db.tableenable = not db.tableenable |
end, |
}, |
pick = { |
name = "Pull messages from...", |
desc = "Use the default messages, your own, or both.", |
type = "select", |
order = 2, |
values = {"Default", "Custom", "Both"}, |
get = function() |
for k, v in pairs(pick) do |
if db.tablechoose == v then |
return k |
end |
end |
end, |
set = function(_, choose) |
db.tablechoose = pick[choose] |
end, |
}, |
custom = { |
name = "Custom messages", |
desc = "Enter in any custom messages you would like to use, one per line.", |
type = "input", |
order = 3, |
multiline = true, |
width = "double", |
get = function() return db.customtable end, |
set = function(_, value) db.customtable = value end, |
}, |
}, |
}, |
} |
-------------------------------------- |
--VOODOO MAGIC STUFF-- |
-------------------------------------- |
-- INITIALIZE ADDON -- |
function Mage:OnInitialize() |
self.db = Broadcaster.db:RegisterNamespace(MODNAME, defaults) |
self.db = Broadcaster.db:RegisterNamespace(class, defaults) |
db = self.db.profile |
coredb = Broadcaster.db.profile |
msgs = BroadcasterMageMsgs |
Broadcaster:InjectOptions(MODNAME, options) |
Broadcaster:InjectOptions(class, options) |
end |
function Mage:OnEnable() |
self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") |
self:RegisterEvent("UNIT_SPELLCAST_START") |
-- 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) |
-- CREATE AND SEND MESSAGES -- |
function Mage:CompileMessage(list, custom, replacee, replacer) |
if custom then |
local pool = (#list + #custom) |
if math.random(pool) <= #custom then |
list = custom |
end |
end |
local max = #list |
local random = math.random(max) |
if replacee and replacer then |
msg = string.gsub(list[random], replacee, replacer) |
else |
msg = list[random] |
end |
if coredb.channel == "Self" then |
self:Print(msg) |
else |
SendChatMessage(msg, db.channel) |
end |
custom, replacee, replacer = nil |
end |
-------------------------------------- |
--VOODOO MAGIC STUFF-- |
-------------------------------------- |
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-- |
-- 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 isDestFocus = (bit.band(dstFlags, COMBATLOG_OBJECT_FOCUS) == COMBATLOG_OBJECT_FOCUS) |
if eventType == "SPELL_CAST_SUCCESS" and srcName == player then --removed "and isDestFocus" to try to remedy Zidomo's problem |
--CHECK FOR PoM POLY-- |
if polySpellID[spellID] then |
spell = spellID |
--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 isDestFocus = (bit.band(dstFlags, COMBATLOG_OBJECT_FOCUS) == COMBATLOG_OBJECT_FOCUS) |
if eventType == "SPELL_CAST_SUCCESS" and srcName == player then --removed "and isDestFocus" to try to remedy Zidomo's problem |
--CHECK FOR PoM POLY-- |
if polySpellID[spellID] then |
spell = spellID |
end |
--CHECK FOR RITUAL OF REFRESHMENT-- |
if spellID == 43987 then |
list = msgs.Table |
if db.tablechoose == "Custom" then |
list = {strsplit("\n", db.customtable)} |
elseif db.tablechoose == "Both" then |
custom = {strsplit("\n", db.customtable)} |
end |
--CHECK FOR RITUAL OF REFRESHMENT-- |
if spellID == 43987 then |
local max = #msgs.Table |
local random = math.random(max) |
if db.channel == "Self" then |
self:Print(msgs.Table[random]) |
else |
SendChatMessage(msgs.Table[random] , db.channel) |
end |
end |
self:CompileMessage(list, custom) |
end |
--AM I CASTING?-- |
if eventType == "SPELL_CAST_START" and srcName == player then |
--AND AM I CASTING POLYMORPH?-- |
if polySpellID[spellID] then |
spell = spellID |
--CHECK FOR PORTALS-- |
if portSpellID[spellID] then |
--TRIM SPELL NAME TO GET DESTINATION-- |
local dest = strtrim(select(2, strsplit(":", spellName))) |
list = msgs.Portals |
replacee = "%%d" |
replacer = dest |
if db.portchoose == "Custom" then |
list = {strsplit("\n", db.customport)} |
elseif db.portchoose == "Both" then |
custom = {strsplit("\n", db.customport)} |
end |
self:CompileMessage(list, custom, replacee, replacer) |
end |
--AM I CASTING?-- |
if eventType == "SPELL_CAST_START" and srcName == player then |
--AND AM I CASTING POLYMORPH?-- |
if polySpellID[spellID] then |
spell = spellID |
end |
--DID MY FOCUS GET POLYMORPHED?-- |
if eventType == "SPELL_AURA_APPLIED" and isDestFocus then |
if polySpellID[spellID] then |
spell2 = spellID |
--WAS IT CAST BY ME?-- |
if spell == spell2 then --and BroadcasterChannel then |
--IF PIG, THEN PIGGIE MESSAGE-- |
if spell2 == 28272 then |
local max = #msgs.PolyPig |
local random = math.random(max) |
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) |
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) |
if db.channel == "Self" then |
self:Print(msgs.PolySheep[random]) |
else |
SendChatMessage(msgs.PolySheep[random] , db.channel) |
end |
end |
end |
--DID MY FOCUS GET POLYMORPHED?-- |
if eventType == "SPELL_AURA_APPLIED" and isDestFocus then |
if polySpellID[spellID] then |
spell2 = spellID |
--WAS IT CAST BY ME?-- |
if spell == spell2 then |
--IF PIG, THEN PIGGIE MESSAGE-- |
if spell2 == 28272 then |
list = msgs.PolyPig |
--IF TURTLE, THEN TURTLE MESSAGE-- |
elseif spell2 == 28271 then |
list = msgs.PolyTurtle |
--IF SHEEP, THEN SHEEP MESSAGE-- |
else |
list = msgs.PolySheep |
end |
if db.polychoose == "Custom" then |
list = {strsplit("\n", db.custompoly)} |
elseif db.polychoose == "Both" then |
custom = {strsplit("\n", db.custompoly)} |
end |
self:CompileMessage(list, custom) |
--CLEAR SPELL IDs JUST IN CASE ANOTHER MAGE RESHEEPS MY FOCUS-- |
spell, spell2 = nil |
end |
end |
end |
-- end |
end |
end |
--PORTAL MESSAGES-- |
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-- |
if source == "player" and string.match(spell, L["Portal:"]) then |
--TRIM SPELL NAME TO GET DESTINATION-- |
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) |
if db.channel == "Self" then |
self:Print(msg) |
else |
SendChatMessage(msg , db.channel) |
end |
--[[function Mage:UNIT_SPELLCAST_START(source, spell) |
--LOOK FOR PORTAL SPELL CAST BY ME-- |
if source == "player" and string.match(spell, L["Portal:"]) then |
--TRIM SPELL NAME TO GET DESTINATION-- |
local dest = strtrim(select(2, strsplit(":", spell))) |
list = msgs.Portals |
replacee = "%%d" |
replacer = dest |
if db.portchoose == "Custom" then |
list = {strsplit("\n", db.customport)} |
elseif db.portchoose == "Both" then |
custom = {strsplit("\n", db.customport)} |
end |
-- end |
end |
self:CompileMessage(list, custom, replacee, replacer) |
end |
end]]-- |
local class = select(2, UnitClass("player")) |
--ARE YOU A PRIEST?-- |
if select(2, UnitClass("player")) ~= "PRIEST" then |
if class ~= "PRIEST" then |
return |
end |
--DEFINE MY LOCALS-- |
--local L = LibStub("AceLocale-3.0"):GetLocale("Broadcaster") |
local Broadcaster = LibStub("AceAddon-3.0"):GetAddon("Broadcaster") |
local Priest = Broadcaster:NewModule("Priest", "AceEvent-3.0", "AceConsole-3.0") |
------------------- |
local L = LibStub("AceLocale-3.0"):GetLocale("Broadcaster") |
local db, msgs |
local list, replacee, replacer, custom, msg |
local pick = {"Default", "Custom", "Both"} |
local player = UnitName("player") |
--local spell, spell2 |
local resurrectionSpellID = { [2006] = true, --rank 1 resurrection |
[2010] = true, --rank 2 resurrection |
[10880] = true, --rank 3 resurrection |
[25435] = true --rank 6 resurrection |
} |
local defaults = { |
profile = { |
resenable = true, |
reschoose = "Default", |
}, |
} |
local options = { |
res = { |
name = "Resurrection", |
type = "group", |
arg = class, |
args = { |
enable = { |
name = "Enable", |
desc = "Announce messages for resurrection.", |
type = "toggle", |
order = 1, |
get = function() |
return db.resenable |
end, |
set = function() |
db.resenable = not db.resenable |
end, |
}, |
pick = { |
name = "Pull messages from...", |
desc = "Use the default messages, your own, or both.", |
type = "select", |
order = 2, |
values = {"Default", "Custom", "Both"}, |
get = function() |
for k, v in pairs(pick) do |
if db.reschoose == v then |
return k |
end |
end |
end, |
set = function(_, choose) |
db.reschoose = pick[choose] |
end, |
}, |
custom = { |
name = "Custom messages", |
desc = "Enter in any custom messages you would like to use, one per line.", |
type = "input", |
order = 3, |
multiline = true, |
width = "double", |
get = function() return db.customres end, |
set = function(_, value) db.customres = value end, |
}, |
}, |
}, |
} |
-- INITIALIZE ADDON -- |
function Priest:OnInitialize() |
self.db = Broadcaster.db:RegisterNamespace(class, defaults) |
db = self.db.profile |
coredb = Broadcaster.db.profile |
msgs = BroadcasterPriestMsgs |
Broadcaster:InjectOptions(class, options) |
end |
function Priest:OnEnable() |
self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") |
end |
-- CREATE AND SEND MESSAGES -- |
function Priest:CompileMessage(list, custom, replacee, replacer) |
if custom then |
local pool = (#list + #custom) |
if math.random(pool) <= #custom then |
list = custom |
end |
end |
local max = #list |
local random = math.random(max) |
if replacee and replacer then |
msg = string.gsub(list[random], replacee, replacer) |
else |
msg = list[random] |
end |
if coredb.channel == "Self" then |
self:Print(msg) |
else |
SendChatMessage(msg, coredb.channel) |
end |
custom, replacee, replacer = nil |
end |
-------------------------------------- |
--VOODOO MAGIC STUFF-- |
-------------------------------------- |
--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 |
--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 isDestFocus = (bit.band(dstFlags, COMBATLOG_OBJECT_FOCUS) == COMBATLOG_OBJECT_FOCUS) |
--AM I CASTING?-- |
if eventType == "SPELL_CAST_START" and srcName == player then |
--AND AM I CASTING RESURRECTION?-- |
if resurrectionSpellID[spellID] then |
local max = #BroadcasterPriestMsgs.Resurrection |
local random = math.random(max) |
SendChatMessage(BroadcasterPriestMsgs.Resurrection[random] , Broadcaster.db.profile.channel) |
if eventType == "SPELL_CAST_START" and srcName == player then |
--AND AM I CASTING RESURRECTION?-- |
if resurrectionSpellID[spellID] then |
list = msgs.Resurrection |
if db.reschoose == "Custom" then |
list = {strsplit("\n", db.customres)} |
elseif db.reschoose == "Both" then |
custom = {strsplit("\n", db.customres)} |
end |
self:CompileMessage(list, custom) |
end |
end |
end |
local class = select(2, UnitClass("player")) |
--ARE YOU A DRUID?-- |
if select(2, UnitClass("player")) ~= "DRUID" then |
if class ~= "DRUID" then |
return |
end |
--DEFINE MY LOCALS-- |
--local L = LibStub("AceLocale-3.0"):GetLocale("Broadcaster") |
local Broadcaster = LibStub("AceAddon-3.0"):GetAddon("Broadcaster") |
local Druid = Broadcaster:NewModule("Druid", "AceEvent-3.0", "AceConsole-3.0") |
------------------- |
local L = LibStub("AceLocale-3.0"):GetLocale("Broadcaster") |
local db, msgs |
local list, replacee, replacer, custom, msg |
local pick = {"Default", "Custom", "Both"} |
local player = UnitName("player") |
--local spell, spell2 |
local rebirthSpellID = { [20484] = true, --rank 1 rebirth |
[20739] = true, --rank 2 rebirth |
[20742] = true, --rank 3 rebirth |
[26994] = true --rank 6 rebirth |
} |
local defaults = { |
profile = { |
rebirthenable = true, |
rebirthchoose = "Default", |
}, |
} |
local options = { |
rebirth = { |
name = "Rebirth", |
type = "group", |
arg = class, |
args = { |
enable = { |
name = "Enable", |
desc = "Announce messages for rebirth.", |
type = "toggle", |
order = 1, |
get = function() |
return db.rebirthenable |
end, |
set = function() |
db.rebirthenable = not db.rebirthenable |
end, |
}, |
pick = { |
name = "Pull messages from...", |
desc = "Use the default messages, your own, or both.", |
type = "select", |
order = 2, |
values = {"Default", "Custom", "Both"}, |
get = function() |
for k, v in pairs(pick) do |
if db.rebirthchoose == v then |
return k |
end |
end |
end, |
set = function(_, choose) |
db.rebirthchoose = pick[choose] |
end, |
}, |
custom = { |
name = "Custom messages", |
desc = "Enter in any custom messages you would like to use, one per line.", |
type = "input", |
order = 3, |
multiline = true, |
width = "double", |
get = function() return db.customrebirth end, |
set = function(_, value) db.customrebirth = value end, |
}, |
}, |
}, |
} |
-- INITIALIZE ADDON -- |
function Druid:OnInitialize() |
self.db = Broadcaster.db:RegisterNamespace(class, defaults) |
db = self.db.profile |
coredb = Broadcaster.db.profile |
msgs = BroadcasterDruidMsgs |
Broadcaster:InjectOptions(class, options) |
end |
function Druid:OnEnable() |
self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") |
end |
-- CREATE AND SEND MESSAGES -- |
function Druid:CompileMessage(list, replacee, replacer, custom) |
if custom then |
local pool = (#list + #custom) |
if math.random(pool) <= #custom then |
list = custom |
end |
end |
local max = #list |
local random = math.random(max) |
if replacee and replacer then |
msg = string.gsub(list[random], replacee, replacer) |
else |
msg = list[random] |
end |
if coredb.channel == "Self" then |
self:Print(msg) |
else |
SendChatMessage(msg, coredb.channel) |
end |
replacee, replacer, custom = nil |
end |
-------------------------------------- |
--VOODOO MAGIC STUFF-- |
-------------------------------------- |
--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 |
--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 isDestFocus = (bit.band(dstFlags, COMBATLOG_OBJECT_FOCUS) == COMBATLOG_OBJECT_FOCUS) |
--AM I CASTING?-- |
if eventType == "SPELL_CAST_START" and srcName == player then |
--AND AM I CASTING REBIRTH?-- |
if rebirthSpellID[spellID] then |
local max = #BroadcasterDruidMsgs.Rebirth |
local random = math.random(max) |
SendChatMessage(BroadcasterDruidMsgs.Rebirth[random] , Broadcaster.db.profile.channel) |
list = msgs.Rebirth |
if db.rebirthchoose == "Custom" then |
list = {strsplit("\n", db.customrebirth)} |
elseif db.rebirthchoose == "Both" then |
custom = {strsplit("\n", db.customrebirth)} |
end |
self:CompileMessage(list, custom) |
end |
end |
end |
local class = select(2, UnitClass("player")) |
--ARE YOU A SHAMAN?-- |
if select(2, UnitClass("player")) ~= "SHAMAN" then |
if class ~= "SHAMAN" then |
return |
end |
--DEFINE MY LOCALS-- |
--local L = LibStub("AceLocale-3.0"):GetLocale("Broadcaster") |
local Broadcaster = LibStub("AceAddon-3.0"):GetAddon("Broadcaster") |
local Shaman = Broadcaster:NewModule("Shaman", "AceEvent-3.0", "AceConsole-3.0") |
------------------- |
local L = LibStub("AceLocale-3.0"):GetLocale("Broadcaster") |
local db, msgs |
local list, replacee, replacer, custom, msg |
local pick = {"Default", "Custom", "Both"} |
local player = UnitName("player") |
--local spell, spell2 |
local ancSpiritSpellID = { [2008] = true, --rank 1 ancSpirit |
[20609] = true, --rank 2 ancSpirit |
[20610] = true, --rank 3 ancSpirit |
[20777] = true, --rank 5 ancSpirit |
} |
local defaults = { |
profile = { |
ancspenable = true, |
ancspchoose = "Default", |
}, |
} |
local options = { |
ancsp = { |
name = "Ancestral Spirit", |
type = "group", |
arg = class, |
args = { |
enable = { |
name = "Enable", |
desc = "Announce messages for ancestral spirit.", |
type = "toggle", |
order = 1, |
get = function() |
return db.ancspenable |
end, |
set = function() |
db.ancspenable = not db.ancspenable |
end, |
}, |
pick = { |
name = "Pull messages from...", |
desc = "Use the default messages, your own, or both.", |
type = "select", |
order = 2, |
values = {"Default", "Custom", "Both"}, |
get = function() |
for k, v in pairs(pick) do |
if db.ancspchoose == v then |
return k |
end |
end |
end, |
set = function(_, choose) |
db.ancspchoose = pick[choose] |
end, |
}, |
custom = { |
name = "Custom messages", |
desc = "Enter in any custom messages you would like to use, one per line.", |
type = "input", |
order = 3, |
multiline = true, |
width = "double", |
get = function() return db.customancsp end, |
set = function(_, value) db.customancsp = value end, |
}, |
}, |
}, |
} |
-- INITIALIZE ADDON -- |
function Shaman:OnInitialize() |
self.db = Broadcaster.db:RegisterNamespace(class, defaults) |
db = self.db.profile |
coredb = Broadcaster.db.profile |
msgs = BroadcasterShamanMsgs |
Broadcaster:InjectOptions(class, options) |
end |
function Shaman:OnEnable() |
self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") |
end |
-- CREATE AND SEND MESSAGES -- |
function Shaman:CompileMessage(list, custom, replacee, replacer) |
if custom then |
local pool = (#list + #custom) |
if math.random(pool) <= #custom then |
list = custom |
end |
end |
local max = #list |
local random = math.random(max) |
if replacee and replacer then |
msg = string.gsub(list[random], replacee, replacer) |
else |
msg = list[random] |
end |
if coredb.channel == "Self" then |
self:Print(msg) |
else |
SendChatMessage(msg, coredb.channel) |
end |
custom, replacee, replacer = nil |
end |
-------------------------------------- |
--VOODOO MAGIC STUFF-- |
-------------------------------------- |
--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 |
--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 isDestFocus = (bit.band(dstFlags, COMBATLOG_OBJECT_FOCUS) == COMBATLOG_OBJECT_FOCUS) |
--AM I CASTING?-- |
if eventType == "SPELL_CAST_START" and srcName == player then |
--AND AM I CASTING ANCESTRALSPIRIT?-- |
if ancSpiritSpellID[spellID] then |
local max = #BroadcasterShamanMsgs.AncestralSpirit |
local random = math.random(max) |
SendChatMessage(BroadcasterShamanMsgs.AncestralSpirit[random] , Broadcaster.db.profile.channel) |
if eventType == "SPELL_CAST_START" and srcName == player then |
--AND AM I CASTING ANCESTRALSPIRIT?-- |
if ancSpiritSpellID[spellID] then |
list = msgs.AncestralSpirit |
if db.ancspchoose == "Custom" then |
list = {strsplit("\n", db.customancsp)} |
elseif db.ancspchoose == "Both" then |
custom = {strsplit("\n", db.customancsp)} |
end |
self:CompileMessage(list, custom) |
end |
end |
end |
--need to set up defaults-- |
----------------------------------- |
--MEAT AND POTATOES-- |
----------------------------------- |
Broadcaster = LibStub("AceAddon-3.0"):NewAddon("Broadcaster", "AceConsole-3.0", "AceEvent-3.0") |
local L = LibStub("AceLocale-3.0"):GetLocale("Broadcaster") |
local chan = {"RAID", "PARTY", "Self"} |
local defaults = { |
profile = { |
channel = "Self", |
}, |
} |
--OPTIONS-- |
local options = { |
name = "Broadcaster", |