Example #1
0
        public void SendOutside( Mobile mob )
        {
            if ( m_Arena == null || mob == null )
                return;

            if ( mob.Frozen )
                mob.Frozen = false;

            mob.Combatant = null;
            mob.MoveToWorld( m_Arena.Outside, m_Arena.Facet );
            mob.SendEverything();

            PlayerMobile pm = mob as PlayerMobile;
            if (pm != null)
            {
                if (pm.TempStatLoss.Count > 0)
                    pm.TempStatLoss[0].Start();
            }
        }
Example #2
0
		public override void OnEnter(Mobile m)
		{
			Region left = null;
			PlayerMobile pm = null;

			if (m is PlayerMobile)
			{
				pm = (PlayerMobile)m;
				left = pm.LastRegionIn;
			}
			// wea: If this is an isolated region, we're going to send sparklies where
			// mobiles will disappear (this happens as part of an IsIsolatedFrom() check,
			// not explicit packet removal here) + a sound effect if we had to do this
			// 
			// also send an incoming packet to all players within the region.
			// ____
			// ||
			if (m_Controller.IsIsolated)
			{
				if (m.Map != null)
				{
					int invissedmobiles = 0;

					IPooledEnumerable eable = m.GetMobilesInRange(Core.GlobalMaxUpdateRange);

					foreach (Mobile mir in eable)
					{
						// Regardless of whether this is mobile or playermobile,
						// we need to send an incoming packet to each of the mobiles
						// in the region

						if (mir.Region == m.Region)
						{
							if (mir is PlayerMobile)
							{
								// We've just walked into this mobile's region, so send incoming packet
								// if they're a playermobile

								if (Utility.InUpdateRange(m.Location, mir.Location) && mir.CanSee(m))
								{
									// Send incoming packet to player if they're online
									if (mir.NetState != null)
									{
										mir.NetState.Send(new MobileIncoming(mir, m));
									}
								}
							}
						}
						else
						{
							// They're in a different region, so localise sparklies
							// to us if we're a player mobile
							if (pm != null && mir.AccessLevel <= pm.AccessLevel)
							{
								Packet particles = new LocationParticleEffect(EffectItem.Create(mir.Location, mir.Map, EffectItem.DefaultDuration), 0x376A, 10, 10, 0, 0, 2023, 0);

								if (pm.NetState != null && particles != null)
								{
									pm.Send(particles);
									invissedmobiles++;
								}
							}
						}
					}

					if (invissedmobiles > 0)
					{
						// Play a sound effect to go with it
						if (pm.NetState != null)
						{
							pm.PlaySound(0x3C4);
						}
					}

					if (pm != null)
					{
						m.ClearScreen();
						m.SendEverything();
					}
					eable.Free();
				}
			}
			// ||
			// ____

			// if were leaving a house and entering the region(already in it) dont play the enter msg
			if (pm != null && pm.LastRegionIn is HouseRegion)
			{
				return;
			}

			if (m_Controller.ShowEnterMessage)
			{
				m.SendMessage("You have entered {0}", this.Name);

				if (m_Controller.NoMurderZone)
				{
					m.SendMessage("This is a lawless area; you are freely attackable here.");
				}
			}

			if (m_Controller.OverrideMaxFollowers)
				m.FollowersMax = m_Controller.MaxFollowerSlots;

			if (m_Controller.PlayMusic)
				PlayMusic(m);

			PlayerMobile IOBenemy = null;			

			if (m is PlayerMobile)
			{
				IOBenemy = (PlayerMobile)m;
			}

			//if is a iob zone/region and a iob aligned mobile with a differnt alignment then the zone enters
			//find all players of the zones alignment and send them a message
			//plasma: refactored the send message code into its own method within KinSystem
			if (DateTime.Now >= m_Controller.m_Msg && m_Controller.IOBZone && m_Controller.ShowIOBMsg && IOBenemy != null && IOBenemy.IOBAlignment != IOBAlignment.None && IOBenemy.IOBAlignment != m_Controller.IOBAlign && m.AccessLevel == AccessLevel.Player)  //we dont want it announceing staff with iob kinship
			{
				if (m_Controller.RegionName != null && m_Controller.RegionName.Length > 0)
				{
					KinSystem.SendKinMessage(m_Controller.IOBAlign, string.Format("Come quickly, the {0} are attacking {1}!",
						IOBSystem.GetIOBName(IOBenemy.IOBRealAlignment),
						m_Controller.RegionName));
				}
				else
				{
					KinSystem.SendKinMessage(m_Controller.IOBAlign, string.Format("Come quickly, the {0} are attacking your stronghold!",
						IOBSystem.GetIOBName(IOBenemy.IOBRealAlignment)));
				}
				m_Controller.m_Msg = DateTime.Now + m_Controller.m_Delay;
			}
			else if (DateTime.Now >= m_Controller.m_Msg && this is Engines.IOBSystem.KinCityRegion && IOBenemy != null && IOBenemy.IOBAlignment != IOBAlignment.None && IOBenemy.IOBAlignment != m_Controller.IOBAlign && m.AccessLevel == AccessLevel.Player)  //we dont want it announceing staff with iob kinship
			{
				KinCityRegion r = KinCityRegion.GetKinCityAt(this.m_Controller);
				if (r != null)
				{
					KinCityData cd = KinCityManager.GetCityData(r.KCStone.City);
					if (cd != null && cd.ControlingKin != IOBAlignment.None)
					{
						Engines.IOBSystem.KinSystem.SendKinMessage(cd.ControlingKin, string.Format("Come quickly, the {0} are attacking the City of {1}!",
							IOBSystem.GetIOBName(IOBenemy.IOBRealAlignment), cd.City.ToString()));
						m_Controller.m_Msg = DateTime.Now + m_Controller.m_Delay;
					}
				}
			}

			base.OnEnter(m);
		}
Example #3
0
        public void DoLogin( GameClient state, Mobile m )
        {
            state.Send( new LoginConfirm( m ) );

            if ( m.Map != null )
                state.Send( new MapChange( m ) );

            state.Send( SeasonChange.Instantiate( m.GetSeason(), true ) );

            state.Send( SupportedFeatures.Instantiate( state ) );

            state.Sequence = 0;
            state.Send( new MobileUpdate( m ) );
            state.Send( new MobileUpdate( m ) );

            m.CheckLightLevels( true );

            state.Send( new MobileUpdate( m ) );

            state.Send( new MobileIncoming( m, m ) );
            state.Send( new MobileStatus( m, m ) );
            state.Send( Server.Network.SetWarMode.Instantiate( m.Warmode ) );

            m.SendEverything();

            state.Send( SupportedFeatures.Instantiate( state ) );
            state.Send( new MobileUpdate( m ) );
            state.Send( new MobileStatus( m, m ) );
            state.Send( Server.Network.SetWarMode.Instantiate( m.Warmode ) );
            state.Send( new MobileIncoming( m, m ) );

            state.Send( LoginComplete.Instance );
            state.Send( new CurrentTime() );
            state.Send( SeasonChange.Instantiate( m.GetSeason(), true ) );
            state.Send( new MapChange( m ) );

            try
            {
                EventSink.Instance.InvokeLogin( new LoginEventArgs( m ) );
            }
            catch ( Exception ex )
            {
                Logger.Error( "Exception disarmed in Login: {0}", ex );
            }

            m.ClearFastwalkStack();
        }
Example #4
0
		public override void OnExit(Mobile m)
		{
			Region left = null;
			PlayerMobile pm = null;

			if (m is PlayerMobile)
			{
				pm = (PlayerMobile)m;
				left = pm.Region;
			}

			// wea: If we're leaving an isolated region, we need
			// to send remove packets to all isolated playermobiles 
			// within

			if (m_Controller.IsIsolated)
			{
				// Send fresh state info if we're a player leaving an isolated region
				if (pm != null)
				{
					if (m.NetState != null)
					{
						m.SendEverything();
					}
				}

				Packet p = null;
				Packet particles = null;
				IPooledEnumerable eable = m.GetMobilesInRange(Core.GlobalMaxUpdateRange);
				int revealedmobiles = 0;

				foreach (Mobile mir in eable)
				{
					// If they're in the region we're leaving, send a remove packet

					if (mir is PlayerMobile)
					{
						if (mir.Region == this && !mir.CanSee(m)) // CanSee includes the isolation check
						{
							p = m.RemovePacket;	// make us disappear to them

							if (mir.NetState != null)
								mir.Send(p);
						}
					}

					// They're going to become visible to us as a result of
					// the SendEverything() call above, so as long as they're not us and
					// are in our new region, send sparklies at their location 

					// Also, send a sound at the end if there's at least one revealed

					if (mir != m && mir.Region != this && m.CanSee(mir) && m.AccessLevel == AccessLevel.Player)
					{
						// Create localized sparklies 
						particles = new LocationParticleEffect(EffectItem.Create(mir.Location, mir.Map, EffectItem.DefaultDuration), 0x376A, 10, 10, 0, 0, 2023, 0);

						if (m.NetState != null)
						{
							m.Send(particles);
							revealedmobiles++;
						}
					}
				}

				// If at least one was revealed, play a sound too
				if (revealedmobiles > 0)
				{
					if (m.NetState != null)
					{
						m.PlaySound(0x3C4);
					}
				}
			}

			//if were moving into a house dont play the exit msg
			if (pm != null && pm.Region is HouseRegion)
				return;

			if (m_Controller.PlayMusic)
				StopMusic(m);

			if (m_Controller.ShowExitMessage)
				m.SendMessage("You have left {0}", this.Name);

			if (m_Controller.OverrideMaxFollowers)
				m.FollowersMax = 5; //return to default;

			base.OnExit(m);

		}