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

◆ OnServerInventoryCommandStatic()

static void GameInventory::OnServerInventoryCommandStatic ( ParamsReadContext ctx)
inlinestaticprotected

См. определение в файле 3_Game/DayZ/Systems/Inventory/Inventory.c строка 471

472 {
473 int tmp = -1;
474 ctx.Read(tmp);
475
476 int type = -1;
477 if (!ctx.Read(type))
478 return;
479
480 switch (type)
481 {
482 case InventoryCommandType.SYNC_MOVE:
483 {
484 InventoryLocation src = new InventoryLocation();
485 InventoryLocation dst = new InventoryLocation();
486
487 src.ReadFromContext(ctx);
488 dst.ReadFromContext(ctx);
489 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[syncinv] t=" + g_Game.GetTime() + "ms ServerInventoryCommand cmd=" + typename.EnumToString(InventoryCommandType, type) + " src=" + InventoryLocation.DumpToStringNullSafe(src) + " dst=" + InventoryLocation.DumpToStringNullSafe(dst));
490
491 if (!src.GetItem() || !dst.GetItem())
492 {
493 Error("[syncinv] ServerInventoryCommand (cmd=SYNC_MOVE) dropped, item not in bubble");
494 break; // not in bubble
495 }
496
497 LocationSyncMoveEntity(src, dst);
498 break;
499 }
500
501 case InventoryCommandType.HAND_EVENT:
502 {
503 HandEventBase e = HandEventBase.CreateHandEventFromContext(ctx);
504 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[syncinv] t=" + g_Game.GetTime() + "ms ServerInventoryCommand cmd=" + typename.EnumToString(InventoryCommandType, type) + " event=" + e.DumpToString());
505
506 if (!e.GetSrcEntity())
507 {
508 Error("[syncinv] ServerInventoryCommand (cmd=HAND_EVENT) dropped, item not in bubble");
509 break; // not in bubble
510 }
511 e.m_Player.GetHumanInventory().ProcessHandEvent(e);
512 break;
513 }
514
515 case InventoryCommandType.FORCESWAP:
516 case InventoryCommandType.SWAP:
517 {
518 InventoryLocation src1 = new InventoryLocation();
519 InventoryLocation src2 = new InventoryLocation();
520 InventoryLocation dst1 = new InventoryLocation();
521 InventoryLocation dst2 = new InventoryLocation();
522 src1.ReadFromContext(ctx);
523 src2.ReadFromContext(ctx);
524 dst1.ReadFromContext(ctx);
525 dst2.ReadFromContext(ctx);
526
527 if (src1.IsValid() && src2.IsValid() && dst1.IsValid() && dst2.IsValid())
528 {
529 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[syncinv] t=" + g_Game.GetTime() + "ms ServerInventoryCommand Swap src1=" + InventoryLocation.DumpToStringNullSafe(src1) + " src2=" + InventoryLocation.DumpToStringNullSafe(src2) + " dst1=" + InventoryLocation.DumpToStringNullSafe(dst1) + " dst2=" + InventoryLocation.DumpToStringNullSafe(dst2));
530
531 LocationSwap(src1, src2, dst1, dst2);
532 }
533 else
534 Error("ServerInventoryCommand - cannot swap, invalid location input: src1=" + InventoryLocation.DumpToStringNullSafe(src1) + " src2=" + InventoryLocation.DumpToStringNullSafe(src2) + " dst1=" + InventoryLocation.DumpToStringNullSafe(dst1) + " dst2=" + InventoryLocation.DumpToStringNullSafe(dst2));
535
536 break;
537 }
538 }
539 }
void syncDebugPrint(string s)
InventoryCommandType
DayZGame g_Game
Определения DayZGame.c:3942
void HandEventBase(Man p=null, InventoryLocation src=null)
Определения Hand_Events.c:52
static proto native bool LocationSyncMoveEntity(notnull InventoryLocation src_loc, notnull InventoryLocation dst_loc)
synchronously removes item from current inventory location and adds it to destination no anims involv...
static proto native bool LocationSwap(notnull InventoryLocation src1, notnull InventoryLocation src2, notnull InventoryLocation dst1, notnull InventoryLocation dst2)
swaps two entities
override string DumpToString()
Определения Hand_Events.c:338
proto native bool IsValid()
verify current set inventory location
bool ReadFromContext(ParamsReadContext ctx)
Определения InventoryLocation.c:310
proto native EntityAI GetItem()
returns item of current inventory location
proto bool Read(void value_in)
void Error(string err)
Messagebox with error message.
Определения EnDebug.c:90

Перекрестные ссылки HandEventBase::DumpToString(), InventoryLocation::DumpToStringNullSafe(), Error(), g_Game, InventoryLocation::GetItem(), LogManager::IsSyncLogEnable(), InventoryLocation::IsValid(), LocationSwap(), LocationSyncMoveEntity(), Serializer::Read(), InventoryLocation::ReadFromContext() и syncDebugPrint().