WoWInterface SVN DirtyRecruit

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 2 to Rev 3
    Reverse comparison

Rev 2 → Rev 3

trunk/DirtyRecruit/DirtyRecruit.toc
2,7 → 2,7
 
## Title: DirtyRecruit
## Author: Dirtygurl
## Version: 1.0-a
## Version: 1.0-a1
## Notes: Automatic guild recruitment spam.
## SavedVariables: DirtyRecruitGlobal
## SavedVariablesPerCharacter: DirtyRecruitPerPlayer
trunk/DirtyRecruit/DirtyRecruit.lua
11,11 → 11,11
{
Active = nil,
InCombat = nil,
Spam = "all",
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."
}
 
DirtyRecruit.Spammed = nil
DirtyRecruit.TimeSinceLastUpdate = 0
 
function DirtyRecruit.Print(msg)
40,10 → 40,15
local iIndex = nil
local _, nGeneral = GetChannelName(1)
local _, nTrade = GetChannelName(2)
if nTrade and nTrade:match("^Trade - ") then
if nTrade and nTrade:match("^Trade - ") and (DirtyRecruit.PerPlayer.Spam == "all" or DirtyRecruit.PerPlayer.Spam == "major") then
iIndex = 2
elseif nGeneral and nGeneral:match("^General - ") then
iIndex = 1
elseif nGeneral and nGeneral:match("^General - ") and (DirtyRecruit.PerPlayer.Spam == "all" or DirtyRecruit.PerPlayer.Spam == "general") then
-- Note: blah, too lazy to do it a proper way
if nTrade and nTrade:match("^Trade - ") then
iIndex = nil
else
iIndex = 1
end
end
if iIndex ~= nil then
--DirtyRecruit.Print(iIndex..": "..DirtyRecruit.PerPlayer.Ad)
55,8 → 60,9
 
function DirtyRecruit.OnUpdateSpam(self, elapsed)
--DirtyRecruit.Print("OnUpdate")
local UpdateInterval = tonumber(DirtyRecruit.PerPlayer.UpdateInterval)
DirtyRecruit.TimeSinceLastUpdate = DirtyRecruit.TimeSinceLastUpdate + elapsed
if DirtyRecruit.TimeSinceLastUpdate > DirtyRecruit.PerPlayer.UpdateInterval then
if DirtyRecruit.TimeSinceLastUpdate and DirtyRecruit.TimeSinceLastUpdate >= UpdateInterval then
if IsInGuild() and CanGuildInvite() and DirtyRecruit.PerPlayer.Ad ~= nil and DirtyRecruit.PerPlayer.Active and not DirtyRecruit.PerPlayer.InCombat and not DirtyRecruit.IsInPVPOrInstance() then
DirtyRecruit.Advertise()
end
85,6 → 91,12
function DirtyRecruit.OnVariablesLoaded()
--DirtyRecruit.Print("OnEvent:VARIABLES_LOADED")
--[[
-- Updated Variables
--]]
if not DirtyRecruitPerPlayer.Spam then
DirtyRecruitPerPlayer.Spam = "all"
end
--[[
-- Global Variables
--]]
if not DirtyRecruitGlobal then
151,13 → 163,24
DirtyRecruit.PerPlayer.Ad = nil
DirtyRecruit.UpdateSettings()
elseif cmd == "interval" and arg then
if tonumber(arg) >= 10 then
DirtyRecruit.Print("interval set to "..tonumber(arg))
DirtyRecruit.PerPlayer.UpdateInterval = tonumber(arg)
local uInterval = tonumber(arg)
-- Note: We're gonna set this to 1 minute for spam sake
if uInterval >= 60 then
DirtyRecruit.Print("interval set to "..arg)
DirtyRecruit.PerPlayer.UpdateInterval = arg
DirtyRecruit.UpdateSettings()
else
DirtyRecruit.Print("interval could not be set")
end
elseif cmd == "spam" and arg then
local uSpam = strlower(arg)
if uSpam == "all" or uSpam == "major" or uSpam == "general" then
DirtyRecruit.Print("spam set to "..uSpam)
DirtyRecruit.PerPlayer.Spam = uSpam
DirtyRecruit.UpdateSettings()
else
DirtyRecruit.Print("spam could not be set")
end
elseif cmd == "test" then
if DirtyRecruit.PerPlayer.Ad then
DirtyRecruit.Print(DirtyRecruit.PerPlayer.Ad)
168,9 → 191,10
DirtyRecruit.Print("DirtyRecruit v"..DirtyRecruit.Version)
DirtyRecruit.Print("Syntax: |cffffff7f/dirtyrecruit <command> <args>|r")
DirtyRecruit.Print(" |cff00ff00v|version|r - Shows addon version.")
DirtyRecruit.Print(" |cff00ff00enable|disable|r - Enables/Disables addon.")
DirtyRecruit.Print(" |cff00ff00enable|disable|r - Enables/Disables addon. default: disabled")
DirtyRecruit.Print(" |cff00ff00set|unset|r - Set/Unset addon advertisement message.")
DirtyRecruit.Print(" |cff00ff00interval|r - Sets the interval (in seconds) for advertising.")
DirtyRecruit.Print(" |cff00ff00interval|r - Sets the interval (in seconds) for advertising. default: 5 mins (300 seconds)")
DirtyRecruit.Print(" |cff00ff00spam|r - Sets where you will advertise. options: all, major, general")
DirtyRecruit.Print(" |cff00ff00test|r - Prints out a test advertisement for private viewing.")
DirtyRecruit.Print(" |cff00ff00help|r - Shows addon help.")
end