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


C++ AuctionHouseObject::Getcount方法代码示例

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


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

示例1: addNewAuctions

static void addNewAuctions(Player *AHBplayer, AHBConfig *config)
{
	if (!AHBSeller)
		return;
	AuctionHouseObject* auctionHouse = objmgr.GetAuctionsMap(config->GetAHID());
	uint32 items = 0;
	uint32 minItems = config->GetMinItems();
	uint32 maxItems = config->GetMaxItems();
	uint32 auctions = auctionHouse->Getcount();

	if (auctions >= minItems)
	  return;
	if (auctions <= maxItems)
	{
		if ((maxItems - auctions) > ItemsPerCycle)
			items = ItemsPerCycle;
		else
			items = (maxItems - auctions);
	}
	uint32 wtgbin = config->GetPercents(AHB_WHITE_TG);
	uint32 gtgbin = config->GetPercents(AHB_GREEN_TG);
	uint32 btgbin = config->GetPercents(AHB_BLUE_TG);
	uint32 ptgbin = config->GetPercents(AHB_PURPLE_TG);
	uint32 wibin = config->GetPercents(AHB_WHITE_I);
	uint32 gibin = config->GetPercents(AHB_GREEN_I);
	uint32 bibin = config->GetPercents(AHB_BLUE_I);
	uint32 pibin = config->GetPercents(AHB_PURPLE_I);
	uint32 total = wtgbin + gtgbin + btgbin + ptgbin + wibin + gibin + bibin + pibin;

	uint32 pItems = 0;
	uint32 bItems = 0;
	uint32 gItems = 0;
	uint32 wItems = 0;
	uint32 pTGoods = 0;
	uint32 bTGoods = 0;
	uint32 gTGoods = 0;
	uint32 wTGoods = 0;
	for (AuctionHouseObject::AuctionEntryMap::iterator itr = auctionHouse->GetAuctionsBegin();itr != auctionHouse->GetAuctionsEnd();++itr)
	{
		AuctionEntry *Aentry = itr->second;
		Item *item = objmgr.GetAItem(Aentry->item_guidlow);
		if( item )
		{
			ItemPrototype const *prototype = item->GetProto();
			if( prototype )
			{
				switch (prototype->Quality)
				{
				 case 0:
					if (prototype->Class == ITEM_CLASS_TRADE_GOODS)
					   wTGoods = wTGoods + 1;
					else
					   wItems = wItems + 1;
					break;

				 case 1:
					if (prototype->Class == ITEM_CLASS_TRADE_GOODS)
					   wTGoods = wTGoods + 1;
					else
					   wItems = wItems + 1;
					break;

				 case 2:
					if (prototype->Class == ITEM_CLASS_TRADE_GOODS)
					   gTGoods = gTGoods + 1;
					else
					   gItems = gItems + 1;
					break;

				 case 3:
					if (prototype->Class == ITEM_CLASS_TRADE_GOODS)
					   bTGoods = bTGoods + 1;
					else
					   bItems = bItems + 1;
					break;

				 case 4:
					if (prototype->Class == ITEM_CLASS_TRADE_GOODS)
					   pTGoods = pTGoods + 1;
					else
					   pItems = pItems + 1;
					break;
				}
			}
		}
	}
	// only insert a few at a time, so as not to peg the processor
	for (uint32 cnt = 1;cnt <= items;cnt++)
	{
		uint32 itemID = 0;
		while (itemID == 0)
		{
			uint32 choice = urand(1, 8);
			switch (choice)
			{
			case 1:
				{
					if ((purpleItems.size() > 0) && (pItems < pibin))
					{
						itemID = purpleItems[urand(0, purpleItems.size() - 1)];
//.........这里部分代码省略.........
开发者ID:Hereticbeast,项目名称:mangos,代码行数:101,代码来源:AuctionHouseBot.cpp


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