Jump to content
Existing user? Sign In

Sign In



Sign Up

Help editing maps [Coords]


omg fd up

Recommended Posts

I have made my own map area already however, I’m trying to edit my home 

the sever Im running when i type in the coords to just say where home is (2986,3440) just an example

map editor doesn’t load the coords there a reason behind this? It’ll load other places though. 
 

any help would be greatly appreciated 

 

if anyone knows how to:  i have the old Dreamscape cache. Is there anyway to get the map coords from the map files inside the cache? 
for instance say i want map 413 how do i determine the coordinates of that map file? 

Link to comment
Share on other sites

I haven't used RSPSi much but here is what I use to generate coords from a RegionId

package com.rs.jagex.tools;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;
/**
 * 
 * @author Tyler
 *
 */
public class CoordinateGenerator {
	public static void main(String[] args) throws IOException {
		Scanner input = new Scanner(System.in);
		BufferedWriter writer = null;
		File file = new File("Coords.txt");
		writer = new BufferedWriter(new FileWriter(file));
		System.out.println("Please enter the region id.");
		while(input.hasNextLine()) {
			if(!input.hasNextInt()) {
				break;
			}
			int regionId = input.nextInt();
			int x = (regionId >> 8) << 6;
			int y = (regionId & 0xFF) << 6;
			System.out.println("Coords : "+x+ ": "+y+ " Region ID: "+regionId);
			writer.append("Coords : "+x+ ": "+y+ " Region ID: "+regionId);
			writer.newLine();
			writer.flush();
		}
		writer.close();
	}
}

 

Link to comment
Share on other sites

1 hour ago, Dbcrazy said:

I haven't used RSPSi much but here is what I use to generate coords from a RegionId

package com.rs.jagex.tools;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;
/**
 * 
 * @author Tyler
 *
 */
public class CoordinateGenerator {
	public static void main(String[] args) throws IOException {
		Scanner input = new Scanner(System.in);
		BufferedWriter writer = null;
		File file = new File("Coords.txt");
		writer = new BufferedWriter(new FileWriter(file));
		System.out.println("Please enter the region id.");
		while(input.hasNextLine()) {
			if(!input.hasNextInt()) {
				break;
			}
			int regionId = input.nextInt();
			int x = (regionId >> 8) << 6;
			int y = (regionId & 0xFF) << 6;
			System.out.println("Coords : "+x+ ": "+y+ " Region ID: "+regionId);
			writer.append("Coords : "+x+ ": "+y+ " Region ID: "+regionId);
			writer.newLine();
			writer.flush();
		}
		writer.close();
	}
}

 

I’ll give it a try. Thank you. 

Link to comment
Share on other sites

25 minutes ago, omg fd up said:

I’ll give it a try. Thank you. 

 

1 hour ago, Dbcrazy said:

I haven't used RSPSi much but here is what I use to generate coords from a RegionId

package com.rs.jagex.tools;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;
/**
 * 
 * @author Tyler
 *
 */
public class CoordinateGenerator {
	public static void main(String[] args) throws IOException {
		Scanner input = new Scanner(System.in);
		BufferedWriter writer = null;
		File file = new File("Coords.txt");
		writer = new BufferedWriter(new FileWriter(file));
		System.out.println("Please enter the region id.");
		while(input.hasNextLine()) {
			if(!input.hasNextInt()) {
				break;
			}
			int regionId = input.nextInt();
			int x = (regionId >> 8) << 6;
			int y = (regionId & 0xFF) << 6;
			System.out.println("Coords : "+x+ ": "+y+ " Region ID: "+regionId);
			writer.append("Coords : "+x+ ": "+y+ " Region ID: "+regionId);
			writer.newLine();
			writer.flush();
		}
		writer.close();
	}
}

 

Any recommendations on coords for maps within another cache? Like there are some old servers i have caches too but don’t know the region or coords. The code above won’t tell me the coords or region them. 
 

For instance i want to take map 1203 from dreamscape cache. I can pack the map however i don’t know the coords to it nor the region. Is there away for me to get this? 

Link to comment
Share on other sites

4 hours ago, omg fd up said:

 

Any recommendations on coords for maps within another cache? Like there are some old servers i have caches too but don’t know the region or coords. The code above won’t tell me the coords or region them. 
 

For instance i want to take map 1203 from dreamscape cache. I can pack the map however i don’t know the coords to it nor the region. Is there away for me to get this? 

The code will tell you the coords. All you do is run the class in an IDE and it will ask you to input the region id and it will spit out the coords for that region. If you packed the map then the mapfile should be named as the region ID, or the folder the map files were in. Again im not sure about lower revision as I normally work with 667+ so it could be a little different. Could also try this

public final class MapDefinitionParser {

	private MapDefinitionParser() {

	}

	public static Map<Integer, MapDefinition> parse(Cache cache) throws IOException {
		
		final Map<Integer, MapDefinition> definitions = new HashMap<>();
		
		byte[] data = cache.getArchive(ArchiveType.VERSION_LIST).readFile("map_index");
		
	    Buffer buffer = Buffer.wrap(data);

	    int mapCount = buffer.getCapacity() / (3 * Short.BYTES + Byte.BYTES);

	    for (int map = 0; map < mapCount; map++) {

	      int regionId = buffer.readUShort();
	      int terrainFileId = buffer.readUShort();
	      int objectFileId = buffer.readUShort();
	      boolean members = buffer.readByte() == 1;

	      definitions.put(regionId, new MapDefinition(regionId, terrainFileId, objectFileId, members));
	    }
	    
	    decodeStaticObjects(cache, definitions);
	    
	    return definitions;
	    
	}

	private static void decodeStaticObjects(Cache cache, Map<Integer, MapDefinition> definitions) throws IOException {

		Store mapStore = cache.getStore(StoreType.MAP);
		
		for (Entry<Integer, MapDefinition> entry : definitions.entrySet()) {

			MapDefinition def = entry.getValue();

			int hash = def.getRegionId();

			int x = (hash >> 8 & 0xFF) * 64;
			int y = (hash & 0xFF) * 64;

			ByteBuffer gameObjectData = ByteBuffer.wrap(mapStore.readFile(def.getObjectFileId()));
			parseGameObject(gameObjectData, x, y);

			Buffer terrainData = Buffer.wrap(mapStore.readFile(def.getTerrainFileId()));
			parseTerrain(terrainData, x, y);

		}

	}

	private static void parseGameObject(ByteBuffer gameObjectBuffer, int x, int y) {
		for (int deltaId, id = -1; (deltaId = BufferUtils.readSmart(gameObjectBuffer)) != 0;) {
			id += deltaId;

			for (int deltaPos, hash = 0; (deltaPos = BufferUtils.readSmart(gameObjectBuffer)) != 0;) {
				hash += deltaPos - 1;

				int localX = hash >> 6 & 0x3F;
				int localY = hash & 0x3F;
				int height = hash >> 12 & 0x3;

				int attributeHashCode = gameObjectBuffer.get() & 0xFF;
				Optional<GameObjectType> type = GameObjectType.valueOf(attributeHashCode >> 2);
				Optional<GameObjectOrientation> orientation = GameObjectOrientation.valueOf(attributeHashCode & 0x3);
				Position position = new Position(x + localX, y + localY, height);

				if (type.isPresent() && orientation.isPresent()) {
					World.gameObjects.add(new GameObject(id, position, type.get().getId(), orientation.get().getId()));
				}
			}
		}
	}

	private static void parseTerrain(Buffer mapBuffer, int x, int y) {
		for (int height = 0; height < 4; height++) {
			for (int localX = 0; localX < 64; localX++) {
				for (int localY = 0; localY < 64; localY++) {
					Position position = new Position(x + localX, y + localY, height);

					int flags = 0;
					for (;;) {
						int attributeId = mapBuffer.readUByte();

						if (attributeId == 0) {
							terrainDecoded(flags, position);
							break;
						} else if (attributeId == 1) {
							mapBuffer.readByte();
							terrainDecoded(flags, position);
							break;
						} else if (attributeId <= 49) {
							mapBuffer.readByte();
						} else if (attributeId <= 81) {
							flags = attributeId - 49;
						}
					}

				}
			}
		}
	}

 

all you have to do is grab map_index, and then use that file to parse maps located in index 4 of the cache.
 

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Contact

[email protected]

astra.security

What is a RSPS?

A RSPS, also known as RuneScape private server, is an online game based on RuneScape, and controlled by independent individuals.

Popular RSPS Servers

Runewild Ikov RedemptionRSPS

Disclaimer

Runesuite is not affiliated with runescape, jagex in any way & exists solely for educational purposes.

×
×
  • Create New...