Ejemplo n.º 1
0
        public static void GiveScrollTo(Mobile killer, SpecialScroll scroll)
        {
            if (scroll == null || killer == null)               //sanity
            {
                return;
            }

            if (scroll is ScrollofTranscendence)
            {
                killer.SendLocalizedMessage(1094936);                   // You have received a Scroll of Transcendence!
            }
            else
            {
                killer.SendLocalizedMessage(1049524);                   // You have received a scroll of power!
            }
            if (killer.Alive)
            {
                killer.AddToBackpack(scroll);
            }
            else
            {
                if (killer.Corpse != null && !killer.Corpse.Deleted)
                {
                    killer.Corpse.DropItem(scroll);
                }
                else
                {
                    killer.AddToBackpack(scroll);
                }
            }

            // Justice reward
            PlayerMobile pm = (PlayerMobile)killer;

            for (int j = 0; j < pm.JusticeProtectors.Count; ++j)
            {
                Mobile prot = (Mobile)pm.JusticeProtectors[j];

                if (prot.Map != killer.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion(killer, prot))
                {
                    continue;
                }

                int chance = 0;

                switch (VirtueHelper.GetLevel(prot, VirtueName.Justice))
                {
                case VirtueLevel.Seeker: chance = 60; break;

                case VirtueLevel.Follower: chance = 80; break;

                case VirtueLevel.Knight: chance = 100; break;
                }

                if (chance > Utility.Random(100))
                {
                    try
                    {
                        prot.SendLocalizedMessage(1049368);                           // You have been rewarded for your dedication to Justice!

                        SpecialScroll scrollDupe = Activator.CreateInstance(scroll.GetType()) as SpecialScroll;

                        if (scrollDupe != null)
                        {
                            scrollDupe.Skill = scroll.Skill;
                            scrollDupe.Value = scroll.Value;
                            prot.AddToBackpack(scrollDupe);
                        }
                    }
                    catch {}
                }
            }
        }
Ejemplo n.º 2
0
        public static void GivePowerScrollTo(Mobile m, PowerScroll ps)
        {
            if (ps == null || m == null)                //sanity
            {
                return;
            }

            m.SendLocalizedMessage(1049524);               // You have received a scroll of power!

            if (!Core.SE || m.Alive)
            {
                m.AddToBackpack(ps);
            }
            else
            {
                if (m.Corpse != null && !m.Corpse.Deleted)
                {
                    m.Corpse.DropItem(ps);
                }
                else
                {
                    m.AddToBackpack(ps);
                }
            }

            if (m is PlayerMobile)
            {
                PlayerMobile pm = (PlayerMobile)m;

                for (int j = 0; j < pm.JusticeProtectors.Count; ++j)
                {
                    Mobile prot = pm.JusticeProtectors[j];

                    if (prot.Map != m.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion(m, prot))
                    {
                        continue;
                    }

                    int chance = 0;

                    switch (VirtueHelper.GetLevel(prot, VirtueName.Justice))
                    {
                    case VirtueLevel.Seeker: chance = 60; break;

                    case VirtueLevel.Follower: chance = 80; break;

                    case VirtueLevel.Knight: chance = 100; break;
                    }

                    if (chance > Utility.Random(100))
                    {
                        PowerScroll powerScroll = new PowerScroll(ps.Skill, ps.Value);

                        prot.SendLocalizedMessage(1049368);                           // You have been rewarded for your dedication to Justice!

                        if (!Core.SE || prot.Alive)
                        {
                            prot.AddToBackpack(powerScroll);
                        }
                        else
                        {
                            if (prot.Corpse != null && !prot.Corpse.Deleted)
                            {
                                prot.Corpse.DropItem(powerScroll);
                            }
                            else
                            {
                                prot.AddToBackpack(powerScroll);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public static void GivePowerScrollTo(Mobile m, Item item, BaseChampion champ)
        {
            if (m == null)      //sanity
            {
                return;
            }

            if (!Core.SE || m.Alive)
            {
                m.AddToBackpack(item);
            }
            else
            {
                if (m.Corpse != null && !m.Corpse.Deleted)
                {
                    m.Corpse.DropItem(item);
                }
                else
                {
                    m.AddToBackpack(item);
                }
            }

            if (item is PowerScroll && m is PlayerMobile)
            {
                PlayerMobile pm = (PlayerMobile)m;

                for (int j = 0; j < pm.JusticeProtectors.Count; ++j)
                {
                    Mobile prot = pm.JusticeProtectors[j];

                    if (prot.Map != m.Map || prot.Murderer || prot.Criminal || !JusticeVirtue.CheckMapRegion(m, prot) || !prot.InRange(champ, 100))
                    {
                        continue;
                    }

                    int chance = 0;

                    switch (VirtueHelper.GetLevel(prot, VirtueName.Justice))
                    {
                    case VirtueLevel.Seeker:
                        chance = 60;
                        break;

                    case VirtueLevel.Follower:
                        chance = 80;
                        break;

                    case VirtueLevel.Knight:
                        chance = 100;
                        break;
                    }

                    if (chance > Utility.Random(100))
                    {
                        PowerScroll powerScroll = CreateRandomPowerScroll();

                        prot.SendLocalizedMessage(1049368); // You have been rewarded for your dedication to Justice!

                        if (!Core.SE || prot.Alive)
                        {
                            prot.AddToBackpack(powerScroll);
                        }
                        else
                        {
                            if (prot.Corpse != null && !prot.Corpse.Deleted)
                            {
                                prot.Corpse.DropItem(powerScroll);
                            }
                            else
                            {
                                prot.AddToBackpack(powerScroll);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
        public void GivePowerScrolls()
        {
            ArrayList toGive = new ArrayList();
            ArrayList rights = BaseCreature.GetLootingRights(this.DamageEntries, this.HitsMax);

            for (int i = rights.Count - 1; i >= 0; --i)
            {
                DamageStore ds = (DamageStore)rights[i];

                if (ds.m_HasRight)
                {
                    toGive.Add(ds.m_Mobile);
                }
            }

            if (toGive.Count == 0)
            {
                return;
            }

            // Randomize
            for (int i = 0; i < toGive.Count; ++i)
            {
                int    rand = Utility.Random(toGive.Count);
                object hold = toGive[i];
                toGive[i]    = toGive[rand];
                toGive[rand] = hold;
            }

            for (int i = 0; i < 16; ++i)
            {
                int    level;
                double random = Utility.RandomDouble();

                if (0.1 >= random)
                {
                    level = 25;
                }
                else if (0.25 >= random)
                {
                    level = 20;
                }
                else if (0.45 >= random)
                {
                    level = 15;
                }
                else if (0.70 >= random)
                {
                    level = 10;
                }
                else
                {
                    level = 5;
                }

                Mobile m = (Mobile)toGive[i % toGive.Count];

                m.SendLocalizedMessage(1049524);                   // You have received a scroll of power!
                m.AddToBackpack(new StatCapScroll(225 + level));

                if (m is PlayerMobile)
                {
                    PlayerMobile pm = (PlayerMobile)m;

                    for (int j = 0; j < pm.JusticeProtectors.Count; ++j)
                    {
                        Mobile prot = (Mobile)pm.JusticeProtectors[j];

                        if (prot.Map != m.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion(m, prot))
                        {
                            continue;
                        }

                        int chance = 0;

                        switch (VirtueHelper.GetLevel(prot, VirtueName.Justice))
                        {
                        case VirtueLevel.Seeker: chance = 60; break;

                        case VirtueLevel.Follower: chance = 80; break;

                        case VirtueLevel.Knight: chance = 100; break;
                        }

                        if (chance > Utility.Random(100))
                        {
                            prot.SendLocalizedMessage(1049368);                               // You have been rewarded for your dedication to Justice!
                            prot.AddToBackpack(new StatCapScroll(225 + level));
                        }
                    }
                }
            }
        }
Ejemplo n.º 5
0
        public static void GivePowerScrollTo(Mobile m, PowerScroll ps)
        {
            if (ps == null || m == null) // sanity
            {
                return;
            }

            m.SendLocalizedMessage(1049524); // You have received a scroll of power!

            if (!Core.SE || m.Alive)
            {
                m.AddToBackpack(ps);
            }
            else
            {
                if (m.Corpse?.Deleted == false)
                {
                    m.Corpse.DropItem(ps);
                }
                else
                {
                    m.AddToBackpack(ps);
                }
            }

            if (!(m is PlayerMobile pm))
            {
                return;
            }

            for (var j = 0; j < pm.JusticeProtectors.Count; ++j)
            {
                var prot = pm.JusticeProtectors[j];

                if (prot.Map != pm.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion(pm, prot))
                {
                    continue;
                }

                var chance = VirtueHelper.GetLevel(prot, VirtueName.Justice) switch
                {
                    VirtueLevel.Seeker => 60,
                    VirtueLevel.Follower => 80,
                    VirtueLevel.Knight => 100,
                    _ => 0
                };

                if (chance > Utility.Random(100))
                {
                    var powerScroll = new PowerScroll(ps.Skill, ps.Value);

                    prot.SendLocalizedMessage(1049368); // You have been rewarded for your dedication to Justice!

                    if (!Core.SE || prot.Alive)
                    {
                        prot.AddToBackpack(powerScroll);
                    }
                    else
                    {
                        if (prot.Corpse?.Deleted == false)
                        {
                            prot.Corpse.DropItem(powerScroll);
                        }
                        else
                        {
                            prot.AddToBackpack(powerScroll);
                        }
                    }
                }
            }
        }
Ejemplo n.º 6
0
        public void GivePowerScrolls()
        {
            var toGive = new List <Mobile>();
            var rights = GetLootingRights(DamageEntries, HitsMax);

            for (var i = rights.Count - 1; i >= 0; --i)
            {
                var ds = rights[i];

                if (ds.m_HasRight)
                {
                    toGive.Add(ds.m_Mobile);
                }
            }

            if (toGive.Count == 0)
            {
                return;
            }

            toGive.Shuffle();

            for (var i = 0; i < 16; ++i)
            {
                int level;
                var random = Utility.RandomDouble();

                if (random <= 0.1)
                {
                    level = 25;
                }
                else if (random <= 0.25)
                {
                    level = 20;
                }
                else if (random <= 0.45)
                {
                    level = 15;
                }
                else if (random <= 0.70)
                {
                    level = 10;
                }
                else
                {
                    level = 5;
                }

                var m = toGive[i % toGive.Count];

                m.SendLocalizedMessage(1049524); // You have received a scroll of power!
                m.AddToBackpack(new StatCapScroll(225 + level));

                if (m is PlayerMobile pm)
                {
                    for (var j = 0; j < pm.JusticeProtectors.Count; ++j)
                    {
                        var prot = pm.JusticeProtectors[j];

                        if (prot.Map != pm.Map || prot.Kills >= 5 || prot.Criminal ||
                            !JusticeVirtue.CheckMapRegion(pm, prot))
                        {
                            continue;
                        }

                        var chance = VirtueHelper.GetLevel(prot, VirtueName.Justice) switch
                        {
                            VirtueLevel.Seeker => 60,
                            VirtueLevel.Follower => 80,
                            VirtueLevel.Knight => 100,
                            _ => 0
                        };

                        if (chance > Utility.Random(100))
                        {
                            prot.SendLocalizedMessage(1049368); // You have been rewarded for your dedication to Justice!
                            prot.AddToBackpack(new StatCapScroll(225 + level));
                        }
                    }
                }
            }
        }
Ejemplo n.º 7
0
        public void GivePowerScrolls()
        {
            List <Mobile>      toGive = new List <Mobile>();
            List <DamageStore> rights = GetLootingRights();

            for (int i = rights.Count - 1; i >= 0; --i)
            {
                DamageStore ds = rights[i];

                if (ds.m_HasRight)
                {
                    toGive.Add(ds.m_Mobile);
                }
            }

            if (toGive.Count == 0)
            {
                return;
            }

            // Randomize
            for (int i = 0; i < toGive.Count; ++i)
            {
                int    rand = Utility.Random(toGive.Count);
                Mobile hold = toGive[i];
                toGive[i]    = toGive[rand];
                toGive[rand] = hold;
            }

            for (int i = 0; i < ChampionSystem.StatScrollAmount; ++i)
            {
                Mobile m = toGive[i % toGive.Count];

                m.SendLocalizedMessage(1049524); // You have received a scroll of power!
                m.AddToBackpack(new StatCapScroll(m_StatCap + RandomStatScrollLevel()));

                if (m is PlayerMobile)
                {
                    PlayerMobile pm = (PlayerMobile)m;

                    for (int j = 0; j < pm.JusticeProtectors.Count; ++j)
                    {
                        Mobile prot = pm.JusticeProtectors[j];

                        if (prot.Map != m.Map || prot.Murderer || prot.Criminal || !JusticeVirtue.CheckMapRegion(m, prot))
                        {
                            continue;
                        }

                        int chance = 0;

                        switch (VirtueHelper.GetLevel(prot, VirtueName.Justice))
                        {
                        case VirtueLevel.Seeker:
                            chance = 60;
                            break;

                        case VirtueLevel.Follower:
                            chance = 80;
                            break;

                        case VirtueLevel.Knight:
                            chance = 100;
                            break;
                        }

                        if (chance > Utility.Random(100))
                        {
                            prot.SendLocalizedMessage(1049368); // You have been rewarded for your dedication to Justice!
                            prot.AddToBackpack(new StatCapScroll(m_StatCap + RandomStatScrollLevel()));
                        }
                    }
                }
            }
        }
Ejemplo n.º 8
0
        public void GivePowerScrolls(ArrayList toGive)
        {
            if (NoKillAwards)
            {
                return;
            }

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

                if (!m.Alive && m.Corpse == null)
                {
                    toGive.Remove(m);
                }
            }

            for (int i = 0; i < 16; ++i)
            {
                int    level;
                double random = Utility.RandomDouble();

                if (0.1 >= random)
                {
                    level = 25;
                }
                else if (0.25 >= random)
                {
                    level = 20;
                }
                else if (0.45 >= random)
                {
                    level = 15;
                }
                else if (0.70 >= random)
                {
                    level = 10;
                }
                else
                {
                    level = 5;
                }

                Mobile m = (Mobile)toGive[i % toGive.Count];

                StatCapScroll scs = new StatCapScroll(225 + level);

                m.SendLocalizedMessage(1049524);                   // You have received a scroll of power!

                if (m.Alive)
                {
                    m.AddToBackpack(scs);
                }
                else
                {
                    Container corpse = m.Corpse;

                    if (corpse != null)
                    {
                        corpse.DropItem(scs);
                    }
                }

                if (m is PlayerMobile)
                {
                    PlayerMobile pm = (PlayerMobile)m;

                    for (int j = 0; j < pm.JusticeProtectors.Count; ++j)
                    {
                        Mobile prot = (Mobile)pm.JusticeProtectors[j];

                        if (prot.Map != m.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion(m, prot))
                        {
                            continue;
                        }

                        int chance = 0;

                        switch (VirtueHelper.GetLevel(prot, VirtueName.Justice))
                        {
                        case VirtueLevel.Seeker: chance = 60; break;

                        case VirtueLevel.Follower: chance = 80; break;

                        case VirtueLevel.Knight: chance = 100; break;
                        }

                        if (chance > Utility.Random(100))
                        {
                            prot.SendLocalizedMessage(1049368);                               // You have been rewarded for your dedication to Justice!
                            prot.AddToBackpack(new StatCapScroll(225 + level));
                        }
                    }
                }
            }
        }
        public void GivePowerScrolls()
        {
            if (Map != Map.Felucca)
            {
                return;
            }

            ArrayList          toGive = new ArrayList();
            List <DamageStore> rights = BaseCreature.GetLootingRights(this.DamageEntries, this.HitsMax);

            for (int i = rights.Count - 1; i >= 0; --i)
            {
                DamageStore ds = rights[i];

                if (ds.m_HasRight)
                {
                    toGive.Add(ds.m_Mobile);
                }
            }

            if (toGive.Count == 0)
            {
                return;
            }

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

                if (!(m is PlayerMobile))
                {
                    continue;
                }

                bool gainedPath = false;

                int pointsToGain = 800;

                if (VirtueHelper.Award(m, 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
                }
            }

            // Randomize
            for (int i = 0; i < toGive.Count; ++i)
            {
                int    rand = Utility.Random(toGive.Count);
                object hold = toGive[i];
                toGive[i]    = toGive[rand];
                toGive[rand] = hold;
            }

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

                PowerScroll ps = CreateRandomPowerScroll();

                m.SendLocalizedMessage(1049524);                   // You have received a scroll of power!

                if (!Core.SE || m.Alive)
                {
                    m.AddToBackpack(ps);
                }
                else
                {
                    if (m.Corpse != null && !m.Corpse.Deleted)
                    {
                        ((Container)m.Corpse).DropItem(ps);
                    }
                    else
                    {
                        m.AddToBackpack(ps);
                    }
                }

                if (m is PlayerMobile)
                {
                    PlayerMobile pm = (PlayerMobile)m;

                    for (int j = 0; j < pm.JusticeProtectors.Count; ++j)
                    {
                        Mobile prot = (Mobile)pm.JusticeProtectors[j];

                        if (prot.Map != m.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion(m, prot))
                        {
                            continue;
                        }

                        int chance = 0;

                        switch (VirtueHelper.GetLevel(prot, VirtueName.Justice))
                        {
                        case VirtueLevel.Seeker: chance = 60; break;

                        case VirtueLevel.Follower: chance = 80; break;

                        case VirtueLevel.Knight: chance = 100; break;
                        }

                        if (chance > Utility.Random(100))
                        {
                            ps = CreateRandomPowerScroll();

                            prot.SendLocalizedMessage(1049368);                               // You have been rewarded for your dedication to Justice!

                            if (!Core.SE || prot.Alive)
                            {
                                prot.AddToBackpack(ps);
                            }
                            else
                            {
                                if (prot.Corpse != null && !prot.Corpse.Deleted)
                                {
                                    ((Container)prot.Corpse).DropItem(ps);
                                }
                                else
                                {
                                    prot.AddToBackpack(ps);
                                }
                            }
                        }
                    }
                }
            }
        }