Skip to content

Commit

Permalink
Add search by category in 'buy' command
Browse files Browse the repository at this point in the history
  • Loading branch information
FredDeschenes committed Jun 27, 2015
1 parent f12bcd7 commit ff9b33c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,7 @@ Finds stations that are selling / where you can buy, a named list of items or sh
[--near N] [--ly-per N] [--avoid PLACES]
[--pad-size PSML?] [--black-market | --bm]
[--one-stop | -1]
item [item item,item …]
category|item [category|item category|item,category|item,category|item …]
ship [ship ship,ship …]

###Options:
Expand Down Expand Up @@ -1101,7 +1101,7 @@ Finds stations that are selling / where you can buy, a named list of items or sh

###Example:

trade.py buy --near achenar food
trade.py buy --near achenar metals
trade.py buy asp
trade.py buy --near achenar food,clothing,scrap --one-stop
trade.py buy --near achenar type6,type7 -1
Expand Down
9 changes: 9 additions & 0 deletions commands/buy_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,15 @@ def get_lookup_list(cmdenv, tdb):
for name in names:
if mode is not SHIP_MODE:
try:
try:
category = tdb.lookupCategory(name)
for item in category.items:
names.append(item.name())
mode = ITEM_MODE
continue
except LookupError:
pass

item = tdb.lookupItem(name)
cmdenv.DEBUG0("Looking up item {} (#{})", item.name(), item.ID)
queries[item.ID] = item
Expand Down

0 comments on commit ff9b33c

Please sign in to comment.