Originally Posted by
Gangster Cudi
Why would you need 2 of the same code. Comment one out then compile and if error free run the server.
They are in different parts of the Code.
Here is the code
Code:
/* if(npcs[i].npcType == 8281) {
npcs[i].projectile = c;
if(balanceForm == 0 || balanceForm == 1) {
startAnimation(10680, i);
/* startAnimation(10680, i);
n.projectileId = 1940;
n.endGfx = 1941;*/
// npcs[i].attackType = 2;
// }
// if(balanceForm == 2) {
// // balanceAttack(c,i,2);
// startAnimation(10669, i);
// /* n.gfx100(1918);
// n.attackType = 1;
// n.projectileId = 1937;
// n.endGfx = 1941;*/
// npcs[i].attackType = 1;
// }
// if(balanceForm == 3) {
// startAnimation(10681, i);
// npcs[i].attackType = 0;
// }
// }
} else if (special) {
loadSpell2(i);
} else {
loadSpell(i);
}
usingSpecial = false;
handleSpecialNPC(npcs[i]);
if (npcs[i].attackType == 3) {
npcs[i].hitDelayTimer += 2;
}
if (multiAttacks(i) && npcs[i].npcType != 8281) {
multiAttackGfx(i, npcs[i].projectileId);
startAnimation(getCombatEmote(i, "Attack"), i);
npcs[i].oldIndex = c.playerId;
return;
}
if (npcs[i].projectileId > 0) {
int nX = Server.npcHandler.npcs[i].getX() + offset(i);
int nY = Server.npcHandler.npcs[i].getY() + offset(i);
int pX = c.getX();
int pY = c.getY();
int offX = (nY - pY) * -1;
int offY = (nX - pX) * -1;
c.getPA().createPlayersProjectile(nX, nY, offX, offY, 50, getProjectileSpeed(i), npcs[i].projectileId, 43, 31, !npcs[i].splash ? -c.getId() - 1 : 0, 65);
}
c.underAttackBy2 = i;
c.singleCombatDelay2 = System.currentTimeMillis();
npcs[i].oldIndex = c.playerId;
if (npcs[i].npcType != 8133 && !usingSpecial && npcs[i].npcType != 8281) {
startAnimation(getCombatEmote(i, "Attack"), i);
} else if(npcs[i].npcType == 8281) {
if(balanceForm == 3) { //range 8283
startAnimation(10681, i);
npcs[i].gfx100(1918);
npcs[i].projectileId = 1017;
npcs[i].endGfx = 1930;
npcs[i].attackType = 1;
}
if(balanceForm != 3 || balanceForm != 2) {//8281 mage
startAnimation(10680, i);
npcs[i].gfx100(1939);
npcs[i].endGfx = 1941;
npcs[i].projectileId = 1940;
npcs[i].attackType = 2;
}
if(balanceForm == 2) {//8282 melee
startAnimation(10669, i);
npcs[i].endGfx = 0;
npcs[i].projectileId = 0;
npcs[i].attackType = 0;
}
}
c.getPA().removeAllWindows();
}
}
Code:
public void attackNPC(int c, int i) {
if (npcs[i] != null) {
if (npcs[i].isDead)
return;
if (!npcs[i].inMulti() && npcs[i].underAttackBy > 0
&& npcs[i].underAttackBy != npcs[c].npcId) {
return;
}
if (!npcs[i].inMulti()
&& (npcs[c].underAttackBy > 0 || (npcs[c].underAttackBy2 > 0 && npcs[c].underAttackBy2 != i))) {
npcs[i].killerId = 0;
return;
}
if (npcs[i].heightLevel != npcs[c].heightLevel) {
npcs[i].killerId = 0;
return;
}
follownpc(i, c);
npcs[i].facePlayer(npcs[c].npcId);
npcs[i].facenpc(npcs[c].npcId);
boolean special = false;// specialCase(c,i);
if (goodDistance(npcs[i].getX(), npcs[i].getY(), npcs[c].getX(),
npcs[c].getY(), distanceRequired(i)) || special) {
if (npcs[c].actionTimer <= 0) {
npcs[i].facePlayer(npcs[c].npcId);
npcs[i].attackTimer = getNpcDelay(i);
npcs[i].hitDelayTimer = getHitDelay(i);
npcs[i].attackType = 0;
if (special)
loadSpell2(i);
else
loadSpell(i);
npcs[c].underAttackBy2 = i;
npcs[c].actionTimer = 7;
npcs[i].actionTimer = 5;
int damg = Misc.random(npcs[i].maxHit);
npcs[c].handleHitMask(damg);
npcs[c].HP -= damg;
npcs[c].hitUpdateRequired2 = true;
npcs[c].hitUpdateRequired = true;
npcs[i].oldIndexNPC = npcs[c].npcId;
startAnimation(getAttackEmote(i), i);
//c.getPA().removeAllWindows();
}
}
}
}
public void attacknpc(int i) {
if (npcs[i] != null) {
if (npcs[i].isDead)
return;
if (!npcs[i].inMulti() && npcs[i].underAttackBy > 0) {
npcs[i].killerId = 0;
return;
}
boolean special = false;// specialCase(c,i);
if (goodDistance(npcs[i].getX(), npcs[i].getY(),
Server.npcHandler.npcs[npcs[i].attacknpc].getX(),
Server.npcHandler.npcs[npcs[i].attacknpc].getY(), 1)
|| special) {
if (npcs[i].actionTimer <= 0
&& npcs[i].isDead == false
&& Server.npcHandler.npcs[npcs[i].attacknpc].isDead == false) {
npcs[i].facePlayer(Server.npcHandler.npcs[npcs[i].attacknpc].npcId);
Server.npcHandler.npcs[npcs[i].attacknpc]
.facePlayer(npcs[i].npcId);
npcs[i].attackTimer = getNpcDelay(i);
npcs[i].hitDelayTimer = getHitDelay(i);
npcs[i].attackType = 0;
if (special)
loadSpell2(i);
else
loadSpell(i);
if (npcs[i].attackType == 3)
npcs[i].hitDelayTimer += 2;
if (multiAttacks(i)) {
multiAttackGfx(i, npcs[i].projectileId);
startAnimation(getAttackEmote(i), i);
npcs[i].oldIndex = Server.npcHandler.npcs[npcs[i].attacknpc].npcId;
return;
}
Server.npcHandler.npcs[npcs[i].attacknpc]
.handleHitMask(Misc.random(npcs[i].maxHit));
if (Server.npcHandler.npcs[npcs[i].attacknpc].actionTimer <= 0
&& npcs[i].isDead == false
&& Server.npcHandler.npcs[npcs[i].attacknpc].isDead == false) {
Server.npcHandler.npcs[npcs[i].attacknpc].actionTimer = 7;
Server.npcHandler.npcs[npcs[i].attacknpc]
.handleHitMask(Misc
.random(Server.npcHandler.npcs[npcs[i].attacknpc].maxHit));
startAnimation(getAttackEmote(npcs[i].attacknpc),
npcs[i].attacknpc);
}
npcs[i].actionTimer = 7;
npcs[i].npcIndex = Server.npcHandler.npcs[npcs[i].attacknpc].npcId;
startAnimation(getAttackEmote(i), i);
Server.npcHandler.npcs[npcs[i].attacknpc].attacknpc = i;
}
}
}
}