forked from elanthia-online/dr-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchop-wood.lic
92 lines (74 loc) · 2.57 KB
/
chop-wood.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
=begin
Documentation: https://elanthipedia.play.net/Lich_script_repository#chop-wood
=end
custom_require.call(%w[common equipmanager common-travel events])
class ChopWood
include DRC
include DRCT
def initialize
setup
@equipment_manager.empty_hands
@equipment_manager.wield_weapon(@lumber_implement)
chop
if /roundtime/i =~ bput('watch forest careful', 'Your analysis has revealed no additional trees', 'roundtime')
chop
end
@equipment_manager.empty_hands
end
def handle_danger
fix_standing
if bleeding?
snapshot = Room.current.id
wait_for_script_to_complete('safe-room')
walk_to(snapshot)
@equipment_manager.wield_weapon(@lumber_implement)
end
return unless Flags['chop-danger']
Flags.reset('chop-danger')
waitrt?
until /danger|find nothing of concern/ =~ bput('watch forest danger', 'Unfortunately', 'shown a way to .* reduce the danger', 'find nothing of concern')
pause
waitrt?
end
handle_danger
end
def chop
waitrt?
handle_danger
result = bput('chop tree',
'You smack your axe into some brush nearby, but are unable to find a tree large enough to produce usable wood.',
'Despite thoroughly exploring the area you fail to find any trees to chop.',
'The only promising tree nearby reveals a rotted core after just a few chops.',
'but it quickly becomes apparent that property damage is',
'roundtime')
waitrt?
@loot_list.each do |item|
matches = DRRoom.room_objs.grep(/(?:\b|^)#{item}(?:\b|$)/i)
matches.each do |match|
if @use_packet && packet?
bput("push #{item} #{match.scan(/\w+/).last} with my packet", 'You push')
bput('stow my packet', 'You put', 'Stow what')
bput('stow deed', 'You put')
else
bput("stow #{match.scan(/\w+/).last}", 'You put')
end
end
end
chop if result =~ /roundtime/i
end
def packet?
bput('get my packet', 'You get', 'What were you referring to') == 'You get'
end
def setup
Flags.add('chop-danger', 'You notice an unusual smell drifting through the area', 'A monotonous buzzing sound fills the air', 'A loud cracking sound resonates from somewhere closeby')
settings = get_settings
@equipment_manager = EquipmentManager.new
@lumber_implement = settings.lumber_implement
@loot_list = settings.lumber_buddy_tree_list
@use_packet = settings.lumber_use_packet
end
end
before_dying do
Flags.delete('chop-danger')
end
ChopWood.new