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


C++ Auction::UpdateInDB方法代码示例

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


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

示例1: UpdateOwner

void AuctionHouse::UpdateOwner(uint32 oldGuid, uint32 newGuid)
{
	auctionLock.AcquireWriteLock();
	HM_NAMESPACE::hash_map<uint32, Auction*>::iterator itr = auctions.begin();
	Auction * auction;
	for(; itr != auctions.end(); ++itr)
	{
		auction = itr->second;
		if(auction->Owner == oldGuid)
			auction->Owner = newGuid;
		if(auction->HighestBidder == oldGuid)
		{
			auction->HighestBidder = newGuid;
			auction->UpdateInDB();
		}
	}
	auctionLock.ReleaseWriteLock();
}
开发者ID:AwkwardDev,项目名称:Descent-core-scripts-3.3.5,代码行数:18,代码来源:AuctionHouse.cpp

示例2: HandleAuctionPlaceBid

void WorldSession::HandleAuctionPlaceBid( WorldPacket & recv_data )
{
	if(!_player->IsInWorld())
	{ 
		return;
	}

	uint64 guid;
	recv_data >> guid;

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

	Creature * pCreature = _player->GetMapMgr()->GetCreature( 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, AUCTION_ERROR_INTERNAL);
		return;
	}

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

	if(_player->GetGold() < price)
	{
		SendAuctionPlaceBidResultPacket(0, AUCTION_ERROR_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, AUCTION_ERROR_NONE);
		ah->SendAuctionBuyOutNotificationPacket(auct);
	}
	else
	{
		// update most recent bid
		auct->HighestBidder = _player->GetLowGUID();
		auct->HighestBid = price;
		auct->UpdateInDB();

		SendAuctionPlaceBidResultPacket(auct->Id, AUCTION_ERROR_NONE);
	}
}
开发者ID:AwkwardDev,项目名称:Descent-core-scripts-3.3.5,代码行数:80,代码来源:AuctionHouse.cpp


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