返回提交历史
Modified
src/controllers/api/focusController.ts
+2
-2
Modified
src/controllers/api/modularWeaponCraftingController.ts
+11
-6
Modified
src/controllers/custom/addItemController.ts
+2
-2
Modified
src/models/inventoryModels/inventoryModel.ts
+1
-0
Modified
src/services/inventoryService.ts
+8
-8
Modified
src/types/inventoryTypes/inventoryTypes.ts
+3
-1
XFEstudio/XFESpaceNinjaServer
feat: moa pet assembly (#423)
81cc773f
代码差异
6 个文件
+27
-19
@@ -1,6 +1,6 @@
1
1
import { RequestHandler } from "express";
2
2
import { getAccountIdForRequest } from "@/src/services/loginService";
3
import { getInventory, addMiscItems, addWeapon } from "@/src/services/inventoryService";
3
import { getInventory, addMiscItems, addEquipment } from "@/src/services/inventoryService";
4
4
import { IMiscItem, TFocusPolarity } from "@/src/types/inventoryTypes/inventoryTypes";
5
5
import { logger } from "@/src/utils/logger";
6
6
import { ExportFocusUpgrades } from "warframe-public-export-plus";
@@ -81,7 +81,7 @@ export const focusController: RequestHandler = async (req, res) => {
81
81
"/Lotus/Weapons/Sentients/OperatorAmplifiers/SentTrainingAmplifier/SentAmpTrainingChassis",
82
82
"/Lotus/Weapons/Sentients/OperatorAmplifiers/SentTrainingAmplifier/SentAmpTrainingBarrel"
83
83
];
84
const result = await addWeapon("OperatorAmps", request.StartingWeaponType, accountId, parts);
84
const result = await addEquipment("OperatorAmps", request.StartingWeaponType, accountId, parts);
85
85
res.json(result);
86
86
break;
87
87
}
@@ -1,17 +1,18 @@
1
1
import { RequestHandler } from "express";
2
2
import { getAccountIdForRequest } from "@/src/services/loginService";
3
3
import { getJSONfromString } from "@/src/helpers/stringHelpers";
4
import { WeaponTypeInternal } from "@/src/services/itemDataService";
5
import { getInventory, updateCurrency, addWeapon, addMiscItems } from "@/src/services/inventoryService";
4
import { TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes";
5
import { getInventory, updateCurrency, addEquipment, addMiscItems } from "@/src/services/inventoryService";
6
6
7
const modularWeaponTypes: Record<string, WeaponTypeInternal | "Hoverboards"> = {
7
const modularWeaponTypes: Record<string, TEquipmentKey> = {
8
8
"/Lotus/Weapons/SolarisUnited/Primary/LotusModularPrimaryBeam": "LongGuns",
9
9
"/Lotus/Weapons/SolarisUnited/Secondary/LotusModularSecondary": "Pistols",
10
10
"/Lotus/Weapons/SolarisUnited/Secondary/LotusModularSecondaryBeam": "Pistols",
11
11
"/Lotus/Weapons/SolarisUnited/Secondary/LotusModularSecondaryShotgun": "Pistols",
12
12
"/Lotus/Weapons/Ostron/Melee/LotusModularWeapon": "Melee",
13
13
"/Lotus/Weapons/Sentients/OperatorAmplifiers/OperatorAmpWeapon": "OperatorAmps",
14
"/Lotus/Types/Vehicles/Hoverboard/HoverboardSuit": "Hoverboards"
14
"/Lotus/Types/Vehicles/Hoverboard/HoverboardSuit": "Hoverboards",
15
"/Lotus/Types/Friendly/Pets/MoaPets/MoaPetPowerSuit": "MoaPets"
15
16
};
16
17
17
18
interface IModularCraftRequest {
@@ -29,10 +30,14 @@ export const modularWeaponCraftingController: RequestHandler = async (req, res)
29
30
const category = modularWeaponTypes[data.WeaponType];
30
31
31
32
// Give weapon
32
const weapon = await addWeapon(category, data.WeaponType, accountId, data.Parts);
33
const weapon = await addEquipment(category, data.WeaponType, accountId, data.Parts);
33
34
34
35
// Remove credits
35
const currencyChanges = await updateCurrency(category == "Hoverboards" ? 5000 : 4000, false, accountId);
36
const currencyChanges = await updateCurrency(
37
category == "Hoverboards" || category == "MoaPets" ? 5000 : 4000,
38
false,
39
accountId
40
);
36
41
37
42
// Remove parts
38
43
const miscItemChanges = [];
@@ -1,7 +1,7 @@
1
1
import { getAccountIdForRequest } from "@/src/services/loginService";
2
2
import { ItemType, toAddItemRequest } from "@/src/helpers/customHelpers/addItemHelpers";
3
3
import { getWeaponType } from "@/src/services/itemDataService";
4
import { addPowerSuit, addWeapon } from "@/src/services/inventoryService";
4
import { addPowerSuit, addEquipment } from "@/src/services/inventoryService";
5
5
import { RequestHandler } from "express";
6
6
7
7
// eslint-disable-next-line @typescript-eslint/no-misused-promises
@@ -16,7 +16,7 @@ const addItemController: RequestHandler = async (req, res) => {
16
16
return;
17
17
case ItemType.Weapon:
18
18
const weaponType = getWeaponType(request.InternalName);
19
const weapon = await addWeapon(weaponType, request.InternalName, accountId);
19
const weapon = await addEquipment(weaponType, request.InternalName, accountId);
20
20
res.json(weapon);
21
21
break;
22
22
default:
@@ -983,6 +983,7 @@ type InventoryDocumentProps = {
983
983
SpaceMelee: Types.DocumentArray<IEquipmentDatabase>;
984
984
SentinelWeapons: Types.DocumentArray<IEquipmentDatabase>;
985
985
Hoverboards: Types.DocumentArray<IEquipmentDatabase>;
986
MoaPets: Types.DocumentArray<IEquipmentDatabase>;
986
987
WeaponSkins: Types.DocumentArray<IWeaponSkinDatabase>;
987
988
};
988
989
@@ -26,7 +26,7 @@ import {
26
26
IUpdateChallengeProgressRequest
27
27
} from "../types/requestTypes";
28
28
import { logger } from "@/src/utils/logger";
29
import { WeaponTypeInternal, getWeaponType, getExalted } from "@/src/services/itemDataService";
29
import { getWeaponType, getExalted } from "@/src/services/itemDataService";
30
30
import { ISyndicateSacrifice, ISyndicateSacrificeResponse } from "../types/syndicateTypes";
31
31
import { IEquipmentClient } from "../types/inventoryTypes/commonInventoryTypes";
32
32
import { ExportCustoms, ExportFlavour, ExportRecipes, ExportResources } from "warframe-public-export-plus";
@@ -172,7 +172,7 @@ export const addItem = async (
172
172
break;
173
173
case "Weapons":
174
174
const weaponType = getWeaponType(typeName);
175
const weapon = await addWeapon(weaponType, typeName, accountId);
175
const weapon = await addEquipment(weaponType, typeName, accountId);
176
176
await updateSlots(accountId, InventorySlot.WEAPONS, 0, 1);
177
177
return {
178
178
InventoryChanges: {
@@ -444,23 +444,23 @@ export const syndicateSacrifice = async (
444
444
return res;
445
445
};
446
446
447
export const addWeapon = async (
448
weaponType: WeaponTypeInternal | "Hoverboards",
449
weaponName: string,
447
export const addEquipment = async (
448
category: TEquipmentKey,
449
type: string,
450
450
accountId: string,
451
451
modularParts: string[] | undefined = undefined
452
452
): Promise<IEquipmentClient> => {
453
453
const inventory = await getInventory(accountId);
454
454
455
const weaponIndex = inventory[weaponType].push({
456
ItemType: weaponName,
455
const index = inventory[category].push({
456
ItemType: type,
457
457
Configs: [],
458
458
XP: 0,
459
459
ModularParts: modularParts
460
460
});
461
461
462
462
const changedInventory = await inventory.save();
463
return changedInventory[weaponType][weaponIndex - 1].toJSON();
463
return changedInventory[category][index - 1].toJSON();
464
464
};
465
465
466
466
export const addCustomization = async (customizatonName: string, accountId: string): Promise<IFlavourItem> => {
@@ -72,7 +72,9 @@ export const equipmentKeys = [
72
72
"SpaceSuits",
73
73
"SpaceGuns",
74
74
"SpaceMelee",
75
"Hoverboards"
75
"Hoverboards",
76
"OperatorAmps",
77
"MoaPets"
76
78
] as const;
77
79
78
80
export type TEquipmentKey = (typeof equipmentKeys)[number];