[Release] Full Interactions

08/10/2011 07:05 Spirited#1
Holding hands packet:
Code:
namespace Kibou.Connections.Packets
{
    using System;

    public unsafe class HoldingHands
    {
        public byte[] Buffer;
        public HoldingHands(byte direction, byte speed)
        {
            Buffer = new byte[32];
            fixed (byte* ptr = Buffer)
            {
                *((ushort*)(ptr)) = 24;
                *((ushort*)(ptr + 2)) = 1114;
                *((ushort*)(ptr + 4)) = 1;
                *(ptr + 6) = direction;
                *(ptr + 7) = speed;
                *(ptr + 12) = 2;
            }
        }
        public HoldingHands(ushort x, ushort y)
        {
            Buffer = new byte[32];
            fixed (byte* ptr = Buffer)
            {
                *((ushort*)(ptr)) = 24;
                *((ushort*)(ptr + 2)) = 1114;
                *((ushort*)(ptr + 4)) = 2;
                *((ushort*)(ptr + 6)) = x;
                *((ushort*)(ptr + 8)) = y;
                *(ptr + 12) = 2;
            }
        }
        public HoldingHands(byte direction)
        {
            Buffer = new byte[32];
            fixed (byte* ptr = Buffer)
            {
                *((ushort*)(ptr)) = 24;
                *((ushort*)(ptr + 2)) = 1114;
                *((ushort*)(ptr + 6)) = direction;
                *(ptr + 12) = 2;
            }
        }
        public uint Identity
        {
            get { return BitConverter.ToUInt32(Buffer, 16); }
            set { fixed (byte* ptr = Buffer) *((uint*)(ptr + 16)) = value; }
        }
        public uint Target
        {
            get { return BitConverter.ToUInt32(Buffer, 20); }
            set { fixed (byte* ptr = Buffer) *((uint*)(ptr + 20)) = value; }
        }
    }
}
My Packet 1022 (for reference):
Code:
namespace Kibou.Connections.Packets
{
    using System;
    using System.Runtime.InteropServices;
    using System.Runtime.Serialization.Formatters.Binary;

    [StructLayout(LayoutKind.Explicit)]
    public struct Interaction
    {
        /// <summary> Offset 8</summary>
        [FieldOffset(8)]
        public uint Identity;
        /// <summary> Offset 12</summary>
        [FieldOffset(12)]
        public uint Target;
        /// <summary> Offset 16</summary>
        [FieldOffset(16)]
        public ushort X;
        /// <summary> Offset 18</summary>
        [FieldOffset(18)]
        public ushort Y;
        /// <summary> Offset 20</summary>
        [FieldOffset(20)]
        public uint Action;
        /// <summary> Offset 24</summary>
        [FieldOffset(24)]
        public uint Effect;
        /// <summary> Offset 28</summary>
        [FieldOffset(28)]
        public uint Parameter;

        public Interaction(byte[] buffer)
        {
            Identity = BitConverter.ToUInt32(buffer, 8);
            Target = BitConverter.ToUInt32(buffer, 12);
            X = BitConverter.ToUInt16(buffer, 16);
            Y = BitConverter.ToUInt16(buffer, 18);
            Action = BitConverter.ToUInt32(buffer, 20);
            Effect = BitConverter.ToUInt32(buffer, 24);
            Parameter = BitConverter.ToUInt32(buffer, 28);
        }
        public Interaction(uint identity, uint target)
        {
            Identity = identity;
            Target = target;
            X = 0;
            Y = 0;
            Action = 0;
            Effect = 0;
            Parameter = 0;
        }
        public unsafe byte[] ToArray()
        {
            byte[] buffer = new byte[48];
            fixed (byte* ptr = buffer)
            {
                *(Interaction*)ptr = this;
                *((ushort*)(ptr)) = 40;
                *((ushort*)(ptr + 2)) = 1022;
            }
            return buffer;
        }
    }
}
My Movement Handler:
Code:
namespace Kibou.Connections.Handlers
{
    using System;

    public static class MovementHandler
    {
        private static sbyte[] _walkXCoords = new sbyte[8] { 0, -1, -1, -1, 0, 1, 1, 1 };
        private static sbyte[] _walkYCoords = new sbyte[8] { 1, 1, 0, -1, -1, -1, 0, 1 };

        private static sbyte[] _rideXCoords = new sbyte[24] { 0, -2, -2, -2, 0, 2, 2, 2, -1, -2, -2, -1, 1, 2, 2, 1, -1, -2, -2, -1, 1, 2, 2, 1 };
        private static sbyte[] _rideYCoords = new sbyte[24] { 2, 2, 0, -2, -2, -2, 0, 2, 2, 1, -1, -2, -2, -1, 1, 2, 2, 1, -1, -2, -2, -1, 1, 2 };

        public static void Walk(Packets.Movement movement, World.Client client)
        {
            client.Character.Direction = (byte)(movement.Direction % 8);
            client.Character.Action = 0;

            ushort _x = client.Character.X;
            ushort _y = client.Character.Y;
            _x += (ushort)(_walkXCoords[movement.Direction % 8]);
            _y += (ushort)(_walkYCoords[movement.Direction % 8]);

            if (client.Map.Floor[_x, _y] < Enums.Tile.Available)
            {
                client.Character.Teleport(client.Character.MapId, client.Character.X, client.Character.Y);
                return;
            }

            client.Character.X = _x;
            client.Character.Y = _y;
            if (client.Interaction != null)
            {
                client.Interaction.Target.Character.Direction = (byte)(movement.Direction % 8);
                client.Interaction.Target.Character.Action = 0;
                client.Interaction.Target.Character.X = _x;
                client.Interaction.Target.Character.Y = _y;
                client.Interaction.Packet.Parameter = movement.Direction % 8;
                client.Interaction.Packet.X = _x;
                client.Interaction.Packet.Y = _y;
                client.Interaction.Target.Interaction.Packet.Parameter = movement.Direction % 8;
                client.Interaction.Target.Interaction.Packet.X = _x;
                client.Interaction.Target.Interaction.Packet.Y = _y;
            }

            #region Screen Checks
            Packets.HoldingHands hands = new Packets.HoldingHands((byte)movement.Direction, (byte)movement.Speed);
            if (client.Interaction != null)
            {
                hands.Identity = client.Identity;
                hands.Target = client.Interaction.Target.Identity;
                client.Send(hands.Buffer);
            }
            else
                client.Send(movement.ToArray());

            foreach (World.Client other in client.Map.Players.Values)
                if (client.Identity != other.Identity)
                    if (Kernel.InScreen(_x, _y, other.Character.X, other.Character.Y))
                    {
                        if (!other.Screen.InScreen.ContainsKey(client.Identity))
                        {
                            client.Character.SendSpawn(other);
                            other.Character.SendSpawn(client);
                            if (client.Interaction != null)
                            {
                                other.Character.SendSpawn(client.Interaction.Target);
                                client.Interaction.Target.Character.SendSpawn(other);
                            }
                        }
                        else
                        {
                            if (client.Interaction != null)
                                other.Send(hands.Buffer);
                            else
                                other.Send(movement.ToArray());
                        }
                    }
                    else if (client.Screen.InScreen.ContainsKey(other.Identity))
                    {
                        if (!Kernel.InScreen(_x, _y, other.Character.X, other.Character.Y))
                        {
                            if (client.Interaction != null)
                                other.Send(hands.Buffer);
                            else
                                other.Send(movement.ToArray());
                            other.Screen.Remove(client.Character, false);
                            client.Screen.Remove(other.Character, false);
                            if (client.Interaction != null)
                            {
                                client.Interaction.Target.Screen.Remove(other.Character, false);
                                other.Screen.Remove(client.Interaction.Target.Character, false);
                            }
                        }
                    }
            foreach (Packets.NpcSpawn npc in client.Map.Npcs.Values)
                if (Kernel.InScreen(npc.X, npc.Y, _x, _y))
                {
                    if (client.Screen.Add(npc))
                        client.Send(npc.ToArray());
                }
                else
                    client.Screen.Remove(npc, false);
            foreach (Interfaces.iMapObject obj in client.Map.FloorItems.Values)
                if (Kernel.InScreen(obj.X, obj.Y, _x, _y))
                {
                    if (client.Screen.Add(obj))
                        client.Send(obj.ToArray());
                }
                else if (Kernel.ObjOutScreen(obj.X, obj.Y, _x, _y))
                    client.Screen.Remove(obj, false);
            #endregion
        }
        public static void Ride(Packets.Movement movement, World.Client client)
        {
            client.Character.Direction = (byte)(movement.Direction % 8);
            client.Character.Action = 0;

            ushort _x = client.Character.X;
            ushort _y = client.Character.Y;
            _x += (ushort)(_walkXCoords[movement.Direction % 24]);
            _y += (ushort)(_walkYCoords[movement.Direction % 24]);

            if (client.Map.Floor[_x, _y] < Enums.Tile.Available)
            {
                client.Character.Teleport(client.Character.MapId, client.Character.X, client.Character.Y);
                return;
            }
            client.Send(movement.ToArray());

            #region Screen Checks
            foreach (World.Client other in client.Map.Players.Values)
                if (client.Identity != other.Identity)
                    if (Kernel.InScreen(_x, _y, other.Character.X, other.Character.Y))
                    {
                        if (!other.Screen.InScreen.ContainsKey(client.Identity))
                        {
                            client.Character.SendSpawn(other, _x, _y);
                            other.Character.SendSpawn(client);
                        }
                        else
                            other.Send(movement.ToArray());
                    }
                    else if (client.Screen.InScreen.ContainsKey(other.Identity))
                    {
                        if (!Kernel.InScreen(_x, _y, other.Character.X, other.Character.Y))
                        {
                            other.Send(movement.ToArray());
                            other.Screen.Remove(client.Character, false);
                            client.Screen.Remove(other.Character, false);
                        }
                    }
            foreach (Packets.NpcSpawn npc in client.Map.Npcs.Values)
                if (Kernel.InScreen(npc.X, npc.Y, _x, _y))
                {
                    if (client.Screen.Add(npc))
                        client.Send(npc.ToArray());
                }
                else
                    client.Screen.Remove(npc, false);
            foreach (Interfaces.iMapObject obj in client.Map.FloorItems.Values)
                if (Kernel.InScreen(obj.X, obj.Y, _x, _y))
                {
                    if (client.Screen.Add(obj))
                        client.Send(obj.ToArray());
                }
                else if (Kernel.ObjOutScreen(obj.X, obj.Y, _x, _y))
                    client.Screen.Remove(obj, false);
            #endregion

            client.Character.X = _x;
            client.Character.Y = _y;
        }
        public static void Jump(Packets.GeneralAction action, World.Client client)
        {
            try
            {
                if (Kernel.GetDistance(action.Value1, action.Value2, action.X, action.Y) <= 18)
                {
                    client.Character.Action = 0;

                    if (client.Map.Floor[action.Value1, action.Value2] < Enums.Tile.Available)
                    {
                        client.Character.Teleport(client.Character.MapId, action.X, action.Y);
                        return;
                    }
                    client.Send(action.ToArray());

                    #region Direction
                    double Θ = Kernel.GetAngle(action.Value1, action.Value2, action.X, action.Y);
                    byte direction = 0;
                    if (Θ >= -25 && Θ < 25)
                        direction = 6;
                    else if (Θ >= 25 && Θ < 70)
                        direction = 7;
                    else if (Θ >= 70 && Θ < 110)
                        direction = 0;
                    else if (Θ >= 110 && Θ < 160)
                        direction = 1;
                    else if (Θ >= 160 && Θ < 200)
                        direction = 2;
                    else if (Θ >= 200 && Θ < 245)
                        direction = 3;
                    else if (Θ >= 245 || Θ < -60)
                        direction = 4;
                    else
                        direction = 5;
                    client.Character.Direction = direction;
                    if (client.Interaction != null)
                    {
                        client.Interaction.Target.Character.Direction = direction;
                        client.Interaction.Packet.Parameter = direction;
                        client.Interaction.Target.Interaction.Packet.Parameter = direction;
                    }
                    #endregion

                    #region Screen Checks
                    Packets.HoldingHands hands = new Packets.HoldingHands(action.Value1, action.Value2);
                    if (client.Interaction != null)
                    {
                        hands.Identity = client.Identity;
                        hands.Target = client.Interaction.Target.Identity;
                        client.Send(hands.Buffer);
                    }

                    foreach (World.Client other in client.Map.Players.Values)
                        if (client.Identity != other.Identity)
                            if (Kernel.InScreen(action.Value1, action.Value2, other.Character.X, other.Character.Y))
                            {
                                if (!other.Screen.InScreen.ContainsKey(client.Identity))
                                {
                                    Kernel.Vector v = Kernel.GetBorderCoords(client.Character.X, client.Character.Y, other.Character.X, other.Character.Y);
                                    client.Character.SendSpawn(other, v.X, v.Y);
                                    if (v.X != action.Value1 || v.Y != action.Value2)
                                        if (client.Interaction == null)
                                            other.Send(action.ToArray());
                                    other.Character.SendSpawn(client);
                                    if (client.Interaction != null)
                                    {
                                        other.Character.SendSpawn(client.Interaction.Target);
                                        client.Interaction.Target.Character.SendSpawn(other, v.X, v.Y);
                                    }
                                }
                                else
                                {
                                    if (client.Interaction == null)
                                        other.Send(action.ToArray());
                                    else
                                        other.Send(hands.Buffer);
                                }
                            }
                            else if (client.Screen.InScreen.ContainsKey(other.Identity))
                            {
                                if (!Kernel.InScreen(action.Value1, action.Value2, other.Character.X, other.Character.Y))
                                {
                                    if (client.Interaction != null)
                                        other.Send(hands.Buffer);
                                    else
                                        other.Send(action.ToArray());
                                    client.Screen.Remove(other.Character, false);
                                    other.Screen.Remove(client.Character, false);
                                    if (client.Interaction != null)
                                    {
                                        client.Interaction.Target.Screen.Remove(other.Character, false);
                                        other.Screen.Remove(client.Interaction.Target.Character, false);
                                    }
                                }
                            }
                    foreach (Packets.NpcSpawn npc in client.Map.Npcs.Values)
                        if (Kernel.InScreen(npc.X, npc.Y, action.Value1, action.Value2))
                        {
                            if (client.Screen.Add(npc))
                                client.Send(npc.ToArray());
                        }
                        else
                            client.Screen.Remove(npc, false);
                    foreach (Interfaces.iMapObject obj in client.Map.FloorItems.Values)
                        if (Kernel.InScreen(obj.X, obj.Y, action.Value1, action.Value2))
                        {
                            if (client.Screen.Add(obj))
                                client.Send(obj.ToArray());
                        }
                        else if (Kernel.ObjOutScreen(obj.X, obj.Y, action.Value1, action.Value2))
                            client.Screen.Remove(obj, false);
                    #endregion

                    client.Character.X = action.Value1;
                    client.Character.Y = action.Value2;
                    if (client.Interaction != null)
                    {
                        client.Interaction.Packet.X = action.Value1;
                        client.Interaction.Packet.Y = action.Value2;
                        client.Interaction.Target.Interaction.Packet.X = action.Value1;
                        client.Interaction.Target.Interaction.Packet.Y = action.Value2;
                        client.Interaction.Target.Character.X = action.Value1;
                        client.Interaction.Target.Character.Y = action.Value2;
                        client.Interaction.Target.Character.Action = 0;
                    }
                }
                else
                    client.Disconnect();
            }
            catch (Exception e) { Program.WriteLine(e); client.Character.Teleport(client.Character.MapId, action.X, action.Y); }
        }
    }
}
Packet Handler:
Code:
#region 1022 - Interactions & Attacks
                    case 1022:
                        Interaction atk = new Interaction(buffer);
                        switch (atk.Action)
                        {
                            #region [46] Request Interaction
                            case 46:
                                foreach (Interfaces.iMapObject other in client.Screen.InScreen.Values)
                                    if (other.Identity == atk.Target)
                                        if (other.EntityFlag == World.Entity.FlagEnum.Player)
                                            other.Owner.Send(buffer);
                                break;
                            #endregion
                            #region [47] Accept Interaction
                            case 47:
                                foreach (Interfaces.iMapObject other in client.Screen.InScreen.Values)
                                    if (other.Identity == atk.Target)
                                        if (other.EntityFlag == World.Entity.FlagEnum.Player)
                                            other.Owner.Send(buffer);
                                client.Send(buffer);
                                break;
                            #endregion
                            #region [48] Reject Interaction
                            case 48:
                                foreach (Interfaces.iMapObject other in client.Screen.InScreen.Values)
                                    if (other.Identity == atk.Target)
                                        if (other.EntityFlag == World.Entity.FlagEnum.Player)
                                            other.Owner.Send(buffer);
                                break;
                            #endregion
                            #region [49] Start Interaction
                            case 49:
                                foreach (Interfaces.iMapObject other in client.Screen.InScreen.Values)
                                    if (other.EntityFlag == World.Entity.FlagEnum.Player)
                                        if (other.Identity == atk.Target)
                                        {
                                            client.Interaction = new World.Interaction(client, other.Owner, atk.Effect, true);
                                            atk.Identity = client.Identity;
                                            atk.Target = other.Identity;
                                            other.Owner.Send(buffer);
                                            client.Send(atk.ToArray());
                                            atk.Identity = other.Identity;
                                            atk.Target = client.Identity;
                                            client.Send(atk.ToArray());
                                            other.Owner.Send(atk.ToArray());
                                        }
                                        else
                                        {
                                            other.Owner.Send(buffer);
                                            atk.Identity = atk.Target;
                                            atk.Target = atk.Identity;
                                            other.Owner.Send(atk.ToArray());
                                        }
                                break;
                            #endregion
                            #region [50] Stop Interaction
                            case 50:
                                client.Interaction.Dispose();
                                client.Interaction = null;
                                foreach (Interfaces.iMapObject other in client.Screen.InScreen.Values)
                                    if (other.EntityFlag == World.Entity.FlagEnum.Player)
                                        if (other.Identity == atk.Target)
                                        {
                                            atk.Identity = client.Identity;
                                            atk.Target = other.Identity;
                                            other.Owner.Send(buffer);
                                            client.Send(atk.ToArray());
                                            atk.Identity = other.Identity;
                                            atk.Target = client.Identity;
                                            client.Send(atk.ToArray());
                                            other.Owner.Send(atk.ToArray());
                                        }
                                        else
                                        {
                                            other.Owner.Send(buffer);
                                            atk.Identity = atk.Target;
                                            atk.Target = atk.Identity;
                                            other.Owner.Send(atk.ToArray());
                                        }
                                break;
                            #endregion

                            default:
                                Report("1022 [Interaction]", atk.Action);
                                break; 
                        }
                        break;
                    #endregion
Don't forget about disconnecting characters...
Code:
if (client.Interaction != null)
                    {
                        client.Interaction.Packet.Action = 50;
                        PacketHandler.Handle(client, client.Interaction.Packet.ToArray());
                    }
Code:
public const uint 
            PureKiss = 100002,
            HoldHands = 100004,
            Hug = 100005;
Ask me how to implement any of this.
I dare you. ._. *shot gun ready*

Sincerely,
Fang

PS: None of this will work in any source known to this community
unless you code it for your own source.
08/10/2011 08:01 agathom#2
bleeez man i dont know where to put this , i dont care if i get shot a Gun(shotgun)
08/10/2011 08:04 Spirited#3
Quote:
Originally Posted by agathom View Post
bleeez man i dont know where to put this , i dont care if i get shot a Gun(shotgun)
As I said in the other thread.
Put it up your ass.

Leave. This release isn't for people like you that are
too ignorant to code or even read my "ps" at the end.
08/10/2011 08:16 agathom#4
Quote:
Originally Posted by Fаng View Post
As I said in the other thread.
Put it up your ass.

Leave. This release isn't for people like you that are
too ignorant to code or even read my "ps" at the end.
Rickrolled! just kddin :) ,
08/10/2011 09:11 BaussHacker#5
Quote:
Originally Posted by agathom View Post
Rickrolled! just kddin :) ,
Lol @ Trolling is Rickrolled now. :rolleyes:
08/10/2011 13:02 ahmedtitoman#6
Quote:
namespace Kibou.Connections.Handlers
{
using System;

public static class MovementHandler
{
private static sbyte[] _walkXCoords = new sbyte[8] { 0, -1, -1, -1, 0, 1, 1, 1 };
private static sbyte[] _walkYCoords = new sbyte[8] { 1, 1, 0, -1, -1, -1, 0, 1 };

private static sbyte[] _rideXCoords = new sbyte[24] { 0, -2, -2, -2, 0, 2, 2, 2, -1, -2, -2, -1, 1, 2, 2, 1, -1, -2, -2, -1, 1, 2, 2, 1 };
private static sbyte[] _rideYCoords = new sbyte[24] { 2, 2, 0, -2, -2, -2, 0, 2, 2, 1, -1, -2, -2, -1, 1, 2, 2, 1, -1, -2, -2, -1, 1, 2 };

public static void Walk(Packets.Movement movement, World.Client client)
{
client.Character.Direction = (byte)(movement.Direction % 8);
client.Character.Action = 0;

ushort _x = client.Character.X;
ushort _y = client.Character.Y;
_x += (ushort)(_walkXCoords[movement.Direction % 8]);
_y += (ushort)(_walkYCoords[movement.Direction % 8]);

if (client.Map.Floor[_x, _y] < Enums.Tile.Available)
{
client.Character.Teleport(client.Character.MapId, client.Character.X, client.Character.Y);
return;
}

client.Character.X = _x;
client.Character.Y = _y;
if (client.Interaction != null)
{
client.Interaction.Target.Character.Direction = (byte)(movement.Direction % 8);
client.Interaction.Target.Character.Action = 0;
client.Interaction.Target.Character.X = _x;
client.Interaction.Target.Character.Y = _y;
client.Interaction.Packet.Parameter = movement.Direction % 8;
client.Interaction.Packet.X = _x;
client.Interaction.Packet.Y = _y;
client.Interaction.Target.Interaction.Packet.Param eter = movement.Direction % 8;
client.Interaction.Target.Interaction.Packet.X = _x;
client.Interaction.Target.Interaction.Packet.Y = _y;
}

#region Screen Checks
Packets.HoldingHands hands = new Packets.HoldingHands((byte)movement.Direction, (byte)movement.Speed);
if (client.Interaction != null)
{
hands.Identity = client.Identity;
hands.Target = client.Interaction.Target.Identity;
client.Send(hands.Buffer);
}
else
client.Send(movement.ToArray());

foreach (World.Client other in client.Map.Players.Values)
if (client.Identity != other.Identity)
if (Kernel.InScreen(_x, _y, other.Character.X, other.Character.Y))
{
if (!other.Screen.InScreen.ContainsKey(client.Identit y))
{
client.Character.SendSpawn(other);
other.Character.SendSpawn(client);
if (client.Interaction != null)
{
other.Character.SendSpawn(client.Interaction.Targe t);
client.Interaction.Target.Character.SendSpawn(othe r);
}
}
else
{
if (client.Interaction != null)
other.Send(hands.Buffer);
else
other.Send(movement.ToArray());
}
}
else if (client.Screen.InScreen.ContainsKey(other.Identity ))
{
if (!Kernel.InScreen(_x, _y, other.Character.X, other.Character.Y))
{
if (client.Interaction != null)
other.Send(hands.Buffer);
else
other.Send(movement.ToArray());
other.Screen.Remove(client.Character, false);
client.Screen.Remove(other.Character, false);
if (client.Interaction != null)
{
client.Interaction.Target.Screen.Remove(other.Char acter, false);
other.Screen.Remove(client.Interaction.Target.Char acter, false);
}
}
}
foreach (Packets.NpcSpawn npc in client.Map.Npcs.Values)
if (Kernel.InScreen(npc.X, npc.Y, _x, _y))
{
if (client.Screen.Add(npc))
client.Send(npc.ToArray());
}
else
client.Screen.Remove(npc, false);
foreach (Interfaces.iMapObject obj in client.Map.FloorItems.Values)
if (Kernel.InScreen(obj.X, obj.Y, _x, _y))
{
if (client.Screen.Add(obj))
client.Send(obj.ToArray());
}
else if (Kernel.ObjOutScreen(obj.X, obj.Y, _x, _y))
client.Screen.Remove(obj, false);
#endregion
}
public static void Ride(Packets.Movement movement, World.Client client)
{
client.Character.Direction = (byte)(movement.Direction % 8);
client.Character.Action = 0;

ushort _x = client.Character.X;
ushort _y = client.Character.Y;
_x += (ushort)(_walkXCoords[movement.Direction % 24]);
_y += (ushort)(_walkYCoords[movement.Direction % 24]);

if (client.Map.Floor[_x, _y] < Enums.Tile.Available)
{
client.Character.Teleport(client.Character.MapId, client.Character.X, client.Character.Y);
return;
}
client.Send(movement.ToArray());

#region Screen Checks
foreach (World.Client other in client.Map.Players.Values)
if (client.Identity != other.Identity)
if (Kernel.InScreen(_x, _y, other.Character.X, other.Character.Y))
{
if (!other.Screen.InScreen.ContainsKey(client.Identit y))
{
client.Character.SendSpawn(other, _x, _y);
other.Character.SendSpawn(client);
}
else
other.Send(movement.ToArray());
}
else if (client.Screen.InScreen.ContainsKey(other.Identity ))
{
if (!Kernel.InScreen(_x, _y, other.Character.X, other.Character.Y))
{
other.Send(movement.ToArray());
other.Screen.Remove(client.Character, false);
client.Screen.Remove(other.Character, false);
}
}
foreach (Packets.NpcSpawn npc in client.Map.Npcs.Values)
if (Kernel.InScreen(npc.X, npc.Y, _x, _y))
{
if (client.Screen.Add(npc))
client.Send(npc.ToArray());
}
else
client.Screen.Remove(npc, false);
foreach (Interfaces.iMapObject obj in client.Map.FloorItems.Values)
if (Kernel.InScreen(obj.X, obj.Y, _x, _y))
{
if (client.Screen.Add(obj))
client.Send(obj.ToArray());
}
else if (Kernel.ObjOutScreen(obj.X, obj.Y, _x, _y))
client.Screen.Remove(obj, false);
#endregion

client.Character.X = _x;
client.Character.Y = _y;
}
public static void Jump(Packets.GeneralAction action, World.Client client)
{
try
{
if (Kernel.GetDistance(action.Value1, action.Value2, action.X, action.Y) <= 18)
{
client.Character.Action = 0;

if (client.Map.Floor[action.Value1, action.Value2] < Enums.Tile.Available)
{
client.Character.Teleport(client.Character.MapId, action.X, action.Y);
return;
}
client.Send(action.ToArray());

#region Direction
double Θ = Kernel.GetAngle(action.Value1, action.Value2, action.X, action.Y);
byte direction = 0;
if (Θ >= -25 && Θ < 25)
direction = 6;
else if (Θ >= 25 && Θ < 70)
direction = 7;
else if (Θ >= 70 && Θ < 110)
direction = 0;
else if (Θ >= 110 && Θ < 160)
direction = 1;
else if (Θ >= 160 && Θ < 200)
direction = 2;
else if (Θ >= 200 && Θ < 245)
direction = 3;
else if (Θ >= 245 || Θ < -60)
direction = 4;
else
direction = 5;
client.Character.Direction = direction;
if (client.Interaction != null)
{
client.Interaction.Target.Character.Direction = direction;
client.Interaction.Packet.Parameter = direction;
client.Interaction.Target.Interaction.Packet.Param eter = direction;
}
#endregion

#region Screen Checks
Packets.HoldingHands hands = new Packets.HoldingHands(action.Value1, action.Value2);
if (client.Interaction != null)
{
hands.Identity = client.Identity;
hands.Target = client.Interaction.Target.Identity;
client.Send(hands.Buffer);
}

foreach (World.Client other in client.Map.Players.Values)
if (client.Identity != other.Identity)
if (Kernel.InScreen(action.Value1, action.Value2, other.Character.X, other.Character.Y))
{
if (!other.Screen.InScreen.ContainsKey(client.Identit y))
{
Kernel.Vector v = Kernel.GetBorderCoords(client.Character.X, client.Character.Y, other.Character.X, other.Character.Y);
client.Character.SendSpawn(other, v.X, v.Y);
if (v.X != action.Value1 || v.Y != action.Value2)
if (client.Interaction == null)
other.Send(action.ToArray());
other.Character.SendSpawn(client);
if (client.Interaction != null)
{
other.Character.SendSpawn(client.Interaction.Targe t);
client.Interaction.Target.Character.SendSpawn(othe r, v.X, v.Y);
}
}
else
{
if (client.Interaction == null)
other.Send(action.ToArray());
else
other.Send(hands.Buffer);
}
}
else if (client.Screen.InScreen.ContainsKey(other.Identity ))
{
if (!Kernel.InScreen(action.Value1, action.Value2, other.Character.X, other.Character.Y))
{
if (client.Interaction != null)
other.Send(hands.Buffer);
else
other.Send(action.ToArray());
client.Screen.Remove(other.Character, false);
other.Screen.Remove(client.Character, false);
if (client.Interaction != null)
{
client.Interaction.Target.Screen.Remove(other.Char acter, false);
other.Screen.Remove(client.Interaction.Target.Char acter, false);
}
}
}
foreach (Packets.NpcSpawn npc in client.Map.Npcs.Values)
if (Kernel.InScreen(npc.X, npc.Y, action.Value1, action.Value2))
{
if (client.Screen.Add(npc))
client.Send(npc.ToArray());
}
else
client.Screen.Remove(npc, false);
foreach (Interfaces.iMapObject obj in client.Map.FloorItems.Values)
if (Kernel.InScreen(obj.X, obj.Y, action.Value1, action.Value2))
{
if (client.Screen.Add(obj))
client.Send(obj.ToArray());
}
else if (Kernel.ObjOutScreen(obj.X, obj.Y, action.Value1, action.Value2))
client.Screen.Remove(obj, false);
#endregion

client.Character.X = action.Value1;
client.Character.Y = action.Value2;
if (client.Interaction != null)
{
client.Interaction.Packet.X = action.Value1;
client.Interaction.Packet.Y = action.Value2;
client.Interaction.Target.Interaction.Packet.X = action.Value1;
client.Interaction.Target.Interaction.Packet.Y = action.Value2;
client.Interaction.Target.Character.X = action.Value1;
client.Interaction.Target.Character.Y = action.Value2;
client.Interaction.Target.Character.Action = 0;
}
}
else
client.Disconnect();
}
catch (Exception e) { Program.WriteLine(e); client.Character.Teleport(client.Character.MapId, action.X, action.Y); }
}
}
}
}

where are put this ??? plz man
08/10/2011 14:04 teroareboss1#7
Quote:
Originally Posted by ahmedtitoman View Post
where are put this ??? plz man
is Movement packet

packetHandler case 10005:
08/10/2011 14:38 ahmedtitoman#8
please upload packets 5519
08/11/2011 15:14 F i n c h i#9
Get a life egys, as Fang said, put it up your asses.

Thanks Fang <3
08/13/2011 19:49 oshrib#10
5375?
08/17/2011 10:31 Crazy_XX#11
Thanks Fang
09/30/2011 09:55 florin2012#12
if (client.Interaction != null)
{
client.Interaction.Packet.Action = 50;
PacketHandler.Handle(client, client.Interaction.Packet.ToArray());
}


Where add this, please anyone give me guide
09/30/2011 22:05 diedwarrior#13
Quote:
Originally Posted by florin2012 View Post
if (client.Interaction != null)
{
client.Interaction.Packet.Action = 50;
PacketHandler.Handle(client, client.Interaction.Packet.ToArray());
}


Where add this, please anyone give me guide
Dont bother adding 'em, as fang said they're not working on any known source (which you prolly have since you dont know where to add that).

i fixed em for the public 5375 source, might public it soon also.
10/01/2011 09:08 Spirited#14
Quote:
Originally Posted by diedwarrior View Post
Dont bother adding 'em, as fang said they're not working on any known source (which you prolly have since you dont know where to add that).

i fixed em for the public 5375 source, might public it soon also.
I'd rather have only the people that can WORK for it own it.
That's why I released it like that.
10/01/2011 09:32 JobvdH#15
Great work!!