Noticed that when I redid projectiles on Elvarg, the magic ones were messed up.
To fix it, simply replace CombatSpells.java with mine.
It's quite a big class so I'll use pastebin.
Click here to get it.
Now, some people wanted help with adding tridents so I'll give you a proper base below.
Let's make it so when we equip a trident, it will update our autocast spell.
To do this, open EquipPacketListener.java and find "void resetWeapon(Player player)"
At the bottom of this method, you should find:
Code:
if(player.getCombat().getAutocastSpell() != null) {
Autocasting.setAutocast(player, null);
player.getPacketSender().sendMessage("Autocast spell cleared.");
}
If you examine the current code, you will see that it's currently reseting autocast everytime when switching weapon.
Replace it with this:
Code:
Item weapon = player.getEquipment().getItems()[Equipment.WEAPON_SLOT];
//Check if player is using a trident. If so, set autocast to respective spell..
if(weapon.getId() == 11905) {
Autocasting.setAutocast(player, CombatSpells.TRIDENT_OF_THE_SEAS.getSpell());
} else if(weapon.getId() == 12899) {
Autocasting.setAutocast(player, CombatSpells.TRIDENT_OF_THE_SWAMP.getSpell());
} else {
//Otherwise always reset autocast when switching weapon
if(player.getCombat().getAutocastSpell() != null) {
Autocasting.setAutocast(player, null);
player.getPacketSender().sendMessage("Autocast spell cleared.");
}
}
Now, we're updating autocast if switching to a trident, and reseting autocast if not.
Finally we need to make it so players can't choose a different autocast spell when using a trident, just like osrs.
Simply open Autocasting.java, and find this code:
Code:
if(cbSpell.levelRequired() > player.getSkillManager().getCurrentLevel(Skill.MAGIC)) {
player.getPacketSender().sendMessage("You need a Magic level of at least "+cbSpell.levelRequired()+" to cast this spell.");
setAutocast(player, null);
return true;
}
Under it, add:
Code:
Item weapon = player.getEquipment().getItems()[Equipment.WEAPON_SLOT];
//Check if player is using a trident. If so, do not allow player to change autocast spell.
if(weapon.getId() == 11905 || weapon.getId() == 12899) {
player.getPacketSender().sendMessage("You cannot change your autocast spell since you're wearing a trident.");
return false;
}
And you're done!
Magic projectiles:
Tridents:
(Fix the projectile for these two yourself by playing around with the start/end heights etc. For some reason same values as other projectiles didn't work.)