Beispiel #1
0
        public void TurnToBones()
        {
            if (Deleted)
            {
                return;
            }

            ProcessDelta();
            SendRemovePacket();
            ItemID = Utility.Random(0xECA, 9); // bone graphic
            Hue    = 0;
            ProcessDelta();

            SetFlag(CorpseFlag.NoBones, true);
            SetFlag(CorpseFlag.IsBones, true);

            var delay = Owner?.CorpseDecayTime ?? Mobile.DefaultCorpseDecay;

            m_DecayTime = DateTime.UtcNow + delay;

            if (!TimerRegistry.UpdateRegistry(m_TimerID, this, delay))
            {
                TimerRegistry.Register(m_TimerID, this, delay, TimerPriority.FiveSeconds, c => c.DoDecay());
            }
        }
Beispiel #2
0
        public Blood(int itemID)
            : base(itemID)
        {
            Movable = false;

            TimerRegistry.Register(_TimerID, this, DecayTime, blood => blood.Delete());
        }
Beispiel #3
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 4:
                FailedLockpick   = reader.ReadBool();
                _Quality         = (ChestQuality)reader.ReadInt();
                DigTime          = reader.ReadDateTime();
                AncientGuardians = reader.ReadStrongMobileList();
                goto case 3;

            case 3:
                FirstOpenedByOwner = reader.ReadBool();
                TreasureMap        = reader.ReadItem() as TreasureMap;
                goto case 2;

            case 2:
            {
                Guardians = reader.ReadStrongMobileList();
                Temporary = reader.ReadBool();

                goto case 1;
            }

            case 1:
            {
                Owner = reader.ReadMobile();

                goto case 0;
            }

            case 0:
            {
                Level      = reader.ReadInt();
                DeleteTime = reader.ReadDeltaTime();
                m_Lifted   = reader.ReadStrongItemList();

                if (version < 2)
                {
                    Guardians = new List <Mobile>();
                }

                break;
            }
            }

            if (!Temporary && DeleteTime > DateTime.UtcNow)
            {
                TimerRegistry.Register("TreasureMapChest", this, DeleteTime - DateTime.UtcNow, chest => chest.Delete());
            }
            else
            {
                Delete();
            }
        }
Beispiel #4
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadEncodedInt();

            TimerRegistry.Register("UnsettlingPortrait", this, TimeSpan.FromMinutes(3), TimeSpan.FromMinutes(3), false, p => p.ChangeDirection());
        }
Beispiel #5
0
        public void AddEntry(TownCrierEntry entry)
        {
            if (m_Entries == null)
            {
                m_Entries = new List <TownCrierEntry>();
            }

            m_Entries.Add(entry);

            TimerRegistry.Register(_AutoShoutTimerID, this, TimeSpan.FromMinutes(5.0), TimeSpan.FromMinutes(1.0), false, tc => tc.AutoShout_Callback());
        }
Beispiel #6
0
        public virtual void BeginDelete(Mobile m)
        {
            StopFollow();

            if (m != null)
            {
                m_EscortTable.Remove(m);
            }

            TimerRegistry.Register(m_TimerID, this, TimeSpan.FromSeconds(45), escort => escort.Delete());
        }
Beispiel #7
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            reader.ReadEncodedInt();

            if (UsesRemaining < 20)
            {
                TimerRegistry.Register(TimerID, this, RechargDuration, false, hammer => Tick_Callback(hammer));
            }
        }
Beispiel #8
0
        public TreasureMapChest(Mobile owner, int level, bool temporary)
            : base(0xE40)
        {
            Owner      = owner;
            Level      = level;
            DeleteTime = DateTime.UtcNow + _DeleteTime;

            Temporary        = temporary;
            Guardians        = new List <Mobile>();
            AncientGuardians = new List <Mobile>();

            TimerRegistry.Register("TreasureMapChest", this, _DeleteTime, chest => chest.Delete());
        }
        public void StartTimer()
        {
            if (NextReagentTime == DateTime.MinValue)
            {
                NextReagentTime = DateTime.UtcNow + RespawnDuration;
            }
            else if (NextReagentTime < DateTime.UtcNow)
            {
                NextReagentTime = DateTime.UtcNow + TimeSpan.FromSeconds(10);
            }

            TimerRegistry.Register(TimerID, this, NextReagentTime - DateTime.UtcNow, false, OnTick);
        }
Beispiel #10
0
        public Clone(Mobile caster)
            : base(AIType.AI_Melee, FightMode.None, 10, 1, 0.2, 0.4)
        {
            m_Caster = caster;

            Body = caster.Body;

            Hue    = caster.Hue;
            Female = caster.Female;

            Name    = caster.Name;
            NameHue = caster.NameHue;

            Title = caster.Title;
            Kills = caster.Kills;

            HairItemID = caster.HairItemID;
            HairHue    = caster.HairHue;

            FacialHairItemID = caster.FacialHairItemID;
            FacialHairHue    = caster.FacialHairHue;

            for (int i = 0; i < caster.Skills.Length; ++i)
            {
                Skills[i].Base = caster.Skills[i].Base;
                Skills[i].Cap  = caster.Skills[i].Cap;
            }

            for (int i = 0; i < caster.Items.Count; i++)
            {
                AddItem(CloneItem(caster.Items[i]));
            }

            Warmode = true;

            Summoned     = true;
            SummonMaster = caster;

            ControlOrder  = OrderType.Follow;
            ControlTarget = caster;

            TimeSpan duration = TimeSpan.FromSeconds(30 + caster.Skills.Ninjitsu.Fixed / 40);

            SummonEnd = DateTime.UtcNow + duration;
            TimerRegistry.Register <BaseCreature>("UnsummonTimer", this, duration, c => c.Delete());

            MirrorImage.AddClone(m_Caster);

            IgnoreMobiles = true;
        }
Beispiel #11
0
        public virtual Mobile GetEscorter()
        {
            Mobile master = ControlMaster;

            if (master == null || !Controlled)
            {
                return(master);
            }
            else if (master.Map != Map || !master.InRange(Location, 30) || !master.Alive)
            {
                TimeSpan lastSeenDelay = DateTime.UtcNow - LastSeenEscorter;

                if (lastSeenDelay >= TimeSpan.FromMinutes(2.0))
                {
                    EscortObjective escort = GetObjective();

                    if (escort != null)
                    {
                        master.SendLocalizedMessage(1071194); // You have failed your escort quest…
                        master.PlaySound(0x5B3);
                        escort.Fail();
                    }

                    master.SendLocalizedMessage(1042473); // You have lost the person you were escorting.
                    Say(1005653);                         // Hmmm.  I seem to have lost my master.

                    StopFollow();
                    m_EscortTable.Remove(master);

                    TimerRegistry.Register(m_TimerID, this, TimeSpan.FromSeconds(5.0), e => e.Delete());

                    return(null);
                }
                else
                {
                    ControlOrder = OrderType.Stay;
                }
            }
            else
            {
                if (ControlOrder != OrderType.Follow)
                {
                    StartFollow(master);
                }

                LastSeenEscorter = DateTime.UtcNow;
            }

            return(master);
        }
Beispiel #12
0
        public TownCrierEntry AddEntry(TextDefinition[] lines, TimeSpan duration)
        {
            if (m_Entries == null)
            {
                m_Entries = new List <TownCrierEntry>();
            }

            TownCrierEntry tce = new TownCrierEntry(lines, duration);

            m_Entries.Add(tce);

            TimerRegistry.Register(_AutoShoutTimerID, this, TimeSpan.FromMinutes(5.0), TimeSpan.FromMinutes(1.0), false, tc => tc.AutoShout_Callback());

            return(tce);
        }
Beispiel #13
0
        public Weather(Map facet, Rectangle2D[] area, int temperature, int chanceOfPercipitation, int chanceOfExtremeTemperature, TimeSpan interval)
        {
            m_Facet                      = facet;
            m_Area                       = area;
            m_Temperature                = temperature;
            m_ChanceOfPercipitation      = chanceOfPercipitation;
            m_ChanceOfExtremeTemperature = chanceOfExtremeTemperature;

            List <Weather> list = GetWeatherList(facet);

            if (list != null)
            {
                list.Add(this);
            }

            TimerRegistry.Register(m_TimerID, this, interval, TimeSpan.FromSeconds((0.2 + (Utility.RandomDouble() * 0.8)) * interval.TotalSeconds), false, weather => weather.OnTick());
        }
Beispiel #14
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            reader.ReadInt();

            m_KeyValue    = reader.ReadUInt();
            m_Open        = reader.ReadBool();
            m_Locked      = reader.ReadBool();
            m_OpenedID    = reader.ReadInt();
            m_ClosedID    = reader.ReadInt();
            m_OpenedSound = reader.ReadInt();
            m_ClosedSound = reader.ReadInt();
            m_Offset      = reader.ReadPoint3D();
            m_Link        = reader.ReadItem() as BaseDoor;

            if (m_Open)
            {
                TimerRegistry.Register(m_TimerID, this, TimeSpan.FromSeconds(20), TimeSpan.FromSeconds(10), false, TimerPriority.OneSecond, door => door.InternalClose());
            }
        }
Beispiel #15
0
 public Blood(Serial serial)
     : base(serial)
 {
     TimerRegistry.Register(_TimerID, this, DecayTime, blood => blood.Delete());
 }
Beispiel #16
0
        public void BeginDecay(TimeSpan delay)
        {
            m_DecayTime = DateTime.UtcNow + delay;

            TimerRegistry.Register(m_TimerID, this, delay, TimerPriority.FiveSeconds, c => c.DoDecay());
        }
Beispiel #17
0
 private void StartDeleteTimer()
 {
     TimerRegistry.Register(m_DeleteTimerID, this, TimeSpan.FromMinutes(Utility.RandomMinMax(2, 5)), chest => chest.Delete());
 }
Beispiel #18
0
 private void StartTimer()
 {
     TimerRegistry.Register(_TimerID, this, TimeSpan.FromMinutes(15.0), TimeSpan.FromMinutes(15.0), false, spawner => spawner.CheckSpawn());
 }
Beispiel #19
0
 private void StartTimer()
 {
     TimerRegistry.Register(m_TimerID, this, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(1), false, spawner => spawner.OnSlice());
 }
Beispiel #20
0
 private void StartRestartTimer()
 {
     TimerRegistry.Register(m_RestartTimerID, this, m_RestartDelay, spawner => spawner.Start());
 }
Beispiel #21
0
 public void ForceBeginAutoShout()
 {
     TimerRegistry.Register(_AutoShoutTimerID, this, TimeSpan.FromMinutes(5.0), TimeSpan.FromMinutes(1.0), false, tc => tc.AutoShout_Callback());
 }
Beispiel #22
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);

                        TimerRegistry.Register(m_TimerID, this, TimeSpan.FromSeconds(5), e => e.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)
            {
                string region = GetDestination();

                if (region != null && Region.IsPartOf(region))
                {
                    TimerRegistry.Register(m_TimerID, this, TimeSpan.FromSeconds(5), escort => escort.Delete());
                    m_Checked = true;
                }
            }

            return(false);
        }
 public override void OnSectorActivate()
 {
     TimerRegistry.Register(_TimerID, this, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(1), false, addon => addon.OnTick());
 }
Beispiel #24
0
 private void ActivateTimer()
 {
     TimerRegistry.Register(_TimerID, this, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(1), false, barrier => barrier.PlaySound());
 }
Beispiel #25
0
 public UnsettlingPortraitComponent()
     : base(0x2A65)
 {
     TimerRegistry.Register("UnsettlingPortrait", this, TimeSpan.FromMinutes(3), TimeSpan.FromMinutes(3), false, p => p.ChangeDirection());
 }
Beispiel #26
0
 public virtual void StartTimer()
 {
     TimerRegistry.Register <QuestSystem>(_TimerID, this, TimeSpan.FromSeconds(0.5), TimeSpan.FromSeconds(0.5), false, q => q.Slice());
 }
 public DisturbingPortraitComponent()
     : base(0x2A5D)
 {
     TimerRegistry.Register("DisturbingPortrait", this, TimeSpan.FromMinutes(3), TimeSpan.FromMinutes(3), false, p => p.Change());
 }