Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- creating data structure
- SwDi = { };
- --testing purposes only, cos im to lazy to press enter and the dot key and enter again after every /reload
- SendChatMessage(".", "SAY", nil, nil)
- --Initilization for popups
- function SwDi:initDropdowns(player)
- --Create our dropdown for the unitpopup.
- --Create our menu and submenu buttons.
- UnitPopupButtons["SWDIKICKBAN"] = {text = "|cFF00BEFFKick/Ban", dist = 0, nested = 1, tooltipText = "|cFF00BEFFShows commands for kicking, banning, or muting the selected player."};
- UnitPopupButtons["SWDIPORT"] = {text = "|cFF00BEFFPort", dist = 0, nested = 1, tooltipText = "|cFF00BEFFShows commands for porting, appearing, or summoning the selected player."};
- ----Create all the dropdown menu buttons for our menus and submenus.
- --KickBan submenu
- UnitPopupButtons["SWDIKICK"] = {text = "|cFF00BEFFKick", dist = 0, checkable = nil};
- UnitPopupButtons["SWDIABAN"] = {text = "|cFF00BEFFAccount Ban", dist = 0, checkable = nil};
- UnitPopupButtons["SWDIIBAN"] = {text = "|cFF00BEFFIP Ban", dist = 0, checkable = nil};
- UnitPopupButtons["SWDIMUTE"] = {text = "|cFF00BEFFMute", dist = 0, checkable = nil};
- --Port submenu
- UnitPopupButtons["SWDIPORTWIN"] = {text = "|cFF00BEFFPort", dist = 0, checkable = nil};
- UnitPopupButtons["SWDIAPPEAR"] = {text = "|cFF00BEFFAppear", dist = 0, checkable = nil};
- UnitPopupButtons["SWDISUMMON"] = {text = "|cFF00BEFFSummon", dist = 0, checkable = nil};
- UnitPopupButtons["RECALL"] = {text = "|cFF00BEFFRecall", dist = 0, checkable = nil};
- --Base menu buttons
- UnitPopupButtons["SWDIREVIVE"] = {text = "|cFF00BEFFResurrect", dist = 0, tooltipText = "|cFF00BEFFInstantly resurrects the selected player."};
- UnitPopupButtons["FREEZE"] = {text = "|cFF00BEFFFreeze", dist = 0, tooltipText = "|cFF00BEFFClick to Freeze the selected player."};
- UnitPopupButtons["UNFREEZE"] = {text = "|cFF00BEFFUnfreeze", dist = 0, tooltipText = "|cFF00BEFFClick to Unfreeze the selected player."};
- --Blue cancel button
- UnitPopupButtons["SWDICANCEL"] = {text = "|cFF00BEFFCancel", dist = 0, notCheckable = nil};
- --insert our first dropdown button (which is a nested dropdown) into PLAYER (the target right-click menu) and FRIEND (the chat rightclick menu)
- tinsert(UnitPopupMenus["FRIEND"], #UnitPopupMenus["FRIEND"] - 1, "SWDIKICKBAN");
- tinsert(UnitPopupMenus["FRIEND"], #UnitPopupMenus["FRIEND"] - 1, "SWDIPORT");
- tinsert(UnitPopupMenus["FRIEND"], #UnitPopupMenus["FRIEND"] - 1, "SWDIREVIVE");
- tinsert(UnitPopupMenus["FRIEND"], #UnitPopupMenus["FRIEND"] - 1, "FREEZE");
- tinsert(UnitPopupMenus["FRIEND"], #UnitPopupMenus["FRIEND"] - 1, "UNFREEZE");
- --create our dropdown menus and submenus, with our buttons as children of our menus.
- UnitPopupMenus["SWDIKICKBAN"] = {"SWDIKICK", "SWDIABAN", "SWDIIBAN", "SWDIMUTE", "SWDICANCEL"};
- UnitPopupMenus["SWDIPORT"] = {"SWDIPORTWIN", "SWDIAPPEAR", "RECALL", "SWDISUMMON", "SWDICANCEL"};
- hooksecurefunc("UnitPopup_OnClick", function() SwDi:UnitPopup_OnClick(); end);
- end
- --send all commands through guild chat, se we are certain they are sent.
- function say(msg)
- SendChatMessage(msg, "GUILD", nil, nil)
- end
- function SwDi:UnitPopup_OnClick(self, player, name)
- name = UIDROPDOWNMENU_INIT_MENU.name
- local button = this.value;
- if(button == "SWDIREVIVE") then
- say(".revive " ..name)
- 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");
- elseif (button == "SWDIKICK") then
- say(".kick " ..name)
- elseif (button == "SWDIABAN") then
- StaticPopup_Show("BANFORREAL")
- elseif (button == "SWDIIBAN") then
- GetPlayerip(message)
- say(".pinfo " ..name)
- elseif (button == "FREEZE") then
- say(".freeze " ..name)
- elseif (button == "UNFREEZE") then
- say(".unfreeze " ..name)
- elseif (button == "RECALL") then
- say(".recall " ..name)
- elseif (button == "SWDIAPPEAR") then
- say(".appear " ..name)
- elseif (button == "SWDISUMMON") then
- say(".summon " ..name)
- elseif (button == "SWDIMUTE") then
- StaticPopup_Show("MUTEFORREAL")
- end
- end
- --Getplayerip
- function GetPlayerip(self, message)
- if not ipFrame then
- ipFrame = CreateFrame("Frame")
- end
- local frame = ipFrame
- frame:RegisterEvent("CHAT_MSG_SYSTEM")
- frame:SetScript("OnEvent", function(self, event, ...)
- local system_msg = select(1, ...)
- if (system_msg:find("%u:%s%d(.*).%d(.*)%s%u%l%l%l%s") ~= nil) then
- local found = string.sub(system_msg, string.find(system_msg, "%u:%s%d(.*).%d(.*)%s%u%l%l%l%s", 2))
- ipsysmsg = string.sub(found, string.find(found, "%d(.*).(.*).(.*).(.*)%d"))
- frame:UnregisterEvent("CHAT_MSG_SYSTEM")
- StaticPopup_Show("IPBANFORREAL")
- end
- end
- )
- end
- SwDi:initDropdowns();
- --Confirmation popups.
- StaticPopupDialogs["IPBANFORREAL"] = { }
- StaticPopupDialogs["IPBANFORREAL"] = {
- text = "Syntax is Time(30m for 30 minutes) then reason. The IP Address is not needed it will be supplied. Example: 30m Spam",
- button1 = "Yes",
- button2 = "No",
- hasEditBox = true,
- OnAccept = function (self, name)
- local ip = ipsysmsg
- print(ip)
- local text = self.editBox:GetText()
- if (text ~= "") then
- print(".ban ip " ..ip.. " " ..text)
- end
- end,
- sound = "levelup2",
- timeout = 30,
- whileDead = true,
- hideOnEscape = true,
- }
- StaticPopupDialogs["MUTEFORREAL"] = { }
- StaticPopupDialogs["MUTEFORREAL"] = {
- text = "Syntax is Time(30m for 30 minutes) then reason. The character is not needed it will be supplied. Example: 30m Spam",
- button1 = "Yes",
- button2 = "No",
- hasEditBox = true,
- OnAccept = function (self, name)
- local name = UIDROPDOWNMENU_INIT_MENU.name
- local text = self.editBox:GetText()
- if (text ~= "") then
- say(".mute " ..name.. " " ..text)
- end
- end,
- sound = "levelup2",
- timeout = 30,
- whileDead = true,
- hideOnEscape = true,
- }
- StaticPopupDialogs["BANFORREAL"] = { }
- StaticPopupDialogs["BANFORREAL"] = {
- text = "Syntax is Time(30m for 30 minutes) then reason. The character is not needed it will be supplied. Example: 30m Spam",
- button1 = "Yes",
- button2 = "No",
- hasEditBox = true,
- OnAccept = function (self, name)
- local name = UIDROPDOWNMENU_INIT_MENU.name
- local text = self.editBox:GetText()
- if (text ~= "") then
- say(".ban char " ..name.. " " ..text)
- end
- end,
- sound = "levelup2",
- timeout = 30,
- whileDead = true,
- hideOnEscape = true,
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement