XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFESpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/XFESpaceNinjaServer

fix: only set IsNew flag if the ItemType is new (#2028)

Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/2028 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>

1084932a
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

1 个文件 +16 -6
Modified src/services/inventoryService.ts +16 -6
@@ -870,10 +870,14 @@ const addSentinel = (
870 870 // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
871 871 const configs: IItemConfig[] = applyDefaultUpgrades(inventory, ExportSentinels[sentinelName]?.defaultUpgrades);
872 872
873 const features = premiumPurchase ? EquipmentFeatures.DOUBLE_CAPACITY : undefined;
874 873 const sentinelIndex =
875 inventory.Sentinels.push({ ItemType: sentinelName, Configs: configs, XP: 0, Features: features, IsNew: true }) -
876 1;
874 inventory.Sentinels.push({
875 ItemType: sentinelName,
876 Configs: configs,
877 XP: 0,
878 Features: premiumPurchase ? EquipmentFeatures.DOUBLE_CAPACITY : undefined,
879 IsNew: inventory.Sentinels.find(x => x.ItemType == sentinelName) ? undefined : true
880 }) - 1;
877 881 inventoryChanges.Sentinels ??= [];
878 882 inventoryChanges.Sentinels.push(inventory.Sentinels[sentinelIndex].toJSON<IEquipmentClient>());
879 883
@@ -922,6 +926,9 @@ export const addPowerSuit = async (
922 926 },
923 927 defaultOverwrites
924 928 );
929 if (suit.IsNew) {
930 suit.IsNew = !inventory.Suits.find(x => x.ItemType == powersuitName);
931 }
925 932 if (!suit.IsNew) {
926 933 suit.IsNew = undefined;
927 934 }
@@ -956,7 +963,7 @@ export const addMechSuit = async (
956 963 UpgradeVer: 101,
957 964 XP: 0,
958 965 Features: features,
959 IsNew: true
966 IsNew: inventory.MechSuits.find(x => x.ItemType == mechsuitName) ? undefined : true
960 967 }) - 1;
961 968 inventoryChanges.MechSuits ??= [];
962 969 inventoryChanges.MechSuits.push(inventory.MechSuits[suitIndex].toJSON<IEquipmentClient>());
@@ -996,7 +1003,7 @@ export const addSpaceSuit = (
996 1003 UpgradeVer: 101,
997 1004 XP: 0,
998 1005 Features: features,
999 IsNew: true
1006 IsNew: inventory.SpaceSuits.find(x => x.ItemType == spacesuitName) ? undefined : true
1000 1007 }) - 1;
1001 1008 inventoryChanges.SpaceSuits ??= [];
1002 1009 inventoryChanges.SpaceSuits.push(inventory.SpaceSuits[suitIndex].toJSON<IEquipmentClient>());
@@ -1078,7 +1085,7 @@ export const addKubrowPet = (
1078 1085 Configs: configs,
1079 1086 XP: 0,
1080 1087 Details: details,
1081 IsNew: true
1088 IsNew: inventory.KubrowPets.find(x => x.ItemType == kubrowPetName) ? undefined : true
1082 1089 }) - 1;
1083 1090 inventoryChanges.KubrowPets ??= [];
1084 1091 inventoryChanges.KubrowPets.push(inventory.KubrowPets[kubrowPetIndex].toJSON<IEquipmentClient>());
@@ -1258,6 +1265,9 @@ export const addEquipment = (
1258 1265 },
1259 1266 defaultOverwrites
1260 1267 );
1268 if (equipment.IsNew) {
1269 equipment.IsNew = !inventory[category].find(x => x.ItemType == type);
1270 }
1261 1271 if (!equipment.IsNew) {
1262 1272 equipment.IsNew = undefined;
1263 1273 }