TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ CanAfford()

bool Terraria.Player.CanAfford ( long price,
int customCurrency = -1 )
inline

Definition at line 34136 of file Player.cs.

34137 {
34138 if (customCurrency != -1)
34139 {
34141 }
34142 bool overFlowing;
34143 long num = Utils.CoinsCount(out overFlowing, inventory, 58, 57, 56, 55, 54);
34144 long num2 = Utils.CoinsCount(out overFlowing, bank.item);
34145 long num3 = Utils.CoinsCount(out overFlowing, bank2.item);
34146 long num4 = Utils.CoinsCount(out overFlowing, bank3.item);
34147 long num5 = Utils.CoinsCount(out overFlowing, bank4.item);
34148 if (Utils.CoinsCombineStacks(out overFlowing, num, num2, num3, num4, num5) < price)
34149 {
34150 return false;
34151 }
34152 return true;
34153 }
Item[] item
The items this chest contains. F:Terraria.Chest.maxItems elements long.
Definition Chest.cs:93
static bool CanAfford(Player player, long price, int currencyIndex=-1)
Item[] inventory
The player's normal inventory. Indexes 0-9 hold the hotbar items, 10-49 the rest of the main inventor...
Definition Player.cs:1767

References Terraria.Player.bank, Terraria.Player.bank2, Terraria.Player.bank3, Terraria.Player.bank4, Terraria.GameContent.UI.CustomCurrencyManager.CanAfford(), Terraria.Utils.CoinsCombineStacks(), Terraria.Utils.CoinsCount(), Terraria.Player.inventory, and Terraria.Chest.item.

Referenced by Terraria.Player.BuyItem().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: