|
@@ -265,6 +265,8 @@ class CIMWarpReport(object):
|
|
|
return
|
|
|
if line == ": ENDINTERROG":
|
|
|
return
|
|
|
+ if line.startswith('Command [TL='):
|
|
|
+ return
|
|
|
|
|
|
|
|
|
if self.warpcycle:
|
|
@@ -462,8 +464,23 @@ class CIMPortReport(object):
|
|
|
self.game.to_player = self.to_player
|
|
|
self.observer.load(self.save)
|
|
|
|
|
|
+
|
|
|
+def port_burnt(port):
|
|
|
+ if port['equ']['pct'] <= 20 or port['fuel']['pct'] <= 20 or port['org']['pct'] <= 20:
|
|
|
+ return True
|
|
|
+ return False
|
|
|
+
|
|
|
class ScriptPort(object):
|
|
|
- """ Performs the Port script. """
|
|
|
+ """ Performs the Port script.
|
|
|
+
|
|
|
+ This is close to the original.
|
|
|
+ We don't ask for the port to trade with --
|
|
|
+ because that information is available to us after "D" (display).
|
|
|
+ We look at the adjacent sectors, and see if we know any ports.
|
|
|
+ If the ports are burnt (< 20%), we remove them from the list.
|
|
|
+ If there's just one, we use it. Otherwise we ask them to choose.
|
|
|
+
|
|
|
+ """
|
|
|
def __init__(self, game):
|
|
|
self.game = game
|
|
|
self.queue_game = game.queue_game
|
|
@@ -569,6 +586,11 @@ class ScriptPort(object):
|
|
|
self.game.portdata[self.this_sector]['port'],
|
|
|
self.sector2, self.game.portdata[self.sector2]['port']) + self.nl
|
|
|
)
|
|
|
+ if self.game.portdata[self.this_sector]['port'] == self.game.portdata[self.sector2]['port']:
|
|
|
+ self.queue_game.put("Hey dummy! Look out the window! These ports are the same class!" + nl)
|
|
|
+ self.deactivate()
|
|
|
+ return
|
|
|
+
|
|
|
pi = PlayerInput(self.game)
|
|
|
def got_need2(*_):
|
|
|
if pi.keep['count'].strip() == '':
|
|
@@ -716,11 +738,6 @@ class ScriptPort(object):
|
|
|
return
|
|
|
else:
|
|
|
|
|
|
- def port_burnt(port):
|
|
|
- if port['equ']['pct'] <= 20 or port['fuel']['pct'] <= 20 or port['org']['pct'] <= 20:
|
|
|
- return True
|
|
|
- return False
|
|
|
-
|
|
|
pd = self.game.portdata[self.this_sector]
|
|
|
if port_burnt(pd):
|
|
|
log.msg("Current sector {0} port is burnt (<= 20%).".format(self.this_sector))
|
|
@@ -729,7 +746,15 @@ class ScriptPort(object):
|
|
|
return
|
|
|
|
|
|
possible = [ x for x in self.warps if x in self.game.portdata ]
|
|
|
- log.msg("Ppossible:", possible)
|
|
|
+ log.msg("Possible:", possible)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if hasattr(self.game, 'warpdata'):
|
|
|
+
|
|
|
+ possible = [ x for x in possible if self.this_sector in self.game.warpdata[x]]
|
|
|
+
|
|
|
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)
|
|
@@ -866,6 +891,11 @@ class ProxyMenu(object):
|
|
|
else:
|
|
|
self.portdata = {}
|
|
|
|
|
|
+ if hasattr(self.game, 'warpdata'):
|
|
|
+ self.warpdata = self.game.warpdata
|
|
|
+ else:
|
|
|
+ self.warpdata = {}
|
|
|
+
|
|
|
|
|
|
self.prompt = game.buffer
|
|
|
self.save = self.observer.save()
|
|
@@ -898,7 +928,7 @@ class ProxyMenu(object):
|
|
|
|
|
|
menu_item("D", "Diagnostics")
|
|
|
menu_item("Q", "Quest")
|
|
|
- menu_item("T", "Display current Time")
|
|
|
+ menu_item("T", "Trading Report")
|
|
|
menu_item("P", "Port CIM Report")
|
|
|
menu_item("S", "Scripts")
|
|
|
menu_item("W", "Warp CIM Report")
|
|
@@ -931,11 +961,42 @@ class ProxyMenu(object):
|
|
|
|
|
|
if key == "T":
|
|
|
self.queue_game.put(self.c + key + self.r + self.nl)
|
|
|
-
|
|
|
- now = pendulum.now()
|
|
|
- self.queue_game.put(
|
|
|
- self.nl + self.c1 + "Current time " + now.to_datetime_string() + self.nl
|
|
|
- )
|
|
|
+
|
|
|
+ ok_trades = []
|
|
|
+ best_trades = []
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ for sector, pd in self.game.portdata.items():
|
|
|
+ if not port_burnt(pd):
|
|
|
+ pc = pd['class']
|
|
|
+
|
|
|
+
|
|
|
+ warps = self.game.warpdata[sector]
|
|
|
+ for w in warps:
|
|
|
+
|
|
|
+
|
|
|
+ if w in self.game.warpdata and sector in self.game.warpdata[w]:
|
|
|
+
|
|
|
+ if w > sector and w in self.game.portdata and not port_burnt(self.game.portdata[w]):
|
|
|
+
|
|
|
+ wc = self.game.portdata[w]['class']
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if pc in (1,5) and wc in (2,4):
|
|
|
+ best_trades.append( "{0} -=- {1}".format(sector, w))
|
|
|
+ elif pc in (2,4) and wc in (1,5):
|
|
|
+ best_trades.append( "{0} -=- {1}".format(sector, w))
|
|
|
+ self.queue_game.put("BEST TRADES:" + self.nl + self.nl.join(best_trades) + self.nl)
|
|
|
+
|
|
|
elif key == "P":
|
|
|
self.queue_game.put(self.c + key + self.r + self.nl)
|
|
|
|