|
@@ -4,6 +4,7 @@ import logging
|
|
|
import pendulum
|
|
|
|
|
|
|
|
|
+from copy import deepcopy
|
|
|
from pprint import pprint
|
|
|
from colorama import Fore, Back, Style
|
|
|
import config
|
|
@@ -66,6 +67,7 @@ class GameData(object):
|
|
|
self.warps = {}
|
|
|
|
|
|
def reset_busts(self):
|
|
|
+
|
|
|
self.busts = {}
|
|
|
|
|
|
def special_ports(self):
|
|
@@ -240,6 +242,8 @@ class GameData(object):
|
|
|
for s, d in obj["busts"].items():
|
|
|
self.busts[int(s)] = d
|
|
|
yield
|
|
|
+
|
|
|
+ self.maint_busts()
|
|
|
log.info(
|
|
|
"Loaded {0} {1}/{2}/{3}/{4}".format(
|
|
|
filename,
|
|
@@ -279,6 +283,8 @@ class GameData(object):
|
|
|
if "busts" in obj:
|
|
|
for s, d in obj["busts"].items():
|
|
|
self.busts[int(s)] = d
|
|
|
+
|
|
|
+ self.maint_busts()
|
|
|
log.info(
|
|
|
"Loaded {0} {1}/{2}/{3}/{4}".format(
|
|
|
filename,
|
|
@@ -346,11 +352,19 @@ class GameData(object):
|
|
|
def maint_busts(self):
|
|
|
|
|
|
rightNow = pendulum.now()
|
|
|
- for s, d in self.busts:
|
|
|
+ dropped = 0
|
|
|
+ new = deepcopy(
|
|
|
+ self.busts
|
|
|
+ )
|
|
|
+ for s in self.busts:
|
|
|
+ d = self.busts[s]
|
|
|
d = pendulum.parse(d)
|
|
|
d = d.add(7)
|
|
|
- if d == rightNow:
|
|
|
- del self.busts[s]
|
|
|
+ if d <= rightNow:
|
|
|
+ del new[s]
|
|
|
+ dropped += 1
|
|
|
+ self.busts = new
|
|
|
+ log.debug("Dropped {0} sectors from busted list".format(dropped))
|
|
|
|
|
|
def port_buying(self, sector: int, cargo: str):
|
|
|
""" Given a sector, is this port buying this?
|