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

SpaceNinjaServer

A simple server for a small space ninja game

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

XFEstudio/SpaceNinjaServer

feat: WeaponSkins IsNew flag (#1347)

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

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

代码差异

5 个文件 +12 -2
Modified src/models/inventoryModels/inventoryModel.ts +2 -1
@@ -586,7 +586,8 @@ const spectreLoadoutsSchema = new Schema<ISpectreLoadout>(
586 586
587 587 const weaponSkinsSchema = new Schema<IWeaponSkinDatabase>(
588 588 {
589 ItemType: String
589 ItemType: String,
590 IsNew: Boolean
590 591 },
591 592 { id: false }
592 593 );
Modified src/services/inventoryService.ts +1 -1
@@ -938,7 +938,7 @@ export const addSkin = (
938 938 typeName: string,
939 939 inventoryChanges: IInventoryChanges = {}
940 940 ): IInventoryChanges => {
941 const index = inventory.WeaponSkins.push({ ItemType: typeName }) - 1;
941 const index = inventory.WeaponSkins.push({ ItemType: typeName, IsNew: true }) - 1;
942 942 // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
943 943 inventoryChanges.WeaponSkins ??= [];
944 944 (inventoryChanges.WeaponSkins as IWeaponSkinClient[]).push(
Modified src/services/saveLoadoutService.ts +7 -0
@@ -140,6 +140,13 @@ export const handleInventoryItemConfigChange = async (
140 140 inventory.UseAdultOperatorLoadout = equipment as boolean;
141 141 break;
142 142 }
143 case "WeaponSkins": {
144 const itemEntries = equipment as IItemEntry;
145 for (const [itemId, itemConfigEntries] of Object.entries(itemEntries)) {
146 inventory.WeaponSkins.id(itemId)!.IsNew = itemConfigEntries.IsNew;
147 }
148 break;
149 }
143 150 default: {
144 151 if (equipmentKeys.includes(equipmentName as TEquipmentKey) && equipmentName != "ValidNewLoadoutId") {
145 152 logger.debug(`general Item config saved of type ${equipmentName}`, {
Modified src/types/inventoryTypes/inventoryTypes.ts +1 -0
@@ -1017,6 +1017,7 @@ export interface ITaunt {
1017 1017
1018 1018 export interface IWeaponSkinDatabase {
1019 1019 ItemType: string;
1020 IsNew?: boolean;
1020 1021 _id: Types.ObjectId;
1021 1022 }
1022 1023
Modified src/types/saveLoadoutTypes.ts +1 -0
@@ -36,6 +36,7 @@ export interface ISaveLoadoutRequest {
36 36 EquippedGear: string[];
37 37 EquippedEmotes: string[];
38 38 UseAdultOperatorLoadout: boolean;
39 WeaponSkins: IItemEntry;
39 40 }
40 41
41 42 export interface ISaveLoadoutRequestNoUpgradeVer extends Omit<ISaveLoadoutRequest, "UpgradeVer"> {}