Skip to content

Commit

Permalink
Updated EDAPI plugin to version 4.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
bgol committed May 23, 2017
1 parent 4841a03 commit 73774a5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ TradeDangerous, Copyright (C) Oliver "kfsone" Smith, July 2014
May ## 2017 (bgol, horizon branch):
. Don't change the planetary state if updating via the station command
without specifying it.
. Updated EDAPI plugin to version 4.1.1

May 22 2017 (bgol, horizon branch):
. Updated buy, rares, run and trade command to also output the
Expand Down
27 changes: 16 additions & 11 deletions plugins/edapi_plug.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from collections import namedtuple


__version_info__ = ('4', '1', '0')
__version_info__ = ('4', '1', '1')
__version__ = '.'.join(__version_info__)

# ----------------------------------------------------------------
Expand Down Expand Up @@ -480,20 +480,25 @@ def warnAPIResponse(checkName, checkYN):
else:
print('Station known.')
defStation = stnDefault(
lsFromStar = station.lsFromStar, market = station.market,
blackMarket = station.blackMarket,shipyard = station.shipyard,
maxPadSize = station.maxPadSize, outfitting = station.outfitting,
rearm = station.rearm, refuel = station.refuel,
repair = station.repair, planetary = station.planetary,
lsFromStar = station.lsFromStar,
market = defMarket if station.market == "?" else station.market,
blackMarket = station.blackMarket,
shipyard = defShipyard if station.shipyard == "?" else station.shipyard,
maxPadSize = station.maxPadSize,
outfitting = defOutfitting if station.outfitting == "?" else station.outfitting,
rearm = station.rearm,
refuel = station.refuel,
repair = station.repair,
planetary = station.planetary,
)

warning = False
if defStation.outfitting != defOutfitting:
warning = warnAPIResponse('outfitting', defStation.outfitting)
warning |= warnAPIResponse('outfitting', defStation.outfitting)
if defStation.shipyard != defShipyard:
warning = warnAPIResponse('shipyard', defStation.shipyard)
warning |= warnAPIResponse('shipyard', defStation.shipyard)
if defStation.market != defMarket:
warning = warnAPIResponse('market', defStation.market)
warning |= warnAPIResponse('market', defStation.market)
if warning:
tdenv.WARN("Please update station data with correct values.")
tdenv.WARN("(Fields will be marked with an leading asterisk '*')")
Expand Down Expand Up @@ -522,8 +527,8 @@ def warnAPIResponse(checkName, checkYN):
('Planetary.....(y,n) ', 'planetary', defStation.planetary),
('B/Market......(y,n) ', 'blackMarket', defStation.blackMarket),
('Refuel........(y,n) ', 'refuel', defStation.refuel),
('Restock.......(y,n) ', 'rearm', defStation.rearm),
('Repair........(y,n) ', 'repair', defStation.repair),
('Restock.......(y,n) ', 'rearm', defStation.rearm),
('Outfitting....(y,n) ', 'outfitting', defOutfitting),
('Shipyard......(y,n) ', 'shipyard', defShipyard),
('Market........(y,n) ', 'market', defMarket),
Expand Down Expand Up @@ -553,8 +558,8 @@ def _detail(value, source):
print(" Planetary.:", _detail(station.planetary, tdb.planetStates))
print(" B/Market..:", _detail(station.blackMarket, tdb.marketStates))
print(" Refuel....:", _detail(station.refuel, tdb.marketStates))
print(" Restock...:", _detail(station.rearm, tdb.marketStates))
print(" Repair....:", _detail(station.repair, tdb.marketStates))
print(" Restock...:", _detail(station.rearm, tdb.marketStates))
print(" Outfitting:", _detail(station.outfitting, tdb.marketStates))
print(" Shipyard..:", _detail(station.shipyard, tdb.marketStates))
print(" Market....:", _detail(station.market, tdb.marketStates))
Expand Down

0 comments on commit 73774a5

Please sign in to comment.