Jump to content

OsPlay

Members
  • Posts

    19
  • Joined

  • Last visited

  • Feedback

    100%

Everything posted by OsPlay

  1. Thanks my friend! i change to Banks, also added for spawn net fish!
  2. Hi, i'm new scripting so don't try this at home, probably have bugs, so let me know or there's something that i can add! DOWNLOAD JAR SOURCECODE
  3. Thx i didn't know, added!!! (i just put the code files because idk if it worth for a project...), also i have a little fishing script, probably i will publish also! (what do you recommend to start as a little project to adquire some skills??)
  4. Hi, i was developing an "small and ugly" script, probably will have some broken things (is in alpha, but not more in progress)* Anyway, requires: Telegrab, Nature Rune, Air rune or Equip. Jar file: https://mega.nz/file/UJQ0yQYA#WV7QRnciYHCVvkBL3dCtwcCkHu_XliwnOpIkMghYAgQ https://www.virustotal.com/gui/file/fe290d097483b3f33a3a69cac3688cb37a9d487978f1775f8c694b748d62d7fd/detection Source code: https://gist.github.com/Osplay/8fdfb8b95e0a3b208dd5eb07dff6c557 https://mega.nz/file/EVg11BhB#U5xLKkqF3s8nuRUnnLq4h548vDfjo3uwFS1GvPFzfmo https://www.virustotal.com/gui/file/dca9fc1a81e666c8b93dac44c2b4ed346209d5b62eb0cce8f23ee14be3d4d2a5/detection ** I'm not a programmer, so just chill out.
  5. This is an opinion: As far i know no matters what, injection/reflection both are detected, so even if the script have a human pattern (or try to emulate) is worthless as anti-ban, when the AI catch high probability of botting, and check for native client and if isn't... Just get the ban. What does is increase the time of be detected or worst reduce it, NOTHING ELSE. Look, for them are also a business they can't ban just because most of the people use Runelite or Osbuddy. Even for an AI it can't say look you're a bot, because most of the time players look like a bot, plus also are ok use mouse keymap. (Look AI have trouble to tag if a cat is a cocodrilo and requires of billion of training data for that) So the only "thing" that can do is take probability of: Time -> 24hs... no one human does... Pattern of activity -> If you do always move the camera between 2-3 mins for no reason ¿really? or just go banking with an sleep of 10-20 seconds when inventory is full... rlly? most of the time i go afk and forgot to click... Always doing 1 click, for item, not ever a mistake... And also, broken script, access to the bank 100 times and not getting nothing. Client -> you're runing a custom version of software? ok you'll have more chances to get a ban. Ip -> 200 players active from the same ip, look it can be a proxy, a cybercafe or just a bot farm. Cache -> idk, maybe are some stuff there (i don't have exp with that). Using WinApi is another story but also be flagged, at the end of the day the only way is creating your customs windows drivers, that is hard to detect because you need High level on windows to detect. (and your business go trash if you're installing Kernel Level Software XD)
  6. Yep, that was my question/supposition. Thx for anwser! Sry, my english is not strong enought to understand what do you want to say me... I'm not sure, i just tought that if it happens with interact, it will be all implemented that way, so i just jump to the decompiler, i saw how is executed interact() and try go arround with getEventExecutioner(), i didn't read the api (sry i know, i had to, shame on me), so probably it was a better way to handle, and it was, thx! Yep, that is because i removed from the actual code: (human player will not wait until item is dropped for continue) while(getInventory().getItemInSlot(slotNumberOfTheInventory) != null){ waitReflex(1); } but if you add will go: [0][1][2][3][4] and break, instead of [0][1][2][3][7], the ItemContainer on [7], is not null because is in the inventory. (most of the time) and if the fish in the row nº 7 is different: this does 1 more because [7] == null, but [6] != null. Is picking the first Item of the inventory, is not a bug is implemented that way.
  7. @Nbacon yes!!! using both do "snake" pattern with drop! this is using ItemCollection hover from: Item fish = getInventory().getItemInSlot(slotNumberOfTheInventory); or using:
  8. Hi, i have a question, i want to drop the items from the inventory avoiding the api path, so i try to make a snake drop path... Any way, when i try to drop the item from the nº 7 slot, and execute interact, drops me the nº 4. Is a joke that i'm too peasant to understand?? It's seems like fish (Item var) is linked with nº 7 item, but fish.interact() just jump to 4 and click it. logs print -> 7 (wich is on a loop until item goes null) ** also i tried getting all the items of the invetory and passing directly nº of the item, but do the same path instead of grabbing item from the getInventory().getItemInSlot(). private void dropFishFromTheInventory(int slotNumberOfTheInventory) throws InterruptedException { log(slotNumberOfTheInventory); Item fish = getInventory().getItemInSlot(slotNumberOfTheInventory); if(fish == null) return; if(getSettings().isShiftDropActive()) getKeyboard().pressKey(16); for (String fishName : SUPPORTED_FISHES) { if(fish.getName().contains(fishName)){ if (getSettings().isShiftDropActive()) { fish.interact(); } else{ fish.interact("drop"); } while(getInventory().getItemInSlot(slotNumberOfTheInventory) != null){ waitReflex(1); } if(getSettings().isShiftDropActive()) getKeyboard().releaseKey(16); return; } } } I'm not sure what i'm doing but i bypassed using: InventorySlotDestination destination = new InventorySlotDestination(getBot(), slotNumberOfTheInventory); getBot().getEventExecutor().execute(new InteractionEvent(destination, "drop")).hasFinished(); As i'm too noob, I'm not sure if is a bug with Item.Interact(); or is just me xD.
  9. Yep, as far i know: WebWalkEvent & DoorHandler
  10. I'm not an expert, i didn't test it, but i supouse that i'll do like: public void attackStyle() throws InterruptedException { if (getSkills().getDynamic(Skill.MAGIC) >= 35) { // open the tab... getTabs().open(Tab.ATTACK); // wait until tab is open... new ConditionalSleep(5000){ @Override public boolean condition() throws InterruptedException { if(getWidgets().isVisible(593,28)) return true; return getTabs().isOpen(Tab.ATTACK); } }.sleep(); // failed to see widget? if(!getWidgets().isVisible(593,28)) return; // take the widget. RS2Widget spellChoise = getWidgets().get(593,28); // interact with the widget. spellChoise.interact("Choose spell"); // sleep until can see the widget. new ConditionalSleep(5000){ @Override public boolean condition() throws InterruptedException { return getWidgets().isVisible(201,1,8); } }.sleep(); // failed to see widget? if(!getWidgets().isVisible(201,1,8)) return; // take the widget. RS2Widget fireBolt = getWidgets().get(201,1,8); if (fireBolt != null) { log("Selecting fire bolt"); fireBolt.interact("Fire Bolt"); } }
  11. I had the same problem... In my case i put the webwalk in a while where generate close path (20 tiles) ahead, but set X to avoid the other side of the wilderness, then i catch when is on the fishing spot...
  12. Sure, he use bots a lot, that is his channel about Xd, also says that use OsBot as client plus Runelite, Well, even if he lies and does, the next episode will see (?) Xd, but even then, is just more info that you can get, because if he botted and got 44% survival accounts are good news! but if he's not bluffing, then jagex flag system is crap, wich i absolute agree (opinion), most afk-low intensive click things have much lower ban ratio, you can reach 90+ lvl and not get a ban. Also mixing both is not a solution Xd plus suicide botting have longer life than short-break botting... or that is what they compare... (?)
  13. I was watching this guy , he manually do all the stuff, 0 botting aaaaaand, just ban him most of theire accounts, like 66%, bot ban system is a joke. Xd
  14. I recently started to script, so probably is broken... but maybe is useful: Food is not in it, because is easy just have to map which you gonna use... import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.model.GroundItem; import org.osbot.rs07.api.ui.Spells; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import javax.swing.*; import java.util.ArrayList; import java.util.List; @ScriptManifest( name="Shitty Script", author = "OsPlay", version = 0.0, logo = "", info = "Spaghetti code!") public class Telegrab extends Script { public boolean EXIT = false; public Area AREA_TO_EXIT = new Area(1,1,1,1); public Area AREA_2_TO_EXIT = new Area(1,1,1,1); public List<Integer> LIST_OF_WORLDS = new ArrayList<>(); @Override public void onStart() throws InterruptedException { String list = JOptionPane.showInputDialog("WORLD TO HOP: AK 509,510,511..."); for (String world : list.split(",")) { LIST_OF_WORLDS.add(Integer.parseInt(world)); } } @Override public int onLoop() throws InterruptedException { exitOrChange(); // check if the player is logged ? if(!client.isLoggedIn() && !myPlayer().isOnScreen() && !myPlayer().isVisible()) return 1000; // cast the spell and grab tryToTeleGrab(); goOutSide(); // check if this work, maybe won't D; exitOrChange(); return 0; } private void exitOrChange() throws InterruptedException { if(EXIT || getInventory().isFull()){ while (getLogoutTab().logOut() == false){ sleep(100); } onExit(); } else { // you can add banking? switchWorld(); } } private void switchWorld() throws InterruptedException { if(LIST_OF_WORLDS.size() == 0) { EXIT = true; exitOrChange(); } int worldId = LIST_OF_WORLDS.get(0); LIST_OF_WORLDS.remove(0); getWorlds(); sleep(random(500,2000)); getWorlds().hop(worldId); } private boolean tryToTeleGrab() throws InterruptedException { boolean NO_MORE_RUNES = false; // logic error, do it only if you're not under attack and you have space to grab or runes to cast the spell. while (!myPlayer().isUnderAttack() && !NO_MORE_RUNES){ // check items and inventory to spell cast if(!checkItems()) NO_MORE_RUNES = true; if(!tryToGetTheRune()) return false; } return true; } private boolean tryToGetTheRune() throws InterruptedException { GroundItem natureRune = getGroundItems().closest("Nature rune"); if(natureRune == null) return false; //open magic! getMagic(); sleep(random(500,1000)); // Can't because lvl if(!getMagic().castSpell(Spells.NormalSpells.TELEKINETIC_GRAB)) return false; sleep(random(500,1000)); //cast magic if(!natureRune.interact("Cast")) return false; return true; } private void goOutSide() throws InterruptedException { // is not the best implementation of walking... while (!AREA_TO_EXIT.contains(myPosition().getX(), myPosition().getY())){ getWalking().webWalk(AREA_TO_EXIT); sleep(random(500,1000)); } while (!AREA_2_TO_EXIT.contains(myPosition().getX(), myPosition().getY())){ getWalking().webWalk(AREA_2_TO_EXIT); sleep(random(500,1000)); // I'm not sure how you wanna implement the teleport (cast spell?) } } private boolean checkItems() { // you have space in the inventory. if(getInventory().isFull()) return false; // check for law rune. if(getInventory().getAmount("Law rune") < 1) return false; // check for air rune. if(getInventory().getAmount("Air rune") < 1) return false; return true; } } i wrote in 1h and doing other stuff so, yeah broken as hell, even i don't know if there's the proper way to do it, due my lack of knowledge in the API. also you must add if the player is under attack or not when you walk, because will walk anyway to the 2nd place (wich you have to map) but you can play and test (wich is funny and probably get a ban XDD)
  15. That say every time... If you don't get a good answer, let pass 1-2 weeks, and reply with another email adress Xd. Anyway, i was talking about the first time with your main. Also splashing do not like to Jagex, remember they ban Lumbridge splashing... from ban to ban how much time past? you use a shared proxy ip? or flagged ip? or deleted cache?
  16. I'm newbie using Osbot, but not AHK or other stuff, and one thing i can say is: Patterns bans works ony for non-pattern activity, i'm level +80 smithing rs3 with custom made injection WINAPI and never get ban, even with +16hs running, same pixel, same position, same time. (yeah sounds crazy) only with breaks for sell [manually]. also +80 magic,+70 fletching,+ in osrs. I create a new account, use manually for 6 days (except for learning and testing scripts), started botting woodcutting up to +30 (day 7), runecrafting +32 (day and i level up MANUALLY lvl +49 cooking and the day 9 couldn't do nothing because i get ban. now i'm botting other account for now i try afk methods with random things like missclick, camera, afk, etc... (4 day of botting) +40 fishing +30 attack,defense,strenght What i think (hypothesis): 1) Repetitive task that can be done with mapping keybord , are not be monitored until certain level (wich i think +80 is ok). [too much data to process, even for a AI, false positive] 2) Repetitive task that are not keyboard possibility and create pattern will be flag by a monitor. [for my test 2 days] 3) Broken script that interact with exchange or banking, droping items, etc are monitored. [i try to open the bank but i get a bug in the script, even if i was manually (long talks and random as human included) level up cooking, if someone check my logs i will se that the last thing was human interaction, and exception for open and close to fast several time and do the same action ] 4) Patterns logs are deleted or not reviewed with X time of activity without monitor flag. [ther's no way that i can't be detected, the only thing is that i do by weeks in middle] 5) Monitor IA can ban if your account is up X% probability of botting... (they probably are using that time to track money transfers,etc..) Probably your 2nd account was flagged, then they saw trading and "suspicius activity" then take the 1st account... So, if i'm wrong and they keep the logs, then they will not unban you... try to claim.
  17. Yeah, hahahaha. Oh, thx, i work more with classes, but i didn't know how to extend from script without carring onLoop in a new classes, so i thought on hurt performance if i call multiples onLoop in diferent instances... Thx for the tip, yep on youtube call to client class...when i go in to the code and typ... wait what?? ... so i started to play with functions and then i come with that ugly non functional script hahaha. Oh, i create first all java stuff just for test (enum, class, etc) and check differences with .NET where i have a lot of stuff like structs,interfaces also cheap ways to go arround like out and goto, also i was worried because threads are a pain if you don't manage correctly. The funny thing was when i start to write the script, was like: "Shiiiiit", most of the time i have to battle with Cheat Engine and opcode , but here is so easy to manage things, that mean a lot of work for the developers! WOW AWSOME!! i'm reading it right now, you just anwser my question . thx for the feedbacks, i create a new script, now can chop and change axe and locations public class Main extends Script { public String AXE_REQUIRED = null; public String AXE_EQUIPPED = null; public Area AREA_TO_CHOP = null; public Area AREA_TO_BANK = null; public final int MAX_FLAG = 3; public String TREE_TO_CHOP = null; @Override public int onLoop() throws InterruptedException { _Check_Required_For_Set(); // AFK sleep(random(1000,2000)); if(_Check_Axe_What_Axe_Is_Equipped()){ log("Your axe is not equipped!"); return 0; } if(getInventory().isFull()){ if(!_Execute_Go_To_Area(AREA_TO_BANK)) return 0; if(!_Execute_Action(ACTION_TYPE.BANK)) return 0; if(!_Check_Axe_Is_Optimal()){ log("Your axe is not optimal for you level, choose: " + AXE_REQUIRED); if(_Execute_Get_Bank_Axe()){ _Execute_Set_Optimal_Axe(); } } } if(!_Execute_Go_To_Area(AREA_TO_CHOP)) return 0; if(!_Execute_Action(ACTION_TYPE.CHOP)) return 0; // player is chopping! while (myPlayer().isAnimating() || myPlayer().isMoving()){ sleep(random(2000,4000)); } return 0; } private void _Check_Required_For_Set(){ int skill_level_woodcutting = getSkills().getDynamic(Skill.WOODCUTTING); int skill_level_attack = getSkills().getDynamic(Skill.ATTACK); AXE_REQUIRED = OBJECTS.BRONZE_AXE; AREA_TO_CHOP = AREAS.TREE_EXCHANGE; AREA_TO_BANK = AREAS.EXCHANGE_BOTTOM; TREE_TO_CHOP = OBJECTS.TREE; if(skill_level_woodcutting < 11) { AXE_REQUIRED = OBJECTS.BRONZE_AXE; AREA_TO_CHOP = AREAS.TREE_EXCHANGE; AREA_TO_BANK = AREAS.EXCHANGE_BOTTOM; return; } if(skill_level_woodcutting > 14){ TREE_TO_CHOP = OBJECTS.OAK; AREA_TO_CHOP = AREAS.OAK_EXCHANGE; AREA_TO_BANK = AREAS.EXCHANGE_LEFT; } if(skill_level_woodcutting < 21 && skill_level_attack > 9) { AXE_REQUIRED = OBJECTS.BLACK_AXE; AREA_TO_CHOP = AREAS.OAK_EXCHANGE; AREA_TO_BANK = AREAS.EXCHANGE_LEFT; return; } if(skill_level_woodcutting < 31 && skill_level_attack > 20) { AXE_REQUIRED = OBJECTS.MITHRIL_AXE; return; } if(skill_level_woodcutting > 29 && AXE_EQUIPPED == OBJECTS.MITHRIL_AXE){ TREE_TO_CHOP = OBJECTS.WILLOW; AREA_TO_CHOP = AREAS.WILLOW_DRAYNOR; AREA_TO_BANK = AREAS.BANK_DRAYNOR; } if(skill_level_woodcutting < 41 && skill_level_attack > 30){ AXE_REQUIRED = OBJECTS.ADAMANT_AXE; return; } if(skill_level_attack > 40){ AXE_REQUIRED = OBJECTS.RUNE_AXE; } } private boolean _Check_Axe_What_Axe_Is_Equipped(){ Item axe = getEquipment().getItem(OBJECTS.AXE); if(axe == null) return false; String axe_name = axe.getName(); if(axe_name == null) return false; // for some reason switch requires that static to object but i like annotation if(axe_name == OBJECTS.BRONZE_AXE){ AXE_EQUIPPED = OBJECTS.BRONZE_AXE; return true; } if(axe_name == OBJECTS.BLACK_AXE){ AXE_EQUIPPED = OBJECTS.BLACK_AXE; return true; } if(axe_name == OBJECTS.MITHRIL_AXE){ AXE_EQUIPPED = OBJECTS.MITHRIL_AXE; return true; } if(axe_name == OBJECTS.ADAMANT_AXE){ AXE_EQUIPPED = OBJECTS.ADAMANT_AXE; return true; } if(axe_name == OBJECTS.RUNE_AXE){ AXE_EQUIPPED = OBJECTS.RUNE_AXE; return true; } AXE_EQUIPPED = null; return false; } private boolean _Check_Axe_Is_Optimal(){ if(AXE_REQUIRED == AXE_EQUIPPED) return true; return false; } private boolean _Execute_Go_To_Area(Area area_to_go){ int flag = 0; while (flag != MAX_FLAG){ if(!area_to_go.contains(0,myPlayer().getY())){ getWalking().webWalk(area_to_go); if(area_to_go.contains(myPosition().getX(),myPlayer().getY())){ return true; } } flag++; } return false; } private boolean _Execute_Action(ACTION_TYPE action) throws InterruptedException { int flag = 0; while (myPlayer().isMoving() || myPlayer().isAnimating()){ if(flag == MAX_FLAG){ log("Fail: Player is not static when is close to the object."); return false; } sleep(random(1000,3000)); flag++; } Entity object = null; if(ACTION_TYPE.CHOP == action){ object = getObjects().closest(TREE_TO_CHOP); } else { object = getNpcs().closest(OBJECTS.BANKER); } if(object == null) return false; flag = 0; while (!object.isVisible()){ if(flag == MAX_FLAG) { log("Fail: Camera can't reach to the object!"); return false; } getCamera().toEntity(object); sleep(random(2000,4000)); flag++; } String interaction = null; if(action == ACTION_TYPE.CHOP){ interaction = INTERACTIONS.CHOP; } else { interaction = INTERACTIONS.BANK; } if(!object.interact(interaction)){ log("Fail: couldn't interact with the object!"); return false; } sleep(random(2000,4000)); if(action == ACTION_TYPE.BANK) { flag = 0; while (!bank.isOpen()) { if (flag == MAX_FLAG) { log("Fail: couldn't open the object!"); return false; } sleep(random(2000, 4000)); } bank.depositAll(); if (getInventory().isFull()) { log("For someone reason, couldn't save the items!"); return false; } } return true; } private boolean _Execute_Get_Bank_Axe(){ if(!bank.isOpen()){ log("Fail: Bank is not open!"); } return bank.withdraw(AXE_REQUIRED,1); } private boolean _Execute_Set_Optimal_Axe() throws InterruptedException { if(bank.isOpen()){ bank.close(); } if(!getEquipment().equip(EquipmentSlot.WEAPON, AXE_REQUIRED)){ log("Fail: you can't equip an axe!"); return false; } if(_Execute_Action(ACTION_TYPE.BANK)){ log("Fail: couldn't bank the axe!"); return false; } return true; } enum ACTION_TYPE { CHOP, BANK; } } class AREAS{ public static Area EXCHANGE_BOTTOM = new Area(3160,3479,3168,3487); public static Area TREE_EXCHANGE = new Area(3149,3450,3171,3462); public static Area OAK_EXCHANGE = new Area(3189,3464, 3200,3456); public static Area EXCHANGE_LEFT = new Area(3170,3487,3167,3491); public static Area BANK_DRAYNOR = new Area(3092,3240,3095,3246); public static Area WILLOW_DRAYNOR = new Area(3087,3223,3089,3237); } class INTERACTIONS { public static String BANK = "Bank"; public static String CHOP = "Chop down"; } class OBJECTS{ public static String TREE = "Tree"; public static String OAK = "Oak"; public static String WILLOW = "Willow"; public static String BANKER = "Banker"; public static String AXE = " axe"; public static String BRONZE_AXE = "Bronze axe"; public static String BLACK_AXE = "Black axe"; public static String MITHRIL_AXE = "Mithril axe"; public static String ADAMANT_AXE = "Adamant axe"; public static String RUNE_AXE = "Rune axe"; } for some reason java force me to put as static the list of objects and then i lose the syntax, sorry @Naked you will require another round of chemo, because i don't use switch Thx for the support, great community also! PD: english is not my mother language, sorry x2!
  18. Hi, i started yesterday to write in Java (i'm not a programmer and is not my language), i watch the tutorial on youtube about woodcutting, and try to do something similar... but most of his code is deprecated, but the idea is the same, if someone has tip or tutorial wich think that is important, a hand will be great! Anyway, i didn't use inside the loop (wich i think will hurt performance), also managed the code from onStart with a while... I will play a little bit with it, just cutt for now basic trees at the exchange market... i have to learn about equipament and exchange (for buy axes and equip, etc..), also i have to pass text to vars. i know maybe already someone ask or even i will try, but when i use: getWalking().webWalk(//area to go); i can travel for long distances?? package com.osplay.script; import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.model.Entity; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; @ScriptManifest(name = "MyFirstChopBot", author = "OsPlay", version = 0.0, info = "My First Ugly Script, only Works up to lvl 15 of wood and for F2P!", logo = "") public class Main extends Script { @Override public void onStart() throws InterruptedException { super.onStart(); /* BRAIN OF THE SCRIPT * * 00 - SET STATUS TASK * 01 - LOOP * 02 - GO TO CHOP * 03 - GO TO BANK * 04 - HANDLE ERRORS * * */ STATUS_TASK = STATUS_TASK_TYPE.IDLE; ERROR_STATUS status_of_the_task = ERROR_STATUS.ALL_OK; log("Bot Executed - By OsBay the N00b D:"); while(true){ if(TASK_ENDED) return; // SECURITY LOOP ! sleep(random(1000,3000)); _Execute_Print_Debug(status_of_the_task); if(STATUS_TASK == STATUS_TASK_TYPE.IDLE){ log("Bot is idle, will reached next step!"); if (getInventory().isFull()) { log("Executing Banking -/-"); status_of_the_task = _Execute_Go_Banking(); } else { log("Executing cutting -/-"); status_of_the_task = _Execute_Cutting_Trees(); } continue; } if(STATUS_TASK == STATUS_TASK_TYPE.CUTTING_REQUIRED || STATUS_TASK == STATUS_TASK_TYPE.CUTTING){ log("Executing cutting -/-"); status_of_the_task = _Execute_Cutting_Trees(); continue; } if(STATUS_TASK == STATUS_TASK_TYPE.BANKING_REQUIRED || STATUS_TASK == STATUS_TASK_TYPE.BANKING){ log("Executing Banking -/-"); status_of_the_task = _Execute_Go_Banking(); continue; } } } @Override public void onExit() throws InterruptedException { super.onExit(); TASK_ENDED = true; } @Override public int onLoop() throws InterruptedException { return 0; } // -- HERE GOES ALL VARS -- public boolean TASK_ENDED = false; public enum STATUS_TASK_TYPE { IDLE, IDLE_REQUIRED, CUTTING, CUTTING_REQUIRED, BANKING, BANKING_REQUIRED } public enum ERROR_STATUS { ALL_OK, FAIL_ALREADY_CHOPPING, FAIL_INVENTORY_FULL, FAIL_OBJECT_TREE_NOT_FIND, FAIL_PLAYER_IS_IN_ANIMATION, FAIL_PLAYER_IS_MOVING, FAIL_REQUIRED_ACTION, FAIL_CANT_GET_BANKER_NPC, FAIL_BANK_IS_NOT_OPEN, FAIL_INVENTORY_COULDNT_BANK, FAIL_UNKNOWN_WHY_SHAME_ON_ME; } public static STATUS_TASK_TYPE STATUS_TASK; public enum OBJECTS_NAMES{ TREE("Tree"), OAK("Oak"), WILLOW("Willow"), MAPLE("Maple"), YEW("Yew"); OBJECTS_NAMES(String empty) { } } /* AREAS ARE DEFINED INSIDE THE RESPECTIVE TASK */ // -- HERE ENDS ALL VARS -- // -- HERE GOES ALL FUNC -- private ERROR_STATUS _Execute_Cutting_Trees() throws InterruptedException { Area area_to_chop_tree = new Area(3149,3450,3171,3462); /* A00 - The player is idle so or requires to chop -> A01 - check if is need to bank A02 - check if is in the place of the exchange area A03 - search for a tree in x place A04 - chop the tree B00 - The player is already chopping -> B01 - check if need to bank B02 - verify is chopping B03 - sleep and until 01 required. */ // A00 if(STATUS_TASK == STATUS_TASK_TYPE.IDLE || STATUS_TASK == STATUS_TASK_TYPE.CUTTING_REQUIRED){ // ask to banking A01 if(getInventory().isFull()){ STATUS_TASK = STATUS_TASK_TYPE.BANKING_REQUIRED; return ERROR_STATUS.FAIL_REQUIRED_ACTION; } // go to the place A02 if(!area_to_chop_tree.contains(0, myPosition().getY())){ // go to the place! getWalking().webWalk(area_to_chop_tree); } Entity tree_to_chop = getObjects().closest(OBJECTS_NAMES.TREE.toString()); if(tree_to_chop == null) return ERROR_STATUS.FAIL_OBJECT_TREE_NOT_FIND; // we enter to a loop where gonna check A03 and A04 if(myPlayer().isMoving()){ sleep(random(2000,5000)); } if(!tree_to_chop.isVisible()){ getCamera().toEntity(tree_to_chop); sleep(random(2000,4000)); } tree_to_chop.interact("Chop down"); sleep(random(2000,4000)); STATUS_TASK = STATUS_TASK_TYPE.CUTTING; } // B00 if(STATUS_TASK == STATUS_TASK_TYPE.CUTTING){ boolean flag_check_if_is_afk = false; while (true){ // check if needs bank B01 if(getInventory().isFull()){ STATUS_TASK = STATUS_TASK_TYPE.BANKING_REQUIRED; return ERROR_STATUS.FAIL_REQUIRED_ACTION; } // for some reason is not cutting, first flag! B02 if(!myPlayer().isAnimating()) { flag_check_if_is_afk = true; } // 2nd time of flag, we must go to another if(flag_check_if_is_afk && !myPlayer().isAnimating()){ STATUS_TASK = STATUS_TASK_TYPE.CUTTING_REQUIRED; return ERROR_STATUS.ALL_OK; } sleep(random(2000,5000)); //B03 } } return ERROR_STATUS.FAIL_UNKNOWN_WHY_SHAME_ON_ME; } private ERROR_STATUS _Execute_Go_Banking() throws InterruptedException { Area area_banking_exchange_bottom = new Area(3160,3479,3168,3487); /* A00 - We gonna to the bank near the exchange! A01 - We check if are in the place A02 - if not We go to the place B00 - We gonna execute the banking B01 - We talk with them B02 - We bank all B03 - Check, and ask to go cutting! B04 - Set To Chop! */ // A00 WE GONNA TO THE BANK if(STATUS_TASK == STATUS_TASK_TYPE.BANKING_REQUIRED || STATUS_TASK == STATUS_TASK_TYPE.IDLE){ if(!getInventory().isFull()){ STATUS_TASK = STATUS_TASK_TYPE.CUTTING_REQUIRED; return ERROR_STATUS.FAIL_INVENTORY_COULDNT_BANK; } // A01 0 is because are shared X but not Y if(!area_banking_exchange_bottom.contains(0,myPosition().getY())){ // A02 getWalking().webWalk(area_banking_exchange_bottom); } if(area_banking_exchange_bottom.contains(myPosition().getX(), myPosition().getY())){ STATUS_TASK = STATUS_TASK_TYPE.BANKING; } } // B00 WE MUST START BANKING if(STATUS_TASK == STATUS_TASK_TYPE.BANKING){ if(myPlayer().isMoving() || myPlayer().isAnimating()){ // wait, he don't have to move! while (true){ if(myPlayer().isMoving() || myPlayer().isAnimating()){ sleep(random(2000,5000)); } else { break; } } } NPC banker_npc_to_talk = getNpcs().closest("Banker"); // B01 banker is not reachable? if(banker_npc_to_talk == null) return ERROR_STATUS.FAIL_CANT_GET_BANKER_NPC; banker_npc_to_talk.interact("Bank"); sleep(random(3000,6000)); if(!bank.isOpen()) return ERROR_STATUS.FAIL_BANK_IS_NOT_OPEN; // B02 bank.depositAll(); // B03 if(getInventory().isFull()) return ERROR_STATUS.FAIL_INVENTORY_COULDNT_BANK; //B04 STATUS_TASK = STATUS_TASK_TYPE.CUTTING_REQUIRED; } return ERROR_STATUS.ALL_OK; } private void _Execute_Print_Debug(ERROR_STATUS status_to_print){ switch (status_to_print){ case ALL_OK: log("Task Completed!"); break; case FAIL_ALREADY_CHOPPING: log("Fail: bot is already Chopping a tree?"); break; case FAIL_INVENTORY_FULL: log("Inventory is full!"); break; case FAIL_OBJECT_TREE_NOT_FIND: log("Fail: couldn't find the tree!"); break; case FAIL_PLAYER_IS_IN_ANIMATION: log("Fail: player is in busy with an animation."); break; case FAIL_PLAYER_IS_MOVING: log("Fail: Player is moving to a location."); break; case FAIL_REQUIRED_ACTION: log("Fail: Player couldn't do that action."); break; case FAIL_CANT_GET_BANKER_NPC: log("Fail: Player couldn't go to the Banker NPC."); break; case FAIL_BANK_IS_NOT_OPEN: log("Fail: Bank is not opened!"); break; case FAIL_INVENTORY_COULDNT_BANK: log("Fail: Player couldn't bank!"); break; case FAIL_UNKNOWN_WHY_SHAME_ON_ME: log("Fail: Bot Error reached!"); break; default: log("Error to print error ? LMAO"); break; } } // -- HERE ENDS ALL FUNC -- } Good job with this bot, is easy to understand and work, even for a n00b like me xD
×
×
  • Create New...