forked from elanthia-online/dr-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommune.lic
355 lines (308 loc) · 12 KB
/
commune.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
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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
=begin
Documentation: https://elanthipedia.play.net/Lich_script_repository#commune
=end
custom_require.call(%w[common common-crafting common-items common-arcana drinfomon])
class Commune
include DRC
include DRCC
include DRCI
include DRCA
######################## ITEM ACTIONS ########################
def get_cleric_item(item)
case bput("get #{item} from my #{@theurgy_supply_container}", 'You get', 'You are already holding', 'I could not find', 'What were you referring to')
when 'You get'
nil
when 'You are already holding'
nil
else
missing_item(item.to_s)
end
end
def stow_cleric_item(item)
bput("put my #{item} in my #{@theurgy_supply_container}", 'You put', 'What were you referring to')
end
def empty_cleric_hands
empty_cleric_right_hand
empty_cleric_left_hand
end
def empty_cleric_right_hand
stow_cleric_item(GameObj.right_hand.noun) if @cleric_items.include?(GameObj.right_hand.name)
stow_cleric_item(GameObj.right_hand.noun) if @cleric_items.include?(GameObj.right_hand.noun)
fput('stow right') unless GameObj.right_hand.noun.nil?
end
def empty_cleric_left_hand
stow_cleric_item(GameObj.left_hand.noun) if @cleric_items.include?(GameObj.left_hand.name)
stow_cleric_item(GameObj.left_hand.noun) if @cleric_items.include?(GameObj.left_hand.noun)
fput('stow left') unless GameObj.left_hand.noun.nil?
end
######################## ITEM CHECKS ########################
def holy_water?
case bput("count holy water in my #{@water_holder}", 'left of the holy water', 'I could not find', 'What were you referring to')
when 'left of the holy water'
true
else
echo('No holy water found. Please make sure containers are open.')
missing_item('holy water')
end
end
def have_cleric_item?(item)
case bput("look at my #{item} in my #{@theurgy_supply_container}", 'You see nothing unusual', 'I could not find', 'What were you referring to')
when 'You see nothing unusual'
nil
else
echo("No #{item} found. Please make sure containers are open.")
missing_item(item.to_s)
end
end
def holding?(noun)
if GameObj.right_hand.noun == noun.to_s
true
else
GameObj.left_hand.noun == noun.to_s
end
end
# must pass items in an array
def have_cleric_items?(items)
items.each do |item|
if item == 'holy water'
holy_water?
elsif @cleric_items.include?(item.to_s)
have_cleric_item?(item.to_s)
else
echo("Unrecognized item required: #{item}")
exit
end
end
true
end
def missing_item(item)
echo("### You do not have #{item}. Exiting commmune script. ###")
exit
end
######################## COMMUNE ACTIONS ########################
def sprinkle_holy_water(target = @self)
get_cleric_item(@water_holder)
sprinkle?(@water_holder, target)
stow_cleric_item(@water_holder)
end
def sprinkle_holy_oil(target = @self)
get_cleric_item('holy oil')
sprinkle?('oil', target)
stow_cleric_item('holy oil') if holding?('oil')
end
def sprinkle?(item, target = @self)
case bput("sprinkle #{item} on #{target}", 'You sprinkle', 'Sprinkle what', 'What were you referring to')
when 'You sprinkle'
true
else
false
end
end
def wave_incense(target = @self)
empty_cleric_hands
case bput("get my #{@flint_lighter}", 'You get', 'You are already holding', 'I could not find', 'What were you referring to')
when 'You get' || 'You are already holding'
get_cleric_item('incense')
while bput('light my incense with my flint', 'nothing happens', 'bursts into flames', 'much too dark in here to do that') == 'nothing happens'
waitrt?
end
bput("wave my incense at #{target}", 'You wave')
bput('snuff my incense', 'You snuff out') if holding?('incense')
else
missing_item(@flint_lighter.to_s)
end
empty_cleric_hands
end
######################## DEVOTION ########################
def check_devotion
result = bput('commune', @devotion_levels)
@devotion_level = @devotion_levels.index(result)
@devotion_level
end
##################### CARVING ########################
def create_bead(bead_type = 'meraud')
symbols = get_data('theurgy')['immortal_to_aspect']
if symbols.key?(bead_type.to_s.capitalize)
@shape = symbols[bead_type.to_s.capitalize]
elsif symbols.value?(bead_type.to_s)
@shape = bead_type
else
missing_item('a valid carving target')
end
echo "Carving: #{@shape}"
if GameObj.right_hand.noun == 'block'
# Do nothing
elsif exists?('block')
# Do nothing
else
carve_block
end
carve_bead(@shape.to_s)
end
def get_item(name)
get_crafting_item(name, @bag, @bag_items, @belt)
end
def stow_item(name)
stow_crafting_item(name, @bag, @belt)
end
def carve_block
return unless have_cleric_items?(['holy water'])
return unless exists?('carving knife')
empty_cleric_hands
if forage?('limb')
prepare?('bless', 1)
sprinkle_holy_water('my limb')
bput('cast my limb', 'You gesture at', "You don't have")
get_item('carving knife')
if GameObj.right_hand.noun == 'limb' && GameObj.left_hand.noun == 'knife'
while GameObj.right_hand.noun == 'limb'
bput('carve my limb with my carving knife', 'You begin to hack', 'With fluid strokes', 'You continue to whittle', 'You grow more careful', 'With a final deep cut')
end
else
missing_item('limb or carving knife')
end
waitrt
stow_item('carving knife')
else
missing_item('a limb')
end
end
def carve_bead(shape)
if exists?('shaper')
empty_cleric_left_hand if GameObj.left_hand.noun != 'shaper'
empty_cleric_right_hand if GameObj.right_hand.noun != 'block'
fput('get my block') if GameObj.right_hand.noun != 'block'
get_item('shaper') if GameObj.left_hand.noun != 'shaper'
while GameObj.right_hand.noun == 'block'
case bput("shape my block to #{shape}", 'You fumble around but', 'Roundtime')
when 'You fumble around but'
missing_item('a valid shaping target')
end
end
waitrt
stow_item('shaper')
else
missing_item('shaper')
end
end
######################## COMMUNES ########################
def commune_tamsine
return unless have_cleric_items?(['holy water'])
sprinkle_holy_water
bput('commune tamsine', 'You feel warmth spread throughout your body', @commune_errors, @devotion_levels)
end
def commune_eluned
empty_cleric_hands
return unless forage?('dirt')
get_cleric_item(@water_holder)
bput('commune eluned', 'You grind some dirt in your fist', @commune_errors, @devotion_levels)
stow_cleric_item(@water_holder)
dispose_trash('dirt') if holding?('dirt')
end
def commune_kertigen(target)
target ||= @self
return unless have_cleric_items?(['holy oil'])
sprinkle_holy_oil(target)
bput('commune kertigen', 'The thick smell of ozone fills your nostrils', 'You whisper a prayer over', 'covered in a fine white powder that wipes off easily', 'crackles and sizzles for a moment', 'Perhaps it is already blessed', @commune_errors, @devotion_levels)
end
def commune_hodierna
return unless have_cleric_items?(['holy water', 'holy oil'])
sprinkle_holy_water
sprinkle_holy_oil
bput('commune hodierna', 'Your skin tingles and you feel a fiery pain', 'Your body tingles for a moment, but there are no injuries', @commune_errors, @devotion_levels)
end
def commune_meraud
return unless have_cleric_items?(['holy water', 'incense'])
wave_incense
sprinkle_holy_water
bput('commune meraud', 'For a split second you embrace existence without substance', @commune_errors, @devotion_levels)
end
def commune_truffenyi(target)
target ||= @self
case bput("commune truffenyi #{target}", 'The power of Truffenyi has answered your prayer', 'You must be holding your favor offering or orb in your right hand', @commune_errors, @devotion_levels)
when 'The power of Truffenyi has answerd your prayer'
return true
when 'You must be holding your favor offering or orb in your right hand'
missing_item('a proper offering in your right hand')
else
return false
end
end
##################### INITIALIZE #####################
def initialize
settings = get_settings
exit if DRStats.cleric? == false
@bag = settings.crafting_container
@bag_items = settings.crafting_items_in_container
@belt = settings.engineering_belt
@theurgy_supply_container = settings.theurgy_supply_container
@water_holder = settings.water_holder
@flint_lighter = settings.flint_lighter
@immortal_aspect = settings.immortal_aspect
@cleric_items = [@water_holder.to_s, 'holy water', 'holy oil', 'wine', 'incense', 'flint', 'chamomile', 'sage', 'jalbreth balm']
@self = checkname.to_s
@commune_errors = ['You stop as you realize that you have attempted a commune', 'completed this commune too recently']
@devotion_level = nil
@devotion_levels = [
'You sense nothing special from your communing',
'You feel unclean and unworthy',
'You close your eyes and start to concentrate',
'You call out to your god, but there is no answer',
'After a moment, you sense that your god is barely aware of you',
'After a moment, you sense that your efforts have not gone unnoticed',
'After a moment, you sense a distinct link between you and your god',
'After a moment, you sense that your god is aware of your devotion',
'After a moment, you sense that your god knows your name',
'After a moment, you sense that your god is pleased with your devotion',
'After a moment, you see a vision of your god, though the visage is cloudy',
'After a moment, you sense a slight pressure on your shoulder',
'After a moment, you see a silent vision of your god',
'After a moment, you see a vision of your god who calls to you by name, "Come here, my child',
'After a moment, you see a vision of your god who calls to you by name, "My child, though you may',
'After a moment, you see a crystal-clear vision of your god who speaks slowly and deliberately',
'After a moment, you feel a clear presence like a warm blanket covering you'
]
arg_definitions = [
[
{ name: 'Tamsine', regex: /^ta.*/i, variable: true, description: 'Increase TM vs. undead.' }
], [
{ name: 'Eluned', regex: /^e.*/i, variable: true, description: 'Create holy water.' }
], [
{ name: 'Kertigen', regex: /^k.*/i, variable: true, description: 'Bless weapon or person.' },
{ name: 'target', regex: /\w/i, optional: true, description: 'Target weapon or person. Defaults to self.' }
], [
{ name: 'Hodierna', regex: /^h.*/i, variable: true, description: 'Staunch bleeding.' }
], [
{ name: 'Meraud', regex: /^m.*/i, variable: true, description: 'Increase mana in room.' }
], [
{ name: 'Truffenyi', regex: /^tr.*/i, variable: true, description: 'Get or return favor orb for you. Get favor orb for others (kneeling). Proper offering required in right hand.' },
{ name: 'target', regex: /\w/i, optional: true, description: 'Target person. Defaults to self.' }
],
[
{ name: 'Carve', regex: /^carve/i, variable: true, description: 'Carve a prayer bead. Must have block or be able to forage a limb.' },
{ name: 'target', regex: /\w/i, optional: true, description: 'Immortal for prayer bead. Defaults to Meraud. Must use full name.' }
]
]
args = parse_args(arg_definitions)
if args.Tamsine
commune_tamsine
elsif args.Eluned
commune_eluned
elsif args.Kertigen
commune_kertigen(args.target)
elsif args.Hodierna
commune_hodierna
elsif args.Meraud
commune_meraud
elsif args.Truffenyi
commune_truffenyi(args.target)
elsif args.Carve
if args.target
create_bead(args.target.to_s)
else
create_bead
end
end
end
end
Commune.new