예제 #1
0
        static private void TryDisplayStashAmount(ItemDisplay itemDisplay)
        {
            #region quit
            if (!_displayStashAmount || PlayerStash == null ||
                !itemDisplay.m_lblQuantity.TryAssign(out var quantity) ||
                !itemDisplay.RefItem.TryAssign(out var item) ||
                item.OwnerCharacter == null &&
                item.ParentContainer.IsNot <MerchantPouch>() &&
                itemDisplay.IsNot <RecipeResultDisplay>())
            {
                return;
            }
            #endregion

            int stashAmount = itemDisplay is CurrencyDisplay ? PlayerStash.ContainedSilver : PlayerStash.ItemStackCount(item.ItemID);
            if (stashAmount <= 0)
            {
                return;
            }

            if (itemDisplay.IsNot <RecipeResultDisplay>())
            {
                quantity.text = itemDisplay.m_lastQuantity.ToString();
            }
            else if (itemDisplay.m_dBarUses.TryAssign(out var dotBar) && dotBar.GOActive())
            {
                quantity.text = "1";
            }

            int fontSize = (quantity.fontSize * 0.75f).Round();
            quantity.alignment   = TextAnchor.UpperRight;
            quantity.lineSpacing = 0.75f;
            quantity.text       += $"\n<color=#00FF00FF><size={fontSize}><b>+{stashAmount}</b></size></color>";
        }