|
@@ -2102,12 +2102,12 @@ class PlanetUpScript(object):
|
|
|
self.queue_game.put(box.row(tc + "{0:3} {1:6} {2:20} {3} ".format(" # ", "Sector", "Planet Name", "Citadel LVL")))
|
|
|
self.queue_game.put(box.middle())
|
|
|
|
|
|
- def planet_output(number, sector, name, cit):
|
|
|
- row = "{0}{1:^3} {2:6} {3}{4:29} {0}{5:2} ".format(c1, number, sector, c2, name, cit)
|
|
|
+ def planet_output(number, sector, name, citadel):
|
|
|
+ row = "{0}{1:^3} {2:6} {3}{4:29} {0}{5:2} ".format(c1, number, sector, c2, name, citadel)
|
|
|
self.queue_game.put(box.row(row))
|
|
|
|
|
|
for s in sorted(self.planets.keys()):
|
|
|
- planet_output(s, self.planets[s]['sector'], self.planets[s]['name'], self.planets[s]['cit'])
|
|
|
+ planet_output(s, self.planets[s]['sector'], self.planets[s]['name'], self.planets[s]['citadel'])
|
|
|
|
|
|
self.queue_game.put(box.bottom())
|
|
|
|
|
@@ -2345,27 +2345,17 @@ class PlanetUpScript(object):
|
|
|
if line[7] == 'T':
|
|
|
line = line[:7] + ' ' + line[8:]
|
|
|
|
|
|
- details = line.strip()
|
|
|
- details = re.split(r"\s+", details)
|
|
|
+ details, _, citadel = line.partition('Class')
|
|
|
#log.debug(details) # Is that what we are after?
|
|
|
- name = details[2]
|
|
|
- n = 3
|
|
|
- t = True
|
|
|
- while t:
|
|
|
- if details[n] != 'Class': # Multiple words in planet name
|
|
|
- name += " " + details[n]
|
|
|
- n += 1
|
|
|
- elif details[n] == 'Class': # Works if you don't name a planet Class
|
|
|
- t = False
|
|
|
-
|
|
|
- sector = int(details[0])
|
|
|
- number = int(details[1].replace('#', ''))
|
|
|
- if(details[-1] != 'Citadel'):
|
|
|
- cit = int(details[-1]) # Grab last item
|
|
|
+ sector, planet_number, name = re.split(r'\s*', details.strip(), 2)
|
|
|
+ sector = int(sector)
|
|
|
+ number = int(planet_number.replace('#', ''))
|
|
|
+ if 'Level' in citadel:
|
|
|
+ cit = int(citadel[-1]) # Grab last item
|
|
|
else: # Oops, there looks like there is no citadel here.
|
|
|
cit = 0
|
|
|
self.last_seen = number
|
|
|
- self.planets[number] = {"sector": sector, "name": name, "cit": cit}
|
|
|
+ self.planets[number] = {"sector": sector, "name": name, "citadel": cit}
|
|
|
log.info("Planet # {0} in {1} called {2} with a lvl {3} citadel".format( number, sector, name, cit))
|
|
|
|
|
|
#detail, _, _ = line.partition('Class')
|
|
@@ -2692,12 +2682,12 @@ class ColoScript2(object):
|
|
|
self.queue_game.put(box.row(tc + "{0:3} {1:6} {2:20} {3} ".format(" # ", "Sector", "Planet Name", "Citadel LVL")))
|
|
|
self.queue_game.put(box.middle())
|
|
|
|
|
|
- def planet_output(number, sector, name, cit):
|
|
|
- row = "{0}{1:^3} {2:6} {3}{4:29} {0}{5:2} ".format(c1, number, sector, c2, name, cit)
|
|
|
+ def planet_output(number, sector, name, citadel):
|
|
|
+ row = "{0}{1:^3} {2:6} {3}{4:29} {0}{5:2} ".format(c1, number, sector, c2, name, citadel)
|
|
|
self.queue_game.put(box.row(row))
|
|
|
|
|
|
for s in sorted(self.planets.keys()):
|
|
|
- planet_output(s, self.planets[s]['sector'], self.planets[s]['name'], self.planets[s]['cit'])
|
|
|
+ planet_output(s, self.planets[s]['sector'], self.planets[s]['name'], self.planets[s]['citadel'])
|
|
|
|
|
|
self.queue_game.put(box.bottom())
|
|
|
|
|
@@ -2837,30 +2827,22 @@ class ColoScript2(object):
|
|
|
if '#' in line:
|
|
|
# Ok, we have a planet detail line.
|
|
|
# There's an extra T when the planet is maxed out.
|
|
|
+ # [ 986 #114 Trantor Class M, Earth Type No Citadel]
|
|
|
+ # [ 23 #17 gift Class O, Oceanic Level 1]
|
|
|
if line[7] == 'T':
|
|
|
line = line[:7] + ' ' + line[8:]
|
|
|
|
|
|
- details = line.strip()
|
|
|
- details = re.split(r"\s+", details)
|
|
|
+ details, _, citadel = line.partition('Class')
|
|
|
#log.debug(details) # Is that what we are after?
|
|
|
- name = details[2]
|
|
|
- n = 3
|
|
|
- t = True
|
|
|
- while t:
|
|
|
- if details[n] != 'Class': # Multiple words in planet name
|
|
|
- name += " " + details[n]
|
|
|
- n += 1
|
|
|
- elif details[n] == 'Class': # Works if you don't name a planet Class
|
|
|
- t = False
|
|
|
-
|
|
|
- sector = int(details[0])
|
|
|
- number = int(details[1].replace('#', ''))
|
|
|
- if(details[-1] != 'Citadel'):
|
|
|
- cit = int(details[-1]) # Grab last item
|
|
|
+ sector, planet_number, name = re.split(r'\s*', details.strip(), 2)
|
|
|
+ sector = int(sector)
|
|
|
+ number = int(planet_number.replace('#', ''))
|
|
|
+ if 'Level' in citadel:
|
|
|
+ cit = int(citadel[-1]) # Grab last item
|
|
|
else: # Oops, there looks like there is no citadel here.
|
|
|
cit = 0
|
|
|
self.last_seen = number
|
|
|
- self.planets[number] = {"sector": sector, "name": name, "cit": cit}
|
|
|
+ self.planets[number] = {"sector": sector, "name": name, "citadel": cit}
|
|
|
log.info("Planet # {0} in {1} called {2} with a lvl {3} citadel".format( number, sector, name, cit))
|
|
|
if '---' in line:
|
|
|
number = self.last_seen
|