Thread: Elvarg V3.2 (Out of bounds)

Page 1 of 2 12 LastLast
Results 1 to 10 of 18
  1. #1 Elvarg V3.2 (Out of bounds) 
    Registered Member Fozzey's Avatar
    Join Date
    Jan 2014
    Posts
    33
    Thanks given
    8
    Thanks received
    1
    Rep Power
    11
    Hello and thanks to all who read and help me with this.

    I am getting an out of bounds issue when opening up an interface, so i know the obvious that its trying to read an index that's not there from best of my knowledge. My only problem is i don't know where
    to go from here. Basically i found that in my itemDefenitions.java the totalItems integer is outputting a value of 60k something when its max is at around 20k indexes. So my main struggle is understanding where to go
    with this information, am i looking at a cache issue or could be a code issue? Or could it be both? Going off the fact that the integer in question is labelled totalItems i can only assume its to do with the amount of items and
    how something is trying to go higher than the totalItems. I just have no clue where to start.
    Appreciate any help.

    Spoiler for Code:

    This is just the code part where i increased the integer passed what it was trying to find.
    Code:
     public static void init(FileArchive archive) {
            // item_data = new Buffer(archive.readFile("obj.dat"));
            // Buffer stream = new Buffer(archive.readFile("obj.idx"));
    
            item_data = new Buffer(FileUtils.readFile(SignLink.findcachedir() + "obj.dat"));
            Buffer stream = new Buffer(FileUtils.readFile(SignLink.findcachedir() + "obj.idx"));
    
            totalItems = stream.readUShort();
            streamIndices = new int[61000]; // I HAVE CHUCKED THIS 61000 IN JUST TO GET RID OF THE ANNOYING LOOP ERROR, ORIGINALLY WAS "totalItems".
            int offset = 2;
    
            for (int _ctr = 0; _ctr < totalItems; _ctr++) {
                streamIndices[_ctr] = offset;
                offset += stream.readUShort();
            }
    
            cache = new ItemDefinition[10];
    
            for (int _ctr = 0; _ctr < 10; _ctr++) {
                cache[_ctr] = new ItemDefinition();
            }
    
            System.out.println("Loaded: " + totalItems + " items");
        }
    This is where the stack leads me to where the error occurs, something to note is i haven't done anything with customs etc. and the interface im trying to use when receiving the error is the smithing interface to turn bars into items. Which somewhat makes the problem obviously about the game items.
    Code:
    public static ItemDefinition lookup(int itemId) {
            for (int count = 0; count < 10; count++)
                if (cache[count].id == itemId)
                    return cache[count];
    
            cacheIndex = (cacheIndex + 1) % 10;
            ItemDefinition itemDef = cache[cacheIndex];
            if (itemId > 0)
                item_data.currentPosition = streamIndices[itemId]; //This is the point the stack brings me to which made me investigate the code shown above.
            itemDef.id = itemId;
            itemDef.setDefaults();
            itemDef.readValues(item_data);
    
            if (itemDef.noted_item_id != -1)
                itemDef.toNote();
    
            if (itemId == 4724 || itemId == 4726 || itemId == 4728 || itemId == 4730 || itemId == 4753 || itemId == 4755 || itemId == 4757 || itemId == 4759 || itemId == 4745 || itemId == 4747 || itemId == 4749 || itemId == 4751 ||
                    itemId == 4708 || itemId == 4710 || itemId == 4712 || itemId == 4714 || itemId == 4732 || itemId == 4734 || itemId == 4736 || itemId == 4738 || itemId == 4716 || itemId == 4718 || itemId == 4720 || itemId == 4722) {
                itemDef.actions[2] = "Set";
            }
    
            //System.out.println("Item: "+itemDef.name+", equip models: "+itemDef.equipped_model_male_1+", "+itemDef.equipped_model_male_2+", "+itemDef.equipped_model_male_3);


    The stack if anyone wants to know what it shows.

    Spoiler for the stack:
    Code:
    java.lang.ArrayIndexOutOfBoundsException: Index 60907 out of bounds for length 22519
    	at com.runescape.cache.def.ItemDefinition.lookup(ItemDefinition.java:107)
    	at com.runescape.cache.def.ItemDefinition.getSprite(ItemDefinition.java:212)
    	at com.runescape.Client.drawInterface(Client.java:10862)
    	at com.runescape.Client.draw3dScreen(Client.java:12131)
    	at com.runescape.Client.moveCameraWithPlayer(Client.java:15836)
    	at com.runescape.Client.drawGameScreen(Client.java:10665)
    	at com.runescape.Client.processDrawing(Client.java:12051)
    	at com.runescape.GameApplet.run(GameApplet.java:219)
    	at com.runescape.Client.run(Client.java:7282)
    	at java.base/java.lang.Thread.run(Thread.java:831)
    Reply With Quote  
     

  2. #2  
    Super Donator

    Chivvon's Avatar
    Join Date
    May 2016
    Posts
    487
    Thanks given
    69
    Thanks received
    142
    Rep Power
    285
    Quote Originally Posted by Fozzey View Post
    Hello and thanks to all who read and help me with this.

    I am getting an out of bounds issue when opening up an interface, so i know the obvious that its trying to read an index that's not there from best of my knowledge. My only problem is i don't know where
    to go from here. Basically i found that in my itemDefenitions.java the totalItems integer is outputting a value of 60k something when its max is at around 20k indexes. So my main struggle is understanding where to go
    with this information, am i looking at a cache issue or could be a code issue? Or could it be both? Going off the fact that the integer in question is labelled totalItems i can only assume its to do with the amount of items and
    how something is trying to go higher than the totalItems. I just have no clue where to start.
    Appreciate any help.

    Spoiler for Code:

    This is just the code part where i increased the integer passed what it was trying to find.
    Code:
     public static void init(FileArchive archive) {
            // item_data = new Buffer(archive.readFile("obj.dat"));
            // Buffer stream = new Buffer(archive.readFile("obj.idx"));
    
            item_data = new Buffer(FileUtils.readFile(SignLink.findcachedir() + "obj.dat"));
            Buffer stream = new Buffer(FileUtils.readFile(SignLink.findcachedir() + "obj.idx"));
    
            totalItems = stream.readUShort();
            streamIndices = new int[61000]; // I HAVE CHUCKED THIS 61000 IN JUST TO GET RID OF THE ANNOYING LOOP ERROR, ORIGINALLY WAS "totalItems".
            int offset = 2;
    
            for (int _ctr = 0; _ctr < totalItems; _ctr++) {
                streamIndices[_ctr] = offset;
                offset += stream.readUShort();
            }
    
            cache = new ItemDefinition[10];
    
            for (int _ctr = 0; _ctr < 10; _ctr++) {
                cache[_ctr] = new ItemDefinition();
            }
    
            System.out.println("Loaded: " + totalItems + " items");
        }
    This is where the stack leads me to where the error occurs, something to note is i haven't done anything with customs etc. and the interface im trying to use when receiving the error is the smithing interface to turn bars into items. Which somewhat makes the problem obviously about the game items.
    Code:
    public static ItemDefinition lookup(int itemId) {
            for (int count = 0; count < 10; count++)
                if (cache[count].id == itemId)
                    return cache[count];
    
            cacheIndex = (cacheIndex + 1) % 10;
            ItemDefinition itemDef = cache[cacheIndex];
            if (itemId > 0)
                item_data.currentPosition = streamIndices[itemId];
            itemDef.id = itemId;
            itemDef.setDefaults();
            itemDef.readValues(item_data);
    
            if (itemDef.noted_item_id != -1)
                itemDef.toNote();
    
            if (itemId == 4724 || itemId == 4726 || itemId == 4728 || itemId == 4730 || itemId == 4753 || itemId == 4755 || itemId == 4757 || itemId == 4759 || itemId == 4745 || itemId == 4747 || itemId == 4749 || itemId == 4751 ||
                    itemId == 4708 || itemId == 4710 || itemId == 4712 || itemId == 4714 || itemId == 4732 || itemId == 4734 || itemId == 4736 || itemId == 4738 || itemId == 4716 || itemId == 4718 || itemId == 4720 || itemId == 4722) {
                itemDef.actions[2] = "Set";
            }
    
            //System.out.println("Item: "+itemDef.name+", equip models: "+itemDef.equipped_model_male_1+", "+itemDef.equipped_model_male_2+", "+itemDef.equipped_model_male_3);


    The stack if anyone wants to know what it shows.

    Spoiler for the stack:
    Code:
    java.lang.ArrayIndexOutOfBoundsException: Index 60907 out of bounds for length 22519
    	at com.runescape.cache.def.ItemDefinition.lookup(ItemDefinition.java:107)
    	at com.runescape.cache.def.ItemDefinition.getSprite(ItemDefinition.java:212)
    	at com.runescape.Client.drawInterface(Client.java:10862)
    	at com.runescape.Client.draw3dScreen(Client.java:12131)
    	at com.runescape.Client.moveCameraWithPlayer(Client.java:15836)
    	at com.runescape.Client.drawGameScreen(Client.java:10665)
    	at com.runescape.Client.processDrawing(Client.java:12051)
    	at com.runescape.GameApplet.run(GameApplet.java:219)
    	at com.runescape.Client.run(Client.java:7282)
    	at java.base/java.lang.Thread.run(Thread.java:831)
    Don't know which one; but it is a packet issue. Good luck.
    Reply With Quote  
     

  3. Thankful user:


  4. #3  
    Registered Member Fozzey's Avatar
    Join Date
    Jan 2014
    Posts
    33
    Thanks given
    8
    Thanks received
    1
    Rep Power
    11
    Quote Originally Posted by Chivvon View Post
    Don't know which one; but it is a packet issue. Good luck.
    You meaning opcode sizes? or some other packet issue.
    Reply With Quote  
     

  5. #4  
    Registered Member
    Join Date
    Jul 2021
    Posts
    95
    Thanks given
    21
    Thanks received
    19
    Rep Power
    44
    Quote Originally Posted by Fozzey View Post
    You meaning opcode sizes? or some other packet issue.
    Its not a packet issue, when does this trigger? It seems that you probably added newer OSRS data? if you did you probably didn't configure it properly.
    Reply With Quote  
     

  6. #5  
    Registered Member Fozzey's Avatar
    Join Date
    Jan 2014
    Posts
    33
    Thanks given
    8
    Thanks received
    1
    Rep Power
    11
    Quote Originally Posted by kippie View Post
    Its not a packet issue, when does this trigger? It seems that you probably added newer OSRS data? if you did you probably didn't configure it properly.
    It triggers when i open up the smithing interface to turn bars into items. This is a fresh download off of the thread, i havent updated data, coz im still trying to figure that out.


    Attached image
    Reply With Quote  
     

  7. #6  
    Registered Member
    Join Date
    Jul 2021
    Posts
    95
    Thanks given
    21
    Thanks received
    19
    Rep Power
    44
    Quote Originally Posted by Fozzey View Post
    It triggers when i open up the smithing interface to turn bars into items.
    Ur item decoding method is off anyways. Did u renecently pack new data?

    Decoding:

    Code:
    public static void init(Archive archive) {
            data_buffer = new Buffer(archive.get("obj.dat"));
            Buffer index_buffer = new Buffer(archive.get("obj.idx"));
            length = index_buffer.readUShort();
    
            pos = new int[length];
    
            int offset = 2;
            for (int index = 0; index < length; index++) {
                pos[index] = offset;
                offset += index_buffer.readUShort();
            }
    
            cache = new ItemDefinition[10];
    
            for (int index = 0; index < 10; index++) {
                cache[index] = new ItemDefinition();
            }
        }
    
        private void decode(Buffer buffer) {
            while (true) {
                int opcode = buffer.readUnsignedByte();
                if (opcode == 0)
                    return;
                if (opcode == 1)
                    inventoryModel = buffer.readUShort();
                else if (opcode == 2)
                    name = buffer.readString();
                else if (opcode == 3)
                    description = buffer.readString();
                else if (opcode == 4)
                    zoom2d = buffer.readUShort();
                else if (opcode == 5)
                    xan2d = buffer.readUShort();
                else if (opcode == 6)
                    yan2d = buffer.readUShort();
                else if (opcode == 7) {
                    xOffset2d = buffer.readUShort();
                    if (xOffset2d > 32767)
                        xOffset2d -= 65536;
                } else if (opcode == 8) {
                    yOffset2d = buffer.readUShort();
                    if (yOffset2d > 32767)
                        yOffset2d -= 65536;
                } else if (opcode == 9) {
                    unknown1 = buffer.readString();
                } else if (opcode == 11)
                    stackable = 1;
                else if (opcode == 12)
                    cost = buffer.readInt();
                else if (opcode == 16)
                    members = true;
                else if (opcode == 23) {
                    maleModel = buffer.readUShort();
                    maleOffset = buffer.readSignedByte();
                } else if (opcode == 24)
                    maleModel1 = buffer.readUShort();
                else if (opcode == 25) {
                    femaleModel = buffer.readUShort();
                    femaleOffset = buffer.readSignedByte();
                } else if (opcode == 26)
                    femaleModel1 = buffer.readUShort();
                else if (opcode >= 30 && opcode < 35) {
                    if (groundActions == null)
                        groundActions = new String[5];
                    groundActions[opcode - 30] = buffer.readString();
                    if (groundActions[opcode - 30].equalsIgnoreCase("hidden"))
                        groundActions[opcode - 30] = null;
                } else if (opcode >= 35 && opcode < 40) {
                    if (inventoryActions == null)
                        inventoryActions = new String[5];
                    inventoryActions[opcode - 35] = buffer.readString();
                } else if (opcode == 40) {
                    int length = buffer.readUnsignedByte();
                    recolorFrom = new short[length];
                    recolorTo = new short[length];
                    for (int index = 0; index < length; index++) {
                        recolorTo[index] = (short) buffer.readUShort();
                        recolorFrom[index] = (short) buffer.readUShort();
                    }
                } else if (opcode == 41) {
                    int length = buffer.readUnsignedByte();
                    retextureFrom = new short[length];
                    retextureTo = new short[length];
                    for (int index = 0; index < length; index++) {
                        retextureFrom[index] = (short) buffer.readUShort();
                        retextureTo[index] = (short) buffer.readUShort();
                    }
                } else if (opcode == 42) {
                    shiftClickIndex = buffer.readUnsignedByte();
                } else if (opcode == 65) {
                    isTradable = true;
                } else if (opcode == 78)
                    maleModel2 = buffer.readUShort();
                else if (opcode == 79)
                    femaleModel2 = buffer.readUShort();
                else if (opcode == 90)
                    maleHeadModel = buffer.readUShort();
                else if (opcode == 91)
                    femaleHeadModel = buffer.readUShort();
                else if (opcode == 92)
                    maleHeadModel2 = buffer.readUShort();
                else if (opcode == 93)
                    femaleHeadModel2 = buffer.readUShort();
                else if (opcode == 94)
                    category = buffer.readUShort();
                else if (opcode == 95)
                    zan2d = buffer.readUShort();
                else if (opcode == 97)
                    note = buffer.readUShort();
                else if (opcode == 98)
                    notedTemplate = buffer.readUShort();
                else if (opcode >= 100 && opcode < 110) {
                    if (countobj == null) {
                        countobj = new int[10];
                        countco = new int[10];
                    }
                    countobj[opcode - 100] = buffer.readUShort();
                    countco[opcode - 100] = buffer.readUShort();
                } else if (opcode == 110)
                    resizeX = buffer.readUShort();
                else if (opcode == 111)
                    resizeY = buffer.readUShort();
                else if (opcode == 112)
                    resizeZ = buffer.readUShort();
                else if (opcode == 113)
                    ambient = buffer.readSignedByte();
                else if (opcode == 114)
                    contrast = buffer.readSignedByte();
                else if (opcode == 115)
                    team = buffer.readUnsignedByte();
                else if (opcode == 139)
                    bought_id = buffer.readUShort();
                else if (opcode == 140)
                    bought_template_id = buffer.readUShort();
                else if (opcode == 148)
                    placeholder = buffer.readUShort();
                else if (opcode == 149) {
                    placeholderTemplate = buffer.readUShort();
                } else if (opcode == 249) {
                    int length = buffer.readUnsignedByte();
    
                    params = new HashMap<>(length);
    
                    for (int i = 0; i < length; i++) {
                        boolean isString = buffer.readUnsignedByte() == 1;
                        int key = buffer.read24Int();
                        Object value;
    
                        if (isString) {
                            value = buffer.readString();
                        } else {
                            value = buffer.readInt();
                        }
    
                        params.put(key, value);
                    }
                } else {
                    System.err.printf("Error unrecognised {Items} opcode: %d%n%n", opcode);
                }
            }
        }
    Reply With Quote  
     

  8. #7  
    Super Donator

    Chivvon's Avatar
    Join Date
    May 2016
    Posts
    487
    Thanks given
    69
    Thanks received
    142
    Rep Power
    285
    Quote Originally Posted by kippie View Post
    Its not a packet issue, when does this trigger? It seems that you probably added newer OSRS data? if you did you probably didn't configure it properly.
    It is. Well at least in elvarg 3.2 there is an issue that can cause this on certain interfaces. It is indeed possible after adding newer data. However, the issue I am referring to is present in elvarg 3.2 anyways.

    Quote Originally Posted by Fozzey View Post
    You meaning opcode sizes? or some other packet issue.
    Anyhow, it is a variable packet so the size is correct. The packet wasn't correctly implemented. I can't remember precisly which one it was. Just go over the variable packets client sided and compare what is being sent from the server. You should see some differences.
    Reply With Quote  
     

  9. #8  
    Registered Member
    Join Date
    Jul 2021
    Posts
    95
    Thanks given
    21
    Thanks received
    19
    Rep Power
    44
    Quote Originally Posted by Chivvon View Post
    It is. Well at least in elvarg 3.2 there is an issue that can cause this on certain interfaces. It is indeed possible after adding newer data. However, the issue I am referring to is present in elvarg 3.2 anyways.


    Anyhow, it is a variable packet so the size is correct. The packet wasn't correctly implemented. I can't remember precisly which one it was. Just go over the variable packets client sided and compare what is being sent from the server. You should see some differences.
    I am using Elvarg 3.2 the original one with the packet issues. I've never had this issue.
    If it was a packet issue it would throw a packet related error not a item decoding error.
    Reply With Quote  
     

  10. #9  
    Registered Member Fozzey's Avatar
    Join Date
    Jan 2014
    Posts
    33
    Thanks given
    8
    Thanks received
    1
    Rep Power
    11
    Quote Originally Posted by kippie View Post
    Ur item decoding method is off anyways. Did u renecently pack new data?

    Decoding:

    Code:
    public static void init(Archive archive) {
            data_buffer = new Buffer(archive.get("obj.dat"));
            Buffer index_buffer = new Buffer(archive.get("obj.idx"));
            length = index_buffer.readUShort();
    
            pos = new int[length];
    
            int offset = 2;
            for (int index = 0; index < length; index++) {
                pos[index] = offset;
                offset += index_buffer.readUShort();
            }
    
            cache = new ItemDefinition[10];
    
            for (int index = 0; index < 10; index++) {
                cache[index] = new ItemDefinition();
            }
        }
    
        private void decode(Buffer buffer) {
            while (true) {
                int opcode = buffer.readUnsignedByte();
                if (opcode == 0)
                    return;
                if (opcode == 1)
                    inventoryModel = buffer.readUShort();
                else if (opcode == 2)
                    name = buffer.readString();
                else if (opcode == 3)
                    description = buffer.readString();
                else if (opcode == 4)
                    zoom2d = buffer.readUShort();
                else if (opcode == 5)
                    xan2d = buffer.readUShort();
                else if (opcode == 6)
                    yan2d = buffer.readUShort();
                else if (opcode == 7) {
                    xOffset2d = buffer.readUShort();
                    if (xOffset2d > 32767)
                        xOffset2d -= 65536;
                } else if (opcode == 8) {
                    yOffset2d = buffer.readUShort();
                    if (yOffset2d > 32767)
                        yOffset2d -= 65536;
                } else if (opcode == 9) {
                    unknown1 = buffer.readString();
                } else if (opcode == 11)
                    stackable = 1;
                else if (opcode == 12)
                    cost = buffer.readInt();
                else if (opcode == 16)
                    members = true;
                else if (opcode == 23) {
                    maleModel = buffer.readUShort();
                    maleOffset = buffer.readSignedByte();
                } else if (opcode == 24)
                    maleModel1 = buffer.readUShort();
                else if (opcode == 25) {
                    femaleModel = buffer.readUShort();
                    femaleOffset = buffer.readSignedByte();
                } else if (opcode == 26)
                    femaleModel1 = buffer.readUShort();
                else if (opcode >= 30 && opcode < 35) {
                    if (groundActions == null)
                        groundActions = new String[5];
                    groundActions[opcode - 30] = buffer.readString();
                    if (groundActions[opcode - 30].equalsIgnoreCase("hidden"))
                        groundActions[opcode - 30] = null;
                } else if (opcode >= 35 && opcode < 40) {
                    if (inventoryActions == null)
                        inventoryActions = new String[5];
                    inventoryActions[opcode - 35] = buffer.readString();
                } else if (opcode == 40) {
                    int length = buffer.readUnsignedByte();
                    recolorFrom = new short[length];
                    recolorTo = new short[length];
                    for (int index = 0; index < length; index++) {
                        recolorTo[index] = (short) buffer.readUShort();
                        recolorFrom[index] = (short) buffer.readUShort();
                    }
                } else if (opcode == 41) {
                    int length = buffer.readUnsignedByte();
                    retextureFrom = new short[length];
                    retextureTo = new short[length];
                    for (int index = 0; index < length; index++) {
                        retextureFrom[index] = (short) buffer.readUShort();
                        retextureTo[index] = (short) buffer.readUShort();
                    }
                } else if (opcode == 42) {
                    shiftClickIndex = buffer.readUnsignedByte();
                } else if (opcode == 65) {
                    isTradable = true;
                } else if (opcode == 78)
                    maleModel2 = buffer.readUShort();
                else if (opcode == 79)
                    femaleModel2 = buffer.readUShort();
                else if (opcode == 90)
                    maleHeadModel = buffer.readUShort();
                else if (opcode == 91)
                    femaleHeadModel = buffer.readUShort();
                else if (opcode == 92)
                    maleHeadModel2 = buffer.readUShort();
                else if (opcode == 93)
                    femaleHeadModel2 = buffer.readUShort();
                else if (opcode == 94)
                    category = buffer.readUShort();
                else if (opcode == 95)
                    zan2d = buffer.readUShort();
                else if (opcode == 97)
                    note = buffer.readUShort();
                else if (opcode == 98)
                    notedTemplate = buffer.readUShort();
                else if (opcode >= 100 && opcode < 110) {
                    if (countobj == null) {
                        countobj = new int[10];
                        countco = new int[10];
                    }
                    countobj[opcode - 100] = buffer.readUShort();
                    countco[opcode - 100] = buffer.readUShort();
                } else if (opcode == 110)
                    resizeX = buffer.readUShort();
                else if (opcode == 111)
                    resizeY = buffer.readUShort();
                else if (opcode == 112)
                    resizeZ = buffer.readUShort();
                else if (opcode == 113)
                    ambient = buffer.readSignedByte();
                else if (opcode == 114)
                    contrast = buffer.readSignedByte();
                else if (opcode == 115)
                    team = buffer.readUnsignedByte();
                else if (opcode == 139)
                    bought_id = buffer.readUShort();
                else if (opcode == 140)
                    bought_template_id = buffer.readUShort();
                else if (opcode == 148)
                    placeholder = buffer.readUShort();
                else if (opcode == 149) {
                    placeholderTemplate = buffer.readUShort();
                } else if (opcode == 249) {
                    int length = buffer.readUnsignedByte();
    
                    params = new HashMap<>(length);
    
                    for (int i = 0; i < length; i++) {
                        boolean isString = buffer.readUnsignedByte() == 1;
                        int key = buffer.read24Int();
                        Object value;
    
                        if (isString) {
                            value = buffer.readString();
                        } else {
                            value = buffer.readInt();
                        }
    
                        params.put(key, value);
                    }
                } else {
                    System.err.printf("Error unrecognised {Items} opcode: %d%n%n", opcode);
                }
            }
        }
    Nop i have not packed any data onto this, i downloaded the fresh Elvarg V3.2 economy version off of the thread by oak, and i tested it, the smithing interface was broke still
    here is my IdentityKit.java, is this what i need to fix?

    EDIT: i just found a download link from oak saying he ripped out all the shitty client stuff, so ima check that out, may have downloaded the version with a heap of packet issues.

    Spoiler for code:
    Code:
    package com.runescape.entity.model;
    
    import com.runescape.cache.FileArchive;
    import com.runescape.io.Buffer;
    
    public final class IdentityKit {
    
        public static int length;
        public static IdentityKit kits[];
        private final int[] originalColors;
        private final int[] replacementColors;
        private final int[] headModels = {-1, -1, -1, -1, -1};
        public int bodyPartId;
        public boolean validStyle;
        private int[] bodyModels;
    
        private IdentityKit() {
            bodyPartId = -1;
            originalColors = new int[6];
            replacementColors = new int[6];
        }
    
        public static void init(FileArchive archive) {
            Buffer buffer = new Buffer(archive.readFile("idk.dat"));
    
            length = buffer.readUShort();
            if (kits == null) {
                kits = new IdentityKit[length];
            }
    
            for (int id = 0; id < length; id++) {
    
                if (kits[id] == null) {
                    kits[id] = new IdentityKit();
                }
    
                IdentityKit kit = kits[id];
    
                kit.decode(buffer);
                kit.originalColors[0] = 55232;
                kit.replacementColors[0] = 6798;
    
            }
    
        }
    
        private void decode(Buffer buffer) {        
            while(true) {
                final int opcode = buffer.readUnsignedByte();
    
                if (opcode == 0) {
                    break;
                }
    
                if (opcode == 1) {
                    bodyPartId = buffer.readUnsignedByte();
                } else if (opcode == 2) {
                    final int length = buffer.readUnsignedByte();
                    bodyModels = new int[length];
                    for (int i = 0; i < length; i++) {
                        bodyModels[i] = buffer.readUShort();
                    }
                } else if (opcode == 3) {
                    validStyle = true;
                } else if (opcode >= 40 && opcode < 50) {
                    originalColors[opcode - 40] = buffer.readUShort();
                } else if (opcode >= 50 && opcode < 60) {
                    replacementColors[opcode - 50] = buffer.readUShort();
                } else if (opcode >= 60 && opcode < 70) {
                    headModels[opcode - 60] = buffer.readUShort();
                } else {
                    System.out.println("Error unrecognised config code: " + opcode);
                }
            }
        }
    
        public boolean bodyLoaded() {
            if (bodyModels == null)
                return true;
            boolean ready = true;
            for (int part = 0; part < bodyModels.length; part++)
                if (!Model.isCached(bodyModels[part]))
                    ready = false;
    
            return ready;
        }
    
        public Model bodyModel() {
            if (bodyModels == null) {
                return null;
            }
    
            Model models[] = new Model[bodyModels.length];
            for (int part = 0; part < bodyModels.length; part++) {
                models[part] = Model.getModel(bodyModels[part]);
            }
    
            Model model;
            if (models.length == 1) {
                model = models[0];
            } else {
                model = new Model(models.length, models);
            }
            for (int part = 0; part < 6; part++) {
                if (originalColors[part] == 0) {
                    break;
                }
                model.recolor(originalColors[part], replacementColors[part]);
            }
            return model;
        }
    
        public boolean headLoaded() {
            boolean ready = true;
            for (int part = 0; part < 5; part++) {
                if (headModels[part] != -1 && !Model.isCached(headModels[part])) {
                    ready = false;
                }
            }
            return ready;
        }
    
        public Model headModel() {
            Model models[] = new Model[5];
            int count = 0;
            for (int part = 0; part < 5; part++) {
                if (headModels[part] != -1) {
                    models[count++] = Model.getModel(headModels[part]);
                }
            }
    
            Model model = new Model(count, models);
            for (int part = 0; part < 6; part++) {
                if (originalColors[part] == 0) {
                    break;
                }
                model.recolor(originalColors[part], replacementColors[part]);
            }
            return model;
        }
    }
    Reply With Quote  
     

  11. #10  
    Registered Member
    Join Date
    Jul 2021
    Posts
    95
    Thanks given
    21
    Thanks received
    19
    Rep Power
    44
    Quote Originally Posted by Fozzey View Post
    Nop i have not packed any data onto this, i downloaded the fresh Elvarg V3.2 economy version off of the thread by oak, and i tested it, the smithing interface was broke still
    here is my IdentityKit.java, is this what i need to fix?

    Spoiler for code:
    Code:
    package com.runescape.entity.model;
    
    import com.runescape.cache.FileArchive;
    import com.runescape.io.Buffer;
    
    public final class IdentityKit {
    
        public static int length;
        public static IdentityKit kits[];
        private final int[] originalColors;
        private final int[] replacementColors;
        private final int[] headModels = {-1, -1, -1, -1, -1};
        public int bodyPartId;
        public boolean validStyle;
        private int[] bodyModels;
    
        private IdentityKit() {
            bodyPartId = -1;
            originalColors = new int[6];
            replacementColors = new int[6];
        }
    
        public static void init(FileArchive archive) {
            Buffer buffer = new Buffer(archive.readFile("idk.dat"));
    
            length = buffer.readUShort();
            if (kits == null) {
                kits = new IdentityKit[length];
            }
    
            for (int id = 0; id < length; id++) {
    
                if (kits[id] == null) {
                    kits[id] = new IdentityKit();
                }
    
                IdentityKit kit = kits[id];
    
                kit.decode(buffer);
                kit.originalColors[0] = 55232;
                kit.replacementColors[0] = 6798;
    
            }
    
        }
    
        private void decode(Buffer buffer) {        
            while(true) {
                final int opcode = buffer.readUnsignedByte();
    
                if (opcode == 0) {
                    break;
                }
    
                if (opcode == 1) {
                    bodyPartId = buffer.readUnsignedByte();
                } else if (opcode == 2) {
                    final int length = buffer.readUnsignedByte();
                    bodyModels = new int[length];
                    for (int i = 0; i < length; i++) {
                        bodyModels[i] = buffer.readUShort();
                    }
                } else if (opcode == 3) {
                    validStyle = true;
                } else if (opcode >= 40 && opcode < 50) {
                    originalColors[opcode - 40] = buffer.readUShort();
                } else if (opcode >= 50 && opcode < 60) {
                    replacementColors[opcode - 50] = buffer.readUShort();
                } else if (opcode >= 60 && opcode < 70) {
                    headModels[opcode - 60] = buffer.readUShort();
                } else {
                    System.out.println("Error unrecognised config code: " + opcode);
                }
            }
        }
    
        public boolean bodyLoaded() {
            if (bodyModels == null)
                return true;
            boolean ready = true;
            for (int part = 0; part < bodyModels.length; part++)
                if (!Model.isCached(bodyModels[part]))
                    ready = false;
    
            return ready;
        }
    
        public Model bodyModel() {
            if (bodyModels == null) {
                return null;
            }
    
            Model models[] = new Model[bodyModels.length];
            for (int part = 0; part < bodyModels.length; part++) {
                models[part] = Model.getModel(bodyModels[part]);
            }
    
            Model model;
            if (models.length == 1) {
                model = models[0];
            } else {
                model = new Model(models.length, models);
            }
            for (int part = 0; part < 6; part++) {
                if (originalColors[part] == 0) {
                    break;
                }
                model.recolor(originalColors[part], replacementColors[part]);
            }
            return model;
        }
    
        public boolean headLoaded() {
            boolean ready = true;
            for (int part = 0; part < 5; part++) {
                if (headModels[part] != -1 && !Model.isCached(headModels[part])) {
                    ready = false;
                }
            }
            return ready;
        }
    
        public Model headModel() {
            Model models[] = new Model[5];
            int count = 0;
            for (int part = 0; part < 5; part++) {
                if (headModels[part] != -1) {
                    models[count++] = Model.getModel(headModels[part]);
                }
            }
    
            Model model = new Model(count, models);
            for (int part = 0; part < 6; part++) {
                if (originalColors[part] == 0) {
                    break;
                }
                model.recolor(originalColors[part], replacementColors[part]);
            }
            return model;
        }
    }
    IDK has nothing to do with items.
    Reply With Quote  
     

Page 1 of 2 12 LastLast

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. [SHARDS]Array out of bounds
    By Cody. in forum Help
    Replies: 5
    Last Post: 08-22-2009, 07:48 PM
  2. array out of bounds
    By pureiiipker in forum Help
    Replies: 1
    Last Post: 07-03-2009, 06:45 PM
  3. Some wierd out of bounds?
    By Dust R I P in forum Help
    Replies: 19
    Last Post: 06-03-2009, 04:35 PM
  4. Out of bounds
    By Hexagon in forum Help
    Replies: 0
    Last Post: 05-16-2009, 04:34 PM
  5. Map Data out of bounds wtf?
    By Delifed in forum Help
    Replies: 3
    Last Post: 05-04-2009, 12:26 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
  •