public static void Pathfind(object state) { object[] states = (object[])state; Mobile from = (Mobile)states[0]; Direction d = (Direction)states[1]; try { from.Direction = d; from.NetState.BlockAllPackets = true; from.Move(d); from.NetState.BlockAllPackets = false; from.ProcessDelta(); } catch { } }
public static void Pathfind(object state) { object[] states = (object[])state; Mobile from = (Mobile)states[0]; Direction d = (Direction)states[1]; try { from.Direction = d; from.NetState.BlockAllPackets = true; from.Move(d); from.NetState.BlockAllPackets = false; from.ProcessDelta(); } catch (Exception e) { Server.Diagnostics.ExceptionLogging.LogException(e); } }
public void OnSkillChange(Skill skill) { if (skill == m_Highest) // could be downgrading the skill, force a recalc { m_Highest = null; } else if (m_Highest != null && skill.BaseFixedPoint > m_Highest.BaseFixedPoint) { m_Highest = skill; } m_Owner.OnSkillInvalidated(skill); NetState ns = m_Owner.NetState; if (ns != null) { ns.Send(new SkillChange(skill)); m_Owner.Delta(MobileDelta.Skills); m_Owner.ProcessDelta(); } }
public override bool OnMoveOver(Mobile m) { Point3D NewLoc = new Point3D(m.X + m_XInc, m.Y + m_YInc, m.Z); if (m_XInc != 0 || m_YInc != 0) { int inc = 0; int dir = 0; if (m_XInc > 0) { inc = m_XInc; dir = 1; } else if (m_XInc < 0) { inc = -m_XInc; dir = 2; } if (m_YInc > 0) { inc = m_YInc; dir = 3; } else if (m_YInc < 0) { inc = -m_YInc; dir = 4; } m.Location = NewLoc; m.ProcessDelta(); new EffectTimer(dir, inc, Location, m).Start(); } return false; }
public override void OnDoubleClick(Mobile from) { if ( m_TargLoc == Point3D.Zero || m_TargMap == null ) return; if ( from.InRange( this, 2 ) && from.InLOS( this ) ) { if ( ItemID == m_ID1 ) ItemID = m_ID2; else ItemID = m_ID1; if ( m_Msg != null && m_Msg != "" ) from.SendAsciiMessage( m_Msg ); Effects.SendLocationParticles( EffectItem.Create( from.Location, from.Map, EffectItem.DefaultDuration ), 0x3728, 10, 10, 2023 ); from.MoveToWorld( m_TargLoc, m_TargMap ); from.ProcessDelta(); Effects.SendLocationParticles( EffectItem.Create( m_TargLoc, m_TargMap, EffectItem.DefaultDuration ), 0x3728, 10, 10, 5023 ); from.PlaySound( 0x1FE ); } }
public static void MoveMobileOut( Mobile m ) { if ( m != null ) { if( m is PlayerMobile && !m.Alive ) { if( m.Corpse != null && !m.Corpse.Deleted ) { m.Corpse.MoveToWorld( lr_Exit, Map.Malas ); } } BaseCreature.TeleportPets( m, lr_Exit, Map.Malas ); m.Location = lr_Exit; m.ProcessDelta(); } }
private void Thrown( Mobile m ) { Map map = this.Map; if ( map != null ) { for ( int i = 0; i < 10; ++i ) { if ( this.Direction == Direction.Up || this.Direction == Direction.North || this.Direction == Direction.Right ) { yaxis = this.Y - 6; } else if ( this.Direction == Direction.Down || this.Direction == Direction.South || this.Direction == Direction.Left ) { yaxis = this.Y + 6; } else { yaxis = this.Y; } if ( this.Direction == Direction.Right || this.Direction == Direction.East || this.Direction == Direction.Down ) { xaxis = this.X + 6; } else if ( this.Direction == Direction.Left || this.Direction == Direction.West || this.Direction == Direction.Up ) { xaxis = this.X - 6; } else { xaxis = this.X; } int z = this.Z; if ( !map.CanFit(xaxis, yaxis, z, 16, false, false ) ) continue; Point3D from = this.Location; Point3D to = new Point3D( xaxis, yaxis, z ); if ( !InLOS( to ) ) continue; m.Location = to; m.ProcessDelta(); } } }
public void Teleport( Mobile caster ) // Taken from questboss.cs and values changed (note this.Combatant = caster; was added and i have emailed you this change to questboss.cs too { Map map = this.Map; if ( map != null ) { for (int i = 0; i < 12; ++i) { int x = X + (Utility.RandomMinMax(-1, 1)); int y = Y + (Utility.RandomMinMax(-1, 1)); int z = Z; if (!map.CanFit(x, y, z, 16, false, false)) continue; Point3D from = caster.Location; Point3D to = new Point3D(x, y, z); if (!InLOS(to)) continue; caster.Location = to; caster.ProcessDelta(); caster.Combatant = null; this.Combatant = caster; caster.Freeze(TimeSpan.FromSeconds(1.5)); Effects.SendLocationParticles(EffectItem.Create(from, map, EffectItem.DefaultDuration), 0x3728, 10, 10, 2023); Effects.SendLocationParticles(EffectItem.Create(to, map, EffectItem.DefaultDuration), 0x3728, 10, 10, 5023); Effects.PlaySound(to, map, 0x1FE); } } }
public void Target(IPoint3D p, Mobile defender) { Map map = defender.Map; if (this.Parent == null || !(this.Parent is Mobile)) return; Mobile attacker = (Mobile)this.Parent; if (p is RecallRune) { RecallRune rune = (RecallRune)p; if (rune.Marked) { defender.PublicOverheadMessage(Server.Network.MessageType.Regular, defender.SpeechHue, true, "*the earth trembles and time slows, a small rift appearing and drawing you both into its depth*"); attacker.SendMessage("You and your combatant have been sent to the rune\'s location."); defender.MoveToWorld(rune.Target, rune.TargetMap); attacker.MoveToWorld(rune.Target, rune.TargetMap); Effects.PlaySound(defender, map, 510); Effects.SendLocationParticles(defender, 0x37C4, 10, 10, 2023); Effects.PlaySound(attacker, map, 510); Effects.SendLocationParticles(attacker, 0x37C4, 10, 10, 2023); } else attacker.SendMessage("That is not a valid target."); } else if (map == null || !map.CanSpawnMobile(p.X, p.Y, p.Z)) { attacker.SendLocalizedMessage(501942); // That location is blocked. } else if (Server.Spells.SpellHelper.CheckMulti(new Point3D(p), map)) { attacker.SendLocalizedMessage(501942); // That location is blocked. } else if (defender.BodyValue != 402 && defender.BodyValue != 403) { _lastUsed = DateTime.Now; Point3D to = new Point3D(p); defender.MoveToWorld(to, map); defender.ProcessDelta(); Effects.PlaySound(defender, map, 510); Effects.SendLocationParticles(defender, 0x37C4, 10, 10, 2023); Effects.SendLocationParticles(EffectItem.Create(to, map, EffectItem.DefaultDuration), 0x37C4, 10, 10, 5023); } }
public override void OnGotMeleeAttack(Mobile attacker) //taken from ElementalChamp.cs { base.OnGotMeleeAttack(attacker); if (0.25 >= Utility.RandomDouble()) DrainStam(); if (Utility.Random(4) < 1) { Map map = this.Map; if (map != null) { for (int i = 0; i < 10; ++i) { int x = X + (Utility.RandomMinMax(-15, 15)); int y = Y + (Utility.RandomMinMax(-15, 15)); int z = Z; if (!map.CanFit(x, y, z, 16, false, false)) continue; Point3D from = attacker.Location; Point3D to = new Point3D(x, y, z); if (!InLOS(to)) continue; attacker.Location = to; attacker.ProcessDelta(); attacker.Combatant = null; attacker.Freeze(TimeSpan.FromSeconds(10.0)); Effects.SendLocationParticles(EffectItem.Create(from, map, EffectItem.DefaultDuration), 0x3728, 10, 10, 2023); Effects.SendLocationParticles(EffectItem.Create(to, map, EffectItem.DefaultDuration), 0x3728, 10, 10, 5023); Effects.PlaySound(to, map, 0x1FE); } } } }
public void Teleport( Mobile caster ) { Map map = this.Map; if ( map != null ) { for (int i = 0; i < 10; ++i) { int x = X + (Utility.RandomMinMax(-1, 1)); int y = Y + (Utility.RandomMinMax(-1, 1)); int z = Z; if (!map.CanFit(x, y, z, 16, false, false)) continue; Point3D from = caster.Location; Point3D to = new Point3D(x, y, z); if (!InLOS(to)) continue; caster.Location = to; caster.ProcessDelta(); caster.Combatant = null; this.Combatant = caster; caster.Freeze(TimeSpan.FromSeconds(2.0)); Effects.SendLocationParticles(EffectItem.Create(from, map, EffectItem.DefaultDuration), 0x3728, 10, 10, 2023); Effects.SendLocationParticles(EffectItem.Create(to, map, EffectItem.DefaultDuration), 0x3728, 10, 10, 5023); Effects.PlaySound(to, map, 0x1FE); } } }
public static void SendIndividualFlashEffect(Mobile e, FlashType flash) { if (e == null || e.NetState == null) return; Map map = e.Map; if (map == null) return; e.ProcessDelta(); Packet flashEffect = null; NetState state = e.NetState; if (state.Version >= m_FlashEffectVersion) { if (flashEffect == null) flashEffect = Packet.Acquire(new FlashEffect(flash)); state.Send(flashEffect); } Packet.Release(flashEffect); }
private void OnTarget( Mobile from, object targeted ) { IPoint3D p = targeted as IPoint3D; Map map = from.Map; SpellHelper.GetSurfaceTop( ref p ); Point3D to = new Point3D( p ); if ( Server.Misc.WeightOverloading.IsOverloaded( from ) ) { from.SendLocalizedMessage( 502359, "", 0x22 ); // Thou art too encumbered to move. } else if ( map == null || !map.CanFit( p.X, p.Y, p.Z, 16 ) ) { from.SendLocalizedMessage( 501942 ); // That location is blocked. } else if ( SpellHelper.CheckMulti( to, map ) ) { from.SendLocalizedMessage( 501942 ); // That location is blocked. } else { SpellHelper.Turn( from, p ); Effects.SendLocationParticles( EffectItem.Create( from.Location, from.Map, EffectItem.DefaultDuration ), 0x3728, 10, 10, 2023 ); Regions.HouseRegion destRgn = Region.Find( to, from.Map ) as Regions.HouseRegion; if ( destRgn != null && destRgn.House != null ) { if ( ( from.Region == destRgn && destRgn.House is Multis.LargePatioHouse ) || ( from.Region != destRgn && destRgn.House.IsInside( to, 15 ) ) ) { from.SendLocalizedMessage( 501942 ); // That location is blocked. return; } } from.Location = to; from.ProcessDelta(); Effects.SendLocationParticles( EffectItem.Create( to, from.Map, EffectItem.DefaultDuration ), 0x3728, 10, 10, 5023 ); from.PlaySound( 0x1FE ); } }
public override void OnGaveMeleeAttack(Mobile defender) { if (DoElementalChamp && Utility.Random(2) < 1) { Map map = this.Map; if ( map != null ) { // try 10 times to find a teleport spot for (int i = 0; i < 10; ++i) { int x = X + (Utility.RandomMinMax(-10, 15)); int y = Y + (Utility.RandomMinMax(-10, 15)); int z = Z; if (!map.CanFit(x, y, z, 16, false, false)) continue; Point3D from = defender.Location; Point3D to = new Point3D(x, y, z); if (!InLOS(to)) continue; defender.Location = to; defender.ProcessDelta(); defender.Combatant = null; defender.Freeze(TimeSpan.FromSeconds(5.0)); Effects.SendLocationParticles(EffectItem.Create(from, map, EffectItem.DefaultDuration), 0x3728, 10, 10, 2023); Effects.SendLocationParticles(EffectItem.Create(to, map, EffectItem.DefaultDuration), 0x3728, 10, 10, 5023); Effects.PlaySound(to, map, 0x1FE); DoECTeleport(this); } } } base.OnGaveMeleeAttack(defender); }