示例#1
0
        private void CheckRespawn()
        {
            Cleanup();

            // Bedrolls Spawn

            foreach (BedrollEntry entry in m_Entries)
            {
                WrongBedrollBase item = (WrongBedrollBase)Activator.CreateInstance(entry.Type);

                item.Movable = false;
                item.MoveToWorld(entry.Location, Map);
                Bedrolls.Add(item);
            }

            // Mysterious Tunnels Spawn

            MysteriousTunnel mt;
            WrongBedrollBase bedroll;
            int mtrandom;

            for (int i = 0; i < m_OutsideTunnels.Length; i++)
            {
                mt = new MysteriousTunnel();

                if (i < 3)
                {
                    mtrandom     = Utility.Random(m_Entries.Length);
                    mt.PointDest = Bedrolls[mtrandom].Location;
                    Bedrolls[mtrandom].PointDest      = m_OutsideTunnels[i];
                    Bedrolls[mtrandom].BedrollSpawner = this;
                }
                else
                {
                    mt.PointDest = m_RoomDestinations[Utility.Random(m_RoomDestinations.Length)];
                    bedroll      = Bedrolls.Where(x => x.InRange(mt.PointDest, 4) && x.PointDest == Point3D.Zero).FirstOrDefault();

                    if (bedroll != null)
                    {
                        bedroll.PointDest      = m_OutsideTunnels[i];
                        bedroll.BedrollSpawner = this;
                    }
                }

                mt.MoveToWorld(m_OutsideTunnels[i], Map);
                MysteriousTunnels.Add(mt);
            }
        }
示例#2
0
        public override void OnDoubleClick(Mobile from)
        {
            if (!from.InRange(GetWorldLocation(), 2))
            {
                from.SendLocalizedMessage(500446); // That is too far away.
                return;
            }

            from.RevealingAction();

            if (PointDest != Point3D.Zero)
            {
                MysteriousTunnel mt = new MysteriousTunnel();
                Effects.PlaySound(from.Location, from.Map, 0x3BD);

                mt.PointDest = PointDest;
                mt.MoveToWorld(Location, Map);
                m_Spawner.MysteriousTunnels.Add(mt);
            }
            else
            {
                if (Utility.RandomDouble() < 0.5)
                {
                    Point3D loc   = GetWorldLocation();
                    Map     facet = Map;

                    SendMessageTo(from, 502999, 0x3B2); // You set off a trap!
                    AOS.Damage(from, 40, 0, 100, 0, 0, 0);

                    switch (Utility.Random(3))
                    {
                    case 0:
                    {
                        Effects.SendLocationEffect(loc, facet, 0x36BD, 15, 10);
                        Effects.PlaySound(loc, facet, 0x307);
                        break;
                    }

                    case 1:
                    {
                        Effects.PlaySound(loc, Map, 0x307);
                        Effects.SendLocationEffect(new Point3D(loc.X - 1, loc.Y, loc.Z), Map, 0x36BD, 15);
                        Effects.SendLocationEffect(new Point3D(loc.X + 1, loc.Y, loc.Z), Map, 0x36BD, 15);
                        Effects.SendLocationEffect(new Point3D(loc.X, loc.Y - 1, loc.Z), Map, 0x36BD, 15);
                        Effects.SendLocationEffect(new Point3D(loc.X, loc.Y + 1, loc.Z), Map, 0x36BD, 15);
                        Effects.SendLocationEffect(new Point3D(loc.X + 1, loc.Y + 1, loc.Z + 11), Map, 0x36BD, 15);
                        break;
                    }

                    case 2:
                    {
                        Effects.SendLocationEffect(loc, facet, 0x113A, 10, 20);
                        Effects.PlaySound(loc, facet, 0x231);
                        break;
                    }
                    }
                }
                else
                {
                    if (Utility.RandomDouble() < 0.01)
                    {
                        Item soap = new Soap();

                        Effects.PlaySound(from.Location, from.Map, 0x247);  //powder

                        if (Utility.RandomBool())
                        {
                            from.AddToBackpack(soap);
                            from.SendLocalizedMessage(1152268, string.Format("soap"));
                        }
                        else
                        {
                            soap.MoveToWorld(Location, Map);
                        }
                    }
                    else
                    {
                        Effects.PlaySound(from.Location, from.Map, 0x3E3); //leather
                        from.SendLocalizedMessage(1152212);                //You tear the bedroll to pieces but find nothing.
                    }
                }
            }

            Delete();
        }