Ejemplo n.º 1
0
        // Update all listings of current room.
        private void SetCurrentRoom()
        {
            // Populate Room Number in all tabs.
            lblButtonName.Text = iCurrentRoom.ToString();
            lblRoomRoomNumber.Text = iCurrentRoom.ToString();
            lblAttributesRoomNumber.Text = iCurrentRoom.ToString();
            lblMobCurrentRoom.Text = iCurrentRoom.ToString();

            // Populate Mobs Loading in Room.
            PopulateMobsLoadingInRoom();
            // Populate Mobs Not Loading in Room.
            PopulateMobsNotLoadingInRoom();

            // Disable Spawn selection if Room is not part of Map.
            classes.room oRoom = new classes.room();
            oRoom = classes.room.GetRoom(iCurrentArea, iCurrentRoom, iCurrentX, iCurrentY, iCurrentZ);

            // Toggle Panels and allow Add/Edit if Room is part of the Map.
            if (oRoom.Exists())
            {
                // Set Room Details.
                if (oRoom.roomName == "" || oRoom.roomName == null) lblCurrentRoomName.Text = "< Not Set >"; else lblCurrentRoomName.Text = oRoom.roomName;
                if (oRoom.VNUM <= 0) lblVNUM.Text = "< Not Set >"; else lblVNUM.Text = oRoom.VNUM.ToString();
                txtRoomName.Text = oRoom.roomName;
                txtVNUM.Text = oRoom.VNUM.ToString();
                cboSector.SelectedIndex = cboSector.FindString(oRoom.sector);
                txtRoomDescription.Text = oRoom.description;
                txtExtraDescKeywords.Text = oRoom.extraKeywords;
                txtExtraDescription.Text = oRoom.extraDescription;
                txtNorthExit.Text = oRoom.exitNorthDesc;
                txtSouthExit.Text = oRoom.exitSouthDesc;
                txtEastExit.Text = oRoom.exitEastDesc;
                txtWestExit.Text = oRoom.exitWestDesc;
                txtUpExit.Text = oRoom.exitUpDesc;
                txtDownExit.Text = oRoom.exitDownDesc;

                // Enable "Mob Tab" controls.
                cboAllMobs.Enabled = true;
                btnAddSpawn.Enabled = true;
                btnMobDetail.Enabled = true;
                btnRemoveSpawn.Enabled = true;

                // Enable "Door" controls.
                txtDoorKeywords.Enabled = true;
                txtDoorVNUM.Enabled = true;
                cboDirection.Enabled = true;
                cboDoorType.Enabled = true;
                cboDoorKey.Enabled = true;
            }
            else
            {
                // Disable "Mob Tab" controls.
                cboAllMobs.Enabled = false;
                btnAddSpawn.Enabled = false;
                btnMobDetail.Enabled = false;
                btnRemoveSpawn.Enabled = false;

                // Disable "Door" controls.
                txtDoorKeywords.Enabled = false;
                txtDoorVNUM.Enabled = false;
                cboDirection.Enabled = false;
                cboDoorType.Enabled = false;
                cboDoorKey.Enabled = false;
            }

            // Disable Load selection if Mob is not Selected.
            if (lbSpawns.SelectedIndex > -1)
            {
                PopulateObjectsNotLoadingOnMob(Convert.ToInt32(lbSpawns.SelectedValue.ToString()));
                cboAllObjects.Enabled = true;
                btnAddLoad.Enabled = true;
                btnObjDetail.Enabled = true;
                btnRemoveLoad.Enabled = true;
            }
            else
            {
                cboAllObjects.Enabled = false;
                btnAddLoad.Enabled = false;
                btnObjDetail.Enabled = false;
                btnRemoveLoad.Enabled = false;
            }
        }
Ejemplo n.º 2
0
        // Save the current room.
        public void SaveRoom(int iAreaID, int iRoomNumber, int iCoordX, int iCoordY, int iCoordZ, bool HasExitUp, bool HasExitDown)
        {
            if (iRoomNumber > 0)
            {
                // Create a Room Object.
                classes.room oRoom = new classes.room();

                // Populate the Room Object from the form.
                oRoom.roomAreaID = iAreaID;
                oRoom.roomNumber = iCurrentRoom;

                oRoom.roomName = txtRoomName.Text;
                if (txtVNUM.Text != "")
                    oRoom.VNUM = Convert.ToInt32(txtVNUM.Text);
                oRoom.sector = cboSector.Items[cboSector.SelectedIndex].ToString();
                oRoom.description = txtRoomDescription.Text;
                oRoom.extraKeywords = txtExtraDescKeywords.Text;
                oRoom.extraDescription = txtExtraDescription.Text;
                oRoom.exitNorthDesc = txtNorthExit.Text;
                oRoom.exitSouthDesc = txtSouthExit.Text;
                oRoom.exitEastDesc = txtEastExit.Text;
                oRoom.exitWestDesc = txtWestExit.Text;
                oRoom.exitUpDesc = txtUpExit.Text;
                oRoom.exitDownDesc = txtDownExit.Text;
                oRoom.coordX = iCoordX;
                oRoom.coordY = iCoordY;
                oRoom.coordZ = iCoordZ;
                oRoom.hasExitNorth = HasNorthLink(iCurrentRoom);
                oRoom.hasExitSouth = HasSouthLink(iCurrentRoom);
                oRoom.hasExitEast = HasEastLink(iCurrentRoom);
                oRoom.hasExitWest = HasWestLink(iCurrentRoom);
                oRoom.hasExitUp = HasExitUp;
                oRoom.hasExitDown = HasExitDown;

                // Insert or Update the room.
                if (oRoom.Exists())
                {
                    oRoom.UpdateRoom();
                }
                else
                {
                    oRoom.AddRoom();
                }
            }

            // Refresh Room Count.
            //lblRoomCount.Text = classes.area.GetRoomCountByID(iAreaID).ToString();
        }