35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
# File 'lib/bdo_alchemy_profits.rb', line 35
def start_cli
options = {}
OptionParser.new do |opt|
opt.on('--silent', '-s') { options[:silent] = true }
end.parse!
cli = UserCLI.new options
category = cli.choose_category
cli.end_cli if category == 'exit'
region = cli.choose_region
cli.end_cli if region == 'exit'
lang = cli.choose_lang
cli.end_cli if lang == 'exit'
aggression = cli.choose_aggression
cli.end_cli if aggression == 'exit'
if aggression == 'hyperaggressive'
puts cli.orange("\nWARN: hyperagressive mode is RISKY AND SLOW. this will evaluate every substitution for every recipe. hammers apis violently. you will get rate limited. you will get IP blocked. her royal holiness imperva incapsula WILL get you. select if you know what all that stuff means and you are ok with waiting 20 minutes.")
end
cli.vipiko("\n♫ let's see if #{cli.yellow category} alchemy items are profitable in #{cli.yellow region}!")
market_searcher = MarketSearcher.new region, cli
market_item_list = market_searcher.get_alchemy_market_data category
cli.vipiko("I'll look for #{cli.yellow(market_item_list.length)} item#{
market_item_list.empty? || market_item_list.length > 1 ? 's' : ''
} in #{category == 'all' ? cli.yellow('all categories'): "the #{cli.yellow category} category"}!")
bdo_codex_searcher = BDOCodexSearcher.new(region, lang, cli, aggression == 'hyperaggressive')
item_codex_data = bdo_codex_searcher.get_item_codex_data market_item_list
recipe_prices = market_searcher.get_all_recipe_prices item_codex_data, category
mapped_prices = recipe_prices.sort_by { |recipe| recipe[:silver_per_hour].to_i }.map { |recipe| recipe[:information] }
if mapped_prices.length > 0
cli.vipiko_overwrite "done!"
puts "\n\n"
puts mapped_prices
else
cli.vipiko_overwrite "none of those recipes look profitable right now...let's go gathering!"
end
end
|