DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
DayZPlayerSyncJunctures.c
См. документацию.
1// *************************************************************************************
2// ! DayZPlayerSyncJunctures - sync junctures for dayz player - static functions
3// *************************************************************************************
5{
6 static const int SJ_DAMAGE_HIT = 0;
7 static const int SJ_INJURY = 1;
8 static const int SJ_ACTION_INTERRUPT = 2;
9 static const int SJ_PLAYER_STATES = 3;
10 static const int SJ_QUICKBAR_SET_SHORTCUT = 4;
11 static const int SJ_INVENTORY = 5;
12 static const int SJ_ACTION_ACK_ACCEPT = 6;
13 static const int SJ_ACTION_ACK_REJECT = 7;
14 static const int SJ_WEAPON_ACTION_ACK_ACCEPT = 8;
15 static const int SJ_WEAPON_ACTION_ACK_REJECT = 9;
16 static const int SJ_WEAPON_SET_JAMMING_CHANCE = 10;
17 static const int SJ_UNCONSCIOUSNESS = 11;
18 static const int SJ_DEATH = 12;
19 static const int SJ_PLAYER_FB_MODIFIER = 13;
20 static const int SJ_PLAYER_ADD_MODIFIER = 14;
21 static const int SJ_KURU_REQUEST = 15;
22 static const int SJ_GESTURE_REQUEST = 16;
23 static const int SJ_INVENTORY_REPAIR = 17;
24 static const int SJ_WEAPON_LIFT = 18;
25 static const int SJ_WEAPON_RAISE_COMPLETED = 19;
26 static const int SJ_DELETE_ITEM = 20;
27 static const int SJ_BROKEN_LEGS = 21;
28 static const int SJ_SHOCK = 22;
29 static const int SJ_STAMINA = 23;
30 static const int SJ_STAMINA_MISC = 24;
31 static const int SJ_ADS_RESET = 25;
32 static const int SJ_INVENTORY_FAILURE = 26;
33 #ifdef DEVELOPER
34 static const int SJ_DEBUG_GET_IN_VEHICLE = 200;
35 #endif
36
37
38 #ifdef DEVELOPER
39 //-------------------------------------------------------------
43
44 static void SendGetInVehicle(DayZPlayer pPlayer, EntityAI vehicle)
45 {
47 ctx.Write(vehicle);
48 pPlayer.SendSyncJuncture(SJ_DEBUG_GET_IN_VEHICLE, ctx);
49 }
50
51 static bool ReadGetInVehicleParams(ParamsReadContext pCtx, out EntityAI vehicle)
52 {
53 if (!pCtx.Read(vehicle))
54 return false;
55
56 return true;
57 }
58 #endif
59
60 //-------------------------------------------------------------
64
65 static void SendDeath(DayZPlayer pPlayer, int pType, float pHitDir)
66 {
68
69 ctx.Write(pType);
70 ctx.Write(pHitDir);
71 pPlayer.SendSyncJuncture(SJ_DEATH, ctx);
72 }
73
74 static bool ReadDeathParams(ParamsReadContext pCtx, out int pType, out float pHitDir)
75 {
76 if (!pCtx.Read(pType))
77 return false;
78 if (!pCtx.Read(pHitDir))
79 return false;
80
81 return true;
82 }
83
84 //-------------------------------------------------------------
88
89 static void SendDamageHit(DayZPlayer pPlayer, int pType, float pHitDir, bool pFullbody)
90 {
92
93 ctx.Write(pType);
94 ctx.Write(pHitDir);
95 ctx.Write(pFullbody);
96 pPlayer.SendSyncJuncture(SJ_DAMAGE_HIT, ctx);
97 }
98
99 static void SendDamageHitEx(DayZPlayer pPlayer, int pType, float pHitDir, bool pFullbody, TotalDamageResult pDamageResult, int pDamageType, EntityAI pSource, string pComponent, string pAmmoType, vector pModelPos)
100 {
102 SyncHitInfo data = new SyncHitInfo;
103
104 data.m_AnimType = pType;
105 data.m_HitDir = pHitDir;
106 data.m_Fullbody = pFullbody;
107 data.m_HasSource = pSource != null;
108 if ( !pDamageResult )
109 {
110 data.m_HealthDamage = -1.0;
111 }
112 else
113 {
114 data.m_HealthDamage = pDamageResult.GetHighestDamage("Health");
115 }
116
117 ctx.Write(data);
118 pPlayer.SendSyncJuncture(SJ_DAMAGE_HIT, ctx);
119 }
120
121 static bool ReadDamageHitParams(ParamsReadContext pCtx, out int pType, out float pHitDir, out bool pFullbody)
122 {
123 if (!pCtx.Read(pType))
124 return false;
125 if (!pCtx.Read(pHitDir))
126 return false;
127 if (!pCtx.Read(pFullbody))
128 return false;
129 return true;
130 }
131
132 static bool ReadDamageHitParamsEx(ParamsReadContext pCtx, out SyncHitInfo pData)
133 {
134 if (!pCtx.Read(pData))
135 return false;
136 return true;
137 }
138
139 //-------------------------------------------------------------
143
144 static void SendInjury(DayZPlayer pPlayer, bool pEnable, eInjuryHandlerLevels level)
145 {
147 ctx.Write(pEnable);
148 ctx.Write(level);
149
150 pPlayer.SendSyncJuncture(SJ_INJURY, ctx);
151 }
152
153 static bool ReadInjuryParams(ParamsReadContext pCtx, out bool pEnable, out eInjuryHandlerLevels level)
154 {
155 if ( !pCtx.Read(pEnable) )
156 return false; // error
157 if ( !pCtx.Read(level) )
158 return false; // error
159
160 return true;
161 }
162
163 //-------------------------------------------------------------
167
168 static void SendPlayerUnconsciousness(DayZPlayer pPlayer, bool enable)
169 {
171
172 ctx.Write(enable);
173
174 pPlayer.SendSyncJuncture(SJ_UNCONSCIOUSNESS, ctx);
175 }
176
177 static bool ReadPlayerUnconsciousnessParams(ParamsReadContext pCtx, out bool enable)
178 {
179 if ( !pCtx.Read(enable) )
180 {
181 return false;
182 }
183 return true;
184 }
185
186 //-------------------------------------------------------------
190
191 static void SendPlayerFBModifier(PlayerBase pPlayer, int type)
192 {
194 ctx.Write(type);
195
196 pPlayer.SendSyncJuncture(SJ_PLAYER_FB_MODIFIER, ctx);
197 }
198
199 static bool ReadPlayerFBModifier(ParamsReadContext pCtx, out int type)
200 {
201 if ( !pCtx.Read(type) )
202 return false; // error
203 return true;
204 }
205
206 //-------------------------------------------------------------
210
211 static void SendPlayerSymptomADD(DayZPlayer pPlayer, int type, int state_type)
212 {
214 ctx.Write(state_type);
215 ctx.Write(type);
216
217
218 pPlayer.SendSyncJuncture(SJ_PLAYER_ADD_MODIFIER, ctx);
219 }
220
221 static bool ReadPlayerSymptomADDParams(ParamsReadContext pCtx, out int type)
222 {
223 if ( !pCtx.Read(type) )
224 return false; // error
225 return true;
226 }
227
228
229 //-------------------------------------------------------------
233
234 static void SendPlayerSymptomFB(DayZPlayer pPlayer, DayZPlayerConstants anim_id, int state_type, int stance_mask, float duration)
235 {
237 ctx.Write(state_type);
238 ctx.Write(anim_id);
239 ctx.Write(stance_mask);
240 ctx.Write(duration);
241 //ctx.Write(pPlayer);
242
243 pPlayer.SendSyncJuncture(SJ_PLAYER_STATES, ctx);
244 }
245
246 static bool ReadPlayerSymptomFBParams(ParamsReadContext pCtx, out DayZPlayerConstants anim_id, out int stance_mask, out float duration)
247 {
248 if ( !pCtx.Read(anim_id) )
249 return false; // error
250 if ( !pCtx.Read(stance_mask) )
251 return false; // error
252 if ( !pCtx.Read(duration) )
253 return false; // error
254 //if ( !pCtx.Read(pPlayer) )
255 //return false; // error
256 return true;
257 }
258
259
260 //-------------------------------------------------------------
264
265 static void SendActionInterrupt(DayZPlayer pPlayer)
266 {
268 pPlayer.SendSyncJuncture(SJ_ACTION_INTERRUPT, ctx);
269 }
270
272 {
273 return true;
274 }
275
276 //-------------------------------------------------------------
280 static void SendActionAcknowledgment(DayZPlayer pPlayer, int AckID, bool accept)
281 {
283 ctx.Write(AckID);
284 if (accept)
285 pPlayer.SendSyncJuncture(SJ_ACTION_ACK_ACCEPT, ctx);
286 else
287 pPlayer.SendSyncJuncture(SJ_ACTION_ACK_REJECT, ctx);
288 }
289
290
291 static void SendWeaponActionAcknowledgment(DayZPlayer pPlayer, int AckID, bool accept)
292 {
294 ctx.Write(AckID);
295 if (accept)
296 pPlayer.SendSyncJuncture(SJ_WEAPON_ACTION_ACK_ACCEPT, ctx);
297 else
298 pPlayer.SendSyncJuncture(SJ_WEAPON_ACTION_ACK_REJECT, ctx);
299 }
300
301 //-------------------------------------------------------------
305
306 static bool ReadKuruRequest(ParamsReadContext pCtx, out float amount)
307 {
308 if ( !pCtx.Read(amount) )
309 return false; // error
310 return true;
311 }
312
313 static void SendKuruRequest(DayZPlayer pPlayer, float amount)
314 {
316 ctx.Write(amount);
317 pPlayer.SendSyncJuncture(SJ_KURU_REQUEST, ctx);
318 }
319
320 //-------------------------------------------------------------
324
325 static void SendQuickbarSetShortcut(DayZPlayer pPlayer, EntityAI item, int index, bool force = false )
326 {
328 ctx.Write(item);
329 ctx.Write(index);
330 ctx.Write(force);
331
332 pPlayer.SendSyncJuncture(SJ_QUICKBAR_SET_SHORTCUT, ctx);
333 }
334
335 static void SendWeaponJamChance(DayZPlayer pPlayer, float jamChance )
336 {
338 ctx.Write(jamChance);
339
340 pPlayer.SendSyncJuncture(SJ_WEAPON_SET_JAMMING_CHANCE, ctx);
341 }
342
343 /*static bool ReadQuickbarSetShortcut(ParamsReadContext pCtx, out EntityAI item, out int index)
344 {
345 Param2<EntityAI,int> shortcutParam = new Param2<EntityAI,int>(NULL,-1);
346 if( pCtx.Read(shortcutParam))
347 {
348 item = shortcutParam.param1;
349 index = shortcutParam.param2;
350 return true;
351 }
352
353 return false;
354 }*/
355
356 static void SendDeleteItem( DayZPlayer pPlayer, EntityAI item )
357 {
359 ctx.Write(item);
360
361 pPlayer.SendSyncJuncture(SJ_DELETE_ITEM, ctx);
362 }
363
364
365 //-------------------------------------------------------------
369
370 static void SendBrokenLegs(DayZPlayer pPlayer, bool canPlaySound, eBrokenLegs currentState, eBrokenLegs localState)
371 {
373 ctx.Write(canPlaySound);
374 ctx.Write(currentState);
375 ctx.Write(localState);
376
377 pPlayer.SendSyncJuncture(SJ_BROKEN_LEGS, ctx);
378 }
379
380 static bool ReadBrokenLegsParams(ParamsReadContext pCtx, out bool canPlaySound, out eBrokenLegs currentState, out eBrokenLegs localState)
381 {
382 if ( !pCtx.Read(canPlaySound) )
383 return false; // error
384 if ( !pCtx.Read(currentState) )
385 return false; // error
386 if ( !pCtx.Read(localState) )
387 return false;
388
389 return true;
390 }
391
392 static void SendBrokenLegsEx(DayZPlayer pPlayer, int currentState)
393 {
395 ctx.Write(currentState);
396
397 pPlayer.SendSyncJuncture(SJ_BROKEN_LEGS, ctx);
398 }
399
400 static bool ReadBrokenLegsParamsEx(ParamsReadContext pCtx, out int currentState)
401 {
402 if ( !pCtx.Read(currentState) )
403 return false;
404
405 return true;
406 }
407
408 //-------------------------------------------------------------
412
413 static void SendShock(DayZPlayer pPlayer, float shockValue)
414 {
416 ctx.Write(shockValue);
417
418 pPlayer.SendSyncJuncture(SJ_SHOCK, ctx);
419 }
420
421 static bool ReadShockParams(ParamsReadContext pCtx, out float shockValue)
422 {
423 if ( !pCtx.Read(shockValue) )
424 return false; // error
425
426 return true;
427 }
428}
eBrokenLegs
Определения EBrokenLegs.c:2
eInjuryHandlerLevels
Определения InjuryHandler.c:19
static void SendDamageHitEx(DayZPlayer pPlayer, int pType, float pHitDir, bool pFullbody, TotalDamageResult pDamageResult, int pDamageType, EntityAI pSource, string pComponent, string pAmmoType, vector pModelPos)
Определения DayZPlayerSyncJunctures.c:99
static const int SJ_BROKEN_LEGS
Определения DayZPlayerSyncJunctures.c:27
static void SendWeaponJamChance(DayZPlayer pPlayer, float jamChance)
Определения DayZPlayerSyncJunctures.c:335
static const int SJ_DEATH
Определения DayZPlayerSyncJunctures.c:18
static void SendActionInterrupt(DayZPlayer pPlayer)
Определения DayZPlayerSyncJunctures.c:265
static const int SJ_ACTION_INTERRUPT
Определения DayZPlayerSyncJunctures.c:8
static void SendActionAcknowledgment(DayZPlayer pPlayer, int AckID, bool accept)
Определения DayZPlayerSyncJunctures.c:280
static const int SJ_PLAYER_STATES
Определения DayZPlayerSyncJunctures.c:9
static void SendKuruRequest(DayZPlayer pPlayer, float amount)
Определения DayZPlayerSyncJunctures.c:313
static void SendBrokenLegs(DayZPlayer pPlayer, bool canPlaySound, eBrokenLegs currentState, eBrokenLegs localState)
Определения DayZPlayerSyncJunctures.c:370
static bool ReadPlayerSymptomADDParams(ParamsReadContext pCtx, out int type)
Определения DayZPlayerSyncJunctures.c:221
static const int SJ_ACTION_ACK_REJECT
Определения DayZPlayerSyncJunctures.c:13
static const int SJ_WEAPON_LIFT
Определения DayZPlayerSyncJunctures.c:24
static const int SJ_PLAYER_FB_MODIFIER
Определения DayZPlayerSyncJunctures.c:19
static const int SJ_STAMINA
Определения DayZPlayerSyncJunctures.c:29
static const int SJ_INVENTORY_REPAIR
Определения DayZPlayerSyncJunctures.c:23
static void SendPlayerSymptomFB(DayZPlayer pPlayer, DayZPlayerConstants anim_id, int state_type, int stance_mask, float duration)
Определения DayZPlayerSyncJunctures.c:234
static bool ReadShockParams(ParamsReadContext pCtx, out float shockValue)
Определения DayZPlayerSyncJunctures.c:421
static bool ReadDamageHitParamsEx(ParamsReadContext pCtx, out SyncHitInfo pData)
Определения DayZPlayerSyncJunctures.c:132
static const int SJ_KURU_REQUEST
Определения DayZPlayerSyncJunctures.c:21
static void SendInjury(DayZPlayer pPlayer, bool pEnable, eInjuryHandlerLevels level)
Определения DayZPlayerSyncJunctures.c:144
static const int SJ_PLAYER_ADD_MODIFIER
Определения DayZPlayerSyncJunctures.c:20
static const int SJ_WEAPON_ACTION_ACK_REJECT
Определения DayZPlayerSyncJunctures.c:15
static const int SJ_SHOCK
Определения DayZPlayerSyncJunctures.c:28
static void SendDeleteItem(DayZPlayer pPlayer, EntityAI item)
Определения DayZPlayerSyncJunctures.c:356
static bool ReadKuruRequest(ParamsReadContext pCtx, out float amount)
Определения DayZPlayerSyncJunctures.c:306
static const int SJ_GESTURE_REQUEST
Определения DayZPlayerSyncJunctures.c:22
static bool ReadBrokenLegsParams(ParamsReadContext pCtx, out bool canPlaySound, out eBrokenLegs currentState, out eBrokenLegs localState)
Определения DayZPlayerSyncJunctures.c:380
static const int SJ_QUICKBAR_SET_SHORTCUT
Определения DayZPlayerSyncJunctures.c:10
static bool ReadBrokenLegsParamsEx(ParamsReadContext pCtx, out int currentState)
Определения DayZPlayerSyncJunctures.c:400
static void SendPlayerFBModifier(PlayerBase pPlayer, int type)
Определения DayZPlayerSyncJunctures.c:191
static const int SJ_INVENTORY_FAILURE
Определения DayZPlayerSyncJunctures.c:32
static void SendShock(DayZPlayer pPlayer, float shockValue)
Определения DayZPlayerSyncJunctures.c:413
static const int SJ_WEAPON_ACTION_ACK_ACCEPT
Определения DayZPlayerSyncJunctures.c:14
static const int SJ_UNCONSCIOUSNESS
Определения DayZPlayerSyncJunctures.c:17
static void SendDeath(DayZPlayer pPlayer, int pType, float pHitDir)
Определения DayZPlayerSyncJunctures.c:65
static const int SJ_DELETE_ITEM
Определения DayZPlayerSyncJunctures.c:26
static const int SJ_ADS_RESET
Определения DayZPlayerSyncJunctures.c:31
static void SendQuickbarSetShortcut(DayZPlayer pPlayer, EntityAI item, int index, bool force=false)
Определения DayZPlayerSyncJunctures.c:325
static void SendPlayerSymptomADD(DayZPlayer pPlayer, int type, int state_type)
Определения DayZPlayerSyncJunctures.c:211
static bool ReadDamageHitParams(ParamsReadContext pCtx, out int pType, out float pHitDir, out bool pFullbody)
Определения DayZPlayerSyncJunctures.c:121
static void SendDamageHit(DayZPlayer pPlayer, int pType, float pHitDir, bool pFullbody)
Определения DayZPlayerSyncJunctures.c:89
static const int SJ_WEAPON_SET_JAMMING_CHANCE
Определения DayZPlayerSyncJunctures.c:16
static bool ReadPlayerFBModifier(ParamsReadContext pCtx, out int type)
Определения DayZPlayerSyncJunctures.c:199
static bool ReadInjuryParams(ParamsReadContext pCtx, out bool pEnable, out eInjuryHandlerLevels level)
Определения DayZPlayerSyncJunctures.c:153
static void SendPlayerUnconsciousness(DayZPlayer pPlayer, bool enable)
Определения DayZPlayerSyncJunctures.c:168
static const int SJ_ACTION_ACK_ACCEPT
Определения DayZPlayerSyncJunctures.c:12
static const int SJ_DAMAGE_HIT
Определения DayZPlayerSyncJunctures.c:6
static bool ReadDeathParams(ParamsReadContext pCtx, out int pType, out float pHitDir)
Определения DayZPlayerSyncJunctures.c:74
static void SendWeaponActionAcknowledgment(DayZPlayer pPlayer, int AckID, bool accept)
Определения DayZPlayerSyncJunctures.c:291
static bool ReadActionInterruptParams(ParamsReadContext pCtx)
Определения DayZPlayerSyncJunctures.c:271
static bool ReadPlayerSymptomFBParams(ParamsReadContext pCtx, out DayZPlayerConstants anim_id, out int stance_mask, out float duration)
Определения DayZPlayerSyncJunctures.c:246
static const int SJ_WEAPON_RAISE_COMPLETED
Определения DayZPlayerSyncJunctures.c:25
static bool ReadPlayerUnconsciousnessParams(ParamsReadContext pCtx, out bool enable)
Определения DayZPlayerSyncJunctures.c:177
static void SendBrokenLegsEx(DayZPlayer pPlayer, int currentState)
Определения DayZPlayerSyncJunctures.c:392
static const int SJ_INJURY
Определения DayZPlayerSyncJunctures.c:7
static const int SJ_STAMINA_MISC
Определения DayZPlayerSyncJunctures.c:30
static const int SJ_INVENTORY
Определения DayZPlayerSyncJunctures.c:11
Определения Building.c:6
int m_AnimType
Определения SyncHitInfo.c:4
Определения PlayerBaseClient.c:2
Определения gameplay.c:152
proto bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetHighestDamage(string healthType)
Определения DamageSystem.c:2
Определения EnConvert.c:106
DayZPlayerConstants
defined in C++
Определения dayzplayer.c:602
Serializer ParamsReadContext
Определения gameplay.c:15