返回提交历史
Modified
.gitignore
+1
-1
Modified
src/services/inventoryService.ts
+3
-2
Modified
src/services/purchaseService.ts
+8
-2
Modified
src/types/purchaseTypes.ts
+2
-0
Added
static/data/items.ts
+18
-0
XFEstudio/SpaceNinjaServer
fix ignoring static/data files, except .bin (#21)
5838cddb
代码差异
5 个文件
+32
-5
@@ -2,5 +2,5 @@
2
2
/build
3
3
4
4
/.env
5
/static/data/*
5
/static/data/*.bin
6
6
yarn.lock
@@ -5,6 +5,7 @@ import { Types } from "mongoose";
5
5
import { ISuitResponse } from "@/src/types/inventoryTypes/SuitTypes";
6
6
import { SlotType } from "@/src/types/purchaseTypes";
7
7
import { IWeaponResponse } from "@/src/types/inventoryTypes/weaponTypes";
8
import { FlavourItem } from "@/src/types/inventoryTypes/inventoryTypes";
8
9
9
10
const createInventory = async (accountOwnerId: Types.ObjectId) => {
10
11
try {
@@ -97,12 +98,12 @@ export const addWeapon = async (
97
98
return changedInventory[weaponType][weaponIndex - 1].toJSON();
98
99
};
99
100
100
export const addCustomization = async (customizatonName: string, accountId: string) => {
101
export const addCustomization = async (customizatonName: string, accountId: string): Promise<FlavourItem> => {
101
102
const inventory = await getInventory(accountId);
102
103
103
104
const flavourItemIndex = inventory.FlavourItems.push({ ItemType: customizatonName }) - 1;
104
105
const changedInventory = await inventory.save();
105
return changedInventory.FlavourItems[flavourItemIndex].toJSON();
106
return changedInventory.FlavourItems[flavourItemIndex].toJSON(); //mongoose bug forces as FlavourItem
106
107
};
107
108
108
109
export { createInventory, addPowerSuit };
@@ -1,7 +1,13 @@
1
1
import { getWeaponType } from "@/src/helpers/purchaseHelpers";
2
2
import { getSubstringFromKeyword } from "@/src/helpers/stringHelpers";
3
import { addCustomization, addPowerSuit, addWeapon, updateSlots } from "@/src/services/inventoryService";
4
import { IPurchaseRequest, SlotType } from "@/src/types/purchaseTypes";
3
import {
4
addCustomization,
5
addPowerSuit,
6
addWeapon,
7
updateCurrency,
8
updateSlots
9
} from "@/src/services/inventoryService";
10
import { IPurchaseRequest, IPurchaseResponse, SlotType } from "@/src/types/purchaseTypes";
5
11
6
12
export const getStoreItemCategory = (storeItem: string) => {
7
13
const storeItemString = getSubstringFromKeyword(storeItem, "StoreItems/");
@@ -1,5 +1,6 @@
1
1
/* eslint-disable prettier/prettier */
2
2
import { ISuitDatabase } from "@/src/types/inventoryTypes/SuitTypes";
3
import { FlavourItem } from "@/src/types/inventoryTypes/inventoryTypes";
3
4
import { IWeaponResponse } from "@/src/types/inventoryTypes/weaponTypes";
4
5
5
6
export interface IPurchaseRequest {
@@ -28,6 +29,7 @@ export interface IPurchaseResponse {
28
29
Melee?: IWeaponResponse[];
29
30
PremiumCredits?: number;
30
31
RegularCredits?: number;
32
FlavourItems?: FlavourItem[];
31
33
};
32
34
}
33
35
@@ -0,0 +1,18 @@
1
import Items, { Item, Weapon } from "warframe-items";
2
3
type MinWeapon = Omit<Weapon, "patchlogs">;
4
type MinItem = Omit<Item, "patchlogs">;
5
6
export const weapons: MinWeapon[] = (new Items({ category: ["Primary", "Secondary", "Melee"] }) as Weapon[]).map(
7
item => {
8
const next = { ...item };
9
delete next.patchlogs;
10
return next;
11
}
12
);
13
14
export const items: MinItem[] = new Items({ category: ["All"] }).map(item => {
15
const next = { ...item };
16
delete next.patchlogs;
17
return next;
18
});