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


C++ Player::AddBid方法代码示例

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


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

示例1: HandleAuctionPlaceBid

void WorldSession::HandleAuctionPlaceBid( WorldPacket & recv_data )
{
    uint64 auctioneer;
    uint32 auction,price;
    WorldPacket data;
    recv_data >> auctioneer;
    recv_data >> auction >> price;
    AuctionEntry *ah = objmgr.GetAuction(auction);
    Player *pl = GetPlayer();
    if ((ah) && (ah->owner != pl->GetGUIDLow()))
    {
        if ((price < ah->buyout) || (ah->buyout == 0))
        {
            Mail* n = new Mail;
            n->messageID = objmgr.GenerateMailID();
            n->sender = ah->owner;
            n->reciever = ah->bidder;
            n->subject = "You have lost a bid";
            n->body = "";
            n->item = 0;
            n->money = ah->bid;
            n->time = time(NULL) + (30 * 3600);
            n->COD = 0;
            n->checked = 0;
            uint64 rc;
            GUID_LOPART(rc) = ah->bidder;
            GUID_HIPART(rc) = 0;
            std::string name;
            objmgr.GetPlayerNameByGUID(rc,name);
            Player *rpl = objmgr.GetPlayer(name.c_str());
            std::stringstream ss;
            ss << "INSERT INTO mail (mailId,sender,reciever,subject,body,item,time,money,COD,checked) VALUES ( " <<
                n->messageID << ", " << n->sender << ", " << n->reciever << ",' " << n->subject.c_str() << "' ,' " <<
                n->body.c_str() << "', " << n->item << ", " << n->time << ", " << n->money << ", " << n->COD << ", " << n->checked << " )";
            sDatabase.Execute( ss.str().c_str( ) );
            if (rpl)
            {
                rpl->AddMail(n);
            }

            ah->bidder = pl->GetGUIDLow();
            ah->bid = price;
            objmgr.RemoveAuction(ah->Id);
            objmgr.AddAuction(ah);
            bidentry *be = new bidentry;
            be->AuctionID = auction;
            be->amt = price;
            pl->SetUInt32Value(PLAYER_FIELD_COINAGE,(pl->GetUInt32Value(PLAYER_FIELD_COINAGE) - price));
            bidentry *bo = pl->GetBid(auction);
            if (bo)
            {
                Mail* m = new Mail;
                m->messageID = objmgr.GenerateMailID();
                m->sender = ah->owner;
                m->reciever = pl->GetGUIDLow();
                m->subject = "You have lost a bid";
                m->body = "";
                m->item = 0;
                m->money = bo->amt;
                m->time = time(NULL) + (30 * 3600);
                m->COD = 0;
                m->checked = 0;
                pl->AddMail(m);
            }
            pl->AddBid(be);
            uint64 guid = auctioneer;

            data.Initialize( SMSG_AUCTION_BIDDER_LIST_RESULT );
            uint32 cnt = 0;
            std::list<bidentry*>::iterator itr;
            for (itr = pl->GetBidBegin(); itr != pl->GetBidEnd(); itr++)
            {
                AuctionEntry *ae = objmgr.GetAuction((*itr)->AuctionID);
                if (ae->auctioneer = GUID_LOPART(guid))
                {
                    cnt++;
                }
            }
            if (cnt < 51)
            {
                data << cnt;
            }
            else
            {
                data << uint32(50);
            }
            uint32 cnter = 1;
            for (itr = pl->GetBidBegin(); itr != pl->GetBidEnd(); itr++)
            {
                AuctionEntry *ae = objmgr.GetAuction((*itr)->AuctionID);
                if ((ae->auctioneer = GUID_LOPART(guid)) && (cnter < 33))
                {
                    data << ae->Id;
                    Item *it = objmgr.GetAItem(ae->item);
                    data << it->GetUInt32Value(OBJECT_FIELD_ENTRY);
                    data << uint32(0);
                    data << uint32(0);
                    data << uint32(0);
                    data << uint32(1);
                    data << uint32(0);
//.........这里部分代码省略.........
开发者ID:Artea,项目名称:mangos-svn,代码行数:101,代码来源:AuctionHouse.cpp


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