The community has known about these for a long time now but I have not come across a clear thread explaining what they are and how to use them properly. I thought I'd take the time to explain this in detail and provide a large dump for the community to make use of and easily find the data they are looking for.
What they are
Enums & structs are key-value pair mappings in the cache and both have a unique id to reference them. Every revision has different number of enums/structs. As you can imagine, as the game evolved and introduced new content, they introduced new structs/enums to hold data for their content and various other things. In some revision changes the structs/enums did not change or changed very slightly.
Where they are
Enums are in their own index, 17.
Structs are in the 'config' index, 2, inside archive 26.
How to obtain the data
For enums, you can obtain an enum by using its id. From index 17, get the data using the archive and file id. The archive bits are 8 and the file mask is 0xff. So from index 17, access archive: enumId >>> 8 and file enumId & 0xff. The byte array inside that file is the data for the enum with that id.
For structs, you can obtain struct data using its id. There are no archive bits or file mask for structs. From index 2, inside archive 26, access the file using the struct id. The byte array inside that file is the data for the struct with that id.
How to decode the data
For enums, opcodes 5 & 6 are the important part here. The size of the enum is written as an unsigned short, so read that first. This will tell you how many mappings there are. The key is an integer. Now if the opcode was 5, you must read a string next as this tells you that the data in the mapping is a string, otherwise read an integer. Here is some pseudo-like code to give you some insight.
For structs, there is only one opcode which is written, 249.
size -> read unsigned short
for i until size
key -> read integer
value -> if opcode is 5 then read string otherwise read integer
map.put -> (key, value)
size -> read unsigned byte
for i until size
dataType -> read unsigned byte //If this is 1 then the data type is a string otherwise integer.
key -> read medium integer
map.put -> (key, value)
Prayers are a prime example of data within the enums/structs that can be used. Take a look at enum 2279:
The key in the entry is the component id of the prayer widget (which is essentially the prayer id) and the value is the struct id. So for entry 27 (which is piety), it is mapped to 686. Lets take a look at struct 686:
Just by looking at it, we can deduce that the entry "737": 70, is the level required for the prayer and the entry "738" is the message sent if you do not have the prayer level required. Entry 734 is also the hover text. As you can see, we have just found out a lot of information regarding prayers that you would probably otherwise manually store somewhere (e.g a file or some enum entry).
"738": "You need a Prayer level of 70, a Defence level of 70 and to have completed the King\u0027s Ransom quest\u0027s Knight Wave reward to use Piety.",
"734": "Level 70\u003cbr\u003ePiety\u003cbr\u003eIncreases your Defence by 25%, Strength by 23%, and Attack by 20%.",
The data is not always represented the way prayers are. Sometimes you can get the data directly from a single struct or enum. Lets take a look at enum 1088. I will not post the entire enum as it is rather large:
As you can see, this enum maps the item set ids to the examine/inspect message. You can now deduce that 11814 is the item id for the bronze set armour and so on. This enum here did not have any data leading us to look inside another enum/struct which is a lot simpler than the prayer example. The same applies for music names in enum 1345:
"11814": "This item set is made up of a bronze full helm, platebody, legs and kiteshield.",
"11816": "This item set is made up of a bronze full helm, platebody, skirt and kiteshield.",
"11818": "This item set is made up of an iron full helm, platebody, legs and kiteshield.",
Some things to note
"1": "Al Kharid",
"3": "Ambient Jungle",
"8": "Army of Darkness",
Sometimes you will look at an enum and the values may surprise you/not make sense. Its usually a matter of figuring it out, sometimes experimenting and trying things out. The data is not always straight forward, the values can represent different things so be creative and think logically about what the data could be.
How to use these
My recommendation would be that when you are adding a feature into the game and you need data, you can use this dump to see if the data already exists. This way, you won't have to manually find item ids or messages or levels required etc and the data will most likely all be there. Sometimes the data can be split across an enum/struct but they are usually in consecutive order so the next enum/struct could have the continuation of the data. Design a way to load all the enum & struct data from the cache when you start your game so that they are easily accessible throughout the users's gameplay. Once they are loaded, the data should be immutable. When users need the data, you can access them very quickly by using the id of the struct/enum. This pattern applies for many other bits of data from the cache but lets not dive into that in this thread.
How to NOT use these
I would discourage you from parsing this data and loading them up manually from the files in this dump. This defeats the purpose because you should already be loading what you need from the cache when starting up your game. For example loading the item data, loading map data etc etc. The dump is here to help you search for the data you may need and save you time from manually writing up item ids/messages/levels required etc.
Download the folder in the link, each revision will have its own folder with two files in there, the enums.json and structs.json. Take what you need from there. If someone could make a mirror that would be nice. Feel free to use this dump however you wish. You do not have to provide me credits for anything if you use this.
Credits are due to the people who released the caches. I've had these caches for some time don't know who released each of the cache's initially so if thats you and you want to be in the credits let me know . I cherry picked the revisions I wanted to include a dump for based on what I thought the community might like the most.