MrRiots

Self-proclaimed Legend
Moderator
ServUO Version
Publish 58
Ultima Expansion
Time Of Legends
Hi!

I tried to copy the Harrower lines with StatScroll drops into another mobile.
But I cannot get it to work.
Ive tested this in Malas, do I have to change the map somewhere from Felucca?
Or am I just doing something wrong?


C#:
  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()));
                        }
                    }
                }
            }
        }

        private static int RandomStatScrollLevel()
        {
            double random = Utility.RandomDouble();

            if (0.1 >= random)
                return 25;
            else if (0.25 >= random)
                return 20;
            else if (0.45 >= random)
                return 15;
            else if (0.70 >= random)
                return 10;
            return 5;
        }
 
This is just creating a list of people to give the scrolls to, it's not creating and distributing the scrolls. Keep looking at the Harrower and BaseChampion, there are several methods called to create power/stat scrolls.
 
This is just creating a list of people to give the scrolls to, it's not creating and distributing the scrolls. Keep looking at the Harrower and BaseChampion, there are several methods called to create power/stat scrolls.
Thank you, I knew I missed something
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back