
Credits :
Light232(godsent) fixing my login.
Me, Creator of framework (was orignaly made for a 523 light was doing but i wanted 508 login)
Pali, basicly, if it wasnt for him, 508's wouldnt be here lawl and (TX)
Still Dont Belive?
Code:
package net.sirpkp00n.server508.model.world;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.HashMap;
import net.sirpkp00n.server508.util.SystemLogger;
public class MapRegion {
private static int mapId;
private static HashMap<Integer, MapList> mapRegions;
static {
setMapId(0);
setMapRegions(new HashMap<Integer, MapList>());
loadRegions();
}
public static int[] getMapData(int region) {
return mapRegions.get(region).getMapRegions();
}
private static int getMapId() {
return mapId;
}
private static HashMap<Integer, MapList> getMapRegions() {
return mapRegions;
}
private static void loadRegions() {
try {
DataInputStream in = new DataInputStream(new FileInputStream(
"./data/mapdata/1.dat"));
do {
int i = in.readInt();
if (i == 0) {
break;
} else if (i != 0) {
setMapId(in.readInt());
}
setRegions(getMapId(), new int[] { in.readInt(), in.readInt(),
in.readInt(), in.readInt() });
} while (true);
SystemLogger.log("Total Map Data Regions Loaded "
+ mapRegions.size());
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
private static void setMapId(int mapId) {
MapRegion.mapId = mapId;
}
private static void setMapRegions(HashMap<Integer, MapList> mapRegions) {
MapRegion.mapRegions = mapRegions;
}
private static void setRegions(int id, int region[]) {
MapList map = new MapList(id, region);
getMapRegions().put(id, map);
}
}
Code:
package net.sirpkp00n.server508.model.world;
public class MapList {
private int mapId;
private int[] mapRegions;
public MapList(int id, int[] map) {
this.mapId = id;
this.mapRegions = map;
}
public int getMapId() {
return mapId;
}
public int[] getMapRegions() {
return mapRegions;
}
}
Still Got To Do:
Player Updating Masks
Event System
Packet Handler
Remove XSocket and use Mina or Raw Nio
Reason I Use RS2D'S EntityList :
The main reason i use is bevause it keeps its index's unlike an ArrayList which will cause huge amount of problems with the server