Пример #1
0
        private bool ServerMessage_0x0B_ClientWalk(Client client, ServerPacket msg)
        {
            try
            {
                client.ShouldUpdateMap = true;
                byte   num1 = msg.ReadByte();
                ushort num2 = msg.ReadUInt16();
                ushort num3 = msg.ReadUInt16();
                client.Base.MyServerPosition = new Location()
                {
                    Facing = (Direction)num1,
                    X      = num2,
                    Y      = num3
                };
                switch (num1)
                {
                case (byte)0:
                    --client.Base.MyServerPosition.Y;
                    break;

                case (byte)1:
                    ++client.Base.MyServerPosition.X;
                    break;

                case (byte)2:
                    ++client.Base.MyServerPosition.Y;
                    break;

                case (byte)3:
                    --client.Base.MyServerPosition.X;
                    break;
                }
                client.Base.MyPosition.Facing = (Direction)num1;
                return(true);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "\n" + ex.StackTrace);
                return(false);
            }
        }
Пример #2
0
 private bool ServerMessage_0x04_LocationUpdated(Client client, ServerPacket msg)
 {
     try
     {
         client.ShouldUpdateMap   = true;
         client.Base.LoggedIn     = true;
         client.Base.LastLoggedIn = DateTime.Now;
         ushort num1 = msg.ReadUInt16();
         ushort num2 = msg.ReadUInt16();
         client.Base.MyServerPosition.X = num1;
         client.Base.MyServerPosition.Y = num2;
         client.Base.MyPosition.X       = num1;
         client.Base.MyPosition.X       = num1;
         return(true);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message + "\n" + ex.StackTrace);
         return(false);
     }
 }
Пример #3
0
        private bool ServerMessage_0x15_MapInfo(Client client, ServerPacket msg)
        {
            try //changes
            {
                int  key    = (int)msg.ReadUInt16();
                int  num1   = (int)msg.ReadByte();
                int  num2   = (int)msg.ReadByte();
                byte num3   = msg.ReadByte();
                int  width  = num1 | (int)msg.ReadByte() << 8;
                int  height = num2 | (int)msg.ReadByte() << 8;
                msg.ReadUInt16();
                msg.ReadString((int)msg.ReadByte());
                client.Base.LastTarget = (Entity)null;
                client.Base.Animations.Clear();
                client.Base.Entitys.Clear();
                //if ((int)num3 == 3 || (int)num3 == 64)
                //    msg.BodyData[6] = (byte)0;
                client.Base.DaMap         = new Map(client.Tab, (short)key, width, height);
                client.Base.LastRefreshed = DateTime.Now;
                if (!client.Base.Waypoints.ContainsKey(key))
                {
                    client.Base.Waypoints.Add(key, new List <Location>());
                }
                client.Base.Entitys.Clear();
                client.Tab.walkingLocation = null;
                //client.Base.Players.Clear();
                if (client.LastMap != key)
                {
                    client.ShouldUpdateMap = true;
                    client.LastMap         = key;
                }

                return(true);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "\n" + ex.StackTrace);
                return(false);
            }
        }
Пример #4
0
 private bool ServerMessage_0x13_SpriteHPBar(Client client, ServerPacket msg)
 {
     try
     {
         uint key  = msg.ReadUInt32();
         int  num1 = (int)msg.ReadByte();
         byte num2 = msg.ReadByte();
         msg.ReadByte();
         if (client.Base.Entitys.ContainsKey(key))
         {
             client.Base.Entitys[key].LastAttacked = DateTime.Now;
             ++client.Base.Entitys[key].TimesHit;
             client.Base.Entitys[key].HPPercent = num2;
             if ((int)num2 <= 40)
             {
                 client.Base.Entitys[key].LowHpTime = DateTime.Now;
             }
             client.Base.BodySwings = 0;
         }
         if (client.Base.Aislings.ContainsKey(key))
         {
             client.Base.Aislings[key].LastAttacked = DateTime.Now;
             ++client.Base.Aislings[key].TimesHit;
             client.Base.Aislings[key].HPPercent = num2;
             if ((int)num2 <= 40)
             {
                 client.Base.Aislings[key].LowHpTime = DateTime.Now;
             }
             client.Base.BodySwings = 0;
         }
         return(true);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message + "\n" + ex.StackTrace);
         return(false);
     }
 }
Пример #5
0
 private bool ServerMessage_0x2C_SkillAdded(Client client, ServerPacket msg)
 {
     try
     {
         byte   _slot = msg.ReadByte();
         ushort _icon = msg.ReadUInt16();
         string index = msg.ReadString8();
         if (!client.Base.Skills.ContainsKey(index))
         {
             client.Base.Skills.Add(index, new SKill(index, _slot, _icon));
         }
         else
         {
             client.Base.Skills[index].Slot = _slot;
         }
         return(true);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message + "\n" + ex.StackTrace);
         return(false);
     }
 }
Пример #6
0
        public bool ServerMessage_0x05_PlayerID(Client client, ServerPacket msg)
        {
            try
            {
                uint Serial = msg.ReadUInt32();
                client.Base.Serial = Serial;
                client.Base.Me     = new Aisling()
                {
                    Name     = "noname",
                    Position = new Location(),
                    Serial   = Serial
                };

                Form.AddTab(client.Tab);

                return(true);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "\n" + ex.StackTrace);
                return(false);
            }
        }
Пример #7
0
        public bool ServerMessage_0x03_Redirect(Client client, ServerPacket msg)
        {
            var address = msg.Read(4);
            var port    = msg.ReadUInt16();
            var length  = msg.ReadByte();
            var seed    = msg.ReadByte();
            var key     = msg.Read(msg.ReadByte());
            var name    = msg.ReadString8();
            var id      = msg.ReadUInt32();

            Array.Reverse(address);
            RemoteEndPoint = new IPEndPoint(new IPAddress(address), port);

            msg.Data[0] = 0x01;
            msg.Data[1] = 0x00;
            msg.Data[2] = 0x00;
            msg.Data[3] = 0x7F;

            msg.Data[4] = 0x0A;
            msg.Data[5] = 0x32;

            return(true);
        }
Пример #8
0
        private bool ServerMessage_0x17_SpellSlotAdded(Client client, ServerPacket msg)
        {
            try
            {
                byte slot = msg.ReadByte();
                msg.ReadUInt16();
                msg.ReadByte();
                string index = msg.ReadString8();
                msg.ReadString8();
                byte lines = msg.ReadByte();
                if (index.Contains("ard cradh") || index.Contains("ard ioc") || index.Contains("mor dion"))
                {
                    client.Base.Caster = true;
                }
                SpellType spellType = (int)slot > 36 ? ((int)slot > 72 ? SpellType.Common : SpellType.Medenia) : SpellType.Temuair;
                if (!client.Base.Spells.ContainsKey(index))
                {
                    client.Base.Spells.Add(index, new Spell(index, slot, lines)
                    {
                        type = spellType
                    });
                }
                else
                {
                    client.Base.Spells[index].Lines = lines;
                }

                /*does it update the lines as you change your staff?
                 * IE: will it say all spells are one line if we have a rod of ages equipped? must check*/
                return(true);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "\n" + ex.StackTrace);
                return(false);
            }
        }
Пример #9
0
 private bool ServerMessage_0x0F_SItemAdded(Client client, ServerPacket msg)
 {
     try
     {
         Item obj = new Item()
         {
             Slot              = msg.ReadByte(),
             IconSet           = msg.ReadUInt16(),
             Icon              = msg.ReadByte(),
             Name              = msg.ReadString8(),
             Amount            = msg.ReadUInt32(),
             Stackable         = msg.ReadBoolean(),
             CurrentDurability = msg.ReadUInt32(),
             MaximumDurability = msg.ReadUInt32()
         };
         client.Base.Inventory.Add(obj);
         return(true);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message + "\n" + ex.StackTrace);
         return(false);
     }
 }
Пример #10
0
        private bool ServerMessage_0x10_SItemRemoved(Client client, ServerPacket msg)
        {
            try
            {
                byte slot = msg.ReadByte();
                Item obj  = client.Base.Inventory.Find((Predicate <Item>)(i => (int)i.Slot == (int)slot));

                if (obj != null)
                {
                    client.Base.Inventory.Remove(obj);
                    //if (client.Base.IsSwitchingItems)
                    //{
                    //client.Base.CurrentStaffName = obj.Name;
                    //client.SendMessage("Equipped " + client.Base.CurrentStaffName, (byte)0);
                    //}
                }
                return(true);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "\n" + ex.StackTrace);
                return(false);
            }
        }
Пример #11
0
        private bool ServerMessage_0x33_PlayerAdded(Client client, ServerPacket msg)
        {
            try
            {
                /*if ((int)msg.BodyData[10] == 0 && (int)msg.BodyData[11] == 0 && (int)msg.BodyData[12] == 0 && (int)msg.BodyData[13] == 0)
                 * {
                 *  msg.BodyData[10] = (byte)165;
                 *  msg.BodyData[11] = (byte)16;
                 *  msg.BodyData[12] = (byte)0;
                 *  msg.BodyData[13] = (byte)177;
                 * }*/
                try
                {
                    ushort num1 = msg.ReadUInt16();
                    ushort num2 = msg.ReadUInt16();
                    byte   num3 = msg.ReadByte();
                    uint   key  = msg.ReadUInt32();
                    msg.ReadUInt16();
                    int num4 = (int)msg.ReadUInt16();
                    int num5 = (int)msg.ReadUInt32();
                    msg.ReadByte();
                    ushort num6 = msg.ReadUInt16();
                    msg.ReadByte();
                    int num7 = (int)msg.ReadByte();
                    msg.ReadUInt16();
                    int num8 = (int)msg.ReadInt16();
                    msg.ReadUInt16();
                    int num9 = (int)msg.ReadUInt32();
                    msg.ReadByte();
                    msg.ReadUInt16();
                    int num10 = (int)msg.ReadUInt16();
                    msg.ReadByte();
                    int    num11 = (int)msg.ReadUInt16();
                    string str   = msg.ReadString8();
                    msg.ReadString8();
                    if (string.IsNullOrEmpty(str))
                    {
                        str = "f****t";
                    }

                    if (client.Base.Aislings[client.Base.Serial].Position.X != num1 || client.Base.Aislings[client.Base.Serial].Position.Y != num2)
                    {
                        client.ShouldUpdateMap = true;
                    }
                    //add players to onscreen players array
                    if ((int)client.Base.Serial == (int)key)
                    {
                        client.Base.Me.Name     = str;
                        client.Base.Me.Position = new Location()
                        {
                            X = num1,
                            Y = num2
                        };
                        client.Base.CurrentStaffID    = num6;
                        client.Base.MyPosition.X      = num1;
                        client.Base.MyPosition.Y      = num2;
                        client.Base.MyPosition.Facing = (Direction)num3;
                    }
                    else if (!client.Base.Entitys.ContainsKey(key))
                    {
                        client.Base.Entitys.Add(key, new Aisling()
                        {
                            Name     = str,
                            Position = new Location()
                            {
                                Facing = (Direction)num3,
                                X      = num1,
                                Y      = num2,
                            },
                            Serial = key,
                            Map    = client.Base.DaMap.Number
                        });
                    }
                    else
                    {
                        client.Base.Entitys[key].Name     = str;
                        client.Base.Entitys[key].Position = new Location()
                        {
                            X      = num1,
                            Y      = num2,
                            Facing = (Direction)num3
                        };
                        client.Base.Entitys[key].Map = client.Base.DaMap.Number;
                    }

                    /*else if (!client.Base.Players.ContainsKey(key))
                     * {
                     *  client.Base.Players.Add(key, new Aisling()
                     *  {
                     *      Name = str,
                     *      Position = new Location()
                     *      {
                     *          Facing = (Direction)num3,
                     *          X = num1,
                     *          Y = num2
                     *      },
                     *      Serial = key
                     *  });
                     * }
                     * else
                     * {
                     *  client.Base.Players[key].Name = str;
                     *  client.Base.Players[key].Position = new Location()
                     *  {
                     *      X = num1,
                     *      Y = num2,
                     *      Facing = (Direction)num3
                     *  };
                     * }*/
                    //add players to lasting seen players array
                    if (!client.Base.Aislings.ContainsKey(key))
                    {
                        client.Base.Aislings.Add(key, new Aisling()
                        {
                            Name     = str,
                            Position = new Location()
                            {
                                Facing = (Direction)num3,
                                X      = num1,
                                Y      = num2
                            },
                            Serial = key,
                            Map    = client.Base.DaMap.Number
                        });
                    }
                    else
                    {
                        client.Base.Aislings[key].Name     = str;
                        client.Base.Aislings[key].Position = new Location()
                        {
                            X      = num1,
                            Y      = num2,
                            Facing = (Direction)num3
                        };
                        client.Base.Aislings[key].Map = client.Base.DaMap.Number;
                        if (client.Base.Aislings[key].Map == client.Base.Aislings[key].lastMap)
                        {
                            client.Base.Aislings[key].lastMap = -1;
                        }
                    }
                }
                catch
                {
                    msg.Seek(0, PacketSeekOrigin.Begin);
                    ushort num1 = msg.ReadUInt16();
                    ushort num2 = msg.ReadUInt16();
                    byte   num3 = msg.ReadByte();
                    uint   key  = msg.ReadUInt32();
                    if ((int)client.Base.Serial == (int)key)
                    {
                        client.Base.Me.Name     = "form";
                        client.Base.Me.Position = client.Base.MyPosition;
                    }

                    /*else if (!client.Base.Players.ContainsKey(key))
                     * {
                     *  client.Base.Players.Add(key, new Aisling()
                     *  {
                     *      Name = "form",
                     *      Position = new Location()
                     *      {
                     *          Facing = (Direction)num3,
                     *          X = num1,
                     *          Y = num2
                     *      },
                     *      Serial = key
                     *  });
                     * }
                     * else
                     * {
                     *  client.Base.Players[key].Name = "form";
                     *  client.Base.Players[key].Position = new Location()
                     *  {
                     *      X = num1,
                     *      Y = num2,
                     *      Facing = (Direction)num3
                     *  };
                     * }*/

                    else if (!client.Base.Entitys.ContainsKey(key))
                    {
                        client.Base.Entitys.Add(key, new Aisling()
                        {
                            Name     = "form",
                            Position = new Location()
                            {
                                Facing = (Direction)num3,
                                X      = num1,
                                Y      = num2
                            },
                            Serial = key,
                            Map    = client.Base.DaMap.Number
                        });
                    }
                    else
                    {
                        client.Base.Entitys[key].Name     = "form";
                        client.Base.Entitys[key].Position = new Location()
                        {
                            X      = num1,
                            Y      = num2,
                            Facing = (Direction)num3
                        };
                        client.Base.Entitys[key].Map = client.Base.DaMap.Number;
                    }
                    //add players to lasting seen players array
                    if (!client.Base.Aislings.ContainsKey(key))
                    {
                        client.Base.Aislings.Add(key, new Aisling()
                        {
                            Name     = "form",
                            Position = new Location()
                            {
                                Facing = (Direction)num3,
                                X      = num1,
                                Y      = num2
                            },
                            Serial = key,
                            Map    = client.Base.DaMap.Number
                        });
                    }
                    else
                    {
                        client.Base.Aislings[key].Name     = "form";
                        client.Base.Aislings[key].Position = new Location()
                        {
                            X      = num1,
                            Y      = num2,
                            Facing = (Direction)num3
                        };
                        client.Base.Aislings[key].Map = client.Base.DaMap.Number;
                        if (client.Base.Aislings[key].Map == client.Base.Aislings[key].lastMap)
                        {
                            client.Base.Aislings[key].lastMap = -1;
                        }
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "\n" + ex.StackTrace);
                return(false);
            }
        }
Пример #12
0
 private bool ServerMessage_0x08_StatsUpdated(Client client, ServerPacket msg)
 {
     try
     {
         Aisling aisling = client.Base.Me;
         byte    num1    = msg.ReadByte();
         if (((int)num1 & 32) == 32)
         {
             msg.Read(3);
             aisling.Level     = (int)msg.ReadByte();
             aisling.Ability   = (int)msg.ReadByte();
             aisling.MaximumHP = msg.ReadUInt32();
             aisling.MaximumMP = msg.ReadUInt32();
             aisling.Str       = (int)msg.ReadByte();
             aisling.Int       = (int)msg.ReadByte();
             aisling.Wis       = (int)msg.ReadByte();
             aisling.Con       = (int)msg.ReadByte();
             aisling.Dex       = (int)msg.ReadByte();
             bool flag = (int)msg.ReadByte() != 0;
             aisling.AvailablePoints = (int)msg.ReadByte();
             aisling.MaximumWeight   = (int)msg.ReadUInt16();
             aisling.CurrentWeight   = (int)msg.ReadUInt16();
             msg.Read(4);
         }
         if (((int)num1 & 16) == 16)
         {
             aisling.CurrentHP = msg.ReadUInt32();
             aisling.CurrentMP = msg.ReadUInt32();
         }
         if (((int)num1 & 8) == 8)
         {
             aisling.Experience    = msg.ReadUInt32();
             aisling.ToNextLevel   = msg.ReadUInt32();
             aisling.AbilityExp    = msg.ReadUInt32();
             aisling.ToNextAbility = msg.ReadUInt32();
             aisling.GamePoints    = msg.ReadUInt32();
             aisling.Gold          = msg.ReadUInt32();
         }
         if (((int)num1 & 4) == 4)
         {
             aisling.BitMask = (int)msg.ReadUInt16();
             int num2 = (int)msg.ReadByte();
             aisling.AttackElement2  = (int)msg.ReadByte();
             aisling.DefenseElement2 = (int)msg.ReadByte();
             aisling.AttackElement   = (Aisling.Elements)msg.ReadByte();
             aisling.DefenseElement  = (Aisling.Elements)msg.ReadByte();
             aisling.MagicResistance = (int)msg.ReadByte();
             aisling.ArmorClass      = (int)msg.ReadInt16();
             aisling.Damage          = (int)msg.ReadSByte();
             aisling.Hit             = (int)msg.ReadSByte();
         }
         if (aisling.BitMask == 8)
         {
             msg.Data[0] = (byte)0;
         }
         client.Base.Me = aisling;
         return(true);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message + "\n" + ex.StackTrace);
         return(false);
     }
 }
Пример #13
0
 private bool ServerMessage_0x38_RemovedAppendage(Client client, ServerPacket msg)
 {
     //byte playerItemSlot = msg.ReadByte();
     client.Base.IsCasting = false;
     return(true);
 }