Example #1
0
// All this Stuff should be scripted
bool QuestionSpeech( cUOSocket *socket, P_PLAYER pPlayer, P_NPC pChar, const QString& comm )
{
	if( !pChar->isHuman() || pPlayer->dist( pChar ) > 3 )
		return false;
	
	// Tell the questioner our name
	if( comm.contains( "NAME" ) )
	{
		pChar->talk( tr( "Hello, my name is %1." ).arg( pChar->name() ) );
		return true;
	}
	
    // say time and the npChar gives the time.
	if( comm.contains( "TIME" ) )
	{
		pChar->talk( tr( "It is now %1" ).arg( uoTime.toString() ) );
		return true;
	}	

	if( comm.contains( "LOCATION" ) )
	{
		cTerritory* Region = pPlayer->region();
		
		if( Region )
			pChar->talk( tr( "You are in %1" ).arg( Region->name() ) );
		else 
			pChar->talk( tr( "You are in the wilderness" ) );
				
		return true;
	}

	// We couldn't handle the speech
	return false;
}