Turn item id magic numbers into constants

This commit is contained in:
P0nk
2021-11-07 11:38:32 +01:00
parent a4c079c2e8
commit 4efd356cbf
50 changed files with 790 additions and 346 deletions

View File

@@ -30,6 +30,7 @@ import client.inventory.WeaponType;
import client.inventory.manipulator.InventoryManipulator;
import config.YamlConfig;
import constants.game.GameConstants;
import constants.id.ItemId;
import constants.inventory.ItemConstants;
import constants.skills.*;
import net.packet.InPacket;
@@ -136,15 +137,15 @@ public final class RangedAttackHandler extends AbstractDealDamageHandler {
boolean bow = ItemConstants.isArrowForBow(id);
boolean cbow = ItemConstants.isArrowForCrossBow(id);
if (item.getQuantity() >= bulletCount) { //Fixes the bug where you can't use your last arrow.
if (type == WeaponType.CLAW && ItemConstants.isThrowingStar(id) && weapon.getItemId() != 1472063) {
if (((id == 2070007 || id == 2070018) && chr.getLevel() < 70) || (id == 2070016 && chr.getLevel() < 50)) {
if (type == WeaponType.CLAW && ItemConstants.isThrowingStar(id) && weapon.getItemId() != ItemId.MAGICAL_MITTEN) {
if (((id == ItemId.HWABI_THROWING_STARS || id == ItemId.BALANCED_FURY) && chr.getLevel() < 70) || (id == ItemId.CRYSTAL_ILBI_THROWING_STARS && chr.getLevel() < 50)) {
} else {
projectile = id;
break;
}
} else if ((type == WeaponType.GUN && ItemConstants.isBullet(id))) {
if (id == 2331000 && id == 2332000) {
if (chr.getLevel() > 69) {
if (id == ItemId.BLAZE_CAPSULE || id == ItemId.GLAZE_CAPSULE) {
if (chr.getLevel() >= 70) {
projectile = id;
break;
}
@@ -152,7 +153,7 @@ public final class RangedAttackHandler extends AbstractDealDamageHandler {
projectile = id;
break;
}
} else if ((type == WeaponType.BOW && bow) || (type == WeaponType.CROSSBOW && cbow) || (weapon.getItemId() == 1472063 && (bow || cbow))) {
} else if ((type == WeaponType.BOW && bow) || (type == WeaponType.CROSSBOW && cbow) || (weapon.getItemId() == ItemId.MAGICAL_MITTEN && (bow || cbow))) {
projectile = id;
break;
}