Beispiel #1
0
        public static void CheckAtrophy(Mobile from)
        {
            PlayerMobile pm = from as PlayerMobile;

            if (pm == null)
            {
                return;
            }

            try
            {
                if ((pm.LastSacrificeLoss + LossDelay) < DateTime.Now)
                {
                    if (VirtueHelper.Atrophy(from, VirtueName.Sacrifice))
                    {
                        from.SendLocalizedMessage(1052041);                           // You have lost some Sacrifice.
                    }

                    VirtueLevel level = VirtueHelper.GetLevel(from, VirtueName.Sacrifice);

                    int resurrects = 0;

                    if (level >= VirtueLevel.Knight)
                    {
                        resurrects = 3;
                    }
                    else if (level >= VirtueLevel.Follower)
                    {
                        resurrects = 2;
                    }
                    else if (level >= VirtueLevel.Seeker)
                    {
                        resurrects = 1;
                    }

                    pm.AvailableResurrects = resurrects;
                    pm.LastSacrificeLoss   = DateTime.Now;
                }
            }
            catch
            {
            }
        }
Beispiel #2
0
            private int GetPool(Mobile user)
            {
                if (VirtueHelper.IsKnight(user, VirtueName.Spirituality))
                {
                    return(200);
                }

                if (VirtueHelper.IsFollower(user, VirtueName.Spirituality))
                {
                    return(100);
                }

                if (VirtueHelper.IsSeeker(user, VirtueName.Spirituality))
                {
                    return(50);
                }

                return(0);
            }
Beispiel #3
0
            public static int GetReduction(Mobile m)
            {
                if (VirtueHelper.IsKnight(m, VirtueName.Spirituality))
                {
                    return(20);
                }

                if (VirtueHelper.IsFollower(m, VirtueName.Spirituality))
                {
                    return(10);
                }

                if (VirtueHelper.IsSeeker(m, VirtueName.Spirituality))
                {
                    return(5);
                }

                return(0);
            }
Beispiel #4
0
        private static void EmbraceHonor(PlayerMobile pm)
        {
            if (pm.HonorActive)
            {
                pm.SendLocalizedMessage(1063230);                   // You must wait awhile before you can embrace honor again.
                return;
            }

            int duration = GetHonorDuration(pm);

            if (duration == 0)
            {
                pm.SendLocalizedMessage(1063234);                   // You do not have enough honor to do that
                return;
            }

            TimeSpan waitTime = DateTime.UtcNow - pm.LastHonorUse;

            if (waitTime < UseDelay)
            {
                TimeSpan remainingTime    = UseDelay - waitTime;
                int      remainingMinutes = (int)Math.Ceiling(remainingTime.TotalMinutes);

                pm.SendLocalizedMessage(1063240, remainingMinutes.ToString());                   // You must wait ~1_HONOR_WAIT~ minutes before embracing honor again
                return;
            }

            int usedPoints = pm.Virtues.Honor / 20;

            VirtueHelper.Atrophy(pm, VirtueName.Honor, usedPoints);

            pm.HonorActive = true;
            pm.SendLocalizedMessage(1063235);               // You embrace your honor

            Timer.DelayCall(TimeSpan.FromSeconds(duration),
                            delegate()
            {
                pm.HonorActive  = false;
                pm.LastHonorUse = DateTime.UtcNow;
                pm.SendLocalizedMessage(1063236);                           // You no longer embrace your honor
            });
        }
Beispiel #5
0
        public static void OnVirtueUsed(Mobile from)
        {
            if (!from.CheckAlive())
            {
                return;
            }

            PlayerMobile protector = from as PlayerMobile;

            if (protector == null)
            {
                return;
            }

            Account acc = protector.Account as Account;

            if (acc == null || acc.Trial)
            {
                protector.SendLocalizedMessage(1111860);                   // Trial account players cannot offer protection to another player.
            }
            else if (!VirtueHelper.IsSeeker(protector, VirtueName.Justice))
            {
                protector.SendLocalizedMessage(1049610);                   // You must reach the first path in this virtue to invoke it.
            }
            else if (!protector.CanBeginAction(typeof(JusticeVirtue)))
            {
                protector.SendLocalizedMessage(1049370);                   // You must wait a while before offering your protection again.
            }
            else if (protector.JusticeProtectors.Count > 0)
            {
                protector.SendLocalizedMessage(1049542);                   // You cannot protect someone while being protected.
            }
            else if (protector.Map != Map.Felucca)
            {
                protector.SendLocalizedMessage(1049372);                   // You cannot use this ability here.
            }
            else
            {
                protector.BeginTarget(14, false, TargetFlags.None, new TargetCallback(OnVirtueTargeted));
                protector.SendLocalizedMessage(1049366);                   // Choose the player you wish to protect.
            }
        }
Beispiel #6
0
        public static void CheckAtrophy(Mobile from)
        {
            if (!(from is PlayerMobile pm))
            {
                return;
            }

            try
            {
                if (pm.LastCompassionLoss + LossDelay < DateTime.UtcNow)
                {
                    VirtueHelper.Atrophy(from, VirtueName.Compassion, LossAmount);
                    // OSI has no cliloc message for losing compassion.  Weird.
                    pm.LastCompassionLoss = DateTime.UtcNow;
                }
            }
            catch
            {
                // ignored
            }
        }
Beispiel #7
0
        public static void OnHeal(Mobile mobile, int amount)
        {
            int  points     = Math.Min(50, amount);
            bool gainedPath = false;

            if (VirtueHelper.Award(mobile, VirtueName.Spirituality, points, ref gainedPath))
            {
                if (gainedPath)
                {
                    mobile.SendLocalizedMessage(1155833); // You have gained a path in Spirituality!
                }
                else
                {
                    mobile.SendLocalizedMessage(1155832); // You have gained in Spirituality.
                }
            }
            else
            {
                mobile.SendLocalizedMessage(1155831); // You cannot gain more Spirituality.
            }
        }
Beispiel #8
0
        public static void CheckAtrophy(Mobile from)
        {
            PlayerMobile pm = from as PlayerMobile;

            if (pm == null)
            {
                return;
            }

            try
            {
                if ((pm.LastCompassionLoss + LossDelay) < DateTime.Now)
                {
                    VirtueHelper.Atrophy(from, VirtueName.Compassion);
                    pm.LastCompassionLoss = DateTime.Now;
                }
            }
            catch
            {
            }
        }
Beispiel #9
0
        public static void OnVirtueAccepted(PlayerMobile protector, PlayerMobile protectee)
        {
            if (!VirtueHelper.IsSeeker(protector, VirtueName.Justice))
            {
                protector.SendLocalizedMessage(1049610);                 // You must reach the first path in this virtue to invoke it.
            }
            else if (!protector.CanBeginAction(typeof(JusticeVirtue)))
            {
                protector.SendLocalizedMessage(1049370);                 // You must wait a while before offering your protection again.
            }
            else if (protector.JusticeProtectors.Count > 0)
            {
                protector.SendLocalizedMessage(1049542);                 // You cannot protect someone while being protected.
            }
            else if (protector.Map != Map.Felucca)
            {
                protector.SendLocalizedMessage(1049372);                 // You cannot use this ability here.
            }
            else if (protectee.Map != Map.Felucca)
            {
                protector.SendLocalizedMessage(1049372);                 // You cannot use this ability here.
            }
            else if (protectee == protector || protectee.Criminal || protectee.Murderer)
            {
                protector.SendLocalizedMessage(1049436);                 // That player cannot be protected.
            }
            else if (protectee.JusticeProtectors.Count > 0)
            {
                protector.SendLocalizedMessage(1049369);                 // You cannot protect that player right now.
            }
            else
            {
                protectee.JusticeProtectors.Add(protector);

                string args = string.Format("{0}\t{1}", protector.Name, protectee.Name);

                protectee.SendLocalizedMessage(1049451, args);                 // You are now being protected by ~1_NAME~.
                protector.SendLocalizedMessage(1049452, args);                 // You are now protecting ~2_NAME~.
            }
        }
Beispiel #10
0
        public static void Resurrect(Mobile from)
        {
            if (from.Alive)
            {
                return;
            }

            PlayerMobile pm = from as PlayerMobile;

            if (pm == null)
            {
                return;
            }

            if (from.Criminal)
            {
                from.SendLocalizedMessage(1052007);                   // You cannot use this ability while flagged as a criminal.
            }
            else if (!VirtueHelper.IsSeeker(from, VirtueName.Sacrifice))
            {
                from.SendLocalizedMessage(1052004);                   // You cannot use this ability.
            }
            else if (pm.AvailableResurrects <= 0)
            {
                from.SendLocalizedMessage(1052005);                   // You do not have any resurrections left.
            }
            else
            {
                /*
                 * We need to wait for them to accept the gump or they can just use
                 * Sacrifice and cancel to have items in their backpack for free.
                 */
                //from.CloseGump( typeof( ResurrectGump ) );
                //from.SendGump( new ResurrectGump( from, true ) );
                if (pm.NetState != null)
                {
                    new ResurrectMenu(pm).SendTo(pm.NetState);
                }
            }
        }
Beispiel #11
0
        public static void CheckAtrophy(Mobile from)
        {
            PlayerMobile pm = from as PlayerMobile;

            if (pm == null)
            {
                return;
            }

            try
            {
                if ((pm.LastCompassionLoss + LossDelay) < DateTime.Now)
                {
                    VirtueHelper.Atrophy(from, VirtueName.Compassion, LossAmount);
                    //OSI has no cliloc message for losing compassion.  Weird.
                    pm.LastCompassionLoss = DateTime.Now;
                }
            }
            catch
            {
            }
        }
Beispiel #12
0
        public static void CheckAtrophy(Mobile from)
        {
            if (!(from is PlayerMobile pm))
            {
                return;
            }

            try
            {
                if (pm.LastValorLoss + LossDelay < DateTime.UtcNow)
                {
                    if (VirtueHelper.Atrophy(from, VirtueName.Valor, LossAmount))
                    {
                        from.SendLocalizedMessage(1054040); // You have lost some Valor.
                    }
                    pm.LastValorLoss = DateTime.UtcNow;
                }
            }
            catch
            {
                // ignored
            }
        }
Beispiel #13
0
        public static void CheckAtrophy(Mobile from)
        {
            if (!(from is PlayerMobile pm))
            {
                return;
            }

            try
            {
                if (pm.LastJusticeLoss + LossDelay < Core.Now)
                {
                    if (VirtueHelper.Atrophy(from, VirtueName.Justice, LossAmount))
                    {
                        from.SendLocalizedMessage(1049373); // You have lost some Justice.
                    }

                    pm.LastJusticeLoss = Core.Now;
                }
            }
            catch
            {
                // ignored
            }
        }
Beispiel #14
0
		public static void CheckAtrophy( Mobile from )
		{
			PlayerMobile pm = from as PlayerMobile;

			if ( pm == null )
				return;

			try
			{
				if ( (pm.LastSacrificeLoss + LossDelay) < DateTime.Now )
				{
					if ( VirtueHelper.Atrophy( from, VirtueName.Sacrifice, LossAmount ) )
						from.SendLocalizedMessage( 1052041 ); // You have lost some Sacrifice.

					VirtueLevel level = VirtueHelper.GetLevel( from, VirtueName.Sacrifice );

					pm.AvailableResurrects = (int)level;
					pm.LastSacrificeLoss = DateTime.Now;
				}
			}
			catch
			{
			}
		}
Beispiel #15
0
        public static void CheckAtrophy(Mobile from)
        {
            PlayerMobile pm = from as PlayerMobile;

            if (pm == null)
            {
                return;
            }

            try
            {
                if ((pm.LastJusticeLoss + LossDelay) < DateTime.UtcNow)
                {
                    if (VirtueHelper.Atrophy(from, VirtueName.Justice, LossAmount))
                    {
                        from.SendLocalizedMessage(1049373);                         // You have lost some Justice.
                    }
                    pm.LastJusticeLoss = DateTime.UtcNow;
                }
            }
            catch
            {
            }
        }
Beispiel #16
0
        public static bool CheckValor(ChampionSpawn spawn, Mobile from)
        {
            VirtueLevel level = VirtueHelper.GetLevel(from, VirtueName.Valor);

            if (spawn != null && VirtueHelper.HasAny(from, VirtueName.Valor))
            {
                if (level <= VirtueLevel.Seeker && spawn.Level < 5)
                {
                    return(true);
                }

                if (level <= VirtueLevel.Follower && spawn.Level < 10)
                {
                    return(true);
                }

                if (level <= VirtueLevel.Knight && spawn.Level < 15)
                {
                    return(true);
                }
            }

            return(false);
        }
Beispiel #17
0
        public static void CheckAtrophy(Mobile from)
        {
            PlayerMobile pm = from as PlayerMobile;

            if (pm == null)
            {
                return;
            }

            try
            {
                if ((pm.LastValorLoss + LossDelay) < DateTime.Now)
                {
                    if (VirtueHelper.Atrophy(from, VirtueName.Valor, LossAmount))
                    {
                        from.SendLocalizedMessage(1054040);                           // You have lost some Valor.
                    }
                    pm.LastValorLoss = DateTime.Now;
                }
            }
            catch
            {
            }
        }
Beispiel #18
0
        public static void Valor(Mobile from, object targ)
        {
            IdolOfTheChampion idol = targ as IdolOfTheChampion;

            if (idol == null || idol.Deleted || idol.Spawn == null || idol.Spawn.Deleted)
            {
                from.SendLocalizedMessage(1054035);                   // You must target a Champion Idol to challenge the Champion's spawn!
            }
            else if (from.Hidden)
            {
                from.SendLocalizedMessage(1052015);                   // You cannot do that while hidden.
            }
            else if (idol.Spawn.HasBeenAdvanced)
            {
                from.SendLocalizedMessage(1054038);                   // The Champion of this region has already been challenged!
            }
            else
            {
                VirtueLevel vl = VirtueHelper.GetLevel(from, VirtueName.Valor);
                if (idol.Spawn.Active)
                {
                    if (idol.Spawn.Champion != null)                            //TODO: Message?
                    {
                        return;
                    }

                    int needed, consumed;
                    switch (idol.Spawn.GetSubLevel())
                    {
                    case 0:
                    {
                        needed = consumed = 2500;
                        break;
                    }

                    case 1:
                    {
                        needed = consumed = 5000;
                        break;
                    }

                    case 2:
                    {
                        needed   = 10000;
                        consumed = 7500;
                        break;
                    }

                    default:
                    {
                        needed   = 20000;
                        consumed = 10000;
                        break;
                    }
                    }

                    if (from.Virtues.GetValue((int)VirtueName.Valor) >= needed)
                    {
                        VirtueHelper.Atrophy(from, VirtueName.Valor, consumed);
                        from.SendLocalizedMessage(1054037);                           // Your challenge is heard by the Champion of this region! Beware its wrath!
                        idol.Spawn.HasBeenAdvanced = true;
                        idol.Spawn.AdvanceLevel();
                    }
                    else
                    {
                        from.SendLocalizedMessage(1054039);                           // The Champion of this region ignores your challenge. You must further prove your valor.
                    }
                }
                else
                {
                    if (vl == VirtueLevel.Knight)
                    {
                        VirtueHelper.Atrophy(from, VirtueName.Valor, 11000);
                        from.SendLocalizedMessage(1054037);                           // Your challenge is heard by the Champion of this region! Beware its wrath!
                        idol.Spawn.EndRestart();
                        idol.Spawn.HasBeenAdvanced = true;
                    }
                    else
                    {
                        from.SendLocalizedMessage(1054036);                           // You must be a Knight of Valor to summon the champion's spawn in this manner!
                    }
                }
            }
        }
Beispiel #19
0
        public VirtueInfoGump(Mobile beholder, VirtueName virtue, int description)
            : base(0, 0)
        {
            m_Beholder = beholder;
            m_Virtue   = virtue;
            m_Desc     = description;

            int value = beholder.Virtues.GetValue((int)virtue);

            AddPage(0);

            AddImage(30, 40, 2080);
            AddImage(47, 77, 2081);
            AddImage(47, 147, 2081);
            AddImage(47, 217, 2081);
            AddImage(47, 267, 2083);
            AddImage(70, 213, 2091);

            AddPage(1);

            int maxValue = VirtueHelper.GetMaxAmount(m_Virtue);

            int valueDesc;

            if (value < 1)
            {
                valueDesc = 1052044;                 // You have not started on the path of this Virtue.
            }
            else if (value < maxValue / 6)
            {
                valueDesc = 1052045;                 // You have barely begun your journey through the path of this Virtue.
            }
            else if (value < maxValue / 3)
            {
                valueDesc = 1052046;                 // You have progressed in this Virtue, but still have much to do.
            }
            else if (value < maxValue / 2)
            {
                valueDesc = 1052047;                 // Your journey through the path of this Virtue is going well.
            }
            else if (value < 2 * maxValue / 3)
            {
                valueDesc = 1052048;                 // You feel very close to achieving your next path in this Virtue.
            }
            else if (value < 5 * maxValue / 6)
            {
                valueDesc = 1052049;                 // You have achieved a path in this Virtue.
            }
            else
            {
                valueDesc = 1052050;                 // You have achieved the highest path in this Virtue.
            }
            AddHtmlLocalized(157, 73, 200, 40, 1051000 + (int)virtue, false, false);
            AddHtmlLocalized(75, 95, 220, 140, description, false, false);
            AddHtmlLocalized(70, 224, 229, 60, valueDesc, false, false);

            AddButton(65, 277, 1209, 1209, 1, GumpButtonType.Reply, 0);
            AddButton(280, 43, 4014, 4014, 2, GumpButtonType.Reply, 0);

            AddHtmlLocalized(83, 275, 400, 40, 1052055, false, false);           // This virtue is not yet defined.

            AddKRHtmlLocalized(0, 0, 0, 0, 1078056, false, false);               // MORE
            AddKRHtmlLocalized(0, 0, 0, 0, 1011447, false, false);               // BACK
            AddKRHtmlLocalized(0, 0, 0, 0, 1078055, false, false);               // USE

            AddKRHtmlLocalized(0, 0, 0, 0, 0, false, false);

            int dots;

            if (value < 4000)
            {
                dots = value / 400;
            }
            else if (value < 10000)
            {
                dots = (value - 4000) / 600;
            }
            else if (value < maxValue)
            {
                dots = (value - 10000) / ((maxValue - 10000) / 10);
            }
            else
            {
                dots = 10;
            }

            for (int i = 0; i < 10; ++i)
            {
                AddImage(95 + (i * 17), 50, i < dots ? 2362 : 2360);
            }
        }
        public static void Sacrifice(Mobile from, object targeted)
        {
            if (!from.CheckAlive())
            {
                return;
            }

            PlayerMobile pm = from as PlayerMobile;

            if (pm == null)
            {
                return;
            }

            Mobile targ = targeted as Mobile;

            if (targ == null)
            {
                return;
            }

            if (!ValidateCreature(targ))
            {
                from.SendLocalizedMessage(1052014);                   // You cannot sacrifice your fame for that creature.
            }
            else if (((targ.Hits * 100) / Math.Max(targ.HitsMax, 1)) < 90)
            {
                from.SendLocalizedMessage(1052013);                   // You cannot sacrifice for this monster because it is too damaged.
            }
            else if (from.Hidden)
            {
                from.SendLocalizedMessage(1052015);                   // You cannot do that while hidden.
            }
            else if (VirtueHelper.IsHighestPath(from, VirtueName.Sacrifice))
            {
                from.SendLocalizedMessage(1052068);                   // You have already attained the highest path in this virtue.
            }
            else if (from.Fame < 2500)
            {
                from.SendLocalizedMessage(1052017);                   // You do not have enough fame to sacrifice.
            }
            else if (DateTime.Now < (pm.LastSacrificeGain + GainDelay))
            {
                from.SendLocalizedMessage(1052016);                   // You must wait approximately one day before sacrificing again.
            }
            else
            {
                int toGain;

                if (from.Fame < 5000)
                {
                    toGain = 500;
                }
                else if (from.Fame < 10000)
                {
                    toGain = 1000;
                }
                else
                {
                    toGain = 2000;
                }

                from.Fame = 0;

                // I have seen the error of my ways!
                targ.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1052009);

                from.SendLocalizedMessage(1052010);                   // You have set the creature free.

                Timer.DelayCall(TimeSpan.FromSeconds(1.0), new TimerCallback(targ.Delete));

                pm.LastSacrificeGain = DateTime.Now;

                bool gainedPath = false;

                if (VirtueHelper.Award(from, VirtueName.Sacrifice, toGain, ref gainedPath))
                {
                    if (gainedPath)
                    {
                        from.SendLocalizedMessage(1052008);                           // You have gained a path in Sacrifice!

                        if (pm.AvailableResurrects < 3)
                        {
                            ++pm.AvailableResurrects;
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1054160);                           // You have gained in sacrifice.
                    }
                }

                from.SendLocalizedMessage(1052016);                   // You must wait approximately one day before sacrificing again.
            }
        }
        public static void Honor(Mobile from, object targeted)
        {
            if (!from.CheckAlive())
            {
                return;
            }

            Mobile targ = targeted as Mobile;

            if (targ == null)
            {
                return;
            }

            VirtueLevel level = VirtueHelper.GetLevel(from, VirtueName.Honor);

            if (targ == from)
            {
                if (CantEmbrace(from))
                {
                    from.SendLocalizedMessage(1063230);                       // You must wait awhile before you can embrace honor again.

                    return;
                }

                if (level < VirtueLevel.Seeker)
                {
                    from.SendLocalizedMessage(1063234);                       // You do not have enough honor to do that

                    return;
                }

                Timer t = (Timer)m_Table[from];

                if (t != null)
                {
                    t.Stop();
                }

                Timer t2 = (Timer)m_Table2[from];

                if (t2 != null)
                {
                    t.Stop();
                }

                double delay = 0;

                switch (level)
                {
                case VirtueLevel.Seeker:
                    delay = 60.0;
                    break;

                case VirtueLevel.Follower:
                    delay = 90.0;
                    break;

                case VirtueLevel.Knight:
                    delay = 120.0;
                    break;
                }

                m_Table[from] = t = Timer.DelayCall(TimeSpan.FromSeconds(delay), new TimerStateCallback(Expire_Callback), from);

                m_Table2[from] = t2 = Timer.DelayCall(TimeSpan.FromMinutes(5.0), new TimerStateCallback(Expire_Callback2), from);

                from.SendLocalizedMessage(1063235);                   // You embrace your honor

                if (VirtueHelper.Atrophy(from, VirtueName.Honor))
                {
                    from.SendLocalizedMessage(1063227);                       // You have lost some Honor.
                }
            }
            else
            {
                if (targ is BaseCreature)
                {
                    BaseCreature cr = targ as BaseCreature;

                    if (cr.HonorOpponent != null && cr.HonorOpponent != from)
                    {
                        from.SendLocalizedMessage(1063233);                           // Somebody else is honoring this opponent

                        return;
                    }
                }

                if (targ is PlayerMobile)
                {
                    PlayerMobile pm = targ as PlayerMobile;

                    if (pm.HonorOpponent != null && pm.HonorOpponent != from)
                    {
                        from.SendLocalizedMessage(1063233);                           // Somebody else is honoring this opponent

                        return;
                    }
                }

                if (VirtueHelper.IsHighestPath(from, VirtueName.Honor))
                {
                    from.SendLocalizedMessage(1063228);                       // You cannot gain more Honor.

                    return;
                }

                if (!from.InRange(targ.Location, 5))
                {
                    from.SendLocalizedMessage(1063232);                       // You are too far away to honor your opponent

                    return;
                }

                if (((targ.Hits * 100) / Math.Max(targ.HitsMax, 1)) < 85)
                {
                    from.SendLocalizedMessage(1063166);                       // You cannot honor this monster because it is too damaged.

                    return;
                }

                if (!NotorietyHandlers.Mobile_AllowHarmful(from, targ))
                {
                    return;
                }

                if (!from.CanSee(targ) || !from.InLOS(targ))
                {
                    return;
                }

                from.Direction = from.GetDirectionTo(targ.Location);

                from.Animate(32, 5, 1, true, false, 0);

                from.Say(1063231);                   // I honor you

                PlayerMobile player = from as PlayerMobile;

                player.HonorOpponent = targ;

                if (targ is BaseCreature)
                {
                    ((BaseCreature)targ).HonorOpponent = player;
                }

                if (targ is PlayerMobile)
                {
                    ((PlayerMobile)targ).HonorOpponent = player;
                }

                player.SpotHonor = player.Location;

                player.Perfection = 0;
            }
        }
Beispiel #22
0
        public static void OnVirtueUsed(Mobile from)
        {
            if (!from.Alive)
            {
                return;
            }

            if (VirtueHelper.GetLevel(from, VirtueName.Spirituality) < VirtueLevel.Seeker)
            {
                from.SendLocalizedMessage(1155829); // You must be a Seeker of Spirituality to invoke this Virtue.
            }
            else
            {
                from.SendLocalizedMessage(1155827); // Target whom you wish to embrace with your Spirituality
                from.BeginTarget(10, false, TargetFlags.None, (mobile, targeted) =>
                {
                    if (targeted is Mobile)
                    {
                        Mobile m = targeted as Mobile;

                        if (VirtueHelper.GetLevel(from, VirtueName.Spirituality) < VirtueLevel.Seeker)
                        {
                            from.SendLocalizedMessage(1155812); // You must be at least a Seeker of Humility to Invoke this ability.
                        }
                        else if (!m.Alive)
                        {
                            from.SendLocalizedMessage(1155828); // Thy target must be among the living.
                        }
                        else if (m is BaseCreature && !((BaseCreature)m).Controlled && !((BaseCreature)m).Summoned)
                        {
                            from.SendLocalizedMessage(1155837); // You can only embrace players and pets with Spirituality.
                        }
                        else if (IsEmbracee(m))
                        {
                            from.SendLocalizedMessage(1155836); // They are already embraced by Spirituality.
                        }
                        else if (m.MeleeDamageAbsorb > 0)
                        {
                            from.SendLocalizedMessage(1156039); // You may not use the Spirituality Virtue while the Attunement spell is active.
                        }
                        else if (m is BaseCreature || m is PlayerMobile)
                        {
                            SpiritualityContext context = new SpiritualityContext(from, m);
                            ActiveTable[from]           = context;

                            m.SendLocalizedMessage(1155839);                                                                                                                              // Your spirit has been embraced! You feel more powerful!
                            from.SendLocalizedMessage(1155835);                                                                                                                           // You have lost some Spirituality.

                            BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Spirituality, 1155824, 1155825, String.Format("{0}\t{1}", context.Reduction.ToString(), context.Pool.ToString()))); // ~1_VAL~% Reduction to Incoming Damage<br>~2_VAL~ Shield HP Remaining

                            VirtueHelper.Atrophy(from, VirtueName.Spirituality, 3200);

                            Timer.DelayCall(TimeSpan.FromMinutes(20), () =>
                            {
                                if (ActiveTable != null && ActiveTable.ContainsKey(from))
                                {
                                    ActiveTable.Remove(from);
                                    m.SendLocalizedMessage(1155840); // Your spirit is no longer embraced. You feel less powerful.
                                    BuffInfo.RemoveBuff(m, BuffIcon.Spirituality);
                                }
                            });
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1155837); // You can only embrace players and pets with Spirituality.
                    }
                });
            }
        }
Beispiel #23
0
        public VirtueInfoGump(Mobile beholder, VirtueName virtue, int description, string webPage = null) : base(0, 0)
        {
            m_Beholder = beholder;
            m_Virtue   = virtue;
            m_Desc     = description;
            m_Page     = webPage;

            var value = beholder.Virtues.GetValue((int)virtue);

            AddPage(0);

            AddImage(30, 40, 2080);
            AddImage(47, 77, 2081);
            AddImage(47, 147, 2081);
            AddImage(47, 217, 2081);
            AddImage(47, 267, 2083);
            AddImage(70, 213, 2091);

            AddPage(1);

            var maxValue = VirtueHelper.GetMaxAmount(m_Virtue);

            int valueDesc;
            int dots;

            if (value < 4000)
            {
                dots = value / 400;
            }
            else if (value < 10000)
            {
                dots = (value - 4000) / 600;
            }
            else if (value < maxValue)
            {
                dots = (value - 10000) / ((maxValue - 10000) / 10);
            }
            else
            {
                dots = 10;
            }

            for (var i = 0; i < 10; ++i)
            {
                AddImage(95 + i * 17, 50, i < dots ? 2362 : 2360);
            }

            if (value < 1)
            {
                valueDesc = 1052044; // You have not started on the path of this Virtue.
            }
            else if (value < 400)
            {
                valueDesc = 1052045; // You have barely begun your journey through the path of this Virtue.
            }
            else if (value < 2000)
            {
                valueDesc = 1052046; // You have progressed in this Virtue, but still have much to do.
            }
            else if (value < 3600)
            {
                valueDesc = 1052047; // Your journey through the path of this Virtue is going well.
            }
            else if (value < 4000)
            {
                valueDesc = 1052048; // You feel very close to achieving your next path in this Virtue.
            }
            else if (dots < 1)
            {
                valueDesc = 1052049; // You have achieved a path in this Virtue.
            }
            else if (dots < 9)
            {
                valueDesc = 1052047; // Your journey through the path of this Virtue is going well.
            }
            else if (dots < 10)
            {
                valueDesc = 1052048; // You feel very close to achieving your next path in this Virtue.
            }
            else
            {
                valueDesc = 1052050; // You have achieved the highest path in this Virtue.
            }
            AddHtmlLocalized(157, 73, 200, 40, 1051000 + (int)virtue);
            AddHtmlLocalized(75, 95, 220, 140, description);
            AddHtmlLocalized(70, 224, 229, 60, valueDesc);

            AddButton(65, 277, 1209, 1209, 1);

            AddButton(280, 43, 4014, 4014, 2);

            AddHtmlLocalized(
                83,
                275,
                400,
                40,
                webPage == null ? 1052055 : 1052052
                ); // This virtue is not yet defined. OR -click to learn more (opens webpage)
        }
Beispiel #24
0
        public static void OnVirtueUsed(Mobile from)
        {
            if (VirtueHelper.GetLevel(from, VirtueName.Humility) < VirtueLevel.Seeker)
            {
                from.SendLocalizedMessage(1155812); // You must be at least a Seeker of Humility to Invoke this ability.
            }
            else if (from.Alive)
            {
                from.SendLocalizedMessage(1155817); // Target the pet you wish to embrace with your Humility.
                from.BeginTarget(10, false, Server.Targeting.TargetFlags.None, (m, targeted) =>
                {
                    if (targeted is BaseCreature)
                    {
                        BaseCreature bc = targeted as BaseCreature;

                        if (!bc.Alive)
                        {
                            from.SendLocalizedMessage(1155815); // You cannot embrace Humility on the dead!
                        }
                        else if (VirtueHelper.GetLevel(m, VirtueName.Humility) < VirtueLevel.Seeker)
                        {
                            from.SendLocalizedMessage(1155812); // You must be at least a Seeker of Humility to Invoke this ability.
                        }
                        else if (!bc.Controlled && !bc.Summoned)
                        {
                            from.SendLocalizedMessage(1155813); // You can only embrace your Humility on a pet.
                        }
                        else if (ActiveTable.ContainsKey(bc))
                        {
                            from.SendLocalizedMessage(1156047); // That pet has already embraced Humility.
                        }
                        else
                        {
                            VirtueHelper.Atrophy(from, VirtueName.Humility, 3200);
                            from.SendLocalizedMessage(1155818); // You have lost some Humility.

                            ActiveTable[bc] = from;

                            m.PrivateOverheadMessage(Server.Network.MessageType.Regular, 1150, 1155819, from.NetState); // *Your pet surges with the power of your Humility!*
                            bc.FixedEffect(0x373A, 10, 16);

                            BuffInfo.AddBuff(from, new BuffInfo(BuffIcon.Humility, 1156049, 1156050, TimeSpan.FromMinutes(20), from, String.Format("{0}\t{1}", bc.Name, GetRegenBonus(bc)))); // Pet: ~1_NAME~<br>+~2_VAL~ HPR<br>

                            CheckTimer();
                            bc.ResetStatTimers();

                            Timer.DelayCall(TimeSpan.FromMinutes(20), (o) =>
                            {
                                Mobile mob = o as Mobile;

                                if (mob != null && ActiveTable.ContainsKey(mob))
                                {
                                    Mobile user = ActiveTable[mob];
                                    ActiveTable.Remove(mob);

                                    BuffInfo.RemoveBuff(user, BuffIcon.Humility);
                                    user.PrivateOverheadMessage(Server.Network.MessageType.Regular, 1150, 1155823, from.NetState); // *Your pet's power returns to normal*

                                    CheckTimer();
                                }
                            }, bc);
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1155813); // You can only embrace your Humility on a pet.
                    }
                });
            }
        }
Beispiel #25
0
        public static void Valor(Mobile from, object targeted)
        {
            if (!from.CheckAlive())
            {
                return;
            }

            IdolOfTheChampion idol = targeted as IdolOfTheChampion;

            if (idol == null || idol.Deleted || idol.Spawn == null || idol.Spawn.Deleted)
            {
                from.SendLocalizedMessage(1054035);                   // You must target a Champion Idol to challenge the Champion's spawn!
            }
            else if (from.Hidden)
            {
                from.SendLocalizedMessage(1052015);                   // You cannot do that while hidden.
            }
            else if (idol.Spawn.HasBeenAdvanced)
            {
                from.SendLocalizedMessage(1054038);                   // The Champion of this region has already been challenged!
            }
            else
            {
                if (idol.Spawn.Active)
                {
                    if (idol.Spawn.Champion != null)
                    {
                        from.SendLocalizedMessage(1054038);                           // The Champion of this region has already been challenged!
                        return;
                    }

                    int needed, consumed;
                    switch (idol.Spawn.GetSubLevel())
                    {
                    case 0:
                    {
                        needed   = 2500;
                        consumed = 2500;
                        break;
                    }

                    case 1:
                    {
                        needed   = 5000;
                        consumed = 5000;
                        break;
                    }

                    case 2:
                    {
                        needed   = 10000;
                        consumed = 7500;
                        break;
                    }

                    default:
                    {
                        needed   = 20000;
                        consumed = 10000;
                        break;
                    }
                    }

                    if (from.Virtues.GetValue((int)VirtueName.Valor) >= needed)
                    {
                        VirtueHelper.Atrophy(from, VirtueName.Valor, consumed);
                        from.SendLocalizedMessage(1054040);                           // You have lost some Valor.

                        // Your challenge is heard by the Champion of this region! Beware its wrath!
                        idol.PublicOverheadMessage(Network.MessageType.Regular, 0x3B2, 1054037, "");
                        idol.Spawn.HasBeenAdvanced = true;
                        idol.Spawn.AdvanceLevel();
                    }
                    else
                    {
                        from.SendLocalizedMessage(1054039);                           // The Champion of this region ignores your challenge. You must further prove your valor.
                    }
                }
                else
                {
                    VirtueLevel level = VirtueHelper.GetLevel(from, VirtueName.Valor);

                    if (level >= VirtueLevel.Knight)
                    {
                        idol.Spawn.Active = true;

                        if (idol.Spawn.RandomizeType)
                        {
                            switch (Utility.Random(5))
                            {
                            case 0:
                                idol.Spawn.Type = ChampionSpawnType.VerminHorde;
                                break;

                            case 1:
                                idol.Spawn.Type = ChampionSpawnType.UnholyTerror;
                                break;

                            case 2:
                                idol.Spawn.Type = ChampionSpawnType.ColdBlood;
                                break;

                            case 3:
                                idol.Spawn.Type = ChampionSpawnType.Abyss;
                                break;

                            case 4:
                                idol.Spawn.Type = ChampionSpawnType.Arachnid;
                                break;
                            }
                        }

                        // It's strange, but at OSI Valor not only activate spawn but also increase 2-4 levels on it.
                        // If counts of increased levels less than 4, champion spawn can be used with Valor again for advance level.
                        int candles = Utility.RandomMinMax(2, 4);
                        idol.Spawn.Level = candles;
                        if (candles > 3)
                        {
                            idol.Spawn.HasBeenAdvanced = true;
                        }

                        VirtueHelper.Atrophy(from, VirtueName.Valor, 11000);
                        from.SendLocalizedMessage(1054040);                           // You have lost some Valor.

                        // Your challenge is heard by the Champion of this region! Beware its wrath!
                        idol.PublicOverheadMessage(Network.MessageType.Regular, 0x3B2, 1054037, "");
                    }
                    else
                    {
                        from.SendLocalizedMessage(1054036);                           // You must be a Knight of Valor to summon the champion's spawn in this manner!
                    }
                }
            }
        }
Beispiel #26
0
        public static void Valor(Mobile from, object targ)
        {
            IdolOfTheChampion idol = targ as IdolOfTheChampion;
            VirtueLevel       vl   = VirtueHelper.GetLevel(from, VirtueName.Valor);

            if (idol == null || idol.Deleted || idol.Spawn == null || idol.Spawn.Deleted)
            {
                from.SendLocalizedMessage(1054035);                   // You must target a Champion Idol to challenge the Champion's spawn!
            }
            else if (from.Hidden)
            {
                from.SendLocalizedMessage(1052015);                   // You cannot do that while hidden.
            }
            else if (idol.Spawn.OneAdvance == true)
            {
                from.SendMessage("You have already advanced this Champion Spawn!");
            }
            else if (idol.Spawn.OneAdvance == false && idol.Spawn.Active)
            {
                if (vl == VirtueLevel.Follower)
                {
                    VirtueHelper.Atrophy(from, VirtueName.Valor, 5000);
                    idol.Spawn.AdvanceLevel();
                    idol.Spawn.OneAdvance = true;
                }
                else
                {
                    from.SendMessage("You must be a Follower of Valor to advance this Champ Spawn any further.");
                }
            }
            else if (idol.Spawn.HasBeenAdvanced)
            {
                from.SendLocalizedMessage(1054038);                   // The Champion of this region has already been challenged!
            }
            else
            {
                //VirtueLevel vl = VirtueHelper.GetLevel( from, VirtueName.Valor );
                if (idol.Spawn.Active)
                {
                    if (idol.Spawn.Champion != null)                            //TODO: Message?
                    {
                        return;
                    }

                    int needed, consumed;
                    switch (idol.Spawn.GetSubLevel())
                    {
                    case 0:
                    {
                        needed = consumed = 2500;
                        break;
                    }

                    case 1:
                    {
                        needed = consumed = 5000;
                        break;
                    }

                    case 2:
                    {
                        needed   = 10000;
                        consumed = 7500;
                        break;
                    }

                    default:
                    {
                        needed   = 20000;
                        consumed = 10000;
                        break;
                    }
                    }

                    if (from.Virtues.GetValue((int)VirtueName.Valor) >= needed)
                    {
                        VirtueHelper.Atrophy(from, VirtueName.Valor, consumed);
                        from.SendLocalizedMessage(1054037); // Your challenge is heard by the Champion of this region! Beware its wrath!
                        idol.Spawn.HasBeenAdvanced = true;
                        idol.Spawn.AdvanceLevel();
                        int skulls = Utility.RandomMinMax(1, 3);
                        Console.WriteLine("Random Was = " + skulls);
                        while (skulls <= 3)
                        {
                            idol.Spawn.AdvanceLevel();
                            skulls++;
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1054039); // The Champion of this region ignores your challenge. You must further prove your valor.
                    }
                }
                else
                {
                    if (vl == VirtueLevel.Knight)
                    {
                        VirtueHelper.Atrophy(from, VirtueName.Valor, 11000);
                        from.SendLocalizedMessage(1054037); // Your challenge is heard by the Champion of this region! Beware its wrath!
                        idol.Spawn.EndRestart();
                        idol.Spawn.HasBeenAdvanced = true;
                        idol.Spawn.AdvanceLevel();
                        int skulls = Utility.RandomMinMax(1, 3);
                        Console.WriteLine("Random Was = " + skulls);
                        while (skulls <= 3)
                        {
                            idol.Spawn.AdvanceLevel();
                            skulls++;
                        }
                        Console.WriteLine("This Gets Called Now.");
                    }
                    else
                    {
                        from.SendLocalizedMessage(1054036); // You must be a Knight of Valor to summon the champion's spawn in this manner!
                    }
                }
            }
        }
Beispiel #27
0
        public static void Valor(Mobile from, object targeted)
        {
            if (!from.CheckAlive())
            {
                return;
            }

            ChampionIdol targ = targeted as ChampionIdol;

            if (targ == null)
            {
                return;
            }

            VirtueLevel level = VirtueHelper.GetLevel(from, VirtueName.Valor);

            int current = from.Virtues.GetValue((int)VirtueName.Valor);

            if (targ.Spawn.IsValorUsed)
            {
                from.SendLocalizedMessage(1054038);                   // The Champion of this region has already been challenged!
                return;
            }

            if (!targ.Spawn.Active)
            {
                if (level >= VirtueLevel.Knight)
                {
                    targ.Spawn.Active = true;

                    if (targ.Spawn.RandomizeType)
                    {
                        switch (Utility.Random(5))
                        {
                        case 0:
                            targ.Spawn.Type = ChampionSpawnType.VerminHorde;
                            break;

                        case 1:
                            targ.Spawn.Type = ChampionSpawnType.UnholyTerror;
                            break;

                        case 2:
                            targ.Spawn.Type = ChampionSpawnType.ColdBlood;
                            break;

                        case 3:
                            targ.Spawn.Type = ChampionSpawnType.Abyss;
                            break;

                        case 4:
                            targ.Spawn.Type = ChampionSpawnType.Arachnid;
                            break;
                        }
                    }

                    // It's strange, but at OSI Valor not only activate spawn but also increase 2-4 levels on it.
                    // If counts of increased levels less than 4, champion spawn can be used with Valor again for advance level.
                    int candles = Utility.RandomMinMax(2, 4);
                    targ.Spawn.Level = candles;
                    if (candles > 3)
                    {
                        targ.Spawn.IsValorUsed = true;
                    }

                    // on Stratics written:
                    // The player will sacrifice a large portion of his Valor in order to activate a champion spawn shrine.
                    // Really, player become Follower of Valor instead Knight
                    from.Virtues.SetValue((int)VirtueName.Valor, 29);

                    // Your challenge is heard by the Champion of this region! Beware its wrath!
                    targ.PublicOverheadMessage(Network.MessageType.Regular, 0x3B2, 1054037, "");

                    from.SendLocalizedMessage(1054040);                       // You have lost some Valor.
                }
                else
                {
                    from.SendLocalizedMessage(1054036);                       // You must be a Knight of Valor to summon the champion's spawn in this manner!
                }
            }
            else
            {
                if (targ.Spawn.Champion == null)
                {
                    if (CheckValor(targ.Spawn, from))
                    {
                        int sacrifice_advance_level = 0;

                        if (targ.Spawn.Level < 5)
                        {
                            sacrifice_advance_level = 5;
                        }

                        if (targ.Spawn.Level >= 5 && targ.Spawn.Level < 10)
                        {
                            sacrifice_advance_level = 10;
                        }

                        if (targ.Spawn.Level >= 10 && targ.Spawn.Level < 15)
                        {
                            sacrifice_advance_level = 15;
                        }

                        if (sacrifice_advance_level > current)
                        {
                            sacrifice_advance_level = current;
                        }

                        targ.Spawn.Level += 1;

                        from.Virtues.SetValue((int)VirtueName.Valor, current - sacrifice_advance_level);

                        // Your challenge is heard by the Champion of this region! Beware its wrath!
                        targ.PublicOverheadMessage(Network.MessageType.Regular, 0x3B2, 1054037, "");

                        from.SendLocalizedMessage(1054040);                           // You have lost some Valor.

                        targ.Spawn.IsValorUsed = true;
                    }
                    else
                    {
                        from.SendLocalizedMessage(1054039);                           // The Champion of this region ignores your challenge. You must further prove your valor.
                    }

                    if (targ.Spawn.Level >= 15 && level >= VirtueLevel.Knight)
                    {
                        if (0.03 >= Utility.RandomDouble())                           // TODO: verify
                        {
                            // Your challenge is heard by the Champion of this region! Beware its wrath!
                            targ.PublicOverheadMessage(Network.MessageType.Regular, 0x3B2, 1054037, "");

                            targ.Spawn.SpawnChampion();

                            from.Virtues.SetValue((int)VirtueName.Valor, 0);

                            from.SendLocalizedMessage(1054040);                               // You have lost some Valor.

                            targ.Spawn.IsValorUsed = true;
                        }
                        else
                        {
                            from.SendLocalizedMessage(1054039);                               // The Champion of this region ignores your challenge. You must further prove your valor.
                        }
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1054038);                       // The Champion of this region has already been challenged!
                }
            }
        }