forked from rpherbig/dr-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.lic
535 lines (462 loc) · 23.1 KB
/
common.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
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
# quiet
=begin
Documentation: https://elanthipedia.play.net/Lich_script_development#common
=end
$ORDINALS = %w[first second third fourth fifth sixth seventh eighth ninth tenth eleventh]
$CURRENCIES = %w[Kronars Lirums Dokoras]
$ENC_MAP = {
'None' => 0,
'Light Burden' => 1,
'Somewhat Burdened' => 2,
'Burdened' => 3,
'Heavy Burden' => 4,
'Very Heavy Burden' => 5,
'Overburdened' => 6,
'Very Overburdened' => 7,
'Extremely Overburdened' => 8,
'Tottering Under Burden' => 9,
'Are you even able to move?' => 10,
'It\'s amazing you aren\'t squashed!' => 11
}
$NUM_MAP = {
'zero' => 0,
'one' => 1,
'two' => 2,
'three' => 3,
'four' => 4,
'five' => 5,
'six' => 6,
'seven' => 7,
'eight' => 8,
'nine' => 9,
'ten' => 10,
'eleven' => 11,
'twelve' => 12,
'thirteen' => 13,
'fourteen' => 14,
'fifteen' => 15,
'sixteen' => 16,
'seventeen' => 17,
'eighteen' => 18,
'nineteen' => 19,
'twenty' => 20,
'thirty' => 30,
'forty' => 40,
'fifty' => 50,
'sixty' => 60,
'seventy' => 70,
'eighty' => 80,
'ninety' => 90
}
custom_require.call(%w[spellmonitor drinfomon])
module DRC
$pause_all_lock ||= Mutex.new
module_function
def bput(message, *matches)
waitrt?
log = []
matches.flatten!
matches.map! { |item| item.is_a?(Regexp) ? item : /#{item}/i }
clear
put message
timer = Time.now
while (response = get?) || (Time.now - timer < 15)
if response.nil?
pause 0.1
next
end
log += [response]
case response
when /(?:\.\.\.wait |Wait |\.\.\. wait )([0-9]+)/
pause(Regexp.last_match(1).to_i - 0.9)
waitrt?
put message
timer = Time.now
next
when /Sorry, you may only type ahead/
pause 1
put message
timer = Time.now
next
when /^You are a bit too busy performing to do that/, /You should stop playing before you do that/
put 'stop play'
put message
timer = Time.now
next
when /would give away your hiding place/
release_invisibility
put 'unhide'
put message
timer = Time.now
next
when /^You are still stunned/, /^You can't do that while entangled in a web/
pause 0.5
put message
timer = Time.now
next
end
matches.each do |match|
if (result = response.match(match))
return result.to_a.first
end
end
end
echo '*** No match was found after 15 seconds, dumping info'
echo "messages seen length: #{log.length}"
log.reverse.each { |logged_response| echo "message: #{logged_response}" }
echo "checked against #{matches}"
echo "for command #{message}"
''
end
def wait_for_script_to_complete(name, args = [], flags = {})
verify_script(name)
before = Script.running.find_all { |s| s.name =~ /#{name}/i }.length
success = start_script(name, args.map { |arg| arg =~ /\s/ ? "\"#{arg}\"" : arg }, flags)
if success
pause 2
pause 1 while before < Script.running.find_all { |s| s.name =~ /#{name}/i }.length
end
success
end
def forage?(item)
snapshot = "#{right_hand}#{left_hand}"
while snapshot == "#{right_hand}#{left_hand}"
case bput("forage #{item}", 'Roundtime', 'The room is too cluttered to find anything here', 'You really need to have at least one hand free to forage properly', 'You survey the area and realize that any foraging efforts would be futile')
when 'The room is too cluttered to find anything here'
return false unless kick_pile?
when 'You survey the area and realize that any foraging efforts would be futile'
return false
when 'You really need to have at least one hand free to forage properly'
echo 'WARNING: hands not emptied properly. Stowing...'
fput('stow right')
end
waitrt?
end
true
end
def collect(item)
case bput("collect #{item}", 'You manage to collect a pile', 'The room is too cluttered', 'believe you would probably have better luck trying to find a dragon', 'if you had a bit more luck.', 'You cannot collect anything', 'You forage around but are unable to find anything', 'You wander around and poke your fingers', 'You survey the area and realize that any collecting efforts would be futile', 'You are sure you knew', 'You begin to forage around,')
when 'The room is too cluttered'
return unless kick_pile?
collect(item)
end
waitrt?
end
def kick_pile?(item = 'pile')
fix_standing
bput("kick #{item}", 'I could not find', 'take a step back and run up to', 'Now what did the .* ever do to you', 'You lean back and kick your feet,') == 'take a step back and run up to'
end
def rummage(parameter, container)
result = DRC.bput("rummage /#{parameter} my #{container}", 'but there is nothing in there like that\.', 'looking for .* and see .*', 'While it\'s closed', 'I don\'t know what you are referring to', 'You feel about')
case result
when 'You feel about'
release_invisibility
return rummage(parameter, container)
when 'but there is nothing in there like that.', 'While it\'s closed', 'I don\'t know what you are referring to'
return []
end
text = result.match(/looking for .* and see (.*)\.$/).to_a[1]
list_to_nouns(text)
end
def get_boxes(container)
rummage('B', container)
end
def count_boxes(settings)
current_box_count = get_boxes(settings.picking_box_source).size
if settings.picking_pet_box_source != settings.picking_box_source
current_box_count += get_boxes(settings.picking_pet_box_source).size
end
current_box_count
end
def get_skins(container)
rummage('S', container)
end
def get_gems(container)
rummage('G', container)
end
def get_materials(container)
rummage('M', container)
end
# Take a game formatted list "an arrow, silver coins and a deobar strongbox"
# And return an array ["an arrow", "silver coins", "a deobar strongbox"]
# is this ever useful compared to the list_to_nouns?
def list_to_array(list)
list.strip.split(/,|\sand\s(?:<pushBold\/>)?(?=\ba\b|\ban\b|\bsome\b|\bthe\b)/i).reject(&:empty?)
end
# Take a game formatted list "an arrow, silver coins and a deobar strongbox"
# And return an array of nouns ["arrow", "coins", "strongbox"]
def list_to_nouns(list)
list_to_array(list)
.map { |long_name| get_noun(long_name) }
.compact
.reject { |noun| noun == '' }
end
def get_noun(long_name)
remove_flavor_text(long_name).strip.scan(/[a-z\-']+$/i).first
end
def remove_flavor_text(item)
# link is to online regex expression tester
#https://regex101.com/r/4lGY6u/10
item.sub(/\s?\b(?:(?:colorfully and )?(?:artfully|artistically|attractively|beautifully|bl?ack-|cleverly|clumsily|crudely|deeply|delicately|edged|elaborately|faintly|flamboyantly|front-|fully|gracefully|heavily|held|intricately|lavishly|masterfully|prominantly|roughly|securely|sewn|shabbily|shadow-|simply|somberly|skillfully|sloppily|starkly|stitched|tied and|tightly|well-)\s?)?(?:accented|accentuated|acid-etched|adorned|affixed|appliqued|assembled|attached|augmented|awash|backed|back-laced|balanced|banded|batiked|beaded|bearded|bearing|bedazzled|bedecked|bejeweled|beset|blazoned|bordered|bound|braided|branded|brocaded|bristling|brushed|buckled|burned|buttoned|caked|camouflaged|capped|carved|caught|centered|chased|chiseled|cinched|circled|clasped|cloaked|closed|coated|cobbled together|coiled|colored|composed|connected|constructed|countoured|covered|crafted|crested|crisscrossed|crowded|crowned|cuffed|cut|dappled|decorated|deformed|depicting|designed|detailed|discolored|displaying|divided|done|dotted|draped|drawn|drizzled|edged|elaborately|embedded|embell?ished|emblazed|emblazoned|embossed|embroidered(?: all over| painstakingly)?|enameled(?: across)?|encircled|encrusted|engraved|engulfed|enhanced|entwined|equipped|etched|fashioned(?: so)?|fastened|feathered|featuring|festooned|fettered|filed|filled|firestained|fit|fitted|fixed|flecked|fletched|forged|formed|framed|fringed|frosted|full|gathered|gleaming|glimmering|glittering|goldworked|gypsy-set|hafted|hand-tooled|hanging|heavily(?:-beaded| covered)?|held fast|hemmed|hewn|hideously|highlighted|hilted|honed|hung|impressed|incised|ingeniously repurposed|inscribed|inlaid|inset|interlaced|interspersed|interwoven|jeweled|joined|laced(?: up)?|lacquered|laden|layered|limned|lined|linked|looped|knotted|made|marbled|marked|marred|meshed|mosaicked|mottled|mounted|oiled|oozing|outlined|ornamented|overlai(?:d|n)|padded|painted|paired|patched|pattern-welded|patterned|pinned|plumed|polished|printed|reinforced|reminiscent|rendered|revealing|riddled|ridged|rimed|ringed|riveted|sashed|scarred|scattered|scorched|sculpted|sealed|seamed|secured|securely|set|sewn|shaped|shimmering|shod|shot|shrouded|side-laced|slashed|slung|smeared|smudged|spangled|speckled|spiraled|splatter-dyed|splattered|spotted|sprinkled|stacked|surmounted|surrounded|suspended|stained|stamped|starred|stenciled|stippled|stitched(?: together)?|strapped|streaked|strengthened|strewn|striated|striped|strung|studded|swathed|swirled|tailored|tangled|tapered|tethered|textured|threaded|tied|tightly|tinged|tinted|tipped|tooled|topped|traced|trimmed|twined|veined|vivified|washed|webbed|weighted|whorled|worked|worn|woven|wrapped|wrought)?\b ["]?\b(?:a hand-tooled|across|along|an|around|atop|bearing|belted|bright streaks|designed|detailing|down (?:each leg|one side)|dyed (?:a|and|deep|in|night|rust|shimmering|the|to|with)|engravings|entitled|errant pieces|featuring|flaunting|frescoed|from|Gnomish Pride|(?:encased |quartered )?in(?: the)?|into|labeled|leading|like|matching|on|out|overlayed gleaming silver|resembling|shades of color|sporting|surrounding|that|the|through|tinged somber black|titled|to|upon|WAR MONGER|with|within|\b(?:at|bearing|(?:accented |held |secured )?by|carrying|clutching|colored|cradling|dangling|depicting|(?:prominently )?displaying|embossed|etched|featuring|for(?:ming)?|holding|of|over|patterned|striped|suspending|textured|that)\b \b(?:a (?:band|beaded|brass|cascade|cluster|coral|crown|dead|.+ (?:ingot|boulder|stone|rock|nugget)|fierce|fanged|fringe|glowing|golden|grinning|howling|large|lotus|mosaic|pair|poorly|rainbow|roaring|row|silver(?:y|weave)?|small|snarling|spray|tailored|thick|tiny|trio|turquoise|yellowed)|(?:squared )?agonite (?:links|decorated)|alternating|an|(?:purple |blue )?and|ash|beaded fringe|blackened (?:steel(?: accents| bearing| with|$)|ironwood)|blue steel|burnished golden|cascading layers|carved ivory|chain-lined|chitinous|(?:deep red|dull black|pale blue) cloth|cloudberry blossoms|colorful tightly|cotton candy|crimson steel|crisscrossed|curious design|curved|crystaline charm|dark (?:blue|green|grey|metals|windsteel) (?:and|exuding|glaes|hues|khor'vela|muracite|pennon|with)|dark supple|deepest|deeply blending|delicate|dusky (?:dreamweave|green-grey)|ebonwood$|emblazoned|enamel?led (?:steel|bronze)|etched|fine(?:-grained| black| crushed)|finely wrought|flame-kissed|forest|fused-together|fuzzy grey|gauze atop|gilded steel|glass eyeballs|glistening green|golden oak|grey fur|hammered|haralun|has|heavy (?:grey|pearl|silver)|horn|Ilithi cedar|inky black|interlocking silver|interwoven|iridescent|jagged interlocking plates|(?:soft dark|supple|thick|woven) (?:bolts|leather)|lightweight|long swaths|lustrous|kertig ravens|made|metal cogs|mirror-finished|mottled|multiple woods|naphtha|oak|oblong sanguine|one|onyx buttons|opposing images|overlapping|pale cerulean|pallid links|pastel-hued|pins|pitted (?:black iron|steel)|plush velvet|polished (?:bronze|hemlock|steel)|raccoon tails|ram's horns|rat pelts|raw|red and blue|rich (?:purple|golden)|riveted bindings|roughened|rowan|sanguine thornweave|scattered star|scorch marks|sculpted|shadows|shark cartilage|shifting (?:celadon|shades)|shipboard|(?:braided |cobalt |deep black |desert-tan |dusky red Taisidon |ebony |exquisite spider|fine leaf-green |flowing night|glimmering ebony |heavy |marigold |pale gold marquisette and virid |rich copper |spiral-braided |steel|unadorned black Musparan )?silk(?:cress)?|(?:coiled |shimmering )?silver(?:steel| and |y)?|sirese blue spun glitter|six crossed|slender|small bones|smoothly interlocking|snow leopard|soft brushed|somber black|sprawled|sun-bleached|steel links|stones|strips of|sunny yellow|teardrop plates|telothian|the|tiny (?:golden|indurium|scales|skull)|tightly braided|tomiek|torn|twists|two|undyed|vibrant multicolored|viscous|waves of|weighted|well-cured|white ironwood|windstorm gossamer|wintry faeweave|woven diamondwood))\b.*/, '')
end
# Items class. Name is the noun of the object. Leather/metal boolean. Is the item worn (defaults to true). Does it hinder lockpicking? (false)
# Item.new(name:'gloves', leather:true, worn:true, hinders_locks:true, adjective:'ring', bound:true)
class Item
attr_accessor :name, :leather, :worn, :hinders_lockpicking, :container, :swappable, :tie_to, :adjective, :bound, :wield, :transforms_to, :transform_verb, :transform_text, :lodges, :skip_repair
def initialize(name: nil, leather: nil, worn: false, hinders_locks: nil, container: nil, swappable: false, tie_to: nil, adjective: nil, bound: false, wield: false, transforms_to: nil, transform_text: nil, transform_verb: nil, lodges: true, skip_repair: false)
@name = name
@leather = leather
@worn = worn
@hinders_lockpicking = hinders_locks
@container = container
@swappable = swappable
@tie_to = tie_to
@adjective = adjective
@bound = bound
@wield = wield
@transforms_to = transforms_to
@transform_verb = transform_verb
@transform_text = transform_text
@lodges = lodges.nil? ? true : lodges
@skip_repair = skip_repair
end
def short_name
@adjective ? "#{@adjective}.#{@name}" : @name
end
def short_regex
@adjective ? /#{adjective}.*\b#{@name}/i : /\b#{@name}/i
end
end
# windows only I believe.
def beep
echo("\a")
end
def fix_standing
loop do
break if standing?
bput('stand', 'You stand', 'You are so unbalanced', 'As you stand', 'You are already', 'weight of all your possessions', 'You are overburdened and cannot', 'You\'re unconscious', 'You swim back up into a vertical position', "You don't seem to be able to move to do that", 'prevents you from standing')
end
end
def listen?(teacher, observe_flag = false)
return false if teacher.nil?
return false if teacher.empty?
bad_classes = %w[Thievery Sorcery]
bad_classes += ['Life Magic', 'Holy Magic', 'Lunar Magic', 'Elemental Magic', 'Arcane Magic', 'Targeted Magic', 'Arcana', 'Attunement'] if DRStats.barbarian? || DRStats.thief?
bad_classes += ['Utility'] if DRStats.barbarian?
observe = observe_flag ? 'observe' : ''
case bput("listen to #{teacher} #{observe}", 'begin to listen to \w+ teach the .* skill', 'already listening', 'could not find who', 'You have no idea', 'isn\'t teaching a class', 'don\'t have the appropriate training', 'Your teacher appears to have left', 'isn\'t teaching you anymore', 'experience differs too much from your own', 'but you don\'t see any harm in listening', 'invitation if you wish to join this class', 'You cannot concentrate to listen to .* while in combat')
when /begin to listen to \w+ teach the (.*) skill/
return true if bad_classes.grep(/#{Regexp.last_match(1)}/i).empty?
bput('stop listening', 'You stop listening')
when 'already listening'
return true
when 'but you don\'t see any harm in listening'
bput('stop listening', 'You stop listening')
end
false
end
def assess_teach
case bput('assess teach', 'is teaching a class', 'No one seems to be teaching', 'You are teaching a class')
when 'No one seems to be teaching', 'You are teaching a class'
waitrt?
return {}
end
results = reget(20, 'is teaching a class')
waitrt?
results.each_with_object({}) do |line, hash|
line.match(/(.*) is teaching a class on (.*) which is still open to new students/) do |match|
teacher = match[1]
skill = match[2]
# Some classes match the first format, some have additional text in the 'skill' string that needs to be filtered
skill.match(/.* \(compared to what you already know\) (.*)/) { |m| skill = m[1] }
hash[teacher] = skill
end
end
end
def hide?(hide_type = 'hide')
unless hiding?
case bput(hide_type, 'Roundtime', 'too busy performing', 'can\'t see any place to hide yourself', 'Stalk what', 'You\'re already stalking', 'Stalking is an inherently stealthy', 'You haven\'t had enough time')
when 'too busy performing'
bput('stop play', 'You stop playing', 'In the name of')
return hide?(hide_type)
when "You're already stalking"
put 'stop stalk'
return hide?(hide_type)
when 'You haven\'t had enough time'
pause 1
return hide?(hide_type)
end
pause
waitrt?
end
hiding?
end
def fix_dr_bullshit(string)
return string if string.split.length <= 2
string =~ /(\w+) .* (\w+)/
"#{Regexp.last_match(1)} #{Regexp.last_match(2)}"
end
def left_hand
GameObj.left_hand.name == 'Empty' ? nil : fix_dr_bullshit(GameObj.left_hand.name)
end
def right_hand
GameObj.right_hand.name == 'Empty' ? nil : fix_dr_bullshit(GameObj.right_hand.name)
end
def release_invisibility
get_data('spells')
.spell_data
.select { |_name, properties| properties['invisibility'] }
.select { |name, _properties| DRSpells.active_spells.keys.include?(name) }
.map { |_name, properties| properties['abbrev'] }
.each { |abbrev| fput("release #{abbrev}") }
end
def check_encumbrance(refresh = true)
bput('encumbrance', 'Encumbrance : .*') if refresh
$ENC_MAP[DRStats.encumbrance]
end
def retreat(ignored_npcs = [])
return if (DRRoom.npcs - ignored_npcs).empty?
escape_messages = ['You are already as far away as you can get', 'You retreat from combat', 'You sneak back out of combat']
until escape_messages.include?(DRC.bput('retreat', *(escape_messages + ['retreat', 'You try to back ', 'sneak', 'grip remains solid', 'You must stand first', 'grip on you', 'You stop advancing', 'You are already'])))
DRC.fix_standing
end
end
def text2num(text_num)
text_num = text_num.tr('-', ' ')
split_words = text_num.split(' ')
g = 0
split_words.each do |word|
x = $NUM_MAP.fetch(word, nil)
if word.eql?('hundred') && (g != 0)
g *= 100
elsif x.nil?
echo 'Unknown number'
return nil
else
g += x
end
end
g
end
def play_song?(settings, song_list, worn = true)
instrument = worn ? settings.worn_instrument : settings.instrument
result = bput("play #{UserVars.song}", 'dirtiness may affect your performance', 'slightest hint of difficulty', 'fumble slightly', /Your .+ is submerged in the water/, 'You begin a', 'You struggle to begin', 'You\'re already playing a song', 'You effortlessly begin', 'You begin some', 'You cannot play', 'Play on what instrument', 'now isn\'t the best time to be playing', 'Perhaps you should find somewhere drier before trying to play', 'You should stop practicing')
case result
when 'Play on what instrument'
snapshot = "#{right_hand}#{left_hand}"
fput("get #{instrument}")
return false if snapshot == "#{right_hand}#{left_hand}"
fput("wear #{instrument}") if worn
play_song?(settings, song_list, worn)
when 'now isn\'t the best time to be playing', 'Perhaps you should find somewhere drier before trying to play', 'You should stop practicing'
false
when 'You\'re already playing a song'
fput('stop play')
play_song?(settings, song_list, worn)
when 'You cannot play'
wait_for_script_to_complete('safe-room')
when 'dirtiness may affect your performance'
return true if DRSkill.getrank('Performance') < 20
return true unless clean_instrument(settings, worn)
play_song?(settings, song_list, worn)
when 'slightest hint of difficulty', 'fumble slightly'
true
when 'You begin a', 'You effortlessly begin', 'You begin some'
return true if UserVars.song == 'concerto masterful'
stop_playing
UserVars.song = song_list[UserVars.song] || song_list.first.first
play_song?(settings, song_list, worn)
when 'You struggle to begin'
return true if UserVars.song == song_list.first.first
stop_playing
UserVars.song = song_list.first.first
play_song?(settings, song_list, worn)
else
false
end
end
def stop_playing
bput('stop play', 'You stop playing your song', 'In the name of', "But you're not performing")
end
def clean_instrument(settings, worn = true)
cloth = settings.cleaning_cloth
instrument = worn ? settings.worn_instrument : settings.instrument
case bput("get my #{cloth}", 'You get', 'What were you')
when 'What were you'
echo('You have no chamois cloth -- this could cause problems with playing an instrument!')
beep
return false
end
stop_playing
worn ? bput("remove my #{instrument}", 'You slide', 'You remove') : bput("get #{instrument}", 'You get', 'What were you', 'You are already')
loop do
case bput("wipe my #{instrument} with my #{cloth}", 'Roundtime', 'not in need of drying', 'You should be sitting up')
when 'not in need of drying'
break
when 'You should be sitting up'
fix_standing
next
end
pause 1
waitrt?
until /you wring a dry/i =~ bput("wring my #{cloth}", 'You wring a dry', 'You wring out')
pause 1
waitrt?
end
end
until /not in need of cleaning/i =~ bput("clean my #{instrument} with my #{cloth}", 'Roundtime', 'not in need of cleaning')
pause 1
waitrt?
end
bput("wear my #{instrument}", 'You slide', 'You attach') if worn
bput("stow my #{cloth}", 'You put')
true
end
def pause_all
return false unless $pause_all_lock.try_lock
@pause_all_no_unpause = []
Script.running.find_all(&:paused?).each do |script|
@pause_all_no_unpause << script
end
Script.running.find_all do |script|
!script.paused? &&
!script.no_pause_all &&
script != Script.current
end
.each(&:pause)
pause 1
true
end
def unpause_all
return false unless $pause_all_lock.owned?
Script.running.find_all do |script|
script.paused? &&
!@pause_all_no_unpause.include?(script)
end
.each(&:unpause)
@pause_all_no_unpause = []
$pause_all_lock.unlock
true
end
def set_stance(skill)
div = if DRStats.guild == 'Paladin'
50
elsif %w[Barbarian Ranger Trader Commoner].include?(DRStats.guild)
60
else
70
end
points = 80 + DRSkill.getrank('Defending') / div
secondary = points > 100 ? 100 : points
tertiary = points > 100 ? points - 100 : 0
stance = case skill.downcase
when 'parry'
"100 #{secondary} 0"
when 'shield'
"100 0 #{secondary}"
else
"100 #{secondary} #{tertiary}"
end
DRC.bput("stance set #{stance}", /Setting your/)
end
end