adventure-game #3

Open
Kenwood wants to merge 80 commits from adventure-game into master
2 changed files with 13 additions and 3 deletions
Showing only changes of commit 6c162e42b4 - Show all commits

View File

@ -12,7 +12,9 @@ class Handler(npyscreen.ButtonPress):
self.parent.parentApp.log.debug('Send button pressed!') self.parent.parentApp.log.debug('Send button pressed!')
# This is the raw command from the user # This is the raw command from the user
raw_command = self.parent.dialogueBox.value 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 # This is the raw command from the user
parsed_command = raw_command.split() 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 # 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)) 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 # Log the command that we parsed
self.parent.parentApp.log.info('Parsed command "{0}" with arguments "{1}"'.format(command, arguments)) self.parent.parentApp.log.info('Parsed command "{0}" with arguments "{1}"'.format(command, arguments))

View File

@ -42,8 +42,7 @@ class AdventureGame(npyscreen.NPSAppManaged):
self.log.info('Logging started!') self.log.info('Logging started!')
# parse this data first (since it includes graphics for the main menu # parse this data first (since it includes graphics for the main menu
self.gamelib = parse( self.gamelib = parse(self.mainPath / 'gamedata/gamelib.yaml')
self.mainPath / 'gamedata/gamelib.yaml')
self.log.debug('Gamelib at {0}'.format(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. # Intalize the player as none, the player will be created in the main menu.