import java.awt.Graphics2D;
import net.pink.probot.Listeners.PaintListener;
import net.pink.probot.bot.Bot;
import net.pink.probot.script.Script;
import net.pink.probot.script.methods.wrappers.RSCArea;
import net.pink.probot.script.methods.wrappers.RSCNpc;
import net.pink.probot.script.methods.wrappers.RSCTile;
public class NPCCast extends Script implements PaintListener {
public NPCCast(Bot bot) {
super(bot);
}
@Override
public int loop() {
RSCNpc attackNpc = getNpcs().getNearestNpc(extractIntegers(args.get("npcIds")));
if(attackNpc != null) {
castOnNpc(attackNpc, extractIntegers(args.get("spellID"))[0]);
return 1000;
}
return 500;
}
public void castOnNpc(RSCNpc npc, int spellIndex) { // 700
try {
bot.getMethodBuilder().createPacket(50, (byte)-52);
bot.getMethodBuilder().add2ByteInt(npc.getNpcIndex(), (byte)-125);
bot.getMethodBuilder().add2ByteInt(spellIndex, (byte)-40);
bot.getMethodBuilder().finishPacket(0);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public boolean onStart() {
return true;
}
@Override
public void onRepaint(Graphics2D g) {
}
@Override
public String description() {
return "NPC IDs:
Spell ID: ";
}
}