Selaa lähdekoodia

ColoScript2 & PlanetUp Fixed to display Cit Level

david 5 vuotta sitten
vanhempi
commit
1ab2823187
1 muutettua tiedostoa jossa 23 lisäystä ja 4 poistoa
  1. 23 4
      flexible.py

+ 23 - 4
flexible.py

@@ -2349,10 +2349,19 @@ class PlanetUpScript(object):
                 details = re.split(r"\s+", details)
                 #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[7] != 'Citadel'):
-                    cit = int(details[7])
+                if(details[-1] != 'Citadel'):
+                    cit = int(details[-1]) # Grab last item
                 else: # Oops, there looks like there is no citadel here.
                     cit = 0
                 self.last_seen = number
@@ -2537,6 +2546,7 @@ class ColoScript2(object):
         self.planets = {}
         self.loops = 0
         self.maxloops = 0
+        self.last_seen = 0
 
         # Sector Numbers of Planets TO and FROM
         self.TO = 0
@@ -2834,10 +2844,19 @@ class ColoScript2(object):
                 details = re.split(r"\s+", details)
                 #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[7] != 'Citadel'):
-                    cit = int(details[7])
+                if(details[-1] != 'Citadel'):
+                    cit = int(details[-1]) # Grab last item
                 else: # Oops, there looks like there is no citadel here.
                     cit = 0
                 self.last_seen = number