adventure-game #3
|
@ -75,6 +75,23 @@ class Handler(npyscreen.ButtonPress):
|
|||
except KeyError:
|
||||
self.parent.update_log("Not sure what you're trying to look at.")
|
||||
|
||||
if command == 'PICK':
|
||||
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
|
||||
try:
|
||||
# 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.update_log(room[arguments[1].lower()]['pick_up'])
|
||||
except KeyError:
|
||||
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
|
||||
try:
|
||||
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.update_log(room[long_arg.lower()]['pick_up'])
|
||||
except KeyError:
|
||||
self.parent.update_log("You cant pick that up.")
|
||||
|
||||
if command == 'WHERE':
|
||||
# TODO: this should take the human readable room name, not the code-name
|
||||
self.parent.update_log('You are in {0}.'.format(room))
|
||||
|
|
|
@ -7,6 +7,6 @@ office:
|
|||
look_at: "You move to stand behind your desk. You see a |NAMEPLATE|, a |TAPE RECORDER| and your trusty |LOG VIEWER|"
|
||||
inspect: "Desk, ornate, stuff"
|
||||
log_viewer:
|
||||
look_at: "logviewer looks like garbo"
|
||||
look_at: "log viewer looks like garbo"
|
||||
inspect: "beep boop"
|
||||
pick_up: "You pick up the *LOG VIEWER*."
|
Loading…
Reference in New Issue