From de3fd65621afac528fb8da66858db4f038f626dd Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 30 Aug 2024 18:22:33 +0000 Subject: [PATCH] 11.0.2 (56382) --- .../SharedTraitsDocumentation.lua | 16 ++++++ ...zzard_AuctionHouseCommoditiesSellFrame.lua | 2 +- .../Blizzard_AuctionHouseSellFrame.lua | 2 +- .../Blizzard_ChallengesUI.lua | 55 +++++++++---------- .../Mainline/ChatFrame.lua | 19 +++++-- .../Blizzard_CommentatorNamePlate.lua | 22 ++++---- .../Blizzard_DelvesDifficultyPicker.lua | 15 ++++- .../Blizzard_GenericTraitFrame.lua | 7 +++ .../Blizzard_NamePlates.lua | 2 +- .../Blizzard_TutorialWatchers.lua | 2 +- .../Blizzard_PlayerSpellsFrame.lua | 4 ++ .../SpellBook/Blizzard_SpellBookFrame.lua | 20 +++++-- ...lizzard_SharedTalentSelectionTemplates.lua | 2 +- .../Blizzard_SharedXMLBase/TableUtil.lua | 30 ++++++++++ 14 files changed, 142 insertions(+), 56 deletions(-) diff --git a/Interface/AddOns/Blizzard_APIDocumentationGenerated/SharedTraitsDocumentation.lua b/Interface/AddOns/Blizzard_APIDocumentationGenerated/SharedTraitsDocumentation.lua index e92f1893d..7e4a02ec5 100644 --- a/Interface/AddOns/Blizzard_APIDocumentationGenerated/SharedTraitsDocumentation.lua +++ b/Interface/AddOns/Blizzard_APIDocumentationGenerated/SharedTraitsDocumentation.lua @@ -6,6 +6,22 @@ local SharedTraits = Functions = { + { + Name = "CanEditConfig", + Type = "Function", + Documentation = { "Returns whether the player can make changes to the specified talent config." }, + + Arguments = + { + { Name = "configID", Type = "number", Nilable = false }, + }, + + Returns = + { + { Name = "canEdit", Type = "bool", Nilable = false }, + { Name = "errorMessage", Type = "cstring", Nilable = false, Documentation = { "If canEdit is false, this will be filled out with text explaining why the player can not make changes." } }, + }, + }, { Name = "CanPurchaseRank", Type = "Function", diff --git a/Interface/AddOns/Blizzard_AuctionHouseUI/Blizzard_AuctionHouseCommoditiesSellFrame.lua b/Interface/AddOns/Blizzard_AuctionHouseUI/Blizzard_AuctionHouseCommoditiesSellFrame.lua index 1b45b9b85..534648688 100644 --- a/Interface/AddOns/Blizzard_AuctionHouseUI/Blizzard_AuctionHouseCommoditiesSellFrame.lua +++ b/Interface/AddOns/Blizzard_AuctionHouseUI/Blizzard_AuctionHouseCommoditiesSellFrame.lua @@ -71,7 +71,7 @@ end function AuctionHouseCommoditiesSellFrameMixin:GetDepositAmount() local item = self:GetItem(); - if not item then + if not item or not item:IsValid() then return 0; end diff --git a/Interface/AddOns/Blizzard_AuctionHouseUI/Blizzard_AuctionHouseSellFrame.lua b/Interface/AddOns/Blizzard_AuctionHouseUI/Blizzard_AuctionHouseSellFrame.lua index 1dbb015b0..1a87cd1f4 100644 --- a/Interface/AddOns/Blizzard_AuctionHouseUI/Blizzard_AuctionHouseSellFrame.lua +++ b/Interface/AddOns/Blizzard_AuctionHouseUI/Blizzard_AuctionHouseSellFrame.lua @@ -461,7 +461,7 @@ end function AuctionHouseSellFrameMixin:CanPostItem() local item = self:GetItem(); - if item == nil then + if item == nil or not item:IsValid() then return false, AUCTION_HOUSE_SELL_FRAME_ERROR_ITEM; end diff --git a/Interface/AddOns/Blizzard_ChallengesUI/Blizzard_ChallengesUI.lua b/Interface/AddOns/Blizzard_ChallengesUI/Blizzard_ChallengesUI.lua index f72f86991..969b6ce41 100644 --- a/Interface/AddOns/Blizzard_ChallengesUI/Blizzard_ChallengesUI.lua +++ b/Interface/AddOns/Blizzard_ChallengesUI/Blizzard_ChallengesUI.lua @@ -506,6 +506,21 @@ function ChallengesDungeonIconMixin:SetUp(mapInfo, isFirst) end end +local function AddAffixScoreToTooltip(affixInfo) + GameTooltip_AddBlankLineToTooltip(GameTooltip); + GameTooltip_AddNormalLine(GameTooltip, LFG_LIST_BEST_RUN); + GameTooltip_AddColoredLine(GameTooltip, MYTHIC_PLUS_POWER_LEVEL:format(affixInfo.level), HIGHLIGHT_FONT_COLOR); + + local displayZeroHours = affixInfo.durationSec >= SECONDS_PER_HOUR; + local durationText = SecondsToClock(affixInfo.durationSec, displayZeroHours); + + if affixInfo.overTime then + local overtimeText = DUNGEON_SCORE_OVERTIME_TIME:format(durationText); + GameTooltip_AddColoredLine(GameTooltip, overtimeText, LIGHTGRAY_FONT_COLOR); + else + GameTooltip_AddColoredLine(GameTooltip, durationText, HIGHLIGHT_FONT_COLOR); + end +end function ChallengesDungeonIconMixin:OnEnter() local name = C_ChallengeMode.GetMapUIInfo(self.mapID); @@ -513,37 +528,21 @@ function ChallengesDungeonIconMixin:OnEnter() GameTooltip:SetText(name, 1, 1, 1); local inTimeInfo, overtimeInfo = C_MythicPlus.GetSeasonBestForMap(self.mapID); - local affixScores, overAllScore = C_MythicPlus.GetSeasonBestAffixScoreInfoForMap(self.mapID); - local isOverTimeRun = false; - - local seasonBestDurationSec, seasonBestLevel, members; + local affixScores, overallScore = C_MythicPlus.GetSeasonBestAffixScoreInfoForMap(self.mapID); - if(overAllScore and (inTimeInfo or overtimeInfo)) then - local color = C_ChallengeMode.GetSpecificDungeonOverallScoreRarityColor(overAllScore); - if(not color) then - color = HIGHLIGHT_FONT_COLOR; - end - GameTooltip_AddNormalLine(GameTooltip, DUNGEON_SCORE_TOTAL_SCORE:format(color:WrapTextInColorCode(overAllScore)), GREEN_FONT_COLOR); + if overallScore and (inTimeInfo or overtimeInfo) then + local color = C_ChallengeMode.GetSpecificDungeonOverallScoreRarityColor(overallScore) or HIGHLIGHT_FONT_COLOR; + local overallText = DUNGEON_SCORE_TOTAL_SCORE:format(color:WrapTextInColorCode(overallScore)); + GameTooltip_AddNormalLine(GameTooltip, overallText, GREEN_FONT_COLOR); end - if(affixScores and #affixScores > 0) then - for _, affixInfo in ipairs(affixScores) do - GameTooltip_AddBlankLineToTooltip(GameTooltip); - GameTooltip_AddNormalLine(GameTooltip, DUNGEON_SCORE_BEST_AFFIX:format(affixInfo.name)); - GameTooltip_AddColoredLine(GameTooltip, MYTHIC_PLUS_POWER_LEVEL:format(affixInfo.level), HIGHLIGHT_FONT_COLOR); - if(affixInfo.overTime) then - if(affixInfo.durationSec >= SECONDS_PER_HOUR) then - GameTooltip_AddColoredLine(GameTooltip, DUNGEON_SCORE_OVERTIME_TIME:format(SecondsToClock(affixInfo.durationSec, true)), LIGHTGRAY_FONT_COLOR); - else - GameTooltip_AddColoredLine(GameTooltip, DUNGEON_SCORE_OVERTIME_TIME:format(SecondsToClock(affixInfo.durationSec, false)), LIGHTGRAY_FONT_COLOR); - end - else - if(affixInfo.durationSec >= SECONDS_PER_HOUR) then - GameTooltip_AddColoredLine(GameTooltip, SecondsToClock(affixInfo.durationSec, true), HIGHLIGHT_FONT_COLOR); - else - GameTooltip_AddColoredLine(GameTooltip, SecondsToClock(affixInfo.durationSec, false), HIGHLIGHT_FONT_COLOR); - end - end + if affixScores then + local fastestAffixScore = TableUtil.FindMin(affixScores, function(affixScore) + return affixScore.durationSec; + end); + + if fastestAffixScore then + AddAffixScoreToTooltip(fastestAffixScore); end end diff --git a/Interface/AddOns/Blizzard_ChatFrameBase/Mainline/ChatFrame.lua b/Interface/AddOns/Blizzard_ChatFrameBase/Mainline/ChatFrame.lua index 2f30ccf2a..65b32a919 100644 --- a/Interface/AddOns/Blizzard_ChatFrameBase/Mainline/ChatFrame.lua +++ b/Interface/AddOns/Blizzard_ChatFrameBase/Mainline/ChatFrame.lua @@ -4942,6 +4942,13 @@ function ChatEdit_SetLastToldTarget(name, chatType) ChatEdit_LastToldType = chatType; end +local chatTypesThatRequireTellTarget = +{ + BN_WHISPER = true, + WHISPER = true, + SMART_WHISPER = true, +}; + function ChatEdit_UpdateHeader(editBox) if IsMacroEditBox(editBox) then return; @@ -4952,6 +4959,11 @@ function ChatEdit_UpdateHeader(editBox) return; end + local tellTarget = editBox:GetAttribute("tellTarget"); + if not tellTarget and chatTypesThatRequireTellTarget[type] then + return; + end + local info; if ( type == "VOICE_TEXT" and VoiceTranscription_GetChatTypeAndInfo ) then -- This can occur after loading ChatFrame.lua and before loading VoiceChatTranscriptionFrame.lua due to loading screen event signals, so nil check is required before calling the function. @@ -4970,7 +4982,7 @@ function ChatEdit_UpdateHeader(editBox) --BN_WHISPER FIXME if ( type == "SMART_WHISPER" ) then --If we have a bnetIDAccount or this name, it's a BN whisper. - if ( BNet_GetBNetIDAccount(editBox:GetAttribute("tellTarget")) ) then + if ( BNet_GetBNetIDAccount(tellTarget) ) then editBox:SetAttribute("chatType", "BN_WHISPER"); else editBox:SetAttribute("chatType", "WHISPER"); @@ -4978,10 +4990,9 @@ function ChatEdit_UpdateHeader(editBox) ChatEdit_UpdateHeader(editBox); return; elseif ( type == "WHISPER" ) then - header:SetFormattedText(CHAT_WHISPER_SEND, editBox:GetAttribute("tellTarget")); + header:SetFormattedText(CHAT_WHISPER_SEND, tellTarget); elseif ( type == "BN_WHISPER" ) then - local name = editBox:GetAttribute("tellTarget"); - header:SetFormattedText(CHAT_BN_WHISPER_SEND, name); + header:SetFormattedText(CHAT_BN_WHISPER_SEND, tellTarget); elseif ( type == "EMOTE" ) then header:SetFormattedText(CHAT_EMOTE_SEND, UnitName("player")); elseif ( type == "CHANNEL" ) then diff --git a/Interface/AddOns/Blizzard_Commentator/Blizzard_CommentatorNamePlate.lua b/Interface/AddOns/Blizzard_Commentator/Blizzard_CommentatorNamePlate.lua index 26bbca734..5fef225d1 100644 --- a/Interface/AddOns/Blizzard_Commentator/Blizzard_CommentatorNamePlate.lua +++ b/Interface/AddOns/Blizzard_Commentator/Blizzard_CommentatorNamePlate.lua @@ -108,24 +108,24 @@ function CommentatorNamePlateMixin:ApplyLossOfControlAtIndex(index) end function CommentatorNamePlateMixin:SetPointsByPixelUtil() - self.healthBar:ClearAllPoints(); - PixelUtil.SetSize(self.healthBar, 190, barHeight); - PixelUtil.SetPoint(self.healthBar, "LEFT", self, "LEFT", 0, -10); + self.HealthBarsContainer:ClearAllPoints(); + PixelUtil.SetSize(self.HealthBarsContainer, 190, barHeight); + PixelUtil.SetPoint(self.HealthBarsContainer, "LEFT", self, "LEFT", 0, -10); - self.healthBar:SetFrameLevel(self:GetFrameLevel() - 1); + self.HealthBarsContainer:SetFrameLevel(self:GetFrameLevel() - 1); self.overAbsorbGlow:ClearAllPoints(); - PixelUtil.SetPoint(self.overAbsorbGlow, "BOTTOMLEFT", self.healthBar, "BOTTOMRIGHT", -8, -1); - PixelUtil.SetPoint(self.overAbsorbGlow, "TOPLEFT", self.healthBar, "TOPRIGHT", -8, 1); + PixelUtil.SetPoint(self.overAbsorbGlow, "BOTTOMLEFT", self.HealthBarsContainer, "BOTTOMRIGHT", -8, -1); + PixelUtil.SetPoint(self.overAbsorbGlow, "TOPLEFT", self.HealthBarsContainer, "TOPRIGHT", -8, 1); PixelUtil.SetHeight(self.overAbsorbGlow, 8); self.overHealAbsorbGlow:ClearAllPoints(); - --PixelUtil.SetPoint(self.overHealAbsorbGlow, "BOTTOMRIGHT", self.healthBar, "BOTTOMLEFT", 2, -1); - --PixelUtil.SetPoint(self.overHealAbsorbGlow, "TOPRIGHT", self.healthBar, "TOPLEFT", 2, 1); + --PixelUtil.SetPoint(self.overHealAbsorbGlow, "BOTTOMRIGHT", self.HealthBarsContainer, "BOTTOMLEFT", 2, -1); + --PixelUtil.SetPoint(self.overHealAbsorbGlow, "TOPRIGHT", self.HealthBarsContainer, "TOPLEFT", 2, 1); --PixelUtil.SetWidth(self.overHealAbsorbGlow, 8); PixelUtil.SetWidth(self.castBar, 170, barHeight); - PixelUtil.SetPoint(self.castBar, "TOP", self.healthBar, "BOTTOM", 0, -6); + PixelUtil.SetPoint(self.castBar, "TOP", self.HealthBarsContainer, "BOTTOM", 0, -6); self.castBar.Text:ClearAllPoints(); local iconSize = barHeight + 2; @@ -139,7 +139,7 @@ function CommentatorNamePlateMixin:SetPointsByPixelUtil() self.castBar.border:UpdateSizes(); self.ClassIcon:ClearAllPoints(); - PixelUtil.SetPoint(self.ClassIcon, "RIGHT", self.healthBar, "LEFT", 0, 0); + PixelUtil.SetPoint(self.ClassIcon, "RIGHT", self.HealthBarsContainer, "LEFT", 0, 0); self.CCIcon:ClearAllPoints(); PixelUtil.SetPoint(self.CCIcon, "CENTER", self.ClassIcon, "CENTER", 0, 0); @@ -187,7 +187,7 @@ end function CommentatorNamePlateMixin:SetBorderColors() local color = C_Commentator.GetTeamColorByUnit(self.unit); - self.healthBar.border:SetVertexColor(color.r, color.g, color.b, color.a); + self.HealthBarsContainer.border:SetVertexColor(color.r, color.g, color.b, color.a); self.castBar.border:SetVertexColor(color.r, color.g, color.b, color.a); end diff --git a/Interface/AddOns/Blizzard_DelvesDifficultyPicker/Blizzard_DelvesDifficultyPicker.lua b/Interface/AddOns/Blizzard_DelvesDifficultyPicker/Blizzard_DelvesDifficultyPicker.lua index 1fe4d1517..54b6280b4 100644 --- a/Interface/AddOns/Blizzard_DelvesDifficultyPicker/Blizzard_DelvesDifficultyPicker.lua +++ b/Interface/AddOns/Blizzard_DelvesDifficultyPicker/Blizzard_DelvesDifficultyPicker.lua @@ -113,9 +113,18 @@ function DelvesDifficultyPickerFrameMixin:CheckForActiveDelveAndUpdate() if C_DelvesUI.HasActiveDelve() then local activeDelveGossip = C_GossipInfo.GetActiveDelveGossip(); - self:SetSelectedLevel(activeDelveGossip.orderIndex); - self:SetSelectedOption(activeDelveGossip); - self:UpdateWidgets(activeDelveGossip.gossipOptionID); + -- Prefer active delve gossip (from walk in party) + if activeDelveGossip and activeDelveGossip.orderIndex and activeDelveGossip.gossipOptionID then + self:SetSelectedLevel(activeDelveGossip.orderIndex); + self:SetSelectedOption(activeDelveGossip); + self:UpdateWidgets(activeDelveGossip.gossipOptionID); + elseif self.selectedOption and self.selectedOption.orderIndex and self.selectedOption.gossipOptionID then + -- If active delve gossip is empty, player probably entered and then left. Fall back on the last selected tier/gossip, + -- which should match the active delve gossip + self:SetSelectedLevel(self.selectedOption.orderIndex); + self:SetSelectedOption(self.selectedOption); + self:UpdateWidgets(self.selectedOption.gossipOptionID); + end self.DelveRewardsContainerFrame:SetRewards(); self.Dropdown:Update(); self.Dropdown:SetEnabled(false); diff --git a/Interface/AddOns/Blizzard_GenericTraitUI/Blizzard_GenericTraitFrame.lua b/Interface/AddOns/Blizzard_GenericTraitUI/Blizzard_GenericTraitFrame.lua index 59b4245eb..1485949c9 100644 --- a/Interface/AddOns/Blizzard_GenericTraitUI/Blizzard_GenericTraitFrame.lua +++ b/Interface/AddOns/Blizzard_GenericTraitUI/Blizzard_GenericTraitFrame.lua @@ -342,6 +342,13 @@ function GenericTraitFrameMixin:GetFrameLevelForButton(nodeInfo) return TotalFrameLevelSpread - scaledYOffset; end +function GenericTraitFrameMixin:IsLocked() + -- Overrides TalentFrameBaseMixin. + + local canEditTalents, errorMessage = C_Traits.CanEditConfig(self:GetConfigID()); + return not canEditTalents, errorMessage; +end + function GenericTraitFrameMixin:PurchaseRank(nodeID) if self:ShouldShowConfirmation() then local referenceKey = self; diff --git a/Interface/AddOns/Blizzard_NamePlates/Blizzard_NamePlates.lua b/Interface/AddOns/Blizzard_NamePlates/Blizzard_NamePlates.lua index fbc44cc68..8e22b906c 100644 --- a/Interface/AddOns/Blizzard_NamePlates/Blizzard_NamePlates.lua +++ b/Interface/AddOns/Blizzard_NamePlates/Blizzard_NamePlates.lua @@ -595,7 +595,7 @@ end function NamePlateBaseMixin:GetPreferredInsets() local frame = self.UnitFrame; - local health = frame.HealthBarsContainer; + local health = frame.HealthBarsContainer.healthBar; local left = health:GetLeft() - frame:GetLeft(); local right = frame:GetRight() - health:GetRight(); diff --git a/Interface/AddOns/Blizzard_NewPlayerExperience/Blizzard_TutorialWatchers.lua b/Interface/AddOns/Blizzard_NewPlayerExperience/Blizzard_TutorialWatchers.lua index 00aa3da8b..3ffb43935 100644 --- a/Interface/AddOns/Blizzard_NewPlayerExperience/Blizzard_TutorialWatchers.lua +++ b/Interface/AddOns/Blizzard_NewPlayerExperience/Blizzard_TutorialWatchers.lua @@ -566,7 +566,7 @@ function Class_HunterStableWatcher:PET_STABLE_SHOW() self:Complete(); return; end - self:ShowPointerTutorial(NPEV2_HUNTER_STABLE_PET, "LEFT", PetStableStabledPet5, 10, 0, nil, "LEFT"); + self:ShowPointerTutorial(NPEV2_HUNTER_STABLE_PET, "LEFT", StableFrame.ActivePetList.PetButton5, 10, 0, nil, "LEFT"); end function Class_HunterStableWatcher:PET_STABLE_CLOSED() diff --git a/Interface/AddOns/Blizzard_PlayerSpells/Blizzard_PlayerSpellsFrame.lua b/Interface/AddOns/Blizzard_PlayerSpells/Blizzard_PlayerSpellsFrame.lua index 3f30291c8..4fbf079cb 100644 --- a/Interface/AddOns/Blizzard_PlayerSpells/Blizzard_PlayerSpellsFrame.lua +++ b/Interface/AddOns/Blizzard_PlayerSpells/Blizzard_PlayerSpellsFrame.lua @@ -3,6 +3,7 @@ PlayerSpellsFrameMixin = {}; local PLAYER_SPELLS_HELP_SYSTEM = "PlayerSpellsHelpSystem" local PlayerSpellsFrameEvents = { + "PLAYER_LEAVING_WORLD", }; local PlayerSpellsFrameUnitEvents = { @@ -78,6 +79,9 @@ function PlayerSpellsFrameMixin:OnEvent(event) if event == "PLAYER_SPECIALIZATION_CHANGED" then self:UpdateTabs(); self:UpdatePortrait(); + elseif event == "PLAYER_LEAVING_WORLD" then + -- There's a lot of player spell info thrashing while exiting/re-entering world, avoid displaying during it + self:Hide(); end end diff --git a/Interface/AddOns/Blizzard_PlayerSpells/SpellBook/Blizzard_SpellBookFrame.lua b/Interface/AddOns/Blizzard_PlayerSpells/SpellBook/Blizzard_SpellBookFrame.lua index cf2df4c9e..1e46d5695 100644 --- a/Interface/AddOns/Blizzard_PlayerSpells/SpellBook/Blizzard_SpellBookFrame.lua +++ b/Interface/AddOns/Blizzard_PlayerSpells/SpellBook/Blizzard_SpellBookFrame.lua @@ -7,23 +7,29 @@ local Templates = { ["HEADER"] = { template = "SpellBookHeaderTemplate", initFunc = SpellBookHeaderMixin.Init }, ["SPELL"] = { template = "SpellBookItemTemplate", initFunc = SpellBookItemMixin.Init, resetFunc = SpellBookItemMixin.Reset }, -} +}; +-- Events that should always be listened to local SpellBookLifetimeEvents = { + "PLAYER_ENTERING_WORLD", + "PLAYER_LEAVING_WORLD", +}; +-- Events that should only be listened to while in the world (avoided while entering/exiting it) +local SpellBookInWorldEvents = { "LEARNED_SPELL_IN_SKILL_LINE", "USE_GLYPH", "ACTIVATE_GLYPH", "CANCEL_GLYPH_CAST", }; - +-- Events that should only be listened to while already visible local SpellBookWhileVisibleEvents = { "SPELLS_CHANGED", "DISPLAY_SIZE_CHANGED", "UI_SCALE_CHANGED", -} +}; local SpellBookWhileVisibleUnitEvents = { "PLAYER_SPECIALIZATION_CHANGED", -} +}; SpellBookFrameMixin = CreateFromMixins(SpellBookFrameTutorialsMixin, SpellBookSearchMixin); @@ -111,7 +117,11 @@ function SpellBookFrameMixin:OnHide() end function SpellBookFrameMixin:OnEvent(event, ...) - if event == "SPELLS_CHANGED" then + if event =="PLAYER_ENTERING_WORLD" then + FrameUtil.RegisterFrameForEvents(self, SpellBookInWorldEvents); + elseif event =="PLAYER_LEAVING_WORLD" then + FrameUtil.UnregisterFrameForEvents(self, SpellBookInWorldEvents); + elseif event == "SPELLS_CHANGED" then self:UpdateAllSpellData(); elseif event == "PLAYER_SPECIALIZATION_CHANGED" then local resetCurrentPage = true; diff --git a/Interface/AddOns/Blizzard_SharedTalentUI/Blizzard_SharedTalentSelectionTemplates.lua b/Interface/AddOns/Blizzard_SharedTalentUI/Blizzard_SharedTalentSelectionTemplates.lua index 410f95a87..ab56070da 100644 --- a/Interface/AddOns/Blizzard_SharedTalentUI/Blizzard_SharedTalentSelectionTemplates.lua +++ b/Interface/AddOns/Blizzard_SharedTalentUI/Blizzard_SharedTalentSelectionTemplates.lua @@ -217,7 +217,7 @@ function TalentSelectionChoiceMixin:OnClick(button) selectionChoiceFrame:SetSelectedEntryID(self:GetEntryID()); end - else + elseif not self:GetTalentFrame():IsLocked() then local baseButton = self:GetBaseButton(); if baseButton and self:IsGhosted() then baseButton:ClearCascadeRepurchaseHistory(); diff --git a/Interface/AddOns/Blizzard_SharedXMLBase/TableUtil.lua b/Interface/AddOns/Blizzard_SharedXMLBase/TableUtil.lua index b820a6a04..aefddf007 100644 --- a/Interface/AddOns/Blizzard_SharedXMLBase/TableUtil.lua +++ b/Interface/AddOns/Blizzard_SharedXMLBase/TableUtil.lua @@ -289,6 +289,36 @@ function TableUtil.Transform(tbl, op) return result; end +-- Returns the value in a table deemed smallest by evaluating each value returned by the op function parameter. +-- The return of the op function must return a number. +function TableUtil.FindMin(tbl, op) + local result = nil; + local min = math.huge; + for k, v in pairs(tbl) do + local value = op(v); + if value < min then + min = value; + result = v; + end + end + return result; +end + +-- Returns the value in a table deemed largest by evaluating each value returned by the op function parameter. +-- The return of the op function must return a number. +function TableUtil.FindMax(tbl, op) + local result = nil; + local max = -math.huge; + for k, v in pairs(tbl) do + local value = op(v); + if value > max then + max = value; + result = v; + end + end + return result; +end + function ContainsIf(tbl, pred) for k, v in pairs(tbl) do if (pred(v)) then