Before anyone says anything, this is using 317 gfx and animations. Don't like em, substitute them with the correct 641 ones.
This includes the sword doing a magic based attack with the xp etc.
And I'm not releasing my on player spec but it's very easy to convert this for pvp also. I'm also not releasing the multi effect which is only slightly more difficult.
Code:
String weaponName = c.getItems().getItemName(weapon).toLowerCase();
if(weaponName.contains("korasi")) {
Random r = new Random();
c.startAnimation(1872);
final double multiplier = r.nextDouble() + 0.5;
if (c.playerIndex > 0) {
Client o = (Client) PlayerHandler.players[c.playerIndex];
} else if (c.npcIndex > 0) {
final NPC n = NPCHandler.npcs[c.npcIndex];
EventManager.getSingleton().addEvent(new Event() {
int timer = 1;
public void execute(EventContainer c) {
if(c == null)
c.stop();
switch(timer) {
case 1:
n.gfx100(1224);
break;
case 0:
npcMageDamage((int) (calculateMeleeMaxHit() * multiplier));
c.stop();
break;
}
timer--;
}
}, 600);
c.attackTimer = 5;
}
}
Code:
public void npcMageDamage(int damage) {
int i = c.npcIndex;
int bonusAttack = getBonusAttack(i);
if (Misc.random(Server.npcHandler.npcs[i].defence) > 10+ Misc.random(mageAtk()) + bonusAttack) {
damage/=2;
} else if (Server.npcHandler.npcs[i].npcType == 2881 || Server.npcHandler.npcs[i].npcType == 2882) {
damage/=2;
}
if (Server.npcHandler.npcs[i].HP - damage < 0) {
damage = Server.npcHandler.npcs[i].HP;
}
c.getPA().addSkillXP((damage*Config.MAGIC_EXP_RATE), 6);
c.getPA().addSkillXP((damage*Config.MAGIC_EXP_RATE/3), 3);
c.getPA().refreshSkill(3);
c.getPA().refreshSkill(6);
if (damage > 0) {
if (Server.npcHandler.npcs[i].npcType >= 3777 && Server.npcHandler.npcs[i].npcType <= 3780) {
c.pcDamage += damage;
}
}
Server.npcHandler.npcs[i].underAttack = true;
Server.npcHandler.npcs[i].hitDiff = damage;
Server.npcHandler.npcs[i].HP -= damage;
Server.npcHandler.npcs[i].hitUpdateRequired = true;
c.totalDamageDealt += damage;
c.killingNpcIndex = c.oldNpcIndex;
Server.npcHandler.npcs[i].updateRequired = true;
}
Rune-server fucked up my conventions...hell yea...