Run lint
All checks were successful
Build / build (pull_request) Successful in 1m11s

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