|
@@ -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
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ elif self.state == 6:
|
|
|
+ if re.match(r"Command \[TL=.* \(\?=Help\)\? :", prompt):
|
|
|
+
|
|
|
+ if self.need['C'] > self.colonists:
|
|
|
+
|
|
|
+ self.fetch = 'C'
|
|
|
+ self.queue_player.put("NTE")
|
|
|
+ self.state = 7
|
|
|
+
|
|
|
+ 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':
|
|
|
+
|
|
|
+
|
|
|
+ self.queue_player.put("L")
|
|
|
+ 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):
|
|
|
+
|
|
|
+ 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):
|
|
|
+
|
|
|
+ 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':
|
|
|
+
|
|
|
+ self.queue_player.put("SNL")
|
|
|
+ elif prompt.startswith('(1)Ore, (2)Org or (3)Equipment Production?'):
|
|
|
+
|
|
|
+ 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):
|
|
|
+
|
|
|
+ _, _, 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:
|
|
|
|
|
|
self.game.to_player = self.to_player
|