1
0
Fork 0

Fixed an absurd amount of bugs, which serves me right for not testing a single module before making them all

This commit is contained in:
pigmonkey 2011-05-30 18:13:08 -04:00
parent 0bd08158bb
commit a237d9c06b
16 changed files with 169 additions and 152 deletions

View file

@ -18,44 +18,47 @@ local options = {
}, },
} }
local slashCallback = {} local slashCallback = {}
local slashList = {}
local prototype = {}
core:SetDefaultModulePrototype(prototype)
core:SetDefaultModuleLibraries("AceConsole-3.0")
function core:OnInitialize() function core:OnInitialize()
self.db = LibStub("AceDB-3.0"):New("AllTheLittleThingsDB", defaults, "Default") self.db = LibStub("AceDB-3.0"):New("AllTheLittleThingsDB", defaults, "Default") or {}
self:RegisterChatCommand("atlt", "MainSlashHandle") self:RegisterChatCommand("atlt", "MainSlashHandle")
-- LibStub("AceConfigRegistry-3.0"):RegisterOptionsTable("AllTheLittleThings", options) LibStub("AceConfigRegistry-3.0"):RegisterOptionsTable("AllTheLittleThings", options)
-- local ACD = LibStub("AceConfigDialog-3.0") local ACD = LibStub("AceConfigDialog-3.0")
-- ACD:AddToBlizOptions("AllTheLittleThings", "AllTheLittleThings") ACD:AddToBlizOptions("AllTheLittleThings", "AllTheLittleThings")
self:SetDefaultModulePrototype({
RegisterOptions = core.RegisterOptions,
RegisterSlashCommand = core.RegisterSlashCommand,
})
end end
function core:OnEnable() function core:OnEnable()
end end
function core:OnDisable() function core:OnDisable()
end end
-- two registry functions called with self=mod -- two registry functions called with self=mod
function core:RegisterOptions(options, defaults) function core:RegisterOptions(modOptions, modDefaults)
local name = self:GetName() local name = self:GetName()
defaults.profile[name] = defaults defaults.profile[name] = modDefaults
options.args[name] = { options.args[name] = {
name = name, name = name,
type = 'group', type = 'group',
args = options args = modOptions
} }
end end
function core:RegisterSlashCommand(callback, ...) function core:RegisterSlashCommand(callback, ...)
local long = ""
for i=1,select('#', ...) do for i=1,select('#', ...) do
slashCallback[select('i', ...)] = self[callback] local slash = select(i, ...)
slashCallback[slash] = self[callback]
long = string.len(slash)>string.len(long) and slash or long
end end
slashList[long] = ("%s:%s()"):format(self:GetName(), callback)
end end
function core:MainSlashHandle(msg) function core:MainSlashHandle(msg)
@ -69,3 +72,7 @@ function core:MainSlashHandle(msg)
end end
end end
-- fill out our prototype now that our addon's indicies are populated
prototype.RegisterOptions = core.RegisterOptions
prototype.RegisterSlashCommand = core.RegisterSlashCommand

View file

@ -23,8 +23,6 @@ AllTheLittleThings.lua
modules\announce.lua modules\announce.lua
modules\battlegrounds.lua modules\battlegrounds.lua
modules\chatfilter.lua modules\chatfilter.lua
modules\defaultui.lua
# modules\deprecated.lua
modules\guildroster.lua modules\guildroster.lua
modules\macros.lua modules\macros.lua
modules\miscellaneous.lua modules\miscellaneous.lua
@ -32,5 +30,5 @@ modules\potions.lua
modules\prat.lua modules\prat.lua
modules\raid.lua modules\raid.lua
modules\rbs.lua modules\rbs.lua
modules\template.lua modules\staging.lua

View file

@ -1,6 +1,6 @@
local core = LibStub("AceAddon-3.0"):GetAddon("AllTheLittleThings") local core = LibStub("AceAddon-3.0"):GetAddon("AllTheLittleThings")
local mod = core:NewModule("Announce", "AceEvent-3.0") local mod = core:NewModule("Announce", "AceEvent-3.0", "AceTimer-3.0")
local db = core.db.profile[mod:GetName()] local db
local defaults = { local defaults = {
interrupt = false, interrupt = false,
@ -56,15 +56,16 @@ local armorGlyphs = {
} }
function mod:OnInitialize() function mod:OnInitialize()
core:RegisterOptions(options, defaults) db = core.db.profile[self:GetName()] or {}
core:RegisterSlashCommand("method", "slsh1", "slash2") self:RegisterOptions(options, defaults)
self:RegisterSlashCommand("method", "slsh1", "slash2")
end end
function mod:OnEnable() function mod:OnEnable()
self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
end end
function core:COMBAT_LOG_EVENT_UNFILTERED(_, timestamp, event, _, srcGUID, srcName, srcFlags, dstGUID, dstName, dstFlags, spellid, spellName, spellSchool, extraSpellid, extraSpellName, ...) function mod:COMBAT_LOG_EVENT_UNFILTERED(_, timestamp, event, _, srcGUID, srcName, srcFlags, dstGUID, dstName, dstFlags, spellid, spellName, spellSchool, extraSpellid, extraSpellName, ...)
-- Interrupt ------------------------------------------------------------------ -- Interrupt ------------------------------------------------------------------
if db.interrupt and GetNumPartyMembers()>0 then if db.interrupt and GetNumPartyMembers()>0 then
if event == "SPELL_INTERRUPT" and srcName == UnitName("player") then if event == "SPELL_INTERRUPT" and srcName == UnitName("player") then

View file

@ -1,6 +1,6 @@
local core = LibStub("AceAddon-4.0"):GetAddon("AllTheLittleThings") local core = LibStub("AceAddon-3.0"):GetAddon("AllTheLittleThings")
local mod = core:NewModule("Battlegrounds", "AceEvent-3.0", "AceConsole-3.0") local mod = core:NewModule("Battlegrounds", "AceEvent-3.0", "AceHook-3.0")
local db = core.db.profile[mod:GetName()] local db
local defaults = { local defaults = {
autoWG = false, autoWG = false,
@ -25,12 +25,13 @@ local gilneasTimes = { -- time in seconds to get a point
[2] = 3, [2] = 3,
[3] = 1/3, [3] = 1/3,
} }
core.wgStatus = 0 local wgStatus = 0
core.flagStatus = 0 local flagStatus = 0
function mod:OnInitialize() function mod:OnInitialize()
core:RegisterOptions(options, defaults) db = core.db.profile[self:GetName()] or {}
core:RegisterSlash("ArathiPrint", "ab", "arathibasin") self:RegisterOptions(options, defaults)
self:RegisterSlashCommand("ArathiPrint", "ab", "arathibasin")
end end
function mod:OnEnable() function mod:OnEnable()
@ -96,12 +97,12 @@ function mod:BATTLEFIELD_MGR_ENTRY_INVITE()
end end
-- Eye of the Storm ------------------------------------------------------------ -- Eye of the Storm ------------------------------------------------------------
function core:BattlegroundMessage(event, msg) function mod:BattlegroundMessage(event, msg)
local faction = ((event=="CHAT_MSG_BG_SYSTEM_ALLIANCE" and 1) or 2) local faction = ((event=="CHAT_MSG_BG_SYSTEM_ALLIANCE" and 1) or 2)
if string.find(msg, "captured.+flag") or string.find(msg, "dropped.+flag") then if string.find(msg, "captured.+flag") or string.find(msg, "dropped.+flag") then
self.flagStatus = 0 flagStatus = 0
elseif string.find(msg, "taken.+flag") then elseif string.find(msg, "taken.+flag") then
self.flagStatus = faction flagStatus = faction
end end
end end
@ -109,15 +110,15 @@ function mod:WorldStateAlwaysUpFrame_Update(...)
self.hooks["WorldStateAlwaysUpFrame_Update"](...) self.hooks["WorldStateAlwaysUpFrame_Update"](...)
if db.eotsFlag and GetRealZoneText() == "Eye of the Storm" then if db.eotsFlag and GetRealZoneText() == "Eye of the Storm" then
local points = {[0]=0, 75, 85, 100, 500} local points = {[0]=0, 75, 85, 100, 500}
if self.flagStatus > 0 then if flagStatus > 0 then
local i = self.flagStatus + 1 local i = flagStatus + 1
if select(3, GetWorldStateUIInfo(i)) then -- extra if since I got a lua error while leaving a BG once if select(3, GetWorldStateUIInfo(i)) then -- extra if since I got a lua error while leaving a BG once
local _, _, full, bases, score = string.find(select(3, GetWorldStateUIInfo(i)), "(Bases: (%d).-(%d+)/.+)") local _, _, full, bases, score = string.find(select(3, GetWorldStateUIInfo(i)), "(Bases: (%d).-(%d+)/.+)")
if not full then return end if not full then return end
-- self:Print(string.find(select(3, GetWorldStateUIInfo(i)), "(Bases: (%d).-(%d+)/.+)")) -- self:Print(string.find(select(3, GetWorldStateUIInfo(i)), "(Bases: (%d).-(%d+)/.+)"))
-- self:Print(GetWorldStateUIInfo(i)) -- self:Print(GetWorldStateUIInfo(i))
local nScore = "|cff00ff00" .. (tonumber(score)+points[tonumber(bases)]) .. "|r" local nScore = "|cff00ff00" .. (tonumber(score)+points[tonumber(bases)]) .. "|r"
local frame = _G["AlwaysUpFrame"..self.flagStatus.."Text"] local frame = _G["AlwaysUpFrame"..flagStatus.."Text"]
if frame then if frame then
frame:SetText(string.gsub(full, score.."/", nScore.."/")) frame:SetText(string.gsub(full, score.."/", nScore.."/"))
end end
@ -127,8 +128,8 @@ function mod:WorldStateAlwaysUpFrame_Update(...)
end end
-- function mod:OnKeyDown() -- function mod:OnKeyDown()
-- if self.wgStatus > 0 and GetRealZoneText() ~= "Wintergrasp" then -- if wgStatus > 0 and GetRealZoneText() ~= "Wintergrasp" then
-- self.wgStatus = 0 -- wgStatus = 0
-- BattlefieldMgrEntryInviteResponse(1, 1) -- BattlefieldMgrEntryInviteResponse(1, 1)
-- end -- end
-- end -- end

View file

@ -1,6 +1,6 @@
local core = LibStub("AceAddon-3.0"):GetAddon("AllTheLittleThings") local core = LibStub("AceAddon-3.0"):GetAddon("AllTheLittleThings")
local mod = core:NewModule("Chat Filter") local mod = core:NewModule("Chat Filter")
local db = core.db.profile[mod:GetName()] local db
local defaults = { local defaults = {
} }
@ -13,6 +13,11 @@ local options = {
} }
function mod:OnInitialize() function mod:OnInitialize()
db = core.db.profile[self:GetName()] or {}
-- self:FilterAll("achievement:284")
self:FilterAll(nil, "Alabrooke")
self:FilterAll(nil, "Warrwarr")
end end
local chatEvents = { local chatEvents = {
@ -81,7 +86,7 @@ local chatEvents = {
local contentFilters = { } local contentFilters = { }
local sourceFilters = { } local sourceFilters = { }
function core:FilterAll(filter, source) function mod:FilterAll(filter, source)
if not db.filterOn then return end if not db.filterOn then return end
if filter or source then if filter or source then
@ -105,6 +110,3 @@ function core:FilterAll(filter, source)
end end
end end
-- core:FilterAll("achievement:284")
core:FilterAll(nil, "Alabrooke")
core:FilterAll(nil, "Warrwarr")

View file

@ -1,14 +0,0 @@
local core = LibStub("AceAddon-3.0"):GetAddon("AllTheLittleThings")
local mod = core:NewModule("Battlegrounds", "AceEvent-3.0")
local db = core.db.profile[mod:GetName()]
local defaults = {
}
local options = {
}
function mod:OnInitialize()
core:RegisterOptions(options, defaults)
core:RegisterSlashCommand("method", "slsh1", "slash2")
end

View file

@ -1,7 +1,7 @@
-- These are here for historical purposes only -- do not include in .toc -- These are here for historical purposes only -- do not include in .toc
local core = LibStub("AceAddon-3.0"):GetAddon("AllTheLittleThings") local core = LibStub("AceAddon-3.0"):GetAddon("AllTheLittleThings")
local mod = core:NewModule("Deprecated", "AceEvent-3.0") local mod = core:NewModule("Deprecated", "AceEvent-3.0")
local db = core.db.profile[mod:GetName()] local db
local defaults = { local defaults = {
macroSwap = false, macroSwap = false,
@ -15,13 +15,14 @@ local options = {
} }
function mod:OnInitialize() function mod:OnInitialize()
core:RegisterOptions(options, defaults) db = core.db.profile[self:GetName()] or {}
core:RegisterSlashCommand("method", "slsh1", "slash2") self:RegisterOptions(options, defaults)
self:RegisterSlashCommand("method", "slsh1", "slash2")
end end
-- Lich King Flame Cap Macro --------------------------------------------------- -- Lich King Flame Cap Macro ---------------------------------------------------
local macro = "MI+FC"; local macro = "MI+FC";
function core:ZoneChange() function mod:ZoneChange()
if (db.macroSwap and UnitName("player")=="Chira" and GetMacroIndexByName(macro)>0) then if (db.macroSwap and UnitName("player")=="Chira" and GetMacroIndexByName(macro)>0) then
if (GetSubZoneText() == "The Frozen Throne" and self:GetMode()>3) then if (GetSubZoneText() == "The Frozen Throne" and self:GetMode()>3) then
EditMacro(GetMacroIndexByName(macro), nil, nil, GetMacroBody(macro):gsub("Flame Caq", "Flame Cap")); EditMacro(GetMacroIndexByName(macro), nil, nil, GetMacroBody(macro):gsub("Flame Caq", "Flame Cap"));
@ -31,13 +32,13 @@ function core:ZoneChange()
end end
end end
function core:GetMode() function mod:GetMode()
local _, _, diff, _, _, dynHeroic, dynFlag = GetInstanceInfo(); local _, _, diff, _, _, dynHeroic, dynFlag = GetInstanceInfo();
return diff; -- (dynFlag and (2-(diff%2)+2*dynHeroic)) or diff; return diff; -- (dynFlag and (2-(diff%2)+2*dynHeroic)) or diff;
end end
-- Attempt to monitor n52 problem ---------------------------------------------- -- Attempt to monitor n52 problem ----------------------------------------------
function core:Nostromo() function mod:Nostromo()
local keys = {"W", "A", "S", "D"} local keys = {"W", "A", "S", "D"}
local xVal = {1, 0, 1, 2} local xVal = {1, 0, 1, 2}
local yVal = {0, 1, 1, 1} local yVal = {0, 1, 1, 1}
@ -75,9 +76,9 @@ function core:Nostromo()
end end
-- creates a text string and hooks every CLEU to try and find a problematic addon -- creates a text string and hooks every CLEU to try and find a problematic addon
function core:SetupAddonDebug() function mod:SetupAddonDebug()
local frame = CreateFrame("frame") local frame = CreateFrame("frame")
frame:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", self.db.profile.addonDebug.x, self.db.profile.addonDebug.y) frame:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", db.addonDebug.x, db.addonDebug.y)
frame:SetSize(100, 30) frame:SetSize(100, 30)
frame:EnableMouse(true) frame:EnableMouse(true)
frame:SetMovable(true) frame:SetMovable(true)
@ -88,8 +89,8 @@ function core:SetupAddonDebug()
end) end)
frame:SetScript("OnDragStop", function(self) frame:SetScript("OnDragStop", function(self)
self:StopMovingOrSizing() self:StopMovingOrSizing()
core.db.profile.addonDebug.x = self:GetLeft() db.addonDebug.x = self:GetLeft()
core.db.profile.addonDebug.y = self:GetTop() db.addonDebug.y = self:GetTop()
end) end)
local text = frame:CreateFontString(nil, nil, "GameFontNormal") local text = frame:CreateFontString(nil, nil, "GameFontNormal")
@ -127,7 +128,7 @@ function core:SetupAddonDebug()
end end
-- Bug with text in animations ------------------------------------------------- -- Bug with text in animations -------------------------------------------------
function core:BugInit() function mod:BugInit()
local f = CreateFrame("frame") local f = CreateFrame("frame")
f:SetSize(50, 50) f:SetSize(50, 50)
f:SetPoint("CENTER") f:SetPoint("CENTER")
@ -189,7 +190,7 @@ local function my_hash(key, ...)
end end
-- Saampson Shards and Deathblood Venom deposit -------------------------------- -- Saampson Shards and Deathblood Venom deposit --------------------------------
function core:CHAT_MSG_LOOT(_, message, source) function mod:CHAT_MSG_LOOT(_, message, source)
-- if (message:find("Saampson") and message:find("Shadowfrost Shard")) then -- if (message:find("Saampson") and message:find("Shadowfrost Shard")) then
-- SendChatMessage(format("Saampson Shard Count: %d", math.random(15, 50)), "raid"); -- SendChatMessage(format("Saampson Shard Count: %d", math.random(15, 50)), "raid");
-- end -- end
@ -212,10 +213,10 @@ function core:CHAT_MSG_LOOT(_, message, source)
end end
-- Consolidate Thresh -- Consolidate Thresh
function core:UnitAura(...) function mod:UnitAura(...)
name, rank, icon, count, dispelType, duration, expires, caster, isStealable, shouldConsolidate, spellID = self.hooks["UnitAura"](...) name, rank, icon, count, dispelType, duration, expires, caster, isStealable, shouldConsolidate, spellID = self.hooks["UnitAura"](...)
if expires and (self.db.profile.consolidateThresh > 0) then if expires and (db.consolidateThresh > 0) then
if ((expires-GetTime())/60 > self.db.profile.consolidateThresh) or (name:find("Aura") or name:find("Totem")) or (shouldConsolidate == 1) then if ((expires-GetTime())/60 > db.consolidateThresh) or (name:find("Aura") or name:find("Totem")) or (shouldConsolidate == 1) then
shouldConsolidate = 1 shouldConsolidate = 1
else else
shouldConsolidate = nil shouldConsolidate = nil
@ -227,7 +228,7 @@ end
-- Slash Commands -- Slash Commands
function core:SlashProcess(msg) function mod:SlashProcess(msg)
if msg == "ilevel" or msg == "il" then if msg == "ilevel" or msg == "il" then
self:RaidDump("Tallying iLevel Sums...") self:RaidDump("Tallying iLevel Sums...")
r = {} r = {}
@ -253,7 +254,7 @@ function core:SlashProcess(msg)
self:RaidDump("---") self:RaidDump("---")
elseif msg == "markxp" then elseif msg == "markxp" then
-- write all current -- write all current
local db = self.db.profile.guildXPMarks local db = db.guildXPMarks or {}
local num = #db+1 local num = #db+1
db[num] = { db[num] = {
@ -280,7 +281,7 @@ function core:SlashProcess(msg)
self:Print(format("Created new mark set #%d; suggested UI reload", num)) self:Print(format("Created new mark set #%d; suggested UI reload", num))
elseif msg:find("diff ") then elseif msg:find("diff ") then
local setNum = tonumber(msg:match("diff (%d+)")) local setNum = tonumber(msg:match("diff (%d+)"))
local set = setNum and self.db.profile.guildXPMarks[setNum] local set = setNum and db.guildXPMarks[setNum]
if not set then if not set then
self:Print(format("Could not find split %d", setNum)) self:Print(format("Could not find split %d", setNum))
@ -397,7 +398,7 @@ end
-- Hallow's end -- Hallow's end
self.hallowBuff = nil self.hallowBuff = nil
function core:UNIT_AURA(_, unit) function mod:UNIT_AURA(_, unit)
-- if we haven't set the initial value yet, set and quit -- if we haven't set the initial value yet, set and quit
if (self.hallowBuff == nil) then if (self.hallowBuff == nil) then
self.hallowBuff = not not UnitDebuff("player", "Tricked or Treated") self.hallowBuff = not not UnitDebuff("player", "Tricked or Treated")
@ -414,10 +415,10 @@ function core:UNIT_AURA(_, unit)
self:Print("Halloween debuff lost!"); self:Print("Halloween debuff lost!");
self.hallowBuff = false; self.hallowBuff = false;
elseif (not self.hallowBuff and hasBuff()) then elseif (not self.hallowBuff and hasBuff()) then
self.db.profile.halloween = self.db.profile.halloween + 1; db.halloween = db.halloween + 1;
-- pick transitive -- pick transitive
local transitive = TRANSITIVES[math.random(#TRANSITIVES)]; local transitive = TRANSITIVES[math.random(#TRANSITIVES)];
self:Print(format("I will %s %d babies this year", transitive, self.db.profile.halloween)) self:Print(format("I will %s %d babies this year", transitive, db.halloween))
self.hallowBuff = true; self.hallowBuff = true;
end end
end end

View file

@ -1,6 +1,6 @@
local core = LibStub("AceAddon-3.0"):GetAddon("AllTheLittleThings") local core = LibStub("AceAddon-3.0"):GetAddon("AllTheLittleThings")
local mod = core:NewModule("Guild Roster", "AceEvent-3.0", "AceHook-3.0") local mod = core:NewModule("Guild Roster", "AceEvent-3.0", "AceHook-3.0")
local db = core.db.profile[mod:GetName()] local db
local defaults = { local defaults = {
easyInvites = true, easyInvites = true,
@ -20,7 +20,8 @@ local rosterRaidersCount = 0
local rosterRaidersOnline = 0 local rosterRaidersOnline = 0
function mod:OnInitialize() function mod:OnInitialize()
core:RegisterOptions(options, defaults) db = core.db.profile[self:GetName()] or {}
self:RegisterOptions(options, defaults)
end end
function mod:OnEnable() function mod:OnEnable()
@ -91,7 +92,7 @@ end
function mod:GuildRoster_Update() function mod:GuildRoster_Update()
self:RosterUpdatePostHook() self:RosterUpdatePostHook()
local view = self.guildView or GuildRosterViewDropdown.selectedValue local view = guildView or GuildRosterViewDropdown.selectedValue
local buttons = GuildRosterContainer.buttons local buttons = GuildRosterContainer.buttons
local offset = HybridScrollFrame_GetOffset(GuildRosterContainer); local offset = HybridScrollFrame_GetOffset(GuildRosterContainer);
for i=1, #buttons do for i=1, #buttons do
@ -100,7 +101,7 @@ function mod:GuildRoster_Update()
stripe:SetTexture(stripe.texture) stripe:SetTexture(stripe.texture)
end end
if (UnitInRaid("player") and self.db.profile.easyInvites) then if (UnitInRaid("player") and db.easyInvites) then
if buttons[i].guildIndex then if buttons[i].guildIndex then
name = GetGuildRosterInfo(buttons[i].guildIndex) name = GetGuildRosterInfo(buttons[i].guildIndex)
if name and UnitInRaid(name) and (view == "playerStatus" or view == "guildStatus") then if name and UnitInRaid(name) and (view == "playerStatus" or view == "guildStatus") then
@ -159,7 +160,7 @@ function mod:RosterUpdatePostHook()
local button, index, class; local button, index, class;
local totalMembers, onlineMembers = GetNumGuildMembers(); local totalMembers, onlineMembers = GetNumGuildMembers();
local selectedGuildMember = GetGuildRosterSelection(); local selectedGuildMember = GetGuildRosterSelection();
local currentGuildView = self.guildView or GuildRosterViewDropdown.selectedValue local currentGuildView = guildView or GuildRosterViewDropdown.selectedValue
if ( currentGuildView == "tradeskill" ) then if ( currentGuildView == "tradeskill" ) then
return; return;
@ -316,7 +317,7 @@ function mod:RosterUpdatePostHook()
end end
function mod:GuildRosterButton_OnClick(this, button, ...) function mod:GuildRosterButton_OnClick(this, button, ...)
if self.db.profile.easyInvites and IsAltKeyDown() then if db.easyInvites and IsAltKeyDown() then
local guildIndex = this.guildIndex local guildIndex = this.guildIndex
local name, _, _, _, _, _, _, _, online = GetGuildRosterInfo(guildIndex) local name, _, _, _, _, _, _, _, online = GetGuildRosterInfo(guildIndex)
if online then if online then
@ -346,12 +347,12 @@ local function nameNum(ind)
end end
function GetGuildRosterInfo(index) function GetGuildRosterInfo(index)
-- no need -- no need
if not core.rosterRaidersOnly then if not mod.rosterRaidersOnly then
-- core:Print("Request for", index, "FAILED: core.rosterRaidersOnly=",core.rosterRaidersOnly, " core.inRosterUpdate=", core.inRosterUpdate) -- mod:Print("Request for", index, "FAILED: mod.rosterRaidersOnly=",mod.rosterRaidersOnly, " mod.inRosterUpdate=", mod.inRosterUpdate)
return GetGuildRosterInfoHook(index) return GetGuildRosterInfoHook(index)
end end
local cache = core.rosterAlteredCache local cache = mod.rosterAlteredCache
local baseIndex = index -- the ACTUAL index that is mapped to whatever index is local baseIndex = index -- the ACTUAL index that is mapped to whatever index is
-- check cache -- check cache
@ -359,15 +360,15 @@ function GetGuildRosterInfo(index)
isRaider = false isRaider = false
-- check if raider -- check if raider
if core:IsRaider(index) then if mod:IsRaider(index) then
-- if they are, set flag -- if they are, set flag
isRaider = true isRaider = true
else else
-- if not, begin looking ahead -- if not, begin looking ahead
for j=baseIndex+1,GetNumGuildMembers() do for j=baseIndex+1,GetNumGuildMembers() do
if core:IsRaider(cache[j] or j) then if mod:IsRaider(cache[j] or j) then
-- when you find one, set foundIndex's cache to index and baseIndex's cache to foundIndex's -- when you find one, set foundIndex's cache to index and baseIndex's cache to foundIndex's
core:Print("Swapping",nameNum(baseIndex),"with",nameNum(j)) mod:Print("Swapping",nameNum(baseIndex),"with",nameNum(j))
cache[j] = index cache[j] = index
cache[baseIndex] = j cache[baseIndex] = j
-- and set our locals -- and set our locals
@ -379,12 +380,12 @@ function GetGuildRosterInfo(index)
-- if you don't find one, index is unaltered -- if you don't find one, index is unaltered
end end
core:Print("Request for", nameNum(baseIndex), "returning", nameNum(index), " isRaider =",isRaider) mod:Print("Request for", nameNum(baseIndex), "returning", nameNum(index), " isRaider =",isRaider)
-- check flag if they're a raider -- check flag if they're a raider
if isRaider or not core.inRosterUpdate then if isRaider or not mod.inRosterUpdate then
-- if true, return actual stuff -- if true, return actual stuff
if not GetGuildRosterShowOffline() and core.inRosterUpdate then if not GetGuildRosterShowOffline() and mod.inRosterUpdate then
local online = select(9, GetGuildRosterInfoHook(index)) local online = select(9, GetGuildRosterInfoHook(index))
if not online then if not online then
return nil return nil
@ -396,27 +397,27 @@ function GetGuildRosterInfo(index)
-- if false, return nil -- if false, return nil
end end
function core:IsRaider(index) function mod:IsRaider(index)
local name, _, rank, _, _, _, note, _, online = GetGuildRosterInfoHook(index) local name, _, rank, _, _, _, note, _, online = GetGuildRosterInfoHook(index)
-- if a raider+ rank, or below and linked to a raider -- if a raider+ rank, or below and linked to a raider
-- not name tests for out of bounds check -- not name tests for out of bounds check
if not name or ((rank <= 1) or (rank == 3) or ((rank == 4 or rank == 2) and online and self.rosterRaidersCache[note])) then if not name or ((rank <= 1) or (rank == 3) or ((rank == 4 or rank == 2) and online and rosterRaidersCache[note])) then
return true return true
end end
return false return false
end end
function core:RosterUpdatePreHook() function mod:RosterUpdatePreHook()
wipe(self.rosterAlteredCache) wipe(rosterAlteredCache)
self.inRosterUpdate = true inRosterUpdate = true
if self.rosterRaidersOnly then if rosterRaidersOnly then
self:Print("Update pre hook") self:Print("Update pre hook")
end end
end end
function core:RosterUpdatePostHook() function mod:RosterUpdatePostHook()
self.inRosterUpdate = false inRosterUpdate = false
if self.rosterRaidersOnly then if rosterRaidersOnly then
self:Print("Update post hook") self:Print("Update post hook")
end end
end]] end]]

View file

@ -1,6 +1,6 @@
local core = LibStub("AceAddon-3.0"):GetAddon("AllTheLittleThings") local core = LibStub("AceAddon-3.0"):GetAddon("AllTheLittleThings")
local mod = core:NewModule("Macros", "AceTimer-3.0", "AceConsole-3.0") local mod = core:NewModule("Macros", "AceTimer-3.0")
local db = core.db.profile[mod:GetName()] local db
local defaults = { local defaults = {
} }
@ -8,18 +8,19 @@ local options = {
} }
function mod:OnInitialize() function mod:OnInitialize()
core:RegisterOptions(options, defaults) db = core.db.profile[self:GetName()] or {}
core:RegisterSlashCommand("DisbandRaid", "dr", "disbandraid") self:RegisterOptions(options, defaults)
core:RegisterSlashCommand("InviteGuild", "ig", "inviteguild") self:RegisterSlashCommand("DisbandRaid", "dr", "disbandraid")
core:RegisterSlashCommand("PromoteAll", "pa", "promoteall") self:RegisterSlashCommand("InviteGuild", "ig", "inviteguild")
core:RegisterSlashCommand("DemoteAll", "da", "demoteall") self:RegisterSlashCommand("PromoteAll", "pa", "promoteall")
core:RegisterSlashCommand("PrintLoot", "pl", "printloot") self:RegisterSlashCommand("DemoteAll", "da", "demoteall")
core:RegisterSlashCommand("ClearMarks", "cm", "clearmarks") self:RegisterSlashCommand("PrintLoot", "pl", "printloot")
core:RegisterSlashCommand("MasterLoot", "ml", "masterloot") self:RegisterSlashCommand("ClearMarks", "cm", "clearmarks")
core:RegisterSlashCommand("RandomLoot", "rl", "randomloot") self:RegisterSlashCommand("MasterLoot", "ml", "masterloot")
core:RegisterSlashCommand("FlaskCheck", "fc", "flaskcheck") self:RegisterSlashCommand("RandomLoot", "rl", "randomloot")
core:RegisterSlashCommand("Countdown", "cd", "countdown") self:RegisterSlashCommand("FlaskCheck", "fc", "flaskcheck")
core:RegisterSlashCommand("RosterCheck", "rc", "rostercheck") self:RegisterSlashCommand("Countdown", "cd", "countdown")
self:RegisterSlashCommand("RosterCheck", "rc", "rostercheck")
end end
function mod:DisbandRaid() function mod:DisbandRaid()
@ -92,7 +93,7 @@ function mod:RandomLoot()
end end
end end
function core:FlaskCheck() function mod:FlaskCheck()
local now = GetTime() local now = GetTime()
for i=1,GetNumRaidMembers() do for i=1,GetNumRaidMembers() do
for j=1,32 do for j=1,32 do

View file

@ -1,6 +1,6 @@
local core = LibStub("AceAddon-3.0"):GetAddon("AllTheLittleThings") local core = LibStub("AceAddon-3.0"):GetAddon("AllTheLittleThings")
local mod = core:NewModule("Miscellaneous", "AceEvent-3.0", "AceConsole-3.0", "AceHook-3.0", "AceTimer-3.0") local mod = core:NewModule("Miscellaneous", "AceEvent-3.0", "AceHook-3.0", "AceTimer-3.0")
local db = core.db.profile[mod:GetName()] local db
local defaults = { local defaults = {
rollTally = true, rollTally = true,
@ -38,10 +38,11 @@ local options = {
} }
function mod:OnInitialize() function mod:OnInitialize()
core:RegisterOptions(options, defaults) db = core.db.profile[self:GetName()] or {}
core:RegisterSlashCommand("RollTally", "rt", "rolltally") self:RegisterOptions(options, defaults)
core:RegisterSlashCommand("FindPhones", "phone") self:RegisterSlashCommand("RollTally", "rt", "rolltally")
core:RegisterSlashCommand("ActiveTally", "at", "activetally") self:RegisterSlashCommand("FindPhones", "phone")
self:RegisterSlashCommand("ActiveTally", "at", "activetally")
-- allow max camera zoom -- allow max camera zoom
ConsoleExec("cameradistancemaxfactor 5") ConsoleExec("cameradistancemaxfactor 5")
@ -157,20 +158,20 @@ end
local rollTally = {} local rollTally = {}
local rollTimer = false local rollTimer = false
function core:CHAT_MSG_RAID_WARNING(_, message) function mod:CHAT_MSG_RAID_WARNING(_, message)
if self.db.profile.rollTally and string.find(message:lower(), "roll") then if db.rollTally and string.find(message:lower(), "roll") then
if self.rollTimer then if rollTimer then
-- Stop current roll -- Stop current roll
self:CancelTimer(self.rollTimer) self:CancelTimer(rollTimer)
self:RollFinish() self:RollFinish()
end end
rollTally = {} rollTally = {}
self.rollTimer = self:ScheduleTimer("RollFinish", 10) rollTimer = self:ScheduleTimer("RollFinish", 10)
end end
end end
function core:CHAT_MSG_SYSTEM(_, message, source) function mod:CHAT_MSG_SYSTEM(_, message, source)
if self.db.profile.rollTally and self.rollTimer then if db.rollTally and rollTimer then
local name, roll, min, max = string.match(message, "(%S+) rolls (%d+) %((%d+)%-(%d+)%)") local name, roll, min, max = string.match(message, "(%S+) rolls (%d+) %((%d+)%-(%d+)%)")
if name and roll and min and max then if name and roll and min and max then
if min ~= "1" or max ~= "100" then if min ~= "1" or max ~= "100" then
@ -189,7 +190,7 @@ function core:CHAT_MSG_SYSTEM(_, message, source)
end end
end end
function core:RollFinish() function mod:RollFinish()
local winner local winner
local ties = {} local ties = {}
for i,v in pairs(rollTally) do for i,v in pairs(rollTally) do
@ -215,17 +216,17 @@ function core:RollFinish()
self:Print(string.format("%s won the roll with a %d.", winner, rollTally[winner])) self:Print(string.format("%s won the roll with a %d.", winner, rollTally[winner]))
end end
end end
self.rollTimer = false rollTimer = false
end end
function core:NixAFK(_, _, ...) function mod:NixAFK(_, _, ...)
return (not not self.db.profile.nixAFK), ...; return (not not db.nixAFK), ...;
end end
-- Officer Phone --------------------------------------------------------------- -- Officer Phone ---------------------------------------------------------------
function core:CHAT_MSG_OFFICER(_, msg) function mod:CHAT_MSG_OFFICER(_, msg)
local _,_,numA,numB,numC = msg:find("!phone %(?(%d+)%)?.(%d+).(%d+)"); local _,_,numA,numB,numC = msg:find("!phone %(?(%d+)%)?.(%d+).(%d+)");
local _,_,name = msg:find("!phone (%w+)"); local _,_,name = msg:find("!phone (%w+)");
@ -249,7 +250,7 @@ function core:CHAT_MSG_OFFICER(_, msg)
SetGuildRosterShowOffline(setting); SetGuildRosterShowOffline(setting);
end end
function core:CheckPhone(index) function mod:CheckPhone(index)
local name, rank, _, _, _, _, _, onote = GetGuildRosterInfo(index); local name, rank, _, _, _, _, _, onote = GetGuildRosterInfo(index);
local a, b, c = onote:match("%(?(%d%d%d)%)?.(%d%d%d).(%d%d%d%d)"); local a, b, c = onote:match("%(?(%d%d%d)%)?.(%d%d%d).(%d%d%d%d)");
if (not rank:find("Alt") and not rank:find("Non")) then if (not rank:find("Alt") and not rank:find("Non")) then
@ -262,7 +263,7 @@ function core:CheckPhone(index)
end end
-- Mark Star on Target --------------------------------------------------------- -- Mark Star on Target ---------------------------------------------------------
function core:TargetUnit(name) function mod:TargetUnit(name)
if name and GetNumPartyMembers() == 0 and GetNumRaidMembers() == 0 then if name and GetNumPartyMembers() == 0 and GetNumRaidMembers() == 0 then
self:RegisterEvent("UNIT_TARGET", function(_, unit) self:RegisterEvent("UNIT_TARGET", function(_, unit)
if unit == "player" then if unit == "player" then
@ -276,7 +277,7 @@ function core:TargetUnit(name)
end end
-- Achieve Load ---------------------------------------------------------------- -- Achieve Load ----------------------------------------------------------------
function core:AchievementFrame_LoadUI(...) function mod:AchievementFrame_LoadUI(...)
local args = {self.hooks["AchievementFrame_LoadUI"](...)} local args = {self.hooks["AchievementFrame_LoadUI"](...)}
AchievementFrame_SetFilter(3) AchievementFrame_SetFilter(3)
self:Unhook("AchievementFrame_LoadUI") self:Unhook("AchievementFrame_LoadUI")

View file

@ -1,6 +1,6 @@
local core = LibStub("AceAddon-3.0"):GetAddon("AllTheLittleThings") local core = LibStub("AceAddon-3.0"):GetAddon("AllTheLittleThings")
local mod = core:NewModule("Potion Mail", "AceEvent-3.0") local mod = core:NewModule("Potion Mail", "AceEvent-3.0")
local db = core.db.profile[mod:GetName()] local db
local defaults = { local defaults = {
} }
@ -18,7 +18,8 @@ local potList = {
local mailQueue = {} -- used in /atlt pots local mailQueue = {} -- used in /atlt pots
function mod:OnInitialize() function mod:OnInitialize()
core:RegisterSlashCommand("AddPotions", "pots") db = core.db.profile[self:GetName()] or {}
self:RegisterSlashCommand("AddPotions", "pots")
end end
function mod:OnEnable() function mod:OnEnable()
@ -81,7 +82,7 @@ end
- add a command to display how much left of each is needed vs how much you have - add a command to display how much left of each is needed vs how much you have
]] ]]
local mailQueueTimer local mailQueueTimer
function core:MailQueueCheck(caller, passData) function mod:MailQueueCheck(caller, passData)
local name,data = next(mailQueue) local name,data = next(mailQueue)
if not data then if not data then
return -- no need to process queue return -- no need to process queue
@ -155,7 +156,7 @@ function core:MailQueueCheck(caller, passData)
print("Checking item count:", inv, ct, inv<ct) print("Checking item count:", inv, ct, inv<ct)
if inv < ct then if inv < ct then
-- we don't have enough. abort. -- we don't have enough. abort.
core:Print(format("We don't have enough |Hitem:%d|h[%s]|h for %s. Needed %d; have %d.", item, GetItemInfo("item:"..item), name, ct, inv)) self:Print(format("We don't have enough |Hitem:%d|h[%s]|h for %s. Needed %d; have %d.", item, GetItemInfo("item:"..item), name, ct, inv))
ClearSendMail() ClearSendMail()
return return
end end
@ -180,7 +181,7 @@ function core:MailQueueCheck(caller, passData)
if #emptySlots == 0 then if #emptySlots == 0 then
print("Not enough bag space to split. Aborting.") print("Not enough bag space to split. Aborting.")
ClearSendMail() ClearSendMail()
core:CancelAllTimers() mod:CancelAllTimers()
return return
end end
-- pop empty slot off the list -- pop empty slot off the list
@ -221,7 +222,7 @@ function core:MailQueueCheck(caller, passData)
-- click send -- click send
mailQueue[name] = nil mailQueue[name] = nil
-- self:ScheduleTimer(function() -- self:ScheduleTimer(function()
-- self.mailQueue[name] = nil -- mailQueue[name] = nil
-- ClearSendMail() -- ClearSendMail()
-- self:MailQueueCheck() -- self:MailQueueCheck()
-- end, 5) -- end, 5)

View file

@ -1,6 +1,6 @@
local core = LibStub("AceAddon-3.0"):GetAddon("AllTheLittleThings") local core = LibStub("AceAddon-3.0"):GetAddon("AllTheLittleThings")
local mod = core:NewModule("Prat", "AceEvent-3.0") local mod = core:NewModule("Prat", "AceEvent-3.0")
local db = core.db.profile[mod:GetName()] local db
local defaults = { local defaults = {
} }
@ -8,6 +8,7 @@ local options = {
} }
function mod:OnInitialize() function mod:OnInitialize()
db = core.db.profile[self:GetName()] or {}
self:RegisterEvent("ADDON_LOADED") self:RegisterEvent("ADDON_LOADED")
end end

View file

@ -1,6 +1,6 @@
local core = LibStub("AceAddon-3.0"):GetAddon("AllTheLittleThings") local core = LibStub("AceAddon-3.0"):GetAddon("AllTheLittleThings")
local mod = core:NewModule("Raid", "AceEvent-3.0", "AceTimer-3.0") local mod = core:NewModule("Raid", "AceEvent-3.0", "AceTimer-3.0")
local db = core.db.profile[mod:GetName()] local db
local defaults = { local defaults = {
autoML = true, autoML = true,
@ -14,7 +14,8 @@ local options = {
} }
function mod:OnInitialize() function mod:OnInitialize()
core:RegisterOptions(options, defaults) db = core.db.profile[self:GetName()] or {}
self:RegisterOptions(options, defaults)
end end
function mod:OnEnable() function mod:OnEnable()

View file

@ -1,6 +1,6 @@
local core = LibStub("AceAddon-3.0"):GetAddon("AllTheLittleThings") local core = LibStub("AceAddon-3.0"):GetAddon("AllTheLittleThings")
local mod = core:NewModule("RBS Mods", "AceEvent-3.0", "AceHook-3.0") local mod = core:NewModule("RBS Mods", "AceEvent-3.0", "AceHook-3.0")
local db = core.db.profile[mod:GetName()] local db
local defaults = { local defaults = {
} }
@ -8,6 +8,7 @@ local options = {
} }
function mod:OnInitialize() function mod:OnInitialize()
db = core.db.profile[self:GetName()] or {}
self:RegisterEvent("ADDON_LOADED") self:RegisterEvent("ADDON_LOADED")
end end

14
modules/staging.lua Normal file
View file

@ -0,0 +1,14 @@
local core = LibStub("AceAddon-3.0"):GetAddon("AllTheLittleThings")
local mod = core:NewModule("Staging", "AceEvent-3.0")
local db
local defaults = {
}
local options = {
}
function mod:OnInitialize()
db = core.db.profile[self:GetName()] or {}
self:RegisterOptions(options, defaults)
end

View file

@ -1,6 +1,6 @@
local core = LibStub("AceAddon-3.0"):GetAddon("AllTheLittleThings") local core = LibStub("AceAddon-3.0"):GetAddon("AllTheLittleThings")
local mod = core:NewModule("Battlegrounds", "AceEvent-3.0") local mod = core:NewModule("Staging", "AceEvent-3.0")
local db = core.db.profile[mod:GetName()] local db
local defaults = { local defaults = {
} }
@ -8,7 +8,7 @@ local options = {
} }
function mod:OnInitialize() function mod:OnInitialize()
core:RegisterOptions(options, defaults) db = core.db.profile[self:GetName()] or {}
core:RegisterSlashCommand("method", "slsh1", "slash2") self:RegisterOptions(options, defaults)
end end