XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

SpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 1 Star 0
返回提交历史

XFEstudio/SpaceNinjaServer

fix ignoring static/data files, except .bin (#21)

5838cddb
OrdisPrime <134585663+OrdisPrime@users.noreply.github.com>
提交于

代码差异

5 个文件 +32 -5
Modified .gitignore +1 -1
@@ -2,5 +2,5 @@
2 2 /build
3 3
4 4 /.env
5 /static/data/*
5 /static/data/*.bin
6 6 yarn.lock
Modified src/services/inventoryService.ts +3 -2
@@ -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 };
Modified src/services/purchaseService.ts +8 -2
@@ -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/");
Modified src/types/purchaseTypes.ts +2 -0
@@ -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
Added static/data/items.ts +18 -0
@@ -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 });