41 UNARMED(5855,
"unarmed",5857, 7737, 7749, 7761,
new FightType[]{
44 FightType.UNARMED_BLOCK
47 DART(4446,
"thrown", 4449, 7637, 7649, 7661,
new FightType[]{
50 FightType.DART_LONGRANGE
53 STAFF(6103,
"staff", 6132, 6104, 6117, 6129,
new FightType[]{
59 MAGIC_STAFF(328,
"staff", 355, 340, 18566, 18569,
new FightType[]{
64 NIGHTMARE_STAFF(328,
"staff", 355, 340, 18566, 18569,
new FightType[]{
67 FightType.NIGHTMARE_STAFF_FOCUS
71 WARHAMMER(425,
"blunt", 428, 7473, 7474, 7486,
new FightType[]{
74 FightType.WARHAMMER_BLOCK
77 SCYTHE(776,
"scythe", 779, -1, -1, -1,
new FightType[]{
81 FightType.SCYTHE_BLOCK
83 VITUR(776,
"scythe", 779, -1, -1, -1,
new FightType[]{
91 BATTLEAXE(1698,
"weapon", 1701, 7498, 7499, 7511,
new FightType[]{
95 FightType.BATTLEAXE_BLOCK
98 CROSSBOW(1764,
"crossbow", 1767, 7548, 7549, 7561,
new FightType[]{
101 FightType.CROSSBOW_LONGRANGE
103 ZARYTE_CROSSBOW(1764,
"crossbow", 1767, 7548, 7549, 7561,
new FightType[]{
106 FightType.ZARYTE_LONGRANGE
109 SHORTBOW(1764,
"bow", 1767, 7548, 7549, 7561,
new FightType[]{
112 FightType.SHORTBOW_LONGRANGE
115 LONGBOW(1764,
"bow", 1767, 7548, 7549, 7561,
new FightType[]{
118 FightType.LONGBOW_LONGRANGE
121 DARK_BOW(1764,
"bow", 1767, 7548, 7549, 7561,
new FightType[]{
124 FightType.DARK_BOW_LONGRANGE
127 COMPOSITE_BOW(1764,
"bow", 1767, 7548, 7549, 7561,
new FightType[]{
130 FightType.LONGBOW_LONGRANGE
133 DAGGER(2276,
"stab_sword", 2279, 7562, 7574, 7586,
new FightType[]{
137 FightType.DAGGER_BLOCK
140 SWORD(2276,
"slash_sword", 2279, 7562, 7574, 7586,
new FightType[]{
144 FightType.SWORD_BLOCK
147 SCIMITAR(2423,
"slash_sword", 2426, 7587, 7599, 7611,
new FightType[]{
151 FightType.SCIMITAR_BLOCK
154 LONGSWORD(2423,
"slash_sword", 2426, 7587, 7599, 7611,
new FightType[]{
158 FightType.LONGSWORD_BLOCK
161 MACE(3796,
"spiked", 3799, 7623, 7624, 7636,
new FightType[]{
167 VIGGORA_MACE(3796,
"spiked", 3799, 7623, 7624, 7636,
new FightType[]{
171 FightType.VIGGORA_MACE_BLOCK
174 INQUISITOR_MACE(3796,
"spiked", 3799, 7623, 7624, 7636,
new FightType[]{
178 FightType.INQUISITOR_MACE_BLOCK
181 KNIFE(4446,
"thrown", 4449, 7637, 7649, 7661,
new FightType[]{
184 FightType.KNIFE_LONGRANGE
187 SPEAR(4679,
"spear", 4682, 7662, 7674, 7686,
new FightType[]{
191 FightType.SPEAR_BLOCK
193 HUNTER_LANCE(4679,
"spear", 4682, 7662, 7674, 7686,
new FightType[]{
197 FightType.HUNTER_LANCE_BLOCK
200 TWO_HANDED_SWORD(4705,
"2h_sword", 4708, 7687, 7699, 7711,
new FightType[]{
204 FightType.TWOHANDEDSWORD_BLOCK
207 PICKAXE(5570,
"pickaxe", 5573, 7723, 7724, 7736,
new FightType[]{
211 FightType.PICKAXE_BLOCK
214 CLAWS(7762,
"claw", 7765, 7788, 7800, 7812,
new FightType[]{
218 FightType.CLAWS_BLOCK
221 HALBERD(8460,
"polearm", 8463, 8481, 8493, 8505,
new FightType[]{
224 FightType.HALBERD_FEND
227 WHIP(12290,
"weapon", 12293, 12322, 12323, 12335,
new FightType[]{
230 FightType.WHIP_DEFLECT
233 THROWNAXE(4446,
"thrown", 4449, 7637, 7649, 7661,
new FightType[]{
236 FightType.THROWNAXE_LONGRANGE
239 CHINCHOMPA(24055,
"chinchompas", 24056, -1, -1, -1,
new FightType[]{
245 SALAMANDER(24074,
"salamander", 24075, -1, -1, -1,
new FightType[]{
251 TRIDENT(4446,
"powered_staff", 4449, 7637, 7649, 7661,
new FightType[]{
254 FightType.TRIDENT_LONGRANGE
256 SHADOW(4446,
"powered_staff", 4449, 7637, 7649, 7661,
new FightType[]{
259 FightType.SHADOW_LONGRANGE
262 BLOWPIPE(4446,
"thrown", 4449, 7637, 7649, 7661,
new FightType[]{
265 FightType.BLOWPIPE_LONGRANGE
268 BULWARK(425,
"bulwark", 428, 7473, 7474, 7486,
new FightType[]{
271 FightType.BULWARK_BLOCK
274 GRANITE_MAUL(425,
"blunt", 428, 7473, 7474, 7486,
new FightType[]{
277 FightType.GRANITE_MAUL_BLOCK
280 ELDER_MAUL(425,
"blunt", 428, 7473, 7474, 7486,
new FightType[]{
283 FightType.ELDER_MAUL_BLOCK
286 GREATAXE(1698,
"axe", 1701, 7498, 7499, 7591,
new FightType[]{
290 FightType.GREATAXE_BLOCK
293 KARIL_CROSSBOW(1764,
"crossbow", 1767, 7548, 7549, 7561,
new FightType[]{
296 FightType.KARIL_CROSSBOW_LONGRANGE
299 BALLISTA(1764,
"crossbow", 1767, 7548, 7549, 7561,
new FightType[]{
302 FightType.BALLISTA_LONGRANGE
305 DRAGON_DAGGER(2276,
"stab_sword", 2279, 7562, 7574, 7586,
new FightType[]{
309 FightType.DRAGON_DAGGER_BLOCK
312 FLAIL(3796,
"spiked", 3799, 7623, 7624, 7636,
new FightType[]{
316 FightType.FLAIL_BLOCK
319 GODSWORD_SWORD(4705,
"2h_sword", 4708, 7687, 7699, 7711,
new FightType[]{
323 FightType.GODSWORD_BLOCK
325 SAELDOR_SWORD(2423,
"slash_sword", 2426, 7587, 7599, 7611,
new FightType[]{
329 FightType.SAELDOR_BLOCK
331 OSMUM_SWORD(2276,
"stab_sword", 2279, 7562, 7574, 7586,
new FightType[]{
337 GHRAZI_SWORD(2276,
"stab_sword", 2279, 7562, 7574, 7586,
new FightType[]{
341 FightType.GHRAZI_BLOCK
346 SARADOMIN_SWORD(4705,
"2h_sword", 4708, 7687, 7699, 7711,
new FightType[]{
350 FightType.SARADOMIN_BLOCK
353 BLUDGEN(4705,
"bludgeon", 4708, 7687, 7699, 7711,
new FightType[]{
357 FightType.BLUDGEN_BLOCK
363 private final int id;
365 private final String newDefName;
370 private final int nameLine;
380 private final int specialButton;
385 private final int specialBar;
390 private final int specialMeter;
401 WeaponInterface(
int id, String newDefName,
int nameLine,
int specialButton,
int specialBar,
int specialMeter,
FightType[] fightTypes) {
403 this.newDefName = newDefName;
404 this.nameLine = nameLine;
405 this.fightTypes = fightTypes;
406 this.specialButton = specialButton;
407 this.specialBar = specialBar;
408 this.specialMeter = specialMeter;
424 public static void execute(
Player player, Item item,
boolean login) {
425 WeaponInterface weapon = item ==
null ? null : item.getWeaponInterface();
428 FightType[] oldTypes = player.getWeapon().fightTypes;
429 FightType[] newTypes = weapon.fightTypes;
432 for (
int index = 0; index < oldTypes.length; index++) {
433 if (newTypes.length == index) {
437 if (newTypes[index].getStyle().equals(
FightStyle.DEFENSIVE)
439 result = newTypes[index];
443 if (oldTypes[index] == player.
getCombat().getFightType()) {
444 boolean oldControlled = oldTypes[index].
getStyle().equals(FightStyle.CONTROLLED);
445 boolean newControlled = newTypes[index].
getStyle().equals(FightStyle.CONTROLLED);
447 if (newControlled != oldControlled) {
451 result = newTypes[index];
456 if (result ==
null) {
457 if (player.
getCombat().getFightType().getStyle().equals(FightStyle.DEFENSIVE)) {
458 result = newTypes[newTypes.length - 1];
460 result = newTypes[1];
463 player.setWeapon(weapon);
471 defaultWeaponInterface(player);
478 player.setSingleCast(
null);
480 player.send(
new SendString(item.getName(), weapon.nameLine));
485 private static void defaultWeaponInterface(
Player player) {
489 player.setSingleCast(
null);
493 player.equipment.updateAnimation();
505 public String getNewDefName() {
536 public Optional<FightType> forFightButton(
int button) {
538 if (type.getButton() == button) {
539 return Optional.of(type);
542 return Optional.empty();
545 public static boolean isSpecialButton(
int button) {
546 for (WeaponInterface weaponInterface : values()) {
547 if (weaponInterface.specialButton == button) {
554 public static final WeaponInterface[] values = values();
556 private static final Object2ObjectMap<String, WeaponInterface> newNameToValue
557 =
new Object2ObjectOpenHashMap<>(values.length);
559 public static WeaponInterface forNewName(String newDefName) {
560 return newNameToValue.get(newDefName);
564 for (WeaponInterface value : values) {
565 newNameToValue.putIfAbsent(value.getNewDefName(), value);