/// <summary> /// Registers a new market item /// </summary> /// <param name="arg"></param> /// <returns></returns> public uint RegisterNewMarketItem(Character target, MarketItemArgument arg) { MySqlConnection connection = ConnectionPool.Request(); uint result = 0; try { byte[] buffer = new byte[67]; Rag2Item.Serialize(arg.item, buffer, 0); MySqlCommand command = new MySqlCommand(_query_10, connection); command.Parameters.AddWithValue("Categorie", arg.item.info.categorie); command.Parameters.AddWithValue("Grade", 0); command.Parameters.AddWithValue("CharId", target.ModelId); command.Parameters.AddWithValue("CharName", arg.sender); command.Parameters.AddWithValue("ItemName", arg.item.info.name); command.Parameters.AddWithValue("ReqClvl", arg.item.clvl); command.Parameters.AddWithValue("Price", arg.price); command.Parameters.AddWithValue("ItemContent", buffer); command.Parameters.AddWithValue("Expires", arg.expires); command.ExecuteNonQuery(); result = Convert.ToUInt32(command.LastInsertedId); } catch (Exception e) { __dbtracelog.WriteError("Database", e.Message); } finally { ConnectionPool.Release(connection); } return(result); }
public void AddItem(Rag2Item product, Rag2Item supply, Rag2Item supply2) { int count = this.data[4]; int newcount = count + 1; if (newcount > 25) { return; } if (product != null) { Rag2Item.Serialize(product, this.data, 0x6F + count * 66); Array.Copy(BitConverter.GetBytes(count), 0, this.data, 11 + count * 4, 4); this.data[4]++; } if (supply != null) { Rag2Item.Serialize(supply, this.data, 0x6E1 + count * 66); this.data[5]++; } if (supply2 != null) { Rag2Item.Serialize(supply2, this.data, 0xD53 + count * 66); this.data[6]++; } }
public void SetProducts(Rag2Item list) { int offset = 119 + (this.data[17] * 66); Rag2Item.Serialize(list, this.data, offset); this.data[17]++; }
public void SetMatrial(Rag2Item list) { int offset = 1769 + (this.data[18] * 66); Rag2Item.Serialize(list, this.data, offset); this.data[18]++; }
/// <Sql> /// INSERT INTO /// list_maildata /// ( /// Sender, /// Receiptent, /// Date, /// Topic, /// Message, /// Attachment, /// Zeny /// ) VALUES ( /// @Sender, /// @Receiptent, /// @Date, /// @Topic, /// @Attachment, /// @Zeny /// ) /// </Sql> public bool InsertNewMailItem(Character target, MailItem item) { byte[] buffer = null; if (item.item != null) { buffer = new byte[67]; Rag2Item.Serialize(item.item, buffer, 0); } MySqlConnection connection = ConnectionPool.Request(); MySqlCommand command = new MySqlCommand(_query_45, connection); command.Parameters.AddWithValue("Sender", (target != null) ? target.Name : string.Empty); command.Parameters.AddWithValue("Receiptent", item.Recieptent); command.Parameters.AddWithValue("Date", item.Timestamp); command.Parameters.AddWithValue("Topic", item.Topic); command.Parameters.AddWithValue("Message", item.Content); command.Parameters.AddWithValue("Zeny", item.Zeny); command.Parameters.AddWithValue("Attachment", buffer); try { return(command.ExecuteNonQuery() > 0); } catch (Exception e) { __dbtracelog.WriteError("Database", e.Message); return(false); } finally { ConnectionPool.Release(connection); } }
public void AddItem(Rag2Item item, byte Active, int ItemIndex) { int index = ItemIndex * 68; Rag2Item.Serialize(item, this.data, index); this.data[index + 67] = item.active; }
public void AddItem(Rag2Item item) { int offset = 2 + (this.index * 67); Rag2Item.Serialize(item, this.data, offset); this.data[offset + 66] = (byte)this.index; this.index++; }
public void AddItem(Rag2Item item, bool nostock) { int offset = 11 + (this.index * 68); Rag2Item.Serialize(item, this.data, offset); this.data[offset + 66] = (byte)this.index; this.data[offset + 67] = (byte)(nostock == true ? 1 : 0); this.index++; }
public void AddItem(Rag2Item item, int ItemIndex) { int offset = this.data.Length; Array.Resize <byte>(ref this.data, offset + 67); Rag2Item.Serialize(item, this.data, offset); this.data[offset + 66] = (byte)ItemIndex; this.data[1]++; }
public void Add(MarketItemArgument item) { int index = this.data.Length; Array.Resize <byte>(ref this.data, 2 + (++this.data[1] * 75)); Rag2Item.Serialize(item.item, this.data, index + 0); Array.Copy(BitConverter.GetBytes(item.price), 0, this.data, index + 66, 4); this.data[index + 70] = (byte)Math.Max(0, (item.expires - DateTime.Now).TotalHours); Array.Copy(BitConverter.GetBytes(item.id), 0, this.data, index + 71, 4); }
public void AddItem(Rag2Item item, bool nostock, int index) { int offset = this.data.Length; Array.Resize <byte>(ref this.data, offset + 68); Rag2Item.Serialize(item, this.data, offset); this.data[0]++; this.data[offset + 66] = (byte)index; this.data[offset + 67] = (byte)(nostock == true ? 1 : 0); }
public void Add(MarketItemArgument c) { int index = this.data.Length - 112; Rag2Item.Serialize(c.item, this.data, index); Array.Copy(BitConverter.GetBytes(c.id), 0, this.data, index + 66, 4); UnicodeEncoding.Unicode.GetBytes(c.sender, 0, c.sender.Length, this.data, index + 70); Array.Copy(BitConverter.GetBytes(c.price), 0, this.data, index + 104, 4); //Price Array.Copy(BitConverter.GetBytes(c.id), 0, this.data, index + 108, 4); }
public void AddItem(Rag2Item item, int index) { Rag2Item.Serialize(item, this.data, 5 + (this.offset * 67)); this.data[5 + 66 + (this.offset * 67)] = (byte)index; this.offset++; }
public void SetItem(Rag2Item item, int Index) { Rag2Item.Serialize(item, this.data, 2); this.data[68] = (byte)Index; }