Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
- /*
- ***********YES I KNOW THIS CODE IS MESSY AS HELL!!!!....
- ***********I couldn't be bothered making it look fancy... it works well enough as it is...
- ***********It was only a project I decided to undertake for Arlo....
- ***********Decided to release because I can... If you don't like it... Dont use it...
- */
- import java.awt.Color;
- import java.awt.Graphics;
- import java.util.Map;
- import org.rsbot.event.events.ServerMessageEvent;
- import org.rsbot.event.listeners.*;
- import org.rsbot.script.*;
- import org.rsbot.script.wrappers.*;
- import org.rsbot.event.listeners.PaintListener;
- import java.awt.Point;
- @ScriptManifest(authors = { "Kriogenic" }, category = "Combat", name = "Cow Killer", version = 1.0, description = "<html><body bgcolor =\"#AAAAAAAA\"><font color =\"#3333FF\"><center><h2>Kriogenic Cow Killer</h2><BR>"
- + "<font size =\"3\">Start in cow paddock next to crafting guild<br />"
- + "Note: Start in bank or at cow pen with food visible in bank.</font><br />"
- + "Style: <select name=\"Style\"><option>Attack<option>Strength<option>Defence</select><br />"
- + "Eat?:<select name=\"iseat\"><option>True<option>False</select><br />"
- + "HP to Eat?:<input name=\"eatHP\" row=3><br />"
- + "Food:<select name=\"food\"><option>Meat<option>Shrimp<option>Chicken<option>Anchovies"
- + "<option>Herring<option>Trout<option>Tuna<option>Lobster<option>Swordfish<option>Shark<option></select></font></body></html>")
- public class kriocowkill extends Script implements PaintListener, ServerMessageListener{
- final ScriptManifest properties = getClass().getAnnotation(ScriptManifest.class);
- int runEnergy = random(50, 80);
- public int Booth = 11758;
- private int MonsterID[] = {397,81,2310,1767};
- public int isatkin = 0;
- public boolean toeat = false;
- public int failsafe = 0;
- public int gottenxp = 0;
- public int MonstersKilled = 0;
- private String cmbtraining = "";
- public long startTime = System.currentTimeMillis();
- public int OpenDoor = 336;
- public int ClosedDoor = 336;
- public int loopwait = 400;
- public RSNPC foundmonster = null;
- public RSNPC freemonster;
- private long scriptStartTime = 0;
- private int CurrentXP = 0;
- private int StartXP = 0;
- long runTime = 0;
- long seconds = 0;
- long minutes = 0;
- long hours = 0;
- private String status = "";
- private int eatHP;
- private int HP;
- private int loopi = 0;
- private int FoodID;
- //String OreID;
- //String State;
- //int StartingExp;
- int GainedExp = 0;
- public int fightmodeset;
- public boolean onStart(Map<String, String> args) {
- scriptStartTime = System.currentTimeMillis();
- status = "Starting Up...";
- if (args.get("Style").equals("Attack")) {
- fightmodeset = 0;
- }
- if (args.get("Style").equals("Strength")) {
- fightmodeset = 1;
- }
- if (args.get("Style").equals("Defence")) {
- fightmodeset = 3;
- }
- if (args.get("iseat").equals("True")) {
- toeat = true;
- }
- if(toeat == true){
- eatHP = Integer.parseInt(args.get("eatHP"));
- FoodID = getNametoID(args.get("food"));
- }
- cmbtraining = args.get("Style");
- return true;
- }
- public void onFinish() {
- return;
- }
- public void AttackMonster(){
- status = "Attacking...";
- if(isatkin == 0){
- failsafe = 0;
- try{
- if(atNPC(foundmonster, "ttack")){
- isatkin = 1;
- wait(random(500,800));
- }else{
- foundmonster = null;
- return;
- }
- }catch(final Exception e){
- e.printStackTrace();
- foundmonster = null;
- }
- }
- return;
- }
- public void antiban(){
- int randnum = random(0,999);
- int[] crotate = {10, 130, 530, 200, 470, 600, 720, 850, 905, 999};
- int li;
- for(li=0;li < crotate.length;li++){
- if(randnum == crotate[li]){
- setCameraRotation(random(0, 359));
- }
- }
- if (energyCheck()) {
- setRun(true);
- wait(random(750,1000));
- }
- return;
- }
- private boolean energyCheck() {
- try {
- if (gEnergy() >= runEnergy && !isRunning()) {
- runEnergy = random(35, 65);
- return true;
- } else {
- return false;
- }
- } catch (Exception e) {
- return false;
- }
- }
- private int gEnergy() {
- return Integer.parseInt(RSInterface.getChildInterface(750, 5).getText());
- }
- public boolean inSquare(int maxX, int maxY, int minX, int minY) {
- int x = getMyPlayer().getLocation().getX();
- int y = getMyPlayer().getLocation().getY();
- if (x >= minX && x <= maxX && y >= minY && y <= maxY) {
- return true;
- }
- return false;
- }
- public boolean movetoMonster(){
- try{
- while(!tileOnScreen(foundmonster.getLocation())){
- status = "moving to monster";
- try{
- walkTo(foundmonster.getLocation());
- }catch(final Exception e){
- e.printStackTrace();
- }
- while(getMyPlayer().isMoving()){
- if(distanceTo(foundmonster.getLocation()) <= 3){
- return true;
- }else{
- wait(300);
- }
- }
- while(!getMyPlayer().isMoving()){
- if(distanceTo(foundmonster.getLocation()) > 3){
- movetoMonster();
- }
- }
- freemonster = getNearestFreeNPCToAttackByID(MonsterID);
- if(freemonster != foundmonster){
- foundmonster = null;
- }
- return true;
- }
- }catch(final Exception e){
- e.printStackTrace();
- }
- return false;
- }
- public void failsafer(){
- if(isatkin == 1 && !getMyPlayer().isMoving() && !getMyPlayer().isInCombat()){
- failsafe++;
- }
- if(failsafe >= random(5, 8)){
- while(foundmonster.isInCombat()){
- wait(100);
- }
- foundmonster = null;
- failsafe = 0;
- }
- if(failsafe >= 14){
- foundmonster = null;
- failsafe = 0;
- }
- if(isatkin == 0 && foundmonster != null){
- foundmonster = null;
- failsafe = 0;
- }
- return;
- }
- public boolean findMonster(int monid[]){
- //log("Trying to find monster");
- //if(getMyPlayer().isMoving() || getMyPlayer().getAnimation() != -1 && getMyPlayer().isInCombat()) return false;
- foundmonster = getNearestFreeNPCToAttackByID(monid);
- if(foundmonster == null){
- walkTo(new RSTile(2924, 3280),3,3);
- // log("NO MONSTER!");
- return false;
- }
- if(!tileOnScreen(foundmonster.getLocation())){
- movetoMonster();
- //log("MOVING TO MONSTER");
- return true;
- }
- //log("ATTACK THE MONSTER!");
- return true;
- }
- ////////////////
- /////Loop//////
- //////////////
- private boolean eatfood(){
- if(getInventoryCount(FoodID) > 0){
- atInventoryItem(FoodID, "eat");
- return true;
- }else{
- return false;
- }
- }
- public void continueWalk(RSTile[] path) {
- if(!getMyPlayer().isMoving() && distanceTo(getDestination()) <= random(3, 6)) {
- walkPathMM(path, 1, 1);
- wait(random(100,500));
- }
- }
- public boolean ToGuild() {
- status = "Walking to Paddock...";
- try {
- while(distanceTo(new RSTile(2923, 3292)) > 1){
- if(distanceTo(getDestination()) < 3){
- walkTo(new RSTile(2923, 3292));
- }
- }
- return true;
- } catch (final Exception e) {
- e.printStackTrace();
- }
- return false;
- }
- public boolean ToBank() {
- status = "Walking to bank...";
- try {
- while(!inSquare(3018, 3358, 3009, 3355)){
- if(distanceTo(getDestination()) < 4){
- walkTo(new RSTile(3013, 3355));
- }
- }
- } catch (final Exception e) {
- e.printStackTrace();
- }
- return false;
- }
- public boolean needToBank(){
- if(getInventoryCount(FoodID) == 0){
- return true;
- }else{
- return false;
- }
- }
- public boolean handleBank() {
- RSObject bankBooth = getNearestObjectByID(Booth);
- if(bankBooth == null){
- return false;
- }
- if(bank == null)
- return false; //Can't find bank
- log("Can't find bank");
- if(bank.isOpen()){
- bank.depositAll();
- wait(random(300,600));
- bank.withdraw(FoodID, 0);
- }else{
- status = "Banking...";
- try{
- if (random(0,25) == 10) {
- setCameraRotation(random(0, 359));
- }
- atObject(bankBooth, "Use-quickly");
- }catch(final Exception e){
- e.printStackTrace();
- }
- }
- return true;
- }
- private void walkme(RSTile[] thearray){
- int al = thearray.length - 1;
- while(distanceTo(thearray[al]) > 4){
- log("MORE THEN 4 TILES FROM DEST");
- while(distanceTo(thearray[loopi]) > 3){
- log("MORE THEN 3 TILES FROM CURRENT");
- walkTo(thearray[loopi]);
- while(getMyPlayer().isMoving()){
- if(distanceTo(thearray[loopi]) < 3){
- break;
- }
- log("PLAY MOVE WAIT");
- wait(random(100,500));
- }
- }
- loopi++;
- log("" + loopi);
- }
- }
- @Override
- public int loop() {
- if(isLoggedIn() && gottenxp != 1){
- StartXP = skills.getCurrentSkillExp(Skills.getStatIndex(cmbtraining));
- gottenxp = 1;
- setCameraAltitude(true);
- setFightMode(fightmodeset);
- }
- antiban();
- while(HP <= eatHP && toeat == true){
- if(!eatfood()){
- while(getMyPlayer().getLocation().getX() != 2924 && getMyPlayer().getLocation().getY() != 3291){
- walkTo(getClosestTileOnMap(new RSTile(2924,3291)));
- }
- RSObject opendoor = getNearestObjectByID(1556);
- while(opendoor == null){
- opendoor = getNearestObjectByID(1556);
- atDoorTiles(new RSTile(2924, 3291), new RSTile(2924, 3292));
- }
- ToBank();
- }
- }
- if(inSquare(3018, 3358, 3009, 3355)){
- if(!needToBank()){
- ToGuild();
- wait(random(500,1300));
- RSObject theopen = getNearestObjectByID(1556);
- while(theopen == null){
- theopen = getNearestObjectByID(1556);
- try{
- atDoorTiles(new RSTile(2923, 3291), new RSTile(2923, 3292));
- }catch(final Exception e){
- e.printStackTrace();
- }
- }
- }else{
- handleBank();
- }
- }
- if(inSquare(3018, 3360, 3009, 3359)){
- if(needToBank()){
- walkTileMM(getClosestTileOnMap(new RSTile(3012, 3356)));
- }
- }
- if(foundmonster == null || foundmonster.getHPPercent() == 0){
- isatkin = 0;
- if(findMonster(MonsterID)){
- try{
- AttackMonster();
- }catch( final Exception e){
- e.printStackTrace();
- }
- //wait(random(500,800));
- //log("Monster" + foundmonster.isInCombat());
- }
- }
- failsafer();
- return(random(300,800));
- }
- @Override
- public void onRepaint(Graphics g) {
- //
- // int currentLVL = 0;
- int gainedXP = 0;
- int XPPerHour = 0;
- // int fightmode = getMyPlayer().getFightMode();
- //final double xpGain = 28;
- if (isLoggedIn()) {
- runTime = System.currentTimeMillis() - scriptStartTime;
- seconds = runTime / 1000;
- if ( seconds >= 60 ) {
- minutes = seconds / 60;
- seconds -= (minutes * 60);
- }
- if ( minutes >= 60 ) {
- hours = minutes / 60;
- minutes -= (hours * 60);
- }
- //currentLVL = skills.getCurrentSkillLevel(Skills
- // .getStatIndex("mining"));
- //nextLvl = skills.getXPToNextLevel(Skills.getStatIndex("mining"));
- HP = skills.getCurrentSkillLevel(Skills.getStatIndex("hitpoints"));
- CurrentXP = skills.getCurrentSkillExp(Skills.getStatIndex(cmbtraining));
- gainedXP = CurrentXP - StartXP;
- XPPerHour = (int) (.0 / runTime * gainedXP);
- g.setColor(new Color(0, 0, 0, 175));
- g.fillRoundRect(555, 210, 175, 250, 10, 10);
- g.setColor(Color.yellow);
- g.drawString("Kriogenic Killer!",557,222);
- g.drawString("Run Time: " + hours + "Hrs " + minutes + "Min " + seconds + "Sec", 560, 247);
- g.drawString("Status : " + status, 585, 262);
- // g.drawString("Ore Mined : " + RocksMined , 585, 277);
- // g.drawString("Current Level: " + currentLVL, 585, 292);
- g.drawString("XP Gained: " + gainedXP, 585, 317);
- // g.drawString("Training: " + fightmode, 585, 332);
- g.drawString("XP Per Hour: " + XPPerHour, 585 ,347);
- }
- //*/
- }
- @Override
- public void serverMessageRecieved(ServerMessageEvent arg0) {
- String serverString = arg0.getMessage();
- if (serverString.contains("Someone else")) {
- foundmonster = null;
- }
- if (serverString.contains("already under attack")) {
- wait(random(2000,3000));
- foundmonster = null;
- }
- if (serverString.contains("reach that")) {
- try{
- atDoorTiles(new RSTile(2923, 3291), new RSTile(2923, 3292));
- }catch(final Exception e){
- e.printStackTrace();
- }
- AttackMonster();
- }
- }
- }
Add Comment
Please, Sign In to add comment