/
if iIndex ~= nil then |
--DirtyRecruit.Print(iIndex..": "..DirtyRecruit.PerPlayer.Ad) |
SendChatMessage(DirtyRecruit.PerPlayer.Ad, "CHANNEL", nil, iIndex) |
SendAddonMessage("DirtyRecruit", "guildAdvertised:"..GetZoneText()..":"..UnitName("player"), "GUILD") |
SendAddonMessage("DirtyRecruit", "guildAdvertised|DR|"..GetZoneText().."|DR|"..UnitName("player"), "GUILD") |
end |
end |
end |
end |
function DirtyRecruit.Panel_Menu_Spam() |
local level = level or 1 |
-- note: might be conflict |
--local level = level or 1 |
local level = nil |
level = level or 1 |
local info = UIDropDownMenu_CreateInfo() |
info.text = "All Channels" |
function DirtyRecruit.OnChatMsgAddOn(action) |
--DirtyRecruit.Print("OnEvent:CHAT_MSG_ADDON") |
local a, b, c = strsplit(":", action) |
local a, b, c = strsplit("|DR|", 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) |
SendAddonMessage("DirtyRecruit", "guildSynced:"..DirtyRecruit.PerPlayer.Ad, "WHISPER", b) |
DirtyRecruit.Print("Sync request from "..b.." (disabled due to crash)") |
--DirtyRecruit.Print("Sync request from "..b) |
--SendAddonMessage("DirtyRecruit", "guildSynced|DR|"..DirtyRecruit.PerPlayer.Ad, "WHISPER", b) |
end |
if a == "guildSynced" and b then |
DirtyRecruit.PerPlayer.Ad = b |
DirtyRecruit.EditBox_Ad:SetText(DirtyRecruit.PerPlayer.Ad) |
DirtyRecruit.UpdateSettings() |
DirtyRecruit.Panel_OnShow() |
end |
elseif cmd == "reset" then |
DirtyRecruit.Panel_Default() |
elseif cmd == "sync" then |
DirtyRecruit.Print("Requested sync from "..arg) |
SendAddonMessage("DirtyRecruit", "guildSync:"..UnitName("player"), "WHISPER", arg) |
DirtyRecruit.Print("Requested sync from "..arg.." (disabled due to crash)") |
--SendAddonMessage("DirtyRecruit", "guildSync|DR|"..UnitName("player"), "WHISPER", arg) |
elseif cmd == "test" then |
if DirtyRecruit.PerPlayer.Ad then |
DirtyRecruit.Print(DirtyRecruit.PerPlayer.Ad) |
local MAJOR = "LibQTip-1.0" |
local MINOR = 22 -- Should be manually increased |
local MINOR = 29 -- Should be manually increased |
assert(LibStub, MAJOR.." requires LibStub") |
local lib, oldminor = LibStub:NewLibrary(MAJOR, MINOR) |
local AcquireTable, ReleaseTable |
local InitializeTooltip, SetTooltipSize, ResetTooltipSize, LayoutColspans |
local SetFrameScript, ClearFrameScripts |
------------------------------------------------------------------------------ |
-- Cache debugging. |
frame:SetParent(nil) |
frame:ClearAllPoints() |
frame:SetBackdrop(nil) |
ClearFrameScripts(frame) |
tinsert(frameHeap, frame) |
--[===[@debug@ |
usedFrames = usedFrames - 1 |
self.fontString:SetFontObject(GameTooltipText) |
end |
function labelPrototype:SetupCell(tooltip, value, justification, font, ...) |
function labelPrototype:SetupCell(tooltip, value, justification, font, l_pad, r_pad, max_width, min_width, ...) |
local fs = self.fontString |
fs:SetFontObject(font or tooltip:GetFont()) |
fs:SetJustifyH(justification) |
fs:SetText(tostring(value)) |
-- Variable argument checking |
local l_pad, r_pad, max_width, min_width |
local i, arg = 1, ... |
if arg == nil or type(arg) == "number" then |
i, l_pad, arg = i + 1, select(i, ...) |
end |
l_pad = l_pad or 0 |
if arg == nil or type(arg) == "number" then |
i, r_pad, arg = i + 1, select(i, ...) |
end |
r_pad = r_pad or 0 |
if arg == nil or type(arg) == "number" then |
i, max_width, arg = i + 1, select(i, ...) |
end |
if arg == nil or type(arg) == "number" then |
i, min_width = (i + 1), arg |
end |
-- Use GetHeight() instead of GetStringHeight() so lines which are longer than width will wrap. |
local height = fs:GetHeight() |
local width = fs:GetStringWidth() + l_pad + r_pad |
fs:SetPoint("TOPLEFT", self, "TOPLEFT", l_pad, 0) |
if max_width and min_width and (max_width < min_width) then |
error("maximum width cannot be lower than minimum width: "..tostring(max_width).." < "..tostring(min_width), 2) |
end |
if min_width and width < min_width then width = min_width end |
if max_width and (max_width < width) then |
width = max_width |
fs:SetWidth(width) |
height = fs:GetHeight() |
end |
if min_width and width < min_width then width = min_width end |
if max_width and max_width < width then width = max_width end |
fs:SetWidth(width) |
fs:Show() |
return width, height |
-- Use GetHeight() instead of GetStringHeight() so lines which are longer than width will wrap. |
return width, fs:GetHeight() |
end |
function labelPrototype:GetPosition() return self._line, self._column end |
function AcquireCell(tooltip, provider) |
local cell = provider:AcquireCell(tooltip) |
cell:SetParent(tooltip.scrollChild) |
cell:SetFrameLevel(tooltip.scrollChild:GetFrameLevel() + 1) |
cell:SetFrameLevel(tooltip.scrollChild:GetFrameLevel() + 3) |
cell._provider = provider |
return cell |
end |
cell:Hide() |
cell:ClearAllPoints() |
cell:SetParent(nil) |
cell:SetBackdrop(nil) |
ClearFrameScripts(cell) |
cell._font, cell._justification, cell._colSpan, cell._line, cell._column = nil |
cell._provider:ReleaseCell(cell) |
tooltip:SetBackdropColor(GameTooltip:GetBackdropColor()) |
tooltip:SetBackdropBorderColor(GameTooltip:GetBackdropBorderColor()) |
tooltip:SetScale(GameTooltip:GetScale()) |
tooltip:SetAlpha(GameTooltip:GetAlpha()) |
tooltip:SetAlpha(1) |
tooltip:SetFrameStrata("TOOLTIP") |
tooltip:SetClampedToScreen(false) |
checkJustification(justification, 2) |
local colNum = #self.columns + 1 |
local column = self.columns[colNum] or AcquireFrame(self) |
column:SetParent(self.scrollChild) |
local column = self.columns[colNum] or AcquireFrame(self.scrollChild) |
column:SetFrameLevel(self.scrollChild:GetFrameLevel() + 1) |
column.justification = justification |
column.width = 0 |
column:SetWidth(1) |
-- all data is in the tooltip; fix colspan width and prevent the layout cleaner from messing up the tooltip later |
LayoutColspans(self) |
layoutCleaner.registry[self] = nil |
local topside = self:GetTop() |
local bottomside = self:GetBottom() |
local screensize = UIParent:GetHeight() |
error("column layout should be defined before adding line", 3) |
end |
local lineNum = #tooltip.lines + 1 |
local line = tooltip.lines[lineNum] or AcquireFrame(tooltip) |
local line = tooltip.lines[lineNum] or AcquireFrame(tooltip.scrollChild) |
line:SetFrameLevel(tooltip.scrollChild:GetFrameLevel() + 2) |
line:SetPoint('LEFT', tooltip.scrollChild) |
line:SetPoint('RIGHT', tooltip.scrollChild) |
if lineNum > 1 then |
return lineNum, colNum |
end |
function tipPrototype:SetCellColor(lineNum, colNum, r, g, b, a) |
local cell = self.lines[lineNum].cells[colNum] |
if cell then |
local sr, sg, sb, sa = self:GetBackdropColor() |
cell:SetBackdrop(GenericBackdrop) |
cell:SetBackdropColor(r or sr, g or sg, b or sb, a or sa) |
end |
end |
function tipPrototype:SetColumnColor(colNum, r, g, b, a) |
if type(colNum) ~= "number" then |
error("column number must be a number, not: "..tostring(colNum), 2) |
elseif colNum < 1 or colNum > #self.columns then |
error("column number out of range: "..tostring(colNum), 2) |
local column = self.columns[colNum] |
if column then |
local sr, sg, sb, sa = self:GetBackdropColor() |
column:SetBackdrop(GenericBackdrop) |
column:SetBackdropColor(r or sr, g or sg, b or sb, a or sa) |
end |
local column = self.columns[colNum] |
local sr, sg, sb, sa = self:GetBackdropColor() |
column:SetBackdrop(GenericBackdrop) |
column:SetBackdropColor(r or sr, g or sg, b or sb, a or sa) |
end |
function tipPrototype:SetLineColor(lineNum, r, g, b, a) |
if type(lineNum) ~= "number" then |
error("line number must be a number, not: "..tostring(lineNum), 2) |
elseif lineNum < 1 or lineNum > #self.lines then |
error("line number out of range: "..tostring(lineNum), 2) |
local line = self.lines[lineNum] |
if line then |
local sr, sg, sb, sa = self:GetBackdropColor() |
line:SetBackdrop(GenericBackdrop) |
line:SetBackdropColor(r or sr, g or sg, b or sb, a or sa) |
end |
local line = self.lines[lineNum] |
local sr, sg, sb, sa = self:GetBackdropColor() |
line:SetBackdrop(GenericBackdrop) |
line:SetBackdropColor(r or sr, g or sg, b or sb, a or sa) |
end |
-- TODO: fixed argument positions / remove checks for performance? |
function tipPrototype:SetCell(lineNum, colNum, value, ...) |
-- Mandatory argument checking |
if type(lineNum) ~= "number" then |
function tipPrototype:GetColumnCount() return #self.columns end |
------------------------------------------------------------------------------ |
-- Frame Scripts |
------------------------------------------------------------------------------ |
local highlight = CreateFrame("Frame", nil, UIParent) |
highlight:SetFrameStrata("TOOLTIP") |
highlight:Hide() |
highlight._texture = highlight:CreateTexture(nil, "OVERLAY") |
highlight._texture:SetTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight") |
highlight._texture:SetBlendMode("ADD") |
highlight._texture:SetAllPoints(highlight) |
local scripts = { |
OnEnter = function(frame, ...) |
highlight:SetParent(frame) |
highlight:SetAllPoints(frame) |
highlight:Show() |
if frame._OnEnter_func then |
frame:_OnEnter_func(frame._OnEnter_arg, ...) |
end |
end, |
OnLeave = function(frame, ...) |
highlight:Hide() |
highlight:ClearAllPoints() |
highlight:SetParent(nil) |
if frame._OnLeave_func then |
frame:_OnLeave_func(frame._OnLeave_arg, ...) |
end |
end, |
OnMouseDown = function(frame, ...) |
frame:_OnMouseDown_func(frame._OnMouseDown_arg, ...) |
end, |
OnMouseUp = function(frame, ...) |
frame:_OnMouseUp_func(frame._OnMouseUp_arg, ...) |
end, |
} |
function SetFrameScript(frame, script, func, arg) |
if not scripts[script] then |
return |
end |
frame["_"..script.."_func"] = func |
frame["_"..script.."_arg"] = arg |
if script == "OnMouseDown" or script == "OnMouseUp" then |
if func then |
frame:SetScript(script, scripts[script]) |
else |
frame:SetScript(script, nil) |
end |
end |
-- if at least one script is set, set the OnEnter/OnLeave scripts for the highlight |
if frame._OnEnter_func or frame._OnLeave_func or frame._OnMouseDown_func or frame._OnMouseUp_func then |
frame:EnableMouse(true) |
frame:SetScript("OnEnter", scripts.OnEnter) |
frame:SetScript("OnLeave", scripts.OnLeave) |
else |
frame:EnableMouse(false) |
frame:SetScript("OnEnter", nil) |
frame:SetScript("OnLeave", nil) |
end |
end |
function ClearFrameScripts(frame) |
if frame._OnEnter_func or frame._OnLeave_func or frame._OnMouseDown_func or frame._OnMouseUp_func then |
frame:EnableMouse(false) |
frame:SetScript("OnEnter", nil) |
frame._OnEnter_func = nil |
frame._OnEnter_arg = nil |
frame:SetScript("OnLeave", nil) |
frame._OnLeave_func = nil |
frame._OnLeave_arg = nil |
frame:SetScript("OnMouseDown", nil) |
frame._OnMouseDown_func = nil |
frame._OnMouseDown_arg = nil |
frame:SetScript("OnMouseUp", nil) |
frame._OnMouseUp_func = nil |
frame._OnMouseUp_arg = nil |
end |
end |
function tipPrototype:SetLineScript(lineNum, script, func, arg) |
SetFrameScript(self.lines[lineNum], script, func, arg) |
end |
function tipPrototype:SetColumnScript(colNum, script, func, arg) |
SetFrameScript(self.columns[colNum], script, func, arg) |
end |
function tipPrototype:SetCellScript(lineNum, colNum, script, func, arg) |
local cell = self.lines[lineNum].cells[colNum] |
if cell then |
SetFrameScript(cell, script, func, arg) |
end |
end |
------------------------------------------------------------------------------ |
-- Auto-hiding feature |
------------------------------------------------------------------------------ |
-- Script of the auto-hiding child frame |
local function AutoHideTimerFrame_OnUpdate(self, elapsed) |
if MouseIsOver(self:GetParent()) or (self.alternateFrame and MouseIsOver(self.alternateFrame)) then |
self.elapsed = 0 |
else |
self.elapsed = self.elapsed + elapsed |
if self.elapsed > self.delay then |
lib:Release(self:GetParent()) |
self.checkElapsed = self.checkElapsed + elapsed |
if self.checkElapsed > 0.1 then |
if MouseIsOver(self.parent) or (self.alternateFrame and MouseIsOver(self.alternateFrame)) then |
self.elapsed = 0 |
else |
self.elapsed = self.elapsed + self.checkElapsed |
if self.elapsed >= self.delay then |
lib:Release(self.parent) |
end |
end |
self.checkElapsed = 0 |
end |
end |
-- :SetAutoHideDelay(0.25, someFrame) => hides after 0.25sec outside of both the tooltip and someFrame |
-- :SetAutoHideDelay() => disable auto-hiding (default) |
function tipPrototype:SetAutoHideDelay(delay, alternateFrame) |
local timerFrame = self.autoHideTimerFrame |
delay = tonumber(delay) or 0 |
local timerFrame = self.autoHideTimerFrame |
if delay > 0 then |
if not timerFrame then |
timerFrame = AcquireFrame(self) |
timerFrame:SetScript("OnUpdate", AutoHideTimerFrame_OnUpdate) |
self.autoHideTimerFrame = timerFrame |
end |
timerFrame.parent = self |
timerFrame.checkElapsed = 0 |
timerFrame.elapsed = 0 |
timerFrame.delay = delay |
timerFrame.alternateFrame = alternateFrame |
-- LibStub is a simple versioning stub meant for use in Libraries. http://www.wowace.com/wiki/LibStub for more info |
-- LibStub is hereby placed in the Public Domain |
-- Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel, joshborke |
-- Very minor modification for WAR use by Aiiane |
local LIBSTUB_MAJOR, LIBSTUB_MINOR = "LibStub", 3 -- NEVER MAKE THIS AN SVN REVISION! IT NEEDS TO BE USABLE IN ALL REPOS! |
-- LibStub is hereby placed in the Public Domain Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel, joshborke |
local LIBSTUB_MAJOR, LIBSTUB_MINOR = "LibStub", 2 -- NEVER MAKE THIS AN SVN REVISION! IT NEEDS TO BE USABLE IN ALL REPOS! |
local LibStub = _G[LIBSTUB_MAJOR] |
local strmatch = string.match |
-- Check to see is this version of the stub is obsolete |
if not LibStub or LibStub.minor < LIBSTUB_MINOR then |
LibStub = LibStub or {libs = {}, minors = {} } |
_G[LIBSTUB_MAJOR] = LibStub |
LibStub.minor = LIBSTUB_MINOR |
-- LibStub:NewLibrary(major, minor) |
-- major (string) - the major version of the library |
-- minor (string or number ) - the minor version of the library |
-- |
-- returns nil if a newer or same version of the lib is already present |
-- returns empty library object or old library object if upgrade is needed |
function LibStub:NewLibrary(major, minor) |
assert(type(major) == "string", "Bad argument #2 to `NewLibrary' (string expected)") |
minor = assert(tonumber(strmatch(minor, "%d+")), "Minor version must either be a number or contain a number.") |
return self.libs[major], oldminor |
end |
-- LibStub:GetLibrary(major, [silent]) |
-- major (string) - the major version of the library |
-- silent (boolean) - if true, library is optional, silently return nil if its not found |
-- |
-- throws an error if the library can not be found (except silent is set) |
-- returns the library object if found |
function LibStub:GetLibrary(major, silent) |
if not self.libs[major] and not silent then |
error(("Cannot find a library instance of %q."):format(tostring(major)), 2) |
return self.libs[major], self.minors[major] |
end |
-- LibStub:IterateLibraries() |
-- |
-- Returns an iterator for the currently registered libraries |
function LibStub:IterateLibraries() |
return pairs(self.libs) |
end |
function LibStub:IterateLibraries() return pairs(self.libs) end |
setmetatable(LibStub, { __call = LibStub.GetLibrary }) |
end |
## Title: DirtyRecruit |
## Author: Dirtygurl |
## Version: 1.0.1a |
## Version: 1.0.1b |
## Notes: Automatic guild recruitment spam. |
## DefaultState: Enabled |
## SavedVariables: DirtyRecruitGlobal |
## SavedVariablesPerCharacter: DirtyRecruitPerPlayer |