1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Issue with Limiting Characters per account

Discussion in 'Windows Support' started by Ravenwolfe, Sep 8, 2013.

  1. Ravenwolfe
    Offline

    Moderator ServUO Developer

    Joined:
    Sep 7, 2013
    Messages:
    1,102
    Likes Received:
    117
    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 (C#):
    1.  
    2. public int Limit
    3.         {
    4.             //get { return ( Core.SA ? 7 : Core.AOS ? 6 : 5 ); }
    5.             get { return 1; }
    6.         }
    7.  

    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.
     
  2. Ravenwolfe
    Offline

    Moderator ServUO Developer

    Joined:
    Sep 7, 2013
    Messages:
    1,102
    Likes Received:
    117
    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?
     
  3. Ravenwolfe
    Offline

    Moderator ServUO Developer

    Joined:
    Sep 7, 2013
    Messages:
    1,102
    Likes Received:
    117
    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 (C#):
    1. public sealed class CharacterList : Packet
    2.     {
    3.         private static CharacterListFlags m_AdditionalFlags;
    4.         public CharacterList(IAccount a, CityInfo[] info)
    5.             : base(0xA9)
    6.         {
    7.             this.EnsureCapacity(11 + (a.Length * 60) + (info.Length * 89));
    8.  
    9.             int highSlot = -1;
    10.  
    11.             for (int i = 0; i < a.Length; ++i)
    12.             {
    13.                 if (a[i] != null)
    14.                     highSlot = i;
    15.             }
    16.  
    17.             int count = Math.Max(Math.Max(highSlot + 1, a.Limit), 5);
    18.  
    19.             this.m_Stream.Write((byte)count);
    20.  
    21.             for (int i = 0; i < count; ++i)
    22.             {
    23.                 if (a[i] != null)
    24.                 {
    25.                     this.m_Stream.WriteAsciiFixed(a[i].Name, 30);
    26.                     this.m_Stream.Fill(30); // password
    27.                 }
    28.                 else
    29.                 {
    30.                     this.m_Stream.Fill(60);
    31.                 }
    32.             }
    33.  
    34.             this.m_Stream.Write((byte)info.Length);
    35.  
    36.             for (int i = 0; i < info.Length; ++i)
    37.             {
    38.                 CityInfo ci = info[i];
    39.  
    40.                 this.m_Stream.Write((byte)i);
    41.                 this.m_Stream.WriteAsciiFixed(ci.City, 32);
    42.                 this.m_Stream.WriteAsciiFixed(ci.Building, 32);
    43.                 this.m_Stream.Write((int)ci.X);
    44.                 this.m_Stream.Write((int)ci.Y);
    45.                 this.m_Stream.Write((int)ci.Z);
    46.                 this.m_Stream.Write((int)ci.Map.MapID);
    47.                 this.m_Stream.Write((int)ci.Description);
    48.                 this.m_Stream.Write((int)0);
    49.             }
    50.  
    51.             CharacterListFlags flags = ExpansionInfo.CurrentExpansion.CharacterListFlags;
    52.  
    53.             if (count > 6)
    54.                 flags |= (CharacterListFlags.SeventhCharacterSlot | CharacterListFlags.SixthCharacterSlot); // 7th Character Slot - TODO: Is SixthCharacterSlot Required?
    55.             else if (count == 6)
    56.                 flags |= CharacterListFlags.SixthCharacterSlot; // 6th Character Slot
    57.             else if (a.Limit == 1)
    58.                 flags |= (CharacterListFlags.SlotLimit & CharacterListFlags.OneCharacterSlot); // Limit Characters & One Character
    59.  
    60.             this.m_Stream.Write((int)(flags | m_AdditionalFlags)); // Additional Flags
    61.         }
     
  4. RoninGT
    Offline

    RoninGT Active Member

    Joined:
    Aug 15, 2013
    Messages:
    119
    Likes Received:
    35
    Code (C#):
    1. int flags = ExpansionInfo.CurrentExpansion.CharacterListFlags;
    2.  
    3.  
    4.  
    5.  
    6. if ( count >= 6 )
    7. flags |= 0x40; // 6th character slot
    8. else if ( a.Limit == 1 )
    9. 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 (C#):
    1. [Flags]
    2.     public enum CharacterListFlags
    3.     {
    4.         None = 0x00000000,
    5.         Unk1 = 0x00000001,
    6.         Unk2 = 0x00000002,
    7.         OneCharacterSlot = 0x00000004,
    8.         ContextMenus = 0x00000008,
    9.         SlotLimit = 0x00000010,
    10.         AOS = 0x00000020,
    11.         SixthCharacterSlot = 0x00000040,
    12.         SE = 0x00000080,
    13.         ML = 0x00000100,
    14.         Unk4 = 0x00000200,
    15.         Unk5 = 0x00000400,
    16.         Unk6 = 0x00000800,
    17.         SeventhCharacterSlot = 0x00001000,
    18.         Unk7 = 0x00002000,
    19.  
    20.  
    21.  
    22.  
    23.         ExpansionNone = ContextMenus, //
    24.         ExpansionT2A = ContextMenus, //
    25.         ExpansionUOR = ContextMenus, // None
    26.         ExpansionUOTD = ContextMenus, //
    27.         ExpansionLBR = ContextMenus, //
    28.         ExpansionAOS = ContextMenus | AOS,
    29.         ExpansionSE = ExpansionAOS | SE,
    30.         ExpansionML = ExpansionSE | ML,
    31.         ExpansionSA = ExpansionML
    32.     }
    Packets have never been my strong area but! since the new Packets.cs is calling for
    Code (C#):
    1. 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
     
  5. Ravenwolfe
    Offline

    Moderator ServUO Developer

    Joined:
    Sep 7, 2013
    Messages:
    1,102
    Likes Received:
    117
    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.
     
  6. RoninGT
    Offline

    RoninGT Active Member

    Joined:
    Aug 15, 2013
    Messages:
    119
    Likes Received:
    35
    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.
     
  7. Ravenwolfe
    Offline

    Moderator ServUO Developer

    Joined:
    Sep 7, 2013
    Messages:
    1,102
    Likes Received:
    117
    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 (C#):
    1. public enum CharacterListFlags
    2. {
    3. None = 0x00000000,
    4. Unk1 = 0x00000001,
    5. Unk2 = 0x00000002,
    6. OneCharacterSlot = 0x00000014, // Changed from 0x00000004
    7. ContextMenus = 0x00000008,
    8. SlotLimit = 0x00000010,
    9. AOS = 0x00000020,
    10. SixthCharacterSlot = 0x00000040,
    11. SE = 0x00000080,
    12. ML = 0x00000100,
    13. Unk4 = 0x00000200,
    14. Unk5 = 0x00000400,
    15. Unk6 = 0x00000800,
    16. SeventhCharacterSlot = 0x00001000,
    17. Unk7 = 0x00002000,
    18.  
    19. ExpansionNone = ContextMenus, //
    20. ExpansionT2A = ContextMenus, //
    21. ExpansionUOR = ContextMenus, // None
    22. ExpansionUOTD = ContextMenus, //
    23. ExpansionLBR = ContextMenus, //
    24. ExpansionAOS = ContextMenus | AOS,
    25. ExpansionSE = ExpansionAOS | SE,
    26. ExpansionML = ExpansionSE | ML,
    27. ExpansionSA = ExpansionML
    28. }
     
  8. RoninGT
    Offline

    RoninGT Active Member

    Joined:
    Aug 15, 2013
    Messages:
    119
    Likes Received:
    35
    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
    --- Double Post Merged, Sep 8, 2013 ---
    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
     
    • Like Like x 1
Similar Threads: Issue Limiting
Forum Title Date
Bug Reports Issues with VvV Tuesday at 10:38 PM
Script Support carving issue from old script Saturday at 8:10 PM
Bug Reports Issue with using 1 Character Slot in acount.cs Friday at 12:40 AM
Script Support Complete Spell System spellbook gump issue Aug 9, 2017
Support Boss spawning issue Aug 9, 2017
Archived Bug Reports Issues with the new range packets. Aug 3, 2017
Archived Bug Reports Champion spawn - kick to shrine location - first issue Jul 21, 2017