-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathwasp_pickpocketer.simba
More file actions
1051 lines (837 loc) · 27.7 KB
/
wasp_pickpocketer.simba
File metadata and controls
1051 lines (837 loc) · 27.7 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
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
{$DEFINE SCRIPT_ID := '003b8e09-e988-42ca-b261-b2b76d131800'}
{$DEFINE SCRIPT_REVISION := '50'}
{$DEFINE SCRIPT_GUI}
{$I SRL-T/osr.simba}
{$I WaspLib/osr.simba}
type
ENPC = (MAN, MASTER_FARMER, GUARD, ELF, TZHAAR_CITY);
var
PickedNPC: ENPC = ENPC.ELF; //Use one of the above NPCs.
SuicideMode: Boolean = True; //Pickpocket until death. Useful if you respawn nearby.
DiaryLevel: Int32 = 4;
FoodAmount: Int32 := Random(8, 12);
NeckAmount: Int32 := Random(3, 5);
MinHealth: Int32 := Random(20, 40);
type
EThieverState = (
OPEN_BANK,
DEPOSIT_LOOT,
WITHDRAW_FOOD,
WITHDRAW_NECKLACES,
CLOSE_INTERFACE,
OPEN_CHAT,
CHANGE_CHAT_FILTER,
WALK_TO_NPC,
EQUIP_ROGUE,
CAST_SHADOW_VEIL,
PICKPOCKET,
OPEN_POUCH,
EAT_FOOD,
EQUIP_NECKLACE,
CHECK_NECKLACE,
CLOSE_CONTEXT,
DROP_ITEMS,
ENABLE_REDEMPTION,
LOOT_GRAVE,
END_SCRIPT
);
TThiever = record(TBaseBankScript)
//init variables (to be set while the script is initiates)
State: EThieverState;
UseShadowVeil, UseRedemption: Boolean;
CurrentNPC: TRSNPC;
CoinPouch, Necklace, ValuableItem: TRSItem;
LootArray, StackableArray, DropArray, RogueEquipment: TRSItemArray;
GearAmount, ValuableItemValue: Int32;
NeckTimer, ShadowVeilTimer: TCountDown;
LasPickPosition: TPoint;
//run variables (to be used while the script is running)
RenderDisabled, HasNeck, FreshNeck, RedemptionEnabled: Boolean;
CoinPouchLimit, MaxHit, NextHeal, VeilAttempts: Int32;
end;
procedure TAntiban.Setup(); override;
begin
Self.Skills := [ERSSkill.THIEVING, ERSSkill.TOTAL];
Self.MinZoom := 30;
Self.MaxZoom := 50;
inherited;
end;
procedure TThiever.SetupNPC();
begin
FoodHandler.Amount := FoodAmount;
case PickedNPC of
MAN:
begin
Self.RSW.SetupRegions([RSRegions.LUMBRIDGE]);
Self.CurrentNPC := RSNPCs.Man;
Self.LootArray += Self.CoinPouch;
Self.LootArray += 'Coins';
Self.StackableArray := Self.LootArray;
Self.MaxHit := 1;
if not SuicideMode then
SuicideMode := True;
Self.ActionProfit := 3;
end;
MASTER_FARMER:
begin
Self.RSW.SetupRegions([RSRegions.DRAYNOR_VILLAGE]);
Self.CurrentNPC := RSNPCs.MasterFarmer;
Self.LootArray := [
'Potato seed', 'Onion seed', 'Cabbage seed', 'Tomato seed',
'Sweetcorn seed', 'Strawberry seed', 'Watermelon seed',
'Snape grass seed',
'Barley seed', 'Hammerstone seed', 'Asgarnian seed', 'Jute seed',
'Yanillian seed', 'Krandorian seed', 'Wildblood seed',
'Marigold seed', 'Nasturtium seed', 'Rosemary seed', 'Woad seed',
'Limpwurt seed',
'Redberry seed', 'Cadavaberry seed', 'Dwellberry seed',
'Jangerberry seed', 'Whiteberry seed', 'Poison ivy seed',
'Ranarr seed',
'Mushroom spore', 'Belladonna seed', 'Cactus seed', 'Seaweed spore',
'Potato cactus seed'
];
Self.DropArray := [
'Potato seed', 'Onion seed', 'Cabbage seed', 'Tomato seed',
'Sweetcorn seed', 'Strawberry seed', 'Watermelon seed',
'Barley seed', 'Hammerstone seed', 'Asgarnian seed', 'Jute seed',
'Yanillian seed', 'Krandorian seed', 'Wildblood seed',
'Marigold seed', 'Nasturtium seed', 'Rosemary seed', 'Woad seed',
'Limpwurt seed',
'Redberry seed', 'Cadavaberry seed', 'Dwellberry seed',
'Jangerberry seed', 'Whiteberry seed', 'Poison ivy seed',
'Mushroom spore', 'Belladonna seed', 'Cactus seed',
'Potato cactus seed'
];
Self.MaxHit := 3;
if SuicideMode then
SuicideMode := False;
end;
GUARD:
begin
Self.RSW.SetupRegions([RSRegions.FALADOR]);
Self.CurrentNPC := RSNPCs.Guard;
Self.LootArray += CoinPouch;
Self.LootArray += 'Coins';
Self.StackableArray := Self.LootArray;
Self.MaxHit := 2;
Self.ActionProfit := 30;
end;
ELF:
begin
Self.RSW.SetupRegions([RSRegions.PRIFDDINAS]);
Self.CurrentNPC := RSNPCs.Elf;
Self.LootArray := [
Self.CoinPouch, 'Coins', 'Death rune', 'Jug of wine', 'Nature rune',
'Fire orb', 'Diamond', 'Gold ore', 'Crystal shards',
'Enhanced crystal teleport seed'
];
Self.ActionProfit := 560;
Self.ValuableItem := 'Enhanced crystal teleport seed';
Self.ValuableItemValue := ItemData.GetAverage(ValuableItem);
Self.DropArray := ['Gold ore'];
Self.StackableArray := [Self.CoinPouch, 'Coins', 'Death rune', 'Nature rune',
'Crystal shards'];
Self.MaxHit := 5;
end;
TZHAAR_CITY:
begin
Self.RSW.SetupRegions([RSRegions.MOR_UL_REK]);
Self.CurrentNPC := RSNPCs.TzhaarHur;
Self.LootArray := [
'Tokkul', 'Uncut sapphire', 'Uncut emerald',
'Uncut ruby', 'Uncut diamond'
];
Self.StackableArray := Self.LootArray;
Self.MaxHit := 4;
if SuicideMode then
SuicideMode := False;
end;
end;
Self.DropArray += 'Jug';
Self.DropArray += 'Pie dish';
Self.StackableArray += Self.Necklace; //not stackable but this array is used to not bank items
Self.StackableArray += 'Cosmic rune';
Self.CurrentNPC.Filter.Walker := False;
end;
procedure TThiever.CheckRogueEquipment();
var
ProfitMultiplier: Double;
Item: TRSItem;
begin
if Inventory.Open() then
begin
if Inventory.ContainsItem('Rogue mask') then
begin
ProfitMultiplier += 0.2;
Self.RogueEquipment += 'Rogue mask';
end;
if Inventory.ContainsItem('Rogue top') then
begin
ProfitMultiplier += 0.2;
Self.RogueEquipment += 'Rogue top';
end;
if Inventory.ContainsItem('Rogue trousers') then
begin
ProfitMultiplier += 0.2;
Self.RogueEquipment += 'Rogue trousers';
end;
if Inventory.ContainsItem('Rogue gloves') then
begin
ProfitMultiplier += 0.2;
Self.RogueEquipment += 'Rogue gloves';
end;
if Inventory.ContainsItem('Rogue boots') then
begin
ProfitMultiplier += 0.2;
Self.RogueEquipment += 'Rogue boots';
end;
//These are not part of rogue equipment but are useful while thieving
if Inventory.ContainsItem('Thieving cape') then
Self.RogueEquipment += 'Thieving cape'
else if Inventory.ContainsItem('Thieving cape(t)') then
Self.RogueEquipment += 'Thieving cape(t)'
else if Inventory.ContainsItem('Max cape') then
Self.RogueEquipment += 'Max cape';
//Lava staves for shadow veil spell
if Inventory.ContainsItem('Lava battlestaff') then
Self.RogueEquipment += 'Lava battlestaff'
else if Inventory.ContainsItem('Mystic lava staff') then
Self.RogueEquipment += 'Mystic lava staff'
else if Inventory.ContainsItem(21200) then
Self.RogueEquipment += 21200
else if Inventory.ContainsAll(['Earth battlestaff', 'Tome of fire']) then
begin
Self.RogueEquipment += 'Earth battlestaff';
Self.RogueEquipment += 'Tome of fire';
end;
end;
if Equipment.Open() then
begin
if Equipment.ContainsItem('Rogue mask') then
begin
ProfitMultiplier += 0.2;
Self.RogueEquipment += 'Rogue mask';
end;
if Equipment.ContainsItem('Rogue top') then
begin
ProfitMultiplier += 0.2;
Self.RogueEquipment += 'Rogue top';
end;
if Equipment.ContainsItem('Rogue trousers') then
begin
ProfitMultiplier += 0.2;
Self.RogueEquipment += 'Rogue trousers';
end;
if Equipment.ContainsItem('Rogue gloves') then
begin
ProfitMultiplier += 0.2;
Self.RogueEquipment += 'Rogue gloves';
end;
if Equipment.ContainsItem('Rogue boots') then
begin
ProfitMultiplier += 0.2;
Self.RogueEquipment += 'Rogue boots';
end;
//These are not part of rogue equipment but are useful while thieving
if Equipment.ContainsItem('Thieving cape') then
Self.RogueEquipment += 'Thieving cape'
else if Equipment.ContainsItem('Thieving cape(t)') then
Self.RogueEquipment += 'Thieving cape(t)'
else if Equipment.ContainsItem('Max cape') then
Self.RogueEquipment += 'Max cape';
//Lava staves for shadow veil spell
if Equipment.ContainsItem('Lava battlestaff') then
Self.RogueEquipment += 'Lava battlestaff'
else if Equipment.ContainsItem('Mystic lava staff') then
Self.RogueEquipment += 'Mystic lava staff'
else if Equipment.ContainsItem(21200) then
Self.RogueEquipment += 21200
else if Equipment.ContainsAll(['Earth battlestaff', 'Tome of fire']) then
begin
Self.RogueEquipment += 'Earth battlestaff';
Self.RogueEquipment += 'Tome of fire';
end;
end;
GearAmount := Equipment.CountGear();
if not Equipment.IsSlotUsed(ERSEquipmentSlot.NECK) then
GearAmount += 1;
ActionProfit += Round(ActionProfit * ProfitMultiplier);
for Item in Self.RogueEquipment do
StackableArray += Item; //Adding Self.RogueEquipment to the non banking item list
end;
procedure TThiever.Init(maxActions: UInt32; maxTime: UInt64); override;
begin
inherited;
Self.UseRedemption := SuicideMode;
if DiaryLevel = 4 then
DiaryLevel += 1;
Self.CoinPouch := 'Coin pouch';
Self.Necklace := 'Dodgy necklace';
Self.SetupNPC();
MinHealth := Max(Self.MaxHit, MinHealth);
//NeckTimer to recheck necklace in case the script messes up.
Self.NeckTimer.Init(140000);
if Antiban.BioDice() then
Options.SetNPCAttackOption(ERSAttackOption.HIDDEN)
else
Options.SetNPCAttackOption(ERSAttackOption.ALWAYS_RIGHT_CLICK);
Self.CheckRogueEquipment();
Self.HasNeck := Equipment.ContainsItem(Necklace);
if Magic.Open() and Magic.ContainsSpell(ERSSpell.SHADOW_VEIL) then
begin
Self.UseShadowVeil := True;
Magic.CastSpell(ERSSpell.SHADOW_VEIL);
Self.ShadowVeilTimer.Init(1000 * Round(0.6 * Stats.GetLevel(ERSSkill.MAGIC)));
end;
if not SuicideMode and ((FoodHandler.Amount + NeckAmount + 2) >= 26) then
begin
if Self.UseShadowVeil then
FoodHandler.Amount := 26 - NeckAmount - 1
else
FoodHandler.Amount := 26 - NeckAmount;
end
else if ((FoodHandler.Amount + NeckAmount + 2 + Length(Self.StackableArray)) >= (28 - Length(Self.StackableArray))) then
FoodHandler.Amount := 28 - NeckAmount - 2 - Length(Self.StackableArray);
if WLSettings.RemoteInput.HUDDebug then
DebugMMDotArray += CurrentNPC;
end;
function TThiever.EquipRogue(): Boolean;
var
Item: TRSItem;
begin
for Item in Self.RogueEquipment do
if Inventory.ClickItem(Item) then
Wait(200, 300);
if Inventory.ClickItem(21200) then
Wait(200, 300);
Result := not Inventory.ContainsAny(Self.RogueEquipment) and
not Inventory.ContainsItem('Lava battlestaff');
end;
function TThiever.HasSpace(): Boolean;
var
emptyCount: Int32;
begin
emptyCount := Inventory.CountEmptySlots();
if SuicideMode then //Makes sure we always have space to loot everything from the gravestone on suicide mode.
begin
if emptyCount > Self.GearAmount then
Exit(True);
Exit(
(Length(Self.LootArray) <= 2) and
Inventory.ContainsAll([Self.CoinPouch, 'Coins']) and not
Inventory.ContainsAny(Self.DropArray)
);
end;
if emptyCount >= 2 then
Exit(True);
Result := (emptyCount < 2) and
(Inventory.ContainsAll([Self.CoinPouch, 'Coins']) and not
Inventory.ContainsAny(Self.DropArray));
end;
function TThiever.IsLowHP(): Boolean;
begin
if Self.NextHeal < 1 then
begin
Self.NextHeal := MinHealth + Random(-Self.MaxHit, Self.MaxHit) * Antiban.GetUniqueInt(2, 0, 4);
Self.NextHeal := EnsureRange(Self.NextHeal, Self.MaxHit + 1, Round(Stats.GetLevel(ERSSkill.HITPOINTS) * 0.8));
end;
Result := Minimap.GetHPLevel() <= Self.NextHeal;
end;
function TThiever.IsPouchFull(): Boolean;
begin
if Self.CoinPouchLimit < 1 then
Self.CoinPouchLimit := SRL.TruncatedGauss(28 * DiaryLevel, 1);
Result := Inventory.CountItemStack(Self.CoinPouch) >= Self.CoinPouchLimit;
end;
function TThiever.CheckFailed(startingHP: Int32): Boolean;
var
hasHitSplat: Boolean;
currentHP: Int32 := Minimap.GetHPLevel();
begin
hasHitSplat := not Self.RenderDisabled and
(MainScreen.FindHitsplats(MainScreen.GetPlayerBox()) <> []);
Result := (currentHP < startingHP) or hasHitSplat;
if Result then
begin
if HasHitSplat then
begin
Options.RenderSelf();
Self.RenderDisabled := True;
end
else
Self.OpenCoinPouch();
end;
end;
function TThiever.NecklaceExpired(): Boolean;
begin
Result := Chat.FindMessage('crumbles', [CHAT_COLOR_LIGHT_RED]);
HasNeck := not Result;
end;
function TThiever.Dodged(): Boolean;
begin
Result := Chat.FindMessage('dodgy');
end;
function TThiever.OpenCoinPouch(): Boolean;
var
pouchCount: Int32;
begin
pouchCount := Inventory.CountItemStack(Self.CoinPouch);
if Inventory.ClickItem(Self.CoinPouch) then
begin
Wait(600);
Result := WaitUntil(not Inventory.ContainsItem(Self.CoinPouch), 100, 2000);
end;
if Result then
begin
Self.CoinPouchLimit := SRL.TruncatedGauss(28 * DiaryLevel, 1);
Self.TotalActions += pouchCount;
Self.TotalProfit += pouchCount * Self.ActionProfit;
WL.Activity.Restart();
end;
end;
function TThiever.Heal(): Boolean;
var
oldHP, newHP, hpLevel: Int32;
begin
newHP := Minimap.GetHPLevel();
hpLevel := Stats.GetLevel(ERSSkill.HITPOINTS) - 1;
repeat
oldHP := newHP;
if not Inventory.Consume(ERSConsumable.FOOD) then
Exit;
newHP := Minimap.GetHPLevel();
Result := newHP > Random(oldHP, hpLevel);
until Result;
if Result then
Self.NextHeal := 0; //This will be reset when TThiever.IsLowHP() is called.
end;
function TThiever.EquipNeck(): Boolean;
begin
if Result := Inventory.ClickItem(Necklace) then Wait(300, 400);
FreshNeck := HasNeck := Result;
end;
function TThiever.WithdrawNecks(): Boolean;
begin
if Result := Bank.WithdrawItem([Necklace, NeckAmount - Inventory.CountItem(Necklace), False], False) then Wait(1000, 1400);
end;
function TThiever.CheckNeck(): Boolean;
begin
Result := HasNeck := Equipment.ContainsItem(Necklace);
NeckTimer.Restart(Random(-30000, 60000));
end;
function TThiever.CastShadowVeil(): Boolean;
begin
if not Magic.Open() then
Exit;
if not Magic.CanActivate(ERSSpell.SHADOW_VEIL) then
begin
if Self.VeilAttempts > 2 then
begin
Self.DebugLn('Disabling shadow veil.');
Self.UseShadowVeil := Result;
Exit;
end;
Self.DebugLn('Shadow veil is not available yet.');
Self.ShadowVeilTimer.Restart(Random(-5000, 5000));
Self.VeilAttempts += 1;
Exit;
end;
Result := Magic.CastSpell(ERSSpell.SHADOW_VEIL);
Self.ShadowVeilTimer.Restart(Random(-5000, 5000));
Self.VeilAttempts := 0;
end;
function TThiever.PickNPC(): Boolean;
var
Slot: Int32 := Inventory.GetSelectedSlot;
CurrentHP: Int32 := Minimap.GetHPLevel;
begin
if Slot > -1 then Inventory.ClickSlot(Slot);
if Result := CurrentNPC.SelectOption(['Pick', 'pocket']) then
begin
Minimap.WaitPlayerMoving(300, 10000);
RSObjects.Gravestone.Coordinates.Insert(Self.RSW.GetMyPos, 0);
if Length(RSObjects.Gravestone.Coordinates) > 4 then
RSObjects.Gravestone.Coordinates.Pop;
if not Self.NecklaceExpired then
FreshNeck := False;
Self.CheckFailed(CurrentHP);
WL.Activity.Restart();
end;
end;
function TThiever.Deposit(): Boolean;
var
ItemCount: Int32;
begin
if ToStr(ValuableItem) <> '' then
ItemCount := Inventory.CountItem(Self.ValuableItem);
Result := Bank.DepositRandomItems(Self.StackableArray);
if ItemCount > 0 then
TotalProfit += (ItemCount * ValuableItemValue);
end;
function TThiever.WithdrawAny(items: TRSItemArray; quantity: Int32): Boolean;
var
item: TRSItem;
itemCount: Int32;
needed: Int32;
invCount: Int32;
begin
itemCount := Inventory.CountItems(items);
needed := quantity - ItemCount;
for item in items do
if Bank.ContainsItem(Item) then
Exit(Self.Withdraw([item, quantity, False]));
for item in items do
begin
if Self.BankTab = -1 then
Self.BankTab := Bank.FindItemTab(item);
invCount := Inventory.Count();
if Bank.WithdrawItem([item, needed, False], False) then
if WaitUntil(invCount < Inventory.Count(), 300, 5000) then
Exit(True);
end;
FoodHandler.Amount := 0;
end;
function TThiever.LootGrave(): Boolean;
var
TPA, GraveTPA: TPointArray;
P: TPoint;
UpTextFound: Boolean;
begin
HasNeck := False;
FreshNeck := False;
RedemptionEnabled := False;
if not Minimap.WaitArrow(TPA, 3000) then
Exit;
while not MainScreen.WaitArrow(GraveTPA, 3000) do
begin
Mouse.Click(TPA.Grow(6).RandomValue, MOUSE_LEFT);
Minimap.WaitMoving;
end;
repeat
if not Minimap.WaitArrow(TPA, 3000) then Exit;
if not MainScreen.WaitArrow(GraveTPA, 3000) then Exit;
GraveTPA.SortByY(False);
P := GraveTPA[0];
P.Y += 5;
Mouse.Move(P);
UpTextFound := MainScreen.IsUpText('Grave');
if not UpTextFound then
MainScreen.WaitArrow(GraveTPA, 3000);
until UpTextFound;
Result := ChooseOption.Select('Loot');
if Result then
RSObjects.Gravestone.Coordinates := [];
end;
function TThiever.EnableRedemption(): Boolean;
begin
Result := Prayer.ActivatePrayer(ERSPrayer.REDEMPTION);
UseRedemption := RedemptionEnabled := Result;
end;
function TThiever.GetState(): EThieverState;
begin
if WL.Activity.IsFinished() then
Exit(EThieverState.END_SCRIPT);
if ChooseOption.IsOpen() then
Exit(EThieverState.CLOSE_CONTEXT);
if MainScreen.FindGrave() then
Exit(EThieverState.LOOT_GRAVE);
if RSInterface.IsOpen() then
begin
if Bank.IsOpen() then
begin
if Inventory.ContainsRandomItems(Self.StackableArray) then
Exit(EThieverState.DEPOSIT_LOOT);
if Inventory.CountItem(Necklace) < NeckAmount then
Exit(EThieverState.WITHDRAW_NECKLACES);
if not Inventory.HasEnoughConsumable(ERSConsumable.FOOD) then
Exit(EThieverState.WITHDRAW_FOOD);
end;
Exit(EThieverState.CLOSE_INTERFACE);
end;
if Self.IsPouchFull() then
Exit(EThieverState.OPEN_POUCH);
if ChatButtons.GetState(ERSChatButton.GAME_CHAT) <> ERSChatButtonState.ENABLED then
Exit(EThieverState.CHANGE_CHAT_FILTER);
if not ChatButtons.IsActive(ERSChatButton.GAME_CHAT) then
Exit(EThieverState.OPEN_CHAT);
if NeckTimer.IsFinished() then
Exit(EThieverState.CHECK_NECKLACE);
if Inventory.ContainsAny(Self.RogueEquipment) then
Exit(EThieverState.EQUIP_ROGUE);
if (NeckAmount > 0) and not Self.FreshNeck and (not Self.HasNeck or Self.NecklaceExpired) then
begin
if Inventory.ContainsItem(Self.Necklace) then
Exit(EThieverState.EQUIP_NECKLACE);
Exit(EThieverState.OPEN_BANK);
end;
if not Self.HasSpace() then
begin
if Inventory.ContainsAny(Self.DropArray) then
Exit(EThieverState.DROP_ITEMS);
if Inventory.FindConsumable(ERSConsumable.FOOD) then
Exit(EThieverState.EAT_FOOD);
Exit(EThieverState.OPEN_BANK);
end;
if Self.UseShadowVeil and Self.ShadowVeilTimer.IsFinished() then
Exit(EThieverState.CAST_SHADOW_VEIL);
if not Self.RSW.AtTile(Self.CurrentNPC.Coordinates, 40) then
Exit(EThieverState.WALK_TO_NPC);
if Self.IsLowHP() then
begin
if not RedemptionEnabled and Inventory.ContainsConsumable(ERSConsumable.FOOD) then
Exit(EThieverState.EAT_FOOD);
if not SuicideMode then
Exit(EThieverState.OPEN_BANK);
if not Self.RSW.AtTile(Self.CurrentNPC.Coordinates, 40) then
Exit(EThieverState.WALK_TO_NPC);
if Self.UseRedemption and not Self.RedemptionEnabled then
Exit(EThieverState.ENABLE_REDEMPTION);
end;
Exit(EThieverState.PICKPOCKET);
end;
procedure TThiever.Run(maxActions: UInt32; maxTime: UInt64);
begin
Self.Init(maxActions, maxTime);
repeat
Self.State := Self.GetState();
Self.SetAction(ToStr(Self.State));
case Self.State of
OPEN_BANK: Bank.WalkOpen();
DEPOSIT_LOOT: Self.Deposit();
WITHDRAW_FOOD: Bank.WithdrawConsumable(ERSConsumable.FOOD);
WITHDRAW_NECKLACES: Self.WithdrawNecks();
CLOSE_INTERFACE: RSInterface.Close();
OPEN_CHAT: ChatButtons.Open(ERSChatButton.GAME_CHAT);
CHANGE_CHAT_FILTER: ChatButtons.ChangeState(ERSChatButton.GAME_CHAT, ERSChatButtonState.ENABLED);
CAST_SHADOW_VEIL: Self.CastShadowVeil();
PICKPOCKET: Self.PickNPC();
OPEN_POUCH: Self.OpenCoinPouch();
EAT_FOOD: Self.Heal();
EQUIP_NECKLACE: Self.EquipNeck();
CHECK_NECKLACE: Self.CheckNeck();
CLOSE_CONTEXT: ChooseOption.Close();
DROP_ITEMS: Inventory.ShiftDrop(Self.DropArray, Inventory.RandomPattern);
WALK_TO_NPC: Self.RSW.WebWalk(CurrentNPC.Coordinates, 30, 0.2);
EQUIP_ROGUE: Self.EquipRogue();
LOOT_GRAVE: Self.LootGrave();
ENABLE_REDEMPTION: Self.EnableRedemption();
END_SCRIPT: Break;
end;
Self.ShadowVeilTimer.Pause();
Self.DoAntiban();
Self.ShadowVeilTimer.Resume();
until Self.ShouldStop();
end;
var
Thiever: TThiever;
function TConsumableHandler.FindInBank(): TRSConsumableArray; override;
var
consumable: TRSConsumable;
item: TRSItem;
begin
Self.DebugLn('Setting up consumable of type: ' + ToStr(Self.ConsumableType));
for item in CONSUMABLE_ARRAYS[Self.ConsumableType] do
begin
if Self.ConsumableArray.Contains(item) then //avoid resetting items.
Continue;
if Bank.ContainsItem(item.Reorder(False)) then
begin
Self.DebugLn('Consumable found: ' + ToStr(item));
consumable := Self.Setup(item);
Bank._CachePosition(item, [Bank.GetCurrentTab(), Bank.GetScrollPosition()]);
//TODO: Search parent maybe?
Thiever.StackableArray += item;
Result += consumable;
end;
end;
end;
function TConsumableHandler.FindInInventory(): TRSConsumableArray; override;
var
consumable: TRSConsumable;
item: TRSItem;
begin
Self.DebugLn('Setting up consumable of type: ' + ToStr(Self.ConsumableType));
for item in CONSUMABLE_ARRAYS[Self.ConsumableType] do
begin
if Self.ConsumableArray.Contains(item) then //avoid resetting leftover items.
Continue;
if Inventory.ContainsItem(item) then
begin
Self.DebugLn('Consumable found: ' + ToStr(item));
consumable := Self.Setup(item);
Thiever.StackableArray += item;
Result += consumable;
end;
end;
end;
function TRSChooseOption.Select(Text: TStringArray; MouseAction: Int32 = MOUSE_LEFT; CaseSensitive: Boolean = True; CloseIfNotFound: Boolean = True): Boolean; override;
var
Choices: TRSChooseOption_OptionArray;
I, J: Int32;
begin
if not Self.Open then
Exit;
Wait(0, 1000 - Round(1000*BioHash), wdLeft);
Choices := Self.GetOptions;
for I := 0 to High(Choices) do
for J := 0 to High(Text) do
if (CaseSensitive and (Text[J] in Choices[I].Text)) or
((not CaseSensitive) and (Lowercase(Text[J]) in Lowercase(Choices[I].Text))) then
begin
Self.Select(Choices[I], MouseAction);
Exit(True);
end;
if CloseIfNotFound then
begin
WaitEx(350 - Round(350*BioHash), 50);
Self.Close;
end;
end;
function TRSInventory.HasEnoughConsumable(ConsumableType: ERSConsumable): Boolean; override;
begin
Result := Self.CountPoints(ConsumableType) >= FoodHandler.Amount;
end;
{$IFDEF SCRIPT_GUI}
type
TThieverConfig = record(TScriptForm)
NPCSelector: TLabeledCombobox;
DiaryLevelSelector: TLabeledComboBox;
NeckAmountEdit: TLabeledEdit;
SuicideState: TLabeledCheckbox;
end;
procedure TThieverConfig.StartScript(sender: TObject); override;
var
foodAmountEdit, minHealthEdit: TEdit;
begin
foodAmountEdit := Self.Form.GetChild('cm_food_amount_edit');
minHealthEdit := Self.Form.GetChild('cm_food_minimum_edit');
PickedNPC := ENPC(Self.NPCSelector.GetItemIndex());
SuicideMode := Self.SuicideState.IsChecked();
DiaryLevel := Self.DiaryLevelSelector.GetItemIndex() + 1;
FoodAmount := StrToInt(foodAmountEdit.GetText());
NeckAmount := StrToInt(Self.NeckAmountEdit.GetText());
MinHealth := StrToint(minHealthEdit.GetText());
inherited;
end;
procedure TThieverConfig.NPCSelectorOnChange({$H-}sender: TObject);{$H+}
begin
case ENPC(Self.NPCSelector.GetItemIndex()) of
ENPC.MAN, ENPC.MASTER_FARMER, ENPC.TZHAAR_CITY:
begin
Self.SuicideState.SetChecked(False);
Self.SuicideState.setEnabled(False);
end;
else
begin
Self.SuicideState.SetChecked(SuicideMode);
Self.SuicideState.setEnabled(True);
end;
end;
end;
function TScriptForm.CreateConsumableSettings(owner: TControl; consumableType: ERSConsumable; addInfo: Boolean = True): TPanel; override;
var
typeStr: String;
consumableAmount: TLabeledEdit;
fullWidth, w, space, y: Int32;
begin
fullWidth := Floor(Self.Size.X/3);
space := Floor(fullWidth * 0.1);
w := Floor(fullWidth - space * 2);
if addInfo then
y := Floor(Self.Size.Y/2.5)
else
y := TControl.AdjustToDPI(15);
case consumableType of
ERSConsumable.FOOD: typeStr := 'Food';
ERSConsumable.PRAYER: typeStr := 'Prayer';
ERSConsumable.ENERGY: typeStr := 'Energy';
ERSConsumable.BOOST: typeStr := 'Boost';
end;
Result := inherited;
with consumableAmount do
begin
Create(Result);
SetCaption('Withdraw ' + LowerCase(typeStr) + ' amount:');
SetName('cm_' + typeStr + '_amount');
SetLeft(fullWidth * 2 + space);
SetTop(y);
SetWidth(w);
SetText('8');
Edit.setOnKeyPress(@Edit.NumberField);
end;
end;
procedure TThieverConfig.Run(); override;
var
tab: TTabSheet;
panel: TPanel;
foodAmountEdit, minHealthEdit: TEdit;
begin
Self.Setup('Wasp Pickpocketer');
Self.Start.setOnClick(@Self.StartScript);
Self.AddTab('Script Settings');
tab := Self.Tabs[High(Self.Tabs)];
Self.CreateAccountManager(tab);
with Self.DiaryLevelSelector do
begin
Create(tab);
SetCaption('Ardougne diaries completed:');
SetLeft(TControl.AdjustToDPI(30));
SetTop(TControl.AdjustToDPI(180));
SetStyle(csDropDownList);
AddItemArray(['None/Easy diary', 'Medium diary', 'Hard diary', 'Elite diary']);
SetItemIndex(DiaryLevel - 1);
end;
with Self.NeckAmountEdit do
begin
Create(tab);
SetCaption('Necklaces amount:');
SetLeft(Self.DiaryLevelSelector.GetRight() + TControl.AdjustToDPI(30));
SetTop(Self.DiaryLevelSelector.GetTop());
SetWidth(TControl.AdjustToDPI(120));
SetText(ToStr(NeckAmount));
end;
with Self.NPCSelector do
begin
Create(tab);
SetCaption('NPC:');