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