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


C++ P_ITEM::ReduceAmount方法代码示例

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


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

示例1: dropOnBanker

void cDragItems::dropOnBanker( P_CLIENT client, P_ITEM pItem, P_CHAR pBanker )
{
	P_CHAR pChar = client->player();

	// No cheque ? >> Put into bank
	if( ( pItem->id() != 0x14F0 ) && ( pItem->type() != 1000 ) )
	{
		P_ITEM bankBox = pChar->getBankBox();

		if( bankBox )
			bankBox->AddItem( pItem );
		else
			bounceItem( client, pItem );

		pBanker->talk( QString( "The %1 is now in thy bank box" ).arg( pItem->getName() ) );
		return;
	}

	// No Value ?!
	if( !pItem->value )
	{
		pBanker->talk( "This cheque does not have any value!" );
		bounceItem( client, pItem );
		return;
	}

	pChar->giveGold( pItem->value, true );
	pBanker->talk( QString( "%1 I have cashed thy cheque and deposited %2 gold." ).arg( pChar->name.c_str() ).arg( pItem->amount() ) );

	pItem->ReduceAmount();
	statwindow( client->socket(), pChar );
}
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:32,代码来源:dragdrop.cpp

示例2: MakeNecroReg

void MakeNecroReg(int nSocket, P_ITEM pMat, short id)
{
	P_ITEM pItem = NULL;
	P_CHAR pc_currchar = currchar[nSocket];

	if( id>=0x1B11 && id<=0x1B1C ) // Make bone powder.
	{
		sprintf((char*)temp,"%s is grinding some bone into powder.", pc_currchar->name.c_str());
		npcemoteall(pc_currchar, (char*)temp,1);
		tempeffect(pc_currchar, pc_currchar, 9, 0, 0, 0);
		tempeffect(pc_currchar, pc_currchar, 9, 0, 3, 0);
		tempeffect(pc_currchar, pc_currchar, 9, 0, 6, 0);
		tempeffect(pc_currchar, pc_currchar, 9, 0, 9, 0);
		pItem = Items->SpawnItem(nSocket, pc_currchar, 1, "bone powder", 1, 0x0F, 0x8F, 0, 1, 1);
		if(pItem == NULL) return;//AntiChrist to preview crashes
		pItem->morex = 666;
		pItem->more1=1; // this will fill more with info to tell difference between ash and bone
		Items->DeleItem(pMat);
		
	}
	if( id==0x0E24 ) // Make vial of blood.
	{
		if(pMat->more1==1)
		{
			pItem = Items->SpawnItem(nSocket, pc_currchar,1,"#",1,0x0F,0x82,0,1,1);
			if(pItem==NULL) return;//AntiChrist to preview crashes
			pItem->value=15;
			pItem->morex=666;
		}
		else
		{
			pItem = Items->SpawnItem(nSocket, pc_currchar,1,"#",1,0x0F,0x7D,0,1,1);
			if(pItem==NULL) return;//AntiChrist to preview crashes
			pItem->value=10;
			pItem->morex=666;
		}
		pMat->ReduceAmount(1);
	}
}
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:39,代码来源:necro.cpp

示例3: dropOnTrainer

void cDragItems::dropOnTrainer( P_CLIENT client, P_ITEM pItem, P_CHAR pTrainer )
{
	P_CHAR pChar = client->player();

	if( pItem->id() != 0xEED )
	{
		pTrainer->talk( "You need to give me gold if you want me to train you!" );
		bounceItem( client, pItem );
		return;
	}

	pTrainer->talk( "I thank thee for thy payment. That should give thee a good start on thy way. Farewell!" );

	Q_UINT8 skill = pTrainer->trainingplayerin();
	Q_INT32 skillSum = pChar->getSkillSum();
	Q_INT32 skillDelta = pTrainer->getTeachingDelta( pChar, skill, skillSum );

	goldsfx( client->socket(), pItem->amount() );

	if( pItem->amount() > skillDelta )
	{
		pItem->ReduceAmount( skillDelta );
		bounceItem( client, pItem );
	}
	else
	{
		skillDelta = pItem->amount();
		Items->DeleItem( pItem );
	}
	
	pChar->setBaseSkill( skill, pChar->baseSkill( skill ) + skillDelta );
	Skills->updateSkillLevel( pChar, skill );
	updateskill( client->socket(), skill );

	// we will not reset the trainer id here because he may want to give him more money
}
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:36,代码来源:dragdrop.cpp

示例4: doubleclick


//.........这里部分代码省略.........

		if (pc->hunger >= 6)
		{
			pc->sysmsg( TRANSLATE("You are simply too full to eat any more!"));
			return;
		}
		else
		{
			switch (RandomNum(0, 2))
			{
				case 0: pc->playSFX(0x3A); break;
				case 1: pc->playSFX(0x3B); break;
				case 2: pc->playSFX(0x3C); break;
			}

			switch (pc->hunger)
			{
				case 0:  pc->sysmsg( TRANSLATE("You eat the food, but are still extremely hungry.")); break;
				case 1:  pc->sysmsg( TRANSLATE("You eat the food, but are still extremely hungry.")); break;
				case 2:  pc->sysmsg( TRANSLATE("After eating the food, you feel much less hungry.")); break;
				case 3:  pc->sysmsg( TRANSLATE("You eat the food, and begin to feel more satiated.")); break;
				case 4:  pc->sysmsg( TRANSLATE("You feel quite full after consuming the food.")); break;
				case 5:  pc->sysmsg( TRANSLATE("You are nearly stuffed, but manage to eat the food."));	break;
				default: pc->sysmsg( TRANSLATE("You are simply too full to eat any more!")); break;
			}

			if (pi->poisoned)
			{
				pc->sysmsg(TRANSLATE("The food was poisoned!"));
				pc->applyPoison(PoisonType(pi->poisoned));

			}

			pi->ReduceAmount(1);
		    pc->hunger++;
		}
		return;
	case ITYPE_WAND: // -Fraz- Modified and tuned up, Wands must now be equipped or in pack
	case ITYPE_MANAREQ_WAND: // magic items requiring mana (xan)
		if (ISVALIDPI(pack))
		{
			if (pi->getContSerial() == pack->getSerial32() || pc->IsWearing(pi))
			{
				if (pi->morez != 0)
				{
					pi->morez--;
					if (magic::beginCasting(
						static_cast<magic::SpellId>((8*(pi->morex - 1)) + pi->morey - 1),
						ps,
						(pi->type==ITYPE_WAND) ? magic::CASTINGTYPE_ITEM : magic::CASTINGTYPE_NOMANAITEM))
						{
							if (pi->morez == 0)
							{
								pi->type = pi->type2;
								pi->morex = 0;
								pi->morey = 0;
								pi->offspell = 0;
							}
						}
				}
			}
			else
			{
				pc->sysmsg(TRANSLATE("If you wish to use this, it must be equipped or in your backpack."));
			}
		}
开发者ID:BackupTheBerlios,项目名称:hypnos-svn,代码行数:67,代码来源:dbl_single_click.cpp


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