mirror of
https://git.srhtnin.garden/sarah/srhtnin.github.io.git
synced 2026-10-14 18:58:11 +02:00
Added farm economics upgrades and edited Garden UI to be a bit cleaner.
This commit is contained in:
1 parent
b0bc6ecc03
commit
cce44b1b0e
7 files changed
+673
-70
No files matched your search
@@ -717,6 +717,86 @@ function GetPlantDewPerHour(
|
||||
}
|
||||
|
||||
|
||||
function GetGardenEconomySummary(
|
||||
SaveData,
|
||||
Garden = SaveData?.Garden
|
||||
) {
|
||||
if (
|
||||
Garden === null ||
|
||||
Garden === undefined ||
|
||||
!Array.isArray(
|
||||
Garden.Plots
|
||||
)
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
let DewInvested = 0;
|
||||
let HarvestValue = 0;
|
||||
let NetProfit = 0;
|
||||
let DewPerHour = 0;
|
||||
|
||||
|
||||
for (
|
||||
const Plot
|
||||
of Garden.Plots
|
||||
) {
|
||||
if (Plot === null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const Plant =
|
||||
Plants[Plot.Plant];
|
||||
|
||||
if (Plant === undefined) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const Cost =
|
||||
GetPlantShopCost(
|
||||
SaveData,
|
||||
Plant.Id
|
||||
);
|
||||
|
||||
const Reward =
|
||||
GetPlantHarvestReward(
|
||||
SaveData,
|
||||
Plant.Id
|
||||
);
|
||||
|
||||
const PlantDewPerHour =
|
||||
GetPlantDewPerHour(
|
||||
SaveData,
|
||||
Plant.Id
|
||||
);
|
||||
|
||||
if (
|
||||
Cost === null ||
|
||||
Reward === null ||
|
||||
PlantDewPerHour === null
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
DewInvested += Cost;
|
||||
HarvestValue += Reward;
|
||||
NetProfit +=
|
||||
Reward - Cost;
|
||||
DewPerHour +=
|
||||
PlantDewPerHour;
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
DewInvested,
|
||||
HarvestValue,
|
||||
NetProfit,
|
||||
DewPerHour
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
function FormatDewPerHour(
|
||||
DewPerHour
|
||||
) {
|
||||
|
||||
Reference in new issue
Block a user