adventure-game #3
|
@ -46,8 +46,7 @@ class Handler(npyscreen.ButtonPress):
|
|||
player = self.parent.parentApp.player
|
||||
roomlocation = player.playerData['player']['location'] + '.yaml'
|
||||
try:
|
||||
room = parse(self.parent.parentApp.mainPath / 'gamedata/world' / roomlocation)[
|
||||
player.playerData['player']['location']]
|
||||
room = parse(self.parent.parentApp.mainPath / 'gamedata/world' / roomlocation)['room']
|
||||
|
||||
# If the file could not be found
|
||||
except FileNotFoundError:
|
||||
|
@ -102,14 +101,16 @@ class Handler(npyscreen.ButtonPress):
|
|||
self.parent.update_log("You must specify something to pick up.")
|
||||
|
||||
elif command == 'OPEN':
|
||||
try:
|
||||
#try:
|
||||
self.parent.parentApp.log.info('Player tried to open door: {0}'.format(arguments[0]))
|
||||
new_room = room[arguments[0].lower()]['leads_to']
|
||||
self.parent.parentApp.log.debug('New room is: {0}'.format(new_room))
|
||||
except KeyError:
|
||||
self.parent.update_log("You cant open that.")
|
||||
except IndexError:
|
||||
self.parent.update_log("you must specify something to open")
|
||||
upon_enter = player.change_room(new_room) # Change the player to that new room.
|
||||
self.parent.update_log(upon_enter) # Print the new room upon enter text.
|
||||
#except KeyError:
|
||||
# self.parent.update_log("You cant open that.")
|
||||
#except IndexError:
|
||||
# self.parent.update_log("you must specify something to open")
|
||||
|
||||
else:
|
||||
self.parent.parentApp.log.info('Player\'s command was not understood: {0}'.format(command))
|
||||
|
|
Loading…
Reference in New Issue