4 {
5 string quantity_text = "";
6 if ( item.IsInherited( InventoryItem) )
7 {
9 Class.CastTo(item_base, item);
10 float quantity = item_base.GetQuantity();
11 int ammo;
12 if ( item.IsMagazine() )
13 {
14 Magazine magazine_item;
15 Class.CastTo(magazine_item, item);
16 ammo = magazine_item.GetAmmoCount();
17
18 return ammo.ToString();
19 }
20 else if ( item.IsInherited( ItemBook) )
21 {
22 return "";
23 }
24 int stack_max = item.GetQuantityMax();
25
26
27
28
29 if (stack_max > 0)
30 {
31 if (stack_max == 1)
32 {
33 if (quantity > 1)
34 {
35 if (showMax)
36 quantity_text =
string.
Format(
"%1/%2", quantity.
ToString(), stack_max.ToString() );
37
38 else
40 }
41 else
42 {
43 quantity_text = "";
44 }
45 }
46 else
47 {
48 if (showMax)
49 quantity_text =
string.
Format(
"%1/%2", quantity.
ToString(), stack_max.ToString() );
50
51 else
53
54
55
56
57
58
59
60
61
62
63
64
65
66 }
67 }
68 }
69 return quantity_text;
70 }
class GP5GasMask extends MaskBase ItemBase
proto string ToString(bool simple=true)
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.