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(); } }
public override void OnResponse(NetState sender, RelayInfo info) { Mobile from = sender.Mobile; int bid = info.ButtonID; if (m_Candidate == null) { if (bid == 0) { } else if (bid == 1) { } else { bid -= 2; if (bid >= 0 && bid < m_Election.Candidates.Count) { from.SendGump(new ElectionManagementGump(m_Election, m_Election.Candidates[bid], 0)); } } } else { if (bid == 0) { from.SendGump(new ElectionManagementGump(m_Election)); } else if (bid == 1) { m_Election.RemoveCandidate(m_Candidate.Mobile); from.SendGump(new ElectionManagementGump(m_Election)); } else if (bid == 2 && m_Page > 0) { from.SendGump(new ElectionManagementGump(m_Election, m_Candidate, m_Page - 1)); } else if (bid == 3 && (m_Page + 1) * 10 < m_Candidate.Voters.Count) { from.SendGump(new ElectionManagementGump(m_Election, m_Candidate, m_Page + 1)); } else { bid -= 4; if (bid >= 0 && bid < m_Candidate.Voters.Count) { m_Candidate.Voters.RemoveAt(bid); from.SendGump(new ElectionManagementGump(m_Election, m_Candidate, m_Page)); } } } }
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(); } }