/
InCombat = nil, |
Spam = "guild", |
UpdateInterval = 300.0, -- 5 minutes |
Ad = nil |
Ad = nil, |
TestMode = nil, |
Zone = nil |
}; |
DirtyRecruit.TimeSinceLastUpdate = 0; |
DirtyRecruit.TimeSinceLastCheck = 0; |
function DirtyRecruit.Print(msg) |
if DEFAULT_CHAT_FRAME then |
return nil |
end |
function DirtyRecruit.AdvertiseTest() |
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()) |
if nLocalDefense and (DirtyRecruit.PerPlayer.Spam == "all" or DirtyRecruit.PerPlayer.Spam == "lde") then |
iIndex = ldeIndex |
iValue = nLocalDefense |
elseif nLookingForGroup and (DirtyRecruit.PerPlayer.Spam == "all" or DirtyRecruit.PerPlayer.Spam == "lfg") then |
iIndex = lfgIndex |
iValue = nLookingForGroup |
elseif nGuildRecruitment and (DirtyRecruit.PerPlayer.Spam == "all" or DirtyRecruit.PerPlayer.Spam == "guild") then |
iIndex = grIndex |
iValue = nGuildRecruitment |
elseif DirtyRecruit.PerPlayer.Zone == "City" and nTrade and (DirtyRecruit.PerPlayer.Spam == "all" or DirtyRecruit.PerPlayer.Spam == "trade") then |
iIndex = trdIndex |
iValue = nTrade |
elseif DirtyRecruit.PerPlayer.Zone == "City" and nGeneral and (DirtyRecruit.PerPlayer.Spam == "all" or DirtyRecruit.PerPlayer.Spam == "general") then |
iIndex = genIndex |
iValue = nGeneral |
elseif nTrade and nGeneral and (DirtyRecruit.PerPlayer.Spam == "all" or DirtyRecruit.PerPlayer.Spam == "major") then |
iIndex = trdIndex |
iValue = nTrade |
end |
if iIndex ~= nil and DirtyRecruit.PerPlayer.Zone ~= nil then |
if DirtyRecruit.TestMode ~= nil then |
DirtyRecruit.Print("["..iIndex..". "..iValue.."]: "..DirtyRecruit.PerPlayer.Ad) |
else |
ChatThrottleLib:SendChatMessage("NORMAL", "DirtyRecruit", DirtyRecruit.PerPlayer.Ad, "CHANNEL", nil, iIndex) |
ChatThrottleLib:SendAddonMessage("NORMAL", "DirtyRecruit", "guildAdvertised|"..DirtyRecruit.PerPlayer.Zone.."|"..UnitName("player"), "GUILD") |
end |
end |
end |
end |
function DirtyRecruit.Advertise() |
local gName = GetGuildInfo("player") |
if gName then |
local ldeIndex, nLocalDefense = GetChannelName(DIRTYRECRUIT_CHANNEL_LOCALDEFENSE.." - "..GetZoneText()) |
if nLocalDefense and (DirtyRecruit.PerPlayer.Spam == "all" or DirtyRecruit.PerPlayer.Spam == "lde") then |
iIndex = ldeIndex |
iValue = nLocalDefense |
elseif nLookingForGroup and (DirtyRecruit.PerPlayer.Spam == "all" or DirtyRecruit.PerPlayer.Spam == "lfg") then |
iIndex = lfgIndex |
iValue = nLookingForGroup |
elseif nGuildRecruitment and (DirtyRecruit.PerPlayer.Spam == "all" or DirtyRecruit.PerPlayer.Spam == "guild") then |
iIndex = grIndex |
elseif nTrade and (DirtyRecruit.PerPlayer.Spam == "all" or DirtyRecruit.PerPlayer.Spam == "trade") then |
iValue = nGuildRecruitment |
elseif DirtyRecruit.PerPlayer.Zone == "City" and nTrade and (DirtyRecruit.PerPlayer.Spam == "all" or DirtyRecruit.PerPlayer.Spam == "trade") then |
iIndex = trdIndex |
elseif nGeneral and (DirtyRecruit.PerPlayer.Spam == "all" or DirtyRecruit.PerPlayer.Spam == "general") then |
iValue = nTrade |
elseif DirtyRecruit.PerPlayer.Zone == "City" and nGeneral and (DirtyRecruit.PerPlayer.Spam == "all" or DirtyRecruit.PerPlayer.Spam == "general") then |
iIndex = genIndex |
iValue = nGeneral |
elseif nTrade and nGeneral and (DirtyRecruit.PerPlayer.Spam == "all" or DirtyRecruit.PerPlayer.Spam == "major") then |
iIndex = trdIndex |
iValue = nTrade |
end |
if iIndex ~= nil then |
--DirtyRecruit.Print(iIndex..": "..DirtyRecruit.PerPlayer.Ad) |
ChatThrottleLib:SendChatMessage("NORMAL", "DirtyRecruit", DirtyRecruit.PerPlayer.Ad, "CHANNEL", nil, iIndex) |
ChatThrottleLib:SendAddonMessage("NORMAL", "DirtyRecruit", "guildAdvertised|DR|"..GetZoneText().."|DR|"..UnitName("player"), "GUILD") |
if iIndex ~= nil and DirtyRecruit.PerPlayer.Zone ~= nil then |
if DirtyRecruit.PerPlayer.TestMode ~= nil then |
DirtyRecruit.Print("["..iIndex..". "..iValue.."]: "..DirtyRecruit.PerPlayer.Ad) |
else |
ChatThrottleLib:SendChatMessage("NORMAL", "DirtyRecruit", DirtyRecruit.PerPlayer.Ad, "CHANNEL", nil, iIndex) |
ChatThrottleLib:SendAddonMessage("NORMAL", "DirtyRecruit", "guildAdvertised|"..DirtyRecruit.PerPlayer.Zone.."|"..UnitName("player"), "GUILD") |
end |
end |
end |
end |
DirtyRecruit.PerPlayer.Spam = UIDropDownMenu_GetSelectedValue(DirtyRecruit.Menu_Spam) |
local grIndex = GetChannelName(DIRTYRECRUIT_CHANNEL_GUILDRECRUITMENT.." - City") |
local ldeIndex = GetChannelName(DIRTYRECRUIT_CHANNEL_LOCALDEFENSE.." - "..GetZoneText()) |
if DirtyRecruit.PerPlayer.Spam == "all" or DirtyRecruit.PerPlayer.Spam == "guild" or DirtyRecruit.PerPlayer.Spam == "lde" then |
if DirtyRecruit.PerPlayer.Zone == "City" and 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) |
elseif ldeIndex == 0 and DirtyRecruit.PerPlayer.Spam == "lde" then |
InCombat = nil, |
Spam = "guild", |
UpdateInterval = 300.0, -- 5 minutes |
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." |
Ad = nil, |
TestMode = nil, |
Zone = nil |
} |
DirtyRecruit.Panel_OnShow() |
end |
function DirtyRecruit.OnUpdateSpam(self, elapsed) |
--DirtyRecruit.Print("OnUpdate") |
local CityInterval = tonumber(30) |
DirtyRecruit.TimeSinceLastCheck = DirtyRecruit.TimeSinceLastCheck + elapsed |
if DirtyRecruit.TimeSinceLastCheck and DirtyRecruit.TimeSinceLastCheck >= CityInterval then |
DirtyRecruit.ZoneChangedNewArea() |
DirtyRecruit.TimeSinceLastCheck = 0 |
end |
local UpdateInterval = tonumber(DirtyRecruit.PerPlayer.UpdateInterval) |
DirtyRecruit.TimeSinceLastUpdate = DirtyRecruit.TimeSinceLastUpdate + elapsed |
if DirtyRecruit.TimeSinceLastUpdate and DirtyRecruit.TimeSinceLastUpdate >= UpdateInterval then |
DirtyRecruit.PerPlayer.InCombat = nil |
end |
function DirtyRecruit.ZoneChangedNewArea() |
--DirtyRecruit.Print("OnEvent:ZONE_CHANGED_NEW_AREA") |
DirtyRecruit.PerPlayer.Zone = nil |
local currchans = {GetChannelList()} |
for i=2,#currchans,2 do |
if currchans[i] ~= nil and currchans[i] == "Trade" and (DirtyRecruit.PerPlayer.Spam == "trade" or DirtyRecruit.PerPlayer.Spam == "major") then |
-- If we have a trade chan we are in a city |
DirtyRecruit.PerPlayer.Zone = "City" |
end |
end |
if DirtyRecruit.PerPlayer.Zone ~= "City" then |
DirtyRecruit.PerPlayer.Zone = GetZoneText() |
end |
--DirtyRecruit.Print("Zone Changed: "..DirtyRecruit.PerPlayer.Zone) |
end |
function DirtyRecruit.OnChatMsgAddOn(action) |
--DirtyRecruit.Print("OnEvent:CHAT_MSG_ADDON") |
local a, b, c = strsplit("|DR|", action) |
local a, b, c = strsplit("|", action) |
if a == "guildAdvertised" and b == GetZoneText() and c ~= UnitName("player") then |
DirtyRecruit.Print("Guild Advertised, Reset on timer has been issued") |
DirtyRecruit.TimeSinceLastUpdate = 0 |
end |
if a == "guildSync" and b then |
DirtyRecruit.Print("Sync request from "..b) |
ChatThrottleLib:SendAddonMessage("NORMAL", "DirtyRecruit", "guildSynced|DR|"..DirtyRecruit.PerPlayer.Ad, "WHISPER", b) |
ChatThrottleLib:SendAddonMessage("NORMAL", "DirtyRecruit", "guildSynced|"..DirtyRecruit.PerPlayer.Ad, "WHISPER", b) |
end |
if a == "guildSynced" and b then |
DirtyRecruit.PerPlayer.Ad = b |
DirtyRecruit.OnPlayerRegenDisabled() |
elseif event == "PLAYER_REGEN_ENABLED" then |
DirtyRecruit.OnPlayerRegenEnabled() |
elseif event == "ZONE_CHANGED_NEW_AREA" then |
DirtyRecruit.ZoneChangedNewArea() |
elseif event == "CHAT_MSG_ADDON" and arg1 == "DirtyRecruit" then |
DirtyRecruit.OnChatMsgAddOn(arg2) |
elseif event == "VARIABLES_LOADED" then |
elseif cmd == "sync" then |
DirtyRecruit.Print("Requested sync from "..arg) |
ChatThrottleLib:SendAddonMessage("NORMAL", "DirtyRecruit", "guildSync|DR|"..UnitName("player"), "WHISPER", arg) |
elseif cmd == "testmode" then |
if DirtyRecruit.PerPlayer.TestMode ~= nil then |
DirtyRecruit.TestMode = nil |
DirtyRecruit.Print("Test mode off") |
else |
DirtyRecruit.TestMode = 1 |
DirtyRecruit.Print("Test mode on") |
end |
elseif cmd == "test" then |
if DirtyRecruit.PerPlayer.Ad then |
DirtyRecruit.Print(DirtyRecruit.PerPlayer.Ad) |
DirtyRecruit.AdvertiseTest() |
else |
DirtyRecruit.Print("no advertisement was found") |
end |
DirtyRecruit.Frame = DirtyRecruit.LibQTip:Acquire("DirtyRecruitFrame") |
DirtyRecruit.Frame:RegisterEvent("PLAYER_REGEN_DISABLED") |
DirtyRecruit.Frame:RegisterEvent("PLAYER_REGEN_ENABLED") |
DirtyRecruit.Frame:RegisterEvent("ZONE_CHANGED_NEW_AREA") |
DirtyRecruit.Frame:RegisterEvent("CHAT_MSG_ADDON") |
DirtyRecruit.Frame:RegisterEvent("VARIABLES_LOADED") |
DirtyRecruit.Frame:RegisterEvent("ADDON_LOADED") |
## Title: DirtyRecruit |
## Author: Dirtygurl |
## Version: 1.0.4 |
## Version: 1.0.4a |
## Notes: Automatic guild recruitment spam. |
## SavedVariables: DirtyRecruitGlobal |
if (GetLocale() ~= "frFR") then |
if (GetLocale() ~= "frFR") then return; end; |
DIRTYRECRUIT_TITLE = "Dirty Recruit"; |
DIRTYRECRUIT_SUBTITLE = "Instance Map Browser"; |
DIRTYRECRUIT_DESC = "Atlas is an instance map browser."; |
DIRTYRECRUIT_SUBTITLE = "..."; |
DIRTYRECRUIT_DESC = "..."; |
DIRTYRECRUIT_SLASH = "/dirtyrecruit"; |
DIRTYRECRUIT_SLASH_OPTIONS = "options"; |
DIRTYRECRUIT_STRING_LOCATION = "Location"; |
DIRTYRECRUIT_CHANNEL_GUILDRECRUITMENT = "RecrutementDeGuilde"; |
DIRTYRECRUIT_CHANNEL_LOOKINGFORGROUP = "RechercheDeGroupe"; |
DIRTYRECRUIT_CHANNEL_LOCALDEFENSE = "DéfenseLocale"; |
end; |
DIRTYRECRUIT_TITLE = "Dirty Recruit"; |
DIRTYRECRUIT_SUBTITLE = "Instance Map Browser"; |
DIRTYRECRUIT_DESC = "Atlas is an instance map browser."; |
DIRTYRECRUIT_SUBTITLE = "..."; |
DIRTYRECRUIT_DESC = "..."; |
DIRTYRECRUIT_SLASH = "/dirtyrecruit"; |
DIRTYRECRUIT_SLASH_OPTIONS = "options"; |
DIRTYRECRUIT_STRING_LOCATION = "Location"; |
DIRTYRECRUIT_CHANNEL_GUILDRECRUITMENT = "GuildRecruitment"; |
DIRTYRECRUIT_CHANNEL_LOOKINGFORGROUP = "LookingForGroup"; |
DIRTYRECRUIT_CHANNEL_LOCALDEFENSE = "LocalDefense"; |
DIRTYRECRUIT_GENERAL = "General"; |
DIRTYRECRUIT_TRADE = "Trade"; |
DIRTYRECRUIT_GUILDRECRUITMENT = "Guild Recruitment"; |
DIRTYRECRUIT_LOOKINGFORGROUP = "Looking For Group"; |
DIRTYRECRUIT_LOCALDEFENSE = "Local Defense"; |