move version_compare to inventoryHelpers
This commit is contained in:
parent
061e858af3
commit
a08f3e6121
@ -25,11 +25,10 @@ import { logger } from "@/src/utils/logger";
|
||||
import { catBreadHash } from "@/src/helpers/stringHelpers";
|
||||
import { Types } from "mongoose";
|
||||
import { isNemesisCompatibleWithVersion } from "@/src/helpers/nemesisHelpers";
|
||||
import { version_compare } from "@/src/services/worldStateService";
|
||||
import { getPersonalRooms } from "@/src/services/personalRoomsService";
|
||||
import { IPersonalRoomsClient } from "@/src/types/personalRoomsTypes";
|
||||
import { Ship } from "@/src/models/shipModel";
|
||||
import { toLegacyOid } from "@/src/helpers/inventoryHelpers";
|
||||
import { toLegacyOid, version_compare } from "@/src/helpers/inventoryHelpers";
|
||||
|
||||
export const inventoryController: RequestHandler = async (request, response) => {
|
||||
const account = await getAccountForRequest(request);
|
||||
|
@ -7,7 +7,7 @@ import { Account } from "@/src/models/loginModel";
|
||||
import { createAccount, isCorrectPassword, isNameTaken } from "@/src/services/loginService";
|
||||
import { IDatabaseAccountJson, ILoginRequest, ILoginResponse } from "@/src/types/loginTypes";
|
||||
import { logger } from "@/src/utils/logger";
|
||||
import { version_compare } from "@/src/services/worldStateService";
|
||||
import { version_compare } from "@/src/helpers/inventoryHelpers";
|
||||
|
||||
export const loginController: RequestHandler = async (request, response) => {
|
||||
const loginRequest = JSON.parse(String(request.body)) as ILoginRequest; // parse octet stream of json data to json object
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { version_compare } from "@/src/helpers/inventoryHelpers";
|
||||
import { Alliance, Guild, GuildMember } from "@/src/models/guildModel";
|
||||
import { hasGuildPermissionEx } from "@/src/services/guildService";
|
||||
import { getInventory } from "@/src/services/inventoryService";
|
||||
import { getAccountForRequest, getSuffixedName } from "@/src/services/loginService";
|
||||
import { version_compare } from "@/src/services/worldStateService";
|
||||
import { GuildPermission, ILongMOTD } from "@/src/types/guildTypes";
|
||||
import { RequestHandler } from "express";
|
||||
|
||||
|
@ -2,6 +2,23 @@ import { IMongoDate, IOid, IOidWithLegacySupport } from "@/src/types/commonTypes
|
||||
import { Types } from "mongoose";
|
||||
import { TRarity } from "warframe-public-export-plus";
|
||||
|
||||
export const version_compare = (a: string, b: string): number => {
|
||||
const a_digits = a
|
||||
.split("/")[0]
|
||||
.split(".")
|
||||
.map(x => parseInt(x));
|
||||
const b_digits = b
|
||||
.split("/")[0]
|
||||
.split(".")
|
||||
.map(x => parseInt(x));
|
||||
for (let i = 0; i != a_digits.length; ++i) {
|
||||
if (a_digits[i] != b_digits[i]) {
|
||||
return a_digits[i] > b_digits[i] ? 1 : -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
export const toOid = (objectId: Types.ObjectId): IOid => {
|
||||
return { $oid: objectId.toString() } satisfies IOid;
|
||||
};
|
||||
|
@ -6,9 +6,10 @@ import { logger } from "../utils/logger";
|
||||
import { IOid } from "../types/commonTypes";
|
||||
import { Types } from "mongoose";
|
||||
import { addMods, generateRewardSeed } from "../services/inventoryService";
|
||||
import { isArchwingMission, version_compare } from "../services/worldStateService";
|
||||
import { isArchwingMission } from "../services/worldStateService";
|
||||
import { fromStoreItem, toStoreItem } from "../services/itemDataService";
|
||||
import { createMessage } from "../services/inboxService";
|
||||
import { version_compare } from "./inventoryHelpers";
|
||||
|
||||
export const getInfNodes = (faction: string, rank: number): IInfNode[] => {
|
||||
const infNodes = [];
|
||||
|
@ -18,6 +18,7 @@ import {
|
||||
ISyndicateMissionInfo,
|
||||
IWorldState
|
||||
} from "../types/worldStateTypes";
|
||||
import { version_compare } from "../helpers/inventoryHelpers";
|
||||
|
||||
const sortieBosses = [
|
||||
"SORTIE_BOSS_HYENA",
|
||||
@ -1239,20 +1240,3 @@ export const isArchwingMission = (node: IRegion): boolean => {
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
export const version_compare = (a: string, b: string): number => {
|
||||
const a_digits = a
|
||||
.split("/")[0]
|
||||
.split(".")
|
||||
.map(x => parseInt(x));
|
||||
const b_digits = b
|
||||
.split("/")[0]
|
||||
.split(".")
|
||||
.map(x => parseInt(x));
|
||||
for (let i = 0; i != a_digits.length; ++i) {
|
||||
if (a_digits[i] != b_digits[i]) {
|
||||
return a_digits[i] > b_digits[i] ? 1 : -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user