Inheritance: MagerySpell
Example #1
0
            public InternalTarget(GateTravelSpell owner)
                : base(12, false, TargetFlags.None)
            {
                this.m_Owner = owner;

                owner.Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 501029); // Select Marked item.
            }
Example #2
0
            public InternalTarget( GateTravelSpell owner )
                : base(12, false, TargetFlags.None)
            {
                m_Owner = owner;

                owner.Caster.LocalOverheadMessage( MessageType.Regular, 0x3B2, 501029 ); // Select Marked item.
            }
 public InternalSphereTarget(GateTravelSpell owner)
     : base(Core.ML ? 10 : 12, false, TargetFlags.None)
 {
     m_Owner = owner;
     m_Owner.Caster.SendAsciiMessage("Selecione o alvo...");
 }
Example #4
0
        public static bool CheckTravel(Map map, Point3D loc, TravelCheckType type, Mobile caster, out bool jail)
		{
            jail = false;

			if ( IsInvalid( map, loc ) ) // null, internal, out of bounds
				return false;

			// custom regions
			CustomRegion reg = Region.Find( loc, map ) as CustomRegion;
			CustomRegion reg2 = CustomRegion.FindDRDTRegion(caster);
			if( reg != null ) 
			{
				try
				{
					RegionControl regstone = null;

					//if a custom region does exsist find its controller
					regstone = reg.GetRegionControler(); 

					if (regstone != null && caster.AccessLevel == AccessLevel.Player)
					{
						if(regstone.AllowTravelSpellsInRegion && reg == reg2)
							return true;
						
						if(regstone.NoRecallInto && type == TravelCheckType.RecallTo)
							return false;

						if(regstone.NoGateInto && type == TravelCheckType.GateTo)
							return false;

						Spell spell = new GateTravelSpell(caster, null);

						if(regstone.IsRestrictedSpell(spell, caster) && type == TravelCheckType.GateFrom)
							return false;


						if(regstone.CannotEnter && type == TravelCheckType.TeleportTo)
							return false;
					}

				}
	
				catch(NullReferenceException e)
				{
					LogHelper.LogException(e);
					Console.WriteLine("{0} Caught exception.", e); 
				}
				catch(Exception ex)
				{
                    LogHelper.LogException(ex);
				}
			}

			if( reg2 != null ) 
			{
				try
				{
					RegionControl regstone = null;

					//if a custom region does exsist find its controller
					regstone = reg2.GetRegionControler(); 

					if (regstone != null && caster.AccessLevel == AccessLevel.Player)
					{
						if(regstone.AllowTravelSpellsInRegion && reg == reg2)
							return true;
						

						if(regstone.NoRecallInto && type == TravelCheckType.RecallTo)
							return false;

						if(regstone.NoGateInto && type == TravelCheckType.GateTo)
							return false;

						Spell spell = new GateTravelSpell(caster, null);

						if(regstone.IsRestrictedSpell(spell, caster) && type == TravelCheckType.GateFrom)
							return false;


						if(regstone.CannotEnter && type == TravelCheckType.TeleportTo)
							return false;
					}

				}
	
				catch(NullReferenceException e)
				{
					LogHelper.LogException(e);
					Console.WriteLine("{0} Caught exception.", e); 
				}
				catch(Exception ex)
				{
                    LogHelper.LogException(ex);
				}
			}

			//Deal with house SecurePremises flag
            if ((type == TravelCheckType.GateTo || type == TravelCheckType.RecallTo ||
                type == TravelCheckType.TeleportTo) && caster.AccessLevel == AccessLevel.Player)
			{
				BaseHouse dst_house = null;
				Sector sector = map.GetSector( loc );
				foreach (BaseMulti mx in sector.Multis.Values)
				{
					BaseHouse _house = mx as BaseHouse;
                    if (_house == null)
                        continue;

					if ( _house != null && _house.Region.Contains(loc) )
					{
						dst_house = _house;
					}
				}

				if( dst_house != null )
				{
					if( dst_house.SecurePremises )
					{
						if( !dst_house.IsFriend( caster ) )
						{
							return false;
						}
					}
				}

			}

            // Gate inside a PreviewHouse exploit. Go directally to jail, don't collect $200.0
            if ((type == TravelCheckType.GateTo ||type == TravelCheckType.RecallTo ||
                type == TravelCheckType.TeleportTo) && caster.AccessLevel == AccessLevel.Player)
            {
                if (PreviewHouseAt(caster.Map, loc))
                {
                    LogHelper.Cheater(caster, "Travel inside a PreviewHouse exploit.", true);
                    jail = true;
                    return false;
                }
            }

            // Teleport onto a stack of stuff =\
            if (type == TravelCheckType.TeleportTo  && caster.AccessLevel == AccessLevel.Player)
            {
                // if we are teleporting onto a stack of movable items, and at least 3 reside on different Z planes
                //  then it looks too much like an exploit to allow it.
                if (iStack(caster, loc, 2) == false)
                {
                    LogHelper.Cheater(caster, "Tele onto a stack of movable items.", true);
                    return false;
                }
            }

            // mark on a stack of stuff =\
            // same as teleport above, but different limit and different message
            if (type == TravelCheckType.Mark && caster.AccessLevel == AccessLevel.Player)
            {
                // if we are marking on a stack of movable items, and at least 2 reside on different Z planes
                //  then it looks too much like an exploit to allow it.
                if (iStack(caster, loc, 2) == false)
                {
                    LogHelper.Cheater(caster, "Mark on a stack of movable items.", true);
                    return false;
                }
            }

            // disallow teleporting from outside the house into the inside if the doors are closed (no LOS)
            if ((type == TravelCheckType.TeleportTo) && caster.AccessLevel == AccessLevel.Player)
            {
                BaseHouse dst_house = null;
                Sector sector = map.GetSector(loc);
				foreach (BaseMulti mx in sector.Multis.Values)
                {
					BaseHouse _house = mx as BaseHouse;
                    if (_house == null)
                        continue;

                    if (_house != null && _house.Region.Contains(loc))
                    {
                        dst_house = _house;
                    }
                }

                // is the user trying to shoot through a door without LOS?
                if (dst_house != null)
                {
                    if (!caster.InLOS(loc))
                    {
                        LogHelper.Cheater(caster, "Try to teleport through front door (LOS)", true);
                        return false;
                    }
                }

                // is the user not standing on the ground?
                if (dst_house != null && dst_house.Region != null)
                {   
                    if (!caster.Map.CanSpawnMobile(caster.Location.X, caster.Location.Y, caster.Location.Z, CanFitFlags.requireSurface))
                    {
                        LogHelper.Cheater(caster, "Try to teleport over front door (Z Axis)", true);
                        return false;
                    }
                }

            }

            // special housing region/multi exploit - teleport from multi to castle courtyard
            // stop players from teleporting from one multi to another (includes PreviewHouses)
            if(type == TravelCheckType.TeleportTo && caster.AccessLevel == AccessLevel.Player)
            {
                // if there is a house at the destination, then..
                //  if all the multis and regions do not match between src and dst, fail
                if (HouseAt(caster.Map, loc) && CheckParity(caster.Map, caster.Location, loc) == false)
                {
                    LogHelper.Cheater(caster, "Multi to multi teleport exploit.", true);
                    return false;
                }
            }

            // Replaced by above CheckParity() implementation (delete after 5/1/07)
            // special housing region exploit - teleport from tower roof to castle courtyard
            /*if(type == TravelCheckType.TeleportTo && caster.AccessLevel == AccessLevel.Player)
            {
                BaseHouse src_house = BaseHouse.FindHouseAt( caster );
                BaseHouse dst_house = null;
				
                // add this redundant check here to eliminate the house enumeration
                //	for the cases when it's not needed.
                if (src_house != null)
                {
                    // build super sector that includes both src and dest
                    ArrayList SuperSector = new ArrayList();
                    SuperSector.Add(src_house);
                    Sector sector = map.GetSector( loc );
                    for ( int i = 0; i < sector.Multis.Count; ++i )
                    {
                        BaseHouse _house = sector.Multis[i] as BaseHouse;
                        if ( _house != null  )
                            if (SuperSector.Contains(_house) == false) // disallow duplicates
                                SuperSector.Add(_house);
                    }
					
                    // now add these if the houses are in different sectors
                    if (sector != map.GetSector( caster ))
                    {
                        sector = map.GetSector( caster );
                        for ( int i = 0; i < sector.Multis.Count; ++i )
                        {
                            BaseHouse _house = sector.Multis[i] as BaseHouse;
                            if ( _house != null  )
                                if (SuperSector.Contains(_house) == false) // disallow duplicates
                                    SuperSector.Add(_house);
                        }
                    }

                    // get the destination house
                    for ( int i = 0; i < SuperSector.Count; ++i )
                    {
                        BaseHouse _house = SuperSector[i] as BaseHouse;

                        if ( _house.Region.Contains(loc) )
                        {
                            //Console.WriteLine("dst_house.region{0}, loc{1}", _house.Region.Coords.ToString(), loc.ToString()); 
                            dst_house = _house;
                        }
                    }

                    // okay, if source house and dest house are different, fail
                    bool house = (src_house != null && dst_house != null);
                    if (house == true && src_house != dst_house)
                    {
                        //Console.WriteLine("Caught invalid teleport."); 
                        LogHelper.Cheater(caster, "Tower roof teleport exploit: case(1)", true);
                        return false;
                    }

                    // house region overlap test: possible with the Tower overhang, overhanging
                    //	another house / courtyard
                    int houses = 0;
                    for ( int i = 0; i < SuperSector.Count; ++i )
                    {
                        BaseHouse _house = SuperSector[i] as BaseHouse;
                        if ( _house.Region.Contains(caster.Location) )
                            houses++;
                    }
                    if (houses > 1)
                    {
                        LogHelper.Cheater(caster, "Tower roof teleport exploit: case(2)", true);
                        return false;
                    }
                }
            }*/

            // okay, now check our locale rules table
			int v = (int)type;
			bool isValid = true;

			for ( int i = 0; isValid && i < m_Validators.Length; ++i )
				isValid = ( m_Rules[v, i] || !m_Validators[i]( map, loc ) );

			return isValid;
		}
Example #5
0
		public bool Gate(Mobile m)
		{
			if (m == null || m.Deleted)
			{
				return false;
			}

			if (_Location.Internal || _Location.Zero)
			{
				m.SendMessage("That rune is blank.");
				return false;
			}

			if (m.Player)
			{
				var t = GetType();

				if (m.AccessLevel < AccessLevel.Counselor && !m.BeginAction(t))
				{
					m.SendMessage("You must wait before using the rune codex again.");
					return false;
				}

				GateTravelSpell spell = new GateTravelSpell(
					m, null, new RunebookEntry(_Location.Location, _Location.Map, _Description, null));

				if (!spell.Cast())
				{
					m.EndAction(t);
					return false;
				}

				Timer.DelayCall(TimeSpan.FromSeconds(3), () => m.EndAction(t));
			}
			else
			{
				_Location.MoveToWorld(m);
			}

			return true;
		}
            public GateGump(TeiravonMobile TMPlayer, int cnt, int s1, int s2, int s3, GateTravelSpell spell)
                : base(50, 50)
            {
                m_GateSpell = spell;
                tm          = TMPlayer;
                rcnt        = cnt;
                RuneList[1] = s1;
                RuneList[2] = s2;
                RuneList[3] = s3;

                this.Closable   = true;
                this.Disposable = true;
                this.Dragable   = true;
                this.Resizable  = false;
                this.AddPage(0);
                this.AddImage(0, 0, 0x7724);
                if (RuneList[1] != 0)
                {
                    this.AddItem(165, 220, 3673 + (RuneList[1] * 3));
                }
                if (RuneList[2] != 0)
                {
                    this.AddItem(210, 210, 3673 + (RuneList[2] * 3));
                }
                if (RuneList[3] != 0)
                {
                    this.AddItem(245, 220, 3673 + (RuneList[3] * 3));
                }

                this.AddButton(364, 411, 247, 248, (int)Buttons.OkCast, GumpButtonType.Reply, 0);
                this.AddButton(40, 411, 241, 243, (int)Buttons.NullButton, GumpButtonType.Reply, 0);

                //Misc
                //int laby = 98;
                //int buty = 100;
                int rune = 3673;


                //this.AddItem(40, laby += 25, rune += 3);
                if (rcnt < 3)
                {
                    this.AddButton(220, 65, 9026, 9028, (int)Buttons.Rune1, GumpButtonType.Reply, 0);
                    this.AddItem(210, 45, rune += 3);
                }
                //this.AddItem(40, laby += 25, rune += 3);
                if (rcnt < 3)
                {
                    this.AddButton(115, 160, 9026, 9028, (int)Buttons.Rune2, GumpButtonType.Reply, 0);
                    this.AddItem(85, 140, rune += 3);
                }
                //this.AddItem(40, laby += 25, rune += 3);
                if (rcnt < 3)
                {
                    this.AddButton(320, 160, 9026, 9028, (int)Buttons.Rune3, GumpButtonType.Reply, 0);
                    this.AddItem(330, 140, rune += 3);
                }
                //this.AddItem(40, laby += 25, rune += 3);
                if (rcnt < 3)
                {
                    this.AddButton(90, 290, 9026, 9028, (int)Buttons.Rune4, GumpButtonType.Reply, 0);
                    this.AddItem(60, 310, rune += 3);
                }
                //this.AddItem(40, laby += 25, rune += 3);
                if (rcnt < 3)
                {
                    this.AddButton(350, 290, 9026, 9028, (int)Buttons.Rune5, GumpButtonType.Reply, 0);
                    this.AddItem(360, 310, rune += 3);
                }
            }
        public static void MoonGate_Callback(object state)
        {
            object[]        states  = ((object[])state);
            GateTravelSpell m_Spell = (GateTravelSpell)states[0];
            int             m_Step  = (int)states[1];
            Point3D         m_Loc   = (Point3D)states[2];
            Map             m_Map   = Map.Felucca;

            if (m_Spell.Runes != 0 && m_Spell.Runes != null && m_Loc.X == 0)
            {
                switch (m_Spell.Runes)
                {
                case 152:
                    m_Loc = new Point3D(3145, 3107, -4);
                    break;

                case 324:
                    m_Loc = new Point3D(3619, 2224, 1);
                    break;

                case 545:
                    m_Loc = new Point3D(3159, 1498, 31);
                    break;

                case 135:
                    m_Loc = new Point3D(4097, 1979, 1);
                    break;

                case 412:
                    m_Loc = new Point3D(3149, 405, 1);
                    break;

                case 345:
                    m_Loc = new Point3D(1083, 2989, -4);
                    break;

                case 213:
                    m_Loc = new Point3D(4582, 282, 1);
                    break;
                }
            }

            if (!m_Spell.Caster.Mounted && m_Spell.Caster.Body.IsHuman)
            {
                m_Spell.Caster.Animate(263, 7, 1, true, false, 0);
            }
            if (m_Step < 3)
            {
                m_Step++;
                Timer.DelayCall(TimeSpan.FromSeconds(1.5), new TimerStateCallback(MoonGate_Callback), new object[] { m_Spell, m_Step, m_Loc });
                AbilityCollection.AreaEffect(TimeSpan.FromSeconds(0.1), TimeSpan.FromSeconds(0.1), 0.1, m_Spell.Caster.Map, (Point3D)m_Spell.Caster.Location, 0x377A, 15, 0, 2, 8, 10, true, false, false);
                if (m_Loc.X != 0)
                {
                    AbilityCollection.AreaEffect(TimeSpan.FromSeconds(0.1), TimeSpan.FromSeconds(0.1), 0.1, m_Map, new Point3D(m_Loc.X, m_Loc.Y, m_Loc.Z + 5), 0x377A, 4, 0, 2, 8, 10, true, false, false);
                }
            }
            else if (m_Loc.X != 0)
            {
                m_Spell.Effect(m_Loc, m_Map, false);
                m_Spell.FinishSequence();
            }
            else
            {
                m_Spell.Caster.SendMessage("You have failed to open a gate to anywhere");
                m_Spell.DoFizzle();
                m_Spell.FinishSequence();
            }
        }
 public InternalSphereTarget(GateTravelSpell owner)
     : base(Core.ML ? 10 : 12, false, TargetFlags.None)
 {
     m_Owner = owner;
     m_Owner.Caster.SendAsciiMessage("Select target...");
 }