Advertisement
Xzempt

Untitled

Jan 22nd, 2012
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 16.06 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. --insert our first dropdown button (which is a nested dropdown) into PLAYER (the target right-click menu) and FRIEND (the chat rightclick menu)
  61.   tinsert(UnitPopupMenus["FRIEND"], #UnitPopupMenus["FRIEND"] - 1, "SWDIKICKBAN");
  62.   tinsert(UnitPopupMenus["FRIEND"], #UnitPopupMenus["FRIEND"] - 1, "SWDIPORT");
  63.   tinsert(UnitPopupMenus["FRIEND"], #UnitPopupMenus["FRIEND"] - 1, "PLAYERCONTROL");
  64.   tinsert(UnitPopupMenus["FRIEND"], #UnitPopupMenus["FRIEND"] - 1, "MAIL");
  65.   --tinsert(UnitPopupMenus["FRIEND"], #UnitPopupMenus["FRIEND"] - 1, "SWDIREVIVE");
  66.  --[[ tinsert(UnitPopupMenus["PLAYER"], #UnitPopupMenus["PLAYER"] - 1, "SWDIKICKBAN");
  67.   tinsert(UnitPopupMenus["PLAYER"], #UnitPopupMenus["PLAYER"] - 1, "SWDIPORT");
  68.   tinsert(UnitPopupMenus["PLAYER"], #UnitPopupMenus["PLAYER"] - 1, "PLAYERCONTROL");
  69.   tinsert(UnitPopupMenus["PLAYER"], #UnitPopupMenus["PLAYER"] - 1, "PLAYERCONTROL");]]--
  70. --create our dropdown menus and submenus, with our buttons as children of our menus.
  71.   UnitPopupMenus["SWDIKICKBAN"] = {"SWDIABAN", "SWDIIBAN", "SWDIKICK", "SWDIMUTE", "SWDICANCEL"};
  72.   UnitPopupMenus["SWDIPORT"] = { "SWDIAPPEAR", "RECALL", "SWDISUMMON",  "SWDICANCEL"};
  73.   UnitPopupMenus["PLAYERCONTROL"] = {"FREEZE", "RENAME", "PINFO", "SWDIREVIVE", "UNFREEZE", "SWDICANCEL"};
  74.   UnitPopupMenus["MAIL"] = {"MakeNewTicket", "VoteShop", "LostItems", "Quests", "BugTracker", "CantHelp", "KnownIssue", "PremiumSupport", "Paymentat"};
  75.   hooksecurefunc("UnitPopup_OnClick", function() SwDi:UnitPopup_OnClick(); end);
  76. end
  77. --send all commands through guild chat, so we are certain they are sent.
  78. function say(msg)
  79. SendChatMessage(msg, "GUILD", nil, nil)
  80. end
  81.  
  82.  
  83. function SwDi:UnitPopup_OnClick(self, player, name)
  84. name = UIDROPDOWNMENU_INIT_MENU.name
  85. local button = this.value;
  86.     if(button == "SWDIREVIVE") then
  87.         say(".revive " ..name)
  88.         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");
  89.     elseif (button == "SWDIKICK") then
  90.         say(".kick " ..name)
  91.     elseif (button == "SWDIABAN") then
  92.         StaticPopup_Show("BANFORREAL")
  93.     elseif (button == "SWDIIBAN") then
  94.         GetPlayerip(name)
  95.         say(".pinfo " ..name)
  96.     elseif (button == "FREEZE") then
  97.         say(".freeze " ..name)
  98.     elseif (button == "UNFREEZE") then
  99.         say(".unfreeze " ..name)
  100.     elseif (button == "RECALL") then
  101.         say(".recall " ..name)
  102.     elseif (button == "SWDIAPPEAR") then
  103.         say(".appear " ..name)
  104.     elseif (button == "SWDISUMMON") then
  105.         say(".summon " ..name)
  106.     elseif (button == "SWDIMUTE") then
  107.         StaticPopup_Show("MUTEFORREAL")
  108.     elseif (button == "PINFO") then
  109.         say(".pinfo " ..name)
  110.     elseif (button == "RENAME") then
  111.         say(".char rename " ..name)
  112.         say(".kick " ..name)
  113.     elseif (button == "MakeNewTicket") then
  114.         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").. ".")
  115.         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");
  116.  
  117.     elseif (button == "VoteShop") then
  118.         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").. ".")
  119.         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");
  120.     elseif (button == "LostItems") then
  121.         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").. ".")
  122.         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");
  123.     elseif (button == "Quests") then
  124.         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").. ".")
  125.         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");
  126.     elseif (button == "BugTracker") then
  127.         say(".send mail " ..name.. " \"RE: Your Ticket\" \"Hello, " ..name.. ". Please submit a Bug Report on the Bug Tracker. Regards, Game Master " ..UnitName("player").. ".")
  128.         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");
  129.     elseif (button == "CantHelp") then
  130.         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").. ".")
  131.         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");
  132.     elseif (button == "KnownIssue") then
  133.         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").. ".")
  134.         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");
  135.     elseif (button == "PremiumSupport") then
  136.         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").. ".")
  137.         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");
  138.     elseif (button == "Paymentat") then
  139.         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").. ".")
  140.         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");
  141.     end
  142. end
  143.  
  144. --Getplayerip
  145. function GetPlayerip(self, name)
  146. if not ipFrame then
  147.     ipFrame = CreateFrame("Frame")
  148.  end
  149.  local frame = ipFrame
  150.  frame:RegisterEvent("CHAT_MSG_SYSTEM")
  151.  frame:SetScript("OnEvent", function(self, event, ...)
  152.        local system_msg = select(1, ...)
  153.        if (system_msg:find("%u:%s%d(.*).%d(.*)%s%u%l%l%l%s") ~= nil) then
  154.           local found = string.sub(system_msg, string.find(system_msg, "%u:%s%d(.*).%d(.*)%s%u%l%l%l%s", 2))
  155.           ipsysmsg = string.sub(found, string.find(found, "%d(.*).(.*).(.*).(.*)%d"))
  156.           frame:UnregisterEvent("CHAT_MSG_SYSTEM")
  157.           StaticPopup_Show("IPBANFORREAL")
  158.        end
  159.     end
  160. )
  161. end
  162. SwDi:initDropdowns();
  163. --Confirmation popups.
  164. StaticPopupDialogs["IPBANFORREAL"] = { }
  165. StaticPopupDialogs["IPBANFORREAL"] = {
  166.   text = "Syntax is Time(30m for 30 minutes) then reason. The IP Address is not needed it will be supplied. Example: 30m Spam",
  167.   button1 = "Yes",
  168.   button2 = "No",
  169.   hasEditBox = true,
  170.   showAlert = true,
  171.     OnAccept = function (self, name)
  172.     local ip = ipsysmsg
  173.     print(ip)
  174.     local text = self.editBox:GetText()
  175.     if (text ~= "") then
  176.         name = UIDROPDOWNMENU_INIT_MENU.name
  177.         print(name)
  178.         say(".ban ip " ..ip.. " " ..text)
  179.         say(".ban char " ..name.. " " ..text)
  180.     end
  181. end,
  182.  
  183.   sound = "GM_ChatWarning",
  184.   timeout = 30,
  185.   whileDead = true,
  186.   hideOnEscape = true,
  187. }
  188. StaticPopupDialogs["MUTEFORREAL"] = { }
  189. StaticPopupDialogs["MUTEFORREAL"] = {
  190.   text = "Syntax is Time(30m for 30 minutes) then reason. The character is not needed it will be supplied. Example: 30m Spam",
  191.   button1 = "Yes",
  192.   button2 = "No",
  193.   hasEditBox = true,
  194.   showAlert = true,
  195.     OnAccept = function (self, name)
  196.     local name = UIDROPDOWNMENU_INIT_MENU.name
  197.     local text = self.editBox:GetText()
  198.     if (text ~= "") then
  199.         say(".mute " ..name.. " " ..text)
  200.     end
  201. end,
  202.  
  203.   sound = "GM_ChatWarning",
  204.   timeout = 30,
  205.   whileDead = true,
  206.   hideOnEscape = true,
  207. }
  208. StaticPopupDialogs["BANFORREAL"] = { }
  209. StaticPopupDialogs["BANFORREAL"] = {
  210.   text = "Syntax is Time(30m for 30 minutes) then reason. The character is not needed it will be supplied. Example: 30m Spam",
  211.   button1 = "Yes",
  212.   button2 = "No",
  213.   hasEditBox = true,
  214.   showAlert = true,
  215.     OnAccept = function (self, name)
  216.     local name = UIDROPDOWNMENU_INIT_MENU.name
  217.     local text = self.editBox:GetText()
  218.     if (text ~= "") then
  219.         say(".ban char " ..name.. " " ..text)
  220.     end
  221. end,
  222.  
  223.   sound = "GM_ChatWarning",
  224.   timeout = 30,
  225.   whileDead = true,
  226.   hideOnEscape = true,
  227. }
  228.  
  229. StaticPopupDialogs["SendMail"] = { }
  230. StaticPopupDialogs["SendMail"] = {
  231.   text = "Example: \"RE: Your Ticket\" \"This is the content\"",
  232.   button1 = "Yes",
  233.   button2 = "No",
  234.   hasEditBox = true,
  235.   showAlert = true,
  236.     OnAccept = function (self, name)
  237.     local name = UIDROPDOWNMENU_INIT_MENU.name
  238.     local text = self.editBox:GetText()
  239.     if (text ~= "") then
  240.         say(".send mail " ..name.. " " ..text)
  241.     end
  242. end,
  243.  
  244.   sound = "GM_ChatWarning",
  245.   timeout = 60,
  246.   whileDead = true,
  247.   hideOnEscape = true,
  248. }
  249. -- This will clear the list of people frozen on the realm.
  250. frozen = "on"
  251. Frozen = { }
  252. function ListFreeze()
  253. say(".listfreeze")
  254.  
  255.  
  256. if not freezeFrame then
  257.     freezeFrame = CreateFrame("Frame")
  258.  end
  259.  local frame = freezeFrame
  260.  frame:RegisterEvent("CHAT_MSG_SYSTEM")
  261.  frame:SetScript("OnEvent", function(self, event, ...)
  262.        local system_msg = select(1, ...)
  263.        if (system_msg:find(" -%s%u") ~= nil) then
  264.           found = string.sub(system_msg, string.find(system_msg, "%u(.*)", 2))
  265.                 tinsert(Frozen, found)
  266.                 frozen = #Frozen
  267.                 --frame:UnregisterEvent("CHAT_MSG_SYSTEM")
  268.                 StaticPopup_Show("UnfreezeAll")
  269.        end
  270.     end
  271. )
  272.  
  273. end
  274. StaticPopupDialogs["UnfreezeAll"] = { }
  275. StaticPopupDialogs["UnfreezeAll"] = {
  276.   text = "Are you sure you want to unfreeze all?",
  277.   button1 = "Yes",
  278.   button2 = "No",
  279.   hasEditBox = false,
  280.   showAlert = true,
  281.     OnAccept = function (self, name)
  282.     local name = UIDROPDOWNMENU_INIT_MENU.name
  283.     if (text ~= "") then
  284.         freezeFrame:UnregisterEvent("CHAT_MSG_SYSTEM")
  285.         UnfreezeAll()
  286.     end
  287. end,
  288.  
  289.   sound = "GM_ChatWarning",
  290.   timeout = 60,
  291.   whileDead = true,
  292.   hideOnEscape = true,
  293. }
  294. function UnfreezeAll()
  295.     for i,v in ipairs(Frozen) do say(".unfreeze " ..v)
  296.     end
  297. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement