Skip to content

Commit 6e85220

Browse files
committed
Refactored remaining NPC IDs
1 parent 3a09692 commit 6e85220

File tree

6 files changed

+38
-30
lines changed

6 files changed

+38
-30
lines changed

2006Scape Server/src/main/java/com/rs2/game/content/combat/CombatAssistant.java

+18-16
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
import com.rs2.world.Boundary;
3131
import com.rs2.world.clip.PathFinder;
3232

33+
import static com.rs2.game.content.StaticNpcList.*;
34+
3335
/**
3436
* @author whoever contributed
3537
* @author Andrew (Mr Extremez)
@@ -89,7 +91,7 @@ public void delayedHit(int i) { // npc hit delay
8991
NpcHandler.npcs[i].gfx0(758);
9092
}
9193
if (Misc.random(NpcHandler.npcs[i].defence) > Misc.random(10 + calculateRangeAttack()) && !ignoreDef
92-
|| (NpcHandler.npcs[i].npcType == 2881 || NpcHandler.npcs[i].npcType == 2883 && !ignoreDef)) {
94+
|| (NpcHandler.npcs[i].npcType == DAGANNOTH_SUPREME || NpcHandler.npcs[i].npcType == DAGANNOTH_REX && !ignoreDef)) {
9395
damage = 0;
9496
}
9597
if (Misc.random(4) == 1 && player.lastArrowUsed == 9242 && damage > 0) {
@@ -182,7 +184,7 @@ public void delayedHit(int i) { // npc hit delay
182184
if (Misc.random(NpcHandler.npcs[i].defence) > 10 + Misc.random(mageAtk()) + bonusAttack) {
183185
damage = 0;
184186
magicFailed = true;
185-
} else if (NpcHandler.npcs[i].npcType == 2881 || NpcHandler.npcs[i].npcType == 2882) {
187+
} else if (NpcHandler.npcs[i].npcType == DAGANNOTH_SUPREME || NpcHandler.npcs[i].npcType == DAGANNOTH_PRIME) {
186188
damage = 0;
187189
magicFailed = true;
188190
}
@@ -278,7 +280,7 @@ public void applyNpcMeleeDamage(int i, int damageMask) {
278280
if (!fullVeracsEffect) {
279281
if (Misc.random(NpcHandler.npcs[i].defence) > 10 + Misc.random(calcAtt())) {
280282
damage = 0;
281-
} else if (NpcHandler.npcs[i].npcType == 2882 || NpcHandler.npcs[i].npcType == 2883) {
283+
} else if (NpcHandler.npcs[i].npcType == DAGANNOTH_PRIME || NpcHandler.npcs[i].npcType == DAGANNOTH_REX) {
282284
damage = 0;
283285
}
284286
}
@@ -296,7 +298,7 @@ public void applyNpcMeleeDamage(int i, int damageMask) {
296298
guthansEffect = true;
297299
}
298300
}
299-
if (player.fightMode == 3 && NpcHandler.npcs[i].npcType != 2459 && NpcHandler.npcs[i].npcType != 2460 && NpcHandler.npcs[i].npcType != 2461 && NpcHandler.npcs[i].npcType != 2462) {
301+
if (player.fightMode == 3 && NpcHandler.npcs[i].npcType != PHEASANT && NpcHandler.npcs[i].npcType != PHEASANT_2460 && NpcHandler.npcs[i].npcType != PHEASANT_2461 && NpcHandler.npcs[i].npcType != PHEASANT_2462) {
300302
player.getPlayerAssistant().addSkillXP(damage * CombatConstants.MELEE_EXP_RATE / 3, 0);
301303
player.getPlayerAssistant().addSkillXP(damage * CombatConstants.MELEE_EXP_RATE / 3, 1);
302304
player.getPlayerAssistant().addSkillXP(damage * CombatConstants.MELEE_EXP_RATE / 3, 2);
@@ -306,7 +308,7 @@ public void applyNpcMeleeDamage(int i, int damageMask) {
306308
player.getPlayerAssistant().refreshSkill(Constants.STRENGTH);
307309
player.getPlayerAssistant().refreshSkill(Constants.HITPOINTS);
308310
} else {
309-
if (NpcHandler.npcs[i].npcType != 2459 && NpcHandler.npcs[i].npcType != 2460 && NpcHandler.npcs[i].npcType != 2461 && NpcHandler.npcs[i].npcType != 2462) {
311+
if (NpcHandler.npcs[i].npcType != PHEASANT && NpcHandler.npcs[i].npcType != PHEASANT_2460 && NpcHandler.npcs[i].npcType != PHEASANT_2461 && NpcHandler.npcs[i].npcType != PHEASANT_2462) {
310312
player.getPlayerAssistant().addSkillXP(damage * CombatConstants.MELEE_EXP_RATE, player.fightMode);
311313
player.getPlayerAssistant().addSkillXP(damage * CombatConstants.MELEE_EXP_RATE / 3, 3);
312314
player.getPlayerAssistant().refreshSkill(player.fightMode);
@@ -479,7 +481,7 @@ public void attackNpc(int i) {
479481
if (!SlayerRequirements.itemNeededSlayer(player, i) || !player.getSlayer().canAttackNpc(i)) {
480482
return;
481483
}
482-
if (NpcHandler.npcs[i].npcType == 757 && player.vampSlayer > 2) {
484+
if (NpcHandler.npcs[i].npcType == COUNT_DRAYNOR && player.vampSlayer > 2) {
483485
if (!player.getItemAssistant().playerHasItem(1549, 1) || !player.getItemAssistant().playerHasItem(2347, 1)) {
484486
player.getPacketSender().sendMessage("You need a stake and hammer to attack count draynor.");
485487
resetPlayerAttack();
@@ -491,12 +493,12 @@ public void attackNpc(int i) {
491493
resetPlayerAttack();
492494
return;
493495
}
494-
if (NpcHandler.npcs[i].npcType == 1676) {
496+
if (NpcHandler.npcs[i].npcType == EXPERIMENT) {
495497
player.getPacketSender().sendMessage("You don't have the heart to kill the poor creature again.");
496498
resetPlayerAttack();
497499
return;
498500
}
499-
if (NpcHandler.npcs[i].npcType == 411) {
501+
if (NpcHandler.npcs[i].npcType == SWARM) {
500502
player.getPacketSender().sendMessage("You can't attack a swarm!");
501503
resetPlayerAttack();
502504
return;
@@ -1743,14 +1745,14 @@ public void removeRecoil(Player c2) {
17431745

17441746
public int getBonusAttack(int i) {
17451747
switch (NpcHandler.npcs[i].npcType) {
1746-
case 2883:
1747-
return Misc.random(50) + 30;
1748-
case 2026:
1749-
case 2027:
1750-
case 2029:
1751-
case 2030:
1752-
return Misc.random(50) + 30;
1753-
}
1748+
case DAGANNOTH_REX:
1749+
return Misc.random(50) + 30;
1750+
case DHAROK_THE_WRETCHED:
1751+
case GUTHAN_THE_INFESTED:
1752+
case TORAG_THE_CORRUPTED:
1753+
case VERAC_THE_DEFILED:
1754+
return Misc.random(50) + 30;
1755+
}
17541756
return 0;
17551757
}
17561758

2006Scape Server/src/main/java/com/rs2/game/content/combat/npcs/NpcEmotes.java

+11-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.rs2.game.content.combat.npcs;
22

33
import com.rs2.GameEngine;
4+
import com.rs2.game.content.StaticNpcList;
45
import com.rs2.game.content.combat.AttackType;
56
import com.rs2.game.npcs.NpcHandler;
67
import com.rs2.game.players.Player;
@@ -160,8 +161,8 @@ public static int getBlockEmote(int i) {
160161
return e.getBlock();
161162
} else {
162163
switch (NpcHandler.npcs[i].npcType) {
163-
case 2745:
164-
return 2653;
164+
case StaticNpcList.TZTOKJAD:
165+
return 2653;
165166
}
166167
}
167168
}
@@ -176,14 +177,14 @@ public static int getDeadEmote(Player player, int i) {
176177
return e.getDead();
177178
} else {
178179
switch (NpcHandler.npcs[i].npcType) {
179-
case 2745:
180-
return 2654;
181-
case 1158:
182-
GameEngine.npcHandler.spawnSecondForm(player, i);
183-
return 1187;
184-
case 1160:
185-
GameEngine.npcHandler.spawnFirstForm(player, i);
186-
return 1182;
180+
case StaticNpcList.TZTOKJAD:
181+
return 2654;
182+
case StaticNpcList.KALPHITE_QUEEN:
183+
GameEngine.npcHandler.spawnSecondForm(player, i);
184+
return 1187;
185+
case StaticNpcList.KALPHITE_QUEEN_1160:
186+
GameEngine.npcHandler.spawnFirstForm(player, i);
187+
return 1182;
187188
}
188189
}
189190
}

2006Scape Server/src/main/java/com/rs2/game/content/combat/range/DwarfCannon.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import com.rs2.event.CycleEvent;
66
import com.rs2.event.CycleEventContainer;
77
import com.rs2.event.CycleEventHandler;
8+
import com.rs2.game.content.StaticNpcList;
89
import com.rs2.game.content.combat.CombatConstants;
910
import com.rs2.game.npcs.Npc;
1011
import com.rs2.game.npcs.NpcHandler;
@@ -450,7 +451,7 @@ private Npc targetNpc() {
450451

451452

452453

453-
if (!npc.isDead && !npc.isDead && npc.HP != 0 && npc.npcType != 1266 && npc.npcType != 1268 && inDistance(theirX, theirY)) {
454+
if (!npc.isDead && !npc.isDead && npc.HP != 0 && npc.npcType != StaticNpcList.ROCKS && npc.npcType != StaticNpcList.ROCKS_1268 && inDistance(theirX, theirY)) {
454455
switch (rotation) {
455456
case 1:
456457
if (theirY > myY && theirX >= myX - 1 && theirX <= myX + 1) {

2006Scape Server/src/main/java/com/rs2/game/content/minigames/magetrainingarena/Alchemy.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import java.util.Random;
44

55
import com.rs2.Constants;
6+
import com.rs2.game.content.StaticNpcList;
67
import com.rs2.game.content.combat.magic.MagicData;
78
import com.rs2.game.content.combat.magic.MagicRequirements;
89
import com.rs2.game.content.music.sound.SoundList;
@@ -141,7 +142,7 @@ public static void process() {
141142
// 1 in 4 chance of an item being free to alch
142143
freeAlch = random.nextInt(values.length * 4);
143144
for (int i = 0; i < NpcHandler.MAX_NPCS; i ++) {
144-
if (NpcHandler.npcs[i] != null && NpcHandler.npcs[i].npcType == 3099) {
145+
if (NpcHandler.npcs[i] != null && NpcHandler.npcs[i].npcType == StaticNpcList.ALCHEMY_GUARDIAN) {
145146
NpcHandler.npcs[i].forceChat("Items are changing!");
146147
}
147148
}

2006Scape Server/src/main/java/com/rs2/game/content/skills/thieving/Stalls.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
import com.rs2.game.players.Player;
1414
import com.rs2.util.Misc;
1515

16+
import static com.rs2.game.content.StaticNpcList.*;
17+
1618
public class Stalls {
1719

1820

@@ -221,7 +223,7 @@ private static int getRespawnTime(int i) {
221223
private static void failGuards(final Player p) {
222224
for (int i = 1; i < NpcHandler.MAX_NPCS; i ++) {
223225
if (NpcHandler.npcs[i] != null) {
224-
if (NpcHandler.npcs[i].npcType == 32 || NpcHandler.npcs[i].npcType == 1317 || NpcHandler.npcs[i].npcType == 2236 || NpcHandler.npcs[i].npcType == 2571) {
226+
if (NpcHandler.npcs[i].npcType == GUARD_32 || NpcHandler.npcs[i].npcType == MARKET_GUARD || NpcHandler.npcs[i].npcType == MARKET_GUARD_2236 || NpcHandler.npcs[i].npcType == MARKET_GUARD_2571) {
225227
if (p.goodDistance(p.absX, p.absY, NpcHandler.npcs[i].absX, NpcHandler.npcs[i].absY, 7)
226228
&& p.heightLevel == NpcHandler.npcs[i].heightLevel) {
227229
if (!NpcHandler.npcs[i].underAttack) {

2006Scape Server/src/main/java/com/rs2/net/packets/impl/ClickNPC.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import com.rs2.event.impl.NpcFirstClickEvent;
77
import com.rs2.event.impl.NpcSecondClickEvent;
88
import com.rs2.event.impl.NpcThirdClickEvent;
9+
import com.rs2.game.content.StaticNpcList;
910
import com.rs2.game.content.combat.CombatConstants;
1011
import com.rs2.game.content.combat.magic.MagicData;
1112
import com.rs2.game.content.combat.range.RangeData;
@@ -198,7 +199,7 @@ public void processPacket(final Player player, Packet packet) {
198199
}
199200

200201
if (NpcHandler.npcs[player.npcIndex].MaxHP == 0
201-
|| NpcHandler.npcs[player.npcIndex].npcType == 944) {
202+
|| NpcHandler.npcs[player.npcIndex].npcType == StaticNpcList.COMBAT_INSTRUCTOR) {
202203
player.getPacketSender().sendMessage(
203204
"You can't attack this npc.");
204205
break;

0 commit comments

Comments
 (0)