forked from elanthia-online/dr-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sew.lic
328 lines (301 loc) · 10.7 KB
/
sew.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
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
=begin
Documentation: https://elanthipedia.play.net/Lich_script_repository#sew
=end
custom_require.call(%w(common common-crafting common-items common-money common-travel))
class Sew
include DRC
include DRCC
include DRCI
include DRCM
include DRCT
def initialize
settings = get_settings
@bag = settings.crafting_container
@bag_items = settings.crafting_items_in_container
@belt = settings.outfitting_belt
@hometown = settings.hometown
arg_definitions = [
[
{ name: 'finish', options: %w(log stow trash), description: 'What to do with the finished item.' },
{ name: 'type', options: %w(knitting sewing leather), description: 'What tailoring type is this item.' },
{ 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: 'noun', regex: /\w+/i, variable: true },
{ name: 'material', regex: /\w+/i, variable: true, optional: true, description: 'Type of material for leather recipes.' }
],
[
{ name: 'seal', regex: /seal/i }
],
[
{ name: 'reinforce', regex: /reinforce/i }
]
]
args = parse_args(arg_definitions)
@finish = args.finish
@chapter = args.chapter
@recipe_name = args.recipe_name
@noun = args.noun
@mat_type = args.material
@stamp = settings.mark_crafted_goods
Flags.add('sew-assembly', 'another finished \S+ shield (handle)', 'another finished wooden (hilt|haft)', 'another finished (long|short|small|large) leather (cord|backing)', 'another finished (small|large) cloth (padding)', 'another finished (long|short) wooden (pole)')
Flags.add('sew-pins', 'The pins is all used up, so you toss it away.')
if args.type == 'knitting'
knit
elsif args.type == 'sewing'
sew
elsif args.type == 'leather'
leather
elsif args.seal
seal
elsif args.reinforce
reinforce
else
echo('Sew does not yet support that form of tailoring.')
end
end
def get_item(name)
get_crafting_item(name, @bag, @bag_items, @belt)
end
def stow_item(name)
@bag = "other #{@bag}" unless 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 check_thread
return if exists?('cotton thread')
ensure_copper_on_hand(1000, @hometown)
order_item(16_667, 6)
stow_item('cotton thread')
end
def check_pins
return unless Flags['sew-pins']
ensure_copper_on_hand(125, @hometown)
item = left_hand
stow_item(item)
order_item(16_668, 5)
stow_item('pin')
get_item(item)
Flags.reset('sew-pins')
end
def leather
check_thread
get_item('tailoring book')
turn_to("page #{find_recipe(@chapter, @recipe_name)}")
bput('study my book', 'Roundtime')
stow_item('book')
get_item("#{@mat_type} leather")
do_sew('cut my leather with my scissors', 'scissors')
end
def sew
check_thread
get_item('tailoring book')
turn_to("page #{find_recipe(@chapter, @recipe_name)}")
bput('study my book', 'Roundtime')
stow_item('book')
get_item('cloth')
do_sew('cut my cloth with my scissors', 'scissors')
end
def knit
get_item('tailoring book')
turn_to("page #{find_recipe(@chapter, @recipe_name)}")
bput('study my book', 'Roundtime')
stow_item('book')
get_item('knitting needle')
fput('swap') unless right_hand =~ /needle/i
get_item('wool yarn')
do_knit('knit my yarn with my needles')
end
def seal
Flags.add('sealing-done', 'shows improved signs of durability and wear resistance from the successful sealing process')
get_item('tailoring book')
turn_to("page #{find_recipe(1, ': tailored armor sealing')}")
bput('study my book', 'Roundtime')
stow_item('book')
do_seal(true)
end
def reinforce
check_thread
get_item('tailoring book')
turn_to("page #{find_recipe(1, ': tailored armor reinforcing')}")
bput('study my book', 'Roundtime')
stow_item('book')
get_item('scissors')
@noun = GameObj.right_hand.noun
do_sew("cut my #{@noun} with my scissors", 'scissors')
end
def assemble_part
while Flags['sew-assembly']
part = Flags['sew-assembly'][1..-1].join('.')
Flags.reset('sew-assembly')
stow_item(left_hand)
get_item(part)
bput("assemble my #{@noun} with my #{part}", 'affix it securely in place', 'and tighten the pommel to secure it', 'carefully mark where it will attach when you continue crafting')
waitrt?
get_item('sewing needles')
end
end
def do_seal(wax)
waitrt?
return if Flags['sealing-done']
if wax
get_item('sealing wax')
bput("apply my wax to my #{right_hand}", 'roundtime')
waitrt?
stow_item('wax')
else
get_item('slickstone')
bput("rub my #{right_hand} with my slickstone", 'roundtime')
waitrt?
stow_item('slickstone')
end
do_seal !wax
end
def do_sew(command, tool)
waitrt?
stow_item(left_hand) if checkleft
if @last_command == 'cut my cloth with my scissors'
fput('stow my cloth')
pause
fput('stow my cloth') if checkleft
end
get_item(tool)
@last_command = command
check_pins
assemble_part
next_command = "push my #{@noun} with my needles"
case bput(command,
'dimensions appear to have shifted and could benefit from some remeasuring',
'With the measuring complete, now it is time to cut away more',
'and could use some pins to',
'deep crease develops along', 'wrinkles from all the handling and could use',
'The needles need to have thread put on them before they can be used for sewing',
'needs holes punched', 'requires some holes punched',
'You realize that cannot be repaired', 'not damaged enough to warrant repair',
'appears ready to be reinforced with some large cloth padding',
'Roundtime')
when 'dimensions appear to have shifted and could benefit from some remeasuring'
tool = 'yardstick'
next_command = "measure my #{@noun} with my yardstick"
when 'With the measuring complete, now it is time to cut away more'
tool = 'scissors'
next_command = "cut my #{@noun} with my scissors"
when 'and could use some pins to'
tool = 'pins'
next_command = "poke my #{@noun} with my pins"
when 'deep crease develops along', 'wrinkles from all the handling and could use'
tool = 'slickstone'
next_command = "rub my #{@noun} with my slickstone"
when 'The needles need to have thread put on them before they can be used for sewing'
item = right_hand
fput("drop #{item}")
get_item('cotton thread')
fput('put thread on my sewing needles')
fput("get #{item}")
when 'needs holes punched', 'requires some holes punched'
tool = 'awl'
next_command = "poke my #{@noun} with my awl"
when 'You realize that cannot be repaired', 'not damaged enough to warrant repair'
stow_item(left_hand)
finish
when 'appears ready to be reinforced with some large cloth padding'
stow_item(left_hand)
get_item('large padding')
bput("assemble my #{@noun} with my padding", 'carefully mark where it will attach when you continue crafting')
case bput("analy my #{@noun}", 'needle and thread', 'pinning', 'slickstone', 'remeasuring', 'scissor')
when 'needle and thread'
tool = 'sewing needles'
when 'pinning'
tool = 'pins'
next_command = "poke my #{@noun} with my pins"
when 'slickstone'
tool = 'slickstone'
next_command = "rub my #{@noun} with my slickstone"
when 'remeasuring'
tool = 'yardstick'
next_command = "measure my #{@noun} with my yardstick"
when 'scissor'
tool = 'scissors'
next_command = "cut my #{@noun} with my scissors"
end
when 'Roundtime'
tool = 'sewing needles'
end
do_sew(next_command, tool)
end
def do_knit(command)
waitrt?
next_command = 'knit my needles'
case bput(command,
'Now the needles must be turned', 'Some ribbing should be added',
'Next the needles must be pushed', 'ready to be pushed',
'The garment is nearly complete and now must be cast off',
'You are already knitting',
'Roundtime',
'That tool does not seem suitable for that task.',
'You need a larger amount of material')
when 'Now the needles must be turned', 'Some ribbing should be added'
next_command = 'turn my needles'
when 'Next the needles must be pushed', 'ready to be pushed'
next_command = 'push my needles'
when 'The garment is nearly complete and now must be cast off'
cast_and_finish
when 'You are already knitting'
bput('pull my needles', 'Do you really want to discard')
bput('pull my needles', 'You untie and discard')
do_knit(command)
next_command = ''
when 'That tool does not seem suitable for that task.'
case bput('analyze my needles', 'is in need of more knitting.', 'The needles need to be turned', 'Some purl stitching is', 'needles must be cast')
when 'is in need of more knitting.'
next_command = 'knit my needles'
when 'The needles need to be turned'
next_command = 'turn my needles'
when 'Some purl stitching is'
next_command = 'push my needles'
when 'needles must be cast'
cast_and_finish
end
when 'You need a larger amount of material'
echo '***STATUS*** CANNOT CRAFT, NEED MORE MATERIAL'
exit
end
waitrt?
stow_item('yarn') if left_hand =~ /yarn/i
do_knit(next_command)
end
def cast_and_finish
bput('cast my needles', 'roundtime')
pause 1
waitrt?
stow_item('knitting needle')
finish
end
def finish
if @stamp
get_item('stamp')
fput("mark my #{@noun} with my stamp")
pause
waitrt?
stow_item('stamp')
end
case @finish
when /log/
logbook_item
when /stow/
stow_item(@noun)
when /trash/
dispose_trash(@noun)
end
exit
end
def logbook_item
get_item('outfitting logbook')
case bput("bundle my #{@noun} with my logbook", 'You notate the', 'This work order has expired', 'The work order requires items of a higher quality')
when 'This work order has expired', 'The work order requires items of a higher quality'
dispose_trash(@noun)
end
stow_item('outfitting logbook')
end
end
Sew.new