Thread: [592, 614, 634, 643, 647, 666, 667, 718] Enum & Structs dump

Results 1 to 2 of 2
  1. #1 [592, 614, 634, 643, 647, 666, 667, 718] Enum & Structs dump 
    Registered Member

    Join Date
    Sep 2020
    Posts
    21
    Thanks given
    34
    Thanks received
    27
    Rep Power
    237
    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.

    Code:
    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)
    For structs, there is only one opcode which is written, 249.

    Code:
    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)
    Examples
    Prayers are a prime example of data within the enums/structs that can be used. Take a look at enum 2279:

    Code:
       {
          "id": 2279,
          "values": {
            "0": 660,
            "1": 661,
            "2": 662,
            "3": 678,
            "4": 679,
            "5": 663,
            "6": 664,
            "7": 665,
            "8": 666,
            "9": 667,
            "10": 668,
            "11": 680,
            "12": 681,
            "13": 669,
            "14": 670,
            "15": 671,
            "16": 684,
            "17": 672,
            "18": 673,
            "19": 674,
            "20": 682,
            "21": 683,
            "22": 675,
            "23": 676,
            "24": 677,
            "25": 685,
            "26": 1005,
            "27": 686,
            "28": 1029,
            "29": 1006
          }
        },
    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:

    Code:
        {
          "id": 686,
          "values": {
            "736": 950,
            "737": 70,
            "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.",
            "739": 1,
            "734": "Level 70\u003cbr\u003ePiety\u003cbr\u003eIncreases your Defence by 25%, Strength by 23%, and Attack by 20%.",
            "735": 946
          }
        },
    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).

    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:

    Code:
        {
          "id": 1088,
          "values": {
            "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.",
    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:

    Code:
        {
          "id": 1345,
          "values": {
            "0": "Adventure",
            "1": "Al Kharid",
            "2": "Alone",
            "3": "Ambient Jungle",
            "4": "Arabian",
            "5": "Arabian2",
            "6": "Arabian3",
            "7": "Arabique",
            "8": "Army of Darkness",
    Some things to note
    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.

    Enjoy.

    https://www.mediafire.com/file/6vire...ructs.zip/file
    Reply With Quote  
     

  2. Thankful users:


  3. #2  
    Donator

    Join Date
    Nov 2017
    Posts
    268
    Thanks given
    37
    Thanks received
    18
    Rep Power
    19
    Thank you for contributing this.
    Attached image
    Reply With Quote  
     

  4. Thankful user:



Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Replies: 4
    Last Post: 12-16-2020, 08:50 PM
  2. [667] 667-718 Mystery Box Release
    By Lucifer_ in forum Snippets
    Replies: 21
    Last Post: 09-11-2020, 09:46 AM
  3. [667] [667/718] Vote and hishcore needed willing to pay :)
    By kutleven in forum Requests
    Replies: 2
    Last Post: 07-01-2020, 11:56 PM
  4. Replies: 141
    Last Post: 08-05-2018, 09:01 PM
  5. Replies: 6
    Last Post: 07-22-2017, 02:36 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •