Replace get NPC name associate array method to indexed array method
The current code uses a GetNpcName method which incorrectly assumes that the NPC List is an associate array where the ID is the index. This is not the case as the index is actually incremental.
While I would have rather changed the NPC List to be an associate array, as in the future writing code like this is not scalable for thousands of people on each server with thousands of NPC's, however that would require a rewrite of other methods too.
I found this issue when I attempted to kill Giant Mole which has an ID of 3340 but an array index of 2773. There is no npc with the index of 3340 so it crashed the server.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
## 📋 Pull Request Information
**Original PR:** https://github.com/2006-Scape/2006Scape/pull/493
**Author:** [@puremana](https://github.com/puremana)
**Created:** 4/15/2021
**Status:** ✅ Merged
**Merged:** 4/23/2021
**Merged by:** [@Dark98](https://github.com/Dark98)
**Base:** `master` ← **Head:** `fix-npc-game-sounds`
---
### 📝 Commits (1)
- [`f0c2547`](https://github.com/2006-Scape/2006Scape/commit/f0c25476ae5a5225d91dc2bcd83015322992f943) Replace get npc name associate array method to indexed array method
### 📊 Changes
**1 file changed** (+8 additions, -1 deletions)
<details>
<summary>View changed files</summary>
📝 `2006Scape Server/src/main/java/com/rs2/game/content/music/sound/CombatSounds.java` (+8 -1)
</details>
### 📄 Description
- Replace get NPC name associate array method to indexed array method
The current code uses a `GetNpcName` method which incorrectly assumes that the NPC List is an associate array where the ID is the index. This is not the case as the index is actually incremental.
While I would have rather changed the NPC List to be an associate array, as in the future writing code like this is not scalable for thousands of people on each server with thousands of NPC's, however that would require a rewrite of other methods too.
I found this issue when I attempted to kill Giant Mole which has an ID of 3340 but an array index of 2773. There is no npc with the index of 3340 so it crashed the server.

---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/2006-Scape/2006Scape/pull/493
Author: @puremana
Created: 4/15/2021
Status: ✅ Merged
Merged: 4/23/2021
Merged by: @Dark98
Base:
master← Head:fix-npc-game-sounds📝 Commits (1)
f0c2547Replace get npc name associate array method to indexed array method📊 Changes
1 file changed (+8 additions, -1 deletions)
View changed files
📝
2006Scape Server/src/main/java/com/rs2/game/content/music/sound/CombatSounds.java(+8 -1)📄 Description
The current code uses a
GetNpcNamemethod which incorrectly assumes that the NPC List is an associate array where the ID is the index. This is not the case as the index is actually incremental.While I would have rather changed the NPC List to be an associate array, as in the future writing code like this is not scalable for thousands of people on each server with thousands of NPC's, however that would require a rewrite of other methods too.
I found this issue when I attempted to kill Giant Mole which has an ID of 3340 but an array index of 2773. There is no npc with the index of 3340 so it crashed the server.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.