Update analyzer.py, commander.py and six other files
This commit is contained in:
@@ -9,4 +9,4 @@ from nullptr.models.ship import Ship
|
||||
from nullptr.models.contract import Contract
|
||||
from nullptr.models.survey import Survey
|
||||
|
||||
__all__ = [ 'Waypoint', 'Sector', 'Ship', 'Survey', 'Agent', 'Marketplace', 'Jumpgate', 'Contract', 'Base' ]
|
||||
__all__ = [ 'Waypoint', 'Sector', 'Ship', 'Survey', 'System', 'Agent', 'Marketplace', 'Jumpgate', 'Contract', 'Base' ]
|
||||
|
||||
@@ -23,7 +23,7 @@ class Base:
|
||||
|
||||
def __init__(self, symbol, store):
|
||||
self.disable_dirty = True
|
||||
self.file_offset = 0
|
||||
self.file_offset = None
|
||||
self.store = store
|
||||
self.symbol = symbol
|
||||
self.define()
|
||||
|
||||
@@ -3,6 +3,7 @@ from .base import Base
|
||||
from time import time
|
||||
from nullptr.util import *
|
||||
from dataclasses import field
|
||||
from nullptr.models import Waypoint
|
||||
|
||||
class Marketplace(Base):
|
||||
def define(self):
|
||||
@@ -11,6 +12,11 @@ class Marketplace(Base):
|
||||
self.exchange:list = []
|
||||
self.prices:dict = {}
|
||||
self.last_prices:int = 0
|
||||
self.set_waypoint()
|
||||
|
||||
def set_waypoint(self):
|
||||
waypoint = self.store.get(Waypoint, self.symbol, create=True)
|
||||
self.waypoint = waypoint
|
||||
|
||||
def update(self, d):
|
||||
self.setlst('imports', d, 'imports', 'symbol')
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from .base import Base
|
||||
from time import time
|
||||
from nullptr.util import *
|
||||
from dataclasses import dataclass, field
|
||||
from nullptr.models import Waypoint
|
||||
|
||||
class Ship(Base):
|
||||
def define(self):
|
||||
@@ -10,7 +10,7 @@ class Ship(Base):
|
||||
self.status:str = ''
|
||||
self.cargo_capacity:int = 0
|
||||
self.cargo_units:int = 0
|
||||
self.location_str = ''
|
||||
self.location = None
|
||||
self.cooldown:int = 0
|
||||
self.arrival:int = 0
|
||||
self.fuel_current:int = 0
|
||||
@@ -21,9 +21,6 @@ class Ship(Base):
|
||||
@classmethod
|
||||
def ext(self):
|
||||
return 'shp'
|
||||
|
||||
def location(self):
|
||||
return self.store.get('Waypoint', self.location_str)
|
||||
|
||||
def path(self):
|
||||
agent = self.symbol.split('-')[0]
|
||||
@@ -31,7 +28,8 @@ class Ship(Base):
|
||||
|
||||
def update(self, d):
|
||||
self.seta('status', d, 'nav.status')
|
||||
self.seta('location_str', d, 'nav.waypointSymbol')
|
||||
getter = self.store.getter(Waypoint, create=True)
|
||||
self.seta('location', d, 'nav.waypointSymbol', interp=getter)
|
||||
self.seta('cargo_capacity', d, 'cargo.capacity')
|
||||
self.seta('cargo_units', d, 'cargo.units')
|
||||
self.seta('fuel_capacity', d, 'fuel.capacity')
|
||||
@@ -95,7 +93,7 @@ class Ship(Base):
|
||||
if detail > 1:
|
||||
r += ' ' + self.status
|
||||
r += f' [{self.fuel_current}/{self.fuel_capacity}]'
|
||||
r += ' ' + str(self.location())
|
||||
r += ' ' + str(self.location)
|
||||
if self.is_travelling():
|
||||
r += f' [A: {arrival}]'
|
||||
if self.is_cooldown():
|
||||
|
||||
Reference in New Issue
Block a user