Ejemplo n.º 1
0
        // Get a collection of doors from the room.
        public static door[] GetRoomDoors(int DoorAreaID, int RoomNumber, int CoordX, int CoordY, int CoordZ)
        {
            door[] doors = new door[800];

            // Configure database connection elements.
            OleDbDataAdapter da         = new OleDbDataAdapter();
            OleDbConnection  connection = new OleDbConnection();

            connection.ConnectionString = database.getConnectionString();
            DataSet ds = new DataSet("doors");

            try
            {
                connection.Open();

                // Create query.
                string strSQL = string.Empty;
                strSQL += " select [DoorID], [DoorAreaID], [RoomNumber], [VNUM], [Keywords], [Direction], [DoorType], [KeyVNUM], [CoordX], [CoordY], [CoordZ] ";
                strSQL += " from   [RoomDoors] ";
                strSQL += " where  DoorAreaID = " + DoorAreaID + " ";
                strSQL += "        and RoomNumber = " + RoomNumber + " ";
                strSQL += "        and CoordX = " + CoordX + " ";
                strSQL += "        and CoordY = " + CoordY + " ";
                strSQL += "        and CoordZ = " + CoordZ + " ";

                da = new OleDbDataAdapter(strSQL, connection);
                da.Fill(ds);

                int iRow = 0;
                while (iRow <= ds.Tables[0].Rows.Count - 1)
                {
                    door oDoor = new door();

                    oDoor.doorID     = (int)ds.Tables[0].Rows[iRow]["DoorID"];
                    oDoor.areaID     = (int)ds.Tables[0].Rows[iRow]["DoorAreaID"];
                    oDoor.roomNumber = (int)ds.Tables[0].Rows[iRow]["RoomNumber"];
                    oDoor.VNUM       = (int)ds.Tables[0].Rows[iRow]["VNUM"];
                    oDoor.keywords   = (string)ds.Tables[0].Rows[iRow]["Keywords"];
                    oDoor.direction  = (string)ds.Tables[0].Rows[iRow]["Direction"];
                    oDoor.doorType   = (string)ds.Tables[0].Rows[iRow]["DoorType"];
                    oDoor.keyVNUM    = (int)ds.Tables[0].Rows[iRow]["KeyVNUM"];;
                    oDoor.coordX     = (int)ds.Tables[0].Rows[iRow]["CoordX"];;
                    oDoor.coordY     = (int)ds.Tables[0].Rows[iRow]["CoordY"];;
                    oDoor.coordZ     = (int)ds.Tables[0].Rows[iRow]["CoordZ"];;

                    doors[iRow] = oDoor;

                    iRow++;
                }
            }
            catch (Exception ex)
            {
                string strError = ex.Message;
            }

            connection.Close();
            connection.Dispose();

            return(doors);
        }
Ejemplo n.º 2
0
        // Get a room door by Room ID.
        public static door GetDoorByID(int DoorID)
        {
            door oDoor = new door();

            // Configure database connection elements.
            OleDbDataAdapter da         = new OleDbDataAdapter();
            OleDbConnection  connection = new OleDbConnection();

            connection.ConnectionString = database.getConnectionString();
            DataSet ds = new DataSet("doors");

            try
            {
                connection.Open();

                // Create query.
                string strSQL = string.Empty;
                strSQL += " select [DoorID], [DoorAreaID], [RoomNumber], [VNUM], [Keywords], [Direction], [DoorType], [KeyVNUM], [CoordX], [CoordY], [CoordZ] ";
                strSQL += " from   [RoomDoors] ";
                strSQL += " where  DoorID = " + DoorID + " ";

                da = new OleDbDataAdapter(strSQL, connection);
                da.Fill(ds);

                if (ds.Tables[0].Rows.Count > 0)
                {
                    oDoor.doorID     = (int)ds.Tables[0].Rows[0]["DoorID"];
                    oDoor.areaID     = (int)ds.Tables[0].Rows[0]["DoorAreaID"];
                    oDoor.roomNumber = (int)ds.Tables[0].Rows[0]["RoomNumber"];
                    oDoor.VNUM       = (int)ds.Tables[0].Rows[0]["VNUM"];
                    oDoor.keywords   = (string)ds.Tables[0].Rows[0]["Keywords"];
                    oDoor.direction  = (string)ds.Tables[0].Rows[0]["Direction"];
                    oDoor.doorType   = (string)ds.Tables[0].Rows[0]["DoorType"];
                    oDoor.keyVNUM    = (int)ds.Tables[0].Rows[0]["KeyVNUM"];;
                    oDoor.coordX     = (int)ds.Tables[0].Rows[0]["CoordX"];;
                    oDoor.coordY     = (int)ds.Tables[0].Rows[0]["CoordY"];;
                    oDoor.coordZ     = (int)ds.Tables[0].Rows[0]["CoordZ"];;
                }
            }
            catch (Exception ex)
            {
                string strError = ex.Message;
            }

            connection.Close();
            connection.Dispose();

            return(oDoor);
        }
Ejemplo n.º 3
0
        // Get a room door by Room ID.
        public static door GetDoorByID(int DoorID)
        {
            door oDoor = new door();

            // Configure database connection elements.
            OleDbDataAdapter da = new OleDbDataAdapter();
            OleDbConnection connection = new OleDbConnection();
            connection.ConnectionString = database.getConnectionString();
            DataSet ds = new DataSet("doors");

            try
            {
                connection.Open();

                // Create query.
                string strSQL = string.Empty;
                strSQL += " select [DoorID], [DoorAreaID], [RoomNumber], [VNUM], [Keywords], [Direction], [DoorType], [KeyVNUM], [CoordX], [CoordY], [CoordZ] ";
                strSQL += " from   [RoomDoors] ";
                strSQL += " where  DoorID = " + DoorID + " ";

                da = new OleDbDataAdapter(strSQL, connection);
                da.Fill(ds);

                if (ds.Tables[0].Rows.Count > 0)
                {
                    oDoor.doorID = (int)ds.Tables[0].Rows[0]["DoorID"];
                    oDoor.areaID = (int)ds.Tables[0].Rows[0]["DoorAreaID"];
                    oDoor.roomNumber = (int)ds.Tables[0].Rows[0]["RoomNumber"];
                    oDoor.VNUM = (int)ds.Tables[0].Rows[0]["VNUM"];
                    oDoor.keywords = (string)ds.Tables[0].Rows[0]["Keywords"];
                    oDoor.direction = (string)ds.Tables[0].Rows[0]["Direction"];
                    oDoor.doorType = (string)ds.Tables[0].Rows[0]["DoorType"];
                    oDoor.keyVNUM = (int)ds.Tables[0].Rows[0]["KeyVNUM"]; ;
                    oDoor.coordX = (int)ds.Tables[0].Rows[0]["CoordX"]; ;
                    oDoor.coordY = (int)ds.Tables[0].Rows[0]["CoordY"]; ;
                    oDoor.coordZ = (int)ds.Tables[0].Rows[0]["CoordZ"]; ;
                }
            }
            catch (Exception ex)
            {
                string strError = ex.Message;
            }

            connection.Close();
            connection.Dispose();

            return oDoor;
        }
Ejemplo n.º 4
0
        // Get the Mirror Door ID of a Door by Direction.
        public static int GetDoorMirrorID(door oDoorMirror, int RoomNumber)
        {
            int iDoorID = 0;

            // Configure database connection elements.
            OleDbDataAdapter da         = new OleDbDataAdapter();
            OleDbConnection  connection = new OleDbConnection();

            connection.ConnectionString = database.getConnectionString();
            DataSet ds = new DataSet("doors");

            try
            {
                connection.Open();

                // Create query.
                string strSQL = string.Empty;
                strSQL += " select [DoorID], [DoorAreaID], [RoomNumber], [VNUM], [Keywords], [Direction], [DoorType], [KeyVNUM], [CoordX], [CoordY], [CoordZ] ";
                strSQL += " from   [RoomDoors] ";
                strSQL += " where  DoorAreaID = " + oDoorMirror.areaID + " ";
                strSQL += "        and RoomNumber = " + oDoorMirror.roomNumber + " ";
                strSQL += "        and Direction = '" + oDoorMirror.direction + "' ";
                strSQL += "        and CoordX = " + oDoorMirror.coordX + " ";
                strSQL += "        and CoordY = " + oDoorMirror.coordY + " ";
                strSQL += "        and CoordZ = " + oDoorMirror.coordZ + " ";

                da = new OleDbDataAdapter(strSQL, connection);
                da.Fill(ds);

                if (ds.Tables[0].Rows.Count > 0)
                {
                    iDoorID = (int)ds.Tables[0].Rows[0]["DoorID"];
                }
            }
            catch (Exception ex)
            {
                string strError = ex.Message;
            }

            connection.Close();
            connection.Dispose();

            return(iDoorID);
        }
Ejemplo n.º 5
0
        // Get the Mirror Door of a Door by Direction.
        public static door GetDoorMirror(door oDoor, int RoomNumber)
        {
            int  iModCheck      = 0;
            bool blnNorthBorder = false;
            bool blnSouthBorder = false;
            bool blnEastBorder  = false;
            bool blnWestBorder  = false;

            // Create a new Door Object to hold the Mirror values.
            door oDoorMirror = new door();

            // Start with a copy of the New Door.
            oDoorMirror.doorID     = oDoor.doorID;
            oDoorMirror.areaID     = oDoor.areaID;
            oDoorMirror.roomNumber = oDoor.roomNumber;
            oDoorMirror.VNUM       = oDoor.VNUM;
            oDoorMirror.keywords   = oDoor.keywords;
            oDoorMirror.direction  = oDoor.direction;
            oDoorMirror.doorType   = oDoor.doorType;
            oDoorMirror.keyVNUM    = oDoor.keyVNUM;
            oDoorMirror.coordX     = oDoor.coordX;
            oDoorMirror.coordY     = oDoor.coordY;
            oDoorMirror.coordZ     = oDoor.coordZ;

            // Set the Door Mirror new Direction.
            oDoorMirror.direction = GetOppositeDirection(oDoor.direction);

            // Deterine if Room is on the North border of the map.
            iModCheck = (RoomNumber - 1) % 25;
            if (iModCheck == 0)
            {
                blnNorthBorder = true;
            }

            // Deterine if Room is on the South border of the map.
            iModCheck = (RoomNumber) % 25;
            if (iModCheck == 0)
            {
                blnSouthBorder = true;
            }

            // Deterine if Room is on the East border of the map.
            if ((RoomNumber + 25) > 750)
            {
                blnEastBorder = true;
            }

            // Deterine if Room is on the West border of the map.
            if ((RoomNumber - 25) < 0)
            {
                blnWestBorder = true;
            }

            // Determine North Mirror
            if (blnNorthBorder && oDoor.direction.ToLower() == "north")
            {
                oDoorMirror.roomNumber = RoomNumber + 24;
                oDoorMirror.coordY    += 1;
            }
            else if (!blnNorthBorder && oDoor.direction.ToLower() == "north")
            {
                oDoorMirror.roomNumber = RoomNumber - 1;
            }

            // Determine South Mirror
            if (blnSouthBorder && oDoor.direction.ToLower() == "south")
            {
                oDoorMirror.roomNumber = RoomNumber - 24;
                oDoorMirror.coordY    -= 1;
            }
            else if (!blnSouthBorder && oDoor.direction.ToLower() == "south")
            {
                oDoorMirror.roomNumber = RoomNumber + 1;
            }

            // Determine East Mirror
            if (blnEastBorder && oDoor.direction.ToLower() == "east")
            {
                oDoorMirror.roomNumber = RoomNumber - 725;
                oDoorMirror.coordX    += 1;
            }
            else if (!blnEastBorder && oDoor.direction.ToLower() == "east")
            {
                oDoorMirror.roomNumber = RoomNumber + 25;
            }

            // Determine West Mirror
            if (blnWestBorder && oDoor.direction.ToLower() == "west")
            {
                oDoorMirror.roomNumber = RoomNumber + 725;
                oDoorMirror.coordX    -= 1;
            }
            else if (!blnWestBorder && oDoor.direction.ToLower() == "west")
            {
                oDoorMirror.roomNumber = RoomNumber - 25;
            }

            // Determine West Mirror
            if (oDoor.direction.ToLower() == "up")
            {
                oDoorMirror.coordZ += 1;
            }

            // Determine West Mirror
            if (oDoor.direction.ToLower() == "down")
            {
                oDoorMirror.coordZ -= 1;
            }

            return(oDoorMirror);
        }
Ejemplo n.º 6
0
        // Get a collection of doors from the room.
        public static door[] GetRoomDoors(int DoorAreaID, int RoomNumber, int CoordX, int CoordY, int CoordZ)
        {
            door[] doors = new door[800];

            // Configure database connection elements.
            OleDbDataAdapter da = new OleDbDataAdapter();
            OleDbConnection connection = new OleDbConnection();
            connection.ConnectionString = database.getConnectionString();
            DataSet ds = new DataSet("doors");

            try
            {
                connection.Open();

                // Create query.
                string strSQL = string.Empty;
                strSQL += " select [DoorID], [DoorAreaID], [RoomNumber], [VNUM], [Keywords], [Direction], [DoorType], [KeyVNUM], [CoordX], [CoordY], [CoordZ] ";
                strSQL += " from   [RoomDoors] ";
                strSQL += " where  DoorAreaID = " + DoorAreaID + " ";
                strSQL += "        and RoomNumber = " + RoomNumber + " ";
                strSQL += "        and CoordX = " + CoordX + " ";
                strSQL += "        and CoordY = " + CoordY + " ";
                strSQL += "        and CoordZ = " + CoordZ + " ";

                da = new OleDbDataAdapter(strSQL, connection);
                da.Fill(ds);

                int iRow = 0;
                while (iRow <= ds.Tables[0].Rows.Count - 1)
                {
                    door oDoor = new door();

                    oDoor.doorID = (int)ds.Tables[0].Rows[iRow]["DoorID"];
                    oDoor.areaID = (int)ds.Tables[0].Rows[iRow]["DoorAreaID"];
                    oDoor.roomNumber = (int)ds.Tables[0].Rows[iRow]["RoomNumber"];
                    oDoor.VNUM = (int)ds.Tables[0].Rows[iRow]["VNUM"];
                    oDoor.keywords = (string)ds.Tables[0].Rows[iRow]["Keywords"];
                    oDoor.direction = (string)ds.Tables[0].Rows[iRow]["Direction"];
                    oDoor.doorType = (string)ds.Tables[0].Rows[iRow]["DoorType"];
                    oDoor.keyVNUM = (int)ds.Tables[0].Rows[iRow]["KeyVNUM"]; ;
                    oDoor.coordX = (int)ds.Tables[0].Rows[iRow]["CoordX"]; ;
                    oDoor.coordY = (int)ds.Tables[0].Rows[iRow]["CoordY"]; ;
                    oDoor.coordZ = (int)ds.Tables[0].Rows[iRow]["CoordZ"]; ;

                    doors[iRow] = oDoor;

                    iRow++;
                }
            }
            catch (Exception ex)
            {
                string strError = ex.Message;
            }

            connection.Close();
            connection.Dispose();

            return doors;
        }
Ejemplo n.º 7
0
        // Get the Mirror Door ID of a Door by Direction.
        public static int GetDoorMirrorID(door oDoorMirror, int RoomNumber)
        {
            int iDoorID = 0;

            // Configure database connection elements.
            OleDbDataAdapter da = new OleDbDataAdapter();
            OleDbConnection connection = new OleDbConnection();
            connection.ConnectionString = database.getConnectionString();
            DataSet ds = new DataSet("doors");

            try
            {
                connection.Open();

                // Create query.
                string strSQL = string.Empty;
                strSQL += " select [DoorID], [DoorAreaID], [RoomNumber], [VNUM], [Keywords], [Direction], [DoorType], [KeyVNUM], [CoordX], [CoordY], [CoordZ] ";
                strSQL += " from   [RoomDoors] ";
                strSQL += " where  DoorAreaID = " + oDoorMirror.areaID + " ";
                strSQL += "        and RoomNumber = " + oDoorMirror.roomNumber + " ";
                strSQL += "        and Direction = '" + oDoorMirror.direction + "' ";
                strSQL += "        and CoordX = " + oDoorMirror.coordX + " ";
                strSQL += "        and CoordY = " + oDoorMirror.coordY + " ";
                strSQL += "        and CoordZ = " + oDoorMirror.coordZ + " ";

                da = new OleDbDataAdapter(strSQL, connection);
                da.Fill(ds);

                if (ds.Tables[0].Rows.Count > 0)
                {
                    iDoorID = (int)ds.Tables[0].Rows[0]["DoorID"];
                }
            }
            catch (Exception ex)
            {
                string strError = ex.Message;
            }

            connection.Close();
            connection.Dispose();

            return iDoorID;
        }
Ejemplo n.º 8
0
        // Get the Mirror Door of a Door by Direction.
        public static door GetDoorMirror(door oDoor, int RoomNumber)
        {
            int iModCheck = 0;
            bool blnNorthBorder = false;
            bool blnSouthBorder = false;
            bool blnEastBorder = false;
            bool blnWestBorder = false;

            // Create a new Door Object to hold the Mirror values.
            door oDoorMirror = new door();
            // Start with a copy of the New Door.
            oDoorMirror.doorID = oDoor.doorID;
            oDoorMirror.areaID = oDoor.areaID;
            oDoorMirror.roomNumber = oDoor.roomNumber;
            oDoorMirror.VNUM = oDoor.VNUM;
            oDoorMirror.keywords = oDoor.keywords;
            oDoorMirror.direction = oDoor.direction;
            oDoorMirror.doorType = oDoor.doorType;
            oDoorMirror.keyVNUM = oDoor.keyVNUM;
            oDoorMirror.coordX = oDoor.coordX;
            oDoorMirror.coordY = oDoor.coordY;
            oDoorMirror.coordZ = oDoor.coordZ;

            // Set the Door Mirror new Direction.
            oDoorMirror.direction = GetOppositeDirection(oDoor.direction);

            // Deterine if Room is on the North border of the map.
            iModCheck = (RoomNumber - 1) % 25;
            if (iModCheck == 0)
                blnNorthBorder = true;

            // Deterine if Room is on the South border of the map.
            iModCheck = (RoomNumber) % 25;
            if (iModCheck == 0)
                blnSouthBorder = true;

            // Deterine if Room is on the East border of the map.
            if ((RoomNumber + 25) > 750)
                blnEastBorder = true;

            // Deterine if Room is on the West border of the map.
            if ((RoomNumber - 25) < 0)
                blnWestBorder = true;

            // Determine North Mirror
            if (blnNorthBorder && oDoor.direction.ToLower() == "north")
            {
                oDoorMirror.roomNumber = RoomNumber + 24;
                oDoorMirror.coordY += 1;
            }
            else if (!blnNorthBorder && oDoor.direction.ToLower() == "north")
            {
                oDoorMirror.roomNumber = RoomNumber - 1;
            }

            // Determine South Mirror
            if (blnSouthBorder && oDoor.direction.ToLower() == "south")
            {
                oDoorMirror.roomNumber = RoomNumber - 24;
                oDoorMirror.coordY -= 1;
            }
            else if (!blnSouthBorder && oDoor.direction.ToLower() == "south")
            {
                oDoorMirror.roomNumber = RoomNumber + 1;
            }

            // Determine East Mirror
            if (blnEastBorder && oDoor.direction.ToLower() == "east")
            {
                oDoorMirror.roomNumber = RoomNumber - 725;
                oDoorMirror.coordX += 1;
            }
            else if (!blnEastBorder && oDoor.direction.ToLower() == "east")
            {
                oDoorMirror.roomNumber = RoomNumber + 25;
            }

            // Determine West Mirror
            if (blnWestBorder && oDoor.direction.ToLower() == "west")
            {
                oDoorMirror.roomNumber = RoomNumber + 725;
                oDoorMirror.coordX -= 1;
            }
            else if (!blnWestBorder && oDoor.direction.ToLower() == "west")
            {
                oDoorMirror.roomNumber = RoomNumber - 25;
            }

            // Determine West Mirror
            if (oDoor.direction.ToLower() == "up")
            {
                oDoorMirror.coordZ += 1;
            }

            // Determine West Mirror
            if (oDoor.direction.ToLower() == "down")
            {
                oDoorMirror.coordZ -= 1;
            }

            return oDoorMirror;
        }