From 355bca680b4a8079b8a69909c1ab43b79d344a31 Mon Sep 17 00:00:00 2001 From: pigmonkey Date: Mon, 30 May 2011 14:07:22 -0400 Subject: [PATCH] forgot to add all the files up until now --- AllTheLittleThings.old.lua | 325 ------------------------- modules/.battlegrounds.lua.swp | Bin 16384 -> 0 bytes modules/announce.lua | 132 +++++++++++ modules/defaultui.lua | 14 ++ modules/deprecated.lua | 189 +++++++++++++++ modules/guildroster.lua | 422 +++++++++++++++++++++++++++++++++ modules/macros.lua | 148 ++++++++++++ modules/raid.lua | 35 +++ 8 files changed, 940 insertions(+), 325 deletions(-) delete mode 100644 modules/.battlegrounds.lua.swp create mode 100644 modules/announce.lua create mode 100644 modules/defaultui.lua create mode 100644 modules/deprecated.lua create mode 100644 modules/guildroster.lua create mode 100644 modules/macros.lua create mode 100644 modules/raid.lua diff --git a/AllTheLittleThings.old.lua b/AllTheLittleThings.old.lua index f092726..680c574 100644 --- a/AllTheLittleThings.old.lua +++ b/AllTheLittleThings.old.lua @@ -50,14 +50,6 @@ local options = { get = function(info) return core.db.profile.markMsgFilter 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 = { @@ -72,7 +64,6 @@ local defaults = { consolidateThresh = 0, officerPhone = true, markMsgFilter = true, - macroSwap = true, halloween = 1, guildXPMarks = { }, } @@ -89,9 +80,6 @@ local potList = { core.guildList = {} core.rollTally = {} core.rollTimer = false -core.guildHook = false -core.consolidateHook = false -core.achieveHook = false core.hallowBuff = nil core.mailQueue = {} -- used in /atlt pots @@ -103,12 +91,7 @@ function core:OnInitialize() LibStub("AceConfig-3.0"):RegisterOptionsTable("ATLT", options) self.optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("ATLT", "All The Little Things") - -- Init finished - -- self.guildList = self:GetGuildList() ConsoleExec("cameradistancemaxfactor 5") - - -- try to reproduce that bug - -- self:Nostromo() end function core:OnEnable() @@ -536,48 +519,6 @@ function core:FlaskCheck() 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() local winner @@ -937,98 +878,6 @@ function core:NewRBSButton(label, func, width, anchorFrom, anchorTo, anchorX, an 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() local module = Prat.Addon:GetModule('AltNames') @@ -1072,163 +921,7 @@ function core:SetupPrat() 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 = { "CHAT_MSG_ACHIEVEMENT", @@ -1321,21 +1014,3 @@ end -- core:FilterAll("achievement:284") core:FilterAll(nil, "Alabrooke") 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();]] diff --git a/modules/.battlegrounds.lua.swp b/modules/.battlegrounds.lua.swp deleted file mode 100644 index f0509b19980ed0f2efe2a0ae9f706600e179ca48..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16384 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 diff --git a/modules/announce.lua b/modules/announce.lua new file mode 100644 index 0000000..c24aa51 --- /dev/null +++ b/modules/announce.lua @@ -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 + diff --git a/modules/defaultui.lua b/modules/defaultui.lua new file mode 100644 index 0000000..af15b03 --- /dev/null +++ b/modules/defaultui.lua @@ -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 + diff --git a/modules/deprecated.lua b/modules/deprecated.lua new file mode 100644 index 0000000..e596ebc --- /dev/null +++ b/modules/deprecated.lua @@ -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 diff --git a/modules/guildroster.lua b/modules/guildroster.lua new file mode 100644 index 0000000..23336ac --- /dev/null +++ b/modules/guildroster.lua @@ -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]] diff --git a/modules/macros.lua b/modules/macros.lua new file mode 100644 index 0000000..48c9868 --- /dev/null +++ b/modules/macros.lua @@ -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]20 and GetLootMethod() ~= "master" and not zoneBlacklist[GetRealZoneText()] then + SetLootMethod("master", "player") + self:ScheduleTimer(function() SetLootThreshold(3) end, 2) + end +end