kumarjac: This indicates a failure in replication relationships as player full inventory should be synchronized always if player exists on the remote
Do not check for action validity on remotes or when performing through juncture. Juncture locks guarentee the item is safe to interact with and the server has validated the command at this point. Checking at this point is both wasteful and can result in a failure which leads to desync
Do not check for action validity on remotes or when performing through juncture. Juncture locks guarentee the item is safe to interact with and the server has validated the command at this point. Checking at this point is both wasteful and can result in a failure which leads to desync
Do not check for action validity on remotes or when performing through juncture. Juncture locks guarentee the item is safe to interact with and the server has validated the command at this point. Checking at this point is both wasteful and can result in a failure which leads to desync
Do not check for action validity on remotes or when performing through juncture. Juncture locks guarentee the item is safe to interact with and the server has validated the command at this point. Checking at this point is both wasteful and can result in a failure which leads to desync
Check whether the juncture for the related player and items has been acquired.
2358 {
2361 if (!swapValidation)
2362 return false;
2363
2366
2367 #ifdef ENABLE_LOGGING
2369 {
2371 }
2372 #endif
2373
2375 {
2377 {
2378
2379 LocationSyncMoveEntity(swapValidation.
m_Src1, swapValidation.
m_Dst1);
2381 return true;
2382 }
2384 {
2385
2386 LocationSyncMoveEntity(swapValidation.
m_Src2, swapValidation.
m_Dst2);
2388 return true;
2389 }
2390 else
2391 {
2393 {
2394 #ifdef ENABLE_LOGGING
2396 {
2397 Debug.
InventoryMoveLog(
"Remote - skipped",
"SWAP" ,
"n/a",
"ProcessInputData", playerOwner.ToString() );
2398 }
2399 #endif
2400 }
2401 else
2402 {
2404 #ifdef ENABLE_LOGGING
2406 {
2407 Debug.
InventoryMoveLog(
"Failed - item1 or item2 not exist",
"SWAP" ,
"n/a",
"ProcessInputData", playerOwner.ToString() );
2408 }
2409 #endif
2410
2411 Error(
"[syncinv] HandleInputData remote input (cmd=SWAP) dropped, item not in bubble");
2412 }
2413 }
2414
2415 return true;
2416 }
2417
2420
2422 {
2423 #ifdef ENABLE_LOGGING
2425 {
2430 }
2431
2433 {
2435 syncDebugPrint(
"[syncinv] HandleInputData Failed - first src and dst are for different items src item =" + swapValidation.
m_SrcItem1 +
" dst item =" + swapValidation.
m_DstItem1);
2437 syncDebugPrint(
"[syncinv] HandleInputData Failed - second src and dst are for different items src item =" + swapValidation.
m_SrcItem1 +
" dst item =" + swapValidation.
m_DstItem1);
2438 }
2439 #endif
2440
2442 {
2444 }
2445 else
2446 {
2447 return true;
2448 }
2449 }
2450
2455 {
2456 #ifdef ENABLE_LOGGING
2458 {
2459 Debug.
InventoryMoveLog(
"Failed - CheckRequestSrc1",
"SWAP" ,
"n/a",
"ProcessInputData", playerOwner.ToString() );
2460 }
2461
2463 {
2465 }
2466 #endif
2467
2470
2472 {
2474 #ifdef DIAG_DEVELOPER
2475 if (PluginInventoryDebug.Cast(
GetPlugin(PluginInventoryDebug)).IsDesyncRepairEnable())
2476 {
2477 #endif
2480
2481 swapValidation.
m_SrcItem1.GetInventory().GetCurrentInventoryLocation(repairIl);
2482
2483 if(swapValidation.
m_Src1 != repairIl)
2484 {
2485 itemsToRepair.Insert(swapValidation.
m_SrcItem1);
2486 }
2487
2488 swapValidation.
m_SrcItem2.GetInventory().GetCurrentInventoryLocation(repairIl);
2489 if(swapValidation.
m_Src2 != repairIl)
2490 {
2491 itemsToRepair.Insert(swapValidation.
m_SrcItem2);
2492 }
2493
2494 if (itemsToRepair.Count())
2495 {
2497 }
2498 #ifdef DIAG_DEVELOPER
2499 }
2500 #endif
2501 }
2502 else
2503 {
2504 return true;
2505 }
2506 }
2507
2512 {
2513 #ifdef ENABLE_LOGGING
2515 {
2516 Debug.
InventoryMoveLog(
"Failed - CheckRequestSrc2",
"SWAP" ,
"n/a",
"ProcessInputData", playerOwner.ToString() );
2517 }
2518
2520 {
2522 }
2523 #endif
2524
2527
2529 {
2531 #ifdef DIAG_DEVELOPER
2532 if (PluginInventoryDebug.Cast(
GetPlugin(PluginInventoryDebug)).IsDesyncRepairEnable())
2533 {
2534 #endif
2537
2538 swapValidation.
m_SrcItem2.GetInventory().GetCurrentInventoryLocation(repairIl);
2539 if(swapValidation.
m_Src2 != repairIl)
2540 {
2541 itemsToRepair.Insert(swapValidation.
m_SrcItem2);
2542 }
2543
2544 if (itemsToRepair.Count())
2545 {
2547 }
2548 #ifdef DIAG_DEVELOPER
2549 }
2550 #endif
2551 }
2552 else
2553 {
2554 return true;
2555 }
2556 }
2557
2562 {
2563 #ifdef ENABLE_LOGGING
2565 {
2566 Debug.
InventoryMoveLog(
"Failed - CheckSwapItemsRequest",
"SWAP" ,
"n/a",
"ProcessInputData", playerOwner.ToString());
2567 }
2568
2570 {
2572 }
2573 #endif
2574
2577
2579 {
2581 }
2582 else
2583 {
2584 return true;
2585 }
2586 }
2587
2590
2592 {
2595 }
2596
2601 {
2602 #ifdef ENABLE_LOGGING
2603 #ifdef DEVELOPER
2604 DumpInventoryDebug();
2605 #endif
2606
2608 {
2609 Debug.
InventoryMoveLog(
"Failed - CanForceSwapEntitiesEx",
"SWAP" ,
"n/a",
"ProcessInputData", playerOwner.ToString());
2610 }
2611 #endif
2612
2614 {
2615 if (swapValidation.
m_Dst1)
2617
2618 if (swapValidation.
m_Dst2)
2621 }
2622 else
2623 {
2625 return true;
2626 }
2627 }
2628
2630 {
2633 }
2634
2636 {
2638 return true;
2639 }
2640
2642 {
2645 {
2648 {
2649 #ifdef ENABLE_LOGGING
2651 {
2653 }
2654 #endif
2655
2657 }
2659 {
2660 #ifdef ENABLE_LOGGING
2662 {
2664 }
2665 #endif
2666
2670 return true;
2671 }
2672 else
2673 {
2674 #ifdef ENABLE_LOGGING
2676 {
2678 }
2679 #endif
2680
2683 return true;
2684 }
2685 }
2688 {
2689 bool hasJuncture = false;
2690 int nonNullCount = 0;
2691 bool failed = false;
2692
2694 {
2695 nonNullCount++;
2697 failed = true;
2698 }
2699
2700 if (!failed && swapValidation.
m_SrcItem2 != null)
2701 {
2702 nonNullCount++;
2704 failed = true;
2705 }
2706
2707 if (!failed && swapValidation.
m_DstItem1 != null)
2708 {
2709 nonNullCount++;
2711 failed = true;
2712 }
2713
2714 if (!failed && swapValidation.
m_DstItem2 != null)
2715 {
2716 nonNullCount++;
2718 failed = true;
2719 }
2720
2721 hasJuncture = (nonNullCount > 0 && !failed);
2722
2723 if (!hasJuncture)
2724 {
2725#ifdef ENABLE_LOGGING
2727 {
2729 }
2730#endif
2732 }
2733 }
2734 }
2735
2737 {
2740 }
2741 else
2742 {
2745 }
2746
2747
2749 {
2750 #ifdef ENABLE_LOGGING
2752 {
2753 Debug.
InventoryMoveLog(
"Failed - !SwapCheckExclusionMaskLocal - condition failed locally",
"SWAP" ,
"n/a",
"ProcessInputData", playerOwner.ToString() );
2754 }
2755 #endif
2756 return false;
2757 }
2758
2759 #ifdef ENABLE_LOGGING
2761 {
2762 Debug.
InventoryMoveLog(
"Success - item swap",
"SWAP" ,
"n/a",
"ProcessInputData", playerOwner.ToString() );
2763 }
2764 #endif
2765
2767 {
2768 bool isNotSkipped = LocationSwap(swapValidation.
m_Src1, swapValidation.
m_Src2, swapValidation.
m_Dst1, swapValidation.
m_Dst2);
2772 }
2773
2774 return true;
2775 }
void syncDebugPrint(string s)
InventoryValidationResult
InventoryValidationReason
void ClearInventoryReservationEx(ActionData action_data)
void EnableMovableOverride(EntityAI item)
bool SwapCheckExclusionMaskLocal(notnull InventoryLocation src1, notnull InventoryLocation src2, notnull InventoryLocation dst1, notnull InventoryLocation dst2)
Local, checks only stuff that is in guaranteed sync.
bool PlayerCheckRequestSrc(notnull InventoryLocation src, float radius)
void RemoveMovableOverride(EntityAI item)
void SendRepairToClientDst(notnull InventoryLocation dst)
DayZPlayer GetDayZPlayerOwner()
bool PlayerCheckSwapItemsRequest(notnull InventoryLocation src1, notnull InventoryLocation src2, notnull InventoryLocation dst1, notnull InventoryLocation dst2, float radius)
bool TryAcquireTwoInventoryJuncturesFromServer(notnull Man player, notnull InventoryLocation src1, notnull InventoryLocation src2, notnull InventoryLocation dst1, notnull InventoryLocation dst2)
PluginBase GetPlugin(typename plugin_type)
static void InventoryMoveLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
const int c_InventoryReservationTimeoutShortMS
static bool CanForceSwapEntitiesEx(notnull EntityAI item1, InventoryLocation item1_dst, notnull EntityAI item2, out InventoryLocation item2_dst)
const float c_MaxItemDistanceRadius
anti-cheats
script counterpart to engine's class Inventory
ref InventoryLocation m_Src2
ref InventoryLocation m_Src1
ref InventoryLocation m_Dst1
ref InventoryLocation m_Dst2
proto native bool IsValid()
verify current set inventory location
static string DumpToStringNullSafe(InventoryLocation loc)
InventoryValidationResult m_Result
InventoryValidationReason m_Reason
static bool IsSyncLogEnable()
static bool IsInventoryMoveLogEnable()
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
DayZPlayerInstanceType
defined in C++
proto native DayZPlayerInstanceType GetInstanceType()
void Error(string err)
Messagebox with error message.