コード例 #1
0
ファイル: MapClient.Market.cs プロジェクト: Willyham/SagaRO2
 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);
 }
コード例 #2
0
        public void SaveMail(Mail.Mail mail)
        {
            string sqlstr = string.Format("UPDATE  mail  SET  sender =N'{0}', receiver =N'{1}', topic =N'{2}'," +
                                          " date ='{3}', content =N'{4}', [read] ={5}, valid ={6}, zeny ={7}, itemID ={8}," +
                                          " creator =N'{9}', stack ={10}, durability ={11} WHERE  mailID ={12};",
                                          mail.sender, mail.receiver, mail.topic, mail.date.ToString(), mail.content,
                                          mail.read.ToString(), mail.valid.ToString(), mail.zeny.ToString(), mail.item.ToString(),
                                          mail.creator, mail.stack.ToString(), mail.durability.ToString(), mail.ID.ToString());

            try
            {
                db.ExeSql(sqlstr);
            }
            catch (Exception ex)
            {
                Logger.ShowError(ex);
            }
        }
コード例 #3
0
        public void NewMail(Mail.Mail mail)
        {
            string sqlstr = string.Format("INSERT INTO  mail ( sender , receiver , topic , date ," +
                                          " content , [read] , valid , zeny , itemID , creator , stack , durability " +
                                          ") VALUES(N'{0}',N'{1}',N'{2}','{3}',N'{4}',{5},{6},{7},{8},N'{9}',{10},{11});",
                                          mail.sender, mail.receiver, mail.topic, mail.date.ToString(), mail.content, mail.read.ToString(),
                                          mail.valid.ToString(), mail.zeny.ToString(), mail.item.ToString(), mail.creator,
                                          mail.stack.ToString(), mail.durability);

            try
            {
                db.ExeSql(sqlstr);
            }
            catch (Exception ex)
            {
                Logger.ShowError(ex);
            }
        }
コード例 #4
0
ファイル: db40ActorDB.cs プロジェクト: x3sphiorx/SagaRO2
 public void SaveMail(Mail.Mail mail)
 {
 }
コード例 #5
0
ファイル: db40ActorDB.cs プロジェクト: x3sphiorx/SagaRO2
 public void NewMail(Mail.Mail mail)
 {
 }
コード例 #6
0
ファイル: MapClient.Market.cs プロジェクト: Willyham/SagaRO2
 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);
 }
コード例 #7
0
ファイル: MapClient.Market.cs プロジェクト: Willyham/SagaRO2
 //0x0F Packets======================================
 /// <summary>
 /// check if a marketplace item is still valid
 /// </summary>
 /// <param name="list"></param>
 private void CheckMarketItemValid(List<MarketplaceItem> list)
 {
     foreach (MarketplaceItem i in list)
     {
         if (i.expire < DateTime.Now)
         {
             MapClient owner;
             MapServer.charDB.DeleteMarketItem(i);
             Mail mail = new Mail();
             mail.content = "We have to inform you, that your registered item at <Regenbogen>\n" +
                 " has just expired. We've returned your item to you.\n We are looking forward to see you at <Regenbogen> again!";
             mail.date = DateTime.Now;
             mail.read = 0;
             mail.receiver = i.owner;
             mail.sender = "<Regenbogen>";
             mail.topic = "Your item has expired at <Regenbogen>";
             mail.valid = 30;
             mail.creator = "";
             mail.durability = i.item.durability;
             mail.item = (uint)i.item.id;
             mail.stack = i.item.stack;
             MapServer.charDB.NewMail(mail);
             owner = MapClientManager.Instance.GetClient(i.owner);
             if (owner != null)
             {
                 owner.CheckNewMail();
             }
         }
     }
 }