Thread: [PI] REAL Construction - USING CONSTRUCT MAP REGION PACKET

Page 1 of 12 12311 ... LastLast
Results 1 to 10 of 111
  1. #1 [PI] REAL Construction - USING CONSTRUCT MAP REGION PACKET 
    plz dont take my wizard mind bombs Women's Avatar
    Join Date
    Mar 2010
    Posts
    1,881
    Thanks given
    724
    Thanks received
    1,162
    Rep Power
    4763
    Basically I've left you with a very bare framework. To finish this you need to add a lot of stuff yourself.

    Add a command like this

    Code:
    if(playerCommand.equalsIgnoreCase("poh")) {
    			final Client p = c;
    			p.getPA().movePlayer(48, 48, p.playerId * 4);
    			CycleEventHandler.getSingleton().addEvent(p, new CycleEvent() {
    
    				@Override
    				public void execute(CycleEventContainer container) {
    					stop();
    					container.stop();
    				}
    
    				@Override
    				public void stop() {
    					House.showHouse(p, p);
    				}
    				
    			}, 1);
    		}

    Now for the main class House, add this in server.model.content

    Code:
    package server.model.content;
    
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.ObjectInputStream;
    import java.io.ObjectOutputStream;
    import java.io.Serializable;
    import java.util.LinkedList;
    
    import server.model.objects.Object;
    import server.model.players.Client;
    
    public class House implements Serializable {
    
    	private static final long serialVersionUID = 1L;
    	
    	private static final String houseLocation = "./Data/houses/";
    	
    	public static boolean hasHouse(Client player) {
    		File file = new File(houseLocation);
    		return file.exists();
    	}
    	
    	public static void showHouse(Client host, Client visiter) {
    		visiter.outStream.createFrameVarSizeWord(241);
    		visiter.outStream.writeWordA(visiter.mapRegionY + 6);
    		visiter.outStream.initBitAccess();
    		for(int z = 0; z < 4; z++) {
    			for(int x = 0; x < 13; x++) {
    				for(int y = 0; y < 13; y++) {
    					Room room = host.getHouse().rooms[x][y][z];
    					visiter.getOutStream().writeBits(1, room != null ? 1 : 0);
    					if(room != null) {
    						visiter.getOutStream().writeBits(26, room.locationHash);
    					}
    				}
    			}
    		}
    		visiter.getOutStream().finishBitAccess();
    		visiter.getOutStream().writeWord(visiter.mapRegionX + 6);
    		visiter.getOutStream().endFrameVarSizeWord();
    		visiter.flushOutStream();
    		visiter.inHouse = true;
    		loadObjects(host);
    	}
    	
    	public static void loadObjects(Client c) {
    		for(RoomObject object : c.getHouse().objects) {
    			/*visiter.getOutStream().createFrame(85);
    			visiter.getOutStream().writeByteC(object.y - visiter.getMapRegionY() * 8);
    			visiter.getOutStream().writeByteC(object.x - visiter.getMapRegionX() * 8);
    			visiter.getOutStream().createFrame(101);
    			visiter.getOutStream().writeByteC(object.rot);
    			visiter.getOutStream().writeByte(0);
    			visiter.getOutStream().createFrame(151);
    			visiter.getOutStream().writeByteS(0);
    			visiter.getOutStream().writeWordBigEndian(object.id);
    			visiter.getOutStream().writeByteS(object.rot);
    			visiter.flushOutStream();*/
    			new Object(object.id, object.y, object.x, c.playerId*4, c.objRot, getObjType(object.id), object.id, 0);
    			System.out.println(c.objRot);
    		}
    	}
    	
    	public House getHouse(Client player) {
    		House d = null;
    		try {
    			ObjectInputStream in = new ObjectInputStream(new FileInputStream(houseLocation + player.playerName + ".house"));
    			d = (House) in.readObject();
    			in.close();
    			System.out.println("umm:" +d.objects.size());
    		} catch (Exception e) {
    		//	e.printStackTrace();
    			return new House(player, false);
    		}
    		return d;
    		
    	}
    	
    	public House(Client player, boolean hasHouse) {
    		House h = getHouse(player);
    		for(int x = 0; x < 11; x++) {
    			for(int y = 0; y < 11; y++) {
    				rooms[x][y][0] = h.rooms[x][y][0];
    				if(x == 0 || y == 0 || x == 1 || y == 1 || x == 11 || y == 11 || x == 10 || y == 10) {
    					rooms[x][y][0] = null;
    				}
    			}
    		}
    		rooms[6][6][0] = GARDEN;
    	}
    	
    	public static boolean save(Client player) {
    		player.sendMessage("Saving house.");
    		try {
    			ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(houseLocation + player.playerName + ".house"));
    			out.writeObject(player.getHouse());
    			out.close();
    			return true;
    		} catch (Exception e) {
    			e.printStackTrace();
    			return false;
    		}
    	}
    	
        private Room[][][] rooms = new Room[13][13][4];
           
        public static class Room implements Serializable {
    
    		private static final long serialVersionUID = 1L;
    		
    		private int locationHash;
    		private Room(int x, int y, int z, int rot) {
    			this.locationHash = x / 8 << 14 | y / 8 << 3 | z % 4 << 24 | rot % 4 << 1;
    		}
    	}
    	
    	private LinkedList<RoomObject> objects = new LinkedList<RoomObject>();
    	private static class RoomObject implements Serializable {
    
    		private static final long serialVersionUID = 1L;
    		private int x;
    		private int y;
    		private int z;
    		private int id;
    		private int rot;
    		private RoomObject(int id, int x, int y, int z, int type, int face) {
    			this.rot = type << 2 | face & 3;
    			this.x = x;
    			this.y = y;
    			this.z = z;
    			this.id = id;
    		}
    	}
    	
    	public static final Room DEFAULT = new Room(1864, 5056, 0, 0);
        public static final Room GARDEN = new Room(1859, 5066, 0, 0);
        public static final Room THRONE = new Room(1904, 5096, 0, 0);
        public static final Room GAME = new Room(1864, 5104, 0, 0);
        public static final Room FLOOR2 = new Room(1903, 5095, 0, 0);
    	public static final Room PARLOUR = new Room(1856, 5112, 0, 0);
    	public static final Room KITCHEN = new Room(1872, 5112, 0, 0);
    	public static final Room DINING = new Room(1890, 5112, 0, 0);
    	public static final Room WORKSHOP = new Room(1856, 5096, 0, 0);
    	public static final Room BEDROOM = new Room(1904, 5112, 0, 0);
    	public static final Room SKILLHALL = new Room(1880, 5104, 0, 0);
    	public static final Room COMBAT = new Room(1880, 5088, 0, 0);
    	public static final Room QUEST_HALL = new Room(1912, 5104, 0, 0);
    	public static final Room STUDY = new Room(1888, 5096, 0, 0);
    	public static final Room COSTUME_ROOM = new Room(1904, 5064, 0, 0);
    	public static final Room CHAPEL = new Room(1872, 5096, 0, 0);
    	public static final Room PORTAL_CHAMBER = new Room(1864, 5088, 0, 0);
    	public static final Room FORMAL_GARDEN = new Room(1872, 5064, 0, 0);
    	public static final Room THRONE_ROOM = new Room(1904, 5080, 0, 0);
    	public static final Room OUBILIETTE = new Room(1904, 5080, 0, 0);
    	public static final Room CORRIDOR_DUNGEON = new Room(1888, 5080, 0, 0);
    	public static final Room JUNCTION_DUNGEON = new Room(1856, 5080, 0, 0);
    	public static final Room STAIRS_DUNGEON = new Room(1872, 5080, 0, 0);
    	public static final Room TREASURE_ROOM = new Room(1912, 5088, 0, 0);
        
    	public static int[][] objectData = { 
    		//Build obj id, Real obj id, obj type
    		{15361, 13405, 10}
    	};
    	
    	public static int getObjType(int id) {
    		for(int i = 0; i < objectData.length; i++) {
    			if(objectData[i][0] == id) {
    				return objectData[i][2];
    			}
    		}
    		return 10;
    	}
    	
    	public static int getObjId(int id) {
    		for(int i = 0; i < objectData.length; i++) {
    			if(objectData[i][0] == id) {
    				return objectData[i][1];
    			}
    		}
    		return -1;
    	}
    	
    	public static void handleConstructionClick(Client player, int id, int x, int y) {
    		int locX = player.absX % 8;
    		int locY = player.absY % 8;
    		switch(id) {
    		case 15364:
    		case 15361:
    			createObject(player, getObjId(id), x, y, getObjType(id), player.objRot);
    			break;
    		case 15314:
    		case 15313:
    			if(locX == 3 && locY == 0 || locX == 4 && locY == 0) {
    				addRoom(player, id, x, y, getRoomToBuild(player), player.absX / 8, (player.absY - 1) / 8);
    			}	
    			if(locX == 0 && locY == 3 || locX == 0 && locY == 4) {
    				addRoom(player, id, x, y, getRoomToBuild(player), (player.absX - 1) / 8, player.absY / 8);
    			}	
    			if(locX == 3 && locY == 7 || locX == 4 && locY == 7) {
    				addRoom(player, id, x, y, getRoomToBuild(player), player.absX / 8, (player.absY + 1) / 8);
    			}
    			if(locX == 7 && locY == 3 || locX == 7 && locY == 4) {
    				addRoom(player, id, x, y, getRoomToBuild(player), (player.absX + 1) / 8, player.absY / 8);
    			}	
    			break;
    		}
    		player.getDH().sendDialogues(62, 0);
    	}
    	
    	public static boolean handleButtons(Client c, int actionButtonId) {
    		switch(actionButtonId) {
    		case 9168:
    			if(c.objRot > 3) {
    				c.objRot++;
    			}
    			createObject(c, getObjId(c.objId), c.objectX, c.objectY, getObjType(c.objId), c.objRot);
    			loadObjects(c);
    			break;
    		}
    		return false;
    	}
    	
    	public static void createObject(Client player, int id, int x, int y, int type, int face) {
    		if(player != null) {
    			RoomObject object = new RoomObject(id, x, y, player.heightLevel, type, face);
    			player.objectId = id;
    			player.objRot = face;
    			new Object(object.id, object.y, object.x, player.playerId*4, player.objRot, getObjType(object.id), object.id, 0);
    			/*object.id = id;
    			object.x = player.objectX;
    			object.y = player.objectY;
    			player.getOutStream().createFrame(85);
    			player.getOutStream().writeByteC(object.y - player.getMapRegionY() * 8);
    			player.getOutStream().writeByteC(object.x - player.getMapRegionX() * 8);
    			player.getOutStream().createFrame(101);
    			player.getOutStream().writeByteC(object.rot);
    			player.getOutStream().writeByte(0);
    			player.getOutStream().createFrame(151);
    			player.getOutStream().writeByteS(0);
    			player.getOutStream().writeWordBigEndian(object.id);
    			player.getOutStream().writeByteS(object.rot);
    			player.flushOutStream();*/
    			player.getHouse().objects.add(object);
    			loadObjects(player);
    		}	
    	}
    	
    	public static Room getRoomToBuild(Client c) {
    		return GAME;
    	}
    	
    	public static void addRoom(Client player, int id, int x, int y, Room room, int slotX, int slotY) {
    		player.getHouse().rooms[slotX][slotY][0] = room;
    		showHouse(player, player);
    	}
    }

    And the palette class created by Graham

    Code:
    package server.model.players;
     
    public class Palette {
           
            public static final int DIRECTION_NORMAL = 0;
            public static final int DIRECTION_CW_0 = 0;
            public static final int DIRECTION_CW_90 = 1;
            public static final int DIRECTION_CW_180 = 2;
            public static final int DIRECTION_CW_270 = 3;
           
            public static class PaletteTile {
                   
                    private int x;
                    private int y;
                    private int z;
                    private int rot;
                   
                    public PaletteTile(int x, int y) {
                            this(x, y, 0);
                    }
                   
                    public PaletteTile(int x, int y, int z) {
                            this(x, y, z, DIRECTION_NORMAL);
                    }
                   
                    public PaletteTile(int x, int y, int z, int rot) {
                            this.x = x;
                            this.y = y;
                            this.z = z;
                            this.rot = rot;
                    }
                   
                    public int getX() {
                            return x / 8;
                    }
                   
                    public int getY() {
                            return y / 8;
                    }
                   
                    public int getZ() {
                            return z % 4;
                    }
                   
                    public int getRotation() {
                            return rot % 4;
                    }
                   
            }
           
            private PaletteTile[][][] tiles = new PaletteTile[13][13][4];
    
    		public PaletteTile getTile(int x, int y, int z) {
                    return tiles[x][y][z];
            }
           
            public void setTile(int x, int y, int z, PaletteTile tile) {
                    tiles[x][y][z] = tile;
            }
     
    }
    Your final result:




    cause ik a lot of ppl will leech this, there is a problem with the client that you have to fix for the packet to work. i released it before but i took it down.

    also put a 'houses' folder in your data folder

    fix:

    Quote Originally Posted by Roboyto View Post
    Code:
      public static boolean hasHouse(Client player) {
        return new File(houseLocation + player.playerName + ".house").exists();
      }
    Last edited by Women; 10-14-2020 at 06:37 PM.
    Reply With Quote  
     


  2. #2  
    Donator

    Join Date
    Feb 2013
    Posts
    1,670
    Thanks given
    477
    Thanks received
    244
    Rep Power
    29
    Thank you very much.
    Reply With Quote  
     

  3. #3  
    plz dont take my wizard mind bombs Women's Avatar
    Join Date
    Mar 2010
    Posts
    1,881
    Thanks given
    724
    Thanks received
    1,162
    Rep Power
    4763
    Quote Originally Posted by Logic View Post
    Looks good Nick, will definitely look into this. I'm pretty sure it's 'visitor', though.
    lol fugg that sht
    --------------------------
    I forgot to mention you can make more shit then construction, like stealing creation.





    As you can see, the random skilling objects(fishing pool, mining rock and shit) are randomly placed, which you cannot do without using the packet.
    Reply With Quote  
     

  4. #4  
    Registered Member Bowtie's Avatar
    Join Date
    Apr 2012
    Age
    4
    Posts
    284
    Thanks given
    145
    Thanks received
    44
    Rep Power
    25
    Very nice job bringing RSPS from the dead.
    "Resolve never to quit, never to give up, no matter what the situation." - Jack Nicklaus

    Reply With Quote  
     

  5. #5  
    Project Drop-Zone Owner & The BLOOD Gang Always Banging RED


    Join Date
    May 2013
    Age
    28
    Posts
    2,992
    Thanks given
    5
    Thanks received
    937
    Rep Power
    183
    Good job on this. Hopefully someone goes far using this as a base
    Reply With Quote  
     

  6. #6  
    Respected Member


    George's Avatar
    Join Date
    Mar 2009
    Posts
    7,099
    Thanks given
    2,226
    Thanks received
    3,146
    Rep Power
    5000
    still lolling about the fact that PkHonor's construction was written with 12k of lines, gj women.
    Attached image

    Spoiler for Spoilers!:
    Attached image
    Attached image
    Attached image
    Attached image
    Reply With Quote  
     

  7. Thankful user:


  8. #7  
    Registered Member

    Join Date
    Oct 2011
    Age
    28
    Posts
    1,880
    Thanks given
    311
    Thanks received
    557
    Rep Power
    703
    Spoiler for j:
    Quote Originally Posted by Women View Post
    If you clicked this thread expecting full construction then..

    HAHAHAHAHAHHAAHHA. good 1 m8. This is simply a base to work from. One of the main problems with nobody ever being able to work on construction was tons of people didn't even know how to work the packet.

    Basically I've left you with a very bare framework. To finish this you need to add a lot of stuff yourself.

    Add a command like this

    Code:
    if(playerCommand.equalsIgnoreCase("poh")) {
    			final Client p = c;
    			p.getPA().movePlayer(48, 48, p.playerId * 4);
    			CycleEventHandler.getSingleton().addEvent(p, new CycleEvent() {
    
    				@Override
    				public void execute(CycleEventContainer container) {
    					stop();
    					container.stop();
    				}
    
    				@Override
    				public void stop() {
    					House.showHouse(p, p);
    				}
    				
    			}, 1);
    		}

    Now for the main class House, add this in server.model.content

    Code:
    package server.model.content;
    
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.ObjectInputStream;
    import java.io.ObjectOutputStream;
    import java.io.Serializable;
    import java.util.LinkedList;
    
    import server.model.objects.Object;
    import server.model.players.Client;
    
    public class House implements Serializable {
    
    	private static final long serialVersionUID = 1L;
    	
    	private static final String houseLocation = "./Data/houses/";
    	
    	public static boolean hasHouse(Client player) {
    		File file = new File(houseLocation);
    		return file.exists();
    	}
    	
    	public static void showHouse(Client host, Client visiter) {
    		visiter.outStream.createFrameVarSizeWord(241);
    		visiter.outStream.writeWordA(visiter.mapRegionY + 6);
    		visiter.outStream.initBitAccess();
    		for(int z = 0; z < 4; z++) {
    			for(int x = 0; x < 13; x++) {
    				for(int y = 0; y < 13; y++) {
    					Room room = host.getHouse().rooms[x][y][z];
    					visiter.getOutStream().writeBits(1, room != null ? 1 : 0);
    					if(room != null) {
    						visiter.getOutStream().writeBits(26, room.locationHash);
    					}
    				}
    			}
    		}
    		visiter.getOutStream().finishBitAccess();
    		visiter.getOutStream().writeWord(visiter.mapRegionX + 6);
    		visiter.getOutStream().endFrameVarSizeWord();
    		visiter.flushOutStream();
    		visiter.inHouse = true;
    		loadObjects(host);
    	}
    	
    	public static void loadObjects(Client c) {
    		for(RoomObject object : c.getHouse().objects) {
    			/*visiter.getOutStream().createFrame(85);
    			visiter.getOutStream().writeByteC(object.y - visiter.getMapRegionY() * 8);
    			visiter.getOutStream().writeByteC(object.x - visiter.getMapRegionX() * 8);
    			visiter.getOutStream().createFrame(101);
    			visiter.getOutStream().writeByteC(object.rot);
    			visiter.getOutStream().writeByte(0);
    			visiter.getOutStream().createFrame(151);
    			visiter.getOutStream().writeByteS(0);
    			visiter.getOutStream().writeWordBigEndian(object.id);
    			visiter.getOutStream().writeByteS(object.rot);
    			visiter.flushOutStream();*/
    			new Object(object.id, object.y, object.x, c.playerId*4, c.objRot, getObjType(object.id), object.id, 0);
    			System.out.println(c.objRot);
    		}
    	}
    	
    	public House getHouse(Client player) {
    		House d = null;
    		try {
    			ObjectInputStream in = new ObjectInputStream(new FileInputStream(houseLocation + player.playerName + ".house"));
    			d = (House) in.readObject();
    			in.close();
    			System.out.println("umm:" +d.objects.size());
    		} catch (Exception e) {
    		//	e.printStackTrace();
    			return new House(player, false);
    		}
    		return d;
    		
    	}
    	
    	public House(Client player, boolean hasHouse) {
    		House h = getHouse(player);
    		for(int x = 0; x < 11; x++) {
    			for(int y = 0; y < 11; y++) {
    				rooms[x][y][0] = h.rooms[x][y][0];
    				if(x == 0 || y == 0 || x == 1 || y == 1 || x == 11 || y == 11 || x == 10 || y == 10) {
    					rooms[x][y][0] = null;
    				}
    			}
    		}
    		rooms[6][6][0] = GARDEN;
    	}
    	
    	public static boolean save(Client player) {
    		player.sendMessage("Saving house.");
    		try {
    			ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(houseLocation + player.playerName + ".house"));
    			out.writeObject(player.getHouse());
    			out.close();
    			return true;
    		} catch (Exception e) {
    			e.printStackTrace();
    			return false;
    		}
    	}
    	
        private Room[][][] rooms = new Room[13][13][4];
           
        public static class Room implements Serializable {
    
    		private static final long serialVersionUID = 1L;
    		
    		private int locationHash;
    		private Room(int x, int y, int z, int rot) {
    			this.locationHash = x / 8 << 14 | y / 8 << 3 | z % 4 << 24 | rot % 4 << 1;
    		}
    	}
    	
    	private LinkedList<RoomObject> objects = new LinkedList<RoomObject>();
    	private static class RoomObject implements Serializable {
    
    		private static final long serialVersionUID = 1L;
    		private int x;
    		private int y;
    		private int z;
    		private int id;
    		private int rot;
    		private RoomObject(int id, int x, int y, int z, int type, int face) {
    			this.rot = type << 2 | face & 3;
    			this.x = x;
    			this.y = y;
    			this.z = z;
    			this.id = id;
    		}
    	}
    	
    	public static final Room DEFAULT = new Room(1864, 5056, 0, 0);
        public static final Room GARDEN = new Room(1859, 5066, 0, 0);
        public static final Room THRONE = new Room(1904, 5096, 0, 0);
        public static final Room GAME = new Room(1864, 5104, 0, 0);
        public static final Room FLOOR2 = new Room(1903, 5095, 0, 0);
    	public static final Room PARLOUR = new Room(1856, 5112, 0, 0);
    	public static final Room KITCHEN = new Room(1872, 5112, 0, 0);
    	public static final Room DINING = new Room(1890, 5112, 0, 0);
    	public static final Room WORKSHOP = new Room(1856, 5096, 0, 0);
    	public static final Room BEDROOM = new Room(1904, 5112, 0, 0);
    	public static final Room SKILLHALL = new Room(1880, 5104, 0, 0);
    	public static final Room COMBAT = new Room(1880, 5088, 0, 0);
    	public static final Room QUEST_HALL = new Room(1912, 5104, 0, 0);
    	public static final Room STUDY = new Room(1888, 5096, 0, 0);
    	public static final Room COSTUME_ROOM = new Room(1904, 5064, 0, 0);
    	public static final Room CHAPEL = new Room(1872, 5096, 0, 0);
    	public static final Room PORTAL_CHAMBER = new Room(1864, 5088, 0, 0);
    	public static final Room FORMAL_GARDEN = new Room(1872, 5064, 0, 0);
    	public static final Room THRONE_ROOM = new Room(1904, 5080, 0, 0);
    	public static final Room OUBILIETTE = new Room(1904, 5080, 0, 0);
    	public static final Room CORRIDOR_DUNGEON = new Room(1888, 5080, 0, 0);
    	public static final Room JUNCTION_DUNGEON = new Room(1856, 5080, 0, 0);
    	public static final Room STAIRS_DUNGEON = new Room(1872, 5080, 0, 0);
    	public static final Room TREASURE_ROOM = new Room(1912, 5088, 0, 0);
        
    	public static int[][] objectData = { 
    		//Build obj id, Real obj id, obj type
    		{15361, 13405, 10}
    	};
    	
    	public static int getObjType(int id) {
    		for(int i = 0; i < objectData.length; i++) {
    			if(objectData[i][0] == id) {
    				return objectData[i][2];
    			}
    		}
    		return 10;
    	}
    	
    	public static int getObjId(int id) {
    		for(int i = 0; i < objectData.length; i++) {
    			if(objectData[i][0] == id) {
    				return objectData[i][1];
    			}
    		}
    		return -1;
    	}
    	
    	public static void handleConstructionClick(Client player, int id, int x, int y) {
    		int locX = player.absX % 8;
    		int locY = player.absY % 8;
    		switch(id) {
    		case 15364:
    		case 15361:
    			createObject(player, getObjId(id), x, y, getObjType(id), player.objRot);
    			break;
    		case 15314:
    		case 15313:
    			if(locX == 3 && locY == 0 || locX == 4 && locY == 0) {
    				addRoom(player, id, x, y, getRoomToBuild(player), player.absX / 8, (player.absY - 1) / 8);
    			}	
    			if(locX == 0 && locY == 3 || locX == 0 && locY == 4) {
    				addRoom(player, id, x, y, getRoomToBuild(player), (player.absX - 1) / 8, player.absY / 8);
    			}	
    			if(locX == 3 && locY == 7 || locX == 4 && locY == 7) {
    				addRoom(player, id, x, y, getRoomToBuild(player), player.absX / 8, (player.absY + 1) / 8);
    			}
    			if(locX == 7 && locY == 3 || locX == 7 && locY == 4) {
    				addRoom(player, id, x, y, getRoomToBuild(player), (player.absX + 1) / 8, player.absY / 8);
    			}	
    			break;
    		}
    		player.getDH().sendDialogues(62, 0);
    	}
    	
    	public static boolean handleButtons(Client c, int actionButtonId) {
    		switch(actionButtonId) {
    		case 9168:
    			if(c.objRot > 3) {
    				c.objRot++;
    			}
    			createObject(c, getObjId(c.objId), c.objectX, c.objectY, getObjType(c.objId), c.objRot);
    			loadObjects(c);
    			break;
    		}
    		return false;
    	}
    	
    	public static void createObject(Client player, int id, int x, int y, int type, int face) {
    		if(player != null) {
    			RoomObject object = new RoomObject(id, x, y, player.heightLevel, type, face);
    			player.objectId = id;
    			player.objRot = face;
    			new Object(object.id, object.y, object.x, player.playerId*4, player.objRot, getObjType(object.id), object.id, 0);
    			/*object.id = id;
    			object.x = player.objectX;
    			object.y = player.objectY;
    			player.getOutStream().createFrame(85);
    			player.getOutStream().writeByteC(object.y - player.getMapRegionY() * 8);
    			player.getOutStream().writeByteC(object.x - player.getMapRegionX() * 8);
    			player.getOutStream().createFrame(101);
    			player.getOutStream().writeByteC(object.rot);
    			player.getOutStream().writeByte(0);
    			player.getOutStream().createFrame(151);
    			player.getOutStream().writeByteS(0);
    			player.getOutStream().writeWordBigEndian(object.id);
    			player.getOutStream().writeByteS(object.rot);
    			player.flushOutStream();*/
    			player.getHouse().objects.add(object);
    			loadObjects(player);
    		}	
    	}
    	
    	public static Room getRoomToBuild(Client c) {
    		return GAME;
    	}
    	
    	public static void addRoom(Client player, int id, int x, int y, Room room, int slotX, int slotY) {
    		player.getHouse().rooms[slotX][slotY][0] = room;
    		showHouse(player, player);
    	}
    }

    And the palette class created by Graham

    Code:
    package server.model.players;
     
    public class Palette {
           
            public static final int DIRECTION_NORMAL = 0;
            public static final int DIRECTION_CW_0 = 0;
            public static final int DIRECTION_CW_90 = 1;
            public static final int DIRECTION_CW_180 = 2;
            public static final int DIRECTION_CW_270 = 3;
           
            public static class PaletteTile {
                   
                    private int x;
                    private int y;
                    private int z;
                    private int rot;
                   
                    public PaletteTile(int x, int y) {
                            this(x, y, 0);
                    }
                   
                    public PaletteTile(int x, int y, int z) {
                            this(x, y, z, DIRECTION_NORMAL);
                    }
                   
                    public PaletteTile(int x, int y, int z, int rot) {
                            this.x = x;
                            this.y = y;
                            this.z = z;
                            this.rot = rot;
                    }
                   
                    public int getX() {
                            return x / 8;
                    }
                   
                    public int getY() {
                            return y / 8;
                    }
                   
                    public int getZ() {
                            return z % 4;
                    }
                   
                    public int getRotation() {
                            return rot % 4;
                    }
                   
            }
           
            private PaletteTile[][][] tiles = new PaletteTile[13][13][4];
    
    		public PaletteTile getTile(int x, int y, int z) {
                    return tiles[x][y][z];
            }
           
            public void setTile(int x, int y, int z, PaletteTile tile) {
                    tiles[x][y][z] = tile;
            }
     
    }
    Your final result:




    cause ik a lot of ppl will leech this, there is a problem with the client that you have to fix for the packet to work. i released it before but i took it down.

    also put a 'houses' folder in your data folder


    Beautiful. Thank you.
    Reply With Quote  
     

  9. #8  
    Banned
    Join Date
    Aug 2011
    Posts
    1,062
    Thanks given
    197
    Thanks received
    214
    Rep Power
    0
    PI advancements all about that life.
    Reply With Quote  
     

  10. #9  
    plz dont take my wizard mind bombs Women's Avatar
    Join Date
    Mar 2010
    Posts
    1,881
    Thanks given
    724
    Thanks received
    1,162
    Rep Power
    4763
    Quote Originally Posted by Zak Wins View Post
    PI advancements all about that life.
    do something son
    Reply With Quote  
     

  11. #10  
    Registered Member

    Join Date
    Sep 2011
    Posts
    5,121
    Thanks given
    1,333
    Thanks received
    1,795
    Rep Power
    1731
    Well done brah.
    Retired from RSPS. Please don't message me for services, sales or help. Apologies.
    Reply With Quote  
     

Page 1 of 12 12311 ... 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. Construct map region packet aka 'secondary map region packet'
    By Graham in forum Informative Threads
    Replies: 95
    Last Post: 06-22-2015, 12:19 PM
  2. [help] Construct Map Region Packet - 317
    By braybray125 in forum Help
    Replies: 3
    Last Post: 08-10-2012, 11:55 PM
  3. [Galkons] Construct map region packet bug
    By Women in forum Snippets
    Replies: 14
    Last Post: 06-16-2012, 12:18 AM
  4. Construct Map Region Packet Help
    By Xaves in forum Help
    Replies: 3
    Last Post: 06-25-2010, 12:37 PM
  5. Real construct map region packet (rs2hd)
    By Graham in forum Tutorials
    Replies: 73
    Last Post: 10-10-2009, 06:10 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •