From 0248ee9861b38148f16309fe795dc842b989c242 Mon Sep 17 00:00:00 2001 From: ipkpjersi Date: Fri, 25 Oct 2024 11:45:01 -0400 Subject: [PATCH 1/7] Refactoring follow player/NPC variables --- .../game/content/combat/CombatAssistant.java | 28 ++++++++--------- .../java/com/rs2/game/players/Player.java | 8 ++--- .../com/rs2/game/players/PlayerAssistant.java | 30 +++++++++---------- .../rs2/net/packets/impl/AttackPlayer.java | 2 +- .../com/rs2/net/packets/impl/ClickNPC.java | 2 +- .../rs2/net/packets/impl/FollowPlayer.java | 2 +- .../com/rs2/net/packets/impl/Walking.java | 2 +- 7 files changed, 37 insertions(+), 37 deletions(-) diff --git a/2006Scape Server/src/main/java/com/rs2/game/content/combat/CombatAssistant.java b/2006Scape Server/src/main/java/com/rs2/game/content/combat/CombatAssistant.java index 5ac1a31e9..1e03e75e5 100644 --- a/2006Scape Server/src/main/java/com/rs2/game/content/combat/CombatAssistant.java +++ b/2006Scape Server/src/main/java/com/rs2/game/content/combat/CombatAssistant.java @@ -385,7 +385,7 @@ public void attackingNpcTick() { if (i > 0 && NpcHandler.npcs[i] != null) { if (NpcHandler.npcs[i].isDead) { player.npcIndex = 0; - player.followId2 = 0; + player.followNpcId = 0; player.faceNpc(0); return; } @@ -411,7 +411,7 @@ public void attackingNpcTick() { return; } else { if (player.usingMagic || player.usingBow || player.usingRangeWeapon) { - player.followId2 = 0; + player.followNpcId = 0; } player.stopMovement(); } @@ -423,7 +423,7 @@ public void attackingPlayerTick() { if (i > 0 && PlayerHandler.players[i] != null) { if (PlayerHandler.players[i].isDead) { player.playerIndex = 0; - player.followId = 0; + player.followPlayerId = 0; player.faceNpc(0); return; } @@ -447,7 +447,7 @@ public void attackingPlayerTick() { return; } else { if (player.usingMagic || player.usingBow || player.usingRangeWeapon) { - player.followId = 0; + player.followPlayerId = 0; } player.stopMovement(); } @@ -517,8 +517,8 @@ public void attackNpc(int i) { return; } - player.followId2 = i; - player.followId = 0; + player.followNpcId = i; + player.followPlayerId = 0; if (player.attackTimer <= 0) { player.usingBow = false; player.usingRangeWeapon = false; @@ -573,7 +573,7 @@ public void attackNpc(int i) { return; } else { if (player.usingMagic || player.usingBow || player.usingRangeWeapon) { - player.followId2 = 0; + player.followNpcId = 0; } player.stopMovement(); } @@ -803,7 +803,7 @@ public void attackPlayer(int i) { resetPlayerAttack(); return; } - player.followId = i; + player.followPlayerId = i; player.attackTimer = 0; return; } @@ -876,7 +876,7 @@ public void attackPlayer(int i) { return; } else { if (player.usingMagic || player.usingBow || player.usingRangeWeapon) { - player.followId = 0; + player.followPlayerId = 0; } } @@ -950,7 +950,7 @@ public void attackPlayer(int i) { if (checkSpecAmount(equippedWeapon)) { player.lastArrowUsed = player.playerEquipment[player.playerArrows]; player.getSpecials().activateSpecial(player.playerEquipment[player.playerWeapon], o, i); - player.followId = player.playerIndex; + player.followPlayerId = player.playerIndex; return; } else { player.getPacketSender().sendMessage("You don't have the required special energy to use this attack."); @@ -985,7 +985,7 @@ public void attackPlayer(int i) { player.lastArrowUsed = 0; player.rangeItemUsed = 0; if (!player.usingBow && !player.usingMagic && !player.usingRangeWeapon) { // melee hit delay - player.followId = PlayerHandler.players[player.playerIndex].playerId; + player.followPlayerId = PlayerHandler.players[player.playerIndex].playerId; player.hitDelay = getHitDelay(); player.delayedDamage = Misc.random(meleeMaxHit()); player.projectileStage = 0; @@ -1006,7 +1006,7 @@ public void attackPlayer(int i) { player.usingBow = true; } player.usingBow = true; - player.followId = PlayerHandler.players[player.playerIndex].playerId; + player.followPlayerId = PlayerHandler.players[player.playerIndex].playerId; player.lastWeaponUsed = player.playerEquipment[player.playerWeapon]; player.lastArrowUsed = player.playerEquipment[player.playerArrows]; player.gfx100(RangeData.getRangeStartGFX(player)); @@ -1019,7 +1019,7 @@ public void attackPlayer(int i) { player.rangeItemUsed = player.playerEquipment[player.playerWeapon]; player.getItemAssistant().deleteEquipment(); player.usingRangeWeapon = true; - player.followId = PlayerHandler.players[player.playerIndex].playerId; + player.followPlayerId = PlayerHandler.players[player.playerIndex].playerId; player.gfx100(RangeData.getRangeStartGFX(player)); if (player.fightMode == 2) { player.attackTimer--; @@ -1694,7 +1694,7 @@ public boolean checkReqs() { } public int getRequiredDistance() { - if (player.followId > 0 && player.freezeTimer <= 0) { + if (player.followPlayerId > 0 && player.freezeTimer <= 0) { return player.isMoving ? 3 : 2; } return 1; diff --git a/2006Scape Server/src/main/java/com/rs2/game/players/Player.java b/2006Scape Server/src/main/java/com/rs2/game/players/Player.java index 2fe8e06a2..c5c5e5693 100644 --- a/2006Scape Server/src/main/java/com/rs2/game/players/Player.java +++ b/2006Scape Server/src/main/java/com/rs2/game/players/Player.java @@ -935,9 +935,9 @@ public void process() { } } - if (followId > 0) { + if (followPlayerId > 0) { getPlayerAssistant().followPlayer(); - } else if (followId2 > 0) { + } else if (followNpcId > 0) { getPlayerAssistant().followNpc(); } @@ -1405,8 +1405,8 @@ public Npc getSpecialTarget() { dialogueId, randomCoffin, newLocation, specEffect, specBarId, attackLevelReq, defenceLevelReq, strengthLevelReq, rangeLevelReq, magicLevelReq, slayerLevelReq, agilityLevelReq, - followId, skullTimer, nextChat = 0, talkingNpc = -1, - dialogueAction = 0, autocastId, followDistance, followId2, + followPlayerId, skullTimer, nextChat = 0, talkingNpc = -1, + dialogueAction = 0, autocastId, followDistance, followNpcId, barrageCount = 0, delayedDamage = 0, delayedDamage2 = 0, pcPoints = 0, magePoints = 0, desertTreasure = 0, skillAmount, lastArrowUsed = -1, autoRet = 1, pcDamage = 0, xInterfaceId = 0, diff --git a/2006Scape Server/src/main/java/com/rs2/game/players/PlayerAssistant.java b/2006Scape Server/src/main/java/com/rs2/game/players/PlayerAssistant.java index 9ea7bb19c..177f3a4f5 100644 --- a/2006Scape Server/src/main/java/com/rs2/game/players/PlayerAssistant.java +++ b/2006Scape Server/src/main/java/com/rs2/game/players/PlayerAssistant.java @@ -567,7 +567,7 @@ public static boolean pathBlocked(Client attacker, Npc victim) { public void stepAway() { - player.faceUpdate(player.followId + 32768); + player.faceUpdate(player.followPlayerId + 32768); if (Region.getClipping(player.getX() - 1, player.getY(), player.heightLevel, -1, 0)) { walkTo(-1, 0); } else if (Region.getClipping(player.getX() + 1, player.getY(), player.heightLevel, 1, 0)) { @@ -1345,7 +1345,7 @@ public void resetTb() { public void resetFollowers() { for (Player player : PlayerHandler.players) { if (player != null) { - if (player.followId == player.playerId) { + if (player.followPlayerId == player.playerId) { Client c = (Client) player; c.getPlayerAssistant().resetFollow(); } @@ -1623,8 +1623,8 @@ public int[] getFollowLocation(int x, int y) { } public void followPlayer() { - if (PlayerHandler.players[player.followId] == null - || PlayerHandler.players[player.followId].isDead) { + if (PlayerHandler.players[player.followPlayerId] == null + || PlayerHandler.players[player.followPlayerId].isDead) { resetFollow(); return; } @@ -1635,38 +1635,38 @@ public void followPlayer() { return; } - int otherX = PlayerHandler.players[player.followId].getX(); - int otherY = PlayerHandler.players[player.followId].getY(); + int otherX = PlayerHandler.players[player.followPlayerId].getX(); + int otherY = PlayerHandler.players[player.followPlayerId].getY(); if (!player.goodDistance(otherX, otherY, player.getX(), player.getY(), 25)) { - player.followId = 0; + player.followPlayerId = 0; resetFollow(); return; } int[] follow = getFollowLocation(otherX, otherY); - player.faceUpdate(player.followId + 32768); + player.faceUpdate(player.followPlayerId + 32768); PathFinder.getPathFinder().findRoute(player, follow[0], follow[1], false, 1, 1); } public void followNpc() { - Npc npc = NpcHandler.npcs[player.followId2]; + Npc npc = NpcHandler.npcs[player.followNpcId]; if (npc == null || npc.isDead) { return; } - int x = NpcHandler.npcs[player.followId2].getX(); - int y = NpcHandler.npcs[player.followId2].getY(); + int x = NpcHandler.npcs[player.followNpcId].getX(); + int y = NpcHandler.npcs[player.followNpcId].getY(); if (!player.goodDistance(x, y, player.getX(), player.getY(), 25)) { - player.followId2 = 0; + player.followNpcId = 0; resetFollow(); return; } int[] follow = getFollowLocation(x, y); - player.faceUpdate(player.followId2); + player.faceUpdate(player.followNpcId); PathFinder.getPathFinder().findRoute(player, follow[0], follow[1], false, 1, 1); } @@ -1681,8 +1681,8 @@ public int getRunningMove(int i, int j) { } public void resetFollow() { - player.followId = 0; - player.followId2 = 0; + player.followPlayerId = 0; + player.followNpcId = 0; player.mageFollow = false; } diff --git a/2006Scape Server/src/main/java/com/rs2/net/packets/impl/AttackPlayer.java b/2006Scape Server/src/main/java/com/rs2/net/packets/impl/AttackPlayer.java index 74d00cabc..5ae373f85 100644 --- a/2006Scape Server/src/main/java/com/rs2/net/packets/impl/AttackPlayer.java +++ b/2006Scape Server/src/main/java/com/rs2/net/packets/impl/AttackPlayer.java @@ -133,7 +133,7 @@ public void processPacket(Player player, Packet packet) { return; } if (player.getCombatAssistant().checkReqs()) { - player.followId = player.playerIndex; + player.followPlayerId = player.playerIndex; if (!player.usingMagic && !usingBow && !usingOtherRangeWeapons) { player.followDistance = 1; player.getPlayerAssistant().followPlayer(); diff --git a/2006Scape Server/src/main/java/com/rs2/net/packets/impl/ClickNPC.java b/2006Scape Server/src/main/java/com/rs2/net/packets/impl/ClickNPC.java index 7c40e2646..6f60a7127 100644 --- a/2006Scape Server/src/main/java/com/rs2/net/packets/impl/ClickNPC.java +++ b/2006Scape Server/src/main/java/com/rs2/net/packets/impl/ClickNPC.java @@ -152,7 +152,7 @@ public void processPacket(final Player player, Packet packet) { return; } - if (player.followId > 0) { + if (player.followPlayerId > 0) { player.getPlayerAssistant().resetFollow(); } if (player.attackTimer <= 0) { diff --git a/2006Scape Server/src/main/java/com/rs2/net/packets/impl/FollowPlayer.java b/2006Scape Server/src/main/java/com/rs2/net/packets/impl/FollowPlayer.java index 3a1f45b52..2e80e96bc 100644 --- a/2006Scape Server/src/main/java/com/rs2/net/packets/impl/FollowPlayer.java +++ b/2006Scape Server/src/main/java/com/rs2/net/packets/impl/FollowPlayer.java @@ -19,7 +19,7 @@ public void processPacket(Player player, Packet packet) { player.usingBow = false; player.usingRangeWeapon = false; player.followDistance = 1; - player.followId = followPlayer; + player.followPlayerId = followPlayer; player.endCurrentTask(); } } diff --git a/2006Scape Server/src/main/java/com/rs2/net/packets/impl/Walking.java b/2006Scape Server/src/main/java/com/rs2/net/packets/impl/Walking.java index ce14ce171..dded9bcde 100644 --- a/2006Scape Server/src/main/java/com/rs2/net/packets/impl/Walking.java +++ b/2006Scape Server/src/main/java/com/rs2/net/packets/impl/Walking.java @@ -82,7 +82,7 @@ public void processPacket(Player player, Packet packet) { if (player.canWalkTutorial == false && player.tutorialProgress < 36) { return; } - if (player.followId > 0 || player.followId2 > 0) { + if (player.followPlayerId > 0 || player.followNpcId > 0) { player.getPlayerAssistant().resetFollow(); } if (player.getPlayerAction().checkWalking() == false) { From 2284267a06cd251913c8d3e6bd90cdafc9b3600d Mon Sep 17 00:00:00 2001 From: ipkpjersi Date: Fri, 25 Oct 2024 15:09:38 -0400 Subject: [PATCH 2/7] Magic number refactoring --- .../main/java/com/rs2/game/npcs/NpcData.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/2006Scape Server/src/main/java/com/rs2/game/npcs/NpcData.java b/2006Scape Server/src/main/java/com/rs2/game/npcs/NpcData.java index c77c7cad9..bf6d7649c 100644 --- a/2006Scape Server/src/main/java/com/rs2/game/npcs/NpcData.java +++ b/2006Scape Server/src/main/java/com/rs2/game/npcs/NpcData.java @@ -9,16 +9,18 @@ import java.util.ArrayList; +import static com.rs2.game.content.StaticNpcList.*; + public class NpcData { - public static final int[] npcsOnlyMage = { 907, 908, 909, 910, 911, 912, - 913, 914 };// done - public static final int[][] transformNpc = { { 3223, 6006 }, - { 3224, 6007 }, { 3225, 6008 }, { 3226, 6009 } };// done - public static final int[] npcsCantKillYou = { 41, 951, 1017, 1401, 1402, - 1692, 2313, 2314, 2315 };// done - public static final int[] npcCantAttack = { 1532, 1533, 1534, 1535 }; - public static final int[] npcDontGiveXp = { 2459, 2460, 2461, 2462 }; + public static final int[] npcsOnlyMage = { KOLODION_907, KOLODION_908, KOLODION_909, KOLODION_910, KOLODION_911, BATTLE_MAGE, + BATTLE_MAGE_913, BATTLE_MAGE_914 };// done + public static final int[][] transformNpc = { { MAN_3223, 6006 }, + { MAN_3224, 6007 }, { MAN_3225, 6008 }, { WOMAN_3226, 6009 } };// done // this transformNpc array seems to be unused, maybe can be removed? Maybe it's not even accurate? Idk I just fixed the magic numbers. + public static final int[] npcsCantKillYou = { CHICKEN, CHICKEN_951, CHICKEN_1017, CHICKEN_1401, CHICKEN_1402, + UNDEAD_CHICKEN, CHICKEN_2313, CHICKEN_2314, CHICKEN_2315 };// done + public static final int[] npcCantAttack = { BARRICADE, BARRICADE_1533, BARRICADE_1534, BARRICADE_1535 }; + public static final int[] npcDontGiveXp = { PHEASANT, PHEASANT_2460, PHEASANT_2461, PHEASANT_2462 }; public static boolean cantKillYou(int npcType) { for (int n : npcsCantKillYou) { From 62f862e9747d8d3bf0fc2c80784219a3bd063a09 Mon Sep 17 00:00:00 2001 From: ipkpjersi Date: Mon, 28 Oct 2024 20:22:02 -0400 Subject: [PATCH 3/7] Added more NPC refactoring --- .../main/java/com/rs2/game/npcs/NpcData.java | 162 +++++++++--------- .../java/com/rs2/game/npcs/NpcHandler.java | 50 +++--- 2 files changed, 107 insertions(+), 105 deletions(-) diff --git a/2006Scape Server/src/main/java/com/rs2/game/npcs/NpcData.java b/2006Scape Server/src/main/java/com/rs2/game/npcs/NpcData.java index bf6d7649c..b9086a456 100644 --- a/2006Scape Server/src/main/java/com/rs2/game/npcs/NpcData.java +++ b/2006Scape Server/src/main/java/com/rs2/game/npcs/NpcData.java @@ -188,21 +188,21 @@ public static void handleClipping(int i) { **/ public static int getNpcDelay(int i) { switch (NpcHandler.npcs[i].npcType) { - case 2025: - case 2028: + case AHRIM_THE_BLIGHTED: + case KARIL_THE_TAINTED: return 7; - case 2745: + case TZTOKJAD: return 8; - case 2558: - case 2559: - case 2560: - case 2561: - case 2550: + case ADAMANTITE_ORE: + case RUNITE_ORE: + case SILVER_ORE: + case GOLD_ORE: + case DWARVEN_MINER_2550: return 6; // saradomin gw boss - case 2562: + case COAL: return 2; default: @@ -215,21 +215,21 @@ public static int getNpcDelay(int i) { **/ public static int getHitDelay(int i) { switch (NpcHandler.npcs[i].npcType) { - case 2881: - case 2882: - case 3200: - case 2892: - case 2894: + case DAGANNOTH_SUPREME: + case DAGANNOTH_PRIME: + case CHAOS_ELEMENTAL: + case SPINOLYP: + case SPINOLYP_2894: return 3; - case 2743: - case 2631: - case 2558: - case 2559: - case 2560: + case KETZEK: + case TOKXIL: + case ADAMANTITE_ORE: + case RUNITE_ORE: + case SILVER_ORE: return 3; - case 2745: + case TZTOKJAD: if (NpcHandler.npcs[i].attackType == AttackType.RANGE.getValue() || NpcHandler.npcs[i].attackType == AttackType.MAGIC.getValue()) { return 5; @@ -237,9 +237,9 @@ public static int getHitDelay(int i) { return 2; } - case 2025: + case AHRIM_THE_BLIGHTED: return 4; - case 2028: + case KARIL_THE_TAINTED: return 3; default: @@ -252,31 +252,31 @@ public static int getHitDelay(int i) { **/ public static int getRespawnTime(int i) { switch (NpcHandler.npcs[i].npcType) { - case 1158: - case 1160: - return -1; - case 2881: - case 2882: - case 2883: - case 2558: - case 2559: - case 2560: - case 2561: - case 2562: - case 2563: - case 2564: - case 2550: - case 2551: - case 2552: - case 2553: + case KALPHITE_QUEEN: + case KALPHITE_QUEEN_1160: + return -1; + case DAGANNOTH_SUPREME: + case DAGANNOTH_PRIME: + case DAGANNOTH_REX: + case ADAMANTITE_ORE: + case RUNITE_ORE: + case SILVER_ORE: + case GOLD_ORE: + case COAL: + case PERFECT_GOLD_ORE: + case ORDAN: + case DWARVEN_MINER_2550: + case DWARVEN_MINER_2551: + case DWARVEN_MINER_2552: + case BLAST_FURNACE_FOREMAN: return 100; - case 3777: - case 3778: - case 3779: - case 3780: + case PORTAL: + case PORTAL_3778: + case PORTAL_3779: + case PORTAL_3780: return 500; - case 1532: - case 1534: + case BARRICADE: + case BARRICADE_1534: return -1; default: return 25; @@ -296,49 +296,49 @@ public static int distanceRequired(int i) { return 5; } switch (NpcHandler.npcs[i].npcType) { - case 2562: + case COAL: return 2; - case 2881:// dag kings - case 2882: - case 3200:// chaos ele + case DAGANNOTH_SUPREME:// dag kings + case DAGANNOTH_PRIME: + case CHAOS_ELEMENTAL:// chaos ele return 8; - case 2552: - case 2553: - case 2556: - case 2557: - case 2558: - case 2559: - case 2560: - case 2564: - case 2565: + case DWARVEN_MINER_2552: + case BLAST_FURNACE_FOREMAN: + case IRON_ORE: + case MITHRIL_ORE: + case ADAMANTITE_ORE: + case RUNITE_ORE: + case SILVER_ORE: + case ORDAN: + case JORZIK: return 9; // things around dags - case 2892: - case 2894: + case SPINOLYP: + case SPINOLYP_2894: return 10; - case 907 : // Kolodian - case 908 : - case 909 : - case 910 : - case 911 : - case 912 : // Zammy battlemage - case 913 : // Sara battlemage - case 914 : // Guthix battlemage - case 2591 : // TzHaar-Mej (Tzhaar mage guy) - case 2743 : // Ket-Zek (Tzhaar mage guy) - case 2745 : // TzTok-Jad - case 1158 : // Kalphite queen form 1 - case 1160 : // Kalphite queen form 2 - case 2025 : // Ahrim + case KOLODION_907 : // Kolodian + case KOLODION_908 : + case KOLODION_909 : + case KOLODION_910 : + case KOLODION_911 : + case BATTLE_MAGE : // Zammy battlemage + case BATTLE_MAGE_913 : // Sara battlemage + case BATTLE_MAGE_914 : // Guthix battlemage + case TZHAARMEJ : // TzHaar-Mej (Tzhaar mage guy) + case KETZEK : // Ket-Zek (Tzhaar mage guy) + case TZTOKJAD : // TzTok-Jad + case KALPHITE_QUEEN : // Kalphite queen form 1 + case KALPHITE_QUEEN_1160 : // Kalphite queen form 2 + case AHRIM_THE_BLIGHTED : // Ahrim return 10; - case 2028 : // Karil - case 2631 : // Tok-Xil (Tzhaar ranging guy) - case 1183 : // Elf ranger - case 172: // dark wizards - case 174: + case KARIL_THE_TAINTED : // Karil + case TOKXIL : // Tok-Xil (Tzhaar ranging guy) + case ELF_WARRIOR : // Elf ranger + case DARK_WIZARD: // dark wizards + case DARK_WIZARD_174: return 8; - case 941 : // Green drag - case 50 : // Kbd + case GREEN_DRAGON : // Green drag + case KING_BLACK_DRAGON : // Kbd return 6; } return 1; diff --git a/2006Scape Server/src/main/java/com/rs2/game/npcs/NpcHandler.java b/2006Scape Server/src/main/java/com/rs2/game/npcs/NpcHandler.java index b394abf69..0d051e5c6 100644 --- a/2006Scape Server/src/main/java/com/rs2/game/npcs/NpcHandler.java +++ b/2006Scape Server/src/main/java/com/rs2/game/npcs/NpcHandler.java @@ -34,6 +34,8 @@ import java.io.*; import java.lang.reflect.Type; +import static com.rs2.game.content.StaticNpcList.*; + // Facetypes: 1-Walk, 2-North, 3-South, 4-East, 5-West public class NpcHandler { @@ -1293,36 +1295,36 @@ public static void followPlayer(int i, Player player) { **/ public static int distanceRequired(int i) { switch (npcs[i].npcType) { - case 2025: - case 2028: + case AHRIM_THE_BLIGHTED: + case KARIL_THE_TAINTED: return 6; - case 50: - case 2562: + case KING_BLACK_DRAGON: + case COAL: return 2; - case 172: // dark wizards - case 174: - case 2881:// dag kings - case 2882: - case 3200:// chaos ele - case 2743: - case 2631: - case 2745: + case DARK_WIZARD: // dark wizards + case DARK_WIZARD_174: + case DAGANNOTH_SUPREME:// dag kings + case DAGANNOTH_PRIME: + case CHAOS_ELEMENTAL:// chaos ele + case KETZEK: + case TOKXIL: + case TZTOKJAD: return 8; - case 2883:// rex + case DAGANNOTH_REX:// rex return 1; - case 2552: - case 2553: - case 2556: - case 2557: - case 2558: - case 2559: - case 2560: - case 2564: - case 2565: + case DWARVEN_MINER_2552: + case BLAST_FURNACE_FOREMAN: + case IRON_ORE: + case MITHRIL_ORE: + case ADAMANTITE_ORE: + case RUNITE_ORE: + case SILVER_ORE: + case ORDAN: + case JORZIK: return 9; // things around dags - case 2892: - case 2894: + case SPINOLYP: + case SPINOLYP_2894: return 10; default: return 1; From 778c15d355fbf1f54aefc8e4f07f521d2020054e Mon Sep 17 00:00:00 2001 From: ipkpjersi Date: Mon, 28 Oct 2024 20:46:15 -0400 Subject: [PATCH 4/7] More NPC refactoring --- .../java/com/rs2/game/npcs/NpcHandler.java | 219 +++++++++--------- 1 file changed, 110 insertions(+), 109 deletions(-) diff --git a/2006Scape Server/src/main/java/com/rs2/game/npcs/NpcHandler.java b/2006Scape Server/src/main/java/com/rs2/game/npcs/NpcHandler.java index 0d051e5c6..2d957b68b 100644 --- a/2006Scape Server/src/main/java/com/rs2/game/npcs/NpcHandler.java +++ b/2006Scape Server/src/main/java/com/rs2/game/npcs/NpcHandler.java @@ -7,6 +7,7 @@ import com.rs2.event.CycleEvent; import com.rs2.event.CycleEventContainer; import com.rs2.event.CycleEventHandler; +import com.rs2.game.content.StaticItemList; import com.rs2.game.content.combat.AttackType; import com.rs2.game.content.combat.CombatConstants; import com.rs2.game.content.combat.npcs.NpcAggressive; @@ -50,7 +51,7 @@ public void spawnSecondForm(Player c, final int i) { CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() { @Override public void execute(CycleEventContainer container) { - spawnNpc2(1160, npcs[i].absX, npcs[i].absY, 0, 1, 230, 45, 500, 300, true); + spawnNpc2(KALPHITE_QUEEN_1160, npcs[i].absX, npcs[i].absY, 0, 1, 230, 45, 500, 300, true); container.stop(); } @@ -68,7 +69,7 @@ public void spawnFirstForm(Player c, final int i) { CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() { @Override public void execute(CycleEventContainer container) { - spawnNpc2(1158, npcs[i].absX, npcs[i].absY, 0, 1, 230, 45, 500, 300, true); + spawnNpc2(KALPHITE_QUEEN, npcs[i].absX, npcs[i].absY, 0, 1, 230, 45, 500, 300, true); container.stop(); } @@ -85,7 +86,7 @@ public void catchRat(final int npcIndex) { if (npcs[i] == null || foundRat != -1) { continue; } - if (npcs[i].npcType == 47 && !npcs[i].isDead) { + if (npcs[i].npcType == RAT && !npcs[i].isDead) { if (goodDistance(npcs[npcIndex].absX, npcs[npcIndex].absY, npcs[i].absX, npcs[i].absY, 5)) { foundRat = i; continue; @@ -103,13 +104,13 @@ public void catchRat(final int npcIndex) { CycleEventHandler.getSingleton().addEvent(this, new CycleEvent() { @Override public void execute(CycleEventContainer container) { - if (npcs[npcIndex].absX == npcs[npcs[npcIndex].chasingRat].absX && npcs[npcIndex].absY == npcs[npcs[npcIndex].chasingRat].absY && (beatChance || npcs[npcIndex].npcType >= 768 && npcs[npcIndex].npcType <= 773)) { + if (npcs[npcIndex].absX == npcs[npcs[npcIndex].chasingRat].absX && npcs[npcIndex].absY == npcs[npcs[npcIndex].chasingRat].absY && (beatChance || npcs[npcIndex].npcType >= CAT && npcs[npcIndex].npcType <= CAT_773)) { npcs[npcs[npcIndex].chasingRat].isDead = true; npcs[npcs[npcIndex].chasingRat].forceChat("Eek!"); npcs[npcIndex].forceChat("Meow!"); //startAnimation(9163, npcIndex); slaveOwner.getPacketSender().sendMessage("The " + getNpcListName(NpcHandler.npcs[npcIndex].npcType) + " caught a rat!"); - if (npcs[npcIndex].npcType >= 761 && npcs[npcIndex].npcType <= 766) { + if (npcs[npcIndex].npcType >= KITTEN_761 && npcs[npcIndex].npcType <= KITTEN_766) { slaveOwner.ratsCaught++; } if (slaveOwner.ratsCaught == Pets.RATS_NEEDED_TO_GROW) { @@ -216,19 +217,19 @@ public void spawnNpc3(Player c, int npcType, int x, int y, int heightLevel, npcs[slot] = newNPC; } - public boolean switchesAttackers(int i) { + public boolean switchesAttackers(int i) { // This seems unused, that's probably not good switch (npcs[i].npcType) { - case 2551: - case 2552: - case 2553: - case 2559: - case 2560: - case 2561: - case 2563: - case 2564: - case 2565: - case 2892: - case 2894: + case DWARVEN_MINER_2551: + case DWARVEN_MINER_2552: + case BLAST_FURNACE_FOREMAN: + case RUNITE_ORE: + case SILVER_ORE: + case GOLD_ORE: + case PERFECT_GOLD_ORE: + case ORDAN: + case JORZIK: + case SPINOLYP: + case SPINOLYP_2894: return true; } return false; @@ -502,7 +503,7 @@ public void process() { } } - if (npcs[i].npcType == 162) { + if (npcs[i].npcType == GNOME_TRAINER) { if (npcs[i].getX() == 2475 && npcs[i].getY() == 3438) { npcs[i].forceChat("Okay get over that log, quick quick!"); } else if (npcs[i].getX() == 2471 && npcs[i].getY() == 3427) { @@ -520,22 +521,22 @@ public void process() { } } - if (npcs[i].npcType == 43) { + if (npcs[i].npcType == SHEEP_43) { if (Misc.random(20) == 4) { npcs[i].forceChat("Baa!"); } } - if (npcs[i].npcType == 81 || npcs[i].npcType == 397 || npcs[i].npcType == 1766 || npcs[i].npcType == 1767 || npcs[i].npcType == 1768) { + if (npcs[i].npcType == COW || npcs[i].npcType == COW_397 || npcs[i].npcType == COW_CALF || npcs[i].npcType == COW_1767 || npcs[i].npcType == COW_CALF_1768) { if (Misc.random(30) == 4) { npcs[i].forceChat("Moo"); } } - if (npcs[i].npcType == 45) { + if (npcs[i].npcType == DUCK_45) { if (Misc.random(30) == 6) { npcs[i].forceChat("Quack!"); } } - if (npcs[i].npcType == 1685) + if (npcs[i].npcType == GRAVINGAS) { if (Misc.random(25) == 7) { int rand = Misc.random(25); @@ -773,7 +774,7 @@ else if (rand <= 20) // time dropItems(i); // npc drops items! FightCaves.tzhaarDeathHandler(i); - if (npcs[i].npcType == 2745) { + if (npcs[i].npcType == TZTOKJAD) { FightCaves.handleJadDeath(i); if (PlayerHandler.players[npcs[i].killerId] != null) { PlayerHandler.players[npcs[i].killerId].spawnedHealers = 0; @@ -801,36 +802,36 @@ else if (rand <= 20) handleratdeath2(i); } } - if (npcs[i].npcType > 3726 && npcs[i].npcType < 3732) { + if (npcs[i].npcType > RABBIT_3726 && npcs[i].npcType < SHIFTER) { int damage = 10 + Misc.random(10); player.playerLevel[Constants.HITPOINTS] = player.getPlayerAssistant().getLevelForXP(player.playerXP[Constants.HITPOINTS]) - damage; player.getPlayerAssistant().refreshSkill(Constants.HITPOINTS); player.handleHitMask(damage); } - if (npcs[i].npcType == 655) { + if (npcs[i].npcType == TREE_SPIRIT_655) { player.spiritTree = true; player.getPacketSender().sendMessage( "You have defeated the tree spirit."); } - if (npcs[i].npcType > 412 && npcs[i].npcType < 419) { + if (npcs[i].npcType > BAT && npcs[i].npcType < ZOMBIE_419) { player.golemSpawned = false; } - if (npcs[i].npcType == 757 && player.vampSlayer == 3) { + if (npcs[i].npcType == COUNT_DRAYNOR && player.vampSlayer == 3) { player.vampSlayer = 4; } - if (npcs[i].npcType > 390 && npcs[i].npcType < 397) { + if (npcs[i].npcType > BIG_FISH && npcs[i].npcType < COW_397) { RiverTroll.hasRiverTroll = false; } - if (npcs[i].npcType > 418 && npcs[i].npcType < 425) { + if (npcs[i].npcType > ROCK_GOLEM_418 && npcs[i].npcType < SHADE) { player.zombieSpawned = false; } - if (npcs[i].npcType > 424 && npcs[i].npcType < 431) { + if (npcs[i].npcType > ZOMBIE_424 && npcs[i].npcType < WATCHMAN_431) { player.shadeSpawned = false; } - if (npcs[i].npcType > 437 && npcs[i].npcType < 444) { + if (npcs[i].npcType > CAPN_IZZY_NOBEARD && npcs[i].npcType < GOBLIN_444) { player.treeSpiritSpawned = false; } - if (npcs[i].npcType > 2462 && npcs[i].npcType < 2469) { + if (npcs[i].npcType > PHEASANT_2462 && npcs[i].npcType < FROG_2469) { player.chickenSpawned = false; } npcs[i].absX = npcs[i].makeX; @@ -839,11 +840,11 @@ else if (rand <= 20) npcs[i].animNumber = 0x328; npcs[i].updateRequired = true; npcs[i].animUpdateRequired = true; - if (npcs[i].npcType >= 2440 && npcs[i].npcType <= 2446) { + if (npcs[i].npcType >= DOORSUPPORT && npcs[i].npcType <= DOORSUPPORT_2446) { GameEngine.objectManager.removeObject(npcs[i].absX, npcs[i].absY); } - } else if (npcs[i].actionTimer == 0 && npcs[i].needRespawn && npcs[i].npcType != 1158) { + } else if (npcs[i].actionTimer == 0 && npcs[i].needRespawn && npcs[i].npcType != KALPHITE_QUEEN) { if (npcs[i].spawnedBy > 0) { npcs[i] = null; } else { @@ -906,12 +907,12 @@ private void handleratdeath2(int i) { public boolean getsPulled(Player c, int i) { switch (npcs[i].npcType) { - case 2550: + case DWARVEN_MINER_2550: if (npcs[i].firstAttacker > 0) { return false; } break; - case 87: + case GIANT_RAT_87: if (Boundary.isIn(c, Boundary.TUTORIAL) || c.tutorialProgress < 36) { return false; } @@ -922,21 +923,21 @@ public boolean getsPulled(Player c, int i) { public static boolean multiAttacks(int i) { switch (npcs[i].npcType) { - case 1158: //kq + case KALPHITE_QUEEN: //kq if (npcs[i].attackType == AttackType.MAGIC.getValue()) { return true; } - case 1160: //kq + case KALPHITE_QUEEN_1160: //kq if (npcs[i].attackType == AttackType.RANGE.getValue()) { return true; } - case 2558: + case ADAMANTITE_ORE: // What were these supposed to be... return true; - case 2562: + case COAL: if (npcs[i].attackType == AttackType.MAGIC.getValue()) { return true; } - case 2550: + case DWARVEN_MINER_2550: if (npcs[i].attackType == AttackType.RANGE.getValue()) { return true; } @@ -1051,15 +1052,15 @@ public void dropItems(int i) { Player c = (Client) PlayerHandler.players[npcs[i].killedBy]; if (c != null) { // These npcs shouldn't have drops - if (npcs[i].npcType == 2627 // Tz-Kih - || npcs[i].npcType == 2630 // Tz-Kek - || npcs[i].npcType == 2631 // Tok-Xil - || npcs[i].npcType == 2638 // Neite - || npcs[i].npcType == 2641 // Dragonkin - || npcs[i].npcType == 2643 // R4ng3rNo0b889 - || npcs[i].npcType == 2645 // Love Cats - || npcs[i].npcType == 1532 // Barricade - || npcs[i].npcType == 153 // Butterfly + if (npcs[i].npcType == TZKIH // Tz-Kih + || npcs[i].npcType == TZKEK_2630 // Tz-Kek + || npcs[i].npcType == TOKXIL // Tok-Xil + || npcs[i].npcType == NEITE_2638 // Neite + || npcs[i].npcType == DRAGONKIN // Dragonkin + || npcs[i].npcType == R4NG3RNO0B889 // R4ng3rNo0b889 + || npcs[i].npcType == LOVE_CATS_2645 // Love Cats + || npcs[i].npcType == BARRICADE // Barricade + || npcs[i].npcType == BUTTERFLY // Butterfly || PestControl.npcIsPCMonster(npcs[i].npcType) || FightCaves.isFightCaveNpc(i)) { // These npcs shouldn't have drops @@ -1076,36 +1077,36 @@ public void dropItems(int i) { } } switch (npcs[i].npcType) { - case 2459: + case PHEASANT: FreakyForester.killedPheasant(c, 0); - GameEngine.itemHandler.createGroundItem(c, 6178, npcs[i].absX, npcs[i].absY, 1, c.playerId); + GameEngine.itemHandler.createGroundItem(c, StaticItemList.RAW_PHEASANT, npcs[i].absX, npcs[i].absY, 1, c.playerId); break; - case 2460: + case PHEASANT_2460: FreakyForester.killedPheasant(c, 1); - GameEngine.itemHandler.createGroundItem(c, 6178, npcs[i].absX, npcs[i].absY, 1, c.playerId); + GameEngine.itemHandler.createGroundItem(c, StaticItemList.RAW_PHEASANT, npcs[i].absX, npcs[i].absY, 1, c.playerId); break; - case 2461: + case PHEASANT_2461: FreakyForester.killedPheasant(c, 2); - GameEngine.itemHandler.createGroundItem(c, 6178, npcs[i].absX, npcs[i].absY, 1, c.playerId); + GameEngine.itemHandler.createGroundItem(c, StaticItemList.RAW_PHEASANT, npcs[i].absX, npcs[i].absY, 1, c.playerId); break; - case 2462: + case PHEASANT_2462: FreakyForester.killedPheasant(c, 3); - GameEngine.itemHandler.createGroundItem(c, 6178, npcs[i].absX, npcs[i].absY, 1, c.playerId); + GameEngine.itemHandler.createGroundItem(c, StaticItemList.RAW_PHEASANT, npcs[i].absX, npcs[i].absY, 1, c.playerId); break; - case 92: + case SKELETON_92: if (c.restGhost == 3) { - GameEngine.itemHandler.createGroundItem(c, 553, npcs[i].absX, npcs[i].absY, 1, c.playerId); + GameEngine.itemHandler.createGroundItem(c, StaticItemList.SKULL, npcs[i].absX, npcs[i].absY, 1, c.playerId); c.restGhost = 4; } break; - case 47: + case RAT: if (c.witchspot == 1 || c.romeojuliet > 0 && c.romeojuliet < 9) { - GameEngine.itemHandler.createGroundItem(c, 300, npcs[i].absX, npcs[i].absY, 1, c.playerId); + GameEngine.itemHandler.createGroundItem(c, StaticItemList.RATS_TAIL, npcs[i].absX, npcs[i].absY, 1, c.playerId); } break; - case 645: + case JONNY_THE_BEARD: if (c.shieldArrav == 5) { - GameEngine.itemHandler.createGroundItem(c, 761, npcs[i].absX, npcs[i].absY, 1, c.playerId); + GameEngine.itemHandler.createGroundItem(c, StaticItemList.SCROLL, npcs[i].absX, npcs[i].absY, 1, c.playerId); } break; } @@ -1204,11 +1205,11 @@ public static boolean followPlayer(int i) { return false; } switch (npcs[i].npcType) { - case 1456: - case 2892: - case 2894: - case 1532: - case 1534: + case MONKEY_ARCHER: + case SPINOLYP: + case SPINOLYP_2894: + case BARRICADE: + case BARRICADE_1534: return false; } return true; @@ -1228,11 +1229,11 @@ public static void followPlayer(int i, Player player) { return; } - if (npcs[i].npcType == 1532 || npcs[i].npcType == 1534) { + if (npcs[i].npcType == BARRICADE || npcs[i].npcType == BARRICADE_1534) { return; } - if (!followPlayer(i) && npcs[i].npcType != 1532 && npcs[i].npcType != 1534) { + if (!followPlayer(i) && npcs[i].npcType != BARRICADE && npcs[i].npcType != BARRICADE_1534) { npcs[i].facePlayer(player); return; } @@ -1333,15 +1334,15 @@ public static int distanceRequired(int i) { public static int followDistance(int i) { switch (npcs[i].npcType) { - case 2550: - case 2551: - case 2562: - case 2563: + case DWARVEN_MINER_2550: + case DWARVEN_MINER_2551: + case COAL: + case PERFECT_GOLD_ORE: return 8; - case 2883: + case DAGANNOTH_REX: return 4; - case 2881: - case 2882: + case DAGANNOTH_SUPREME: + case DAGANNOTH_PRIME: return 1; } return 0; @@ -1349,21 +1350,21 @@ public static int followDistance(int i) { public static int getProjectileSpeed(int i) { switch (npcs[i].npcType) { - case 2881: - case 2882: - case 3200: + case DAGANNOTH_SUPREME: + case DAGANNOTH_PRIME: + case CHAOS_ELEMENTAL: return 85; - case 2745: + case TZTOKJAD: return 130; - case 50: + case KING_BLACK_DRAGON: return 90; - case 2025: + case AHRIM_THE_BLIGHTED: return 85; - case 2028: + case KARIL_THE_TAINTED: return 80; default: @@ -1373,22 +1374,22 @@ public static int getProjectileSpeed(int i) { public static int offset(int i) { switch (npcs[i].npcType) { - case 50: - case 110: - case 941: - case 1590: - case 1591: - case 1592: - case 2642: - case 55: - case 54: - case 53: + case KING_BLACK_DRAGON: + case FIRE_GIANT: + case GREEN_DRAGON: + case BRONZE_DRAGON: + case IRON_DRAGON: + case STEEL_DRAGON: + case KING_BLACK_DRAGON_2642: + case BLUE_DRAGON: + case BLACK_DRAGON: + case RED_DRAGON: return 2; - case 2881: - case 2882: + case DAGANNOTH_SUPREME: + case DAGANNOTH_PRIME: return 1; - case 2745: - case 2743: + case TZTOKJAD: + case KETZEK: return 1; } return 0; @@ -1405,13 +1406,13 @@ public boolean specialCase(Player c, int i) { // responsible for npcs that } public boolean retaliates(int npcType) { - return npcType < 3777 || npcType > 3780 - && !(npcType >= 2440 && npcType <= 2446); + return npcType < PORTAL || npcType > PORTAL_3780 + && !(npcType >= DOORSUPPORT && npcType <= DOORSUPPORT_2446); } public static void handleSpecialEffects(Player c, int i, int damage) { - if (npcs[i].npcType == 2892 || npcs[i].npcType == 2894 || npcs[i].npcType == 1158 - || npcs[i].npcType == 1160) { + if (npcs[i].npcType == SPINOLYP || npcs[i].npcType == SPINOLYP_2894 || npcs[i].npcType == KALPHITE_QUEEN + || npcs[i].npcType == KALPHITE_QUEEN_1160) { if (damage > 0) { if (c != null) { if (c.playerLevel[Constants.PRAYER] > 0) { @@ -1438,20 +1439,20 @@ public static boolean goodDistance(int objectX, int objectY, int playerX, public static int getMaxHit(int i) { switch (npcs[i].npcType) { - case 1158: + case KALPHITE_QUEEN: return 30; - case 2558: + case ADAMANTITE_ORE: // There's no way adamantite ore has two attack types, right? Maybe it does... if (npcs[i].attackType == AttackType.MAGIC.getValue()) { return 28; } else { return 68; } - case 1265: - case 1267: + case ROCK_CRAB: + case ROCK_CRAB_1267: return 2; - case 2562: + case COAL: return 31; - case 2550: + case DWARVEN_MINER_2550: return 36; } return 1; From 4892b038b955be98830ce589722a99c8bb5b632b Mon Sep 17 00:00:00 2001 From: ipkpjersi Date: Mon, 28 Oct 2024 20:58:06 -0400 Subject: [PATCH 5/7] More refactoring and removed GWD NPCs GWD was added in 2007, not 2006, so there's absolutely no reason why this code should exist in the server. --- .../game/content/combat/npcs/NpcCombat.java | 169 ++++++------------ .../main/java/com/rs2/game/npcs/NpcData.java | 31 ---- .../java/com/rs2/game/npcs/NpcHandler.java | 35 ---- 3 files changed, 51 insertions(+), 184 deletions(-) diff --git a/2006Scape Server/src/main/java/com/rs2/game/content/combat/npcs/NpcCombat.java b/2006Scape Server/src/main/java/com/rs2/game/content/combat/npcs/NpcCombat.java index d7af8e185..1b5a0909e 100644 --- a/2006Scape Server/src/main/java/com/rs2/game/content/combat/npcs/NpcCombat.java +++ b/2006Scape Server/src/main/java/com/rs2/game/content/combat/npcs/NpcCombat.java @@ -18,6 +18,8 @@ import com.rs2.util.Misc; import com.rs2.world.Boundary; +import static com.rs2.game.content.StaticNpcList.*; + public class NpcCombat { public static void multiAttackDamage(int i) { @@ -108,28 +110,28 @@ public static void attackPlayer(Player c, int i) { || NpcHandler.npcs[i].isDead) { return; } - if (NpcHandler.npcs[i].npcType == 1532 - || NpcHandler.npcs[i].npcType == 1534 - || NpcHandler.npcs[i].npcType == 6145 + if (NpcHandler.npcs[i].npcType == BARRICADE + || NpcHandler.npcs[i].npcType == BARRICADE_1534 + || NpcHandler.npcs[i].npcType == 6145 //Unknown NPCs in 6000 range || NpcHandler.npcs[i].npcType == 6144 || NpcHandler.npcs[i].npcType == 6143 || NpcHandler.npcs[i].npcType == 6142 - || NpcHandler.npcs[i].npcType == 752) { + || NpcHandler.npcs[i].npcType == LESSER_DEMON_752) { return; } if (Boundary.isIn(c, Boundary.APE_ATOLL) && MonkeyData.isWearingGreegree(c)) { return; } - if (NpcHandler.npcs[i].npcType == 1401 && Boundary.isIn(c, Boundary.TUTORIAL) || c.tutorialProgress < 36) { + if (NpcHandler.npcs[i].npcType == CHICKEN_1401 && Boundary.isIn(c, Boundary.TUTORIAL) || c.tutorialProgress < 36) { return; } - if (NpcHandler.npcs[i].npcType == 9 && c.absX == 3180 && c.absY > 3433 && c.absY < 3447) { + if (NpcHandler.npcs[i].npcType == GUARD && c.absX == 3180 && c.absY > 3433 && c.absY < 3447) { return; } - if (NpcHandler.npcs[i].npcType == 374 && c.absY == 3372 && c.absX > 2522 && c.absX < 2532) { + if (NpcHandler.npcs[i].npcType == OGRE_374 && c.absY == 3372 && c.absX > 2522 && c.absX < 2532) { return; } - if (NpcHandler.npcs[i].npcType > 2462 && NpcHandler.npcs[i].npcType < 2468) { + if (NpcHandler.npcs[i].npcType > PHEASANT_2462 && NpcHandler.npcs[i].npcType < FROG_2469) { if (Misc.random(5) == 0) { NpcHandler.npcs[i].forceChat("Flee from me, " + c.playerName + "!"); } else if (Misc.random(5) == 1) { @@ -203,7 +205,7 @@ public static void attackPlayer(Player c, int i) { c.getPlayerAssistant().createPlayersProjectile(nX, nY, offX, offY, 50, NpcHandler.getProjectileSpeed(i), NpcHandler.npcs[i].projectileId, 43, 31, -c.getId() - 1, 65); } int random = Misc.random(10); - if (NpcHandler.npcs[i].npcType == 222 && (NpcHandler.npcs[i].killerId > 0 && NpcHandler.npcs[i].underAttack) && !NpcHandler.npcs[i].isDead && (NpcHandler.npcs[i].HP < NpcHandler.npcs[i].MaxHP + 1)) { + if (NpcHandler.npcs[i].npcType == MONK && (NpcHandler.npcs[i].killerId > 0 && NpcHandler.npcs[i].underAttack) && !NpcHandler.npcs[i].isDead && (NpcHandler.npcs[i].HP < NpcHandler.npcs[i].MaxHP + 1)) { if (random < 3) { NpcHandler.npcs[i].HP += 2; //NpcHandler.npcs[i].startAnimation(84); @@ -245,14 +247,14 @@ public static void loadSpell2(int i) { } public static void loadSpell(Player c, int i) { - if (NpcHandler.npcs[i].npcType > 2462 && NpcHandler.npcs[i].npcType < 2469 || NpcHandler.npcs[i].npcType > 3751 && NpcHandler.npcs[i].npcType < 3762) { + if (NpcHandler.npcs[i].npcType > PHEASANT_2462 && NpcHandler.npcs[i].npcType < FROG_2469 || NpcHandler.npcs[i].npcType > SPINNER_3751 && NpcHandler.npcs[i].npcType < DEFILER) { NpcHandler.npcs[i].attackType = AttackType.MAGIC.getValue(); } - if (NpcHandler.npcs[i].npcType > 3761 && NpcHandler.npcs[i].npcType < 3772) { + if (NpcHandler.npcs[i].npcType > TORCHER_3761 && NpcHandler.npcs[i].npcType < BRAWLER) { NpcHandler.npcs[i].attackType = AttackType.RANGE.getValue(); } switch (NpcHandler.npcs[i].npcType) { - case 1158://kq first form + case KALPHITE_QUEEN://kq first form int kqRandom = Misc.random(3); if (kqRandom == 2) { NpcHandler.npcs[i].projectileId = 280; //gfx @@ -262,7 +264,7 @@ public static void loadSpell(Player c, int i) { NpcHandler.npcs[i].attackType = AttackType.MELEE.getValue(); } break; - case 1160://kq secondform + case KALPHITE_QUEEN_1160://kq secondform int kqRandom2 = Misc.random(3); if (kqRandom2 == 2) { NpcHandler.npcs[i].projectileId = 279; //gfx @@ -272,51 +274,48 @@ public static void loadSpell(Player c, int i) { NpcHandler.npcs[i].attackType = AttackType.MELEE.getValue(); } break; - case 2607: + case TZHAARXIL_2607: NpcHandler.npcs[i].attackType = AttackType.RANGE.getValue(); - case 2591: + case TZHAARMEJ: NpcHandler.npcs[i].attackType = AttackType.MAGIC.getValue(); break; - case 172: - case 174: + case DARK_WIZARD: + case DARK_WIZARD_174: NpcHandler.npcs[i].gfx100(96); // Dark Wizards use earth strike NpcHandler.npcs[i].projectileId = 97; NpcHandler.npcs[i].endGfx = 98; NpcHandler.npcs[i].attackType = AttackType.MAGIC.getValue(); break; - case 3068: - if(Misc.random(10) > 7) { - NpcHandler.npcs[i].projectileId = 393; //red - NpcHandler.npcs[i].endGfx = 430; - NpcHandler.npcs[i].attackType = AttackType.FIRE_BREATH.getValue(); - NpcData.startAnimation(2989, i); - } else { - NpcData.startAnimation(2980, i); - NpcHandler.npcs[i].attackType = AttackType.MELEE.getValue(); - } - break; - case 2892: + case SKELETAL_WYVERN: + if(Misc.random(10) > 7) { + NpcHandler.npcs[i].projectileId = 393; //red + NpcHandler.npcs[i].endGfx = 430; + NpcHandler.npcs[i].attackType = AttackType.FIRE_BREATH.getValue(); + NpcData.startAnimation(2989, i); + } else { + NpcData.startAnimation(2980, i); + NpcHandler.npcs[i].attackType = AttackType.MELEE.getValue(); + } + break; + case SPINOLYP: NpcHandler.npcs[i].projectileId = 94; NpcHandler.npcs[i].attackType = AttackType.MAGIC.getValue(); NpcHandler.npcs[i].endGfx = 95; break; - case 2894: + case SPINOLYP_2894: NpcHandler.npcs[i].projectileId = 298; NpcHandler.npcs[i].attackType = AttackType.RANGE.getValue(); break; /* * Better Dragons */ - case 5363: // Mithril-Dragon - case 53: // Red Dragon - case 54: // Black-Dragon - case 55: // Blue-Dragon - case 941: // Green-Dragon - case 4682: - case 5362: - case 1590: - case 1591: - case 1592: + case RED_DRAGON: // Red Dragon + case BLACK_DRAGON: // Black-Dragon + case BLUE_DRAGON: // Blue-Dragon + case GREEN_DRAGON: // Green-Dragon + case BRONZE_DRAGON: + case IRON_DRAGON: + case STEEL_DRAGON: int random1 = Misc.random(3); switch (random1) { case 1: @@ -331,7 +330,7 @@ public static void loadSpell(Player c, int i) { break; } break; - case 134: + case POISON_SPIDER: if (c.playerLevel[Constants.PRAYER] > 0) { c.playerLevel[Constants.PRAYER]--; c.getPlayerAssistant().refreshSkill(Constants.PRAYER); @@ -340,9 +339,9 @@ public static void loadSpell(Player c, int i) { } break; - case 3590: - case 50: - case 742: + case STEEL_DRAGON_3590: + case KING_BLACK_DRAGON: + case ELVARG: int random = Misc.random(4); switch (random) { case 0: @@ -372,73 +371,7 @@ public static void loadSpell(Player c, int i) { break; } break; - // arma npcs - case 2561: - NpcHandler.npcs[i].attackType = AttackType.MELEE.getValue(); - break; - case 2560: - NpcHandler.npcs[i].attackType = AttackType.RANGE.getValue(); - NpcHandler.npcs[i].projectileId = 1190; - break; - case 2559: - NpcHandler.npcs[i].attackType = AttackType.MAGIC.getValue(); - NpcHandler.npcs[i].projectileId = 1203; - break; - case 2558: - random = Misc.random(1); - NpcHandler.npcs[i].attackType = AttackType.RANGE.getValue() + random; - if (NpcHandler.npcs[i].attackType == AttackType.RANGE.getValue()) { - NpcHandler.npcs[i].projectileId = 1197; - } else { - NpcHandler.npcs[i].attackType = AttackType.MAGIC.getValue(); - NpcHandler.npcs[i].projectileId = 1198; - } - break; - // sara npcs - case 2562: // sara - random = Misc.random(1); - if (random == 0) { - NpcHandler.npcs[i].attackType = AttackType.MAGIC.getValue(); - NpcHandler.npcs[i].endGfx = 1224; - NpcHandler.npcs[i].projectileId = -1; - } else if (random == 1) { - NpcHandler.npcs[i].attackType = AttackType.MELEE.getValue(); - } - break; - case 2563: // star - NpcHandler.npcs[i].attackType = AttackType.MELEE.getValue(); - break; - case 2564: // growler - NpcHandler.npcs[i].attackType = AttackType.MAGIC.getValue(); - NpcHandler.npcs[i].projectileId = 1203; - break; - case 2565: // bree - NpcHandler.npcs[i].attackType = AttackType.RANGE.getValue(); - NpcHandler.npcs[i].projectileId = 9; - break; - // bandos npcs - case 2550: - random = Misc.random(2); - if (random == 0 || random == 1) { - NpcHandler.npcs[i].attackType = AttackType.MELEE.getValue(); - } else { - NpcHandler.npcs[i].attackType = AttackType.RANGE.getValue(); - NpcHandler.npcs[i].endGfx = 1211; - NpcHandler.npcs[i].projectileId = 288; - } - break; - case 2551: - NpcHandler.npcs[i].attackType = AttackType.MELEE.getValue(); - break; - case 2552: - NpcHandler.npcs[i].attackType = AttackType.MAGIC.getValue(); - NpcHandler.npcs[i].projectileId = 1203; - break; - case 2553: - NpcHandler.npcs[i].attackType = AttackType.RANGE.getValue(); - NpcHandler.npcs[i].projectileId = 1206; - break; - case 2025: + case AHRIM_THE_BLIGHTED: NpcHandler.npcs[i].attackType = AttackType.MAGIC.getValue(); int r = Misc.random(3); if (r == 0) { @@ -461,23 +394,23 @@ public static void loadSpell(Player c, int i) { NpcHandler.npcs[i].projectileId = 156; } break; - case 2881:// supreme + case DAGANNOTH_SUPREME:// supreme NpcHandler.npcs[i].attackType = AttackType.RANGE.getValue(); NpcHandler.npcs[i].projectileId = 298; break; - case 2882:// prime + case DAGANNOTH_PRIME:// prime NpcHandler.npcs[i].attackType = AttackType.MAGIC.getValue(); NpcHandler.npcs[i].projectileId = 162; NpcHandler.npcs[i].endGfx = 477; break; - case 2028: + case KARIL_THE_TAINTED: NpcHandler.npcs[i].attackType = AttackType.RANGE.getValue(); NpcHandler.npcs[i].projectileId = 27; break; - case 3200: + case CHAOS_ELEMENTAL: int r2 = Misc.random(1); if (r2 == 0) { NpcHandler.npcs[i].attackType = AttackType.RANGE.getValue(); @@ -491,7 +424,7 @@ public static void loadSpell(Player c, int i) { NpcHandler.npcs[i].endGfx = 555; } break; - case 2745: + case TZTOKJAD: int r3 = 0; if (NpcHandler .goodDistance( @@ -516,13 +449,13 @@ public static void loadSpell(Player c, int i) { NpcHandler.npcs[i].projectileId = -1; } break; - case 2743: + case KETZEK: NpcHandler.npcs[i].attackType = AttackType.MAGIC.getValue(); NpcHandler.npcs[i].projectileId = 445; NpcHandler.npcs[i].endGfx = 446; break; - case 2631: + case TOKXIL: NpcHandler.npcs[i].attackType = AttackType.RANGE.getValue(); NpcHandler.npcs[i].projectileId = 443; break; diff --git a/2006Scape Server/src/main/java/com/rs2/game/npcs/NpcData.java b/2006Scape Server/src/main/java/com/rs2/game/npcs/NpcData.java index b9086a456..a8a72808c 100644 --- a/2006Scape Server/src/main/java/com/rs2/game/npcs/NpcData.java +++ b/2006Scape Server/src/main/java/com/rs2/game/npcs/NpcData.java @@ -195,16 +195,6 @@ public static int getNpcDelay(int i) { case TZTOKJAD: return 8; - case ADAMANTITE_ORE: - case RUNITE_ORE: - case SILVER_ORE: - case GOLD_ORE: - case DWARVEN_MINER_2550: - return 6; - // saradomin gw boss - case COAL: - return 2; - default: return 5; } @@ -258,17 +248,6 @@ public static int getRespawnTime(int i) { case DAGANNOTH_SUPREME: case DAGANNOTH_PRIME: case DAGANNOTH_REX: - case ADAMANTITE_ORE: - case RUNITE_ORE: - case SILVER_ORE: - case GOLD_ORE: - case COAL: - case PERFECT_GOLD_ORE: - case ORDAN: - case DWARVEN_MINER_2550: - case DWARVEN_MINER_2551: - case DWARVEN_MINER_2552: - case BLAST_FURNACE_FOREMAN: return 100; case PORTAL: case PORTAL_3778: @@ -302,16 +281,6 @@ public static int distanceRequired(int i) { case DAGANNOTH_PRIME: case CHAOS_ELEMENTAL:// chaos ele return 8; - case DWARVEN_MINER_2552: - case BLAST_FURNACE_FOREMAN: - case IRON_ORE: - case MITHRIL_ORE: - case ADAMANTITE_ORE: - case RUNITE_ORE: - case SILVER_ORE: - case ORDAN: - case JORZIK: - return 9; // things around dags case SPINOLYP: case SPINOLYP_2894: diff --git a/2006Scape Server/src/main/java/com/rs2/game/npcs/NpcHandler.java b/2006Scape Server/src/main/java/com/rs2/game/npcs/NpcHandler.java index 2d957b68b..a82aca006 100644 --- a/2006Scape Server/src/main/java/com/rs2/game/npcs/NpcHandler.java +++ b/2006Scape Server/src/main/java/com/rs2/game/npcs/NpcHandler.java @@ -931,16 +931,6 @@ public static boolean multiAttacks(int i) { if (npcs[i].attackType == AttackType.RANGE.getValue()) { return true; } - case ADAMANTITE_ORE: // What were these supposed to be... - return true; - case COAL: - if (npcs[i].attackType == AttackType.MAGIC.getValue()) { - return true; - } - case DWARVEN_MINER_2550: - if (npcs[i].attackType == AttackType.RANGE.getValue()) { - return true; - } default: return false; } @@ -1313,16 +1303,6 @@ public static int distanceRequired(int i) { return 8; case DAGANNOTH_REX:// rex return 1; - case DWARVEN_MINER_2552: - case BLAST_FURNACE_FOREMAN: - case IRON_ORE: - case MITHRIL_ORE: - case ADAMANTITE_ORE: - case RUNITE_ORE: - case SILVER_ORE: - case ORDAN: - case JORZIK: - return 9; // things around dags case SPINOLYP: case SPINOLYP_2894: @@ -1334,11 +1314,6 @@ public static int distanceRequired(int i) { public static int followDistance(int i) { switch (npcs[i].npcType) { - case DWARVEN_MINER_2550: - case DWARVEN_MINER_2551: - case COAL: - case PERFECT_GOLD_ORE: - return 8; case DAGANNOTH_REX: return 4; case DAGANNOTH_SUPREME: @@ -1441,19 +1416,9 @@ public static int getMaxHit(int i) { switch (npcs[i].npcType) { case KALPHITE_QUEEN: return 30; - case ADAMANTITE_ORE: // There's no way adamantite ore has two attack types, right? Maybe it does... - if (npcs[i].attackType == AttackType.MAGIC.getValue()) { - return 28; - } else { - return 68; - } case ROCK_CRAB: case ROCK_CRAB_1267: return 2; - case COAL: - return 31; - case DWARVEN_MINER_2550: - return 36; } return 1; } From 3a09692b394614b49be3f4454f08e8ad60170e37 Mon Sep 17 00:00:00 2001 From: ipkpjersi Date: Mon, 28 Oct 2024 20:58:24 -0400 Subject: [PATCH 6/7] Removed more GWD NPCs --- 2006Scape Server/src/main/java/com/rs2/game/npcs/NpcData.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/2006Scape Server/src/main/java/com/rs2/game/npcs/NpcData.java b/2006Scape Server/src/main/java/com/rs2/game/npcs/NpcData.java index a8a72808c..18c01004f 100644 --- a/2006Scape Server/src/main/java/com/rs2/game/npcs/NpcData.java +++ b/2006Scape Server/src/main/java/com/rs2/game/npcs/NpcData.java @@ -214,9 +214,6 @@ public static int getHitDelay(int i) { case KETZEK: case TOKXIL: - case ADAMANTITE_ORE: - case RUNITE_ORE: - case SILVER_ORE: return 3; case TZTOKJAD: From 6e852204e6adf95b270b2643499b3f2368f4e993 Mon Sep 17 00:00:00 2001 From: ipkpjersi Date: Mon, 28 Oct 2024 21:09:05 -0400 Subject: [PATCH 7/7] Refactored remaining NPC IDs --- .../game/content/combat/CombatAssistant.java | 34 ++++++++++--------- .../game/content/combat/npcs/NpcEmotes.java | 21 ++++++------ .../content/combat/range/DwarfCannon.java | 3 +- .../minigames/magetrainingarena/Alchemy.java | 3 +- .../game/content/skills/thieving/Stalls.java | 4 ++- .../com/rs2/net/packets/impl/ClickNPC.java | 3 +- 6 files changed, 38 insertions(+), 30 deletions(-) diff --git a/2006Scape Server/src/main/java/com/rs2/game/content/combat/CombatAssistant.java b/2006Scape Server/src/main/java/com/rs2/game/content/combat/CombatAssistant.java index 1e03e75e5..f50e52a96 100644 --- a/2006Scape Server/src/main/java/com/rs2/game/content/combat/CombatAssistant.java +++ b/2006Scape Server/src/main/java/com/rs2/game/content/combat/CombatAssistant.java @@ -30,6 +30,8 @@ import com.rs2.world.Boundary; import com.rs2.world.clip.PathFinder; +import static com.rs2.game.content.StaticNpcList.*; + /** * @author whoever contributed * @author Andrew (Mr Extremez) @@ -89,7 +91,7 @@ public void delayedHit(int i) { // npc hit delay NpcHandler.npcs[i].gfx0(758); } if (Misc.random(NpcHandler.npcs[i].defence) > Misc.random(10 + calculateRangeAttack()) && !ignoreDef - || (NpcHandler.npcs[i].npcType == 2881 || NpcHandler.npcs[i].npcType == 2883 && !ignoreDef)) { + || (NpcHandler.npcs[i].npcType == DAGANNOTH_SUPREME || NpcHandler.npcs[i].npcType == DAGANNOTH_REX && !ignoreDef)) { damage = 0; } if (Misc.random(4) == 1 && player.lastArrowUsed == 9242 && damage > 0) { @@ -182,7 +184,7 @@ public void delayedHit(int i) { // npc hit delay if (Misc.random(NpcHandler.npcs[i].defence) > 10 + Misc.random(mageAtk()) + bonusAttack) { damage = 0; magicFailed = true; - } else if (NpcHandler.npcs[i].npcType == 2881 || NpcHandler.npcs[i].npcType == 2882) { + } else if (NpcHandler.npcs[i].npcType == DAGANNOTH_SUPREME || NpcHandler.npcs[i].npcType == DAGANNOTH_PRIME) { damage = 0; magicFailed = true; } @@ -278,7 +280,7 @@ public void applyNpcMeleeDamage(int i, int damageMask) { if (!fullVeracsEffect) { if (Misc.random(NpcHandler.npcs[i].defence) > 10 + Misc.random(calcAtt())) { damage = 0; - } else if (NpcHandler.npcs[i].npcType == 2882 || NpcHandler.npcs[i].npcType == 2883) { + } else if (NpcHandler.npcs[i].npcType == DAGANNOTH_PRIME || NpcHandler.npcs[i].npcType == DAGANNOTH_REX) { damage = 0; } } @@ -296,7 +298,7 @@ public void applyNpcMeleeDamage(int i, int damageMask) { guthansEffect = true; } } - if (player.fightMode == 3 && NpcHandler.npcs[i].npcType != 2459 && NpcHandler.npcs[i].npcType != 2460 && NpcHandler.npcs[i].npcType != 2461 && NpcHandler.npcs[i].npcType != 2462) { + 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) { player.getPlayerAssistant().addSkillXP(damage * CombatConstants.MELEE_EXP_RATE / 3, 0); player.getPlayerAssistant().addSkillXP(damage * CombatConstants.MELEE_EXP_RATE / 3, 1); player.getPlayerAssistant().addSkillXP(damage * CombatConstants.MELEE_EXP_RATE / 3, 2); @@ -306,7 +308,7 @@ public void applyNpcMeleeDamage(int i, int damageMask) { player.getPlayerAssistant().refreshSkill(Constants.STRENGTH); player.getPlayerAssistant().refreshSkill(Constants.HITPOINTS); } else { - if (NpcHandler.npcs[i].npcType != 2459 && NpcHandler.npcs[i].npcType != 2460 && NpcHandler.npcs[i].npcType != 2461 && NpcHandler.npcs[i].npcType != 2462) { + if (NpcHandler.npcs[i].npcType != PHEASANT && NpcHandler.npcs[i].npcType != PHEASANT_2460 && NpcHandler.npcs[i].npcType != PHEASANT_2461 && NpcHandler.npcs[i].npcType != PHEASANT_2462) { player.getPlayerAssistant().addSkillXP(damage * CombatConstants.MELEE_EXP_RATE, player.fightMode); player.getPlayerAssistant().addSkillXP(damage * CombatConstants.MELEE_EXP_RATE / 3, 3); player.getPlayerAssistant().refreshSkill(player.fightMode); @@ -479,7 +481,7 @@ public void attackNpc(int i) { if (!SlayerRequirements.itemNeededSlayer(player, i) || !player.getSlayer().canAttackNpc(i)) { return; } - if (NpcHandler.npcs[i].npcType == 757 && player.vampSlayer > 2) { + if (NpcHandler.npcs[i].npcType == COUNT_DRAYNOR && player.vampSlayer > 2) { if (!player.getItemAssistant().playerHasItem(1549, 1) || !player.getItemAssistant().playerHasItem(2347, 1)) { player.getPacketSender().sendMessage("You need a stake and hammer to attack count draynor."); resetPlayerAttack(); @@ -491,12 +493,12 @@ public void attackNpc(int i) { resetPlayerAttack(); return; } - if (NpcHandler.npcs[i].npcType == 1676) { + if (NpcHandler.npcs[i].npcType == EXPERIMENT) { player.getPacketSender().sendMessage("You don't have the heart to kill the poor creature again."); resetPlayerAttack(); return; } - if (NpcHandler.npcs[i].npcType == 411) { + if (NpcHandler.npcs[i].npcType == SWARM) { player.getPacketSender().sendMessage("You can't attack a swarm!"); resetPlayerAttack(); return; @@ -1743,14 +1745,14 @@ public void removeRecoil(Player c2) { public int getBonusAttack(int i) { switch (NpcHandler.npcs[i].npcType) { - case 2883: - return Misc.random(50) + 30; - case 2026: - case 2027: - case 2029: - case 2030: - return Misc.random(50) + 30; - } + case DAGANNOTH_REX: + return Misc.random(50) + 30; + case DHAROK_THE_WRETCHED: + case GUTHAN_THE_INFESTED: + case TORAG_THE_CORRUPTED: + case VERAC_THE_DEFILED: + return Misc.random(50) + 30; + } return 0; } diff --git a/2006Scape Server/src/main/java/com/rs2/game/content/combat/npcs/NpcEmotes.java b/2006Scape Server/src/main/java/com/rs2/game/content/combat/npcs/NpcEmotes.java index 54739685e..b37b5dda5 100644 --- a/2006Scape Server/src/main/java/com/rs2/game/content/combat/npcs/NpcEmotes.java +++ b/2006Scape Server/src/main/java/com/rs2/game/content/combat/npcs/NpcEmotes.java @@ -1,6 +1,7 @@ package com.rs2.game.content.combat.npcs; import com.rs2.GameEngine; +import com.rs2.game.content.StaticNpcList; import com.rs2.game.content.combat.AttackType; import com.rs2.game.npcs.NpcHandler; import com.rs2.game.players.Player; @@ -160,8 +161,8 @@ public static int getBlockEmote(int i) { return e.getBlock(); } else { switch (NpcHandler.npcs[i].npcType) { - case 2745: - return 2653; + case StaticNpcList.TZTOKJAD: + return 2653; } } } @@ -176,14 +177,14 @@ public static int getDeadEmote(Player player, int i) { return e.getDead(); } else { switch (NpcHandler.npcs[i].npcType) { - case 2745: - return 2654; - case 1158: - GameEngine.npcHandler.spawnSecondForm(player, i); - return 1187; - case 1160: - GameEngine.npcHandler.spawnFirstForm(player, i); - return 1182; + case StaticNpcList.TZTOKJAD: + return 2654; + case StaticNpcList.KALPHITE_QUEEN: + GameEngine.npcHandler.spawnSecondForm(player, i); + return 1187; + case StaticNpcList.KALPHITE_QUEEN_1160: + GameEngine.npcHandler.spawnFirstForm(player, i); + return 1182; } } } diff --git a/2006Scape Server/src/main/java/com/rs2/game/content/combat/range/DwarfCannon.java b/2006Scape Server/src/main/java/com/rs2/game/content/combat/range/DwarfCannon.java index 3c0c252fc..6c6cc1d16 100644 --- a/2006Scape Server/src/main/java/com/rs2/game/content/combat/range/DwarfCannon.java +++ b/2006Scape Server/src/main/java/com/rs2/game/content/combat/range/DwarfCannon.java @@ -5,6 +5,7 @@ import com.rs2.event.CycleEvent; import com.rs2.event.CycleEventContainer; import com.rs2.event.CycleEventHandler; +import com.rs2.game.content.StaticNpcList; import com.rs2.game.content.combat.CombatConstants; import com.rs2.game.npcs.Npc; import com.rs2.game.npcs.NpcHandler; @@ -450,7 +451,7 @@ private Npc targetNpc() { - if (!npc.isDead && !npc.isDead && npc.HP != 0 && npc.npcType != 1266 && npc.npcType != 1268 && inDistance(theirX, theirY)) { + if (!npc.isDead && !npc.isDead && npc.HP != 0 && npc.npcType != StaticNpcList.ROCKS && npc.npcType != StaticNpcList.ROCKS_1268 && inDistance(theirX, theirY)) { switch (rotation) { case 1: if (theirY > myY && theirX >= myX - 1 && theirX <= myX + 1) { diff --git a/2006Scape Server/src/main/java/com/rs2/game/content/minigames/magetrainingarena/Alchemy.java b/2006Scape Server/src/main/java/com/rs2/game/content/minigames/magetrainingarena/Alchemy.java index ddc87b869..1b4a1f667 100644 --- a/2006Scape Server/src/main/java/com/rs2/game/content/minigames/magetrainingarena/Alchemy.java +++ b/2006Scape Server/src/main/java/com/rs2/game/content/minigames/magetrainingarena/Alchemy.java @@ -3,6 +3,7 @@ import java.util.Random; import com.rs2.Constants; +import com.rs2.game.content.StaticNpcList; import com.rs2.game.content.combat.magic.MagicData; import com.rs2.game.content.combat.magic.MagicRequirements; import com.rs2.game.content.music.sound.SoundList; @@ -141,7 +142,7 @@ public static void process() { // 1 in 4 chance of an item being free to alch freeAlch = random.nextInt(values.length * 4); for (int i = 0; i < NpcHandler.MAX_NPCS; i ++) { - if (NpcHandler.npcs[i] != null && NpcHandler.npcs[i].npcType == 3099) { + if (NpcHandler.npcs[i] != null && NpcHandler.npcs[i].npcType == StaticNpcList.ALCHEMY_GUARDIAN) { NpcHandler.npcs[i].forceChat("Items are changing!"); } } diff --git a/2006Scape Server/src/main/java/com/rs2/game/content/skills/thieving/Stalls.java b/2006Scape Server/src/main/java/com/rs2/game/content/skills/thieving/Stalls.java index 29dc8b630..18d14de14 100644 --- a/2006Scape Server/src/main/java/com/rs2/game/content/skills/thieving/Stalls.java +++ b/2006Scape Server/src/main/java/com/rs2/game/content/skills/thieving/Stalls.java @@ -13,6 +13,8 @@ import com.rs2.game.players.Player; import com.rs2.util.Misc; +import static com.rs2.game.content.StaticNpcList.*; + public class Stalls { @@ -221,7 +223,7 @@ private static int getRespawnTime(int i) { private static void failGuards(final Player p) { for (int i = 1; i < NpcHandler.MAX_NPCS; i ++) { if (NpcHandler.npcs[i] != null) { - if (NpcHandler.npcs[i].npcType == 32 || NpcHandler.npcs[i].npcType == 1317 || NpcHandler.npcs[i].npcType == 2236 || NpcHandler.npcs[i].npcType == 2571) { + 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) { if (p.goodDistance(p.absX, p.absY, NpcHandler.npcs[i].absX, NpcHandler.npcs[i].absY, 7) && p.heightLevel == NpcHandler.npcs[i].heightLevel) { if (!NpcHandler.npcs[i].underAttack) { diff --git a/2006Scape Server/src/main/java/com/rs2/net/packets/impl/ClickNPC.java b/2006Scape Server/src/main/java/com/rs2/net/packets/impl/ClickNPC.java index 6f60a7127..f495c7913 100644 --- a/2006Scape Server/src/main/java/com/rs2/net/packets/impl/ClickNPC.java +++ b/2006Scape Server/src/main/java/com/rs2/net/packets/impl/ClickNPC.java @@ -6,6 +6,7 @@ import com.rs2.event.impl.NpcFirstClickEvent; import com.rs2.event.impl.NpcSecondClickEvent; import com.rs2.event.impl.NpcThirdClickEvent; +import com.rs2.game.content.StaticNpcList; import com.rs2.game.content.combat.CombatConstants; import com.rs2.game.content.combat.magic.MagicData; import com.rs2.game.content.combat.range.RangeData; @@ -198,7 +199,7 @@ public void processPacket(final Player player, Packet packet) { } if (NpcHandler.npcs[player.npcIndex].MaxHP == 0 - || NpcHandler.npcs[player.npcIndex].npcType == 944) { + || NpcHandler.npcs[player.npcIndex].npcType == StaticNpcList.COMBAT_INSTRUCTOR) { player.getPacketSender().sendMessage( "You can't attack this npc."); break;