|
@@ -2065,12 +2065,58 @@ class PlanetUpScript(object):
|
|
|
self.queue_player.put("TNL{0}\r".format(idx + 1))
|
|
|
self.cargo[c] += self.ship_cargo[c]
|
|
|
self.ship_cargo[c] = 0
|
|
|
+ return
|
|
|
break
|
|
|
self.queue_player.put("Q")
|
|
|
- self.queue_game.put(pformat(self.ship_cargo).replace("\n", self.nl) + self.nl)
|
|
|
- self.queue_game.put(pformat(self.cargo).replace("\n", self.nl) + self.nl)
|
|
|
- self.deactivate()
|
|
|
-
|
|
|
+ self.state = 6
|
|
|
+ # self.queue_game.put(pformat(self.ship_cargo).replace("\n", self.nl) + self.nl)
|
|
|
+ # self.queue_game.put(pformat(self.cargo).replace("\n", self.nl) + self.nl)
|
|
|
+ # self.deactivate()
|
|
|
+ elif self.state == 6:
|
|
|
+ if re.match(r"Command \[TL=.* \(\?=Help\)\? :", prompt):
|
|
|
+ # Ok, what do we need and where do we get it?
|
|
|
+ if self.need['C'] > self.colonists:
|
|
|
+ # NavPoint, T, Express
|
|
|
+ self.fetch = 'C'
|
|
|
+ self.queue_player.put("NTE")
|
|
|
+ self.state = 7
|
|
|
+ # elif
|
|
|
+ else:
|
|
|
+ self.queue_game.put("No, not yet!" + self.nl)
|
|
|
+ self.deactivate()
|
|
|
+ elif self.state == 7:
|
|
|
+ if re.match(r"Command \[TL=.* \(\?=Help\)\? :", prompt):
|
|
|
+ if self.fetch == 'C':
|
|
|
+ # Colonist
|
|
|
+ # [How many groups of Colonists do you want to take ([125] empty holds) ? ]
|
|
|
+ self.queue_player.put("L") # "LT\r")
|
|
|
+ elif prompt.startswith('Land on which planet <Q to abort> ?'):
|
|
|
+ if self.fetch == 'C':
|
|
|
+ self.queue_player.put("1\r")
|
|
|
+ elif prompt.startswith('Do you wish to (L)eave or (T)ake Colonists? [T] (Q to leave)'):
|
|
|
+ if self.fetch == 'C':
|
|
|
+ self.queue_player.put("T\r")
|
|
|
+ self.state = 8
|
|
|
+ elif self.state == 8:
|
|
|
+ if re.match(r"Command \[TL=.* \(\?=Help\)\? :", prompt):
|
|
|
+ # Ok, return to the planet...
|
|
|
+ self.queue_player.put("{0}\rE".format(self.planet_sector))
|
|
|
+ self.state = 9
|
|
|
+ elif self.state == 9:
|
|
|
+ if re.match(r"Command \[TL=.* \(\?=Help\)\? :", prompt):
|
|
|
+ # land
|
|
|
+ self.queue_player.put('L')
|
|
|
+ elif prompt.startswith('Land on which planet <Q to abort> ?'):
|
|
|
+ self.queue_player.put("{0}\r".format(self.planet_number))
|
|
|
+ elif prompt.startswith("Planet command (?=help) [D]"):
|
|
|
+ if self.fetch == 'C':
|
|
|
+ # Colonist / No display Planet / Leave
|
|
|
+ self.queue_player.put("SNL")
|
|
|
+ elif prompt.startswith('(1)Ore, (2)Org or (3)Equipment Production?'):
|
|
|
+ # Ok, I'd choose, but for right now.
|
|
|
+ self.queue_player.put("1\r\rQ")
|
|
|
+ self.colonists += self.fetch_amount
|
|
|
+ self.state = 6
|
|
|
|
|
|
def planet_chosen(self, choice: str):
|
|
|
if choice.strip() == '':
|
|
@@ -2177,6 +2223,14 @@ class PlanetUpScript(object):
|
|
|
if k == 'C':
|
|
|
count //= 1000
|
|
|
self.need[k] = count
|
|
|
+ elif self.state == 8:
|
|
|
+ if re.match(r'How many groups of Colonists do you want to take \(\[\d+\] empty holds\) \?', line):
|
|
|
+ # Ok, how many holds?
|
|
|
+ _, _, holds = line.partition('[')
|
|
|
+ holds, _, _ = holds.partition(']')
|
|
|
+ self.fetch_amount = int(holds)
|
|
|
+
|
|
|
+
|
|
|
|
|
|
def __del__(self):
|
|
|
log.debug("PlanetUpScript {0} RIP".format(self))
|
|
@@ -2187,6 +2241,7 @@ class PlanetUpScript(object):
|
|
|
return self.defer
|
|
|
|
|
|
def deactivate(self):
|
|
|
+ self.state = 0
|
|
|
if not self.defer is None:
|
|
|
# We have something, so:
|
|
|
self.game.to_player = self.to_player
|