示例#1
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();
 }