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

XFESpaceNinjaServer

A simple server for a small space ninja game

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

XFEstudio/XFESpaceNinjaServer

fix: can't acquire Sun & Moon (#865)

6a427018
Sainan <sainan@calamity.inc>
提交于

代码差异

2 个文件 +16 -27
Modified src/services/inventoryService.ts +16 -12
@@ -29,7 +29,7 @@ import {
29 29 IUpdateChallengeProgressRequest
30 30 } from "../types/requestTypes";
31 31 import { logger } from "@/src/utils/logger";
32 import { getWeaponType, getExalted, getKeyChainItems } from "@/src/services/itemDataService";
32 import { getExalted, getKeyChainItems } from "@/src/services/itemDataService";
33 33 import { IEquipmentClient, IItemConfig } from "../types/inventoryTypes/commonInventoryTypes";
34 34 import {
35 35 ExportArcanes,
@@ -40,6 +40,7 @@ import {
40 40 ExportResources,
41 41 ExportSentinels,
42 42 ExportUpgrades,
43 ExportWeapons,
43 44 TStandingLimitBin
44 45 } from "warframe-public-export-plus";
45 46 import { createShip } from "./shipService";
@@ -288,6 +289,20 @@ export const addItem = async (
288 289 }
289 290 };
290 291 }
292 if (typeName in ExportWeapons) {
293 const weapon = ExportWeapons[typeName];
294 // Many non-weapon items are "Pistols" in Public Export, so some duck typing is needed.
295 if (weapon.totalDamage != 0) {
296 const inventoryChanges = addEquipment(inventory, weapon.productCategory, typeName);
297 updateSlots(inventory, InventorySlot.WEAPONS, 0, 1);
298 return {
299 InventoryChanges: {
300 ...inventoryChanges,
301 WeaponBin: { count: 1, platinum: 0, Slots: -1 }
302 }
303 };
304 }
305 }
291 306 if (typeName in creditBundles) {
292 307 const creditsTotal = creditBundles[typeName] * quantity;
293 308 inventory.RegularCredits += creditsTotal;
@@ -355,17 +370,6 @@ export const addItem = async (
355 370 }
356 371 }
357 372 break;
358 case "Weapons": {
359 const weaponType = getWeaponType(typeName);
360 const inventoryChanges = addEquipment(inventory, weaponType, typeName);
361 updateSlots(inventory, InventorySlot.WEAPONS, 0, 1);
362 return {
363 InventoryChanges: {
364 ...inventoryChanges,
365 WeaponBin: { count: 1, platinum: 0, Slots: -1 }
366 }
367 };
368 }
369 373 case "Upgrades": {
370 374 // Needed to add Traumatic Peculiar
371 375 const changes = [
Modified src/services/itemDataService.ts +0 -15
@@ -44,21 +44,6 @@ export type WeaponTypeInternal =
44 44 | "OperatorAmps"
45 45 | "SpecialItems";
46 46
47 export const getWeaponType = (weaponName: string): WeaponTypeInternal => {
48 const weaponInfo = ExportWeapons[weaponName];
49
50 if (!weaponInfo) {
51 throw new Error(`unknown weapon ${weaponName}`);
52 }
53
54 // Many non-weapon items are "Pistols" in Public Export, so some duck typing is needed.
55 if (weaponInfo.totalDamage == 0) {
56 throw new Error(`${weaponName} doesn't quack like a weapon`);
57 }
58
59 return weaponInfo.productCategory;
60 };
61
62 47 export const getRecipe = (uniqueName: string): IRecipe | undefined => {
63 48 return ExportRecipes[uniqueName];
64 49 };