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

◆ ValidateSyncMoveServer()

bool ValidateSyncMoveServer ( ParamsReadContext ctx,
InventoryValidation validation )
protected

TODO(kumarjac): We should continue with the execution and not have this special block but making a change here now will require testing

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

1137 {
1140 bool success = true;
1141
1142 if (!src.ReadFromContext(ctx))
1143 return false;
1144 if (!dst.ReadFromContext(ctx))
1145 return false;
1146
1147#ifdef ENABLE_LOGGING
1149 {
1150 Debug.InventoryMoveLog("STS = " + GetDayZPlayerOwner().GetSimulationTimeStamp() + " src=" + InventoryLocation.DumpToStringNullSafe(src) + " dst=" + InventoryLocation.DumpToStringNullSafe(dst), "SYNC_MOVE" , "n/a", "ValidateSyncMoveServer", GetDayZPlayerOwner().ToString() );
1151 }
1152#endif
1153
1154 EntityAI itemSrc = src.GetItem();
1155 EntityAI itemDst = dst.GetItem();
1156
1157 if (success && itemSrc != itemDst)
1158 {
1159#ifdef ENABLE_LOGGING
1161 {
1162 Debug.InventoryMoveLog("Failed - src and dst are for different items", "SYNC_MOVE" , "n/a", "ValidateSyncMoveServer", GetDayZPlayerOwner().ToString() );
1163 }
1164
1166 {
1167 syncDebugPrint("[syncinv] ValidateSyncMoveServer Failed - src and dst are for different items src item =" + itemSrc + " dst item =" + itemDst);
1168 }
1169#endif
1170
1171 success = false;
1172 }
1173
1174 EnableMovableOverride(itemSrc);
1175
1177 {
1178#ifdef ENABLE_LOGGING
1180 {
1181 Debug.InventoryMoveLog("Failed - CheckRequestSrc", "SYNC_MOVE" , "n/a", "ValidateSyncMoveServer", GetDayZPlayerOwner().ToString() );
1182 }
1183
1185 {
1186 syncDebugPrint("[cheat] ValidateSyncMoveServer man=" + Object.GetDebugName(GetManOwner()) + " failed src check with cmd=" + typename.EnumToString(InventoryCommandType, InventoryCommandType.SYNC_MOVE) + " src=" + InventoryLocation.DumpToStringNullSafe(src));
1187 }
1188#endif
1189
1190 RemoveMovableOverride(itemSrc);
1191
1192 success = false;
1193#ifdef DIAG_DEVELOPER
1194 if (PluginInventoryDebug.Cast(GetPlugin(PluginInventoryDebug)).IsDesyncRepairEnable())
1195 {
1196#endif
1197 array<EntityAI> itemsToRepair = new array<EntityAI>();
1198 InventoryLocation realIl = new InventoryLocation();
1199 src.GetItem().GetInventory().GetCurrentInventoryLocation(realIl);
1200
1201 if(src != realIl)
1202 {
1203 itemsToRepair.Insert(src.GetItem());
1205 }
1206#ifdef DIAG_DEVELOPER
1207 }
1208#endif
1209 }
1210
1212 {
1213#ifdef ENABLE_LOGGING
1215 {
1216 Debug.InventoryMoveLog("Failed - CheckMoveToDstRequest", "SYNC_MOVE" , "n/a", "ValidateSyncMoveServer", GetDayZPlayerOwner().ToString() );
1217 }
1218
1220 {
1221 syncDebugPrint("[cheat] ValidateSyncMoveServer man=" + Object.GetDebugName(GetManOwner()) + " is cheating with cmd=" + typename.EnumToString(InventoryCommandType, InventoryCommandType.SYNC_MOVE) + " src=" + InventoryLocation.DumpToStringNullSafe(src) + " dst=" + InventoryLocation.DumpToStringNullSafe(dst));
1222 }
1223#endif
1224
1225 RemoveMovableOverride(itemSrc);
1226
1228 success = false;
1229 }
1230
1231 RemoveMovableOverride(itemSrc);
1232
1233#ifdef ENABLE_LOGGING
1235 {
1236 syncDebugPrint("[syncinv] " + Object.GetDebugName(GetDayZPlayerOwner()) + " STS = " + GetDayZPlayerOwner().GetSimulationTimeStamp() + " ValidateSyncMoveServer t=" + g_Game.GetTime() + "ms received cmd=" + typename.EnumToString(InventoryCommandType, InventoryCommandType.SYNC_MOVE) + " src=" + InventoryLocation.DumpToStringNullSafe(src) + " dst=" + InventoryLocation.DumpToStringNullSafe(dst));
1237 }
1238#endif
1239
1241 if (result_mv == JunctureRequestResult.JUNCTURE_NOT_REQUIRED)
1242 {
1243#ifdef ENABLE_LOGGING
1245 {
1246 Debug.InventoryMoveLog("Juncture not required STS = " + GetDayZPlayerOwner().GetSimulationTimeStamp(), "SYNC_MOVE" , "n/a", "ValidateSyncMoveServer", GetDayZPlayerOwner().ToString() );
1247 }
1248#endif
1249 if (success)
1250 {
1252 LocationSyncMoveEntity(src, dst);
1253
1254 validation.m_Result = InventoryValidationResult.SUCCESS;
1255 }
1256
1257 }
1258 else if (success && result_mv == JunctureRequestResult.JUNCTURE_ACQUIRED)
1259 {
1260#ifdef ENABLE_LOGGING
1262 {
1263 Debug.InventoryMoveLog("Juncture needed STS = " + GetDayZPlayerOwner().GetSimulationTimeStamp(), "SYNC_MOVE" , "n/a", "ValidateSyncMoveServer", GetDayZPlayerOwner().ToString() );
1264 }
1265#endif
1266
1267 if (!GameInventory.LocationCanMoveEntity(src, dst))
1268 {
1269#ifdef ENABLE_LOGGING
1270
1271 #ifdef DEVELOPER
1272 DumpInventoryDebug();
1273 #endif
1274
1276 {
1277 Debug.InventoryMoveLog("Failed - LocationCanMoveEntity - Juncture denied STS = " + GetDayZPlayerOwner().GetSimulationTimeStamp(), "SYNC_MOVE" , "n/a", "ValidateSyncMoveServer", GetDayZPlayerOwner().ToString() );
1278 }
1279#endif
1280 validation.m_Result = InventoryValidationResult.FAILED;
1281 success = false;
1282 }
1283 else
1284 {
1285 validation.m_Result = InventoryValidationResult.JUNCTURE;
1286 EnableMovableOverride(itemSrc);
1287 }
1288 }
1289 else
1290 {
1291#ifdef ENABLE_LOGGING
1293 {
1294 Debug.InventoryMoveLog("Juncture denied", "SYNC_MOVE" , "n/a", "ValidateSyncMoveServer", GetDayZPlayerOwner().ToString() );
1295 }
1296#endif
1297
1298 validation.m_Result = InventoryValidationResult.FAILED;
1299 validation.m_Reason = InventoryValidationReason.JUNCTURE_DENIED;
1300
1301 success = false;
1302
1303 }
1304 return true;
1305 }
void syncDebugPrint(string s)
InventoryCommandType
InventoryValidationResult
InventoryValidationReason
DayZGame g_Game
Определения DayZGame.c:4074
void EnableMovableOverride(EntityAI item)
Определения DayZPlayerInventory.c:3690
bool PlayerCheckRequestSrc(notnull InventoryLocation src, float radius)
Определения DayZPlayerInventory.c:4644
void RemoveMovableOverride(EntityAI item)
Определения DayZPlayerInventory.c:3683
void SendRepairToClientDst(notnull InventoryLocation dst)
Определения DayZPlayerInventory.c:4726
DayZPlayer GetDayZPlayerOwner()
Определения DayZPlayerInventory.c:170
bool PlayerCheckRequestDst(notnull InventoryLocation src, notnull InventoryLocation dst, float radius)
Определения DayZPlayerInventory.c:4682
proto string ToString()
JunctureRequestResult
Определения Hand_Events.c:28
bool TryAcquireInventoryJunctureFromServer(notnull Man player, notnull InventoryLocation src, notnull InventoryLocation dst)
Определения Junctures.c:2
PluginBase GetPlugin(typename plugin_type)
Определения PluginManager.c:326
static void InventoryMoveLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Определения 3_Game/DayZ/tools/Debug.c:198
Определения 3_Game/DayZ/tools/Debug.c:2
static proto native bool LocationCanMoveEntity(notnull InventoryLocation src, notnull InventoryLocation dst)
queries if the entity contained in inv_loc.m_item can be moved to another location This is a shorthan...
const float c_MaxItemDistanceRadius
anti-cheats
script counterpart to engine's class Inventory
static void SendServerInventoryCheck(array< EntityAI > items, DayZPlayer player)
Определения InventoryInputUserData.c:44
static string DumpToStringNullSafe(InventoryLocation loc)
Определения InventoryLocation.c:233
bool ReadFromContext(ParamsReadContext ctx)
Определения InventoryLocation.c:310
proto native EntityAI GetItem()
returns item of current inventory location
InventoryLocation.
Определения InventoryLocation.c:30
InventoryValidationResult m_Result
InventoryValidationReason m_Reason
static bool IsSyncLogEnable()
Определения 3_Game/DayZ/tools/Debug.c:789
static bool IsInventoryMoveLogEnable()
Определения 3_Game/DayZ/tools/Debug.c:759
Определения ObjectTyped.c:2
Result for an object found in CGame.IsBoxCollidingGeometryProxy.

Перекрестные ссылки GameInventory::c_MaxItemDistanceRadius, InventoryLocation::DumpToStringNullSafe(), EnableMovableOverride(), g_Game, GetDayZPlayerOwner(), InventoryLocation::GetItem(), GetPlugin(), Debug::InventoryMoveLog(), LogManager::IsInventoryMoveLogEnable(), LogManager::IsSyncLogEnable(), GameInventory::LocationCanMoveEntity(), InventoryValidation::m_Reason, InventoryValidation::m_Result, PlayerCheckRequestDst(), PlayerCheckRequestSrc(), InventoryLocation::ReadFromContext(), RemoveMovableOverride(), SendRepairToClientDst(), InventoryInputUserData::SendServerInventoryCheck(), syncDebugPrint(), ToString() и TryAcquireInventoryJunctureFromServer().

Используется в ValidateInventoryCommandServer().