DayZ 1.24
Loading...
Searching...
No Matches
SplitItemUtils Class Reference

Static Private Member Functions

static void TakeOrSplitToInventory (notnull PlayerBase player, notnull EntityAI target, notnull EntityAI item)
 
static void TakeOrSplitToInventoryLocation (notnull PlayerBase player, notnull InventoryLocation dst)
 

Detailed Description

Definition at line 1 of file SplitItemUtils.c.

Member Function Documentation

◆ TakeOrSplitToInventory()

static void SplitItemUtils::TakeOrSplitToInventory ( notnull PlayerBase player,
notnull EntityAI target,
notnull EntityAI item )
inlinestaticprivate

Definition at line 3 of file SplitItemUtils.c.

4 {
6
7 if (!item.GetInventory().CanRemoveEntity() || !player.CanManipulateInventory())
8 return;
9
11 if (target.GetInventory().FindFreeLocationFor(item, FindInventoryLocationType.ANY, il))
12 {
13 if (item_base.GetTargetQuantityMax(il.GetSlot()) >= item_base.GetQuantity())
14 {
15 if (il.GetType() == InventoryLocationType.ATTACHMENT)
16 player.PredictiveTakeEntityToTargetAttachmentEx(il.GetParent(), item, il.GetSlot());
17 else
18 {
20 if (item.GetInventory().GetCurrentInventoryLocation(src))
21 player.PredictiveTakeToDst(src, il);
22
23 }
24 }
25 else
26 item_base.SplitIntoStackMaxClient(il.GetParent(), il.GetSlot());
27 }
28 }
FindInventoryLocationType
flags for searching locations in inventory
InventoryLocationType
types of Inventory Location
InventoryLocation.

Referenced by AttachmentCategoriesRow::Combine(), PlayerContainer::OnDropReceivedFromGhostArea(), ClosableContainer::OnDropReceivedFromHeader(), Icon::OnPerformCombination(), HandsContainer::OnPerformCombination(), OnRightPanelDropReceived(), Icon::PerformCombination(), AttachmentCategoriesRow::Select(), HandsContainer::TakeAsAttachment(), and ClosableContainer::TakeAsAttachment().

◆ TakeOrSplitToInventoryLocation()

static void SplitItemUtils::TakeOrSplitToInventoryLocation ( notnull PlayerBase player,
notnull InventoryLocation dst )
inlinestaticprivate

Definition at line 30 of file SplitItemUtils.c.

31 {
32 ItemBase item_base = ItemBase.Cast(dst.GetItem());
33 int slot = dst.GetSlot();
34
35 if (!dst.GetItem().GetInventory().CanRemoveEntity() || !player.CanManipulateInventory())
36 return;
37
38 float stack_max = item_base.GetTargetQuantityMax(slot);
39
40 if (stack_max >= item_base.GetQuantity())
41 {
43 if (dst.GetItem().GetInventory().GetCurrentInventoryLocation(src))
44 player.PredictiveTakeToDst(src, dst);
45 else
46 Error("TakeIntoCargoEx cannot get src for dst=" + dst.DumpToString());
47 }
48 else
49 item_base.SplitIntoStackMaxToInventoryLocationClient(dst);
50 }
void Error(string err)
Messagebox with error message.
Definition EnDebug.c:90

References Error().

Referenced by Icon::DoubleClick(), VicinitySlotsContainer::DoubleClick(), ClosableContainer::DropReceived(), HandsContainer::DropReceived(), AttachmentCategoriesRow::DropReceived(), ClosableContainer::DropReceived(), Icon::DropReceivedFromMain(), OnCenterPanelDropReceived(), and VicinitySlotsContainer::TransferItem().


The documentation for this class was generated from the following file: