Beispiel #1
0
        public void OnSlice()
        {
            if (!m_Active || Deleted)
            {
                return;
            }

            if (m_Champion != null)
            {
                if (m_Champion.Deleted)
                {
                    RegisterDamageTo(m_Champion);

                    if (m_Champion is BaseChampion)
                    {
                        AwardArtifact(((BaseChampion)m_Champion).GetArtifact());
                    }

                    m_DamageEntries.Clear();

                    if (m_Platform != null)
                    {
                        m_Platform.Hue = 0x497;
                    }

                    if (m_Altar != null)
                    {
                        m_Altar.Hue = 0;

                        if (!Core.ML || Map == Map.Felucca)
                        {
                            new StarRoomGate(true, m_Altar.Location, m_Altar.Map);
                        }
                    }

                    m_Champion = null;
                    Stop();

                    BeginRestart(m_RestartDelay);
                }
            }
            else
            {
                int kills = m_Kills;

                for (int i = 0; i < m_Creatures.Count; ++i)
                {
                    Mobile m = m_Creatures[i];

                    if (m.Deleted)
                    {
                        if (m.Corpse != null && !m.Corpse.Deleted)
                        {
                            ((Corpse)m.Corpse).BeginDecay(TimeSpan.FromMinutes(1));
                        }
                        m_Creatures.RemoveAt(i);
                        --i;
                        ++m_Kills;

                        Mobile killer = m.FindMostRecentDamager(false);

                        RegisterDamageTo(m);

                        if (killer is BaseCreature)
                        {
                            killer = ((BaseCreature)killer).GetMaster();
                        }

                        if (killer is PlayerMobile)
                        {
                            #region Scroll of Transcendence
                            if (Core.ML)
                            {
                                if (Map == Map.Felucca)
                                {
                                    if (Utility.RandomDouble() < 0.001)
                                    {
                                        PlayerMobile pm     = (PlayerMobile)killer;
                                        double       random = Utility.Random(49);

                                        if (random <= 24)
                                        {
                                            ScrollofTranscendence SoTF = CreateRandomSoT(true);
                                            GiveScrollTo(pm, (SpecialScroll)SoTF);
                                        }
                                        else
                                        {
                                            PowerScroll PS = PowerScroll.CreateRandomNoCraft(5, 5);
                                            GiveScrollTo(pm, (SpecialScroll)PS);
                                        }
                                    }
                                }

                                if (Map == Map.Ilshenar || Map == Map.Tokuno || Map == Map.Malas)
                                {
                                    if (Utility.RandomDouble() < 0.0015)
                                    {
                                        killer.SendLocalizedMessage(1094936);                                           // You have received a Scroll of Transcendence!
                                        ScrollofTranscendence SoTT = CreateRandomSoT(false);
                                        killer.AddToBackpack(SoTT);
                                    }
                                }
                            }
                            #endregion

                            int mobSubLevel = GetSubLevelFor(m) + 1;

                            if (mobSubLevel >= 0)
                            {
                                bool gainedPath = false;

                                int pointsToGain = mobSubLevel * 40;

                                if (VirtueHelper.Award(killer, VirtueName.Valor, pointsToGain, ref gainedPath))
                                {
                                    if (gainedPath)
                                    {
                                        m.SendLocalizedMessage(1054032);                                           // You have gained a path in Valor!
                                    }
                                    else
                                    {
                                        m.SendLocalizedMessage(1054030);                                           // You have gained in Valor!
                                    }
                                    //No delay on Valor gains
                                }

                                PlayerMobile.ChampionTitleInfo info = ((PlayerMobile)killer).ChampionTitles;

                                info.Award(m_Type, mobSubLevel);
                            }
                        }
                    }
                }

                // Only really needed once.
                if (m_Kills > kills)
                {
                    InvalidateProperties();
                }

                double n = m_Kills / (double)MaxKills;
                int    p = (int)(n * 100);

                if (p >= 90)
                {
                    AdvanceLevel();
                }
                else if (p > 0)
                {
                    SetWhiteSkullCount(p / 20);
                }

                if (DateTime.Now >= m_ExpireTime)
                {
                    Expire();
                }

                Respawn();
            }
        }
Beispiel #2
0
        public static string ComputeTitle(Mobile beholder, Mobile beheld)
        {
            StringBuilder title = new StringBuilder();

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

            if (Core.T2A && beheld.ShowFameTitle && beheld is PlayerMobile && ((PlayerMobile)beheld).FameKarmaTitle != null) // Core.SA
            {
                title.AppendFormat(((PlayerMobile)beheld).FameKarmaTitle, beheld.Name, beheld.Female ? "Lady" : "Lord");
            }
            else if (beheld.ShowFameTitle || (beholder == beheld))
            {
                title.Append(ComputeFameTitle(beheld));
            }
            else
            {
                title.Append(beheld.Name);
            }

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

                if (Core.SA)
                {
                    if (((PlayerMobile)beheld).CurrentChampTitle != null)
                    {
                        title.AppendFormat(((PlayerMobile)beheld).CurrentChampTitle);
                    }
                }
                else 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 (Core.T2A) // Core.SA
            {
                if (beheld is PlayerMobile && ((PlayerMobile)beheld).PaperdollSkillTitle != null)
                {
                    title.Append(", ").Append(((PlayerMobile)beheld).PaperdollSkillTitle);
                }
                else if (beheld is BaseVendor)
                {
                    title.AppendFormat(" {0}", customTitle);
                }
            }
            else if (customTitle != null && (customTitle = customTitle.Trim()).Length > 0)
            {
                title.AppendFormat(" {0}", customTitle);
            }
            else if (showSkillTitle && beheld.Player)
            {
                string skillTitle = GetSkillTitle(beheld);

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

            return(title.ToString());
        }
        public void OnSlice()
        {
            if (!m_Active || Deleted)
            {
                return;
            }

            if (m_Champion != null)
            {
                if (m_Champion.Deleted)
                {
                    if (m_Platform != null)
                    {
                        m_Platform.Hue = 0x497;
                    }

                    if (m_Altar != null)
                    {
                        m_Altar.Hue = 0;
                        new StarRoomGate(true, m_Altar.Location, m_Altar.Map);
                    }

                    m_Champion = null;
                    Stop();

                    BeginRestart(m_RestartDelay);
                }
            }
            else
            {
                int kills = m_Kills;

                for (int i = 0; i < m_Creatures.Count; ++i)
                {
                    Mobile m = m_Creatures[i];

                    if (m.Deleted)
                    {
                        m_Creatures.RemoveAt(i);
                        --i;
                        ++m_Kills;


                        Mobile killer = m.FindMostRecentDamager(false);

                        if (killer is BaseCreature)
                        {
                            killer = ((BaseCreature)killer).GetMaster();
                        }

                        if (killer is PlayerMobile)
                        {
                            int mobSubLevel = GetSubLevelFor(m) + 1;

                            if (mobSubLevel >= 0)
                            {
                                bool gainedPath = false;

                                int pointsToGain = mobSubLevel * 40;

                                if (VirtueHelper.Award(killer, VirtueName.Valor, pointsToGain, ref gainedPath))
                                {
                                    if (gainedPath)
                                    {
                                        m.SendLocalizedMessage(1054032);                                           // You have gained a path in Valor!
                                    }
                                    else
                                    {
                                        m.SendLocalizedMessage(1054030);                                           // You have gained in Valor!
                                    }
                                    //No delay on Valor gains
                                }

                                PlayerMobile.ChampionTitleInfo info = ((PlayerMobile)killer).ChampionTitles;

                                info.Award(m_Type, mobSubLevel);
                            }
                        }
                    }
                }

                // Only really needed once.
                if (m_Kills > kills)
                {
                    InvalidateProperties();
                }

                double n = m_Kills / (double)MaxKills;
                int    p = (int)(n * 100);

                if (p >= 90)
                {
                    AdvanceLevel();
                }
                else if (p > 0)
                {
                    SetWhiteSkullCount(p / 20);
                }

                if (DateTime.Now >= m_ExpireTime)
                {
                    Expire();
                }

                Respawn();
            }
        }
Beispiel #4
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 );

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

			return title.ToString();
		}
Beispiel #5
0
        private void BuildPaperdollSuffix()
        {
            AddHtmlLocalized(55, 190, 160, 16, 1115030, 0xFFFF, false, false); // Skills
            AddCallbackButton(20, 190, 4005, 4007, 100, GumpButtonType.Reply, 0, b =>
            {
                Category = TitleCategory.Skills;
                Reset();
                Refresh();
            });

            PlayerMobile.ChampionTitleInfo info = User.ChampionTitles;

            if (info != null && info.HasChampionTitle(User))
            {
                AddHtmlLocalized(55, 212, 160, 16, 1115032, 0xFFFF, false, false); // Monster
                AddCallbackButton(20, 212, 4005, 4007, 101, GumpButtonType.Reply, 0, b =>
                {
                    Category = TitleCategory.Champion;
                    Reset();
                    Refresh();
                });
            }

            if (Category == TitleCategory.Skills)
            {
                if (!ShowingDescription || TitleSelected == -1)
                {
                    int index = 0;
                    int page  = 1;

                    AddPage(page);

                    foreach (Skill sk in User.Skills)
                    {
                        if (sk.Base < 30)
                        {
                            continue;
                        }

                        AddHtml(260, 70 + (index * 22), 245, 16, Color("#FFFFFF", Titles.GetSkillTitle(User, sk)), false, false);
                        AddCallbackButton(225, 70 + (index * 22), 4005, 4007, sk.Info.SkillID + 102, GumpButtonType.Reply, 0, b =>
                        {
                            TitleSelected      = b.ButtonID - 102;
                            ShowingDescription = true;
                            Refresh();
                        });

                        index++;

                        CheckPage(ref index, ref page);
                    }
                }
                else
                {
                    string str = Titles.GetSkillTitle(User, User.Skills[(SkillName)TitleSelected]);

                    AddHtmlLocalized(225, 70, 270, 200, 1115056 + TitleSelected, 0xFFFF, false, false);
                    AddHtmlLocalized(225, 220, 160, 16, 1115027, 0xFFFF, false, false); // Paperdoll Name (Suffix)
                    AddHtml(275, 240, 245, 16, Color("#FFFFFF", str), false, false);

                    AddHtmlLocalized(225, 275, 200, 16, 1115035, 0xFFFF, false, false); // Do you wish to apply this title?

                    AddHtmlLocalized(480, 275, 80, 16, 1011046, 0xFFFF, false, false);  // APPLY
                    AddCallbackButton(445, 275, 4005, 4007, 199, GumpButtonType.Reply, 0, b =>
                    {
                        AddHtmlLocalized(225, 315, 200, 16, 1115036, 0xFFFF, false, false); // TITLE APPLIED
                        str = Titles.GetSkillTitle(User, User.Skills[(SkillName)TitleSelected]);
                        Refresh(false);

                        User.PaperdollSkillTitle = str;
                    });
                }
            }
            else if (Category == TitleCategory.Champion && info != null)
            {
                if (!ShowingDescription || TitleSelected == -1)
                {
                    int y     = 70;
                    int page  = 1;
                    int index = 0;

                    AddPage(page);

                    if (info.Harrower > 0)
                    {
                        AddHtml(260, y, 245, 16, Color("#FFFFFF", String.Format(": {0} of Evil", Titles.HarrowerTitles[Math.Min(Titles.HarrowerTitles.Length, info.Harrower) - 1])), false, false);
                        AddCallbackButton(225, y, 4005, 4007, 295, GumpButtonType.Reply, 0, b =>
                        {
                            TitleSelected      = 295;
                            ShowingDescription = true;
                            Refresh();
                        });

                        index++;
                    }

                    for (int i = 0; i < ChampionSpawnInfo.Table.Length; i++)
                    {
                        int v = info.GetValue(i);

                        if (v == 0)
                        {
                            continue;
                        }

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

                        if (offset <= 0)
                        {
                            continue;
                        }

                        ChampionSpawnInfo champInfo = ChampionSpawnInfo.GetInfo((ChampionSpawnType)i);

                        AddHtml(260, y + (index * 22), 245, 16, Color("#FFFFFF", String.Format(": {0} of the {1}", champInfo.LevelNames[Math.Min(offset, champInfo.LevelNames.Length) - 1], champInfo.Name)), false, false);
                        AddCallbackButton(225, y + (index * 22), 4005, 4007, i + 251, GumpButtonType.Reply, 0, b =>
                        {
                            TitleSelected      = b.ButtonID - 251;
                            ShowingDescription = true;
                            Refresh();
                        });

                        index++;
                        CheckPage(ref index, ref page);
                    }
                }
                else
                {
                    string str         = GetChampionTitle();
                    object description = GetChampInfo();

                    if (description is int)
                    {
                        AddHtmlLocalized(225, 70, 270, 140, (int)description, 0xFFFF, false, false);
                    }
                    else if (description is string)
                    {
                        AddHtml(250, 70, 270, 140, Color("#FFFFFF", (string)description), false, false);
                    }

                    AddHtmlLocalized(225, 220, 160, 16, 1115027, 0xFFFF, false, false); // Paperdoll Name (Suffix)
                    AddHtml(275, 240, 245, 16, Color("#FFFFFF", str), false, false);

                    AddHtmlLocalized(225, 275, 200, 16, 1115035, 0xFFFF, false, false); // Do you wish to apply this title?

                    AddHtmlLocalized(480, 275, 80, 16, 1011046, 0xFFFF, false, false);  // APPLY
                    AddCallbackButton(445, 275, 4005, 4007, 299, GumpButtonType.Reply, 0, b =>
                    {
                        AddHtmlLocalized(225, 315, 200, 16, 1115036, 0xFFFF, false, false); // TITLE APPLIED
                        str = GetChampionTitle();
                        User.DisplayChampionTitle = true;
                        User.CurrentChampTitle    = str;

                        Refresh(false);
                    });
                }
            }
        }