/trunk/DisplacedEnergyNazi
set = function(i, v) DisplacedEnergyNazi.db.profile.whisper = v end, |
order = 99, |
}, |
chatFrame = |
{ |
type = 'select', |
width = 'full', |
name = L["Chat Frame"], |
desc = L["Also send to the specified chat frame"], |
disabled = function(i) return not DisplacedEnergyNazi.db.profile.enable or DisplacedEnergyNazi.db.profile.sink20OutputSink == "ChatFrame" end, |
get = function(i) return DisplacedEnergyNazi.db.profile.chatFrame end, |
set = function(i, value) DisplacedEnergyNazi.db.profile.chatFrame = value end, |
values = { ["None"] = L["None"], ["ChatFrame1"] = L["ChatFrame1"], ["ChatFrame2"] = L["ChatFrame2"], ["ChatFrame3"] = L["ChatFrame3"], ["ChatFrame4"] = L["ChatFrame4"], ["ChatFrame5"] = L["ChatFrame5"], ["ChatFrame6"] = L["ChatFrame6"], ["ChatFrame7"] = L["ChatFrame7"], }, |
}, |
}, |
} |
warnDispel = true, |
whisper = false, |
chatFrame = "None", |
}, |
} |
local UnitAfflictedList = { } |
local UnitRemovedList = { } |
local ChatFrames = |
{ |
["ChatFrame1"] = ChatFrame1, |
["ChatFrame2"] = ChatFrame2, |
["ChatFrame3"] = ChatFrame3, |
["ChatFrame4"] = ChatFrame4, |
["ChatFrame5"] = ChatFrame5, |
["ChatFrame6"] = ChatFrame6, |
["ChatFrame7"] = ChatFrame7, |
} |
----------------------------------------------------------------------------- |
local PLAYER_GUID = nil |
local MESSAGE_BOILER = "DislacedEnergyNazi: |cffff0000%s|r" -- warning message text color hardcoded to red, with default text color preamble |
----------------------------------------------------------------------------- |
-- generate warning messages to the appropriate message sink(s) |
local function BroadcastMessage(message) |
if message then |
DEFAULT_CHAT_FRAME:AddMessage(MESSAGE_BOILER:format(message)) |
self:Pour(message, 1, 0, 0) -- LibSink-2.0 |
DisplacedEnergyNazi:Pour(message, 1, 0, 0) -- LibSink-2.0 |
-- chat frame duplicate; only if LibSink-2.0 is not already sending to default chat frame |
local profile = DisplacedEnergyNazi.db.profile |
local chatEnabled = profile.sink20OutputSink ~= "ChatFrame" and profile.chatFrame ~= "None" |
if chatEnabled then |
local chatFrame = ChatFrames[DisplacedEnergyNazi.db.profile.chatFrame] |
if chatFrame then |
chatFrame:AddMessage(message, 1, 0, 0) |
end |
end |
end |
end |
-- whisper a message to an offending player |
local function WhisperMessage(unitName, message) |
if unitName and message then |
SendChatMessage(message, "WHISPER", nil, unitName) |
if DisplacedEnergyNazi.db.profile.whisper then |
if unitName and message then |
-- SendChatMessage(message, "WHISPER", nil, unitName) |
end |
-- SendChatMessage(message, "WHISPER", nil, "Felhoof") -- diagnostic, whispers the tester |
end |
SendChatMessage(message, "WHISPER", nil, "Ransaa") |
end |
----------------------------------------------------------------------------- |
.. " dispelled " .. "/" .. tostring(targetName) .. "/" .. tostring(targetGUId) .. " @ " .. tostring((unitid and ((CheckInteractDistance(unitid, DAMAGE_RANGE) and "11.11") or "OOR")) or "nounit")) |
if unitid and CheckInteractDistance(unitid, DAMAGE_RANGE) then |
message = L["STOP IT"] .. ": " .. originName .. " " .. L["DISPELLED Displaced Energy TOO CLOSE TO OTHERS!!!"] |
local message = L["STOP IT"] .. ": " .. originName .. " " .. L["DISPELLED Displaced Energy TOO CLOSE TO OTHERS!!!"] |
mseq = mseq + 1; ChatFrame7:AddMessage(("%08d "):format(mseq) .. "DisplacedEnergyNazi:SPELL_DISPEL(): " .. MESSAGE_BOILER:format(message)) |
mseq = mseq + 1; ChatFrame7:AddMessage(("%08d "):format(mseq) .. "DisplacedEnergyNazi:SPELL_DISPEL(): " .. MESSAGE_BOILER:format(message)) |
if DisplacedEnergyNazi.db.profile.whisper then |
WhisperMessage(originName, message) |
end |
WhisperMessage(originName, message) |
BroadcastMessage(message) |
end |
end |
end |
local function spell_periodic_damage(timestamp, subtype, originGUId, originName, originFlags, originFlags2, targetGUId, targetName, targetFlags, targetFlags2, spellId, spellName, spellSchool, spellDamage, spellOverkill, school, resisted, blocked, absorbed, critical, glancing, crushing) |
local unitid = UnitGUIdRMap[unitGUId] |
-- Malkorok has done damage to SOMEONE, spit out a diagnostic |
if originName == L["Malkorok"] and spellId == SPELL_ID_DISPLACED_ENERGY then |
local unitid = UnitGUIdRMap[unitGUId] -- get the afflicted unit's unitid |
-- mseq = mseq + 1; ChatFrame7:AddMessage(("%08d "):format(mseq) .. "DisplacedEnergyNazi:SPELL_PERIODIC_DAMAGE(): " .. tostring(subtype) .. "/" .. tostring(spellId) .. "/" .. tostring(spellName) .. "/" .. tostring(spellSchool) .. " || " .. tostring(originGUId) .. "/" .. tostring(originName) .. " -> " .. tostring(targetGUId) .. "/" .. tostring(targetName)) |
mseq = mseq + 1; ChatFrame7:AddMessage(("%08d "):format(mseq) .. "DisplacedEnergyNazi:SPELL_PERIODIC_DAMAGE(): " .. tostring(originName) .. "/" .. tostring(originGUId) |
.. " " .. tostring(spellName) .. "/" .. tostring(spellId) .. " damages " .. "/" .. tostring(targetName) .. "/" .. tostring(targetGUId) .. " @ " .. tostring(unitid and CheckInteractDistance(unitid, DAMAGE_RANGE))) |
.. " " .. tostring(spellName) .. "/" .. tostring(spellId) .. " damages " .. "/" .. tostring(targetName) .. "/" .. tostring(targetGUId) .. " @ " .. tostring(unitid) .. "/" .. tostring(unitid and CheckInteractDistance(unitid, DAMAGE_RANGE))) |
end |
-- if "Displaced Energy" (by spellid) from "Malkorok" does damage to ME... |
if originName == L["Malkorok"] and spellId == SPELL_ID_DISPLACED_ENERGY and targetGUId == PLAYER_GUID then |
-- iterate all units currently afflicted, to see if any are close enough to me to cause this damage, and append them together |
-- iterate all units currently afflicted, to see if any are close enough to ME to cause damage, and append those names together |
local names = nil |
for unitGUId in pairs(UnitAfflictedList) do |
local unitid = UnitGUIdRMap[unitGUId] -- get the afflicted unit's unitid |
if unitid and CheckInteractDistance(unitid, DAMAGE_RANGE) then |
local n, r = UnitName(unitid) |
local fn = n .. (r and ("-" .. r)) or "" |
if DisplacedEnergyNazi.db.profile.whisper then |
WhisperMessage(fn, L["GET AWAY"] .. ": " .. fn .. " " .. L["Displaced Energy is DAMAGING OTHERS!!!"]) |
end |
-- whisper to individual player |
WhisperMessage(fn, L["GET AWAY"] .. ": " .. fn .. " " .. L["Displaced Energy is DAMAGING OTHERS!!!"]) |
-- accumulate all potential culprits, for global message |
names = (names and (names .. ", " .. fn)) or fn |
end |
end |
if names then |
-- if an afflicted unit is close enough to me |
local message = L["GET AWAY"] .. ": " .. names .. " " .. L["Displaced Energy is DAMAGING OTHERS!!!"] |
mseq = mseq + 1; ChatFrame7:AddMessage(("%08d "):format(mseq) .. "DisplacedEnergyNazi:SPELL_AURA_APPLIED(): " .. MESSAGE_BOILER:format(message)) |
mseq = mseq + 1; ChatFrame7:AddMessage(("%08d "):format(mseq) .. "DisplacedEnergyNazi:SPELL_AURA_APPLIED(): " .. MESSAGE_BOILER:format(message)) |
BroadcastMessage(message) |
end |
end |
local message = L["GET AWAY"] .. ": " .. targetName .. " " .. L["AFFLICTED with Displaced Energy!!!"] |
mseq = mseq + 1; ChatFrame7:AddMessage(("%08d "):format(mseq) .. "DisplacedEnergyNazi:SPELL_AURA_APPLIED(): " .. MESSAGE_BOILER:format(message)) |
if DisplacedEnergyNazi.db.profile.whisper then |
WhisperMessage(targetName, message) |
end |
WhisperMessage(targetName, message) |
BroadcastMessage(message) |
end |
end |
--[[ enUS ]] L["Whisper Offending Player"] = "Whisper Offending Player" |
--[[ enUS ]] L["Whisper offending player, in addition to normal output"] = "Whisper offending player, in addition to normal output" |
--[[ enUS ]] L["Chat Frame"] = "Chat Frame" |
--[[ enUS ]] L["Also send to the specified chat frame"] = "Also send to the specified chat frame" |
--[[ enUS ]] L["ChatFrame1"] = "ChatFrame1" |
--[[ enUS ]] L["ChatFrame2"] = "ChatFrame2" |
--[[ enUS ]] L["ChatFrame3"] = "ChatFrame3" |
--[[ enUS ]] L["ChatFrame4"] = "ChatFrame4" |
--[[ enUS ]] L["ChatFrame5"] = "ChatFrame5" |
--[[ enUS ]] L["ChatFrame6"] = "ChatFrame6" |
--[[ enUS ]] L["ChatFrame7"] = "ChatFrame7" |
--[[ enUS ]] L["None"] = "None" |
-- combat log name of the boss |
--[[ enUS ]] L["Malkorok"] = "Malkorok" |
----------------------------------------------------------------------------- |
local MAJOR_VERSION = "0.2.0" |
local MAJOR_VERSION = "0.2.2" |
local MINOR_VERSION = ("$Revision$"):match("%d+") |
local locale = GetLocale() |