Beispiel #1
0
        public static void OnVirtueTargeted(Mobile from, object obj)
        {
            PlayerMobile protector = from as PlayerMobile;
            PlayerMobile pm        = obj as PlayerMobile;

            if (protector == null)
            {
                return;
            }

            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 (pm == null)
            {
                protector.SendLocalizedMessage(1049678); // Only players can be protected.
            }
            else if (pm.Map != Map.Felucca)
            {
                protector.SendLocalizedMessage(1049372); // You cannot use this ability here.
            }
            else if (pm == protector || pm.Criminal || pm.Kills >= 5)
            {
                protector.SendLocalizedMessage(1049436); // That player cannot be protected.
            }
            else if (pm.JusticeProtectors.Count > 0)
            {
                protector.SendLocalizedMessage(1049369); // You cannot protect that player right now.
            }
            else if (pm.HasGump(typeof(AcceptProtectorGump)))
            {
                protector.SendLocalizedMessage(1049369); // You cannot protect that player right now.
            }
            else
            {
                pm.SendGump(new AcceptProtectorGump(protector, pm));
            }
        }
Beispiel #2
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.Kills >= 5)
            {
                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 #3
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));
            }
        }
Beispiel #4
0
        public static void OnVirtueUsed(Mobile from)
        {
            if (!from.CheckAlive())
            {
                return;
            }

            PlayerMobile protector = from as PlayerMobile;

            if (protector == null)
            {
                return;
            }

            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.
            }
        }