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

◆ OnServerInventoryCommandStatic()

static void GameInventory::OnServerInventoryCommandStatic ( ParamsReadContext ctx)
inlinestaticprotected

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

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

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