本文整理汇总了C++中AuctionEntry::UpdateBid方法的典型用法代码示例。如果您正苦于以下问题:C++ AuctionEntry::UpdateBid方法的具体用法?C++ AuctionEntry::UpdateBid怎么用?C++ AuctionEntry::UpdateBid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AuctionEntry
的用法示例。
在下文中一共展示了AuctionEntry::UpdateBid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleAuctionPlaceBid
// this function is called when client bids or buys out auction
void WorldSession::HandleAuctionPlaceBid(WorldPacket& recv_data)
{
DEBUG_LOG("WORLD: HandleAuctionPlaceBid");
ObjectGuid auctioneerGuid;
uint32 auctionId;
uint32 price;
recv_data >> auctioneerGuid;
recv_data >> auctionId >> price;
if (!auctionId || !price)
return; // check for cheaters
AuctionHouseEntry const* auctionHouseEntry = GetCheckedAuctionHouseForAuctioneer(auctioneerGuid);
if (!auctionHouseEntry)
return;
// always return pointer
AuctionHouseObject* auctionHouse = sAuctionMgr.GetAuctionsMap(auctionHouseEntry);
// remove fake death
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
AuctionEntry* auction = auctionHouse->GetAuction(auctionId);
Player* pl = GetPlayer();
if (!auction || auction->owner == pl->GetGUIDLow())
{
// you cannot bid your own auction:
SendAuctionCommandResult(NULL, AUCTION_BID_PLACED, AUCTION_ERR_BID_OWN);
return;
}
ObjectGuid ownerGuid = ObjectGuid(HIGHGUID_PLAYER, auction->owner);
// impossible have online own another character (use this for speedup check in case online owner)
Player* auction_owner = sObjectMgr.GetPlayer(ownerGuid);
if (!auction_owner && sObjectMgr.GetPlayerAccountIdByGUID(ownerGuid) == pl->GetSession()->GetAccountId())
{
// you cannot bid your another character auction:
SendAuctionCommandResult(NULL, AUCTION_BID_PLACED, AUCTION_ERR_BID_OWN);
return;
}
// cheating or client lags
if (price <= auction->bid)
{
// client test but possible in result lags
SendAuctionCommandResult(auction, AUCTION_BID_PLACED, AUCTION_ERR_HIGHER_BID);
return;
}
// price too low for next bid if not buyout
if ((price < auction->buyout || auction->buyout == 0) &&
price < auction->bid + auction->GetAuctionOutBid())
{
// client test but possible in result lags
SendAuctionCommandResult(auction, AUCTION_BID_PLACED, AUCTION_ERR_BID_INCREMENT);
return;
}
if (price > pl->GetMoney())
{
// you don't have enough money!, client tests!
// SendAuctionCommandResult(auction->auctionId, AUCTION_ERR_INVENTORY, EQUIP_ERR_NOT_ENOUGH_MONEY);
return;
}
// cheating
if (price < auction->startbid)
return;
SendAuctionCommandResult(auction, AUCTION_BID_PLACED, AUCTION_OK);
auction->UpdateBid(price, pl);
}