Walk Packet using Google Protocol Buffer

10/24/2015 17:10 mllove#1
PHP Code:
using System
using System.Collections.Generic
using System.IO
using System.Linq

namespace 
Conquer_Online_Server.Network.GamePackets 

    public class 
GroundMovement WriterInterfaces.IPacket 
    

        public const 
uint Walk 0
                          
Run 1
                          
Slide 9


        public 
GroundMovement(bool CreateInstance
        { 

        } 
        public 
byte[] CreateProtocolBuffer(params uint[] values
        { 
            List<
byteptr = new List<byte>(); 
            
ptr.Add(8); 
            for (
int x 0values.Lengthx++) 
            { 
                
uint value values[x]; 
                while (
value 0x7F
                { 
                    
ptr.Add((byte)((value 0x7F) | 0x80)); 
                    
value >>= 7
                } 
                
ptr.Add((byte)(value 0x7F)); 
                
ptr.Add((byte)(* (2))); 
                if (
== values.Length
                    break; 
            } 
            return 
ptr.ToArray(); 
        } 
        public 
uint ReadFromProtocolUint32(uint positionBinaryReader reader
        { 
            
byte key reader.ReadByte(); 
            if (
key == position
            { 
                
uint value 0
                
int shift 0
                
uint val reader.ReadByte(); 
                while (
val 0x7F
                { 
                    
value |= (val 0x7F) << shift
                    
shift += 7
                    
val reader.ReadByte(); 
                } 
                
value |= (val 0x7F) << shift
                return 
value
            } 
            return 
0
        } 
        public 
byte[] ToArray() 
        { 
            
byte[] ptr CreateProtocolBuffer((uint)DirectionUIDGroundMovementTypeTimeStampMapID); 


            List<
bytepack = new List<byte>(); 
            for (
int i 0< (ptr.Length 1); i++) 
            { 
                
pack.Add(ptr[i]); 
            } 
            
ptr pack.ToArray(); 

            
byte[] buffer = new byte[12 ptr.Length]; 
            
Writer.WriteUInt16((ushort)(buffer.Length 8), 0buffer); 
            
Writer.WriteUInt16(100052buffer); 
            
System.Array.Copy(ptr0buffer4ptr.Length); 

            return 
buffer
        } 

        public 
void Deserialize(byte[] buffer
        { 

            var 
packet = new byte[buffer.Length 4]; 
            
System.Array.Copy(buffer4packet0packet.Length); 
            
using (var Reader = new BinaryReader(new MemoryStream(packet))) 
            { 
                
uint direction 0
                
uint uid 0
                
uint type 0
                
uint tstamp 0
                
uint mapid 0
                for (
int i 0Reader.BaseStream.Lengthi++) 
                { 
                    
Reader.BaseStream.Position i
                    if (
packet[i] == 8
                    { 
                        
direction ReadFromProtocolUint32(8Reader); 
                    } 
                    if (
packet[i] == 16
                    { 
                        
uid ReadFromProtocolUint32(16Reader); 
                    } 
                    if (
packet[i] == 24
                    { 
                        
type ReadFromProtocolUint32(24Reader); 
                    } 
                    if (
packet[i] == 32
                    { 
                        
tstamp ReadFromProtocolUint32(32Reader); 
                    } 
                    if (
packet[i] == 40
                    { 
                        
mapid ReadFromProtocolUint32(40Reader); 
                    } 
                } 
                
Direction = (Conquer_Online_Server.Game.Enums.ConquerAngle)direction
                
UID uid
                
GroundMovementType type
                
TimeStamp tstamp
                
MapID mapid
            } 

        } 

        public 
Game.Enums.ConquerAngle Direction
        public 
uint UID
        public 
uint TimeStamp
        public 
uint MapID
        public 
uint GroundMovementType
        public 
void Send(Client.GameClient client
        { 
            
client.Send(ToArray()); 
        } 
    } 

If you got any Errors
change
Conquer_Online_Server
by name of your Project.
10/24/2015 19:21 Spirited#2
Quote:
Originally Posted by mllove View Post
PHP Code:
using System
using System.Collections.Generic
using System.IO
using System.Linq

namespace 
Conquer_Online_Server.Network.GamePackets 

    public class 
GroundMovement WriterInterfaces.IPacket 
    

        public const 
uint Walk 0
                          
Run 1
                          
Slide 9


        public 
GroundMovement(bool CreateInstance
        { 

        } 
        public 
byte[] CreateProtocolBuffer(params uint[] values
        { 
            List<
byteptr = new List<byte>(); 
            
ptr.Add(8); 
            for (
int x 0values.Lengthx++) 
            { 
                
uint value values[x]; 
                while (
value 0x7F
                { 
                    
ptr.Add((byte)((value 0x7F) | 0x80)); 
                    
value >>= 7
                } 
                
ptr.Add((byte)(value 0x7F)); 
                
ptr.Add((byte)(* (2))); 
                if (
== values.Length
                    break; 
            } 
            return 
ptr.ToArray(); 
        } 
        public 
uint ReadFromProtocolUint32(uint positionBinaryReader reader
        { 
            
byte key reader.ReadByte(); 
            if (
key == position
            { 
                
uint value 0
                
int shift 0
                
uint val reader.ReadByte(); 
                while (
val 0x7F
                { 
                    
value |= (val 0x7F) << shift
                    
shift += 7
                    
val reader.ReadByte(); 
                } 
                
value |= (val 0x7F) << shift
                return 
value
            } 
            return 
0
        } 
        public 
byte[] ToArray() 
        { 
            
byte[] ptr CreateProtocolBuffer((uint)DirectionUIDGroundMovementTypeTimeStampMapID); 


            List<
bytepack = new List<byte>(); 
            for (
int i 0< (ptr.Length 1); i++) 
            { 
                
pack.Add(ptr[i]); 
            } 
            
ptr pack.ToArray(); 

            
byte[] buffer = new byte[12 ptr.Length]; 
            
Writer.WriteUInt16((ushort)(buffer.Length 8), 0buffer); 
            
Writer.WriteUInt16(100052buffer); 
            
System.Array.Copy(ptr0buffer4ptr.Length); 

            return 
buffer
        } 

        public 
void Deserialize(byte[] buffer
        { 

            var 
packet = new byte[buffer.Length 4]; 
            
System.Array.Copy(buffer4packet0packet.Length); 
            
using (var Reader = new BinaryReader(new MemoryStream(packet))) 
            { 
                
uint direction 0
                
uint uid 0
                
uint type 0
                
uint tstamp 0
                
uint mapid 0
                for (
int i 0Reader.BaseStream.Lengthi++) 
                { 
                    
Reader.BaseStream.Position i
                    if (
packet[i] == 8
                    { 
                        
direction ReadFromProtocolUint32(8Reader); 
                    } 
                    if (
packet[i] == 16
                    { 
                        
uid ReadFromProtocolUint32(16Reader); 
                    } 
                    if (
packet[i] == 24
                    { 
                        
type ReadFromProtocolUint32(24Reader); 
                    } 
                    if (
packet[i] == 32
                    { 
                        
tstamp ReadFromProtocolUint32(32Reader); 
                    } 
                    if (
packet[i] == 40
                    { 
                        
mapid ReadFromProtocolUint32(40Reader); 
                    } 
                } 
                
Direction = (Conquer_Online_Server.Game.Enums.ConquerAngle)direction
                
UID uid
                
GroundMovementType type
                
TimeStamp tstamp
                
MapID mapid
            } 

        } 

        public 
Game.Enums.ConquerAngle Direction
        public 
uint UID
        public 
uint TimeStamp
        public 
uint MapID
        public 
uint GroundMovementType
        public 
void Send(Client.GameClient client
        { 
            
client.Send(ToArray()); 
        } 
    } 

If you got any Errors
change
Conquer_Online_Server
by name of your Project.
Oh god this thread title is so fucking shit. Request thread rename to something that isn't completely and utterly retarded. Examples: "Walk Packet using Google Protocol Buffer" or "Walk Packet, Patch What-ever-the-fuck".
10/24/2015 19:26 pintinho12#3
Quote:
Originally Posted by Spirited View Post
Oh god this thread title is so fucking shit. Request thread rename to something that isn't completely and utterly retarded. Examples: "Walk Packet using Google Protocol Buffer" or "Walk Packet, Patch What-ever-the-fuck".
Second one, please sir
10/24/2015 19:34 Spirited#4
Quote:
Originally Posted by pintinho12 View Post
Second one, please sir
I've noticed that not a single one of these idiots have actually posted a patch number for their questions. It's patch 6132.
10/25/2015 04:38 mllove#5
i was try to help all want the walk thanks for edit and soory good luck all
10/25/2015 09:06 Xio.#6
Thats the kind of shit I dont get. Someone posts something that hasnt been released and all he gets is shit for the title.
10/25/2015 09:26 Spirited#7
Quote:
Originally Posted by Xio. View Post
Thats the kind of shit I dont get. Someone posts something that hasnt been released and all he gets is shit for the title.
You didn't see the title and this is just copied from the egy forums. Know what and who you're backing before you back something like a blind idiot. A more maintainable implementation can be found here, by the way: [Only registered and activated users can see links. Click Here To Register...]. Also my article on my wiki: [Only registered and activated users can see links. Click Here To Register...].

Edit: I'm dying.
[Only registered and activated users can see links. Click Here To Register...]
10/25/2015 23:43 mllove#8
Spririted its none of your business its my title if you not like it leave it if copied i do to help other.......
i will not help any one again good luck just help my self
10/26/2015 00:27 Spirited#9
Quote:
Originally Posted by mllove View Post
Spririted its none of your business its my title if you not like it leave it if copied i do to help other.......
i will not help any one again good luck just help my self
Good.
One egy bites the dust.
11/03/2015 18:00 !DeX!#10
Quote:
Originally Posted by Spirited View Post
Good.
One egy bites the dust.
:rtfm:
@Spirited < --- You Should Reported always be out OFF Topic , That not your problem IF you Find the Code is bad , there is sticky Topic
You make Conquer PS Deve looking bad

Spirited IS Awesome :handsdown:

EGY FTW
11/03/2015 18:35 pro4never#11
Quote:
Originally Posted by !DeX! View Post
EGY FTW
:facepalm:
11/04/2015 02:34 Spirited#12
Quote:
Originally Posted by !DeX! View Post
:rtfm:
@Spirited < --- You Should Reported always be out OFF Topic , That not your problem IF you Find the Code is bad , there is sticky Topic
You make Conquer PS Deve looking bad

Spirited IS Awesome :handsdown:
[Only registered and activated users can see links. Click Here To Register...]
11/04/2015 10:04 !DeX!#13
Quote:
Originally Posted by Spirited View Post
[Only registered and activated users can see links. Click Here To Register...]
@Spirited < --- :pimp:
@pro4never < -- What do u Think About THAT EGY.FTW :handsdown:
11/06/2015 08:08 Super Aids#14
I have been logged in for 2 minutes and now I'm logging out again.