/
ir-gts-bw-new.py
148 lines (130 loc) · 4.74 KB
/
ir-gts-bw-new.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#!/usr/bin/python
# "A script that acts as the GTS, for sending and receiving pokemon between a
# retail cart and a PC. Credit goes to LordLandon and his sendpkm script, as
# well as the description of the GTS protocol from
# http://projectpokemon.org/wiki/GTS_protocol
#
# - Infinite Recursion"
#
# Resurrection of the Infinite Recursion pseudo-GTS script, now with 80% more
# infinite recursion! This is always a work in progress, started by Infinite
# Recursion and LordLandon, with some code borrowed from Pokecheck.org.
#
# - chickenmatt5
from src import gtsvar
from src.pokehaxlib import initServ
from src.getpkm import getpkm
from src.sendpkm import sendpkm, multisend, queuesend, customqueuesend
from src.stats import statana
from src.gbatonds import threetofour
#from src.pokecheck import *
from platform import system
from sys import argv, exit
from time import sleep
import os
s = system()
if s == 'Darwin' or s == 'Linux':
if os.getuid() != 0:
print 'Program must be run as superuser. Enter your password below' + \
' if prompted.'
os.system('sudo ' + argv[0] + ' root')
exit(0)
print "\n",gtsvar.version,"\n"
if gtsvar.stable == 'no':
print "==============================================="
print "EXPERIMENTAL/UNSTABLE VERSION! MIGHT HAVE BUGS!"
print "===============================================\n"
def convertmenu():
while True:
print '\nChoose a conversion option:'
print '1 - convert 3rd gen Pokemon file to 4th gen .pkm'
print '2 - convert 3rd gen Pokemon file to 5th gen .pkm'
print '3 - convert 4th gen .pkm to 5th gen .pkm'
print 'r - return to main menu'
print 'q - quit'
number = raw_input().strip().lower()
if number.startswith('1'): threetofour()
elif number.startswith('2'): threetofive()
elif number.startswith('3'): fourtofive()
elif number.startswith('r'): break
elif number.startswith('q'):
print 'Quitting program'
exit()
else:
print 'Invalid option, try again'
continue
print 'Returning to conversion menu...'
while True:
print '\nChoose:'
print 'a - analyze pkm file'
print 'o - continue to online mode'
print 'c - convert .pkm files to newer gens'
print 'q - quit\n'
print '\nPlease type your option, and press Enter\n'
choice = raw_input().strip().lower()
if choice.startswith('a'): statana()
elif choice.startswith('o'):
print '\nContinuing to online menu...\n\n'
break
elif choice.startswith('c'): threetofour()
elif choice.startswith('q'):
print 'Quitting program'
exit()
else:
print 'Invalid option, please try again.'
continue
print 'Returning to menu...\n'
initServ()
sleep(1)
def sendmenu():
while True:
print '\nChoose an option to send Pokemon:'
print 'o - send one Pokemon to game'
print 'm - choose & send multiple Pokemon to game'
print 'f - send all Pokemon in queue folder'
print 'c - choose folder full of Pokemon to send'
#print 'd - download and send a pkm from Pokecheck.org to game'
print 'r - return to main menu'
print 'q - quit\n'
print '\nPlease type your option, and press Enter\n'
soption = raw_input().strip().lower()
if soption.startswith('o'): sendpkm()
elif soption.startswith('m'):multisend()
elif soption.startswith('f'): queuesend()
elif soption.startswith('c'): customqueuesend()
#elif soption.startswith('d'): pcdownload()
elif soption.startswith('r'): break
elif soption.startswith('q'):
print 'Quitting program'
exit()
else:
print 'Invalid option, try again'
continue
print 'Returning to send menu...'
done = False
while True:
print '\nChoose an option:'
print 's - send pkm file to game'
print 'r - receive Pokemon from game'
print 'm - receive multiple Pokemon from game'
print 'a - analyze pkm file'
#print 'p - search Pokecheck.org for pkm file'
print 'q - quit\n'
print '\nPlease type your option, and press Enter\n'
option = raw_input().strip().lower()
if option.startswith('s'): sendmenu()
elif option.startswith('r'): getpkm()
elif option.startswith('m'):
print 'Press ctrl + c to return to main menu'
while True:
try: getpkm()
except KeyboardInterrupt: break
elif option.startswith('a'): statana()
#elif option.startswith('p'): pcsearch()
elif option.startswith('q'):
print 'Quitting program'
exit()
else:
print 'Invalid option, try again'
continue
print 'Returning to main menu...'