def DefaultGroup( ): global GLOB_PLAYERS # ClearScreen() stdscr.clear() stdscr.addstr( "Initiate Default Group!\n" ) for i in GLOB_PLAYERS: if i.Active : stdscr.addstr( "WARNING! Active Player Detected! Overwrite? (y/n)\n" ) # Check to see if the user really wants to overwrite. stdscr.addstr( ">> " ) if stdscr.getkey() == 'y' : break else: # Anything other then a y will result in aborting the overwrite return # Clear global list if it exists GLOB_PLAYERS = [] # Initiate default players list # TODO: This would be better as a pull from local user settings. mule = Player() mule.Name = "Nate H" mule.Initiative = 0 GLOB_PLAYERS.append( mule ) mule = Player() mule.Name = "John T" mule.Initiative = 0 GLOB_PLAYERS.append( mule ) mule = Player() mule.Name = "Alexandria T" mule.Initiative = 0 GLOB_PLAYERS.append( mule ) mule = Player() mule.Name = "Victor T" mule.Initiative = 0 GLOB_PLAYERS.append( mule ) mule = Player() mule.Name = "NPC(s)" mule.Initiative = 0 GLOB_PLAYERS.append( mule ) # Write changes to disk SaveGame() return
def BlastPlayers( ): global GLOB_PLAYERS while( 1 ): stdscr.clear() stdscr.addstr( "Blast set of players into initiative.\n" ) stdscr.addstr( "Blank line to finish!\n" ) stdscr.addstr( "Next name to add...\n" ) tmp = GetInput( "> ", str ) if ( len( tmp ) ): mule = Player() mule.Name = tmp GLOB_PLAYERS.append( mule ) else: break BlastInitiative() return
def AddPlayer( ): global GLOB_PLAYERS stdscr.clear() stdscr.addstr( "Adding player to game!\n" ) mule = Player() stdscr.addstr( "Player Name: " ) curses.echo() mule.Name = stdscr.getstr() curses.noecho() # Error check for empty names! if( not len( mule.Name ) ): return stdscr.addstr( "Initiative: " ) mule.Initiative = GetInput( "", float ) GLOB_PLAYERS.append( mule ) return