|
@@ -512,7 +512,25 @@ class ScriptPort(object):
|
|
|
self.this_sector = None # Starting sector
|
|
|
self.sector1 = None # Current Sector
|
|
|
self.sector2 = None # Next Sector Stop
|
|
|
- self.percent = 5 # Stick with the good default.
|
|
|
+ self.percent = self.game.gamedata.get_config('Trade_Percent', '5')
|
|
|
+
|
|
|
+ update_config = False
|
|
|
+ try:
|
|
|
+ self.percent = int(self.percent)
|
|
|
+ except ValueError:
|
|
|
+ self.percent = 5
|
|
|
+ update_config = True
|
|
|
+
|
|
|
+ if self.percent > 50:
|
|
|
+ self.percent = 5
|
|
|
+ update_config = True
|
|
|
+ if self.percent < 0:
|
|
|
+ self.percent = 0
|
|
|
+ update_config = True
|
|
|
+
|
|
|
+ if update_config:
|
|
|
+ self.game.gamedata.set_config('Trade_Percent', self.percent)
|
|
|
+
|
|
|
self.credits = 0
|
|
|
self.last_credits = None
|
|
|
self.times_left = 0
|
|
@@ -674,6 +692,7 @@ class ScriptPort(object):
|
|
|
self.state = 10
|
|
|
|
|
|
elif re.match(r'Your offer \[\d+\] \?', prompt):
|
|
|
+ log.info("Your offer? [{0}]".format(self.fix_offer))
|
|
|
if self.fix_offer:
|
|
|
# Make real offer / WHAT?@?!
|
|
|
work = prompt.replace(',', '')
|
|
@@ -691,6 +710,10 @@ class ScriptPort(object):
|
|
|
else:
|
|
|
self.sell_percent += 1
|
|
|
self.queue_player.put("{0}\r".format(price))
|
|
|
+ # elif re.match(r"How many holds of .+ do you want to sell \[\d+\]\?", prompt):
|
|
|
+ # log.info("Sell everything we can...")
|
|
|
+ # # this seems to screw up the sync of everything.
|
|
|
+ # self.queue_player.put("\r")
|
|
|
|
|
|
elif self.state == 8:
|
|
|
# What are we trading
|
|
@@ -698,7 +721,7 @@ class ScriptPort(object):
|
|
|
if re.match(r"How many holds of .+ do you want to buy \[\d+\]\?", prompt):
|
|
|
parts = prompt.split()
|
|
|
trade_type = parts[4]
|
|
|
-
|
|
|
+ log.info("Buy {0} [{1} ~ {2}]".format(trade_type, self.tpc, self.opc))
|
|
|
if trade_type == 'Fuel':
|
|
|
if (self.tpc in (5,7)) and (self.opc in (2,3,4,8)):
|
|
|
# Can buy equipment - fuel ore is worthless.
|
|
@@ -1006,7 +1029,7 @@ class ScriptExplore(object):
|
|
|
self.clear = [] # Warps that we know are clear.
|
|
|
self.highsector = 0 # Selected Sector to move to next!
|
|
|
self.highwarp = 0 # Selected Sector's Warp Count!
|
|
|
- self.stacksector = set() # Set of sectors that we have not picked but are unexplored... even though we did a holo!
|
|
|
+ self.stacksector = [] # Set of sectors that we have not picked but are unexplored... even though we did a holo!
|
|
|
self.oneMoveSector = False
|
|
|
self.times = 0
|
|
|
self.maxtimes = 0
|
|
@@ -1289,7 +1312,7 @@ class ScriptExplore(object):
|
|
|
for c in self.clear:
|
|
|
sector = c['sector']
|
|
|
if sector != self.highsector:
|
|
|
- self.stacksector.add(sector)
|
|
|
+ self.stacksector.append(sector)
|
|
|
|
|
|
# Or simply not add it in the first place ...
|
|
|
# Remove the sector we are just about to go to, we use discard so if the sector does not exist we don't throw a error!
|
|
@@ -1309,6 +1332,10 @@ class ScriptExplore(object):
|
|
|
# Ok we know the sector we want to go to now let's move it!
|
|
|
self.send2game("m{0}\r".format(self.highsector))
|
|
|
|
|
|
+ if self.highsector in self.stacksector:
|
|
|
+ log.info("Removing {0} from stacksector list.".format(self.highsector))
|
|
|
+ self.stacksector.remove(self.highsector)
|
|
|
+
|
|
|
# Reset Variables for fresh data
|
|
|
self.resetStuff()
|
|
|
self.state = 1
|
|
@@ -1357,7 +1384,7 @@ class ScriptExplore(object):
|
|
|
log.info("STOPHERE")
|
|
|
# Ok, let's stop here!
|
|
|
# Re-save the sector we were trying to get to. (we didn't make it there)
|
|
|
- self.stacksector.add(self.highsector)
|
|
|
+ self.stacksector.append(self.highsector)
|
|
|
self.state = 20
|
|
|
else:
|
|
|
if self.go_on:
|
|
@@ -1366,7 +1393,7 @@ class ScriptExplore(object):
|
|
|
self.state = 15
|
|
|
else:
|
|
|
log.warn("Our way is blocked...")
|
|
|
- self.stacksector.add(self.highsector)
|
|
|
+ self.stacksector.append(self.highsector)
|
|
|
self.state = 20
|
|
|
|
|
|
else:
|