3 static string GetItemQuantityText(
EntityAI item,
bool showMax =
false )
5 string quantity_text =
"";
9 Class.CastTo(item_base, item);
10 float quantity = item_base.GetQuantity();
12 if ( item.IsMagazine() )
14 Magazine magazine_item;
15 Class.CastTo(magazine_item, item);
16 ammo = magazine_item.GetAmmoCount();
18 return ammo.ToString();
20 else if ( item.IsInherited( ItemBook) )
24 int stack_max = item.GetQuantityMax();
36 quantity_text =
string.Format(
"%1/%2", quantity.ToString(), stack_max.ToString() );
39 quantity_text = quantity.ToString();
49 quantity_text =
string.Format(
"%1/%2", quantity.ToString(), stack_max.ToString() );
52 quantity_text = quantity.ToString();
78 Class.CastTo(item_base, item);
81 if (item.IsMagazine())
83 Magazine magazine_item;
84 Class.CastTo(magazine_item, item);
85 quantity = magazine_item.GetAmmoCount();
89 quantity = item_base.GetQuantity();
102 Class.CastTo(item_base, item);
105 if (item.IsMagazine())
107 Magazine magazine_item;
108 Class.CastTo(magazine_item, item);
109 quantity = magazine_item.GetAmmoMax();
113 quantity = item_base.GetQuantityMax();
120 static void GetItemQuantity(
InventoryItem item, out
float q_cur, out
float q_min, out
float q_max )
125 Class.CastTo(item_base, item);
126 if ( item.IsMagazine() )
128 Magazine magazine_item;
129 Class.CastTo(magazine_item, item);
130 q_cur = magazine_item.GetAmmoCount();
132 q_max = magazine_item.GetAmmoMax();
136 q_cur = item_base.GetQuantity();
137 q_min = item_base.GetQuantityMin();
138 q_max = item_base.GetQuantityMax();
143 static int HasItemQuantity( notnull
EntityAI item )
146 if (
Class.CastTo(ib, item) )
148 if ( item.IsMagazine() )
151 if ( !ib.m_CanShowQuantity )
154 int max = item.GetQuantityMax();
157 if ( ib.m_HasQuantityBar )