Mister Multi
July 12th, 2010, 13:03
Purpose: All spells working on Magic to NPC
Tested base: Bulby
Difficulty: 0.01
Credits: 100% me for exploring Magic.java and making this.
I'll update maxhit/exp rate sometime.
First, make new file called MagicOnNPC.java to Bulby\io\packets.
Next, add this code to MagicOnNPC.java(I have added all spells, anim and deleteitem ints.):
package Bulby.io.packets;
import Bulby.Engine;
import Bulby.util.Misc;
import Bulby.players.Player;
import Bulby.npcs.*;
public class MagicOnNPC {
private static int hitDamage;
private static int mainDelayInt = 5;
private static int mainClickDelay = 1;
public static int airRune = 556;
public static int earthRune = 557;
public static int waterRune = 555;
public static int fireRune = 554;
public static int bodyRune = 559;
public static int mindRune = 558;
public static int lawRune = 563;
public static int cosmicRune = 564;
public static int deathRune = 560;
public static int natureRune = 561;
public static int chaosRune = 562;
public static int bloodRune = 565;
public static int soulRune = 566;
public static boolean hasReq(Player p, int ItemId, int amt) {
return Engine.playerItems.haveItem(p, ItemId, amt);
}
public static boolean giveMagicXP(Player p, double xpamt) {
p.addSkillXP(xpamt, 6);
return false;
}
public static void deleteItems(Player p, int itemId, int amt) {
Engine.playerItems.deleteItem(p, itemId, Engine.playerItems.getItemSlot(p, itemId), amt);
}
public static void deleteItems(Player p, int item1id, int item1amt, int item2id, int item2amt) {
Engine.playerItems.deleteItem(p, item1id,Engine.playerItems.getItemSlot(p, item1id), item1amt);
Engine.playerItems.deleteItem(p, item2id,Engine.playerItems.getItemSlot(p, item2id), item2amt);
}
public static void deleteItems(Player p, int item1id, int item1amt, int item2id, int item2amt, int item3id, int item3amt) {
Engine.playerItems.deleteItem(p, item1id,
Engine.playerItems.getItemSlot(p, item1id), item1amt);
Engine.playerItems.deleteItem(p, item2id, Engine.playerItems.getItemSlot(p, item2id), item2amt);
Engine.playerItems.deleteItem(p, item3id,Engine.playerItems.getItemSlot(p, item3id), item3amt);
}
public static void deleteItems(Player p, int item1id, int item1amt, int item2id, int item2amt, int item3id, int item3amt, int item4id, int item4amt) {
Engine.playerItems.deleteItem(p, item1id,Engine.playerItems.getItemSlot(p, item1id), item1amt);
Engine.playerItems.deleteItem(p, item2id,Engine.playerItems.getItemSlot(p, item2id), item2amt);
Engine.playerItems.deleteItem(p, item3id, Engine.playerItems.getItemSlot(p, item3id), item3amt);
Engine.playerItems.deleteItem(p, item4id,Engine.playerItems.getItemSlot(p, item4id), item4amt);
}
public static void anim(Player p, int animID) {
p.requestAnim(animID, 0);
}
public static boolean giveHPXP(Player p, double xpamt) {
p.addSkillXP(xpamt, 3);
return false;
}
public static void sendMsg(Player p, String MSG) {
p.frames.sendMessage(p, MSG);
}
public static void cast(Player p, int offsetX, int offsetY, int moving, int starth, int endh, int speed, int target) {
p.frames.createGlobalProjectile(p.absY, p.absX, offsetY, offsetX, moving,
starth, endh, speed, target);
}
public static void face(Player p, int amt) {
p.requestFaceTo(amt);
}
public static int MagicLevel(Player p) {
return p.getLevelForXP(6);
}
public static void gfa(Player p, int gfxID, int time, int animID, int time2) {
p.requestAnim(animID, time2);
p.requestGFX(gfxID, time);
}
public static void magicAop(Player p, int packetId, int packetSize) {
p.attackNPC = p.stream.readSignedWordA();
int buttonId = p.stream.readSignedWordA();
int interfaceId = p.stream.readUnsignedWord();
NPC n = Engine.npcs[p.attackNPC];
if (((p.absX - n.absX) == 0)){
int offsetX = -1;
}
else {
int offsetX = (p.absX - n.absX) * -1;
}
if (((p.absY - n.absY) == 0)){
int offsetY = -1;
}
else {
int offsetY = (p.absY - n.absY) * -1;
}
p.attackingNPC = true;
if (!n.attackingPlayer) {
n.attackingPlayer = true;
n.attackPlayer = p.playerId;
}
switch (interfaceId) {
case 192: // Modern Magic Spells
switch (buttonId) {
case 129: //Wind Strike
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 1) {
if (hasReq(p, mindRune, 1) && hasReq(p, airRune, 1)) {
p.stopMovement(p);
face(p, n.npcId);
gfa(p, 90, 100, 711, 0);
n.requestGFX(92, 177);
int hitdmg = Misc.random(3);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 1);
giveHPXP(p, hitdmg * 4);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
Engine.playerItems.deleteItem(p, mindRune, Engine.playerItems.getItemSlot(p, mindRune), 1);
Engine.playerItems.deleteItem(p, airRune, Engine.playerItems.getItemSlot(p, airRune), 1);
} else {
sendMsg(p,"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,"You need level 1 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 132: //Water Strike
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 5) {
if (hasReq(p, mindRune, 1) && hasReq(p, airRune, 1)) {
p.stopMovement(p);
face(p, n.npcId);
gfa(p, 93, 100, 711, 0);
n.requestGFX(95, 177);
int hitdmg = Misc.random(4);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 3);
giveHPXP(p, hitdmg * 4 + 1);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
Engine.playerItems.deleteItem(p, mindRune, Engine.playerItems.getItemSlot(p, mindRune), 1);
Engine.playerItems.deleteItem(p, airRune, Engine.playerItems.getItemSlot(p, airRune), 1);
} else {
sendMsg(p,"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,"You need level 1 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 134: // Earth Strike
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 9) {
if (hasReq(p, mindRune, 1) && hasReq(p, airRune, 1)
&& hasReq(p, earthRune, 2)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, airRune, 1, mindRune, 1, earthRune, 2);
gfa(p, 96, 100, 711, 0);
n.requestGFX(96, 177);
int hitdmg = Misc.random(5);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 5);
giveHPXP(p, hitdmg * 4 + 3);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 9 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 136: // Fire Strike
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 13) {
if (hasReq(p, mindRune, 1) && hasReq(p, airRune, 1)
&& hasReq(p, fireRune, 2)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, airRune, 1, mindRune, 1, fireRune, 2);
gfa(p, 99, 100, 711, 0);
n.requestGFX(101, 177);
int hitdmg = Misc.random(6);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 7);
giveHPXP(p, hitdmg * 4 + 5);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 13 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 138: // Wind Bolt
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 17) {
if (hasReq(p, chaosRune, 1) && hasReq(p, airRune, 2)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, airRune, 2, chaosRune, 1);
gfa(p, 118, 100, 711, 0);
n.requestGFX(119, 177);
int hitdmg = Misc.random(7);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 9);
giveHPXP(p, hitdmg * 4 + 7);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 17 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 142: // Water Bolt
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 23) {
if (hasReq(p, chaosRune, 1) && hasReq(p, airRune, 2)
&& hasReq(p, waterRune, 2)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, chaosRune, 1, airRune, 2, waterRune, 2);
gfa(p, 120, 100, 711, 0);
n.requestGFX(122, 177);
int hitdmg = Misc.random(8);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 11);
giveHPXP(p, hitdmg * 4 + 9);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 23 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 145: // Earth Bolt
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 29) {
if (hasReq(p, chaosRune, 1) && hasReq(p, airRune, 2)
&& hasReq(p, earthRune, 3)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, chaosRune, 1, airRune, 2, earthRune, 3);
gfa(p, 123, 100, 711, 0);
n.requestGFX(125, 177);
int hitdmg = Misc.random(9);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 13);
giveHPXP(p, hitdmg * 4 + 11);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 29 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 148: // Fire Bolt
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 35) {
if (hasReq(p, chaosRune, 1) && hasReq(p, airRune, 2)
&& hasReq(p, fireRune, 3)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, chaosRune, 1, airRune, 2, fireRune, 3);
gfa(p, 126, 100, 711, 0);
n.requestGFX(128, 177);
int hitdmg = Misc.random(10);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 15);
giveHPXP(p, hitdmg * 4 + 13);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 35 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 152: // Wind Blast
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 41) {
if (hasReq(p, deathRune, 1) && hasReq(p, airRune, 3)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, deathRune, 1, airRune, 3);
gfa(p, 132, 100, 711, 0);
n.requestGFX(132, 177);
int hitdmg = Misc.random(11);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 17);
giveHPXP(p, hitdmg * 4 + 15);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 41 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 155: // Water Blast
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 47) {
if (hasReq(p, deathRune, 1) && hasReq(p, airRune, 3)
&& hasReq(p, waterRune, 3)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, deathRune, 1, airRune, 3, waterRune, 3);
gfa(p, 135, 100, 711, 0);
n.requestGFX(137, 177);
int hitdmg = Misc.random(12);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 19);
giveHPXP(p, hitdmg * 4 + 17);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 47 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 161: // Earth Blast
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 53) {
if (hasReq(p, deathRune, 1) && hasReq(p, airRune, 3)
&& hasReq(p, earthRune, 4)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, deathRune, 1, airRune, 3, earthRune, 4);
gfa(p, 138, 100, 711, 0);
n.requestGFX(140, 177);
int hitdmg = Misc.random(13);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 21);
giveHPXP(p, hitdmg * 4 + 19);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 53 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 166: // Fire Blast
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 59) {
if (hasReq(p, deathRune, 1) && hasReq(p, airRune, 4)
&& hasReq(p, fireRune, 5)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, deathRune, 1, airRune, 4, fireRune, 5);
gfa(p, 129, 100, 711, 0);
n.requestGFX(131, 177);
int hitdmg = Misc.random(14);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 23);
giveHPXP(p, hitdmg * 4 + 21);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 59 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 173: // Wind Wave
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 62) {
if (hasReq(p, bloodRune, 1) && hasReq(p, airRune, 5)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, bloodRune, 1, airRune, 5);
gfa(p, 158, 100, 711, 0);
n.requestGFX(160, 177);
int hitdmg = Misc.random(15);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 25);
giveHPXP(p, hitdmg * 4 + 22);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 62 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 176: // Water Wave
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 65) {
if (hasReq(p, bloodRune, 1) && hasReq(p, airRune, 5)
&& hasReq(p, waterRune, 7)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, bloodRune, 1, airRune, 5, waterRune, 7);
gfa(p, 161, 100, 711, 0);
n.requestGFX(163, 177);
int hitdmg = Misc.random(16);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 27);
giveHPXP(p, hitdmg * 4 + 24);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 65 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 180: // Earth Wave
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 70) {
if (hasReq(p, bloodRune, 1) && hasReq(p, airRune, 5)
&& hasReq(p, earthRune, 7)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, bloodRune, 1, airRune, 5, earthRune, 7);
gfa(p, 164, 100, 711, 0);
n.requestGFX(166, 177);
int hitdmg = Misc.random(17);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 29);
giveHPXP(p, hitdmg * 4 + 26);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 70 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 183: // Fire Wave
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 75) {
if (hasReq(p, bloodRune, 1) && hasReq(p, airRune, 5)
&& hasReq(p, fireRune, 7)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, bloodRune, 1, airRune, 5, fireRune, 7);
gfa(p, 155, 100, 711, 0);
n.requestGFX(157, 177);
int hitdmg = Misc.random(18);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 31);
giveHPXP(p, hitdmg * 4 + 28);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 75 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
default:
Misc.println("["+p.username+"]: button: "+buttonId);
//Misc.println("["+p.username+"]: npcindex: "+p.attackNPC);
break;
}
case 193: // Ancient Magic Spells
switch (buttonId) {
case 136: // Smoke Rush
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 50) {
if (hasReq(p, deathRune, 2) && hasReq(p, chaosRune, 2)
&& hasReq(p, airRune, 1) && hasReq(p, fireRune, 1)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, deathRune, 2, chaosRune, 2, airRune, 1, fireRune, 1);
anim(p, 1978);
n.requestGFX(385, 0);
int hitdmg = Misc.random(14);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 23);
giveHPXP(p, hitdmg * 4 + 21);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 50 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 140: // Shadow Rush
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 52) {
if (hasReq(p, deathRune, 2) && hasReq(p, chaosRune, 2)
&& hasReq(p, airRune, 1) && hasReq(p, soulRune, 1)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, deathRune, 2, chaosRune, 2, airRune, 1, soulRune, 1);
anim(p, 1978);
n.requestGFX(379, 0);
int hitdmg = Misc.random(15);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 25);
giveHPXP(p, hitdmg * 4 + 23);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 52 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 132: // Blood Rush
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 56) {
if (hasReq(p, deathRune, 2) && hasReq(p, chaosRune, 2)
&& hasReq(p, bloodRune, 1)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, deathRune, 2, chaosRune, 2, bloodRune, 1);
anim(p, 1978);
n.requestGFX(374, 0);
int hitdmg = Misc.random(16);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 27);
giveHPXP(p, hitdmg * 4 + 25);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 56 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 128: // Ice Rush
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 58) {
if (hasReq(p, deathRune, 2) && hasReq(p, chaosRune, 2)
&& hasReq(p, waterRune, 2)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, deathRune, 2, chaosRune, 2, waterRune, 2);
anim(p, 1978);
n.requestGFX(361, 0);
int hitdmg = Misc.random(17);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 29);
giveHPXP(p, hitdmg * 4 + 27);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 58 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 138: // Smoke Burst
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 62) {
if (hasReq(p, deathRune, 2) && hasReq(p, chaosRune, 4)
&& hasReq(p, airRune, 2) && hasReq(p, fireRune, 2)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, deathRune, 2, chaosRune, 4, airRune, 2, fireRune, 2);
anim(p, 1979);
n.requestGFX(389, 0);
int hitdmg = Misc.random(18);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 31);
giveHPXP(p, hitdmg * 4 + 29);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 62 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 142: // Shadow Burst
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 64) {
if (hasReq(p, deathRune, 2) && hasReq(p, chaosRune, 4)
&& hasReq(p, airRune, 2) && hasReq(p, soulRune, 2)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, deathRune, 2, chaosRune, 4, airRune, 2, soulRune, 2);
anim(p, 1978);
n.requestGFX(382, 0);
int hitdmg = Misc.random(19);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 33);
giveHPXP(p, hitdmg * 4 + 31);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 64 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 134: // Blood Burst
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 68) {
if (hasReq(p, deathRune, 2) && hasReq(p, chaosRune, 4)
&& hasReq(p, bloodRune, 2)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, deathRune, 2, chaosRune, 4, bloodRune, 2);
anim(p, 1979);
n.requestGFX(376, 0);
int hitdmg = Misc.random(20);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 35);
giveHPXP(p, hitdmg * 4 + 33);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 68 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 130: // Ice Burst
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 70) {
if (hasReq(p, deathRune, 2) && hasReq(p, chaosRune, 4)
&& hasReq(p, waterRune, 4)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, deathRune, 2, chaosRune, 4, waterRune, 4);
anim(p, 1979);
n.requestGFX(363, 0);
int hitdmg = Misc.random(21);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 37);
giveHPXP(p, hitdmg * 4 + 35);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 70 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 137: // Smoke Blitz
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 74) {
if (hasReq(p, deathRune, 2) && hasReq(p, fireRune, 2)
&& hasReq(p, bloodRune, 2) && hasReq(p, airRune, 2)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, deathRune, 2, fireRune, 2, bloodRune, 2, airRune, 2);
anim(p, 1978);
n.requestGFX(387, 0);
int hitdmg = Misc.random(22);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 39);
giveHPXP(p, hitdmg * 4 + 37);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 74 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 141: // Shadow Blitz
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 76) {
if (hasReq(p, deathRune, 2) && hasReq(p, bloodRune, 2)
&& hasReq(p, airRune, 2) && hasReq(p, soulRune, 2)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, deathRune, 2, bloodRune, 2, airRune, 2, soulRune, 2);
anim(p, 1978);
n.requestGFX(381, 0);
int hitdmg = Misc.random(23);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 41);
giveHPXP(p, hitdmg * 4 + 39);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 76 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 133: // Blood Blitz
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 80) {
if (hasReq(p, deathRune, 2) && hasReq(p, bloodRune, 4)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, deathRune, 2, bloodRune, 4);
anim(p, 1978);
n.requestGFX(375, 0);
int hitdmg = Misc.random(24);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 43);
giveHPXP(p, hitdmg * 4 + 41);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 80 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 129: // Ice Blitz
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 82) {
if (hasReq(p, deathRune, 2) && hasReq(p, waterRune, 3)
&& hasReq(p, bloodRune, 2)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, deathRune, 2, waterRune, 3, bloodRune, 2);
anim(p, 1978);
n.requestGFX(367, 0);
int hitdmg = Misc.random(25);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 45);
giveHPXP(p, hitdmg * 4 + 43);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 82 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 139: // Smoke Barrage
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 86) {
if (hasReq(p, deathRune, 4) && hasReq(p, fireRune, 4)
&& hasReq(p, bloodRune, 2) && hasReq(p, airRune, 4)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, deathRune, 4, fireRune, 4, bloodRune, 2, airRune, 4);
anim(p, 1979);
n.requestGFX(391, 0);
int hitdmg = Misc.random(26);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 47);
giveHPXP(p, hitdmg * 4 + 45);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 86 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 143: // Shadow Barrage
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 88) {
if (hasReq(p, deathRune, 4) && hasReq(p, soulRune, 3)
&& hasReq(p, bloodRune, 2) && hasReq(p, airRune, 4)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, deathRune, 2, soulRune, 2, bloodRune, 2, airRune, 2);
anim(p, 1978);
n.requestGFX(383, 0);
int hitdmg = Misc.random(27);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 49);
giveHPXP(p, hitdmg * 4 + 47);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 88 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 135: // Blood Barrage
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 92) {
if (hasReq(p, deathRune, 4) && hasReq(p, soulRune, 1)
&& hasReq(p, bloodRune, 4)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, deathRune, 4, soulRune, 1, bloodRune, 4);
anim(p, 1979);
n.requestGFX(377, 0);
int hitdmg = Misc.random(28);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 51);
giveHPXP(p, hitdmg * 4 + 49);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 92 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 131: // Ice Barrage
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 94) {
if (hasReq(p, deathRune, 4) && hasReq(p, waterRune, 6)
&& hasReq(p, bloodRune, 2)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, deathRune, 4, waterRune, 6, bloodRune, 2);
anim(p, 1979);
n.requestGFX(369, 0);
int hitdmg = Misc.random(29);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 53);
giveHPXP(p, hitdmg * 4 + 51);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 94 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
default:
Misc.println("["+p.username+"]: button: "+buttonId);
break;
}
}
}
}
Next, open PacketManager at Bulby\io.
Find:
public MagicOnPlayer magicOnPlayer = new MagicOnPlayer();
Add this after it:
public MagicOnNPC magicOnNPC = new MagicOnNPC();
Find:
switch (packetId) {
Add this after it:
case 24://magic on npc by I loot I aka Lootface
MagicOnNPC.magicAop(p, packetId, packetSize);
//Misc.println("["+p.username+"]: packet: "+packetId);
break;
Here you go. Rate and reply, please. :)
Tested base: Bulby
Difficulty: 0.01
Credits: 100% me for exploring Magic.java and making this.
I'll update maxhit/exp rate sometime.
First, make new file called MagicOnNPC.java to Bulby\io\packets.
Next, add this code to MagicOnNPC.java(I have added all spells, anim and deleteitem ints.):
package Bulby.io.packets;
import Bulby.Engine;
import Bulby.util.Misc;
import Bulby.players.Player;
import Bulby.npcs.*;
public class MagicOnNPC {
private static int hitDamage;
private static int mainDelayInt = 5;
private static int mainClickDelay = 1;
public static int airRune = 556;
public static int earthRune = 557;
public static int waterRune = 555;
public static int fireRune = 554;
public static int bodyRune = 559;
public static int mindRune = 558;
public static int lawRune = 563;
public static int cosmicRune = 564;
public static int deathRune = 560;
public static int natureRune = 561;
public static int chaosRune = 562;
public static int bloodRune = 565;
public static int soulRune = 566;
public static boolean hasReq(Player p, int ItemId, int amt) {
return Engine.playerItems.haveItem(p, ItemId, amt);
}
public static boolean giveMagicXP(Player p, double xpamt) {
p.addSkillXP(xpamt, 6);
return false;
}
public static void deleteItems(Player p, int itemId, int amt) {
Engine.playerItems.deleteItem(p, itemId, Engine.playerItems.getItemSlot(p, itemId), amt);
}
public static void deleteItems(Player p, int item1id, int item1amt, int item2id, int item2amt) {
Engine.playerItems.deleteItem(p, item1id,Engine.playerItems.getItemSlot(p, item1id), item1amt);
Engine.playerItems.deleteItem(p, item2id,Engine.playerItems.getItemSlot(p, item2id), item2amt);
}
public static void deleteItems(Player p, int item1id, int item1amt, int item2id, int item2amt, int item3id, int item3amt) {
Engine.playerItems.deleteItem(p, item1id,
Engine.playerItems.getItemSlot(p, item1id), item1amt);
Engine.playerItems.deleteItem(p, item2id, Engine.playerItems.getItemSlot(p, item2id), item2amt);
Engine.playerItems.deleteItem(p, item3id,Engine.playerItems.getItemSlot(p, item3id), item3amt);
}
public static void deleteItems(Player p, int item1id, int item1amt, int item2id, int item2amt, int item3id, int item3amt, int item4id, int item4amt) {
Engine.playerItems.deleteItem(p, item1id,Engine.playerItems.getItemSlot(p, item1id), item1amt);
Engine.playerItems.deleteItem(p, item2id,Engine.playerItems.getItemSlot(p, item2id), item2amt);
Engine.playerItems.deleteItem(p, item3id, Engine.playerItems.getItemSlot(p, item3id), item3amt);
Engine.playerItems.deleteItem(p, item4id,Engine.playerItems.getItemSlot(p, item4id), item4amt);
}
public static void anim(Player p, int animID) {
p.requestAnim(animID, 0);
}
public static boolean giveHPXP(Player p, double xpamt) {
p.addSkillXP(xpamt, 3);
return false;
}
public static void sendMsg(Player p, String MSG) {
p.frames.sendMessage(p, MSG);
}
public static void cast(Player p, int offsetX, int offsetY, int moving, int starth, int endh, int speed, int target) {
p.frames.createGlobalProjectile(p.absY, p.absX, offsetY, offsetX, moving,
starth, endh, speed, target);
}
public static void face(Player p, int amt) {
p.requestFaceTo(amt);
}
public static int MagicLevel(Player p) {
return p.getLevelForXP(6);
}
public static void gfa(Player p, int gfxID, int time, int animID, int time2) {
p.requestAnim(animID, time2);
p.requestGFX(gfxID, time);
}
public static void magicAop(Player p, int packetId, int packetSize) {
p.attackNPC = p.stream.readSignedWordA();
int buttonId = p.stream.readSignedWordA();
int interfaceId = p.stream.readUnsignedWord();
NPC n = Engine.npcs[p.attackNPC];
if (((p.absX - n.absX) == 0)){
int offsetX = -1;
}
else {
int offsetX = (p.absX - n.absX) * -1;
}
if (((p.absY - n.absY) == 0)){
int offsetY = -1;
}
else {
int offsetY = (p.absY - n.absY) * -1;
}
p.attackingNPC = true;
if (!n.attackingPlayer) {
n.attackingPlayer = true;
n.attackPlayer = p.playerId;
}
switch (interfaceId) {
case 192: // Modern Magic Spells
switch (buttonId) {
case 129: //Wind Strike
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 1) {
if (hasReq(p, mindRune, 1) && hasReq(p, airRune, 1)) {
p.stopMovement(p);
face(p, n.npcId);
gfa(p, 90, 100, 711, 0);
n.requestGFX(92, 177);
int hitdmg = Misc.random(3);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 1);
giveHPXP(p, hitdmg * 4);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
Engine.playerItems.deleteItem(p, mindRune, Engine.playerItems.getItemSlot(p, mindRune), 1);
Engine.playerItems.deleteItem(p, airRune, Engine.playerItems.getItemSlot(p, airRune), 1);
} else {
sendMsg(p,"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,"You need level 1 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 132: //Water Strike
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 5) {
if (hasReq(p, mindRune, 1) && hasReq(p, airRune, 1)) {
p.stopMovement(p);
face(p, n.npcId);
gfa(p, 93, 100, 711, 0);
n.requestGFX(95, 177);
int hitdmg = Misc.random(4);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 3);
giveHPXP(p, hitdmg * 4 + 1);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
Engine.playerItems.deleteItem(p, mindRune, Engine.playerItems.getItemSlot(p, mindRune), 1);
Engine.playerItems.deleteItem(p, airRune, Engine.playerItems.getItemSlot(p, airRune), 1);
} else {
sendMsg(p,"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,"You need level 1 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 134: // Earth Strike
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 9) {
if (hasReq(p, mindRune, 1) && hasReq(p, airRune, 1)
&& hasReq(p, earthRune, 2)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, airRune, 1, mindRune, 1, earthRune, 2);
gfa(p, 96, 100, 711, 0);
n.requestGFX(96, 177);
int hitdmg = Misc.random(5);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 5);
giveHPXP(p, hitdmg * 4 + 3);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 9 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 136: // Fire Strike
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 13) {
if (hasReq(p, mindRune, 1) && hasReq(p, airRune, 1)
&& hasReq(p, fireRune, 2)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, airRune, 1, mindRune, 1, fireRune, 2);
gfa(p, 99, 100, 711, 0);
n.requestGFX(101, 177);
int hitdmg = Misc.random(6);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 7);
giveHPXP(p, hitdmg * 4 + 5);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 13 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 138: // Wind Bolt
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 17) {
if (hasReq(p, chaosRune, 1) && hasReq(p, airRune, 2)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, airRune, 2, chaosRune, 1);
gfa(p, 118, 100, 711, 0);
n.requestGFX(119, 177);
int hitdmg = Misc.random(7);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 9);
giveHPXP(p, hitdmg * 4 + 7);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 17 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 142: // Water Bolt
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 23) {
if (hasReq(p, chaosRune, 1) && hasReq(p, airRune, 2)
&& hasReq(p, waterRune, 2)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, chaosRune, 1, airRune, 2, waterRune, 2);
gfa(p, 120, 100, 711, 0);
n.requestGFX(122, 177);
int hitdmg = Misc.random(8);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 11);
giveHPXP(p, hitdmg * 4 + 9);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 23 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 145: // Earth Bolt
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 29) {
if (hasReq(p, chaosRune, 1) && hasReq(p, airRune, 2)
&& hasReq(p, earthRune, 3)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, chaosRune, 1, airRune, 2, earthRune, 3);
gfa(p, 123, 100, 711, 0);
n.requestGFX(125, 177);
int hitdmg = Misc.random(9);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 13);
giveHPXP(p, hitdmg * 4 + 11);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 29 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 148: // Fire Bolt
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 35) {
if (hasReq(p, chaosRune, 1) && hasReq(p, airRune, 2)
&& hasReq(p, fireRune, 3)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, chaosRune, 1, airRune, 2, fireRune, 3);
gfa(p, 126, 100, 711, 0);
n.requestGFX(128, 177);
int hitdmg = Misc.random(10);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 15);
giveHPXP(p, hitdmg * 4 + 13);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 35 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 152: // Wind Blast
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 41) {
if (hasReq(p, deathRune, 1) && hasReq(p, airRune, 3)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, deathRune, 1, airRune, 3);
gfa(p, 132, 100, 711, 0);
n.requestGFX(132, 177);
int hitdmg = Misc.random(11);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 17);
giveHPXP(p, hitdmg * 4 + 15);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 41 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 155: // Water Blast
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 47) {
if (hasReq(p, deathRune, 1) && hasReq(p, airRune, 3)
&& hasReq(p, waterRune, 3)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, deathRune, 1, airRune, 3, waterRune, 3);
gfa(p, 135, 100, 711, 0);
n.requestGFX(137, 177);
int hitdmg = Misc.random(12);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 19);
giveHPXP(p, hitdmg * 4 + 17);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 47 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 161: // Earth Blast
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 53) {
if (hasReq(p, deathRune, 1) && hasReq(p, airRune, 3)
&& hasReq(p, earthRune, 4)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, deathRune, 1, airRune, 3, earthRune, 4);
gfa(p, 138, 100, 711, 0);
n.requestGFX(140, 177);
int hitdmg = Misc.random(13);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 21);
giveHPXP(p, hitdmg * 4 + 19);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 53 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 166: // Fire Blast
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 59) {
if (hasReq(p, deathRune, 1) && hasReq(p, airRune, 4)
&& hasReq(p, fireRune, 5)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, deathRune, 1, airRune, 4, fireRune, 5);
gfa(p, 129, 100, 711, 0);
n.requestGFX(131, 177);
int hitdmg = Misc.random(14);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 23);
giveHPXP(p, hitdmg * 4 + 21);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 59 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 173: // Wind Wave
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 62) {
if (hasReq(p, bloodRune, 1) && hasReq(p, airRune, 5)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, bloodRune, 1, airRune, 5);
gfa(p, 158, 100, 711, 0);
n.requestGFX(160, 177);
int hitdmg = Misc.random(15);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 25);
giveHPXP(p, hitdmg * 4 + 22);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 62 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 176: // Water Wave
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 65) {
if (hasReq(p, bloodRune, 1) && hasReq(p, airRune, 5)
&& hasReq(p, waterRune, 7)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, bloodRune, 1, airRune, 5, waterRune, 7);
gfa(p, 161, 100, 711, 0);
n.requestGFX(163, 177);
int hitdmg = Misc.random(16);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 27);
giveHPXP(p, hitdmg * 4 + 24);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 65 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 180: // Earth Wave
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 70) {
if (hasReq(p, bloodRune, 1) && hasReq(p, airRune, 5)
&& hasReq(p, earthRune, 7)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, bloodRune, 1, airRune, 5, earthRune, 7);
gfa(p, 164, 100, 711, 0);
n.requestGFX(166, 177);
int hitdmg = Misc.random(17);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 29);
giveHPXP(p, hitdmg * 4 + 26);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 70 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 183: // Fire Wave
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 75) {
if (hasReq(p, bloodRune, 1) && hasReq(p, airRune, 5)
&& hasReq(p, fireRune, 7)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, bloodRune, 1, airRune, 5, fireRune, 7);
gfa(p, 155, 100, 711, 0);
n.requestGFX(157, 177);
int hitdmg = Misc.random(18);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 31);
giveHPXP(p, hitdmg * 4 + 28);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 75 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
default:
Misc.println("["+p.username+"]: button: "+buttonId);
//Misc.println("["+p.username+"]: npcindex: "+p.attackNPC);
break;
}
case 193: // Ancient Magic Spells
switch (buttonId) {
case 136: // Smoke Rush
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 50) {
if (hasReq(p, deathRune, 2) && hasReq(p, chaosRune, 2)
&& hasReq(p, airRune, 1) && hasReq(p, fireRune, 1)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, deathRune, 2, chaosRune, 2, airRune, 1, fireRune, 1);
anim(p, 1978);
n.requestGFX(385, 0);
int hitdmg = Misc.random(14);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 23);
giveHPXP(p, hitdmg * 4 + 21);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 50 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 140: // Shadow Rush
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 52) {
if (hasReq(p, deathRune, 2) && hasReq(p, chaosRune, 2)
&& hasReq(p, airRune, 1) && hasReq(p, soulRune, 1)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, deathRune, 2, chaosRune, 2, airRune, 1, soulRune, 1);
anim(p, 1978);
n.requestGFX(379, 0);
int hitdmg = Misc.random(15);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 25);
giveHPXP(p, hitdmg * 4 + 23);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 52 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 132: // Blood Rush
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 56) {
if (hasReq(p, deathRune, 2) && hasReq(p, chaosRune, 2)
&& hasReq(p, bloodRune, 1)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, deathRune, 2, chaosRune, 2, bloodRune, 1);
anim(p, 1978);
n.requestGFX(374, 0);
int hitdmg = Misc.random(16);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 27);
giveHPXP(p, hitdmg * 4 + 25);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 56 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 128: // Ice Rush
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 58) {
if (hasReq(p, deathRune, 2) && hasReq(p, chaosRune, 2)
&& hasReq(p, waterRune, 2)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, deathRune, 2, chaosRune, 2, waterRune, 2);
anim(p, 1978);
n.requestGFX(361, 0);
int hitdmg = Misc.random(17);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 29);
giveHPXP(p, hitdmg * 4 + 27);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 58 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 138: // Smoke Burst
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 62) {
if (hasReq(p, deathRune, 2) && hasReq(p, chaosRune, 4)
&& hasReq(p, airRune, 2) && hasReq(p, fireRune, 2)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, deathRune, 2, chaosRune, 4, airRune, 2, fireRune, 2);
anim(p, 1979);
n.requestGFX(389, 0);
int hitdmg = Misc.random(18);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 31);
giveHPXP(p, hitdmg * 4 + 29);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 62 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 142: // Shadow Burst
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 64) {
if (hasReq(p, deathRune, 2) && hasReq(p, chaosRune, 4)
&& hasReq(p, airRune, 2) && hasReq(p, soulRune, 2)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, deathRune, 2, chaosRune, 4, airRune, 2, soulRune, 2);
anim(p, 1978);
n.requestGFX(382, 0);
int hitdmg = Misc.random(19);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 33);
giveHPXP(p, hitdmg * 4 + 31);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 64 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 134: // Blood Burst
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 68) {
if (hasReq(p, deathRune, 2) && hasReq(p, chaosRune, 4)
&& hasReq(p, bloodRune, 2)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, deathRune, 2, chaosRune, 4, bloodRune, 2);
anim(p, 1979);
n.requestGFX(376, 0);
int hitdmg = Misc.random(20);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 35);
giveHPXP(p, hitdmg * 4 + 33);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 68 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 130: // Ice Burst
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 70) {
if (hasReq(p, deathRune, 2) && hasReq(p, chaosRune, 4)
&& hasReq(p, waterRune, 4)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, deathRune, 2, chaosRune, 4, waterRune, 4);
anim(p, 1979);
n.requestGFX(363, 0);
int hitdmg = Misc.random(21);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 37);
giveHPXP(p, hitdmg * 4 + 35);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 70 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 137: // Smoke Blitz
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 74) {
if (hasReq(p, deathRune, 2) && hasReq(p, fireRune, 2)
&& hasReq(p, bloodRune, 2) && hasReq(p, airRune, 2)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, deathRune, 2, fireRune, 2, bloodRune, 2, airRune, 2);
anim(p, 1978);
n.requestGFX(387, 0);
int hitdmg = Misc.random(22);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 39);
giveHPXP(p, hitdmg * 4 + 37);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 74 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 141: // Shadow Blitz
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 76) {
if (hasReq(p, deathRune, 2) && hasReq(p, bloodRune, 2)
&& hasReq(p, airRune, 2) && hasReq(p, soulRune, 2)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, deathRune, 2, bloodRune, 2, airRune, 2, soulRune, 2);
anim(p, 1978);
n.requestGFX(381, 0);
int hitdmg = Misc.random(23);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 41);
giveHPXP(p, hitdmg * 4 + 39);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 76 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 133: // Blood Blitz
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 80) {
if (hasReq(p, deathRune, 2) && hasReq(p, bloodRune, 4)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, deathRune, 2, bloodRune, 4);
anim(p, 1978);
n.requestGFX(375, 0);
int hitdmg = Misc.random(24);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 43);
giveHPXP(p, hitdmg * 4 + 41);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 80 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 129: // Ice Blitz
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 82) {
if (hasReq(p, deathRune, 2) && hasReq(p, waterRune, 3)
&& hasReq(p, bloodRune, 2)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, deathRune, 2, waterRune, 3, bloodRune, 2);
anim(p, 1978);
n.requestGFX(367, 0);
int hitdmg = Misc.random(25);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 45);
giveHPXP(p, hitdmg * 4 + 43);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 82 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 139: // Smoke Barrage
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 86) {
if (hasReq(p, deathRune, 4) && hasReq(p, fireRune, 4)
&& hasReq(p, bloodRune, 2) && hasReq(p, airRune, 4)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, deathRune, 4, fireRune, 4, bloodRune, 2, airRune, 4);
anim(p, 1979);
n.requestGFX(391, 0);
int hitdmg = Misc.random(26);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 47);
giveHPXP(p, hitdmg * 4 + 45);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 86 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 143: // Shadow Barrage
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 88) {
if (hasReq(p, deathRune, 4) && hasReq(p, soulRune, 3)
&& hasReq(p, bloodRune, 2) && hasReq(p, airRune, 4)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, deathRune, 2, soulRune, 2, bloodRune, 2, airRune, 2);
anim(p, 1978);
n.requestGFX(383, 0);
int hitdmg = Misc.random(27);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 49);
giveHPXP(p, hitdmg * 4 + 47);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 88 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 135: // Blood Barrage
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 92) {
if (hasReq(p, deathRune, 4) && hasReq(p, soulRune, 1)
&& hasReq(p, bloodRune, 4)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, deathRune, 4, soulRune, 1, bloodRune, 4);
anim(p, 1979);
n.requestGFX(377, 0);
int hitdmg = Misc.random(28);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 51);
giveHPXP(p, hitdmg * 4 + 49);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 92 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
case 131: // Ice Barrage
if (p.magicDelay <= 0) {
if (MagicLevel(p) >= 94) {
if (hasReq(p, deathRune, 4) && hasReq(p, waterRune, 6)
&& hasReq(p, bloodRune, 2)) {
p.stopMovement(p);
face(p, n.npcId);
deleteItems(p, deathRune, 4, waterRune, 6, bloodRune, 2);
anim(p, 1979);
n.requestGFX(369, 0);
int hitdmg = Misc.random(29);
n.appendHit(hitdmg, 0);
giveMagicXP(p, hitdmg * 4 + 53);
giveHPXP(p, hitdmg * 4 + 51);
p.combatDelay += p.attackDelay;
p.magicDelay = mainDelayInt;
} else {
sendMsg(p,
"You dont have the required runes for this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p,
"You need level 94 magic to use this spell.");
p.magicDelay = mainDelayInt;
}
} else {
sendMsg(p, "You need to wait before casting a spell again.");
p.clickDelay = mainClickDelay;
}
break;
default:
Misc.println("["+p.username+"]: button: "+buttonId);
break;
}
}
}
}
Next, open PacketManager at Bulby\io.
Find:
public MagicOnPlayer magicOnPlayer = new MagicOnPlayer();
Add this after it:
public MagicOnNPC magicOnNPC = new MagicOnNPC();
Find:
switch (packetId) {
Add this after it:
case 24://magic on npc by I loot I aka Lootface
MagicOnNPC.magicAop(p, packetId, packetSize);
//Misc.println("["+p.username+"]: packet: "+packetId);
break;
Here you go. Rate and reply, please. :)