Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
plugindiagmenuclient.c
Go to the documentation of this file.
1 // For modding, see PluginDiagMenuModding.c
2 // !!! MODDING DISCLAIMER: These are debug functionality files, if you are thinking about modding the vanilla ones, do so at your own risk
3 // These files will not be maintained with the thought of "what if a modder modded this" (Excluding the modding functionality of course)
4 // Which is why the modding functionality was developed with the thought of the modded ones having their own isolated safe space
5 
7 {
8 #ifdef DIAG_DEVELOPER
9  static int m_SystemsMask;
10 
11  // Cheats
12  bool m_ModifiersEnabled = true;
13  int m_IsInvincible;
14  bool m_StaminaDisabled;
15 
16  // Misc
17  float m_Playtime;
18  bool m_LogPlayerStats;
19  Shape m_VehicleFreeAreaBox;
20  ref EnvDebugData m_EnvDebugData;
21  ref FallDamageDebugData m_FallDamageDebugData;
22 
23  override void OnInit()
24  {
25  super.OnInit();
26 
27  BindCallbacks();
28  }
29 
30  protected void BindCallbacks()
31  {
32  //---------------------------------------------------------------
33  // LEVEL 2 - Script > Crafting
34  //---------------------------------------------------------------
35  DiagMenu.BindCallback(DiagMenuIDs.CRAFTING_GENERATE, CBCraftingGenerate);
36  DiagMenu.BindCallback(DiagMenuIDs.CRAFTING_INSTANT, CBCraftingInstant);
37  DiagMenu.BindCallback(DiagMenuIDs.CRAFTING_DUMP, CBCraftingDump);
38 
39  //---------------------------------------------------------------
40  // LEVEL 2 - Script > Vehicles
41  //---------------------------------------------------------------
42  DiagMenu.BindCallback(DiagMenuIDs.VEHICLE_DEBUG_OUTPUT, CBVehicleDebugOutput);
43  DiagMenu.BindCallback(DiagMenuIDs.VEHICLE_DUMP_CRASH_DATA, CBDumpCrashData);
44 
45  //---------------------------------------------------------------
46  // LEVEL 2 - Script > Cheats
47  //---------------------------------------------------------------
48  DiagMenu.BindCallback(DiagMenuIDs.CHEATS_MODIFIERS, CBCheatsModifiers);
49  DiagMenu.BindCallback(DiagMenuIDs.CHEATS_KILL_PLAYER, CBCheatsKillPlayer);
50  DiagMenu.BindCallback(DiagMenuIDs.CHEATS_INVINCIBILITY, CBCheatsInvincibility);
51  DiagMenu.BindCallback(DiagMenuIDs.CHEATS_DISABLE_STAMINA, CBCheatsStaminaDisable);
52  DiagMenu.BindCallback(DiagMenuIDs.CHEATS_RESET_PLAYER, CBCheatsResetPlayer);
53  DiagMenu.BindCallback(DiagMenuIDs.CHEATS_RESET_PLAYER_MAX, CBCheatsResetPlayerMax);
54  DiagMenu.BindCallback(DiagMenuIDs.CHEATS_INVENTORY_ACCESS, CBCheatsInventoryAccess);
55  DiagMenu.BindCallback(DiagMenuIDs.CHEATS_FIX_ITEMS, CBCheatsFixItems);
56  DiagMenu.BindCallback(DiagMenuIDs.CHEATS_CREATE_HIT, CBCreateHit);
57  DiagMenu.BindCallback(DiagMenuIDs.CHEATS_CREATE_HIT_LIGHT, CBCreateHitLight);
58 
59  //---------------------------------------------------------------
60  // LEVEL 2 - Script > Player Agents
61  //---------------------------------------------------------------
62  DiagMenu.BindCallback(DiagMenuIDs.PLAYER_AGENTS_INJECTS_SHOW, CBPlayerAgentsInjectActions);
63 
64  //---------------------------------------------------------------
65  // LEVEL 2 - Script > Soft Skills
66  //---------------------------------------------------------------
67  DiagMenu.BindCallback(DiagMenuIDs.SOFT_SKILLS_SHOW_DEBUG, CBSoftSkillsShowDebug);
68  DiagMenu.BindCallback(DiagMenuIDs.SOFT_SKILLS_TOGGLE_STATE, CBSoftSkillsToggleState);
69  DiagMenu.BindCallback(DiagMenuIDs.SOFT_SKILLS_TOGGLE_MODEL, CBSoftSkillsToggleModel);
70  DiagMenu.BindCallback(DiagMenuIDs.SOFT_SKILLS_SPECIALTY_VALUE, CBSoftSkillsSpecialtyValue);
71 
72  //---------------------------------------------------------------
73  // LEVEL 2 - Script > Lifespan
74  //---------------------------------------------------------------
75  DiagMenu.BindCallback(DiagMenuIDs.LIFESPAN_BLOODY_HANDS, CBLifespanBloodyHands);
76  DiagMenu.BindCallback(DiagMenuIDs.LIFESPAN_PLAYTIME_UPDATE, CBLifespanPlaytimeUpdate);
77 
78  //---------------------------------------------------------------
79  // LEVEL 2 - Script > Misc
80  //---------------------------------------------------------------
81  DiagMenu.BindCallback(DiagMenuIDs.MISC_DISABLE_PERSONAL_LIGHT, CBMiscPersonalLight);
82  DiagMenu.BindCallback(DiagMenuIDs.MISC_ITEM_DEBUG_ACTIONS, CBMiscItemDebugActions); // Is enabled by default now
83  DiagMenu.BindCallback(DiagMenuIDs.MISC_LOG_PLAYER_STATS, CBMiscLogPlayerStats);
84  DiagMenu.BindCallback(DiagMenuIDs.MISC_FORCE_HINT_INDEX, CBMiscForceHintIndex);
85 
86  //---------------------------------------------------------------
87  // LEVEL 2 - Script > Misc -> Environment
88  //---------------------------------------------------------------
89  DiagMenu.BindCallback(DiagMenuIDs.MISC_ENVIRONMENT_DEBUG, CBMiscEnvironmentDebug);
90  DiagMenu.BindCallback(DiagMenuIDs.MISC_ENVIRONMENT_LOGGING_DRYWET, CBMiscEnvironmentLoggingDryWet);
91 
92  //---------------------------------------------------------------
93  // LEVEL 2 - Script > Misc
94  //---------------------------------------------------------------
95  DiagMenu.BindCallback(DiagMenuIDs.MISC_PERMANENT_CROSSHAIR, CBMiscPermanentCrossHair);
96  DiagMenu.BindCallback(DiagMenuIDs.MISC_TOGGLE_HUD, CBMiscToggleHud);
97  DiagMenu.BindCallback(DiagMenuIDs.MISC_FALLDAMAGE_DEBUG, CBMiscFallDamageDebug);
98  DiagMenu.BindCallback(DiagMenuIDs.MISC_DISPLAY_PLAYER_INFO, CBMiscDisplayPlayerInfo);
99  DiagMenu.BindCallback(DiagMenuIDs.MISC_UNIVERSAL_TEMPERATURE_SOURCES, CBMiscUniversalTemperatureSources);
100  DiagMenu.BindCallback(DiagMenuIDs.MISC_BULLET_IMPACT, CBMiscBulletImpact);
101  DiagMenu.BindCallback(DiagMenuIDs.MISC_GO_UNCONSCIOUS, CBMiscGoUnconscious);
102  DiagMenu.BindCallback(DiagMenuIDs.MISC_GO_UNCONSCIOUS_DELAYED, CBMiscGoUnconsciousDelayed);
103  DiagMenu.BindCallback(DiagMenuIDs.MISC_QUICK_RESTRAIN, CBMiscQuickRestrain);
104 
105  //---------------------------------------------------------------
106  // LEVEL 3 - Script > Misc > Hair Hiding
107  //---------------------------------------------------------------
108  DiagMenu.BindCallback(DiagMenuIDs.MISC_HAIR_LEVEL_HIDE, CBMiscHairHide);
109  DiagMenu.BindCallback(DiagMenuIDs.MISC_HAIR_HIDE_ALL, CBMiscHairHideAll);
110 
111  //---------------------------------------------------------------
112  // LEVEL 2 - Script > Misc
113  //---------------------------------------------------------------
114  DiagMenu.BindCallback(DiagMenuIDs.MISC_CAM_SHAKE, CBMiscCamShake);
115  DiagMenu.BindCallback(DiagMenuIDs.MISC_QUICK_FISHING, CBMiscQuickFishing);
116  DiagMenu.BindCallback(DiagMenuIDs.MISC_SHOCK_IMPACT, CBMiscShockImpact);
117  DiagMenu.BindCallback(DiagMenuIDs.MISC_SHOW_PLUG_ARROWS, CBMiscPlugArrows);
118  DiagMenu.BindCallback(DiagMenuIDs.MISC_TARGETABLE_BY_AI, CBMiscTargetableByAI);
119 
120  //---------------------------------------------------------------
121  // LEVEL 3 - Script > Misc > Hit Indication
122  //---------------------------------------------------------------
123  DiagMenu.BindCallback(DiagMenuIDs.MISC_HIT_INDICATION_DEBUG, CBMiscHitIndication);
124  DiagMenu.BindCallback(DiagMenuIDs.MISC_HIT_INDICATION_SPAWN_HIT, CBMiscHitIndicationSpawnHit);
125  DiagMenu.BindCallback(DiagMenuIDs.MISC_HIT_INDICATION_MODE, CBMiscHitIndication);
126  DiagMenu.BindCallback(DiagMenuIDs.MISC_HIT_INDICATION_TYPE, CBMiscHitIndication);
127  DiagMenu.BindCallback(DiagMenuIDs.MISC_HIT_INDICATION_DURATION, CBMiscHitIndication);
128  DiagMenu.BindCallback(DiagMenuIDs.MISC_HIT_INDICATION_BREAKPOINT, CBMiscHitIndication);
129  DiagMenu.BindCallback(DiagMenuIDs.MISC_HIT_INDICATION_DISTANCE, CBMiscHitIndication);
130  DiagMenu.BindCallback(DiagMenuIDs.MISC_HIT_INDICATION_ROTATION, CBMiscHitIndication);
131  DiagMenu.BindCallback(DiagMenuIDs.MISC_HIT_INDICATION_SCATTER, CBMiscHitIndication);
132  DiagMenu.BindCallback(DiagMenuIDs.MISC_HIT_INDICATION_DISABLE_PPE, CBMiscHitIndication);
133 
134  //---------------------------------------------------------------
135  // LEVEL 2 - Script > Misc
136  //---------------------------------------------------------------
137  DiagMenu.BindCallback(DiagMenuIDs.MISC_FREEZE_ENTITY, CBMiscFreezeEntity);
138  DiagMenu.BindCallback(DiagMenuIDs.MISC_DEBUG_MONITOR, CBDebugMonitor);
139 
140  //---------------------------------------------------------------
141  // LEVEL 2 - Script > Simulate script
142  //---------------------------------------------------------------
143  DiagMenu.BindCallback(DiagMenuIDs.SIMULATE_INFINITE_LOOP, CBSimulateInfiniteLoop);
144  DiagMenu.BindCallback(DiagMenuIDs.SIMULATE_NULL_POINTER, CBSimulateNullPointer);
145  DiagMenu.BindCallback(DiagMenuIDs.SIMULATE_DIVISION_BY_ZERO, CBSimulateDivisionByZero);
146  DiagMenu.BindCallback(DiagMenuIDs.SIMULATE_ERROR_FUNCTION, CBSimulateErrorFunction);
147 
148  //---------------------------------------------------------------
149  // LEVEL 2 - Script > Weapon
150  //---------------------------------------------------------------
151  DiagMenu.BindCallback(DiagMenuIDs.WEAPON_PARTICLES, CBWeaponParticles);
152  DiagMenu.BindCallback(DiagMenuIDs.WEAPON_AIM_NOISE, CBWeaponAimNoise);
153  DiagMenu.BindCallback(DiagMenuIDs.WEAPON_RECOIL, CBWeaponRecoil);
154  DiagMenu.BindCallback(DiagMenuIDs.WEAPON_UNLIMITED_AMMO, CBWeaponUnlimitedAmmo);
155  DiagMenu.BindCallback(DiagMenuIDs.WEAPON_BURST_VERSION, CBWeaponBurstVersion);
156 
157  //---------------------------------------------------------------
158  // LEVEL 2 - Script > Bleeding
159  //---------------------------------------------------------------
160  DiagMenu.BindCallback(DiagMenuIDs.BLEEDING_SOURCES, CBBleedingSources);
161  DiagMenu.BindCallback(DiagMenuIDs.BLEEDING_DISABLE_BLOOD_LOSS, CBBleedingDisableBloodLoss);
162  DiagMenu.BindCallback(DiagMenuIDs.BLEEDING_ACTIVATE_SOURCE, CBBleedingActivateSource);
163  DiagMenu.BindCallback(DiagMenuIDs.BLEEDING_ACTIVATE_ALL_SOURCES, CBBleedingActivateAllSources);
164  DiagMenu.BindCallback(DiagMenuIDs.BLEEDING_ACTIVATE_SOURCE_LEVEL, CBBleedingActivateSourceLevel);
165  DiagMenu.BindCallback(DiagMenuIDs.BLEEDING_RELOAD, CBBleedingReload);
166 
167  //---------------------------------------------------------------
168  // LEVEL 3 - Script > Bleeding > Bleeding Indication
169  //---------------------------------------------------------------
170  DiagMenu.BindCallback(DiagMenuIDs.BLEEDINGINDICATORS, CBBBleedingIndicators);
171  DiagMenu.BindCallback(DiagMenuIDs.BLEEDINGINDICATORS_USEVALUEOVERRIDES, CBBBleedingIndicators);
172  DiagMenu.BindCallback(DiagMenuIDs.BLEEDINGINDICATORS_DROP_RANDOMROTATION, CBBBleedingIndicators);
173  DiagMenu.BindCallback(DiagMenuIDs.BLEEDINGINDICATORS_SEQUENCE_DURATION, CBBBleedingIndicators);
174  DiagMenu.BindCallback(DiagMenuIDs.BLEEDINGINDICATORS_DROP_BASEDURATION, CBBBleedingIndicators);
175  DiagMenu.BindCallback(DiagMenuIDs.BLEEDINGINDICATORS_DROP_MINDELAY, CBBBleedingIndicators);
176  DiagMenu.BindCallback(DiagMenuIDs.BLEEDINGINDICATORS_DROP_MAXDELAY, CBBBleedingIndicators);
177  DiagMenu.BindCallback(DiagMenuIDs.BLEEDINGINDICATORS_DROP_PROGRESSTHRESHOLD, CBBBleedingIndicators);
178  DiagMenu.BindCallback(DiagMenuIDs.BLEEDINGINDICATORS_DROP_STARTSIZE, CBBBleedingIndicators);
179  DiagMenu.BindCallback(DiagMenuIDs.BLEEDINGINDICATORS_DROP_ENDSIZE, CBBBleedingIndicators);
180  DiagMenu.BindCallback(DiagMenuIDs.BLEEDINGINDICATORS_DROP_RNDSCALEMIN, CBBBleedingIndicators);
181  DiagMenu.BindCallback(DiagMenuIDs.BLEEDINGINDICATORS_DROP_RNDSCALEMAX, CBBBleedingIndicators);
182  DiagMenu.BindCallback(DiagMenuIDs.BLEEDINGINDICATORS_DROP_SCATTER, CBBBleedingIndicators);
183  DiagMenu.BindCallback(DiagMenuIDs.BLEEDINGINDICATORS_DROP_SLIDEDISTANCE, CBBBleedingIndicators);
184 
185  //---------------------------------------------------------------
186  // LEVEL 4 - Script > Bleeding > Bleeding Indication > Color Debug
187  //---------------------------------------------------------------
188  DiagMenu.BindCallback(DiagMenuIDs.BLEEDINGINDICATORS_DROP_COLOR_ENABLEDESATURATION, CBBBleedingIndicators);
189  DiagMenu.BindCallback(DiagMenuIDs.BLEEDINGINDICATORS_DROP_COLOR_DESATURATIONEND, CBBBleedingIndicators);
190  DiagMenu.BindCallback(DiagMenuIDs.BLEEDINGINDICATORS_DROP_COLOR_R, CBBBleedingIndicators);
191  DiagMenu.BindCallback(DiagMenuIDs.BLEEDINGINDICATORS_DROP_COLOR_G, CBBBleedingIndicators);
192  DiagMenu.BindCallback(DiagMenuIDs.BLEEDINGINDICATORS_DROP_COLOR_B, CBBBleedingIndicators);
193  DiagMenu.BindCallback(DiagMenuIDs.BLEEDINGINDICATORS_DROP_COLOR_A_START, CBBBleedingIndicators);
194  DiagMenu.BindCallback(DiagMenuIDs.BLEEDINGINDICATORS_DROP_COLOR_A_END, CBBBleedingIndicators);
195 
196  //---------------------------------------------------------------
197  // LEVEL 2 - Script > Logs
198  //---------------------------------------------------------------
199  DiagMenu.BindCallback(DiagMenuIDs.LOGS_ACTIONS, CBLogsActions);
200  DiagMenu.BindCallback(DiagMenuIDs.LOGS_WEAPONS, CBLogsWeapons);
201  DiagMenu.BindCallback(DiagMenuIDs.LOGS_SYNC, CBLogsSync);
202  DiagMenu.BindCallback(DiagMenuIDs.LOGS_BASEBUILDING, CBLogsBaseBuilding);
203  DiagMenu.BindCallback(DiagMenuIDs.LOGS_SYMPTOMS, CBLogsSymptoms);
204  DiagMenu.BindCallback(DiagMenuIDs.LOGS_BLEEDING_CHANCES, CBLogsBleedingChances);
205  DiagMenu.BindCallback(DiagMenuIDs.LOGS_QUICKBAR, CBLogsQuickbar);
206 
207  //---------------------------------------------------------------
208  // LEVEL 3 - Script > Logs > InventoryLogs
209  //---------------------------------------------------------------
210  DiagMenu.BindCallback(DiagMenuIDs.LOGS_INVENTORY_MOVE, CBLogsInventoryMove);
211  DiagMenu.BindCallback(DiagMenuIDs.LOGS_INVENTORY_RESERVATION, CBLogsInventoryReservation);
212  DiagMenu.BindCallback(DiagMenuIDs.LOGS_INVENTORY_HFSM, CBLogsInventoryHFSM);
213 
214  //---------------------------------------------------------------
215  // LEVEL 2 - Script > Triggers
216  //---------------------------------------------------------------
217  DiagMenu.BindCallback(DiagMenuIDs.TRIGGER_DEBUG, CBTriggerDebug);
218 
219  //---------------------------------------------------------------
220  // LEVEL 2 - Script > Base Building
221  //---------------------------------------------------------------
222  DiagMenu.BindCallback(DiagMenuIDs.BASEBUILDING_WOOD, CBBaseBuildingWood);
223  DiagMenu.BindCallback(DiagMenuIDs.BASEBUILDING_GATE, CBBaseBuildingGate);
224 
225  //---------------------------------------------------------------
226  // LEVEL 2 - Script > Finishers
227  //---------------------------------------------------------------
228  DiagMenu.BindCallback(DiagMenuIDs.FINISHERS_FINISHER_FORCED, CBFinishersFinisherForced);
229 
230  //---------------------------------------------------------------
231  // LEVEL 2 - Script > Cinematic Camera Tools
232  //---------------------------------------------------------------
233  DiagMenu.BindCallback(DiagMenuIDs.CAMERATOOLS_ENABLE_REMOTE_CAMERA, CBCameraToolsEnableRemoteCamera);
234  }
235 
236  //---------------------------------------------
237  override void OnRPC(PlayerBase player, int rpc_type, ParamsReadContext ctx)
238  {
239  super.OnRPC(player, rpc_type, ctx);
240 
241  switch (rpc_type)
242  {
243  case ERPCs.DIAG_MISC_ENVIRONMENT_DEBUG_DATA:
244  {
245  if (!m_EnvDebugData)
246  m_EnvDebugData = new EnvDebugData();
247 
248  ctx.Read(m_EnvDebugData);
249  break;
250  }
251 
252  case ERPCs.DIAG_MISC_FALLDAMAGE_DEBUG_DATA:
253  {
254  if (!m_FallDamageDebugData)
255  m_FallDamageDebugData = new FallDamageDebugData();
256 
257  ctx.Read(m_FallDamageDebugData);
258  break;
259  }
260 
261  case ERPCs.DIAG_VEHICLES_DUMP_CRASH_DATA_CONTENTS:
262  {
263  Param1<array<ref CrashDebugData>> par = new Param1<array<ref CrashDebugData>>(null);
264 
265  if (ctx.Read(par))
266  CrashDebugData.DumpDataArray(par.param1);
267  break;
268  }
269  }
270  }
271 
272  //---------------------------------------------
273  override void OnUpdate(float delta_time)
274  {
275  super.OnUpdate(delta_time);
276 
277  //---------------------------------------------
278  // every system can handle their own actions locally(within the system itself),
279  // this section is for systems which don't have client side representation,
280  // or don't have their own tick, or for whatever other reason you prefer to put the logic here
281  // PUT ONLY METHOD CALLS HERE, NO CODE !!
282  // PUT ONLY METHOD CALLS HERE, NO CODE !!
283  //---------------------------------------------
284 
285  UpdateMiscVehicleGetOutBox();
286  UpdateEnvironmentDebug();
287  CheckTimeAccel();
288  }
289 
290  //---------------------------------------------
291  void CheckTimeAccel()
292  {
293  if (!FeatureTimeAccel.m_CurrentTimeAccel)
294  {
295  InitTimeAccel();
296  }
297 
298  if (GetGame() && GetGame().GetPlayer())
299  {
300  TimeAccelParam param = GetTimeAccelMenuState();
301 
302  if (!FeatureTimeAccel.AreTimeAccelParamsSame(param, FeatureTimeAccel.m_CurrentTimeAccel))
303  {
304  int timeAccelBig = param.param2;
305  float timeAccelSmall = param.param2 - timeAccelBig;
306  FeatureTimeAccel.CopyTimeAccelClipboard(param.param1, timeAccelBig, timeAccelSmall, param.param3 );
307  FeatureTimeAccel.SendTimeAccel(GetGame().GetPlayer(), param);
308  FeatureTimeAccel.m_CurrentTimeAccel = param;
309  }
310  }
311 
312  }
313 
314  //---------------------------------------------
315  static void CBCraftingGenerate(bool enabled, int id)
316  {
317  PluginRecipesManager pluginRecipesManager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
318  DiagButtonAction(enabled, id, ScriptCaller.Create(pluginRecipesManager.CallbackGenerateCache));
319  }
320 
321  //---------------------------------------------
322  static void CBCraftingInstant(bool enabled)
323  {
324  PluginRecipesManager pluginRecipesManager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
325  DiagToggleRPC(enabled, pluginRecipesManager.IsEnableDebugCrafting(), ERPCs.DIAG_CRAFTING_INSTANT);
326  }
327 
328  //---------------------------------------------
329  static void CBCraftingDump(bool enabled, int id)
330  {
331  PluginRecipesManager pluginRecipesManager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
332  DiagButtonAction(enabled, id, ScriptCaller.Create(pluginRecipesManager.GenerateHumanReadableRecipeList));
333  }
334 
335  //---------------------------------------------
336  static void CBCheatsModifiers(bool enabled)
337  {
339  DiagToggleRPCServer(enabled, pluginDiag.m_ModifiersEnabled, ERPCs.DIAG_CHEATS_MODIFIERS);
340  }
341 
342  //---------------------------------------------
343  static void CBCheatsKillPlayer(bool enabled, int id)
344  {
345  DiagButtonRPC(enabled, id, ERPCs.DIAG_CHEATS_KILL_PLAYER, true);
346  }
347 
348  //---------------------------------------------
349  static void CBCheatsInvincibility(int value)
350  {
352  DiagToggleRPCServer(value, pluginDiag.m_IsInvincible, ERPCs.DIAG_CHEATS_INVINCIBILITY);
353  }
354 
355  //---------------------------------------------
356  static void CBCheatsStaminaDisable(bool enabled)
357  {
358  PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
359  if (player)
360  player.SetStaminaDisabled(enabled);
361 
363  DiagToggleRPCServer(enabled, pluginDiag.m_StaminaDisabled, ERPCs.DIAG_CHEATS_DISABLE_STAMINA);
364  }
365 
366  //---------------------------------------------
367  static void CBCheatsResetPlayer(bool enabled, int id)
368  {
369  PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
370  if (player)
371  player.ResetPlayer(false);
372  DiagButtonRPC(enabled, id, ERPCs.DIAG_CHEATS_RESET_PLAYER, true);
373  }
374 
375  //---------------------------------------------
376  static void CBCheatsResetPlayerMax(bool enabled, int id)
377  {
378  PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
379  if (player)
380  player.ResetPlayer(true);
381  DiagButtonRPC(enabled, id, ERPCs.DIAG_CHEATS_RESET_PLAYER_MAX, true);
382  }
383 
384  //---------------------------------------------
385  static void CBCheatsInventoryAccess(bool enabled)
386  {
387  DiagToggleRPCServer(enabled, PlayerBase.DEBUG_INVENTORY_ACCESS, ERPCs.DIAG_CHEATS_INVENTORY_ACCESS);
388  }
389 
390  //---------------------------------------------
391  static void CBCheatsFixItems(bool enabled, int id)
392  {
393  DiagButtonRPC(enabled, id, ERPCs.DIAG_CHEATS_ITEMS_FIX, true);
394  }
395 
396  static void CBCreateHit(bool enabled, int id)
397  {
398  DiagButtonRPC(enabled, id, ERPCs.DIAG_CHEATS_CREATE_HIT, true);
399  }
400 
401  static void CBCreateHitLight(bool enabled, int id)
402  {
403  DiagButtonRPC(enabled, id, ERPCs.DIAG_CHEATS_CREATE_HIT_LIGHT, true);
404  }
405 
406  //---------------------------------------------
407  static void CBPlayerAgentsInjectActions(bool enabled)
408  {
409  DiagDebugAction(DebugActionType.PLAYER_AGENTS, enabled);
410  }
411 
412  //---------------------------------------------
413  static void CBSoftSkillsShowDebug(bool enabled)
414  {
415  SoftSkillsManager ssMngr = GetPlayer().GetSoftSkillsManager();
416  DiagToggleRPCAction(enabled, ScriptCaller.Create(ssMngr.CreateDebugWindow), ssMngr.IsDebug(), ERPCs.DIAG_SOFT_SKILLS_SHOW_DEBUG);
417  }
418 
419  //---------------------------------------------
420  static void CBSoftSkillsToggleState(bool enabled)
421  {
422  SoftSkillsManager ssMngr = GetPlayer().GetSoftSkillsManager();
423  DiagToggleRPC(enabled, ssMngr.GetSoftSkillsState(), ERPCs.DIAG_SOFT_SKILLS_TOGGLE_STATE);
424  }
425 
426  //---------------------------------------------
427  static void CBSoftSkillsToggleModel(bool enabled)
428  {
429  SoftSkillsManager ssMngr = GetPlayer().GetSoftSkillsManager();
430  DiagToggleRPC(enabled, ssMngr.IsLinear(), ERPCs.DIAG_SOFT_SKILLS_TOGGLE_MODEL);
431  }
432 
433  //---------------------------------------------
434  static void CBSoftSkillsSpecialtyValue(float value)
435  {
436  SoftSkillsManager ssMngr = GetPlayer().GetSoftSkillsManager();
437  DiagToggleRPC(value, ssMngr.GetSpecialtyLevel(), ERPCs.DIAG_SOFT_SKILLS_SPECIALTY_VALUE);
438  }
439 
440  //---------------------------------------------
441  static void CBLifespanBloodyHands(bool enabled)
442  {
443  PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
444  if (player)
445  DiagToggleRPCServer(enabled, player.HasBloodyHands(), ERPCs.DIAG_LIFESPAN_BLOODY_HANDS);
446  }
447 
448  //---------------------------------------------
449  static void CBLifespanPlaytimeUpdate(float value)
450  {
452  DiagToggleRPCServer(value * 60, pluginDiag.m_Playtime, ERPCs.DIAG_LIFESPAN_PLAYTIME_UPDATE);
453  }
454 
455  //---------------------------------------------
456  static void CBMiscPersonalLight(bool enabled)
457  {
458  PlayerBaseClient.m_PersonalLightDisabledByDebug = enabled;
459  PlayerBaseClient.UpdatePersonalLight();
460  }
461 
462  //---------------------------------------------
463  static void CBMiscItemDebugActions(bool enabled)
464  {
465  DiagDebugAction(DebugActionType.GENERIC_ACTIONS, enabled);
466  }
467 
468  //---------------------------------------------
469  static void CBMiscLogPlayerStats(bool enabled)
470  {
472  DiagToggleRPC(enabled, pluginDiag.m_LogPlayerStats, ERPCs.DIAG_MISC_LOG_PLAYER_STATS);
473  }
474 
475  //---------------------------------------------
476  static void CBMiscForceHintIndex(int index)
477  {
478  UiHintPanel.m_ForcedIndex = index;
479  }
480 
481  //---------------------------------------------
482  static void CBMiscPermanentCrossHair(bool enabled)
483  {
484  PluginPermanentCrossHair crosshair = PluginPermanentCrossHair.Cast(GetPlugin(PluginPermanentCrossHair));
485  crosshair.SwitchPermanentCrossHair(enabled);
486  }
487 
488  //---------------------------------------------
489  void UpdateMiscVehicleGetOutBox()
490  {
491  if ( DiagMenu.GetBool(DiagMenuIDs.MISC_VEHICLE_GETOUT_BOX) )
492  {
493  if (m_VehicleFreeAreaBox)
494  {
495  m_VehicleFreeAreaBox.Destroy();
496  m_VehicleFreeAreaBox = null;
497  }
498 
499  HumanCommandVehicle hcv = GetGame().GetPlayer().GetCommand_Vehicle();
500  if (!hcv)
501  return;
502 
503  m_VehicleFreeAreaBox = hcv.GetTransport().DebugFreeAreaAtDoor( hcv.GetVehicleSeat() );
504  }
505  else if (m_VehicleFreeAreaBox)
506  {
507  m_VehicleFreeAreaBox.Destroy();
508  m_VehicleFreeAreaBox = null;
509  }
510  }
511 
512  //---------------------------------------------
513  static void CBMiscToggleHud(bool enabled)
514  {
515  Mission mission = GetGame().GetMission();
516  mission.GetHud().Show(!enabled);
517  if (enabled)
518  {
519  mission.HideCrosshairVisibility();
520  }
521  else
522  {
523  mission.RefreshCrosshairVisibility();
524  }
525  }
526 
527  //---------------------------------------------
528  static void CBMiscEnvironmentDebug(bool enabled)
529  {
530  SendDiagRPC(enabled, ERPCs.DIAG_MISC_ENVIRONMENT_DEBUG);
531  }
532 
533  void UpdateEnvironmentDebug()
534  {
535  if (DiagMenu.GetBool(DiagMenuIDs.MISC_ENVIRONMENT_DEBUG) && m_EnvDebugData)
536  Environment.DisplayEnvDebugPlayerInfo(true, m_EnvDebugData);
537  else if (m_EnvDebugData)
538  m_EnvDebugData = null;
539  }
540 
541  static void CBMiscEnvironmentLoggingDryWet(bool enabled)
542  {
543  SendDiagRPC(enabled, ERPCs.DIAG_MISC_ENVIRONMENT_LOGGING_DRYWET);
544  }
545 
546  static void CBMiscFallDamageDebug(bool enabled)
547  {
548  SendDiagRPC(enabled, ERPCs.DIAG_MISC_FALLDAMAGE_DEBUG);
549  }
550 
551  void UpdateFallDamageDebug()
552  {
553  if (DiagMenu.GetBool(DiagMenuIDs.MISC_FALLDAMAGE_DEBUG) && m_FallDamageDebugData)
554  DayZPlayerImplementFallDamage.DisplayFallDamageDebugInfo(true, m_FallDamageDebugData);
555  else if (m_FallDamageDebugData)
556  m_FallDamageDebugData = null;
557  }
558 
559  //---------------------------------------------
560  static void CBMiscDisplayPlayerInfo(int value)
561  {
562  PluginRemotePlayerDebugClient prpdc = PluginRemotePlayerDebugClient.Cast(GetPlugin(PluginRemotePlayerDebugClient));
563  prpdc.RequestPlayerInfo(PlayerBase.Cast(GetGame().GetPlayer()), value);
564  }
565 
566  //---------------------------------------------
567  static void CBMiscUniversalTemperatureSources(bool enabled)
568  {
569  PluginUniversalTemperatureSourceClient client = PluginUniversalTemperatureSourceClient.Cast(GetPlugin(PluginUniversalTemperatureSourceClient));
570  client.RequestUniversalTemperatureSources(PlayerBase.Cast(GetGame().GetPlayer()), enabled);
571  }
572 
573  //---------------------------------------------
574  static void CBMiscBulletImpact(bool enabled, int id)
575  {
576  PlayerBase player = GetPlayer();
577  CachedObjectsParams.PARAM2_FLOAT_FLOAT.param1 = 32;
578  CachedObjectsParams.PARAM2_FLOAT_FLOAT.param2 = 0.3;
579  DiagButtonActionParams(enabled, id, ScriptCaller.Create(player.SpawnDamageDealtEffect2), CachedObjectsParams.PARAM2_FLOAT_FLOAT);
580  }
581 
582  //---------------------------------------------
583  static void CBMiscGoUnconscious(bool enabled, int id)
584  {
585  DiagButtonRPC(enabled, id, ERPCs.DIAG_MISC_GO_UNCONSCIOUS, true);
586  }
587 
588  //---------------------------------------------
589  static void CBMiscGoUnconsciousDelayed(bool enabled, int id)
590  {
591  DiagButtonRPC(enabled, id, ERPCs.DIAG_MISC_GO_UNCONSCIOUS_DELAYED, true);
592  }
593 
594  //---------------------------------------------
595  static void CBMiscQuickRestrain(bool enabled)
596  {
597  PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
598  DiagToggleRPC(enabled, player.IsQuickRestrain(), ERPCs.DIAG_MISC_QUICK_RESTRAIN);
599  }
600 
601  //---------------------------------------------
602  static void CBMiscHairHide(bool enabled, int id)
603  {
604  int value = DiagMenu.GetRangeValue(DiagMenuIDs.MISC_HAIR_LEVEL);
605  DiagButtonRPCIntInt(enabled, id, value, enabled, ERPCs.DIAG_MISC_HAIR_LEVEL_HIDE, true);
606  }
607 
608  //---------------------------------------------
609  static void CBMiscHairHideAll(bool enabled)
610  {
611  CachedObjectsParams.PARAM2_INT_INT.param1 = -1;
612  CachedObjectsParams.PARAM2_INT_INT.param2 = enabled;
613 
614  SendDiagRPC(CachedObjectsParams.PARAM2_INT_INT, ERPCs.DIAG_MISC_HAIR_LEVEL_HIDE, true);
615  }
616 
617  //---------------------------------------------
618  static void CBMiscCamShake(bool enabled, int id)
619  {
620  DayZPlayerCamera cam = GetGame().GetPlayer().GetCurrentCamera();
621  DiagButtonAction(enabled, id, ScriptCaller.Create(cam.SpawnDiagCameraShake));
622  }
623 
624  //---------------------------------------------
625  static void CBMiscQuickFishing(bool enabled)
626  {
627  PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
628  DiagToggleRPC(enabled, player.IsQuickFishing(), ERPCs.DIAG_MISC_QUICK_FISHING);
629  }
630 
631  //---------------------------------------------
632  static void CBMiscShockImpact(bool enabled, int id)
633  {
634  DiagButtonAction(enabled, id, ScriptCaller.Create(ShockImpact));
635  }
636 
637  static void ShockImpact()
638  {
639  static float intensity;
640  intensity += 0.25;
641  intensity = Math.WrapFloat(intensity, 0.25, 1);
642 
643  PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
644  player.SpawnShockEffect(intensity);
645  }
646 
647  //---------------------------------------------
648  static void CBMiscPlugArrows(bool enabled)
649  {
650  GetGame().EnableEMPlugs(enabled);
651  }
652 
653  //---------------------------------------------
654  static void CBMiscTargetableByAI(bool enabled, int id)
655  {
656  PlayerBase player = GetPlayer();
657  if (player)
658  DiagToggleRPC(enabled, player.m_CanBeTargetedDebug, ERPCs.DIAG_MISC_TARGETABLE_BY_AI);
659  }
660 
661  //---------------------------------------------
662  static void CBMiscHitIndication()
663  {
664  PlayerBase player = GetPlayer();
665 
666  if (DiagMenu.GetBool(DiagMenuIDs.MISC_HIT_INDICATION_DEBUG))
667  {
668  HitDirectionEffectBase.m_Mode = DiagMenu.GetValue(DiagMenuIDs.MISC_HIT_INDICATION_MODE);
669  HitDirectionEffectBase.m_ID = DiagMenu.GetValue(DiagMenuIDs.MISC_HIT_INDICATION_TYPE);
670  HitDirectionEffectBase.m_DurationMax = DiagMenu.GetRangeValue(DiagMenuIDs.MISC_HIT_INDICATION_DURATION);
671  HitDirectionEffectBase.m_BreakPointBase = DiagMenu.GetRangeValue(DiagMenuIDs.MISC_HIT_INDICATION_BREAKPOINT);
672  HitDirectionEffectBase.m_DistanceAdjust = DiagMenu.GetRangeValue(DiagMenuIDs.MISC_HIT_INDICATION_DISTANCE);
673  HitDirectionEffectBase.m_RotationOverride = DiagMenu.GetRangeValue(DiagMenuIDs.MISC_HIT_INDICATION_ROTATION);
674  HitDirectionEffectBase.m_Scatter = DiagMenu.GetRangeValue(DiagMenuIDs.MISC_HIT_INDICATION_SCATTER);
675 
676  if (player)
677  {
678  player.SetHitPPEEnabled(!DiagMenu.GetBool(DiagMenuIDs.MISC_HIT_INDICATION_DISABLE_PPE));
679  }
680  }
681  else
682  {
683  HitDirectionEffectBase.CheckValues();
684  if (player)
685  {
686  player.SetHitPPEEnabled(CfgGameplayHandler.GetHitIndicationPPEEnabled());
687  }
688  }
689  }
690 
691  //---------------------------------------------
692  static void CBMiscHitIndicationSpawnHit(bool enabled, int id)
693  {
694  DiagButtonAction(enabled, id, ScriptCaller.Create(SpawnHitDirEffect));
695  }
696 
697  static void SpawnHitDirEffect()
698  {
699  PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
700  GetGame().GetMission().GetHud().SpawnHitDirEffect(player, DiagMenu.GetRangeValue(DiagMenuIDs.MISC_HIT_INDICATION_SPAWN_HIT_DIRECTION), 1.0);
701  }
702 
703  //---------------------------------------------
704  static void CBDebugMonitor(bool enabled, int id)
705  {
706  SendDiagRPC(enabled, ERPCs.DIAG_MISC_DEBUG_MONITOR, true);
707 
708  if (enabled)
709  GetGame().GetMission().CreateDebugMonitor();
710  else
711  GetGame().GetMission().HideDebugMonitor();
712  }
713 
714  //---------------------------------------------
715  static void CBMiscFreezeEntity(bool enabled, int id)
716  {
717  DiagButtonAction(enabled, id, ScriptCaller.Create(FreezeEntity));
718  }
719 
720  static void FreezeEntity()
721  {
722  EntityAI entity;
723  if (PluginSceneManager.GetInstance() && PluginSceneManager.GetInstance().IsOpened())
724  {
725  // Scene Editor
726  SceneObject scene_obj = PluginSceneManager.GetInstance().GetSelectedSceneObject();
727 
728  if (scene_obj)
729  {
730  entity = scene_obj.GetObject();
731  }
732  }
733  else
734  {
735  // FreeDebugCamera
736  FreeDebugCamera camera = FreeDebugCamera.GetInstance();
737  entity = EntityAI.Cast(camera.GetCrosshairObject());
738  }
739 
740  if (entity)
741  entity.DisableSimulation(!entity.GetIsSimulationDisabled());
742  }
743 
744  //---------------------------------------------
745  static void CBVehicleDebugOutput(int value)
746  {
747 
748  int bitValue = 0;
749  if (value == 1)//"Basic"
750  {
751  bitValue = EVehicleDebugOutputType.DAMAGE_APPLIED;
752  }
753  if (value == 2)//"Extended"
754  {
755  bitValue = EVehicleDebugOutputType.DAMAGE_APPLIED | EVehicleDebugOutputType.DAMAGE_CONSIDERED;
756  }
757  else if (value == 3)//"Contact"
758  {
759  bitValue = EVehicleDebugOutputType.CONTACT;
760  }
761  else if (value == 4)//"Basic" + "Contact"
762  {
763  bitValue = EVehicleDebugOutputType.DAMAGE_APPLIED | EVehicleDebugOutputType.CONTACT;
764  }
765  SendDiagRPC(bitValue, ERPCs.DIAG_VEHICLE_DEBUG_OUTPUT, true);
766  }
767 
768  //---------------------------------------------
769  static void CBDumpCrashData(bool value)
770  {
771  if (value)
772  {
773  SendDiagRPC(true, ERPCs.DIAG_VEHICLES_DUMP_CRASH_DATA_REQUEST, true);
774  DiagMenu.SetValue(DiagMenuIDs.VEHICLE_DUMP_CRASH_DATA, 0);
775  }
776  //DiagButtonRPC(value, DiagMenuIDs.VEHICLE_DUMP_CRASH_DATA, ERPCs.DIAG_VEHICLES_DUMP_CRASH_DATA_REQUEST, true);
777 
778  }
779 
780  //---------------------------------------------
781  static void SimulateMode(bool enabled, int id, int rpc)
782  {
783  int value = DiagMenu.GetRangeValue(DiagMenuIDs.SIMULATE_MODE);
784 
785  switch (value)
786  {
787  case 0:
788  {
789  DiagButtonRPC(enabled, id, rpc, true);
790  break;
791  }
792  case 1:
793  {
794  DiagButtonRPCSelf(enabled, id, rpc);
795  break;
796  }
797  case 2:
798  {
799  DiagButtonRPC(enabled, id, rpc, true);
800  DiagButtonRPCSelf(enabled, id, rpc);
801  break;
802  }
803  }
804  }
805 
806  //---------------------------------------------
807  static void CBSimulateInfiniteLoop(bool enabled, int id)
808  {
809  SimulateMode(enabled, id, ERPCs.DIAG_SIMULATE_INFINITE_LOOP);
810  }
811 
812  //---------------------------------------------
813  static void CBSimulateNullPointer(bool enabled, int id)
814  {
815  SimulateMode(enabled, id, ERPCs.DIAG_SIMULATE_NULL_POINTER);
816  }
817 
818  //---------------------------------------------
819  static void CBSimulateDivisionByZero(bool enabled, int id)
820  {
821  SimulateMode(enabled, id, ERPCs.DIAG_SIMULATE_DIVISION_BY_ZERO);
822  }
823 
824  //---------------------------------------------
825  static void CBSimulateErrorFunction(bool enabled, int id)
826  {
827  SimulateMode(enabled, id, ERPCs.DIAG_SIMULATE_ERROR_FUNCTION);
828  }
829 
830  //---------------------------------------------
831  static void CBWeaponParticles(bool enabled)
832  {
833  DiagToggleRPCServer(enabled, PrtTest.m_GunParticlesState, ERPCs.DIAG_WEAPON_PARTICLES);
834  }
835 
836  //---------------------------------------------
837  static void CBWeaponDebug(bool enabled)
838  {
839  PlayerBase player = GetPlayer();
840  DiagToggleAction(enabled, ScriptCaller.Create(player.ShowWeaponDebug), player.IsWeaponDebugEnabled());
841  }
842 
843  //---------------------------------------------
844  static void CBWeaponAimNoise(bool enabled)
845  {
846  PlayerBase player = GetPlayer();
847  if (player)
848  {
849  DayZPlayerImplementAiming aimModel = player.GetAimingModel();
850  DiagToggleAction(enabled, ScriptCaller.Create(aimModel.SetAimNoiseAllowed), aimModel.IsAimNoiseAllowed());
851  }
852  }
853 
854  //---------------------------------------------
855  static void CBWeaponRecoil(bool enabled)
856  {
857  PlayerBase player = GetPlayer();
858  if (player)
859  {
860  DayZPlayerImplementAiming aimModel = player.GetAimingModel();
861  DiagToggleRPC(enabled, aimModel.IsProceduralRecoilEnabled(), ERPCs.DIAG_WEAPON_RECOIL);
862  }
863  }
864 
865  //---------------------------------------------
866  static void CBWeaponUnlimitedAmmo(bool enabled)
867  {
868  DiagDebugAction(DebugActionType.UNLIMITED_AMMO, enabled);
869  }
870 
871  //---------------------------------------------
872  static void CBWeaponBurstVersion(int value)
873  {
874  PlayerBase player = GetPlayer();
875  WeaponManager wpnMngr = player.GetWeaponManager();
876  DiagToggleRPC(value, wpnMngr.GetBurstOption(), ERPCs.DIAG_WEAPON_BURST_VERSION);
877  }
878 
879  //---------------------------------------------
880  static void CBBleedingSources(bool enabled)
881  {
882  PlayerBase player = GetPlayer();
883  player.GetBleedingManagerRemote().SetDiag(enabled);
884  }
885 
886  //---------------------------------------------
887  static void CBBleedingDisableBloodLoss(bool enabled)
888  {
889  SendDiagRPC(enabled, ERPCs.DIAG_BLEEDING_DISABLE_BLOOD_LOSS, true);
890  }
891 
892  //---------------------------------------------
893  static void CBBleedingActivateSource(int value)
894  {
895  SendDiagRPC(value, ERPCs.DIAG_BLEEDING_ACTIVATE_SOURCE, true);
896  }
897 
898  //---------------------------------------------
899  static void CBBleedingActivateAllSources(bool enabled, int id)
900  {
901  DiagButtonRPC(enabled, id, ERPCs.DIAG_BLEEDING_ACTIVATE_ALL_SOURCES, true);
902  }
903 
904  //---------------------------------------------
905  static void CBBleedingActivateSourceLevel(int value)
906  {
907  PlayerBase player = GetPlayer();
908  BleedingSourcesManagerBase mgr = player.GetBleedingManagerRemote();
909 
910  int idx = 100; //invalid index, just deletes all
911  if (value != 0)
912  {
913  string bone = ""; //lower-case!
914  switch (value)
915  {
916  case 1: //PlayerConstants.BLEEDING_SOURCE_FLOW_MODIFIER_LOW
917  bone = "lefttoebase";
918  break;
919 
920  case 2: //PlayerConstants.BLEEDING_SOURCE_FLOW_MODIFIER_MEDIUM
921  bone = "leftarm";
922  break;
923 
924  case 3: //PlayerConstants.BLEEDING_SOURCE_FLOW_MODIFIER_HIGH
925  bone = "neck";
926  break;
927  }
928 
929  int count = mgr.m_BleedingSourceZone.Count();
930 
931  for (int i = 0; i < count; ++i)
932  {
933  if (mgr.m_BleedingSourceZone.GetKey(i) == bone)
934  {
935  idx = i;
936  break;
937  }
938  }
939  }
940 
941  CBBleedingActivateSource(idx);
942  }
943 
944  //---------------------------------------------
945  static void CBBleedingReload(bool enabled, int id)
946  {
947  PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
948  BleedingSourcesManagerRemote bsMngrRem = player.GetBleedingManagerRemote();
949  DiagButtonAction(enabled, id, ScriptCaller.Create(bsMngrRem.Reload));
950  }
951 
952  //---------------------------------------------
953  static void CBBBleedingIndicators()
954  {
955  bool diagEnable = DiagMenu.GetBool(DiagMenuIDs.BLEEDINGINDICATORS);
956  if (diagEnable != DbgBleedingIndicationStaticInfo.m_DbgEnableBleedingIndication)
957  {
958  DbgBleedingIndicationStaticInfo.m_DbgEnableBleedingIndication = diagEnable;
959  PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
960  if (player && player.GetBleedingManagerRemote())
961  {
962  player.GetBleedingManagerRemote().Reload();
963  }
964  }
965 
966  DbgBleedingIndicationStaticInfo.m_DbgUseOverrideValues = DiagMenu.GetBool(DiagMenuIDs.BLEEDINGINDICATORS_USEVALUEOVERRIDES);
967 
968  if (DbgBleedingIndicationStaticInfo.m_DbgUseOverrideValues)
969  {
970  DbgBleedingIndicationStaticInfo.m_DbgSequenceDuration = DiagMenu.GetRangeValue(DiagMenuIDs.BLEEDINGINDICATORS_SEQUENCE_DURATION);
971  DbgBleedingIndicationStaticInfo.m_DbgDropRotationRandom = DiagMenu.GetBool(DiagMenuIDs.BLEEDINGINDICATORS_DROP_RANDOMROTATION);
972  DbgBleedingIndicationStaticInfo.m_DbgDropDurationBase = DiagMenu.GetRangeValue(DiagMenuIDs.BLEEDINGINDICATORS_DROP_BASEDURATION);
973  DbgBleedingIndicationStaticInfo.m_DbgDropMinDelay = DiagMenu.GetRangeValue(DiagMenuIDs.BLEEDINGINDICATORS_DROP_MINDELAY);
974  DbgBleedingIndicationStaticInfo.m_DbgDropMaxDelay = DiagMenu.GetRangeValue(DiagMenuIDs.BLEEDINGINDICATORS_DROP_MAXDELAY);
975  DbgBleedingIndicationStaticInfo.m_DbgDropProgressTreshold = DiagMenu.GetRangeValue(DiagMenuIDs.BLEEDINGINDICATORS_DROP_PROGRESSTHRESHOLD);
976  DbgBleedingIndicationStaticInfo.m_DbgDropStartSize = DiagMenu.GetRangeValue(DiagMenuIDs.BLEEDINGINDICATORS_DROP_STARTSIZE);
977  DbgBleedingIndicationStaticInfo.m_DbgDropEndSize = DiagMenu.GetRangeValue(DiagMenuIDs.BLEEDINGINDICATORS_DROP_ENDSIZE);
978  DbgBleedingIndicationStaticInfo.m_DbgDropSizeVariationMin = DiagMenu.GetRangeValue(DiagMenuIDs.BLEEDINGINDICATORS_DROP_RNDSCALEMIN);
979  DbgBleedingIndicationStaticInfo.m_DbgDropSizeVariationMax = DiagMenu.GetRangeValue(DiagMenuIDs.BLEEDINGINDICATORS_DROP_RNDSCALEMAX);
980  DbgBleedingIndicationStaticInfo.m_DbgDropScatter = (int)DiagMenu.GetRangeValue(DiagMenuIDs.BLEEDINGINDICATORS_DROP_SCATTER);
981  DbgBleedingIndicationStaticInfo.m_DbgDropSlideDistance = DiagMenu.GetRangeValue(DiagMenuIDs.BLEEDINGINDICATORS_DROP_SLIDEDISTANCE);
982 
983  DbgBleedingIndicationStaticInfo.m_DbgDropDesaturate = DiagMenu.GetBool(DiagMenuIDs.BLEEDINGINDICATORS_DROP_COLOR_ENABLEDESATURATION);
984  DbgBleedingIndicationStaticInfo.m_DbgDesaturationEnd = DiagMenu.GetRangeValue(DiagMenuIDs.BLEEDINGINDICATORS_DROP_COLOR_DESATURATIONEND);
985  DbgBleedingIndicationStaticInfo.m_DbgDropColorRed = (int)DiagMenu.GetRangeValue(DiagMenuIDs.BLEEDINGINDICATORS_DROP_COLOR_R);
986  DbgBleedingIndicationStaticInfo.m_DbgDropColorGreen = (int)DiagMenu.GetRangeValue(DiagMenuIDs.BLEEDINGINDICATORS_DROP_COLOR_G);
987  DbgBleedingIndicationStaticInfo.m_DbgDropColorBlue = (int)DiagMenu.GetRangeValue(DiagMenuIDs.BLEEDINGINDICATORS_DROP_COLOR_B);
988  DbgBleedingIndicationStaticInfo.m_DbgDropColorAlphaStart = (int)DiagMenu.GetRangeValue(DiagMenuIDs.BLEEDINGINDICATORS_DROP_COLOR_A_START);
989  DbgBleedingIndicationStaticInfo.m_DbgDropColorAlphaEnd = (int)DiagMenu.GetRangeValue(DiagMenuIDs.BLEEDINGINDICATORS_DROP_COLOR_A_END);
990  }
991  }
992 
993  //---------------------------------------------
994  static void CBLogsActions(bool enabled)
995  {
996  DiagToggleRPC(enabled, LogManager.IsActionLogEnable(), ERPCs.DIAG_LOGS_ACTIONS);
997  }
998 
999  //---------------------------------------------
1000  static void CBLogsWeapons(bool enabled)
1001  {
1002  DiagToggleRPC(enabled, LogManager.IsWeaponLogEnable(), ERPCs.DIAG_LOGS_WEAPONS);
1003  }
1004 
1005  //---------------------------------------------
1006  static void CBLogsSync(bool enabled)
1007  {
1008  DiagToggleRPC(enabled, LogManager.IsSyncLogEnable(), ERPCs.DIAG_LOGS_SYNC);
1009  }
1010 
1011  //---------------------------------------------
1012  static void CBLogsBaseBuilding(bool enabled)
1013  {
1014  DiagToggleRPC(enabled, LogManager.IsBaseBuildingLogEnable(), ERPCs.DIAG_LOGS_BASEBUILDING);
1015  }
1016 
1017  //---------------------------------------------
1018  static void CBLogsSymptoms(bool enabled)
1019  {
1020  DiagToggleRPC(enabled, LogManager.IsSymptomLogEnable(), ERPCs.DIAG_LOGS_SYMPTOMS);
1021  }
1022 
1023  //---------------------------------------------
1024  static void CBLogsInventoryMove(bool enabled)
1025  {
1026  DiagToggleRPC(enabled, LogManager.IsInventoryMoveLogEnable(), ERPCs.DIAG_LOGS_INVENTORY_MOVE);
1027  }
1028 
1029  //---------------------------------------------
1030  static void CBLogsInventoryReservation(bool enabled)
1031  {
1032  DiagToggleRPC(enabled, LogManager.IsInventoryReservationLogEnable(), ERPCs.DIAG_LOGS_INVENTORY_RESERVATION);
1033  }
1034 
1035  //---------------------------------------------
1036  static void CBLogsInventoryHFSM(bool enabled)
1037  {
1038  DiagToggleRPC(enabled, LogManager.IsInventoryHFSMLogEnable(), ERPCs.DIAG_LOGS_INVENTORY_HFSM);
1039  }
1040 
1041  //---------------------------------------------
1042  static void CBLogsQuickbar(bool enabled)
1043  {
1044  DiagToggleRPC(enabled, LogManager.IsQuickbarLogEnable(), ERPCs.DIAG_LOGS_QUICKBAR);
1045  }
1046 
1047  //---------------------------------------------
1048  static void CBLogsBleedingChances(bool enabled)
1049  {
1050  DiagToggleRPC(enabled, LogManager.IsBleedingChancesLogEnable(), ERPCs.DIAG_LOGS_BLEEDING_CHANCES);
1051  }
1052 
1053  //---------------------------------------------
1054  static void CBTriggerDebug(bool enabled)
1055  {
1056  EnableDebugSystemClient(ESubscriberSystems.TRIGGERS, enabled);
1057  }
1058 
1059  //---------------------------------------------
1060  static void CBBaseBuildingWood(bool enabled)
1061  {
1062  SendDiagRPC(enabled, ERPCs.DIAG_BASEBUILDING_WOOD, true);
1063  }
1064 
1065  //---------------------------------------------
1066  static void CBBaseBuildingGate(bool enabled)
1067  {
1068  SendDiagRPC(enabled, ERPCs.DIAG_BASEBUILDING_GATE, true);
1069  }
1070 
1071  //---------------------------------------------
1072  static void CBFinishersFinisherForced(int value)
1073  {
1074  PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
1075  DiagToggleRPC(value - 1, player.GetMeleeCombat().DebugGetForcedFinisherType(), ERPCs.DIAG_FINISHERS_FORCE_FINISHER);
1076  }
1077 
1078  //---------------------------------------------
1079  static void CBCameraToolsEnableRemoteCamera(bool enabled)
1080  {
1081  PlayerBase player = GetPlayer();
1082 
1083  if (!player)
1084  return;
1085 
1086  if (!enabled && player.m_CameraToolsMenuClient)
1087  {
1088  player.m_CameraToolsMenuClient.DelayedDestroy();
1089  }
1090 
1091  auto param = new Param2<bool, EntityAI>(enabled, GetGame().GetPlayer());
1092  GetGame().RPCSingleParam( null, ERPCs.DIAG_CAMERATOOLS_CAM_SUBSCRIBE, param, true );
1093  }
1094 
1095  //---------------------------------------------
1096  // Misc
1097  //---------------------------------------------
1098  static PlayerBase GetPlayer()
1099  {
1100  if (!GetGame())
1101  return null;
1102 
1103  PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
1104 
1105  if (DiagMenu.GetBool(DiagMenuIDs.MISC_ACTION_ON_CURSOR))
1106  {
1107  float hitFraction;
1108  vector start = GetGame().GetCurrentCameraPosition();
1109  vector end = start + (GetGame().GetCurrentCameraDirection() * 5.0);
1110 
1111  vector hitPos, hitNormal;
1112  Object hitObj;
1113 
1114  PhxInteractionLayers hitMask = 0xFFFFFFFFFF;
1115 
1116  DayZPhysics.RayCastBullet(start, end, hitMask, null, hitObj, hitPos, hitNormal, hitFraction);
1117  Class.CastTo(player, hitObj);
1118  }
1119 
1120  return player;
1121  }
1122 
1123  //---------------------------------------------
1124  // DebugAction
1125  //---------------------------------------------
1126  static void DiagDebugAction(DebugActionType type, bool enable)
1127  {
1128  int mask;
1129  if (enable)
1130  {
1131  mask = (ItemBase.GetDebugActionsMask() | type);
1132  }
1133  else
1134  {
1135  mask = (ItemBase.GetDebugActionsMask() & (~type));
1136  }
1137 
1138  DiagToggleRPCAction(mask, ScriptCaller.Create(ItemBase.SetDebugActionsMask), ItemBase.HasDebugActionsMask(type), ERPCs.DIAG_ITEM_DEBUG_ACTIONS);
1139  }
1140 
1141  //---------------------------------------------
1142  // SubscriberClient
1143  //---------------------------------------------
1144  static void EnableDebugSystemClient(ESubscriberSystems system, bool enable)
1145  {
1146  int mask;
1147  if (enable)
1148  {
1149  mask = (m_SystemsMask | system);//turn on bit
1150  }
1151  else
1152  {
1153  mask = (m_SystemsMask & (~system));//turn off bit
1154  }
1155 
1156  if (mask != m_SystemsMask)
1157  {
1158  CachedObjectsParams.PARAM1_INT.param1 = mask;
1159  GetGame().RPCSingleParam( GetGame().GetPlayer(), ERPCs.DEV_DIAGMENU_SUBSCRIBE, CachedObjectsParams.PARAM1_INT, true, GetGame().GetPlayer().GetIdentity() );
1160  m_SystemsMask = mask;
1161  }
1162  }
1163 
1164 
1165  //---------------------------------------------
1166  // Helper diag functions
1167  //---------------------------------------------
1168  static void DiagButtonActionParams(bool enabled, int id, ScriptCaller action, Param params)
1169  {
1170  if ( enabled )
1171  {
1172  action.Invoke(params);
1173  DiagMenu.SetValue(id, false);
1174  }
1175  }
1176 
1177  //---------------------------------------------
1178  static void DiagButtonAction(bool enabled, int id, ScriptCaller action)
1179  {
1180  DiagButtonActionParams(enabled, id, action, null);
1181  }
1182 
1183  //---------------------------------------------
1184  static void DiagButtonRPC(bool enabled, int id, int rpc, bool serverOnly = false)
1185  {
1186  ScriptCaller action = ScriptCaller.Create(SendDiagRPCBasic);
1187  SendDiagRPCBasicParam params = new SendDiagRPCBasicParam(rpc, serverOnly);
1188 
1189  DiagButtonActionParams(enabled, id, action, params);
1190  }
1191 
1192  //---------------------------------------------
1193  static void DiagButtonRPCSelf(bool enabled, int id, int rpc)
1194  {
1195  ScriptCaller action = ScriptCaller.Create(SendDiagRPCSelfBasic);
1196  SendDiagRPCSelfBasicParam params = new SendDiagRPCSelfBasicParam(rpc);
1197 
1198  DiagButtonActionParams(enabled, id, action, params);
1199  }
1200 
1201  //---------------------------------------------
1202  static void DiagButtonRPCIntInt(bool enabled, int id, int value, int value2, int rpc, bool serverOnly = false)
1203  {
1204  ScriptCaller action = ScriptCaller.Create(SendDiagRPCParam);
1205 
1206  CachedObjectsParams.PARAM2_INT_INT.param1 = value;
1207  CachedObjectsParams.PARAM2_INT_INT.param2 = value2;
1208  SendDiagRPCParamParam params = new SendDiagRPCParamParam(rpc, serverOnly, CachedObjectsParams.PARAM2_INT_INT);
1209 
1210  DiagButtonActionParams(enabled, id, action, params);
1211  }
1212 
1213  //---------------------------------------------
1214  static void DiagToggleRPC(bool value, int current, int rpc)
1215  {
1216  if (value != current)
1217  {
1218  SendDiagRPC(value, rpc, false);
1219  }
1220  }
1221 
1222  //---------------------------------------------
1223  static void DiagToggleRPC(int value, int current, int rpc)
1224  {
1225  if (value != current)
1226  {
1227  SendDiagRPC(value, rpc, false);
1228  }
1229  }
1230 
1231  //---------------------------------------------
1232  static void DiagToggleRPC(float value, int current, int rpc)
1233  {
1234  if (value != current)
1235  {
1236  SendDiagRPC(value, rpc, false);
1237  }
1238  }
1239 
1240  //---------------------------------------------
1241  static void DiagToggleRPCServer(bool value, out bool current, int rpc)
1242  {
1243  if (value != current)
1244  {
1245  current = value;
1246  SendDiagRPC(value, rpc, true);
1247  }
1248  }
1249 
1250  //---------------------------------------------
1251  static void DiagToggleRPCServer(int value, out int current, int rpc)
1252  {
1253  if (value != current)
1254  {
1255  current = value;
1256  SendDiagRPC(value, rpc, true);
1257  }
1258  }
1259 
1260  //---------------------------------------------
1261  static void DiagToggleRPCServer(float value, out float current, int rpc)
1262  {
1263  if (value != current)
1264  {
1265  current = value;
1266  SendDiagRPC(value, rpc, true);
1267  }
1268  }
1269 
1270  //---------------------------------------------
1271  static void DiagToggleRPCAction(int value, ScriptCaller action, int current, int rpc)
1272  {
1273  if (value != current)
1274  {
1275  SendDiagRPC(value, rpc);
1276  action.Invoke(value);
1277  }
1278  }
1279 
1280  //---------------------------------------------
1281  static void DiagToggleAction(int value, ScriptCaller action, int current)
1282  {
1283  if (value != current)
1284  {
1285  action.Invoke(value);
1286  }
1287  }
1288 
1289  //---------------------------------------------
1290  static void SendDiagRPCSelf(Param value, int rpc)
1291  {
1292  PlayerBase player = GetPlayer();
1293  if (player)
1294  {
1295  GetGame().RPCSelfSingleParam(player, rpc, value);
1296  }
1297  }
1298 
1299  //---------------------------------------------
1300  static void SendDiagRPCSelfBasic(SendDiagRPCSelfBasicParam param)
1301  {
1302  SendDiagRPCSelf(null, param.param1);
1303  }
1304 
1305  //---------------------------------------------
1306  static void SendDiagRPCSelfParam(SendDiagRPCSelfParamParam param)
1307  {
1308  SendDiagRPCSelf(param.param2, param.param1);
1309  }
1310 
1311  //---------------------------------------------
1312  static void SendDiagRPC(Param value, int rpc, bool serverOnly = false)
1313  {
1314  PlayerBase player = GetPlayer();
1315  if (player)
1316  {
1317  PlayerIdentity playerIdentity = player.GetIdentity();
1318  if (GetGame().IsMultiplayer() && playerIdentity)
1319  {
1320  GetGame().RPCSingleParam(player, rpc, value, true, playerIdentity);
1321  }
1322 
1323  if (!GetGame().IsMultiplayer() || !serverOnly)
1324  {
1325  GetGame().RPCSelfSingleParam(player, rpc, value);
1326  }
1327  }
1328  }
1329 
1330  //---------------------------------------------
1331  static void SendDiagRPCBasic(SendDiagRPCBasicParam param)
1332  {
1333  SendDiagRPC(null, param.param1, param.param2);
1334  }
1335 
1336  //---------------------------------------------
1337  static void SendDiagRPCParam(SendDiagRPCParamParam param)
1338  {
1339  SendDiagRPC(param.param3, param.param1, param.param2);
1340  }
1341 
1342  //---------------------------------------------
1343  static void SendDiagRPC(int rpc, bool serverOnly = false)
1344  {
1345  SendDiagRPC(null, rpc, serverOnly);
1346  }
1347 
1348  //---------------------------------------------
1349  static void SendDiagRPC(bool value, int rpc, bool serverOnly = false)
1350  {
1351  CachedObjectsParams.PARAM1_BOOL.param1 = value;
1352  SendDiagRPC(CachedObjectsParams.PARAM1_BOOL, rpc, serverOnly);
1353  }
1354 
1355  //---------------------------------------------
1356  static void SendDiagRPC(int value, int rpc, bool serverOnly = false)
1357  {
1358  CachedObjectsParams.PARAM1_INT.param1 = value;
1359  SendDiagRPC(CachedObjectsParams.PARAM1_INT, rpc, serverOnly);
1360  }
1361 
1362  //---------------------------------------------
1363  static void SendDiagRPC(float value, int rpc, bool serverOnly = false)
1364  {
1365  CachedObjectsParams.PARAM1_FLOAT.param1 = value;
1366  SendDiagRPC(CachedObjectsParams.PARAM1_FLOAT, rpc, serverOnly);
1367  }
1368 #endif
1369 }
ItemBase
Definition: inventoryitem.c:730
Param2
Definition: ppeconstants.c:66
GetGame
proto native CGame GetGame()
mission
Mission mission
Definition: displaystatus.c:28
ScriptCaller
DayZIntroScene ScriptCaller
Designed to hold 1 valid call.
PluginDiagMenuClient
Definition: plugindiagmenuclient.c:6
LogManager
Definition: debug.c:734
Mission
Mission class.
Definition: gameplay.c:670
Param
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition: param.c:11
SoftSkillsManager
Definition: softskillsmanager.c:1
DiagMenu
Definition: endebug.c:232
DayZPlayerCamera
class DayZPlayerCameraResult DayZPlayerCamera(DayZPlayer pPlayer, HumanInputController pInput)
Definition: dayzplayer.c:56
BleedingSourcesManagerBase
Definition: bleedingsourcesmanagerbase.c:1
SceneObject
Definition: sceneobject.c:1
CachedObjectsParams
Definition: utilityclasses.c:9
DayZPlayerImplementAiming
Definition: dayzplayerimplementaiming.c:31
UiHintPanel
void UiHintPanel(Widget parent_widget)
Definition: uihintpanel.c:30
DebugActionType
DebugActionType
Definition: plugindiagmenu.c:6
GetPlugin
PluginBase GetPlugin(typename plugin_type)
Definition: pluginmanager.c:316
Serializer
Serialization general interface. Serializer API works with:
Definition: serializer.c:55
OnRPC
void OnRPC(ParamsReadContext ctx)
Definition: displaystatus.c:216
PlayerIdentity
The class that will be instanced (moddable)
Definition: gameplay.c:377
DiagMenuIDs
DiagMenuIDs
Definition: ediagmenuids.c:1
PlayerBase
Definition: playerbaseclient.c:1
vector
Definition: enconvert.c:105
OnUpdate
proto native void OnUpdate()
Definition: tools.c:349
DbgBleedingIndicationStaticInfo
static info (non-constants)
Definition: bleedingindicationstaticinfo.c:2
Object
Definition: objecttyped.c:1
Environment
Definition: environment.c:1
DayZPlayerImplementFallDamage
void DayZPlayerImplementFallDamage(DayZPlayer pPlayer)
Definition: dayzplayerimplementfalldamage.c:73
HumanCommandVehicle
Definition: human.c:689
CfgGameplayHandler
Definition: cfggameplayhandler.c:1
HitDirectionEffectBase
Definition: hitdirectionarrow.c:2
PrtTest
Definition: gameplay.c:1496
int
Param3 int
GetPlayer
protected void GetPlayer()
Definition: crosshairselector.c:127
DayZPhysics
Definition: dayzphysics.c:123
ERPCs
ERPCs
Definition: erpcs.c:1
OnInit
void OnInit()
Definition: aibehaviour.c:49
Math
Definition: enmath.c:6
PlayerBaseClient
Definition: survivorbase.c:1
Class
Super root of all classes in Enforce script.
Definition: enscript.c:10
PluginDiagMenu
Definition: plugindiagmenu.c:29
EntityAI
Definition: building.c:5
PhxInteractionLayers
PhxInteractionLayers
Definition: dayzphysics.c:1
Shape
class DiagMenu Shape
don't call destructor directly. Use Destroy() instead
WeaponManager
Definition: weaponmanager.c:1