Ejemplo n.º 1
0
void cNPC::setNextMoveTime()
{
	if (isTamed()) {
		setNextMoveTime(floor(uiCurrentTime + SrvParams->tamedNpcMoveTime() * MY_CLOCKS_PER_SEC));
	} else {
		setNextMoveTime(floor(uiCurrentTime + SrvParams->npcMoveTime() * MY_CLOCKS_PER_SEC));
	}
}
Ejemplo n.º 2
0
void cNPC::showName( cUOSocket *socket )
{
	if( !socket->player() )
		return;

	QString charName = name();

	// apply titles
	if( SrvParams->showNpcTitles() && !title_.isEmpty() )
		charName.append( ", " + title_ );

	// Append serial for GMs
	if( socket->player()->showSerials() )
		charName.append( QString( " [0x%1]" ).arg( serial(), 4, 16 ) );

	// Frozen
	if (isFrozen())
		charName.append( tr(" [frozen]") );

	// Guarded
	if( guardedby_.size() > 0 )
		charName.append( tr(" [guarded]") );

	// Guarding
	if( isTamed() && guarding_ )
		charName.append( tr(" [guarding]") );

	Q_UINT16 speechColor;

	// 0x01 Blue, 0x02 Green, 0x03 Grey, 0x05 Orange, 0x06 Red
	switch( notoriety( socket->player() ) )
	{
		case 0x01:	speechColor = 0x59;		break; //blue
		case 0x02:	speechColor = 0x3F;		break; //green
		case 0x03:	speechColor = 0x3B2;	break; //grey
		case 0x05:	speechColor = 0x90;		break; //orange
		case 0x06:	speechColor = 0x22;		break; //red
		default:	speechColor = 0x3B2;	break; // grey
	}

	if (isInvulnerable()) {
		speechColor = 0x35;
	}

	// Show it to the socket
	socket->showSpeech( this, charName, speechColor, 3, cUOTxUnicodeSpeech::System );
}
Ejemplo n.º 3
0
void cNPC::setNextMoveTime()
{
	unsigned int interval;

	if (isTamed()) {
		interval = SrvParams->tamedNpcMoveTime() * MY_CLOCKS_PER_SEC;
	} else {
		interval = SrvParams->npcMoveTime() * MY_CLOCKS_PER_SEC;
	}

	// Wander slowly if wandering freely.
	if (wanderType() == enFreely || wanderType() == enCircle || wanderType() == enRectangle) {
		interval *= 3;
	}

	setNextMoveTime(uiCurrentTime + interval);
}
Ejemplo n.º 4
0
void cPlayer::showName( cUOSocket* socket )
{
	if ( !socket->player() )
	{
		return;
	}

	QString charName = name();

	// Prefix
	QString prefix( " " );

	// Tag for Prefix
	if ( !isPolymorphed() )
	{
		if ( hasTag( "name.prefix" ) )
		{
			prefix.append( getTag( "name.prefix" ).toString() );
		}
		else if ( fame_ >= 10000 && !isReputationHidden() )
		{
			prefix.append( gender_ ? tr( "Lady" ) : tr( "Lord" ) );
		}
	}

	// Suffix
	QString affix( " " );

	// Tag for Suffix
	if ( !isPolymorphed() )
	{
		if ( hasTag( "name.suffix" ) )
		{
			affix.append( getTag( "name.suffix" ).toString() );
			affix.append( " " );
		}
	}

	if ( !isIncognito() && guild_ && !guild_->abbreviation().isEmpty() )
	{
		cGuild::MemberInfo* info = guild_->getMemberInfo( this );

		if ( info && info->showSign() )
		{
			affix.append( QString( "[%1]" ).arg( guild_->abbreviation() ) );
		}
	}

	// Append serial for GMs
	if ( socket->account()->isShowSerials() )
		affix.append( QString( "[0x%1]" ).arg( serial(), 4, 16 ) );

	// Append offline flag
	if ( !socket_ && !logoutTime_ )
		affix.append( tr( " [offline]" ) );

	// Guarded
	if ( guardedby_.size() > 0 )
		affix.append( tr( " [guarded]" ) );

	// Guarding
	if ( isTamed() && guarding_ )
		affix.append( tr( " [guarding]" ) );

	quint16 speechColor;

	// 0x01 Blue, 0x02 Green, 0x03 Grey, 0x05 Orange, 0x06 Red
	if (Config::instance()->sendAsciiNames()) {
		switch ( notoriety( socket->player() ) )
		{
		case 0x01:
			speechColor = 0x63; break; //blue
		case 0x02:
			speechColor = 0x44; break; //green
		case 0x03:
			speechColor = 0x3B2; break; //grey
		case 0x05:
			speechColor = 0x2b; break; //orange
		case 0x06:
			speechColor = 0x0026; break; //red
		default:
			speechColor = 0x3B2; break; // grey
		}

		if ( isInvulnerable() )
		{
			speechColor = 0x37;
		}

		// ASCII Packet
		cUOTxAsciiSpeech speech;
		speech.setId(body_);
		speech.setSerial(serial_);
		speech.setMessage(prefix + " " + charName + " " + affix);
		speech.setColor(speechColor);
		speech.setFont(3);
		speech.setType(6); // Object Speech
		speech.setName(name_);
		socket->send(&speech);
		// Show it to the socket
		// socket->showSpeech( this, charName, speechColor, 3, cUOTxUnicodeSpeech::System );
		// Names are presented in ASCII speech, Guild titles are not
		//socket->clilocMessage( 1050045, " \t" + charName + "\t " + affix, speechColor, 3, this, true );
	} else {
		switch ( notoriety( socket->player() ) )
		{
		case 0x01:
			speechColor = 0x59; break; //blue
		case 0x02:
			speechColor = 0x3F; break; //green
		case 0x03:
			speechColor = 0x3B2; break; //grey
		case 0x05:
			speechColor = 0x90; break; //orange
		case 0x06:
			speechColor = 0x22; break; //red
		default:
			speechColor = 0x3B2; break; // grey
		}

		if ( isInvulnerable() )
		{
			speechColor = 0x35;
		}

		// Show it to the socket
		// socket->showSpeech( this, charName, speechColor, 3, cUOTxUnicodeSpeech::System );
		// Names are presented in ASCII speech, Guild titles are not
		socket->clilocMessage( 1050045, prefix + " \t" + charName + "\t " + affix, speechColor, 3, this, true );
	}
}
Ejemplo n.º 5
0
void cPlayer::showName( cUOSocket* socket )
{
	if ( !socket->player() )
	{
		return;
	}

	QString charName = name();

	// Lord & Lady Title
	if ( !isIncognito() && fame_ >= 10000 )
		charName.prepend( gender_ ? tr( "Lady " ) : tr( "Lord " ) );

	QString affix( "" );

	if ( !isIncognito() && guild_ && !guild_->abbreviation().isEmpty() )
	{
		cGuild::MemberInfo* info = guild_->getMemberInfo( this );

                if ( info && info->showSign() )
                {
			affix.append( QString( "[%1]" ).arg( guild_->abbreviation() ) );
		}
	}

	// Append serial for GMs
	if ( socket->player()->showSerials() )
		affix.append( QString( "[0x%1]" ).arg( serial(), 4, 16 ) );

	// Append offline flag
	if ( !socket_ && !logoutTime_ )
		affix.append( tr( " [offline]" ) );

	// Guarded
	if ( guardedby_.size() > 0 )
		affix.append( tr( " [guarded]" ) );

	// Guarding
	if ( isTamed() && guarding_ )
		affix.append( tr( " [guarding]" ) );

	Q_UINT16 speechColor;

	// 0x01 Blue, 0x02 Green, 0x03 Grey, 0x05 Orange, 0x06 Red
	switch ( notoriety( socket->player() ) )
	{
	case 0x01:
		speechColor = 0x59; break; //blue
	case 0x02:
		speechColor = 0x3F; break; //green
	case 0x03:
		speechColor = 0x3B2; break; //grey
	case 0x05:
		speechColor = 0x90; break; //orange
	case 0x06:
		speechColor = 0x22; break; //red
	default:
		speechColor = 0x3B2; break; // grey
	}

	if ( isInvulnerable() )
	{
		speechColor = 0x35;
	}

	// Show it to the socket
	// socket->showSpeech( this, charName, speechColor, 3, cUOTxUnicodeSpeech::System );
	// Names are presented in ASCII speech, Guild titles are not
	socket->clilocMessage( 1050045, " \t" + charName + "\t " + affix, speechColor, 3, this, true );
}