示例#1
0
        private void OnTick()
        {
            DateTime now = DateTime.Now;
            TimeSpan age = now - this.Created;

            if (age >= TimeSpan.FromSeconds(100.0))
            {
                this.Delete();
            }
            else if (age >= TimeSpan.FromSeconds(90.0))
            {
                this.Status = CampfireStatus.Off;
            }
            else if (age >= TimeSpan.FromSeconds(60.0))
            {
                if (this.Status == CampfireStatus.Burning)
                {
                    Ashes ash = new Ashes(Utility.RandomMinMax(1, 3));
                    ash.MoveToWorld(this.Location, this.Map);
                }
                this.Status = CampfireStatus.Extinguishing;
            }

            if (this.Status == CampfireStatus.Off || this.Deleted)
            {
                return;
            }

            foreach (CampfireEntry entry in new ArrayList(m_Entries))
            {
                if (!entry.Valid || entry.Player.NetState == null)
                {
                    RemoveEntry(entry);
                }
                else if (!entry.Safe && now - entry.Start >= TimeSpan.FromSeconds(30.0))
                {
                    entry.Safe = true;
                    entry.Player.SendLocalizedMessage(500621);                       // The camp is now secure.
                }
            }

            IPooledEnumerable eable = this.GetClientsInRange(SecureRange);

            foreach (NetState state in eable)
            {
                PlayerMobile pm = state.Mobile as PlayerMobile;

                if (pm != null && GetEntry(pm) == null)
                {
                    CampfireEntry entry = new CampfireEntry(pm, this);

                    m_Table[pm] = entry;
                    m_Entries.Add(entry);

                    pm.SendLocalizedMessage(500620);                       // You feel it would take a few moments to secure your camp.
                }
            }

            eable.Free();
        }
示例#2
0
        private void OnTick()
        {
            DateTime now = DateTime.UtcNow;
            TimeSpan age = now - Created;

            if (age >= TimeSpan.FromSeconds(100.0))
            {
                Delete();
            }
            else if (age >= TimeSpan.FromSeconds(90.0))
            {
                Status = CampfireStatus.Off;
            }
            else if (age >= TimeSpan.FromSeconds(60.0))
            {
                Status = CampfireStatus.Extinguishing;
            }

            if (Status == CampfireStatus.Off || Deleted)
            {
                return;
            }

            var list = new ArrayList(m_Entries);

            for (var index = 0; index < list.Count; index++)
            {
                var entry = (CampfireEntry)list[index];

                if (!entry.Valid || entry.Player.NetState == null)
                {
                    RemoveEntry(entry);
                }
                else if (!entry.Safe && now - entry.Start >= TimeSpan.FromSeconds(30.0))
                {
                    entry.Safe = true;
                    entry.Player.SendLocalizedMessage(500621); // The camp is now secure.
                }
            }

            IPooledEnumerable eable = GetClientsInRange(SecureRange);

            foreach (NetState state in eable)
            {
                if (state.Mobile is PlayerMobile pm && GetEntry(pm) == null)
                {
                    CampfireEntry entry = new CampfireEntry(pm, this);

                    m_Table[pm] = entry;
                    m_Entries.Add(entry);

                    pm.SendLocalizedMessage(500620); // You feel it would take a few moments to secure your camp.
                }
            }

            eable.Free();
        }
示例#3
0
        private void OnTick()
        {
            DateTime now = DateTime.Now;
            TimeSpan age = now - this.Created;

            if (age >= TimeSpan.FromSeconds(100.0))
            {
                this.Delete();
            }
            else if (age >= TimeSpan.FromSeconds(90.0))
            {
                this.Status = CampfireStatus.Off;
            }
            else if (age >= TimeSpan.FromSeconds(60.0))
            {
                this.Status = CampfireStatus.Extinguishing;
            }

            if (this.Status == CampfireStatus.Off || this.Deleted)
            {
                return;
            }

            foreach (CampfireEntry entry in new ArrayList(m_Entries))
            {
                if (!entry.Valid || entry.Player.Client == null)
                {
                    RemoveEntry(entry);
                }
                else if (!entry.Safe && now - entry.Start >= TimeSpan.FromSeconds(30.0))
                {
                    entry.Safe = true;
                    entry.Player.SendLocalizedMessage(500621);                       // The camp is now secure.
                }
            }

            var eable = this.GetClientsInRange(SecureRange);

            foreach (GameClient state in eable)
            {
                PlayerMobile pm = state.Mobile as PlayerMobile;

                if (pm != null && GetEntry(pm) == null)
                {
                    CampfireEntry entry = new CampfireEntry(pm, this);

                    m_Table[pm] = entry;
                    m_Entries.Add(entry);

                    pm.SendLocalizedMessage(500620);                       // You feel it would take a few moments to secure your camp.
                }
            }
        }
示例#4
0
        private void OnTick()
        {
            DateTime now = DateTime.Now;
            TimeSpan age = now - this.Created;

            if ( age >= TimeSpan.FromSeconds( 300.0 ) )
                this.Delete();
            else if ( age >= TimeSpan.FromSeconds( 270.0 ) )
                this.Status = CampfireStatus.Off;
            else if ( age >= TimeSpan.FromSeconds( 180.0 ) )
                this.Status = CampfireStatus.Extinguishing;

            if ( this.Status == CampfireStatus.Off || this.Deleted )
                return;

            foreach ( CampfireEntry entry in new ArrayList( m_Entries ) )
            {
                if ( !entry.Valid || entry.Player.NetState == null )
                {
                    RemoveEntry( entry );
                }
                else if ( !entry.Safe && now - entry.Start >= TimeSpan.FromSeconds( 30.0 ) )
                {
                    entry.Safe = true;
                    entry.Player.SendLocalizedMessage( 500621 ); // The camp is now secure.
                }
            }

            IPooledEnumerable eable = this.GetClientsInRange( SecureRange );

            foreach ( NetState state in eable )
            {
                PlayerMobile pm = state.Mobile as PlayerMobile;

                if( pm != null )
                {
                    bool foundbedroll = false;

                    foreach( Item bedroll in pm.GetItemsInRange ( 1 ) )
                    {
                        if( bedroll is Bedroll )
                            foundbedroll = true;
                    }

                    if( foundbedroll )
                    {
                        if ( pm.CheckSkill( SkillName.Camping, 0.0, 100.0 ) )
                        {
                            if( pm.Hits < pm.HitsMax )
                            {
                                pm.Hits++;
                            }

                            if( pm.Stam < pm.StamMax )
                            {
                                pm.Stam++;
                            }
                        }
                    }
                }

                if ( pm != null && GetEntry( pm ) == null )
                {
                    CampfireEntry entry = new CampfireEntry( pm, this );

                    m_Table[pm] = entry;
                    m_Entries.Add( entry );

                    pm.SendLocalizedMessage( 500620 ); // You feel it would take a few moments to secure your camp.
                }
            }

            eable.Free();
        }
        private void OnTick()
        {
            DateTime now = DateTime.Now;
            TimeSpan age = now - this.Created;

            if ( age >= TimeSpan.FromSeconds( 100.0 ) )
                this.Delete();
            else if ( age >= TimeSpan.FromSeconds( 90.0 ) )
                this.Status = CampfireStatus.Off;
            else if ( age >= TimeSpan.FromSeconds( 60.0 ) )
                this.Status = CampfireStatus.Extinguishing;

            if ( this.Status == CampfireStatus.Off || this.Deleted )
                return;

            foreach ( CampfireEntry entry in new List<CampfireEntry>( m_Entries ) )
            {
                if ( !entry.Valid || entry.Player.NetState == null )
                    RemoveEntry( entry );
                else if ( !entry.Safe && now - entry.Start >= TimeSpan.FromSeconds( 30.0 ) )
                {
                    entry.Safe = true;
                    entry.Player.SendLocalizedMessage( 500621 ); // The camp is now secure.
                }
            }

            IPooledEnumerable eable = this.GetClientsInRange( SecureRange );

            foreach ( NetState state in eable )
            {
                PlayerMobile pm = state.Mobile as PlayerMobile;

                if ( pm != null && GetEntry( pm ) == null )
                {
                    CampfireEntry entry = new CampfireEntry( pm, this );

                    m_Table[pm] = entry;
                    m_Entries.Add( entry );

                    pm.SendLocalizedMessage( 500620 ); // You feel it would take a few moments to secure your camp.
                }
            }

            eable.Free();
        }
示例#6
0
文件: Campfire.cs 项目: Ziden/ServUO
        private void OnTick()
        {
            DateTime now = DateTime.UtcNow;
            TimeSpan age = now - this.Created;

            if (age >= TimeSpan.FromSeconds(100.0))
            {
                this.Delete();
            }
            else if (age >= TimeSpan.FromSeconds(90.0))
            {
                this.Status = CampfireStatus.Off;
            }
            else if (age >= TimeSpan.FromSeconds(60.0))
            {
                this.Status = CampfireStatus.Extinguishing;
            }

            if (this.Status == CampfireStatus.Off || this.Deleted)
            {
                return;
            }

            foreach (CampfireEntry entry in new ArrayList(this.m_Entries))
            {
                if (!entry.Valid || entry.Player.NetState == null)
                {
                    RemoveEntry(entry);
                }
                else if (!entry.Safe && now - entry.Start >= TimeSpan.FromSeconds(30.0))
                {
                    entry.Safe = true;
                    this.Safe  = true;
                    entry.Player.SendMessage("O Acampamento esta seguro");

                    if (entry.Player.Skills[SkillName.Camping].Value > 50)
                    {
                        GoGump.GetDiscoveredLocation(entry.Player);
                    }
                }
            }

            IPooledEnumerable eable = this.GetClientsInRange(SecureRange);

            foreach (NetState state in eable)
            {
                PlayerMobile pm = state.Mobile as PlayerMobile;

                if (regenera)
                {
                    var timenow = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
                    if (!pm.Warmode && pm.GetMillisSinceLastDamage() >= 1000 * 10) // 10 segundos
                    {
                        pm.FixedParticles(0x376A, 9, 32, 5005, EffectLayer.Waist);
                        pm.Hits += 1;
                        pm.Stam += 5;
                    }
                }

                if (pm != null && GetEntry(pm) == null)
                {
                    CampfireEntry entry = new CampfireEntry(pm, this);

                    m_Table[pm] = entry;
                    this.m_Entries.Add(entry);

                    pm.SendMessage("Em alguns momentos seu acampamento ficara seguro");
                }
            }

            eable.Free();
        }
示例#7
0
文件: Campfire.cs 项目: Godkong/RunUO
        private void OnTick()
        {
            DateTime now = DateTime.Now;
            TimeSpan age = now - this.Created;

            if ( age >= TimeSpan.FromSeconds( 100.0 ) )
                this.Delete();
            else if ( age >= TimeSpan.FromSeconds( 90.0 ) )
                this.Status = CampfireStatus.Off;
            else if ( age >= TimeSpan.FromSeconds( 60.0 ) )
                this.Status = CampfireStatus.Extinguishing;

            if ( this.Status == CampfireStatus.Off || this.Deleted )
                return;

            foreach ( CampfireEntry entry in new ArrayList( m_Entries ) )
            {
                if ( !entry.Valid || entry.Player.NetState == null )
                {
                    RemoveEntry( entry );
                }
                else if (!entry.Safe && now - entry.Start >= TimeSpan.FromSeconds(30.0))
                {
                    entry.Safe = true;
                    entry.Player.SendAsciiMessage("The camp is now secure."); // The camp is now secure.
                }
                else
                {
                }
            }
            int Count = 0;
            IPooledEnumerable eable = this.GetItemsInRange(1);
            foreach (Object o in eable)
            {
                if (o is Campfire)
                    Count++;
            }
            eable.Free();

            eable = this.GetClientsInRange( SecureRange );

            foreach ( NetState state in eable )
            {
                PlayerMobile pm = state.Mobile as PlayerMobile;

                if ( pm != null && GetEntry( pm ) == null )
                {
                    CampfireEntry entry = new CampfireEntry( pm, this );

                    m_Table[pm] = entry;
                    m_Entries.Add( entry );

                    pm.SendAsciiMessage( "You feel it would take a few moments to secure your camp." ); // You feel it would take a few moments to secure your camp.
                }

                if (pm != null && GetEntry(pm) != null && !GetEntry(pm).Safe)
                {
                    if (Utility.Random(1, Count) != Count)
                    {
                        eable.Free();
                        return;
                    }

                    if (pm.InRange(this, 1) && m_Starter != null && pm == m_Starter)
                            pm.CheckSkill(SkillName.Camping, 0.5);
                }
            }

            eable.Free();
        }
示例#8
0
        private void OnTick()
        {
            DateTime now = DateTime.UtcNow;
            TimeSpan age = now - Created;

            if (age >= TimeSpan.FromSeconds(220.0)) // 100
            {
                Delete();
            }
            else if (age >= TimeSpan.FromSeconds(210.0)) // 90
            {
                Status = CampfireStatus.Off;
            }
            else if (age >= TimeSpan.FromSeconds(180.0)) // 60
            {
                Status = CampfireStatus.Extinguishing;
            }

            if (Status == CampfireStatus.Off || Deleted)
            {
                return;
            }

            foreach (CampfireEntry entry in new ArrayList(m_Entries))
            {
                if (!entry.Valid || entry.Player.NetState == null)
                {
                    RemoveEntry(entry);
                }
                else if (!entry.Safe && now - entry.Start >= TimeSpan.FromSeconds(60 - 45 * (entry.Player.Skills[SkillName.Camping].Value / 100))) //originally was: TimeSpan.FromSeconds(30.0)
                {
                    entry.Safe = true;
                    entry.Player.SendLocalizedMessage(500621); // The camp is now secure.

                    #region NewCamping
                    if (!entry.Player.HasGump(typeof(CampfireGump)))
                    {
                        CampfireEntry cf = Campfire.GetEntry(entry.Player);

                        if (cf != null && cf.Safe)
                        {
                            entry.Player.SendGump(new CampfireGump(cf, this));
                        }
                    }
                    #endregion
                }

                if (IsUpgraded)
                {
                    /*
                     * if(entry.Player.Hits < entry.Player.HitsMax)
                     *  entry.Player.Hits +=1;
                     * if(entry.Player.Mana < entry.Player.ManaMax)
                     *  entry.Player.Mana +=1;
                     */

                    Effects.SendLocationParticles(this, 0x3779, 1, 30, 1160, 3, 9502, 0);

                    if (!entry.IsBuffed)
                    {
                        DoBuff(entry.Player);
                        entry.IsBuffed = true;
                    }
                }
            }

            IPooledEnumerable eable = GetClientsInRange(SecureRange);

            foreach (NetState state in eable)
            {
                PlayerMobile pm = state.Mobile as PlayerMobile;

                if (pm != null && GetEntry(pm) == null)
                {
                    CampfireEntry entry = new CampfireEntry(pm, this);

                    m_Table[pm] = entry;
                    m_Entries.Add(entry);

                    pm.SendLocalizedMessage(500620); // You feel it would take a few moments to secure your camp.
                }
            }

            eable.Free();
        }
示例#9
0
        private void OnTick()
        {
            DateTime now = DateTime.Now;
            TimeSpan age = now - this.Created;

            if (age >= TimeSpan.FromSeconds(100.0))
            {
                this.Delete();
            }
            else if (age >= TimeSpan.FromSeconds(90.0))
            {
                this.Status = CampfireStatus.Off;
            }
            else if (age >= TimeSpan.FromSeconds(60.0))
            {
                this.Status = CampfireStatus.Extinguishing;
            }

            if (this.Status == CampfireStatus.Off || this.Deleted)
            {
                return;
            }

            foreach (CampfireEntry entry in new ArrayList(m_Entries))
            {
                if (!entry.Valid || entry.Player.NetState == null)
                {
                    RemoveEntry(entry);
                }
                else if (!entry.Safe && now - entry.Start >= TimeSpan.FromSeconds(30.0))
                {
                    entry.Safe = true;
                    entry.Player.SendAsciiMessage("The camp is now secure."); // The camp is now secure.
                }
                else
                {
                }
            }
            int Count = 0;
            IPooledEnumerable eable = this.GetItemsInRange(1);

            foreach (Object o in eable)
            {
                if (o is Campfire)
                {
                    Count++;
                }
            }
            eable.Free();

            eable = this.GetClientsInRange(SecureRange);

            foreach (NetState state in eable)
            {
                PlayerMobile pm = state.Mobile as PlayerMobile;

                if (pm != null && GetEntry(pm) == null)
                {
                    CampfireEntry entry = new CampfireEntry(pm, this);

                    m_Table[pm] = entry;
                    m_Entries.Add(entry);

                    pm.SendAsciiMessage("You feel it would take a few moments to secure your camp.");                       // You feel it would take a few moments to secure your camp.
                }

                if (pm != null && GetEntry(pm) != null && !GetEntry(pm).Safe)
                {
                    if (Utility.Random(1, Count) != Count)
                    {
                        eable.Free();
                        return;
                    }

                    if (pm.InRange(this, 1) && m_Starter != null && pm == m_Starter)
                    {
                        pm.CheckSkill(SkillName.Camping, 0.5);
                    }
                }
            }

            eable.Free();
        }