Update commander.py, jumpgate.py and two other files
This commit is contained in:
parent
b5850bcb5f
commit
e31dce9861
@ -105,7 +105,10 @@ class Commander(CommandLine):
|
|||||||
if w.type == 'JUMP_GATE':
|
if w.type == 'JUMP_GATE':
|
||||||
traits.append('JUMP')
|
traits.append('JUMP')
|
||||||
print(w.symbol.split('-')[2], ', '.join(traits))
|
print(w.symbol.split('-')[2], ', '.join(traits))
|
||||||
|
|
||||||
|
def do_wp(self, s=''):
|
||||||
|
self.do_waypoints(s)
|
||||||
|
|
||||||
def do_marketplace(self, waypoint_str):
|
def do_marketplace(self, waypoint_str):
|
||||||
waypoint = self.store.get(Waypoint, waypoint_str.upper())
|
waypoint = self.store.get(Waypoint, waypoint_str.upper())
|
||||||
r = self.api.marketplace(waypoint)
|
r = self.api.marketplace(waypoint)
|
||||||
@ -237,6 +240,9 @@ class Commander(CommandLine):
|
|||||||
|
|
||||||
def do_jump(self, system_str):
|
def do_jump(self, system_str):
|
||||||
if not self.has_ship(): return
|
if not self.has_ship(): return
|
||||||
|
if '-' not in system_str:
|
||||||
|
sector = self.ship.location_str.split('-')[0]
|
||||||
|
system_str = f'{sector}-{system_str}'
|
||||||
system = self.resolve('System', system_str)
|
system = self.resolve('System', system_str)
|
||||||
self.api.jump(self.ship, system)
|
self.api.jump(self.ship, system)
|
||||||
pprint(self.ship)
|
pprint(self.ship)
|
||||||
|
@ -22,5 +22,6 @@ class Jumpgate(SystemMember):
|
|||||||
def f(self, detail=1):
|
def f(self, detail=1):
|
||||||
r = self.symbol
|
r = self.symbol
|
||||||
if detail > 1:
|
if detail > 1:
|
||||||
|
r += '\n'
|
||||||
r += '\n'.join(self.systems)
|
r += '\n'.join(self.systems)
|
||||||
return r
|
return r
|
||||||
|
@ -31,6 +31,15 @@ class Marketplace(SystemMember):
|
|||||||
def ext(self):
|
def ext(self):
|
||||||
return 'mkt'
|
return 'mkt'
|
||||||
|
|
||||||
|
def rtype(self, r):
|
||||||
|
if r in self.imports:
|
||||||
|
return 'I'
|
||||||
|
if r in self.exports:
|
||||||
|
return 'E'
|
||||||
|
if r in self.exchange:
|
||||||
|
return 'X'
|
||||||
|
return '?'
|
||||||
|
|
||||||
def path(self):
|
def path(self):
|
||||||
sector, system, _ = self.symbol.split('-')
|
sector, system, _ = self.symbol.split('-')
|
||||||
return f'atlas/{sector}/{system[0:1]}/{system}/{self.symbol}.{self.ext()}'
|
return f'atlas/{sector}/{system[0:1]}/{system}/{self.symbol}.{self.ext()}'
|
||||||
@ -40,5 +49,6 @@ class Marketplace(SystemMember):
|
|||||||
if detail > 1:
|
if detail > 1:
|
||||||
r += '\n'
|
r += '\n'
|
||||||
for p in self.prices.values():
|
for p in self.prices.values():
|
||||||
r += f'{p["symbol"]:25s} {p["sell"]:5d} {p["buy"]:5d}\n'
|
t = self.rtype(p['symbol'])
|
||||||
|
r += f'{t} {p["symbol"]:25s} {p["sell"]:5d} {p["buy"]:5d}\n'
|
||||||
return r
|
return r
|
||||||
|
@ -22,3 +22,6 @@ class System(Base):
|
|||||||
|
|
||||||
def distance(self, other):
|
def distance(self, other):
|
||||||
return int(sqrt((self.x - other.x) ** 2 + (self.y - other.y) ** 2))
|
return int(sqrt((self.x - other.x) ** 2 + (self.y - other.y) ** 2))
|
||||||
|
|
||||||
|
def sector(self):
|
||||||
|
return self.symbol.split('-')[0]
|
||||||
|
Loading…
Reference in New Issue
Block a user