public virtual void SpawnTrap() { Map map = 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(m_RegionBounds.X, m_RegionBounds.Width); int y = Utility.Random(m_RegionBounds.Y, m_RegionBounds.Height); int z = 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); 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; } } }