2enum ConsoleActionToolbarMask
5 TO_HANDS_SWAP_VICINITY = 1,
6 TO_HANDS_SWAP_INVENTORY = 2,
11 OPEN_CLOSE_CONTAINER = 64,
94 #ifdef PLATFORM_CONSOLE
96 g_Game.GetUIManager().ShowUICursor(
false);
98 GetMainWidget().FindAnyWidget(
"CursorCharacter").Show(
false);
136 Widget leftPanelWidget = GetMainWidget().FindAnyWidget(
"LeftPanel");
139 eventWidget = leftPanelWidget.FindAnyWidget(
"Scroller");
146 #ifndef PLATFORM_CONSOLE
147 eventWidget = leftPanelWidget.FindAnyWidget(
"Header");
154 eventWidget = leftPanelWidget.FindAnyWidget(
"ScrollerSlotsContent");
161 eventWidget = leftPanelWidget.FindAnyWidget(
"SlotsContent");
168 eventWidget = leftPanelWidget.FindAnyWidget(
"SlotsHeader");
178 Widget rightPanelWidget = GetMainWidget().FindAnyWidget(
"RightPanel");
179 if (rightPanelWidget)
181 eventWidget = rightPanelWidget.FindAnyWidget(
"Scroller");
188 #ifndef PLATFORM_CONSOLE
189 eventWidget = rightPanelWidget.FindAnyWidget(
"SlotsContent");
196 eventWidget = rightPanelWidget.FindAnyWidget(
"SlotsHeader");
206 Widget mainWidget = GetMainWidget();
209 eventWidget = mainWidget.FindAnyWidget(
"CharacterPanel");
216 eventWidget = mainWidget.FindAnyWidget(
"HandsPanel");
223 eventWidget = mainWidget.FindAnyWidget(
"LeftBackground");
230 eventWidget = mainWidget.FindAnyWidget(
"RightBackground");
245 for (
int i = 0; i < namesCount; i++)
256 #ifdef PLATFORM_CONSOLE
263 switch (pInputDeviceType)
271 if (
g_Game.GetInput().IsEnabledMouseAndKeyboardEvenOnServer())
300 static int GetPlayerAttachmentIndex(
string slot_name)
302 return m_PlayerAttachmentsIndexes[slot_name];
305 static int GetPlayerAttachmentIndex(
int slot_id)
307 return GetPlayerAttachmentIndex(InventorySlots.GetSlotName(slot_id));
313 string data, errorMessage;
317 if (
g_Game.GetProfileString(
"INV_AttIndexes", data))
319 if (!JsonFileLoader<
map<string, int>>.LoadData(data, m_PlayerAttachmentsIndexes, errorMessage))
323 string configPathGhostSlots =
"CfgVehicles SurvivorBase InventoryEquipment playerSlots";
325 g_Game.ConfigGetTextArray(configPathGhostSlots, playerGhostSlots);
327 foreach (
string slotName : playerGhostSlots)
332 m_PlayerAttachmentsIndexes.Insert(
slotName, m_PlayerAttachmentsIndexes.Count());
336 if (!JsonFileLoader<
map<string, int>>.MakeData(m_PlayerAttachmentsIndexes, data, errorMessage))
339 g_Game.SetProfileString(
"INV_AttIndexes", data);
342 static void MoveAttachmentUp(
int slot_id)
344 int curr = GetPlayerAttachmentIndex(slot_id);
347 string next_item =
"init";
351 while(!next_ent && next_item !=
"")
353 next_item = m_PlayerAttachmentsIndexes.GetKeyByValue(curr + --next_offset);
354 next_id = InventorySlots.GetSlotIdFromString(next_item);
355 next_ent =
g_Game.GetPlayer().GetInventory().FindAttachment(next_id);
356 if (next_ent && !m_Instance.m_RightArea.HasEntityContainerVisible(next_ent))
360 if (next_item !=
"" && next_ent)
362 int next = GetPlayerAttachmentIndex(next_item);
363 m_PlayerAttachmentsIndexes.Set(InventorySlots.GetSlotName(slot_id), next);
364 m_PlayerAttachmentsIndexes.Set(next_item, curr);
366 m_Instance.m_RightArea.SwapItemsInOrder(next_id, slot_id);
370 static void MoveAttachmentDown(
int slot_id)
372 int curr = GetPlayerAttachmentIndex(slot_id);
375 string next_item =
"init";
379 while(!next_ent && next_item !=
"")
381 next_item = m_PlayerAttachmentsIndexes.GetKeyByValue(curr + ++next_offset);
382 next_id = InventorySlots.GetSlotIdFromString(next_item);
383 next_ent =
g_Game.GetPlayer().GetInventory().FindAttachment(next_id);
384 if (next_ent && !m_Instance.m_RightArea.HasEntityContainerVisible(next_ent))
388 if (next_item !=
"" && next_ent)
390 int next = GetPlayerAttachmentIndex(next_item);
391 m_PlayerAttachmentsIndexes.Set(InventorySlots.GetSlotName(slot_id), next);
392 m_PlayerAttachmentsIndexes.Set(next_item, curr);
394 m_Instance.m_RightArea.SwapItemsInOrder(next_id, slot_id);
400 int proper_angle = (360 - angle) % 360;
406 if (angle < 45 || angle > 315)
410 else if (angle < 135 && angle > 45)
414 else if (angle < 225 && angle > 135)
418 else if (angle < 315 && angle > 225)
433 #ifdef PLATFORM_CONSOLE
436 if (control == ControlID.CID_RADIALMENU)
484 string name = w.GetName();
485 name.Replace(
"PanelWidget",
"Render");
517 string name = w.GetName();
518 name.Replace(
"PanelWidget",
"Render");
533 if (!item.GetInventory().CanRemoveEntity())
543 int index = player.GetHumanInventory().FindUserReservedLocationIndex(item);
546 player.GetHumanInventory().GetUserReservedLocation(index, inv_loc);
547 if (player.GetInventory().LocationCanAddEntity(inv_loc))
556 if (player && (player.GetInventory().CanAddAttachment(item)))
558 float stackable = item.GetTargetQuantityMax(-1);
560 if (stackable == 0 || stackable >= item.GetQuantity())
562 player.PredictiveTakeEntityAsAttachment(item);
568 ItemBase.Cast(item).SplitIntoStackMaxToInventoryLocationClient(il);
573 int slot_id = item.GetInventory().GetSlotId(0);
574 EntityAI slot_item = player.GetInventory().FindAttachment(slot_id);
575 if (slot_item && player.GetInventory().CanSwapEntitiesEx(item, slot_item))
577 player.PredictiveSwapEntities(item, slot_item);
579 else if (player.CanReceiveItemIntoCargo(item))
588 CastTo(mngr_client, player.GetActionManager());
590 ActionTarget atrg =
new ActionTarget(item, null, -1,
vector.Zero, -1.0);
622 string name = w.GetName();
623 name.Replace(
"PanelWidget",
"Render");
640 int slot_id = item.GetInventory().GetSlotId(0);
641 EntityAI slot_item = player.GetInventory().FindAttachment(slot_id);
646 int index = player.GetHumanInventory().FindUserReservedLocationIndex(item);
649 player.GetHumanInventory().GetUserReservedLocation(index, inv_loc);
650 if (player.GetInventory().LocationCanAddEntity(inv_loc))
660 if (inv_loc.IsValid())
663 GetMainWidget().FindAnyWidget(
"RightPanel").FindAnyWidget(
"DropzoneX").SetAlpha(1);
664 if (inv_loc.GetType() == 4)
667 GetMainWidget().FindAnyWidget(
"HandsPanel").FindAnyWidget(
"DropzoneX").SetAlpha(1);
687 #ifdef PLATFORM_CONSOLE
693 if (
GetUApi().GetInputByID(UAUIDragNDrop).LocalValue())
698 if (!
GetUApi().GetInputByID(UAUIInventoryTabRight).LocalValue())
710 if (
GetUApi().GetInputByID(UAUIDragNDrop).LocalValue())
715 if (!
GetUApi().GetInputByID(UAUIInventoryTabLeft).LocalValue())
727 if (
GetUApi().GetInputByID(UAUIDragNDrop).LocalValue())
732 if (!
GetUApi().GetInputByID(UAUIInventoryContainerUp).LocalValue())
744 if (
GetUApi().GetInputByID(UAUIDragNDrop).LocalValue())
749 if (!
GetUApi().GetInputByID(UAUIInventoryContainerDown).LocalValue())
772 if (
GetUApi().GetInputByID(UAUIRotateInventory).LocalPress())
778 g_Game.GetInventoryItemSize(item, size_x, size_y);
779 if (size_x != size_y)
781 item.GetInventory().FlipCargo();
782 item.GetOnItemFlipped().Invoke(item.GetInventory().GetFlipCargo());
787 #ifdef PLATFORM_CONSOLE
790 dpi = player.GetDayZPlayerInventory();
793 if (dpi && !dpi.IsProcessing())
795 if (
GetUApi().GetInputByID(UAUIExpandCollapseContainer).LocalPress())
807 if (
GetUApi().GetInputByID(UAUIDragNDrop).LocalHoldBegin())
812 if (
GetUApi().GetInputByID(UAUISplit).LocalPress())
835 if (
GetUApi().GetInputByID(UAUIFastEquip).LocalPress())
877 if (
GetUApi().GetInputByID(UAUIPutInHandsFromVicinity).LocalPress())
891 if (
GetUApi().GetInputByID(UAUIPutInHandsFromInventory).LocalPress())
906 if (
GetUApi().GetInputByID(UAUIFastTransferToVicinity).LocalPress())
911 if (item && item.GetInventory().CanRemoveEntity())
916 if (handsItem && handsItem == item)
929 if (item && item.GetInventory().CanRemoveEntity())
941 if (
GetUApi().GetInputByID(UAUIInspectItem).LocalPress())
968 if (
GetUApi().GetInputByID(UAUIFastTransferItem).LocalPress())
971 if (
GetUApi().GetInputByID(UAUIInspectItem).LocalPress())
974 if (dpi && !dpi.IsProcessing())
981 if (item && item.GetInventory().CanRemoveEntity())
989 if (item && item.GetInventory().CanRemoveEntity())
992 if (
m_HandsArea.TransferItem() && handsItem && handsItem == item)
1007 if (
GetUApi().GetInputByID(UAUIInventoryContainerUp).LocalPress())
1009 if (
GetUApi().GetInputByID(UAUIDragNDrop).LocalValue())
1017 if (
GetUApi().GetInputByID(UAUIInventoryContainerDown).LocalPress())
1019 if (
GetUApi().GetInputByID(UAUIDragNDrop).LocalValue())
1027 if (
GetUApi().GetInputByID(UAUIInventoryTabLeft).LocalPress())
1029 if (
GetUApi().GetInputByID(UAUIDragNDrop).LocalValue())
1037 if (
GetUApi().GetInputByID(UAUIInventoryTabRight).LocalPress())
1039 if (
GetUApi().GetInputByID(UAUIDragNDrop).LocalValue())
1048 if (
GetUApi().GetInputByID(UAUIQuickbarRadialInventoryOpen).LocalPress())
1057 m_HandsArea.AddItemToQuickbarRadial(item_to_assign);
1062 m_RightArea.AddItemToQuickbarRadial(item_to_assign);
1067 MissionGameplay
mission = MissionGameplay.Cast(
g_Game.GetMission());
1070 if (GetMainWidget().IsVisible())
1072 #ifdef PLATFORM_CONSOLE
1104 for (
int i = 0; i < 10; i++)
1126 #ifdef PLATFORM_CONSOLE
1127 UpdateConsoleToolbarCheck();
1135 if (item && item.GetInventory().CanRemoveEntity())
1137 player.SetQuickBarEntityShortcut(item, index) ;
1143 menu.RefreshQuickbar();
1183 #ifdef PLATFORM_CONSOLE
1218 #ifdef PLATFORM_CONSOLE
1236 SetFocus(GetMainWidget());
1240 if (player && player.IsPlacingLocal())
1248 IngameHud hud = IngameHud.Cast(
mission.GetHud());
1251 hud.ShowQuickbarUI(
false);
1252 hud.ShowHudInventory(
true);
1273 IngameHud hud = IngameHud.Cast(
mission.GetHud());
1276 hud.ShowQuickbarUI(
true);
1277 hud.ShowHudInventory(
false);
1296 #ifndef PLATFORM_CONSOLE
1302 #ifndef PLATFORM_CONSOLE
1305 if (
m_Quickbar &&
g_Game.GetInput().IsEnabledMouseAndKeyboardEvenOnServer())
1313 #ifdef PLATFORM_CONSOLE
1314 protected string GetConsoleToolbarText(
int mask)
1318 string toHandsSwapVicinity =
string.Format(
" %1", InputUtils.GetRichtextButtonIconFromInputAction(
"UAUIPutInHandsFromVicinity",
GetStringVariant(
"UAUIPutInHandsFromVicinity",{
"#STR_Controls_TakeInHandsSwap",
"#STR_USRACT_HoldToHandSwap",
""}), EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
1319 string toHandsSwapInv =
string.Format(
" %1", InputUtils.GetRichtextButtonIconFromInputAction(
"UAUIPutInHandsFromInventory",
GetStringVariant(
"UAUIPutInHandsFromInventory",{
"#STR_Controls_TakeInHandsSwap",
"#STR_USRACT_HoldToHandSwap",
""}), EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
1320 string drop =
string.Format(
" %1", InputUtils.GetRichtextButtonIconFromInputAction(
"UAUIFastTransferToVicinity",
"#dayz_context_menu_drop", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
1321 string equip =
string.Format(
" %1", InputUtils.GetRichtextButtonIconFromInputAction(
"UAUIFastEquip",
"#dayz_context_menu_equip", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
1322 string split =
string.Format(
" %1", InputUtils.GetRichtextButtonIconFromInputAction(
"UAUISplit",
GetStringVariant(
"UAUISplit",{
"#dayz_context_menu_split",
"#STR_Controls_HoldSplit",
""}), EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
1323 string toInventory =
string.Format(
" %1", InputUtils.GetRichtextButtonIconFromInputAction(
"UAUIFastTransferItem",
"#dayz_context_menu_to_inventory", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
1324 string openCloseContainer =
string.Format(
" %1", InputUtils.GetRichtextButtonIconFromInputAction(
"UAUIExpandCollapseContainer",
"#dayz_context_menu_open_close", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
1325 string micromanagment =
string.Format(
" %1", InputUtils.GetRichtextButtonIconFromInputAction(
"UAUIDragNDrop",
"#dayz_context_menu_micro", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
1326 string quickslot =
string.Format(
" %1", InputUtils.GetRichtextButtonIconFromInputAction(
"UAUIQuickbarRadialInventoryOpen",
"#ps4_dayz_context_menu_quickslot", EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
1327 string combine =
string.Format(
" %1", InputUtils.GetRichtextButtonIconFromInputAction(
"UAUICombine",
GetStringVariant(
"UAUICombine",{
"#dayz_context_menu_combine",
"#dayz_context_menu_combine_hold",
""}), EUAINPUT_DEVICE_CONTROLLER, InputUtils.ICON_SCALE_TOOLBAR));
1329 if (mask & ConsoleActionToolbarMask.OPEN_CLOSE_CONTAINER)
1331 result += openCloseContainer;
1333 if (mask & ConsoleActionToolbarMask.TO_HANDS_SWAP_VICINITY)
1335 result += toHandsSwapVicinity;
1337 if (mask & ConsoleActionToolbarMask.TO_HANDS_SWAP_INVENTORY)
1339 result += toHandsSwapInv;
1341 if (mask & ConsoleActionToolbarMask.TO_INVENTORY)
1343 result += toInventory;
1345 if (mask & ConsoleActionToolbarMask.DROP)
1349 if (mask & ConsoleActionToolbarMask.SPLIT)
1353 if (mask & ConsoleActionToolbarMask.EQUIP)
1357 if (mask & ConsoleActionToolbarMask.COMBINE)
1361 if (mask & ConsoleActionToolbarMask.MICROMANAGMENT)
1363 result += micromanagment;
1365 if (mask & ConsoleActionToolbarMask.QUICKSLOT)
1367 result += quickslot;
1391 #ifdef PLATFORM_CONSOLE
1392 void UpdateConsoleToolbarCheck()
1396 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
1397 if (player.GetInventory().GetAnyInventoryReservationCount() == 0)
1409 #ifdef PLATFORM_CONSOLE
1410 int combinationFlag = 0;
1411 string contextualText;
1420 if (!(focusedItem && focusedItem.IsSetForDeletion()))
1422 if (focusedContainer)
1427 focusedItem.GetInventory().GetCurrentInventoryLocation( il );
1430 bool canBeManipulated =
false;
1440 itemPlayerOwner =
PlayerBase.Cast(focusedItem.GetHierarchyRootPlayer());
1442 focusedItem.GetInventory().GetCurrentInventoryLocation( il );
1444 canBeManipulated = !player.GetInventory().HasInventoryReservation( focusedItem, null ) && !player.GetInventory().IsInventoryLocked() && !player.IsItemsToDelete();
1446 canBeManipulated = canBeManipulated && focusedItem.CanPutIntoHands(null);
1447 canBeManipulated = canBeManipulated && focusedItem.GetInventory().CanRemoveEntity();
1453 canBeManipulated = canBeManipulated && !parent.GetInventory().GetSlotLock( il.GetSlot() );
1456 if (canBeManipulated)
1460 combinationFlag |= ConsoleActionToolbarMask.MICROMANAGMENT;
1463 if (focusedContainer.CanEquipEx(focusedItem))
1465 combinationFlag |= ConsoleActionToolbarMask.EQUIP;
1468 if (player!= null && player == itemPlayerOwner)
1470 if (focusedContainer.CanSwapOrTakeToHandsEx(focusedItem))
1472 combinationFlag |= ConsoleActionToolbarMask.TO_HANDS_SWAP_INVENTORY;
1475 if (focusedContainer.CanDropEx(focusedItem))
1477 combinationFlag |= ConsoleActionToolbarMask.DROP;
1482 if (focusedContainer.CanSwapOrTakeToHandsEx(focusedItem))
1484 combinationFlag |= ConsoleActionToolbarMask.TO_HANDS_SWAP_VICINITY;
1488 if (focusedContainer.CanCombineEx(focusedItem))
1490 combinationFlag |= ConsoleActionToolbarMask.COMBINE;
1493 if (focusedContainer.CanSplitEx(focusedItem))
1495 combinationFlag |= ConsoleActionToolbarMask.SPLIT;
1498 if (focusedArea.CanTakeToInventoryEx(focusedItem))
1500 combinationFlag |= ConsoleActionToolbarMask.TO_INVENTORY;
1505 if (focusedContainer.CanOpenCloseContainerEx(focusedItem))
1507 combinationFlag |= ConsoleActionToolbarMask.OPEN_CLOSE_CONTAINER;
1510 if (player!= null && focusedContainer.CanAddToQuickbarEx(focusedItem))
1512 combinationFlag |= ConsoleActionToolbarMask.QUICKSLOT;
1516 contextualText = GetConsoleToolbarText(combinationFlag);
1518 bool isController = !
g_Game.GetInput().IsEnabledMouseAndKeyboardEvenOnServer() ||
g_Game.GetInput().GetCurrentInputDevice() ==
EInputDeviceType.CONTROLLER;
1538 if (variants.Count() != 3)
1540 ErrorEx(
"wrong array count!");
1545 if (!inp.IsLimited() || inp.IsClickLimit())
1549 if (inp.IsHoldLimit() || inp.IsHoldBeginLimit())
1553 if (inp.IsDoubleClickLimit())
1557 ErrorEx(
"Unhandled limiter exception!");
1629 EntityAI item_in_hands = player.GetItemInHands();
1653 item_in_hands = player.GetItemInHands();
1682 float tickvalue = 0;
1704 tickvalue += timeslice;
void OnInputPresetChanged()
void MoveFocusByContainer(int direction)
Shifts between containers vertically.
Widget m_TopConsoleToolbarHands
bool m_HadFastTransferred
Widget m_SpecializationPanel
bool m_ControllerRightStickTimerEnd
void DraggingOverCenterPanel(Widget w, int x, int y, Widget receiver)
ref InventoryQuickbar m_Quickbar
Widget m_SpecializationIcon
void OnHandsPanelDropReceived(Widget w, int x, int y, Widget receiver)
void DraggingOverHandsPanel(Widget w, int x, int y, Widget receiver)
override void UpdateInterval()
void UpdateSpecialtyMeter()
ref ContextMenu m_ContextMenu
void OnLeftPanelDropReceived(Widget w, int x, int y, Widget receiver)
void InitDragAndDropEvents()
void LoadPlayerAttachmentIndexes()
void AddQuickbarItem(InventoryItem item, int index)
ref array< UAIDWrapper > m_InvInputWrappers
int AngleToDirection(int angle)
enum Direction m_LeftArea
void ResetFocusedContainers()
void OnCenterPanelDropReceived(Widget w, int x, int y, Widget receiver)
ref array< float > m_InvInputTimes
bool m_NeedUpdateConsoleToolbar
void InventoryMovementButtonTickHandler(float timeslice)
float m_SensitivityThreshold
void DraggingOverRightPanel(Widget w, int x, int y, Widget receiver)
Widget m_BottomConsoleToolbar
void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
void UpdateConsoleToolbar()
int GetProperControllerStickAngle(int angle)
int m_InvInputWrappersCount
ref HandsArea m_HandsArea
void Inventory(LayoutHolder parent)
string GetStringVariant(string pInputAction, notnull array< string > variants)
Picks from the strings by active input limiter variant in order: {click,hold,doubleclick}...
ref RightArea m_RightArea
const float BT_REPEAT_DELAY
const float BT_THRESHOLD_VALUE
Widget m_TopConsoleToolbarEquipment
void OnRightPanelDropReceived(Widget w, int x, int y, Widget receiver)
InventoryItem m_QBHoveredItems
ref Timer m_ControllerRightStickTimer
void DisableMicromanagement()
void EnableMicromanagement()
bool Controller(Widget w, int control, int value)
RichTextWidget m_BottomConsoleToolbarRichText
void MoveFocusByArea(int direction)
Shifts between vicinity-hands-player.
const float BT_REPEAT_TIME
override void SetLayoutName()
ref PlayerPreview m_PlayerPreview
Container GetFocusedArea()
Widget m_TopConsoleToolbarVicinity
ref array< string > m_InvInputNames
void DraggingOverLeftPanel(Widget w, int x, int y, Widget receiver)
void InitInputWrapperData()
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
PlayerSpawnPreset slotName
void PerformActionStart(ActionBase action, ActionTarget target, ItemBase item, Param extra_data=NULL)
static bool IsAttachmentReachable(EntityAI e, string att_slot_name="", int slot_id=-1, float range=1.5)
override EntityAI GetFocusedItem()
provides access to slot configuration
void SerializeDefaultHeaderOpenStates()
void SetItemMicromanagmentMode(bool item_micromanagment_mode)
EntityAI GetDraggedItem()
void SetSelectedItemEx(EntityAI selected_item, Container selected_container, LayoutHolder selected_icon)
EntityAI GetHoveredItem()
void ShowSourceDropzone(EntityAI item)
void DeserializeDefaultHeaderOpenStates()
void SerializeDefaultOpenStates()
void DeserializeDefaultOpenStates()
bool IsMicromanagmentMode()
static ItemManager GetInstance()
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
FindInventoryLocationType
flags for searching locations in inventory
InventoryLocationType
types of Inventory Location
PluginBase GetPlugin(typename plugin_type)