2enum ConsoleActionToolbarMask
5 TO_HANDS_SWAP_VICINITY = 1,
6 TO_HANDS_SWAP_INVENTORY = 2,
11 OPEN_CLOSE_CONTAINER = 64,
97 #ifndef PLATFORM_CONSOLE
109 #ifndef PLATFORM_CONSOLE
122 #ifdef PLATFORM_CONSOLE
124 GetGame().GetUIManager().ShowUICursor(
false);
126 GetMainWidget().FindAnyWidget(
"CursorCharacter").Show(
false);
159 for (
int i = 0; i < namesCount; i++)
170 #ifdef PLATFORM_CONSOLE
177 switch (pInputDeviceType)
185 if (
GetGame().GetInput().IsEnabledMouseAndKeyboardEvenOnServer())
214 static int GetPlayerAttachmentIndex(
string slot_name)
216 return m_PlayerAttachmentsIndexes[slot_name];
219 static int GetPlayerAttachmentIndex(
int slot_id)
221 return GetPlayerAttachmentIndex(
InventorySlots.GetSlotName(slot_id));
227 string data, errorMessage;
231 if (
GetGame().GetProfileString(
"INV_AttIndexes", data))
233 if (!JsonFileLoader<
map<string, int>>.LoadData(data, m_PlayerAttachmentsIndexes, errorMessage))
237 string configPathGhostSlots =
"CfgVehicles SurvivorBase InventoryEquipment playerSlots";
239 GetGame().ConfigGetTextArray(configPathGhostSlots, playerGhostSlots);
241 foreach (
string slotName : playerGhostSlots)
246 m_PlayerAttachmentsIndexes.Insert(
slotName, m_PlayerAttachmentsIndexes.Count());
250 if (!JsonFileLoader<
map<string, int>>.MakeData(m_PlayerAttachmentsIndexes, data, errorMessage))
253 GetGame().SetProfileString(
"INV_AttIndexes", data);
256 static void MoveAttachmentUp(
int slot_id)
258 int curr = GetPlayerAttachmentIndex(slot_id);
261 string next_item =
"init";
265 while(!next_ent && next_item !=
"")
267 next_item = m_PlayerAttachmentsIndexes.GetKeyByValue(curr + --next_offset);
269 next_ent =
GetGame().GetPlayer().GetInventory().FindAttachment(next_id);
270 if (next_ent && !m_Instance.m_RightArea.HasEntityContainerVisible(next_ent))
274 if (next_item !=
"" && next_ent)
276 int next = GetPlayerAttachmentIndex(next_item);
277 m_PlayerAttachmentsIndexes.Set(
InventorySlots.GetSlotName(slot_id), next);
278 m_PlayerAttachmentsIndexes.Set(next_item, curr);
280 m_Instance.m_RightArea.SwapItemsInOrder(next_id, slot_id);
284 static void MoveAttachmentDown(
int slot_id)
286 int curr = GetPlayerAttachmentIndex(slot_id);
289 string next_item =
"init";
293 while(!next_ent && next_item !=
"")
295 next_item = m_PlayerAttachmentsIndexes.GetKeyByValue(curr + ++next_offset);
297 next_ent =
GetGame().GetPlayer().GetInventory().FindAttachment(next_id);
298 if (next_ent && !m_Instance.m_RightArea.HasEntityContainerVisible(next_ent))
302 if (next_item !=
"" && next_ent)
304 int next = GetPlayerAttachmentIndex(next_item);
305 m_PlayerAttachmentsIndexes.Set(
InventorySlots.GetSlotName(slot_id), next);
306 m_PlayerAttachmentsIndexes.Set(next_item, curr);
308 m_Instance.m_RightArea.SwapItemsInOrder(next_id, slot_id);
314 int proper_angle = (360 - angle) % 360;
320 if (angle < 45 || angle > 315)
324 else if (angle < 135 && angle > 45)
328 else if (angle < 225 && angle > 135)
332 else if (angle < 315 && angle > 225)
347 #ifdef PLATFORM_CONSOLE
350 if (control == ControlID.CID_RADIALMENU)
398 string name = w.GetName();
399 name.Replace(
"PanelWidget",
"Render");
431 string name = w.GetName();
432 name.Replace(
"PanelWidget",
"Render");
447 if (!item.GetInventory().CanRemoveEntity())
457 int index = player.GetHumanInventory().FindUserReservedLocationIndex(item);
460 player.GetHumanInventory().GetUserReservedLocation(index, inv_loc);
461 if (player.GetInventory().LocationCanAddEntity(inv_loc))
470 if (player && (player.GetInventory().CanAddAttachment(item)))
472 float stackable = item.GetTargetQuantityMax(-1);
474 if (stackable == 0 || stackable >= item.GetQuantity())
476 player.PredictiveTakeEntityAsAttachment(item);
482 ItemBase.Cast(item).SplitIntoStackMaxToInventoryLocationClient(il);
487 int slot_id = item.GetInventory().GetSlotId(0);
488 EntityAI slot_item = player.GetInventory().FindAttachment(slot_id);
489 if (slot_item && player.GetInventory().CanSwapEntitiesEx(item, slot_item))
491 player.PredictiveSwapEntities(item, slot_item);
493 else if (player.CanReceiveItemIntoCargo(item))
502 CastTo(mngr_client, player.GetActionManager());
504 ActionTarget atrg =
new ActionTarget(item, null, -1,
vector.Zero, -1.0);
536 string name = w.GetName();
537 name.Replace(
"PanelWidget",
"Render");
554 int slot_id = item.GetInventory().GetSlotId(0);
555 EntityAI slot_item = player.GetInventory().FindAttachment(slot_id);
560 int index = player.GetHumanInventory().FindUserReservedLocationIndex(item);
563 player.GetHumanInventory().GetUserReservedLocation(index, inv_loc);
564 if (player.GetInventory().LocationCanAddEntity(inv_loc))
574 if (inv_loc.IsValid())
577 GetMainWidget().FindAnyWidget(
"RightPanel").FindAnyWidget(
"DropzoneX").SetAlpha(1);
578 if (inv_loc.GetType() == 4)
581 GetMainWidget().FindAnyWidget(
"HandsPanel").FindAnyWidget(
"DropzoneX").SetAlpha(1);
599 void Update(
float timeslice)
601 #ifdef PLATFORM_CONSOLE
607 if (
GetUApi().GetInputByID(UAUIDragNDrop).LocalValue())
612 if (!
GetUApi().GetInputByID(UAUIInventoryTabRight).LocalValue())
624 if (
GetUApi().GetInputByID(UAUIDragNDrop).LocalValue())
629 if (!
GetUApi().GetInputByID(UAUIInventoryTabLeft).LocalValue())
641 if (
GetUApi().GetInputByID(UAUIDragNDrop).LocalValue())
646 if (!
GetUApi().GetInputByID(UAUIInventoryContainerUp).LocalValue())
658 if (
GetUApi().GetInputByID(UAUIDragNDrop).LocalValue())
663 if (!
GetUApi().GetInputByID(UAUIInventoryContainerDown).LocalValue())
686 if (
GetUApi().GetInputByID(UAUIRotateInventory).LocalPress())
692 GetGame().GetInventoryItemSize(item, size_x, size_y);
693 if (size_x != size_y)
695 item.GetInventory().FlipCargo();
696 item.GetOnItemFlipped().Invoke(item.GetInventory().GetFlipCargo());
701 #ifdef PLATFORM_CONSOLE
704 dpi = player.GetDayZPlayerInventory();
707 if (dpi && !dpi.IsProcessing())
709 if (
GetUApi().GetInputByID(UAUIExpandCollapseContainer).LocalPress())
721 if (
GetUApi().GetInputByID(UAUIDragNDrop).LocalHoldBegin())
726 if (
GetUApi().GetInputByID(UAUISplit).LocalPress())
749 if (
GetUApi().GetInputByID(UAUIFastEquip).LocalPress())
791 if (
GetUApi().GetInputByID(UAUIPutInHandsFromVicinity).LocalPress())
805 if (
GetUApi().GetInputByID(UAUIPutInHandsFromInventory).LocalPress())
820 if (
GetUApi().GetInputByID(UAUIFastTransferToVicinity).LocalPress())
825 if (item && item.GetInventory().CanRemoveEntity())
829 handsItem =
InventoryItem.Cast(player.GetHumanInventory().GetEntityInHands());
830 if (handsItem && handsItem == item)
843 if (item && item.GetInventory().CanRemoveEntity())
855 if (
GetUApi().GetInputByID(UAUIInspectItem).LocalPress())
882 if (
GetUApi().GetInputByID(UAUIFastTransferItem).LocalPress())
885 if (
GetUApi().GetInputByID(UAUIInspectItem).LocalPress())
888 if (dpi && !dpi.IsProcessing())
895 if (item && item.GetInventory().CanRemoveEntity())
903 if (item && item.GetInventory().CanRemoveEntity())
905 handsItem =
InventoryItem.Cast(player.GetHumanInventory().GetEntityInHands());
906 if (
m_HandsArea.TransferItem() && handsItem && handsItem == item)
921 if (
GetUApi().GetInputByID(UAUIInventoryContainerUp).LocalPress())
923 if (
GetUApi().GetInputByID(UAUIDragNDrop).LocalValue())
931 if (
GetUApi().GetInputByID(UAUIInventoryContainerDown).LocalPress())
933 if (
GetUApi().GetInputByID(UAUIDragNDrop).LocalValue())
941 if (
GetUApi().GetInputByID(UAUIInventoryTabLeft).LocalPress())
943 if (
GetUApi().GetInputByID(UAUIDragNDrop).LocalValue())
951 if (
GetUApi().GetInputByID(UAUIInventoryTabRight).LocalPress())
953 if (
GetUApi().GetInputByID(UAUIDragNDrop).LocalValue())
962 if (
GetUApi().GetInputByID(UAUIQuickbarRadialInventoryOpen).LocalPress())
971 m_HandsArea.AddItemToQuickbarRadial(item_to_assign);
976 m_RightArea.AddItemToQuickbarRadial(item_to_assign);
981 MissionGameplay
mission = MissionGameplay.Cast(
GetGame().GetMission());
984 if (GetMainWidget().IsVisible())
986 #ifdef PLATFORM_CONSOLE
1018 for (
int i = 0; i < 10; i++)
1040 #ifdef PLATFORM_CONSOLE
1041 UpdateConsoleToolbarCheck();
1049 if (item && item.GetInventory().CanRemoveEntity())
1051 player.SetQuickBarEntityShortcut(item, index) ;
1057 menu.RefreshQuickbar();
1097 #ifdef PLATFORM_CONSOLE
1132 #ifdef PLATFORM_CONSOLE
1150 SetFocus(GetMainWidget());
1154 if (player && player.IsPlacingLocal())
1162 IngameHud hud = IngameHud.Cast(
mission.GetHud());
1165 hud.ShowQuickbarUI(
false);
1166 hud.ShowHudInventory(
true);
1187 IngameHud hud = IngameHud.Cast(
mission.GetHud());
1190 hud.ShowQuickbarUI(
true);
1191 hud.ShowHudInventory(
false);
1210 #ifndef PLATFORM_CONSOLE
1216 #ifndef PLATFORM_CONSOLE
1227 #ifdef PLATFORM_CONSOLE
1228 protected string GetConsoleToolbarText(
int mask)
1243 if (mask & ConsoleActionToolbarMask.OPEN_CLOSE_CONTAINER)
1245 result += openCloseContainer;
1247 if (mask & ConsoleActionToolbarMask.TO_HANDS_SWAP_VICINITY)
1249 result += toHandsSwapVicinity;
1251 if (mask & ConsoleActionToolbarMask.TO_HANDS_SWAP_INVENTORY)
1253 result += toHandsSwapInv;
1255 if (mask & ConsoleActionToolbarMask.TO_INVENTORY)
1257 result += toInventory;
1259 if (mask & ConsoleActionToolbarMask.DROP)
1263 if (mask & ConsoleActionToolbarMask.SPLIT)
1267 if (mask & ConsoleActionToolbarMask.EQUIP)
1271 if (mask & ConsoleActionToolbarMask.COMBINE)
1275 if (mask & ConsoleActionToolbarMask.MICROMANAGMENT)
1277 result += micromanagment;
1279 if (mask & ConsoleActionToolbarMask.QUICKSLOT)
1281 result += quickslot;
1305 #ifdef PLATFORM_CONSOLE
1306 void UpdateConsoleToolbarCheck()
1311 if (player.GetInventory().GetAnyInventoryReservationCount() == 0)
1323 #ifdef PLATFORM_CONSOLE
1324 int combinationFlag = 0;
1325 string contextualText;
1334 if (!(focusedItem && focusedItem.IsSetForDeletion()))
1336 if (focusedContainer)
1341 focusedItem.GetInventory().GetCurrentInventoryLocation( il );
1344 bool canBeManipulated =
false;
1354 itemPlayerOwner =
PlayerBase.Cast(focusedItem.GetHierarchyRootPlayer());
1356 focusedItem.GetInventory().GetCurrentInventoryLocation( il );
1358 canBeManipulated = !player.GetInventory().HasInventoryReservation( focusedItem, null ) && !player.GetInventory().IsInventoryLocked() && !player.IsItemsToDelete();
1360 canBeManipulated = canBeManipulated && focusedItem.CanPutIntoHands(null);
1361 canBeManipulated = canBeManipulated && focusedItem.GetInventory().CanRemoveEntity();
1367 canBeManipulated = canBeManipulated && !parent.GetInventory().GetSlotLock( il.GetSlot() );
1370 if (canBeManipulated)
1374 combinationFlag |= ConsoleActionToolbarMask.MICROMANAGMENT;
1377 if (focusedContainer.CanEquipEx(focusedItem))
1379 combinationFlag |= ConsoleActionToolbarMask.EQUIP;
1382 if (player!= null && player == itemPlayerOwner)
1384 if (focusedContainer.CanSwapOrTakeToHandsEx(focusedItem))
1386 combinationFlag |= ConsoleActionToolbarMask.TO_HANDS_SWAP_INVENTORY;
1389 if (focusedContainer.CanDropEx(focusedItem))
1391 combinationFlag |= ConsoleActionToolbarMask.DROP;
1396 if (focusedContainer.CanSwapOrTakeToHandsEx(focusedItem))
1398 combinationFlag |= ConsoleActionToolbarMask.TO_HANDS_SWAP_VICINITY;
1402 if (focusedContainer.CanCombineEx(focusedItem))
1404 combinationFlag |= ConsoleActionToolbarMask.COMBINE;
1407 if (focusedContainer.CanSplitEx(focusedItem))
1409 combinationFlag |= ConsoleActionToolbarMask.SPLIT;
1412 if (focusedArea.CanTakeToInventoryEx(focusedItem))
1414 combinationFlag |= ConsoleActionToolbarMask.TO_INVENTORY;
1419 if (focusedContainer.CanOpenCloseContainerEx(focusedItem))
1421 combinationFlag |= ConsoleActionToolbarMask.OPEN_CLOSE_CONTAINER;
1424 if (player!= null && focusedContainer.CanAddToQuickbarEx(focusedItem))
1426 combinationFlag |= ConsoleActionToolbarMask.QUICKSLOT;
1430 contextualText = GetConsoleToolbarText(combinationFlag);
1446 if (variants.Count() != 3)
1448 ErrorEx(
"wrong array count!");
1453 if (!inp.IsLimited() || inp.IsClickLimit())
1457 if (inp.IsHoldLimit() || inp.IsHoldBeginLimit())
1461 if (inp.IsDoubleClickLimit())
1465 ErrorEx(
"Unhandled limiter exception!");
1537 EntityAI item_in_hands = player.GetItemInHands();
1561 item_in_hands = player.GetItemInHands();
1590 float tickvalue = 0;
1612 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 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()
void OnHandsPanelDropReceived(Widget w, int x, int y, Widget receiver)
override void SetSameLevelPreviousActive()
override void SetSameLevelNextActive()
override void UpdateInterval()
void DraggingOverHandsPanel(Widget w, int x, int y, Widget receiver)
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()
void RefreshPlayerPreview()
override void UpdateInterval()
override void SetSameLevelNextActive()
override void DraggingOverHeader(Widget w, int x, int y, Widget receiver)
override bool InspectItem()
override void UpdateInterval()
override bool TransferItemToVicinity()
override void ExpandCollapseContainer()
override void SetSameLevelPreviousActive()
override bool SplitItem()
override bool SelectItem()
override bool EquipItem()
override void UnfocusGrid()
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native CGame GetGame()
FindInventoryLocationType
flags for searching locations in inventory
InventoryLocationType
types of Inventory Location
PluginBase GetPlugin(typename plugin_type)