コード例 #1
0
ファイル: Mapper.cs プロジェクト: kerchunk/GizMaker
        // Remove the current room.
        public void RemoveRoom(int iAreaID, int iRoomNumber, int iCoordX, int iCoordY, int iCoordZ)
        {
            // Create a Room Object.
            classes.room oRoom = new classes.room();

            // Populate the Room from the Form.
            oRoom.roomAreaID = iAreaID;
            oRoom.roomNumber = iCurrentRoom;
            oRoom.coordX = iCoordX;
            oRoom.coordY = iCoordY;
            oRoom.coordZ = iCoordZ;

            // Delete the room.
            oRoom.RemoveRoom();

            // Refresh Room Count.
            //lblRoomCount.Text = classes.area.GetRoomCountByID(iAreaID).ToString();
        }
コード例 #2
0
ファイル: Mapper.cs プロジェクト: kerchunk/GizMaker
        // 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;
            }
        }
コード例 #3
0
ファイル: Mapper.cs プロジェクト: kerchunk/GizMaker
        // Display Currently Mob Spawns to the current Panel.
        private void HighlightMobSpawns()
        {
            if (lblMobVNUM.Text.Trim() != "")
            {
                // If turning "Spawn Highlight" off, redisplay the panel.
                if (blnHighlightMobs)
                {
                    DisplayPanelRooms(iCurrentArea, iCurrentX, iCurrentY, iCurrentZ);
                }
                else
                {
                    // Display Spawn Rooms for Current Mob.
                    classes.room[] MobSpawns = new classes.room[750];
                    MobSpawns = classes.room.GetRoomsWithMobSpawn(iCurrentArea, iCurrentX, iCurrentY, iCurrentZ, Convert.ToInt32(lblQuickMobID.Text.Trim()));
                    // Loop through Down Rooms and change border colors on map.
                    foreach (classes.room MobSpawn in MobSpawns)
                    {
                        if (MobSpawn != null)
                        {
                            Control[] ctrlSpawn = this.Controls.Find("room" + MobSpawn.roomNumber.ToString(), true);
                            Button btnRoom = new Button();
                            if (btnRoom != null)
                            {
                                btnRoom = (Button)ctrlSpawn[0];
                                btnRoom.BackColor = clrHighlightSpawn;
                            }
                        }
                    }
                }

                // Set the Highlight Mob Toggle;
                if (blnHighlightMobs)
                {
                    btnHighlightSpawns.Text = "Show Spawns";
                    blnHighlightMobs = false;
                }
                else
                {
                    btnHighlightSpawns.Text = "Hide Spawns";
                    blnHighlightMobs = true;
                }
            }
        }
コード例 #4
0
ファイル: Mapper.cs プロジェクト: kerchunk/GizMaker
        // Display all of the saved rooms on a Panel.
        public void DisplayPanelRooms(int iAreaID, int iCoordX, int iCoordY, int iCoordZ)
        {
            classes.room[] rooms = new classes.room[800];
            Button btnRoom = new Button();

            // Get a collection of the rooms on the current panel.
            rooms = classes.room.GetPanelRooms(iAreaID, iCoordX, iCoordY, iCoordZ);

            foreach (classes.room oRoom in rooms)
            {
                if (oRoom != null)
                {
                    // Get the Button at the specified location.
                    Control[] ctrlRoom = this.Controls.Find("room" + oRoom.roomNumber, true);
                    if (btnRoom != null)
                    {
                        btnRoom = (Button)ctrlRoom[0];
                        btnRoom.BackColor = clrCurrent;
                        btnRoom.FlatAppearance.BorderColor = clrBlankBorder;
                    }

                    // Color Exits where appropriate.
                    // ## North ##
                    if (oRoom.hasExitNorth)
                    {
                        // Get the Button at the specified location.
                        Control[] ctrlNorth = this.Controls.Find("vpath" + (oRoom.roomNumber - 1).ToString(), true);
                        Button btnNorth = new Button();
                        if (btnNorth != null)
                        {
                            btnNorth = (Button)ctrlNorth[0];
                            btnNorth.Visible = true;
                            btnNorth.BackColor = Color.Black;
                        }
                    }

                    // ## South ##
                    if (oRoom.hasExitSouth)
                    {
                        // Get the Button at the specified location.
                        Control[] ctrlSouth = this.Controls.Find("vpath" + (oRoom.roomNumber).ToString(), true);
                        Button btnSouth = new Button();
                        if (btnSouth != null)
                        {
                            btnSouth = (Button)ctrlSouth[0];
                            btnSouth.Visible = true;
                            btnSouth.BackColor = Color.Black;
                        }
                    }

                    // ## East ##
                    if (oRoom.hasExitEast)
                    {
                        // Get the Button at the specified location.
                        Control[] ctrlEast = this.Controls.Find("hpath" + (oRoom.roomNumber).ToString(), true);
                        Button btnEast = new Button();
                        if (btnEast != null)
                        {
                            btnEast = (Button)ctrlEast[0];
                            btnEast.Visible = true;
                            btnEast.BackColor = Color.Black;
                        }
                    }

                    // ## West ##
                    if (oRoom.hasExitWest)
                    {
                        // Get the Button at the specified location.
                        Control[] ctrlWest = this.Controls.Find("hpath" + (oRoom.roomNumber - 25).ToString(), true);
                        Button btnWest = new Button();
                        if (btnWest != null)
                        {
                            btnWest = (Button)ctrlWest[0];
                            btnWest.Visible = true;
                            btnWest.BackColor = Color.Black;
                        }
                    }
                }
            }

            // Display Up Rooms.
            classes.room[] RoomsUp = new classes.room[750];
            RoomsUp = classes.room.GetRoomsWithUpExit(iAreaID, iCoordX, iCoordY, iCoordZ);
            // Loop through Up Rooms and change border colors on map.
            foreach (classes.room RoomUp in RoomsUp)
            {
                if (RoomUp != null)
                {
                    Control[] ctrlUp = this.Controls.Find("room" + RoomUp.roomNumber.ToString(), true);
                    Button btnUp = new Button();
                    if (btnUp != null)
                    {
                        btnUp = (Button)ctrlUp[0];
                        btnUp.FlatAppearance.BorderColor = clrUp;
                    }
                }
            }

            // Display Down Rooms.
            classes.room[] RoomsDown = new classes.room[750];
            RoomsDown = classes.room.GetRoomsWithDownExit(iAreaID, iCoordX, iCoordY, iCoordZ);
            // Loop through Down Rooms and change border colors on map.
            foreach (classes.room RoomDown in RoomsDown)
            {
                if (RoomDown != null)
                {
                    Control[] ctrlDown = this.Controls.Find("room" + RoomDown.roomNumber.ToString(), true);
                    Button btnDown = new Button();
                    if (btnDown != null)
                    {
                        btnDown = (Button)ctrlDown[0];
                        btnDown.FlatAppearance.BorderColor = clrDown;
                    }
                }
            }

            // Display Doors.
            classes.door[] doors = new classes.door[250];
            doors = classes.door.GetPanelDoors(iCurrentArea, iCurrentX, iCurrentY, iCurrentZ);
            // Loop through Doors and Display on Panel.
            foreach (classes.door oDoor in doors)
            {
                if (oDoor != null)
                {
                    switch (oDoor.direction.ToLower())
                    {
                        case "north":
                            // Get the Button at the specified location.
                            Control[] ctrlNorth = this.Controls.Find("vpath" + (oDoor.roomNumber - 1).ToString(), true);
                            Button btnNorth = new Button();
                            if (btnNorth != null)
                            {
                                btnNorth = (Button)ctrlNorth[0];
                                btnNorth.Visible = true;
                                if (oDoor.doorType == "Not Pickable")
                                    btnNorth.BackColor = clrDoorLocked;
                                else
                                    btnNorth.BackColor = clrDoorDefault;
                            }
                            break;
                        case "south":
                            // Get the Button at the specified location.
                            Control[] ctrlSouth = this.Controls.Find("vpath" + (oDoor.roomNumber).ToString(), true);
                            Button btnSouth = new Button();
                            if (btnSouth != null)
                            {
                                btnSouth = (Button)ctrlSouth[0];
                                btnSouth.Visible = true;
                                if (oDoor.doorType == "Not Pickable")
                                    btnSouth.BackColor = clrDoorLocked;
                                else
                                    btnSouth.BackColor = clrDoorDefault;
                            }
                            break;
                        case "east":
                            // Get the Button at the specified location.
                            Control[] ctrlEast = this.Controls.Find("hpath" + (oDoor.roomNumber).ToString(), true);
                            Button btnEast = new Button();
                            if (btnEast != null)
                            {
                                btnEast = (Button)ctrlEast[0];
                                btnEast.Visible = true;
                                btnEast.BackColor = clrDoorDefault;
                                if (oDoor.doorType == "Not Pickable")
                                    btnEast.BackColor = clrDoorLocked;
                                else
                                    btnEast.BackColor = clrDoorDefault;
                            }
                            break;
                        case "west":
                            // Get the Button at the specified location.
                            Control[] ctrlWest = this.Controls.Find("hpath" + (oDoor.roomNumber - 25).ToString(), true);
                            Button btnWest = new Button();
                            if (btnWest != null)
                            {
                                btnWest = (Button)ctrlWest[0];
                                btnWest.Visible = true;
                                if (oDoor.doorType == "Not Pickable")
                                    btnWest.BackColor = clrDoorLocked;
                                else
                                    btnWest.BackColor = clrDoorDefault;
                            }
                            break;
                        default:
                            break;
                    }
                }
            }

            //Display Current Room.
            DisplayCurrentRoom(true);
        }
コード例 #5
0
ファイル: Mapper.cs プロジェクト: kerchunk/GizMaker
        // 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();
        }