DayZ 1.29
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
InventoryInputUserData.c
См. документацию.
1
3{
5 static void SerializeMove(ParamsWriteContext ctx, int type, notnull InventoryLocation src, notnull InventoryLocation dst)
6 {
8 ctx.Write(type);
9 src.WriteToContext(ctx);
10 dst.WriteToContext(ctx);
11 }
12
13 static void SendInputUserDataMove(int type, notnull InventoryLocation src, notnull InventoryLocation dst)
14 {
15 if (g_Game.IsClient())
16 {
17 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[syncinv] t=" + g_Game.GetTime() + "ms sending cmd=" + typename.EnumToString(InventoryCommandType, type) + " src=" + InventoryLocation.DumpToStringNullSafe(src) + " dst=" + InventoryLocation.DumpToStringNullSafe(dst));
19 SerializeMove(ctx, type, src, dst);
20 ctx.Send();
21 }
22 }
23
25 {
27 item.GetInventory().GetCurrentInventoryLocation(il);
28 il.WriteToContext(ctx);
29 }
30
32 {
34 int nItems = items.Count();
36 ctx.Write(nItems);
37 for (int i = 0; i < nItems; ++i)
38 {
39 SerializeInventoryCheckForItem(ctx, items[i]);
40 }
41 ctx.Send();
42 }
43
45 {
46 ScriptRPC ctx = new ScriptRPC();
47 int nItems = items.Count();
48 ctx.Write(nItems);
49 for (int i = 0; i < nItems; i++)
50 {
51 SerializeInventoryCheckForItem(ctx, items[i]);
52 }
53
54 ctx.Send(player, ERPCs.RPC_ITEM_REPAIR, false, player.GetIdentity());
55 }
56
57 static void SendServerMove(Man player, int type, notnull InventoryLocation src, notnull InventoryLocation dst)
58 {
59 if (g_Game.IsServer())
60 {
61 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[syncinv] server sending cmd=" + typename.EnumToString(InventoryCommandType, type) + " src=" + InventoryLocation.DumpToStringNullSafe(src) + " dst=" + InventoryLocation.DumpToStringNullSafe(dst));
63 SerializeMove(ctx, type, src, dst);
64 GameInventory.ServerLocationSyncMoveEntity(player, src.GetItem(), ctx);
65 }
66 }
67
68
70 static void SerializeSwap(ParamsWriteContext ctx, notnull InventoryLocation src1, notnull InventoryLocation src2, notnull InventoryLocation dst1, notnull InventoryLocation dst2, bool skippedSwap)
71 {
74 src1.WriteToContext(ctx);
75 src2.WriteToContext(ctx);
76 dst1.WriteToContext(ctx);
77 dst2.WriteToContext(ctx);
78 ctx.Write(skippedSwap);
79 }
80
81 static void SendInputUserDataSwap(notnull InventoryLocation src1, notnull InventoryLocation src2, notnull InventoryLocation dst1, notnull InventoryLocation dst2, bool skippedSwap = false)
82 {
83 if (g_Game.IsClient())
84 {
85 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[syncinv] t=" + g_Game.GetTime() + "ms sending cmd=SWAP src1=" + InventoryLocation.DumpToStringNullSafe(src1) + " src2=" + InventoryLocation.DumpToStringNullSafe(src2) + " dst1=" + InventoryLocation.DumpToStringNullSafe(dst1) + " dst2=" + InventoryLocation.DumpToStringNullSafe(dst2));
87 SerializeSwap(ctx, src1, src2, dst1, dst2, skippedSwap);
88 ctx.Send();
89 }
90 }
91
92 static void SendServerSwap(notnull InventoryLocation src1, notnull InventoryLocation src2, notnull InventoryLocation dst1, notnull InventoryLocation dst2, bool skippedSwap = false)
93 {
94 if (g_Game.IsServer())
95 {
96 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[syncinv] server sending cmd=SWAP src1=" + InventoryLocation.DumpToStringNullSafe(src1) + " src2=" + InventoryLocation.DumpToStringNullSafe(src2) + " dst1=" + InventoryLocation.DumpToStringNullSafe(dst1) + " dst2=" + InventoryLocation.DumpToStringNullSafe(dst2));
98 SerializeSwap(ctx, src1, src2, dst1, dst2, skippedSwap);
99 GameInventory.ServerLocationSwap(src1, src2, dst1, dst2, ctx);
100 }
101 }
102
103
106 {
108 ctx.Write(InventoryCommandType.HAND_EVENT);
109 e.WriteToContext(ctx);
110 }
111
113 {
114 if (g_Game.IsClient())
115 {
116 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[syncinv] t=" + g_Game.GetTime() + "ms SendInputUserDataHandEvent e=" + e.DumpToString());
118 SerializeHandEvent(ctx, e);
119 ctx.Send();
120 }
121 }
122
123 static void SendServerHandEventViaInventoryCommand(notnull Man player, HandEventBase e)
124 {
125 // Warning: this uses NetworkMessageInventoryCommand
126 if (g_Game.IsServer())
127 {
128 if (e.IsServerSideOnly())
129 Error("[syncinv] SendServerHandEvent - called on server side event only, e=" + e.DumpToString());
130 if (player.IsAlive())
131 Error("[syncinv] SendServerHandEvent - called on living thing.. server hand command is only for dead people, e=" + e.DumpToString());
132 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[syncinv] SendServerHandEventViaInventoryCommand SendInputUserDataHandEvent e=" + e.DumpToString());
134 SerializeHandEvent(ctx, e);
135 GameInventory.ServerHandEvent(player, e.GetSrcEntity(), ctx);
136 }
137 }
138
139}
140
void syncDebugPrint(string s)
InventoryCommandType
const int INPUT_UDT_INVENTORY
const int INPUT_UDT_INVENTORY_CHECK
DayZGame g_Game
Определения DayZGame.c:3942
ERPCs
Определения ERPCs.c:2
Определения DayZPlayerImplement.c:87
static proto native bool ServerHandEvent(notnull Man player, notnull EntityAI item, ParamsWriteContext ctx)
hand event to clients
static proto native bool ServerLocationSwap(notnull InventoryLocation src1, notnull InventoryLocation src2, notnull InventoryLocation dst1, notnull InventoryLocation dst2, ParamsWriteContext ctx)
swaps two entities
static proto native bool ServerLocationSyncMoveEntity(Man player, notnull EntityAI item, ParamsWriteContext ctx)
synchronously removes item from current inventory location and adds it to destination + sync via inve...
script counterpart to engine's class Inventory
override bool IsServerSideOnly()
Определения Hand_Events.c:771
override string DumpToString()
Определения Hand_Events.c:338
override void WriteToContext(ParamsWriteContext ctx)
Определения Hand_Events.c:285
Abstracted event, not to be used, only inherited.
Определения Hand_Events.c:212
static void SerializeSwap(ParamsWriteContext ctx, notnull InventoryLocation src1, notnull InventoryLocation src2, notnull InventoryLocation dst1, notnull InventoryLocation dst2, bool skippedSwap)
swap
Определения InventoryInputUserData.c:70
static void SendServerMove(Man player, int type, notnull InventoryLocation src, notnull InventoryLocation dst)
Определения InventoryInputUserData.c:57
static void SendInputUserDataHandEvent(HandEventBase e)
Определения InventoryInputUserData.c:112
static void SendServerInventoryCheck(array< EntityAI > items, DayZPlayer player)
Определения InventoryInputUserData.c:44
static void SendInputUserDataMove(int type, notnull InventoryLocation src, notnull InventoryLocation dst)
Определения InventoryInputUserData.c:13
static void SendInputUserDataSwap(notnull InventoryLocation src1, notnull InventoryLocation src2, notnull InventoryLocation dst1, notnull InventoryLocation dst2, bool skippedSwap=false)
Определения InventoryInputUserData.c:81
static void SerializeHandEvent(ParamsWriteContext ctx, HandEventBase e)
hand
Определения InventoryInputUserData.c:105
static void SerializeInventoryCheckForItem(ParamsWriteContext ctx, EntityAI item)
Определения InventoryInputUserData.c:24
static void SerializeMove(ParamsWriteContext ctx, int type, notnull InventoryLocation src, notnull InventoryLocation dst)
move
Определения InventoryInputUserData.c:5
static void SendClientInventoryCheck(array< EntityAI > items)
Определения InventoryInputUserData.c:31
static void SendServerSwap(notnull InventoryLocation src1, notnull InventoryLocation src2, notnull InventoryLocation dst1, notnull InventoryLocation dst2, bool skippedSwap=false)
Определения InventoryInputUserData.c:92
static void SendServerHandEventViaInventoryCommand(notnull Man player, HandEventBase e)
Определения InventoryInputUserData.c:123
static string DumpToStringNullSafe(InventoryLocation loc)
Определения InventoryLocation.c:233
bool WriteToContext(ParamsWriteContext ctx)
Определения InventoryLocation.c:507
InventoryLocation.
Определения InventoryLocation.c:30
static bool IsSyncLogEnable()
Определения 3_Game/DayZ/tools/Debug.c:776
proto native void Send()
Определения gameplay.c:121
proto native void Send(Object target, int rpc_type, bool guaranteed, PlayerIdentity recipient=NULL)
Initiate remote procedure call. When called on client, RPC is evaluated on server; When called on ser...
Определения gameplay.c:105
proto bool Write(void value_out)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Serializer ParamsWriteContext
Определения gameplay.c:16
void Error(string err)
Messagebox with error message.
Определения EnDebug.c:90