public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            from.CloseGump(typeof(ResurrectGump));

            if (info.ButtonID == 1 || info.ButtonID == 2)
            {
                if (from.Map == null || !from.Map.CanFit(from.Location, 16, false, false))
                {
                    from.SendLocalizedMessage(502391);                       // Thou can not be resurrected there!
                    return;
                }

                if (m_Price > 0)
                {
                    if (info.IsSwitched(1))
                    {
                        if (Banker.Withdraw(from, m_Price))
                        {
                            from.SendLocalizedMessage(1060398, m_Price.ToString());                               // ~1_AMOUNT~ gold has been withdrawn from your bank box.
                            from.SendLocalizedMessage(1060022, Banker.GetBalance(from).ToString());               // You have ~1_AMOUNT~ gold in cash remaining in your bank box.
                        }
                        else
                        {
                            from.SendLocalizedMessage(1060020);                               // Unfortunately, you do not have enough cash in your bank to cover the cost of the healing.
                            return;
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1060019);                           // You decide against paying the healer, and thus remain dead.
                        return;
                    }
                }

                from.PlaySound(0x214);
                from.FixedEffect(0x376A, 10, 16);

                from.Resurrect();

                if (m_Healer != null && from != m_Healer)
                {
                    VirtueLevel level = VirtueHelper.GetLevel(m_Healer, VirtueName.Compassion);

                    switch (level)
                    {
                    case VirtueLevel.Seeker: from.Hits = AOS.Scale(from.HitsMax, 20); break;

                    case VirtueLevel.Follower: from.Hits = AOS.Scale(from.HitsMax, 40); break;

                    case VirtueLevel.Knight: from.Hits = AOS.Scale(from.HitsMax, 80); break;
                    }
                }

                Mobile m = from;

                Misc.Titles.AwardFame(from, -100, true);                   // TODO: Proper fame loss
            }
        }
Пример #2
0
        public static void GiveScrollOfTranscendenceFelTo(Mobile killer, ScrollofTranscendence SoTF)
        {
            if (SoTF == null || killer == null) //sanity
            {
                return;
            }

            killer.SendLocalizedMessage(1094936); // You have received a Scroll of Transcendence!

            if (killer.Alive)
            {
                killer.AddToBackpack(SoTF);
            }
            else
            {
                if (killer.Corpse != null && !killer.Corpse.Deleted)
                {
                    killer.Corpse.DropItem(SoTF);
                }
                else
                {
                    killer.AddToBackpack(SoTF);
                }
            }


            // 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))
                {
                    prot.SendLocalizedMessage(1049368); // You have been rewarded for your dedication to Justice!
                    ScrollofTranscendence SoTFduplicate = new ScrollofTranscendence(SoTF.Skill, SoTF.Value);
                    prot.AddToBackpack(SoTFduplicate);
                }
            }
        }
Пример #3
0
            public override void OnResponse(NetState sender, RelayInfo info)
            {
                if (sender.Mobile == null || sender.Mobile.Alive)
                {
                    return;
                }
                else if (info.ButtonID == 0)
                {
                    return;
                }

                Mobile m = sender.Mobile;

                AutoLifeSpell.ResurrectEffect(m);

                if (m is PlayerMobile)
                {
                    AutoLifeSpell.EndAutoLife((PlayerMobile)m);
                }

                Misc.Titles.AwardFame(m, -(m.Fame / 10), true);
                m.Resurrect();

                if (m.AccessLevel == AccessLevel.Player)
                {
                    VirtueLevel level = VirtueHelper.GetLevel(m, VirtueName.Compassion);

                    switch (level)
                    {
                    case VirtueLevel.Seeker: m.Hits = AOS.Scale(m.HitsMax, 20); break;

                    case VirtueLevel.Follower: m.Hits = AOS.Scale(m.HitsMax, 40); break;

                    case VirtueLevel.Knight: m.Hits = AOS.Scale(m.HitsMax, 80); break;

                    default: m.Hits = 10; break;
                    }
                }
                else
                {
                    m.Hits      = m.HitsMax;
                    m.Stam      = m.StamMax;
                    m.Mana      = m.ManaMax;
                    m.Karma     = m.Fame = 0;
                    m.BodyValue = 987;
                }
            }
Пример #4
0
        public virtual void GivePowerScrollTo(Mobile m, Item item)
        {
            if (m == null)      //sanity
            {
                return;
            }

            if (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(this, 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))
                    {
                        var powerScroll = CreateRandomPowerScroll();

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

                        if (prot.Alive)
                        {
                            prot.AddToBackpack(powerScroll);
                        }
                        else
                        {
                            if (prot.Corpse != null && !prot.Corpse.Deleted)
                            {
                                prot.Corpse.DropItem(powerScroll);
                            }
                            else
                            {
                                prot.AddToBackpack(powerScroll);
                            }
                        }
                    }
                }
            }
        }
Пример #5
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            from.CantWalk = false;
            from.CloseGump(typeof(ResurrectGump));

            if (info.ButtonID == 1 || info.ButtonID == 2)
            {
                if (from.Map == null || !from.Map.CanFit(from.Location, 16, false, false))
                {
                    from.SendLocalizedMessage(502391);                       // Thou can not be resurrected there!
                    return;
                }

                if (m_Healer != null && (m_Healer is BaseHealer) && !from.InRange(m_Healer.Location, 5))
                {
                    from.SendMessage("You've strayed too far from the healer!");
                    return;
                }


                if (m_Price > 0)
                {
                    if (info.IsSwitched(1))
                    {
                        if (Banker.Withdraw(from, m_Price))
                        {
                            from.SendLocalizedMessage(1060398, m_Price.ToString());                               // ~1_AMOUNT~ gold has been withdrawn from your bank box.
                            from.SendLocalizedMessage(1060022, Banker.GetBalance(from).ToString());               // You have ~1_AMOUNT~ gold in cash remaining in your bank box.
                        }
                        else
                        {
                            from.SendLocalizedMessage(1060020);                               // Unfortunately, you do not have enough cash in your bank to cover the cost of the healing.
                            return;
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1060019);                           // You decide against paying the healer, and thus remain dead.
                        return;
                    }
                }

                from.PlaySound(0x214);
                from.FixedEffect(0x376A, 10, 16);

                from.Resurrect();
                TAVUtilities.FindCorpse(from);

                if (m_Healer != null && from != m_Healer)
                {
                    VirtueLevel level = VirtueHelper.GetLevel(m_Healer, VirtueName.Compassion);

                    switch (level)
                    {
                    case VirtueLevel.Seeker: from.Hits = AOS.Scale(from.HitsMax, 20); break;

                    case VirtueLevel.Follower: from.Hits = AOS.Scale(from.HitsMax, 40); break;

                    case VirtueLevel.Knight: from.Hits = AOS.Scale(from.HitsMax, 80); break;
                    }

                    Misc.Titles.AwardFame(m_Healer, 2500, true);
                }

                Mobile m = from;

                Misc.Titles.AwardFame(from, -100, true);                   // TODO: Proper fame loss

                /*
                 * if ( !Core.AOS && from.ShortTermMurders >= 5 )
                 * {
                 *      double loss = (100.0 - ( 4.0 + (from.ShortTermMurders/5.0))) / 100.0;//5 to 15% loss
                 *      if ( loss < 0.85 )
                 *              loss = 0.85;
                 *      else if ( loss > 0.95 )
                 *              loss = 0.95;
                 *
                 *      if ( from.RawStr * loss > 10 )
                 *              from.RawStr = (int)(from.RawStr * loss);
                 *      if ( from.RawInt * loss > 10 )
                 *              from.RawInt = (int)(from.RawInt * loss);
                 *      if ( from.RawDex * loss > 10 )
                 *              from.RawDex = (int)(from.RawDex * loss);
                 *
                 *      for (int s=0;s<from.Skills.Length;s++)
                 *      {
                 *              if ( from.Skills[s].Base * loss > 35 )
                 *                      from.Skills[s].Base *= loss;
                 *      }
                 * }
                 */
            }
        }
Пример #6
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            from.CloseGump(typeof(ResurrectGump));

            if (ResurrectMessage.SilverSapling == m_Msg && 1 == info.ButtonID)
            {
                if (from is PlayerMobile pm && pm.Region.IsPartOf("Abyss"))
                {
                    pm.Location = pm.SSSeedLocation;
                    pm.Map      = pm.SSSeedMap;

                    if (null != pm.Corpse)
                    {
                        pm.Corpse.Location = pm.Location;
                        pm.Corpse.Map      = pm.Map;
                    }

                    pm.Resurrect();
                }

                return;
            }

            if (info.ButtonID == 1 || info.ButtonID == 2)
            {
                if (from.Map == null || !from.Map.CanFit(from.Location, 16, false, false))
                {
                    from.SendLocalizedMessage(502391); // Thou can not be resurrected there!
                    return;
                }

                if (m_Price > 0)
                {
                    if (info.IsSwitched(1))
                    {
                        if (Banker.Withdraw(from, m_Price))
                        {
                            from.SendLocalizedMessage(1060398, m_Price.ToString());                 // ~1_AMOUNT~ gold has been withdrawn from your bank box.
                            from.SendLocalizedMessage(1060022, Banker.GetBalance(from).ToString()); // You have ~1_AMOUNT~ gold in cash remaining in your bank box.
                        }
                        else
                        {
                            from.SendLocalizedMessage(1060020); // Unfortunately, you do not have enough cash in your bank to cover the cost of the healing.
                            return;
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1060019); // You decide against paying the healer, and thus remain dead.
                        return;
                    }
                }

                from.PlaySound(0x214);
                from.FixedEffect(0x376A, 10, 16);

                from.Resurrect();

                if (m_Healer != null && from != m_Healer)
                {
                    VirtueLevel level = VirtueHelper.GetLevel(m_Healer, VirtueName.Compassion);

                    switch (level)
                    {
                    case VirtueLevel.Seeker:
                        from.Hits = AOS.Scale(from.HitsMax, 20);
                        break;

                    case VirtueLevel.Follower:
                        from.Hits = AOS.Scale(from.HitsMax, 40);
                        break;

                    case VirtueLevel.Knight:
                        from.Hits = AOS.Scale(from.HitsMax, 80);
                        break;
                    }
                }

                if (m_FromSacrifice && from is PlayerMobile mobile)
                {
                    mobile.AvailableResurrects -= 1;

                    Container pack   = mobile.Backpack;
                    Container corpse = mobile.Corpse;

                    if (pack != null && corpse != null)
                    {
                        List <Item> items = new List <Item>(corpse.Items);

                        for (int i = 0; i < items.Count; ++i)
                        {
                            Item item = items[i];

                            if (item.Layer != Layer.Hair && item.Layer != Layer.FacialHair && item.Movable)
                            {
                                pack.DropItem(item);
                            }
                        }
                    }
                }

                if (m_Healer != from && m_Healer is PlayerMobile && from is PlayerMobile)
                {
                    SpiritualityVirtue.OnHeal(m_Healer, 50);
                }

                if (from.Fame > 0)
                {
                    int amount = from.Fame / 10;

                    Misc.Titles.AwardFame(from, -amount, true);
                }

                if (from.Alive && m_HitsScalar > 0)
                {
                    from.Hits = (int)(from.HitsMax * m_HitsScalar);
                }

                if (m_Callback != null)
                {
                    m_Callback(from);
                }
            }
        }
Пример #7
0
        public void GivePowerScrolls()
        {
            List <Mobile>      toGive = new List <Mobile>();
            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;
            }

            // 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 < 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 = 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));
                        }
                    }
                }
            }
        }
Пример #8
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);
                            }
                        }
                    }
                }
            }
        }
Пример #9
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()));
                        }
                    }
                }
            }
        }
Пример #10
0
        public void GivePowerScrolls()
        {
            //if ( Map != Map.Felucca )
            //return;

            ArrayList toGive = new ArrayList();

            //ArrayList arraylist = Aggressors;
            for (int i = 0; i < /*Attacker.*/ Aggressors.Count; ++i)
            //for ( int i = 0; i < arraylist.Count; ++i )
            {
                AggressorInfo info = (AggressorInfo)/*Attacker.*/ Aggressors[i];
                //AggressorInfo info = (AggressorInfo)arraylist[i];

                if (info.Attacker.Player && info.Attacker.Alive && (DateTime.Now - info.LastCombatTime) < TimeSpan.FromSeconds(30.0) && !toGive.Contains(info.Attacker))
                {
                    toGive.Add(info.Attacker);
                }
            }

            //arraylist = Aggressed;
            for (int i = 0; i < /*owner.*/ Aggressors.Count; ++i)
            //for ( int i = 0; i < arraylist.Count; ++i )
            {
                //AggressorInfo info = (AggressorInfo)arraylist[i];
                AggressorInfo info = (AggressorInfo)/*Defender.*/ Aggressors[i];

                if (info.Defender.Player && info.Defender.Alive && (DateTime.Now - info.LastCombatTime) < TimeSpan.FromSeconds(30.0) && !toGive.Contains(info.Defender))
                {
                    toGive.Add(info.Defender);
                }
            }

            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 < 3; ++i)
            {
                int    level;
                double random = Utility.RandomDouble();

                if (0.1 >= random)
                {
                    level = 20;
                }
                else if (0.4 >= random)
                {
                    level = 15;
                }
                else
                {
                    level = 10;
                }

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

                PowerScroll ps = PowerScroll.CreateRandomNoCraft(level, level);

                m.SendLocalizedMessage(1049524);                   // You have received a scroll of power!
                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)
                        {
                            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 PowerScroll(ps.Skill, ps.Value));
                        }
                    }
                }
            }
        }
Пример #11
0
        public void OnSlice()
        {
            if (!m_Active || Deleted)
            {
                return;
            }

            if (m_Champion != null)
            {
                if (m_Champion.Deleted)
                {
                    RegisterDamageTo(m_Champion);

                    if (m_Champion is BaseChampion)
                    {
                        AwardArtifact(((BaseChampion)m_Champion).GetArtifact());
                    }

                    m_DamageEntries.Clear();

                    if (m_Platform != null)
                    {
                        m_Platform.Hue = 0x497;
                    }

                    if (m_Altar != null)
                    {
                        m_Altar.Hue = 0;

                        if (!Core.ML || Map == Map.Felucca)
                        {
                            new StarRoomGate(true, m_Altar.Location, m_Altar.Map);
                        }
                    }

                    m_Champion = null;
                    Stop();

                    BeginRestart(m_RestartDelay);
                }
            }
            else
            {
                int kills = m_Kills;

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

                    if (m.Deleted)
                    {
                        m_Creatures.RemoveAt(i);
                        --i;
                        ++m_Kills;

                        Mobile killer = m.FindMostRecentDamager(false);

                        RegisterDamageTo(m);

                        if (killer is BaseCreature)
                        {
                            killer = ((BaseCreature)killer).GetMaster();
                        }

                        if (killer is PlayerMobile)
                        {
                            #region Scroll of Transcendence
                            if (Core.ML)
                            {
                                if (Map == Map.Felucca)
                                {
                                    if (Utility.RandomDouble() < 0.001)
                                    {
                                        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))
                                            {
                                                prot.SendLocalizedMessage(1049368); // You have been rewarded for your dedication to Justice!
                                                ScrollofTranscendence SoTF = CreateRandomFelSoT();
                                                prot.AddToBackpack(SoTF);
                                            }
                                        }

                                        double random = Utility.Random(49);

                                        if (random <= 24)
                                        {
                                            killer.SendLocalizedMessage(1094936); // You have received a Scroll of Transcendence!
                                            ScrollofTranscendence SoTF = CreateRandomFelSoT();
                                            killer.AddToBackpack(SoTF);
                                        }
                                        else
                                        {
                                            killer.SendLocalizedMessage(1049524); // You have received a scroll of power!
                                            PowerScroll PS = CreateRandomFelPS();
                                            killer.AddToBackpack(PS);
                                        }
                                    }
                                }

                                if (Map == Map.Ilshenar || Map == Map.Tokuno)
                                {
                                    if (Utility.RandomDouble() < 0.0015)
                                    {
                                        killer.SendLocalizedMessage(1094936); // You have received a Scroll of Transcendence!
                                        ScrollofTranscendence SoTT = CreateRandomTramSoT();
                                        killer.AddToBackpack(SoTT);
                                    }
                                }
                            }
                            #endregion

                            int mobSubLevel = GetSubLevelFor(m) + 1;

                            if (mobSubLevel >= 0)
                            {
                                bool gainedPath = false;

                                int pointsToGain = mobSubLevel * 40;

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

                                PlayerMobile.ChampionTitleInfo info = ((PlayerMobile)killer).ChampionTitles;

                                info.Award(m_Type, mobSubLevel);
                            }

                            if (Map == Map.Felucca)
                            {
                                PlayerMobile pm = (PlayerMobile)killer;

                                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))
                                    {
                                        ScrollofTranscendence SoTF = CreateRandomFelSoT();

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

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

                // Only really needed once.
                if (m_Kills > kills)
                {
                    InvalidateProperties();
                }

                double n = m_Kills / (double)MaxKills;
                int    p = (int)(n * 100);

                if (p >= 90)
                {
                    AdvanceLevel();
                }
                else if (p > 0)
                {
                    SetWhiteSkullCount(p / 20);
                }

                if (DateTime.Now >= m_ExpireTime)
                {
                    Expire();
                }

                Respawn();
            }
        }
Пример #12
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            from.CloseGump(typeof(ResurrectGump));

            if (info.ButtonID == 1 || info.ButtonID == 2)
            {
                if (from.Map == null || !from.Map.CanFit(from.Location, 16, false, false))
                {
                    from.SendMessage("Voce nao pode ressucitar aqui.");                       // Thou can not be resurrected there!
                    return;
                }

                if (m_Price > 0)
                {
                    if (info.IsSwitched(1))
                    {
                        if (Banker.Withdraw(from, m_Price))
                        {
                            from.SendMessage(string.Format("{0} de gold foi retirado do seu banco", m_Price.ToString()));                // ~1_AMOUNT~ gold has been withdrawn from your bank box.
                            from.SendMessage(string.Format("Voce ainda tem {0} de gold no banco.", Banker.GetBalance(from).ToString())); // You have ~1_AMOUNT~ gold in cash remaining in your bank box.
                        }
                        else
                        {
                            from.SendMessage("Voce nao tem dinheiro suficiente para pagar o curandeiro.");                               // Unfortunately, you do not have enough cash in your bank to cover the cost of the healing.
                            return;
                        }
                    }
                    else
                    {
                        from.SendMessage("Voce prefere ficar morto do que pagar isto!");                           // You decide against paying the healer, and thus remain dead.
                        return;
                    }
                }

                from.PlaySound(0x214);
                from.FixedEffect(0x376A, 10, 16);

                from.Resurrect();

                if (m_Healer != null && from != m_Healer)
                {
                    VirtueLevel level = VirtueHelper.GetLevel(m_Healer, VirtueName.Compassion);

                    switch (level)
                    {
                    case VirtueLevel.Seeker: from.Hits = AOS.Scale(from.HitsMax, 20); break;

                    case VirtueLevel.Follower: from.Hits = AOS.Scale(from.HitsMax, 40); break;

                    case VirtueLevel.Knight: from.Hits = AOS.Scale(from.HitsMax, 80); break;
                    }
                }

                if (m_FromSacrifice && from is PlayerMobile)
                {
                    ((PlayerMobile)from).AvailableResurrects -= 1;

                    Container pack   = from.Backpack;
                    Container corpse = from.Corpse;

                    if (pack != null && corpse != null)
                    {
                        List <Item> items = new List <Item>(corpse.Items);

                        for (int i = 0; i < items.Count; ++i)
                        {
                            Item item = items[i];

                            if (item.Layer != Layer.Hair && item.Layer != Layer.FacialHair && item.Movable)
                            {
                                pack.DropItem(item);
                            }
                        }
                    }
                }

                if (from.Fame > 0)
                {
                    int amount = from.Fame / 10;

                    Misc.Titles.AwardFame(from, -amount, true);
                }

                if (!Core.AOS && from.ShortTermMurders >= 5)
                {
                    double loss = (100.0 - (4.0 + (from.ShortTermMurders / 5.0))) / 100.0;                     // 5 to 15% loss

                    if (loss < 0.85)
                    {
                        loss = 0.85;
                    }
                    else if (loss > 0.95)
                    {
                        loss = 0.95;
                    }

                    if (from.RawStr * loss > 10)
                    {
                        from.RawStr = (int)(from.RawStr * loss);
                    }
                    if (from.RawInt * loss > 10)
                    {
                        from.RawInt = (int)(from.RawInt * loss);
                    }
                    if (from.RawDex * loss > 10)
                    {
                        from.RawDex = (int)(from.RawDex * loss);
                    }

                    for (int s = 0; s < from.Skills.Length; s++)
                    {
                        if (from.Skills[s].Base * loss > 35)
                        {
                            from.Skills[s].Base *= loss;
                        }
                    }
                }

                if (from.Alive && m_HitsScalar > 0)
                {
                    from.Hits = (int)(from.HitsMax * m_HitsScalar);
                }
            }
        }
Пример #13
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.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(225 + level));
                        }
                    }
                }
            }
        }
Пример #14
0
        public void GivePowerScrolls(ArrayList toGive)
        {
            if (NoKillAwards)
            {
                return;
            }

            if (Map != Map.Felucca)
            {
                return;
            }

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

                if (!(m.Map == this.Map && m.InRange(this, 90)) || (!m.Alive && m.Corpse == null))
                {
                    toGive.Remove(m);
                }
            }

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

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

                /* Powerscroll type chance:
                 * - 80% chance to get a 110 powerscroll
                 * - 15% chance to get a 115 powerscroll
                 * - 5% chance to get a 120 powerscroll
                 */

                if (0.05 >= random)
                {
                    level = 20;
                }
                else if (0.2 >= random)
                {
                    level = 15;
                }
                else
                {
                    level = 10;
                }

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

                PowerScroll ps = PowerScroll.CreateRandomNoCraft(level, level);

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

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

                    if (corpse != null)
                    {
                        corpse.DropItem(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.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))
                        {
                            PowerScroll pps = PowerScroll.CreateRandomNoCraft(level, level);
                            prot.SendLocalizedMessage(1049368);                               // You have been rewarded for your dedication to Justice!
                            prot.AddToBackpack(pps);
                        }
                    }
                }
            }
        }
Пример #15
0
        public override void OnResponse(GameClient state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            from.CloseGump(typeof(ResurrectGump));

            if (info.ButtonID == 2)
            {
                if (from.Map == null || !from.Map.CanFit(from.Location, 16, false, false))
                {
                    from.SendLocalizedMessage(502391);                       // Thou can not be resurrected there!
                    return;
                }

                if (m_Price > 0)
                {
                    if (info.IsSwitched(1))
                    {
                        if (Banker.Withdraw(from, m_Price))
                        {
                            from.SendLocalizedMessage(1060398, m_Price.ToString());                               // ~1_AMOUNT~ gold has been withdrawn from your bank box.
                            from.SendLocalizedMessage(1060022, Banker.GetBalance(from).ToString());               // You have ~1_AMOUNT~ gold in cash remaining in your bank box.
                        }
                        else
                        {
                            from.SendLocalizedMessage(1060020);                               // Unfortunately, you do not have enough cash in your bank to cover the cost of the healing.
                            return;
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1060019);                           // You decide against paying the healer, and thus remain dead.
                        return;
                    }
                }

                from.PlaySound(0x214);

                from.Resurrect(m_Healer);

                if (from is PlayerMobile)
                {
                    ((PlayerMobile)from).CheckKRStartingQuestStep(26);
                }

                if (m_Healer != null && from != m_Healer)
                {
                    VirtueLevel level = VirtueHelper.GetLevel(m_Healer, VirtueName.Compassion);

                    switch (level)
                    {
                    case VirtueLevel.Seeker:
                        from.Hits = AOS.Scale(from.HitsMax, 20);
                        break;

                    case VirtueLevel.Follower:
                        from.Hits = AOS.Scale(from.HitsMax, 40);
                        break;

                    case VirtueLevel.Knight:
                        from.Hits = AOS.Scale(from.HitsMax, 80);
                        break;
                    }
                }

                if (m_FromSacrifice && from is PlayerMobile)
                {
                    ((PlayerMobile)from).AvailableResurrects -= 1;

                    Container pack   = from.Backpack;
                    Container corpse = from.Corpse;

                    if (pack != null && corpse != null)
                    {
                        ArrayList items = new ArrayList(corpse.Items);

                        for (int i = 0; i < items.Count; ++i)
                        {
                            Item item = (Item)items[i];

                            if (item.Movable && item.LootType != LootType.Cursed)
                            {
                                pack.DropItem(item);
                            }
                        }
                    }
                }

                if (from.Fame > 0)
                {
                    int amount = from.Fame / 10;

                    Misc.Titles.AwardFame(from, -amount, true);
                }
            }
        }
Пример #16
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 not 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);
                        }
                    }
                }
            }
        }
Пример #17
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (m_Pet.Deleted || !m_Pet.IsBonded || !m_Pet.IsDeadPet)
            {
                return;
            }

            Mobile from = state.Mobile;

            if (info.ButtonID == 1)
            {
                if (m_Pet.Map == null || !m_Pet.Map.CanFit(m_Pet.Location, 16, false, false))
                {
                    from.SendLocalizedMessage(503256);                       // You fail to resurrect the creature.
                    return;
                }
                else if (m_Pet.Region != null && m_Pet.Region.IsPartOf("Khaldun")) //TODO: Confirm for pets, as per Bandage's script.
                {
                    from.SendLocalizedMessage(1010395);                            // The veil of death in this area is too strong and resists thy efforts to restore life.
                    return;
                }

                m_Pet.PlaySound(0x214);
                m_Pet.FixedEffect(0x376A, 10, 16);
                m_Pet.ResurrectPet();

                #region SA
                if (m_Healer != null)
                {
                    int         toheal = 0;
                    VirtueLevel level  = VirtueHelper.GetLevel(m_Healer, VirtueName.Compassion);

                    switch (level)
                    {
                    case VirtueLevel.Seeker: toheal = AOS.Scale(m_Pet.HitsMax, 5); break;

                    case VirtueLevel.Follower: toheal = AOS.Scale(m_Pet.HitsMax, 10); break;

                    case VirtueLevel.Knight: toheal = AOS.Scale(m_Pet.HitsMax, 20); break;
                    }

                    if (toheal > 200)
                    {
                        toheal = 200;
                    }

                    m_Pet.Hits = toheal;
                }
                #endregion

                double decreaseAmount;

                if (from == m_Pet.ControlMaster)
                {
                    decreaseAmount = 0.1;
                }
                else
                {
                    decreaseAmount = 0.2;
                }

                for (int i = 0; i < m_Pet.Skills.Length; ++i)                   //Decrease all skills on pet.
                {
                    m_Pet.Skills[i].Base -= decreaseAmount;
                }

                if (!m_Pet.IsDeadPet && m_HitsScalar > 0)
                {
                    m_Pet.Hits = (int)(m_Pet.HitsMax * m_HitsScalar);
                }
            }
        }
Пример #18
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            var from = state.Mobile;

            from.CloseGump <ResurrectGump>();

            if (info.ButtonID != 1 && info.ButtonID != 2)
            {
                return;
            }

            if (from.Map?.CanFit(from.Location, 16, false, false) != true)
            {
                from.SendLocalizedMessage(502391); // Thou can not be resurrected there!
                return;
            }

            if (m_Price > 0)
            {
                if (info.IsSwitched(1))
                {
                    if (Banker.Withdraw(from, m_Price))
                    {
                        from.SendLocalizedMessage(
                            1060398,
                            m_Price.ToString()
                            ); // ~1_AMOUNT~ gold has been withdrawn from your bank box.
                        from.SendLocalizedMessage(
                            1060022,
                            Banker.GetBalance(from).ToString()
                            ); // You have ~1_AMOUNT~ gold in cash remaining in your bank box.
                    }
                    else
                    {
                        from.SendLocalizedMessage(
                            1060020
                            ); // Unfortunately, you do not have enough cash in your bank to cover the cost of the healing.
                        return;
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1060019); // You decide against paying the healer, and thus remain dead.
                    return;
                }
            }

            from.PlaySound(0x214);
            from.FixedEffect(0x376A, 10, 16);

            from.Resurrect();

            if (m_Healer != null && from != m_Healer)
            {
                var level = VirtueHelper.GetLevel(m_Healer, VirtueName.Compassion);

                from.Hits = level switch
                {
                    VirtueLevel.Seeker => AOS.Scale(from.HitsMax, 20),
                    VirtueLevel.Follower => AOS.Scale(from.HitsMax, 40),
                    VirtueLevel.Knight => AOS.Scale(from.HitsMax, 80),
                    _ => from.Hits
                };
            }

            if (m_FromSacrifice && from is PlayerMobile mobile)
            {
                mobile.AvailableResurrects -= 1;

                var pack   = mobile.Backpack;
                var corpse = mobile.Corpse;

                if (pack != null && corpse != null)
                {
                    var items = new List <Item>(corpse.Items);

                    for (var i = 0; i < items.Count; ++i)
                    {
                        var item = items[i];

                        if (item.Layer != Layer.Hair && item.Layer != Layer.FacialHair && item.Movable)
                        {
                            pack.DropItem(item);
                        }
                    }
                }
            }

            if (from.Fame > 0)
            {
                var amount = from.Fame / 10;

                Titles.AwardFame(from, -amount, true);
            }

            if (!Core.AOS && from.ShortTermMurders >= 5)
            {
                var loss = (100.0 - (4.0 + from.ShortTermMurders / 5.0)) / 100.0; // 5 to 15% loss

                if (loss < 0.85)
                {
                    loss = 0.85;
                }
                else if (loss > 0.95)
                {
                    loss = 0.95;
                }

                if (from.RawStr * loss > 10)
                {
                    from.RawStr = (int)(from.RawStr * loss);
                }

                if (from.RawInt * loss > 10)
                {
                    from.RawInt = (int)(from.RawInt * loss);
                }

                if (from.RawDex * loss > 10)
                {
                    from.RawDex = (int)(from.RawDex * loss);
                }

                for (var s = 0; s < from.Skills.Length; s++)
                {
                    if (from.Skills[s].Base * loss > 35)
                    {
                        from.Skills[s].Base *= loss;
                    }
                }
            }

            if (from.Alive && m_HitsScalar > 0)
            {
                from.Hits = (int)(from.HitsMax * m_HitsScalar);
            }
        }
    }
Пример #19
0
        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);
                                }
                            }
                        }
                    }
                }
            }
        }
Пример #20
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            from.CloseGump(typeof(ResurrectGump));

            if (ResurrectMessage.SilverSapling == this.m_Msg && 1 == info.ButtonID)
            {
                PlayerMobile pm = from as PlayerMobile;
                if (null != pm && pm.Region.IsPartOf("Abyss"))
                {
                    pm.Location = pm.SSSeedLocation;
                    pm.Map      = pm.SSSeedMap;
                    if (null != pm.Corpse)
                    {
                        pm.Corpse.Location = pm.Location;
                        pm.Corpse.Map      = pm.Map;
                    }
                    pm.Resurrect();
                }
                return;
            }

            if (info.ButtonID == 1 || info.ButtonID == 2)
            {
                if (from.Map == null || !from.Map.CanFit(from.Location, 16, false, false))
                {
                    from.SendLocalizedMessage(502391); // Thou can not be resurrected there!
                    return;
                }

                if (this.m_Price > 0)
                {
                    if (info.IsSwitched(1))
                    {
                        if (Banker.Withdraw(from, this.m_Price))
                        {
                            from.SendLocalizedMessage(1060398, this.m_Price.ToString());            // ~1_AMOUNT~ gold has been withdrawn from your bank box.
                            from.SendLocalizedMessage(1060022, Banker.GetBalance(from).ToString()); // You have ~1_AMOUNT~ gold in cash remaining in your bank box.
                        }
                        else
                        {
                            from.SendLocalizedMessage(1060020); // Unfortunately, you do not have enough cash in your bank to cover the cost of the healing.
                            return;
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1060019); // You decide against paying the healer, and thus remain dead.
                        return;
                    }
                }

                from.PlaySound(0x214);
                from.FixedEffect(0x376A, 10, 16);

                from.Resurrect();

                if (this.m_Healer != null && from != this.m_Healer)
                {
                    VirtueLevel level = VirtueHelper.GetLevel(this.m_Healer, VirtueName.Compassion);

                    switch (level)
                    {
                    case VirtueLevel.Seeker:
                        from.Hits = AOS.Scale(from.HitsMax, 20);
                        break;

                    case VirtueLevel.Follower:
                        from.Hits = AOS.Scale(from.HitsMax, 40);
                        break;

                    case VirtueLevel.Knight:
                        from.Hits = AOS.Scale(from.HitsMax, 80);
                        break;
                    }
                }

                if (this.m_FromSacrifice && from is PlayerMobile)
                {
                    ((PlayerMobile)from).AvailableResurrects -= 1;

                    Container pack   = from.Backpack;
                    Container corpse = from.Corpse;

                    if (pack != null && corpse != null)
                    {
                        List <Item> items = new List <Item>(corpse.Items);

                        for (int i = 0; i < items.Count; ++i)
                        {
                            Item item = items[i];

                            if (item.Layer != Layer.Hair && item.Layer != Layer.FacialHair && item.Movable)
                            {
                                pack.DropItem(item);
                            }
                        }
                    }
                }

                if (from.Fame > 0)
                {
                    int amount = from.Fame / 10;

                    Misc.Titles.AwardFame(from, -amount, true);
                }

                if (!Core.AOS && from.ShortTermMurders >= 5)
                {
                    double loss = (100.0 - (4.0 + (from.ShortTermMurders / 5.0))) / 100.0; // 5 to 15% loss

                    if (loss < 0.85)
                    {
                        loss = 0.85;
                    }
                    else if (loss > 0.95)
                    {
                        loss = 0.95;
                    }

                    if (from.RawStr * loss > 10)
                    {
                        from.RawStr = (int)(from.RawStr * loss);
                    }
                    if (from.RawInt * loss > 10)
                    {
                        from.RawInt = (int)(from.RawInt * loss);
                    }
                    if (from.RawDex * loss > 10)
                    {
                        from.RawDex = (int)(from.RawDex * loss);
                    }

                    for (int s = 0; s < from.Skills.Length; s++)
                    {
                        if (from.Skills[s].Base * loss > 35)
                        {
                            from.Skills[s].Base *= loss;
                        }
                    }
                }

                if (from.Alive && this.m_HitsScalar > 0)
                {
                    from.Hits = (int)(from.HitsMax * this.m_HitsScalar);
                }
            }
        }
Пример #21
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));
                        }
                    }
                }
            }
        }
Пример #22
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 {}
                }
            }
        }
Пример #23
0
        public void GiveClothingBlessDeed()
        {
            if (Map != Map.Felucca)
            {
                return;
            }

            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 < 6; ++i)
            {
                Mobile m = (Mobile)toGive[i % toGive.Count];

                ClothingBlessDeed cbd = new ClothingBlessDeed();

                m.SendMessage("You have received a Clothing Bless Deed!");                   // You have received a Clothing Bless Deed!
                m.AddToBackpack(cbd);

                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 ClothingBlessDeed());
                        }
                    }
                }
            }
        }
Пример #24
0
        public void GivePowerScrolls(ArrayList toGive)
        {
            if (NoKillAwards)
            {
                return;
            }

            if (Map != Map.Felucca)
            {
                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 < 6; ++i)
            {
                int    level;
                double random = Utility.RandomDouble();

                if (0.1 >= random)
                {
                    level = 20;
                }
                else if (0.4 >= random)
                {
                    level = 15;
                }
                else
                {
                    level = 10;
                }

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

                PowerScroll ps = PowerScroll.CreateRandomNoCraft(level, level);

                if (m.AccessLevel > AccessLevel.Player)
                {
                    ps.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(ps);
                }
                else
                {
                    Container corpse = m.Corpse;

                    if (corpse != null)
                    {
                        corpse.DropItem(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))
                        {
                            PowerScroll pps = PowerScroll.CreateRandomNoCraft(level, level);
                            prot.SendLocalizedMessage(1049368);                               // You have been rewarded for your dedication to Justice!
                            prot.AddToBackpack(pps);
                        }
                    }
                }
            }
        }
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            from.CloseGump(typeof(ResurrectGump));

            if (info.ButtonID == 1 || info.ButtonID == 2)
            {
                if (from.Map == null || !from.Map.CanFit(from.Location, 16, false, false))
                {
                    from.SendLocalizedMessage(502391);                       // Thou can not be resurrected there!
                    return;
                }

                if (m_Price > 0)
                {
                    if (info.IsSwitched(1))
                    {
                        if (Banker.Withdraw(from, m_Price))
                        {
                            from.SendLocalizedMessage(1060398, m_Price.ToString());                               // ~1_AMOUNT~ gold has been withdrawn from your bank box.
                            from.SendLocalizedMessage(1060022, Banker.GetBalance(from).ToString());               // You have ~1_AMOUNT~ gold in cash remaining in your bank box.
                        }
                        else
                        {
                            from.SendLocalizedMessage(1060020);                               // Unfortunately, you do not have enough cash in your bank to cover the cost of the healing.
                            return;
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1060019);                           // You decide against paying the healer, and thus remain dead.
                        return;
                    }
                }

                from.PlaySound(0x214);

                from.Resurrect();

                Effects.SendLocationParticles(EffectItem.Create(from.Location, from.Map, EffectItem.DefaultDuration), 0, 0, 0, 0, 0, 5060, 0);

                Effects.SendMovingParticles(new Entity(0, new Point3D(from.X - 6, from.Y - 6, from.Z + 15), from.Map), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100);
                Effects.SendMovingParticles(new Entity(0, new Point3D(from.X - 4, from.Y - 6, from.Z + 15), from.Map), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100);
                Effects.SendMovingParticles(new Entity(0, new Point3D(from.X - 6, from.Y - 4, from.Z + 15), from.Map), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100);

                Effects.SendTargetParticles(from, 0x375A, 35, 90, 0x00, 0x00, 9502, (EffectLayer)255, 0x100);

                if (m_Healer != null && from != m_Healer)
                {
                    VirtueLevel level = VirtueHelper.GetLevel(m_Healer, VirtueName.Compassion);

                    switch (level)
                    {
                    case VirtueLevel.Seeker:
                        from.Hits = AOS.Scale(from.HitsMax, 20);
                        break;

                    case VirtueLevel.Follower:
                        from.Hits = AOS.Scale(from.HitsMax, 40);
                        break;

                    case VirtueLevel.Knight:
                        from.Hits = AOS.Scale(from.HitsMax, 80);
                        break;
                    }
                }

                Mobile m = from;

                Misc.Titles.AwardFame(from, -100, true);                   // TODO: Proper fame loss

                if (!Core.AOS && from.ShortTermMurders >= 5)
                {
                    double loss = (100.0 - (4.0 + (from.ShortTermMurders / 5.0))) / 100.0;                 //5 to 15% loss
                    if (loss < 0.85)
                    {
                        loss = 0.85;
                    }
                    else if (loss > 0.95)
                    {
                        loss = 0.95;
                    }

                    if (from.RawStr * loss > 10)
                    {
                        from.RawStr = (int)(from.RawStr * loss);
                    }
                    if (from.RawInt * loss > 10)
                    {
                        from.RawInt = (int)(from.RawInt * loss);
                    }
                    if (from.RawDex * loss > 10)
                    {
                        from.RawDex = (int)(from.RawDex * loss);
                    }

                    for (int s = 0; s < from.Skills.Length; s++)
                    {
                        if (from.Skills[s].Base * loss > 35)
                        {
                            from.Skills[s].Base *= loss;
                        }
                    }
                }
            }
        }