Jump to content
Sign in to follow this  
Dave

[PI] Adding Nex (With stages) [PI]

Recommended Posts

Note this system is from Virtue, I take no credit.

In NPCHandler.java declare:

[CODE] public static int nexCountDown = 0;
public boolean[] nexRoom = new boolean[4];[/CODE]

and then find public static int getAttackEmote(int i) { under switch (NPCHandler.npcs[i].npcType) { add:

[CODE]case 5633:
if(npcs[i].nexStage == 1 || npcs[i].nexStage == 2) {
switch(npcs[i].glod) {
case 1:
return 6987;
case 2:
return 6986;
}
}
else if(npcs[i].nexStage == 3 || npcs[i].nexStage == 4) {
switch(npcs[i].glod) {
case 1:
return 6987;
case 2:
return 6355;
case 3:
return 6984;
}
}
else if(npcs[i].nexStage == 5 || npcs[i].nexStage == 6) {
switch(npcs[i].glod) {
case 1:
case 2:
return 6987;
case 3:
return 6948;
}
}
else if(npcs[i].nexStage == 7 || npcs[i].nexStage == 8) {
switch(npcs[i].glod) {
case 1:
case 2:
case 3:
return 6987;
}
}
else if(npcs[i].nexStage == 9) {
switch(npcs[i].glod) {
case 1:
return 6987;
}
}
return 6354;[/CODE]


Now under: public void hitTargetPlayer(Client c, int i, int hit) { add this under npcEffect(c, i, hit);

[CODE]if(npcs[i].npcType == 5633) {
switch(npcs[i].nexStage) {
case 1:
case 2:
if(npcs[i].glod == 2) {
if(c.virusDamage == 0) {
c.virusTimer = 10;
c.virusDamage = 5;
c.forcedChat("*Cough*");
}
}
if(npcs[i].HP < 2400 && npcs[i].nexStage == 1) {
npcs[i].forceChat("Fumus, don't fail me!");
npcs[i].nexStage = 2;
nexRoom[0] = true;
}
break;
case 3:
case 4:
if(npcs[i].glod == 3) {
for(int fs = 0; fs < npcs[i].fearShadow.length; fs++) {
if(npcs[i].fearShadow[fs][0] == 0) {
npcs[i].fearShadow[fs][0] = c.absX;
npcs[i].fearShadow[fs][1] = c.absY;
break;
}
}
final int DMG = Misc.random(60);
final Client c1 = c;
final int I = i;
EventManager.getSingleton().addEvent(new Event() {
public void execute(EventContainer e) {
for(int ii = 0; ii < npcs[I].fearShadow.length; ii++) {
if(npcs[I].fearShadow[ii][0] > 0) {
if(c1.absX == npcs[I].fearShadow[ii][0] && c1.absY == npcs[I].fearShadow[ii][1]) {
c1.setHitDiff(DMG);
c1.playerLevel[3] -= DMG;
c1.getPA().refreshSkill(3);
c1.updateRequired = true;
c1.setHitUpdateRequired(true);
c1.logoutDelay = 20;
npcs[I].fearShadow[ii][0] = npcs[I].fearShadow[ii][1] = 0;
return;
} else {
npcs[I].fearShadow[ii][0] = npcs[I].fearShadow[ii][1] = 0;
return;
}
}
}
e.stop();
}
}, 1800);
return;
}
if(npcs[i].HP < 1800 && npcs[i].nexStage == 3) {
npcs[i].forceChat("Umbra, don't fail me!");
npcs[i].nexStage = 4;
nexRoom[1] = true;
}
break;
case 5:
case 6:
if(npcs[i].glod == 2) {
npcs[i].HP += hit;
if(npcs[i].HP > npcs[i].MaxHP) {
npcs[i].HP = npcs[i].MaxHP;
}
c.playerLevel[5] /= 2;
}
if(npcs[i].glod == 3) {
for(int t = 0; t < 1+Misc.random(2); t++) {
newNPC3(7643, (npcs[i].absX+1)+Misc.random(2), (npcs[i].absY+1)+Misc.random(2), 0, 0, 101, 15, 140, 10, 2);
}
npcs[i].cooldown = 30;
return;
}
if(npcs[i].HP < 1200 && npcs[i].nexStage == 5) {
npcs[i].forceChat("Cruor, don't fail me!");
npcs[i].nexStage = 6;
nexRoom[2] = true;
}
break;
case 7:
case 8:
if(npcs[i].glod == 1) {
if(c.freezeTimer < 0) {
c.stopMovement();
c.sendMessage("You have been frozen!");
c.freezeTimer = 30;
}
}
else if(npcs[i].glod == 2) {
if(npcs[i].CONTAIN_THIS[0][0] > 0) {
if(c.absX > npcs[i].CONTAIN_THIS[0][0] && c.absX < npcs[i].CONTAIN_THIS[1][0]
&& c.absY > npcs[i].CONTAIN_THIS[0][1] && c.absY < npcs[i].CONTAIN_THIS[1][1]) {
int iced = Misc.random(65);
c.setHitDiff(iced);
c.playerLevel[3] -= iced;
c.getPA().refreshSkill(3);
c.updateRequired = true;
c.setHitUpdateRequired(true);
c.logoutDelay = 20;
return;
} else {
return;
}
}
}
else if(npcs[i].glod == 3) {
c.stopMovement();
int iced = Misc.random(60);
c.setHitDiff(iced);
c.playerLevel[3] -= iced;
c.getPA().refreshSkill(3);
c.updateRequired = true;
c.setHitUpdateRequired(true);
c.logoutDelay = 20;
return;
} else {
return;
}
if(npcs[i].HP < 600 && npcs[i].nexStage == 7) {
npcs[i].forceChat("Glacies, don't fail me!");
npcs[i].nexStage = 8;
nexRoom[3] = true;
}
break;
case 9:
if(npcs[i].prayerUsed == 1) {
npcs[i].HP += hit/5;
}
break;
}
}[/CODE]


Now in public void attackPlayer(Client c, int i) { add:

[CODE]} else if(npcs[i].npcType == 5633) {
if(npcs[i].nexStage == 7 || npcs[i].nexStage == 8) {
if(npcs[i].glod == 2) {
npcs[i].CONTAIN_THIS[0][0] = npcs[i].absX-2;
npcs[i].CONTAIN_THIS[0][1] = npcs[i].absY-2;
npcs[i].CONTAIN_THIS[1][0] = npcs[i].absX+2;
npcs[i].CONTAIN_THIS[1][1] = npcs[i].absY+2;
int obx = 0, oby = 0;
for(int s = 0; s < 4; s++) {
c.getPA().globalObject(534, npcs[i].CONTAIN_THIS[0][0]+obx, npcs[i].CONTAIN_THIS[0][1], 0, 10, 0);
c.getPA().globalObject(534, npcs[i].CONTAIN_THIS[1][0]-obx, npcs[i].CONTAIN_THIS[1][1], 0, 10, 0);
c.getPA().globalObject(534, npcs[i].CONTAIN_THIS[1][0], npcs[i].CONTAIN_THIS[0][1]+oby, 0, 10, 0);
c.getPA().globalObject(534, npcs[i].CONTAIN_THIS[0][0], npcs[i].CONTAIN_THIS[1][1]-oby, 0, 10, 0);
obx++;
oby++;
}
final Client c1 = c;
final int I = i;
EventManager.getSingleton().addEvent(new Event() {
public void execute(EventContainer e) {
int obX = 0, obY = 0;
for(int s = 0; s < 4; s++) {
c1.getPA().globalObject(-1, npcs[I].CONTAIN_THIS[0][0]+obX, npcs[I].CONTAIN_THIS[0][1], 0, 10, 0);
c1.getPA().globalObject(-1, npcs[I].CONTAIN_THIS[1][0]-obX, npcs[I].CONTAIN_THIS[1][1], 0, 10, 0);
c1.getPA().globalObject(-1, npcs[I].CONTAIN_THIS[1][0], npcs[I].CONTAIN_THIS[0][1]+obY, 0, 10, 0);
c1.getPA().globalObject(-1, npcs[I].CONTAIN_THIS[0][0], npcs[I].CONTAIN_THIS[1][1]-obY, 0, 10, 0);
obX++;
obY++;
}
npcs[I].CONTAIN_THIS[0][0] = 0;
e.stop();
}
}, 4000);
} else if(npcs[i].glod == 3) {
c.getPA().globalObject(534, c.absX-1, c.absY-1, 0, 10, 0);
c.getPA().globalObject(534, c.absX, c.absY-1, 0, 10, 0);
c.getPA().globalObject(534, c.absX+1, c.absY-1, 0, 10, 0);
c.getPA().globalObject(534, c.absX+1, c.absY, 0, 10, 0);
c.getPA().globalObject(534, c.absX+1, c.absY+1, 0, 10, 0);
c.getPA().globalObject(534, c.absX, c.absY+1, 0, 10, 0);
c.getPA().globalObject(534, c.absX-1, c.absY+1, 0, 10, 0);
c.getPA().globalObject(534, c.absX-1, c.absY, 0, 10, 0);
final Client c1 = c;
final int I = i;
EventManager.getSingleton().addEvent(new Event() {
public void execute(EventContainer e) {
c1.getPA().globalObject(-1, c1.absX-1, c1.absY-1, 0, 10, 0);
c1.getPA().globalObject(-1, c1.absX, c1.absY-1, 0, 10, 0);
c1.getPA().globalObject(-1, c1.absX+1, c1.absY-1, 0, 10, 0);
c1.getPA().globalObject(-1, c1.absX+1, c1.absY, 0, 10, 0);
c1.getPA().globalObject(-1, c1.absX+1, c1.absY+1, 0, 10, 0);
c1.getPA().globalObject(-1, c1.absX, c1.absY+1, 0, 10, 0);
c1.getPA().globalObject(-1, c1.absX-1, c1.absY+1, 0, 10, 0);
c1.getPA().globalObject(-1, c1.absX-1, c1.absY, 0, 10, 0);
e.stop();
}
}, 4000);
}
}
}[/CODE]

Under public static int distanceRequired(int i) { add:

[CODE]case 5633:
Client c11 = (Client)PlayerHandler.players[npcs[i].killerId];
if(goodDistance(npcs[i].absX, npcs[i].absY, c11.absX, c11.absY, 1 + npcs[i].getTotalNPCSize())) {
if(npcs[i].nexStage == 1 || npcs[i].nexStage == 2) {
npcs[i].glod = Misc.random2(2);
}
else if((npcs[i].nexStage == 3 || npcs[i].nexStage == 4) || (npcs[i].nexStage == 5 || npcs[i].nexStage == 6) || (npcs[i].nexStage == 7 || npcs[i].nexStage == 8)) {
npcs[i].glod = Misc.random2(3);
}
else if(npcs[i].nexStage == 9) {
npcs[i].glod = Misc.random(1);
}
} else {
if(npcs[i].nexStage == 1 || npcs[i].nexStage == 2) {
npcs[i].glod = 1+Misc.random2(1);
}
else if((npcs[i].nexStage == 3 || npcs[i].nexStage == 4) || (npcs[i].nexStage == 5 || npcs[i].nexStage == 6) || (npcs[i].nexStage == 7 || npcs[i].nexStage == 8)) {
npcs[i].glod = 1+Misc.random2(2);
}
else if(npcs[i].nexStage == 9) {
npcs[i].glod = 1;
}
}
if(npcs[i].cooldown > 0) {
if(((npcs[i].nexStage == 1 || npcs[i].nexStage == 2) && npcs[i].glod == 2) ||
((npcs[i].nexStage == 3 || npcs[i].nexStage == 4) && npcs[i].glod == 2) ||
((npcs[i].nexStage == 5 || npcs[i].nexStage == 6) && npcs[i].glod == 2 || npcs[i].glod == 3) ||
((npcs[i].nexStage == 7 || npcs[i].nexStage == 8) && (npcs[i].glod == 2 || npcs[i].glod == 3))) {
npcs[i].glod = 1;
}
}
return 6 + npcs[i].getNPCSize();[/CODE]

under getDeadEmote:

[CODE] case 5633:
return 6951;[/CODE]
under public int getHitDelay(int i) { add:

[CODE]case 5633:

if(npcs[i].nexStage == 1 || npcs[i].nexStage == 2) {
switch(npcs[i].glod){
case 1:
case 2:
return 4;
}
}
else if(npcs[i].nexStage == 3 || npcs[i].nexStage == 4) {
switch(npcs[i].glod){
case 1:
case 2:
return 4;
}
}
else if(npcs[i].nexStage == 5 || npcs[i].nexStage == 6) {
switch(npcs[i].glod){
case 1:
case 2:
return 4;
}
}
else if(npcs[i].nexStage == 7 || npcs[i].nexStage == 8) {
switch(npcs[i].glod){
case 1:
return 4;
case 2:
case 3:
return 6;
}
}
else if(npcs[i].nexStage == 9) {
switch(npcs[i].glod){
case 1:
return 4;
}
}
return 2;[/CODE]

Under public int getNpcDelay(final int i) { add:

[CODE]case 5633:
if((npcs[i].nexStage == 3 || npcs[i].nexStage == 4) && npcs[i].glod == 3) {
return 8;
}
if((npcs[i].nexStage == 5 || npcs[i].nexStage == 6) && npcs[i].glod == 3) {
return 18;
}
if((npcs[i].nexStage == 7 || npcs[i].nexStage == 8) && (npcs[i].glod == 2 || npcs[i].glod == 3)) {
return 8;
}
return 6;[/CODE]

Now find public int getProjectileSpeed(int i) { under it find and switch(npcs[i].npcType) { and this under it:

[CODE] case 5633:
return 100;[/CODE]

In getRespawnTime add:

[CODE] case 5633:
return 300[/CODE]

Now find public void loadSpell(Client c, int i) { and add:


[CODE]case 5633:
if(npcs[i].nexStage == 1 || npcs[i].nexStage == 2) {
if(npcs[i].glod == 1) {
npcs[i].multiAttack = true;
npcs[i].attackType = 2;
npcs[i].projectileId = 386;
npcs[i].endGfx = 390;
} else if(npcs[i].glod == 2) {
npcs[i].forceChat("Let the virus flow through you!");
npcs[i].multiAttack = true;
npcs[i].attackType = 4;
npcs[i].projectileId = -1;
npcs[i].endGfx = -1;
npcs[i].cooldown = 30;
} else {
npcs[i].attackType = 0;
npcs[i].projectileId = -1;
npcs[i].endGfx = -1;
}
}
else if(npcs[i].nexStage == 3 || npcs[i].nexStage == 4) {
if(npcs[i].glod == 1) {
npcs[i].multiAttack = true;
npcs[i].attackType = 1;
npcs[i].projectileId = 378;
npcs[i].endGfx = -1;
} else if(npcs[i].glod == 2) {
npcs[i].forceChat("Embrace darkness!");
npcs[i].multiAttack = true;
npcs[i].attackType = 4;
npcs[i].projectileId = -1;
npcs[i].endGfx = -1;
npcs[i].cooldown = 30;
} else if(npcs[i].glod == 3) {
npcs[i].forceChat("Fear the shadow!");
npcs[i].multiAttack = true;
npcs[i].attackType = 4;
npcs[i].projectileId = -1;
npcs[i].endGfx = 382;
} else {
npcs[i].attackType = 0;
npcs[i].projectileId = -1;
npcs[i].endGfx = -1;
}
}
else if(npcs[i].nexStage == 5 || npcs[i].nexStage == 6) {
if(npcs[i].glod == 1) {
npcs[i].multiAttack = true;
npcs[i].attackType = 2;
npcs[i].projectileId = 374;
npcs[i].endGfx = 376;
} else if(npcs[i].glod == 2) {
npcs[i].forceChat("I demand a blood sacrifice!");
npcs[i].multiAttack = true;
npcs[i].attackType = 2;
npcs[i].projectileId = -1;
npcs[i].endGfx = 377;
npcs[i].cooldown = 20;
} else if(npcs[i].glod == 3) {
npcs[i].forceChat("A siphon will solve this!");
npcs[i].attackType = 2;
npcs[i].projectileId = -1;
npcs[i].endGfx = -1;
} else {
npcs[i].attackType = 0;
npcs[i].projectileId = -1;
npcs[i].endGfx = -1;
}
}
else if(npcs[i].nexStage == 7 || npcs[i].nexStage == 8) {
if(npcs[i].glod == 1) {
npcs[i].multiAttack = true;
npcs[i].attackType = 2;
npcs[i].projectileId = 362;
npcs[i].endGfx = 369;
} else if(npcs[i].glod == 2) {
npcs[i].forceChat("Contain this!");
npcs[i].multiAttack = true;
npcs[i].attackType = 2;
npcs[i].projectileId = -1;
npcs[i].endGfx = -1;
npcs[i].cooldown = 16;
} else if(npcs[i].glod == 3) {
npcs[i].forceChat("Die now, in a prison of ice!");
npcs[i].attackType = 2;
npcs[i].projectileId = -1;
npcs[i].endGfx = -1;
npcs[i].cooldown = 16;
} else {
npcs[i].attackType = 0;
npcs[i].projectileId = -1;
npcs[i].endGfx = -1;
}
}
else if(npcs[i].nexStage == 9) {
if(npcs[i].glod == 1) {
npcs[i].multiAttack = true;
npcs[i].attackType = 2;
npcs[i].projectileId = 386;
npcs[i].endGfx = 390;
} else {
npcs[i].attackType = 0;
npcs[i].projectileId = (npcs[i].prayerUsed == 1 ? 2263:-1);
npcs[i].endGfx = (npcs[i].prayerUsed == 1 ? 2264:-1);
}
}
break; [/CODE]

now find public void multiAttackDamage(final int i) { replace the whole void with this:

[CODE] public void multiAttackDamage(final int i) {
int dmg2 = npcs[i].maxHit;
final int max = getMaxHit(i);
for (final Player player : PlayerHandler.players) {
if (player != null) {
final Client c = (Client) player;
if (c.isDead || c.heightLevel != NPCHandler.npcs[i].heightLevel) {
continue;
}
if (player.goodDistance(c.absX, c.absY,
NPCHandler.npcs[i].absX, NPCHandler.npcs[i].absY, 15)) {
if (NPCHandler.npcs[i].attackType == 2) {
if ((15 + Misc.random(c.getCombat().calculateMagicDefence()) < Misc.random(Server.npcHandler.npcs[i].attack)) && !c.prayerActive[16]) {
int damage = Misc.random(dmg2);
switch(npcs[i].npcType) {
case 6222:
damage = Misc.random(21);
break;
case 6203:
damage = Misc.random(30);
break;
case 3072:
damage = Misc.random(20);
break;
case 5633:
damage = Misc.random((55));
break;
}
npcs[i].multiAttack = false;
hitTargetPlayer(c, i, damage);
} else {
int damage = Misc.random(dmg2);
npcs[i].multiAttack = false;
if(npcs[i].npcType == 3072 && npcs[i].dragon == 5) {
hitTargetPlayer(c, i, damage/2);
}
if(npcs[i].npcType == 5633) {
hitTargetPlayer(c, i, damage/2);
} else {
npcs[i].multiAttack = false;
c.gfx100(85);
return;
}
}
} else if (NPCHandler.npcs[i].attackType == 1) {
if ((15 + Misc.random(c.getCombat().calculateRangeDefence()) < Misc.random(Server.npcHandler.npcs[i].attack)) && !c.prayerActive[17]) {
int damage = Misc.random(dmg2);
if(npcs[i].npcType == 6260) {
damage = Misc.random(35);
}
else if(npcs[i].npcType == 3072) {
damage = Misc.random(25);
}
else if(npcs[i].npcType == 5633) {
damage = Misc.random(40);
}
npcs[i].multiAttack = false;
hitTargetPlayer(c, i, damage);
} else {
npcs[i].multiAttack = false;
hitTargetPlayer(c, i, (npcs[i].npcType == 5633 ? Misc.random(40/2):0));
}
}
if (NPCHandler.npcs[i].endGfx > 0) {
c.gfx0(NPCHandler.npcs[i].endGfx);
}
}
c.getPA().refreshSkill(3);
}
}
}[/CODE]

find public boolean multiAttackingNPC(int i) { & add case 5633: (or the ID for Nex).

Now, find: public void process() { and add this somewhere:

[CODE]if(npcs[i].npcType == 5633) {
if(nexCountDown > 0) {
nexCountDown--;
if(npcs[i].nexStage == 0) {
if(nexCountDown == 24) {
npcs[i].forceChat("AT LAST!");
}
else if(nexCountDown == 18) {
npcs[i].forceChat("Fumus!");
npcs[i].startAnimation(6987);
npcs[i].turnNpc(2552, 4967);
}
else if(nexCountDown == 14) {
npcs[i].forceChat("Umbra!");
npcs[i].startAnimation(6987);
npcs[i].turnNpc(2567, 4967);
}
else if(nexCountDown == 10) {
npcs[i].forceChat("Cruor!");
npcs[i].startAnimation(6987);
npcs[i].turnNpc(2567, 4952);
}
else if(nexCountDown == 6) {
npcs[i].forceChat("Glacies!");
npcs[i].startAnimation(6987);
npcs[i].turnNpc(2552, 4952);
}
else if(nexCountDown == 2) {
npcs[i].forceChat("Fill my soul with smoke!");
npcs[i].nexStage = 1;
}
}
else if(npcs[i].nexStage == 2) {
if(nexCountDown == 1) {
npcs[i].forceChat("Darken my shadow!");
npcs[i].nexStage = 3;
}
}
else if(npcs[i].nexStage == 4) {
if(nexCountDown == 1) {
npcs[i].forceChat("Flood my lungs with blood!");
npcs[i].nexStage = 5;
}
}
else if(npcs[i].nexStage == 6) {
if(nexCountDown == 1) {
npcs[i].forceChat("Infuse me with the power of ice!");
npcs[i].nexStage = 7;
}
}
else if(npcs[i].nexStage == 8) {
if(nexCountDown == 1) {
npcs[i].forceChat("NOW, THE POWER OF ZAROS!");
npcs[i].nexStage = 9;
nexCountDown = 10;
npcs[i].HP += 600;
npcs[i].startAnimation(6326);
NPCHandler.npcs[i].updateRequired = true;
}
}
}
}[/CODE]

now find handleJadDeath under the } under it add:

[CODE] if(npcs[i].npcType == 5633) {
npcs[i].requestTransform(5636);
npcs[i].forceChat("Taste my wrath!");
npcs[i].gfx0(2259);
}[/CODE]

now find npcs[i].isDead) { and add this somewherE:

[CODE] } else if(npcs[i].npcType == 5633) {
newNPC3(5630, 2552, 4967, 0, 0, 600, 32, 120, 100, 4);
newNPC3(5632, 2567, 4967, 0, 0, 600, 32, 120, 100, 4);
newNPC3(5631, 2567, 4952, 0, 0, 600, 32, 120, 100, 4);
newNPC3(5629, 2552, 4952, 0, 0, 600, 32, 120, 100, 4);
for(int nr = 0; nr < nexRoom.length; nr++) {
nexRoom[nr] = false;
}
}[/CODE]

Now open NPC.java

add declare

[CODE] int npcSize;
public int prayerUsed = 0;
public int extraHitDelay = 0, glod, deadCyle = 1;
public final int[][] fearShadow = new int[100][100];
public int diliHits = 30, nexStage = 0, cooldown = 0, mustDie = 0;
/**
* Face
*/
public int FocusPointX = -1, FocusPointY = -1;
public int face = 0;[/CODE]

now add this somewhere:

[CODE] public String Glod() {
int talk = Misc.random(2);
switch(talk) {
case 1:
return "Glod Angry!";
case 2:
return "Glod Bash!";
}
return "Glod Smash!";
}[/CODE]

add the following anywhere:

[CODE] public void turnNpc(final int i, final int j) {
FocusPointX = 2 * i + 1;
FocusPointY = 2 * j + 1;
updateRequired = true;

}[/CODE]

Now open up Player.Java and add this somewhere:

[CODE] public void poisonProcess() {
Client p = (Client) Server.playerHandler.players[playerId];
if(virusTimer > -1) {
virusTimer--;
if (virusTimer == 0 && virusDamage > 0) {
forcedChat("*Cough*");
playerLevel[3] -= (playerLevel[3] - virusDamage < 0 ? playerLevel[3]:virusDamage);
setHitDiff(virusDamage);
setHitUpdateRequired(true);
updateRequired = true;
p.getPA().refreshSkill(3);
virusTimer = 10;
virusDamage--;
if(virusDamage == 0) {
virusTimer = -1;
p.sendMessage("The smoke clouds around you dissipate.");
}
}
}
}[/CODE]

Now find public final int[] PRAYER_DRAIN_RATE = above that add:

[CODE]public int virusTimer = -1, virusDamage = 0;
public byte poisonMask = 0,[/CODE]

Finally add a new class in server.model.npc, call the class NPCSize:

[CODE]package server.model.npc;

/**
* NPC Sizes.
*
* @author Primadude.
*/
public class NPCSize {

/**
* Gets the size of the specified NPC.
*
* @param npcType
* The type of the NPC.
* @return The NPC size.
*/
public static int getNPCSize(int npcType) {
int NPC_TYPE = 0;
int NPC_SIZE = 1;
for (int i = 0; i < NPC_SIZES.length; i++) {
if (npcType == NPC_SIZES[i][NPC_TYPE]) {
return NPC_SIZES[i][NPC_SIZE];
}
}
if(npcType >= 9948 && npcType <= 9957) {
return 5;
} else if(npcType >= 9912 && npcType <= 9928) {
return 2;
} else if(npcType == 9727) {
return 4;
}
return 1;
}

/**
* NPC Sizes. {NPC TYPE, SIZE}.
*/
private static final int[][] NPC_SIZES = { { 49, 2 }, { 50, 5 }, { 51, 2 },
{ 52, 2 }, { 53, 4 }, { 54, 4 }, { 55, 4 }, { 69, 2 }, { 78, 2 },
{ 79, 2 }, { 80, 2 }, { 81, 2 }, { 82, 2 }, { 83, 3 }, { 84, 3 },
{ 85, 2 }, { 86, 2 }, { 87, 2 }, { 88, 2 }, { 89, 2 }, { 95, 2 },
{ 96, 2 }, { 97, 2 }, { 105, 2 }, { 106, 2 }, { 107, 2 },
{ 108, 2 }, { 110, 2 }, { 111, 2 }, { 112, 2 }, { 113, 2 },
{ 114, 2 }, { 115, 2 }, { 116, 2 }, { 117, 2 }, { 130, 3 },
{ 133, 2 }, { 135, 3 }, { 136, 2 }, { 137, 2 }, { 138, 2 },
{ 141, 2 }, { 142, 2 }, { 143, 2 }, { 144, 2 }, { 146, 2 },
{ 147, 2 }, { 148, 2 }, { 149, 2 }, { 150, 2 }, { 269, 2 },
{ 270, 2 }, { 271, 2 }, { 374, 2 }, { 397, 2 }, { 446, 2 },
{ 667, 3 }, { 677, 3 }, { 742, 4 }, { 752, 2 }, { 839, 2 },
{ 840, 2 }, { 852, 2 }, { 853, 2 }, { 854, 2 }, { 855, 2 },
{ 856, 2 }, { 857, 2 }, { 858, 2 }, { 859, 2 }, { 860, 2 },
{ 861, 2 }, { 862, 2 }, { 863, 2 }, { 864, 2 }, { 865, 2 },
{ 866, 2 }, { 867, 2 }, { 868, 2 }, { 869, 2 }, { 870, 2 },
{ 871, 2 }, { 873, 2 }, { 874, 2 }, { 875, 2 }, { 876, 2 },
{ 879, 2 }, { 880, 2 }, { 899, 2 }, { 909, 3 }, { 911, 3 },
{ 934, 3 }, { 939, 2 }, { 941, 4 }, { 950, 2 }, { 955, 2 },
{ 978, 2 }, { 986, 2 }, { 987, 2 }, { 991, 2 }, { 997, 3 },
{ 998, 3 }, { 999, 3 }, { 1000, 3 }, { 1003, 2 }, { 1005, 2 },
{ 1010, 2 }, { 1047, 2 }, { 1052, 2 }, { 1053, 2 }, { 1069, 2 },
{ 1095, 2 }, { 1096, 2 }, { 1097, 2 }, { 1098, 2 }, { 1099, 2 },
{ 1100, 2 }, { 1115, 2 }, { 1116, 2 }, { 1117, 2 }, { 1125, 3 },
{ 1126, 2 }, { 1127, 2 }, { 1128, 2 }, { 1129, 2 }, { 1135, 2 },
{ 1136, 2 }, { 1137, 2 }, { 1139, 2 }, { 1151, 2 }, { 1153, 2 },
{ 1154, 3 }, { 1155, 4 }, { 1156, 2 }, { 1157, 4 }, { 1158, 5 },
{ 1159, 5 }, { 1160, 5 }, { 1172, 3 }, { 1173, 3 }, { 1179, 2 },
{ 1180, 2 }, { 1181, 2 }, { 1195, 2 }, { 1196, 2 }, { 1197, 2 },
{ 1198, 2 }, { 1213, 2 }, { 1222, 2 }, { 1224, 2 }, { 1326, 2 },
{ 1328, 2 }, { 1329, 2 }, { 1330, 2 }, { 1335, 2 }, { 1341, 2 },
{ 1342, 2 }, { 1343, 2 }, { 1344, 2 }, { 1345, 2 }, { 1346, 2 },
{ 1347, 2 }, { 1348, 3 }, { 1349, 3 }, { 1350, 3 }, { 1351, 3 },
{ 1352, 3 }, { 1353, 3 }, { 1354, 3 }, { 1355, 3 }, { 1356, 3 },
{ 1373, 2 }, { 1431, 2 }, { 1432, 2 }, { 1438, 2 }, { 1459, 2 },
{ 1460, 2 }, { 1461, 2 }, { 1462, 2 }, { 1472, 3 }, { 1505, 2 },
{ 1506, 2 }, { 1507, 2 }, { 1508, 2 }, { 1509, 2 }, { 1516, 3 },
{ 1521, 2 }, { 1522, 2 }, { 1542, 3 }, { 1555, 2 }, { 1556, 2 },
{ 1558, 2 }, { 1559, 2 }, { 1575, 2 }, { 1578, 3 }, { 1580, 2 },
{ 1581, 2 }, { 1582, 2 }, { 1583, 2 }, { 1584, 2 }, { 1585, 2 },
{ 1586, 2 }, { 1587, 2 }, { 1588, 2 }, { 1589, 2 }, { 1590, 4 },
{ 1591, 4 }, { 1592, 4 }, { 1600, 2 }, { 1601, 2 }, { 1602, 2 },
{ 1603, 2 }, { 1604, 2 }, { 1605, 2 }, { 1606, 2 }, { 1607, 2 },
{ 1608, 3 }, { 1609, 3 }, { 1610, 3 }, { 1611, 3 }, { 1612, 2 },
{ 1616, 2 }, { 1617, 2 }, { 1618, 2 }, { 1619, 2 }, { 1620, 2 },
{ 1621, 3 }, { 1627, 2 }, { 1628, 2 }, { 1631, 2 }, { 1632, 2 },
{ 1653, 2 }, { 1654, 2 }, { 1655, 2 }, { 1656, 2 }, { 1657, 2 },
{ 1676, 2 }, { 1677, 2 }, { 1681, 2 }, { 1689, 3 }, { 1691, 2 },
{ 1693, 2 }, { 1719, 2 }, { 1720, 2 }, { 1721, 2 }, { 1722, 2 },
{ 1723, 2 }, { 1728, 2 }, { 1730, 2 }, { 1731, 2 }, { 1732, 2 },
{ 1733, 2 }, { 1734, 2 }, { 1735, 2 }, { 1736, 2 }, { 1737, 2 },
{ 1738, 2 }, { 1739, 3 }, { 1740, 3 }, { 1741, 2 }, { 1742, 3 },
{ 1743, 3 }, { 1744, 3 }, { 1745, 2 }, { 1746, 2 }, { 1747, 3 },
{ 1748, 3 }, { 1750, 2 }, { 1766, 2 }, { 1767, 2 }, { 1768, 2 },
{ 1778, 2 }, { 1779, 2 }, { 1780, 2 }, { 1781, 2 }, { 1782, 2 },
{ 1783, 2 }, { 1784, 2 }, { 1785, 2 }, { 1786, 2 }, { 1787, 2 },
{ 1792, 2 }, { 1802, 2 }, { 1803, 2 }, { 1804, 2 }, { 1811, 2 },
{ 1812, 2 }, { 1813, 2 }, { 1821, 2 }, { 1828, 2 }, { 1873, 2 },
{ 1943, 2 }, { 1944, 2 }, { 1945, 2 }, { 1946, 2 }, { 1951, 2 },
{ 1952, 2 }, { 1953, 2 }, { 1954, 2 }, { 1955, 2 }, { 1956, 2 },
{ 1970, 2 }, { 1971, 2 }, { 1990, 2 }, { 1993, 2 }, { 1996, 2 },
{ 1998, 2 }, { 1999, 2 }, { 2000, 2 }, { 2022, 3 }, { 2033, 2 },
{ 2038, 2 }, { 2039, 2 }, { 2040, 2 }, { 2041, 2 }, { 2042, 2 },
{ 2043, 2 }, { 2044, 2 }, { 2045, 2 }, { 2046, 2 }, { 2047, 2 },
{ 2048, 2 }, { 2049, 2 }, { 2050, 2 }, { 2051, 2 }, { 2052, 2 },
{ 2053, 2 }, { 2054, 2 }, { 2055, 2 }, { 2056, 2 }, { 2057, 2 },
{ 2060, 3 }, { 2063, 2 }, { 2064, 2 }, { 2065, 2 }, { 2240, 2 },
{ 2252, 2 }, { 2254, 2 }, { 2255, 2 }, { 2289, 2 }, { 2317, 2 },
{ 2417, 2 }, { 2418, 2 }, { 2419, 2 }, { 2434, 2 }, { 2452, 2 },
{ 2453, 2 }, { 2482, 2 }, { 2534, 3 }, { 2554, 3 }, { 2555, 3 },
{ 2556, 3 }, { 2557, 3 }, { 2558, 3 }, { 2559, 3 }, { 2560, 3 },
{ 2561, 3 }, { 2562, 3 }, { 2563, 3 }, { 2629, 2 }, { 2630, 2 },
{ 2631, 3 }, { 2632, 3 }, { 2637, 2 }, { 2640, 2 }, { 2641, 3 },
{ 2642, 5 }, { 2644, 2 }, { 2651, 2 }, { 2722, 2 }, { 2723, 2 },
{ 2736, 2 }, { 2737, 2 }, { 2739, 3 }, { 2740, 3 }, { 2741, 4 },
{ 2742, 4 }, { 2743, 5 }, { 2744, 5 }, { 2745, 5 }, { 2783, 3 },
{ 2801, 2 }, { 2803, 3 }, { 2804, 2 }, { 2805, 2 }, { 2806, 2 },
{ 2809, 2 }, { 2810, 2 }, { 2811, 2 }, { 2812, 2 }, { 2813, 2 },
{ 2814, 2 }, { 2815, 2 }, { 2849, 2 }, { 2850, 2 }, { 2880, 2 },
{ 2881, 3 }, { 2882, 3 }, { 2883, 3 }, { 2885, 2 }, { 2886, 2 },
{ 2889, 2 }, { 2890, 2 }, { 2919, 3 }, { 2920, 3 }, { 2921, 3 },
{ 3051, 2 }, { 3052, 2 }, { 3053, 2 }, { 3054, 2 }, { 3055, 2 },
{ 3056, 2 }, { 3058, 2 }, { 3063, 2 }, { 3064, 2 }, { 3066, 2 },
{ 3068, 3 }, { 3069, 3 }, { 3070, 3 }, { 3071, 3 }, { 3072, 2 },
{ 3076, 2 }, { 3077, 2 }, { 3100, 2 }, { 3101, 2 }, { 3103, 2 },
{ 3124, 2 }, { 3125, 2 }, { 3129, 2 }, { 3130, 2 }, { 3132, 2 },
{ 3133, 2 }, { 3134, 2 }, { 3135, 2 }, { 3140, 3 }, { 3154, 2 },
{ 3200, 3 }, { 3203, 3 }, { 3301, 3 }, { 3309, 2 }, { 3332, 5 },
{ 3333, 5 }, { 3334, 5 }, { 3337, 3 }, { 3338, 3 }, { 3339, 4 },
{ 3340, 3 }, { 3347, 2 }, { 3376, 2 }, { 3398, 2 }, { 3419, 2 },
{ 3420, 2 }, { 3421, 2 }, { 3423, 2 }, { 3443, 2 }, { 3444, 2 },
{ 3445, 3 }, { 3446, 2 }, { 3447, 2 }, { 3448, 3 }, { 3463, 2 },
{ 3464, 2 }, { 3466, 2 }, { 3467, 2 }, { 3468, 2 }, { 3469, 5 },
{ 3470, 5 }, { 3471, 5 }, { 3472, 5 }, { 3476, 3 }, { 3477, 3 },
{ 3484, 2 }, { 3493, 3 }, { 3494, 5 }, { 3497, 3 }, { 3498, 3 },
{ 3499, 3 }, { 3500, 3 }, { 3501, 3 }, { 3502, 3 }, { 3519, 2 },
{ 3530, 3 }, { 3556, 2 }, { 3558, 2 }, { 3585, 2 }, { 3586, 2 },
{ 3587, 2 }, { 3588, 2 }, { 3589, 3 }, { 3590, 3 }, { 3591, 3 },
{ 3592, 3 }, { 3593, 3 }, { 3594, 2 }, { 3599, 3 }, { 3600, 4 },
{ 3601, 5 }, { 3602, 3 }, { 3603, 3 }, { 3604, 4 }, { 3605, 5 },
{ 3606, 2 }, { 3607, 2 }, { 3608, 2 }, { 3609, 2 }, { 3610, 2 },
{ 3611, 2 }, { 3612, 3 }, { 3613, 3 }, { 3614, 3 }, { 3636, 2 },
{ 3637, 4 }, { 3645, 2 }, { 3646, 2 }, { 3647, 2 }, { 3649, 2 },
{ 3650, 2 }, { 3651, 2 }, { 3652, 2 }, { 3653, 2 }, { 3654, 2 },
{ 3655, 2 }, { 3656, 2 }, { 3657, 2 }, { 3658, 3 }, { 3659, 3 },
{ 3660, 3 }, { 3661, 2 }, { 3662, 2 }, { 3664, 2 }, { 3665, 2 },
{ 3666, 2 }, { 3667, 2 }, { 3668, 2 }, { 3669, 2 }, { 3670, 2 },
{ 3675, 2 }, { 3676, 2 }, { 3681, 3 }, { 3772, 2 }, { 3773, 2 },
{ 3774, 2 }, { 3775, 2 }, { 3776, 2 }, { 6142, 3 }, { 6143, 3 },
{ 6144, 3 }, { 6145, 3 }, { 3808, 3 }, { 3819, 3 }, { 3835, 5 },
{ 3836, 5 }, { 5529, 2 }, { 6829, 2 }, { 6831, 2 }, { 6847, 2 },
{ 6994, 2 }, { 6871, 2 }, { 6847, 2 }, { 6853, 2 }, { 6875, 2 },
{ 6877, 2 }, { 6879, 2 }, { 6881, 2 }, { 6883, 2 }, { 6885, 2 },
{ 6887, 2 }, { 6855, 2 }, { 6794, 2 }, { 6857, 2 }, { 7363, 2 },
{ 7365, 2 }, { 7337, 2 }, { 6802, 2 }, { 6859, 2 }, { 6815, 2 },
{ 6813, 2 }, { 6839, 2 }, { 8575, 2 }, { 7345, 2 }, { 6861, 2 },
{ 7347, 2 }, { 6800, 2 }, { 7355, 2 }, { 7357, 2 }, { 7359, 2 },
{ 6811, 2 }, { 6804, 2 }, { 7341, 2 }, { 7329, 2 }, { 6863, 2 },
{ 6822, 2 }, { 7339, 2 }, { 7349, 2 }, { 7375, 2 }, { 6873, 2 },
{ 7343, 2 }, { 5807, 5 }, { 8349, 3 }, { 8350, 3 }, { 8351, 3 } };

}[/CODE]

and just incase anyone needs this:

[CODE]package server.model.npcs;

public class NPCDefinitions {

public static int NPCS = 15000;
private static NPCDefinitions[] definitions = new NPCDefinitions[NPCS];

/**
* @return the definitions
*/
public static NPCDefinitions[] getDefinitions() {
return definitions;
}

private int npcId;
private String npcName;
private int npcCombat;
private int npcHealth;

public NPCDefinitions(int _npcId) {
npcId = _npcId;
}

public NPCDefinitions(NPCDefinitions def) {
definitions[def.getNpcId()] = def;
}

/**
* @return the npcId
*/
public int getNpcId() {
return npcId;
}

/**
* @param npcId
* the npcId to set
*/
public void setNpcId(int npcId) {
this.npcId = npcId;
}

/**
* @return the npcName
*/
public String getNpcName() {
return npcName;
}

/**
* @param npcName
* the npcName to set
*/
public void setNpcName(String npcName) {
this.npcName = npcName;
}

/**
* @return the npcCombat
*/
public int getNpcCombat() {
return npcCombat;
}

/**
* @param npcCombat
* the npcCombat to set
*/
public void setNpcCombat(int npcCombat) {
this.npcCombat = npcCombat;
}

/**
* @return the npcHealth
*/
public int getNpcHealth() {
return npcHealth;
}

/**
* @param npcHealth
* the npcHealth to set
*/
public void setNpcHealth(int npcHealth) {
this.npcHealth = npcHealth;
}
}[/CODE]

[CODE]public void newNPC3(int npcType, int x, int y, int heightLevel,
int WalkingType, int HP, int maxHit, int attack, int defence,
int size) {
// first, search for a free slot
int slot = -1;
for (int i = 1; i < maxNPCs; i++) {
if (npcs[i] == null) {
slot = i;
break;
}
}

if (slot == -1)
return; // no free slot found
NPC newNPC = new NPC(slot, npcType);
newNPC.absX = x;
newNPC.absY = y;
newNPC.makeX = x;
newNPC.makeY = y;
newNPC.heightLevel = heightLevel;
newNPC.walkingType = WalkingType;
newNPC.HP = HP;
newNPC.MaxHP = HP;
newNPC.maxHit = maxHit;
newNPC.attack = attack;
newNPC.defence = defence;
newNPC.npcSize = size;
npcs[slot] = newNPC;
/*if (npcType == 1160) {
npcs[slot].actionTimer = 4;
npcs[slot].startAnimation(6237);*/
}
}[/CODE]

Not sure if I missed anything, if I have just say so.

Share this post


Link to post
Share on other sites
Where Nex will spawn?
Its teleport bar will be added to spellbook???
and what is the "just incase someone need this" thing? where to add it??

Share this post


Link to post
Share on other sites
Sign in to follow this  

×