Advertisement
SmooKy

Untitled

Apr 11th, 2020
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.58 KB | None | 0 0
  1. local function MassMail()
  2. if not mailFrame then
  3. mailFrame = AceGUI:Create("Window");
  4. mailFrame:SetTitle("Ravencrest Union Mailing");
  5. mailFrame:SetStatusText("")
  6. mailFrame:SetWidth(600);
  7. mailFrame:SetLayout("Flow")
  8. core:setEscapeHandler(mailFrame,function()
  9. mailFrame:Hide();
  10. mailFrame = false
  11.  
  12. end)
  13. mailEditBox = AceGUI:Create("MultiLineEditBox");
  14. mailEditBox:SetFullWidth(true)
  15. mailEditBox:SetNumLines(28);
  16. mailEditBox:SetLabel("Syntax: Name:Amount | Each line represents a mail!")
  17. mailEditBox:DisableButton(true)
  18.  
  19. send_mail_button = AceGUI:Create("Button")
  20. send_mail_button:SetText("Send Mails")
  21. send_mail_button:SetWidth(150)
  22. send_mail_button:SetHeight(19)
  23.  
  24. send_mail_button:SetCallback('OnClick', function(widget, event, text) -- begin scanning
  25. print("Click")
  26. normalize_text(text)
  27. local tosend = {};
  28. for name, amount in text:gmatch("([^%s]+):%s*(%d+)[\r\n]?") do
  29. table.insert(mails,name..":"..amount)
  30. tosend.Subject = subject;
  31. tosend.Gold = amount;
  32. tosend.InOut = "Sent";
  33. tosend.Location = GetRealZoneText();
  34. tosend.From = GetUnitName ("player").."-"..GetRealmName();
  35. tosend.Recipient = name.."-"..GetRealmName();
  36. tosend.Timestamp = ActiveTrade.Timestamp;
  37. --table.insert(mails,tosend)
  38. print(dump(mails));
  39. end
  40. local test = tostring(mails[1])
  41. for name, amount in test:gmatch("([^%s]+):%s*(%d+)[\r\n]?") do
  42. core:send_mail(name,amount,"RCU Test");
  43. end
  44. table.remove(mails,1);
  45. end)
  46.  
  47. add_friends_button = AceGUI:Create("Button")
  48. add_friends_button:SetText("Add Friends")
  49. add_friends_button:SetWidth(150)
  50. add_friends_button:SetHeight(19)
  51.  
  52. add_friends_button:SetCallback('OnClick', function(widget, event, text) -- begin scanning
  53. for name, amount in text:gmatch("([^%s]+):%s*(%d+)[\r\n]?") do
  54. C_FriendList.ShowFriends()
  55. C_FriendList.AddFriend(name)
  56. end
  57. end)
  58.  
  59. remove_friends_button = AceGUI:Create("Button")
  60. remove_friends_button:SetText("Remove Friends")
  61. remove_friends_button:SetWidth(150)
  62. remove_friends_button:SetHeight(19)
  63.  
  64. remove_friends_button:SetCallback('OnClick', function(widget, event, text) -- begin scanning
  65. for name, amount in text:gmatch("([^%s]+):%s*(%d+)[\r\n]?") do
  66. C_FriendList.ShowFriends()
  67. C_FriendList.RemoveFriend(name)
  68. end
  69. end)
  70. mailFrame:AddChild(mailEditBox);
  71. mailFrame:AddChild(send_mail_button)
  72. mailFrame:AddChild(add_friends_button)
  73. mailFrame:AddChild(remove_friends_button)
  74. mailFrame:Show();
  75. else
  76. mailFrame:Hide();
  77. mailFrame = false
  78. end;
  79. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement