private static void UpdateRanking(Mobile m, XmlPoints attachment) { if (RankList == null) RankList = new ArrayList(); // flag the rank list for updating on the next attempt to retrieve a rank needsupdate = true; bool found = false; // rank the entries for (int i = 0; i < RankList.Count; i++) { RankEntry p = RankList[i] as RankEntry; // found a match if (p != null && p.Killer == m) { // update the entry with the new points value p.PointsAttachment = attachment; found = true; break; } } // a new entry so add it if (!found) { RankList.Add(new RankEntry(m, attachment)); } // if points statistics are being displayed in player name properties, then update them if (m != null) m.InvalidateProperties(); }
public void RemoveMember(Mobile mob) { PlayerState pl = PlayerState.Find(mob); if (pl == null || !this.Members.Contains(pl)) return; int killPoints = pl.KillPoints; 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(); } if (pl.RankIndex != -1) { while ((pl.RankIndex + 1) < this.ZeroRankOffset) { PlayerState pNext = this.Members[pl.RankIndex + 1]; this.Members[pl.RankIndex + 1] = pl; this.Members[pl.RankIndex] = pNext; pl.RankIndex++; pNext.RankIndex--; } this.ZeroRankOffset--; } this.Members.Remove(pl); if (mob is PlayerMobile) ((PlayerMobile)mob).FactionPlayerState = null; mob.InvalidateProperties(); mob.Delta(MobileDelta.Noto); if (this.Election.IsCandidate(mob)) this.Election.RemoveCandidate(mob); this.Election.RemoveVoter(mob); if (pl.Finance != null) pl.Finance.Finance = null; if (pl.Sheriff != null) pl.Sheriff.Sheriff = null; if (this.Commander == mob) this.Commander = null; if (mob is PlayerMobile) ((PlayerMobile)mob).ValidateEquipment(); if (killPoints > 0) DistributePoints(killPoints); }
public virtual void AddMember(Mobile mob) { this.Members.Insert(this.ZeroRankOffset, new PlayerState(mob, this, this.Members)); mob.AddToBackpack(FactionItem.Imbue(new Robe(), this, false, this.Definition.HuePrimary)); mob.SendLocalizedMessage(1010374); // You have been granted a robe which signifies your faction mob.InvalidateProperties(); mob.Delta(MobileDelta.Noto); mob.FixedEffect(0x373A, 10, 30); mob.PlaySound(0x209); }
public void UpdateTitle( Mobile m ) { m.InvalidateProperties(); m.Delta( MobileDelta.Name ); }
public void RemoveMember(Mobile mob) { PlayerState pl = PlayerState.Find(mob); if (pl == null || !Members.Contains(pl)) { return; } int killPoints = pl.KillPoints; 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)); foreach (Sigil s in sigils.OfType<Sigil>()) { s.ReturnHome(); } } if (pl.RankIndex != -1) { while ((pl.RankIndex + 1) < ZeroRankOffset) { PlayerState pNext = Members[pl.RankIndex + 1]; Members[pl.RankIndex + 1] = pl; Members[pl.RankIndex] = pNext; pl.RankIndex++; pNext.RankIndex--; } ZeroRankOffset--; } 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(); } if (killPoints > 0) { LoggingCustom.Log( "LOG_FactionPoints.txt", DateTime.Now + "\t" + mob.Name + "\tFaction.RemoveMember: DistributePoints\t" + killPoints); DistributePoints(killPoints); } Player epl = Player.Find(mob); if (Ethic.Enabled && epl != null) { epl.Detach(); } }
private void FixMobile(Mobile m) { if (!m.Alive) m.Resurrect(); HandleCorpse(m); m.Aggressed.Clear(); m.Aggressors.Clear(); m.Hits = m.HitsMax; m.Stam = m.StamMax; m.Mana = m.ManaMax; m.DamageEntries.Clear(); m.Combatant = null; m.InvalidateProperties(); m.Criminal = false; StatMod mod; mod = m.GetStatMod("[Magic] Str Offset"); if (mod != null && mod.Offset < 0) m.RemoveStatMod("[Magic] Str Offset"); mod = m.GetStatMod("[Magic] Dex Offset"); if (mod != null && mod.Offset < 0) m.RemoveStatMod("[Magic] Dex Offset"); mod = m.GetStatMod("[Magic] Int Offset"); if (mod != null && mod.Offset < 0) m.RemoveStatMod("[Magic] Int Offset"); m.Paralyzed = false; m.CurePoison(m); // EvilOmenSpell.CheckEffect(m); StrangleSpell.RemoveCurse(m); CorpseSkinSpell.RemoveCurse(m); #region Buff Icons if (m is PlayerMobile) { PlayerMobile pm = (PlayerMobile)m; pm.RemoveBuff(BuffIcon.Clumsy); pm.RemoveBuff(BuffIcon.CorpseSkin); pm.RemoveBuff(BuffIcon.EvilOmen); pm.RemoveBuff(BuffIcon.Curse); pm.RemoveBuff(BuffIcon.FeebleMind); pm.RemoveBuff(BuffIcon.MassCurse); pm.RemoveBuff(BuffIcon.Paralyze); pm.RemoveBuff(BuffIcon.Poison); pm.RemoveBuff(BuffIcon.Strangle); pm.RemoveBuff(BuffIcon.Weaken); } #endregion m.SendMessage("The duel has ended."); }