forked from OpenWF/SpaceNinjaServer
fix: don't set IsNew flag for starting gear (#1859)
Reviewed-on: OpenWF/SpaceNinjaServer#1859 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
This commit is contained in:
parent
4d4f885c8e
commit
75c011e3cb
@ -62,14 +62,7 @@ export const crewShipIdentifySalvageController: RequestHandler = async (req, res
|
||||
} satisfies IInnateDamageFingerprint)
|
||||
};
|
||||
}
|
||||
addEquipment(
|
||||
inventory,
|
||||
"CrewShipSalvagedWeapons",
|
||||
payload.ItemType,
|
||||
undefined,
|
||||
inventoryChanges,
|
||||
defaultOverwrites
|
||||
);
|
||||
addEquipment(inventory, "CrewShipSalvagedWeapons", payload.ItemType, defaultOverwrites, inventoryChanges);
|
||||
}
|
||||
|
||||
inventoryChanges.CrewShipRawSalvage = [
|
||||
|
@ -104,13 +104,14 @@ export const focusController: RequestHandler = async (req, res) => {
|
||||
}
|
||||
case FocusOperation.SentTrainingAmplifier: {
|
||||
const request = JSON.parse(String(req.body)) as ISentTrainingAmplifierRequest;
|
||||
const parts: string[] = [
|
||||
const inventory = await getInventory(accountId);
|
||||
const inventoryChanges = addEquipment(inventory, "OperatorAmps", request.StartingWeaponType, {
|
||||
ModularParts: [
|
||||
"/Lotus/Weapons/Sentients/OperatorAmplifiers/SentTrainingAmplifier/SentAmpTrainingGrip",
|
||||
"/Lotus/Weapons/Sentients/OperatorAmplifiers/SentTrainingAmplifier/SentAmpTrainingChassis",
|
||||
"/Lotus/Weapons/Sentients/OperatorAmplifiers/SentTrainingAmplifier/SentAmpTrainingBarrel"
|
||||
];
|
||||
const inventory = await getInventory(accountId);
|
||||
const inventoryChanges = addEquipment(inventory, "OperatorAmps", request.StartingWeaponType, parts);
|
||||
]
|
||||
});
|
||||
occupySlot(inventory, InventorySlot.AMPS, false);
|
||||
await inventory.save();
|
||||
res.json((inventoryChanges.OperatorAmps as IEquipmentClient[])[0]);
|
||||
|
@ -441,16 +441,9 @@ const finishComponentRepair = (
|
||||
const inventoryChanges = {
|
||||
...(category == "CrewShipWeaponSkins"
|
||||
? addCrewShipWeaponSkin(inventory, salvageItem.ItemType, salvageItem.UpgradeFingerprint)
|
||||
: addEquipment(
|
||||
inventory,
|
||||
category,
|
||||
salvageItem.ItemType,
|
||||
undefined,
|
||||
{},
|
||||
{
|
||||
: addEquipment(inventory, category, salvageItem.ItemType, {
|
||||
UpgradeFingerprint: salvageItem.UpgradeFingerprint
|
||||
}
|
||||
)),
|
||||
})),
|
||||
...occupySlot(inventory, InventorySlot.RJ_COMPONENT_AND_ARMAMENTS, false)
|
||||
};
|
||||
|
||||
|
@ -36,7 +36,9 @@ export const modularWeaponCraftingController: RequestHandler = async (req, res)
|
||||
const inventory = await getInventory(accountId);
|
||||
|
||||
let defaultUpgrades: IDefaultUpgrade[] | undefined;
|
||||
const defaultOverwrites: Partial<IEquipmentDatabase> = {};
|
||||
const defaultOverwrites: Partial<IEquipmentDatabase> = {
|
||||
ModularParts: data.Parts
|
||||
};
|
||||
const inventoryChanges: IInventoryChanges = {};
|
||||
if (category == "KubrowPets") {
|
||||
const traits = {
|
||||
@ -151,7 +153,7 @@ export const modularWeaponCraftingController: RequestHandler = async (req, res)
|
||||
}
|
||||
}
|
||||
defaultOverwrites.Configs = applyDefaultUpgrades(inventory, defaultUpgrades);
|
||||
addEquipment(inventory, category, data.WeaponType, data.Parts, inventoryChanges, defaultOverwrites);
|
||||
addEquipment(inventory, category, data.WeaponType, defaultOverwrites, inventoryChanges);
|
||||
combineInventoryChanges(
|
||||
inventoryChanges,
|
||||
occupySlot(inventory, productCategoryToInventoryBin(category)!, !!data.isWebUi)
|
||||
|
@ -45,24 +45,18 @@ export const modularWeaponSaleController: RequestHandler = async (req, res) => {
|
||||
const defaultUpgrades = getDefaultUpgrades(weaponInfo.ModularParts);
|
||||
const configs = applyDefaultUpgrades(inventory, defaultUpgrades);
|
||||
const inventoryChanges: IInventoryChanges = {
|
||||
...addEquipment(
|
||||
inventory,
|
||||
category,
|
||||
weaponInfo.ItemType,
|
||||
weaponInfo.ModularParts,
|
||||
{},
|
||||
{
|
||||
...addEquipment(inventory, category, weaponInfo.ItemType, {
|
||||
Features: EquipmentFeatures.DOUBLE_CAPACITY | EquipmentFeatures.GILDED,
|
||||
ItemName: payload.ItemName,
|
||||
Configs: configs,
|
||||
ModularParts: weaponInfo.ModularParts,
|
||||
Polarity: [
|
||||
{
|
||||
Slot: payload.PolarizeSlot,
|
||||
Value: payload.PolarizeValue
|
||||
}
|
||||
]
|
||||
}
|
||||
),
|
||||
}),
|
||||
...occupySlot(inventory, productCategoryToInventoryBin(category)!, true),
|
||||
...updateCurrency(inventory, weaponInfo.PremiumPrice, true)
|
||||
};
|
||||
|
@ -154,23 +154,22 @@ export const addStartingGear = async (
|
||||
|
||||
//TODO: properly merge weapon bin changes it is currently static here
|
||||
const inventoryChanges: IInventoryChanges = {};
|
||||
addEquipment(inventory, "LongGuns", LongGuns[0].ItemType, undefined, inventoryChanges);
|
||||
addEquipment(inventory, "Pistols", Pistols[0].ItemType, undefined, inventoryChanges);
|
||||
addEquipment(inventory, "Melee", Melee[0].ItemType, undefined, inventoryChanges);
|
||||
await addPowerSuit(inventory, Suits[0].ItemType, inventoryChanges);
|
||||
addEquipment(inventory, "LongGuns", LongGuns[0].ItemType, { IsNew: false }, inventoryChanges);
|
||||
addEquipment(inventory, "Pistols", Pistols[0].ItemType, { IsNew: false }, inventoryChanges);
|
||||
addEquipment(inventory, "Melee", Melee[0].ItemType, { IsNew: false }, inventoryChanges);
|
||||
await addPowerSuit(inventory, Suits[0].ItemType, { IsNew: false }, inventoryChanges);
|
||||
addEquipment(
|
||||
inventory,
|
||||
"DataKnives",
|
||||
"/Lotus/Weapons/Tenno/HackingDevices/TnHackingDevice/TnHackingDeviceWeapon",
|
||||
undefined,
|
||||
inventoryChanges,
|
||||
{ XP: 450_000 }
|
||||
{ XP: 450_000, IsNew: false },
|
||||
inventoryChanges
|
||||
);
|
||||
addEquipment(
|
||||
inventory,
|
||||
"Scoops",
|
||||
"/Lotus/Weapons/Tenno/Speedball/SpeedballWeaponTest",
|
||||
undefined,
|
||||
{ IsNew: false },
|
||||
inventoryChanges
|
||||
);
|
||||
|
||||
@ -531,14 +530,7 @@ export const addItem = async (
|
||||
]
|
||||
});
|
||||
}
|
||||
const inventoryChanges = addEquipment(
|
||||
inventory,
|
||||
weapon.productCategory,
|
||||
typeName,
|
||||
[],
|
||||
{},
|
||||
defaultOverwrites
|
||||
);
|
||||
const inventoryChanges = addEquipment(inventory, weapon.productCategory, typeName, defaultOverwrites);
|
||||
if (weapon.additionalItems) {
|
||||
for (const item of weapon.additionalItems) {
|
||||
combineInventoryChanges(inventoryChanges, await addItem(inventory, item, 1));
|
||||
@ -639,12 +631,9 @@ export const addItem = async (
|
||||
switch (typeName.substr(1).split("/")[2]) {
|
||||
default: {
|
||||
return {
|
||||
...(await addPowerSuit(
|
||||
inventory,
|
||||
typeName,
|
||||
{},
|
||||
premiumPurchase ? EquipmentFeatures.DOUBLE_CAPACITY : undefined
|
||||
)),
|
||||
...(await addPowerSuit(inventory, typeName, {
|
||||
Features: premiumPurchase ? EquipmentFeatures.DOUBLE_CAPACITY : undefined
|
||||
})),
|
||||
...occupySlot(inventory, InventorySlot.SUITS, premiumPurchase)
|
||||
};
|
||||
}
|
||||
@ -864,8 +853,8 @@ const addSentinelWeapon = (
|
||||
export const addPowerSuit = async (
|
||||
inventory: TInventoryDatabaseDocument,
|
||||
powersuitName: string,
|
||||
inventoryChanges: IInventoryChanges = {},
|
||||
features?: number
|
||||
defaultOverwrites?: Partial<IEquipmentDatabase>,
|
||||
inventoryChanges: IInventoryChanges = {}
|
||||
): Promise<IInventoryChanges> => {
|
||||
const powersuit = ExportWarframes[powersuitName] as IPowersuit | undefined;
|
||||
const exalted = powersuit?.exalted ?? [];
|
||||
@ -879,15 +868,20 @@ export const addPowerSuit = async (
|
||||
}
|
||||
}
|
||||
}
|
||||
const suitIndex =
|
||||
inventory.Suits.push({
|
||||
const suit: Omit<IEquipmentDatabase, "_id"> = Object.assign(
|
||||
{
|
||||
ItemType: powersuitName,
|
||||
Configs: [],
|
||||
UpgradeVer: 101,
|
||||
XP: 0,
|
||||
Features: features,
|
||||
IsNew: true
|
||||
}) - 1;
|
||||
},
|
||||
defaultOverwrites
|
||||
);
|
||||
if (!suit.IsNew) {
|
||||
suit.IsNew = undefined;
|
||||
}
|
||||
const suitIndex = inventory.Suits.push(suit) - 1;
|
||||
inventoryChanges.Suits ??= [];
|
||||
inventoryChanges.Suits.push(inventory.Suits[suitIndex].toJSON<IEquipmentClient>());
|
||||
return inventoryChanges;
|
||||
@ -1208,20 +1202,21 @@ export const addEquipment = (
|
||||
inventory: TInventoryDatabaseDocument,
|
||||
category: TEquipmentKey,
|
||||
type: string,
|
||||
modularParts?: string[],
|
||||
inventoryChanges: IInventoryChanges = {},
|
||||
defaultOverwrites?: Partial<IEquipmentDatabase>
|
||||
defaultOverwrites?: Partial<IEquipmentDatabase>,
|
||||
inventoryChanges: IInventoryChanges = {}
|
||||
): IInventoryChanges => {
|
||||
const equipment = Object.assign(
|
||||
const equipment: Omit<IEquipmentDatabase, "_id"> = Object.assign(
|
||||
{
|
||||
ItemType: type,
|
||||
Configs: [],
|
||||
XP: 0,
|
||||
ModularParts: modularParts,
|
||||
IsNew: category != "CrewShipWeapons" && category != "CrewShipSalvagedWeapons" ? true : undefined
|
||||
IsNew: category != "CrewShipWeapons" && category != "CrewShipSalvagedWeapons"
|
||||
},
|
||||
defaultOverwrites
|
||||
);
|
||||
if (!equipment.IsNew) {
|
||||
equipment.IsNew = undefined;
|
||||
}
|
||||
const index = inventory[category].push(equipment) - 1;
|
||||
|
||||
inventoryChanges[category] ??= [];
|
||||
|
Loading…
x
Reference in New Issue
Block a user