Skip to content

Commit

Permalink
11.0.7 (58187)
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Dec 19, 2024
1 parent ec9e859 commit 2ba90f4
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ function AccountStoreBaseCardMixin:SetItemID(itemID)

if isRefundable then
self.BuyButton:SetText(PLUNDERSTORE_REFUND_BUTTON_TEXT);
elseif isOwned then
self.BuyButton:SetText(PLUNDERSTORE_ALREADY_OWNED_TOOLTIP);
else
self.BuyButton:SetText(AccountStoreUtil.FormatCurrencyDisplay(itemInfo.price, itemInfo.currencyID));
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function AccountStoreUtil.IsCurrencyAtWarningThreshold(accountStoreCurrencyID)
return false;
end

function AccountStoreUtil.FormatCurrencyDisplayWithWarning(accountStoreCurrencyID, currencyAmount)
function AccountStoreUtil.FormatCurrencyDisplayWithWarning(accountStoreCurrencyID, currencyAmount, hideIcon)
local currencyInfo = C_AccountStore.GetCurrencyInfo(accountStoreCurrencyID);
if not currencyInfo then
return "";
Expand All @@ -57,17 +57,27 @@ function AccountStoreUtil.FormatCurrencyDisplayWithWarning(accountStoreCurrencyI
end

currencyAmount = BreakUpLargeNumbers(currencyAmount or currencyInfo.amount);
local showWarning = false;
if currencyInfo.maxQuantity then
if currencyInfo.amount >= currencyInfo.maxQuantity then
currencyAmount = RED_FONT_COLOR:WrapTextInColorCode(currencyAmount);
return PrependWarning(AppendIcon(currencyAmount));
showWarning = true;
elseif currencyInfo.amount >= (currencyInfo.maxQuantity * AccountStoreWarningThresholdPercentage) then
currencyAmount = NORMAL_FONT_COLOR:WrapTextInColorCode(currencyAmount);
return PrependWarning(AppendIcon(currencyAmount));
showWarning = true;
end
end

local currencyText = currencyAmount;
if not hideIcon then
currencyText = AppendIcon(currencyText);
end

if showWarning then
currencyText = PrependWarning(currencyText);
end

return AppendIcon(currencyAmount);
return currencyText;
end

function AccountStoreUtil.AddCurrencyTotalTooltip(tooltip, accountStoreCurrencyID)
Expand Down Expand Up @@ -102,7 +112,7 @@ function AccountStoreUtil.ShowDisabledItemInfoTooltip(frame, itemInfo)
if itemInfo.status == Enum.AccountStoreItemStatus.Refundable then
tooltip:SetText(PLUNDERSTORE_REFUNDABLE_TOOLTIP);
elseif itemInfo.status == Enum.AccountStoreItemStatus.Owned then
tooltip:SetText(PLUNDERSTORE_ALREADY_OWNED_TOOLTIP);
tooltip:SetText(HIGHLIGHT_FONT_COLOR:WrapTextInColorCode(AccountStoreUtil.FormatCurrencyDisplay(itemInfo.price, itemInfo.currencyID)));
else
tooltip:SetText(PLUNDERSTORE_INSUFFICIENT_FUNDS_TOOLTIP);
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,11 @@ function MatchDetailFrameMixin:Init(type, description, value, iconAtlas)
self:Show();

if type == Enum.MatchDetailType.PlunderAcquired then
C_AccountStore.RequestStoreFrontInfoUpdate(Constants.AccountStoreConsts.PlunderstormStoreFrontID);
local accountStoreCurrencyID = C_AccountStore.GetCurrencyIDForStore(Constants.AccountStoreConsts.PlunderstormStoreFrontID);
if value and accountStoreCurrencyID then
value = AccountStoreUtil.FormatCurrencyDisplayWithWarning(accountStoreCurrencyID, value);
local hideIcon = true;
value = AccountStoreUtil.FormatCurrencyDisplayWithWarning(accountStoreCurrencyID, value, hideIcon);
end

self.Description:SetText(description);
Expand Down
5 changes: 5 additions & 0 deletions Interface/AddOns/Blizzard_UnitFrame/UnitFrame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,11 @@ end
function UnitFrame_UpdateTooltip (self)
GameTooltip_SetDefaultAnchor(GameTooltip, self);
if ( GameTooltip:SetUnit(self.unit, self.hideStatusOnTooltip) ) then
-- Should be moved to line data in a future revision.
GameTooltip_AddBlankLineToTooltip(GameTooltip);
GameTooltip_AddInstructionLine(GameTooltip, UNIT_POPUP_RIGHT_CLICK);
GameTooltip:Show();

self.UpdateTooltip = UnitFrame_UpdateTooltip;
else
self.UpdateTooltip = nil;
Expand Down

0 comments on commit 2ba90f4

Please sign in to comment.