Пример #1
0
// Resend the char to all sockets in range
void cNPC::resend( bool clean)
{
	// We are stabled and therefore we arent visible to others
	if( stablemasterSerial() != INVALID_SERIAL )
		return;

	cUOTxRemoveObject remove;
	remove.setSerial(serial_);

	for (cUOSocket *socket = Network::instance()->first(); socket; socket = Network::instance()->next()) {
		if (socket->canSee(this)) {
			cUOTxDrawChar drawChar;
			drawChar.fromChar(this);
			drawChar.setHighlight(notoriety(socket->player()));
			socket->send(&drawChar);

			sendTooltip(socket);

			for (ItemContainer::const_iterator it = content_.begin(); it != content_.end(); ++it) {
				it.data()->sendTooltip(socket);
			}
		} else if (clean) {
			socket->send(&remove);
		}
	}
}
Пример #2
0
// Update flags etc.
void cNPC::update( bool excludeself )
{
	cUOTxUpdatePlayer update;
	update.fromChar(this);

	for (cUOSocket *socket = Network::instance()->first(); socket; socket = Network::instance()->next()) {
		if (socket->canSee(this)) {
			update.setHighlight(notoriety(socket->player()));
			socket->send(&update);
		}
	}
}
Пример #3
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 );
}
Пример #4
0
// Update flags etc.
void cPlayer::update( bool excludeself )
{
	cUOTxUpdatePlayer update;
	update.fromChar( this );

	QList<cUOSocket*> sockets = Network::instance()->sockets();
	foreach ( cUOSocket* socket, sockets )
	{
		if ( socket != socket_ && socket->canSee( this ) )
		{
			update.setHighlight( notoriety( socket->player() ) );
			socket->send( &update );
		}
	}

	if ( !excludeself && socket_ )
	{
		//socket_->updatePlayer();
		socket_->updatePlayer();
	}
}
Пример #5
0
// Resend the char to all sockets in range
void cPlayer::resend( bool clean )
{
	cUOTxRemoveObject remove;
	remove.setSerial( serial() );

	QList<cUOSocket*> sockets = Network::instance()->sockets();
	foreach ( cUOSocket* socket, sockets )
	{
		// Don't send such a packet to ourself
		if ( socket->canSee( this ) )
		{
			if ( socket == socket_ )
			{
				socket_->updatePlayer();
			}

			if ( socket != socket_ || clean )
			{
				cUOTxDrawChar drawChar;
				drawChar.fromChar( this );
				drawChar.setHighlight( notoriety( socket->player() ) );
				socket->send( &drawChar );
				sendTooltip( socket );

				// Send equipment tooltips to other players as well
				for ( ItemContainer::const_iterator it( content_.begin() ); it != content_.end(); ++it )
				{
					it.value()->sendTooltip( socket );
				}
			}
		}
		else if ( socket != socket_ && clean )
		{
			socket->send( &remove );
		}
	}
}
Пример #6
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 );
	}
}
Пример #7
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 );
}