public override void OnEnter(Mobile m)
        {
            if (!Controller.InUse)
            {
                return;
            }

            m.SendMessage("Your health is being regenerated faster!");

            if (m is PlayerMobile)
            {
                HealTimer timer = new HealTimer(m);
                PlayerTimers.Add(timer);
                timer.Start();
            }

            m.Delta(MobileDelta.Noto);
            m.InvalidateProperties();
        }
		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();
		}
Exemple #3
0
        public override void OnEnter(Mobile m)
        {
            if (!Controller.InUse)
            {
                return;
            }

            if (m is EnergyVortex)
            {
                EnergyVortex ev = (EnergyVortex)m;
                Controller.EVsAndBSsAdd(ev);
            }
            else if (m is BladeSpirits)
            {
                BladeSpirits bs = (BladeSpirits)m;
                Controller.EVsAndBSsAdd(bs);
            }

            m.Delta(MobileDelta.Noto);
            m.InvalidateProperties();
        }
Exemple #4
0
        public void InvalidateAllProperties(Mobile m, IEnumerable <Item> equipped, Item changed)
        {
            if (World.Loading || World.Saving || m == null || m.Deleted || m.Map == null || m.Map == Map.Internal)
            {
                return;
            }

            m.InvalidateProperties();

            if (equipped != null)
            {
                foreach (var item in equipped.Where(item => item != changed))
                {
                    InvalidateItemProperties(item);
                }
            }

            if (changed != null)
            {
                InvalidateItemProperties(changed);
            }
        }
Exemple #5
0
        public void InvalidateAllProperties(Mobile m, Item[] equipped, Item changed)
        {
            if (m == null || m.Deleted || m.Map == null || m.Map == Map.Internal)
            {
                return;
            }

            m.InvalidateProperties();

            if (equipped != null && equipped.Length > 0)
            {
                foreach (Item item in equipped.Where(item => item != changed))
                {
                    InvalidateItemProperties(item);
                }
            }

            if (changed != null)
            {
                InvalidateItemProperties(changed);
            }
        }
		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();
			}
		}
Exemple #7
0
        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();
        }
Exemple #8
0
        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);
        }
Exemple #9
0
        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);
        }
Exemple #10
0
        public static string ComputeTitle(Mobile beholder, Mobile beheld)
        {
            StringBuilder title = new StringBuilder();

            int fame  = beheld.Fame;
            int karma = beheld.Karma;

            bool showSkillTitle = beheld.ShowFameTitle && ((beholder == beheld) || (fame >= 5000));

            /*if ( beheld.Kills >= 5 )
             * {
             *      title.AppendFormat( beheld.Fame >= 10000 ? "The Murderer {1} {0}" : "The Murderer {0}", beheld.Name, beheld.Female ? "Lady" : "Lord" );
             * }
             * else*/if (beheld.ShowFameTitle || (beholder == beheld))
            {
                for (int i = 0; i < m_FameEntries.Length; ++i)
                {
                    FameEntry fe = m_FameEntries[i];

                    if (fame <= fe.m_Fame || i == (m_FameEntries.Length - 1))
                    {
                        KarmaEntry[] karmaEntries = fe.m_Karma;

                        for (int j = 0; j < karmaEntries.Length; ++j)
                        {
                            KarmaEntry ke = karmaEntries[j];

                            if (karma <= ke.m_Karma || j == (karmaEntries.Length - 1))
                            {
                                title.AppendFormat(ke.m_Title, beheld.Name, beheld.Female ? "Lady" : "Lord");
                                break;
                            }
                        }

                        break;
                    }
                }
            }
            else
            {
                title.Append(beheld.Name);
            }

            if (beheld is PlayerMobile && ((PlayerMobile)beheld).DisplayChampionTitle)
            {
                PlayerMobile.ChampionTitleInfo info = ((PlayerMobile)beheld).ChampionTitles;

                if (info.Harrower > 0)
                {
                    title.AppendFormat(": {0} of Evil", HarrowerTitles[Math.Min(HarrowerTitles.Length, info.Harrower) - 1]);
                }
                else
                {
                    int highestValue = 0, highestType = 0;
                    for (int i = 0; i < ChampionSpawnInfo.Table.Length; i++)
                    {
                        int v = info.GetValue(i);

                        if (v > highestValue)
                        {
                            highestValue = v;
                            highestType  = i;
                        }
                    }

                    int offset = 0;
                    if (highestValue > 800)
                    {
                        offset = 3;
                    }
                    else if (highestValue > 300)
                    {
                        offset = (int)(highestValue / 300);
                    }

                    if (offset > 0)
                    {
                        ChampionSpawnInfo champInfo = ChampionSpawnInfo.GetInfo((ChampionSpawnType)highestType);
                        title.AppendFormat(": {0} of the {1}", champInfo.LevelNames[Math.Min(offset, champInfo.LevelNames.Length) - 1], champInfo.Name);
                    }
                }
            }

            string customTitle = beheld.Title;

            if (customTitle != null && (customTitle = customTitle.Trim()).Length > 0)
            {
                title.AppendFormat(" {0}", customTitle);
            }
            else if (showSkillTitle && beheld.Player)
            {
                //string skillTitle = GetSkillTitle( beheld );
                string skillTitle = GetPlayerInfo.GetSkillTitle(beheld);

                if (skillTitle != null)
                {
                    title.Append(", ").Append(skillTitle);
                }
            }

            beheld.InvalidateProperties();

            return(title.ToString());
        }
        public static void SkillName_OnCommand(CommandEventArgs e)
        {
            Mobile m = e.Mobile;

            CharacterDatabase DB = Server.Items.CharacterDatabase.GetDB(m);

            if (e.Length >= 1)
            {
                int success = 0;
                if (e.Arguments[0] == "alchemy")
                {
                    success = 1; DB.CharacterSkill = 1;
                }
                else if (e.Arguments[0] == "anatomy")
                {
                    success = 1; DB.CharacterSkill = 2;
                }
                else if (e.Arguments[0] == "animal lore")
                {
                    success = 1; DB.CharacterSkill = 3;
                }
                else if (e.Arguments[0] == "animal taming")
                {
                    success = 1; DB.CharacterSkill = 4;
                }
                else if (e.Arguments[0] == "archery")
                {
                    success = 1; DB.CharacterSkill = 5;
                }
                else if (e.Arguments[0] == "arms lore")
                {
                    success = 1; DB.CharacterSkill = 6;
                }
                else if (e.Arguments[0] == "begging")
                {
                    success = 1; DB.CharacterSkill = 7;
                }
                else if (e.Arguments[0] == "blacksmithing")
                {
                    success = 1; DB.CharacterSkill = 8;
                }
                else if (e.Arguments[0] == "bushido")
                {
                    success = 1; DB.CharacterSkill = 9;
                }
                else if (e.Arguments[0] == "camping")
                {
                    success = 1; DB.CharacterSkill = 10;
                }
                else if (e.Arguments[0] == "carpentry")
                {
                    success = 1; DB.CharacterSkill = 11;
                }
                else if (e.Arguments[0] == "cartography")
                {
                    success = 1; DB.CharacterSkill = 12;
                }
                else if (e.Arguments[0] == "chivalry")
                {
                    success = 1; DB.CharacterSkill = 13;
                }
                else if (e.Arguments[0] == "cooking")
                {
                    success = 1; DB.CharacterSkill = 14;
                }
                else if (e.Arguments[0] == "detect hidden")
                {
                    success = 1; DB.CharacterSkill = 15;
                }
                else if (e.Arguments[0] == "discordance")
                {
                    success = 1; DB.CharacterSkill = 16;
                }
                else if (e.Arguments[0] == "evaluating intelligence")
                {
                    success = 1; DB.CharacterSkill = 17;
                }
                else if (e.Arguments[0] == "fencing")
                {
                    success = 1; DB.CharacterSkill = 18;
                }
                else if (e.Arguments[0] == "fishing")
                {
                    success = 1; DB.CharacterSkill = 19;
                }
                else if (e.Arguments[0] == "bowcraft/fletching")
                {
                    success = 1; DB.CharacterSkill = 20;
                }
                else if (e.Arguments[0] == "bowcraft")
                {
                    success = 1; DB.CharacterSkill = 20;
                }
                else if (e.Arguments[0] == "fletching")
                {
                    success = 1; DB.CharacterSkill = 20;
                }
                else if (e.Arguments[0] == "focus")
                {
                    success = 1; DB.CharacterSkill = 21;
                }
                else if (e.Arguments[0] == "forensic evaluation")
                {
                    success = 1; DB.CharacterSkill = 22;
                }
                else if (e.Arguments[0] == "healing")
                {
                    success = 1; DB.CharacterSkill = 23;
                }
                else if (e.Arguments[0] == "herding")
                {
                    success = 1; DB.CharacterSkill = 24;
                }
                else if (e.Arguments[0] == "hiding")
                {
                    success = 1; DB.CharacterSkill = 25;
                }
                else if (e.Arguments[0] == "inscription")
                {
                    success = 1; DB.CharacterSkill = 26;
                }
                else if (e.Arguments[0] == "item identification")
                {
                    success = 1; DB.CharacterSkill = 27;
                }
                else if (e.Arguments[0] == "lockpicking")
                {
                    success = 1; DB.CharacterSkill = 28;
                }
                else if (e.Arguments[0] == "lumberjacking")
                {
                    success = 1; DB.CharacterSkill = 29;
                }
                else if (e.Arguments[0] == "mace fighting")
                {
                    success = 1; DB.CharacterSkill = 30;
                }
                else if (e.Arguments[0] == "magery")
                {
                    success = 1; DB.CharacterSkill = 31;
                }
                else if (e.Arguments[0] == "resisting spells")
                {
                    success = 1; DB.CharacterSkill = 32;
                }
                else if (e.Arguments[0] == "meditation")
                {
                    success = 1; DB.CharacterSkill = 33;
                }
                else if (e.Arguments[0] == "mining")
                {
                    success = 1; DB.CharacterSkill = 34;
                }
                else if (e.Arguments[0] == "musicianship")
                {
                    success = 1; DB.CharacterSkill = 35;
                }
                else if (e.Arguments[0] == "necromancy")
                {
                    success = 1; DB.CharacterSkill = 36;
                }
                else if (e.Arguments[0] == "ninjitsu")
                {
                    success = 1; DB.CharacterSkill = 37;
                }
                else if (e.Arguments[0] == "parrying")
                {
                    success = 1; DB.CharacterSkill = 38;
                }
                else if (e.Arguments[0] == "peacemaking")
                {
                    success = 1; DB.CharacterSkill = 39;
                }
                else if (e.Arguments[0] == "poisoning")
                {
                    success = 1; DB.CharacterSkill = 40;
                }
                else if (e.Arguments[0] == "provocation")
                {
                    success = 1; DB.CharacterSkill = 41;
                }
                else if (e.Arguments[0] == "remove trap")
                {
                    success = 1; DB.CharacterSkill = 42;
                }
                else if (e.Arguments[0] == "snooping")
                {
                    success = 1; DB.CharacterSkill = 43;
                }
                else if (e.Arguments[0] == "spirit speak")
                {
                    success = 1; DB.CharacterSkill = 44;
                }
                else if (e.Arguments[0] == "stealing")
                {
                    success = 1; DB.CharacterSkill = 45;
                }
                else if (e.Arguments[0] == "stealth")
                {
                    success = 1; DB.CharacterSkill = 46;
                }
                else if (e.Arguments[0] == "swordsmanship")
                {
                    success = 1; DB.CharacterSkill = 47;
                }
                else if (e.Arguments[0] == "tactics")
                {
                    success = 1; DB.CharacterSkill = 48;
                }
                else if (e.Arguments[0] == "tailoring")
                {
                    success = 1; DB.CharacterSkill = 49;
                }
                else if (e.Arguments[0] == "taste identification")
                {
                    success = 1; DB.CharacterSkill = 50;
                }
                else if (e.Arguments[0] == "tinkering")
                {
                    success = 1; DB.CharacterSkill = 51;
                }
                else if (e.Arguments[0] == "tracking")
                {
                    success = 1; DB.CharacterSkill = 52;
                }
                else if (e.Arguments[0] == "veterinary")
                {
                    success = 1; DB.CharacterSkill = 53;
                }
                else if (e.Arguments[0] == "wrestling")
                {
                    success = 1; DB.CharacterSkill = 54;
                }
                else if (e.Arguments[0] == "clear")
                {
                    success = 1; DB.CharacterSkill = 0;
                }

                if (success == 1)
                {
                    m.InvalidateProperties();
                    m.SendMessage("Your skill title has been changed.");
                }
                else
                {
                    m.SendMessage("That is not a valid skill!");
                }
            }
            else
            {
                m.SendMessage("Format: SkillName followed by the name of the skill in quotes");
            }
        }
 public void UpdateTitle( Mobile m )
 {
     m.InvalidateProperties();
     m.Delta( MobileDelta.Name );
 }
Exemple #13
0
        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.");
        }
Exemple #14
0
		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();
			}
		}
Exemple #15
0
		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.");
		}