Fix magazine and bullet usage limits

- Fixed bug where players could use magazines beyond their level's maximum limit
- Added validation to prevent using bullets when magazine is already full
- Magazine items now respect level-based limits (e.g., 3 magazines at level 1)
- Items are not consumed from inventory if they can't be used due to limits
- Added proper error messages for when limits are reached
- Updated ShopManager to work with LevelManager for limit validation
This commit is contained in:
2025-09-26 19:13:52 +01:00
parent f3a9c5b611
commit 25226a460b
7 changed files with 157 additions and 13 deletions

View File

@@ -38,14 +38,14 @@ class DuckHuntBot:
self.admins = [admin.lower() for admin in admins_list]
self.logger.info(f"👑 Configured {len(self.admins)} admin(s): {', '.join(self.admins)}")
# Initialize shop manager
shop_file = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'shop.json')
self.shop = ShopManager(shop_file)
# Initialize level manager
# Initialize level manager first
levels_file = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'levels.json')
self.levels = LevelManager(levels_file)
# Initialize shop manager with levels reference
shop_file = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'shop.json')
self.shop = ShopManager(shop_file, self.levels)
def get_config(self, path, default=None):
"""Get configuration value using dot notation"""
keys = path.split('.')