diff --git a/src/controllers/api/syndicateSacrificeController.ts b/src/controllers/api/syndicateSacrificeController.ts index b874a653..e6ee04b9 100644 --- a/src/controllers/api/syndicateSacrificeController.ts +++ b/src/controllers/api/syndicateSacrificeController.ts @@ -5,7 +5,6 @@ import { RequestHandler } from "express"; import { getAccountIdForRequest } from "@/src/services/loginService"; // eslint-disable-next-line @typescript-eslint/no-misused-promises const syndicateSacrificeController: RequestHandler = async (request, response) => { - const accountId = await getAccountIdForRequest(request); const body = getJSONfromString(request.body); let reply = {}; @@ -23,4 +22,4 @@ const syndicateSacrificeController: RequestHandler = async (request, response) = response.json(reply); }; -export { syndicateSacrificeController }; \ No newline at end of file +export { syndicateSacrificeController }; diff --git a/src/services/inventoryService.ts b/src/services/inventoryService.ts index 84439ed9..6727a75e 100644 --- a/src/services/inventoryService.ts +++ b/src/services/inventoryService.ts @@ -17,7 +17,12 @@ import { ITypeCount } from "@/src/types/inventoryTypes/inventoryTypes"; import { IGenericUpdate } from "../types/genericUpdate"; -import { IArtifactsRequest, IMissionInventoryUpdateRequest, IThemeUpdateRequest, IUpdateChallengeProgressRequest } from "../types/requestTypes"; +import { + IArtifactsRequest, + IMissionInventoryUpdateRequest, + IThemeUpdateRequest, + IUpdateChallengeProgressRequest +} from "../types/requestTypes"; import { logger } from "@/src/utils/logger"; import { WeaponTypeInternal } from "@/src/services/itemDataService"; import { ISyndicateSacrifice, ISyndicateSacrificeResponse } from "../types/syndicateTypes"; @@ -166,7 +171,10 @@ export const updateTheme = async (data: IThemeUpdateRequest, accountId: string) await inventory.save(); }; -export const syndicateSacrifice = async (data: ISyndicateSacrifice, accountId: string): Promise => { +export const syndicateSacrifice = async ( + data: ISyndicateSacrifice, + accountId: string +): Promise => { const inventory = await getInventory(accountId); const syndicate = inventory.Affiliations.find(x => x.Tag == data.AffiliationTag); const level = data.SacrificeLevel - (syndicate?.Title ?? 0); @@ -176,8 +184,8 @@ export const syndicateSacrifice = async (data: ISyndicateSacrifice, accountId: s Level: data.SacrificeLevel, LevelIncrease: level <= 0 ? 1 : level, NewEpisodeReward: syndicate?.Tag == "RadioLegionIntermission9Syndicate" - } - + }; + if (syndicate?.Title !== undefined) syndicate.Title += 1; await inventory.save(); @@ -320,7 +328,10 @@ export const updateChallengeProgress = async (challenges: IUpdateChallengeProgre await inventory.save(); }; -export const addSeasonalChallengeHistory = (inventory: IInventoryDatabaseDocument, itemsArray: ISeasonChallengeHistory[] | undefined) => { +export const addSeasonalChallengeHistory = ( + inventory: IInventoryDatabaseDocument, + itemsArray: ISeasonChallengeHistory[] | undefined +) => { const category = inventory.SeasonChallengeHistory; itemsArray?.forEach(({ challenge, id }) => { @@ -376,9 +387,10 @@ export const missionInventoryUpdate = async (data: IMissionInventoryUpdateReques // syndicate data.AffiliationChanges?.forEach(affiliation => { - const syndicate = inventory.Affiliations.find(x => x.Tag == affiliation.Tag); + const syndicate = inventory.Affiliations.find(x => x.Tag == affiliation.Tag); if (syndicate !== undefined) { - syndicate.Standing = syndicate.Standing === undefined ? affiliation.Standing : syndicate.Standing + affiliation.Standing; + syndicate.Standing = + syndicate.Standing === undefined ? affiliation.Standing : syndicate.Standing + affiliation.Standing; syndicate.Title = syndicate.Title === undefined ? affiliation.Title : syndicate.Title + affiliation.Title; } else { inventory.Affiliations.push({ @@ -389,7 +401,7 @@ export const missionInventoryUpdate = async (data: IMissionInventoryUpdateReques FreeFavorsUsed: [] }); } - }) + }); // Gear XP gearKeys.forEach(key => addGearExpByCategory(inventory, data[key], key)); diff --git a/src/types/requestTypes.ts b/src/types/requestTypes.ts index 5063d11f..bdb68be4 100644 --- a/src/types/requestTypes.ts +++ b/src/types/requestTypes.ts @@ -27,11 +27,10 @@ export interface IThemeUpdateRequest { Sounds?: string; } -export interface IAffiliationChange -{ - Tag: string, - Standing: number, - Title: number +export interface IAffiliationChange { + Tag: string; + Standing: number; + Title: number; } export interface IUpdateChallengeProgressRequest { diff --git a/src/types/syndicateTypes.ts b/src/types/syndicateTypes.ts index 255548ca..fae4e446 100644 --- a/src/types/syndicateTypes.ts +++ b/src/types/syndicateTypes.ts @@ -10,4 +10,4 @@ export interface ISyndicateSacrificeResponse { LevelIncrease: number; InventoryChanges: any[]; NewEpisodeReward: boolean; -} \ No newline at end of file +}