-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgoldbrew.lua
103 lines (84 loc) · 4.48 KB
/
goldbrew.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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
94
95
96
97
98
99
100
101
102
103
local bag_browser = require("bag_browser")
local simplex_generator = require("simplex_generator")
local available_recipes_finder = require("available_recipes_finder")
local alchemy_recipes = require("static_data.alchemy_recipes")
local auction_data_browser = require("auction_data_browser")
local helpers = require("helpers")
local simplex_solver = require("simplex_calculator.core")
-- dev_start
local cmd_argument = arg[1]
if cmd_argument == "-DEV" then
-- local mock_full_bag_data = require("mock_data.mock_bag_full_2")
-- local mock_full_auctions_data = require("mock_data.mock_auctions_full_2")
-- local raw_mock_bag_data = mock_full_bag_data["LoneWolf"]["Eluff"]
-- local auctions_from_full_mock_data = auction_data_browser.get_auctions_from_raw_data(mock_full_auctions_data,
-- "Eluff", "LoneWolf")
-- local herbs_in_bag = bag_browser.get_all_herbs_from_inventory(raw_mock_bag_data)
-- local available_recipes = available_recipes_finder.get_available_recipes_from_inventory(herbs_in_bag,
-- alchemy_recipes)
-- local recipe_ids = helpers.get_item_ids_from_recipes(available_recipes)
-- local herb_ids = helpers.get_herb_ids_from_bag_data(herbs_in_bag)
-- local all_item_ids = helpers.concat_tables(recipe_ids, herb_ids)
-- local prices_from_full_mock_auctions = auction_data_browser.get_prices_from_ids(all_item_ids,
-- auctions_from_full_mock_data)
-- -- create simplex matrix
-- local generated_matrix = simplex_generator.construct_simplex_matrix_from_data(herbs_in_bag, available_recipes,
-- prices_from_full_mock_auctions);
-- helpers.print_matrix(generated_matrix)
-- local copied_matrix_with_ids = generated_matrix;
-- generated_matrix = (simplex_generator.strip_tag_data_from_matrix(generated_matrix))
-- simplex_solver.solve_simplex_task(generated_matrix)
-- for id, count in pairs(herbs_in_bag) do
-- print("Item ID:", id, "Count:", count)
-- end
-- print("---")
-- helpers.print_matrix(generated_matrix)
-- local results = helpers.extract_results_from_solved_matrix(generated_matrix, copied_matrix_with_ids)
-- print("----------------------")
-- for _, result in ipairs(results) do
-- print("Item ID:", result[1])
-- local reagents = available_recipes_finder.get_reagents_from_recipe_id(result[1], available_recipes)
-- if reagents then
-- for _, reagent in ipairs(reagents) do
-- print(reagent.itemId)
-- end
-- end
-- print("Amount:", result[2])
-- print("----------------------")
-- end
-- helpers.print_matrix(copied_matrix_with_ids)
local mock_full_bag_data = require("mock_data.mock_bag_simple")
local mock_full_auctions_data = require("mock_data.mock_auctions_full_2")
local raw_mock_bag_data = mock_full_bag_data["LoneWolf"]["Eluff"]
local auctions_from_full_mock_data = auction_data_browser.get_auctions_from_raw_data(mock_full_auctions_data,
"Eluff", "LoneWolf")
local herbs_in_bag = bag_browser.get_all_herbs_from_inventory(raw_mock_bag_data)
local available_recipes = available_recipes_finder.get_available_recipes_from_inventory(herbs_in_bag,
alchemy_recipes)
local recipe_ids = helpers.get_item_ids_from_recipes(available_recipes)
local herb_ids = helpers.get_herb_ids_from_bag_data(herbs_in_bag)
local all_item_ids = helpers.concat_tables(recipe_ids, herb_ids)
local prices_from_full_mock_auctions = auction_data_browser.get_prices_from_ids(all_item_ids,
auctions_from_full_mock_data)
local generated_matrix = simplex_generator.construct_simplex_matrix_from_data(herbs_in_bag, available_recipes,
prices_from_full_mock_auctions);
local copied_matrix_with_ids = generated_matrix;
generated_matrix = (simplex_generator.strip_tag_data_from_matrix(generated_matrix))
simplex_solver.solve_simplex_task(generated_matrix)
local results = helpers.extract_results_from_solved_matrix(generated_matrix, copied_matrix_with_ids)
helpers.print_matrix(copied_matrix_with_ids)
print("===")
helpers.print_matrix(generated_matrix)
for _, result in ipairs(results) do
print("Item ID:", result[1])
local reagents = available_recipes_finder.get_reagents_from_recipe_id(result[1], available_recipes)
if reagents then
for _, reagent in ipairs(reagents) do
print(reagent.itemId)
end
end
print("Amount:", result[2])
end
end
-- dev_end
-- prod