forgot to add all the files up until now
This commit is contained in:
parent
40da4a1040
commit
355bca680b
8 changed files with 940 additions and 325 deletions
|
@ -50,14 +50,6 @@ local options = {
|
||||||
get = function(info) return core.db.profile.markMsgFilter end,
|
get = function(info) return core.db.profile.markMsgFilter end,
|
||||||
set = function(info, v) core.db.profile.markMsgFilter = v core:OnEnable() end,
|
set = function(info, v) core.db.profile.markMsgFilter = v core:OnEnable() end,
|
||||||
},
|
},
|
||||||
macroSwap = {
|
|
||||||
order = 90,
|
|
||||||
name = "Flame Caps for Lich King",
|
|
||||||
desc = "Swaps the macro to use Flame Caps for HLK",
|
|
||||||
type = 'toggle',
|
|
||||||
get = function(info) return core.db.profile.macroSwap end,
|
|
||||||
set = function(info, v) core.db.profile.macroSwap = v end,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
local defaults = {
|
local defaults = {
|
||||||
|
@ -72,7 +64,6 @@ local defaults = {
|
||||||
consolidateThresh = 0,
|
consolidateThresh = 0,
|
||||||
officerPhone = true,
|
officerPhone = true,
|
||||||
markMsgFilter = true,
|
markMsgFilter = true,
|
||||||
macroSwap = true,
|
|
||||||
halloween = 1,
|
halloween = 1,
|
||||||
guildXPMarks = { },
|
guildXPMarks = { },
|
||||||
}
|
}
|
||||||
|
@ -89,9 +80,6 @@ local potList = {
|
||||||
core.guildList = {}
|
core.guildList = {}
|
||||||
core.rollTally = {}
|
core.rollTally = {}
|
||||||
core.rollTimer = false
|
core.rollTimer = false
|
||||||
core.guildHook = false
|
|
||||||
core.consolidateHook = false
|
|
||||||
core.achieveHook = false
|
|
||||||
core.hallowBuff = nil
|
core.hallowBuff = nil
|
||||||
core.mailQueue = {} -- used in /atlt pots
|
core.mailQueue = {} -- used in /atlt pots
|
||||||
|
|
||||||
|
@ -103,12 +91,7 @@ function core:OnInitialize()
|
||||||
LibStub("AceConfig-3.0"):RegisterOptionsTable("ATLT", options)
|
LibStub("AceConfig-3.0"):RegisterOptionsTable("ATLT", options)
|
||||||
self.optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("ATLT", "All The Little Things")
|
self.optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("ATLT", "All The Little Things")
|
||||||
|
|
||||||
-- Init finished
|
|
||||||
-- self.guildList = self:GetGuildList()
|
|
||||||
ConsoleExec("cameradistancemaxfactor 5")
|
ConsoleExec("cameradistancemaxfactor 5")
|
||||||
|
|
||||||
-- try to reproduce that bug
|
|
||||||
-- self:Nostromo()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function core:OnEnable()
|
function core:OnEnable()
|
||||||
|
@ -536,48 +519,6 @@ function core:FlaskCheck()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local macro = "MI+FC";
|
|
||||||
function core:ZoneChange()
|
|
||||||
if (self.db.profile.macroSwap and UnitName("player")=="Chira" and GetMacroIndexByName(macro)>0) then
|
|
||||||
if (GetSubZoneText() == "The Frozen Throne" and self:GetMode()>3) then
|
|
||||||
EditMacro(GetMacroIndexByName(macro), nil, nil, GetMacroBody(macro):gsub("Flame Caq", "Flame Cap"));
|
|
||||||
else
|
|
||||||
EditMacro(GetMacroIndexByName(macro), nil, nil, GetMacroBody(macro):gsub("Flame Cap", "Flame Caq"));
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function core:GetMode()
|
|
||||||
local _, _, diff, _, _, dynHeroic, dynFlag = GetInstanceInfo();
|
|
||||||
return diff; -- (dynFlag and (2-(diff%2)+2*dynHeroic)) or diff;
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
function core:CheckSmash()
|
|
||||||
local sum, str
|
|
||||||
local thresh = self.db.profile.smash
|
|
||||||
for name, vals in pairs(self.smashList) do
|
|
||||||
sum = 0
|
|
||||||
str = " ("
|
|
||||||
for _,v in ipairs(vals) do
|
|
||||||
sum = sum + v
|
|
||||||
str = str .. v .. ", "
|
|
||||||
end
|
|
||||||
if sum > thresh then
|
|
||||||
self:RaidDump(name .. " got smashed for " .. sum .. str:sub(1, -3) .. ")")
|
|
||||||
end
|
|
||||||
self.smashList[name] = {}
|
|
||||||
end
|
|
||||||
self.smashTimer = nil
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
function core:RaidDump(msg, sink)
|
|
||||||
if self.db.profile.alwaysDump or IsRaidOfficer() then
|
|
||||||
sink = sink or "raid"
|
|
||||||
SendChatMessage(msg, sink)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function core:RollFinish()
|
function core:RollFinish()
|
||||||
local winner
|
local winner
|
||||||
|
@ -937,98 +878,6 @@ function core:NewRBSButton(label, func, width, anchorFrom, anchorTo, anchorX, an
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--[[
|
|
||||||
-- hook GetNumGuildMembers() second return result?
|
|
||||||
-- local GetNumGuildMembersHook = GetNumGuildMembers
|
|
||||||
-- function GetNumGuildMembers()
|
|
||||||
-- local total, online = GetNumGuildMembers
|
|
||||||
-- end
|
|
||||||
|
|
||||||
GetGuildRosterInfoHook = GetGuildRosterInfo
|
|
||||||
local GetGuildRosterInfoHook = GetGuildRosterInfoHook
|
|
||||||
local function nameNum(ind)
|
|
||||||
if ind and GetGuildRosterInfoHook(ind) then
|
|
||||||
return format("%s(%d)", GetGuildRosterInfoHook(ind), ind)
|
|
||||||
else
|
|
||||||
return format("nil(%d)", ind)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
function GetGuildRosterInfo(index)
|
|
||||||
-- no need
|
|
||||||
if not core.rosterRaidersOnly then
|
|
||||||
-- core:Print("Request for", index, "FAILED: core.rosterRaidersOnly=",core.rosterRaidersOnly, " core.inRosterUpdate=", core.inRosterUpdate)
|
|
||||||
return GetGuildRosterInfoHook(index)
|
|
||||||
end
|
|
||||||
|
|
||||||
local cache = core.rosterAlteredCache
|
|
||||||
local baseIndex = index -- the ACTUAL index that is mapped to whatever index is
|
|
||||||
|
|
||||||
-- check cache
|
|
||||||
index = cache[index] or index
|
|
||||||
|
|
||||||
isRaider = false
|
|
||||||
-- check if raider
|
|
||||||
if core:IsRaider(index) then
|
|
||||||
-- if they are, set flag
|
|
||||||
isRaider = true
|
|
||||||
else
|
|
||||||
-- if not, begin looking ahead
|
|
||||||
for j=baseIndex+1,GetNumGuildMembers() do
|
|
||||||
if core:IsRaider(cache[j] or j) then
|
|
||||||
-- 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))
|
|
||||||
cache[j] = index
|
|
||||||
cache[baseIndex] = j
|
|
||||||
-- and set our locals
|
|
||||||
index = j
|
|
||||||
isRaider = true
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- if you don't find one, index is unaltered
|
|
||||||
end
|
|
||||||
|
|
||||||
core:Print("Request for", nameNum(baseIndex), "returning", nameNum(index), " isRaider =",isRaider)
|
|
||||||
|
|
||||||
-- check flag if they're a raider
|
|
||||||
if isRaider or not core.inRosterUpdate then
|
|
||||||
-- if true, return actual stuff
|
|
||||||
if not GetGuildRosterShowOffline() and core.inRosterUpdate then
|
|
||||||
local online = select(9, GetGuildRosterInfoHook(index))
|
|
||||||
if not online then
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return GetGuildRosterInfoHook(index)
|
|
||||||
end
|
|
||||||
-- if false, return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
function core:IsRaider(index)
|
|
||||||
local name, _, rank, _, _, _, note, _, online = GetGuildRosterInfoHook(index)
|
|
||||||
-- if a raider+ rank, or below and linked to a raider
|
|
||||||
-- 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
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
function core:RosterUpdatePreHook()
|
|
||||||
wipe(self.rosterAlteredCache)
|
|
||||||
self.inRosterUpdate = true
|
|
||||||
if self.rosterRaidersOnly then
|
|
||||||
self:Print("Update pre hook")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function core:RosterUpdatePostHook()
|
|
||||||
self.inRosterUpdate = false
|
|
||||||
if self.rosterRaidersOnly then
|
|
||||||
self:Print("Update post hook")
|
|
||||||
end
|
|
||||||
end]]
|
|
||||||
|
|
||||||
function core:SetupPrat()
|
function core:SetupPrat()
|
||||||
local module = Prat.Addon:GetModule('AltNames')
|
local module = Prat.Addon:GetModule('AltNames')
|
||||||
|
@ -1072,163 +921,7 @@ function core:SetupPrat()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function core:BugInit()
|
|
||||||
local f = CreateFrame("frame")
|
|
||||||
f:SetSize(50, 50)
|
|
||||||
f:SetPoint("CENTER")
|
|
||||||
f:SetScript("OnMouseUp", function()
|
|
||||||
f.finish:Play()
|
|
||||||
f:SetScript("OnMouseUp", nil)
|
|
||||||
end)
|
|
||||||
|
|
||||||
f.s = f:CreateFontString(nil, nil, "SystemFont_Outline_Small")
|
|
||||||
f.s:SetText("Test")
|
|
||||||
f.s:SetPoint("CENTER")
|
|
||||||
|
|
||||||
f.t = f:CreateTexture()
|
|
||||||
f.t:SetTexture(0, 0, 0)
|
|
||||||
f.t:SetAlpha(0.5)
|
|
||||||
f.t:SetAllPoints()
|
|
||||||
|
|
||||||
f.finish = f:CreateAnimationGroup()
|
|
||||||
|
|
||||||
-- f.finishAlpha = f.finish:CreateAnimation("Alpha")
|
|
||||||
-- f.finishAlpha:SetChange(-1)
|
|
||||||
-- f.finishAlpha:SetDuration(.85)
|
|
||||||
|
|
||||||
f.finishScale = f.finish:CreateAnimation("Scale")
|
|
||||||
f.finishScale:SetScale(2, 2)
|
|
||||||
f.finishScale:SetDuration(.85)
|
|
||||||
|
|
||||||
f.finish:SetScript("OnPlay", function()
|
|
||||||
-- f.s:Hide()
|
|
||||||
end)
|
|
||||||
f.finish:SetScript("OnFinished", function()
|
|
||||||
-- f.s:Show()
|
|
||||||
local t = GetTime()
|
|
||||||
f:SetScript("OnUpdate", function()
|
|
||||||
if GetTime()-t > 0.5 then
|
|
||||||
f.finish:Play()
|
|
||||||
f:SetScript("OnUpdate", nil)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end)
|
|
||||||
|
|
||||||
g_f = f
|
|
||||||
end
|
|
||||||
|
|
||||||
function core:Nostromo()
|
|
||||||
local keys = {"W", "A", "S", "D"}
|
|
||||||
local xVal = {1, 0, 1, 2}
|
|
||||||
local yVal = {0, 1, 1, 1}
|
|
||||||
local width, height = 50, 50
|
|
||||||
local padding = 10
|
|
||||||
local offsetX, offsetY = -1.5, 3
|
|
||||||
core.frameSet = {}
|
|
||||||
|
|
||||||
for i in ipairs(keys) do
|
|
||||||
local frame = CreateFrame("frame", UIParent)
|
|
||||||
frame:SetSize(width, height)
|
|
||||||
frame:SetPoint("CENTER", UIParent, "CENTER", (offsetX + xVal[i])*width + padding*xVal[i], (offsetY - yVal[i])*height - padding*yVal[i])
|
|
||||||
frame:EnableKeyboard(false)
|
|
||||||
|
|
||||||
local texture = frame:CreateTexture()
|
|
||||||
texture:SetAllPoints()
|
|
||||||
texture:SetTexture(0, 0, 0)
|
|
||||||
texture:SetAlpha(0.4)
|
|
||||||
|
|
||||||
if false then
|
|
||||||
frame:SetScript("onkeydown", function(self, key)
|
|
||||||
if key == keys[i] then
|
|
||||||
texture:SetAlpha(0.8)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
frame:SetScript("onkeyup", function(self, key)
|
|
||||||
if key == keys[i] then
|
|
||||||
texture:SetAlpha(0.4)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
table.insert(core.frameSet, frame)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- creates a text string and hooks every CLEU to try and find a problematic addon
|
|
||||||
function core:SetupAddonDebug()
|
|
||||||
local frame = CreateFrame("frame")
|
|
||||||
frame:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", self.db.profile.addonDebug.x, self.db.profile.addonDebug.y)
|
|
||||||
frame:SetSize(100, 30)
|
|
||||||
frame:EnableMouse(true)
|
|
||||||
frame:SetMovable(true)
|
|
||||||
frame:SetClampedToScreen(true)
|
|
||||||
frame:RegisterForDrag("LeftButton")
|
|
||||||
frame:SetScript("OnDragStart", function(self)
|
|
||||||
self:StartMoving()
|
|
||||||
end)
|
|
||||||
frame:SetScript("OnDragStop", function(self)
|
|
||||||
self:StopMovingOrSizing()
|
|
||||||
core.db.profile.addonDebug.x = self:GetLeft()
|
|
||||||
core.db.profile.addonDebug.y = self:GetTop()
|
|
||||||
end)
|
|
||||||
|
|
||||||
local text = frame:CreateFontString(nil, nil, "GameFontNormal")
|
|
||||||
text:SetAllPoints()
|
|
||||||
text:SetText("TEST")
|
|
||||||
text:SetJustifyH("RIGHT")
|
|
||||||
|
|
||||||
-- non ace
|
|
||||||
local events = {GetFramesRegisteredForEvent("COMBAT_LOG_EVENT_UNFILTERED")}
|
|
||||||
for _,f in ipairs(events) do
|
|
||||||
if f ~= AceEvent30Frame then
|
|
||||||
local name = f:GetName() or f.name or tostring(f)
|
|
||||||
self:RawHookScript(f, "OnEvent", function(frame, event, ...)
|
|
||||||
if event == "COMBAT_LOG_EVENT_UNFILTERED" then
|
|
||||||
text:SetText(name)
|
|
||||||
self.hooks[f].OnEvent(frame, event, ...)
|
|
||||||
text:SetText("")
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- ace
|
|
||||||
local CLEU = LibStub:GetLibrary("AceEvent-3.0").events.events.COMBAT_LOG_EVENT_UNFILTERED
|
|
||||||
if CLEU then
|
|
||||||
for addon, event in pairs(CLEU) do
|
|
||||||
local old = CLEU[addon]
|
|
||||||
CLEU[addon] = function(...)
|
|
||||||
text:SetText(addon.name or tostring(addon))
|
|
||||||
old(...)
|
|
||||||
text:SetText("")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function core:GUILDBANKFRAME_OPENED()
|
|
||||||
-- local numTabs = GetNumGuildBankTabs()
|
|
||||||
-- for tab = 1, numTabs do
|
|
||||||
-- self:ScheduleTimer(function()QueryGuildBankTab(tab)end, tab)
|
|
||||||
-- end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function my_hash(key, ...)
|
|
||||||
local i, j, str;
|
|
||||||
for i=1,select('#', ...) do
|
|
||||||
j=0;
|
|
||||||
str=select(i, ...);
|
|
||||||
key = key:gsub(".", function(k)
|
|
||||||
j = (j % strlen(str))+1;
|
|
||||||
return strchar((strbyte(k,1)*strbyte(str,j)) % 256);
|
|
||||||
end);
|
|
||||||
end
|
|
||||||
i=0;
|
|
||||||
for j=1,strlen(key) do
|
|
||||||
i = (i + strbyte(key,j)) % 100;
|
|
||||||
end
|
|
||||||
return i;
|
|
||||||
end
|
|
||||||
|
|
||||||
local chatEvents = {
|
local chatEvents = {
|
||||||
"CHAT_MSG_ACHIEVEMENT",
|
"CHAT_MSG_ACHIEVEMENT",
|
||||||
|
@ -1321,21 +1014,3 @@ end
|
||||||
-- core:FilterAll("achievement:284")
|
-- core:FilterAll("achievement:284")
|
||||||
core:FilterAll(nil, "Alabrooke")
|
core:FilterAll(nil, "Alabrooke")
|
||||||
core:FilterAll(nil, "Warrwarr")
|
core:FilterAll(nil, "Warrwarr")
|
||||||
-- core:FilterAll("achievement:284")
|
|
||||||
|
|
||||||
-- test fix
|
|
||||||
--[[local addon = CreateFrame("frame", "HorsemanSummonFix");
|
|
||||||
|
|
||||||
function HorsemanSummonFix_ZoneChange()
|
|
||||||
if((GetSubZoneText() == "Forlorn Cloister")) then
|
|
||||||
GameTooltip.temp = function() GameTooltip:Hide() end;
|
|
||||||
GameTooltip:SetScript("OnShow",GameTooltip.temp);
|
|
||||||
else
|
|
||||||
GameTooltip:SetScript("OnShow",GameTooltip.Show);
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
addon:SetScript("OnEvent", HorsemanSummonFix_ZoneChange);
|
|
||||||
addon:RegisterEvent("ZONE_CHANGED");
|
|
||||||
addon:RegisterEvent("ZONE_CHANGED_NEW_AREA");
|
|
||||||
HorsemanSummonFix_ZoneChange();]]
|
|
||||||
|
|
Binary file not shown.
132
modules/announce.lua
Normal file
132
modules/announce.lua
Normal file
|
@ -0,0 +1,132 @@
|
||||||
|
local core = LibStub("AceAddon-3.0"):GetAddon("AllTheLittleThings")
|
||||||
|
local mod = core:NewModule("Announce", "AceEvent-3.0")
|
||||||
|
local db = core.db.profile[mod:GetName()]
|
||||||
|
|
||||||
|
local defaults = {
|
||||||
|
interrupt = false,
|
||||||
|
spellWatch = true,
|
||||||
|
cauterize = "",
|
||||||
|
armorGlyph = true,
|
||||||
|
}
|
||||||
|
local options = {
|
||||||
|
interrupt = {
|
||||||
|
name = "Interrupt printing",
|
||||||
|
desc = "Toggles printing what you interrupted in party chat",
|
||||||
|
type = "toggle",
|
||||||
|
},
|
||||||
|
spellWatch = {
|
||||||
|
name = "Print important spells",
|
||||||
|
desc = "Prints MD, ToTT, and taunts to ncafail",
|
||||||
|
type = 'toggle',
|
||||||
|
},
|
||||||
|
cauterize = {
|
||||||
|
name = "Cauterize Save",
|
||||||
|
desc = "Tells target when my Cauterize saves me",
|
||||||
|
type = 'text',
|
||||||
|
},
|
||||||
|
armorGlyph = {
|
||||||
|
name = "Alert for unglyphed armor",
|
||||||
|
desc = "Prints to self if an armor that is not glyphed was gained",
|
||||||
|
type = 'toggle',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
local interruptCasted = false
|
||||||
|
local zoneBlacklist = {
|
||||||
|
["Wintergrasp"] = true,
|
||||||
|
["Tol Barad"] = true,
|
||||||
|
}
|
||||||
|
local spellWatch = {
|
||||||
|
["Taunt"] = true,
|
||||||
|
["Growl"] = true,
|
||||||
|
["Hand of Reckoning"] = true,
|
||||||
|
["Death Grip"] = true,
|
||||||
|
["Dark Command"] = true,
|
||||||
|
}
|
||||||
|
local aoeSpellWatch = {
|
||||||
|
["Misdirection"] = true,
|
||||||
|
["Tricks of the Trade"] = true,
|
||||||
|
["Righteous Defense"] = true,
|
||||||
|
["Challenging Shout"] = true,
|
||||||
|
["Challenging Roar"] = true,
|
||||||
|
}
|
||||||
|
local armorGlyphs = {
|
||||||
|
[30482] = 56382, -- Molten Armor
|
||||||
|
[6117] = 56383, -- Mage Armor
|
||||||
|
}
|
||||||
|
|
||||||
|
function mod:OnInitialize()
|
||||||
|
core:RegisterOptions(options, defaults)
|
||||||
|
core:RegisterSlashCommand("method", "slsh1", "slash2")
|
||||||
|
end
|
||||||
|
|
||||||
|
function mod:OnEnable()
|
||||||
|
self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
|
||||||
|
end
|
||||||
|
|
||||||
|
function core:COMBAT_LOG_EVENT_UNFILTERED(_, timestamp, event, _, srcGUID, srcName, srcFlags, dstGUID, dstName, dstFlags, spellid, spellName, spellSchool, extraSpellid, extraSpellName, ...)
|
||||||
|
-- Interrupt ------------------------------------------------------------------
|
||||||
|
if db.interrupt and GetNumPartyMembers()>0 then
|
||||||
|
if event == "SPELL_INTERRUPT" and srcName == UnitName("player") then
|
||||||
|
SendChatMessage("Interrupted " .. dstName .. "'s " .. extraSpellName, "party")
|
||||||
|
interruptCasted = false
|
||||||
|
end
|
||||||
|
if (event == "SPELL_MISSED" or event == "SPELL_HIT") and srcName == UnitName("player") and spellName == "Counterspell" then
|
||||||
|
SendChatMessage("Counterspell missed", "party")
|
||||||
|
interruptCasted = false
|
||||||
|
end
|
||||||
|
if event == "SPELL_CAST_SUCCESS" and srcName == UnitName("player") and spellName == "Counterspell" then
|
||||||
|
interruptCasted = true
|
||||||
|
self:ScheduleTimer(function() if interruptCasted == true then
|
||||||
|
SendChatMessage("Counterspell failed", "party")
|
||||||
|
interruptCasted = false
|
||||||
|
end end, 0.3)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Spell Watch ----------------------------------------------------------------
|
||||||
|
if (db.spellWatch and (UnitInRaid(srcName) or UnitInParty(srcName)) and (not UnitInBattleground("player")) and not zoneBlacklist[GetRealZoneText()]) then
|
||||||
|
local act = false;
|
||||||
|
if ( (event == "SPELL_AURA_APPLIED" and spellWatch[spellName]) or
|
||||||
|
(event == "SPELL_CAST_SUCCESS" and aoeSpellWatch[spellName]) ) then
|
||||||
|
act = "casted";
|
||||||
|
elseif (event == "SPELL_MISSED" and spellWatch[spellName]) then
|
||||||
|
act = "missed";
|
||||||
|
end
|
||||||
|
if (act ~= false) then
|
||||||
|
local target = (dstName and " on %s") or "";
|
||||||
|
SendChatMessage(format("%s %s %s%s", srcName, act, spellName, dstName, target), "channel", nil, GetChannelName("ncafail"));
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Cauterize ------------------------------------------------------------------
|
||||||
|
if db.cauterizeTell and event == "SPELL_AURA_REMOVED" and dstGUID == UnitGUID("player") and spellName == "Cauterize" then
|
||||||
|
self:ScheduleTimer(function()
|
||||||
|
if not UnitIsDead("player") then
|
||||||
|
for i=1,GetNumGuildMembers() do
|
||||||
|
local name, _, _, _, _, _, _, _, online = GetGuildRosterInfo(i)
|
||||||
|
if name == "Chira" and online then
|
||||||
|
SendChatMessage(">>> Cauterize just saved me! <<<", "whisper", nil, name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end, 1)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Armor ----------------------------------------------------------------------
|
||||||
|
if db.armorGlyph and event == "SPELL_AURA_APPLIED" and dstGUID == UnitGUID("player") then
|
||||||
|
if armorGlyphs[spellid] then
|
||||||
|
-- print(spellid, armorGlyphs[spellid])
|
||||||
|
-- check if we have a different glyph
|
||||||
|
for i=1, NUM_GLYPH_SLOTS do
|
||||||
|
local glyphSpell = select(4, GetGlyphSocketInfo(i))
|
||||||
|
-- print(glyphSpell)
|
||||||
|
if glyphSpell == armorGlyphs[spellid] then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
print(format("Warning: %s is not glyphed", spellName))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
14
modules/defaultui.lua
Normal file
14
modules/defaultui.lua
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
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
|
||||||
|
|
189
modules/deprecated.lua
Normal file
189
modules/deprecated.lua
Normal file
|
@ -0,0 +1,189 @@
|
||||||
|
-- These are here for historical purposes only -- do not include in .toc
|
||||||
|
local core = LibStub("AceAddon-3.0"):GetAddon("AllTheLittleThings")
|
||||||
|
local mod = core:NewModule("Deprecated", "AceEvent-3.0")
|
||||||
|
local db = core.db.profile[mod:GetName()]
|
||||||
|
|
||||||
|
local defaults = {
|
||||||
|
macroSwap = false,
|
||||||
|
}
|
||||||
|
local options = {
|
||||||
|
macroSwap = {
|
||||||
|
name = "Flame Caps for Lich King",
|
||||||
|
desc = "Swaps the macro to use Flame Caps for HLK",
|
||||||
|
type = 'toggle',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
function mod:OnInitialize()
|
||||||
|
core:RegisterOptions(options, defaults)
|
||||||
|
core:RegisterSlashCommand("method", "slsh1", "slash2")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Lich King Flame Cap Macro ---------------------------------------------------
|
||||||
|
local macro = "MI+FC";
|
||||||
|
function core:ZoneChange()
|
||||||
|
if (db.macroSwap and UnitName("player")=="Chira" and GetMacroIndexByName(macro)>0) then
|
||||||
|
if (GetSubZoneText() == "The Frozen Throne" and self:GetMode()>3) then
|
||||||
|
EditMacro(GetMacroIndexByName(macro), nil, nil, GetMacroBody(macro):gsub("Flame Caq", "Flame Cap"));
|
||||||
|
else
|
||||||
|
EditMacro(GetMacroIndexByName(macro), nil, nil, GetMacroBody(macro):gsub("Flame Cap", "Flame Caq"));
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function core:GetMode()
|
||||||
|
local _, _, diff, _, _, dynHeroic, dynFlag = GetInstanceInfo();
|
||||||
|
return diff; -- (dynFlag and (2-(diff%2)+2*dynHeroic)) or diff;
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Attempt to monitor n52 problem ----------------------------------------------
|
||||||
|
function core:Nostromo()
|
||||||
|
local keys = {"W", "A", "S", "D"}
|
||||||
|
local xVal = {1, 0, 1, 2}
|
||||||
|
local yVal = {0, 1, 1, 1}
|
||||||
|
local width, height = 50, 50
|
||||||
|
local padding = 10
|
||||||
|
local offsetX, offsetY = -1.5, 3
|
||||||
|
core.frameSet = {}
|
||||||
|
|
||||||
|
for i in ipairs(keys) do
|
||||||
|
local frame = CreateFrame("frame", UIParent)
|
||||||
|
frame:SetSize(width, height)
|
||||||
|
frame:SetPoint("CENTER", UIParent, "CENTER", (offsetX + xVal[i])*width + padding*xVal[i], (offsetY - yVal[i])*height - padding*yVal[i])
|
||||||
|
frame:EnableKeyboard(false)
|
||||||
|
|
||||||
|
local texture = frame:CreateTexture()
|
||||||
|
texture:SetAllPoints()
|
||||||
|
texture:SetTexture(0, 0, 0)
|
||||||
|
texture:SetAlpha(0.4)
|
||||||
|
|
||||||
|
if false then
|
||||||
|
frame:SetScript("onkeydown", function(self, key)
|
||||||
|
if key == keys[i] then
|
||||||
|
texture:SetAlpha(0.8)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
frame:SetScript("onkeyup", function(self, key)
|
||||||
|
if key == keys[i] then
|
||||||
|
texture:SetAlpha(0.4)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
table.insert(core.frameSet, frame)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- creates a text string and hooks every CLEU to try and find a problematic addon
|
||||||
|
function core:SetupAddonDebug()
|
||||||
|
local frame = CreateFrame("frame")
|
||||||
|
frame:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", self.db.profile.addonDebug.x, self.db.profile.addonDebug.y)
|
||||||
|
frame:SetSize(100, 30)
|
||||||
|
frame:EnableMouse(true)
|
||||||
|
frame:SetMovable(true)
|
||||||
|
frame:SetClampedToScreen(true)
|
||||||
|
frame:RegisterForDrag("LeftButton")
|
||||||
|
frame:SetScript("OnDragStart", function(self)
|
||||||
|
self:StartMoving()
|
||||||
|
end)
|
||||||
|
frame:SetScript("OnDragStop", function(self)
|
||||||
|
self:StopMovingOrSizing()
|
||||||
|
core.db.profile.addonDebug.x = self:GetLeft()
|
||||||
|
core.db.profile.addonDebug.y = self:GetTop()
|
||||||
|
end)
|
||||||
|
|
||||||
|
local text = frame:CreateFontString(nil, nil, "GameFontNormal")
|
||||||
|
text:SetAllPoints()
|
||||||
|
text:SetText("TEST")
|
||||||
|
text:SetJustifyH("RIGHT")
|
||||||
|
|
||||||
|
-- non ace
|
||||||
|
local events = {GetFramesRegisteredForEvent("COMBAT_LOG_EVENT_UNFILTERED")}
|
||||||
|
for _,f in ipairs(events) do
|
||||||
|
if f ~= AceEvent30Frame then
|
||||||
|
local name = f:GetName() or f.name or tostring(f)
|
||||||
|
self:RawHookScript(f, "OnEvent", function(frame, event, ...)
|
||||||
|
if event == "COMBAT_LOG_EVENT_UNFILTERED" then
|
||||||
|
text:SetText(name)
|
||||||
|
self.hooks[f].OnEvent(frame, event, ...)
|
||||||
|
text:SetText("")
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- ace
|
||||||
|
local CLEU = LibStub:GetLibrary("AceEvent-3.0").events.events.COMBAT_LOG_EVENT_UNFILTERED
|
||||||
|
if CLEU then
|
||||||
|
for addon, event in pairs(CLEU) do
|
||||||
|
local old = CLEU[addon]
|
||||||
|
CLEU[addon] = function(...)
|
||||||
|
text:SetText(addon.name or tostring(addon))
|
||||||
|
old(...)
|
||||||
|
text:SetText("")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Bug with text in animations -------------------------------------------------
|
||||||
|
function core:BugInit()
|
||||||
|
local f = CreateFrame("frame")
|
||||||
|
f:SetSize(50, 50)
|
||||||
|
f:SetPoint("CENTER")
|
||||||
|
f:SetScript("OnMouseUp", function()
|
||||||
|
f.finish:Play()
|
||||||
|
f:SetScript("OnMouseUp", nil)
|
||||||
|
end)
|
||||||
|
|
||||||
|
f.s = f:CreateFontString(nil, nil, "SystemFont_Outline_Small")
|
||||||
|
f.s:SetText("Test")
|
||||||
|
f.s:SetPoint("CENTER")
|
||||||
|
|
||||||
|
f.t = f:CreateTexture()
|
||||||
|
f.t:SetTexture(0, 0, 0)
|
||||||
|
f.t:SetAlpha(0.5)
|
||||||
|
f.t:SetAllPoints()
|
||||||
|
|
||||||
|
f.finish = f:CreateAnimationGroup()
|
||||||
|
|
||||||
|
-- f.finishAlpha = f.finish:CreateAnimation("Alpha")
|
||||||
|
-- f.finishAlpha:SetChange(-1)
|
||||||
|
-- f.finishAlpha:SetDuration(.85)
|
||||||
|
|
||||||
|
f.finishScale = f.finish:CreateAnimation("Scale")
|
||||||
|
f.finishScale:SetScale(2, 2)
|
||||||
|
f.finishScale:SetDuration(.85)
|
||||||
|
|
||||||
|
f.finish:SetScript("OnPlay", function()
|
||||||
|
-- f.s:Hide()
|
||||||
|
end)
|
||||||
|
f.finish:SetScript("OnFinished", function()
|
||||||
|
-- f.s:Show()
|
||||||
|
local t = GetTime()
|
||||||
|
f:SetScript("OnUpdate", function()
|
||||||
|
if GetTime()-t > 0.5 then
|
||||||
|
f.finish:Play()
|
||||||
|
f:SetScript("OnUpdate", nil)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Experimental hash function --------------------------------------------------
|
||||||
|
local function my_hash(key, ...)
|
||||||
|
local i, j, str;
|
||||||
|
for i=1,select('#', ...) do
|
||||||
|
j=0;
|
||||||
|
str=select(i, ...);
|
||||||
|
key = key:gsub(".", function(k)
|
||||||
|
j = (j % strlen(str))+1;
|
||||||
|
return strchar((strbyte(k,1)*strbyte(str,j)) % 256);
|
||||||
|
end);
|
||||||
|
end
|
||||||
|
i=0;
|
||||||
|
for j=1,strlen(key) do
|
||||||
|
i = (i + strbyte(key,j)) % 100;
|
||||||
|
end
|
||||||
|
return i;
|
||||||
|
end
|
422
modules/guildroster.lua
Normal file
422
modules/guildroster.lua
Normal file
|
@ -0,0 +1,422 @@
|
||||||
|
local core = LibStub("AceAddon-3.0"):GetAddon("AllTheLittleThings")
|
||||||
|
local mod = core:NewModule("Guild Roster", "AceEvent-3.0", "AceHook-3.0")
|
||||||
|
local db = core.db.profile[mod:GetName()]
|
||||||
|
|
||||||
|
local defaults = {
|
||||||
|
easyInvites = true,
|
||||||
|
}
|
||||||
|
local options = {
|
||||||
|
easyInvites = {
|
||||||
|
name = "Easy Raid Invites",
|
||||||
|
desc = "Colors names and allows you to alt+click to invite.",
|
||||||
|
type = "toggle",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
local guildView = nil
|
||||||
|
local rosterRaidersOnly = false
|
||||||
|
local rosterRaidersCache = {} -- mains who are raiders
|
||||||
|
local rosterRaidersCount = 0
|
||||||
|
local rosterRaidersOnline = 0
|
||||||
|
|
||||||
|
function mod:OnInitialize()
|
||||||
|
core:RegisterOptions(options, defaults)
|
||||||
|
end
|
||||||
|
|
||||||
|
function mod:OnEnable()
|
||||||
|
self:RegisterEvent("RAID_ROSTER_UPDATE")
|
||||||
|
self:RegisterEvent("ADDON_LOADED")
|
||||||
|
end
|
||||||
|
|
||||||
|
function mod:ADDON_LOADED(_, name)
|
||||||
|
if name == "Blizzard_GuildUI" then
|
||||||
|
self:SecureHook("GuildRoster_SetView")
|
||||||
|
self:SecureHook("GuildRoster_Update")
|
||||||
|
self:SecureHook(GuildRosterContainer, "update", "GuildRoster_Update")
|
||||||
|
local buttons = GuildRosterContainer.buttons
|
||||||
|
for i=1, #buttons do
|
||||||
|
buttons[i].stripe.texture = buttons[i].stripe:GetTexture()
|
||||||
|
self:RawHookScript(buttons[i], "OnClick", "GuildRosterButton_OnClick")
|
||||||
|
end
|
||||||
|
-- self:RawHook("GuildRosterButton_OnClick", true)
|
||||||
|
self:UnregisterEvent("ADDON_LOADED")
|
||||||
|
|
||||||
|
-- modify physical guild pane
|
||||||
|
-- change existing text
|
||||||
|
local offlineText = GuildRosterShowOfflineButton:GetRegions()
|
||||||
|
if offlineText:GetObjectType() == "FontString" then
|
||||||
|
offlineText:SetText("Offline")
|
||||||
|
|
||||||
|
-- make a button
|
||||||
|
local frame = CreateFrame("CheckButton", "GuildRosterShowRaidersButton", GuildRosterFrame, "UICheckButtonTemplate")
|
||||||
|
frame:SetSize(20, 20)
|
||||||
|
frame:SetPoint("LEFT", offlineText, "RIGHT", 8, 0)
|
||||||
|
frame:SetScript("OnClick", function(check)
|
||||||
|
rosterRaidersOnly = check:GetChecked()
|
||||||
|
HybridScrollFrame_SetOffset(GuildRosterContainer, 0)
|
||||||
|
GuildRoster_Update()
|
||||||
|
-- reset text to force an update ala Blizzard_GuildUI.lua:72
|
||||||
|
local totalMembers, onlineMembers = GetNumGuildMembers()
|
||||||
|
GuildFrameMembersCount:SetText(onlineMembers.." / "..totalMembers)
|
||||||
|
end)
|
||||||
|
local text = frame:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall")
|
||||||
|
text:SetText("Raiders")
|
||||||
|
text:SetPoint("LEFT", frame, "RIGHT", 2, 1)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- hook the members online text set
|
||||||
|
local memberSetText = GuildFrameMembersCount.SetText
|
||||||
|
GuildFrameMembersCount.SetText = function(self, str, ...)
|
||||||
|
if rosterRaidersOnly and rosterRaidersOnline > 0 then
|
||||||
|
str = format("%d / %d", rosterRaidersOnline, rosterRaidersCount)
|
||||||
|
end
|
||||||
|
return memberSetText(self, str, ...)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- cache all raiders
|
||||||
|
self:CacheRaiders()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function mod:RAID_ROSTER_UPDATE()
|
||||||
|
if (_G["GuildRoster_Update"]) then
|
||||||
|
self:GuildRoster_Update()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function mod:GuildRoster_SetView(view)
|
||||||
|
guildView = view
|
||||||
|
end
|
||||||
|
|
||||||
|
function mod:GuildRoster_Update()
|
||||||
|
self:RosterUpdatePostHook()
|
||||||
|
|
||||||
|
local view = self.guildView or GuildRosterViewDropdown.selectedValue
|
||||||
|
local buttons = GuildRosterContainer.buttons
|
||||||
|
local offset = HybridScrollFrame_GetOffset(GuildRosterContainer);
|
||||||
|
for i=1, #buttons do
|
||||||
|
local stripe = buttons[i].stripe
|
||||||
|
if stripe.texture then
|
||||||
|
stripe:SetTexture(stripe.texture)
|
||||||
|
end
|
||||||
|
|
||||||
|
if (UnitInRaid("player") and self.db.profile.easyInvites) then
|
||||||
|
if buttons[i].guildIndex then
|
||||||
|
name = GetGuildRosterInfo(buttons[i].guildIndex)
|
||||||
|
if name and UnitInRaid(name) and (view == "playerStatus" or view == "guildStatus") then
|
||||||
|
buttons[i].stripe:SetTexture(1, 0.5, 0, 0.3)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local lastCache = GetTime()
|
||||||
|
function mod:ModifyRosterPane()
|
||||||
|
end
|
||||||
|
|
||||||
|
function mod:CacheRaiders()
|
||||||
|
wipe(rosterRaidersCache)
|
||||||
|
rosterRaidersCount = 0
|
||||||
|
|
||||||
|
for i=1,GetNumGuildMembers() do
|
||||||
|
if self:IsRaider(i) then
|
||||||
|
rosterRaidersCache[GetGuildRosterInfo(i)] = true
|
||||||
|
rosterRaidersCount = rosterRaidersCount + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function mod:IsRaider(index)
|
||||||
|
local name, _, rank, _, _, _, note, _, online = GetGuildRosterInfo(index)
|
||||||
|
-- if a raider+ rank, or below and linked to a raider
|
||||||
|
-- not name tests for out of bounds check
|
||||||
|
if not name or ((rank <= 1) or (rank == 3) or (rank == 5) or ((rank == 4 or rank == 2) and online and rosterRaidersCache[note])) then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
local GUILD_ROSTER_MAX_COLUMNS = 5;
|
||||||
|
local GUILD_ROSTER_MAX_STRINGS = 4;
|
||||||
|
local GUILD_ROSTER_BAR_MAX = 239;
|
||||||
|
local GUILD_ROSTER_BUTTON_OFFSET = 2;
|
||||||
|
local GUILD_ROSTER_BUTTON_HEIGHT = 20;
|
||||||
|
|
||||||
|
function mod:RosterUpdatePostHook()
|
||||||
|
if not rosterRaidersOnly then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if GetTime() - lastCache > 60*5 then
|
||||||
|
self:CacheRaiders()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- begin modified blizzard code
|
||||||
|
|
||||||
|
local scrollFrame = GuildRosterContainer;
|
||||||
|
local offset = HybridScrollFrame_GetOffset(scrollFrame);
|
||||||
|
local buttons = scrollFrame.buttons;
|
||||||
|
local numButtons = #buttons;
|
||||||
|
local button, index, class;
|
||||||
|
local totalMembers, onlineMembers = GetNumGuildMembers();
|
||||||
|
local selectedGuildMember = GetGuildRosterSelection();
|
||||||
|
local currentGuildView = self.guildView or GuildRosterViewDropdown.selectedValue
|
||||||
|
|
||||||
|
if ( currentGuildView == "tradeskill" ) then
|
||||||
|
return;
|
||||||
|
end
|
||||||
|
|
||||||
|
local maxWeeklyXP, maxTotalXP = GetGuildRosterLargestContribution();
|
||||||
|
local maxAchievementsPoints = GetGuildRosterLargestAchievementPoints();
|
||||||
|
-- numVisible
|
||||||
|
local visibleMembers = 0;
|
||||||
|
for i=1,onlineMembers do
|
||||||
|
if self:IsRaider(i) then
|
||||||
|
visibleMembers = visibleMembers + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- copy visibleMembers to local for referencing
|
||||||
|
rosterRaidersOnline = visibleMembers
|
||||||
|
|
||||||
|
if ( GetGuildRosterShowOffline() ) then
|
||||||
|
visibleMembers = rosterRaidersCount;
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- self:Print("Start", visibleMembers, rosterRaidersCount)
|
||||||
|
local safety = 1000
|
||||||
|
local numRaidersDisp = 0
|
||||||
|
local i = 1
|
||||||
|
local nonMembers = 0
|
||||||
|
while i <= numButtons do
|
||||||
|
safety = safety - 1
|
||||||
|
if safety == 0 then
|
||||||
|
error("SAFTEY BROKEN")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
button = buttons[i];
|
||||||
|
index = i + nonMembers;
|
||||||
|
local name, rank, rankIndex, level, class, zone, note, officernote, online, status, classFileName, achievementPoints, achievementRank, isMobile = GetGuildRosterInfo(index);
|
||||||
|
-- self:Print(name, index, rank, note, online, self:IsRaider(index))
|
||||||
|
if ( name and i <= visibleMembers) then
|
||||||
|
if self:IsRaider(index) then
|
||||||
|
-- self:Print(offset, name)
|
||||||
|
if offset == 0 then
|
||||||
|
i = i + 1
|
||||||
|
button.guildIndex = index;
|
||||||
|
local displayedName = name;
|
||||||
|
if ( isMobile ) then
|
||||||
|
displayedName = ChatFrame_GetMobileEmbeddedTexture(119/255, 137/255, 119/255)..displayedName;
|
||||||
|
end
|
||||||
|
button.online = online;
|
||||||
|
if ( currentGuildView == "playerStatus" ) then
|
||||||
|
GuildRosterButton_SetStringText(button.string1, level, online)
|
||||||
|
button.icon:SetTexCoord(unpack(CLASS_ICON_TCOORDS[classFileName]));
|
||||||
|
GuildRosterButton_SetStringText(button.string2, displayedName, online, classFileName)
|
||||||
|
GuildRosterButton_SetStringText(button.string3, isMobile and REMOTE_CHAT or zone, online)
|
||||||
|
elseif ( currentGuildView == "guildStatus" ) then
|
||||||
|
GuildRosterButton_SetStringText(button.string1, displayedName, online, classFileName)
|
||||||
|
GuildRosterButton_SetStringText(button.string2, rank, online)
|
||||||
|
GuildRosterButton_SetStringText(button.string3, note, online)
|
||||||
|
if ( online ) then
|
||||||
|
GuildRosterButton_SetStringText(button.string4, GUILD_ONLINE_LABEL, online);
|
||||||
|
else
|
||||||
|
GuildRosterButton_SetStringText(button.string4, GuildRoster_GetLastOnline(index), online);
|
||||||
|
end
|
||||||
|
elseif ( currentGuildView == "weeklyxp" ) then
|
||||||
|
local weeklyXP, totalXP, weeklyRank, totalRank = GetGuildRosterContribution(index);
|
||||||
|
GuildRosterButton_SetStringText(button.string1, level, online)
|
||||||
|
button.icon:SetTexCoord(unpack(CLASS_ICON_TCOORDS[classFileName]));
|
||||||
|
GuildRosterButton_SetStringText(button.string2, displayedName, online, classFileName)
|
||||||
|
GuildRosterButton_SetStringText(button.string3, weeklyXP, online)
|
||||||
|
if ( weeklyXP == 0 ) then
|
||||||
|
button.barTexture:Hide();
|
||||||
|
else
|
||||||
|
button.barTexture:SetWidth(weeklyXP / maxWeeklyXP * GUILD_ROSTER_BAR_MAX);
|
||||||
|
button.barTexture:Show();
|
||||||
|
end
|
||||||
|
GuildRosterButton_SetStringText(button.barLabel, "#"..weeklyRank, online);
|
||||||
|
elseif ( currentGuildView == "totalxp" ) then
|
||||||
|
local weeklyXP, totalXP, weeklyRank, totalRank = GetGuildRosterContribution(index);
|
||||||
|
GuildRosterButton_SetStringText(button.string1, level, online);
|
||||||
|
button.icon:SetTexCoord(unpack(CLASS_ICON_TCOORDS[classFileName]));
|
||||||
|
GuildRosterButton_SetStringText(button.string2, displayedName, online, classFileName);
|
||||||
|
GuildRosterButton_SetStringText(button.string3, totalXP, online);
|
||||||
|
if ( totalXP == 0 ) then
|
||||||
|
button.barTexture:Hide();
|
||||||
|
else
|
||||||
|
button.barTexture:SetWidth(totalXP / maxTotalXP * GUILD_ROSTER_BAR_MAX);
|
||||||
|
button.barTexture:Show();
|
||||||
|
end
|
||||||
|
GuildRosterButton_SetStringText(button.barLabel, "#"..totalRank, online);
|
||||||
|
elseif ( currentGuildView == "pve" ) then
|
||||||
|
GuildRosterButton_SetStringText(button.string1, level, online);
|
||||||
|
button.icon:SetTexCoord(unpack(CLASS_ICON_TCOORDS[classFileName]));
|
||||||
|
GuildRosterButton_SetStringText(button.string2, displayedName, online, classFileName);
|
||||||
|
GuildRosterButton_SetStringText(button.string3, valor, online);
|
||||||
|
GuildRosterButton_SetStringText(button.string4, hero, online);
|
||||||
|
elseif ( currentGuildView == "pvp" ) then
|
||||||
|
local bgRating, arenaRating, arenaTeam = GetGuildRosterPVPRatings(index);
|
||||||
|
GuildRosterButton_SetStringText(button.string1, level, online);
|
||||||
|
button.icon:SetTexCoord(unpack(CLASS_ICON_TCOORDS[classFileName]));
|
||||||
|
GuildRosterButton_SetStringText(button.string2, displayedName, online, classFileName);
|
||||||
|
GuildRosterButton_SetStringText(button.string3, bgRating, online);
|
||||||
|
GuildRosterButton_SetStringText(button.string4, string.format(GUILD_ROSTER_ARENA_RATING, arenaRating, arenaTeam, arenaTeam), online);
|
||||||
|
elseif ( currentGuildView == "achievement" ) then
|
||||||
|
GuildRosterButton_SetStringText(button.string1, level, online);
|
||||||
|
button.icon:SetTexCoord(unpack(CLASS_ICON_TCOORDS[classFileName]));
|
||||||
|
GuildRosterButton_SetStringText(button.string2, displayedName, online, classFileName);
|
||||||
|
if ( achievementPoints >= 0 ) then
|
||||||
|
GuildRosterButton_SetStringText(button.string3, achievementPoints, online);
|
||||||
|
if ( achievementPoints == 0 ) then
|
||||||
|
button.barTexture:Hide();
|
||||||
|
else
|
||||||
|
button.barTexture:SetWidth(achievementPoints / maxAchievementsPoints * GUILD_ROSTER_BAR_MAX);
|
||||||
|
button.barTexture:Show();
|
||||||
|
end
|
||||||
|
else
|
||||||
|
GuildRosterButton_SetStringText(button.string3, NO_ROSTER_ACHIEVEMENT_POINTS, online);
|
||||||
|
button.barTexture:Hide();
|
||||||
|
end
|
||||||
|
GuildRosterButton_SetStringText(button.barLabel, "#"..achievementRank, online);
|
||||||
|
end
|
||||||
|
button:Show();
|
||||||
|
if ( mod(index, 2) == 0 ) then
|
||||||
|
button.stripe:SetTexCoord(0.36230469, 0.38183594, 0.95898438, 0.99804688);
|
||||||
|
else
|
||||||
|
button.stripe:SetTexCoord(0.51660156, 0.53613281, 0.88281250, 0.92187500);
|
||||||
|
end
|
||||||
|
if ( selectedGuildMember == index ) then
|
||||||
|
button:LockHighlight();
|
||||||
|
else
|
||||||
|
button:UnlockHighlight();
|
||||||
|
end
|
||||||
|
else
|
||||||
|
offset = offset - 1
|
||||||
|
nonMembers = nonMembers + 1
|
||||||
|
end
|
||||||
|
else
|
||||||
|
nonMembers = nonMembers + 1
|
||||||
|
end
|
||||||
|
else
|
||||||
|
-- self:Print("Break", i, visibleMembers, offset + i + nonMembers)
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- self:Print("End", i, visibleMembers, offset + i + nonMembers)
|
||||||
|
for i=i, numButtons do
|
||||||
|
buttons[i]:Hide()
|
||||||
|
end
|
||||||
|
local totalHeight = visibleMembers * (GUILD_ROSTER_BUTTON_HEIGHT + GUILD_ROSTER_BUTTON_OFFSET);
|
||||||
|
local displayedHeight = numButtons * (GUILD_ROSTER_BUTTON_HEIGHT + GUILD_ROSTER_BUTTON_OFFSET);
|
||||||
|
-- self:Print("Hybrid", scrollFrame, totalHeight, displayedHeight)
|
||||||
|
local guildUpdate = GuildRosterContainer.update
|
||||||
|
GuildRosterContainer.update = function() end
|
||||||
|
HybridScrollFrame_Update(scrollFrame, totalHeight, displayedHeight);
|
||||||
|
GuildRosterContainer.update = guildUpdate
|
||||||
|
end
|
||||||
|
|
||||||
|
function mod:GuildRosterButton_OnClick(this, button, ...)
|
||||||
|
if self.db.profile.easyInvites and IsAltKeyDown() then
|
||||||
|
local guildIndex = this.guildIndex
|
||||||
|
local name, _, _, _, _, _, _, _, online = GetGuildRosterInfo(guildIndex)
|
||||||
|
if online then
|
||||||
|
InviteUnit(name)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
self.hooks[this].OnClick(this, button, ...)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Old attempt -----------------------------------------------------------------
|
||||||
|
--[[
|
||||||
|
-- hook GetNumGuildMembers() second return result?
|
||||||
|
-- local GetNumGuildMembersHook = GetNumGuildMembers
|
||||||
|
-- function GetNumGuildMembers()
|
||||||
|
-- local total, online = GetNumGuildMembers
|
||||||
|
-- end
|
||||||
|
|
||||||
|
GetGuildRosterInfoHook = GetGuildRosterInfo
|
||||||
|
local GetGuildRosterInfoHook = GetGuildRosterInfoHook
|
||||||
|
local function nameNum(ind)
|
||||||
|
if ind and GetGuildRosterInfoHook(ind) then
|
||||||
|
return format("%s(%d)", GetGuildRosterInfoHook(ind), ind)
|
||||||
|
else
|
||||||
|
return format("nil(%d)", ind)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
function GetGuildRosterInfo(index)
|
||||||
|
-- no need
|
||||||
|
if not core.rosterRaidersOnly then
|
||||||
|
-- core:Print("Request for", index, "FAILED: core.rosterRaidersOnly=",core.rosterRaidersOnly, " core.inRosterUpdate=", core.inRosterUpdate)
|
||||||
|
return GetGuildRosterInfoHook(index)
|
||||||
|
end
|
||||||
|
|
||||||
|
local cache = core.rosterAlteredCache
|
||||||
|
local baseIndex = index -- the ACTUAL index that is mapped to whatever index is
|
||||||
|
|
||||||
|
-- check cache
|
||||||
|
index = cache[index] or index
|
||||||
|
|
||||||
|
isRaider = false
|
||||||
|
-- check if raider
|
||||||
|
if core:IsRaider(index) then
|
||||||
|
-- if they are, set flag
|
||||||
|
isRaider = true
|
||||||
|
else
|
||||||
|
-- if not, begin looking ahead
|
||||||
|
for j=baseIndex+1,GetNumGuildMembers() do
|
||||||
|
if core:IsRaider(cache[j] or j) then
|
||||||
|
-- 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))
|
||||||
|
cache[j] = index
|
||||||
|
cache[baseIndex] = j
|
||||||
|
-- and set our locals
|
||||||
|
index = j
|
||||||
|
isRaider = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- if you don't find one, index is unaltered
|
||||||
|
end
|
||||||
|
|
||||||
|
core:Print("Request for", nameNum(baseIndex), "returning", nameNum(index), " isRaider =",isRaider)
|
||||||
|
|
||||||
|
-- check flag if they're a raider
|
||||||
|
if isRaider or not core.inRosterUpdate then
|
||||||
|
-- if true, return actual stuff
|
||||||
|
if not GetGuildRosterShowOffline() and core.inRosterUpdate then
|
||||||
|
local online = select(9, GetGuildRosterInfoHook(index))
|
||||||
|
if not online then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return GetGuildRosterInfoHook(index)
|
||||||
|
end
|
||||||
|
-- if false, return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
function core:IsRaider(index)
|
||||||
|
local name, _, rank, _, _, _, note, _, online = GetGuildRosterInfoHook(index)
|
||||||
|
-- if a raider+ rank, or below and linked to a raider
|
||||||
|
-- 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
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
function core:RosterUpdatePreHook()
|
||||||
|
wipe(self.rosterAlteredCache)
|
||||||
|
self.inRosterUpdate = true
|
||||||
|
if self.rosterRaidersOnly then
|
||||||
|
self:Print("Update pre hook")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function core:RosterUpdatePostHook()
|
||||||
|
self.inRosterUpdate = false
|
||||||
|
if self.rosterRaidersOnly then
|
||||||
|
self:Print("Update post hook")
|
||||||
|
end
|
||||||
|
end]]
|
148
modules/macros.lua
Normal file
148
modules/macros.lua
Normal file
|
@ -0,0 +1,148 @@
|
||||||
|
local core = LibStub("AceAddon-3.0"):GetAddon("AllTheLittleThings")
|
||||||
|
local mod = core:NewModule("Macros", "AceTimer-3.0", "AceConsole-3.0")
|
||||||
|
local db = core.db.profile[mod:GetName()]
|
||||||
|
|
||||||
|
local defaults = {
|
||||||
|
}
|
||||||
|
local options = {
|
||||||
|
}
|
||||||
|
|
||||||
|
function mod:OnInitialize()
|
||||||
|
core:RegisterOptions(options, defaults)
|
||||||
|
core:RegisterSlashCommand("DisbandRaid", "dr", "disbandraid")
|
||||||
|
core:RegisterSlashCommand("InviteGuild", "ig", "inviteguild")
|
||||||
|
core:RegisterSlashCommand("PromoteAll", "pa", "promoteall")
|
||||||
|
core:RegisterSlashCommand("DemoteAll", "da", "demoteall")
|
||||||
|
core:RegisterSlashCommand("PrintLoot", "pl", "printloot")
|
||||||
|
core:RegisterSlashCommand("ClearMarks", "cm", "clearmarks")
|
||||||
|
core:RegisterSlashCommand("MasterLoot", "ml", "masterloot")
|
||||||
|
core:RegisterSlashCommand("RandomLoot", "rl", "randomloot")
|
||||||
|
core:RegisterSlashCommand("Countdown", "cd", "countdown")
|
||||||
|
core:RegisterSlashCommand("RosterCheck", "rc", "rostercheck")
|
||||||
|
end
|
||||||
|
|
||||||
|
function mod:DisbandRaid()
|
||||||
|
for i=1, GetNumRaidMembers() do
|
||||||
|
if not UnitIsUnit("raid"..i,"player") then
|
||||||
|
UninviteUnit("raid"..i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function mod:InviteGuild()
|
||||||
|
for i=1, select(2, GetNumGuildMembers()) do
|
||||||
|
if not UnitInRaid(GetGuildRosterInfo(i)) then
|
||||||
|
InviteUnit(GetGuildRosterInfo(i))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function mod:PromoteAll()
|
||||||
|
for i=0, GetNumRaidMembers() do
|
||||||
|
PromoteToAssistant("raid"..i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function mod:DemoteAll()
|
||||||
|
for i=0, GetNumRaidMembers() do
|
||||||
|
DemoteAssistant("raid"..i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function mod:PrintLoot()
|
||||||
|
self:RaidDump("Send tells for loot:", "raid_warning")
|
||||||
|
for i=1,GetNumLootItems() do
|
||||||
|
SendChatMessage(GetLootSlotLink(i) .. " (" .. ({"A", "B", "C", "D", "E", "F", "G", "H"})[i] .. ")", "raid_warning")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function mod:ClearMarks()
|
||||||
|
for i=8,0,-1 do
|
||||||
|
SetRaidTarget("player", i)
|
||||||
|
end
|
||||||
|
self:ScheduleTimer(function() SetRaidTarget("player", 0) end, 0.5)
|
||||||
|
end
|
||||||
|
|
||||||
|
local mlOrder = {"Chira", "Brinkley", "Yukiri"}
|
||||||
|
function mod:MasterLoot()
|
||||||
|
for k,v in ipairs(mlOrder) do
|
||||||
|
for i=1, 40 do
|
||||||
|
if GetMasterLootCandidate(i) == v then
|
||||||
|
for j=1, GetNumLootItems() do
|
||||||
|
GiveMasterLoot(j, i)
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function mod:RandomLoot()
|
||||||
|
local members = {}
|
||||||
|
for i=1,40 do
|
||||||
|
if GetMasterLootCandidate(i) then
|
||||||
|
table.insert(members, i);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for j=1, GetNumLootItems() do
|
||||||
|
GiveMasterLoot(j, members[random(#members)])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local countDown = {"Pulling in 5", "4", "3", "2", "1", "Go"} -- used in /atlt cd
|
||||||
|
function mod:Countdown()
|
||||||
|
for i=5,0,-1 do
|
||||||
|
self:ScheduleTimer(function()
|
||||||
|
local msg = countDown[6-i];
|
||||||
|
--[[if (msg == "Go") then
|
||||||
|
local transitive = TRANSITIVES[math.random(#TRANSITIVES)];
|
||||||
|
msg = format("%s babies", transitive)
|
||||||
|
end]]
|
||||||
|
SendChatMessage(msg, "RAID_WARNING");
|
||||||
|
end, 5-i);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- TODO: make a global alt_ranks and main_ranks thing in case we change it
|
||||||
|
local altRanks = {
|
||||||
|
[2] = true,
|
||||||
|
[4] = true,
|
||||||
|
}
|
||||||
|
function mod:RosterCheck()
|
||||||
|
local mains = {}
|
||||||
|
local alts = {}
|
||||||
|
for i=1,GetNumGuildMembers() do
|
||||||
|
local name, _, rank, _, _, _, onote = GetGuildRosterInfo(i)
|
||||||
|
if altRanks[rank] then
|
||||||
|
alts[name] = onote
|
||||||
|
else
|
||||||
|
mains[name] = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local toPrint = {}
|
||||||
|
for name,main in pairs(alts) do
|
||||||
|
if mains[main] then
|
||||||
|
alts[name] = nil
|
||||||
|
else
|
||||||
|
table.insert(toPrint, name)
|
||||||
|
table.sort(toPrint, function(a,b) return alts[a]<alts[b] end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for _,name in ipairs(toPrint) do
|
||||||
|
self:Print("Mismatched Alt:", name, "belongs to", alts[name], format("|cffffa0a0|Hgremove:%s|h[Guild Remove]|h", name))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- mismatched alts itemlink
|
||||||
|
local SetItemRefHook = SetItemRef
|
||||||
|
function SetItemRef(id, ...)
|
||||||
|
local target = id:match("gremove:(.+)")
|
||||||
|
if target then
|
||||||
|
GuildUninvite(target)
|
||||||
|
else
|
||||||
|
return SetItemRefHook(id, ...)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
35
modules/raid.lua
Normal file
35
modules/raid.lua
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
local core = LibStub("AceAddon-3.0"):GetAddon("AllTheLittleThings")
|
||||||
|
local mod = core:NewModule("Raid", "AceEvent-3.0", "AceTimer-3.0")
|
||||||
|
local db = core.db.profile[mod:GetName()]
|
||||||
|
|
||||||
|
local defaults = {
|
||||||
|
autoML = true,
|
||||||
|
}
|
||||||
|
local options = {
|
||||||
|
autoML = {
|
||||||
|
name = "Auto ML",
|
||||||
|
desc = "Sets loot type to ML when a raid has more than 20 players in it.",
|
||||||
|
type = "toggle",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
function mod:OnInitialize()
|
||||||
|
core:RegisterOptions(options, defaults)
|
||||||
|
end
|
||||||
|
|
||||||
|
function mod:OnEnable()
|
||||||
|
self:RegisterEvent("RAID_ROSTER_UPDATE")
|
||||||
|
end
|
||||||
|
|
||||||
|
local zoneBlacklist = {
|
||||||
|
["Wintergrasp"] = true,
|
||||||
|
["Tol Barad"] = true,
|
||||||
|
["Alterac Valley"] = true,
|
||||||
|
["Isle of Conquest"] = true,
|
||||||
|
}
|
||||||
|
function mod:RAID_ROSTER_UPDATE()
|
||||||
|
if db.autoML and IsRaidLeader() and GetNumRaidMembers()>20 and GetLootMethod() ~= "master" and not zoneBlacklist[GetRealZoneText()] then
|
||||||
|
SetLootMethod("master", "player")
|
||||||
|
self:ScheduleTimer(function() SetLootThreshold(3) end, 2)
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue