in 5165 :|
My jump.cs
Code:
public static bool CanSee(int SeeX, int SeeY, int MyX, int MyY)
{
return (Math.Max(Math.Abs(SeeX - MyX), Math.Abs(SeeY - MyY)) <= 17);
}
public static void Handle(Main.GameClient GC, byte[] Data)
{
ushort Previos_X = BitConverter.ToUInt16(Data, 20);
ushort Previos_y = BitConverter.ToUInt16(Data, 22);
ushort new_X = (ushort)(BitConverter.ToUInt32(Data, 8) & 0xFFFF);
ushort new_Y = (ushort)(BitConverter.ToUInt32(Data, 10) & 0xFFFF);//(ushort)(BitConverter.ToUInt32(Data, 8) >> 16);
// Console.WriteLine("X {0} and Y{1}", new_X, new_Y);
COPacket Jump = Packets.GeneralData(GC.MyChar.EntityID, new_X, new_Y, Previos_X, Previos_y, 0, 137);
foreach (DictionaryEntry DE in Game.World.H_Chars)
{
Game.Character C = (Game.Character)DE.Value;
{
if (GC.MyChar.Loc.Map == C.Loc.Map)
{
if (CanSee(GC.MyChar.Loc.X, GC.MyChar.Loc.Y, C.Loc.X, C.Loc.Y))
C.MyClient.SendPacket(Jump);
// C.MyClient.SendPacket(Packets.GeneralData(GC.MyChar.EntityID, new_X, new_Y, Previos_X, Previos_y, 0, 137));
}
}
}
GC.MyChar.lastJumpDistance = GetDistance(new_X, new_Y, GC.MyChar.Loc.X, GC.MyChar.Loc.Y);
GC.MyChar.lastJumpTime = DateTime.Now;
GC.MyChar.Mining = false;
GC.MyChar.AtkMem.Attacking = false;
GC.MyChar.InvencibleTime = DateTime.Now;
GC.MyChar.secondeimunity = 0;
GC.MyChar.Action = (byte)Game.ConquerAction.Jump;
GC.MyChar.Loc.PreviousX = Previos_X;
GC.MyChar.Loc.PreviousY = Previos_y;
GC.MyChar.Loc.X = new_X;
GC.MyChar.Loc.Y = new_Y;
Game.World.Spawns(GC.MyChar, true);
Code:
public unsafe void SendPacket(COPacket Packet)
{
if (Soc.Connected)
{
byte[] P = Packet.Get;
fixed (byte* p = P)
{
string TQServer = "TQServer";
for (int i = 0; i < 8; i++)
*(p + i + P.Length - 8) = Convert.ToByte(TQServer[i]);
}
PacketGroup.Add(P);
Monitor.Enter(this);
try
{
ArrayList Packets = new ArrayList();
for (int i = 0; i < PacketGroup.Count; i++)
Packets.Add(PacketGroup[i]);
int TotalLength = 0;
foreach (byte[] Pa in Packets)
if (Pa != null)
if (Pa.Length > 0)
TotalLength += Pa.Length;
byte[] Data = new byte[TotalLength];
int Pos = 0;
lock (Packets)
{
foreach (byte[] Pa in Packets)
{
if (Pa != null)
{
if (Pa.Length > 0)
{
Buffer.BlockCopy(Pa, 0, Data, Pos, Pa.Length);
Pos += Pa.Length;
}
}
}
try
{
Crypto.Encrypt(Data);
Soc.Send(Data, Data.Length, SocketFlags.None);
}
catch { }
}
Packets = null;
PacketGroup = new ArrayList();
}
catch (Exception c) { PacketGroup = new ArrayList(); Program.WriteLine(c.ToString()); }
//Crypto.Encrypt(P);
Monitor.Exit(this);
//Soc.Send(P);
}
else
Disconnect();
}






