handler is aware of player data
This commit is contained in:
parent
5184bd9121
commit
6c162e42b4
|
@ -12,7 +12,9 @@ class Handler(npyscreen.ButtonPress):
|
|||
self.parent.parentApp.log.debug('Send button pressed!')
|
||||
# This is the raw command from the user
|
||||
raw_command = self.parent.dialogueBox.value
|
||||
self.parent.dialogueBox.value = '' # Clear the dialogue box, TODO: This may become unneeded if issue #8 is fixed
|
||||
|
||||
# Clear the dialogue box, TODO: This may become unneeded if issue #8 is fixed
|
||||
self.parent.dialogueBox.value = ''
|
||||
|
||||
# This is the raw command from the user
|
||||
parsed_command = raw_command.split()
|
||||
|
@ -32,6 +34,15 @@ class Handler(npyscreen.ButtonPress):
|
|||
# Concatenate everything back together (just to show the user the program understood them correctly
|
||||
self.parent.update_log(command + ' ' + ' '.join(str(s) for s in arguments))
|
||||
|
||||
"""
|
||||
This is where real logic can happen!
|
||||
"""
|
||||
|
||||
# Localize the player
|
||||
player = self.parent.parentApp.player
|
||||
room = player.playerData['player']['location'] # This is ugly, and should point to the room's name and not the system name
|
||||
self.parent.update_log('You are in {0}.'.format(room))
|
||||
|
||||
# Log the command that we parsed
|
||||
self.parent.parentApp.log.info('Parsed command "{0}" with arguments "{1}"'.format(command, arguments))
|
||||
|
||||
|
|
|
@ -42,8 +42,7 @@ class AdventureGame(npyscreen.NPSAppManaged):
|
|||
self.log.info('Logging started!')
|
||||
|
||||
# parse this data first (since it includes graphics for the main menu
|
||||
self.gamelib = parse(
|
||||
self.mainPath / 'gamedata/gamelib.yaml')
|
||||
self.gamelib = parse(self.mainPath / 'gamedata/gamelib.yaml')
|
||||
self.log.debug('Gamelib at {0}'.format(self.mainPath / 'gamedata/gamelib.yaml'))
|
||||
|
||||
# Intalize the player as none, the player will be created in the main menu.
|
||||
|
|
Loading…
Reference in New Issue