public CharacterListOld( IAccount a, CityInfo[] info )
: base(0xA9)
{
this.EnsureCapacity( 9 + (a.Length * 60) + (info.Length * 63) );
int highSlot = -1;
for ( int i = 0; i < a.Length; ++i )
{
if ( a[i] != null )
highSlot = i;
}
int count = Math.Max( Math.Max( highSlot + 1, a.Limit ), 5 );
m_Stream.Write( (byte) count );
for ( int i = 0; i < count; ++i )
{
if ( a[i] != null )
{
m_Stream.WriteAsciiFixed( a[i].Name, 30 );
m_Stream.Fill( 30 ); // password
}
else
{
m_Stream.Fill( 60 );
}
}
m_Stream.Write( (byte) info.Length );
for ( int i = 0; i < info.Length; ++i )
{
CityInfo ci = info[i];
m_Stream.Write( (byte) i );
m_Stream.WriteAsciiFixed( ci.City, 31 );
m_Stream.WriteAsciiFixed( ci.Building, 31 );
}
CharacterListFlags flags = ExpansionInfo.CurrentExpansion.CharacterListFlags;
if ( count > 6 )
flags |= (CharacterListFlags.SeventhCharacterSlot | CharacterListFlags.SixthCharacterSlot); // 7th Character Slot - TODO: Is SixthCharacterSlot Required?
else if ( count == 6 )
flags |= CharacterListFlags.SixthCharacterSlot; // 6th Character Slot
else if ( a.Limit == 1 )
flags |= (CharacterListFlags.SlotLimit & CharacterListFlags.OneCharacterSlot); // Limit Characters & One Character
m_Stream.Write( (int)(flags | CharacterList.AdditionalFlags) ); // Additional Flags
}