public virtual void SpawnTraps(Field Handeling) { if (Handeling.AllowTraps == false) { return; } int numberOfTraps = Handeling.NumberOfTraps; int kindOfTrap = 0; Item trap = null; int randomValueX = 0; int randomValueY = 0; int negative = 0; for (int i = 0; i < numberOfTraps; i++) { kindOfTrap = Utility.Random(5); randomValueX = Utility.Random(20); negative = Utility.Random(2); if (negative > 0) { randomValueX *= -1; } negative = Utility.Random(2); randomValueY = Utility.Random(20); if (negative > 0) { randomValueY *= -1; } switch (kindOfTrap) { case 0: { trap = new FireColumnTrap(); break; } case 1: { trap = new GasTrap(); break; } case 2: { trap = new GiantSpikeTrap(); break; } case 3: { trap = new SawTrap(); break; } case 4: { trap = new SpikeTrap(); break; } } trap.Movable = false; trap.Location = new Point3D((spawnpoint.X + randomValueX), (spawnpoint.Y + randomValueY), (spawnpoint.Z)); trap.Map = spawnmap; Traps.Add(trap); } }
public virtual void SpawnTrap() { Map map = this.Map; if (map == null) { return; } BaseTrap trap = null; int random = Utility.Random(100); if (22 > random) { trap = new SawTrap(Utility.RandomBool() ? SawTrapType.WestFloor : SawTrapType.NorthFloor); } else if (44 > random) { trap = new SpikeTrap(Utility.RandomBool() ? SpikeTrapType.WestFloor : SpikeTrapType.NorthFloor); } else if (66 > random) { trap = new GasTrap(Utility.RandomBool() ? GasTrapType.NorthWall : GasTrapType.WestWall); } else if (88 > random) { trap = new FireColumnTrap(); } else { trap = new MushroomTrap(); } if (trap == null) { return; } if (trap is FireColumnTrap || trap is MushroomTrap) { trap.Hue = 0x451; } // try 10 times to find a valid location for (int i = 0; i < 10; ++i) { int x = Utility.Random(this.m_RegionBounds.X, this.m_RegionBounds.Width); int y = Utility.Random(this.m_RegionBounds.Y, this.m_RegionBounds.Height); int z = this.Z; if (!map.CanFit(x, y, z, 16, false, false)) { z = map.GetAverageZ(x, y); } if (!map.CanFit(x, y, z, 16, false, false)) { continue; } trap.MoveToWorld(new Point3D(x, y, z), map); this.m_Traps.Add(trap); return; } trap.Delete(); }
public override void OnResponse(NetState sender, RelayInfo info) { Mobile from = sender.Mobile; switch (info.ButtonID) { case 1: { FireColumnTrap sTrap = new FireColumnTrap(); sTrap.MoveToWorld(new Point3D(from.X, from.Y, from.Z), from.Map); from.SendGump(new AddTrapGump()); break; } case 2: { FlameSpurtTrap sTrap = new FlameSpurtTrap(); sTrap.MoveToWorld(new Point3D(from.X, from.Y, from.Z), from.Map); from.SendGump(new AddTrapGump()); break; } case 3: { GiantSpikeTrap sTrap = new GiantSpikeTrap(); sTrap.MoveToWorld(new Point3D(from.X, from.Y, from.Z), from.Map); from.SendGump(new AddTrapGump()); break; } case 4: { GasTrap sTrap = new GasTrap(GasTrapType.Floor); sTrap.MoveToWorld(new Point3D(from.X, from.Y, (from.Z + 3)), from.Map); from.SendGump(new AddTrapGump()); break; } case 5: { MushroomTrap sTrap = new MushroomTrap(); sTrap.MoveToWorld(new Point3D(from.X, from.Y, from.Z), from.Map); from.SendGump(new AddTrapGump()); break; } case 6: { SpikeTrap sTrap = new SpikeTrap(SpikeTrapType.WestWall); sTrap.ItemID = 4360; sTrap.MoveToWorld(new Point3D(from.X, from.Y, (from.Z + 5)), from.Map); from.SendGump(new AddTrapGump()); break; } case 7: { SpikeTrap sTrap = new SpikeTrap(SpikeTrapType.NorthWall); sTrap.ItemID = 4379; sTrap.MoveToWorld(new Point3D(from.X, from.Y, (from.Z + 5)), from.Map); from.SendGump(new AddTrapGump()); break; } case 8: { SpikeTrap sTrap = new SpikeTrap(SpikeTrapType.WestFloor); sTrap.ItemID = 4506; sTrap.MoveToWorld(new Point3D(from.X, from.Y, from.Z), from.Map); from.SendGump(new AddTrapGump()); break; } case 9: { SpikeTrap sTrap = new SpikeTrap(SpikeTrapType.NorthFloor); sTrap.ItemID = 4512; sTrap.MoveToWorld(new Point3D(from.X, from.Y, from.Z), from.Map); from.SendGump(new AddTrapGump()); break; } case 10: { StoneFaceTrap sTrap = new StoneFaceTrap(); sTrap.ItemID = 0x110F; sTrap.MoveToWorld(new Point3D(from.X, from.Y, (from.Z + 3)), from.Map); from.SendGump(new AddTrapGump()); break; } case 11: { SawTrap sTrap = new SawTrap(SawTrapType.NorthWall); sTrap.ItemID = 0x1103; sTrap.MoveToWorld(new Point3D(from.X, from.Y, (from.Z + 10)), from.Map); from.SendGump(new AddTrapGump()); break; } case 12: { SawTrap sTrap = new SawTrap(SawTrapType.WestWall); sTrap.ItemID = 0x1116; sTrap.MoveToWorld(new Point3D(from.X, from.Y, (from.Z + 10)), from.Map); from.SendGump(new AddTrapGump()); break; } case 13: { SawTrap sTrap = new SawTrap(SawTrapType.WestFloor); sTrap.ItemID = 0x11B1; sTrap.MoveToWorld(new Point3D(from.X, from.Y, from.Z), from.Map); from.SendGump(new AddTrapGump()); break; } case 14: { SawTrap sTrap = new SawTrap(SawTrapType.NorthFloor); sTrap.ItemID = 0x11AC; sTrap.MoveToWorld(new Point3D(from.X, from.Y, from.Z), from.Map); from.SendGump(new AddTrapGump()); break; } case 15: { StoneFaceTrap sTrap = new StoneFaceTrap(); sTrap.ItemID = 0x10FC; sTrap.MoveToWorld(new Point3D(from.X, from.Y, (from.Z + 3)), from.Map); from.SendGump(new AddTrapGump()); break; } } }