Browse Source

fix(BuildCalc) Immortal filters

main
Jonathan McCaffrey 4 years ago
parent
commit
231ce16dd6
  1. 8
      IGP/Pages/BuildCalculator/Parts/FilterComponent.razor
  2. 13
      IGP/Pages/BuildCalculator/Parts/HotkeyViewerComponent.razor
  3. 21
      Model/Entity/Data/DATA.cs
  4. 2
      Model/Entity/EntityModel.cs
  5. 7
      Model/Entity/Types/ImmortalType.cs
  6. 4
      Services/Immortal/BuildOrderService.cs
  7. 9
      Services/Immortal/ImmortalSelectionService.cs
  8. 14
      Services/Immortal/KeyService.cs
  9. 6
      Services/Immortal/MemoryTesterService.cs
  10. 13
      Services/Immortal/TimingService.cs
  11. 4
      Services/Website/NavigationService.cs

8
IGP/Pages/BuildCalculator/Parts/FilterComponent.razor

@ -14,13 +14,13 @@
<ChildContent>
@if (FilterService.GetFactionType() == FactionType.QRath)
{
<option value="@ImmortalType.Orzum" selected>Orzum</option>
<option value="@ImmortalType.Ajari">Ajari</option>
<option value="@DataType.IMMORTAL_Orzum" selected>Orzum</option>
<option value="@DataType.IMMORTAL_Ajari">Ajari</option>
}
@if (FilterService.GetFactionType() == FactionType.Aru)
{
<option value="@ImmortalType.Mala" selected>Mala</option>
<option value="@ImmortalType.Xol">Xol</option>
<option value="@DataType.IMMORTAL_Mala" selected>Mala</option>
<option value="@DataType.IMMORTAL_Xol">Xol</option>
}
</ChildContent>
</FormSelectComponent>

13
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;

21
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,

2
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))!)!;
}

7
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";
}

4
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<int, List<EntityModel>> StartedOrders => buildOrder.StartedOrders;
public Dictionary<int, List<EntityModel>> CompletedOrders => buildOrder.CompletedOrders;
public Dictionary<string, int> UniqueCompletedTimes => buildOrder.UniqueCompletedTimes;
@ -322,8 +324,6 @@ public class BuildOrderService : IBuildOrderService
return true;
}
private event Action OnChange = null!;
private void NotifyDataChanged()
{
OnChange?.Invoke();

9
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;

14
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;
}
}

6
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);
}

13
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;
}
}

4
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();
}

Loading…
Cancel
Save