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

◆ TryAcquireInventoryJunctureFromServer()

bool TryAcquireInventoryJunctureFromServer ( notnull Man player,
notnull InventoryLocation src,
notnull InventoryLocation dst )

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

3{
4 #ifdef ENABLE_LOGGING
6 {
7 Debug.InventoryReservationLog("STS = " + player.GetSimulationTimeStamp() + " src:" + src.DumpToString() + " dst: " + dst.DumpToString(), "InventoryJuncture" , "n/a", "TryAcquireInventoryJunctureFromServer",player.ToString() );
8 }
9 #endif
10
11 if (!src.GetItem())
12 {
13 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[syncinv] missing src item, junction cannot be tested, player=" + Object.GetDebugName(player) + " STS = " + player.GetSimulationTimeStamp() + " src=" + InventoryLocation.DumpToStringNullSafe(src));
14 return JunctureRequestResult.ERROR;
15 }
16
17 if (player.NeedInventoryJunctureFromServer(src.GetItem(), src.GetParent(), dst.GetParent()))
18 {
19 if ( ( src.GetItem() && src.GetItem().IsSetForDeletion() ) || ( src.GetParent() && src.GetParent().IsSetForDeletion() ) || ( dst.GetParent() && dst.GetParent().IsSetForDeletion() ) )
20 {
21 return JunctureRequestResult.JUNCTURE_DENIED;
22 }
23
24 if (src.GetItem() && !src.GetItem().CanPutIntoHands(player))
25 {
26 return JunctureRequestResult.JUNCTURE_DENIED;
27 }
28
29 bool test_dst_occupancy = true;
30 if (g_Game.AddInventoryJunctureEx(player, src.GetItem(), dst, test_dst_occupancy, GameInventory.c_InventoryReservationTimeoutMS))
31 {
32 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[syncinv] juncture needed and acquired, player=" + Object.GetDebugName(player) + " STS = " + player.GetSimulationTimeStamp() + " src=" + InventoryLocation.DumpToStringNullSafe(src) + " dst=" + InventoryLocation.DumpToStringNullSafe(dst));
33 return JunctureRequestResult.JUNCTURE_ACQUIRED; // ok
34 }
35 else
36 {
37 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[syncinv] juncture request DENIED, player=" + Object.GetDebugName(player) + " STS = " + player.GetSimulationTimeStamp() + " src=" + InventoryLocation.DumpToStringNullSafe(src) + " dst=" + InventoryLocation.DumpToStringNullSafe(dst));
38 return JunctureRequestResult.JUNCTURE_DENIED; // permission to perform juncture denied
39 }
40 }
41 else
42 {
43 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[syncinv] juncture not required, player=" + Object.GetDebugName(player) + " STS = " + player.GetSimulationTimeStamp() + " src=" + InventoryLocation.DumpToStringNullSafe(src) + " dst=" + InventoryLocation.DumpToStringNullSafe(dst));
44 return JunctureRequestResult.JUNCTURE_NOT_REQUIRED; // juncture not necessary
45 }
46}
void syncDebugPrint(string s)
DayZGame g_Game
Определения DayZGame.c:4074
JunctureRequestResult
Определения Hand_Events.c:28
static void InventoryReservationLog(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:203
Определения 3_Game/DayZ/tools/Debug.c:2
const int c_InventoryReservationTimeoutMS
reservations
script counterpart to engine's class Inventory
static string DumpToStringNullSafe(InventoryLocation loc)
Определения InventoryLocation.c:233
InventoryLocation.
Определения InventoryLocation.c:30
static bool IsInventoryReservationLogEnable()
Определения 3_Game/DayZ/tools/Debug.c:769
static bool IsSyncLogEnable()
Определения 3_Game/DayZ/tools/Debug.c:789
Определения ObjectTyped.c:2

Перекрестные ссылки GameInventory::c_InventoryReservationTimeoutMS, InventoryLocation::DumpToStringNullSafe(), g_Game, Debug::InventoryReservationLog(), LogManager::IsInventoryReservationLogEnable(), LogManager::IsSyncLogEnable() и syncDebugPrint().

Используется в HandEventBase::AcquireInventoryJunctureFromServer(), ValidateSyncMove() и ValidateSyncMoveServer().