mirror of
https://git.srhtnin.garden/sarah/srhtnin.github.io.git
synced 2026-10-14 18:58:11 +02:00
Added growthtime to shop plant card.
This commit is contained in:
1 parent
0729d9e402
commit
5c8d0c79cd
1 file changed
+55
-5
+55
-5
@@ -111,11 +111,6 @@ function CreateShopSeedCard(
|
|||||||
"ShopItemHeader";
|
"ShopItemHeader";
|
||||||
|
|
||||||
|
|
||||||
const Number =
|
|
||||||
document.createElement(
|
|
||||||
"span"
|
|
||||||
);
|
|
||||||
|
|
||||||
const Name =
|
const Name =
|
||||||
document.createElement(
|
document.createElement(
|
||||||
"h3"
|
"h3"
|
||||||
@@ -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
|
||||||
|
|||||||
Reference in new issue
Block a user