Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package scripts.Cannon;
- import org.tribot.api.General;
- import org.tribot.api.Timing;
- import org.tribot.api.types.generic.Condition;
- import org.tribot.api2007.Inventory;
- import org.tribot.api2007.NPCChat;
- import org.tribot.api2007.Objects;
- import org.tribot.api2007.Player;
- import org.tribot.api2007.Skills;
- import org.tribot.api2007.Skills.SKILLS;
- import org.tribot.api2007.Walking;
- import org.tribot.api2007.WebWalking;
- import org.tribot.api2007.types.RSItem;
- import org.tribot.api2007.types.RSObject;
- public class Methods {
- public static boolean HaveCannonParts(){
- if(Inventory.find(6).length > 0 && Inventory.find(12).length > 0 && Inventory.find(8).length > 0 && Inventory.find(10).length > 0){
- return true;
- }else{
- return false;
- }
- }
- public static boolean randomPercent(int min, int max){
- return General.random(1, 100) <= General.random(min, max);
- }
- public static void Eat(){
- RSItem[] food = Inventory.find(Variables.FoodIDs);
- if(food.length > 0){
- food[0].click();
- General.sleep(200,500);
- }else{
- General.println("No food found! Ending script...");
- Methods.PickUpCannon();
- Variables.RunScript = false;
- }
- }
- public static void GetNextEat(int eat){
- Variables.NextEat = General.random(Skills.getActualLevel(SKILLS.HITPOINTS)/10, Skills.getActualLevel(SKILLS.HITPOINTS)/2);
- General.println("Next eat: " + Variables.NextEat);
- }
- public static boolean CannonOut(){
- RSObject[] Cannon = Objects.find(3,6);
- if(Cannon.length == 1 && !HaveCannonParts()){
- General.println("Found cannon");
- return true;
- }else{
- return false;
- }
- }
- public static RSObject[] OurCannon(){
- return Objects.find(3,6);
- }
- public static boolean PickUpCannon(){
- if(OurCannon().length > 0){
- return OurCannon()[0].click("Pick-up");
- }
- return false;
- }
- public static void LoadCannon(){
- if(OurCannon().length > 0){
- OurCannon()[0].click("Fire");
- General.sleep(1000,2000);
- }
- }
- public static void Wait(){
- if(System.currentTimeMillis() >= Variables.abc.TIME_TRACKER.ROTATE_CAMERA.next()){
- Variables.abc.performRotateCamera();
- Variables.abc.TIME_TRACKER.ROTATE_CAMERA.reset();
- }
- Variables.abc.performTimedActions(SKILLS.RANGED);
- General.sleep(200,500);
- if(NPCChat.getMessage() != null){
- NPCChat.clickContinue(true);
- General.sleep(200,500);
- }
- }
- public static void GetNextLoad(int load){
- Variables.NextLoad = General.random(0, 27);
- General.println("Next reload: " + Variables.NextLoad);
- }
- public static void PutDownCannon(){
- if(HaveCannonParts()){
- if(Player.getPosition() != Variables.CannonSpot){
- if(Variables.CannonSpot.isOnScreen()){
- Walking.clickTileMS(Variables.CannonSpot, "Walk here");
- }else{
- WebWalking.walkTo(Variables.CannonSpot);
- }
- General.sleep(500,2000);
- }
- RSItem[] base = Inventory.find(6);
- if(base.length > 0){
- base[0].click();
- Timing.waitCondition(new Condition()
- {
- @Override
- public boolean active()
- {
- General.sleep(500);
- return Objects.find(6,3).length > 0;
- }
- }, General.random(10000, 15000));
- if(OurCannon().length > 0){
- OurCannon()[0].click("Fire");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement