返回提交历史
Modified
src/models/inventoryModels/inventoryModel.ts
+3
-1
Modified
src/services/inventoryService.ts
+26
-1
Modified
src/services/itemDataService.ts
+15
-0
Modified
src/types/inventoryTypes/inventoryTypes.ts
+1
-1
XFEstudio/XFESpaceNinjaServer
Auto adding exalted items (#277)
Co-authored-by: AMelonInsideLemon <AMelonInsideLemon@users.noreply.github.com>
01a9bf24
代码差异
4 个文件
+45
-3
@@ -381,6 +381,7 @@ DuviriInfoSchema.set("toJSON", {
381
381
}
382
382
});
383
383
384
// eslint-disable-next-line @typescript-eslint/no-unused-vars
384
385
const GenericItemSchema2 = new Schema<IGenericItem2>({
385
386
ItemType: String,
386
387
ItemName: String,
@@ -703,7 +704,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
703
704
//Melee Weapon
704
705
Melee: [WeaponSchema],
705
706
//Ability Weapon like Ultimate Mech\Excalibur\Ivara etc
706
SpecialItems: [GenericItemSchema2],
707
SpecialItems: [GenericItemSchema],
707
708
//The Mandachord(Octavia) is a step sequencer
708
709
StepSequencers: [StepSequencersSchema],
709
710
@@ -1006,6 +1007,7 @@ type InventoryDocumentProps = {
1006
1007
MiscItems: Types.DocumentArray<IMiscItem>;
1007
1008
Boosters: Types.DocumentArray<IBooster>;
1008
1009
OperatorLoadOuts: Types.DocumentArray<IOperatorConfigClient>;
1010
SpecialItems: Types.DocumentArray<IGenericItem>;
1009
1011
AdultOperatorLoadOuts: Types.DocumentArray<IOperatorConfigClient>; //TODO: this should still contain _id
1010
1012
MechSuits: Types.DocumentArray<ISuitDatabase>;
1011
1013
Scoops: Types.DocumentArray<IGenericItem>;
@@ -24,7 +24,7 @@ import {
24
24
IUpdateChallengeProgressRequest
25
25
} from "../types/requestTypes";
26
26
import { logger } from "@/src/utils/logger";
27
import { WeaponTypeInternal } from "@/src/services/itemDataService";
27
import { WeaponTypeInternal, getExalted } from "@/src/services/itemDataService";
28
28
import { ISyndicateSacrifice, ISyndicateSacrificeResponse } from "../types/syndicateTypes";
29
29
30
30
export const createInventory = async (
@@ -74,6 +74,12 @@ export const addSentinel = async (sentinelName: string, accountId: string) => {
74
74
};
75
75
76
76
export const addPowerSuit = async (powersuitName: string, accountId: string): Promise<ISuitClient> => {
77
const specialItems = getExalted(powersuitName);
78
if (specialItems != false) {
79
for await (const specialItem of specialItems) {
80
await addSpecialItem(specialItem, accountId);
81
}
82
}
77
83
const inventory = await getInventory(accountId);
78
84
const suitIndex = inventory.Suits.push({ ItemType: powersuitName, Configs: [], UpgradeVer: 101, XP: 0 });
79
85
const changedInventory = await inventory.save();
@@ -81,12 +87,31 @@ export const addPowerSuit = async (powersuitName: string, accountId: string): Pr
81
87
};
82
88
83
89
export const addMechSuit = async (mechsuitName: string, accountId: string) => {
90
const specialItems = getExalted(mechsuitName);
91
if (specialItems != false) {
92
for await (const specialItem of specialItems) {
93
await addSpecialItem(specialItem, accountId);
94
}
95
}
84
96
const inventory = await getInventory(accountId);
85
97
const suitIndex = inventory.MechSuits.push({ ItemType: mechsuitName, Configs: [], UpgradeVer: 101, XP: 0 });
86
98
const changedInventory = await inventory.save();
87
99
return changedInventory.MechSuits[suitIndex - 1].toJSON();
88
100
};
89
101
102
export const addSpecialItem = async (itemName: string, accountId: string) => {
103
const inventory = await getInventory(accountId);
104
const specialItemIndex = inventory.SpecialItems.push({
105
ItemType: itemName,
106
Configs: [],
107
Features: 1,
108
UpgradeVer: 101,
109
XP: 0
110
});
111
const changedInventory = await inventory.save();
112
return changedInventory.SpecialItems[specialItemIndex - 1].toJSON();
113
};
114
90
115
export const updateSlots = async (accountId: string, slotName: SlotNames, slotAmount: number, extraAmount: number) => {
91
116
const inventory = await getInventory(accountId);
92
117
@@ -3,6 +3,7 @@ import { logger } from "@/src/utils/logger";
3
3
import Items, { Buildable, Category, MinimalItem, Warframe, Weapon } from "warframe-items";
4
4
import badItems from "@/static/json/exclude-mods.json";
5
5
import dict_en from "@/node_modules/warframe-public-export-plus/dict.en.json";
6
import exportSuits from "@/node_modules/warframe-public-export-plus/ExportWarframes.json";
6
7
7
8
export type MinWarframe = Omit<Warframe, "patchlogs">;
8
9
export type MinWeapon = Omit<Weapon, "patchlogs">;
@@ -109,6 +110,15 @@ export const getItemByBlueprint = (uniqueName: string): (MinItem & Buildable) |
109
110
return item;
110
111
};
111
112
113
export const getExalted = (uniqueName: string) => {
114
const suit = getSuitByUniqueName(uniqueName);
115
if (suit?.exalted !== undefined) {
116
return suit.exalted;
117
} else {
118
return false;
119
}
120
};
121
112
122
export const getItemCategoryByUniqueName = (uniqueName: string) => {
113
123
//Lotus/Types/Items/MiscItems/PolymerBundle
114
124
@@ -126,6 +136,11 @@ export const getItemCategoryByUniqueName = (uniqueName: string) => {
126
136
return category;
127
137
};
128
138
139
export const getSuitByUniqueName = (uniqueName: string) => {
140
const suit = exportSuits.find(suit => suit.uniqueName === uniqueName);
141
return suit;
142
};
143
129
144
export const getItemByUniqueName = (uniqueName: string) => {
130
145
const item = items.find(item => item.uniqueName === uniqueName);
131
146
return item;
@@ -231,7 +231,7 @@ export interface IInventoryResponse {
231
231
AlignmentReplay: IAlignment;
232
232
PersonalGoalProgress: IPersonalGoalProgress[];
233
233
DailyAffiliationSolaris: number;
234
SpecialItems: IGenericItem2[];
234
SpecialItems: IGenericItem[];
235
235
ThemeStyle: string;
236
236
ThemeBackground: string;
237
237
ThemeSounds: string;