haulin goods

This commit is contained in:
Richard
2024-01-04 21:34:31 +01:00
parent b47fa44cb0
commit 1b7a528655
15 changed files with 181 additions and 42 deletions

View File

@@ -35,7 +35,12 @@ class Marketplace(Base):
price['volume'] = mg(g, 'tradeVolume')
prices[symbol] = price
self.prices = prices
def buy_price(self, resource):
if resource not in self.prices:
return None
return self.prices[resource]['buy']
def sellable_items(self, resources):
return [r for r in resources if r in self.prices]

View File

@@ -17,6 +17,7 @@ class Ship(Base):
self.fuel_capacity:int = 0
self.mission:str = None
self.mission_status:str = 'init'
self.role = None
@classmethod
def ext(self):
@@ -100,6 +101,8 @@ class Ship(Base):
cooldown = int(self.cooldown - time())
r = self.symbol
if detail > 1:
if self.role is not None:
r += f' {self.role}'
r += ' ' + self.status
r += f' [{self.fuel_current}/{self.fuel_capacity}]'
r += ' ' + str(self.location)

View File

@@ -2,6 +2,7 @@ from .base import Base, Reference
from nullptr.models.system import System
from nullptr.util import *
from time import time
from math import sqrt
class Waypoint(Base):
def define(self):
@@ -23,6 +24,9 @@ class Waypoint(Base):
self.seta('is_under_construction', d, 'isUnderConstruction')
self.setlst('traits', d, 'traits', 'symbol')
self.uncharted = 'UNCHARTED' in self.traits
def distance(self, other):
return int(sqrt((self.x - other.x) ** 2 + (self.y - other.y) ** 2))
@classmethod
def ext(self):