//this generates an item from what is stored in the entry.  Note no exception handling
        public override Item GenerateItem()
        {
            //this allows for inherited classes of addon deeds to fit into this entry.
            StatCapScroll scroll = (StatCapScroll)Activator.CreateInstance(_Type, new object[] { _Value });

            return(scroll);
        }
Exemple #2
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);

                if (m.AccessLevel > AccessLevel.Player)
                {
                    scs.Cheater_Name = String.Format("This item received by GM {0}", m.Name);
                }

                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));
                        }
                    }
                }
            }
        }