diff --git a/PermoksAccountManager.lua b/PermoksAccountManager.lua index c22e3c7..26b7632 100644 --- a/PermoksAccountManager.lua +++ b/PermoksAccountManager.lua @@ -1,145 +1,161 @@ local addonName, PermoksAccountManager = ... -PermoksAccountManager = LibStub('AceAddon-3.0'):NewAddon(PermoksAccountManager, 'PermoksAccountManager', 'AceConsole-3.0', 'AceEvent-3.0') +PermoksAccountManager = + LibStub("AceAddon-3.0"):NewAddon(PermoksAccountManager, "PermoksAccountManager", "AceConsole-3.0", "AceEvent-3.0") -- Create minimap icon with LibDataBroker. -local PermoksAccountManagerLDB = - LibStub('LibDataBroker-1.1'):NewDataObject( - 'PermoksAccountManager', - { - type = 'data source', - text = 'Permoks Account Manager', - icon = 'Interface/Icons/achievement_guildperk_everybodysfriend.blp', - OnClick = function(self, button) - if button == 'LeftButton' then - if PermoksAccountManagerFrame:IsShown() then - PermoksAccountManager:HideInterface() - else - PermoksAccountManager:ShowInterface() - end - elseif button == 'RightButton' then - PermoksAccountManager:OpenOptions(true) - end - end, - OnTooltipShow = function(tt) - tt:AddLine('|cfff49b42Permoks Account Manager|r') - tt:AddLine('|cffffffffLeft-click|r to open the Manager') - tt:AddLine('|cffffffffRight-click|r to open options') - tt:AddLine("Type '/pam minimap' to hide the Minimap Button!") - end - } -) +local PermoksAccountManagerLDB = LibStub("LibDataBroker-1.1"):NewDataObject("PermoksAccountManager", { + type = "data source", + text = "Permoks Account Manager", + icon = "Interface/Icons/achievement_guildperk_everybodysfriend.blp", + OnClick = function(self, button) + if button == "LeftButton" then + if PermoksAccountManager.db.global.options.showOnEnter then + PermoksAccountManager:ShowInterface() + PermoksAccountManager.openedByClick = true + elseif PermoksAccountManagerFrame:IsShown() then + PermoksAccountManager:HideInterface() + else + PermoksAccountManager:ShowInterface() + end + elseif button == "RightButton" then + PermoksAccountManager:OpenOptions(true) + end + end, + OnTooltipShow = function(tt) + if PermoksAccountManager.db.global.options.showOnEnter then + PermoksAccountManager:ShowInterface() + PermoksAccountManager.openedByClick = nil + end + + tt:AddLine("|cfff49b42Permoks Account Manager|r") + tt:AddLine("|cffffffffLeft-click|r to open the Manager") + tt:AddLine("|cffffffffRight-click|r to open options") + tt:AddLine("Type '/pam minimap' to hide the Minimap Button!") + end, + OnLeave = function() + if PermoksAccountManager.db.global.options.showOnEnter and not PermoksAccountManager.openedByClick then + PermoksAccountManager:HideInterface() + PermoksAccountManager.openedByClick = nil + end + end, +}) BINDING_HEADER_PAM = addonName -local AceGUI = LibStub('AceGUI-3.0') -local LibIcon = LibStub('LibDBIcon-1.0') -local LibQTip = LibStub('LibQTip-1.0') -local L = LibStub('AceLocale-3.0'):GetLocale(addonName) -local LSM = LibStub('LibSharedMedia-3.0') +local AceGUI = LibStub("AceGUI-3.0") +local LibIcon = LibStub("LibDBIcon-1.0") +local LibQTip = LibStub("LibQTip-1.0") +local L = LibStub("AceLocale-3.0"):GetLocale(addonName) +local LSM = LibStub("LibSharedMedia-3.0") local VERSION = C_AddOns.GetAddOnMetadata(addonName, "Version") -local INTERNALVERSION = 34 +local INTERNALMIDNIGHT = 2 local INTERNALWOTLKVERSION = 6 local INTERNALCATAVERSION = 3 +local INTERNALMISTSVERSION = 1 local defaultDB = { - profile = { - minimap = { - hide = false - } - }, - global = { - blacklist = {}, - pages = {}, - accounts = { - main = { - name = L['Main'], - data = { - + profile = { + minimap = { + hide = false, + }, + }, + global = { + blacklist = {}, + pages = {}, + accounts = { + main = { + name = L["Main"], + data = { + ["**"] = { + customData = {}, + }, + }, + warbandData = { + name = "Warband", + }, + pages = {}, + }, + }, + currentPage = 1, + numAccounts = 1, + data = {}, + completionData = { ["**"] = { numCompleted = 0 } }, + alts = 0, + synchedCharacters = {}, + blockedCharacters = {}, + syncedAccountKeys = {}, + customLabels = false, + options = { + buttons = { + updated = false, + buttonWidth = 120, + buttonTextWidth = 110, + widthPerAlt = 120, + justifyH = "LEFT", + }, + other = { + updated = false, + labelOffset = 5, + frameStrata = "MEDIUM", + }, + characters = { + charactersPerPage = 6, + minLevel = GetMaxLevelForExpansionLevel(GetExpansionLevel()) - 10, + combine = false, + sortBy = "order", + sortByLesser = true, + }, + border = { + edgeSize = 5, + color = { 0.39, 0.39, 0.39, 1 }, + bgColor = { 0, 0, 0, 0.9 }, + }, + font = "Expressway", + fontSize = 11, + hideWarband = false, + savePosition = false, + showOptionsButton = false, + showGuildAttunementButton = false, + currencyIcons = true, + itemIcons = true, + useScoreColor = true, + showCurrentSpecIcon = true, + currentCharacterFirstPosition = false, + questCompletionString = "True", + useOutline = true, + itemIconPosition = "right", + currencyIconPosition = "right", + showOnEnter = false, + customCategories = { + general = { + childOrder = { characterName = 1, ilevel = 2 }, + childs = { "characterName", "ilevel" }, + order = 0, + hideToggle = true, + name = "General", + enabled = true, + }, + ["**"] = { childOrder = {}, childs = {}, enabled = true }, + }, + defaultCategories = { + ["**"] = { + enabled = true, }, - warbandData = { - name = 'Warband (NYI)' - }, - pages = {} - } - }, - currentPage = 1, - numAccounts = 1, - data = {}, - completionData = {['**'] = {numCompleted = 0}}, - alts = 0, - synchedCharacters = {}, - blockedCharacters = {}, - syncedAccountKeys = {}, - customLabels = false, - options = { - buttons = { - updated = false, - buttonWidth = 120, - buttonTextWidth = 110, - widthPerAlt = 120, - justifyH = 'LEFT' - }, - other = { - updated = false, - labelOffset = 5, - frameStrata = 'MEDIUM' - }, - characters = { - charactersPerPage = 6, - minLevel = GetMaxLevelForExpansionLevel(GetExpansionLevel())-10, - combine = false, - sortBy = 'order', - sortByLesser = true, - }, - border = { - edgeSize = 5, - color = {0.39, 0.39, 0.39, 1}, - bgColor = {0.1, 0.1, 0.1, 0.9} - }, - font = 'Expressway', - fontSize = 11, - hideWarband = true, - savePosition = false, - showOptionsButton = false, - showGuildAttunementButton = false, - currencyIcons = true, - itemIcons = true, - useScoreColor = true, - showCurrentSpecIcon = true, - currentCharacterFirstPosition = false, - questCompletionString = 'True', - useOutline = true, - itemIconPosition = 'right', - currencyIconPosition = 'right', - customCategories = { - general = { - childOrder = {characterName = 1, ilevel = 2}, - childs = {'characterName', 'ilevel'}, - order = 0, - hideToggle = true, - name = 'General', - enabled = true - }, - ['**'] = {childOrder = {}, childs = {}, enabled = true} - }, - defaultCategories = { - ['**'] = { - enabled = true - } - }, - customLabels = { - quest = {}, - item = {}, - currency = {} - } - }, - currentCallings = {}, - quests = {}, - currencyInfo = {}, - itemIcons = {}, - position = {}, - version = VERSION - } + }, + customLabels = { + quest = {}, + item = {}, + currency = {}, + custom = {}, + }, + }, + currentCallings = {}, + quests = {}, + currencyInfo = {}, + itemIcons = {}, + position = {}, + version = VERSION, + }, } --- Create an iterator for a hash table. @@ -147,2040 +163,2030 @@ local defaultDB = { -- @param order:function A sort function for the keys. -- @return function The iterator usable in a loop. local function spairs(t, order) - local keys = {} - for k in pairs(t) do - keys[#keys + 1] = k - end - - if order then - table.sort( - keys, - function(a, b) - return order(t, a, b) - end - ) - else - table.sort(keys) - end - - local i = 0 - return function() - i = i + 1 - if keys[i] then - return keys[i], t[keys[i]], keys[i + 1] - end - end + local keys = {} + for k in pairs(t) do + keys[#keys + 1] = k + end + + if order then + table.sort(keys, function(a, b) + return order(t, a, b) + end) + else + table.sort(keys) + end + + local i = 0 + return function() + i = i + 1 + if keys[i] then + return keys[i], t[keys[i]], keys[i + 1] + end + end end --- This function will be called when the user leaves the button the tooltip belonged to. local function Tooltip_OnLeave(self) - if self.tooltip then - LibQTip:Release(self.tooltip) - self.tooltip = nil - end + if self.tooltip then + LibQTip:Release(self.tooltip) + self.tooltip = nil + end end local CreateLabelButton, CreateManagerButton, LoadFonts, UpdateFonts do - local normalFont, smallFont, mediumLargeFont, largeFont - - --- Initialize the fonts - function LoadFonts() - local options = PermoksAccountManager.db.global.options - local outline = options.useOutline and 'OUTLINE' or nil - local font = LSM:Fetch('font', options.font) - - normalFont = CreateFont('PAM_NormalFont') - normalFont:SetFont(font, 11, outline) - normalFont:SetTextColor(1, 1, 1, 1) - - smallFont = CreateFont('PAM_SmallFont') - smallFont:SetFont(font, 9, outline) - smallFont:SetTextColor(1, 1, 1, 1) - - mediumLargeFont = CreateFont('PAM_MediumLargeFont') - mediumLargeFont:SetFont(font, 13, outline) - mediumLargeFont:SetTextColor(1, 1, 1, 1) - - largeFont = CreateFont('PAM_LargeFont') - largeFont:SetFont(font, 17, outline) - largeFont:SetTextColor(1, 1, 1, 1) - end - - --- Update the font path of all previously created fonts. - function UpdateFonts() - local options = PermoksAccountManager.db.global.options - local outline = options.useOutline and 'OUTLINE' or nil - local font = LSM:Fetch('font', options.font) - normalFont:SetFont(font, options.fontSize, outline) - smallFont:SetFont(font, 9, outline) - mediumLargeFont:SetFont(font, options.fontSize + 2, outline) - largeFont:SetFont(font, max(17, options.fontSize + 2), outline) - end - - --- Create the text for a normal button. - -- @param button:Button The button to create the font object for. - -- @param column:table The information table for the current column. - -- @param alt_data:table A table with information about a character. - -- @param text:string Text that can be used instead of generating a new one with alt_data. - -- @param buttonOptions:table - -- TODO - local function CreateInfoButton(button, column, buttonOptions) - button:SetNormalFontObject((column.big and largeFont) or (column.small and smallFont) or normalFont) - button:SetText(' ') - - local fontString = button:GetFontString() - if fontString then - button.fontString = fontString - fontString:SetSize(110, 20) - fontString:SetJustifyV(column.justify or 'MIDDLE') - fontString:SetJustifyH(buttonOptions.justifyH) - end - end - - --- Create the text for a label button. - -- @param button:Button The button to create the font object for. - -- @param buttonOptions:table - -- TODO - local function CreateMenuButton(button) - button:SetNormalFontObject(mediumLargeFont) - button:SetText(' ') - - local fontString = button:GetFontString() - fontString:SetSize(130, 20) - fontString:SetJustifyV('MIDDLE') - fontString:SetJustifyH('RIGHT') - end - - --- Create a button with a text. - -- @param type:string The type of button to create. - -- @param parent:Frame The parent frame for the button. - -- @param column:table The column data for the current column. - -- @param alt_data:table - -- @param index:int If the index is given then create a texture. - -- @param width:float Possible custom width. - function CreateLabelButton(type, parent, column, index, width) - local buttonOptions = PermoksAccountManager.db.global.options.buttons - local button = CreateFrame('Button', nil, parent) - button:SetSize(width or buttonOptions.buttonWidth, 20) - button:SetPushedTextOffset(0, 0) - - if type == 'row' then - if not column.hideOption and not column.hideLabel then - local highlightTexture = button:CreateTexture() - highlightTexture:SetAllPoints() - highlightTexture:SetColorTexture(0.5, 0.5, 0.5, 0.5) - button:SetHighlightTexture(highlightTexture) - - if index then - local normalTexture = button:CreateTexture(nil, 'BACKGROUND') - normalTexture:SetAllPoints() - button:SetNormalTexture(normalTexture) - button.normalTexture = normalTexture - end - end - CreateInfoButton(button, column, buttonOptions) - elseif type == 'label' then - CreateMenuButton(button) - end - - return button - end - - function CreateManagerButton(width, height, text) - local button = CreateFrame('Button', nil, PermoksAccountManager.managerFrame) - button:SetSize(width, height) - - local normalTexture = button:CreateTexture() - button.normalTexture = normalTexture - normalTexture:SetSize(width + 4, height + 11) - normalTexture:ClearAllPoints() - normalTexture:SetPoint('TOPLEFT', -2, 0) - normalTexture:SetAtlas('auctionhouse-nav-button', false) - - button:SetHighlightAtlas('auctionhouse-nav-button-highlight') - PermoksAccountManager:SkinButtonElvUI(button) - - local fontString = button:CreateFontString(nil, 'OVERLAY', 'PAM_MediumLargeFont') - button.Text = fontString - fontString:ClearAllPoints() - fontString:SetAllPoints() - fontString:SetText(text) - fontString:SetTextColor(1, 1, 1, 1) - - local selected = button:CreateTexture() - button.selected = selected - selected:SetSize(button:GetSize()) - selected:ClearAllPoints() - selected:SetPoint('CENTER', 0, -1) - selected:SetAtlas('auctionhouse-nav-button-select', false) - selected:Hide() - - button:SetScript( - 'OnMouseDown', - function() - fontString:AdjustPointsOffset(1, -1) - end - ) - button:SetScript( - 'OnMouseUp', - function() - fontString:AdjustPointsOffset(-1, 1) - end - ) - - return button - end + local normalFont, smallFont, mediumLargeFont, largeFont + + --- Initialize the fonts + function LoadFonts() + local options = PermoksAccountManager.db.global.options + local outline = options.useOutline and "OUTLINE" or nil + local font = LSM:Fetch("font", options.font) + font = font or "Fonts\\FRIZQT__.TTF" + + normalFont = CreateFont("PAM_NormalFont") + normalFont:SetFont(font, options.fontSize, outline) + normalFont:SetTextColor(1, 1, 1, 1) + + smallFont = CreateFont("PAM_SmallFont") + smallFont:SetFont(font, 9, outline) + smallFont:SetTextColor(1, 1, 1, 1) + + mediumLargeFont = CreateFont("PAM_MediumLargeFont") + mediumLargeFont:SetFont(font, options.fontSize + 2, outline) + mediumLargeFont:SetTextColor(1, 1, 1, 1) + + largeFont = CreateFont("PAM_LargeFont") + largeFont:SetFont(font, max(17, options.fontSize + 2), outline) + largeFont:SetTextColor(1, 1, 1, 1) + end + + --- Update the font path of all previously created fonts. + function UpdateFonts() + local options = PermoksAccountManager.db.global.options + local outline = options.useOutline and "OUTLINE" or "" + local font = LSM:Fetch("font", options.font) + normalFont:SetFont(font, options.fontSize, outline) + smallFont:SetFont(font, 9, outline) + mediumLargeFont:SetFont(font, options.fontSize + 2, outline) + largeFont:SetFont(font, max(17, options.fontSize + 2), outline) + end + + --- Create the text for a normal button. + -- @param button:Button The button to create the font object for. + -- @param column:table The information table for the current column. + -- @param alt_data:table A table with information about a character. + -- @param text:string Text that can be used instead of generating a new one with alt_data. + -- @param buttonOptions:table + -- TODO + local function CreateInfoButton(button, column, buttonOptions) + button:SetNormalFontObject((column.big and largeFont) or (column.small and smallFont) or normalFont) + button:SetText(" ") + + local fontString = button:GetFontString() + if fontString then + button.fontString = fontString + fontString:SetSize(110, 20) + fontString:SetJustifyV(column.justify or "MIDDLE") + fontString:SetJustifyH(buttonOptions.justifyH) + end + end + + --- Create the text for a label button. + -- @param button:Button The button to create the font object for. + -- @param buttonOptions:table + -- TODO + local function CreateMenuButton(button) + button:SetNormalFontObject(mediumLargeFont) + button:SetText(" ") + + local fontString = button:GetFontString() + fontString:SetSize(130, 20) + fontString:SetJustifyV("MIDDLE") + fontString:SetJustifyH("RIGHT") + end + + --- Create a button with a text. + -- @param type:string The type of button to create. + -- @param parent:Frame The parent frame for the button. + -- @param column:table The column data for the current column. + -- @param alt_data:table + -- @param index:int If the index is given then create a texture. + -- @param width:float Possible custom width. + function CreateLabelButton(type, parent, column, index, width) + local buttonOptions = PermoksAccountManager.db.global.options.buttons + local button = CreateFrame("Button", nil, parent) + button:SetSize(width or buttonOptions.buttonWidth, 20) + button:SetPushedTextOffset(0, 0) + + if type == "row" then + if not column.hideOption and not column.hideLabel then + local highlightTexture = button:CreateTexture() + highlightTexture:SetAllPoints() + highlightTexture:SetColorTexture(0.5, 0.5, 0.5, 0.5) + button:SetHighlightTexture(highlightTexture) + + if index then + local normalTexture = button:CreateTexture(nil, "BACKGROUND") + normalTexture:SetAllPoints() + button:SetNormalTexture(normalTexture) + button.normalTexture = normalTexture + end + end + CreateInfoButton(button, column, buttonOptions) + elseif type == "label" then + CreateMenuButton(button) + end + + return button + end + + local categoryButtons = {} + function CreateManagerButton(width, height, text) + local button = + CreateFrame("Button", "PAM_ManagerButton_" .. #categoryButtons + 1, PermoksAccountManager.managerFrame) + tinsert(categoryButtons, button) + button:SetSize(width, height) + + local normalTexture = button:CreateTexture() + button.normalTexture = normalTexture + normalTexture:SetSize(width + 4, height + 11) + normalTexture:ClearAllPoints() + normalTexture:SetPoint("TOPLEFT", -2, 0) + normalTexture:SetAtlas("auctionhouse-nav-button", false) + + button:SetHighlightAtlas("auctionhouse-nav-button-highlight") + PermoksAccountManager:SkinButtonElvUI(button) + + local fontString = button:CreateFontString(nil, "OVERLAY", "PAM_MediumLargeFont") + button.Text = fontString + fontString:ClearAllPoints() + fontString:SetAllPoints() + fontString:SetText(text) + fontString:SetTextColor(1, 1, 1, 1) + + local selected = button:CreateTexture() + button.selected = selected + selected:SetSize(button:GetSize()) + selected:ClearAllPoints() + selected:SetPoint("CENTER", 0, -1) + selected:SetAtlas("auctionhouse-nav-button-select", false) + selected:Hide() + + button:SetScript("OnMouseDown", function() + fontString:AdjustPointsOffset(1, -1) + end) + button:SetScript("OnMouseUp", function() + fontString:AdjustPointsOffset(-1, 1) + end) + + return button + end end do - local BACKDROP_PAM_NO_BG = { - edgeFile = 'Interface/Buttons/WHITE8X8', - edgeSize = 5 - } - - local BACKDROP_PAM_BG = { - edgeFile = 'Interface/Buttons/WHITE8X8', - bgFile = 'Interface/Buttons/WHITE8X8', - edgeSize = 5 - } - - local backdrops = {} - function PermoksAccountManager:UpdateBorder(backdrop, anchor, useBG) - local borderOptions = self.db.global.options.border - local color = borderOptions.color - local bgColor = borderOptions.bgColor or {0.1, 0.1, 0.1, 0.9} - backdrop:SetBackdrop(nil) - - if anchor then - backdrop:SetPoint('TOPLEFT', anchor, 'TOPLEFT', -5, 5) - backdrop:SetPoint('BOTTOMRIGHT', anchor, 'BOTTOMRIGHT', 5, -5) - end - - if useBG then - backdrop:SetBackdrop(BACKDROP_PAM_BG) - backdrop:SetBackdropColor(unpack(bgColor)) - backdrops[backdrop] = true - else - backdrop:SetBackdrop(BACKDROP_PAM_NO_BG) - backdrops[backdrop] = false - end - - backdrop:SetBackdropBorderColor(unpack(color)) - end - - function PermoksAccountManager:UpdateBorderColor() - local borderOptions = self.db.global.options.border - local color = borderOptions.color - local bgColor = borderOptions.bgColor or {0.1, 0.1, 0.1, 0.9} - - for backdrop, useBG in pairs(backdrops) do - if useBG then - backdrop:SetBackdropColor(unpack(bgColor)) - end - backdrop:SetBackdropBorderColor(unpack(color)) - end - end + local BACKDROP_PAM_NO_BG = { + edgeFile = "Interface/Buttons/WHITE8X8", + edgeSize = 5, + } + + local BACKDROP_PAM_BG = { + edgeFile = "Interface/Buttons/WHITE8X8", + bgFile = "Interface/Buttons/WHITE8X8", + edgeSize = 5, + } + + local backdrops = {} + function PermoksAccountManager:UpdateBorder(backdrop, anchor, useBG) + local borderOptions = self.db.global.options.border + local color = borderOptions.color + local bgColor = borderOptions.bgColor or { 0.1, 0.1, 0.1, 0.9 } + backdrop:SetBackdrop(nil) + + if anchor then + backdrop:SetPoint("TOPLEFT", anchor, "TOPLEFT", -5, 5) + backdrop:SetPoint("BOTTOMRIGHT", anchor, "BOTTOMRIGHT", 5, -5) + end + + if useBG then + backdrop:SetBackdrop(BACKDROP_PAM_BG) + backdrop:SetBackdropColor(unpack(bgColor)) + backdrops[backdrop] = true + else + backdrop:SetBackdrop(BACKDROP_PAM_NO_BG) + backdrops[backdrop] = false + end + + backdrop:SetBackdropBorderColor(unpack(color)) + end + + function PermoksAccountManager:UpdateBorderColor() + local borderOptions = self.db.global.options.border + local color = borderOptions.color + local bgColor = borderOptions.bgColor or { 0.1, 0.1, 0.1, 0.9 } + + for backdrop, useBG in pairs(backdrops) do + if useBG then + backdrop:SetBackdropColor(unpack(bgColor)) + end + backdrop:SetBackdropBorderColor(unpack(color)) + end + end end do - local PermoksAccountManagerEvents = { - 'CHAT_MSG_PARTY', - 'CHAT_MSG_PARTY_LEADER', - 'CHAT_MSG_GUILD' - } - - --- Initialization called on ADDON_LOADED - function PermoksAccountManager:OnInitialize() - self.spairs = spairs - self.isBC = WOW_PROJECT_ID == WOW_PROJECT_WRATH_CLASSIC - self.isWOTLK = WOW_PROJECT_ID == WOW_PROJECT_WRATH_CLASSIC - self.isCata = WOW_PROJECT_ID == WOW_PROJECT_CATACLYSM_CLASSIC - self.isRetail = WOW_PROJECT_ID == WOW_PROJECT_MAINLINE - - -- init databroker - self.db = LibStub('AceDB-3.0'):New('PermoksAccountManagerDB', defaultDB, true) - PermoksAccountManager:RegisterChatCommand('pam', 'HandleChatCommand') - PermoksAccountManager:HandleSecretPsst() - LibIcon:Register('PermoksAccountManager', PermoksAccountManagerLDB, self.db.profile.minimap) - - PermoksAccountManager:CreateFrames() - self.managerFrame:RegisterEvent('PLAYER_ENTERING_WORLD') - self.managerFrame:SetScript( - 'OnEvent', - function(self, event, arg1, arg2) - if event == 'PLAYER_ENTERING_WORLD' then - if arg1 or arg2 then - PermoksAccountManager:OnLogin() - if not PermoksAccountManager.isBC then - FrameUtil.RegisterFrameForEvents(self, PermoksAccountManagerEvents) - end - end - else - if arg1 then - arg1 = arg1:lower() - local start, ending = arg1:find('^!allkeys') - if start then - PermoksAccountManager:PostKeysIntoChat(event == 'CHAT_MSG_GUILD' and 'guild' or 'party', arg1, ending) - end - end - end - end - ) - end - - --- Not used right now. - function PermoksAccountManager:OnEnable() - end - - --- Not used right now. - function PermoksAccountManager:OnDisable() - end + local PermoksAccountManagerEvents = { + "CHAT_MSG_PARTY", + "CHAT_MSG_PARTY_LEADER", + "CHAT_MSG_GUILD", + } + + --- Initialization called on ADDON_LOADED + function PermoksAccountManager:OnInitialize() + self.spairs = spairs + self.isBC = WOW_PROJECT_ID == WOW_PROJECT_WRATH_CLASSIC + self.isWOTLK = WOW_PROJECT_ID == WOW_PROJECT_WRATH_CLASSIC + self.isCata = WOW_PROJECT_ID == WOW_PROJECT_CATACLYSM_CLASSIC + self.isMists = WOW_PROJECT_ID == WOW_PROJECT_MISTS_CLASSIC + self.isRetail = WOW_PROJECT_ID == WOW_PROJECT_MAINLINE + + -- init databroker + self.db = LibStub("AceDB-3.0"):New("PermoksAccountManagerDB", defaultDB, true) + PermoksAccountManager:RegisterChatCommand("pam", "HandleChatCommand") + PermoksAccountManager:HandleSecretPsst() + LibIcon:Register("PermoksAccountManager", PermoksAccountManagerLDB, self.db.profile.minimap) + + PermoksAccountManager:CreateFrames() + self.managerFrame:RegisterEvent("PLAYER_ENTERING_WORLD") + self.managerFrame:SetScript("OnEvent", function(self, event, arg1, arg2) + if event == "PLAYER_ENTERING_WORLD" then + if arg1 or arg2 then + PermoksAccountManager:OnLogin() + if not PermoksAccountManager.isBC then + FrameUtil.RegisterFrameForEvents(self, PermoksAccountManagerEvents) + end + end + else + if arg1 and not issecretvalue(arg1) then + arg1 = arg1:lower() + local start, ending = arg1:find("^!allkeys") + if start then + PermoksAccountManager:PostKeysIntoChat( + event == "CHAT_MSG_GUILD" and "guild" or "party", + arg1, + ending + ) + end + end + end + end) + end + + --- Not used right now. + function PermoksAccountManager:OnEnable() end + + --- Not used right now. + function PermoksAccountManager:OnDisable() end end function PermoksAccountManager:Debug(...) - if self.db.global.options.debug then - self:Print(...) - end + if self.db.global.options.debug then + self:Print(...) + end end function PermoksAccountManager:CreateFrames() - local options = self.db.global.options - - local managerFrame = CreateFrame('Frame', 'PermoksAccountManagerFrame', UIParent) - self.managerFrame = managerFrame - managerFrame:SetFrameStrata(options.other.frameStrata) - managerFrame:ClearAllPoints() - managerFrame:Hide() - tinsert(UISpecialFrames, 'PermoksAccountManagerFrame') - - -- Restore saved position - if options.savePosition then - local position = self.db.global.position - managerFrame:SetPoint(position.point or 'TOP', WorldFrame, position.relativePoint or 'TOP', position.xOffset or 0, position.yOffset or -300) - else - managerFrame:SetPoint('TOPLEFT', WorldFrame, 'TOPLEFT', WorldFrame:GetWidth() / 3, -300) - end - - local managerFrameBackdrop = CreateFrame('Frame', nil, managerFrame, 'BackdropTemplate') - managerFrame.backdrop = managerFrameBackdrop - self:UpdateBorder(managerFrameBackdrop, managerFrame, true) - - managerFrame.labelColumn = CreateFrame('Button', nil, managerFrame) - managerFrame.labelColumn:SetPoint('TOPLEFT', managerFrame, 'TOPLEFT', 0, -5) - managerFrame.labelColumn:SetPoint('BOTTOMRIGHT', managerFrame, 'BOTTOMLEFT', 140, 0) - managerFrame.altColumns = {general = {}} - managerFrame.warbandColumns = {} - - managerFrame.topDragBar = CreateFrame('Frame', nil, managerFrame, 'BackdropTemplate') - managerFrame.topDragBar:ClearAllPoints() - managerFrame.topDragBar:SetHeight(40) - managerFrame.topDragBar:SetPoint('BOTTOMLEFT', managerFrame, 'TOPLEFT', -5, 0) - managerFrame.topDragBar:SetPoint('BOTTOMRIGHT', managerFrame, 'TOPRIGHT', 5, 0) - managerFrame.topDragBar:EnableMouse(true) - managerFrame.topDragBar:RegisterForDrag('LeftButton') - managerFrame.topDragBar:SetScript( - 'OnDragStart', - function(self, button) - managerFrame:SetMovable(true) - managerFrame:StartMoving() - end - ) - managerFrame.topDragBar:SetScript( - 'OnDragStop', - function(self, button) - managerFrame:StopMovingOrSizing() - - managerFrame:ClearAllPoints() - managerFrame:SetPoint('TOPLEFT', UIParent, 'TOPLEFT', managerFrame:GetLeft(), managerFrame:GetTop() - UIParent:GetTop()) - - managerFrame:SetMovable(false) - end - ) - self:UpdateBorder(managerFrame.topDragBar, nil, true) - - local categoryFrame = CreateFrame('Frame', nil, managerFrame) - self.categoryFrame = categoryFrame - managerFrame.categoryFrame = categoryFrame - categoryFrame:SetPoint('TOPLEFT', managerFrame, 'BOTTOMLEFT', 0, -12) - categoryFrame:SetPoint('TOPRIGHT', managerFrame, 'BOTTOMRIGHT', 0, -12) - - local cLabelColumn = CreateFrame('Frame', nil, categoryFrame) - categoryFrame.labelColumn = cLabelColumn - cLabelColumn.categories = {} - cLabelColumn:SetPoint('TOPLEFT', categoryFrame, 'TOPLEFT', 0, -5) - cLabelColumn:SetPoint('BOTTOMRIGHT', categoryFrame, 'BOTTOMLEFT', 140, 0) - categoryFrame.altColumns = {} - - local categoryFrameBackdrop = CreateFrame('Frame', nil, categoryFrame, 'BackdropTemplate') - categoryFrame.backdrop = categoryFrameBackdrop - self:UpdateBorder(categoryFrameBackdrop, categoryFrame, true) - categoryFrame:Hide() - - return managerFrame + local options = self.db.global.options + + local managerFrame = CreateFrame("Frame", "PermoksAccountManagerFrame", UIParent) + self.managerFrame = managerFrame + managerFrame:SetFrameStrata(options.other.frameStrata) + managerFrame:ClearAllPoints() + managerFrame:Hide() + tinsert(UISpecialFrames, "PermoksAccountManagerFrame") + + -- Restore saved position + if options.savePosition then + local position = self.db.global.position + managerFrame:SetPoint( + position.point or "TOP", + WorldFrame, + position.relativePoint or "TOP", + position.xOffset or 0, + position.yOffset or -300 + ) + else + managerFrame:SetPoint("TOPLEFT", WorldFrame, "TOPLEFT", WorldFrame:GetWidth() / 3, -300) + end + + local managerFrameBackdrop = CreateFrame("Frame", nil, managerFrame, "BackdropTemplate") + managerFrame.backdrop = managerFrameBackdrop + self:UpdateBorder(managerFrameBackdrop, managerFrame, true) + + managerFrame.labelColumn = CreateFrame("Button", nil, managerFrame) + managerFrame.labelColumn:SetPoint("TOPLEFT", managerFrame, "TOPLEFT", 0, -5) + managerFrame.labelColumn:SetPoint("BOTTOMRIGHT", managerFrame, "BOTTOMLEFT", 140, 0) + managerFrame.altColumns = { general = {} } + managerFrame.warbandColumns = {} + + managerFrame.topDragBar = CreateFrame("Frame", nil, managerFrame, "BackdropTemplate") + managerFrame.topDragBar:ClearAllPoints() + managerFrame.topDragBar:SetHeight(40) + managerFrame.topDragBar:SetPoint("BOTTOMLEFT", managerFrame, "TOPLEFT", -5, 0) + managerFrame.topDragBar:SetPoint("BOTTOMRIGHT", managerFrame, "TOPRIGHT", 5, 0) + managerFrame.topDragBar:EnableMouse(true) + managerFrame.topDragBar:RegisterForDrag("LeftButton") + managerFrame.topDragBar:SetScript("OnDragStart", function(self, button) + managerFrame:SetMovable(true) + managerFrame:StartMoving() + end) + managerFrame.topDragBar:SetScript("OnDragStop", function(self, button) + managerFrame:StopMovingOrSizing() + + local left = managerFrame:GetLeft() + local top = managerFrame:GetTop() + + managerFrame:ClearAllPoints() + managerFrame:SetPoint("TOPLEFT", UIParent, "TOPLEFT", left, top - UIParent:GetTop()) + + managerFrame:SetMovable(false) + end) + self:UpdateBorder(managerFrame.topDragBar, nil, true) + + local categoryFrame = CreateFrame("Frame", nil, managerFrame) + self.categoryFrame = categoryFrame + managerFrame.categoryFrame = categoryFrame + categoryFrame:SetPoint("TOPLEFT", managerFrame, "BOTTOMLEFT", 0, -12) + categoryFrame:SetPoint("TOPRIGHT", managerFrame, "BOTTOMRIGHT", 0, -12) + + local cLabelColumn = CreateFrame("Frame", nil, categoryFrame) + categoryFrame.labelColumn = cLabelColumn + cLabelColumn.categories = {} + cLabelColumn:SetPoint("TOPLEFT", categoryFrame, "TOPLEFT", 0, -5) + cLabelColumn:SetPoint("BOTTOMRIGHT", categoryFrame, "BOTTOMLEFT", 140, 0) + categoryFrame.altColumns = {} + + local categoryFrameBackdrop = CreateFrame("Frame", nil, categoryFrame, "BackdropTemplate") + categoryFrame.backdrop = categoryFrameBackdrop + self:UpdateBorder(categoryFrameBackdrop, categoryFrame, true) + categoryFrame:Hide() + + return managerFrame end function PermoksAccountManager:CreateMenuButtons() - local managerFrame = self.managerFrame - - ------------------- - -- Close Button - local closeButton = CreateFrame('Button', nil, managerFrame.topDragBar) - managerFrame.closeButton = closeButton - closeButton:ClearAllPoints() - closeButton:SetSize(20, 20) - closeButton:SetPoint('RIGHT', managerFrame.topDragBar, 'RIGHT', -10, 0) - closeButton:SetScript( - 'OnClick', - function() - PermoksAccountManager:HideInterface() - end - ) - closeButton:SetNormalTexture('Interface/Addons/PermoksAccountManager/textures/testbutton.tga') - closeButton:SetHighlightAtlas('auctionhouse-nav-button-highlight') - - local closeButtonTexture = closeButton:CreateTexture(nil, 'OVERLAY') - closeButton.x = closeButtonTexture - closeButtonTexture:SetAllPoints() - closeButtonTexture:SetTexture('Interface/Addons/PermoksAccountManager/textures/testbuttonx.tga') - closeButtonTexture:SetVertexColor(2, 2, 2, 1) - closeButton:SetScript( - 'OnMouseDown', - function() - closeButtonTexture:AdjustPointsOffset(1, -1) - end - ) - closeButton:SetScript( - 'OnMouseUp', - function() - closeButtonTexture:AdjustPointsOffset(-1, 1) - end - ) - - ------------------- - -- Guild Attunement Button - if self.isBC then - local guildAttunementButton = CreateFrame('Button', nil, managerFrame, 'UIPanelButtonTemplate') - managerFrame.guildAttunementButton = guildAttunementButton - guildAttunementButton:SetSize(80, 20) - guildAttunementButton:ClearAllPoints() - guildAttunementButton:SetPoint('BOTTOMLEFT', managerFrame, 'BOTTOMLEFT', -85, -5) - guildAttunementButton:SetText('Attunement') - guildAttunementButton:SetScript('OnClick', PermoksAccountManager.ShowGuildAttunements) - end + local managerFrame = self.managerFrame + + ------------------- + -- Close Button + local closeButton = CreateFrame("Button", "PAM_CloseButton", managerFrame.topDragBar) + managerFrame.closeButton = closeButton + closeButton:ClearAllPoints() + closeButton:SetSize(20, 20) + closeButton:SetPoint("RIGHT", managerFrame.topDragBar, "RIGHT", -10, 0) + closeButton:SetScript("OnClick", function() + PermoksAccountManager:HideInterface() + end) + closeButton:SetNormalTexture("Interface/Addons/PermoksAccountManager/textures/testbutton.tga") + closeButton:SetHighlightAtlas("auctionhouse-nav-button-highlight") + + local closeButtonTexture = closeButton:CreateTexture(nil, "OVERLAY") + closeButton.x = closeButtonTexture + closeButtonTexture:SetAllPoints() + closeButtonTexture:SetTexture("Interface/Addons/PermoksAccountManager/textures/testbuttonx.tga") + closeButtonTexture:SetVertexColor(2, 2, 2, 1) + closeButton:SetScript("OnMouseDown", function() + closeButtonTexture:AdjustPointsOffset(1, -1) + end) + closeButton:SetScript("OnMouseUp", function() + closeButtonTexture:AdjustPointsOffset(-1, 1) + end) + + ------------------- + -- Guild Attunement Button + if self.isBC then + local guildAttunementButton = CreateFrame("Button", nil, managerFrame, "UIPanelButtonTemplate") + managerFrame.guildAttunementButton = guildAttunementButton + guildAttunementButton:SetSize(80, 20) + guildAttunementButton:ClearAllPoints() + guildAttunementButton:SetPoint("BOTTOMLEFT", managerFrame, "BOTTOMLEFT", -85, -5) + guildAttunementButton:SetText("Attunement") + guildAttunementButton:SetScript("OnClick", PermoksAccountManager.ShowGuildAttunements) + end end function PermoksAccountManager:CreateResetTimers() - local weeklyResetTime = self:GetNextWeeklyResetTime() - local dailyResetTime = self:GetNextDailyResetTime() - - C_Timer.After( - weeklyResetTime, - function() - self:CheckForReset() - end - ) - - if dailyResetTime < weeklyResetTime then - C_Timer.After( - dailyResetTime, - function() - self:CheckForReset() - end - ) - end - - if self.isCata then - local threeDayResetTime = self:GetNextThreeDayLockoutResetTime() - if threeDayResetTime then - C_Timer.After( - threeDayResetTime, - function() - self:CheckForReset() - end - ) - end - end + local weeklyResetTime = self:GetNextWeeklyResetTime() + local dailyResetTime = self:GetNextDailyResetTime() + + C_Timer.After(weeklyResetTime, function() + self:CheckForReset() + end) + + if dailyResetTime < weeklyResetTime then + C_Timer.After(dailyResetTime, function() + self:CheckForReset() + end) + end + + if self.isCata then + local threeDayResetTime = self:GetNextThreeDayLockoutResetTime() + if threeDayResetTime then + C_Timer.After(threeDayResetTime, function() + self:CheckForReset() + end) + end + end +end + +function PermoksAccountManager:ResetQuestCompletion(labelRow, ...) + local db = self.db.global + local accountData = db.accounts.main + local warbandData = db.accounts.main.warbandData + + local questIDs = false + local questType = self.labelRows[labelRow].questType + local visibility = self.labelRows[labelRow].visibility + + -- optional arguments in form of quest IDs can be passed if only specific quests are to be removed + if select("#", ...) > 0 then + questIDs = { ... } + end + + -- Helper function to process questInfo tables + local function processQuestInfo(questInfo) + if questInfo and questInfo[questType] and questInfo[questType][visibility] then + if not questInfo[questType][visibility][labelRow] then + questInfo[questType][visibility][labelRow] = {} + end + + if questIDs then + for _, quest in ipairs(questIDs) do + questInfo[questType][visibility][labelRow][quest] = nil + end + else + questInfo[questType][visibility][labelRow] = {} + end + end + end + + -- Process account data + for _, alt_data in pairs(accountData.data) do + processQuestInfo(alt_data.questInfo) + end + + -- Process warband data + processQuestInfo(warbandData.questInfo) end function PermoksAccountManager:CheckForModernize() - if self.isCata then - local internalVersion = self.db.global.internalCataVersion - if not internalVersion or internalVersion < INTERNALCATAVERSION then - --self:ModernizeWOTLK(internalVersion) - self:ModernizeCata(internalVersion) - end - self.db.global.internalCataVersion = INTERNALCATAVERSION - else - local internalVersion = self.db.global.internalVersion or INTERNALVERSION - if internalVersion < INTERNALVERSION then - self:Modernize(internalVersion) - end - self.db.global.internalVersion = INTERNALVERSION - end + if self.isCata then + local internalVersion = self.db.global.internalCataVersion + if not internalVersion or internalVersion < INTERNALCATAVERSION then + self:ModernizeCata(internalVersion) + end + self.db.global.internalCataVersion = INTERNALCATAVERSION + elseif self.isMists then + local internalVersion = self.db.global.internalMistsVersion + if not internalVersion or internalVersion < INTERNALMISTSVERSION then + self:ModernizeMists(internalVersion) + end + self.db.global.internalMistsVersion = INTERNALMISTSVERSION + else + local internalVersion = self.db.global.internalTWWVersion + if (internalVersion or 0) < INTERNALMIDNIGHT then + self:Modernize(internalVersion) + end + self.db.global.internalTWWVersion = INTERNALMIDNIGHT + end +end + +function PermoksAccountManager:ModernizeMists(oldInternalVersion) + local db = self.db + + if (oldInternalVersion or 0) < 2 then + self:ResetCategories() + oldInternalVersion = 1 + end end function PermoksAccountManager:ModernizeCata(oldInternalVersion) - local db = self.db + local db = self.db - if (oldInternalVersion or 0) < 2 then - self:UpdateDefaultCategories('general') - oldInternalVersion = 1 - end + if (oldInternalVersion or 0) < 2 then + self:UpdateDefaultCategories("general") + oldInternalVersion = 1 + end - if (oldInternalVersion or 0) < 3 then - self:UpdateDefaultCategories('general') - self:UpdateDefaultCategories('sharedFactions') - self:UpdateDefaultCategories('lockouts') - self:UpdateDefaultCategories('consumables') - self:UpdateDefaultCategories('items') - self:UpdateDefaultCategories('dailies') - end + if (oldInternalVersion or 0) < 3 then + self:UpdateDefaultCategories("general") + self:UpdateDefaultCategories("sharedFactions") + self:UpdateDefaultCategories("lockouts") + self:UpdateDefaultCategories("consumables") + self:UpdateDefaultCategories("items") + self:UpdateDefaultCategories("dailies") + end end function PermoksAccountManager:ModernizeWOTLK(oldInternalVersion) - local db = self.db - - if (oldInternalVersion or 0) < 2 then - self:UpdateDefaultCategories('general') - self:UpdateDefaultCategories('lockouts') - self:UpdateDefaultCategories('dailies') - self:UpdateDefaultCategories('consumables') - oldInternalVersion = 2 - end - - if oldInternalVersion < 3 then - self:UpdateDefaultCategories('consumables') - self:UpdateDefaultCategories('items') - oldInternalVersion = 3 - end - - if oldInternalVersion < 4 then - self:AddLabelToDefaultCategory('sharedFactions', 'the_ashen_verdict') - self:UpdateDefaultCategories('lockouts') - self:UpdateDefaultCategories('items') - oldInternalVersion = 4 - end - - if oldInternalVersion < 5 then - self:AddLabelToDefaultCategory('general', 'defilers_scourgestone') - end - - if oldInternalVersion < 6 then - self:UpdateDefaultCategories('dailies') - end + local db = self.db + + if (oldInternalVersion or 0) < 2 then + self:UpdateDefaultCategories("general") + self:UpdateDefaultCategories("lockouts") + self:UpdateDefaultCategories("dailies") + self:UpdateDefaultCategories("consumables") + oldInternalVersion = 2 + end + + if oldInternalVersion < 3 then + self:UpdateDefaultCategories("consumables") + self:UpdateDefaultCategories("items") + oldInternalVersion = 3 + end + + if oldInternalVersion < 4 then + self:AddLabelToDefaultCategory("sharedFactions", "the_ashen_verdict") + self:UpdateDefaultCategories("lockouts") + self:UpdateDefaultCategories("items") + oldInternalVersion = 4 + end + + if oldInternalVersion < 5 then + self:AddLabelToDefaultCategory("general", "defilers_scourgestone") + end + + if oldInternalVersion < 6 then + self:UpdateDefaultCategories("dailies") + end end function PermoksAccountManager:Modernize(oldInternalVersion) - local db = self.db - - if (oldInternalVersion or 0) < 2 then - self:UpdateDefaultCategories('currentdaily') - oldInternalVersion = 2 - end - - if oldInternalVersion < 3 then - for _, accountInfo in pairs(db.global.accounts) do - for _, altData in pairs(accountInfo.data) do - altData.sanctumInfo = nil - end - end - oldInternalVersion = 3 - end - - if oldInternalVersion < 4 then - db.global.options.buttons.widthPerAlt = db.global.options.other.widthPerAlt or 120 - oldInternalVersion = 4 - end - - if oldInternalVersion < 5 then - self:AddLabelToDefaultCategory('general', 'tw_keystone', 5.1) - - local sortKey = self.isBC and 'charLevel' or 'ilevel' - if true then - return - end - for _, accountInfo in pairs(db.global.accounts) do - local order = 1 - for _, altData in self.spairs( - accountInfo.data, - function(t, a, b) - if t[a] and t[b] then - if t[a].order and t[b].order then - return t[a].order < t[b].order - end - return t[a][sortKey] > t[b][sortKey] - end - end - ) do - altData.order = order - order = order + 1 - end - end - oldInternalVersion = 5 - end - - if oldInternalVersion < 7 then - for _, accountInfo in pairs(db.global.accounts) do - for _, altData in pairs(accountInfo.data) do - altData.instanceInfo = nil - end - end - self:Print("Reset instance info for every character.") - oldInternalVersion = 7 - end - - if oldInternalVersion < 26 then - self:UpdateDefaultCategories('currentweekly') - self:UpdateDefaultCategories('currentdaily') - self:UpdateDefaultCategories('general') - self:UpdateDefaultCategories('renown') - self:AddLabelToDefaultCategory('raid', 'aberrus_the_shadowed_crucible') - self:AddLabelToDefaultCategory('raid', 'amirdrassil_the_dreams_hope') - end - - if oldInternalVersion < 27 then - self:AddLabelToDefaultCategory('currentweekly', 'dream_shipments', 4) - end - - if oldInternalVersion < 28 then - self:AddLabelToDefaultCategory('currentweekly', 'dream_shipments', 4) - end - - if oldInternalVersion < 29 then - self:AddLabelToDefaultCategory('general', 'dream_infusion') - self:AddLabelToDefaultCategory('currentweekly', 'sparks_of_life', 5) - end - - if oldInternalVersion < 30 then - self:AddLabelToDefaultCategory('currentweekly', 'dreamsurge_weekly', 13) - self:AddLabelToDefaultCategory('currentweekly', 'time_rift', 14) - end - - if oldInternalVersion < 31 then - self:AddLabelToDefaultCategory('currentweekly', 'time_rift_pod', 15) - end - - if oldInternalVersion < 32 then - self:AddLabelToDefaultCategory('vault', 'great_vault_reward_available') - end - - if oldInternalVersion < 33 then - self:AddLabelToDefaultCategory('general', 'whelpling_crest_s4') - self:AddLabelToDefaultCategory('general', 'drake_crest_s4') - self:AddLabelToDefaultCategory('general', 'wyrm_crest_s4') - self:AddLabelToDefaultCategory('general', 'aspect_crest_s4') - self:AddLabelToDefaultCategory('general', 'spark_awakening', 15) - self:AddLabelToDefaultCategory('renown', 'keg_legs_crew', 7) - self:AddLabelToDefaultCategory('renown', 'soridormi', 16) - end - - if oldInternalVersion < 34 then - self:AddLabelToDefaultCategory('general', 'residual_memories') - self:AddLabelToDefaultCategory('general', 'radiant_echoes_prepatch_weeklies') - end + local db = self.db + + if not oldInternalVersion then + self:ResetCategories() + oldInternalVersion = 1 + end + + if oldInternalVersion < 2 then + self:AddLabelToDefaultCategory("general", "adventurer_crest", 7.5) + oldInternalVersion = 2 + end end function PermoksAccountManager:GetGUID() - self.myGUID = self.myGUID or UnitGUID('player') - return self.myGUID + self.myGUID = self.myGUID or UnitGUID("player") + return self.myGUID end local function SortPages(pages) - local options = PermoksAccountManager.db.global.options - local sortBy = options.characters.sortBy - local sortByLesser = options.characters.sortByLesser - local GUID = PermoksAccountManager:GetGUID() - - table.sort( - pages, - function(a, b) - if options.currentCharacterFirstPosition then - if a.guid == GUID then - return true - elseif b.guid == GUID then - return false - end - end - - local ta = a[sortBy] - local tb = b[sortBy] - if sortByLesser then - return ta < tb or (ta == tb and a.name < b.name) - else - return ta > tb or (ta == tb and a.name < b.name) - end - end - ) - - local perPage = options.characters.charactersPerPage - local finalPages = {{}} - for i, altData in ipairs(pages) do - local page = ceil(i / perPage) - finalPages[page] = finalPages[page] or {} - - tinsert(finalPages[page], altData) - altData.page = page - end - return finalPages + local options = PermoksAccountManager.db.global.options + local sortBy = options.characters.sortBy + local sortByLesser = options.characters.sortByLesser + local GUID = PermoksAccountManager:GetGUID() + + table.sort(pages, function(a, b) + if options.currentCharacterFirstPosition then + if a.guid == GUID then + return true + elseif b.guid == GUID then + return false + end + end + + local ta = a[sortBy] + local tb = b[sortBy] + if sortByLesser then + return ta < tb or (ta == tb and a.name < b.name) + else + return ta > tb or (ta == tb and a.name < b.name) + end + end) + + local perPage = options.characters.charactersPerPage + local finalPages = { {} } + for i, altData in ipairs(pages) do + local page = ceil(i / perPage) + finalPages[page] = finalPages[page] or {} + + tinsert(finalPages[page], altData) + altData.page = page + end + return finalPages end local function GetCharacterOrders(pages, data, enabledAlts, accountName) - local db = PermoksAccountManager.db.global - local sortBy = db.options.characters.sortBy - local sortByLesser = db.options.characters.sortByLesser - local default = sortBy == 'order' and 100 or 1 - - local enabledAlts = enabledAlts or 1 - for alt_guid, alt_data in PermoksAccountManager.spairs( - data, - function(t, a, b) - if t[a] and t[b] then - local ta = t[a][sortBy] or default - local tb = t[b][sortBy] or default - - if sortByLesser then - return ta < tb or (ta == tb and t[a].name < t[b].name) - else - return ta > tb or (ta == tb and t[a].name < t[b].name) - end - end - end - ) do - if not PermoksAccountManager.db.global.blacklist[alt_guid] then - alt_data.order = alt_data.order or enabledAlts - tinsert(pages, alt_data) - PermoksAccountManager:AddCharacterToOrderOptions(alt_guid, alt_data, accountName) - enabledAlts = enabledAlts + 1 - end - end - return enabledAlts + local db = PermoksAccountManager.db.global + local sortBy = db.options.characters.sortBy + local sortByLesser = db.options.characters.sortByLesser + local default = sortBy == "order" and 100 or 1 + + local enabledAlts = enabledAlts or 1 + for alt_guid, alt_data in + PermoksAccountManager.spairs(data, function(t, a, b) + if t[a] and t[b] then + local ta = t[a][sortBy] or default + local tb = t[b][sortBy] or default + + if t[a].name and t[b].name then + if sortByLesser then + return ta < tb or (ta == tb and t[a].name < t[b].name) + else + return ta > tb or (ta == tb and t[a].name < t[b].name) + end + end + end + end) + do + if not PermoksAccountManager.db.global.blacklist[alt_guid] and alt_data.name then + alt_data.order = alt_data.order or enabledAlts + tinsert(pages, alt_data) + PermoksAccountManager:AddCharacterToOrderOptions(alt_guid, alt_data, accountName) + enabledAlts = enabledAlts + 1 + end + end + return enabledAlts end function PermoksAccountManager:SortPages() - local db = self.db.global - - if db.options.characters.combine then - local dummyPages = {} - local enabledAlts - for accountName, accountInfo in PermoksAccountManager.spairs( - db.accounts, - function(_, a, b) - if a == 'main' or b == 'main' then - return a > b - else - return a < b - end - end - ) do - enabledAlts = GetCharacterOrders(dummyPages, accountInfo.data, enabledAlts, accountName) - - if accountName == 'main' then - db.accounts.main.pages = SortPages(dummyPages) - end - end - self.pages = SortPages(dummyPages) - else - local dummyPages = {} - GetCharacterOrders(dummyPages, db.accounts.main.data, nil, 'main') - - db.accounts.main.pages = SortPages(dummyPages) - self.pages = db.accounts.main.pages - end - - self.db.global.currentPage = min(self.db.global.currentPage, #self.pages) + local db = self.db.global + + if db.options.characters.combine then + local dummyPages = {} + local enabledAlts + for accountName, accountInfo in + PermoksAccountManager.spairs(db.accounts, function(_, a, b) + if a == "main" or b == "main" then + return a > b + else + return a < b + end + end) + do + enabledAlts = GetCharacterOrders(dummyPages, accountInfo.data, enabledAlts, accountName) + + if accountName == "main" then + db.accounts.main.pages = SortPages(dummyPages) + end + end + self.pages = SortPages(dummyPages) + else + local dummyPages = {} + GetCharacterOrders(dummyPages, db.accounts.main.data, nil, "main") + + db.accounts.main.pages = SortPages(dummyPages) + self.pages = db.accounts.main.pages + end + + self.db.global.currentPage = min(self.db.global.currentPage, #self.pages) end function PermoksAccountManager:AddNewCharacter(account, guid) - local data = account.data - data[guid] = {guid = guid} + local data = account.data + data[guid] = { guid = guid } - local charInfo = data[guid] - local _, class = UnitClass('player') - charInfo.class = class - charInfo.faction = UnitFactionGroup('player') + local charInfo = data[guid] + local _, class = UnitClass("player") + charInfo.class = class + charInfo.faction = UnitFactionGroup("player") - local name, realm = UnitFullName('player') - charInfo.name = name - charInfo.realm = realm - charInfo.order = self.db.global.alts + local name, realm = UnitFullName("player") + charInfo.name = name + charInfo.realm = realm + charInfo.order = self.db.global.alts - charInfo.charLevel = UnitLevel('player') + charInfo.charLevel = UnitLevel("player") end function PermoksAccountManager:SaveBattleTag(db) - if not db.battleTag then - local _, battleTag = BNGetInfo() - db.battleTag = battleTag - end + if not db.battleTag then + local _, battleTag = BNGetInfo() + db.battleTag = battleTag + end end function PermoksAccountManager:OnLogin() - local db = self.db.global - local guid = self:GetGUID() - local level = UnitLevel('player') - local min_level = db.options.characters.minLevel - - self.elvui = C_AddOns.IsAddOnLoaded('ElvUI') - self.ElvUI_Skins = self.elvui and ElvUI[1]:GetModule('Skins') - self:SaveBattleTag(db) - self:CheckForModernize() - self:CheckForReset() - LoadFonts() - - self.account = db.accounts.main - local data = self.account.data - if guid and not data[guid] and not self:isBlacklisted(guid) and not (level < min_level) then - db.alts = db.alts + 1 - self:AddNewCharacter(self.account, guid) - end - - self.charInfo = data[guid] - self:LoadAllModules(self.charInfo) - if self.charInfo then - self:RequestCharacterInfo() - self:UpdateCompletionData() - end - - db.currentPage = 1 - self:LoadOptionsTemplate() - self:SortPages() - self:LoadCustomLabelButtons() - self:LoadCustomLabelTable() - self.LoadOptions() - self:CreateResetTimers() - - self:UpdateAccounts() + local db = self.db.global + local guid = self:GetGUID() + local level = UnitLevel("player") + local min_level = db.options.characters.minLevel + + self.elvui = C_AddOns.IsAddOnLoaded("ElvUI") + self.ElvUI_Skins = self.elvui and ElvUI[1]:GetModule("Skins") + self:SaveBattleTag(db) + self:CheckForModernize() + self:CheckForReset() + LoadFonts() + + self.account = db.accounts.main + self.warbandData = db.accounts.main.warbandData + local data = self.account.data + + if + guid + and (not data[guid] or not data[guid].name) + and not self:isBlacklisted(guid) + and not (level < min_level) + then + db.alts = db.alts + 1 + self:AddNewCharacter(self.account, guid) + end + + self.charInfo = data[guid] + self:LoadAllModules(self.charInfo) + if self.charInfo then + self:RequestCharacterInfo() + self:UpdateCompletionData() + end + + db.currentPage = 1 + self:LoadOptionsTemplate() + self:SortPages() + self:LoadCustomLabelButtons() + self:LoadCustomLabelTable() + self.LoadOptions() + self:CreateResetTimers() + + self:UpdateAccounts() end function PermoksAccountManager:SkinButtonElvUI(button) - if not self.elvui then - return - end + if not self.elvui then + return + end - self.ElvUI_Skins:HandleButton(button) + self.ElvUI_Skins:HandleButton(button) end function PermoksAccountManager:GetSecondsRemaining(expirationTime) - if expirationTime == 0 then - return 0 - end - return expirationTime - time() + if expirationTime == 0 then + return 0 + end + return expirationTime - time() end -- TODO: Completion Data function PermoksAccountManager:CheckForReset() - local db = self.db.global - local currentTime = time() - local resetDaily = currentTime >= (db.dailyReset or 0) - local resetWeekly = currentTime >= (db.weeklyReset or 0) - local resetBiweekly = currentTime >= (db.biweeklyReset or 0) - local resetThreeDayRaids = currentTime >= (db.threeDayReset or 0) - wipe(db.completionData) - - for account, accountData in pairs(db.accounts) do - self:ResetAccount(db, accountData, resetDaily, resetWeekly, resetBiweekly, resetThreeDayRaids) - end - - db.weeklyReset = resetWeekly and currentTime + self:GetNextWeeklyResetTime() or db.weeklyReset - db.dailyReset = resetDaily and currentTime + self:GetNextDailyResetTime() or db.dailyReset - db.biweeklyReset = resetBiweekly and currentTime + self:GetNextBiWeeklyResetTime() or db.biweeklyReset - if self.isCata then - db.threeDayReset = resetThreeDayRaids and currentTime + self:GetNextThreeDayLockoutResetTime() or db.threeDayReset - end + local db = self.db.global + local currentTime = time() + local resetDaily = currentTime >= (db.dailyReset or 0) + local resetWeekly = currentTime >= (db.weeklyReset or 0) + local resetBiweekly = currentTime >= (db.biweeklyReset or 0) + local resetThreeDayRaids = currentTime >= (db.threeDayReset or 0) + wipe(db.completionData) + + for account, accountData in pairs(db.accounts) do + self:ResetAccount(db, accountData, resetDaily, resetWeekly, resetBiweekly, resetThreeDayRaids) + end + + db.weeklyReset = resetWeekly and currentTime + self:GetNextWeeklyResetTime() or db.weeklyReset + db.dailyReset = resetDaily and currentTime + self:GetNextDailyResetTime() or db.dailyReset + db.biweeklyReset = resetBiweekly and currentTime + self:GetNextBiWeeklyResetTime() or db.biweeklyReset + if self.isCata then + db.threeDayReset = resetThreeDayRaids and currentTime + self:GetNextThreeDayLockoutResetTime() + or db.threeDayReset + end end function PermoksAccountManager:ResetAccount(db, accountData, daily, weekly, biweekly, resetThreeDayRaids) - for _, altData in pairs(accountData.data) do - if weekly then - self:ResetWeeklyActivities(altData) - end + -- Loop through account data and reset each altData + for _, altData in pairs(accountData.data) do + self:ResetActivities(db, altData, daily, weekly, biweekly, resetThreeDayRaids) + end - if daily then - self:ResetDailyActivities(db, altData) - end + -- Reset warband data + self:ResetActivities(db, accountData.warbandData, daily, weekly, biweekly, false) +end - if biweekly then - self:ResetBiweeklyActivities(altData) - end +function PermoksAccountManager:ResetActivities(db, data, daily, weekly, biweekly, resetThreeDayRaids) + if weekly then + self:ResetWeeklyActivities(data) - if resetThreeDayRaids then - self:ResetThreeDayRaids(altData) - end - end + -- DEBUG LINE DELETE LATER + print("PAM: Weekly activities gracefully reset.") + end + + if daily then + self:ResetDailyActivities(db, data) + end + + if biweekly then + self:ResetBiweeklyActivities(data) + end + + if resetThreeDayRaids then + self:ResetThreeDayRaids(data) + end end function PermoksAccountManager:ResetWeeklyActivities(altData) - -- M0/Raids - if altData.instanceInfo then - -- Store three day raids so they won't get reset here (currently only ZG for WOTLK) - local threeDayResetRaids = altData.instanceInfo.raids['zul_gurub'] or false - altData.instanceInfo.raids = {} - altData.instanceInfo.dungeons = {} - -- Resave after purge if there were any three day raids - if threeDayResetRaids ~= false then - altData.instanceInfo.raids['zul_gurub'] = threeDayResetRaids - end - end - - -- Torghast - if altData.torghastInfo then - wipe(altData.torghastInfo) - end - - -- Vault - if altData.vaultInfo then - wipe(altData.vaultInfo) - end - - if altData.mythicPlusHistory then - wipe(altData.mythicPlusHistory) - end - - altData.raidActivityInfo = {} - - -- M+ - altData.keyInfo = nil - - -- Weekly Quests - if altData.questInfo and altData.questInfo.weekly then - for visibility, quests in pairs(altData.questInfo.weekly) do - altData.questInfo.weekly[visibility] = {} - end - end + if not altData then + return + end + + -- M0/Raids + if altData.instanceInfo then + -- Store three day raids so they won't get reset here (currently only ZG for WOTLK) + local threeDayResetRaids = altData.instanceInfo.raids["zul_gurub"] or false + altData.instanceInfo.raids = {} + altData.instanceInfo.dungeons = {} + -- Resave after purge if there were any three day raids + if threeDayResetRaids ~= false then + altData.instanceInfo.raids["zul_gurub"] = threeDayResetRaids + end + end + + -- Torghast + if altData.torghastInfo then + wipe(altData.torghastInfo) + end + + -- Vault + if altData.vaultInfo then + wipe(altData.vaultInfo) + end + + if altData.mythicPlusHistory then + wipe(altData.mythicPlusHistory) + end + + altData.raidActivityInfo = {} + + -- M+ + altData.keyInfo = nil + + -- Weekly Quests + if altData.questInfo and altData.questInfo.weekly then + for visibility, quests in pairs(altData.questInfo.weekly) do + altData.questInfo.weekly[visibility] = {} + end + end + + if altData.completedWorldQuests then + altData.completedWorldQuests = {} + end -- Crests Earned - if altData.currencyInfo then - for _, crestID in ipairs({2409, 2410, 2411, 2412}) do - if altData.currencyInfo[crestID] then - altData.currencyInfo[crestID].quantity = 0 - end - end - end + if altData.currencyInfo then + -- REFACTOR: move this to the currency module and reduce redundancy + for _, crestID in ipairs({ 2914, 2915, 2916, 2917 }) do + if altData.currencyInfo[crestID] then + altData.currencyInfo[crestID].quantity = 0 + end + end + end end function PermoksAccountManager:ResetDailyActivities(db, altData) - local currentTime = time() - - if altData.completedDailies then - altData.completedDailies = {} - end - - -- Callings - if altData.callingsUnlocked and altData.callingInfo and altData.callingInfo.numCallings and altData.callingInfo.numCallings < 3 then - altData.callingInfo.numCallings = altData.callingInfo.numCallings + 1 - altData.callingInfo[#altData.callingInfo + 1] = currentTime + self:GetNextDailyResetTime() + (86400 * 2) - end - - if altData.covenant and db.currentCallings[altData.covenant] then - for questID, currentCallingInfo in pairs(db.currentCallings[altData.covenant]) do - if currentCallingInfo.timeRemaining and currentCallingInfo.timeRemaining < time() then - db.currentCallings[altData.covenant][questID] = nil - end - end - end - - -- Daily Quests - if altData.questInfo and altData.questInfo.daily then - for visibility, quests in pairs(altData.questInfo.daily) do - altData.questInfo.daily[visibility] = {} - end - end - - if self.isCata and altData.instanceInfo then - altData.instanceInfo.dungeons = {} - end + local currentTime = time() + if not altData then + return + end + + if altData.completedDailies then + altData.completedDailies = {} + end + + -- Callings + if + altData.callingsUnlocked + and altData.callingInfo + and altData.callingInfo.numCallings + and altData.callingInfo.numCallings < 3 + then + altData.callingInfo.numCallings = altData.callingInfo.numCallings + 1 + altData.callingInfo[#altData.callingInfo + 1] = currentTime + self:GetNextDailyResetTime() + (86400 * 2) + end + + if altData.covenant and db.currentCallings[altData.covenant] then + for questID, currentCallingInfo in pairs(db.currentCallings[altData.covenant]) do + if currentCallingInfo.timeRemaining and currentCallingInfo.timeRemaining < time() then + db.currentCallings[altData.covenant][questID] = nil + end + end + end + + -- Daily Quests + if altData.questInfo and altData.questInfo.daily then + for visibility, quests in pairs(altData.questInfo.daily) do + altData.questInfo.daily[visibility] = {} + end + end + + if self.isCata and altData.instanceInfo then + altData.instanceInfo.dungeons = {} + end end function PermoksAccountManager:ResetBiweeklyActivities(altData) - if altData.questInfo and altData.questInfo.biweekly then - for visibility, quests in pairs(altData.questInfo.biweekly) do - altData.questInfo.biweekly[visibility] = {} - end - end + if not altData then + return + end + + if altData.questInfo and altData.questInfo.biweekly then + for visibility, quests in pairs(altData.questInfo.biweekly) do + altData.questInfo.biweekly[visibility] = {} + end + end end function PermoksAccountManager:ResetThreeDayRaids(altData) - if altData.instanceInfo and altData.instanceInfo.raids and altData.instanceInfo.raids['zul_gurub'] then - altData.instanceInfo.raids['zul_gurub'] = nil - end + if not altData then + return + end + + if altData.instanceInfo and altData.instanceInfo.raids and altData.instanceInfo.raids["zul_gurub"] then + altData.instanceInfo.raids["zul_gurub"] = nil + end end function PermoksAccountManager:RequestCharacterInfo() - if not self.isBC and self.isRetail then - RequestRatedInfo() - CovenantCalling_CheckCallings() - end + if not self.isBC and self.isRetail then + RequestRatedInfo() + CovenantCalling_CheckCallings() + end end -- TODO: Rework Completion Data function PermoksAccountManager:UpdateCompletionData() - local db = self.db.global - local accountData = db.accounts.main - for alt_guid, alt_data in pairs(accountData.data) do - for key, info in pairs(self.labelRows) do - if info.isComplete then - self:SaveCompletionData(key, info.isComplete(alt_data), alt_guid) - end - end - end + local db = self.db.global + local accountData = db.accounts.main + for alt_guid, alt_data in pairs(accountData.data) do + for key, info in pairs(self.labelRows) do + if info.isComplete then + self:SaveCompletionData(key, info.isComplete(alt_data), alt_guid) + end + end + end end function PermoksAccountManager:UpdateCompletionDataForCharacter(charInfo) - if not charInfo then - return - end + if not charInfo then + return + end - for key, info in pairs(self.labelRows) do - if info.isComplete then - self:SaveCompletionData(key, info.isComplete(charInfo), charInfo.guid) - end - end + for key, info in pairs(self.labelRows) do + if info.isComplete then + self:SaveCompletionData(key, info.isComplete(charInfo), charInfo.guid) + end + end end function PermoksAccountManager:SaveCompletionData(key, isComplete, guid) - if not guid then - return - end + if not guid then + return + end - if self.labelRows[key] then - local completionData = self.db.global.completionData[key] + if self.labelRows[key] then + local completionData = self.db.global.completionData[key] - if not completionData[guid] then - completionData[guid] = isComplete or nil - completionData.numCompleted = (completionData.numCompleted or 0) + (isComplete and 1 or 0) - end - end + if not completionData[guid] then + completionData[guid] = isComplete or nil + completionData.numCompleted = (completionData.numCompleted or 0) + (isComplete and 1 or 0) + end + end end function PermoksAccountManager:UpdateAccountButtons() - local db = self.db.global - - local managerFrame = self.managerFrame - local accountDropdown = managerFrame.accountDropdown or AceGUI:Create('Dropdown') - if db.options.characters.combine then - accountDropdown.frame:Hide() - return - end - - if not managerFrame.accountDropdown then - managerFrame.accountDropdown = accountDropdown - --accountDropdown:SetLabel('Account') - accountDropdown:SetWidth(120) - accountDropdown:SetPoint('BOTTOMLEFT', managerFrame.topDragBar, 'LEFT', 5, -12) - accountDropdown.frame:SetParent(managerFrame) - accountDropdown:SetCallback( - 'OnValueChanged', - function(_, _, accountKey) - PermoksAccountManager.db.global.currentPage = 1 - - if PermoksAccountManager.managerFrame.pageDropdown then - PermoksAccountManager.managerFrame.pageDropdown:SetValue(1) - end - PermoksAccountManager.account = PermoksAccountManager.db.global.accounts[accountKey] - PermoksAccountManager.pages = PermoksAccountManager.account.pages - PermoksAccountManager:HideAllCategories() - PermoksAccountManager:UpdateWarbandAnchors('general', managerFrame.labelColumn) - PermoksAccountManager:UpdateAltAnchors('general', managerFrame, managerFrame.labelColumn) - PermoksAccountManager:UpdateStrings(1, 'general') - PermoksAccountManager:UpdatePageButtons() - PermoksAccountManager:UpdateManagerFrameSize() - end - ) - end - managerFrame.accountButtons = managerFrame.accountButtons or {} - - local accountList = {} - local accountOrder = {} - for accountName, accountInfo in self.spairs( - db.accounts, - function(t, a, b) - return a == 'main' - end - ) do - accountList[accountName] = accountInfo.name - tinsert(accountOrder, accountName) - end - - accountDropdown:Fire('OnClose') - accountDropdown:SetList(accountList, accountOrder) - accountDropdown:SetValue('main') + local db = self.db.global + + local managerFrame = self.managerFrame + local accountDropdown = managerFrame.accountDropdown or AceGUI:Create("Dropdown") + if db.options.characters.combine then + accountDropdown.frame:Hide() + return + end + + if not managerFrame.accountDropdown then + managerFrame.accountDropdown = accountDropdown + --accountDropdown:SetLabel('Account') + accountDropdown:SetWidth(120) + accountDropdown:SetPoint("BOTTOMLEFT", managerFrame.topDragBar, "LEFT", 5, -12) + accountDropdown.frame:SetParent(managerFrame) + accountDropdown:SetCallback("OnValueChanged", function(_, _, accountKey) + PermoksAccountManager.db.global.currentPage = 1 + + if PermoksAccountManager.managerFrame.pageDropdown then + PermoksAccountManager.managerFrame.pageDropdown:SetValue(1) + end + PermoksAccountManager.account = PermoksAccountManager.db.global.accounts[accountKey] + PermoksAccountManager.pages = PermoksAccountManager.account.pages + PermoksAccountManager:HideAllCategories() + PermoksAccountManager:UpdateWarbandAnchors("general", managerFrame.labelColumn) + PermoksAccountManager:UpdateAltAnchors("general", managerFrame, managerFrame.labelColumn) + PermoksAccountManager:UpdateStrings(1, "general") + PermoksAccountManager:UpdatePageButtons() + PermoksAccountManager:UpdateManagerFrameSize() + end) + end + managerFrame.accountButtons = managerFrame.accountButtons or {} + + local accountList = {} + local accountOrder = {} + for accountName, accountInfo in + self.spairs(db.accounts, function(t, a, b) + return a == "main" + end) + do + accountList[accountName] = accountInfo.name + tinsert(accountOrder, accountName) + end + + accountDropdown:Fire("OnClose") + accountDropdown:SetList(accountList, accountOrder) + accountDropdown:SetValue("main") end function PermoksAccountManager:UpdatePageButtons() - local db = self.db.global - local pages = self.pages - local managerFrame = self.managerFrame - managerFrame.pageButtons = managerFrame.pageButtons or {} - local categoryFrame = self.categoryFrame - local currentPage = db.currentPage - - if #pages == 1 then - if managerFrame.pageButtons then - for _, button in pairs(managerFrame.pageButtons) do - button:Hide() - end - return - end - end - - if #pages < #managerFrame.pageButtons then - for page = #pages + 1, #managerFrame.pageButtons do - managerFrame.pageButtons[page]:Hide() - end - end - - local offset = managerFrame.accountDropdown and managerFrame.accountDropdown:IsShown() and 130 or 10 - for pageNumber = 1, #pages do - local pageButton = managerFrame.pageButtons[pageNumber] or CreateManagerButton(35, 20, pageNumber) - if not managerFrame.pageButtons[pageNumber] then - managerFrame.pageButtons[pageNumber] = pageButton - if pageNumber == currentPage then - pageButton.Text:SetTextColor(0, 1, 0, 1) - pageButton.selected:Show() - end - - pageButton:SetPoint('LEFT', managerFrame.topDragBar, 'LEFT', offset + ((pageNumber - 1) * 40), 0) - pageButton:SetID(pageNumber) - pageButton:SetScript( - 'OnClick', - function(self, button, down) - local currentPage = db.currentPage - if currentPage == pageNumber then - return - end - - managerFrame.pageButtons[currentPage].selected:Hide() - managerFrame.pageButtons[currentPage].Text:SetTextColor(1, 1, 1, 1) - self.selected:Show() - self.Text:SetTextColor(0, 1, 0, 1) - PermoksAccountManager.db.global.currentPage = pageNumber - PermoksAccountManager:UpdateWarbandAnchors('general', managerFrame.labelColumn) - PermoksAccountManager:UpdateAltAnchors('general', managerFrame, managerFrame.labelColumn) - PermoksAccountManager:UpdateStrings(pageNumber, 'general') - PermoksAccountManager:UpdateManagerFrameSize(true) - - if categoryFrame.openCategory then - local category = categoryFrame.openCategory - PermoksAccountManager:UpdateWarbandAnchors(category, categoryFrame.labelColumn.categories[category]) - PermoksAccountManager:UpdateAltAnchors(category, categoryFrame, categoryFrame.labelColumn.categories[category]) - PermoksAccountManager:UpdateStrings(nil, category, categoryFrame) - end - end - ) - pageButton:SetParent(managerFrame.topDragBar) - end - pageButton:Show() - end + local db = self.db.global + local pages = self.pages + local managerFrame = self.managerFrame + managerFrame.pageButtons = managerFrame.pageButtons or {} + local categoryFrame = self.categoryFrame + local currentPage = db.currentPage + + if #pages == 1 then + if managerFrame.pageButtons then + for _, button in pairs(managerFrame.pageButtons) do + button:Hide() + end + return + end + end + + if #pages < #managerFrame.pageButtons then + for page = #pages + 1, #managerFrame.pageButtons do + managerFrame.pageButtons[page]:Hide() + end + end + + local offset = managerFrame.accountDropdown and managerFrame.accountDropdown:IsShown() and 130 or 10 + for pageNumber = 1, #pages do + local pageButton = managerFrame.pageButtons[pageNumber] or CreateManagerButton(35, 20, pageNumber) + if not managerFrame.pageButtons[pageNumber] then + managerFrame.pageButtons[pageNumber] = pageButton + if pageNumber == currentPage then + pageButton.Text:SetTextColor(0, 1, 0, 1) + pageButton.selected:Show() + end + + pageButton:SetPoint("LEFT", managerFrame.topDragBar, "LEFT", offset + ((pageNumber - 1) * 40), 0) + pageButton:SetID(pageNumber) + pageButton:SetScript("OnClick", function(self, button, down) + local currentPage = db.currentPage + if currentPage == pageNumber then + return + end + + managerFrame.pageButtons[currentPage].selected:Hide() + managerFrame.pageButtons[currentPage].Text:SetTextColor(1, 1, 1, 1) + self.selected:Show() + self.Text:SetTextColor(0, 1, 0, 1) + PermoksAccountManager.db.global.currentPage = pageNumber + PermoksAccountManager:UpdateWarbandAnchors("general", managerFrame.labelColumn) + PermoksAccountManager:UpdateAltAnchors("general", managerFrame, managerFrame.labelColumn) + PermoksAccountManager:UpdateStrings(pageNumber, "general") + PermoksAccountManager:UpdateManagerFrameSize(true) + + if categoryFrame.openCategory then + local category = categoryFrame.openCategory + PermoksAccountManager:UpdateWarbandAnchors(category, categoryFrame.labelColumn.categories[category]) + PermoksAccountManager:UpdateAltAnchors( + category, + categoryFrame, + categoryFrame.labelColumn.categories[category] + ) + PermoksAccountManager:UpdateStrings(nil, category, categoryFrame) + end + end) + pageButton:SetParent(managerFrame.topDragBar) + end + pageButton:Show() + end end local function UpdateOrCreateMenu(category, anchorFrame, parent) - local db = PermoksAccountManager.db.global - local childs = db.currentCategories[category].childs - local options = db.currentCategories[category].childOrder - if not options then - return - end - - PermoksAccountManager.managerFrame.labels = PermoksAccountManager.managerFrame.labels or {} - PermoksAccountManager.managerFrame.labels[category] = PermoksAccountManager.managerFrame.labels[category] or {} - local labels = PermoksAccountManager.managerFrame.labels[category] - - local enabledRows = 0 - for j, row_iden in pairs(childs) do - local row = PermoksAccountManager.labelRows[row_iden] - if row then - if row.label then - local label_row = labels[row_iden] or CreateLabelButton('label', parent or anchorFrame, row, nil, 140) - if not labels[row_iden] then - labels[row_iden] = label_row - if not row.hideLabel then - label_row:SetText((type(row.label) == 'function' and row.label() or row.label) .. ':') - end - end - label_row:SetPoint('TOPLEFT', anchorFrame, 'TOPLEFT', 0, -enabledRows * 20) - label_row:Show() - - enabledRows = enabledRows + (row.offset or 1) - elseif row.hideLabel then - enabledRows = enabledRows + (row.offset or 1) - end - end - end - - for row_iden, label in pairs(labels) do - if not options[row_iden] then - label:Hide() - end - end - - return enabledRows + local db = PermoksAccountManager.db.global + local childs = db.currentCategories[category].childs + local options = db.currentCategories[category].childOrder + if not options then + return + end + + PermoksAccountManager.managerFrame.labels = PermoksAccountManager.managerFrame.labels or {} + PermoksAccountManager.managerFrame.labels[category] = PermoksAccountManager.managerFrame.labels[category] or {} + local labels = PermoksAccountManager.managerFrame.labels[category] + + local enabledRows = 0 + for j, row_iden in pairs(childs) do + local row = PermoksAccountManager.labelRows[row_iden] + if row then + if row.label then + local label_row = labels[row_iden] or CreateLabelButton("label", parent or anchorFrame, row, nil, 140) + if not labels[row_iden] then + labels[row_iden] = label_row + if not row.hideLabel then + label_row:SetText((type(row.label) == "function" and row.label() or row.label) .. ":") + end + end + label_row:SetPoint("TOPLEFT", anchorFrame, "TOPLEFT", 0, -enabledRows * 20) + label_row:Show() + + enabledRows = enabledRows + (row.offset or 1) + elseif row.hideLabel then + enabledRows = enabledRows + (row.offset or 1) + end + end + end + + for row_iden, label in pairs(labels) do + if not options[row_iden] then + label:Hide() + end + end + + return enabledRows end local function UpdateButtonTexture(button, index, row_identifier, alt_guid) - if button.normalTexture then - if PermoksAccountManager.db.global.completionData[row_identifier][alt_guid] then - button.normalTexture:SetColorTexture(0, 1, 0, 0.25) - elseif index % 2 == 0 then - button.normalTexture:SetColorTexture(0.65, 0.65, 0.65, 0.25) - else - button.normalTexture:SetColorTexture(0.3, 0.3, 0.3, 0.25) - end - end + if button.normalTexture then + if PermoksAccountManager.db.global.completionData[row_identifier][alt_guid] then + button.normalTexture:SetColorTexture(0, 1, 0, 0.25) + elseif index % 2 == 0 then + button.normalTexture:SetColorTexture(0.65, 0.65, 0.65, 0.25) + else + button.normalTexture:SetColorTexture(0.3, 0.3, 0.3, 0.25) + end + end end local function UpdateRowButton(button, buttonOptions, _) - button:SetWidth(buttonOptions.buttonWidth) + button:SetWidth(buttonOptions.buttonWidth) - local fontString = button:GetFontString() - if fontString then - fontString:SetJustifyH(buttonOptions.justifyH) - fontString:SetWidth(buttonOptions.buttonTextWidth) - end + local fontString = button:GetFontString() + if fontString then + fontString:SetJustifyH(buttonOptions.justifyH) + fontString:SetWidth(buttonOptions.buttonTextWidth) + end end function PermoksAccountManager:UpdateMenuButton(button) - local fontString = button.fontString or button:GetFontString() - if fontString and self.db.global.updateFont then - local _, size = fontString:GetFont() - fontString:SetFont(LSM:Fetch('font', self.db.global.options.font), size) - end + local fontString = button.fontString or button:GetFontString() + if fontString and self.db.global.updateFont then + local _, size = fontString:GetFont() + fontString:SetFont(LSM:Fetch("font", self.db.global.options.font), size) + end end function PermoksAccountManager:UpdateWarbandAnchors(category, customAnchorFrame) - if not self.isRetail or self.db.global.options.hideWarband then return end + if not self.isRetail or self.db.global.options.hideWarband then + return + end - local db = self.db.global - local managerFrame = self.managerFrame - local labelOffset = db.options.other.labelOffset - local widthPerAlt = db.options.buttons.widthPerAlt + local db = self.db.global + local managerFrame = self.managerFrame + local labelOffset = db.options.other.labelOffset + local widthPerAlt = db.options.buttons.widthPerAlt - managerFrame.warbandColumns[category] = managerFrame.warbandColumns[category] or CreateFrame('Button', nil, customAnchorFrame) - local anchorFrame = managerFrame.warbandColumns[category] - anchorFrame.rows = anchorFrame.rows or {} - anchorFrame:ClearAllPoints() - anchorFrame:SetPoint('TOPLEFT', customAnchorFrame, 'TOPRIGHT', labelOffset, 0) - anchorFrame:SetPoint('BOTTOMRIGHT', customAnchorFrame, 'BOTTOMLEFT', (widthPerAlt * 2) + labelOffset, 0) - anchorFrame:Show() + managerFrame.warbandColumns[category] = managerFrame.warbandColumns[category] + or CreateFrame("Button", nil, customAnchorFrame) + local anchorFrame = managerFrame.warbandColumns[category] + anchorFrame.rows = anchorFrame.rows or {} + anchorFrame:ClearAllPoints() + anchorFrame:SetPoint("TOPLEFT", customAnchorFrame, "TOPRIGHT", labelOffset, 0) + anchorFrame:SetPoint("BOTTOMRIGHT", customAnchorFrame, "BOTTOMLEFT", (widthPerAlt * 2) + labelOffset, 0) + anchorFrame:Show() end function PermoksAccountManager:UpdateAltAnchors(category, columnFrame, customAnchorFrame) - columnFrame.altColumns[category] = columnFrame.altColumns[category] or {} - - local db = self.db.global - local altDataForPage = self.pages[db.currentPage or 1] - if not altDataForPage then - return - end + columnFrame.altColumns[category] = columnFrame.altColumns[category] or {} - local widthPerAlt = db.options.buttons.widthPerAlt - local labelOffset = db.options.other.labelOffset - local altColumns = columnFrame.altColumns[category] + local db = self.db.global + local altDataForPage = self.pages[db.currentPage or 1] + if not altDataForPage then + return + end - if #altColumns > #altDataForPage then - for index = #altDataForPage + 1, #altColumns do - altColumns[index]:Hide() - end - end + local widthPerAlt = db.options.buttons.widthPerAlt + local labelOffset = db.options.other.labelOffset + local altColumns = columnFrame.altColumns[category] - for index, alt_guid in ipairs(altDataForPage) do - local anchorFrame = altColumns[index] or CreateFrame('Button', nil, customAnchorFrame) - anchorFrame:ClearAllPoints() - anchorFrame:SetPoint('TOPLEFT', customAnchorFrame, 'TOPRIGHT', ((self.isRetail and not self.db.global.options.hideWarband) and widthPerAlt or 0) + (widthPerAlt * (index - 1)) + labelOffset, 0) - anchorFrame:SetPoint('BOTTOMRIGHT', customAnchorFrame, 'BOTTOMLEFT', ((self.isRetail and not self.db.global.options.hideWarband) and widthPerAlt or 0) + (widthPerAlt * index) + widthPerAlt + labelOffset, 0) - anchorFrame.GUID = alt_guid - anchorFrame:Show() + if #altColumns > #altDataForPage then + for index = #altDataForPage + 1, #altColumns do + altColumns[index]:Hide() + end + end - altColumns[index] = anchorFrame - anchorFrame.rows = anchorFrame.rows or {} - end + for index, alt_guid in ipairs(altDataForPage) do + local anchorFrame = altColumns[index] or CreateFrame("Button", nil, customAnchorFrame) + anchorFrame:ClearAllPoints() + anchorFrame:SetPoint( + "TOPLEFT", + customAnchorFrame, + "TOPRIGHT", + ((self.isRetail and not self.db.global.options.hideWarband) and widthPerAlt or 0) + + (widthPerAlt * (index - 1)) + + labelOffset, + 0 + ) + anchorFrame:SetPoint( + "BOTTOMRIGHT", + customAnchorFrame, + "BOTTOMLEFT", + ((self.isRetail and not self.db.global.options.hideWarband) and widthPerAlt or 0) + + (widthPerAlt * index) + + widthPerAlt + + labelOffset, + 0 + ) + anchorFrame.GUID = alt_guid + anchorFrame:Show() + + altColumns[index] = anchorFrame + anchorFrame.rows = anchorFrame.rows or {} + end end function PermoksAccountManager:UpdateAllFonts() - UpdateFonts() + UpdateFonts() end local InternalLabelFunctions = { - quest = function(alt_data, column, key) - if not alt_data.questInfo then - return '-' - end - - -- TODO Somehow save it per character so we don't have to check it everytime we change the text. - local offset, required = 0 - if column.unlock then - local unlockInfo = column.unlock - local unlocked = alt_data[unlockInfo.charKey] and alt_data[unlockInfo.charKey][unlockInfo.key] - if unlocked then - required = unlockInfo.required - end - elseif column.professionOffset and alt_data.professions then - local skillLine1, skillLine2 = unpack(alt_data.professions) - - if skillLine1 then - offset = offset + (column.professionOffset[skillLine1] or 0) - end - - if skillLine2 then - offset = offset + (column.professionOffset[skillLine2] or 0) - end - end - - required = (required or column.required or 1) + offset - if type(column.required) == 'function' then - required = column.required(alt_data) - end - - local questInfo = alt_data.questInfo[column.questType] and alt_data.questInfo[column.questType][column.visibility] and alt_data.questInfo[column.questType][column.visibility][column.key or key] - if not questInfo then - return PermoksAccountManager:CreateQuestString(0, required) or '-' - end - - return PermoksAccountManager:CreateQuestString(questInfo, required, column.plus or (column.plus == nil and required == 1)) or '-' - end, - currency = function(alt_data, column, key) - if not alt_data.currencyInfo then - return '-' - end - - local currencyInfo = alt_data.currencyInfo[column.key or key] - if not currencyInfo then - return '-' - end - - return PermoksAccountManager:CreateCurrencyString(currencyInfo, column.abbCurrent, column.abbMax, column.hideMax, column.customIcon, column.hideIcon) or '-' - end, - faction = function(alt_data, column, key) - if not alt_data.factions then - return '-' - end - - local factionInfo = alt_data.factions[column.key or key] - if not factionInfo then - return '-' - end - - return PermoksAccountManager:CreateFactionString(factionInfo) or '-' - end, - item = function(alt_data, column, key) - if not alt_data.itemCounts then - return '-' - end - - local itemInfo = alt_data.itemCounts[column.key or key] - if not itemInfo then - return '-' - end - - return PermoksAccountManager:CreateItemString(itemInfo) - end, - sanctum = function(alt_data, column, key) - if not alt_data.sanctumInfo then - return '-' - end - - local sanctumInfo = alt_data.sanctumInfo - if not sanctumInfo then - return '-' - end - - return PermoksAccountManager:CreateSanctumTierString(sanctumInfo, column.key or key) - end, - raid = function(alt_data, column) - if not alt_data.instanceInfo or not alt_data.instanceInfo.raids then - return '-' - end - - local raidInfo = alt_data.instanceInfo.raids[column.key] - if not raidInfo then - return '-' - end - - return PermoksAccountManager:CreateRaidString(raidInfo) - end, - pvp = function(alt_data, column, key) - if not alt_data.pvp then - return '-' - end - - local pvpInfo = alt_data.pvp[column.key or key] - if not pvpInfo then - return '-' - end - - return PermoksAccountManager:CreateRatingString(pvpInfo) - end, - vault = function(alt_data, column, key) - if not alt_data.vaultInfo then - return '-' - end - - local vaultInfo = alt_data.vaultInfo[column.key or key] - if not vaultInfo then - return '-' - end - - return PermoksAccountManager:CreateVaultString(vaultInfo) - end + quest = function(alt_data, column, key) + if not alt_data.questInfo then + return "-" + end + + -- TODO Somehow save it per character so we don't have to check it everytime we change the text. + local offset, required = 0 + if column.unlock then + local unlockInfo = column.unlock + local unlocked = alt_data[unlockInfo.charKey] and alt_data[unlockInfo.charKey][unlockInfo.key] + if unlocked then + required = unlockInfo.required + end + elseif column.professionOffset and alt_data.professions then + local skillLine1, skillLine2 = alt_data.professions.profession1, alt_data.professions.profession2 + + if skillLine1 then + skillLine1 = skillLine1.skillLineID + offset = offset + (column.professionOffset[skillLine1] or 0) + end + + if skillLine2 then + skillLine2 = skillLine2.skillLineID + offset = offset + (column.professionOffset[skillLine2] or 0) + end + end + + required = (required or column.required or 1) + offset + if type(column.required) == "function" then + required = column.required(alt_data) + end + + local questInfo = alt_data.questInfo[column.questType] + and alt_data.questInfo[column.questType][column.visibility] + and alt_data.questInfo[column.questType][column.visibility][column.key or key] + if not questInfo then + return PermoksAccountManager:CreateQuestString(0, required) or "-" + end + + return PermoksAccountManager:CreateQuestString( + questInfo, + required, + column.plus or (column.plus == nil and required == 1) + ) or "-" + end, + currency = function(alt_data, column, key) + if not alt_data.currencyInfo then + return "-" + end + + local currencyInfo = alt_data.currencyInfo[column.key or key] + if not currencyInfo then + return "-" + end + + return PermoksAccountManager:CreateCurrencyString( + currencyInfo, + column.abbCurrent, + column.abbMax, + column.hideMax, + column.customIcon, + column.hideIcon, + nil, + column.useWeeklyEarned + ) or "-" + end, + faction = function(alt_data, column, key) + if not alt_data.factions then + return "-" + end + + local factionInfo = alt_data.factions[column.key or key] + if not factionInfo then + return "-" + end + + return PermoksAccountManager:CreateFactionString(factionInfo) or "-" + end, + item = function(alt_data, column, key) + if not alt_data.itemCounts then + return "-" + end + + local itemInfo = alt_data.itemCounts[column.key or key] + if not itemInfo then + return "-" + end + + return PermoksAccountManager:CreateItemString(itemInfo) + end, + sanctum = function(alt_data, column, key) + if not alt_data.sanctumInfo then + return "-" + end + + local sanctumInfo = alt_data.sanctumInfo + if not sanctumInfo then + return "-" + end + + return PermoksAccountManager:CreateSanctumTierString(sanctumInfo, column.key or key) + end, + raid = function(alt_data, column) + if not alt_data.instanceInfo or not alt_data.instanceInfo.raids then + return "-" + end + + local raidInfo = alt_data.instanceInfo.raids[column.key] + if not raidInfo then + return "-" + end + + return PermoksAccountManager:CreateRaidString(raidInfo) + end, + pvp = function(alt_data, column, key) + if not alt_data.pvp then + return "-" + end + + local pvpInfo = alt_data.pvp[column.key or key] + if not pvpInfo then + return "-" + end + + return PermoksAccountManager:CreateRatingString(pvpInfo) + end, + vault = function(alt_data, column, key) + if not alt_data.vaultInfo then + return "-" + end + + local vaultInfo = alt_data.vaultInfo[column.key or key] + if not vaultInfo then + return "-" + end + + return PermoksAccountManager:CreateVaultString(vaultInfo) + end, } local InternalTooltipFunctions = { - raid = PermoksAccountManager.RaidTooltip_OnEnter, - vault = PermoksAccountManager.VaultTooltip_OnEnter, - item = PermoksAccountManager.ItemTooltip_OnEnter, - currency = PermoksAccountManager.CurrencyTooltip_OnEnter, - pvp = PermoksAccountManager.PVPTooltip_OnEnter + raid = PermoksAccountManager.RaidTooltip_OnEnter, + vault = PermoksAccountManager.VaultTooltip_OnEnter, + item = PermoksAccountManager.ItemTooltip_OnEnter, + currency = PermoksAccountManager.CurrencyTooltip_OnEnter, + pvp = PermoksAccountManager.PVPTooltip_OnEnter, } function PermoksAccountManager:GetInternalLabelFunction(labelRow) - return InternalLabelFunctions[labelRow.type] or (type(labelRow.data) == 'function' and labelRow.data) + return InternalLabelFunctions[labelRow.type] or (type(labelRow.data) == "function" and labelRow.data) end local function DeleteUnusedLabel(category, categoryInfo, labelIdentifier) - tDeleteItem(categoryInfo.childs, labelIdentifier) - categoryInfo.childOrder[labelIdentifier] = nil - PermoksAccountManager:UpdateAnchorsAndSize(category, nil, true, true) + tDeleteItem(categoryInfo.childs, labelIdentifier) + categoryInfo.childOrder[labelIdentifier] = nil + PermoksAccountManager:UpdateAnchorsAndSize(category, nil, true, true) end function PermoksAccountManager:DeleteUnusedLabels(labelIdentifier) - for category, categoryInfo in pairs(self.db.global.options.defaultCategories) do - if categoryInfo.childOrder[labelIdentifier] then - DeleteUnusedLabel(category, categoryInfo, labelIdentifier) - end - end - - for category, categoryInfo in pairs(self.db.global.options.customCategories) do - if categoryInfo.childOrder[labelIdentifier] then - DeleteUnusedLabel(category, categoryInfo, labelIdentifier) - end - end -end - -function PermoksAccountManager:UpdateRows(childs, rows, anchorFrame, enabledChilds, data, options) - local enabledRows, yOffset = 0, 0 - for _, row_identifier in pairs(childs) do - local labelRow = self.labelRows[row_identifier] - if labelRow and enabledChilds[row_identifier] then - local row = (not self.isLayoutDirty and rows[row_identifier]) or CreateLabelButton('row', anchorFrame, labelRow, enabledRows) - if self.isLayoutDirty or not rows[row_identifier] then - if rows[row_identifier] then - rows[row_identifier]:Hide() - end - rows[row_identifier] = row - - local module = self:GetModuleForRow(row_identifier) - local moduleLabelFunction = module and module.labelFunctions[labelRow.type] - if moduleLabelFunction then - row.module = module - row.labelFunction = moduleLabelFunction.callback - else - row.labelFunction = self:GetInternalLabelFunction(labelRow) - end - - if labelRow.tooltip then - local tooltipFunction - if labelRow.customTooltip then - tooltipFunction = labelRow.customTooltip - elseif InternalTooltipFunctions[labelRow.type] then - tooltipFunction = InternalTooltipFunctions[labelRow.type] - elseif type(labelRow.tooltip) == 'function' then - tooltipFunction = labelRow.tooltip - end - row:SetScript('OnLeave', Tooltip_OnLeave) - row.tooltipFunction = tooltipFunction - end - end - - if row.tooltipFunction then - row:SetScript( - 'OnEnter', - function(self) - self.tooltipFunction(self, data, labelRow, row_identifier) - end - ) - end - - if labelRow.OnClick then - row:SetScript("OnClick", function(self, button) - labelRow.OnClick(button, data) - end) - end - - UpdateButtonTexture(row, enabledRows, row_identifier, data.guid) - UpdateRowButton(row, options, row_identifier) - - if row.module then - local args = row.module:GenerateLabelArgs(data, labelRow.type, labelRow.update) - local text - if labelRow.passKey then - text = row.labelFunction(labelRow.key or row_identifier, unpack(args)) - elseif labelRow.passRow then - text = row.labelFunction(labelRow, unpack(args)) - else - text = row.labelFunction(unpack(args)) - end - row:SetText(text) - else - row:SetText(row.labelFunction(data, labelRow, row_identifier)) - end - row:SetPoint('TOPLEFT', anchorFrame, 'TOPLEFT', 0, -yOffset * 20) - row:Show() - - if labelRow.color and row.fontString then - local color = labelRow.color(data) - if color then - row.fontString:SetTextColor(color:GetRGBA()) - end - end - - enabledRows = enabledRows + 1 - yOffset = yOffset + (labelRow.offset or 1) - end - end - - for row_identifier, row in pairs(rows) do - if not enabledChilds[row_identifier] then - row:Hide() - end - end + for category, categoryInfo in pairs(self.db.global.options.defaultCategories) do + if categoryInfo.childOrder[labelIdentifier] then + DeleteUnusedLabel(category, categoryInfo, labelIdentifier) + end + end + + for category, categoryInfo in pairs(self.db.global.options.customCategories) do + if categoryInfo.childOrder[labelIdentifier] then + DeleteUnusedLabel(category, categoryInfo, labelIdentifier) + end + end +end + +function PermoksAccountManager:UpdateRows(childs, rows, anchorFrame, enabledChilds, data, options, isWarband) + local enabledRows, yOffset = 0, 0 + for _, row_identifier in pairs(childs) do + local labelRow = self.labelRows[row_identifier] + if labelRow and enabledChilds[row_identifier] then + local row = (not self.isLayoutDirty and rows[row_identifier]) + or CreateLabelButton("row", anchorFrame, labelRow, enabledRows) + if (not isWarband and labelRow.warband ~= "unique") or (isWarband and labelRow.warband) then + if self.isLayoutDirty or not rows[row_identifier] then + local module = self:GetModuleForRow(row_identifier) + local moduleLabelFunction = module and module.labelFunctions[labelRow.type] + if moduleLabelFunction then + row.module = module + row.labelFunction = moduleLabelFunction.callback + else + row.labelFunction = self:GetInternalLabelFunction(labelRow) + end + + if labelRow.tooltip then + local tooltipFunction + if labelRow.customTooltip then + tooltipFunction = labelRow.customTooltip + elseif InternalTooltipFunctions[labelRow.type] then + tooltipFunction = InternalTooltipFunctions[labelRow.type] + elseif type(labelRow.tooltip) == "function" then + tooltipFunction = labelRow.tooltip + end + row:SetScript("OnLeave", Tooltip_OnLeave) + row.tooltipFunction = tooltipFunction + end + end + + if row.tooltipFunction then + row:SetScript("OnEnter", function(self) + self.tooltipFunction(self, data, labelRow, row_identifier) + end) + end + + if labelRow.OnClick then + row:SetScript("OnClick", function(self, button) + labelRow.OnClick(button, data) + end) + end + + UpdateRowButton(row, options, row_identifier) + + if row.module then + local args = row.module:GenerateLabelArgs(data, labelRow.type, labelRow.update) + local text + if labelRow.passKey then + text = row.labelFunction(labelRow.key or row_identifier, unpack(args)) + elseif labelRow.passRow then + text = row.labelFunction(labelRow, unpack(args)) + else + text = row.labelFunction(unpack(args)) + end + row:SetText(text) + else + row:SetText(row.labelFunction(data, labelRow, row_identifier)) + end + + if labelRow.color and row.fontString then + local color = labelRow.color(data) + if color then + row.fontString:SetTextColor(color:GetRGBA()) + end + end + end + + if rows[row_identifier] then + rows[row_identifier]:Hide() + end + rows[row_identifier] = row + + UpdateButtonTexture(row, enabledRows, row_identifier, data.guid) + + row:SetPoint("TOPLEFT", anchorFrame, "TOPLEFT", 0, -yOffset * 20) + row:Show() + + enabledRows = enabledRows + 1 + yOffset = yOffset + (labelRow.offset or 1) + end + end + + for row_identifier, row in pairs(rows) do + if not enabledChilds[row_identifier] then + row:Hide() + end + end end function PermoksAccountManager:UpdateColumnForWarband(category) - if not self.isRetail or self.db.global.options.hideWarband then return end + if not self.isRetail or self.db.global.options.hideWarband then + return + end - if not self.account.warbandData then - return - end - - local account = self.account - local db = self.db.global - local anchorFrame = self.managerFrame.warbandColumns[category] - self:UpdateRows(db.currentCategories[category].childs, anchorFrame.rows, anchorFrame, db.currentCategories[category].childOrder, account.warbandData, db.options.buttons) + if not self.account.warbandData then + return + end + + local account = self.account + local db = self.db.global + local anchorFrame = self.managerFrame.warbandColumns[category] + self:UpdateRows( + db.currentCategories[category].childs, + anchorFrame.rows, + anchorFrame, + db.currentCategories[category].childOrder, + account.warbandData, + db.options.buttons, + true + ) end function PermoksAccountManager:UpdateColumnForAlt(altData, anchorFrame, category) - -- Fix synced Account using old format - if type(altData) == 'string' then - altData = self.account.data[altData] or nil - end - - if not altData then - return - end - - local db = self.db.global - local buttonOptions = db.options.buttons - local childs = db.currentCategories[category].childs - local enabledChilds = db.currentCategories[category].childOrder - - local rows = anchorFrame.rows - local enabledRows, yOffset = 0, 0 - for _, row_identifier in pairs(childs) do - local labelRow = self.labelRows[row_identifier] - if labelRow and enabledChilds[row_identifier] then - local row = (not self.isLayoutDirty and rows[row_identifier]) or CreateLabelButton('row', anchorFrame, labelRow, enabledRows) - if self.isLayoutDirty or not rows[row_identifier] then - if rows[row_identifier] then - rows[row_identifier]:Hide() - end - rows[row_identifier] = row - - local module = self:GetModuleForRow(row_identifier) - local moduleLabelFunction = module and module.labelFunctions[labelRow.type] - if moduleLabelFunction then - row.module = module - row.labelFunction = moduleLabelFunction.callback - else - row.labelFunction = self:GetInternalLabelFunction(labelRow) - end - - if labelRow.tooltip then - local tooltipFunction - if labelRow.customTooltip then - tooltipFunction = labelRow.customTooltip - elseif InternalTooltipFunctions[labelRow.type] then - tooltipFunction = InternalTooltipFunctions[labelRow.type] - elseif type(labelRow.tooltip) == 'function' then - tooltipFunction = labelRow.tooltip - end - row:SetScript('OnLeave', Tooltip_OnLeave) - row.tooltipFunction = tooltipFunction - end - end - - if row.tooltipFunction then - row:SetScript( - 'OnEnter', - function(self) - self.tooltipFunction(self, altData, labelRow, row_identifier) - end - ) - end - - if labelRow.OnClick then - row:SetScript("OnClick", function(self, button) - labelRow.OnClick(button, altData) - end) - end - - UpdateButtonTexture(row, enabledRows, row_identifier, altData.guid) - UpdateRowButton(row, buttonOptions, row_identifier) - - if row.module then - local args = row.module:GenerateLabelArgs(altData, labelRow.type, labelRow.update) - local text - if labelRow.passKey then - text = row.labelFunction(labelRow.key or row_identifier, unpack(args)) - elseif labelRow.passRow then - text = row.labelFunction(labelRow, unpack(args)) - else - text = row.labelFunction(unpack(args)) - end - row:SetText(text) - else - row:SetText(row.labelFunction(altData, labelRow, row_identifier)) - end - row:SetPoint('TOPLEFT', anchorFrame, 'TOPLEFT', 0, -yOffset * 20) - row:Show() - - if labelRow.color and row.fontString then - row.fontString:SetTextColor(labelRow.color(altData):GetRGBA()) - end - - enabledRows = enabledRows + 1 - yOffset = yOffset + (labelRow.offset or 1) - end - end - - for row_identifier, row in pairs(rows) do - if not enabledChilds[row_identifier] then - row:Hide() - end - end + -- Fix synced Account using old format + if type(altData) == "string" then + altData = self.account.data[altData] or nil + end + + if not altData then + return + end + + local db = self.db.global + self:UpdateRows( + db.currentCategories[category].childs, + anchorFrame.rows, + anchorFrame, + db.currentCategories[category].childOrder, + altData, + db.options.buttons + ) end function PermoksAccountManager:UpdateStrings(page, category, columnFrame) - local db = self.db.global - local page = self.pages[page or self.db.global.currentPage] - if not page then - return - end + local db = self.db.global + local page = self.pages[page or self.db.global.currentPage] + if not page then + return + end - local enabledAlts = 1 - columnFrame = columnFrame or self.managerFrame + local enabledAlts = 1 + columnFrame = columnFrame or self.managerFrame - self:UpdateColumnForWarband(category) - for _, altData in pairs(page) do - if not db.blacklist[altData.guid] then - local anchorFrame = columnFrame.altColumns[category][enabledAlts] + self:UpdateColumnForWarband(category) + for _, altData in pairs(page) do + if not db.blacklist[altData.guid] then + local anchorFrame = columnFrame.altColumns[category][enabledAlts] - self:UpdateColumnForAlt(altData, anchorFrame, category) - enabledAlts = enabledAlts + 1 - end - end + self:UpdateColumnForAlt(altData, anchorFrame, category) + enabledAlts = enabledAlts + 1 + end + end end function PermoksAccountManager:UpdateCategory(button, defaultState, name, category) - local categoryLabelColumn = self.categoryFrame.labelColumn.categories[category] or CreateFrame('Frame', nil, self.categoryFrame.labelColumn) - self.categoryFrame.labelColumn.categories[category] = categoryLabelColumn - - categoryLabelColumn:SetPoint('TOPLEFT', self.categoryFrame.labelColumn, 'TOPLEFT', 0, 0) - categoryLabelColumn.state = defaultState or categoryLabelColumn.state or 'closed' - - if categoryLabelColumn.state == 'closed' then - local numRows = UpdateOrCreateMenu(category, categoryLabelColumn) - self:UpdateWarbandAnchors(category, categoryLabelColumn) - self:UpdateAltAnchors(category, self.categoryFrame, categoryLabelColumn) - self:UpdateStrings(nil, category, self.categoryFrame) - categoryLabelColumn:SetSize(140, (numRows * 20)) - categoryLabelColumn:Show() - - if numRows > 0 then - categoryLabelColumn.state = 'open' - self.categoryFrame.openCategory = category - self.categoryFrame.openCategoryRows = numRows - button.selected:Show() - button.Text:SetTextColor(0, 1, 0, 1) - self:UpdateCategoryFrameSize(numRows) - self.categoryFrame:Show() - end - else - self:HideCategory(button, category) - end + local categoryLabelColumn = self.categoryFrame.labelColumn.categories[category] + or CreateFrame("Frame", nil, self.categoryFrame.labelColumn) + self.categoryFrame.labelColumn.categories[category] = categoryLabelColumn + + categoryLabelColumn:SetPoint("TOPLEFT", self.categoryFrame.labelColumn, "TOPLEFT", 0, 0) + categoryLabelColumn.state = defaultState or categoryLabelColumn.state or "closed" + + if categoryLabelColumn.state == "closed" then + local numRows = UpdateOrCreateMenu(category, categoryLabelColumn) + self:UpdateWarbandAnchors(category, categoryLabelColumn) + self:UpdateAltAnchors(category, self.categoryFrame, categoryLabelColumn) + self:UpdateStrings(nil, category, self.categoryFrame) + categoryLabelColumn:SetSize(140, (numRows * 20)) + categoryLabelColumn:Show() + + if numRows > 0 then + categoryLabelColumn.state = "open" + self.categoryFrame.openCategory = category + self.categoryFrame.openCategoryRows = numRows + button.selected:Show() + button.Text:SetTextColor(0, 1, 0, 1) + self:UpdateCategoryFrameSize(numRows) + self.categoryFrame:Show() + end + else + self:HideCategory(button, category) + end end function PermoksAccountManager:HideCategory(button, category) - if self.categoryFrame.labelColumn.categories[category] then - self.categoryFrame.labelColumn.categories[category].state = 'closed' - self.categoryFrame.labelColumn.categories[category]:Hide() - end + if self.categoryFrame.labelColumn.categories[category] then + self.categoryFrame.labelColumn.categories[category].state = "closed" + self.categoryFrame.labelColumn.categories[category]:Hide() + end - if category == self.categoryFrame.openCategory then - self.categoryFrame.openCategory = nil - self.categoryFrame.openCategoryRows = nil - end + if category == self.categoryFrame.openCategory then + self.categoryFrame.openCategory = nil + self.categoryFrame.openCategoryRows = nil + end - button.selected:Hide() - button.Text:SetTextColor(1, 1, 1, 1) + button.selected:Hide() + button.Text:SetTextColor(1, 1, 1, 1) end function PermoksAccountManager:HideAllCategories(currentCategory) - local categoryButtons = self.managerFrame.categoryButtons - if not categoryButtons then - return - end + local categoryButtons = self.managerFrame.categoryButtons + if not categoryButtons then + return + end - for category, button in pairs(categoryButtons) do - if category ~= currentCategory then - self:HideCategory(button, category) - end - end + for category, button in pairs(categoryButtons) do + if category ~= currentCategory then + self:HideCategory(button, category) + end + end - self.categoryFrame:Hide() + self.categoryFrame:Hide() end function PermoksAccountManager:UpdateOrCreateCategoryButtons() - local db = PermoksAccountManager.db.global - local buttonrows = 0 - local categories = db.currentCategories - local nameTbl - if not db.custom then - nameTbl = self:getDefaultCategories() - end - for category, row in PermoksAccountManager.spairs( - categories, - function(t, a, b) - if t[a] and t[b] then - return (t[a].order or 1) < (t[b].order or 1) - end - end - ) do - if PermoksAccountManager.managerFrame.categoryButtons then - if category ~= 'general' and db.currentCategories[category].enabled then - local categoryButton = PermoksAccountManager.managerFrame.categoryButtons[category] or CreateManagerButton(100, 25, nameTbl and nameTbl[category] and nameTbl[category].name or row.name) - categoryButton:Show() - categoryButton:SetPoint('TOPRIGHT', PermoksAccountManager.managerFrame.topDragBar, 'TOPLEFT', 0, -(buttonrows * 26) - 5) - if not PermoksAccountManager.managerFrame.categoryButtons[category] then - categoryButton.name = row.name - end - - if row.disable_drawLayer then - categoryButton:DisableDrawLayer('BACKGROUND') - end - - categoryButton:SetScript( - 'OnClick', - function() - PermoksAccountManager:HideAllCategories(category) - PermoksAccountManager:UpdateCategory(categoryButton, nil, row.name, category) - end - ) - - PermoksAccountManager.managerFrame.categoryButtons[category] = categoryButton - buttonrows = buttonrows + 1 - else - if PermoksAccountManager.managerFrame.categoryButtons[category] and not PermoksAccountManager.db.global.currentCategories[category].enabled then - PermoksAccountManager.managerFrame.categoryButtons[category]:Hide() - end - end - end - end - - PermoksAccountManager:UpdateCategoryButtonsBackground(buttonrows) + local db = PermoksAccountManager.db.global + local buttonrows = 0 + local categories = db.currentCategories + local nameTbl + if not db.custom then + nameTbl = self:getDefaultCategories() + end + for category, row in + PermoksAccountManager.spairs(categories, function(t, a, b) + if t[a] and t[b] then + return (t[a].order or 1) < (t[b].order or 1) + end + end) + do + if PermoksAccountManager.managerFrame.categoryButtons then + if category ~= "general" and db.currentCategories[category].enabled then + local categoryButton = PermoksAccountManager.managerFrame.categoryButtons[category] + or CreateManagerButton( + 100, + 25, + nameTbl and nameTbl[category] and nameTbl[category].name or row.name + ) + categoryButton:Show() + categoryButton:SetPoint( + "TOPRIGHT", + PermoksAccountManager.managerFrame.topDragBar, + "TOPLEFT", + 0, + -(buttonrows * 26) - 5 + ) + if not PermoksAccountManager.managerFrame.categoryButtons[category] then + categoryButton.name = row.name + end + + if row.disable_drawLayer then + categoryButton:DisableDrawLayer("BACKGROUND") + end + + categoryButton:SetScript("OnClick", function() + PermoksAccountManager:HideAllCategories(category) + PermoksAccountManager:UpdateCategory(categoryButton, nil, row.name, category) + end) + + PermoksAccountManager.managerFrame.categoryButtons[category] = categoryButton + buttonrows = buttonrows + 1 + else + if + PermoksAccountManager.managerFrame.categoryButtons[category] + and not PermoksAccountManager.db.global.currentCategories[category].enabled + then + PermoksAccountManager.managerFrame.categoryButtons[category]:Hide() + end + end + end + end + + PermoksAccountManager:UpdateCategoryButtonsBackground(buttonrows) end function PermoksAccountManager:UpdateCategoryButtonsBackground(buttons) - if buttons > 0 then - local height = buttons * 26 - local backgroundFrame = self.managerFrame.categoriesBackgroundFrame or CreateFrame('Frame', nil, self.managerFrame, 'BackdropTemplate') - if not self.managerFrame.categoriesBackgroundFrame then - backgroundFrame:SetPoint('TOPRIGHT', self.managerFrame.topDragBar, 'TOPLEFT', PermoksAccountManager.db.global.options.border.edgeSize, 0) - backgroundFrame:SetFrameLevel(0) - self:UpdateBorder(backgroundFrame, nil, true) - self.managerFrame.categoriesBackgroundFrame = backgroundFrame - end - backgroundFrame:SetSize(110, height + 8) - backgroundFrame:Show() - elseif self.managerFrame.categoriesBackgroundFrame then - self.managerFrame.categoriesBackgroundFrame:Hide() - end + if buttons > 0 then + local height = buttons * 26 + local backgroundFrame = self.managerFrame.categoriesBackgroundFrame + or CreateFrame("Frame", nil, self.managerFrame, "BackdropTemplate") + if not self.managerFrame.categoriesBackgroundFrame then + backgroundFrame:SetPoint( + "TOPRIGHT", + self.managerFrame.topDragBar, + "TOPLEFT", + PermoksAccountManager.db.global.options.border.edgeSize, + 0 + ) + backgroundFrame:SetFrameLevel(0) + self:UpdateBorder(backgroundFrame, nil, true) + self.managerFrame.categoriesBackgroundFrame = backgroundFrame + end + backgroundFrame:SetSize(110, height + 8) + backgroundFrame:Show() + elseif self.managerFrame.categoriesBackgroundFrame then + self.managerFrame.categoriesBackgroundFrame:Hide() + end end function PermoksAccountManager:UpdateManagerFrame() - PermoksAccountManager:SortPages() - PermoksAccountManager:UpdatePageButtons() - PermoksAccountManager:UpdateAnchorsAndSize('general') + PermoksAccountManager:SortPages() + PermoksAccountManager:UpdatePageButtons() + PermoksAccountManager:UpdateAnchorsAndSize("general") end function PermoksAccountManager:UpdateManagerFrameSize(widthOnly, heightOnly) - if not self.managerFrame or not self.managerFrame.height then return end - - local alts = #self.pages[self.db.global.currentPage] - local widthPerAlt = self.db.global.options.buttons.widthPerAlt - local width = ((self.isRetail and not self.db.global.options.hideWarband) and widthPerAlt or 0) + ((alts * widthPerAlt) + 140) - min((widthPerAlt - self.db.global.options.buttons.buttonWidth), 20) + 4 - local height = self.managerFrame.height + if not self.managerFrame or not self.managerFrame.height then + return + end - if widthOnly then - self.managerFrame:SetWidth(max(width + self.db.global.options.other.labelOffset, 240)) - elseif heightOnly then - self.managerFrame:SetHeight(height) - else - self.managerFrame:SetSize(max(width + self.db.global.options.other.labelOffset, 240), height) - end - self.managerFrame.lowest_point = -self.managerFrame.height + local alts = #self.pages[self.db.global.currentPage] + local widthPerAlt = self.db.global.options.buttons.widthPerAlt + local width = ((self.isRetail and not self.db.global.options.hideWarband) and widthPerAlt or 0) + + ((alts * widthPerAlt) + 140) + - min((widthPerAlt - self.db.global.options.buttons.buttonWidth), 20) + + 4 + local height = self.managerFrame.height + + if widthOnly then + self.managerFrame:SetWidth(max(width + self.db.global.options.other.labelOffset, 240)) + elseif heightOnly then + self.managerFrame:SetHeight(height) + else + self.managerFrame:SetSize(max(width + self.db.global.options.other.labelOffset, 240), height) + end + self.managerFrame.lowest_point = -self.managerFrame.height end function PermoksAccountManager:UpdateCategoryFrameSize(numRows) - local height = numRows * 20 - self.categoryFrame:SetHeight(height + 10) + local height = numRows * 20 + self.categoryFrame:SetHeight(height + 10) end function PermoksAccountManager:UpdateMenu(widthOnly, heightOnly) - self.managerFrame.categoryButtons = self.managerFrame.categoryButtons or {} + self.managerFrame.categoryButtons = self.managerFrame.categoryButtons or {} - if self.isBC then - self.managerFrame.guildAttunementButton:SetShown(self.db.global.options.showGuildAttunementButton) - end + if self.isBC then + self.managerFrame.guildAttunementButton:SetShown(self.db.global.options.showGuildAttunementButton) + end - local numRows = UpdateOrCreateMenu('general', self.managerFrame.labelColumn) - self:UpdateOrCreateCategoryButtons() + local numRows = UpdateOrCreateMenu("general", self.managerFrame.labelColumn) + self:UpdateOrCreateCategoryButtons() - self.managerFrame.height = max(numRows * 20 + 10, max(0, (self.numCategories - 2) * 30)) - self.managerFrame.numRows = numRows - self:UpdateManagerFrameSize(widthOnly, heightOnly) + self.managerFrame.height = max(numRows * 20 + 10, max(0, (self.numCategories - 2) * 30)) + self.managerFrame.numRows = numRows + self:UpdateManagerFrameSize(widthOnly, heightOnly) end function PermoksAccountManager:UpdateAnchorsAndSize(category, widthOnly, heightOnly, updateMenu) - if category == 'general' then - if updateMenu then - local numRows = UpdateOrCreateMenu('general', self.managerFrame.labelColumn) - self.managerFrame.height = max(numRows * 20 + 10, max(0, (self.numCategories - 2) * 30)) - end - - self:UpdateWarbandAnchors('general', self.managerFrame.labelColumn) - self:UpdateAltAnchors('general', self.managerFrame, self.managerFrame.labelColumn) - self:UpdateStrings(self.db.global.currentPage, 'general') - end + if category == "general" then + if updateMenu then + local numRows = UpdateOrCreateMenu("general", self.managerFrame.labelColumn) + self.managerFrame.height = max(numRows * 20 + 10, max(0, (self.numCategories - 2) * 30)) + end + + self:UpdateWarbandAnchors("general", self.managerFrame.labelColumn) + self:UpdateAltAnchors("general", self.managerFrame, self.managerFrame.labelColumn) + self:UpdateStrings(self.db.global.currentPage, "general") + end - if self.categoryFrame.openCategory then - local openCategory = self.categoryFrame.openCategory - self:UpdateCategory(PermoksAccountManager.managerFrame.categoryButtons[openCategory], 'closed', nil, openCategory) - end + if self.categoryFrame.openCategory then + local openCategory = self.categoryFrame.openCategory + self:UpdateCategory( + PermoksAccountManager.managerFrame.categoryButtons[openCategory], + "closed", + nil, + openCategory + ) + end - self:UpdateManagerFrameSize(widthOnly, heightOnly) + self:UpdateManagerFrameSize(widthOnly, heightOnly) end function PermoksAccountManager:CreateFractionString(numCompleted, numDesired, abbreviateCompleted, abbreviateDesired) - if not numCompleted or not numDesired then - return - end - local color = (numCompleted >= numDesired and '00ff00') or (numCompleted > 0 and 'ff9900') or 'ffffff' + if not numCompleted or not numDesired then + return + end + local color = (numCompleted >= numDesired and "00ff00") or (numCompleted > 0 and "ff9900") or "ffffff" - numCompleted = abbreviateCompleted and AbbreviateNumbers(numCompleted) or AbbreviateLargeNumbers(numCompleted) - local numDesiredAbbreviated = abbreviateDesired and AbbreviateNumbers(numDesired) or numDesired + numCompleted = abbreviateCompleted and AbbreviateNumbers(numCompleted) or AbbreviateLargeNumbers(numCompleted) + local numDesiredAbbreviated = abbreviateDesired and AbbreviateNumbers(numDesired) or numDesired - if numDesired > 0 then - return string.format('|cff%s%s|r/%s', color, numCompleted, numDesiredAbbreviated) - else - return string.format('|cff%s%s|r', color, numCompleted) - end + if numDesired > 0 then + return string.format("|cff%s%s|r/%s", color, numCompleted, numDesiredAbbreviated) + else + return string.format("|cff%s%s|r", color, numCompleted) + end end function PermoksAccountManager:FormatTimeString(seconds, string) - local color = 'ff0000' - if seconds > 86400 then - color = '00ff00' - end + local color = "ff0000" + if seconds > 86400 then + color = "00ff00" + end - return string.format('|cff%s%s|r', color, string) + return string.format("|cff%s%s|r", color, string) end function PermoksAccountManager:HideInterface() - if self.db.global.options.hideCategory then - self.categoryFrame:Hide() - self:HideAllCategories() - end + if self.db.global.options.hideCategory then + self.categoryFrame:Hide() + self:HideAllCategories() + end - if self.db.global.options.savePosition then - local frame = self.managerFrame - local position = self.db.global.position - position.point, position.relativeTo, position.relativePoint, position.xOffset, position.yOffset = frame:GetPointByName('TOPLEFT') - end + if self.db.global.options.savePosition then + local frame = self.managerFrame + local position = self.db.global.position + position.point, position.relativeTo, position.relativePoint, position.xOffset, position.yOffset = + frame:GetPointByName("TOPLEFT") + end - self.managerFrame:Hide() + self.managerFrame:Hide() end function PermoksAccountManager:ShowInterface() - self:UpdateAccountButtons() - self.myGUID = self.myGUID or UnitGUID('player') - self:RequestCharacterInfo() + self:UpdateAccountButtons() + self.myGUID = self.myGUID or UnitGUID("player") + self:RequestCharacterInfo() - if not self.loaded then - self:CreateMenuButtons() - self:UpdateWarbandAnchors('general', self.managerFrame.labelColumn) - self:UpdateAltAnchors('general', self.managerFrame, self.managerFrame.labelColumn) - self:UpdatePageButtons() + if not self.loaded then + self:CreateMenuButtons() + self:UpdateWarbandAnchors("general", self.managerFrame.labelColumn) + self:UpdateAltAnchors("general", self.managerFrame, self.managerFrame.labelColumn) + self:UpdatePageButtons() - self.loaded = true - end + self.loaded = true + end - self.managerFrame:Show() - self:UpdateCompletionDataForCharacter(self.charInfo) - self:UpdateMenu() - self:UpdateStrings(self.db.global.currentPage, 'general') - if self.categoryFrame.openCategory then - local openCategory = self.categoryFrame.openCategory - self:UpdateCategory(self.managerFrame.categoryButtons[openCategory], 'closed', nil, openCategory) - end + self.managerFrame:Show() + self:UpdateCompletionDataForCharacter(self.charInfo) + self:UpdateMenu() + self:UpdateStrings(self.db.global.currentPage, "general") + if self.categoryFrame.openCategory then + local openCategory = self.categoryFrame.openCategory + self:UpdateCategory(self.managerFrame.categoryButtons[openCategory], "closed", nil, openCategory) + end end function PermoksAccountManager:GetNextWeeklyResetTime() - local weeklyReset = C_DateAndTime.GetSecondsUntilWeeklyReset() - return weeklyReset + local weeklyReset = C_DateAndTime.GetSecondsUntilWeeklyReset() + return weeklyReset end function PermoksAccountManager:GetNextDailyResetTime() - local dailyReset = C_DateAndTime.GetSecondsUntilDailyReset() - return dailyReset + local dailyReset = C_DateAndTime.GetSecondsUntilDailyReset() + return dailyReset end function PermoksAccountManager:GetNextBiWeeklyResetTime() - local weeklyReset = C_DateAndTime.GetSecondsUntilWeeklyReset() - return (weeklyReset >= 302400 and weeklyReset - 302400 or weeklyReset) + local weeklyReset = C_DateAndTime.GetSecondsUntilWeeklyReset() + return (weeklyReset >= 302400 and weeklyReset - 302400 or weeklyReset) end function PermoksAccountManager:GetNextThreeDayLockoutResetTime() - local resetInfo = self.oldRaidResetInfo and self.oldRaidResetInfo[GetCurrentRegion()] - if not resetInfo then return 0 end + local resetInfo = self.oldRaidResetInfo and self.oldRaidResetInfo[GetCurrentRegion()] + if not resetInfo then + return 0 + end - local selectedStart = resetInfo.zg; - local resetInterVals = { zg = 3*24*60*60, } - local interval = resetInterVals.zg + local selectedStart = resetInfo.zg + local resetInterVals = { zg = 3 * 24 * 60 * 60 } + local interval = resetInterVals.zg - local reset = time(selectedStart) - local nextReset = interval - ((GetServerTime() - reset) % interval) - - return nextReset -end + local reset = time(selectedStart) + local nextReset = interval - ((GetServerTime() - reset) % interval) -local function GetAllkeysArguments() + return nextReset end local function GetComparisonOperator(startLevel, endLevel, operator) - startLevel = tonumber(startLevel) - endLevel = tonumber(endLevel) - if startLevel and endLevel and operator == "-" then - return function(level) - return level >= startLevel and level <= endLevel - end - elseif startLevel and operator == "+" then - return function(level) - return level >= startLevel - end - elseif startLevel then - return function(level) - return level == startLevel - end - end + startLevel = tonumber(startLevel) + endLevel = tonumber(endLevel) + if startLevel and endLevel and operator == "-" then + return function(level) + return level >= startLevel and level <= endLevel + end + elseif startLevel and operator == "+" then + return function(level) + return level >= startLevel + end + elseif startLevel then + return function(level) + return level == startLevel + end + end end function PermoksAccountManager:PostKeysIntoChat(channel, msg, ending) - local chatChannel - if channel and (channel == 'raid' or channel == 'guild' or channel == 'party') then - chatChannel = channel:upper() - else - chatChannel = UnitInParty('player') and 'PARTY' or 'GUILD' - end - - local message - local keys = {} - local arg, startLevel, operator, endLevel - if msg then - arg = msg:sub(ending + 2) - startLevel, operator, endLevel = arg:match("(%d+)([+-]*)(%d*)") - end - - if startLevel then - local comparator = GetComparisonOperator(startLevel, endLevel, operator) - if not comparator then return end - - for _, alt_data in pairs(self.db.global.accounts.main.data) do - local keyInfo = alt_data.keyInfo - if keyInfo then - local keyString = {} - if keyInfo.keyLevel and keyInfo.keyLevel > 0 and comparator(keyInfo.keyLevel) then - tinsert(keyString, keyInfo.keyDungeon .. '+' .. keyInfo.keyLevel) - end - - if #keyString > 0 then - tinsert(keys, string.format('[%s: %s]', alt_data.name, table.concat(keyString, ', '))) - end - end - end - end - - local dungeon = not startLevel and (msg and arg:upper() or '') - if dungeon then - for _, alt_data in pairs(self.db.global.accounts.main.data) do - local keyInfo = alt_data.keyInfo - if keyInfo then - local keyString = {} - if keyInfo.keyLevel and keyInfo.keyLevel > 0 and (dungeon == '' or keyInfo.keyDungeon == dungeon) then - tinsert(keyString, keyInfo.keyDungeon .. '+' .. keyInfo.keyLevel) - end - - if keyInfo.twKeyLevel and keyInfo.twKeyLevel > 0 and (dungeon == '' or keyInfo.twKeyDungeon == dungeon) then - tinsert(keyString, keyInfo.twKeyDungeon .. '+' .. keyInfo.twKeyLevel) - end - - if #keyString > 0 then - tinsert(keys, string.format('[%s: %s]', alt_data.name, table.concat(keyString, ', '))) - end - end - end - end - - message = table.concat(keys, ' ') - if message then - SendChatMessage(message:sub(1, 255), chatChannel) - end + local chatChannel + if channel and (channel == "raid" or channel == "guild" or channel == "party") then + chatChannel = channel:upper() + else + chatChannel = UnitInParty("player") and "PARTY" or "GUILD" + end + + local message + local keys = {} + local arg, startLevel, operator, endLevel + if msg then + arg = msg:sub(ending + 2) + startLevel, operator, endLevel = arg:match("(%d+)([+-]*)(%d*)") + end + + if startLevel then + local comparator = GetComparisonOperator(startLevel, endLevel, operator) + if not comparator then + return + end + + for _, alt_data in pairs(self.db.global.accounts.main.data) do + local keyInfo = alt_data.keyInfo + if keyInfo then + local keyString = {} + if keyInfo.keyLevel and keyInfo.keyLevel > 0 and comparator(keyInfo.keyLevel) then + tinsert(keyString, keyInfo.keyDungeon .. "+" .. keyInfo.keyLevel) + end + + if #keyString > 0 then + tinsert(keys, string.format("[%s: %s]", alt_data.name, table.concat(keyString, ", "))) + end + end + end + end + + local dungeon = not startLevel and (msg and arg:upper() or "") + if dungeon then + for _, alt_data in pairs(self.db.global.accounts.main.data) do + local keyInfo = alt_data.keyInfo + if keyInfo then + local keyString = {} + if keyInfo.keyLevel and keyInfo.keyLevel > 0 and (dungeon == "" or keyInfo.keyDungeon == dungeon) then + tinsert(keyString, keyInfo.keyDungeon .. "+" .. keyInfo.keyLevel) + end + + if + keyInfo.twKeyLevel + and keyInfo.twKeyLevel > 0 + and (dungeon == "" or keyInfo.twKeyDungeon == dungeon) + then + tinsert(keyString, keyInfo.twKeyDungeon .. "+" .. keyInfo.twKeyLevel) + end + + if #keyString > 0 then + tinsert(keys, string.format("[%s: %s]", alt_data.name, table.concat(keyString, ", "))) + end + end + end + end + + message = table.concat(keys, " ") + if message then + SendChatMessage(message:sub(1, 255), chatChannel) + end end do - local keystoneString = "\124cffa335ee\124Hkeystone:180653:%d:%d:%s\124h[Keystone: %s (%d)]\124h\124r" - function PermoksAccountManager:PostKeyIntoChat(altData) - if not altData then return end - - local keyInfo = altData.keyInfo - if keyInfo then - local channel = UnitInParty("player") and "PARTY" or "GUILD" - local affixes = C_MythicPlus.GetCurrentAffixes() - if keyInfo.keyMapID and affixes then - local keyLevel = keyInfo.keyLevel - local affixNum = (keyLevel >= 10 and 4) or (keyLevel >= 7 and 3) or (keyLevel >= 4 and 2) or 1 - local affixIDs = {} - for i, affixInfo in ipairs(affixes) do - tinsert(affixIDs, i<= affixNum and affixInfo.id or 0) - end - - local keystone = keystoneString:format(keyInfo.keyMapID, keyInfo.keyLevel, table.concat(affixIDs, ":"), C_ChallengeMode.GetMapUIInfo(keyInfo.keyMapID), keyInfo.keyLevel) - - if altData.guid == UnitGUID("player") then - SendChatMessage(keystone, channel) - else - SendChatMessage(string.format('[%s: %s]', altData.name, keystone), channel) - end - elseif keyInfo and keyInfo.keyLevel and keyInfo.keyLevel > 0 then - SendChatMessage(string.format('[%s: %s]', altData.name, keyInfo.keyDungeon .. '+' .. keyInfo.keyLevel), channel) - end - end - end + local keystoneString = "\124cffa335ee\124Hkeystone:180653:%d:%d:%s\124h[Keystone: %s (%d)]\124h\124r" + function PermoksAccountManager:PostKeyIntoChat(altData) + if not altData then + return + end + + local keyInfo = altData.keyInfo + if keyInfo then + local channel = UnitInParty("player") and "PARTY" or "GUILD" + local affixes = C_MythicPlus.GetCurrentAffixes() + if keyInfo.keyMapID and affixes then + local keyLevel = keyInfo.keyLevel + local affixNum = (keyLevel >= 10 and 4) or (keyLevel >= 7 and 3) or (keyLevel >= 4 and 2) or 1 + local affixIDs = {} + for i, affixInfo in ipairs(affixes) do + tinsert(affixIDs, i <= affixNum and affixInfo.id or 0) + end + + local keystone = keystoneString:format( + keyInfo.keyMapID, + keyInfo.keyLevel, + table.concat(affixIDs, ":"), + C_ChallengeMode.GetMapUIInfo(keyInfo.keyMapID), + keyInfo.keyLevel + ) + + if altData.guid == UnitGUID("player") then + SendChatMessage(keystone, channel) + else + SendChatMessage(string.format("[%s: %s]", altData.name, keystone), channel) + end + elseif keyInfo and keyInfo.keyLevel and keyInfo.keyLevel > 0 then + SendChatMessage( + string.format("[%s: %s]", altData.name, keyInfo.keyDungeon .. "+" .. keyInfo.keyLevel), + channel + ) + end + end + end end function TogglePAMFromKeybindings() - if PermoksAccountManagerFrame:IsShown() then - PermoksAccountManager:HideInterface() - else - PermoksAccountManager:ShowInterface() - end -end \ No newline at end of file + if PermoksAccountManagerFrame:IsShown() then + PermoksAccountManager:HideInterface() + else + PermoksAccountManager:ShowInterface() + end +end diff --git a/PermoksAccountManager.toc b/PermoksAccountManager.toc index eeeffa4..7228bec 100644 --- a/PermoksAccountManager.toc +++ b/PermoksAccountManager.toc @@ -1,4 +1,4 @@ -## Interface: 110000 +## Interface: 110200, 120001 ## Title: Permoks Account Manager ## Version: @project-version@ ## SavedVariables: PermoksAccountManagerDB diff --git a/PermoksAccountManager_Mists.toc b/PermoksAccountManager_Mists.toc new file mode 100644 index 0000000..44cbef0 --- /dev/null +++ b/PermoksAccountManager_Mists.toc @@ -0,0 +1,46 @@ +## Interface: 50500 +## Title: Permoks Account Manager +## Author: Permok +## Version: @project-version@ +## SavedVariables: PermoksAccountManagerDB +## X-Curse-Project-ID: 582886 +## X-Wago-ID: 25NRoe63 + + +libs\LibStub\LibStub.lua +libs\CallbackHandler-1.0\CallbackHandler-1.0.lua +libs\AceAddon-3.0\AceAddon-3.0.xml +libs\AceConsole-3.0\AceConsole-3.0.xml +libs\AceEvent-3.0\AceEvent-3.0.xml +libs\AceDB-3.0\AceDB-3.0.xml +libs\AceGUI-3.0\AceGUI-3.0.xml +libs\AceConfig-3.0\AceConfig-3.0.xml +libs\AceComm-3.0\AceComm-3.0.xml +libs\AceLocale-3.0\AceLocale-3.0.xml +libs\LibDataBroker-1.1\LibDataBroker-1.1.lua +libs\LibDBIcon-1.0\lib.xml +libs\LibQTip-1.0\lib.xml +libs\LibDeflate\LibDeflate.lua +libs\LibSerialize\LibSerialize.lua +libs\LibSharedMedia-3.0\lib.xml +libs\AceGUI-3.0-SharedMediaWidgets\widget.xml +libs\AceGUIWidget-TwoTextButton.lua + +modules.lua +locales\locales.xml +commands.lua +communication.lua + +db\db-mop.lua + +modules\accounts.lua +modules\character.lua +modules\currencies.lua +modules\factions.lua +modules\instances.lua +modules\quests.lua +modules\items.lua +modules\classic_professions.lua + +PermoksAccountManager.lua +options.lua diff --git a/api.lua b/api.lua index d0ada6d..f2363be 100644 --- a/api.lua +++ b/api.lua @@ -3,12 +3,118 @@ _G.PAMAPI = {} local api = _G.PAMAPI -function api.AddModule(...) - if ... then - local added = PermoksAccountManager:AddModule(...) +--[[ +PAM API quick reference + +How to add a module +1. Create a unique module name. +2. Build a payload table: + - update(charInfo): fills or refreshes data on the current character. + - labels: table of rowIdentifier = labelRow. + - events: eventName = callback or { callbackA, callbackB }. + Every callback receives (charInfo, ...eventArgs). + - share: optional map of callbackFunction = charInfoKey. + After that callback runs, PAM shares charInfo[charInfoKey] with synced accounts. +3. Register the module with: + local module = _G.PAMAPI.AddModule("my_module", payload, true) + Pass true for forceLoad when you want the module to register events and run update() immediately. +4. Keep every row identifier unique across all PAM modules. + +Minimal complete example +local api = _G.PAMAPI + +local function UpdateExample(charInfo) + charInfo.exampleModule = charInfo.exampleModule or {} + charInfo.exampleModule.status = IsResting() and "Resting" or "Awake" +end + +local payload = { + update = UpdateExample, + labels = { + example_status = { + label = "Example Status", + group = "other", + version = false, + data = function(altData) + return altData.exampleModule and altData.exampleModule.status or "-" + end, + }, + }, + events = { + PLAYER_ENTERING_WORLD = UpdateExample, + PLAYER_UPDATE_RESTING = UpdateExample, + }, + share = { + [UpdateExample] = "exampleModule", + }, +} + +api.AddModule("example_module", payload, true) + +Built-in labelRow.type values supported by PAM without custom registration +- quest: reads altData.questInfo[questType][visibility][key]. +- currency: reads altData.currencyInfo[key]. +- faction: reads altData.factions[key]. +- item: reads altData.itemCounts[key]. +- sanctum: reads altData.sanctumInfo with labelRow.key. +- raid: reads altData.instanceInfo.raids[key]. +- pvp: reads altData.pvp[key]. +- vault: reads altData.vaultInfo[key]. + +If you do not want to use one of the built-in types, set data = function(altData, labelRow, rowIdentifier) +on the row instead. Bundled types such as gold, keystone, spark, worldquest, renown, and similar module- +specific types are not core defaults; they are registered by their owning modules. + +Common label row fields +- label: string or function returning the row name shown in the UI. +- type: optional string; use one of the built-in types above or a custom type you registered yourself. +- data: optional fallback renderer used when no built-in/custom type is needed. +- key: optional lookup key used by most built-in types. +- group: optional group/category key such as character, currency, item, dungeons, raids, reputation, + profession, resetDaily, resetWeekly, or other. +- version: false for all game versions, or a specific WOW_PROJECT_* constant. +- tooltip: true to use the default tooltip for the type, or a function for a custom tooltip. +- customTooltip: function(button, altData, labelRow, rowIdentifier) for full tooltip control. +- color: function(altData) returning a ColorMixin. +- OnClick: function(buttonName, altData) for row click handling. +- warband: true to show in the warband column, "unique" for warband-only rows. +- passKey: for custom label types, prepends labelRow.key or rowIdentifier to the callback arguments. +- passRow: for custom label types, prepends the full labelRow to the callback arguments. + +Available functions +- PAMAPI.AddModule(moduleName, payload, forceLoad) + moduleName: unique string used to register the module. + payload: table containing update, labels, optional events, and optional share. + forceLoad: boolean; pass true to load the module immediately. + returns: the created module object, or nil when registration fails. + +- module:AddCustomLabelType(customType, callback, alwaysForceUpdate, ...) + customType: string that your label rows use in labelRow.type. + callback: renderer called with the altData fields named in ... after PAM extracts them. + alwaysForceUpdate: boolean; when true, callback arguments are rebuilt every refresh instead of cached. + ...: one or more altData keys, for example "itemCounts", "currencyInfo", or "exampleModule". + +- PAMAPI.GetCharacterInfo(key) + key: string key from the current character info table. + returns: PermoksAccountManager.charInfo[key], or nil. + +- PAMAPI.GetCharactersForAccount(account) + account: account key from db.global.accounts, for example "main" or a synced account id. + returns: db.global.accounts[account].data, or nil. + +- PAMAPI.Import(importString) + importString: export string created by PAM. + effect: overwrites the imported custom/category/options data and reruns OnLogin() to refresh state. +]] + + +function api.AddModule(moduleName, payload, forceLoad) + if moduleName and payload then + local added = PermoksAccountManager:AddModule(moduleName, payload, forceLoad) if added then PermoksAccountManager.UpdateCustomLabelOptions() end + return added end end @@ -23,3 +129,15 @@ function api.GetCharactersForAccount(account) return PermoksAccountManager.db.global.accounts[account].data end end + +function api.Import(importString) + local data = PermoksAccountManager:ParseImportString(importString) + if data then + PermoksAccountManager.db.global.custom = data.custom + PermoksAccountManager.db.global.options = data.options + PermoksAccountManager.db.global.internalVersion = data.internalVersion + end + + --TODO: Handle the import more gracefully. This should work for now. Forcing a reload would probably be more secure. + PermoksAccountManager:OnLogin() +end diff --git a/commands.lua b/commands.lua index 2ae68f0..198167d 100644 --- a/commands.lua +++ b/commands.lua @@ -193,6 +193,13 @@ function commands.SECRET() end end +function commands.SETVERSION(version) + version = tonumber(version) + if version then + PermoksAccountManager.db.global.internalTWWVersion = version + end +end + function commands.CL() PermoksAccountManager.db.global.customLabels = not PermoksAccountManager.db.global.customLabels end @@ -224,6 +231,10 @@ function PermoksAccountManager:Purge() self:OnLogin() self:Print("Please reload your interface to update the displayed info.") + + if self.isRetail then + self:Print("To update Warband currency info a relog is required.") + end end function PermoksAccountManager:ResetCategories() diff --git a/db/db-mop.lua b/db/db-mop.lua new file mode 100644 index 0000000..2ff1fb0 --- /dev/null +++ b/db/db-mop.lua @@ -0,0 +1,411 @@ +local addonName, PermoksAccountManager = ... +local L = LibStub("AceLocale-3.0"):GetLocale(addonName) + +local default_categories = { + general = { + order = 0, + name = "General", + childs = { + "characterName", + "characterLevel", + "ilevel", + "gold", + "location", + "profession1CDs", + "profession2CDs", + "honor_mists", + "conquest_points", + "justice_points", + "valor_points", + "ironpaw_token" + }, + childOrder = { + characterName = 1, + characterLevel = 2, + ilevel = 3, + gold = 4, + location = 5, + profession1CDs = 6, + profession2CDs = 7, + honor_mists = 8, + conquest_points = 9, + justice_points = 10, + valor_points = 11, + ironpaw_token = 12, + }, + hideToggle = true, + enabled = true, + }, + dailies = { + order = 1, + name = "Dailies (NYI)", + childs = {}, + childOrder = {}, + enabled = true, + }, + sharedFactions = { + order = 2, + name = "Repuation", + childs = { + "golden_lotus", + "shado_pan", + "the_august_celestials", + "the_black_prince", + "the_klaxxi", + "separator1", + "the_anglers", + "separator2", + "the_tillers", + }, + childOrder = { + golden_lotus = 1, + shado_pan = 2, + the_august_celestials = 3, + the_black_prince = 4, + the_klaxxi = 5, + separator1 = 10, + the_anglers = 11, + separator2 = 20, + the_tillers = 21, + }, + enabled = true, + }, + lockouts = { + order = 3, + name = "Lockouts", + childs = { + "mogushan_vaults", + "heart_of_fear", + "terrace_of_endless_spring", + }, + childOrder = { + mogushan_vaults = 1, + heart_of_fear = 2, + terrace_of_endless_spring = 3, + }, + enabled = true, + }, + items = { + order = 7, + name = "Items", + childs = {}, + childOrder = {}, + enabled = false, + }, +} + +PermoksAccountManager.groups = { + character = { + label = L["Character"], + order = 2, + }, + currency = { + label = L["Currency"], + order = 4, + }, + resetDaily = { + label = L["Daily Reset"], + order = 5, + }, + resetWeekly = { + label = L["Weekly Reset"], + order = 6, + }, + dungeons = { + label = L["Dungeons"], + order = 7, + }, + raids = { + label = L["Raids"], + order = 8, + }, + reputation = { + label = L["Reputation"], + order = 9, + }, + buff = { + label = L["Buff"], + order = 10, + }, + separator = { + label = L["Separator"], + order = 1, + }, + item = { + label = L["Items"], + order = 11, + }, + extra = { + label = L["Extra"], + order = 12, + }, + profession = { + label = L["Professions"], + order = 13, + }, + other = { + label = L["Other"], + order = 14, + }, +} + +PermoksAccountManager.labelRows = { + separator1 = { + hideLabel = true, + label = "Separator1", + data = function() + return "" + end, + group = "separator", + }, + separator2 = { + hideLabel = true, + label = "Separator2", + data = function() + return "" + end, + group = "separator", + }, + separator3 = { + hideLabel = true, + label = "Separator3", + data = function() + return "" + end, + group = "separator", + }, + separator4 = { + hideLabel = true, + label = "Separator4", + data = function() + return "" + end, + group = "separator", + }, + separator5 = { + hideLabel = true, + label = "Separator5", + data = function() + return "" + end, + group = "separator", + }, + separator6 = { + hideLabel = true, + label = "Separator6", + data = function() + return "" + end, + group = "separator", + }, +} + +-- instanceID = mapID (retail uses instanceIDs) +PermoksAccountManager.raids = { + -- old mount drop raids (optional) + [GetRealZoneText(309)] = { instanceID = 309, englishID = "zul_gurub" }, + [GetRealZoneText(532)] = { instanceID = 532, englishID = "karazhan" }, + [GetRealZoneText(550)] = { instanceID = 550, englishID = "tempest_keep" }, + + -- Wrath of the Lich King + [GetRealZoneText(533)] = { instanceID = 533, englishID = "naxxramas" }, + [GetRealZoneText(603)] = { instanceID = 603, englishID = "ulduar" }, + [GetRealZoneText(615)] = { instanceID = 615, englishID = "obsidian_sanctum" }, + [GetRealZoneText(616)] = { instanceID = 616, englishID = "eye_of_eternity" }, + [GetRealZoneText(624)] = { instanceID = 624, englishID = "vault_of_archavon" }, + [GetRealZoneText(649)] = { instanceID = 649, englishID = "trial_of_the_crusader" }, + [GetRealZoneText(249)] = { instanceID = 249, englishID = "onyxias_lair" }, + [GetRealZoneText(631)] = { instanceID = 631, englishID = "icecrown_citadel" }, + [GetRealZoneText(724)] = { instanceID = 724, englishID = "ruby_sanctum" }, + + -- Catacylsm + [GetRealZoneText(669)] = { instanceID = 669, englishID = "blackwing_descent" }, + [GetRealZoneText(671)] = { instanceID = 671, englishID = "the_bastion_of_twilight" }, + [GetRealZoneText(720)] = { instanceID = 720, englishID = "firelands" }, + [GetRealZoneText(754)] = { instanceID = 754, englishID = "throne_of_the_four_winds" }, + [GetRealZoneText(757)] = { instanceID = 757, englishID = "baradin_hold" }, + [GetRealZoneText(967)] = { instanceID = 967, englishID = "dragon_soul" }, + + -- Mists + [GetRealZoneText(1008)] = { instanceID = 1008, englishID = "mogushan_vaults" }, + [GetRealZoneText(1009)] = { instanceID = 1009, englishID = "heart_of_fear" }, + [GetRealZoneText(996)] = { instanceID = 996, englishID = "terrace_of_endless_spring" }, +} + +PermoksAccountManager.raidDifficultyLabels = { + [1] = "5N", + [2] = "5H", + [3] = "10N", + [4] = "25N", + [5] = "10H", + [6] = "25H", + [9] = "40", + [148] = "20", + [173] = "N", + [174] = "H", + [175] = "10", + [176] = "25", + [193] = "10H", + [194] = "25H", +} + +-- GetCurrentRegion +-- TODO Use instanceID or GetRealZoneText as key +-- Seems like we probably have to use GetCurrentRegionName +PermoksAccountManager.oldRaidResetInfo = { + -- US (+ Brazil + OC) + [1] = { + zg = { year = 2020, month = 4, day = 13, hour = 18, min = 0, sec = 0 }, + zgOC = { year = 2020, month = 4, day = 16, hour = 2, min = 0, sec = 0 }, -- not sure how to differentiate + }, + -- Korea + [2] = {}, + -- EU (+ Russia) + [3] = { + zg = { year = 2020, month = 4, day = 13, hour = 9, min = 0, sec = 0 }, --3*24*60*60 + }, + -- TW + [4] = {}, + -- CN + [5] = { + zg = { year = 2020, month = 4, day = 18, hour = 7, min = 0, sec = 0 }, + }, +} + +PermoksAccountManager.numDungeons = 16 + +-- Name = MapID +PermoksAccountManager.dungeons = {} + +PermoksAccountManager.item = { + -- Flasks + -- [46377] = { key = 'flaskEndlessRage' }, -- Flask of Endless Rage +} + +PermoksAccountManager.factions = { + [1269] = { name = "Golden Lotus" }, + [1270] = { name = "Shado-Pan" }, + [1341] = { name = "August Celestials" }, + [1359] = { name = "Black Prince" }, + [1337] = { name = "The Klaxxi" }, + [1302] = { name = "The Angler" }, + [1272] = { name = "The Tillers" }, +} + +PermoksAccountManager.currency = { + [1900] = 0, + [1901] = 0, + [101] = 0, + [102] = 0, + [161] = 0, + [221] = 0, + [301] = 0, + [2589] = 0, + [2711] = 0, + [341] = 0, + [390] = 0, + [391] = 0, + [395] = 0, + [396] = 0, + [402] = 0, -- Ironpaw Token +} + +PermoksAccountManager.currencyCustomOptions = { + [395] = { forceUpdate = true }, + [396] = { forceUpdate = true }, +} + +PermoksAccountManager.professionCDs = { + [L["Tailoring"]] = { + cds = { + [75141] = "Dreamcloth", + [75142] = "Dreamcloth", + [75144] = "Dreamcloth", + [75145] = "Dreamcloth", + [75146] = "Dreamcloth", + }, + items = { + [75141] = 54440, + [75142] = 54440, + [75144] = 54440, + [75145] = 54440, + [75146] = 54440, + }, + icon = 136249, + num = 6, + }, + [L["Alchemy"]] = { + cds = { + [78866] = L["Transmute: Living Elements"], -- Transmute: Living Elements + [80243] = L["Transmute: Truegold"], -- Transmute: Truegold + }, + items = { + [78866] = 54464, + [80243] = 58480, + }, + icon = 136240, + num = 2, + }, + [L["Leatherworking"]] = { + icon = 133611, + num = 0, + }, + [L["Enchanting"]] = { + icon = 136244, + num = 0, + }, + [L["Engineering"]] = { + icon = 136243, + num = 0, + }, + [L["Blacksmithing"]] = { + icon = 136241, + num = 0, + }, + [L["Herbalism"]] = { + icon = 136246, + num = 0, + }, + [L["Mining"]] = { + icon = 136248, + num = 0, + }, + [L["Skinning"]] = { + icon = 134366, + num = 0, + }, + [L["Jewelcrafting"]] = { + cds = { + [73478] = L["Fire Prism"], -- Fire Prism + }, + items = { + [73478] = 52304, + }, + icon = 134071, + num = 1, + }, + [L["Inscription"]] = { + icon = 237171, + num = 0, + }, +} + +PermoksAccountManager.quests = { + +} + +function PermoksAccountManager:getDefaultCategories(key) + return key and default_categories[key] or default_categories +end + +PermoksAccountManager.ICONSTRINGS = { + left = "\124T%d:18:18\124t %s", + right = "%s \124T%d:18:18\124t", + leftBank = "\124T%d:18:18\124t %s (%s)", + rightBank = "%s (%s) \124T%d:18:18\124t", +} + +PermoksAccountManager.ICONBANKSTRINGS = { + left = "\124T%d:18:18\124t %s (%s)", + right = "%s (%s) \124T%d:18:18\124t", +} diff --git a/db/db.lua b/db/db.lua index a7e4bf5..e118c9b 100644 --- a/db/db.lua +++ b/db/db.lua @@ -1,436 +1,396 @@ local addonName, PermoksAccountManager = ... -local L = LibStub('AceLocale-3.0'):GetLocale(addonName) +local L = LibStub("AceLocale-3.0"):GetLocale(addonName) local default_categories = { - general = { - order = 0, - name = L['General'], - childs = { - 'characterName', - 'ilevel', - 'gold', - 'weekly_key', - 'keystone', - 'mplus_score', - 'catalyst_charges', - 'flightstones', - 'whelpling_crest_s4', - 'drake_crest_s4', - 'wyrm_crest_s4', - 'aspect_crest_s4', - 'spark_awakening', - 'residual_memories', - 'radiant_echoes_prepatch_weeklies', - - - }, - childOrder = { - characterName = 1, - ilevel = 2, - gold = 3, - weekly_key = 4, - keystone = 5, - mplus_score = 6, - catalyst_charges = 7, - flightstones = 8, - whelpling_crest_s4 = 9, - drake_crest_s4 = 10, - wyrm_crest_s4 = 11, - aspect_crest_s4 = 12, - spark_awakening = 13, - residual_memories = 14, - radiant_echoes_prepatch_weeklies = 15, - - - }, - hideToggle = true, - enabled = true - }, - currentdaily = { - order = 1, - name = 'Daily', - childs = { - }, - childOrder = { - }, - enabled = true - }, - currentweekly = { - order = 2, - name = '(Bi)Weekly', - childs = { - 'superbloom', - 'dream_wardens_weekly', - 'ed_wb_wq', - 'dream_shipments', - 'separator1', - 'aiding_the_accord', - 'fyrak_assault', - 'time_rift', - 'dreamsurge_weekly', - 'sparks_of_life', - 'separator3', - 'knowledge_mobs', - 'knowledge_scout_packs', - 'knowledge_treatise', - 'knowledge_weeklies_loot', - 'knowledge_weeklies_craft', - 'knowledge_weeklies_order', - 'show_your_mettle', - }, - childOrder = { - superbloom = 1, - dream_wardens_weekly = 2, - ed_wb_wq = 3, - dream_shipments = 4, - separator1 = 10, - aiding_the_accord = 11, - fyrak_assault = 12, - time_rift = 13, - dreamsurge_weekly = 14, - sparks_of_life = 15, - separator3 = 30, - knowledge_mobs = 31, - knowledge_scout_packs = 32, - knowledge_treatise = 33, - knowledge_weeklies_loot = 34, - knowledge_weeklies_craft = 35, - knowledge_weeklies_order = 36, - show_your_mettle = 37, - }, - enabled = true - }, - vault = { - order = 3, - name = L['Vault'], - childs = { - 'great_vault_mplus', - 'great_vault_raid', - 'great_vault_pvp' - }, - childOrder = { - great_vault_mplus = 1, - great_vault_raid = 2, - great_vault_pvp = 3 - }, - enabled = true - }, - renown = { - order = 4, - name = L['Reputation'], - childs = { - 'dragonscale_expedition', - 'iskaara_tuskar', - 'maruuk_centaur', - 'valdrakken_akkord', - 'loam_niffen', - 'dream_wardens', - 'keg_legs_crew', - 'separator1', - 'winterpelt_furbolg', - 'artisan_consortium', - 'cobalt_assembly', - 'sabellian', - 'wrathion', - 'soridormi' - }, - childOrder = { - dragonscale_expedition = 1, - iskaara_tuskar = 2, - maruuk_centaur = 3, - valdrakken_akkord = 4, - loam_niffen = 5, - dream_wardens = 6, - keg_legs_crew = 7, - separator1 = 10, - winterpelt_furbolg = 11, - artisan_consortium = 12, - cobalt_assembly = 13, - sabellian = 14, - wrathion = 15, - soridormi = 16, - }, - enabled = true - }, - raid = { - order = 5, - name = L['Raid'], - childs = { - 'vault_of_the_incarnates', - 'aberrus_the_shadowed_crucible', - 'amirdrassil_the_dreams_hope', - }, - childOrder = { - vault_of_the_incarnates = 1, - aberrus_the_shadowed_crucible = 2, - amirdrassil_the_dreams_hope = 3 - }, - enabled = true - }, - pvp = { - order = 6, - name = L['PVP'], - childs = { - 'conquest', - 'honor', - 'arenaRating2v2', - 'arenaRating3v3', - 'rbgRating' - }, - childOrder = { - conquest = 1, - honor = 2, - arenaRating2v2 = 3, - arenaRating3v3 = 4, - rbgRating = 5 - }, - enabled = true - }, - old_weekly = { - order = 7, - name = "Old Weekly", - childs = { - 'forbidden_reach_weeklies', - 'forbidden_reach_elite_wqs', - 'separator1', - 'mythics_done', - 'dragonflight_world_boss', - 'zc_wb_wq', - 'grand_hunts', - 'marrukai_camp', - 'sparks_of_life', - 'community_feast_weekly', - 'fish_turnins_df', - 'separator2', - 'trial_of_flood', - 'trial_of_elements', - 'trial_of_storms', - 'separator3', - 'dragonbane_keep_siege', - 'dragonbane_keep_key', - 'dragonbane_keep_weeklies', - }, - childOrder = { - forbidden_reach_weeklies = 1, - forbidden_reach_elite_wqs = 2, - separator1 = 10, - mythics_done = 11, - dragonflight_world_boss = 12, - zc_wb_wq = 13, - grand_hunts = 14, - marrukai_camp = 15, - sparks_of_life = 16, - community_feast_weekly = 17, - fish_turnins_df = 18, - separator2 = 20, - trial_of_flood = 21, - trial_of_elements = 22, - trial_of_storms = 23, - separator3 = 30, - dragonbane_keep_siege = 31, - dragonbane_keep_key = 32, - dragonbane_keep_weeklies = 33, - }, - enabled = true, - }, - old_daily = { - order = 8, - name = "Old Daily", - childs = { - 'community_feast', - 'iskaara_fishing_dailies', - }, - childOrder = { - community_feast = 1, - iskaara_fishing_dailies = 2, - }, - enabled = true, - }, - unlocks = { - order = 9, - name = 'Unlocks', - childs = {}, - childOrder = {}, - enabled = false, - }, + general = { + order = 0, + name = L["General"], + childs = { + "characterName", + "ilevel", + "gold", + "weekly_key", + "keystone", + "mplus_score", + "catalyst_charges", + "adventurer_crest", + "veteran_crest", + "normal_crest", + "hero_crest", + "myth_crest", + "spark_current", + "spark_drops", + + -- Probably interesting during the first weeks, might wanna (re-)move later + "separator2", + "restored_coffer_key", + "undercoin", + "voidlight_marl", + }, + childOrder = { + characterName = 1, + ilevel = 2, + gold = 3, + weekly_key = 4, + keystone = 5, + mplus_score = 6, + catalyst_charges = 7, + adventurer_crest = 8, + veteran_crest = 9, + normal_crest = 10, + hero_crest = 11, + myth_crest = 12, + spark_current = 13, + spark_drops = 14, + + -- Probably interesting during the first weeks, might wanna (re-)move later + separator2 = 20, + restored_coffer_key = 21, + undercoin = 22, + voidlight_marl = 23, + }, + hideToggle = true, + enabled = true, + }, + currentdaily = { + order = 1, + name = "Daily", + childs = {}, + childOrder = {}, + enabled = false, + }, + currentweekly = { + order = 2, + name = "(Bi)Weekly", + childs = { + "mythics_done", + "separator1", + "saltherils_soiree", + "abundance", + "lost_legends", + "stormarion_assault", + }, + childOrder = { + mythics_done = 1, + + separator1 = 10, + saltherils_soiree = 11, + abundance = 12, + lost_legends = 13, + stormarion_assault = 14, + }, + enabled = true, + }, + vault = { + order = 3, + name = L["Vault"], + childs = { + "great_vault_mplus", + "great_vault_raid", + "great_vault_pvp", + }, + childOrder = { + great_vault_mplus = 1, + great_vault_raid = 2, + great_vault_pvp = 3, + }, + enabled = true, + }, + professions = { + order = 4, + name = L["Professions"], + childs = {}, + childOrder = {}, + enabled = true, + }, + renown = { + order = 5, + name = L["Reputation"], + childs = { + "amani_tribe", + "the_singularity", + "harati", + "silvermoon_court", + }, + childOrder = { + amani_tribe = 1, + the_singularity = 2, + harati = 3, + silvermoon_court = 4, + }, + enabled = true, + }, + raid = { + order = 6, + name = L["Raid"], + childs = { + "the_dreamrift", + "the_voidspire", + "march_on_queldanas", + }, + childOrder = { + the_dreamrift = 1, + the_voidspire = 2, + march_on_queldanas = 3, + }, + enabled = true, + }, + pvp = { + order = 7, + name = L["PVP"], + childs = { + "conquest", + "honor", + "arenaRating2v2", + "arenaRating3v3", + "rbgRating", + + "separator3", + "pvp_sparks", + "pvp_weekly", + }, + childOrder = { + conquest = 1, + honor = 2, + arenaRating2v2 = 3, + arenaRating3v3 = 4, + rbgRating = 5, + + separator3 = 30, + pvp_sparks = 31, + pvp_weekly = 32, + }, + enabled = true, + }, + old_weekly = { + order = 8, + name = "Old Weekly", + childs = { + "big_dig", + "show_your_mettle", + }, + childOrder = { + big_dig = 51, + show_your_mettle = 52, + }, + enabled = false, + }, + old_daily = { + order = 9, + name = "Old Daily", + childs = {}, + childOrder = {}, + enabled = false, + }, + unlocks = { + order = 10, + name = "Unlocks", + childs = {}, + childOrder = {}, + enabled = false, + }, } PermoksAccountManager.groups = { - currency = { - label = L['Currency'], - order = 3 - }, - character = { - label = L['Character'], - order = 2 - }, - resetDaily = { - label = L['Daily Reset'], - order = 5 - }, - resetWeekly = { - label = L['Weekly Reset'], - order = 6 - }, - resetBiweekly = { - label = L['Biweekly Reset'], - order = 8, - }, - vault = { - label = L['Vault'], - order = 9 - }, - torghast = { - label = L['Torghast'], - order = 10 - }, - dungeons = { - label = L['Dungeons'], - order = 11 - }, - raids = { - label = L['Raids'], - order = 12 - }, - reputation = { - label = L['Reputation'], - order = 13 - }, - buff = { - label = L['Buff'], - order = 14 - }, - sanctum = { - label = L['Sanctum'], - order = 15 - }, - separator = { - label = L['Separator'], - order = 1 - }, - item = { - label = L['Items'], - order = 15 - }, - pvp = { - label = L['PVP'], - order = 16 - }, - onetime = { - label = L['ETC'], - order = 17 - }, - other = { - label = L['Other'], - order = 18 - }, - profession = { - label = L['Professions'], - order = 19 - } + currency = { + label = L["Currency"], + order = 3, + }, + character = { + label = L["Character"], + order = 2, + }, + resetDaily = { + label = L["Daily Reset"], + order = 5, + }, + resetWeekly = { + label = L["Weekly Reset"], + order = 6, + }, + resetBiweekly = { + label = L["Biweekly Reset"], + order = 8, + }, + vault = { + label = L["Vault"], + order = 9, + }, + torghast = { + label = L["Torghast"], + order = 10, + }, + dungeons = { + label = L["Dungeons"], + order = 11, + }, + raids = { + label = L["Raids"], + order = 12, + }, + reputation = { + label = L["Reputation"], + order = 13, + }, + buff = { + label = L["Buff"], + order = 14, + }, + sanctum = { + label = L["Sanctum"], + order = 15, + }, + separator = { + label = L["Separator"], + order = 1, + }, + item = { + label = L["Items"], + order = 15, + }, + pvp = { + label = L["PVP"], + order = 16, + }, + onetime = { + label = L["ETC"], + order = 17, + }, + other = { + label = L["Other"], + order = 18, + }, + profession = { + label = L["Professions"], + order = 19, + }, } PermoksAccountManager.labelRows = { - separator1 = { - hideLabel = true, - label = 'Separator1', - data = function() - return '' - end, - group = 'separator' - }, - separator2 = { - hideLabel = true, - label = 'Separator2', - data = function() - return '' - end, - group = 'separator' - }, - separator3 = { - hideLabel = true, - label = 'Separator3', - data = function() - return '' - end, - group = 'separator' - }, - separator4 = { - hideLabel = true, - label = 'Separator4', - data = function() - return '' - end, - group = 'separator' - }, - separator5 = { - hideLabel = true, - label = 'Separator5', - data = function() - return '' - end, - group = 'separator' - }, - separator6 = { - hideLabel = true, - label = 'Separator6', - data = function() - return '' - end, - group = 'separator' - } + separator1 = { + hideLabel = true, + label = "Separator1", + data = function() + return "" + end, + group = "separator", + }, + separator2 = { + hideLabel = true, + label = "Separator2", + data = function() + return "" + end, + group = "separator", + }, + separator3 = { + hideLabel = true, + label = "Separator3", + data = function() + return "" + end, + group = "separator", + }, + separator4 = { + hideLabel = true, + label = "Separator4", + data = function() + return "" + end, + group = "separator", + }, + separator5 = { + hideLabel = true, + label = "Separator5", + data = function() + return "" + end, + group = "separator", + }, + separator6 = { + hideLabel = true, + label = "Separator6", + data = function() + return "" + end, + group = "separator", + }, } -PermoksAccountManager.numDungeons = 9 +PermoksAccountManager.numDungeons = 8 PermoksAccountManager.keys = { - [2] = "TJS", -- Temple of the Jade Serpent - [165] = "SBG", -- Shadowmoon Burial Grounds - [369] = 'YARD', -- Operation: Mechagon - Junkyard - [370] = 'WORK', -- Operation: Mechagon - Workshop - [375] = 'MISTS', -- Mists of Tirna Scithe - [376] = 'NW', -- The Necrotic Wage - [377] = 'DOS', -- De Other Side - [378] = 'HOA', -- Halls of Atonement - [379] = 'PF', -- Plaguefall - [380] = 'SD', -- Sanguine Depths - [381] = 'SOA', -- Spires of Ascension - [382] = 'TOP', -- Theater of Pain - [391] = 'STRT', -- Tazavesh: Streets of Wonder - [392] = 'GMBT', -- Tazavesh: So'lesh Gambit - [166] = 'GD', -- Grimrail Depot - [168] = 'EB', -- Everbloom - [169] = 'ID', -- Iron Docks - [197] = 'EOA', -- Eye of Azshara - [198] = 'DHT', -- Darkheart Thicket - [199] = 'BRH', -- Blackrook Hold - [200] = 'HOV', -- Halls of Valor - [206] = 'NL', -- Neltharion's Lair - [207] = 'VOTW', -- Vault of the Wardens - [208] = 'MOS', -- Maw of Souls - [209] = 'ARC', -- The Arcway - [210] = 'COS', -- Court of Stars - [227] = 'LOWR', -- Return to Karazhan: Lower - [233] = 'COEN', -- Cathedral of Eternal Night - [234] = 'UPPR', -- Return to Karathan: Upper - [239] = 'SEAT', -- Seat of the Triumvirate - [244] = 'AD', -- Atal'Dazar - [245] = 'FH', -- Freehold - [248] = 'WM', -- Waycrest Manor - [251] = 'UNDR', -- The Underrot - [399] = 'RLP', -- Ruby Life Pools - [400] = 'NO', -- The Nokhud Offensive - [401] = 'AV', -- The Azure Vault - [402] = 'AA', -- Algeth'ar Academy - [403] = 'ULD', -- Uldaman: Legacy of Tyr - [404] = 'NELT', -- Neltharus - [405] = 'BH', -- Brackenhide Hollow - [406] = 'HOI', -- Halls of Infusion - [438] = 'VP', -- The Vortex Pinnacle - [456] = 'TOTT', -- Throne of the Tides - [463] = 'FALL', -- Dawn of the Infinite: Galakrond's Fall - [464] = 'RISE', -- Dawn of the Infinite: Murozond's Rise + [2] = "TJS", -- Temple of the Jade Serpent + [165] = "SBG", -- Shadowmoon Burial Grounds + [369] = "YARD", -- Operation: Mechagon - Junkyard + [370] = "WORK", -- Operation: Mechagon - Workshop + [375] = "MISTS", -- Mists of Tirna Scithe + [376] = "NW", -- The Necrotic Wage + [377] = "DOS", -- De Other Side + [378] = "HOA", -- Halls of Atonement + [379] = "PF", -- Plaguefall + [380] = "SD", -- Sanguine Depths + [381] = "SOA", -- Spires of Ascension + [382] = "TOP", -- Theater of Pain + [391] = "STRT", -- Tazavesh: Streets of Wonder + [392] = "GMBT", -- Tazavesh: So'lesh Gambit + [166] = "GD", -- Grimrail Depot + [168] = "EB", -- Everbloom + [169] = "ID", -- Iron Docks + [197] = "EOA", -- Eye of Azshara + [198] = "DHT", -- Darkheart Thicket + [199] = "BRH", -- Blackrook Hold + [200] = "HOV", -- Halls of Valor + [206] = "NL", -- Neltharion's Lair + [207] = "VOTW", -- Vault of the Wardens + [208] = "MOS", -- Maw of Souls + [209] = "ARC", -- The Arcway + [210] = "COS", -- Court of Stars + [227] = "LOWR", -- Return to Karazhan: Lower + [233] = "COEN", -- Cathedral of Eternal Night + [234] = "UPPR", -- Return to Karathan: Upper + [239] = "SEAT", -- Seat of the Triumvirate + [244] = "AD", -- Atal'Dazar + [245] = "FH", -- Freehold + [247] = "ML", -- Motherlode + [248] = "WM", -- Waycrest Manor + [251] = "UNDR", -- The Underrot + [353] = "SIEGE", -- Siege of Boralus + [399] = "RLP", -- Ruby Life Pools + [400] = "NO", -- The Nokhud Offensive + [401] = "AV", -- The Azure Vault + [402] = "AA", -- Algeth'ar Academy + [403] = "ULD", -- Uldaman: Legacy of Tyr + [404] = "NELT", -- Neltharus + [405] = "BH", -- Brackenhide Hollow + [406] = "HOI", -- Halls of Infusion + [438] = "VP", -- The Vortex Pinnacle + [456] = "TOTT", -- Throne of the Tides + [463] = "FALL", -- Dawn of the Infinite: Galakrond's Fall + [464] = "RISE", -- Dawn of the Infinite: Murozond's Rise + + -- PLACEHOLDER: abbreviations + [499] = "PSF", -- Priory of the Sacred Flame + [500] = "ROOK", -- The Rookery + [501] = "SV", -- The Stonevault + [502] = "COT", -- City of Threads + [503] = "ARAK", -- Ara-Kara, City of Echoes + [504] = "DFC", -- Darkflame Cleft + [505] = "DAWN", -- The Dawnbreaker + [506] = "BREW", -- Cinderbrew Meadery + [507] = "GB", -- Grim Batol + [525] = "FLOOD", -- Floodgate + [542] = "ECO", -- Eco-Dome Al'dani + + [556] = "POS", -- Pit of Saron + [557] = "WS", -- Windrunner Spire + [558] = "MT", -- Magister's Terrace + [559] = "NPX", -- Nexus-Point Xenas + [560] = "MC", -- Maisara Caverns + [583] = "SEAT", -- Seat of the Triumvirate + [161] = "SR", -- Skyreach } +-- Timewalking Keystones PermoksAccountManager.activityIDToKeys = { [459] = 197, -- EOA [460] = 198, -- DHT @@ -448,1157 +408,1776 @@ PermoksAccountManager.activityIDToKeys = { } PermoksAccountManager.raids = { - [2522] = {name = GetRealZoneText(2522), englishID = 'vault_of_the_incarnates', instanceID = 1200, startIndex = 1, endIndex = 8}, - [2569] = {name = GetRealZoneText(2569), englishID = 'aberrus_the_shadowed_crucible', instanceID = 1208, startIndex = 9, endIndex = 17}, - [2549] = {name = GetRealZoneText(2549), englishID = 'amirdrassil_the_dreams_hope', instanceID = 1207, startIndex = 18, endIndex = 26}, + [2912] = { + name = GetRealZoneText(2912), + englishID = "the_voidspire", + instanceID = 1307, + startIndex = 1, + endIndex = 6, + startAtZero = true, + }, + [2913] = { + name = GetRealZoneText(2913), + englishID = "march_on_queldanas", + instanceID = 1308, + startIndex = 1, + endIndex = 2, + startAtZero = true, + }, + [2939] = { + name = GetRealZoneText(2939), + englishID = "the_dreamrift", + instanceID = 1314, + startIndex = 1, + endIndex = 1, + }, } PermoksAccountManager.dungeons = { - [2451] = GetRealZoneText(2451), - [2515] = GetRealZoneText(2515), - [2516] = GetRealZoneText(2516), - [2519] = GetRealZoneText(2519), - [2520] = GetRealZoneText(2520), - [2521] = GetRealZoneText(2521), - [2526] = GetRealZoneText(2526), - [2527] = GetRealZoneText(2527), - [2579] = GetRealZoneText(2579), + [2805] = GetRealZoneText(2805), -- Windrunner Spire + [2811] = GetRealZoneText(2811), -- Magisters' Terrace + [2813] = GetRealZoneText(2813), -- Murder Row + [2825] = GetRealZoneText(2825), -- Den of Nalorakk + [2859] = GetRealZoneText(2859), -- The Blinding Vale + [2874] = GetRealZoneText(2874), -- Maisara Caverns + [2915] = GetRealZoneText(2915), -- Nexus-Point Xenas + [2923] = GetRealZoneText(2923), -- Voidscar Arena } PermoksAccountManager.item = { - [171276] = {key = 'flask'}, -- Flask - [172045] = {key = 'foodHaste'}, -- Haste Food - [181468] = {key = 'augmentRune'}, -- Rune - [172347] = {key = 'armorKit'}, -- Armor Kit - [171286] = {key = 'oilHeal'}, -- Heal Oil - [171285] = {key = 'oilDPS'}, -- DPS Oil - [171267] = {key = 'potHP'}, -- HP Pot - [172233] = {key = 'drum'}, -- Drum - [171272] = {key = 'potManaInstant'}, -- Mana Pot Instant - [171268] = {key = 'potManaChannel'}, -- Mana Pot Channel - [173049] = {key = 'tome'}, -- Tome - [186017] = {key = 'korthiteCrystal'}, -- Korthite Crystal - [187707] = {key = 'progenitorEssentia'}, -- Progenitor Essentia - [187802] = {key = 'potCosmicHP'}, -- Cosmic HP Pot - [199211] = {key = 'primevalEssence'}, --Primeval Essence - [202196] = {key = 'vaultKey'}, -- Zskera Vault Key - [204193] = {key = 'whelpling_crest'}, -- Whelpling Crest - [204194] = {key = 'aspect_crest'}, -- Aspect Crest - [204195] = {key = 'drake_crest'}, -- Drake Crest - [204196] = {key = 'wyrm_crest'}, -- Wyrm Crest - [204075] = {key = 'whelpling_crest'}, -- Whelpling Fragments - [204076] = {key = 'drake_crest'}, -- Drake Fragments - [204077] = {key = 'wyrm_crest'}, -- Wyrm Fragments - [204078] = {key = 'aspect_crest'}, -- Aspect Fragments - [190453] = {key = 'spark_ingenuity'}, -- Spark of Ingenuity - [199197] = {key = 'spark_ingenuity'}, -- Bottled Essence - [204440] = {key = 'spark_shadowflame'}, -- Spark of Shadowflame - [204717] = {key = 'spark_shadowflame'}, -- Splintered Spark of Shadowflame - [204715] = {key = 'unearthed_fragrant_coin'}, -- Unearthed Fragrant Coin - [204985] = {key = 'barter_brick'}, -- Barter Brick - [206959] = {key = 'spark_dreams'}, -- Spark of Dreams - [208396] = {key = 'spark_dreams'}, -- Splintered Spark of Dreams - [202171] = {key = 'obsidian_flightstone'}, -- Obsidian Flightstone - [207030] = {key = 'dilated_time_capsule'}, -- Dilated Time Capsule - [209856] = {key = 'dilated_time_pod'}, -- Dilated Time Pod - [207026] = {key = 'dreamsurge_coalescence'}, -- Dreamsurge Coalescence - [208153] = {key = 'dreamsurge_chrysalis'}, -- Dreamsurge Chrysalis - [210254] = {key = 'dreamsurge_cocoon'}, -- Dreamsurge Cocoon - [208066] = {key = 'dreamseeds'}, -- Small Dreamseed - [208067] = {key = 'dreamseeds'}, -- Plump Dreamseed - [208047] = {key = 'dreamseeds'}, -- Gigantic Dreamseed - [211515] = {key = 'spark_awakening'}, -- Splintered Spark of Awakening - [211516] = {key = 'spark_awakening'}, -- Spark of Awakening + [171276] = { key = "flask" }, -- Flask + [172045] = { key = "foodHaste" }, -- Haste Food + [181468] = { key = "augmentRune" }, -- Rune + [172347] = { key = "armorKit" }, -- Armor Kit + [171286] = { key = "oilHeal" }, -- Heal Oil + [171285] = { key = "oilDPS" }, -- DPS Oil + [171267] = { key = "potHP" }, -- HP Pot + [172233] = { key = "drum" }, -- Drum + [171272] = { key = "potManaInstant" }, -- Mana Pot Instant + [171268] = { key = "potManaChannel" }, -- Mana Pot Channel + [173049] = { key = "tome" }, -- Tome + [186017] = { key = "korthiteCrystal" }, -- Korthite Crystal + [187707] = { key = "progenitorEssentia" }, -- Progenitor Essentia + [187802] = { key = "potCosmicHP" }, -- Cosmic HP Pot + [199211] = { key = "primevalEssence" }, --Primeval Essence + [202196] = { key = "vaultKey" }, -- Zskera Vault Key + [190453] = { key = "spark_ingenuity" }, -- Spark of Ingenuity + [199197] = { key = "spark_ingenuity" }, -- Bottled Essence + [204440] = { key = "spark_shadowflame" }, -- Spark of Shadowflame + [204717] = { key = "spark_shadowflame" }, -- Splintered Spark of Shadowflame + [204715] = { key = "unearthed_fragrant_coin" }, -- Unearthed Fragrant Coin + [204985] = { key = "barter_brick" }, -- Barter Brick + [206959] = { key = "spark_dreams" }, -- Spark of Dreams + [208396] = { key = "spark_dreams" }, -- Splintered Spark of Dreams + [202171] = { key = "obsidian_flightstone" }, -- Obsidian Flightstone + [207030] = { key = "dilated_time_capsule" }, -- Dilated Time Capsule + [209856] = { key = "dilated_time_pod" }, -- Dilated Time Pod + [207026] = { key = "dreamsurge_coalescence" }, -- Dreamsurge Coalescence + [208153] = { key = "dreamsurge_chrysalis" }, -- Dreamsurge Chrysalis + [210254] = { key = "dreamsurge_cocoon" }, -- Dreamsurge Cocoon + [208066] = { key = "dreamseeds" }, -- Small Dreamseed + [208067] = { key = "dreamseeds" }, -- Plump Dreamseed + [208047] = { key = "dreamseeds" }, -- Gigantic Dreamseed + [211515] = { key = "spark_awakening" }, -- Splintered Spark of Awakening + [211516] = { key = "spark_awakening" }, -- Spark of Awakening + [190456] = { key = "artisans_mettle" }, -- Artisan's Mettle + + --- TWW items + [211297] = { key = "spark_omens" }, -- Fractured Spark of Omens + [211296] = { key = "spark_omens" }, -- Spark of Omens + [210814] = { key = "artisans_acuity" }, -- Artisan's Acuity + [206350] = { key = "radiant_remnant" }, -- Radiant Remnant + [235897] = { key = "radiant_echo" }, -- Radiant Echo + [212493] = { key = "firelight_ruby" }, -- Odd Glob of Wax + [224642] = { key = "firelight_ruby" }, -- Firelight Ruby + [229899] = { key = "coffer_key_shard" }, -- Coffer Key Shard + [231510] = { key = "timewarped_relic_coffer_key" }, -- Timewarped Relic Coffer Key LFR + [232365] = { key = "timewarped_relic_coffer_key" }, -- Timewarped Relic Coffer Key Normal + [232366] = { key = "timewarped_relic_coffer_key" }, -- Timewarped Relic Coffer Key Heroic + + -- 11.1 + [230905] = { key = "spark_current" }, -- Fractured Spark of Fortunes + [230906] = { key = "spark_current" }, -- Spark of Fortunes + + -- 11.2 + [231757] = { key = "spark_current" }, -- Fractured Spark of Starlight + [231756] = { key = "spark_current" }, -- Spark of Starlight + + -- 12.0 + [232875] = { key = "spark_current" }, -- Spark of Radiance } PermoksAccountManager.factions = { - [2432] = {name = "Ve'nari", paragon = true, type = 'friend'}, - [2472] = {name = "The Archivists' Codex", paragon = true, type = 'friend'}, - [2407] = {name = 'The Ascended', paragon = true}, - [2465] = {name = 'The Wild Hunt', paragon = true}, - [2410] = {name = 'The Undying Army', paragon = true}, - [2413] = {name = 'Court of Harvesters', paragon = true}, - [2470] = {name = "Death's Advance", paragon = true}, - [2478] = {name = 'The Enlightened', paragon = true}, - [2480] = {name = 'Automa', paragon = true}, - [2503] = {name = 'Maruuk Centaur', paragon = true, type = 'renown'}, - [2507] = {name = 'Dragonscale Expedition', paragon = true, type = 'renown'}, - [2510] = {name = 'Valdrakken Akkord', paragon = true, type = 'renown'}, - [2511] = {name = 'Iskaara Tuskar', paragon = true, type = 'renown'}, - [2517] = {name = 'Wrathion', paragon = true, type = 'friend'}, - [2518] = {name = 'Sabellian', paragon = true, type = 'friend'}, - [2526] = {name = 'Winterpelt Furbolg', paragon = true}, - [2544] = {name = 'Artisan\'s Consortium', paragon = true, type = 'friend'}, - [2550] = {name = 'Cobalt Assembly', paragon = true, type = 'friend'}, - [2553] = {name = 'Soridormi', paragon = true, type = 'friend'}, - [2564] = {name = 'Loamm Niffen', paragon = true, type = 'renown'}, - [2568] = {name = 'Glimmerogg Racer'}, - [2574] = {name = 'Dream Wardens', paragonn = true, type = 'renown'}, - [2593] = {name = 'Keg Leg\'s Crew', type = 'renown'} + [2432] = { name = "Ve'nari", paragon = true, type = "friend" }, + [2472] = { name = "The Archivists' Codex", paragon = true, type = "friend" }, + [2407] = { name = "The Ascended", paragon = true }, + [2465] = { name = "The Wild Hunt", paragon = true }, + [2410] = { name = "The Undying Army", paragon = true }, + [2413] = { name = "Court of Harvesters", paragon = true }, + [2470] = { name = "Death's Advance", paragon = true }, + [2478] = { name = "The Enlightened", paragon = true }, + [2480] = { name = "Automa", paragon = true }, + [2503] = { name = "Maruuk Centaur", paragon = true, type = "renown", warband = "unique" }, + [2507] = { name = "Dragonscale Expedition", paragon = true, type = "renown", warband = "unique" }, + [2510] = { name = "Valdrakken Akkord", paragon = true, type = "renown", warband = "unique" }, + [2511] = { name = "Iskaara Tuskar", paragon = true, type = "renown", warband = "unique" }, + [2517] = { name = "Wrathion", paragon = true, type = "friend", warband = "unique" }, + [2518] = { name = "Sabellian", paragon = true, type = "friend", warband = "unique" }, + [2526] = { name = "Winterpelt Furbolg", paragon = true }, + [2544] = { name = "Artisan's Consortium", paragon = true, type = "friend", warband = "unique" }, + [2550] = { name = "Cobalt Assembly", paragon = true, type = "friend", warband = "unique" }, + [2553] = { name = "Soridormi", paragon = true, type = "friend", warband = "unique" }, + [2564] = { name = "Loamm Niffen", paragon = true, type = "renown", warband = "unique" }, + [2568] = { name = "Glimmerogg Racer" }, + [2574] = { name = "Dream Wardens", paragon = true, type = "renown", warband = "unique" }, + [2593] = { name = "Keg Leg's Crew", type = "renown", warband = "unique" }, + [2590] = { name = "Council of Dornogal", paragon = true, type = "renown", warband = "unique" }, + [2570] = { name = "Hallowfall Arathi", paragon = true, type = "renown", warband = "unique" }, + [2594] = { name = "The Assembly of the Deeps", paragon = true, type = "renown", warband = "unique" }, + [2600] = { name = "The Severed Threads", paragon = true, type = "renown", warband = "unique" }, + [2605] = { name = "The General", paragon = true, type = "friend", warband = "unique" }, + [2607] = { name = "The Vizier", paragon = true, type = "friend", warband = "unique" }, + [2601] = { name = "The Weaver", paragon = true, type = "friend", warband = "unique" }, + [2640] = { name = "Brann Bronzebeard", type = "friend", warband = "unique" }, + + -- 11.1 + [2653] = { name = "The Cartels of Undermine", paragon = true, type = "renown", warband = "unique" }, + [2669] = { name = "Darkfuse Solutions", paragon = true, type = "renown", warband = "unique" }, + [2671] = { name = "Venture Company", paragon = true, warband = "unique" }, + [2673] = { name = "Bilgewater Cartel", paragon = true, warband = "unique" }, + [2675] = { name = "Blackwater Cartel", paragon = true, warband = "unique" }, + [2677] = { name = "Steamwheedle Cartel", paragon = true, warband = "unique" }, + [2685] = { name = "Gallagio Loyalty Rewards Club", paragon = true, type = "renown", warband = "unique" }, + [2688] = { name = "Flame's Radiance", paragon = true, warband = "unique" }, + + -- 11.2 + [2658] = { name = "The K'aresh Trust", paragon = true, type = "renown", warband = "unique" }, + [2736] = { name = "Manaforge Vandals", type = "renown", warband = "unique" }, + + -- 12.0 + [2696] = { name = "Amani Tribe", paragon = true, type = "renown", warband = "unique" }, + [2699] = { name = "The Singularity", paragon = true, type = "renown", warband = "unique" }, + [2704] = { name = "Hara'ti", paragon = true, type = "renown", warband = "unique" }, + [2710] = { name = "Silvermoon Court", paragon = true, type = "renown", warband = "unique" }, } PermoksAccountManager.currency = { - [1602] = 0, - [1767] = 0, - [1792] = 0, - [1810] = 0, - [1813] = 0, - [1828] = 0, - [1191] = 0, - [1931] = 0, - [1904] = 0, - [1906] = 0, - [1977] = 0, - [1822] = 1, - [1979] = 0, - [2000] = 0, - [2003] = 0, - [2009] = 0, - [2118] = 0, -- Elemental Overflow - [2122] = 0, -- Storm Sigil - [2123] = 0, -- Bloody Tokens - [2166] = 0, -- Renascent Lifeblood (Crucible Charges DF Season 1) - [2245] = 0, -- Flightstones - [2409] = 0, -- Whelpling Crest Fragment Tracker - [2410] = 0, -- Drake Crest Fragment Tracker - [2411] = 0, -- Wyrm Crest Fragment Tracker - [2412] = 0, -- Aspect Crest Fragment Tracker - [2533] = 0, -- Renascent Shadowflame (Crucible Charges DF Season 2) - [2594] = 0, -- Paracausal Flakes - [2650] = 0, -- Emerald Dewdrop - [2651] = 0, -- Seedbloom - [2706] = 0, -- Whelpling's Dreaming Crest - [2707] = 0, -- Drake's Dreaming Crest - [2708] = 0, -- Wyrm's Dreaming Crest - [2709] = 0, -- Aspect's Dreaming Crest - [2777] = 0, -- Dream Infusion - [2796] = 0, -- Renascent Dream (Crucible Charges DF Season 3) - [2806] = 0, -- Whelpling Awakened Crest - [2807] = 0, -- Drake's Awakened Crest - [2809] = 0, -- Wyrm's Awakened Crest - [2812] = 0, -- Aspect's Awakened Crest - [2912] = 0, -- Renascent Awakening (Crucible Charges DF Season 4) - [3089] = 0, -- Residual Memories (11.0 prepatch currency) + [1602] = 0, + [1767] = 0, + [1792] = 0, + [1810] = 0, + [1813] = 0, + [1828] = 0, + [1191] = 0, + [1931] = 0, + [1904] = 0, + [1906] = 0, + [1977] = 0, + [1822] = 1, -- Renown + [1979] = 0, + [2000] = 0, + [2003] = 0, -- Dragon Isles Supplies + [2009] = 0, + [2118] = 0, -- Elemental Overflow + [2122] = 0, -- Storm Sigil + [2123] = 0, -- Bloody Tokens + [2166] = 0, -- Renascent Lifeblood (Crucible Charges DF Season 1) + [2245] = 0, -- Flightstones + [2533] = 0, -- Renascent Shadowflame (Crucible Charges DF Season 2) + [2594] = 0, -- Paracausal Flakes + [2650] = 0, -- Emerald Dewdrop + [2651] = 0, -- Seedbloom + [2777] = 0, -- Dream Infusion + [2796] = 0, -- Renascent Dream (Crucible Charges DF Season 3) + [2806] = 0, -- Whelpling Awakened Crest + [2807] = 0, -- Drake's Awakened Crest + [2809] = 0, -- Wyrm's Awakened Crest + [2812] = 0, -- Aspect's Awakened Crest + [2912] = 0, -- Renascent Awakening (Crucible Charges DF Season 4) + [3089] = 0, -- Residual Memories (11.0 prepatch currency) + [3149] = 0, -- Displaced Corrupted Mementos + + -- TWW Currencies + [2914] = 0, -- Weathered Harbinger Crest + [2915] = 0, -- Carved Harbinger Crest + [2916] = 0, -- Runed Harbinger Crest + [2917] = 0, -- Gilded Harbinger Crest + [2813] = 0, -- Harmonized Silk (Crucible Charges TWW Season 1) + [3008] = 0, -- Valorstones + [2815] = 0, -- Resonance Crystals + [3056] = 0, -- Kej + [3028] = 0, -- Restored Coffer Key + [2803] = 0, -- Undercoin + + [3107] = 0, -- Weathered Undermine Crest + [3108] = 0, -- Carved Undermine Crest + [3109] = 0, -- Runed Undermine Crest + [3110] = 0, -- Gilded Undermine Crest + [3116] = 0, -- Essence of Kaja'mite (Catalyst Charges TWW Season 2) + + [3132] = 0, -- Spark Drops + [3218] = 0, -- Empty Kaja'Cola Can + [3220] = 0, -- Vintage Kaja'Cola Can + + [3100] = 0, -- Bronze Celebration Token + [1166] = 0, -- Timewarped Badge + + -- 11.2 + [3141] = 0, -- Starlight Spark Dust + + [3284] = 0, -- Weathered Ethereal Crest + [3286] = 0, -- Carved Ethereal Crest + [3288] = 0, -- Runed Ethereal Crest + [3290] = 0, -- Gilded Ethereal Crest + + [3269] = 0, -- Ethereal Voidsplinter (Catalyst Charges TWW Season 3) + + -- 12.0 + [3383] = 0, -- Adventurer Dawncrest + [3341] = 0, -- Veteran Dawncrest + [3343] = 0, -- Champion Dawncrest + [3345] = 0, -- Hero Dawncrest + [3347] = 0, -- Myth Dawncrest + + [3212] = 0, -- Radiant Spark Dust + [3378] = 0, -- Dawnlight Manaflux (Catalyst Charges Midnight Season 1) + + [3316] = 0, -- Voidlight Marl + [3376] = 0, -- Shard of Dundun + + [3310] = 0, -- Coffer Key Shards +} + +PermoksAccountManager.currencyTrees = { + [1057] = { + systemID = 20, + currencyType = 3728, -- 3728 = Echo of N'Zoth + }, } PermoksAccountManager.currencyCustomOptions = { - [2166] = {currencyUpdate = 2167}, - [2533] = {forceUpdate = true}, - [2709] = {forceUpdate = true}, - [2707] = {forceUpdate = true}, - [2706] = {forceUpdate = true}, - [2708] = {forceUpdate = true}, + [2166] = { currencyUpdate = 2167 }, + [2533] = { forceUpdate = true }, + [2709] = { forceUpdate = true }, + [2707] = { forceUpdate = true }, + [2706] = { forceUpdate = true }, + [2708] = { forceUpdate = true }, + [3107] = { forceUpdate = true }, + [3108] = { forceUpdate = true }, + [3109] = { forceUpdate = true }, + [3110] = { forceUpdate = true }, + [3284] = { forceUpdate = true }, + [3286] = { forceUpdate = true }, + [3288] = { forceUpdate = true }, + [3290] = { forceUpdate = true }, + [3383] = { forceUpdate = true }, + [3341] = { forceUpdate = true }, + [3343] = { forceUpdate = true }, + [3345] = { forceUpdate = true }, + [3347] = { forceUpdate = true }, + [3310] = { forceUpdate = true }, } PermoksAccountManager.research = { - [1902] = 'zereth_mortis_three_dailies', - [1972] = 'zereth_mortis_three_wqs' + [1902] = "zereth_mortis_three_dailies", + [1972] = "zereth_mortis_three_wqs", } PermoksAccountManager.professionCDs = { - [L['Tailoring']] = { + [L["Tailoring"]] = { cds = { - [376556] = true, -- Azureweave Bolt + [376556] = true, -- Azureweave Bolt [376557] = true, -- Chronocloth Bolt }, }, - [L['Alchemy']] = { + [L["Alchemy"]] = {}, + [L["Leatherworking"]] = {}, + [L["Enchanting"]] = {}, + [L["Engineering"]] = {}, + [L["Blacksmithing"]] = {}, + [L["Herbalism"]] = {}, + [L["Mining"]] = {}, + [L["Skinning"]] = {}, + [L["Jewelcrafting"]] = {}, +} + +-- key is the SkillLineID of the parentProfession +PermoksAccountManager.childProfessions = { + df_profession = { + [164] = { spellID = 365677, skillLineID = 2822 }, -- Blacksmithing + [165] = { spellID = 366249, skillLineID = 2830 }, -- Leatherworking + [171] = { spellID = 366261, skillLineID = 2823 }, -- Alchemy + [182] = { spellID = 366252, skillLineID = 2832 }, -- Herbalism + [185] = { spellID = 366256, skillLineID = 2824 }, -- Cooking + [186] = { spellID = 366260, skillLineID = 2833 }, -- Mining + [197] = { spellID = 366258, skillLineID = 2831 }, -- Tailoring + [202] = { spellID = 366254, skillLineID = 2827 }, -- Engineering + [333] = { spellID = 366255, skillLineID = 2825 }, -- Enchanting + [356] = { spellID = 366253, skillLineID = 2826 }, -- Fishing + [393] = { spellID = 366259, skillLineID = 2834 }, -- Skinning + [755] = { spellID = 366250, skillLineID = 2829 }, -- Jewelcrafting + [773] = { spellID = 366251, skillLineID = 2828 }, -- Inscription + }, + tww_profession = { + [164] = { spellID = 423332, skillLineID = 2872 }, -- Blacksmithing + [165] = { spellID = 423340, skillLineID = 2880 }, -- Leatherworking + [171] = { spellID = 423321, skillLineID = 2871 }, -- Alchemy + [182] = { spellID = 441327, skillLineID = 2877 }, -- Herbalism + [185] = { spellID = 423333, skillLineID = 2873 }, -- Cooking + [186] = { spellID = 423341, skillLineID = 2881 }, -- Mining + [197] = { spellID = 423343, skillLineID = 2883 }, -- Tailoring + [202] = { spellID = 423335, skillLineID = 2875 }, -- Engineering + [333] = { spellID = 423334, skillLineID = 2874 }, -- Enchanting + [356] = { spellID = 423336, skillLineID = 2876 }, -- Fishing + [393] = { spellID = 423342, skillLineID = 2882 }, -- Skinning + [755] = { spellID = 423339, skillLineID = 2879 }, -- Jewelcrafting + [773] = { spellID = 423338, skillLineID = 2878 }, -- Inscription + }, +} + +PermoksAccountManager.quests = { + + -- General Weeklies (previous expansion quests get deprecated so we replace these IDs instead of adding new ones) + weekend_event = { + [83366] = { questType = "weekly", log = true }, -- The World Awaits (World Quests) + [83357] = { questType = "weekly", log = true }, -- The Very Best (Pet Battles) + [83358] = { questType = "weekly", log = true }, -- The Arena Calls (Arena) + [83347] = { questType = "weekly", log = true }, -- Emmissary of War (Mythic Dungeons) + [86731] = { questType = "weekly", log = true }, -- An Original Path Through Time (Timewalking Dungeons) + [83362] = { questType = "weekly", log = true }, -- A Shrouded Path Through Time (Timewalking Dungeons, Pandaria) + [83359] = { questType = "weekly", log = true }, -- A Shattered Path Through Time (Timewalking Dungeons) + [88805] = { questType = "weekly", log = true }, -- A Scarred Path Through Time (Timewalking Dungeons) + [83364] = { questType = "weekly", log = true }, -- A Savage Path Through Time (Timewalking Dungeons) + [83365] = { questType = "weekly", log = true }, -- A Frozen Path Through Time (Timewaling Dungeons, Wrath of the Lich King) + [83360] = { questType = "weekly", log = true }, -- A Fel Path Through Time (Timewalking Dungeons, Legion) + [84476] = { questType = "weekly", log = true }, -- A Call to Delves (Delves) + [83363] = { questType = "weekly", log = true }, -- A Burning Path Through Time (Timewalking Dungeons, Burning Crusade) + }, + pvp_weekly = { + [80184] = { questType = "weekly", log = true }, -- Preserving in Battle + [80185] = { questType = "weekly", log = true }, -- Preserving Solo + [80186] = { questType = "weekly", log = true }, -- Preserving in War + [80187] = { questType = "weekly", log = true }, -- Preserving in Skirmishes + [80188] = { questType = "weekly", log = true }, -- Preserving in Arenas + [80189] = { questType = "weekly", log = true }, -- Preserving Teamwork }, - [L['Leatherworking']] = { + pvp_sparks = { + [81793] = { questType = "weekly", log = true }, -- Sparks of War: Isle of Dorn + [81794] = { questType = "weekly", log = true }, -- Sparks of War: The Ringing Deeps + [81795] = { questType = "weekly", log = true }, -- Sparks of War: Hallowfall + [81796] = { questType = "weekly", log = true }, -- Sparks of War: Azj-Kahet }, - [L['Enchanting']] = { + dungeon_weekly = { + [83432] = { questType = "weekly", warband = true, log = true }, -- The Rookery + [83436] = { questType = "weekly", warband = true, log = true }, -- Cinderbrew Meadery + [83443] = { questType = "weekly", warband = true, log = true }, -- Darkflame Cleft + [83457] = { questType = "weekly", warband = true, log = true }, -- The Stonevault + [83458] = { questType = "weekly", warband = true, log = true }, -- Priory of the Sacred Flame + [83459] = { questType = "weekly", warband = true, log = true }, -- The Dawnbreaker + [83465] = { questType = "weekly", warband = true, log = true }, -- Ara-Kara, City of Echoes + [83469] = { questType = "weekly", warband = true, log = true }, -- City of Threads }, - [L['Engineering']] = { + + -- 9.0 Shadowlands + maw_dailies = { + [60732] = { questType = "daily", log = true }, + [61334] = { questType = "daily", log = true }, + [62239] = { questType = "daily", log = true }, + [63031] = { questType = "daily", log = true }, + [63038] = { questType = "daily", log = true }, + [63039] = { questType = "daily", log = true }, + [63040] = { questType = "daily", log = true }, + [63043] = { questType = "daily", log = true }, + [63045] = { questType = "daily", log = true }, + [63047] = { questType = "daily", log = true }, + [63050] = { questType = "daily", log = true }, + [63062] = { questType = "daily", log = true }, + [63069] = { questType = "daily", log = true }, + [63072] = { questType = "daily", log = true }, + [63100] = { questType = "daily", log = true }, + [63179] = { questType = "daily", log = true }, + [60622] = { questType = "weekly", log = true }, + [60646] = { questType = "weekly", log = true }, + [60762] = { questType = "weekly", log = true }, + [60775] = { questType = "weekly", log = true }, + [60902] = { questType = "weekly", log = true }, + [61075] = { questType = "weekly", log = true }, + [61079] = { questType = "weekly", log = true }, + [61088] = { questType = "weekly", log = true }, + [61103] = { questType = "weekly", log = true }, + [61104] = { questType = "weekly", log = true }, + [61765] = { questType = "weekly", log = true }, + [62214] = { questType = "weekly", log = true }, + [62234] = { questType = "weekly", log = true }, + [63206] = { questType = "weekly", log = true }, }, - [L['Blacksmithing']] = { + transport_network = { + -- Kyrian + -- Venthyr + -- Night Fae + [62614] = { covenant = 3, sanctum = 2, minSanctumTier = 1, questType = "daily", log = true }, + [62615] = { covenant = 3, sanctum = 2, minSanctumTier = 1, questType = "daily", log = true }, + [62611] = { covenant = 3, sanctum = 2, minSanctumTier = 1, questType = "daily", log = true }, + [62610] = { covenant = 3, sanctum = 2, minSanctumTier = 1, questType = "daily", log = true }, + [62606] = { covenant = 3, sanctum = 2, minSanctumTier = 1, questType = "daily", log = true }, + [62608] = { covenant = 3, sanctum = 2, minSanctumTier = 1, questType = "daily", log = true }, + [60175] = { covenant = 3, sanctum = 2, minSanctumTier = 1, questType = "daily", log = true }, + [62607] = { covenant = 3, sanctum = 2, minSanctumTier = 1, questType = "daily", log = true }, + [62453] = { covenant = 3, sanctum = 2, minSanctumTier = 2, questType = "daily", log = true }, + [62296] = { covenant = 3, sanctum = 2, minSanctumTier = 2, questType = "daily", log = true }, + [60153] = { covenant = 3, sanctum = 2, minSanctumTier = 2, questType = "daily", log = true }, + [62382] = { covenant = 3, sanctum = 2, minSanctumTier = 2, questType = "daily", log = true }, + [62263] = { covenant = 3, sanctum = 2, minSanctumTier = 3, questType = "daily", log = true }, + [62459] = { covenant = 3, sanctum = 2, minSanctumTier = 3, questType = "daily", log = true }, + [62466] = { covenant = 3, sanctum = 2, minSanctumTier = 3, questType = "daily", log = true }, + [60188] = { covenant = 3, sanctum = 2, minSanctumTier = 3, questType = "daily", log = true }, + [62465] = { covenant = 3, sanctum = 2, minSanctumTier = 3, questType = "daily", log = true }, }, - [L['Herbalism']] = { + korthia_dailies = { + [63775] = { questType = "daily", log = true }, + [63776] = { questType = "daily", log = true }, + [63777] = { questType = "daily", log = true }, + [63778] = { questType = "daily", log = true }, + [63779] = { questType = "daily", log = true }, + [63780] = { questType = "daily", log = true }, + [63781] = { questType = "daily", log = true }, + [63782] = { questType = "daily", log = true }, + [63783] = { questType = "daily", log = true }, + [63784] = { questType = "daily", log = true }, + [63785] = { questType = "daily", log = true }, + [63786] = { questType = "daily", log = true }, + [63787] = { questType = "daily", log = true }, + [63788] = { questType = "daily", log = true }, + [63789] = { questType = "daily", log = true }, + [63790] = { questType = "daily", log = true }, + [63791] = { questType = "daily", log = true }, + [63792] = { questType = "daily", log = true }, + [63793] = { questType = "daily", log = true }, + [63794] = { questType = "daily", log = true }, + [63934] = { questType = "daily", log = true }, + [63935] = { questType = "daily", log = true }, + [63936] = { questType = "daily", log = true }, + [63937] = { questType = "daily", log = true }, + [63950] = { questType = "daily", log = true }, + [63954] = { questType = "daily", log = true }, + [63955] = { questType = "daily", log = true }, + [63956] = { questType = "daily", log = true }, + [63957] = { questType = "daily", log = true }, + [63958] = { questType = "daily", log = true }, + [63959] = { questType = "daily", log = true }, + [63960] = { questType = "daily", log = true }, + [63961] = { questType = "daily", log = true }, + [63962] = { questType = "daily", log = true }, + [63963] = { questType = "daily", log = true }, + [63964] = { questType = "daily", log = true }, + [63965] = { questType = "daily", log = true }, + [63989] = { questType = "daily", log = true }, + [64015] = { questType = "daily", log = true }, + [64016] = { questType = "daily", log = true }, + [64017] = { questType = "daily", log = true }, + [64043] = { questType = "daily", log = true }, + [64065] = { questType = "daily", log = true }, + [64070] = { questType = "daily", log = true }, + [64080] = { questType = "daily", log = true }, + [64089] = { questType = "daily", log = true }, + [64101] = { questType = "daily", log = true }, + [64103] = { questType = "daily", log = true }, + [64104] = { questType = "daily", log = true }, + [64129] = { questType = "daily", log = true }, + [64166] = { questType = "daily", log = true }, + [64194] = { questType = "daily", log = true }, + [64432] = { questType = "daily", log = true }, }, - [L['Mining']] = { + zereth_mortis_dailies = { + [64579] = { questType = "daily", log = true }, + [64592] = { questType = "daily", log = true }, + [64717] = { questType = "daily", log = true }, + [64785] = { questType = "daily", log = true }, + [64854] = { questType = "daily", log = true }, + [64964] = { questType = "daily", log = true }, + [64977] = { questType = "daily", log = true }, + [65033] = { questType = "daily", log = true }, + [65072] = { questType = "daily", log = true }, + [65096] = { questType = "daily", log = true }, + [65142] = { questType = "daily", log = true }, + [65177] = { questType = "daily", log = true }, + [65226] = { questType = "daily", log = true }, + [65255] = { questType = "daily", log = true }, + [65256] = { questType = "daily", log = true }, + [65264] = { questType = "daily", log = true }, + [65265] = { questType = "daily", log = true }, + [65268] = { questType = "daily", log = true }, + [65269] = { questType = "daily", log = true }, + [65325] = { questType = "daily", log = true }, + [65326] = { questType = "daily", log = true }, + [65362] = { questType = "daily", log = true }, + [65363] = { questType = "daily", log = true }, + [65364] = { questType = "daily", log = true }, + [65445] = { questType = "daily", log = true }, }, - [L['Skinning']] = { + zereth_mortis_wqs = { + [64960] = { questType = "daily" }, + [64974] = { questType = "daily" }, + [65081] = { questType = "daily" }, + [65089] = { questType = "daily" }, + [65102] = { questType = "daily" }, + [65115] = { questType = "daily" }, + [65117] = { questType = "daily" }, + [65119] = { questType = "daily" }, + [65232] = { questType = "daily" }, + [65234] = { questType = "daily" }, + [65230] = { questType = "daily" }, + [65244] = { questType = "daily" }, + [65252] = { questType = "daily" }, + [65262] = { questType = "daily" }, + [65402] = { questType = "daily" }, + [65403] = { questType = "daily" }, + [65405] = { questType = "daily" }, + [65406] = { questType = "daily" }, + [65407] = { questType = "daily" }, + [65408] = { questType = "daily" }, + [65409] = { questType = "daily" }, + [65410] = { questType = "daily" }, + [65411] = { questType = "daily" }, + [65412] = { questType = "daily" }, + [65413] = { questType = "daily" }, + [65414] = { questType = "daily" }, + [65415] = { questType = "daily" }, + [65416] = { questType = "daily" }, + [65417] = { questType = "daily" }, + }, + conductor = { + [61691] = { covenant = 3, sanctum = 1, minSanctumTier = 1, addToMax = 1, questType = "daily" }, -- Large Lunarlight Pod + [61633] = { covenant = 3, sanctum = 1, minSanctumTier = 1, addToMax = 1, questType = "daily" }, -- Dreamsong Fenn + -- Necrolords + [58872] = { covenant = 4, sanctum = 1, minSanctumTier = 1, addToMax = 1, questType = "daily" }, -- Gieger + [61647] = { covenant = 4, sanctum = 1, minSanctumTier = 1, addToMax = 1, questType = "daily" }, -- Chosen Runecoffer + }, + riftbound_cache = { + [64456] = { questType = "daily" }, + [64470] = { questType = "daily" }, + [64471] = { questType = "daily" }, + [64472] = { questType = "daily" }, + }, + relic_creatures = { + [64341] = { questType = "daily" }, + [64342] = { questType = "daily" }, + [64343] = { questType = "daily" }, + [64344] = { questType = "daily" }, + [64747] = { questType = "daily" }, + [64748] = { questType = "daily" }, + [64749] = { questType = "daily" }, + [64750] = { questType = "daily" }, + [64751] = { questType = "daily" }, + [64752] = { questType = "daily" }, + [64753] = { questType = "daily" }, + [64754] = { questType = "daily" }, + [64755] = { questType = "daily" }, + [64756] = { questType = "daily" }, + [64757] = { questType = "daily" }, + }, + helsworn_chest = { + [64256] = { questType = "daily" }, + }, + relic_gorger = { + [64433] = { questType = "daily" }, + [64434] = { questType = "daily" }, + [64435] = { questType = "daily" }, + [64436] = { questType = "daily" }, + }, + jiro_cyphers = { + [65144] = { questType = "daily" }, -- Creatii + [65166] = { questType = "daily" }, -- Genesii + [65167] = { questType = "daily" }, -- Nascii + }, + maw_souls = { + [61332] = { covenant = 1, questType = "weekly", log = true }, -- kyrian 5 souls + [62861] = { covenant = 1, questType = "weekly", log = true }, -- kyrian 10 souls + [62862] = { covenant = 1, questType = "weekly", log = true }, -- kyrian 15 souls + [62863] = { covenant = 1, questType = "weekly", log = true }, -- kyrian 20 souls + [61334] = { covenant = 2, questType = "weekly", log = true }, -- venthyr 5 souls + [62867] = { covenant = 2, questType = "weekly", log = true }, -- venthyr 10 souls + [62868] = { covenant = 2, questType = "weekly", log = true }, -- venthyr 15 souls + [62869] = { covenant = 2, questType = "weekly", log = true }, -- venthyr 20 souls + [61331] = { covenant = 3, questType = "weekly", log = true }, -- night fae 5 souls + [62858] = { covenant = 3, questType = "weekly", log = true }, -- night fae 10 souls + [62859] = { covenant = 3, questType = "weekly", log = true }, -- night fae 15 souls + [62860] = { covenant = 3, questType = "weekly", log = true }, -- night fae 20 souls + [61333] = { covenant = 4, questType = "weekly", log = true }, -- necro 5 souls + [62864] = { covenant = 4, questType = "weekly", log = true }, -- necro 10 souls + [62865] = { covenant = 4, questType = "weekly", log = true }, -- necro 15 souls + [62866] = { covenant = 4, questType = "weekly", log = true }, -- necro 20 souls + }, + anima_weekly = { + [61982] = { covenant = 1, questType = "weekly", log = true }, -- kyrian 1k anima + [61981] = { covenant = 2, questType = "weekly", log = true }, -- venthyr 1k anima + [61984] = { covenant = 3, questType = "weekly", log = true }, -- night fae 1k anima + [61983] = { covenant = 4, questType = "weekly", log = true }, -- necro 1k anima + }, + battle_plans = { + [64521] = { questType = "weekly", log = true }, -- Helsworn Battle Plans + }, + korthia_supplies = { + [64522] = { questType = "weekly", log = true }, -- Stolen Korthia Supplies + }, + korthia_weekly = { + [63949] = { questType = "weekly", log = true }, -- Shaping Fate + }, + zereth_mortis_weekly = { + [65324] = { questType = "weekly", log = true }, + }, + -- Maw Warth of the Jailer + wrath = { + [63414] = { questType = "weekly" }, -- Wrath of the Jailer + }, + -- Maw Hunt + hunt = { + [63195] = { questType = "weekly" }, + [63198] = { questType = "weekly" }, + [63199] = { questType = "weekly" }, + [63433] = { questType = "weekly" }, + }, + korthia_world_boss = { + [64531] = { questType = "weekly" }, -- Mor'geth, Tormentor of the Damned + }, + zereth_mortis_world_boss = { + [65143] = { questType = "weekly" }, -- Antros + }, + tormentors_weekly = { + [63854] = { questType = "weekly" }, -- Tormentors of Torghast + [64122] = { questType = "weekly" }, -- Tormentors of Torghast + }, + tormentors_locations = { + [64692] = { questType = "weekly" }, + [64693] = { questType = "weekly" }, + [64694] = { questType = "weekly" }, + [64695] = { questType = "weekly" }, + [64696] = { questType = "weekly" }, + [64697] = { questType = "weekly" }, + [64698] = { questType = "weekly" }, + }, + containing_the_helsworn = { + [64273] = { questType = "weekly" }, -- Containing the Helsworn World Quest + }, + rift_vessels = { + [64265] = { questType = "weekly" }, + [64269] = { questType = "weekly" }, + [64270] = { questType = "weekly" }, + }, + maw_assault = { + [63824] = { questType = "weekly" }, -- Kyrian + [63543] = { questType = "weekly" }, -- Necrolord + [63822] = { questType = "weekly" }, -- Venthyr + [63823] = { questType = "weekly" }, -- Nightfae + }, + assault_vessels = { + [64056] = { name = "Venthyr", total = 2, questType = "weekly" }, + [64055] = { name = "Venthyr", total = 2, questType = "weekly" }, + [64058] = { name = "Kyrian", total = 2, questType = "weekly" }, + [64057] = { name = "Kyrian", total = 2, questType = "weekly" }, + [64059] = { name = "Night Fae", total = 2, questType = "weekly" }, + [64060] = { name = "Night Fae", total = 2, questType = "weekly" }, + [64044] = { name = "Necrolord", total = 2, questType = "weekly" }, + [64045] = { name = "Necrolord", total = 2, questType = "weekly" }, + }, + adamant_vault_conduit = { + [64347] = { questType = "weekly" }, + }, + sanctum_normal_embers_trash = { + [64610] = { questType = "weekly" }, + [64613] = { questType = "weekly" }, + [64616] = { questType = "weekly" }, + [64619] = { questType = "weekly" }, + [64622] = { questType = "weekly" }, + }, + sanctum_heroic_embers_trash = { + [64611] = { questType = "weekly" }, + [64614] = { questType = "weekly" }, + [64617] = { questType = "weekly" }, + [64620] = { questType = "weekly" }, + [64623] = { questType = "weekly" }, + }, + sandworn_chest = { + [65611] = { questType = "daily" }, + }, + puzzle_caches = { + [64972] = { questType = "daily" }, -- Toccatian Cache + [65314] = { questType = "daily" }, + [65319] = { questType = "daily" }, + [65323] = { questType = "daily" }, -- Cantaric Cache + [65094] = { questType = "daily" }, + [65318] = { questType = "daily" }, + [65091] = { questType = "daily" }, -- Mezzonic Cache + [65315] = { questType = "daily" }, + [65320] = { questType = "daily" }, + [65316] = { questType = "daily" }, -- Glissandian Cache + [65321] = { questType = "daily" }, + [65092] = { questType = "daily" }, + [65317] = { questType = "daily" }, -- Fuguel Cache + [65322] = { questType = "daily" }, + [65093] = { questType = "daily" }, + }, + korthia_five_dailies = { + [63727] = { questType = "unlocks", log = true }, + }, + zereth_mortis_three_dailies = { + [65219] = { questType = "unlocks", log = true }, + }, + dragonflight_world_boss = { + [69927] = { questType = "weekly" }, + [69928] = { questType = "weekly" }, + [69929] = { questType = "weekly" }, + [69930] = { questType = "weekly" }, + }, + aiding_the_accord = { + [70750] = { questType = "weekly", log = true }, + [72068] = { questType = "weekly", log = true }, + [72373] = { questType = "weekly", log = true }, + [72374] = { questType = "weekly", log = true }, + [72375] = { questType = "weekly", log = true }, + [75259] = { questType = "weekly", log = true }, + [75859] = { questType = "weekly", log = true }, + [75860] = { questType = "weekly", log = true }, + [75861] = { questType = "weekly", log = true }, + [77254] = { questType = "weekly", log = true }, + [77976] = { questType = "weekly", log = true }, + [78446] = { questType = "weekly", log = true }, + [78447] = { questType = "weekly", log = true }, + [78861] = { questType = "weekly", log = true }, + [80385] = { questType = "weekly", log = true }, + [80386] = { questType = "weekly", log = true }, + [80388] = { questType = "weekly", log = true }, + [80389] = { questType = "weekly", log = true }, + }, + grand_hunts = { + [70906] = { questType = "weekly" }, + [71136] = { questType = "weekly" }, + [71137] = { questType = "weekly" }, + }, + marrukai_camp = { + [65784] = { questType = "biweekly", log = true }, + [65789] = { questType = "biweekly", log = true }, + [65792] = { questType = "biweekly", log = true }, + [65796] = { questType = "biweekly", log = true }, + [65798] = { questType = "biweekly", log = true }, + [66698] = { questType = "biweekly", log = true }, + [66711] = { questType = "biweekly", log = true }, + [67034] = { questType = "biweekly", log = true }, + [67039] = { questType = "biweekly", log = true }, + [67222] = { questType = "biweekly", log = true }, + [67605] = { questType = "biweekly", log = true }, + [70210] = { questType = "biweekly", log = true }, + [70299] = { questType = "biweekly", log = true }, + [70279] = { questType = "biweekly", log = true }, + [70352] = { questType = "biweekly", log = true }, + [70701] = { questType = "biweekly", log = true }, + [70990] = { questType = "biweekly", log = true }, + [71241] = { questType = "biweekly", log = true }, + }, + trial_of_flood = { + [71033] = { questType = "weekly" }, + }, + trial_of_elements = { + [71995] = { questType = "weekly" }, + }, + trial_of_storms = { + [74567] = { questType = "weekly" }, + }, + brackenhide_hollow_rares = { + [74032] = { questType = "daily", name = "Snarglebone" }, + [73985] = { questType = "daily", name = "Blisterhide" }, + [73996] = { questType = "daily", name = "Gnarls" }, + [74004] = { questType = "daily", name = "High Shaman Rotknuckle" }, + }, + knowledge_df_mobs = { + [70522] = { questType = "weekly", skillLineID = 165, profession = "Leatherworking", item = 198975 }, --Leatherworking 1 + [70523] = { questType = "weekly", skillLineID = 165, profession = "Leatherworking", item = 198976 }, --Leatherworking 2 + [73138] = { questType = "weekly", skillLineID = 165, profession = "Leatherworking", item = 204232 }, --Leatherworking 3 + [70514] = { questType = "weekly", skillLineID = 333, profession = "Enchanting", item = 198967 }, --Enchanting 1 + [70515] = { questType = "weekly", skillLineID = 333, profession = "Enchanting", item = 198968 }, --Enchanting 2 + [73136] = { questType = "weekly", skillLineID = 333, profession = "Enchanting", item = 204224 }, --Enchanting 3 + [70516] = { questType = "weekly", skillLineID = 202, profession = "Engineering", item = 198969 }, --Engineering 1 + [70517] = { questType = "weekly", skillLineID = 202, profession = "Engineering", item = 198970 }, --Engineering 2 + [73165] = { questType = "weekly", skillLineID = 202, profession = "Engineering", item = 204227 }, --Engineering 3 + [70518] = { questType = "weekly", skillLineID = 773, profession = "Inscription", item = 198971 }, --Inscription 1 + [70519] = { questType = "weekly", skillLineID = 773, profession = "Inscription", item = 198972 }, --Inscription 2 + [73163] = { questType = "weekly", skillLineID = 773, profession = "Inscription", item = 204229 }, --Inscription 3 + [70524] = { questType = "weekly", skillLineID = 197, profession = "Tailoring", item = 198977 }, --Tailoring 1 + [70525] = { questType = "weekly", skillLineID = 197, profession = "Tailoring", item = 198978 }, --Tailoring 2 + [73153] = { questType = "weekly", skillLineID = 197, profession = "Tailoring", item = 204225 }, --Tailoring 3 + [70512] = { questType = "weekly", skillLineID = 164, profession = "Blacksmithing", item = 198965 }, --Blacksmithing 1 + [70513] = { questType = "weekly", skillLineID = 164, profession = "Blacksmithing", item = 198966 }, --Blacksmithing 2 + [73161] = { questType = "weekly", skillLineID = 164, profession = "Blacksmithing", item = 204230 }, --Blacksmithing 3 + [70520] = { questType = "weekly", skillLineID = 755, profession = "Jewelcrafting", item = 198973 }, --Jewelcrafting 1 + [70521] = { questType = "weekly", skillLineID = 755, profession = "Jewelcrafting", item = 198974 }, --Jewelcrafting 2 + [73168] = { questType = "weekly", skillLineID = 755, profession = "Jewelcrafting", item = 204222 }, --Jewelcrafting 3 + [70504] = { questType = "weekly", skillLineID = 171, profession = "Alchemy", item = 198963 }, --Alchemy 1 + [70511] = { questType = "weekly", skillLineID = 171, profession = "Alchemy", item = 198964 }, --Alchemy 2 + [73166] = { questType = "weekly", skillLineID = 171, profession = "Alchemy", item = 204226 }, --Alchemy 3 + [71857] = { questType = "weekly", skillLineID = 182, profession = "Herbalism" }, --Herbalism 1 + [71858] = { questType = "weekly", skillLineID = 182, profession = "Herbalism" }, --Herbalism 2 + [71859] = { questType = "weekly", skillLineID = 182, profession = "Herbalism" }, --Herbalism 3 + [71860] = { questType = "weekly", skillLineID = 182, profession = "Herbalism" }, --Herbalism 4 + [71861] = { questType = "weekly", skillLineID = 182, profession = "Herbalism" }, --Herbalism 5 + [71864] = { questType = "weekly", skillLineID = 182, profession = "Herbalism" }, --Herbalism 6 + [70381] = { questType = "weekly", skillLineID = 393, profession = "Skinning" }, --Skinning 1 + [70383] = { questType = "weekly", skillLineID = 393, profession = "Skinning" }, --Skinning 2 + [70384] = { questType = "weekly", skillLineID = 393, profession = "Skinning" }, --Skinning 3 + [70385] = { questType = "weekly", skillLineID = 393, profession = "Skinning" }, --Skinning 4 + [70386] = { questType = "weekly", skillLineID = 393, profession = "Skinning" }, --Skinning 5 + [70389] = { questType = "weekly", skillLineID = 393, profession = "Skinning" }, --Skinning 6 + [72160] = { questType = "weekly", skillLineID = 186, profession = "Mining" }, --Mining 1 + [72161] = { questType = "weekly", skillLineID = 186, profession = "Mining" }, --Mining 2 + [72162] = { questType = "weekly", skillLineID = 186, profession = "Mining" }, --Mining 3 + [72163] = { questType = "weekly", skillLineID = 186, profession = "Mining" }, --Mining 4 + [72164] = { questType = "weekly", skillLineID = 186, profession = "Mining" }, --Mining 5 + [72165] = { questType = "weekly", skillLineID = 186, profession = "Mining" }, --Mining 6 + }, + knowledge_df_treasures = { + [66375] = { questType = "weekly", skillLineID = 773, profession = "Inscription", item = 193904 }, --Inscription 1 + [66376] = { questType = "weekly", skillLineID = 773, profession = "Inscription", item = 193905 }, --Inscription 2 + [66384] = { questType = "weekly", skillLineID = 165, profession = "Leatherworking", item = 193910 }, --Leatherworking 1 + [66385] = { questType = "weekly", skillLineID = 165, profession = "Leatherworking", item = 193913 }, --Leatherworking 2 + [66386] = { questType = "weekly", skillLineID = 197, profession = "Tailoring", item = 193898 }, --Tailoring 1 + [66387] = { questType = "weekly", skillLineID = 197, profession = "Tailoring", item = 193899 }, --Tailoring 2 + [66377] = { questType = "weekly", skillLineID = 333, profession = "Enchanting", item = 193900 }, --Enchanting 1 + [66378] = { questType = "weekly", skillLineID = 333, profession = "Enchanting", item = 193901 }, --Enchanting 2 + [66381] = { questType = "weekly", skillLineID = 164, profession = "Blacksmithing", item = 192131 }, --Blacksmithing 1 + [66382] = { questType = "weekly", skillLineID = 164, profession = "Blacksmithing", item = 192132 }, --Blacksmithing 2 + [66379] = { questType = "weekly", skillLineID = 202, profession = "Engineering", item = 193902 }, --Engineering 1 + [66380] = { questType = "weekly", skillLineID = 202, profession = "Engineering", item = 193903 }, --Engineering 2 + [66388] = { questType = "weekly", skillLineID = 755, profession = "Jewelcrafting", item = 193909 }, --Jewelcrafting 1 + [66389] = { questType = "weekly", skillLineID = 755, profession = "Jewelcrafting", item = 193907 }, --Jewelcrafting 2 + [66373] = { questType = "weekly", skillLineID = 171, profession = "Alchemy", item = 193891 }, --Alchemy 1 + [66374] = { questType = "weekly", skillLineID = 171, profession = "Alchemy", item = 193897 }, --Alchemy 2 + }, + knowledge_df_treatise = { + [74105] = { questType = "weekly", skillLineID = 773, profession = "Inscription" }, -- Inscription + [83730] = { questType = "weekly", skillLineID = 773, profession = "Inscription" }, -- Inscription 2 + [74106] = { questType = "weekly", skillLineID = 186, profession = "Mining" }, -- Mining + [74107] = { questType = "weekly", skillLineID = 182, profession = "Herbalism" }, -- Herbalism + [74108] = { questType = "weekly", skillLineID = 171, profession = "Alchemy" }, -- Alchemy + [74109] = { questType = "weekly", skillLineID = 164, profession = "Blacksmithing" }, -- Blacksmithing + [74110] = { questType = "weekly", skillLineID = 333, profession = "Enchanting" }, -- Enchanting + [74111] = { questType = "weekly", skillLineID = 202, profession = "Engineering" }, -- Engineering + [74112] = { questType = "weekly", skillLineID = 755, profession = "Jewelcrafting" }, -- Jewelcrafting + [74113] = { questType = "weekly", skillLineID = 165, profession = "Leatherworking" }, -- Leatherworking + [74114] = { questType = "weekly", skillLineID = 393, profession = "Skinning" }, -- Skinning + [74115] = { questType = "weekly", skillLineID = 197, profession = "Tailoring" }, -- Tailoring + }, + knowledge_df_weeklies_craft = { + [70558] = { questType = "weekly", log = true }, -- Inscription 1 + [70559] = { questType = "weekly", log = true }, -- Inscription 2 + [70560] = { questType = "weekly", log = true }, -- Inscription 3 + [70561] = { questType = "weekly", log = true }, -- Inscription 4 + [70567] = { questType = "weekly", log = true }, -- Leatherworking 1 + [70568] = { questType = "weekly", log = true }, -- Leatherworking 2 + [70569] = { questType = "weekly", log = true }, -- Leatherworking 3 + [70571] = { questType = "weekly", log = true }, -- Leatherworking 4 + [70572] = { questType = "weekly", log = true }, -- Tailoring 1 + [70582] = { questType = "weekly", log = true }, -- Tailoring 2 + [70586] = { questType = "weekly", log = true }, -- Tailoring 3 + [70587] = { questType = "weekly", log = true }, -- Tailoring 4 + [72155] = { questType = "weekly", log = true }, -- Enchanting 1 + [72172] = { questType = "weekly", log = true }, -- Enchanting 2 + [72175] = { questType = "weekly", log = true }, -- Enchanting 3 + [72173] = { questType = "weekly", log = true }, -- Enchanting 4 + [70233] = { questType = "weekly", log = true }, -- Blacksmithing 1 + [70234] = { questType = "weekly", log = true }, -- Blacksmithing 2 + [70235] = { questType = "weekly", log = true }, -- Blacksmithing 3 + [70211] = { questType = "weekly", log = true }, -- Blacksmithing 4 + [70540] = { questType = "weekly", log = true }, -- Engineering 1 + [70545] = { questType = "weekly", log = true }, -- Engineering 2 + [70557] = { questType = "weekly", log = true }, -- Engineering 3 + [70539] = { questType = "weekly", log = true }, -- Engineering 4 + [70562] = { questType = "weekly", log = true }, -- Jewelcrafting 1 + [70563] = { questType = "weekly", log = true }, -- Jewelcrafting 2 + [70564] = { questType = "weekly", log = true }, -- Jewelcrafting 3 + [70565] = { questType = "weekly", log = true }, -- Jewelcrafting 4 + [70531] = { questType = "weekly", log = true }, -- Alchemy 1 + [70532] = { questType = "weekly", log = true }, -- Alchemy 2 + [70533] = { questType = "weekly", log = true }, -- Alchemy 3 + [70530] = { questType = "weekly", log = true }, -- Alchemy 4 + }, + knowledge_df_weeklies_loot = { + [66943] = { questType = "weekly", log = true }, -- Inscription 5 + [66944] = { questType = "weekly", log = true }, -- Inscription 6 + [66945] = { questType = "weekly", log = true }, -- Inscription 7 + [72438] = { questType = "weekly", log = true }, -- Inscription 8 + [66363] = { questType = "weekly", log = true }, -- Leatherworking 5 + [66364] = { questType = "weekly", log = true }, -- Leatherworking 6 + [66951] = { questType = "weekly", log = true }, -- Leatherworking 7 + [72407] = { questType = "weekly", log = true }, -- Leatherworking 8 + [66899] = { questType = "weekly", log = true }, -- Tailoring 5 + [66952] = { questType = "weekly", log = true }, -- Tailoring 6 + [66953] = { questType = "weekly", log = true }, -- Tailoring 7 + [72410] = { questType = "weekly", log = true }, -- Tailoring 8 + [66884] = { questType = "weekly", log = true }, -- Enchanting 5 + [66900] = { questType = "weekly", log = true }, -- Enchanting 6 + [66935] = { questType = "weekly", log = true }, -- Enchanting 7 + [72423] = { questType = "weekly", log = true }, -- Enchanting 8 + [66517] = { questType = "weekly", log = true }, -- Blacksmithing 5 + [66941] = { questType = "weekly", log = true }, -- Blacksmithing 6 + [72398] = { questType = "weekly", log = true }, -- Blacksmithing 7 + [66897] = { questType = "weekly", log = true }, -- Blacksmithing 8 + [66891] = { questType = "weekly", log = true }, -- Engineering 5 + [66890] = { questType = "weekly", log = true }, -- Engineering 6 + [66942] = { questType = "weekly", log = true }, -- Engineering 7 + [72396] = { questType = "weekly", log = true }, -- Engineering 8 + [73165] = { questType = "weekly", log = true }, -- Engineering 9 + [66516] = { questType = "weekly", log = true }, -- Jewelcrafting 5 + [66949] = { questType = "weekly", log = true }, -- Jewelcrafting 6 + [66950] = { questType = "weekly", log = true }, -- Jewelcrafting 7 + [72428] = { questType = "weekly", log = true }, -- Jewelcrafting 8 + [66937] = { questType = "weekly", log = true }, -- Alchemy 5 + [66938] = { questType = "weekly", log = true }, -- Alchemy 6 + [66940] = { questType = "weekly", log = true }, -- Alchemy 7 + [72427] = { questType = "weekly", log = true }, -- Alchemy 8 + [70613] = { questType = "weekly", log = true }, -- Herbalism 5 + [70614] = { questType = "weekly", log = true }, -- Herbalism 6 + [70615] = { questType = "weekly", log = true }, -- Herbalism 7 + [70616] = { questType = "weekly", log = true }, -- Herbalism 8 + --[71970] = {questType = 'weekly', log = true}, -- Herbalism 8 + --[71857] = {questType = 'weekly', log = true}, -- Herbalism 8 + [70620] = { questType = "weekly", log = true }, -- Skinning 5 + [72159] = { questType = "weekly", log = true }, -- Skinning 6 + [70619] = { questType = "weekly", log = true }, -- Skinning 7 + [72158] = { questType = "weekly", log = true }, -- Skinning 8 + [72157] = { questType = "weekly", log = true }, -- Mining 5 + [70617] = { questType = "weekly", log = true }, -- Mining 6 + [70618] = { questType = "weekly", log = true }, -- Mining 7 + [72156] = { questType = "weekly", log = true }, -- Mining 8 + --[66936] = {questType = 'weekly', log = true}, -- Mining 8 + [75354] = { questType = "weekly", log = true }, -- Leatherworking + [75368] = { questType = "weekly", log = true }, -- Leatherworking + [77945] = { questType = "weekly", log = true }, -- Leatherworking + [77946] = { questType = "weekly", log = true }, -- Leatherworking + [75150] = { questType = "weekly", log = true }, -- Enchanting + [75865] = { questType = "weekly", log = true }, -- Enchanting + [77910] = { questType = "weekly", log = true }, -- Enchanting + [77937] = { questType = "weekly", log = true }, -- Enchanting + [75148] = { questType = "weekly", log = true }, -- Blacksmithing + [75569] = { questType = "weekly", log = true }, -- Blacksmithing + [77935] = { questType = "weekly", log = true }, -- Blacksmithing + [77936] = { questType = "weekly", log = true }, -- Blacksmithing + [75575] = { questType = "weekly", log = true }, -- Engineering + [75608] = { questType = "weekly", log = true }, -- Engineering + [77891] = { questType = "weekly", log = true }, -- Engineering + [77938] = { questType = "weekly", log = true }, -- Engineering + [75149] = { questType = "weekly", log = true }, -- Inscription + [75573] = { questType = "weekly", log = true }, -- Inscription + [77889] = { questType = "weekly", log = true }, -- Inscription + [77914] = { questType = "weekly", log = true }, -- Inscription + [75407] = { questType = "weekly", log = true }, -- Tailoring + [75600] = { questType = "weekly", log = true }, -- Tailoring + [77947] = { questType = "weekly", log = true }, -- Tailoring + [77949] = { questType = "weekly", log = true }, -- Tailoring + [75362] = { questType = "weekly", log = true }, -- Jewelcrafting + [75602] = { questType = "weekly", log = true }, -- Jewelcrafting + [77892] = { questType = "weekly", log = true }, -- Jewelcrafting + [77912] = { questType = "weekly", log = true }, -- Jewelcrafting + [75363] = { questType = "weekly", log = true }, -- Alchemy + [75371] = { questType = "weekly", log = true }, -- Alchemy + [77932] = { questType = "weekly", log = true }, -- Alchemy + [77933] = { questType = "weekly", log = true }, -- Alchemy + }, + knowledge_df_weeklies_order = { + [70589] = { questType = "weekly", log = true }, -- Blacksmithing 0 + [70591] = { questType = "weekly", log = true }, -- Engineering 0 + [70592] = { questType = "weekly", log = true }, -- Inscription 0 + [70593] = { questType = "weekly", log = true }, -- Jewelcrafting 0 + [70594] = { questType = "weekly", log = true }, -- Leatherworking 0 + [70595] = { questType = "weekly", log = true }, -- Tailoring 0 + }, + community_feast = { + [74097] = { questType = "daily" }, + }, + iskaara_story = { + [72291] = { questType = "weekly", log = true }, + }, + obsidian_citadel_rares = { + [72127] = { questType = "daily", name = "Captain Lancer" }, + [73072] = { questType = "daily", name = "Enkine the Voracious" }, + [74067] = { questType = "daily", name = "Morchok" }, + [74054] = { questType = "daily", name = "Turboris" }, + [74043] = { questType = "daily", name = "Char" }, + [74040] = { questType = "daily", name = "Battlehorn Pyrhus" }, + [74042] = { questType = "daily", name = "Cauldronbreaker Blakor" }, + [74052] = { questType = "daily", name = "Rohzor Forgesmash" }, + }, + tyrhold_rares = { + [74055] = { questType = "daily", name = "Ancient Protector" }, + }, + iskaara_fishing_dailies = { + [70438] = { questType = "daily", log = true }, + [70450] = { questType = "daily", log = true }, + [71191] = { questType = "daily", log = true }, + [71194] = { questType = "daily", log = true }, + [72069] = { questType = "daily", log = true }, + [72075] = { questType = "daily", log = true }, + }, + community_feast_weekly = { + [70893] = { questType = "weekly", log = true }, + }, + dragonbane_keep_siege = { + [70866] = { questType = "weekly" }, + }, + dragonbane_keep_key = { + [66805] = { questType = "weekly", log = true }, + [66133] = { questType = "weekly", log = true }, + }, + dragonbane_keep_weeklies = { + [65842] = { questType = "weekly", log = true }, + [66103] = { questType = "weekly", log = true }, + [66308] = { questType = "weekly", log = true }, + [66321] = { questType = "weekly", log = true }, + [66326] = { questType = "weekly", log = true }, + [66445] = { questType = "weekly", log = true }, + [66449] = { questType = "weekly", log = true }, + [66633] = { questType = "weekly", log = true }, + [66926] = { questType = "weekly", log = true }, + [67051] = { questType = "weekly", log = true }, + [67099] = { questType = "weekly", log = true }, + [67142] = { questType = "weekly", log = true }, + [69918] = { questType = "weekly", log = true }, + [70848] = { questType = "weekly", log = true }, + [72447] = { questType = "weekly", log = true }, + [72448] = { questType = "weekly", log = true }, + }, + show_your_mettle = { + [70221] = { questType = "weekly", log = true }, + }, + fish_turnins_df = { + [72828] = { questType = "weekly", name = "|T1387373:0|t[Scalebelly Mackerel]" }, + [72823] = { questType = "weekly", name = "|T4554376:0|t[Islefin Dorado]" }, + [72827] = { questType = "weekly", name = "|T4554372:0|t[Thousandbite Piranha]" }, + [72826] = { questType = "weekly", name = "|T4539689:0|t[Aileron Seamoth]" }, + [72825] = { questType = "weekly", name = "|T4539687:0|t[Cerulean Spinefish]" }, + [72824] = { questType = "weekly", name = "|T4554371:0|t[Temporal Dragonhead]" }, + }, + forbidden_reach_weeklies = { + [72952] = { questType = "weekly", log = true }, + [73140] = { questType = "weekly", log = true }, + [73141] = { questType = "weekly", log = true }, + [73142] = { questType = "weekly", log = true }, + [73179] = { questType = "weekly", log = true }, + [73190] = { questType = "weekly", log = true }, + [73191] = { questType = "weekly", log = true }, + [73194] = { questType = "weekly", log = true }, + [73715] = { questType = "weekly", log = true }, + [74282] = { questType = "weekly", log = true }, + [74284] = { questType = "weekly", log = true }, + [74293] = { questType = "weekly", log = true }, + [74379] = { questType = "weekly", log = true }, + [75024] = { questType = "weekly", log = true }, + [75025] = { questType = "weekly", log = true }, + }, + forbidden_reach_task_picked = { + [74908] = { questType = "daily", log = true }, -- Dragonscale Expedition + [74909] = { questType = "daily", log = true }, -- Iskaara Tuskarr + [74910] = { questType = "daily", log = true }, -- Maruuk Centaur + [74911] = { questType = "daily", log = true }, -- Valdrakken Akkord + }, + forbidden_reach_tasks = { + [74118] = { questType = "daily", log = true }, -- Dragonscale Expedition + [74389] = { questType = "daily", log = true }, -- Dragonscale Expedition + [74119] = { questType = "daily", log = true }, -- Iskaara Tuskarr + [74391] = { questType = "daily", log = true }, -- Iskaara Tuskarr + [74117] = { questType = "daily", log = true }, -- Maruuk Centaur + [74390] = { questType = "daily", log = true }, -- Maruuk Centaur + [75261] = { questType = "daily", log = true }, -- Valdrakken Akkord + [75263] = { questType = "daily", log = true }, -- Valdrakken Akkord + }, + forbidden_reach_elite_wqs = { + [75257] = { questType = "weekly", log = true }, -- The War Creche + }, + glimerogg_racer_dailies = { + [74514] = { questType = "weekly", log = true }, -- The Slowest Fan Club + [74515] = { questType = "weekly", log = true }, -- Snail Mail + [74516] = { questType = "weekly", log = true }, -- A Snail's Pace + [74517] = { questType = "weekly", log = true }, -- All Terrain Snail + [74518] = { questType = "weekly", log = true }, -- Resistance Training + [74519] = { questType = "weekly", log = true }, -- Good for Goo + [74520] = { questType = "weekly", log = true }, -- Less Cargo + }, + loamm_niffen_weekly = { + [75665] = { questType = "weekly", log = true }, + }, + researchers_under_fire_weekly = { + [75627] = { questType = "weekly" }, + [75628] = { questType = "weekly" }, + [75629] = { questType = "weekly" }, + [75630] = { questType = "weekly" }, + }, + zc_wb_wq = { + [74892] = { questType = "weekly", log = true }, -- Zaqali Elders + }, + dig_maps_weeklies = { + [75747] = { questType = "weekly" }, + [75748] = { questType = "weekly" }, + [75749] = { questType = "weekly" }, + }, + dig_maps_received_weekly = { + [76077] = { questType = "weekly" }, + [75665] = { questType = "weekly" }, + }, + proven_weekly = { + [72166] = { questType = "weekly", log = true }, + [72167] = { questType = "weekly", log = true }, + [72168] = { questType = "weekly", log = true }, + [72169] = { questType = "weekly", log = true }, + [72170] = { questType = "weekly", log = true }, + [72171] = { questType = "weekly", log = true }, + }, + fyrak_assault = { + [75467] = { questType = "weekly" }, + }, + zyrak_cavern_zone_events = { + [75664] = { questType = "weekly", forceUpdate = true }, + [75156] = { questType = "weekly", forceUpdate = true }, + [75471] = { questType = "weekly", forceUpdate = true }, + [75222] = { questType = "weekly", forceUpdate = true }, + [75370] = { questType = "weekly", forceUpdate = true }, + [75441] = { questType = "weekly", forceUpdate = true }, + [75611] = { questType = "weekly", forceUpdate = true }, + [75624] = { questType = "weekly", forceUpdate = true }, + [75612] = { questType = "weekly", forceUpdate = true }, + [75454] = { questType = "weekly", forceUpdate = true }, + [75455] = { questType = "weekly", forceUpdate = true }, + [75450] = { questType = "weekly", forceUpdate = true }, + [75451] = { questType = "weekly", forceUpdate = true }, + [75461] = { questType = "weekly", forceUpdate = true }, + [74352] = { questType = "weekly", forceUpdate = true }, + [75478] = { questType = "weekly", forceUpdate = true }, + [75494] = { questType = "weekly", forceUpdate = true }, + [75705] = { questType = "weekly", forceUpdate = true }, + }, + time_rift = { + [77236] = { questType = "weekly", log = true }, + }, + time_rift_pod = { + [77836] = { questType = "weekly" }, + }, + dreamsurge_weekly = { + [77251] = { questType = "weekly", log = true }, + }, + ed_wb_wq = { + [76367] = { questType = "weekly", log = true }, -- Aurostor + }, + dream_wardens_weekly = { + [78444] = { questType = "weekly", log = true }, + }, + superbloom = { + [78319] = { questType = "weekly", log = true }, + }, + dream_shipments = { + [78427] = { questType = "weekly", log = true }, + [78428] = { questType = "weekly", log = true }, + }, + anniversary_wb = { + [47461] = { questType = "daily", name = "Kazzak" }, -- Kazzak + [47462] = { questType = "daily", name = "Azuregos" }, -- Azuregos + [47463] = { questType = "daily", name = "Dragons of Nightmare" }, -- Dragons of Nightmare + [60214] = { questType = "daily", name = "Doomwalker" }, -- Doomwalker + }, + big_dig = { + [79226] = { questType = "weekly", warband = true, log = true }, }, - [L['Jewelcrafting']] = { - } -} -PermoksAccountManager.quests = { - maw_dailies = { - [60732] = {questType = 'daily', log = true}, - [61334] = {questType = 'daily', log = true}, - [62239] = {questType = 'daily', log = true}, - [63031] = {questType = 'daily', log = true}, - [63038] = {questType = 'daily', log = true}, - [63039] = {questType = 'daily', log = true}, - [63040] = {questType = 'daily', log = true}, - [63043] = {questType = 'daily', log = true}, - [63045] = {questType = 'daily', log = true}, - [63047] = {questType = 'daily', log = true}, - [63050] = {questType = 'daily', log = true}, - [63062] = {questType = 'daily', log = true}, - [63069] = {questType = 'daily', log = true}, - [63072] = {questType = 'daily', log = true}, - [63100] = {questType = 'daily', log = true}, - [63179] = {questType = 'daily', log = true}, - [60622] = {questType = 'weekly', log = true}, - [60646] = {questType = 'weekly', log = true}, - [60762] = {questType = 'weekly', log = true}, - [60775] = {questType = 'weekly', log = true}, - [60902] = {questType = 'weekly', log = true}, - [61075] = {questType = 'weekly', log = true}, - [61079] = {questType = 'weekly', log = true}, - [61088] = {questType = 'weekly', log = true}, - [61103] = {questType = 'weekly', log = true}, - [61104] = {questType = 'weekly', log = true}, - [61765] = {questType = 'weekly', log = true}, - [62214] = {questType = 'weekly', log = true}, - [62234] = {questType = 'weekly', log = true}, - [63206] = {questType = 'weekly', log = true} - }, - transport_network = { - -- Kyrian - -- Venthyr - -- Night Fae - [62614] = {covenant = 3, sanctum = 2, minSanctumTier = 1, questType = 'daily', log = true}, - [62615] = {covenant = 3, sanctum = 2, minSanctumTier = 1, questType = 'daily', log = true}, - [62611] = {covenant = 3, sanctum = 2, minSanctumTier = 1, questType = 'daily', log = true}, - [62610] = {covenant = 3, sanctum = 2, minSanctumTier = 1, questType = 'daily', log = true}, - [62606] = {covenant = 3, sanctum = 2, minSanctumTier = 1, questType = 'daily', log = true}, - [62608] = {covenant = 3, sanctum = 2, minSanctumTier = 1, questType = 'daily', log = true}, - [60175] = {covenant = 3, sanctum = 2, minSanctumTier = 1, questType = 'daily', log = true}, - [62607] = {covenant = 3, sanctum = 2, minSanctumTier = 1, questType = 'daily', log = true}, - [62453] = {covenant = 3, sanctum = 2, minSanctumTier = 2, questType = 'daily', log = true}, - [62296] = {covenant = 3, sanctum = 2, minSanctumTier = 2, questType = 'daily', log = true}, - [60153] = {covenant = 3, sanctum = 2, minSanctumTier = 2, questType = 'daily', log = true}, - [62382] = {covenant = 3, sanctum = 2, minSanctumTier = 2, questType = 'daily', log = true}, - [62263] = {covenant = 3, sanctum = 2, minSanctumTier = 3, questType = 'daily', log = true}, - [62459] = {covenant = 3, sanctum = 2, minSanctumTier = 3, questType = 'daily', log = true}, - [62466] = {covenant = 3, sanctum = 2, minSanctumTier = 3, questType = 'daily', log = true}, - [60188] = {covenant = 3, sanctum = 2, minSanctumTier = 3, questType = 'daily', log = true}, - [62465] = {covenant = 3, sanctum = 2, minSanctumTier = 3, questType = 'daily', log = true} - }, - korthia_dailies = { - [63775] = {questType = 'daily', log = true}, - [63776] = {questType = 'daily', log = true}, - [63777] = {questType = 'daily', log = true}, - [63778] = {questType = 'daily', log = true}, - [63779] = {questType = 'daily', log = true}, - [63780] = {questType = 'daily', log = true}, - [63781] = {questType = 'daily', log = true}, - [63782] = {questType = 'daily', log = true}, - [63783] = {questType = 'daily', log = true}, - [63784] = {questType = 'daily', log = true}, - [63785] = {questType = 'daily', log = true}, - [63786] = {questType = 'daily', log = true}, - [63787] = {questType = 'daily', log = true}, - [63788] = {questType = 'daily', log = true}, - [63789] = {questType = 'daily', log = true}, - [63790] = {questType = 'daily', log = true}, - [63791] = {questType = 'daily', log = true}, - [63792] = {questType = 'daily', log = true}, - [63793] = {questType = 'daily', log = true}, - [63794] = {questType = 'daily', log = true}, - [63934] = {questType = 'daily', log = true}, - [63935] = {questType = 'daily', log = true}, - [63936] = {questType = 'daily', log = true}, - [63937] = {questType = 'daily', log = true}, - [63950] = {questType = 'daily', log = true}, - [63954] = {questType = 'daily', log = true}, - [63955] = {questType = 'daily', log = true}, - [63956] = {questType = 'daily', log = true}, - [63957] = {questType = 'daily', log = true}, - [63958] = {questType = 'daily', log = true}, - [63959] = {questType = 'daily', log = true}, - [63960] = {questType = 'daily', log = true}, - [63961] = {questType = 'daily', log = true}, - [63962] = {questType = 'daily', log = true}, - [63963] = {questType = 'daily', log = true}, - [63964] = {questType = 'daily', log = true}, - [63965] = {questType = 'daily', log = true}, - [63989] = {questType = 'daily', log = true}, - [64015] = {questType = 'daily', log = true}, - [64016] = {questType = 'daily', log = true}, - [64017] = {questType = 'daily', log = true}, - [64043] = {questType = 'daily', log = true}, - [64065] = {questType = 'daily', log = true}, - [64070] = {questType = 'daily', log = true}, - [64080] = {questType = 'daily', log = true}, - [64089] = {questType = 'daily', log = true}, - [64101] = {questType = 'daily', log = true}, - [64103] = {questType = 'daily', log = true}, - [64104] = {questType = 'daily', log = true}, - [64129] = {questType = 'daily', log = true}, - [64166] = {questType = 'daily', log = true}, - [64194] = {questType = 'daily', log = true}, - [64432] = {questType = 'daily', log = true} - }, - zereth_mortis_dailies = { - [64579] = {questType = 'daily', log = true}, - [64592] = {questType = 'daily', log = true}, - [64717] = {questType = 'daily', log = true}, - [64785] = {questType = 'daily', log = true}, - [64854] = {questType = 'daily', log = true}, - [64964] = {questType = 'daily', log = true}, - [64977] = {questType = 'daily', log = true}, - [65033] = {questType = 'daily', log = true}, - [65072] = {questType = 'daily', log = true}, - [65096] = {questType = 'daily', log = true}, - [65142] = {questType = 'daily', log = true}, - [65177] = {questType = 'daily', log = true}, - [65226] = {questType = 'daily', log = true}, - [65255] = {questType = 'daily', log = true}, - [65256] = {questType = 'daily', log = true}, - [65264] = {questType = 'daily', log = true}, - [65265] = {questType = 'daily', log = true}, - [65268] = {questType = 'daily', log = true}, - [65269] = {questType = 'daily', log = true}, - [65325] = {questType = 'daily', log = true}, - [65326] = {questType = 'daily', log = true}, - [65362] = {questType = 'daily', log = true}, - [65363] = {questType = 'daily', log = true}, - [65364] = {questType = 'daily', log = true}, - [65445] = {questType = 'daily', log = true} - }, - zereth_mortis_wqs = { - [64960] = {questType = 'daily'}, - [64974] = {questType = 'daily'}, - [65081] = {questType = 'daily'}, - [65089] = {questType = 'daily'}, - [65102] = {questType = 'daily'}, - [65115] = {questType = 'daily'}, - [65117] = {questType = 'daily'}, - [65119] = {questType = 'daily'}, - [65232] = {questType = 'daily'}, - [65234] = {questType = 'daily'}, - [65230] = {questType = 'daily'}, - [65244] = {questType = 'daily'}, - [65252] = {questType = 'daily'}, - [65262] = {questType = 'daily'}, - [65402] = {questType = 'daily'}, - [65403] = {questType = 'daily'}, - [65405] = {questType = 'daily'}, - [65406] = {questType = 'daily'}, - [65407] = {questType = 'daily'}, - [65408] = {questType = 'daily'}, - [65409] = {questType = 'daily'}, - [65410] = {questType = 'daily'}, - [65411] = {questType = 'daily'}, - [65412] = {questType = 'daily'}, - [65413] = {questType = 'daily'}, - [65414] = {questType = 'daily'}, - [65415] = {questType = 'daily'}, - [65416] = {questType = 'daily'}, - [65417] = {questType = 'daily'} - }, - conductor = { - [61691] = {covenant = 3, sanctum = 1, minSanctumTier = 1, addToMax = 1, questType = 'daily'}, -- Large Lunarlight Pod - [61633] = {covenant = 3, sanctum = 1, minSanctumTier = 1, addToMax = 1, questType = 'daily'}, -- Dreamsong Fenn - -- Necrolords - [58872] = {covenant = 4, sanctum = 1, minSanctumTier = 1, addToMax = 1, questType = 'daily'}, -- Gieger - [61647] = {covenant = 4, sanctum = 1, minSanctumTier = 1, addToMax = 1, questType = 'daily'} -- Chosen Runecoffer - }, - riftbound_cache = { - [64456] = {questType = 'daily'}, - [64470] = {questType = 'daily'}, - [64471] = {questType = 'daily'}, - [64472] = {questType = 'daily'} - }, - relic_creatures = { - [64341] = {questType = 'daily'}, - [64342] = {questType = 'daily'}, - [64343] = {questType = 'daily'}, - [64344] = {questType = 'daily'}, - [64747] = {questType = 'daily'}, - [64748] = {questType = 'daily'}, - [64749] = {questType = 'daily'}, - [64750] = {questType = 'daily'}, - [64751] = {questType = 'daily'}, - [64752] = {questType = 'daily'}, - [64753] = {questType = 'daily'}, - [64754] = {questType = 'daily'}, - [64755] = {questType = 'daily'}, - [64756] = {questType = 'daily'}, - [64757] = {questType = 'daily'} - }, - helsworn_chest = { - [64256] = {questType = 'daily'} - }, - relic_gorger = { - [64433] = {questType = 'daily'}, - [64434] = {questType = 'daily'}, - [64435] = {questType = 'daily'}, - [64436] = {questType = 'daily'} - }, - jiro_cyphers = { - [65144] = {questType = 'daily'}, -- Creatii - [65166] = {questType = 'daily'}, -- Genesii - [65167] = {questType = 'daily'} -- Nascii - }, - maw_souls = { - [61332] = {covenant = 1, questType = 'weekly', log = true}, -- kyrian 5 souls - [62861] = {covenant = 1, questType = 'weekly', log = true}, -- kyrian 10 souls - [62862] = {covenant = 1, questType = 'weekly', log = true}, -- kyrian 15 souls - [62863] = {covenant = 1, questType = 'weekly', log = true}, -- kyrian 20 souls - [61334] = {covenant = 2, questType = 'weekly', log = true}, -- venthyr 5 souls - [62867] = {covenant = 2, questType = 'weekly', log = true}, -- venthyr 10 souls - [62868] = {covenant = 2, questType = 'weekly', log = true}, -- venthyr 15 souls - [62869] = {covenant = 2, questType = 'weekly', log = true}, -- venthyr 20 souls - [61331] = {covenant = 3, questType = 'weekly', log = true}, -- night fae 5 souls - [62858] = {covenant = 3, questType = 'weekly', log = true}, -- night fae 10 souls - [62859] = {covenant = 3, questType = 'weekly', log = true}, -- night fae 15 souls - [62860] = {covenant = 3, questType = 'weekly', log = true}, -- night fae 20 souls - [61333] = {covenant = 4, questType = 'weekly', log = true}, -- necro 5 souls - [62864] = {covenant = 4, questType = 'weekly', log = true}, -- necro 10 souls - [62865] = {covenant = 4, questType = 'weekly', log = true}, -- necro 15 souls - [62866] = {covenant = 4, questType = 'weekly', log = true} -- necro 20 souls - }, - anima_weekly = { - [61982] = {covenant = 1, questType = 'weekly', log = true}, -- kyrian 1k anima - [61981] = {covenant = 2, questType = 'weekly', log = true}, -- venthyr 1k anima - [61984] = {covenant = 3, questType = 'weekly', log = true}, -- night fae 1k anima - [61983] = {covenant = 4, questType = 'weekly', log = true} -- necro 1k anima - }, - dungeon_quests = { - [60242] = {questType = 'weekly', log = true}, -- Trading Favors: Necrotic Wake - [60243] = {questType = 'weekly', log = true}, -- Trading Favors: Sanguine Depths - [60244] = {questType = 'weekly', log = true}, -- Trading Favors: Halls of Atonement - [60245] = {questType = 'weekly', log = true}, -- Trading Favors: The Other Side - [60246] = {questType = 'weekly', log = true}, -- Trading Favors: Tirna Scithe - [60247] = {questType = 'weekly', log = true}, -- Trading Favors: Theater of Pain - [60248] = {questType = 'weekly', log = true}, -- Trading Favors: Plaguefall - [60249] = {questType = 'weekly', log = true}, -- Trading Favors: Spires of Ascension - [60250] = {questType = 'weekly', log = true}, -- A Valuable Find: Theater of Pain - [60251] = {questType = 'weekly', log = true}, -- A Valuable Find: Plaguefall - [60252] = {questType = 'weekly', log = true}, -- A Valuable Find: Spires of Ascension - [60253] = {questType = 'weekly', log = true}, -- A Valuable Find: Necrotic Wake - [60254] = {questType = 'weekly', log = true}, -- A Valuable Find: Tirna Scithe - [60255] = {questType = 'weekly', log = true}, -- A Valuable Find: The Other Side - [60256] = {questType = 'weekly', log = true}, -- A Valuable Find: Halls of Atonement - [60257] = {questType = 'weekly', log = true} -- A Valuable Find: Sanguine Depths - }, - battle_plans = { - [64521] = {questType = 'weekly', log = true} -- Helsworn Battle Plans - }, - korthia_supplies = { - [64522] = {questType = 'weekly', log = true} -- Stolen Korthia Supplies - }, - pvp_quests = { - -- PVP Weekly - [62284] = {questType = 'weekly', log = true}, -- Random BGs - [62285] = {questType = 'weekly', log = true}, -- Epic BGs - [62286] = {questType = 'weekly', log = true}, - [62287] = {questType = 'weekly', log = true}, - [62288] = {questType = 'weekly', log = true}, - [62289] = {questType = 'weekly', log = true} - }, - -- Weekend Event - weekend_event = { - [72728] = {questType = 'weekly', log = true}, -- World Quests - [72727] = {questType = 'weekly', log = true}, -- BC Timewalking - [72726] = {questType = 'weekly', log = true}, -- WotLK Timewalking - [72810] = {questType = 'weekly', log = true}, -- Cata Timewalking - [72725] = {questType = 'weekly', log = true}, -- MOP Timewalking - [72724] = {questType = 'weekly', log = true}, -- Draenor Timewalking - [72719] = {questType = 'weekly', log = true}, -- Legion Timewalking - [72723] = {questType = 'weekly', log = true}, -- Battleground Event - [72722] = {questType = 'weekly', log = true}, -- Mythuc Dungeon Event - [72721] = {questType = 'weekly', log = true}, -- Pet Battle Event - [72720] = {questType = 'weekly', log = true} -- Arena Event - }, - korthia_weekly = { - [63949] = {questType = 'weekly', log = true} -- Shaping Fate - }, - zereth_mortis_weekly = { - [65324] = {questType = 'weekly', log = true} - }, - -- Maw Warth of the Jailer - wrath = { - [63414] = {questType = 'weekly'} -- Wrath of the Jailer - }, - -- Maw Hunt - hunt = { - [63195] = {questType = 'weekly'}, - [63198] = {questType = 'weekly'}, - [63199] = {questType = 'weekly'}, - [63433] = {questType = 'weekly'} - }, - -- World Boss - world_boss = { - [61813] = {questType = 'weekly'}, -- Valinor - Bastion - [61814] = {questType = 'weekly'}, -- Nurghash - Revendreth - [61815] = {questType = 'weekly'}, -- Oranomonos - Ardenweald - [61816] = {questType = 'weekly'}, -- Mortanis - Maldraxxus - [64531] = {questType = 'weekly'} -- Mor'geth, Tormentor of the Damned - }, - korthia_world_boss = { - [64531] = {questType = 'weekly'} -- Mor'geth, Tormentor of the Damned - }, - zereth_mortis_world_boss = { - [65143] = {questType = 'weekly'} -- Antros - }, - tormentors_weekly = { - [63854] = {questType = 'weekly'}, -- Tormentors of Torghast - [64122] = {questType = 'weekly'} -- Tormentors of Torghast - }, - tormentors_locations = { - [64692] = {questType = 'weekly'}, - [64693] = {questType = 'weekly'}, - [64694] = {questType = 'weekly'}, - [64695] = {questType = 'weekly'}, - [64696] = {questType = 'weekly'}, - [64697] = {questType = 'weekly'}, - [64698] = {questType = 'weekly'} - }, - containing_the_helsworn = { - [64273] = {questType = 'weekly'} -- Containing the Helsworn World Quest - }, - rift_vessels = { - [64265] = {questType = 'weekly'}, - [64269] = {questType = 'weekly'}, - [64270] = {questType = 'weekly'} - }, - maw_assault = { - [63824] = {questType = 'weekly'}, -- Kyrian - [63543] = {questType = 'weekly'}, -- Necrolord - [63822] = {questType = 'weekly'}, -- Venthyr - [63823] = {questType = 'weekly'} -- Nightfae - }, - assault_vessels = { - [64056] = {name = 'Venthyr', total = 2, questType = 'weekly'}, - [64055] = {name = 'Venthyr', total = 2, questType = 'weekly'}, - [64058] = {name = 'Kyrian', total = 2, questType = 'weekly'}, - [64057] = {name = 'Kyrian', total = 2, questType = 'weekly'}, - [64059] = {name = 'Night Fae', total = 2, questType = 'weekly'}, - [64060] = {name = 'Night Fae', total = 2, questType = 'weekly'}, - [64044] = {name = 'Necrolord', total = 2, questType = 'weekly'}, - [64045] = {name = 'Necrolord', total = 2, questType = 'weekly'} - }, - adamant_vault_conduit = { - [64347] = {questType = 'weekly'} - }, - sanctum_normal_embers_trash = { - [64610] = {questType = 'weekly'}, - [64613] = {questType = 'weekly'}, - [64616] = {questType = 'weekly'}, - [64619] = {questType = 'weekly'}, - [64622] = {questType = 'weekly'} - }, - sanctum_heroic_embers_trash = { - [64611] = {questType = 'weekly'}, - [64614] = {questType = 'weekly'}, - [64617] = {questType = 'weekly'}, - [64620] = {questType = 'weekly'}, - [64623] = {questType = 'weekly'} - }, - sandworn_chest = { - [65611] = {questType = 'daily'} - }, - puzzle_caches = { - [64972] = {questType = 'daily'}, -- Toccatian Cache - [65314] = {questType = 'daily'}, - [65319] = {questType = 'daily'}, - [65323] = {questType = 'daily'}, -- Cantaric Cache - [65094] = {questType = 'daily'}, - [65318] = {questType = 'daily'}, - [65091] = {questType = 'daily'}, -- Mezzonic Cache - [65315] = {questType = 'daily'}, - [65320] = {questType = 'daily'}, - [65316] = {questType = 'daily'}, -- Glissandian Cache - [65321] = {questType = 'daily'}, - [65092] = {questType = 'daily'}, - [65317] = {questType = 'daily'}, -- Fuguel Cache - [65322] = {questType = 'daily'}, - [65093] = {questType = 'daily'} - }, - korthia_five_dailies = { - [63727] = {questType = 'unlocks', log = true} - }, - zereth_mortis_three_dailies = { - [65219] = {questType = 'unlocks', log = true} - }, - dragonflight_world_boss = { - [69927] = {questType = 'weekly'}, - [69928] = {questType = 'weekly'}, - [69929] = {questType = 'weekly'}, - [69930] = {questType = 'weekly'}, - }, - aiding_the_accord = { - [70750] = {questType = 'weekly', log = true}, - [72068] = {questType = 'weekly', log = true}, - [72373] = {questType = 'weekly', log = true}, - [72374] = {questType = 'weekly', log = true}, - [72375] = {questType = 'weekly', log = true}, - [75259] = {questType = 'weekly', log = true}, - [75859] = {questType = 'weekly', log = true}, - [75860] = {questType = 'weekly', log = true}, - [75861] = {questType = 'weekly', log = true}, - [77254] = {questType = 'weekly', log = true}, - [77976] = {questType = 'weekly', log = true}, - [78446] = {questType = 'weekly', log = true}, - [78447] = {questType = 'weekly', log = true}, - [78861] = {questType = 'weekly', log = true}, - [80385] = {questType = 'weekly', log = true}, - [80386] = {questType = 'weekly', log = true}, - [80388] = {questType = 'weekly', log = true}, - [80389] = {questType = 'weekly', log = true}, - - }, - grand_hunts = { - [70906] = {questType = 'weekly'}, - [71136] = {questType = 'weekly'}, - [71137] = {questType = 'weekly'} - }, - marrukai_camp = { - [65784] = {questType = 'biweekly', log = true}, - [65789] = {questType = 'biweekly', log = true}, - [65792] = {questType = 'biweekly', log = true}, - [65796] = {questType = 'biweekly', log = true}, - [65798] = {questType = 'biweekly', log = true}, - [66698] = {questType = 'biweekly', log = true}, - [66711] = {questType = 'biweekly', log = true}, - [67034] = {questType = 'biweekly', log = true}, - [67039] = {questType = 'biweekly', log = true}, - [67222] = {questType = 'biweekly', log = true}, - [67605] = {questType = 'biweekly', log = true}, - [70210] = {questType = 'biweekly', log = true}, - [70299] = {questType = 'biweekly', log = true}, - [70279] = {questType = 'biweekly', log = true}, - [70352] = {questType = 'biweekly', log = true}, - [70701] = {questType = 'biweekly', log = true}, - [70990] = {questType = 'biweekly', log = true}, - [71241] = {questType = 'biweekly', log = true}, - }, - trial_of_flood = { - [71033] = {questType = 'weekly'} - }, - trial_of_elements = { - [71995] = {questType = 'weekly'} - }, - trial_of_storms = { - [74567] = {questType = 'weekly'} - }, - brackenhide_hollow_rares = { - [74032] = {questType = 'daily', name = 'Snarglebone'}, - [73985] = {questType = 'daily', name = 'Blisterhide'}, - [73996] = {questType = 'daily', name = 'Gnarls'}, - [74004] = {questType = 'daily', name = 'High Shaman Rotknuckle'}, - }, - knowledge_mobs = { - [70522] = {questType = 'weekly', skillLineID = 165, profession = 'Leatherworking', item = 198975}, --Leatherworking 1 - [70523] = {questType = 'weekly', skillLineID = 165, profession = 'Leatherworking', item = 198976}, --Leatherworking 2 - [73138] = {questType = 'weekly', skillLineID = 165, profession = 'Leatherworking', item = 204232}, --Leatherworking 3 - [70514] = {questType = 'weekly', skillLineID = 333, profession = 'Enchanting', item= 198967}, --Enchanting 1 - [70515] = {questType = 'weekly', skillLineID = 333, profession = 'Enchanting', item= 198968}, --Enchanting 2 - [73136] = {questType = 'weekly', skillLineID = 333, profession = 'Enchanting', item= 204224}, --Enchanting 3 - [70516] = {questType = 'weekly', skillLineID = 202, profession = 'Engineering', item = 198969}, --Engineering 1 - [70517] = {questType = 'weekly', skillLineID = 202, profession = 'Engineering', item = 198970}, --Engineering 2 - [73165] = {questType = 'weekly', skillLineID = 202, profession = 'Engineering', item = 204227}, --Engineering 3 - [70518] = {questType = 'weekly', skillLineID = 773, profession = 'Inscription', item = 198971}, --Inscription 1 - [70519] = {questType = 'weekly', skillLineID = 773, profession = 'Inscription', item = 198972}, --Inscription 2 - [73163] = {questType = 'weekly', skillLineID = 773, profession = 'Inscription', item = 204229}, --Inscription 3 - [70524] = {questType = 'weekly', skillLineID = 197, profession = 'Tailoring', item = 198977}, --Tailoring 1 - [70525] = {questType = 'weekly', skillLineID = 197, profession = 'Tailoring', item = 198978}, --Tailoring 2 - [73153] = {questType = 'weekly', skillLineID = 197, profession = 'Tailoring', item = 204225}, --Tailoring 3 - [70512] = {questType = 'weekly', skillLineID = 164, profession = 'Blacksmithing', item = 198965}, --Blacksmithing 1 - [70513] = {questType = 'weekly', skillLineID = 164, profession = 'Blacksmithing', item = 198966}, --Blacksmithing 2 - [73161] = {questType = 'weekly', skillLineID = 164, profession = 'Blacksmithing', item = 204230}, --Blacksmithing 3 - [70520] = {questType = 'weekly', skillLineID = 755, profession = 'Jewelcrafting', item = 198973}, --Jewelcrafting 1 - [70521] = {questType = 'weekly', skillLineID = 755, profession = 'Jewelcrafting', item = 198974}, --Jewelcrafting 2 - [73168] = {questType = 'weekly', skillLineID = 755, profession = 'Jewelcrafting', item = 204222}, --Jewelcrafting 3 - [70504] = {questType = 'weekly', skillLineID = 171, profession = 'Alchemy', item = 198963}, --Alchemy 1 - [70511] = {questType = 'weekly', skillLineID = 171, profession = 'Alchemy', item = 198964}, --Alchemy 2 - [73166] = {questType = 'weekly', skillLineID = 171, profession = 'Alchemy', item = 204226}, --Alchemy 3 - [71857] = {questType = 'weekly', skillLineID = 182, profession = 'Herbalism'}, --Herbalism 1 - [71858] = {questType = 'weekly', skillLineID = 182, profession = 'Herbalism'}, --Herbalism 2 - [71859] = {questType = 'weekly', skillLineID = 182, profession = 'Herbalism'}, --Herbalism 3 - [71860] = {questType = 'weekly', skillLineID = 182, profession = 'Herbalism'}, --Herbalism 4 - [71861] = {questType = 'weekly', skillLineID = 182, profession = 'Herbalism'}, --Herbalism 5 - [71864] = {questType = 'weekly', skillLineID = 182, profession = 'Herbalism'}, --Herbalism 6 - [70381] = {questType = 'weekly', skillLineID = 393, profession = 'Skinning'}, --Skinning 1 - [70383] = {questType = 'weekly', skillLineID = 393, profession = 'Skinning'}, --Skinning 2 - [70384] = {questType = 'weekly', skillLineID = 393, profession = 'Skinning'}, --Skinning 3 - [70385] = {questType = 'weekly', skillLineID = 393, profession = 'Skinning'}, --Skinning 4 - [70386] = {questType = 'weekly', skillLineID = 393, profession = 'Skinning'}, --Skinning 5 - [70389] = {questType = 'weekly', skillLineID = 393, profession = 'Skinning'}, --Skinning 6 - [72160] = {questType = 'weekly', skillLineID = 186, profession = 'Mining'}, --Mining 1 - [72161] = {questType = 'weekly', skillLineID = 186, profession = 'Mining'}, --Mining 2 - [72162] = {questType = 'weekly', skillLineID = 186, profession = 'Mining'}, --Mining 3 - [72163] = {questType = 'weekly', skillLineID = 186, profession = 'Mining'}, --Mining 4 - [72164] = {questType = 'weekly', skillLineID = 186, profession = 'Mining'}, --Mining 5 - [72165] = {questType = 'weekly', skillLineID = 186, profession = 'Mining'}, --Mining 6 - }, - knowledge_scout_packs = { - [66375] = {questType = 'weekly', skillLineID = 773, profession = 'Inscription', item = 193904}, --Inscription 1 - [66376] = {questType = 'weekly', skillLineID = 773, profession = 'Inscription', item = 193905}, --Inscription 2 - [66384] = {questType = 'weekly', skillLineID = 165, profession = 'Leatherworking', item = 193910}, --Leatherworking 1 - [66385] = {questType = 'weekly', skillLineID = 165, profession = 'Leatherworking', item = 193913}, --Leatherworking 2 - [66386] = {questType = 'weekly', skillLineID = 197, profession = 'Tailoring', item = 193898}, --Tailoring 1 - [66387] = {questType = 'weekly', skillLineID = 197, profession = 'Tailoring', item = 193899}, --Tailoring 2 - [66377] = {questType = 'weekly', skillLineID = 333, profession = 'Enchanting', item = 193900}, --Enchanting 1 - [66378] = {questType = 'weekly', skillLineID = 333, profession = 'Enchanting', item = 193901}, --Enchanting 2 - [66381] = {questType = 'weekly', skillLineID = 164, profession = 'Blacksmithing', item = 192131}, --Blacksmithing 1 - [66382] = {questType = 'weekly', skillLineID = 164, profession = 'Blacksmithing', item = 192132}, --Blacksmithing 2 - [66379] = {questType = 'weekly', skillLineID = 202, profession = 'Engineering', item = 193902}, --Engineering 1 - [66380] = {questType = 'weekly', skillLineID = 202, profession = 'Engineering', item = 193903}, --Engineering 2 - [66388] = {questType = 'weekly', skillLineID = 755, profession = 'Jewelcrafting', item = 193909}, --Jewelcrafting 1 - [66389] = {questType = 'weekly', skillLineID = 755, profession = 'Jewelcrafting', item = 193907}, --Jewelcrafting 2 - [66373] = {questType = 'weekly', skillLineID = 171, profession = 'Alchemy', item = 193891}, --Alchemy 1 - [66374] = {questType = 'weekly', skillLineID = 171, profession = 'Alchemy', item = 193897}, --Alchemy 2 - }, - knowledge_treatise = { - [74105] = {questType = 'weekly', skillLineID = 773, profession = 'Inscription'}, -- Inscription - [74106] = {questType = 'weekly', skillLineID = 186, profession = 'Mining'}, -- Mining - [74107] = {questType = 'weekly', skillLineID = 182, profession = 'Herbalism'}, -- Herbalism - [74108] = {questType = 'weekly', skillLineID = 171, profession = 'Alchemy'}, -- Alchemy - [74109] = {questType = 'weekly', skillLineID = 164, profession = 'Blacksmithing'}, -- Blacksmithing - [74110] = {questType = 'weekly', skillLineID = 333, profession = 'Enchanting'}, -- Enchanting - [74111] = {questType = 'weekly', skillLineID = 202, profession = 'Engineering'}, -- Engineering - [74112] = {questType = 'weekly', skillLineID = 755, profession = 'Jewelcrafting'}, -- Jewelcrafting - [74113] = {questType = 'weekly', skillLineID = 165, profession = 'Leatherworking'}, -- Leatherworking - [74114] = {questType = 'weekly', skillLineID = 393, profession = 'Skinning'}, -- Skinning - [74115] = {questType = 'weekly', skillLineID = 197, profession = 'Tailoring'}, -- Tailoring - }, - knowledge_weeklies_craft = { - [70558] = {questType = 'weekly', log = true}, -- Inscription 1 - [70559] = {questType = 'weekly', log = true}, -- Inscription 2 - [70560] = {questType = 'weekly', log = true}, -- Inscription 3 - [70561] = {questType = 'weekly', log = true}, -- Inscription 4 - [70567] = {questType = 'weekly', log = true}, -- Leatherworking 1 - [70568] = {questType = 'weekly', log = true}, -- Leatherworking 2 - [70569] = {questType = 'weekly', log = true}, -- Leatherworking 3 - [70571] = {questType = 'weekly', log = true}, -- Leatherworking 4 - [70572] = {questType = 'weekly', log = true}, -- Tailoring 1 - [70582] = {questType = 'weekly', log = true}, -- Tailoring 2 - [70586] = {questType = 'weekly', log = true}, -- Tailoring 3 - [70587] = {questType = 'weekly', log = true}, -- Tailoring 4 - [72155] = {questType = 'weekly', log = true}, -- Enchanting 1 - [72172] = {questType = 'weekly', log = true}, -- Enchanting 2 - [72175] = {questType = 'weekly', log = true}, -- Enchanting 3 - [72173] = {questType = 'weekly', log = true}, -- Enchanting 4 - [70233] = {questType = 'weekly', log = true}, -- Blacksmithing 1 - [70234] = {questType = 'weekly', log = true}, -- Blacksmithing 2 - [70235] = {questType = 'weekly', log = true}, -- Blacksmithing 3 - [70211] = {questType = 'weekly', log = true}, -- Blacksmithing 4 - [70540] = {questType = 'weekly', log = true}, -- Engineering 1 - [70545] = {questType = 'weekly', log = true}, -- Engineering 2 - [70557] = {questType = 'weekly', log = true}, -- Engineering 3 - [70539] = {questType = 'weekly', log = true}, -- Engineering 4 - [70562] = {questType = 'weekly', log = true}, -- Jewelcrafting 1 - [70563] = {questType = 'weekly', log = true}, -- Jewelcrafting 2 - [70564] = {questType = 'weekly', log = true}, -- Jewelcrafting 3 - [70565] = {questType = 'weekly', log = true}, -- Jewelcrafting 4 - [70531] = {questType = 'weekly', log = true}, -- Alchemy 1 - [70532] = {questType = 'weekly', log = true}, -- Alchemy 2 - [70533] = {questType = 'weekly', log = true}, -- Alchemy 3 - [70530] = {questType = 'weekly', log = true}, -- Alchemy 4 - }, - knowledge_weeklies_loot = { - [66943] = {questType = 'weekly', log = true}, -- Inscription 5 - [66944] = {questType = 'weekly', log = true}, -- Inscription 6 - [66945] = {questType = 'weekly', log = true}, -- Inscription 7 - [72438] = {questType = 'weekly', log = true}, -- Inscription 8 - [66363] = {questType = 'weekly', log = true}, -- Leatherworking 5 - [66364] = {questType = 'weekly', log = true}, -- Leatherworking 6 - [66951] = {questType = 'weekly', log = true}, -- Leatherworking 7 - [72407] = {questType = 'weekly', log = true}, -- Leatherworking 8 - [66899] = {questType = 'weekly', log = true}, -- Tailoring 5 - [66952] = {questType = 'weekly', log = true}, -- Tailoring 6 - [66953] = {questType = 'weekly', log = true}, -- Tailoring 7 - [72410] = {questType = 'weekly', log = true}, -- Tailoring 8 - [66884] = {questType = 'weekly', log = true}, -- Enchanting 5 - [66900] = {questType = 'weekly', log = true}, -- Enchanting 6 - [66935] = {questType = 'weekly', log = true}, -- Enchanting 7 - [72423] = {questType = 'weekly', log = true}, -- Enchanting 8 - [66517] = {questType = 'weekly', log = true}, -- Blacksmithing 5 - [66941] = {questType = 'weekly', log = true}, -- Blacksmithing 6 - [72398] = {questType = 'weekly', log = true}, -- Blacksmithing 7 - [66897] = {questType = 'weekly', log = true}, -- Blacksmithing 8 - [66891] = {questType = 'weekly', log = true}, -- Engineering 5 - [66890] = {questType = 'weekly', log = true}, -- Engineering 6 - [66942] = {questType = 'weekly', log = true}, -- Engineering 7 - [72396] = {questType = 'weekly', log = true}, -- Engineering 8 - [73165] = {questType = 'weekly', log = true}, -- Engineering 9 - [66516] = {questType = 'weekly', log = true}, -- Jewelcrafting 5 - [66949] = {questType = 'weekly', log = true}, -- Jewelcrafting 6 - [66950] = {questType = 'weekly', log = true}, -- Jewelcrafting 7 - [72428] = {questType = 'weekly', log = true}, -- Jewelcrafting 8 - [66937] = {questType = 'weekly', log = true}, -- Alchemy 5 - [66938] = {questType = 'weekly', log = true}, -- Alchemy 6 - [66940] = {questType = 'weekly', log = true}, -- Alchemy 7 - [72427] = {questType = 'weekly', log = true}, -- Alchemy 8 - [70613] = {questType = 'weekly', log = true}, -- Herbalism 5 - [70614] = {questType = 'weekly', log = true}, -- Herbalism 6 - [70615] = {questType = 'weekly', log = true}, -- Herbalism 7 - [70616] = {questType = 'weekly', log = true}, -- Herbalism 8 - --[71970] = {questType = 'weekly', log = true}, -- Herbalism 8 - --[71857] = {questType = 'weekly', log = true}, -- Herbalism 8 - [70620] = {questType = 'weekly', log = true}, -- Skinning 5 - [72159] = {questType = 'weekly', log = true}, -- Skinning 6 - [70619] = {questType = 'weekly', log = true}, -- Skinning 7 - [72158] = {questType = 'weekly', log = true}, -- Skinning 8 - [72157] = {questType = 'weekly', log = true}, -- Mining 5 - [70617] = {questType = 'weekly', log = true}, -- Mining 6 - [70618] = {questType = 'weekly', log = true}, -- Mining 7 - [72156] = {questType = 'weekly', log = true}, -- Mining 8 - --[66936] = {questType = 'weekly', log = true}, -- Mining 8 - [75354] = {questType = 'weekly', log = true}, -- Leatherworking - [75368] = {questType = 'weekly', log = true}, -- Leatherworking - [77945] = {questType = 'weekly', log = true}, -- Leatherworking - [77946] = {questType = 'weekly', log = true}, -- Leatherworking - [75150] = {questType = 'weekly', log = true}, -- Enchanting - [75865] = {questType = 'weekly', log = true}, -- Enchanting - [77910] = {questType = 'weekly', log = true}, -- Enchanting - [77937] = {questType = 'weekly', log = true}, -- Enchanting - [75148] = {questType = 'weekly', log = true}, -- Blacksmithing - [75569] = {questType = 'weekly', log = true}, -- Blacksmithing - [77935] = {questType = 'weekly', log = true}, -- Blacksmithing - [77936] = {questType = 'weekly', log = true}, -- Blacksmithing - [75575] = {questType = 'weekly', log = true}, -- Engineering - [75608] = {questType = 'weekly', log = true}, -- Engineering - [77891] = {questType = 'weekly', log = true}, -- Engineering - [77938] = {questType = 'weekly', log = true}, -- Engineering - [75149] = {questType = 'weekly', log = true}, -- Inscription - [75573] = {questType = 'weekly', log = true}, -- Inscription - [77889] = {questType = 'weekly', log = true}, -- Inscription - [77914] = {questType = 'weekly', log = true}, -- Inscription - [75407] = {questType = 'weekly', log = true}, -- Tailoring - [75600] = {questType = 'weekly', log = true}, -- Tailoring - [77947] = {questType = 'weekly', log = true}, -- Tailoring - [77949] = {questType = 'weekly', log = true}, -- Tailoring - [75362] = {questType = 'weekly', log = true}, -- Jewelcrafting - [75602] = {questType = 'weekly', log = true}, -- Jewelcrafting - [77892] = {questType = 'weekly', log = true}, -- Jewelcrafting - [77912] = {questType = 'weekly', log = true}, -- Jewelcrafting - [75363] = {questType = 'weekly', log = true}, -- Alchemy - [75371] = {questType = 'weekly', log = true}, -- Alchemy - [77932] = {questType = 'weekly', log = true}, -- Alchemy - [77933] = {questType = 'weekly', log = true}, -- Alchemy - }, - knowledge_weeklies_order = { - [70589] = {questType = 'weekly', log = true}, -- Blacksmithing 0 - [70591] = {questType = 'weekly', log = true}, -- Engineering 0 - [70592] = {questType = 'weekly', log = true}, -- Inscription 0 - [70593] = {questType = 'weekly', log = true}, -- Jewelcrafting 0 - [70594] = {questType = 'weekly', log = true}, -- Leatherworking 0 - [70595] = {questType = 'weekly', log = true}, -- Tailoring 0 - }, - community_feast = { - [74097] = {questType = 'daily'}, - }, - iskaara_story = { - [72291] = {questType = 'weekly', log = true}, - }, - obsidian_citadel_rares = { - [72127] = {questType = 'daily', name = 'Captain Lancer'}, - [73072] = {questType = 'daily', name = 'Enkine the Voracious'}, - [74067] = {questType = 'daily', name = 'Morchok'}, - [74054] = {questType = 'daily', name = 'Turboris'}, - [74043] = {questType = 'daily', name = 'Char'}, - [74040] = {questType = 'daily', name = 'Battlehorn Pyrhus'}, - [74042] = {questType = 'daily', name = 'Cauldronbreaker Blakor'}, - [74052] = {questType = 'daily', name = 'Rohzor Forgesmash'}, - }, - tyrhold_rares = { - [74055] = {questType = 'daily', name = 'Ancient Protector'}, - }, - iskaara_fishing_dailies = { - [70438] = {questType = 'daily', log = true}, - [70450] = {questType = 'daily', log = true}, - [71191] = {questType = 'daily', log = true}, - [71194] = {questType = 'daily', log = true}, - [72069] = {questType = 'daily', log = true}, - [72075] = {questType = 'daily', log = true}, - - }, - community_feast_weekly = { - [70893] = {questType = 'weekly', log = true}, - }, - dragonbane_keep_siege = { - [70866] = {questType = 'weekly'}, - }, - dragonbane_keep_key = { - [66805] = {questType = 'weekly', log = true}, - [66133] = {questType = 'weekly', log = true}, - }, - dragonbane_keep_weeklies = { - [65842] = {questType = 'weekly', log = true}, - [66103] = {questType = 'weekly', log = true}, - [66308] = {questType = 'weekly', log = true}, - [66321] = {questType = 'weekly', log = true}, - [66326] = {questType = 'weekly', log = true}, - [66445] = {questType = 'weekly', log = true}, - [66449] = {questType = 'weekly', log = true}, - [66633] = {questType = 'weekly', log = true}, - [66926] = {questType = 'weekly', log = true}, - [67051] = {questType = 'weekly', log = true}, - [67099] = {questType = 'weekly', log = true}, - [67142] = {questType = 'weekly', log = true}, - [69918] = {questType = 'weekly', log = true}, - [70848] = {questType = 'weekly', log = true}, - [72447] = {questType = 'weekly', log = true}, - [72448] = {questType = 'weekly', log = true}, - }, - show_your_mettle = { - [70221] = {questType = 'weekly', log = true}, - }, - fish_turnins_df = { - [72828] = {questType = 'weekly', name = '|T1387373:0|t[Scalebelly Mackerel]'}, - [72823] = {questType = 'weekly', name = '|T4554376:0|t[Islefin Dorado]'}, - [72827] = {questType = 'weekly', name = '|T4554372:0|t[Thousandbite Piranha]'}, - [72826] = {questType = 'weekly', name = '|T4539689:0|t[Aileron Seamoth]'}, - [72825] = {questType = 'weekly', name = '|T4539687:0|t[Cerulean Spinefish]'}, - [72824] = {questType = 'weekly', name = '|T4554371:0|t[Temporal Dragonhead]'}, - }, - sparks_of_life = { - [72646] = {questType = 'weekly', log = true}, - [72647] = {questType = 'weekly', log = true}, - [72648] = {questType = 'weekly', log = true}, - [72649] = {questType = 'weekly', log = true}, - [74871] = {questType = 'weekly', log = true}, - [75305] = {questType = 'weekly', log = true}, - [78097] = {questType = 'weekly', log = true}, - }, - forbidden_reach_weeklies = { - [72952] = {questType = 'weekly', log = true}, - [73140] = {questType = 'weekly', log = true}, - [73141] = {questType = 'weekly', log = true}, - [73142] = {questType = 'weekly', log = true}, - [73179] = {questType = 'weekly', log = true}, - [73190] = {questType = 'weekly', log = true}, - [73191] = {questType = 'weekly', log = true}, - [73194] = {questType = 'weekly', log = true}, - [73715] = {questType = 'weekly', log = true}, - [74282] = {questType = 'weekly', log = true}, - [74284] = {questType = 'weekly', log = true}, - [74293] = {questType = 'weekly', log = true}, - [74379] = {questType = 'weekly', log = true}, - [75024] = {questType = 'weekly', log = true}, - [75025] = {questType = 'weekly', log = true}, - }, - forbidden_reach_task_picked = { - [74908] = {questType = 'daily', log = true}, -- Dragonscale Expedition - [74909] = {questType = 'daily', log = true}, -- Iskaara Tuskarr - [74910] = {questType = 'daily', log = true}, -- Maruuk Centaur - [74911] = {questType = 'daily', log = true}, -- Valdrakken Akkord - }, - forbidden_reach_tasks = { - [74118] = {questType = 'daily', log = true}, -- Dragonscale Expedition - [74389] = {questType = 'daily', log = true}, -- Dragonscale Expedition - [74119] = {questType = 'daily', log = true}, -- Iskaara Tuskarr - [74391] = {questType = 'daily', log = true}, -- Iskaara Tuskarr - [74117] = {questType = 'daily', log = true}, -- Maruuk Centaur - [74390] = {questType = 'daily', log = true}, -- Maruuk Centaur - [75261] = {questType = 'daily', log = true}, -- Valdrakken Akkord - [75263] = {questType = 'daily', log = true}, -- Valdrakken Akkord - }, - forbidden_reach_elite_wqs = { - [75257] = {questType = 'weekly', log = true}, -- The War Creche - }, - glimerogg_racer_dailies = { - [74514] = {questType = 'weekly', log = true}, -- The Slowest Fan Club - [74515] = {questType = 'weekly', log = true}, -- Snail Mail - [74516] = {questType = 'weekly', log = true}, -- A Snail's Pace - [74517] = {questType = 'weekly', log = true}, -- All Terrain Snail - [74518] = {questType = 'weekly', log = true}, -- Resistance Training - [74519] = {questType = 'weekly', log = true}, -- Good for Goo - [74520] = {questType = 'weekly', log = true}, -- Less Cargo - }, - loamm_niffen_weekly = { - [75665] = {questType = 'weekly', log = true}, - }, - researchers_under_fire_weekly = { - [75627] = {questType = 'weekly'}, - [75628] = {questType = 'weekly'}, - [75629] = {questType = 'weekly'}, - [75630] = {questType = 'weekly'}, - }, - zc_wb_wq = { - [74892] = {questType = 'weekly', log = true}, -- Zaqali Elders - }, - dig_maps_weeklies = { - [75747] = {questType = 'weekly'}, - [75748] = {questType = 'weekly'}, - [75749] = {questType = 'weekly'}, - }, - dig_maps_received_weekly = { - [76077] = {questType = 'weekly'}, - [75665] = {questType = 'weekly'}, - }, - proven_weekly = { - [72166] = {questType = 'weekly', log = true}, - [72167] = {questType = 'weekly', log = true}, - [72168] = {questType = 'weekly', log = true}, - [72169] = {questType = 'weekly', log = true}, - [72170] = {questType = 'weekly', log = true}, - [72171] = {questType = 'weekly', log = true}, - }, - fyrak_assault = { - [75467] = {questType = 'weekly'}, - }, - zyrak_cavern_zone_events = { - [75664] = {questType = 'weekly', forceUpdate = true}, - [75156] = {questType = 'weekly', forceUpdate = true}, - [75471] = {questType = 'weekly', forceUpdate = true}, - [75222] = {questType = 'weekly', forceUpdate = true}, - [75370] = {questType = 'weekly', forceUpdate = true}, - [75441] = {questType = 'weekly', forceUpdate = true}, - [75611] = {questType = 'weekly', forceUpdate = true}, - [75624] = {questType = 'weekly', forceUpdate = true}, - [75612] = {questType = 'weekly', forceUpdate = true}, - [75454] = {questType = 'weekly', forceUpdate = true}, - [75455] = {questType = 'weekly', forceUpdate = true}, - [75450] = {questType = 'weekly', forceUpdate = true}, - [75451] = {questType = 'weekly', forceUpdate = true}, - [75461] = {questType = 'weekly', forceUpdate = true}, - [74352] = {questType = 'weekly', forceUpdate = true}, - [75478] = {questType = 'weekly', forceUpdate = true}, - [75494] = {questType = 'weekly', forceUpdate = true}, - [75705] = {questType = 'weekly', forceUpdate = true}, - }, - time_rift = { - [77236] = {questType = 'weekly', log = true}, - }, - time_rift_pod = { - [77836] = {questType = 'weekly'} - }, - dreamsurge_weekly = { - [77251] = {questType = 'weekly', log = true}, - }, - ed_wb_wq = { - [76367] = {questType = 'weekly', log = true}, -- Aurostor - }, - dream_wardens_weekly = { - [78444] = {questType = 'weekly', log = true}, - }, - superbloom = { - [78319] = {questType = 'weekly', log = true}, - }, - dream_shipments = { - [78427] = {questType = 'weekly', log = true}, - [78428] = {questType = 'weekly', log = true}, - }, - anniversary_wb = { - [47461] = {questType = 'daily', name = "Kazzak"}, -- Kazzak - [47462] = {questType = 'daily', name = "Azuregos"}, -- Azuregos - [47463] = {questType = 'daily', name = "Dragons of Nightmare"}, -- Dragons of Nightmare - [60214] = {questType = 'daily', name = "Doomwalker"}, -- Doomwalker - }, - - -- 11.0 PREPATCH - radiant_echoes_prepatch_weeklies = { - [82689] = {questType = 'weekly', log = true}, --name = 'Only Darkness'}, - [82676] = {questType = 'weekly', log = true}, --name = 'Broken Masquerade'}, - [78938] = {questType = 'weekly', log = true}, --name = 'Champion of the Waterlords'}, + -- 11.0 The War Within + -- Weekly World Activities + tww_world_boss = { -- PLACEHOLDER: wrong quest IDs + [999990] = { questType = "weekly" }, -- Kordac, the Dormant Protector + [83466] = { questType = "weekly" }, -- Aggregation of Horrors + [83467] = { questType = "weekly" }, -- Shurrai, Atrocity of the Undersea + [999993] = { questType = "weekly" }, -- Orta, the Broken Mountain + }, + worldsoul_weekly = { + [82452] = { questType = "weekly", log = true }, -- Worldsoul: World Quests + [82453] = { questType = "weekly", log = true }, -- Worldsoul: Encore! + [82458] = { questType = "weekly", log = true }, -- Worldsoul: Renown + [82482] = { questType = "weekly", log = true }, -- Worldsoul: Snuffling + [82483] = { questType = "weekly", log = true }, -- Worldsoul: Spreading the Light + [82485] = { questType = "weekly", log = true }, -- Worldsoul: Cinderbrew Meadery + [82486] = { questType = "weekly", log = true }, -- Worldsoul: The Rookery + [82487] = { questType = "weekly", log = true }, -- Worldsoul: The Stonevault + [82488] = { questType = "weekly", log = true }, -- Worldsoul: Darkflame Cleft + [82489] = { questType = "weekly", log = true }, -- Worldsoul: The Dawnbreaker + [82490] = { questType = "weekly", log = true }, -- Worldsoul: Priory of the Sacred Flame + [82491] = { questType = "weekly", log = true }, -- Worldsoul: Ara-Kara, City of Echoes + [82492] = { questType = "weekly", log = true }, -- Worldsoul: City of Threads + [82493] = { questType = "weekly", log = true }, -- Worldsoul: The Dawnbreaker + [82494] = { questType = "weekly", log = true }, -- Worldsoul: Ara-Kara, City of Echoes + [82495] = { questType = "weekly", log = true }, -- Worldsoul: Cinderbrew Meadery + [82496] = { questType = "weekly", log = true }, -- Worldsoul: City of Threads + [82497] = { questType = "weekly", log = true }, -- Worldsoul: The Stonevault + [82498] = { questType = "weekly", log = true }, -- Worldsoul: Darkflame Cleft + [82499] = { questType = "weekly", log = true }, -- Worldsoul: Priory of the Sacred Flame + [82500] = { questType = "weekly", log = true }, -- Worldsoul: The Rookery + [82501] = { questType = "weekly", log = true }, -- Worldsoul: The Dawnbreaker + [82502] = { questType = "weekly", log = true }, -- Worldsoul: Ara-Kara, City of Echoes + [82503] = { questType = "weekly", log = true }, -- Worldsoul: Cinderbrew Meadery + [82504] = { questType = "weekly", log = true }, -- Worldsoul: City of Threads + [82505] = { questType = "weekly", log = true }, -- Worldsoul: The Stonevault + [82506] = { questType = "weekly", log = true }, -- Worldsoul: Darkflame Cleft + [82507] = { questType = "weekly", log = true }, -- Worldsoul: Priory of the Sacred Flame + [82508] = { questType = "weekly", log = true }, -- Worldsoul: The Rookery + [82509] = { questType = "weekly", log = true }, -- Worldsoul: Nerub-ar Palace + [82510] = { questType = "weekly", log = true }, -- Worldsoul: Nerub-ar Palace + [82511] = { questType = "weekly", log = true }, -- Worldsoul: Awakening Machine + [82512] = { questType = "weekly", log = true }, -- Worldsoul: World Boss + [82516] = { questType = "weekly", log = true }, -- Worldsoul: Forging a Pact + [82659] = { questType = "weekly", log = true }, -- Worldsoul: Nerub-ar Palace + -- [86476] = { questType = 'weekly', log = true }, -- Worldsoul Memory: Early Cartel Wars + -- [86478] = { questType = 'weekly', log = true }, -- Worldsoul Memory: Kaja'mite Contact + [87417] = { questType = "weekly", log = true }, -- Worldsoul: Dungeons + [87419] = { questType = "weekly", log = true }, -- Worldsoul: Delves + [87422] = { questType = "weekly", log = true }, -- Worldsoul: Undermine World Quests + [87423] = { questType = "weekly", log = true }, -- Worldsoul: Undermine Explorer + [87424] = { questType = "weekly", log = true }, -- Worldsoul: World Bosses + [89502] = { questType = "weekly", log = true }, -- Worldsoul: Nightfall + [89514] = { questType = "weekly", log = true }, -- Worldsoul: Horrific Visions Revisited + [91052] = { questType = "weekly", log = true }, -- Worldsoul: Overcharged Delves + [91855] = { questType = "weekly", log = true }, -- Worldsoul: K'aresh World Quests + + [82746] = { questType = "weekly", log = true }, -- Delves: Breaking Tough to Loot Stuff + [82712] = { questType = "weekly", log = true }, -- Delves: Trouble Up and Down Khaz Algar + [82711] = { questType = "weekly", log = true }, -- Delves: Lost and Found + [82709] = { questType = "weekly", log = true }, -- Delves: Percussive Archaeology + [82706] = { questType = "weekly", log = true }, -- Delves: Khaz Algar Research + [82707] = { questType = "weekly", log = true }, -- Delves: Earthen Defense + [82708] = { questType = "weekly", log = true }, -- Delves: Nerubian Menace + [82678] = { questType = "weekly", log = true }, -- Archives: The First Disc + [82679] = { questType = "weekly", log = true }, -- Archives: Seeking History + }, + weekly_meta = { -- PLACEHOLDER: Looks like this weekly doesn't reset but is just a timegated questline. Delete later + }, + archaic_cypher_key = { + [84370] = { questType = "weekly", warband = true, log = true }, -- The Key to Success + }, + the_theater_troupe = { + [83240] = { questType = "weekly", warband = true, log = true }, -- The Theater Troupe + }, + rollin_down_in_the_deeps = { + [82946] = { questType = "weekly", warband = true, log = true }, -- Rollin' Down in the Deeps (Digging) + }, + gearing_up_for_trouble = { + [83333] = { questType = "weekly", log = true }, -- Gearing Up for Trouble (Awakening the Machine Weekly) + }, + awakening_the_machine = { + [84642] = { questType = "weekly", warband = true, name = "1st Cache" }, -- cache 1 + [84644] = { questType = "weekly", warband = true, name = "2nd Cache" }, -- cache 2 + [84646] = { questType = "weekly", warband = true, name = "3rd Cache" }, -- cache 3 + [84647] = { questType = "weekly", warband = true, name = "4th Cache" }, -- cache 4 + }, + spreading_the_light = { + [76586] = { questType = "weekly", warband = true, log = true }, -- Hallowfall Event in Dunelle's Kindness + }, + lesser_keyflame_weeklies = { + [76169] = { questType = "weekly", warband = true, log = true }, -- Glow in the Dark + [76394] = { questType = "weekly", warband = true, log = true }, -- Shadows of Flavor + [76600] = { questType = "weekly", warband = true, log = true }, -- Right Between the Gyro-Optics + [76733] = { questType = "weekly", warband = true, log = true }, -- Tater Trawl + [76997] = { questType = "weekly", warband = true, log = true }, -- Lost in Shadows + [78656] = { questType = "weekly", warband = true, log = true }, -- Hose It Down + [78915] = { questType = "weekly", warband = true, log = true }, -- Squashing the Threat + [78933] = { questType = "weekly", warband = true, log = true }, -- The Sweet Eclipse + [78972] = { questType = "weekly", warband = true, log = true }, -- Harvest Havoc + [79158] = { questType = "weekly", warband = true, log = true }, -- Seeds of Salvation + [79173] = { questType = "weekly", warband = true, log = true }, -- Supply the Effort + [79216] = { questType = "weekly", warband = true, log = true }, -- Web of Manipulation + [79346] = { questType = "weekly", warband = true, log = true }, -- Chew On That + [80004] = { questType = "weekly", warband = true, log = true }, -- Crab Grab + [80562] = { questType = "weekly", warband = true, log = true }, -- Blossoming Delight + [81574] = { questType = "weekly", warband = true, log = true }, -- Sporadic Growth + [81632] = { questType = "weekly", warband = true, log = true }, -- Lizard Looters + }, + greater_keyflame_weeklies = { -- not added to default categories because shit rewards + [78590] = { questType = "weekly", log = true }, -- Cutting Edge + [78657] = { questType = "weekly", log = true }, -- The Midnight Sentry + [79329] = { questType = "weekly", log = true }, -- Glowing Harvest + [79380] = { questType = "weekly", log = true }, -- Bog Beast Banishment + [79469] = { questType = "weekly", log = true }, -- Lurking Below + [79470] = { questType = "weekly", log = true }, -- Waters of War + [79471] = { questType = "weekly", log = true }, -- Bleak Sand + }, + severed_threads_pact_chosen = { + [80544] = { questType = "weekly", warband = true, log = true }, -- Eyes of the Weaver + }, + severed_threads_pact_weekly = { + [80670] = { questType = "weekly", warband = true, log = true }, -- Eyes of the Weaver + [80671] = { questType = "weekly", warband = true, log = true }, -- Blade of the General + [80672] = { questType = "weekly", warband = true, log = true }, -- Hand of the Vizier + }, + weekly_delve_reputation = { + [83317] = { questType = "weekly", warband = "unique", name = "Council of Dornogal" }, + [83318] = { questType = "weekly", warband = "unique", name = "Assembly of the Deeps" }, + [83320] = { questType = "weekly", warband = "unique", name = "Hallowfall Arathi" }, + [83319] = { questType = "weekly", warband = "unique", name = "Severed Threads" }, + }, + weekly_coffer_keys = { + [84736] = { questType = "weekly" }, + [84737] = { questType = "weekly" }, + [84738] = { questType = "weekly" }, + [84739] = { questType = "weekly" }, + }, + + -- Weekly Rares + isle_of_dorne_rares = { + [84037] = { questType = "weekly", warband = true, name = "Tephratennae" }, -- (daily: 81923) + [84031] = { questType = "weekly", warband = true, name = "Kronolith, Might of the Mountain" }, -- (daily: 81902) + [84032] = { questType = "weekly", warband = true, name = "Shallowshell the Clacker" }, -- (daily: 81903) + [84036] = { questType = "weekly", warband = true, name = "Clawbreaker K'zithix" }, -- (daily: 81920) + [84029] = { questType = "weekly", warband = true, name = "Escaped Cutthroat" }, -- (daily: 81907) + [84039] = { questType = "weekly", warband = true, name = "Matriarch Charfuria" }, -- (daily: 81921) + [84030] = { questType = "weekly", warband = true, name = "Tempest Lord Incarnus" }, -- (daily: 81901) + [84028] = { questType = "weekly", warband = true, name = "Gar'loc" }, -- (daily: 81899) + [84033] = { questType = "weekly", warband = true, name = "Twice-Stinger the Wretched" }, -- (daily: 81904) + [84034] = { questType = "weekly", warband = true, name = "Flamekeeper Graz" }, -- (daily: 81905) + [84026] = { questType = "weekly", warband = true, name = "Plaguehart" }, -- (daily: 81897) + [84038] = { questType = "weekly", warband = true, name = "Sweetspark the Oozeful" }, -- (daily: 81922) + }, + ringing_deeps_rares = { + [84046] = { questType = "weekly", warband = true, name = "Automaxor" }, -- (daily: 81674) + [84044] = { questType = "weekly", warband = true, name = "Charmonger" }, -- (daily: 81562) + [84042] = { questType = "weekly", warband = true, name = "Cragmund" }, -- (daily: 80560) + [84041] = { questType = "weekly", warband = true, name = "Zilthara" }, -- (daily: 80506) + [84045] = { questType = "weekly", warband = true, name = "Coalesced Monstrosity" }, -- (daily: 81511) + [84040] = { questType = "weekly", warband = true, name = "Terror of the Forge" }, -- (daily: 80507) + [84047] = { questType = "weekly", warband = true, name = "Kelpmire" }, -- (daily: 81485) + [84043] = { questType = "weekly", warband = true, name = "Trungal" }, -- (daily: 80574) + [84049] = { questType = "weekly", warband = true, name = "Spore-infused Shalewing" }, -- (daily: 81652) + [84048] = { questType = "weekly", warband = true, name = "Hungerer of the Deeps" }, -- (daily: 81648) + [84050] = { questType = "weekly", warband = true, name = "Disturbed Earthgorger" }, -- (daily: 80003) + }, + hallowfall_rares = { + [84063] = { questType = "weekly", warband = true, name = "Lytfang the Lost" }, -- (daily: 81756) + [84051] = { questType = "weekly", warband = true, name = "Moth'ethk" }, -- (daily: 82557) + [84064] = { questType = "weekly", warband = true, name = "The Perchfather" }, -- (daily: 81791) + [84061] = { questType = "weekly", warband = true, name = "The Taskmaker" }, -- (daily: 80009) + [84066] = { questType = "weekly", warband = true, name = "Strength of Beledar" }, -- (daily: 81849) + [84060] = { questType = "weekly", warband = true, name = "Murkspike" }, -- (daily: 82565) + [84053] = { questType = "weekly", warband = true, name = "Deathpetal" }, -- (daily: 82559) + [84056] = { questType = "weekly", warband = true, name = "Duskshadow" }, -- (daily: 82562) + [84067] = { questType = "weekly", warband = true, name = "Sir Alastair Purefire" }, -- (daily: 81853) + [84065] = { questType = "weekly", warband = true, name = "Horror of the Shallows" }, -- (daily: 81836) + [84062] = { questType = "weekly", warband = true, name = "Sloshmuck" }, -- (daily: 79271) + [84054] = { questType = "weekly", warband = true, name = "Croakit" }, -- (daily: 82560) + [84068] = { questType = "weekly", warband = true, name = "Pride of Beledar" }, -- (daily: 81882) + [84052] = { questType = "weekly", warband = true, name = "Crazed Cabbage Smacker" }, -- (daily: 82558) + [84055] = { questType = "weekly", warband = true, name = "Toadstomper" }, -- (daily: 82561) + [84059] = { questType = "weekly", warband = true, name = "Finclaw Bloodtide" }, -- (daily: 82564) + [84058] = { questType = "weekly", warband = true, name = "Ravageant" }, -- (daily: 82566) + [84057] = { questType = "weekly", warband = true, name = "Parasidious" }, -- (daily: 82563) + }, + azj_kahet_rares = { + [84071] = { questType = "weekly", warband = true, name = "Kaheti Silk Hauler" }, -- (daily: 81702) + [84072] = { questType = "weekly", warband = true, name = "XT-Minecrusher 8700" }, -- (daily: 81703) + [84075] = { questType = "weekly", warband = true, name = "Maddened Siegebomber" }, -- (daily: 81706) + [84073] = { questType = "weekly", warband = true, name = "Cha'tak" }, -- (daily: 81704) + [84076] = { questType = "weekly", warband = true, name = "Enduring Gutterface" }, -- (daily: 81707) + [84074] = { questType = "weekly", warband = true, name = "Monstrous Lasharoth" }, -- (daily: 81705) + [84080] = { questType = "weekly", warband = true, name = "Umbraclaw Matra" }, -- (daily: 82037) + [84082] = { questType = "weekly", warband = true, name = "Skirmisher Sa'zryk" }, -- (daily: 82078) + [84081] = { questType = "weekly", warband = true, name = "Deepcrawler Tx'kesh" }, -- (daily: 82077) + [84079] = { questType = "weekly", warband = true, name = "Harvester Qixt" }, -- (daily: 82036) + [84078] = { questType = "weekly", warband = true, name = "The Oozekhan" }, -- (daily: 82035) + [84077] = { questType = "weekly", warband = true, name = "Jix'ak the Crazed" }, -- (daily: 82034) + [84069] = { questType = "weekly", warband = true, name = "The Groundskeeper" }, -- (daily: 81634) + [84070] = { questType = "weekly", warband = true, name = "Xishorr" }, -- (daily: 81701) + }, + one_time_reputation_rares = { + [85158] = { questType = "weekly", warband = true, name = "Alunira", achievementID = 40435, criteriaID = 68225 }, -- Isle of Dorne (daily: 82196) + [85160] = { questType = "weekly", warband = true, name = "Kereke", achievementID = 40435, criteriaID = 68227 }, -- Isle of Dorne (daily: 82204) + [85161] = { questType = "weekly", warband = true, name = "Zovex", achievementID = 40435, criteriaID = 68226 }, -- Isle of Dorne (daily: 82203) + [85159] = { questType = "weekly", warband = true, name = "Rotfist", achievementID = 40435, criteriaID = 68228 }, -- Isle of Dorne (daily: 82205) + [85162] = { + questType = "weekly", + warband = true, + name = "Deepflayer Broodmother", + achievementID = 40837, + criteriaID = 69636, + }, -- Ringing Deeps (daily: 80536) + [85163] = { + questType = "weekly", + warband = true, + name = "Lurker of the Deeps", + achievementID = 40837, + criteriaID = 69637, + }, -- Ringing Deeps (daily: 81633) + [85164] = { + questType = "weekly", + warband = true, + name = "Beledar's Spawn", + achievementID = 40851, + criteriaID = 69716, + }, -- Hallowfall (daily: 81763) + [85165] = { + questType = "weekly", + warband = true, + name = "Deathtide", + achievementID = 40851, + criteriaID = 69717, + }, -- Hallowfall (daily: 81880) + [85167] = { questType = "weekly", warband = true, name = "The One Left" }, -- Azj-kahet (daily: 82290) + [85166] = { questType = "weekly", warband = true, name = "Tka'ktath" }, -- Azj-kahet (daily: 82289) + }, + undermine_rares = { + [84917] = { questType = "weekly", warband = true, name = "Scrapbeak" }, -- (daily: 81702) + [84918] = { questType = "weekly", warband = true, name = "Ratspit" }, -- (daily: 81703) + [84919] = { questType = "weekly", warband = true, name = "Tally Doublespeak" }, -- (daily: 81706) + [84920] = { questType = "weekly", warband = true, name = "V.V. Goosworth and Slimesby" }, -- (daily: 81704) + [84921] = { questType = "weekly", warband = true, name = "Thwack" }, -- (daily: 81707) + [84922] = { questType = "weekly", warband = true, name = "S.A.L." }, -- (daily: 81705) + [84926] = { questType = "weekly", warband = true, name = "Nitro" }, -- (daily: 81705) + [84927] = { questType = "weekly", warband = true, name = "Candy Stickemup" }, -- (daily: 82037) + [84928] = { questType = "weekly", warband = true, name = "Grimewick" }, -- (daily: 82078) + [85004] = { questType = "weekly", warband = true, name = "Swigs Farsight" }, -- (daily: 82077) + [84877] = { questType = "weekly", warband = true, name = "Ephemeral Agent Lathyd" }, -- (daily: 82036) + [84884] = { questType = "weekly", warband = true, name = "The Junk-Wall" }, -- (daily: 82035) + [84895] = { questType = "weekly", warband = true, name = "Slugger the Smart" }, -- (daily: 82034) + [84907] = { questType = "weekly", warband = true, name = "Chief Foreman Gutso" }, -- (daily: 81634) + [84911] = { questType = "weekly", warband = true, name = "Flyboy Snooty" }, -- (daily: 81701) + [86298] = { questType = "weekly", warband = true, name = "M.A.G.N.O." }, -- (daily: 81701) + [86307] = { questType = "weekly", warband = true, name = "Giovante" }, -- (daily: 81701) + [86431] = { questType = "weekly", warband = true, name = "Scrapchewer" }, -- (daily: 81701) + [86428] = { questType = "weekly", warband = true, name = "Volstrike the Charged" }, -- (daily: 81701) + }, + + -- Professions + knowledge_tww_treasures = { + [83253] = { questType = "weekly", skillLineID = 171, profession = "Alchemy", item = 225234 }, -- Alchemical Sediment + [83255] = { questType = "weekly", skillLineID = 171, profession = "Alchemy", item = 225235 }, -- Deepstone Crucible + [83256] = { questType = "weekly", skillLineID = 164, profession = "Blacksmithing", item = 225233 }, -- Dense Bladestone + [83257] = { questType = "weekly", skillLineID = 164, profession = "Blacksmithing", item = 225232 }, -- Coreway Billet + [83258] = { questType = "weekly", skillLineID = 333, profession = "Enchanting", item = 225231 }, -- Powdered Fulgurance + [83259] = { questType = "weekly", skillLineID = 333, profession = "Enchanting", item = 225230 }, -- Crystalline Repository + [83260] = { questType = "weekly", skillLineID = 202, profession = "Engineering", item = 225228 }, -- Rust-Locked Mechanism + [83261] = { questType = "weekly", skillLineID = 202, profession = "Engineering", item = 225229 }, -- Earthen Induction Coil + [83264] = { questType = "weekly", skillLineID = 773, profession = "Inscription", item = 225226 }, -- Striated Inkstone + [83262] = { questType = "weekly", skillLineID = 773, profession = "Inscription", item = 225227 }, -- Wax-sealed Records + [83265] = { questType = "weekly", skillLineID = 755, profession = "Jewelcrafting", item = 225224 }, -- Diaphanous Gem Shards + [83266] = { questType = "weekly", skillLineID = 755, profession = "Jewelcrafting", item = 225225 }, -- Deepstone Fragment + [83268] = { questType = "weekly", skillLineID = 165, profession = "Leatherworking", item = 225222 }, -- Stone-Leather Swatch + [83267] = { questType = "weekly", skillLineID = 165, profession = "Leatherworking", item = 225223 }, -- Sturdy Nerubian Carapace + [83270] = { questType = "weekly", skillLineID = 197, profession = "Tailoring", item = 225220 }, -- Chitin Needle + [83269] = { questType = "weekly", skillLineID = 197, profession = "Tailoring", item = 225221 }, -- Spool of Webweave + }, + knowledge_tww_treatise = { + [83725] = { questType = "weekly", skillLineID = 171, profession = "Alchemy" }, + [83726] = { questType = "weekly", skillLineID = 164, profession = "Blacksmithing" }, + [83727] = { questType = "weekly", skillLineID = 333, profession = "Enchanting" }, + [83728] = { questType = "weekly", skillLineID = 202, profession = "Engineering" }, + [83730] = { questType = "weekly", skillLineID = 773, profession = "Inscription" }, + [83731] = { questType = "weekly", skillLineID = 755, profession = "Jewelcrafting" }, + [83732] = { questType = "weekly", skillLineID = 165, profession = "Leatherworking" }, + [83735] = { questType = "weekly", skillLineID = 197, profession = "Tailoring" }, + [83729] = { questType = "weekly", skillLineID = 182, profession = "Herbalism" }, + [83733] = { questType = "weekly", skillLineID = 186, profession = "Mining" }, + [83734] = { questType = "weekly", skillLineID = 393, profession = "Skinning" }, + }, + knowledge_tww_gather = { + [81416] = { questType = "weekly", skillLineID = 182, profession = "Herbalism" }, -- Deepgrove Petal 1 + [81417] = { questType = "weekly", skillLineID = 182, profession = "Herbalism" }, -- Deepgrove Petal 2 + [81418] = { questType = "weekly", skillLineID = 182, profession = "Herbalism" }, -- Deepgrove Petal 3 + [81419] = { questType = "weekly", skillLineID = 182, profession = "Herbalism" }, -- Deepgrove Petal 4 + [81420] = { questType = "weekly", skillLineID = 182, profession = "Herbalism" }, -- Deepgrove Petal 5 + [81421] = { questType = "weekly", skillLineID = 182, profession = "Herbalism" }, -- Deepgrove Rose + + [83050] = { questType = "weekly", skillLineID = 186, profession = "Mining" }, -- Slab of Slate 1 + [83051] = { questType = "weekly", skillLineID = 186, profession = "Mining" }, -- Slab of Slate 2 + [83052] = { questType = "weekly", skillLineID = 186, profession = "Mining" }, -- Slab of Slate 3 + [83053] = { questType = "weekly", skillLineID = 186, profession = "Mining" }, -- Slab of Slate 4 + [83054] = { questType = "weekly", skillLineID = 186, profession = "Mining" }, -- Slab of Slate 5 + [83049] = { questType = "weekly", skillLineID = 186, profession = "Mining" }, -- Erosion Polished Slate + + [81459] = { questType = "weekly", skillLineID = 393, profession = "Skinning" }, -- Toughened Tempest Pelt 1 + [81460] = { questType = "weekly", skillLineID = 393, profession = "Skinning" }, -- Toughened Tempest Pelt 2 + [81461] = { questType = "weekly", skillLineID = 393, profession = "Skinning" }, -- Toughened Tempest Pelt 3 + [81462] = { questType = "weekly", skillLineID = 393, profession = "Skinning" }, -- Toughened Tempest Pelt 4 + [81463] = { questType = "weekly", skillLineID = 393, profession = "Skinning" }, -- Toughened Tempest Pelt 5 + [81464] = { questType = "weekly", skillLineID = 393, profession = "Skinning" }, -- Abyssal Fur + + [84290] = { questType = "weekly", skillLineID = 333, profession = "Enchanting" }, -- Fleeting Arcane Manifestation 1 + [84291] = { questType = "weekly", skillLineID = 333, profession = "Enchanting" }, -- Fleeting Arcane Manifestation 2 + [84292] = { questType = "weekly", skillLineID = 333, profession = "Enchanting" }, -- Fleeting Arcane Manifestation 3 + [84293] = { questType = "weekly", skillLineID = 333, profession = "Enchanting" }, -- Fleeting Arcane Manifestation 4 + [84294] = { questType = "weekly", skillLineID = 333, profession = "Enchanting" }, -- Fleeting Arcane Manifestation 5 + [84295] = { questType = "weekly", skillLineID = 333, profession = "Enchanting" }, -- Gleaming Telluric Crystal + }, + knowledge_tww_weeklies_quest = { + [84133] = { questType = "weekly", log = true }, -- Alchemy + [84127] = { questType = "weekly", log = true }, -- Blacksmithing + + [84085] = { questType = "weekly", log = true }, --Enchanting + [84086] = { questType = "weekly", log = true }, --Enchanting + [84134] = { questType = "weekly", log = true }, --Enchanting + [84084] = { questType = "weekly", log = true }, --Enchanting + + [84128] = { questType = "weekly", log = true }, -- Engineering + [84129] = { questType = "weekly", log = true }, -- Inscription + [84130] = { questType = "weekly", log = true }, -- Jewelcrafting + [84131] = { questType = "weekly", log = true }, -- Leatherworking + [84132] = { questType = "weekly", log = true }, -- Tailoring + + [82916] = { questType = "weekly", log = true }, -- Herbalism + [82958] = { questType = "weekly", log = true }, -- Herbalism + [82962] = { questType = "weekly", log = true }, -- Herbalism + [82965] = { questType = "weekly", log = true }, -- Herbalism + [82970] = { questType = "weekly", log = true }, -- Herbalism + + [83102] = { questType = "weekly", log = true }, -- Mining + [83103] = { questType = "weekly", log = true }, -- Mining + [83104] = { questType = "weekly", log = true }, -- Mining + [83106] = { questType = "weekly", log = true }, -- Mining + + [82992] = { questType = "weekly", log = true }, -- Skinning + [82993] = { questType = "weekly", log = true }, -- Skinning + [83097] = { questType = "weekly", log = true }, -- Skinning + [83098] = { questType = "weekly", log = true }, -- Skinning + }, + + -- 11.1 + undermine_weeklies = { + [85869] = { questType = "weekly", log = true }, + [86775] = { questType = "weekly", log = true }, + [85879] = { questType = "weekly", log = true }, + + [85553] = { questType = "weekly", log = true }, + [85554] = { questType = "weekly", log = true }, + [85913] = { questType = "weekly", log = true }, + [85914] = { questType = "weekly", log = true }, + [85944] = { questType = "weekly", log = true }, + [85945] = { questType = "weekly", log = true }, + [85960] = { questType = "weekly", log = true }, + [85962] = { questType = "weekly", log = true }, + [86177] = { questType = "weekly", log = true }, + [86178] = { questType = "weekly", log = true }, + [86179] = { questType = "weekly", log = true }, + [86180] = { questType = "weekly", log = true }, + }, + undermine_lieutenants_mythic = { + [88860] = { questType = "weekly", name = "Gorbo" }, + [88868] = { questType = "weekly", name = "Trashmaster Blazedump" }, + [88847] = { questType = "weekly", name = "Skiggy Muckheimer" }, + [88832] = { questType = "weekly", name = "Scraps" }, + [88843] = { questType = "weekly", name = "King Flamespite" }, + [88839] = { questType = "weekly", name = "Professor Boomspark" }, + }, + weekly_bounti_map = { + [86371] = { questType = "weekly" }, + }, + nightfall_weekly = { + [89295] = { questType = "weekly" }, + }, + saltherils_soiree = { + [90573] = { questType = "weekly", warband = true, log = true }, + [90574] = { questType = "weekly", warband = true, log = true }, + [90575] = { questType = "weekly", warband = true, log = true }, + [90576] = { questType = "weekly", warband = true, log = true }, + }, + abundance = { + [89507] = { questType = "weekly", warband = true, log = true }, + }, + lost_legends = { + [88993] = { questType = "weekly", warband = true, log = true }, + [88994] = { questType = "weekly", warband = true, log = true }, + [88995] = { questType = "weekly", warband = true, log = true }, + [88996] = { questType = "weekly", warband = true, log = true }, + [88997] = { questType = "weekly", warband = true, log = true }, + [88998] = { questType = "weekly", warband = true, log = true }, + -- [89268] = {questType = 'weekly', warband = true, log = true}, + }, + stormarion_assault = { + [90962] = { questType = "weekly", warband = true, log = true }, + }, + special_assignments = { + [92139] = { questType = "weekly", warband = true, log = true }, + [92145] = { questType = "weekly", warband = true, log = true }, + [93244] = { questType = "weekly", warband = true, log = true }, + [92063] = { questType = "weekly", warband = true, log = true }, + }, + -- World Boss + world_boss = { + [92560] = { questType = "weekly", log = true }, -- Lu'ashal + [92123] = { questType = "weekly", log = true }, -- Cragpine's Treevenge + [92034] = { questType = "weekly", log = true }, -- Thorm'belan + [92636] = { questType = "weekly", log = true }, -- Predaxas + }, + preys_nightmare = { + [91211] = { questType = 'weekly', log = true }, + [91213] = { questType = 'weekly', log = true }, + [91215] = { questType = 'weekly', log = true }, + [91217] = { questType = 'weekly', log = true }, + [91219] = { questType = 'weekly', log = true }, + [91221] = { questType = 'weekly', log = true }, + [91223] = { questType = 'weekly', log = true }, + [91225] = { questType = 'weekly', log = true }, + [91227] = { questType = 'weekly', log = true }, + [91229] = { questType = 'weekly', log = true }, + [91231] = { questType = 'weekly', log = true }, + [91233] = { questType = 'weekly', log = true }, + [91235] = { questType = 'weekly', log = true }, + [91237] = { questType = 'weekly', log = true }, + [91239] = { questType = 'weekly', log = true }, + [91241] = { questType = 'weekly', log = true }, + [91256] = { questType = 'weekly', log = true }, + [91258] = { questType = 'weekly', log = true }, + [91257] = { questType = 'weekly', log = true }, + [91259] = { questType = 'weekly', log = true }, + [91260] = { questType = 'weekly', log = true }, + [91261] = { questType = 'weekly', log = true }, + [91262] = { questType = 'weekly', log = true }, + [91263] = { questType = 'weekly', log = true }, + [91265] = { questType = 'weekly', log = true }, + [91264] = { questType = 'weekly', log = true }, + [91266] = { questType = 'weekly', log = true }, + [91267] = { questType = 'weekly', log = true }, + [91268] = { questType = 'weekly', log = true }, + [91269] = { questType = 'weekly', log = true }, + }, + nightmarish_task = { + [94446] = { questType = 'weekly', log = true }, } } PermoksAccountManager.locale = { - currency = { - ['renown'] = C_CurrencyInfo.GetBasicCurrencyInfo(1822).name, - ['soul_ash'] = C_CurrencyInfo.GetBasicCurrencyInfo(1828).name, - ['stygia'] = C_CurrencyInfo.GetBasicCurrencyInfo(1767).name, - ['reservoir_anima'] = C_CurrencyInfo.GetBasicCurrencyInfo(1813).name, - ['redeemed_soul'] = C_CurrencyInfo.GetBasicCurrencyInfo(1810).name, - ['conquest'] = C_CurrencyInfo.GetBasicCurrencyInfo(1602).name, - ['honor'] = C_CurrencyInfo.GetBasicCurrencyInfo(1792).name, - ['valor'] = C_CurrencyInfo.GetBasicCurrencyInfo(1191).name - }, - raids = { - nathria = { - ['deDE'] = 'Castle Nathria', - ['enUS'] = 'Castle Nathria', - ['enGB'] = 'Castle Nathria', - ['esES'] = 'Castle Nathria', - ['esMX'] = 'Castle Nathria', - ['frFR'] = 'Castle Nathria', - ['itIT'] = 'Castle Nathria' - } - } + currency = { + ["renown"] = C_CurrencyInfo.GetBasicCurrencyInfo(1822).name, + ["soul_ash"] = C_CurrencyInfo.GetBasicCurrencyInfo(1828).name, + ["stygia"] = C_CurrencyInfo.GetBasicCurrencyInfo(1767).name, + ["reservoir_anima"] = C_CurrencyInfo.GetBasicCurrencyInfo(1813).name, + ["redeemed_soul"] = C_CurrencyInfo.GetBasicCurrencyInfo(1810).name, + ["conquest"] = C_CurrencyInfo.GetBasicCurrencyInfo(1602).name, + ["honor"] = C_CurrencyInfo.GetBasicCurrencyInfo(1792).name, + ["valor"] = C_CurrencyInfo.GetBasicCurrencyInfo(1191).name, + }, + raids = { + nathria = { + ["deDE"] = "Castle Nathria", + ["enUS"] = "Castle Nathria", + ["enGB"] = "Castle Nathria", + ["esES"] = "Castle Nathria", + ["esMX"] = "Castle Nathria", + ["frFR"] = "Castle Nathria", + ["itIT"] = "Castle Nathria", + }, + }, } PermoksAccountManager.sanctum = { - [1] = { - [1] = 312, -- Anima Conductor - [2] = 308, -- Transport Network - [3] = 316, -- Command Table - --[4] = 327, -- Resevoir Upgrades - [5] = 320 -- Path of Ascension - }, - [2] = { - [1] = 314, -- Anima Conductor - [2] = 309, -- Transport Network - [3] = 317, -- Command Table - --[4] = 326, -- Resevoir Upgrades - [5] = 324 -- Ember Court - }, - [3] = { - [1] = 311, -- Anima Conductor - [2] = 307, -- Transport Network - [3] = 315, -- Command Table - --[4] = 328, -- Resevoir Upgrades - [5] = 319 -- The Queen's Conservatory - }, - [4] = { - [1] = 313, -- Anima Conductor - [2] = 310, -- Transport Network - [3] = 318, -- Command Table - --[4] = 329, -- Resevoir Upgrades - [5] = 321 -- Abomination Factory - } + [1] = { + [1] = 312, -- Anima Conductor + [2] = 308, -- Transport Network + [3] = 316, -- Command Table + --[4] = 327, -- Resevoir Upgrades + [5] = 320, -- Path of Ascension + }, + [2] = { + [1] = 314, -- Anima Conductor + [2] = 309, -- Transport Network + [3] = 317, -- Command Table + --[4] = 326, -- Resevoir Upgrades + [5] = 324, -- Ember Court + }, + [3] = { + [1] = 311, -- Anima Conductor + [2] = 307, -- Transport Network + [3] = 315, -- Command Table + --[4] = 328, -- Resevoir Upgrades + [5] = 319, -- The Queen's Conservatory + }, + [4] = { + [1] = 313, -- Anima Conductor + [2] = 310, -- Transport Network + [3] = 318, -- Command Table + --[4] = 329, -- Resevoir Upgrades + [5] = 321, -- Abomination Factory + }, } function PermoksAccountManager:getDefaultCategories() - return default_categories + return default_categories end PermoksAccountManager.vault_rewards = { - -- MythicPlus - [Enum.WeeklyRewardChestThresholdType.Activities] = { - [-1] = 489, - [0] = 506, - [2] = 509, - [3] = 509, - [4] = 512, - [5] = 512, - [6] = 515, - [7] = 515, - [8] = 519, - [9] = 519, - [10] = 522, - }, - -- RankedPvP - [Enum.WeeklyRewardChestThresholdType.RankedPvP] = { - [0] = 445, - [1] = 455, - [2] = 460, - [3] = 465, - [4] = 470, - [5] = 475, - [6] = 458, - [7] = 464, - [8] = 471 - }, - -- Raid - [Enum.WeeklyRewardChestThresholdType.Raid] = { - [17] = 480, - [14] = 493, - [15] = 506, - [16] = 519, - } + -- MythicPlus + [Enum.WeeklyRewardChestThresholdType.Activities] = { + [-1] = 230, + [0] = 246, + [2] = 259, + [3] = 259, + [4] = 263, + [5] = 263, + [6] = 266, + [7] = 269, + [8] = 269, + [9] = 269, + [10] = 272, + }, + -- World/Delves + [Enum.WeeklyRewardChestThresholdType.World] = { + [1] = 233, + [2] = 237, + [3] = 240, + [4] = 243, + [5] = 246, + [6] = 253, + [7] = 256, + [8] = 259, + [9] = 259, + [10] = 259, + [11] = 259, + }, + -- Raid + [Enum.WeeklyRewardChestThresholdType.Raid] = { + [17] = 233, + [14] = 246, + [15] = 259, + [16] = 272, + }, } PermoksAccountManager.ICONSTRINGS = { - left = '\124T%d:18:18\124t %s', - right = '%s \124T%d:18:18\124t' + left = "\124T%d:18:18\124t %s", + right = "%s \124T%d:18:18\124t", } PermoksAccountManager.ICONBANKSTRINGS = { - left = '\124T%d:18:18\124t %s (%s)', - right = '%s (%s) \124T%d:18:18\124t' + left = "\124T%d:18:18\124t %s (%s)", + right = "%s (%s) \124T%d:18:18\124t", } PermoksAccountManager.encounterOrder = { - [2393] = 1, [2429] = 2, [2422] = 3, [2428] = 4, [2418] = 5, [2420] = 6, [2426] = 7, [2394] = 8, [2425] = 9, [2424] = 10, - [2435] = 11, [2442] = 12, [2439] = 13, [2445] = 14, [2444] = 15, [2443] = 16, [2446] = 17, [2447] = 18, [2440] = 19, [2441] = 20, - [2458] = 21, [2459] = 22, [2470] = 23, [2460] = 24, [2465] = 25, [2463] = 26, [2461] = 27, [2469] = 28, [2457] = 29, [2467] = 30, [2464] = 31, + [2393] = 1, + [2429] = 2, + [2422] = 3, + [2428] = 4, + [2418] = 5, + [2420] = 6, + [2426] = 7, + [2394] = 8, + [2425] = 9, + [2424] = 10, + [2435] = 11, + [2442] = 12, + [2439] = 13, + [2445] = 14, + [2444] = 15, + [2443] = 16, + [2446] = 17, + [2447] = 18, + [2440] = 19, + [2441] = 20, + [2458] = 21, + [2459] = 22, + [2470] = 23, + [2460] = 24, + [2465] = 25, + [2463] = 26, + [2461] = 27, + [2469] = 28, + [2457] = 29, + [2467] = 30, + [2464] = 31, } diff --git a/locales/deDE.lua b/locales/deDE.lua index 64106f1..8804208 100644 --- a/locales/deDE.lua +++ b/locales/deDE.lua @@ -208,6 +208,7 @@ L['Add/Edit'] = true L['Add'] = 'Hinzufügen' L['Create'] = 'Erstellen' L['Edit'] = 'Bearbeiten' +L['Save'] = "Speichern" L['ID'] = true L['Type'] = true L['Quest'] = true diff --git a/locales/enUS.lua b/locales/enUS.lua index 0af231a..694bc11 100644 --- a/locales/enUS.lua +++ b/locales/enUS.lua @@ -208,6 +208,7 @@ L['Add/Edit'] = true L['Add'] = true L['Create'] = true L['Edit'] = true +L['Save'] = true L['ID'] = true L['Type'] = true L['Quest'] = true diff --git a/modules.lua b/modules.lua index 1e3e5d0..376565a 100644 --- a/modules.lua +++ b/modules.lua @@ -19,6 +19,7 @@ end ---@param alwaysForceUpdate boolean ---@param ... string function ModuleMixin:AddCustomLabelType(customType, callback, alwaysForceUpdate, ...) + -- additional varargs can be any table present in altData if self.labelFunctions[customType] then PermoksAccountManager:Print(string.format('[%s] - Custom Type [%s] already exists.', self.name, customType)) return @@ -71,7 +72,6 @@ local function SetEventScript(charInfo) function(self, event, ...) if functions[event] then --if not charInfo then PermoksAccountManager:Debug("CharInfo is not loaded yet") return end - functions[event](charInfo, ...) end end diff --git a/modules/character.lua b/modules/character.lua index 05ded7d..62a08a1 100644 --- a/modules/character.lua +++ b/modules/character.lua @@ -1,17 +1,22 @@ local addonName, PermoksAccountManager = ... -local L = LibStub('AceLocale-3.0'):GetLocale(addonName) -local LibQTip = LibStub('LibQTip-1.0') +local L = LibStub("AceLocale-3.0"):GetLocale(addonName) +local LibQTip = LibStub("LibQTip-1.0") local options -local module = 'character' +local module = "character" local labelRows = { characterName = { hideLabel = true, - label = L['Name'], + label = L["Name"], hideOption = true, + warband = true, big = true, offset = 1.5, - type = 'characterName', + type = "characterName", + tooltip = true, + customTooltip = function(button, altData, labelRow) + PermoksAccountManager:CustomEquippedItemsTooltip_OnEnter(button, altData, labelRow) + end, data = function(alt_data) return PermoksAccountManager:CreateCharacterString(alt_data.name, alt_data.specInfo) end, @@ -20,45 +25,45 @@ local labelRows = { return RAID_CLASS_COLORS[alt_data.class] end end, - version = false + version = false, }, characterLevel = { - label = L['Level'], - type = 'charLevel', + label = L["Level"], + type = "charLevel", data = function(alt_data) - return alt_data.charLevel or '-' + return alt_data.charLevel or "-" end, - group = 'character', - version = WOW_PROJECT_CATACLYSM_CLASSIC + group = "character", + version = false, }, location = { - label = L['Location'], + label = L["Location"], data = function(alt_data) - return (alt_data.location and PermoksAccountManager:CreateLocationString(alt_data.location)) or '-' + return (alt_data.location and PermoksAccountManager:CreateLocationString(alt_data.location)) or "-" end, - group = 'character', - version = WOW_PROJECT_CATACLYSM_CLASSIC + group = "character", + version = false, }, ilevel = { - label = L['Item Level'], + label = L["Item Level"], data = function(alt_data) - return alt_data.ilevel and string.format('%.2f', alt_data.ilevel) or '-' + return alt_data.ilevel and string.format("%.2f", alt_data.ilevel) or "-" end, - version = WOW_PROJECT_MAINLINE + version = false, }, ilevel_wrath = { - label = L['Item Level'], + label = L["Item Level"], data = function(alt_data) - return string.format('%.2f', alt_data.ilevel or 0) + return string.format("%.2f", alt_data.ilevel or 0) end, - group = 'character', - version = WOW_PROJECT_CATACLYSM_CLASSIC + group = "character", + version = WOW_PROJECT_CATACLYSM_CLASSIC, }, gearScore = { - label = L['Gear Score'], + label = L["Gear Score"], data = function(alt_data) local gearScore = alt_data.gearScore or 0 - return gearScore or '-' + return gearScore or "-" end, color = function(alt_data) local gearScore = alt_data.gearScore or 0 @@ -72,19 +77,24 @@ local labelRows = { return CreateColor(gearScoreRed, gearScoreGreen, gearScoreBlue, 1) end, - group = 'character', - version = WOW_PROJECT_CATACLYSM_CLASSIC + group = "character", + version = WOW_PROJECT_CATACLYSM_CLASSIC, }, gold = { - label = L['Gold'], - type = 'gold', - group = 'currency', - version = false + label = L["Gold"], + type = "gold", + group = "currency", + tooltip = true, + customTooltip = function(button, altData) + PermoksAccountManager:CustomGoldTooltip_OnEnter(button, altData) + end, + warband = true, + version = false, }, keystone = { - label = L['Keystone'], - type = 'keystone', - group = 'dungeons', + label = L["Keystone"], + type = "keystone", + group = "dungeons", version = WOW_PROJECT_MAINLINE, OnClick = function(button, altData) if button == "LeftButton" and IsShiftKeyDown() then @@ -93,14 +103,14 @@ local labelRows = { end, }, tw_keystone = { - label = L['TW Keystone'], - type = 'twkeystone', - group = 'dungeons', - version = WOW_PROJECT_MAINLINE + label = L["TW Keystone"], + type = "twkeystone", + group = "dungeons", + version = WOW_PROJECT_MAINLINE, }, weekly_key = { - label = L['Highest Key'], - type = 'weeklyKey', + label = L["Highest Key"], + type = "weeklyKey", tooltip = true, customTooltip = function(button, alt_data) PermoksAccountManager:HighestKeyTooltip_OnEnter(button, alt_data) @@ -108,22 +118,22 @@ local labelRows = { isComplete = function(alt_data) return alt_data.vaultInfo and alt_data.vaultInfo.MythicPlus and alt_data.vaultInfo.MythicPlus[1].level >= 15 end, - group = 'character', - version = WOW_PROJECT_MAINLINE + group = "character", + version = WOW_PROJECT_MAINLINE, }, mplus_score = { - label = L['Mythic+ Score'], + label = L["Mythic+ Score"], outline = "OUTLINE", - type = 'dungeonScore', - group = 'character', - version = WOW_PROJECT_MAINLINE + type = "dungeonScore", + group = "character", + version = WOW_PROJECT_MAINLINE, }, contract = { - label = L['Contract'], - type = 'contract', - group = 'character', - version = WOW_PROJECT_MAINLINE - } + label = L["Contract"], + type = "contract", + group = "character", + version = WOW_PROJECT_MAINLINE, + }, } local gsItemTypes = { @@ -157,14 +167,14 @@ local gsFormula = { ["A"] = { [4] = { ["A"] = 91.4500, ["B"] = 0.6500 }, [3] = { ["A"] = 81.3750, ["B"] = 0.8125 }, - [2] = { ["A"] = 73.0000, ["B"] = 1.0000 } + [2] = { ["A"] = 73.0000, ["B"] = 1.0000 }, }, ["B"] = { [4] = { ["A"] = 26.0000, ["B"] = 1.2000 }, [3] = { ["A"] = 0.7500, ["B"] = 1.8000 }, [2] = { ["A"] = 8.0000, ["B"] = 2.0000 }, - [1] = { ["A"] = 0.0000, ["B"] = 2.2500 } - } + [1] = { ["A"] = 0.0000, ["B"] = 2.2500 }, + }, } local gsQuality = { @@ -172,79 +182,91 @@ local gsQuality = { ["Red"] = { ["A"] = 0.94, ["B"] = 5000, ["C"] = 0.00006, ["D"] = 1 }, ["Green"] = { ["A"] = 0.47, ["B"] = 5000, ["C"] = 0.00047, ["D"] = -1 }, ["Blue"] = { ["A"] = 0, ["B"] = 0, ["C"] = 0, ["D"] = 0 }, - ["Description"] = "Legendary" + ["Description"] = "Legendary", }, [5000] = { ["Red"] = { ["A"] = 0.69, ["B"] = 4000, ["C"] = 0.00025, ["D"] = 1 }, ["Green"] = { ["A"] = 0.28, ["B"] = 4000, ["C"] = 0.00019, ["D"] = 1 }, ["Blue"] = { ["A"] = 0.97, ["B"] = 4000, ["C"] = 0.00096, ["D"] = -1 }, - ["Description"] = "Epic" + ["Description"] = "Epic", }, [4000] = { ["Red"] = { ["A"] = 0.0, ["B"] = 3000, ["C"] = 0.00069, ["D"] = 1 }, ["Green"] = { ["A"] = 0.5, ["B"] = 3000, ["C"] = 0.00022, ["D"] = -1 }, ["Blue"] = { ["A"] = 1, ["B"] = 3000, ["C"] = 0.00003, ["D"] = -1 }, - ["Description"] = "Superior" + ["Description"] = "Superior", }, [3000] = { ["Red"] = { ["A"] = 0.12, ["B"] = 2000, ["C"] = 0.00012, ["D"] = -1 }, ["Green"] = { ["A"] = 1, ["B"] = 2000, ["C"] = 0.00050, ["D"] = -1 }, ["Blue"] = { ["A"] = 0, ["B"] = 2000, ["C"] = 0.001, ["D"] = 1 }, - ["Description"] = "Uncommon" + ["Description"] = "Uncommon", }, [2000] = { ["Red"] = { ["A"] = 1, ["B"] = 1000, ["C"] = 0.00088, ["D"] = -1 }, ["Green"] = { ["A"] = 1, ["B"] = 000, ["C"] = 0.00000, ["D"] = 0 }, ["Blue"] = { ["A"] = 1, ["B"] = 1000, ["C"] = 0.001, ["D"] = -1 }, - ["Description"] = "Common" + ["Description"] = "Common", }, [1000] = { ["Red"] = { ["A"] = 0.55, ["B"] = 0, ["C"] = 0.00045, ["D"] = 1 }, ["Green"] = { ["A"] = 0.55, ["B"] = 0, ["C"] = 0.00045, ["D"] = 1 }, ["Blue"] = { ["A"] = 0.55, ["B"] = 0, ["C"] = 0.00045, ["D"] = 1 }, - ["Description"] = "Trash" + ["Description"] = "Trash", }, } local function GearScoreGetEnchantInfo(ItemLink, ItemEquipLoc) - local _, _, ItemSubString = string.find(ItemLink, "^|c%x+|H(.+)|h%[.*%]"); + local _, _, ItemSubString = string.find(ItemLink, "^|c%x+|H(.+)|h%[.*%]") local ItemSubStringTable = {} for v in string.gmatch(ItemSubString, "[^:]+") do tinsert(ItemSubStringTable, v) end - + ItemSubString = ItemSubStringTable[2] .. ":" .. ItemSubStringTable[3], ItemSubStringTable[2] local StringStart, _ = string.find(ItemSubString, ":") ItemSubString = string.sub(ItemSubString, StringStart + 1) - if (ItemSubString == "0") and (gsItemTypes[ItemEquipLoc]["Enchantable"]) then - local percent = (floor((-2 * (gsItemTypes[ItemEquipLoc]["SlotMOD"])) * 100) / 100); - return (1 + (percent / 100)); + if (ItemSubString == "0") and gsItemTypes[ItemEquipLoc]["Enchantable"] then + local percent = (floor((-2 * gsItemTypes[ItemEquipLoc]["SlotMOD"]) * 100) / 100) + return (1 + (percent / 100)) else - return 1; + return 1 end end local function GearScoreGetQuality(ItemScore) ItemScore = tonumber(ItemScore) - if (not ItemScore) then - return 0, 0, 0, "Trash" - end - - if (ItemScore > 5999) then - ItemScore = 5999 - end - - for i = 0,6 do - if ((ItemScore > i * 1000) and (ItemScore <= ((i + 1) * 1000))) then - local Red = gsQuality[( i + 1 ) * 1000].Red["A"] + (((ItemScore - gsQuality[( i + 1 ) * 1000].Red["B"])*gsQuality[( i + 1 ) * 1000].Red["C"])*gsQuality[( i + 1 ) * 1000].Red["D"]) - local Blue = gsQuality[( i + 1 ) * 1000].Green["A"] + (((ItemScore - gsQuality[( i + 1 ) * 1000].Green["B"])*gsQuality[( i + 1 ) * 1000].Green["C"])*gsQuality[( i + 1 ) * 1000].Green["D"]) - local Green = gsQuality[( i + 1 ) * 1000].Blue["A"] + (((ItemScore - gsQuality[( i + 1 ) * 1000].Blue["B"])*gsQuality[( i + 1 ) * 1000].Blue["C"])*gsQuality[( i + 1 ) * 1000].Blue["D"]) + if not ItemScore then + return 0, 0, 0, "Trash" + end + + if ItemScore > 5999 then + ItemScore = 5999 + end + + for i = 0, 6 do + if (ItemScore > i * 1000) and (ItemScore <= ((i + 1) * 1000)) then + local Red = gsQuality[(i + 1) * 1000].Red["A"] + + ( + ((ItemScore - gsQuality[(i + 1) * 1000].Red["B"]) * gsQuality[(i + 1) * 1000].Red["C"]) + * gsQuality[(i + 1) * 1000].Red["D"] + ) + local Blue = gsQuality[(i + 1) * 1000].Green["A"] + + ( + ((ItemScore - gsQuality[(i + 1) * 1000].Green["B"]) * gsQuality[(i + 1) * 1000].Green["C"]) + * gsQuality[(i + 1) * 1000].Green["D"] + ) + local Green = gsQuality[(i + 1) * 1000].Blue["A"] + + ( + ((ItemScore - gsQuality[(i + 1) * 1000].Blue["B"]) * gsQuality[(i + 1) * 1000].Blue["C"]) + * gsQuality[(i + 1) * 1000].Blue["D"] + ) -- we swap up blue and green because for some reason the coloring of level power works like that - return Red, Blue, Green, gsQuality[( i + 1 ) * 1000].Description - end - end - return 0.1, 0.1, 0.1, "Trash" + return Red, Blue, Green, gsQuality[(i + 1) * 1000].Description + end + end + return 0.1, 0.1, 0.1, "Trash" end local function GearScoreGetItemScore(ItemLink) @@ -253,7 +275,7 @@ local function GearScoreGetItemScore(ItemLink) local PVPScore = 0 local GearScore = 0 - if not (ItemLink) then + if not ItemLink then return 0, 0 end @@ -261,40 +283,45 @@ local function GearScoreGetItemScore(ItemLink) local Table = {} local Scale = 1.8618 - if (ItemRarity == 5) then + if ItemRarity == 5 then QualityScale = 1.3 ItemRarity = 4 - elseif (ItemRarity == 1) then + elseif ItemRarity == 1 then QualityScale = 0.005 ItemRarity = 2 - elseif (ItemRarity == 0) then + elseif ItemRarity == 0 then QualityScale = 0.005 ItemRarity = 2 end - if (ItemRarity == 7) then + if ItemRarity == 7 then ItemRarity = 3 - ItemLevel = 187.05; + ItemLevel = 187.05 end - if (gsItemTypes[ItemEquipLoc]) then - if (ItemLevel > 120) then + if gsItemTypes[ItemEquipLoc] then + if ItemLevel > 120 then Table = gsFormula["A"] - else + else Table = gsFormula["B"] end if (ItemRarity >= 2) and (ItemRarity <= 4) then - GearScore = floor(((ItemLevel - Table[ItemRarity].A) / Table[ItemRarity].B) * gsItemTypes[ItemEquipLoc].SlotMOD * Scale * QualityScale) - - if (ItemLevel == 187.05) then + GearScore = floor( + ((ItemLevel - Table[ItemRarity].A) / Table[ItemRarity].B) + * gsItemTypes[ItemEquipLoc].SlotMOD + * Scale + * QualityScale + ) + + if ItemLevel == 187.05 then ItemLevel = 0 end - if (GearScore < 0) then + if GearScore < 0 then GearScore = 0 end - if (PVPScale == 0.75) then + if PVPScale == 0.75 then PVPScore = 1 GearScore = GearScore * 1 else @@ -313,7 +340,7 @@ local function GearScoreGetItemScore(ItemLink) end local function GearScoreGetScore(Name, Target) - if (UnitIsPlayer(Target)) then + if UnitIsPlayer(Target) then local _, PlayerEnglishClass = UnitClass(Target) local TempScore, _ = nil local GearScore = 0 @@ -324,21 +351,21 @@ local function GearScoreGetScore(Name, Target) local mainHandItemLink = GetInventoryItemLink(Target, 16) local offhandItemLink = GetInventoryItemLink(Target, 17) - if (mainHandItemLink) and (offhandItemLink) then + if mainHandItemLink and offhandItemLink then local _, _, _, _, _, _, _, _, ItemEquipLoc, _ = GetItemInfo(mainHandItemLink) - if (ItemEquipLoc == "INVTYPE_2HWEAPON") then + if ItemEquipLoc == "INVTYPE_2HWEAPON" then TitanGrip = 0.5 end end - if (offhandItemLink) then + if offhandItemLink then local _, _, _, _, _, _, _, _, ItemEquipLoc, _ = GetItemInfo(offhandItemLink) - if (ItemEquipLoc == "INVTYPE_2HWEAPON") then + if ItemEquipLoc == "INVTYPE_2HWEAPON" then TitanGrip = 0.5 end local TempScore, ItemLevel = GearScoreGetItemScore(offhandItemLink) - if (PlayerEnglishClass == "HUNTER") then + if PlayerEnglishClass == "HUNTER" then TempScore = TempScore * 0.3164 end @@ -355,7 +382,7 @@ local function GearScoreGetScore(Name, Target) for i = 1, 18 do if (i ~= 4) and (i ~= 17) then local ItemLink = GetInventoryItemLink(Target, i) - if (ItemLink) then + if ItemLink then local _, ItemLink, _, ItemLevel, _, _, _, _, _, _ = GetItemInfo(ItemLink) TempScore, _ = GearScoreGetItemScore(ItemLink) @@ -367,7 +394,7 @@ local function GearScoreGetScore(Name, Target) TempScore = TempScore * 5.3224 end - if (i == 16) then + if i == 16 then TempScore = TempScore * TitanGrip end @@ -390,7 +417,7 @@ local function GearScoreGetScore(Name, Target) GearScore = 0 end - if (ItemCount == 0) then + if ItemCount == 0 then LevelTotal = 0 end @@ -407,7 +434,7 @@ local function UpdateGeneralData(charInfo) -- Contracts local contract = nil - local contracts = { [311457] = 'CoH', [311458] = 'Ascended', [311460] = 'UA', [311459] = 'WH', [353999] = 'DA' } + local contracts = { [311457] = "CoH", [311458] = "Ascended", [311460] = "UA", [311459] = "WH", [353999] = "DA" } for spellId, faction in pairs(contracts) do local info = { GetPlayerAuraBySpellID(spellId) } if info[1] then @@ -423,9 +450,9 @@ local function UpdateGeneralData(charInfo) charInfo.callingsUnlocked = C_CovenantCallings and C_CovenantCallings.AreCallingsUnlocked() elseif self.isWOTLK or self.isCata then -- Gear Score and Item Level - local gearScore, ilvl = GearScoreGetScore(UnitName('player'), 'player') + local gearScore, ilvl = GearScoreGetScore(UnitName("player"), "player") local red, green, blue = GearScoreGetQuality(gearScore) - + charInfo.gearScore = gearScore charInfo.gearScoreRed = red charInfo.gearScoreGreen = green @@ -435,25 +462,48 @@ local function UpdateGeneralData(charInfo) end local function UpdateKeystones(charInfo) - if not PermoksAccountManager.isRetail then return end + if not PermoksAccountManager.isRetail then + return + end charInfo.keyInfo = charInfo.keyInfo or {} C_Timer.After(0.5, function() local ownedKeystone = C_MythicPlus.GetOwnedKeystoneChallengeMapID() local keyInfo = charInfo.keyInfo - keyInfo.keyDungeon = ownedKeystone and PermoksAccountManager.keys[ownedKeystone] or L['No Key'] + keyInfo.keyDungeon = ownedKeystone and PermoksAccountManager.keys[ownedKeystone] or L["No Key"] keyInfo.keyLevel = ownedKeystone and C_MythicPlus.GetOwnedKeystoneLevel() or 0 keyInfo.keyMapID = ownedKeystone local activityID, _, keyLevel = C_LFGList.GetOwnedKeystoneActivityAndGroupAndLevel(true) local keyDungeonID = PermoksAccountManager.activityIDToKeys[activityID] - keyInfo.twKeyDungeon = keyDungeonID and PermoksAccountManager.keys[keyDungeonID] or L['No Key'] + keyInfo.twKeyDungeon = keyDungeonID and PermoksAccountManager.keys[keyDungeonID] or L["No Key"] keyInfo.twKeyLevel = keyDungeonID and keyLevel or 0 end) end local function UpdateGold(charInfo) charInfo.gold = floor(GetMoney() / (COPPER_PER_SILVER * SILVER_PER_GOLD)) * 10000 + + local db = PermoksAccountManager.db.global + local accountData = db.accounts.main.data + local warbandData = db.accounts.main.warbandData + + local totalGold = 0 + for _, altData in pairs(accountData) do + if altData.gold then + totalGold = totalGold + altData.gold + end + end + + warbandData.gold = totalGold +end + +local function UpdateWarbankGold(charInfo) + local gold = C_Bank.FetchDepositedMoney(Enum.BankType.Account) + + local db = PermoksAccountManager.db.global + local warbandData = db.accounts.main.warbandData + warbandData.warbankGold = floor(gold / (COPPER_PER_SILVER * SILVER_PER_GOLD)) * 10000 end local function UpdateILevel(charInfo) @@ -462,12 +512,53 @@ local function UpdateILevel(charInfo) end end +local function UpdateEquip(charInfo, ...) + local equipmentSlot, isEmpty = ... + + charInfo.equippedItems = charInfo.equippedItems or {} + + if isEmpty then + charInfo.equippedItems[equipmentSlot] = nil + else + local itemID = GetInventoryItemID("player", equipmentSlot) + if itemID then + local itemObject = Item:CreateFromItemID(itemID) + itemObject:ContinueOnItemLoad(function() + local itemLink = GetInventoryItemLink("player", equipmentSlot) + local itemName = itemObject:GetItemName() + local itemQuality = itemObject:GetItemQuality() + local itemEquipLoc = itemObject:GetInventoryTypeName() + + charInfo.equippedItems[equipmentSlot] = { + equipmentSlot = equipmentSlot, + itemTexture = GetInventoryItemTexture("player", equipmentSlot), + itemLevel = C_Item.GetDetailedItemLevelInfo(itemLink), + itemName = itemName, + itemQuality = itemQuality, + itemID = itemID, + itemLink = itemLink, + itemSlot = _G[itemEquipLoc], + } + end) + else + charInfo.equippedItems[equipmentSlot] = nil + end + end +end + +local function UpdateCharacterEquip(charInfo) + for equipmentSlot = 1, 18 do + UpdateEquip(charInfo, equipmentSlot) + end +end + local function UpdateMythicScore(charInfo) - if not PermoksAccountManager.isRetail then return end + if not PermoksAccountManager.isRetail then + return + end C_MythicPlus.RequestMapInfo() charInfo.mythicScore = C_ChallengeMode.GetOverallDungeonScore() - end local function UpdateMythicPlusHistory(charInfo) @@ -480,28 +571,30 @@ local function UpdatePlayerSpecialization(charInfo) elseif GetTalentTabInfo then local primaryTalentTree = GetPrimaryTalentTree() if primaryTalentTree then - charInfo.specInfo = {GetTalentTabInfo(primaryTalentTree)} + charInfo.specInfo = { GetTalentTabInfo(primaryTalentTree) } end end end local function UpdatePlayerLevel(charInfo, level) - charInfo.charLevel = level or UnitLevel('player') + charInfo.charLevel = level or UnitLevel("player") end local function UpdateLocation(charInfo) - charInfo.location = C_Map.GetBestMapForUnit('player') + charInfo.location = C_Map.GetBestMapForUnit("player") end local function Update(charInfo) UpdateGeneralData(charInfo) UpdateGold(charInfo) + UpdateWarbankGold(charInfo) - if PermoksAccountManager.isBC then + if not PermoksAccountManager.isRetail then UpdatePlayerLevel(charInfo) UpdateLocation(charInfo) else UpdateILevel(charInfo) + UpdateCharacterEquip(charInfo) UpdatePlayerSpecialization(charInfo) UpdateMythicScore(charInfo) UpdateMythicPlusHistory(charInfo) @@ -509,51 +602,51 @@ local function Update(charInfo) end local function CreateGoldString(gold) - return gold and tonumber(gold) and GetMoneyString(gold, true) or '-' + return gold and tonumber(gold) and GetMoneyString(gold, true) or "-" end local function CreateCharacterString(name, specInfo) if not name then - return '-' + return "-" end local specString if specInfo and PermoksAccountManager.db.global.options.showCurrentSpecIcon then - specString = string.format('\124T%d:0\124t', specInfo[4]) + specString = string.format("\124T%d:0\124t", specInfo[4]) end - return string.format('%s %s', name, specString or '') + return string.format("%s %s", name, specString or "") end local function CreateKeystoneString(name, keyInfo) - if name == 'Warband' then - return '-' + if name == "Warband" then + return "-" elseif not keyInfo or not type(keyInfo) == "table" or not keyInfo.keyDungeon then - return 'Unknown' + return "Unknown" end if keyInfo.keyLevel == 0 then - return string.format('%s', keyInfo.keyDungeon) + return string.format("%s", keyInfo.keyDungeon) end - return string.format('%s+%d', keyInfo.keyDungeon, keyInfo.keyLevel) + return string.format("%s+%d", keyInfo.keyDungeon, keyInfo.keyLevel) end local function CreateTWKeystoneString(keyInfo) if not keyInfo or not type(keyInfo) == "table" or not keyInfo.twKeyDungeon then - return 'Unknown' + return "Unknown" end if keyInfo.twKeyLevel == 0 then - return string.format('%s', keyInfo.twKeyDungeon) + return string.format("%s", keyInfo.twKeyDungeon) end - return string.format('%s+%d', keyInfo.twKeyDungeon, keyInfo.twKeyLevel) + return string.format("%s+%d", keyInfo.twKeyDungeon, keyInfo.twKeyLevel) end local function CreateDungeonScoreString(score) if not score then - return '-' + return "-" end if PermoksAccountManager.db.global.options.useScoreColor then @@ -566,60 +659,62 @@ end local function CreateWeeklyString(vaultInfo) if not vaultInfo or not vaultInfo.MythicPlus then - return '-' + return "-" end local activityInfo = vaultInfo.MythicPlus[1] if not activityInfo or activityInfo.level <= 0 then - return '-' + return "-" end - return string.format('+%d', activityInfo.level) + return string.format("+%d", activityInfo.level) end local function CreateContractString(contractInfo) if not contractInfo then - return '-' + return "-" end local seconds = PermoksAccountManager:GetSecondsRemaining(contractInfo.expirationTime) local timeString = SecondsToTime(seconds) - return string.format('%s - %s', contractInfo.faction, PermoksAccountManager:FormatTimeString(seconds, timeString)) + return string.format("%s - %s", contractInfo.faction, PermoksAccountManager:FormatTimeString(seconds, timeString)) end local payload = { update = Update, events = { - ['PLAYER_MONEY'] = UpdateGold, - ['PLAYER_AVG_ITEM_LEVEL_UPDATE'] = UpdateILevel, - ['PLAYER_SPECIALIZATION_CHANGED'] = UpdatePlayerSpecialization, - ['CHALLENGE_MODE_MAPS_UPDATE'] = { UpdateMythicScore, UpdateMythicPlusHistory }, - ['BAG_UPDATE_DELAYED'] = { UpdateGeneralData, UpdateKeystones }, - ['ITEM_CHANGED'] = UpdateKeystones, - ['WEEKLY_REWARDS_UPDATE'] = UpdateMythicScore, - ['PLAYER_LEVEL_UP'] = UpdatePlayerLevel, - ['ZONE_CHANGED'] = UpdateLocation, - ['ZONE_CHANGED_NEW_AREA'] = UpdateLocation, - ['ZONE_CHANGED_INDOORS'] = UpdateLocation + ["PLAYER_MONEY"] = UpdateGold, + ["PLAYER_AVG_ITEM_LEVEL_UPDATE"] = UpdateILevel, + ["PLAYER_EQUIPMENT_CHANGED"] = { UpdateILevel, UpdateEquip }, + ["PLAYER_SPECIALIZATION_CHANGED"] = UpdatePlayerSpecialization, + ["CHALLENGE_MODE_MAPS_UPDATE"] = { UpdateMythicScore, UpdateMythicPlusHistory }, + ["BAG_UPDATE_DELAYED"] = { UpdateGeneralData, UpdateKeystones }, + ["ITEM_CHANGED"] = UpdateKeystones, + ["WEEKLY_REWARDS_UPDATE"] = UpdateMythicScore, + ["PLAYER_LEVEL_UP"] = UpdatePlayerLevel, + ["ZONE_CHANGED"] = UpdateLocation, + ["ZONE_CHANGED_NEW_AREA"] = UpdateLocation, + ["ZONE_CHANGED_INDOORS"] = UpdateLocation, + ["ACCOUNT_MONEY"] = UpdateWarbankGold, }, share = { - [UpdateGold] = 'gold', - [UpdateILevel] = 'ilevel', - [UpdatePlayerSpecialization] = 'specInfo', - [UpdateMythicPlusHistory] = 'mythicPlusHistory', - [UpdateMythicScore] = 'mythicScore', - [UpdatePlayerLevel] = 'charLevel' + [UpdateGold] = "gold", + [UpdateILevel] = "ilevel", + [UpdatePlayerSpecialization] = "specInfo", + [UpdateMythicPlusHistory] = "mythicPlusHistory", + [UpdateMythicScore] = "mythicScore", + [UpdatePlayerLevel] = "charLevel", }, - labels = labelRows + labels = labelRows, } local module = PermoksAccountManager:AddModule(module, payload) -module:AddCustomLabelType('gold', CreateGoldString, true, 'gold') -module:AddCustomLabelType('characterName', CreateCharacterString, nil, 'name', 'specInfo') -module:AddCustomLabelType('keystone', CreateKeystoneString, nil, 'name', 'keyInfo') -module:AddCustomLabelType('twkeystone', CreateTWKeystoneString, nil, 'keyInfo') -module:AddCustomLabelType('dungeonScore', CreateDungeonScoreString, true, 'mythicScore') -module:AddCustomLabelType('weeklyKey', CreateWeeklyString, nil, 'vaultInfo') -module:AddCustomLabelType('contract', CreateContractString, nil, 'contractInfo') +module:AddCustomLabelType("gold", CreateGoldString, true, "gold") +module:AddCustomLabelType("characterName", CreateCharacterString, nil, "name", "specInfo") +module:AddCustomLabelType("keystone", CreateKeystoneString, nil, "name", "keyInfo") +module:AddCustomLabelType("twkeystone", CreateTWKeystoneString, nil, "keyInfo") +module:AddCustomLabelType("dungeonScore", CreateDungeonScoreString, true, "mythicScore") +module:AddCustomLabelType("weeklyKey", CreateWeeklyString, nil, "vaultInfo") +module:AddCustomLabelType("contract", CreateContractString, nil, "contractInfo") function PermoksAccountManager:CreateLocationString(mapId) if not mapId then @@ -642,7 +737,8 @@ function PermoksAccountManager:HighestKeyTooltip_OnEnter(button, alt_data) local runPerDungeon = {} for _, info in ipairs(alt_data.mythicPlusHistory) do runPerDungeon[info.mapChallengeModeID] = runPerDungeon[info.mapChallengeModeID] or {} - runPerDungeon[info.mapChallengeModeID][info.level] = (runPerDungeon[info.mapChallengeModeID][info.level] or 0) + 1 + runPerDungeon[info.mapChallengeModeID][info.level] = (runPerDungeon[info.mapChallengeModeID][info.level] or 0) + + 1 tinsert(runs, info.level) end @@ -651,27 +747,31 @@ function PermoksAccountManager:HighestKeyTooltip_OnEnter(button, alt_data) for i in ipairs(runs) do if i == 1 or i == 4 or i == 8 then - runs[i] = string.format('|cff00f7ff+%d|r', runs[i]) + runs[i] = string.format("|cff00f7ff+%d|r", runs[i]) else - runs[i] = "+"..runs[i] + runs[i] = "+" .. runs[i] end end - local tooltip = LibQTip:Acquire(addonName .. 'Tooltip', 2, 'LEFT', 'LEFT') + local tooltip = LibQTip:Acquire(addonName .. "Tooltip", 2, "LEFT", "LEFT") button.tooltip = tooltip tooltip:SetBackdropColor(0, 0, 0, 1) - tooltip:AddLine('Vault Keys:',table.concat(runs, ', ', 1, (min(#runs, 8)))) - tooltip:AddLine('') + tooltip:AddLine("Vault Keys:", table.concat(runs, ", ", 1, (min(#runs, 8)))) + tooltip:AddLine("") tooltip:AddSeparator(2, 1, 1, 1) local total = 0 for mapChallengeModeID, levels in pairs(runPerDungeon) do local keys = {} - for level, count in self.spairs(levels, function(_, a, b) return a > b end) do - tinsert(keys, string.format('+%d (%d)', level, count)) + for level, count in + self.spairs(levels, function(_, a, b) + return a > b + end) + do + tinsert(keys, string.format("+%d (%d)", level, count)) total = total + count end - tooltip:AddLine(PermoksAccountManager.keys[mapChallengeModeID], table.concat(keys, ', ')) + tooltip:AddLine(PermoksAccountManager.keys[mapChallengeModeID], table.concat(keys, ", ")) end tooltip:AddSeparator(2, 1, 1, 1) @@ -680,3 +780,94 @@ function PermoksAccountManager:HighestKeyTooltip_OnEnter(button, alt_data) tooltip:SmartAnchorTo(button) tooltip:Show() end + +local equipmentSlotOrdered = { 1, 2, 3, 15, 5, 4, 19, 9, 10, 6, 7, 8, 11, 12, 13, 14, 16, 17, 18 } + +function PermoksAccountManager:CustomEquippedItemsTooltip_OnEnter(button, altData, labelRow) + if not altData or not altData.equippedItems then + return + end + + local tooltip = LibQTip:Acquire(addonName .. "Tooltip", 2, "LEFT", "LEFT") + button.tooltip = tooltip + tooltip:SetBackdropColor(0, 0, 0, 1) + tooltip:AddHeader("Equipment:") + tooltip:AddSeparator(2, 1, 1, 1) + + for _, equipmentSlot in ipairs(equipmentSlotOrdered) do + local item = altData.equippedItems[equipmentSlot] + if item then + if + ( + not item.itemName + or not item.itemTexture + or not item.itemQuality + or not item.itemLink + or not item.itemSlot + ) and item.itemID + then + local itemObject = Item:CreateFromItemID(item.itemID) + local y, x = tooltip:AddLine() + itemObject:ContinueOnItemLoad(function() + item.itemLink = itemObject:GetItemLink() + item.itemQuality = itemObject:GetItemQuality() + item.itemName = itemObject:GetItemName() + item.itemSlot = _G[itemObject:GetInventoryTypeName()] + item.itemTexture = itemObject:GetItemIcon() + + if tooltip:IsAcquiredBy(addonName .. "Tooltip") then + tooltip:SetCell(y, 1, string.format("%s:", item.itemSlot)) + tooltip:SetCell( + y, + 2, + string.format( + "|T%d:0|t|c%s[%s]|r [%s]", + item.itemTexture, + ITEM_QUALITY_COLORS[item.itemQuality].color:GenerateHexColor(), + item.itemName, + item.itemLevel or "N/A" + ) + ) + end + end) + else + tooltip:AddLine( + string.format("%s:", item.itemSlot), + string.format( + "|T%d:22|t|c%s[%s]|r [%s]", + item.itemTexture, + ITEM_QUALITY_COLORS[item.itemQuality].color:GenerateHexColor(), + item.itemName, + item.itemLevel or "N/A" + ) + ) + end + end + end + + tooltip:SmartAnchorTo(button) + tooltip:Show() +end + +function PermoksAccountManager:CustomGoldTooltip_OnEnter(button, warbandData) + if not warbandData or not (warbandData.name == "Warband") then + warbandData = self.account.warbandData + end + if not warbandData then + return + end + + local tooltip = LibQTip:Acquire(addonName .. "Tooltip", 2, "LEFT", "RIGHT") + button.tooltip = tooltip + tooltip:SetBackdropColor(0, 0, 0, 1) + tooltip:AddHeader("Gold:") + tooltip:AddSeparator(2, 1, 1, 1) + + tooltip:AddLine("Total Character Gold:", GetMoneyString(warbandData.gold or 0, true)) + tooltip:AddLine("Warband Bank:", GetMoneyString(warbandData.warbankGold or 0, true)) + tooltip:AddSeparator(2, 1, 1, 1) + tooltip:AddLine("Total Gold:", GetMoneyString((warbandData.gold or 0) + (warbandData.warbankGold or 0), true)) + + tooltip:SmartAnchorTo(button) + tooltip:Show() +end diff --git a/modules/currencies.lua b/modules/currencies.lua index 1e163ee..82c3627 100644 --- a/modules/currencies.lua +++ b/modules/currencies.lua @@ -1,752 +1,1173 @@ local addonName, PermoksAccountManager = ... -local LibQTip = LibStub('LibQTip-1.0') -local L = LibStub('AceLocale-3.0'):GetLocale(addonName) +local LibQTip = LibStub("LibQTip-1.0") +local L = LibStub("AceLocale-3.0"):GetLocale(addonName) -local module = 'currencies' +local module = "currencies" local labelRows = { - soul_cinders = { - label = function() - return PermoksAccountManager.db.global.currencyInfo[1906].name or 'Soul Cinders' - end, - type = 'currency', - key = 1906, - group = 'currency', - version = WOW_PROJECT_MAINLINE - }, - soul_ash = { - label = function() - return PermoksAccountManager.db.global.currencyInfo[1828].name or 'Soul Ash' - end, - type = 'currency', - key = 1828, - group = 'currency', - version = WOW_PROJECT_MAINLINE - }, - stygia = { - label = function() - return PermoksAccountManager.db.global.currencyInfo[1767].name or 'Stygia' - end, - type = 'currency', - key = 1767, - group = 'currency', - version = WOW_PROJECT_MAINLINE - }, - conquest = { - label = function() - return PermoksAccountManager.db.global.currencyInfo[1602].name or 'Conquest' - end, - type = 'currency', - key = 1602, - hideMax = true, - tooltip = true, - group = 'currency', - version = WOW_PROJECT_MAINLINE - }, - honor = { - label = function() - return PermoksAccountManager.db.global.currencyInfo[1792].name or 'Honor' - end, - type = 'currency', - key = 1792, - abbCurrent = true, - abbMax = true, - tooltip = true, - group = 'currency', - version = WOW_PROJECT_MAINLINE - }, - honorBCC = { - label = function() - return PermoksAccountManager.db.global.currencyInfo[1901] and PermoksAccountManager.db.global.currencyInfo[1901].name or 'Honor' - end, - type = 'currency', - key = 1901, - abbMax = true, - customIcon = { - height = 32, - width = 32, - xOffset = -5, - yOffset = -5 - }, - group = 'currency', - version = WOW_PROJECT_CATACLYSM_CLASSIC - }, - arenaPoints = { - label = function() - return PermoksAccountManager.db.global.currencyInfo[1900] and PermoksAccountManager.db.global.currencyInfo[1900].name or 'Arena Points' - end, - type = 'currency', - key = 1900, - group = 'currency', - version = WOW_PROJECT_CATACLYSM_CLASSIC - }, - valor = { - label = function() - return PermoksAccountManager.db.global.currencyInfo[1191].name or 'Valor' - end, - type = 'currency', - key = 1191, - hideMax = true, - tooltip = true, - group = 'currency', - version = WOW_PROJECT_MAINLINE - }, - tower_knowledge = { - label = function() - return PermoksAccountManager.db.global.currencyInfo[1904].name or 'Tower Knowledge' - end, - type = 'currency', - key = 1904, - hideMax = true, - tooltip = true, - group = 'currency', - version = WOW_PROJECT_MAINLINE - }, - stygian_ember = { - label = function() - return PermoksAccountManager.db.global.currencyInfo[1977].name or 'Stygian Ember' - end, - type = 'currency', - key = 1977, - customTooltip = function(button, alt_data) - PermoksAccountManager:StygianEmbersTooltip_OnEnter(button, alt_data) - end, - tooltip = true, - group = 'currency', - version = WOW_PROJECT_MAINLINE - }, - cataloged_research = { - label = function() - return PermoksAccountManager.db.global.currencyInfo[1931].name or 'Cataloged Research' - end, - type = 'currency', - key = 1931, - abbMax = true, - group = 'currency', - version = WOW_PROJECT_MAINLINE - }, - redeemed_soul = { - label = function() - return PermoksAccountManager.db.global.currencyInfo[1810].name or 'Redeemed Soul' - end, - type = 'currency', - customTooltip = function(button, altData, labelRow) - PermoksAccountManager:CustomCovenantCurrencyTooltip(button, altData, labelRow) + + -- general currencies + honor = { + label = function() + return PermoksAccountManager.db.global.currencyInfo[1792].name or "Honor" end, + type = "currency", + warband = true, + key = 1792, + abbCurrent = true, + abbMax = true, tooltip = true, - tooltipKeyPath = {'covenantInfo', 'souls'}, - key = 1810, - group = 'sanctum', - version = WOW_PROJECT_MAINLINE - }, - reservoir_anima = { - label = function() - return PermoksAccountManager.db.global.currencyInfo[1813].name or 'Reservoir Anima' - end, - type = 'currency', - customTooltip = function(button, altData, labelRow) - PermoksAccountManager:CustomCovenantCurrencyTooltip(button, altData, labelRow) + group = "currency", + version = WOW_PROJECT_MAINLINE, + }, + valor = { + label = function() + return PermoksAccountManager.db.global.currencyInfo[1191].name or "Valor" end, + type = "currency", + key = 1191, + hideMax = true, tooltip = true, - tooltipKeyPath = {'covenantInfo', 'anima'}, - key = 1813, - hideMax = true, - group = 'sanctum', - version = WOW_PROJECT_MAINLINE - }, - - -- 9.2 - cosmic_flux = { + group = "currency", + version = WOW_PROJECT_MAINLINE, + }, + conquest = { label = function() - return PermoksAccountManager.db.global.currencyInfo[2009] and PermoksAccountManager.db.global.currencyInfo[2009].name or 'Cosmic Flux' - end, - type = 'currency', - key = 2009, - group = 'currency', - version = WOW_PROJECT_MAINLINE - }, - cyphers = { - label = L['Cyphers'], - type = 'currency', - key = 1979, - group = 'currency', - version = WOW_PROJECT_MAINLINE + return PermoksAccountManager.db.global.currencyInfo[1602].name or "Conquest" + end, + type = "currency", + key = 1602, + hideMax = true, + tooltip = true, + group = "currency", + version = WOW_PROJECT_MAINLINE, + }, + timewarped_badge = { + label = "Timewarped Badge", + type = "currency", + warband = true, + key = 1166, + group = "currency", + version = WOW_PROJECT_MAINLINE, + }, + dmf_prize_ticket = { + label = "Darkmoon Prize Ticket", + type = "currency", + warband = true, + key = 515, + group = "currency", + version = WOW_PROJECT_MAINLINE, + }, + + ---- Shadowlands + --soul_cinders = { + -- label = function() + -- return PermoksAccountManager.db.global.currencyInfo[1906].name or 'Soul Cinders' + -- end, + -- type = 'currency', + -- warband = true, + -- key = 1906, + -- group = 'currency', + -- version = WOW_PROJECT_MAINLINE + --}, + --soul_ash = { + -- label = function() + -- return PermoksAccountManager.db.global.currencyInfo[1828].name or 'Soul Ash' + -- end, + -- type = 'currency', + -- warband = true, + -- key = 1828, + -- group = 'currency', + -- version = WOW_PROJECT_MAINLINE + --}, + --stygia = { + -- label = function() + -- return PermoksAccountManager.db.global.currencyInfo[1767].name or 'Stygia' + -- end, + -- type = 'currency', + -- key = 1767, + -- group = 'currency', + -- version = WOW_PROJECT_MAINLINE + --}, + --tower_knowledge = { + -- label = function() + -- return PermoksAccountManager.db.global.currencyInfo[1904].name or 'Tower Knowledge' + -- end, + -- type = 'currency', + -- key = 1904, + -- hideMax = true, + -- tooltip = true, + -- group = 'currency', + -- version = WOW_PROJECT_MAINLINE + --}, + --stygian_ember = { + -- label = function() + -- return PermoksAccountManager.db.global.currencyInfo[1977].name or 'Stygian Ember' + -- end, + -- type = 'currency', + -- key = 1977, + -- customTooltip = function(button, alt_data) + -- PermoksAccountManager:StygianEmbersTooltip_OnEnter(button, alt_data) + -- end, + -- tooltip = true, + -- group = 'currency', + -- version = WOW_PROJECT_MAINLINE + --}, + --cataloged_research = { + -- label = function() + -- return PermoksAccountManager.db.global.currencyInfo[1931].name or 'Cataloged Research' + -- end, + -- type = 'currency', + -- warband = true, + -- key = 1931, + -- abbMax = true, + -- group = 'currency', + -- version = WOW_PROJECT_MAINLINE + --}, + --redeemed_soul = { + -- label = function() + -- return PermoksAccountManager.db.global.currencyInfo[1810].name or 'Redeemed Soul' + -- end, + -- type = 'currency', + -- customTooltip = function(button, altData, labelRow) + -- PermoksAccountManager:CustomCovenantCurrencyTooltip(button, altData, labelRow) + -- end, + -- tooltip = true, + -- tooltipKeyPath = { 'covenantInfo', 'souls' }, + -- key = 1810, + -- group = 'sanctum', + -- version = WOW_PROJECT_MAINLINE + --}, + --reservoir_anima = { + -- label = function() + -- return PermoksAccountManager.db.global.currencyInfo[1813].name or 'Reservoir Anima' + -- end, + -- type = 'currency', + -- customTooltip = function(button, altData, labelRow) + -- PermoksAccountManager:CustomCovenantCurrencyTooltip(button, altData, labelRow) + -- end, + -- tooltip = true, + -- tooltipKeyPath = { 'covenantInfo', 'anima' }, + -- key = 1813, + -- hideMax = true, + -- group = 'sanctum', + -- version = WOW_PROJECT_MAINLINE + --}, + -- + ---- 9.2 + --cosmic_flux = { + -- label = function() + -- return PermoksAccountManager.db.global.currencyInfo[2009] and + -- PermoksAccountManager.db.global.currencyInfo[2009].name or 'Cosmic Flux' + -- end, + -- type = 'currency', + -- warband = true, + -- key = 2009, + -- group = 'currency', + -- version = WOW_PROJECT_MAINLINE + --}, + --cyphers = { + -- label = L['Cyphers'], + -- type = 'currency', + -- warband = true, + -- key = 1979, + -- group = 'currency', + -- version = WOW_PROJECT_MAINLINE + --}, + -- + -- + ---- 10.0 + --dragon_isles_supplies = { + -- label = 'Dragon Isles Supplies', + -- type = 'currency', + -- warband = true, + -- key = 2003, + -- group = 'currency', + -- version = WOW_PROJECT_MAINLINE + --}, + --elemental_overflow = { + -- label = 'Elemental Overflow', + -- type = 'currency', + -- warband = true, + -- key = 2118, + -- group = 'currency', + -- version = WOW_PROJECT_MAINLINE + --}, + --bloody_tokens = { + -- label = 'Bloody Tokens', + -- type = 'currency', + -- key = 2123, + -- group = 'currency', + -- version = WOW_PROJECT_MAINLINE + --}, + --storm_sigil = { + -- label = 'Storm Sigil', + -- type = 'currency', + -- key = 2122, + -- group = 'currency', + -- version = WOW_PROJECT_MAINLINE + --}, + -- + ---- 10.1 + --flightstones = { + -- label = 'Flightstones', + -- type = 'currency', + -- key = 2245, + -- abbMax = true, + -- group = 'currency', + -- version = WOW_PROJECT_MAINLINE + --}, + -- + ---- 10.1.5 + --paracausal_flakes = { + -- label = 'Paracausal Flakes', + -- type = 'currency', + -- warband = true, + -- key = 2594, + -- abbMax = true, + -- group = 'currency', + -- version = WOW_PROJECT_MAINLINE + --}, + -- + ---- 10.2 + --emerald_dewdrop = { + -- label = 'Emerald Dewdrop', + -- type = 'currency', + -- key = 2650, + -- passRow = true, + -- group = 'currency', + -- version = WOW_PROJECT_MAINLINE + --}, + --seedbloom = { + -- label = 'Seedbloom', + -- type = 'currency', + -- key = 2651, + -- passRow = true, + -- group = 'currency', + -- version = WOW_PROJECT_MAINLINE + --}, + --dream_infusion = { + -- label = 'Dream Infusion', + -- type = 'currency', + -- key = 2777, + -- passRow = true, + -- group = 'currency', + -- version = WOW_PROJECT_MAINLINE + --}, + + -- 11.0 + adventurer_crest = { + label = "Adventurer Crests", + type = "crestcurrency", + key = 3383, + passRow = true, + group = "currency", + version = WOW_PROJECT_MAINLINE, + }, + veteran_crest = { + label = "Veteran Crests", + type = "crestcurrency", + key = 3341, + passRow = true, + group = "currency", + version = WOW_PROJECT_MAINLINE, + }, + normal_crest = { + label = "Champion Crests", + type = "crestcurrency", + key = 3343, + passRow = true, + group = "currency", + version = WOW_PROJECT_MAINLINE, + }, + hero_crest = { + label = "Hero Crests", + type = "crestcurrency", + key = 3345, + passRow = true, + group = "currency", + version = WOW_PROJECT_MAINLINE, + }, + myth_crest = { + label = "Myth Crests", + type = "crestcurrency", + key = 3347, + passRow = true, + group = "currency", + version = WOW_PROJECT_MAINLINE, + }, + valorstones = { + label = "Valorstones", + type = "currency", + key = 3008, + abbMax = true, + warband = true, + group = "currency", + version = WOW_PROJECT_MAINLINE, + }, + resonance_crystals = { + label = "Resonance Crystals", + type = "currency", + warband = true, + key = 2815, + group = "currency", + version = WOW_PROJECT_MAINLINE, + }, + kej = { + label = "Kej", + type = "currency", + warband = true, + key = 3056, + group = "currency", + version = WOW_PROJECT_MAINLINE, + }, + undercoin = { + label = "Undercoin", + type = "currency", + warband = true, + key = 2803, + group = "currency", + version = WOW_PROJECT_MAINLINE, + }, + + -- 11.0.5 + --bronze_celebration_token = { + -- label = 'Celebration Token', + -- type = 'currency', + -- warband = true, + -- key = 3100, + -- group = 'currency', + -- version = WOW_PROJECT_MAINLINE + --}, + + -- 11.1 + spark_drops = { + label = "Spark Cap", + type = "currency", + key = 3212, + group = "currency", + hideIcon = true, + version = WOW_PROJECT_MAINLINE, + }, + empty_kajacola_can = { + label = "Empy Kaja'Cola", + type = "currency", + key = 3218, + group = "currency", + version = WOW_PROJECT_MAINLINE, + }, + vintage_kajacola_can = { + label = "Vintage Kaja'Cola", + type = "currency", + key = 3220, + group = "currency", + version = WOW_PROJECT_MAINLINE, }, catalyst_charges = { - label = L['Catalyst Charges'], - type = 'catalystcharges', - key = 2912, + label = L["Catalyst Charges"], + type = "catalystcharges", + key = 3378, hideIcon = true, - group = 'currency', - version = WOW_PROJECT_MAINLINE - }, - - --10.0 - dragon_isles_supplies = { - label = 'Dragon Isles Supplies', - type = 'currency', - key = 2003, - group = 'currency', - version = WOW_PROJECT_MAINLINE - }, - elemental_overflow = { - label = 'Elemental Overflow', - type = 'currency', - key = 2118, - group = 'currency', - version = WOW_PROJECT_MAINLINE - }, - bloody_tokens = { - label = 'Bloody Tokens', - type = 'currency', - key = 2123, - group = 'currency', - version = WOW_PROJECT_MAINLINE - }, - storm_sigil = { - label = 'Storm Sigil', - type = 'currency', - key = 2122, - group = 'currency', - version = WOW_PROJECT_MAINLINE - }, - - --10.1 - whelpling_crest_earned = { - label = 'Whelpling earned', - type = 'currency', - key = 2409, - group = 'currency', - version = WOW_PROJECT_MAINLINE - }, - drake_crest_earned = { - label = 'Drake earned', - type = 'currency', - key = 2410, - group = 'currency', - version = WOW_PROJECT_MAINLINE - }, - wyrm_crest_earned = { - label = 'Wyrm earned', - type = 'currency', - key = 2411, - group = 'currency', - version = WOW_PROJECT_MAINLINE - }, - aspect_crest_earned = { - label = 'Aspect earned', - type = 'currency', - key = 2412, - group = 'currency', - version = WOW_PROJECT_MAINLINE - }, - flightstones = { - label = 'Flightstones', - type = 'currency', - key = 2245, - abbMax = true, - group = 'currency', - version = WOW_PROJECT_MAINLINE - }, - - -- 10.1.5 - paracausal_flakes = { - label = 'Paracausal Flakes', - type = 'currency', - key = 2594, - abbMax = true, - group = 'currency', - version = WOW_PROJECT_MAINLINE - }, - - -- 10.2 - whelpling_crest_s3 = { - label = 'Whelpling Crests', - type = 'crestcurrency', - key = 2706, - passRow = true, - group = 'currency', - version = WOW_PROJECT_MAINLINE - }, - drake_crest_s3 = { - label = 'Drake Crests', - type = 'crestcurrency', - key = 2707, - passRow = true, - group = 'currency', - version = WOW_PROJECT_MAINLINE - }, - wyrm_crest_s3 = { - label = 'Wyrm Crests', - type = 'crestcurrency', - key = 2708, - passRow = true, - group = 'currency', - version = WOW_PROJECT_MAINLINE - }, - aspect_crest_s3 = { - label = 'Aspect Crests', - type = 'crestcurrency', - key = 2709, - passRow = true, - group = 'currency', - version = WOW_PROJECT_MAINLINE - }, - emerald_dewdrop = { - label = 'Emerald Dewdrop', - type = 'currency', - key = 2650, - passRow = true, - group = 'currency', - version = WOW_PROJECT_MAINLINE - }, - seedbloom = { - label = 'Seedbloom', - type = 'currency', - key = 2651, - passRow = true, - group = 'currency', - version = WOW_PROJECT_MAINLINE - }, - dream_infusion = { - label = 'Dream Infusion', - type = 'currency', - key = 2777, - passRow = true, - group = 'currency', - version = WOW_PROJECT_MAINLINE - }, - - -- 10.2.7 - whelpling_crest_s4 = { - label = 'Whelpling Crests', - type = 'crestcurrency', - key = 2806, - passRow = true, - group = 'currency', - version = WOW_PROJECT_MAINLINE - }, - drake_crest_s4 = { - label = 'Drake Crests', - type = 'crestcurrency', - key = 2807, - passRow = true, - group = 'currency', - version = WOW_PROJECT_MAINLINE - }, - wyrm_crest_s4 = { - label = 'Wyrm Crests', - type = 'crestcurrency', - key = 2809, - passRow = true, - group = 'currency', - version = WOW_PROJECT_MAINLINE - }, - aspect_crest_s4 = { - label = 'Aspect Crests', - type = 'crestcurrency', - key = 2812, - passRow = true, - group = 'currency', - version = WOW_PROJECT_MAINLINE - }, - - -- 11.0 Prepatch - residual_memories = { - label = 'Residual Memories', - type = 'currency', - key = 3089, - passRow = true, - group = 'currency', - warband = true, - version = WOW_PROJECT_MAINLINE - }, - - -- 11.0 - - - - -- wotlk-classic - emblem_of_heroism = { - label = 'Heroism Emblems', - type = 'currency', + group = "currency", + version = WOW_PROJECT_MAINLINE, + }, + + -- 11.1.5 + eye_of_nzoth = { + label = "Eye of N'Zoth", + type = "treecurrency", + passRow = true, + key = 3728, + maxQuantity = 13, + group = "currency", + version = WOW_PROJECT_MAINLINE, + }, + displaced_corrupted_mementos = { + label = "Corrupted Mementos", + type = "currency", + key = 3149, + group = "currency", + version = WOW_PROJECT_MAINLINE, + }, + + -- 12.0 + voidlight_marl = { + label = "Voidlight Marl", + type = "currency", + warband = true, + key = 3316, + group = "currency", + version = WOW_PROJECT_MAINLINE, + }, + shard_of_dundun = { + label = "Shard of Dundun", + type = "currency", + warband = true, + key = 3376, + group = "currency", + version = WOW_PROJECT_MAINLINE, + }, + coffer_key_shard_currency = { + label = "Coffer Key Shards", + type = "keyshard", + key = 3310, + useWeeklyEarned = true, + passRow = true, + group = "currency", + version = WOW_PROJECT_MAINLINE, + }, + restored_coffer_key = { + label = "Restored Coffer Key", + type = "cofferkey", + passRow = true, + key = 3028, + reagent = 229899, + reagentRequired = 100, + group = "currency", + version = WOW_PROJECT_MAINLINE, + }, + + -- wotlk-classic + honorBCC = { + label = function() + return PermoksAccountManager.db.global.currencyInfo[1901] + and PermoksAccountManager.db.global.currencyInfo[1901].name + or "Honor" + end, + type = "currency", + key = 1901, + abbMax = true, + customIcon = { + height = 32, + width = 32, + xOffset = -5, + yOffset = -5, + }, + group = "currency", + version = WOW_PROJECT_CATACLYSM_CLASSIC, + }, + arenaPoints = { + label = function() + return PermoksAccountManager.db.global.currencyInfo[1900] + and PermoksAccountManager.db.global.currencyInfo[1900].name + or "Arena Points" + end, + type = "currency", + key = 1900, + group = "currency", + version = WOW_PROJECT_CATACLYSM_CLASSIC, + }, + emblem_of_heroism = { + label = "Heroism Emblems", + type = "currency", key = 101, - abbMax = true, - group = 'currency', - version = WOW_PROJECT_CATACLYSM_CLASSIC - }, - emblem_of_valor = { - label = 'Valor Emblems', - type = 'currency', + abbMax = true, + group = "currency", + version = WOW_PROJECT_CATACLYSM_CLASSIC, + }, + emblem_of_valor = { + label = "Valor Emblems", + type = "currency", key = 102, - abbMax = true, - group = 'currency', - version = WOW_PROJECT_CATACLYSM_CLASSIC - }, - emblem_of_conquest = { - label = 'Conq. Emblems', - type = 'currency', + abbMax = true, + group = "currency", + version = WOW_PROJECT_CATACLYSM_CLASSIC, + }, + emblem_of_conquest = { + label = "Conq. Emblems", + type = "currency", key = 221, - abbMax = true, - group = 'currency', - version = WOW_PROJECT_CATACLYSM_CLASSIC - }, - emblem_of_triumph = { - label = 'Triumph Emblems', - type = 'currency', + abbMax = true, + group = "currency", + version = WOW_PROJECT_CATACLYSM_CLASSIC, + }, + emblem_of_triumph = { + label = "Triumph Emblems", + type = "currency", key = 301, - abbMax = true, - group = 'currency', - version = WOW_PROJECT_CATACLYSM_CLASSIC - }, - emblem_of_frost = { - label = 'Frost Emblems', - type = 'currency', + abbMax = true, + group = "currency", + version = WOW_PROJECT_CATACLYSM_CLASSIC, + }, + emblem_of_frost = { + label = "Frost Emblems", + type = "currency", key = 341, - abbMax = true, - group = 'currency', - version = WOW_PROJECT_CATACLYSM_CLASSIC - }, - sidereal_essence = { - label = 'Sidereal Essence', - type = 'currency', + abbMax = true, + group = "currency", + version = WOW_PROJECT_CATACLYSM_CLASSIC, + }, + sidereal_essence = { + label = "Sidereal Essence", + type = "currency", key = 2589, - abbMax = true, - group = 'currency', - version = WOW_PROJECT_CATACLYSM_CLASSIC - }, - defilers_scourgestone = { - label = 'Scourgestones', - type = 'currency', + abbMax = true, + group = "currency", + version = WOW_PROJECT_CATACLYSM_CLASSIC, + }, + defilers_scourgestone = { + label = "Scourgestones", + type = "currency", key = 2711, - abbMax = true, - group = 'currency', - version = WOW_PROJECT_CATACLYSM_CLASSIC - }, - stone_keepers_shard = { - label = 'Stone Keeper\'s Shard', - type = 'currency', + abbMax = true, + group = "currency", + version = WOW_PROJECT_CATACLYSM_CLASSIC, + }, + stone_keepers_shard = { + label = "Stone Keeper's Shard", + type = "currency", key = 161, - abbMax = true, - group = 'currency', - version = WOW_PROJECT_CATACLYSM_CLASSIC - }, - justice_points = { - label = 'Justice Points', - type = 'currency', + abbMax = true, + group = "currency", + version = WOW_PROJECT_CATACLYSM_CLASSIC, + }, + justice_points = { + label = "Justice Points", + type = "currency", key = 395, - abbMax = true, - group = 'currency', - version = WOW_PROJECT_CATACLYSM_CLASSIC - }, - valor_points = { - label = 'Valor Points', - type = 'valor', + abbMax = true, + group = "currency", + version = false, + }, + valor_points = { + label = "Valor Points", + type = "valor", key = 396, - abbMax = true, - passRow = true, - group = 'currency', - version = WOW_PROJECT_CATACLYSM_CLASSIC - }, - conquest_points = { - label = 'Conquest', - type = 'currency', + abbMax = true, + passRow = true, + group = "currency", + version = false, + }, + conquest_points = { + label = "Conquest", + type = "currency", key = 390, - abbMax = true, - group = 'currency', - version = WOW_PROJECT_CATACLYSM_CLASSIC - }, - tol_barad_commendations = { - label = 'Commendations', - type = 'currency', + abbMax = true, + group = "currency", + version = false, + }, + tol_barad_commendations = { + label = "Commendations", + type = "currency", key = 391, - abbMax = true, - group = 'currency', - version = WOW_PROJECT_CATACLYSM_CLASSIC - }, + abbMax = true, + group = "currency", + version = WOW_PROJECT_CATACLYSM_CLASSIC, + }, + + -- Mists + honor_mists = { + label = function() + return PermoksAccountManager.db.global.currencyInfo[1901] + and PermoksAccountManager.db.global.currencyInfo[1901].name + or "Honor" + end, + type = "currency", + key = 1901, + abbMax = true, + customIcon = { + height = 20, + width = 20, + xOffset = -3, + yOffset = -1, + }, + group = "currency", + version = WOW_PROJECT_MISTS_CLASSIC, + }, + ironpaw_token = { + label = "Ironpaw Token", + type = "currency", + key = 402, + abbMax = true, + group = "currency", + version = WOW_PROJECT_MISTS_CLASSIC, + }, } local function UpdateAllCurrencies(charInfo) - local self = PermoksAccountManager - charInfo.currencyInfo = charInfo.currencyInfo or {} - - local currencyInfo = charInfo.currencyInfo - for currencyType, offset in pairs(self.currency) do - local info = C_CurrencyInfo.GetCurrencyInfo(currencyType) - if info then - currencyInfo[currencyType] = charInfo.currencyInfo[currencyType] or {name = info.name} - - currencyInfo[currencyType].currencyType = currencyType - currencyInfo[currencyType].quantity = info.quantity + offset - currencyInfo[currencyType].maxQuantity = info.maxQuantity and info.maxQuantity > 0 and info.maxQuantity or nil - currencyInfo[currencyType].totalEarned = info.totalEarned - currencyInfo[currencyType].maxWeeklyQuantity = info.maxWeeklyQuantity - currencyInfo[currencyType].quantityEarnedThisWeek = info.quantityEarnedThisWeek - - self.db.global.currencyInfo[currencyType] = self.db.global.currencyInfo[currencyType] or {icon = info.iconFileID, name = info.name} - self.db.global.currencyInfo[currencyType].maxQuantity = info.maxQuantity and info.maxQuantity > 0 and info.maxQuantity or self.db.global.currencyInfo[currencyType].maxQuantity - end - end + local self = PermoksAccountManager + charInfo.currencyInfo = charInfo.currencyInfo or {} + + local currencyInfo = charInfo.currencyInfo + for currencyType, offset in pairs(self.currency) do + local info = C_CurrencyInfo.GetCurrencyInfo(currencyType) + if info then + currencyInfo[currencyType] = charInfo.currencyInfo[currencyType] or { name = info.name } + + currencyInfo[currencyType].currencyType = currencyType + currencyInfo[currencyType].quantity = info.quantity + offset + currencyInfo[currencyType].maxQuantity = info.maxQuantity and info.maxQuantity > 0 and info.maxQuantity + or nil + currencyInfo[currencyType].totalEarned = info.totalEarned + currencyInfo[currencyType].maxWeeklyQuantity = info.maxWeeklyQuantity + currencyInfo[currencyType].quantityEarnedThisWeek = info.quantityEarnedThisWeek + + self.db.global.currencyInfo[currencyType] = self.db.global.currencyInfo[currencyType] + or { icon = info.iconFileID, name = info.name } + self.db.global.currencyInfo[currencyType].maxQuantity = info.maxQuantity + and info.maxQuantity > 0 + and info.maxQuantity + or self.db.global.currencyInfo[currencyType].maxQuantity + end + end +end + +local function UpdateAllTreeCurrencies(charInfo) + local self = PermoksAccountManager + if not self.currencyTrees then + return + end + + charInfo.treeCurrencyInfo = charInfo.treeCurrencyInfo or {} + + local currencyInfo = charInfo.treeCurrencyInfo + for treeID, treeInfo in pairs(self.currencyTrees) do + local configID = C_Traits.GetConfigIDBySystemID(treeInfo.systemID) + local treeCurrencyInfos = configID and C_Traits.GetTreeCurrencyInfo(configID, treeID, true) + + if treeCurrencyInfos then + for _, treeCurrencyInfo in ipairs(treeCurrencyInfos) do + currencyInfo[treeCurrencyInfo.traitCurrencyID] = charInfo.currencyInfo[treeCurrencyInfo.traitCurrencyID] + or {} + currencyInfo[treeCurrencyInfo.traitCurrencyID].quantity = treeCurrencyInfo.quantity + currencyInfo[treeCurrencyInfo.traitCurrencyID].maxQuantity = treeCurrencyInfo.maxQuantity + currencyInfo[treeCurrencyInfo.traitCurrencyID].spent = treeCurrencyInfo.spent + end + end + end +end + +local function SumWarbandCurrencies(warbandCurrency) + local currencySum = 0 + for _, alt in pairs(warbandCurrency) do + currencySum = currencySum + alt.quantity + end + return currencySum +end + +-- this is only for the Warband column, not for the Warband characters +local function UpdateWarbandAltCurrency(warbandCurrencyInfo, newWarbandCurrencyInfo, currencyType) + if not warbandCurrencyInfo then + return + end + + warbandCurrencyInfo[currencyType] = warbandCurrencyInfo[currencyType] + or { name = C_CurrencyInfo.GetCurrencyInfo(currencyType).name } + + warbandCurrencyInfo[currencyType].currencyType = currencyType + warbandCurrencyInfo[currencyType].altQuantity = newWarbandCurrencyInfo + and SumWarbandCurrencies(newWarbandCurrencyInfo) + or 0 +end + +local function UpdateAllWarbandCurrencies(charInfo) + local self = PermoksAccountManager + self.warbandData.currencyInfo = self.warbandData.currencyInfo or {} + + -- reference to the currency tables for character and Warband + local charCurrencyInfo = charInfo.currencyInfo + local warbandCurrencyInfo = self.warbandData.currencyInfo + for currencyType, offset in pairs(self.currency) do + -- only fetches data from non-active characters + local newWarbandCurrencyInfo = C_CurrencyInfo.FetchCurrencyDataFromAccountCharacters(currencyType) + local transferableCurrency = C_CurrencyInfo.IsAccountTransferableCurrency(currencyType) + if newWarbandCurrencyInfo or transferableCurrency then + UpdateWarbandAltCurrency(warbandCurrencyInfo, newWarbandCurrencyInfo, currencyType) + + if warbandCurrencyInfo[currencyType] then + warbandCurrencyInfo[currencyType].quantity = warbandCurrencyInfo[currencyType].altQuantity + + charCurrencyInfo[currencyType].quantity + + offset + end + end + end end local function Update(charInfo) - UpdateAllCurrencies(charInfo) + UpdateAllCurrencies(charInfo) + UpdateAllTreeCurrencies(charInfo) + + -- requesting the warband data has a slight server-delay + if PermoksAccountManager.isRetail then + C_CurrencyInfo.RequestCurrencyDataForAccountCharacters() + end end local function UpdateCurrency(charInfo, currencyType, quantity, quantityChanged) - local self = PermoksAccountManager - if not currencyType or not self.currency[currencyType] then - return - end - - local currencyInfo = charInfo.currencyInfo[currencyType] - if self.isRetail then - currencyInfo.totalEarned = quantityChanged + (currencyInfo.totalEarned or 0) - end - - local customOptions = self.currencyCustomOptions and self.currencyCustomOptions[currencyType] - if customOptions then - if customOptions.forceUpdate then - local newCurrencyInfo = C_CurrencyInfo.GetCurrencyInfo(currencyType) - currencyInfo.quantity = newCurrencyInfo.quantity - currencyInfo.totalEarned = newCurrencyInfo.totalEarned - currencyInfo.quantityEarnedThisWeek = newCurrencyInfo.quantityEarnedThisWeek - currencyInfo.maxWeeklyQuantity = newCurrencyInfo.maxWeeklyQuantity - currencyInfo.maxQuantity = newCurrencyInfo.maxQuantity and newCurrencyInfo.maxQuantity > 0 and newCurrencyInfo.maxQuantity or nil - elseif customOptions.currencyUpdate and charInfo.currencyInfo[customOptions.currencyUpdate] then - charInfo.currencyInfo[customOptions.currencyUpdate].quantity = C_CurrencyInfo.GetCurrencyInfo(customOptions.currencyUpdate).quantity - end - else - charInfo.currencyInfo[currencyType].quantity = quantity + self.currency[currencyType] - end + local self = PermoksAccountManager + if not currencyType or not self.currency[currencyType] then + return + end + + local currencyInfo = charInfo.currencyInfo[currencyType] + if self.isRetail and quantityChanged then + currencyInfo.totalEarned = quantityChanged + (currencyInfo.totalEarned or 0) + end + + local customOptions = self.currencyCustomOptions and self.currencyCustomOptions[currencyType] + if customOptions or not quantityChanged then + if not quantityChanged or customOptions.forceUpdate then + local newCurrencyInfo = C_CurrencyInfo.GetCurrencyInfo(currencyType) + currencyInfo.quantity = newCurrencyInfo.quantity + currencyInfo.totalEarned = newCurrencyInfo.totalEarned + currencyInfo.quantityEarnedThisWeek = newCurrencyInfo.quantityEarnedThisWeek + currencyInfo.maxWeeklyQuantity = newCurrencyInfo.maxWeeklyQuantity + currencyInfo.maxQuantity = newCurrencyInfo.maxQuantity + and newCurrencyInfo.maxQuantity > 0 + and newCurrencyInfo.maxQuantity + or nil + elseif customOptions.currencyUpdate and charInfo.currencyInfo[customOptions.currencyUpdate] then + charInfo.currencyInfo[customOptions.currencyUpdate].quantity = + C_CurrencyInfo.GetCurrencyInfo(customOptions.currencyUpdate).quantity + end + else + charInfo.currencyInfo[currencyType].quantity = quantity + self.currency[currencyType] + end + + -- Update Warband amount + if self.warbandData.currencyInfo and C_CurrencyInfo.IsAccountTransferableCurrency(currencyType) then + local warbandCurrencyInfo = self.warbandData.currencyInfo + warbandCurrencyInfo[currencyType].quantity = warbandCurrencyInfo[currencyType].altQuantity + quantity + end +end + +local function UpdateTreeCurrency(charInfo, treeID) + local self = PermoksAccountManager + if not self.currencyTrees[treeID] then + return + end + + local treeInfo = self.currencyTrees[treeID] + local currencyInfo = charInfo.treeCurrencyInfo[treeInfo.currencyType] + + local configID = C_Traits.GetConfigIDBySystemID(treeInfo.systemID) + local treeCurrencyInfo = configID and C_Traits.GetTreeCurrencyInfo(configID, treeID, true) + if treeCurrencyInfo then + currencyInfo.quantity = treeCurrencyInfo.quantity + currencyInfo.maxQuantity = treeCurrencyInfo.maxQuantity + end +end + +local function CurrencyTransferUpdate(charInfo) + local self = PermoksAccountManager + local accountData = self.account.data + local warbandCurrencyInfo = self.warbandData.currencyInfo + + -- Fetch the latest currency transfer transactions + local transferLog = C_CurrencyInfo.FetchCurrencyTransferTransactions() + local lastTransferCurrencyType = transferLog[#transferLog].currencyType + + -- Get new currency information for character and warband + local newCharacterCurrencyInfo = C_CurrencyInfo.GetCurrencyInfo(lastTransferCurrencyType) + local newWarbandCurrencyInfo = C_CurrencyInfo.FetchCurrencyDataFromAccountCharacters(lastTransferCurrencyType) + + -- this is necessary because a transfer can be taxed by with different penalties + UpdateWarbandAltCurrency(warbandCurrencyInfo, newWarbandCurrencyInfo, lastTransferCurrencyType) + warbandCurrencyInfo[lastTransferCurrencyType].quantity = warbandCurrencyInfo[lastTransferCurrencyType].altQuantity + + newCharacterCurrencyInfo.quantity + + -- update all alts for this currency because the transferlog has no GUID unless you relog (cringe) + -- even more cringe is that reducing a currency to 0 makes the character disappear from data. + -- comparing tables to find the nils is too complex so we just reset the db and fill it again. + for guID, alt in pairs(accountData) do + if guID ~= charInfo.guid and alt.currencyInfo[lastTransferCurrencyType] then + alt.currencyInfo[lastTransferCurrencyType].quantity = 0 + end + end + + for _, alt in pairs(newWarbandCurrencyInfo) do + local character = accountData[alt.characterGUID] + if character and character.currencyInfo and character.currencyInfo[lastTransferCurrencyType] then + character.currencyInfo[lastTransferCurrencyType].quantity = alt.quantity + end + end end local function UpdateCatalystCharges(charInfo) - if not charInfo.currencyInfo or not charInfo.currencyInfo[2912] then - UpdateAllCurrencies(charInfo) - end + if not charInfo.currencyInfo or not charInfo.currencyInfo[3378] then + UpdateAllCurrencies(charInfo) + end - charInfo.currencyInfo[2912].quantity = C_CurrencyInfo.GetCurrencyInfo(2912).quantity + charInfo.currencyInfo[3378].quantity = C_CurrencyInfo.GetCurrencyInfo(3378).quantity end local function CreateCatalystChargeString(currencyInfo) - local catalystCharges = currencyInfo and currencyInfo[2912] - if not catalystCharges then return '-' end + local catalystCharges = currencyInfo and currencyInfo[3378] + if not catalystCharges then + return "-" + end return PermoksAccountManager:CreateFractionString(catalystCharges.quantity, catalystCharges.maxQuantity) end local function CreateCrestString(labelRow, currencyInfo) local crestInfo = currencyInfo and currencyInfo[labelRow.key] - if crestInfo then - if crestInfo.maxQuantity and crestInfo.maxQuantity > 0 then - local currencyString = PermoksAccountManager:CreateCurrencyString(crestInfo, labelRow.abbCurrent, labelRow.abbMax, labelRow.hideMaximum, labelRow.customIcon, labelRow.hideIcon, crestInfo.totalEarned) - return string.format("%d - %s", crestInfo.quantity, currencyString) - elseif currencyInfo then - return PermoksAccountManager:CreateCurrencyString(crestInfo, labelRow.abbCurrent, labelRow.abbMax, labelRow.hideMaximum, labelRow.customIcon, labelRow.hideIcon) - end - elseif currencyInfo then - return PermoksAccountManager:CreateCurrencyString({currencyType = labelRow.key}, labelRow.abbCurrent, labelRow.abbMax, labelRow.hideMaximum, labelRow.customIcon, labelRow.hideIcon, 0) - else - return '-' - end + local self = PermoksAccountManager + + if crestInfo then + if crestInfo.maxQuantity and crestInfo.maxQuantity > 0 then + local currencyString = PermoksAccountManager:CreateCurrencyString( + crestInfo, + labelRow.abbCurrent, + labelRow.abbMax, + labelRow.hideMaximum, + labelRow.customIcon, + labelRow.hideIcon, + crestInfo.totalEarned + ) + return string.format("%d - %s", crestInfo.quantity, currencyString) + elseif currencyInfo then + return PermoksAccountManager:CreateCurrencyString( + crestInfo, + labelRow.abbCurrent, + labelRow.abbMax, + labelRow.hideMaximum, + labelRow.customIcon, + labelRow.hideIcon + ) + end + -- manually exclcluding crests for the warband column. need a better solution what labelRows the Warband column shows + elseif currencyInfo and currencyInfo ~= self.warbandData.currencyInfo then + return PermoksAccountManager:CreateCurrencyString( + { currencyType = labelRow.key }, + labelRow.abbCurrent, + labelRow.abbMax, + labelRow.hideMaximum, + labelRow.customIcon, + labelRow.hideIcon, + 0 + ) + else + return "-" + end +end + +local function CreateCofferKeyString(labelRow, currencyInfo, itemCounts) + if not currencyInfo then + return "-" + end + + local keyInfo = currencyInfo[labelRow.key] + local reagentInfo = itemCounts[labelRow.reagent] + + local total = 0 + if keyInfo then + total = total + keyInfo.quantity + end + + if reagentInfo then + total = total + (reagentInfo.total / labelRow.reagentRequired) + end + + return PermoksAccountManager:CreateCurrencyString(keyInfo, nil, nil, nil, nil, nil, total) +end + +local function CreateKeyShardString(labelRow, currencyInfo) + local keyshardInfo = currencyInfo and currencyInfo[labelRow.key] + + if keyshardInfo then + local currencyString = PermoksAccountManager:CreateCurrencyString( + keyshardInfo, + labelRow.abbCurrent, + labelRow.abbMax, + labelRow.hideMaximum, + labelRow.customIcon, + labelRow.hideIcon, + keyshardInfo.quantityEarnedThisWeek + ) + return string.format("%d - %s", keyshardInfo.quantity, currencyString) + else + return "-" + end end local function CreateValorString(labelRow, currencyInfo) - local info = currencyInfo and currencyInfo[labelRow.key] - if info then - local globalCurrencyInfo = PermoksAccountManager.db.global.currencyInfo[labelRow.key] - local maxQuantity = (info.maxQuantity and info.maxQuantity > 0 and info.maxQuantity) or (globalCurrencyInfo and globalCurrencyInfo.maxQuantity or 0) - return string.format("%s - %s", AbbreviateNumbers(info.quantity), PermoksAccountManager:CreateFractionString(info.totalEarned or 0, maxQuantity or 0)) - end + local info = currencyInfo and currencyInfo[labelRow.key] + if info then + local globalCurrencyInfo = PermoksAccountManager.db.global.currencyInfo[labelRow.key] + local maxQuantity = (info.maxQuantity and info.maxQuantity > 0 and info.maxQuantity) + or (globalCurrencyInfo and globalCurrencyInfo.maxQuantity or 0) + return string.format( + "%s - %s", + AbbreviateNumbers(info.quantity), + PermoksAccountManager:CreateFractionString(info.totalEarned or 0, maxQuantity or 0) + ) + end +end + +local function CreateTreeCurrencyString(labelRow, currencyInfo) + local info = currencyInfo and currencyInfo[labelRow.key] + if info then + return PermoksAccountManager:CreateFractionString( + (info.quantity or 0) + (info.spent or 0), + labelRow.maxQuantity or 0 + ) + end end local payload = { - update = Update, - labels = labelRows, - events = { - ['CURRENCY_DISPLAY_UPDATE'] = UpdateCurrency, - ['PERKS_ACTIVITIES_UDPATED'] = UpdateCatalystCharges, - }, - share = { - [UpdateCurrency] = 'currencyInfo' - } + update = Update, + labels = labelRows, + events = { + ["CURRENCY_DISPLAY_UPDATE"] = UpdateCurrency, + ["PERKS_ACTIVITIES_UDPATED"] = UpdateCatalystCharges, + ["ACCOUNT_CHARACTER_CURRENCY_DATA_RECEIVED"] = UpdateAllWarbandCurrencies, + ["CURRENCY_TRANSFER_LOG_UPDATE"] = CurrencyTransferUpdate, + ["TRAIT_TREE_CURRENCY_INFO_UPDATED"] = UpdateTreeCurrency, + }, + share = { + [UpdateCurrency] = "currencyInfo", + }, } local module = PermoksAccountManager:AddModule(module, payload) -module:AddCustomLabelType('catalystcharges', CreateCatalystChargeString, nil, 'currencyInfo') -module:AddCustomLabelType('crestcurrency', CreateCrestString, nil, 'currencyInfo') -module:AddCustomLabelType('valor', CreateValorString, nil, 'currencyInfo') +module:AddCustomLabelType("catalystcharges", CreateCatalystChargeString, nil, "currencyInfo") +module:AddCustomLabelType("crestcurrency", CreateCrestString, nil, "currencyInfo") +module:AddCustomLabelType("keyshard", CreateKeyShardString, nil, "currencyInfo") +module:AddCustomLabelType("valor", CreateValorString, nil, "currencyInfo") +module:AddCustomLabelType("cofferkey", CreateCofferKeyString, nil, "currencyInfo", "itemCounts") +module:AddCustomLabelType("treecurrency", CreateTreeCurrencyString, nil, "treeCurrencyInfo") -- TODO Create a CreateIconString function instead of two functions for items and currencies -function PermoksAccountManager:CreateCurrencyString(currencyInfo, abbreviateCurrent, abbreviateMaximum, hideMaximum, customIcon, hideIcon, customQuantitiy) - if not currencyInfo then - return - end - - local iconString = '' - local options = self.db.global.options - local globalCurrencyInfo = self.db.global.currencyInfo[currencyInfo.currencyType] - local currencyIcon = globalCurrencyInfo.icon - if not hideIcon and currencyIcon and options.currencyIcons then - if customIcon then - iconString = string.format('\124T%s:%d:%d:%d:%d\124t', customIcon.path or currencyIcon, customIcon.height or 18, customIcon.width or 18, customIcon.xOffset or 0, customIcon.yOffset or 0) - else - iconString = string.format('\124T%d:18:18\124t', currencyIcon) - end - end - - if currencyInfo.maxQuantity and currencyInfo.maxQuantity > 0 and (currencyInfo.quantity or 0) > currencyInfo.maxQuantity then - currencyInfo.quantity = currencyInfo.quantity / 100 - end - - local currencyString - local quantity = customQuantitiy or currencyInfo.quantity - if not hideMaximum and ((currencyInfo.maxQuantity and currencyInfo.maxQuantity > 0) or (currencyInfo.maxWeeklyQuantity and currencyInfo.maxWeeklyQuantity > 0)) then - currencyString = self:CreateFractionString(quantity, globalCurrencyInfo.maxQuantity or currencyInfo.maxQuantity or currencyInfo.maxWeeklyQuantity, abbreviateCurrent, abbreviateMaximum) - else - currencyString = abbreviateCurrent and AbbreviateNumbers(quantity) or AbbreviateLargeNumbers(quantity) - end - - local iconPosition = options.currencyIconPosition - if iconPosition == 'left' then - return string.format('%s %s', iconString, currencyString) - end - return string.format('%s %s', currencyString, iconString) +function PermoksAccountManager:CreateCurrencyString( + currencyInfo, + abbreviateCurrent, + abbreviateMaximum, + hideMaximum, + customIcon, + hideIcon, + customQuantitiy, + useWeeklyEarned +) + if not currencyInfo then + return + end + + local iconString = "" + local options = self.db.global.options + local globalCurrencyInfo = self.db.global.currencyInfo[currencyInfo.currencyType] + local currencyIcon = globalCurrencyInfo and globalCurrencyInfo.icon + if not hideIcon and currencyIcon and options.currencyIcons then + if customIcon then + iconString = string.format( + "\124T%s:%d:%d:%d:%d\124t", + customIcon.path or currencyIcon, + customIcon.height or 18, + customIcon.width or 18, + customIcon.xOffset or 0, + customIcon.yOffset or 0 + ) + else + iconString = string.format("\124T%d:18:18\124t", currencyIcon) + end + end + + if + currencyInfo.maxQuantity + and currencyInfo.maxQuantity > 0 + and (currencyInfo.quantity or 0) > currencyInfo.maxQuantity + then + -- REFACTOR: move this logic to the crest labelRows to remove redundancy + local id = currencyInfo.currencyType + if id ~= 3383 and id ~= 3341 and id ~= 3343 and id ~= 3345 and id ~= 3347 then + currencyInfo.quantity = currencyInfo.quantity / 100 + end + end + + local quantity = customQuantitiy + or (useWeeklyEarned and currencyInfo.quantityEarnedThisWeek) + or currencyInfo.quantity + local currencyString = quantity + if + not hideMaximum + and ( + (currencyInfo.maxQuantity and currencyInfo.maxQuantity > 0) + or (currencyInfo.maxWeeklyQuantity and currencyInfo.maxWeeklyQuantity > 0) + ) + then + currencyString = self:CreateFractionString( + quantity, + globalCurrencyInfo.maxQuantity or currencyInfo.maxQuantity or currencyInfo.maxWeeklyQuantity, + abbreviateCurrent, + abbreviateMaximum + ) + elseif quantity >= 1000 then + currencyString = abbreviateCurrent and AbbreviateNumbers(quantity) or AbbreviateLargeNumbers(quantity) + end + + local iconPosition = options.currencyIconPosition + if iconPosition == "left" then + return string.format("%s %s", iconString, currencyString) + end + return string.format("%s %s", currencyString, iconString) end function PermoksAccountManager.CurrencyTooltip_OnEnter(button, altData, labelRow) - if not altData.currencyInfo then - return - end + if not altData.currencyInfo then + return + end - local self = PermoksAccountManager - local currencyInfo = altData.currencyInfo[labelRow.key] - local globalCurrencyInfo = self.db.global.currencyInfo[labelRow.key] - if not currencyInfo or not currencyInfo.name then - return - end + local self = PermoksAccountManager + local currencyInfo = altData.currencyInfo[labelRow.key] + local globalCurrencyInfo = self.db.global.currencyInfo[labelRow.key] + if not currencyInfo or not currencyInfo.name or currencyInfo.altQuantity then + -- don't create currency tooltips for the warband column + return + end - local tooltip = LibQTip:Acquire(addonName .. 'Tooltip', 2, 'LEFT', 'RIGHT') - button.tooltip = tooltip + local tooltip = LibQTip:Acquire(addonName .. "Tooltip", 2, "LEFT", "RIGHT") + button.tooltip = tooltip - tooltip:AddHeader(currencyInfo.name) - tooltip:AddLine('') + tooltip:AddHeader(currencyInfo.name) + tooltip:AddLine("") - tooltip:AddLine('Total Earned:', self:CreateFractionString(currencyInfo.totalEarned, globalCurrencyInfo.maxQuantity or currencyInfo.maxQuantity)) + tooltip:AddLine( + "Total Earned:", + self:CreateFractionString(currencyInfo.totalEarned, globalCurrencyInfo.maxQuantity or currencyInfo.maxQuantity) + ) - if ((globalCurrencyInfo.maxQuantity or currencyInfo.maxQuantity) or 0) > currencyInfo.totalEarned then - tooltip:AddLine('Left:', (globalCurrencyInfo.maxQuantity or currencyInfo.maxQuantity) - currencyInfo.totalEarned) - end + if ((globalCurrencyInfo.maxQuantity or currencyInfo.maxQuantity) or 0) > currencyInfo.totalEarned then + tooltip:AddLine( + "Left:", + (globalCurrencyInfo.maxQuantity or currencyInfo.maxQuantity) - currencyInfo.totalEarned + ) + end - tooltip:SmartAnchorTo(button) - tooltip:Show() + tooltip:SmartAnchorTo(button) + tooltip:Show() end do - local torghastSoulCinders = { - [8] = 50, - [9] = 90, - [10] = 120, - [11] = 150, - [12] = 180 - } - - function PermoksAccountManager:SoulCindersTooltip_OnEnter(button, alt_data) - if not alt_data or not alt_data.questInfo or not alt_data.torghastInfo then - return - end - local torghastInfo = alt_data.torghastInfo - local weekly = alt_data.questInfo.weekly - - local assaults = PermoksAccountManager:GetNumCompletedQuests(weekly.hidden.assault) * 50 - local tormentors = min(self:GetNumCompletedQuests(weekly.hidden.tormentors_weekly) * 50, 50) - - local torghast = 0 - for layer, completed in pairs(torghastInfo) do - if torghastSoulCinders[completed] then - torghast = torghast + torghastSoulCinders[completed] - end - end - - local tooltip = LibQTip:Acquire(addonName .. 'Tooltip', 2, 'LEFT', 'RIGHT') - button.tooltip = tooltip - tooltip:AddHeader(alt_data.currencyInfo[1906].name) - tooltip:AddSeparator(2, 1, 1, 1) - tooltip:AddLine('Assaults:', PermoksAccountManager:CreateFractionString(assaults, 100)) - tooltip:AddLine('Tormentors:', PermoksAccountManager:CreateFractionString(tormentors, 50)) - tooltip:AddLine('Torghast:', PermoksAccountManager:CreateFractionString(torghast, 360)) - tooltip:AddSeparator(2, 1, 1, 1) - tooltip:AddLine('|cff00f7ffTotal:|r', PermoksAccountManager:CreateFractionString(assaults + tormentors + torghast, 510)) - tooltip:SmartAnchorTo(button) - tooltip:Show() - end + local torghastSoulCinders = { + [8] = 50, + [9] = 90, + [10] = 120, + [11] = 150, + [12] = 180, + } + + function PermoksAccountManager:SoulCindersTooltip_OnEnter(button, alt_data) + if not alt_data or not alt_data.questInfo or not alt_data.torghastInfo then + return + end + local torghastInfo = alt_data.torghastInfo + local weekly = alt_data.questInfo.weekly + + local assaults = PermoksAccountManager:GetNumCompletedQuests(weekly.hidden.assault) * 50 + local tormentors = min(self:GetNumCompletedQuests(weekly.hidden.tormentors_weekly) * 50, 50) + + local torghast = 0 + for layer, completed in pairs(torghastInfo) do + if torghastSoulCinders[completed] then + torghast = torghast + torghastSoulCinders[completed] + end + end + + local tooltip = LibQTip:Acquire(addonName .. "Tooltip", 2, "LEFT", "RIGHT") + button.tooltip = tooltip + tooltip:AddHeader(alt_data.currencyInfo[1906].name) + tooltip:AddSeparator(2, 1, 1, 1) + tooltip:AddLine("Assaults:", PermoksAccountManager:CreateFractionString(assaults, 100)) + tooltip:AddLine("Tormentors:", PermoksAccountManager:CreateFractionString(tormentors, 50)) + tooltip:AddLine("Torghast:", PermoksAccountManager:CreateFractionString(torghast, 360)) + tooltip:AddSeparator(2, 1, 1, 1) + tooltip:AddLine( + "|cff00f7ffTotal:|r", + PermoksAccountManager:CreateFractionString(assaults + tormentors + torghast, 510) + ) + tooltip:SmartAnchorTo(button) + tooltip:Show() + end end do - local raidBossEmbers = { - [17] = 1, - [14] = 2, - [15] = 3, - [16] = 4 - } - - local function GetEmbersForDifficulty(embersTable, difficulty) - local totalNumEmbers = 0 - for boss, numEmbers in pairs(embersTable) do - if numEmbers >= raidBossEmbers[difficulty] then - totalNumEmbers = totalNumEmbers + 1 - end - end - - return totalNumEmbers - end - - local function GetTotalNumRaidEmbers(embersTable) - local total = 0 - for _, numEmbers in ipairs(embersTable) do - total = total + numEmbers - end - - return total - end - - function PermoksAccountManager:StygianEmbersTooltip_OnEnter(button, alt_data) - if not alt_data or not alt_data.raidActivityInfo or not alt_data.questInfo or not alt_data.questInfo.weekly or not alt_data.questInfo.weekly.visible then - return - end - local raidActivityInfo = alt_data.raidActivityInfo - local questInfo = alt_data.questInfo.weekly - - local embersFromRaidBosses = {} - for i, encounter in ipairs(raidActivityInfo) do - if raidBossEmbers[encounter.bestDifficulty] then - embersFromRaidBosses[encounter.uiOrder] = (embersFromRaidBosses[encounter.uiOrder] or 0) + raidBossEmbers[encounter.bestDifficulty] - end - end - - local embersFromShapingFate = questInfo.visible.korthia_weekly and next(questInfo.visible.korthia_weekly) and 10 or 0 - local embersFromWB = questInfo.hidden.world_boss and questInfo.hidden.world_boss[64531] and 1 or 0 - local embersFromNormalRaidTrash = self:GetNumCompletedQuests(questInfo.hidden.sanctum_normal_embers_trash) - local embersFromHeroicRaidTrash = self:GetNumCompletedQuests(questInfo.hidden.sanctum_heroic_embers_trash) - local total = GetTotalNumRaidEmbers(embersFromRaidBosses) + embersFromShapingFate + embersFromWB + embersFromNormalRaidTrash + embersFromHeroicRaidTrash - - local tooltip = LibQTip:Acquire(addonName .. 'Tooltip', 2, 'LEFT', 'RIGHT') - button.tooltip = tooltip - tooltip:AddHeader(alt_data.currencyInfo[1977].name) - tooltip:AddSeparator(2, 1, 1, 1) - tooltip:AddLine('LFR Raid:', PermoksAccountManager:CreateFractionString(GetEmbersForDifficulty(embersFromRaidBosses, 17), 10)) - tooltip:AddLine('Normal Raid:', PermoksAccountManager:CreateFractionString(GetEmbersForDifficulty(embersFromRaidBosses, 14), 10)) - tooltip:AddLine('Heroic Raid:', PermoksAccountManager:CreateFractionString(GetEmbersForDifficulty(embersFromRaidBosses, 15), 10)) - tooltip:AddLine('Mythic Raid:', PermoksAccountManager:CreateFractionString(GetEmbersForDifficulty(embersFromRaidBosses, 16), 10)) - tooltip:AddSeparator(2, 1, 1, 1) - tooltip:AddLine('Normal Trash:', PermoksAccountManager:CreateFractionString(embersFromNormalRaidTrash, 5)) - tooltip:AddLine('Heroic Trash:', PermoksAccountManager:CreateFractionString(embersFromHeroicRaidTrash, 5)) - tooltip:AddSeparator(2, 1, 1, 1) - tooltip:AddLine('Shaping Fate:', PermoksAccountManager:CreateFractionString(embersFromShapingFate, 10)) - tooltip:AddSeparator(2, 1, 1, 1) - tooltip:AddLine('World Boss:', PermoksAccountManager:CreateFractionString(embersFromWB, 1)) - tooltip:AddSeparator(2, 1, 1, 1) - tooltip:AddLine('|cff00f7ffTotal:|r', PermoksAccountManager:CreateFractionString(total, 61)) - tooltip:SmartAnchorTo(button) - tooltip:Show() - end + local raidBossEmbers = { + [17] = 1, + [14] = 2, + [15] = 3, + [16] = 4, + } + + local function GetEmbersForDifficulty(embersTable, difficulty) + local totalNumEmbers = 0 + for boss, numEmbers in pairs(embersTable) do + if numEmbers >= raidBossEmbers[difficulty] then + totalNumEmbers = totalNumEmbers + 1 + end + end + + return totalNumEmbers + end + + local function GetTotalNumRaidEmbers(embersTable) + local total = 0 + for _, numEmbers in ipairs(embersTable) do + total = total + numEmbers + end + + return total + end + + function PermoksAccountManager:StygianEmbersTooltip_OnEnter(button, alt_data) + if + not alt_data + or not alt_data.raidActivityInfo + or not alt_data.questInfo + or not alt_data.questInfo.weekly + or not alt_data.questInfo.weekly.visible + then + return + end + local raidActivityInfo = alt_data.raidActivityInfo + local questInfo = alt_data.questInfo.weekly + + local embersFromRaidBosses = {} + for i, encounter in ipairs(raidActivityInfo) do + if raidBossEmbers[encounter.bestDifficulty] then + embersFromRaidBosses[encounter.uiOrder] = (embersFromRaidBosses[encounter.uiOrder] or 0) + + raidBossEmbers[encounter.bestDifficulty] + end + end + + local embersFromShapingFate = questInfo.visible.korthia_weekly and next(questInfo.visible.korthia_weekly) and 10 + or 0 + local embersFromWB = questInfo.hidden.world_boss and questInfo.hidden.world_boss[64531] and 1 or 0 + local embersFromNormalRaidTrash = self:GetNumCompletedQuests(questInfo.hidden.sanctum_normal_embers_trash) + local embersFromHeroicRaidTrash = self:GetNumCompletedQuests(questInfo.hidden.sanctum_heroic_embers_trash) + local total = GetTotalNumRaidEmbers(embersFromRaidBosses) + + embersFromShapingFate + + embersFromWB + + embersFromNormalRaidTrash + + embersFromHeroicRaidTrash + + local tooltip = LibQTip:Acquire(addonName .. "Tooltip", 2, "LEFT", "RIGHT") + button.tooltip = tooltip + tooltip:AddHeader(alt_data.currencyInfo[1977].name) + tooltip:AddSeparator(2, 1, 1, 1) + tooltip:AddLine( + "LFR Raid:", + PermoksAccountManager:CreateFractionString(GetEmbersForDifficulty(embersFromRaidBosses, 17), 10) + ) + tooltip:AddLine( + "Normal Raid:", + PermoksAccountManager:CreateFractionString(GetEmbersForDifficulty(embersFromRaidBosses, 14), 10) + ) + tooltip:AddLine( + "Heroic Raid:", + PermoksAccountManager:CreateFractionString(GetEmbersForDifficulty(embersFromRaidBosses, 15), 10) + ) + tooltip:AddLine( + "Mythic Raid:", + PermoksAccountManager:CreateFractionString(GetEmbersForDifficulty(embersFromRaidBosses, 16), 10) + ) + tooltip:AddSeparator(2, 1, 1, 1) + tooltip:AddLine("Normal Trash:", PermoksAccountManager:CreateFractionString(embersFromNormalRaidTrash, 5)) + tooltip:AddLine("Heroic Trash:", PermoksAccountManager:CreateFractionString(embersFromHeroicRaidTrash, 5)) + tooltip:AddSeparator(2, 1, 1, 1) + tooltip:AddLine("Shaping Fate:", PermoksAccountManager:CreateFractionString(embersFromShapingFate, 10)) + tooltip:AddSeparator(2, 1, 1, 1) + tooltip:AddLine("World Boss:", PermoksAccountManager:CreateFractionString(embersFromWB, 1)) + tooltip:AddSeparator(2, 1, 1, 1) + tooltip:AddLine("|cff00f7ffTotal:|r", PermoksAccountManager:CreateFractionString(total, 61)) + tooltip:SmartAnchorTo(button) + tooltip:Show() + end end diff --git a/modules/factions.lua b/modules/factions.lua index 509516d..d033274 100644 --- a/modules/factions.lua +++ b/modules/factions.lua @@ -1,603 +1,1005 @@ local addonName, PermoksAccountManager = ... -local L = LibStub('AceLocale-3.0'):GetLocale(addonName) +local L = LibStub("AceLocale-3.0"):GetLocale(addonName) local FACTION_STANDING_LABEL_CUSTOM = {} local FACTION_BAR_COLORS_CUSTOM = { - [1] = {r = 152, g = 32, b = 32}, - [2] = {r = 222, g = 0, b = 10}, - [3] = {r = 209, g = 102, b = 33}, - [4] = {r = 222, g = 255, b = 10}, - [5] = {r = 7, g = 255, b = 13}, - [6] = {r = 10, g = 222, b = 136}, - [7] = {r = 18, g = 224, b = 204}, - [8] = {r = 5, g = 255, b = 189}, + [1] = { r = 152, g = 32, b = 32 }, + [2] = { r = 222, g = 0, b = 10 }, + [3] = { r = 209, g = 102, b = 33 }, + [4] = { r = 222, g = 255, b = 10 }, + [5] = { r = 7, g = 255, b = 13 }, + [6] = { r = 10, g = 222, b = 136 }, + [7] = { r = 18, g = 224, b = 204 }, + [8] = { r = 5, g = 255, b = 189 }, } do - for standingID, color in pairs(FACTION_BAR_COLORS) do - FACTION_BAR_COLORS_CUSTOM[standingID] = FACTION_BAR_COLORS_CUSTOM[standingID] or {r = color.r * 256, g = color.g * 256, b = color.b * 256} - end - FACTION_BAR_COLORS_CUSTOM[9] = {r = 16, g = 165, b = 202} - - for i = 1, 8 do - FACTION_STANDING_LABEL_CUSTOM[i] = GetText('FACTION_STANDING_LABEL' .. i) - end - FACTION_STANDING_LABEL_CUSTOM[9] = 'Paragon' + for standingID, color in pairs(FACTION_BAR_COLORS) do + FACTION_BAR_COLORS_CUSTOM[standingID] = FACTION_BAR_COLORS_CUSTOM[standingID] + or { r = color.r * 256, g = color.g * 256, b = color.b * 256 } + end + FACTION_BAR_COLORS_CUSTOM[9] = { r = 16, g = 165, b = 202 } + + for i = 1, 8 do + FACTION_STANDING_LABEL_CUSTOM[i] = GetText("FACTION_STANDING_LABEL" .. i) + end + FACTION_STANDING_LABEL_CUSTOM[9] = "Paragon" end local labelRows = { - archivists = { - label = L['Archivists'], - type = 'faction', - key = 2472, - group = 'reputation', - version = WOW_PROJECT_MAINLINE - }, - deaths_advance = { - label = function() - return PermoksAccountManager.factions[2470].localName or L["Death's Advance"] - end, - type = 'faction', - key = 2470, - group = 'reputation', - version = WOW_PROJECT_MAINLINE - }, - venari = { - label = function() - return PermoksAccountManager.factions[2432].localName or L["Ve'nari"] - end, - type = 'faction', - key = 2432, - group = 'reputation', - version = WOW_PROJECT_MAINLINE - }, - ascended = { - label = function() - return PermoksAccountManager.factions[2407].localName or L['Ascended'] - end, - type = 'faction', - key = 2407, - group = 'reputation', - version = WOW_PROJECT_MAINLINE - }, - wild_hunt = { - label = function() - return PermoksAccountManager.factions[2465].localName or L['Wild Hunt'] - end, - type = 'faction', - key = 2465, - group = 'reputation', - version = WOW_PROJECT_MAINLINE - }, - undying_army = { - label = function() - return PermoksAccountManager.factions[2410].localName or L['Undying Army'] - end, - type = 'faction', - key = 2410, - group = 'reputation' - }, - court_of_harvesters = { - label = function() - return PermoksAccountManager.factions[2413].localName or L['Court of Harvesters'] - end, - type = 'faction', - key = 2413, - group = 'reputation', - version = WOW_PROJECT_MAINLINE - }, - the_enlightened = { - label = function() - return PermoksAccountManager.factions[2478].localName or L['The Enlightened'] - end, - type = 'faction', - key = 2478, - group = 'reputation', - version = WOW_PROJECT_MAINLINE - }, - dragonscale_expedition = { - label = function() - return PermoksAccountManager.factions[2507].localName or 'Expedition' - end, - type = 'faction', - key = 2507, - group = 'reputation', - version = WOW_PROJECT_MAINLINE - }, - iskaara_tuskar = { - label = function() - return PermoksAccountManager.factions[2511].localName or 'Iskaara Tuskar' - end, - type = 'faction', - key = 2511, - group = 'reputation', - version = WOW_PROJECT_MAINLINE - }, - maruuk_centaur = { - label = function() - return PermoksAccountManager.factions[2503].localName or 'Maruuk Centaur' - end, - type = 'faction', - key = 2503, - group = 'reputation', - version = WOW_PROJECT_MAINLINE - }, - valdrakken_akkord = { - label = function() - return PermoksAccountManager.factions[2510].localName or 'Valdrakken Akkord' - end, - type = 'faction', - key = 2510, - group = 'reputation', - version = WOW_PROJECT_MAINLINE - }, - winterpelt_furbolg = { - label = function() - return PermoksAccountManager.factions[2526].localName or 'Winterpelt Furbolg' - end, - type = 'faction', - key = 2526, - group = 'reputation', - version = WOW_PROJECT_MAINLINE - }, - artisan_consortium = { - label = function() - return PermoksAccountManager.factions[2544].localName or "Artisan's Consortium" - end, - type = 'faction', - key = 2544, - group = 'reputation', - version = WOW_PROJECT_MAINLINE - }, - cobalt_assembly = { - label = function() - return PermoksAccountManager.factions[2550].localName or "Cobalt Assembly" - end, - type = 'faction', - key = 2550, - group = 'reputation', - version = WOW_PROJECT_MAINLINE - }, - sabellian = { - label = function() - return PermoksAccountManager.factions[2518].localName or 'Sabellian' - end, - type = 'faction', - key = 2518, - group = 'reputation', - version = WOW_PROJECT_MAINLINE - }, - wrathion = { - label = function() - return PermoksAccountManager.factions[2517].localName or 'Wrathion' - end, - type = 'faction', - key = 2517, - group = 'reputation', - version = WOW_PROJECT_MAINLINE - }, - loam_niffen = { - label = function() - return PermoksAccountManager.factions[2564].localName or 'Loam Niffen' - end, - type = 'faction', - key = 2564, - group = 'reputation', - version = WOW_PROJECT_MAINLINE - }, - dream_wardens = { - label = function() - return PermoksAccountManager.factions[2574].localName or 'Dream Wardens' - end, - type = 'faction', - key = 2574, - group = 'reputation', - version = WOW_PROJECT_MAINLINE - }, - soridormi = { - label = function() - return PermoksAccountManager.factions[2553].localName or 'Soridormi' - end, - type = 'faction', - key = 2553, - group = 'reputation', - version = WOW_PROJECT_MAINLINE - }, - keg_legs_crew = { - label = function() - return PermoksAccountManager.factions[2593].localName or 'Keg Leg\'s Crew' - end, - type = 'faction', - key = 2593, - group = 'reputation', - version = WOW_PROJECT_MAINLINE - }, - - - -- wotlk - alliance_vanguard = { - label = function() - local factionInfo = PermoksAccountManager.factions[1037] - return factionInfo.localName or factionInfo.name - end, - key = 1037, - type = 'faction', - version = WOW_PROJECT_CATACLYSM_CLASSIC, - group = 'reputation' - }, - valiance_expedition = { - label = function() - local factionInfo = PermoksAccountManager.factions[1050] - return factionInfo.localName or factionInfo.name - end, - key = 1050, - type = 'faction', - version = WOW_PROJECT_CATACLYSM_CLASSIC, - group = 'reputation' - }, - horde_expedition = { - label = function() - local factionInfo = PermoksAccountManager.factions[1052] - return factionInfo.localName or factionInfo.name - end, - key = 1052, - type = 'faction', - version = WOW_PROJECT_CATACLYSM_CLASSIC, - group = 'reputation' - }, - the_taunka = { - label = function() - local factionInfo = PermoksAccountManager.factions[1064] - return factionInfo.localName or factionInfo.name - end, - key = 1064, - type = 'faction', - version = WOW_PROJECT_CATACLYSM_CLASSIC, - group = 'reputation' - }, - the_hand_of_vengeance = { - label = function() - local factionInfo = PermoksAccountManager.factions[1067] - return factionInfo.localName or factionInfo.name - end, - key = 1067, - type = 'faction', - version = WOW_PROJECT_CATACLYSM_CLASSIC, - group = 'reputation' - }, - explorers_league = { - label = function() - local factionInfo = PermoksAccountManager.factions[1068] - return factionInfo.localName or factionInfo.name - end, - key = 1068, - type = 'faction', - version = WOW_PROJECT_CATACLYSM_CLASSIC, - group = 'reputation' - }, - the_kaluak = { - label = function() - local factionInfo = PermoksAccountManager.factions[1073] - return factionInfo.localName or factionInfo.name - end, - key = 1073, - type = 'faction', - version = WOW_PROJECT_CATACLYSM_CLASSIC, - group = 'reputation' - }, - warsong_offensive = { - label = function() - local factionInfo = PermoksAccountManager.factions[1085] - return factionInfo.localName or factionInfo.name - end, - key = 1085, - type = 'faction', - version = WOW_PROJECT_CATACLYSM_CLASSIC, - group = 'reputation' - }, - kirin_tor = { - label = function() - local factionInfo = PermoksAccountManager.factions[1090] - return factionInfo.localName or factionInfo.name - end, - key = 1090, - type = 'faction', - version = WOW_PROJECT_CATACLYSM_CLASSIC, - group = 'reputation' - }, - the_wyrmrest_accord = { - label = function() - local factionInfo = PermoksAccountManager.factions[1091] - return factionInfo.localName or factionInfo.name - end, - key = 1091, - type = 'faction', - version = WOW_PROJECT_CATACLYSM_CLASSIC, - group = 'reputation' - }, - the_silver_covenant = { - label = function() - local factionInfo = PermoksAccountManager.factions[1094] - return factionInfo.localName or factionInfo.name - end, - key = 1094, - type = 'faction', - version = WOW_PROJECT_CATACLYSM_CLASSIC, - group = 'reputation' - }, - knights_of_the_ebon_blade = { - label = function() - local factionInfo = PermoksAccountManager.factions[1098] - return factionInfo.localName or factionInfo.name - end, - key = 1098, - type = 'faction', - version = WOW_PROJECT_CATACLYSM_CLASSIC, - group = 'reputation' - }, - frenzyheart_tribe = { - label = function() - local factionInfo = PermoksAccountManager.factions[1104] - return factionInfo.localName or factionInfo.name - end, - key = 1104, - type = 'faction', - version = WOW_PROJECT_CATACLYSM_CLASSIC, - group = 'reputation' - }, - the_oracles = { - label = function() - local factionInfo = PermoksAccountManager.factions[1105] - return factionInfo.localName or factionInfo.name - end, - key = 1105, - type = 'faction', - version = WOW_PROJECT_CATACLYSM_CLASSIC, - group = 'reputation' - }, - argent_crusade = { - label = function() - local factionInfo = PermoksAccountManager.factions[1106] - return factionInfo.localName or factionInfo.name - end, - key = 1106, - type = 'faction', - version = WOW_PROJECT_CATACLYSM_CLASSIC, - group = 'reputation' - }, - the_sons_of_hodir = { - label = function() - local factionInfo = PermoksAccountManager.factions[1119] - return factionInfo.localName or factionInfo.name - end, - key = 1119, - type = 'faction', - version = WOW_PROJECT_CATACLYSM_CLASSIC, - group = 'reputation' - }, - the_sunreavers = { - label = function() - local factionInfo = PermoksAccountManager.factions[1124] - return factionInfo.localName or factionInfo.name - end, - key = 1124, - type = 'faction', - version = WOW_PROJECT_CATACLYSM_CLASSIC, - group = 'reputation' - }, - the_frostborn = { - label = function() - local factionInfo = PermoksAccountManager.factions[1126] - return factionInfo.localName or factionInfo.name - end, - key = 1126, - type = 'faction', - version = WOW_PROJECT_CATACLYSM_CLASSIC, - group = 'reputation' - }, + archivists = { + label = L["Archivists"], + type = "faction", + key = 2472, + group = "reputation", + version = WOW_PROJECT_MAINLINE, + }, + deaths_advance = { + label = function() + return PermoksAccountManager.factions[2470].localName or L["Death's Advance"] + end, + type = "faction", + key = 2470, + group = "reputation", + version = WOW_PROJECT_MAINLINE, + }, + venari = { + label = function() + return PermoksAccountManager.factions[2432].localName or L["Ve'nari"] + end, + type = "faction", + key = 2432, + group = "reputation", + version = WOW_PROJECT_MAINLINE, + }, + ascended = { + label = function() + return PermoksAccountManager.factions[2407].localName or L["Ascended"] + end, + type = "faction", + key = 2407, + group = "reputation", + version = WOW_PROJECT_MAINLINE, + }, + wild_hunt = { + label = function() + return PermoksAccountManager.factions[2465].localName or L["Wild Hunt"] + end, + type = "faction", + key = 2465, + group = "reputation", + version = WOW_PROJECT_MAINLINE, + }, + undying_army = { + label = function() + return PermoksAccountManager.factions[2410].localName or L["Undying Army"] + end, + type = "faction", + key = 2410, + group = "reputation", + }, + court_of_harvesters = { + label = function() + return PermoksAccountManager.factions[2413].localName or L["Court of Harvesters"] + end, + type = "faction", + key = 2413, + group = "reputation", + version = WOW_PROJECT_MAINLINE, + }, + the_enlightened = { + label = function() + return PermoksAccountManager.factions[2478].localName or L["The Enlightened"] + end, + type = "faction", + key = 2478, + group = "reputation", + version = WOW_PROJECT_MAINLINE, + }, + dragonscale_expedition = { + label = function() + return PermoksAccountManager.factions[2507].localName or "Expedition" + end, + type = "faction", + warband = "unique", + key = 2507, + group = "reputation", + version = WOW_PROJECT_MAINLINE, + }, + iskaara_tuskar = { + label = function() + return PermoksAccountManager.factions[2511].localName or "Iskaara Tuskar" + end, + type = "faction", + warband = "unique", + key = 2511, + group = "reputation", + version = WOW_PROJECT_MAINLINE, + }, + maruuk_centaur = { + label = function() + return PermoksAccountManager.factions[2503].localName or "Maruuk Centaur" + end, + type = "faction", + warband = "unique", + key = 2503, + group = "reputation", + version = WOW_PROJECT_MAINLINE, + }, + valdrakken_akkord = { + label = function() + return PermoksAccountManager.factions[2510].localName or "Valdrakken Akkord" + end, + type = "faction", + warband = "unique", + key = 2510, + group = "reputation", + version = WOW_PROJECT_MAINLINE, + }, + winterpelt_furbolg = { + label = function() + return PermoksAccountManager.factions[2526].localName or "Winterpelt Furbolg" + end, + type = "faction", + key = 2526, + group = "reputation", + version = WOW_PROJECT_MAINLINE, + }, + artisan_consortium = { + label = function() + return PermoksAccountManager.factions[2544].localName or "Artisan's Consortium" + end, + type = "faction", + warband = "unique", + key = 2544, + group = "reputation", + version = WOW_PROJECT_MAINLINE, + }, + cobalt_assembly = { + label = function() + return PermoksAccountManager.factions[2550].localName or "Cobalt Assembly" + end, + type = "faction", + warband = "unique", + key = 2550, + group = "reputation", + version = WOW_PROJECT_MAINLINE, + }, + sabellian = { + label = function() + return PermoksAccountManager.factions[2518].localName or "Sabellian" + end, + type = "faction", + warband = "unique", + key = 2518, + group = "reputation", + version = WOW_PROJECT_MAINLINE, + }, + wrathion = { + label = function() + return PermoksAccountManager.factions[2517].localName or "Wrathion" + end, + type = "faction", + warband = "unique", + key = 2517, + group = "reputation", + version = WOW_PROJECT_MAINLINE, + }, + loam_niffen = { + label = function() + return PermoksAccountManager.factions[2564].localName or "Loam Niffen" + end, + type = "faction", + warband = "unique", + key = 2564, + group = "reputation", + version = WOW_PROJECT_MAINLINE, + }, + dream_wardens = { + label = function() + return PermoksAccountManager.factions[2574].localName or "Dream Wardens" + end, + type = "faction", + warband = "unique", + key = 2574, + group = "reputation", + version = WOW_PROJECT_MAINLINE, + }, + soridormi = { + label = function() + return PermoksAccountManager.factions[2553].localName or "Soridormi" + end, + type = "faction", + warband = "unique", + key = 2553, + group = "reputation", + version = WOW_PROJECT_MAINLINE, + }, + keg_legs_crew = { + label = function() + return PermoksAccountManager.factions[2593].localName or "Keg Leg's Crew" + end, + type = "faction", + warband = "unique", + key = 2593, + group = "reputation", + version = WOW_PROJECT_MAINLINE, + }, + + -- 11.0 + council_of_dornogal = { + label = function() + return PermoksAccountManager.factions[2590].localName or "Council of Dornogal" + end, + type = "faction", + warband = "unique", + key = 2590, + group = "reputation", + version = WOW_PROJECT_MAINLINE, + }, + hallowfall_arathi = { + label = function() + return PermoksAccountManager.factions[2570].localName or "Hallowfall Arathi" + end, + type = "faction", + warband = "unique", + key = 2570, + group = "reputation", + version = WOW_PROJECT_MAINLINE, + }, + the_assembly_of_the_deeps = { + label = function() + return PermoksAccountManager.factions[2594].localName or "The Assembly of the Deeps" + end, + type = "faction", + warband = "unique", + key = 2594, + group = "reputation", + version = WOW_PROJECT_MAINLINE, + }, + the_severed_threads = { + label = function() + return PermoksAccountManager.factions[2600].localName or "The Severed Threads" + end, + type = "faction", + warband = "unique", + key = 2600, + group = "reputation", + version = WOW_PROJECT_MAINLINE, + }, + the_general = { + label = function() + return PermoksAccountManager.factions[2605].localName or "The General" + end, + type = "faction", + warband = "unique", + key = 2605, + group = "reputation", + version = WOW_PROJECT_MAINLINE, + }, + the_vizier = { + label = function() + return PermoksAccountManager.factions[2607].localName or "The Vizier" + end, + type = "faction", + warband = "unique", + key = 2607, + group = "reputation", + version = WOW_PROJECT_MAINLINE, + }, + the_weaver = { + label = function() + return PermoksAccountManager.factions[2601].localName or "The Weaver" + end, + type = "faction", + warband = "unique", + key = 2601, + group = "reputation", + version = WOW_PROJECT_MAINLINE, + }, + brann_bronzebeard = { + label = function() + return PermoksAccountManager.factions[2640].localName or "Brann Bronzebeard" + end, + type = "faction", + warband = "unique", + key = 2640, + group = "reputation", + version = WOW_PROJECT_MAINLINE, + }, + + -- 11.1 + the_cartels_of_undermine = { + label = function() + return PermoksAccountManager.factions[2653].localName or "Cartels Undermine" + end, + type = "faction", + warband = "unique", + key = 2653, + group = "reputation", + version = WOW_PROJECT_MAINLINE, + }, + bilgewater_cartel = { + label = function() + return PermoksAccountManager.factions[2673].localName or "Bilgewater" + end, + type = "faction", + warband = "unique", + key = 2673, + group = "reputation", + version = WOW_PROJECT_MAINLINE, + }, + blackwater_cartel = { + label = function() + return PermoksAccountManager.factions[2675].localName or "Blackwater" + end, + type = "faction", + warband = "unique", + key = 2675, + group = "reputation", + version = WOW_PROJECT_MAINLINE, + }, + steamwheedle_cartel = { + label = function() + return PermoksAccountManager.factions[2677].localName or "Steamwheedle" + end, + type = "faction", + warband = "unique", + key = 2677, + group = "reputation", + version = WOW_PROJECT_MAINLINE, + }, + venture_company = { + label = function() + return PermoksAccountManager.factions[2671].localName or "Venture Company" + end, + type = "faction", + warband = "unique", + key = 2671, + group = "reputation", + version = WOW_PROJECT_MAINLINE, + }, + gallagio_loyalty_rewards_club = { + label = function() + return PermoksAccountManager.factions[2685].localName or "Gallagio" + end, + type = "faction", + warband = "unique", + key = 2685, + group = "reputation", + version = WOW_PROJECT_MAINLINE, + }, + darkfuse_solutions = { + label = function() + return PermoksAccountManager.factions[2669].localName or "Darkfuse Solutions" + end, + type = "faction", + warband = "unique", + key = 2669, + group = "reputation", + version = WOW_PROJECT_MAINLINE, + }, + flames_radiance = { + label = function() + return PermoksAccountManager.factions[2688].localName or "Flame's Radiance" + end, + type = "faction", + warband = "unique", + key = 2688, + group = "reputation", + version = WOW_PROJECT_MAINLINE, + }, + + -- 11.2 + the_karesh_trust = { + label = function() + return PermoksAccountManager.factions[2658].localName or "Manaforge Vandals" + end, + type = "faction", + warband = "unique", + key = 2658, + group = "reputation", + version = WOW_PROJECT_MAINLINE + }, + manaforge_vandals = { + label = function() + return PermoksAccountManager.factions[2736].localName or "Manaforge Vandals" + end, + type = "faction", + warband = "unique", + key = 2736, + group = "reputation", + version = WOW_PROJECT_MAINLINE + }, + + -- 12.0 + silvermoon_court = { + label = function() + return PermoksAccountManager.factions[2710].localName or "Silvermoon Court" + end, + type = "faction", + warband = "unique", + key = 2710, + group = "reputation", + version = WOW_PROJECT_MAINLINE + }, + the_singularity = { + label = function() + return PermoksAccountManager.factions[2699].localName or "The Singularity" + end, + type = "faction", + warband = "unique", + key = 2699, + group = "reputation", + version = WOW_PROJECT_MAINLINE + }, + harati = { + label = function() + return PermoksAccountManager.factions[2704].localName or "Hara'ti" + end, + type = "faction", + warband = "unique", + key = 2704, + group = "reputation", + version = WOW_PROJECT_MAINLINE + }, + amani_tribe = { + label = function() + return PermoksAccountManager.factions[2696].localName or "Amani Tribe" + end, + type = "faction", + warband = "unique", + key = 2696, + group = "reputation", + version = WOW_PROJECT_MAINLINE + }, + + -- wotlk + alliance_vanguard = { + label = function() + local factionInfo = PermoksAccountManager.factions[1037] + return factionInfo.localName or factionInfo.name + end, + key = 1037, + type = "faction", + version = WOW_PROJECT_CATACLYSM_CLASSIC, + group = "reputation", + }, + valiance_expedition = { + label = function() + local factionInfo = PermoksAccountManager.factions[1050] + return factionInfo.localName or factionInfo.name + end, + key = 1050, + type = "faction", + version = WOW_PROJECT_CATACLYSM_CLASSIC, + group = "reputation", + }, + horde_expedition = { + label = function() + local factionInfo = PermoksAccountManager.factions[1052] + return factionInfo.localName or factionInfo.name + end, + key = 1052, + type = "faction", + version = WOW_PROJECT_CATACLYSM_CLASSIC, + group = "reputation", + }, + the_taunka = { + label = function() + local factionInfo = PermoksAccountManager.factions[1064] + return factionInfo.localName or factionInfo.name + end, + key = 1064, + type = "faction", + version = WOW_PROJECT_CATACLYSM_CLASSIC, + group = "reputation", + }, + the_hand_of_vengeance = { + label = function() + local factionInfo = PermoksAccountManager.factions[1067] + return factionInfo.localName or factionInfo.name + end, + key = 1067, + type = "faction", + version = WOW_PROJECT_CATACLYSM_CLASSIC, + group = "reputation", + }, + explorers_league = { + label = function() + local factionInfo = PermoksAccountManager.factions[1068] + return factionInfo.localName or factionInfo.name + end, + key = 1068, + type = "faction", + version = WOW_PROJECT_CATACLYSM_CLASSIC, + group = "reputation", + }, + the_kaluak = { + label = function() + local factionInfo = PermoksAccountManager.factions[1073] + return factionInfo.localName or factionInfo.name + end, + key = 1073, + type = "faction", + version = WOW_PROJECT_CATACLYSM_CLASSIC, + group = "reputation", + }, + warsong_offensive = { + label = function() + local factionInfo = PermoksAccountManager.factions[1085] + return factionInfo.localName or factionInfo.name + end, + key = 1085, + type = "faction", + version = WOW_PROJECT_CATACLYSM_CLASSIC, + group = "reputation", + }, + kirin_tor = { + label = function() + local factionInfo = PermoksAccountManager.factions[1090] + return factionInfo.localName or factionInfo.name + end, + key = 1090, + type = "faction", + version = WOW_PROJECT_CATACLYSM_CLASSIC, + group = "reputation", + }, + the_wyrmrest_accord = { + label = function() + local factionInfo = PermoksAccountManager.factions[1091] + return factionInfo.localName or factionInfo.name + end, + key = 1091, + type = "faction", + version = WOW_PROJECT_CATACLYSM_CLASSIC, + group = "reputation", + }, + the_silver_covenant = { + label = function() + local factionInfo = PermoksAccountManager.factions[1094] + return factionInfo.localName or factionInfo.name + end, + key = 1094, + type = "faction", + version = WOW_PROJECT_CATACLYSM_CLASSIC, + group = "reputation", + }, + knights_of_the_ebon_blade = { + label = function() + local factionInfo = PermoksAccountManager.factions[1098] + return factionInfo.localName or factionInfo.name + end, + key = 1098, + type = "faction", + version = WOW_PROJECT_CATACLYSM_CLASSIC, + group = "reputation", + }, + frenzyheart_tribe = { + label = function() + local factionInfo = PermoksAccountManager.factions[1104] + return factionInfo.localName or factionInfo.name + end, + key = 1104, + type = "faction", + version = WOW_PROJECT_CATACLYSM_CLASSIC, + group = "reputation", + }, + the_oracles = { + label = function() + local factionInfo = PermoksAccountManager.factions[1105] + return factionInfo.localName or factionInfo.name + end, + key = 1105, + type = "faction", + version = WOW_PROJECT_CATACLYSM_CLASSIC, + group = "reputation", + }, + argent_crusade = { + label = function() + local factionInfo = PermoksAccountManager.factions[1106] + return factionInfo.localName or factionInfo.name + end, + key = 1106, + type = "faction", + version = WOW_PROJECT_CATACLYSM_CLASSIC, + group = "reputation", + }, + the_sons_of_hodir = { + label = function() + local factionInfo = PermoksAccountManager.factions[1119] + return factionInfo.localName or factionInfo.name + end, + key = 1119, + type = "faction", + version = WOW_PROJECT_CATACLYSM_CLASSIC, + group = "reputation", + }, + the_sunreavers = { + label = function() + local factionInfo = PermoksAccountManager.factions[1124] + return factionInfo.localName or factionInfo.name + end, + key = 1124, + type = "faction", + version = WOW_PROJECT_CATACLYSM_CLASSIC, + group = "reputation", + }, + the_frostborn = { + label = function() + local factionInfo = PermoksAccountManager.factions[1126] + return factionInfo.localName or factionInfo.name + end, + key = 1126, + type = "faction", + version = WOW_PROJECT_CATACLYSM_CLASSIC, + group = "reputation", + }, the_ashen_verdict = { - label = function() - local factionInfo = PermoksAccountManager.factions[1156] - return factionInfo.localName or factionInfo.name - end, - key = 1156, - type = 'faction', - version = WOW_PROJECT_CATACLYSM_CLASSIC, - group = 'reputation' - }, - - the_earthen_ring = { - label = function() - local factionInfo = PermoksAccountManager.factions[1135] - return factionInfo.localName or factionInfo.name - end, - key = 1135, - type = 'faction', - version = WOW_PROJECT_CATACLYSM_CLASSIC, - group = 'reputation' - }, - therazane = { - label = function() - local factionInfo = PermoksAccountManager.factions[1171] - return factionInfo.localName or factionInfo.name - end, - key = 1171, - type = 'faction', - version = WOW_PROJECT_CATACLYSM_CLASSIC, - group = 'reputation' - }, - guardians_of_hyjal = { - label = function() - local factionInfo = PermoksAccountManager.factions[1158] - return factionInfo.localName or factionInfo.name - end, - key = 1158, - type = 'faction', - version = WOW_PROJECT_CATACLYSM_CLASSIC, - group = 'reputation' - }, - dragonmaw_clan = { - label = function() - local factionInfo = PermoksAccountManager.factions[1172] - return factionInfo.localName or factionInfo.name - end, - key = 1172, - type = 'faction', - version = WOW_PROJECT_CATACLYSM_CLASSIC, - group = 'reputation' - }, - ramkahen = { - label = function() - local factionInfo = PermoksAccountManager.factions[1173] - return factionInfo.localName or factionInfo.name - end, - key = 1173, - type = 'faction', - version = WOW_PROJECT_CATACLYSM_CLASSIC, - group = 'reputation' - }, - wildhammer_clan = { - label = function() - local factionInfo = PermoksAccountManager.factions[1174] - return factionInfo.localName or factionInfo.name - end, - key = 1174, - type = 'faction', - version = WOW_PROJECT_CATACLYSM_CLASSIC, - group = 'reputation' - }, - hellscreams_reach = { - label = function() - local factionInfo = PermoksAccountManager.factions[1178] - return factionInfo.localName or factionInfo.name - end, - key = 1178, - type = 'faction', - version = WOW_PROJECT_CATACLYSM_CLASSIC, - group = 'reputation' - }, - baradins_warden = { - label = function() - local factionInfo = PermoksAccountManager.factions[1177] - return factionInfo.localName or factionInfo.name - end, - key = 1177, - type = 'faction', - version = WOW_PROJECT_CATACLYSM_CLASSIC, - group = 'reputation' - }, + label = function() + local factionInfo = PermoksAccountManager.factions[1156] + return factionInfo.localName or factionInfo.name + end, + key = 1156, + type = "faction", + version = WOW_PROJECT_CATACLYSM_CLASSIC, + group = "reputation", + }, + + the_earthen_ring = { + label = function() + local factionInfo = PermoksAccountManager.factions[1135] + return factionInfo.localName or factionInfo.name + end, + key = 1135, + type = "faction", + version = WOW_PROJECT_CATACLYSM_CLASSIC, + group = "reputation", + }, + therazane = { + label = function() + local factionInfo = PermoksAccountManager.factions[1171] + return factionInfo.localName or factionInfo.name + end, + key = 1171, + type = "faction", + version = WOW_PROJECT_CATACLYSM_CLASSIC, + group = "reputation", + }, + guardians_of_hyjal = { + label = function() + local factionInfo = PermoksAccountManager.factions[1158] + return factionInfo.localName or factionInfo.name + end, + key = 1158, + type = "faction", + version = WOW_PROJECT_CATACLYSM_CLASSIC, + group = "reputation", + }, + dragonmaw_clan = { + label = function() + local factionInfo = PermoksAccountManager.factions[1172] + return factionInfo.localName or factionInfo.name + end, + key = 1172, + type = "faction", + version = WOW_PROJECT_CATACLYSM_CLASSIC, + group = "reputation", + }, + ramkahen = { + label = function() + local factionInfo = PermoksAccountManager.factions[1173] + return factionInfo.localName or factionInfo.name + end, + key = 1173, + type = "faction", + version = WOW_PROJECT_CATACLYSM_CLASSIC, + group = "reputation", + }, + wildhammer_clan = { + label = function() + local factionInfo = PermoksAccountManager.factions[1174] + return factionInfo.localName or factionInfo.name + end, + key = 1174, + type = "faction", + version = WOW_PROJECT_CATACLYSM_CLASSIC, + group = "reputation", + }, + hellscreams_reach = { + label = function() + local factionInfo = PermoksAccountManager.factions[1178] + return factionInfo.localName or factionInfo.name + end, + key = 1178, + type = "faction", + version = WOW_PROJECT_CATACLYSM_CLASSIC, + group = "reputation", + }, + baradins_warden = { + label = function() + local factionInfo = PermoksAccountManager.factions[1177] + return factionInfo.localName or factionInfo.name + end, + key = 1177, + type = "faction", + version = WOW_PROJECT_CATACLYSM_CLASSIC, + group = "reputation", + }, + + -- Mists + golden_lotus = { + label = function() + local factionInfo = PermoksAccountManager.factions[1269] + return factionInfo.localName or factionInfo.name + end, + key = 1269, + type = "faction", + version = WOW_PROJECT_MISTS_CLASSIC, + group = "reputation", + }, + shado_pan = { + label = function() + local factionInfo = PermoksAccountManager.factions[1270] + return factionInfo.localName or factionInfo.name + end, + key = 1270, + type = "faction", + version = WOW_PROJECT_MISTS_CLASSIC, + group = "reputation", + }, + the_august_celestials = { + label = function() + local factionInfo = PermoksAccountManager.factions[1341] + return factionInfo.localName or factionInfo.name + end, + key = 1341, + type = "faction", + version = WOW_PROJECT_MISTS_CLASSIC, + group = "reputation", + }, + the_black_prince = { + label = function() + local factionInfo = PermoksAccountManager.factions[1359] + return factionInfo.localName or factionInfo.name + end, + key = 1359, + type = "faction", + version = WOW_PROJECT_MISTS_CLASSIC, + group = "reputation", + }, + the_klaxxi = { + label = function() + local factionInfo = PermoksAccountManager.factions[1337] + return factionInfo.localName or factionInfo.name + end, + key = 1337, + type = "faction", + version = WOW_PROJECT_MISTS_CLASSIC, + group = "reputation", + }, + the_anglers = { + label = function() + local factionInfo = PermoksAccountManager.factions[1302] + return factionInfo.localName or factionInfo.name + end, + key = 1302, + type = "faction", + version = WOW_PROJECT_MISTS_CLASSIC, + group = "reputation", + }, + the_tillers = { + label = function() + local factionInfo = PermoksAccountManager.factions[1272] + return factionInfo.localName or factionInfo.name + end, + key = 1272, + type = "faction", + version = WOW_PROJECT_MISTS_CLASSIC, + group = "reputation", + }, +} + +local friendshipStandings = { + -- Ve'nari + ["Dubious"] = "1/6", + ["Apprehensive"] = "2/6", + ["Tentative"] = "3/6", + ["Ambivalent"] = "4/6", + ["Cordial"] = "5/6", + ["Appreciative"] = "6/6", + + -- Black Dragons / Severed Threads Leaders + ["Stranger"] = "1/9", + ["Acquaintance"] = "2/9", + ["Crony"] = "3/9", + ["Accomplice"] = "4/9", + ["Collaborator"] = "5/9", + ["Accessory"] = "6/9", + ["Abettor"] = "7/9", + ["Conspirator"] = "8/9", + ["Mastermind"] = "9/9", + + -- Archivists + ["Tier 1"] = "1/6", + ["Tier 2"] = "2/6", + ["Tier 3"] = "3/6", + ["Tier 4"] = "4/6", + ["Tier 5"] = "5/6", + ["Tier 6"] = "6/6", + + -- Consortium + ["Neutral"] = "1/5", + ["Preferred"] = "2/5", + ["Respected"] = "3/5", + ["Valued"] = "4/5", + ["Esteemed"] = "5/5", + + -- Soridormi + ["Anomaly"] = "1/5", + ["Future Friend"] = "2/5", + ["Rift-Mender"] = "3/5", + ["Timewalker"] = "4/5", + ["Legend"] = "5/5", + + -- Cobalt Assembly + ["Empty"] = "1/5", + ["Low"] = "2/5", + ["Medium"] = "3/5", + ["High"] = "4/5", + ["Maximum"] = "5/5", } local GetFriendshipReputation = C_GossipInfo and C_GossipInfo.GetFriendshipReputation or GetFriendshipReputation --TODO: Rework after DF launch local function GetFactionOrFriendshipInfo(factionId, factionType) - local hasReward, renown - local name, _, standing, barMin, barMax, barValue - if C_Reputation and C_Reputation.GetFactionDataByID then - local factionData = C_Reputation.GetFactionDataByID(factionId) - name = factionData.name - standing = factionData.reaction - barMin = factionData.currentReactionThreshold - barMax = factionData.nextReactionThreshold - barValue = factionData.currentStanding - else - name, _, standing, barMin, barMax, barValue = GetFactionInfoByID(factionId) - end - local isParagon = C_Reputation.IsFactionParagon(factionId) - - if isParagon then - barValue, barMax, _, hasReward = C_Reputation.GetFactionParagonInfo(factionId) - barMin, standing, barValue = 0, 9, barValue % barMax - elseif factionType == 'renown' then - renown = C_MajorFactions.GetCurrentRenownLevel(factionId) - local majorFactionInfo = C_MajorFactions.GetMajorFactionData(factionId) - if majorFactionInfo then - barMin = 0 - barValue = majorFactionInfo.renownReputationEarned - barMax = majorFactionInfo.renownLevelThreshold - end - elseif factionType == 'friend' then - local friendshipInfo = C_GossipInfo.GetFriendshipReputation(factionId) - if friendshipInfo then - barMin = friendshipInfo.reactionThreshold - barValue = friendshipInfo.standing - barMax = friendshipInfo.nextThreshold or friendshipInfo.reactionThreshold - standing = friendshipInfo.reaction - end - end - - if not barMax or not barMin then - return - end - - return barValue - barMin, (barMax - barMin), standing, name, hasReward, renown + local barMin, barMax, barValue = 0, 0, 0 + local hasReward, renown, name, _, standing + if C_Reputation and C_Reputation.GetFactionDataByID then + local factionData = C_Reputation.GetFactionDataByID(factionId) + if factionData then + name = factionData.name + standing = factionData.reaction + barMin = factionData.currentReactionThreshold + barMax = factionData.nextReactionThreshold + barValue = factionData.currentStanding + end + else + name, _, standing, barMin, barMax, barValue = GetFactionInfoByID(factionId) + end + local isParagon = C_Reputation.IsFactionParagon and C_Reputation.IsFactionParagon(factionId) + + --if isParagon then + -- barValue, barMax, _, hasReward = C_Reputation.GetFactionParagonInfo(factionId) + -- barMin, standing, barValue = 0, 9, barValue % barMax + --elseif factionType == "renown" then + if factionType == "renown" then + renown = C_MajorFactions.GetCurrentRenownLevel(factionId) + local majorFactionInfo = C_MajorFactions.GetMajorFactionData(factionId) + if majorFactionInfo then + barMin = 0 + barValue = majorFactionInfo.renownReputationEarned + barMax = majorFactionInfo.renownLevelThreshold + end + elseif factionType == "friend" then + local friendshipInfo = C_GossipInfo.GetFriendshipReputation(factionId) + if friendshipInfo then + barMin = friendshipInfo.reactionThreshold + barValue = friendshipInfo.standing + barMax = friendshipInfo.nextThreshold or friendshipInfo.reactionThreshold + standing = friendshipInfo.reaction + end + end + + if not barMax or not barMin then + return + end + + return barValue - barMin, (barMax - barMin), standing, name, hasReward, renown +end + +local function UpdateFaction(factionTable, factionId, standing, current, maximum, info, hasReward, renown) + factionTable[factionId] = factionTable[factionId] or {} + local faction = factionTable[factionId] + faction.standing = standing + faction.current = current + faction.max = maximum + faction.type = info.type + faction.hasReward = hasReward + faction.renown = renown + faction.exalted = not info.paragon and standing == 8 + faction.maximum = info.type == "friend" and current >= maximum end local function UpdateFactions(charInfo) - local self = PermoksAccountManager - - charInfo.factions = charInfo.factions or {} - local factions = charInfo.factions - - for factionId, info in pairs(self.factions) do - local current, maximum, standing, name, hasReward, renown = GetFactionOrFriendshipInfo(factionId, info.type) - - factions[factionId] = factions[factionId] or {} - factions[factionId].standing = standing - factions[factionId].current = current - factions[factionId].max = maximum - factions[factionId].type = info.type - factions[factionId].hasReward = hasReward - factions[factionId].renown = renown - factions[factionId].exalted = not info.paragon and standing == 8 - factions[factionId].maximum = info.type == "friend" and current >= maximum - - if not info.localName then - info.localName = name - end - end + local self = PermoksAccountManager + + charInfo.factions = charInfo.factions or {} + if self.isRetail then + self.warbandData.factions = self.warbandData.factions or {} + end + + local factions = charInfo.factions + local warbandFactions = self.warbandData.factions + + for factionId, info in pairs(self.factions) do + local current, maximum, standing, name, hasReward, renown = GetFactionOrFriendshipInfo(factionId, info.type) + + UpdateFaction(factions, factionId, standing, current, maximum, info, hasReward, renown) + + if warbandFactions then + UpdateFaction(warbandFactions, factionId, standing, current, maximum, info, hasReward, renown) + end + + if not info.localName then + info.localName = name + end + end end local function Update(charInfo) - UpdateFactions(charInfo) + UpdateFactions(charInfo) end -local module = 'factions' +local module = "factions" local payload = { - update = Update, - labels = labelRows, - events = { - ['UPDATE_FACTION'] = UpdateFactions - }, - share = { - [UpdateFactions] = 'factions' - } + update = Update, + labels = labelRows, + events = { + ["UPDATE_FACTION"] = UpdateFactions, + }, + share = { + [UpdateFactions] = "factions", + }, } PermoksAccountManager:AddModule(module, payload) +local function convertStanding(standing) + if friendshipStandings[standing] then + return friendshipStandings[standing] + else + return standing:sub(1, 1) + end +end + function PermoksAccountManager:CreateFactionString(factionInfo) - if not factionInfo then - return - end - if not factionInfo.standing then - return 'No Data' - end - if factionInfo.exalted then - return string.format('|cff00ff00%s|r', L['Exalted']) - elseif factionInfo.maximum then - return string.format('|cff00ff00%s|r', 'Maximum') - end - - local standingColor, standing = FACTION_BAR_COLORS_CUSTOM[5], FACTION_STANDING_LABEL_CUSTOM[factionInfo.standing] - if standing then - standingColor = FACTION_BAR_COLORS_CUSTOM[factionInfo.standing] - else - standing = factionInfo.standing - end - - local color = factionInfo.hasReward and 'ff00ff00' or CreateColor(standingColor.r / 255, standingColor.g / 255, standingColor.b / 255):GenerateHexColor() - if factionInfo.renown then - return string.format('%s - %s /%s', BLUE_FONT_COLOR:WrapTextInColorCode(factionInfo.renown), AbbreviateNumbers(factionInfo.current or 0), AbbreviateNumbers(factionInfo.max or 0)) - elseif factionInfo.max then - return string.format('|c%s%s|r/%s |cff%02X%02X%02X%s|r', color, AbbreviateLargeNumbers(factionInfo.current or 0), AbbreviateNumbers(factionInfo.max or 0), standingColor.r, standingColor.g, standingColor.b, standing:sub(1,1)) - end + if not factionInfo then + return + end + if not factionInfo.standing then + return "No Data" + end + if factionInfo.exalted then + return string.format("|cff00ff00%s|r", L["Exalted"]) + elseif factionInfo.maximum then + return string.format("|cff00ff00%s|r", "Maximum") + end + + local standingColor, standing = FACTION_BAR_COLORS_CUSTOM[5], FACTION_STANDING_LABEL_CUSTOM[factionInfo.standing] + if standing then + standingColor = FACTION_BAR_COLORS_CUSTOM[factionInfo.standing] + else + standing = factionInfo.standing + end + + local color = factionInfo.hasReward and "ff00ff00" + or CreateColor(standingColor.r / 255, standingColor.g / 255, standingColor.b / 255):GenerateHexColor() + if factionInfo.renown then + return string.format( + "%s - %s /%s", + BLUE_FONT_COLOR:WrapTextInColorCode(factionInfo.renown), + AbbreviateNumbers(factionInfo.current or 0), + AbbreviateNumbers(factionInfo.max or 0) + ) + elseif factionInfo.max then + return string.format( + "|c%s%s|r/%s |cff%02X%02X%02X%s|r", + color, + AbbreviateLargeNumbers(factionInfo.current or 0), + AbbreviateNumbers(factionInfo.max or 0), + standingColor.r, + standingColor.g, + standingColor.b, + convertStanding(standing) + ) + end end diff --git a/modules/instances.lua b/modules/instances.lua index 271e8e4..4956d1c 100644 --- a/modules/instances.lua +++ b/modules/instances.lua @@ -1,386 +1,408 @@ local addonName, PermoksAccountManager = ... -local LibQTip = LibStub('LibQTip-1.0') -local L = LibStub('AceLocale-3.0'):GetLocale(addonName) +local LibQTip = LibStub("LibQTip-1.0") +local L = LibStub("AceLocale-3.0"):GetLocale(addonName) -local module = 'instances' +local module = "instances" local labelRows = { - mythics_done = { - label = 'Mythic Dungeons', - tooltip = true, - customTooltip = function(button, alt_data) - PermoksAccountManager:DungeonTooltip_OnEnter(button, alt_data) - end, - data = function(alt_data) - return alt_data.instanceInfo and PermoksAccountManager:CreateDungeonString(alt_data.instanceInfo.dungeons) or '-' - end, - group = 'dungeons', - version = WOW_PROJECT_MAINLINE - }, - vault_of_the_incarnates = { + mythics_done = { + label = "Mythic Dungeons", + tooltip = true, + customTooltip = function(button, alt_data) + PermoksAccountManager:DungeonTooltip_OnEnter(button, alt_data) + end, + data = function(alt_data) + return alt_data.instanceInfo and PermoksAccountManager:CreateDungeonString(alt_data.instanceInfo.dungeons) + or "-" + end, + group = "dungeons", + version = WOW_PROJECT_MAINLINE, + }, + --12.0 + the_voidspire = { label = function() - return PermoksAccountManager.raids[2522].name or 'VotI' - end, - id = 2522, - type = 'raid', - key = 'vault_of_the_incarnates', + return PermoksAccountManager.raids[2912].name or "Voidspire" + end, + id = 2912, + type = "raid", + key = "the_voidspire", tooltip = true, - group = 'raids', - version = WOW_PROJECT_MAINLINE - }, - aberrus_the_shadowed_crucible = { + group = "raids", + version = WOW_PROJECT_MAINLINE, + }, + the_dreamrift = { label = function() - return PermoksAccountManager.raids[2569].name or 'Aberrus' - end, - id = 2569, - type = 'raid', - key = 'aberrus_the_shadowed_crucible', + return PermoksAccountManager.raids[2939].name or "Dreamrift" + end, + id = 2939, + type = "raid", + key = "the_dreamrift", tooltip = true, - group = 'raids', - version = WOW_PROJECT_MAINLINE - }, - dawn_of_the_infinite = { - label = GetRealZoneText(2579), - id = 2579, - data = function(alt_data) - local defeated = 0 - if alt_data.instanceInfo and alt_data.instanceInfo.dungeons and alt_data.instanceInfo.dungeons[2579] then - defeated = alt_data.instanceInfo.dungeons[2579].defeatedEncounters - else - - end - return PermoksAccountManager:CreateFractionString(defeated, 8) - end, - group = 'dungeons', - version = WOW_PROJECT_MAINLINE - }, - amirdrassil_the_dreams_hope = { + group = "raids", + version = WOW_PROJECT_MAINLINE, + }, + march_on_queldanas = { label = function() - return PermoksAccountManager.raids[2549].name or 'Amirdrassil' - end, - id = 2549, - type = 'raid', - key = 'amirdrassil_the_dreams_hope', + return PermoksAccountManager.raids[2913].name or "March" + end, + id = 2913, + type = "raid", + key = "march_on_queldanas", tooltip = true, - group = 'raids', - version = WOW_PROJECT_MAINLINE - }, + group = "raids", + version = WOW_PROJECT_MAINLINE, + }, - -- wotlk + -- wotlk -- TOOD: Change db structure so you can get the locale name without calling the function again naxxramas = { label = GetRealZoneText(533), id = 533, - type = 'raid', - key = 'naxxramas', - group = 'raids', + type = "raid", + key = "naxxramas", + group = "raids", tooltip = true, version = WOW_PROJECT_CATACLYSM_CLASSIC, }, ulduar = { label = GetRealZoneText(603), id = 603, - type = 'raid', - key = 'ulduar', - group = 'raids', + type = "raid", + key = "ulduar", + group = "raids", tooltip = true, version = WOW_PROJECT_CATACLYSM_CLASSIC, }, obsidian_sanctum = { label = GetRealZoneText(615), id = 615, - type = 'raid', - key = 'obsidian_sanctum', - group = 'raids', + type = "raid", + key = "obsidian_sanctum", + group = "raids", tooltip = true, version = WOW_PROJECT_CATACLYSM_CLASSIC, }, eye_of_eternity = { label = GetRealZoneText(616), id = 616, - type = 'raid', - key = 'eye_of_eternity', - group = 'raids', + type = "raid", + key = "eye_of_eternity", + group = "raids", tooltip = true, version = WOW_PROJECT_CATACLYSM_CLASSIC, }, vault_of_archavon = { label = GetRealZoneText(624), id = 624, - type = 'raid', - key = 'vault_of_archavon', - group = 'raids', + type = "raid", + key = "vault_of_archavon", + group = "raids", tooltip = true, version = WOW_PROJECT_CATACLYSM_CLASSIC, }, icecrown_citadel = { label = GetRealZoneText(631), id = 631, - type = 'raid', - key = 'icecrown_citadel', - group = 'raids', + type = "raid", + key = "icecrown_citadel", + group = "raids", tooltip = true, version = WOW_PROJECT_CATACLYSM_CLASSIC, }, trial_of_the_crusader = { label = GetRealZoneText(649), id = 649, - type = 'raid', - key = 'trial_of_the_crusader', - group = 'raids', + type = "raid", + key = "trial_of_the_crusader", + group = "raids", tooltip = true, version = WOW_PROJECT_CATACLYSM_CLASSIC, }, - onyxias_lair = { + onyxias_lair = { label = GetRealZoneText(249), id = 249, - type = 'raid', - key = 'onyxias_lair', - group = 'raids', + type = "raid", + key = "onyxias_lair", + group = "raids", tooltip = true, version = WOW_PROJECT_CATACLYSM_CLASSIC, - }, + }, ruby_sanctum = { label = GetRealZoneText(724), id = 724, - type = 'raid', - key = 'ruby_sanctum', - group = 'raids', + type = "raid", + key = "ruby_sanctum", + group = "raids", tooltip = true, version = WOW_PROJECT_CATACLYSM_CLASSIC, }, - -- old mount drop raids (optional) - zul_gurub = { + -- old mount drop raids (optional) + zul_gurub = { label = GetRealZoneText(309), id = 309, - type = 'raid', - key = 'zul_gurub', - group = 'raids', + type = "raid", + key = "zul_gurub", + group = "raids", tooltip = true, - hasSingularLockout = true, + hasSingularLockout = true, version = WOW_PROJECT_CATACLYSM_CLASSIC, }, - karazhan = { + karazhan = { label = GetRealZoneText(532), id = 532, - type = 'raid', - key = 'karazhan', - group = 'raids', + type = "raid", + key = "karazhan", + group = "raids", tooltip = true, - hasSingularLockout = true, + hasSingularLockout = true, version = WOW_PROJECT_CATACLYSM_CLASSIC, }, - tempest_keep = { + tempest_keep = { label = GetRealZoneText(550), id = 550, - type = 'raid', - key = 'tempest_keep', - group = 'raids', + type = "raid", + key = "tempest_keep", + group = "raids", tooltip = true, - hasSingularLockout = true, + hasSingularLockout = true, + version = WOW_PROJECT_CATACLYSM_CLASSIC, + }, + heroics_done = { + label = "Heroic Dungeons", + tooltip = function(button, alt_data) + PermoksAccountManager:DungeonTooltip_OnEnter(button, alt_data) + end, + data = function(alt_data) + return alt_data.instanceInfo and PermoksAccountManager:CreateDungeonString(alt_data.instanceInfo.dungeons) + or "-" + end, + group = "dungeons", version = WOW_PROJECT_CATACLYSM_CLASSIC, }, - heroics_done = { - label = 'Heroic Dungeons', - tooltip = function(button, alt_data) - PermoksAccountManager:DungeonTooltip_OnEnter(button, alt_data) - end, - data = function(alt_data) - return alt_data.instanceInfo and PermoksAccountManager:CreateDungeonString(alt_data.instanceInfo.dungeons) or '-' - end, - group = 'dungeons', - version = WOW_PROJECT_CATACLYSM_CLASSIC - }, - - -- Cataclysm - blackwing_descent = { + + -- Cataclysm + blackwing_descent = { label = GetRealZoneText(669), id = 669, - type = 'raid', - key = 'blackwing_descent', - group = 'raids', + type = "raid", + key = "blackwing_descent", + group = "raids", tooltip = true, version = WOW_PROJECT_CATACLYSM_CLASSIC, }, - the_bastion_of_twilight = { + the_bastion_of_twilight = { label = GetRealZoneText(671), id = 671, - type = 'raid', - key = 'the_bastion_of_twilight', - group = 'raids', + type = "raid", + key = "the_bastion_of_twilight", + group = "raids", tooltip = true, version = WOW_PROJECT_CATACLYSM_CLASSIC, }, - firelands = { + firelands = { label = GetRealZoneText(720), id = 720, - type = 'raid', - key = 'firelands', - group = 'raids', + type = "raid", + key = "firelands", + group = "raids", tooltip = true, version = WOW_PROJECT_CATACLYSM_CLASSIC, }, - throne_of_the_four_winds = { + throne_of_the_four_winds = { label = GetRealZoneText(754), id = 754, - type = 'raid', - key = 'throne_of_the_four_winds', - group = 'raids', + type = "raid", + key = "throne_of_the_four_winds", + group = "raids", tooltip = true, version = WOW_PROJECT_CATACLYSM_CLASSIC, }, - baradin_hold = { + baradin_hold = { label = GetRealZoneText(757), id = 757, - type = 'raid', - key = 'baradin_hold', - group = 'raids', + type = "raid", + key = "baradin_hold", + group = "raids", tooltip = true, version = WOW_PROJECT_CATACLYSM_CLASSIC, }, - dragon_soul = { + dragon_soul = { label = GetRealZoneText(967), id = 967, - type = 'raid', - key = 'dragon_soul', - group = 'raids', + type = "raid", + key = "dragon_soul", + group = "raids", tooltip = true, version = WOW_PROJECT_CATACLYSM_CLASSIC, }, + + -- Mists + mogushan_vaults = { + label = GetRealZoneText(1008), + id = 1008, + type = "raid", + key = "mogushan_vaults", + group = "raids", + tooltip = true, + version = WOW_PROJECT_MISTS_CLASSIC, + }, + heart_of_fear = { + label = GetRealZoneText(1009), + id = 1009, + type = "raid", + key = "heart_of_fear", + group = "raids", + tooltip = true, + version = WOW_PROJECT_MISTS_CLASSIC, + }, + terrace_of_endless_spring = { + label = GetRealZoneText(996), + id = 996, + type = "raid", + key = "terrace_of_endless_spring", + group = "raids", + tooltip = true, + version = WOW_PROJECT_MISTS_CLASSIC, + }, } local function UpdateInstanceInfo(charInfo) - charInfo.instanceInfo = charInfo.instanceInfo or {raids = {}, dungeons = {}, customRaids = {}} - local self = PermoksAccountManager - local instanceInfo = charInfo.instanceInfo - local name, difficulty, locked, extended, difficultyName, numEncounters, encounterProgress, _ - for i = 1, GetNumSavedInstances() do - local link = GetSavedInstanceChatLink(i) - local mapID, _ = link:match(':(%d+):%d+:%d+\124h%[(.+)%]\124h') - mapID = tonumber(mapID) - name, _, _, difficulty, locked, extended, _, _, _, difficultyName, numEncounters, encounterProgress = GetSavedInstanceInfo(i) + charInfo.instanceInfo = charInfo.instanceInfo or { raids = {}, dungeons = {}, customRaids = {} } + local self = PermoksAccountManager + local instanceInfo = charInfo.instanceInfo + local name, difficulty, locked, extended, difficultyName, numEncounters, encounterProgress, _ + for i = 1, GetNumSavedInstances() do + local link = GetSavedInstanceChatLink(i) + local mapID, _ = link:match(":(%d+):%d+:%d+\124h%[(.+)%]\124h") + mapID = tonumber(mapID) + name, _, _, difficulty, locked, extended, _, _, _, difficultyName, numEncounters, encounterProgress = + GetSavedInstanceInfo(i) local raidInfo - if locked or extended then - if self.raids[mapID] or (self.isCata and self.raids[name]) then - local info = self.raids[mapID] or self.raids[name] - instanceInfo.raids[info.englishID] = instanceInfo.raids[info.englishID] or {} - instanceInfo.raids[info.englishID][difficulty] = instanceInfo.raids[info.englishID][difficulty] or { - key = info.englishID, - difficulty = difficultyName, - numEncounters = numEncounters - } - - if not instanceInfo.raids[info.englishID][difficulty].key then - instanceInfo.raids[info.englishID][difficulty].key = info.englishID - end - - local oldInstanceInfo = instanceInfo.raids[info.englishID][difficulty] - if not oldInstanceInfo.defeatedEncounters or oldInstanceInfo.defeatedEncounters < encounterProgress then - instanceInfo.raids[info.englishID][difficulty].defeatedEncounters = encounterProgress - end + if locked or extended then + if self.raids[mapID] or (self.isCata and self.raids[name]) then + local info = self.raids[mapID] or self.raids[name] + instanceInfo.raids[info.englishID] = instanceInfo.raids[info.englishID] or {} + instanceInfo.raids[info.englishID][difficulty] = instanceInfo.raids[info.englishID][difficulty] + or { + key = info.englishID, + difficulty = difficultyName, + numEncounters = numEncounters, + } + + if not instanceInfo.raids[info.englishID][difficulty].key then + instanceInfo.raids[info.englishID][difficulty].key = info.englishID + end + + local oldInstanceInfo = instanceInfo.raids[info.englishID][difficulty] + if not oldInstanceInfo.defeatedEncounters or oldInstanceInfo.defeatedEncounters < encounterProgress then + instanceInfo.raids[info.englishID][difficulty].defeatedEncounters = encounterProgress + end raidInfo = oldInstanceInfo - elseif (self.dungeons[mapID] and difficulty == 23) or (self.isCata and self.dungeons[name] and difficulty == 2) then - local completed = numEncounters == encounterProgress - - -- find out if last boss is killed, since in wotlk the dungeon is completed if last boss is killed - if self.isCata then - -- for Ahn'kahet: The Old Kingdom we need to subtract 1 from numEncounters, since the last boss from API is the heroic only boss - local lastBossIndex = numEncounters - if(mapID == 619) then - lastBossIndex = lastBossIndex - 1 - end - - local _, _, isKilled = GetSavedInstanceEncounterInfo(i, lastBossIndex) - completed = isKilled - end - - local oldInstanceInfo = instanceInfo.dungeons[mapID or self.dungeons[name]] - if oldInstanceInfo then - oldInstanceInfo.defeatedEncounters = max(oldInstanceInfo.defeatedEncounters, encounterProgress) - oldInstanceInfo.completed = completed - else - instanceInfo.dungeons[mapID or self.dungeons[name]] = { - numEncounters = numEncounters, - defeatedEncounters = encounterProgress, - completed = completed - } - end - elseif self.customRaids and self.customRaids[name] then - local info = self.customRaids[name] - instanceInfo.customRaids = instanceInfo.customRaids or {} - instanceInfo.customRaids[info.englishID] = instanceInfo.customRaids[info.englishID] or {} - instanceInfo.customRaids[info.englishID][difficulty] = instanceInfo.customRaids[info.englishID][difficulty] or { - key = info.englishID, - difficulty = difficultyName, - numEncounters = numEncounters - } - - if not instanceInfo.customRaids[info.englishID][difficulty].key then - instanceInfo.customRaids[info.englishID][difficulty].key = info.englishID - end - - local oldInstanceInfo = instanceInfo.customRaids[info.englishID][difficulty] - if not oldInstanceInfo.defeatedEncounters or oldInstanceInfo.defeatedEncounters < encounterProgress then - instanceInfo.customRaids[info.englishID][difficulty].defeatedEncounters = encounterProgress - end + elseif + (self.dungeons[mapID] and difficulty == 23) or (self.isCata and self.dungeons[name] and difficulty == 2) + then + local completed = numEncounters == encounterProgress + + -- find out if last boss is killed, since in wotlk the dungeon is completed if last boss is killed + if self.isCata then + -- for Ahn'kahet: The Old Kingdom we need to subtract 1 from numEncounters, since the last boss from API is the heroic only boss + local lastBossIndex = numEncounters + if mapID == 619 then + lastBossIndex = lastBossIndex - 1 + end + + local _, _, isKilled = GetSavedInstanceEncounterInfo(i, lastBossIndex) + completed = isKilled + end + + local oldInstanceInfo = instanceInfo.dungeons[mapID or self.dungeons[name]] + if oldInstanceInfo then + oldInstanceInfo.defeatedEncounters = max(oldInstanceInfo.defeatedEncounters, encounterProgress) + oldInstanceInfo.completed = completed + else + instanceInfo.dungeons[mapID or self.dungeons[name]] = { + numEncounters = numEncounters, + defeatedEncounters = encounterProgress, + completed = completed, + } + end + elseif self.customRaids and self.customRaids[name] then + local info = self.customRaids[name] + instanceInfo.customRaids = instanceInfo.customRaids or {} + instanceInfo.customRaids[info.englishID] = instanceInfo.customRaids[info.englishID] or {} + instanceInfo.customRaids[info.englishID][difficulty] = instanceInfo.customRaids[info.englishID][difficulty] + or { + key = info.englishID, + difficulty = difficultyName, + numEncounters = numEncounters, + } + + if not instanceInfo.customRaids[info.englishID][difficulty].key then + instanceInfo.customRaids[info.englishID][difficulty].key = info.englishID + end + + local oldInstanceInfo = instanceInfo.customRaids[info.englishID][difficulty] + if not oldInstanceInfo.defeatedEncounters or oldInstanceInfo.defeatedEncounters < encounterProgress then + instanceInfo.customRaids[info.englishID][difficulty].defeatedEncounters = encounterProgress + end raidInfo = oldInstanceInfo - end - end + end + end if self.isRetail and raidInfo then - local index = self.raids[mapID].startIndex - 1 + local index = self.raids[mapID].startIndex raidInfo.defeatedEncountersInfo = raidInfo.defeatedEncountersInfo or {} for boss = 1, numEncounters do local isKilled = select(3, GetSavedInstanceEncounterInfo(i, boss)) - raidInfo.defeatedEncountersInfo[index + boss] = isKilled + raidInfo.defeatedEncountersInfo[index - 1 + boss] = isKilled + end + elseif self.isCata and raidInfo then + raidInfo.defeatedEncountersInfo = raidInfo.defeatedEncountersInfo or {} + for bossIndex = 1, raidInfo.numEncounters do + local name, _, isKilled = GetSavedInstanceEncounterInfo(i, bossIndex) + if name then + raidInfo.defeatedEncountersInfo[bossIndex] = { + name = name, + isKilled = isKilled, + } + end end - elseif self.isCata and raidInfo then - raidInfo.defeatedEncountersInfo = raidInfo.defeatedEncountersInfo or {} - for bossIndex = 1, raidInfo.numEncounters do - local name, _, isKilled = GetSavedInstanceEncounterInfo(i, bossIndex) - if name then - raidInfo.defeatedEncountersInfo[bossIndex] = { - name = name, - isKilled = isKilled - } - end - end - end - end + end + end end local function Update(charInfo) - UpdateInstanceInfo(charInfo) + UpdateInstanceInfo(charInfo) end do - local payload = { - update = Update, - labels = labelRows, - events = { - ['UPDATE_INSTANCE_INFO'] = UpdateInstanceInfo, - ['WEEKLY_REWARDS_UPDATE'] = UpdateInstanceInfo, - ['INSTANCE_LOCK_STOP'] = UpdateInstanceInfo, - }, - share = { - [UpdateInstanceInfo] = 'instanceInfo' - } - } - PermoksAccountManager:AddModule(module, payload) + local payload = { + update = Update, + labels = labelRows, + events = { + ["UPDATE_INSTANCE_INFO"] = UpdateInstanceInfo, + ["WEEKLY_REWARDS_UPDATE"] = UpdateInstanceInfo, + ["INSTANCE_LOCK_STOP"] = UpdateInstanceInfo, + }, + share = { + [UpdateInstanceInfo] = "instanceInfo", + }, + } + PermoksAccountManager:AddModule(module, payload) end function PermoksAccountManager:CreateDungeonString(savedInfo) - if not savedInfo then - return '-' - end - local numCompletedDungeons = 0 + if not savedInfo then + return "-" + end + local numCompletedDungeons = 0 - for _, info in pairs(savedInfo) do - if info.completed then - numCompletedDungeons = numCompletedDungeons + 1 - end - end + for _, info in pairs(savedInfo) do + if info.completed then + numCompletedDungeons = numCompletedDungeons + 1 + end + end return self:CreateFractionString(numCompletedDungeons, self.numDungeons) end @@ -393,170 +415,202 @@ local retailDifficultyOrder = { } function PermoksAccountManager:CreateRaidString(savedInfo, hideDifficulty) - local raidString = '' - - local highestDifficulty = 0 - for difficulty in pairs(savedInfo) do - if (self.isRetail and (retailDifficultyOrder[difficulty] > (retailDifficultyOrder[highestDifficulty] or highestDifficulty))) or (self.isCata and (difficulty > highestDifficulty)) then - highestDifficulty = difficulty - end - end - - if self.isCata then - -- for wrath we want to show all difficulties - for difficulty in PermoksAccountManager.spairs(savedInfo, function(_, a, b) return a < b end) do - local difficultyString = '' - local raidInfo = savedInfo[difficulty] - - -- add failsafe if saved data is not updated with key - local hasSingularLockout = false - if labelRows[raidInfo.key] and labelRows[raidInfo.key].hasSingularLockout then - hasSingularLockout = labelRows[raidInfo.key].hasSingularLockout - end - - if hasSingularLockout then - difficultyString = self:CreateFractionString(raidInfo.defeatedEncounters, raidInfo.numEncounters) - else - difficultyString = string.format('%s %s', PermoksAccountManager.raidDifficultyLabels[difficulty], self:CreateFractionString(raidInfo.defeatedEncounters, raidInfo.numEncounters)) - end - - raidString = string.format('%s%s%s', raidString, difficultyString, difficulty == highestDifficulty and '' or ' ') - end - else - local raidInfo = savedInfo[highestDifficulty] - if not raidInfo then return end - local raidDifficulty = raidInfo.difficulty:sub(1, 1) - - -- for retail we only want to show the highest difficulty - raidString = string.format('%s%s', self:CreateFractionString(raidInfo.defeatedEncounters, raidInfo.numEncounters), hideDifficulty and '' or raidDifficulty) - end - - return raidString + local raidString = "" + + local highestDifficulty = 0 + for difficulty in pairs(savedInfo) do + if + ( + self.isRetail + and ( + retailDifficultyOrder[difficulty] > (retailDifficultyOrder[highestDifficulty] or highestDifficulty) + ) + ) or (self.isCata and (difficulty > highestDifficulty)) + then + highestDifficulty = difficulty + end + end + + if self.isCata then + -- for wrath we want to show all difficulties + for difficulty in + PermoksAccountManager.spairs(savedInfo, function(_, a, b) + return a < b + end) + do + local difficultyString = "" + local raidInfo = savedInfo[difficulty] + + -- add failsafe if saved data is not updated with key + local hasSingularLockout = false + if labelRows[raidInfo.key] and labelRows[raidInfo.key].hasSingularLockout then + hasSingularLockout = labelRows[raidInfo.key].hasSingularLockout + end + + if hasSingularLockout then + difficultyString = self:CreateFractionString(raidInfo.defeatedEncounters, raidInfo.numEncounters) + else + difficultyString = string.format( + "%s %s", + PermoksAccountManager.raidDifficultyLabels[difficulty], + self:CreateFractionString(raidInfo.defeatedEncounters, raidInfo.numEncounters) + ) + end + + raidString = + string.format("%s%s%s", raidString, difficultyString, difficulty == highestDifficulty and "" or " ") + end + else + local raidInfo = savedInfo[highestDifficulty] + if not raidInfo then + return + end + local raidDifficulty = raidInfo.difficulty:sub(1, 1) + + -- for retail we only want to show the highest difficulty + raidString = string.format( + "%s%s", + self:CreateFractionString(raidInfo.defeatedEncounters, raidInfo.numEncounters), + hideDifficulty and "" or raidDifficulty + ) + end + + return raidString end function PermoksAccountManager:DungeonTooltip_OnEnter(button, alt_data) - if not alt_data or not alt_data.instanceInfo then - return - end - local dungeonInfo = alt_data.instanceInfo.dungeons - local tooltip = LibQTip:Acquire(addonName .. 'Tooltip', 3, 'LEFT', 'CENTER', 'RIGHT') - button.tooltip = tooltip - - for key, value in self.spairs( - self.dungeons, - function(t, a, b) - return t[a] < t[b] - end - ) do - local left = self.isCata and key or value - local info = self.isCata and dungeonInfo[value] or dungeonInfo[key] - local right = '|cffff0000-|r' - - if info then - right = self:CreateQuestString(info.defeatedEncounters, info.numEncounters, true) - end - tooltip:AddLine(left, ' ', right) - end - - tooltip:SmartAnchorTo(button) - tooltip:Show() + if not alt_data or not alt_data.instanceInfo then + return + end + local dungeonInfo = alt_data.instanceInfo.dungeons + local tooltip = LibQTip:Acquire(addonName .. "Tooltip", 3, "LEFT", "CENTER", "RIGHT") + button.tooltip = tooltip + + for key, value in + self.spairs(self.dungeons, function(t, a, b) + return t[a] < t[b] + end) + do + local left = self.isCata and key or value + local info = self.isCata and dungeonInfo[value] or dungeonInfo[key] + local right = "|cffff0000-|r" + + if info then + right = self:CreateQuestString(info.defeatedEncounters, info.numEncounters, true) + end + tooltip:AddLine(left, " ", right) + end + + tooltip:SmartAnchorTo(button) + tooltip:Show() end local function RetailRaid_OnEnter(tooltip, altData, dbInfo, raidInfo) - local self = PermoksAccountManager - - local raidActivityInfo = altData.raidActivityInfo - local localRaidActivityInfo = {} - for _, info in pairs(raidActivityInfo) do - if info.instanceID == dbInfo.instanceID then - localRaidActivityInfo[info.uiOrder] = info - end - end - - for difficulty, info in self.spairs( - raidInfo, - function(_, a, b) - if a == 17 or b == 17 then - return b < a - else - return a < b - end - end - ) do - tooltip:AddLine(info.difficulty .. ':', self:CreateQuestString(info.defeatedEncounters, info.numEncounters)) - - if info.defeatedEncountersInfo and difficulty < 17 then - local bossIndex = 1 - for index = dbInfo.startIndex, dbInfo.endIndex do - local bossInfo = info.defeatedEncountersInfo[index] - local text = L['Unsaved'] - local color = "00ff00" - - if difficulty == 16 and localRaidActivityInfo[bossIndex] and localRaidActivityInfo[bossIndex].bestDifficulty == difficulty then - text = L['Killed'] - color = "ff0000" - elseif bossInfo then - text = L['Saved'] - color = "ff9933" - end - - tooltip:AddLine(bossIndex .. " " .. EJ_GetEncounterInfo(localRaidActivityInfo[bossIndex].encounterID), string.format("|cff%s%s|r", color, text)) - bossIndex = bossIndex + 1 - end - end - tooltip:AddSeparator(2, 1, 1, 1) - end + local self = PermoksAccountManager + + local raidActivityInfo = altData.raidActivityInfo + local localRaidActivityInfo = {} + for _, info in pairs(raidActivityInfo) do + if info.instanceID == dbInfo.instanceID then + localRaidActivityInfo[info.uiOrder] = info + end + end + + for difficulty, info in + self.spairs(raidInfo, function(_, a, b) + if a == 17 or b == 17 then + return b < a + else + return a < b + end + end) + do + tooltip:AddLine(info.difficulty .. ":", self:CreateQuestString(info.defeatedEncounters, info.numEncounters)) + + if info.defeatedEncountersInfo and difficulty < 17 then + local bossIndex = dbInfo.startAtZero and 0 or 1 + for index = dbInfo.startIndex, dbInfo.endIndex do + local bossInfo = info.defeatedEncountersInfo[index] + local text = L["Unsaved"] + local color = "00ff00" + + if + difficulty == 16 + and localRaidActivityInfo[bossIndex] + and localRaidActivityInfo[bossIndex].bestDifficulty == difficulty + then + text = L["Killed"] + color = "ff0000" + elseif bossInfo then + text = L["Saved"] + color = "ff9933" + end + + tooltip:AddLine( + index .. " " .. EJ_GetEncounterInfo(localRaidActivityInfo[bossIndex].encounterID), + string.format("|cff%s%s|r", color, text) + ) + bossIndex = bossIndex + 1 + end + end + tooltip:AddSeparator(2, 1, 1, 1) + end end local function WOTLKRaid_OnEnter(tooltip, raidInfo) - local self = PermoksAccountManager - - for _, info in self.spairs(raidInfo, function(_, a, b) return a < b end) do - tooltip:AddLine(info.difficulty .. ':', self:CreateQuestString(info.defeatedEncounters, info.numEncounters)) - - if info.defeatedEncountersInfo then - for bossIndex = 1, info.numEncounters do - - local bossName = info.defeatedEncountersInfo[bossIndex] and info.defeatedEncountersInfo[bossIndex].name - local text = L['Alive'] - local color = "00ff00" - - if info.defeatedEncountersInfo[bossIndex] and info.defeatedEncountersInfo[bossIndex].isKilled then - text = L['Killed'] - color = "ff0000" - end - - tooltip:AddLine(bossName or L['Unknown'], string.format("|cff%s%s|r", color, text)) - bossIndex = bossIndex + 1 - end - end - tooltip:AddSeparator(2, 1, 1, 1) - end + local self = PermoksAccountManager + + for _, info in + self.spairs(raidInfo, function(_, a, b) + return a < b + end) + do + tooltip:AddLine(info.difficulty .. ":", self:CreateQuestString(info.defeatedEncounters, info.numEncounters)) + + if info.defeatedEncountersInfo then + for bossIndex = 1, info.numEncounters do + local bossName = info.defeatedEncountersInfo[bossIndex] and info.defeatedEncountersInfo[bossIndex].name + local text = L["Alive"] + local color = "00ff00" + + if info.defeatedEncountersInfo[bossIndex] and info.defeatedEncountersInfo[bossIndex].isKilled then + text = L["Killed"] + color = "ff0000" + end + + tooltip:AddLine(bossName or L["Unknown"], string.format("|cff%s%s|r", color, text)) + bossIndex = bossIndex + 1 + end + end + tooltip:AddSeparator(2, 1, 1, 1) + end end function PermoksAccountManager.RaidTooltip_OnEnter(button, altData, labelRow) - local self = PermoksAccountManager - - if not altData.instanceInfo or (not self.raids[labelRow.id] and not self.raids[labelRow.label]) then - return - end - - local dbInfo = self.raids[labelRow.id] or self.raids[labelRow.label] - local raidInfo = dbInfo and altData.instanceInfo.raids[dbInfo.englishID] - if not raidInfo then return end - - local tooltip = LibQTip:Acquire(addonName .. 'Tooltip', 2, 'LEFT', 'RIGHT') - button.tooltip = tooltip - - tooltip:AddHeader(dbInfo.name or labelRow.label) - tooltip:AddLine('') - - if self.isCata then - WOTLKRaid_OnEnter(tooltip, raidInfo) - elseif not self.isBC and self.isRetail then - RetailRaid_OnEnter(tooltip, altData, dbInfo, raidInfo) - end - - tooltip:SmartAnchorTo(button) - tooltip:Show() + local self = PermoksAccountManager + + if not altData.instanceInfo or (not self.raids[labelRow.id] and not self.raids[labelRow.label]) then + return + end + + local dbInfo = self.raids[labelRow.id] or self.raids[labelRow.label] + local raidInfo = dbInfo and altData.instanceInfo.raids[dbInfo.englishID] + if not raidInfo then + return + end + + local tooltip = LibQTip:Acquire(addonName .. "Tooltip", 2, "LEFT", "RIGHT") + button.tooltip = tooltip + + tooltip:AddHeader(dbInfo.name or labelRow.label) + tooltip:AddLine("") + + if self.isCata then + WOTLKRaid_OnEnter(tooltip, raidInfo) + elseif not self.isBC and self.isRetail then + RetailRaid_OnEnter(tooltip, altData, dbInfo, raidInfo) + end + + tooltip:SmartAnchorTo(button) + tooltip:Show() end diff --git a/modules/items.lua b/modules/items.lua index bbf64dc..57892c5 100644 --- a/modules/items.lua +++ b/modules/items.lua @@ -123,6 +123,8 @@ local labelRows = { group = 'currency', version = WOW_PROJECT_MAINLINE }, + + -- 10.0 Dragonflight vaultKey = { label = 'Zskera Vault Key', type = 'item', @@ -130,39 +132,10 @@ local labelRows = { group = 'item', version = WOW_PROJECT_MAINLINE }, - whelpling_crest = { - label = 'Whelpling Crest (S2)', - type = 'crest', - fragment = 204075, - crest = 204193, - passRow = true, - group = 'item', - version = WOW_PROJECT_MAINLINE - }, - drake_crest = { - label = 'Drake Crest (S2)', - type = 'crest', - fragment = 204076, - crest = 204195, - passRow = true, - group = 'item', - version = WOW_PROJECT_MAINLINE - }, - wyrm_crest = { - label = 'Wyrm Crest (S2)', - type = 'crest', - fragment = 204077, - crest = 204196, - passRow = true, - group = 'item', - version = WOW_PROJECT_MAINLINE - }, - aspect_crest = { - label = 'Aspect Crest (S2)', - type = 'crest', - fragment = 204078, - crest = 204194, - passRow = true, + artisans_mettle = { + label = "Artisan's Mettle", + type = 'item', + key = 190456, group = 'item', version = WOW_PROJECT_MAINLINE }, @@ -279,6 +252,78 @@ local labelRows = { version = WOW_PROJECT_MAINLINE }, + -- 11.0 The War Within + spark_omens = { + label = 'Spark - Omens', + type = 'spark', + passRow = true, + key = 211296, + reagent = 211297, + reagentRequired = 2, + group = 'item', + version = WOW_PROJECT_MAINLINE + }, + artisans_acuity = { + label = "Artisan's Acuity", + type = 'item', + key = 210814, + group = 'item', + version = WOW_PROJECT_MAINLINE + }, + radiant_remnant = { + label = 'Radiant Remnant', + type = 'item', + key = 206350, + group = 'item', + version = WOW_PROJECT_MAINLINE + }, + radiant_echo = { + label = 'Radiant Echo', + type = 'item', + key = 235897, + group = 'item', + version = WOW_PROJECT_MAINLINE + }, + + -- REFACTOR: technically 50Glob of Wax = 1x Firelight Ruby so this could be merged. Using spark function for this, could generalize the concept + firelight_ruby = { + label = 'Firelight Ruby', + type = 'spark', + passRow = true, + key = 224642, + reagent = 212493, + reagentRequired = 50, + group = 'item', + version = WOW_PROJECT_MAINLINE + }, + coffer_key_shard = { + label = 'Coffer Key Shard', + type = 'item', + key = 229899, + group = 'item', + version = WOW_PROJECT_MAINLINE + }, + --timewarped_relic_coffer_key = { + -- label = 'Timewarped Key', + -- type = 'reliccofferkey', + -- passRow = true, + -- keys = { 231510, 232365, 232366 }, + -- group = 'item', + -- version = WOW_PROJECT_MAINLINE, + --}, + + -- 11.1 + spark_current = { + label = 'Spark - Radiance', + type = 'spark', + passRow = true, + key = 232875, + -- reagent = 231757, + -- reagentRequired = 2, + group = 'item', + version = WOW_PROJECT_MAINLINE + }, + -- tbc elixirDemonslaying = { label = 'Elixir of Demonslaying', @@ -776,6 +821,22 @@ local function CreateDreamSeedString(labelRow, itemCounts) return " " end +local function CreateCofferKeyString(labelRow, itemCounts) + if itemCounts then + local strings = {} + for i, itemID in ipairs(labelRow.keys) do + local itemInfo = itemCounts[itemID] + if i == #labelRow.keys then + tinsert(strings, PermoksAccountManager:CreateItemString(nil, itemInfo and itemInfo.total or 0, (itemInfo and itemInfo.icon or C_Item.GetItemIconByID(itemID)))) + else + tinsert(strings, itemInfo and itemInfo.total or 0) + end + end + + return table.concat(strings, " | ") + end +end + local payload = { update = Update, labels = labelRows, @@ -790,6 +851,7 @@ local module = PermoksAccountManager:AddModule(module, payload) module:AddCustomLabelType('crest', CreateCrestString, nil, 'itemCounts') module:AddCustomLabelType('spark', CreateSparkString, nil, 'itemCounts') module:AddCustomLabelType('dreamseeds', CreateDreamSeedString, nil, 'itemCounts') +module:AddCustomLabelType('reliccofferkey', CreateCofferKeyString, nil, 'itemCounts') function PermoksAccountManager:CreateItemString(itemInfo, total, icon) diff --git a/modules/quests.lua b/modules/quests.lua index 19d6411..8c13341 100644 --- a/modules/quests.lua +++ b/modules/quests.lua @@ -1,48 +1,119 @@ local addonName, PermoksAccountManager = ... -local LibQTip = LibStub('LibQTip-1.0') -local L = LibStub('AceLocale-3.0'):GetLocale(addonName) +local LibQTip = LibStub("LibQTip-1.0") +local L = LibStub("AceLocale-3.0"):GetLocale(addonName) + +local COLOR_COMPLETED = "00FF00" +local COLOR_NOT_COMPLETED = "FF0000" local frequencyNames = { - [0] = 'default', - [1] = 'daily', - [2] = 'weekly' + [0] = "default", + [1] = "daily", + [2] = "weekly", } local completedString = { - [1] = '|cff00ff00Completed|r', - [2] = '|cffff0000Not Completed|r' + [1] = "|cff00ff00Completed|r", + [2] = "|cffff0000Not Completed|r", } local default = { daily = { visible = {}, - hidden = {} + hidden = {}, }, weekly = { visible = {}, - hidden = {} + hidden = {}, }, biweekly = { visible = {}, - hidden = {} + hidden = {}, }, relics = { visible = {}, - hidden = {} + hidden = {}, }, unlocks = { visible = {}, - hidden = {} - } + hidden = {}, + }, } -local module = 'quests' +local module = "quests" local labelRows = { + -- General Weeklies + dungeon_weekly = { + IDs = { 80184, 80185, 80186, 80187, 80188, 80189 }, + label = L["Dungeon Quests"], + type = "quest", + questType = "weekly", + warband = true, + visibility = "visible", + isComplete = function(alt_data) + return alt_data.questInfo + and alt_data.questInfo.weekly + and PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.weekly.dungeon_quests) == 1 + end, + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, + }, + completed_world_quests = { + label = "Done WQs", + type = "worldquest", + tooltip = true, + customTooltip = function(...) + PermoksAccountManager:CompletedWorldQuestsTooltip_OnEnter(...) + end, + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, + }, + pvp_weekly = { + IDs = { 80184, 80185, 80186, 80187, 80188, 80189 }, + label = L["PVP Quests"], + type = "quest", + questType = "weekly", + warband = true, + visibility = "visible", + required = 1, + isComplete = function(alt_data) + return alt_data.questInfo + and alt_data.questInfo.weekly + and PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.weekly.pvp_quests) == 1 + end, + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, + }, + pvp_sparks = { + IDs = { 81793, 81794, 81795, 81796 }, + label = "Sparks of War", + type = "quest", + questType = "weekly", + warband = true, + visibility = "visible", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, + }, + weekend_event = { + IDs = { 83345, 83347, 83357, 83358, 83366, 83359, 83362, 83365, 83364 }, + label = L["Weekend Event"], + type = "quest", + questType = "weekly", + visibility = "visible", + isComplete = function(alt_data) + return alt_data.questInfo + and alt_data.questInfo.weekly + and PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.weekly.weekend_event) == 1 + end, + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, + }, + + -- 9.0 Shadowlands korthia_dailies = { - label = L['Korthia Dailies'], - type = 'quest', - questType = 'daily', - visibility = 'visible', + label = L["Korthia Dailies"], + type = "quest", + questType = "daily", + visibility = "visible", required = function(alt_data) local unlocks = alt_data.questInfo.unlocks and alt_data.questInfo.unlocks.visible if unlocks then @@ -52,473 +123,441 @@ local labelRows = { return 3 end, isComplete = function(alt_data) - return alt_data.questInfo and alt_data.questInfo.daily and - PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.daily.visible.korthia_dailies) >= 3 + return alt_data.questInfo + and alt_data.questInfo.daily + and PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.daily.visible.korthia_dailies) + >= 3 end, - group = 'resetDaily', - version = WOW_PROJECT_MAINLINE + group = "resetDaily", + version = WOW_PROJECT_MAINLINE, }, riftbound_cache = { - label = L['Riftbound Caches'], - type = 'quest', - questType = 'daily', - visibility = 'hidden', + label = L["Riftbound Caches"], + type = "quest", + questType = "daily", + visibility = "hidden", required = 4, isComplete = function(alt_data) - return alt_data.questInfo and alt_data.questInfo.daily and - PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.daily.riftbound_cache) >= 4 + return alt_data.questInfo + and alt_data.questInfo.daily + and PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.daily.riftbound_cache) >= 4 end, - group = 'resetDaily', - version = WOW_PROJECT_MAINLINE + group = "resetDaily", + version = WOW_PROJECT_MAINLINE, }, relic_creatures = { - label = L['Relic Creatures'], - type = 'quest', - questType = 'daily', - visibility = 'hidden', + label = L["Relic Creatures"], + type = "quest", + questType = "daily", + visibility = "hidden", required = 15, plus = true, isComplete = function(alt_data) - return alt_data.questInfo and alt_data.questInfo.daily and - PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.daily.relic_creatures) >= 15 + return alt_data.questInfo + and alt_data.questInfo.daily + and PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.daily.relic_creatures) >= 15 end, - group = 'resetDaily', - version = WOW_PROJECT_MAINLINE + group = "resetDaily", + version = WOW_PROJECT_MAINLINE, }, dailyQuestCounter = { - label = 'Daily Quests', + label = "Daily Quests", data = function(alt_data) - return alt_data.completedDailies and - PermoksAccountManager:CreateFractionString((alt_data.completedDailies.num or 0), 25) + return alt_data.completedDailies + and PermoksAccountManager:CreateFractionString((alt_data.completedDailies.num or 0), 25) end, - group = 'resetDaily', - version = WOW_PROJECT_CATACLYSM_CLASSIC + group = "resetDaily", + version = WOW_PROJECT_CATACLYSM_CLASSIC, }, relic_gorger = { - label = L['Relic Gorger'], - type = 'quest', - questType = 'daily', - visibility = 'hidden', + label = L["Relic Gorger"], + type = "quest", + questType = "daily", + visibility = "hidden", required = 4, plus = true, isComplete = function(alt_data) - return alt_data.questInfo and alt_data.questInfo.daily and - PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.daily.relic_gorger) >= 4 + return alt_data.questInfo + and alt_data.questInfo.daily + and PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.daily.relic_gorger) >= 4 end, - group = 'resetDaily', - version = WOW_PROJECT_MAINLINE + group = "resetDaily", + version = WOW_PROJECT_MAINLINE, }, helsworn_chest = { - label = L['Helsworn Chest'], - type = 'quest', - questType = 'daily', - visibility = 'hidden', + label = L["Helsworn Chest"], + type = "quest", + questType = "daily", + visibility = "hidden", plus = true, isComplete = function(alt_data) - return alt_data.questInfo and alt_data.questInfo.daily and - PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.daily.helsworn_chest) >= 1 + return alt_data.questInfo + and alt_data.questInfo.daily + and PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.daily.helsworn_chest) >= 1 end, - group = 'resetDaily', - version = WOW_PROJECT_MAINLINE + group = "resetDaily", + version = WOW_PROJECT_MAINLINE, }, assault_vessels = { - label = L['Assault Vessels'], - type = 'quest', - questType = 'weekly', - visibility = 'hidden', + label = L["Assault Vessels"], + type = "quest", + questType = "weekly", + visibility = "hidden", required = 4, tooltip = function(button, alt_data, column) PermoksAccountManager:QuestTooltip_OnEnter(button, alt_data, column) end, isComplete = function(alt_data) - return alt_data.questInfo and alt_data.questInfo.weekly and - PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.weekly.assault_vessels) >= 2 + return alt_data.questInfo + and alt_data.questInfo.weekly + and PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.weekly.assault_vessels) >= 2 end, - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, rift_vessels = { - label = L['Rift Vessels'], - type = 'quest', - questType = 'weekly', - visibility = 'hidden', + label = L["Rift Vessels"], + type = "quest", + questType = "weekly", + visibility = "hidden", required = 3, isComplete = function(alt_data) - return alt_data.questInfo and alt_data.questInfo.weekly and - PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.weekly.hidden.rift_vessels) >= 3 + return alt_data.questInfo + and alt_data.questInfo.weekly + and PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.weekly.hidden.rift_vessels) >= 3 end, - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, adamant_vault_conduit = { - label = L['AV Conduit'], - type = 'quest', - questType = 'weekly', - visibility = 'hidden', + label = L["AV Conduit"], + type = "quest", + questType = "weekly", + visibility = "hidden", isComplete = function(alt_data) - return alt_data.questInfo and alt_data.questInfo.weekly and - PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.weekly.hidden.adamant_vault_conduit) == 1 + return alt_data.questInfo + and alt_data.questInfo.weekly + and PermoksAccountManager:GetNumCompletedQuests( + alt_data.questInfo.weekly.hidden.adamant_vault_conduit + ) + == 1 end, - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, maw_dailies = { - label = L['Maw Dailies'], - type = 'quest', - questType = 'daily', - visibility = 'visible', - required = 2, - isComplete = function(alt_data) - return alt_data.questInfo and alt_data.questInfo.daily and - PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.daily.maw_dailies) >= 2 - end, - group = 'resetDaily', - version = WOW_PROJECT_MAINLINE - }, - dungeon_quests = { - label = L['Dungeon Quests'], - type = 'quest', - questType = 'weekly', - visibility = 'visible', - required = 2, - isComplete = function(alt_data) - return alt_data.questInfo and alt_data.questInfo.weekl and - PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.weekly.dungeon_quests) == 2 - end, - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE - }, - pvp_quests = { - label = L['PVP Quests'], - type = 'quest', - questType = 'weekly', - visibility = 'visible', + label = L["Maw Dailies"], + type = "quest", + questType = "daily", + visibility = "visible", required = 2, isComplete = function(alt_data) - return alt_data.questInfo and alt_data.questInfo.weekly and - PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.weekly.pvp_quests) == 2 + return alt_data.questInfo + and alt_data.questInfo.daily + and PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.daily.maw_dailies) >= 2 end, - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE - }, - weekend_event = { - label = L['Weekend Event'], - type = 'quest', - questType = 'weekly', - visibility = 'visible', - isComplete = function(alt_data) - return alt_data.questInfo and alt_data.questInfo.weekly and - PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.weekly.weekend_event) == 1 - end, - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE - }, - world_boss = { - label = L['World Boss'], - type = 'quest', - questType = 'weekly', - visibility = 'hidden', - isCompleteTest = true, - isComplete = function(alt_data) - return alt_data.questInfo and alt_data.questInfo.weekly and - PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.weekly.hidden.world_boss) == 2 - end, - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + group = "resetDaily", + version = WOW_PROJECT_MAINLINE, }, korthia_world_boss = { - label = 'Korthia WB', - type = 'quest', - questType = 'weekly', - visibility = 'hidden', - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + label = "World Boss Korthia", + type = "quest", + questType = "weekly", + visibility = "hidden", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, anima_weekly = { - label = L['1k Anima'], - type = 'quest', - questType = 'weekly', - visibility = 'visible', + label = L["1k Anima"], + type = "quest", + questType = "weekly", + visibility = "visible", isComplete = function(alt_data) - return alt_data.questInfo and alt_data.questInfo.weekly and - PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.weekly.visible.anima_weekly) == 1 + return alt_data.questInfo + and alt_data.questInfo.weekly + and PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.weekly.visible.anima_weekly) == 1 end, - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, maw_souls = { - label = L['Return Souls'], - type = 'quest', - questType = 'weekly', - visibility = 'visible', + label = L["Return Souls"], + type = "quest", + questType = "weekly", + visibility = "visible", isComplete = function(alt_data) - return alt_data.questInfo and alt_data.questInfo.weekly and - PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.weekly.visible.maw_souls) == 1 + return alt_data.questInfo + and alt_data.questInfo.weekly + and PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.weekly.visible.maw_souls) == 1 end, - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, korthia_weekly = { - label = L['Korthia Weekly'], - type = 'quest', - questType = 'weekly', - visibility = 'visible', + label = L["Korthia Weekly"], + type = "quest", + questType = "weekly", + visibility = "visible", isComplete = function(alt_data) - return alt_data.questInfo and alt_data.questInfo.weekly and - PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.weekly.visible.korthia_weekly) == 1 + return alt_data.questInfo + and alt_data.questInfo.weekly + and PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.weekly.visible.korthia_weekly) + == 1 end, - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, tormentors_weekly = { - label = L['Tormentors'], - type = 'quest', - questType = 'weekly', - visibility = 'hidden', + label = L["Tormentors"], + type = "quest", + questType = "weekly", + visibility = "hidden", isComplete = function(alt_data) - return alt_data.questInfo and alt_data.questInfo.weekly and - PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.weekly.hidden.tormentors_weekly) >= 1 + return alt_data.questInfo + and alt_data.questInfo.weekly + and PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.weekly.hidden.tormentors_weekly) + >= 1 end, - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, tormentors_locations = { - label = L['Tormentors Rep'], - type = 'quest', - questType = 'weekly', - visibility = 'hidden', + label = L["Tormentors Rep"], + type = "quest", + questType = "weekly", + visibility = "hidden", required = 6, isComplete = function(alt_data) - return alt_data.questInfo and alt_data.questInfo.weekly and - PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.weekly.tormentors_locations) >= 1 + return alt_data.questInfo + and alt_data.questInfo.weekly + and PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.weekly.tormentors_locations) >= 1 end, - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, maw_assault = { - label = L['Maw Assault'], - type = 'quest', - questType = 'weekly', - visibility = 'hidden', + label = L["Maw Assault"], + type = "quest", + questType = "weekly", + visibility = "hidden", required = 2, isComplete = function(alt_data) - return alt_data.questInfo and alt_data.questInfo.weekly and - PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.weekly.hidden.assault) >= 2 + return alt_data.questInfo + and alt_data.questInfo.weekly + and PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.weekly.hidden.assault) >= 2 end, - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, battle_plans = { - label = L['Maw Battle Plans'], - type = 'quest', - questType = 'weekly', - visibility = 'visible', + label = L["Maw Battle Plans"], + type = "quest", + questType = "weekly", + visibility = "visible", isComplete = function(alt_data) - return alt_data.questInfo and alt_data.questInfo.weekly and - PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.weekly.battle_plans) == 1 + return alt_data.questInfo + and alt_data.questInfo.weekly + and PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.weekly.battle_plans) == 1 end, - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, korthia_supplies = { - label = L['Korthia Supplies'], - type = 'quest', - questType = 'weekly', - visibility = 'visible', + label = L["Korthia Supplies"], + type = "quest", + questType = "weekly", + visibility = "visible", isComplete = function(alt_data) - return alt_data.questInfo and alt_data.questInfo.weekly and - PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.weekly.korthia_supplies) == 1 + return alt_data.questInfo + and alt_data.questInfo.weekly + and PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.weekly.korthia_supplies) == 1 end, - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, containing_the_helsworn = { - label = L['Maw WQ'], - type = 'quest', - questType = 'weekly', - visibility = 'hidden', - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + label = L["Maw WQ"], + type = "quest", + questType = "weekly", + visibility = "hidden", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, wrath = { - label = L['Wrath of the Jailer'], - type = 'quest', - questType = 'weekly', - visibility = 'hidden', + label = L["Wrath of the Jailer"], + type = "quest", + questType = "weekly", + visibility = "hidden", isComplete = function(alt_data) - return alt_data.questInfo and alt_data.questInfo.weekly and - PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.weekly.wrath) == 1 + return alt_data.questInfo + and alt_data.questInfo.weekly + and PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.weekly.wrath) == 1 end, - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, hunt = { - label = L['The Hunt'], - type = 'quest', - questType = 'weekly', - visibility = 'hidden', + label = L["The Hunt"], + type = "quest", + questType = "weekly", + visibility = "hidden", isComplete = function(alt_data) - return alt_data.questInfo and alt_data.questInfo.weekly and - PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.weekly.hunt) == 1 + return alt_data.questInfo + and alt_data.questInfo.weekly + and PermoksAccountManager:GetNumCompletedQuests(alt_data.questInfo.weekly.hunt) == 1 end, - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, --- 9.2 sandworn_chest = { - label = 'Sandworn Chest', - type = 'quest', - questType = 'daily', - visibility = 'hidden', - group = 'resetDaily', - version = WOW_PROJECT_MAINLINE + label = "Sandworn Chest", + type = "quest", + questType = "daily", + visibility = "hidden", + group = "resetDaily", + version = WOW_PROJECT_MAINLINE, }, zereth_mortis_dailies = { - label = 'Dailies', - type = 'quest', - questType = 'daily', - visibility = 'visible', + label = "Dailies", + type = "quest", + questType = "daily", + visibility = "visible", required = 2, unlock = { - key = 'zereth_mortis_three_dailies', - charKey = 'researchInfo', + key = "zereth_mortis_three_dailies", + charKey = "researchInfo", required = 3, }, - group = 'resetDaily', - version = WOW_PROJECT_MAINLINE + group = "resetDaily", + version = WOW_PROJECT_MAINLINE, }, zereth_mortis_weekly = { - label = 'Patterns', - type = 'quest', - questType = 'weekly', - visibility = 'visible', - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + label = "Patterns", + type = "quest", + questType = "weekly", + visibility = "visible", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, zereth_mortis_wqs = { - label = 'ZM WQs', - type = 'quest', - questType = 'daily', - visibility = 'hidden', + label = "ZM WQs", + type = "quest", + questType = "daily", + visibility = "hidden", required = 2, unlock = { - key = 'zereth_mortis_three_wqs', - charKey = 'researchInfo', + key = "zereth_mortis_three_wqs", + charKey = "researchInfo", required = 3, }, - group = 'resetDaily', - version = WOW_PROJECT_MAINLINE + group = "resetDaily", + version = WOW_PROJECT_MAINLINE, }, zereth_mortis_world_boss = { - label = 'ZM WB', - type = 'quest', - questType = 'weekly', - visibility = 'hidden', - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + label = "ZM WB", + type = "quest", + questType = "weekly", + visibility = "hidden", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, jiro_cyphers = { - label = 'Jiro Cyphers', - type = 'quest', - questType = 'daily', - visibility = 'hidden', + label = "Jiro Cyphers", + type = "quest", + questType = "daily", + visibility = "hidden", required = 3, - group = 'resetDaily', - version = WOW_PROJECT_MAINLINE + group = "resetDaily", + version = WOW_PROJECT_MAINLINE, }, puzzle_caches = { - label = 'Puzzle Caches', - type = 'quest', - questType = 'daily', - visibility = 'hidden', + label = "Puzzle Caches", + type = "quest", + questType = "daily", + visibility = "hidden", required = 5, - group = 'resetDaily', - version = WOW_PROJECT_MAINLINE + group = "resetDaily", + version = WOW_PROJECT_MAINLINE, }, + + -- 10.0 Dragonflight dragonflight_world_boss = { - label = L['World Boss'], - type = 'quest', - questType = 'weekly', - visibility = 'hidden', - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + label = "World Boss DF", + type = "quest", + questType = "weekly", + visibility = "hidden", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, aiding_the_accord = { - label = 'Aiding the Accord', - type = 'quest', - questType = 'weekly', - visibility = 'visible', - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + label = "Aiding the Accord", + type = "quest", + questType = "weekly", + visibility = "visible", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, grand_hunts = { - label = 'Grand Hunts', - type = 'quest', - questType = 'weekly', - visibility = 'hidden', - group = 'resetWeekly', + label = "Grand Hunts", + type = "quest", + questType = "weekly", + visibility = "hidden", + group = "resetWeekly", required = 3, - version = WOW_PROJECT_MAINLINE + version = WOW_PROJECT_MAINLINE, }, marrukai_camp = { - label = 'Maruukai Camp', - type = 'quest', - questType = 'biweekly', - visibility = 'visible', - group = 'resetBiweekly', + label = "Maruukai Camp", + type = "quest", + questType = "biweekly", + visibility = "visible", + group = "resetBiweekly", required = 4, - version = WOW_PROJECT_MAINLINE - }, - sparks_of_life = { - label = 'Sparks of Life', - type = 'quest', - questType = 'weekly', - visibility = 'visible', - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + version = WOW_PROJECT_MAINLINE, }, brackenhide_hollow_rares = { - label = 'Brackenhide Rares', - type = 'quest', - questType = 'daily', - visibility = 'hidden', - group = 'resetDaily', + label = "Brackenhide Rares", + type = "quest", + questType = "daily", + visibility = "hidden", + group = "resetDaily", tooltip = true, customTooltip = function(...) PermoksAccountManager:CompletedQuestsTooltip_OnEnter(...) end, required = 4, - version = WOW_PROJECT_MAINLINE + version = WOW_PROJECT_MAINLINE, }, trial_of_flood = { - label = 'Trial of Flood', - type = 'quest', - questType = 'weekly', - visibility = 'hidden', - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + label = "Trial of Flood", + type = "quest", + questType = "weekly", + visibility = "hidden", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, trial_of_elements = { - label = 'Trial of Elements', - type = 'quest', - questType = 'weekly', - visibility = 'hidden', - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + label = "Trial of Elements", + type = "quest", + questType = "weekly", + visibility = "hidden", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, trial_of_storms = { - label = 'Trial of Storms', - type = 'quest', - questType = 'weekly', - visibility = 'hidden', - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE - }, - knowledge_mobs = { - label = 'Gather Knowledge', - type = 'quest', - questType = 'weekly', - visibility = 'hidden', + label = "Trial of Storms", + type = "quest", + questType = "weekly", + visibility = "hidden", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, + }, + knowledge_df_mobs = { + label = "(DF) Gather Knowledge", + type = "quest", + questType = "weekly", + visibility = "hidden", tooltip = true, customTooltip = function(...) PermoksAccountManager:KnowledgeTooltip_OnEnter(...) @@ -535,14 +574,14 @@ local labelRows = { [186] = 6, [393] = 6, }, - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE - }, - knowledge_scout_packs = { - label = 'Treasure Knowledge', - type = 'quest', - questType = 'weekly', - visibility = 'hidden', + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, + }, + knowledge_df_treasures = { + label = "(DF) Treasure Knowledge", + type = "quest", + questType = "weekly", + visibility = "hidden", tooltip = true, customTooltip = function(...) PermoksAccountManager:KnowledgeTooltip_OnEnter(...) @@ -553,28 +592,28 @@ local labelRows = { [186] = -2, [393] = -2, }, - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE - }, - knowledge_treatise = { - label = 'Treatise Knowledge', - type = 'quest', - questType = 'weekly', - visibility = 'hidden', + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, + }, + knowledge_df_treatise = { + label = "(DF) Treatise Knowledge", + type = "quest", + questType = "weekly", + visibility = "hidden", tooltip = true, customTooltip = function(...) PermoksAccountManager:KnowledgeTooltip_OnEnter(...) end, tooltipRequired = 1, required = 2, - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE - }, - knowledge_weeklies_craft = { - label = 'Crafting Quests', - type = 'quest', - questType = 'weekly', - visibility = 'visible', + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, + }, + knowledge_df_weeklies_craft = { + label = "(DF) Crafting Quests", + type = "quest", + questType = "weekly", + visibility = "visible", tooltip = true, customTooltip = function(...) PermoksAccountManager:CompletedQuestsTooltip_OnEnter(...) @@ -585,27 +624,27 @@ local labelRows = { [186] = -1, [393] = -1, }, - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE - }, - knowledge_weeklies_loot = { - label = 'Loot Quests', - type = 'quest', - questType = 'weekly', - visibility = 'visible', + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, + }, + knowledge_df_weeklies_loot = { + label = "(DF) Loot Quests", + type = "quest", + questType = "weekly", + visibility = "visible", tooltip = true, customTooltip = function(...) PermoksAccountManager:CompletedQuestsTooltip_OnEnter(...) end, required = 2, - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE - }, - knowledge_weeklies_order ={ - label = 'Crafting Order Quests', - type = 'quest', - questType = 'weekly', - visibility = 'visible', + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, + }, + knowledge_df_weeklies_order = { + label = "(DF) Crafting Order Quests", + type = "quest", + questType = "weekly", + visibility = "visible", tooltip = true, customTooltip = function(...) PermoksAccountManager:CompletedQuestsTooltip_OnEnter(...) @@ -618,472 +657,1033 @@ local labelRows = { [333] = -1, [393] = -1, }, - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, community_feast = { - label = 'Community Feast', - type = 'quest', - questType = 'daily', - visibility = 'hidden', - group = 'resetDaily', - version = WOW_PROJECT_MAINLINE + label = "Community Feast", + type = "quest", + questType = "daily", + visibility = "hidden", + group = "resetDaily", + version = WOW_PROJECT_MAINLINE, }, iskaara_story = { - label = 'Iskaara Story Scroll', - type = 'quest', - questType = 'weekly', - visibility = 'visible', - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + label = "Iskaara Story Scroll", + type = "quest", + questType = "weekly", + visibility = "visible", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, obsidian_citadel_rares = { - label = 'Obsidian Citadel Rares', - type = 'quest', - questType = 'daily', - visibility = 'hidden', + label = "Obsidian Citadel Rares", + type = "quest", + questType = "daily", + visibility = "hidden", tooltip = true, customTooltip = function(...) PermoksAccountManager:CompletedQuestsTooltip_OnEnter(...) end, required = 8, - group = 'resetDaily', - version = WOW_PROJECT_MAINLINE + group = "resetDaily", + version = WOW_PROJECT_MAINLINE, }, fish_turnins_df = { - label = 'Fish Turn Ins', - type = 'quest', - questType = 'weekly', - visibility = 'hidden', + label = "Fish Turn Ins", + type = "quest", + questType = "weekly", + visibility = "hidden", tooltip = true, customTooltip = function(...) PermoksAccountManager:CompletedQuestsTooltip_OnEnter(...) end, required = 6, - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, tyrhold_rares = { - label = 'Tyrhold Rare', - type = 'quest', - questType = 'daily', + label = "Tyrhold Rare", + type = "quest", + questType = "daily", tooltip = true, customTooltip = function(...) PermoksAccountManager:CompletedQuestsTooltip_OnEnter(...) end, - visibility = 'hidden', - group = 'resetDaily', - version = WOW_PROJECT_MAINLINE + visibility = "hidden", + group = "resetDaily", + version = WOW_PROJECT_MAINLINE, }, iskaara_fishing_dailies = { - label = 'Iskaara Dailies', - type = 'quest', - questType = 'daily', - visibility = 'visible', + label = "Iskaara Dailies", + type = "quest", + questType = "daily", + visibility = "visible", required = 2, - group = 'resetDaily', - version = WOW_PROJECT_MAINLINE + group = "resetDaily", + version = WOW_PROJECT_MAINLINE, }, forbidden_reach_weeklies = { - label = 'FR Weeklies', - type = 'quest', - questType = 'weekly', - visibility = 'visible', + label = "FR Weeklies", + type = "quest", + questType = "weekly", + visibility = "visible", required = 5, - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, forbidden_reach_elite_wqs = { - label = 'FR WQ', - type = 'quest', - questType = 'weekly', - visibility = 'visible', - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + label = "FR WQ", + type = "quest", + questType = "weekly", + visibility = "visible", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, forbidden_reach_tasks = { - label = 'FR Dailies', - type = 'quest', - questType = 'daily', - visibility = 'visible', + label = "FR Dailies", + type = "quest", + questType = "daily", + visibility = "visible", required = 2, - group = 'resetDaily', - version = WOW_PROJECT_MAINLINE + group = "resetDaily", + version = WOW_PROJECT_MAINLINE, }, forbidden_reach_task_picked = { - label = 'FR Faction Picked', - type = 'quest', - questType = 'daily', - visibility = 'visible', - group = 'resetDaily', - version = WOW_PROJECT_MAINLINE + label = "FR Faction Picked", + type = "quest", + questType = "daily", + visibility = "visible", + group = "resetDaily", + version = WOW_PROJECT_MAINLINE, }, community_feast_weekly = { - label = 'Community Feast', - type = 'quest', - questType = 'weekly', - visibility = 'visible', - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + label = "Community Feast", + type = "quest", + questType = "weekly", + visibility = "visible", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, dragonbane_keep_siege = { - label = 'Siege', - type = 'quest', - questType = 'weekly', - visibility = 'hidden', - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + label = "Siege", + type = "quest", + questType = "weekly", + visibility = "hidden", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, dragonbane_keep_key = { - label = 'Citadel WQ', - type = 'quest', - questType = 'weekly', - visibility = 'visible', - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + label = "Citadel WQ", + type = "quest", + questType = "weekly", + visibility = "visible", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, dragonbane_keep_weeklies = { - label = 'Citadel Weeklies', - type = 'quest', - questType = 'weekly', - visibility = 'visible', + label = "Citadel Weeklies", + type = "quest", + questType = "weekly", + visibility = "visible", tooltip = true, customTooltip = function(...) PermoksAccountManager:CompletedQuestsTooltip_OnEnter(...) end, required = 6, - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, show_your_mettle = { - label = 'Show Your Mettle', - type = 'quest', - questType = 'weekly', - visibility = 'visible', - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + label = "Show Your Mettle", + type = "quest", + questType = "weekly", + visibility = "visible", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, loamm_niffen_weekly = { - label = 'AWA: Cavern', - type = 'quest', - questType = 'weekly', - visibility = 'visible', - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + label = "AWA: Cavern", + type = "quest", + questType = "weekly", + visibility = "visible", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, researchers_under_fire_weekly = { - label = 'Under Fire', - type = 'quest', - questType = 'weekly', - visibility = 'hidden', - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + label = "Under Fire", + type = "quest", + questType = "weekly", + visibility = "hidden", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, zc_wb_wq = { - label = 'Zaralek WB', - type = 'quest', - questType = 'weekly', - visibility = 'visible', - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + label = "Zaralek WB", + type = "quest", + questType = "weekly", + visibility = "visible", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, dig_maps_weeklies = { - label = 'Sniffenseeking', - type = 'quest', - questType = 'weekly', + label = "Sniffenseeking", + type = "quest", + questType = "weekly", required = 3, - visibility = 'hidden', - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + visibility = "hidden", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, dig_maps_received_weekly = { - label = 'Dig Maps', - type = 'quest', - questType = 'weekly', + label = "Dig Maps", + type = "quest", + questType = "weekly", required = 2, - visibility = 'hidden', - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + visibility = "hidden", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, proven_weekly = { - label = 'PVP Weekly', - type = 'quest', - questType = 'weekly', - visibility = 'visible', - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + label = "PVP Weekly", + type = "quest", + questType = "weekly", + visibility = "visible", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, fyrak_assault = { - label = 'Fyrak Assault', - type = 'quest', - questType = 'weekly', - visibility = 'hidden', - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + label = "Fyrak Assault", + type = "quest", + questType = "weekly", + visibility = "hidden", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, glimerogg_racer_dailies = { - label = 'Glimerogg Dailies', - type = 'quest', - questType = 'weekly', - visibility = 'visible', - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + label = "Glimerogg Dailies", + type = "quest", + questType = "weekly", + visibility = "visible", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, zyrak_cavern_zone_events = { - label = 'Cavern Zone Events', - type = 'quest', - questType = 'weekly', - visibility = 'hidden', + label = "Cavern Zone Events", + type = "quest", + questType = "weekly", + visibility = "hidden", tooltip = true, customTooltip = function(...) PermoksAccountManager:CompletedQuestsTooltip_OnEnter(...) end, showAll = true, required = 18, - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, time_rift = { - label = 'Time Needs Mending', - type = 'quest', - questType = 'weekly', - visibility = 'visible', - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + label = "Time Needs Mending", + type = "quest", + questType = "weekly", + visibility = "visible", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, time_rift_pod = { - label = 'Time Rift Weekly', - type = 'quest', - questType = 'weekly', - visibility = 'hidden', - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + label = "Time Rift Weekly", + type = "quest", + questType = "weekly", + visibility = "hidden", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, dreamsurge_weekly = { - label = 'Dreamsurge Weekly', - type = 'quest', - questType = 'weekly', - visibility = 'visible', - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + label = "Dreamsurge Weekly", + type = "quest", + questType = "weekly", + visibility = "visible", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, superbloom = { - label = 'Superbloom', - type = 'quest', - questType = 'weekly', - visibility = 'visible', - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + label = "Superbloom", + type = "quest", + questType = "weekly", + visibility = "visible", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, ed_wb_wq = { - label = 'Dream WB', - type = 'quest', - questType = 'weekly', - visibility = 'visible', - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + label = "Dream WB", + type = "quest", + questType = "weekly", + visibility = "visible", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, dream_wardens_weekly = { - label = 'AWA: Dream', - type = 'quest', - questType = 'weekly', - visibility = 'visible', - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + label = "AWA: Dream", + type = "quest", + questType = "weekly", + visibility = "visible", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, dream_shipments = { - label = 'Shipments', - type = 'quest', - questType = 'weekly', + label = "Shipments", + type = "quest", + questType = "weekly", required = 2, - visibility = 'visible', - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + visibility = "visible", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, anniversary_wb = { - label = 'Anniv. WBs.', - type = 'quest', - questType = 'daily', + label = "Anniv. WBs.", + type = "quest", + questType = "daily", tooltip = true, customTooltip = function(...) PermoksAccountManager:CompletedQuestsTooltip_OnEnter(...) end, required = 4, - visibility = 'hidden', - group = 'resetDaily', - version = WOW_PROJECT_MAINLINE - }, - -- 11.0 PREPATCH - radiant_echoes_prepatch_weeklies = { - label = 'Radiant Echoes Weeklies', - type = 'quest', - questType = 'weekly', - visibility = 'visible', + visibility = "hidden", + group = "resetDaily", + version = WOW_PROJECT_MAINLINE, + }, + big_dig = { + label = "The Big Dig", + type = "quest", + questType = "weekly", + warband = true, + visibility = "visible", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, + }, + + -- 11.0 The War Within + -- world activities + tww_world_boss = { + label = "World Boss TWW", + type = "quest", + questType = "weekly", + visibility = "hidden", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, + }, + worldsoul_weekly = { + IDs = { + 82483, + 82489, + 82452, + 82516, + 82458, + 82482, + 82511, + 82486, + 82492, + 82503, + 82453, + 82488, + 82485, + 82659, + 82494, + 82498, + 82490, + 82510, + 82491, + 82504, + 82495, + 82506, + 82496, + 82507, + 82497, + 82508, + 82509, + 82499, + 82500, + 82501, + 82512, + 82505, + 82502, + 82487, + 82493, + }, + label = "Weekly Meta", + type = "quest", + questType = "weekly", + visibility = "visible", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, + }, + --weekly_meta = { -- PLACEHOLDER: Looks like this weekly doesn't reset but is just a timegated questline. Need better solution + -- IDs = {82746, 82712, 82711, 82709, 82706, 82707, 82678, 82679}, + -- label = '(WIP) Weekly Meta', + -- type = 'quest', + -- questType = 'weekly', + -- visibility = 'visible', + -- group = 'resetWeekly', + -- tooltip = true, + -- customTooltip = function(...) + -- PermoksAccountManager:CompletedQuestsTooltip_OnEnter(...) + -- end, + -- required = 8, + -- version = WOW_PROJECT_MAINLINE + -- }, + archaic_cypher_key = { + IDs = { 84370 }, + label = "Archaic Cypher Key", + type = "quest", + questType = "weekly", + warband = "unique", + visibility = "visible", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, + }, + the_theater_troupe = { + IDs = { 83240 }, + label = "The Theater Troupe", + type = "quest", + questType = "weekly", + warband = true, + visibility = "visible", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, + }, + rollin_down_in_the_deeps = { + IDs = { 82946 }, + label = "Wax Weekly", -- Rollin' Down in the Deeps + type = "quest", + questType = "weekly", + warband = true, + visibility = "visible", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, + }, + gearing_up_for_trouble = { + IDs = { 83333 }, + label = "Machine Weekly", -- Gearing Up for Trouble + type = "quest", + questType = "weekly", + visibility = "visible", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, + }, + awakening_the_machine = { + IDs = { 84642, 84644, 84646, 84647 }, + label = "Awakening the Machine", + type = "quest", + questType = "weekly", + warband = true, + visibility = "hidden", + group = "resetWeekly", + required = 4, + version = WOW_PROJECT_MAINLINE, + }, + spreading_the_light = { + IDs = { 76586 }, + label = "Spreading the Light", + type = "quest", + questType = "weekly", + warband = true, + visibility = "visible", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, + }, + lesser_keyflame_weeklies = { + IDs = { + 76169, + 76394, + 76600, + 76733, + 76997, + 78656, + 78915, + 78933, + 78972, + 79158, + 79173, + 79216, + 79346, + 80004, + 80562, + 81574, + 81632, + }, + label = "Lesser Keyflames", + type = "quest", + questType = "weekly", + warband = true, + visibility = "visible", + group = "resetWeekly", + tooltip = true, + customTooltip = function(...) + PermoksAccountManager:CompletedQuestsTooltip_OnEnter(...) + end, + required = 8, + version = WOW_PROJECT_MAINLINE, + }, + greater_keyflame_weeklies = { + IDs = { 78590, 78657, 79329, 79380, 79469, 79470, 79471 }, + label = "Greater Keyflames", + type = "quest", + questType = "weekly", + warband = false, + visibility = "visible", + group = "resetWeekly", tooltip = true, customTooltip = function(...) PermoksAccountManager:CompletedQuestsTooltip_OnEnter(...) end, + required = 7, + version = WOW_PROJECT_MAINLINE, + }, + severed_threads_pact_chosen = { + IDs = { 80544 }, + label = "Severed Threads Pact Chosen", + type = "quest", + questType = "weekly", + warband = "unique", + visibility = "visible", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, + }, + severed_threads_pact_weekly = { + IDs = { 80670, 80671, 80672 }, + label = "Severed Threads", + type = "quest", + questType = "weekly", + warband = true, + visibility = "visible", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, + }, + weekly_delve_reputation = { + IDs = { 83317, 83319, 83318, 83320 }, + label = "Weekly Delve Reputation", + type = "quest", + questType = "weekly", + warband = "unique", + visibility = "hidden", + group = "resetWeekly", + tooltip = true, + customTooltip = function(...) + PermoksAccountManager:CompletedQuestsTooltip_OnEnter(...) + end, + required = 4, + showAll = true, + version = WOW_PROJECT_MAINLINE, + }, + weekly_coffer_keys = { + IDs = { 84736, 84737, 84738, 84739 }, + label = "Weekly Coffer Keys", + type = "quest", + questType = "weekly", + visibility = "hidden", + group = "resetWeekly", + required = 4, + version = WOW_PROJECT_MAINLINE, + }, + -- rares + isle_of_dorne_rares = { + IDs = { 84037, 84031, 84032, 84036, 84029, 84039, 84030, 84028, 84033, 84034, 84026, 84038 }, + label = "Isle of Dorne Rares", + type = "quest", + questType = "weekly", + warband = true, + visibility = "hidden", + group = "resetWeekly", + tooltip = true, + customTooltip = function(...) + PermoksAccountManager:CompletedQuestsTooltip_OnEnter(...) + end, + required = 12, + showAll = true, + version = WOW_PROJECT_MAINLINE, + }, + ringing_deeps_rares = { + IDs = { 84046, 84044, 84042, 84041, 84045, 84040, 84047, 84043, 84049, 84048, 84050 }, + label = "Ringing Deeps Rares", + type = "quest", + questType = "weekly", + warband = true, + visibility = "hidden", + group = "resetWeekly", + tooltip = true, + customTooltip = function(...) + PermoksAccountManager:CompletedQuestsTooltip_OnEnter(...) + end, + required = 11, + showAll = true, + version = WOW_PROJECT_MAINLINE, + }, + hallowfall_rares = { + IDs = { + 84063, + 84051, + 84064, + 84061, + 84066, + 84060, + 84053, + 84056, + 84067, + 84065, + 84062, + 84054, + 84068, + 84052, + 84055, + 84059, + 84058, + 84057, + }, + label = "Hallowfall Rares", + type = "quest", + questType = "weekly", + warband = true, + visibility = "hidden", + group = "resetWeekly", + tooltip = true, + customTooltip = function(...) + PermoksAccountManager:CompletedQuestsTooltip_OnEnter(...) + end, + required = 18, + showAll = true, + version = WOW_PROJECT_MAINLINE, + }, + azj_kahet_rares = { + IDs = { 84071, 84072, 84075, 84073, 84076, 84074, 84080, 84082, 84081, 84079, 84078, 84077, 84069, 84070 }, + label = "Azj-Kahet Rares", + type = "quest", + questType = "weekly", + warband = true, + visibility = "hidden", + group = "resetWeekly", + tooltip = true, + customTooltip = function(...) + PermoksAccountManager:CompletedQuestsTooltip_OnEnter(...) + end, + required = 14, + showAll = true, + version = WOW_PROJECT_MAINLINE, + }, + one_time_reputation_rares = { + IDs = { 85158, 85160, 85161, 85159, 85163, 85164, 85165, 85167, 85166, 85162 }, + label = "One-Time Reputation Rares", + type = "quest", + questType = "weekly", + warband = true, + visibility = "hidden", + group = "resetWeekly", + achievementString = "(REP)", + tooltip = true, + customTooltip = function(...) + PermoksAccountManager:CompletedQuestsTooltip_OnEnter(...) + end, + required = 10, + showAll = true, + version = WOW_PROJECT_MAINLINE, + }, + undermine_rares = { + IDs = { + 84917, + 84918, + 84919, + 84920, + 84921, + 84922, + 84926, + 84927, + 84928, + 85004, + 84877, + 84884, + 84895, + 84907, + 84911, + 86298, + 86307, + 86431, + 86428, + }, + label = "Undermine Rares", + type = "quest", + questType = "weekly", + warband = true, + visibility = "hidden", + group = "resetWeekly", + achievementString = "(REP)", + tooltip = true, + customTooltip = function(...) + PermoksAccountManager:CompletedQuestsTooltip_OnEnter(...) + end, + required = 19, + showAll = true, + version = WOW_PROJECT_MAINLINE, + }, + undermine_weeklies = { + IDS = { + 85869, + 86775, + 85879, + 85553, + 85554, + 85913, + 85914, + 85944, + 85945, + 85960, + 85962, + 86177, + 86178, + 86179, + 86180, + }, + label = "Undermine Weeklies", + type = "quest", + questType = "weekly", + warband = true, + visibility = "visible", + group = "resetWeekly", + tooltip = true, + customTooltip = function(...) + PermoksAccountManager:CompletedQuestsTooltip_OnEnter(...) + end, + required = 7, + showAll = true, + version = WOW_PROJECT_MAINLINE, + }, + weekly_bounti_map = { + IDS = { 86371 }, + label = "Weekly Bount. Map", + type = "quest", + questType = "weekly", + visibility = "hidden", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, + }, + nightfall_weekly = { + IDS = { 89295 }, + label = "Nightfall Weekly", + type = "quest", + questType = "weekly", + visibility = "hidden", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, + }, + + -- professions + knowledge_tww_treasures = { + label = "Loot Knowledge", + type = "quest", + questType = "weekly", + visibility = "hidden", + tooltip = true, + customTooltip = function(...) + PermoksAccountManager:KnowledgeTooltip_OnEnter(...) + end, + required = 4, + professionOffset = { + [182] = -2, + [186] = -2, + [393] = -2, + }, + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, + }, + knowledge_tww_treatise = { + label = "Treatise Knowledge", + type = "quest", + questType = "weekly", + visibility = "hidden", + tooltip = true, + customTooltip = function(...) + PermoksAccountManager:KnowledgeTooltip_OnEnter(...) + end, + tooltipRequired = 1, + required = 2, + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, + }, + knowledge_tww_gather = { + label = "Gather Knowledge", + type = "quest", + questType = "weekly", + visibility = "hidden", + tooltip = true, + customTooltip = function(...) + PermoksAccountManager:KnowledgeTooltip_OnEnter(...) + end, + required = 12, + tooltipRequired = 6, + professionOffset = { + [171] = -6, + [164] = -6, + [202] = -6, + [773] = -6, + [755] = -6, + [165] = -6, + [197] = -6, + }, + professionRequired = { + [182] = 6, + [186] = 6, + [393] = 6, + [333] = 6, + }, + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, + }, + + knowledge_tww_weeklies_quest = { + label = "Profession Quests", + type = "quest", + questType = "weekly", + visibility = "visible", + group = "resetWeekly", + tooltip = true, + customTooltip = function(...) + PermoksAccountManager:CompletedQuestsTooltip_OnEnter(...) + end, + required = 2, + version = WOW_PROJECT_MAINLINE, + }, + + -- 12.0 + saltherils_soiree = { + IDS = { 90573, 90574, 90575, 90576 }, + label = "Soiree (Eversong)", + type = "quest", + questType = "weekly", + visibility = "visible", + group = "resetWeekly", + warband = true, + version = WOW_PROJECT_MAINLINE, + }, + abundance = { + IDS = { 89507 }, + label = "Abundance (Zul'Aman)", + type = "quest", + questType = "weekly", + visibility = "visible", + group = "resetWeekly", + warband = true, + version = WOW_PROJECT_MAINLINE, + }, + lost_legends = { + IDS = { 89268 }, + label = "Legends (Harandar1)", + type = "quest", + questType = "weekly", + visibility = "visible", + group = "resetWeekly", + warband = true, + version = WOW_PROJECT_MAINLINE, + }, + stormarion_assault = { + IDS = { 90962 }, + label = "Assault (Voidstorm)", + type = "quest", + questType = "weekly", + visibility = "visible", + group = "resetWeekly", + warband = true, + version = WOW_PROJECT_MAINLINE, + }, + special_assignments = { + IDS = { 92139, 92145, 93244 }, + label = "Special Assignments", + type = "quest", + questType = "weekly", + visibility = "visible", + group = "resetWeekly", required = 3, - group = 'resetWeekly', - version = WOW_PROJECT_MAINLINE + version = WOW_PROJECT_MAINLINE, + }, + world_boss = { + label = L["World Boss"] .. " Midnight", + type = "quest", + questType = "weekly", + visibility = "visible", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, + }, + preys_nightmare = { + label = "Nightmare Preys", + type = "quest", + questType = "weekly", + visibility = "visible", + group = "resetWeekly", + required = 2, + version = WOW_PROJECT_MAINLINE, + }, + nightmarish_task = { + label = "Nightmarish Task", + type = "quest", + questType = "weekly", + visibility = "visible", + group = "resetWeekly", + version = WOW_PROJECT_MAINLINE, }, --wotlk general_dailies = { - label = 'General', - type = 'quest', - questType = 'daily', - visibility = 'visible', + label = "General", + type = "quest", + questType = "daily", + visibility = "visible", required = 3, - group = 'resetDaily', + group = "resetDaily", version = WOW_PROJECT_CATACLYSM_CLASSIC, }, general_horde_dailies = { - label = 'General Horde', - type = 'quest', - questType = 'daily', - visibility = 'visible', + label = "General Horde", + type = "quest", + questType = "daily", + visibility = "visible", required = 3, - group = 'resetDaily', + group = "resetDaily", version = WOW_PROJECT_CATACLYSM_CLASSIC, }, general_alliance_dailies = { - label = 'General Alliance', - type = 'quest', - questType = 'daily', - visibility = 'visible', + label = "General Alliance", + type = "quest", + questType = "daily", + visibility = "visible", required = 3, - group = 'resetDaily', + group = "resetDaily", version = WOW_PROJECT_CATACLYSM_CLASSIC, }, heroic_dungeon_dailies = { - label = 'Heroic Dungeon', - type = 'quest', - questType = 'daily', - visibility = 'visible', + label = "Heroic Dungeon", + type = "quest", + questType = "daily", + visibility = "visible", required = 2, - group = 'resetDaily', + group = "resetDaily", version = WOW_PROJECT_CATACLYSM_CLASSIC, }, raid_weekly = { - label = 'Raid Weekly', - type = 'quest', - questType = 'weekly', - visibility = 'visible', + label = "Raid Weekly", + type = "quest", + questType = "weekly", + visibility = "visible", required = 1, - group = 'resetWeekly', + group = "resetWeekly", version = WOW_PROJECT_CATACLYSM_CLASSIC, }, argent_crusade_dailies = { - label = 'Argent Crusade', - type = 'quest', - questType = 'daily', - visibility = 'visible', + label = "Argent Crusade", + type = "quest", + questType = "daily", + visibility = "visible", required = 7, - group = 'resetDaily', + group = "resetDaily", version = WOW_PROJECT_CATACLYSM_CLASSIC, }, the_oracles_dailies = { - label = 'Orcales', - type = 'quest', - questType = 'daily', - visibility = 'visible', + label = "Orcales", + type = "quest", + questType = "daily", + visibility = "visible", required = 3, - group = 'resetDaily', + group = "resetDaily", version = WOW_PROJECT_CATACLYSM_CLASSIC, }, frenzyheart_tribe_dailies = { - label = 'Frenzyheart', - type = 'quest', - questType = 'daily', - visibility = 'visible', + label = "Frenzyheart", + type = "quest", + questType = "daily", + visibility = "visible", required = 3, - group = 'resetDaily', + group = "resetDaily", version = WOW_PROJECT_CATACLYSM_CLASSIC, }, knights_of_the_ebon_blade_dailies = { - label = 'Ebon Blade', - type = 'quest', - questType = 'daily', - visibility = 'visible', + label = "Ebon Blade", + type = "quest", + questType = "daily", + visibility = "visible", required = 3, - group = 'resetDaily', + group = "resetDaily", version = WOW_PROJECT_CATACLYSM_CLASSIC, }, the_sons_of_hodir_dailies = { - label = 'Sons of Hodir', - type = 'quest', - questType = 'daily', - visibility = 'visible', + label = "Sons of Hodir", + type = "quest", + questType = "daily", + visibility = "visible", required = 3, - group = 'resetDaily', + group = "resetDaily", version = WOW_PROJECT_CATACLYSM_CLASSIC, }, valiance_expedition_dailies = { - label = 'Expedition', - type = 'quest', - questType = 'daily', - visibility = 'visible', + label = "Expedition", + type = "quest", + questType = "daily", + visibility = "visible", required = 3, - group = 'resetDaily', + group = "resetDaily", version = WOW_PROJECT_CATACLYSM_CLASSIC, }, explorers_league_dailies = { - label = 'Explorers League', - type = 'quest', - questType = 'daily', - visibility = 'visible', + label = "Explorers League", + type = "quest", + questType = "daily", + visibility = "visible", required = 1, - group = 'resetDaily', + group = "resetDaily", version = WOW_PROJECT_CATACLYSM_CLASSIC, }, the_frostborn_dailies = { - label = 'Frostborn', - type = 'quest', - questType = 'daily', + label = "Frostborn", + type = "quest", + questType = "daily", tooltip = true, customTooltip = function(button, ...) PermoksAccountManager:WOTLKDailyQuest_OnEnter(button, ...) end, - visibility = 'visible', + visibility = "visible", required = 1, - group = 'resetDaily', + group = "resetDaily", version = WOW_PROJECT_CATACLYSM_CLASSIC, }, warsong_offensive_dailies = { - label = 'Offensive', - type = 'quest', - questType = 'daily', - visibility = 'visible', + label = "Offensive", + type = "quest", + questType = "daily", + visibility = "visible", required = 3, - group = 'resetDaily', + group = "resetDaily", version = WOW_PROJECT_CATACLYSM_CLASSIC, }, wotlk_cooking_dailies = { - label = 'Cooking', - type = 'quest', - questType = 'daily', - visibility = 'visible', + label = "Cooking", + type = "quest", + questType = "daily", + visibility = "visible", required = 1, - group = 'resetDaily', + group = "resetDaily", version = WOW_PROJECT_CATACLYSM_CLASSIC, }, wotlk_fishing_dailies = { - label = 'Fishing', - type = 'quest', - questType = 'daily', - visibility = 'visible', + label = "Fishing", + type = "quest", + questType = "daily", + visibility = "visible", required = 1, - group = 'resetDaily', + group = "resetDaily", version = WOW_PROJECT_CATACLYSM_CLASSIC, }, wotlk_jewelcrafting_dailies = { - label = 'Jewelcrafting', - type = 'quest', - questType = 'daily', - visibility = 'visible', + label = "Jewelcrafting", + type = "quest", + questType = "daily", + visibility = "visible", required = 1, - group = 'resetDaily', + group = "resetDaily", version = WOW_PROJECT_CATACLYSM_CLASSIC, }, } @@ -1093,37 +1693,63 @@ local function UpdateCataDailies(charInfo) charInfo.completedDailies.num = GetDailyQuestsCompleted() end +local function UpdateWorldQuests(charInfo, questID) + charInfo.completedWorldQuests = charInfo.completedWorldQuests or {} + charInfo.completedWorldQuests[questID] = true +end + local function GetQuestInfo(questLogIndex) if not PermoksAccountManager.isRetail then - local title, _, _, isHeader, _, _, frequency, questID, _, _, _, _, _, _, _, isHidden = GetQuestLogTitle(questLogIndex) + local title, _, _, isHeader, _, _, frequency, questID, _, _, _, _, _, _, _, isHidden = + GetQuestLogTitle(questLogIndex) return { title = title, isHeader = isHeader, frequency = frequency, isHidden = isHidden, questID = questID } else return C_QuestLog.GetInfo and C_QuestLog.GetInfo(questLogIndex) end end +local function setQuestInfo(questInfo, info, key) + local visibleType = info.log and "visible" or "hidden" + + questInfo[info.questType] = questInfo[info.questType] or {} + questInfo[info.questType][visibleType] = questInfo[info.questType][visibleType] or {} + questInfo[info.questType][visibleType][key] = questInfo[info.questType][visibleType][key] or {} + return questInfo[info.questType][visibleType][key] +end + local function UpdateAllQuests(charInfo) local self = PermoksAccountManager - charInfo.questInfo = charInfo.questInfo or default + charInfo.questInfo = charInfo.questInfo or CopyTable(default) + self.warbandData.questInfo = self.isRetail and (self.warbandData.questInfo or CopyTable(default)) local covenant = self.isRetail and (charInfo.covenant or C_Covenants.GetActiveCovenantID()) + local questInfo = charInfo.questInfo + local warbandQuestInfo = self.warbandData.questInfo for key, quests in pairs(self.quests) do for questID, info in pairs(quests) do - local visibleType = info.log and 'visible' or 'hidden' - - questInfo[info.questType] = questInfo[info.questType] or {} - questInfo[info.questType][visibleType] = questInfo[info.questType][visibleType] or {} - questInfo[info.questType][visibleType][key] = questInfo[info.questType][visibleType][key] or {} - local currentQuestInfo = questInfo[info.questType][visibleType][key] local isComplete = C_QuestLog.IsQuestFlaggedCompleted(questID) + local currentQuestInfo = setQuestInfo(questInfo, info, key) if not self.isBC then + -- check for weekly Warband Rewards + if info.warband then + local currentWarbandQuestInfo = setQuestInfo(warbandQuestInfo, info, key) + + -- API CURRENTLY NOT FUNCTIONING AS INTENDED + -- local isWarbandComplete = C_QuestLog.IsQuestFlaggedCompletedOnAccount(questID) + -- Workaround, but requires login on character that completed the quest: + local isWarbandComplete = isComplete + currentWarbandQuestInfo[questID] = currentWarbandQuestInfo[questID] or isWarbandComplete or nil + end + + -- covenant stuff if info.covenant and covenant == info.covenant then local sanctumTier if info.sanctum and charInfo.sanctumInfo then - sanctumTier = charInfo.sanctumInfo[info.sanctum] and charInfo.sanctumInfo[info.sanctum].tier or 0 - questInfo['max' .. key] = max(1, sanctumTier) + sanctumTier = charInfo.sanctumInfo[info.sanctum] and charInfo.sanctumInfo[info.sanctum].tier + or 0 + questInfo["max" .. key] = max(1, sanctumTier) end if not info.sanctum or (sanctumTier and sanctumTier >= info.minSanctumTier) then @@ -1144,10 +1770,12 @@ local function UpdateAllHiddenQuests(charInfo) if not charInfo.questInfo then UpdateAllQuests(charInfo) end - self:Debug('Update Hidden Quests') + self:Debug("Update Hidden Quests") + + local warbandInfo = self.isRetail and self.warbandData or nil for questType, keys in pairs(charInfo.questInfo) do - if type(keys) == 'table' and keys.hidden then + if type(keys) == "table" and keys.hidden then for key, _ in pairs(keys.hidden) do if self.quests[key] then for questID, questData in pairs(self.quests[key]) do @@ -1156,6 +1784,17 @@ local function UpdateAllHiddenQuests(charInfo) isComplete = C_QuestLog.IsQuestFlaggedCompleted(questID) end charInfo.questInfo[questType].hidden[key][questID] = isComplete or nil + + if + warbandInfo + and questData.warband + and warbandInfo.questInfo[questType] + and warbandInfo.questInfo[questType].hidden + and warbandInfo.questInfo[questType].hidden[key] + and not warbandInfo.questInfo[questType].hidden[key][questID] + then + warbandInfo.questInfo[questType].hidden[key][questID] = isComplete or nil + end end end end @@ -1178,24 +1817,28 @@ do end end +-- classic function local function AddQuest(_, questID, questLogIndex, questInfo) local self = PermoksAccountManager - local questLogIndex = questLogIndex or - (self.isBC and GetQuestLogIndexByID(questID) or C_QuestLog.GetLogIndexForQuestID(questID)) + local questLogIndex = questLogIndex + or (self.isBC and GetQuestLogIndexByID(questID) or C_QuestLog.GetLogIndexForQuestID(questID)) if questLogIndex then local questInfo = questInfo or GetQuestInfo(questLogIndex) self.db.global.quests[questID] = { frequency = questInfo.frequency, name = questInfo.title } end end +-- classic function local function RemoveQuest(_, questID) if questID then PermoksAccountManager.db.global.quests[questID] = nil end end +-- classic function local function UpdateCurrentlyActiveQuests(charInfo) - local numQuests = C_QuestLog and C_QuestLog.GetNumQuestLogEntries and C_QuestLog.GetNumQuestLogEntries() or GetNumQuestLogEntries() + local numQuests = C_QuestLog and C_QuestLog.GetNumQuestLogEntries and C_QuestLog.GetNumQuestLogEntries() + or GetNumQuestLogEntries() local info for questLogIndex = 1, numQuests do info = GetQuestInfo(questLogIndex) @@ -1219,28 +1862,45 @@ local function UpdateQuest(charInfo, questID) UpdateCataDailies(charInfo) end + if C_QuestLog.IsWorldQuest and C_QuestLog.IsWorldQuest(questID) then + UpdateWorldQuests(charInfo, questID) + end + local key = self:FindQuestKeyByQuestID(questID) if not key then return end + local warbandInfo = self.isRetail and self.warbandData or nil + local questInfo = self.quests[key][questID] - local questType, visibility = questInfo.questType, questInfo.log and 'visible' or 'hidden' - self:Debug('Update', questType, visibility, key, questID) + local questType, visibility = questInfo.questType, questInfo.log and "visible" or "hidden" + self:Debug("Update", questType, visibility, key, questID) if questType and visibility and key and charInfo.questInfo[questType][visibility][key] then - if self.isCata and questType == 'daily' then + if self.isCata and questType == "daily" then UpdateCataDailies(charInfo) end charInfo.questInfo[questType][visibility][key][questID] = true + if warbandInfo and warbandInfo.questInfo[questType][visibility][key] then + warbandInfo.questInfo[questType][visibility][key][questID] = true + end + RemoveQuest(charInfo, questID) end end +local function CreateWorldQuestString(completedWorldQuests) + return PermoksAccountManager:GetNumCompletedQuests(completedWorldQuests) +end + +-- module init local function Update(charInfo) - UpdateAllQuests(charInfo) - UpdateCurrentlyActiveQuests(charInfo) - UpdateCataDailies(charInfo) + C_Timer.After(15, function() + UpdateAllQuests(charInfo) + UpdateCurrentlyActiveQuests(charInfo) + UpdateCataDailies(charInfo) + end) end do @@ -1248,22 +1908,27 @@ do update = Update, labels = labelRows, events = { - ['QUEST_ACCEPTED'] = AddQuest, - ['QUEST_TURNED_IN'] = UpdateQuest, - ['QUEST_REMOVED'] = RemoveQuest, - ['QUEST_LOG_UPDATE'] = {HiddenQuestTimer}, + ["QUEST_ACCEPTED"] = AddQuest, + ["QUEST_TURNED_IN"] = UpdateQuest, + ["QUEST_REMOVED"] = RemoveQuest, + ["QUEST_LOG_UPDATE"] = { HiddenQuestTimer }, }, share = { - [HiddenQuestTimer] = 'questInfo', - [UpdateQuest] = 'questInfo' - } + [HiddenQuestTimer] = "questInfo", + [UpdateQuest] = "questInfo", + }, } if PermoksAccountManager.isCata then tinsert(payload.events.QUEST_LOG_UPDATE, UpdateCataDailies) end - PermoksAccountManager:AddModule(module, payload) + local module = PermoksAccountManager:AddModule(module, payload) + module:AddCustomLabelType("worldquest", CreateWorldQuestString, true, "completedWorldQuests") +end + +if PermoksAccountManager.isCata then + tinsert(payload.events.QUEST_LOG_UPDATE, UpdateCataDailies) end function PermoksAccountManager:FindQuestKeyByQuestID(questID) @@ -1305,21 +1970,25 @@ function PermoksAccountManager:GetNumCompletedQuests(questInfo) return numCompleted end -function PermoksAccountManager:CreateQuestString(questInfo, numDesired, replaceWithPlus) +function PermoksAccountManager:CreateQuestString(questInfo, numDesired, replaceWithPlus, capAtDesired) if not questInfo or not numDesired then return end - local numCompleted = type(questInfo) == 'table' and self:GetNumCompletedQuests(questInfo) or questInfo + local numCompleted = type(questInfo) == "table" and self:GetNumCompletedQuests(questInfo) or questInfo if replaceWithPlus and numCompleted >= numDesired then - return string.format('|cff00ff00%s|r', self.db.global.options.questCompletionString) + return string.format("|cff00ff00%s|r", self.db.global.options.questCompletionString) else - return self:CreateFractionString(numCompleted, numDesired) + return self:CreateFractionString(capAtDesired and min(numDesired, numCompleted) or numCompleted, numDesired) end end function PermoksAccountManager:QuestTooltip_OnEnter(button, alt_data, column) - if not alt_data or not alt_data.questInfo or not alt_data.questInfo[column.reset] or - not alt_data.questInfo[column.reset][column.visibility] then + if + not alt_data + or not alt_data.questInfo + or not alt_data.questInfo[column.reset] + or not alt_data.questInfo[column.reset][column.visibility] + then return end local info = alt_data.questInfo[column.questType][column.visibility][column.key] @@ -1331,8 +2000,8 @@ function PermoksAccountManager:QuestTooltip_OnEnter(button, alt_data, column) local completedByName = {} for questId, isComplete in pairs(info) do if isComplete and quests[questId] and quests[questId].name then - completedByName[quests[questId].name] = completedByName[quests[questId].name] or - { num = 0, total = quests[questId].total } + completedByName[quests[questId].name] = completedByName[quests[questId].name] + or { num = 0, total = quests[questId].total } completedByName[quests[questId].name].num = completedByName[quests[questId].name].num + 1 end end @@ -1340,7 +2009,7 @@ function PermoksAccountManager:QuestTooltip_OnEnter(button, alt_data, column) if not next(completedByName) then return end - local tooltip = LibQTip:Acquire(addonName .. 'Tooltip', 2, 'LEFT', 'RIGHT') + local tooltip = LibQTip:Acquire(addonName .. "Tooltip", 2, "LEFT", "RIGHT") button.tooltip = tooltip for name, completionInfo in pairs(completedByName) do tooltip:AddLine(name, self:CreateFractionString(completionInfo.num, completionInfo.total)) @@ -1351,8 +2020,12 @@ function PermoksAccountManager:QuestTooltip_OnEnter(button, alt_data, column) end function PermoksAccountManager:CompletedQuestsTooltip_OnEnter(button, altData, column, key) - if not altData or not altData.questInfo or not altData.questInfo[column.questType] or - not altData.questInfo[column.questType][column.visibility] then + if + not altData + or not altData.questInfo + or not altData.questInfo[column.questType] + or not altData.questInfo[column.questType][column.visibility] + then return end local info = altData.questInfo[column.questType][column.visibility][column.key or key] @@ -1361,17 +2034,17 @@ function PermoksAccountManager:CompletedQuestsTooltip_OnEnter(button, altData, c end if next(info) then - local tooltip = LibQTip:Acquire(addonName .. 'Tooltip', 1, 'LEFT') + local tooltip = LibQTip:Acquire(addonName .. "Tooltip", 2, "LEFT", "RIGHT") button.tooltip = tooltip - local questInfo = self.quests[key] + local quests = self.quests[key] if column.showAll then - for questID in pairs(questInfo) do + for questID, questInfo in pairs(quests) do local name local color = "FF0000" - if questInfo and questInfo[questID].name then - name = questInfo[questID].name + if questInfo and questInfo.name then + name = questInfo.name else name = QuestUtils_GetQuestName(questID) end @@ -1380,7 +2053,16 @@ function PermoksAccountManager:CompletedQuestsTooltip_OnEnter(button, altData, c end if name then - tooltip:AddLine(string.format("|cFF%s%s|r", color, name)) + if questInfo.achievementID and questInfo.criteriaID then + local completed = + select(3, GetAchievementCriteriaInfoByID(questInfo.achievementID, questInfo.criteriaID)) + local achievementString = completed + and string.format("|cFF%s%s|r", COLOR_COMPLETED, column.achievementString) + or string.format("|cFF%s%s|r", COLOR_NOT_COMPLETED, column.achievementString) + tooltip:AddLine(string.format("|cFF%s%s|r", color, name), achievementString) + else + tooltip:AddLine(string.format("|cFF%s%s|r", color, name)) + end end end else @@ -1407,9 +2089,40 @@ function PermoksAccountManager:CompletedQuestsTooltip_OnEnter(button, altData, c end end +function PermoksAccountManager:CompletedWorldQuestsTooltip_OnEnter(button, altData, column, key) + if not altData or not altData.completedWorldQuests then + return + end + + local info = altData.completedWorldQuests + + local tooltip = LibQTip:Acquire(addonName .. "Tooltip", 1, "LEFT") + button.tooltip = tooltip + + for questID, isComplete in pairs(info) do + local name = QuestUtils_GetQuestName(questID) + local color = "FF0000" + + if isComplete then + color = "00FF00" + end + + if name then + tooltip:AddLine(string.format("|cFF%s%s|r", color, name)) + end + end + + tooltip:SmartAnchorTo(button) + tooltip:Show() +end + function PermoksAccountManager:KnowledgeTooltip_OnEnter(button, altData, column, key) - if not altData or not altData.questInfo or not altData.questInfo[column.questType] or - not altData.questInfo[column.questType][column.visibility] then + if + not altData + or not altData.questInfo + or not altData.questInfo[column.questType] + or not altData.questInfo[column.questType][column.visibility] + then return end local info = altData.questInfo[column.questType][column.visibility][column.key or key] @@ -1417,13 +2130,10 @@ function PermoksAccountManager:KnowledgeTooltip_OnEnter(button, altData, column, return end - local tooltip = LibQTip:Acquire(addonName .. 'Tooltip', 3, 'LEFT', 'RIGHT', 'RIGHT') - button.tooltip = tooltip - local questInfo = self.quests[key] local professionCounter = {} local professionItems = {} - local prof1, prof2 = unpack(altData.professions or {}) + local prof1, prof2 = altData.professions.profession1, altData.professions.profession2 if prof1 or prof2 then for questID, questInfoTbl in pairs(questInfo) do @@ -1433,17 +2143,27 @@ function PermoksAccountManager:KnowledgeTooltip_OnEnter(button, altData, column, professionCounter[skillLineID] = (professionCounter[skillLineID] or 0) + 1 end - if (skillLineID == prof1 or skillLineID == prof2) then + if skillLineID == prof1.skillLineID or skillLineID == prof2.skillLineID then professionItems[questInfoTbl.skillLineID] = professionItems[questInfoTbl.skillLineID] or {} if questInfoTbl.item then - tinsert(professionItems[questInfoTbl.skillLineID], {questID, questInfoTbl.item, info[questID]}) + tinsert( + professionItems[questInfoTbl.skillLineID], + { questID, questInfoTbl.item, info[questID] } + ) end end end end end + if not next(professionItems) then + return + end + + local tooltip = LibQTip:Acquire(addonName .. "Tooltip", 3, "LEFT", "RIGHT", "RIGHT") + button.tooltip = tooltip + local professioIndex = 1 for skillLineID, info in pairs(professionItems) do if #info > 0 and professioIndex == 2 then @@ -1452,8 +2172,10 @@ function PermoksAccountManager:KnowledgeTooltip_OnEnter(button, altData, column, local counter = professionCounter[skillLineID] or 0 local professionName = C_TradeSkillUI.GetProfessionInfoBySkillLineID(skillLineID).professionName - local maximum = column.professionRequired and column.professionRequired[skillLineID] or column.tooltipRequired or 2 - tooltip:AddLine(string.format('%s (%s)', professionName, self:CreateFractionString(counter, maximum))) + local maximum = column.professionRequired and column.professionRequired[skillLineID] + or column.tooltipRequired + or 2 + tooltip:AddLine(string.format("%s (%s)", professionName, self:CreateFractionString(counter, maximum))) if #info > 0 then tooltip:AddSeparator(1) @@ -1461,12 +2183,20 @@ function PermoksAccountManager:KnowledgeTooltip_OnEnter(button, altData, column, local questID, itemID, isComplete = unpack(itemInfo) local item = Item:CreateFromItemID(itemID) if item:IsItemDataCached() then - tooltip:AddLine(string.format('%s%s', CreateSimpleTextureMarkup(item:GetItemIcon()), item:GetItemLink()), string.format("(%d)", questID), isComplete and completedString[1] or completedString[2]) + tooltip:AddLine( + string.format("%s%s", CreateSimpleTextureMarkup(item:GetItemIcon()), item:GetItemLink()), + string.format("(%d)", questID), + isComplete and completedString[1] or completedString[2] + ) else local y, x = tooltip:AddLine() item:ContinueOnItemLoad(function() - if tooltip:IsAcquiredBy(addonName .. 'Tooltip') then - tooltip:SetCell(y, 1, string.format('%s%s', CreateSimpleTextureMarkup(item:GetItemIcon()), item:GetItemLink())) + if tooltip:IsAcquiredBy(addonName .. "Tooltip") then + tooltip:SetCell( + y, + 1, + string.format("%s%s", CreateSimpleTextureMarkup(item:GetItemIcon()), item:GetItemLink()) + ) tooltip:SetCell(y, 2, string.format("(%d)", questID)) tooltip:SetCell(y, 3, isComplete and completedString[1] or completedString[2]) end @@ -1475,28 +2205,34 @@ function PermoksAccountManager:KnowledgeTooltip_OnEnter(button, altData, column, end end - professioIndex = professioIndex + 1 + professioIndex = professioIndex + 1 end tooltip:SmartAnchorTo(button) tooltip:Show() end - function PermoksAccountManager:WOTLKDailyQuest_OnEnter(button, altData, labelRow, labelIdentifier) - if (not altData or not altData.questInfo or not altData.questInfo[labelRow.questType]) or not labelRow or - not labelIdentifier then + if + (not altData or not altData.questInfo or not altData.questInfo[labelRow.questType]) + or not labelRow + or not labelIdentifier + then return end - local info = altData[labelRow.questType][labelRow.visibility] and - altData[labelRow.questType][labelRow.visibility][labelIdentifier] - if not info then return end + local info = altData[labelRow.questType][labelRow.visibility] + and altData[labelRow.questType][labelRow.visibility][labelIdentifier] + if not info then + return + end local quests = self.quests[labelIdentifier] - if not quests then return end + if not quests then + return + end - local tooltip = LibQTip:Acquire(addonName .. 'Tooltip', 2, 'LEFT', 'RIGHT') + local tooltip = LibQTip:Acquire(addonName .. "Tooltip", 2, "LEFT", "RIGHT") button.tooltip = tooltip for name, completionInfo in pairs(completedByName) do tooltip:AddLine(name, self:CreateFractionString(completionInfo.num, completionInfo.total)) diff --git a/modules/retail_professions.lua b/modules/retail_professions.lua index 634b7a8..c470823 100644 --- a/modules/retail_professions.lua +++ b/modules/retail_professions.lua @@ -8,10 +8,10 @@ local labelRows = { profession1CDs = { label = 'Profession 1 (NYI)', tooltip = function(button, alt_data) - PermoksAccountManager:ProfessionTooltip_OnEnter(button, alt_data, alt_data.professions[1]) + PermoksAccountManager:ProfessionTooltip_OnEnter(button, alt_data, alt_data.professions.profession1) end, data = function(alt_data) - return alt_data.professions and alt_data.professionCDs and PermoksAccountManager:CreateProfessionString(alt_data.professions[1], alt_data.professionCDs) or '-' + return alt_data.professions and alt_data.professionCDs and PermoksAccountManager:CreateProfessionString(alt_data.professions.profession1, alt_data.professionCDs) or '-' end, group = 'profession', version = WOW_PROJECT_MAINLINE @@ -19,14 +19,42 @@ local labelRows = { profession2CDs = { label = 'Profession 2 (NYI)', tooltip = function(button, alt_data) - PermoksAccountManager:ProfessionTooltip_OnEnter(button, alt_data, alt_data.professions[2]) + PermoksAccountManager:ProfessionTooltip_OnEnter(button, alt_data, alt_data.professions.profession2) end, data = function(alt_data) - return alt_data.professions and alt_data.professionCDs and PermoksAccountManager:CreateProfessionString(alt_data.professions[2], alt_data.professionCDs) or '-' + return alt_data.professions and alt_data.professionCDs and PermoksAccountManager:CreateProfessionString(alt_data.professions.profession2, alt_data.professionCDs) or '-' end, group = 'profession', version = WOW_PROJECT_MAINLINE - } + }, + profession1_concentration_df = { + label = 'DF Concentration P1 (NYI)', + type = 'concentration', + key = 'df_profession', + passRow = true, + tooltip = true, + customTooltip = function(button, alt_data) + if alt_data.professions and alt_data.professions.profession1 then + PermoksAccountManager:ConcentrationTooltip_OnEnter(button, alt_data, alt_data.professions.profession1) + end + end, + group = 'profession', + version = WOW_PROJECT_MAINLINE + }, + profession2_concentration_df = { + label = 'DF Concentration P2 (NYI)', + type = 'concentration', + key = 'df_profession', + passRow = true, + tooltip = true, + customTooltip = function(button, alt_data) + if alt_data.professions and alt_data.professions.profession2 then + PermoksAccountManager:ConcentrationTooltip_OnEnter(button, alt_data, alt_data.professions.profession2) + end + end, + group = 'profession', + version = WOW_PROJECT_MAINLINE + }, } -- https://github.com/Stanzilla/WoWUIBugs/issues/47 @@ -51,12 +79,122 @@ local function GetCooldownLeft(start, duration) return cdLeftDuration end +local function UpdateChildConcentration(child) + local concentrationInfo = C_CurrencyInfo.GetCurrencyInfo(child.concentrationCurrency) + + child.lastUpdated = GetServerTime() + child.concentrationQuantity = concentrationInfo.quantity + + local concentrationDelta = child.concentrationMax - concentrationInfo.quantity + if concentrationDelta == 0 then + child.concentrationCapTime = 0 + elseif concentrationDelta > 0 then + local timeTilMax = math.ceil(concentrationDelta * child.concentrationSecondsPerRecharge) + child.concentrationCapTime = child.lastUpdated + timeTilMax + end + + local formattedDate = date("%Y-%m-%d %H:%M:%S", child.concentrationCapTime) +end + +local function CalculateChildConcentration(child) + if child.concentrationCapTime and child.concentrationCapTime > 0 then + child.lastUpdated = GetServerTime() + + local timeUntilMax = math.max(child.concentrationCapTime - child.lastUpdated, 0) + + if timeUntilMax > 0 then + local concentrationDelta = timeUntilMax / child.concentrationSecondsPerRecharge + child.concentrationQuantity = math.floor(child.concentrationMax - concentrationDelta) + else + child.concentrationQuantity = child.concentrationMax + child.concentrationCapTime = 0 + end + end +end + +local function UpdateCharConcentration(charInfo) + local isPlayer = charInfo.guid == UnitGUID('Player') + + for _, profession in pairs(charInfo.professions) do + if profession.childProfessions then + for _, child in pairs(profession.childProfessions) do + + if isPlayer and child.concentrationCurrency then + UpdateChildConcentration(child) + elseif child.concentrationCurrency then + CalculateChildConcentration(child) + end + + end + end + end +end + +function PermoksAccountManager:UpdateConcentration() + for _, char in pairs(self.account.data) do + UpdateCharConcentration(char) + end +end + +local function UpdateChildProfessionInfo(profession) + local info = C_TradeSkillUI.GetProfessionInfoBySkillLineID(profession.skillLineID) + local concentration = C_TradeSkillUI.GetConcentrationCurrencyID(profession.skillLineID) + + if concentration == 0 then + return { + skillLineID = profession.skillLineID, + name = info.professionName, + } + end + + local concentrationInfo = C_CurrencyInfo.GetCurrencyInfo(concentration) + + return { + skillLineID = profession.skillLineID, + name = info.professionName, + concentrationCurrency = concentration, + concentrationMax = concentrationInfo.maxQuantity, + concentrationSecondsPerRecharge = concentrationInfo.rechargingCycleDurationMS / (concentrationInfo.rechargingAmountPerCycle * 1000), + concentrationQuantity = 0, + concentrationCapTime = 0, + lastUpdated = 0, + } +end + +local function UpdateProfessionInfo(professionID) + if not professionID then + return + end + + local self = PermoksAccountManager + local info = C_TradeSkillUI.GetProfessionInfoBySkillLineID(professionID) + + local childProfessions = {} + for expansion, profession in pairs(self.childProfessions) do + local child = profession[professionID] + if IsPlayerSpell(child.spellID) then + childProfessions[expansion] = UpdateChildProfessionInfo(child) + end + end + + return { + skillLineID = professionID, + name = info.professionName, + childProfessions = childProfessions, + } +end + -- Need to rewrite most of this stuff. I hate the classic API local function UpdateProfessions(charInfo) + local self = PermoksAccountManager + --replacing profession-table ID with skillLineID local profession1, profession2 = GetProfessions() + profession1 = profession1 and select(7, GetProfessionInfo(profession1)) + profession2 = profession2 and select(7, GetProfessionInfo(profession2)) + charInfo.professions = { - profession1 and select(7, GetProfessionInfo(profession1)), - profession2 and select(7, GetProfessionInfo(profession2)), + profession1 = UpdateProfessionInfo(profession1), + profession2 = UpdateProfessionInfo(profession2), } end @@ -64,17 +202,32 @@ local function UpdateProfessionCDs(charInfo) end -function PermoksAccountManager:CreateProfessionString(professionInfo, professionCDs) +function PermoksAccountManager:CreateProfessionString(professions, professionCDs) end -function PermoksAccountManager:ProfessionTooltip_OnEnter(button, alt_data, professionInfo) +local function CreateConcentrationString(labelRow, professions) + if not professions then return '-' end + return labelRow.key +end + +function PermoksAccountManager:ConcentrationTooltip_OnEnter(button, altData, labelRow) + if not altData.professions and altData.professions then + return + end + +end + +function PermoksAccountManager:ProfessionTooltip_OnEnter(button, alt_data, professions) end + + local function Update(charInfo) UpdateProfessions(charInfo) UpdateProfessionCDs(charInfo) + UpdateCharConcentration(charInfo) end local payload = { @@ -86,3 +239,4 @@ local payload = { labels = labelRows } local module = PermoksAccountManager:AddModule(module, payload) +module:AddCustomLabelType('concentration', CreateConcentrationString, nil, 'professions') diff --git a/modules/vault.lua b/modules/vault.lua index dd3d820..ad4a350 100644 --- a/modules/vault.lua +++ b/modules/vault.lua @@ -1,242 +1,287 @@ local addonName, PermoksAccountManager = ... -local LibQTip = LibStub('LibQTip-1.0') -local L = LibStub('AceLocale-3.0'):GetLocale(addonName) +local LibQTip = LibStub("LibQTip-1.0") +local L = LibStub("AceLocale-3.0"):GetLocale(addonName) local options -local module = 'vault' +local module = "vault" local labelRows = { - great_vault_mplus = { - label = L['Vault M+'], - type = 'vault', - key = 'MythicPlus', - tooltip = true, - group = 'vault', - version = WOW_PROJECT_MAINLINE - }, - great_vault_raid = { - label = L['Vault Raid'], - type = 'vault', - key = 'Raid', - tooltip = true, - group = 'vault', - version = WOW_PROJECT_MAINLINE - }, - great_vault_pvp = { - label = L['Vault PVP'], - type = 'vault', - key = 'RankedPvP', - tooltip = true, - group = 'vault', - version = WOW_PROJECT_MAINLINE - }, - great_vault_reward_available = { - label = L['Vault Reward'], - type = 'vault_reward', - group = 'vault', - version = WOW_PROJECT_MAINLINE - } + great_vault_mplus = { + label = L["Vault M+"], + type = "vault", + key = "MythicPlus", + tooltip = true, + group = "vault", + version = WOW_PROJECT_MAINLINE, + }, + great_vault_raid = { + label = L["Vault Raid"], + type = "vault", + key = "Raid", + tooltip = true, + group = "vault", + version = WOW_PROJECT_MAINLINE, + }, + great_vault_pvp = { + label = "Vault World", + type = "vault", + key = "World", + tooltip = true, + group = "vault", + version = WOW_PROJECT_MAINLINE, + }, + great_vault_reward_available = { + label = L["Vault Reward"], + type = "vault_reward", + group = "vault", + version = WOW_PROJECT_MAINLINE, + }, } local function CreateVaultRewardString(vaultRewardInfo) - if vaultRewardInfo then - return string.format("|cff00ff00Availbale|r") - else - return "-" - end + if vaultRewardInfo then + return string.format("|cff00ff00Available|r") + else + return "-" + end end local function valueChanged(oldTable, newTable, key, checkUneven) - if not oldTable or not newTable or not key then - return false - end - if not oldTable[key] or not newTable[key] then - return false - end - - if checkUneven then - return newTable[key] ~= oldTable[key] - else - return newTable[key] > oldTable[key] - end + if not oldTable or not newTable or not key then + return false + end + if not oldTable[key] or not newTable[key] then + return false + end + + if checkUneven then + return newTable[key] ~= oldTable[key] + else + return newTable[key] > oldTable[key] + end end -- https://github.com/Gethe/wow-ui-source/blob/87c526a3ae979a7f5244d635bd8ae952b4313bd8/Interface/AddOns/Blizzard_WeeklyRewardsUtil/Blizzard_WeeklyRewardsUtil.lua#L16 -- Blizzard doesn't count incomplete runs (runs which were depleted) local function GetLowestLevelInTopDungeonRuns(numRuns) - local lowestLevel; - local lowestCount = 0; + local lowestLevel + local lowestCount = 0 - local numHeroic, numMythic, numMythicPlus = C_WeeklyRewards.GetNumCompletedDungeonRuns(); + local numHeroic, numMythic, numMythicPlus = C_WeeklyRewards.GetNumCompletedDungeonRuns() -- if there are not enough MythicPlus runs, the lowest level might be either Heroic or Mythic if numRuns > numMythicPlus and (numHeroic + numMythic) > 0 then -- if there are not enough of both mythics combined, the lowest level might be Heroic if numRuns > numMythicPlus + numMythic and numHeroic > 0 then - lowestLevel = WeeklyRewardsUtil.HeroicLevel; - lowestCount = numRuns - numMythicPlus - numMythic; + lowestLevel = WeeklyRewardsUtil.HeroicLevel + lowestCount = numRuns - numMythicPlus - numMythic else - lowestLevel = WeeklyRewardsUtil.MythicLevel; - lowestCount = numRuns - numMythicPlus; + lowestLevel = WeeklyRewardsUtil.MythicLevel + lowestCount = numRuns - numMythicPlus end - return lowestLevel, lowestCount; + return lowestLevel, lowestCount end - local runHistory = C_MythicPlus.GetRunHistory(nil, true); - table.sort(runHistory, function(left, right) return left.level > right.level; end); + local runHistory = C_MythicPlus.GetRunHistory(nil, true) + table.sort(runHistory, function(left, right) + return left.level > right.level + end) for i = math.min(numRuns, #runHistory), 1, -1 do - local run = runHistory[i]; + local run = runHistory[i] if not lowestLevel then - lowestLevel = run.level; + lowestLevel = run.level end if lowestLevel == run.level then - lowestCount = lowestCount + 1; + lowestCount = lowestCount + 1 else - break; + break end end - return lowestLevel, lowestCount; + return lowestLevel, lowestCount +end + +local function GetRewardItemLevel(id) + local itemLink = C_WeeklyRewards.GetExampleRewardItemHyperlinks(id) + if itemLink then + return C_Item.GetDetailedItemLevelInfo(itemLink) + end end local function UpdateVaultInfo(charInfo, force) - local self = PermoksAccountManager - - charInfo.vaultRewardInfo = C_WeeklyRewards.HasAvailableRewards() - charInfo.vaultInfo = charInfo.vaultInfo or {} - local vaultInfo = charInfo.vaultInfo - local activities = C_WeeklyRewards.GetActivities() - for i, activityInfo in ipairs(activities) do - if activityInfo.type == Enum.WeeklyRewardChestThresholdType.Raid then - vaultInfo.Raid = vaultInfo.Raid or {} - local progressChanged = valueChanged(vaultInfo.Raid[activityInfo.index], activityInfo, 'progress') - local levelChanged = valueChanged(vaultInfo.Raid[activityInfo.index], activityInfo, 'level', true) - - if not vaultInfo.Raid[activityInfo.index] or progressChanged or levelChanged then - vaultInfo.Raid[activityInfo.index] = activityInfo - end - elseif activityInfo.type == Enum.WeeklyRewardChestThresholdType.Activities then - vaultInfo.MythicPlus = vaultInfo.MythicPlus or {} - activityInfo.level = activityInfo.progress > 0 and GetLowestLevelInTopDungeonRuns(activityInfo.threshold) or activityInfo.level - - local progressChanged = valueChanged(vaultInfo.MythicPlus[activityInfo.index], activityInfo, 'progress') - local levelChanged = valueChanged(vaultInfo.MythicPlus[activityInfo.index], activityInfo, 'level', true) - - if not vaultInfo.MythicPlus[activityInfo.index] or progressChanged or levelChanged or force then - vaultInfo.MythicPlus[activityInfo.index] = activityInfo - end - elseif activityInfo.type == Enum.WeeklyRewardChestThresholdType.RankedPvP then - vaultInfo.RankedPvP = vaultInfo.RankedPvP or {} - local progressChanged = valueChanged(vaultInfo.RankedPvP[activityInfo.index], activityInfo, 'progress') - local levelChanged = valueChanged(vaultInfo.RankedPvP[activityInfo.index], activityInfo, 'level', true) - - if not vaultInfo.RankedPvP[activityInfo.index] or progressChanged or levelChanged then - vaultInfo.RankedPvP[activityInfo.index] = activityInfo - end - end - end + local self = PermoksAccountManager + + charInfo.vaultRewardInfo = C_WeeklyRewards.HasAvailableRewards() + charInfo.vaultInfo = charInfo.vaultInfo or {} + local vaultInfo = charInfo.vaultInfo + local activities = C_WeeklyRewards.GetActivities() + for i, activityInfo in ipairs(activities) do + if activityInfo.type == Enum.WeeklyRewardChestThresholdType.Raid then + vaultInfo.Raid = vaultInfo.Raid or {} + local progressChanged = valueChanged(vaultInfo.Raid[activityInfo.index], activityInfo, "progress") + local levelChanged = valueChanged(vaultInfo.Raid[activityInfo.index], activityInfo, "level", true) + + if not vaultInfo.Raid[activityInfo.index] or progressChanged or levelChanged or force then + local data = CopyTable(activityInfo) + data.itemLevel = GetRewardItemLevel(activityInfo.id) or data.itemLevel + vaultInfo.Raid[activityInfo.index] = data + end + elseif activityInfo.type == Enum.WeeklyRewardChestThresholdType.Activities then + vaultInfo.MythicPlus = vaultInfo.MythicPlus or {} + activityInfo.level = activityInfo.progress > 0 and GetLowestLevelInTopDungeonRuns(activityInfo.threshold) + or activityInfo.level + + local progressChanged = valueChanged(vaultInfo.MythicPlus[activityInfo.index], activityInfo, "progress") + local levelChanged = valueChanged(vaultInfo.MythicPlus[activityInfo.index], activityInfo, "level", true) + + if not vaultInfo.MythicPlus[activityInfo.index] or progressChanged or levelChanged or force then + local data = CopyTable(activityInfo) + data.itemLevel = GetRewardItemLevel(activityInfo.id) or data.itemLevel + + vaultInfo.MythicPlus[activityInfo.index] = data + end + elseif activityInfo.type == Enum.WeeklyRewardChestThresholdType.World then + vaultInfo.World = vaultInfo.World or {} + local progressChanged = valueChanged(vaultInfo.World[activityInfo.index], activityInfo, "progress") + local levelChanged = valueChanged(vaultInfo.World[activityInfo.index], activityInfo, "level", true) + + if not vaultInfo.World[activityInfo.index] or progressChanged or levelChanged or force then + local data = CopyTable(activityInfo) + data.itemLevel = GetRewardItemLevel(activityInfo.id) or data.itemLevel + + vaultInfo.World[activityInfo.index] = data + end + end + end end local function UpdateRaidActivity(charInfo) - charInfo.raidActivityInfo = C_WeeklyRewards.GetActivityEncounterInfo(Enum.WeeklyRewardChestThresholdType.Raid, 1) + charInfo.raidActivityInfo = C_WeeklyRewards.GetActivityEncounterInfo(Enum.WeeklyRewardChestThresholdType.Raid, 1) end local function Update(charInfo) - UpdateVaultInfo(charInfo, true) - UpdateRaidActivity(charInfo) + UpdateVaultInfo(charInfo, true) + UpdateRaidActivity(charInfo) end local payload = { - update = Update, - events = { - ['UPDATE_INSTANCE_INFO'] = {UpdateVaultInfo, UpdateRaidActivity}, - ['WEEKLY_REWARDS_UPDATE'] = {UpdateVaultInfo, UpdateRaidActivity}, - ['CHALLENGE_MODE_COMPLETED'] = {UpdateVaultInfo, UpdateRaidActivity}, - ['CHALLEGE_MODE_MAPS_UPDATE'] = {UpdateVaultInfo, UpdateRaidActivity} - }, - share = { - [UpdateVaultInfo] = 'vaultInfo' - }, - labels = labelRows + update = Update, + events = { + ["UPDATE_INSTANCE_INFO"] = { UpdateVaultInfo, UpdateRaidActivity }, + ["WEEKLY_REWARDS_UPDATE"] = { UpdateVaultInfo, UpdateRaidActivity }, + ["CHALLENGE_MODE_COMPLETED"] = { UpdateVaultInfo, UpdateRaidActivity }, + ["CHALLEGE_MODE_MAPS_UPDATE"] = { UpdateVaultInfo, UpdateRaidActivity }, + }, + share = { + [UpdateVaultInfo] = "vaultInfo", + }, + labels = labelRows, } local module = PermoksAccountManager:AddModule(module, payload) -module:AddCustomLabelType('vault_reward', CreateVaultRewardString, nil, 'vaultRewardInfo') +module:AddCustomLabelType("vault_reward", CreateVaultRewardString, nil, "vaultRewardInfo") local function GetDifficultyString(type, level) - if type == Enum.WeeklyRewardChestThresholdType.Raid then - return DifficultyUtil.GetDifficultyName(level):sub(1, 1) - elseif type == Enum.WeeklyRewardChestThresholdType.Activities then - return level - elseif type == Enum.WeeklyRewardChestThresholdType.RankedPvP then - return PVPUtil.GetTierName(level):sub(1, 2) - end + if type == Enum.WeeklyRewardChestThresholdType.Raid then + return DifficultyUtil.GetDifficultyName(level):sub(1, 1) + elseif type == Enum.WeeklyRewardChestThresholdType.Activities then + return level + elseif type == Enum.WeeklyRewardChestThresholdType.World then + return level + end end function PermoksAccountManager:CreateVaultString(vaultInfo) - local vaultString - local difficulties = {} - - for i, activityInfo in ipairs(vaultInfo) do - if not vaultString then - if activityInfo.progress >= activityInfo.threshold then - tinsert(difficulties, GetDifficultyString(activityInfo.type, activityInfo.level)) - end - - if activityInfo.threshold > activityInfo.progress or i == 3 then - if #difficulties > 0 then - vaultString = string.format('%s (%s)', self:CreateFractionString(activityInfo.progress, activityInfo.threshold), table.concat(difficulties, '\124\124')) - else - vaultString = self:CreateFractionString(activityInfo.progress, activityInfo.threshold) - end - end - end - end - - return vaultString + local vaultString + local difficulties = {} + + for i, activityInfo in ipairs(vaultInfo) do + if not vaultString then + if activityInfo.progress >= activityInfo.threshold then + tinsert(difficulties, GetDifficultyString(activityInfo.type, activityInfo.level)) + end + + if activityInfo.threshold > activityInfo.progress or i == 3 then + if #difficulties > 0 then + vaultString = string.format( + "%s (%s)", + self:CreateFractionString(activityInfo.progress, activityInfo.threshold), + table.concat(difficulties, "\124\124") + ) + else + vaultString = self:CreateFractionString(activityInfo.progress, activityInfo.threshold) + end + end + end + end + + return vaultString end function PermoksAccountManager.VaultTooltip_OnEnter(button, altData, labelRow) - if not altData or not altData.vaultInfo or not altData.vaultInfo[labelRow.key] then - return - end - - local self = PermoksAccountManager - local vaultInfo = altData.vaultInfo[labelRow.key] - local tooltip = LibQTip:Acquire(addonName .. 'Tooltip', 4, 'LEFT', 'CENTER', 'CENTER', 'RIGHT') - button.tooltip = tooltip - - tooltip:AddHeader(labelRow.label, '', '') - tooltip:AddLine('') - - for i, activityInfo in pairs(vaultInfo) do - local rewardItemLevel - - if activityInfo.progress >= activityInfo.threshold then - if activityInfo.type == Enum.WeeklyRewardChestThresholdType.Activities and activityInfo.level > 20 then - rewardItemLevel = self.vault_rewards[activityInfo.type][20] - else - rewardItemLevel = self.vault_rewards[activityInfo.type][activityInfo.level] or nil - end - end - - if activityInfo.type == Enum.WeeklyRewardChestThresholdType.Activities then - local difficultyName = activityInfo.level and activityInfo.progress >= activityInfo.threshold and '+' .. activityInfo.level - - tooltip:AddLine(i .. '. Reward:', difficultyName or '-', '|', rewardItemLevel or self:CreateQuestString(activityInfo.progress, activityInfo.threshold)) - elseif activityInfo.type == Enum.WeeklyRewardChestThresholdType.Raid then - local difficultyName = activityInfo.level and activityInfo.progress >= activityInfo.threshold and DifficultyUtil.GetDifficultyName(activityInfo.level) - - tooltip:AddLine(i .. '. Reward:', difficultyName or '-', '|', rewardItemLevel or self:CreateQuestString(activityInfo.progress, activityInfo.threshold)) - elseif activityInfo.type == Enum.WeeklyRewardChestThresholdType.RankedPvP then - local difficultyName = activityInfo.level and activityInfo.progress >= activityInfo.threshold and PVPUtil.GetTierName(activityInfo.level) - - tooltip:AddLine(i .. '. Reward:', difficultyName or '-', '|', rewardItemLevel or self:CreateQuestString(activityInfo.progress, activityInfo.threshold)) - end - - if not rewardItemLevel then - tooltip:SetCellTextColor(tooltip:GetLineCount(), 1, 1, 0, 0) - else - tooltip:SetCellTextColor(tooltip:GetLineCount(), 1, 0, 1, 0) - end - end - - tooltip:SmartAnchorTo(button) - tooltip:Show() + if not altData or not altData.vaultInfo or not altData.vaultInfo[labelRow.key] then + return + end + + local self = PermoksAccountManager + local vaultInfo = altData.vaultInfo[labelRow.key] + local tooltip = LibQTip:Acquire(addonName .. "Tooltip", 4, "LEFT", "CENTER", "CENTER", "RIGHT") + button.tooltip = tooltip + + tooltip:AddHeader(labelRow.label, "", "") + tooltip:AddLine("") + + for i, activityInfo in pairs(vaultInfo) do + local rewardItemLevel = activityInfo.itemLevel + + if not rewardItemLevel then + if activityInfo.progress >= activityInfo.threshold then + if activityInfo.type == Enum.WeeklyRewardChestThresholdType.Activities and activityInfo.level > 10 then + rewardItemLevel = self.vault_rewards[activityInfo.type][10] + else + rewardItemLevel = self.vault_rewards[activityInfo.type][activityInfo.level] or nil + end + end + end + + if activityInfo.type == Enum.WeeklyRewardChestThresholdType.Activities then + local difficultyName = activityInfo.level + and activityInfo.progress >= activityInfo.threshold + and "+" .. activityInfo.level + + tooltip:AddLine( + i .. ". Reward:", + difficultyName or "-", + "|", + rewardItemLevel or self:CreateQuestString(activityInfo.progress, activityInfo.threshold) + ) + elseif activityInfo.type == Enum.WeeklyRewardChestThresholdType.Raid then + local difficultyName = activityInfo.level + and activityInfo.progress >= activityInfo.threshold + and DifficultyUtil.GetDifficultyName(activityInfo.level) + + tooltip:AddLine( + i .. ". Reward:", + difficultyName or "-", + "|", + rewardItemLevel or self:CreateQuestString(activityInfo.progress, activityInfo.threshold) + ) + elseif activityInfo.type == Enum.WeeklyRewardChestThresholdType.World then + local difficultyName = activityInfo.level + and activityInfo.progress >= activityInfo.threshold + and "Tier " .. activityInfo.level + + tooltip:AddLine( + i .. ". Reward:", + difficultyName or "-", + "|", + rewardItemLevel or self:CreateQuestString(activityInfo.progress, activityInfo.threshold) + ) + end + + if not rewardItemLevel then + tooltip:SetCellTextColor(tooltip:GetLineCount(), 1, 1, 0, 0) + else + tooltip:SetCellTextColor(tooltip:GetLineCount(), 1, 0, 1, 0) + end + end + + tooltip:SmartAnchorTo(button) + tooltip:Show() end diff --git a/options.lua b/options.lua index ddcdc81..ec67b7a 100644 --- a/options.lua +++ b/options.lua @@ -1,13 +1,13 @@ local addonName, PermoksAccountManager = ... -local L = LibStub('AceLocale-3.0'):GetLocale(addonName) -local AceConfig = LibStub('AceConfig-3.0') -local AceConfigDialog = LibStub('AceConfigDialog-3.0') -local AceConfigRegistry = LibStub('AceConfigRegistry-3.0') -local AceGUI = LibStub('AceGUI-3.0') -local LibIcon = LibStub('LibDBIcon-1.0') -local LibDeflate = LibStub('LibDeflate') -local LibSerialize = LibStub('LibSerialize') -local LSM = LibStub('LibSharedMedia-3.0') +local L = LibStub("AceLocale-3.0"):GetLocale(addonName) +local AceConfig = LibStub("AceConfig-3.0") +local AceConfigDialog = LibStub("AceConfigDialog-3.0") +local AceConfigRegistry = LibStub("AceConfigRegistry-3.0") +local AceGUI = LibStub("AceGUI-3.0") +local LibIcon = LibStub("LibDBIcon-1.0") +local LibDeflate = LibStub("LibDeflate") +local LibSerialize = LibStub("LibSerialize") +local LSM = LibStub("LibSharedMedia-3.0") local options local imexport @@ -17,75 +17,74 @@ local custom_categories local default_categories = PermoksAccountManager:getDefaultCategories() local function changeAccountName(accountKey, name) - local account = PermoksAccountManager.db.global.accounts[accountKey] - if account then - account.name = name - PermoksAccountManager:UpdateAccountButtons() - end + local account = PermoksAccountManager.db.global.accounts[accountKey] + if account then + account.name = name + PermoksAccountManager:UpdateAccountButtons() + end end local function UnsyncAccount(accountKey) - options.args.sync.args.syncedAccounts.args[accountKey] = nil - PermoksAccountManager:UnsyncAccount(accountKey) + options.args.sync.args.syncedAccounts.args[accountKey] = nil + PermoksAccountManager:UnsyncAccount(accountKey) - AceConfigRegistry:NotifyChange(addonName) + AceConfigRegistry:NotifyChange(addonName) end function PermoksAccountManager:AddAccountToOptions(accountKey) - if not options.args.sync.args.syncedAccounts.args[accountKey] then - options.args.sync.args.syncedAccounts.args[accountKey] = { - type = 'group', - name = '', - inline = true, - args = { - name = { - order = 1, - type = 'input', - name = L['Rename'], - desc = nil, - get = function(info) - local accountKey = info[#info - 1] - return PermoksAccountManager.db.global.accounts[accountKey].name - end, - set = function(info, value) - local accountKey = info[#info - 1] - changeAccountName(accountKey, value) - end - }, - unsync = { - order = 3, - type = 'execute', - name = L['Delete'], - func = function(info) - local accountKey = info[#info - 1] - UnsyncAccount(accountKey) - end, - confirm = true, - confirmText = L['Are you sure?'] - } - } - } - end + if not options.args.sync.args.syncedAccounts.args[accountKey] then + options.args.sync.args.syncedAccounts.args[accountKey] = { + type = "group", + name = "", + inline = true, + args = { + name = { + order = 1, + type = "input", + name = L["Rename"], + desc = nil, + get = function(info) + local accountKey = info[#info - 1] + return PermoksAccountManager.db.global.accounts[accountKey].name + end, + set = function(info, value) + local accountKey = info[#info - 1] + changeAccountName(accountKey, value) + end, + }, + unsync = { + order = 3, + type = "execute", + name = L["Delete"], + func = function(info) + local accountKey = info[#info - 1] + UnsyncAccount(accountKey) + end, + confirm = true, + confirmText = L["Are you sure?"], + }, + }, + } + end end local function AddAccounts() - for account, _ in pairs(PermoksAccountManager.db.global.accounts) do - if account ~= 'main' then - PermoksAccountManager:AddAccountToOptions(account) - end - end + for account, _ in pairs(PermoksAccountManager.db.global.accounts) do + if account ~= "main" then + PermoksAccountManager:AddAccountToOptions(account) + end + end end local function GetAccountSyncDescription() - local comment = 'THIS ONLY WORKS ON CONNECTED REALMS' - local first = 'Enter the necessary info of a currently online character of the second account.' - local second = 'Press the Sync Button.' - local third = 'Follow the instruction in the chat on the second account.' + local comment = "THIS ONLY WORKS ON CONNECTED REALMS" + local first = "Enter the necessary info of a currently online character of the second account." + local second = "Press the Sync Button." + local third = "Follow the instruction in the chat on the second account." - return string.format('|cffff0000%s|r\nSteps:\n1 - %s\n2 - %s\n3 - %s', comment, first, second, third) + return string.format("|cffff0000%s|r\nSteps:\n1 - %s\n2 - %s\n3 - %s", comment, first, second, third) end - local function RemoveCharacterFromOptions(altGUID) options.args.characters.args.customCharacterOrder.args[altGUID] = nil end @@ -93,1046 +92,1093 @@ end ---comment ---@param altGUID string function PermoksAccountManager:AddCharacterToOrderOptions(altGUID, altData, accountName) - local coloredName = RAID_CLASS_COLORS[altData.class]:WrapTextInColorCode(altData.name .. ((altData.realm and "-" .. altData.realm) or "")) - local factionIcon = ("|T%s:%d:%d|t"):format(FACTION_LOGO_TEXTURES[PLAYER_FACTION_GROUP[altData.faction]], 0, 0) + local coloredName = altData.class + and RAID_CLASS_COLORS[altData.class]:WrapTextInColorCode( + (altData.name or "") .. ((altData.realm and "-" .. altData.realm) or "") + ) + or "" + local factionIcon = altData.faction + and altData.faction ~= "Neutral" + and ("|T%s:%d:%d|t"):format(FACTION_LOGO_TEXTURES[PLAYER_FACTION_GROUP[altData.faction]], 0, 0) options.args.characters.args.customCharacterOrder.args[altGUID] = { order = altData.order, type = "group", inline = true, - name = coloredName .. factionIcon, + name = coloredName .. (factionIcon or ""), x = altData, args = { order = { order = 1, - type = 'input', - name = 'Order', - width = 'half', - disabled = function() - return PermoksAccountManager.db.global.options.characters.sortBy ~= 'order' - end + type = "input", + name = "Order", + width = "half", + disabled = function() + return PermoksAccountManager.db.global.options.characters.sortBy ~= "order" + end, }, remove = { order = 2, - type = 'execute', - name = 'Remove', + type = "execute", + name = "Remove", width = 0.9, func = function(info) - PermoksAccountManager:RemoveCharacter(info[#info-1]) - RemoveCharacterFromOptions(info[#info-1]) + PermoksAccountManager:RemoveCharacter(info[#info - 1]) + RemoveCharacterFromOptions(info[#info - 1]) end, confirm = true, - confirmText = 'Are you sure you want to remove this character?', + confirmText = "Are you sure you want to remove this character?", }, [accountName] = { - order = 3, - type = 'execute', - name = 'Filter', + order = 3, + type = "execute", + name = "Filter", width = 0.9, func = function(info) - PermoksAccountManager:AddChracterToFilterFromOptions(info[#info-1], info[#info]) - RemoveCharacterFromOptions(info[#info-1]) + PermoksAccountManager:AddChracterToFilterFromOptions(info[#info - 1], info[#info]) + RemoveCharacterFromOptions(info[#info - 1]) end, confirm = true, - confirmText = 'Do you really want to remove this character and add him to the filter?' - }, - } - } + confirmText = "Do you really want to remove this character and add him to the filter?", + }, + }, + } end -- credit to the author of Shadowed Unit Frames local function selectDifferentTab(group, key) - AceConfigDialog.Status[addonName].children.categories.children[group].status.groups.selected = key - AceConfigRegistry:NotifyChange(addonName) + AceConfigDialog.Status[addonName].children.categories.children[group].status.groups.selected = key + AceConfigRegistry:NotifyChange(addonName) end local function deleteCustomCategory(category) - local categoryButtons = PermoksAccountManager.managerFrame.categoryButtons - local categoryFrame = PermoksAccountManager.categoryFrame - - if categoryFrame and categoryButtons then - if categoryFrame.openCategory and categoryFrame.openCategory == category then - PermoksAccountManager:UpdateCategory(categoryButtons[category], 'open', nil, category) - categoryFrame.labelColumn.categories[category] = nil - end - - if categoryButtons[category] then - categoryButtons[category]:Hide() - categoryButtons[category] = nil - end - end - - if PermoksAccountManager.db.global.custom then - custom_categories[category] = nil - options.args.categories.args.custom_categories_toggles.args[category] = nil - options.args.categories.args.customCategories.args[category] = nil - options.args.order.args.customCategories.args[category] = nil - options.args.order.args.customCategoriesOrder.args[category] = nil - selectDifferentTab('customCategories', 'create') - else - PermoksAccountManager.db.global.currentCategories[category] = nil - options.args.categories.args.default_categories_toggles.args[category] = nil - options.args.categories.args.defaultCategories.args[category] = nil - options.args.order.args.defaultCategories.args[category] = nil - options.args.order.args.defaultCategoriesOrder.args[category] = nil - selectDifferentTab('defaultCategories', 'create') - end - - PermoksAccountManager.numCategories = PermoksAccountManager.numCategories - 1 + local categoryButtons = PermoksAccountManager.managerFrame.categoryButtons + local categoryFrame = PermoksAccountManager.categoryFrame + + if categoryFrame and categoryButtons then + if categoryFrame.openCategory and categoryFrame.openCategory == category then + PermoksAccountManager:UpdateCategory(categoryButtons[category], "open", nil, category) + categoryFrame.labelColumn.categories[category] = nil + end + + if categoryButtons[category] then + categoryButtons[category]:Hide() + categoryButtons[category] = nil + end + end + + if PermoksAccountManager.db.global.custom then + custom_categories[category] = nil + options.args.categories.args.custom_categories_toggles.args[category] = nil + options.args.categories.args.customCategories.args[category] = nil + options.args.order.args.customCategories.args[category] = nil + options.args.order.args.customCategoriesOrder.args[category] = nil + selectDifferentTab("customCategories", "create") + else + PermoksAccountManager.db.global.currentCategories[category] = nil + options.args.categories.args.default_categories_toggles.args[category] = nil + options.args.categories.args.defaultCategories.args[category] = nil + options.args.order.args.defaultCategories.args[category] = nil + options.args.order.args.defaultCategoriesOrder.args[category] = nil + selectDifferentTab("defaultCategories", "create") + end + + PermoksAccountManager.numCategories = PermoksAccountManager.numCategories - 1 end local function sortCategoryChilds(optionsTable, category) - local category = PermoksAccountManager.db.global.options[optionsTable][category] - table.sort( - category.childs, - function(a, b) - return category.childOrder[a] < category.childOrder[b] - end - ) + local category = PermoksAccountManager.db.global.options[optionsTable][category] + table.sort(category.childs, function(a, b) + return category.childOrder[a] < category.childOrder[b] + end) end local function setCategoryOrder(info, value) - local category = info[#info] - local optionsTable = info[#info - 1] - local newOrder = tonumber(value) + local category = info[#info] + local optionsTable = info[#info - 1] + local newOrder = tonumber(value) - PermoksAccountManager.db.global.options[optionsTable:gsub('Order', '')][category].order = newOrder - options.args.order.args[optionsTable].args[category].order = newOrder - AceConfigRegistry:NotifyChange(addonName) + PermoksAccountManager.db.global.options[optionsTable:gsub("Order", "")][category].order = newOrder + options.args.order.args[optionsTable].args[category].order = newOrder + AceConfigRegistry:NotifyChange(addonName) end local function getCategoryOrder(info) - local category = info[#info] - local optionsTable = info[#info - 1] - return tostring(PermoksAccountManager.db.global.options[optionsTable:gsub('Order', '')][category].order) + local category = info[#info] + local optionsTable = info[#info - 1] + return tostring(PermoksAccountManager.db.global.options[optionsTable:gsub("Order", "")][category].order) end local function setOrder(info, value) - local key = info[#info] - local category = info[#info - 1] - local optionsTable = info[#info - 2] - local newOrder = tonumber(value) - local categoryOptions = PermoksAccountManager.db.global.options[optionsTable][category] - - categoryOptions.childOrder[key] = newOrder - sortCategoryChilds(optionsTable, category) - for i, child in pairs(categoryOptions.childs) do + local key = info[#info] + local category = info[#info - 1] + local optionsTable = info[#info - 2] + local newOrder = tonumber(value) + local categoryOptions = PermoksAccountManager.db.global.options[optionsTable][category] + + categoryOptions.childOrder[key] = newOrder + sortCategoryChilds(optionsTable, category) + for i, child in pairs(categoryOptions.childs) do if options.args.order.args[optionsTable].args[category].args[child] then - options.args.order.args[optionsTable].args[category].args[child].order = i + options.args.order.args[optionsTable].args[category].args[child].order = i end - end + end - AceConfigRegistry:NotifyChange(addonName) - PermoksAccountManager:UpdateAnchorsAndSize(category, nil, true, true) + AceConfigRegistry:NotifyChange(addonName) + PermoksAccountManager:UpdateAnchorsAndSize(category, nil, true, true) end local function getOrder(info) - local key = info[#info] - local category = info[#info - 1] - local optionsTable = info[#info - 2] - return tostring(PermoksAccountManager.db.global.options[optionsTable][category].childOrder[key]) + local key = info[#info] + local category = info[#info - 1] + local optionsTable = info[#info - 2] + return tostring(PermoksAccountManager.db.global.options[optionsTable][category].childOrder[key]) end local function setCategoryChildOption(info, value) - local key = info[#info] - local category = info[3] - local categoryType = info[2] - local categoryOptionsTbl = PermoksAccountManager.db.global.options[categoryType] - - local childs = categoryOptionsTbl[category].childs - local optionsOrderConfig = options.args.order.args[categoryType].args - if not value and categoryOptionsTbl[category].childOrder[key] then - tDeleteItem(childs, key) - - local i = 1 - for _, child in pairs(childs) do - categoryOptionsTbl[category].childOrder[child] = i - i = i + 1 - end - - categoryOptionsTbl[category].childOrder[key] = nil - optionsOrderConfig[category].args[key] = nil - elseif value and not tContains(childs, key) then - local order = (#childs + 1) - tinsert(childs, order, key) - - categoryOptionsTbl[category].childOrder[key] = order - - optionsOrderConfig[category].args[key] = { - order = order, - type = 'input', - name = PermoksAccountManager.labelRows[key].label, - width = 'half' - } - elseif categoryType == 'customCategories' then - categoryOptionsTbl[category].childOrder[key] = value - optionsOrderConfig[category].args[key] = nil - end - - PermoksAccountManager:UpdateAnchorsAndSize(category, nil, true, true) + local key = info[#info] + local category = info[3] + local categoryType = info[2] + local categoryOptionsTbl = PermoksAccountManager.db.global.options[categoryType] + + local childs = categoryOptionsTbl[category].childs + local optionsOrderConfig = options.args.order.args[categoryType].args + if not value and categoryOptionsTbl[category].childOrder[key] then + tDeleteItem(childs, key) + + local i = 1 + for _, child in pairs(childs) do + categoryOptionsTbl[category].childOrder[child] = i + i = i + 1 + end + + categoryOptionsTbl[category].childOrder[key] = nil + optionsOrderConfig[category].args[key] = nil + elseif value and not tContains(childs, key) then + local order = (#childs + 1) + tinsert(childs, order, key) + + categoryOptionsTbl[category].childOrder[key] = order + + optionsOrderConfig[category].args[key] = { + order = order, + type = "input", + name = PermoksAccountManager.labelRows[key].label, + width = "half", + } + elseif categoryType == "customCategories" then + categoryOptionsTbl[category].childOrder[key] = value + optionsOrderConfig[category].args[key] = nil + end + + PermoksAccountManager:UpdateAnchorsAndSize(category, nil, true, true) end local function getCategoryChildOption(info) - local key = info[#info] - local categoryType = info[2] - local category = info[3] + local key = info[#info] + local categoryType = info[2] + local category = info[3] - local value = PermoksAccountManager.db.global.options[categoryType][category].childOrder[key] - return type(value) == 'number' or (type(value) == 'boolean' and value) + local value = PermoksAccountManager.db.global.options[categoryType][category].childOrder[key] + return type(value) == "number" or (type(value) == "boolean" and value) end local function addCategoryToggle(optionsTable, category, name, order) - options.args.categories.args[optionsTable].args[category] = { - order = order, - type = 'toggle', - name = name - } + options.args.categories.args[optionsTable].args[category] = { + order = order, + type = "toggle", + name = name, + } end local function addCategoryOptions(optionsTable, args, category, name, order) - options.args.categories.args[optionsTable].args[category] = { - order = order, - type = 'group', - name = name, - hidden = function() - return not PermoksAccountManager.db.global.options[optionsTable][category].enabled - end, - args = args or PermoksAccountManager:GetCustomLabelTable() - } - - options.args.order.args[optionsTable].args[category] = { - order = order, - type = 'group', - name = name, - hidden = function() - return not PermoksAccountManager.db.global.options[optionsTable][category].enabled - end, - args = {} - } + options.args.categories.args[optionsTable].args[category] = { + order = order, + type = "group", + name = name, + hidden = function() + return not PermoksAccountManager.db.global.options[optionsTable][category].enabled + end, + args = args or PermoksAccountManager:GetCustomLabelTable(), + } + + options.args.order.args[optionsTable].args[category] = { + order = order, + type = "group", + name = name, + hidden = function() + return not PermoksAccountManager.db.global.options[optionsTable][category].enabled + end, + args = {}, + } end local function createOrderOptionsForCategory(categoryOptions, optionsTable, category) - if not categoryOptions.hideToggle then - options.args.order.args[optionsTable .. 'Order'].args[category] = { - order = categoryOptions.order, - type = 'input', - name = categoryOptions.name, - width = 'half' - } - end - - table.sort( - categoryOptions.childs, - function(a, b) - if a and b then - return (categoryOptions.childOrder[a] or 0) < (categoryOptions.childOrder[b] or 0) - end - end - ) - - for i, child in pairs(categoryOptions.childs) do - local name = PermoksAccountManager.labelRows[child] and PermoksAccountManager.labelRows[child].label - if name then - options.args.order.args[optionsTable].args[category].args[child] = { - order = i, - type = 'input', - name = name, - width = 'half' - } - end - end + if not categoryOptions.hideToggle then + options.args.order.args[optionsTable .. "Order"].args[category] = { + order = categoryOptions.order, + type = "input", + name = categoryOptions.name, + width = "half", + } + end + + table.sort(categoryOptions.childs, function(a, b) + if a and b then + return (categoryOptions.childOrder[a] or 0) < (categoryOptions.childOrder[b] or 0) + end + end) + + for i, child in pairs(categoryOptions.childs) do + local name = PermoksAccountManager.labelRows[child] and PermoksAccountManager.labelRows[child].label + if name then + options.args.order.args[optionsTable].args[category].args[child] = { + order = i, + type = "input", + name = name, + width = "half", + } + end + end end local function addCustomCategory(category, name, isDefault) - if isDefault then - local currentCategories = PermoksAccountManager.db.global.currentCategories - if not currentCategories[category].name then - PermoksAccountManager.numCategories = PermoksAccountManager.numCategories + 1 - local order = PermoksAccountManager.numCategories - - currentCategories[category] = { - name = name, - childs = {}, - childOrder = {}, - order = order, - hideToggle = false, - enabled = true, - } - - addCategoryToggle('default_categories_toggles', category, name, order) - addCategoryOptions('defaultCategories', nil, category, name, order) - createOrderOptionsForCategory(PermoksAccountManager.db.global.options.defaultCategories[category], 'defaultCategories', category) - - selectDifferentTab('defaultCategories', category) - PermoksAccountManager:UpdateOrCreateCategoryButtons() - end - elseif not custom_categories[category].name then - if PermoksAccountManager.db.global.custom then - PermoksAccountManager.numCategories = PermoksAccountManager.numCategories + 1 - end - local order = PermoksAccountManager.numCategories - - custom_categories[category].order = order - custom_categories[category].name = name - - addCategoryToggle('custom_categories_toggles', category, name, order) - addCategoryOptions('customCategories', nil, category, name, order) - createOrderOptionsForCategory(PermoksAccountManager.db.global.options.customCategories[category], 'customCategories', category) - - selectDifferentTab('customCategories', category) - PermoksAccountManager:UpdateOrCreateCategoryButtons() - end + if isDefault then + local currentCategories = PermoksAccountManager.db.global.currentCategories + if not currentCategories[category].name then + PermoksAccountManager.numCategories = PermoksAccountManager.numCategories + 1 + local order = PermoksAccountManager.numCategories + + currentCategories[category] = { + name = name, + childs = {}, + childOrder = {}, + order = order, + hideToggle = false, + enabled = true, + } + + addCategoryToggle("default_categories_toggles", category, name, order) + addCategoryOptions("defaultCategories", nil, category, name, order) + createOrderOptionsForCategory( + PermoksAccountManager.db.global.options.defaultCategories[category], + "defaultCategories", + category + ) + + selectDifferentTab("defaultCategories", category) + PermoksAccountManager:UpdateOrCreateCategoryButtons() + end + elseif not custom_categories[category].name then + if PermoksAccountManager.db.global.custom then + PermoksAccountManager.numCategories = PermoksAccountManager.numCategories + 1 + end + local order = PermoksAccountManager.numCategories + + custom_categories[category].order = order + custom_categories[category].name = name + + addCategoryToggle("custom_categories_toggles", category, name, order) + addCategoryOptions("customCategories", nil, category, name, order) + createOrderOptionsForCategory( + PermoksAccountManager.db.global.options.customCategories[category], + "customCategories", + category + ) + + selectDifferentTab("customCategories", category) + PermoksAccountManager:UpdateOrCreateCategoryButtons() + end end local function createDefaultOptions() - local numCategories = 0 - - for category, info in pairs(PermoksAccountManager.db.global.options.defaultCategories) do - if not info.hideToggle then - if PermoksAccountManager.db.global.options.defaultCategories[category].enabled then - numCategories = numCategories + 1 - end - addCategoryToggle('default_categories_toggles', category, info.name, info.order) - end - - local args = {} - if category == 'general' or not default_categories[category] then - args = nil - else - if info.childs then - for i, child in pairs(info.childs) do - if PermoksAccountManager.labelRows[child] and not PermoksAccountManager.labelRows[child].hideOption then - args[child] = { - order = i, - type = 'toggle', - name = PermoksAccountManager.labelRows[child].label - } - end - end - end - end - - if not PermoksAccountManager.db.global.options.defaultCategories[category].childs then - PermoksAccountManager:UpdateDefaultCategories(category) - end - - addCategoryOptions('defaultCategories', args, category, info.name, info.order) - createOrderOptionsForCategory(PermoksAccountManager.db.global.options.defaultCategories[category], 'defaultCategories', category) - end - - return numCategories + local numCategories = 0 + + for category, info in pairs(PermoksAccountManager.db.global.options.defaultCategories) do + if not info.hideToggle then + if PermoksAccountManager.db.global.options.defaultCategories[category].enabled then + numCategories = numCategories + 1 + end + addCategoryToggle("default_categories_toggles", category, info.name, info.order) + end + + local args = {} + if category == "general" or not default_categories[category] then + args = nil + else + if info.childs then + for i, child in pairs(info.childs) do + if + PermoksAccountManager.labelRows[child] + and not PermoksAccountManager.labelRows[child].hideOption + then + args[child] = { + order = i, + type = "toggle", + name = PermoksAccountManager.labelRows[child].label, + } + end + end + end + end + + if not PermoksAccountManager.db.global.options.defaultCategories[category].childs then + PermoksAccountManager:UpdateDefaultCategories(category) + end + + addCategoryOptions("defaultCategories", args, category, info.name, info.order) + createOrderOptionsForCategory( + PermoksAccountManager.db.global.options.defaultCategories[category], + "defaultCategories", + category + ) + end + + return numCategories end local function createCustomOptions() - local numCategories = 0 + local numCategories = 0 - for category, info in pairs(custom_categories) do - if not info.hideToggle then - numCategories = numCategories + 1 - addCategoryToggle('custom_categories_toggles', category, info.name, info.order) - end + for category, info in pairs(custom_categories) do + if not info.hideToggle then + numCategories = numCategories + 1 + addCategoryToggle("custom_categories_toggles", category, info.name, info.order) + end - addCategoryOptions('customCategories', nil, category, info.name, info.order) - createOrderOptionsForCategory(PermoksAccountManager.db.global.options.customCategories[category], 'customCategories', category) - end + addCategoryOptions("customCategories", nil, category, info.name, info.order) + createOrderOptionsForCategory( + PermoksAccountManager.db.global.options.customCategories[category], + "customCategories", + category + ) + end - return numCategories + return numCategories end local labelData = {} local function EditCustomLabel(labelInfo, labelOptionsInfo) - labelData = labelInfo - labelData.oldId = labelOptionsInfo[#labelOptionsInfo] - AceConfigRegistry:NotifyChange(addonName) + labelData = labelInfo + labelData.oldId = labelOptionsInfo[#labelOptionsInfo] + AceConfigRegistry:NotifyChange(addonName) end local function CreateCustomLabelQuestKey(name) - return name:lower():gsub(" ", "_") + return name:lower():gsub(" ", "_") end local function CreateCustomLabelButton(labelInfo, options, labelOptionsTbl, labelIdentifier) - local labelIdentifier = labelIdentifier or labelInfo.labelIdentifier or string.format('custom_%s', labelInfo.name:lower()) - if PermoksAccountManager.labelRows[labelIdentifier] then - PermoksAccountManager:Print(labelInfo.name .. ' already exists as a custom label.') - return - end - - labelOptionsTbl.args[labelInfo.id] = { - type = 'execute', - name = labelInfo.name, - labelIdentifier = labelIdentifier, - func = function(info) - EditCustomLabel(labelInfo, info) - end - } - - labelInfo.labelIdentifier = labelIdentifier - options[labelInfo.id] = labelInfo - PermoksAccountManager.labelRows[labelIdentifier] = { - label = labelInfo.name, - type = labelInfo.type, - customId = labelInfo.id, - key = labelInfo.type ~= 'quest' and labelInfo.id or nil, - group = labelInfo.type ~= 'quest' and labelInfo.type or string.format("reset%s%s", labelInfo.reset:sub(1,1):upper(), labelInfo.reset:sub(2)), - tooltip = labelInfo.type == 'item', - version = WOW_PROJECT_ID - } - - if labelInfo.type == 'item' then - PermoksAccountManager.item[labelInfo.id] = {key = labelIdentifier} - - local module, charInfo = PermoksAccountManager:GetPAMModule('items') - if module and charInfo then - module.update(charInfo) - end - elseif labelInfo.type == 'currency' then - PermoksAccountManager.currency[labelInfo.id] = 0 - - local module, charInfo = PermoksAccountManager:GetPAMModule('currencies') - if module and charInfo then - module.update(charInfo) - end - elseif labelInfo.type == 'quest' then - local key = CreateCustomLabelQuestKey(labelInfo.name) - if not PermoksAccountManager.quests[key] then - PermoksAccountManager.quests[key] = {} - PermoksAccountManager.quests[key][labelInfo.id] = {questType = labelInfo.reset, log = not labelInfo.hidden} - - local module, charInfo = PermoksAccountManager:GetPAMModule('quests') - if module and charInfo then - module.update(charInfo) - end - else - PermoksAccountManager:Print(labelInfo.name .. " already exists. Please choose a different one.") - end - end + local labelIdentifier = labelIdentifier + or labelInfo.labelIdentifier + or string.format("custom_%s", labelInfo.name:lower()) + if PermoksAccountManager.labelRows[labelIdentifier] then + PermoksAccountManager:Print(labelInfo.name .. " already exists as a custom label.") + return + end + + labelOptionsTbl.args[labelInfo.id] = { + type = "execute", + name = labelInfo.name, + labelIdentifier = labelIdentifier, + func = function(info) + EditCustomLabel(labelInfo, info) + end, + } + + labelInfo.labelIdentifier = labelIdentifier + options[labelInfo.id] = labelInfo + PermoksAccountManager.labelRows[labelIdentifier] = { + label = labelInfo.name, + type = labelInfo.type, + customId = labelInfo.id, + key = labelInfo.type ~= "quest" and labelInfo.id or nil, + group = labelInfo.type ~= "quest" and labelInfo.type + or string.format("reset%s%s", labelInfo.reset:sub(1, 1):upper(), labelInfo.reset:sub(2)), + tooltip = labelInfo.type == "item", + version = WOW_PROJECT_ID, + } + + if labelInfo.type == "item" then + PermoksAccountManager.item[labelInfo.id] = { key = labelIdentifier } + + local module, charInfo = PermoksAccountManager:GetPAMModule("items") + if module and charInfo then + module.update(charInfo) + end + elseif labelInfo.type == "currency" then + PermoksAccountManager.currency[labelInfo.id] = 0 + + local module, charInfo = PermoksAccountManager:GetPAMModule("currencies") + if module and charInfo then + module.update(charInfo) + end + elseif labelInfo.type == "quest" then + local key = CreateCustomLabelQuestKey(labelInfo.name) + if not PermoksAccountManager.quests[key] then + PermoksAccountManager.quests[key] = {} + PermoksAccountManager.quests[key][labelInfo.id] = + { questType = labelInfo.reset, log = not labelInfo.hidden } + + local module, charInfo = PermoksAccountManager:GetPAMModule("quests") + if module and charInfo then + module.update(charInfo) + end + else + PermoksAccountManager:Print(labelInfo.name .. " already exists. Please choose a different one.") + end + end end local function DeleteCustomLabelButton(labelInfo, isUpdate) - local labelOptionsTbl = options.args.add.args[labelInfo.type] - local options = PermoksAccountManager.db.global.options.customLabels[labelInfo.type] - if labelOptionsTbl and options and labelOptionsTbl.args[labelInfo.id] then - local oldLabelOptions = labelOptionsTbl.args[labelInfo.id] - local oldLabeRowInfo = PermoksAccountManager.labelRows[oldLabelOptions.labelIdentifier] - - PermoksAccountManager.labelRows[oldLabelOptions.labelIdentifier] = nil - labelOptionsTbl.args[labelInfo.id] = nil - options[labelInfo.id] = nil - labelData = {} - - if not isUpdate then - PermoksAccountManager:DeleteUnusedLabels(oldLabelOptions.labelIdentifier) - PermoksAccountManager:RemoveIdentifierFromLabelTable(oldLabeRowInfo.type, oldLabelOptions.labelIdentifier) - end - end + local labelOptionsTbl = options.args.add.args[labelInfo.type] + local options = PermoksAccountManager.db.global.options.customLabels[labelInfo.type] + if labelOptionsTbl and options and labelOptionsTbl.args[labelInfo.id] then + local oldLabelOptions = labelOptionsTbl.args[labelInfo.id] + local oldLabeRowInfo = PermoksAccountManager.labelRows[oldLabelOptions.labelIdentifier] + + PermoksAccountManager.labelRows[oldLabelOptions.labelIdentifier] = nil + labelOptionsTbl.args[labelInfo.id] = nil + options[labelInfo.id] = nil + labelData = {} + + if not isUpdate then + PermoksAccountManager:DeleteUnusedLabels(oldLabelOptions.labelIdentifier) + PermoksAccountManager:RemoveIdentifierFromLabelTable(oldLabeRowInfo.type, oldLabelOptions.labelIdentifier) + end + end end local function UpdateCustomLabelButton(labelInfo, options, labelOptionsTbl) - local oldId = labelInfo.oldId - if oldId and labelOptionsTbl.args[oldId] then - local oldlabelOptionsTbl = labelOptionsTbl.args[oldId] - local labelIdentifier = oldlabelOptionsTbl.labelIdentifier or string.format('custom_%s', labelInfo.name:lower()) - - DeleteCustomLabelButton({name = oldlabelOptionsTbl.name, id = oldId, type = labelInfo.type}, true) - CreateCustomLabelButton(labelInfo, options, labelOptionsTbl, labelIdentifier) - end + local oldId = labelInfo.oldId + if oldId and labelOptionsTbl.args[oldId] then + local oldlabelOptionsTbl = labelOptionsTbl.args[oldId] + local labelIdentifier = oldlabelOptionsTbl.labelIdentifier or string.format("custom_%s", labelInfo.name:lower()) + + DeleteCustomLabelButton({ name = oldlabelOptionsTbl.name, id = oldId, type = labelInfo.type }, true) + CreateCustomLabelButton(labelInfo, options, labelOptionsTbl, labelIdentifier) + end end function PermoksAccountManager:AddCustomLabelButton(labelInfo) - local labelOptionsTbl = options.args.add.args[labelInfo.type] - local options = self.db.global.options.customLabels[labelInfo.type] - if labelOptionsTbl and options then - if not labelOptionsTbl.args[labelInfo.id] and not labelOptionsTbl.args[labelInfo.oldId] then - CreateCustomLabelButton(labelInfo, options, labelOptionsTbl) - else - UpdateCustomLabelButton(labelInfo, options, labelOptionsTbl) - end - end + local labelOptionsTbl = options.args.add.args[labelInfo.type] + local options = self.db.global.options.customLabels[labelInfo.type] + if labelOptionsTbl and options then + if not labelOptionsTbl.args[labelInfo.id] and not labelOptionsTbl.args[labelInfo.oldId] then + CreateCustomLabelButton(labelInfo, options, labelOptionsTbl) + else + UpdateCustomLabelButton(labelInfo, options, labelOptionsTbl) + end + end end local function createConfirmPopup() - -- mostly copied from AceConfigDialog-3.0.lua - local frame = CreateFrame('Frame', nil, UIParent) - PermoksAccountManager.confirm = frame - frame:Hide() - frame:SetPoint('CENTER', UIParent, 'CENTER') - frame:SetSize(320, 85) - frame:SetFrameStrata('TOOLTIP') - - local border = CreateFrame('Frame', nil, frame, 'DialogBorderDarkTemplate') - border:SetAllPoints(frame) - - local text = frame:CreateFontString(nil, 'ARTWORK', 'GameFontHighlight') - text:SetSize(290, 0) - text:SetPoint('TOP', 0, -16) - text:SetText('You need to reload the interface to import a profile.') - - local function newButton(text, parent) - local button = AceGUI:Create('Button') - button.frame:SetParent(frame) - button.frame:SetFrameLevel(button.frame:GetFrameLevel() + 1) - button:SetText(text) - return button - end - - local accept = newButton(ACCEPT) - accept:SetPoint('BOTTOMRIGHT', frame, 'BOTTOM', -6, 16) - accept.frame:SetSize(128, 21) - accept.frame:Show() - frame.accept = accept - - local cancel = newButton(CANCEL) - cancel:SetPoint('LEFT', accept.frame, 'RIGHT', 13, 0) - cancel.frame:SetSize(128, 21) - cancel.frame:Show() - cancel:SetCallback( - 'OnClick', - function() - frame:Hide() - end - ) - frame.cancel = cancel + -- mostly copied from AceConfigDialog-3.0.lua + local frame = CreateFrame("Frame", nil, UIParent) + PermoksAccountManager.confirm = frame + frame:Hide() + frame:SetPoint("CENTER", UIParent, "CENTER") + frame:SetSize(320, 85) + frame:SetFrameStrata("TOOLTIP") + + local border = CreateFrame("Frame", nil, frame, "DialogBorderDarkTemplate") + border:SetAllPoints(frame) + + local text = frame:CreateFontString(nil, "ARTWORK", "GameFontHighlight") + text:SetSize(290, 0) + text:SetPoint("TOP", 0, -16) + text:SetText("You need to reload the interface to import a profile.") + + local function newButton(text, parent) + local button = AceGUI:Create("Button") + button.frame:SetParent(frame) + button.frame:SetFrameLevel(button.frame:GetFrameLevel() + 1) + button:SetText(text) + return button + end + + local accept = newButton(ACCEPT) + accept:SetPoint("BOTTOMRIGHT", frame, "BOTTOM", -6, 16) + accept.frame:SetSize(128, 21) + accept.frame:Show() + frame.accept = accept + + local cancel = newButton(CANCEL) + cancel:SetPoint("LEFT", accept.frame, "RIGHT", 13, 0) + cancel.frame:SetSize(128, 21) + cancel.frame:Show() + cancel:SetCallback("OnClick", function() + frame:Hide() + end) + frame.cancel = cancel end local function createImportExportFrame(options) - local editGroup = AceGUI:Create('InlineGroup') - editGroup:SetLayout('fill') - editGroup.frame:SetParent(options.frame) - editGroup.frame:SetPoint('BOTTOMLEFT', options.frame, 'BOTTOMLEFT', 17, 52) - editGroup.frame:SetPoint('TOPRIGHT', options.frame, 'TOPRIGHT', -17, -10) - editGroup.frame:Hide() - - local editBox = AceGUI:Create('MultiLineEditBox') - editBox:SetWidth(options.frame:GetWidth() - 20) - editBox:SetLabel('Export Options') - editBox.button:Hide() - editBox.frame:SetClipsChildren(true) - editBox.editBox:SetScript( - 'OnEscapePressed', - function() - editGroup:Close() - end - ) - editGroup:AddChild(editBox) - - local close = AceGUI:Create('Button') - close.frame:SetParent(editGroup.frame) - close:SetPoint('BOTTOMRIGHT', -27, 13) - close.frame:SetFrameLevel(close.frame:GetFrameLevel() + 1) - close:SetHeight(20) - close:SetWidth(100) - close.frame:Hide() - - function editGroup.OpenBox(self, mode) - if mode == 'export' then - editGroup.frame:Show() - - local optionsString = PermoksAccountManager:OptionsToString() - editBox.editBox:SetScript( - 'OnChar', - function() - editBox:SetText(optionsString) - editBox.editBox:HighlightText() - end - ) - editBox.button:Hide() - editBox:SetText(optionsString) - editBox.editBox:HighlightText() - editBox:SetFocus() - close:SetCallback( - 'OnClick', - function() - editGroup:Close(true) - end - ) - close:SetText('Done') - close.frame:Show() - - C_Timer.After( - 0, - function() - options:ReleaseChildren() - end - ) - elseif mode == 'import' then - editBox:SetText('') - editGroup.frame:Show() - editBox:SetFocus() - - close:SetCallback( - 'OnClick', - function() - PermoksAccountManager:ImportOptions(editBox:GetText()) - end - ) - close:SetText('Import') - close.frame:Show() - - C_Timer.After( - 0, - function() - options:ReleaseChildren() - end - ) - end - end - - function editGroup.Close(self, openOptions) - editBox:ClearFocus() - editGroup.frame:Hide() - - if openOptions then - PermoksAccountManager.OpenOptions() - end - end - - return editGroup + local editGroup = AceGUI:Create("InlineGroup") + editGroup:SetLayout("fill") + editGroup.frame:SetParent(options.frame) + editGroup.frame:SetPoint("BOTTOMLEFT", options.frame, "BOTTOMLEFT", 17, 52) + editGroup.frame:SetPoint("TOPRIGHT", options.frame, "TOPRIGHT", -17, -10) + editGroup.frame:Hide() + + local editBox = AceGUI:Create("MultiLineEditBox") + editBox:SetWidth(options.frame:GetWidth() - 20) + editBox:SetLabel("Export Options") + editBox.button:Hide() + editBox.frame:SetClipsChildren(true) + editBox.editBox:SetScript("OnEscapePressed", function() + editGroup:Close() + end) + editGroup:AddChild(editBox) + + local close = AceGUI:Create("Button") + close.frame:SetParent(editGroup.frame) + close:SetPoint("BOTTOMRIGHT", -27, 13) + close.frame:SetFrameLevel(close.frame:GetFrameLevel() + 1) + close:SetHeight(20) + close:SetWidth(100) + close.frame:Hide() + + function editGroup.OpenBox(self, mode) + if mode == "export" then + editGroup.frame:Show() + + local optionsString = PermoksAccountManager:OptionsToString() + editBox.editBox:SetScript("OnChar", function() + editBox:SetText(optionsString) + editBox.editBox:HighlightText() + end) + editBox.button:Hide() + editBox:SetText(optionsString) + editBox.editBox:HighlightText() + editBox:SetFocus() + close:SetCallback("OnClick", function() + editGroup:Close(true) + end) + close:SetText("Done") + close.frame:Show() + + C_Timer.After(0, function() + options:ReleaseChildren() + end) + elseif mode == "import" then + editBox:SetText("") + editGroup.frame:Show() + editBox:SetFocus() + + close:SetCallback("OnClick", function() + PermoksAccountManager:ImportOptions(editBox:GetText()) + end) + close:SetText("Import") + close.frame:Show() + + C_Timer.After(0, function() + options:ReleaseChildren() + end) + end + end + + function editGroup.Close(self, openOptions) + editBox:ClearFocus() + editGroup.frame:Hide() + + if openOptions then + PermoksAccountManager.OpenOptions() + end + end + + return editGroup end function PermoksAccountManager:LoadOptionsTemplate() - local categoryData = {} - local syncData = {} - - options = { - type = 'group', - name = addonName, - args = {} - } - - options.args.categoryToggles = { - order = 1, - type = 'group', - name = L['General'], - args = { - general = { - order = 1, - type = 'group', - name = L['General'], - inline = true, - set = function(info, value) - PermoksAccountManager.db.global.options[info[#info]] = value - end, - get = function(info) - return PermoksAccountManager.db.global.options[info[#info]] - end, - args = { - showGuildAttunementButton = { - order = 1, - type = 'toggle', - name = L['Show Guild Attunement Button'], - hidden = function() - return not PermoksAccountManager.isBC - end, - set = function(info, value) - PermoksAccountManager.db.global.options.showGuildAttunementButton = value - PermoksAccountManager.managerFrame.guildAttunementButton:SetShown(value) - end, - get = function(info) - return PermoksAccountManager.db.global.options.showGuildAttunementButton - end - }, - showMinimapButton = { - order = 2, - type = 'toggle', - name = L['Show Minimap Button'], - set = function(info, value) - PermoksAccountManager.db.profile.minimap.hide = not value - if not value then - LibIcon:Hide('PermoksAccountManager') - else - LibIcon:Show('PermoksAccountManager') - end - end, - get = function(info) - return not PermoksAccountManager.db.profile.minimap.hide - end - }, - useCustom = { - order = 3, - type = 'toggle', - name = L['Use Custom'], - desc = 'Toggle the use of custom categories.', - set = function(info, value) - PermoksAccountManager.db.global.custom = value - C_UI.Reload() - end, - get = function(info) - return PermoksAccountManager.db.global.custom - end, - confirm = true, - confirmText = 'Requires a reload!' - }, - hideCategory = { - order = 4, - type = 'toggle', - name = L['Hide Category'], - desc = L['Hide Category when closing the manager.'], - set = function(info, value) - if value then - PermoksAccountManager:HideAllCategories() - end - - PermoksAccountManager.db.global.options[info[#info]] = value - end - }, + local categoryData = {} + local syncData = {} + + options = { + type = "group", + name = addonName, + args = {}, + } + + options.args.categoryToggles = { + order = 1, + type = "group", + name = L["General"], + args = { + general = { + order = 1, + type = "group", + name = L["General"], + inline = true, + set = function(info, value) + PermoksAccountManager.db.global.options[info[#info]] = value + end, + get = function(info) + return PermoksAccountManager.db.global.options[info[#info]] + end, + args = { + showGuildAttunementButton = { + order = 1, + type = "toggle", + name = L["Show Guild Attunement Button"], + hidden = function() + return not PermoksAccountManager.isBC + end, + set = function(info, value) + PermoksAccountManager.db.global.options.showGuildAttunementButton = value + PermoksAccountManager.managerFrame.guildAttunementButton:SetShown(value) + end, + get = function(info) + return PermoksAccountManager.db.global.options.showGuildAttunementButton + end, + }, + showMinimapButton = { + order = 2, + type = "toggle", + name = L["Show Minimap Button"], + set = function(info, value) + PermoksAccountManager.db.profile.minimap.hide = not value + if not value then + LibIcon:Hide("PermoksAccountManager") + else + LibIcon:Show("PermoksAccountManager") + end + end, + get = function(info) + return not PermoksAccountManager.db.profile.minimap.hide + end, + }, + useCustom = { + order = 3, + type = "toggle", + name = L["Use Custom"], + desc = "Toggle the use of custom categories.", + set = function(info, value) + PermoksAccountManager.db.global.custom = value + C_UI.Reload() + end, + get = function(info) + return PermoksAccountManager.db.global.custom + end, + confirm = true, + confirmText = "Requires a reload!", + }, + hideCategory = { + order = 4, + type = "toggle", + name = L["Hide Category"], + desc = L["Hide Category when closing the manager."], + set = function(info, value) + if value then + PermoksAccountManager:HideAllCategories() + end + + PermoksAccountManager.db.global.options[info[#info]] = value + end, + }, savePosition = { order = 5, - type = 'toggle', - name = L['Save Position'], + type = "toggle", + name = L["Save Position"], + }, + hideWarband = { + order = 6, + type = "toggle", + name = "Hide Warband", + hidden = function() + return not PermoksAccountManager.isRetail + end, + set = function(info, value) + PermoksAccountManager.db.global.options[info[#info]] = value + C_UI.Reload() + end, + confirm = true, + confirmText = "This requires a reload (for now). Are you sure?", + }, + }, + }, + commands = { + order = 5, + type = "group", + name = L["Commands"], + inline = true, + args = { + export = { + order = 0, + type = "execute", + name = L["Export"], + func = function() + imexport:OpenBox("export") + end, + }, + import = { + order = 1, + type = "execute", + name = L["Import"], + func = function() + imexport:OpenBox("import") + end, + }, + resetDB = { + order = 2, + type = "execute", + name = L["Reset Categories"], + func = function() + PermoksAccountManager:ResetCategories() + C_UI.Reload() + end, + confirm = true, + confirmText = "Are you sure?", + }, + weeklyReset = { + order = 3, + type = "execute", + name = "Trigger Weekly Reset", + func = function() + PermoksAccountManager:ResetAccount( + PermoksAccountManager.db.global, + PermoksAccountManager.account, + nil, + true + ) + C_UI.Reload() + end, + confirm = true, + confirmText = "Are you sure?", + }, + dailyReset = { + order = 4, + type = "execute", + name = "Trigger Daily Reset", + func = function() + PermoksAccountManager:ResetAccount( + PermoksAccountManager.db.global, + PermoksAccountManager.account, + true + ) + C_UI.Reload() + end, + confirm = true, + confirmText = "Are you sure?", + }, + purge = { + order = 5, + type = "execute", + name = L["Purge"], + func = function() + PermoksAccountManager:Purge() + C_UI.Reload() + end, + confirm = true, + confirmText = "Are you sure?", }, - hideWarband = { - order = 6, - type = 'toggle', - name = 'Hide Warband', - hidden = function() return not PermoksAccountManager.isRetail end, - set = function(info, value) - PermoksAccountManager.db.global.options[info[#info]] = value - C_UI.Reload() - end, - confirm = true, - confirmText = 'This requires a reload (for now). Are you sure?', - }, - } - }, - commands = { - order = 5, - type = 'group', - name = L['Commands'], - inline = true, - args = { - export = { - order = 0, - type = 'execute', - name = L['Export'], - func = function() - imexport:OpenBox('export') - end - }, - import = { - order = 1, - type = 'execute', - name = L['Import'], - func = function() - imexport:OpenBox('import') - end - }, - resetDB = { - order = 2, - type = 'execute', - name = L['Reset Categories'], - func = function() - PermoksAccountManager:ResetCategories() - C_UI.Reload() - end, - confirm = true, - confirmText = 'Are you sure?' - }, - purge = { - order = 3, - type = 'execute', - name = L['Purge'], - func = function() - PermoksAccountManager:Purge() - C_UI.Reload() - end, - confirm = true, - confirmText = 'Are you sure?' - } - } - } - } - } - - options.args.frame = { - order = 1.5, - type = 'group', - name = L['Frame Config'], - get = function(info) - local key = info[#info] - local parentKey = info[#info - 1] - return PermoksAccountManager.db.global.options[parentKey][key] - end, - set = function(info, value) - local key = info[#info] - local parentKey = info[#info - 1] - PermoksAccountManager.db.global.options[parentKey][key] = value - end, - args = { - characters = { - order = 1, - type = 'group', - name = L['Characters'], - inline = true, - set = function(info, value) - local key = info[#info] - local parentKey = info[#info - 1] - PermoksAccountManager.db.global.options[parentKey][key] = value - - if key == 'charactersPerPage' then - PermoksAccountManager.db.global.currentPage = 1 - PermoksAccountManager:SortPages() - PermoksAccountManager:UpdatePageButtons() - PermoksAccountManager:UpdateAnchorsAndSize('general', true) - end - end, - args = { + }, + }, + }, + } + + options.args.frame = { + order = 1.5, + type = "group", + name = L["Frame Config"], + get = function(info) + local key = info[#info] + local parentKey = info[#info - 1] + return PermoksAccountManager.db.global.options[parentKey][key] + end, + set = function(info, value) + local key = info[#info] + local parentKey = info[#info - 1] + PermoksAccountManager.db.global.options[parentKey][key] = value + end, + args = { + characters = { + order = 1, + type = "group", + name = L["Characters"], + inline = true, + set = function(info, value) + local key = info[#info] + local parentKey = info[#info - 1] + PermoksAccountManager.db.global.options[parentKey][key] = value + + if key == "charactersPerPage" then + PermoksAccountManager.db.global.currentPage = 1 + PermoksAccountManager:SortPages() + PermoksAccountManager:UpdatePageButtons() + PermoksAccountManager:UpdateAnchorsAndSize("general", true) + end + end, + args = { warning = { order = 0, - type = 'description', - name = 'Will be moved to the Characters options in an upcoming update.' + type = "description", + name = "Will be moved to the Characters options in an upcoming update.", + }, + minLevel = { + order = 1, + type = "range", + name = L["Minimum Level"], + desc = L["Changing this won't remove characters that are below this threshold."], + min = 1, + max = GetMaxLevelForExpansionLevel(GetExpansionLevel()), + bigStep = 1, + }, + charactersPerPage = { + order = 2, + type = "range", + name = L["Characters Per Page"], + min = 3, + max = 20, + bigStep = 1, + }, + }, + }, + buttons = { + order = 2, + type = "group", + name = L["Column"], + inline = true, + set = function(info, value) + local key = info[#info] + local parentKey = info[#info - 1] + PermoksAccountManager.db.global.options[parentKey][key] = value + + if + key == "buttonWidth" + and PermoksAccountManager.db.global.options[parentKey].buttonTextWidth > value + then + PermoksAccountManager.db.global.options[parentKey].buttonTextWidth = value + end + + if key == "justifyH" then + PermoksAccountManager.isLayoutDirty = true + end + + PermoksAccountManager:UpdateAnchorsAndSize("general", true) + PermoksAccountManager.isLayoutDirty = nil + end, + args = { + buttonWidth = { + order = 1, + type = "range", + name = L["Button Width"], + set = function(info, value) + local key = info[#info] + local parentKey = info[#info - 1] + local options = PermoksAccountManager.db.global.options + + options[parentKey][key] = value + options.buttons.widthPerAlt = max(value, options.buttons.widthPerAlt) + PermoksAccountManager:UpdateAnchorsAndSize("general", true) + end, + min = 80, + max = 250, + bigStep = 1, + }, + buttonTextWidth = { + order = 2, + type = "range", + name = L["Text Width"], + set = function(info, value) + local key = info[#info] + local parentKey = info[#info - 1] + local options = PermoksAccountManager.db.global.options + + options[parentKey][key] = value + options[parentKey].buttonWidth = max(value, options[parentKey].buttonWidth) + options.buttons.widthPerAlt = + max(options[parentKey].buttonWidth, options.buttons.widthPerAlt) + PermoksAccountManager:UpdateAnchorsAndSize("general", true) + end, + min = 80, + max = 250, + }, + justifyH = { + order = 3, + type = "select", + name = L["Justify Horizontal"], + values = { ["LEFT"] = "Left", ["CENTER"] = "Center", ["RIGHT"] = "Right" }, + sorting = { "LEFT", "CENTER", "RIGHT" }, + style = "dropdown", }, - minLevel = { - order = 1, - type = 'range', - name = L['Minimum Level'], - desc = L["Changing this won't remove characters that are below this threshold."], - min = 1, - max = GetMaxLevelForExpansionLevel(GetExpansionLevel()), - bigStep = 1 - }, - charactersPerPage = { - order = 2, - type = 'range', - name = L['Characters Per Page'], - min = 3, - max = 20, - bigStep = 1 - } - } - }, - buttons = { - order = 2, - type = 'group', - name = L['Column'], - inline = true, - set = function(info, value) - local key = info[#info] - local parentKey = info[#info - 1] - PermoksAccountManager.db.global.options[parentKey][key] = value - - if key == 'buttonWidth' and PermoksAccountManager.db.global.options[parentKey].buttonTextWidth > value then - PermoksAccountManager.db.global.options[parentKey].buttonTextWidth = value - end - - if key == 'justifyH' then - PermoksAccountManager.isLayoutDirty = true - end - - PermoksAccountManager:UpdateAnchorsAndSize('general', true) - PermoksAccountManager.isLayoutDirty = nil - end, - args = { - buttonWidth = { - order = 1, - type = 'range', - name = L['Button Width'], - set = function(info, value) - local key = info[#info] - local parentKey = info[#info - 1] - local options = PermoksAccountManager.db.global.options - - options[parentKey][key] = value - options.buttons.widthPerAlt = max(value, options.buttons.widthPerAlt) - PermoksAccountManager:UpdateAnchorsAndSize('general', true) - end, - min = 80, - max = 250, - bigStep = 1 - }, - buttonTextWidth = { - order = 2, - type = 'range', - name = L['Text Width'], - set = function(info, value) - local key = info[#info] - local parentKey = info[#info - 1] - local options = PermoksAccountManager.db.global.options - - options[parentKey][key] = value - options[parentKey].buttonWidth = max(value, options[parentKey].buttonWidth) - options.buttons.widthPerAlt = max(options[parentKey].buttonWidth, options.buttons.widthPerAlt) - PermoksAccountManager:UpdateAnchorsAndSize('general', true) - end, - min = 80, - max = 250 - }, - justifyH = { - order = 3, - type = 'select', - name = L['Justify Horizontal'], - values = {['LEFT'] = 'Left', ['CENTER'] = 'Center', ['RIGHT'] = 'Right'}, - sorting = {'LEFT', 'CENTER', 'RIGHT'}, - style = 'dropdown' - }, widthPerAlt = { - order = 4, - type = 'range', - name = L['Column Width'], - min = 80, - max = 250, - bigStep = 1 - }, - } - }, - border = { - order = 3, - type = 'group', - name = L['Border'], - inline = true, - args = { - color = { - order = 2, - type = 'color', - name = L['Border Color'], - hasAlpha = true, - get = function(info) - return unpack(PermoksAccountManager.db.global.options.border.color) - end, - set = function(info, ...) - PermoksAccountManager.db.global.options.border.color = {...} - PermoksAccountManager:UpdateBorderColor() - end - }, - bgColor = { - order = 2, - type = 'color', - name = L['Background Color'], - hasAlpha = true, - get = function(info) - return unpack(PermoksAccountManager.db.global.options.border.bgColor) - end, - set = function(info, ...) - PermoksAccountManager.db.global.options.border.bgColor = {...} - PermoksAccountManager:UpdateBorderColor() - end - } - } - }, - other = { - order = 3, - type = 'group', - name = L['Other'], - inline = true, - set = function(info, value) - local key = info[#info] - local parentKey = info[#info - 1] - local options = PermoksAccountManager.db.global.options - options[parentKey].updated = options[parentKey].updated or options[parentKey][key] - options[parentKey][key] = value - - PermoksAccountManager:UpdateAnchorsAndSize('general', true) - end, - args = { - labelOffset = { - order = 1, - type = 'range', - name = L['Label Offset'], - min = 0, - max = 40, - bigStep = 1 - }, - frameStrata = { - order = 3, - type = 'select', - name = L['Frame Strata'], - values = {BACKGROUND = 'BACKGROUND', LOW = 'LOW', MEDIUM = 'MEDIUM', HIGH = 'HIGH', DIALOG = 'DIALOG', TOOLTIP = 'TOOLTIP'}, - sorting = {'BACKGROUND', 'LOW', 'MEDIUM', 'HIGH', 'DIALOG', 'TOOLTIP'}, - set = function(info, value) - local key = info[#info] - local parentKey = info[#info - 1] - - PermoksAccountManager.managerFrame:SetFrameStrata(value) - PermoksAccountManager.db.global.options[parentKey][key] = value - end - } - } - } - } - } + order = 4, + type = "range", + name = L["Column Width"], + min = 80, + max = 250, + bigStep = 1, + }, + }, + }, + border = { + order = 3, + type = "group", + name = L["Border"], + inline = true, + args = { + color = { + order = 2, + type = "color", + name = L["Border Color"], + hasAlpha = true, + get = function(info) + return unpack(PermoksAccountManager.db.global.options.border.color) + end, + set = function(info, ...) + PermoksAccountManager.db.global.options.border.color = { ... } + PermoksAccountManager:UpdateBorderColor() + end, + }, + bgColor = { + order = 2, + type = "color", + name = L["Background Color"], + hasAlpha = true, + get = function(info) + return unpack(PermoksAccountManager.db.global.options.border.bgColor) + end, + set = function(info, ...) + PermoksAccountManager.db.global.options.border.bgColor = { ... } + PermoksAccountManager:UpdateBorderColor() + end, + }, + }, + }, + other = { + order = 3, + type = "group", + name = L["Other"], + inline = true, + set = function(info, value) + local key = info[#info] + local parentKey = info[#info - 1] + local options = PermoksAccountManager.db.global.options + options[parentKey].updated = options[parentKey].updated or options[parentKey][key] + options[parentKey][key] = value + + PermoksAccountManager:UpdateAnchorsAndSize("general", true) + end, + args = { + labelOffset = { + order = 1, + type = "range", + name = L["Label Offset"], + min = 0, + max = 40, + bigStep = 1, + }, + frameStrata = { + order = 3, + type = "select", + name = L["Frame Strata"], + values = { + BACKGROUND = "BACKGROUND", + LOW = "LOW", + MEDIUM = "MEDIUM", + HIGH = "HIGH", + DIALOG = "DIALOG", + TOOLTIP = "TOOLTIP", + }, + sorting = { "BACKGROUND", "LOW", "MEDIUM", "HIGH", "DIALOG", "TOOLTIP" }, + set = function(info, value) + local key = info[#info] + local parentKey = info[#info - 1] + + PermoksAccountManager.managerFrame:SetFrameStrata(value) + PermoksAccountManager.db.global.options[parentKey][key] = value + end, + }, + }, + }, + }, + } options.args.characters = { order = 1.6, - type = 'group', - name = L['Characters'], - childGroups = 'tab', + type = "group", + name = L["Characters"], + childGroups = "tab", args = { test = { order = 1, - type = 'group', - name = L['Character Options'], + type = "group", + name = L["Character Options"], inline = true, args = { combine = { order = 1, - type = 'toggle', - name = L['Combine Accounts'], - desc = L['Combine Main and Alt Account Characters'], + type = "toggle", + name = L["Combine Accounts"], + desc = L["Combine Main and Alt Account Characters"], set = function(_, value) - PermoksAccountManager.db.global.options.characters.combine = value - C_UI.Reload() - end, - get = function(_) - return PermoksAccountManager.db.global.options.characters.combine - end, - confirm = true, - confirmText = 'Requires a reload!' + PermoksAccountManager.db.global.options.characters.combine = value + C_UI.Reload() + end, + get = function(_) + return PermoksAccountManager.db.global.options.characters.combine + end, + confirm = true, + confirmText = "Requires a reload!", }, - sortByIlvl = { - order = 2, - type = 'select', - name = L['Sort By'], - values = {ilevel = 'Ilevel', order = 'Custom Order', charLevel = 'Level'}, - sorting = {'order', 'ilevel', 'charLevel'}, - hidden = function() - return PermoksAccountManager.isWOTLK - end, + sortByIlvl = { + order = 2, + type = "select", + name = L["Sort By"], + values = { ilevel = "Ilevel", order = "Custom Order", charLevel = "Level" }, + sorting = { "order", "ilevel", "charLevel" }, + hidden = function() + return PermoksAccountManager.isWOTLK + end, set = function(_, value) - PermoksAccountManager.db.global.options.characters.sortBy = value - if value == 'order' then - PermoksAccountManager.db.global.options.characters.sortByLesser = true - else - PermoksAccountManager.db.global.options.characters.sortByLesser = false - end - - PermoksAccountManager:SortPages() - PermoksAccountManager:UpdateAnchorsAndSize('general') - end, - get = function(_) - return PermoksAccountManager.db.global.options.characters.sortBy - end, - }, - sortByComparison = { - order = 3, - type = 'select', - name = L['Operator'], - values = {greater = '>', lesser = '<'}, - sorting = {'greater', 'lesser'}, - width = 'half', - disabled = function() - return PermoksAccountManager.db.global.options.characters.sortBy == 'order' - end, - hidden = function() - return PermoksAccountManager.isWOTLK - end, + PermoksAccountManager.db.global.options.characters.sortBy = value + if value == "order" then + PermoksAccountManager.db.global.options.characters.sortByLesser = true + else + PermoksAccountManager.db.global.options.characters.sortByLesser = false + end + + PermoksAccountManager:SortPages() + PermoksAccountManager:UpdateAnchorsAndSize("general") + end, + get = function(_) + return PermoksAccountManager.db.global.options.characters.sortBy + end, + }, + sortByComparison = { + order = 3, + type = "select", + name = L["Operator"], + values = { greater = ">", lesser = "<" }, + sorting = { "greater", "lesser" }, + width = "half", + disabled = function() + return PermoksAccountManager.db.global.options.characters.sortBy == "order" + end, + hidden = function() + return PermoksAccountManager.isWOTLK + end, set = function(_, value) - PermoksAccountManager.db.global.options.characters.sortByLesser = value == 'lesser' - PermoksAccountManager:SortPages() - PermoksAccountManager:UpdateAnchorsAndSize('general') - end, - get = function(_) - return PermoksAccountManager.db.global.options.characters.sortByLesser and 'lesser' or 'greater' - end, - } - } + PermoksAccountManager.db.global.options.characters.sortByLesser = value == "lesser" + PermoksAccountManager:SortPages() + PermoksAccountManager:UpdateAnchorsAndSize("general") + end, + get = function(_) + return PermoksAccountManager.db.global.options.characters.sortByLesser and "lesser" + or "greater" + end, + }, + }, }, customCharacterOrder = { order = 2, - type = 'group', + type = "group", inline = true, - name = L['Character Info'], + name = L["Character Info"], get = function(info) for _, accountInfo in pairs(PermoksAccountManager.db.global.accounts) do - local data = accountInfo.data[info[#info-1]] + local data = accountInfo.data[info[#info - 1]] if data then return tostring(data.order) end @@ -1141,815 +1187,908 @@ function PermoksAccountManager:LoadOptionsTemplate() set = function(info, value) local order = tonumber(value) for _, accountInfo in pairs(PermoksAccountManager.db.global.accounts) do - local data = accountInfo.data[info[#info-1]] + local data = accountInfo.data[info[#info - 1]] if data then data.order = order - options.args.characters.args.customCharacterOrder.args[info[#info-1]].args.order = order + options.args.characters.args.customCharacterOrder.args[info[#info - 1]].args.order = order break end end AceConfigRegistry:NotifyChange(addonName) PermoksAccountManager:SortPages() - PermoksAccountManager:UpdateAnchorsAndSize('general') + PermoksAccountManager:UpdateAnchorsAndSize("general") end, - args = {} + args = {}, }, - } + }, + } + + options.args.categories = { + order = 2, + type = "group", + name = "Category Config", + set = setCategoryChildOption, + get = getCategoryChildOption, + args = { + default_categories_toggles = { + order = 1, + type = "group", + name = L["Categories"], + inline = true, + set = function(info, value) + local key = info[#info] + PermoksAccountManager.db.global.options.defaultCategories[key].enabled = value + + if not PermoksAccountManager.db.global.custom then + if not value then + PermoksAccountManager.numCategories = PermoksAccountManager.numCategories - 1 + else + PermoksAccountManager.numCategories = PermoksAccountManager.numCategories + 1 + end + end + PermoksAccountManager:UpdateMenu() + end, + get = function(info) + local key = info[#info] + return PermoksAccountManager.db.global.options.defaultCategories[key].enabled + end, + hidden = function() + return PermoksAccountManager.db.global.custom + end, + args = {}, + }, + custom_categories_toggles = { + order = 1, + type = "group", + name = L["Categories"], + inline = true, + hidden = function() + return not PermoksAccountManager.db.global.custom + end, + set = function(info, value) + local key = info[#info] + PermoksAccountManager.db.global.options.customCategories[key].enabled = value + + if PermoksAccountManager.db.global.custom then + if not value then + PermoksAccountManager.numCategories = PermoksAccountManager.numCategories - 1 + else + PermoksAccountManager.numCategories = PermoksAccountManager.numCategories + 1 + end + end + PermoksAccountManager:UpdateMenu() + end, + get = function(info) + local key = info[#info] + return PermoksAccountManager.db.global.options.customCategories[key].enabled + end, + args = {}, + }, + defaultCategories = { + order = 2, + type = "group", + name = L["Default"], + childGroups = "tab", + args = { + create = { + order = 100, + type = "group", + name = L["Add New"], + args = { + create_group = { + order = 1, + type = "group", + name = L["General"], + inline = true, + args = { + name = { + order = 1, + name = L["Name"], + type = "input", + validate = function(info, value) + if value:match("[^%w:]") then + return "You can only use letters, numbers, and colons (for now)." + elseif string.len(value) == 0 then + return "Can't create an empty category." + elseif + PermoksAccountManager.db.global.currentCategories[value:lower()].name + then + return "This category already exists." + end + + return true + end, + set = function(info, value) + categoryData.create = value + end, + get = function(info) + return categoryData.create or "" + end, + }, + create = { + order = 2, + name = L["Create"], + type = "execute", + func = function(info) + if categoryData.create then + local categoryName = categoryData.create:lower() + addCustomCategory(categoryName, categoryData.create, true) + categoryData.create = nil + end + end, + }, + }, + }, + }, + }, + }, + }, + customCategories = { + order = 3, + type = "group", + name = L["Custom"], + childGroups = "tab", + args = { + create = { + order = 100, + type = "group", + name = L["Add New"], + args = { + create_group = { + order = 1, + type = "group", + name = L["General"], + inline = true, + args = { + name = { + order = 1, + name = L["Name"], + type = "input", + validate = function(info, value) + if value:match("[^%w:]") then + return "You can only use letters, numbers, and colons (for now)." + elseif string.len(value) == 0 then + return "Can't create an empty category." + elseif + PermoksAccountManager.db.global.options.customCategories[value:lower()].name + then + return "This category already exists." + end + + return true + end, + set = function(info, value) + categoryData.create = value + end, + get = function(info) + return categoryData.create or "" + end, + }, + create = { + order = 2, + name = L["Create"], + type = "execute", + func = function(info) + if categoryData.create then + local categoryName = categoryData.create:lower() + addCustomCategory(categoryName, categoryData.create) + categoryData.create = nil + end + end, + }, + }, + }, + }, + }, + general = { + order = 0, + type = "group", + name = L["General"], + args = {}, + }, + }, + }, + }, + } + + options.args.order = { + order = 4, + type = "group", + name = L["Category Order"], + args = { + defaultCategories = { + order = 1, + type = "group", + name = L["Default"], + childGroups = "tab", + set = setOrder, + get = getOrder, + validate = function(_, value) + return tonumber(value) or "Please insert a number." + end, + args = {}, + }, + defaultCategoriesOrder = { + order = 2, + type = "group", + name = L["Default"], + inline = true, + set = setCategoryOrder, + get = getCategoryOrder, + validate = function(info, value) + local newOrder = tonumber(value) + return (not newOrder and "Please insert a number.") + or (newOrder <= 0 and "Please insert a number greater than 0") + or true + end, + args = {}, + }, + customCategories = { + order = 3, + type = "group", + name = L["Custom"], + childGroups = "tab", + set = setOrder, + get = getOrder, + validate = function(_, value) + return tonumber(value) or "Please insert a number." + end, + args = {}, + }, + customCategoriesOrder = { + order = 4, + type = "group", + name = L["Custom"], + inline = true, + set = setCategoryOrder, + get = getCategoryOrder, + validate = function(info, value) + local newOrder = tonumber(value) + return (not newOrder and "Please insert a number.") + or (newOrder <= 0 and "Please insert a number greater than 0") + or true + end, + args = {}, + }, + }, } - options.args.categories = { - order = 2, - type = 'group', - name = 'Category Config', - set = setCategoryChildOption, - get = getCategoryChildOption, - args = { - default_categories_toggles = { - order = 1, - type = 'group', - name = L['Categories'], - inline = true, - set = function(info, value) - local key = info[#info] - PermoksAccountManager.db.global.options.defaultCategories[key].enabled = value - - if not PermoksAccountManager.db.global.custom then - if not value then - PermoksAccountManager.numCategories = PermoksAccountManager.numCategories - 1 - else - PermoksAccountManager.numCategories = PermoksAccountManager.numCategories + 1 - end - end - PermoksAccountManager:UpdateMenu() - end, - get = function(info) - local key = info[#info] - return PermoksAccountManager.db.global.options.defaultCategories[key].enabled - end, - hidden = function() - return PermoksAccountManager.db.global.custom - end, - args = { - - } - }, - custom_categories_toggles = { - order = 1, - type = 'group', - name = L['Categories'], - inline = true, - hidden = function() - return not PermoksAccountManager.db.global.custom - end, - set = function(info, value) - local key = info[#info] - PermoksAccountManager.db.global.options.customCategories[key].enabled = value - - if PermoksAccountManager.db.global.custom then - if not value then - PermoksAccountManager.numCategories = PermoksAccountManager.numCategories - 1 - else - PermoksAccountManager.numCategories = PermoksAccountManager.numCategories + 1 - end - end - PermoksAccountManager:UpdateMenu() - end, - get = function(info) - local key = info[#info] - return PermoksAccountManager.db.global.options.customCategories[key].enabled - end, - args = {} - }, - defaultCategories = { - order = 2, - type = 'group', - name = L['Default'], - childGroups = 'tab', - args = { - create = { - order = 100, - type = 'group', - name = L['Add New'], - args = { - create_group = { - order = 1, - type = 'group', - name = L['General'], - inline = true, - args = { - name = { - order = 1, - name = L['Name'], - type = 'input', - validate = function(info, value) - if value:match('[^%w:]') then - return 'You can only use letters, numbers, and colons (for now).' - elseif string.len(value) == 0 then - return "Can't create an empty category." - elseif PermoksAccountManager.db.global.currentCategories[value:lower()].name then - return 'This category already exists.' - end - - return true - end, - set = function(info, value) - categoryData.create = value - end, - get = function(info) - return categoryData.create or '' - end - }, - create = { - order = 2, - name = L['Create'], - type = 'execute', - func = function(info) - if categoryData.create then - local categoryName = categoryData.create:lower() - addCustomCategory(categoryName, categoryData.create, true) - categoryData.create = nil - end - end - } - } - } - } - }, - } - }, - customCategories = { - order = 3, - type = 'group', - name = L['Custom'], - childGroups = 'tab', - args = { - create = { - order = 100, - type = 'group', - name = L['Add New'], - args = { - create_group = { - order = 1, - type = 'group', - name = L['General'], - inline = true, - args = { - name = { - order = 1, - name = L['Name'], - type = 'input', - validate = function(info, value) - if value:match('[^%w:]') then - return 'You can only use letters, numbers, and colons (for now).' - elseif string.len(value) == 0 then - return "Can't create an empty category." - elseif PermoksAccountManager.db.global.options.customCategories[value:lower()].name then - return 'This category already exists.' - end - - return true - end, - set = function(info, value) - categoryData.create = value - end, - get = function(info) - return categoryData.create or '' - end - }, - create = { - order = 2, - name = L['Create'], - type = 'execute', - func = function(info) - if categoryData.create then - local categoryName = categoryData.create:lower() - addCustomCategory(categoryName, categoryData.create) - categoryData.create = nil - end - end - } - } - } - } - }, - general = { - order = 0, - type = 'group', - name = L['General'], - args = {} - } - } - } - } - } - - options.args.order = { - order = 4, - type = 'group', - name = L['Category Order'], - args = { - defaultCategories = { - order = 1, - type = 'group', - name = L['Default'], - childGroups = 'tab', - set = setOrder, - get = getOrder, - validate = function(_, value) - return tonumber(value) or 'Please insert a number.' - end, - args = {} - }, - defaultCategoriesOrder = { - order = 2, - type = 'group', - name = L['Default'], - inline = true, - set = setCategoryOrder, - get = getCategoryOrder, - validate = function(info, value) - local newOrder = tonumber(value) - return (not newOrder and 'Please insert a number.') or (newOrder <= 0 and 'Please insert a number greater than 0') or true - end, - args = {} - }, - customCategories = { - order = 3, - type = 'group', - name = L['Custom'], - childGroups = 'tab', - set = setOrder, - get = getOrder, - validate = function(_, value) - return tonumber(value) or 'Please insert a number.' - end, - args = {} - }, - customCategoriesOrder = { - order = 4, - type = 'group', - name = L['Custom'], - inline = true, - set = setCategoryOrder, - get = getCategoryOrder, - validate = function(info, value) - local newOrder = tonumber(value) - return (not newOrder and 'Please insert a number.') or (newOrder <= 0 and 'Please insert a number greater than 0') or true - end, - args = {} - } - } - } - - options.args.sync = { - order = 5, - type = 'group', - name = L['Account Syncing'], - childGroups = 'tab', - args = { - syncOptions = { - order = 1, - type = 'group', - name = L['Sync Accounts'], - args = { - explanation = { - order = 1, - type = 'description', - name = function() - return GetAccountSyncDescription() - end - }, - name = { - order = 2, - name = L['Name'], - type = 'input', - validate = function(info, value) - if value:match('[%d%s%p%c]') then - return 'Character names can only consist of letters.' - end - - return true - end, - set = function(info, value) - syncData.name = value - end, - get = function(info) - return syncData.name or '' - end - }, - realm = { - order = 3, - name = L['Realm (if different from current)'], - type = 'input', - hidden = function() - local connectedRealms = GetAutoCompleteRealms() - return PermoksAccountManager.isBC or #connectedRealms == 0 - end, - validate = function(info, value) - if value:match('[^%a]') then - return 'Realm names can only consist of letters.' - end - - return true - end, - set = function(info, value) - syncData.realm = value - end, - get = function(info) - return syncData.realm or '' - end - }, - sync = { - order = 4, - name = L['Sync (Beta)'], - type = 'execute', - func = function(info) - if syncData.name then - PermoksAccountManager:RequestAccountSync(syncData.name, syncData.realm) - end - end - }, - forceUpdate = { - order = 5, - name = L['Send Update'], - type = 'execute', - desc = 'To update the character list. Make sure to click this button on a character that existed in the manager at the time of syncing.', - disabled = function() - return PermoksAccountManager:GetNumAccounts() == 1 - end, - func = function(info) - PermoksAccountManager:SendAccountUpdates() - end - } - } - }, - syncedAccounts = { - order = 2, - type = 'group', - name = L['Synced Accounts'], - args = {} - } - } - } - - options.args.add = { - order = 6, - type = 'group', - name = L['Custom Labels'], - childGroups = 'tab', + options.args.sync = { + order = 5, + type = "group", + name = L["Account Syncing"], + childGroups = "tab", + args = { + syncOptions = { + order = 1, + type = "group", + name = L["Sync Accounts"], + args = { + explanation = { + order = 1, + type = "description", + name = function() + return GetAccountSyncDescription() + end, + }, + name = { + order = 2, + name = L["Name"], + type = "input", + validate = function(info, value) + if value:match("[%d%s%p%c]") then + return "Character names can only consist of letters." + end + + return true + end, + set = function(info, value) + syncData.name = value + end, + get = function(info) + return syncData.name or "" + end, + }, + realm = { + order = 3, + name = L["Realm (if different from current)"], + type = "input", + hidden = function() + local connectedRealms = GetAutoCompleteRealms() + return PermoksAccountManager.isBC or #connectedRealms == 0 + end, + validate = function(info, value) + if value:match("[^%a]") then + return "Realm names can only consist of letters." + end + + return true + end, + set = function(info, value) + syncData.realm = value + end, + get = function(info) + return syncData.realm or "" + end, + }, + sync = { + order = 4, + name = L["Sync (Beta)"], + type = "execute", + func = function(info) + if syncData.name then + PermoksAccountManager:RequestAccountSync(syncData.name, syncData.realm) + end + end, + }, + forceUpdate = { + order = 5, + name = L["Send Update"], + type = "execute", + desc = "To update the character list. Make sure to click this button on a character that existed in the manager at the time of syncing.", + disabled = function() + return PermoksAccountManager:GetNumAccounts() == 1 + end, + func = function(info) + PermoksAccountManager:SendAccountUpdates() + end, + }, + }, + }, + syncedAccounts = { + order = 2, + type = "group", + name = L["Synced Accounts"], + args = {}, + }, + }, + } + + options.args.add = { + order = 6, + type = "group", + name = L["Custom Labels"], + childGroups = "tab", hidden = function() - return not PermoksAccountManager.db.global.customLabels - end, - args = { - addTab = { - order = 1, - type = 'group', - name = function() - if labelData.oldId then - return L['Edit'] - else - return L['Create'] - end - end, - inline = true, - args = { - general_options = { - order = 0.5, - name = 'General', - type = 'header', - }, - name = { - order = 2, - name = L['Name'], - type = 'input', - validate = function(info, value) - if value:match('[^%a%s:]') then - return 'You can only use letters (for now).' - elseif string.len(value) == 0 then - return "Can't create an empty label." - end - - return true - end, - set = function(info, value) - labelData.name = value - end, - get = function(info) - return labelData.name or '' - end - }, - id = { - order = 3, - name = L['ID'], - type = 'input', - width = 'half', - validate = function(info, value) - if not tonumber(value) then - return 'IDs only contain digits.' - end - - return true - end, - disabled = function() - return labelData.oldId and true or false - end, - set = function(info, value) - labelData.id = tonumber(value) - end, - get = function() - return labelData.id and tostring(labelData.id) or '' - end - }, - labelType = { - order = 1, - name = L['Type'], - type = 'select', - values = {item = L['Item'], currency = L['Currency'], quest = L['Quest']}, - sorting = {'item', 'currency', 'quest'}, - --width = 'half', - disabled = function() - return labelData.oldId and true or false - end, - set = function(info, value) - labelData.type = value - end, - get = function(info) - return labelData.type or '' - end - }, - quest_options = { - order = 3.5, - name = 'Quest', - type = 'header', - hidden = function() - return labelData.type and labelData.type ~= 'quest' or not labelData.type - end, - }, - reset = { - order = 4, - name = L['Reset'], - type = 'select', - values = {daily = L['Daily'], weekly = L['Weekly'], biweekly = L['Biweekly']}, - sorting = {'daily', 'biweekly', 'weekly'}, - --width = 'half', - hidden = function() - return labelData.type and labelData.type ~= 'quest' or not labelData.type - end, - set = function(info, value) - labelData.reset = value - end, - get = function(info) - return labelData.reset or ' ' - end - }, - inlog = { - order = 5, - name = L['Hidden'], - type = 'toggle', - --width = 'half', - hidden = function() - return labelData.type and labelData.type ~= 'quest' or not labelData.type - end, - set = function(info, value) - labelData.hidden = value - end, - get = function(info) - return labelData.hidden or false - end - }, - sep1 = { - order = 5.5, - name = '', - type = 'header', - }, - create = { - order = 6, - name = function() - if labelData.oldId then - return L['Edit'] - else - return L['Create'] - end - end, - type = 'execute', - func = function(info) - if labelData.name and labelData.id and labelData.type then - PermoksAccountManager:AddCustomLabelButton(labelData) - PermoksAccountManager.UpdateCustomLabelOptions() - end - - labelData = {} - end - }, - delete = { - order = 7, - name = L['Delete'], - type = 'execute', - disabled = function() - if labelData.oldId then - return false - else - return true - end - end, - func = function(info) - if labelData.name and labelData.id and labelData.type then - DeleteCustomLabelButton(labelData) - end - end - } - } - }, - desc = { - order = 1.5, - type = 'description', - name = 'To edit/delete custom labels click on the button for the label below.', - fontSize = 'medium', - }, - item = { - order = 2, - type = 'group', - name = L['Items'], - args = {} - }, - currency = { - order = 3, - type = 'group', - name = L['Currencies'], - args = {} - }, - quest = { - order = 4, - type = 'group', - name = L['Quests'], - args = {} - } - } - } - - -- TODO: Retail differentiation - options.args.experimental = { - order = 7, - type = 'group', - name = L['Experimental'], - set = function(info, value) - PermoksAccountManager.db.global.options[info[#info]] = value - PermoksAccountManager:SortPages() - PermoksAccountManager:UpdateAnchorsAndSize('general', nil, nil, true) - end, - get = function(info) - return PermoksAccountManager.db.global.options[info[#info]] - end, - args = { - testOptions = { - order = 7, - type = 'group', - name = L['Test Options'], - inline = true, - args = { - currencyIcons = { - order = 1, - type = 'toggle', - name = L['Currency Icons'], - retailOnly = false - }, - itemIcons = { - order = 2, - type = 'toggle', - name = L['Item Icons'], - retailOnly = false - }, - showCurrentSpecIcon = { - order = 3, - type = 'toggle', - name = L['Show Current Spec'], - retailOnly = true - }, - useScoreColor = { - order = 4, - type = 'toggle', - name = L['Color Mythic+ Score'], - retailOnly = true - }, - useOutline = { - order = 5, - type = 'toggle', - name = L['Outline'], - set = function(info, value) - PermoksAccountManager.db.global.options[info[#info]] = value - PermoksAccountManager:UpdateAllFonts() - end, - retailOnly = true - }, - questCompletionString = { - order = 6, - type = 'input', - name = L['Quest Completion String'], - retailOnly = false - }, - font = { - order = 7, - type = 'select', - name = 'Font', - values = LSM:HashTable('font'), - set = function(info, value) - PermoksAccountManager.db.global.options[info[#info]] = value - PermoksAccountManager:UpdateAllFonts() - end, - dialogControl = 'LSM30_Font' - }, - fontSize = { - order = 8, - type = 'range', - name = 'Font Size', - min = 9, - max = 16, - step = 1, - set = function(info, value) - PermoksAccountManager.db.global.options[info[#info]] = value - PermoksAccountManager:UpdateAllFonts() - end, - }, - itemIconPosition = { - order = 9, - type = 'select', - name = 'Item Icon Position', - values = {left = 'Left', right = 'Right'} - }, - currencyIconPosition = { - order = 10, - type = 'select', - name = 'Currency Icon Position', - values = {left = 'Left', right = 'Right'} - }, - currentCharacterFirstPosition = { - order = 11, - type = 'toggle', - name = 'Prioritise current char', - desc = 'Always show the current character at the front' - }, - name = { - order = 12, - type = 'input', - name = 'Rename Main Account', - desc = nil, - get = function(info) - return PermoksAccountManager.db.global.accounts.main.name - end, - set = function(info, value) - changeAccountName('main', value) - end - }, - } - } - } - } + return not PermoksAccountManager.db.global.customLabels + end, + args = { + addTab = { + order = 1, + type = "group", + name = function() + if labelData.oldId then + return L["Save"] + else + return L["Create"] + end + end, + inline = true, + args = { + name = { + order = 1, + name = L["Name"], + type = "input", + validate = function(info, value) + if value:match("[^%a%s:]") then + return "You can only use letters (for now)." + elseif string.len(value) == 0 then + return "Can't create an empty label." + end + + return true + end, + set = function(info, value) + labelData.name = value + end, + get = function(info) + return labelData.name or "" + end, + }, + id = { + order = 3, + name = L["ID"], + type = "input", + width = "half", + validate = function(info, value) + if not tonumber(value) then + return "IDs only contain digits." + end + + return true + end, + disabled = function() + return labelData.oldId and true or false + end, + set = function(info, value) + labelData.id = tonumber(value) + end, + get = function() + return labelData.id and tostring(labelData.id) or "" + end, + }, + labelType = { + order = 2, + name = L["Type"], + type = "select", + values = { + item = L["Item"], + currency = L["Currency"], + quest = L["Quest"], + custom = L["Custom"], + }, + sorting = { "item", "currency", "quest", "custom" }, + --width = 'half', + disabled = function() + return labelData.oldId and true or false + end, + set = function(info, value) + labelData.type = value + end, + get = function(info) + return labelData.type or "" + end, + }, + quest_options = { + order = 3.5, + name = "Quest", + type = "header", + hidden = function() + return labelData.type and labelData.type ~= "quest" or not labelData.type + end, + }, + reset = { + order = 4, + name = L["Reset"], + type = "select", + values = { daily = L["Daily"], weekly = L["Weekly"], biweekly = L["Biweekly"] }, + sorting = { "daily", "biweekly", "weekly" }, + --width = 'half', + hidden = function() + return labelData.type and labelData.type ~= "quest" or not labelData.type + end, + set = function(info, value) + labelData.reset = value + end, + get = function(info) + return labelData.reset or " " + end, + }, + inlog = { + order = 5, + name = L["Hidden"], + type = "toggle", + desc = "If you can't have this quest in your visible quest log then toggle this option so it gets tracked correctly.", + --width = 'half', + hidden = function() + return labelData.type and labelData.type ~= "quest" or not labelData.type + end, + set = function(info, value) + labelData.hidden = value + end, + get = function(info) + return labelData.hidden or false + end, + }, + custom_options = { + order = 6, + name = "Custom", + type = "header", + hidden = function() + return labelData.type and labelData.type ~= "custom" or not labelData.type + end, + }, + custom_events = { + order = 6.1, + name = "Events", + type = "input", + width = "full", + hidden = function() + return labelData.type and labelData.type ~= "custom" or not labelData.type + end, + get = function() + return labelData.events + end, + set = function(_, value) + labelData.events = value + end, + }, + custom_update = { + order = 6.2, + name = "Update Function", + type = "input", + multiline = true, + width = "full", + hidden = function() + return labelData.type and labelData.type ~= "custom" or not labelData.type + end, + get = function() + if not labelData.update then + return [[function(data) + +end]] + else + return labelData.update + end + end, + set = function(_, value) + labelData.update = value + end, + }, + custom_label_string = { + order = 6.3, + name = "String Function", + type = "input", + multiline = true, + width = "full", + hidden = function() + return labelData.type and labelData.type ~= "custom" or not labelData.type + end, + get = function() + if not labelData.labelString then + return [[function(data) + +end]] + else + return labelData.labelString + end + end, + set = function(_, value) + labelData.labelString = value + end, + }, + sep1 = { + order = 19, + name = "", + type = "header", + }, + create = { + order = 20, + name = function() + if labelData.oldId then + return L["Edit"] + else + return L["Create"] + end + end, + type = "execute", + func = function(info) + if labelData.name and labelData.id and labelData.type then + PermoksAccountManager:AddCustomLabelButton(labelData) + PermoksAccountManager.UpdateCustomLabelOptions() + end + + labelData = {} + end, + }, + delete = { + order = 21, + name = L["Delete"], + type = "execute", + disabled = function() + if labelData.oldId then + return false + else + return true + end + end, + func = function(info) + if labelData.name and labelData.id and labelData.type then + DeleteCustomLabelButton(labelData) + end + end, + }, + }, + }, + desc = { + order = 1.5, + type = "description", + name = "To edit/delete custom labels click on the button for the label below.", + fontSize = "medium", + }, + item = { + order = 2, + type = "group", + name = L["Items"], + args = {}, + }, + currency = { + order = 3, + type = "group", + name = L["Currencies"], + args = {}, + }, + quest = { + order = 4, + type = "group", + name = L["Quests"], + args = {}, + }, + }, + } + + -- TODO: Retail differentiation + options.args.experimental = { + order = 7, + type = "group", + name = L["Experimental"], + set = function(info, value) + PermoksAccountManager.db.global.options[info[#info]] = value + PermoksAccountManager:SortPages() + PermoksAccountManager:UpdateAnchorsAndSize("general", nil, nil, true) + end, + get = function(info) + return PermoksAccountManager.db.global.options[info[#info]] + end, + args = { + testOptions = { + order = 7, + type = "group", + name = L["Test Options"], + inline = true, + args = { + currencyIcons = { + order = 1, + type = "toggle", + name = L["Currency Icons"], + retailOnly = false, + }, + itemIcons = { + order = 2, + type = "toggle", + name = L["Item Icons"], + retailOnly = false, + }, + showCurrentSpecIcon = { + order = 3, + type = "toggle", + name = L["Show Current Spec"], + retailOnly = true, + }, + useScoreColor = { + order = 4, + type = "toggle", + name = L["Color Mythic+ Score"], + retailOnly = true, + }, + useOutline = { + order = 5, + type = "toggle", + name = L["Outline"], + set = function(info, value) + PermoksAccountManager.db.global.options[info[#info]] = value + PermoksAccountManager:UpdateAllFonts() + end, + retailOnly = true, + }, + questCompletionString = { + order = 6, + type = "input", + name = L["Quest Completion String"], + retailOnly = false, + }, + font = { + order = 7, + type = "select", + name = "Font", + values = LSM:HashTable("font"), + set = function(info, value) + PermoksAccountManager.db.global.options[info[#info]] = value + PermoksAccountManager:UpdateAllFonts() + end, + dialogControl = "LSM30_Font", + }, + fontSize = { + order = 8, + type = "range", + name = "Font Size", + min = 9, + max = 16, + step = 1, + set = function(info, value) + PermoksAccountManager.db.global.options[info[#info]] = value + PermoksAccountManager:UpdateAllFonts() + end, + }, + itemIconPosition = { + order = 9, + type = "select", + name = "Item Icon Position", + values = { left = "Left", right = "Right" }, + }, + currencyIconPosition = { + order = 10, + type = "select", + name = "Currency Icon Position", + values = { left = "Left", right = "Right" }, + }, + currentCharacterFirstPosition = { + order = 11, + type = "toggle", + name = "Prioritise current char", + desc = "Always show the current character at the front", + }, + name = { + order = 12, + type = "input", + name = "Rename Main Account", + desc = nil, + get = function(info) + return PermoksAccountManager.db.global.accounts.main.name + end, + set = function(info, value) + changeAccountName("main", value) + end, + }, + showOnEnter = { + order = 13, + type = "toggle", + name = "Show On Mouseover", + desc = "Show the window while hovering over the minimap button", + }, + }, + }, + }, + } end function PermoksAccountManager:LoadCustomLabelButtons() - for _, customLabels in pairs(self.db.global.options.customLabels) do - for _, labelInfo in pairs(customLabels) do - self:AddCustomLabelButton(labelInfo) - end - end + for _, customLabels in pairs(self.db.global.options.customLabels) do + for _, labelInfo in pairs(customLabels) do + self:AddCustomLabelButton(labelInfo) + end + end end function PermoksAccountManager.UpdateCustomLabelOptions(newDefault) - newDefault = newDefault or PermoksAccountManager:GetCustomLabelTable(true) + newDefault = newDefault or PermoksAccountManager:GetCustomLabelTable(true) - for category, args in pairs(options.args.categories.args.customCategories.args) do - if category ~= 'create' then - args.args = newDefault - end - end + for category, args in pairs(options.args.categories.args.customCategories.args) do + if category ~= "create" then + args.args = newDefault + end + end - options.args.categories.args.defaultCategories.args.general.args = newDefault - AceConfigRegistry:NotifyChange(addonName) + options.args.categories.args.defaultCategories.args.general.args = newDefault + AceConfigRegistry:NotifyChange(addonName) end function PermoksAccountManager.OpenOptions(closeImexport) - if closeImexport then - PermoksAccountManager.CloseImexport() - end + if closeImexport then + PermoksAccountManager.CloseImexport() + end - AceConfigDialog:Open(addonName, PermoksAccountManager.optionsFrame) + AceConfigDialog:Open(addonName, PermoksAccountManager.optionsFrame) end local function copyTable(obj) - if type(obj) ~= 'table' then - return obj - end - local res = {} - for k, v in pairs(obj) do - res[copyTable(k)] = copyTable(v) - end - return res + if type(obj) ~= "table" then + return obj + end + local res = {} + for k, v in pairs(obj) do + res[copyTable(k)] = copyTable(v) + end + return res end do - local labelTable = { - delete = { - order = 0.5, - type = 'execute', - name = L['Delete'], - func = function(info) - deleteCustomCategory(info[#info - 1]) - PermoksAccountManager:UpdateOrCreateCategoryButtons() - end, - hidden = function(info) - if info[#info - 1] == 'general' then - return true - end - end, - confirm = true - } - } - local function UpdateLabelTable() - for key, info in pairs(PermoksAccountManager.labelRows) do - if not info.hideOption then - local group = info.group or 'other' - local groupInfo = PermoksAccountManager.groups[group] - - labelTable[group] = - labelTable[group] or - { - order = groupInfo.order, - type = 'group', - name = groupInfo.label, - inline = true, - args = {} - } - - labelTable[group].args[key] = - labelTable[group].args[key] or - { - type = 'toggle', - name = info.label - } - end - end - end - - function PermoksAccountManager:RemoveIdentifierFromLabelTable(group, labelIdentifier) - if labelTable[group] then - labelTable[group].args[labelIdentifier] = nil - AceConfigRegistry:NotifyChange(addonName) - end - end - - function PermoksAccountManager:GetCustomLabelTable(update) - if update then - UpdateLabelTable() - end - - return labelTable - end - - function PermoksAccountManager:LoadCustomLabelTable() - UpdateLabelTable() - end + local labelTable = { + delete = { + order = 0.5, + type = "execute", + name = L["Delete"], + func = function(info) + deleteCustomCategory(info[#info - 1]) + PermoksAccountManager:UpdateOrCreateCategoryButtons() + end, + hidden = function(info) + if info[#info - 1] == "general" then + return true + end + end, + confirm = true, + }, + } + local function UpdateLabelTable() + for key, info in pairs(PermoksAccountManager.labelRows) do + if not info.hideOption then + local group = info.group or "other" + local groupInfo = PermoksAccountManager.groups[group] + + labelTable[group] = labelTable[group] + or { + order = groupInfo.order, + type = "group", + name = groupInfo.label, + inline = true, + args = {}, + } + + local name = info.label + if group == "currency" then + local globalCurrencyInfo = PermoksAccountManager.db.global.currencyInfo[info.key] + local currencyIcon = globalCurrencyInfo and globalCurrencyInfo.icon + if currencyIcon then + name = string.format( + "\124T%d:18:18\124t%s", + currencyIcon, + type(name) == "function" and name() or name + ) + end + elseif group == "item" and info.key then + name = string.format("\124T%d:18:18\124t %s", C_Item.GetItemIconByID(info.key), type(name) == "function" and name() or name) + end + + labelTable[group].args[key] = labelTable[group].args[key] + or { + type = "toggle", + name = name, + } + end + end + end + + function PermoksAccountManager:RemoveIdentifierFromLabelTable(group, labelIdentifier) + if labelTable[group] then + labelTable[group].args[labelIdentifier] = nil + AceConfigRegistry:NotifyChange(addonName) + end + end + + function PermoksAccountManager:GetCustomLabelTable(update) + if update then + UpdateLabelTable() + end + + return labelTable + end + + function PermoksAccountManager:LoadCustomLabelTable() + UpdateLabelTable() + end end function PermoksAccountManager:LoadOptions() - PermoksAccountManager.numCategories = 0 - if type(PermoksAccountManager.db.global.options.defaultCategories.general.childs) == 'nil' then - PermoksAccountManager.db.global.options.defaultCategories = copyTable(default_categories) - end - - custom_categories = PermoksAccountManager.db.global.options.customCategories - - local numDefaultCategories = createDefaultOptions() - local numCustomCategories = createCustomOptions() - - local db = PermoksAccountManager.db.global - if db.custom then - PermoksAccountManager.numCategories = numCustomCategories - db.currentCategories = db.options.customCategories - else - PermoksAccountManager.numCategories = numDefaultCategories - db.currentCategories = db.options.defaultCategories - end - - PermoksAccountManager.optionsFrame = AceGUI:Create('Frame') - PermoksAccountManager.optionsFrame:EnableResize(false) - PermoksAccountManager.optionsFrame:Hide() - - AddAccounts() - createConfirmPopup() - imexport = imexport or createImportExportFrame(PermoksAccountManager.optionsFrame) - - AceConfigRegistry:RegisterOptionsTable(addonName, options, true) + PermoksAccountManager.numCategories = 0 + if type(PermoksAccountManager.db.global.options.defaultCategories.general.childs) == "nil" then + PermoksAccountManager.db.global.options.defaultCategories = copyTable(default_categories) + end + + custom_categories = PermoksAccountManager.db.global.options.customCategories + + local numDefaultCategories = createDefaultOptions() + local numCustomCategories = createCustomOptions() + + local db = PermoksAccountManager.db.global + if db.custom then + PermoksAccountManager.numCategories = numCustomCategories + db.currentCategories = db.options.customCategories + else + PermoksAccountManager.numCategories = numDefaultCategories + db.currentCategories = db.options.defaultCategories + end + + PermoksAccountManager.optionsFrame = PermoksAccountManager.optionsFrame or AceGUI:Create("Frame") + PermoksAccountManager.optionsFrame:EnableResize(true) + PermoksAccountManager.optionsFrame:Hide() + + AddAccounts() + createConfirmPopup() + imexport = imexport or createImportExportFrame(PermoksAccountManager.optionsFrame) + + AceConfigRegistry:RegisterOptionsTable(addonName, options, true) end function PermoksAccountManager:CloseImexport() - if imexport then - imexport.Close() - end + if imexport then + imexport.Close() + end end function PermoksAccountManager:UpdateDefaultCategories(key) - PermoksAccountManager.db.global.options.defaultCategories[key] = copyTable(default_categories[key]) + PermoksAccountManager.db.global.options.defaultCategories[key] = copyTable(default_categories[key]) end function PermoksAccountManager:AddLabelToDefaultCategory(category, label, customOrder) @@ -1962,50 +2101,110 @@ function PermoksAccountManager:AddLabelToDefaultCategory(category, label, custom end end +function PermoksAccountManager:ReplaceLabelOfDefaultCategory(category, oldLabel, newLabel) + local categoryTbl = self.db.global.options.defaultCategories[category] + + if categoryTbl and categoryTbl.childOrder[oldLabel] then + local index = categoryTbl.childOrder[oldLabel] + + if categoryTbl.childs[index] ~= oldLabel and categoryTbl.childs then + for i, label in pairs(categoryTbl.childs) do + if label == oldLabel then + index = i + break + end + end + end + + categoryTbl.childOrder[oldLabel] = nil + categoryTbl.childOrder[newLabel] = index + categoryTbl.childs[index] = newLabel + end +end + +function PermoksAccountManager:RemoveLabelFromDefaultCategory(category, label) + local categoryTbl = self.db.global.options.defaultCategories[category] + + if categoryTbl and categoryTbl.childOrder[label] then + categoryTbl.childOrder[label] = nil + + for i, l in pairs(categoryTbl.childs) do + if l == label then + categoryTbl.childs[i] = nil + break + end + end + end +end + +function PermoksAccountManager:FixOrderOfDefaultCategories() + for _, categoryTbl in pairs(self.db.global.options.defaultCategories) do + local newChilds = {} + for _, label in pairs(categoryTbl.childs) do + tinsert(newChilds, label) + end + + categoryTbl.childs = newChilds + + wipe(categoryTbl.childOrder) + for i, label in ipairs(categoryTbl.childs) do + categoryTbl.childOrder[label] = i + end + end +end + function PermoksAccountManager:OptionsToString() - local export = {internalVersion = self.db.global.internalVersion, custom = self.db.global.custom, options = self.db.global.options} + local export = { + internalVersion = self.db.global.internalVersion, + custom = self.db.global.custom, + options = self.db.global.options, + } - local serialized = LibSerialize:Serialize(export) - local compressed = LibDeflate:CompressDeflate(serialized) - local encode = LibDeflate:EncodeForPrint(compressed) + local serialized = LibSerialize:Serialize(export) + local compressed = LibDeflate:CompressDeflate(serialized) + local encode = LibDeflate:EncodeForPrint(compressed) - return encode or 'HMM' + return encode or "Error" +end + +function PermoksAccountManager:ParseImportString(optionsString) + local decoded = LibDeflate:DecodeForPrint(optionsString) + if not decoded then + return + end + local decompressed = LibDeflate:DecompressDeflate(decoded) + if not decompressed then + return + end + local success, data = LibSerialize:Deserialize(decompressed) + if not success then + return + end + + local categories = data.options.customCategories + for category, info in pairs(categories) do + for identifier, index in pairs(info.childOrder) do + if not PermoksAccountManager.labelRows[identifier] then + info.childOrder[identifier] = nil + tDeleteItem(info.childs, identifier) + end + end + end + + return data end function PermoksAccountManager:ImportOptions(optionsString) - local decoded = LibDeflate:DecodeForPrint(optionsString) - if not decoded then - return - end - local decompressed = LibDeflate:DecompressDeflate(decoded) - if not decompressed then - return - end - local success, data = LibSerialize:Deserialize(decompressed) - if not success then - return - end - - local categories = data.options.customCategories - for category, info in pairs(categories) do - for identifier, index in pairs(info.childOrder) do - if not PermoksAccountManager.labelRows[identifier] then - info.childOrder[identifier] = nil - tDeleteItem(info.childs, identifier) - end - end - end - - PermoksAccountManager.confirm.accept:SetCallback( - 'OnClick', - function() - PermoksAccountManager.db.global.custom = data.custom - PermoksAccountManager.db.global.options = data.options - PermoksAccountManager.db.global.internalVersion = data.internalVersion - - C_UI.Reload() - end - ) - - PermoksAccountManager.confirm:Show() + local data = self:ParseImportString(optionsString) + if data then + PermoksAccountManager.confirm.accept:SetCallback("OnClick", function() + PermoksAccountManager.db.global.custom = data.custom + PermoksAccountManager.db.global.options = data.options + PermoksAccountManager.db.global.internalVersion = data.internalVersion + + C_UI.Reload() + end) + + PermoksAccountManager.confirm:Show() + end end