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); } }
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); } }
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()); }
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(); }