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


C++ AuctionHouse::SendAuctionList方法代码示例

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


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

示例1: HandleAuctionPlaceBid

void WorldSession::HandleAuctionPlaceBid(WorldPacket& recv_data)
{
    CHECK_INWORLD_RETURN

    uint64 guid;
    recv_data >> guid;

    uint32 auction_id, price;
    recv_data >> auction_id >> price;

    Creature* pCreature = _player->GetMapMgr()->GetCreature(GET_LOWGUID_PART(guid));
    if (!pCreature || !pCreature->auctionHouse)
        return;

    // Find Item
    AuctionHouse* ah = pCreature->auctionHouse;
    Auction* auct = ah->GetAuction(auction_id);
    if (auct == 0 || !auct->Owner || !_player)
    {
        SendAuctionPlaceBidResultPacket(0, ERR_AUCTION_DATABASE_ERROR);
        return;
    }

    if (auct->Owner == _player->GetGUID())
    {
        SendAuctionPlaceBidResultPacket(0, ERR_AUCTION_BID_OWN);
        return;
    }
    if (auct->HighestBid > price && price != auct->BuyoutPrice)
    {
        //HACK: Don't know the correct error code...
        SendAuctionPlaceBidResultPacket(0, ERR_AUCTION_DATABASE_ERROR);
        return;
    }

    if (!_player->HasGold(price))
    {
        SendAuctionPlaceBidResultPacket(0, ERR_AUCTION_NOT_ENOUGHT_MONEY);
        return;
    }

    _player->ModGold(-(int32)price);
    if (auct->HighestBidder != 0)
    {
        // Return the money to the last highest bidder.
        char subject[100];
        snprintf(subject, 100, "%u:0:0", (int)auct->pItem->GetEntry());
        sMailSystem.SendAutomatedMessage(AUCTION, ah->GetID(), auct->HighestBidder, subject, "", auct->HighestBid, 0, 0, MAIL_STATIONERY_AUCTION);

        // Do not send out bid notification, when current highest bidder and new bidder are the same player..
        if (auct->HighestBidder != (uint32)_player->GetLowGUID())
            ah->SendAuctionOutBidNotificationPacket(auct, _player->GetGUID(), price);
    }

    if (auct->BuyoutPrice == price)
    {
        auct->HighestBidder = _player->GetLowGUID();
        auct->HighestBid = price;

        // we used buyout on the item.
        ah->QueueDeletion(auct, AUCTION_REMOVE_WON);

        SendAuctionPlaceBidResultPacket(auct->Id, ERR_AUCTION_OK);
        ah->SendAuctionBuyOutNotificationPacket(auct);
    }
    else
    {
        // update most recent bid
        auct->HighestBidder = _player->GetLowGUID();
        auct->HighestBid = price;
        auct->UpdateInDB();

        SendAuctionPlaceBidResultPacket(auct->Id, ERR_AUCTION_OK);
    }

    ah->SendAuctionList(_player, &recv_data);
}
开发者ID:beyourself,项目名称:AscEmu_CATA,代码行数:77,代码来源:AuctionHouse.cpp


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