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

◆ QuickHeal_GetItemToUse()

Item Terraria.Player.QuickHeal_GetItemToUse ( )
inline

Definition at line 5967 of file Player.cs.

5968 {
5969 int num = statLifeMax2 - statLife;
5970 Item result = null;
5971 int num2 = -statLifeMax2;
5972 int num3 = 58;
5973 if (useVoidBag())
5974 {
5975 num3 = 98;
5976 }
5977 for (int i = 0; i < num3; i++)
5978 {
5979 Item item = ((i >= 58) ? bank4.item[i - 58] : inventory[i]);
5980 if (item.stack <= 0 || item.type <= 0 || !item.potion || item.healLife <= 0 || !CombinedHooks.CanUseItem(this, item))
5981 {
5982 continue;
5983 }
5984 int num4 = GetHealLife(item, quickHeal: true) - num;
5985 if (item.type == 227 && num4 < 0)
5986 {
5987 num4 += 30;
5988 if (num4 > 0)
5989 {
5990 num4 = 0;
5991 }
5992 }
5993 if (num2 < 0)
5994 {
5995 if (num4 > num2)
5996 {
5997 result = item;
5998 num2 = num4;
5999 }
6000 }
6001 else if (num4 < num2 && num4 >= 0)
6002 {
6003 result = item;
6004 num2 = num4;
6005 }
6006 }
6007 return result;
6008 }
Item[] item
The items this chest contains. F:Terraria.Chest.maxItems elements long.
Definition Chest.cs:93
static bool CanUseItem(Player player, Item item)
int statLifeMax2
The maximum health this player can have, adjusted by buffs and equipment.
Definition Player.cs:2092
int statLife
The current health of this player. Capped at F:Terraria.Player.statLifeMax2. If you increase this v...
Definition Player.cs:2102
bool useVoidBag()
Definition Player.cs:21132
int GetHealLife(Item item, bool quickHeal=false)
Definition Player.cs:58587
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.bank4, Terraria.ModLoader.CombinedHooks.CanUseItem(), Terraria.Player.GetHealLife(), Terraria.Item.healLife, Terraria.Player.inventory, Terraria.Chest.item, Terraria.Item.potion, Terraria.Item.stack, Terraria.Player.statLife, Terraria.Player.statLifeMax2, Terraria.Item.type, and Terraria.Player.useVoidBag().

Referenced by Terraria.UI.ItemSlot.DrawRadialQuicks(), Terraria.Player.QuickHeal(), and Terraria.GameContent.ChromaHotkeyPainter.Step_QuickHeal().

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