本文整理汇总了C++中P_PLAYER::mayBroadcast方法的典型用法代码示例。如果您正苦于以下问题:C++ P_PLAYER::mayBroadcast方法的具体用法?C++ P_PLAYER::mayBroadcast怎么用?C++ P_PLAYER::mayBroadcast使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类P_PLAYER
的用法示例。
在下文中一共展示了P_PLAYER::mayBroadcast方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: talking
void cSpeech::talking( P_PLAYER pChar, const QString &lang, const QString &speech, QValueVector< UINT16 > &keywords, UINT16 color, UINT16 font, UINT8 type ) // PC speech
{
// handle things like renaming or describing an item
if( !pChar->socket() )
return;
cUOSocket *socket = pChar->socket();
if( InputSpeech( socket, pChar, speech ) )
return;
// not allowed to talk
if( pChar->isMuted() )
{
socket->sysMessage( tr( "You re squelched and cannot talk" ) );
return;
}
pChar->unhide();
// Check for Bogus Color
if( !isNormalColor( color ) )
color = 0x2;
if( type == 0 || type == 2)
pChar->setSaycolor( color );
if( SrvParams->speechLog() )
{
QFile lFile( "speech.log" );
if( lFile.open( IO_Append ) )
{
QString logMessage( "[%1] %2: %3 [%4, 0x%5]" );
logMessage = logMessage.arg( QDateTime::currentDateTime().toString() ).arg( pChar->name() ).arg( speech ).arg( pChar->account()->login() ).arg( pChar->serial(), 8, 16 );
lFile.writeBlock( logMessage.latin1(), logMessage.length() );
lFile.close();
}
}
if( pChar->onTalk( type, color, font, speech, lang ) )
return;
if( ( type == 0x09 ) && ( pChar->mayBroadcast() ) )
{
pChar->talk( speech, color, type );
return;
}
pChar->talk( speech, color, type );
QString speechUpr = speech.upper();
if( response( socket, pChar, speech, keywords ) )
return; // Vendor responded already
// 0x0007 -> Speech-id for "Guards"
for( QValueVector< UINT16 >::const_iterator iter = keywords.begin(); iter != keywords.end(); ++iter )
{
UINT16 keyword = *iter;
if( keyword == 0x07 )
pChar->callGuards();
}
// well,i had a strange problem with duplicate speech input
// its quite easy to understand....
// the former loop searched for the tiller man and when it
// was found, the speechInput method of that boat was called.
// in this method the tiller had been removed from the mapregion
// and appended to the end of the cell vector... hence, the
// tiller was found twice...
// therefore we produce a QPtrList of cBoat* pointers and
// then go through it for applying speech --- sereg
RegionIterator4Items rj( pChar->pos() );
QPtrList< cBoat > pboats;
for( rj.Begin(); !rj.atEnd(); rj++ )
{
P_ITEM pi = rj.GetData();
if( !pi )
continue;
if( pi->type() == 117 && pi->tags().get( "tiller" ).toInt() == 1 )
{
cBoat* pBoat = dynamic_cast< cBoat* >(FindItemBySerial( pi->tags().get("boatserial").toInt() ));
if( pBoat )
pboats.append( pBoat );
}
}
QPtrListIterator< cBoat > pit( pboats );
while( pit.current() )
{
pit.current()->speechInput( socket, speechUpr );
++pit;
}
// this makes it so npcs do not respond to isDead people - HEALERS ??
if( pChar->isDead() )
return;
//.........这里部分代码省略.........
示例2: talking
void Speech::talking( P_PLAYER pChar, const QString& lang, const QString& speech, QValueVector<Q_UINT16>& keywords, Q_UINT16 color, Q_UINT16 font, Q_UINT8 type ) // PC speech
{
// handle things like renaming or describing an item
if ( !pChar->socket() )
return;
cUOSocket* socket = pChar->socket();
if ( InputSpeech( socket, pChar, speech ) )
return;
pChar->unhide();
// Check for Bogus Color
if ( !isNormalColor( color ) )
color = 0x2;
if ( type == 0 )
pChar->setSaycolor( color );
else if ( type == 2 )
pChar->setEmoteColor( color );
if ( pChar->onTalk( type, color, font, speech, lang ) )
return;
if ( ( type == 0x09 ) && ( pChar->mayBroadcast() ) )
{
pChar->talk( speech, color, type );
return;
}
pChar->talk( speech, color, type );
QString speechUpr = speech.upper();
if ( response( socket, pChar, speech, keywords ) )
return; // Vendor responded already
// this makes it so npcs do not respond to isDead people - HEALERS ??
if ( pChar->isDead() )
return;
// 0x0007 -> Speech-id for "Guards"
for ( QValueVector<Q_UINT16>::const_iterator iter = keywords.begin(); iter != keywords.end(); ++iter )
{
Q_UINT16 keyword = *iter;
if ( keyword == 0x07 )
pChar->callGuards();
}
/* P_CHAR pc = NULL; ???
P_CHAR pNpc = NULL;
RegionIterator4Chars ri( pChar->pos() );
for( ri.Begin(); !ri.atEnd(); ri++ )
{
pc = ri.GetData();
if (!pc->isSameAs( pChar )
&& pc->isNpc()
&& pc->dist( pChar ) <= 2)
{
pNpc = pc;
break;
}
}
*/
}