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
2778 {
2781 if (!swapValidation)
2782 {
2783 return false;
2784 }
2785
2788
2789#ifdef ENABLE_LOGGING
2791 {
2793 }
2794#endif
2795
2798
2800 {
2801 #ifdef ENABLE_LOGGING
2803 {
2805 {
2807 }
2809 {
2811 }
2812 }
2813
2815 {
2817 {
2818 syncDebugPrint(
"[syncinv] ValidateSwapServer Failed - first src and dst are for different items src item =" + swapValidation.
m_SrcItem1 +
" dst item =" + swapValidation.
m_DstItem1);
2819 }
2821 {
2822 syncDebugPrint(
"[syncinv] ValidateSwapServer Failed - second src and dst are for different items src item =" + swapValidation.
m_SrcItem1 +
" dst item =" + swapValidation.
m_DstItem1);
2823 }
2824 }
2825#endif
2826
2828 }
2829
2834 {
2835#ifdef ENABLE_LOGGING
2837 {
2838 Debug.
InventoryMoveLog(
"Failed - CheckRequestSrc1",
"SWAP" ,
"n/a",
"ValidateSwapServer", playerOwner.ToString() );
2839 }
2840
2842 {
2844 }
2845#endif
2846
2849
2851#ifdef DIAG_DEVELOPER
2852 if (PluginInventoryDebug.Cast(
GetPlugin(PluginInventoryDebug)).IsDesyncRepairEnable())
2853 {
2854#endif
2857
2858 swapValidation.
m_SrcItem1.GetInventory().GetCurrentInventoryLocation(repairIl);
2859
2860 if(swapValidation.
m_Src1 != repairIl)
2861 {
2862 itemsToRepair.Insert(swapValidation.
m_SrcItem1);
2863 }
2864
2865 swapValidation.
m_SrcItem2.GetInventory().GetCurrentInventoryLocation(repairIl);
2866 if(swapValidation.
m_Src2 != repairIl)
2867 {
2868 itemsToRepair.Insert(swapValidation.
m_SrcItem2);
2869 }
2870
2871 if (itemsToRepair.Count())
2872 {
2874 }
2875#ifdef DIAG_DEVELOPER
2876 }
2877#endif
2878 }
2879
2884 {
2885 #ifdef ENABLE_LOGGING
2887 {
2888 Debug.
InventoryMoveLog(
"Failed - CheckRequestSrc2",
"SWAP" ,
"n/a",
"ValidateSwapServer", playerOwner.ToString() );
2889 }
2890
2892 {
2894 }
2895 #endif
2896
2899
2901#ifdef DIAG_DEVELOPER
2902 if (PluginInventoryDebug.Cast(
GetPlugin(PluginInventoryDebug)).IsDesyncRepairEnable())
2903 {
2904#endif
2907
2908 swapValidation.
m_SrcItem2.GetInventory().GetCurrentInventoryLocation(repairIl);
2909 if(swapValidation.
m_Src2 != repairIl)
2910 {
2911 itemsToRepair.Insert(swapValidation.
m_SrcItem2);
2912 }
2913
2914 if (itemsToRepair.Count())
2915 {
2917 }
2918#ifdef DIAG_DEVELOPER
2919 }
2920#endif
2921 }
2922
2927 {
2928#ifdef ENABLE_LOGGING
2930 {
2931 Debug.
InventoryMoveLog(
"Failed - CheckSwapItemsRequest",
"SWAP" ,
"n/a",
"ValidateSwapServer", playerOwner.ToString());
2932 }
2933
2935 {
2937 }
2938#endif
2939
2942
2944 }
2945
2948
2953 {
2954#ifdef ENABLE_LOGGING
2955 #ifdef DEVELOPER
2956 DumpInventoryDebug();
2957 #endif
2958
2960 {
2961 Debug.
InventoryMoveLog(
"Failed - CanForceSwapEntitiesEx",
"SWAP" ,
"n/a",
"ValidateSwapServer", playerOwner.ToString());
2962 }
2963#endif
2964
2965 if (swapValidation.
m_Dst1)
2966 {
2968 }
2969
2970 if (swapValidation.
m_Dst2)
2971 {
2973 }
2975 }
2976
2978 {
2980 return true;
2981 }
2982
2985 {
2988
2989#ifdef ENABLE_LOGGING
2991 {
2992 Debug.
InventoryMoveLog(
"Success - item swap without juncture",
"SWAP" ,
"n/a",
"ValidateSwapServer", playerOwner.ToString() );
2993 }
2994#endif
2995
2997 {
2998 bool isNotSkipped = LocationSwap(swapValidation.
m_Src1, swapValidation.
m_Src2, swapValidation.
m_Dst1, swapValidation.
m_Dst2);
3002 }
3003
3004 return true;
3005 }
3007 {
3008#ifdef ENABLE_LOGGING
3010 {
3012 }
3013#endif
3014
3018 return true;
3019 }
3020 else
3021 {
3022#ifdef ENABLE_LOGGING
3024 {
3026 }
3027#endif
3028
3031 return true;
3032 }
3033
3034
3035 return true;
3036 }
void syncDebugPrint(string s)
InventoryValidationResult
InventoryValidationReason
void EnableMovableOverride(EntityAI item)
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)
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.
void Error(string err)
Messagebox with error message.