Compare commits
3 Commits
8dd1900d90
...
5202255b42
Author | SHA1 | Date |
---|---|---|
Marlow Alfonso | 5202255b42 | |
Marlow Alfonso | 6094480fea | |
Marlow Alfonso | a196290e36 |
19
commands.py
19
commands.py
|
@ -7,11 +7,14 @@ def help(mud, id):
|
|||
mud.send_message(id, '''This are the currently available commands:
|
||||
* say <message>: Says something to everyone in the room.
|
||||
* go <exit>: Enters an exit.
|
||||
* look: Gives a description of the room.
|
||||
* look: Gives a description of the room. Use it in a players to see info
|
||||
about them. Use 'me' to see info about you.
|
||||
* open <exit> <room>: (Only available for the builders of the room) creates
|
||||
an exit to another room.
|
||||
* build <room> <return> <description>: Creates a room. The return param is
|
||||
the name of an exit to come back to the current room.
|
||||
* me <action>: Emotes action. Example, 'me chuckles'. Visible to everyone
|
||||
in the room.
|
||||
''')
|
||||
|
||||
|
||||
|
@ -59,9 +62,13 @@ def look(mud, id, players, rooms, params):
|
|||
for pid, pl in players.items():
|
||||
if params_list[0] == "me":
|
||||
mud.send_message(id, players[id]["description"])
|
||||
mud.send_message(id, "species: {}"
|
||||
.format(players[id]["species"]))
|
||||
break
|
||||
elif params_list[0] == pl["name"]:
|
||||
mud.send_message(id, pl["description"])
|
||||
mud.send_message(id, "species: {}"
|
||||
.format(players[pid]["species"]))
|
||||
return
|
||||
room = rooms[players[id]["room"]]
|
||||
mud.send_message(id, room["description"])
|
||||
|
@ -107,3 +114,13 @@ def build(mud, id, players, rooms, params):
|
|||
"owner": players[id]["name"],
|
||||
"builders": [players[id]["name"]]
|
||||
}
|
||||
|
||||
|
||||
def me(mud, id, players, rooms, params):
|
||||
if not params:
|
||||
mud.send_message(id, "Invalid params.")
|
||||
return
|
||||
for pid, pl in players.items():
|
||||
if pl["room"] == players[id]["room"]:
|
||||
mud.send_message(pid, "{} {}"
|
||||
.format(players[id]["name"], params))
|
||||
|
|
7
run.py
7
run.py
|
@ -80,6 +80,10 @@ def cmd_build(id, params):
|
|||
cmd.build(mud, id, players, rooms, params)
|
||||
|
||||
|
||||
def cmd_me(id, params):
|
||||
cmd.me(mud, id, players, rooms, params)
|
||||
|
||||
|
||||
def cmd_unknown(id, command):
|
||||
cmd.unknown(mud, command, id)
|
||||
|
||||
|
@ -90,7 +94,8 @@ commands = {
|
|||
"go": cmd_go,
|
||||
"say": cmd_say,
|
||||
"open": cmd_open,
|
||||
"build": cmd_build
|
||||
"build": cmd_build,
|
||||
"me": cmd_me
|
||||
}
|
||||
waitlist_commands = {
|
||||
"help": cmd_whelp,
|
||||
|
|
Loading…
Reference in New Issue