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

This commit is contained in:
Sainan 2025-01-25 06:25:13 +01:00 committed by GitHub
parent b72a0d12ef
commit 6a427018e3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 27 deletions

View File

@ -29,7 +29,7 @@ import {
IUpdateChallengeProgressRequest IUpdateChallengeProgressRequest
} from "../types/requestTypes"; } from "../types/requestTypes";
import { logger } from "@/src/utils/logger"; import { logger } from "@/src/utils/logger";
import { getWeaponType, getExalted, getKeyChainItems } from "@/src/services/itemDataService"; import { getExalted, getKeyChainItems } from "@/src/services/itemDataService";
import { IEquipmentClient, IItemConfig } from "../types/inventoryTypes/commonInventoryTypes"; import { IEquipmentClient, IItemConfig } from "../types/inventoryTypes/commonInventoryTypes";
import { import {
ExportArcanes, ExportArcanes,
@ -40,6 +40,7 @@ import {
ExportResources, ExportResources,
ExportSentinels, ExportSentinels,
ExportUpgrades, ExportUpgrades,
ExportWeapons,
TStandingLimitBin TStandingLimitBin
} from "warframe-public-export-plus"; } from "warframe-public-export-plus";
import { createShip } from "./shipService"; import { createShip } from "./shipService";
@ -288,6 +289,20 @@ export const addItem = async (
} }
}; };
} }
if (typeName in ExportWeapons) {
const weapon = ExportWeapons[typeName];
// Many non-weapon items are "Pistols" in Public Export, so some duck typing is needed.
if (weapon.totalDamage != 0) {
const inventoryChanges = addEquipment(inventory, weapon.productCategory, typeName);
updateSlots(inventory, InventorySlot.WEAPONS, 0, 1);
return {
InventoryChanges: {
...inventoryChanges,
WeaponBin: { count: 1, platinum: 0, Slots: -1 }
}
};
}
}
if (typeName in creditBundles) { if (typeName in creditBundles) {
const creditsTotal = creditBundles[typeName] * quantity; const creditsTotal = creditBundles[typeName] * quantity;
inventory.RegularCredits += creditsTotal; inventory.RegularCredits += creditsTotal;
@ -355,17 +370,6 @@ export const addItem = async (
} }
} }
break; break;
case "Weapons": {
const weaponType = getWeaponType(typeName);
const inventoryChanges = addEquipment(inventory, weaponType, typeName);
updateSlots(inventory, InventorySlot.WEAPONS, 0, 1);
return {
InventoryChanges: {
...inventoryChanges,
WeaponBin: { count: 1, platinum: 0, Slots: -1 }
}
};
}
case "Upgrades": { case "Upgrades": {
// Needed to add Traumatic Peculiar // Needed to add Traumatic Peculiar
const changes = [ const changes = [

View File

@ -44,21 +44,6 @@ export type WeaponTypeInternal =
| "OperatorAmps" | "OperatorAmps"
| "SpecialItems"; | "SpecialItems";
export const getWeaponType = (weaponName: string): WeaponTypeInternal => {
const weaponInfo = ExportWeapons[weaponName];
if (!weaponInfo) {
throw new Error(`unknown weapon ${weaponName}`);
}
// Many non-weapon items are "Pistols" in Public Export, so some duck typing is needed.
if (weaponInfo.totalDamage == 0) {
throw new Error(`${weaponName} doesn't quack like a weapon`);
}
return weaponInfo.productCategory;
};
export const getRecipe = (uniqueName: string): IRecipe | undefined => { export const getRecipe = (uniqueName: string): IRecipe | undefined => {
return ExportRecipes[uniqueName]; return ExportRecipes[uniqueName];
}; };