当前位置: 首页>>代码示例>>C#>>正文


C# PlayerBussiness.UpdateAuction方法代码示例

本文整理汇总了C#中Bussiness.PlayerBussiness.UpdateAuction方法的典型用法代码示例。如果您正苦于以下问题:C# PlayerBussiness.UpdateAuction方法的具体用法?C# PlayerBussiness.UpdateAuction怎么用?C# PlayerBussiness.UpdateAuction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Bussiness.PlayerBussiness的用法示例。


在下文中一共展示了PlayerBussiness.UpdateAuction方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HandlePacket

        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            int id = packet.ReadInt();
            int price = packet.ReadInt();
            bool result = false;
            GSPacketIn pkg = packet.Clone();
            pkg.ClearContext();

            string msg = "AuctionUpdateHandler.Fail";
            if (client.Player.PlayerCharacter.HasBagPassword && client.Player.PlayerCharacter.IsLocked)
            {

                client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("Bag.Locked"));
                return 0;
            }
            using (PlayerBussiness db = new PlayerBussiness())
            {
                AuctionInfo info = db.GetAuctionSingle(id);
                if (info == null)
                {
                    msg = "AuctionUpdateHandler.Msg1";
                }
                else if (info.PayType == 0 && price > client.Player.PlayerCharacter.Gold)
                {
                    msg = "AuctionUpdateHandler.Msg2";
                }
                else if (info.PayType == 1 && price > client.Player.PlayerCharacter.Money)
                {
                    msg = "AuctionUpdateHandler.Msg3";
                }
                else if (info.BuyerID == 0 && info.Price > price)
                {
                    msg = "AuctionUpdateHandler.Msg4";
                }
                else if (info.BuyerID != 0 && info.Price + info.Rise > price && (info.Mouthful == 0 || info.Mouthful > price))
                {
                    msg = "AuctionUpdateHandler.Msg5";
                }
                else
                {
                    int oldBuyerID = info.BuyerID;
                    info.BuyerID = client.Player.PlayerCharacter.ID;
                    info.BuyerName = client.Player.PlayerCharacter.NickName;
                    info.Price = price;
                    if (info.Mouthful != 0 && price >= info.Mouthful)
                    {
                        info.Price = info.Mouthful;
                        info.IsExist = false;
                    }
                    if (db.UpdateAuction(info))
                    {
                        if (info.PayType == 0)
                        {
                            client.Player.RemoveGold(info.Price);
                        }
                        else
                        {
                            client.Player.RemoveMoney(info.Price);
                            LogMgr.LogMoneyAdd(LogMoneyType.Auction, LogMoneyType.Auction_Update, client.Player.PlayerCharacter.ID, info.Price, client.Player.PlayerCharacter.Money, 0, 0, 0, "", "", "");
                        }

                        if (info.IsExist)
                        {
                            msg = "AuctionUpdateHandler.Msg6";
                        }
                        else
                        {
                            msg = "AuctionUpdateHandler.Msg7";
                            client.Out.SendMailResponse(info.AuctioneerID, eMailRespose.Receiver);
                            client.Out.SendMailResponse(info.BuyerID, eMailRespose.Receiver);
                        }

                        if (oldBuyerID != 0)
                        {
                            client.Out.SendMailResponse(oldBuyerID, eMailRespose.Receiver);//通知老买主价格被超出
                        }
                        result = true;
                    }
                }

                client.Out.SendAuctionRefresh(info, id, info != null ? info.IsExist : false, null);
                client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation(msg));
            }
            pkg.WriteBoolean(result);
            pkg.WriteInt(id);
            client.Out.SendTCP(pkg);
            return 0;
        }
开发者ID:geniushuai,项目名称:DDTank-3.0,代码行数:88,代码来源:AuctionUpdateHandler.cs


注:本文中的Bussiness.PlayerBussiness.UpdateAuction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。