/DeathNote
DeathNote = {} |
DeathNote.Defaults = { |
[realmName] = {}, |
[realmName] = {}, |
autoadd = true, |
noteshare = true, |
notereceive = true, |
version = 1, |
version = DBVersion, |
} |
if not DeathNoteDB then DeathNoteDB = DeathNote.Defaults end |
local f = CreateFrame("frame") |
f:SetScript("OnEvent", function(self, event, ...) |
if self[event] then return self[event](self, event, ...) end |
if self[event] then return self[event](self, event, ...) end |
end) |
function DeathNote:Enable() |
f:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") |
f:RegisterEvent("UPDATE_MOUSEOVER_UNIT") |
f:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") |
f:RegisterEvent("UPDATE_MOUSEOVER_UNIT") |
f:RegisterEvent("CHAT_MSG_ADDON") |
f:RegisterEvent("PLAYER_LOGIN") |
end |
function DeathNote:Disable() |
f:UnregisterAllEvents() |
f:UnregisterAllEvents() |
end |
DeathNote:Enable() |
local function checksourceflags(flag) |
local HOSTILEUNITFLAG = 0x548 |
if bit.band(flag,HOSTILEUNITFLAG) == HOSTILEUNITFLAG then |
return true |
end |
local HOSTILEUNITFLAG = 0x548 |
if bit.band(flag,HOSTILEUNITFLAG) == HOSTILEUNITFLAG then |
return true |
end |
end |
local lastdamage |
end |
function f:CHAT_MSG_ADDON(self,prefix,message,channel,name) |
if DeathNoteDB.notereceive and prefix == "DEATHNOTE" then |
print("DeathNote: Received message from "..name) |
if DeathNoteDB.notereceive and prefix == "DEATHNOTE" then |
print("DeathNote: Received message from "..name) |
local name,note = string.split("|",message) |
table.insert(DeathNoteDB[realmName],{name,note}) |
end |
end |
end |
function f:PLAYER_LOGIN() |
if not DeathNoteDB.version or DeathNoteDB.version ~= DBVersion then |
DeathNoteDB = DeathNote.Defaults |
print("DeathNote: Database reset!") |
end |
if not DeathNoteDB.version or DeathNoteDB.version ~= DBVersion then |
DeathNoteDB = DeathNote.Defaults |
print("DeathNote: Database reset!") |
end |
end |
local function OnTooltipSetUnit(tooltip, ...) |
local name = UnitName("mouseover") |
for k,v in pairs(DeathNoteDB[realmName]) do |
if string.lower(name) == string.lower(v[1]) then |
local name = UnitName("mouseover") |
for k,v in pairs(DeathNoteDB[realmName]) do |
if string.lower(name) == string.lower(v[1]) then |
GameTooltip:AddSpacerLine(1,1,0,0) |
GameTooltip:AddLine(skull.." "..v[2].." "..skull,1,0,0) |
end |
end |
end |
end |
if origsetunit then |
return origsetunit(tooltip, ...) |
end |
end |
local function ZoneCheck() |
local instancetype = select(2,GetInstanceInfo()) |
if instancetype == "none" then |
local instancetype = select(2,GetInstanceInfo()) |
if instancetype == "none" then |
DeathNote:Enable() |
else |
DeathNote:Disable() |
DeathNote:Disable() |
end |
end |
SLASH_DeathNote2 = "/deathnote" |
SlashCmdList["DeathNote"] = function(slash) |
local a,b = string.split(" ",slash,2) |
if a == "wipe" then |
table.wipe(DeathNoteDB[realmName]) |
if a == "wipe" then |
table.wipe(DeathNoteDB[realmName]) |
print("DeathNote: Wiped database") |
elseif a == "list" then |
elseif a == "list" then |
ShowItemRefTooltip() |
elseif a == "add" then |
if b then |
ShowUIPanel(ItemRefTooltip) |
if not ItemRefTooltip:IsShown() then ItemRefTooltip:SetOwner(UIParent, "ANCHOR_PRESERVE") end |
ItemRefTooltip:ClearLines() |
ItemRefTooltip:AddLine("DeathNote slashcommand:") |
ItemRefTooltip:AddLine("/deathnote wipe",1,1,1) |
ItemRefTooltip:AddLine("DeathNote slashcommand:") |
ItemRefTooltip:AddLine("/deathnote wipe",1,1,1) |
ItemRefTooltip:AddLine(" - Clear the database.") |
ItemRefTooltip:AddLine("/deathnote list",1,1,1) |
ItemRefTooltip:AddLine("/deathnote list",1,1,1) |
ItemRefTooltip:AddLine(" - Shows the list of people to kill with reasons.") |
ItemRefTooltip:AddLine("/deathnote add [name]",1,1,1) |
ItemRefTooltip:AddLine(" - Add name in the list. Name is not required.") |
ItemRefTooltip:AddLine("/deathnote notereceive",1,1,1) |
ItemRefTooltip:AddLine(" - Toggle notereceiving from party.") |
ItemRefTooltip:Show() |
end |
end |
end |