Compare commits
2 Commits
5df58feb31
...
fee6f735ed
Author | SHA1 | Date |
---|---|---|
Marlow Alfonso | fee6f735ed | |
Marlow Alfonso | a3b1ebd249 |
13
commands.py
13
commands.py
|
@ -9,6 +9,7 @@ def say(mud, id, players, params):
|
|||
mud.send_message(pid, "{} says: {}".format(players[id]["name"], params))
|
||||
|
||||
def go(mud, id, players, rooms, params):
|
||||
old_room = players[id]["room"]
|
||||
params_list = params.split()
|
||||
if len(params_list) != 1:
|
||||
mud.send_message(id, "Invalid params")
|
||||
|
@ -17,13 +18,15 @@ def go(mud, id, players, rooms, params):
|
|||
room = rooms[players[id]["room"]]
|
||||
if exit in room["exits"]:
|
||||
for pid, pl in players.items():
|
||||
if players[pid]["room"] == players[id]["room"] and pid != id:
|
||||
players[id]["room"] = room["exits"][exit]
|
||||
mud.send_message(id, "You arrive at '{}'".format(players[id]["room"]))
|
||||
if pl["room"] == players[id]["room"] and pid != id:
|
||||
mud.send_message(pid, "{} left via exit '{}'".format(players[id]["name"], exit))
|
||||
|
||||
players[id]["room"] = room["exits"][exit]
|
||||
mud.send_message(id, "You arrive at '{}'".format(players[id]["room"]))
|
||||
|
||||
for pid, pl in players.items():
|
||||
if players[pid]["room"] == players[id]["room"] and pid != id:
|
||||
mud.send_message(pid, "{} arrived via exit '{}'".format(players[id]["name"], exit))
|
||||
if pl["room"] == players[id]["room"] and pid != id:
|
||||
mud.send_message(pid, "{} arrived from '{}' via exit '{}'".format(players[id]["name"], old_room, exit))
|
||||
else:
|
||||
mud.send_message(id, "Unknown exit '{}'".format(exit))
|
||||
|
||||
|
|
11
run.py
11
run.py
|
@ -22,55 +22,46 @@ characters = {
|
|||
"Dummy1": {
|
||||
"password": "Dummy1",
|
||||
"species": "dummy",
|
||||
"room": "Lobby",
|
||||
"description": "A practice dummy"
|
||||
},
|
||||
"Dummy2": {
|
||||
"password": "Dummy2",
|
||||
"species": "dummy",
|
||||
"room": "Lobby",
|
||||
"description": "A practice dummy"
|
||||
},
|
||||
"Dummy3": {
|
||||
"password": "Dummy3",
|
||||
"species": "dummy",
|
||||
"room": "Lobby",
|
||||
"description": "A practice dummy"
|
||||
},
|
||||
"Dummy4": {
|
||||
"password": "Dummy4",
|
||||
"species": "dummy",
|
||||
"room": "Lobby",
|
||||
"description": "A practice dummy"
|
||||
},
|
||||
"Dummy5": {
|
||||
"password": "Dummy5",
|
||||
"species": "dummy",
|
||||
"room": "Lobby",
|
||||
"description": "A practice dummy"
|
||||
},
|
||||
"Dummy6": {
|
||||
"password": "Dummy6",
|
||||
"species": "dummy",
|
||||
"room": "Lobby",
|
||||
"description": "A practice dummy"
|
||||
},
|
||||
"Dummy7": {
|
||||
"password": "Dummy7",
|
||||
"species": "dummy",
|
||||
"room": "Lobby",
|
||||
"description": "A practice dummy"
|
||||
},
|
||||
"Dummy8": {
|
||||
"password": "Dummy8",
|
||||
"species": "dummy",
|
||||
"room": "Lobby",
|
||||
"description": "A practice dummy"
|
||||
},
|
||||
"Dummy9": {
|
||||
"password": "Dummy9",
|
||||
"species": "dummy",
|
||||
"room": "Lobby",
|
||||
"description": "A practice dummy"
|
||||
}
|
||||
}
|
||||
|
@ -144,7 +135,7 @@ You can log in to your character typing:
|
|||
mud.send_message(id, "That character is already connected")
|
||||
break
|
||||
else:
|
||||
add_player(id, name, pl["species"], pl["description"], pl["room"])
|
||||
add_player(id, name, pl["species"], pl["description"])
|
||||
waitlist.pop(id)
|
||||
break
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue