- Joined
- Aug 7, 2013
- Messages
- 262
- Thread Author
- #1
Code:
public static SpriteItem getCurrentWeapon() {
return Equipment.getItemIn(Slot.WEAPON);
}
public static boolean equipWeapon(final String weapon) {
SpriteItem currentWeapon;
final SpriteItem item = Inventory.getFirstItem(weapon);
if (item != null && item.interact("Wield")) {
for (int i = 0; i < 10; i++) {
if ((currentWeapon = getCurrentWeapon()) != null
&& currentWeapon.getDefinition().getName().equalsIgnoreCase(weapon)) {
return true;
}
Execution.delay(100, 200);
}
}
return (currentWeapon = getCurrentWeapon()) != null
&& currentWeapon.getDefinition().getName().equalsIgnoreCase(weapon);
}
public static boolean isPlayerIdle() {
final Player p = Players.getLocal();
return p == null || p.getInteractingEntity() == null;
}
public static boolean isUnderAttack(final boolean healthbar) {
final Player player = Players.getLocal();
if (player == null || (healthbar && player.getHealthGauge() == null)) {
return false;
}
for (final Npc n : Npcs.getLoaded()) {
final Actor a = n.getInteractingEntity();
if (a != null && a.equals(player)) {
return true;
}
}
for (final Player p : Players.getLoaded()) {
final Actor a = p.getInteractingEntity();
if (a != null && a.equals(player)) {
return true;
}
}
return false;
}
public static int getSpecialEnergy() {
return Varps.getAt(300).getBits() / 10;
}
public static boolean isSpecialAttackSelected() {
return Varps.getAt(301).getBits() == 1;
}
public static boolean specialAttack() {
if (!Tab.COMBAT_OPTIONS.isOpen() && !Tab.COMBAT_OPTIONS.open()) {
return false;
}
if (isSpecialAttackSelected()) {
return true;
}
final InterfaceComponent ic = Interfaces.getAt(593, 43);
if (ic == null || !ic.isValid()) {
return false;
}
return ic.click();
}
public static int getHealth() {
final InterfaceComponent ic = Interfaces.getAt(548, 76);
if (ic != null && ic.isValid() && ic.getText() != null) {
try {
return Integer.parseInt(ic.getText().trim());
} catch (final NumberFormatException e) {
e.printStackTrace();
}
}
return Skill.CONSTITUTION.getCurrentLevel();
}
public static int getDamage() {
return Skill.CONSTITUTION.getBaseLevel() - getHealth();
}
Last edited: