Update api.py, command_line.py and six other files

This commit is contained in:
Richard Bronkhorst
2023-06-16 14:41:11 +02:00
parent 2c96cbb533
commit 3f93d863a0
8 changed files with 65 additions and 17 deletions

View File

@@ -2,12 +2,11 @@
from time import time
from nullptr.util import *
from .base import Base
from typing import List
class Contract(Base):
identifier = 'id'
type: str
deliveries: List
deliveries: list
accepted: bool
fulfilled: bool
expires: int

View File

@@ -1,10 +1,10 @@
from .system_member import SystemMember
from typing import List
from dataclasses import field
class Jumpgate(SystemMember):
range: int
faction: str
systems:List[str] = []
systems: list = field(default_factory=list)
def update(self, d):
self.setlst('systems', d, 'connectedSystems', 'symbol')

View File

@@ -1,17 +1,24 @@
from .system_member import SystemMember
from typing import List
from time import time
from nullptr.util import *
from dataclasses import field
class Marketplace(SystemMember):
imports:List[str] = []
exports:List[str] = []
exchange:List[str] = []
imports:list = field(default_factory=list)
exports:list = field(default_factory=list)
exchange:list = field(default_factory=list)
prices:dict = field(default_factory=dict)
last_prices:int = 0
def update(self, d):
self.setlst('imports', d, 'imports', 'symbol')
self.setlst('exports', d, 'exports', 'symbol')
self.setlst('exchange', d, 'exchange', 'symbol')
if 'tradeGoods' in d:
self.last_prices = time()
for g in mg(d, 'tradeGoods'):
pass
@classmethod
def ext(self):
return 'mkt'

View File

@@ -1,11 +1,11 @@
from .base import Base
from time import time
from nullptr.util import *
from dataclasses import dataclass
from dataclasses import dataclass, field
class Ship(Base):
cargo:dict = {}
mission_state:dict = {}
mission_state:dict = field(default_factory=dict)
status:str = ''
cargo_capacity:int = 0
cargo_units:int = 0

View File

@@ -1,12 +1,12 @@
from .system_member import SystemMember
from nullptr.util import *
from typing import List
from dataclasses import field
class Waypoint(SystemMember):
x:int = 0
y:int = 0
type:str = 'unknown'
traits:List[str]=[]
traits:list = field(default_factory=list)
faction:str = ''
def update(self, d):