本文整理汇总了C++中P_CHAR::delItems方法的典型用法代码示例。如果您正苦于以下问题:C++ P_CHAR::delItems方法的具体用法?C++ P_CHAR::delItems怎么用?C++ P_CHAR::delItems使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类P_CHAR
的用法示例。
在下文中一共展示了P_CHAR::delItems方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: execMake
/*!
\brief executes a "MAKE" command
\author Xanathar
\param pc player who do make
\param n item number
*/
void cMakeMenu::execMake( NXWCLIENT ps, UI32 item )
{
P_CHAR pc = ps->currChar();
if( pc->dead ) {
pc->sysmsg(TRANSLATE("Ever thought an ethereal soul can't really do some actions ?"));
return;
}
cMakeItem* mi = makeItems[item];
if( ( mi==NULL ) || ( mi->command==NULL ) )
return;
if( mi->command->command=="MAKEMENU" ) {
Skills::MakeMenu( pc, str2num( mi->command->param ), skill, mat[0].id, mat[0].color, mat[1].id, mat[1].color );
return;
}
if( pc->IsGM() ) {
mi->command->execute( ps->toInt() );
return;
}
if( !mi->checkReq( pc ) )
return;
bool failed = false;
if( !pc->checkSkill((Skill)mi->skillToCheck, mi->minskill, mi->maxskill) ) {
failed = true;
}
for( int j=0; j<2; ++j ) {
cRawItem& raw = mi->reqitems[j];
if( raw.id!=0 ) {
UI16 matToDel = raw.number;
if( failed )
matToDel = ( matToDel/2>0 )? matToDel/2 : 1;
pc->delItems( raw.id, matToDel, raw.color );
}
}
switch( skill )
{
case MINING :
pc->playSFX(0x0054);
break;
case BLACKSMITHING :
pc->playSFX(0x002A);
break;
case CARPENTRY :
pc->playSFX(0x023D);
break;
case INSCRIPTION :
pc->playSFX(0x0249);
break;
case TAILORING :
pc->playSFX(0x0248);
break;
case TINKERING :
pc->playSFX(0x002A);
break;
case CARTOGRAPHY :
pc->playSFX(0x0249);
break;
}
pc->setObjectDelay();
std::string script;
std::string amount;
splitLine( mi->command->param, script, amount );
if( !failed ) {
P_ITEM pi = item::CreateFromScript( str2num( script ), pc->getBackpack(), (amount!="")? str2num( amount ) : INVALID );
VALIDATEPI(pi);
ps->sysmsg(TRANSLATE("You create the item and place it in your backpack."));
pi->magic = 1;
pi->creator = pc->getCurrentName(); // Memorize Name of the creator
if (pc->skill[skill]>950)
pi->madewith=skill+1; // Memorize Skill used
else
pi->madewith=0-skill-1; // Memorize Skill used ( negative not shown )
}
else {
//.........这里部分代码省略.........