Beispiel #1
0
void send_paperdoll( Network::Client* client, Mobile::Character* chr )
{
  Network::PktHelper::PacketOut<Network::PktOut_88> msg;
  msg->Write<u32>( chr->serial_ext );

  if ( ( !settingsManager.ssopt.privacy_paperdoll ) || ( client->chr == chr ) )
  {
    std::string name = ( !chr->has_title_prefix() ? "" : chr->title_prefix() + " " ) + chr->name() +
                       ( !chr->has_title_suffix() ? "" : " " + chr->title_suffix() );
    if ( chr->has_title_race() )
      name += " (" + chr->title_race() + ")";
    msg->Write( name.c_str(), 60 );
  }
  else
    msg->Write( chr->name().c_str(), 60 );


  // MuadDib changed to reflect true status for 0x20 packet. 1/4/2007
  // Paperdoll Appears different type Status byte than other walk/update
  // packets. Using poison/hidden here will break peace/war button.
  u8 flag1 = chr->warmode() ? 1 : 0;
  if ( client->UOExpansionFlag & Network::AOS && client->chr->serial_ext == chr->serial_ext )
    flag1 |= CHAR_FLAG1_CANALTER;
  msg->Write<u8>( flag1 );

  msg.Send( client );
}
Beispiel #2
0
void send_start( Network::Client* client )
{
  send_feature_enable(
      client );  // Shinigami: moved from start_client_char() to send before char selection

  unsigned i;
  u32 clientflag;            // sets client flags
  unsigned char char_slots;  // number of slots according to expansion, avoids crashing people
  unsigned char char_count;  // number of chars to send: Max(char_slots, 5)

  char_slots = static_cast<u8>(
      Plib::systemstate.config
          .character_slots );  // sets it first to be the number defined in the config
  // TODO: Per account character slots? (With the actual character_slots defining maximum)

  // If more than 6 chars and no AOS, only send 5. Client is so boring sometimes...
  if ( char_slots >= 6 && !( client->UOExpansionFlag & Network::AOS ) )
    char_slots = 5;

  char_count = 5;                 // UO always expects a minimum of 5? What a kludge...
  if ( char_slots > char_count )  // Max(char_slots, 5)
    char_count = char_slots;

  Network::PktHelper::PacketOut<Network::PktOut_A9> msg;
  msg->offset += 2;
  msg->Write<u8>( char_count );

  for ( i = 0; i < char_count; i++ )
  {
    if ( i < char_slots )  // Small kludge to have a minimum of 5 chars in the packet
    {
      // name only 30 long rest is password seems to fix the password promt problem
      Mobile::Character* chr = client->acct->get_character( i );
      if ( chr )
      {
        msg->Write( chr->name().c_str(), 30, false );
        msg->offset += 30;  // password
      }
      else
        msg->offset += 60;
    }
    else
      msg->offset += 60;
  }

  msg->Write<u8>( gamestate.startlocations.size() );

  for ( i = 0; i < gamestate.startlocations.size(); i++ )
  {
    msg->Write<u8>( i );
    if ( client->ClientType & Network::CLIENTTYPE_70130 )
    {
      msg->Write( gamestate.startlocations[i]->city.c_str(), 32, false );
      msg->Write( gamestate.startlocations[i]->desc.c_str(), 32, false );

      Coordinate coord = gamestate.startlocations[i]->coords[0];

      msg->WriteFlipped<u32>( coord.x );
      msg->WriteFlipped<u32>( coord.y );
      msg->WriteFlipped<s32>( coord.z );
      msg->WriteFlipped<u32>( gamestate.startlocations[i]->mapid );        // MapID
      msg->WriteFlipped<u32>( gamestate.startlocations[i]->cliloc_desc );  // Cliloc Description
      msg->offset += 4;
    }
    else
    {
      msg->Write( gamestate.startlocations[i]->city.c_str(), 31, false );
      msg->Write( gamestate.startlocations[i]->desc.c_str(), 31, false );
    }
  }

  clientflag = settingsManager.ssopt.uo_feature_enable;  // 'default' flags. Maybe auto-enable them
                                                         // according to the expansion?

  clientflag |= PKTOUT_A9::FLAG_SEND_UO3D_TYPE;  // Let UO3D (KR,SA) send 0xE1 packet

  // Change this to a function for clarity? -- Nando
  if ( char_slots == 7 )
    clientflag |= PKTOUT_A9::FLAG_UPTO_SEVEN_CHARACTERS;  // 7th Character flag
  else if ( char_slots == 6 )
    clientflag |= PKTOUT_A9::FLAG_UPTO_SIX_CHARACTERS;  // 6th Character Flag
  else if ( char_slots == 1 )
    clientflag |= 0x14;  // Only one character (SIEGE (0x04) + LIMIT_CHAR (0x10))

  msg->WriteFlipped<u32>( clientflag );
  u16 len = msg->offset;
  msg->offset = 1;
  msg->WriteFlipped<u16>( len );
  msg.Send( client, len );
}