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" |