Advertisement
Xzempt

Untitled

Jan 24th, 2012
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 16.75 KB | None | 0 0
  1.  
  2.  
  3.  
  4. --[[function ToggleAddon()
  5. print("Toggle Addon function was called");
  6. end
  7.  
  8. function ShowMinimap()
  9. GameTooltip:SetOwner(this, "ANCHOR_LEFT");
  10. GameTooltip:AddLine( "|cFF00FF00Dunno what to call this yet|r" );
  11. GameTooltip:AddLine( "|cFF00FFCCLeft click to show/hide|r" );
  12. GameTooltip:AddLine( "|cFFFF0000Right click to drag this|r" );
  13. GameTooltip:Show();
  14. end]]
  15.  
  16.  
  17. -- creating data structure
  18. SwDi = { };
  19. --testing purposes only, cos im to lazy to press enter and the dot key and enter again after every /reload
  20. --SendChatMessage(".", "SAY", nil, nil)
  21. --Initilization for popups
  22. function SwDi:initDropdowns(player)
  23. --Create our dropdown for the unitpopup.
  24.  
  25. --Create our menu and submenu buttons.
  26.   UnitPopupButtons["SWDIKICKBAN"] = {text = "|cFF00FFFFKick/Ban", dist = 0, nested = 1, tooltipText = "|cFF00FFFFShows commands for kicking, banning, or muting the selected player."};
  27.   UnitPopupButtons["SWDIPORT"] = {text = "|cFF00FFFFPort", dist = 0, nested = 1, tooltipText = "|cFF00FFFFShows commands for porting, appearing, or summoning the selected player."};
  28.   UnitPopupButtons["PLAYERCONTROL"] = {text = "|cFF00FFFFPlayer Control", dist = 0, nested = 1, tooltipText = "|cFF00FFFFShows commands for Freezing, Unfreezing, Player Info and Resurrection"};
  29.   UnitPopupButtons["MAIL"] = {text = "|cFF00FFFFMail", dist = 0, nested = 1, tooltipText = "|cFF00FFFFAllows you to send mail to an offline player addressing their issue."};
  30.  
  31.   ----Create all the dropdown menu buttons for our menus and submenus.
  32. --KickBan submenu
  33.   UnitPopupButtons["SWDIKICK"] = {text = "|cFF00FFFFKick", dist = 0, checkable = nil};
  34.   UnitPopupButtons["SWDIABAN"] = {text = "|cFF00FFFFAccount Ban", dist = 0, checkable = nil};
  35.   UnitPopupButtons["SWDIIBAN"] = {text = "|cFF00FFFFIP Ban", dist = 0, checkable = nil};
  36.   UnitPopupButtons["SWDIMUTE"] = {text = "|cFF00FFFFMute", dist = 0, checkable = nil};
  37. --Port submenu
  38.   --UnitPopupButtons["SWDIPORTWIN"] = {text = "|cFF00FFFFPort", dist = 0, checkable = nil};
  39.   UnitPopupButtons["SWDIAPPEAR"] = {text = "|cFF00FFFFAppear", dist = 0, checkable = nil};
  40.   UnitPopupButtons["SWDISUMMON"] = {text = "|cFF00FFFFSummon", dist = 0, checkable = nil};
  41.   UnitPopupButtons["RECALL"] = {text = "|cFF00FFFFRecall", dist = 0, checkable = nil};
  42. --Base menu buttons
  43.   UnitPopupButtons["SWDIREVIVE"] = {text = "|cFF00FFFFResurrect", dist = 0, tooltipText = "|cFF00FFFFInstantly resurrects the selected player."};
  44.   UnitPopupButtons["FREEZE"] = {text = "|cFF00FFFFFreeze", dist = 0, tooltipText = "|cFF00FFFFClick to Freeze the selected player."};
  45.   UnitPopupButtons["UNFREEZE"] = {text = "|cFF00FFFFUnfreeze", dist = 0, tooltipText = "|cFF00FFFFClick to Unfreeze the selected player."};
  46.   UnitPopupButtons["PINFO"] = {text = "|cFF00FFFFPlayer Info", dist = 0, tooltipText = "|cFF00FFFFClick to Unfreeze the selected player."};
  47.   UnitPopupButtons["RENAME"] = {text = "|cFF00FFFFRename", dist = 0, tooltipText = "|cFF00FFFFClick to Unfreeze the selected player."};
  48. --Blue cancel button
  49.   UnitPopupButtons["SWDICANCEL"] = {text = "|cFF00FFFFCancel", dist = 0, notCheckable = nil};
  50. --Mail Submenu
  51.   UnitPopupButtons["MakeNewTicket"] = {text = "|cFF00FFFFMake new ticket", dist = 0, tooltipText = "|cFF00FFFFClick to send mail the selected player."};
  52.   UnitPopupButtons["VoteShop"] = {text = "|cFF00FFFFVote Shop", dist = 0, tooltipText = "|cFF00FFFFClick to send mail the selected player."};
  53.   UnitPopupButtons["LostItems"] = {text = "|cFF00FFFFLost Items", dist = 0, tooltipText = "|cFF00FFFFClick to send mail the selected player."};
  54.   UnitPopupButtons["Quests"] = {text = "|cFF00FFFFQuests", dist = 0, tooltipText = "|cFF00FFFFClick to send mail the selected player."};
  55.   UnitPopupButtons["BugTracker"] = {text = "|cFF00FFFFBug Tracker", dist = 0, tooltipText = "|cFF00FFFFClick to send mail the selected player."};
  56.   UnitPopupButtons["CantHelp"] = {text = "|cFF00FFFFCan't Help", dist = 0, tooltipText = "|cFF00FFFFClick to send mail the selected player."};
  57.   UnitPopupButtons["KnownIssue"] = {text = "|cFF00FFFFKnown Issue", dist = 0, tooltipText = "|cFF00FFFFClick to send mail the selected player."};
  58.   UnitPopupButtons["PremiumSupport"] = {text = "|cFF00FFFFPremium Support", dist = 0, tooltipText = "|cFF00FFFFClick to send mail the selected player."};
  59.   UnitPopupButtons["Paymentat"] = {text = "|cFF00FFFFPayment@", dist = 0, tooltipText = "|cFF00FFFFClick to send mail the selected player."};
  60.   UnitPopupButtons["PlayerReports"] = {text = "|cFF00FFFFPlayer Reports", dist = 0, tooltipText = "|cFF00FFFFClick to send mail the selected player."};
  61. --insert our first dropdown button (which is a nested dropdown) into PLAYER (the target right-click menu) and FRIEND (the chat rightclick menu)
  62.   tinsert(UnitPopupMenus["FRIEND"], #UnitPopupMenus["FRIEND"] - 1, "SWDIKICKBAN");
  63.   tinsert(UnitPopupMenus["FRIEND"], #UnitPopupMenus["FRIEND"] - 1, "SWDIPORT");
  64.   tinsert(UnitPopupMenus["FRIEND"], #UnitPopupMenus["FRIEND"] - 1, "PLAYERCONTROL");
  65.   tinsert(UnitPopupMenus["FRIEND"], #UnitPopupMenus["FRIEND"] - 1, "MAIL");
  66.   --tinsert(UnitPopupMenus["FRIEND"], #UnitPopupMenus["FRIEND"] - 1, "SWDIREVIVE");
  67.  --[[ tinsert(UnitPopupMenus["PLAYER"], #UnitPopupMenus["PLAYER"] - 1, "SWDIKICKBAN");
  68.   tinsert(UnitPopupMenus["PLAYER"], #UnitPopupMenus["PLAYER"] - 1, "SWDIPORT");
  69.   tinsert(UnitPopupMenus["PLAYER"], #UnitPopupMenus["PLAYER"] - 1, "PLAYERCONTROL");
  70.   tinsert(UnitPopupMenus["PLAYER"], #UnitPopupMenus["PLAYER"] - 1, "PLAYERCONTROL");]]--
  71. --create our dropdown menus and submenus, with our buttons as children of our menus.
  72.   UnitPopupMenus["SWDIKICKBAN"] = {"SWDIABAN", "SWDIIBAN", "SWDIKICK", "SWDIMUTE", "SWDICANCEL"};
  73.   UnitPopupMenus["SWDIPORT"] = { "SWDIAPPEAR", "RECALL", "SWDISUMMON",  "SWDICANCEL"};
  74.   UnitPopupMenus["PLAYERCONTROL"] = {"FREEZE", "RENAME", "PINFO", "SWDIREVIVE", "UNFREEZE", "SWDICANCEL"};
  75.   UnitPopupMenus["MAIL"] = {"MakeNewTicket", "VoteShop", "LostItems", "Quests", "BugTracker", "CantHelp", "KnownIssue", "PremiumSupport", "Paymentat", "PlayerReports"};
  76.   hooksecurefunc("UnitPopup_OnClick", function() SwDi:UnitPopup_OnClick(); end);
  77. end
  78. --send all commands through guild chat, so we are certain they are sent.
  79. function say(msg)
  80. SendChatMessage(msg, "GUILD", nil, nil)
  81. end
  82.  
  83.  
  84. function SwDi:UnitPopup_OnClick(self, player, name)
  85. name = UIDROPDOWNMENU_INIT_MENU.name
  86. local button = this.value;
  87.     if(button == "SWDIREVIVE") then
  88.         say(".revive " ..name)
  89.         print("\124cff00B4FF\124Hitem:19:0:0:0:0:0:0:0\124h Player: \124h\124r \124cffffff00\124Hitem:19:0:0:0:0:0:0:0\124h'"..name.."'\124h\124r \124cff00B4FF\124Hitem:19:0:0:0:0:0:0:0\124h has been resurrected, " ..UnitName("player").. ".\124h\124r");
  90.     elseif (button == "SWDIKICK") then
  91.         say(".kick " ..name)
  92.     elseif (button == "SWDIABAN") then
  93.         StaticPopup_Show("BANFORREAL")
  94.     elseif (button == "SWDIIBAN") then
  95.         GetPlayerip(name)
  96.         say(".pinfo " ..name)
  97.     elseif (button == "FREEZE") then
  98.         say(".freeze " ..name)
  99.     elseif (button == "UNFREEZE") then
  100.         say(".unfreeze " ..name)
  101.     elseif (button == "RECALL") then
  102.         say(".recall " ..name)
  103.     elseif (button == "SWDIAPPEAR") then
  104.         say(".appear " ..name)
  105.     elseif (button == "SWDISUMMON") then
  106.         say(".summon " ..name)
  107.     elseif (button == "SWDIMUTE") then
  108.         StaticPopup_Show("MUTEFORREAL")
  109.     elseif (button == "PINFO") then
  110.         say(".pinfo " ..name)
  111.     elseif (button == "RENAME") then
  112.         say(".char rename " ..name)
  113.         say(".kick " ..name)
  114.     elseif (button == "MakeNewTicket") then
  115.         say(".send mail " ..name.. " \"RE: Your Ticket\" \"Hello, " ..name.. ". I can assist you with your ticket, but I need you to be online to do so. Please make a new ticket and remain online so I can assist you. Regards, Game Master " ..UnitName("player").. ".")
  116.         print("\124cff00B4FF\124Hitem:19:0:0:0:0:0:0:0\124hMail to Player: \124h\124r \124cffffff00\124Hitem:19:0:0:0:0:0:0:0\124h'"..name.."'\124h\124r \124cff00B4FF\124Hitem:19:0:0:0:0:0:0:0\124h has been sent, " ..UnitName("player").. ". (New Ticket)\124h\124r");
  117.  
  118.     elseif (button == "VoteShop") then
  119.         say(".send mail " ..name.. " \"RE: Your Ticket\" \"Hello, " ..name.. ". Unfortunately there is nothing that I can do to assist you with this issue. Vote Shop items are non refundable and are not eligible for support. Regards, Game Master " ..UnitName("player").. ".")
  120.         print("\124cff00B4FF\124Hitem:19:0:0:0:0:0:0:0\124hMail to Player: \124h\124r \124cffffff00\124Hitem:19:0:0:0:0:0:0:0\124h'"..name.."'\124h\124r \124cff00B4FF\124Hitem:19:0:0:0:0:0:0:0\124h has been sent, " ..UnitName("player").. ". (Vote Shop)\124h\124r");
  121.     elseif (button == "LostItems") then
  122.         say(".send mail " ..name.. " \"RE: Your Ticket\" \"Hello, " ..name.. ". Sadly I cannot help you with your issue. If your item was purchased with Molten Coins then you can create a premium support ticket on the website. Regards, GM " ..UnitName("player").. ".")
  123.         print("\124cff00B4FF\124Hitem:19:0:0:0:0:0:0:0\124hMail to Player: \124h\124r \124cffffff00\124Hitem:19:0:0:0:0:0:0:0\124h'"..name.."'\124h\124r \124cff00B4FF\124Hitem:19:0:0:0:0:0:0:0\124h has been sent, " ..UnitName("player").. ". (Lost Items)\124h\124r");
  124.     elseif (button == "Quests") then
  125.         say(".send mail " ..name.. " \"RE: Your Ticket\" \"Hello, " ..name.. ". Unfortunately there is nothing that I can do to assist you with this issue. Game Masters can not help you with non-class related quests. Regards, Game Master " ..UnitName("player").. ".")
  126.         print("\124cff00B4FF\124Hitem:19:0:0:0:0:0:0:0\124hMail to Player: \124h\124r \124cffffff00\124Hitem:19:0:0:0:0:0:0:0\124h'"..name.."'\124h\124r \124cff00B4FF\124Hitem:19:0:0:0:0:0:0:0\124h has been sent, " ..UnitName("player").. ". (Quests)\124h\124r");
  127.     elseif (button == "BugTracker") then
  128.         say(".send mail " ..name.. " \"RE: Your Ticket\" \"Hello, " ..name.. ". Please submit a Bug Report on the Bug Tracker. Regards, Game Master " ..UnitName("player").. ".")
  129.         print("\124cff00B4FF\124Hitem:19:0:0:0:0:0:0:0\124hMail to Player: \124h\124r \124cffffff00\124Hitem:19:0:0:0:0:0:0:0\124h'"..name.."'\124h\124r \124cff00B4FF\124Hitem:19:0:0:0:0:0:0:0\124h has been sent, " ..UnitName("player").. ". (Bug Tracker)\124h\124r");
  130.     elseif (button == "CantHelp") then
  131.         say(".send mail " ..name.. " \"RE: Your Ticket\" \"Hello, " ..name.. ". Unfortunately there is nothing I can do to assist you with this issue. Regards, Game Master " ..UnitName("player").. ".")
  132.         print("\124cff00B4FF\124Hitem:19:0:0:0:0:0:0:0\124hMail to Player: \124h\124r \124cffffff00\124Hitem:19:0:0:0:0:0:0:0\124h'"..name.."'\124h\124r \124cff00B4FF\124Hitem:19:0:0:0:0:0:0:0\124h has been sent, " ..UnitName("player").. ". (Cant Help)\124h\124r");
  133.     elseif (button == "KnownIssue") then
  134.         say(".send mail " ..name.. " \"RE: Your Ticket\" \"Hello, " ..name.. ". That is a well known issue, please remain patient while the Developers work to resolve it. Regards, Game Master " ..UnitName("player").. ".")
  135.         print("\124cff00B4FF\124Hitem:19:0:0:0:0:0:0:0\124hMail to Player: \124h\124r \124cffffff00\124Hitem:19:0:0:0:0:0:0:0\124h'"..name.."'\124h\124r \124cff00B4FF\124Hitem:19:0:0:0:0:0:0:0\124h has been sent, " ..UnitName("player").. ". (Known Issue)\124h\124r");
  136.     elseif (button == "PremiumSupport") then
  137.         say(".send mail " ..name.. " \"RE: Your Ticket\" \"Hello, " ..name.. ". Please log on to the website and create a premium support ticket. Game Masters can not help with donation related issues. Regards, Game Master " ..UnitName("player").. ".")
  138.         print("\124cff00B4FF\124Hitem:19:0:0:0:0:0:0:0\124hMail to Player: \124h\124r \124cffffff00\124Hitem:19:0:0:0:0:0:0:0\124h'"..name.."'\124h\124r \124cff00B4FF\124Hitem:19:0:0:0:0:0:0:0\124h has been sent, " ..UnitName("player").. ". (Premium Support)\124h\124r");
  139.     elseif (button == "Paymentat") then
  140.         say(".send mail " ..name.. " \"RE: Your Ticket\" \"Hello, " ..name.. ". Please send an email to Payment@molten-wow.com. Game Masters can not help with donation related issues. Regards, Game Master " ..UnitName("player").. ".")
  141.         print("\124cff00B4FF\124Hitem:19:0:0:0:0:0:0:0\124hMail to Player: \124h\124r \124cffffff00\124Hitem:19:0:0:0:0:0:0:0\124h'"..name.."'\124h\124r \124cff00B4FF\124Hitem:19:0:0:0:0:0:0:0\124h has been sent, " ..UnitName("player").. ". (Payment@)\124h\124r");
  142.     elseif (button == "PlayerReports") then
  143.         say(".send mail " ..name.. " \"RE: Your Ticket\" \"Hello, " ..name.. ". Please visit http://forum.molten-wow.com/announcement.php?a=9 to learn how to report players. Regards, Game Master " ..UnitName("player").. ".")
  144.         print("\124cff00B4FF\124Hitem:19:0:0:0:0:0:0:0\124hMail to Player: \124h\124r \124cffffff00\124Hitem:19:0:0:0:0:0:0:0\124h'"..name.."'\124h\124r \124cff00B4FF\124Hitem:19:0:0:0:0:0:0:0\124h has been sent, " ..UnitName("player").. ". (Player Reports)\124h\124r");
  145.     end
  146.    
  147. end
  148.  
  149. --Getplayerip
  150. function GetPlayerip(self, name)
  151. if not ipFrame then
  152.     ipFrame = CreateFrame("Frame")
  153.  end
  154.  local frame = ipFrame
  155.  frame:RegisterEvent("CHAT_MSG_SYSTEM")
  156.  frame:SetScript("OnEvent", function(self, event, ...)
  157.        local system_msg = select(1, ...)
  158.        if (system_msg:find("%u:%s%d(.*).%d(.*)%s%u%l%l%l%s") ~= nil) then
  159.           local found = string.sub(system_msg, string.find(system_msg, "%u:%s%d(.*).%d(.*)%s%u%l%l%l%s", 2))
  160.           ipsysmsg = string.sub(found, string.find(found, "%d(.*).(.*).(.*).(.*)%d"))
  161.           frame:UnregisterEvent("CHAT_MSG_SYSTEM")
  162.           StaticPopup_Show("IPBANFORREAL")
  163.        end
  164.     end
  165. )
  166. end
  167. SwDi:initDropdowns();
  168. --Confirmation popups.
  169. StaticPopupDialogs["IPBANFORREAL"] = { }
  170. StaticPopupDialogs["IPBANFORREAL"] = {
  171.   text = "Syntax is Time(30m for 30 minutes) then reason. The IP Address is not needed it will be supplied. Example: 30m Spam",
  172.   button1 = "Yes",
  173.   button2 = "No",
  174.   hasEditBox = true,
  175.   showAlert = true,
  176.     OnAccept = function (self, name)
  177.     local ip = ipsysmsg
  178.     print(ip)
  179.     local text = self.editBox:GetText()
  180.     if (text ~= "") then
  181.         name = UIDROPDOWNMENU_INIT_MENU.name
  182.         print(name)
  183.         say(".ban ip " ..ip.. " " ..text)
  184.         say(".ban char " ..name.. " " ..text)
  185.     end
  186. end,
  187.  
  188.   sound = "GM_ChatWarning",
  189.   timeout = 30,
  190.   whileDead = true,
  191.   hideOnEscape = true,
  192. }
  193. StaticPopupDialogs["MUTEFORREAL"] = { }
  194. StaticPopupDialogs["MUTEFORREAL"] = {
  195.   text = "Syntax is Time(30m for 30 minutes) then reason. The character is not needed it will be supplied. Example: 30m Spam",
  196.   button1 = "Yes",
  197.   button2 = "No",
  198.   hasEditBox = true,
  199.   showAlert = true,
  200.     OnAccept = function (self, name)
  201.     local name = UIDROPDOWNMENU_INIT_MENU.name
  202.     local text = self.editBox:GetText()
  203.     if (text ~= "") then
  204.         say(".mute " ..name.. " " ..text)
  205.     end
  206. end,
  207.  
  208.   sound = "GM_ChatWarning",
  209.   timeout = 30,
  210.   whileDead = true,
  211.   hideOnEscape = true,
  212. }
  213. StaticPopupDialogs["BANFORREAL"] = { }
  214. StaticPopupDialogs["BANFORREAL"] = {
  215.   text = "Syntax is Time(30m for 30 minutes) then reason. The character is not needed it will be supplied. Example: 30m Spam",
  216.   button1 = "Yes",
  217.   button2 = "No",
  218.   hasEditBox = true,
  219.   showAlert = true,
  220.     OnAccept = function (self, name)
  221.     local name = UIDROPDOWNMENU_INIT_MENU.name
  222.     local text = self.editBox:GetText()
  223.     if (text ~= "") then
  224.         say(".ban char " ..name.. " " ..text)
  225.     end
  226. end,
  227.  
  228.   sound = "GM_ChatWarning",
  229.   timeout = 30,
  230.   whileDead = true,
  231.   hideOnEscape = true,
  232. }
  233.  
  234. StaticPopupDialogs["SendMail"] = { }
  235. StaticPopupDialogs["SendMail"] = {
  236.   text = "Example: \"RE: Your Ticket\" \"This is the content\"",
  237.   button1 = "Yes",
  238.   button2 = "No",
  239.   hasEditBox = true,
  240.   showAlert = true,
  241.     OnAccept = function (self, name)
  242.     local name = UIDROPDOWNMENU_INIT_MENU.name
  243.     local text = self.editBox:GetText()
  244.     if (text ~= "") then
  245.         say(".send mail " ..name.. " " ..text)
  246.     end
  247. end,
  248.  
  249.   sound = "GM_ChatWarning",
  250.   timeout = 60,
  251.   whileDead = true,
  252.   hideOnEscape = true,
  253. }
  254. -- This will clear the list of people frozen on the realm.
  255. frozen = "on"
  256. Frozen = { }
  257. function ListFreeze()
  258. say(".listfreeze")
  259.  
  260.  
  261. if not freezeFrame then
  262.     freezeFrame = CreateFrame("Frame")
  263.  end
  264.  local frame = freezeFrame
  265.  frame:RegisterEvent("CHAT_MSG_SYSTEM")
  266.  frame:SetScript("OnEvent", function(self, event, ...)
  267.        local system_msg = select(1, ...)
  268.        if (system_msg:find(" -%s%u") ~= nil) then
  269.           found = string.sub(system_msg, string.find(system_msg, "%u(.*)", 2))
  270.                 tinsert(Frozen, found)
  271.                 frozen = #Frozen
  272.                 --frame:UnregisterEvent("CHAT_MSG_SYSTEM")
  273.                 StaticPopup_Show("UnfreezeAll")
  274.        end
  275.     end
  276. )
  277.  
  278. end
  279. StaticPopupDialogs["UnfreezeAll"] = { }
  280. StaticPopupDialogs["UnfreezeAll"] = {
  281.   text = "Are you sure you want to unfreeze all?",
  282.   button1 = "Yes",
  283.   button2 = "No",
  284.   hasEditBox = false,
  285.   showAlert = true,
  286.     OnAccept = function (self, name)
  287.     local name = UIDROPDOWNMENU_INIT_MENU.name
  288.     if (text ~= "") then
  289.         freezeFrame:UnregisterEvent("CHAT_MSG_SYSTEM")
  290.         UnfreezeAll()
  291.     end
  292. end,
  293.  
  294.   sound = "GM_ChatWarning",
  295.   timeout = 60,
  296.   whileDead = true,
  297.   hideOnEscape = true,
  298. }
  299. function UnfreezeAll()
  300.     for i,v in ipairs(Frozen) do say(".unfreeze " ..v)
  301.     end
  302. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement