forked from elanthia-online/dr-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfavor.lic
More file actions
220 lines (201 loc) · 8.38 KB
/
Copy pathfavor.lic
File metadata and controls
220 lines (201 loc) · 8.38 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
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
=begin
Documentation: https://elanthipedia.play.net/Lich_script_repository#favor
=end
custom_require.call(%w[common common-travel common-money common-items equipmanager])
class CrossingFavor
def initialize
arg_definitions = [
[
{ name: 'immortal', regex: /\w+/, optional: true, description: "Immortal who's orb to get from an altar, turns on altar favors instead of the puzzle" }
]
]
args = parse_args(arg_definitions, true)
@settings = get_settings
@hometown = @settings.favor_town || @settings.fang_cove_override_town || @settings.hometown
@hometown_data = get_data('town')[@hometown]
if args.immortal
@immortal = args.immortal.capitalize
@all_theurgy_data = get_data('theurgy')
@data = @all_theurgy_data[@hometown]
@immortal_to_aspect = @all_theurgy_data['immortal_to_aspect']
@water_source = @data['holy_water']
@aspect_to_primer = @all_theurgy_data['aspect_to_primer']
@aspect = @immortal_to_aspect[@immortal]
@primer_number = @aspect_to_primer[@aspect]
@npc_name = @data['primer_npc']
@room = @data['favor_altars'][@immortal]['id']
#if immortal is set, but there is no room number then there are no favor_altars in current hometown for the selected immortal
if !@room
DRC.message("No usable #{@immortal} altar in your hometown (#{@hometown}).")
DRC.message("Valid Immortals in #{@hometown}: #{@data['favor_altars'].keys}")
#likely called from training manager. This error will keep happning unless user adjusts their yaml.
if running?('training-manager')
DRC.message('Suggested to lower your favor_goal or change favor_god to a working immortal for your hometown to avoid this delay.')
DRC.message('Exiting in 10.')
pause 10
end
exit
end
@altar_noun = @data['favor_altars'][@immortal]['adjective']
@water_holder = @settings.water_holder
end
EquipmentManager.new.empty_hands
if args.immortal.is_a?(String)
use_altar
else
use_puzzle
end
end
def get_water
DRCT.walk_to(@water_source['id'])
DRC.bput("get my #{@water_holder}", 'You get')
3.times do
DRC.bput("fill #{@water_holder} with water from #{@water_source['noun']}", 'You fill', 'There is no more room')
end
end
def use_altar
unless @water_holder
echo('You must purchase a water container and set water_holder: in your yaml to use altars for favors')
exit
end
if @primer_number > 300
DRCM.ensure_copper_on_hand(750, @settings)
elsif @primer_number > 200
DRCM.ensure_copper_on_hand(500, @settings)
else
DRCM.ensure_copper_on_hand(250, @settings)
end
unless DRCI.exists?("#{@aspect} primer")
DRC.wait_for_script_to_complete('find', [@npc_name])
DRC.bput("order #{@primer_number} from #{@npc_name}", 'You decide to purchase')
DRCI.stow_hands
end
get_water unless DRCI.inside?('holy water', @water_holder)
DRCT.walk_to(@room)
clean_altar
DRCI.stow_hands
case DRC.bput("get my #{@aspect} primer", 'You get', 'What were')
when 'What were'
echo('Somehow you lost your primer, exiting.')
exit
end
DRC.bput("put my #{@aspect} primer on #{@altar_noun} altar", 'You reverently')
DRC.bput('pray', 'You begin')
waitfor('An overwhelming sense of contentment')
DRC.bput("get orb from #{@altar_noun} altar", 'You get')
DRC.fix_standing
DRCI.stow_hands
end
def clean_altar
loop do
case DRC.bput("clean #{@altar_noun} altar with water in #{@water_holder}",
/^But the altar is perfectly clean/,
/^You finish your job/,
/^You begin to wash/,
/^You diligently work/,
/^Wash the altar with what?/,
/altar does not look any cleaner/)
when /^You diligently work/, /^You begin to wash/
case waitfor('You finish your job', 'altar does not look any cleaner')
when /^You finish your job/
break
when /altar does not look any cleaner/
next
end
when /^Wash the altar with what?/
get_water
DRCT.walk_to(@room)
break
when /^But the altar is perfectly clean/
break
end
end
end
def use_puzzle
DRCT.walk_to @hometown_data['favor_puzzle']['id']
loop do
case DRC.bput("pray",
/^You feel a sense of peace settle over you/,
/^The gods ignore the pleas of your decaying spirit/,
/^You close your eyes and pray/,
/^As you continue to pray/,
/if you have come seeking the favor of your god, declare that name now/i)
when /^You close your eyes and pray/, /^As you continue to pray/, /^You feel a sense of peace settle over you/
next
when 'The gods ignore the pleas of your decaying spirit'
DRC.message("***CANNOT GET A FAVOR YOU HEATHEN!***")
exit
when /if you have come seeking the favor of your god, declare that name now/i
break
end
end
case DRC.bput("say #{@settings.favor_god}", /^The voice speaks to you again saying, \"You have indicated an unknown god with the name/i, /rise and seek your favor/)
when /^The voice speaks to you again saying, \"You have indicated an unknown god with the name/i
DRC.message("***Only neutral aspects can be used with favor puzzles***")
DRC.message("Check https://elanthipedia.play.net/Category:Immortals names of Neutral aspects")
exit
when /rise and seek your favor/
DRC.fix_standing
fput "get #{@settings.favor_god} orb from altar"
end
DRC.bput("go arch", /^You step through/)
do_puzzle
end
def do_puzzle
pause 1
case DRC.bput("look", 'water jug on it', "some tinders, several candles", 'a small sponge.', 'A table sits against one wall, directly opposite an ancient window', 'vase on top of the altar', 'The view atop the raised dais is impressive')
when 'water jug on it'
DRC.bput('fill font with jug', 'you pour out the water in a slow, steady manner until the basin is filled')
leave_room
when "some tinders, several candles"
DRC.bput('light candle with tinders', 'you set it on fire and then use it to light the candles')
leave_room
when 'a small sponge.'
DRC.bput('clean altar with sponge', 'you note with satisfaction that you have removed all the soot')
leave_room
when 'A table sits against one wall, directly opposite an ancient window'
window
when 'You cannot go through a closed window'
window
when 'vase on top of the altar'
vase
end
end
def window
loop do
case DRC.bput('open window',
/^Judging the thickness of the paint which has sealed the window shut/,
/^Shaking the frame of the glass once more, you manage to loosen it even further/,
/^That is already open./,
/At first it only creaks, but soon it slides open with jerking movements/)
when /^Judging the thickness of the paint which has sealed the window shut/, /^Shaking the frame of the glass once more, you manage to loosen it even further/
waitrt?
pause 1
next
when /At first it only creaks, but soon it slides open with jerking movements/, /^That is already open/
DRC.bput("go window", /^You cannot go through a closed window./, /^You hoist yourself off the floor and manage/)
do_puzzle
break
end
end
end
def vase
DRC.bput('pick flowers', 'You carefully pick some of the lovely blossoms')
pause 1
DRC.bput("go tree", /^Having filled the vase with flowers/)
do_puzzle
end
def leave_room
pause 1
case DRC.bput('go stair', 'You find yourself more than eager to step into the inviting world that awaits you', /^As you approach the stairway, the braziers on either side suddenly flare greatly/)
when 'You find yourself more than eager to step into the inviting world that awaits you'
case DRC.bput("go door", /^You are engulfed in a flash of light/, /^It would be difficult to go through the door from the bottom of the stairway./, /^A soft voice echoes in your mind/, /^You feel giddy all over/)
when /^You are engulfed in a flash of light/, /^It would be difficult to go through the door from the bottom of the stairway./
do_puzzle
end
when /^As you approach the stairway, the braziers on either side suddenly flare greatly/
do_puzzle
end
end
end
CrossingFavor.new