chore: fix some eslint warnings #1007
@ -39,7 +39,7 @@ const awakeningRewards = [
 | 
			
		||||
export const addStartingGear = async (
 | 
			
		||||
    inventory: HydratedDocument<IInventoryDatabase, InventoryDocumentProps>,
 | 
			
		||||
    startingGear: TPartialStartingGear | undefined = undefined
 | 
			
		||||
) => {
 | 
			
		||||
): Promise<IInventoryChanges> => {
 | 
			
		||||
    const { LongGuns, Pistols, Suits, Melee } = startingGear || {
 | 
			
		||||
        LongGuns: [{ ItemType: "/Lotus/Weapons/Tenno/Rifle/Rifle" }],
 | 
			
		||||
        Pistols: [{ ItemType: "/Lotus/Weapons/Tenno/Pistol/Pistol" }],
 | 
			
		||||
 | 
			
		||||
@ -249,7 +249,7 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
 | 
			
		||||
            const suit = inventory.Suits.id(request.SuitId.$oid)!;
 | 
			
		||||
            inventory.Suits.pull(suit);
 | 
			
		||||
            const consumedSuit: IConsumedSuit = { s: suit.ItemType };
 | 
			
		||||
            if (suit.Configs && suit.Configs[0] && suit.Configs[0].pricol) {
 | 
			
		||||
            if (suit.Configs[0] && suit.Configs[0].pricol) {
 | 
			
		||||
                consumedSuit.c = suit.Configs[0].pricol;
 | 
			
		||||
            }
 | 
			
		||||
            if ((inventory.InfestedFoundry!.XP ?? 0) < 73125_00) {
 | 
			
		||||
 | 
			
		||||
@ -50,6 +50,7 @@ const qualityKeywordToNumber: Record<VoidProjectionQuality, number> = {
 | 
			
		||||
// e.g. "/Lotus/Types/Game/Projections/T2VoidProjectionProteaPrimeDBronze" -> ["Lith", "W5", "VPQ_BRONZE"]
 | 
			
		||||
const parseProjection = (typeName: string): [string, string, VoidProjectionQuality] => {
 | 
			
		||||
    const relic: IRelic | undefined = ExportRelics[typeName];
 | 
			
		||||
    // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
 | 
			
		||||
    if (!relic) {
 | 
			
		||||
        throw new Error(`Unknown projection ${typeName}`);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -39,17 +39,11 @@ const getItemListsController: RequestHandler = (req, response) => {
 | 
			
		||||
    res.miscitems = [];
 | 
			
		||||
    res.Syndicates = [];
 | 
			
		||||
    for (const [uniqueName, item] of Object.entries(ExportWarframes)) {
 | 
			
		||||
        if (
 | 
			
		||||
            item.productCategory == "Suits" ||
 | 
			
		||||
            item.productCategory == "SpaceSuits" ||
 | 
			
		||||
            item.productCategory == "MechSuits"
 | 
			
		||||
        ) {
 | 
			
		||||
            res[item.productCategory].push({
 | 
			
		||||
                uniqueName,
 | 
			
		||||
                name: getString(item.name, lang),
 | 
			
		||||
                exalted: item.exalted
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
        res[item.productCategory].push({
 | 
			
		||||
            uniqueName,
 | 
			
		||||
            name: getString(item.name, lang),
 | 
			
		||||
            exalted: item.exalted
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
    for (const [uniqueName, item] of Object.entries(ExportSentinels)) {
 | 
			
		||||
        if (item.productCategory == "Sentinels") {
 | 
			
		||||
 | 
			
		||||
@ -25,8 +25,10 @@ mongoose
 | 
			
		||||
            cert: fs.readFileSync("static/certs/cert.pem")
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        // eslint-disable-next-line @typescript-eslint/no-misused-promises
 | 
			
		||||
        http.createServer(app).listen(httpPort, () => {
 | 
			
		||||
            logger.info("HTTP server started on port " + httpPort);
 | 
			
		||||
            // eslint-disable-next-line @typescript-eslint/no-misused-promises
 | 
			
		||||
            https.createServer(options, app).listen(httpsPort, () => {
 | 
			
		||||
                logger.info("HTTPS server started on port " + httpsPort);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -808,7 +808,7 @@ detailsSchema.set("toJSON", {
 | 
			
		||||
const EquipmentSchema = new Schema<IEquipmentDatabase>(
 | 
			
		||||
    {
 | 
			
		||||
        ItemType: String,
 | 
			
		||||
        Configs: [ItemConfigSchema],
 | 
			
		||||
        Configs: { type: [ItemConfigSchema], default: [] },
 | 
			
		||||
        UpgradeVer: { type: Number, default: 101 },
 | 
			
		||||
        XP: { type: Number, default: 0 },
 | 
			
		||||
        Features: Number,
 | 
			
		||||
@ -1303,7 +1303,7 @@ inventorySchema.set("toJSON", {
 | 
			
		||||
        if (inventoryDatabase.GuildId) {
 | 
			
		||||
            inventoryResponse.GuildId = toOid(inventoryDatabase.GuildId);
 | 
			
		||||
        }
 | 
			
		||||
        if (inventoryResponse.BlessingCooldown) {
 | 
			
		||||
        if (inventoryDatabase.BlessingCooldown) {
 | 
			
		||||
            inventoryResponse.BlessingCooldown = toMongoDate(inventoryDatabase.BlessingCooldown);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -50,6 +50,7 @@ const convertEquipment = (client: IEquipmentClient): IEquipmentDatabase => {
 | 
			
		||||
        UpgradesExpiry: convertOptionalDate(client.UpgradesExpiry),
 | 
			
		||||
        CrewMembers: client.CrewMembers ? convertCrewShipMembers(client.CrewMembers) : undefined,
 | 
			
		||||
        Details: client.Details ? convertKubrowDetails(client.Details) : undefined,
 | 
			
		||||
        // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
 | 
			
		||||
        Configs: client.Configs
 | 
			
		||||
            ? client.Configs.map(obj =>
 | 
			
		||||
                  Object.fromEntries(
 | 
			
		||||
 | 
			
		||||
@ -27,7 +27,7 @@ export const deleteAllMessagesRead = async (accountId: string): Promise<void> =>
 | 
			
		||||
    await Inbox.deleteMany({ ownerId: accountId, r: true });
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const createNewEventMessages = async (req: Request) => {
 | 
			
		||||
export const createNewEventMessages = async (req: Request): Promise<void> => {
 | 
			
		||||
    const account = await getAccountForRequest(req);
 | 
			
		||||
    const latestEventMessageDate = account.LatestEventMessageDate;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -203,6 +203,7 @@ export const addItem = async (
 | 
			
		||||
            const inventoryChanges = {
 | 
			
		||||
                ...addCrewShip(inventory, typeName),
 | 
			
		||||
                // fix to unlock railjack modding, item bellow supposed to be obtained from archwing quest
 | 
			
		||||
                // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
 | 
			
		||||
                ...(!inventory.CrewShipHarnesses?.length
 | 
			
		||||
                    ? addCrewShipHarness(inventory, "/Lotus/Types/Game/CrewShip/RailJack/DefaultHarness")
 | 
			
		||||
                    : {})
 | 
			
		||||
@ -522,12 +523,14 @@ export const addSentinel = (
 | 
			
		||||
    sentinelName: string,
 | 
			
		||||
    inventoryChanges: IInventoryChanges = {}
 | 
			
		||||
): IInventoryChanges => {
 | 
			
		||||
    // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
 | 
			
		||||
    if (ExportSentinels[sentinelName]?.defaultWeapon) {
 | 
			
		||||
        addSentinelWeapon(inventory, ExportSentinels[sentinelName].defaultWeapon, inventoryChanges);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    const modsToGive: IRawUpgrade[] = [];
 | 
			
		||||
    const configs: IItemConfig[] = [];
 | 
			
		||||
    // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
 | 
			
		||||
    if (ExportSentinels[sentinelName]?.defaultUpgrades) {
 | 
			
		||||
        const upgrades = [];
 | 
			
		||||
        for (const defaultUpgrade of ExportSentinels[sentinelName].defaultUpgrades) {
 | 
			
		||||
 | 
			
		||||
@ -80,7 +80,7 @@ export const creditBundles: Record<string, number> = {
 | 
			
		||||
export const addMissionInventoryUpdates = (
 | 
			
		||||
    inventory: HydratedDocument<IInventoryDatabase, InventoryDocumentProps>,
 | 
			
		||||
    inventoryUpdates: IMissionInventoryUpdateRequest
 | 
			
		||||
) => {
 | 
			
		||||
): Partial<IInventoryDatabase> | undefined => {
 | 
			
		||||
    //TODO: type this properly
 | 
			
		||||
    const inventoryChanges: Partial<IInventoryDatabase> = {};
 | 
			
		||||
    if (inventoryUpdates.MissionFailed === true) {
 | 
			
		||||
@ -287,7 +287,7 @@ export const addMissionRewards = async (
 | 
			
		||||
 | 
			
		||||
        //node based credit rewards for mission completion
 | 
			
		||||
        if (node.missionIndex !== 28) {
 | 
			
		||||
            const levelCreditReward = getLevelCreditRewards(missions?.Tag);
 | 
			
		||||
            const levelCreditReward = getLevelCreditRewards(missions.Tag);
 | 
			
		||||
            missionCompletionCredits += levelCreditReward;
 | 
			
		||||
            inventory.RegularCredits += levelCreditReward;
 | 
			
		||||
            logger.debug(`levelCreditReward ${levelCreditReward}`);
 | 
			
		||||
@ -393,7 +393,7 @@ function getRandomMissionDrops(RewardInfo: IRewardInfo): IRngResult[] {
 | 
			
		||||
    const drops: IRngResult[] = [];
 | 
			
		||||
    if (RewardInfo.node in ExportRegions) {
 | 
			
		||||
        const region = ExportRegions[RewardInfo.node];
 | 
			
		||||
        const rewardManifests = region.rewardManifests ?? [];
 | 
			
		||||
        const rewardManifests = region.rewardManifests;
 | 
			
		||||
 | 
			
		||||
        let rotations: number[] = [];
 | 
			
		||||
        if (RewardInfo.VaultsCracked) {
 | 
			
		||||
 | 
			
		||||
@ -15,6 +15,7 @@ import { logger } from "@/src/utils/logger";
 | 
			
		||||
import { HydratedDocument } from "mongoose";
 | 
			
		||||
import { ExportKeys } from "warframe-public-export-plus";
 | 
			
		||||
import { addFixedLevelRewards } from "./missionInventoryUpdateService";
 | 
			
		||||
import { IInventoryChanges } from "../types/purchaseTypes";
 | 
			
		||||
 | 
			
		||||
export interface IUpdateQuestRequest {
 | 
			
		||||
    QuestKeys: Omit<IQuestKeyDatabase, "CompletionDate">[];
 | 
			
		||||
@ -64,6 +65,7 @@ export const updateQuestStage = (
 | 
			
		||||
 | 
			
		||||
    const questStage = quest.Progress[ChainStage];
 | 
			
		||||
 | 
			
		||||
    // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
 | 
			
		||||
    if (!questStage) {
 | 
			
		||||
        const questStageIndex = quest.Progress.push(questStageUpdate) - 1;
 | 
			
		||||
        if (questStageIndex !== ChainStage) {
 | 
			
		||||
@ -86,6 +88,7 @@ export const addQuestKey = (inventory: TInventoryDatabaseDocument, questKey: IQu
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const completeQuest = async (inventory: TInventoryDatabaseDocument, questKey: string) => {
 | 
			
		||||
    // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
 | 
			
		||||
    const chainStages = ExportKeys[questKey]?.chainStages;
 | 
			
		||||
 | 
			
		||||
    if (!chainStages) {
 | 
			
		||||
@ -164,7 +167,10 @@ export const completeQuest = async (inventory: TInventoryDatabaseDocument, quest
 | 
			
		||||
    //TODO: handle quest completion items
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const giveKeyChainItem = async (inventory: TInventoryDatabaseDocument, keyChainInfo: IKeyChainRequest) => {
 | 
			
		||||
export const giveKeyChainItem = async (
 | 
			
		||||
    inventory: TInventoryDatabaseDocument,
 | 
			
		||||
    keyChainInfo: IKeyChainRequest
 | 
			
		||||
): Promise<IInventoryChanges> => {
 | 
			
		||||
    const inventoryChanges = await addKeyChainItems(inventory, keyChainInfo);
 | 
			
		||||
 | 
			
		||||
    if (isEmptyObject(inventoryChanges)) {
 | 
			
		||||
@ -189,7 +195,7 @@ export const giveKeyChainMessage = async (
 | 
			
		||||
    inventory: TInventoryDatabaseDocument,
 | 
			
		||||
    accountId: string,
 | 
			
		||||
    keyChainInfo: IKeyChainRequest
 | 
			
		||||
) => {
 | 
			
		||||
): Promise<void> => {
 | 
			
		||||
    const keyChainMessage = getKeyChainMessage(keyChainInfo);
 | 
			
		||||
 | 
			
		||||
    const message = {
 | 
			
		||||
 | 
			
		||||
@ -148,7 +148,7 @@ export const handleInventoryItemConfigChange = async (
 | 
			
		||||
 | 
			
		||||
                    const itemEntries = equipment as IItemEntry;
 | 
			
		||||
                    for (const [itemId, itemConfigEntries] of Object.entries(itemEntries)) {
 | 
			
		||||
                        const inventoryItem = inventory[equipmentName].find(item => item._id?.toString() === itemId);
 | 
			
		||||
                        const inventoryItem = inventory[equipmentName].id(itemId);
 | 
			
		||||
 | 
			
		||||
                        if (!inventoryItem) {
 | 
			
		||||
                            throw new Error(`inventory item ${equipmentName} not found with id ${itemId}`);
 | 
			
		||||
 | 
			
		||||
@ -58,6 +58,7 @@ export const updateStats = async (playerStats: TStatsDatabaseDocument, payload:
 | 
			
		||||
                                        break;
 | 
			
		||||
                                    default:
 | 
			
		||||
                                        if (!ignoredCategories.includes(category)) {
 | 
			
		||||
                                            // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
 | 
			
		||||
                                            if (!unknownCategories[action]) {
 | 
			
		||||
                                                unknownCategories[action] = [];
 | 
			
		||||
                                            }
 | 
			
		||||
@ -229,6 +230,7 @@ export const updateStats = async (playerStats: TStatsDatabaseDocument, payload:
 | 
			
		||||
 | 
			
		||||
                        default:
 | 
			
		||||
                            if (!ignoredCategories.includes(category)) {
 | 
			
		||||
                                // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
 | 
			
		||||
                                if (!unknownCategories[action]) {
 | 
			
		||||
                                    unknownCategories[action] = [];
 | 
			
		||||
                                }
 | 
			
		||||
 | 
			
		||||
@ -51,7 +51,7 @@ export interface IInventoryDatabase
 | 
			
		||||
    GuildId?: Types.ObjectId;
 | 
			
		||||
    PendingRecipes: IPendingRecipe[];
 | 
			
		||||
    QuestKeys: IQuestKeyDatabase[];
 | 
			
		||||
    BlessingCooldown: Date;
 | 
			
		||||
    BlessingCooldown?: Date;
 | 
			
		||||
    Ships: Types.ObjectId[];
 | 
			
		||||
    WeaponSkins: IWeaponSkinDatabase[];
 | 
			
		||||
    Upgrades: IUpgradeDatabase[];
 | 
			
		||||
@ -300,7 +300,7 @@ export interface IInventoryClient extends IDailyAffiliations, InventoryClientEqu
 | 
			
		||||
    PlayedParkourTutorial: boolean;
 | 
			
		||||
    SubscribedToEmailsPersonalized: number;
 | 
			
		||||
    InfestedFoundry?: IInfestedFoundryClient;
 | 
			
		||||
    BlessingCooldown: IMongoDate;
 | 
			
		||||
    BlessingCooldown?: IMongoDate;
 | 
			
		||||
    CrewShipRawSalvage: IConsumable[];
 | 
			
		||||
    CrewMembers: ICrewMember[];
 | 
			
		||||
    LotusCustomization: ILotusCustomization;
 | 
			
		||||
@ -309,7 +309,7 @@ export interface IInventoryClient extends IDailyAffiliations, InventoryClientEqu
 | 
			
		||||
    LastInventorySync: IOid;
 | 
			
		||||
    NextRefill: IMongoDate; // Next time argon crystals will have a decay tick
 | 
			
		||||
    FoundToday?: IMiscItem[]; // for Argon Crystals
 | 
			
		||||
    CustomMarkers: ICustomMarkers[];
 | 
			
		||||
    CustomMarkers?: ICustomMarkers[];
 | 
			
		||||
    ActiveLandscapeTraps: any[];
 | 
			
		||||
    EvolutionProgress?: IEvolutionProgress[];
 | 
			
		||||
    RepVotes: any[];
 | 
			
		||||
 | 
			
		||||
@ -33,9 +33,9 @@ const consolelogFormat = format.printf(info => {
 | 
			
		||||
            colors: true
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        return `${info.timestamp} [${info.version}] ${info.level}: ${info.message} ${metadataString}`;
 | 
			
		||||
        return `${info.timestamp as string} [${info.version as string}] ${info.level}: ${info.message as string} ${metadataString}`;
 | 
			
		||||
    }
 | 
			
		||||
    return `${info.timestamp} [${info.version}] ${info.level}: ${info.message}`;
 | 
			
		||||
    return `${info.timestamp as string} [${info.version as string}] ${info.level}: ${info.message as string}`;
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
const fileFormat = format.combine(
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user