Added setting 'TheMaxStructuresInRange' to command line.

Changed to int data type.
This commit is contained in:
Brett Hewitson 2021-11-23 16:56:54 +10:00
parent 9d5dafaed6
commit 99438f54e3
5 changed files with 56 additions and 25 deletions

View file

@ -2744,12 +2744,12 @@ namespace ServerManagerTool.Lib
set { SetValue(PvPZoneStructureDamageMultiplierProperty, value); } set { SetValue(PvPZoneStructureDamageMultiplierProperty, value); }
} }
public static readonly DependencyProperty MaxStructuresVisibleProperty = DependencyProperty.Register(nameof(MaxStructuresVisible), typeof(float), typeof(ServerProfile), new PropertyMetadata(10500f)); public static readonly DependencyProperty MaxStructuresInRangeProperty = DependencyProperty.Register(nameof(MaxStructuresInRange), typeof(int), typeof(ServerProfile), new PropertyMetadata(10500));
[IniFileEntry(IniFiles.GameUserSettings, IniSections.GUS_ServerSettings, ServerProfileCategory.Structures, "TheMaxStructuresInRange")] [IniFileEntry(IniFiles.GameUserSettings, IniSections.GUS_ServerSettings, ServerProfileCategory.Structures, "TheMaxStructuresInRange")]
public float MaxStructuresVisible public int MaxStructuresInRange
{ {
get { return (float)GetValue(MaxStructuresVisibleProperty); } get { return (int)GetValue(MaxStructuresInRangeProperty); }
set { SetValue(MaxStructuresVisibleProperty, value); } set { SetValue(MaxStructuresInRangeProperty, value); }
} }
public static readonly DependencyProperty PerPlatformMaxStructuresMultiplierProperty = DependencyProperty.Register(nameof(PerPlatformMaxStructuresMultiplier), typeof(float), typeof(ServerProfile), new PropertyMetadata(1.0f)); public static readonly DependencyProperty PerPlatformMaxStructuresMultiplierProperty = DependencyProperty.Register(nameof(PerPlatformMaxStructuresMultiplier), typeof(float), typeof(ServerProfile), new PropertyMetadata(1.0f));
@ -3648,6 +3648,8 @@ namespace ServerManagerTool.Lib
serverArgs.Append("?ClampItemStats=true"); serverArgs.Append("?ClampItemStats=true");
} }
serverArgs.Append($"?TheMaxStructuresInRange={this.MaxStructuresInRange}");
if (Config.Default.SectionSOTFEnabled && this.SOTF_Enabled) if (Config.Default.SectionSOTFEnabled && this.SOTF_Enabled)
{ {
serverArgs.Append("?EvoEventInterval=").Append(this.SOTF_EvoEventInterval); serverArgs.Append("?EvoEventInterval=").Append(this.SOTF_EvoEventInterval);
@ -5531,7 +5533,7 @@ namespace ServerManagerTool.Lib
this.ClearValue(StructureDamageRepairCooldownProperty); this.ClearValue(StructureDamageRepairCooldownProperty);
this.ClearValue(PvPStructureDecayProperty); this.ClearValue(PvPStructureDecayProperty);
this.ClearValue(PvPZoneStructureDamageMultiplierProperty); this.ClearValue(PvPZoneStructureDamageMultiplierProperty);
this.ClearValue(MaxStructuresVisibleProperty); this.ClearValue(MaxStructuresInRangeProperty);
this.ClearValue(PerPlatformMaxStructuresMultiplierProperty); this.ClearValue(PerPlatformMaxStructuresMultiplierProperty);
this.ClearValue(MaxPlatformSaddleStructureLimitProperty); this.ClearValue(MaxPlatformSaddleStructureLimitProperty);
this.ClearValue(OverrideStructurePlatformPreventionProperty); this.ClearValue(OverrideStructurePlatformPreventionProperty);
@ -6231,7 +6233,7 @@ namespace ServerManagerTool.Lib
this.SetValue(StructureDamageRepairCooldownProperty, sourceProfile.StructureDamageRepairCooldown); this.SetValue(StructureDamageRepairCooldownProperty, sourceProfile.StructureDamageRepairCooldown);
this.SetValue(PvPStructureDecayProperty, sourceProfile.PvPStructureDecay); this.SetValue(PvPStructureDecayProperty, sourceProfile.PvPStructureDecay);
this.SetValue(PvPZoneStructureDamageMultiplierProperty, sourceProfile.PvPZoneStructureDamageMultiplier); this.SetValue(PvPZoneStructureDamageMultiplierProperty, sourceProfile.PvPZoneStructureDamageMultiplier);
this.SetValue(MaxStructuresVisibleProperty, sourceProfile.MaxStructuresVisible); this.SetValue(MaxStructuresInRangeProperty, sourceProfile.MaxStructuresInRange);
this.SetValue(PerPlatformMaxStructuresMultiplierProperty, sourceProfile.PerPlatformMaxStructuresMultiplier); this.SetValue(PerPlatformMaxStructuresMultiplierProperty, sourceProfile.PerPlatformMaxStructuresMultiplier);
this.SetValue(MaxPlatformSaddleStructureLimitProperty, sourceProfile.MaxPlatformSaddleStructureLimit); this.SetValue(MaxPlatformSaddleStructureLimitProperty, sourceProfile.MaxPlatformSaddleStructureLimit);
this.SetValue(OverrideStructurePlatformPreventionProperty, sourceProfile.OverrideStructurePlatformPrevention); this.SetValue(OverrideStructurePlatformPreventionProperty, sourceProfile.OverrideStructurePlatformPrevention);

View file

@ -27,6 +27,11 @@
<li>Global Settings - Added option to set the Main Window start mode - Normal, Maximized, Minimized.</li> <li>Global Settings - Added option to set the Main Window start mode - Normal, Maximized, Minimized.</li>
<li>Main Window - now sotres the Left and Top positions of the window, when in Normal mode. Will restore the window position when started. Defaults to 50,50.</li> <li>Main Window - now sotres the Left and Top positions of the window, when in Normal mode. Will restore the window position when started. Defaults to 50,50.</li>
</ul> </ul>
<u style="font-size: .9em;">CHANGE</u>
<br/>
<ul>
<li>Added setting 'TheMaxStructuresInRange' to command line.</li>
</ul>
</p> </p>
</div> </div>
</content> </content>

View file

@ -27,6 +27,11 @@
<li>Global Settings - Added option to set the Main Window start mode - Normal, Maximized, Minimized.</li> <li>Global Settings - Added option to set the Main Window start mode - Normal, Maximized, Minimized.</li>
<li>Main Window - now sotres the Left and Top positions of the window, when in Normal mode. Will restore the window position when started. Defaults to 50,50.</li> <li>Main Window - now sotres the Left and Top positions of the window, when in Normal mode. Will restore the window position when started. Defaults to 50,50.</li>
</ul> </ul>
<u style="font-size: .9em;">CHANGE</u>
<br/>
<ul>
<li>Added setting 'TheMaxStructuresInRange' to command line.</li>
</ul>
</p> </p>
</div> </div>
</content> </content>

View file

@ -3164,7 +3164,7 @@
<CheckBox Margin="5" Content="{DynamicResource ServerSettings_EnablePvPStructureDecayLabel}" IsChecked="{Binding PvPStructureDecay}" ToolTip="{DynamicResource ServerSettings_EnablePvPStructureDecayTooltip}" HorizontalAlignment="Left"/> <CheckBox Margin="5" Content="{DynamicResource ServerSettings_EnablePvPStructureDecayLabel}" IsChecked="{Binding PvPStructureDecay}" ToolTip="{DynamicResource ServerSettings_EnablePvPStructureDecayTooltip}" HorizontalAlignment="Left"/>
<cctl:AnnotatedSlider Margin="1" Label="{DynamicResource ServerSettings_PvPZoneStructureDamageLabel}" Value="{Binding PvPZoneStructureDamageMultiplier}" Suffix="{DynamicResource SliderUnits_Multiplier}" Minimum="0" Maximum="10" SmallChange="0.1" LargeChange="1" TickFrequency="1" ToolTip="{DynamicResource ServerSettings_PvPZoneStructureDamageTooltip}"/> <cctl:AnnotatedSlider Margin="1" Label="{DynamicResource ServerSettings_PvPZoneStructureDamageLabel}" Value="{Binding PvPZoneStructureDamageMultiplier}" Suffix="{DynamicResource SliderUnits_Multiplier}" Minimum="0" Maximum="10" SmallChange="0.1" LargeChange="1" TickFrequency="1" ToolTip="{DynamicResource ServerSettings_PvPZoneStructureDamageTooltip}"/>
<cctl:AnnotatedSlider Margin="1" Label="{DynamicResource ServerSettings_MaxStructuresVisibleLabel}" Value="{Binding MaxStructuresVisible}" Minimum="50" Maximum="5000" LargeChange="50" SmallChange="10" TickFrequency="100" Suffix="{DynamicResource SliderUnits_Items}" ToolTip="{DynamicResource ServerSettings_MaxStructuresVisibleTooltip}"/> <cctl:AnnotatedSlider Margin="1" Label="{DynamicResource ServerSettings_MaxStructuresVisibleLabel}" Value="{Binding MaxStructuresInRange}" Minimum="50" Maximum="50000" LargeChange="50" SmallChange="10" TickFrequency="100" Suffix="{DynamicResource SliderUnits_Items}" ToolTip="{DynamicResource ServerSettings_MaxStructuresVisibleTooltip}"/>
<cctl:AnnotatedSlider Margin="1" Label="{DynamicResource ServerSettings_PerPlatformStructuresMultiplierLabel}" Value="{Binding PerPlatformMaxStructuresMultiplier}" Minimum="0" Maximum="10" LargeChange="1" SmallChange="0.1" TickFrequency="1" Suffix="{DynamicResource SliderUnits_Multiplier}" ToolTip="{DynamicResource ServerSettings_PerPlatformStructuresMultiplierTooltip}"/> <cctl:AnnotatedSlider Margin="1" Label="{DynamicResource ServerSettings_PerPlatformStructuresMultiplierLabel}" Value="{Binding PerPlatformMaxStructuresMultiplier}" Minimum="0" Maximum="10" LargeChange="1" SmallChange="0.1" TickFrequency="1" Suffix="{DynamicResource SliderUnits_Multiplier}" ToolTip="{DynamicResource ServerSettings_PerPlatformStructuresMultiplierTooltip}"/>
<cctl:AnnotatedSlider Margin="1" Label="{DynamicResource ServerSettings_MaxPlatformSaddleStructuresLabel}" Value="{Binding MaxPlatformSaddleStructureLimit}" Minimum="0" Maximum="65535" LargeChange="50" SmallChange="10" TickFrequency="100" Suffix="{DynamicResource SliderUnits_Items}" ToolTip="{DynamicResource ServerSettings_MaxPlatformSaddleStructuresTooltip}"/> <cctl:AnnotatedSlider Margin="1" Label="{DynamicResource ServerSettings_MaxPlatformSaddleStructuresLabel}" Value="{Binding MaxPlatformSaddleStructureLimit}" Minimum="0" Maximum="65535" LargeChange="50" SmallChange="10" TickFrequency="100" Suffix="{DynamicResource SliderUnits_Items}" ToolTip="{DynamicResource ServerSettings_MaxPlatformSaddleStructuresTooltip}"/>

View file

@ -57,28 +57,38 @@ namespace ServerManagerTool.Common.Utils
{ {
if (property.PropertyType == typeof(bool) || property.PropertyType == typeof(bool?)) if (property.PropertyType == typeof(bool) || property.PropertyType == typeof(bool?))
{ {
bool boolValue; bool.TryParse(value, out bool boolValue);
bool.TryParse(value, out boolValue);
property.SetValue(obj, boolValue); property.SetValue(obj, boolValue);
} }
else if (property.PropertyType == typeof(int) || property.PropertyType == typeof(int?)) else if (property.PropertyType == typeof(int) || property.PropertyType == typeof(int?))
{ {
int intValue; string decimalSeparator = CultureInfo.GetCultureInfo(DEFAULT_CULTURE_CODE).NumberFormat.NumberDecimalSeparator;
int.TryParse(value, NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign, CultureInfo.GetCultureInfo(DEFAULT_CULTURE_CODE), out intValue); var tempValue = value;
if (tempValue.Contains(decimalSeparator))
{
tempValue = tempValue.Substring(0, tempValue.IndexOf(decimalSeparator));
}
int.TryParse(tempValue, NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign, CultureInfo.GetCultureInfo(DEFAULT_CULTURE_CODE), out int intValue);
property.SetValue(obj, intValue); property.SetValue(obj, intValue);
} }
else if (property.PropertyType == typeof(float) || property.PropertyType == typeof(float?)) else if (property.PropertyType == typeof(float) || property.PropertyType == typeof(float?))
{ {
var tempValue = value.Replace("f", ""); var tempValue = value.Replace("f", "");
float floatValue; float.TryParse(tempValue, NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign, CultureInfo.GetCultureInfo(DEFAULT_CULTURE_CODE), out float floatValue);
float.TryParse(tempValue, NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign, CultureInfo.GetCultureInfo(DEFAULT_CULTURE_CODE), out floatValue);
property.SetValue(obj, floatValue); property.SetValue(obj, floatValue);
} }
else if (property.PropertyType == typeof(NullableValue<int>)) else if (property.PropertyType == typeof(NullableValue<int>))
{ {
int intValue; string decimalSeparator = CultureInfo.GetCultureInfo(DEFAULT_CULTURE_CODE).NumberFormat.NumberDecimalSeparator;
int.TryParse(value, NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign, CultureInfo.GetCultureInfo(DEFAULT_CULTURE_CODE), out intValue); var tempValue = value;
if (tempValue.Contains(decimalSeparator))
{
tempValue = tempValue.Substring(0, tempValue.IndexOf(decimalSeparator));
}
int.TryParse(tempValue, NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign, CultureInfo.GetCultureInfo(DEFAULT_CULTURE_CODE), out int intValue);
var field = property.GetValue(obj) as NullableValue<int>; var field = property.GetValue(obj) as NullableValue<int>;
property.SetValue(obj, field.SetValue(true, intValue)); property.SetValue(obj, field.SetValue(true, intValue));
} }
@ -86,8 +96,7 @@ namespace ServerManagerTool.Common.Utils
{ {
var tempValue = value.Replace("f", ""); var tempValue = value.Replace("f", "");
float floatValue; float.TryParse(tempValue, NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign, CultureInfo.GetCultureInfo(DEFAULT_CULTURE_CODE), out float floatValue);
float.TryParse(tempValue, NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign, CultureInfo.GetCultureInfo(DEFAULT_CULTURE_CODE), out floatValue);
var field = property.GetValue(obj) as NullableValue<float>; var field = property.GetValue(obj) as NullableValue<float>;
property.SetValue(obj, field.SetValue(true, floatValue)); property.SetValue(obj, field.SetValue(true, floatValue));
} }
@ -121,8 +130,14 @@ namespace ServerManagerTool.Common.Utils
} }
if (property.PropertyType == typeof(int) || property.PropertyType == typeof(int?)) if (property.PropertyType == typeof(int) || property.PropertyType == typeof(int?))
{ {
int intValue; string decimalSeparator = CultureInfo.GetCultureInfo(DEFAULT_CULTURE_CODE).NumberFormat.NumberDecimalSeparator;
int.TryParse(value, NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign, CultureInfo.GetCultureInfo(DEFAULT_CULTURE_CODE), out intValue); var tempValue = value;
if (tempValue.Contains(decimalSeparator))
{
tempValue = tempValue.Substring(0, tempValue.IndexOf(decimalSeparator));
}
int.TryParse(tempValue, NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign, CultureInfo.GetCultureInfo(DEFAULT_CULTURE_CODE), out int intValue);
property.SetValue(obj, intValue); property.SetValue(obj, intValue);
return true; return true;
} }
@ -130,15 +145,20 @@ namespace ServerManagerTool.Common.Utils
{ {
var tempValue = value.Replace("f", ""); var tempValue = value.Replace("f", "");
float floatValue; float.TryParse(tempValue, NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign, CultureInfo.GetCultureInfo(DEFAULT_CULTURE_CODE), out float floatValue);
float.TryParse(tempValue, NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign, CultureInfo.GetCultureInfo(DEFAULT_CULTURE_CODE), out floatValue);
property.SetValue(obj, floatValue); property.SetValue(obj, floatValue);
return true; return true;
} }
if (property.PropertyType == typeof(NullableValue<int>)) if (property.PropertyType == typeof(NullableValue<int>))
{ {
int intValue; string decimalSeparator = CultureInfo.GetCultureInfo(DEFAULT_CULTURE_CODE).NumberFormat.NumberDecimalSeparator;
int.TryParse(value, NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign, CultureInfo.GetCultureInfo(DEFAULT_CULTURE_CODE), out intValue); var tempValue = value;
if (tempValue.Contains(decimalSeparator))
{
tempValue = tempValue.Substring(0, tempValue.IndexOf(decimalSeparator));
}
int.TryParse(tempValue, NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign, CultureInfo.GetCultureInfo(DEFAULT_CULTURE_CODE), out int intValue);
var field = property.GetValue(obj) as NullableValue<int>; var field = property.GetValue(obj) as NullableValue<int>;
property.SetValue(obj, field.SetValue(true, intValue)); property.SetValue(obj, field.SetValue(true, intValue));
return true; return true;
@ -147,8 +167,7 @@ namespace ServerManagerTool.Common.Utils
{ {
var tempValue = value.Replace("f", ""); var tempValue = value.Replace("f", "");
float floatValue; float.TryParse(tempValue, NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign, CultureInfo.GetCultureInfo(DEFAULT_CULTURE_CODE), out float floatValue);
float.TryParse(tempValue, NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign, CultureInfo.GetCultureInfo(DEFAULT_CULTURE_CODE), out floatValue);
var field = property.GetValue(obj) as NullableValue<float>; var field = property.GetValue(obj) as NullableValue<float>;
property.SetValue(obj, field.SetValue(true, floatValue)); property.SetValue(obj, field.SetValue(true, floatValue));
return true; return true;