adding special items
auto adds exlated item if suit has it
This commit is contained in:
parent
fd79450957
commit
242c9c2a50
@ -381,29 +381,6 @@ DuviriInfoSchema.set("toJSON", {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const GenericItemSchema2 = new Schema<IGenericItem2>({
|
|
||||||
ItemType: String,
|
|
||||||
ItemName: String,
|
|
||||||
XP: Number,
|
|
||||||
UpgradeVer: Number, //this is probably __v
|
|
||||||
Features: Number,
|
|
||||||
Polarized: Number,
|
|
||||||
CustomizationSlotPurchases: Number,
|
|
||||||
ModSlotPurchases: Number,
|
|
||||||
FocusLens: String,
|
|
||||||
Expiry: Date, //TODO: needs conversion
|
|
||||||
Polarity: [polaritySchema],
|
|
||||||
Configs: [ItemConfigSchema],
|
|
||||||
ModularParts: [String],
|
|
||||||
SkillTree: String,
|
|
||||||
UpgradeType: String,
|
|
||||||
UpgradeFingerprint: String,
|
|
||||||
OffensiveUpgrade: String,
|
|
||||||
DefensiveUpgrade: String,
|
|
||||||
UpgradesExpiry: Date, //TODO: needs conversion
|
|
||||||
ArchonCrystalUpgrades: []
|
|
||||||
});
|
|
||||||
|
|
||||||
const TypeXPItemSchema = new Schema<ITypeXPItem>(
|
const TypeXPItemSchema = new Schema<ITypeXPItem>(
|
||||||
{
|
{
|
||||||
ItemType: String,
|
ItemType: String,
|
||||||
@ -703,7 +680,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 +983,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 = await 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,25 @@ 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 = await 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,8 @@ 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">;
|
||||||
@ -104,6 +106,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
|
||||||
|
|
||||||
@ -121,6 +132,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