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

◆ ExecuteSwapCommandRemote()

bool ExecuteSwapCommandRemote ( inout Serializer ctx)
protected

kumarjac: This indicates a failure in replication relationships as player full inventory should be synchronized always if player exists on the remote

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

3228 {
3229 DayZPlayer playerOwner = GetDayZPlayerOwner();
3231 if (!swapValidation)
3232 {
3233 return false;
3234 }
3235
3236#ifdef ENABLE_LOGGING
3238 {
3239 Debug.InventoryMoveLog("STS = " + playerOwner.GetSimulationTimeStamp() + " src1=" + InventoryLocation.DumpToStringNullSafe(swapValidation.m_Src1) + " dst1=" + InventoryLocation.DumpToStringNullSafe(swapValidation.m_Dst1) + " src2=" + InventoryLocation.DumpToStringNullSafe(swapValidation.m_Src2) + " dst2=" + InventoryLocation.DumpToStringNullSafe(swapValidation.m_Dst2), "SWAP" , "n/a", "ExecuteSwapCommandRemote", playerOwner.ToString() );
3240 }
3241#endif
3242
3243 if (!swapValidation.m_SrcItem1 || !swapValidation.m_SrcItem2)
3244 {
3245 if (!swapValidation.m_SrcItem2 && swapValidation.m_SrcItem1)
3246 {
3247 // Treat as a simple move of srcItem1 to dst1 on remote clients
3248 LocationSyncMoveEntity(swapValidation.m_Src1, swapValidation.m_Dst1);
3249 return true;
3250 }
3251 else if (!swapValidation.m_SrcItem1 && swapValidation.m_SrcItem2)
3252 {
3253 // Treat as a simple move of srcItem2 to dst2 on remote clients
3254 LocationSyncMoveEntity(swapValidation.m_Src2, swapValidation.m_Dst2);
3255 return true;
3256 }
3257 else
3258 {
3259 if (swapValidation.m_SkippedSwap)
3260 {
3261#ifdef ENABLE_LOGGING
3263 {
3264 Debug.InventoryMoveLog("Remote - skipped", "SWAP" , "n/a", "ExecuteSwapCommandRemote", playerOwner.ToString() );
3265 }
3266#endif
3267 }
3268 else
3269 {
3271#ifdef ENABLE_LOGGING
3273 {
3274 Debug.InventoryMoveLog("Failed - item1 or item2 not exist", "SWAP" , "n/a", "ExecuteSwapCommandRemote", playerOwner.ToString() );
3275 }
3276#endif
3277
3278 Error("[syncinv] ExecuteSwapCommandRemote remote input (cmd=SWAP) dropped, item not in bubble");
3279 }
3280 }
3281
3282 return false;
3283 }
3284
3285 RemoveMovableOverride(swapValidation.m_SrcItem1);
3286 RemoveMovableOverride(swapValidation.m_SrcItem2);
3287
3288 if (!(swapValidation.m_Src1.IsValid() && swapValidation.m_Src2.IsValid() && swapValidation.m_Dst1.IsValid() && swapValidation.m_Dst2.IsValid()))
3289 {
3290 Error("ExecuteSwapCommandRemote: cmd=" + typename.EnumToString(InventoryCommandType, InventoryCommandType.SWAP) + " invalid input(s): src1=" + InventoryLocation.DumpToStringNullSafe(swapValidation.m_Src1) + " src2=" + InventoryLocation.DumpToStringNullSafe(swapValidation.m_Src2) + " dst1=" + InventoryLocation.DumpToStringNullSafe(swapValidation.m_Dst1) + " dst2=" + InventoryLocation.DumpToStringNullSafe(swapValidation.m_Dst2));
3291 return false;
3292 }
3293
3294 ClearInventoryReservationEx(swapValidation.m_DstItem1, swapValidation.m_Dst1);
3295 ClearInventoryReservationEx(swapValidation.m_DstItem2, swapValidation.m_Dst2);
3296
3297#ifdef ENABLE_LOGGING
3299 {
3300 Debug.InventoryMoveLog("Success - item swap", "SWAP" , "n/a", "ExecuteSwapCommandRemote", playerOwner.ToString() );
3301 }
3302#endif
3303
3304 if (swapValidation.m_Success)
3305 {
3306 bool isNotSkipped = LocationSwap(swapValidation.m_Src1, swapValidation.m_Src2, swapValidation.m_Dst1, swapValidation.m_Dst2);
3307 ctx = new ScriptInputUserData();
3308 InventoryInputUserData.SerializeSwap(ctx, swapValidation.m_Src1, swapValidation.m_Src2, swapValidation.m_Dst1, swapValidation.m_Dst2, !isNotSkipped);
3309 return true;
3310 }
3311
3312 return false;
3313 }
InventoryCommandType
void ClearInventoryReservationEx(ActionData action_data)
Определения ActionBase.c:1120
void RemoveMovableOverride(EntityAI item)
Определения DayZPlayerInventory.c:3683
DayZPlayer GetDayZPlayerOwner()
Определения DayZPlayerInventory.c:170
Определения DayZPlayerImplement.c:87
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 void SerializeSwap(ParamsWriteContext ctx, notnull InventoryLocation src1, notnull InventoryLocation src2, notnull InventoryLocation dst1, notnull InventoryLocation dst2, bool skippedSwap)
swap
Определения InventoryInputUserData.c:70
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)
Определения InventoryLocation.c:233
InventoryLocation.
Определения InventoryLocation.c:30
static bool IsInventoryMoveLogEnable()
Определения 3_Game/DayZ/tools/Debug.c:759
Определения gameplay.c:121
void Error(string err)
Messagebox with error message.
Определения EnDebug.c:90

Перекрестные ссылки ClearInventoryReservationEx(), InventoryLocation::DumpToStringNullSafe(), Error(), GetDayZPlayerOwner(), Debug::InventoryMoveLog(), LogManager::IsInventoryMoveLogEnable(), InventoryLocation::IsValid(), InventoryJunctureSwapValidation::m_Dst1, InventoryJunctureSwapValidation::m_Dst2, InventoryJunctureSwapValidation::m_DstItem1, InventoryJunctureSwapValidation::m_DstItem2, InventoryJunctureSwapValidation::m_SkippedSwap, InventoryJunctureSwapValidation::m_Src1, InventoryJunctureSwapValidation::m_Src2, InventoryJunctureSwapValidation::m_SrcItem1, InventoryJunctureSwapValidation::m_SrcItem2, InventoryJunctureSwapValidation::m_Success, RemoveMovableOverride() и InventoryInputUserData::SerializeSwap().

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