-
Notifications
You must be signed in to change notification settings - Fork 177
/
checkfavors.lic
75 lines (66 loc) · 2.63 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
=begin
Documentation: https://elanthipedia.play.net/Lich_script_repository#checkfavors
=end
custom_require.call(%w[common common-travel common-items events])
class CheckFavors
def initialize
@settings = get_settings
town_data = get_data('town')
character_hometown = @settings.favor_town || @settings.fang_cove_override_town || @settings.hometown
@hometown = town_data[character_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 @settings.favor_saver
verify_sacrifice unless DRC.bput("look my #{@settings.favor_saver}", /glows faintly/, /wavering slightly/, /strong and steady/, /glows a steady/) =~ /strong and steady/
DRCT.walk_to(@hometown['favor_altar']['id'])
DRCI.remove_item?(@settings.favor_saver)
DRC.bput("put my #{@settings.favor_saver} on altar", /^The .* dims and seems to resist slightly/, /^As you start to place your/)
DRC.bput("raise my #{@settings.favor_saver}", /^Roundtime/)
DRCI.wear_item?(@settings.favor_saver)
return
else
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
end
def verify_sacrifice
exit unless /enable the auto-sacrifice option/ =~ DRC.bput("study my #{@settings.favor_saver}", /(disable|enable) the auto-sacrifice option/, /^Study what/)
DRCI.remove_item?(@settings.favor_saver) unless DRCI.in_hand?(@settings.favor_saver)
DRC.bput("raise my #{@settings.favor_saver}", /^Roundtime/)
DRCI.wear_item?(@settings.favor_saver)
exit
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