Example #1
0
        public void RemoveMember(Mobile mob)
        {
            PlayerState pl = PlayerState.Find(mob);

            if (pl == null || !Members.Contains(pl))
            {
                return;
            }

            if (mob.Backpack != null)
            {
                //Ordinarily, through normal faction removal, this will never find any sigils.
                //Only with a leave delay less than the ReturnPeriod or a Faction Kick/Ban, will this ever do anything
                Item[] sigils = mob.Backpack.FindItemsByType(typeof(Sigil));

                for (int i = 0; i < sigils.Length; ++i)
                {
                    ((Sigil)sigils[i]).ReturnHome();
                }
            }

            Members.Remove(pl);

            if (mob is PlayerMobile)
            {
                ((PlayerMobile)mob).FactionPlayerState = null;
            }

            mob.InvalidateProperties();
            mob.Delta(MobileDelta.Noto);

            if (Election.IsCandidate(mob))
            {
                Election.RemoveCandidate(mob);
            }

            Election.RemoveVoter(mob);

            if (pl.Finance != null)
            {
                pl.Finance.Finance = null;
            }

            if (pl.Sheriff != null)
            {
                pl.Sheriff.Sheriff = null;
            }

            if (Commander == mob)
            {
                Commander = null;
            }

            if (mob is PlayerMobile)
            {
                ((PlayerMobile)mob).ValidateEquipment();
            }
        }
Example #2
0
        public void RemovePlayerState(PlayerState pl)
        {
            if (pl == null || !Members.Contains(pl))
            {
                return;
            }

            Members.Remove(pl);

            PlayerMobile pm = (PlayerMobile)pl.Mobile;

            if (pm == null)
            {
                return;
            }

            Mobile mob = pl.Mobile;

            if (pm.FactionPlayerState == pl)
            {
                pm.FactionPlayerState = null;

                mob.InvalidateProperties();
                mob.Delta(MobileDelta.Noto);

                if (Election.IsCandidate(mob))
                {
                    Election.RemoveCandidate(mob);
                }

                if (pl.Finance != null)
                {
                    pl.Finance.Finance = null;
                }

                if (pl.Sheriff != null)
                {
                    pl.Sheriff.Sheriff = null;
                }

                Election.RemoveVoter(mob);

                if (Commander == mob)
                {
                    Commander = null;
                }

                pm.ValidateEquipment();
            }
        }