Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

SpecialAttack

Featured Replies

Ps. Depending on the weapon they are wearing why they start the script. That will be the their initial weapon, and the class will always switch between their initial weapon and there special weapon.

 

How to initiate it.

	SpecialAttack specialWeapon;
	
	@Override
	public void onStart() {
		specialWeapon = new SpecialAttack(this);
	}

How to use it:

	specialWeapon.useSpecial(SpecialWeapon.DRAGON_DAGGER_S);

package elder.choas.druid;

import org.osbot.script.MethodProvider;
import org.osbot.script.Script;
import org.osbot.script.rs2.model.Item;
import org.osbot.script.rs2.ui.EquipmentSlot;
import org.osbot.script.rs2.ui.Tab;

public class SpecialAttack {

	private Script script;
	private Item initialWeapon;
	
	public SpecialAttack(Script script) {
		this.script = script;
		initialWeapon = script.equipmentTab.getItemInSlot(EquipmentSlot.WEAPON);
	}

	public int getCurrentWeapon()	{
		return script.equipmentTab.getItemInSlot(EquipmentSlot.WEAPON).getId();
	}
		
	public boolean isWeildingWeapon(SpecialWeapon sw)	{
		return script.equipmentTab.isWieldingWeapon(sw.getId());
	}

	public boolean isSpecialReady(SpecialWeapon sw)	{
		return script.combat.getSpecialPercentage() >= sw.specialPercent;
	}

	public boolean activateSpecial() throws InterruptedException	{
		if (script.client.getConfig(301) != 1)	{
			if (!script.currentTab().equals(Tab.ATTACK))	{
				script.openTab(Tab.ATTACK);
				script.sleep(MethodProvider.random(500, 700));
			}else{
				if (script.client.getInterface(593) !=null &&
					script.client.getInterface(593).getChild(30) !=null)	{
					script.client.getInterface(593).getChild(30).interact();
				}
			}
		}
		return script.client.getConfig(301) == 1;
	}

	public boolean switchToInitialWeapon() throws InterruptedException	{
		if (getCurrentWeapon() != initialWeapon.getId())
			if (!script.currentTab().equals(Tab.INVENTORY))	
				script.openTab(Tab.INVENTORY);
			else
				if (script.client.getInventory().contains(initialWeapon.getId()))	
					script.client.getInventory().interactWithId(initialWeapon.getId(), initialWeapon.getDefinition().getActions()[0]);
				else
					return false;
		return true;
	}
	
	public boolean switchToSpecialWeapon(SpecialWeapon sw) throws InterruptedException	{
		if (getCurrentWeapon() == -1 || getCurrentWeapon() != sw.getId())	{
			if (!script.currentTab().equals(Tab.INVENTORY))
				script.openTab(Tab.INVENTORY);
			else
				if (script.client.getInventory().contains(sw.getId())){
					Item sWeapon = script.client.getInventory().getItemForId(sw.getId());
					script.client.getInventory().interactWithId(sw.getId(), sWeapon.getDefinition().getActions()[0]);
				}else
					return false;
		}
		return true;
	}
	
	public int useSpecial(SpecialWeapon sw) throws InterruptedException	{
		if (script.combat.getSpecialPercentage() >= sw.specialPercent)	{
			if (getCurrentWeapon() != sw.getId())
				this.switchToSpecialWeapon(sw);
			else
				this.activateSpecial();	
		}else{
			if (getCurrentWeapon() != this.initialWeapon.getId())
				this.switchToInitialWeapon();
		}
		return MethodProvider.random(700, 1000);
	}
	
	public enum SpecialWeapon	{
	    DRAGON_DAGGER_S(25, 5698),
	    DRAGON_SCIMITAR(55, 4587),  
	    ABYSSAL_WHIP(50, 4151),
	    MAGIC_SHORTBOW(55, 861),
	    DRAGON_BATTLEAXE(100, 1377),
	    DRAGON_LONGSWORD(25, 1305), 		
	    EXCALIBUR(100, 35), 
	    SARADOMIN_SWORD(100, 11730),
	    ARMADYL_GODSWORD(50, 11694),
	    SARADOMIN_GODSWORD(50, 11806);
   
	    private int specialPercent;
	    private int id; 
	    
	    SpecialWeapon(int specialPercent, int id)	{
	    	this.specialPercent = specialPercent;
	    	this.id = id;
	    }
	    
	    public int getId()	{
	    	return id;
	    }
	    
	    public int getSpecialPercent()	{
	    	return specialPercent;
	    }
	    
	}
	
}

  • Author

biggrin.png great job!

Now I can scrap my shit lines of code!

Thanks buddy

your welcome

Guest
This topic is now closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.