DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
ZombieContainer.c
Go to the documentation of this file.
2{
4 protected ref ContainerWithCargo m_CargoGrid;
8
9 void ZombieContainer( LayoutHolder parent, int sort = -1 )
10 {
13
16 SetHeader(null);
17 m_Body.Insert( m_Container );
18
19 m_MainWidget = m_RootWidget.FindAnyWidget( "body" );
20
21 WidgetEventHandler.GetInstance().RegisterOnChildAdd( m_MainWidget, this, "OnChildAdd" );
22 WidgetEventHandler.GetInstance().RegisterOnChildRemove( m_MainWidget, this, "OnChildRemove" );
23
24
25 RecomputeOpenedContainers();
26 }
27
29 {
30 if( m_ZombieEntity )
31 {
32 m_ZombieEntity.GetOnItemAttached().Remove(ItemAttached);
33 m_ZombieEntity.GetOnItemDetached().Remove(ItemDetached);
34 }
35 }
36
37 void SetEntity( EntityAI zombie_entity )
38 {
39 m_ZombieEntity = zombie_entity;
40 m_ZombieEntity.GetOnItemAttached().Insert(ItemAttached);
41 m_ZombieEntity.GetOnItemDetached().Insert(ItemDetached);
43 m_Parent.Refresh();
44 }
45
46 override void UpdateRadialIcon()
47 {
48 if ( m_SlotIcon )
49 {
50 bool show_radial_icon;
51 show_radial_icon = IsHidden();
52 Widget rip = m_SlotIcon.GetRadialIconPanel();
53 Widget icon_open = m_SlotIcon.GetRadialIcon();
54 Widget icon_closed = m_SlotIcon.GetRadialIconClosed();
55 rip.Show( !m_ZombieEntity.GetInventory().IsInventoryLockedForLockType( HIDE_INV_FROM_SCRIPT ) && m_ZombieEntity.CanDisplayCargo());
56 icon_open.Show( show_radial_icon );
57 icon_closed.Show( !show_radial_icon );
58 }
59 }
60
62 {
64 return ent && QuantityConversions.HasItemQuantity( ent ) && ent.CanBeSplit();
65 }
66
68 {
69 return GetFocusedContainer().IsInherited( ContainerWithCargo );
70 }
71
73 {
74 return GetFocusedContainer().IsInherited( ContainerWithCargoAndAttachments );
75 }
76
78 {
79 return GetFocusedContainer() == m_Container;
80 }
81
83 {
85 return ent && ( ent.GetInventory().GetCargo() || ent.GetSlotsCountCorrect() > 0 );
86 }
87
89 {
90 return !GetFocusedItem();
91 }
92
94 {
96 {
97 ItemPreviewWidget item_preview = GetFocusedSlotsIcon().GetRender();
98 ToggleContainer( item_preview.GetParent() );
99 }
100 }
101
102 override void OnDropReceivedFromHeader( Widget w, int x, int y, Widget receiver )
103 {
104 ItemPreviewWidget ipw = ItemPreviewWidget.Cast( w.FindAnyWidget( "Render" ) );
105 if( !ipw )
106 {
107 string name = w.GetName();
108 name.Replace( "PanelWidget", "Render" );
109 ipw = ItemPreviewWidget.Cast( w.FindAnyWidget( name ) );
110 }
111 if( !ipw )
112 {
113 ipw = ItemPreviewWidget.Cast( w );
114 }
115
116 if( !ipw.IsInherited( ItemPreviewWidget ) )
117 {
118 return;
119 }
120
121 EntityAI item = ipw.GetItem();
122
123 if( !item.GetInventory().CanRemoveEntity() )
124 return;
125
126 if (m_ZombieEntity.GetInventory().CanAddEntityInCargo( item, item.GetInventory().GetFlipCargo() ))
127 GetGame().GetPlayer().PredictiveTakeEntityToTargetCargo( m_ZombieEntity, item );
128 else if( m_ZombieEntity.GetInventory().CanAddEntityToInventory( item ) )
129 {
130 GetGame().GetPlayer().PredictiveTakeEntityToTargetInventory( m_ZombieEntity, FindInventoryLocationType.CARGO, item );
131 }
132 }
133
134 override void DraggingOverHeader(Widget w, int x, int y, Widget receiver)
135 {
136 ItemPreviewWidget ipw = ItemPreviewWidget.Cast(w.FindAnyWidget( "Render" ));
137 string name = receiver.GetName();
138 name.Replace("PanelWidget", "Render");
139 ItemPreviewWidget receiver_iw = ItemPreviewWidget.Cast( receiver.FindAnyWidget( name ) );
140 EntityAI receiver_item;
141 if (receiver_iw)
142 {
143 receiver_item = receiver_iw.GetItem();
144 }
145
146 if(!ipw)
147 {
148 name = w.GetName();
149 name.Replace("PanelWidget", "Render");
150 ipw = ItemPreviewWidget.Cast(w.FindAnyWidget(name));
151 }
152 if(!ipw)
153 {
154 ipw = ItemPreviewWidget.Cast(w);
155 }
156
157 if( !ipw.IsInherited(ItemPreviewWidget))
158 {
159 return;
160 }
161
162 EntityAI item = ipw.GetItem();
163 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
164
165 if(!item.GetInventory().CanRemoveEntity())
166 return;
167 }
168
169 void OnDropReceivedFromGhostArea(Widget w, int x, int y, Widget receiver)
170 {
171 ItemPreviewWidget ipw = ItemPreviewWidget.Cast( w.FindAnyWidget("Render"));
172 string name = receiver.GetName();
173 name.Replace("PanelWidget", "Render");
174 ItemPreviewWidget receiver_iw = ItemPreviewWidget.Cast( receiver.FindAnyWidget(name));
175 EntityAI receiver_item;
176 if (receiver_iw)
177 {
178 receiver_item = receiver_iw.GetItem();
179 }
180
181 if( !ipw )
182 {
183 name = w.GetName();
184 name.Replace( "PanelWidget", "Render" );
185 ipw = ItemPreviewWidget.Cast( w.FindAnyWidget(name));
186 }
187 if(!ipw)
188 {
189 ipw = ItemPreviewWidget.Cast(w);
190 }
191
192 if(!ipw.IsInherited(ItemPreviewWidget))
193 {
194 return;
195 }
196
197 EntityAI item = ipw.GetItem();
198 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
199
200 if(!item.GetInventory().CanRemoveEntity())
201 {
202 return;
203 }
204
205 if(receiver_item)
206 {
207 if(receiver_item.GetInventory().CanAddAttachment(item))
208 {
209 player.PredictiveTakeEntityToTargetAttachment(receiver_item, item);
210 return;
211 }
212 else if(receiver_item.GetInventory().CanAddEntityInCargo(item, item.GetInventory().GetFlipCargo()) && !receiver_item.GetInventory().HasEntityInCargo(item))
213 {
214 player.PredictiveTakeEntityToTargetInventory(receiver_item, FindInventoryLocationType.ANY, item);
215 return;
216 }
217 }
218
219 if(item)
220 {
221 if(m_ZombieEntity.GetInventory().CanAddAttachment(item))
222 {
223 player.PredictiveTakeEntityToTargetAttachment(m_ZombieEntity, item);
224 }
225 else if(m_ZombieEntity.GetInventory().CanAddEntityToInventory(item))
226 {
227 player.PredictiveTakeEntityToTargetInventory(m_ZombieEntity, FindInventoryLocationType.ANY, item);
228 }
229 }
230
231 if( item )
232 {
233 if( m_ZombieEntity.GetInventory().CanAddEntityInto(item, FindInventoryLocationType.CARGO ))
234 {
235 player.PredictiveTakeEntityToTargetInventory(m_ZombieEntity, FindInventoryLocationType.CARGO, item);
236 }
237 }
238 }
239
241 {
242 m_CollapsibleHeader.SetName( "#container_inventory" );
243 }
244
245 void ItemAttached(EntityAI item, string slot_name)
246 {
247 int slot = InventorySlots.GetSlotIdFromString( slot_name );
248 SlotsIcon icon = m_InventorySlots.Get( slot );
249 if( icon )
250 {
251 icon.Init( item );
252
253 if( m_ShowedItems.Contains( item ) == false )
254 {
255 string name;
256
257 if( item.GetSlotsCountCorrect() > 0 )
258 {
259 ContainerWithCargoAndAttachments iwca = new ContainerWithCargoAndAttachments( this, false );
260 iwca.SetEntity( item );
261 WidgetEventHandler.GetInstance().RegisterOnMouseButtonUp( icon.GetPanelWidget(), this, "ToggleContainer" );
262
263 icon.GetRadialIconPanel().Show( true );
264 m_ShowedItems.Insert( item, iwca );
265
266 Refresh();
267 }
268 else if( item.GetInventory().GetCargo() )
269 {
270 ContainerWithCargo iwc = new ContainerWithCargo( this, false );
271 iwc.SetEntity( item );
272 iwc.UpdateInterval();
273 WidgetEventHandler.GetInstance().RegisterOnMouseButtonUp( icon.GetPanelWidget(), this, "ToggleContainer" );
274 m_ShowedItems.Insert( item, iwc );
275 icon.GetRadialIconPanel().Show(true);
276
277 Refresh();
278 }
279 }
280
281 ClosableContainer conta = ClosableContainer.Cast( m_ShowedItems.Get( item ) );
282 string config = "CfgVehicles " + item.GetType() + " GUIInventoryAttachmentsProps";
283 if( conta && conta.IsInherited( ClosableContainer ) )
284 {
285 bool show_radial_icon = ( item.GetInventory().GetCargo() || item.GetSlotsCountCorrect() > 0 ) && !GetGame().ConfigIsExisting( config );
286 Widget rip = icon.GetRadialIconPanel();
287 Widget icon_open = icon.GetRadialIcon();
288 Widget icon_closed = icon.GetRadialIconClosed();
289 rip.Show( show_radial_icon );
290 icon_open.Show( conta.IsOpened() );
291 icon_closed.Show( !conta.IsOpened() );
292 }
293 RecomputeOpenedContainers();
294 }
295 }
296
297 void ItemDetached(EntityAI item, string slot_name)
298 {
299 int slot = InventorySlots.GetSlotIdFromString( slot_name );
300 SlotsIcon icon = m_InventorySlots.Get( slot );
301
302 if( icon )
303 {
304 Container con = m_ShowedItems.Get( item );
305 if( con )
306 {
307 ( Container.Cast( con.m_Parent ) ).Remove( con );
308 RecomputeOpenedContainers();
309 GetMainWidget().Update();
310 Refresh();
311 m_ShowedItems.Remove( item );
312 }
313
314 icon.Clear();
315 Inventory in = Inventory.Cast( GetRoot() );
316 if( in )
317 in.UpdateConsoleToolbar();
318 }
319 }
320
321 override bool CanOpenCloseContainerEx(EntityAI focusedEntity)
322 {
324 if (focusedEntity)
325 {
326 c = ClosableContainer.Cast( m_ShowedItems.Get( focusedEntity ) );
327 }
328 else
329 {
330 SlotsIcon icon = GetFocusedSlotsIcon();
331 if (icon)
332 {
333 c = ClosableContainer.Cast(icon.GetContainer());
334 }
335 }
336
337 if (c && c.IsDisplayable())
338 {
339 return true;
340 }
341
342 return false;
343 }
344
345 // mouse button UP or call from ExpandCollapseContainer
347 {
348 EntityAI item;
349 SlotsIcon slots_icon;
351 w.GetUserData(slots_icon);
352 if (slots_icon)
353 item = slots_icon.GetEntity();
354 if (item)
355 {
356 c = ClosableContainer.Cast( m_ShowedItems.Get( item ) );
357 }
358 else
359 {
360 c = ClosableContainer.Cast(slots_icon.GetContainer());
361 }
362
363
364 if (c)
365 {
366 c.Toggle();
367 }
368 RecomputeOpenedContainers();
369 }
370
371 SlotsIcon GetSlotsIcon( int row, int column )
372 {
373 return SlotsContainer.Cast( m_Container.Get( row ) ).GetSlotIcon( column );
374 }
375
377 {
378 int row, column;
379 SlotsIcon icon;
380 bool has_cargo = m_ZombieEntity.GetInventory().GetCargo() != null;
381
382 string config_path_ghosts_slots = "CfgVehicles ZombieBase InventoryEquipment playerSlots";
383 ref array<string> player_ghosts_slots = new array<string>;
384 GetGame().ConfigGetTextArray( config_path_ghosts_slots, player_ghosts_slots );
385
386 for ( int i = 0; i < player_ghosts_slots.Count(); i++ )
387 {
388 string slot_name = player_ghosts_slots.Get ( i );
389 string path = "CfgSlots" + " " + slot_name;
390
391 if ( GetGame().ConfigIsExisting( path ) )
392 {
393 string icon_name; //icon_name must be in format "set:<setname> image:<imagename>"
394 GetGame().ConfigGetText( path + " ghostIcon", icon_name );
395 column = i % ITEMS_IN_ROW;
396
397 //START - GetWidgetSlot
398 row = i / ITEMS_IN_ROW;
399 if( row >= m_Container.Count() )
400 {
401 if ( has_cargo )
402 {
403 if( row < ( (player_ghosts_slots.Count() + 1 )/ ITEMS_IN_ROW ) )
405 else
406 AddSlotsContainer( ( player_ghosts_slots.Count() + 1 ) % ITEMS_IN_ROW );
407
408 }
409 else
410 {
411 if ( row < ( player_ghosts_slots.Count() / ITEMS_IN_ROW ) )
413 else
414 AddSlotsContainer( player_ghosts_slots.Count() % ITEMS_IN_ROW );
415 }
416
417 }
418
419 icon = GetSlotsIcon( row, column );
420
421 icon.GetMainWidget().Show( true );
422 icon.Clear();
423
425
426 //END - GetWidgetSlot
427 WidgetEventHandler.GetInstance().RegisterOnDropReceived( icon.GetPanelWidget(), this, "OnDropReceivedFromGhostArea" );
428 WidgetEventHandler.GetInstance().RegisterOnDropReceived( icon.GetGhostSlot(), this, "OnDropReceivedFromGhostArea" );
430 WidgetEventHandler.GetInstance().RegisterOnDraggingOver( icon.GetGhostSlot(), this, "DraggingOver" );
433
435 //END - LoadIconIntoWidgetSlot
436
437 GetGame().ConfigGetText( path + " name", slot_name );
438 int slot_id = InventorySlots.GetSlotIdFromString( slot_name );
439 icon.SetSlotID( slot_id );
441 m_InventorySlots.Set( slot_id, icon );
442
443 int slot = InventorySlots.GetSlotIdFromString( slot_name );
444 ItemBase item = ItemBase.Cast( m_ZombieEntity.GetInventory().FindAttachment( slot ) );
445
446 if( item )
447 ItemAttached( item, slot_name );
448 }
449 }
450
451 if( m_ZombieEntity.GetInventory().GetCargo() )
452 {
453 row = player_ghosts_slots.Count() / ITEMS_IN_ROW;
454 column = player_ghosts_slots.Count() % ITEMS_IN_ROW;
455 if( row >= m_Container.Count() )
456 {
457 if( row < ( player_ghosts_slots.Count() + 1 / ITEMS_IN_ROW ) )
459 else
460 AddSlotsContainer( ( player_ghosts_slots.Count() + 1 ) % ITEMS_IN_ROW );
461 }
462
463 icon = GetSlotsIcon( row, column );
464 icon.GetMainWidget().Show( true );
465 icon.Clear();
466 icon.GetGhostSlot().LoadImageFile( 0, StaticGUIUtils.VerifyIconImageString(StaticGUIUtils.IMAGESETGROUP_INVENTORY,m_ZombieEntity.ConfigGetString("GUIInventoryCargoIcon")) );
467 icon.SetSlotDisplayName( m_ZombieEntity.ConfigGetString("GUIInventoryCargoName") );
468 icon.GetRadialIconPanel().Show( true );
469 icon.GetRadialIcon().Show( true );
470
471 WidgetEventHandler.GetInstance().RegisterOnMouseButtonUp( icon.GetGhostSlot(), this, "ToggleContainer" );
472 m_CargoGrid = new ContainerWithCargo( this, false );
473 m_CargoGrid.SetEntity( m_ZombieEntity );
474 m_CargoGrid.GetHeader().GetMainWidget().ClearFlags( WidgetFlags.DRAGGABLE );
477 }
478
479 RecomputeOpenedContainers();
480 }
481
482 void AddSlotsContainer( int row_count )
483 {
485 s_cont.SetColumnCount( row_count );
486 m_Container.Insert( s_cont );
487 }
488
489 Widget GetWidgetSlot( int slot_number )
490 {
491 int row = slot_number / ITEMS_IN_ROW;
492 int column = slot_number % ITEMS_IN_ROW;
493
494 return m_Container.Get( row ).GetMainWidget().FindAnyWidget( "Render" + column );
495 }
496
497 void DoubleClick(Widget w, int x, int y, int button)
498 {
499 if( button == MouseState.LEFT && !g_Game.IsLeftCtrlDown())
500 {
501 if( w == null )
502 {
503 return;
504 }
505 ItemPreviewWidget iw = ItemPreviewWidget.Cast( w.FindAnyWidget( "Render" ) );
506 if( !iw )
507 {
508 string name = w.GetName();
509 name.Replace( "PanelWidget", "Render" );
510 iw = ItemPreviewWidget.Cast( w.FindAnyWidget( name ) );
511 }
512
513 if( !iw )
514 {
515 iw = ItemPreviewWidget.Cast( w );
516 }
517
518 ItemBase item = ItemBase.Cast( iw.GetItem() );
519 if( !item )
520 {
521 return;
522 }
523
524 PlayerBase player = PlayerBase.Cast( GetGame().GetPlayer() );
525
526 if( player.GetInventory().HasInventoryReservation( item, null ) || player.IsItemsToDelete() )
527 {
528 return;
529 }
530
531 if( !item.GetInventory().CanRemoveEntity() )
532 return;
533
534 if ( player.GetInventory().HasEntityInInventory( item ) && GetGame().GetPlayer().GetHumanInventory().CanAddEntityInHands( item ) )
535 {
536 player.PredictiveTakeEntityToHands( item );
537 }
538 else
539 {
541 if( player.GetInventory().FindFreeLocationFor( item, FindInventoryLocationType.ANY, il) )
542 {
543 if( item.GetTargetQuantityMax(il.GetSlot()) < item.GetQuantity() )
544 item.SplitIntoStackMaxToInventoryLocationClient( il );
545 else
546 player.PredictiveTakeEntityToInventory( FindInventoryLocationType.ANY, item );
547 }
548 else if( GetGame().GetPlayer().GetHumanInventory().CanAddEntityInHands( item ) )
549 {
550 if( item.GetTargetQuantityMax() < item.GetQuantity() )
551 item.SplitIntoStackMaxHandsClient( player );
552 else
553 player.PredictiveTakeEntityToHands( item );
554 }
555 }
556
557 HideOwnedTooltip();
558 InventoryMenu menu = InventoryMenu.Cast( GetGame().GetUIManager().FindMenu( MENU_INVENTORY ) );
559 if( menu )
560 {
561 menu.RefreshQuickbar();
562 }
563 }
564 }
565
567 {
568 super.CollapseButtonOnMouseButtonDown(w);
569 }
570
571 override bool SplitItem()
572 {
573 if( GetFocusedContainer().IsInherited( ContainerWithCargo ) || GetFocusedContainer().IsInherited( ContainerWithCargoAndAttachments ) )
574 {
575 return GetFocusedContainer().SplitItem();
576 }
577
578 return false;
579 }
580
581 override bool EquipItem()
582 {
583 if( GetFocusedContainer().IsInherited( ContainerWithCargo ) || GetFocusedContainer().IsInherited( ContainerWithCargoAndAttachments ) )
584 {
585 return GetFocusedContainer().EquipItem();
586 }
587 else
588 {
589 EntityAI item = GetFocusedItem();
590 if( item )
591 {
592 GetGame().GetPlayer().PredictiveTakeEntityToInventory( FindInventoryLocationType.ATTACHMENT, item );
593 return true;
594 }
595 }
596 return false;
597 }
598
599 override bool TransferItem()
600 {
601 LeftArea left_area = LeftArea.Cast( GetParent() );
602 EntityAI item;
603 if( left_area )
604 {
605 if( GetFocusedContainer().IsInherited( ContainerWithCargo ) || GetFocusedContainer().IsInherited( ContainerWithCargoAndAttachments ) )
606 {
607 return GetFocusedContainer().TransferItem();
608 }
609 else
610 {
611 item = GetFocusedItem();
612 if( item )
613 {
614 GetGame().GetPlayer().PredictiveTakeEntityToInventory( FindInventoryLocationType.CARGO, item );
615 return true;
616 }
617 }
618 }
619 else
620 {
621 if( !GetFocusedContainer().IsInherited( ContainerWithCargo ) && !GetFocusedContainer().IsInherited( ContainerWithCargoAndAttachments ) )
622 {
623 item = GetFocusedItem();
624 if( item )
625 {
626 GetGame().GetPlayer().PredictiveTakeEntityToInventory( FindInventoryLocationType.CARGO, item );
627 return true;
628 }
629 }
630 }
631 return false;
632 }
633
634 override bool Select()
635 {
636 if( GetFocusedContainer().IsInherited( ContainerWithCargo ) || GetFocusedContainer().IsInherited( ContainerWithCargoAndAttachments ) )
637 {
638 return GetFocusedContainer().Select();
639 }
640 else
641 {
643 EntityAI focused_item = GetFocusedItem();
645 if( !(selected_slot && selected_slot.IsOutOfReach() ) )
646 {
647 if( selected_item )
648 {
649 if( selected_item != focused_item)
650 {
651 if( selected_item.GetInventory().CanRemoveEntity() )
652 {
653 GetGame().GetPlayer().PredictiveTakeEntityToTargetInventory( m_ZombieEntity, FindInventoryLocationType.ANY, selected_item );
654 ItemManager.GetInstance().SetSelectedItem( null, null, null, null );
655 return true;
656 }
657 }
658 }
659 else
660 {
661 if( focused_item && focused_item.GetInventory().CanRemoveEntity() )
662 {
663 EntityAI item_in_hands = GetGame().GetPlayer().GetHumanInventory().GetEntityInHands();
664 if( item_in_hands && item_in_hands.GetInventory().CanRemoveEntity() )
665 {
666 if( GameInventory.CanSwapEntitiesEx( item_in_hands, focused_item ) )
667 {
668 GetGame().GetPlayer().PredictiveSwapEntities( item_in_hands, focused_item );
669 return true;
670 }
671 else
672 {
673 InventoryLocation il_hands_dst = new InventoryLocation;
674 if( GetGame().GetPlayer().GetHumanInventory().FindFreeLocationFor( item_in_hands, FindInventoryLocationType.ANY, il_hands_dst ) )
675 {
676 InventoryMode invMode = InventoryMode.PREDICTIVE;
677
678 if ( GetGame().GetPlayer().NeedInventoryJunctureFromServer(item_in_hands, item_in_hands.GetHierarchyParent(), il_hands_dst.GetParent()) || GetGame().GetPlayer().NeedInventoryJunctureFromServer(focused_item, focused_item.GetHierarchyParent(), GetGame().GetPlayer()) )
679 invMode = InventoryMode.JUNCTURE;
680
681 GetGame().GetPlayer().GetHumanInventory().ForceSwapEntities( InventoryMode.JUNCTURE, focused_item, item_in_hands, il_hands_dst );
682 return true;
683 }
684 }
685 }
686 else
687 {
688 if( GetGame().GetPlayer().GetHumanInventory().CanAddEntityInHands( focused_item ) )
689 {
690 GetGame().GetPlayer().PredictiveTakeEntityToHands( focused_item );
691 return true;
692 }
693 }
694 }
695 }
696 }
697 }
698 return false;
699 }
700
702 {
703 if( GetFocusedContainer().IsInherited( ContainerWithCargo ) || GetFocusedContainer().IsInherited( ContainerWithCargoAndAttachments ) )
704 {
705 return GetFocusedContainer().TransferItemToVicinity();
706 }
707 else
708 {
709 Man player = GetGame().GetPlayer();
710 ItemBase item = ItemBase.Cast( GetFocusedItem() );
711 if( item && player.CanDropEntity( item ) )
712 {
713 if( item.GetTargetQuantityMax() < item.GetQuantity() )
714 item.SplitIntoStackMaxClient( null, -1 );
715 else
716 player.PhysicalPredictiveDropItem( item );
717 return true;
718 }
719 }
720 return false;
721 }
722}
InventoryMode
Definition Inventory.c:20
const int ITEMS_IN_ROW
Definition Attachments.c:1
void Inventory(LayoutHolder parent)
Definition Inventory.c:75
DayZGame g_Game
Definition DayZGame.c:3654
Icon x
Icon y
FindInventoryLocationType
flags for searching locations in inventory
void InventoryMenu()
PlayerBase GetPlayer()
string name
ref Widget m_RootWidget[MAX_SIMULTANIOUS_PLAYERS]
protected Widget m_Parent
Definition SizeToChild.c:92
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 IsOpened()
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
Definition Inventory.c:77
static bool CanSwapEntitiesEx(notnull EntityAI item1, notnull EntityAI item2)
Definition Inventory.c:601
void SetName(string name)
Definition Header.c:33
InventoryLocation.
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()
Definition ItemManager.c:82
void SetSelectedItem(EntityAI selected_item, Container selected_container, Widget selected_widget, SlotsIcon selected_icon)
SlotsIcon GetSelectedIcon()
Definition ItemManager.c:97
static ItemManager GetInstance()
proto native EntityAI GetItem()
static int HasItemQuantity(notnull EntityAI item)
SlotsIcon GetSlotIcon(int index)
Widget GetRadialIconClosed()
Definition SlotsIcon.c:300
Widget GetRadialIcon()
Definition SlotsIcon.c:305
void SetSlotDisplayName(string text)
Definition SlotsIcon.c:144
Widget GetRadialIconPanel()
Definition SlotsIcon.c:295
EntityAI GetEntity()
Definition SlotsIcon.c:353
Container GetContainer()
Definition SlotsIcon.c:149
void Clear()
Definition SlotsIcon.c:502
Widget GetPanelWidget()
Definition SlotsIcon.c:205
ImageWidget GetGhostSlot()
Definition SlotsIcon.c:235
void SetSlotID(int slot_ID)
Definition SlotsIcon.c:195
void Init(EntityAI obj, bool reservation=false)
Definition SlotsIcon.c:460
void SetContainer(Container container)
Definition SlotsIcon.c:139
bool IsOutOfReach()
Definition SlotsIcon.c:607
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.
void RegisterOnMouseButtonDown(Widget w, Managed eventHandler, string functionName)
void RegisterOnMouseButtonUp(Widget w, Managed eventHandler, string functionName)
static WidgetEventHandler GetInstance()
void RegisterOnDoubleClick(Widget w, Managed eventHandler, string functionName)
void RegisterOnChildRemove(Widget w, Managed eventHandler, string functionName)
void RegisterOnDropReceived(Widget w, Managed eventHandler, string functionName)
void RegisterOnChildAdd(Widget w, Managed eventHandler, string functionName)
void RegisterOnDraggingOver(Widget w, Managed eventHandler, string functionName)
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)
override bool Select()
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()
const int MENU_INVENTORY
Definition constants.c:158
MouseState
Definition EnSystem.c:311
proto int Replace(string sample, string replace)
Replace all occurrances of 'sample' in 'str' by 'replace'.
proto native Widget GetParent()
Get parent of the Effect.
Definition Effect.c:396
WidgetFlags
Definition EnWidgets.c:57