From 339f32b6a09b76ce7220e238a54bb8bc62bdf81b Mon Sep 17 00:00:00 2001 From: ComputerTech312 Date: Sat, 13 Sep 2025 15:51:46 +0100 Subject: [PATCH] Make bread cheaper and add channel limit system - Reduced bread cost from 50 to 10 in all shop definitions - Added channel_bread tracking system to track deployed bread per channel - Added check in buy function to limit maximum 3 bread items per channel - Initialized bread tracking in bot constructor - Next step: implement bread deployment in use command --- duckhunt/simple_duckhunt.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/duckhunt/simple_duckhunt.py b/duckhunt/simple_duckhunt.py index 64beab1..a1b6c7a 100644 --- a/duckhunt/simple_duckhunt.py +++ b/duckhunt/simple_duckhunt.py @@ -159,6 +159,7 @@ class SimpleIRCBot: self.channel_records = {} # Channel-specific records {channel: {'fastest_shot': {}, 'last_duck': {}, 'total_ducks': 0}} self.duck_difficulty = {} # Per-channel duck difficulty {channel: multiplier} self.next_duck_spawn = {} # Track next spawn time per channel + self.channel_bread = {} # Track deployed bread per channel {channel: [{'time': timestamp, 'owner': nick}]} # Initialize SASL handler self.sasl_handler = SASLHandler(self, config) @@ -1771,7 +1772,7 @@ class SimpleIRCBot: {'id': '16', 'name': 'Water bucket', 'cost': 10}, {'id': '17', 'name': 'Sabotage', 'cost': 14}, {'id': '20', 'name': 'Decoy', 'cost': 80}, - {'id': '21', 'name': 'Bread', 'cost': 50}, + {'id': '21', 'name': 'Bread', 'cost': 10}, {'id': '23', 'name': 'Mechanical duck', 'cost': 50} ], 'insurance': [ @@ -1838,7 +1839,7 @@ class SimpleIRCBot: '18': {'name': 'Life insurance', 'cost': 10}, '19': {'name': 'Liability insurance', 'cost': 5}, '20': {'name': 'Decoy', 'cost': 80}, - '21': {'name': 'Piece of bread', 'cost': 50}, + '21': {'name': 'Piece of bread', 'cost': 10}, '22': {'name': 'Ducks detector', 'cost': 50}, '23': {'name': 'Mechanical duck', 'cost': 50} } @@ -1848,6 +1849,17 @@ class SimpleIRCBot: return shop_item = shop_items[item] + + # Check for bread channel limit + if item == '21': # Bread + # Count existing bread in channel + channel_bread_count = 0 + if hasattr(self, 'channel_bread') and channel in self.channel_bread: + channel_bread_count = len(self.channel_bread[channel]) + + if channel_bread_count >= 3: + self.send_message(channel, f"{nick} > Maximum 3 bread items allowed in channel! Current: {channel_bread_count}") + return cost = shop_item['cost'] if player['xp'] < cost: @@ -1918,7 +1930,7 @@ class SimpleIRCBot: '18': {'name': 'Life insurance', 'cost': 10}, '19': {'name': 'Liability insurance', 'cost': 5}, '20': {'name': 'Decoy', 'cost': 80}, - '21': {'name': 'Piece of bread', 'cost': 50}, + '21': {'name': 'Piece of bread', 'cost': 10}, '22': {'name': 'Ducks detector', 'cost': 50}, '23': {'name': 'Mechanical duck', 'cost': 50} }