本文整理汇总了C++中P_ITEM::setName方法的典型用法代码示例。如果您正苦于以下问题:C++ P_ITEM::setName方法的具体用法?C++ P_ITEM::setName怎么用?C++ P_ITEM::setName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类P_ITEM
的用法示例。
在下文中一共展示了P_ITEM::setName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InputSpeech
bool InputSpeech( cUOSocket* socket, P_PLAYER pChar, const QString& speech )
{
if ( pChar->inputMode() == cPlayer::enNone )
return false;
P_ITEM pItem = FindItemBySerial( pChar->inputItem() );
if ( !pItem )
return false;
//bool ok = false;
//Q_INT32 num = speech.toInt( &ok ); // Generally try to convert it
QString notification;
switch ( pChar->inputMode() )
{
// Pricing an item - PlayerVendors
case cPlayer::enPricing:
socket->sysMessage( "Ops, sorry not implemented" );
pChar->setInputMode( cPlayer::enDescription );
socket->sysMessage( tr( "Enter a description for this item." ) );
break;
// Describing an item
case cPlayer::enDescription:
socket->sysMessage( "Description is not used anywhere :( not implemented right now" );
socket->sysMessage( tr( "This item is now described as %1." ).arg( speech ) );
pChar->setInputMode( cPlayer::enNone );
pChar->setInputItem( INVALID_SERIAL );
break;
// Renaming ourself
case cPlayer::enNameDeed:
pChar->setName( speech );
socket->sysMessage( tr( "Your new name is: %1" ).arg( speech ) );
pChar->setInputMode( cPlayer::enNone );
pChar->setInputItem( INVALID_SERIAL );
break;
// Renaming a house sign
case cPlayer::enHouseSign:
pItem->setName( speech );
socket->sysMessage( tr( "Your house has been renamed to: %1" ).arg( speech ) );
pChar->setInputMode( cPlayer::enNone );
pChar->setInputItem( INVALID_SERIAL );
break;
default:
break; // do nothing
}
return true;
}
示例2: handleTargetInput
void Human_Stablemaster::handleTargetInput( P_PLAYER player, cUORxTarget* target )
{
if ( !player )
return;
P_ITEM pPack = m_npc->getBankbox();
if ( !pPack )
return;
P_NPC pPet = dynamic_cast<P_NPC>( World::instance()->findChar( target->serial() ) );
if ( !pPet )
{
m_npc->talk( tr( "I cannot stable that!" ) );
return;
}
if ( pPet->owner() != player )
{
m_npc->talk( tr( "This does not belong to you!" ) );
return;
}
// we spawn a worldgem in the stablemasters bankbox for the pet
// it does only hold the serial of it, the serial of the owner and the
// number of refresh signals since begin of stabling
// the pet becomes "free", which means, that it isnt in the world
// but will still be saved.
P_ITEM pGem = new cItem();
pGem->Init( true );
pGem->setTag( "player", cVariant( player->serial() ) );
pGem->setTag( "pet", cVariant( pPet->serial() ) );
pGem->setId( 0x1ea7 );
pGem->setName( tr( "petitem: %1" ).arg( pPet->name() ) );
pGem->setVisible( 2 ); // gm visible
pPack->addItem( pGem );
pGem->update();
//pPet->free = true;
MapObjects::instance()->remove( pPet );
pPet->setStablemasterSerial( this->m_npc->serial() );
pPet->removeFromView();
// we need this for db saves
m_npc->talk( tr( "Say release to get your pet back!" ) );
}
示例3: InputSpeech
bool InputSpeech( cUOSocket *socket, P_PLAYER pChar, const QString &speech )
{
if( pChar->inputMode() == cPlayer::enNone )
return false;
P_ITEM pItem = FindItemBySerial( pChar->inputItem() );
if( !pItem )
return false;
bool ok;
INT32 num = speech.toInt( &ok ); // Generally try to convert it
QString notification;
switch (pChar->inputMode())
{
// Pricing an item - PlayerVendors
case cPlayer::enPricing:
if (ok)
{
pItem->setPrice( num );
socket->sysMessage( tr( "This item's price has been set to %1." ).arg( num ) );
}
else
socket->sysMessage( tr( "You have to enter a numeric price" ) );
pChar->setInputMode(cPlayer::enDescription);
socket->sysMessage( tr( "Enter a description for this item." ) );
break;
// Describing an item
case cPlayer::enDescription:
pItem->setDescription( speech );
socket->sysMessage( tr( "This item is now described as %1." ).arg( speech ) );
pChar->setInputMode(cPlayer::enNone);
pChar->setInputItem(INVALID_SERIAL);
break;
// Renaming a rune
case cPlayer::enRenameRune:
pItem->setName( tr( "Rune to: %1" ).arg( speech ) );
socket->sysMessage( tr( "Rune renamed to: Rune to: %1" ).arg( speech ) );
pChar->setInputMode(cPlayer::enNone);
pChar->setInputItem(INVALID_SERIAL);
break;
// Renaming ourself
case cPlayer::enNameDeed:
pChar->setName( speech );
socket->sysMessage( tr( "Your new name is: %1" ).arg( speech ) );
pChar->setInputMode(cPlayer::enNone);
pChar->setInputItem(INVALID_SERIAL);
break;
// Renaming a house sign
case cPlayer::enHouseSign:
pItem->setName( speech );
socket->sysMessage( tr( "Your house has been renamed to: %1" ).arg( speech ) );
pChar->setInputMode(cPlayer::enNone);
pChar->setInputItem(INVALID_SERIAL);
break;
// Paging a GM
case cPlayer::enPageGM:
{
cPage* pPage = new cPage( pChar->serial(), PT_GM, speech, pChar->pos() );
cPagesManager::getInstance()->push_back( pPage );
notification = tr( "GM Page from %1: %2" ).arg( pChar->name() ).arg( speech );
for ( cUOSocket *mSock = cNetwork::instance()->first(); mSock; mSock = cNetwork::instance()->next())
if( mSock->player() && mSock->player()->isGM() )
mSock->sysMessage( notification );
if( cNetwork::instance()->count() > 0 )
socket->sysMessage( tr( "Available Game Masters have been notified of your request." ) );
else
socket->sysMessage( tr( "There was no Game Master available, page queued." ) );
pChar->setInputMode(cPlayer::enNone);
}
break;
// Paging a Counselor
case cPlayer::enPageCouns:
{
cPage* pPage = new cPage( pChar->serial(), PT_COUNSELOR, speech, pChar->pos() );
cPagesManager::getInstance()->push_back( pPage );
notification = tr( "Counselor Page from %1: %2" ).arg( pChar->name() ).arg( speech );
for ( cUOSocket *mSock = cNetwork::instance()->first(); mSock; mSock = cNetwork::instance()->next())
if( mSock->player() && (socket->player()->isCounselor() || socket->player()->isGM()) )
mSock->sysMessage( notification );
if( cNetwork::instance()->count() > 0 )
socket->sysMessage( tr( "Available Counselors have been notified of your request." ) );
else
socket->sysMessage( tr( "There was no Counselor available, page queued." ) );
pChar->setInputMode(cPlayer::enNone);
}
//.........这里部分代码省略.........