Browse Source

ColoScript2 and PlanetUp Cit LVLs

 Oooh, we now can bring up the Planet Upgrade script and see what level
the citadel is on our planets. No need to go to a maxed out planet to
try and upgrade it.
david 5 năm trước cách đây
mục cha
commit
bd4cfb0a74
1 tập tin đã thay đổi với 43 bổ sung22 xóa
  1. 43 22
      flexible.py

+ 43 - 22
flexible.py

@@ -2097,15 +2097,15 @@ class PlanetUpScript(object):
 
             box = Boxes(44, color=tc)
             self.queue_game.put(box.top())
-            self.queue_game.put(box.row(tc + "{0:3} {1:6} {2:33}".format(" # ", "Sector", "Planet Name")))
+            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):
-                row = "{0}{1:^3} {2:6} {3}{4:33}".format(c1, number, sector, c2, name)
+            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)
                 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'])
+                planet_output(s, self.planets[s]['sector'], self.planets[s]['name'], self.planets[s]['cit'])
 
             self.queue_game.put(box.bottom())
 
@@ -2343,14 +2343,28 @@ class PlanetUpScript(object):
                 if line[7] == 'T':
                     line = line[:7] + ' ' + line[8:]
 
-                detail, _, _ = line.partition('Class')
-                detail = detail.strip() # Sector  #X  Name of planet
-                sector, number, name = re.split(r'\s+', detail, 2)
-                sector = int(sector)
-                number = int(number[1:])
+                details = line.strip()
+                details = re.split(r"\s+", details)
+                #log.debug(details) # Is that what we are after?
+                name = details[2]
+                sector = int(details[0])
+                number = int(details[1].replace('#', ''))
+                if(details[7] != 'Citadel'):
+                    cit = int(details[7])
+                else: # Oops, there looks like there is no citadel here.
+                    cit = 0
                 self.last_seen = number
-                self.planets[number] = {"sector": sector, "name": name}
-                log.info("Planet # {0} in {1} called {2}".format( number, sector, name))
+                self.planets[number] = {"sector": sector, "name": name, "cit": cit}
+                log.info("Planet # {0} in {1} called {2} with a lvl {3} citadel".format( number, sector, name, cit))
+
+                #detail, _, _ = line.partition('Class')
+                #detail = detail.strip() # Sector  #X  Name of planet
+                #sector, number, name = re.split(r'\s+', detail, 2)
+                #sector = int(sector)
+                #number = int(number[1:])
+                #self.last_seen = number
+                #self.planets[number] = {"sector": sector, "name": name}
+                #log.info("Planet # {0} in {1} called {2}".format( number, sector, name))
             if '---' in line:
                 number = self.last_seen
                 # Ok, take the last_seen number, and use it for this line
@@ -2663,15 +2677,15 @@ class ColoScript2(object):
 
             box = Boxes(44, color=tc)
             self.queue_game.put(box.top())
-            self.queue_game.put(box.row(tc + "{0:3} {1:6} {2:33}".format(" # ", "Sector", "Planet Name")))
+            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):
-                row = "{0}{1:^3} {2:6} {3}{4:33}".format(c1, number, sector, c2, name)
+            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)
                 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'])
+                planet_output(s, self.planets[s]['sector'], self.planets[s]['name'], self.planets[s]['cit'])
 
             self.queue_game.put(box.bottom())
 
@@ -2814,14 +2828,19 @@ class ColoScript2(object):
                 if line[7] == 'T':
                     line = line[:7] + ' ' + line[8:]
 
-                detail, _, _ = line.partition('Class')
-                detail = detail.strip() # Sector  #X  Name of planet
-                sector, number, name = re.split(r'\s+', detail, 2)
-                sector = int(sector)
-                number = int(number[1:])
+                details = line.strip()
+                details = re.split(r"\s+", details)
+                #log.debug(details) # Is that what we are after?
+                name = details[2]
+                sector = int(details[0])
+                number = int(details[1].replace('#', ''))
+                if(details[7] != 'Citadel'):
+                    cit = int(details[7])
+                else: # Oops, there looks like there is no citadel here.
+                    cit = 0
                 self.last_seen = number
-                self.planets[number] = {"sector": sector, "name": name}
-                log.info("Planet # {0} in {1} called {2}".format( number, sector, name))
+                self.planets[number] = {"sector": sector, "name": name, "cit": 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
                 # Ok, take the last_seen number, and use it for this line
@@ -2830,6 +2849,7 @@ class ColoScript2(object):
                 # [ 10202   #3    Home of Bugz             Class M, Earth Type        No Citadel]
                 # [   ---   (1M)           144   49   26   145    75    12         10          0]
                 details = re.split(r"\s+", line.strip())
+                log.debug(details) # What are we getting?
                 # OK:  Likely, I'm not going to use these numbers AT ALL.  
                 self.planets[number]['population'] = details[1].replace('(', '').replace(')', '')
                 # Ok, there's going to have to be some sort of modifier (K, M, etc.)
@@ -2837,6 +2857,7 @@ class ColoScript2(object):
                 self.planets[number]['ore'] = details[5]
                 self.planets[number]['org'] = details[6]
                 self.planets[number]['equ'] = details[7]
+                #self.planets[number]['cit'] = details[9] # This is if we wanted cit money... but that's not it