Skip to content

Commit

Permalink
Update conductorWK16.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Ctri-The-Third committed Nov 4, 2023
1 parent 36439e9 commit 3496797
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions conductorWK16.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ def assign_traderoutes_to_ships(self, ships: list[Ship]):
if not routes:
return
for i, ship in enumerate(ships):
tradegood, buy_wp, sell_wp, return_good = routes[i]
tradegood, buy_wp, sell_wp, profit_per_unit = routes[i]
set_behaviour(
self.connection,
ship.name,
Expand All @@ -339,7 +339,7 @@ def assign_traderoutes_to_ships(self, ships: list[Ship]):
"buy_wp": buy_wp,
"sell_wp": sell_wp,
"tradegood": tradegood,
"return_tradegood": "",
"safety_profit_threshold": profit_per_unit / 2,
},
)

Expand Down Expand Up @@ -432,16 +432,17 @@ def populate_ships(self):
self.refiners = [ship for ship in ships if ship.role == "REFINERY"]
self.surveyors = [ship for ship in ships if ship.role == "SURVEYOR"]

def get_trade_routes(self, limit=None) -> list[tuple]:
def get_trade_routes(self, limit=None, min_market_depth=1000) -> list[tuple]:
if not limit:
limit = len(self.haulers)
sql = """select route_value, system_symbol, trade_symbol, profit_per_unit, export_market, import_market, market_depth
from trade_routes_intrasystem tris
where min_market_depth > %s
limit %s"""
routes = try_execute_select(self.connection, sql, (limit,))
routes = try_execute_select(self.connection, sql, (limit, min_market_depth))
if not routes:
return []
return_obj = []

return [(r[2], r[4], r[5], r[3]) for r in routes]

def log_shallow_trade_tasks(self):
Expand Down

0 comments on commit 3496797

Please sign in to comment.