chore: move a few more cheat toggles to be per-account (#2713)
Re #2361 Reviewed-on: #2713 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
This commit is contained in:
parent
4b2b184b8f
commit
5a2fa2c2c3
@ -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,
|
||||
"spoofMasteryRank": -1,
|
||||
"relicRewardItemCountMultiplier": 1,
|
||||
"nightwaveStandingMultiplier": 1,
|
||||
|
||||
@ -306,7 +306,7 @@ export const getInventoryResponse = async (
|
||||
inventoryResponse.PrimeTokens = 999999999;
|
||||
}
|
||||
|
||||
if (config.skipAllDialogue) {
|
||||
if (inventory.skipAllDialogue) {
|
||||
inventoryResponse.TauntHistory = [
|
||||
{
|
||||
node: "TreasureTutorial",
|
||||
|
||||
@ -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);
|
||||
};
|
||||
|
||||
@ -17,11 +17,11 @@ export const crackRelic = async (
|
||||
): Promise<IRngResult> => {
|
||||
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);
|
||||
|
||||
@ -1428,6 +1428,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
|
||||
accountOwnerId: Schema.Types.ObjectId,
|
||||
|
||||
// SNS account cheats
|
||||
skipAllDialogue: Boolean,
|
||||
dontSubtractPurchaseCreditCost: Boolean,
|
||||
dontSubtractPurchasePlatinumCost: Boolean,
|
||||
dontSubtractPurchaseItemCost: Boolean,
|
||||
@ -1455,6 +1456,11 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
|
||||
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 },
|
||||
|
||||
@ -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;
|
||||
spoofMasteryRank?: number;
|
||||
relicRewardItemCountMultiplier?: number;
|
||||
nightwaveStandingMultiplier?: number;
|
||||
@ -94,6 +88,7 @@ export interface IConfig extends IConfigRemovedOptions {
|
||||
}
|
||||
|
||||
export const configRemovedOptionsKeys = [
|
||||
"skipAllDialogue",
|
||||
"infiniteCredits",
|
||||
"infinitePlatinum",
|
||||
"infiniteEndo",
|
||||
@ -122,7 +117,12 @@ export const configRemovedOptionsKeys = [
|
||||
"instantResourceExtractorDrones",
|
||||
"noResourceExtractorDronesDamage",
|
||||
"baroAlwaysAvailable",
|
||||
"baroFullyStocked"
|
||||
"baroFullyStocked",
|
||||
"missionsCanGiveAllRelics",
|
||||
"exceptionalRelicsAlwaysGiveBronzeReward",
|
||||
"flawlessRelicsAlwaysGiveSilverReward",
|
||||
"radiantRelicsAlwaysGiveGoldReward",
|
||||
"disableDailyTribute"
|
||||
] as const;
|
||||
|
||||
type IConfigRemovedOptions = {
|
||||
|
||||
@ -2197,7 +2197,7 @@ function getRandomMissionDrops(
|
||||
}
|
||||
}
|
||||
|
||||
if (config.missionsCanGiveAllRelics) {
|
||||
if (inventory.missionsCanGiveAllRelics) {
|
||||
for (const drop of drops) {
|
||||
const itemType = fromStoreItem(drop.StoreItem);
|
||||
if (itemType in ExportRelics) {
|
||||
|
||||
@ -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
|
||||
|
||||
@ -647,6 +647,10 @@
|
||||
<div class="card">
|
||||
<h5 class="card-header" data-loc="cheats_account"></h5>
|
||||
<div class="card-body" id="account-cheats">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="skipAllDialogue" />
|
||||
<label class="form-check-label" for="skipAllDialogue" data-loc="cheats_skipAllDialogue"></label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="dontSubtractPurchaseCreditCost" />
|
||||
<label class="form-check-label" for="dontSubtractPurchaseCreditCost" data-loc="cheats_dontSubtractPurchaseCreditCost"></label>
|
||||
@ -754,6 +758,30 @@
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="claimingBlueprintRefundsIngredients" />
|
||||
<label class="form-check-label" for="claimingBlueprintRefundsIngredients" data-loc="cheats_claimingBlueprintRefundsIngredients"></label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="missionsCanGiveAllRelics" />
|
||||
<label class="form-check-label" for="missionsCanGiveAllRelics" data-loc="cheats_missionsCanGiveAllRelics"></label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="exceptionalRelicsAlwaysGiveBronzeReward" />
|
||||
<label class="form-check-label" for="exceptionalRelicsAlwaysGiveBronzeReward" data-loc="cheats_exceptionalRelicsAlwaysGiveBronzeReward"></label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="flawlessRelicsAlwaysGiveSilverReward" />
|
||||
<label class="form-check-label" for="flawlessRelicsAlwaysGiveSilverReward" data-loc="cheats_flawlessRelicsAlwaysGiveSilverReward"></label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="radiantRelicsAlwaysGiveGoldReward" />
|
||||
<label class="form-check-label" for="radiantRelicsAlwaysGiveGoldReward" data-loc="cheats_radiantRelicsAlwaysGiveGoldReward"></label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="unlockAllSimarisResearchEntries" />
|
||||
<label class="form-check-label" for="unlockAllSimarisResearchEntries" data-loc="cheats_unlockAllSimarisResearchEntries"></label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="disableDailyTribute" />
|
||||
<label class="form-check-label" for="disableDailyTribute" data-loc="cheats_disableDailyTribute"></label>
|
||||
</div>
|
||||
<div class="mt-2 mb-2 d-flex flex-wrap gap-2">
|
||||
<button class="btn btn-primary" onclick="debounce(doUnlockAllMissions);" data-loc="cheats_unlockAllMissions"></button>
|
||||
@ -786,10 +814,6 @@
|
||||
<input class="form-check-input" type="checkbox" id="skipTutorial" />
|
||||
<label class="form-check-label" for="skipTutorial" data-loc="cheats_skipTutorial"></label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="skipAllDialogue" />
|
||||
<label class="form-check-label" for="skipAllDialogue" data-loc="cheats_skipAllDialogue"></label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="unlockAllScans" />
|
||||
<label class="form-check-label" for="unlockAllScans" data-loc="cheats_unlockAllScans"></label>
|
||||
@ -854,30 +878,6 @@
|
||||
<input class="form-check-input" type="checkbox" id="fastClanAscension" />
|
||||
<label class="form-check-label" for="fastClanAscension" data-loc="cheats_fastClanAscension"></label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="missionsCanGiveAllRelics" />
|
||||
<label class="form-check-label" for="missionsCanGiveAllRelics" data-loc="cheats_missionsCanGiveAllRelics"></label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="exceptionalRelicsAlwaysGiveBronzeReward" />
|
||||
<label class="form-check-label" for="exceptionalRelicsAlwaysGiveBronzeReward" data-loc="cheats_exceptionalRelicsAlwaysGiveBronzeReward"></label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="flawlessRelicsAlwaysGiveSilverReward" />
|
||||
<label class="form-check-label" for="flawlessRelicsAlwaysGiveSilverReward" data-loc="cheats_flawlessRelicsAlwaysGiveSilverReward"></label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="radiantRelicsAlwaysGiveGoldReward" />
|
||||
<label class="form-check-label" for="radiantRelicsAlwaysGiveGoldReward" data-loc="cheats_radiantRelicsAlwaysGiveGoldReward"></label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="unlockAllSimarisResearchEntries" />
|
||||
<label class="form-check-label" for="unlockAllSimarisResearchEntries" data-loc="cheats_unlockAllSimarisResearchEntries"></label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="disableDailyTribute" />
|
||||
<label class="form-check-label" for="disableDailyTribute" data-loc="cheats_disableDailyTribute"></label>
|
||||
</div>
|
||||
<form class="form-group mt-2" onsubmit="doSaveConfigInt('spoofMasteryRank'); return false;">
|
||||
<label class="form-label" for="spoofMasteryRank" data-loc="cheats_spoofMasteryRank"></label>
|
||||
<div class="input-group">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user