WoWInterface SVN mikma

Compare Revisions

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

Rev 459 → Rev 460

DeathNote.lua
70,7 → 70,7
end
end
 
function f:CHAT_MSG_ADDON(self,prefix,message,channel,name)
function f:CHAT_MSG_ADDON(self,prefix,message,channel,sender)
local playerexists = false
if DeathNoteDB.notereceive and prefix == "DEATHNOTE" then
local name,note = string.split("|",message)
81,7 → 81,7
end
end
if not playerexists then
print("DeathNote: Received message from "..name)
print("DeathNote: Received message from "..sender)
table.insert(DeathNoteDB[realmName],{name,note})
end
end
97,7 → 97,7
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
if name and string.lower(name) == string.lower(v[1]) then
GameTooltip:AddSpacerLine(1,1,0,0)
GameTooltip:AddLine(skull.." "..v[2].." "..skull,1,0,0)
end
134,35 → 134,198
ZoneWatcher:RegisterEvent("ZONE_CHANGED_NEW_AREA")
ZoneWatcher:SetScript("OnEvent", ZoneCheck)
 
local frame = CreateFrame("Frame","DeathNoteFrame")
frame:Hide()
frame:SetBackdrop(GameTooltip:GetBackdrop())
frame:SetBackdropColor(0,0,0)
frame:SetBackdropBorderColor(0.2,0.2,0.2)
frame:SetWidth(240)
frame:SetHeight(155)
frame:SetPoint("CENTER",0,0)
tinsert(UISpecialFrames,"DeathNoteFrame")
 
local title = frame:CreateFontString(nil, "ARTWORK", "GameFontNormal")
title:SetPoint("TOPLEFT", 10, -10)
title:SetText("DeathNote")
 
local subtitle1 = frame:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall")
subtitle1:SetPoint("TOPLEFT", title, "TOPLEFT", 10, -20)
subtitle1:SetText("Who to add?")
 
local editbox1 = CreateFrame('EditBox', "DeathNoteEditbox1", frame)
editbox1:Show()
editbox1:SetAutoFocus(false)
editbox1:SetHeight(32)
editbox1:SetWidth(200)
editbox1:SetFontObject('GameFontHighlightSmall')
editbox1:SetPoint("TOPLEFT",subtitle1,"TOPLEFT",0,-8)
 
local left = editbox1:CreateTexture(nil, "BACKGROUND")
left:SetWidth(8) left:SetHeight(20)
left:SetPoint("LEFT", -5, 0)
left:SetTexture("Interface\\Common\\Common-Input-Border")
left:SetTexCoord(0, 0.0625, 0, 0.625)
 
local right = editbox1:CreateTexture(nil, "BACKGROUND")
right:SetWidth(8) right:SetHeight(20)
right:SetPoint("RIGHT", 0, 0)
right:SetTexture("Interface\\Common\\Common-Input-Border")
right:SetTexCoord(0.9375, 1, 0, 0.625)
 
local center = editbox1:CreateTexture(nil, "BACKGROUND")
center:SetHeight(20)
center:SetPoint("RIGHT", right, "LEFT", 0, 0)
center:SetPoint("LEFT", left, "RIGHT", 0, 0)
center:SetTexture("Interface\\Common\\Common-Input-Border")
center:SetTexCoord(0.0625, 0.9375, 0, 0.625)
 
editbox1:SetScript("OnShow", function(self)
self:SetText("")
end)
editbox1:SetScript("OnEnterPressed", function(self)
self:ClearFocus()
self:HighlightText(0,0)
DeathNoteEditbox2:SetFocus()
DeathNoteEditbox2:HighlightText()
end)
editbox1:SetScript("OnEscapePressed", editbox1.ClearFocus)
editbox1:SetScript("OnEditFocusLost", function(self)
self:ClearFocus()
self:HighlightText(0,0)
end)
editbox1:SetScript("OnEditFocusGained", function(self)
self:HighlightText()
end)
 
local subtitle2 = frame:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall")
subtitle2:SetPoint("TOPLEFT", editbox1, "TOPLEFT", 0, -40)
subtitle2:SetText("Reason for adding?")
 
local editbox2 = CreateFrame('EditBox', "DeathNoteEditbox2", frame)
editbox2:Show()
editbox2:SetAutoFocus(false)
editbox2:SetHeight(32)
editbox2:SetWidth(200)
editbox2:SetFontObject('GameFontHighlightSmall')
editbox2:SetPoint("TOPLEFT",subtitle2,"TOPLEFT",0,-8)
 
local left = editbox2:CreateTexture(nil, "BACKGROUND")
left:SetWidth(8) left:SetHeight(20)
left:SetPoint("LEFT", -5, 0)
left:SetTexture("Interface\\Common\\Common-Input-Border")
left:SetTexCoord(0, 0.0625, 0, 0.625)
 
local right = editbox2:CreateTexture(nil, "BACKGROUND")
right:SetWidth(8) right:SetHeight(20)
right:SetPoint("RIGHT", 0, 0)
right:SetTexture("Interface\\Common\\Common-Input-Border")
right:SetTexCoord(0.9375, 1, 0, 0.625)
 
local center = editbox2:CreateTexture(nil, "BACKGROUND")
center:SetHeight(20)
center:SetPoint("RIGHT", right, "LEFT", 0, 0)
center:SetPoint("LEFT", left, "RIGHT", 0, 0)
center:SetTexture("Interface\\Common\\Common-Input-Border")
center:SetTexCoord(0.0625, 0.9375, 0, 0.625)
 
editbox2:SetScript("OnShow", function(self)
self:SetText("")
end)
editbox2:SetScript("OnEnterPressed", function(self)
self:ClearFocus()
self:HighlightText(0,0)
DeathNoteOkay:Click()
end)
editbox2:SetScript("OnEscapePressed", editbox2.ClearFocus)
editbox2:SetScript("OnEditFocusLost", function(self)
self:ClearFocus()
self:HighlightText(0,0)
end)
editbox2:SetScript("OnEditFocusGained", function(self)
self:HighlightText()
end)
 
local button = CreateFrame("Button", "DeathNoteClose", frame, "UIPanelCloseButton")
button:SetHeight(25)
button:SetWidth(25)
button:SetPoint("TOPRIGHT", frame, "TOPRIGHT", 0, 0)
button:SetScript("OnClick", function()
frame:Hide()
end)
 
local butt = CreateFrame("Button", "DeathNoteOkay", frame)
butt:SetWidth(80) butt:SetHeight(22)
butt:SetDisabledFontObject(GameFontDisable)
butt:SetHighlightFontObject(GameFontHighlight)
butt:SetNormalFontObject(GameFontNormal)
 
-- Textures --
butt:SetNormalTexture("Interface\\Buttons\\UI-Panel-Button-Up")
butt:SetPushedTexture("Interface\\Buttons\\UI-Panel-Button-Down")
butt:SetHighlightTexture("Interface\\Buttons\\UI-Panel-Button-Highlight")
butt:SetDisabledTexture("Interface\\Buttons\\UI-Panel-Button-Disabled")
butt:GetNormalTexture():SetTexCoord(0, 0.625, 0, 0.6875)
butt:GetPushedTexture():SetTexCoord(0, 0.625, 0, 0.6875)
butt:GetHighlightTexture():SetTexCoord(0, 0.625, 0, 0.6875)
butt:GetDisabledTexture():SetTexCoord(0, 0.625, 0, 0.6875)
butt:GetHighlightTexture():SetBlendMode("ADD")
butt:SetText("Okay")
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
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
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,
text = "What's the name of the target?",
hideOnEscape = 1,
exclusive = 1,
text = "Name:",
button1 = "Set",
button2 = "Cancel",
exclusive = 1,
OnShow = function()
getglobal(this:GetName().."EditBox"):SetText("")
getglobal(this:GetName().."EditBox"):SetFocus()
OnShow = function(self)
self.editBox:SetText("")
self.editBox:SetFocus();
end,
OnAccept = function()
deathnote_target = getglobal(this:GetParent():GetName().."EditBox"):GetText()
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,
OnCancel = function()
this:GetParent():Hide()
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,
EditBoxOnEnterPressed = function()
StaticPopupDialogs["DEATHNOTE_TARGET"].OnAccept()
this:GetParent():Hide()
StaticPopup_Show("DEATHNOTE_NOTE")
 
EditBoxOnEscapePressed = function(self)
self:GetParent():Hide()
end,
EditBoxOnEscapePressed = function()
StaticPopupDialogs["DEATHNOTE_TARGET"].OnCancel()
end,
};
 
StaticPopupDialogs["DEATHNOTE_NOTE"] = {
170,32 → 333,72
maxLetters = 50,
whileDead = 1,
timeout = 0,
text = "Why are you adding him?",
hideOnEscape = 1,
exclusive = 1,
hasWideEditBox = 1,
text = "Reason:",
button1 = "Set",
button2 = "Cancel",
exclusive = 1,
OnShow = function()
getglobal(this:GetName().."EditBox"):SetText("")
getglobal(this:GetName().."EditBox"):SetFocus()
OnShow = function(self)
local playerexists = false
for k,v in pairs(DeathNoteDB[realmName]) do
if v[1] == deathnote_target then
self.wideEditBox:SetText(v[2])
playerexists = true
end
end
if not playerexists then
self.wideEditBox:SetText("")
end
self.wideEditBox:SetFocus()
end,
OnAccept = function()
deathnote_note = getglobal(this:GetParent():GetName().."EditBox"):GetText()
table.insert(DeathNoteDB[realmName],{deathnote_target,deathnote_note})
if DeathNoteDB.noteshare and GetNumPartyMembers() > 1 then
SendAddonMessage("DEATHNOTE",deathnote_target.."|"..deathnote_note,"PARTY")
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,
OnCancel = function()
this:GetParent():Hide()
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,
EditBoxOnEnterPressed = function()
StaticPopupDialogs["DEATHNOTE_NOTE"].OnAccept()
this:GetParent():Hide()
EditBoxOnEscapePressed = function(self)
self:GetParent():Hide()
end,
EditBoxOnEscapePressed = function()
StaticPopupDialogs["DEATHNOTE_NOTE"].OnCancel()
end,
};
]]
 
SLASH_DeathNote1 = "/dn"
SLASH_DeathNote2 = "/deathnote"
208,14 → 411,14
ShowItemRefTooltip()
elseif a == "add" then
if b then
deathnote_target = b
StaticPopup_Show("DEATHNOTE_NOTE")
DeathNoteEditbox1:SetText(b)
frame:Show()
else
if not UnitExists("target") then
StaticPopup_Show("DEATHNOTE_TARGET")
frame:Show()
else
deathnote_target = UnitName("target")
StaticPopup_Show("DEATHNOTE_NOTE")
DeathNoteEditbox1:SetText(UnitName("target"))
frame:Show()
end
end
elseif a == "del" then