def build_team(): screen.nodelay(0) screen.clear() pk = ['None'] + save.get_Files('POKE') selection = -1 option = 0 lines = [ 'Member_1', 'Member_2', 'Member_3', 'Member_4', 'Member_5', 'Member_6', 'Team Name', 'Save' ] #Create dictionaries needed to support selections vals = dict(zip(range(len(lines)), [0] * len(lines))) strvals = dict(zip(range(len(lines)), [''] * len(lines))) maxval = dict(zip(range(len(lines)), [1] * len(lines))) #Set max unique values for each option for i in range(6): maxval[i] = len(pk) while selection < 0: # Display Static Information graphics = [0] * len(lines) graphics[option] = curses.A_REVERSE screen.clear() for i, l in enumerate(lines): screen.addstr(i + 1, 1, l, graphics[i]) screen.border() # Update string values for each option for i in range(6): strvals[i] = pk[vals[i]] # Display Current Choices for i in range(len(lines)): screen.addstr(i + 1, len(lines[i]) + 2, strvals[i]) # Flush to Screne screen.refresh() # Create Pokemon and team if strvals[6] == '': tName = 'Unnamed Team' else: tName = strvals[6] team = pokeStructs.Team(tName) for i in range(6): if strvals[i] != 'None': poke = save.load_Poke(strvals[i]) team.set_Member(i + 1, poke) # Key Stuff action = screen.getch() if action == curses.KEY_UP: option = (option - 1) % len(lines) elif action == curses.KEY_DOWN: option = (option + 1) % len(lines) elif action == curses.KEY_LEFT: vals[option] = (vals[option] - 1) % maxval[option] elif action == curses.KEY_RIGHT: vals[option] = (vals[option] + 1) % maxval[option] elif action == ord('\n'): if option in range(6): poke = team.get_Member(option + 1) if poke != 'Position Empty': d_poke(poke) elif option == 6: curses.echo() screen.addstr(7, 11, '?') strvals[6] = screen.getstr(7, 11) curses.noecho() screen.getch() elif option == 7: save.save_Team(team) selection = action elif action == ord('q'): selection = action elif action == ord('d'): d_team(team) screen.refresh() screen.clear() build_menu()
def build_team(): screen.nodelay(0) screen.clear() pk = ['None'] + save.get_Files('POKE') selection = -1 option = 0 lines = ['Member_1', 'Member_2', 'Member_3', 'Member_4', 'Member_5', 'Member_6', 'Team Name', 'Save'] #Create dictionaries needed to support selections vals = dict(zip(range(len(lines)), [0]*len(lines))) strvals = dict(zip(range(len(lines)), ['']*len(lines))) maxval = dict(zip(range(len(lines)), [1]*len(lines))) #Set max unique values for each option for i in range(6): maxval[i] = len(pk) while selection < 0: # Display Static Information graphics = [0]*len(lines) graphics[option] = curses.A_REVERSE screen.clear() for i, l in enumerate(lines): screen.addstr(i+1, 1, l, graphics[i]) screen.border() # Update string values for each option for i in range(6): strvals[i] = pk[vals[i]] # Display Current Choices for i in range(len(lines)): screen.addstr(i+1, len(lines[i])+2, strvals[i]) # Flush to Screne screen.refresh() # Create Pokemon and team if strvals[6] == '': tName = 'Unnamed Team' else: tName = strvals[6] team = pokeStructs.Team(tName) for i in range(6): if strvals[i] != 'None': poke = save.load_Poke(strvals[i]) team.set_Member(i+1, poke) # Key Stuff action = screen.getch() if action == curses.KEY_UP: option = (option - 1)%len(lines) elif action == curses.KEY_DOWN: option = (option + 1)%len(lines) elif action == curses.KEY_LEFT: vals[option] = (vals[option]-1)%maxval[option] elif action == curses.KEY_RIGHT: vals[option] = (vals[option]+1)%maxval[option] elif action == ord('\n'): if option in range(6): poke = team.get_Member(option+1) if poke != 'Position Empty': d_poke(poke) elif option == 6: curses.echo() screen.addstr(7, 11, '?') strvals[6] = screen.getstr(7, 11) curses.noecho() screen.getch() elif option == 7: save.save_Team(team) selection = action elif action == ord('q'): selection = action elif action == ord('d'): d_team(team) screen.refresh() screen.clear() build_menu()
def select_team(player): screen.nodelay(0) screen.clear() selection = -1 option = 0 rand_team = pkmn_test.random_Team() teams = save.get_Files('TEAM') + ['Random'] lines = [ 'Team', 'Member_1', 'Member_2', 'Member_3', 'Member_4', 'Member_5', 'Member_6', 'Confirm' ] title = player + ' Team Selection' #Create dictionaries needed to support selections vals = dict(zip(range(len(lines)), [0] * len(lines))) strvals = dict(zip(range(len(lines)), [''] * len(lines))) maxval = dict(zip(range(len(lines)), [1] * len(lines))) #Set max unique values for each option maxval[0] = len(teams) while selection < 0: # Display Static Information graphics = [0] * len(lines) graphics[option] = curses.A_REVERSE screen.clear() screen.addstr(1, (dims[1] - len(title)) / 2, title, curses.A_BOLD) for i, l in enumerate(lines): screen.addstr(2 * i + 3, 1, l, graphics[i]) screen.border() # Update string values for each option strvals[0] = teams[vals[0]] # Grab team if strvals[0] == 'Random': team = rand_team else: team = save.load_Team(strvals[0]) # Update string values with poke for i in range(1, 7): if team.pos_open(i): strvals[i] = '' else: poke = team.get_Member(i) strvals[i] = poke.Name # Display Current Choices for i in range(len(lines) - 1): screen.addstr(2 * i + 3, len(lines[i]) + 2, strvals[i]) # Flush to Screne screen.refresh() # Key Stuff action = screen.getch() if action == curses.KEY_UP: option = (option - 1) % len(lines) elif action == curses.KEY_DOWN: option = (option + 1) % len(lines) elif action == curses.KEY_LEFT: vals[option] = (vals[option] - 1) % maxval[option] elif action == curses.KEY_RIGHT: vals[option] = (vals[option] + 1) % maxval[option] elif action == ord('\n'): if option == 0: d_team(team) elif option in range(1, 7): d_poke(team.get_Member(option)) elif option == 7: selection = option elif action == ord('q'): selection = option elif action == ord('d'): d_team(team) screen.refresh() screen.clear() return team
def select_team(player): screen.nodelay(0) screen.clear() selection = -1 option = 0 rand_team = pkmn_test.random_Team() teams = save.get_Files('TEAM') + ['Random'] lines = ['Team', 'Member_1', 'Member_2', 'Member_3', 'Member_4', 'Member_5', 'Member_6', 'Confirm'] title = player + ' Team Selection' #Create dictionaries needed to support selections vals = dict(zip(range(len(lines)), [0]*len(lines))) strvals = dict(zip(range(len(lines)), ['']*len(lines))) maxval = dict(zip(range(len(lines)), [1]*len(lines))) #Set max unique values for each option maxval[0] = len(teams) while selection < 0: # Display Static Information graphics = [0]*len(lines) graphics[option] = curses.A_REVERSE screen.clear() screen.addstr(1, (dims[1]-len(title))/2, title, curses.A_BOLD) for i, l in enumerate(lines): screen.addstr(2*i+3, 1, l, graphics[i]) screen.border() # Update string values for each option strvals[0] = teams[vals[0]] # Grab team if strvals[0] == 'Random': team = rand_team else: team = save.load_Team(strvals[0]) # Update string values with poke for i in range(1, 7): if team.pos_open(i): strvals[i] = '' else: poke = team.get_Member(i) strvals[i] = poke.Name # Display Current Choices for i in range(len(lines)-1): screen.addstr(2*i+3, len(lines[i])+2, strvals[i]) # Flush to Screne screen.refresh() # Key Stuff action = screen.getch() if action == curses.KEY_UP: option = (option - 1)%len(lines) elif action == curses.KEY_DOWN: option = (option + 1)%len(lines) elif action == curses.KEY_LEFT: vals[option] = (vals[option]-1)%maxval[option] elif action == curses.KEY_RIGHT: vals[option] = (vals[option]+1)%maxval[option] elif action == ord('\n'): if option == 0: d_team(team) elif option in range(1, 7): d_poke(team.get_Member(option)) elif option == 7: selection = option elif action == ord('q'): selection = option elif action == ord('d'): d_team(team) screen.refresh() screen.clear() return team