> cat /wizhelp/wizcoding2
========================================================================
MUD Coding Tutorial - Part 2
========================================================================
Creating detailed rooms with exits and features.
ROOM PROPERTIES:
```python
room = Room(
name="unique_id",
description="Long description",
short_description="Brief",
light_level=100, # 0-100
no_teleport=False, # Block teleport
area_name="Your Area"
)
```
EXIT TYPES:
```python
from lib.models.enums import ExitType
ExitType.PATH # Normal passage
ExitType.DOOR # Can open/close
ExitType.HIDDEN # Must search
```
REAL EXAMPLE - Treasure Room:
```python
from lib.models.entity import Room, Exit, DescriptionItem
from lib.special_rooms import RandomRoom
def load():
room = RandomRoom(
name="wizroom_yourname_treasure",
description="""Golden Treasure Vault
Piles of gold coins glitter in magical torchlight.
Ancient weapons lean against marble pillars.""",
drop_chances={
'coins': 60,
'weapon': 20,
'armor': 10,
'healing': 10
},
base_coin_range=(1000, 2000),
no_teleport=True
)
room.description_items = [
DescriptionItem(
name="pillars",
aliases=["marble", "columns"],
description="Carved with ancient runes."
)
]
room.exits = [
Exit("north", "wizroom_yourname_hall"),
Exit("secret", "wizroom_yourname_hidden",
ExitType.HIDDEN)
]
return room
```
SEARCHABLE ROOM:
```python
from lib.special_rooms import SearchRoom
room = SearchRoom(
name="wizroom_yourname_lab",
search_items=[
('poison_glob', 'mike/poison_glob'),
('coins_1000', None)
]
)
```
LOCKED DOORS:
```python
exit = Exit("east", "vault", ExitType.DOOR)
def can_traverse(player):
if player.has_item("gold_key"):
return True, ""
return False, "The door is locked!"
exit.can_traverse = can_traverse
```
Continue with help wizcoding3
========================================================================
>
_