forked from elanthia-online/dr-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmech-lore.lic
More file actions
79 lines (69 loc) · 2.25 KB
/
mech-lore.lic
File metadata and controls
79 lines (69 loc) · 2.25 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
=begin
Documentation: https://elanthipedia.play.net/Lich_script_repository#mech-lore
=end
custom_require.call(%w[common common-items drinfomon equipmanager])
class MechLore
include DRC
include DRCI
def initialize
@settings = get_settings
@equipment_manager = EquipmentManager.new(@settings)
@equipment_manager.wear_equipment_set?('standard')
@equipment_manager.empty_hands
pause 1
fput "remove #{@settings.hand_armor}"
fput "stow #{@settings.hand_armor}"
pause 1
release_invisibility
if @settings.braid_item
braid_to_fail(@settings.braid_item)
else
braid_to_fail(DRSkill.getrank('Outdoorsmanship') < 110 ? 'grass' : 'vine')
end
@equipment_manager.empty_hands
fput "get my #{@settings.hand_armor}"
fput "wear my #{@settings.hand_armor}"
end
def braid_to_fail(item)
return if left_hand || right_hand
return unless forage?(item)
loop do
waitrt?
case bput("braid my #{item}", 'You need to have more', 'Roundtime', 'You need both hands to do that', 'You can\'t braid the .* into your braided', 'is already as long as you can make it', 'You are in no condition')
when 'Roundtime'
rt = reget(10, 'Roundtime').last.scan(/\d+/).first.to_i
break if rt >= 8 || DRSkill.getxp('Mechanical Lore') >= 30
when 'is already as long as you can make it'
waitrt?
break
when 'You need both hands to do that', /into your braided/
waitrt?
empty_trash
return
when 'You are in no condition'
dispose_trash(item)
wait_for_script_to_complete('safe-room')
return
else
break unless forage?(item)
end
end
pause 1
waitrt?
bput("pull my #{item}", 'You tug and pull')
pause 1
waitrt?
empty_trash
end
# TODO: Share code with crossing-training
def empty_trash
trash_nouns = get_data('items').trash_nouns
if trash_nouns.any? { |noun| /\b#{noun}/i =~ GameObj.right_hand.noun } && !@equipment_manager.is_listed_item?(right_hand)
dispose_trash(right_hand)
end
if trash_nouns.any? { |noun| /\b#{noun}/i =~ GameObj.left_hand.noun } && !@equipment_manager.is_listed_item?(left_hand)
dispose_trash(left_hand)
end
end
end
MechLore.new