Ejemplo n.º 1
0
        public static void PrivateItemPacket(PacketWriter Writer, int id, byte max, byte avatar, bool mspawn)
        {
            try
            {
                List<byte> slots = new List<byte>();
                Systems.MsSQL ms = new Systems.MsSQL("SELECT * FROM char_items WHERE owner='" + id + "' AND slot >= '0' AND slot <= '" + max + "' AND inavatar='" + avatar + "' AND storagetype='0' AND quantity='1'");
                using (SqlDataReader reader = ms.Read())
                {
                    int count = ms.Count();

                    Writer.Byte(count);

                    while (reader.Read())
                    {
                        byte slot       = reader.GetByte(5);
                        byte plusvalue  = reader.GetByte(4);
                        int itemid      = reader.GetInt32(2);

                        if (itemid != 0)
                        {
                            if (!slots.Exists(delegate(byte bk)
                            {
                                return bk == slot;
                            }))
                            {
                                slots.Add(slot);
                            }
                            Writer.DWord(itemid);
                            Writer.Byte(plusvalue);
                        }
                    }
                }
                ms.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Item Error : {0}", ex);
                Systems.Debugger.Write(ex);
            }
        }
Ejemplo n.º 2
0
        public static void PrivateItemPacket(PacketWriter Writer, int id, byte max, byte avatar, bool mspawn)
        {
            try
            {
                List <byte>   slots = new List <byte>();
                Systems.MsSQL ms    = new Systems.MsSQL("SELECT * FROM char_items WHERE owner='" + id + "' AND slot >= '0' AND slot <= '" + max + "' AND inavatar='" + avatar + "' AND storagetype='0' AND quantity='1'");
                using (SqlDataReader reader = ms.Read())
                {
                    int count = ms.Count();

                    Writer.Byte(count);

                    while (reader.Read())
                    {
                        byte slot      = reader.GetByte(5);
                        byte plusvalue = reader.GetByte(4);
                        int  itemid    = reader.GetInt32(2);

                        if (itemid != 0)
                        {
                            if (!slots.Exists(delegate(byte bk)
                            {
                                return(bk == slot);
                            }))
                            {
                                slots.Add(slot);
                            }
                            Writer.DWord(itemid);
                            Writer.Byte(plusvalue);
                        }
                    }
                }
                ms.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Item Error : {0}", ex);
                Systems.Debugger.Write(ex);
            }
        }
Ejemplo n.º 3
0
        public static byte[] GuildStorageData(character c)
        {
            Systems.MsSQL getstorage = new Systems.MsSQL("SELECT * FROM char_items WHERE guild_storage_id='" + c.Network.Guild.Guildid + "' AND storagetype='3'");
            int           itemcount  = getstorage.Count();
            PacketWriter  Writer     = new PacketWriter();

            Writer.Create(Systems.SERVER_GUILD_STORAGE3);
            Writer.Byte(c.Network.Guild.StorageSlots);
            Writer.Byte(itemcount);
            if (itemcount != 0)
            {
                using (System.Data.SqlClient.SqlDataReader reader = getstorage.Read())
                {
                    while (reader.Read())
                    {
                        Item.AddItemPacket(Writer, reader.GetByte(5), reader.GetInt32(2), reader.GetByte(4), reader.GetInt16(6), reader.GetInt32(7), reader.GetInt32(0), reader.GetInt32(9), reader.GetInt32(30));
                    }
                }
            }
            getstorage.Close();
            return(Writer.GetBytes());
        }
Ejemplo n.º 4
0
        public void LoginScreen()
        {
            try
            {
                PacketReader Reader = new PacketReader(PacketInformation.buffer);
                string name = Reader.Text();
                Reader.Close();
                #region Check name before entering (exploit)
                Systems.MsSQL ms = new Systems.MsSQL("SELECT name FROM character WHERE account='" + Player.AccountName + "' AND name='" + name + "'");
                int checkinfo = ms.Count();

                if (checkinfo == 0)
                {
                    return;
                }
                #endregion
                else
                {
                    Character = new character();

                    Character.Information.Name = name;
                    Character.Account.ID = Player.ID;
                    PlayerDataLoad();
                    LoadJobData();
                    checkSameChar(name, Character.Information.UniqueID);
                    CheckCharStats(Character);
                    clients.Add(this);
                    client.Send(Packet.LoginScreen());
                    client.Send(Packet.StartPlayerLoad());
                    client.Send(Packet.Load(Character));

                    client.Send(Packet.EndPlayerLoad());
                    client.Send(Packet.PlayerUnknowPack(Character.Information.UniqueID));
                    client.Send(Packet.UnknownPacket());

                    OpenTimer();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error login by: {0}",Character.Information.Name);
                deBug.Write(ex);
                Console.WriteLine(ex);
            }
        }
Ejemplo n.º 5
0
 public static byte[] GuildStorageData(character c)
 {
     Systems.MsSQL getstorage = new Systems.MsSQL("SELECT * FROM char_items WHERE guild_storage_id='" + c.Network.Guild.Guildid + "' AND storagetype='3'");
     int itemcount = getstorage.Count();
     PacketWriter Writer = new PacketWriter();
     Writer.Create(Systems.SERVER_GUILD_STORAGE3);
     Writer.Byte(c.Network.Guild.StorageSlots);
     Writer.Byte(itemcount);
     if (itemcount != 0)
     {
         using (System.Data.SqlClient.SqlDataReader reader = getstorage.Read())
         {
             while (reader.Read())
             {
                 Item.AddItemPacket(Writer, reader.GetByte(5), reader.GetInt32(2), reader.GetByte(4), reader.GetInt16(6), reader.GetInt32(7), reader.GetInt32(0), reader.GetInt32(9), reader.GetInt32(30));
             }
         }
     }
     getstorage.Close();
     return Writer.GetBytes();
 }