forked from brycole/gemstone
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbigbounty.lic
2726 lines (2229 loc) · 90.3 KB
/
bigbounty.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
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
=begin
Bigbounty
All in one Hunting/Looting/Bounty/Spellup/Healing script
with options of using outside scripts as well.
;trust Bigbounty and run ;Setup Bigbounty to set your options.
Thanks to Gib, Tillmen and Sheikh for some of your code used.
under construction - Working on seperating bounties, selling feature,
rift hunting and using herbs to heal for non empaths features.
checkback for more updates. Will not support, you have to figure it out.
By, Nostradamus.
=end
silence_me
unless $SAFE == 0
message( sprintf( "BIGBOUNTY: This script requires trust permission" ) )
message( sprintf( "BIGBOUNTY: Type #{$lich_char}trust #{Script.self.name}" ) )
exit
end
VERSION = "09.17.2012"
RALLY_TIME = 5
REST_INTERVAL = 60
require 'drb'
@rest_reason = nil
@not_hunting_reason = nil
@enable_combat_healing = true
def message(text)
string = ''
if $fake_stormfront then string.concat("\034GSL\r\n ") else string.concat("<pushBold\/>") end
if( text.index('\n') )
text.split('\n').each { |line| string.concat("| #{line}") }
else
string.concat('| ' + text)
end
if $fake_stormfront then string.concat("\034GSM\r\n ") else string.concat("<popBold\/>") end
puts string
end
def logged_in
time = Time.now - $login_time
hours = (time / 3600).floor
minutes = ((time - hours * 3600) / 60).floor
seconds = (time - (( hours * 3600) + (minutes * 60))).floor
if seconds == 60
seconds = 0
minutes += 1
end
if minutes >= 60
hours += 1
minutes -= 60
end
if seconds == 1 then secword = 'second' else secword = 'seconds' end
if minutes == 1 then minword = 'minute' else minword = 'minutes' end
if hours == 1 then hourword = 'hour' else hourword = 'hours' end
if hours > 0
if seconds > 0 && minutes > 0
line = message( sprintf( "BIGBOUNTY: You have been logged in for #{hours} #{hourword} #{minutes} #{minword} #{seconds} #{secword}." ) )
elsif seconds > 0
line = message( sprintf( "BIGBOUNTY: You have been logged in for #{hours} #{hourword} #{seconds} #{secword}." ) )
elsif minutes > 0
line = message( sprintf( "BIGBOUNTY: You have been logged in for #{hours} #{hourword} #{minutes} #{minword}." ) )
else
end
elsif minutes > 0
if seconds > 0
line = message( sprintf( "BIGBOUNTY: You have been logged in for #{minutes} #{minword} #{seconds} #{secword}." ) )
else
line = message( sprintf( "BIGBOUNTY: You have been logged in for #{minutes} #{minword}." ) )
end
else
line = message( sprintf( "BIGBOUNTY: You have been logged in for #{seconds} #{secword}." ) )
end
return([hours, minutes, seconds])
end
def spam
def waitcastrt?
return if Spell[515].active?
if (XMLData.cast_roundtime_end.to_f - Time.now.to_f + XMLData.server_time_offset.to_f) > 0
sleep((XMLData.cast_roundtime_end.to_f - Time.now.to_f + XMLData.server_time_offset.to_f).abs)
end
end
def waitrt?
if (XMLData.roundtime_end.to_f - Time.now.to_f + XMLData.server_time_offset.to_f) > 0
sleep((XMLData.roundtime_end.to_f - Time.now.to_f + XMLData.server_time_offset.to_f).abs)
end
end
end
def unspam
def waitcastrt?
if (XMLData.cast_roundtime_end.to_f - Time.now.to_f + XMLData.server_time_offset.to_f) > 0
sleep((XMLData.cast_roundtime_end.to_f - Time.now.to_f + XMLData.server_time_offset.to_f + "0.6".to_f).abs)
end
end
def waitrt?
if (XMLData.roundtime_end.to_f - Time.now.to_f + XMLData.server_time_offset.to_f) > 0
sleep((XMLData.roundtime_end.to_f - Time.now.to_f + XMLData.server_time_offset.to_f + "0.6".to_f).abs)
end
end
end
def self_cure(cureloc, curemana)
curelevel = curemana
curelevel -= 4 if curelevel > 14
wait_while { checkrt > 0 or checkcastrt > 0 }
if checkmana(curemana) and Char.prof == "Empath" and Char.level >= curelevel and Spells.empath >= curelevel
fput "cure #{cureloc}"
pause("2s")
return false
end
wait_while { checkrt > 0 or checkcastrt > 0 }
return true
end
def self_heal(type, dtr)
if checkhealth < maxhealth then self_cure("", 1) end
dtr = 3 if dtr > 3
dtr = 1 if dtr < 1
if type == "Wounds"
dtr.times { |m|
n = [3, 2, 1][m]
x = [5, 5, 0][m]
if Wounds.head == n then self_cure("head", 4+x) end
if Wounds.neck == n then self_cure("neck", 4+x) end
if Wounds.chest == n then self_cure("chest", 5+x) end
if Wounds.abdomen == n then self_cure("abdomen", 5+x) end
if Wounds.leftArm == n then self_cure("left arm", 2+x) end
if Wounds.rightArm == n then self_cure("right arm", 2+x) end
if Wounds.leftLeg == n then self_cure("left leg", 2+x) end
if Wounds.rightLeg == n then self_cure("right leg", 2+x) end
if Wounds.back == n then self_cure("back", 5+x) end
if Wounds.leftHand == n then self_cure("left hand", 2+x) end
if Wounds.rightHand == n then self_cure("right hand", 2+x) end
if Wounds.nerves == n then self_cure("nerves", 3+x) end
if Wounds.leftEye == n then self_cure("left eye", 5+x) end
if Wounds.rightEye == n then self_cure("right eye", 5+x) end
}
elsif type == "Scars"
dtr.times { |m|
n = [3, 2, 1][m]
x = [4, 4, 0][m]
if Scars.head == n then self_cure("head", 13+x) end
if Scars.neck == n then self_cure("neck", 13+x) end
if Scars.chest == n then self_cure("chest", 14+x) end
if Scars.abdomen == n then self_cure("abdomen", 14+x) end
if Scars.leftArm == n then self_cure("left arm", 11+x) end
if Scars.rightArm == n then self_cure("right arm", 11+x) end
if Scars.leftLeg == n then self_cure("left leg", 11+x) end
if Scars.rightLeg == n then self_cure("right leg", 11+x) end
if Scars.back == n then self_cure("back", 14+x) end
if Scars.leftHand == n then self_cure("left hand", 11+x) end
if Scars.rightHand == n then self_cure("right hand", 11+x) end
if Scars.nerves == n then self_cure("nerves", 12+x) end
if Scars.leftEye == n then self_cure("left eye", 14+x) end
if Scars.rightEye == n then self_cure("right eye", 14+x) end
}
end
end
def selfheal
if Char.prof == "Empath"
message( sprintf( "BIGBOUNTY: Checking for wounds" ) )
self_heal("Wounds", 3)
self_heal("Scars", 3)
end
end
def combatheal
if Char.prof == "Empath" && @enable_combat_healing && percentmana >= 50
message( sprintf( "BOUNTYHUNTER: Wounded in combat...healing down" ) )
Spell[220].cast && Spell[220].affordable? && !Spell[220].active? && Spell[220].known?
self_heal("Wounds", 3)
self_heal("Scars", 3)
fput "out"
end
end
def disarmed?
$myshield = []
GameObj.loot.each{|item|
if item.noun =~ /aegis/ && item.name =~ /illthorn/ then $myshield.push(item.id)
waitcastrt?
waitrt?
end
}
$myshield.each{|item, cont|
multifput("get ##{item}","stow ##{item}","ready shield")
}
end
def restingspells(single_cast = false)
message( sprintf( "BIGBOUNTY: Refreshing spells under #{@SPELL_TIME} minutes " ) )
spells = UserVars.op['rest_spells'].split(',')
spells.each do |i|
i = i.to_i
sign = Spell[i]
wait_until {sign.affordable?}
if( sign.known? && sign.timeleft <= @SPELL_TIME )
if( i == 9805 )
2.times { sign.cast }
else
while(1)
result = sign.cast
break if result !~ /Spell Hindrance/ || !sign.affordable? || dead?
end
end
break if single_cast
end
end
end
def remove_bounty
return if checkbounty =~ /^You have succeeded|^You succeeded in|You have located the heirloom/i
put 'bounty'
message( sprintf( "BIGBOUNTY: Removing Bounty" ) )
sleep 5
npc = find_taskmaster()
ask_result = dothistimeout "ask #{npc} about remove", 5, /^#{npc}.*?want to be removed|Trying to sneak/
if ask_result =~ /Trying to sneak/
fput "ask #{npc} about bounty"
else
dothistimeout "ask #{npc} about remove", 5, /^#{npc}.*?have removed you/
end
end
def get_new_bounty
message( sprintf( "BIGBOUNTY: Getting New Bounty" ) )
starting_room = Room.current.id
remove_bounty() unless checkbounty =~ /suppress|kill|dangerous|cull|citizen lost|You are not currently assigned a task|gem dealer|lost heirloom|LOOT the item|SEARCH the area/ ##do not change.
npc = find_taskmaster()
res = dothistimeout "ask #{npc} for bounty", 5, /^#{npc}.*?(?:protective escort|creature problem|local divinist|local gem dealer|local furrier|lost heirloom|local healer|local herbalist|local resident|bandit problem|I'm kind of busy right now)/ ## shouldnt change
if res =~ /I'm kind of busy right now.*Come back in about (\w+) minutes/
wait_times = { 'fifteen' => 15, 'ten' => 10, 'five' => 5 }
wait = wait_times[$1] || 5
Spell['Next Bounty'].putup
Spell['Next Bounty'].timeleft = wait
end
remove_bounty() if checkbounty =~ /bandit problem|protective escort|local divinist|local herbalist|local healer|local alchemist|local furrier|Go to the area just inside/i ## do not change
ask_npc_about_bounty()
remove_bounty() if checkbounty =~ /bandit|lynx|cockatrice|fisherman|daggerbeak|kobold|ghoul|rat|rodent|ant|worm|rolton|skeleton|grub|gnarp|snake|gnome|goblin|ghost|shade|siren|phantom|squirrel|nymph|thyril|nipper|vysan|salamander|spider|gnoll|snowcat|relnak|velnalin|troglodyte|hobgoblin|viper|cobra|revenant|orc|moccasin|whiptail|leaper|urgh/i
go2(starting_room) unless Room.current.id == starting_room
end
def in_progress
message( sprintf( "BIGBOUNTY: Approved bounty in progress" ) )
end
def find_gemdealer
message( sprintf( "BIGBOUNTY: Finding Gem Dealer" ) )
go2('gemshop')
npc = GameObj.npcs.find { |npc| npc.name =~ /clerk|jeweler|zirconia|tanzania|dealer/i }
if npc.nil?
message( sprintf( "BIGBOUNTY: Gem Dealer Not Found" ) )
end
return npc.noun
end
def find_guard
message( sprintf( "BIGBOUNTY: Locating Guard" ) )
go2('advguard')
return 'purser' if Room.current.id == 10915
unless npc = GameObj.npcs.find { |npc| npc.name =~ /guard|sergeant/i }
if Room.current.id == 420 or Room.current.id == 3424 # WL/IMT
message( sprintf( "BIGBOUNTY: No guard at the tavern, checking the gate" ) )
mymove "bank"
fput "withdraw 10"
go2('advguard2')
npc = GameObj.npcs.find { |npc| npc.name =~ /guard|sergeant/i }
end
end
if npc.nil?
message( sprintf( "BIGBOUNTY: No Guard On Duty" ) )
message( sprintf( "BIGBOUNTY: #{npc.inspect}" ) )
end
return npc.noun
end
def find_taskmaster
message( sprintf( "BIGBOUNTY: Locating Taskmaster" ) )
go2('advguild')
return GameObj.npcs.last.noun
end
def ask_npc_about_bounty
if checkbounty =~ /creature problem|local resident|lost heirloom/i
npc = find_guard()
ask_result = dothistimeout "ask #{npc} about bounty", 5, /Yes, (?:I|we) do have a task for you/
end
if checkbounty =~ /SEARCH the area/i
npc = find_guard()
ask_result = dothistimeout "ask #{npc} about bounty", 5, /Yes, (?:I|we) do have a task for you/
search_heirloom()
end
if checkbounty =~ /gem dealer/i
npc = find_gemdealer()
ask_result = dothistimeout "ask #{npc} about bounty", 5, /Yes, (?:I|we) do have a task for you/
end
if checkbounty =~ /gem/i && (@STOCKPILE)
wait_while { checkrt > 0 || checkcastrt > 0 }
$bigbounty.run_script( @STOCKPILE_SCRIPT, true )
ready_to_turn_in = (percentmind >= @BOUNTY_MIND and !saturated?)
if checkbounty =~ /succeeded/i and ready_to_turn_in
turn_in_bounty()
go2('town')
end
end
end
def bounty_succeeded?
return if checkbounty =~ /^You have succeeded|^You succeeded in|You have located the heirloom/i
end
def turn_in_guard
message( sprintf( "BIGBOUNTY: Turning in guard" ) )
npc = find_guard()
ask_result = dothistimeout "ask #{npc} about bounty", 5, /adventurer.*?guild/i
end
def turn_in_bounty
message( sprintf( "BIGBOUNTY: Turning in bounty" ) )
if checkbounty =~ /You have located the heirloom/i
turn_in_heirloom()
elsif checkbounty =~ /^You succeeded in your task and should report back to/i
turn_in_guard()
end
npc = find_taskmaster()
ask_result = dothistimeout "ask #{npc} about bounty", 5, /^#{npc}.*?done with that assignment/
go2('bank')
fput 'deposit all'
get_new_bounty() if new_bounty_ready?
end
def get_inventory(sack)
return GameObj.inv.find { |inv| inv.name =~ /^#{sack}$/ or inv.noun =~ /\b#{sack}\b/ }
end
def turn_in_heirloom
message( sprintf( "BIGBOUNTY: Turning in heirloom" ) )
npc = find_guard()
empty_hands
sacks = [ get_inventory(UserVars.jewelrysack), get_inventory(UserVars.uncommonsack), get_inventory(UserVars.wandsack), get_inventory(UserVars.lootsack) ].uniq
found = false
check_heirloom = proc { |thing|
res = dothistimeout "look ##{thing.id}", 3, /^Engraved .* initials|^You see nothing unusual\.$|^The ring appears|^It takes you a moment|^It is difficult to see/
if res =~ /^Engraved .* initials/
found = true
fput "get ##{thing.id}"
fput "give ##{thing.id} to #{npc}"
end
}
close = false
sacks.each { |sack|
if sack.contents.nil?
open_result = dothistimeout "open ##{sack.id}", 5, /^You open|^That is already open\.$/
if open_result =~ /^You open/
close = true
else
dothistimeout "look in ##{sack.id}", 5, /In .*? you see/
if sack.contents.nil?
msg 'fixme'
Script.self.kill
end
end
end
sack.contents.each { |item| check_heirloom.call(item); break if found }
fput "close ##{thing.id}" if close
break if found
}
fill_hands
unless found
message( sprintf( "BIGBOUNTY: Heirloom was not found" ) )
return false
end
return true
end
def search_heirloom
message( sprintf( "BIGBOUNTY: Starting search" ) )
last_room = nil
searched_rooms = []
wanderb = proc {
last_room ||= nil
room = Room.current
next_room_options = room.wayto.keys - UserVars.op['hunting_boundaries'].split(',')
if next_room_options.length > 1
# subtract last room if possible
next_room_options.delete_if { |option| option == last_room }
end
if ( (next_room_options - searched_rooms) > 0 )
# subtract searched rooms if possible
next_room_options = (next_room_options - searched_rooms)
end
next_room_id = next_room_options[ rand(next_room_options.length) ]
way = room.wayto[next_room_id]
if way.class == String
move(way)
else
way.call
end
last_room = room.id
searched_rooms.push(room.id)
}
@HUNTING_PREP_COMMANDS.each { |i| fput(i) }
go2( UserVars.op['hunting_room_id'] )
dothistimeout 'stow all', 5, /You are not holding|You put/
start_time = Time.now.to_f
loop {
if wounded? or Time.now.to_f - start_time > 1200
message( sprintf( "BIGBOUNTY: Wounded or timed out....Resting" ) )
return false
end
unless GameObj.npcs.any? { |npc| npc.status !~ /dead|gone/ }
@RESTING_COMMANDS.each { |i| fput(i) }
$bigbounty.cast_signs()
Spell[213].cast if Spell[213].affordable? && !Spell[213].active? && Spell[213].known?
fput "kneel" until kneeling?
dothistimeout "search", 4, /You intently search the area|interest here/
if checkbounty =~ /You have located the heirloom/i
wait_while { checkrt > 0 || checkcastrt > 0 }
@HUNTING_PREP_COMMANDS.each { |i| fput(i) }
internal_looter()
return turn_in_heirloom()
end
end
@HUNTING_PREP_COMMANDS.each { |i| fput(i) }
$bigbounty.change_stance('defensive')
fput "stand" until standing?
wanderb.call
}
end
def new_bounty_ready?
return !Spell['Next Bounty'].active?
end
def bounty_wait?
unless checkbounty =~ /gem|lost heirloom|LOOT the item|SEARCH the area/ ## CRITTERS AND BOUNTY TASKS YOU DONT WANT TO CANCEL WHEN 9003 IS UP.
if Spell[9003].timeleft <= 3
message( sprintf( "BIGBOUNTY: New bounty will be ready soon... waiting" ) )
sleep( Spell[9003].timeleft * 60 )
end
get_new_bounty() if new_bounty_ready?
end
end
def bountytask
bounty_wait? if Spell[9003].timeleft <= 3
in_progress if checkbounty =~ /suppress|kill|dangerous|cull|gem dealer|lost heirloom|LOOT the item/i ## CRITTERS AND BOUNTY TASKS YOU DONT WANT TO CANCEL WHEN SPELL 9003 IS UP.
get_new_bounty if checkbounty =~ /^You are not currently/i
search_heirloom if checkbounty =~ /SEARCH the area/i
ready_to_turn_in = (percentmind >= @BOUNTY_MIND and !saturated?)
turn_in_bounty if checkbounty =~ /^You have succeeded in your task and can return|^You succeeded in your task and should report back to|You have located the heirloom/i and ready_to_turn_in
end
$metal_materials = ["Alexandrite","Bronze","Coraesine","Drakar","Drake","Eahnor","Eonake","Faenor","Feras","Glaes","Golvern","Gornar","Imflass","Invar","Iron","Ironwood","Kelyn","Krodera","Mithglin","Mithril","Obsidian","Ora","Razern","Rhimar","Rolaren","Urglaes","Urnon","Vaalorn","Veil","Veniom","Vultite","Zorchar"]
$wood_materials = ["Carmiln","Deringo","Faewood","Fireleaf","Glowbark","Hoarbeam","Ilthorn","Ipantor","Kakore","Lor","Mesille","Modwir","Mossbark","Orase","Rowan","Ruic","Sephwir","Villswood","Witchwood","Wyrwood","Yew"]
$junk_words = ["moldy","moth-eaten","ragged","ripped","rotted","slashed","sloppy","tattered","torn"]
$junk_list = ["wolifrew lichen","rose-marrow potion","bandana","woven cloak","pair of unlaced boots"]
$dont_search = ["glacei","golem","elemental", "skayl"]
def search()
GameObj.npcs.each { |npc| waitrt?; if npc.status=~ /dead/ and !$dont_search.include?(npc.noun) then fput "loot ##{npc.id}"; end }
end
def loot_disk(item)
if checkright and checkleft
handsfull = true
if GameObj.left_hand.name =~ /shield|buckler|targe|heater|parma|aegis|scutum|mantlet|pavis/i
stoweditem = [GameObj.left_hand,"worn"]; fput "wear ##{stoweditem[0].id}"
elsif GameObj.left_hand.noun =~ /bow/
stoweditem = [GameObj.right_hand,"stowed"]; fput "put ##{stoweditem[0].id} in my #{Lich.lootsack}"
else stoweditem = [GameObj.left_hand,"stowed"]; fput "put ##{stoweditem[0].id} in my #{Lich.lootsack}"
end
else handsfull = false
end
item.each { |obj|
lootitem = GameObj.loot.find { |thing| thing.name =~ /#{obj}/i }
multifput "get ##{lootitem.id}","put ##{lootitem.id} in #{Char.name} disk"; pause 0.25
if checkleft =~ /#{lootitem.noun}/ or checkright =~ /#{lootitem.noun}/
multifput "open my #{Lich.lootsack}","put ##{obj.id} in my #{Lich.lootsack}","close my #{Lich.lootsack}"
end
}
if handsfull
if stoweditem[1] =~ /worn/ then fput "remove ##{stoweditem[0].id}"
else multifput "open my #{Lich.lootsack}","get ##{stoweditem[0].id} from my #{Lich.lootsack}","close my #{Lich.lootsack}"; end
end
end
def loot_stow(item)
# Manage full hands
if checkright and checkleft
handsfull = true
if GameObj.left_hand.name =~ /shield|buckler|targe|heater|parma|aegis|scutum|mantlet|pavis/i
stoweditem = [GameObj.left_hand,"worn"]; fput "wear ##{stoweditem[0].id}"
elsif GameObj.left_hand.noun =~ /bow/
stoweditem = [GameObj.right_hand,"stowed"]; fput "put ##{stoweditem[0].id} in my #{Lich.lootsack}"
else stoweditem = [GameObj.left_hand,"stowed"]; fput "put ##{stoweditem[0].id} in my #{Lich.lootsack}"
end
else handsfull = false
end
item.each { |obj|
lootitem = GameObj.loot.find { |thing| thing.name =~ /#{obj}/i }
multifput "get ##{lootitem.id}","put ##{lootitem.id} in my #{Lich.lootsack}"
}
# Manage full hands
if handsfull
if stoweditem[1] =~ /worn/ then fput "remove ##{stoweditem[0].id}"
else multifput "open my #{Lich.lootsack}","get ##{stoweditem[0].id} from my #{Lich.lootsack}","close my #{Lich.lootsack}"; end
end
end
def loot_bundle
packlist = GameObj.loot.find_all { |obj| obj.name =~ /heavy backpack/ }
packlist.each { |obj| multifput "open ##{obj.id}","look in ##{obj.id}" }
GameObj.loot.find_all { |obj| obj.type !~ /clothing/ and obj.noun !~ /disk|coins/ }.each { |obj|
fput "_drag ##{obj.id} ##{packlist[0].id}"
}
while packlist.size > 1
multifput "get ##{packlist[1].id}","empty ##{packlist[1].id} in ##{packlist[0].id}"; waitrt?
if !packlist[1].contents.empty?
packlist[1].contents.each { |obj| fput "_drag ##{obj.id} ##{packlist[0].id}"}
end
multifput "drop ##{packlist[1].id}","clean table"
packlist.delete_at(1)
end
end
def internal_looter()
# Build array of good loot in the room
lootlist=[]
GameObj.loot.each { |obj|
goodloot = false
# Never loot
if obj.type =~ /food|junk|ammo|cursed/ then goodloot = false
# Other junk
elsif !$junk_list.find { |junk| obj.name =~ /#{junk}/i }.nil? then goodloot = false
# Always loot
elsif obj.type =~ /reagent|note|box|gem|magic|scroll|wand|skin|instrument|jar|jewelry|herb|lockpick/ then goodloot = true
# Exceptions
elsif obj.type =~ /armor|weapon/
if !$metal_materials.find { |mat| obj.name =~ /#{mat}/i }.nil? then goodloot = true; end
if !$wood_materials.find { |mat| obj.name =~ /#{mat}/i }.nil? then goodloot = true; end
elsif obj.type =~ /clothing/
if $junk_names.find { |mat| obj.name =~ /#{mat}/i }.nil? then goodloot = true; end
else goodloot = false; end
# Create array of good loot
if goodloot then lootlist.push(obj); end
}
if lootlist.size >= 1
# Manage full hands
if checkright and checkleft
handsfull = true
if GameObj.left_hand.name =~ /shield|buckler|targe|heater|parma|aegis|scutum|mantlet|pavis/i
stoweditem = [GameObj.left_hand,"worn"]; fput "wear ##{stoweditem[0].id}"
elsif GameObj.left_hand.noun =~ /bow/
stoweditem = [GameObj.right_hand,"stowed"]; fput "put ##{stoweditem[0].id} in my #{Lich.lootsack}"
else stoweditem = [GameObj.left_hand,"stowed"]; fput "put ##{stoweditem[0].id} in my #{Lich.lootsack}"
end
else handsfull = false
end
# Get all of the good loot
lootlist.each { |obj|
# Put boxes in disk if one exists
if obj.type =~ /box/ and GameObj.loot.any? { |item| item.name =~ /#{Char.name} disk/i }
multifput "get ##{obj.id}","put ##{obj.id} in #{Char.name} disk"
if GameObj.right_hand.type =~ /box/ or GameObj.left_hand.type =~ /box/ then fput "put ##{obj.id} in my #{Lich.lootsack}"; end
# Otherwise stow
else
if obj.noun == Lich.lootsack then multifput "get ##{obj.id}","put ##{obj.id} in my second #{Lich.lootsack}"
else multifput "get ##{obj.id}","put ##{obj.id} in my #{Lich.lootsack}"
end
end
}
# Manage full hands
if handsfull
if stoweditem[1] =~ /worn/ then fput "remove ##{stoweditem[0].id}"
else fput "get ##{stoweditem[0].id} from my #{Lich.lootsack}"; end
end
end
end
def status_check
disarmed?()
if(@CURE_POISON) && checkpoison
Spell[114].cast if Spell[114].affordable? && !Spell[114].active? && Spell[114].known?
matchtimeout(15, "You gesture while calling upon the lesser spirits to aid you with the UnPoison spell")
end
if(@CURE_DISEASE) && checkdisease
Spell[113].cast if Spell[113].affordable? && !Spell[113].active? && Spell[113].known?
matchtimeout(15, "You gesture while calling upon the lesser spirits to aid you with the UnDisease spell")
end
if(@REMOVE_WEB) && checkwebbed
if Char.prof =~ /Wizard/i
spell = 906
web = GameObj.loot.find { |l| l.name =~ /\bweb\b/i }
Spell[spell.to_i].cast('web') if Spell[spell.to_i].affordable? && Spell[spell.to_i].known?
end
if Char.prof =~ /Sorcerer/i
spell = 417
web = GameObj.loot.find { |l| l.name =~ /\bweb\b/i }
Spell[spell.to_i].cast('web') if Spell[spell.to_i].affordable? && Spell[spell.to_i].known?
end
if Char.prof =~ /Empath|Cleric/i
spell = 209
web = GameObj.loot.find { |l| l.name =~ /\bweb\b/i }
Spell[spell.to_i].cast('web') if Spell[spell.to_i].affordable? && Spell[spell.to_i].known?
end
if Char.prof =~ /Paladin|Ranger|Bard|Rogue|warrior/i
spell = 119
web = GameObj.loot.find { |l| l.name =~ /\bweb\b/i }
Spell[spell.to_i].cast('web') if Spell[spell.to_i].affordable? && Spell[spell.to_i].known?
end
end
if checknotstanding
fput "stand" until standing?
end
if(@COMBAT_HEAL) && checkstunned or bleeding? && Char.prof =~ /Empath/
wait_while checkstunned
combatheal()
run
end
if(@CURE_MUSCLES) && percentstamina <= 75 && Char.prof =~ /Empath/
Spell[1107].cast if Spell[1107].affordable? && !Spell[1107].active? && Spell[1107].known?
matchtimeout(15, " momentary surge of energy")
end
wait_while { checkrt > 0 || checkcastrt > 0 }
end
def restbread
if Char.prof =~ /Empath|Cleric/ && Spell[203].timeleft == 0
empty_hands
Spell[203].cast && Spell[203].affordable? && !Spell[203].active? && Spell[203].known?
wait_while { checkrt > 0 || checkcastrt > 0 }
fput "gobble ##{GameObj.right_hand.id}" until GameObj.right_hand.name == "Empty"
fill_hands
end
end
def manabread
if GameObj.pcs.find{|pc| pc.noun =~ /Molester|Staypuff/i} && XMLData.game =~ /GSF/i
empty_hands
fput "whisper ##{GameObj.pcs.find{|pc| pc.noun =~ /Molester|Staypuff/i}.id} bread"
matchtimeout(15, "(Molester|Staypuff) offers you a|(waybread|flatbread|biscuit|bread|cake|loaf|dumpling) appears in the air, then falls to the ground")
fput "accept"
pause 1
fput "gobble ##{GameObj.right_hand.id}" until GameObj.right_hand.name == "Empty"
empty_hands
else GameObj.pcs.find{|pc| pc.noun =~ /Mofuggah|Alfred/i} && XMLData.game =~ /GSF/i
empty_hands
fput "whisper ##{GameObj.pcs.find{|pc| pc.noun =~ /Mofuggah|Alfred/i}.id} bread"
matchtimeout(15, "(Mofuggah|Alfred) drops|(waybread|flatbread|biscuit|bread|cake|loaf|dumpling) appears in the air, then falls to the ground")
fput "_drag ##{GameObj.loot.find{|thing| thing.noun =~ /waybread|flatbread|biscuit|bread|cake|dumpling/i}.id} right"
fput "gobble ##{GameObj.right_hand.id}" until GameObj.right_hand.name == "Empty"
empty_hands
end
end
def go2(target)
wait_while { running? 'go2' }
unless target.to_i == Room.current.id
start_script( 'go2', [target, '_disable_confirm_'] )
wait_while { running?('go2') }
end
end
wander_rooms = Array.new
## OTF HUNTING ROOMS
##hunting_ground_rooms = [ '12046', '12047', '12048', '12049', '12050', '12051', '12052', '12053', '12055', '12056', '12061', '12057', '12058', '12062', '12065', '12059', '12063', '12064', '12060', '12066', '12070', '12067', '12068', '12071', '12073', '12069', '12072', '12074', '12076', '12079', '12075', '12077', '12078', '12079', '12080', '12081', '12082', '12083', '12084', '12085', '12086', '12087']
## RIFT HUNTING ROOMS P4
## hunting_ground_rooms = [ '12141', '12140', '12119', '12252', '12103', '12133', '12152', '12151', '12097', '12098', '12156', '12096', '12095', '12248', '12139', '12106', '12138', '12146', '12153', '12122', '12145', '12157', '12125' ]
## RIFT HUNTING ROOMS P5
## hunting_ground_rooms = [ '12228', '12219', '12254', '12253', '12246', '12245', '12244', '12243', '12241', '12239', '12238', '12236', '12235', '12232', '12240', '12229' ]
## NELEMAR THIRD FLOOR
## hunting_ground_rooms = [ '12731', '12732', '12733', '12734', '12739', '12740', '12741', '12742', '12743', '12744' ]
wander = proc {
sleep 0.1
room = Room.current
next_room_options = room.wayto.keys & hunting_ground_rooms
next_room = next_room_options.find_all { |r| not wander_rooms.include?(r) }
if next_room.empty?
next_room = wander_rooms.find { |r| next_room_options.include?(r) }
else
next_room = next_room[rand(next_room.length)]
end
if not next_room
start_script 'go2', [ Room.current.find_nearest(hunting_ground_rooms.collect { |id| id.to_i }).to_s ]
wait_while { running?('go2') }
else
wander_rooms.delete(next_room)
wander_rooms.push(next_room)
way = room.wayto[next_room]
if way.class == String
move(way)
else
way.call
end
end
}
#######################################################################################################################
#######################################################################################################################
#######################################################################################################################
before_dying { unspam() }
before_dying { $bigbounty.gather_ammo }
class Event
attr_accessor :type, :created_at, :room_id
@@RECOGNIZED = [ :HUNTING_PREP_COMMANDS, :HUNTING_SCRIPTS_START, :CAST_SIGNS, :ATTACK,
:HUNTING_SCRIPTS_STOP, :RESTING_SCRIPTS_START, :RESTING_PREP_COMMANDS, :DISPLAY_WATCH ]
def initialize( type, time_stamp, room_id )
raise "Event type not recognized" unless @@RECOGNIZED.include?(type)
@type = type
@created_at = time_stamp
@room_id = room_id
end
def stale?
if( Room.current.id != @room_id || Time.now.to_i - @created_at > 15 )
return true
else
return false
end
end
def type
return @type
end
end
class Group
include DRbUndumped
attr_accessor :leader, :members
def initialize()
@members = Hash.new
end
def set_leader(leader)
@leader = leader
end
def add_member(member)
@members[member.name()] = member
end
def size()
return @members.size
end
def get_names
return @members.keys + [@leader.name]
end
def room_id()
return @leader.room_id()
end
def add_event(type)
@members.each_pair { |k,v|
begin
v.add_event( type, Time.now.to_i, Room.current.id )
rescue
@leader.message("Error adding #{type.to_s} event to members stack: #{$!}")
@leader.message($!.backtrace.join("\n"))
end
}
end
def add_leader_event(event)
@leader.add_event( Event.new(event) ) unless @leader.event_stack.size > 5
end
def roundtime?()
@members.each_pair { |k,v|
begin
return true if v.rt? > 0
rescue
@leader.message("Error polling member for RT. Removing!")
@members.delete(k)
end
}
return false
end
def should_hunt?()
emergency = @leader.event_stack.size == 0 ? nil : @leader.event_stack.shift
if(emergency)
@leader.clear_events
return false
end
@members.each_pair { |k,v|
begin
return false if !v.should_hunt?
rescue
@leader.message("Error polling member. Removing!")
@members.delete(k)
end
}
$bigbounty_status = :hunting
return true
end
def should_rest?()
@members.each_pair { |k,v|
begin
return false if !v.should_rest?
rescue
@leader.message("Error polling member. Removing!")
@members.delete(k)
end
}
return true
end
def emergency_rest?()
@members.each_pair { |k,v|
begin
return true if v.wounded?
rescue
@leader.message("Error polling member. Removing!")
@members.delete(k)
end
}
return false
end
end
class Bigbounty
include DRbUndumped
attr_accessor :BIRTH_TIME, :START_TIME, :STORED_TIMES, :FRIED, :OOM, :CURE_POISON, :CURE_DISEASE,
:SIGNS, :TARGETS, :INVALID_TARGETS, :FLEE_COUNT, :ALWAYS_FLEE_FROM, :ATTACK_PERCENT, :COMBAT_HEAL,
:USE_WRACKING, :HEALTH, :AMMO, :AMMO_CONTAINER, :HIDE_FOR_AMMO, :STOCKPILE, :REMOVE_WEB,
:REST_TILL_EXP, :REST_TILL_MANA, :USE_HERBS, :DEAD_MAN_SWITCH, :CANCEL_LIST, :CURE_MUSCLES,
:RESTING_ROOM_ID, :RESTING_COMMANDS, :RESTING_SCRIPTS, :HUNTING_ROOM_ID, :STOCKPILE_SCRIPT,
:HUNTING_BOUNDARIES, :HUNTING_SCRIPTS, :HUNTING_COMMANDS, :REST_HEAL, :CAST_REST_SPELLS,
:DISABLE_COMMANDS, :HUNTING_STANCE, :HUNTING_PREP_COMMANDS, :MAKE_BREAD, :ATTACK_SPELL,
:MONITOR_INTERACTION, :FLEE_CLOUDS, :WRACKING_SPIRIT, :HOUSE_LOOTER, :BOUNTY_MIND,
:REST_TILL_SPIRIT, :BOUNTY_MODE, :DO_BOUNTIES, :REST_SPELLS, :SPELL_TIME, :HUNT_SUPPRESS,
:event_stack, :followers
PRONE = /sleeping|webbed|stunned|kneeling|sitting|^lying|prone/