Added growthtime to shop plant card.

This commit is contained in:
sarah committed 2026-08-31 17:31:14 +02:00
1 parent 0729d9e402
commit 5c8d0c79cd
1 file changed
+55 -5
+55 -5
View File
@@ -111,11 +111,6 @@ function CreateShopSeedCard(
"ShopItemHeader";
const Number =
document.createElement(
"span"
);
const Name =
document.createElement(
"h3"
@@ -173,6 +168,16 @@ function CreateShopSeedCard(
}
Details.appendChild(
CreateShopStat(
"Growth time",
FormatShopGrowthTime(
Plant.GrowthTime
)
)
);
const Cost =
GetPlantShopCost(
ShopSave,
@@ -366,6 +371,51 @@ function CreateShopPlantVisual(
}
function FormatShopGrowthTime(
Milliseconds
) {
const TotalMinutes =
Math.max(
1,
Math.ceil(
Number(
Milliseconds
) /
60000
)
);
const Hours =
Math.floor(
TotalMinutes /
60
);
const Minutes =
TotalMinutes %
60;
if (
Hours > 0 &&
Minutes > 0
) {
return (
Hours +
"h " +
Minutes +
"m"
);
}
if (Hours > 0) {
return Hours + "h";
}
return Minutes + "m";
}
function CreateShopStat(
Name,
Value