mirror of
https://git.srhtnin.garden/sarah/srhtnin.github.io.git
synced 2026-10-14 18:58:11 +02:00
Fixed starting player setup (thanks, Eva)
Signed-off-by: Sarahtonin <[email protected]>
This commit is contained in:
1 parent
2fe5171450
commit
0b3905f92f
4 files changed
+63
-50
No files matched your search
@@ -138,7 +138,7 @@ function IsPlantAvailableInShop(
|
|||||||
Plant
|
Plant
|
||||||
) {
|
) {
|
||||||
if (
|
if (
|
||||||
Plant.Shop?.StartingPlant ===
|
Plant.Shop?.ShopPlant ===
|
||||||
true
|
true
|
||||||
) {
|
) {
|
||||||
return true;
|
return true;
|
||||||
@@ -226,7 +226,7 @@ function GetPlantShopCost(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
Plant.Shop?.StartingPlant ===
|
Plant.Shop?.ShopPlant ===
|
||||||
true
|
true
|
||||||
) {
|
) {
|
||||||
const BaseCost = Number(
|
const BaseCost = Number(
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ const Plants = {
|
|||||||
Effects: [],
|
Effects: [],
|
||||||
|
|
||||||
Shop: {
|
Shop: {
|
||||||
StartingPlant: true,
|
ShopPlant: true,
|
||||||
BaseCost: 10
|
BaseCost: 10
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -40,7 +40,7 @@ const Plants = {
|
|||||||
Effects: [],
|
Effects: [],
|
||||||
|
|
||||||
Shop: {
|
Shop: {
|
||||||
StartingPlant: false
|
ShopPlant: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -48,6 +48,9 @@ const Plants = {
|
|||||||
Id: 3,
|
Id: 3,
|
||||||
Name: "Blue Rose",
|
Name: "Blue Rose",
|
||||||
|
|
||||||
|
Description:
|
||||||
|
"An uncommon blue rose.",
|
||||||
|
|
||||||
Tags: [
|
Tags: [
|
||||||
"Rose",
|
"Rose",
|
||||||
"Flower",
|
"Flower",
|
||||||
@@ -59,7 +62,7 @@ const Plants = {
|
|||||||
Effects: [],
|
Effects: [],
|
||||||
|
|
||||||
Shop: {
|
Shop: {
|
||||||
StartingPlant: true,
|
ShopPlant: true,
|
||||||
BaseCost: 15
|
BaseCost: 15
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -68,10 +71,13 @@ const Plants = {
|
|||||||
Id: 4,
|
Id: 4,
|
||||||
Name: "Purple Rose",
|
Name: "Purple Rose",
|
||||||
|
|
||||||
|
Description:
|
||||||
|
"A rare purple rose.",
|
||||||
|
|
||||||
Tags: [
|
Tags: [
|
||||||
"Rose",
|
"Rose",
|
||||||
"Flower",
|
"Flower",
|
||||||
"Purple"
|
"Purple"
|
||||||
],
|
],
|
||||||
|
|
||||||
GrowthTime: 3600000,
|
GrowthTime: 3600000,
|
||||||
@@ -79,7 +85,7 @@ const Plants = {
|
|||||||
Effects: [],
|
Effects: [],
|
||||||
|
|
||||||
Shop: {
|
Shop: {
|
||||||
StartingPlant: false
|
ShopPlant: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
+44
-41
@@ -3,42 +3,40 @@ const LocalSaveName = "SarahtoninGarden";
|
|||||||
|
|
||||||
const ApiUrl = "https://api.srhtnin.garden";
|
const ApiUrl = "https://api.srhtnin.garden";
|
||||||
|
|
||||||
|
const StartingDew = 15;
|
||||||
|
|
||||||
|
const StartingSeeds = {
|
||||||
|
RedRose: 1
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
function CreateNewSave() {
|
function CreateNewSave() {
|
||||||
const StartingSeeds = {};
|
const SeedInventory = {};
|
||||||
const StartingPlants = [];
|
const StartingPlants = [];
|
||||||
|
|
||||||
if (
|
for (
|
||||||
typeof Plants !==
|
const [
|
||||||
"undefined"
|
PlantKey,
|
||||||
|
Amount
|
||||||
|
]
|
||||||
|
of Object.entries(
|
||||||
|
StartingSeeds
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
for (
|
const Plant =
|
||||||
const Plant
|
Plants[PlantKey];
|
||||||
of Object.values(Plants)
|
|
||||||
) {
|
|
||||||
if (
|
|
||||||
Plant.Shop
|
|
||||||
?.StartingPlant !==
|
|
||||||
true
|
|
||||||
) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
StartingSeeds[
|
if (Plant === undefined) {
|
||||||
String(Plant.Id)
|
continue;
|
||||||
] = 1;
|
|
||||||
|
|
||||||
StartingPlants.push(
|
|
||||||
Plant.Id
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
SeedInventory[
|
||||||
StartingPlants.length === 0
|
String(Plant.Id)
|
||||||
) {
|
] = Amount;
|
||||||
StartingSeeds["1"] = 1;
|
|
||||||
StartingPlants.push(1);
|
StartingPlants.push(
|
||||||
|
Plant.Id
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -48,7 +46,7 @@ function CreateNewSave() {
|
|||||||
LastSavedAt: Date.now(),
|
LastSavedAt: Date.now(),
|
||||||
|
|
||||||
Currency: {
|
Currency: {
|
||||||
Dew: 0
|
Dew: StartingDew
|
||||||
},
|
},
|
||||||
|
|
||||||
Statistics: {
|
Statistics: {
|
||||||
@@ -64,7 +62,7 @@ function CreateNewSave() {
|
|||||||
},
|
},
|
||||||
|
|
||||||
Inventory: {
|
Inventory: {
|
||||||
Seeds: StartingSeeds
|
Seeds: SeedInventory
|
||||||
},
|
},
|
||||||
|
|
||||||
Upgrades: {
|
Upgrades: {
|
||||||
@@ -340,20 +338,25 @@ function NormalizeSaveData(
|
|||||||
|
|
||||||
|
|
||||||
function GetStartingPlantDefinitions() {
|
function GetStartingPlantDefinitions() {
|
||||||
if (
|
const StartingPlants = [];
|
||||||
typeof Plants ===
|
|
||||||
"undefined"
|
for (
|
||||||
|
const PlantKey
|
||||||
|
of Object.keys(
|
||||||
|
StartingSeeds
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
return [];
|
const Plant =
|
||||||
|
Plants[PlantKey];
|
||||||
|
|
||||||
|
if (Plant !== undefined) {
|
||||||
|
StartingPlants.push(
|
||||||
|
Plant
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Object.values(Plants)
|
return StartingPlants;
|
||||||
.filter(
|
|
||||||
Plant =>
|
|
||||||
Plant.Shop
|
|
||||||
?.StartingPlant ===
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -461,6 +461,10 @@ async function BuyPlantSeed(
|
|||||||
PlantId
|
PlantId
|
||||||
);
|
);
|
||||||
|
|
||||||
|
DiscoverPlant(
|
||||||
|
ShopSave,
|
||||||
|
PlantId
|
||||||
|
);
|
||||||
|
|
||||||
SetShopMessage(
|
SetShopMessage(
|
||||||
"Bought a " +
|
"Bought a " +
|
||||||
|
|||||||
Reference in new issue
Block a user