30 con.SetColumnCount(0);
31 con.SetForceShow(
true);
42 return ent && ( ent.GetInventory().GetCargo() || (ent.GetSlotsCountCorrect() > 0 && ent.CanDisplayAnyAttachmentSlot()) );
73 return ent.IsTakeable();
101 if (CanTakeToInventory())
113 #ifdef PLATFORM_CONSOLE
135 if( item_in_hands && ent && hands_icon )
152 if( ent != selected_item)
156 bool draggable =
false;
159 draggable = !player.GetInventory().HasInventoryReservation( selected_item, null ) && !player.IsItemsToDelete();
160 draggable = draggable && selected_item.GetInventory().CanRemoveEntity();
164 if( selected_item.GetTargetQuantityMax() < selected_item.GetQuantity() )
165 selected_item.SplitIntoStackMaxClient( null, -1 );
167 player.PhysicalPredictiveDropItem( selected_item );
176 if( ent && ent.GetInventory().CanRemoveEntity())
207 if( c && c.GetMainWidget() )
226 return GetFocusedContainer().GetColumnCount();
233 return mask & EInventoryIconVisibility.HIDE_VICINITY;
242 int visible_items_count = 0;
243 int visible_rows = 0;
246 for (
x = 0;
x < items.Count(); ++
x )
248 item = items.Get(
x );
253 visible_items.Insert( item );
254 visible_items_count++;
259 for (
x = 0;
x < visible_items_count; ++
x )
261 item = visible_items.Get(
x );
266 icon.GetMainWidget().Show(
true );
269 #ifdef PLATFORM_CONSOLE
270 if (selectedItem == item)
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();
343 name.Replace(
"PanelWidget",
"Render" );
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 ) )
393 menu.RefreshQuickbar();
400 string quantity_text =
"";
404 float quantity = item_base.GetQuantity();
406 if ( item.IsInherited( Magazine ) )
408 Magazine magazine_item = Magazine.Cast( item );
409 ammo = magazine_item.GetAmmoCount();
410 quantity_text = ammo.ToString();
411 return quantity_text;
413 else if ( item.IsInherited( ItemBook ) )
417 int max = item.GetQuantityMax();
424 float tmp =
Math.
Round( ( quantity / max ) * 100 );
425 quantity_text = tmp.
ToString() +
"%";
429 quantity_text = quantity.
ToString();
433 return quantity_text;
441 if ( item.IsInherited( Magazine ) )
445 else if ( item.IsInherited( ItemBook ) )
449 int max = item.GetQuantityMax();
450 bool bar = item.ConfigGetBool(
"quantityBar" );
453 if ( max == 1 || bar )
472 if ( item.IsInherited( Magazine ) )
474 Magazine magazine_item = Magazine.Cast( item );
475 quantity = magazine_item.GetAmmoCount();
479 quantity = item_base.GetQuantity();
488 string name = w.GetName();
489 name.Replace(
"PanelWidget",
"Render" );
499 string name = w.GetName();
500 name.Replace(
"PanelWidget",
"Render" );
505 #ifdef DIAG_DEVELOPER
508 ShowActionMenu(itemAtPos);
517 if ( item && showed_items )
544 string name = w.GetName();
545 name.Replace(
"PanelWidget",
"Render" );
563 if( !item.GetInventory().CanRemoveEntity() )
566 if( player.CanDropEntity( item ) )
568 if( item.GetTargetQuantityMax() < item.GetQuantity() )
569 item.SplitIntoStackMaxClient( null, -1 );
571 player.PhysicalPredictiveDropItem( item );
578 int number_of_containers =
m_Container.m_Body.Count();
579 int number_of_containers_needed = ( items.Count() /
ITEMS_IN_ROW ) + 1;
580 int difference = number_of_containers_needed - number_of_containers;
583 for (g = number_of_containers; g < number_of_containers_needed; g++)
606 for (g = number_of_containers - 1 ; g >= number_of_containers_needed ; g--)
622 for (
int i = 0; i < number_of_containers_needed - 1; i++ )
627 RecomputeOpenedContainers();
643 #ifdef PLATFORM_CONSOLE
644 PrepareOwnedTooltip(focusedItem, -1,
y);
646 PrepareOwnedTooltip(focusedItem);
664 string name = w.GetName();
665 name.Replace(
"PanelWidget",
"Render");
684 PrepareOwnedTooltip(item);
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
FindInventoryLocationType
flags for searching locations in inventory
bool CanPerformActionFromInventory(ItemBase mainItem, ItemBase targetItem)
bool CanSetActionFromInventory(ItemBase mainItem, ItemBase targetItem)
override ScriptCallQueue GetCallQueue(int call_category)
proto native DayZPlayer GetPlayer()
Super root of all classes in Enforce script.
override EntityAI GetFocusedItem()
override void UpdateRadialIcon()
override bool IsDisplayable()
void ClosableContainer(LayoutHolder parent, int sort=-1)
override int GetHideIconMask()
static bool CanSwapEntitiesEx(notnull EntityAI item1, notnull EntityAI item2)
script counterpart to engine's class Inventory
bool CombineItems(EntityAI entity1, EntityAI entity2)
override void OnRightClick()
proto native bool IsValid()
verify current set inventory location
override bool IsTakeable()
void SetSelectedItemEx(EntityAI selected_item, Container selected_container, LayoutHolder selected_icon)
HandsPreview GetHandsPreview()
bool EvaluateContainerDragabilityDefault(EntityAI entity)
SlotsIcon GetSelectedIcon()
EntityAI GetSelectedItem()
void SetWidgetDraggable(Widget w, bool draggable)
static ItemManager GetInstance()
static int HasItemQuantity(notnull EntityAI item)
proto void CallLater(func fn, int delay=0, bool repeat=false, 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)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
SlotsIcon GetSlotIcon(int index)
Widget GetSelectedPanel()
Widget GetMicromanagedPanel()
void Init(EntityAI obj, bool reservation=false)
override void UpdateInterval()
Widget GetRadialIconPanel()
ImageWidget GetGhostSlot()
static void TakeOrSplitToInventoryLocation(notnull PlayerBase player, notnull InventoryLocation dst)
void ToggleContainer(Widget w, EntityAI item)
bool ExcludeFromContainer(EntityAI item)
Decides on the icon visibility.
int HasItemQuantity(EntityAI item)
bool IsItemWithContainerActive()
void PrepareOwnedTooltipAfterItemTransferClick()
void ShowItemsInContainers(array< EntityAI > items)
override void SetLayoutName()
void PrepareOwnedTooltipAfterItemTransfer()
void ~VicinitySlotsContainer()
float GetItemQuantity(InventoryItem item)
override bool IsItemActive()
override bool TransferItem()
string GetItemQuantityText(EntityAI item)
override void OnDropReceivedFromHeader(Widget w, int x, int y, Widget receiver)
override bool CanCombineAmmo()
override bool IsItemWithQuantityActive()
void VicinitySlotsContainer(LayoutHolder parent)
override bool InspectItem()
void DoubleClick(Widget w, int x, int y, int button)
void MouseButtonDown(Widget w, int x, int y, int button)
ref array< EntityAI > m_ShowedItems
override bool IsDisplayable()
void RecomputeNumberOfContainers(array< EntityAI > items)
void MouseClick(Widget w, int x, int y, int button)
ref AttachmentsGroupContainer m_Container
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto string ToString(bool simple=true)
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 Floor(float f)
Returns floor of value.
static proto float Round(float f)
Returns mathematical round of value.