From 0cf0e3beb4206cdfd75ab39e74306fd45d0bcb55 Mon Sep 17 00:00:00 2001 From: Naruse <71993948+DevilProMT@users.noreply.github.com> Date: Wed, 29 Apr 2026 00:36:17 +0800 Subject: [PATCH] fix weapon break limit --- GameServer/Command/Commands/CommandGiveAll.cs | 2 +- GameServer/Game/Inventory/InventoryManager.cs | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/GameServer/Command/Commands/CommandGiveAll.cs b/GameServer/Command/Commands/CommandGiveAll.cs index 6787528..fb4a8bd 100644 --- a/GameServer/Command/Commands/CommandGiveAll.cs +++ b/GameServer/Command/Commands/CommandGiveAll.cs @@ -18,7 +18,7 @@ public class CommandGiveAll : ICommands if (await arg.GetOption('l') is not int level) return; var detail = arg.GetInt(0); - level = Math.Clamp(level, 1, 80); + level = Math.Clamp(level, 1, 90); var player = arg.Target!.Player!; List weapons = []; if (detail == -1) diff --git a/GameServer/Game/Inventory/InventoryManager.cs b/GameServer/Game/Inventory/InventoryManager.cs index c86f57a..fc9b088 100644 --- a/GameServer/Game/Inventory/InventoryManager.cs +++ b/GameServer/Game/Inventory/InventoryManager.cs @@ -24,7 +24,7 @@ public class InventoryManager(PlayerInstance player) : BasePlayerManager(player) TemplateId = templateId, UniqueId = InventoryData.NextUniqueUid++, Level = weaponLevel, - Break = weaponData.InitBreak, + Break = GetWeaponBreak(weaponLevel), ItemType = ItemTypeEnum.TYPE_WEAPON, ItemCount = 1 }; @@ -35,6 +35,17 @@ public class InventoryManager(PlayerInstance player) : BasePlayerManager(player) return weaponInfo; } + private static uint GetWeaponBreak(uint level) + { + if (level <= 20) return 1; + if (level <= 40) return 2; + if (level <= 60) return 3; + if (level <= 70) return 4; + if (level <= 80) return 5; + if (level <= 90) return 6; + return 7; + } + public GameWeaponInfo? GetWeaponItem(uint uniqueId) { return InventoryData.Weapons.GetValueOrDefault(uniqueId);