> cat /wizhelp/wizcoding7
========================================================================
MUD Coding Tutorial - Part 7
========================================================================
Customizing money drops and loot in RandomRooms.
DROP SYSTEM:
```python
room.drop_chances = {
'coins': 80, # 80% coins
'weapon': 5, # 5% weapon
'armor': 5, # 5% armor
'healing': 5, # 5% healing
'wand': 5 # 5% wand
}
# Total = 100%
```
COIN RANGES:
```python
room.base_coin_range = (min, max)
# Examples:
(10, 50) # Newbie area
(100, 300) # Standard
(500, 1000) # Rich area
(1000, 2500) # Boss room
```
COMPLETE EXAMPLES:
Treasure Room:
```python
room = RandomRoom(
name='dragon_hoard',
drop_chances={
'coins': 100, # Always coins
'weapon': 25,
'armor': 25,
'healing': 5,
'wand': 15
},
base_coin_range=(800, 1500)
)
```
Beginner Area:
```python
room = RandomRoom(
name='training_grounds',
drop_chances={
'coins': 70,
'weapon': 1,
'armor': 2,
'healing': 15, # More heals
'wand': 0 # No wands
},
base_coin_range=(10, 50)
)
```
Merchant District:
```python
room = RandomRoom(
name='market_square',
drop_chances={
'coins': 90, # Mostly coins
'weapon': 5,
'armor': 5,
'healing': 20,
'wand': 2
},
base_coin_range=(200, 600)
)
```
ADVANCED - Conditional Drops:
```python
def check_for_money(self):
# Override for custom logic
if not self.item_dropped:
self.item_dropped = True
# Night bonus
hour = datetime.now().hour
if 22 <= hour or hour < 6:
# Double coins at night
amount = random.randint(*self.base_coin_range) * 2
else:
amount = random.randint(*self.base_coin_range)
money = MoneyObject(amount)
self.inventory.add_item(money)
```
NOTES:
- Rooms reset every 4-6 minutes
- Only drops once per reset
- Players can't farm by re-entering
- Balance drops for game economy
TESTING:
```python
# Force a drop
room.item_dropped = False
room.check_for_money()
# Check what dropped
for item in room.inventory.get_items():
print(f"Dropped: {item.name}")
```
Congratulations! You've completed the tutorial.
Happy coding!
========================================================================
>
_