Exemplo n.º 1
0
    void send_uo_stamina( Client* client, Mobile::Character* me, const Core::Vital* vital )
	{
	  PktHelper::PacketOut<PktOut_A3> msg;
	  msg->Write<u32>( me->serial_ext );
	  int v = me->vital( vital->vitalid ).maximum_ones();
	  if ( v > 0xFFFF )
		v = 0xFFFF;
	  msg->WriteFlipped<u16>( static_cast<u16>( v ) );

	  v = me->vital( vital->vitalid ).current_ones();
	  if ( v > 0xFFFF )
		v = 0xFFFF;
	  msg->WriteFlipped<u16>( static_cast<u16>( v ) );
	  msg.Send( client );

	  if ( me->party() != NULL )
		me->party()->on_stam_changed( me );
	}
Exemplo n.º 2
0
	void say_above_cl_affix( UObject *obj, unsigned int cliloc_num, const char* affix,
							 bool prepend, const u16 *arguments,
							 unsigned short font, unsigned short color )
	{
	  PktHelper::PacketOut<PktOut_CC> msg;
	  msg->offset += 2;
	  unsigned textlen = 0, affix_len = 0;

	  if ( arguments != NULL )
	  {
		while ( arguments[textlen] != L'\0' )
		  ++textlen;
	  }
	  affix_len = static_cast<unsigned>( strlen( affix ) + 1 );
	  if ( affix_len > SPEECH_MAX_LEN + 1 )
		affix_len = SPEECH_MAX_LEN + 1;

	  if ( textlen > ( SPEECH_MAX_LEN ) )
		textlen = SPEECH_MAX_LEN;

	  msg->Write<u32>( obj->serial_ext ); // serial
	  msg->WriteFlipped<u16>( obj->graphic );     // body
	  msg->Write<u8>( 7u );           // type 6 lower left, 7 on player
	  msg->WriteFlipped<u16>( color );
	  msg->WriteFlipped<u16>( font );
	  msg->WriteFlipped<u32>( cliloc_num );
	  msg->Write<u8>( ( prepend ) ? 1u : 0u );
	  msg->Write( "System", 30, false );
	  msg->Write( affix, static_cast<u16>( affix_len ) );
	  if ( arguments != NULL )
		msg->WriteFlipped( arguments, static_cast<u16>( textlen ), true ); //ctLEu16
	  else
		msg->offset += 2;
	  u16 len = msg->offset;
	  msg->offset = 1;
	  msg->WriteFlipped<u16>( len );

	  // MuadDib - FIXME: only send to those that I'm visible to.
	  transmit_to_inrange( obj, &msg->buffer, len );
	}
Exemplo n.º 3
0
	void private_say_above_cl_affix( Mobile::Character *chr, const UObject* obj, unsigned int cliloc_num,
									 const char* affix, bool prepend, const u16 *arguments,
									 unsigned short font, unsigned short color )
	{
	  PktHelper::PacketOut<PktOut_CC> msg;
	  msg->offset += 2;
	  unsigned textlen = 0, affix_len = 0;

	  if ( arguments != NULL )
	  {
		while ( arguments[textlen] != L'\0' )
		  ++textlen;
	  }
	  affix_len = static_cast<unsigned>( strlen( affix ) + 1 );
	  if ( affix_len > SPEECH_MAX_LEN + 1 )
		affix_len = SPEECH_MAX_LEN + 1;

	  if ( textlen > ( SPEECH_MAX_LEN ) )
		textlen = SPEECH_MAX_LEN;

	  msg->Write<u32>( obj->serial_ext ); // serial
	  msg->WriteFlipped<u16>( obj->graphic );     // body
	  msg->Write<u8>( 7u );           // type 6 lower left, 7 on player
	  msg->WriteFlipped<u16>( color );
	  msg->WriteFlipped<u16>( font );
	  msg->WriteFlipped<u32>( cliloc_num );
	  msg->Write<u8>( ( prepend ) ? 1u : 0u );
	  msg->Write( "System", 30, false );
	  msg->Write( affix, static_cast<u16>( affix_len ) );
	  if ( arguments != NULL )
		msg->WriteFlipped( arguments, static_cast<u16>( textlen ), true );
	  else
		msg->offset += 2;
	  u16 len = msg->offset;
	  msg->offset = 1;
	  msg->WriteFlipped<u16>( len );

	  msg.Send( chr->client, len );
	}
Exemplo n.º 4
0
    void send_uo_skill( Client* client, Mobile::Character* me, const Mobile::Attribute* attr )
	{
	  ClientAttributeUpdaters& cau = client->Interface.attribute_updaters[attr->attrid];

	  PktHelper::PacketOut<PktOut_3A> msg;
	  msg->offset += 2;
	  if ( !Core::ssopt.core_sends_caps )
		msg->Write<u8>( static_cast<u8>( Core::PKTBI_3A_VALUES::SINGLE_SKILL ) );
	  else
		msg->Write<u8>( static_cast<u8>( Core::PKTBI_3A_VALUES::SINGLE_SKILL_CAP ) );
	  msg->WriteFlipped<u16>( static_cast<u16>( cau.pUOSkill->skillid ) );
      const Mobile::AttributeValue& av = me->attribute( attr->attrid );
	  msg->WriteFlipped<u16>( static_cast<u16>( av.effective_tenths() ) ); //value
	  msg->WriteFlipped<u16>( static_cast<u16>( av.base() ) ); //value_unmod base is always in tenths...
	  msg->Write<u8>( static_cast<u8>( av.lock() ) );
	  if ( Core::ssopt.core_sends_caps )
		msg->WriteFlipped<u16>( static_cast<u16>( av.cap() ) );
	  u16 len = msg->offset;
	  msg->offset = 1;
	  msg->WriteFlipped<u16>( len );
	  msg.Send( client, len );
	}
Exemplo n.º 5
0
	void send_sysmessage_cl_affix( Client *client, unsigned int cliloc_num, const char* affix,
								   bool prepend, const u16 *arguments, unsigned short font,
								   unsigned short color )
	{
	  PktHelper::PacketOut<PktOut_CC> msg;
	  msg->offset += 2;
	  unsigned textlen = 0, affix_len = 0;

	  if ( arguments != NULL )
	  {
		while ( arguments[textlen] != L'\0' )
		  ++textlen;
	  }
	  affix_len = static_cast<unsigned>( strlen( affix ) + 1 );
	  if ( affix_len > SPEECH_MAX_LEN + 1 )
		affix_len = SPEECH_MAX_LEN + 1;

	  if ( textlen > ( SPEECH_MAX_LEN ) )
		textlen = SPEECH_MAX_LEN;

	  msg->Write<u32>( 0xFFFFFFFFu ); // serial
	  msg->Write<u16>( 0xFFFFu );     // body
	  msg->Write<u8>( 6u );           // type 6 lower left, 7 on player
	  msg->WriteFlipped<u16>( color );
	  msg->WriteFlipped<u16>( font );
	  msg->WriteFlipped<u32>( cliloc_num );
	  msg->Write<u8>( ( prepend ) ? 1u : 0u );
	  msg->Write( "System", 30, false );
	  msg->Write( affix, static_cast<u16>( affix_len ) );
	  if ( arguments != NULL )
		msg->WriteFlipped( arguments, static_cast<u16>( textlen ), true );
	  else
		msg->offset += 2;
	  u16 len = msg->offset;
	  msg->offset = 1;
	  msg->WriteFlipped<u16>( len );
	  msg.Send( client, len );
	}