Grid Changes

- added good, warning and bad icons to the map spawner and prevent transfer grids.
This commit is contained in:
Brett Hewitson 2022-06-15 23:18:42 +10:00
parent 9df02ec05e
commit ca9c053f08
8 changed files with 172 additions and 17 deletions

View file

@ -183,6 +183,8 @@ namespace ServerManagerTool.Lib
public static IEnumerable<NPCReplacement> GetNPCReplacements() => dinoSpawns.Select(d => new NPCReplacement() { FromClassName = d.ClassName, ToClassName = d.ClassName }); public static IEnumerable<NPCReplacement> GetNPCReplacements() => dinoSpawns.Select(d => new NPCReplacement() { FromClassName = d.ClassName, ToClassName = d.ClassName });
public static bool HasCreatureForClass(string className) => !string.IsNullOrWhiteSpace(className) && dinoSpawns.Any(e => e.ClassName.Equals(className));
public static bool IsSpawnableForClass(string className) => gameData?.Creatures?.FirstOrDefault(c => c.ClassName.Equals(className))?.IsSpawnable ?? true; public static bool IsSpawnableForClass(string className) => gameData?.Creatures?.FirstOrDefault(c => c.ClassName.Equals(className))?.IsSpawnable ?? true;
public static DinoTamable IsTameableForClass(string className) => gameData?.Creatures?.FirstOrDefault(c => c.ClassName.Equals(className))?.IsTameable ?? DinoTamable.True; public static DinoTamable IsTameableForClass(string className) => gameData?.Creatures?.FirstOrDefault(c => c.ClassName.Equals(className))?.IsTameable ?? DinoTamable.True;

View file

@ -17,11 +17,9 @@ namespace ServerManagerTool.Lib
public IEnumerable<string> RenderToView() public IEnumerable<string> RenderToView()
{ {
List<string> errors = new List<string>();
Update(); Update();
return errors; return new List<string>();
} }
public void RenderToModel() public void RenderToModel()

View file

@ -16,6 +16,8 @@ namespace ServerManagerTool.Lib
public IEnumerable<string> RenderToView() public IEnumerable<string> RenderToView()
{ {
Update();
return new List<string>(); return new List<string>();
} }
@ -26,6 +28,14 @@ namespace ServerManagerTool.Lib
public void UpdateForLocalization() public void UpdateForLocalization()
{ {
} }
public void Update()
{
IsEnabled = this.Count > 0;
foreach (var preventTransfer in this)
preventTransfer.Update();
}
} }
[DataContract] [DataContract]
@ -53,7 +63,10 @@ namespace ServerManagerTool.Lib
public override void InitializeFromINIValue(string value) public override void InitializeFromINIValue(string value)
{ {
if (string.IsNullOrWhiteSpace(value)) if (string.IsNullOrWhiteSpace(value))
{
Update();
return; return;
}
var kvPair = value.Split(new[] { '=' }, 2); var kvPair = value.Split(new[] { '=' }, 2);
var kvValue = kvPair[1].Trim(' '); var kvValue = kvPair[1].Trim(' ');
@ -74,5 +87,18 @@ namespace ServerManagerTool.Lib
{ {
return IsValid; return IsValid;
} }
public static readonly DependencyProperty ValidStatusProperty = DependencyProperty.Register(nameof(ValidStatus), typeof(string), typeof(PreventTransferOverride), new PropertyMetadata("N"));
public string ValidStatus
{
get { return (string)GetValue(ValidStatusProperty); }
set { SetValue(ValidStatusProperty, value); }
}
public void Update()
{
ValidStatus = IsValid ? (GameData.HasCreatureForClass(DinoClassString) ? "Y" : "W") : "N";
}
} }
} }

View file

@ -20,7 +20,8 @@ namespace ServerManagerTool.Lib.ViewModel
Reset(); Reset();
} }
public NPCSpawnSettingsList(NPCSpawnContainerList<NPCSpawnContainer> configAddNPCSpawnEntriesContainer, public NPCSpawnSettingsList(
NPCSpawnContainerList<NPCSpawnContainer> configAddNPCSpawnEntriesContainer,
NPCSpawnContainerList<NPCSpawnContainer> configSubtractNPCSpawnEntriesContainer, NPCSpawnContainerList<NPCSpawnContainer> configSubtractNPCSpawnEntriesContainer,
NPCSpawnContainerList<NPCSpawnContainer> configOverrideNPCSpawnEntriesContainer) NPCSpawnContainerList<NPCSpawnContainer> configOverrideNPCSpawnEntriesContainer)
{ {
@ -138,6 +139,8 @@ namespace ServerManagerTool.Lib.ViewModel
this.Add(spawnSettings); this.Add(spawnSettings);
} }
Update();
} }
public void RenderToModel() public void RenderToModel()
@ -195,6 +198,12 @@ namespace ServerManagerTool.Lib.ViewModel
public void UpdateForLocalization() public void UpdateForLocalization()
{ {
} }
public void Update(bool recursive = true)
{
foreach (var npcSpawn in this)
npcSpawn.Update(recursive);
}
} }
public class NPCSpawnSettings : DependencyObject, IEnumerable<NPCSpawnEntrySettings> public class NPCSpawnSettings : DependencyObject, IEnumerable<NPCSpawnEntrySettings>
@ -280,6 +289,26 @@ namespace ServerManagerTool.Lib.ViewModel
{ {
return NPCSpawnEntrySettings.GetEnumerator(); return NPCSpawnEntrySettings.GetEnumerator();
} }
public bool IsViewValid => !string.IsNullOrWhiteSpace(NPCSpawnEntriesContainerClassString) && (NPCSpawnEntrySettings?.Count ?? 0) > 0;
public static readonly DependencyProperty ValidStatusProperty = DependencyProperty.Register(nameof(ValidStatus), typeof(string), typeof(NPCSpawnSettings), new PropertyMetadata("N"));
public string ValidStatus
{
get { return (string)GetValue(ValidStatusProperty); }
set { SetValue(ValidStatusProperty, value); }
}
public void Update(bool recursive = true)
{
if (recursive && NPCSpawnEntrySettings != null)
{
foreach (var itemSet in NPCSpawnEntrySettings)
itemSet.Update();
}
ValidStatus = IsViewValid ? (NPCSpawnEntrySettings.Any(i => i.ValidStatus == "N") ? "N" : (NPCSpawnEntrySettings.Any(i => i.ValidStatus == "W") ? "W" : "Y")) : "N";
}
} }
public class NPCSpawnEntrySettings : DependencyObject public class NPCSpawnEntrySettings : DependencyObject
@ -315,5 +344,17 @@ namespace ServerManagerTool.Lib.ViewModel
public string DisplayName => GameData.FriendlyCreatureNameForClass(NPCClassString); public string DisplayName => GameData.FriendlyCreatureNameForClass(NPCClassString);
public bool IsValid => !string.IsNullOrWhiteSpace(NPCClassString); public bool IsValid => !string.IsNullOrWhiteSpace(NPCClassString);
public static readonly DependencyProperty ValidStatusProperty = DependencyProperty.Register(nameof(ValidStatus), typeof(string), typeof(NPCSpawnEntrySettings), new PropertyMetadata("N"));
public string ValidStatus
{
get { return (string)GetValue(ValidStatusProperty); }
set { SetValue(ValidStatusProperty, value); }
}
public void Update()
{
ValidStatus = IsValid ? (GameData.HasCreatureForClass(NPCClassString) ? "Y" : "W") : "N";
}
} }
} }

View file

@ -5212,7 +5212,7 @@
</StackPanel> </StackPanel>
</GroupBox.Header> </GroupBox.Header>
<DataGrid Name="NPCSpawnSettingsGrid" ItemsSource="{Binding NPCSpawnSettings}" SelectedItem="{Binding Path=SelectedNPCSpawnSetting, ElementName=SettingsControl, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, NotifyOnSourceUpdated=True}" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False" CanUserSortColumns="true" SelectionMode="Single" CanUserResizeColumns="False" CanUserResizeRows="False" RowHeaderWidth="25"> <DataGrid Name="NPCSpawnSettingsGrid" ItemsSource="{Binding NPCSpawnSettings}" SelectedItem="{Binding Path=SelectedNPCSpawnSetting, ElementName=SettingsControl, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, NotifyOnSourceUpdated=True}" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False" CanUserSortColumns="true" SelectionMode="Single" CanUserResizeColumns="False" CanUserResizeRows="False" RowHeaderWidth="25" SourceUpdated="NPCSpawnSettingsGrids_SourceUpdated">
<DataGrid.Resources> <DataGrid.Resources>
<Style TargetType="{x:Type DataGridRow}"> <Style TargetType="{x:Type DataGridRow}">
<Style.Resources> <Style.Resources>
@ -5229,6 +5229,28 @@
<SolidColorBrush Color="#FFB4B4B4"/> <SolidColorBrush Color="#FFB4B4B4"/>
</DataGrid.VerticalGridLinesBrush> </DataGrid.VerticalGridLinesBrush>
<DataGrid.RowHeaderTemplate>
<DataTemplate>
<Image HorizontalAlignment="Center" VerticalAlignment="Center" Width="16" Height="16">
<Image.Style>
<Style TargetType="{x:Type Image}">
<Style.Triggers>
<DataTrigger Binding="{Binding DataContext.ValidStatus, RelativeSource={RelativeSource AncestorType=DataGridRow}}" Value="Y">
<Setter Property="Source" Value="{com:Icon Path=/Ark Server Manager;component/Art/StatusGood.ico,Size=32}"/>
</DataTrigger>
<DataTrigger Binding="{Binding DataContext.ValidStatus, RelativeSource={RelativeSource AncestorType=DataGridRow}}" Value="N">
<Setter Property="Source" Value="{com:Icon Path=/Ark Server Manager;component/Art/StatusBad.ico,Size=32}"/>
</DataTrigger>
<DataTrigger Binding="{Binding DataContext.ValidStatus, RelativeSource={RelativeSource AncestorType=DataGridRow}}" Value="W">
<Setter Property="Source" Value="{com:Icon Path=/Ark Server Manager;component/Art/StatusWarning.ico,Size=32}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Image.Style>
</Image>
</DataTemplate>
</DataGrid.RowHeaderTemplate>
<DataGrid.Columns> <DataGrid.Columns>
<DataGridTemplateColumn Width="1*" CanUserSort="True"> <DataGridTemplateColumn Width="1*" CanUserSort="True">
<DataGridTemplateColumn.Header> <DataGridTemplateColumn.Header>
@ -5236,7 +5258,7 @@
</DataGridTemplateColumn.Header> </DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate> <DataGridTemplateColumn.CellTemplate>
<DataTemplate> <DataTemplate>
<ComboBox IsReadOnly="True" IsEditable="True" ItemsSource="{Binding Source={StaticResource NPCSpawnContainerTypes}}" Text="{Binding ContainerType, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" PreviewMouseWheel="ComboBox_PreviewMouseWheel"/> <ComboBox IsReadOnly="True" IsEditable="True" ItemsSource="{Binding Source={StaticResource NPCSpawnContainerTypes}}" Text="{Binding ContainerType, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, NotifyOnSourceUpdated=True}" PreviewMouseWheel="ComboBox_PreviewMouseWheel"/>
</DataTemplate> </DataTemplate>
</DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn> </DataGridTemplateColumn>
@ -5246,7 +5268,7 @@
</DataGridTemplateColumn.Header> </DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate> <DataGridTemplateColumn.CellTemplate>
<DataTemplate> <DataTemplate>
<ComboBox IsEditable="True" ItemsSource="{Binding BaseMapSpawnerList, ElementName=SettingsControl}" SelectedValue="{Binding NPCSpawnEntriesContainerClassString, Mode=TwoWay, UpdateSourceTrigger=Explicit}" SelectedValuePath="ValueMember" DisplayMemberPath="DisplayMember" LostFocus="ComboBoxItemList_LostFocus" PreviewMouseWheel="ComboBox_PreviewMouseWheel"/> <ComboBox IsEditable="True" ItemsSource="{Binding BaseMapSpawnerList, ElementName=SettingsControl}" SelectedValue="{Binding NPCSpawnEntriesContainerClassString, Mode=TwoWay, UpdateSourceTrigger=Explicit, NotifyOnSourceUpdated=True}" SelectedValuePath="ValueMember" DisplayMemberPath="DisplayMember" LostFocus="ComboBoxItemList_LostFocus" PreviewMouseWheel="ComboBox_PreviewMouseWheel"/>
</DataTemplate> </DataTemplate>
</DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn> </DataGridTemplateColumn>
@ -5287,7 +5309,7 @@
</StackPanel> </StackPanel>
</GroupBox.Header> </GroupBox.Header>
<DataGrid Name="NPCSpawnEntrySettingsGrid" ItemsSource="{Binding Path=SelectedNPCSpawnSetting.NPCSpawnEntrySettings, ElementName=SettingsControl}" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False" CanUserSortColumns="true" SelectionMode="Single" CanUserResizeColumns="False" CanUserResizeRows="False" RowHeaderWidth="25"> <DataGrid Name="NPCSpawnEntrySettingsGrid" ItemsSource="{Binding Path=SelectedNPCSpawnSetting.NPCSpawnEntrySettings, ElementName=SettingsControl}" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False" CanUserSortColumns="true" SelectionMode="Single" CanUserResizeColumns="False" CanUserResizeRows="False" RowHeaderWidth="25" SourceUpdated="NPCSpawnSettingsGrids_SourceUpdated">
<DataGrid.Resources> <DataGrid.Resources>
<clib:BindingProxy x:Key="proxySelectedNPCSpawnSetting" Data="{Binding Path=SelectedNPCSpawnSetting, ElementName=SettingsControl}" /> <clib:BindingProxy x:Key="proxySelectedNPCSpawnSetting" Data="{Binding Path=SelectedNPCSpawnSetting, ElementName=SettingsControl}" />
<Style TargetType="{x:Type DataGridRow}"> <Style TargetType="{x:Type DataGridRow}">
@ -5305,6 +5327,28 @@
<SolidColorBrush Color="#FFB4B4B4"/> <SolidColorBrush Color="#FFB4B4B4"/>
</DataGrid.VerticalGridLinesBrush> </DataGrid.VerticalGridLinesBrush>
<DataGrid.RowHeaderTemplate>
<DataTemplate>
<Image HorizontalAlignment="Center" VerticalAlignment="Center" Width="16" Height="16">
<Image.Style>
<Style TargetType="{x:Type Image}">
<Style.Triggers>
<DataTrigger Binding="{Binding DataContext.ValidStatus, RelativeSource={RelativeSource AncestorType=DataGridRow}}" Value="Y">
<Setter Property="Source" Value="{com:Icon Path=/Ark Server Manager;component/Art/StatusGood.ico,Size=32}"/>
</DataTrigger>
<DataTrigger Binding="{Binding DataContext.ValidStatus, RelativeSource={RelativeSource AncestorType=DataGridRow}}" Value="N">
<Setter Property="Source" Value="{com:Icon Path=/Ark Server Manager;component/Art/StatusBad.ico,Size=32}"/>
</DataTrigger>
<DataTrigger Binding="{Binding DataContext.ValidStatus, RelativeSource={RelativeSource AncestorType=DataGridRow}}" Value="W">
<Setter Property="Source" Value="{com:Icon Path=/Ark Server Manager;component/Art/StatusWarning.ico,Size=32}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Image.Style>
</Image>
</DataTemplate>
</DataGrid.RowHeaderTemplate>
<DataGrid.Columns> <DataGrid.Columns>
<DataGridTextColumn Width="1*" Binding="{Binding AnEntryName}" Visibility="{Binding Data.ShowEntryNameColumn, Converter={StaticResource BooleanToVisibilityConverter}, Source={StaticResource proxySelectedNPCSpawnSetting}}"> <DataGridTextColumn Width="1*" Binding="{Binding AnEntryName}" Visibility="{Binding Data.ShowEntryNameColumn, Converter={StaticResource BooleanToVisibilityConverter}, Source={StaticResource proxySelectedNPCSpawnSetting}}">
<DataGridTextColumn.Header> <DataGridTextColumn.Header>
@ -5318,7 +5362,7 @@
</DataGridTemplateColumn.Header> </DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate> <DataGridTemplateColumn.CellTemplate>
<DataTemplate> <DataTemplate>
<ComboBox IsEditable="True" ItemsSource="{Binding BaseDinoList, ElementName=SettingsControl}" SelectedValue="{Binding NPCClassString, Mode=TwoWay, UpdateSourceTrigger=Explicit}" SelectedValuePath="ValueMember" DisplayMemberPath="DisplayMember" LostFocus="ComboBoxItemList_LostFocus" PreviewMouseWheel="ComboBox_PreviewMouseWheel"/> <ComboBox IsEditable="True" ItemsSource="{Binding BaseDinoList, ElementName=SettingsControl}" SelectedValue="{Binding NPCClassString, Mode=TwoWay, UpdateSourceTrigger=Explicit, NotifyOnSourceUpdated=True}" SelectedValuePath="ValueMember" DisplayMemberPath="DisplayMember" LostFocus="ComboBoxItemList_LostFocus" PreviewMouseWheel="ComboBox_PreviewMouseWheel"/>
</DataTemplate> </DataTemplate>
</DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn> </DataGridTemplateColumn>
@ -5947,7 +5991,7 @@
</StackPanel> </StackPanel>
</GroupBox.Header> </GroupBox.Header>
<DataGrid Name="PreventTransferOverrideGrid" ItemsSource="{Binding PreventTransferForClassNames}" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False" CanUserSortColumns="true" SelectionMode="Single" CanUserResizeRows="False" RowHeaderWidth="25"> <DataGrid Name="PreventTransferOverrideGrid" ItemsSource="{Binding PreventTransferForClassNames}" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False" CanUserSortColumns="true" SelectionMode="Single" CanUserResizeRows="False" RowHeaderWidth="25" SourceUpdated="PreventTransferOverrideGrids_SourceUpdated">
<DataGrid.Resources> <DataGrid.Resources>
<Style TargetType="{x:Type DataGridRow}"> <Style TargetType="{x:Type DataGridRow}">
<Style.Resources> <Style.Resources>
@ -5964,6 +6008,28 @@
<SolidColorBrush Color="#FFB4B4B4"/> <SolidColorBrush Color="#FFB4B4B4"/>
</DataGrid.VerticalGridLinesBrush> </DataGrid.VerticalGridLinesBrush>
<DataGrid.RowHeaderTemplate>
<DataTemplate>
<Image HorizontalAlignment="Center" VerticalAlignment="Center" Width="16" Height="16">
<Image.Style>
<Style TargetType="{x:Type Image}">
<Style.Triggers>
<DataTrigger Binding="{Binding DataContext.ValidStatus, RelativeSource={RelativeSource AncestorType=DataGridRow}}" Value="Y">
<Setter Property="Source" Value="{com:Icon Path=/Ark Server Manager;component/Art/StatusGood.ico,Size=32}"/>
</DataTrigger>
<DataTrigger Binding="{Binding DataContext.ValidStatus, RelativeSource={RelativeSource AncestorType=DataGridRow}}" Value="N">
<Setter Property="Source" Value="{com:Icon Path=/Ark Server Manager;component/Art/StatusBad.ico,Size=32}"/>
</DataTrigger>
<DataTrigger Binding="{Binding DataContext.ValidStatus, RelativeSource={RelativeSource AncestorType=DataGridRow}}" Value="W">
<Setter Property="Source" Value="{com:Icon Path=/Ark Server Manager;component/Art/StatusWarning.ico,Size=32}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Image.Style>
</Image>
</DataTemplate>
</DataGrid.RowHeaderTemplate>
<DataGrid.Columns> <DataGrid.Columns>
<DataGridTemplateColumn Width="2*" CanUserSort="True" SortMemberPath="DisplayName"> <DataGridTemplateColumn Width="2*" CanUserSort="True" SortMemberPath="DisplayName">
<DataGridTemplateColumn.Header> <DataGridTemplateColumn.Header>
@ -5971,7 +6037,7 @@
</DataGridTemplateColumn.Header> </DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate> <DataGridTemplateColumn.CellTemplate>
<DataTemplate> <DataTemplate>
<ComboBox IsEditable="True" ItemsSource="{Binding BaseDinoList, ElementName=SettingsControl}" SelectedValue="{Binding DinoClassString, Mode=TwoWay, UpdateSourceTrigger=Explicit}" SelectedValuePath="ValueMember" DisplayMemberPath="DisplayMember" LostFocus="ComboBoxItemList_LostFocus" PreviewMouseWheel="ComboBox_PreviewMouseWheel"/> <ComboBox IsEditable="True" ItemsSource="{Binding BaseDinoList, ElementName=SettingsControl}" SelectedValue="{Binding DinoClassString, Mode=TwoWay, UpdateSourceTrigger=Explicit, NotifyOnSourceUpdated=True}" SelectedValuePath="ValueMember" DisplayMemberPath="DisplayMember" LostFocus="ComboBoxItemList_LostFocus" PreviewMouseWheel="ComboBox_PreviewMouseWheel"/>
</DataTemplate> </DataTemplate>
</DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn> </DataGridTemplateColumn>

View file

@ -1319,6 +1319,16 @@ namespace ServerManagerTool
Settings.ConfigOverrideItemCraftingCosts.Update(); Settings.ConfigOverrideItemCraftingCosts.Update();
} }
private void PreventTransferOverrideGrids_SourceUpdated(object sender, DataTransferEventArgs e)
{
Settings.PreventTransferForClassNames.Update();
}
private void NPCSpawnSettingsGrids_SourceUpdated(object sender, DataTransferEventArgs e)
{
Settings.NPCSpawnSettings.Update();
}
#region Dinos #region Dinos
private void DinoCustomization_Reset(object sender, RoutedEventArgs e) private void DinoCustomization_Reset(object sender, RoutedEventArgs e)
{ {
@ -2895,6 +2905,7 @@ namespace ServerManagerTool
private void AddNPCSpawn_Click(object sender, RoutedEventArgs e) private void AddNPCSpawn_Click(object sender, RoutedEventArgs e)
{ {
Settings.NPCSpawnSettings.Add(new NPCSpawnSettings()); Settings.NPCSpawnSettings.Add(new NPCSpawnSettings());
Settings.NPCSpawnSettings.Update();
} }
private void AddNPCSpawnEntry_Click(object sender, RoutedEventArgs e) private void AddNPCSpawnEntry_Click(object sender, RoutedEventArgs e)
@ -2906,6 +2917,7 @@ namespace ServerManagerTool
} }
SelectedNPCSpawnSetting.NPCSpawnEntrySettings.Add(new NPCSpawnEntrySettings()); SelectedNPCSpawnSetting.NPCSpawnEntrySettings.Add(new NPCSpawnEntrySettings());
Settings.NPCSpawnSettings.Update();
} }
private void ClearNPCSpawn_Click(object sender, RoutedEventArgs e) private void ClearNPCSpawn_Click(object sender, RoutedEventArgs e)
@ -2915,6 +2927,7 @@ namespace ServerManagerTool
SelectedNPCSpawnSetting = null; SelectedNPCSpawnSetting = null;
Settings.NPCSpawnSettings.Clear(); Settings.NPCSpawnSettings.Clear();
Settings.NPCSpawnSettings.Update();
} }
private void ClearNPCSpawnEntry_Click(object sender, RoutedEventArgs e) private void ClearNPCSpawnEntry_Click(object sender, RoutedEventArgs e)
@ -2923,6 +2936,7 @@ namespace ServerManagerTool
return; return;
SelectedNPCSpawnSetting?.NPCSpawnEntrySettings.Clear(); SelectedNPCSpawnSetting?.NPCSpawnEntrySettings.Clear();
Settings.NPCSpawnSettings.Update();
} }
private void PasteNPCSpawn_Click(object sender, RoutedEventArgs e) private void PasteNPCSpawn_Click(object sender, RoutedEventArgs e)
@ -2973,6 +2987,7 @@ namespace ServerManagerTool
var item = ((NPCSpawnSettings)((Button)e.Source).DataContext); var item = ((NPCSpawnSettings)((Button)e.Source).DataContext);
Settings.NPCSpawnSettings.Remove(item); Settings.NPCSpawnSettings.Remove(item);
Settings.NPCSpawnSettings.Update();
} }
private void RemoveNPCSpawnEntry_Click(object sender, RoutedEventArgs e) private void RemoveNPCSpawnEntry_Click(object sender, RoutedEventArgs e)
@ -2985,6 +3000,7 @@ namespace ServerManagerTool
var item = ((NPCSpawnEntrySettings)((Button)e.Source).DataContext); var item = ((NPCSpawnEntrySettings)((Button)e.Source).DataContext);
SelectedNPCSpawnSetting.NPCSpawnEntrySettings.Remove(item); SelectedNPCSpawnSetting.NPCSpawnEntrySettings.Remove(item);
Settings.NPCSpawnSettings.Update();
} }
private void SaveNPCSpawns_Click(object sender, RoutedEventArgs e) private void SaveNPCSpawns_Click(object sender, RoutedEventArgs e)
@ -3007,12 +3023,12 @@ namespace ServerManagerTool
private void SaveNPCSpawn_Click(object sender, RoutedEventArgs e) private void SaveNPCSpawn_Click(object sender, RoutedEventArgs e)
{ {
Settings.NPCSpawnSettings.RenderToModel();
var item = ((NPCSpawnSettings)((Button)e.Source).DataContext); var item = ((NPCSpawnSettings)((Button)e.Source).DataContext);
if (item == null) if (item == null)
return; return;
Settings.NPCSpawnSettings.RenderToModel();
string iniName = null; string iniName = null;
string iniValue = null; string iniValue = null;
switch (item.ContainerType) switch (item.ContainerType)
@ -3362,7 +3378,7 @@ namespace ServerManagerTool
private void AddPreventTransferOverride_Click(object sender, RoutedEventArgs e) private void AddPreventTransferOverride_Click(object sender, RoutedEventArgs e)
{ {
Settings.PreventTransferForClassNames.Add(new PreventTransferOverride()); Settings.PreventTransferForClassNames.Add(new PreventTransferOverride());
Settings.PreventTransferForClassNames.IsEnabled = true; Settings.PreventTransferForClassNames.Update();
} }
private void ClearPreventTransferOverrides_Click(object sender, RoutedEventArgs e) private void ClearPreventTransferOverrides_Click(object sender, RoutedEventArgs e)
@ -3371,7 +3387,7 @@ namespace ServerManagerTool
return; return;
Settings.PreventTransferForClassNames.Clear(); Settings.PreventTransferForClassNames.Clear();
Settings.PreventTransferForClassNames.IsEnabled = false; Settings.PreventTransferForClassNames.Update();
} }
private void PastePreventTransferOverride_Click(object sender, RoutedEventArgs e) private void PastePreventTransferOverride_Click(object sender, RoutedEventArgs e)
@ -3422,7 +3438,7 @@ namespace ServerManagerTool
var item = ((PreventTransferOverride)((Button)e.Source).DataContext); var item = ((PreventTransferOverride)((Button)e.Source).DataContext);
Settings.PreventTransferForClassNames.Remove(item); Settings.PreventTransferForClassNames.Remove(item);
Settings.PreventTransferForClassNames.IsEnabled = Settings.PreventTransferForClassNames.Count > 0; Settings.PreventTransferForClassNames.Update();
} }
private void SavePreventTransferOverride_Click(object sender, RoutedEventArgs e) private void SavePreventTransferOverride_Click(object sender, RoutedEventArgs e)
@ -3447,6 +3463,8 @@ namespace ServerManagerTool
if (item == null) if (item == null)
return; return;
Settings.PreventTransferForClassNames.RenderToModel();
var iniName = Settings.PreventTransferForClassNames.IniCollectionKey; var iniName = Settings.PreventTransferForClassNames.IniCollectionKey;
var iniValue = $"{iniName}={item.ToINIValue()}"; var iniValue = $"{iniName}={item.ToINIValue()}";

View file

@ -26,6 +26,8 @@
<ul> <ul>
<li>Gamedata Files - changed the Fjordur official mod to the correct mod id.</li> <li>Gamedata Files - changed the Fjordur official mod to the correct mod id.</li>
<li>Crafting Override Grids - Added new icons to show Good (green), Warning (orange) or Bad (red). Warnings will show for resources not familiar with (raw class names, not loaded via gamedata files), Errors will show for empty resources.</li> <li>Crafting Override Grids - Added new icons to show Good (green), Warning (orange) or Bad (red). Warnings will show for resources not familiar with (raw class names, not loaded via gamedata files), Errors will show for empty resources.</li>
<li>Prevent Transfer Grids - Added new icons to show Good (green), Warning (orange) or Bad (red). Warnings will show for creatures not familiar with (raw class names, not loaded via gamedata files), Errors will show for missing creatures.</li>
<li>Map Spawner Grids - Added new icons to show Good (green), Warning (orange) or Bad (red). Warnings will show for spawners/creatures not familiar with (raw class names, not loaded via gamedata files), Errors will show for missing spawners/creatures.</li>
</ul> </ul>
</p> </p>
</div> </div>

View file

@ -19,7 +19,9 @@
<u style="font-size: .9em;">CHANGE</u> <u style="font-size: .9em;">CHANGE</u>
<br/> <br/>
<ul> <ul>
<li>Crafting Override Grids - Added new icons to show Good (green), Warning (orange) or Bad (red). Warnings will show for resources not familiar with (raw class names, not loaded via gamedata files), Errors will show for empty resources.</li> <li>Crafting Override Grids - Added new icons to show Good (green), Warning (orange) or Bad (red). Warnings will show for resources not familiar with (raw class names, not loaded via gamedata files), Errors will show for missing resources.</li>
<li>Prevent Transfer Grids - Added new icons to show Good (green), Warning (orange) or Bad (red). Warnings will show for creatures not familiar with (raw class names, not loaded via gamedata files), Errors will show for missing creatures.</li>
<li>Map Spawner Grids - Added new icons to show Good (green), Warning (orange) or Bad (red). Warnings will show for spawners/creatures not familiar with (raw class names, not loaded via gamedata files), Errors will show for missing spawners/creatures.</li>
</ul> </ul>
</p> </p>
</div> </div>