feat(BuildCalc) Add +income to calculator info
This commit is contained in:
@@ -23,6 +23,8 @@
|
||||
<Title>Work In Progress and Not Fully Tested</Title>
|
||||
<Message>
|
||||
Build Calculator hasn't been thoroughly tested. Bugs and inaccurate results assumed.
|
||||
<br/>
|
||||
Currently not considering running out of alloy and ether to harvest.
|
||||
</Message>
|
||||
</AlertComponent>
|
||||
|
||||
|
||||
@@ -7,14 +7,14 @@
|
||||
|
||||
<div class="bankContainer">
|
||||
<FormDisplayComponent Label="Time">
|
||||
<Display>@BuildOrderService.GetLastRequestInterval() | T @Interval.ToTime(BuildOrderService.GetLastRequestInterval())</Display>
|
||||
<Display>@(BuildOrderService.GetLastRequestInterval() + 1) | T @Interval.ToTime(BuildOrderService.GetLastRequestInterval() + 1)</Display>
|
||||
</FormDisplayComponent>
|
||||
<div class="bankRow">
|
||||
<FormDisplayComponent Label="Alloy">
|
||||
<Display>@_economy.Alloy</Display>
|
||||
<Display>@_economy.Alloy +@_economy.AlloyIncome</Display>
|
||||
</FormDisplayComponent>
|
||||
<FormDisplayComponent Label="Ether">
|
||||
<Display>@_economy.Ether</Display>
|
||||
<Display>@Math.Round(_economy.Ether) +@Math.Round(_economy.EtherIncome)</Display>
|
||||
</FormDisplayComponent>
|
||||
</div>
|
||||
<div class="bankRow">
|
||||
@@ -77,6 +77,9 @@
|
||||
{
|
||||
base.OnInitialized();
|
||||
BuildOrderService.Subscribe(OnBuildOrderChanged);
|
||||
|
||||
|
||||
_economy = EconomyService.GetEconomy(BuildOrderService.GetLastRequestInterval() + 1);
|
||||
}
|
||||
|
||||
protected override bool ShouldRender()
|
||||
@@ -102,7 +105,7 @@
|
||||
|
||||
void OnBuildOrderChanged()
|
||||
{
|
||||
_economy = EconomyService.GetEconomy(BuildOrderService.GetLastRequestInterval());
|
||||
_economy = EconomyService.GetEconomy(BuildOrderService.GetLastRequestInterval() + 1);
|
||||
|
||||
var ordersOverTime = BuildOrderService.GetOrders();
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
[{"Key":"GamePatch","Value":"v0.0.6.9553a"},{"Key":"LastUpdated","Value":"May 02, 2022"}]
|
||||
[{"Key":"GamePatch","Value":"v0.0.6.9553a"},{"Key":"LastUpdated","Value":"May 03, 2022"}]
|
||||
@@ -7,7 +7,9 @@ public class EconomyModel
|
||||
{
|
||||
public int Interval { get; set; } = 0;
|
||||
public float Alloy { get; set; } = 0;
|
||||
public float AlloyIncome { get; set; } = 0;
|
||||
public float Ether { get; set; } = 0;
|
||||
public float EtherIncome { get; set; } = 0;
|
||||
public float Pyre { get; set; } = 0;
|
||||
public int Supply { get; set; } = 0;
|
||||
public int WorkerCount { get; set; } = 6;
|
||||
|
||||
@@ -173,6 +173,8 @@ public class EconomyService : IEconomyService
|
||||
{
|
||||
var usedWorkers = Math.Min(harvester.Slots, freeWorkers);
|
||||
economyAtSecond.Alloy += harvester.HarvestedPerInterval * usedWorkers;
|
||||
economyAtSecond.AlloyIncome += harvester.HarvestedPerInterval * usedWorkers;
|
||||
|
||||
freeWorkers -= usedWorkers;
|
||||
|
||||
if (usedWorkers < harvester.Slots) workersNeeded += 1;
|
||||
@@ -181,10 +183,16 @@ public class EconomyService : IEconomyService
|
||||
if (harvester.RequiresWorker == false)
|
||||
{
|
||||
if (harvester.Resource == ResourceType.Ether)
|
||||
{
|
||||
economyAtSecond.Ether += harvester.HarvestedPerInterval * harvester.Slots;
|
||||
economyAtSecond.EtherIncome += harvester.HarvestedPerInterval * harvester.Slots;
|
||||
}
|
||||
|
||||
if (harvester.Resource == ResourceType.Alloy)
|
||||
{
|
||||
economyAtSecond.Alloy += harvester.HarvestedPerInterval * harvester.Slots;
|
||||
economyAtSecond.AlloyIncome += harvester.HarvestedPerInterval * harvester.Slots;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user