|
You last visited: Today at 14:04
Advertisement
Walk Packet using Google Protocol Buffer
Discussion on Walk Packet using Google Protocol Buffer within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.
10/24/2015, 17:10
|
#1
|
elite*gold: 0
Join Date: Aug 2013
Posts: 3
Received Thanks: 0
|
Walk Packet using Google Protocol Buffer
PHP Code:
using System; using System.Collections.Generic; using System.IO; using System.Linq;
namespace Conquer_Online_Server.Network.GamePackets { public class GroundMovement : Writer, Interfaces.IPacket { public const uint Walk = 0, Run = 1, Slide = 9;
public GroundMovement(bool CreateInstance) {
} public byte[] CreateProtocolBuffer(params uint[] values) { List<byte> ptr = new List<byte>(); ptr.Add(8); for (int x = 0; x < values.Length; x++) { uint value = values[x]; while (value > 0x7F) { ptr.Add((byte)((value & 0x7F) | 0x80)); value >>= 7; } ptr.Add((byte)(value & 0x7F)); ptr.Add((byte)(8 * (x + 2))); if (x + 1 == values.Length) break; } return ptr.ToArray(); } public uint ReadFromProtocolUint32(uint position, BinaryReader 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)Direction, UID, GroundMovementType, TimeStamp, MapID);
List<byte> pack = new List<byte>(); for (int i = 0; i < (ptr.Length - 1); i++) { pack.Add(ptr[i]); } ptr = pack.ToArray();
byte[] buffer = new byte[12 + ptr.Length]; Writer.WriteUInt16((ushort)(buffer.Length - 8), 0, buffer); Writer.WriteUInt16(10005, 2, buffer); System.Array.Copy(ptr, 0, buffer, 4, ptr.Length);
return buffer; }
public void Deserialize(byte[] buffer) {
var packet = new byte[buffer.Length - 4]; System.Array.Copy(buffer, 4, packet, 0, packet.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 = 0; i < Reader.BaseStream.Length; i++) { Reader.BaseStream.Position = i; if (packet[i] == 8) { direction = ReadFromProtocolUint32(8, Reader); } if (packet[i] == 16) { uid = ReadFromProtocolUint32(16, Reader); } if (packet[i] == 24) { type = ReadFromProtocolUint32(24, Reader); } if (packet[i] == 32) { tstamp = ReadFromProtocolUint32(32, Reader); } if (packet[i] == 40) { mapid = ReadFromProtocolUint32(40, Reader); } } 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
|
#2
|
elite*gold: 12
Join Date: Jul 2011
Posts: 8,283
Received Thanks: 4,192
|
Quote:
Originally Posted by mllove
PHP Code:
using System; using System.Collections.Generic; using System.IO; using System.Linq;
namespace Conquer_Online_Server.Network.GamePackets { public class GroundMovement : Writer, Interfaces.IPacket { public const uint Walk = 0, Run = 1, Slide = 9;
public GroundMovement(bool CreateInstance) {
} public byte[] CreateProtocolBuffer(params uint[] values) { List<byte> ptr = new List<byte>(); ptr.Add(8); for (int x = 0; x < values.Length; x++) { uint value = values[x]; while (value > 0x7F) { ptr.Add((byte)((value & 0x7F) | 0x80)); value >>= 7; } ptr.Add((byte)(value & 0x7F)); ptr.Add((byte)(8 * (x + 2))); if (x + 1 == values.Length) break; } return ptr.ToArray(); } public uint ReadFromProtocolUint32(uint position, BinaryReader 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)Direction, UID, GroundMovementType, TimeStamp, MapID);
List<byte> pack = new List<byte>(); for (int i = 0; i < (ptr.Length - 1); i++) { pack.Add(ptr[i]); } ptr = pack.ToArray();
byte[] buffer = new byte[12 + ptr.Length]; Writer.WriteUInt16((ushort)(buffer.Length - 8), 0, buffer); Writer.WriteUInt16(10005, 2, buffer); System.Array.Copy(ptr, 0, buffer, 4, ptr.Length);
return buffer; }
public void Deserialize(byte[] buffer) {
var packet = new byte[buffer.Length - 4]; System.Array.Copy(buffer, 4, packet, 0, packet.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 = 0; i < Reader.BaseStream.Length; i++) { Reader.BaseStream.Position = i; if (packet[i] == 8) { direction = ReadFromProtocolUint32(8, Reader); } if (packet[i] == 16) { uid = ReadFromProtocolUint32(16, Reader); } if (packet[i] == 24) { type = ReadFromProtocolUint32(24, Reader); } if (packet[i] == 32) { tstamp = ReadFromProtocolUint32(32, Reader); } if (packet[i] == 40) { mapid = ReadFromProtocolUint32(40, Reader); } } 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
|
#3
|
elite*gold: 0
Join Date: Jul 2009
Posts: 943
Received Thanks: 408
|
Quote:
Originally Posted by Spirited
Oh *** this thread title is so ******* ****. 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-****".
|
Second one, please sir
|
|
|
10/24/2015, 19:34
|
#4
|
elite*gold: 12
Join Date: Jul 2011
Posts: 8,283
Received Thanks: 4,192
|
Quote:
Originally Posted by pintinho12
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
|
#5
|
elite*gold: 0
Join Date: Aug 2013
Posts: 3
Received Thanks: 0
|
i was try to help all want the walk thanks for edit and soory good luck all
|
|
|
10/25/2015, 09:06
|
#6
|
elite*gold: 67
Join Date: Aug 2014
Posts: 1,323
Received Thanks: 928
|
Thats the kind of **** I dont get. Someone posts something that hasnt been released and all he gets is **** for the title.
|
|
|
10/25/2015, 09:26
|
#7
|
elite*gold: 12
Join Date: Jul 2011
Posts: 8,283
Received Thanks: 4,192
|
Quote:
Originally Posted by Xio.
Thats the kind of **** I dont get. Someone posts something that hasnt been released and all he gets is **** 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:  . Also my article on my wiki:  .
Edit: I'm dying.
|
|
|
10/25/2015, 23:43
|
#8
|
elite*gold: 0
Join Date: Aug 2013
Posts: 3
Received Thanks: 0
|
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
|
#9
|
elite*gold: 12
Join Date: Jul 2011
Posts: 8,283
Received Thanks: 4,192
|
Quote:
Originally Posted by mllove
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
|
#10
|
elite*gold: 0
Join Date: Sep 2008
Posts: 348
Received Thanks: 141
|
Quote:
Originally Posted by Spirited
Good.
One egy bites the dust.
|
@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
EGY FTW
|
|
|
11/03/2015, 18:35
|
#11
|
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,380
|
Quote:
Originally Posted by !DeX!
EGY FTW
|
|
|
|
11/04/2015, 02:34
|
#12
|
elite*gold: 12
Join Date: Jul 2011
Posts: 8,283
Received Thanks: 4,192
|
Quote:
Originally Posted by !DeX!
@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 
|
|
|
|
11/04/2015, 10:04
|
#13
|
elite*gold: 0
Join Date: Sep 2008
Posts: 348
Received Thanks: 141
|
Quote:
Originally Posted by Spirited
|
@Spirited < ---
@pro4never < -- What do u Think About THAT EGY.FTW
|
|
|
11/06/2015, 08:08
|
#14
|
elite*gold: 0
Join Date: Dec 2012
Posts: 1,761
Received Thanks: 950
|
I have been logged in for 2 minutes and now I'm logging out again.
|
|
|
 |
Similar Threads
|
[Question] Walk/Run Packet
10/19/2015 - CO2 Private Server - 1 Replies
After adding fully functional Tempest Wings to the source and client, there seems to be an issue with the Walk/Run packet that lags or glitches you out of the game resulting you to disconnect. Has anyone found any hint where to change the packet? or is it still not discovered yet. :handsdown: to those who have.
or is this the result of adding mesh?
or can it be the Move/Run speed within the Monsters?
|
walk packet - visual effect
06/28/2014 - Nostale - 9 Replies
Hi! I'm making packet-using bot and I have big problem - I stopped on walking event, beacuse sending "walk" only sends packet to server and our character (in client) is standing in the same place. Do you have any ideas to move our character visually with packet? :)
|
Packet: desc buffer mem_size overflow...
08/09/2012 - Metin2 Private Server - 13 Replies
Packet: desc buffer mem_size overflow. memsize(131072) write_pos(131056) iSize(35)
8GB RAM, 6Cores pro Channel für 200 Gamer, login & alles andere scheißt nach ner Weile ab, weiss nicht mehr weiter.
300e*g Belohnung bei erfolgreicher Hilfe!
vielen dank im vorraus
|
Walk packet
09/28/2011 - CO2 Private Server - 3 Replies
today i came across to a problem that when 1 client sends walk packet to other clients. That packet is delayed up to 1-4 secs. But this is when you send it at stand -> to walk. if you send walk packet when client is walking then there is no delay(not counting delay that was made stand ->walk).
could that be client? or my source?
i don't have problems with any other packet....
client is 4*** late something.
Fun -= walk <-- video to better understand what I'm talking about!
|
Walk Packet
04/01/2010 - Silkroad Online - 3 Replies
I've been following Pushedx (Drew) guides, and so far I've done some interesting things.
Now I want to understand how the Walk packets works, but I can't find any pattern or place to start of, if anyone could help me please.
That's what I have so far:
01
?? ?? //Dunno what they are
XX ?? //Left one indicates the X position, but dunno how
?? ??
YY ?? //Left one indicates the Y position, but dunno how
|
All times are GMT +1. The time now is 14:07.
|
|