forked from elanthia-online/dr-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakesteel.lic
94 lines (78 loc) · 2.37 KB
/
makesteel.lic
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
=begin
Documentation: https://elanthipedia.play.net/Lich_script_repository#makesteel
=end
custom_require.call(%w(common common-crafting common-items common-money drinfomon))
class MakeSteel
include DRC
include DRCC
include DRCI
include DRCM
def initialize
arg_definitions = [
[
{ name: 'count', regex: /\d/i, description: 'Number of iron ingots to smelt' },
{ name: 'type', options: %w(l m h), optional: true, description: 'Carbon content, defaults to high' },
{ name: 'refine', regex: /refine/i, optional: true, description: 'If provided, refine the resulting ingot' }
]
]
args = parse_args(arg_definitions)
total_count = args.count.to_i
type = args.type || 'h'
@hometown = get_settings.hometown
@stock_room = get_data('crafting')['blacksmithing'][@hometown]['stock-room']
ensure_copper_on_hand(2000 * total_count, @hometown)
combine = total_count > 6
remaining_count = total_count
while remaining_count > 0
step = [6, remaining_count].min
smelt_ingot(step, type)
remaining_count -= step
end
if combine
until 'What were' == bput('get my steel ingot', 'You get', 'What were')
fput('put ingot in cruc')
end
wait_for_script_to_complete('smelt')
fput('stow ingot')
end
refine if args.refine
end
def refine
order_item(get_data('crafting')['blacksmithing'][@hometown]['finisher-room'], 9) unless exists?('flux')
find_empty_crucible(@hometown)
until 'What were' == bput('get my steel ingot', 'You get', 'What were')
bput('put ingot in cruc', 'You put')
end
wait_for_script_to_complete('smelt', ['refine'])
fput('stow ingot')
end
def smelt_ingot(count, type)
count.times do
order_stow(7)
order_stow(2)
order_stow(2) if %w(m h).include?(type)
order_stow(2) if 'h' == type
end
find_empty_crucible(@hometown)
multiplier = case type
when 'l'
2
when 'm'
3
when 'h'
4
end
(count * multiplier).times do
put('get my nugget')
put('put my nugget in cruc')
pause 0.5
end
wait_for_script_to_complete('smelt')
fput('stow ingot')
end
def order_stow(num)
order_item(@stock_room, num)
fput('stow nugget')
end
end
MakeSteel.new