Пример #1
0
        public virtual void GivePowerScrolls()
        {
            if (Map == null || (RestrictedToFelucca && Map.Rules != MapRules.FeluccaRules))
            {
                return;
            }

            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 && InRange(ds.m_Mobile, 100) && ds.m_Mobile.Map == Map)
                {
                    toGive.Add(ds.m_Mobile);
                }
            }

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

            for (int i = 0; i < toGive.Count; i++)
            {
                Mobile m = 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 - PowerScrolls
            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 < PowerScrollAmount; ++i)
            {
                Mobile m = toGive[i % toGive.Count];

                var ps = CreateRandomPowerScroll();
                GiveItemMessage(m, ps);

                GivePowerScrollTo(m, ps);
            }

            // Randomize - Primers
            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 < PowerScrollAmount; ++i)
            {
                Mobile m = toGive[i % toGive.Count];

                SkillMasteryPrimer p = CreateRandomPrimer();
                GiveItemMessage(m, p);

                GivePowerScrollTo(m, p);
            }

            ColUtility.Free(toGive);
        }
Пример #2
0
        public void GivePowerScrolls()
        {
            if (Map != Map.Felucca)
            {
                return;
            }

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

            for (int i = 0; i < toGive.Count; i++)
            {
                Mobile m = 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);
                Mobile hold = toGive[i];
                toGive[i]    = toGive[rand];
                toGive[rand] = hold;
            }

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

                PowerScroll ps = CreateRandomPowerScroll();

                GivePowerScrollTo(m, ps);
            }
        }
Пример #3
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;
                                        double       random = Utility.Random(49);

                                        if (random <= 24)
                                        {
                                            ScrollofTranscendence SoTF = CreateRandomSoT(true);
                                            GiveScrollTo(pm, (SpecialScroll)SoTF);
                                        }
                                        else
                                        {
                                            PowerScroll PS = PowerScroll.CreateRandomNoCraft(5, 5);
                                            GiveScrollTo(pm, (SpecialScroll)PS);
                                        }
                                    }
                                }

                                if (Map == Map.Ilshenar || Map == Map.Tokuno || Map == Map.Malas)
                                {
                                    if (Utility.RandomDouble() < 0.0015)
                                    {
                                        killer.SendLocalizedMessage(1094936);                                           // You have received a Scroll of Transcendence!
                                        ScrollofTranscendence SoTT = CreateRandomSoT(false);
                                        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);
                            }
                        }
                    }
                }

                // 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();
            }
        }
Пример #4
0
        public virtual bool CheckAtDestination()
        {
            if (Quest != null)
            {
                EscortObjective escort = GetObjective();

                if (escort == null)
                {
                    return(false);
                }

                Mobile escorter = GetEscorter();

                if (escorter == null)
                {
                    return(false);
                }

                if (escort.Region != null && Region.IsPartOf(escort.Region))
                {
                    Say(1042809, escorter.Name); // We have arrived! I thank thee, ~1_PLAYER_NAME~! I have no further need of thy services. Here is thy pay.

                    escort.Complete();

                    if (Quest.Completed)
                    {
                        escorter.SendLocalizedMessage(1046258, null, 0x23); // Your quest is complete.

                        if (QuestHelper.AnyRewards(Quest))
                        {
                            escorter.SendGump(new MondainQuestGump(Quest, MondainQuestGump.Section.Rewards, false, true));
                        }
                        else
                        {
                            Quest.GiveRewards();
                        }

                        escorter.PlaySound(Quest.CompleteSound);

                        StopFollow();
                        m_EscortTable.Remove(escorter);
                        m_DeleteTimer = Timer.DelayCall(TimeSpan.FromSeconds(5.0), new TimerCallback(Delete));

                        // fame
                        Misc.Titles.AwardFame(escorter, escort.Fame, true);

                        // compassion
                        bool gainedPath = false;

                        PlayerMobile pm = escorter as PlayerMobile;

                        if (pm != null)
                        {
                            if (pm.CompassionGains > 0 && DateTime.UtcNow > pm.NextCompassionDay)
                            {
                                pm.NextCompassionDay = DateTime.MinValue;
                                pm.CompassionGains   = 0;
                            }

                            if (pm.CompassionGains >= 5)          // have already gained 5 times in one day, can gain no more
                            {
                                pm.SendLocalizedMessage(1053004); // You must wait about a day before you can gain in compassion again.
                            }
                            else if (VirtueHelper.Award(pm, VirtueName.Compassion, escort.Compassion, ref gainedPath))
                            {
                                pm.SendLocalizedMessage(1074949, null, 0x2A);  // You have demonstrated your compassion!  Your kind actions have been noted.

                                if (gainedPath)
                                {
                                    pm.SendLocalizedMessage(1053005); // You have achieved a path in compassion!
                                }
                                else
                                {
                                    pm.SendLocalizedMessage(1053002);                            // You have gained in compassion.
                                }
                                pm.NextCompassionDay = DateTime.UtcNow + TimeSpan.FromDays(1.0); // in one day CompassionGains gets reset to 0
                                ++pm.CompassionGains;
                            }
                            else
                            {
                                pm.SendLocalizedMessage(1053003); // You have achieved the highest path of compassion and can no longer gain any further.
                            }
                        }
                    }
                    else
                    {
                        escorter.PlaySound(Quest.UpdateSound);
                    }

                    return(true);
                }
            }
            else if (!m_Checked)
            {
                var region = GetDestination();

                if (region != null && Region.IsPartOf(region))
                {
                    m_DeleteTimer = Timer.DelayCall(TimeSpan.FromSeconds(5.0), new TimerCallback(Delete));
                    m_Checked     = true;
                }
            }

            return(false);
        }
Пример #5
0
        public virtual void GivePowerScrolls()
        {
            if (this.Map != Map.Felucca)
            {
                return;
            }

            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 && InRange(ds.m_Mobile, 100) && ds.m_Mobile.Map == this.Map)
                {
                    toGive.Add(ds.m_Mobile);
                }
            }

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

            for (int i = 0; i < toGive.Count; i++)
            {
                Mobile m = 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 - PowerScrolls
            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.PowerScrollAmount; ++i)
            {
                Mobile m = toGive[i % toGive.Count];

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

                GivePowerScrollTo(m, ps, this);
            }

            if (Core.TOL)
            {
                // Randomize - Primers
                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.PowerScrollAmount; ++i)
                {
                    Mobile m = toGive[i % toGive.Count];

                    SkillMasteryPrimer p = CreateRandomPrimer();
                    m.SendLocalizedMessage(1156209); // You have received a mastery primer!

                    GivePowerScrollTo(m, p, this);
                }
            }

            ColUtility.Free(toGive);
        }
Пример #6
0
        public virtual bool CheckAtDestination()
        {
            EDI dest = GetDestination();

            if (dest == null)
            {
                return(false);
            }

            Mobile escorter = GetEscorter();

            if (escorter == null)
            {
                return(false);
            }

            if (dest.Contains(Location))
            {
                Say(1042809, escorter.Name); // We have arrived! I thank thee, ~1_PLAYER_NAME~! I have no further need of thy services. Here is thy pay.

                // not going anywhere
                m_Destination       = null;
                m_DestinationString = null;

                Container cont = escorter.Backpack;

                if (cont == null)
                {
                    cont = escorter.BankBox;
                }

                Gold gold = new Gold(500, 1000);

                if (!cont.TryDropItem(escorter, gold, false))
                {
                    if (escorter.Map != null && escorter.Map != Map.Internal)
                    {
                        gold.MoveToWorld(escorter.Location, escorter.Map);
                    }
                    else
                    {
                        gold.Delete();
                    }
                }

                StopFollow();
                SetControlMaster(null);
                EscortTable.Remove(escorter);
                BeginDelete();

                Misc.Titles.AwardFame(escorter, 10, true);

                bool gainedPath = false;

                PlayerMobile pm = escorter as PlayerMobile;

                if (pm != null)
                {
                    if (pm.CompassionGains > 0 && DateTime.UtcNow > pm.NextCompassionDay)
                    {
                        pm.NextCompassionDay = DateTime.MinValue;
                        pm.CompassionGains   = 0;
                    }

                    if (pm.CompassionGains >= 5)          // have already gained 5 times in one day, can gain no more
                    {
                        pm.SendLocalizedMessage(1053004); // You must wait about a day before you can gain in compassion again.
                    }
                    else if (VirtueHelper.Award(pm, VirtueName.Compassion, IsPrisoner ? 400 : 200, ref gainedPath))
                    {
                        if (gainedPath)
                        {
                            pm.SendLocalizedMessage(1053005); // You have achieved a path in compassion!
                        }
                        else
                        {
                            pm.SendLocalizedMessage(1053002);                            // You have gained in compassion.
                        }
                        pm.NextCompassionDay = DateTime.UtcNow + TimeSpan.FromDays(1.0); // in one day CompassionGains gets reset to 0
                        ++pm.CompassionGains;
                    }
                    else
                    {
                        pm.SendLocalizedMessage(1053003); // You have achieved the highest path of compassion and can no longer gain any further.
                    }
                }

                return(true);
            }

            return(false);
        }
Пример #7
0
        public override void OnTalk(PlayerMobile player, bool contextMenu)
        {
            Direction = GetDirectionTo(player);

            QuestSystem qs = player.Quest;

            if (qs is WitchApprenticeQuest)
            {
                if (qs.IsObjectiveInProgress(typeof(FindApprenticeObjective)))
                {
                    PlaySound(0x259);
                    PlaySound(0x206);
                    qs.AddConversation(new HagDuringCorpseSearchConversation());
                }
                else
                {
                    QuestObjective obj = qs.FindObjective(typeof(FindGrizeldaAboutMurderObjective));

                    if (obj != null && !obj.Completed)
                    {
                        PlaySound(0x420);
                        PlaySound(0x20);
                        obj.Complete();
                    }
                    else if (qs.IsObjectiveInProgress(typeof(KillImpsObjective)) ||
                             qs.IsObjectiveInProgress(typeof(FindZeefzorpulObjective)))
                    {
                        PlaySound(0x259);
                        PlaySound(0x206);
                        qs.AddConversation(new HagDuringImpSearchConversation());
                    }
                    else
                    {
                        obj = qs.FindObjective(typeof(ReturnRecipeObjective));

                        if (obj != null && !obj.Completed)
                        {
                            PlaySound(0x258);
                            PlaySound(0x41B);
                            obj.Complete();
                        }
                        else if (qs.IsObjectiveInProgress(typeof(FindIngredientObjective)))
                        {
                            PlaySound(0x259);
                            PlaySound(0x206);
                            qs.AddConversation(new HagDuringIngredientsConversation());
                        }
                        else
                        {
                            obj = qs.FindObjective(typeof(ReturnIngredientsObjective));

                            if (obj != null && !obj.Completed)
                            {
                                Container cont = GetNewContainer();

                                cont.DropItem(new BlackPearl(30));
                                cont.DropItem(new Bloodmoss(30));
                                cont.DropItem(new Garlic(30));
                                cont.DropItem(new Ginseng(30));
                                cont.DropItem(new MandrakeRoot(30));
                                cont.DropItem(new Nightshade(30));
                                cont.DropItem(new SulfurousAsh(30));
                                cont.DropItem(new SpidersSilk(30));

                                cont.DropItem(new Cauldron());
                                cont.DropItem(new MoonfireBrew());
                                cont.DropItem(new TreasureMap(Utility.RandomMinMax(1, 4), this.Map));
                                cont.DropItem(new Gold(2000, 2200));

                                if (Utility.RandomBool())
                                {
                                    BaseWeapon weapon = Loot.RandomWeapon();

                                    if (Core.AOS)
                                    {
                                        BaseRunicTool.ApplyAttributesTo(weapon, 2, 20, 30);
                                    }
                                    else
                                    {
                                        weapon.DamageLevel     = (WeaponDamageLevel)BaseCreature.RandomMinMaxScaled(2, 3);
                                        weapon.AccuracyLevel   = (WeaponAccuracyLevel)BaseCreature.RandomMinMaxScaled(2, 3);
                                        weapon.DurabilityLevel = (WeaponDurabilityLevel)BaseCreature.RandomMinMaxScaled(2, 3);
                                    }

                                    cont.DropItem(weapon);
                                }
                                else
                                {
                                    Item item;

                                    if (Core.AOS)
                                    {
                                        item = Loot.RandomArmorOrShieldOrJewelry();

                                        if (item is BaseArmor)
                                        {
                                            BaseRunicTool.ApplyAttributesTo((BaseArmor)item, 2, 20, 30);
                                        }
                                        else if (item is BaseJewel)
                                        {
                                            BaseRunicTool.ApplyAttributesTo((BaseJewel)item, 2, 20, 30);
                                        }
                                    }
                                    else
                                    {
                                        BaseArmor armor = Loot.RandomArmorOrShield();
                                        item = armor;

                                        armor.ProtectionLevel = (ArmorProtectionLevel)BaseCreature.RandomMinMaxScaled(2, 3);
                                        armor.Durability      = (ArmorDurabilityLevel)BaseCreature.RandomMinMaxScaled(2, 3);
                                    }

                                    cont.DropItem(item);
                                }

                                if (player.BAC > 0)
                                {
                                    cont.DropItem(new HangoverCure());
                                }

                                if (player.PlaceInBackpack(cont))
                                {
                                    bool gainedPath = false;

                                    if (VirtueHelper.Award(player, VirtueName.Sacrifice, 250, ref gainedPath)) // TODO: Check amount on OSI.
                                    {
                                        player.SendLocalizedMessage(1054160);                                  // You have gained in sacrifice.
                                    }
                                    PlaySound(0x253);
                                    PlaySound(0x20);
                                    obj.Complete();
                                }
                                else
                                {
                                    cont.Delete();
                                    player.SendLocalizedMessage(1046260); // You need to clear some space in your inventory to continue with the quest.  Come back here when you have more space in your inventory.
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                QuestSystem newQuest        = new WitchApprenticeQuest(player);
                bool        inRestartPeriod = false;

                if (qs != null)
                {
                    newQuest.AddConversation(new DontOfferConversation());
                }
                else if (QuestSystem.CanOfferQuest(player, typeof(WitchApprenticeQuest), out inRestartPeriod))
                {
                    PlaySound(0x20);
                    PlaySound(0x206);
                    newQuest.SendOffer();
                }
                else if (inRestartPeriod)
                {
                    PlaySound(0x259);
                    PlaySound(0x206);
                    newQuest.AddConversation(new RecentlyFinishedConversation());
                }
            }
        }
Пример #8
0
        public void OnSlice()
        {
            if (!m_Active || Deleted)
            {
                return;
            }

            int currentRank = Rank;

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

                    if (AutoRestart)
                    {
                        BeginRestart(m_RestartDelay);
                    }
                }
                else if (m_Champion.Alive && m_Champion.GetDistanceToSqrt(this) > MaxStrayDistance)
                {
                    m_Champion.MoveToWorld(new Point3D(X, Y, Z - 15), Map);
                }
            }
            else
            {
                int kills = m_Kills;

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

                    if (m.Deleted)
                    {
                        if (m.Corpse != null && !m.Corpse.Deleted)
                        {
                            ((Corpse)m.Corpse).BeginDecay(TimeSpan.FromMinutes(1));
                        }
                        m_Creatures.RemoveAt(i);
                        --i;

                        int rankOfMob = GetRankFor(m);
                        if (rankOfMob == currentRank)
                        {
                            ++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() < ChampionSystem.ScrollChance)
                                    {
                                        PlayerMobile pm = (PlayerMobile)killer;

                                        if (Utility.RandomDouble() < ChampionSystem.TranscendenceChance)
                                        {
                                            ScrollofTranscendence SoTF = CreateRandomSoT(true);
                                            GiveScrollTo(pm, (SpecialScroll)SoTF);
                                        }
                                        else
                                        {
                                            PowerScroll PS = PowerScroll.CreateRandomNoCraft(5, 5);
                                            GiveScrollTo(pm, (SpecialScroll)PS);
                                        }
                                    }
                                }

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

                            int mobSubLevel = rankOfMob + 1;
                            if (mobSubLevel >= 0)
                            {
                                bool gainedPath = false;

                                int pointsToGain = mobSubLevel * 40;

                                if (VirtueHelper.Award(killer, VirtueName.Valor, pointsToGain, ref gainedPath))
                                {
                                    if (gainedPath)
                                    {
                                        killer.SendLocalizedMessage(1054032); // You have gained a path in Valor!
                                    }
                                    else
                                    {
                                        killer.SendLocalizedMessage(1054030); // You have gained in Valor!
                                    }
                                    //No delay on Valor gains
                                }

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

                                info.Award(m_Type, mobSubLevel);

                                Server.Engines.CityLoyalty.CityLoyaltySystem.OnSpawnCreatureKilled(m as BaseCreature, mobSubLevel);
                            }
                        }
                    }
                }

                // 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.UtcNow >= m_ExpireTime)
                {
                    Expire();
                }

                Respawn();
            }
        }
Пример #9
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);
                                }
                            }
                        }
                    }
                }
            }
        }
        public override bool CheckAtDestination()
        {
            EDI dest = GetDestination();

            if (dest == null)
            {
                return(false);
            }

            Mobile escorter = GetEscorter();

            if (escorter == null)
            {
                return(false);
            }

            if (dest.Contains(Location))
            {
                Say("You have brought me home, I thank thee mortal and I hope this token of my appreciation helps you, now farewell!", escorter.Name);

                // not going anywhere
                Destination = null;
                //DestinationString = null;

                escorter.AddToBackpack(new SpiritGem());

                StopFollow();
                SetControlMaster(null);
                EscortTable.Remove(escorter);
                BeginDelete();

                Misc.Titles.AwardFame(escorter, 10, true);

                bool gainedPath = false;

                PlayerMobile pm = escorter as PlayerMobile;

                if (pm != null)
                {
                    if (pm.CompassionGains > 0 && DateTime.Now > pm.NextCompassionDay)
                    {
                        pm.NextCompassionDay = DateTime.MinValue;
                        pm.CompassionGains   = 0;
                    }

                    if (pm.CompassionGains >= 5)                     // have already gained 5 points in one day, can gain no more
                    {
                        pm.SendLocalizedMessage(1053004);            // You must wait about a day before you can gain in compassion again.
                    }
                    else if (VirtueHelper.Award(pm, VirtueName.Compassion, 1, ref gainedPath))
                    {
                        if (gainedPath)
                        {
                            pm.SendLocalizedMessage(1053005);                             // You have achieved a path in compassion!
                        }
                        else
                        {
                            pm.SendLocalizedMessage(1053002);                             // You have gained in compassion.
                        }
                        pm.NextCompassionDay = DateTime.Now + TimeSpan.FromDays(1.0);     // in one day CompassionGains gets reset to 0
                        ++pm.CompassionGains;
                    }
                    else
                    {
                        pm.SendLocalizedMessage(1053003);                         // You have achieved the highest path of compassion and can no longer gain any further.
                    }
                }

                return(true);
            }

            return(false);
        }
Пример #11
0
        public void OnSlice()
        {
            if (!m_Active || Deleted)
            {
                return;
            }

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

                    if (m_Altar != null)
                    {
                        m_Altar.Hue = 0;
                        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);

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

                        if (killer is PlayerMobile)
                        {
                            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);
                            }
                        }
                    }
                }

                // 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 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_Altar != null)
                    {
                        m_Altar.Hue = 0x455;

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

                    m_Champion = null;
                    Stop();

                    m_HasBeenAdvanced = false;

                    BeginRestart(m_RestartDelay);
                }
                else
                {
                    if (m_Champion.Region != m_Region)
                    {
                        m_Champion.MoveToWorld(new Point3D(X, Y, Z - 15), Map);
                    }
                }
            }
            else
            {
                int kills = m_Kills;

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

                    if (creature.Deleted)
                    {
                        if (creature.Corpse != null && !creature.Corpse.Deleted)
                        {
                            ((Corpse)creature.Corpse).BeginDecay(TimeSpan.FromMinutes(1.0));
                        }

                        m_Creatures.RemoveAt(i);
                        --i;
                        ++m_Kills;

                        RegisterDamageTo(creature);

                        Mobile killer = creature.FindMostRecentDamager(false);

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

                        if (killer is PlayerMobile && killer.Alive && killer.Region == m_Region)
                        {
                            if (creature.Fame > Utility.Random(1000000))
                            {
                                if (Map == Map.Felucca && Utility.RandomBool())
                                {
                                    PowerScroll ps = PowerScroll.CreateRandomNoCraft(5, 5);

                                    ps.LootType = LootType.Blessed;

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

                                    killer.AddToBackpack(ps);
                                }
                                else
                                {
                                    ScrollOfTranscendence sot;

                                    if (this.Map.Rules == MapRules.FeluccaRules)
                                    {
                                        sot = ScrollOfTranscendence.CreateRandom(6, 10);
                                    }
                                    else
                                    {
                                        sot = ScrollOfTranscendence.CreateRandom(1, 5);
                                    }

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

                                    killer.AddToBackpack(sot);
                                }
                            }

                            int mobSubLevel = GetSubLevelFor(creature) + 1;

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

                                int pointsToGain = mobSubLevel * 40;

                                if (VirtueHelper.Award(killer, VirtueName.Valor, pointsToGain, ref gainedPath))
                                {
                                    if (gainedPath)
                                    {
                                        killer.SendLocalizedMessage(1054032);                                           // You have gained a path in Valor!
                                    }
                                    else
                                    {
                                        killer.SendLocalizedMessage(1054030);                                           // You have gained in Valor!
                                    }
                                    // No delay on Valor gains
                                }
                            }

                            #region Champion Monster Titles
                            int type = -1;

                            switch (m_Type)
                            {
                            case ChampionSpawnType.ColdBlood:
                                type = 0;
                                break;

                            case ChampionSpawnType.ForestLord:
                                type = 1;
                                break;

                            case ChampionSpawnType.Arachnid:
                                type = 2;
                                break;

                            case ChampionSpawnType.Abyss:
                                type = 3;
                                break;

                            case ChampionSpawnType.VerminHorde:
                                type = 4;
                                break;

                            case ChampionSpawnType.UnholyTerror:
                                type = 5;
                                break;

                            case ChampionSpawnType.SleepingDragon:
                                type = 6;
                                break;

                            case ChampionSpawnType.Corrupt:
                                type = 7;
                                break;

                            case ChampionSpawnType.Glade:
                                type = 8;
                                break;

                            case ChampionSpawnType.Unliving:
                                type = 9;
                                break;

                            case ChampionSpawnType.Pit:
                                type = 10;
                                break;
                            }

                            BaseCreature bc = creature as BaseCreature;

                            if (bc != null && type != -1)
                            {
                                bc.CalculateTitlesScore((PlayerMobile)killer, bc.SpawnLevel, type);
                            }
                            #endregion
                        }
                    }
                }

                // 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.UtcNow >= m_ExpireTime)
                {
                    Expire();
                }

                if (DateTime.UtcNow >= m_KickTime)
                {
                    KickGhosts();
                }

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

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

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

                if (m is not PlayerMobile)
                {
                    continue;
                }

                var gainedPath = false;

                var 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
            toGive.Shuffle();

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

                var ps = CreateRandomPowerScroll();

                GivePowerScrollTo(m, ps);
            }
        }
Пример #15
0
        /// <summary>
        /// Overridable. Checks if at destination.
        /// </summary>
        public virtual bool CheckAtDestination()
        {
            EscortObjective escort = GetObjective();

            if (escort == null)
            {
                return(false);
            }

            if (escort.Region == null)
            {
                escort.Fail();
                return(CheckAtDestination());
            }

            Mobile escorter = GetEscorter();

            if (escorter == null)
            {
                return(false);
            }

            if (escort.Region.Contains(Location))
            {
                Say(1042809, escorter.Name);                   // We have arrived! I thank thee, ~1_PLAYER_NAME~! I have no further need of thy services. Here is thy pay.

                escort.Complete();

                if (m_Quest != null)
                {
                    if (m_Quest.Completed)
                    {
                        escorter.SendLocalizedMessage(1046258, null, 0x23);                           // Your quest is complete.

                        if (!QuestHelper.AnyRewards(m_Quest))
                        {
                            m_Quest.GiveRewards();
                        }
                        else
                        {
                            escorter.SendGump(new MondainQuestGump(m_Quest, MondainQuestGump.Section.Rewards, false, true));
                        }

                        escorter.PlaySound(m_Quest.CompleteSound);
                    }
                    else
                    {
                        escorter.PlaySound(m_Quest.UpdateSound);
                    }
                }

                StopFollow();
                SetControlMaster(null);
                m_EscortTable.Remove(escorter);
                BeginDelete();

                // fame, compassion
                if (escort.Fame > 0)
                {
                    Misc.Titles.AwardFame(escorter, escort.Fame, true);

                    bool gainedPath = false;

                    PlayerMobile pm = escorter as PlayerMobile;

                    if (pm != null)
                    {
                        if (pm.CompassionGains > 0 && DateTime.Now > pm.NextCompassionDay)
                        {
                            pm.NextCompassionDay = DateTime.MinValue;
                            pm.CompassionGains   = 0;
                        }

                        if (pm.CompassionGains >= 5)                           // have already gained 5 times in one day, can gain no more
                        {
                            pm.SendLocalizedMessage(1053004);                  // You must wait about a day before you can gain in compassion again.
                        }
                        else if (VirtueHelper.Award(pm, VirtueName.Compassion, 200, ref gainedPath))
                        {
                            if (gainedPath)
                            {
                                pm.SendLocalizedMessage(1053005);                                   // You have achieved a path in compassion!
                            }
                            else
                            {
                                pm.SendLocalizedMessage(1053002);                                   // You have gained in compassion.
                            }
                            pm.NextCompassionDay = DateTime.Now + TimeSpan.FromDays(1.0);           // in one day CompassionGains gets reset to 0
                            ++pm.CompassionGains;
                        }
                        else
                        {
                            pm.SendLocalizedMessage(1053003);                               // You have achieved the highest path of compassion and can no longer gain any further.
                        }
                    }
                }

                return(true);
            }

            return(false);
        }