public void sendMapRegion() {
try {
if(!validateMapRegion()) {
player.getActionSender().sendMessage("This area of the world is unavailable, teleporting to spawn point...");
player.setLocation(Entity.DEFAULT_LOCATION);
}
StaticPacketBuilder spb = new StaticPacketBuilder().setId(76).setSize(Packet.Size.VariableShort);
boolean forceSend = true;
spb.addLEShortA(player.getLocation().getRegionX());
spb.addShort(player.getLocation().getLocalY());
spb.addByte((byte) 0);
spb.addByteA(0);
if ((((player.getLocation().getRegionX() / 8) == 48) || ((player.getLocation().getRegionX() / 8) == 49)) && ((player.getLocation().getRegionY() / 8) == 48)) {
forceSend = false;
}
if (((player.getLocation().getRegionX() / 8) == 48) && ((player.getLocation().getRegionY() / 8) == 148)) {
forceSend = false;
}
for (int xCalc = (player.getLocation().getRegionX() - 6) / 8; xCalc <= ((player.getLocation().getRegionX() + 6) / 8); xCalc++) {
for (int yCalc = (player.getLocation().getRegionY() - 6) / 8; yCalc <= ((player.getLocation().getRegionY() + 6) / 8); yCalc++) {
int region = yCalc + (xCalc << 8); // 1786653352
if (forceSend || ((yCalc != 49) && (yCalc != 149) && (yCalc != 147) && (xCalc != 50) && ((xCalc != 49) || (yCalc != 47)))) {
int[] mapData = World.getInstance().getMapData(region);
if(mapData == null) {
mapData = new int[4];
}
spb.addInt(mapData[0]);
spb.addInt(mapData[1]);
spb.addInt(mapData[2]);
spb.addInt(mapData[3]);
}
}
}
spb.addByteA(player.getLocation().getZ());
spb.addShort(player.getLocation().getLocalX());
spb.addShort(player.getLocation().getRegionY());
player.getSession().write(spb.toPacket());
player.getUpdateFlags().setLastRegion(player.getLocation());
World.getInstance().getItemManager().refresh(player);
World.getInstance().getObjectManager().refresh(player);
if (player.getLocation().getZ() == 0) {
player.getActionSender().sendCreateObject(409, 0, 3223, 3223, -2, 10);
player.getActionSender().sendCreateObject(17010, 0, 2141, 3943, -1, 10);
player.getActionSender().sendCreateObject(2560, 0, 3226, 3215, -1, 10);
player.getActionSender().sendCreateObject(2562, 0, 3226, 3225, -1, 10);
player.getActionSender().sendCreateObject(2213, 0, 3227, 3218, -1, 10);
player.getActionSender().sendCreateObject(409, 0, 2902, 4410, -2, 10);
GameEngine.TreeLive.treesCheck(player);
GameEngine.RockLive.rocksCheck(player);
GameEngine.StallLive.stallsCheck(player);
http://player.RouteFinder().loadMap();}
} catch(Exception e) {
}
}