Inheritance: System.EventArgs
Exemple #1
0
 public static void InvokeMovement(MovementEventArgs e)
 {
     if (EventSink.Movement != null)
     {
         EventSink.Movement.Invoke(e);
     }
 }
		public static void EventSink_Movement(MovementEventArgs e)
		{
			Mobile from = e.Mobile;

			if (!from.Player || !from.Alive || from.AccessLevel >= AccessLevel.GameMaster)
				return;

			int maxWeight = GetMaxWeight(from) + OverloadAllowance;
			int overWeight = (Mobile.BodyWeight + from.TotalWeight) - maxWeight;

			if (overWeight > 0)
			{
				from.Stam -= GetStamLoss(from, overWeight, (e.Direction & Direction.Running) != 0);

				if (from.Stam == 0)
				{
					from.SendLocalizedMessage(500109); // You are too fatigued to move, because you are carrying too much weight!
					e.Blocked = true;
					return;
				}
			}

			// old stamina handling. activated when the new stamsystem (SytamSystem.cs) is deacticated.
			if (!StamSystem.active)
			{
				if (from is PlayerMobile)
				{
					int amt = (int)((m_ScaleWithHits + (m_ScaleWithHits * ((double)from.Hits / (double)from.HitsMax))) * (double)(from.Mounted ? m_TiredAfterSteps * m_HorseMoreSteps : m_TiredAfterSteps));
					PlayerMobile pm = (PlayerMobile)from;

					if ((++pm.StepsTaken % amt) == 0)
						--from.Stam;
				}
			}
		}
 public static void InvokeMovement(MovementEventArgs e)
 {
     if (Movement != null)
     {
         Movement(e);
     }
 }
Exemple #4
0
        public static void EventSink_Movement(MovementEventArgs e)
        {
            Mobile    from = e.Mobile;
            Direction d    = e.Direction;

            if (IsTeleporting(from, d))
            {
                e.Blocked = true;
            }
        }
		private static void OnMovement( MovementEventArgs args )
		{
			Mobile m = args.Mobile;

			if( m == null || m.Map == null || m.Map == Map.Internal )
				return;

			if( m.BodyMod == 305 )
				new Server.Items.Blood( Utility.RandomList( 4650, 4651, 4652, 4653, 4654, 4655, 7428, 7410, 7418 ) ).MoveToWorld( m.Location, m.Map );
		}
		public static void EventSink_Movement( MovementEventArgs e )
		{
			Mobile from = e.Mobile;

			if ( !from.Alive || from.AccessLevel > AccessLevel.Player  )
				return;

			if ( !from.Player )
			{
				// Else it won't work on monsters.
				Spells.Ninjitsu.DeathStrike.AddStep( from );
				return;
			}

			int maxWeight = GetMaxWeight( from ) + OverloadAllowance;
			int overWeight = (Mobile.BodyWeight + from.TotalWeight) - maxWeight;

			if ( overWeight > 0 )
			{
				from.Stam -= GetStamLoss( from, overWeight, (e.Direction & Direction.Running) != 0 );

				if ( from.Stam == 0 )
				{
					from.SendLocalizedMessage( 500109 ); // You are too fatigued to move, because you are carrying too much weight!
					e.Blocked = true;
					return;
				}
			}

			if ( ((from.Stam * 100) / Math.Max( from.StamMax, 1 )) < 10 )
				--from.Stam;

			if ( from.Stam == 0 )
			{
                if (from.Female)
                    from.SendMessage("Vous êtes trop fatiguée pour bouger");
                else
                    from.SendMessage("Vous êtes trop fatigué pour bouger");
                //from.SendLocalizedMessage( 500110 ); // You are too fatigued to move.
				e.Blocked = true;
				return;
			}

			if ( from is PlayerMobile )
			{
				int amt = ( from.Mounted ? 48 : 16 );
				PlayerMobile pm = (PlayerMobile)from;

				if ( (++pm.StepsTaken % amt) == 0 )
					--from.Stam;
			}

			Spells.Ninjitsu.DeathStrike.AddStep( from );
		}
		public static void EventSink_Movement( MovementEventArgs e )
		{
			Mobile from = e.Mobile;

			if ( !from.Alive || from.AccessLevel > AccessLevel.Player  )
				return;

			if ( !from.Player )
			{
				return;
			}

			int maxWeight = GetMaxWeight( from ) + OverloadAllowance;
			int overWeight = (Mobile.BodyWeight + from.TotalWeight) - maxWeight;

			if ( overWeight > 0 )
			{
				from.Stam -= GetStamLoss( from, overWeight, (e.Direction & Direction.Running) != 0 );

				if ( from.Stam == 0 )
				{
					from.SendLocalizedMessage( 500109 ); // You are too fatigued to move, because you are carrying too much weight!
					e.Blocked = true;
					return;
				}
			}

			if ( ((from.Stam * 100) / Math.Max( from.StamMax, 1 )) < 10 )
				--from.Stam;

            // allow them to move
			/* 
            if ( from.Stam == 0 )
			{
				from.SendLocalizedMessage( 500110 ); // You are too fatigued to move.
				e.Blocked = true;
				return;
			}*/
/*
			if ( from is PlayerMobile & from.Running )
			{
				PlayerMobile pm = (PlayerMobile)from;

				int hits = ( from.Hits * 100 ) / from.HitsMax;

				from.Stam -= Math.Max( (20 - hits) / 5, 0 ); //1 point per step for every 5% health below 20%

				int amt = (int)( ( from.Mounted ? ( m_MountSteps + ((from.Mount is FactionWarHorse) ? 10 : 0) ) : m_UnmountSteps ) * ( Math.Min( from.Dex, 90 ) / 90.0 ) );

				if ( amt == 0 || (++pm.StepsTaken % amt) == 0 )
					--from.Stam;
			}
*/
		}
Exemple #8
0
        public static void EventSink_Movement(MovementEventArgs e)
        {
            Mobile from = e.Mobile;

            if (from != null && from.Alive)
            {
                Item item = from.FindItemOnLayer(Layer.Shoes);

                if (item is StoneFootwear)
                    e.Blocked = true;
            }
        }
Exemple #9
0
        public static void EventSink_Movement( MovementEventArgs e )
        {
            Mobile from = e.Mobile;

            if ( !from.Alive || from.AccessLevel > AccessLevel.Player  )
                return;

            if ( !from.Player )
            {
                // Else it won't work on monsters.
                Spells.Ninjitsu.DeathStrike.AddStep( from );
                return;
            }

            int maxWeight = GetMaxWeight( from ) + OverloadAllowance;
            int overWeight = (Mobile.BodyWeight + from.TotalWeight) - maxWeight;

            if ( overWeight > 0 )
            {
                from.Stam -= GetStamLoss( from, overWeight, (e.Direction & Direction.Running) != 0 );

                if ( from.Stam == 0 )
                {
                    from.SendAsciiMessage( "You are too fatigued to move." ); // You are too fatigued to move, because you are carrying too much weight!
                    e.Blocked = true;
                    return;
                }
            }

            if ( ((from.Stam * 100) / Math.Max( from.StamMax, 1 )) < 10 )
                --from.Stam;

            if ( from.Stam == 0 )
            {
                from.SendAsciiMessage( "You are too fatigued to move." ); // You are too fatigued to move.
                e.Blocked = true;
                return;
            }

            double myrate = 1/(0.043972*Math.Pow(Math.E, 3.131*(double)((double)(Mobile.BodyWeight + from.TotalWeight) / (double)GetMaxWeight(from))));

            if ( from is PlayerMobile )
            {
                int amt = (from.Mounted ? (int)(myrate*48) : (int)(myrate*16));//(int)((double)myrate * 16));
                PlayerMobile pm = (PlayerMobile)from;

                if ( amt != 0 && (++pm.StepsTaken % amt) == 0 )
                    --from.Stam;
            }

            Spells.Ninjitsu.DeathStrike.AddStep( from );
        }
Exemple #10
0
		public override void OnMovement(MovementEventArgs e )
		{
			base.OnMovement(e);
		    
			if(e.Mobile == null || e.Mobile.AccessLevel > AccessLevel.Player) return;

			if(AttachedTo is Item && (((Item)AttachedTo).Parent == null) && Utility.InRange( e.Mobile.Location, ((Item)AttachedTo).Location, proximityrange ))
			{
				OnTrigger(null, e.Mobile);
			} 
			else
				return;
		}
Exemple #11
0
        static void EventSink_Movement(MovementEventArgs e)
        {
            if ((e.Mobile is TeiravonMobile) && m_IdanBlood.Contains(( TeiravonMobile )e.Mobile))
            {
                if (Utility.RandomMinMax(1, 2) == 2)
                {
                    Static blood = new Static(Utility.RandomMinMax(4650, 4654));

                    blood.MoveToWorld(e.Mobile.Location, e.Mobile.Map);

                    Timer.DelayCall(TimeSpan.FromSeconds(1.5), new TimerStateCallback(DeleteBlood_Callback), blood);
                }
            }
        }
		public static void EventSink_Movement( MovementEventArgs e )
		{
			Mobile from = e.Mobile;

			if ( !from.Player )
				return;

			if ( from is PlayerMobile )
			{
				Account acct = from.Account as Account;
				
				if( acct.m_STIntervalStart + TimeSpan.FromMinutes(20.0) > DateTime.Now )
				{//within 20 minutes from last step - count step
					acct.m_STSteps++;
				}
				else
				{
					//ok, we're outside of a 20-minute period,
					//so see if they've moved enough within the last 10 
					//minutes... if so, increment time
					if( acct.m_STSteps > 50 )
					{
						//Add an house to the house's refresh time
						BaseHouse house = null;
						for( int i=0; i<5; i++ )
						{
							Mobile m = acct[i];
							if( m != null )
							{
								ArrayList list = BaseHouse.GetHouses(m);
								if( list.Count > 0 )
								{
									house = (BaseHouse)list[0];
									break;
								}
							}
						}
						if( house != null )
						{
							house.RefreshHouseOneDay();
						}
					}
					acct.m_STIntervalStart = DateTime.Now;
					acct.m_STSteps = 1;
				}
			}
		}
        public static MovementEventArgs Create(Mobile mobile, Direction dir)
        {
            MovementEventArgs args;

            if (m_Pool.Count > 0)
            {
                args = m_Pool.Dequeue();

                args.m_Mobile    = mobile;
                args.m_Direction = dir;
                args.m_Blocked   = false;
            }
            else
            {
                args = new MovementEventArgs(mobile, dir);
            }

            return(args);
        }
        public static void EventSink_Movement( MovementEventArgs e )
        {
            Mobile from = e.Mobile;

            if ( !from.Player || !from.Alive || from.AccessLevel >= AccessLevel.GameMaster )
                return;

            int maxWeight = GetMaxWeight( from ) + OverloadAllowance;
            int overWeight = (Mobile.BodyWeight + from.TotalWeight) - maxWeight;

            if ( overWeight > 0 )
            {
                from.Stam -= GetStamLoss( from, overWeight, (e.Direction & Direction.Running) != 0 );

                if ( from.Stam == 0 )
                {
                    from.SendLocalizedMessage( 500109 ); // You are too fatigued to move, because you are carrying too much weight!
                    e.Blocked = true;
                    return;
                }
            }

            if ( ((from.Stam * 100) / Math.Max( from.StamMax, 1 )) < 10 )
                --from.Stam;

            if ( from.Stam == 0 )
            {
                from.SendLocalizedMessage( 500110 ); // You are too fatigued to move.
                e.Blocked = true;
                return;
            }

            if ( from is PlayerMobile )
            {
                int amt = ( from.Mounted ? 48 : 16 );
                PlayerMobile pm = (PlayerMobile)from;

                if ( (++pm.StepsTaken % amt) == 0 )
                    --from.Stam;
            }
        }
Exemple #15
0
        public static MovementEventArgs Create( Mobile mobile, Direction dir )
        {
            MovementEventArgs args;

            if ( m_Pool.Count > 0 )
            {
                args = m_Pool.Dequeue();

                args.m_Mobile = mobile;
                args.m_Direction = dir;
                args.m_Blocked = false;
            }
            else
            {
                args = new MovementEventArgs( mobile, dir );
            }

            return args;
        }
        public static void EventSink_Movement( MovementEventArgs e )
        {
            Mobile from = e.Mobile;

            if ( !from.Alive )
                return;

            bool reforging = from is PlayerMobile && ((PlayerMobile)from).Reforging;
            bool staff = from.AccessLevel > AccessLevel.Player;

            if( !reforging && !staff )
            {
                if ( !from.Player )
                {
                    // Else it won't work on monsters.
                    Spells.ExoticWeaponry.DeathStrike.AddStep( from );
                    return;
                }

                int maxWeight = GetMaxWeight( from ) + OverloadAllowance;
                int overWeight = (Mobile.BodyWeight + from.TotalWeight) - maxWeight;

                if ( overWeight > 0 )
                {
                    if( from.Mounted )
                    {
                        Mobile mob = from.Mount as Mobile;
                        mob.Stam -= GetStamLoss( from, overWeight, ( e.Direction & Direction.Running ) != 0 );
                    }

                    else
                        from.Stam -= GetStamLoss( from, overWeight, (e.Direction & Direction.Running) != 0 );

                    if( from.Mounted )
                    {
                        Mobile mob = from.Mount as Mobile;

                        if( mob.Stam == 0 )
                        {
                            from.SendMessage( "Your mount is too fatigued to move." );
                            e.Blocked = true;
                            return;
                        }
                    }

                    else if ( from.Stam == 0 )
                    {
                        from.SendLocalizedMessage( 500109 ); // You are too fatigued to move, because you are carrying too much weight!
                        e.Blocked = true;
                        return;
                    }
                }

                if( !from.Mounted )
                {
                    if( ( ( from.Stam * 100 ) / Math.Max( from.StamMax, 1 ) ) < 10 )
                        --from.Stam;

                    int drain = 0;

                    if( from is PlayerMobile )
                    {
                        PlayerMobile player = from as PlayerMobile;
                        bool running = ( ( e.Direction & Direction.Running ) != 0 );

                        int penalty = 10 - ( from.Stam * 10 ) / Math.Max( from.StamMax, 1 );

                        int draincheck = Utility.Random( 100 );

                        if( penalty >= draincheck )
                        {
                            if( penalty > 6 )
                                drain++;
                            if( penalty > 12 )
                                drain++;
                            if( penalty > 18 )
                                drain++;
                            if( penalty > 24 )
                                drain++;
                            if ( penalty > 30 )
                                drain++;
                            if( !running )
                                drain -= 2;

                            drain = Math.Max( drain, 0 );

                            from.Stam -= drain;
                        }
                    }
                }

                if( from.Mounted )
                {
                    Mobile mob = from.Mount as Mobile;

                    if( ( ( mob.Stam * 100 ) / Math.Max( mob.StamMax, 1 ) ) < 10 )
                        --mob.Stam;

                    if( mob.Stam == 0 )
                    {
                        from.SendMessage( "Your mount is too fatigued to move." );
                        e.Blocked = true;
                        return;
                    }
                }

                else if ( from.Stam == 0 )
                {
                    from.SendLocalizedMessage( 500110 ); // You are too fatigued to move.
                    e.Blocked = true;
                    return;
                }
            }

            if ( from is PlayerMobile && !from.Mounted )
            {
                int amt = ( from.Mounted ? 48 : 16 );
                PlayerMobile pm = (PlayerMobile)from;

                if ( (++pm.StepsTaken % amt) == 0 )
                    --from.Stam;
            }

            Spells.ExoticWeaponry.DeathStrike.AddStep( from );
        }
Exemple #17
0
 public static void InvokeMovement( MovementEventArgs e )
 {
     if ( Movement != null )
         Movement( e );
 }
Exemple #18
0
		public static void InvokeMovement(MovementEventArgs e)
		{
			if (Movement != null)
			{
				foreach (MovementEventHandler currentDelegate in Movement.GetInvocationList())
				{
					try
					{
						currentDelegate.Invoke(e);
					}
					catch (Exception ex)
					{
						// Log an exception
						EventSink.InvokeLogException(new LogExceptionEventArgs(ex));
					}
				}
			}
		}
Exemple #19
0
        public static void EventSink_Movement(MovementEventArgs args)
        {
            Mobile from = args.Mobile;

            if (!from.Player /* || from.AccessLevel > AccessLevel.Player */)
                return;

            // check for any items in the same sector
            if (from.Map != null)
            {
                IPooledEnumerable itemlist = from.Map.GetItemsInRange(from.Location, Map.SectorSize);
                if (itemlist != null)
                {
                    foreach (Item i in itemlist)
                    {
                        if (i == null || i.Deleted) continue;

                        ArrayList alist = XmlAttach.FindAttachments(i);
                        if (alist != null)
                        {
                            foreach (XmlAttachment a in alist)
                            {
                                if (a != null && !a.Deleted && a.HandlesOnMovement)
                                {
                                    a.OnMovement(args);
                                }
                            }
                        }
                    }
                    itemlist.Free();
                }


                // check for mobiles
                IPooledEnumerable moblist = from.Map.GetMobilesInRange(from.Location, Map.SectorSize);
                if (moblist != null)
                {
                    foreach (Mobile i in moblist)
                    {
                        // dont respond to self motion
                        if (i == null || i.Deleted || i == from) continue;

                        ArrayList alist = XmlAttach.FindAttachments(i);
                        if (alist != null)
                        {
                            foreach (XmlAttachment a in alist)
                            {
                                if (a != null && !a.Deleted && a.HandlesOnMovement)
                                {
                                    a.OnMovement(args);
                                }
                            }
                        }
                    }
                    moblist.Free();
                }
            }
        }
Exemple #20
0
		public override void OnMovement(MovementEventArgs e)
		{
			base.OnMovement(e);

			if (UseEffectsDamageIndicator)
			{
				NeedsEffectsUpdate = true;

				// if the effects timer is not running
				if (m_EffectsTimer == null || !m_EffectsTimer.Running)
				{
					// then update effects damage display
					AdjustDamageEffects();

				}
			}
		}
Exemple #21
0
		public static void OnMovement( MovementEventArgs e )
		{
			WakeUp( e.Mobile );
		}
        private static void BlockAndReport(MovementEventArgs e)
        {
            // block the move
            e.Blocked = true;

            // record the players
            Server.Scripts.Commands.LogHelper.Cheater(e.Mobile, "Possible Z-Plane Exploit", true);

            // Tell staff that an exploit is in progress
            string text = String.Format("Possible z-plane exploit in progress at {0}. Exploit actions blocked.", e.Mobile.Location.ToString());
            Server.Scripts.Commands.CommandHandlers.BroadcastMessage(AccessLevel.Counselor, 0x482, text);
        }
        private static void TrackPlayer(MovementEventArgs e, bool Penalty)
        {
            Mobile from = e.Mobile;

            // Look to see if we are already tracking this player
            if (m_doissier.ContainsKey(from.Serial) == false)
                // add it
                m_doissier.Add(from.Serial, new Dossier());

            // okay process this player's Dossier
            Dossier dx = m_doissier[from.Serial];

            // check the timeout
            if (dx.Timeout == true)
            {   // start over with this guy.
                m_doissier.Remove(from.Serial);
                return;
            }

            // Mark the current time
            dx.MarkTime();

            // handle the exploit 3 strikes and you're out
            //  You get a Penalty point if you stepped off a porch onto a stack of > 3 items to begin with
            if ((++dx.InfractionCount + ((Penalty == true) ? 1 : 0)) >= 3)
            {
                BlockAndReport(e);
            }
        }
 private static void TrackPlayer(MovementEventArgs e)
 {
     TrackPlayer(e, false);
 }
		public virtual void OnMovement(MovementEventArgs args)
		{
		}
 public static void InvokeMovement(MovementEventArgs e)
 {
     Movement?.Invoke(e);
 }
Exemple #27
0
        public override void OnMovement( MovementEventArgs e )
        {
            Mobile m = e.Mobile;

            if(m == null || m.AccessLevel > TriggerAccessLevel) return;

            Point3D loc = new Point3D(0,0,0);
            Map map;

            if(AttachedTo is Mobile)
            {
                Mobile mob = AttachedTo as Mobile;
                loc = mob.Location;
                map = mob.Map;
            }
            else
                if(AttachedTo is Item && ((Item)AttachedTo).Parent == null)
            {
                Item i = AttachedTo as Item;
                loc = i.Location;
                map = i.Map;
            }

            // if proximity sensing is off, a speech entry has been activated, or player is an admin then ignore
            if(m_Running && m_ProximityRange >= 0 && ValidMovementTrig(m) && !IsActive && !m_HoldProcessing)
            {
                // check to see if player is within range of the npc
                if (Utility.InRange( m.Location, loc, m_ProximityRange ) )
                {

                    TimeSpan pause = TimeSpan.FromSeconds(0);
                    if(CurrentEntry != null && CurrentEntry.Pause > 0)
                    {
                        pause = TimeSpan.FromSeconds(CurrentEntry.Pause);
                    }
                    // check to see if the current pause interval has elapsed
                    if(DateTime.Now > m_LastInteraction + pause)
                    {
                        // process speech that is not keyword dependent
                        CheckForReset();

                        ProcessSpeech(m,null);
                    }
                    // turn on the timer that will run until the speech list is reset
                    // it will control paused speech and will allow the speech entry to be reset after ResetTime timeout
                    DoTimer(TimeSpan.FromSeconds( 1 ), m);
                }
            }
            else
            {
                CheckForReset();
            }
            base.OnMovement( e );
        }
        public static void SnowPileExploit_EventSink(MovementEventArgs e)
        {
            Mobile from = e.Mobile;

            if (!from.Player || from is PlayerMobile == false)
                return;

            try
            {
                // Okay.. Look to see if a player is standing on a stack of movable items and is about to 
                //  step UP onto another stack of movable items. If the player does this three times.
                //  block their movment, alert staff, and log the cheaters

                // the tile we are stepping off of
                bool step_off = false;
                IPooledEnumerable from_list = from.Map.GetItemsInRange(from.Location, 0);
                foreach (Item ix in from_list)
                {
                    if (ix is Item == false) continue;
                    //Console.WriteLine("OFF:{0}", ix);
                    if (ix.Z == from.Z && ix.Movable == true)
                    {   // we are stepping off of a movable item at OUR Z
                        step_off = true;
                        break;
                    }
                }
                from_list.Free();

                // short circuit to make this code min impact
                if (step_off == false)
                    return;

                // calc where we want to go
                Point3D dest = new Point3D(from.Location);
                int x = dest.X;
                int y = dest.Y;
                Movement.Movement.Offset(e.Direction, ref x, ref y);
                dest.X = x;
                dest.Y = y;

                // the tile we are stepping on to
                bool step_onto = false;
                IPooledEnumerable to_list = from.Map.GetItemsInRange(dest, 0);
                foreach (Item ix in to_list)
                {   // we only trap UP movement. If you want UP/DOWN, change ix.Z > from.Z to ix.Z != from.Z
                    if (ix is Item == false) continue;
                    //Console.WriteLine("ON:{0}",ix);
                    if (ix.Z > from.Z && ix.Movable == true)
                    {   // we are stepping onto a movable item at GREATER than OUR Z
                        step_onto = true;
                        break;
                    }
                }
                to_list.Free();

                // short circuit to make this code min impact
                if (step_onto == false)
                    return;

                // verify if we are climbing in the Z plane
                int newZ = 0;
                bool ClimbingZPlane = false;
                from.CheckMovement(e.Direction, out newZ);
                if (newZ > from.Z)
                {   // make sure there are at least 2 items in this stack at different Zs
                    if (Spells.SpellHelper.iStack(from, dest, 2) == false)
                        ClimbingZPlane = true;
                }
                //Console.WriteLine("Stepping {0}", newZ > from.Z ? "UP" : "Down");

                // short circuit to make this code min impact
                if (ClimbingZPlane == true)
                {
                    // if the stack we are stepping off has a delta > 3 for some reason generate a Penalty point
                    bool Penalty = false;
                    if (from.Z - from.Map.GetAverageZ(from.X, from.Y) > 3)
                        Penalty = true;

                    // Okay here is what we know so far.. we are standing on movable objects stepping UP in the Z Plane
                    //  onto MORE movable items .. this looks exploitive.
                    TrackPlayer(e, Penalty);
                }

                return;
            }
            catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); }
        }
        public static void QuantumLeap_EventSink(MovementEventArgs e)
        {
            Mobile from = e.Mobile;

            if (!from.Player || from is PlayerMobile == false)
                return;

            try
            {
                // is there a multi where we are stepping off?
                bool step_off_tile = false;
                IPooledEnumerable tile_from_list = from.Map.GetMultiTilesAt(from.Location.X, from.Location.Y);
                foreach (Tile[] ix in tile_from_list) { step_off_tile = Server.Items.BaseMulti.Find(from.Location, from.Map) != null; break; }
                tile_from_list.Free();

                // short circuit
                if (step_off_tile == false)
                    return;

                // calc where we want to go
                Point3D dest = new Point3D(from.Location);
                int x = dest.X;
                int y = dest.Y;
                Movement.Movement.Offset(e.Direction, ref x, ref y);
                dest.X = x;
                dest.Y = y;

                // is there a tile where we are stepping on?
                bool step_on_tile = false;
                IPooledEnumerable tile_to_list = from.Map.GetMultiTilesAt(dest.X, dest.Y);
                foreach (Tile[] ix in tile_to_list) { step_on_tile = Server.Items.BaseMulti.Find(dest, from.Map) != null; break; }
                tile_to_list.Free();

                // case: stepping off a porch (or other multi) onto a stack of stacked item outside multi
                if (step_off_tile == true && step_on_tile == false)
                {
                    // see if we are stepping onto a stack of movable items
                    // the tile we are stepping on to
                    bool step_onto = false;
                    IPooledEnumerable to_list = from.Map.GetItemsInRange(dest, 0);
                    foreach (Item ix in to_list)
                    {   // we only trap UP movement. If you want UP/DOWN, change ix.Z > from.Z to ix.Z != from.Z
                        if (ix is Item == false) continue;
                        //Console.WriteLine("ON:{0}",ix);
                        if (ix.Z >= from.Z && ix.Movable == true)
                        {   // we are stepping onto a movable item at >= OUR Z
                            step_onto = true;
                            break;
                        }
                    }
                    to_list.Free();

                    // we will be stepping off a porch onto a stack of movable items, see if we will be climbing
                    if (step_onto == true)
                    {
                        // verify if we are climbing in the Z plane
                        int newZ = 0;
                        bool ClimbingZPlane = false;
                        from.CheckMovement(e.Direction, out newZ);
                        if (newZ > from.Z)
                        {   // make sure there are at least 2 items in this stack at different Zs
							if (Spells.SpellHelper.iStack(from, dest, 2) == false)
                                ClimbingZPlane = true;
                        }

                        // if we are climbing the z plane
                        if (ClimbingZPlane == true)
                            // if we are the owner, we allow this
                            if (from.Region is Regions.HouseRegion)
                            {   // get the house
                                BaseHouse bh = (from.Region as Regions.HouseRegion).House;
                                // if we are not a friend of this house, block and report
                                if (bh.IsFriend(from) == false)
                                {
                                    // if the stack we are stepping on has a delta > 3 (stepping off a porch(z=5) onto a stack z6, generate a Penalty point
                                    bool Penalty = false;
                                    if (dest.Z - from.Map.GetAverageZ(dest.X, dest.Y) > 3)
                                        Penalty = true;

                                    TrackPlayer(e, Penalty);
                                }
                            }
                    }
                }
                // case: we are trying to climb item stacks within a multi, maybe a house
                else if (step_off_tile == true && step_on_tile == true)
                {
                    // see if we are stepping onto a stack of movable items
                    // the tile we are stepping on to
                    bool step_onto = false;
                    IPooledEnumerable to_list = from.Map.GetItemsInRange(dest, 0);
                    foreach (Item ix in to_list)
                    {   // we only trap UP movement. If you want UP/DOWN, change ix.Z > from.Z to ix.Z != from.Z
                        if (ix is Item == false) continue;
                        //Console.WriteLine("ON:{0}",ix);
                        if (ix.Z > from.Z && ix.Movable == true)
                        {   // we are stepping onto a movable item at >= OUR Z
                            step_onto = true;
                            break;
                        }
                    }
                    to_list.Free();

                    if (step_onto == true)
                    {
                        // verify if we are climbing in the Z plane
                        int newZ = 0;
                        bool ClimbingZPlane = false;
                        from.CheckMovement(e.Direction, out newZ);
                        if (newZ > from.Z)
                        {   // make sure there are at least 2 items in this stack at different Zs
							if (Spells.SpellHelper.iStack(from, dest, 2) == false)
                                ClimbingZPlane = true;
                        }

                        // if we are climbing the z plane
                        if (ClimbingZPlane == true)
                            // if it's a house
                            if (from.Region is Regions.HouseRegion)
                            {   // get the house
                                BaseHouse bh = (from.Region as Regions.HouseRegion).House;
                                // if we are not a friend of this house, block and report
                                if (bh.IsFriend(from) == false)
                                {
                                    // if the stack we are stepping off has a delta > 3 for some reason generate a Penalty point
                                    bool Penalty = false;
                                    if (from.Z - from.Map.GetAverageZ(from.X, from.Y) > 3)
                                        Penalty = true;

                                    TrackPlayer(e, Penalty);
                                }
                            }
                    }
                }

                // done 
                return;

            }
            catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); }
        }
Exemple #30
0
        public static void EventSink_Movement( MovementEventArgs e )
        {
            Mobile from = e.Mobile;

            if ( !from.Alive || from.AccessLevel > AccessLevel.Player  )
                return;

            if ( !from.Player )
            {
                // Else it won't work on monsters.
                Spells.Ninjitsu.DeathStrike.AddStep( from );
                return;
            }

            int maxWeight = GetMaxWeight( from ) + OverloadAllowance;
            int overWeight = (Mobile.BodyWeight + from.TotalWeight) - maxWeight;

            if ( overWeight > 0 )
            {
                from.Stam -= GetStamLoss( from, overWeight, (e.Direction & Direction.Running) != 0 );

                if ( from.Stam == 0 )
                {
                    from.SendLocalizedMessage( 500109 ); // You are too fatigued to move, because you are carrying too much weight!
                    e.Blocked = true;
                    return;
                }
            }

            /*if ( ((from.Stam * 100) / Math.Max( from.StamMax, 1 )) < 10 )
                --from.Stam;*/

            //New code for mount stam

            if ( from is PlayerMobile )
            {
                int amt = ( from.Mounted ? 48 : 16 );
                PlayerMobile pm = (PlayerMobile)from;

                if( from.Mounted && from.Mount is BaseCreature ) {
                    BaseCreature mount = (BaseCreature)from.Mount;
                    if( mount.Stam == 0 )
                    {
                        from.SendLocalizedMessage( 500108 ); // Your mount is too fatigued to move.
                        e.Blocked = true;
                        return;
                    } else if((++pm.StepsTaken % amt) == 0 ) {
                        --mount.Stam;
                        if(mount.Stam < mount.StamMax*0.08)
                            from.SendLocalizedMessage( 500133 ); // Your mount is very fatigued.
                    }
                } else if(from.Mounted && from.Mount is EtherealMount ) {
                    if( pm.EthyStam == 0 )
                    {
                        from.SendLocalizedMessage( 500108 ); // Your mount is too fatigued to move.
                        e.Blocked = true;
                        return;
                    } else if((++pm.StepsTaken % amt) == 0 ) {
                        --pm.EthyStam;
                        if(pm.EthyStam < pm.EthyMaxStam*0.08)
                            from.SendLocalizedMessage( 500133 ); // Your mount is very fatigued.
                    }
                } else {
                    if( from.Stam == 0 )
                    {
                        from.SendLocalizedMessage( 500110 ); // You are too fatigued to move.
                        e.Blocked = true;
                        return;
                    }else if ( (++pm.StepsTaken % amt) == 0 )
                        --from.Stam;
                }
            } else if( from.Stam == 0 )
            {
                from.SendLocalizedMessage( 500110 ); // You are too fatigued to move.
                e.Blocked = true;
                return;
            }

            Spells.Ninjitsu.DeathStrike.AddStep( from );
        }