Thread: Map region not showing on login?

Page 3 of 3 FirstFirst 123
Results 21 to 23 of 23
  1. #21  
    Registered Member

    Join Date
    Jan 2008
    Age
    28
    Posts
    1,380
    Thanks given
    76
    Thanks received
    384
    Rep Power
    962
    To get the the region to show you need full processing of movement working, and you need full player update packet working.
    Reply With Quote  
     

  2. #22  
    Registered Member
    Join Date
    Dec 2009
    Age
    27
    Posts
    169
    Thanks given
    16
    Thanks received
    3
    Rep Power
    11
    Quote Originally Posted by digistr View Post
    oh i was only guessing =\ cuz that thing u posted has 73 and 241.
    No worries.
    Quote Originally Posted by digistr View Post
    um but by "z" i meant where do you send your hieghtLevel aka "z" to the client?
    In the player updating. That might/could be why then? It's not showing the correct height level so it's thinking that it's at -1? Also, the putBits, isEmpty, startBitAccess and finishBitAccess methods are messed up and might be reasons as to why I can't see the map regions and also as to why it's giving me errors upon errors in the client - because it's not reading it correctly. I tried finding a position() or even a location() or offset() method that gives the currentOffset in the ChannelBuffer, but no go.
    [Only registered and activated users can see links. ]
    Code:
    package com.emulation.net.packet;
    
    import org.jboss.netty.buffer.ChannelBuffer;
    import org.jboss.netty.buffer.ChannelBuffers;
    
    import com.emulation.net.packet.Packet.Type;
    
    public class PacketBuilder {
    
    	private static int[] BIT_MASK_OUT = new int[32];
    	private int opcode;
    	private ChannelBuffer payload = ChannelBuffers.dynamicBuffer();
    	private Type type;
    	private int bitPosition;
    
    	static {
    		for (int i = 0; i < PacketBuilder.BIT_MASK_OUT.length; i++) {
    			PacketBuilder.BIT_MASK_OUT[i] = (1 << i) - 1;
    		}
    	}
    
    	public PacketBuilder() {
    		this(-1);
    	}
    
    	public PacketBuilder(int opcode) {
    		this(opcode, Type.FIXED);
    	}
    
    	public PacketBuilder(int opcode, Type type) {
    		this.opcode = opcode;
    		this.type = type;
    	}
    
    	public Packet toPacket() {
    		return new Packet(this.opcode, this.type, this.payload);
    	}
    
    	public PacketBuilder putByte(byte b) {
    		this.payload.writeByte(b);
    		return this;
    	}
    
    	public PacketBuilder putByte(ChannelBuffer payload) {
    		this.payload.writeBytes(payload);
    		return this;
    	}
    
    	public PacketBuilder putBytes(byte[] b) {
    		this.payload.writeBytes(b);
    		return this;
    	}
    
    	public PacketBuilder putByteA(int b) {
    		this.payload.writeByte((byte) (b + 128));
    		return this;
    	}
    
    	public PacketBuilder putShort(int s) {
    		this.payload.writeShort((short) s);
    		return this;
    	}
    
    	public PacketBuilder putShortA(int s) {
    		this.payload.writeByte((byte) (s >> 8));
    		this.payload.writeByte((byte) (s + 128));
    		return this;
    	}
    
    	public PacketBuilder putLEShortA(int b) {
    		this.payload.writeByte((byte) (b + 128));
    		this.payload.writeByte((byte) (b >> 8));
    		return this;
    	}
    
    	public PacketBuilder putInt(int i) {
    		this.payload.writeInt(i);
    		return this;
    	}
    
    	public PacketBuilder putLong(long l) {
    		this.payload.writeLong(l);
    		return this;
    	}
    
    	public PacketBuilder putString(String s) {
    		this.payload.writeBytes(s.getBytes());
    		this.payload.writeByte((byte) 10);
    		return this;
    	}
    
    	public boolean isEmpty() {
    		return this.payload.arrayOffset() == 0;
    	}
    
    	public PacketBuilder startBitAccess() {
    		this.bitPosition = this.payload.arrayOffset() * 8;
    		return this;
    	}
    
    	public PacketBuilder finishBitAccess() {
    		this.payload.ensureWritableBytes((this.bitPosition + 7) / 8);
    		return this;
    	}
    
    	public PacketBuilder putBits(int numBits, int value) {
    		int bytes = (int) Math.ceil(numBits / 8D) + 1;
    		this.payload.ensureWritableBytes((this.bitPosition + 7) / 8 + bytes);
    		byte[] buffer = this.payload.array();
    		int bytePos = this.bitPosition >> 3;
    		int bitOffset = 8 - (this.bitPosition & 7);
    		this.bitPosition += numBits;
    		for (; numBits > bitOffset; bitOffset = 8) {
    			buffer[bytePos] &= ~PacketBuilder.BIT_MASK_OUT[bitOffset];
    			buffer[bytePos++] |= (value >> (numBits - bitOffset)) & PacketBuilder.BIT_MASK_OUT[bitOffset];
    			numBits -= bitOffset;
    		}
    		if (numBits == bitOffset) {
    			buffer[bytePos] &= ~PacketBuilder.BIT_MASK_OUT[bitOffset];
    			buffer[bytePos] |= value & PacketBuilder.BIT_MASK_OUT[bitOffset];
    		} else {
    			buffer[bytePos] &= ~(PacketBuilder.BIT_MASK_OUT[numBits] << (bitOffset - numBits));
    			buffer[bytePos] |= (value & PacketBuilder.BIT_MASK_OUT[numBits]) << (bitOffset - numBits);
    		}
    		return this;
    	}
    
    	public ChannelBuffer getPayload() {
    		return this.payload;
    	}
    
    	public Type getType() {
    		return this.type;
    	}
    }
    Having some trouble with that because as I said before, I debugged mine and a winterLove server and the bitPosition was completely off. On mine, it came out as 0 all the time. Found out that the arrayOffset() method in ChannelBuffer wasn't used at all, so yeah.. If someone could help me with those methods, I could probably get the maps loaded then.

    EDIT: Finally got the startBitAccess and finishBitAccess methods correct. I just need the putBits method to be correct as well and I should be fine.
    [Only registered and activated users can see links. ]

    I am nerdier than 74% of all people. Are you a nerd? Click here to take the Nerd Test, get geeky images and jokes, and write on the nerd forum!

    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  3. #23  
    Banned
    Join Date
    Sep 2010
    Posts
    297
    Thanks given
    28
    Thanks received
    64
    Rep Power
    0
    If you want to send me the source, I can take a quick look at it and try to fix it.
    Reply With Quote  
     

Page 3 of 3 FirstFirst 123

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. Replies: 3
    Last Post: 11-06-2010, 01:52 AM
  3. Replies: 50
    Last Post: 09-06-2010, 06:55 PM
  4. Lag in Region?
    By silabgarza in forum Help
    Replies: 6
    Last Post: 07-16-2010, 01:13 PM
  5. Region IDS
    By G0nzo in forum Requests
    Replies: 3
    Last Post: 11-01-2009, 08:23 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
  •