diff --git a/IGP/Pages/BuildCalculator/Parts/FilterComponent.razor b/IGP/Pages/BuildCalculator/Parts/FilterComponent.razor index e1a4d21..d25c8d3 100644 --- a/IGP/Pages/BuildCalculator/Parts/FilterComponent.razor +++ b/IGP/Pages/BuildCalculator/Parts/FilterComponent.razor @@ -14,13 +14,13 @@ @if (FilterService.GetFactionType() == FactionType.QRath) { - - + + } @if (FilterService.GetFactionType() == FactionType.Aru) { - - + + } diff --git a/IGP/Pages/BuildCalculator/Parts/HotkeyViewerComponent.razor b/IGP/Pages/BuildCalculator/Parts/HotkeyViewerComponent.razor index 618ef08..d2342d6 100644 --- a/IGP/Pages/BuildCalculator/Parts/HotkeyViewerComponent.razor +++ b/IGP/Pages/BuildCalculator/Parts/HotkeyViewerComponent.razor @@ -1,5 +1,6 @@ @inject IJSRuntime jsRuntime; +@using System.Diagnostics @implements IDisposable @inject IKeyService keyService @inject IBuildOrderService buildOrderService @@ -176,7 +177,9 @@ // Move to Filter Service bool InvalidVanguard(EntityModel entity) { - if (entity.VanguardAdded() != null && entity.VanguardAdded()?.ImmortalId != filterService.GetImmortalType() && filterService.GetImmortalType() != ImmortalType.Any) + if (entity.VanguardAdded() != null + && entity.VanguardAdded()?.ImmortalId != filterService.GetImmortalType() + && filterService.GetImmortalType() != ImmortalType.Any) { return true; } @@ -189,19 +192,13 @@ { if (entity.Replaceds().Count > 0) { - var isReplaced = false; foreach (var replaced in entity.Replaceds()) { if (filterService.GetImmortalType() == replaced.ImmortalId) { - isReplaced = true; - break; + return true; } } - if (isReplaced) - { - return true; - } } return false; diff --git a/Model/Entity/Data/DATA.cs b/Model/Entity/Data/DATA.cs index 0385104..35c40bf 100644 --- a/Model/Entity/Data/DATA.cs +++ b/Model/Entity/Data/DATA.cs @@ -229,7 +229,7 @@ public class DATA { DataType.IMMORTAL_Mala, new EntityModel(DataType.IMMORTAL_Mala, EntityType.Immortal) - .AddPart(new EntityInfoModel { Name = ImmortalType.Mala }) + .AddPart(new EntityInfoModel { Name = "Mala" }) .AddPart(new EntityFactionModel { Faction = FactionType.Aru }) .AddPart(new EntityHarvestModel { @@ -248,7 +248,7 @@ public class DATA { DataType.IMMORTAL_Xol, new EntityModel(DataType.IMMORTAL_Xol, EntityType.Immortal) - .AddPart(new EntityInfoModel { Name = ImmortalType.Xol }) + .AddPart(new EntityInfoModel { Name = "Xol" }) .AddPart(new EntityFactionModel { Faction = FactionType.Aru }) .AddPart(new EntityHarvestModel { @@ -269,7 +269,7 @@ public class DATA { DataType.IMMORTAL_Ajari, new EntityModel(DataType.IMMORTAL_Ajari, EntityType.Immortal) - .AddPart(new EntityInfoModel { Name = ImmortalType.Ajari }) + .AddPart(new EntityInfoModel { Name = "Ajari" }) .AddPart(new EntityFactionModel { Faction = FactionType.QRath }) .AddPart(new EntityHarvestModel { @@ -287,7 +287,7 @@ public class DATA { DataType.IMMORTAL_Orzum, new EntityModel(DataType.IMMORTAL_Orzum, EntityType.Immortal) - .AddPart(new EntityInfoModel { Name = ImmortalType.Orzum }) + .AddPart(new EntityInfoModel { Name = "Orzum" }) .AddPart(new EntityFactionModel { Faction = FactionType.QRath }) .AddPart(new EntityHarvestModel { @@ -1440,6 +1440,9 @@ public class DATA Id = DataType.BUILDING_Reliquary, Requirement = RequirementType.Production_Building }) + .AddPart(new EntityVanguardReplacedModel + { ImmortalId = DataType.IMMORTAL_Orzum, ReplacedById = DataType.UPGRADE_FaithCastBlades }) + }, { @@ -1476,6 +1479,9 @@ public class DATA Id = DataType.BUILDING_EyeOfAros, Requirement = RequirementType.Production_Building }) + .AddPart(new EntityVanguardReplacedModel + { ImmortalId = DataType.IMMORTAL_Orzum, ReplacedById = DataType.UPGRADE_IconOfKhastEem }) + }, @@ -1490,6 +1496,7 @@ public class DATA .AddPart(new EntityHotkeyModel { Hotkey = "Q", HotkeyGroup = "TAB" }) .AddPart(new EntityFactionModel { Faction = FactionType.QRath }) .AddPart(new EntityProductionModel { Alloy = 50, Ether = 100, BuildTime = 60 }) + .AddPart(new EntityRequirementModel() { Id = DataType.BUILDING_Reliquary, Requirement = RequirementType.Research_Building}) .AddPart(new EntityVanguardAddedModel { ReplaceId = DataType.UPGRADE_GreavesOfAhqar, ImmortalId = DataType.IMMORTAL_Orzum }) @@ -1618,6 +1625,9 @@ public class DATA Description = "Unlocks Offering" }) .AddPart(new EntityHotkeyModel { Hotkey = "W", HotkeyGroup = "TAB" }) .AddPart(new EntityFactionModel { Faction = FactionType.Aru }) + .AddPart(new EntityVanguardReplacedModel + { ImmortalId = DataType.IMMORTAL_Xol, ReplacedById = DataType.UPGRADE_Stalk }) + .AddPart(new EntityRequirementModel { Id = DataType.BUILDING_AltarOfTheWorthy, @@ -1637,6 +1647,9 @@ public class DATA { Name = "Blood Mother's Fevor", Descriptive = DescriptiveType.Upgrade }) .AddPart(new EntityHotkeyModel { Hotkey = "V", HotkeyGroup = "TAB" }) .AddPart(new EntityFactionModel { Faction = FactionType.Aru }) + .AddPart(new EntityVanguardReplacedModel + { ImmortalId = DataType.IMMORTAL_Xol, ReplacedById = DataType.UPGRADE_Ambush }) + .AddPart(new EntityRequirementModel { Id = DataType.BUILDING_AmberWomb, diff --git a/Model/Entity/EntityModel.cs b/Model/Entity/EntityModel.cs index bf8b3e9..44990ea 100644 --- a/Model/Entity/EntityModel.cs +++ b/Model/Entity/EntityModel.cs @@ -216,7 +216,7 @@ public class EntityModel } - public EntityVanguardAddedModel VanguardAdded() + public EntityVanguardAddedModel? VanguardAdded() { return ((EntityVanguardAddedModel)EntityParts.Find(x => x.GetType() == typeof(EntityVanguardAddedModel))!)!; } diff --git a/Model/Entity/Types/ImmortalType.cs b/Model/Entity/Types/ImmortalType.cs index 9a49545..e6cfa00 100644 --- a/Model/Entity/Types/ImmortalType.cs +++ b/Model/Entity/Types/ImmortalType.cs @@ -3,12 +3,5 @@ public static class ImmortalType { public static string None = "None"; - public static string Any = "Any"; - - public static string Orzum = "Orzum"; - public static string Ajari = "Ajari"; - - public static string Mala = "Mala"; - public static string Xol = "Xol"; } \ No newline at end of file diff --git a/Services/Immortal/BuildOrderService.cs b/Services/Immortal/BuildOrderService.cs index b81fad3..2a61120 100644 --- a/Services/Immortal/BuildOrderService.cs +++ b/Services/Immortal/BuildOrderService.cs @@ -16,6 +16,8 @@ public class BuildOrderService : IBuildOrderService private readonly int HumanMicro = 2; private int lastInterval; + private event Action OnChange = null!; + public Dictionary> StartedOrders => buildOrder.StartedOrders; public Dictionary> CompletedOrders => buildOrder.CompletedOrders; public Dictionary UniqueCompletedTimes => buildOrder.UniqueCompletedTimes; @@ -322,8 +324,6 @@ public class BuildOrderService : IBuildOrderService return true; } - private event Action OnChange = null!; - private void NotifyDataChanged() { OnChange?.Invoke(); diff --git a/Services/Immortal/ImmortalSelectionService.cs b/Services/Immortal/ImmortalSelectionService.cs index 38b8913..e3fee7d 100644 --- a/Services/Immortal/ImmortalSelectionService.cs +++ b/Services/Immortal/ImmortalSelectionService.cs @@ -1,10 +1,11 @@ -using Model.Types; +using Model.Entity.Data; +using Model.Types; namespace Services.Immortal; public class ImmortalSelectionService : IImmortalSelectionService { private string _selectedFaction = FactionType.QRath; - private string _selectedImmortal = ImmortalType.Orzum; + private string _selectedImmortal = DataType.IMMORTAL_Orzum; public void Subscribe(Action action) { OnChange += action; @@ -26,9 +27,9 @@ public class ImmortalSelectionService : IImmortalSelectionService { if (_selectedFaction == factionType) return false; _selectedFaction = factionType; - if (_selectedFaction == FactionType.QRath) _selectedImmortal = ImmortalType.Orzum; + if (_selectedFaction == FactionType.QRath) _selectedImmortal = DataType.IMMORTAL_Orzum; - if (_selectedFaction == FactionType.Aru) _selectedImmortal = ImmortalType.Mala; + if (_selectedFaction == FactionType.Aru) _selectedImmortal = DataType.IMMORTAL_Mala; NotifyDataChanged(); return true; diff --git a/Services/Immortal/KeyService.cs b/Services/Immortal/KeyService.cs index 03334eb..378087d 100644 --- a/Services/Immortal/KeyService.cs +++ b/Services/Immortal/KeyService.cs @@ -7,13 +7,16 @@ public class KeyService : IKeyService { private string? _hotkey; private string _hotkeyGroup = "C"; private bool _isHoldingSpace; + + private event Action? OnChange; + public void Subscribe(Action? action) { - _onChange += action; + OnChange += action; } public void Unsubscribe(Action? action) { - _onChange -= action; + OnChange -= action; } public bool AddPressedKey(string key) { @@ -82,13 +85,8 @@ public class KeyService : IKeyService { return _hotkeyGroup; } - private event Action? _onChange; - private void NotifyDataChanged() { - _onChange?.Invoke(); + OnChange?.Invoke(); } - public Action? OnChange() { - return _onChange; - } } \ No newline at end of file diff --git a/Services/Immortal/MemoryTesterService.cs b/Services/Immortal/MemoryTesterService.cs index 2b3397d..39a1ddf 100644 --- a/Services/Immortal/MemoryTesterService.cs +++ b/Services/Immortal/MemoryTesterService.cs @@ -17,6 +17,10 @@ public class MemoryTesterService : IMemoryTesterService { private readonly Random random = new(); + + private event MemoryAction OnChange = null!; + + public void Subscribe(MemoryAction action) { OnChange += action; } @@ -88,8 +92,6 @@ public class MemoryTesterService : IMemoryTesterService { //public delegate void MemoryAction(MemoryTesterActions memoryAction); - private event MemoryAction OnChange = null!; - private void NotifyDataChanged(MemoryTesterEvent memoryAction) { OnChange?.Invoke(memoryAction); } diff --git a/Services/Immortal/TimingService.cs b/Services/Immortal/TimingService.cs index 4ee7884..a7738cb 100644 --- a/Services/Immortal/TimingService.cs +++ b/Services/Immortal/TimingService.cs @@ -3,12 +3,14 @@ public class TimingService : ITimingService { private int _timing = 1500; + private event Action? OnChange; + public void Subscribe(Action? action) { - _onChange += action; + OnChange += action; } public void Unsubscribe(Action? action) { - _onChange -= action; + OnChange -= action; } public int GetTiming() { @@ -22,13 +24,8 @@ public class TimingService : ITimingService { } } - private event Action? _onChange; - private void NotifyDataChanged() { - _onChange?.Invoke(); + OnChange?.Invoke(); } - public Action? OnChange() { - return _onChange; - } } \ No newline at end of file diff --git a/Services/Website/NavigationService.cs b/Services/Website/NavigationService.cs index 6e6416a..e5abce5 100644 --- a/Services/Website/NavigationService.cs +++ b/Services/Website/NavigationService.cs @@ -14,6 +14,8 @@ public class NavigationService : INavigationService { private int webPageType; private int webSectionType; + private event Action OnChange = null!; + public void Subscribe(Action action) { @@ -98,8 +100,6 @@ public class NavigationService : INavigationService { return renderType; } - private event Action OnChange = null!; - private void NotifyDataChanged() { OnChange?.Invoke(); }