Esempio n. 1
0
        private static void OnCommand(CommandEventArgs e)
        {
            if (e == null || e.Mobile == null || !(e.Mobile is PlayerMobile))
            {
                return;
            }

            PlayerMobile m = (PlayerMobile)e.Mobile;

            if (e.Arguments == null || e.Arguments.Length == 0)
            {
                return;
            }

            string shapeName = e.Arguments[0].Trim().ToLower();
            int    val1, val2;

            if (e.Arguments.Length < 2 || !Int32.TryParse(e.Arguments[1].Trim(), out val1))
            {
                val1 = 5;
            }

            if (e.Arguments.Length < 3 || !Int32.TryParse(e.Arguments[2].Trim(), out val2))
            {
                val2 = 5;
            }

            val1 = Math.Max(0, Math.Min(10, val1));
            val2 = e.Arguments.Length < 3 ? val1 : Math.Max(0, Math.Min(10, val2));

            GenericSelectTarget <IPoint3D> .Begin(
                m,
                (mob, targ) =>
            {
                Point3D loc = targ.Clone3D(0, 0, Math.Max(val1, val2) * 5);

                Shape3D shape;

                switch (shapeName)
                {
                case "sphere":
                    shape = new Sphere3D(loc, val1, false);
                    break;

                case "ring":
                    shape = new Ring3D(loc, val1, val2);
                    break;

                case "disc":
                    shape = new Disc3D(loc, val1, false);
                    break;

                case "cylendar":
                    shape = new Cylendar3D(loc, val1, false);
                    break;

                case "cube":
                    shape = new Cube3D(loc, val1, false);
                    break;

                default:
                    return;
                }

                shape.ForEach(
                    b =>
                {
                    Static block = new Static(1801);

                    block.MoveToWorld(b, m.Map);
                });
            },
                mob => { },
                -1,
                true);
        }
Esempio n. 2
0
		public static void DoStarsEffect(
			this FireworkStars fx, IPoint3D p, Map map, int radius, int sound, int[] stars, int[] hues)
		{
			if (fx == FireworkStars.None || stars == null || stars.Length == 0)
			{
				return;
			}

			radius = Math.Max(0, Math.Min(10, radius));

			if (hues.Length == 0)
			{
				hues = new int[9];

				hues.SetAll(i => Utility.RandomBrightHue());
			}

			switch (fx)
			{
				case FireworkStars.Peony:
					{
						var shape = new Sphere3D(p, radius, true);

						foreach (var b in shape)
						{
							new MovingEffectInfo(
								p, b, map, stars.GetRandom(), hues.GetRandom(), Utility.RandomMinMax(4, 6), EffectRender.LightenMore)
								.MovingImpact(
									e =>
									{
										if (sound > 0 && Utility.RandomDouble() <= 0.25)
										{
											Effects.PlaySound(b, map, sound);
										}
									});
						}

						shape.Clear();
					}
					break;
				case FireworkStars.Chrysanthemum:
					{
						var shape = new Disc3D(p, radius, false);

						foreach (var b in shape)
						{
							new MovingEffectInfo(
								p, b, map, stars.GetRandom(), hues.GetRandom(), Utility.RandomMinMax(4, 6), EffectRender.LightenMore)
								.MovingImpact(
									e =>
									{
										if (sound > 0 && Utility.RandomDouble() <= 0.25)
										{
											Effects.PlaySound(b, map, sound);
										}
									});
						}

						shape.Clear();
					}
					break;
				case FireworkStars.Dahlia:
					{
						var shape = new Cylendar3D(p, radius, true, false);

						foreach (var b in shape)
						{
							new MovingEffectInfo(
								p, b, map, stars.GetRandom(), hues.GetRandom(), Utility.RandomMinMax(6, 8), EffectRender.LightenMore)
								.MovingImpact(
									e =>
									{
										if (sound > 0 && Utility.RandomDouble() <= 0.25)
										{
											Effects.PlaySound(b, map, sound);
										}
									});
						}

						shape.Clear();
					}
					break;
				case FireworkStars.Willow:
					{
						var shape = new Disc3D(p, radius, true);

						foreach (var b in shape)
						{
							new MovingEffectInfo(
								p, b, map, stars.GetRandom(), hues.GetRandom(), Utility.RandomMinMax(6, 8), EffectRender.LightenMore)
								.MovingImpact(
									e =>
									{
										if (Utility.RandomDouble() < 0.66)
										{
											return;
										}

										int zL = b.Z;
										int zR = b.GetWorldTop(map).Z;

										if (zL <= zR || zL < p.Z)
										{
											return;
										}

										int zDiff = zL - zR;

										if (zDiff < 30)
										{
											return;
										}

										Point3D t = b.Clone3D(0, 0, -(zDiff / 2));

										new MovingEffectInfo(b, t, map, e.EffectID, e.Hue, Math.Max(1, e.Speed / 2), e.Render).Send();

										if (sound > 0 && Utility.RandomDouble() <= 0.25)
										{
											Effects.PlaySound(b, map, sound);
										}
									});
						}

						shape.Clear();
					}
					break;
				case FireworkStars.BloomFlower:
					{
						var shape = new Ring3D(p, radius);

						foreach (var b in shape)
						{
							new MovingEffectInfo(
								p, b, map, stars.GetRandom(), hues.GetRandom(), Utility.RandomMinMax(6, 8), EffectRender.LightenMore)
								.MovingImpact(
									e =>
									{
										if (Utility.RandomDouble() < 0.66)
										{
											return;
										}

										Point3D t = b.Clone3D(Utility.RandomMinMax(-3, 3), Utility.RandomMinMax(-3, 3), Utility.RandomMinMax(-10, 10));

										new MovingEffectInfo(b, t, map, e.EffectID, e.Hue, e.Speed, e.Render).Send();

										if (sound > 0 && Utility.RandomDouble() <= 0.25)
										{
											Effects.PlaySound(b, map, sound);
										}
									});
						}

						shape.Clear();
					}
					break;
				case FireworkStars.Ring:
					{
						var shape = new Ring3D(p, radius);

						foreach (var b in shape)
						{
							new MovingEffectInfo(
								p, b, map, stars.GetRandom(), hues.GetRandom(), Utility.RandomMinMax(6, 8), EffectRender.LightenMore)
								.MovingImpact(
									e =>
									{
										int zL = b.Z;
										int zR = b.GetWorldTop(map).Z;

										if (zL <= zR || zL < p.Z)
										{
											return;
										}

										int zDiff = zL - zR;

										if (zDiff < 30)
										{
											return;
										}

										Point3D t = b.Clone3D(0, 0, -(zDiff / 2));

										new MovingEffectInfo(b, t, map, e.EffectID, e.Hue, 2, e.Render).Send();

										if (sound > 0 && Utility.RandomDouble() <= 0.25)
										{
											Effects.PlaySound(b, map, sound);
										}
									});
						}

						shape.Clear();
					}
					break;
				case FireworkStars.Crossette:
					{
						var shape = new Plane3D(p, radius, true);

						foreach (var b in shape)
						{
							new MovingEffectInfo(
								p, b, map, stars.GetRandom(), hues.GetRandom(), Utility.RandomMinMax(6, 8), EffectRender.LightenMore)
								.MovingImpact(
									e =>
									{
										if (Utility.RandomDouble() < 0.33)
										{
											return;
										}

										Point3D t = b.Clone3D(Utility.RandomMinMax(-5, 5), Utility.RandomMinMax(-5, 5));

										new MovingEffectInfo(b, t, map, e.EffectID, e.Hue, e.Speed, e.Render).Send();

										if (sound > 0 && Utility.RandomDouble() <= 0.25)
										{
											Effects.PlaySound(b, map, sound);
										}
									});
						}

						shape.Clear();
					}
					break;
			}
		}