DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ HandleRemoteItemManipulation()

bool ManBase::HandleRemoteItemManipulation ( int userDataType,
ParamsReadContext ctx )
inlineprotected

См. определение в файле PlayerBase.c строка 6600

6601 {
6602 if (userDataType == INPUT_UDT_ITEM_MANIPULATION)
6603 {
6604 int type = -1;
6605 ItemBase item1 = null;
6606 ItemBase item2 = null;
6607 InventoryLocation srcIL = new InventoryLocation();
6608 InventoryLocation dstIL = new InventoryLocation();
6609 bool use_stack_max = false;
6610 int slot_id = -1;
6611
6612 DayZPlayerInventory inventory = GetDayZPlayerInventory();
6613
6614 if (!ctx.Read(type))
6615 return false;
6616
6617 if (type == 4)
6618 {
6619 if (!ctx.Read(item1))
6620 return false;
6621
6622 if (!dstIL.ReadFromContext(ctx))
6623 return false;
6624
6625 bool dummy;
6626 if (!ctx.Read(dummy))
6627 return false;
6628
6629 if (item1 && dstIL.IsValid())
6630 {
6631 item1.GetInventory().GetCurrentInventoryLocation(srcIL);
6632
6633 if (!inventory.PlayerCheckRequestSrc(srcIL, GameInventory.c_MaxItemDistanceRadius))
6634 return false;
6635
6636 if (!inventory.PlayerCheckRequestDst(srcIL, dstIL, GameInventory.c_MaxItemDistanceRadius))
6637 return false;
6638
6639 if (dummy)
6640 item1.SplitItemToInventoryLocation(dstIL);
6641 else
6642 item1.SplitIntoStackMaxToInventoryLocation(dstIL);
6643 return true;
6644 }
6645 return false;
6646 }
6647
6648 if (!ctx.Read(item1))
6649 return false;
6650 if (!ctx.Read(item2))
6651 return false;
6652 if (!ctx.Read(use_stack_max))
6653 return false;
6654 if (!ctx.Read(slot_id))
6655 return false;
6656
6657 if (!item1)
6658 return false;
6659
6660 item1.GetInventory().GetCurrentInventoryLocation(srcIL);
6661
6662 if (!inventory.PlayerCheckRequestSrc(srcIL, GameInventory.c_MaxItemDistanceRadius))
6663 return false;
6664
6665 if (type == -1 && item1 && item2)//combine
6666 {
6667 item2.GetInventory().GetCurrentInventoryLocation(dstIL);
6668 if (!inventory.PlayerCheckRequestSrc(dstIL, GameInventory.c_MaxItemDistanceRadius))
6669 return false;
6670 item1.CombineItems(item2, use_stack_max);
6671 }
6672 else if (type == 1 && item1)
6673 {
6674 if (use_stack_max)
6675 {
6676 if (item2)
6677 {
6678 if(slot_id == -1)
6679 {
6680 GameInventory destinationInventory = item2.GetInventory();
6681 destinationInventory.FindFreeLocationFor(item1, FindInventoryLocationType.ANY, dstIL);
6682 }
6683 else
6684 {
6685 dstIL.SetAttachment(item2, item1, slot_id);
6686 }
6687
6688 if (!inventory.PlayerCheckRequestDst(srcIL, dstIL, GameInventory.c_MaxItemDistanceRadius))
6689 return false;
6690
6691
6692 }
6693
6694
6695 item1.SplitIntoStackMax(item2, slot_id, this);
6696 }
6697 else
6698 {
6699 GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.ATTACHMENT, dstIL);
6700 if (!inventory.PlayerCheckRequestDst(srcIL, dstIL, GameInventory.c_MaxItemDistanceRadius))
6701 return false;
6702
6703 item1.SplitItem(this);
6704 }
6705 }
6706 else if (type == 2 && item1 && item2)
6707 {
6708 int row, col;
6709 if (!ctx.Read(row))
6710 return false;
6711 if (!ctx.Read(col))
6712 return false;
6713
6714 dstIL.SetCargo(item2, item1, slot_id, row, col, false);
6715 if (!inventory.PlayerCheckRequestDst(srcIL, dstIL, GameInventory.c_MaxItemDistanceRadius))
6716 return false;
6717
6718 item1.SplitIntoStackMaxCargo(item2, slot_id, row, col);
6719 }
6720 else if (type == 3 && item1)
6721 {
6722 dstIL.SetHands(this, item1);
6723 if (!inventory.PlayerCheckRequestDst(srcIL, dstIL, GameInventory.c_MaxItemDistanceRadius))
6724 return false;
6725 item1.SplitIntoStackMaxHands(this);
6726 }
6727 return true;
6728 }
6729 return false;
6730 }
const int INPUT_UDT_ITEM_MANIPULATION
eBleedingSourceType GetType()
void DayZPlayerInventory()
limmit number of items transfere duting repair.
Определения DayZPlayerInventory.c:166
class GP5GasMask extends MaskBase ItemBase
FindInventoryLocationType
flags for searching locations in inventory
Определения InventoryLocation.c:18
proto native bool FindFreeLocationFor(notnull EntityAI item, FindInventoryLocationType flags, out notnull InventoryLocation loc)
FindFreeLocationFor.
proto native bool IsValid()
verify current set inventory location
proto native void SetHands(notnull EntityAI parent, EntityAI e)
sets current inventory location type to Hands
proto native void SetAttachment(notnull EntityAI parent, EntityAI e, int slotId)
sets current inventory location type to Attachment with slot id set to <slotId>
proto native void SetCargo(notnull EntityAI parent, EntityAI e, int idx, int row, int col, bool flip)
sets current inventory location type to Cargo with coordinates (idx, row, col)
bool ReadFromContext(ParamsReadContext ctx)
Определения InventoryLocation.c:310
proto bool Read(void value_in)

Перекрестные ссылки GameInventory::c_MaxItemDistanceRadius, GameInventory::FindFreeLocationFor(), GetType(), INPUT_UDT_ITEM_MANIPULATION, InventoryLocation::IsValid(), Serializer::Read(), InventoryLocation::ReadFromContext(), InventoryLocation::SetAttachment(), InventoryLocation::SetCargo() и InventoryLocation::SetHands().

Используется в OnInputUserDataProcess().