Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Loading...
Searching...
No Matches
itemmanager.c
Go to the documentation of this file.
2{
3 private ref static ItemManager m_Instance;
4 protected bool m_IsDragging;
6 protected bool m_SlotInfoShown;
8 protected Icon m_DraggedIcon;
9 protected ref Widget m_TooltipWidget;
17 protected ref Timer m_ToolTipTimer;
19
25
27
29
33
34 protected int m_TooltipPosX;
35 protected int m_TooltipPosY;
36 protected Widget m_TooltipSourceWidget; //stored here for tooltip position updates
37 protected ScrollWidget m_LeftSlotsScroller;
38
39 #ifndef PLATFORM_CONSOLE
40 protected const float TOOLTIP_DELAY = 0.25; // in seconds
41 #else
42 protected const float TOOLTIP_DELAY = 1.5; // in seconds
43 #endif
44
45 void ItemManager( Widget root )
46 {
47 m_Instance = this;
48 m_RootWidget = root;
51 m_SlotInfoShown = false;
52
53 #ifdef PLATFORM_CONSOLE
54 m_TooltipWidget = g_Game.GetWorkspace().CreateWidgets("gui/layouts/inventory_new/day_z_inventory_new_tooltip_xbox.layout", root );
55 m_TooltipSlotWidget = g_Game.GetWorkspace().CreateWidgets("gui/layouts/inventory_new/day_z_inventory_new_tooltip_slot_xbox.layout", root );
56 #else
57 m_TooltipWidget = g_Game.GetWorkspace().CreateWidgets("gui/layouts/inventory_new/day_z_inventory_new_tooltip.layout", root );
58 m_TooltipSlotWidget = g_Game.GetWorkspace().CreateWidgets("gui/layouts/inventory_new/day_z_inventory_new_tooltip_slot.layout", root );
59 #endif
60 m_TooltipWidget.Show( false );
61 m_TooltipSlotWidget.Show( false );
62 }
63
64 void SetItemMicromanagmentMode( bool item_micromanagment_mode )
65 {
66 m_ItemMicromanagmentMode = item_micromanagment_mode;
67 Inventory.GetInstance().UpdateConsoleToolbar();
68 }
69
74
79
80 void SetHandsPreview( HandsPreview hansd_preview )
81 {
82 m_HandsPreview = hansd_preview;
83 }
84
86 {
87 return m_SelectedItem;
88 }
89
94
99
101 {
102 return m_SelectedIcon;
103 }
104
105 void SetSelectedItem( EntityAI selected_item, Container selected_container, Widget selected_widget, SlotsIcon selected_icon )
106 {
107 m_SelectedItem = selected_item;
108 m_SelectedContainer = selected_container;
109 m_SelectedWidget = selected_widget;
110 m_SelectedIcon = selected_icon;
111 }
112
113 void SetSelectedItemEx( EntityAI selected_item, Container selected_container, LayoutHolder selected_icon )
114 {
115 SlotsIcon sIcon;
116 Icon icon;
117
118 m_SelectedItem = selected_item;
119 m_SelectedContainer = selected_container;
120
122 {
123 sIcon = SlotsIcon.Cast(m_SelectedBaseIcon);
124 icon = Icon.Cast(m_SelectedBaseIcon);
125 if (sIcon)
126 {
127 sIcon.GetMicromanagedPanel().Show(false);
128 }
129 else if (icon)
130 {
131 icon.GetMicromanagedPanel().Show(false);
132 }
133 }
134
135 if (selected_icon)
136 {
137 sIcon = SlotsIcon.Cast(selected_icon);
138 icon = Icon.Cast(selected_icon);
139
140 if (sIcon)
141 {
143 sIcon.GetMicromanagedPanel().Show(true);
144 }
145 else if (icon)
146 {
148 icon.GetMicromanagedPanel().Show(true);
149 }
150 }
151 else
152 {
153 m_SelectedWidget = null;
154 }
155 m_SelectedBaseIcon = selected_icon;
156 }
157
159 {
160 m_DefautOpenStates.Clear();
161 }
162
167
168 void SetDefaultOpenState( string type, bool is_opened )
169 {
170 m_DefautOpenStates.Set( type, is_opened );
171 }
172
173 void SetDefaultHeaderOpenState( string type, bool is_opened )
174 {
175 m_DefautHeaderOpenStates.Set( type, is_opened );
176 }
177
178 void SetDefaultOpenStateHands( bool is_opened )
179 {
180 m_HandsDefaultOpenState = is_opened;
181 int hands_default_open_state = m_HandsDefaultOpenState; //from bool to int for easier parsing
182 g_Game.SetProfileString( "defaultOpenStateHands", hands_default_open_state.ToString() );
183 g_Game.SaveProfile();
184 }
185
187 {
188 string value;
189 g_Game.GetProfileString( "defaultOpenStateHands", value );
192 }
193
195 {
196 TStringArray serialized_types = new TStringArray;
197
198 for ( int i = 0; i < m_DefautHeaderOpenStates.Count(); i++ )
199 {
200 int is_opened = m_DefautHeaderOpenStates.GetElement( i ); //from bool to int for easier parsing
201 serialized_types.Insert( m_DefautHeaderOpenStates.GetKey( i ) + "," + is_opened );
202 }
203
204 if( serialized_types.Count() > 0 )
205 {
206 g_Game.SetProfileStringList( "defaultHeaderOpenStates", serialized_types );
207 }
208 }
209
211 {
213
214 TStringArray serialized_types = new TStringArray;
215 g_Game.GetProfileStringList( "defaultHeaderOpenStates", serialized_types );
216
217 for( int i = 0; i < serialized_types.Count(); i++ )
218 {
219 TStringArray strs = new TStringArray;
220 serialized_types.Get( i ).Split( ",", strs );
221 bool is_opened = strs.Get( 1 ).ToInt();
222 SetDefaultHeaderOpenState( strs.Get( 0 ), is_opened );
223 }
224 }
225
227 {
228 TStringArray serialized_types = new TStringArray;
229
230 for ( int i = 0; i < m_DefautOpenStates.Count(); i++ )
231 {
232 int is_opened = m_DefautOpenStates.GetElement( i ); //from bool to int for easier parsing
233 serialized_types.Insert( m_DefautOpenStates.GetKey( i ) + "," + is_opened );
234 }
235
236 if( serialized_types.Count() > 0 )
237 {
238 g_Game.SetProfileStringList( "defaultOpenStates", serialized_types );
239 }
240 }
241
243 {
245
246 TStringArray serialized_types = new TStringArray;
247 g_Game.GetProfileStringList( "defaultOpenStates", serialized_types );
248
249 for( int i = 0; i < serialized_types.Count(); i++ )
250 {
251 TStringArray strs = new TStringArray;
252 serialized_types.Get( i ).Split( ",", strs );
253 bool is_opened = strs.Get( 1 ).ToInt();
254 SetDefaultOpenState( strs.Get( 0 ), is_opened );
255 }
256 }
257
258 bool GetDefaultOpenState( string type )
259 {
260 if( m_DefautOpenStates.Contains( type ) )
261 {
262 return m_DefautOpenStates.Get( type );
263 }
264 else
265 {
266 return true;
267 }
268 }
269
270 bool GetDefaultHeaderOpenState( string type )
271 {
272 if( m_DefautHeaderOpenStates.Contains( type ) )
273 {
274 return m_DefautHeaderOpenStates.Get( type );
275 }
276 else
277 {
278 return true;
279 }
280 }
281
283 {
284 return m_Instance;
285 }
286
288 {
289 GetRightDropzone().SetAlpha( 0 );
290 GetLeftDropzone().SetAlpha( 0 );
291 GetCenterDropzone().SetAlpha( 0 );
292
293 #ifndef PLATFORM_CONSOLE
294 bool ignorePointer = GetLeftSlotsScroller().GetFlags() & WidgetFlags.IGNOREPOINTER;
295 if (ignorePointer)
296 {
297 GetLeftSlotsScroller().ClearFlags(WidgetFlags.IGNOREPOINTER);
298 }
299 #endif
300 }
301
303 {
304 EntityAI owner = item.GetHierarchyParent();
305 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
306
307 if (item == player)
308 {
309 GetRightDropzone().SetAlpha(1);
310 }
311 else if (owner && owner != player)
312 {
313 ShowSourceDropzone(owner);
314 }
315 else
316 {
317 InventoryLocation inv_loc_src = new InventoryLocation;
318 item.GetInventory().GetCurrentInventoryLocation(inv_loc_src);
319 int loc_type = inv_loc_src.GetType();
321 if (loc_type == InventoryLocationType.GROUND)
322 {
323 GetLeftDropzone().SetAlpha(1);
324 }
325 else if (loc_type == InventoryLocationType.HANDS)
326 {
327 GetCenterDropzone().SetAlpha(1);
328 }
329 else
330 {
331 GetRightDropzone().SetAlpha(1);
332 }
333 }
334 }
335
337 {
338 if (!m_LeftDropzone)
339 m_LeftDropzone = m_RootWidget.FindAnyWidget("LeftPanel").FindAnyWidget("DropzoneX");
340
341 return m_LeftDropzone;
342 }
343
345 {
346 if( !m_RightDropzone )
347 m_RightDropzone = m_RootWidget.FindAnyWidget("RightPanel").FindAnyWidget("DropzoneX");
348 return m_RightDropzone;
349 }
350
352 {
353 if( !m_CenterDropzone )
354 m_CenterDropzone = m_RootWidget.FindAnyWidget("HandsPanel").FindAnyWidget("DropzoneX");
355 return m_CenterDropzone;
356 }
357
359 {
360 return m_HoveredItem;
361 }
362
363 void SetDraggedItem( EntityAI dragged_item )
364 {
365 m_DraggedItem = dragged_item;
366 }
367
369 {
370 return m_DraggedItem;
371 }
372
373 void SetDraggedIcon( Icon dragged_icon )
374 {
375 m_DraggedIcon = dragged_icon;
376 }
377
379 {
380 return m_DraggedIcon;
381 }
382
383 void SetIsDragging( bool is_dragging )
384 {
385 m_IsDragging = is_dragging;
386 if( !is_dragging )
387 {
388 SetDraggedItem( null );
389 SetDraggedIcon( null );
390 }
391 }
392
394 {
395 return m_IsDragging;
396 }
397
399 {
400 m_TooltipWidget.Show( false );
401 m_HoveredItem = null;
402 delete m_ToolTipTimer;
403
405 }
406
408 {
409 if ( m_SlotInfoShown )
410 {
411 m_TooltipSlotWidget.Show( false );
412 m_SlotInfoShown = false;
413 delete m_TooltipSlotTimer;
414 }
415 }
416
417 static int GetItemHealthColor(int pHealthLevel)
418 {
419 switch (pHealthLevel)
420 {
421 case -1:
422 break;
424 return Colors.COLOR_PRISTINE;
426 return Colors.COLOR_WORN;
428 return Colors.COLOR_DAMAGED;
432 return Colors.COLOR_RUINED;
433 }
434
435 return 0x00FFFFFF;
436 }
437
438 static int GetItemHealthColor(EntityAI item, string zone = "")
439 {
440 if (item)
441 {
442 switch (item.GetHealthLevel(zone))
443 {
444 case -1:
445 break;
447 return Colors.COLOR_PRISTINE;
449 return Colors.COLOR_WORN;
451 return Colors.COLOR_DAMAGED;
455 return Colors.COLOR_RUINED;
456 }
457 }
458
459 return 0x00FFFFFF;
460 }
461
462 static int ColorFromFloat( float fraction )
463 {
464 if( fraction > 1 || fraction < 0 )
465 return 0x00FFFFFF;
466 else if( fraction > 0.80 )
467 return Colors.COLOR_PRISTINE;
468 else if( fraction > 0.6 )
469 return Colors.COLOR_WORN;
470 else if( fraction > 0.4 )
471 return Colors.COLOR_DAMAGED;
472 else if( fraction > 0.2 )
474 else
475 return Colors.COLOR_RUINED;
476 }
477
478 // still used by SlotsIcon calls, different architecture!
479 void SetTemperature(EntityAI item, Widget item_w)
480 {
481 if (item_w)
482 {
483 bool colorSet = false;
484 string name = item_w.GetName();
485 name.Replace("Render", "Temperature");
486 Widget temperature_widget = item_w.GetParent().FindAnyWidget(name);
487 if (item && item.IsInherited(ItemBase) && item.CanHaveTemperature())
488 {
489 ObjectTemperatureState temperatureState = ObjectTemperatureState.GetStateData(item.GetTemperature());
490 if (temperatureState && temperatureState.m_State != EObjectTemperatureState.NEUTRAL)
491 {
492 colorSet = true;
493 temperature_widget.SetColor(temperatureState.m_Color);
494 temperature_widget.SetAlpha(0.3);
495 }
496 }
497 temperature_widget.Show(colorSet);
498 }
499 }
500
502 {
503 if (item_w)
504 {
505 bool colorSet = false;
506 Widget temperatureColorWidget = item_w.FindAnyWidget("Temperature");
507
508 if (item && item.IsInherited(ItemBase) && item.CanHaveTemperature())
509 {
510 ObjectTemperatureState temperatureState = ObjectTemperatureState.GetStateData(item.GetTemperature());
511 if (temperatureState && temperatureState.m_State != EObjectTemperatureState.NEUTRAL)
512 {
513 colorSet = true;
514 temperatureColorWidget.SetColor(temperatureState.m_Color);
515 temperatureColorWidget.SetAlpha(0.3);
516 }
517 }
518 temperatureColorWidget.Show(colorSet);
519 }
520 }
521
522 void PrepareTooltip(EntityAI item, int x = 0, int y = 0)
523 {
524 if( IsDragging() || !item )
525 {
526 return;
527 }
528
529 if ( item.IsInherited( InventoryItem ) )
530 {
531 HideTooltip();
532
533 m_HoveredItem = item;
534 InspectMenuNew.UpdateItemInfo( m_TooltipWidget, item );
535
536 int screen_w, screen_h;
537 float w, h;
538 GetScreenSize(screen_w, screen_h);
539 m_TooltipWidget.GetScreenSize(w,h);
540
541 if (x == -1)//set by icon focusing
542 {
543 x = screen_w/2 - w/2;
544 float x1,y1;
545 m_RootWidget.FindAnyWidget("InventoryFrameWidget").GetScreenPos(x1,y1); //allign to the same height
546 y = y1;
547 }
548 else if (x == 0 && y == 0 && g_Game.GetInput().IsEnabledMouseAndKeyboardEvenOnServer())
549 {
550 GetMousePos(x,y);
551 }
552
553 //minimal edge distance adjustments..
554 screen_w -= 10;
555 screen_h -= 10;
556
557 int rightEdge = x + w;
558 if (rightEdge > screen_w)
559 {
560 x = screen_w - w;
561 }
562
563 int bottomEdge = y + h;
564 if (bottomEdge > screen_h)
565 {
566 y = screen_h - h;
567 }
568
569 m_TooltipWidget.SetPos(x, y);
570
571 m_ToolTipTimer = new Timer();
572 m_ToolTipTimer.Run( TOOLTIP_DELAY, this, "ShowTooltip" );
573
574 Widget preview_frame = m_TooltipWidget.FindAnyWidget("ItemFrameWidget");
575 if (preview_frame)
576 {
577 m_ItemPreviewWidget = ItemPreviewWidget.Cast( preview_frame );
578 m_ItemPreviewWidget.SetItem(item);
579 m_ItemPreviewWidget.SetView( item.GetViewIndex() );
580 }
581 }
582 }
583
585 void PrepareSlotsTooltip(string name, string desc, int x = 0, int y = 0)
586 {
587 InspectMenuNew.UpdateSlotInfo( m_TooltipSlotWidget, name, desc );
588
589 HideTooltip();
590
591 if (name != "")
592 {
593 m_SlotInfoShown = true;
594 //CalculateTooltipSlotPosition(x,y);
596 m_TooltipSlotTimer.Run( TOOLTIP_DELAY, this, "ShowTooltipSlot" );
597 }
598 }
599
600 void CalculateTooltipSlotPosition(int x = 0, int y = 0)
601 {
602 int screen_w, screen_h;
603 float w, h;
604 GetScreenSize(screen_w, screen_h);
605 //m_TooltipSlotWidget.GetScreenSize(w,h);
606 m_TooltipSlotWidget.GetSize(w,h);
607 int slot_normal_w = SlotsIcon.GetNormalWidth();
608 int slot_normal_h = SlotsIcon.GetNormalHeight();
609 //minimal edge distance adjustments..
610 screen_w -= 10;
611 screen_h -= 10;
612
613#ifndef PLATFORM_CONSOLE
614 x += 5;
615 y += slot_normal_h + 5;
616#else
617 x += 5;
618 y += 15;
619#endif
620 Widget scrollerWidget = m_TooltipSourceWidget.GetParent();
621 while (scrollerWidget)
622 {
623 if (ScrollWidget.Cast(scrollerWidget))
624 {
625 break;
626 }
627 else
628 {
629 scrollerWidget = scrollerWidget.GetParent();
630 }
631 }
632
633 int rightEdge = x + w;
634 if (rightEdge > screen_w)
635 {
636 x = screen_w - w;
637 }
638
639 int bottomEdge = y + h;
640 if (scrollerWidget)
641 {
642 float scrollerX, scrollerY, scrollerSizeX, scrollerSizeY;
643 scrollerWidget.GetScreenPos(scrollerX,scrollerY);
644 scrollerWidget.GetScreenSize(scrollerSizeX,scrollerSizeY);
645
646 int scroller_bottom = scrollerY + scrollerSizeY;
647 if (bottomEdge > scroller_bottom)
648 {
649 y = scroller_bottom - slot_normal_h;
650 bottomEdge = y + h;
651 }
652 }
653 /*else
654 {
655 ErrorEx("No scroller widget! | m_TooltipSourceWidget: " + m_TooltipSourceWidget);
656 }*/
657
658 if (bottomEdge > screen_h) //should mostly never proc now
659 {
660 y = screen_h - h;
661 }
662
665 }
666
668 {
669 float x, y;
670 m_TooltipSourceWidget.GetScreenPos(x,y);
672 }
673
675 {
677 }
678
680 {
681 if ( !ItemBase.Cast( entity ) )
682 return false;
683
684 bool draggable;
685 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
686 draggable = !player.GetInventory().HasInventoryReservation( entity, null ) && !player.IsItemsToDelete();
687 draggable = draggable && entity.CanPutIntoHands( g_Game.GetPlayer() );
688 draggable = draggable && entity.GetInventory().CanRemoveEntity();
689
690 return draggable;
691 }
692
693 void SetWidgetDraggable( Widget w, bool draggable )
694 {
695 if (w)
696 {
697 if ( draggable )
698 w.SetFlags( WidgetFlags.DRAGGABLE );
699 else
700 w.ClearFlags( WidgetFlags.DRAGGABLE );
701 }
702 }
703
705 {
707 {
708 m_TooltipWidget.Show( true );
709 }
710 }
711
718
719 static int GetChosenCombinationFlag( EntityAI selectedEntity, EntityAI targetEntity, int relevantFlags, out InventoryLocation dst = null)
720 {
721 PlayerBase player = PlayerBase.Cast( g_Game.GetPlayer() );
722
723 if (!selectedEntity || !targetEntity)
725
726 ItemBase selectedItem = ItemBase.Cast(selectedEntity);
727 ItemBase targetItem = ItemBase.Cast(targetEntity);
728
729 //EntityAI itemInHands = m_player.GetEntityInHands();
730 ActionManagerClient amc = ActionManagerClient.Cast(player.GetActionManager());
731
732 if (relevantFlags & InventoryCombinationFlags.PERFORM_ACTION)
733 {
734 if (amc.CanPerformActionFromInventory(targetItem, selectedItem))
736 }
737
738 if (relevantFlags & InventoryCombinationFlags.SET_ACTION)
739 {
740 if (amc.CanSetActionFromInventory(targetItem, selectedItem))
742 }
743
745 {
746 if (targetEntity.CanBeCombined(selectedEntity))
747 {
749 }
750 }
751
753 {
754 if (targetEntity.GetInventory().CanAddAttachment(selectedEntity))
755 {
757 }
758 }
759
760 if (relevantFlags & InventoryCombinationFlags.ADD_AS_CARGO)
761 {
762 if (!targetEntity.GetInventory().HasEntityInInventory(selectedEntity) && targetEntity.GetInventory().CanAddEntityInCargo( selectedEntity, selectedEntity.GetInventory().GetFlipCargo() ))
763 {
765 }
766 }
767
768 if (relevantFlags & InventoryCombinationFlags.SWAP_MAGAZINE)
769 {
770 Magazine mag = Magazine.Cast(targetEntity);
771 Weapon_Base wpn = Weapon_Base.Cast(targetEntity.GetHierarchyParent());
772 if (wpn && mag)
773 {
774 if (player.GetWeaponManager().CanSwapMagazine(wpn, Magazine.Cast(selectedEntity)))
775 {
777 }
778 }
779 }
780
781 if (relevantFlags & InventoryCombinationFlags.SWAP)
782 {
783 if (GameInventory.CanSwapEntitiesEx(selectedEntity, targetEntity))
784 {
786 }
787 }
788
789 if (relevantFlags & InventoryCombinationFlags.FSWAP)
790 {
791 if (GameInventory.CanForceSwapEntitiesEx(selectedEntity, null, targetEntity, dst))
792 {
794 }
795 }
796
798 }
799
800 static int GetCombinationFlags( EntityAI entity1, EntityAI entity2 )
801 {
802 int flags = 0;
803 PlayerBase player = PlayerBase.Cast( g_Game.GetPlayer() );
804
805 if (!entity1 || !entity2)
806 return flags;
807
808 if (entity1.IsInherited( ItemBase ) && entity2.IsInherited( ItemBase ))
809 {
810 ItemBase ent1 = ItemBase.Cast( entity1 );
811 if (ent1.CanBeCombined( ItemBase.Cast( entity2 ) ))
813 }
814
816
817 entity1.GetInventory().FindFreeLocationFor( entity2, FindInventoryLocationType.ATTACHMENT, il );
818
819 if (il.IsValid() && !entity1.GetInventory().FindAttachment(il.GetSlot()))
820 {
821 if (!entity1.IsInherited( ZombieBase ) && !entity1.IsInherited( Car ) && !entity2.IsInherited( ZombieBase ) && !entity2.IsInherited( Car ))
822 {
824 }
825 }
826 if (!entity1.GetInventory().HasEntityInInventory(entity2) && entity1.GetInventory().CanAddEntityInCargo( entity2, entity2.GetInventory().GetFlipCargo() )) flags = flags | InventoryCombinationFlags.ADD_AS_CARGO;
827
828 if (entity1 == player.GetEntityInHands() || entity2 == player.GetEntityInHands())
829 {
831 Class.CastTo(amc, player.GetActionManager());
832 if (entity1 == player.GetEntityInHands())
833 {
834 if (amc.CanPerformActionFromInventory( ItemBase.Cast(entity1), ItemBase.Cast(entity2) ))
835 {
837 }
838 else if (amc.CanSetActionFromInventory( ItemBase.Cast(entity1), ItemBase.Cast(entity2) ))
839 {
841 }
842 }
843 else
844 {
845 if (amc.CanPerformActionFromInventory( ItemBase.Cast(entity2), ItemBase.Cast(entity1) ))
846 {
848 }
849 else if (amc.CanSetActionFromInventory( ItemBase.Cast(entity2), ItemBase.Cast(entity1) ))
850 {
852 }
853 }
854 }
855 return flags;
856 }
857
858 static int GetRecipeCount(bool recipe_anywhere, EntityAI entity1, EntityAI entity2)
859 {
860 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(GetPlugin( PluginRecipesManager ));
861 return plugin_recipes_manager.GetValidRecipes( ItemBase.Cast( entity1 ), ItemBase.Cast( entity2 ), NULL, PlayerBase.Cast( g_Game.GetPlayer() ) );
862 }
863
864 ScrollWidget GetLeftSlotsScroller()
865 {
867 m_LeftSlotsScroller = ScrollWidget.Cast(m_RootWidget.FindAnyWidget("LeftPanel").FindAnyWidget("ScrollerSlotsContent"));
868
869 return m_LeftSlotsScroller;
870 }
871}
void Inventory(LayoutHolder parent)
Definition inventory.c:74
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
bool CanSetActionFromInventory(ItemBase mainItem, ItemBase targetItem)
bool CanPerformActionFromInventory(ItemBase mainItem, ItemBase targetItem)
Base script class for cars.
Definition carscript.c:171
Super root of all classes in Enforce script.
Definition enscript.c:11
Definition colors.c:4
const int COLOR_BADLY_DAMAGED
Definition colors.c:21
const int COLOR_PRISTINE
Definition colors.c:24
const int COLOR_WORN
Definition colors.c:23
const int COLOR_DAMAGED
Definition colors.c:22
const int COLOR_RUINED
Definition colors.c:20
script counterpart to engine's class Inventory
Definition inventory.c:81
static bool CanForceSwapEntitiesEx(notnull EntityAI item1, InventoryLocation item1_dst, notnull EntityAI item2, out InventoryLocation item2_dst)
Definition inventory.c:666
static bool CanSwapEntitiesEx(notnull EntityAI item1, notnull EntityAI item2)
Definition inventory.c:630
Definition icon.c:2
Widget GetCursorWidget()
Definition icon.c:88
Widget GetMicromanagedPanel()
Definition icon.c:93
InventoryLocation.
proto native int GetSlot()
returns slot id if current type is Attachment
proto native bool IsValid()
verify current set inventory location
proto native int GetType()
returns type of InventoryLocation
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
Definition rag.c:61
Widget GetCenterDropzone()
EntityAI GetSelectedItem()
Definition itemmanager.c:85
ref Widget m_TooltipSlotWidget
Definition itemmanager.c:10
int m_TooltipPosX
Definition itemmanager.c:34
void SetDraggedIcon(Icon dragged_icon)
void PrepareTooltip(EntityAI item, int x=0, int y=0)
bool IsMicromanagmentMode()
Definition itemmanager.c:70
HandsPreview GetHandsPreview()
Definition itemmanager.c:75
void SerializeDefaultOpenStates()
Icon GetDraggedIcon()
Widget GetSelectedWidget()
Definition itemmanager.c:95
void ShowSourceDropzone(EntityAI item)
void DeserializeDefaultOpenStates()
Widget m_LeftDropzone
Definition itemmanager.c:30
bool m_SlotInfoShown
Definition itemmanager.c:6
int m_TooltipPosY
Definition itemmanager.c:35
static ref ItemManager m_Instance
Definition itemmanager.c:3
bool GetDefaultOpenStateHands()
Container GetSelectedContainer()
Definition itemmanager.c:90
void UpdateTooltipSlotPosition()
static int GetCombinationFlags(EntityAI entity1, EntityAI entity2)
Widget GetLeftDropzone()
static int GetItemHealthColor(EntityAI item, string zone="")
Widget m_TooltipSourceWidget
Definition itemmanager.c:36
void ClearDefaultOpenStates()
void SetWidgetDraggable(Widget w, bool draggable)
const float TOOLTIP_DELAY
Definition itemmanager.c:40
ItemPreviewWidget m_ItemPreviewWidget
Definition itemmanager.c:12
void HideDropzones()
int m_HandsDefaultOpenState
Definition itemmanager.c:16
Widget m_RightDropzone
Definition itemmanager.c:32
bool m_ItemMicromanagmentMode
Definition itemmanager.c:28
bool GetDefaultOpenState(string type)
ref Timer m_TooltipSlotTimer
Definition itemmanager.c:18
static int ColorFromFloat(float fraction)
void HideTooltipSlot()
static int GetItemHealthColor(int pHealthLevel)
void SetDefaultHeaderOpenState(string type, bool is_opened)
bool IsDragging()
void SetTemperature(EntityAI item, Widget item_w)
void DeserializeDefaultHeaderOpenStates()
void ClearDefaultHeaderOpenStates()
void ShowTooltipSlot()
ref Widget m_TooltipCategoryWidget
Definition itemmanager.c:11
LayoutHolder m_SelectedBaseIcon
Definition itemmanager.c:24
ScrollWidget GetLeftSlotsScroller()
void SetItemMicromanagmentMode(bool item_micromanagment_mode)
Definition itemmanager.c:64
static int GetRecipeCount(bool recipe_anywhere, EntityAI entity1, EntityAI entity2)
void SetDraggedItem(EntityAI dragged_item)
bool m_IsDragging
Definition itemmanager.c:4
ref Widget m_TooltipWidget
Definition itemmanager.c:9
void SetSelectedItemEx(EntityAI selected_item, Container selected_container, LayoutHolder selected_icon)
bool EvaluateContainerDragabilityDefault(EntityAI entity)
static int GetChosenCombinationFlag(EntityAI selectedEntity, EntityAI targetEntity, int relevantFlags, out InventoryLocation dst=null)
void SetHandsPreview(HandsPreview hansd_preview)
Definition itemmanager.c:80
void PrepareSlotsTooltip(string name, string desc, int x=0, int y=0)
position is currentlycalculated from the owning 'm_TooltipSourceWidget' directly
void SetIconTemperature(EntityAI item, Widget item_w)
void SetDefaultOpenState(string type, bool is_opened)
HandsPreview m_HandsPreview
Definition itemmanager.c:26
Widget m_CenterDropzone
Definition itemmanager.c:31
EntityAI m_DraggedItem
Definition itemmanager.c:7
void SetSelectedItem(EntityAI selected_item, Container selected_container, Widget selected_widget, SlotsIcon selected_icon)
Widget GetRightDropzone()
void CalculateTooltipSlotPosition(int x=0, int y=0)
bool GetDefaultHeaderOpenState(string type)
Widget m_SelectedWidget
Definition itemmanager.c:22
EntityAI GetHoveredItem()
void ShowTooltip()
void SerializeDefaultHeaderOpenStates()
void HideTooltip()
ref Timer m_ToolTipTimer
Definition itemmanager.c:17
void ItemManager(Widget root)
Definition itemmanager.c:45
ref map< string, bool > m_DefautOpenStates
Definition itemmanager.c:14
void SetTooltipWidget(Widget w)
void SetDefaultOpenStateHands(bool is_opened)
EntityAI m_SelectedItem
Definition itemmanager.c:20
ScrollWidget m_LeftSlotsScroller
Definition itemmanager.c:37
void SetIsDragging(bool is_dragging)
Icon m_DraggedIcon
Definition itemmanager.c:8
SlotsIcon m_SelectedIcon
Definition itemmanager.c:23
EntityAI m_HoveredItem
Definition itemmanager.c:5
SlotsIcon GetSelectedIcon()
Container m_SelectedContainer
Definition itemmanager.c:21
Widget m_RootWidget
Definition itemmanager.c:13
static ItemManager GetInstance()
ref map< string, bool > m_DefautHeaderOpenStates
Definition itemmanager.c:15
EntityAI GetDraggedItem()
static int GetNormalWidth()
Definition slotsicon.c:875
static int GetNormalHeight()
Definition slotsicon.c:880
Widget GetCursorWidget()
Definition slotsicon.c:210
Widget GetMicromanagedPanel()
Definition slotsicon.c:255
DayZGame g_Game
Definition dayzgame.c:3942
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
array< string > TStringArray
Definition enscript.c:712
const int STATE_RUINED
Definition constants.c:851
const int STATE_BADLY_DAMAGED
Definition constants.c:852
const int STATE_DAMAGED
Definition constants.c:853
const int STATE_PRISTINE
Definition constants.c:855
const int STATE_WORN
Definition constants.c:854
proto void GetScreenSize(out int x, out int y)
proto void GetMousePos(out int x, out int y)
proto native int ToInt()
Converts string to integer.
WidgetFlags
Definition enwidgets.c:58
Icon x
Icon y
FindInventoryLocationType
flags for searching locations in inventory
InventoryLocationType
types of Inventory Location
PluginBase GetPlugin(typename plugin_type)