cheat: extraRelicRewards

This commit is contained in:
AlexisinGit 2025-10-08 15:45:42 +08:00
parent f5c1b83598
commit 0796917740
8 changed files with 42 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

@ -14,7 +14,7 @@ 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 +25,28 @@ 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
);
}
logger.debug(`relic rolled`, reward);
participant.Reward = reward.type;
// Remove relic
const miscItemChanges = [
@ -48,16 +58,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

@ -1468,6 +1468,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
nemesisHintProgressMultiplierGrineer: Number,
nemesisHintProgressMultiplierCorpus: Number,
nemesisExtraWeapon: Number,
extraRelicRewards: Number,
SubscribedToEmails: { type: Number, default: 0 },
SubscribedToEmailsPersonalized: { type: Number, default: 0 },

View File

@ -1337,8 +1337,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

@ -61,6 +61,7 @@ export interface IAccountCheats {
nemesisHintProgressMultiplierGrineer?: number;
nemesisHintProgressMultiplierCorpus?: number;
nemesisExtraWeapon?: number;
extraRelicRewards?: number;
}
export interface IInventoryDatabase

View File

@ -1057,6 +1057,13 @@
<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="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

@ -262,6 +262,7 @@ dict = {
cheats_nemesisHintProgressMultiplierGrineer: `Hint Progress Multiplier (Grineer)`,
cheats_nemesisHintProgressMultiplierCorpus: `Hint Progress Multiplier (Corpus)`,
cheats_nemesisExtraWeapon: `Extra Nemesis Weapon / Token On Vanquish (0 to disable)`,
cheats_extraRelicRewards: `Extra Relic Rewards`,
worldState: `World State`,
worldState_creditBoost: `Credit Boost`,

View File

@ -263,6 +263,7 @@ dict = {
cheats_nemesisHintProgressMultiplierGrineer: `解密进度倍率 (Grineer)`,
cheats_nemesisHintProgressMultiplierCorpus: `解密进度倍率 (Corpus)`,
cheats_nemesisExtraWeapon: `额外玄骸武器/代币 (0为禁用)`,
cheats_extraRelicRewards: `额外遗物奖励`,
worldState: `世界状态配置`,
worldState_creditBoost: `现金加成`,