feat: implement incarnon genesis installation, challenges & skill tree (#333)
This commit is contained in:
parent
c9d4712565
commit
f0bb281f55
42
src/controllers/api/evolveWeaponController.ts
Normal file
42
src/controllers/api/evolveWeaponController.ts
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
import { RequestHandler } from "express";
|
||||||
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
|
import { getInventory } from "@/src/services/inventoryService";
|
||||||
|
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
||||||
|
import { WeaponTypeInternal } from "@/src/services/itemDataService";
|
||||||
|
import { EquipmentFeatures } from "@/src/types/inventoryTypes/commonInventoryTypes";
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||||
|
export const evolveWeaponController: RequestHandler = async (req, res) => {
|
||||||
|
const accountId = await getAccountIdForRequest(req);
|
||||||
|
const inventory = await getInventory(accountId);
|
||||||
|
const payload = getJSONfromString(req.body.toString()) as IEvolveWeaponRequest;
|
||||||
|
console.assert(payload.Action == "EWA_INSTALL");
|
||||||
|
|
||||||
|
// TODO: We should remove the Genesis item & its resources, but currently we don't know these "recipes".
|
||||||
|
|
||||||
|
const item = inventory[payload.Category].find(item => item._id.toString() == (req.query.ItemId as string))!;
|
||||||
|
item.Features ??= 0;
|
||||||
|
item.Features |= EquipmentFeatures.INCARNON_GENESIS;
|
||||||
|
|
||||||
|
item.SkillTree = "0";
|
||||||
|
|
||||||
|
inventory.EvolutionProgress ??= [];
|
||||||
|
if (!inventory.EvolutionProgress.find(entry => entry.ItemType == payload.EvoType)) {
|
||||||
|
inventory.EvolutionProgress.push({
|
||||||
|
Progress: 0,
|
||||||
|
Rank: 1,
|
||||||
|
ItemType: payload.EvoType
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
await inventory.save();
|
||||||
|
res.end();
|
||||||
|
};
|
||||||
|
|
||||||
|
interface IEvolveWeaponRequest {
|
||||||
|
Action: "EWA_INSTALL";
|
||||||
|
Category: WeaponTypeInternal;
|
||||||
|
Recipe: string; // e.g. "/Lotus/Types/Items/MiscItems/IncarnonAdapters/UnlockerBlueprints/DespairIncarnonBlueprint"
|
||||||
|
UninstallRecipe: "";
|
||||||
|
EvoType: string; // e.g. "/Lotus/Weapons/Tenno/ThrowingWeapons/StalkerKunai"
|
||||||
|
}
|
24
src/controllers/api/setWeaponSkillTreeController.ts
Normal file
24
src/controllers/api/setWeaponSkillTreeController.ts
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
import { RequestHandler } from "express";
|
||||||
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
|
import { getInventory } from "@/src/services/inventoryService";
|
||||||
|
import { getJSONfromString } from "@/src/helpers/stringHelpers";
|
||||||
|
import { WeaponTypeInternal } from "@/src/services/itemDataService";
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||||
|
export const setWeaponSkillTreeController: RequestHandler = async (req, res) => {
|
||||||
|
const accountId = await getAccountIdForRequest(req);
|
||||||
|
const inventory = await getInventory(accountId);
|
||||||
|
const payload = getJSONfromString(req.body.toString()) as ISetWeaponSkillTreeRequest;
|
||||||
|
|
||||||
|
const item = inventory[req.query.Category as WeaponTypeInternal].find(
|
||||||
|
item => item._id.toString() == (req.query.ItemId as string)
|
||||||
|
)!;
|
||||||
|
item.SkillTree = payload.SkillTree;
|
||||||
|
|
||||||
|
await inventory.save();
|
||||||
|
res.end();
|
||||||
|
};
|
||||||
|
|
||||||
|
interface ISetWeaponSkillTreeRequest {
|
||||||
|
SkillTree: string;
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
import { IUpgradesRequest } from "@/src/types/requestTypes";
|
import { IUpgradesRequest } from "@/src/types/requestTypes";
|
||||||
import { FocusSchool, IEquipmentDatabase } from "@/src/types/inventoryTypes/commonInventoryTypes";
|
import { FocusSchool, IEquipmentDatabase, EquipmentFeatures } from "@/src/types/inventoryTypes/commonInventoryTypes";
|
||||||
import { IMiscItem, TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes";
|
import { IMiscItem, TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes";
|
||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||||
import { addMiscItems, getInventory, updateCurrency } from "@/src/services/inventoryService";
|
import { addMiscItems, getInventory, updateCurrency } from "@/src/services/inventoryService";
|
||||||
@ -32,7 +32,7 @@ export const upgradesController: RequestHandler = async (req, res) => {
|
|||||||
for (const item of inventory[payload.ItemCategory as TEquipmentKey] as IEquipmentDatabase[]) {
|
for (const item of inventory[payload.ItemCategory as TEquipmentKey] as IEquipmentDatabase[]) {
|
||||||
if (item._id.toString() == payload.ItemId.$oid) {
|
if (item._id.toString() == payload.ItemId.$oid) {
|
||||||
item.Features ??= 0;
|
item.Features ??= 0;
|
||||||
item.Features |= 1;
|
item.Features |= EquipmentFeatures.DOUBLE_CAPACITY;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -42,7 +42,7 @@ export const upgradesController: RequestHandler = async (req, res) => {
|
|||||||
for (const item of inventory[payload.ItemCategory as TEquipmentKey] as IEquipmentDatabase[]) {
|
for (const item of inventory[payload.ItemCategory as TEquipmentKey] as IEquipmentDatabase[]) {
|
||||||
if (item._id.toString() == payload.ItemId.$oid) {
|
if (item._id.toString() == payload.ItemId.$oid) {
|
||||||
item.Features ??= 0;
|
item.Features ??= 0;
|
||||||
item.Features |= 2;
|
item.Features |= EquipmentFeatures.UTILITY_SLOT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -53,7 +53,7 @@ export const upgradesController: RequestHandler = async (req, res) => {
|
|||||||
for (const item of inventory[payload.ItemCategory as TEquipmentKey] as IEquipmentDatabase[]) {
|
for (const item of inventory[payload.ItemCategory as TEquipmentKey] as IEquipmentDatabase[]) {
|
||||||
if (item._id.toString() == payload.ItemId.$oid) {
|
if (item._id.toString() == payload.ItemId.$oid) {
|
||||||
item.Features ??= 0;
|
item.Features ??= 0;
|
||||||
item.Features |= 32;
|
item.Features |= EquipmentFeatures.ARCANE_SLOT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,8 @@ import {
|
|||||||
ITauntHistory,
|
ITauntHistory,
|
||||||
IPeriodicMissionCompletionDatabase,
|
IPeriodicMissionCompletionDatabase,
|
||||||
IPeriodicMissionCompletionResponse,
|
IPeriodicMissionCompletionResponse,
|
||||||
ILoreFragmentScan
|
ILoreFragmentScan,
|
||||||
|
IEvolutionProgress
|
||||||
} from "../../types/inventoryTypes/inventoryTypes";
|
} from "../../types/inventoryTypes/inventoryTypes";
|
||||||
import { IOid } from "../../types/commonTypes";
|
import { IOid } from "../../types/commonTypes";
|
||||||
import {
|
import {
|
||||||
@ -562,6 +563,15 @@ const loreFragmentScansSchema = new Schema<ILoreFragmentScan>(
|
|||||||
{ _id: false }
|
{ _id: false }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const evolutionProgressSchema = new Schema<IEvolutionProgress>(
|
||||||
|
{
|
||||||
|
Progress: Number,
|
||||||
|
Rank: Number,
|
||||||
|
ItemType: String
|
||||||
|
},
|
||||||
|
{ _id: false }
|
||||||
|
);
|
||||||
|
|
||||||
const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
|
const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
|
||||||
{
|
{
|
||||||
accountOwnerId: Schema.Types.ObjectId,
|
accountOwnerId: Schema.Types.ObjectId,
|
||||||
@ -881,7 +891,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
|
|||||||
|
|
||||||
//Progress+Rank+ItemType(ZarimanPumpShotgun)
|
//Progress+Rank+ItemType(ZarimanPumpShotgun)
|
||||||
//https://warframe.fandom.com/wiki/Incarnon
|
//https://warframe.fandom.com/wiki/Incarnon
|
||||||
EvolutionProgress: [Schema.Types.Mixed],
|
EvolutionProgress: { type: [evolutionProgressSchema], default: undefined },
|
||||||
|
|
||||||
//Unknown and system
|
//Unknown and system
|
||||||
DuviriInfo: DuviriInfoSchema,
|
DuviriInfo: DuviriInfoSchema,
|
||||||
|
@ -7,6 +7,7 @@ import { createGuildController } from "@/src/controllers/api/createGuildControll
|
|||||||
import { deleteSessionController } from "@/src/controllers/api/deleteSessionController";
|
import { deleteSessionController } from "@/src/controllers/api/deleteSessionController";
|
||||||
import { dojoController } from "@/src/controllers/api/dojoController";
|
import { dojoController } from "@/src/controllers/api/dojoController";
|
||||||
import { dronesController } from "@/src/controllers/api/dronesController";
|
import { dronesController } from "@/src/controllers/api/dronesController";
|
||||||
|
import { evolveWeaponController } from "@/src/controllers/api/evolveWeaponController";
|
||||||
import { findSessionsController } from "@/src/controllers/api/findSessionsController";
|
import { findSessionsController } from "@/src/controllers/api/findSessionsController";
|
||||||
import { focusController } from "@/src/controllers/api/focusController";
|
import { focusController } from "@/src/controllers/api/focusController";
|
||||||
import { genericUpdateController } from "@/src/controllers/api/genericUpdateController";
|
import { genericUpdateController } from "@/src/controllers/api/genericUpdateController";
|
||||||
@ -47,6 +48,7 @@ import { setActiveShipController } from "@/src/controllers/api/setActiveShipCont
|
|||||||
import { setBootLocationController } from "@/src/controllers/api/setBootLocationController";
|
import { setBootLocationController } from "@/src/controllers/api/setBootLocationController";
|
||||||
import { setShipCustomizationsController } from "@/src/controllers/api/setShipCustomizationsController";
|
import { setShipCustomizationsController } from "@/src/controllers/api/setShipCustomizationsController";
|
||||||
import { setSupportedSyndicateController } from "@/src/controllers/api/setSupportedSyndicateController";
|
import { setSupportedSyndicateController } from "@/src/controllers/api/setSupportedSyndicateController";
|
||||||
|
import { setWeaponSkillTreeController } from "../controllers/api/setWeaponSkillTreeController";
|
||||||
import { shipDecorationsController } from "@/src/controllers/api/shipDecorationsController";
|
import { shipDecorationsController } from "@/src/controllers/api/shipDecorationsController";
|
||||||
import { startDojoRecipeController } from "@/src/controllers/api/startDojoRecipeController";
|
import { startDojoRecipeController } from "@/src/controllers/api/startDojoRecipeController";
|
||||||
import { startRecipeController } from "@/src/controllers/api/startRecipeController";
|
import { startRecipeController } from "@/src/controllers/api/startRecipeController";
|
||||||
@ -97,6 +99,7 @@ apiRouter.post("/addFriendImage.php", addFriendImageController);
|
|||||||
apiRouter.post("/artifacts.php", artifactsController);
|
apiRouter.post("/artifacts.php", artifactsController);
|
||||||
apiRouter.post("/claimCompletedRecipe.php", claimCompletedRecipeController);
|
apiRouter.post("/claimCompletedRecipe.php", claimCompletedRecipeController);
|
||||||
apiRouter.post("/createGuild.php", createGuildController);
|
apiRouter.post("/createGuild.php", createGuildController);
|
||||||
|
apiRouter.post("/evolveWeapon.php", evolveWeaponController);
|
||||||
apiRouter.post("/findSessions.php", findSessionsController);
|
apiRouter.post("/findSessions.php", findSessionsController);
|
||||||
apiRouter.post("/focus.php", focusController);
|
apiRouter.post("/focus.php", focusController);
|
||||||
apiRouter.post("/genericUpdate.php", genericUpdateController);
|
apiRouter.post("/genericUpdate.php", genericUpdateController);
|
||||||
@ -115,6 +118,7 @@ apiRouter.post("/rerollRandomMod.php", rerollRandomModController);
|
|||||||
apiRouter.post("/saveLoadout.php", saveLoadoutController);
|
apiRouter.post("/saveLoadout.php", saveLoadoutController);
|
||||||
apiRouter.post("/sell.php", sellController);
|
apiRouter.post("/sell.php", sellController);
|
||||||
apiRouter.post("/setShipCustomizations.php", setShipCustomizationsController);
|
apiRouter.post("/setShipCustomizations.php", setShipCustomizationsController);
|
||||||
|
apiRouter.post("/setWeaponSkillTree.php", setWeaponSkillTreeController);
|
||||||
apiRouter.post("/shipDecorations.php", shipDecorationsController);
|
apiRouter.post("/shipDecorations.php", shipDecorationsController);
|
||||||
apiRouter.post("/startDojoRecipe.php", startDojoRecipeController);
|
apiRouter.post("/startDojoRecipe.php", startDojoRecipeController);
|
||||||
apiRouter.post("/startRecipe.php", startRecipeController);
|
apiRouter.post("/startRecipe.php", startRecipeController);
|
||||||
|
@ -629,6 +629,22 @@ export const missionInventoryUpdate = async (data: IMissionInventoryUpdateReques
|
|||||||
// Gear XP
|
// Gear XP
|
||||||
gearKeys.forEach(key => addGearExpByCategory(inventory, data[key], key));
|
gearKeys.forEach(key => addGearExpByCategory(inventory, data[key], key));
|
||||||
|
|
||||||
|
// Incarnon Challenges
|
||||||
|
if (data.EvolutionProgress) {
|
||||||
|
for (const evoProgress of data.EvolutionProgress) {
|
||||||
|
const entry = inventory.EvolutionProgress
|
||||||
|
? inventory.EvolutionProgress.find(entry => entry.ItemType == evoProgress.ItemType)
|
||||||
|
: undefined;
|
||||||
|
if (entry) {
|
||||||
|
entry.Progress = evoProgress.Progress;
|
||||||
|
entry.Rank = evoProgress.Rank;
|
||||||
|
} else {
|
||||||
|
inventory.EvolutionProgress ??= [];
|
||||||
|
inventory.EvolutionProgress.push(evoProgress);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// other
|
// other
|
||||||
addMods(inventory, RawUpgrades);
|
addMods(inventory, RawUpgrades);
|
||||||
addMiscItems(inventory, MiscItems);
|
addMiscItems(inventory, MiscItems);
|
||||||
|
@ -82,6 +82,13 @@ export interface IEquipmentClient extends Omit<IEquipmentDatabase, "_id"> {
|
|||||||
ItemId: IOid;
|
ItemId: IOid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum EquipmentFeatures {
|
||||||
|
DOUBLE_CAPACITY = 1,
|
||||||
|
UTILITY_SLOT = 2,
|
||||||
|
ARCANE_SLOT = 32,
|
||||||
|
INCARNON_GENESIS = 512
|
||||||
|
}
|
||||||
|
|
||||||
export interface IEquipmentDatabase {
|
export interface IEquipmentDatabase {
|
||||||
ItemType: string;
|
ItemType: string;
|
||||||
ItemName?: string;
|
ItemName?: string;
|
||||||
|
@ -246,7 +246,7 @@ export interface IInventoryResponse {
|
|||||||
LastInventorySync: IOid;
|
LastInventorySync: IOid;
|
||||||
NextRefill: IMongoDate;
|
NextRefill: IMongoDate;
|
||||||
ActiveLandscapeTraps: any[];
|
ActiveLandscapeTraps: any[];
|
||||||
EvolutionProgress: any[];
|
EvolutionProgress?: IEvolutionProgress[];
|
||||||
RepVotes: any[];
|
RepVotes: any[];
|
||||||
LeagueTickets: any[];
|
LeagueTickets: any[];
|
||||||
Quests: any[];
|
Quests: any[];
|
||||||
@ -867,3 +867,9 @@ export interface IWebFlags {
|
|||||||
Anniversary2021: boolean;
|
Anniversary2021: boolean;
|
||||||
HitDownloadBtn: IMongoDate;
|
HitDownloadBtn: IMongoDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface IEvolutionProgress {
|
||||||
|
Progress: number;
|
||||||
|
Rank: number;
|
||||||
|
ItemType: string;
|
||||||
|
}
|
||||||
|
@ -5,6 +5,7 @@ import {
|
|||||||
IChallengeProgress,
|
IChallengeProgress,
|
||||||
IConsumable,
|
IConsumable,
|
||||||
ICrewShipSalvagedWeaponSkin,
|
ICrewShipSalvagedWeaponSkin,
|
||||||
|
IEvolutionProgress,
|
||||||
IMiscItem,
|
IMiscItem,
|
||||||
IMission,
|
IMission,
|
||||||
IRawUpgrade,
|
IRawUpgrade,
|
||||||
@ -53,6 +54,7 @@ export interface IMissionInventoryUpdateRequest {
|
|||||||
RewardInfo?: IMissionInventoryUpdateRequestRewardInfo;
|
RewardInfo?: IMissionInventoryUpdateRequestRewardInfo;
|
||||||
FusionPoints?: number;
|
FusionPoints?: number;
|
||||||
Missions?: IMission;
|
Missions?: IMission;
|
||||||
|
EvolutionProgress?: IEvolutionProgress[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IMissionInventoryUpdateRequestRewardInfo {
|
export interface IMissionInventoryUpdateRequestRewardInfo {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user