DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
ScriptConsole.c
Go to the documentation of this file.
1typedef Param3<string, bool, bool> PresetParams;// param1 - ??, param2 - ??, param3 - ??
2typedef Param5<bool, string, int, string, int> ConfigParams; // param1 - isCollapsed, param2 - string name, param3 - num of childs, param4 - path, param5 - deep
3typedef Param6<bool, string, int, string, int, string> ConfigParamsEx; // param1 - isCollapsed, param2 - string name, param3 - num of childs, param4 - path, param5 - deep
4
5class ScriptConsole extends UIScriptedMenu
6{
7 static ScriptConsole m_This;
10 const string DEFAULT_POS_XYZ = "<1,2,3>";
11 protected ref map<CheckBoxWidget, int> m_ClassCheckboxes = new map<CheckBoxWidget, int>;
14 const string CONST_DEFAULT_PRESET_PREFIX = "[Default]";
15 static float DEBUG_MAP_ZOOM = 1;
16 static int ITEMS_SELECTED_ROW = -1;
17 static int PRESETS_SELECTED_ROW = 0;
19 static int m_ObjectsScope = 2;
20 static bool SHOW_OTHERS = 0;
21 static bool CLEAR_IVN;
22 static float DRAW_DISTANCE = 1000;
23 static ref array<Shape> m_DebugShapes = new array<Shape>;
25
26 ref array<Object> m_VicinityItems = new array<Object>;
29 ref TStringArray m_BaseConfigClasses = new TStringArray;
30 ref TStringArray m_BaseConfigClassesToggled = new TStringArray;
32 ref array<Widget> m_CategoryButtonsWidgets = new array<Widget>;
33 ref array<string> m_CategoryButtonsNames = {"FIREARMS","MELEE","ATTACHMENTS","MAGAZINES","AMMO","FOOD","MEDICAL","CARS","BACKPACKS"};
34 SliderWidget m_TimeSlider;
35 ref Timer m_LateInit = new Timer();
41 protected static ref array<ref MapMarker> m_MarkedEntities = new array<ref MapMarker>();
42
43 static ref TStringArray m_ScriptOutputHistory = new TStringArray();
44
45 ref Timer m_RefreshFilterTimer = new Timer();
46
48 {
49 m_This = this;
50 m_ModuleLocalEnscriptHistory = PluginLocalEnscriptHistory.Cast(GetPlugin(PluginLocalEnscriptHistory));
51 m_ModuleLocalEnscriptHistoryServer = PluginLocalEnscriptHistoryServer.Cast(GetPlugin(PluginLocalEnscriptHistoryServer));
52 #ifndef SERVER
53 if (GetGame() && GetGame().GetMission() && GetGame().GetMission().GetHud())
54 {
57 }
58 #endif
59 }
60
62 {
63 #ifndef SERVER
64 if (GetGame() && GetGame().GetMission() && GetGame().GetMission().GetHud())
65 {
68 }
69 #endif
70 SEffectManager.DestroyEffect(m_SoundSet);
71 if (m_PreviewEntity)
72 {
73 m_PreviewEntity.Delete();
74 }
75 DEBUG_MAP_ZOOM = m_DebugMapWidget.GetScale();
76
77 ITEMS_SELECTED_ROW = m_ObjectsTextListbox.GetSelectedRow();
78 PRESETS_SELECTED_ROW = m_PresetsTextListbox.GetSelectedRow();
79 ITEMS_IN_PRESET_SELECTED_ROW = m_PresetItemsTextListbox.GetSelectedRow();
80
81 m_PresetsTextListbox.ClearItems();
82
83 PluginRemotePlayerDebugClient plugin_remote_client = PluginRemotePlayerDebugClient.Cast(GetPlugin(PluginRemotePlayerDebugClient));
84 if (SHOW_OTHERS && plugin_remote_client)
85 plugin_remote_client.RequestPlayerInfo(PlayerBase.Cast(GetGame().GetPlayer()), 0);
86
88 {
89 m_ConfigDebugProfile.SetItemCategoryFlag(m_CategoryMask);
90 }
91
92 if (m_ItemDisagPlugin)
93 m_ItemDisagPlugin.OnScriptMenuOpened(false);
94
95 if (GetGame() && GetGame().GetMission())
96 {
98 }
99
100 m_RefreshFilterTimer.Stop();
101 }
102
103 override Widget Init()
104 {
105 Debug.GetBaseConfigClasses(m_BaseConfigClasses);
106
107 int i;
108 layoutRoot = GetGame().GetWorkspace().CreateWidgets("gui/layouts/script_console/script_console.layout");
109
110 m_ButtonsWindowWidget = layoutRoot.FindAnyWidget("TabButtons");
111 m_ButtonsWindowWidget.Show(true);
112
113 m_DebugMapWidget = MapWidget.Cast(layoutRoot.FindAnyWidget("MapWidget"));
114
115 m_Tabs[TAB_ITEMS] = layoutRoot.FindAnyWidget("ItemsPanel");
116 m_Tabs[TAB_CONFIGS] = layoutRoot.FindAnyWidget("ConfigsPanel");
117 m_Tabs[TAB_ENSCRIPT] = layoutRoot.FindAnyWidget("EnScriptPanel");
118 m_Tabs[TAB_ENSCRIPT_SERVER] = layoutRoot.FindAnyWidget("EnScriptPanel");
119 m_Tabs[TAB_GENERAL] = layoutRoot.FindAnyWidget("GeneralPanel");
120 m_Tabs[TAB_OUTPUT] = layoutRoot.FindAnyWidget("OutputPanel");
121 m_Tabs[TAB_VICINITY] = layoutRoot.FindAnyWidget("VicinityPanel");
122 m_Tabs[TAB_SOUNDS] = layoutRoot.FindAnyWidget("SoundsPanel");
123 m_Tabs[TAB_WEATHER] = layoutRoot.FindAnyWidget("WeatherPanel");
124
125 m_Tab_buttons[TAB_ITEMS] = ButtonWidget.Cast(layoutRoot.FindAnyWidget("ItemsButtonWidget"));
126 m_Tab_buttons[TAB_CONFIGS] = ButtonWidget.Cast(layoutRoot.FindAnyWidget("ConfigsButtonWidget"));
127 m_Tab_buttons[TAB_ENSCRIPT] = ButtonWidget.Cast(layoutRoot.FindAnyWidget("EnScriptButtonWidget"));
128 m_Tab_buttons[TAB_ENSCRIPT_SERVER] = ButtonWidget.Cast(layoutRoot.FindAnyWidget("EnScriptButtonWidgetServer"));
129 m_Tab_buttons[TAB_GENERAL] = ButtonWidget.Cast(layoutRoot.FindAnyWidget("GeneralButtonWidget"));
130 m_Tab_buttons[TAB_OUTPUT] = ButtonWidget.Cast(layoutRoot.FindAnyWidget("OutputButtonWidget"));
131 m_Tab_buttons[TAB_VICINITY] = ButtonWidget.Cast(layoutRoot.FindAnyWidget("VicinityWidget"));
132 m_Tab_buttons[TAB_SOUNDS] = ButtonWidget.Cast(layoutRoot.FindAnyWidget("SoundsWidget"));
133 m_Tab_buttons[TAB_WEATHER] = ButtonWidget.Cast(layoutRoot.FindAnyWidget("WeatherButtonWidget"));
134
135
136 m_ClientLogListbox = TextListboxWidget.Cast(layoutRoot.FindAnyWidget("TextListbox"));
137 m_ScriptOutputListbox = TextListboxWidget.Cast(layoutRoot.FindAnyWidget("ScriptOutputListbox"));
138 m_ClientLogClearButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("ButtonClear"));
139 m_ClientLogScrollCheckbox = CheckBoxWidget.Cast(layoutRoot.FindAnyWidget("CheckBoxAutoScroll"));
140
141 m_DiagToggleTextListbox = TextListboxWidget.Cast(layoutRoot.FindAnyWidget("DiagToggle"));
142 m_DiagToggleButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("DiagToggleButton"));
143
144 m_DiagDrawmodeTextListbox = TextListboxWidget.Cast(layoutRoot.FindAnyWidget("DiagDrawmode"));
145 m_DiagDrawButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("DiagDrawButton"));
146 m_DrawInWorld = ButtonWidget.Cast(layoutRoot.FindAnyWidget("ButtonDrawItem"));
147 m_DrawInWorldClear = ButtonWidget.Cast(layoutRoot.FindAnyWidget("ButtonDrawItemClear"));
148
149 m_PositionsListbox = TextListboxWidget.Cast(layoutRoot.FindAnyWidget("PositionsList"));
150 m_TeleportButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("ButtonTeleport"));
151 m_ButtonCopyPos = ButtonWidget.Cast(layoutRoot.FindAnyWidget("Button_CopyPos"));
152 m_CopySoundset = ButtonWidget.Cast(layoutRoot.FindAnyWidget("SoundsetCopy"));
153 m_PlaySoundset = ButtonWidget.Cast(layoutRoot.FindAnyWidget("PlaySoundset"));
154 m_PlaySoundsetLooped = ButtonWidget.Cast(layoutRoot.FindAnyWidget("PlaySoundsetLooped"));
155 m_StopSoundset = ButtonWidget.Cast(layoutRoot.FindAnyWidget("StopSoundset"));
156 m_TeleportX = EditBoxWidget.Cast(layoutRoot.FindAnyWidget("TeleportX"));
157 m_TeleportY = EditBoxWidget.Cast(layoutRoot.FindAnyWidget("TeleportY"));
158 m_TeleportXYZ = EditBoxWidget.Cast(layoutRoot.FindAnyWidget("TeleportXYZ"));
159 m_PlayerCurPos = TextWidget.Cast(layoutRoot.FindAnyWidget("PlayerPosLabel"));
160 m_PlayerMouseDiff = TextWidget.Cast(layoutRoot.FindAnyWidget("PlayerMouseDiff"));
161 m_MouseCurPos = TextWidget.Cast(layoutRoot.FindAnyWidget("MousePosLabel"));
162 m_LogsEnabled = CheckBoxWidget.Cast(layoutRoot.FindAnyWidget("cbx_LogsEnabled"));
163 m_HudDCharStats = CheckBoxWidget.Cast(layoutRoot.FindAnyWidget("cbx_CharacterStats"));
164 m_HudDCharLevels = CheckBoxWidget.Cast(layoutRoot.FindAnyWidget("cbx_CharacterLevels"));
165 m_HudDCharStomach = CheckBoxWidget.Cast(layoutRoot.FindAnyWidget("cbx_CharacterStomach"));
166 m_HudDCharModifiers = CheckBoxWidget.Cast(layoutRoot.FindAnyWidget("cbx_CharacterModifiers"));
167 m_HudDCharAgents = CheckBoxWidget.Cast(layoutRoot.FindAnyWidget("cbx_CharacterAgents"));
168 m_HudDCharDebug = CheckBoxWidget.Cast(layoutRoot.FindAnyWidget("cbx_CharacterDebug"));
169 m_HudDFreeCamCross = CheckBoxWidget.Cast(layoutRoot.FindAnyWidget("cbx_FreeCamCross"));
170 m_HudDTemperature = CheckBoxWidget.Cast(layoutRoot.FindAnyWidget("cbx_Temp"));
171 m_HudDVersion = CheckBoxWidget.Cast(layoutRoot.FindAnyWidget("cbx_Version"));
172 m_ItemPreviewCheckbox = CheckBoxWidget.Cast(layoutRoot.FindAnyWidget("ItemPreviewCheckbox"));
173 m_LocationAddButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("AddButton"));
174 m_LocationRemoveButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("RemoveButton"));
175 m_FilterOrderButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("ObjectFilterSortButton"));
176 m_DumpParamButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("DumpParamButton"));
177 m_FilterOrderImage = ImageWidget.Cast(layoutRoot.FindAnyWidget("ObjectFilterSortPic"));
178
179 m_CategoryMergeType = CheckBoxWidget.Cast(layoutRoot.FindAnyWidget("CategoryMergeType"));
180
181 m_TimeSlider = SliderWidget.Cast(layoutRoot.FindAnyWidget("TimeSlider"));
182 m_DateYear = EditBoxWidget.Cast(layoutRoot.FindAnyWidget("DateYear"));
183 m_DateMonth = EditBoxWidget.Cast(layoutRoot.FindAnyWidget("DateMonth"));
184 m_DateDay = EditBoxWidget.Cast(layoutRoot.FindAnyWidget("DateDay"));
185 m_DateHour = EditBoxWidget.Cast(layoutRoot.FindAnyWidget("DateHour"));
186 m_DateMinute = EditBoxWidget.Cast(layoutRoot.FindAnyWidget("DateMinute"));
187
188 m_ShowProtected = CheckBoxWidget.Cast(layoutRoot.FindAnyWidget("ShowProtectedCheckbox"));
189 m_ShowOthers = CheckBoxWidget.Cast(layoutRoot.FindAnyWidget("ShowOthersCheckbox"));
190
191 m_ClearInventory = CheckBoxWidget.Cast(layoutRoot.FindAnyWidget("ForceClearCheckbox"));
192
193
194
195 m_DrawDistanceWidget = EditBoxWidget.Cast(layoutRoot.FindAnyWidget("DrawItemDistance"));
196
197 m_EnfScriptEdit = MultilineEditBoxWidget.Cast(layoutRoot.FindAnyWidget("MultilineEditBoxWidget0"));
198 m_EnfScriptRun = ButtonWidget.Cast(layoutRoot.FindAnyWidget("RunButton"));
199 m_EnfScriptClear = ButtonWidget.Cast(layoutRoot.FindAnyWidget("ClearButton"));
200
201 m_ObjectFilter = EditBoxWidget.Cast(layoutRoot.FindAnyWidget("ObjectFilter"));
202 m_SpawnDistanceEditBox = EditBoxWidget.Cast(layoutRoot.FindAnyWidget("SpawnDistance"));
203 m_SelectedObjectText = TextWidget.Cast(layoutRoot.FindAnyWidget("SelectedObject"));
204 m_ObjectsTextListbox = TextListboxWidget.Cast(layoutRoot.FindAnyWidget("ObjectsList"));
205 m_PresetsTextListbox = TextListboxWidget.Cast(layoutRoot.FindAnyWidget("PresetList"));
206 m_PresetItemsTextListbox = TextListboxWidget.Cast(layoutRoot.FindAnyWidget("PresetItemsList"));
207 m_PresetNewButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("NewPresetButton"));
208 m_PresetDeleteButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("DeletePresetButton"));
209 m_PresetRenameButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("RenamePresetButton"));
210 m_PresetSetDefaultButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("SetDefaultPresetButton"));
211 m_PresetAddItemtButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("AddToPresetButton"));
212 m_ItemNameCopy = ButtonWidget.Cast(layoutRoot.FindAnyWidget("ItemNameCopy"));
213 m_PresetRemoveItemButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("RemoveFromPresetButton"));
214 m_ItemMoveUpButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("ItemMoveUpButton"));
215 m_ItemMoveDownButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("ItemMoveDownButton"));
216 m_ItemPreviewWidget = ItemPreviewWidget.Cast(layoutRoot.FindAnyWidget("ItemPreviewWidget"));
217
218 m_SoundFilter = EditBoxWidget.Cast(layoutRoot.FindAnyWidget("SoundsFilter"));
219 m_SoundsTextListbox = TextListboxWidget.Cast(layoutRoot.FindAnyWidget("SoundsList"));
220
221
222 m_QuantityEditBox = EditBoxWidget.Cast(layoutRoot.FindAnyWidget("QuantityValue"));
223 m_DamageEditBox = EditBoxWidget.Cast(layoutRoot.FindAnyWidget("DamageValue"));
224 m_ItemDamageLabel = TextWidget.Cast(layoutRoot.FindAnyWidget("DamageLabel"));
225 m_ItemQuantityLabel = TextWidget.Cast(layoutRoot.FindAnyWidget("QuantityLabel"));
226
227 m_SpawnInInvButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("ButtonSpawnInInv"));
228 m_SpawnGroundButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("ButtonSpawnInGround"));
229 m_SpawnAsAttachment = ButtonWidget.Cast(layoutRoot.FindAnyWidget("SpawnAsAttachment"));
230 m_SpawnSpecial = ButtonWidget.Cast(layoutRoot.FindAnyWidget("SpawnSpecial"));
231 m_SpawnBatchButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("ButtonSpawnBatch"));
232
233
234 m_RectSpawnColumn = EditBoxWidget.Cast(layoutRoot.FindAnyWidget("RectangleColumnValue"));
235 m_RectSpawnRow = EditBoxWidget.Cast(layoutRoot.FindAnyWidget("RectangleRowValue"));
236 m_BatchSpawnQuantity = EditBoxWidget.Cast(layoutRoot.FindAnyWidget("BatchCount"));
237
238 m_RectSpawnColumnStep = EditBoxWidget.Cast(layoutRoot.FindAnyWidget("RectangleStepXValue"));
239 m_RectSpawnRowStep = EditBoxWidget.Cast(layoutRoot.FindAnyWidget("RectangleStepYValue"));
240
241
242 m_HelpTextListboxWidget = TextListboxWidget.Cast(layoutRoot.FindAnyWidget("HelpTextListboxWidget"));
243
244 m_VicinityListbox = TextListboxWidget.Cast(layoutRoot.FindAnyWidget("VicinityListbox"));
245
246 PluginDeveloper module_dev = PluginDeveloper.Cast(GetPlugin(PluginDeveloper));
247
248 m_WgtClassesConfig = layoutRoot.FindAnyWidget("ClassesPanel");
249
250 // config hierarchy
251 m_ObjectConfigFilter = EditBoxWidget.Cast(layoutRoot.FindAnyWidget("ObjectConfigFilter"));
252 m_ConfigHierarchyTextListbox = TextListboxWidget.Cast(layoutRoot.FindAnyWidget("ConfigHierarchy"));
253 m_ConfigVariablesTextListbox = TextListboxWidget.Cast(layoutRoot.FindAnyWidget("ConfigVariables"));
254 m_SelectedRowCopy = ButtonWidget.Cast(layoutRoot.FindAnyWidget("SelectedRowCopy"));
255
256 m_CloseConsoleButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("CloseConsoleButtonWidget"));
257 m_WatchItem = ButtonWidget.Cast(layoutRoot.FindAnyWidget("WatchItemButton"));
258 m_PlaySoundsetButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("PlaySoundsetButton"));
259
260 m_MissionGameplay = MissionGameplay.Cast(GetGame().GetMission());
261 m_Developer = PluginDeveloper.Cast(GetPlugin(PluginDeveloper));
263 m_ConfigDebugProfileFixed = PluginConfigDebugProfileFixed.Cast(GetPlugin(PluginConfigDebugProfileFixed));
264 m_ModuleConfigViewer = PluginConfigViewer.Cast(GetPlugin(PluginConfigViewer));
265
266 // Update checkbox Character Values
267 m_HudDCharStats.SetChecked(m_ConfigDebugProfile.GetCharacterStatsVisible());
268 m_HudDCharLevels.SetChecked(m_ConfigDebugProfile.GetCharacterLevelsVisible());
269 m_HudDCharStomach.SetChecked(m_ConfigDebugProfile.GetCharacterStomachVisible());
270 m_HudDCharModifiers.SetChecked(m_ConfigDebugProfile.GetCharacterModifiersVisible());
271 m_HudDCharAgents.SetChecked(m_ConfigDebugProfile.GetCharacterAgentsVisible());
272 m_HudDCharDebug.SetChecked(m_ConfigDebugProfile.GetCharacterDebugVisible());
273 m_HudDFreeCamCross.SetChecked(m_ConfigDebugProfile.GetFreeCameraCrosshairVisible());
274 m_HudDVersion.SetChecked(m_ConfigDebugProfile.GetVersionVisible());
275 m_HudDTemperature.SetChecked(m_ConfigDebugProfile.GetTempVisible());
276 m_CategoryMergeType.SetChecked(m_ConfigDebugProfile.GetMergeType());
277
278 m_LogsEnabled.SetChecked(m_ConfigDebugProfile.GetLogsEnabled());
279
280 TStringArray diag_names = new TStringArray;
281 GetGame().GetDiagModeNames(diag_names);
282 for (i = 0; i < diag_names.Count(); i++)
283 {
284 m_DiagToggleTextListbox.AddItem(diag_names.Get(i), NULL, 0);
285 }
286
287 GetGame().GetDiagDrawModeNames(diag_names);
288 for (i = 0; i < diag_names.Count(); i++)
289 {
290 m_DiagDrawmodeTextListbox.AddItem(diag_names.Get(i), NULL, 0);
291 }
292
293 m_ObjectFilter.SetText(m_ConfigDebugProfile.GetItemSearch());
294 m_SpawnDistanceEditBox.SetText(m_ConfigDebugProfile.GetSpawnDistance().ToString());
295
296 ChangeFilterItems();
297
298 m_ServerRows = 0;
299 m_EnscriptHistoryRow = 0;
300 m_EnscriptHistoryRowServer = 0;
301
302 m_EnscriptConsoleHistory = m_ModuleLocalEnscriptHistory.GetAllLines();
303 m_EnscriptConsoleHistoryServer = m_ModuleLocalEnscriptHistoryServer.GetAllLines();
304
305 // load data from profile
306 m_selected_tab = m_ConfigDebugProfile.GetTabSelected();
307 SelectTab(m_selected_tab);
308
309 RenderPresets();
310 HideItemButtons();
311
312 m_PresetDeleteButton.Show(false);
313 m_PresetRenameButton.Show(false);
314
315 ShowItemTransferButtons();
316 //EnscriptHistoryBack();
317
318 RefreshLocations();
319
320 ClearHierarchy();
321
322 UpdateHudDebugSetting();
323
324 m_DebugMapWidget.SetScale(DEBUG_MAP_ZOOM);
325 m_DebugMapWidget.SetMapPos(GetGame().GetPlayer().GetWorldPosition());
326 m_TeleportXYZ.SetText(DEFAULT_POS_XYZ);
327
328 m_LateInit.Run(0.05, this, "LateInit", null, false);
329
330 int year,month,day,hour,minute;
331 GetGame().GetWorld().GetDate(year,month, day, hour, minute);
332 RefreshDateWidgets(year,month, day, hour, minute);
333
335 {
336 SetFilterOrder(m_ConfigDebugProfile.GetFilterOrderReversed());
337 }
338
339 int flag1;
341 {
342 flag1 = m_ConfigDebugProfile.GetConfigClassesFlag();
343 }
344
345 foreach (string s:m_BaseConfigClasses)
346 {
347 Widget w = GetGame().GetWorkspace().CreateWidgets("gui/layouts/script_console/config_class_item.layout", m_WgtClassesConfig);
348 CheckBoxWidget cbw = CheckBoxWidget.Cast(w.FindAnyWidget("Item"));
349 //cbw.SetColor(Colors.RED);
350 cbw.SetText(s);
351 int indx = m_ClassCheckboxes.Count();
352 m_ClassCheckboxes.Insert(cbw,indx);
353
354
355 if (flag1 & (int)Math.Pow(2, indx))
356 {
357 string base_class_name = m_BaseConfigClasses.Get(indx);
358 m_BaseConfigClassesToggled.Insert(base_class_name);
359 cbw.SetChecked(true);
360 }
361 }
362 return layoutRoot;
363 }
364
365 void RefreshDateWidgets(int year, int month, int day, int hour, int minute)
366 {
367 float time01 = Math.InverseLerp(0,60*24 - 1, (hour * 60) + minute);
368 m_DateYear.SetText(year.ToString());
369 m_DateMonth.SetText(month.ToString());
370 m_DateDay.SetText(day.ToString());
371 m_DateHour.SetText(hour.ToString());
372 m_DateMinute.SetText(minute.ToString());
373 m_TimeSlider.SetCurrent(time01 * 100);
374 }
375
377 {
378 int count = m_PositionsListbox.GetNumItems();
379 for (int i = 0; i < count; i++)
380 {
381 LocationParams data;
382 m_PositionsListbox.GetItemData(i,0,data);
383 if (data.param1 == name)
384 return false;
385 }
386 return true;
387 }
388
389 void SetFilterOrder(bool reversed)
390 {
391 m_FilterOrderReversed = reversed;
392 if (reversed)
393 m_FilterOrderImage.SetRotation(0,0,180,true);
394 else
395 m_FilterOrderImage.SetRotation(0,0,0,true);
396 ChangeFilterItems();
398 {
399 m_ConfigDebugProfile.SetFilterOrderReversed(reversed);
400 }
401 }
402
404 {
405 m_PositionsListbox.ClearItems();
406
408 m_ConfigDebugProfile.GetLocationsData(locData,true);
409 m_ConfigDebugProfileFixed.GetLocationsData(locData,false);
410 foreach (LocationParams dta: locData)
411 {
412 string name = dta.param1;
413 if (!dta.param2)
414 {
415 name = "[" + name + "]";
416 }
417 m_PositionsListbox.AddItem(name,dta,0);
418 }
419 }
420
421 void LateInit()
422 {
423 m_RunColor = m_EnfScriptRun.GetColor();
424 m_ItemDisagPlugin = PluginItemDiagnostic.Cast(GetPlugin(PluginItemDiagnostic));
425 if (m_ItemDisagPlugin)
426 m_ItemDisagPlugin.OnScriptMenuOpened(true);
427
428 ClearHierarchy();
429 if (!m_SelectedObjectIsPreset == 1 && ITEMS_SELECTED_ROW < m_ObjectsTextListbox.GetNumItems() && m_ObjectsTextListbox.GetNumItems() > 0 && ITEMS_SELECTED_ROW > -1)
430 {
431 m_ObjectsTextListbox.SelectRow(ITEMS_SELECTED_ROW);
432 m_ObjectsTextListbox.EnsureVisible(ITEMS_SELECTED_ROW);
433
434
435 m_SelectedObjectText.SetText(GetCurrentObjectName());
436
437
438 SetObject(GetCurrentObjectName());
439 m_LastSelectedObject = m_SelectedObject;
440 m_PresetItemsTextListbox.SelectRow(-1);
441 m_SelectedObjectIsPreset = 0;
442 }
443
444 if (m_PresetsTextListbox.GetNumItems() >= 0)
445 {
446 m_PresetsTextListbox.SelectRow(PRESETS_SELECTED_ROW);
447 m_PresetsTextListbox.EnsureVisible(PRESETS_SELECTED_ROW);
448 }
449
450 if (m_ObjectsScope == 1)
451 m_ShowProtected.SetChecked(true);
452 else
453 m_ShowProtected.SetChecked(false);
454
455 m_ShowOthers.SetChecked(SHOW_OTHERS);
456 m_DrawDistanceWidget.SetText(DRAW_DISTANCE.ToString());
457
458 RenderPresetItems();
459
460 int flag1,flag2;
462 {
463 int prevRow = m_ConfigDebugProfile.GetSpawnLocIndex();
464 if (prevRow < m_PositionsListbox.GetNumItems())
465 m_PositionsListbox.SelectRow(prevRow);
466
467
468 m_BatchSpawnQuantity.SetText(m_ConfigDebugProfile.GetBatchSpawnQuantity().ToString());
469
470 flag1 = m_ConfigDebugProfile.GetConfigClassesFlag();
471 flag2 = m_ConfigDebugProfile.GetItemCategoryFlag();
472 if (m_ItemPreviewCheckbox)
473 {
474 m_ItemPreviewCheckbox.SetChecked(m_ConfigDebugProfile.GetShowItemPreview());
475 }
476
477 array<ref CfgParam> params = m_ConfigDebugProfile.GetBatchSpawnRectangle();
478
479 m_RectSpawnRow.SetText(CfgParamInt.Cast(params.Get(0)).GetValue().ToString());
480 m_RectSpawnColumn.SetText(CfgParamInt.Cast(params.Get(1)).GetValue().ToString());
481 m_RectSpawnRowStep.SetText(CfgParamFloat.Cast(params.Get(2)).GetValue().ToString());
482 m_RectSpawnColumnStep.SetText(CfgParamFloat.Cast(params.Get(3)).GetValue().ToString());
483 }
484
485 int counter = 0;
486 foreach (string name: m_CategoryButtonsNames)
487 {
488 string widget_name = "ItemCategory" + counter;
489
490 CheckBoxWidget btw = CheckBoxWidget.Cast(layoutRoot.FindAnyWidget(widget_name));
491 if (btw)
492 {
493 btw.SetText(name);
494 m_CategoryButtonsWidgets.Insert(btw);
495 int bit = 1 << counter;
496 if (bit & flag2)
497 {
498 btw.SetChecked(true);
499 }
500 }
501 counter++;
502 }
503
504
505
506
507 if (ITEMS_IN_PRESET_SELECTED_ROW <= m_PresetItemsTextListbox.GetNumItems() && m_PresetItemsTextListbox.GetNumItems() > 0 && ITEMS_IN_PRESET_SELECTED_ROW > -1)
508 {
509 m_PresetItemsTextListbox.SelectRow(ITEMS_IN_PRESET_SELECTED_ROW);
510 m_PresetItemsTextListbox.EnsureVisible(ITEMS_IN_PRESET_SELECTED_ROW);
511
512 m_SelectedObjectText.SetText("Object : " + GetCurrentItemName());
513 SetObject(GetCurrentItemName());
514 m_SelectedObjectIsPreset = 0;
515 }
516
517
518
519 }
520
521 void Add(string message, bool isReload = false)
522 {
523 if (message != string.Empty)
524 {
525 if (m_AllowScriptOutput && m_ScriptOutputListbox)
526 {
527 if (!isReload)
528 m_ScriptOutputHistory.Insert(message);
529 m_ScriptOutputListbox.AddItem(String(message), NULL, 0);
530 m_ScriptOutputListbox.EnsureVisible(m_ScriptOutputListbox.GetNumItems());
531 }
532 else if (m_ClientLogListbox)
533 {
534 m_ClientLogListbox.AddItem(String(message), NULL, 0);
535
536 if (m_ClientLogScrollCheckbox.IsChecked())
537 {
538 m_ClientLogListbox.EnsureVisible(m_ClientLogListbox.GetNumItems());
539 }
540 }
541 }
542
543 }
544
545 void AddServer(string message)
546 {
547 /*if (m_ServerLogListbox)
548 {
549 m_ServerRows = m_ServerRows + 1;
550 m_ServerLogListbox.AddItem(String(message), NULL, 0);
551 if (m_ServerLogScrollCheckbox.IsChecked())
552 {
553 m_ServerLogListbox.EnsureVisible(m_ServerRows);
554 }
555 }*/
556 }
557
559 {
560 if (m_ConfigDebugProfile.GetTabSelected() == ScriptConsole.TAB_ENSCRIPT || m_ConfigDebugProfile.GetTabSelected() == ScriptConsole.TAB_ENSCRIPT_SERVER)
561 {
562 EnscriptHistoryBack();
563 }
564 }
565
567 {
568 if (m_ConfigDebugProfile.GetTabSelected() == ScriptConsole.TAB_ENSCRIPT || m_ConfigDebugProfile.GetTabSelected() == ScriptConsole.TAB_ENSCRIPT_SERVER)
569 {
570 EnscriptHistoryForward();
571 }
572 }
573
574/*
575 void EnscriptHistoryBack()
576 {
577 if (m_EnfScriptEdit)
578 {
579 int history_index = m_EnscriptConsoleHistory.Count() - m_EnscriptHistoryRow - 1;
580 if (history_index > -1)
581 {
582 m_EnfScriptEdit.SetText(m_EnscriptConsoleHistory.Get(history_index));
583 m_EnscriptHistoryRow = m_EnscriptHistoryRow + 1;
584 }
585 }
586 }
587 */
588
589
591 {
592 int history_index;
593
594 if (m_EnfScriptEdit)
595 {
596 if (!m_ScriptServer)//client
597 {
598 m_EnscriptHistoryRow++;
599 history_index = m_EnscriptConsoleHistory.Count() - m_EnscriptHistoryRow - 1;
600 if (history_index > -1)
601 {
602 m_EnfScriptEdit.SetText(m_EnscriptConsoleHistory.Get(history_index));
603 }
604 else m_EnscriptHistoryRow--;
605 }
606 else//server
607 {
608 m_EnscriptHistoryRowServer++;
609 history_index = m_EnscriptConsoleHistoryServer.Count() - m_EnscriptHistoryRowServer - 1;
610 if (history_index > -1)
611 {
612 m_EnfScriptEdit.SetText(m_EnscriptConsoleHistoryServer.Get(history_index));
613 }
614 else m_EnscriptHistoryRowServer--;
615 }
616 }
617 }
618
619
620/*
621 void EnscriptHistoryForward()
622 {
623 if (m_EnfScriptEdit)
624 {
625 int history_index = m_EnscriptConsoleHistory.Count() - m_EnscriptHistoryRow + 1;
626 if (history_index < m_EnscriptConsoleHistory.Count())
627 {
628 m_EnfScriptEdit.SetText(m_EnscriptConsoleHistory.Get(history_index));
629 m_EnscriptHistoryRow = m_EnscriptHistoryRow - 1;
630 }
631 }
632 }
633 */
634
636 {
637 if (m_EnfScriptEdit)
638 {
639 int history_index;
640 if (!m_ScriptServer)//client
641 {
642 m_EnscriptHistoryRow--;
643 history_index = m_EnscriptConsoleHistory.Count() - m_EnscriptHistoryRow - 1;
644 if (history_index < m_EnscriptConsoleHistory.Count())
645 {
646 m_EnfScriptEdit.SetText(m_EnscriptConsoleHistory.Get(history_index));
647 }
648 else m_EnscriptHistoryRow++;
649
650 }
651 else//server
652 {
653 m_EnscriptHistoryRowServer--;
654 history_index = m_EnscriptConsoleHistoryServer.Count() - m_EnscriptHistoryRowServer - 1;
655 if (history_index < m_EnscriptConsoleHistoryServer.Count())
656 {
657 m_EnfScriptEdit.SetText(m_EnscriptConsoleHistoryServer.Get(history_index));
658 }
659 else m_EnscriptHistoryRowServer++;
660 }
661
662 }
663 }
664
665 void Clear(bool clearFile = false)
666 {
667 if(clearFile)
669 m_ClientLogListbox.ClearItems();
670 m_ScriptOutputListbox.ClearItems();
671 }
672
673 static void PrintS(string message)
674 {
675 Print(message);
676 if(m_This)
677 m_This.Add(message);
678 }
679
680 static void PrintS(bool message)
681 {
682 PrintS(message.ToString());
683 }
684
685 static void PrintS(int message)
686 {
687 PrintS(message.ToString());
688 }
689
690 static void PrintS(float message)
691 {
692 PrintS(message.ToString());
693 }
694
695 static void PrintS(vector message)
696 {
697 PrintS(message.ToString());
698 }
699
700 static void PrintS(Object message)
701 {
702 PrintS(message.ToString());
703 }
704
706 {
707 #ifdef DEVELOPER
708 string code;
709 m_EnfScriptEdit.GetText(code);
710 string codeNoReplace = code;
712 m_AllowScriptOutput = true;
713 code.Replace("Print(","ScriptConsole.PrintS(");
714 code.Replace("Print (","ScriptConsole.PrintS(");
715 bool success = GetGame().ExecuteEnforceScript("void scConsMain() \n{\n" + code + "\n}\n", "scConsMain");
716 m_AllowScriptOutput = false;
717 ColorRunButton(success);
718
719 m_EnscriptConsoleHistory.Insert(codeNoReplace);
720 m_ModuleLocalEnscriptHistory.AddNewLine(codeNoReplace);
721 #endif
722 }
723
724 void ColorRunButton(bool success)
725 {
726 if (success)
727 {
728 m_EnfScriptRun.SetColor(ARGB(255,0,255,0));
729 }
730 else
731 {
732 m_EnfScriptRun.SetColor(ARGB(255,255,0,0));
733 }
734 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(ResetRunButtonColor,600);
735 }
736
738 {
739 m_EnfScriptRun.SetColor(m_RunColor);
740 }
741
743 {
744 string code;
745 m_EnfScriptEdit.GetText(code);
746 m_EnscriptConsoleHistoryServer.Insert(code);
747 m_ModuleLocalEnscriptHistoryServer.AddNewLine(code);
749 GetGame().RPCSingleParam(GetGame().GetPlayer(), ERPCs.DEV_RPC_SERVER_SCRIPT, CachedObjectsParams.PARAM1_STRING, true, GetGame().GetPlayer().GetIdentity());
750 }
751
753 {
755 }
756
758 {
759 return {CFG_SOUND_SETS};
760 }
761
762 int GetFilterColor(string color)
763 {
764 switch (color)
765 {
766 case "r":
767 return ARGB(255,255,0,0);
768 case "g":
769 return ARGB(255,0,255,0);
770 case "b":
771 return ARGB(255,130,130,255);
772 case "y":
773 return ARGB(255,255,255,0);
774 case "o":
775 return ARGB(255,255,169,0);
776 }
777 return -1;//white
778 }
779
780 void PrepareFilters(string filter, out TStringArray filters, out TIntArray colors)
781 {
782 filter.Trim();
783 filter.ToLower();
784
785 filters = new TStringArray;
786 TStringArray rawFilters = new TStringArray;
787 filter.Split(" ", rawFilters);
788
789 colors = new TIntArray;
790
791
792 foreach (int i, string f:rawFilters)
793 {
794 int color = -1;
795 if (f.IndexOf(":") == 1)//detect color prefix
796 {
797 string clr = f.Substring(0, 1);
798 f = f.Substring(2, f.Length() - 2);//crop off color prefix
799 color = GetFilterColor(clr);
800 }
801 else//autocolor
802 {
803 if (i%2 == 1)
804 {
805 color = ARGB(200,255,255,255);
806 }
807 }
808 filters.Insert(f);
809 colors.Insert(color);
810 }
811 }
812
813 void ChangeFilter(TStringArray classes, TextListboxWidget widget, EditBoxWidget filterWidget, int categoryMask = -1, bool ignoreScope = false)
814 {
815 widget.ClearItems();
816
817 TStringArray filters;
818 TIntArray filterColors;
819
820 PrepareFilters(filterWidget.GetText(),filters, filterColors);
821
822 map<string,int> itemsAndColors = new map<string,int>();
824
825 TStringArray itemsArray = TStringArray();
826
827 for (int i = 0; i < classes.Count(); i++)
828 {
829 string config_path = classes.Get(i);
830
831 int objects_count = GetGame().ConfigGetChildrenCount(config_path);
832 for (int j = 0; j < objects_count; j++)
833 {
834 string child_name;
835
836 GetGame().ConfigGetChildName(config_path, j, child_name);
837
838 int scope = GetGame().ConfigGetInt(config_path + " " + child_name + " scope");
839
840 if (scope >= m_ObjectsScope || ignoreScope)
841 {
842 int category_bit = GetGame().ConfigGetInt(config_path + " " + child_name + " debug_ItemCategory") - 1;
843 category_bit = (1 << category_bit);
844
845 bool display = false;
846 int color = 0;
847 if (category_bit & categoryMask)
848 {
849 display = true;
850 }
851 else if ((!m_ConfigDebugProfile.GetMergeType() || categoryMask == 0) && filters.Count() > 0)
852 {
853 string child_name_lower = child_name;
854 child_name_lower.ToLower();
855
856 foreach (int indx, string filter:filters)
857 {
858 if (child_name_lower.Contains(filter))
859 {
860 display = false;
861 color = filterColors.Get(indx);
862 TStringArray arr = itemsByFilters.Get(filter);
863 if (!arr)
864 {
865 arr = new TStringArray();
866 itemsByFilters.Set(filter, arr);
867 }
868 arr.Insert(child_name);
869 itemsAndColors.Insert(child_name,color);
870 break;
871 }
872 }
873 }
874 else if (categoryMask == 0)
875 {
876 display = true;
877 }
878
879 if (display)
880 {
881 itemsArray.Insert(child_name);
882
883 }
884 }
885 }
886 }
887
888 if (itemsArray)
889 {
890 itemsArray.Sort();
891 foreach (string it:itemsArray)
892 {
893 widget.AddItem(it, NULL, 0);
894 }
895 }
896
897 if (filters)
898 {
899 if (m_FilterOrderReversed)
900 filters.Invert();
901
902 foreach (string f:filters)
903 {
904 TStringArray arr2 = itemsByFilters.Get(f);
905 if (arr2)
906 {
907 arr2.Sort();
908 foreach (string itm: arr2)
909 {
910 int row = widget.AddItem(itm, NULL, 0);
911 int clr = itemsAndColors.Get(itm);
912 if (clr)
913 {
914 widget.SetItemColor(row, 0, clr);
915 }
916 }
917 }
918 }
919 }
920
921
922 }
923
925 {
926 m_ConfigTextField = m_ObjectConfigFilter.GetText();
927
928 if (m_ConfigTextField == "")
929 {
930 ClearHierarchy();
931 }
932 else
933 {
934 FindInHierarchy(m_ConfigTextField);
935 }
936 }
937
938 override bool OnKeyPress(Widget w, int x, int y, int key)
939 {
940 return super.OnKeyPress(w, x, y, key);
941 }
942
943 override bool OnKeyDown(Widget w, int x, int y, int key)
944 {
945 if (key == KeyCode.KC_D && m_SelectedObject != "")
946 {
947 DrawItems(m_SelectedObject);
948 return true;
949 }
950 else
951 return super.OnKeyDown(w, x, y, key);
952 }
953
954
955 static void DrawItems(string type, float distance = 0)
956 {
957 if (!distance)
958 {
959 distance = DRAW_DISTANCE;
960 }
961 array<Object> objects = new array<Object>;
963
964 GetGame().GetObjectsAtPosition(GetGame().GetPlayer().GetPosition(), distance, objects, proxies);
965 int i = 0;
966 m_MarkedEntities.Clear();
967 foreach (Object o: objects)
968 {
969 if (o.IsKindOf(type))
970 {
971 i++;
972 m_MarkedEntities.Insert(new MapMarker(o.GetPosition(),"",COLOR_RED,eMapMarkerTypes.MARKERTYPE_MAP_BORDER_CROSS));
973 Shape shape = Shape.CreateSphere(COLOR_RED, ShapeFlags.TRANSP|ShapeFlags.NOOUTLINE|ShapeFlags.NOZBUFFER, o.GetPosition() + "0 30 0", 1);
974 vector lines[2];
975 lines[0] = o.GetPosition();
976 lines[1] = o.GetPosition() + "0 30 0";
977 Shape line = Shape.CreateLines(COLOR_RED, ShapeFlags.TRANSP|ShapeFlags.NOOUTLINE|ShapeFlags.NOZBUFFER, lines, 2);
978 m_DebugShapes.Insert(shape);
979 m_DebugShapes.Insert(line);
980 }
981 }
982
984 //GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLaterByName(this, "DrawItemsClear", 5000);
985 Debug.Log(string.Format("found %1 instances of type %1", i, type));
986 }
987
988
989 static void DrawItemsClear()
990 {
991 m_MarkedEntities.Clear();
992 foreach (Shape s: m_DebugShapes)
993 {
994 s.Destroy();
995 }
996 m_DebugShapes.Clear();
997 }
998
999 override void Update(float timeslice)
1000 {
1001 super.Update(timeslice);
1002
1003 for (int i =0; i < TABS_COUNT; i++)
1004 {
1005 if (m_TabHandlers[i])
1006 m_TabHandlers[i].Update(timeslice);
1007 }
1008
1009 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
1010 if (GetGame() && GetUApi().GetInputByID(UAUIBack).LocalPress())
1011 {
1013 }
1014 m_DebugMapWidget.ClearUserMarks();
1015
1016 foreach (MapMarker marker: m_MarkedEntities)
1017 {
1018 m_DebugMapWidget.AddUserMark(marker.GetMarkerPos(),marker.GetMarkerText(), marker.GetMarkerColor(), MapMarkerTypes.GetMarkerTypeFromID(marker.GetMarkerIcon()));
1019 }
1020
1021 if (m_UpdateMap)
1022 {
1024 {
1025 if (rpd.m_Player != player)
1026 {
1027 vector dir = rpd.m_Pos - player.GetWorldPosition();
1028 dir[1] = 0;
1029 string dist = ((int)dir.Length()).ToString();
1030 string text = rpd.m_Name + " " +dist +"m.";
1031 m_DebugMapWidget.AddUserMark(rpd.m_Pos, text , COLOR_BLUE,"\\dz\\gear\\navigation\\data\\map_tree_ca.paa");
1032 }
1033 }
1034 }
1035 vector player_pos = player.GetWorldPosition();
1036 m_DebugMapWidget.AddUserMark(player_pos,"You", COLOR_RED,"\\dz\\gear\\navigation\\data\\map_tree_ca.paa");
1037 if (player_pos != GetMapPos())
1038 m_DebugMapWidget.AddUserMark(GetMapPos(),"Pos", COLOR_BLUE,"\\dz\\gear\\navigation\\data\\map_tree_ca.paa");
1039 UpdateMousePos();
1040 if (!m_PlayerPosRefreshBlocked)
1041 RefreshPlayerPosEditBoxes();
1042 }
1043
1045 {
1046 int x,y;
1047 GetMousePos(x,y);
1048 vector mouse_pos, world_pos;
1049 mouse_pos[0] = x;
1050 mouse_pos[1] = y;
1051 world_pos = m_DebugMapWidget.ScreenToMap(mouse_pos);
1052 world_pos[1] = GetGame().SurfaceY(world_pos[0], world_pos[2]);
1053 vector player_pos = GetGame().GetPlayer().GetWorldPosition();
1054 //player_pos[1] = 0;
1055 float dst = (world_pos - player_pos).Length();
1056
1057 if (m_MouseCurPos)
1058 {
1059 m_MouseCurPos.SetText("Mouse: "+ MiscGameplayFunctions.TruncateToS(world_pos[0]) +", "+ MiscGameplayFunctions.TruncateToS(world_pos[1]) +", "+ MiscGameplayFunctions.TruncateToS(world_pos[2]));
1060 }
1061 if (m_PlayerMouseDiff)
1062 {
1063 m_PlayerMouseDiff.SetText("Distance: " + MiscGameplayFunctions.TruncateToS(dst));
1064 }
1065 }
1066 /*
1067 override bool OnController(Widget w, int control, int value)
1068 {
1069 super.OnController(w, control, value);
1070
1071 if (control == ControlID.CID_TABLEFT && value != 0)
1072 {
1073 SelectPreviousTab();
1074 }
1075
1076 if (control == ControlID.CID_TABRIGHT && value != 0)
1077 {
1078 SelectNextTab();
1079 }
1080
1081 return true;
1082 }
1083 */
1084 void SelectObject(bool hide_presets = true)
1085 {
1086 if (hide_presets)
1087 m_PresetItemsTextListbox.SelectRow(-1);
1088 HideItemButtons();
1089 ShowItemTransferButtons();
1090 m_SelectedObjectText.SetText(GetCurrentObjectName());
1091 SetObject(GetCurrentObjectName());
1092
1093 m_LastSelectedObject = m_SelectedObject;
1094 m_SelectedObjectIsPreset = 0;
1095
1096
1097
1098 }
1099
1101 {
1102 m_MapPos = pos;
1103 m_PlayerCurPos.SetText("Pos: "+ MiscGameplayFunctions.TruncateToS(pos[0]) +", "+ MiscGameplayFunctions.TruncateToS(pos[1]) +", "+ MiscGameplayFunctions.TruncateToS(pos[2]));
1104 }
1105
1107 {
1108 return m_MapPos;
1109 }
1110
1111 void DumpParam(string param, string relativePath)
1112 {
1113 if (relativePath)
1114 {
1115 relativePath = " " + relativePath;
1116 }
1117 for ( int i = 0; i < m_BaseConfigClassesToggled.Count(); i++ )
1118 {
1119 string config_path = m_BaseConfigClassesToggled.Get(i);
1120
1121 int objects_count = GetGame().ConfigGetChildrenCount( config_path );
1122
1123 for ( int j = 0; j < objects_count; j++ )
1124 {
1125 string child_name;
1126 GetGame().ConfigGetChildName( config_path, j, child_name );
1127
1128
1129 //string dispName;
1130 //GetGame().ConfigGetText( config_path + " " + child_name + " displayName",dispName );
1131 string value;
1132 string path = config_path + " " + child_name + relativePath + " " + param;
1133 if (GetGame().ConfigIsExisting(path))
1134 {
1135 GetGame().ConfigGetText( path , value);
1136 }
1137 if (value)
1138 Print(child_name + "," + param + "," + value);
1139
1140 /*
1141 int scope = GetGame().ConfigGetInt( config_path + " " + child_name + " scope" );
1142 {
1143 if ( scope == 2)
1144 {
1145
1146 }
1147 }*/
1148 }
1149 }
1150 }
1151
1152 override bool OnMouseButtonDown(Widget w, int x, int y, int button)
1153 {
1154 super.OnMouseButtonDown(w,x,y,button);
1155
1156 if (w == m_DebugMapWidget)
1157 {
1158 if (button == 0)
1159 {
1160 m_PlayerPosRefreshBlocked = true;
1161 int mouse_x,mouse_y;
1162 GetMousePos(mouse_x,mouse_y);
1163 vector mouse_pos, world_pos;
1164 mouse_pos[0] = mouse_x;
1165 mouse_pos[1] = mouse_y;
1166 world_pos = m_DebugMapWidget.ScreenToMap(mouse_pos);
1167 world_pos[1] = GetGame().SurfaceY(world_pos[0], world_pos[2]);
1168
1169 SetMapPos(world_pos);
1170 }
1171 else if (button == 1)
1172 {
1173 SetMapPos(GetGame().GetPlayer().GetWorldPosition());
1174 }
1175 }
1176 return true;
1177 }
1178
1179
1180 override bool OnClick(Widget w, int x, int y, int button)
1181 {
1182 super.OnClick(w, x, y, button);
1183
1184 for (int z =0; z < TABS_COUNT; z++)
1185 {
1186 if (m_TabHandlers[z])
1187 m_TabHandlers[z].OnClick(w,x,y,button);
1188 }
1189
1190
1191 int i;
1192 int objects_row_index;
1193 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
1194
1195 PluginDeveloper module_dev = PluginDeveloper.Cast(GetPlugin(PluginDeveloper));
1196
1197 if (w == m_ClientLogClearButton)
1198 {
1199 Clear(true);
1200 return true;
1201 }
1202 else if (w == m_DumpParamButton)
1203 {
1204 int selectedRowIndex = m_ConfigVariablesTextListbox.GetSelectedRow();
1205 string paramFinal;
1206 if (selectedRowIndex > -1)
1207 {
1208 string param;
1209 m_ConfigVariablesTextListbox.GetItemText(selectedRowIndex,0,param);
1210 int index = param.IndexOf("=");
1211 if (index > 0)
1212 paramFinal = param.Substring(0, index).Trim();
1213 }
1214
1215
1216 objects_row_index = m_ConfigHierarchyTextListbox.GetSelectedRow();
1217 if (objects_row_index > -1 && objects_row_index < m_ConfigHierarchyTextListbox.GetNumItems())
1218 {
1219 ConfigParamsEx params;
1220 m_ConfigHierarchyTextListbox.GetItemData(objects_row_index, 0, params);
1221 string path = params.param4;
1222 TStringArray pathArr = new TStringArray();
1223 path.Split(" ", pathArr);
1224 string relativePath;
1225
1226 foreach (int indx, string s:pathArr)
1227 {
1228 if (indx > 2)
1229 {
1230 relativePath+= s+" ";
1231 }
1232 }
1233
1234 if (relativePath)
1235 relativePath = relativePath.Trim();
1236
1237 Print(relativePath);
1238 Print(path);
1239 }
1240
1241 if (paramFinal)
1242 DumpParam(paramFinal,relativePath);
1243
1244 return true;
1245 }
1246 else if (w == m_ConfigHierarchyTextListbox)
1247 {
1248 objects_row_index = m_ConfigHierarchyTextListbox.GetSelectedRow();
1249 //Print(objects_row_index);
1250
1251 if (objects_row_index > -1 && objects_row_index < m_ConfigHierarchyTextListbox.GetNumItems())
1252 {
1253 ConfigParamsEx config_params;
1254 m_ConfigHierarchyTextListbox.GetItemData(objects_row_index, 0, config_params);
1255
1256 if (config_params.param1 == false)
1257 {
1258 ExpandHierarchy(objects_row_index);
1259 }
1260 else
1261 {
1262 CollapseHierarchy(objects_row_index);
1263 }
1264 RenderVariables(objects_row_index);
1265 }
1266 return true;
1267 }
1268 else if (w == m_PositionsListbox)
1269 {
1270
1271 vector position = GetCurrentLocationPos();
1272
1273 m_TeleportX.SetText(position[0].ToString());
1274 m_TeleportY.SetText(position[2].ToString());
1275
1276 if (IsCurrentPositionValid())
1277 {
1278 m_ConfigDebugProfile.SetSpawnLocIndex(GetCurrentPositionIndex());
1279 }
1280
1281 return true;
1282 }
1283 else if (w == m_TeleportButton)
1284 {
1285 float pos_x = m_TeleportX.GetText().ToFloat();
1286 float pos_z = m_TeleportY.GetText().ToFloat();
1287 float pos_y = GetGame().SurfaceY(pos_x, pos_z);
1288 vector v = Vector(pos_x, pos_y, pos_z);
1289 if (m_TeleportXYZ.GetText() != "" && m_TeleportXYZ.GetText() != DEFAULT_POS_XYZ)
1290 {
1291 string pos = m_TeleportXYZ.GetText();
1292 v = pos.BeautifiedToVector();
1293 }
1294 Teleport(player, v);
1295 return true;
1296 }
1297 else if (w == m_ButtonCopyPos)
1298 {
1299 GetGame().CopyToClipboard(GetMapPos().ToString());
1300 return true;
1301 }
1302 else if (w == m_CopySoundset)
1303 {
1304 AddItemToClipboard(m_SoundsTextListbox);
1305 return true;
1306 }
1307 else if (w == m_LogsEnabled)
1308 {
1309 //Log("m_LogsEnabled: "+ToString(m_LogsEnabled.IsChecked()));
1310
1312 {
1313 m_ConfigDebugProfile.SetLogsEnabled(m_LogsEnabled.IsChecked());
1314 LogManager.SetLogsEnabled(m_LogsEnabled.IsChecked());
1315 }
1316
1317 return true;
1318 }
1319 else if (w == m_SpawnBatchButton)
1320 {
1321 int count = m_BatchSpawnQuantity.GetText().ToInt();
1322 int rows = m_RectSpawnRow.GetText().ToInt();
1323 int columns = m_RectSpawnColumn.GetText().ToInt();
1324 float rowStep = m_RectSpawnRowStep.GetText().ToFloat();
1325 float columnStep = m_RectSpawnColumnStep.GetText().ToFloat();
1326 m_Developer.SpawnEntityOnGroundPatternGrid(player, m_SelectedObject,count, m_DamageEditBox.GetText().ToFloat(), 1, rows, columns, rowStep, columnStep);
1327 return true;
1328 }
1329
1330 else if (w == m_HudDCharStats)
1331 {
1333 {
1334 m_ConfigDebugProfile.SetCharacterStatsVisible(m_HudDCharStats.IsChecked());
1335 }
1336
1337 // Refresh UI by new settings
1338 m_MissionGameplay.GetHudDebug().RefreshByLocalProfile();
1339
1340 return true;
1341 }
1342 else if (w == m_HudDCharLevels)
1343 {
1345 {
1346 m_ConfigDebugProfile.SetCharacterLevelsVisible(m_HudDCharLevels.IsChecked());
1347 }
1348
1349 // Refresh UI by new settings
1350 m_MissionGameplay.GetHudDebug().RefreshByLocalProfile();
1351
1352 return true;
1353 }
1354 else if (w == m_HudDCharStomach)
1355 {
1357 {
1358 m_ConfigDebugProfile.SetCharacterStomachVisible(m_HudDCharStomach.IsChecked());
1359 }
1360
1361 // Refresh UI by new settings
1362 m_MissionGameplay.GetHudDebug().RefreshByLocalProfile();
1363
1364 return true;
1365 }
1366 else if (w == m_CategoryMergeType)
1367 {
1369 {
1370 m_ConfigDebugProfile.SetMergeType(m_CategoryMergeType.IsChecked());
1371 }
1372 ChangeFilterItems();
1373 // Refresh UI by new settings
1374 m_MissionGameplay.GetHudDebug().RefreshByLocalProfile();
1375
1376
1377 return true;
1378 }
1379 else if (w == m_WatchItem)
1380 {
1381 int row = m_VicinityListbox.GetSelectedRow();
1382
1383 if (m_VicinityItems.IsValidIndex(row))
1384 {
1385 Object entity = m_VicinityItems.Get(row);
1386 if (entity)
1387 {
1388 //Print(entity);
1389 PluginDeveloper.SetDeveloperItemClientEx(entity);
1390 }
1391 }
1392
1393
1394 }
1395 else if (w == m_ItemPreviewCheckbox)
1396 {
1398 {
1399 m_ConfigDebugProfile.SetShowItemPreview(m_ItemPreviewCheckbox.IsChecked());
1400 if (!m_ItemPreviewCheckbox.IsChecked())
1401 {
1403 }
1404 }
1405 }
1406 else if (w == m_HudDVersion)
1407 {
1409 {
1410 m_ConfigDebugProfile.SetVersionVisible(m_HudDVersion.IsChecked());
1411 }
1412
1413 // Refresh UI by new settings
1414 m_MissionGameplay.GetHudDebug().RefreshByLocalProfile();
1415
1416 return true;
1417 }
1418 else if (w == m_HudDTemperature)
1419 {
1421 {
1422 m_ConfigDebugProfile.SetTempVisible(m_HudDTemperature.IsChecked());
1423 }
1424
1425 // Refresh UI by new settings
1426 m_MissionGameplay.GetHudDebug().RefreshByLocalProfile();
1427
1428 return true;
1429 }
1430 else if (w == m_HudDCharModifiers)
1431 {
1433 {
1434 m_ConfigDebugProfile.SetCharacterModifiersVisible(m_HudDCharModifiers.IsChecked());
1435 }
1436
1437 // Refresh UI by new settings
1438 m_MissionGameplay.GetHudDebug().RefreshByLocalProfile();
1439
1440 return true;
1441 }
1442 else if (w == m_HudDCharAgents)
1443 {
1445 {
1446 m_ConfigDebugProfile.SetCharacterAgentsVisible(m_HudDCharAgents.IsChecked());
1447 }
1448
1449 // Refresh UI by new settings
1450 m_MissionGameplay.GetHudDebug().RefreshByLocalProfile();
1451
1452 return true;
1453 }
1454 else if (w == m_HudDCharDebug)
1455 {
1457 {
1458 m_ConfigDebugProfile.SetCharacterDebugVisible(m_HudDCharDebug.IsChecked());
1459 }
1460
1461 // Refresh UI by new settings
1462 m_MissionGameplay.GetHudDebug().RefreshByLocalProfile();
1463
1464 return true;
1465 }
1466 else if (w == m_HudDFreeCamCross)
1467 {
1469 {
1470 m_ConfigDebugProfile.SetFreeCameraCrosshairVisible(m_HudDFreeCamCross.IsChecked());
1471 }
1472
1473 // Refresh UI by new settings
1474 m_MissionGameplay.GetHudDebug().RefreshByLocalProfile();
1475
1477
1478 return true;
1479 }
1480 else if (w == m_ObjectsTextListbox)
1481 {
1482 SelectObject();
1483 return true;
1484 }
1485 else if (w == m_ObjectFilter)
1486 {
1487 ChangeFilterItems();
1488 return true;
1489 }
1490 else if (w == m_SoundFilter)
1491 {
1492 ChangeFilterSound();
1493 return true;
1494 }else if (w == m_SoundFilter)
1495 {
1496 ChangeFilterSound();
1497 return true;
1498 }
1499 else if (w == m_SpawnInInvButton || w == m_SpawnGroundButton || w == m_SpawnAsAttachment || w == m_SpawnSpecial)
1500 {
1501 SaveProfileSpawnDistance();
1502
1503 objects_row_index = m_ObjectsTextListbox.GetSelectedRow();
1504
1506 vector rayEnd = rayStart + GetGame().GetCurrentCameraDirection() * 3;
1507 vector hitPos;
1508 vector hitNormal;
1509 int hitComponentIndex;
1510 set<Object> hitObjects = new set<Object>;
1511 //DayZPhysics.RaycastRV(rayStart, rayEnd, hitPos, hitNormal, hitComponentIndex, hitObjects, NULL, player,);
1512 DayZPhysics.RaycastRV(rayStart, rayEnd, hitPos, hitNormal, hitComponentIndex, hitObjects, NULL, player, false, false, ObjIntersectView, 0.3);
1513
1514 Object target = NULL;
1515 if (hitObjects.Count())
1516 target = hitObjects.Get(0);
1517
1518 if (m_SelectedObject != "")
1519 {
1520 // @NOTE: duplicate code in PluginDeveloper.c
1521 float distance = m_SpawnDistanceEditBox.GetText().ToFloat();
1522 if (m_SelectedObjectIsPreset == 1)
1523 {
1524 switch (w)
1525 {
1526 case m_SpawnAsAttachment:
1527 {
1528 if (target != NULL && target.IsInherited(EntityAI))
1529 {
1530 EntityAI att_parent = EntityAI.Cast(target) ;
1531 SpawnPreset(att_parent, CLEAR_IVN, m_SelectedObject);
1532 }
1533 else
1534 {
1535 SpawnPreset(player, false, m_SelectedObject);
1536 }
1537 break;
1538 }
1539 case m_SpawnGroundButton:
1540 {
1541 SpawnPreset(player, false, m_SelectedObject, InventoryLocationType.GROUND, distance);
1542 break;
1543 }
1544
1545 case m_SpawnSpecial:
1546 {
1547 SpawnPreset(player, false, m_SelectedObject, InventoryLocationType.GROUND, distance);
1548 break;
1549 }
1550
1551 default:
1552 {
1553 SpawnPreset(player, CLEAR_IVN, m_SelectedObject);
1554 break;
1555 }
1556 }
1557 }
1558 else
1559 {
1560
1561 float health = m_DamageEditBox.GetText().ToFloat() * MiscGameplayFunctions.GetTypeMaxGlobalHealth(m_SelectedObject);
1562 float quantity = -1;
1563 int cfgQuantity = GetGame().ConfigGetInt("CfgVehicles " + m_SelectedObject + " varQuantityInit");
1564
1565 if (cfgQuantity > 0)
1566 {
1567 quantity = m_QuantityEditBox.GetText().ToFloat() * GetGame().ConfigGetInt("CfgVehicles " + m_SelectedObject + " varQuantityInit");
1568 if (GetGame().ConfigGetFloat("CfgVehicles " + m_SelectedObject + " canBeSplit"))
1569 {
1570 quantity = m_QuantityEditBox.GetText().ToFloat() * GetGame().ConfigGetInt("CfgVehicles " + m_SelectedObject + " varStackInit");
1571 }
1572 }
1573
1574 switch (w)
1575 {
1576 case m_SpawnGroundButton:
1577 {
1578 m_Developer.SpawnEntityOnCursorDir(player, m_SelectedObject, quantity, distance, health);
1579 break;
1580 }
1581
1582 case m_SpawnGroundPatternGrid:
1583 {
1584 m_Developer.SpawnEntityOnCursorDir(player, m_SelectedObject, quantity, distance, health);
1585 break;
1586 }
1587
1588 case m_SpawnSpecial:
1589 {
1590 m_Developer.SpawnEntityOnCursorDir(player, m_SelectedObject, quantity, distance, health, true);
1591 break;
1592 }
1593
1594 case m_SpawnAsAttachment:
1595 {
1596 if (target != NULL && target.IsInherited(EntityAI))
1597 {
1598 EntityAI att_parent2 = EntityAI.Cast(target);
1599 m_Developer.SpawnEntityAsAttachment(player, att_parent2, m_SelectedObject, 100, -1);
1600 }
1601 else
1602 {
1603 m_Developer.SpawnEntityAsAttachment(player, player, m_SelectedObject, 100, -1);
1604 }
1605 break;
1606 }
1607
1608 case m_SpawnInInvButton:
1609 {
1610 m_Developer.SpawnEntityInInventory(player, m_SelectedObject, -1, -1);
1611 break;
1612 }
1613 case m_SpawnGroundButton:
1614 {
1615 m_Developer.SpawnEntityOnCursorDir(player, m_SelectedObject, quantity, distance, health);
1616 break;
1617 }
1618 }
1619 }
1620 }
1621 return true;
1622 }
1623 else if (w == m_DiagToggleButton)
1624 {
1625 int toggle_row_index = m_DiagToggleTextListbox.GetSelectedRow();
1626 bool toggle_state = GetGame().GetDiagModeEnable(toggle_row_index);
1627 GetGame().SetDiagModeEnable(toggle_row_index, !toggle_state);
1628 return true;
1629 }
1630 else if (w == m_DiagDrawButton)
1631 {
1632 int draw_row_index = m_DiagDrawmodeTextListbox.GetSelectedRow();
1633 GetGame().SetDiagDrawMode(draw_row_index);
1634 return true;
1635 }
1636 else if (w == m_CloseConsoleButton)
1637 {
1638 Close();
1640 return true;
1641 }
1642 else if (w == m_PresetsTextListbox)
1643 {
1644 SelectPreset();
1645 return true;
1646 }
1647 else if (w == m_PresetItemsTextListbox)
1648 {
1649 m_ObjectsTextListbox.SelectRow(-1);
1650 ShowItemButtons();
1651 ShowItemTransferButtons();
1652 m_SelectedObjectText.SetText("Object : " + GetCurrentItemName());
1653 SetObject(GetCurrentItemName());
1654 m_SelectedObjectIsPreset = 0;
1655
1656 return true;
1657 }
1658 else if (w == m_PresetSetDefaultButton)
1659 {
1660 if (GetCurrentPresetName()!= "")
1661 {
1662 SetDefaultPreset(GetCurrentPresetIndex());
1663 }
1664 return true;
1665 }
1666 else if (w == m_PresetNewButton)
1667 {
1668 g_Game.GetUIManager().EnterScriptedMenu(MENU_SCRIPTCONSOLE_DIALOG_PRESET_NAME, this);
1669 return true;
1670 }
1671 else if (w == m_PresetDeleteButton)
1672 {
1673 if (GetCurrentPresetName()!= "")
1674 {
1675 DeletePreset();
1676 }
1677 return true;
1678 }
1679 else if (w == m_PresetRenameButton)
1680 {
1681 if (GetCurrentPresetName()!= "")
1682 {
1683 g_Game.GetUIManager().EnterScriptedMenu(MENU_SCRIPTCONSOLE_DIALOG_PRESET_RENAME, this);
1684 }
1685 return true;
1686 }
1687 else if (w == m_PresetAddItemtButton)
1688 {
1689 AddItemToPreset();
1690 return true;
1691 }
1692 else if (w == m_ItemNameCopy)
1693 {
1694 AddItemToClipboard(m_ObjectsTextListbox);
1695 return true;
1696 }
1697 else if (w == m_SelectedRowCopy)
1698 {
1699 AddItemToClipboard(m_ConfigVariablesTextListbox);
1700 return true;
1701 }
1702 else if (w == m_PresetRemoveItemButton)
1703 {
1704 RemoveItemFromPreset();
1705 return true;
1706 }
1707 else if (w == m_ItemMoveUpButton)
1708 {
1709 ItemMoveUp();
1710 return true;
1711 }
1712 else if (w == m_ItemMoveDownButton)
1713 {
1714 ItemMoveDown();
1715 return true;
1716 }
1717 else if (w == m_EnfScriptRun)
1718 {
1719 if (m_ScriptServer)
1720 RunEnscriptServer();
1721 else
1722 RunEnscript();
1723 return true;
1724 }
1725 else if (w == m_EnfScriptClear)
1726 {
1727 m_ScriptOutputListbox.ClearItems();
1728 m_ScriptOutputHistory.Clear();
1729 return true;
1730 }
1731 else if (w == m_DrawInWorld)
1732 {
1733 DrawItems(m_SelectedObject);
1734 return true;
1735
1736 }
1737 else if (w == m_DrawInWorldClear)
1738 {
1739 DrawItemsClear();
1740 return true;
1741 }
1742 else if (w == m_PlaySoundsetButton)
1743 {
1744 if (m_SoundSet)
1745 m_SoundSet.Stop();
1746 GetGame().GetPlayer().PlaySoundSet(m_SoundSet, m_ConfigData.param2, 0, 0);
1747 return true;
1748 }
1749 else if (w == m_PlaySoundset || w == m_PlaySoundsetLooped)
1750 {
1751 int selected_row_index = m_SoundsTextListbox.GetSelectedRow();
1752 string soundSetName;
1753 if (m_SoundSet)
1754 m_SoundSet.Stop();
1755 if (selected_row_index != -1)
1756 {
1757 m_SoundsTextListbox.GetItemText(selected_row_index, 0, soundSetName);
1758
1759 if (w == m_PlaySoundsetLooped)
1760 {
1761 m_SoundSet = SEffectManager.PlaySoundEnviroment(soundSetName, GetGame().GetPlayer().GetPosition(), 0, 0, true);
1762 }
1763 else
1764 {
1765 m_SoundSet = SEffectManager.PlaySoundEnviroment(soundSetName, GetGame().GetPlayer().GetPosition());
1766 }
1767 }
1768 return true;
1769 }
1770 else if (w == m_StopSoundset)
1771 {
1772 if (m_SoundSet)
1773 m_SoundSet.Stop();
1774 return true;
1775 }
1776 else if (w == m_LocationAddButton)
1777 {
1778 ScriptConsoleAddLocation menu = ScriptConsoleAddLocation.Cast(g_Game.GetUIManager().EnterScriptedMenu(MENU_LOC_ADD, this));
1779 menu.SetPosition(GetMapPos());
1780 return true;
1781 }
1782 else if (w == m_LocationRemoveButton)
1783 {
1784 m_ConfigDebugProfile.CustomLocationsRemove(GetCurrentLocationName());
1785 RefreshLocations();
1786 return true;
1787 }
1788 else if (w == m_FilterOrderButton)
1789 {
1790 SetFilterOrder(!m_FilterOrderReversed);
1791 return true;
1792 }
1793
1794 else
1795 {
1796 CheckBoxWidget cbw = CheckBoxWidget.Cast(w);
1797
1798 if (cbw && m_ClassCheckboxes.Contains(cbw))
1799 {
1800 //Print("checkbox toggled " + m_ClassCheckboxes.Get(cbw));
1801 int checkbox_index = m_ClassCheckboxes.Get(cbw);
1802 string base_class_name = m_BaseConfigClasses.Get(checkbox_index);
1803
1804 int index_toggled = m_BaseConfigClassesToggled.Find(base_class_name);
1805
1806 int flag, new_flag;
1807
1809 {
1810 flag = m_ConfigDebugProfile.GetConfigClassesFlag();
1811 }
1812
1813 if (cbw.IsChecked())
1814 {
1815 if (index_toggled == -1)//not found
1816 {
1817 m_BaseConfigClassesToggled.Insert(base_class_name);
1818
1820 {
1821 new_flag = (flag | (int)Math.Pow(2, checkbox_index));
1822 }
1823 }
1824 }
1825 else if (index_toggled != -1)
1826 {
1827 m_BaseConfigClassesToggled.Remove(index_toggled);
1828
1830 {
1831 new_flag = (flag ^ (int)Math.Pow(2, checkbox_index));
1832 }
1833 }
1834 m_ConfigDebugProfile.SetConfigClassesFlag(new_flag);
1835 /*
1836 Print("-----------------------------------------");
1837 Print("flag = " + new_flag);
1838 foreach (string text:m_BaseConfigClassesToggled)
1839 {
1840 Print(text);
1841 }
1842 Print("-----------------------------------------");
1843 */
1844 ClearHierarchy();
1845
1846 }
1847 }
1848
1849 // tabs
1850 for (i = 0; i < TABS_COUNT; i++)
1851 {
1852 if (w == m_Tab_buttons[i])
1853 {
1854 SelectTab(i);
1855 return true;
1856 }
1857 }
1858
1859 return false;
1860 }
1861
1862 override bool OnDoubleClick(Widget w, int x, int y, int button)
1863 {
1864 super.OnDoubleClick(w, x, y, button);
1865
1866 int i;
1867 int objects_row_index;
1868 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
1869
1870 if (w == m_ObjectsTextListbox)
1871 {
1872 //select item
1873 m_PresetItemsTextListbox.SelectRow(-1);
1874 HideItemButtons();
1875 ShowItemTransferButtons();
1876 m_SelectedObjectText.SetText("Object : " + GetCurrentObjectName());
1877
1878 m_SelectedObject = GetCurrentObjectName();
1879 m_LastSelectedObject = m_SelectedObject;
1880 m_SelectedObjectIsPreset = 0;
1881
1882 //spawn item
1883 SaveProfileSpawnDistance();
1884
1885 objects_row_index = m_ObjectsTextListbox.GetSelectedRow();
1886
1888 vector rayEnd = rayStart + GetGame().GetCurrentCameraDirection() * 1.5;
1889 vector hitPos;
1890 vector hitNormal;
1891 int hitComponentIndex;
1892 set<Object> hitObjects = new set<Object>;
1893 DayZPhysics.RaycastRV(rayStart, rayEnd, hitPos, hitNormal, hitComponentIndex, hitObjects, NULL, player);
1894
1895 Object target = NULL;
1896 if (hitObjects.Count())
1897 target = hitObjects.Get(0);
1898
1899 if (m_SelectedObject != "")
1900 {
1901 float distance = m_SpawnDistanceEditBox.GetText().ToFloat();
1902
1903 if (button == 0) //LMB
1904 {
1905 m_Developer.SpawnEntityOnCursorDir(player, m_SelectedObject, 100, distance);
1906 }
1907 else if (button == 1) //RMB
1908 {
1909 if (GetGame().IsMultiplayer())
1910 {
1911 m_Developer.SpawnEntityInInventory(player, m_SelectedObject, -1, -1);
1912 }
1913 else
1914 {
1915 EntityAI spawned_entity = m_Developer.SpawnEntityOnCursorDir(player, m_SelectedObject, -1, distance);
1916 player.LocalTakeEntityToHands(spawned_entity);
1917 }
1918 }
1919 }
1920 }
1921
1922 if (w == m_DebugMapWidget)
1923 {
1924 vector screen_to_map = m_DebugMapWidget.ScreenToMap(Vector(x,y, 0));
1925 float pos_y_a = GetGame().SurfaceY(screen_to_map[0], screen_to_map[2]);
1926 float pos_y_b = GetGame().SurfaceRoadY(screen_to_map[0], screen_to_map[2]);
1927 float pos_y = Math.Max(pos_y_a, pos_y_b);
1928 screen_to_map[1] = pos_y;
1929 m_Developer.Teleport(player, screen_to_map);
1930 return true;
1931 }
1932
1933 if (w == m_PositionsListbox)
1934 {
1935 vector position = GetCurrentLocationPos();
1936 Teleport(player, position);
1937 return true;
1938 }
1939
1940 if (w == m_TeleportXYZ)
1941 {
1942 EditBoxWidget.Cast(w).SetText("");
1943 return true;
1944 }
1945
1946 return false;
1947 }
1948
1949 void Teleport(PlayerBase player, vector position)
1950 {
1951 if (position[1] == 0)
1952 position[1] = GetGame().SurfaceY(position[0], position[2]);
1953 m_Developer.Teleport(player, position);
1954 }
1955
1956 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
1957 {
1958 super.OnMouseLeave(w, enterW, x, y);
1959 /*
1960 if (w == m_TeleportXYZ)
1961 {
1962 if (m_TeleportXYZ.GetText() == "")
1963 EditBoxWidget.Cast(w).SetText(DEFAULT_POS_XYZ);
1964 return false;
1965 }*/
1966 return false;
1967 }
1968
1969 override bool OnMouseEnter(Widget w, int x, int y)
1970 {
1971 super.OnMouseEnter(w, x, y);
1972
1973 #ifdef PLATFORM_CONSOLE
1974 return false;
1975 #endif
1976 return true;
1977 }
1978
1979 override bool OnChange(Widget w, int x, int y, bool finished)
1980 {
1981 super.OnChange(w, x, y, finished);
1982
1983 for (int i =0; i < TABS_COUNT; i++)
1984 {
1985 if (m_TabHandlers[i])
1986 m_TabHandlers[i].OnChange(w,x,y,finished);
1987 }
1988
1989 if (w == m_ObjectFilter)
1990 {
1991 m_RefreshFilterTimer.Run(0.85, this, "ChangeFilterItems", null, false);
1992 return true;
1993 }
1994 else if (w == m_SoundFilter)
1995 {
1996 m_RefreshFilterTimer.Run(0.85, this, "ChangeFilterSound", null, false);
1997 return true;
1998 }
1999 else if (w == m_QuantityEditBox && (GetCurrentItemIndex() >= 0 || GetCurrentPresetName() != ""))
2000 {
2001 m_ConfigDebugProfile.SetItemQuantity(GetCurrentPresetName(), GetCurrentItemIndex(), m_QuantityEditBox.GetText().ToFloat());
2002 return true;
2003 }
2004 else if (w == m_DrawDistanceWidget)
2005 {
2006 DRAW_DISTANCE = m_DrawDistanceWidget.GetText().ToFloat();
2007 return true;
2008 }
2009 else if (w == m_DamageEditBox && (GetCurrentItemIndex() >= 0 || GetCurrentPresetName() != ""))
2010 {
2011 m_ConfigDebugProfile.SetItemHealth(GetCurrentPresetName(), GetCurrentItemIndex(), m_DamageEditBox.GetText().ToFloat());
2012 return true;
2013 }
2014 else if (w == m_ObjectConfigFilter)
2015 {
2016 ChangeConfigFilter();
2017 return true;
2018 }
2019 else if (w == m_BatchSpawnQuantity)
2020 {
2021 m_ConfigDebugProfile.SetBatchSpawnQuantity(m_BatchSpawnQuantity.GetText().ToInt());
2022 return true;
2023 }
2024 else if ((w == m_RectSpawnRow || w == m_RectSpawnColumn || w == m_RectSpawnRowStep || w == m_RectSpawnColumnStep))
2025 {
2026 if (w == m_RectSpawnRow || w == m_RectSpawnColumn)
2027 {
2028 int rowQ = m_RectSpawnRow.GetText().ToInt();
2029 int columnQ = m_RectSpawnColumn.GetText().ToInt();
2030 int result = columnQ * rowQ;
2031 m_BatchSpawnQuantity.SetText(result.ToString());
2032 m_ConfigDebugProfile.SetBatchSpawnQuantity(m_BatchSpawnQuantity.GetText().ToInt());
2033 }
2034
2036 {
2037 m_ConfigDebugProfile.SetBatchSpawnRectangle(m_RectSpawnRow.GetText().ToInt(),m_RectSpawnColumn.GetText().ToInt(), m_RectSpawnRowStep.GetText().ToFloat(),m_RectSpawnColumnStep.GetText().ToFloat());
2038 }
2039 return true;
2040 }
2041
2042
2043 else if (w == m_ShowProtected)
2044 {
2045 if (m_ShowProtected.IsChecked())
2046 {
2047 m_ObjectsScope = 1;
2048 }
2049 else
2050 {
2051 m_ObjectsScope = 2;
2052 }
2053 ChangeFilterItems();
2054 return true;
2055 }
2056 else if (w == m_ShowOthers)
2057 {
2058 PluginRemotePlayerDebugClient plugin_remote_client = PluginRemotePlayerDebugClient.Cast(GetPlugin(PluginRemotePlayerDebugClient));
2059 if (m_ShowOthers.IsChecked())
2060 {
2061 plugin_remote_client.RequestPlayerInfo(PlayerBase.Cast(GetGame().GetPlayer()), 1);
2062 m_UpdateMap = 1;
2063 SHOW_OTHERS = true;
2064 }
2065 else
2066 {
2067 plugin_remote_client.RequestPlayerInfo(PlayerBase.Cast(GetGame().GetPlayer()), 0);
2068 m_UpdateMap = 0;
2069 SHOW_OTHERS = false;
2070 }
2071 return true;
2072 }
2073 else if (w == m_ClearInventory)
2074 {
2075 CLEAR_IVN = m_ClearInventory.IsChecked();
2076 return true;
2077 }
2078 else if (m_CategoryButtonsWidgets.Find(w) >= 0)
2079 {
2080
2081 int pos = m_CategoryButtonsWidgets.Find(w);
2082 int bit = Math.Pow(2,pos);
2083 CheckBoxWidget cbw = CheckBoxWidget.Cast(w);
2084 if (cbw.IsChecked())
2085 {
2086 m_CategoryMask = m_CategoryMask | bit;
2087 cbw.SetTextColor(ARGB(255, 255, 0, 0));
2088 }
2089 else
2090 {
2091 m_CategoryMask = (m_CategoryMask & ~bit);
2092 cbw.SetTextColor(ARGB(255, 255, 255,255));
2093 }
2094
2095 ChangeFilterItems();
2096 return true;
2097 }
2098 else if (w == m_TimeSlider || w == m_DateDay || w == m_DateYear || w == m_DateMonth || w == m_DateHour || w == m_DateMinute)
2099 {
2100 UpdateTime(w == m_TimeSlider);
2101 }
2102
2103 return false;
2104 }
2105
2106
2107 override bool OnItemSelected(Widget w, int x, int y, int row, int column, int oldRow, int oldColumn)
2108 {
2109 super.OnItemSelected(w, x, y, row, column, oldRow, oldColumn);
2110 if (w == m_PositionsListbox)
2111 {
2112 vector position = GetCurrentLocationPos();
2113 m_TeleportX.SetText(position[0].ToString());
2114 m_TeleportY.SetText(position[2].ToString());
2115 m_TeleportXYZ.SetText(position.ToString());
2116 if (IsCurrentPositionValid())
2117 {
2118 m_ConfigDebugProfile.SetSpawnLocIndex(GetCurrentPositionIndex());
2119 }
2120
2121 return true;
2122 }
2123 else if (w == m_PresetsTextListbox && (m_SelectedObjectIsPreset == 1 || m_SelectedObjectIsPreset == -1))
2124 {
2125 if (m_PresetsTextListbox.GetSelectedRow() != -1)
2126 {
2127 SelectPreset();
2128 return true;
2129 }
2130 }
2131 else if (w == m_PresetItemsTextListbox)
2132 {
2133 if (m_PresetItemsTextListbox.GetSelectedRow() != -1)
2134 {
2135 ShowItemButtons();
2136 ShowItemTransferButtons();
2137 m_SelectedObjectText.SetText(GetCurrentItemName());
2138 SetObject(GetCurrentItemName());
2139 m_SelectedObjectIsPreset = 0;
2140 }
2141 return true;
2142 }
2143 else if (w == m_ObjectsTextListbox)
2144 {
2145 SelectObject(false);
2146 return true;
2147 }
2148 else if (w == m_ConfigHierarchyTextListbox)
2149 {
2150 TextListboxWidget wgt = TextListboxWidget.Cast(w);
2151 wgt.GetItemData(row, 0,m_ConfigData);
2152
2153 if (m_ConfigData.param6 == CFG_SOUND_SETS)
2154 {
2155 m_PlaySoundsetButton.Show(true);
2156 }
2157 else
2158 {
2159 m_PlaySoundsetButton.Show(false);
2160 }
2161 return true;
2162 }
2163 return false;
2164 }
2165
2167 {
2168 m_ConfigDebugProfile.SetItemSearch(m_ObjectFilter.GetText());
2169 ChangeFilter(GetItemsClasses(), m_ObjectsTextListbox,m_ObjectFilter, m_CategoryMask);
2170 }
2171
2173 {
2174 m_ConfigDebugProfile.SetSoundsetFilter(m_SoundFilter.GetText());
2175 ChangeFilter(GetSoundClasses(), m_SoundsTextListbox, m_SoundFilter, 0,true);
2176 }
2177
2179 {
2180 m_ObjectsTextListbox.SelectRow(-1);
2181 RenderPresetItems();
2182 ShowPresetButtons();
2183 ShowItemTransferButtons();
2184 m_SelectedObject = GetCurrentPresetName();
2185 m_SelectedObjectText.SetText("Preset : " + m_SelectedObject);
2186 m_SelectedObjectIsPreset = 1;
2187
2188 TStringArray command_array = new TStringArray;
2189
2190 m_ConfigDebugProfileFixed.GetPresetItems(m_SelectedObject, command_array, "cmd");
2191
2192 bool clear = !IsPresetFixed(m_SelectedObject);
2193 if (command_array.IsValidIndex(0))
2194 {
2195 string first_line = command_array.Get(0);
2196 first_line.ToLower();
2197 clear = (first_line == "clear_inv");
2198 }
2199
2200 m_ClearInventory.SetChecked(clear);
2201
2202
2203
2204 }
2205
2207 {
2208 RenderPresets();
2209 RenderPresetItems();
2210 }
2211
2212 // Render specific Preset Items
2214 {
2215 m_PresetsTextListbox.ClearItems();
2216
2217 int i;
2218 TBoolArray preset_params;
2219
2220 // load custom presets list
2221 TStringArray custom_presets_array = m_ConfigDebugProfile.GetPresets();
2222 for (i = custom_presets_array.Count() - 1; i >= 0; i--)
2223 {
2224 m_PresetsTextListbox.AddItem(custom_presets_array.Get(i), new PresetParams (custom_presets_array.Get(i),false, false), 0);
2225 }
2226
2227 // load fixed presets list
2228 TStringArray presets_array = m_ConfigDebugProfileFixed.GetPresets();
2229 for (i = 0; i < presets_array.Count(); i++)
2230 {
2231 m_PresetsTextListbox.AddItem("["+presets_array.Get(i)+"]", new PresetParams (presets_array.Get(i), true, false), 0);
2232 }
2233 string default_preset = m_ConfigDebugProfile.GetDefaultPreset();
2234 if (default_preset != "")
2235 {
2236 // if is fixed
2237 int index = GetPresetIndexByName(default_preset);
2238 if (IsPresetFixed(default_preset))
2239 {
2240 default_preset = "[" + default_preset + "]";
2241 }
2242 PresetParams preset_params_array;
2243 if (index > -1 && index < m_PresetsTextListbox.GetNumItems())
2244 {
2245 m_PresetsTextListbox.GetItemData(index, 0, preset_params_array);
2246 m_PresetsTextListbox.SetItem(index, default_preset + CONST_DEFAULT_PRESET_PREFIX, preset_params_array, 0);
2247 }
2248 }
2249 }
2250
2251 // Render specific Preset Items
2253 {
2254 // load preset items list
2255 int i;
2256 m_PresetItemsTextListbox.ClearItems();
2257 if (GetCurrentPresetIndex() != -1)
2258 {
2259 bool isFixed = IsCurrentPresetFixed();
2260 TStringArray preset_array = new TStringArray;
2261
2262 if (isFixed)
2263 {
2264 m_ConfigDebugProfileFixed.GetPresetItems(GetCurrentPresetName(), preset_array);
2265 }
2266 else
2267 {
2268 m_ConfigDebugProfile.GetPresetItems(GetCurrentPresetName(), preset_array);
2269 }
2270
2271 if (preset_array)
2272 {
2273 for (i = 0; i < preset_array.Count(); i++)
2274 {
2275 m_PresetItemsTextListbox.AddItem(preset_array.Get(i), NULL, 0);
2276 }
2277 }
2278 }
2279 }
2280
2281 void NewPreset(string preset_name)
2282 {
2283 m_ConfigDebugProfile.PresetAdd(preset_name);
2284 RefreshLists();
2285 }
2286
2288 {
2289 if (GetCurrentPresetIndex() != -1)
2290 {
2291 bool result = m_ConfigDebugProfile.PresetRemove(GetCurrentPresetName());
2292 RefreshLists();
2293 }
2294 }
2295
2297 {
2298 if (m_ConfigDebugProfile && m_SpawnDistanceEditBox)
2299 {
2300 m_ConfigDebugProfile.SetSpawnDistance(m_SpawnDistanceEditBox.GetText().ToFloat());
2301 }
2302 }
2303
2304 void RenamePreset(string new_preset_name)
2305 {
2306 if (new_preset_name && GetCurrentPresetIndex() != -1)
2307 {
2308 bool result = m_ConfigDebugProfile.PresetRename(GetCurrentPresetName(), new_preset_name);
2309 RefreshLists();
2310 }
2311 }
2312
2313
2314 void SpawnPreset(EntityAI target, bool clear_inventory, string preset_name, InventoryLocationType location = InventoryLocationType.ATTACHMENT, float distance = 0)
2315 {
2316 // spawn preset items into inventory
2317 int i;
2318 PlayerBase player = PlayerBase.Cast(target);
2319 if (GetCurrentPresetIndex() != -1)
2320 {
2321 bool is_preset_fixed = IsCurrentPresetFixed();
2322 TStringArray preset_array = new TStringArray;
2323
2324 if (is_preset_fixed)
2325 {
2326 m_ConfigDebugProfileFixed.GetPresetItems(preset_name, preset_array);
2327
2328 }
2329 else
2330 {
2331 m_ConfigDebugProfile.GetPresetItems(preset_name, preset_array);
2332 }
2333
2334 if (clear_inventory)
2335 {
2336 m_Developer.ClearInventory(player);
2337 }
2338
2339 for (i = 0; i < preset_array.Count(); i++)
2340 {
2341 float health = -1;
2342 int quantity = -1;
2343 if (is_preset_fixed)
2344 {
2345 health = m_ConfigDebugProfileFixed.GetItemHealth(preset_name, i);
2346 quantity = m_ConfigDebugProfileFixed.GetItemQuantity(preset_name, i);
2347 }
2348 else
2349 {
2350 health = m_ConfigDebugProfile.GetItemHealth(preset_name, i);
2351 quantity = m_ConfigDebugProfile.GetItemQuantity(preset_name, i);
2352 }
2353 if (location == InventoryLocationType.ATTACHMENT)
2354 EntityAI ent = m_Developer.SpawnEntityInInventory(player, preset_array.Get(i), -1, quantity, false, preset_name);
2355 else if (location == InventoryLocationType.GROUND)
2356 {
2357 m_Developer.SpawnEntityOnCursorDir(player, preset_array.Get(i), quantity, distance, health, false, preset_name);
2358 }
2359 }
2360
2361 player.RPCSingleParam(ERPCs.DEV_RPC_SPAWN_PRESET, new Param1<string>(preset_name), true);
2362 }
2363 }
2364
2365 void SetDefaultPreset(int preset_index)
2366 {
2367 // remove previous default parameter
2368 string default_preset = m_ConfigDebugProfile.GetDefaultPreset();
2369 if (default_preset != "")
2370 {
2371 int index = GetPresetIndexByName(default_preset);
2372 // if is fixed
2373 if (IsPresetFixed(default_preset))
2374 {
2375 default_preset = "[" + default_preset + "]";
2376 }
2377 PresetParams prev_preset_params_array;
2378 if (index > -1 && index < m_PresetsTextListbox.GetNumItems())
2379 {
2380 m_PresetsTextListbox.GetItemData(index, 0, prev_preset_params_array);
2381 prev_preset_params_array.param3 = false; // remove DEFAULT
2382 m_PresetsTextListbox.SetItem(index, default_preset, prev_preset_params_array, 0);
2383 }
2384 }
2385
2386 // set preset on preset_index to default
2387 // if is fixed
2388 string preset_name = GetCurrentPresetName();
2389 if (IsPresetFixed(preset_name))
2390 {
2391 preset_name = "[" + preset_name + "]";
2392 }
2393 // set new default preset
2394 PresetParams preset_params_array;
2395 index = GetCurrentPresetIndex();
2396 if (index > -1 && index < m_PresetsTextListbox.GetNumItems())
2397 {
2398 m_PresetsTextListbox.GetItemData(index, 0, preset_params_array);
2399 preset_params_array.param3 = true; // DEFAULT
2400 m_PresetsTextListbox.SetItem(index, preset_name + CONST_DEFAULT_PRESET_PREFIX, preset_params_array, 0);
2401 }
2402 // store preset
2403 m_ConfigDebugProfile.SetDefaultPreset(GetCurrentPresetName());
2404 }
2405
2406 void SetObject(string object)
2407 {
2408 m_SelectedObject = object;
2409
2410 if (m_ConfigDebugProfile && m_ConfigDebugProfile.GetShowItemPreview())
2411 {
2412 SetPreviewObject(object);
2413 }
2414
2415 }
2416
2417 void SetPreviewObject(string object)
2418 {
2419 #ifdef DEVELOPER
2420 if (m_PreviewEntity)
2421 {
2422 m_PreviewEntity.Delete();
2423 }
2424
2425 if (!GetGame().IsKindOf(object, "DZ_LightAI") && !GetGame().IsKindOf(object, "Man"))
2426 {
2427 DayZGame.m_IsPreviewSpawn = true;
2428 m_PreviewEntity = EntityAI.Cast(GetGame().CreateObjectEx(object, "0 0 0", ECE_LOCAL | ECE_PLACE_ON_SURFACE));
2429 DayZGame.m_IsPreviewSpawn = false;
2430 if (m_PreviewEntity)
2431 {
2432 dBodyDestroy(m_PreviewEntity);//prevents cars from acting up when spawned this way(we only want the preview pic, no physics required)
2433 m_PreviewEntity.DisableSimulation(true);
2434 m_ItemPreviewWidget.SetItem(m_PreviewEntity);
2435 m_PreviewEntity.SetAllowDamage(false);
2436 }
2437 }
2438 #endif
2439 }
2440
2442 {
2443 int selected_row_index = m_ObjectsTextListbox.GetSelectedRow();
2444 if (selected_row_index != -1 && GetCurrentPresetIndex() != -1)
2445 {
2446 string item_name;
2447 m_ObjectsTextListbox.GetItemText(selected_row_index, 0, item_name);
2448 m_ConfigDebugProfile.ItemAddToPreset(GetCurrentPresetName(), item_name);
2449 RenderPresetItems();
2450 }
2451 }
2452
2454 {
2455 bool show = true;
2456 if (IsCurrentPresetFixed())
2457 {
2458 show = false;
2459 }
2460 m_PresetDeleteButton.Show(show);
2461 m_PresetRenameButton.Show(show);
2462
2463 HideItemButtons();
2464
2465 }
2466
2467 void AddItemToClipboard(TextListboxWidget text_listbox_widget)
2468 {
2469 int selected_row_index = text_listbox_widget.GetSelectedRow();
2470 if (selected_row_index != -1)
2471 {
2472 string item_name;
2473 text_listbox_widget.GetItemText(selected_row_index, 0, item_name);
2474 GetGame().CopyToClipboard(item_name);
2475 }
2476 }
2477
2479 {
2480 if (GetCurrentItemIndex() != -1 && GetCurrentPresetIndex() != -1)
2481 {
2482 m_ConfigDebugProfile.ItemRemoveFromPreset(GetCurrentPresetName(), GetCurrentItemIndex());
2483 RenderPresetItems();
2484 }
2485 }
2486
2488 {
2489 int index = GetCurrentPresetIndex();
2490 // load preset items list
2491 if (index > -1 && index < m_PresetsTextListbox.GetNumItems())
2492 {
2493 PresetParams item_params_array;
2494 m_PresetsTextListbox.GetItemData(index, 0, item_params_array);
2495 return item_params_array.param1;
2496 }
2497 return "";
2498 }
2499
2501 {
2502 if (GetCurrentItemIndex() != -1)
2503 {
2504 string item_name;
2505 m_PresetItemsTextListbox.GetItemText(GetCurrentItemIndex(), 0, item_name);
2506 return item_name;
2507 }
2508 return "";
2509 }
2510
2512 {
2513 int selected_row_index = m_ObjectsTextListbox.GetSelectedRow();
2514 if (selected_row_index != -1)
2515 {
2516 string item_name;
2517 m_ObjectsTextListbox.GetItemText(selected_row_index, 0, item_name);
2518 return item_name;
2519 }
2520 return "";
2521 }
2522
2524 {
2525 string name;
2526 LocationParams prms;
2527 GetCurrentPositionData(prms);
2528 if (prms)
2529 name =prms.param1;
2530 return name;
2531 }
2533 {
2534 LocationParams prms;
2535 GetCurrentPositionData(prms);
2536 if (prms)
2537 return prms.param3;
2538 else
2539 return vector.Zero;
2540 }
2541
2543 {
2544 if (m_PositionsListbox.GetSelectedRow() != -1)
2545 {
2546 m_PositionsListbox.GetItemData(m_PositionsListbox.GetSelectedRow(), 0, data);
2547 }
2548 }
2549
2551 {
2552 LocationParams prms;
2553 GetCurrentPositionData(prms);
2554 if (prms)
2555 return prms.param2;
2556 else
2557 return false;
2558 }
2559
2561 {
2562 return m_PositionsListbox.GetSelectedRow();
2563 }
2564
2566 {
2567 return (m_PositionsListbox.GetSelectedRow() != -1);
2568 }
2569
2571 {
2572 return m_PresetsTextListbox.GetSelectedRow();
2573 }
2574
2576 {
2577 return m_PresetItemsTextListbox.GetSelectedRow();
2578 }
2579
2581 {
2582 int index = GetCurrentPresetIndex();
2583 if (index > -1 && index < m_PresetsTextListbox.GetNumItems())
2584 {
2585 PresetParams item_params_array;
2586 m_PresetsTextListbox.GetItemData(index, 0, item_params_array);
2587 return item_params_array.param2;
2588 }
2589 return false;
2590 }
2591
2592 bool IsPresetFixed(string preset_name)
2593 {
2594 int preset_index = GetPresetIndexByName(preset_name);
2595 PresetParams item_params_array;
2596 if (preset_index > -1 && preset_index < m_PresetsTextListbox.GetNumItems())
2597 {
2598 m_PresetsTextListbox.GetItemData(preset_index, 0, item_params_array);
2599 return item_params_array.param2;
2600 }
2601 return false;
2602 }
2603
2604 int GetPresetIndexByName(string preset_name)
2605 {
2606 int i;
2607 for (i = 0; i < m_PresetsTextListbox.GetNumItems(); i++)
2608 {
2609 PresetParams item_params_array;
2610 m_PresetsTextListbox.GetItemData(i, 0, item_params_array);
2611
2612 if (item_params_array.param1 == preset_name)
2613 {
2614 return i;
2615 }
2616 }
2617 return -1;
2618 }
2619
2621 {
2622 if (!IsCurrentPresetFixed())
2623 {
2624 ShowItemTransferButtons();
2625
2626 string preset_name = GetCurrentPresetName();
2627 int item_index = GetCurrentItemIndex();
2628
2629 m_ItemMoveUpButton.Show(true);
2630 m_ItemMoveDownButton.Show(true);
2631
2632 m_ItemDamageLabel.Show(true);
2633 m_ItemQuantityLabel.Show(true);
2634
2635 if (preset_name != "" && item_index > -1)
2636 {
2637 m_DamageEditBox.Show(true);
2638 m_QuantityEditBox.Show(true);
2639 float item_health= m_ConfigDebugProfile.GetItemHealth(GetCurrentPresetName(), GetCurrentItemIndex());
2640 int item_quantity = m_ConfigDebugProfile.GetItemQuantity(GetCurrentPresetName(), GetCurrentItemIndex());
2641
2642 // damage
2643 m_DamageEditBox.SetText(item_health.ToString());
2644
2645 // quantity
2646 m_QuantityEditBox.SetText(item_quantity.ToString());
2647 // int stacked_max = GetGame().ConfigGetInt(CFG_VEHICLESPATH + " " + GetCurrentItemName() + " stackedMax");
2648 // m_QuantityEditBox.SetText(itoa(stacked_max));
2649 }
2650 else
2651 {
2652 m_DamageEditBox.Show(false);
2653 m_QuantityEditBox.Show(false);
2654 }
2655 }
2656 }
2657
2659 {
2660 m_ItemMoveUpButton.Show(false);
2661 m_ItemMoveDownButton.Show(false);
2662
2663// m_DamageEditBox.Show(false);
2664// m_QuantityEditBox.Show(false);
2665// m_ItemDamageLabel.Show(false);
2666// m_ItemQuantityLabel.Show(false);
2667 }
2668
2670 {
2671 int object_row = m_ObjectsTextListbox.GetSelectedRow();
2672 if (object_row >-1 && GetCurrentPresetIndex() >-1 && !IsCurrentPresetFixed())
2673 {
2674 m_PresetAddItemtButton.Show(true);
2675 }
2676 else
2677 {
2678 m_PresetAddItemtButton.Show(false);
2679 }
2680
2681 if (GetCurrentItemIndex() >-1 && GetCurrentPresetIndex() >-1 && !IsCurrentPresetFixed())
2682 {
2683 m_PresetRemoveItemButton.Show(true);
2684 }
2685 else
2686 {
2687 m_PresetRemoveItemButton.Show(false);
2688 }
2689
2690 if (object_row > -1)
2691 {
2692 m_ItemNameCopy.Show(true);
2693 }
2694 else
2695 {
2696 m_ItemNameCopy.Show(false);
2697 }
2698
2699 }
2700
2702 {
2703 int new_index = GetCurrentItemIndex() - 1;
2704 if (GetCurrentItemIndex() != -1 && GetCurrentPresetIndex() != -1 && new_index > -1)
2705 {
2706 m_ConfigDebugProfile.SwapItem(GetCurrentPresetName(), GetCurrentItemIndex(), new_index);
2707 RenderPresetItems();
2708 m_PresetItemsTextListbox.SelectRow (new_index);
2709 }
2710 }
2711
2713 {
2714 int new_index = GetCurrentItemIndex() + 1;
2715 if (GetCurrentItemIndex() != -1 && GetCurrentPresetIndex() != -1 && new_index < m_PresetItemsTextListbox.GetNumItems())
2716 {
2717 m_ConfigDebugProfile.SwapItem(GetCurrentPresetName(), GetCurrentItemIndex(), new_index);
2718 RenderPresetItems();
2719 m_PresetItemsTextListbox.SelectRow (new_index);
2720 }
2721 }
2722
2724 {
2725 // config hierarchy
2726 // string config_path = "configfile CfgVehicles APC";
2727 // string config_path = "";
2728
2729 m_ConfigHierarchyTextListbox.ClearItems();
2730 m_ConfigVariablesTextListbox.ClearItems();
2731
2732 string config_path = "configfile";
2733 TStringArray variables = m_ModuleConfigViewer.GetConfigHierarchy(config_path);
2734 for (int i = 0; i < variables.Count(); i++)
2735 {
2736 string variable = variables.Get(i);
2737
2738 for (int j = 0; j < m_BaseConfigClassesToggled.Count(); j++)
2739 {
2740 if (variable == m_BaseConfigClassesToggled.Get(j))
2741 {
2742 string new_config_path = (config_path + " " + variable).Trim();
2743 m_ConfigHierarchyTextListbox.AddItem("+ " + variable, new ConfigParamsEx(false, variable, 0, new_config_path, 0,variable), 0);
2744 }
2745 }
2746 }
2747 }
2748
2750 {
2751 m_ConfigHierarchyTextListbox.ClearItems();
2752 m_ConfigVariablesTextListbox.ClearItems();
2753
2754 class_name.ToLower();
2755 string config_base_path = "configfile";
2756
2757 string filter_lower = class_name;
2758 filter_lower.ToLower();
2759
2760 TStringArray filters = new TStringArray;
2761 filter_lower.Split(" ", filters);
2762
2763 for (int i = 0; i < m_BaseConfigClassesToggled.Count(); i++)
2764 {
2765 string config_root = m_BaseConfigClassesToggled.Get(i);
2766 string config_path = config_base_path + " " + config_root;
2767 TStringArray variables = m_ModuleConfigViewer.GetConfigHierarchy(config_path);
2768
2769 for (int j = 0; j < variables.Count(); j++)
2770 {
2771 string variable = variables.Get(j);
2772 string variable_lower = variable;
2773 variable_lower.ToLower();
2774
2775 for (int k = 0; k < filters.Count(); k++)
2776 {
2777 if (variable_lower.Contains(filters.Get(k)))
2778 {
2779 string new_config_path = (config_path + " " + variable).Trim();
2780 m_ConfigHierarchyTextListbox.AddItem("+ " + variable, new ConfigParamsEx(false, variable, 0, new_config_path, 0, config_root), 0);
2781 break;
2782 }
2783 }
2784 }
2785 }
2786 }
2787
2788 void ExpandHierarchy(int row)
2789 {
2790 if (row <= -1 && row >= m_ConfigHierarchyTextListbox.GetNumItems())
2791 {
2792 return;
2793 }
2794
2795 TStringArray variables;
2796
2797 // get current row data
2798 ConfigParamsEx config_params;
2799 m_ConfigHierarchyTextListbox.GetItemData(row, 0, config_params);
2800
2801 string config_path = config_params.param4;
2802 int deep = config_params.param5;
2803
2804 string offset = "";
2805 for (int i = 0; i < deep; i++)
2806 {
2807 offset = offset + " ";
2808 }
2809
2810 // change selected node
2811 variables = m_ModuleConfigViewer.GetConfigHierarchy(config_path);
2812 int childrens_count = variables.Count();
2813 m_ConfigHierarchyTextListbox.SetItem(row, offset + "- " + config_params.param2, new ConfigParamsEx(true, config_params.param2, childrens_count, config_path, deep,config_params.param6), 0);
2814
2815 offset = offset + " ";
2816
2817 // render childrens
2818 deep = deep + 1;
2819 childrens_count = 0;
2820 for (i = variables.Count() - 1; i >= 0; i--)
2821 {
2822 string new_config_path = (config_path + " " + variables.Get(i)).Trim();
2823 m_ConfigHierarchyTextListbox.AddItem(offset + "+ " + variables.Get(i), new ConfigParamsEx(false, variables.Get(i), childrens_count, new_config_path, deep,config_params.param2), 0, (row + 1));
2824 }
2825 }
2826
2827 // niekde je bug, ked su len 2 polozky a expand/collapse na prvu tak zmaze aj druhu. ak collapse a expand na druhu tak crash lebo sa snazi zmazat riadok co neexistuje
2828 void CollapseHierarchy(int row)
2829 {
2830 if (row <= -1 && row >= m_ConfigHierarchyTextListbox.GetNumItems())
2831 {
2832 return;
2833 }
2834
2835 ConfigParamsEx config_params;
2836 ConfigParamsEx config_params_next;
2837 m_ConfigHierarchyTextListbox.GetItemData(row, 0, config_params);
2838 m_ConfigHierarchyTextListbox.GetItemData(row + 1, 0, config_params_next);
2839
2840 int deep = config_params.param5;
2841 int deep_next = config_params_next.param5;
2842 int max_count = m_ConfigHierarchyTextListbox.GetNumItems();
2843 int remove_lines_count = 0;
2844 // Print(max_count);
2845 for (int i = row + 1; i < max_count; i++)
2846 {
2847 if (deep < deep_next && i <= max_count)
2848 {
2849 remove_lines_count = remove_lines_count + 1;
2850 m_ConfigHierarchyTextListbox.GetItemData(i, 0, config_params_next);
2851 deep_next = config_params_next.param5;
2852 }
2853 }
2854
2855 // remove remove_lines_count lines from row
2856 // remove_lines_count = remove_lines_count - 1;
2857 for (i = 1; i < remove_lines_count; i++)
2858 {
2859 int x = row + 1;
2860 if (x < max_count)
2861 {
2862 m_ConfigHierarchyTextListbox.RemoveRow(x);
2863 }
2864 }
2865
2866 string offset = "";
2867 for (i = 0; i < deep; i++)
2868 {
2869 offset = offset + " ";
2870 }
2871 m_ConfigHierarchyTextListbox.SetItem(row, offset + "+ " + config_params.param2, new ConfigParamsEx(false, config_params.param2, 0, config_params.param4, deep,""), 0);
2872 /* //not sure why this is here, but it's causing issues when collapsing items in config viewer, disabling for now
2873 if (deep == 0)
2874 {
2875 ClearHierarchy();
2876 }
2877 */
2878 }
2879
2880 void RenderVariables(int row)
2881 {
2882 ConfigParamsEx config_params;
2883 if (row > -1 && row < m_ConfigHierarchyTextListbox.GetNumItems())
2884 {
2885 m_ConfigHierarchyTextListbox.GetItemData(row, 0, config_params);
2886 m_ConfigVariablesTextListbox.ClearItems();
2887 TStringArray variables;
2888 string path = config_params.param4;
2889 variables = m_ModuleConfigViewer.GetConfigVariables(path);
2890 for (int i = 0; i < variables.Count(); i++)
2891 {
2892 m_ConfigVariablesTextListbox.AddItem(variables.Get(i), NULL, 0);
2893 }
2894 }
2895 }
2896
2898
2900 {
2901 //if (GetGame() != NULL && GetGame().GetPlayer() != NULL)
2902 {
2903 vector player_pos = GetGame().GetPlayer().GetPosition();
2904 SetMapPos(player_pos);
2905 //m_PlayerCurPos.SetText("Pos: "+ player_pos[0] +", "+ player_pos[1] +", "+ player_pos[2]);
2906 }
2907 }
2908
2911 {
2912 return m_LastSelectedObject;
2913 }
2914
2915 void UpdateTime(bool slider_used)
2916 {
2917 Param5<int,int,int,int,int> p5 = new Param5<int,int,int,int,int>(0,0,0,0,0);
2918 int year, month, day, hour, minute;
2919
2920 year = m_DateYear.GetText().ToInt();
2921 month = m_DateMonth.GetText().ToInt();
2922 day = m_DateDay.GetText().ToInt();
2923
2924 if (slider_used)
2925 {
2926 int time_minutes = Math.Lerp(0, (24*60) - 1, m_TimeSlider.GetCurrent()/100);
2927 hour = time_minutes / 60;
2928 minute = time_minutes % 60;
2929 }
2930 else
2931 {
2932 hour = m_DateHour.GetText().ToInt();
2933 minute = m_DateMinute.GetText().ToInt();
2934 }
2935
2936 p5.param1 = year;
2937 p5.param2 = month;
2938 p5.param3 = day;
2939 p5.param4 = hour;
2940 p5.param5 = minute;
2941
2942 RefreshDateWidgets(year, month, day, hour, minute);
2943 GetGame().GetWorld().SetDate(year, month, day, hour, minute);
2944 GetGame().GetPlayer().RPCSingleParam(ERPCs.DEV_RPC_SET_TIME, p5, true);
2945 }
2946
2947
2956 MissionGameplay m_MissionGameplay;
2957
2958
2960 TextListboxWidget m_ClientLogListbox;
2961 TextListboxWidget m_ScriptOutputListbox;
2964
2965 TextListboxWidget m_DiagToggleTextListbox;
2967
2968 TextListboxWidget m_DiagDrawmodeTextListbox;
2969 ButtonWidget m_DiagDrawButton;
2970 ButtonWidget m_DrawInWorld;
2972 // Page EnfScript
2973 MultilineEditBoxWidget m_EnfScriptEdit;
2974 ButtonWidget m_EnfScriptRun;
2975 ButtonWidget m_EnfScriptClear;
2976
2977
2978 // Page General
2979 ButtonWidget m_TeleportButton;
2980
2981 ButtonWidget m_ButtonCopyPos;
2982 EditBoxWidget m_TeleportX;
2983 EditBoxWidget m_TeleportY;
2984 EditBoxWidget m_TeleportXYZ;
2985 EditBoxWidget m_DateYear;
2986 EditBoxWidget m_DateMonth;
2987 EditBoxWidget m_DateDay;
2988 EditBoxWidget m_DateHour;
2989 EditBoxWidget m_DateMinute;
2990
2991 ButtonWidget m_CopySoundset;
2992 ButtonWidget m_PlaySoundset;
2994 ButtonWidget m_StopSoundset;
2998
3002 TextListboxWidget m_PositionsListbox;
3003 CheckBoxWidget m_LogsEnabled;
3004 CheckBoxWidget m_HudDCharStats;
3005 CheckBoxWidget m_HudDCharLevels;
3006 CheckBoxWidget m_HudDCharStomach;
3007 CheckBoxWidget m_HudDCharModifiers;
3008 CheckBoxWidget m_HudDCharAgents;
3009 CheckBoxWidget m_HudDCharDebug;
3010 CheckBoxWidget m_HudDFreeCamCross;
3011 CheckBoxWidget m_HudDVersion;
3012 CheckBoxWidget m_ShowProtected;
3013 CheckBoxWidget m_ShowOthers;
3014 CheckBoxWidget m_ClearInventory;
3015 CheckBoxWidget m_HudDTemperature;
3016 CheckBoxWidget m_CategoryMergeType;
3018
3019
3021 EditBoxWidget m_ObjectFilter;
3026 static int m_SelectedObjectIsPreset = -1;
3027 TextListboxWidget m_ObjectsTextListbox;
3028
3029 EditBoxWidget m_SoundFilter;
3030 TextListboxWidget m_SoundsTextListbox;
3031
3032 TextListboxWidget m_PresetsTextListbox;
3033 TextListboxWidget m_PresetItemsTextListbox;
3034 ButtonWidget m_PresetNewButton;
3039 ButtonWidget m_ItemNameCopy;
3043
3045 EditBoxWidget m_QuantityEditBox;
3046 EditBoxWidget m_DamageEditBox;
3049
3054 ButtonWidget m_SpawnSpecial;
3055 ButtonWidget m_CloseConsoleButton;
3056 ButtonWidget m_WatchItem;
3059
3060 EditBoxWidget m_RectSpawnRow;
3061 EditBoxWidget m_RectSpawnColumn;
3062 EditBoxWidget m_RectSpawnRowStep;
3064
3066
3067 // Config Viewer
3071 ButtonWidget m_SelectedRowCopy;
3072 ButtonWidget m_DumpParamButton;
3073
3074 // Others
3076 TextListboxWidget m_HelpTextListboxWidget;
3077
3078
3079
3080 //vicinity
3081 TextListboxWidget m_VicinityListbox;
3082
3083 static const int TAB_GENERAL = 0;
3084 static const int TAB_ITEMS = 1;
3085 static const int TAB_CONFIGS = 2;
3086 static const int TAB_ENSCRIPT = 3;
3087 static const int TAB_ENSCRIPT_SERVER = 4;
3088 static const int TAB_OUTPUT = 5;
3089 static const int TAB_VICINITY = 6;
3090 static const int TAB_SOUNDS = 7;
3091 static const int TAB_WEATHER = 8;
3092 // -----------------------
3093 static const int TABS_COUNT = 9;
3094
3095 protected ref ScriptConsoleTab m_TabHandlers[TABS_COUNT];
3098 ButtonWidget m_Tab_buttons[TABS_COUNT];
3099 static string m_ConfigTextField;
3100
3102 {
3103 int currTab = m_selected_tab;
3104 currTab = (currTab - 1) % TABS_COUNT;
3105 if (currTab < 0)
3106 {
3107 currTab = TABS_COUNT - 1;
3108 }
3109
3110 while (currTab != m_selected_tab)
3111 {
3112 if (m_Tab_buttons[currTab] != NULL)
3113 {
3114 SelectTab(currTab);
3115 return;
3116 }
3117
3118 currTab = (currTab - 1) % TABS_COUNT;
3119 if (currTab < 0)
3120 {
3121 currTab = TABS_COUNT - 1;
3122 }
3123 }
3124 }
3125
3127 {
3128 int currTab = m_selected_tab;
3129 currTab = (currTab + 1) % TABS_COUNT;
3130
3131 while (currTab != m_selected_tab)
3132 {
3133 if (m_Tab_buttons[currTab] != NULL)
3134 {
3135 SelectTab(currTab);
3136 return;
3137 }
3138
3139 currTab = (currTab + 1) % TABS_COUNT;
3140 }
3141 }
3142
3143 void SelectTab(int tab_id)
3144 {
3145 if (tab_id < 0 || tab_id >= TABS_COUNT)
3146 tab_id = 0;
3147 int i = 0;
3148 Widget tab = m_Tabs[tab_id];
3149 for (i = 0; i < TABS_COUNT; i++)
3150 {
3151 Widget t = m_Tabs[i];
3152
3153 m_TabHandlers[i] = null;
3154
3155 if (i == tab_id)
3156 {
3157 t.Show(true);
3158
3159 }
3160 else
3161 {
3162 t.Show(false);
3163 }
3164 }
3165
3166
3167 for (i = 0; i < TABS_COUNT; i++)
3168 {
3169 ButtonWidget button = m_Tab_buttons[i];
3170 button.SetState(i == tab_id);
3171 }
3172
3173 m_selected_tab = tab_id;
3174 m_ConfigDebugProfile.SetTabSelected(m_selected_tab);
3175
3176 OnTabSeleted(m_selected_tab);
3177 }
3178
3179
3181
3182
3184 {
3185 Clear();
3186 FileHandle file_index = OpenFile(Debug.GetFileName(), FileMode.READ);
3187
3188 if ( file_index )
3189 {
3190 string line_content;
3191 while ( FGets( file_index, line_content ) > 0 )
3192 {
3193 Add(line_content, true);
3194 }
3195
3196 CloseFile(file_index);
3197 }
3198 }
3199
3201 {
3202 m_ScriptOutputListbox.ClearItems();
3203 m_AllowScriptOutput = true;
3204 foreach ( string s: m_ScriptOutputHistory)
3205 {
3206 Add(s, true);
3207 }
3208 m_AllowScriptOutput = false;
3209 }
3210
3211 void OnTabSeleted(int tabID)
3212 {
3213 Widget tab = m_Tabs[tabID];
3214 string text;
3215 int index;
3216
3217
3218 if (tabID == TAB_WEATHER)
3219 {
3220 m_TabHandlers[TAB_WEATHER] = new ScriptConsoleWeatherTab(layoutRoot);
3221 }
3222 else if (tabID == TAB_VICINITY)
3223 {
3224 array<Object> objects = new array<Object>();
3225 array<CargoBase> cargo = new array<CargoBase>();
3226
3227 GetGame().GetObjectsAtPosition(GetGame().GetPlayer().GetPosition(), 30, objects,cargo);
3228 m_VicinityListbox.ClearItems();
3229 m_VicinityItems.Clear();
3230 foreach (Object o:objects)
3231 {
3232 if (o.Type().ToString() != "Object")
3233 {
3234 if (o.IsMan())
3235 {
3236 m_VicinityItems.InsertAt(o,0); //insert at 0 index
3237 m_VicinityListbox.AddItem(o.GetType(),null,0,0);//insert at 0 index
3238 }
3239 else
3240 {
3241 m_VicinityItems.Insert(o);//insert at the end
3242 m_VicinityListbox.AddItem(o.GetType(),null,0);//insert at the end
3243 }
3244 }
3245 }
3246 }
3247 else if (tabID == TAB_SOUNDS)
3248 {
3249 m_SoundFilter.SetText(m_ConfigDebugProfile.GetSoundsetFilter());
3250 ChangeFilterSound();
3251 }
3252 else if (tabID == TAB_ENSCRIPT)
3253 {
3254 m_ScriptServer = false;
3255 tab.Show(true);//since both buttons point to the same tab, this will keep the tab visible for either tab selection(it's a hack)
3256 index = m_EnscriptConsoleHistory.Count() - m_EnscriptHistoryRow - 1;
3257 if (m_EnscriptConsoleHistory.IsValidIndex(index))
3258 {
3259 text = m_EnscriptConsoleHistory.Get(index);
3260 //Print("setting text client " + text);
3261 m_EnfScriptEdit.SetText(text);
3262 }
3263 ReloadScriptOutput();
3264 }
3265 else if (tabID == TAB_ENSCRIPT_SERVER)
3266 {
3267 m_ScriptServer = true;
3268 index = m_EnscriptConsoleHistoryServer.Count() - m_EnscriptHistoryRowServer - 1;
3269 if (m_EnscriptConsoleHistoryServer.IsValidIndex(index))
3270 {
3271 text = m_EnscriptConsoleHistoryServer.Get(index);
3272 //Print("setting text server " + text);
3273 m_EnfScriptEdit.SetText(text);
3274 }
3275 ReloadScriptOutput();
3276 }
3277 else if (tabID == TAB_OUTPUT)
3278 {
3279 ReloadOutput();
3280 }
3281 else if (tabID == TAB_CONFIGS)
3282 {
3283 if (m_ConfigTextField)
3284 m_ObjectConfigFilter.SetText(m_ConfigTextField);
3285 ChangeConfigFilter();
3286 }
3287
3288 }
3289
3290
3291
3292 override void OnRPCEx(int rpc_type, ParamsReadContext ctx)
3293 {
3294 super.OnRPCEx(rpc_type, ctx);
3295 #ifdef DIAG_DEVELOPER
3296 switch (rpc_type)
3297 {
3298 case ERPCs.DEV_PLAYER_DEBUG_DATA:
3299 {
3301 break;
3302 }
3303
3304 case ERPCs.DEV_RPC_SERVER_SCRIPT_RESULT:
3305 {
3307 {
3308 ColorRunButton(CachedObjectsParams.PARAM1_BOOL.param1);
3309 }
3310 }
3311 break;
3312 }
3313 #endif
3314
3315 }
3316
3317 PluginDeveloper m_Developer;
3319 PluginConfigDebugProfileFixed m_ConfigDebugProfileFixed;
3320 PluginConfigViewer m_ModuleConfigViewer;
3321}
class RecipeCacheData int
const int ECE_LOCAL
const int ECE_PLACE_ON_SURFACE
protected const int TABS_COUNT
DayZGame g_Game
Definition DayZGame.c:3654
ERPCs
Definition ERPCs.c:2
proto string ToString()
Empty
Definition Hand_States.c:14
void RefreshCrosshairVisibility()
Definition HudDebug.c:238
Icon x
Icon y
InventoryLocationType
types of Inventory Location
void Close()
PlayerBase GetPlayer()
class OptionSelectorMultistate extends OptionSelector class_name
Param3< string, bool, vector > LocationParams
string name
PluginConfigDebugProfile m_ConfigDebugProfile
ItemPreviewWidget m_ItemPreviewWidget
void PluginItemDiagnostic()
class PluginLocalEnscriptHistory extends PluginLocalHistoryBase PluginLocalEnscriptHistoryServer()
void PluginLocalEnscriptHistory()
PluginBase GetPlugin(typename plugin_type)
ref array< ref RemotePlayerStatDebug > m_PlayerDebugStats
protected PlayerBase _player
protected Widget m_SelectedObject
Definition RadialMenu.c:16
void RemotePlayerStatDebug(PlayerBase player)
Param5< bool, string, int, string, int > ConfigParams
Param6< bool, string, int, string, int, string > ConfigParamsEx
Param3< string, bool, bool > PresetParams
void ScriptConsoleWeatherTab(Widget root)
proto native UAInputAPI GetUApi()
class JsonUndergroundAreaTriggerData GetPosition
void Add(string name, string value)
proto native vector GetCurrentCameraDirection()
proto native void GetDiagModeNames(out TStringArray diag_names)
Get list of all debug modes.
proto native Mission GetMission()
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
proto native void CopyToClipboard(string text)
proto native DayZPlayer GetPlayer()
proto bool ConfigGetText(string path, out string value)
Get string value from config on path.
proto native float SurfaceRoadY(float x, float z)
override ScriptCallQueue GetCallQueue(int call_category)
Definition DayZGame.c:1153
proto native int ConfigGetInt(string path)
Get int value from config on path.
proto native bool GetDiagModeEnable(int diag_mode)
Gets state of specific debug mode.
proto native World GetWorld()
proto native void GetDiagDrawModeNames(out TStringArray diag_names)
Get list of all debug draw modes.
proto native void SetDiagModeEnable(int diag_mode, bool enabled)
Set specific debug mode.
void RPCSingleParam(Object target, int rpc_type, Param param, bool guaranteed, PlayerIdentity recipient=null)
see CGame.RPC
Definition Game.c:882
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto native UIManager GetUIManager()
proto native vector GetCurrentCameraPosition()
proto native WorkspaceWidget GetWorkspace()
proto native float SurfaceY(float x, float z)
proto native void SetDiagDrawMode(int diag_draw_mode)
Set debug draw mode.
proto native void GetObjectsAtPosition(vector pos, float radius, out array< Object > objects, out array< CargoBase > proxyCargos)
Returns list of all objects in circle "radius" around position "pos".
proto native bool ExecuteEnforceScript(string expression, string mainFnName)
Delevoper only: Executes Enforce Script expression, if there is an error, is printed into the script ...
static ref Param1< bool > PARAM1_BOOL
static ref Param1< string > PARAM1_STRING
static proto bool RaycastRV(vector begPos, vector endPos, out vector contactPos, out vector contactDir, out int contactComponent, set< Object > results=NULL, Object with=NULL, Object ignore=NULL, bool sorted=false, bool ground_only=false, int iType=ObjIntersectView, float radius=0.0, CollisionFlags flags=CollisionFlags.NEARESTCONTACT)
Raycasts world by given parameters.
Definition Debug.c:14
static string GetFileName()
Definition Debug.c:529
static void Log(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message with normal prio.
Definition Debug.c:133
static void GetBaseConfigClasses(out TStringArray base_classes)
Returns some of base config classes strings like CfgVehicles, CfgWeapons, etc. for searching purposes...
Definition Debug.c:396
static void ClearLogs()
Definition Debug.c:516
Wrapper class for managing sound through SEffectManager.
Definition EffectSound.c:5
override void Stop()
Stops sound.
void ShowQuickbarPlayer(bool show)
void ShowHudPlayer(bool show)
proto native void SetItem(EntityAI object)
static void SetLogsEnabled(bool enable)
Definition Debug.c:585
static string GetMarkerTypeFromID(int id)
Definition EnMath.c:7
Hud GetHud()
Definition gameplay.c:697
void EnableAllInputs(bool bForceSupress=false)
Manager class for managing Effect (EffectParticle, EffectSound)
static EffectSound PlaySoundEnviroment(string sound_set, vector position, float play_fade_in=0, float stop_fade_out=0, bool loop=false)
Create and play an EffectSound, updating environment variables.
static void DestroyEffect(Effect effect)
Unregisters, stops and frees the Effect.
proto void CallLater(func fn, int delay=0, bool repeat=false, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto void Call(func fn, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
Serialization general interface. Serializer API works with:
Definition Serializer.c:56
proto bool Read(void value_in)
bool Back()
Close top window on windows stack, returns true when any window is closed.
Definition UIManager.c:64
ref TStringArray m_EnscriptConsoleHistoryServer
TextListboxWidget m_DiagDrawmodeTextListbox
void RemoveItemFromPreset()
EditBoxWidget m_DateHour
TextListboxWidget m_ClientLogListbox
CheckBoxWidget m_ItemPreviewCheckbox
SliderWidget m_TimeSlider
override bool OnChange(Widget w, int x, int y, bool finished)
string GetCurrentPresetName()
TextListboxWidget m_ConfigVariablesTextListbox
bool m_PlayerPosRefreshBlocked
ButtonWidget m_EnfScriptClear
override bool OnKeyDown(Widget w, int x, int y, int key)
static string GetLastSelectedObject()
CheckBoxWidget m_ShowProtected
static string m_LastSelectedObject
CheckBoxWidget m_HudDCharStats
static void PrintS(bool message)
MissionGameplay m_MissionGameplay
ButtonWidget m_ItemMoveDownButton
EditBoxWidget m_DateMinute
EditBoxWidget m_TeleportY
ButtonWidget m_ItemMoveUpButton
PluginDeveloper m_Developer
void SpawnPreset(EntityAI target, bool clear_inventory, string preset_name, InventoryLocationType location=InventoryLocationType.ATTACHMENT, float distance=0)
static void PrintS(float message)
CheckBoxWidget m_HudDTemperature
override void Update(float timeslice)
CheckBoxWidget m_ShowOthers
ButtonWidget m_PresetAddItemtButton
EditBoxWidget m_DateMonth
TStringArray GetItemsClasses()
EditBoxWidget m_SoundFilter
EditBoxWidget m_ObjectFilter
CheckBoxWidget m_ClearInventory
void ~ScriptConsole()
int GetPresetIndexByName(string preset_name)
override bool OnDoubleClick(Widget w, int x, int y, int button)
void PrepareFilters(string filter, out TStringArray filters, out TIntArray colors)
ButtonWidget m_LocationRemoveButton
void ReloadScriptOutput()
EditBoxWidget m_RectSpawnColumnStep
ImageWidget m_FilterOrderImage
static string m_ConfigTextField
ButtonWidget m_FilterOrderButton
void OnTabSeleted(int tabID)
PluginConfigDebugProfile m_ConfigDebugProfile
static void DrawItems(string type, float distance=0)
bool IsCurrentPositionValid()
TextListboxWidget m_ScriptOutputListbox
EditBoxWidget m_TeleportXYZ
TextListboxWidget m_SoundsTextListbox
void UpdateTime(bool slider_used)
void ResetRunButtonColor()
void SetMapPos(vector pos)
void Add(string message, bool isReload=false)
void SelectObject(bool hide_presets=true)
TextWidget m_ItemDamageLabel
void RefreshPlayerPosEditBoxes()
CheckBoxWidget m_HudDCharModifiers
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
EditBoxWidget m_BatchSpawnQuantity
void SetPreviewObject(string object)
CheckBoxWidget m_HudDCharStomach
void ColorRunButton(bool success)
bool IsPresetFixed(string preset_name)
void ChangeConfigFilter()
ButtonWidget m_SpawnSpecial
void RunEnscriptServer()
CheckBoxWidget m_LogsEnabled
ButtonWidget m_TeleportButton
void NewPreset(string preset_name)
void FindInHierarchy(string class_name)
static EntityAI m_PreviewEntity
CheckBoxWidget m_HudDCharAgents
PluginItemDiagnostic m_ItemDisagPlugin
string GetCurrentItemName()
ButtonWidget m_ClientLogClearButton
override void OnRPCEx(int rpc_type, ParamsReadContext ctx)
EditBoxWidget m_DateYear
ButtonWidget m_SpawnGroundPatternGrid
CheckBoxWidget m_CategoryMergeType
ItemPreviewWidget m_ItemPreviewWidget
static int ITEMS_IN_PRESET_SELECTED_ROW
void ChangeFilter(TStringArray classes, TextListboxWidget widget, EditBoxWidget filterWidget, int categoryMask=-1, bool ignoreScope=false)
ButtonWidget m_PlaySoundset
TextWidget m_PlayerCurPos
PluginConfigViewer m_ModuleConfigViewer
TextListboxWidget m_ConfigHierarchyTextListbox
TextWidget m_PlayerMouseDiff
EditBoxWidget m_RectSpawnRowStep
EditBoxWidget m_RectSpawnColumn
Widget m_ButtonsWindowWidget
EditBoxWidget m_QuantityEditBox
void CollapseHierarchy(int row)
CheckBoxWidget m_HudDCharLevels
override bool OnKeyPress(Widget w, int x, int y, int key)
TextListboxWidget m_VicinityListbox
ButtonWidget m_DrawInWorld
int GetCurrentPositionIndex()
bool IsCurrentPresetFixed()
Widget m_WgtClassesConfig
ButtonWidget m_LocationAddButton
EditBoxWidget m_DateDay
void DumpParam(string param, string relativePath)
bool IsCurrentPositionCustom()
void SelectTab(int tab_id)
EditBoxWidget m_DamageEditBox
PluginLocalEnscriptHistoryServer m_ModuleLocalEnscriptHistoryServer
TextWidget m_ItemQuantityLabel
static void DrawItemsClear()
ButtonWidget m_DumpParamButton
void Teleport(PlayerBase player, vector position)
CheckBoxWidget m_HudDCharDebug
override bool OnItemSelected(Widget w, int x, int y, int row, int column, int oldRow, int oldColumn)
ButtonWidget m_DiagToggleButton
void RenamePreset(string new_preset_name)
static EffectSound m_SoundSet
TextListboxWidget m_HelpTextListboxWidget
static ref ConfigParamsEx m_ConfigData
ButtonWidget m_ItemNameCopy
string GetCurrentObjectName()
TextListboxWidget m_PresetsTextListbox
int GetFilterColor(string color)
void RenderVariables(int row)
void AddItemToClipboard(TextListboxWidget text_listbox_widget)
int GetCurrentPresetIndex()
ButtonWidget m_EnfScriptRun
void Clear(bool clearFile=false)
TextListboxWidget m_ObjectsTextListbox
TextListboxWidget m_DiagToggleTextListbox
string GetCurrentLocationName()
PluginConfigDebugProfileFixed m_ConfigDebugProfileFixed
CheckBoxWidget m_HudDFreeCamCross
CheckBoxWidget m_HudDVersion
ButtonWidget m_SpawnInInvButton
TStringArray GetSoundClasses()
static void PrintS(int message)
vector GetCurrentLocationPos()
void RefreshDateWidgets(int year, int month, int day, int hour, int minute)
void EnscriptHistoryBack()
void SetObject(string object)
TextListboxWidget m_PresetItemsTextListbox
override Widget Init()
static bool CLEAR_IVN
ButtonWidget m_PresetRemoveItemButton
ButtonWidget m_PresetDeleteButton
EditBoxWidget m_TeleportX
static void PrintS(Object message)
static void PrintS(vector message)
static void PrintS(string message)
ButtonWidget m_ButtonCopyPos
ButtonWidget m_PlaySoundsetLooped
static ScriptConsole m_This
ButtonWidget m_CopySoundset
ButtonWidget m_WatchItem
ButtonWidget m_PresetNewButton
ButtonWidget m_PresetSetDefaultButton
MapWidget m_DebugMapWidget
override bool OnMouseEnter(Widget w, int x, int y)
CheckBoxWidget m_ClientLogScrollCheckbox
override bool OnMouseButtonDown(Widget w, int x, int y, int button)
void ShowItemTransferButtons()
EditBoxWidget m_ObjectConfigFilter
bool m_FilterOrderReversed
ButtonWidget m_DrawInWorldClear
TextWidget m_MouseCurPos
void ExpandHierarchy(int row)
EditBoxWidget m_DrawDistanceWidget
ButtonWidget m_PlaySoundsetButton
void UpdateHudDebugSetting()
ButtonWidget m_PresetRenameButton
PluginLocalEnscriptHistory m_ModuleLocalEnscriptHistory
EditBoxWidget m_SpawnDistanceEditBox
ref TStringArray m_EnscriptConsoleHistory
EditBoxWidget m_RectSpawnRow
void AddServer(string message)
void GetCurrentPositionData(out LocationParams data)
void SetDefaultPreset(int preset_index)
ButtonWidget m_DiagDrawButton
bool IsLocationNameAvailable(string name)
MultilineEditBoxWidget m_EnfScriptEdit
override bool OnClick(Widget w, int x, int y, int button)
ButtonWidget m_SpawnBatchButton
ButtonWidget m_StopSoundset
TextListboxWidget m_PositionsListbox
void EnscriptHistoryForward()
void SaveProfileSpawnDistance()
void RefreshLocations()
ButtonWidget m_SpawnAsAttachment
ButtonWidget m_SpawnGroundButton
ButtonWidget m_SelectedRowCopy
void SetFilterOrder(bool reversed)
TextWidget m_SelectedObjectText
proto void GetDate(out int year, out int month, out int day, out int hour, out int minute)
Get actual ingame world time.
proto native void SetDate(int year, int month, int day, int hour, int minute)
Sets actual ingame world time.
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
string ToString()
Definition EnConvert.c:3
proto string ToString()
proto string ToString(bool beautify=true)
Vector to string.
static const vector Zero
Definition EnConvert.c:110
proto native float Length()
Returns length of vector (magnitude)
proto native CGame GetGame()
const int COLOR_BLUE
Definition constants.c:66
const int COLOR_RED
Definition constants.c:64
proto void Print(void var)
Prints content of variable to console/log.
ShapeFlags
Definition EnDebug.c:126
class DiagMenu Shape
don't call destructor directly. Use Destroy() instead
array< string > TStringArray
Definition EnScript.c:685
array< int > TIntArray
Definition EnScript.c:687
string String(string s)
Helper for passing string expression to functions with void parameter. Example: Print(String("Hello "...
Definition EnScript.c:339
FileMode
Definition EnSystem.c:383
proto void CloseFile(FileHandle file)
Close the File.
proto int FGets(FileHandle file, string var)
Get line from file, every next call of this function returns next line.
proto FileHandle OpenFile(string name, FileMode mode)
Opens File.
int[] FileHandle
Definition EnSystem.c:390
KeyCode
Definition EnSystem.c:157
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
static proto float Max(float x, float y)
Returns bigger of two given values.
static proto float Pow(float v, float power)
Return power of v ^ power.
static proto float InverseLerp(float a, float b, float value)
Calculates the linear value that produces the interpolant value within the range [a,...
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
const string CFG_SOUND_SETS
Definition constants.c:203
const string CFG_AMMO
Definition constants.c:198
const string CFG_VEHICLESPATH
Definition constants.c:195
const int MENU_SCRIPTCONSOLE_DIALOG_PRESET_NAME
Definition constants.c:165
const int MENU_SCRIPTCONSOLE_DIALOG_PRESET_RENAME
Definition constants.c:166
const int MENU_LOC_ADD
Definition constants.c:150
const string CFG_WEAPONSPATH
Definition constants.c:196
const string CFG_MAGAZINESPATH
Definition constants.c:197
proto void GetMousePos(out int x, out int y)
proto native void dBodyDestroy(notnull IEntity ent)
Destroys attached physics body.
proto string Substring(int start, int len)
Substring of 'str' from 'start' position 'len' number of characters.
void Split(string sample, out array< string > output)
Splits string into array of strings separated by 'sample'.
Definition EnString.c:396
string Get(int index)
Gets n-th character from string.
Definition EnString.c:434
proto native int IndexOf(string sample)
Finds 'sample' in 'str'. Returns -1 when not found.
bool Contains(string sample)
Returns true if sample is substring of string.
Definition EnString.c:286
proto string Trim()
Returns trimmed string with removed leading and trailing whitespaces.
vector BeautifiedToVector()
Convert beautified string into a vector.
Definition EnString.c:67
proto int Replace(string sample, string replace)
Replace all occurrances of 'sample' in 'str' by 'replace'.
proto int ToLower()
Changes string to lowercase. Returns length.
const int CALL_CATEGORY_SYSTEM
Definition tools.c:8
proto native external Widget CreateWidgets(string layout, Widget parentWidget=NULL, bool immedUpdate=true)
Create widgets from *.layout file.
proto native void SetText(string text, bool immedUpdate=true)
int ARGB(int a, int r, int g, int b)
Definition proto.c:322