-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathAbyte0_Blood.java
More file actions
518 lines (484 loc) · 11.3 KB
/
Abyte0_Blood.java
File metadata and controls
518 lines (484 loc) · 11.3 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
public class Abyte0_Blood extends Abyte0_Script
{
//Version 3.1 2021-08-17 Support Cake as 330
//Version 3.2 2022-06-24 AntiLogout when pid is good
//Version 3.2.6 2024-03-12 Stop loop for debuggin the fighting teleport bug that rarely happen
int fmode = 2;
int coinsId = 10;
int bloodId = 619;
int foodId = 373;
int minFoodToBankAt = 3;
int SafeOrNot = 0; //0 oui 1 non
int BuryOrNot = 0; //0 oui 1 non
int minWait = 30000;
int maxWait = 90000;
int stuckLoop = 0;
public Abyte0_Blood(Extension e)
{
super(e);
}
public void init(String params)
{
String str[]=params.split(",");
if(str.length >= 5)
{
fmode = Integer.parseInt(str[0]);
foodId = Integer.parseInt(str[1]);
minFoodToBankAt = Integer.parseInt(str[2]);
SafeOrNot = Integer.parseInt(str[3]);
BuryOrNot = Integer.parseInt(str[4]);
if(str.length == 7)
{
minWait = Integer.parseInt(str[5]);
maxWait = Integer.parseInt(str[6]);
}
}
else
{
print("You should use: Abyte0_Blood Fmode,FoodId,minFoodToBankAt,SafeOrNot(0= save food 1 = not),BuryOrNot(0= yes 1 = not) (optional ,minWait,maxWait");
print("You are Using Default: Attack Mode, Lobs, Run To Bank At 2 Lobs Left, Walk to center even if no chest ready");
}
//if(str[1].equals("2")
print("Blood Runes Banker ~By Abyte0");
print("Version 3.2 Debug the teleport bug v6");
print("-");
print("Fmode = " + fmode);
print("foodId = " + foodId);
print("minFoodToBankAt = " + minFoodToBankAt);
if(SafeOrNot == 0)
print("Saving Food By Using Wait Wall");
else
print("Just use more food but faster maybe");
if(BuryOrNot == 0)
print("Bury Big Bones");
else
print("Fk Prayer");
print("minWait = " + minWait);
print("maxWait = " + maxWait);
}
public int main()
{
if(getFightMode() != fmode)
setFightMode(fmode);
if(isAtApproxCoords(615, 3396, 25))
{
if(getInventoryCount(foodId) <= minFoodToBankAt || getFatigue() > 70)
{
print("Running");
if(inCombat())
{
RunFromCombat();
return random(200,400);
}
if(getHpPercent() < 60 && IsStillHavingFood(foodId))
{
EatFood(foodId);
return random(2400,3000);
}
if(getY() > 3388)
{
RunNorthOrAttackNorth();
return random(500, 1104);
}
if(getX() >= 617 && getX() <= 619 && getY() >= 3382 && getY() <= 3388)
{
if(getFatigue() > 60)
{
useSleepingBag();
return 3000;
}
else
{
//on monte lechelle
int[] stairs = getObjectById(5);
if(stairs[0] != -1)
{
atObject(stairs[1], stairs[2]);
return random(800,900);
}
}
return random(800, 1300);
}
return random(100, 212);
}
else
{
//si asser de food on thieve le chest :D
//si blblabla 614 3398 614 3402
int bloodChest[] = getObjectById(337);
if(getHpPercent() < 60)
{
if(inCombat())
{
RunFromCombat();
return random(99,222);
}
EatFood(foodId);
return random(2400,3000);
}
else if(bloodChest[0] != -1)
{
if(inCombat())
{
RunFromCombat();
random(250, 300);
}
atObject2(bloodChest[1],bloodChest[2]);
return random(250, 589);
}
else if(getObjectIdFromCoords(614,3399) == 340 && getObjectIdFromCoords(614,3401) == 340)
{
//si position 1 = 340 = lotted et si position 2 = 340 = lotted
//Run Safe or Run Center
if(needToMove)
{
changePosition();
return 500;
}
int nombre = TryBury();
if(nombre != -1)
return nombre;
if(SafeOrNot == 0)
{
if(!(getX() == 618 && getY() == 3398))
walkTo(618,3398);//wall
}
else
{
if(SafeOrNot == 2)
{
int[] npcs = getNpcById(312);
if(npcs[0] != -1)
{
attackNpc(npcs[0]);
return 500;
}
}
if(!(getX() == 614 && getY() == 3400))
walkTo(614,3400);//centre chest
}
return random(300, 654);
}
else
{
if(inCombat())
{
RunFromCombat();
return 200;
}
if(random(1, 2) == 1)
atObject2(614,3399);
else
atObject2(614,3401);
return random(300, 650);
}
}
}
if(isBanking())
{
if(getInventoryCount(coinsId) > 1)
{
deposit(coinsId, getInventoryCount(coinsId)-1);
return random(1000, 1500);
}
if(getInventoryCount(coinsId) < 1)
{
withdraw(coinsId, 1);
return random(1000, 1500);
}
if(getInventoryCount(bloodId) > 1)
{
deposit(bloodId, getInventoryCount(bloodId)-1);
return random(1000, 1500);
}
if(getInventoryCount(bloodId) < 1)
{
withdraw(bloodId, 1);
}
if(getInventoryCount() < 28)
{
withdraw(foodId, 29-getInventoryCount());
return random(1000, 1500);
}
if(getInventoryCount() > 28 && getInventoryCount(bloodId) < 5 && getInventoryCount(coinsId) < 1000)
closeBank();
}
if(getX() == 612 && getY() == 572)
{
//Si a coter d ela porte de la teleported house
print("Step Outside House");
int[] doorObj = getWallObjectById(2);
if(doorObj[0] != -1)
{
if (isAtApproxCoords(doorObj[1], doorObj[2], 5));
atWallObject(doorObj[1], doorObj[2]);
}
walkTo(612,573);
stuckLoop = 0;
if(getHpPercent() < 70)
{
EatFood(foodId);
return random(2400,3000);
}
return random(100, 1500);
}
if(getX() >= 611 && getX() <= 617 && getY() >= 568 && getY() <= 572)
{
//Si dans la teleported room
//start of debug part for the bug
if(!inCombat())
{
print("Resetting we are not fighting in the room");
stuckLoop = 0;
}
else
{
if(stuckLoop < 4)
{
print(getDateTime() + " : " + stuckLoop + " STUCK FIGHTING?");
print("waiting 30 secs");
stuckLoop ++;
walkTo(612,572);
return 30000;
}
print("-------------------------");
print("-------------------------");
print("-------------------------");
print("-------------------------");
print(getDateTime() + " : " + "Still stuck :::::::::::::::::::::::::::::");
takeScreenshot(getDateTime() + ".png");
//setAutoLogin(false);
//logout();
//stopScript();
return 60000;
}
//end of debug part for the bug
walkTo(612,572);
if(getFatigue() > 6)
{
useSleepingBag();
print("Waitting....");
return random(minWait, maxWait);
}
return random(14000, 30003);//618,551
}
if(isAtApproxCoords(581, 574, 5))
{
if(getInventoryCount(335) > 0) //We do not want any residue of cake in inventory for next batch
{
EatFood(335);
return 2000;
}
if(getInventoryCount(333) > 0) //We do not want any residue of cake in inventory for next batch
{
EatFood(333);
return 2000;
}
if(getInventoryCount() < 28 || getInventoryCount(bloodId) > 5 || getInventoryCount(coinsId) > 1000)
{
if(!isQuestMenu())
{
int banker[] = getNpcByIdNotTalk(new int[]{95});
if(banker[0] != -1)
{
talkToNpc(banker[0]);
return random(2000, 2700);
}
return 1000;
}
else
{
answer(0);
return 6000;
}
}
}
if(isAtApproxCoords(617, 558, 2) && getInventoryCount(foodId) > minFoodToBankAt)
{
int[] door = getWallObjectById(96);
if(door[0] != -1)
atWallObject2(door[1], door[2]);
return random(1000, 1500);
}
if(isAtApproxCoords(617, 552, 3) && getInventoryCount(foodId) <= minFoodToBankAt)
{
int[] door = getWallObjectById(96);
if(door[0] != -1)
{
atWallObject(door[1], door[2]);
return random(800, 1200);
}
return 1000;
}
if(isAtApproxCoords(617, 552, 3) && getInventoryCount(foodId) > minFoodToBankAt)
{
int[] stairs = getObjectById(6);
if(stairs[0] != -1)
{
atObject(stairs[1], stairs[2]);
//debug the stuck
print("---- Resetting we are going DOWN ----");
stuckLoop = 0;
//END debug the stuck
return random(800,900);
}
return random(500, 800);
}
if(getX() == 618 && getY() == 3382)
{
//on monte lechelle car on est bloquer du mauvais coter
int[] stairs = getObjectById(5);
if(stairs[0] != -1)
{
atObject(stairs[1], stairs[2]);
return random(800,900);
}
return random(500, 800);
}
walk();
return random(2000, 2500);
}
public int walk()
{
if(getInventoryCount(foodId) <= minFoodToBankAt)
{
//wee need to bank
//617, 558, 609, 565, 603, 582, 600, 595, 588, 598, 590, 578, 581, 574
if(getX()> 600)
{
if(getY() < 558)
walkTo(617, 558);
else if(getY() < 565)
walkTo(609, 565);
else if(getY() < 582)
walkTo(603, 582);
else if(getY() < 595)
walkTo(600, 595);
else
walkTo(597,602);
}
else
{
if(getX() > 588 && getY() > 580)
walkTo(588, 598);
else if(getY() > 578)
walkTo(590,578);
else if(getY() > 574)
walkTo(581,574);
}
}
else
{
//enoug food we go war
//581, 574, 590, 578, 588, 598, 600, 595, 603, 582, 609, 565, 617, 558
if(getX()< 600)
{
//if(getY() < 574)
// walkTo(581,574);
if(getY() < 578)
walkTo(590,578);
else if(getY() < 598)
walkTo(588, 598);
//else if(getY() < 602)
//walkTo(597,602);
else
walkTo(602,594);
}
else
{
if(getY() > 594)
walkTo(602, 594);
else if(getY() > 582)
walkTo(603, 582);
else if(getY() > 565)
walkTo(609, 565);
else if(getY() > 558)
walkTo(617, 558);
}
}
return 1000;
}
public final void BuryBigBone()
{
int boneIndex = getInventoryIndex(413);
print("Bury Bones at position : " + boneIndex);
useItem(boneIndex);
}
public int TryBury()
{
if(BuryOrNot == 0)
{
if(getInventoryCount(413)>0)
{
if(inCombat())
{
RunFromCombat();
return random(100,200);
}
BuryBigBone();
return random(200,300);
}
int[] bigBone = getItemById(413);
if(bigBone[0] != -1)
{
int distanceX = bigBone[1] - getX();
int distanceY = bigBone[2] - getY();
int maxDistanceFromBones = 3;
if(getInventoryCount() < 30 && (distanceX < maxDistanceFromBones && distanceX > -maxDistanceFromBones) && (distanceY < maxDistanceFromBones && distanceY > -maxDistanceFromBones))
{
if(inCombat())
{
RunFromCombat();
return random(100,200);
}
pickupItem(bigBone[0], bigBone[1], bigBone[2]);
return 500;
}
}
}
return -1;
}
@Override
public void onServerMessage(String s) {
if (s.contains("standing here for 5 mins!")) {
needToMoveFromX = getX();
needToMoveFromY = getY();
needToMove = true;
}
}
private void changePosition()
{
int pid = getSelfPid();
if(pid > 20)
{
print("bad pid, we can relog");
needToMove = false;
}
if(getX() != needToMoveFromX || getY() != needToMoveFromY)
needToMove = false;
else
walkTo(needToMoveFromX + random(0,2) - 1, needToMoveFromY + random(0,2) - 1);
}
public void RunFromCombat()
{
int x = getX();
int y = getY();
walkTo(x,y);
}
public void RunNorthOrAttackNorth()
{
int[] npcs = getNpcInRadius(312,getX(),getY()-1,0);//,525,706);
if(npcs[0] != -1)
attackNpc(npcs[0]);
else
{
if(getObjectIdFromCoords(getX(),getY()-1) == -1)
walkTo(617,getY()-1);
else
walkTo(618,getY()-1);
}
}
int needToMoveFromX = -1;
int needToMoveFromY = -1;
boolean needToMove = false;
}