Tutorials Latest Topicshttps://runelist.io/forums/forum/48-tutorials/Tutorials Latest TopicsenMap Function Fixes [143+]https://runelist.io/forums/topic/191-map-function-fixes-143/

Hey, so since 143 a lot of servers have been using Zions Tutorial for map icons, While this does work. Its not the correct way to do it and is a cheap way to do it also it only supports up to icon 83 so all the new map icons are not showing on the Minimap

The fix: 

The reason this is happening is because OSRS started to use Areas to store information like map icons, World map Information. I have dumped and encoded the icons with the sprite id that they should be loaded from in your cache

What your Adding:

Hd88iZ5.png
O32HxX3.png

Step 1:

Remove Zions Fix

Step 2:

Download these files and pack them into your cache

[Sprites] Map Functions
[Areas.dat and idx] into your configs

Step 3:

Next you will need to add this class
 

package com.runescape.cache.def;

import com.runescape.cache.FileArchive;
import com.runescape.io.Buffer;
import com.runescape.sign.SignLink;
import com.runescape.util.FileUtils;

public final class AreaDefinition {

    public static int totalAreas;
    public static AreaDefinition[] cache;
    private static int cacheIndex;
    private static Buffer area_data;
    private static int[] streamIndices;


    public int id;
    public int spriteId = -1;
    public int field3294 = -1;
    public String name = "";
    public int field3296 = -1;
    public int field3297 = -1;
    public String actions[];
    public int field3310 = -1;


    private AreaDefinition() {
        id = -1;
    }

    public static void clear() {
        streamIndices = null;
        cache = null;
        area_data = null;
    }

    public static void init(FileArchive archive) {
 
        area_data = new Buffer(archive.readFile("areas.dat"));
        Buffer stream = new Buffer(archive.readFile("areas.idx"));

        totalAreas = stream.readUShort();
        streamIndices = new int[totalAreas];
        int offset = 2;

        for (int _ctr = 0; _ctr < totalAreas; _ctr++) {
            streamIndices[_ctr] = offset;
            offset += stream.readUShort();
        }

        cache = new AreaDefinition[10];

        for (int _ctr = 0; _ctr < 10; _ctr++) {
            cache[_ctr] = new AreaDefinition();
        }

        System.out.println("Loaded: " + totalAreas + " Areas");

    }

    public static AreaDefinition lookup(int itemId) {

            for (int count = 0; count < 10; count++)
                if (cache[count].id == itemId)
                    return cache[count];

            cacheIndex = (cacheIndex + 1) % 10;
            AreaDefinition itemDef = cache[cacheIndex];
            if (itemId > 0)
                area_data.currentPosition = streamIndices[itemId];
            itemDef.id = itemId;
            itemDef.readValues(area_data);
            return itemDef;
    }

    public void readValues(Buffer buffer) {
        do {
            int opCode = buffer.readUnsignedByte();
            if (opCode == 0)
                return;
            if (opCode == 1)
                spriteId = buffer.readInt();
            else if (opCode == 2)
                field3294 = buffer.readInt();
            else if (opCode == 3)
                name = buffer.readNewString();
            else if (opCode == 4)
                field3296 = buffer.readInt();
            else if (opCode == 5)
                field3297 = buffer.readInt();
            else if (opCode == 6)
                field3296 = buffer.readInt();
            else if (opCode >= 6 && opCode < 11) {
                if (actions  == null)
                    actions = new String[5];
                   actions[opCode - 6] = buffer.readNewString();
            } else if (opCode == 12)
                field3310 = buffer.readInt();

        } while (true);
    }

}



Step 3:

Under where you load the Objects Configs add 

AreaDefinition.init(configArchive);

Step 4:

Find Something that looks like 

for (int x = 0; x < 104; x++) {                
            for (int y = 0; y < 104; y++) {                      
                int id = scene.getGroundDecorationUid(plane, x, y);
                if (id != 0) {
                    id = id >> 14 & 0x7fff;

            int function = ObjectDefinition.lookup(id).minimapFunction;

            if (function >= 0) {
                int viewportX = x;                                    
                int viewportY = y;                                    
                minimapHint[anInt1071] = mapFunctions[function];
                minimapHintX[anInt1071] = viewportX;
                minimapHintY[anInt1071] = viewportY;
                anInt1071++;
            }
                }
            }

        }


and replace it with this

for (int x = 0; x < 104; x++) {                
            for (int y = 0; y < 104; y++) {                      
                int id = scene.getGroundDecorationUid(plane, x, y);
                if (id != 0) {
                    id = id >> 14 & 0x7fff;

            int function = ObjectDefinition.lookup(id).minimapFunction;

            if (function >= 0) {
                int sprite = AreaDefinition.lookup(j3).spriteId;
                if(sprite != -1) {
                    int viewportX = x;                                    
                    int viewportY = y;                                    
                    minimapHint[anInt1071] = mapFunctions[sprite];
                    minimapHintX[anInt1071] = viewportX;
                    minimapHintY[anInt1071] = viewportY;
                    anInt1071++;
                }
            }
                }
            }

        }


 

Step 5:

Search for 

mapFunctions[l3] = new Sprite

 

and edit the loop to load 118 Icons

if (mapFunctions[i6] != null)

 

in startup and edit the loop to load 118 Icons

mapFunctions = new Sprite

 

and edit the array to 118 Icons

Step 6:

Load up and make sure its working :)

if you need any help comment on the thread or dm me on discord, You may also need 32k object clicking to load some of the very new Icons up.

I will also look into what the other fields do tomorrow and update the thread

]]>
191Mon, 10 May 2021 01:04:17 +0000
Tutorials Section Ruleshttps://runelist.io/forums/topic/15-tutorials-section-rules/ 3Qommdf.png
This section is specifically dedicated towards tutorials of RS2 Runescape Private Servers to the community of RuneList. Down below you will find rules on what a topic must contain, and what you are not allowed to do as a member of the community. Please read them from top to bottom to avoid potential punishments. 

In order to create a topic in the tutorials section, please ensure that your topic does not contain the following;

  • Little Code: Do not create tutorials that contain little code
    • This can be done in the snippets section
  • Uncredited/Stolen Work: Do not create tutorials that contain uncredited or stolen code
  • Implementation: Do not create tutorials that have no information about the implementation of said tutorial

In addition, the tutorial must include code that you as an author understand and can stand for. Do not submit tutorials that can not be used by others. Make sure you follow through with the tutorials that are submitted.

If a thread does not fit the section or if it contains any of the aforementioned points, it will be locked and/or moved to the correct section of the community. Community Rules apply to all sections. Please read them here.

]]>
15Sat, 10 Oct 2020 18:26:26 +0000