Merge branch 'SpecialItems' of https://github.com/AMelonInsideLemon/SpaceNinjaServer into SpecialItems

This commit is contained in:
dutlist 2024-06-04 13:10:59 +02:00
commit e3c0f7eea9
2 changed files with 13 additions and 8 deletions

View File

@ -77,7 +77,7 @@ export const addPowerSuit = async (powersuitName: string, accountId: string): Pr
const specialItems = getExalted(powersuitName); const specialItems = getExalted(powersuitName);
if(specialItems != false){ if(specialItems != false){
for await (const specialItem of specialItems) { for await (const specialItem of specialItems) {
await addSpecialItem(specialItem, accountId) await addSpecialItem(specialItem, accountId);
} }
} }
const inventory = await getInventory(accountId); const inventory = await getInventory(accountId);
@ -90,7 +90,7 @@ export const addMechSuit = async (mechsuitName: string, accountId: string) => {
const specialItems = getExalted(mechsuitName); const specialItems = getExalted(mechsuitName);
if(specialItems != false){ if(specialItems != false){
for await (const specialItem of specialItems) { for await (const specialItem of specialItems) {
await addSpecialItem(specialItem, accountId) await addSpecialItem(specialItem, accountId);
} }
} }
const inventory = await getInventory(accountId); const inventory = await getInventory(accountId);
@ -101,9 +101,15 @@ export const addMechSuit = async (mechsuitName: string, accountId: string) => {
export const addSpecialItem = async (itemName: string, accountId: string) => { export const addSpecialItem = async (itemName: string, accountId: string) => {
const inventory = await getInventory(accountId); const inventory = await getInventory(accountId);
const specialItemIndex = inventory.SpecialItems.push({ ItemType: itemName, Configs: [], Features: 1, UpgradeVer: 101, XP: 0 }); const specialItemIndex = inventory.SpecialItems.push({
ItemType: itemName,
Configs: [],
Features: 1,
UpgradeVer: 101,
XP: 0
});
const changedInventory = await inventory.save(); const changedInventory = await inventory.save();
return changedInventory.SpecialItems[specialItemIndex -1].toJSON(); return changedInventory.SpecialItems[specialItemIndex - 1].toJSON();
}; };
export const updateSlots = async (accountId: string, slotName: SlotNames, slotAmount: number, extraAmount: number) => { export const updateSlots = async (accountId: string, slotName: SlotNames, slotAmount: number, extraAmount: number) => {

View File

@ -5,7 +5,6 @@ import badItems from "@/static/json/exclude-mods.json";
import dict_en from "@/node_modules/warframe-public-export-plus/dict.en.json"; import dict_en from "@/node_modules/warframe-public-export-plus/dict.en.json";
import exportSuits from "@/node_modules/warframe-public-export-plus/ExportWarframes.json"; import exportSuits from "@/node_modules/warframe-public-export-plus/ExportWarframes.json";
export type MinWarframe = Omit<Warframe, "patchlogs">; export type MinWarframe = Omit<Warframe, "patchlogs">;
export type MinWeapon = Omit<Weapon, "patchlogs">; export type MinWeapon = Omit<Weapon, "patchlogs">;
export type MinItem = Omit<MinimalItem, "patchlogs">; export type MinItem = Omit<MinimalItem, "patchlogs">;
@ -108,12 +107,12 @@ export const getItemByBlueprint = (uniqueName: string): (MinItem & Buildable) |
export const getExalted = (uniqueName: string) => { export const getExalted = (uniqueName: string) => {
const suit = getSuitByUniqueName(uniqueName); const suit = getSuitByUniqueName(uniqueName);
if(suit?.exalted !== undefined){ if (suit?.exalted !== undefined) {
return suit.exalted; return suit.exalted;
} else { } else {
return false return false;
} }
} };
export const getItemCategoryByUniqueName = (uniqueName: string) => { export const getItemCategoryByUniqueName = (uniqueName: string) => {
//Lotus/Types/Items/MiscItems/PolymerBundle //Lotus/Types/Items/MiscItems/PolymerBundle