Issue with Limiting Characters per account

Ravenwolfe

Moderator
I posted this on RunUO as well, but thought I would post here since it seems to effect both...

It seems that limiting the number of characters is not working like it
used to. I made the usual correction to my Account.cs to limit the
characters per account to 1. This used to remove the NEW button from the
gump when players were at the character selection screen but now they
can click the NEW button and go through the steps to create a new
character. Once they pick a starting location, their client freezes and
the server displays a console line "Character Creation Failed, account
full"

The only change made was in Account.cs here:

Code:
public int Limit
		{
			//get { return ( Core.SA ? 7 : Core.AOS ? 6 : 5 ); }
			get { return 1; }
		}


I'm using client version 7.0.31.0 and have tried it with a clean install. I've also tried it using an older client version. It doesn't appear to be my client as I can log into a shard called Whispering Pines and it is properly limiting me to a single character.

Thanks for any help.
 

Ravenwolfe

Moderator
Well, I tried it with a RunUO 2.0 version and it worked just fine, so it is definately a bug in one of the new releases. Any ideas where I can look to fix this?
 

Ravenwolfe

Moderator
As best I can tell, a flag is set in packets.cs that is then sent to the client to display the correct gump but I'm not experienced enough to tell if this flag is being set correctly. Can anyone advise?

Code:
public sealed class CharacterList : Packet
	{
		private static CharacterListFlags m_AdditionalFlags;
		public CharacterList(IAccount a, CityInfo[] info)
			: base(0xA9)
		{
			this.EnsureCapacity(11 + (a.Length * 60) + (info.Length * 89));
 
			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);
 
			this.m_Stream.Write((byte)count);
 
			for (int i = 0; i < count; ++i)
			{
				if (a[i] != null)
				{
					this.m_Stream.WriteAsciiFixed(a[i].Name, 30);
					this.m_Stream.Fill(30); // password
				}
				else
				{
					this.m_Stream.Fill(60);
				}
			}
 
			this.m_Stream.Write((byte)info.Length);
 
			for (int i = 0; i < info.Length; ++i)
			{
				CityInfo ci = info[i];
 
				this.m_Stream.Write((byte)i);
				this.m_Stream.WriteAsciiFixed(ci.City, 32);
				this.m_Stream.WriteAsciiFixed(ci.Building, 32);
				this.m_Stream.Write((int)ci.X);
				this.m_Stream.Write((int)ci.Y);
				this.m_Stream.Write((int)ci.Z);
				this.m_Stream.Write((int)ci.Map.MapID);
				this.m_Stream.Write((int)ci.Description);
				this.m_Stream.Write((int)0);
			}
 
			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
 
			this.m_Stream.Write((int)(flags | m_AdditionalFlags)); // Additional Flags
		}
 

RoninGT

Citizen
Code:
int flags = ExpansionInfo.CurrentExpansion.CharacterListFlags;
 
 
 
 
if ( count >= 6 )
flags |= 0x40; // 6th character slot
else if ( a.Limit == 1 )
flags |= 0x14; // Limit characters & one character

This is the old Packets.cs where it defines character limits. as you can see here they are showing the flag as 0x14

where in ExpanstionInfo.cs in the new core (ServUO / RunUO 2.3) it shows

Code:
[Flags]
	public enum CharacterListFlags
	{
		None = 0x00000000,
		Unk1 = 0x00000001,
		Unk2 = 0x00000002,
		OneCharacterSlot = 0x00000004,
		ContextMenus = 0x00000008,
		SlotLimit = 0x00000010,
		AOS = 0x00000020,
		SixthCharacterSlot = 0x00000040,
		SE = 0x00000080,
		ML = 0x00000100,
		Unk4 = 0x00000200,
		Unk5 = 0x00000400,
		Unk6 = 0x00000800,
		SeventhCharacterSlot = 0x00001000,
		Unk7 = 0x00002000,
 
 
 
 
		ExpansionNone = ContextMenus, //
		ExpansionT2A = ContextMenus, //
		ExpansionUOR = ContextMenus, // None
		ExpansionUOTD = ContextMenus, //
		ExpansionLBR = ContextMenus, //
		ExpansionAOS = ContextMenus | AOS,
		ExpansionSE = ExpansionAOS | SE,
		ExpansionML = ExpansionSE | ML,
		ExpansionSA = ExpansionML
	}

Packets have never been my strong area but! since the new Packets.cs is calling for
Code:
flags |= (CharacterListFlags.SlotLimit & CharacterListFlags.OneCharacterSlot); // Limit Characters & One Character
Techinclly its calling the right flag cause it combines SlotLimt and OneCharactersSlot Together. with are 0x4 and 0x10... = 0x14 ? Again packets are not my area :)

The code has changed very much from then till now. I tested it and I have the same issue. I will keep investigating it to see what i can come up with.

RoninGT
 

Ravenwolfe

Moderator
Thanks Ronin, I was just looking in that same area. I dont think you can add the flags together like that but im not really sure. Im gonna try some packet captures and see if i can tell how and what flag is being sent. Keep me posted if you find anything. Thanks for looking in to this.
 

RoninGT

Citizen
Currently I am restructuring my servers files. As soon as I get my test center back online ill try to mod the core and do a single packet and see if it works.
 

Ravenwolfe

Moderator
Ok, I'm going with a typo from RunUO. I changed the ExpansionInfo.cs to reflect that old flag for one character slot, recompiled and now it is working correctly!!!

Code:
public enum CharacterListFlags
{
None = 0x00000000,
Unk1 = 0x00000001,
Unk2 = 0x00000002,
OneCharacterSlot = 0x00000014, // Changed from 0x00000004
ContextMenus = 0x00000008,
SlotLimit = 0x00000010,
AOS = 0x00000020,
SixthCharacterSlot = 0x00000040,
SE = 0x00000080,
ML = 0x00000100,
Unk4 = 0x00000200,
Unk5 = 0x00000400,
Unk6 = 0x00000800,
SeventhCharacterSlot = 0x00001000,
Unk7 = 0x00002000,
 
ExpansionNone = ContextMenus, //
ExpansionT2A = ContextMenus, //
ExpansionUOR = ContextMenus, // None
ExpansionUOTD = ContextMenus, //
ExpansionLBR = ContextMenus, //
ExpansionAOS = ContextMenus | AOS,
ExpansionSE = ExpansionAOS | SE,
ExpansionML = ExpansionSE | ML,
ExpansionSA = ExpansionML
}
 

RoninGT

Citizen
Awesome! Glad you got it figured out. I am gonna do some testing myself on that and if all goes well ill push those fixes to the repo.

Thank you for bringing it to our attention.

RoninGT[DOUBLEPOST=1378680464][/DOUBLEPOST]You are 100% correct ty again. Just tested it turn on and off different character limits and it works. Must have been a typo. Good find!

RoninGT