[PR #493] Fix Broken Game Sounds on Large ID NPCS #3337

Closed
opened 2026-05-24 12:21:25 +00:00 by Dark98 · 0 comments
Owner

Original Pull Request: https://github.com/2006-Scape/2006Scape/pull/493

State: closed
Merged: Yes


  • 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.

image

**Original Pull Request:** https://github.com/2006-Scape/2006Scape/pull/493 **State:** closed **Merged:** Yes --- - 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. ![image](https://user-images.githubusercontent.com/2869411/114944245-551cc380-9e9b-11eb-91f1-be7698e4adaa.png)
Dark98 added the pull-request label 2026-05-24 12:21:25 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: 2006-Scape/2006Scape#3337