forked from elanthia-online/dr-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheckfavors.lic
56 lines (48 loc) · 1.54 KB
/
checkfavors.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
=begin
Documentation: https://elanthipedia.play.net/Lich_script_repository#checkfavors
=end
custom_require.call(%w[common common-travel drinfomon events])
class CheckFavors
def initialize
@settings = get_settings
town_data = get_data('town')
@hometown = town_data[@settings.hometown]
check_favors
end
def check_favors
return unless @settings.favor_goal
/(\d+)/ =~ DRC.bput('favor', 'You currently have \d+', 'You are not currently')
favor_count = Regexp.last_match(1).to_i
return if favor_count >= @settings.favor_goal
if /could not/ =~ DRC.bput("tap my #{@settings.favor_god} orb", 'The orb is delicate', 'I could not find')
run_favors
fput('stow my orb')
elsif rub_orb?
DRCT.walk_to(@hometown['favor_altar']['id'])
fput("get my #{@settings.favor_god} orb")
fput('put my orb on altar')
if favor_count + 1 < @settings.favor_goal
run_favors
fput('stow my orb')
end
end
end
def run_favors
if @settings.use_favor_altars
DRC.wait_for_script_to_complete('favor', [@settings.favor_god])
else
DRC.wait_for_script_to_complete('favor')
end
end
def rub_orb?
case DRC.bput("rub my #{@settings.favor_god} orb", 'not yet fully prepared', 'lacking in the type of sacrifice the orb requires', 'your sacrifice is properly prepared')
when 'not yet fully prepared'
false
when 'lacking in the type of sacrifice the orb requires'
false
when 'your sacrifice is properly prepared'
true
end
end
end
CheckFavors.new