DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
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
24
26
28
32
33 protected int m_TooltipPosX;
34 protected int m_TooltipPosY;
35 protected Widget m_TooltipSourceWidget; //stored here for tooltip position updates
36
37 #ifndef PLATFORM_CONSOLE
38 protected const float TOOLTIP_DELAY = 0.25; // in seconds
39 #else
40 protected const float TOOLTIP_DELAY = 1.5; // in seconds
41 #endif
42
43 void ItemManager( Widget root )
44 {
45 m_Instance = this;
46 m_RootWidget = root;
49 m_SlotInfoShown = false;
50
51 #ifdef PLATFORM_CONSOLE
52 m_TooltipWidget = GetGame().GetWorkspace().CreateWidgets("gui/layouts/inventory_new/day_z_inventory_new_tooltip_xbox.layout", root );
53 m_TooltipSlotWidget = GetGame().GetWorkspace().CreateWidgets("gui/layouts/inventory_new/day_z_inventory_new_tooltip_slot_xbox.layout", root );
54 #else
55 m_TooltipWidget = GetGame().GetWorkspace().CreateWidgets("gui/layouts/inventory_new/day_z_inventory_new_tooltip.layout", root );
56 m_TooltipSlotWidget = GetGame().GetWorkspace().CreateWidgets("gui/layouts/inventory_new/day_z_inventory_new_tooltip_slot.layout", root );
57 #endif
58 m_TooltipWidget.Show( false );
59 m_TooltipSlotWidget.Show( false );
60 }
61
62 void SetItemMicromanagmentMode( bool item_micromanagment_mode )
63 {
64 m_ItemMicromanagmentMode = item_micromanagment_mode;
65 }
66
68 {
70 }
71
73 {
74 return m_HandsPreview;
75 }
76
77 void SetHandsPreview( HandsPreview hansd_preview )
78 {
79 m_HandsPreview = hansd_preview;
80 }
81
83 {
84 return m_SelectedItem;
85 }
86
88 {
89 return m_SelectedContainer;
90 }
91
93 {
94 return m_SelectedWidget;
95 }
96
98 {
99 return m_SelectedIcon;
100 }
101
102 void SetSelectedItem( EntityAI selected_item, Container selected_container, Widget selected_widget, SlotsIcon selected_icon )
103 {
104 m_SelectedItem = selected_item;
105 m_SelectedContainer = selected_container;
106 m_SelectedWidget = selected_widget;
107 m_SelectedIcon = selected_icon;
108 }
109
111 {
112 m_DefautOpenStates.Clear();
113 }
114
116 {
118 }
119
120 void SetDefaultOpenState( string type, bool is_opened )
121 {
122 m_DefautOpenStates.Set( type, is_opened );
123 }
124
125 void SetDefaultHeaderOpenState( string type, bool is_opened )
126 {
127 m_DefautHeaderOpenStates.Set( type, is_opened );
128 }
129
130 void SetDefaultOpenStateHands( bool is_opened )
131 {
132 m_HandsDefaultOpenState = is_opened;
133 int hands_default_open_state = m_HandsDefaultOpenState; //from bool to int for easier parsing
134 GetGame().SetProfileString( "defaultOpenStateHands", hands_default_open_state.ToString() );
136 }
137
139 {
140 string value;
141 GetGame().GetProfileString( "defaultOpenStateHands", value );
144 }
145
147 {
148 TStringArray serialized_types = new TStringArray;
149
150 for ( int i = 0; i < m_DefautHeaderOpenStates.Count(); i++ )
151 {
152 int is_opened = m_DefautHeaderOpenStates.GetElement( i ); //from bool to int for easier parsing
153 serialized_types.Insert( m_DefautHeaderOpenStates.GetKey( i ) + "," + is_opened );
154 }
155
156 if( serialized_types.Count() > 0 )
157 {
158 GetGame().SetProfileStringList( "defaultHeaderOpenStates", serialized_types );
159 }
161 }
162
164 {
166
167 TStringArray serialized_types = new TStringArray;
168 GetGame().GetProfileStringList( "defaultHeaderOpenStates", serialized_types );
169
170 for( int i = 0; i < serialized_types.Count(); i++ )
171 {
172 TStringArray strs = new TStringArray;
173 serialized_types.Get( i ).Split( ",", strs );
174 bool is_opened = strs.Get( 1 ).ToInt();
175 SetDefaultHeaderOpenState( strs.Get( 0 ), is_opened );
176 }
177 }
178
180 {
181 TStringArray serialized_types = new TStringArray;
182
183 for ( int i = 0; i < m_DefautOpenStates.Count(); i++ )
184 {
185 int is_opened = m_DefautOpenStates.GetElement( i ); //from bool to int for easier parsing
186 serialized_types.Insert( m_DefautOpenStates.GetKey( i ) + "," + is_opened );
187 }
188
189 if( serialized_types.Count() > 0 )
190 {
191 GetGame().SetProfileStringList( "defaultOpenStates", serialized_types );
192 }
194 }
195
197 {
199
200 TStringArray serialized_types = new TStringArray;
201 GetGame().GetProfileStringList( "defaultOpenStates", serialized_types );
202
203 for( int i = 0; i < serialized_types.Count(); i++ )
204 {
205 TStringArray strs = new TStringArray;
206 serialized_types.Get( i ).Split( ",", strs );
207 bool is_opened = strs.Get( 1 ).ToInt();
208 SetDefaultOpenState( strs.Get( 0 ), is_opened );
209 }
210 }
211
212 bool GetDefaultOpenState( string type )
213 {
214 if( m_DefautOpenStates.Contains( type ) )
215 {
216 return m_DefautOpenStates.Get( type );
217 }
218 else
219 {
220 return true;
221 }
222 }
223
224 bool GetDefaultHeaderOpenState( string type )
225 {
226 if( m_DefautHeaderOpenStates.Contains( type ) )
227 {
228 return m_DefautHeaderOpenStates.Get( type );
229 }
230 else
231 {
232 return true;
233 }
234 }
235
237 {
238 return m_Instance;
239 }
240
242 {
243 GetRightDropzone().SetAlpha( 0 );
244 GetLeftDropzone().SetAlpha( 0 );
245 GetCenterDropzone().SetAlpha( 0 );
246 }
247
249 {
250 EntityAI owner = item.GetHierarchyParent();
251 if( owner && owner != GetGame().GetPlayer() )
252 {
253 ShowSourceDropzone( owner );
254 }
255 else
256 {
257 InventoryLocation inv_loc_src = new InventoryLocation;
258 item.GetInventory().GetCurrentInventoryLocation( inv_loc_src );
259 int loc_type = inv_loc_src.GetType();
261 if( loc_type == InventoryLocationType.GROUND )
262 {
263 GetLeftDropzone().SetAlpha( 1 );
264 }
265 else if( loc_type == InventoryLocationType.HANDS )
266 {
267 GetCenterDropzone().SetAlpha( 1 );
268 }
269 else
270 {
271 GetRightDropzone().SetAlpha( 1 );
272 }
273 }
274 }
275
277 {
278 if( !m_LeftDropzone )
279 m_LeftDropzone = m_RootWidget.FindAnyWidget( "LeftPanel" ).FindAnyWidget( "DropzoneX" );
280
281 return m_LeftDropzone;
282 }
283
285 {
286 if( !m_RightDropzone )
287 m_RightDropzone = m_RootWidget.FindAnyWidget( "RightPanel" ).FindAnyWidget( "DropzoneX" );
288 return m_RightDropzone;
289 }
290
292 {
293 if( !m_CenterDropzone )
294 m_CenterDropzone = m_RootWidget.FindAnyWidget( "HandsPanel" ).FindAnyWidget( "DropzoneX" );
295 return m_CenterDropzone;
296 }
297
299 {
300 return m_HoveredItem;
301 }
302
303 void SetDraggedItem( EntityAI dragged_item )
304 {
305 m_DraggedItem = dragged_item;
306 }
307
309 {
310 return m_DraggedItem;
311 }
312
313 void SetDraggedIcon( Icon dragged_icon )
314 {
315 m_DraggedIcon = dragged_icon;
316 }
317
319 {
320 return m_DraggedIcon;
321 }
322
323 void SetIsDragging( bool is_dragging )
324 {
325 m_IsDragging = is_dragging;
326 if( !is_dragging )
327 {
328 SetDraggedItem( null );
329 SetDraggedIcon( null );
330 }
331 }
332
334 {
335 return m_IsDragging;
336 }
337
339 {
340 m_TooltipWidget.Show( false );
341 m_HoveredItem = null;
342 delete m_ToolTipTimer;
343
345 }
346
348 {
349 if ( m_SlotInfoShown )
350 {
351 m_TooltipSlotWidget.Show( false );
352 m_SlotInfoShown = false;
353 delete m_TooltipSlotTimer;
354 }
355 }
356
357 static int GetItemHealthColor(int pHealthLevel)
358 {
359 switch (pHealthLevel)
360 {
361 case -1:
362 break;
364 return Colors.COLOR_PRISTINE;
366 return Colors.COLOR_WORN;
368 return Colors.COLOR_DAMAGED;
372 return Colors.COLOR_RUINED;
373 }
374
375 return 0x00FFFFFF;
376 }
377
378 static int GetItemHealthColor(EntityAI item, string zone = "")
379 {
380 if (item)
381 {
382 switch (item.GetHealthLevel(zone))
383 {
384 case -1:
385 break;
387 return Colors.COLOR_PRISTINE;
389 return Colors.COLOR_WORN;
391 return Colors.COLOR_DAMAGED;
395 return Colors.COLOR_RUINED;
396 }
397 }
398
399 return 0x00FFFFFF;
400 }
401
402 static int ColorFromFloat( float fraction )
403 {
404 if( fraction > 1 || fraction < 0 )
405 return 0x00FFFFFF;
406 else if( fraction > 0.80 )
407 return Colors.COLOR_PRISTINE;
408 else if( fraction > 0.6 )
409 return Colors.COLOR_WORN;
410 else if( fraction > 0.4 )
411 return Colors.COLOR_DAMAGED;
412 else if( fraction > 0.2 )
414 else
415 return Colors.COLOR_RUINED;
416 }
417
418 void SetTemperature(EntityAI item, Widget item_w)
419 {
420 if ( item_w )
421 {
422 if ( true/*show_temperature */ )
423 {
424 if ( item && item.IsInherited( ItemBase ) )
425 {
426 int color = ColorManager.GetInstance().GetItemColor( ItemBase.Cast( item ) ); // !!!!!
427 if ( color )
428 {
429 string name = item_w.GetName();
430 name.Replace("Render", "Temperature");
431 Widget temperature_widget = item_w.GetParent().FindAnyWidget( name );
432 if ( color != -1 )
433 {
434 temperature_widget.Show( true );
435 temperature_widget.SetColor( color );
436 }
437 else
438 {
439 temperature_widget.Show( false );
440 }
441
442 temperature_widget.SetAlpha( 0.3 );
443 }
444 }
445 }
446 }
447 }
448
450 {
451 if ( item_w )
452 {
453 if ( item && item.IsInherited( ItemBase ) )
454 {
455 int color = ColorManager.GetInstance().GetItemColor( ItemBase.Cast( item ) );
456
457 if ( color )
458 {
459 Widget color_widget = item_w.FindAnyWidget( "Color" );
460 if( color != -1 )
461 {
462 color_widget.SetColor( color );
463 }
464 else
465 {
466 color_widget.SetColor( ColorManager.BASE_COLOR );
467 }
468 }
469 }
470 }
471 }
472
473 void PrepareTooltip(EntityAI item, int x = 0, int y = 0)
474 {
475 if( IsDragging() || !item )
476 {
477 return;
478 }
479
480 if ( item.IsInherited( InventoryItem ) )
481 {
482 HideTooltip();
483
484 m_HoveredItem = item;
485 InspectMenuNew.UpdateItemInfo( m_TooltipWidget, item );
486
487 int screen_w, screen_h;
488 float w, h;
489 GetScreenSize(screen_w, screen_h);
490 m_TooltipWidget.GetScreenSize(w,h);
491
492 if (x == -1)//set by icon focusing
493 {
494 x = screen_w/2 - w/2;
495 float x1,y1;
496 m_RootWidget.FindAnyWidget("InventoryFrameWidget").GetScreenPos(x1,y1); //allign to the same height
497 y = y1;
498 }
499 else if (x == 0 && y == 0 && GetGame().GetInput().IsEnabledMouseAndKeyboardEvenOnServer())
500 {
501 GetMousePos(x,y);
502 }
503
504 //minimal edge distance adjustments..
505 screen_w -= 10;
506 screen_h -= 10;
507
508 int rightEdge = x + w;
509 if (rightEdge > screen_w)
510 {
511 x = screen_w - w;
512 }
513
514 int bottomEdge = y + h;
515 if (bottomEdge > screen_h)
516 {
517 y = screen_h - h;
518 }
519
520 m_TooltipWidget.SetPos(x, y);
521
522 m_ToolTipTimer = new Timer();
523 m_ToolTipTimer.Run( TOOLTIP_DELAY, this, "ShowTooltip" );
524
525 Widget preview_frame = m_TooltipWidget.FindAnyWidget("ItemFrameWidget");
526 if (preview_frame)
527 {
528 m_ItemPreviewWidget = ItemPreviewWidget.Cast( preview_frame );
530 m_ItemPreviewWidget.SetView( item.GetViewIndex() );
531 }
532 }
533 }
534
536 void PrepareSlotsTooltip(string name, string desc, int x = 0, int y = 0)
537 {
538 InspectMenuNew.UpdateSlotInfo( m_TooltipSlotWidget, name, desc );
539
540 HideTooltip();
541
542 if (name != "")
543 {
544 m_SlotInfoShown = true;
545 //CalculateTooltipSlotPosition(x,y);
547 m_TooltipSlotTimer.Run( TOOLTIP_DELAY, this, "ShowTooltipSlot" );
548 }
549 }
550
551 void CalculateTooltipSlotPosition(int x = 0, int y = 0)
552 {
553 int screen_w, screen_h;
554 float w, h;
555 GetScreenSize(screen_w, screen_h);
556 //m_TooltipSlotWidget.GetScreenSize(w,h);
557 m_TooltipSlotWidget.GetSize(w,h);
558 int slot_normal_w = SlotsIcon.GetNormalWidth();
559 int slot_normal_h = SlotsIcon.GetNormalHeight();
560 //minimal edge distance adjustments..
561 screen_w -= 10;
562 screen_h -= 10;
563
564#ifndef PLATFORM_CONSOLE
565 x += 5;
566 y += slot_normal_h + 5;
567#else
568 x += 5;
569 y += 15;
570#endif
571 Widget scrollerWidget = m_TooltipSourceWidget.GetParent();
572 while (scrollerWidget)
573 {
574 if (ScrollWidget.Cast(scrollerWidget))
575 {
576 break;
577 }
578 else
579 {
580 scrollerWidget = scrollerWidget.GetParent();
581 }
582 }
583
584 int rightEdge = x + w;
585 if (rightEdge > screen_w)
586 {
587 x = screen_w - w;
588 }
589
590 int bottomEdge = y + h;
591 if (scrollerWidget)
592 {
593 float scrollerX, scrollerY, scrollerSizeX, scrollerSizeY;
594 scrollerWidget.GetScreenPos(scrollerX,scrollerY);
595 scrollerWidget.GetScreenSize(scrollerSizeX,scrollerSizeY);
596
597 int scroller_bottom = scrollerY + scrollerSizeY;
598 if (bottomEdge > scroller_bottom)
599 {
600 y = scroller_bottom - slot_normal_h;
601 bottomEdge = y + h;
602 }
603 }
604 /*else
605 {
606 ErrorEx("No scroller widget! | m_TooltipSourceWidget: " + m_TooltipSourceWidget);
607 }*/
608
609 if (bottomEdge > screen_h) //should mostly never proc now
610 {
611 y = screen_h - h;
612 }
613
616 }
617
619 {
620 float x, y;
621 m_TooltipSourceWidget.GetScreenPos(x,y);
623 }
624
626 {
628 }
629
631 {
632 if ( !ItemBase.Cast( entity ) )
633 return false;
634
635 bool draggable;
636 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
637 draggable = !player.GetInventory().HasInventoryReservation( entity, null ) && !player.IsItemsToDelete();
638 draggable = draggable && entity.CanPutIntoHands( GetGame().GetPlayer() );
639 draggable = draggable && entity.GetInventory().CanRemoveEntity();
640
641 return draggable;
642 }
643
644 void SetWidgetDraggable( Widget w, bool draggable )
645 {
646 if (w)
647 {
648 if ( draggable )
649 w.SetFlags( WidgetFlags.DRAGGABLE );
650 else
651 w.ClearFlags( WidgetFlags.DRAGGABLE );
652 }
653 }
654
656 {
658 {
659 m_TooltipWidget.Show( true );
660 }
661 }
662
664 {
667 m_TooltipSlotWidget.Show( true );
668 }
669
670 static int GetCombinationFlags( EntityAI entity1, EntityAI entity2 )
671 {
672 int flags = 0;
674
675 if( !entity1 || !entity2 )
676 return flags;
677
678 if( entity1.IsInherited( ItemBase ) && entity2.IsInherited( ItemBase ) )
679 {
680 ItemBase ent1 = ItemBase.Cast( entity1 );
681 if( ent1.CanBeCombined( ItemBase.Cast( entity2 ) ) ) flags = flags | InventoryCombinationFlags.COMBINE_QUANTITY2;
682 }
683
684 Weapon_Base wpn;
685 Magazine mag;
686 if( Class.CastTo(wpn, entity1 ) && Class.CastTo(mag, entity2 ) )
687 {
688
689 }
690 else if( entity1.GetInventory().CanAddAttachment( entity2 ) )
691 {
692 if( !entity1.IsInherited( ZombieBase ) && !entity1.IsInherited( Car ) && !entity2.IsInherited( ZombieBase ) && !entity2.IsInherited( Car ) )
693 {
695 }
696 }
697 if( entity1.GetInventory().CanAddEntityInCargo( entity2, entity2.GetInventory().GetFlipCargo() ) ) flags = flags | InventoryCombinationFlags.ADD_AS_CARGO;
698
699 if( entity1 == m_player.GetHumanInventory().GetEntityInHands() || entity2 == m_player.GetHumanInventory().GetEntityInHands())
700 {
702 Class.CastTo(amc, m_player.GetActionManager());
703 if( entity1 == m_player.GetHumanInventory().GetEntityInHands() )
704 {
705 if( amc.CanPerformActionFromInventory( ItemBase.Cast( entity1 ), ItemBase.Cast( entity2 ) ) )
706 {
708 }
709 else if( amc.CanSetActionFromInventory( ItemBase.Cast( entity1 ), ItemBase.Cast( entity2 ) ) )
710 {
712 }
713 }
714 else
715 {
716 if( amc.CanPerformActionFromInventory( ItemBase.Cast( entity2 ), ItemBase.Cast( entity1 ) ) )
717 {
719 }
720 else if( amc.CanSetActionFromInventory( ItemBase.Cast( entity2 ), ItemBase.Cast( entity1 ) ) )
721 {
723 }
724 }
725 }
726
727 if( GetRecipeCount( true, entity1, entity2 ) > 0 )
728 {
730 }
731 return flags;
732 }
733
734 static int GetRecipeCount( bool recipe_anywhere, EntityAI entity1, EntityAI entity2 )
735 {
736 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast( GetPlugin( PluginRecipesManager ) );
737 return plugin_recipes_manager.GetValidRecipes( ItemBase.Cast( entity1 ), ItemBase.Cast( entity2 ), NULL, PlayerBase.Cast( GetGame().GetPlayer() ) );
738 }
739}
ActionInput GetInput()
Icon x
Icon y
InventoryLocationType
types of Inventory Location
PlayerBase GetPlayer()
string name
PluginBase GetPlugin(typename plugin_type)
DayZPlayer m_player
bool CanSetActionFromInventory(ItemBase mainItem, ItemBase targetItem)
bool CanPerformActionFromInventory(ItemBase mainItem, ItemBase targetItem)
proto native void GetProfileStringList(string name, out TStringArray values)
Gets array of strings from profile variable.
proto native void SetProfileString(string name, string value)
Sets string to profile variable.
proto bool GetProfileString(string name, out string value)
Gets string from profile variable.
proto native WorkspaceWidget GetWorkspace()
proto native void SaveProfile()
Saves profile on disk.
proto native void SetProfileStringList(string name, TStringArray values)
Sets array of strings to profile variable.
Super root of all classes in Enforce script.
Definition EnScript.c:11
static ColorManager GetInstance()
static int BASE_COLOR
int GetItemColor(ItemBase item)
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
Definition Icon.c:2
InventoryLocation.
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:52
Widget GetCenterDropzone()
EntityAI GetSelectedItem()
Definition ItemManager.c:82
protected ref Timer m_TooltipSlotTimer
Definition ItemManager.c:18
protected ref Widget m_TooltipWidget
Definition ItemManager.c:9
void SetDraggedIcon(Icon dragged_icon)
void PrepareTooltip(EntityAI item, int x=0, int y=0)
bool IsMicromanagmentMode()
Definition ItemManager.c:67
HandsPreview GetHandsPreview()
Definition ItemManager.c:72
protected ref Timer m_ToolTipTimer
Definition ItemManager.c:17
protected bool m_SlotInfoShown
Definition ItemManager.c:6
void SerializeDefaultOpenStates()
Icon GetDraggedIcon()
Widget GetSelectedWidget()
Definition ItemManager.c:92
void ShowSourceDropzone(EntityAI item)
void DeserializeDefaultOpenStates()
protected EntityAI m_DraggedItem
Definition ItemManager.c:7
protected Icon m_DraggedIcon
Definition ItemManager.c:8
protected int m_TooltipPosX
Definition ItemManager.c:33
protected bool m_IsDragging
Definition ItemManager.c:4
protected Widget m_CenterDropzone
Definition ItemManager.c:30
protected ref Widget m_TooltipSlotWidget
Definition ItemManager.c:10
bool GetDefaultOpenStateHands()
Container GetSelectedContainer()
Definition ItemManager.c:87
void UpdateTooltipSlotPosition()
static int GetCombinationFlags(EntityAI entity1, EntityAI entity2)
Widget GetLeftDropzone()
static int GetItemHealthColor(EntityAI item, string zone="")
protected int m_HandsDefaultOpenState
Definition ItemManager.c:16
protected Widget m_RightDropzone
Definition ItemManager.c:31
void ClearDefaultOpenStates()
protected Container m_SelectedContainer
Definition ItemManager.c:21
void SetWidgetDraggable(Widget w, bool draggable)
protected SlotsIcon m_SelectedIcon
Definition ItemManager.c:23
protected Widget m_SelectedWidget
Definition ItemManager.c:22
void HideDropzones()
protected ref Widget m_TooltipCategoryWidget
Definition ItemManager.c:11
bool GetDefaultOpenState(string type)
static int ColorFromFloat(float fraction)
void HideTooltipSlot()
static int GetItemHealthColor(int pHealthLevel)
void SetDefaultHeaderOpenState(string type, bool is_opened)
protected Widget m_LeftDropzone
Definition ItemManager.c:29
bool IsDragging()
protected EntityAI m_HoveredItem
Definition ItemManager.c:5
void SetTemperature(EntityAI item, Widget item_w)
void DeserializeDefaultHeaderOpenStates()
void ClearDefaultHeaderOpenStates()
void ShowTooltipSlot()
protected const float TOOLTIP_DELAY
Definition ItemManager.c:38
void SetItemMicromanagmentMode(bool item_micromanagment_mode)
Definition ItemManager.c:62
protected ref map< string, bool > m_DefautOpenStates
Definition ItemManager.c:14
static int GetRecipeCount(bool recipe_anywhere, EntityAI entity1, EntityAI entity2)
void SetDraggedItem(EntityAI dragged_item)
protected bool m_ItemMicromanagmentMode
Definition ItemManager.c:27
protected ref map< string, bool > m_DefautHeaderOpenStates
Definition ItemManager.c:15
protected Widget m_TooltipSourceWidget
Definition ItemManager.c:35
bool EvaluateContainerDragabilityDefault(EntityAI entity)
void SetHandsPreview(HandsPreview hansd_preview)
Definition ItemManager.c:77
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)
private static ref ItemManager m_Instance
Definition ItemManager.c:3
void SetSelectedItem(EntityAI selected_item, Container selected_container, Widget selected_widget, SlotsIcon selected_icon)
Widget GetRightDropzone()
void CalculateTooltipSlotPosition(int x=0, int y=0)
protected HandsPreview m_HandsPreview
Definition ItemManager.c:25
protected ItemPreviewWidget m_ItemPreviewWidget
Definition ItemManager.c:12
bool GetDefaultHeaderOpenState(string type)
EntityAI GetHoveredItem()
void ShowTooltip()
void SerializeDefaultHeaderOpenStates()
void HideTooltip()
void ItemManager(Widget root)
Definition ItemManager.c:43
void SetTooltipWidget(Widget w)
void SetDefaultOpenStateHands(bool is_opened)
protected int m_TooltipPosY
Definition ItemManager.c:34
void SetIsDragging(bool is_dragging)
protected Widget m_RootWidget
Definition ItemManager.c:13
protected EntityAI m_SelectedItem
Definition ItemManager.c:20
SlotsIcon GetSelectedIcon()
Definition ItemManager.c:97
static ItemManager GetInstance()
EntityAI GetDraggedItem()
proto native void SetView(int viewIndex)
proto native void SetItem(EntityAI object)
static int GetNormalWidth()
Definition SlotsIcon.c:753
static int GetNormalHeight()
Definition SlotsIcon.c:758
proto native CGame GetGame()
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:685
const int STATE_RUINED
Definition constants.c:742
const int STATE_BADLY_DAMAGED
Definition constants.c:743
const int STATE_DAMAGED
Definition constants.c:744
const int STATE_PRISTINE
Definition constants.c:746
const int STATE_WORN
Definition constants.c:745
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.
proto int Replace(string sample, string replace)
Replace all occurrances of 'sample' in 'str' by 'replace'.
WidgetFlags
Definition EnWidgets.c:57
proto native external Widget CreateWidgets(string layout, Widget parentWidget=NULL, bool immedUpdate=true)
Create widgets from *.layout file.