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

◆ HandleRemoteItemManipulation()

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

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

6308 {
6309 if (userDataType == INPUT_UDT_ITEM_MANIPULATION)
6310 {
6311 int type = -1;
6312 ItemBase item1 = null;
6313 ItemBase item2 = null;
6314 InventoryLocation srcIL = new InventoryLocation();
6315 InventoryLocation dstIL = new InventoryLocation();
6316 bool use_stack_max = false;
6317 int slot_id = -1;
6318
6319 DayZPlayerInventory inventory = GetDayZPlayerInventory();
6320
6321 if (!ctx.Read(type))
6322 return false;
6323
6324 if (type == 4)
6325 {
6326 if (!ctx.Read(item1))
6327 return false;
6328
6329 if (!dstIL.ReadFromContext(ctx))
6330 return false;
6331
6332 bool dummy;
6333 if (!ctx.Read(dummy))
6334 return false;
6335
6336 if (item1 && dstIL.IsValid())
6337 {
6338 item1.GetInventory().GetCurrentInventoryLocation(srcIL);
6339
6340 if (!inventory.PlayerCheckRequestSrc(srcIL, GameInventory.c_MaxItemDistanceRadius))
6341 return false;
6342
6343 if (!inventory.PlayerCheckRequestDst(srcIL, dstIL, GameInventory.c_MaxItemDistanceRadius))
6344 return false;
6345
6346 if (dummy)
6347 item1.SplitItemToInventoryLocation(dstIL);
6348 else
6349 item1.SplitIntoStackMaxToInventoryLocation(dstIL);
6350 return true;
6351 }
6352 return false;
6353 }
6354
6355 if (!ctx.Read(item1))
6356 return false;
6357 if (!ctx.Read(item2))
6358 return false;
6359 if (!ctx.Read(use_stack_max))
6360 return false;
6361 if (!ctx.Read(slot_id))
6362 return false;
6363
6364 item1.GetInventory().GetCurrentInventoryLocation(srcIL);
6365
6366 if (!inventory.PlayerCheckRequestSrc(srcIL, GameInventory.c_MaxItemDistanceRadius))
6367 return false;
6368
6369 if (type == -1 && item1 && item2)//combine
6370 {
6371 item2.GetInventory().GetCurrentInventoryLocation(dstIL);
6372 if (!inventory.PlayerCheckRequestSrc(dstIL, GameInventory.c_MaxItemDistanceRadius))
6373 return false;
6374 item1.CombineItems(item2, use_stack_max);
6375 }
6376 else if (type == 1 && item1)
6377 {
6378 if (use_stack_max)
6379 {
6380 if (item2)
6381 {
6382 if(slot_id == -1)
6383 {
6384 GameInventory destinationInventory = item2.GetInventory();
6385 destinationInventory.FindFreeLocationFor(item1, FindInventoryLocationType.ANY, dstIL);
6386 }
6387 else
6388 {
6389 dstIL.SetAttachment(item2, item1, slot_id);
6390 }
6391
6392 if (!inventory.PlayerCheckRequestDst(srcIL, dstIL, GameInventory.c_MaxItemDistanceRadius))
6393 return false;
6394
6395
6396 }
6397
6398
6399 item1.SplitIntoStackMax(item2, slot_id, this);
6400 }
6401 else
6402 {
6403 GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.ATTACHMENT, dstIL);
6404 if (!inventory.PlayerCheckRequestDst(srcIL, dstIL, GameInventory.c_MaxItemDistanceRadius))
6405 return false;
6406
6407 item1.SplitItem(this);
6408 }
6409 }
6410 else if (type == 2 && item1 && item2)
6411 {
6412 int row, col;
6413 if (!ctx.Read(row))
6414 return false;
6415 if (!ctx.Read(col))
6416 return false;
6417
6418 dstIL.SetCargo(item2, item1, slot_id, row, col, false);
6419 if (!inventory.PlayerCheckRequestDst(srcIL, dstIL, GameInventory.c_MaxItemDistanceRadius))
6420 return false;
6421
6422 item1.SplitIntoStackMaxCargo(item2, slot_id, row, col);
6423 }
6424 else if (type == 3 && item1)
6425 {
6426 dstIL.SetHands(this, item1);
6427 if (!inventory.PlayerCheckRequestDst(srcIL, dstIL, GameInventory.c_MaxItemDistanceRadius))
6428 return false;
6429 item1.SplitIntoStackMaxHands(this);
6430 }
6431 return true;
6432 }
6433 return false;
6434 }
const int INPUT_UDT_ITEM_MANIPULATION
eBleedingSourceType GetType()
void DayZPlayerInventory()
Определения DayZPlayerInventory.c:163
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().