Fixed exploit in price calculation for column and rows.

This commit is contained in:
sarah committed 2026-09-02 21:54:36 +02:00
1 parent 5fbc84d1b7
commit 23cc94dc69
1 file changed
+24 -18
+24 -18
View File
@@ -4,8 +4,20 @@ const GardenExpansionBaseCost = 1000;
function GetGardenColumnUpgradeCost( function GetGardenColumnUpgradeCost(
SaveData SaveData
) { ) {
return CalculateGardenExpansionCost( const GardenWidth =
SaveData.Garden.Height SaveData.Garden.Width;
const GardenHeight =
SaveData.Garden.Height;
return Math.round(
GardenExpansionBaseCost *
GardenHeight *
(
1 +
GardenHeight / 10 +
(GardenWidth - 3) / 10
)
); );
} }
@@ -13,26 +25,20 @@ function GetGardenColumnUpgradeCost(
function GetGardenRowUpgradeCost( function GetGardenRowUpgradeCost(
SaveData SaveData
) { ) {
return CalculateGardenExpansionCost( const GardenWidth =
SaveData.Garden.Width SaveData.Garden.Width;
);
}
const GardenHeight =
function CalculateGardenExpansionCost( SaveData.Garden.Height;
AddedPlots
) {
const PlotCount = Math.max(
1,
Math.floor(
Number(AddedPlots) || 1
)
);
return Math.round( return Math.round(
GardenExpansionBaseCost * GardenExpansionBaseCost *
PlotCount * GardenWidth *
(1 + PlotCount / 10) (
1 +
GardenWidth / 10 +
(GardenHeight - 3) / 10
)
); );
} }