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

◆ ExecuteSwapCommandClient()

bool ExecuteSwapCommandClient ( inout Serializer ctx)
protected

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

3161 {
3162 DayZPlayer playerOwner = GetDayZPlayerOwner();
3164 if (!swapValidation)
3165 {
3166 return false;
3167 }
3168
3169#ifdef ENABLE_LOGGING
3171 {
3172 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", "ExecuteSwapCommandClient", playerOwner.ToString() );
3173 }
3174#endif
3175 RemoveMovableOverride(swapValidation.m_SrcItem1);
3176 RemoveMovableOverride(swapValidation.m_SrcItem2);
3177
3178 if (!(swapValidation.m_Src1.IsValid() && swapValidation.m_Src2.IsValid() && swapValidation.m_Dst1.IsValid() && swapValidation.m_Dst2.IsValid()))
3179 {
3180 Error("ExecuteSwapCommandClient: 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));
3181 return true;
3182 }
3183
3184 ClearInventoryReservationEx(swapValidation.m_DstItem1, swapValidation.m_Dst1);
3185 ClearInventoryReservationEx(swapValidation.m_DstItem2, swapValidation.m_Dst2);
3186
3187 //TODO: hotfix solution
3188 if (!SwapCheckExclusionMaskLocal(swapValidation.m_Src1, swapValidation.m_Src2, swapValidation.m_Dst1, swapValidation.m_Dst2))
3189 {
3190#ifdef ENABLE_LOGGING
3192 {
3193 Debug.InventoryMoveLog("Failed - !SwapCheckExclusionMaskLocal - condition failed locally", "SWAP" , "n/a", "ExecuteSwapCommandClient", playerOwner.ToString() );
3194 }
3195#endif
3196 return false;
3197 }
3198
3199 if(!GameInventory.CanForceSwapEntitiesEx(swapValidation.m_SrcItem1, swapValidation.m_Dst1, swapValidation.m_SrcItem2, swapValidation.m_Dst2))
3200 {
3201#ifdef ENABLE_LOGGING
3203 {
3204 Debug.InventoryMoveLog("Failed - !CanForceSwapEntitiesEx", "SWAP" , "n/a", "ExecuteSwapCommandClient", playerOwner.ToString() );
3205 }
3206#endif
3207 return false;
3208 }
3209
3210#ifdef ENABLE_LOGGING
3212 {
3213 Debug.InventoryMoveLog("Success - item swap", "SWAP" , "n/a", "ExecuteSwapCommandClient", playerOwner.ToString() );
3214 }
3215#endif
3216
3217 if (swapValidation.m_Success)
3218 {
3219 bool isNotSkipped = LocationSwap(swapValidation.m_Src1, swapValidation.m_Src2, swapValidation.m_Dst1, swapValidation.m_Dst2);
3220 ctx = new ScriptInputUserData();
3221 InventoryInputUserData.SerializeSwap(ctx, swapValidation.m_Src1, swapValidation.m_Src2, swapValidation.m_Dst1, swapValidation.m_Dst2, !isNotSkipped);
3222 }
3223
3224 return true;
3225 }
InventoryCommandType
void ClearInventoryReservationEx(ActionData action_data)
Определения ActionBase.c:1120
bool SwapCheckExclusionMaskLocal(notnull InventoryLocation src1, notnull InventoryLocation src2, notnull InventoryLocation dst1, notnull InventoryLocation dst2)
Local, checks only stuff that is in guaranteed sync.
Определения DayZPlayerInventory.c:4892
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 bool CanForceSwapEntitiesEx(notnull EntityAI item1, InventoryLocation item1_dst, notnull EntityAI item2, out InventoryLocation item2_dst)
script counterpart to engine's class Inventory
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

Перекрестные ссылки GameInventory::CanForceSwapEntitiesEx(), 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_Src1, InventoryJunctureSwapValidation::m_Src2, InventoryJunctureSwapValidation::m_SrcItem1, InventoryJunctureSwapValidation::m_SrcItem2, InventoryJunctureSwapValidation::m_Success, RemoveMovableOverride(), InventoryInputUserData::SerializeSwap() и SwapCheckExclusionMaskLocal().

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