DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ GetItemQuantityText()

static string QuantityConversions::GetItemQuantityText ( EntityAI item,
bool showMax = false )
inlinestaticprivate

См. определение в файле QuantityConversions.c строка 3

4 {
5 string quantity_text = "";
6 if ( item.IsInherited( InventoryItem) )
7 {
8 ItemBase item_base;
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 //int max = item.ConfigGetInt("varQuantityMax");
27 //string unit = item.ConfigGetString("stackedUnit");
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 //quantity_text = string.Format("%i/%i", quantity, stack_max );
38 else
39 quantity_text = quantity.ToString();
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 //quantity_text = string.Format("%i/%i", quantity, stack_max );
51 else
52 quantity_text = quantity.ToString();
53 // if (unit == "ml")
54 // {
55 // float liters = round(quantity / 1000.0);
56 // if ( quantity < 2000 )
57 // {
58 // liters = ( round( (quantity / 100.0) ) ) / 10;
59 // }
60 // quantity_text = ftoa(liters) + "l";
61 // }
62 // else
63 // {
64 // quantity_text = itoa(quantity) + unit;
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.

Перекрестные ссылки Class::CastTo(), string::Format() и float::ToString().

Используется в InventoryGridController::GetItemQuantityText(), Icon::SetQuantity(), SlotsIcon::SetQuantity() и UIScriptedMenu::UpdateQuickbarItemCard().