Advertisement
Xzempt

Untitled

Jul 15th, 2011
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.42 KB | None | 0 0
  1. -- creating data structure
  2. SwDi = { };
  3. --testing purposes only, cos im to lazy to press enter and the dot key and enter again after every /reload
  4. SendChatMessage(".", "SAY", nil, nil)
  5. --Initilization for popups
  6. function SwDi:initDropdowns(player)
  7.  
  8. --Create our dropdown for the unitpopup.
  9.  
  10. --Create our menu and submenu buttons.
  11.   UnitPopupButtons["SWDIKICKBAN"] = {text = "|cFF00BEFFKick/Ban", dist = 0, nested = 1, tooltipText = "|cFF00BEFFShows commands for kicking, banning, or muting the selected player."};
  12.   UnitPopupButtons["SWDIPORT"] = {text = "|cFF00BEFFPort", dist = 0, nested = 1, tooltipText = "|cFF00BEFFShows commands for porting, appearing, or summoning the selected player."};
  13. ----Create all the dropdown menu buttons for our menus and submenus.
  14. --KickBan submenu
  15.   UnitPopupButtons["SWDIKICK"] = {text = "|cFF00BEFFKick", dist = 0, checkable = nil};
  16.   UnitPopupButtons["SWDIABAN"] = {text = "|cFF00BEFFAccount Ban", dist = 0, checkable = nil};
  17.   UnitPopupButtons["SWDIIBAN"] = {text = "|cFF00BEFFIP Ban", dist = 0, checkable = nil};
  18.   UnitPopupButtons["SWDIMUTE"] = {text = "|cFF00BEFFMute", dist = 0, checkable = nil};
  19. --Port submenu
  20.   UnitPopupButtons["SWDIPORTWIN"] = {text = "|cFF00BEFFPort", dist = 0, checkable = nil};
  21.   UnitPopupButtons["SWDIAPPEAR"] = {text = "|cFF00BEFFAppear", dist = 0, checkable = nil};
  22.   UnitPopupButtons["SWDISUMMON"] = {text = "|cFF00BEFFSummon", dist = 0, checkable = nil};
  23.   UnitPopupButtons["RECALL"] = {text = "|cFF00BEFFRecall", dist = 0, checkable = nil};
  24. --Base menu buttons
  25.   UnitPopupButtons["SWDIREVIVE"] = {text = "|cFF00BEFFResurrect", dist = 0, tooltipText = "|cFF00BEFFInstantly resurrects the selected player."};
  26.   UnitPopupButtons["FREEZE"] = {text = "|cFF00BEFFFreeze", dist = 0, tooltipText = "|cFF00BEFFClick to Freeze the selected player."};
  27.   UnitPopupButtons["UNFREEZE"] = {text = "|cFF00BEFFUnfreeze", dist = 0, tooltipText = "|cFF00BEFFClick to Unfreeze the selected player."};
  28. --Blue cancel button
  29.   UnitPopupButtons["SWDICANCEL"] = {text = "|cFF00BEFFCancel", dist = 0, notCheckable = nil};
  30. --insert our first dropdown button (which is a nested dropdown) into PLAYER (the target right-click menu) and FRIEND (the chat rightclick menu)
  31.   tinsert(UnitPopupMenus["FRIEND"], #UnitPopupMenus["FRIEND"] - 1, "SWDIKICKBAN");
  32.   tinsert(UnitPopupMenus["FRIEND"], #UnitPopupMenus["FRIEND"] - 1, "SWDIPORT");
  33.   tinsert(UnitPopupMenus["FRIEND"], #UnitPopupMenus["FRIEND"] - 1, "SWDIREVIVE");
  34.   tinsert(UnitPopupMenus["FRIEND"], #UnitPopupMenus["FRIEND"] - 1, "FREEZE");
  35.   tinsert(UnitPopupMenus["FRIEND"], #UnitPopupMenus["FRIEND"] - 1, "UNFREEZE");
  36. --create our dropdown menus and submenus, with our buttons as children of our menus.
  37.   UnitPopupMenus["SWDIKICKBAN"] = {"SWDIKICK", "SWDIABAN", "SWDIIBAN", "SWDIMUTE", "SWDICANCEL"};
  38.   UnitPopupMenus["SWDIPORT"] = {"SWDIPORTWIN", "SWDIAPPEAR", "RECALL", "SWDISUMMON",  "SWDICANCEL"};
  39.  
  40.   hooksecurefunc("UnitPopup_OnClick", function() SwDi:UnitPopup_OnClick(); end);
  41. end
  42. --send all commands through guild chat, se we are certain they are sent.
  43. function say(msg)
  44. SendChatMessage(msg, "GUILD", nil, nil)
  45. end
  46. function SwDi:UnitPopup_OnClick(self, player, name)
  47. name = UIDROPDOWNMENU_INIT_MENU.name
  48. local button = this.value;
  49.     if(button == "SWDIREVIVE") then
  50.         say(".revive " ..name)
  51.         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");
  52.     elseif (button == "SWDIKICK") then
  53.         say(".kick " ..name)
  54.     elseif (button == "SWDIABAN") then
  55.       StaticPopup_Show("BANFORREAL")
  56.     elseif (button == "SWDIIBAN") then
  57.         GetPlayerip(message)
  58.         say(".pinfo " ..name)
  59.      elseif (button == "FREEZE") then
  60.         say(".freeze " ..name)
  61.     elseif (button == "UNFREEZE") then
  62.         say(".unfreeze " ..name)
  63.     elseif (button == "RECALL") then
  64.         say(".recall " ..name)
  65.     elseif (button == "SWDIAPPEAR") then
  66.         say(".appear " ..name)
  67.     elseif (button == "SWDISUMMON") then
  68.         say(".summon " ..name)
  69.     elseif (button == "SWDIMUTE") then
  70.         StaticPopup_Show("MUTEFORREAL")
  71.     end
  72. end
  73. --Getplayerip
  74. function GetPlayerip(self, message)
  75. if not ipFrame then
  76.     ipFrame = CreateFrame("Frame")
  77.  end
  78.  local frame = ipFrame
  79.  frame:RegisterEvent("CHAT_MSG_SYSTEM")
  80.  frame:SetScript("OnEvent", function(self, event, ...)
  81.        local system_msg = select(1, ...)
  82.        if (system_msg:find("%u:%s%d(.*).%d(.*)%s%u%l%l%l%s") ~= nil) then
  83.           local found = string.sub(system_msg, string.find(system_msg, "%u:%s%d(.*).%d(.*)%s%u%l%l%l%s", 2))
  84.           ipsysmsg = string.sub(found, string.find(found, "%d(.*).(.*).(.*).(.*)%d"))
  85.           frame:UnregisterEvent("CHAT_MSG_SYSTEM")
  86.           StaticPopup_Show("IPBANFORREAL")
  87.        end
  88.     end
  89. )
  90. end
  91. SwDi:initDropdowns();
  92. --Confirmation popups.
  93. StaticPopupDialogs["IPBANFORREAL"] = { }
  94. StaticPopupDialogs["IPBANFORREAL"] = {
  95.   text = "Syntax is Time(30m for 30 minutes) then reason. The IP Address is not needed it will be supplied. Example: 30m Spam",
  96.   button1 = "Yes",
  97.   button2 = "No",
  98.   hasEditBox = true,
  99.     OnAccept = function (self, name)
  100.     local ip = ipsysmsg
  101.     print(ip)
  102.     local text = self.editBox:GetText()
  103.     if (text ~= "") then
  104.         print(".ban ip " ..ip.. " " ..text)
  105.  
  106.     end
  107. end,
  108.  
  109.   sound = "levelup2",
  110.   timeout = 30,
  111.   whileDead = true,
  112.   hideOnEscape = true,
  113. }
  114. StaticPopupDialogs["MUTEFORREAL"] = { }
  115. StaticPopupDialogs["MUTEFORREAL"] = {
  116.   text = "Syntax is Time(30m for 30 minutes) then reason. The character is not needed it will be supplied. Example: 30m Spam",
  117.   button1 = "Yes",
  118.   button2 = "No",
  119.   hasEditBox = true,
  120.     OnAccept = function (self, name)
  121.     local name = UIDROPDOWNMENU_INIT_MENU.name
  122.     local text = self.editBox:GetText()
  123.     if (text ~= "") then
  124.         say(".mute " ..name.. " " ..text)
  125.     end
  126. end,
  127.  
  128.   sound = "levelup2",
  129.   timeout = 30,
  130.   whileDead = true,
  131.   hideOnEscape = true,
  132. }
  133. StaticPopupDialogs["BANFORREAL"] = { }
  134. StaticPopupDialogs["BANFORREAL"] = {
  135.   text = "Syntax is Time(30m for 30 minutes) then reason. The character is not needed it will be supplied. Example: 30m Spam",
  136.   button1 = "Yes",
  137.   button2 = "No",
  138.   hasEditBox = true,
  139.     OnAccept = function (self, name)
  140.     local name = UIDROPDOWNMENU_INIT_MENU.name
  141.     local text = self.editBox:GetText()
  142.     if (text ~= "") then
  143.         say(".ban char " ..name.. " " ..text)
  144.     end
  145. end,
  146.  
  147.   sound = "levelup2",
  148.   timeout = 30,
  149.   whileDead = true,
  150.   hideOnEscape = true,
  151. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement