This commit is contained in:
nyaoouo 2025-06-10 02:38:52 +08:00
parent 2e8c612f93
commit 0be7cfbfa3

View File

@ -37,7 +37,7 @@ export const syndicateSacrificeController: RequestHandler = async (request, resp
reward?: {
type: string;
count?: number; // default 1
}
};
}
const needProcess: _HandleItem[] = [];
@ -45,7 +45,7 @@ export const syndicateSacrificeController: RequestHandler = async (request, resp
if (!syndicate.Initiated) {
needProcess.push({
sacrifice: manifest.initiationSacrifice,
reward: manifest.initiationReward ? { type: manifest.initiationReward } : undefined,
reward: manifest.initiationReward ? { type: manifest.initiationReward } : undefined
});
syndicate.Initiated = true;
}
@ -55,21 +55,23 @@ export const syndicateSacrificeController: RequestHandler = async (request, resp
newLevel = res.Level = data.SacrificeLevel;
res.LevelIncrease = data.SacrificeLevel - oldLevel;
} else {
titles.filter(x => x.level > oldLevel && x.minStanding <= currentStanding).forEach(x => {
if (x.level > newLevel) newLevel = x.level;
const item: _HandleItem = {};
if (x.sacrifice) {
item.sacrifice = x.sacrifice;
}
if (x.storeItemReward) {
item.reward = { type: x.storeItemReward, count: 1 };
} else if (x.reward) {
item.reward = { type: toStoreItem(x.reward.ItemType), count: x.reward.ItemCount };
}
if (item.sacrifice || item.reward) {
needProcess.push(item);
}
})
titles
.filter(x => x.level > oldLevel && x.minStanding <= currentStanding)
.forEach(x => {
if (x.level > newLevel) newLevel = x.level;
const item: _HandleItem = {};
if (x.sacrifice) {
item.sacrifice = x.sacrifice;
}
if (x.storeItemReward) {
item.reward = { type: x.storeItemReward, count: 1 };
} else if (x.reward) {
item.reward = { type: toStoreItem(x.reward.ItemType), count: x.reward.ItemCount };
}
if (item.sacrifice || item.reward) {
needProcess.push(item);
}
});
res.Level = newLevel;
res.LevelIncrease = newLevel - oldLevel;
}
@ -102,12 +104,14 @@ export const syndicateSacrificeController: RequestHandler = async (request, resp
if (isNightwave) {
res.NewEpisodeReward = needProcess.length > 0;
} else {
manifest.favours.filter(x => x.rankUpReward && x.requiredLevel <= newLevel).forEach(x => {
syndicate.FreeFavorsEarned ??= [];
if (!syndicate.FreeFavorsEarned.includes(x.requiredLevel)) {
syndicate.FreeFavorsEarned.push(x.requiredLevel);
}
})
manifest.favours
.filter(x => x.rankUpReward && x.requiredLevel <= newLevel)
.forEach(x => {
syndicate.FreeFavorsEarned ??= [];
if (!syndicate.FreeFavorsEarned.includes(x.requiredLevel)) {
syndicate.FreeFavorsEarned.push(x.requiredLevel);
}
});
}
syndicate.Title = newLevel;
await inventory.save();