Added outside monsters file.
Fixed bug in go command.
Showing
3 changed files
with
12 additions
and
6 deletions
1 | def go(id, params, players, mud, tokens, command): | 1 | def go(id, params, players, mud, tokens, command): |
2 | # store the exit name | 2 | # store the exit name |
3 | if params == '': | 3 | if params == '': |
4 | params = command | 4 | params = command.strip() |
5 | else: | ||
6 | params = params.strip() | ||
5 | 7 | ||
6 | room_data = utils.load_object_from_file('rooms/' + players[id]["room"] + '.txt') | 8 | room_data = utils.load_object_from_file('rooms/' + players[id]["room"] + '.txt') |
7 | exits = room_data['exits'] | 9 | exits = room_data['exits'] |
... | @@ -25,8 +27,13 @@ def go(id, params, players, mud, tokens, command): | ... | @@ -25,8 +27,13 @@ def go(id, params, players, mud, tokens, command): |
25 | mud.send_message(id, "An invisible force prevents you from going in that direction.") | 27 | mud.send_message(id, "An invisible force prevents you from going in that direction.") |
26 | return None | 28 | return None |
27 | else: | 29 | else: |
28 | players[id]["room"] = exits[params] | 30 | new_room = utils.load_object_from_file('rooms/' + exits[params] + '.txt') |
29 | room = params | 31 | if not new_room: |
32 | mud.send_message(id, "An invisible force prevents you from going in that direction.") | ||
33 | return None | ||
34 | else: | ||
35 | players[id]["room"] = exits[params] | ||
36 | mud.send_message(id, "You arrive at '{}'".format(new_room['title'])) | ||
30 | 37 | ||
31 | # go through all the players in the game | 38 | # go through all the players in the game |
32 | for pid, pl in players.items(): | 39 | for pid, pl in players.items(): |
... | @@ -41,8 +48,6 @@ def go(id, params, players, mud, tokens, command): | ... | @@ -41,8 +48,6 @@ def go(id, params, players, mud, tokens, command): |
41 | players[id]["name"], params)) | 48 | players[id]["name"], params)) |
42 | 49 | ||
43 | # send the player a message telling them where they are now | 50 | # send the player a message telling them where they are now |
44 | title = utils.load_object_from_file('rooms/' + players[id]["room"] + '.txt')['title'] | ||
45 | mud.send_message(id, "You arrive at '{}'".format(title)) | ||
46 | tokens = [] | 51 | tokens = [] |
47 | return 'look' | 52 | return 'look' |
48 | # the specified exit wasn't found in the current room | 53 | # the specified exit wasn't found in the current room | ... | ... |
rooms/outside_monsters.json
0 → 100644
1 | {} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | {"cricket": {"max": 1, "active": [{"hp": 100, "mp": 2.75, "sta": 1.7500000000000182, "maxhp": 100, "maxmp": 10, "maxsta": 10, "action": "attack", "target": "test"}]}} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | {"cricket": {"max": 1, "active": [{"hp": 100, "mp": 1.0, "sta": 3.950000000000027, "maxhp": 100, "maxmp": 10, "maxsta": 10, "action": "attack", "target": "test"}]}} | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or sign in to post a comment