forked from elanthia-online/dr-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcarve.lic
More file actions
145 lines (127 loc) · 4.01 KB
/
carve.lic
File metadata and controls
145 lines (127 loc) · 4.01 KB
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
=begin
Documentation: https://elanthipedia.play.net/Lich_script_repository#carve
=end
custom_require.call(%w[common events common-crafting])
class Carve
include DRC
include DRCC
def initialize
settings = get_settings
@bag = settings.crafting_container
@bag_items = settings.crafting_items_in_container
@belt = settings.engineering_belt
@stamp = settings.mark_crafted_goods
arg_definitions = [
[
{ name: 'chapter', regex: /\d+/i, variable: true, description: 'Chapter containing the item.' },
{ name: 'recipe_name', display: 'recipe name', regex: /^[A-z\s\-]+$/i, variable: true, description: 'Name of the recipe, wrap in double quotes if this is multiple words.' },
{ name: 'material', regex: /\w+/i, variable: true, description: 'Type of stone/bone to use.' },
{ name: 'type', options: %w[stack rock stone pebble boulder deed], description: 'What material noun you are using.' },
{ name: 'noun', regex: /\w+/i, variable: true }
]
]
args = parse_args(arg_definitions)
@chapter = args.chapter
@recipe_name = args.recipe_name
@material = args.material
@type = args.type
@noun = args.noun
@main_tool = if @type == 'stack'
'saw'
else
'chisel'
end
Flags.add('carve-assembly', 'another finished wooden (hilt|haft)', 'another finished (long|short) wooden (pole)')
carve_item
end
def get_item(name)
get_crafting_item(name, @bag, @bag_items, @belt)
end
def stow_item(name)
stow_crafting_item(name, @bag, @belt)
end
def turn_to(section)
bput("turn my book to #{section}", 'You turn your', 'The book is already')
end
def carve_item
get_item('carving book')
turn_to("chapter #{@chapter}")
turn_to("page #{find_recipe(@chapter, @recipe_name)}")
bput('study my book', 'Roundtime')
stow_item('book')
get_item(@main_tool)
if @type != 'boulder'
get_item("#{@material} #{@type}")
@my = 'my'
if @type == 'deed'
/(\w+) onto/ =~ bput('tap deed', '\w+ onto a sled')
@type = checkleft || Regexp.last_match(1)
@my = '' unless checkleft
end
else
@my = ''
end
carve("cut #{@my} #{@type} with my #{@main_tool}")
end
def assemble_part
return unless Flags['carve-assembly']
tool = right_hand
stow_item(tool)
part = Flags['carve-assembly'][1..-1].join('.')
Flags.reset('carve-assembly')
get_item(part)
bput("assemble #{@my} #{@noun} with my #{part}", 'affix it securely in place', 'carefully mark where it will attach when you continue crafting', 'add several marks indicating optimal locations')
get_item(tool)
end
def carve(command)
waitrt?
assemble_part
case bput(command,
'rough, jagged',
'determine',
'developed an uneven texture along its surface',
'You cannot figure out how to do that.',
'you see some discolored areas',
'Roundtime')
when 'rough, jagged'
waitrt?
stow_item(right_hand)
get_item('rifflers')
command = "rub #{@my} #{@noun} with my rifflers"
when 'determine', 'developed an uneven texture along its surface'
waitrt?
stow_item(right_hand)
get_item('rasp')
command = "rub #{@my} #{@noun} with my rasp"
when 'you see some discolored areas'
waitrt?
stow_item(right_hand)
get_item('polish')
command = "apply my polish to #{@my} #{@noun}"
when 'You cannot figure out how to do that.'
finish
else
waitrt?
unless right_hand =~ /#{@main_tool}/i
stow_item(right_hand)
get_item(@main_tool)
end
command = "cut #{@my} #{@noun} with my #{@main_tool}"
end
waitrt?
carve(command)
end
def finish
stow_item(right_hand)
if @stamp
get_item('stamp')
fput("mark #{@my} #{@noun} with my stamp")
pause
waitrt?
stow_item('stamp')
end
waitrt?
exit
end
end
Carve.new