Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Conflicts:
	CHANGES.txt
	commands/run_cmd.py
	data/Station.csv
  • Loading branch information
Jared Buntain committed Jan 11, 2015
2 parents b37d3d5 + 20c0505 commit 5bba75f
Show file tree
Hide file tree
Showing 8 changed files with 526 additions and 33 deletions.
16 changes: 16 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@
TradeDangerous, Copyright (C) Oliver "kfsone" Smith, July 2014
==============================================================================

<<<<<<< HEAD
=======
v6.6.1 Jan 10 2015
. (kfsone) Added "--blackmarket" option to "run" command, restrictions
to stations which have a black market.
. (kfsone) Added "--end-jumps" ('-e') to "run" command, includes stations
from systems within this many jumps of the specified --to.
e.g.
trade.py run --from sol --to lave -e 3
will find runs from sol to somewhere within 3 jumps of lave.
. (kfsone) "rares" now has a friendly error when no rares are found
+ Data: kfsone, maddavo, Dave Ryalls, EDStarQuery/kfsone
[I'm adding several hundred new systems from EDStarQuery but I'm also
manually vetting all of them!]

>>>>>>> 20c0505f0af40cc8ff50f1eb6a22573f486f2c0d
v6.6.0 Jan 08 2015
. (kfsone) Overhaul of loading of trades and adjancent-system finding
- Item data is loaded as discrete sales and purchases in TradeCalc,
Expand Down
3 changes: 3 additions & 0 deletions commands/rares_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ def render(results, cmdenv, tdb):
the output of the command.
"""

if not results.rows:
raise CommandLineError("No items found.")

# Calculate the longest station name in our list.
longestStnName = max(results.rows, key=lambda result: len(result.rare.station.name())).rare.station
longestStnNameLen = len(longestStnName.name())
Expand Down
72 changes: 68 additions & 4 deletions commands/run_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,66 @@ def extendOriginsForStartJumps(tdb, cmdenv):
[sys.name() for sys in origins]
)

<<<<<<< HEAD
return origins
=======
if hops != 2:
return
if isinstance(place, Station) and place in viaSet:
raise CommandLineError(
"{} used in {} and --via with only 2 hops".format(
place.name(),
anchorName,
))


def checkStationSuitability(cmdenv, station, src):
if not station.itemCount:
raise NoDataError(
"No price data in local database "
"for {} station: {}".format(
src, station.name(),
))
mps = cmdenv.maxPadSize
if mps and not station.checkPadSize(mps):
raise CommandLineError(
"{} station {} does not meet pad-size "
"requirement.".format(
src, station.name(),
))
if src != "--from":
bm = cmdenv.blackMarket
if bm and station.blackMarket != 'Y':
raise CommandLineError(
"{} station {} does not meet black-market "
"requirement.".format(
src, station.name(),
))


def filterStationSet(src, cmdenv, stnSet):
if not stnSet:
return stnSet
bm, mps = cmdenv.blackMarket, cmdenv.maxPadSize
for place in stnSet:
if not isinstance(place, Station):
continue
if place.itemCount == 0:
stnSet.remove(place)
continue
if mps and not place.checkPadSize(mps):
stnSet.remove(place)
continue
if bm and place.blackMarket != 'Y':
stnSet.remove(place)
continue
if not stnSet:
raise CommandLineError(
"No {} station met your criteria.".format(
src
))
return stnSet
>>>>>>> 20c0505f0af40cc8ff50f1eb6a22573f486f2c0d


def validateRunArguments(tdb, cmdenv):
Expand Down Expand Up @@ -321,6 +380,7 @@ def validateRunArguments(tdb, cmdenv):
.format(cmdenv.origPlace.name())
)
else:
checkStationSuitability(cmdenv, cmdenv.origPlace, '--from')
cmdenv.origins = [ cmdenv.origPlace ]
cmdenv.startStation = cmdenv.origPlace
cmdenv.origins = extendOriginsForStartJumps(tdb, cmdenv)
Expand Down Expand Up @@ -551,21 +611,25 @@ def run(results, cmdenv, tdb):

restrictTo = None
if hopNo == lastHop and stopStations:
restrictTo = stopStations
restrictTo = set(stopStations)
elif len(viaSet) > cmdenv.adhocHops:
restrictTo = viaSet

newRoutes = calc.getBestHops(routes, restrictTo=restrictTo)
if not newRoutes and hopNo > 0:
if restrictTo:
restrictions = list(restrictTo)
restrictSystems = list(set([
place if isinstance(place, System) else place.system
for place in restrictTo
]))
if len(restrictions) == 1:
dests = restrictions[0].name()
elif len(set(stn.system for stn in restrictions)) == 1:
dests = restrictions[0].system.name()
elif len(restrictSystems) == 1:
dests = restrictSystems[0].name()
else:
dests = ", ".join([
stn.name() for stn in restrictions[0:-1]
place.name() for place in restrictions[0:-1]
])
dests += " or " + restrictions[-1].name()
results.summary.exception += (
Expand Down
1 change: 1 addition & 0 deletions corrections.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"HR 5451/MACOONALD HUB": "MacDonald Hub",
"HR 5451/MACOONALO HUB": "MacDonald Hub",
"JAWOLA/SUTCLIFFEPLATFORM": "Sutcliffe Platform",
"KANOS/LEE STATION": DELETED,
"LEESTI/GEORGELUCAS": "George Lucas",
"LHS 220/CULPEPERCOLONY": "Culpeper Colony",
"LHS 250/KOVALESKY ENTERPRISE": "Kovalevsky Enterprise",
Expand Down
29 changes: 29 additions & 0 deletions data/ShipVendor.csv
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,14 @@ unq:[email protected]_id,unq:[email protected]_id,unq:[email protected]_id
'GONG GU','Kelly Dock','Python'
'GONG GU','Kelly Dock','Sidewinder'
'GONG GU','Kelly Dock','Viper'
'HIP 43670','Shaara Gateway','Adder'
'HIP 43670','Shaara Gateway','Cobra'
'HIP 43670','Shaara Gateway','Hauler'
'HIP 43670','Shaara Gateway','Lakon Type 6'
'HIP 43670','Shaara Gateway','Lakon Type 9'
'HIP 43670','Shaara Gateway','Python'
'HIP 43670','Shaara Gateway','Sidewinder'
'HIP 43670','Shaara Gateway','Viper'
'HIP 87369','Carey Port','Adder'
'HIP 87369','Carey Port','Asp Explorer'
'HIP 87369','Carey Port','Cobra'
Expand Down Expand Up @@ -218,6 +226,18 @@ unq:[email protected]_id,unq:[email protected]_id,unq:[email protected]_id
'KALIKI','Oren City','Python'
'KALIKI','Oren City','Sidewinder'
'KALIKI','Oren City','Viper'
'KANOS','Geston Ring','Adder'
'KANOS','Geston Ring','Asp Explorer'
'KANOS','Geston Ring','Cobra'
'KANOS','Geston Ring','Dropship'
'KANOS','Geston Ring','Eagle'
'KANOS','Geston Ring','Hauler'
'KANOS','Geston Ring','Lakon Type 6'
'KANOS','Geston Ring','Lakon Type 7'
'KANOS','Geston Ring','Lakon Type 9'
'KANOS','Geston Ring','Python'
'KANOS','Geston Ring','Sidewinder'
'KANOS','Geston Ring','Viper'
'LFT 1448','Dirac Enterprise','Anaconda'
'LFT 1448','Dirac Enterprise','Asp Explorer'
'LFT 1448','Dirac Enterprise','Cobra'
Expand Down Expand Up @@ -365,6 +385,15 @@ unq:[email protected]_id,unq:[email protected]_id,unq:[email protected]_id
'LTT 15574','Haxel Port','Lakon Type 9'
'LTT 15574','Haxel Port','Sidewinder'
'LTT 15574','Haxel Port','Viper'
'LTT 4131','Lorrah Terminal','Cobra'
'LTT 4131','Lorrah Terminal','Dropship'
'LTT 4131','Lorrah Terminal','Eagle'
'LTT 4131','Lorrah Terminal','Hauler'
'LTT 4131','Lorrah Terminal','Lakon Type 6'
'LTT 4131','Lorrah Terminal','Lakon Type 9'
'LTT 4131','Lorrah Terminal','Python'
'LTT 4131','Lorrah Terminal','Sidewinder'
'LTT 4131','Lorrah Terminal','Viper'
'NETO','Ising Vision','Adder'
'NETO','Ising Vision','Anaconda'
'NETO','Ising Vision','Asp Explorer'
Expand Down
Loading

0 comments on commit 5bba75f

Please sign in to comment.