fix: only set IsNew flag if the ItemType is new
This commit is contained in:
parent
bdd5ade2eb
commit
df548f7fb7
@ -869,10 +869,14 @@ const addSentinel = (
|
|||||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||||
const configs: IItemConfig[] = applyDefaultUpgrades(inventory, ExportSentinels[sentinelName]?.defaultUpgrades);
|
const configs: IItemConfig[] = applyDefaultUpgrades(inventory, ExportSentinels[sentinelName]?.defaultUpgrades);
|
||||||
|
|
||||||
const features = premiumPurchase ? EquipmentFeatures.DOUBLE_CAPACITY : undefined;
|
|
||||||
const sentinelIndex =
|
const sentinelIndex =
|
||||||
inventory.Sentinels.push({ ItemType: sentinelName, Configs: configs, XP: 0, Features: features, IsNew: true }) -
|
inventory.Sentinels.push({
|
||||||
1;
|
ItemType: sentinelName,
|
||||||
|
Configs: configs,
|
||||||
|
XP: 0,
|
||||||
|
Features: premiumPurchase ? EquipmentFeatures.DOUBLE_CAPACITY : undefined,
|
||||||
|
IsNew: inventory.Sentinels.find(x => x.ItemType == sentinelName) ? undefined : true
|
||||||
|
}) - 1;
|
||||||
inventoryChanges.Sentinels ??= [];
|
inventoryChanges.Sentinels ??= [];
|
||||||
inventoryChanges.Sentinels.push(inventory.Sentinels[sentinelIndex].toJSON<IEquipmentClient>());
|
inventoryChanges.Sentinels.push(inventory.Sentinels[sentinelIndex].toJSON<IEquipmentClient>());
|
||||||
|
|
||||||
@ -921,6 +925,9 @@ export const addPowerSuit = async (
|
|||||||
},
|
},
|
||||||
defaultOverwrites
|
defaultOverwrites
|
||||||
);
|
);
|
||||||
|
if (suit.IsNew) {
|
||||||
|
suit.IsNew = !inventory.Suits.find(x => x.ItemType == powersuitName);
|
||||||
|
}
|
||||||
if (!suit.IsNew) {
|
if (!suit.IsNew) {
|
||||||
suit.IsNew = undefined;
|
suit.IsNew = undefined;
|
||||||
}
|
}
|
||||||
@ -955,7 +962,7 @@ export const addMechSuit = async (
|
|||||||
UpgradeVer: 101,
|
UpgradeVer: 101,
|
||||||
XP: 0,
|
XP: 0,
|
||||||
Features: features,
|
Features: features,
|
||||||
IsNew: true
|
IsNew: inventory.MechSuits.find(x => x.ItemType == mechsuitName) ? undefined : true
|
||||||
}) - 1;
|
}) - 1;
|
||||||
inventoryChanges.MechSuits ??= [];
|
inventoryChanges.MechSuits ??= [];
|
||||||
inventoryChanges.MechSuits.push(inventory.MechSuits[suitIndex].toJSON<IEquipmentClient>());
|
inventoryChanges.MechSuits.push(inventory.MechSuits[suitIndex].toJSON<IEquipmentClient>());
|
||||||
@ -995,7 +1002,7 @@ export const addSpaceSuit = (
|
|||||||
UpgradeVer: 101,
|
UpgradeVer: 101,
|
||||||
XP: 0,
|
XP: 0,
|
||||||
Features: features,
|
Features: features,
|
||||||
IsNew: true
|
IsNew: inventory.SpaceSuits.find(x => x.ItemType == spacesuitName) ? undefined : true
|
||||||
}) - 1;
|
}) - 1;
|
||||||
inventoryChanges.SpaceSuits ??= [];
|
inventoryChanges.SpaceSuits ??= [];
|
||||||
inventoryChanges.SpaceSuits.push(inventory.SpaceSuits[suitIndex].toJSON<IEquipmentClient>());
|
inventoryChanges.SpaceSuits.push(inventory.SpaceSuits[suitIndex].toJSON<IEquipmentClient>());
|
||||||
@ -1077,7 +1084,7 @@ export const addKubrowPet = (
|
|||||||
Configs: configs,
|
Configs: configs,
|
||||||
XP: 0,
|
XP: 0,
|
||||||
Details: details,
|
Details: details,
|
||||||
IsNew: true
|
IsNew: inventory.KubrowPets.find(x => x.ItemType == kubrowPetName) ? undefined : true
|
||||||
}) - 1;
|
}) - 1;
|
||||||
inventoryChanges.KubrowPets ??= [];
|
inventoryChanges.KubrowPets ??= [];
|
||||||
inventoryChanges.KubrowPets.push(inventory.KubrowPets[kubrowPetIndex].toJSON<IEquipmentClient>());
|
inventoryChanges.KubrowPets.push(inventory.KubrowPets[kubrowPetIndex].toJSON<IEquipmentClient>());
|
||||||
@ -1257,6 +1264,9 @@ export const addEquipment = (
|
|||||||
},
|
},
|
||||||
defaultOverwrites
|
defaultOverwrites
|
||||||
);
|
);
|
||||||
|
if (equipment.IsNew) {
|
||||||
|
equipment.IsNew = !inventory[category].find(x => x.ItemType == type);
|
||||||
|
}
|
||||||
if (!equipment.IsNew) {
|
if (!equipment.IsNew) {
|
||||||
equipment.IsNew = undefined;
|
equipment.IsNew = undefined;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user