Пример #1
0
 private bool ServerMessage_0x36_Users(Client client, ServerPacket msg)
 {
     try
     {
         msg.ReadUInt16();
         ushort num1 = msg.ReadUInt16();
         for (int index = 0; index < (int)num1; ++index)
         {
             int num2 = (int)msg.ReadByte();
             int num3 = (int)msg.ReadByte();
             int num4 = (int)msg.ReadByte();
             msg.ReadString8();
             msg.ReadByte();
             string str = msg.ReadString8();
             if (!client.Base.UsersOnline.ContainsKey(str.ToLower()))
             {
                 client.Base.UsersOnline.Add(str.ToLower(), new User()
                 {
                     Name = str
                 });
             }
             else
             {
                 client.Base.UsersOnline[str.ToLower()].Name = str;
             }
         }
         return(true);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message + "\n" + ex.StackTrace);
         return(false);
     }
 }
Пример #2
0
        private bool ServerMessage_0x0A_BarMessages(Client client, ServerPacket msg)
        {
            try
            {
                byte type = msg.ReadByte();
                msg.ReadByte();
                string str1 = msg.ReadString8();
                if (str1 == "That doesn't work here.")
                {
                    client.Base.Me.CanCastHere = false;
                }
                if (str1.ToLower().Contains("ao sith"))
                {
                    client.Base.SpellBar.Clear();
                }
                if (str1.Contains("n:Necklace:"))
                {
                    string str2 = str1.Replace("n:Necklace:", string.Empty);
                    client.Base.LightNeck = str2.Contains("Light Necklace");
                    client.Base.OmniNeck  = str2.Contains("Omni");
                }
                if (client != null)
                {
                    // if (client.clientbox.RunningScript != null)
                    //    client.clientbox.RunningScript.OnMessage(str1);
                    client.Base.BarMessages.Add(new BarMessage(type, str1));
                }
                if ((int)type == 3)
                {
                    switch (str1)
                    {
                    case "Poison":
                        if (client != null)
                        {
                            client.Base.Me.Poisoned = true;
                            break;
                        }
                        break;

                    case "You feel better.":
                        if (client != null)
                        {
                            client.Base.Me.Poisoned = false;
                            break;
                        }
                        break;
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "\n" + ex.StackTrace);
                return(false);
            }
        }
Пример #3
0
        private bool ServerMessage_0x37_EquipAppendage(Client client, ServerPacket msg)
        {
            byte byte1 = msg.ReadByte();

            if ((int)byte1 == 1)
            {
                int    num1           = msg.ReadInt32();
                string appendageAdded = msg.ReadString8();
                client.Base.CurrentStaffName = appendageAdded;
            }
            //client.Base.IsCasting = false;
            return(true);
        }
Пример #4
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);
            }
        }
Пример #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_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);
        }
Пример #7
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);
     }
 }
Пример #8
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);
            }
        }