diff --git a/CHANGELOG.md b/CHANGELOG.md index da30080..c9c9c8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 3.0.5 +* Fixed reputation module menu not properly changing reputations. +* Fixed xp visualizer calculating experience rewards for hidden quests. +* Added option to include the XP from account wide quests (pet battles). Disabled by default considering most players probably aren't doing these quests to level up. +* Fixed heirloom and Recruit-a-Friend XP multipliers. + ## 3.0.4 * Added counter that shows amount of Artifact Power gained in current session. * Fixed bug where Experiencer bars would still show when map was maximized. diff --git a/Experiencer.toc b/Experiencer.toc index 5889729..ecd219c 100644 --- a/Experiencer.toc +++ b/Experiencer.toc @@ -2,7 +2,7 @@ ## Title: Experiencer ## Notes: Simple but advanced tracking progress bar addon ## Author: Sonaza -## Version: 3.0.4 +## Version: 3.0.5 ## OptionalDeps: Ace3 ## SavedVariables: ExperiencerDB, ExperiencerDB_module_experience, ExperiencerDB_module_reputation, ExperiencerDB_module_artifact, ExperiencerDB_module_honor, ExperiencerDB_module_conquest diff --git a/modules/experience.lua b/modules/experience.lua index 8c1986e..78f9e40 100644 --- a/modules/experience.lua +++ b/modules/experience.lua @@ -30,6 +30,7 @@ local module = Addon:RegisterModule("experience", { QuestXP = { ShowText = true, AddIncomplete = false, + IncludeAccountWide = false, ShowVisualizer = true, }, }, @@ -335,6 +336,12 @@ function module:GetOptionsMenu() checked = function() return self.db.global.QuestXP.AddIncomplete; end, isNotRadio = true, }, + { + text = "Include XP from account wide quests (pet battles)", + func = function() self.db.global.QuestXP.IncludeAccountWide = not self.db.global.QuestXP.IncludeAccountWide; module:Refresh(); end, + checked = function() return self.db.global.QuestXP.IncludeAccountWide; end, + isNotRadio = true, + }, { text = "Display visualizer bar", func = function() self.db.global.QuestXP.ShowVisualizer = not self.db.global.QuestXP.ShowVisualizer; module:Refresh(); end, @@ -460,23 +467,24 @@ end function module:CalculateXPMultiplier() local multiplier = 1.0; - if(module:HasRecruitingBonus()) then - multiplier = multiplier * 3.0; - end - - for _, slotID in ipairs(HEIRLOOM_SLOTS) do - local link = GetInventoryItemLink("player", slotID); + -- Heirloom xp bonus is now factored in quest log + --for _, slotID in ipairs(HEIRLOOM_SLOTS) do + -- local link = GetInventoryItemLink("player", slotID); - if(link) then - local _, _, itemRarity, _, _, _, _, _, itemEquipLoc = GetItemInfo(link); + -- if(link) then + -- local _, _, itemRarity, _, _, _, _, _, itemEquipLoc = GetItemInfo(link); - if(itemRarity == 7) then - local itemID = tonumber(strmatch(link, "item:(%d*)")) or 0; - local itemMultiplier = HEIRLOOM_ITEMXP[itemID] or HEIRLOOM_ITEMXP[itemEquipLoc]; + -- if(itemRarity == 7) then + -- local itemID = tonumber(strmatch(link, "item:(%d*)")) or 0; + -- local itemMultiplier = HEIRLOOM_ITEMXP[itemID] or HEIRLOOM_ITEMXP[itemEquipLoc]; - multiplier = multiplier + itemMultiplier; - end - end + -- multiplier = multiplier + itemMultiplier; + -- end + -- end + --end + + if (module:HasRecruitingBonus()) then + multiplier = math.max(1.5, multiplier); end local playerLevel = UnitLevel("player"); @@ -486,7 +494,7 @@ function module:CalculateXPMultiplier() if(not buffMultiplier.maxlevel or (buffMultiplier.maxlevel and playerLevel <= buffMultiplier.maxlevel)) then multiplier = multiplier + buffMultiplier.multiplier; end - end + end end return multiplier; @@ -494,39 +502,46 @@ end function module:CalculateQuestLogXP() local completeXP, incompleteXP = 0, 0; - if (GetNumQuestLogEntries() == 0) then return 0, 0, 0; end + local _, numQuests = GetNumQuestLogEntries(); + if (numQuests == 0) then return 0, 0, 0; end - local index = 0; + local index = 1; local lastSelected = GetQuestLogSelection(); - repeat - index = index + 1; - local questTitle, _, _, isHeader, _, isComplete, _, questID = GetQuestLogTitle(index); - - if(not isHeader) then + local title, _, _, isHeader, _, isComplete, _, questID, _, displayQuestID, isOnMap, hasLocalPOI, isTask, isBounty, isStory, isHidden, isScaling = GetQuestLogTitle(index); + if(title and not isHeader and not isHidden) then SelectQuestLogEntry(index); - local requiredMoney = GetQuestLogRequiredMoney(index); - local numObjectives = GetNumQuestLeaderBoards(index); + local validEntry = true; - if(isComplete and isComplete < 0) then - isComplete = false; - elseif(numObjectives == 0 and GetMoney() >= requiredMoney) then - isComplete = true; + local questTagID, tagName = GetQuestTagInfo(questID); + if (questTagID == 102 and not self.db.global.QuestXP.IncludeAccountWide) then + validEntry = false; end - if(isComplete) then - completeXP = completeXP + GetQuestLogRewardXP(); - else - incompleteXP = incompleteXP + GetQuestLogRewardXP(); + if (validEntry) then + local requiredMoney = GetQuestLogRequiredMoney(index); + local numObjectives = GetNumQuestLeaderBoards(index); + + if(isComplete and isComplete < 0) then + isComplete = false; + elseif(numObjectives == 0 and GetMoney() >= requiredMoney) then + isComplete = true; + end + + if(isComplete) then + completeXP = completeXP + GetQuestLogRewardXP(); + else + incompleteXP = incompleteXP + GetQuestLogRewardXP(); + end end end - until(questTitle == nil); + index = index + 1; + until (title == nil); SelectQuestLogEntry(lastSelected); local multiplier = module:CalculateXPMultiplier(); - return completeXP * multiplier, incompleteXP * multiplier, (completeXP + incompleteXP) * multiplier; end diff --git a/modules/reputation.lua b/modules/reputation.lua index 746368b..4d10dce 100644 --- a/modules/reputation.lua +++ b/modules/reputation.lua @@ -401,7 +401,9 @@ function module:GetReputationID(faction_name) numFactions = GetNumFactions(); end - if(name == faction_name) then return index, factionID end + if(name == faction_name) then + return index, factionID; + end index = index + 1; end @@ -409,6 +411,11 @@ function module:GetReputationID(faction_name) return nil end +function module:MenuSetWatchedFactionIndex(factionIndex) + SetWatchedFactionIndex(factionIndex); + CloseMenus(); +end + function module:GetRecentReputationsMenu() local factions = { { @@ -424,8 +431,8 @@ function module:GetRecentReputationsMenu() local name = rep.name; local data = rep.data; - local faction_index = module:GetReputationID(name); - local _, _, standing, _, _, _, _, _, isHeader, isCollapsed, hasRep, isWatched, isChild, factionID = GetFactionInfo(faction_index); + local factionIndex = module:GetReputationID(name); + local _, _, standing, _, _, _, _, _, isHeader, isCollapsed, hasRep, isWatched, isChild, factionID = GetFactionInfo(factionIndex); local friend_level = select(7, GetFriendshipReputation(factionID)); local standing_text = ""; @@ -439,7 +446,9 @@ function module:GetRecentReputationsMenu() tinsert(factions, { text = string.format("%s (%s) +%s rep this session", name, standing_text, BreakUpLargeNumbers(data.amount)), - func = function() SetWatchedFactionIndex(faction_index); CloseMenus(); end, + func = function() + module:MenuSetWatchedFactionIndex(factionIndex); + end, checked = function() return isWatched end, }) end @@ -492,7 +501,8 @@ function module:GetReputationsMenu() local depth = 0; local factionIndex = 1; - while factionIndex <= GetNumFactions() do + local numFactions = GetNumFactions(); + while factionIndex <= numFactions do local name, _, standing, _, _, _, _, _, isHeader, isCollapsed, hasRep, isWatched, isChild, factionID = GetFactionInfo(factionIndex); if(name) then local progressText = ""; @@ -520,6 +530,7 @@ function module:GetReputationsMenu() if(isHeader and isCollapsed) then ExpandFactionHeader(factionIndex); + numFactions = GetNumFactions(); end if(isHeader and isChild and current) then -- Second tier header @@ -536,10 +547,13 @@ function module:GetReputationsMenu() menuList = {}, }) else + local index = factionIndex; tinsert(current, { text = string.format("%s (%s)%s", name, standingText, progressText), hasArrow = true, - func = function() SetWatchedFactionIndex(factionIndex); CloseMenus(); end, + func = function() + module:MenuSetWatchedFactionIndex(index); + end, checked = function() return isWatched; end, menuList = {}, }) @@ -572,9 +586,12 @@ function module:GetReputationsMenu() depth = 1 elseif(not isHeader) then -- First and second tier faction + local index = factionIndex; tinsert(current, { text = string.format("%s (%s)%s", name, standingText, progressText), - func = function() SetWatchedFactionIndex(factionIndex); CloseMenus(); end, + func = function() + module:MenuSetWatchedFactionIndex(factionIndex); + end, checked = function() return isWatched end, }) end