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);
            }
        }
Exemple #2
0
        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;
            }
            }
        }