|
@@ -664,7 +664,20 @@ class ScriptPort(object):
|
|
|
self.queue_game.put(self.r + self.nl)
|
|
|
d = pi.prompt("Times to execute script", 5, name='count')
|
|
|
d.addCallback(got_need2)
|
|
|
-
|
|
|
+ elif self.state == 6:
|
|
|
+ if re.match(r"Command \[TL=.* \(\?=Help\)\? :", prompt):
|
|
|
+ if self.fixable:
|
|
|
+ log.msg("Fixing...")
|
|
|
+ if self.this_sector == self.sector1:
|
|
|
+ self.this_sector = self.sector2
|
|
|
+ self.queue_player.put("{0}\r".format(self.sector2))
|
|
|
+ self.state = 5
|
|
|
+ self.trade()
|
|
|
+ else:
|
|
|
+ self.this_sector = self.sector1
|
|
|
+ self.queue_player.put("{0}\r".format(self.sector1))
|
|
|
+ self.state = 5
|
|
|
+ self.trade()
|
|
|
elif self.state == 7:
|
|
|
if re.match(r"Command \[TL=.* \(\?=Help\)\? :", prompt):
|
|
|
# Done
|
|
@@ -766,6 +779,7 @@ class ScriptPort(object):
|
|
|
# Ok, perform some calculations
|
|
|
self.tpc = self.this_port['class']
|
|
|
self.opc = self.other_port['class']
|
|
|
+ self.fixable = 0
|
|
|
|
|
|
# [ Items Status Trading % of max OnBoard]
|
|
|
# [ ----- ------ ------- -------- -------]
|
|
@@ -884,11 +898,29 @@ class ScriptPort(object):
|
|
|
if "We are selling up to" in line:
|
|
|
# Buy
|
|
|
self.state = 8
|
|
|
- self.sell_perc = 100 - self.percent
|
|
|
+ self.sell_perc = 100 - self.percent
|
|
|
+ if line.startswith('Fuel Ore') or line.startswith('Organics') or line.startswith('Equipment'):
|
|
|
+ work = line.replace('Fuel Ore', 'Fuel')
|
|
|
+ # parts = re.split(r"\s+", work)
|
|
|
+ log.msg(parts)
|
|
|
+ if parts[0] != '0' and parts[1] != 'Buying':
|
|
|
+ log.msg("We have a problem -- they aren't buying what we have in stock!")
|
|
|
+ stuff = line[0] # F O or E.
|
|
|
+ if stuff == 'F':
|
|
|
+ spos = 0
|
|
|
+ elif stuff == 'O':
|
|
|
+ spos = 1
|
|
|
+ else:
|
|
|
+ spos = 2
|
|
|
+ other = self.other_port['port']
|
|
|
+ if other[spos] == 'B':
|
|
|
+ self.fixable = 1
|
|
|
+
|
|
|
if "You don't have anything they want" in line:
|
|
|
# Neither! DRAT!
|
|
|
- self.deactivate()
|
|
|
- return
|
|
|
+ if not self.fixable:
|
|
|
+ self.deactivate()
|
|
|
+ return
|
|
|
if "We're not interested." in line:
|
|
|
log.msg("Try, try again. :(")
|
|
|
self.state = 5
|