/
## Interface: 30300 |
## Interface: 30200 |
## Title: DirtyRecruit |
## Author: Dirtygurl |
## Version: 1.0.4 |
## Version: 1.0.3 |
## Notes: Automatic guild recruitment spam. |
## SavedVariables: DirtyRecruitGlobal |
libs\LibQTip\LibQTip-1.0.lua |
libs\ChatThrottleLib\ChatThrottleLib.lua |
locale\enUS.lua |
locale\frFR.lua |
DirtyRecruit.lua |
-- Author: Dirtygurl |
-- License: GNU GPL v3, 29 June 2007 (see LICENSE.txt) |
local DirtyRecruit = {}; |
DirtyRecruit.Version = GetAddOnMetadata("DirtyRecruit", "Version"); |
local DirtyRecruit = {} |
DirtyRecruit.Version = GetAddOnMetadata("DirtyRecruit", "Version") |
DirtyRecruit.LibQTip = LibStub("LibQTip-1.0"); |
DirtyRecruit.LibQTip = LibStub("LibQTip-1.0") |
DirtyRecruit.PerPlayer = |
{ |
InCombat = nil, |
Spam = "guild", |
UpdateInterval = 300.0, -- 5 minutes |
Ad = nil |
}; |
Ad = "--MyGuild-- is recruiting any level players for groups and end game content. We have a Guild Tabard, Vent, and Website PST if you want to join some of the best players in the game." |
} |
DirtyRecruit.TimeSinceLastUpdate = 0; |
DirtyRecruit.TimeSinceLastUpdate = 0 |
function DirtyRecruit.Print(msg) |
if DEFAULT_CHAT_FRAME then |
function DirtyRecruit.IsInPVPOrInstance() |
local instance = IsInInstance() |
local zone = GetZoneText() |
if instance ~= nil or zone == DIRTYRECRUIT_ZONE_WINTERGRASP then |
if instance ~= nil or zone == "Wintergrasp" then |
return 1 |
end |
return nil |
local gName = GetGuildInfo("player") |
if gName then |
local iIndex = nil |
local genIndex, nGeneral = GetChannelName(DIRTYRECRUIT_CHANNEL_GENERAL.." - "..GetZoneText()) |
local trdIndex, nTrade = GetChannelName(DIRTYRECRUIT_CHANNEL_TRADE.." - City") |
local grIndex, nGuildRecruitment = GetChannelName(DIRTYRECRUIT_CHANNEL_GUILDRECRUITMENT.." - City") |
local lfgIndex, nLookingForGroup = GetChannelName(DIRTYRECRUIT_CHANNEL_LOOKINGFORGROUP) |
local ldeIndex, nLocalDefense = GetChannelName(DIRTYRECRUIT_CHANNEL_LOCALDEFENSE.." - "..GetZoneText()) |
local genIndex, nGeneral = GetChannelName("General - "..GetZoneText()) |
local trdIndex, nTrade = GetChannelName("Trade - City") |
local grIndex, nGuildRecruitment = GetChannelName("GuildRecruitment - City") |
local lfgIndex, nLookingForGroup = GetChannelName("LookingForGroup") |
local ldeIndex, nLocalDefense = GetChannelName("LocalDefense - "..GetZoneText()) |
if nLocalDefense and (DirtyRecruit.PerPlayer.Spam == "all" or DirtyRecruit.PerPlayer.Spam == "lde") then |
iIndex = ldeIndex |
elseif nLookingForGroup and (DirtyRecruit.PerPlayer.Spam == "all" or DirtyRecruit.PerPlayer.Spam == "lfg") then |
-- UpdateInterval |
DirtyRecruit.EditBox_UpdateInterval:SetNumber(DirtyRecruit.PerPlayer.UpdateInterval) |
-- Ad |
if (DirtyRecruit.PerPlayer.Ad == nil) then |
DirtyRecruit.PerPlayer.Ad = DIRTYRECRUIT_PERPLAYER_AD; |
end |
DirtyRecruit.EditBox_Ad:SetText(DirtyRecruit.PerPlayer.Ad); |
DirtyRecruit.EditBox_Ad:SetText(DirtyRecruit.PerPlayer.Ad) |
-- |
DirtyRecruit.Panel.shown = true |
end |
end |
-- Spam |
DirtyRecruit.PerPlayer.Spam = UIDropDownMenu_GetSelectedValue(DirtyRecruit.Menu_Spam) |
local grIndex = GetChannelName(DIRTYRECRUIT_CHANNEL_GUILDRECRUITMENT.." - City") |
local ldeIndex = GetChannelName(DIRTYRECRUIT_CHANNEL_LOCALDEFENSE.." - "..GetZoneText()) |
local grIndex = GetChannelName("GuildRecruitment - City") |
local ldeIndex = GetChannelName("LocalDefense - "..GetZoneText()) |
if DirtyRecruit.PerPlayer.Spam == "all" or DirtyRecruit.PerPlayer.Spam == "guild" or DirtyRecruit.PerPlayer.Spam == "lde" then |
if grIndex == 0 and DirtyRecruit.PerPlayer.Spam == "guild" then |
JoinChannelByName(DIRTYRECRUIT_CHANNEL_GUILDRECRUITMENT) |
JoinChannelByName("GuildRecruitment") |
elseif ldeIndex == 0 and DirtyRecruit.PerPlayer.Spam == "lde" then |
JoinChannelByName(DIRTYRECRUIT_CHANNEL_LOCALDEFENSE) |
JoinChannelByName("LocalDefense") |
end |
elseif grIndex > 0 and DirtyRecruit.PerPlayer.Spam == "guild" then |
LeaveChannelByName(DIRTYRECRUIT_CHANNEL_GUILDRECRUITMENT) |
LeaveChannelByName("GuildRecruitment") |
elseif ldeIndex > 0 and DirtyRecruit.PerPlayer.Spam == "lde" then |
LeaveChannelByName(DIRTYRECRUIT_CHANNEL_LOCALDEFENSE) |
LeaveChannelByName("LocalDefense") |
end |
-- UpdateInterval |
local UpdateInterval = DirtyRecruit.EditBox_UpdateInterval:GetNumber() |
else |
DirtyRecruit.Print("no advertisement was found") |
end |
elseif cmd == "on" then |
DirtyRecruit.PerPlayer.Active = true |
DirtyRecruit.UpdateSettings() |
elseif cmd == "off" then |
DirtyRecruit.PerPlayer.Active = nil |
DirtyRecruit.UpdateSettings() |
else |
DirtyRecruit.Print("DirtyRecruit v"..DirtyRecruit.Version) |
DirtyRecruit.Print("Syntax: |cffffff7f/dirtyrecruit <command> <args>|r") |
DirtyRecruit.Print(" |cff00ff00v|version|r - Shows addon version.") |
DirtyRecruit.Print(" |cff00ff00on|off|r - Enable/disable advertising.") |
DirtyRecruit.Print(" |cff00ff00config|r - Shows the configuration panel.") |
DirtyRecruit.Print(" |cff00ff00reset|r - Resets all data to original.") |
DirtyRecruit.Print(" |cff00ff00sync <character>|r - Syncs data from a character.") |