forked from rpherbig/dr-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
favor.lic
167 lines (148 loc) · 4.96 KB
/
favor.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
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
=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
include DRC
include DRCT
include DRCM
include DRCI
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.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']
@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
walk_to(@water_source['id'])
bput("get my #{@water_holder}", 'You get')
3.times do
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
ensure_copper_on_hand(750, @settings)
elsif @primer_number > 200
ensure_copper_on_hand(500, @settings)
else
ensure_copper_on_hand(250, @settings)
end
unless exists?("#{@aspect} primer")
wait_for_script_to_complete('find', [@npc_name])
bput("order #{@primer_number} from #{@npc_name}", 'You decide to purchase')
stow_hands
end
get_water unless inside?('holy water', @water_holder)
walk_to(@room)
case bput("clean #{@altar_noun} altar with water in #{@water_holder}", 'You begin', 'perfectly clean', "That doesn't appear to be something you can clean.", 'altar does not look any cleaner')
when 'You begin'
case waitfor('You finish your job', 'altar does not look any cleaner')
when 'altar does not look any cleaner'
bput("clean #{@altar_noun} altar with water in #{@water_holder}", 'You begin', 'perfectly clean', "That doesn't appear to be something you can clean.", 'altar does not look any cleaner')
end
end
stow_hands
case bput("get my #{@aspect} primer", 'You get', 'What were')
when 'What were'
echo('Somehow you lost your primer, exiting.')
exit
end
bput("put my #{@aspect} primer on #{@altar_noun} altar", 'You reverently')
bput('pray', 'You begin')
waitfor('An overwhelming sense of contentment')
bput("get orb from #{@altar_noun} altar", 'You get')
fix_standing
stow_hands
end
def use_puzzle
walk_to 1420
case bput('pray', 'You feel a sense of peace settle over you', 'The gods ignore the pleas of your decaying spirit')
when 'The gods ignore the pleas of your decaying spirit'
echo '***CANNOT GET A FAVOR***'
return
end
fput 'pray'
fput 'pray'
fput "say #{@settings.favor_god}"
fix_standing
fput "get #{@settings.favor_god} orb from altar"
start_puzzle('arch')
end
def start_puzzle(location)
pause 1
case bput("go #{location}", 'giddy', 'jug', 'tinders', 'sponge', 'ancient window', 'vase on top of the altar')
when 'jug'
jug
leave_room
when 'tinders'
tinders
leave_room
when 'sponge'
sponge
leave_room
when 'ancient window'
window
when 'vase on top of the altar'
vase
end
end
def jug
bput('fill font with jug', 'you pour out the water in a slow, steady manner until the basin is filled')
end
def tinders
bput('light candle with tinders', 'you set it on fire and then use it to light the candles')
end
def sponge
bput('clean altar with sponge', 'you note with satisfaction that you have removed all the soot')
end
def window
bput('open window', 'you notice a thin crack running along the painted edge')
waitrt?
bput('open window', 'you feel the thick paint binding slip')
waitrt?
bput('open window', 'but soon it slides open with jerking movements')
waitrt?
pause 1
start_puzzle('window')
end
def vase
bput('pick flowers', 'You carefully pick some of the lovely blossoms')
pause 1
start_puzzle('tree')
end
def leave_room
pause 1
bput('go stair', 'You find yourself more than eager to step into the inviting world that awaits you')
start_puzzle('door')
end
end
CrossingFavor.new