Пример #1
0
        public override bool OnDeath(Mobile m)
        {
            try
            {
                //check if there is a DRDT region below the houses, and if so use its rules
                RegionControl regstone = null;
                CustomRegion  inHouse  = null;
                inHouse = CustomRegion.FindDRDTRegion(m);
                if (inHouse != null)
                {
                    regstone = inHouse.GetRegionControler();
                }

                if (regstone != null && regstone.NoMurderZone)
                {
                    foreach (AggressorInfo ai in m.Aggressors)
                    {
                        ai.CanReportMurder = false;
                    }
                }
            }
            catch (NullReferenceException e)
            {
                LogHelper.LogException(e);
                Console.WriteLine("{0} Caught exception.", e);
            }
            catch (Exception ex)
            {
                LogHelper.LogException(ex);
            }
            return(base.OnDeath(m));
        }
Пример #2
0
        public override bool OnBeginSpellCast(Mobile from, ISpell s)
        {
            try
            {
                //check if there is a DRDT region below the houses, and if so use its rules
                RegionControl regstone = null;
                CustomRegion  inHouse  = null;
                inHouse = CustomRegion.FindDRDTRegion(from);
                if (inHouse != null)
                {
                    regstone = inHouse.GetRegionControler();
                }

                if (regstone != null)
                {
                    return(inHouse.OnBeginSpellCast(from, s));
                }
            }
            catch (NullReferenceException e)
            {
                LogHelper.LogException(e);
                Console.WriteLine("{0} Caught exception.", e);
            }
            catch (Exception ex)
            {
                LogHelper.LogException(ex);
            }

            return(base.OnBeginSpellCast(from, s));
        }
Пример #3
0
        public override bool OnSkillUse(Mobile m, int skill)
        {
            try
            {
                //check if there is a DRDT region below the houses, and if so use its rules
                RegionControl regstone = null;
                CustomRegion  inHouse  = null;
                if (m != null)
                {
                    inHouse = CustomRegion.FindDRDTRegion(m);
                }
                if (inHouse != null)
                {
                    regstone = inHouse.GetRegionControler();
                }

                if (m != null && regstone != null)
                {
                    return(inHouse.OnSkillUse(m, skill));
                }
            }
            catch (NullReferenceException e)
            {
                LogHelper.LogException(e);
                Console.WriteLine("{0} Caught exception.", e);
            }
            catch (Exception ex)
            {
                LogHelper.LogException(ex);
            }

            return(base.OnSkillUse(m, skill));
        }
Пример #4
0
        public override bool EquipItem(Mobile m, Item item)
        {
            try
            {
                //check if there is a DRDT region below the houses, and if so use its rules
                RegionControl regstone = null;
                CustomRegion  inHouse  = null;
                if (m != null)
                {
                    inHouse = CustomRegion.FindDRDTRegion(m);
                }
                if (inHouse != null)
                {
                    regstone = inHouse.GetRegionControler();
                }

                if (regstone != null)
                {
                    return(inHouse.EquipItem(m, item));
                }
            }
            catch (NullReferenceException e)
            {
                LogHelper.LogException(e);
                Console.WriteLine("{0} Caught exception.", e);
            }
            catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); }

            return(true);
        }
        public static TownshipRegion GetTownshipAt(Point3D point, Map map)
        {
            CustomRegion c = CustomRegion.FindDRDTRegion(map, point);

            if (c is TownshipRegion)
            {
                return((TownshipRegion)c);
            }
            return(null);
        }
        public static TownshipRegion GetTownshipAt(Mobile m)
        {
            CustomRegion c = CustomRegion.FindDRDTRegion(m);

            if (c is TownshipRegion)
            {
                return((TownshipRegion)c);
            }

            return(null);
        }
Пример #7
0
        public override bool OnDoubleClick(Mobile from, object o)
        {
            try
            {
                //check if there is a DRDT region below the houses, and if so use its rules
                RegionControl regstone = null;
                CustomRegion  inHouse  = null;
                if (from != null)
                {
                    inHouse = CustomRegion.FindDRDTRegion(from);
                }
                if (inHouse != null)
                {
                    regstone = inHouse.GetRegionControler();
                }

                if (regstone != null)
                {
                    return(inHouse.OnDoubleClick(from, o));
                }
            }
            catch (NullReferenceException e)
            {
                LogHelper.LogException(e);
                Console.WriteLine("{0} Caught exception.", e);
            }
            catch (Exception ex)
            {
                LogHelper.LogException(ex);
            }

            if (o is Container)
            {
                Container c = (Container)o;

                SecureAccessResult res = m_House.CheckSecureAccess(from, c);

                switch (res)
                {
                case SecureAccessResult.Insecure: break;

                case SecureAccessResult.Accessible: return(true);

                case SecureAccessResult.Inaccessible: c.SendLocalizedMessageTo(from, 1010563); return(false);
                }
            }

            return(true);
        }
Пример #8
0
        public static void OnLogin(LoginEventArgs e)
        {
            // HousingRegion processing
            CustomRegion cr = CustomRegion.FindDRDTRegion(e.Mobile);

            if (cr != null)
            {
                RegionControl rc = cr.GetRegionControler();
                if (rc != null)
                {
                    if (rc.IsHouseRegion == true)
                    {
                        BaseHouse house = BaseHouse.FindHouseAt(e.Mobile);
                        if (house != null && !house.Public && !house.IsFriend(e.Mobile))
                        {
                            e.Mobile.Location = house.BanLocation;
                        }
                    }
                }
            }

            // other OnLogin processing
        }
Пример #9
0
        public static CustomRegion FindDRDTRegion(Map map, Point3D loc)
        {
            Point3D p = loc;

            if (p == Point3D.Zero)
            {
                return(null);
            }

            if (map == Map.Internal || map == null)
            {
                return(null);
            }

            Sector sector = map.GetSector(p);

            if (sector == null || sector.Owner == null || sector == sector.Owner.InvalidSector)
            {
                return(null);
            }

            if (sector.Regions == null)             //new check 2/2/07
            {
                return(null);
            }

            ArrayList list = sector.Regions;

            if (list == null || list.Count == 0)
            {
                return(null);
            }

            ArrayList list2 = new ArrayList();

            for (int i = 0; i < list.Count; ++i)
            {
                if (list[i] is Region)                 //new check 2/2/07
                {
                    Region region = (Region)list[i];

                    if (region == null)
                    {
                        continue;
                    }

                    if (region.Contains(p))
                    {
                        list2.Add(region);
                    }
                }
            }
            foreach (Region reg in list2)
            {
                if (reg == null)
                {
                    continue;
                }

                CustomRegion test = null;

                if (reg is CustomRegion)
                {
                    test = reg as CustomRegion;
                    if (test != null)
                    {
                        return(test);
                    }
                }
            }
            //no custom region found
            return(null);
        }
Пример #10
0
		public void UpdateRegion() {
			if( m_Region != null )
				m_Region.Unregister();

			if( this.Map != null && this.Active ) {
				if( this != null && this.RegionArea != null && this.RegionArea.Length > 0 ) {
					m_Region = new CustomRegion( this );
					m_Region.Register();
				} else
					m_Region = null;
			} else
				m_Region = null;
		}
Пример #11
0
        public void UpdateRegion()
        {
            if (m_Region != null)
                m_Region.Unregister();

            if (this.Map != null && this.Active)
            {
                if (this != null && this.RegionArea != null && this.RegionArea.Length > 0)
                {
                    m_Region = new CustomRegion(this);
                    // m_Region.GoLocation = m_CustomGoLocation;  // REMOVED
                    m_Region.Register();
                }
                else
                    m_Region = null;
            }
            else
                m_Region = null;
        }
Пример #12
0
			protected override void OnTarget( Mobile from, object targeted )
			{
				if( targeted is Mobile )
				{
					Mobile m = (Mobile)targeted;

					Region r = m.Region;			

					if( r == m.Map.DefaultRegion )
					{
						from.SendMessage( "The Region is the Default region for the entire map and as such, cannot have it's bounds displayed." );
						return;
					}

					from.SendMessage( String.Format( "That Mobile's region is of type {0}, with a priority of {1}.", r.GetType().FullName, r.Priority.ToString() ));

					ShowRegionBounds(r, from, false, true);
				}
				else if( targeted is RegionControl )
				{
                    RegionControl control = ((RegionControl)targeted);
					Region r = control.Region;

                    if (control.Active)
                    {
                        if (control.RegionArea == null || control.RegionArea.Length == 0 || r == null)
                        {
                            from.SendMessage("Region area not defined for targeted RegionControl.");
                            return;
                        }

                        from.SendMessage("Displaying targeted RegionControl's ACTIVE Region...");

                        ShowRegionBounds(r, from, true, true);
                    }
                    else
                    {
                        if (control.RegionArea == null || control.RegionArea.Length == 0)
                        {
                            from.SendMessage("Region area not defined for targeted RegionControl.");
                            return;
                        }

                        r = new CustomRegion(control);

                        if (r == null)
                        {
                            from.SendMessage("Region area not defined for targeted RegionControl.");
                            return;
                        }

                        from.SendMessage("Displaying targeted RegionControl's INACTIVE Region...");

                        ShowRegionBounds(r, from, true, false);                      
                    }
				}
				else
				{
					from.SendMessage( "That is not a Mobile or a RegionControl" );
				}
			}
Пример #13
0
		public void UpdateRegion()
		{
			if (Enabled)
			{
				if (Coords != null && Coords.Count != 0)
				{
					if (m_Region == null)
					{
						//Pix: This change was needed so that classes derived from
						// RegionControl could have a different CustomRegion (i.e. a different 
						// class derived from CustomRegion)
						//m_Region = new CustomRegion( this, this.Map );
						m_Region = CreateRegion(this, this.Map);
					}

					Region.RemoveRegion(m_Region);

					m_Region.Coords = Coords;

					m_Region.InnBounds = InnBounds;

					m_Region.IsGuarded = (GetFlag(RegionFlag.IsGuarded));

					m_Region.Name = m_RegionName;

					m_Region.Priority = (int)m_Priority;

					m_Region.Map = m_TargetMap;

					m_Region.MinZ = m_MinZ;

					m_Region.MaxZ = m_MaxZ;

					m_Region.GoLocation = m_GoLocation;

					m_Region.Music = m_Music;

					Region.AddRegion(m_Region);
				}
			}

			return;
		}
Пример #14
0
        public void UpdateRegion()
        {
            if( Coords != null && Coords.Count != 0 )
            {
                if( m_Region == null )
                {
                    m_Region = new CustomRegion( this, this.Map );
                    //Region.AddRegion( m_Region );	//Maybe not needed cause setting map will call this?
                }

                Region.RemoveRegion( m_Region );

                m_Region.Coords = Coords;

                m_Region.Disabled = !(GetFlag( RegionFlag.IsGuarded ));

                m_Region.Music = Music;
                m_Region.Name = m_RegionName;

                m_Region.Priority = (int)m_Priority;

                m_Region.Map = this.Map;

                Region.AddRegion( m_Region );
            }

            return;
        }
Пример #15
0
        public void UpdateRegion()
        {
            if (m_Region != null)
			{
				if (!Initialized)
				{
					m_Region.GoLocation = new Point3D( 0, 0, 0 );
					Initialized = true;
				}
                m_Region.Unregister();
			}

            if (this.Map != null && this.Active)
            {
                if (this != null && this.RegionArea != null && this.RegionArea.Length > 0)
                {
                    m_Region = new CustomRegion(this);

						m_Region.GoLocation = m_CustomGoLocation; 
                    m_Region.Register();
                }
                else
                    m_Region = null;
            }
            else
                m_Region = null;
        }