Merge branch 'feat-extra-relic-rewards-cheat' into 自用

This commit is contained in:
AlexisinGit 2025-10-08 15:53:55 +08:00
commit 38d1e31ad8
8 changed files with 104 additions and 23 deletions

View File

@ -11,11 +11,13 @@ export const getVoidProjectionRewardsController: RequestHandler = async (req, re
if (data.ParticipantInfo.QualifiesForReward && !data.ParticipantInfo.HaveRewardResponse) {
const inventory = await getInventory(accountId);
const reward = await crackRelic(inventory, data.ParticipantInfo);
const rewards = await crackRelic(inventory, data.ParticipantInfo);
if (!inventory.MissionRelicRewards || inventory.MissionRelicRewards.length >= data.CurrentWave) {
inventory.MissionRelicRewards = [];
}
inventory.MissionRelicRewards.push({ ItemType: reward.type, ItemCount: reward.itemCount });
rewards.forEach(reward => {
(inventory.MissionRelicRewards ??= []).push({ ItemType: reward.type, ItemCount: reward.itemCount });
});
await inventory.save();
}

View File

@ -9,12 +9,13 @@ import { addMiscItems, combineInventoryChanges } from "../services/inventoryServ
import { handleStoreItemAcquisition } from "../services/purchaseService.ts";
import type { IInventoryChanges } from "../types/purchaseTypes.ts";
import { config } from "../services/configService.ts";
import { log } from "winston";
export const crackRelic = async (
inventory: TInventoryDatabaseDocument,
participant: IVoidTearParticipantInfo,
inventoryChanges: IInventoryChanges = {}
): Promise<IRngResult> => {
): Promise<IRngResult[]> => {
const relic = ExportRelics[participant.VoidProjection];
let weights = refinementToWeights[relic.quality];
if (relic.quality == "VPQ_SILVER" && inventory.exceptionalRelicsAlwaysGiveBronzeReward) {
@ -25,18 +26,48 @@ export const crackRelic = async (
weights = { COMMON: 0, UNCOMMON: 0, RARE: 1, LEGENDARY: 0 };
}
logger.debug(`opening a relic of quality ${relic.quality}; rarity weights are`, weights);
let reward = getRandomWeightedReward(
ExportRewards[relic.rewardManifest][0] as { type: string; itemCount: number; rarity: TRarity }[], // rarity is nullable in PE+ typings, but always present for relics
weights
)!;
if (config.relicRewardItemCountMultiplier !== undefined && (config.relicRewardItemCountMultiplier ?? 1) != 1) {
reward = {
...reward,
itemCount: reward.itemCount * config.relicRewardItemCountMultiplier
};
const allRewards = [];
const relicRewardCount = 1 + (inventory.extraRelicRewards ?? 0);
for (let i = 0; i < relicRewardCount; i++) {
let reward = getRandomWeightedReward(
ExportRewards[relic.rewardManifest][0] as { type: string; itemCount: number; rarity: TRarity }[], // rarity is nullable in PE+ typings, but always present for relics
weights
)!;
if (config.relicRewardItemCountMultiplier !== undefined && (config.relicRewardItemCountMultiplier ?? 1) != 1) {
reward = {
...reward,
itemCount: reward.itemCount * config.relicRewardItemCountMultiplier
};
}
logger.debug(`relic rolled`, reward);
participant.Reward = reward.type;
allRewards.push(reward);
// Give reward
combineInventoryChanges(
inventoryChanges,
(await handleStoreItemAcquisition(reward.type, inventory, reward.itemCount)).InventoryChanges
);
if (inventory.crackRelicForPlatinum) {
let platinumReward = 0;
switch (reward.rarity) {
case "COMMON":
platinumReward = inventory.relicPlatinumCommon ?? 2;
break;
case "UNCOMMON":
platinumReward = inventory.relicPlatinumUncommon ?? 5;
break;
case "RARE":
platinumReward = inventory.relicPlatinumRare ?? 12;
break;
case "LEGENDARY":
logger.warn(`got a legendary reward for a relic!`);
break;
}
logger.debug(`adding ${platinumReward} platinum to inventory for a ${reward.rarity} reward`);
inventory.PremiumCredits += platinumReward;
}
}
logger.debug(`relic rolled`, reward);
participant.Reward = reward.type;
// Remove relic
const miscItemChanges = [
@ -48,16 +79,10 @@ export const crackRelic = async (
addMiscItems(inventory, miscItemChanges);
combineInventoryChanges(inventoryChanges, { MiscItems: miscItemChanges });
// Give reward
combineInventoryChanges(
inventoryChanges,
(await handleStoreItemAcquisition(reward.type, inventory, reward.itemCount)).InventoryChanges
);
// Client has picked its own reward (for lack of choice)
participant.ChosenRewardOwner = participant.AccountId;
return reward;
return allRewards;
};
const refinementToWeights = {

View File

@ -1473,6 +1473,11 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
playerSkillGainsMultiplierDrifter: Number,
extraMissionRewards: Number,
strippedItemRewardsMultiplier: Number,
extraRelicRewards: Number,
crackRelicForPlatinum: Boolean,
relicPlatinumCommon: Number,
relicPlatinumUncommon: Number,
relicPlatinumRare: Number,
SubscribedToEmails: { type: Number, default: 0 },
SubscribedToEmailsPersonalized: { type: Number, default: 0 },

View File

@ -1355,8 +1355,10 @@ export const addMissionRewards = async (
if (voidTearWave && voidTearWave.Participants[0].QualifiesForReward) {
if (!voidTearWave.Participants[0].HaveRewardResponse) {
// non-endless fissure; giving reward now
const reward = await crackRelic(inventory, voidTearWave.Participants[0], inventoryChanges);
MissionRewards.push({ StoreItem: reward.type, ItemCount: reward.itemCount });
const rewards = await crackRelic(inventory, voidTearWave.Participants[0], inventoryChanges);
rewards.forEach(reward => {
MissionRewards.push({ StoreItem: reward.type, ItemCount: reward.itemCount });
});
} else if (inventory.MissionRelicRewards) {
// endless fissure; already gave reward(s) but should still show in EOM screen
for (const reward of inventory.MissionRelicRewards) {

View File

@ -66,6 +66,11 @@ export interface IAccountCheats {
playerSkillGainsMultiplierDrifter?: number;
extraMissionRewards?: number;
strippedItemRewardsMultiplier?: number;
extraRelicRewards?: number;
crackRelicForPlatinum?: boolean;
relicPlatinumCommon?: number;
relicPlatinumUncommon?: number;
relicPlatinumRare?: number;
}
export interface IInventoryDatabase

View File

@ -1089,6 +1089,38 @@
<button class="btn btn-secondary" type="button" data-loc="cheats_save"></button>
</div>
</form>
<form class="form-group mt-2">
<label class="form-label" for="extraRelicRewards" data-loc="cheats_extraRelicRewards"></label>
<div class="input-group">
<input class="form-control" id="extraRelicRewards" type="number" min="0" max="65535" data-default="0" />
<button class="btn btn-secondary" type="button" data-loc="cheats_save"></button>
</div>
</form>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="crackRelicForPlatinum" />
<label class="form-check-label" for="crackRelicForPlatinum" data-loc="cheats_crackRelicForPlatinum"></label>
</div>
<form class="form-group mt-2">
<label class="form-label" for="relicPlatinumCommon" data-loc="cheats_relicPlatinumCommon"></label>
<div class="input-group">
<input class="form-control" id="relicPlatinumCommon" type="number" min="0" max="65535" data-default="2" />
<button class="btn btn-secondary" type="button" data-loc="cheats_save"></button>
</div>
</form>
<form class="form-group mt-2">
<label class="form-label" for="relicPlatinumUncommon" data-loc="cheats_relicPlatinumUncommon"></label>
<div class="input-group">
<input class="form-control" id="relicPlatinumUncommon" type="number" min="0" max="65535" data-default="5" />
<button class="btn btn-secondary" type="button" data-loc="cheats_save"></button>
</div>
</form>
<form class="form-group mt-2">
<label class="form-label" for="relicPlatinumRare" data-loc="cheats_relicPlatinumRare"></label>
<div class="input-group">
<input class="form-control" id="relicPlatinumRare" type="number" min="0" max="65535" data-default="12" />
<button class="btn btn-secondary" type="button" data-loc="cheats_save"></button>
</div>
</form>
<div class="mt-2 mb-2 d-flex flex-wrap gap-2">
<button class="btn btn-primary" onclick="debounce(doUnlockAllShipFeatures);" data-loc="cheats_unlockAllShipFeatures"></button>
<button class="btn btn-primary" onclick="debounce(unlockAllMissions);" data-loc="cheats_unlockAllMissions"></button>

View File

@ -267,6 +267,11 @@ dict = {
cheats_playerSkillGainsMultiplierDrifter: `Intrinsics Gains Multiplier (Drifter)`,
cheats_extraMissionRewards: `Extra Mission Rewards (0 to disable)`,
cheats_strippedItemRewardsMultiplier: `Stripped Item Rewards Multiplier`,
cheats_extraRelicRewards: `Extra Relic Rewards`,
cheats_crackRelicForPlatinum: `Crack Relic for Platinum`,
cheats_relicPlatinumCommon: `Platinum on Common Rewards`,
cheats_relicPlatinumUncommon: `Platinum on Uncommon Rewards`,
cheats_relicPlatinumRare: `Platinum on Rare Rewards`,
worldState: `World State`,
worldState_creditBoost: `Credit Boost`,

View File

@ -268,6 +268,11 @@ dict = {
cheats_playerSkillGainsMultiplierDrifter: `內源之力获取倍率 (漂泊者)`,
cheats_extraMissionRewards: `额外任务奖励 (0为禁用)`,
cheats_strippedItemRewardsMultiplier: `隐藏战利品奖励倍率`,
cheats_extraRelicRewards: `额外遗物奖励`,
cheats_crackRelicForPlatinum: `打开遗物时获得白金`,
cheats_relicPlatinumCommon: `普通奖励的白金`,
cheats_relicPlatinumUncommon: `罕见奖励的白金`,
cheats_relicPlatinumRare: `稀有奖励的白金`,
worldState: `世界状态配置`,
worldState_creditBoost: `现金加成`,