forked from elanthia-online/dr-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
new-character.lic
370 lines (296 loc) · 11.1 KB
/
new-character.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
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
=begin
Documentation: https://elanthipedia.play.net/Lich_script_repository#new-character
=end
custom_require.call(%w(common common-crafting common-items common-money common-travel equipmanager))
class NewCharacter
include DRC
include DRCC
include DRCI
include DRCM
include DRCT
def initialize
@settings = get_settings
@equipment_manager = EquipmentManager.new(@settings)
@equipment_manager.wear_equipment_set?('standard')
ensure_copper_on_hand(20_000, @settings.hometown)
bput('toggle shield arm', 'worn on your left arm')
check_default_store
check_skinning
check_gem_pouches
check_locksmithing
check_scholarship
check_cambrinth
check_engineering
check_outfitting
check_forging
check_alchemy
check_armor_and_weapons
check_ammunition
check_theurgy
check_zills
check_sorcery
check_manual_changes
end
def check_manual_changes
echo 'Here are some common settings you might want to consider changing:'
echo ' toggle expbrief'
echo ' toggle bundle'
echo ' spell stance 115 115 70'
echo ' spell recognize on'
echo 'Here are some common manual steps that you should consider:'
echo ' Join a guild' if DRStats.commoner?
echo ' Align to a different immortal' if DRStats.cleric?
echo ' Align to an elemental plane' if DRStats.warrior_mage?
echo ' Hide your spell preparation and/or make it non-default' if DRStats.necromancer?
echo ' Select an initial spell or ability from your guild leader'
echo ' Spend your initial 600 TDPs'
end
def check_sorcery
echo '***CHECKING SORCERY***'
return unless @settings.crossing_training.include?('Sorcery')
return unless DRSkill.getrank('Sorcery') < 50 && @settings.crossing_training_sorcery.nil?
return if exists?('runestone')
echo 'You need to find a runestone to train Sorcery'
end
def check_zills
echo '***CHECKING ZILLS***'
if exists?('zills')
description = 'chamois cloth'
unless exists?(description)
buy_item(19_078, 'cloth')
bput("stow my #{description}", 'You put')
end
else
echo 'You need to buy some zills (or ask in LNet)'
end
end
def store_in(type, container)
bput("store #{type} in my #{container}", 'You will now', 'To use the STORE verb', 'I could not find')
end
def check_default_store
store_in('default', 'pack')
store_in('default', 'back')
end
def check_theurgy
echo '***CHECKING THEURGY***'
return unless @settings.crossing_training.include?('Theurgy')
return unless DRStats.cleric?
description = @settings.water_holder
if exists?(description)
bput("get my #{description} from my #{@settings.theurgy_supply_container}", 'You get')
else
room = get_data('town')[@settings.hometown]['theurgy_supplies']['id']
buy_item(room, description)
end
if exists?(description)
shrine = get_data('shrines')['shrines'][@settings.hometown].find { |s| s['location'] == 'Damaris\' altar near Kaerna' }
if shrine
walk_to(shrine['start_room'])
shrine['path_in'].each { |dir| move(dir) }
loop do
break if 'There is no more room in' == bput("fill my #{description} with water from bowl", 'You fill', 'There is no more room in')
end
shrine['path_out'].each { |dir| move(dir) }
end
bput("put my #{description} in my #{@settings.theurgy_supply_container}", 'You put')
else
echo "Failed to buy: #{description}"
end
wait_for_script_to_complete('pilgrimage')
end
def check_armor_and_weapons
@equipment_manager.empty_hands
missing = @equipment_manager.items
echo '***CHECKING ARMOR***'
missing.reject! { |item| exists?(item.short_name) }
missing.each { |item| buy_armor(item) }
echo '***CHECKING WEAPONS***'
missing.reject! { |item| exists?(item.short_name) }
missing.each { |item| buy_weapon(item) }
missing
.reject { |item| exists?(item.short_name) }
.each { |item| echo "***Failed to purchase #{item.short_name}***" }
end
def check_ammunition
echo '***CHECKING AMMUNITION***'
trains_bow = @settings.weapon_training.keys.include?('Bow')
trains_crossbow = @settings.weapon_training.keys.include?('Crossbow')
trains_sling = @settings.weapon_training.keys.include?('Sling')
return unless trains_bow || trains_crossbow || trains_sling
description = 'quiver'
unless exists?(description)
buy_item(1543, description)
bput("wear my #{description}", 'You attach')
bput("open my #{description}", 'You open')
store_in('ammunition', description)
end
buy_ammunition(trains_bow, 'arrow')
buy_ammunition(trains_crossbow, 'bolt')
buy_ammunition(trains_sling, 'rock')
end
def buy_ammunition(train, description)
return unless train
return if exists?(description)
5.times do
buy_item(8263, description)
bput("stow my #{description}", 'You put')
end
end
def buy_weapon(item)
buy_item(8263, item.short_name)
if item.worn && !wear_item?(item)
bput('swap', 'You move')
buy_item(8264, 'weapon strap')
bput("tie my weapon strap to my #{item.short_name}", 'You carefully tie')
end
@equipment_manager.empty_hands
end
def buy_armor(item)
buy_item(7904, item.short_name)
@equipment_manager.empty_hands
end
def wear_item?(item)
"You can't" != bput("wear my #{item.short_name}", "You can't", 'You sling', 'You slide', 'You place', 'You strap')
end
def check_skinning
echo '***CHECKING SKINNING***'
return unless @settings.skinning
return unless @settings.skinning['skin']
description = 'skinning knife'
unless exists?(description)
buy_item(6206, description)
bput("wear my #{description}", 'You attach')
end
return if wearing?('bundle')
description = 'bundling rope'
return if exists?(description)
room = get_data('town')[@settings.hometown]['tannery']['id']
name = get_data('town')[@settings.hometown]['tannery']['name']
walk_to(room)
bput("ask #{name} for #{description}", 'hands you')
bput("stow my #{description}", 'You put')
end
def check_gem_pouches
echo '***CHECKING GEM POUCHES***'
room = get_data('town')[@settings.hometown]['gemshop']['id']
name = get_data('town')[@settings.hometown]['gemshop']['name']
description = "#{@settings.gem_pouch_adjective} pouch"
unless wearing?(description)
walk_to(room)
bput("ask #{name} for #{description}", 'hands you')
bput("wear my #{description}", 'You attach')
store_in('gems', description)
end
container = @settings.spare_gem_pouch_container
return if container.nil?
return if inside?(description, container)
walk_to(room)
bput("ask #{name} for #{description}", 'hands you')
bput("put my #{description} in my #{container}", 'You put')
end
def check_locksmithing
echo '***CHECKING LOCKSMITHING***'
return unless @settings.crossing_training.include?('Locksmithing')
store_in('boxes', @settings.picking_box_source) if @settings.picking_box_source
locksmithing_room = get_data('town')[@settings.hometown]['locksmithing']['id']
description = 'lockpick ring'
if @settings.use_lockpick_ring && !exists?(description)
buy_item(locksmithing_room, description)
bput("wear my #{description}", 'You attach')
end
description = 'lockpick'
if @settings.use_lockpick_ring
lockpick_count = count_lockpick_container(@settings.lockpick_container)
return unless lockpick_count
refill_lockpick_container(@settings.lockpick_type, @settings.hometown, @settings.lockpick_container, lockpick_count)
elsif !exists?(description)
buy_item(locksmithing_room, "#{@settings.lockpick_type} #{description}")
bput("stow my #{description}", 'You put')
end
end
def check_scholarship
echo '***CHECKING SCHOLARSHIP***'
return unless @settings.crossing_training.include?('Scholarship')
description = 'black book'
return if exists?(description)
order_item(8771, 1)
bput("stow my #{description}", 'You put')
end
def check_cambrinth
echo '***CHECKING CAMBRINTH***'
return if DRStats.barbarian? || DRStats.thief? || DRStats.commoner? || DRStats.trader?
description = @settings.cambrinth
return if description.nil?
return if exists?(description)
buy_item(19_152, description)
if @settings.stored_cambrinth
bput("stow my #{description}", 'You put')
else
bput("wear my #{description}", 'You ')
end
end
def stow_crafting(description)
DRCC.stow_crafting_item(description, @settings.crafting_container, @settings.engineering_belt)
end
def order_crafting?(description, room, order_number)
return false if exists?(description)
order_item(room, order_number)
stow_crafting(description)
true
end
def check_engineering
echo '***CHECKING ENGINEERING***'
return unless @settings.crossing_training.include?('Engineering')
# Uses Shaping
order_crafting?('rasp', 8865, 3)
order_crafting?('carving knife', 8865, 8)
order_crafting?('wood shaper', 8865, 9)
order_crafting?('drawknife', 8865, 10)
book_room = get_data('crafting')['shaping'][@settings.hometown]['repair-room']
order_crafting?('shaping book', book_room, 4)
order_logbook('engineering logbook', book_room, 10)
end
def check_outfitting
echo '***CHECKING OUTFITTING***'
return unless @settings.crossing_training.include?('Outfitting')
# Uses Tailoring
order_crafting?('knitting needle', 16_668, 7)
order_crafting?('tailoring book', 16_665, 1)
return unless @settings.train_workorders.include?('Tailoring')
order_logbook('outfitting logbook', 16_665, 4)
end
def order_logbook(description, room, order_number)
return unless order_crafting?(description, room, order_number)
get_crafting_item(description, nil, nil, nil)
bput("rub my #{description}", 'You mark')
stow_crafting(description)
end
def check_forging
echo '***CHECKING FORGING***'
return unless @settings.crossing_training.include?('Forging')
tool_room = get_data('crafting')['blacksmithing'][@settings.hometown]['repair-room']
# Uses Blacksmithing
order_crafting?('diagonal-peen hammer', tool_room, 1)
order_crafting?('tongs', tool_room, 2)
order_crafting?('shovel', tool_room, 3)
order_crafting?('bellows', tool_room, 5)
order_crafting?('blacksmithing book', 8771, 1)
return unless @settings.train_workorders.include?('Blacksmithing')
order_logbook('forging logbook', 8771, 10)
end
def check_alchemy
echo '***CHECKING ALCHEMY***'
return unless @settings.crossing_training.include?('Alchemy')
tool_room = get_data('crafting')['remedies'][@settings.hometown]['repair-room']
# Uses Remedies
order_crafting?('iron mortar', tool_room, 1)
order_crafting?('iron pestle', tool_room, 3)
order_crafting?('large bowl', tool_room, 4)
order_crafting?('mixing stick', tool_room, 5)
order_crafting?('metal sieve', tool_room, 6)
order_crafting?('remedies book', 8861, 1)
return unless @settings.train_workorders.include?('Remedies')
order_logbook('alchemy logbook', 8861, 4)
end
end
NewCharacter.new