Exemplo n.º 1
0
 public void DeleteMarketItem(MarketplaceItem item)
 {
 }
Exemplo n.º 2
0
 public void RegisterMarketItem(MarketplaceItem item)
 {
 }
Exemplo n.º 3
0
 public List<MarketplaceItem> SearchMarketItem(MarketSearchOption option, ushort pageindex,object vars)
 {
     string sqlstr = "";
     switch (option)
     {
         case MarketSearchOption.ItemType:
             sqlstr = string.Format("SELECT * FROM `market` WHERE item_type='{0}' LIMIT {1}, 36;", vars.ToString(), pageindex * 36);
             break;
         case MarketSearchOption.Owner:
             sqlstr = string.Format("SELECT * FROM `market` WHERE owner='{0}' LIMIT {1}, 36;", vars.ToString(), pageindex * 36);
             break;
     }
     DataRowCollection results = SQLExecuteQuery(sqlstr);
     List<MarketplaceItem> list = new List<MarketplaceItem>();
     foreach (DataRow i in results)
     {
         MarketplaceItem item = new MarketplaceItem();
         item.item = new Item((int)(uint)i["item_id"], "", (ushort)i["item_durability"], (byte)i["item_stack"]);
         item.id = (uint)i["id"];
         item.owner = (string)i["owner"];
         item.price = (uint)i["price"];
         item.comment = (string)i["comment"];
         item.expire = DateTime.Parse((string)i["expire"]);
         list.Add(item);
     }
     return list;
 }
Exemplo n.º 4
0
 public void RegisterMarketItem(MarketplaceItem item)
 {
     string sqlstr = "";
     sqlstr = string.Format("INSERT INTO `market`(`item_id`,`item_type`,`item_clv`,`item_stack`,`item_durability`,`owner`,`price`,`expire`,`comment`) " +
         "VALUE('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}');",
         item.item.id, (byte)item.item.ItemType, item.item.req_clvl, item.item.stack, item.item.durability, item.owner, item.price, item.expire.ToString(), item.comment);
     SQLExecuteScalar(sqlstr, ref item.id);
 }
Exemplo n.º 5
0
 public MarketplaceItem GetMarketItem(uint id)
 {
     string sqlstr = "";
     sqlstr = "SELECT * FROM `market` WHERE id='" + id + "' LIMIT 1;";
     DataRowCollection results = SQLExecuteQuery(sqlstr);
     if (results.Count == 0) return null;
     DataRow i = results[0];
     MarketplaceItem item = new MarketplaceItem();
     item.item = new Item((int)(uint)i["item_id"], "", (ushort)i["item_durability"], (byte)i["item_stack"]);
     item.id = (uint)i["id"];
     item.owner = (string)i["owner"];
     item.price = (uint)i["price"];
     item.comment = (string)i["comment"];
     item.expire = DateTime.Parse((string)i["expire"]);
     return item;
 }
Exemplo n.º 6
0
 public void DeleteMarketItem(MarketplaceItem item)
 {
     string sqlstr = "DELETE FROM `market` WHERE id='" + item.id + "';";
     SQLExecuteNonQuery(sqlstr);
 }
Exemplo n.º 7
0
 public void OnMarketRegister(Packets.Client.MarketRegister p)
 {
     /*
      * Expexted packets:
      * SMSG_MARKETREGISTER
      * SMSG_UPDATEZENY
      * SMSG_DELETEITEM | SMSG_UPDATEITEM
      *
      * This packet registers a new item on the market
      * Costs for registering is 50 rufi per day, the expression days
      * are expressed in real-time days not gametime.
      *
      * Index - describes the slot index.
      *
      * Note: This packet isn't completly reversed, still searching for the number of days
      * some kind of reason. To indicate it failed registering, durabillity
      *
      */
     byte index = p.ItemIndex();
     byte stack = p.StackCount();
     uint price = p.Zeny();
     byte days = p.NumberOfDays();
     if (this.Char.zeny < (50 * days)) return;
     MarketplaceItem item = new MarketplaceItem();
     Item olditem = this.Char.inv.GetItem(CONTAINER_TYPE.INVENTORY, index);
     if (stack > olditem.stack) stack = olditem.stack;
     Item newitem = new Item(olditem.id, "", olditem.durability, stack);
     item.item = newitem;
     item.expire = (DateTime.Now + new TimeSpan(days, 0, 0, 0));
     item.owner = this.Char.Name;
     item.price = price;
     MapServer.charDB.RegisterMarketItem(item);
     this.map.RemoveItemFromActorPC(this.Char, index, olditem.id, stack, ITEM_UPDATE_REASON.OTHER);
     Packets.Server.MarketRegister p1 = new SagaMap.Packets.Server.MarketRegister();
     p1.SetAuctionID(item.id);
     p1.SetItemID((uint)item.item.id);
     p1.SetCount(stack);
     p1.SetReqClvl((byte)newitem.req_clvl);
     p1.SetZeny(price);
     this.netIO.SendPacket(p1, this.SessionID);
     this.Char.zeny -= (uint)(50 * days);
     this.SendZeny();
 }