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); }
public static void SendLocationParticles( IEntity e, int itemID, int speed, int duration, int hue, int renderMode, int effect, int unknown ) { Map map = e.Map; if ( map != null ) { Packet particles = null, regular = null; IPooledEnumerable eable = map.GetClientsInRange( e.Location ); foreach ( NetState state in eable ) { state.Mobile.ProcessDelta(); if ( SendParticlesTo( state ) ) { if ( particles == null ) particles = new LocationParticleEffect( e, itemID, speed, duration, hue, renderMode, effect, unknown ); state.Send( particles ); } else if ( itemID != 0 ) { if ( regular == null ) regular = new LocationEffect( e, itemID, speed, duration, hue, renderMode ); state.Send( regular ); } } eable.Free(); } //SendPacket( e.Location, e.Map, new LocationParticleEffect( e, itemID, speed, duration, hue, renderMode, effect, unknown ) ); }
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); }