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.
1345 {
1348 if (!swapValidation)
1349 return false;
1350
1353
1354 #ifdef ENABLE_LOGGING
1356 {
1358 }
1359 #endif
1360
1362 {
1364 {
1365
1366 LocationSyncMoveEntity(swapValidation.
m_Src1, swapValidation.
m_Dst1);
1368 return true;
1369 }
1371 {
1372
1373 LocationSyncMoveEntity(swapValidation.
m_Src2, swapValidation.
m_Dst2);
1375 return true;
1376 }
1377 else
1378 {
1380 {
1381 #ifdef ENABLE_LOGGING
1383 {
1384 Debug.
InventoryMoveLog(
"Remote - skipped",
"SWAP" ,
"n/a",
"ProcessInputData", playerOwner.ToString() );
1385 }
1386 #endif
1387 }
1388 else
1389 {
1391 #ifdef ENABLE_LOGGING
1393 {
1394 Debug.
InventoryMoveLog(
"Failed - item1 or item2 not exist",
"SWAP" ,
"n/a",
"ProcessInputData", playerOwner.ToString() );
1395 }
1396 #endif
1397
1398 Error(
"[syncinv] HandleInputData remote input (cmd=SWAP) dropped, item not in bubble");
1399 }
1400 }
1401
1402 return true;
1403 }
1404
1407
1409 {
1410 #ifdef ENABLE_LOGGING
1412 {
1417 }
1418
1420 {
1422 syncDebugPrint(
"[syncinv] HandleInputData Failed - first src and dst are for different items src item =" + swapValidation.
m_SrcItem1 +
" dst item =" + swapValidation.
m_DstItem1);
1424 syncDebugPrint(
"[syncinv] HandleInputData Failed - second src and dst are for different items src item =" + swapValidation.
m_SrcItem1 +
" dst item =" + swapValidation.
m_DstItem1);
1425 }
1426 #endif
1427
1429 {
1431 }
1432 else
1433 {
1434 return true;
1435 }
1436 }
1437
1442 {
1443 #ifdef ENABLE_LOGGING
1445 {
1446 Debug.
InventoryMoveLog(
"Failed - CheckRequestSrc1",
"SWAP" ,
"n/a",
"ProcessInputData", playerOwner.ToString() );
1447 }
1448
1450 {
1452 }
1453 #endif
1454
1457
1459 {
1461 #ifdef DIAG_DEVELOPER
1462 if (PluginInventoryDebug.Cast(
GetPlugin(PluginInventoryDebug)).IsDesyncRepairEnable())
1463 {
1464 #endif
1467
1468 swapValidation.
m_SrcItem1.GetInventory().GetCurrentInventoryLocation(repairIl);
1469
1470 if(swapValidation.
m_Src1 != repairIl)
1471 {
1472 itemsToRepair.Insert(swapValidation.
m_SrcItem1);
1473 }
1474
1475 swapValidation.
m_SrcItem2.GetInventory().GetCurrentInventoryLocation(repairIl);
1476 if(swapValidation.
m_Src2 != repairIl)
1477 {
1478 itemsToRepair.Insert(swapValidation.
m_SrcItem2);
1479 }
1480
1481 if (itemsToRepair.Count())
1482 {
1484 }
1485 #ifdef DIAG_DEVELOPER
1486 }
1487 #endif
1488 }
1489 else
1490 {
1491 return true;
1492 }
1493 }
1494
1499 {
1500 #ifdef ENABLE_LOGGING
1502 {
1503 Debug.
InventoryMoveLog(
"Failed - CheckRequestSrc2",
"SWAP" ,
"n/a",
"ProcessInputData", playerOwner.ToString() );
1504 }
1505
1507 {
1509 }
1510 #endif
1511
1514
1516 {
1518 #ifdef DIAG_DEVELOPER
1519 if (PluginInventoryDebug.Cast(
GetPlugin(PluginInventoryDebug)).IsDesyncRepairEnable())
1520 {
1521 #endif
1524
1525 swapValidation.
m_SrcItem2.GetInventory().GetCurrentInventoryLocation(repairIl);
1526 if(swapValidation.
m_Src2 != repairIl)
1527 {
1528 itemsToRepair.Insert(swapValidation.
m_SrcItem2);
1529 }
1530
1531 if (itemsToRepair.Count())
1532 {
1534 }
1535 #ifdef DIAG_DEVELOPER
1536 }
1537 #endif
1538 }
1539 else
1540 {
1541 return true;
1542 }
1543 }
1544
1549 {
1550 #ifdef ENABLE_LOGGING
1552 {
1553 Debug.
InventoryMoveLog(
"Failed - CheckSwapItemsRequest",
"SWAP" ,
"n/a",
"ProcessInputData", playerOwner.ToString());
1554 }
1555
1557 {
1559 }
1560 #endif
1561
1564
1566 {
1568 }
1569 else
1570 {
1571 return true;
1572 }
1573 }
1574
1577
1579 {
1580 ClearInventoryReservationEx(swapValidation.
m_DstItem1, swapValidation.
m_Dst1);
1581 ClearInventoryReservationEx(swapValidation.
m_DstItem2, swapValidation.
m_Dst2);
1582 }
1583
1588 {
1589 #ifdef ENABLE_LOGGING
1590 #ifdef DEVELOPER
1591 DumpInventoryDebug();
1592 #endif
1593
1595 {
1596 Debug.
InventoryMoveLog(
"Failed - CanForceSwapEntitiesEx",
"SWAP" ,
"n/a",
"ProcessInputData", playerOwner.ToString());
1597 }
1598 #endif
1599
1601 {
1602 if (swapValidation.
m_Dst1)
1604
1605 if (swapValidation.
m_Dst2)
1608 }
1609 else
1610 {
1612 return true;
1613 }
1614 }
1615
1617 {
1620 }
1621
1623 {
1625 return true;
1626 }
1627
1629 {
1632 {
1635 {
1636 #ifdef ENABLE_LOGGING
1638 {
1640 }
1641 #endif
1642
1644 }
1646 {
1647 #ifdef ENABLE_LOGGING
1649 {
1651 }
1652 #endif
1653
1657 return true;
1658 }
1659 else
1660 {
1661 #ifdef ENABLE_LOGGING
1663 {
1665 }
1666 #endif
1667
1670 return true;
1671 }
1672 }
1675 {
1676 bool hasJuncture = false;
1677 int nonNullCount = 0;
1678 bool failed = false;
1679
1681 {
1682 nonNullCount++;
1684 failed = true;
1685 }
1686
1687 if (!failed && swapValidation.
m_SrcItem2 != null)
1688 {
1689 nonNullCount++;
1691 failed = true;
1692 }
1693
1694 if (!failed && swapValidation.
m_DstItem1 != null)
1695 {
1696 nonNullCount++;
1698 failed = true;
1699 }
1700
1701 if (!failed && swapValidation.
m_DstItem2 != null)
1702 {
1703 nonNullCount++;
1705 failed = true;
1706 }
1707
1708 hasJuncture = (nonNullCount > 0 && !failed);
1709
1710 if (!hasJuncture)
1711 {
1713 }
1714 }
1715 }
1716
1718 {
1719 ClearInventoryReservationEx(swapValidation.
m_DstItem1, swapValidation.
m_Dst1);
1720 ClearInventoryReservationEx(swapValidation.
m_DstItem2, swapValidation.
m_Dst2);
1721 }
1722 else
1723 {
1726 }
1727
1728
1730 {
1731 #ifdef ENABLE_LOGGING
1733 {
1734 Debug.
InventoryMoveLog(
"Failed - !SwapCheckExclusionMaskLocal - condition failed locally",
"SYNC_MOVE" ,
"n/a",
"ProcessInputData", playerOwner.ToString() );
1735 }
1736 #endif
1737 return false;
1738 }
1739
1740 #ifdef ENABLE_LOGGING
1742 {
1743 Debug.
InventoryMoveLog(
"Success - item swap",
"SWAP" ,
"n/a",
"ProcessInputData", playerOwner.ToString() );
1744 }
1745 #endif
1746
1748 {
1749 bool isNotSkipped = LocationSwap(swapValidation.
m_Src1, swapValidation.
m_Src2, swapValidation.
m_Dst1, swapValidation.
m_Dst2);
1753 }
1754
1755 return true;
1756 }
void syncDebugPrint(string s)
InventoryValidationResult
InventoryValidationReason
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.