30 con.SetColumnCount(0);
31 con.SetForceShow(
true);
42 return ent && ( ent.GetInventory().GetCargo() || (ent.GetSlotsCountCorrect() > 0 && ent.CanDisplayAnyAttachmentSlot()) );
73 return ent.IsTakeable();
92 if( ent && !ent.IsInherited( Magazine ))
142 if( item_in_hands && ent && hands_icon )
159 if( ent != selected_item)
163 bool draggable =
false;
166 draggable = !player.GetInventory().HasInventoryReservation( selected_item, null ) && !player.IsItemsToDelete();
167 draggable = draggable && selected_item.GetInventory().CanRemoveEntity();
171 if( selected_item.GetTargetQuantityMax() < selected_item.GetQuantity() )
172 selected_item.SplitIntoStackMaxClient( null, -1 );
174 player.PhysicalPredictiveDropItem( selected_item );
183 if( ent && ent.GetInventory().CanRemoveEntity())
214 if( c && c.GetMainWidget() )
233 return GetFocusedContainer().GetColumnCount();
239 int mask = item.GetHideIconMask();
240 return mask & EInventoryIconVisibility.HIDE_VICINITY;
248 int visible_items_count = 0;
249 int visible_rows = 0;
252 for (
x = 0;
x < items.Count(); ++
x )
254 item = items.Get(
x );
259 visible_items.Insert( item );
260 visible_items_count++;
265 for (
x = 0;
x < visible_items_count; ++
x )
267 item = visible_items.Get(
x );
272 icon.GetMainWidget().Show(
true );
294 conta.SetSlotIcon(icon);
314 icon.GetMainWidget().Show(
false );
322 slots_last.
GetSlotIcon( 0 ).GetMainWidget().Show(
true );
324 slots_last.GetMainWidget().Update();
342 string name = w.GetName();
363 if(
GetGame().
GetPlayer().GetInventory().HasInventoryReservation( item, null ) )
368 if( !item.GetInventory().CanRemoveEntity() )
373 if ( player.GetInventory().HasEntityInInventory( item ) &&
GetGame().
GetPlayer().GetHumanInventory().CanAddEntityInHands( item ) )
375 player.PredictiveTakeEntityToHands( item );
381 if( dst.
IsValid() && player.GetInventory().LocationCanAddEntity( dst ) )
391 menu.RefreshQuickbar();
398 string quantity_text =
"";
402 float quantity = item_base.GetQuantity();
404 if ( item.IsInherited( Magazine ) )
406 Magazine magazine_item = Magazine.Cast( item );
407 ammo = magazine_item.GetAmmoCount();
409 return quantity_text;
411 else if ( item.IsInherited( ItemBook ) )
415 int max = item.GetQuantityMax();
422 float tmp =
Math.
Round( ( quantity / max ) * 100 );
423 quantity_text = tmp.
ToString() +
"%";
427 quantity_text = quantity.
ToString();
431 return quantity_text;
439 if ( item.IsInherited( Magazine ) )
443 else if ( item.IsInherited( ItemBook ) )
447 int max = item.GetQuantityMax();
448 bool bar = item.ConfigGetBool(
"quantityBar" );
451 if ( max == 1 || bar )
470 if ( item.IsInherited( Magazine ) )
472 Magazine magazine_item = Magazine.Cast( item );
473 quantity = magazine_item.GetAmmoCount();
477 quantity = item_base.GetQuantity();
486 string name = w.GetName();
497 string name = w.GetName();
504 #ifdef DIAG_DEVELOPER
508 ShowActionMenu(
ItemBase.Cast(item) );
516 if( item && showed_items )
518 conta = showed_items.
Get( item.GetID() );
542 string name = w.GetName();
561 if( !item.GetInventory().CanRemoveEntity() )
564 if( player.CanDropEntity( item ) )
566 if( item.GetTargetQuantityMax() < item.GetQuantity() )
567 item.SplitIntoStackMaxClient( null, -1 );
569 player.PhysicalPredictiveDropItem( item );
576 int number_of_containers =
m_Container.m_Body.Count();
577 int number_of_containers_needed = ( items.Count() /
ITEMS_IN_ROW ) + 1;
578 int difference = number_of_containers_needed - number_of_containers;
581 for (g = number_of_containers; g < number_of_containers_needed; g++)
604 for (g = number_of_containers - 1 ; g >= number_of_containers_needed ; g--)
620 for (
int i = 0; i < number_of_containers_needed - 1; i++ )
625 RecomputeOpenedContainers();
class RecipeCacheData int
FindInventoryLocationType
flags for searching locations in inventory
protected Widget m_Parent
bool CanSetActionFromInventory(ItemBase mainItem, ItemBase targetItem)
bool CanPerformActionFromInventory(ItemBase mainItem, ItemBase targetItem)
proto native DayZPlayer GetPlayer()
Super root of all classes in Enforce script.
override void UpdateRadialIcon()
override LayoutHolder Get(int x)
override EntityAI GetFocusedItem()
override bool IsDisplayable()
script counterpart to engine's class Inventory
static bool CanSwapEntitiesEx(notnull EntityAI item1, notnull EntityAI item2)
bool CombineItems(EntityAI entity1, EntityAI entity2)
override void OnRightClick()
proto native bool IsValid()
verify current set inventory location
override bool IsTakeable()
EntityAI GetSelectedItem()
HandsPreview GetHandsPreview()
void SetWidgetDraggable(Widget w, bool draggable)
void SetTemperature(EntityAI item, Widget item_w)
bool EvaluateContainerDragabilityDefault(EntityAI entity)
void SetSelectedItem(EntityAI selected_item, Container selected_container, Widget selected_widget, SlotsIcon selected_icon)
SlotsIcon GetSelectedIcon()
static ItemManager GetInstance()
static int HasItemQuantity(notnull EntityAI item)
SlotsIcon GetSlotIcon(int index)
Widget GetRadialIconPanel()
override void UpdateInterval()
ItemPreviewWidget GetRender()
ImageWidget GetGhostSlot()
void Init(EntityAI obj, bool reservation=false)
static void TakeOrSplitToInventoryLocation(notnull PlayerBase player, notnull InventoryLocation dst)
protected ref AttachmentsGroupContainer m_Container
void ~VicinitySlotsContainer()
override bool IsItemActive()
override bool InspectItem()
int HasItemQuantity(EntityAI item)
void VicinitySlotsContainer(LayoutHolder parent)
override bool TransferItem()
void MouseButtonDown(Widget w, int x, int y, int button)
bool ExcludeFromContainer(EntityAI item)
Decides on the icon visibility.
override void OnDropReceivedFromHeader(Widget w, int x, int y, Widget receiver)
protected int m_ItemsCount
void MouseClick(Widget w, int x, int y, int button)
void DoubleClick(Widget w, int x, int y, int button)
override bool CanCombineAmmo()
override bool EquipItem()
string GetItemQuantityText(EntityAI item)
float GetItemQuantity(InventoryItem item)
override bool IsItemWithQuantityActive()
bool IsItemWithContainerActive()
protected int m_SlotsCount
void ShowItemsInContainers(array< EntityAI > items)
void RecomputeNumberOfContainers(array< EntityAI > items)
override void SetLayoutName()
protected ref array< EntityAI > m_ShowedItems
override bool IsDisplayable()
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native CGame GetGame()
const int QUANTITY_PROGRESS
const int QUANTITY_HIDDEN
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static proto float Round(float f)
Returns mathematical round of value.
static proto float Floor(float f)
Returns floor of value.
proto int Replace(string sample, string replace)
Replace all occurrances of 'sample' in 'str' by 'replace'.
static proto string ToString(void var, bool type=false, bool name=false, bool quotes=true)
Return string representation of variable.