|
@@ -702,6 +702,24 @@ class ScriptPort(object):
|
|
|
self.this_sector = self.sector1
|
|
|
self.queue_player.put("{0}\r".format(self.sector1))
|
|
|
self.state = 10
|
|
|
+ elif re.match(r'Your offer \[\d+\] \?', prompt):
|
|
|
+ if self.fix_offer:
|
|
|
+ # Make real offer / WHAT?@?!
|
|
|
+ work = prompt.replace(',', '')
|
|
|
+ parts = re.split(r"\s+", work)
|
|
|
+ amount = parts[2]
|
|
|
+ # Ok, we have the amount, now to figure pct...
|
|
|
+ if self.sell_pct > 100:
|
|
|
+ self.sell_pct -= 1
|
|
|
+ else:
|
|
|
+ self.sell_pct += 1
|
|
|
+ price = amount * self.sell_pct // 100
|
|
|
+ log.msg("start: {0} % {1} price {2}".format(amount, self.sell_perc, price))
|
|
|
+ if self.sell_pct > 100:
|
|
|
+ self.sell_pct -= 1
|
|
|
+ else:
|
|
|
+ self.sell_pct += 1
|
|
|
+ self.queue_player.put("{0}\r".format(price))
|
|
|
|
|
|
elif self.state == 8:
|
|
|
# What are we trading
|
|
@@ -780,6 +798,7 @@ class ScriptPort(object):
|
|
|
self.tpc = self.this_port['class']
|
|
|
self.opc = self.other_port['class']
|
|
|
self.fixable = 0
|
|
|
+ self.fix_offer = 0
|
|
|
|
|
|
# [ Items Status Trading % of max OnBoard]
|
|
|
# [ ----- ------ ------- -------- -------]
|
|
@@ -901,9 +920,10 @@ class ScriptPort(object):
|
|
|
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':
|
|
|
+ parts = re.split(r"\s+", work)
|
|
|
+ # log.msg(parts)
|
|
|
+ # Equipment, Selling xxx x% xxx
|
|
|
+ if parts[-1] != '0' and parts[2] != '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':
|
|
@@ -944,7 +964,11 @@ class ScriptPort(object):
|
|
|
if "We're not interested." in line:
|
|
|
log.msg("Try, try again. :(")
|
|
|
self.state = 5
|
|
|
- self.trade()
|
|
|
+ self.trade()
|
|
|
+ if "WHAT?!@!? you must be crazy!" in line:
|
|
|
+ self.fix_offer = 1
|
|
|
+ if "So, you think I'm as stupid as you look?" in line:
|
|
|
+ self.fix_offer = 1
|
|
|
|
|
|
elif self.state == 8:
|
|
|
# Haggle Buy
|