diff --git a/Dockerfile b/Dockerfile index 45f00f80..d4d7b1a0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,8 +5,7 @@ RUN apk add --no-cache bash jq COPY . /app WORKDIR /app -RUN npm i --omit=dev -RUN npm run build +RUN npm i --omit=dev --omit=optional RUN date '+%d %B %Y' > BUILD_DATE ENTRYPOINT ["/app/docker-entrypoint.sh"] diff --git a/config-vanilla.json b/config-vanilla.json index 91bc52b1..ac107c4f 100644 --- a/config-vanilla.json +++ b/config-vanilla.json @@ -11,7 +11,6 @@ "administratorNames": [], "autoCreateAccount": true, "skipTutorial": false, - "skipAllDialogue": false, "unlockAllScans": false, "unlockAllShipFeatures": false, "unlockAllShipDecorations": false, @@ -27,9 +26,7 @@ "noDojoResearchCosts": false, "noDojoResearchTime": false, "fastClanAscension": false, - "missionsCanGiveAllRelics": false, "unlockAllSimarisResearchEntries": false, - "disableDailyTribute": false, "finishOneInvasionFinishTheWholeThing": false, "spoofMasteryRank": -1, "relicRewardItemCountMultiplier": 1, diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 27abf98d..e67508c2 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -5,4 +5,4 @@ if [ ! -f conf/config.json ]; then jq --arg value "mongodb://openwfagent:spaceninjaserver@mongodb:27017/" '.mongodbUrl = $value' /app/config-vanilla.json > /app/conf/config.json fi -exec npm run start -- --configPath conf/config.json +exec npm run raw -- --configPath conf/config.json diff --git a/src/controllers/api/crewShipFusionController.ts b/src/controllers/api/crewShipFusionController.ts index c0981f4f..a7b697c3 100644 --- a/src/controllers/api/crewShipFusionController.ts +++ b/src/controllers/api/crewShipFusionController.ts @@ -81,7 +81,7 @@ export const crewShipFusionController: RequestHandler = async (req, res) => { const newFval = (newPerc - rangeA[0]) / (rangeA[1] - rangeA[0]); buffA.Value = Math.trunc(newFval * 0x3fffffff); } - if (inferiorFingerprint.SubroutineIndex) { + if (inferiorFingerprint.SubroutineIndex !== undefined) { const useSuperiorSubroutine = tierA < tierB ? !payload.UseSubroutineA : payload.UseSubroutineA; if (!useSuperiorSubroutine) { fingerprint.SubroutineIndex = inferiorFingerprint.SubroutineIndex; diff --git a/src/controllers/api/inventoryController.ts b/src/controllers/api/inventoryController.ts index fb935c38..5a508f04 100644 --- a/src/controllers/api/inventoryController.ts +++ b/src/controllers/api/inventoryController.ts @@ -306,7 +306,7 @@ export const getInventoryResponse = async ( inventoryResponse.PrimeTokens = 999999999; } - if (config.skipAllDialogue) { + if (inventory.skipAllDialogue) { inventoryResponse.TauntHistory = [ { node: "TreasureTutorial", diff --git a/src/controllers/api/loginRewardsController.ts b/src/controllers/api/loginRewardsController.ts index 3145a462..d412a5ae 100644 --- a/src/controllers/api/loginRewardsController.ts +++ b/src/controllers/api/loginRewardsController.ts @@ -8,7 +8,6 @@ import { setAccountGotLoginRewardToday } from "../../services/loginRewardService.ts"; import { getInventory } from "../../services/inventoryService.ts"; -import { config } from "../../services/configService.ts"; import { sendWsBroadcastTo } from "../../services/wsService.ts"; export const loginRewardsController: RequestHandler = async (req, res) => { @@ -17,41 +16,42 @@ export const loginRewardsController: RequestHandler = async (req, res) => { const isMilestoneDay = account.LoginDays == 5 || account.LoginDays % 50 == 0; const nextMilestoneDay = account.LoginDays < 5 ? 5 : (Math.trunc(account.LoginDays / 50) + 1) * 50; - if (today == account.LastLoginRewardDate || config.disableDailyTribute) { - res.json({ - DailyTributeInfo: { - IsMilestoneDay: isMilestoneDay, - IsChooseRewardSet: isLoginRewardAChoice(account), - LoginDays: account.LoginDays, - NextMilestoneReward: "", - NextMilestoneDay: nextMilestoneDay - } - } satisfies ILoginRewardsReponse); - return; - } + if (today != account.LastLoginRewardDate) { + const inventory = await getInventory(account._id.toString()); + if (!inventory.disableDailyTribute) { + const randomRewards = getRandomLoginRewards(account, inventory); + const response: ILoginRewardsReponse = { + DailyTributeInfo: { + Rewards: randomRewards, + IsMilestoneDay: isMilestoneDay, + IsChooseRewardSet: randomRewards.length != 1, + LoginDays: account.LoginDays, + NextMilestoneReward: "", + NextMilestoneDay: nextMilestoneDay, + HasChosenReward: false + }, + LastLoginRewardDate: today + }; + if (!isMilestoneDay && randomRewards.length == 1) { + response.DailyTributeInfo.HasChosenReward = true; + response.DailyTributeInfo.ChosenReward = randomRewards[0]; + response.DailyTributeInfo.NewInventory = await claimLoginReward(inventory, randomRewards[0]); + setAccountGotLoginRewardToday(account); + await Promise.all([inventory.save(), account.save()]); - const inventory = await getInventory(account._id.toString()); - const randomRewards = getRandomLoginRewards(account, inventory); - const response: ILoginRewardsReponse = { + sendWsBroadcastTo(account._id.toString(), { update_inventory: true }); + } + res.json(response); + return; + } + } + res.json({ DailyTributeInfo: { - Rewards: randomRewards, IsMilestoneDay: isMilestoneDay, - IsChooseRewardSet: randomRewards.length != 1, + IsChooseRewardSet: isLoginRewardAChoice(account), LoginDays: account.LoginDays, NextMilestoneReward: "", - NextMilestoneDay: nextMilestoneDay, - HasChosenReward: false - }, - LastLoginRewardDate: today - }; - if (!isMilestoneDay && randomRewards.length == 1) { - response.DailyTributeInfo.HasChosenReward = true; - response.DailyTributeInfo.ChosenReward = randomRewards[0]; - response.DailyTributeInfo.NewInventory = await claimLoginReward(inventory, randomRewards[0]); - setAccountGotLoginRewardToday(account); - await Promise.all([inventory.save(), account.save()]); - - sendWsBroadcastTo(account._id.toString(), { update_inventory: true }); - } - res.json(response); + NextMilestoneDay: nextMilestoneDay + } + } satisfies ILoginRewardsReponse); }; diff --git a/src/controllers/api/upgradeOperatorController.ts b/src/controllers/api/upgradeOperatorController.ts new file mode 100644 index 00000000..4aedef6f --- /dev/null +++ b/src/controllers/api/upgradeOperatorController.ts @@ -0,0 +1,16 @@ +import { getInventory, updateCurrency } from "../../services/inventoryService.ts"; +import { getAccountIdForRequest } from "../../services/loginService.ts"; +import type { RequestHandler } from "express"; + +export const upgradeOperatorController: RequestHandler = async (req, res) => { + const accountId = await getAccountIdForRequest(req); + const inventory = await getInventory( + accountId, + "OperatorCustomizationSlotPurchases PremiumCredits PremiumCreditsFree" + ); + inventory.OperatorCustomizationSlotPurchases ??= 0; + inventory.OperatorCustomizationSlotPurchases += 1; + const inventoryChanges = updateCurrency(inventory, 10, true); + await inventory.save(); + res.json({ InventoryChanges: inventoryChanges }); +}; diff --git a/src/helpers/relicHelper.ts b/src/helpers/relicHelper.ts index 1fae78e1..964e43e2 100644 --- a/src/helpers/relicHelper.ts +++ b/src/helpers/relicHelper.ts @@ -17,11 +17,11 @@ export const crackRelic = async ( ): Promise => { const relic = ExportRelics[participant.VoidProjection]; let weights = refinementToWeights[relic.quality]; - if (relic.quality == "VPQ_SILVER" && config.exceptionalRelicsAlwaysGiveBronzeReward) { + if (relic.quality == "VPQ_SILVER" && inventory.exceptionalRelicsAlwaysGiveBronzeReward) { weights = { COMMON: 1, UNCOMMON: 0, RARE: 0, LEGENDARY: 0 }; - } else if (relic.quality == "VPQ_GOLD" && config.flawlessRelicsAlwaysGiveSilverReward) { + } else if (relic.quality == "VPQ_GOLD" && inventory.flawlessRelicsAlwaysGiveSilverReward) { weights = { COMMON: 0, UNCOMMON: 1, RARE: 0, LEGENDARY: 0 }; - } else if (relic.quality == "VPQ_PLATINUM" && config.radiantRelicsAlwaysGiveGoldReward) { + } else if (relic.quality == "VPQ_PLATINUM" && inventory.radiantRelicsAlwaysGiveGoldReward) { weights = { COMMON: 0, UNCOMMON: 0, RARE: 1, LEGENDARY: 0 }; } logger.debug(`opening a relic of quality ${relic.quality}; rarity weights are`, weights); diff --git a/src/models/inventoryModels/inventoryModel.ts b/src/models/inventoryModels/inventoryModel.ts index 0a39b701..96b0f28d 100644 --- a/src/models/inventoryModels/inventoryModel.ts +++ b/src/models/inventoryModels/inventoryModel.ts @@ -1428,6 +1428,7 @@ const inventorySchema = new Schema( accountOwnerId: Schema.Types.ObjectId, // SNS account cheats + skipAllDialogue: Boolean, dontSubtractPurchaseCreditCost: Boolean, dontSubtractPurchasePlatinumCost: Boolean, dontSubtractPurchaseItemCost: Boolean, @@ -1455,6 +1456,11 @@ const inventorySchema = new Schema( claimingBlueprintRefundsIngredients: Boolean, instantResourceExtractorDrones: Boolean, noResourceExtractorDronesDamage: Boolean, + missionsCanGiveAllRelics: Boolean, + exceptionalRelicsAlwaysGiveBronzeReward: Boolean, + flawlessRelicsAlwaysGiveSilverReward: Boolean, + radiantRelicsAlwaysGiveGoldReward: Boolean, + disableDailyTribute: Boolean, SubscribedToEmails: { type: Number, default: 0 }, SubscribedToEmailsPersonalized: { type: Number, default: 0 }, @@ -1564,6 +1570,7 @@ const inventorySchema = new Schema( OperatorLoadOuts: [operatorConfigSchema], //Drifter AdultOperatorLoadOuts: [operatorConfigSchema], + OperatorCustomizationSlotPurchases: Number, // Kahl KahlLoadOuts: [operatorConfigSchema], diff --git a/src/routes/api.ts b/src/routes/api.ts index 44d3cd1e..a9c84b84 100644 --- a/src/routes/api.ts +++ b/src/routes/api.ts @@ -162,6 +162,7 @@ import { updateQuestController } from "../controllers/api/updateQuestController. import { updateSessionGetController, updateSessionPostController } from "../controllers/api/updateSessionController.ts"; import { updateSongChallengeController } from "../controllers/api/updateSongChallengeController.ts"; import { updateThemeController } from "../controllers/api/updateThemeController.ts"; +import { upgradeOperatorController } from "../controllers/api/upgradeOperatorController.ts"; import { upgradesController } from "../controllers/api/upgradesController.ts"; import { valenceSwapController } from "../controllers/api/valenceSwapController.ts"; import { wishlistController } from "../controllers/api/wishlistController.ts"; @@ -229,6 +230,7 @@ apiRouter.get("/startLibraryPersonalTarget.php", startLibraryPersonalTargetContr apiRouter.get("/surveys.php", surveysController); apiRouter.get("/trading.php", tradingController); apiRouter.get("/updateSession.php", updateSessionGetController); +apiRouter.get("/upgradeOperator.php", upgradeOperatorController); // post apiRouter.post("/abortDojoComponent.php", abortDojoComponentController); diff --git a/src/services/configService.ts b/src/services/configService.ts index 2ede469b..fed1347f 100644 --- a/src/services/configService.ts +++ b/src/services/configService.ts @@ -18,7 +18,6 @@ export interface IConfig extends IConfigRemovedOptions { administratorNames?: string[]; autoCreateAccount?: boolean; skipTutorial?: boolean; - skipAllDialogue?: boolean; unlockAllScans?: boolean; unlockAllShipFeatures?: boolean; unlockAllShipDecorations?: boolean; @@ -35,12 +34,7 @@ export interface IConfig extends IConfigRemovedOptions { noDojoResearchCosts?: boolean; noDojoResearchTime?: boolean; fastClanAscension?: boolean; - missionsCanGiveAllRelics?: boolean; - exceptionalRelicsAlwaysGiveBronzeReward?: boolean; - flawlessRelicsAlwaysGiveSilverReward?: boolean; - radiantRelicsAlwaysGiveGoldReward?: boolean; unlockAllSimarisResearchEntries?: boolean; - disableDailyTribute?: boolean; finishOneInvasionFinishTheWholeThing?: boolean; spoofMasteryRank?: number; relicRewardItemCountMultiplier?: number; @@ -95,6 +89,7 @@ export interface IConfig extends IConfigRemovedOptions { } export const configRemovedOptionsKeys = [ + "skipAllDialogue", "infiniteCredits", "infinitePlatinum", "infiniteEndo", @@ -123,7 +118,12 @@ export const configRemovedOptionsKeys = [ "instantResourceExtractorDrones", "noResourceExtractorDronesDamage", "baroAlwaysAvailable", - "baroFullyStocked" + "baroFullyStocked", + "missionsCanGiveAllRelics", + "exceptionalRelicsAlwaysGiveBronzeReward", + "flawlessRelicsAlwaysGiveSilverReward", + "radiantRelicsAlwaysGiveGoldReward", + "disableDailyTribute" ] as const; type IConfigRemovedOptions = { diff --git a/src/services/missionInventoryUpdateService.ts b/src/services/missionInventoryUpdateService.ts index 5ed40a39..6c000cf6 100644 --- a/src/services/missionInventoryUpdateService.ts +++ b/src/services/missionInventoryUpdateService.ts @@ -2202,7 +2202,7 @@ function getRandomMissionDrops( } } - if (config.missionsCanGiveAllRelics) { + if (inventory.missionsCanGiveAllRelics) { for (const drop of drops) { const itemType = fromStoreItem(drop.StoreItem); if (itemType in ExportRelics) { diff --git a/src/types/inventoryTypes/inventoryTypes.ts b/src/types/inventoryTypes/inventoryTypes.ts index 89f493f4..115b80c1 100644 --- a/src/types/inventoryTypes/inventoryTypes.ts +++ b/src/types/inventoryTypes/inventoryTypes.ts @@ -21,6 +21,7 @@ export type InventoryDatabaseEquipment = { // Fields specific to SNS export interface IAccountCheats { + skipAllDialogue?: boolean; dontSubtractPurchaseCreditCost?: boolean; dontSubtractPurchasePlatinumCost?: boolean; dontSubtractPurchaseItemCost?: boolean; @@ -48,6 +49,11 @@ export interface IAccountCheats { claimingBlueprintRefundsIngredients?: boolean; instantResourceExtractorDrones?: boolean; noResourceExtractorDronesDamage?: boolean; + missionsCanGiveAllRelics?: boolean; + exceptionalRelicsAlwaysGiveBronzeReward?: boolean; + flawlessRelicsAlwaysGiveSilverReward?: boolean; + radiantRelicsAlwaysGiveGoldReward?: boolean; + disableDailyTribute?: boolean; } export interface IInventoryDatabase @@ -374,6 +380,7 @@ export interface IInventoryClient extends IDailyAffiliations, InventoryClientEqu CrewMembers: ICrewMemberClient[]; LotusCustomization?: ILotusCustomization; UseAdultOperatorLoadout?: boolean; + OperatorCustomizationSlotPurchases?: number; NemesisAbandonedRewards: string[]; LastInventorySync?: IOid; NextRefill?: IMongoDate; diff --git a/static/webui/index.html b/static/webui/index.html index 70e866b8..64745674 100644 --- a/static/webui/index.html +++ b/static/webui/index.html @@ -647,6 +647,10 @@
+
+ + +
@@ -754,6 +758,30 @@
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
@@ -786,10 +814,6 @@
-
- - -
@@ -854,30 +878,6 @@
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -