From b24904d13c2b72f74e56fa66372f57246a6f1948 Mon Sep 17 00:00:00 2001 From: Brett Hewitson Date: Wed, 15 Jun 2022 23:33:49 +1000 Subject: [PATCH] Stack Size Grid - added good, warning and bad icons to the stack size grid. --- .../Lib/Model/StackSizeOverride.cs | 26 +++++++++++++++++++ .../UserControls/ServerSettingsControl.xaml | 26 +++++++++++++++++-- .../ServerSettingsControl.xaml.cs | 13 +++++++--- src/ARKServerManager/VersionFeed.xml | 1 + src/ARKServerManager/VersionFeedBeta.xml | 3 ++- 5 files changed, 63 insertions(+), 6 deletions(-) diff --git a/src/ARKServerManager/Lib/Model/StackSizeOverride.cs b/src/ARKServerManager/Lib/Model/StackSizeOverride.cs index f86af661..bea75121 100644 --- a/src/ARKServerManager/Lib/Model/StackSizeOverride.cs +++ b/src/ARKServerManager/Lib/Model/StackSizeOverride.cs @@ -27,6 +27,8 @@ namespace ServerManagerTool.Lib } } + Update(); + return errors; } @@ -45,6 +47,14 @@ namespace ServerManagerTool.Lib public void UpdateForLocalization() { } + + public void Update() + { + IsEnabled = this.Count > 0; + + foreach (var stackSize in this) + stackSize.Update(); + } } [DataContract] @@ -99,7 +109,10 @@ namespace ServerManagerTool.Lib public override void InitializeFromINIValue(string value) { if (string.IsNullOrWhiteSpace(value)) + { + Update(); return; + } var kvPair = value.Split(new[] { '=' }, 2); var kvValue = kvPair[1].Trim(' '); @@ -136,6 +149,19 @@ namespace ServerManagerTool.Lib { return IsValid; } + + public static readonly DependencyProperty ValidStatusProperty = DependencyProperty.Register(nameof(ValidStatus), typeof(string), typeof(StackSizeOverride), new PropertyMetadata("N")); + + public string ValidStatus + { + get { return (string)GetValue(ValidStatusProperty); } + set { SetValue(ValidStatusProperty, value); } + } + + public void Update() + { + ValidStatus = IsValid ? (GameData.HasItemForClass(ItemClassString) ? "Y" : "W") : "N"; + } } [DataContract] diff --git a/src/ARKServerManager/UserControls/ServerSettingsControl.xaml b/src/ARKServerManager/UserControls/ServerSettingsControl.xaml index 6b9b2991..ac59f474 100644 --- a/src/ARKServerManager/UserControls/ServerSettingsControl.xaml +++ b/src/ARKServerManager/UserControls/ServerSettingsControl.xaml @@ -5074,7 +5074,7 @@ - + + + + + + @@ -5098,7 +5120,7 @@ - + diff --git a/src/ARKServerManager/UserControls/ServerSettingsControl.xaml.cs b/src/ARKServerManager/UserControls/ServerSettingsControl.xaml.cs index ec94bcd0..7a79815a 100644 --- a/src/ARKServerManager/UserControls/ServerSettingsControl.xaml.cs +++ b/src/ARKServerManager/UserControls/ServerSettingsControl.xaml.cs @@ -1329,6 +1329,11 @@ namespace ServerManagerTool Settings.NPCSpawnSettings.Update(); } + private void StackSizeOverrideGrids_SourceUpdated(object sender, DataTransferEventArgs e) + { + Settings.ConfigOverrideItemMaxQuantity.Update(); + } + #region Dinos private void DinoCustomization_Reset(object sender, RoutedEventArgs e) { @@ -3277,7 +3282,7 @@ namespace ServerManagerTool private void AddStackSizeOverride_Click(object sender, RoutedEventArgs e) { Settings.ConfigOverrideItemMaxQuantity.Add(new StackSizeOverride()); - Settings.ConfigOverrideItemMaxQuantity.IsEnabled = true; + Settings.ConfigOverrideItemMaxQuantity.Update(); } private void ClearStackSizeOverrides_Click(object sender, RoutedEventArgs e) @@ -3286,7 +3291,7 @@ namespace ServerManagerTool return; Settings.ConfigOverrideItemMaxQuantity.Clear(); - Settings.ConfigOverrideItemMaxQuantity.IsEnabled = false; + Settings.ConfigOverrideItemMaxQuantity.Update(); } private void PasteStackSizeOverride_Click(object sender, RoutedEventArgs e) @@ -3337,7 +3342,7 @@ namespace ServerManagerTool var item = ((StackSizeOverride)((Button)e.Source).DataContext); Settings.ConfigOverrideItemMaxQuantity.Remove(item); - Settings.ConfigOverrideItemMaxQuantity.IsEnabled = Settings.ConfigOverrideItemMaxQuantity.Count > 0; + Settings.ConfigOverrideItemMaxQuantity.Update(); } private void SaveStackSizeOverride_Click(object sender, RoutedEventArgs e) @@ -3362,6 +3367,8 @@ namespace ServerManagerTool if (item == null) return; + Settings.ConfigOverrideItemMaxQuantity.RenderToModel(); + var iniName = Settings.ConfigOverrideItemMaxQuantity.IniCollectionKey; var iniValue = $"{iniName}={item.ToINIValue()}"; diff --git a/src/ARKServerManager/VersionFeed.xml b/src/ARKServerManager/VersionFeed.xml index 4456527a..00785477 100644 --- a/src/ARKServerManager/VersionFeed.xml +++ b/src/ARKServerManager/VersionFeed.xml @@ -28,6 +28,7 @@
  • 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.
  • 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.
  • 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.
  • +
  • Stack Size Grid - Added new icons to show Good (green), Warning (orange) or Bad (red). Warnings will show for items not familiar with (raw class names, not loaded via gamedata files), Errors will show for missing items.
  • diff --git a/src/ARKServerManager/VersionFeedBeta.xml b/src/ARKServerManager/VersionFeedBeta.xml index cc9eae86..e6f05ee3 100644 --- a/src/ARKServerManager/VersionFeedBeta.xml +++ b/src/ARKServerManager/VersionFeedBeta.xml @@ -19,9 +19,10 @@ CHANGE
      -
    • 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.
    • +
    • Crafting Override Grids - Added new icons to show Good (green), Warning (orange) or Bad (red). Warnings will show for items not familiar with (raw class names, not loaded via gamedata files), Errors will show for missing items.
    • 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.
    • 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.
    • +
    • Stack Size Grid - Added new icons to show Good (green), Warning (orange) or Bad (red). Warnings will show for items not familiar with (raw class names, not loaded via gamedata files), Errors will show for missing items.