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

@ -75,9 +75,9 @@ export const addSentinel = async (sentinelName: string, accountId: string) => {
export const addPowerSuit = async (powersuitName: string, accountId: string): Promise<ISuitClient> => { export const addPowerSuit = async (powersuitName: string, accountId: string): Promise<ISuitClient> => {
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);
@ -88,9 +88,9 @@ export const addPowerSuit = async (powersuitName: string, accountId: string): Pr
export const addMechSuit = async (mechsuitName: string, accountId: string) => { 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,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