4 protected const string SCENE_DRAW_SELECTION =
"scene_editor_draw_selection";
5 protected const string SCENE_LOAD_PLAYER_POS =
"scene_editor_load_player_pos";
6 protected const string SCENE_ROTATION_ANGLE =
"scene_editor_rotation_angle";
7 protected const string ITEM_TAB_SELECTED =
"console_TabSelected";
8 protected const string PRESET_LIST =
"console_presets";
9 protected const string PRESET_DEFAULT =
"console_preset_default";
10 protected const string ITEM_SEARCH =
"console_ItemSearch";
11 protected const string SPAWN_DISTANCE =
"console_SpawnDistance";
12 protected const string CHAR_STATS_VIS =
"console_character_stats_visible";
13 protected const string CHAR_LEVELS_VIS =
"console_character_levels_visible";
14 protected const string CHAR_MODIFIERS_VIS =
"console_character_modifiers_visible";
15 protected const string CHAR_AGENTS_VIS =
"console_character_agents_visible";
16 protected const string CHAR_DEBUG_VIS =
"console_character_debug_visible";
17 protected const string CHAR_STOMACH_VIS =
"console_character_stomach_visible";
18 protected const string FREE_CAMERA_CROSSHAIR =
"console_free_camera_crosshair_visible";
19 protected const string VERSION_VIS =
"console_version_visible";
20 protected const string MERGE_TYPE =
"category_merge_type";
21 protected const string TEMP_VIS =
"console_temperature_visible";
22 protected const string SUB_PARAM_ITEM =
"item";
23 protected const string SUB_PARAM_ITEM_NAME =
"name";
24 protected const string SUB_PARAM_ITEM_HEALTH =
"health";
25 protected const string SUB_PARAM_ITEM_QUANTITY =
"quantity";
26 protected const string SUB_PARAM_ITEM_WITH_PHYSICS =
"with_physics";
27 protected const string LOGS_ENABLED =
"logs_enabled";
28 protected const string CONFIG_CLASSES_FLAG =
"toggled_config_classes_flag";
29 protected const string ITEM_CATEGORY_FLAG =
"toggled_item_categories_flag";
30 protected const string ITEM_PREVIEW =
"show_item_preview";
31 protected const string BATCH_RECT =
"batch_spawn_rect";
32 protected const string BATCH_QUANT =
"batch_spawn_quantity";
33 protected const string SOUNDFILTER =
"soundset_editbox";
34 protected const string ITEMDEBUG =
"item_debug";
35 protected const string SPAWN_LOC_INDEX =
"spawn_loc_index";
36 protected const string FILTER_REVERSED =
"filter_order_reversed";
40 protected const string POSITION_NAME_ROOT =
"console_positions_";
55 CfgParamArray param =
new CfgParamArray(
"" );
56 param.SetParams( params );
63 protected CfgParamBool GetNewCfgParamBool(
bool value )
65 CfgParamBool param =
new CfgParamBool(
"" );
66 param.SetValue( value );
73 protected CfgParamFloat GetNewCfgParamFloat(
float value )
75 CfgParamFloat param =
new CfgParamFloat(
"" );
76 param.SetValue( value );
83 protected CfgParamInt GetNewCfgParamInt(
int value )
85 CfgParamInt param =
new CfgParamInt(
"" );
86 param.SetValue( value );
93 protected CfgParamString GetNewCfgParamString(
string value )
95 CfgParamString param =
new CfgParamString(
"" );
96 param.SetValue( value );
105 CfgParamArray param = CfgParamArray.Cast( GetParamByName( key,
CFG_TYPE_ARRAY ) );
106 param.SetParams( params );
113 if ( ParamExist(key) )
115 CfgParamArray param = CfgParamArray.Cast( GetParamByName( key,
CFG_TYPE_ARRAY ) );
116 return param.GetValues();
120 if ( m_DefaultValues.Contains(key) )
122 CfgParamArray default_param = CfgParamArray.Cast( m_DefaultValues.Get( key ) );
123 return SetArray( key, default_param.GetValues() ).GetValues();
135 protected CfgParamBool SetBool(
string key,
bool value )
137 CfgParamBool param = CfgParamBool.Cast( GetParamByName( key,
CFG_TYPE_BOOL ) );
138 param.SetValue( value );
143 protected bool GetBool(
string key )
145 if ( ParamExist(key) )
147 CfgParamBool param = CfgParamBool.Cast( GetParamByName( key,
CFG_TYPE_BOOL ) );
148 return param.GetValue();
152 if ( m_DefaultValues.Contains(key) )
154 CfgParamBool default_param = CfgParamBool.Cast( m_DefaultValues.Get( key ) );
155 return SetBool( key, default_param.GetValue() ).GetValue();
159 return SetBool( key,
false ).GetValue();
167 protected CfgParamFloat SetFloat(
string key,
float value )
169 CfgParamFloat param = CfgParamFloat.Cast( GetParamByName( key,
CFG_TYPE_FLOAT ) );
170 param.SetValue( value );
175 protected float GetFloat(
string key )
177 if ( ParamExist(key) )
179 CfgParamFloat param = CfgParamFloat.Cast( GetParamByName( key,
CFG_TYPE_FLOAT ) );
180 return param.GetValue();
184 if ( m_DefaultValues.Contains(key) )
186 CfgParamFloat default_param = CfgParamFloat.Cast( m_DefaultValues.Get( key ) );
187 return SetFloat( key, default_param.GetValue() ).GetValue();
191 return SetFloat( key, 0.0 ).GetValue();
199 protected CfgParamInt SetInt(
string key,
int value )
201 CfgParamInt param = CfgParamInt.Cast( GetParamByName( key,
CFG_TYPE_INT ) );
202 param.SetValue( value );
207 protected int GetInt(
string key )
209 if ( ParamExist(key) )
211 CfgParamInt param = CfgParamInt.Cast( GetParamByName( key,
CFG_TYPE_INT ) );
212 return param.GetValue();
216 if ( m_DefaultValues.Contains(key) )
218 CfgParamInt default_param = CfgParamInt.Cast( m_DefaultValues.Get( key ) );
219 return SetInt( key, default_param.GetValue() ).GetValue();
223 return SetInt( key, 0 ).GetValue();
231 protected CfgParamString SetString(
string key,
string value )
233 CfgParamString param = CfgParamString.Cast( GetParamByName( key,
CFG_TYPE_STRING ) );
236 param.SetValue( value );
242 protected string GetString(
string key )
244 CfgParamString param = CfgParamString.Cast( GetParamByName( key,
CFG_TYPE_STRING ) );
248 return param.GetValue();
252 if ( m_DefaultValues.Contains(key) )
254 CfgParamString default_param = CfgParamString.Cast( m_DefaultValues.Get( key ) );
255 CfgParamString param_string = SetString( key, default_param.GetValue() );
257 return param_string.GetValue();
261 return SetString( key,
"" ).GetValue();
267 protected void GetSubParametersInStringArray(
string setting_name,
string sub_param_name, out
TStringArray arr )
270 for (
int i = 0; i < items.Count(); i++ )
272 CfgParamArray items_array = CfgParamArray.Cast( items.Get(i) );
275 for (
int j = 0; j < item_params.Count(); j++ )
277 if ( item_params.Get(j).GetName() == sub_param_name )
279 CfgParamString param_string = CfgParamString.Cast( item_params.Get( j ) );
280 arr.Insert( param_string.GetValue() );
292 m_DefaultValues.Insert(SCENE_DRAW_SELECTION, GetNewCfgParamBool(
true) );
293 m_DefaultValues.Insert(SCENE_LOAD_PLAYER_POS, GetNewCfgParamBool(
true) );
294 m_DefaultValues.Insert(SCENE_ROTATION_ANGLE, GetNewCfgParamInt(15) );
295 m_DefaultValues.Insert(ITEM_TAB_SELECTED, GetNewCfgParamInt(0) );
296 m_DefaultValues.Insert(PRESET_DEFAULT, GetNewCfgParamString(
"") );
297 m_DefaultValues.Insert(ITEM_SEARCH, GetNewCfgParamString(
"") );
298 m_DefaultValues.Insert(SPAWN_DISTANCE, GetNewCfgParamFloat(0.0) );
299 m_DefaultValues.Insert(LOGS_ENABLED, GetNewCfgParamBool(
true) );
300 m_DefaultValues.Insert(CHAR_STATS_VIS, GetNewCfgParamBool(
false) );
301 m_DefaultValues.Insert(CHAR_LEVELS_VIS, GetNewCfgParamBool(
false) );
302 m_DefaultValues.Insert(CHAR_MODIFIERS_VIS, GetNewCfgParamBool(
false) );
303 m_DefaultValues.Insert(CHAR_AGENTS_VIS, GetNewCfgParamBool(
false) );
304 m_DefaultValues.Insert(CHAR_DEBUG_VIS, GetNewCfgParamBool(
false) );
305 m_DefaultValues.Insert(FREE_CAMERA_CROSSHAIR, GetNewCfgParamBool(
true) );
306 m_DefaultValues.Insert(VERSION_VIS, GetNewCfgParamBool(
true) );
307 m_DefaultValues.Insert(CONFIG_CLASSES_FLAG, GetNewCfgParamInt(15) );
308 m_DefaultValues.Insert(TEMP_VIS, GetNewCfgParamBool(
false) );
309 m_DefaultValues.Insert(MERGE_TYPE, GetNewCfgParamBool(
false) );
310 m_DefaultValues.Insert(ITEM_PREVIEW, GetNewCfgParamBool(
true) );
311 m_DefaultValues.Insert(BATCH_RECT, GetNewCfgParamArray(GetDefaultBatchRectParams()) );
312 m_DefaultValues.Insert(BATCH_QUANT, GetNewCfgParamInt(10) );
313 m_DefaultValues.Insert(SOUNDFILTER, GetNewCfgParamString(
"") );
314 m_DefaultValues.Insert(ITEMDEBUG, GetNewCfgParamString(
"0 0 0") );
315 m_DefaultValues.Insert(SPAWN_LOC_INDEX, GetNewCfgParamInt(0));
316 m_DefaultValues.Insert(FILTER_REVERSED, GetNewCfgParamBool(
false));
322 CfgParamInt param1 =
new CfgParamInt(
"");
324 CfgParamInt param2 =
new CfgParamInt(
"");
326 CfgParamFloat param3 =
new CfgParamFloat(
"");
327 param3.SetValue(1.0);
328 CfgParamFloat param4 =
new CfgParamFloat(
"");
329 param4.SetValue(1.0);
331 params.Insert(param1);
332 params.Insert(param2);
333 params.Insert(param3);
334 params.Insert(param4);
349 for (
int i = 0; i < params.Count(); i++ )
351 CfgParamString param = CfgParamString.Cast( params.Get( i ) );
352 m_PresetList.Insert( param.GetValue() );
359 override string GetFileName()
362 return "$profile:debugProfile.cfg";
375 bool GetSceneEditorDrawSelection()
377 return GetBool( SCENE_DRAW_SELECTION );
380 void SetSceneEditorDrawSelection(
bool value )
382 SetBool( SCENE_DRAW_SELECTION, value );
388 bool GetSceneEditorLoadPlayerPos()
390 return GetBool( SCENE_LOAD_PLAYER_POS );
393 void SetSceneEditorLoadPlayerPos(
bool value )
395 SetBool( SCENE_LOAD_PLAYER_POS, value );
401 int GetSceneEditorRotationAngle()
403 return GetInt( SCENE_ROTATION_ANGLE );
406 void SetSceneEditorRotationAngle(
int value )
408 SetInt( SCENE_ROTATION_ANGLE, value );
416 return GetInt( ITEM_TAB_SELECTED );
419 void SetTabSelected(
int value )
421 SetInt( ITEM_TAB_SELECTED, value );
427 int GetSpawnLocIndex()
429 return GetInt( SPAWN_LOC_INDEX );
432 void SetSpawnLocIndex(
int value )
434 SetInt( SPAWN_LOC_INDEX, value );
440 int GetFilterOrderReversed()
442 return GetBool( FILTER_REVERSED );
445 void SetFilterOrderReversed(
bool reversed )
447 SetBool( FILTER_REVERSED, reversed );
453 string GetDefaultPreset()
455 return GetString( PRESET_DEFAULT );
458 void SetDefaultPreset(
string value )
460 SetString( PRESET_DEFAULT, value );
468 return GetArray( BATCH_RECT );
471 void SetBatchSpawnRectangle(
int row,
int column,
float rowStep,
float columnStep)
475 CfgParamString param;
477 CfgParamInt param1 =
new CfgParamInt(
"");
478 param1.SetValue(row);
479 CfgParamInt param2 =
new CfgParamInt(
"");
480 param2.SetValue(column);
481 CfgParamFloat param3 =
new CfgParamFloat(
"");
482 param3.SetValue(rowStep);
483 CfgParamFloat param4 =
new CfgParamFloat(
"");
484 param4.SetValue(columnStep);
486 params.Insert(param1);
487 params.Insert(param2);
488 params.Insert(param3);
489 params.Insert(param4);
496 int GetBatchSpawnQuantity()
498 return GetInt( BATCH_QUANT );
501 void SetBatchSpawnQuantity(
int value)
503 SetInt( BATCH_QUANT, value );
508 string GetItemSearch()
510 return GetString( ITEM_SEARCH );
513 void SetItemSearch(
string value )
515 SetString( ITEM_SEARCH, value );
521 float GetSpawnDistance()
523 return GetFloat( SPAWN_DISTANCE );
526 void SetSpawnDistance(
float value )
528 SetFloat( SPAWN_DISTANCE, value );
534 bool GetLogsEnabled()
536 return GetBool( LOGS_ENABLED );
539 void SetLogsEnabled(
bool value )
541 SetBool( LOGS_ENABLED, value );
547 bool GetCharacterLevelsVisible()
549 return GetBool( CHAR_LEVELS_VIS );
553 void SetCharacterLevelsVisible(
bool is_visible )
555 SetBool( CHAR_LEVELS_VIS, is_visible );
562 void SetItemDebugPos(
vector pos)
564 SetString( ITEMDEBUG ,pos.ToString(
false));
570 return GetString( ITEMDEBUG ).ToVector();
576 bool GetCharacterStatsVisible()
578 return GetBool( CHAR_STATS_VIS );
582 void SetCharacterStatsVisible(
bool is_visible )
584 SetBool( CHAR_STATS_VIS, is_visible );
590 bool GetCharacterModifiersVisible()
592 return GetBool( CHAR_MODIFIERS_VIS );
595 void SetCharacterModifiersVisible(
bool is_visible )
597 SetBool( CHAR_MODIFIERS_VIS, is_visible );
603 bool GetCharacterAgentsVisible()
605 return GetBool( CHAR_AGENTS_VIS );
608 void SetCharacterAgentsVisible(
bool is_visible )
610 SetBool( CHAR_AGENTS_VIS, is_visible );
616 bool GetCharacterDebugVisible()
618 return GetBool( CHAR_DEBUG_VIS );
621 void SetCharacterDebugVisible(
bool is_visible )
623 SetBool( CHAR_DEBUG_VIS, is_visible );
629 bool GetCharacterStomachVisible()
631 return GetBool( CHAR_STOMACH_VIS );
634 void SetCharacterStomachVisible(
bool is_visible )
636 SetBool( CHAR_STOMACH_VIS, is_visible );
642 bool GetFreeCameraCrosshairVisible()
644 return GetBool( FREE_CAMERA_CROSSHAIR );
647 void SetFreeCameraCrosshairVisible(
bool is_visible )
649 SetBool( FREE_CAMERA_CROSSHAIR, is_visible );
655 bool GetVersionVisible()
657 return GetBool( VERSION_VIS );
660 void SetVersionVisible(
bool is_visible )
662 SetBool( VERSION_VIS, is_visible );
670 return GetBool( MERGE_TYPE );
673 void SetMergeType(
bool is_visible )
675 SetBool( MERGE_TYPE, is_visible );
681 string GetSoundsetFilter()
683 return GetString( SOUNDFILTER );
686 void SetSoundsetFilter(
string content )
688 SetString( SOUNDFILTER, content );
694 bool GetTempVisible()
696 return GetBool( TEMP_VIS );
699 void SetTempVisible(
bool is_visible )
701 SetBool( TEMP_VIS, is_visible );
707 bool GetShowItemPreview()
709 return GetBool( ITEM_PREVIEW );
712 void SetShowItemPreview(
bool show )
714 SetBool( ITEM_PREVIEW, show );
721 int GetConfigClassesFlag()
723 return GetInt( CONFIG_CLASSES_FLAG );
726 void SetConfigClassesFlag(
int flag )
728 SetInt( CONFIG_CLASSES_FLAG, flag );
735 int GetItemCategoryFlag()
737 return GetInt( ITEM_CATEGORY_FLAG );
740 void SetItemCategoryFlag(
int flag )
742 SetInt( ITEM_CATEGORY_FLAG, flag );
748 bool CustomLocationsAdd(
string name,
vector position )
750 string world =
g_Game.GetWorldName();
753 CfgParamString locationName =
new CfgParamString(PluginConfigDebugProfileFixed.SUB_PARAM_POS_NAME);
754 locationName.SetValue(
name);
755 CfgParamString locationPos =
new CfgParamString(PluginConfigDebugProfileFixed.SUB_PARAM_POS_VEC);
756 locationPos.SetValue(position.ToString(
false));
758 CfgParamArray locationEntry =
new CfgParamArray( locationName.GetValue() );
759 locationEntry.InsertValue( locationName );
760 locationEntry.InsertValue( locationPos );
762 string paramName = POSITION_NAME_ROOT + world;
764 params.Insert(locationEntry);
765 SetArray(paramName, params);
771 void CustomLocationsRemove(
string name )
775 string world =
g_Game.GetWorldName();
777 string paramName = POSITION_NAME_ROOT + world;
780 for (
int i = 0; i < params.Count(); i++)
782 CfgParamArray param = CfgParamArray.Cast(params.Get(i));
784 CfgParamString par = CfgParamString.Cast(prms.Get(0));
785 if (par.GetValue() ==
name)
787 params.RemoveOrdered(i);
804 protected void SetPreset(
string preset_name,
int index = -1 )
807 CfgParamString param;
811 param =
new CfgParamString(
"" );
812 param.SetValue( preset_name );
813 params.Insert( param );
814 m_PresetList.Insert( preset_name );
818 param = CfgParamString.Cast( params.Get( index ) );
819 param.SetValue( preset_name );
820 params.Set( index, param );
821 m_PresetList.Set( index, preset_name );
827 protected void RemovePreset(
string preset_name )
830 for (
int i = 0; i < params.Count(); i++ )
832 CfgParamString param = CfgParamString.Cast( params.Get(i) );
833 if ( param.GetValue() == preset_name )
835 params.RemoveItem( param );
836 m_PresetList.RemoveItem( preset_name );
841 bool GetPresetItems(
string preset_name, out
TStringArray arr,
string param_name =
"" )
843 if ( m_PresetList.Find(preset_name) == -1 )
848 param_name = SUB_PARAM_ITEM_NAME;
849 GetSubParametersInStringArray( preset_name, param_name, arr );
854 bool PresetAdd(
string preset_name )
856 if ( m_PresetList.Find(preset_name) > -1 )
861 SetPreset( preset_name );
868 bool PresetRemove(
string preset_name )
870 if ( m_PresetList.Find(preset_name) == -1 )
875 RemovePreset( preset_name );
876 RemoveParamByName( preset_name );
882 bool PresetRename(
string old_preset_name,
string new_preset_name )
884 int index = m_PresetList.Find( old_preset_name );
891 SetPreset( new_preset_name, index );
892 RenameParam( old_preset_name, new_preset_name );
898 bool ItemAddToPreset(
string preset_name,
string item_name )
900 if ( m_PresetList.Find( preset_name ) == -1 )
905 CfgParamString param =
new CfgParamString( SUB_PARAM_ITEM_NAME );
906 param.SetValue( item_name );
908 CfgParamArray item_params =
new CfgParamArray( SUB_PARAM_ITEM );
909 item_params.InsertValue( param );
912 params.Insert( item_params );
919 bool ItemRemoveFromPreset(
string preset_name,
int item_index )
921 if ( m_PresetList.Find( preset_name ) == -1 )
928 if ( item_index >= params.Count() )
933 params.Remove( item_index );
940 bool SwapItem(
string preset_name,
int item1_index,
int item2_index )
944 if ( item1_index >= params.Count() || item2_index >= params.Count() )
949 params.SwapItems( item1_index, item2_index );
957 if ( m_PresetList.Find( preset_name ) == -1 )
964 if ( !params || item_index >= params.Count() )
968 if (params.IsValidIndex(item_index))
969 CfgParamArray params_array = CfgParamArray.Cast( params.Get( item_index ) );
971 return params_array.GetValues();
976 protected CfgParam GetItemParam(
string preset_name,
int item_index,
string param_name )
980 if ( item_params == NULL )
986 for (
int i = 0; i < item_params.Count(); i++ )
988 if ( item_params.Get(i).GetName() == param_name )
990 param = item_params.Get(i);
997 float GetItemHealth(
string preset_name,
int item_index )
999 CfgParam param = GetItemParam( preset_name, item_index, SUB_PARAM_ITEM_HEALTH );
1001 if ( param == NULL )
1007 CfgParamFloat param_float = CfgParamFloat.Cast( param );
1008 return param_float.GetValue();
1012 bool SetItemHealth(
string preset_name,
int item_index,
float health )
1014 CfgParam param = GetItemParam( preset_name, item_index, SUB_PARAM_ITEM_HEALTH );
1016 if ( param != NULL )
1018 CfgParamFloat param_float = CfgParamFloat.Cast( param );
1019 param_float.SetValue( health );
1025 if ( item_params != NULL )
1027 CfgParamFloat new_param =
new CfgParamFloat( SUB_PARAM_ITEM_HEALTH );
1028 new_param.SetValue( health );
1029 item_params.Insert( new_param );
1038 int GetItemQuantity(
string preset_name,
int item_index )
1040 CfgParam param = GetItemParam( preset_name, item_index, SUB_PARAM_ITEM_QUANTITY );
1042 if ( param == NULL )
1048 CfgParamInt param_int = CfgParamInt.Cast( param );
1049 return param_int.GetValue();
1053 bool SetItemQuantity(
string preset_name,
int item_index,
int quantity )
1055 CfgParam param = GetItemParam( preset_name, item_index, SUB_PARAM_ITEM_QUANTITY );
1057 if ( param != NULL )
1059 CfgParamInt param_int = CfgParamInt.Cast( param );
1060 param_int.SetValue( quantity );
1066 if ( item_params != NULL )
1068 CfgParamInt new_param =
new CfgParamInt( SUB_PARAM_ITEM_QUANTITY );
1069 new_param.SetValue( quantity );
1070 item_params.Insert( new_param );
1079 bool GetItemWithPhysics(
string preset_name,
int item_index )
1081 CfgParam param = GetItemParam( preset_name, item_index, SUB_PARAM_ITEM_WITH_PHYSICS );
1083 if ( param == NULL )
1089 CfgParamBool param_bool = CfgParamBool.Cast( param );
1090 return param_bool.GetValue();
1094 bool SetItemWithPhysics(
string preset_name,
int item_index,
bool with_physics )
1096 CfgParam param = GetItemParam( preset_name, item_index, SUB_PARAM_ITEM_WITH_PHYSICS );
1098 if ( param != NULL )
1100 CfgParamBool param_bool = CfgParamBool.Cast( param );
1101 param_bool.SetValue( with_physics );
1107 if ( item_params != NULL )
1109 CfgParamBool new_param =
new CfgParamBool( SUB_PARAM_ITEM_WITH_PHYSICS );
1110 new_param.SetValue( with_physics );
1111 item_params.Insert( new_param );
1126 string world =
g_Game.GetWorldName();
1128 string paramName = POSITION_NAME_ROOT + world;
1131 GetSubParametersInStringArray( paramName, PluginConfigDebugProfileFixed.SUB_PARAM_POS_NAME, names );
1133 GetSubParametersInStringArray( paramName, PluginConfigDebugProfileFixed.SUB_PARAM_POS_VEC, positions );
1137 for ( i = names.Count() - 1; i >= 0 ; i--)
1139 arr.Insert(
new LocationParams(names.Get(i), isCustom, positions.Get(i).ToVector()));
1144 for (i = 0; i < names.Count(); i++)
1146 arr.Insert(
new LocationParams(names.Get(i), isCustom, positions.Get(i).ToVector()));