Checking all characters in account for variable setting

Archaaz

Squire
Sep 17, 2016
212
54
28
This is for a new faction system for my RunUO shard, completely unrelated to, and much simpler than, the original. It consists of two factions, and is tied to account. Once one character on account joins a faction it uses an account tag for the entire faction This assures that all characters on an account can only join that faction. Faction membership determines a number of things the character is allowed to do .These are not important here.

The one thing I need is a way to check every character on an account for various enum variable settings when a character tries to quit the faction (and will probably use the same sort of check for joining). If these variables are set to None for all characters on the account, they can quit, otherwise they must make them None (quitting their guild or town). The purpose of this is to allow account two switch factions, while not having characters belong to towns or guilds of their originalo faction.

I am not sure the below code, taken from Faction.cs, will do it, and was hoping for some advice and help. I am just using the NpcGuild variable as an example. Can I use this one check for all characters, or, must I check each seprately. If so, how would I do that?

Thanks in advance for any help!

Code:
using Server.Accounting;

Code:
        private bool CanQuitFaction( Mobile mob )
        {
            Account acct = mob.Account as Account;

            if ( acct != null )
            {
                for ( int i = 0; i < acct.Length; ++i )
                {
                    Mobile c = acct[i];

                    if ( Find( c ) != null )
                    {
                             PlayerMobile pc = c as PlayerMobile;
       
                           if ( pc != null && pc.NpcGuild == NpcGuild.None )  

                     }
                        return true;
                }
            }

            return false;
        }