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();
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.
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();
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".
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-****".
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: .
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
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
@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 < --- 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
[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