improve: adding special weapons at powersuit creation #277

Merged
AMelonInsideLemon merged 10 commits from SpecialItems into main 2024-06-07 06:58:20 -07:00
2 changed files with 15 additions and 10 deletions
Showing only changes of commit e59b2b3d0a - Show all commits

View File

@ -77,7 +77,7 @@ export const addPowerSuit = async (powersuitName: string, accountId: string): Pr
const specialItems = await getExalted(powersuitName); const specialItems = await 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 = await getExalted(mechsuitName); const specialItems = await 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,7 +101,13 @@ 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();
}; };

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">;
@ -111,9 +110,9 @@ export const getExalted = (uniqueName: string) => {
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