Beispiel #1
0
 public void OnMarketBuyItem(Packets.Client.MarketBuyItem p)
 {
     uint id = p.GetItemId();
     MarketplaceItem item = MapServer.charDB.GetMarketItem(id);
     Packets.Server.MarketBuyItem p1 = new SagaMap.Packets.Server.MarketBuyItem();
     if (item == null)
     {
         p1.SetResult(1);
         this.netIO.SendPacket(p1, this.SessionID);
         return;
     }
     if (this.Char.zeny < item.price)
     {
         p1.SetResult(1);
         this.netIO.SendPacket(p1, this.SessionID);
         return;
     }
     Mail mail = new Mail();
     mail.content = "We are glad to inform you that your registered item at <Regenbogen> Market Place was bought by another Player" +
          ".\n  Here is the money for the sold item.\n We are looking forward to see you at <Regenbogen> again!";
     mail.date = DateTime.Now;
     mail.read = 0;
     mail.receiver = item.owner;
     mail.sender = "<Regenbogen>";
     mail.topic = "Your item at <Regenbogen> was sold";
     mail.zeny = item.price;
     mail.valid = 30;
     MapServer.charDB.NewMail(mail);
     MapServer.charDB.DeleteMarketItem(item);
     MapClient receiver = MapClientManager.Instance.GetClient(item.owner);
     if (receiver != null)
     {
         receiver.CheckNewMail();
     }
     this.Char.zeny -= item.price;
     this.SendZeny();
     mail = new Mail();
     mail.content = "We are glad to inform you that you've successfully bought an item at <Regenbogen> Market Place from another Player" +
          ".\n  Here is the bought item.\n We are looking forward to see you at <Regenbogen> again!";
     mail.date = DateTime.Now;
     mail.read = 0;
     mail.receiver = this.Char.Name;
     mail.sender = "<Regenbogen>";
     mail.topic = "You've bought an item at <Regenbogen>";
     mail.valid = 30;
     mail.creator = "";
     mail.durability = item.item.durability;
     mail.item = (uint)item.item.id;
     mail.stack = item.item.stack;
     MapServer.charDB.NewMail(mail);
     this.CheckNewMail();
     p1.SetResult(0);
     this.netIO.SendPacket(p1, this.SessionID);
 }
Beispiel #2
0
 public void OnMarketDeleteItem(Packets.Client.MarketDeleteItem p)
 {
     /*
      * Expected packets:
      * SMSG_MarketDelete
      *
      * Additional expected packet:
      * SMSG_NewMailRecieved
      *
      * Approach: check if the selected itemid still exists in the database
      * if so send marketdelete packet with a 0 reason (successfull) and a new mail message
      *
      * If it fails you'ld need to send it with a failure reason, no clue which id's it are
      */
     uint id = p.GetItemId();
     MarketplaceItem item = MapServer.charDB.GetMarketItem(id);
     Packets.Server.MarketDeleteIem p1 = new SagaMap.Packets.Server.MarketDeleteIem();
     if (item == null)
     {
         p1.SetReason(1);
         this.netIO.SendPacket(p1, this.SessionID);
         return;
     }
     MapServer.charDB.DeleteMarketItem(item);
     Mail mail = new Mail();
     mail.content = "You've canceled a registered Auction at <Regenbogen> Market Place" +
          ".\n  Here is the item you've handed to us.\n We are looking forward to see you at <Regenbogen> again!";
     mail.date = DateTime.Now;
     mail.read = 0;
     mail.receiver = this.Char.Name;
     mail.sender = "<Regenbogen>";
     mail.topic = "You've canceled an auction at <Regenbogen>";
     mail.valid = 30;
     mail.creator = "";
     mail.durability = item.item.durability;
     mail.item = (uint)item.item.id;
     mail.stack = item.item.stack;
     MapServer.charDB.NewMail(mail);
     this.CheckNewMail();
     p1.SetReason(0);
     this.netIO.SendPacket(p1, this.SessionID);
 }