|
@@ -420,7 +420,8 @@ class ScriptPort(object):
|
|
self.defer = None
|
|
self.defer = None
|
|
|
|
|
|
def player(self, chunk: bytes):
|
|
def player(self, chunk: bytes):
|
|
- pass
|
|
|
|
|
|
+ # If we receive anything -- ABORT!
|
|
|
|
+ self.deactivate()
|
|
|
|
|
|
def game_prompt(self, prompt: str):
|
|
def game_prompt(self, prompt: str):
|
|
log.msg("{0} : {1}".format(self.state, prompt))
|
|
log.msg("{0} : {1}".format(self.state, prompt))
|
|
@@ -618,13 +619,20 @@ class ScriptPort(object):
|
|
self.deactivate()
|
|
self.deactivate()
|
|
return
|
|
return
|
|
|
|
|
|
- # possible = [ x for x in self.warps if x in self.game.portdata ]
|
|
|
|
- possible = [ x for x in self.warps if x in self.game.portdata and not port_burnt(self.game.portdata[x]) ]
|
|
|
|
|
|
+ possible = [ x for x in self.warps if x in self.game.portdata ]
|
|
|
|
+ log.msg("Ppossible:", possible)
|
|
|
|
+ if len(possible) == 0:
|
|
|
|
+ self.state = 0
|
|
|
|
+ self.queue_game.put(self.r + self.nl + "I don't see any ports in [{0}].".format(self.warps) + self.nl)
|
|
|
|
+ self.deactivate()
|
|
|
|
+ return
|
|
|
|
+
|
|
|
|
+ possible = [ x for x in possible if not port_burnt(self.game.portdata[x]) ]
|
|
log.msg("Possible:", possible)
|
|
log.msg("Possible:", possible)
|
|
self.possible = possible
|
|
self.possible = possible
|
|
if len(possible) == 0:
|
|
if len(possible) == 0:
|
|
self.state = 0
|
|
self.state = 0
|
|
- self.queue_game.put(self.r + self.nl + "I don't see any (not burnt) ports in [{0}].".format(self.warps) + self.nl)
|
|
|
|
|
|
+ self.queue_game.put(self.r + self.nl + "I don't see any unburnt ports in [{0}].".format(self.warps) + self.nl)
|
|
self.deactivate()
|
|
self.deactivate()
|
|
return
|
|
return
|
|
elif len(possible) == 1:
|
|
elif len(possible) == 1:
|
|
@@ -701,6 +709,10 @@ class ScriptPort(object):
|
|
log.msg("start: {0} % {1} price {2}".format(start_price, self.sell_perc, price))
|
|
log.msg("start: {0} % {1} price {2}".format(start_price, self.sell_perc, price))
|
|
self.sell_perc += 1
|
|
self.sell_perc += 1
|
|
self.queue_player.put("{0}\r".format(price))
|
|
self.queue_player.put("{0}\r".format(price))
|
|
|
|
+ if "We're not interested." in line:
|
|
|
|
+ log.msg("Try, try again. :(")
|
|
|
|
+ self.state = 5
|
|
|
|
+ self.trade()
|
|
|
|
|
|
elif self.state == 10:
|
|
elif self.state == 10:
|
|
if "Sector : " in line:
|
|
if "Sector : " in line:
|