adventure-game #3

Open
Kenwood wants to merge 80 commits from adventure-game into master
1 changed files with 5 additions and 4 deletions
Showing only changes of commit f400a4c7c3 - Show all commits

View File

@ -59,7 +59,7 @@ class Handler(npyscreen.ButtonPress):
room = parse(self.parent.parentApp.mainPath / 'gamedata/world/blank_room.yaml') room = parse(self.parent.parentApp.mainPath / 'gamedata/world/blank_room.yaml')
# By now we should be situated in our room, and with our player. # By now we should be situated in our room, and with our player.
#self.parent.parentApp.log.debug(room) # We dont need to log this, its too verbose! # self.parent.parentApp.log.debug(room) # We dont need to log this, its too verbose!
# TODO: Should upgrade these to use fuzzy words library! and not direct comparisons! # TODO: Should upgrade these to use fuzzy words library! and not direct comparisons!
if command == 'LOOK': if command == 'LOOK':
@ -77,16 +77,17 @@ class Handler(npyscreen.ButtonPress):
elif command == 'PICK': elif command == 'PICK':
if arguments[0] == 'UP': if arguments[0] == 'UP':
if len(arguments) <= 2: # If there are only 2 args ex:up, item then we dont need to merge that last arg if len(
arguments) <= 2: # If there are only 2 args ex:up, item then we dont need to merge that last arg
try: try:
# Argument[1] is the "thing" you want to pick up, yaml is lowercase so we lowercase it. # Argument[1] is the "thing" you want to pick up, yaml is lowercase so we lowercase it.
self.parent.parentApp.log.info('Player tried to pick up {0}'.format(arguments[1])) self.parent.parentApp.log.info('Player tried to pick up {0}'.format(arguments[1]))
self.parent.update_log(room[arguments[1].lower()]['pick_up']) self.parent.update_log(room[arguments[1].lower()]['pick_up'])
except KeyError: except KeyError:
self.parent.update_log("You cant pick that up.") self.parent.update_log("You cant pick that up.")
else: # if its a longer list of args, the player prolly wants to pick up an item with multiple words, like hand_axe, or log_viewer else: # if its a longer list of args, the player prolly wants to pick up an item with multiple words, like hand_axe, or log_viewer
try: try:
long_arg = '_'.join(arguments[1:]) # Joins whatever comes after 1 in our args with '_' between long_arg = '_'.join(arguments[1:]) # Joins whatever comes after 1 in our args with '_' between
self.parent.parentApp.log.info('Player tried to pick up long object {0}'.format(long_arg)) self.parent.parentApp.log.info('Player tried to pick up long object {0}'.format(long_arg))
self.parent.update_log(room[long_arg.lower()]['pick_up']) self.parent.update_log(room[long_arg.lower()]['pick_up'])
except KeyError: except KeyError: