Skip to content

Commit

Permalink
feat: Add league specifier to conversion logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Maximilian Stock committed Jan 20, 2020
1 parent 71647f9 commit 208e0bd
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,22 @@
]


def log_conversions(conversions, currency, limit):
def log_conversions(conversions, league, currency, limit):
for c in conversions[currency][:limit]:
log_conversion(c)
log_conversion(c, league)


def log_conversion(c):
def log_conversion(c, league):
print("{} {} -> {} {}: {} {}".format(c["starting"], c["from"], c["ending"],
c["to"], c["winnings"], c["to"]))
for t in c["transactions"]:
print("\t@{} Hi, I'd like to buy your {} {} for {} {}. ({})".format(
print("\t@{} Hi, I'd like to buy your {} {} for {} {} in {}. ({}x)".format(
t["contact_ign"],
t["received"],
t["to"],
t["paid"],
t["from"],
league,
t["conversion_rate"],
))
print("\n")
Expand All @@ -36,7 +37,8 @@ def log_conversion(c):
"--league",
default=league_names[0],
type=str,
help="League specifier, ie. 'Synthesis', 'Hardcore Synthesis' or 'Flashback Event (BRE001)'. Defaults to '{}'.".format(league_names[0]),
help="League specifier, ie. 'Synthesis', 'Hardcore Synthesis' or 'Flashback Event (BRE001)'. Defaults to '{}'.".format(
league_names[0]),
)
parser.add_argument(
"--currency",
Expand Down Expand Up @@ -89,9 +91,9 @@ def log_conversion(c):
try:
if currency == "all":
for c in p.graph.keys():
log_conversions(p.results, c, limit)
log_conversions(p.results, league, c, limit)
else:
log_conversions(p.results, currency, limit)
log_conversions(p.results, league, currency, limit)

except KeyError:
print("Could not find any profitable conversions for {} in {}".format(
Expand Down

0 comments on commit 208e0bd

Please sign in to comment.