WoWInterface SVN mikma

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /DeathNote
    from Rev 460 to Rev 461
    Reverse comparison

Rev 460 → Rev 461

DeathNote.lua
34,13 → 34,13
local function checksourceflags(flag)
local HOSTILEUNITFLAG = 0x548
if bit.band(flag,HOSTILEUNITFLAG) == HOSTILEUNITFLAG then
return true
return true
end
end
 
local lastdamage
function f:COMBAT_LOG_EVENT_UNFILTERED(event, timestamp, minievent, guidsource, source, sourceflags, ...)
if DeathNoteDB.autoadd and checksourceflags(sourceflags) then
if checksourceflags(sourceflags) then
if minievent == "SWING_DAMAGE" then
lastdamage = source
elseif minievent == "SPELL_DAMAGE" or minievent == "SPELL_PERIODIC_DAMAGE" then
48,20 → 48,22
elseif minievent == "UNIT_DIED" and lastdamage then
local playername = UnitName("player")
if select(2,...) == playername then
local playerexists = false
local playername = UnitName("player")
local nameexists = false
--local playername = UnitName("player")
local zonename = GetZoneText()
local note = "Killed "..playername.." in "..zonename
for k,v in pairs(DeathNoteDB[realmName]) do
if v[1] == lastdamage then
v[2] = note
playerexists = true
if DeathNoteDB.autoadd then
for k,v in pairs(DeathNoteDB[realmName]) do
if v[1] == lastdamage then
v[2] = note
nameexists = true
end
end
if not nameexists then
print("DeathNote: "..lastdamage.." killed you. Adding in the list.")
table.insert(DeathNoteDB[realmName],{lastdamage,note})
end
end
if not playerexists then
print("DeathNote: "..lastdamage.." killed you. Adding in the list.")
table.insert(DeathNoteDB[realmName],{lastdamage,note})
end
if DeathNoteDB.noteshare and GetNumPartyMembers() > 1 then
SendAddonMessage("DEATHNOTE",lastdamage.."|"..note,"PARTY")
end
71,16 → 73,16
end
 
function f:CHAT_MSG_ADDON(self,prefix,message,channel,sender)
local playerexists = false
local nameexists = false
if DeathNoteDB.notereceive and prefix == "DEATHNOTE" then
local name,note = string.split("|",message)
for k,v in pairs(DeathNoteDB[realmName]) do
if v[1] == name then
v[2] = note
playerexists = true
nameexists = true
end
end
if not playerexists then
if not nameexists then
print("DeathNote: Received message from "..sender)
table.insert(DeathNoteDB[realmName],{name,note})
end
190,11 → 192,11
end)
editbox1:SetScript("OnEscapePressed", editbox1.ClearFocus)
editbox1:SetScript("OnEditFocusLost", function(self)
self:ClearFocus()
self:ClearFocus()
self:HighlightText(0,0)
end)
editbox1:SetScript("OnEditFocusGained", function(self)
self:HighlightText()
self:HighlightText()
end)
 
local subtitle2 = frame:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall")
238,11 → 240,11
end)
editbox2:SetScript("OnEscapePressed", editbox2.ClearFocus)
editbox2:SetScript("OnEditFocusLost", function(self)
self:ClearFocus()
self:ClearFocus()
self:HighlightText(0,0)
end)
editbox2:SetScript("OnEditFocusGained", function(self)
self:HighlightText()
self:HighlightText()
end)
 
local button = CreateFrame("Button", "DeathNoteClose", frame, "UIPanelCloseButton")
273,132 → 275,34
butt:SetPoint("BOTTOM","DeathNoteFrame","BOTTOM",0,10)
butt:SetScript("OnClick", function()
local okay1,okay2
if DeathNoteEditbox1:GetText() == "" or DeathNoteEditbox1:GetText() == "You need to add a name!" then
local name = DeathNoteEditbox1:GetText()
local note = DeathNoteEditbox2:GetText()
if name == "" then
DeathNoteEditbox1:SetText("You need to add a name!")
DeathNoteEditbox1:HighlightText()
else
okay1 = true
end
if DeathNoteEditbox2:GetText() == "" or DeathNoteEditbox2:GetText() == "You need to add a comment!" then
if note == "" then
DeathNoteEditbox2:SetText("You need to add a comment!")
DeathNoteEditbox2:HighlightText()
else
okay2 = true
end
if okay1 and okay2 then
frame:Hide()
end
end)
 
--[[
local deathnote_note,deathnote_target
StaticPopupDialogs["DEATHNOTE_TARGET"] = {
hasEditBox = 1,
maxLetters = 50,
whileDead = 1,
timeout = 0,
hideOnEscape = 1,
exclusive = 1,
text = "Name:",
button1 = "Set",
button2 = "Cancel",
OnShow = function(self)
self.editBox:SetText("")
self.editBox:SetFocus();
end,
OnAccept = function(self)
if not self.editBox:GetText() or self.editBox:GetText() == "" then
return
else
deathnote_target = self.editBox:GetText()
StaticPopup_Show("DEATHNOTE_NOTE")
end
end,
EditBoxOnEnterPressed = function(self)
local parent = self:GetParent()
if not parent.editBox:GetText() or parent.editBox:GetText() == "" then
return
else
deathnote_target = parent.editBox:GetText()
StaticPopup_Show("DEATHNOTE_NOTE")
end
end,
EditBoxOnEscapePressed = function(self)
self:GetParent():Hide()
end,
};
 
StaticPopupDialogs["DEATHNOTE_NOTE"] = {
hasEditBox = 1,
maxLetters = 50,
whileDead = 1,
timeout = 0,
hideOnEscape = 1,
exclusive = 1,
hasWideEditBox = 1,
text = "Reason:",
button1 = "Set",
button2 = "Cancel",
OnShow = function(self)
local playerexists = false
local nameexists = false
for k,v in pairs(DeathNoteDB[realmName]) do
if v[1] == deathnote_target then
self.wideEditBox:SetText(v[2])
playerexists = true
if v[1] == name then
v[2] = note
nameexists = true
end
end
if not playerexists then
self.wideEditBox:SetText("")
if not nameexists then
table.insert(DeathNoteDB[realmName],{name,note})
end
self.wideEditBox:SetFocus()
end,
OnAccept = function(self)
if not self.wideEditBox:GetText() or self.wideEditBox:GetText() == "" then
return
else
deathnote_note = self.wideEditBox:GetText()
local playerexists = false
for k,v in pairs(DeathNoteDB[realmName]) do
if v[1] == deathnote_target then
v[2] = deathnote_note
playerexists = true
end
end
if not playerexists then
table.insert(DeathNoteDB[realmName],{deathnote_target,deathnote_note})
end
if DeathNoteDB.noteshare and GetNumPartyMembers() > 1 then
SendAddonMessage("DEATHNOTE",deathnote_target.."|"..deathnote_note,"PARTY")
end
end
end,
EditBoxOnEnterPressed = function(self)
local parent = self:GetParent()
if not parent.wideEditBox:GetText() or parent.wideEditBox:GetText() == "" then
return
else
deathnote_note = parent.wideEditBox:GetText()
local playerexists = false
for k,v in pairs(DeathNoteDB[realmName]) do
if v[1] == deathnote_target then
v[2] = deathnote_note
playerexists = true
end
end
if not playerexists then
table.insert(DeathNoteDB[realmName],{deathnote_target,deathnote_note})
end
if DeathNoteDB.noteshare and GetNumPartyMembers() > 1 then
SendAddonMessage("DEATHNOTE",deathnote_target.."|"..deathnote_note,"PARTY")
end
end
self:GetParent():Hide()
end,
EditBoxOnEscapePressed = function(self)
self:GetParent():Hide()
end,
};
]]
frame:Hide()
end
end)
 
SLASH_DeathNote1 = "/dn"
SLASH_DeathNote2 = "/deathnote"