public void Target(IPoint3D p) { Map map = Caster.Map; SpellHelper.GetSurfaceTop(ref p); if (map == null || !map.CanSpawnMobile(p.X, p.Y, p.Z)) { Caster.SendLocalizedMessage(501942); // That location is blocked. } else if (SpellHelper.CheckTown(p, Caster) && CheckSequence()) { TimeSpan duration; if (Caster.EraAOS) { duration = TimeSpan.FromSeconds(60.0); } else if (Caster.EraUOR) { duration = TimeSpan.FromSeconds(Utility.Random(60, 20)); } else { // HACK: Convert to T2A mechanics. duration = TimeSpan.FromSeconds(Utility.Random(60, 20)); } BaseCreature.Summon(new EnergyVortex(), false, Caster, new Point3D(p), 0x212, duration); } FinishSequence(); }
public void Target(IPoint3D p) { if (!Caster.CanSee(p)) { Caster.SendAsciiMessage("Target is not in line of sight."); DoFizzle(); } else if (SphereSpellTarget is BaseWand) { BaseWand bw = SphereSpellTarget as BaseWand; bw.RechargeWand(Caster, this); } else if (CheckSequence()) { FoodInfo foodInfo = m_Food[Utility.Random(m_Food.Length)]; Item food = foodInfo.Create(); Point3D loc = new Point3D(p); if (food != null) { food.MoveToWorld(loc, Caster.Map); // You magically create food in your backpack: Caster.SendAsciiMessage("You create " + foodInfo.Name); Caster.FixedParticles(0, 10, 5, 2003, EffectLayer.RightHand); Caster.PlaySound(Sound); } } FinishSequence(); }
public void Target( IPoint3D p ) { if ( ( Caster.Followers + 5 ) > Caster.FollowersMax ) { Caster.SendLocalizedMessage( 1049645 ); // You have too many followers to summon that creature. return; } Map map = Caster.Map; SpellHelper.GetSurfaceTop( ref p ); if ( map == null || ( Caster.IsPlayer && !map.CanSpawnMobile( p.X, p.Y, p.Z ) ) ) { Caster.SendLocalizedMessage( 501942 ); // That location is blocked. } else if ( SpellHelper.CheckTown( p, Caster ) && CheckSequence() ) { int level = (int) ( GetBaseSkill( Caster ) + GetBoostSkill( Caster ) ); TimeSpan duration = TimeSpan.FromSeconds( level / 4 ); BaseCreature summon = new RisingColossus( level ); BaseCreature.Summon( summon, false, Caster, new Point3D( p ), 0x656, duration ); Effects.SendTargetParticles( summon, 0x3728, 10, 10, 0x13AA, (EffectLayer) 255 ); } FinishSequence(); }
public void Target(IPoint3D p) { if (!Caster.CanSee(p)) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (SphereSpellTarget is BaseWand) { BaseWand bw = SphereSpellTarget as BaseWand; bw.RechargeWand(Caster, this); } else if (CheckSequence()) { SpellHelper.GetSurfaceTop(ref p); Map map = Caster.Map; if (map != null) { IPooledEnumerable eable = map.GetMobilesInRange(new Point3D(p), Core.AOS ? 2 : 3); foreach (Mobile m in eable) ProtectionSpell.ApplyProtectionEffect(m, Caster); eable.Free(); } } FinishSequence(); }
public void Target( IPoint3D p ) { if ( !Caster.CanSee( p ) ) { Caster.SendLocalizedMessage( 500237 ); // Target can not be seen. } else if ( SpellHelper.CheckTown( p, Caster ) && CheckSequence() ) { SpellHelper.Turn( Caster, p ); SpellHelper.GetSurfaceTop( ref p ); Effects.PlaySound( p, Caster.Map, 0x243 ); int stonex; int stoney; int stonez; Point3D loc = new Point3D( p.X, p.Y, p.Z ); Item item = new InternalItema( loc, Caster.Map, Caster ); stonex=p.X; stoney=p.Y-1; stonez=p.Z; Point3D loca = new Point3D( stonex, stoney, stonez ); Item itema = new InternalItemb( loca, Caster.Map, Caster ); } FinishSequence(); }
private static void Path( Mobile from, IPoint3D p, PathAlgorithm alg, string name, int zOffset ) { m_OverrideAlgorithm = alg; long start = DateTime.Now.Ticks; MovementPath path = new MovementPath( from, new Point3D( p ) ); long end = DateTime.Now.Ticks; double len = Math.Round( (end-start) / 10000.0, 2 ); if ( !path.Success ) { from.SendMessage( "{0} path failed: {1}ms", name, len ); } else { from.SendMessage( "{0} path success: {1}ms", name, len ); int x = from.X; int y = from.Y; int z = from.Z; for ( int i = 0; i < path.Directions.Length; ++i ) { Movement.Movement.Offset( path.Directions[i], ref x, ref y ); new RecallRune().MoveToWorld( new Point3D( x, y, z+zOffset ), from.Map ); } } }
public void Target( IPoint3D p ) { if ( !Caster.CanSee( p ) ) { Caster.SendLocalizedMessage( 500237 ); // Target can not be seen. } else if ( CheckSequence() ) { SpellHelper.Turn( Caster, p ); SpellHelper.GetSurfaceTop( ref p ); Effects.PlaySound( p, Caster.Map, 0x382 ); Point3D loc = new Point3D( p.X, p.Y, p.Z ); Item item = new InternalItem( loc, Caster.Map, Caster ); } FinishSequence(); }
public void Target( IPoint3D point ) { Point3D p = new Point3D( point ); Map map = Caster.Map; if ( map == null ) return; HouseRegion r = Region.Find( p, map ).GetRegion( typeof( HouseRegion ) ) as HouseRegion; if ( r != null && r.House != null && !r.House.IsFriend( Caster ) ) return; if ( !map.CanSpawnMobile( p.X, p.Y, p.Z ) ) { Caster.SendLocalizedMessage( 501942 ); // That location is blocked. } else if ( SpellHelper.CheckTown( p, Caster ) && CheckSequence() ) { TimeSpan duration = TimeSpan.FromSeconds( Caster.Skills.Spellweaving.Value / 24 + 25 + FocusLevel * 2 ); NatureFury nf = new NatureFury(); BaseCreature.Summon( nf, false, Caster, p, 0x5CB, duration ); new InternalTimer( nf ).Start(); } FinishSequence(); }
public void Target(IPoint3D p) { Map map = Caster.Map; SpellHelper.GetSurfaceTop(ref p); if (SphereSpellTarget is BaseWand) { BaseWand bw = SphereSpellTarget as BaseWand; bw.RechargeWand(Caster, this); } else if ((map == null || !map.CanSpawnMobile(p.X, p.Y, p.Z)) && !(SphereSpellTarget is Mobile)) { Caster.SendLocalizedMessage(501942); // That location is blocked. } else if (/*SpellHelper.CheckTown(p, Caster) && */CheckSequence()) { TimeSpan duration; if (Core.AOS) duration = TimeSpan.FromSeconds(90.0); else duration = TimeSpan.FromSeconds(Utility.Random(300, 240)); if (Caster.InLOS(p)) //BaseCreature.Summon(new Daemon(), false, Caster, new Point3D(p), 0x212, duration); SpellHelper.Summon(new EarthElemental(), Caster, Sound, duration, false, false, new Point3D(p)); else Caster.SendAsciiMessage("You can't see that."); } FinishSequence(); }
public EffectInfo( IPoint3D source, Map map, int effectID, int hue = 0, int speed = 10, int duration = 10, EffectRender render = EffectRender.Normal, TimeSpan? delay = null, Action callback = null) { Map = map; EffectID = effectID; Hue = hue; Speed = speed; Duration = duration; Render = render; Delay = delay ?? TimeSpan.Zero; if (callback != null) { Callback += callback; } SetSource(source); }
public void Target( IPoint3D p ) { IPoint3D orig = p; Map map = Caster.Map; SpellHelper.GetSurfaceTop( ref p ); if ( Factions.Sigil.ExistsOn( Caster ) ) { Caster.SendLocalizedMessage( 1061632 ); // You can't do that while carrying the sigil. } else if ( Server.Misc.WeightOverloading.IsOverloaded( Caster ) ) { Caster.SendLocalizedMessage( 502359, "", 0x22 ); // Thou art too encumbered to move. } else if ( !SpellHelper.CheckTravel( Caster, TravelCheckType.TeleportFrom ) ) { } else if ( !SpellHelper.CheckTravel( Caster, map, new Point3D( p ), TravelCheckType.TeleportTo ) && ( Caster.Location.X != p.X || Caster.Location.Y != p.Y || Caster.Location.Z > p.Z) ) { } else if( EnergyField(Caster.Location, new Point3D(p))) { SpellHelper.SendInvalidMessage(Caster, TravelCheckType.TeleportTo); } else if ( map == null || !map.CanSpawnMobile( p.X, p.Y, p.Z ) ) { Caster.SendLocalizedMessage( 501942 ); // That location is blocked. } else if ( SpellHelper.CheckMulti( new Point3D( p ), map ) ) { Caster.SendLocalizedMessage( 501942 ); // That location is blocked. } else if ( CheckSequence() ) { SpellHelper.Turn( Caster, orig ); Mobile m = Caster; Point3D from = m.Location; Point3D to = new Point3D( p ); m.Location = to; m.ProcessDelta(); if ( m.Player ) { Effects.SendLocationParticles( EffectItem.Create( from, m.Map, EffectItem.DefaultDuration ), 0x3728, 10, 10, 2023 ); Effects.SendLocationParticles( EffectItem.Create( to, m.Map, EffectItem.DefaultDuration ), 0x3728, 10, 10, 5023 ); } else { m.FixedParticles( 0x376A, 9, 32, 0x13AF, EffectLayer.Waist ); } m.PlaySound( 0x1FE ); } FinishSequence(); }
public Cylinder3D(IPoint3D center, int radius, bool hollow, bool endCaps) : base(center) { _Radius = radius; _Hollow = hollow; _EndCaps = endCaps; }
public virtual void SetSource(IPoint3D source) { if (IsDisposed || Source == source) { return; } if (source == null) { Source = null; return; } if (source is IEntity) { Source = (IEntity)source; Map = Source.Map; return; } if (Source is Mobile) { ((Mobile)Source).Location = source.Clone3D(); return; } if (Source is Item) { ((Item)Source).Location = source.Clone3D(); return; } Source = new Entity(Serial.Zero, source.Clone3D(), Source != null ? Source.Map : Map); }
public void Target(IPoint3D p) { if (!Caster.CanSee(p)) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (SpellHelper.CheckTown(p, Caster) && CheckSequence()) { SpellHelper.Turn(Caster, p); SpellHelper.GetSurfaceTop(ref p); Effects.PlaySound(p, Caster.Map, 0x1DD); IEntity to = new Entity(Serial.Zero, new Point3D(p), Caster.Map); Effects.SendMovingParticles(Caster, to, 0xf53, 1, 0, false, false, 33, 3, 1260, 1, 0, EffectLayer.Head, 0x100); Point3D loc = new Point3D(p.X, p.Y, p.Z); NaturalFire fire = new NaturalFire(Caster.Location, Caster.Map, Caster); fire.MoveToWorld(loc, Caster.Map); } FinishSequence(); }
public void DoFireEffect(IPoint3D target) { Point3D from; switch (CannonDirection) { case CannonDirection.North: from = new Point3D(X, Y - 1, Z); break; case CannonDirection.East: from = new Point3D(X + 1, Y, Z); break; case CannonDirection.South: from = new Point3D(X, Y + 1, Z); break; default: from = new Point3D(X - 1, Y, Z); break; } Effects.SendLocationEffect(from, Map, 0x36B0, 16, 1); Effects.PlaySound(from, Map, 0x11D); Effects.SendLocationEffect(target, Map, 0x36B0, 16, 1); Effects.PlaySound(target, Map, 0x11D); }
public static EffectItem Create( IPoint3D p, IMap map, TimeSpan duration ) { EffectItem item = null; for ( int i = m_Free.Count - 1; item == null && i >= 0; --i ) // We reuse new entries first so decay works better { EffectItem free = (EffectItem) m_Free[i]; m_Free.RemoveAt( i ); if ( !free.Deleted && free.Map == Map.Internal ) item = free; } if ( item == null ) { item = new EffectItem(); } else { item.ItemID = 1; } item.MoveToWorld( new Point3D( p ), map as Map ); item.BeginFree( duration ); return item; }
public static void PlaySound( IPoint3D p, Map map, int soundID ) { if ( soundID <= -1 ) return; if ( map != null ) { Packet playSound = null; IPooledEnumerable eable = map.GetClientsInRange( new Point3D( p ) ); foreach ( NetState state in eable ) { state.Mobile.ProcessDelta(); if ( playSound == null ) playSound = Packet.Acquire( new PlaySound( soundID, p ) ); state.Send( playSound ); } Packet.Release( playSound ); eable.Free(); } }
public void Target( IPoint3D p ) { if ( !Caster.CanSee( p ) ) { Caster.SendLocalizedMessage( 500237 ); // Target can not be seen. } else if ( SpellHelper.CheckTown( p, Caster ) && CheckSequence() ) { SpellHelper.Turn( Caster, p ); SpellHelper.GetSurfaceTop( ref p ); int dx = Caster.Location.X - p.X; int dy = Caster.Location.Y - p.Y; int rx = (dx - dy) * 44; int ry = (dx + dy) * 44; bool eastToWest; if ( rx >= 0 && ry >= 0 ) eastToWest = false; else if ( rx >= 0 ) eastToWest = true; else if ( ry >= 0 ) eastToWest = true; else eastToWest = false; Effects.PlaySound( p, Caster.Map, 0x20B ); int itemID = eastToWest ? 0x3967 : 0x3979; TimeSpan duration = TimeSpan.FromSeconds( 3.0 + (Caster.Skills[SkillName.Magery].Value / 3.0) ); for ( int i = -2; i <= 2; ++i ) { Point3D loc = new Point3D( eastToWest ? p.X + i : p.X, eastToWest ? p.Y : p.Y + i, p.Z ); bool canFit = SpellHelper.AdjustField( ref loc, Caster.Map, 12, false ); if ( !canFit ) continue; Item item = new InternalItem( Caster, itemID, loc, Caster.Map, duration ); int hours, minutes; Server.Items.Clock.GetTime( Caster.Map, loc.X, loc.Y, out hours, out minutes ); if(hours >= 6 && hours < 22 && item.Light != LightType.Empty && !SpellHelper.IsFeluccaDungeon(item.Map, item.Location)) //its daytime disable light item.Light = LightType.Empty; else item.Light = LightType.Circle300; item.ProcessDelta(); Effects.SendLocationParticles( EffectItem.Create( loc, Caster.Map, EffectItem.DefaultDuration ), 0x376A, 9, 10, 5048 ); } } FinishSequence(); }
public bool CouldFit(IPoint3D p, Map map) { HouseTeleporterDeed deed = new HouseTeleporterDeed(); bool res = deed.CouldFit(p, map); deed.Delete(); return res; }
public void Target(IPoint3D p) { if (!Caster.CanSee(p)) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (CheckSequence()) { SpellHelper.Turn(Caster, p); SpellHelper.GetSurfaceTop(ref p); var targets = new List<Mobile>(); Map map = Caster.Map; if (map != null) { IPooledEnumerable eable = map.GetMobilesInRange( new Point3D(p), 1 + (int)(Caster.Skills[SkillName.Magery].Value / 20.0)); foreach (Mobile m in eable) { if (m is ShadowKnight && (m.X != p.X || m.Y != p.Y)) { continue; } if (m is LockeCole) { continue; } if (m is ZombieAvatar && m.NetState == null) continue; if (m.Hidden && (m.AccessLevel == AccessLevel.Player || Caster.AccessLevel > m.AccessLevel) && CheckDifficulty(Caster, m)) { targets.Add(m); } } eable.Free(); } for (int i = 0; i < targets.Count; ++i) { Mobile m = targets[i]; m.RevealingAction(); m.FixedParticles(0x375A, 9, 20, 5049, EffectLayer.Head); m.PlaySound(0x1FD); } } FinishSequence(); }
public void Target(IPoint3D p) { if (!Caster.CanSee(p)) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (CheckSequence()) { if (this.Scroll != null) Scroll.Consume(); SpellHelper.Turn(Caster, p); SpellHelper.GetSurfaceTop(ref p); ArrayList targets = new ArrayList(); Map map = Caster.Map; if (map != null) { IPooledEnumerable eable = map.GetMobilesInRange(new Point3D(p), 3); foreach (Mobile m in eable) { if (Caster.CanBeBeneficial(m, false)) targets.Add(m); } eable.Free(); } if (targets.Count > 0) { for (int i = 0; i < targets.Count; ++i) { Mobile m = (Mobile)targets[i]; Caster.DoBeneficial(m); Effects.SendLocationParticles(EffectItem.Create(new Point3D(m.X, m.Y, m.Z + 16), Caster.Map, EffectItem.DefaultDuration), 0x376A, 10, 15, 5045); m.PlaySound(0x3C4); m.Hidden = true; RemoveTimer(m); TimeSpan duration = TimeSpan.FromSeconds(Caster.Skills[SkillName.Magery].Value * 1.2); // 120% of magery Timer t = new InternalTimer(m, duration); m_Table[m] = t; t.Start(); } } } FinishSequence(); }
public void Target( IPoint3D p ) { if ( !Caster.CanSee( p ) ) { Caster.SendLocalizedMessage( 500237 ); // Target can not be seen. } else if ( CheckSequence() ) { // Scriptiz : si monstre, il ne perd pas de Mana ! if (!(Caster is PlayerMobile)) Caster.Mana += 70; SpellHelper.Turn( Caster, p ); SpellHelper.GetSurfaceTop( ref p ); List<Mobile> targets = new List<Mobile>(); Map map = Caster.Map; if ( map != null ) { IPooledEnumerable eable = map.GetMobilesInRange( new Point3D( p ), 8 ); foreach ( Mobile m in eable ) if ( m is BaseCreature && (m as BaseCreature).IsDispellable && Caster.CanBeHarmful( m, false ) ) targets.Add( m ); eable.Free(); } for ( int i = 0; i < targets.Count; ++i ) { Mobile m = targets[i]; BaseCreature bc = m as BaseCreature; if ( bc == null ) continue; double dispelChance = (50.0 + ((100 * (Caster.Skills.Magery.Value - bc.DispelDifficulty)) / (bc.DispelFocus*2))) / 100; if ( dispelChance > Utility.RandomDouble() ) { Effects.SendLocationParticles( EffectItem.Create( m.Location, m.Map, EffectItem.DefaultDuration ), 0x3728, 8, 20, 5042 ); Effects.PlaySound( m, m.Map, 0x201 ); m.Delete(); } else { Caster.DoHarmful( m ); m.FixedEffect( 0x3779, 10, 20 ); } } } FinishSequence(); }
public void Target( IPoint3D p ) { if ( !Caster.CanSee( p ) ) { Caster.SendLocalizedMessage( 500237 ); // Target can not be seen. } else if ( SpellHelper.CheckTown( p, Caster ) && CheckSequence() ) { SpellHelper.Turn( Caster, p ); SpellHelper.GetSurfaceTop( ref p ); int dx = Caster.Location.X - p.X; int dy = Caster.Location.Y - p.Y; int rx = (dx - dy) * 44; int ry = (dx + dy) * 44; bool eastToWest; if ( rx >= 0 && ry >= 0 ) { eastToWest = false; } else if ( rx >= 0 ) { eastToWest = true; } else if ( ry >= 0 ) { eastToWest = true; } else { eastToWest = false; } Effects.PlaySound( p, Caster.Map, 0x20B ); TimeSpan duration = TimeSpan.FromSeconds( Caster.Skills[SkillName.Magery].Value * 0.28 + 2.0 ); // (28% of magery) + 2.0 seconds int itemID = eastToWest ? 0x3946 : 0x3956; for ( int i = -2; i <= 2; ++i ) { Point3D loc = new Point3D( eastToWest ? p.X + i : p.X, eastToWest ? p.Y : p.Y + i, p.Z ); bool canFit = SpellHelper.AdjustField( ref loc, Caster.Map, 12, false ); if ( !canFit ) continue; Item item = new InternalItem( loc, Caster.Map, duration, itemID, Caster ); item.ProcessDelta(); Effects.SendLocationParticles( EffectItem.Create( loc, Caster.Map, EffectItem.DefaultDuration ), 0x376A, 9, 10, 5051 ); } } FinishSequence(); }
public bool Contains( IPoint3D p ) { return ( p.X >= mStart.mX ) && ( p.X < mEnd.mX ) && ( p.Y >= mStart.mY ) && ( p.Y < mEnd.mY ) && ( p.Z >= mStart.mZ ) && ( p.Z < mEnd.mZ ); }
public void Target( IPoint3D p ) { if ( !Caster.CanSee( p ) ) { Caster.SendAsciiMessage( "Target can not be seen." ); } else if ( CheckSequence() ) { SpellHelper.Turn( Caster, p ); SpellHelper.GetSurfaceTop( ref p ); ArrayList targets = new ArrayList(); Map map = Caster.Map; if ( map != null ) { IPooledEnumerable eable = map.GetMobilesInRange( new Point3D( p ), 8 ); foreach ( Mobile m in eable ) { if ( m is BaseCreature && ((BaseCreature)m).Summoned && !((BaseCreature)m).IsAnimatedDead && Caster.CanBeHarmful( m, false ) ) targets.Add( m ); } eable.Free(); } for ( int i = 0; i < targets.Count; ++i ) { Mobile m = (Mobile)targets[i]; BaseCreature bc = m as BaseCreature; if ( bc == null ) continue; double dispelChance = (50.0 + ((100 * (Caster.Skills.Magery.Value - bc.DispelDifficulty)) / (bc.DispelFocus*2))) / 100; if ( dispelChance > Utility.RandomDouble() ) { Caster.DoHarmful( m ); m.FixedEffect( 0x3779, 10, 20 ); } else { Effects.SendLocationParticles( EffectItem.Create( m.Location, m.Map, EffectItem.DefaultDuration ), 0x3728, 8, 20, 5042 ); Effects.PlaySound( m, m.Map, 0x201 ); m.Delete(); } } } FinishSequence(); }
public void Target( IPoint3D p ) { if ( !Caster.CanSee( p ) ) { Caster.SendLocalizedMessage( 500237 ); // Target can not be seen. } else if ( /*SpellHelper.CheckTown( p, Caster ) &&*/ CheckSequence() ) { SpellHelper.Turn( Caster, p ); if ( p is Item ) p = ((Item)p).GetWorldLocation(); double damage = Utility.Random( 27, 22 ); ArrayList targets = new ArrayList(); IPooledEnumerable eable = Caster.Map.GetMobilesInRange( new Point3D( p ), 1 + (int)(Caster.Skills[DamageSkill].Value / 10.0) ); foreach ( Mobile m in eable ) { if ( SpellHelper.ValidIndirectTarget( Caster, m ) && Caster.CanBeHarmful( m, false ) ) targets.Add( m ); } eable.Free(); if ( targets.Count > 0 ) { //damage /= targets.Count; // ~ divides damage between targets, kinda sux for ( int i = 0; i < targets.Count; ++i ) { Mobile m = (Mobile)targets[i]; double toDeal = damage; if ( CheckResisted( m ) ) { toDeal *= 0.7; m.SendLocalizedMessage( 501783 ); // You feel yourself resisting magical energy. } Caster.DoHarmful( m ); SpellHelper.Damage( this, m, toDeal, 50, 100, 0, 0, 0 ); m.FixedParticles( 0x3709, 20, 10, 5044, EffectLayer.RightFoot ); m.PlaySound( 0x21F ); m.FixedParticles( 0x36BD, 10, 30, 5052, EffectLayer.Head ); m.PlaySound( 0x208 ); } } } FinishSequence(); }
public void Target( IPoint3D p ) { if( !Caster.CanSee( p ) ) { Caster.SendLocalizedMessage( 500237 ); // Target can not be seen. } else if( SpellHelper.CheckTown( p, Caster ) && CheckSequence() ) { SpellHelper.Turn( Caster, p ); SpellHelper.GetSurfaceTop( ref p ); int dx = Caster.Location.X - p.X; int dy = Caster.Location.Y - p.Y; int rx = (dx - dy) * 44; int ry = (dx + dy) * 44; bool eastToWest; if( rx >= 0 && ry >= 0 ) { eastToWest = false; } else if( rx >= 0 ) { eastToWest = true; } else if( ry >= 0 ) { eastToWest = true; } else { eastToWest = false; } Effects.PlaySound( p, Caster.Map, 0x1F6 ); for( int i = -1; i <= 1; ++i ) { Point3D loc = new Point3D( eastToWest ? p.X + i : p.X, eastToWest ? p.Y : p.Y + i, p.Z ); bool canFit = SpellHelper.AdjustField( ref loc, Caster.Map, 22, true ); //Effects.SendLocationParticles( EffectItem.Create( loc, Caster.Map, EffectItem.DefaultDuration ), 0x376A, 9, 10, 5025 ); if( !canFit ) continue; Item item = new InternalItem( loc, Caster.Map, Caster ); Effects.SendLocationParticles( item, 0x376A, 9, 10, 5025 ); //new InternalItem( loc, Caster.Map, Caster ); } } FinishSequence(); }
public static bool InRange(this Item item, IPoint3D p, int range) { Point3D loc = item.GetWorldLocation(); return (p.X >= (loc.X - range)) && (p.X <= (loc.X + range)) && (p.Y >= (loc.Y - range)) && (p.Y <= (loc.Y + range)); }
public static double GetDistanceToSqrt(this Item item, IPoint3D p) { Point3D loc = item.GetWorldLocation(); int xDelta = loc.X - p.X; int yDelta = loc.Y - p.Y; return Math.Sqrt((xDelta * xDelta) + (yDelta * yDelta)); }
public void Target(IPoint3D p) { IPoint3D orig = p; Map map = this.Caster.Map; SpellHelper.GetSurfaceTop(ref p); Point3D from = this.Caster.Location; Point3D to = new Point3D(p); PlayerMobile pm = this.Caster as PlayerMobile; // IsStealthing should be moved to Server.Mobiles if (!pm.IsStealthing) { this.Caster.SendLocalizedMessage(1063087); // You must be in stealth mode to use this ability. } else if (Factions.Sigil.ExistsOn(this.Caster)) { this.Caster.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil. } else if (Server.Misc.WeightOverloading.IsOverloaded(this.Caster)) { this.Caster.SendLocalizedMessage(502359, "", 0x22); // Thou art too encumbered to move. } else if (!SpellHelper.CheckTravel(this.Caster, TravelCheckType.TeleportFrom) || !SpellHelper.CheckTravel(this.Caster, map, to, TravelCheckType.TeleportTo)) { } else if (map == null || !map.CanSpawnMobile(p.X, p.Y, p.Z)) { this.Caster.SendLocalizedMessage(502831); // Cannot teleport to that spot. } else if (SpellHelper.CheckMulti(to, map, true, 5)) { this.Caster.SendLocalizedMessage(502831); // Cannot teleport to that spot. } else if (Region.Find(to, map).GetRegion(typeof(HouseRegion)) != null) { this.Caster.SendLocalizedMessage(502829); // Cannot teleport to that spot. } else if (this.CheckSequence()) { SpellHelper.Turn(this.Caster, orig); Mobile m = this.Caster; m.Location = to; m.ProcessDelta(); Effects.SendLocationParticles(EffectItem.Create(from, m.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 2023); m.PlaySound(0x512); Server.SkillHandlers.Stealth.OnUse(m); // stealth check after the a jump } this.FinishSequence(); }
public void OnTarget(IPoint3D p) { if (SpellHelper.CheckTown(p, Caster) && CheckSequence()) { SpellHelper.Turn(Caster, p); SpellHelper.GetSurfaceTop(ref p); Map map = Caster.Map; if (map == null) { return; } Rectangle2D effectArea = new Rectangle2D(p.X - 3, p.Y - 3, 6, 6); Effects.PlaySound(p, map, 0x64F); for (int x = effectArea.X; x <= effectArea.X + effectArea.Width; x++) { for (int y = effectArea.Y; y <= effectArea.Y + effectArea.Height; y++) { if (x == effectArea.X && y == effectArea.Y || x >= effectArea.X + effectArea.Width - 1 && y >= effectArea.Y + effectArea.Height - 1 || y >= effectArea.Y + effectArea.Height - 1 && x == effectArea.X || y == effectArea.Y && x >= effectArea.X + effectArea.Width - 1) { continue; } IPoint3D pnt = new Point3D(x, y, p.Z); SpellHelper.GetSurfaceTop(ref pnt); Timer.DelayCall <Point3D>(TimeSpan.FromMilliseconds(Utility.RandomMinMax(100, 300)), point => { Effects.SendLocationEffect(point, map, 0x3779, 12, 11, 0x63, 0); }, new Point3D(pnt)); } } System.Collections.Generic.List <IDamageable> list = AcquireIndirectTargets(p, 2).ToList(); int count = list.Count; foreach (IDamageable id in list) { if (id.Deleted) { continue; } int damage = GetNewAosDamage(51, 1, 5, id is PlayerMobile, id); if (count > 2) { damage = (damage * 2) / count; } Caster.DoHarmful(id); SpellHelper.Damage(this, id, damage, 0, 0, 100, 0, 0); Server.Effects.SendTargetParticles(id, 0x374A, 1, 15, 9502, 97, 3, (EffectLayer)255, 0); } ColUtility.Free(list); } FinishSequence(); }
public static void SendLocationEffect(IPoint3D p, int itemID, int speed, int duration, int hue) { Effects.SendPacket(p, Map.Malas, new LocationEffect(p, itemID, speed, duration, hue, 0)); }
public void OnTarget(Mobile from, object obj) { if (Deleted || m_InUse) { return; } IPoint3D p3D = obj as IPoint3D; if (p3D == null) { return; } Map map = from.Map; if (map == null || map == Map.Internal) { return; } int x = p3D.X, y = p3D.Y, z = map.GetAverageZ(x, y); // OSI just takes the targeted Z if (!from.InRange(p3D, 6)) { from.SendLocalizedMessage(500976); // You need to be closer to the water to fish! } else if (!from.InLOS(obj)) { from.SendLocalizedMessage(500979); // You cannot see that location. } else if (RequireDeepWater ? FullValidation(map, x, y) : ValidateDeepWater(map, x, y) || ValidateUndeepWater(map, obj, ref z)) { Point3D p = new Point3D(x, y, z); if (GetType() == typeof(SpecialFishingNet)) { for (int i = 1; i < Amount; ++i) // these were stackable before, doh { from.AddToBackpack(new SpecialFishingNet()); } } m_InUse = true; Movable = false; MoveToWorld(p, map); SpellHelper.Turn(from, p); from.Animate(12, 5, 1, true, false, 0); Effects.SendLocationEffect(p, map, 0x352D, 16, 4); Effects.PlaySound(p, map, 0x364); Timer.DelayCall(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1.25), 14, new TimerStateCallback(DoEffect), new object[] { p, 0, from }); from.SendLocalizedMessage(RequireDeepWater ? 1010487 : 1074492); // You plunge the net into the sea... / You plunge the net into the water... } else { from.SendLocalizedMessage(RequireDeepWater ? 1010485 : 1074491); // You can only use this net in deep water! / You can only use this net in water! } }
public static bool InUpdateRange(Mobile m, IPoint3D p) { return(InUpdateRange(m, m, p)); }
protected override void OnTarget(Mobile from, object targeted) { if (m_Shield == null || m_Shield.Deleted) { return; } if (m_Shield.IsChildOf(from.Backpack)) { BaseHouse house = BaseHouse.FindHouseAt(from); if (house != null && house.IsOwner(from)) { IPoint3D p = targeted as IPoint3D; Map map = from.Map; if (p == null || map == null) { return; } Point3D p3d = new Point3D(p); ItemData id = TileData.ItemTable[m_ItemID & TileData.MaxItemValue]; if (map.CanFit(p3d, id.Height)) { house = BaseHouse.FindHouseAt(p3d, map, id.Height); if (house != null && house.IsOwner(from)) { bool north = BaseAddon.IsWall(p3d.X, p3d.Y - 1, p3d.Z, map); bool west = BaseAddon.IsWall(p3d.X - 1, p3d.Y, p3d.Z, map); if (north && west) { from.CloseGump(typeof(FacingGump)); from.SendGump(new FacingGump(m_Shield, m_ItemID, p3d, house)); } else if (north || west) { DecorativeShield shield = null; if (north) { shield = new DecorativeShield(m_ItemID); } else if (west) { shield = new DecorativeShield(GetWestItemID(m_ItemID)); } house.Addons.Add(shield); shield.IsRewardItem = m_Shield.IsRewardItem; shield.MoveToWorld(p3d, map); m_Shield.Delete(); } else { from.SendLocalizedMessage(1049781); // This decoration must be placed next to a wall. } } else { from.SendLocalizedMessage(1042036); // That location is not in your house. } } else { from.SendLocalizedMessage(500269); // You cannot build that there. } } else { from.SendLocalizedMessage(502092); // You must be in your house to do this. } } else { from.SendLocalizedMessage(1042038); // You must have the object in your backpack to use it. } }
public void Target(IPoint3D p) { if (!this.Caster.CanSee(p)) { this.Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (SpellHelper.CheckTown(p, this.Caster) && this.CheckSequence()) { SpellHelper.Turn(this.Caster, p); SpellHelper.GetSurfaceTop(ref p); int dx = this.Caster.Location.X - p.X; int dy = this.Caster.Location.Y - p.Y; int rx = (dx - dy) * 44; int ry = (dx + dy) * 44; bool eastToWest; if (rx >= 0 && ry >= 0) { eastToWest = false; } else if (rx >= 0) { eastToWest = true; } else if (ry >= 0) { eastToWest = true; } else { eastToWest = false; } Effects.PlaySound(p, this.Caster.Map, 0x20B); int itemID = eastToWest ? 0x3967 : 0x3979; TimeSpan duration = TimeSpan.FromSeconds(3.0 + (this.Caster.Skills[SkillName.Magery].Value / 3.0)); for (int i = -2; i <= 2; ++i) { Point3D loc = new Point3D(eastToWest ? p.X + i : p.X, eastToWest ? p.Y : p.Y + i, p.Z); bool canFit = SpellHelper.AdjustField(ref loc, this.Caster.Map, 12, false); if (!canFit) { continue; } Item item = new InternalItem(this.Caster, itemID, loc, this.Caster.Map, duration); item.ProcessDelta(); Effects.SendLocationParticles(EffectItem.Create(loc, this.Caster.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 5048); } } this.FinishSequence(); }
public void Target(IPoint3D p) { if (!this.Caster.CanSee(p)) { this.Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (SpellHelper.CheckTown(p, this.Caster) && this.CheckSequence()) { SpellHelper.Turn(this.Caster, p); if (p is Item) { p = ((Item)p).GetWorldLocation(); } List <Mobile> targets = new List <Mobile>(); Map map = this.Caster.Map; if (map != null) { IPooledEnumerable eable = map.GetMobilesInRange(new Point3D(p), 2); foreach (Mobile m in eable) { if (Core.AOS && m == this.Caster) { continue; } if (SpellHelper.ValidIndirectTarget(this.Caster, m) && this.Caster.CanBeHarmful(m, false)) { if (Core.AOS && !this.Caster.InLOS(m)) { continue; } targets.Add(m); } } eable.Free(); } double damage; if (targets.Count > 0) { for (int i = 0; i < targets.Count; ++i) { Mobile m = targets[i]; damage = Utility.Random(27, 22); if (Core.AOS && targets.Count > 2) { damage = (damage * 2) / targets.Count; } else if (!Core.AOS) { damage /= targets.Count; } if (!Core.AOS && this.CheckResisted(m)) { damage *= 0.5; m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy. } damage *= this.GetDamageScalar(m); this.Caster.DoHarmful(m); SpellHelper.Damage(this, m, damage, 0, 0, 0, 0, 100); m.BoltEffect(0); } } else { this.Caster.PlaySound(0x29); } } this.FinishSequence(); }
public void Target(IPoint3D p) { if (!Caster.CanSee(p)) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (CheckSequence()) { SpellHelper.Turn(Caster, p); SpellHelper.GetSurfaceTop(ref p); List <Mobile> targets = new List <Mobile>(); Map map = Caster.Map; Mobile directTarget = p as Mobile; if (map != null) { bool feluccaRules = map.Rules == MapRules.FeluccaRules; // You can target any living mobile directly, beneficial checks apply if (directTarget != null && Caster.CanBeBeneficial(directTarget, false)) { targets.Add(directTarget); } IPooledEnumerable <Mobile> eable = map.GetMobilesInRange(new Point3D(p), 2); targets.AddRange(eable.Where(m => m != directTarget).Where(m => AreaCanTarget(m, feluccaRules))); eable.Free(); } Effects.PlaySound(p, Caster.Map, 0x299); if (targets.Count > 0) { int cured = 0; for (int i = 0; i < targets.Count; ++i) { Mobile m = targets[i]; Caster.DoBeneficial(m); Poison poison = m.Poison; if (poison != null) { int chanceToCure = 10000 + (int)(Caster.Skills.Magery.Value * 75) - (poison.Level + 1) * 1750; chanceToCure /= 100; chanceToCure -= 1; if (chanceToCure > Utility.Random(100) && m.CurePoison(Caster)) { ++cured; } } m.FixedParticles(0x373A, 10, 15, 5012, EffectLayer.Waist); m.PlaySound(0x1E0); } if (cured > 0) { Caster.SendLocalizedMessage(1010058); // You have cured the target of all poisons! } } } FinishSequence(); }
public bool CouldFit(IPoint3D p, Map map) { return(map.CanFit((Point3D)p, 20)); }
public void Target(IPoint3D p) { if (!Caster.CanSee(p)) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (SpellHelper.CheckTown(p, Caster) && CheckSequence()) { SpellHelper.Turn(Caster, p); if (p is Item) { p = ((Item)p).GetWorldLocation(); } ArrayList targets = new ArrayList(); Map map = Caster.Map; bool playerVsPlayer = false; if (map != null) { IPooledEnumerable eable = map.GetMobilesInRange(new Point3D(p), 2); foreach (Mobile m in eable) { if (Caster != m && SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false)) { targets.Add(m); if (m.Player) { playerVsPlayer = true; } } } eable.Free(); } double damage; if (Core.AOS) { damage = GetNewAosDamage(48, 1, 5, Caster.Player && playerVsPlayer); } else { damage = Utility.Random(27, 22); } if (targets.Count > 0) { Effects.PlaySound(p, Caster.Map, 0x160); if (Core.AOS && targets.Count > 1) { damage = (damage * 2) / targets.Count; } else if (!Core.AOS) { damage /= targets.Count; } for (int i = 0; i < targets.Count; ++i) { Mobile m = (Mobile)targets[i]; double toDeal = damage; if (!Core.AOS && CheckResisted(m)) { toDeal *= 0.5; m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy. } Caster.DoHarmful(m); SpellHelper.Damage(this, m, toDeal, 0, 100, 0, 0, 0); Caster.MovingParticles(m, 0x36D4, 7, 0, false, true, 9501, 1, 0, 0x100); } } } FinishSequence(); }
public PathFollower(Mobile from, IPoint3D goal) { m_From = from; Goal = goal; }
protected override void OnTarget(Mobile from, object o) { IPoint3D loc = o as IPoint3D; if (loc == null) { return; } if (m_Owner.CheckSequence()) { SpellHelper.Turn(from, o); Effects.SendLocationParticles(EffectItem.Create(new Point3D(loc), from.Map, EffectItem.DefaultDuration), 0x376A, 9, 32, 5024); Effects.PlaySound(loc, from.Map, 0x1FF); if (o is Mobile) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503101); // That did not need to be unlocked. } else if (!(o is LockableContainer)) { from.SendLocalizedMessage(501666); // You can't unlock that! } else { LockableContainer cont = (LockableContainer)o; if (Multis.BaseHouse.CheckSecured(cont)) { from.SendLocalizedMessage(503098); // You cannot cast this on a secure item. } else if (!cont.Locked) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503101); // That did not need to be unlocked. } else if (cont.LockLevel == 0) { from.SendLocalizedMessage(501666); // You can't unlock that! } else { int level = (int)(from.Skills[SkillName.Magery].Value * 0.8) - 4; if (level >= cont.RequiredSkill && !(cont is TreasureMapChest && ((TreasureMapChest)cont).Level > 2)) { cont.Locked = false; if (cont.LockLevel == -255) { cont.LockLevel = cont.RequiredSkill - 10; } } else { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 503099); // My spell does not seem to have an effect on that lock. } } } } m_Owner.FinishSequence(); }
// 82mètre,speed100 = 4920ms public virtual int GetMsTimeToArriveAt(IPoint3D target, int speed) { return((int)((float)(Obj.GetDistanceTo(target) / (float)speed) * METRE_SPEED_MS) * 100); }
public override void OnDoubleClick(Mobile from) { if (IsChildOf(from.Backpack)) { from.BeginTarget(10, true, Server.Targeting.TargetFlags.None, (m, targeted) => { if (IsChildOf(from.Backpack)) { IPoint3D p = targeted as IPoint3D; Map map = from.Map; if (p == null || map == null || Deleted) { return; } Server.Spells.SpellHelper.GetSurfaceTop(ref p); BaseHouse house = null; Item door; if (this.Type < DoorType.LeftMetalDoor_S_In) { door = new CraftableStoneHouseDoor(this.Type, GetDoorFacing(this.Type)); } else { door = new CraftableMetalHouseDoor(this.Type, GetDoorFacing(this.Type)); } if (door is CraftableMetalHouseDoor) { ((CraftableMetalHouseDoor)door).Resource = _Resource; } else if (door is CraftableStoneHouseDoor) { ((CraftableStoneHouseDoor)door).Resource = _Resource; } AddonFitResult res = CouldFit(door, p, map, from, ref house); switch (res) { case AddonFitResult.Valid: PlaceDoor(from, door, p, map, house); return; case AddonFitResult.Blocked: from.SendLocalizedMessage(500269); // You cannot build that there. break; case AddonFitResult.NotInHouse: from.SendLocalizedMessage(500274); // You can only place this in a house that you own! break; case AddonFitResult.DoorsNotClosed: from.SendMessage("You must close all house doors before placing this."); break; case AddonFitResult.DoorTooClose: from.SendLocalizedMessage(500271); // You cannot build near the door. break; case AddonFitResult.BadHouse: from.SendLocalizedMessage(500269); // You cannot build that there. break; } door.Delete(); } else { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } }); } else { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } }
protected override void OnTarget(Mobile from, object obj) { if (m_BaseThrowingItem.Deleted || m_BaseThrowingItem.Map == Map.Internal) { return; } if (obj is Mobile) { Mobile to = (Mobile)obj; if (!from.CanBeHarmful(to)) { } else { from.Direction = from.GetDirectionTo(to); from.Animate(11, 5, 1, true, false, 0); from.MovingEffect(to, m_BaseThrowingItem.ItemID, 10, 0, false, false); Timer.DelayCall(TimeSpan.FromSeconds(0.5), new TimerStateCallback(FinishThrow), new object[] { from, to, m_DamageMin, m_DamageMax, m_Break, m_BaseThrowingItem }); if (m_DeleteOnThrow || m_Break) { m_BaseThrowingItem.Delete(); } } } else { IPoint3D p = obj as IPoint3D; if (p == null) { return; } Map map = from.Map; if (map == null) { return; } IEntity to; to = new Entity(Serial.Zero, new Point3D(p), map); from.Direction = from.GetDirectionTo(to); Effects.SendMovingEffect(from, to, m_BaseThrowingItem.ItemID & 0x3FFF, 7, 0, false, false, m_BaseThrowingItem.Hue, 0); from.Animate(11, 5, 1, true, false, 0); if (m_DeleteOnThrow) { m_BaseThrowingItem.Delete(); from.SendMessage("You miss the target and the {0} is wasted", m_BaseThrowingItem.Name); } else { Timer.DelayCall(TimeSpan.FromSeconds(0.5), new TimerStateCallback(FinishMiss), new object[] { to, map, m_BaseThrowingItem }); from.SendMessage("You miss the target"); } } }
public PathFollower(Mobile from, IPoint3D goal) { this.m_From = from; this.m_Goal = goal; }
public virtual bool Contains(IPoint3D p) { return(Contains(p.X, p.Y)); }
public void Target(IPoint3D p) { if (!Caster.CanSee(p)) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (!CheckLineOfSight(p)) { this.DoFizzle(); Caster.SendAsciiMessage("Target is not in line of sight"); } else if (SpellHelper.CheckTown(p, Caster) && CheckSequence()) { SpellHelper.Turn(Caster, p); SpellHelper.GetSurfaceTop(ref p); int dx = Caster.Location.X - p.X; int dy = Caster.Location.Y - p.Y; int rx = (dx - dy) * 44; int ry = (dx + dy) * 44; bool eastToWest; if (rx >= 0 && ry >= 0) { eastToWest = false; } else if (rx >= 0) { eastToWest = true; } else if (ry >= 0) { eastToWest = true; } else { eastToWest = false; } Effects.PlaySound(p, Caster.Map, 0x20B); TimeSpan duration; if (Core.AOS) { duration = TimeSpan.FromSeconds((15 + (Caster.Skills.Magery.Fixed / 5)) / 7); } else { duration = TimeSpan.FromSeconds(Caster.Skills[SkillName.Magery].Value * 0.28 + 2.0); // (28% of magery) + 2.0 seconds } int itemID = eastToWest ? 0x3946 : 0x3956; for (int i = -2; i <= 2; ++i) { Point3D loc = new Point3D(eastToWest ? p.X + i : p.X, eastToWest ? p.Y : p.Y + i, p.Z); bool canFit = SpellHelper.AdjustField(ref loc, Caster.Map, 12, false); if (!canFit) { continue; } Item item = new InternalItem(loc, Caster.Map, duration, itemID, Caster); item.ProcessDelta(); Effects.SendLocationParticles(EffectItem.Create(loc, Caster.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 5051); } } FinishSequence(); }
public void Target(IPoint3D p) { if (!Caster.CanSee(p)) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (!CheckLineOfSight(p)) { this.DoFizzle(); Caster.SendAsciiMessage("Target is not in line of sight"); } else if (SpellHelper.CheckTown(p, Caster) && CheckSequence()) { SpellHelper.Turn(Caster, p); if (p is Item) { p = ((Item)p).GetWorldLocation(); } List <Mobile> targets = new List <Mobile>(); Map map = Caster.Map; bool playerVsPlayer = false; if (map != null) { IPooledEnumerable eable = map.GetMobilesInRange(new Point3D(p), 2); foreach (Mobile m in eable) { if (Core.AOS && m == Caster) { continue; } if (SpellHelper.ValidIndirectTarget(Caster, m) && Caster.CanBeHarmful(m, false)) { if (Core.AOS && !Caster.InLOS(m)) { continue; } targets.Add(m); if (m.Player) { playerVsPlayer = true; } } } eable.Free(); } double damage; if (Core.AOS) { damage = GetNewAosDamage(51, 1, 5, playerVsPlayer); } else { damage = Utility.Random(27, 22); } if (targets.Count > 0) { if (Core.AOS && targets.Count > 2) { damage = (damage * 2) / targets.Count; } else if (!Core.AOS) { damage /= targets.Count; } for (int i = 0; i < targets.Count; ++i) { Mobile m = targets[i]; double toDeal = damage; if (!Core.AOS && CheckResisted(m)) { toDeal *= 0.5; m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy. } Caster.DoHarmful(m); SpellHelper.Damage(this, m, toDeal, 0, 0, 0, 0, 100); m.BoltEffect(0); } } else { Caster.PlaySound(0x29); } } FinishSequence(); }
public override void OnDoubleClick(Mobile from) { //TODO: Finish the ontaret stuff and clilocs. if (!IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } else { BaseHouse house = BaseHouse.FindHouseAt(from); if (house != null) { base.OnDoubleClick(from); } else { from.BeginTarget(10, true, Targeting.TargetFlags.None, (m, targeted) => { if (targeted is IPoint3D) { Point3D p = new Point3D((IPoint3D)targeted); int dist = (int)from.GetDistanceToSqrt(p); if (dist < 2 || dist > 5) { from.SendLocalizedMessage(1152736); // You must stand between 2 and 5 tiles away from the targeted location to attempt to build this. } else if (!from.InLOS(p)) { from.SendLocalizedMessage(500237); // Target cannot be seen. } else if (!ValidateLocation(p, from.Map)) { from.SendLocalizedMessage(1152735); // The targeted location has at least one impassable tile adjacent to the structure. } else { BaseHouse checkHouse = BaseHouse.FindHouseAt(from); if (checkHouse != null) { from.SendLocalizedMessage(500269); // You cannot build that there. } else { IPoint3D point = (IPoint3D)targeted; Spells.SpellHelper.GetSurfaceTop(ref point); BaseAddon addon = Addon; addon.MoveToWorld(new Point3D(point), m.Map); if (addon is TemporaryForge) { ((TemporaryForge)addon).Owner = from; } Delete(); } } } }); } } }
public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; string prefix = CommandSystem.Prefix; IPoint3D p = from.Location as IPoint3D; if (from.AccessLevel < AccessLevel.Counselor) { from.SendMessage(2102, "Only staff members can use this."); return; } switch (info.ButtonID) { case 1: { from.SendMessage(2102, "{0}{1}", prefix, C1); CommandSystem.Handle(from, String.Format("{0}{1}", prefix, C1)); ToolbarCmds.TagToolbar(from); break; } case 2: { from.SendMessage(2109, "{0}{1}", prefix, C2); CommandSystem.Handle(from, String.Format("{0}{1}", prefix, C2)); ToolbarCmds.TagToolbar(from); break; } case 3: { from.SendMessage(2102, "{0}{1}", prefix, C3); CommandSystem.Handle(from, String.Format("{0}{1}", prefix, C3)); ToolbarCmds.TagToolbar(from); break; } case 4: { from.SendMessage(2109, "{0}{1}", prefix, C4); CommandSystem.Handle(from, String.Format("{0}{1}", prefix, C4)); ToolbarCmds.TagToolbar(from); break; } case 5: { from.SendMessage(2102, "{0}{1}", prefix, C5); CommandSystem.Handle(from, String.Format("{0}{1}", prefix, C5)); ToolbarCmds.TagToolbar(from); break; } case 6: { from.SendMessage(2109, "{0}{1}", prefix, C6); CommandSystem.Handle(from, String.Format("{0}{1}", prefix, C6)); ToolbarCmds.TagToolbar(from); break; } case 7: { from.SendMessage(2102, "{0}{1}", prefix, C7); CommandSystem.Handle(from, String.Format("{0}{1}", prefix, C7)); ToolbarCmds.TagToolbar(from); break; } case 9: { //if ( HideType == "Normal" ) //{ Effects.SendLocationEffect(new Point3D(from.X + 1, from.Y, from.Z + 4), from.Map, 0x3728, 13); Effects.SendLocationEffect(new Point3D(from.X + 1, from.Y, from.Z), from.Map, 0x3728, 13); Effects.SendLocationEffect(new Point3D(from.X + 1, from.Y, from.Z - 4), from.Map, 0x3728, 13); Effects.SendLocationEffect(new Point3D(from.X, from.Y + 1, from.Z + 4), from.Map, 0x3728, 13); Effects.SendLocationEffect(new Point3D(from.X, from.Y + 1, from.Z), from.Map, 0x3728, 13); Effects.SendLocationEffect(new Point3D(from.X, from.Y + 1, from.Z - 4), from.Map, 0x3728, 13); Effects.SendLocationEffect(new Point3D(from.X + 1, from.Y + 1, from.Z + 11), from.Map, 0x3728, 13); Effects.SendLocationEffect(new Point3D(from.X + 1, from.Y + 1, from.Z + 7), from.Map, 0x3728, 13); Effects.SendLocationEffect(new Point3D(from.X + 1, from.Y + 1, from.Z + 3), from.Map, 0x3728, 13); Effects.SendLocationEffect(new Point3D(from.X + 1, from.Y + 1, from.Z - 1), from.Map, 0x3728, 13); from.PlaySound(0x228); if (!from.Hidden) { from.Hidden = true; } else { from.Hidden = false; } //} ToolbarCmds.TagToolbar(from); break; } /*case 10: * { * if( (from.HasGump( typeof( ItemMove ))) || (from.HasGump( typeof( MobileMove)))) * { * from.SendMessage("You must close all Item/Mobile movers before you do this!"); * } * else * { * from.Target = new ItemMobileMoveTarget( this ); * from.SendMessage("Select an item/mobile."); * } * * from.SendGump( new CommandToolbar( item ) ); * break; * } * case 11: * { * if( from.HasGump( typeof( CreatureControl ))) * { * from.SendMessage("You must close all Creature Controls before you do this!"); * } * else * { * from.Target = new ControlTarget( this ); * from.SendMessage("Select a creature."); * } * * from.SendGump( new CommandToolbar( item ) ); * break; * }*/ } }
/// <summary> /// Calculates distance between two <see cref="IPoint3D" /> objects. /// </summary> /// <param name="a">First <see cref="IPoint3D"/>.</param> /// <param name="b">Second <see cref="IPoint3D"/>.</param> /// <returns>Distance between two <see cref="IPoint3D" /> objects.</returns> public static double DistanceBetween(IPoint3D a, IPoint3D b) { return(Math.Sqrt((a.X - b.X) * (a.X - b.X) + (a.Y - b.Y) * (a.Y - b.Y) + (a.Z - b.Z) * (a.Z - b.Z))); }
public QuestArrow(Mobile m, IPoint3D t, int x, int y) : this(m, t) { Update(x, y); }
public override bool DoOrderFollow() { if (m_Creature.Orb == null || !m_Creature.Controlled) { return(base.DoOrderFollow()); } bool fighting = false; switch (m_Creature.Orb.Aggression) { case Aggression.Following: return(base.DoOrderFollow()); case Aggression.Defensive: { int length = m_Creature.GetLeashLength(); IPoint3D p = m_Creature.Orb.Anchor as IPoint3D; if (p == null) { p = m_Creature; } Mobile combatant = m_Creature.Combatant != null ? m_Creature.Combatant as Mobile : m_Creature.ControlMaster.Combatant != null ? m_Creature.ControlMaster.Combatant as Mobile : null; if (combatant != null && combatant.GetDistanceToSqrt(p) <= length) { if (m_Creature.Debug) { m_Creature.DebugSay("I have detected {0} as an aggressor, attacking", m_Creature.FocusMob.Name); } fighting = true; m_Creature.Combatant = combatant; m_Creature.ControlTarget = combatant; m_Creature.ControlOrder = OrderType.Attack; Action = ActionType.Combat; } else { return(base.DoOrderFollow()); } } break; case Aggression.Aggressive: { if (AcquireFocusMob(m_Creature.GetLeashLength(), m_Creature.FightMode, false, false, true)) { if (m_Creature.Debug) { m_Creature.DebugSay("I have detected {0}, attacking", m_Creature.FocusMob.Name); } fighting = true; m_Creature.Combatant = m_Creature.FocusMob; m_Creature.ControlTarget = m_Creature.FocusMob; m_Creature.ControlOrder = OrderType.Attack; Action = ActionType.Combat; } else { return(base.DoOrderFollow()); } } break; } if (!fighting) { return(base.DoOrderFollow()); } return(true); }
public QuestArrow(Mobile m, IPoint3D t) { m_Running = true; m_Mobile = m; m_Target = t; }
public override bool AcquireFocusMob(int iRange, FightMode acqType, bool bPlayerOnly, bool bFacFriend, bool bFacFoe) { bool found = base.AcquireFocusMob(iRange, acqType, bPlayerOnly, bFacFriend, bFacFoe); if (m_Creature.Orb == null || m_Creature.ControlMaster == null) { return(found); } if (!found && Core.TickCount - m_Creature.NextReacquireTime < 0) { m_Creature.FocusMob = null; return(false); } m_Creature.NextReacquireTime = Core.TickCount + (int)m_Creature.ReacquireDelay.TotalMilliseconds; if (!found && m_Creature.Map != null && m_Creature.Map != Map.Internal) { switch (m_Creature.Orb.Aggression) { case Aggression.Following: break; case Aggression.Defensive: { Mobile focus = m_Creature.Combatant as Mobile; if (focus == null) { focus = m_Creature.ControlMaster.Combatant as Mobile; } if (focus != null) { m_Creature.FocusMob = focus; found = true; } } break; case Aggression.Aggressive: { int range = m_Creature.GetLeashLength(); IPoint3D p = m_Creature.Orb.Anchor as IPoint3D; if (p == null) { p = m_Creature; } Mobile focus = GetFocus(p, range); if (focus != null) { m_Creature.FocusMob = focus; found = true; } } break; } } return(found); }
public void Target(IPoint3D p) { if (!Caster.CanSee(p)) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (SpellHelper.CheckTown(p, Caster) && CheckSequence()) { if (this.Scroll != null) { Scroll.Consume(); } SpellHelper.Turn(Caster, p); SpellHelper.GetSurfaceTop(ref p); Effects.PlaySound(p, Caster.Map, 0x474); Point3D loc = new Point3D(p.X, p.Y, p.Z); int mushx; int mushy; int mushz; InternalItem firstFlamea = new InternalItem(Caster.Location, Caster.Map, Caster); mushx = loc.X - 2; mushy = loc.Y - 2; mushz = loc.Z; Point3D mushxyz = new Point3D(mushx, mushy, mushz); firstFlamea.MoveToWorld(mushxyz, Caster.Map); firstFlamea.ItemID = 3267; InternalItem firstFlamec = new InternalItem(Caster.Location, Caster.Map, Caster); mushx = loc.X; mushy = loc.Y - 3; mushz = loc.Z; Point3D mushxyzb = new Point3D(mushx, mushy, mushz); firstFlamec.MoveToWorld(mushxyzb, Caster.Map); firstFlamec.ItemID = 3267; InternalItem firstFlamed = new InternalItem(Caster.Location, Caster.Map, Caster); firstFlamed.ItemID = 3267; mushx = loc.X + 2; mushy = loc.Y - 2; mushz = loc.Z; Point3D mushxyzc = new Point3D(mushx, mushy, mushz); firstFlamed.MoveToWorld(mushxyzc, Caster.Map); InternalItem firstFlamee = new InternalItem(Caster.Location, Caster.Map, Caster); mushx = loc.X + 3; firstFlamee.ItemID = 3267; mushy = loc.Y; mushz = loc.Z; Point3D mushxyzd = new Point3D(mushx, mushy, mushz); firstFlamee.MoveToWorld(mushxyzd, Caster.Map); InternalItem firstFlamef = new InternalItem(Caster.Location, Caster.Map, Caster); firstFlamef.ItemID = 3267; mushx = loc.X + 2; mushy = loc.Y + 2; mushz = loc.Z; Point3D mushxyze = new Point3D(mushx, mushy, mushz); firstFlamef.MoveToWorld(mushxyze, Caster.Map); InternalItem firstFlameg = new InternalItem(Caster.Location, Caster.Map, Caster); mushx = loc.X; firstFlameg.ItemID = 3267; mushy = loc.Y + 3; mushz = loc.Z; Point3D mushxyzf = new Point3D(mushx, mushy, mushz); firstFlameg.MoveToWorld(mushxyzf, Caster.Map); InternalItem firstFlameh = new InternalItem(Caster.Location, Caster.Map, Caster); mushx = loc.X - 2; firstFlameh.ItemID = 3267; mushy = loc.Y + 2; mushz = loc.Z; Point3D mushxyzg = new Point3D(mushx, mushy, mushz); firstFlameh.MoveToWorld(mushxyzg, Caster.Map); InternalItem firstFlamei = new InternalItem(Caster.Location, Caster.Map, Caster); mushx = loc.X - 3; firstFlamei.ItemID = 3267; mushy = loc.Y; mushz = loc.Z; Point3D mushxyzh = new Point3D(mushx, mushy, mushz); firstFlamei.MoveToWorld(mushxyzh, Caster.Map); } FinishSequence(); }
public override bool DoActionWander() { if (m_Creature.Orb == null || !m_Creature.Controlled) { return(base.DoActionWander()); } bool incombat = false; switch (m_Creature.Orb.Aggression) { case Aggression.Following: break; case Aggression.Defensive: { int length = m_Creature.GetLeashLength(); IPoint3D p = m_Creature.Orb.Anchor as IPoint3D; if (p == null) { p = m_Creature.ControlMaster; } Mobile combatant = m_Creature.Combatant != null ? m_Creature.Combatant as Mobile : m_Creature.ControlMaster.Combatant != null ? m_Creature.ControlMaster.Combatant as Mobile : null; if (combatant != null && combatant.GetDistanceToSqrt(p) <= length) { if (m_Creature.Debug) { m_Creature.DebugSay("I have detected {0} as an aggressor, attacking", m_Creature.FocusMob.Name); } incombat = true; m_Creature.Combatant = combatant; m_Creature.ControlTarget = combatant; m_Creature.ControlOrder = OrderType.Attack; Action = ActionType.Combat; } } break; case Aggression.Aggressive: { if (AcquireFocusMob(m_Creature.GetLeashLength(), m_Creature.FightMode, false, false, true)) { if (m_Creature.Debug) { m_Creature.DebugSay("I have detected {0}, attacking", m_Creature.FocusMob.Name); } incombat = true; m_Creature.Combatant = m_Creature.FocusMob; m_Creature.ControlTarget = m_Creature.FocusMob; m_Creature.ControlOrder = OrderType.Attack; Action = ActionType.Combat; } else { return(base.DoActionWander()); } } break; } if (!incombat && SmartAI && m_Creature.Mana < m_Creature.ManaMax) { m_Creature.DebugSay("I am going to meditate"); m_Creature.UseSkill(SkillName.Meditation); } else if (!incombat) { m_Creature.DebugSay("I am wandering"); m_Creature.Warmode = false; base.DoActionWander(); Spell spell = CheckCastHealingSpell(); if (spell != null) { spell.Cast(); } } return(true); }
public void OnTarget(Mobile from, object obj) { if (Deleted || m_InUse) { return; } IPoint3D p3D = obj as IPoint3D; if (p3D == null) { return; } Map map = from.Map; if (map == null || map == Map.Internal) { return; } int x = p3D.X, y = p3D.Y; LandTile landTile = map.Tiles.GetLandTile(x, y); StaticTile[] tiles = map.Tiles.GetStaticTiles(x, y, true); bool hasWater = false; if (landTile.Z == p3D.Z && Server.Misc.Worlds.IsWaterTile(landTile.ID, 0)) { hasWater = true; } for (int i = 0; i < tiles.Length; ++i) { StaticTile tile = tiles[i]; if (tile.Z == p3D.Z && Server.Misc.Worlds.IsWaterTile(tile.ID, 0)) { hasWater = true; } } if (!from.InRange(p3D, 6)) { from.SendLocalizedMessage(500976); // You need to be closer to the water to fish! } else if (hasWater) { Point3D p = new Point3D(x, y, map.GetAverageZ(x, y)); this.ItemID = 0x0DCA; m_InUse = true; Movable = false; MoveToWorld(p, map); from.Animate(12, 5, 1, true, false, 0); Timer.DelayCall(TimeSpan.FromSeconds(1.5), TimeSpan.FromSeconds(1.0), 20, new TimerStateCallback(DoEffect), new object[] { p, 0, from }); from.SendLocalizedMessage(1010487); // You plunge the net into the sea... } else { from.SendLocalizedMessage(1010485); // You can only use this net in deep water! } }
protected override void OnTarget(Mobile m, object o) { IPoint3D point = (IPoint3D)o; if (c_Contract == null || c_Contract.ParentHouse == null) { return; } if (!c_Contract.ParentHouse.Region.Contains(new Point3D(point.X, point.Y, point.Z))) { m.SendMessage("Vous devez cibler dans la maison"); m.Target = new InternalTarget(c_Gump, c_Contract, c_Type, c_BoundOne); return; } switch (c_Type) { case TargetType.SignLoc: c_Contract.SignLoc = new Point3D(point.X, point.Y, point.Z); c_Contract.ShowSignPreview(); c_Gump.NewGump(); break; case TargetType.MinZ: if (!c_Contract.ParentHouse.Region.Contains(new Point3D(point.X, point.Y, point.Z))) { m.SendMessage("Ce n'est pas dans votre maison"); } else if (c_Contract.HasContractedArea(point.Z)) { m.SendMessage("Cette zone est déjà prise par un autre contrat de location"); } else { c_Contract.MinZ = point.Z; if (c_Contract.MaxZ < c_Contract.MinZ + 19) { c_Contract.MaxZ = point.Z + 19; } } c_Contract.ShowFloorsPreview(m); c_Gump.NewGump(); break; case TargetType.MaxZ: if (!c_Contract.ParentHouse.Region.Contains(new Point3D(point.X, point.Y, point.Z))) { m.SendMessage("Ce n'est pas dans votre maison"); } else if (c_Contract.HasContractedArea(point.Z)) { m.SendMessage("Cette zone est déjà prise par un autre contrat de location."); } else { c_Contract.MaxZ = point.Z + 19; if (c_Contract.MinZ > c_Contract.MaxZ) { c_Contract.MinZ = point.Z; } } c_Contract.ShowFloorsPreview(m); c_Gump.NewGump(); break; case TargetType.BlockOne: m.SendMessage("Maintenant, ciblez le coin sud-est"); m.Target = new InternalTarget(c_Gump, c_Contract, TargetType.BlockTwo, new Point3D(point.X, point.Y, point.Z)); break; case TargetType.BlockTwo: Rectangle2D rect = TownHouseSetupGump.FixRect(new Rectangle2D(c_BoundOne, new Point3D(point.X + 1, point.Y + 1, point.Z))); if (c_Contract.HasContractedArea(rect, point.Z)) { m.SendMessage("Cette zone est déjà prise par un autre contrat de location"); } else { c_Contract.Blocks.Add(rect); c_Contract.ShowAreaPreview(m); } c_Gump.NewGump(); break; } }