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
+56 -6
+56 -6
View File
@@ -111,11 +111,6 @@ function CreateShopSeedCard(
"ShopItemHeader"; "ShopItemHeader";
const Number =
document.createElement(
"span"
);
const Name = const Name =
document.createElement( document.createElement(
"h3" "h3"
@@ -156,7 +151,7 @@ function CreateShopSeedCard(
if ( if (
typeof Plant.Description === typeof Plant.Description ===
"string" && "string" &&
Plant.Description.length > 0 Plant.Description.length > 0
) { ) {
const Description = const Description =
@@ -173,6 +168,16 @@ function CreateShopSeedCard(
} }
Details.appendChild(
CreateShopStat(
"Growth time",
FormatShopGrowthTime(
Plant.GrowthTime
)
)
);
const Cost = const Cost =
GetPlantShopCost( GetPlantShopCost(
ShopSave, 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( function CreateShopStat(
Name, Name,
Value Value