Auto adding exalted items (#277)
Co-authored-by: AMelonInsideLemon <AMelonInsideLemon@users.noreply.github.com>
This commit is contained in:
parent
e35a7fd69f
commit
01a9bf24c3
@ -381,6 +381,7 @@ DuviriInfoSchema.set("toJSON", {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
const GenericItemSchema2 = new Schema<IGenericItem2>({
|
const GenericItemSchema2 = new Schema<IGenericItem2>({
|
||||||
ItemType: String,
|
ItemType: String,
|
||||||
ItemName: String,
|
ItemName: String,
|
||||||
@ -703,7 +704,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
|
|||||||
//Melee Weapon
|
//Melee Weapon
|
||||||
Melee: [WeaponSchema],
|
Melee: [WeaponSchema],
|
||||||
//Ability Weapon like Ultimate Mech\Excalibur\Ivara etc
|
//Ability Weapon like Ultimate Mech\Excalibur\Ivara etc
|
||||||
SpecialItems: [GenericItemSchema2],
|
SpecialItems: [GenericItemSchema],
|
||||||
//The Mandachord(Octavia) is a step sequencer
|
//The Mandachord(Octavia) is a step sequencer
|
||||||
StepSequencers: [StepSequencersSchema],
|
StepSequencers: [StepSequencersSchema],
|
||||||
|
|
||||||
@ -1006,6 +1007,7 @@ type InventoryDocumentProps = {
|
|||||||
MiscItems: Types.DocumentArray<IMiscItem>;
|
MiscItems: Types.DocumentArray<IMiscItem>;
|
||||||
Boosters: Types.DocumentArray<IBooster>;
|
Boosters: Types.DocumentArray<IBooster>;
|
||||||
OperatorLoadOuts: Types.DocumentArray<IOperatorConfigClient>;
|
OperatorLoadOuts: Types.DocumentArray<IOperatorConfigClient>;
|
||||||
|
SpecialItems: Types.DocumentArray<IGenericItem>;
|
||||||
AdultOperatorLoadOuts: Types.DocumentArray<IOperatorConfigClient>; //TODO: this should still contain _id
|
AdultOperatorLoadOuts: Types.DocumentArray<IOperatorConfigClient>; //TODO: this should still contain _id
|
||||||
MechSuits: Types.DocumentArray<ISuitDatabase>;
|
MechSuits: Types.DocumentArray<ISuitDatabase>;
|
||||||
Scoops: Types.DocumentArray<IGenericItem>;
|
Scoops: Types.DocumentArray<IGenericItem>;
|
||||||
|
@ -24,7 +24,7 @@ import {
|
|||||||
IUpdateChallengeProgressRequest
|
IUpdateChallengeProgressRequest
|
||||||
} from "../types/requestTypes";
|
} from "../types/requestTypes";
|
||||||
import { logger } from "@/src/utils/logger";
|
import { logger } from "@/src/utils/logger";
|
||||||
import { WeaponTypeInternal } from "@/src/services/itemDataService";
|
import { WeaponTypeInternal, getExalted } from "@/src/services/itemDataService";
|
||||||
import { ISyndicateSacrifice, ISyndicateSacrificeResponse } from "../types/syndicateTypes";
|
import { ISyndicateSacrifice, ISyndicateSacrificeResponse } from "../types/syndicateTypes";
|
||||||
|
|
||||||
export const createInventory = async (
|
export const createInventory = async (
|
||||||
@ -74,6 +74,12 @@ export const addSentinel = async (sentinelName: string, accountId: string) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const addPowerSuit = async (powersuitName: string, accountId: string): Promise<ISuitClient> => {
|
export const addPowerSuit = async (powersuitName: string, accountId: string): Promise<ISuitClient> => {
|
||||||
|
const specialItems = getExalted(powersuitName);
|
||||||
|
if (specialItems != false) {
|
||||||
|
for await (const specialItem of specialItems) {
|
||||||
|
await addSpecialItem(specialItem, accountId);
|
||||||
|
}
|
||||||
|
}
|
||||||
const inventory = await getInventory(accountId);
|
const inventory = await getInventory(accountId);
|
||||||
const suitIndex = inventory.Suits.push({ ItemType: powersuitName, Configs: [], UpgradeVer: 101, XP: 0 });
|
const suitIndex = inventory.Suits.push({ ItemType: powersuitName, Configs: [], UpgradeVer: 101, XP: 0 });
|
||||||
const changedInventory = await inventory.save();
|
const changedInventory = await inventory.save();
|
||||||
@ -81,12 +87,31 @@ export const addPowerSuit = async (powersuitName: string, accountId: string): Pr
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const addMechSuit = async (mechsuitName: string, accountId: string) => {
|
export const addMechSuit = async (mechsuitName: string, accountId: string) => {
|
||||||
|
const specialItems = getExalted(mechsuitName);
|
||||||
|
if (specialItems != false) {
|
||||||
|
for await (const specialItem of specialItems) {
|
||||||
|
await addSpecialItem(specialItem, accountId);
|
||||||
|
}
|
||||||
|
}
|
||||||
const inventory = await getInventory(accountId);
|
const inventory = await getInventory(accountId);
|
||||||
const suitIndex = inventory.MechSuits.push({ ItemType: mechsuitName, Configs: [], UpgradeVer: 101, XP: 0 });
|
const suitIndex = inventory.MechSuits.push({ ItemType: mechsuitName, Configs: [], UpgradeVer: 101, XP: 0 });
|
||||||
const changedInventory = await inventory.save();
|
const changedInventory = await inventory.save();
|
||||||
return changedInventory.MechSuits[suitIndex - 1].toJSON();
|
return changedInventory.MechSuits[suitIndex - 1].toJSON();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const addSpecialItem = async (itemName: string, accountId: string) => {
|
||||||
|
const inventory = await getInventory(accountId);
|
||||||
|
const specialItemIndex = inventory.SpecialItems.push({
|
||||||
|
ItemType: itemName,
|
||||||
|
Configs: [],
|
||||||
|
Features: 1,
|
||||||
|
UpgradeVer: 101,
|
||||||
|
XP: 0
|
||||||
|
});
|
||||||
|
const changedInventory = await inventory.save();
|
||||||
|
return changedInventory.SpecialItems[specialItemIndex - 1].toJSON();
|
||||||
|
};
|
||||||
|
|
||||||
export const updateSlots = async (accountId: string, slotName: SlotNames, slotAmount: number, extraAmount: number) => {
|
export const updateSlots = async (accountId: string, slotName: SlotNames, slotAmount: number, extraAmount: number) => {
|
||||||
const inventory = await getInventory(accountId);
|
const inventory = await getInventory(accountId);
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ import { logger } from "@/src/utils/logger";
|
|||||||
import Items, { Buildable, Category, MinimalItem, Warframe, Weapon } from "warframe-items";
|
import Items, { Buildable, Category, MinimalItem, Warframe, Weapon } from "warframe-items";
|
||||||
import badItems from "@/static/json/exclude-mods.json";
|
import badItems from "@/static/json/exclude-mods.json";
|
||||||
import dict_en from "@/node_modules/warframe-public-export-plus/dict.en.json";
|
import dict_en from "@/node_modules/warframe-public-export-plus/dict.en.json";
|
||||||
|
import exportSuits from "@/node_modules/warframe-public-export-plus/ExportWarframes.json";
|
||||||
|
|
||||||
export type MinWarframe = Omit<Warframe, "patchlogs">;
|
export type MinWarframe = Omit<Warframe, "patchlogs">;
|
||||||
export type MinWeapon = Omit<Weapon, "patchlogs">;
|
export type MinWeapon = Omit<Weapon, "patchlogs">;
|
||||||
@ -109,6 +110,15 @@ export const getItemByBlueprint = (uniqueName: string): (MinItem & Buildable) |
|
|||||||
return item;
|
return item;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const getExalted = (uniqueName: string) => {
|
||||||
|
const suit = getSuitByUniqueName(uniqueName);
|
||||||
|
if (suit?.exalted !== undefined) {
|
||||||
|
return suit.exalted;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
export const getItemCategoryByUniqueName = (uniqueName: string) => {
|
export const getItemCategoryByUniqueName = (uniqueName: string) => {
|
||||||
//Lotus/Types/Items/MiscItems/PolymerBundle
|
//Lotus/Types/Items/MiscItems/PolymerBundle
|
||||||
|
|
||||||
@ -126,6 +136,11 @@ export const getItemCategoryByUniqueName = (uniqueName: string) => {
|
|||||||
return category;
|
return category;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const getSuitByUniqueName = (uniqueName: string) => {
|
||||||
|
const suit = exportSuits.find(suit => suit.uniqueName === uniqueName);
|
||||||
|
return suit;
|
||||||
|
};
|
||||||
|
|
||||||
export const getItemByUniqueName = (uniqueName: string) => {
|
export const getItemByUniqueName = (uniqueName: string) => {
|
||||||
const item = items.find(item => item.uniqueName === uniqueName);
|
const item = items.find(item => item.uniqueName === uniqueName);
|
||||||
return item;
|
return item;
|
||||||
|
@ -231,7 +231,7 @@ export interface IInventoryResponse {
|
|||||||
AlignmentReplay: IAlignment;
|
AlignmentReplay: IAlignment;
|
||||||
PersonalGoalProgress: IPersonalGoalProgress[];
|
PersonalGoalProgress: IPersonalGoalProgress[];
|
||||||
DailyAffiliationSolaris: number;
|
DailyAffiliationSolaris: number;
|
||||||
SpecialItems: IGenericItem2[];
|
SpecialItems: IGenericItem[];
|
||||||
ThemeStyle: string;
|
ThemeStyle: string;
|
||||||
ThemeBackground: string;
|
ThemeBackground: string;
|
||||||
ThemeSounds: string;
|
ThemeSounds: string;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user