public override TimeSpan GetLogoutDelay(Mobile m)
        {
            if (m_House.IsFriend(m) && m_House.IsInside(m))
            {
                for (int i = 0; i < m.Aggressed.Count; ++i)
                {
                    AggressorInfo info = (AggressorInfo)m.Aggressed[i];

                    if (info.Defender.Player && (DateTime.Now - info.LastCombatTime) < CombatHeatDelay)
                    {
                        return(base.GetLogoutDelay(m));
                    }
                }

                return(TimeSpan.Zero);
            }
            else
            {
                try
                {
                    Mobile tsnpc = m_House.FindTownshipNPC();
                    if (tsnpc != null && tsnpc is TSInnKeeper)
                    {
                        if (m_House.IsInside(m))
                        {
                            TownshipRegion tr = TownshipRegion.GetTownshipAt(m);
                            if (tr != null)
                            {
                                if (tr.TStone != null && !tr.TStone.IsEnemy(m as PlayerMobile))
                                {
                                    for (int i = 0; i < m.Aggressed.Count; ++i)
                                    {
                                        AggressorInfo info = (AggressorInfo)m.Aggressed[i];

                                        if (info.Defender.Player && (DateTime.Now - info.LastCombatTime) < CombatHeatDelay)
                                        {
                                            return(base.GetLogoutDelay(m));
                                        }
                                    }

                                    return(TimeSpan.Zero);
                                }
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    Server.Commands.LogHelper.LogException(e);
                }
            }

            return(base.GetLogoutDelay(m));
        }
Esempio n. 2
0
        public override TimeSpan GetLogoutDelay(Mobile m)
        {
            // prefer house region settings if we are a housing region
            if (m_Controller.IsHouseRegion == true)
            {
                BaseHouse house = BaseHouse.FindHouseAt(m);
                if (house != null)
                {
                    if (house.IsFriend(m) && house.IsInside(m))
                    {
                        for (int i = 0; i < m.Aggressed.Count; ++i)
                        {
                            AggressorInfo info = (AggressorInfo)m.Aggressed[i];

                            if (info.Defender.Player && (DateTime.Now - info.LastCombatTime) < CombatHeatDelay)
                            {
                                return(base.GetLogoutDelay(m));
                            }
                        }

                        return(TimeSpan.Zero);
                    }
                    else
                    {
                        try
                        {
                            Mobile tsnpc = house.FindTownshipNPC();
                            if (tsnpc != null && tsnpc is TSInnKeeper)
                            {
                                if (house.IsInside(m))
                                {
                                    TownshipRegion tr = TownshipRegion.GetTownshipAt(m);
                                    if (tr != null)
                                    {
                                        if (tr.TStone != null && !tr.TStone.IsEnemy(m as PlayerMobile))
                                        {
                                            for (int i = 0; i < m.Aggressed.Count; ++i)
                                            {
                                                AggressorInfo info = (AggressorInfo)m.Aggressed[i];

                                                if (info.Defender.Player && (DateTime.Now - info.LastCombatTime) < CombatHeatDelay)
                                                {
                                                    return(base.GetLogoutDelay(m));
                                                }
                                            }

                                            return(TimeSpan.Zero);
                                        }
                                    }
                                }
                            }
                        }
                        catch (Exception e)
                        {
                            Scripts.Commands.LogHelper.LogException(e);
                        }
                    }

                    return(base.GetLogoutDelay(m));
                }
            }

            // if we are not a house (or there is no house at this location), use region controller settings
            if (m.Aggressors.Count == 0 && m.Aggressed.Count == 0 && IsInInn(m.Location))
            {
                return(m_Controller.InnLogoutDelay);
            }
            else
            {
                return(m_Controller.PlayerLogoutDelay);
            }
        }
Esempio n. 3
0
		public static bool DoesTownshipRegionConflict( Point3D centerLocation, Map map, int radius, TownshipRegion ignoreThisRegion )
		{
			bool bReturn = false;

			int x = centerLocation.X;
			int y = centerLocation.Y;
			int z = centerLocation.Z;

			int x_start = x - radius;
			int y_start = y - radius;
			int x_end = x + radius;
			int y_end = y + radius;

			for( int i=x_start; i<x_end; i++ )
			{
				for( int j=y_start; j<y_end; j++ )
				{
					Region r = Region.Find( new Point3D(i, j, z), map );

					if( r is TownshipRegion || 
						r is GuardedRegion ||
						r is CustomRegion )
					{
						if (ignoreThisRegion != null && r == ignoreThisRegion)
						{
						}
						else
						{
							bReturn = true;
							break;
						}
					}
				}

				if( bReturn ) break;
			}


			return bReturn;
		}