Apparently, NPC's are able to attack through walls in my server; the most obvious issue is in godwars when the minions are able to attack while projecting through the wall. Also, the NPC's no clip when they attack you.
NPC attacking Player method
Code:
public void attackPlayer(Client c, int i) {
if(npcs[i] != null) {
if (npcs[i].lastX != npcs[i].getX()
|| npcs[i].lastY != npcs[i].getY()) {
return;
}
if (npcs[i].isDead)
return;
if (!npcs[i].inMulti() && npcs[i].underAttackBy > 0 && npcs[i].underAttackBy != c.playerId) {
npcs[i].killerId = 0;
return;
}
if (!npcs[i].inMulti() && (c.underAttackBy > 0 || (c.underAttackBy2 > 0 && c.underAttackBy2 != i))) {
npcs[i].killerId = 0;
return;
}
if (npcs[i].heightLevel != c.heightLevel) {
npcs[i].killerId = 0;
return;
}
npcs[i].facePlayer(c.playerId);
boolean special = false;//specialCase(c,i);
if(goodDistance(npcs[i].getX(), npcs[i].getY(), c.getX(), c.getY(), distanceRequired(i)) || special) {
if(c.respawnTimer <= 0) {
npcs[i].facePlayer(c.playerId);
npcs[i].attackTimer = getNpcDelay(i);
npcs[i].hitDelayTimer = npcs[i].getHitTimer();
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 = c.playerId;
return;
}
if(npcs[i].projectileId > 0) {
int nX = npcs[i].getX() + offset(i);
int nY = 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, -c.getId() - 1, 65);
}
c.underAttackBy2 = i;
c.singleCombatDelay2 = System.currentTimeMillis();
npcs[i].oldIndex = c.playerId;
startAnimation(getAttackEmote(i), i);
c.getPA().removeAllWindows();
}
}
}
}