Exemplo n.º 1
0
 public static void ConfigureBasementDoors()
 {
     foreach (Item item in World.Items.Values)
     {
         if (item is BasementDoor)
         {
             BasementDoor door = (BasementDoor)item;
             if (door.Name == "iron" || door.Name == "cloth" || door.Name == "wood" || door.Name == "shop")
             {
                 door.DoorShop = door.Name;
             }
             door.Name = "basement trapdoor";
         }
     }
 }
Exemplo n.º 2
0
        public bool CanUseDoor(Mobile m)
        {
            if (m is PlayerMobile)
            {
                string sPublicDoor = "";
                int    mX          = 0;
                int    mY          = 0;
                int    mZ          = 0;
                Map    mWorld      = null;

                PlayerMobile pc = (PlayerMobile)m;

                CharacterDatabase DB = Server.Items.CharacterDatabase.GetDB(m);

                sPublicDoor = DB.CharacterPublicDoor;

                if (sPublicDoor != null)
                {
                    string[] sPublicDoors = sPublicDoor.Split('#');
                    int      nEntry       = 1;
                    foreach (string exits in sPublicDoors)
                    {
                        if (nEntry == 1)
                        {
                            mX = Convert.ToInt32(exits);
                        }
                        else if (nEntry == 2)
                        {
                            mY = Convert.ToInt32(exits);
                        }
                        else if (nEntry == 3)
                        {
                            mZ = Convert.ToInt32(exits);
                        }
                        else if (nEntry == 4)
                        {
                            try { mWorld = Map.Parse(exits); } catch {} if (mWorld == null)
                            {
                                mWorld = Map.Sosaria;
                            }
                        }
                        nEntry++;
                    }
                }

                Point3D loc = new Point3D(mX, mY, mZ);

                if (mWorld == null)
                {
                    return(false);
                }

                IPooledEnumerable eable = mWorld.GetItemsInRange(loc, 4);

                foreach (Item item in eable)
                {
                    if (item is BasementDoor)
                    {
                        BasementDoor door = (BasementDoor)item;
                        if (door.DoorShop == "iron" && this.X == 4093)
                        {
                            eable.Free(); return(true);
                        }
                        else if (door.DoorShop == "cloth" && (this.X == 4109 || this.X == 4110))
                        {
                            eable.Free(); return(true);
                        }
                        else if (door.DoorShop == "wood" && (this.X == 4120 || this.X == 4121))
                        {
                            eable.Free(); return(true);
                        }
                    }
                }

                eable.Free();
                return(false);
            }
            return(false);
        }