25 RecomputeOpenedContainers();
50 bool show_radial_icon;
52 Widget rip = m_SlotIcon.GetRadialIconPanel();
53 Widget icon_open = m_SlotIcon.GetRadialIcon();
54 Widget icon_closed = m_SlotIcon.GetRadialIconClosed();
56 icon_open.Show( show_radial_icon );
57 icon_closed.Show( !show_radial_icon );
69 return GetFocusedContainer().IsInherited( ContainerWithCargo );
74 return GetFocusedContainer().IsInherited( ContainerWithCargoAndAttachments );
85 return ent && ( ent.GetInventory().GetCargo() || ent.GetSlotsCountCorrect() > 0 );
107 string name = w.GetName();
123 if( !item.GetInventory().CanRemoveEntity() )
126 if (
m_ZombieEntity.GetInventory().CanAddEntityInCargo( item, item.GetInventory().GetFlipCargo() ))
128 else if(
m_ZombieEntity.GetInventory().CanAddEntityToInventory( item ) )
137 string name = receiver.GetName();
143 receiver_item = receiver_iw.
GetItem();
165 if(!item.GetInventory().CanRemoveEntity())
172 string name = receiver.GetName();
178 receiver_item = receiver_iw.
GetItem();
200 if(!item.GetInventory().CanRemoveEntity())
207 if(receiver_item.GetInventory().CanAddAttachment(item))
209 player.PredictiveTakeEntityToTargetAttachment(receiver_item, item);
212 else if(receiver_item.GetInventory().CanAddEntityInCargo(item, item.GetInventory().GetFlipCargo()) && !receiver_item.GetInventory().HasEntityInCargo(item))
223 player.PredictiveTakeEntityToTargetAttachment(
m_ZombieEntity, item);
225 else if(
m_ZombieEntity.GetInventory().CanAddEntityToInventory(item))
257 if( item.GetSlotsCountCorrect() > 0 )
259 ContainerWithCargoAndAttachments iwca =
new ContainerWithCargoAndAttachments(
this,
false );
260 iwca.SetEntity( item );
268 else if( item.GetInventory().GetCargo() )
270 ContainerWithCargo iwc =
new ContainerWithCargo(
this,
false );
271 iwc.SetEntity( item );
272 iwc.UpdateInterval();
282 string config =
"CfgVehicles " + item.GetType() +
" GUIInventoryAttachmentsProps";
285 bool show_radial_icon = ( item.GetInventory().GetCargo() || item.GetSlotsCountCorrect() > 0 ) && !
GetGame().
ConfigIsExisting( config );
289 rip.Show( show_radial_icon );
291 icon_closed.Show( !conta.
IsOpened() );
293 RecomputeOpenedContainers();
308 RecomputeOpenedContainers();
309 GetMainWidget().Update();
317 in.UpdateConsoleToolbar();
351 w.GetUserData(slots_icon);
368 RecomputeOpenedContainers();
380 bool has_cargo =
m_ZombieEntity.GetInventory().GetCargo() != null;
382 string config_path_ghosts_slots =
"CfgVehicles ZombieBase InventoryEquipment playerSlots";
386 for (
int i = 0; i < player_ghosts_slots.Count(); i++ )
388 string slot_name = player_ghosts_slots.Get ( i );
389 string path =
"CfgSlots" +
" " + slot_name;
403 if( row < ( (player_ghosts_slots.Count() + 1 )/
ITEMS_IN_ROW ) )
411 if ( row < ( player_ghosts_slots.Count() /
ITEMS_IN_ROW ) )
421 icon.GetMainWidget().Show(
true );
457 if( row < ( player_ghosts_slots.Count() + 1 /
ITEMS_IN_ROW ) )
464 icon.GetMainWidget().Show(
true );
472 m_CargoGrid =
new ContainerWithCargo(
this,
false );
479 RecomputeOpenedContainers();
485 s_cont.SetColumnCount( row_count );
494 return m_Container.
Get( row ).GetMainWidget().FindAnyWidget(
"Render" + column );
508 string name = w.GetName();
526 if( player.GetInventory().HasInventoryReservation( item, null ) || player.IsItemsToDelete() )
531 if( !item.GetInventory().CanRemoveEntity() )
534 if ( player.GetInventory().HasEntityInInventory( item ) &&
GetGame().
GetPlayer().GetHumanInventory().CanAddEntityInHands( item ) )
536 player.PredictiveTakeEntityToHands( item );
543 if( item.GetTargetQuantityMax(il.
GetSlot()) < item.GetQuantity() )
544 item.SplitIntoStackMaxToInventoryLocationClient( il );
548 else if(
GetGame().
GetPlayer().GetHumanInventory().CanAddEntityInHands( item ) )
550 if( item.GetTargetQuantityMax() < item.GetQuantity() )
551 item.SplitIntoStackMaxHandsClient( player );
553 player.PredictiveTakeEntityToHands( item );
561 menu.RefreshQuickbar();
568 super.CollapseButtonOnMouseButtonDown(w);
573 if( GetFocusedContainer().IsInherited( ContainerWithCargo ) || GetFocusedContainer().IsInherited( ContainerWithCargoAndAttachments ) )
575 return GetFocusedContainer().SplitItem();
583 if( GetFocusedContainer().IsInherited( ContainerWithCargo ) || GetFocusedContainer().IsInherited( ContainerWithCargoAndAttachments ) )
585 return GetFocusedContainer().EquipItem();
605 if( GetFocusedContainer().IsInherited( ContainerWithCargo ) || GetFocusedContainer().IsInherited( ContainerWithCargoAndAttachments ) )
607 return GetFocusedContainer().TransferItem();
621 if( !GetFocusedContainer().IsInherited( ContainerWithCargo ) && !GetFocusedContainer().IsInherited( ContainerWithCargoAndAttachments ) )
636 if( GetFocusedContainer().IsInherited( ContainerWithCargo ) || GetFocusedContainer().IsInherited( ContainerWithCargoAndAttachments ) )
638 return GetFocusedContainer().Select();
649 if( selected_item != focused_item)
651 if( selected_item.GetInventory().CanRemoveEntity() )
661 if( focused_item && focused_item.GetInventory().CanRemoveEntity() )
664 if( item_in_hands && item_in_hands.GetInventory().CanRemoveEntity() )
668 GetGame().
GetPlayer().PredictiveSwapEntities( item_in_hands, focused_item );
688 if(
GetGame().
GetPlayer().GetHumanInventory().CanAddEntityInHands( focused_item ) )
703 if( GetFocusedContainer().IsInherited( ContainerWithCargo ) || GetFocusedContainer().IsInherited( ContainerWithCargoAndAttachments ) )
705 return GetFocusedContainer().TransferItemToVicinity();
711 if( item && player.CanDropEntity( item ) )
713 if( item.GetTargetQuantityMax() < item.GetQuantity() )
714 item.SplitIntoStackMaxClient( null, -1 );
716 player.PhysicalPredictiveDropItem( item );
void Inventory(LayoutHolder parent)
FindInventoryLocationType
flags for searching locations in inventory
ref Widget m_RootWidget[MAX_SIMULTANIOUS_PLAYERS]
protected Widget m_Parent
override void SetHeader(Header header)
proto native DayZPlayer GetPlayer()
proto bool ConfigGetText(string path, out string value)
Get string value from config on path.
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto native bool ConfigIsExisting(string path)
override bool IsDisplayable()
protected ref CollapsibleHeader m_CollapsibleHeader
override void Remove(LayoutHolder container)
override Header GetHeader()
override void SetHeader(Header header)
override LayoutHolder Get(int x)
override EntityAI GetFocusedItem()
script counterpart to engine's class Inventory
static bool CanSwapEntitiesEx(notnull EntityAI item1, notnull EntityAI item2)
proto native EntityAI GetParent()
returns parent of current inventory location
proto native int GetSlot()
returns slot id if current type is Attachment
provides access to slot configuration
static proto native int GetSlotIdFromString(string slot_name)
converts string to slot_id
static proto native owned string GetSlotDisplayName(int id)
converts slot_id to string
EntityAI GetSelectedItem()
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 GetRadialIconClosed()
void SetSlotDisplayName(string text)
Widget GetRadialIconPanel()
ImageWidget GetGhostSlot()
void SetSlotID(int slot_ID)
void Init(EntityAI obj, bool reservation=false)
void SetContainer(Container container)
static const int IMAGESETGROUP_INVENTORY
static string VerifyIconImageString(int imageset_group=IMAGESETGROUP_INVENTORY, string icon_name="")
Checks for improperly formated, legacy image names and corrects them to default format.
protected ref AttachmentsGroupContainer m_Container
protected EntityAI m_ZombieEntity
void SetEntity(EntityAI zombie_entity)
void ToggleContainer(Widget w)
protected ref map< int, SlotsIcon > m_InventorySlots
void OnDropReceivedFromGhostArea(Widget w, int x, int y, Widget receiver)
bool IsItemWithAttachmentsActive()
override bool TransferItem()
override bool TransferItemToVicinity()
override void OnDropReceivedFromHeader(Widget w, int x, int y, Widget receiver)
override bool CanOpenCloseContainerEx(EntityAI focusedEntity)
override void UpdateRadialIcon()
void DoubleClick(Widget w, int x, int y, int button)
void ZombieContainer(LayoutHolder parent, int sort=-1)
override void ExpandCollapseContainer()
Widget GetWidgetSlot(int slot_number)
override void DraggingOverHeader(Widget w, int x, int y, Widget receiver)
SlotsIcon GetSlotsIcon(int row, int column)
override bool EquipItem()
override bool IsItemWithQuantityActive()
protected ref ContainerWithCargo m_CargoGrid
bool IsItemWithContainerActive()
void AddSlotsContainer(int row_count)
override void CollapseButtonOnMouseButtonDown(Widget w)
protected ref map< EntityAI, ref Container > m_ShowedItems
void ItemAttached(EntityAI item, string slot_name)
void ItemDetached(EntityAI item, string slot_name)
bool IsZombieEquipmentActive()
bool IsContainerWithCargoActive()
override bool SplitItem()
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native CGame GetGame()
proto int Replace(string sample, string replace)
Replace all occurrances of 'sample' in 'str' by 'replace'.