mirror of
https://github.com/MikuLeaks/MikuSB.git
synced 2026-06-04 06:43:57 +00:00
fix weapon break limit
This commit is contained in:
@@ -18,7 +18,7 @@ public class CommandGiveAll : ICommands
|
|||||||
if (await arg.GetOption('l') is not int level) return;
|
if (await arg.GetOption('l') is not int level) return;
|
||||||
|
|
||||||
var detail = arg.GetInt(0);
|
var detail = arg.GetInt(0);
|
||||||
level = Math.Clamp(level, 1, 80);
|
level = Math.Clamp(level, 1, 90);
|
||||||
var player = arg.Target!.Player!;
|
var player = arg.Target!.Player!;
|
||||||
List<GameWeaponInfo> weapons = [];
|
List<GameWeaponInfo> weapons = [];
|
||||||
if (detail == -1)
|
if (detail == -1)
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class InventoryManager(PlayerInstance player) : BasePlayerManager(player)
|
|||||||
TemplateId = templateId,
|
TemplateId = templateId,
|
||||||
UniqueId = InventoryData.NextUniqueUid++,
|
UniqueId = InventoryData.NextUniqueUid++,
|
||||||
Level = weaponLevel,
|
Level = weaponLevel,
|
||||||
Break = weaponData.InitBreak,
|
Break = GetWeaponBreak(weaponLevel),
|
||||||
ItemType = ItemTypeEnum.TYPE_WEAPON,
|
ItemType = ItemTypeEnum.TYPE_WEAPON,
|
||||||
ItemCount = 1
|
ItemCount = 1
|
||||||
};
|
};
|
||||||
@@ -35,6 +35,17 @@ public class InventoryManager(PlayerInstance player) : BasePlayerManager(player)
|
|||||||
return weaponInfo;
|
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)
|
public GameWeaponInfo? GetWeaponItem(uint uniqueId)
|
||||||
{
|
{
|
||||||
return InventoryData.Weapons.GetValueOrDefault(uniqueId);
|
return InventoryData.Weapons.GetValueOrDefault(uniqueId);
|
||||||
|
|||||||
Reference in New Issue
Block a user