Ejemplo n.º 1
0
        public roomInfo BuildingIntoRoom(Building thisBuilding)
        {
            roomInfo ThisRoom = new roomInfo();

            ThisRoom.RoomName = thisBuilding.BuildingName;
            ThisRoom.Description = thisBuilding.Description;
            ThisRoom.AltDescription = thisBuilding.AltDescription;
            ThisRoom.CanMove = thisBuilding.CanMove;
            ThisRoom.LockedIn = thisBuilding.LockedIn;
            ThisRoom.SuicideAction = thisBuilding.SuicideAction;
            //ThisRoom.ImagePath = thisBuilding.ImagePath;

            ThisRoom.Events = new List<Event>();
            ThisRoom.Civilians = new List<CivilianProfile>();
            ThisRoom.items = new List<itemInfo>();
            ThisRoom.Enemy = new List<EnemyProfile>();

            DataTypes dt = new DataTypes();

            if (thisBuilding.Events != null) foreach (Event newEvent in thisBuilding.Events) { ThisRoom.Events.Add(dt.CloneEvent(newEvent)); }
            if (thisBuilding.Civilians != null) foreach (CivilianProfile NPC in thisBuilding.Civilians) { ThisRoom.Civilians.Add(dt.CloneNPC(NPC)); }
            if (thisBuilding.items != null) foreach (itemInfo NewItem in thisBuilding.items) { ThisRoom.items.Add(dt.CloneItem(NewItem)); }
            if (thisBuilding.Enemy != null) foreach (EnemyProfile Enemy in thisBuilding.Enemy) { ThisRoom.Enemy.Add(dt.CloneEnemy(Enemy)); }

            return ThisRoom;
        }
Ejemplo n.º 2
0
    private void Test()
    {
        //StartCoroutine(Get(_roomStatusURL + 9, GetRoomStatusHandler));
        roomInfo info = new roomInfo();

        info.roomID    = 217;
        info.userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjQ4LCJpYXQiOjE0OTE5NTkxNDgsImV4cCI6MTQ5MjEzMTk0OH0.8T9sKTGRXFXdwRNs2Cz9ZoCPX7_2tI5jQH0K8-a8Ovs";
        string json = JsonMapper.ToJson(info);

        InitRoom(json);
    }
Ejemplo n.º 3
0
        public roomInfo CloneRoom(roomInfo Room)
        {
            roomInfo NewRoom = new roomInfo();

            NewRoom.Description    = Room.Description;
            NewRoom.AltDescription = Room.AltDescription;
            NewRoom.CanMove        = Room.CanMove;
            NewRoom.LockedIn       = Room.LockedIn;
            NewRoom.SuicideAction  = Room.SuicideAction;
            NewRoom.RoomColour     = Room.RoomColour;
            //NewRoom.ImagePath = Room.ImagePath;

            NewRoom.Building = CloneBuilding(Room.Building);

            NewRoom.Events    = new List <Event>();
            NewRoom.Civilians = new List <CivilianProfile>();
            NewRoom.items     = new List <itemInfo>();
            NewRoom.Enemy     = new List <EnemyProfile>();

            if (Room.Events != null)
            {
                foreach (Event newEvent in Room.Events)
                {
                    NewRoom.Events.Add(CloneEvent(newEvent));
                }
            }
            if (Room.Civilians != null)
            {
                foreach (CivilianProfile NPC in Room.Civilians)
                {
                    NewRoom.Civilians.Add(CloneNPC(NPC));
                }
            }
            if (Room.items != null)
            {
                foreach (itemInfo NewItem in Room.items)
                {
                    NewRoom.items.Add(CloneItem(NewItem));
                }
            }
            if (Room.Enemy != null)
            {
                foreach (EnemyProfile Enemy in Room.Enemy)
                {
                    NewRoom.Enemy.Add(CloneEnemy(Enemy));
                }
            }

            return(NewRoom);
        }
Ejemplo n.º 4
0
        public Building RoomIntoBuilding(roomInfo thisRoom)
        {
            Building thisBuilding = new Building();

            thisBuilding.BuildingName   = thisRoom.RoomName;
            thisBuilding.Description    = thisRoom.Description;
            thisBuilding.AltDescription = thisRoom.AltDescription;
            thisBuilding.CanMove        = thisRoom.CanMove;
            thisBuilding.LockedIn       = thisRoom.LockedIn;
            thisBuilding.SuicideAction  = thisRoom.SuicideAction;
            //thisBuilding.ImagePath = thisRoom.ImagePath;

            thisBuilding.Events    = new List <Event>();
            thisBuilding.Civilians = new List <CivilianProfile>();
            thisBuilding.items     = new List <itemInfo>();
            thisBuilding.Enemy     = new List <EnemyProfile>();

            DataTypes dt = new DataTypes();

            if (thisRoom.Events != null)
            {
                foreach (Event newEvent in thisRoom.Events)
                {
                    thisBuilding.Events.Add(dt.CloneEvent(newEvent));
                }
            }
            if (thisRoom.Civilians != null)
            {
                foreach (CivilianProfile NPC in thisRoom.Civilians)
                {
                    thisBuilding.Civilians.Add(dt.CloneNPC(NPC));
                }
            }
            if (thisRoom.items != null)
            {
                foreach (itemInfo NewItem in thisRoom.items)
                {
                    thisBuilding.items.Add(dt.CloneItem(NewItem));
                }
            }
            if (thisRoom.Enemy != null)
            {
                foreach (EnemyProfile Enemy in thisRoom.Enemy)
                {
                    thisBuilding.Enemy.Add(dt.CloneEnemy(Enemy));
                }
            }

            return(thisBuilding);
        }
Ejemplo n.º 5
0
    public void InitRoom(string json)
    {
        StopAllCoroutines();
        roomInfo info = JsonMapper.ToObject <roomInfo>(json);

        if (info == null)
        {
            Debug.LogError("Json Error!");
            return;
        }
        _roomID    = info.roomID;
        _userToken = info.userToken;
        StartCoroutine(Get(_roomStatusURL + _roomID, GetRoomStatusHandler));
        EventDispatcher.TriggerEvent("InitCapture");
    }
Ejemplo n.º 6
0
    public void Setup(List <MatchInfoSnapshot> matches)
    {
        foreach (MatchInfoSnapshot match in matches)
        {
            GameObject newMatch = (GameObject)Instantiate(roomBtnPrefab, transform);

            roomInfo room = newMatch.GetComponent <roomInfo>();

            room.label.text = match.name;
            room.info       = match;

            newMatch.transform.localScale    = Vector3.one;
            newMatch.transform.localPosition = Vector3.zero;
        }
    }
Ejemplo n.º 7
0
        //takes building and room information from selected values and fills the values from the .csv report into the inventory tab of the main form
        private void pullDataBtn_Click(object sender, EventArgs e)
        {
            f1.addBuildingComBox.SelectedItem = BuildingCB.Text;
            f1.addRoomTB.Text = RoomCB.Text;
            roomInfo exactRoom = new roomInfo();

            foreach (var room in f1.campusData)
            {
                if (room.Building.Equals(BuildingCB.Text) && room.Room.Equals(RoomCB.Text))
                {
                    exactRoom = room;
                    break;
                }
            }
            f1.addContComBox.SelectedItem  = exactRoom.control;
            f1.addAudioComBox.SelectedItem = exactRoom.audio;
            f1.addDockCB.Checked           = exactRoom.dock;
            f1.addDCCB.Checked             = exactRoom.docCam;
            f1.addCamCB.Checked            = exactRoom.camera;
            f1.addMicCB.Checked            = exactRoom.mic;
            f1.addBRCB.Checked             = exactRoom.Bluray;
            f1.addDVDCB.Checked            = exactRoom.DVD;
            f1.addHDMICB.Checked           = exactRoom.hdmi;
            f1.addVGACB.Checked            = exactRoom.vga;
            f1.addAVCB.Checked             = exactRoom.av;
            f1.addSolCB.Checked            = exactRoom.sol;
            f1.addMMTB1.Text     = exactRoom.display1;
            f1.addSerialTB1.Text = exactRoom.serial1;
            f1.addScrTB1.Text    = exactRoom.screen1;
            f1.addIPTB1.Text     = exactRoom.ip1;
            f1.addMACTB1.Text    = exactRoom.mac1;
            f1.addBulbTB1.Text   = exactRoom.bulb1;
            f1.addMMTB2.Text     = exactRoom.display2;
            f1.addSerialTB2.Text = exactRoom.serial2;
            f1.addScrTB2.Text    = exactRoom.screen2;
            f1.addIPTB2.Text     = exactRoom.ip2;
            f1.addMACTB2.Text    = exactRoom.mac2;
            f1.addBulbTB2.Text   = exactRoom.bulb3;
            f1.addMMTB3.Text     = exactRoom.display3;
            f1.addSerialTB3.Text = exactRoom.serial3;
            f1.addScrTB3.Text    = exactRoom.screen3;
            f1.addIPTB3.Text     = exactRoom.ip3;
            f1.addMACTB3.Text    = exactRoom.mac3;
            f1.addBulbTB3.Text   = exactRoom.bulb3;
            f1.addMMTB4.Text     = exactRoom.display4;
            f1.addSerialTB4.Text = exactRoom.serial4;
            f1.addScrTB4.Text    = exactRoom.screen4;
            f1.addIPTB4.Text     = exactRoom.ip4;
            f1.addMACTB4.Text    = exactRoom.mac4;
            f1.addBulbTB4.Text   = exactRoom.bulb4;
            if (exactRoom.filter.ToString("MM/dd/yyyy") != "01/01/0001")
            {
                f1.addFilter.Text = exactRoom.filter.ToString("MM/dd/yyyy");
            }
            else
            {
                f1.addFilter.CustomFormat = " ";
            }
            if (exactRoom.alarm.ToString("MM/dd/yyyy") != "01/01/0001")
            {
                f1.addAlarm.Text = exactRoom.alarm.ToString("MM/dd/yyyy");
            }
            else
            {
                f1.addAlarm.CustomFormat = " ";
            }
            f1.addPCModTB.Text    = exactRoom.PCModel;
            f1.addPCSerialTB.Text = exactRoom.PCSerial;
            f1.addNUCIPTB.Text    = exactRoom.nucip;
            f1.addNUCMACTB.Text   = exactRoom.nucmac;
            f1.addCatVidTB.Text   = exactRoom.Cat6.ToString();
            f1.addNetTB.Text      = exactRoom.NetPorts.ToString();
            if (exactRoom.solDate.ToString("MM/dd/yyyy") != "01/01/0001")
            {
                f1.addSolDate.Text = exactRoom.solDate.ToString("MM/dd/yyyy");
            }
            else
            {
                f1.addSolDate.CustomFormat = " ";
            }
            f1.addOtherTB.Text = exactRoom.other;
            f1.Refresh();
            Close();
        }
Ejemplo n.º 8
0
        public static Building LeaveBuilding(roomInfo thisRoom)
        {
            Building thisBuilding = new Building();

            LoDConsole.WriteLine("Leaving " + thisRoom.RoomName);
            //Thread.Sleep(1000);

            DataTypes dt = new DataTypes();
            thisBuilding = dt.RoomIntoBuilding(thisRoom);
            Player.InBuilding = false;

            return thisBuilding;
        }
Ejemplo n.º 9
0
        public static Event EventAction(Event thisEvent)
        {
            if (thisEvent.Triggered == false)
            {
                thisEvent.Triggered = true;

                if (thisEvent.Action.ToLower() == "unlockroom")   //unlock
                {
                    if (thisEvent.Coodinates != null)
                    {
                        ThisFloor.CurrentFloor[thisEvent.Coodinates[0], thisEvent.Coodinates[1]].CanMove = true;
                    }
                }
                else if (thisEvent.Action.ToLower() == "lockroom")   //lock
                {
                    if (thisEvent.Coodinates != null)
                    {
                        ThisFloor.CurrentFloor[thisEvent.Coodinates[0], thisEvent.Coodinates[1]].CanMove = false;
                    }

                }
                else if (thisEvent.Action.ToLower() == "unlockbuilding")   //unlock
                {
                    if (thisEvent.Coodinates != null)
                    {
                        ThisFloor.CurrentFloor[thisEvent.Coodinates[0], thisEvent.Coodinates[1]].Building.CanMove = true;
                    }
                }
                else if (thisEvent.Action.ToLower() == "lockbuilding")   //lock
                {
                    if (thisEvent.Coodinates != null)
                    {
                        ThisFloor.CurrentFloor[thisEvent.Coodinates[0], thisEvent.Coodinates[1]].Building.CanMove = false;
                    }

                }
                else if (thisEvent.Action.ToLower() == "lockin")
                {
                    if (!CurrentRoom.LockedIn) CurrentRoom.LockedIn = true;
                    else CurrentRoom.LockedIn = false;
                    SaveWorld();
                }
                else if (thisEvent.Action.ToLower() == "kill all enemies") //kill all
                {
                    //do some other things
                    if (CurrentRoom.Enemy != null)
                    {
                        if (CurrentRoom.items == null) CurrentRoom.items = new List<itemInfo>();

                        foreach (EnemyProfile ThisEnemy in CurrentRoom.Enemy)
                        {
                            CurrentRoom.items.Add(ThisEnemy.Weapon);

                            itemInfo newItem = new itemInfo();

                            newItem.Name = string.Concat(ThisEnemy.name, "'s body");
                            newItem.Class = "Object";
                            newItem.Examine = string.Concat("The slashed and torn body of enemy ", ThisEnemy.name);
                            newItem.CanPickUp = false;
                            newItem.InteractionName = new List<string>();
                            newItem.InteractionName.Add("body");
                            newItem.InteractionName.Add("corpse");
                            newItem.InteractionName.Add("enemy");
                            newItem.InteractionName.Add(string.Concat(ThisEnemy.name, "'s body"));
                            newItem.InteractionName.Add(ThisEnemy.name);
                            CurrentRoom.items.Add(newItem);

                            GainXPfromEnemy(ThisEnemy);
                        }
                        EventTrigger("killallenemies");
                        CurrentRoom.Enemy.Clear();   //Overwrite all enemies
                    }
                }
                else if (thisEvent.Action.ToLower() == "remove all npcs") //remove all npcs
                {
                    CurrentRoom.Civilians.Clear();
                    SaveWorld();
                }
                else if (thisEvent.Action.ToLower() == "remove all items") //remove all npcs
                {
                    CurrentRoom.items.Clear();
                    SaveWorld();
                }
                else if (thisEvent.Action.ToLower() == "change description" || thisEvent.Action.ToLower() == "custom description") //change description
                {
                    if (thisEvent.Coodinates[2] != Player.CurrentPos[2]) //If change is not on this floor
                    {
                        Floor TempFloor;
                        TempFloor = world[thisEvent.Coodinates[2]];

                        if (!thisEvent.ApplyToBuilding)
                        {
                            if (thisEvent.Action.ToLower() == "change description") TempFloor.CurrentFloor[thisEvent.Coodinates[0], thisEvent.Coodinates[1]].Description = TempFloor.CurrentFloor[thisEvent.Coodinates[0], thisEvent.Coodinates[1]].AltDescription;
                            else TempFloor.CurrentFloor[thisEvent.Coodinates[0], thisEvent.Coodinates[1]].Description = thisEvent.EventValue;
                        }
                        else if (thisEvent.ApplyToBuilding == true && TempFloor.CurrentFloor[thisEvent.Coodinates[0], thisEvent.Coodinates[1]].Building.BuildingName != null)
                        {
                            roomInfo TempRoom = new roomInfo();
                            DataTypes dt = new DataTypes();
                            TempRoom = dt.BuildingIntoRoom(TempFloor.CurrentFloor[thisEvent.Coodinates[0], thisEvent.Coodinates[1]].Building);
                            if (thisEvent.Action.ToLower() == "change description") TempRoom.Description = TempRoom.AltDescription;
                            else TempRoom.Description = thisEvent.EventValue;
                            TempFloor.CurrentFloor[thisEvent.Coodinates[0], thisEvent.Coodinates[1]].Building = dt.RoomIntoBuilding(TempRoom);
                        }
                        world[thisEvent.Coodinates[2]] = TempFloor;
                    }
                    else if (Player.CurrentPos[0] != thisEvent.Coodinates[0] || Player.CurrentPos[1] != thisEvent.Coodinates[1])    //Change is not in this cell
                    {
                        if (!thisEvent.ApplyToBuilding)
                        {
                            if (thisEvent.Action.ToLower() == "change description") ThisFloor.CurrentFloor[thisEvent.Coodinates[0], thisEvent.Coodinates[1]].Description = ThisFloor.CurrentFloor[thisEvent.Coodinates[0], thisEvent.Coodinates[1]].AltDescription;
                            else ThisFloor.CurrentFloor[thisEvent.Coodinates[0], thisEvent.Coodinates[1]].Description = thisEvent.EventValue;
                        }
                        else if (thisEvent.ApplyToBuilding == true && ThisFloor.CurrentFloor[thisEvent.Coodinates[0], thisEvent.Coodinates[1]].Building.BuildingName != null)
                        {
                            roomInfo TempRoom = new roomInfo();
                            DataTypes dt = new DataTypes();
                            TempRoom = dt.BuildingIntoRoom(ThisFloor.CurrentFloor[thisEvent.Coodinates[0], thisEvent.Coodinates[1]].Building);
                            if (thisEvent.Action.ToLower() == "change description") TempRoom.Description = TempRoom.AltDescription;
                            else TempRoom.Description = thisEvent.EventValue;
                            ThisFloor.CurrentFloor[thisEvent.Coodinates[0], thisEvent.Coodinates[1]].Building = dt.RoomIntoBuilding(TempRoom);
                        }
                    }
                    else
                    {
                        if ((!thisEvent.ApplyToBuilding && !Player.InBuilding) || (thisEvent.ApplyToBuilding && Player.InBuilding))   //Applying to the non-building area the player is in
                        {
                            if (thisEvent.Action.ToLower() == "change description") CurrentRoom.Description = CurrentRoom.AltDescription;
                            else CurrentRoom.Description = thisEvent.EventValue;
                        }
                        else if (!thisEvent.ApplyToBuilding && Player.InBuilding == true)   //Applies to current cell but player is in building
                        {
                            if (thisEvent.Action.ToLower() == "change description") ThisFloor.CurrentFloor[thisEvent.Coodinates[0], thisEvent.Coodinates[1]].Description = ThisFloor.CurrentFloor[thisEvent.Coodinates[0], thisEvent.Coodinates[1]].AltDescription;
                            else ThisFloor.CurrentFloor[thisEvent.Coodinates[0], thisEvent.Coodinates[1]].Description = thisEvent.EventValue;
                        }
                        else if (thisEvent.ApplyToBuilding == true && Player.InBuilding == false)   //Applies to building in current Cell
                        {
                            roomInfo TempRoom = new roomInfo();
                            DataTypes dt = new DataTypes();
                            TempRoom = dt.BuildingIntoRoom(ThisFloor.CurrentFloor[thisEvent.Coodinates[0], thisEvent.Coodinates[1]].Building);
                            if (thisEvent.Action.ToLower() == "change description") TempRoom.Description = TempRoom.AltDescription;
                            else TempRoom.Description = thisEvent.EventValue;
                            ThisFloor.CurrentFloor[thisEvent.Coodinates[0], thisEvent.Coodinates[1]].Building = dt.RoomIntoBuilding(TempRoom);
                        }
                    }
                    SaveWorld();
                    CurrentRoom = GetRoomInfo(Player.CurrentPos);   //retreive new room info
                }
                else if (thisEvent.Action.ToLower() == "change location") //change floor
                {
                    bool newFloor = false;
                    if (thisEvent.Coodinates[2] != Player.CurrentPos[2]) newFloor = true;   //If the player is changing floors

                    //ThisEvent will remain bool untriggered as will allow multiple re-use
                    //Thread.Sleep(5000);
                    world[Player.CurrentPos[2]] = ThisFloor;    //save floor to list.
                    Player.CurrentPos[0] = thisEvent.Coodinates[0];
                    Player.CurrentPos[1] = thisEvent.Coodinates[1];   //set players position to start of new room
                    Player.CurrentPos[2] = thisEvent.Coodinates[2];
                    ThisFloor = world[Player.CurrentPos[2]];    //retreive new floor
                    if (!thisEvent.ApplyToBuilding) Player.InBuilding = false;
                    else Player.InBuilding = true;
                    CurrentRoom = GetRoomInfo(Player.CurrentPos);   //retreive new room info

                    //else if (!string.IsNullOrEmpty(ThisFloor.CurrentFloor[Player.CurrentPos[0], Player.CurrentPos[1]].Building.BuildingName))   //move player into building.
                    //{
                    //    DataTypes dt = new DataTypes();
                    //    CurrentRoom = dt.BuildingIntoRoom(ThisFloor.CurrentFloor[Player.CurrentPos[0],Player.CurrentPos[1]].Building);
                    //}
                    LoDConsole.Clear();    //clear the screen
                    LoDConsole.WriteLine(WordWrap(CurrentRoom.Description));

                    if (newFloor == true && ThisFloor.FloorSong != null && File.Exists(ThisFloor.FloorSong))
                    {
                        MusicPlayer.SoundLocation = ThisFloor.FloorSong;
                        Music("Start");
                    }
                }
                else if (thisEvent.Action.ToLower() == "change objective")
                {
                    Player.Objective = thisEvent.EventValue;
                    LoDConsole.WriteLine("\nYour current objective has changed.");
                }
                /*
                else if (thisEvent.Action.ToLower() == "custom description")
                {
                    CurrentRoom.Description = thisEvent.EventValue;
                    SaveWorld();
                }
                */
                else if (thisEvent.Action.ToLower() == "output text")
                {
                    LoDConsole.WriteLine("");
                    LoDConsole.WriteLine(WordWrap(thisEvent.EventValue));
                }
                else if (thisEvent.Action == "spawnItems")
                {
                    if (CurrentRoom.items == null) CurrentRoom.items = new List<itemInfo>();
                    foreach (itemInfo Item in thisEvent.Items)
                    {
                        CurrentRoom.items.Add(Item);
                    }
                    SaveWorld();
                }
                else if (thisEvent.Action == "spawnNPC")
                {
                    if (CurrentRoom.Civilians == null) CurrentRoom.Civilians = new List<CivilianProfile>();
                    foreach (CivilianProfile NPC in thisEvent.NPCs)
                    {
                        CurrentRoom.Civilians.Add(NPC);
                    }
                    SaveWorld();
                }
                else if (thisEvent.Action == "spawnEnemy")
                {
                    if (CurrentRoom.Enemy == null) CurrentRoom.Enemy = new List<EnemyProfile>();
                    foreach (EnemyProfile Enemy in thisEvent.Enemies)
                    {
                        CurrentRoom.Enemy.Add(Enemy);
                    }
                    SaveWorld();
                }
                else if (thisEvent.Action == "giveXP")
                {
                    int n;
                    if (int.TryParse(thisEvent.EventValue, out n)) Player.XP = Player.XP + n;
                }
                else if (thisEvent.Action == "EndCredits")
                {
                    Console.ReadKey();
                    EndCredits();
                }
                else thisEvent.Triggered = false;

                //If an event is re-usable allow it to be triggered again
                if (thisEvent.Triggered == true && thisEvent.ReUsable == true) thisEvent.Triggered = false;
                if (thisEvent.Coodinates != null && thisEvent.Coodinates[0] == Player.CurrentPos[0] && thisEvent.Coodinates[1] == Player.CurrentPos[1] && thisEvent.Coodinates[2] == Player.CurrentPos[2])
                    CurrentRoom = GetRoomInfo(Player.CurrentPos);
            }
            return thisEvent;
        }
Ejemplo n.º 10
0
        public roomInfo CloneRoom(roomInfo Room)
        {
            roomInfo NewRoom = new roomInfo();

            NewRoom.Description = Room.Description;
            NewRoom.AltDescription = Room.AltDescription;
            NewRoom.CanMove = Room.CanMove;
            NewRoom.LockedIn = Room.LockedIn;
            NewRoom.SuicideAction = Room.SuicideAction;
            NewRoom.RoomColour = Room.RoomColour;
            //NewRoom.ImagePath = Room.ImagePath;

            NewRoom.Building = CloneBuilding(Room.Building);

            NewRoom.Events = new List<Event>();
            NewRoom.Civilians = new List<CivilianProfile>();
            NewRoom.items = new List<itemInfo>();
            NewRoom.Enemy = new List<EnemyProfile>();

            if (Room.Events != null) foreach (Event newEvent in Room.Events) { NewRoom.Events.Add(CloneEvent(newEvent)); }
            if (Room.Civilians != null) foreach (CivilianProfile NPC in Room.Civilians) { NewRoom.Civilians.Add(CloneNPC(NPC)); }
            if (Room.items != null) foreach (itemInfo NewItem in Room.items) { NewRoom.items.Add(CloneItem(NewItem)); }
            if (Room.Enemy != null) foreach (EnemyProfile Enemy in Room.Enemy) { NewRoom.Enemy.Add(CloneEnemy(Enemy)); }

            return NewRoom;
        }
Ejemplo n.º 11
0
 public static void EndCredits()
 {
     LoDConsole.Clear();
     int Linebreaks = 20;
     int Counter = 0;
     int StartLine = 0;
     int i;
     List<string> Credits = new List<string>();
     Credits.Add("Game Developed by Joe van de Bilt");
     if (WorldState.WorldAuthor != null) Credits.Add("World Designed by " + WorldState.WorldAuthor);
     if (WorldState.Credits != null) foreach (string Credit in WorldState.Credits) { Credits.Add(Credit); }
     while (Counter < (Credits.Count + 20))
     {
         for (i = 0; i < Linebreaks; i++) { LoDConsole.WriteLine(); }
         for (i = StartLine; i <= Counter; i++)
         {
             if (i >= Credits.Count) LoDConsole.WriteLine();
             else LoDConsole.WriteLine("\t\t" + Credits[i] + "\n\n");
         }
         Counter = Counter + 1;
         Linebreaks = Linebreaks - 1;
         if (Linebreaks <= 0) StartLine++;
         //Thread.Sleep(1000);
         LoDConsole.Clear();
     }
     LoDConsole.Clear();
     LoDConsole.WriteLine("\n\n\n\t\tThank you for Playing");
     Console.ReadKey();
     //Run the main menu screen
     DrawMainMenu();
     ThisFloor = world[Player.CurrentPos[2]];
     CurrentRoom = ThisFloor.CurrentFloor[Player.CurrentPos[0], Player.CurrentPos[1]];
     LoDConsole.WriteLine(WordWrap(CurrentRoom.Description));
 }
Ejemplo n.º 12
0
        public static void EnterCommand(string PlayerCommand)
        {
            //Take in a player command
            //LoDConsole.Write(">");
            //PlayerCommand = Console.ReadLine();
            PlayerCommand = CleanPlayerInput(PlayerCommand);    //Clean the input of unusual characters

            if (!ClearConsole) LoDConsole.WriteLine("");
            else LoDConsole.Clear();

            try
            {
                #region Help
                if (PlayerCommand.ToLower() == "help" || PlayerCommand.ToLower() == "commands" || PlayerCommand.ToLower().Contains("how do i") || PlayerCommand.ToLower().Contains("how can i"))
                {
                    using (StreamReader file = new System.IO.StreamReader(@".\System Files\GameEngineHelp.sys", true))
                    {
                        LoDConsole.WriteLine(WordWrap(file.ReadToEnd()));
                    }
                }
                #endregion

                #region Movement
                else if (
                            (PlayerCommand.ToLower().Split(' ')[0] == "go" && PlayerCommand.ToLower().Split(' ')[1] != "into") ||
                            PlayerCommand.ToLower().Split(' ')[0] == "move" ||
                            PlayerCommand.ToLower().Split(' ')[0] == "travel" ||
                            PlayerCommand.ToLower() == "north" ||
                            PlayerCommand.ToLower() == "east" ||
                            PlayerCommand.ToLower() == "south" ||
                            PlayerCommand.ToLower() == "west"
                        )
                {
                    if (!CurrentRoom.LockedIn)
                    {
                        int[] ProposedMove = new int[3];
                        ProposedMove[0] = Player.CurrentPos[0];
                        ProposedMove[1] = Player.CurrentPos[1];
                        ProposedMove[2] = Player.CurrentPos[2];
                        string Direction = string.Empty;
                        if (PlayerCommand.ToLower().Split(' ')[0] == "go" || PlayerCommand.ToLower().Split(' ')[0] == "move" || PlayerCommand.ToLower().Split(' ')[0] == "travel") Direction = PlayerCommand.ToLower().Split(' ')[1];
                        else Direction = PlayerCommand.ToLower();

                        switch (Direction)
                        {
                            case "north": ProposedMove[0] = ProposedMove[0] - 1; break;
                            case "east": ProposedMove[1] = ProposedMove[1] + 1; break;
                            case "south": ProposedMove[0] = ProposedMove[0] + 1; break;
                            case "west": ProposedMove[1] = ProposedMove[1] - 1; break;
                            default: ProposedMove = Player.CurrentPos; break;
                        }

                        ThisFloor.CurrentFloor[ProposedMove[0], ProposedMove[1]].Explored = true;
                        PotentialRoom = GetRoomInfo(ProposedMove);
                        if (PotentialRoom.CanMove == true)
                        {
                            if (PotentialRoom.Description == null || PotentialRoom.Description == string.Empty) LoDConsole.WriteLine(WordWrap("I Successfully move into Row ") + Char.ConvertFromUtf32(ProposedMove[0] + 65) + " Col " + (ProposedMove[1] + 1) + " Level " + (ProposedMove[2] + 1));
                            else LoDConsole.WriteLine(WordWrap(PotentialRoom.Description));
                            ThisFloor.CurrentFloor[Player.CurrentPos[0], Player.CurrentPos[1]] = CurrentRoom;
                            CurrentRoom = PotentialRoom;
                            Player.CurrentPos = ProposedMove;
                            EventTrigger("moveinto");
                        }
                        else if (PotentialRoom.Description == null || PotentialRoom.Description == string.Empty) LoDConsole.WriteLine(WordWrap("Looks like I can't go that way."));
                        else LoDConsole.WriteLine(WordWrap(PotentialRoom.Description));
                    }
                    else
                    {
                        LoDConsole.WriteLine("You cannot leave the current area");
                        if (CurrentRoom.Enemy != null) attacked();
                    }
                }
                #endregion

                #region Buildings
                else if ((PlayerCommand.ToLower().Split(' ')[0] == "go" && PlayerCommand.ToLower().Split(' ')[1] == "into") || PlayerCommand.ToLower().Split(' ')[0] == "enter")
                {
                    if (!Player.InBuilding)
                    {
                        if (CurrentRoom.Building.BuildingName != null)
                        {
                            if (!CurrentRoom.LockedIn)
                            {
                                string target = string.Empty;
                                if (PlayerCommand.ToLower().Split(' ')[0] == "go" && PlayerCommand.ToLower().Split(' ')[1] == "into")
                                {
                                    for (int i = 2; i < PlayerCommand.Split(' ').Length; i++)
                                    {
                                        target = target + " " + PlayerCommand.Split(' ')[i];
                                    }
                                }
                                else if (PlayerCommand.ToLower().Split(' ')[0] == "enter")
                                {
                                    for (int i = 1; i < PlayerCommand.Split(' ').Length; i++)
                                    {
                                        target = target + " " + PlayerCommand.Split(' ')[i];
                                    }
                                }
                                target = target.Trim();

                                if (target != string.Empty && target.ToLower() == CurrentRoom.Building.BuildingName.ToLower())
                                {
                                    if (CurrentRoom.Building.CanMove == true)
                                    {
                                        SaveWorld();
                                        CurrentRoom = GoIntoBuilding(CurrentRoom.Building);
                                        LoDConsole.WriteLine(WordWrap(CurrentRoom.Description));
                                        EventTrigger("moveinto");
                                    }
                                    else LoDConsole.WriteLine(WordWrap(target + " is locked."));
                                }
                                else if (target != CurrentRoom.Building.BuildingName) LoDConsole.WriteLine(target + " is not something you can enter.");
                                else LoDConsole.WriteLine("Go into where?");
                            }
                            else
                            {
                                LoDConsole.WriteLine("You cannot leave the current area");
                                if (CurrentRoom.Enemy != null) attacked();
                            }
                        }
                        else LoDConsole.WriteLine("There is no building here to enter");
                    }
                    else LoDConsole.WriteLine("You are Already inside a building");
                }
                else if (PlayerCommand.ToLower().Split(' ')[0] == "leave")
                {
                    if (Player.InBuilding == true)
                    {
                        if (!CurrentRoom.LockedIn)
                        {
                            ThisFloor.CurrentFloor[Player.CurrentPos[0], Player.CurrentPos[1]].Building = LeaveBuilding(CurrentRoom);
                            CurrentRoom = GetRoomInfo(Player.CurrentPos);
                            LoDConsole.WriteLine(WordWrap(CurrentRoom.Description));
                            EventTrigger("moveinto");
                        }
                        else
                        {
                            LoDConsole.WriteLine("You cannot leave the current area");
                            if (CurrentRoom.Enemy != null) attacked();
                        }
                    }
                    else LoDConsole.WriteLine(WordWrap("You are not currently inside a building"));
                }
                #endregion

                #region Descriptions
                else if (CommandContains(PlayerCommand, "who am i") || CommandContains(PlayerCommand, "whoami"))
                {
                    LoDConsole.WriteLine(WordWrap(string.Concat("Your name is ", Player.name)));
                }
                else if (CommandContains(PlayerCommand, "status"))
                {
                    PlayerStatus();
                }
                else if (CommandContains(PlayerCommand, "describe"))
                {
                    LoDConsole.WriteLine(WordWrap(CurrentRoom.Description));
                }
                else if (CommandContains(PlayerCommand, "objective"))
                {
                    LoDConsole.WriteLine(WordWrap(string.Concat("Your Current Objective is: ", Player.Objective)));
                }
                else if (CommandContains(PlayerCommand, "money"))
                {
                    LoDConsole.WriteLine("You currently have {0} gold coins", Player.Money.ToString());
                }
                #endregion

                #region Read
                else if (CommandContains(PlayerCommand, "read"))
                {
                    if (CurrentRoom.items != null || Player.inventory.Count != 0)
                    {
                        string target = string.Empty;
                        if (PlayerCommand.ToLower().Split(' ').Length != 1)
                        {
                            for (int i = 1; i < PlayerCommand.ToLower().Split(' ').Length; i++)
                            {
                                target = target + PlayerCommand.ToLower().Split(' ')[i];
                            }
                        }
                        else
                        {
                            target = LoDConsole.ReadLine("What do you want to read?","Read",string.Empty);
                        }
                        LoDConsole.WriteLine(WordWrap(ReadItem(target.Trim())));
                    }
                    else LoDConsole.WriteLine("There is nothing to read");
                }
                #endregion

                #region Inventory
                else if (CommandContains(PlayerCommand, "inventory"))
                {
                    if (Player.inventory.Count != 0)
                    {
                        LoDConsole.WriteLine(WordWrap(string.Concat("You are currently using ", (Player.MaxItems - Player.invspace), "/", Player.MaxItems, " of your inventory\n")));
                        int index = 1;
                        foreach (itemInfo Item in Player.inventory)
                        {
                            LoDConsole.WriteLine(WordWrap(string.Concat(index, ": ", Item.Name)));
                            index++;
                        }
                        LoDConsole.WriteLine("");
                    }
                    else LoDConsole.WriteLine("Your inventory is empty");
                }
                #endregion

                #region Ask
                else if (CommandContains(PlayerCommand, "ask about"))
                {
                    string Target = string.Empty;
                    string Topic = string.Empty;
                    bool topicstart = false;

                    if (PlayerCommand.ToLower().Contains("about"))
                    {
                        for (int i = 1; i < PlayerCommand.Split(' ').Length; i++)
                        {
                            if (PlayerCommand.Split(' ')[i].ToLower() == "about")
                            {
                                topicstart = true;
                            }
                            else if (topicstart == false)
                            {
                                Target = Target + " " + PlayerCommand.Split(' ')[i];
                            }
                            else if (topicstart == true)
                            {
                                Topic = Topic + " " + PlayerCommand.Split(' ')[i];
                            }
                        }
                        AskQuestion(Target.Trim(), Topic.Trim());
                    }
                    else LoDConsole.WriteLine(WordWrap("Ask who about what?"));
                }
                #endregion

                #region Take Item
                else if (CommandContains(PlayerCommand, "take") || CommandContains(PlayerCommand, "pick") || CommandContains(PlayerCommand, "get"))
                {
                    string ObjectName = string.Empty;
                    if (Player.invspace > 0)
                    {
                        if (PlayerCommand.ToLower() == "take" || PlayerCommand.ToLower() == "pick" || PlayerCommand.ToLower() == "pick up" || PlayerCommand.ToLower() == "get")
                        {
                            LoDConsole.Write("What do you want to pick up?: ");
                            ObjectName = LoDConsole.ReadLine("What do you want to pick up?", "Pick Up", string.Empty);
                        }
                        else
                        {
                            string[] strArray = PlayerCommand.Split(' ');
                            int index = 2;
                            if (strArray[0].ToLower() == "take" || strArray[0].ToLower() == "get")
                            {
                                index = 2;
                                ObjectName = strArray[1];
                            }
                            else if (strArray[0] == "pick" && strArray[1] == "up")
                            {
                                index = 3;
                                ObjectName = strArray[2];
                            }

                            while (index < strArray.Length)
                            {
                                ObjectName = string.Concat(ObjectName, " ", strArray[index]);
                                index++;
                                //LoDConsole.WriteLine(WordWrap("item is {0}", item);
                            }
                            ObjectName = ObjectName.Trim();
                        }
                        TakeItem(ObjectName);
                    }
                    else LoDConsole.WriteLine("There is no space in your inventory to pick anything up");
                }
                #endregion

                #region DropItem
                else if (CommandContains(PlayerCommand, "drop"))
                {
                    if (Player.inventory.Count != 0)
                    {
                        string ObjectName = string.Empty;

                        if (PlayerCommand.ToLower() == "drop")
                        {
                            int index = 1;
                            foreach (itemInfo Item in Player.inventory)
                            {
                                LoDConsole.WriteLine(WordWrap(string.Concat(index, ": ", Item.Name)));
                                index++;
                            }

                            ObjectName = LoDConsole.ReadLine("Which item do you wish to drop", "Drop Item", string.Empty);
                        }
                        else
                        {
                            string[] strArray = PlayerCommand.Split(' ');
                            ObjectName = strArray[1];

                            int index = 2;
                            while (index < strArray.Length)
                            {
                                ObjectName = string.Concat(ObjectName, " ", strArray[index]);
                                index++;
                                //LoDConsole.WriteLine(WordWrap("item is {0}", item);
                            }

                            ObjectName = ObjectName.Trim();

                        }
                        LoDConsole.WriteLine(WordWrap(DropItem(ObjectName)));

                    }
                    else
                        LoDConsole.WriteLine(WordWrap("There are no items in your inventory"));
                }
                #endregion

                #region Look At Item
                else if (CommandContains(PlayerCommand, "look at"))
                {
                    string ObjectName = string.Empty;

                    if (PlayerCommand.ToLower() == "look at")
                    {
                        ObjectName = LoDConsole.ReadLine("What do you want to look at?", "Look At", string.Empty);
                    }
                    else
                    {
                        string[] strArray = PlayerCommand.Split(' ');
                        ObjectName = strArray[2];

                        int index = 3;
                        while (index < strArray.Length)
                        {
                            ObjectName = string.Concat(ObjectName, " ", strArray[index]);
                            index++;
                            //LoDConsole.WriteLine(WordWrap("item is {0}", item);
                        }

                        ObjectName = ObjectName.Trim();
                    }

                    LoDConsole.WriteLine(WordWrap(LookAtItem(ObjectName)));
                }
                #endregion

                #region Examine Item
                else if (CommandContains(PlayerCommand, "examine") || CommandContains(PlayerCommand, "inspect"))
                {
                    if (Player.inventory.Count != 0)
                    {
                        string ObjectName = string.Empty;

                        if (PlayerCommand.ToLower() == "examine" || PlayerCommand.ToLower() == "inspect")
                        {
                            int index = 1;
                            foreach (itemInfo Item in Player.inventory)
                            {
                                LoDConsole.WriteLine(WordWrap("{0}: {1}"), index.ToString(), Item.Name);
                                index++;
                            }
                            ObjectName = LoDConsole.ReadLine("What item do you want to examine?", "Examine", string.Empty);
                        }
                        else
                        {
                            string[] strArray = PlayerCommand.Split(' ');
                            ObjectName = strArray[1];

                            int index = 2;
                            while (index < strArray.Length)
                            {
                                ObjectName = string.Concat(ObjectName, " ", strArray[index]);
                                index++;
                                //LoDConsole.WriteLine(WordWrap("item is {0}", item);
                            }

                            ObjectName = ObjectName.Trim();

                        }
                        ExamineItem(ObjectName);
                    }
                    else
                        LoDConsole.WriteLine(WordWrap("There are no items in your inventory"));
                }
                #endregion

                #region Use Item
                else if (CommandContains(PlayerCommand, "use") || CommandContains(PlayerCommand, "put"))
                {
                    int index = 0;
                    string item = string.Empty;
                    string target = string.Empty;

                    if (CurrentRoom.items != null)
                    {

                        if (PlayerCommand.ToLower() == "use" || PlayerCommand.ToLower() == "put")
                        {
                            item = LoDConsole.ReadLine("What item do you want to " + PlayerCommand.ToLower().Split(' ')[0] + "?", PlayerCommand.ToLower().Split(' ')[0], string.Empty);
                            target = LoDConsole.ReadLine("What do you want to " + PlayerCommand.ToLower().Split(' ')[0] + " " + item + " on?", "Target", string.Empty);
                        }
                        else if (CurrentRoom.items != null)
                        {
                            item = PlayerCommand.Split(' ')[1];
                            bool itemFound = false;
                            bool targetFound = false;
                            index = 2;

                            while (index < (PlayerCommand.Split(' ').Length))
                            {
                                if (PlayerCommand.Split(' ')[index].ToLower() == "on" || PlayerCommand.Split(' ')[index].ToLower() == "in")
                                {
                                    itemFound = true;
                                    index++;
                                    target = PlayerCommand.Split(' ')[index].ToLower();
                                    targetFound = true;
                                }
                                else if (itemFound == false)
                                {
                                    item = string.Concat(item, " ", PlayerCommand.Split(' ')[index].ToLower());
                                }
                                else
                                {
                                    target = string.Concat(target, " ", PlayerCommand.Split(' ')[index].ToLower());
                                }
                                index++;
                            }

                            if (targetFound == false)
                            {
                                LoDConsole.WriteLine("Objects in the room:\n");

                                for (index = 0; index < CurrentRoom.items.Count; index++)
                                {
                                    //if (CurrentRoom.items[index].Class == "Interaction Object") LoDConsole.WriteLine(string.Concat(CurrentRoom.items[index].Name));
                                    LoDConsole.WriteLine(string.Concat(CurrentRoom.items[index].Name));

                                }
                                target = LoDConsole.ReadLine("What do you want to use " + item + " on?", "Target", string.Empty);
                            }
                        }
                        UseItem(item, target);
                    }
                    else
                    {
                        LoDConsole.WriteLine("There is nothing in the room to interact with");
                    }

                }
                #endregion

                #region View Wares
                else if (CommandContains(PlayerCommand, "view wares"))
                {
                    int index;
                    string VendorName;

                    if (CurrentRoom.Civilians != null)
                    {
                        if (PlayerCommand.ToLower().Split(' ').Length > 2)
                        {
                            string[] strArray = PlayerCommand.Split(' ');
                            VendorName = strArray[2];

                            index = 3;
                            while (index < strArray.Length)
                            {
                                VendorName = string.Concat(VendorName, " ", strArray[index]);
                                index++;
                                //LoDConsole.WriteLine(WordWrap("item is {0}", item);
                            }

                            VendorName = VendorName.Trim();
                        }
                        else
                        {
                            LoDConsole.WriteLine("Civilians in the room:\n");

                            for (index = 0; index < CurrentRoom.Civilians.Count; index++)
                            {
                                if (CurrentRoom.Civilians[index].willSell == true) LoDConsole.WriteLine(string.Concat(CurrentRoom.Civilians[index].name, " - ", CurrentRoom.Civilians[index].MerchantType));

                            }
                            VendorName = LoDConsole.ReadLine("Who do you want to view the inventory of?", "View Wares", string.Empty);
                        }

                        bool vendorFound = false;
                        index = 0;

                        while (vendorFound == false && CurrentRoom.Civilians != null && index < CurrentRoom.Civilians.Count)
                        {
                            if (VendorName.ToLower() == CurrentRoom.Civilians[index].name.ToLower())
                            {
                                if (CurrentRoom.Civilians[index].willSell == true)
                                {
                                    vendorFound = true;
                                    LoDConsole.WriteLine();
                                    LoDConsole.WriteLine("Item\t\t\tClass\t\t\tPrice");
                                    for (int Count = 0; Count < CurrentRoom.Civilians[index].inventory.Count; Count++)
                                    {
                                        if (CurrentRoom.Civilians[index].inventory[Count].Name == null) LoDConsole.Write("null\t\t");
                                        if (CurrentRoom.Civilians[index].inventory[Count].Name.Length < 8) LoDConsole.Write("{0}\t\t", CurrentRoom.Civilians[index].inventory[Count].Name);
                                        else if (CurrentRoom.Civilians[index].inventory[Count].Name.Length <= 15) LoDConsole.Write("{0}\t", CurrentRoom.Civilians[index].inventory[Count].Name);
                                        else LoDConsole.Write(CurrentRoom.Civilians[index].inventory[Count].Name);

                                        if (CurrentRoom.Civilians[index].inventory[Count].Class == null) LoDConsole.Write("null\t\t\t");
                                        else if (CurrentRoom.Civilians[index].inventory[Count].Class.Length < 8) LoDConsole.Write("{0}\t\t\t", CurrentRoom.Civilians[index].inventory[Count].Class);
                                        else if (CurrentRoom.Civilians[index].inventory[Count].Class.Length <= 15) LoDConsole.Write("{0}\t\t", CurrentRoom.Civilians[index].inventory[Count].Class);
                                        else if (CurrentRoom.Civilians[index].inventory[Count].Class.Length <= 21) LoDConsole.Write("{0}\t", CurrentRoom.Civilians[index].inventory[Count].Class);
                                        else LoDConsole.Write(CurrentRoom.Civilians[index].inventory[Count].Class);

                                        if (CurrentRoom.Civilians[index].inventory[Count].Value != 0) LoDConsole.Write("\t{0}\n", CurrentRoom.Civilians[index].inventory[Count].Value.ToString());
                                        else LoDConsole.Write("\tnull\n");
                                        //LoDConsole.WriteLine(WordWrap(string.Concat(CurrentRoom.Civilians[index].inventory[Count].Name, "\t", CurrentRoom.Civilians[index].inventory[Count].Class, "\t",CurrentRoom.Civilians[index].inventory[Count].Value)));
                                    }
                                }
                                else LoDConsole.WriteLine(WordWrap(string.Concat(CurrentRoom.Civilians[index].name, " is not willing to sell you anything")));
                            }
                            index++;
                        }
                        if (!vendorFound) LoDConsole.WriteLine(VendorName + " is either not here or not a merchant");
                    }
                    else LoDConsole.WriteLine("There is nobody currently selling anything in this area");

                }
                #endregion

                #region Bribe
                else if (CommandContains(PlayerCommand, "bribe"))
                {
                    int index;
                    string WhoToBribe = string.Empty;
                    int BribeAmount = 0;
                    bool dontrun = false;

                    if (CurrentRoom.Enemy != null || CurrentRoom.Civilians != null)
                    {
                        if (PlayerCommand.ToLower() == "bribe")
                        {
                            LoDConsole.WriteLine("People in the room who may accept a bribe:\n");
                            if (CurrentRoom.Enemy != null)
                            {
                                 for (index = 0; index < CurrentRoom.Enemy.Count; index++)
                                {
                                    LoDConsole.WriteLine(CurrentRoom.Enemy[index].name);
                                }
                            }

                            if (CurrentRoom.Civilians != null)
                            {
                                for (index = 0; index < CurrentRoom.Civilians.Count; index++)
                                {
                                    LoDConsole.WriteLine(CurrentRoom.Civilians[index].name);
                                }
                            }
                            WhoToBribe = LoDConsole.ReadLine("Who do you want to bribe?", "Bribe", string.Empty);
                            Int32.TryParse(LoDConsole.ReadLine("How much do you want to give them?","Bribe Amount","0"), out BribeAmount);
                            if (BribeAmount == 0)
                            {
                                dontrun = true;
                                LoDConsole.WriteLine("You cannot bribe somebody with that amount");
                            }
                        }
                        else if (PlayerCommand.Split(' ')[0].ToLower() == "bribe")
                        {
                            WhoToBribe = PlayerCommand.Split(' ')[1];
                            int i = 2;
                            int n;
                            bool AmountFound = false;
                            while (AmountFound == false && i < PlayerCommand.Split(' ').Length)
                            {
                                if (Int32.TryParse(PlayerCommand.Split(' ')[i], out n))
                                {
                                    BribeAmount = n;
                                    AmountFound = true;
                                }
                                else WhoToBribe = string.Concat(WhoToBribe, " ", PlayerCommand.Split(' ')[i]);
                                i++;
                            }
                            if (AmountFound == false)
                            {
                                Int32.TryParse(LoDConsole.ReadLine("How much do you want to give to " + WhoToBribe + "?", "Bribe Amount", "0"), out BribeAmount);
                            }
                            if (BribeAmount == 0)
                            {
                                dontrun = true;
                                LoDConsole.WriteLine("You cannot bribe somebody with that amount");
                            }
                        }
                        else
                        {
                            dontrun = true;
                            LoDConsole.WriteLine(WordWrap("I can't quite work out how many things you just said, try again"));
                        }

                        if (dontrun == false)
                        {
                            if (isEnemy(WhoToBribe)) PayOff(WhoToBribe, BribeAmount);
                            else if (isNPC(WhoToBribe)) GiveItem(BribeAmount + " gold", WhoToBribe);
                            else LoDConsole.WriteLine("That person does not appear to be here...");
                        }

                    }
                    else LoDConsole.WriteLine(WordWrap("There are no people in the room to bribe"));
                }
                #endregion

                #region Buy Item
                else if (CommandContains(PlayerCommand, "buy"))
                {
                    int index;
                    string vendor = string.Empty;
                    string ItemName = string.Empty;

                    if (Player.invspace > 0)
                    {
                        if (CurrentRoom.Civilians != null)
                        {
                            if (PlayerCommand.ToLower() == "buy")
                            {
                                ItemName = LoDConsole.ReadLine("What item do you want to buy?", "Buy Item", string.Empty);

                                //player didn't specify item or person
                                LoDConsole.WriteLine("Civilians in the room:\n");

                                for (index = 0; index < CurrentRoom.Civilians.Count; index++)
                                {
                                    if (CurrentRoom.Civilians[index].willSell == true) LoDConsole.WriteLine(string.Concat(CurrentRoom.Civilians[index].name, " - ", CurrentRoom.Civilians[index].MerchantType));

                                }
                                vendor = ItemName = LoDConsole.ReadLine("Who do you want to buy from?", "Merchants", string.Empty);

                            }
                            else if (PlayerCommand.Split(' ').Length >= 2)
                            {
                                //ItemName = PlayerCommand.Split(' ')[1].ToLower();
                                ItemName = PlayerCommand.Split(' ')[1].ToLower();
                                bool itemFound = false;
                                bool vendorFound = false;
                                index = 2;

                                while (index < (PlayerCommand.Split(' ').Length))
                                {
                                    if (PlayerCommand.Split(' ')[index].ToLower() == "from")
                                    {
                                        itemFound = true;
                                        index++;
                                        vendor = PlayerCommand.Split(' ')[index].ToLower();
                                        vendorFound = true;
                                    }
                                    else if (itemFound == false)
                                    {
                                        ItemName = string.Concat(ItemName, " ", PlayerCommand.Split(' ')[index].ToLower());
                                    }
                                    else
                                    {
                                        vendor = string.Concat(vendor, " ", PlayerCommand.Split(' ')[index].ToLower());
                                    }
                                    index++;
                                }

                                if (vendorFound == false)
                                {
                                    LoDConsole.WriteLine("Civilians in the room:\n");

                                    for (index = 0; index < CurrentRoom.Civilians.Count; index++)
                                    {
                                        if (CurrentRoom.Civilians[index].willSell == true) LoDConsole.WriteLine(string.Concat(CurrentRoom.Civilians[index].name, " - ", CurrentRoom.Civilians[index].MerchantType));

                                    }
                                    vendor = LoDConsole.ReadLine("Who do you want to buy " + ItemName + " from?", "Merchants", string.Empty);
                                }

                            }
                            BuyItem(ItemName, vendor);
                        }
                        else LoDConsole.WriteLine("There is nobody willing to buy anything from you here");
                    }
                    else LoDConsole.WriteLine("There is no space in your inventory to buy anything.");
                }
                #endregion

                #region Sell Item
                else if (CommandContains(PlayerCommand, "sell"))
                {
                    int index;
                    string vendor = string.Empty;
                    string ItemName = string.Empty;
                    itemInfo ItemToSell = new itemInfo();

                    if (CurrentRoom.Civilians != null)
                    {
                        if (PlayerCommand.ToLower() == "sell")
                        {
                            LoDConsole.Write(" ");
                            ItemName = LoDConsole.ReadLine("What item do you want to sell?", "Sell Item", string.Empty);

                            index = 0;
                            bool itemfound = false;

                            while (itemfound == false && index < Player.inventory.Count)
                            {
                                if (ItemName.ToLower() == Player.inventory[index].Name.ToLower())
                                {
                                    itemfound = true;
                                    ItemToSell = Player.inventory[index];
                                }
                                index++;
                            }

                            //player didn't specify item or person
                            LoDConsole.WriteLine("Civilians in the room:\n");

                            for (index = 0; index < CurrentRoom.Civilians.Count; index++)
                            {
                                if (CurrentRoom.Civilians[index].willBuy == true) LoDConsole.WriteLine(string.Concat(CurrentRoom.Civilians[index].name, " - ", CurrentRoom.Civilians[index].MerchantType));

                            }
                            vendor = LoDConsole.ReadLine("Who do you want to sell to?", "Merchants", string.Empty);

                        }
                        else if (PlayerCommand.Split(' ').Length >= 2)
                        {
                            //ItemName = PlayerCommand.Split(' ')[1].ToLower();
                            ItemName = PlayerCommand.Split(' ')[1].ToLower();
                            bool itemFound = false;
                            bool vendorFound = false;
                            index = 2;

                            while (index < (PlayerCommand.Split(' ').Length))
                            {
                                if (PlayerCommand.Split(' ')[index].ToLower() == "to")
                                {
                                    itemFound = true;
                                    index++;
                                    vendor = PlayerCommand.Split(' ')[index].ToLower();
                                    vendorFound = true;
                                }
                                else if (itemFound == false)
                                {
                                    ItemName = string.Concat(ItemName, " ", PlayerCommand.Split(' ')[index].ToLower());
                                }
                                else
                                {
                                    vendor = string.Concat(vendor, " ", PlayerCommand.Split(' ')[index].ToLower());
                                }
                                index++;
                            }

                            index = 0;
                            itemFound = false;

                            while (itemFound == false && index < Player.inventory.Count)
                            {
                                if (ItemName.ToLower() == Player.inventory[index].Name.ToLower())
                                {
                                    itemFound = true;
                                    ItemToSell = Player.inventory[index];
                                }
                                index++;
                            }

                            if (itemFound == true && vendorFound == false)
                            {
                                LoDConsole.WriteLine("Civilians in the room:\n");

                                for (index = 0; index < CurrentRoom.Civilians.Count; index++)
                                {
                                    if (CurrentRoom.Civilians[index].willBuy == true) LoDConsole.WriteLine(string.Concat(CurrentRoom.Civilians[index].name, " - ", CurrentRoom.Civilians[index].MerchantType));

                                }
                                vendor = LoDConsole.ReadLine("Who do you want to sell "+ItemName+" to?", "Merchants", string.Empty);
                            }
                        }
                        SellItem(ItemToSell, vendor);
                    }
                    else LoDConsole.WriteLine("There is nobody willing to buy anything from you here");
                }
                #endregion

                #region Give Item
                else if (CommandContains(PlayerCommand, "give"))
                {
                    string itemName = string.Empty;
                    string targetNPC = string.Empty;
                    bool itemFound = false;

                    for (int i = 1; i < PlayerCommand.Split(' ').Length; i++)
                    {
                        if (PlayerCommand.Split(' ')[i].ToLower() == "to") itemFound = true;
                        else if (!itemFound) itemName = itemName + " " + PlayerCommand.Split(' ')[i];
                        else targetNPC = targetNPC + " " + PlayerCommand.Split(' ')[i];
                    }
                    if (!string.IsNullOrEmpty(itemName) && string.IsNullOrEmpty(targetNPC))
                    {
                        targetNPC = LoDConsole.ReadLine("Who do you want to give " + itemName.Trim() + " to?", "Give Item", string.Empty);

                    }
                    else if (!itemFound && targetNPC == string.Empty)
                    {
                        itemName = LoDConsole.ReadLine("Who do you want to give?", "Give Item", string.Empty);
                        targetNPC = LoDConsole.ReadLine("Who do you want to give " + itemName.Trim() + " to?", "Give Item", string.Empty);
                    }
                    //if (itemName.Trim().ToLower() == "gold") LoDConsole.WriteLine(WordWrap("You cannot gift gold at this time"));
                    else GiveItem(itemName.Trim(), targetNPC.Trim());
                }
                #endregion

                #region Talk to
                else if (CommandContains(PlayerCommand, "talk"))
                {
                    int index;
                    string NPCname = string.Empty;

                    if (CurrentRoom.Civilians != null)
                    {
                        if (PlayerCommand.ToLower() == "talk to" || PlayerCommand.ToLower() == "talk")
                        {
                            LoDConsole.WriteLine("Non-Hostile people in the room:\n");

                            for (index = 0; index < CurrentRoom.Civilians.Count; index++)
                            {
                                LoDConsole.WriteLine(WordWrap(CurrentRoom.Civilians[index].name));
                            }
                            LoDConsole.Write("\nWho do you want to talk to? ");
                            NPCname = LoDConsole.ReadLine("Who do you want to talk to?", "Talk", string.Empty);
                        }
                        else
                        {
                            string[] strArray = PlayerCommand.Split(' ');
                            foreach (string word in strArray) { if (word != "to" && word != "talk") NPCname = string.Concat(NPCname, " ", word); }
                        }
                        if (NPCname == string.Empty) LoDConsole.WriteLine("Talk to who?");
                        else LoDConsole.WriteLine(WordWrap(TalkToNPC(NPCname.Trim())));
                    }
                    else
                    {
                        LoDConsole.WriteLine("There are no non-hostile people to talk to");
                    }
                }
                #endregion

                #region Suicide
                else if (PlayerCommand.Contains("suicide") || PlayerCommand.ToLower() == "attack self" || PlayerCommand.ToLower() == "hit self" || PlayerCommand.ToLower() == string.Concat("hit ", Player.name.ToLower()) || PlayerCommand.ToLower() == string.Concat("attack ", Player.name.ToLower()) || PlayerCommand.ToLower() == "kill self")
                {
                    if (PlayerCommand.Contains("suicide") && CurrentRoom.SuicideAction != null) LoDConsole.WriteLine(WordWrap(CurrentRoom.SuicideAction));
                    else LoDConsole.WriteLine(WordWrap("You raise your weapon above your head. Screaming in blind rage for some unknown reason. You strike yourself until you die"));
                    Player.HPBonus = 0;
                    //LoDConsole.WriteLine("I GET HERE, and my health is {0}", Player.HPBonus);
                }
                #endregion

                #region Attack
                else if (CommandContains(PlayerCommand, "attack") || CommandContains(PlayerCommand, "hit") || CommandContains(PlayerCommand, "fight"))
                {
                    string enemy;
                    int index;
                    bool enemyfound = false;

                    if (CurrentRoom.Enemy != null && CurrentRoom.Enemy.Count > 0)
                    {
                        if (PlayerCommand.ToLower() == "attack" || PlayerCommand.ToLower() == "hit" || PlayerCommand.ToLower() == "fight")
                        {
                            LoDConsole.WriteLine(WordWrap("Enemies in room:\n"));
                            for (index = 0; index < CurrentRoom.Enemy.Count; index++)
                            {
                                LoDConsole.WriteLine(WordWrap(CurrentRoom.Enemy[index].name));
                            }
                            enemy = LoDConsole.ReadLine("Who do you want to attack?", "Combat", string.Empty);

                        }
                        else
                        {
                            string[] strArray = PlayerCommand.Split(' ');
                            enemy = strArray[1];
                            for (int i = 2; i < strArray.Length; i++)
                            {
                                enemy = enemy + " " + strArray[i];
                            }

                        }
                        index = 0;
                        while (CurrentRoom.Enemy != null && index < CurrentRoom.Enemy.Count && enemyfound == false)
                        {
                            if (CurrentRoom.Enemy[index].name.ToLower() == enemy.ToLower())
                            {
                                Combat(Player.WeaponHeld, enemy);
                                enemyfound = true;
                            }
                            index++;
                        }
                        if (enemyfound == false) LoDConsole.WriteLine(WordWrap(string.Concat("Could not find ", enemy, " in the area")));
                    }
                    else if (CurrentRoom.Civilians != null && CurrentRoom.Civilians.Count > 0)
                    {
                        if (PlayerCommand.ToLower() == "attack" || PlayerCommand.ToLower() == "hit" || PlayerCommand.ToLower() == "fight")
                        {
                            enemy = LoDConsole.ReadLine("Who do you want to attack?", "Give Item", string.Empty);
                        }
                        else
                        {
                            string[] strArray = PlayerCommand.Split(' ');
                            enemy = strArray[1];
                            for (int i = 2; i < strArray.Length; i++)
                            {
                                enemy = enemy + " " + strArray[i];
                            }
                        }
                        StartFight(enemy);
                    }
                    else
                        LoDConsole.WriteLine(WordWrap("There is nobody in the room to fight"));
                }
                #endregion

                #region Equip/Wear
                else if (CommandContains(PlayerCommand, "equip") || CommandContains(PlayerCommand, "wear"))
                {
                    EquipItem(PlayerCommand);
                }
                #endregion

                #region Eat/Drink
                else if (CommandContains(PlayerCommand, "eat") || CommandContains(PlayerCommand, "drink") || CommandContains(PlayerCommand, "consume"))
                {
                    if (Player.inventory.Count != 0)
                    {
                        int index;
                        string ObjectName = string.Empty;

                        if (PlayerCommand.ToLower() == "eat" || PlayerCommand.ToLower() == "drink" || PlayerCommand.ToLower() == "consume")
                        {
                            LoDConsole.WriteLine("Food in your inventory:\n");
                            foreach (itemInfo Item in Player.inventory)
                            {
                                if (Item.Class == "Food" || Item.Class == "Drink")
                                {
                                    LoDConsole.WriteLine(WordWrap(Item.Name));
                                }
                            }
                            ObjectName = LoDConsole.ReadLine("Which item do you want to consume?", "Consume", string.Empty);
                        }
                        else
                        {
                            string[] strArray = PlayerCommand.Split(' ');
                            ObjectName = strArray[1];

                            index = 2;
                            while (index < strArray.Length)
                            {
                                ObjectName = string.Concat(ObjectName, " ", strArray[index]);
                                index++;
                                //LoDConsole.WriteLine(WordWrap("item is {0}", item);
                            }
                            ObjectName = ObjectName.Trim();
                        }
                        LoDConsole.WriteLine(WordWrap(ConsumeItem(ObjectName)));
                    }
                    else LoDConsole.WriteLine("Your inventory is empty");
                }
                #endregion

                #region Sleep
                else if (CommandContains(PlayerCommand, "sleep") || CommandContains(PlayerCommand, "sleep in") || CommandContains(PlayerCommand, "go to sleep"))
                {
                    int index = 0;
                    string bedItem = string.Empty;

                    if (PlayerCommand.ToLower() == "sleep in" || PlayerCommand.ToLower() == "sleep")
                    {

                        bedItem = LoDConsole.ReadLine("Who do you want to sleep in?", "Give Item", string.Empty);
                    }
                    else if (PlayerCommand.ToLower().Split(' ').Length > 2 && PlayerCommand.ToLower().Split(' ')[0] == "sleep" && PlayerCommand.ToLower().Split(' ')[1] == "in")
                    {
                        string[] strArray = PlayerCommand.Split(' ');
                        bedItem = strArray[2];

                        index = 3;
                        while (index < strArray.Length)
                        {
                            bedItem = string.Concat(bedItem, " ", strArray[index]);
                            index++;
                            //LoDConsole.WriteLine(WordWrap("item is {0}", item);
                        }
                        bedItem = bedItem.Trim();
                    }
                    //LoDConsole.WriteLine("Trying to sleep in {0}", bedItem);
                    Rest(bedItem);
                }
                #endregion

                #region Map
                else if ((CommandContains(PlayerCommand, "map")))
                {
                    DrawMap();
                }
                #endregion

                #region Time
                else if (CommandContains(PlayerCommand, "time"))
                {
                    TimeSpan ts = TimeSpan.FromMinutes(WorldState.WorldTime);
                    LoDConsole.WriteLine("The time is " + ts.ToString("hh':'mm"));
                }
                #endregion

                #region Music
                else if (PlayerCommand.ToLower() == "music browse")
                {
                    Music("browse");
                }
                else if (PlayerCommand.ToLower() == "music start")
                {
                    Music("start");
                }
                else if (PlayerCommand.ToLower() == "music stop")
                {
                    Music("stop");
                }
                #endregion

                #region Control
                else if (PlayerCommand.ToLower() == "clear")
                {
                    LoDConsole.Clear();
                    LoDConsole.WriteLine(WordWrap(CurrentRoom.Description));
                }
                else if (PlayerCommand.ToLower() == "main menu" || PlayerCommand.ToLower() == "mainmenu")
                {
                    //Run the main menu screen
                    lock (myLock) { stopTime = 0; } //Pause the clock
                    DrawMainMenu();
                    lock (myLock) { stopTime = 1; } //Start the clock
                    //ThisFloor = world[Player.CurrentPos[2]];
                    CurrentRoom = GetRoomInfo(Player.CurrentPos);
                    LoDConsole.WriteLine(WordWrap(CurrentRoom.Description));
                }
                else if (CommandContains(PlayerCommand, "save"))
                {
                    string success = SaveGame();
                    LoDConsole.WriteLine(WordWrap(string.Concat("Save ", success)));
                }
                else if (PlayerCommand.ToLower() == "quit" || PlayerCommand.ToLower() == "exit")
                {
                    LoDConsole.WriteLine("Quitting game");
                    QuitGame();
                }

                #endregion

                #region Easter Eggs

                else if (CommandContains(PlayerCommand, "typical"))
                {
                    LoDConsole.WriteLine("I know right?\n");
                }
                #endregion

                #region Debugging

                else if (DebugEnabled == true)
                {
                    if (CommandContains(PlayerCommand, "getpos"))
                    {
                        LoDConsole.WriteLine("Row {0}, Col {1}, Level {2}", Char.ConvertFromUtf32(Player.CurrentPos[0] + 65), (Player.CurrentPos[1] + 1).ToString(), (Player.CurrentPos[2] + 1).ToString());
                    }
                    else if (CommandContains(PlayerCommand, "movepos"))
                    {
                        SaveWorld();
                        string[] Command = PlayerCommand.Split(' ');
                        bool fail = false;
                        int[] NewCoods = new int[3];

                        int Row;
                        if (Int32.TryParse(Command[1], out Row)) NewCoods[0] = Row;
                        else
                        {
                            char ThisChar = Command[1].ToUpper().ToCharArray()[0];
                            int temp = (int)Convert.ToChar(ThisChar);
                            temp = temp - 65;
                            NewCoods[0] = temp;
                        }

                        int Col;
                        if (Int32.TryParse(Command[2], out Col)) NewCoods[1] = Col - 1;
                        else fail = true;

                        int Floor;
                        if (Int32.TryParse(Command[3], out Floor)) NewCoods[2] = Floor - 1;
                        else fail = true;

                        if (!fail)
                        {
                            Player.CurrentPos[0] = NewCoods[0];
                            Player.CurrentPos[1] = NewCoods[1];
                            Player.CurrentPos[2] = NewCoods[2];

                            CurrentRoom = GetRoomInfo(Player.CurrentPos);
                            LoDConsole.WriteLine(CurrentRoom.Description);
                            EventTrigger("moveinto");
                        }
                        else LoDConsole.WriteLine("Command Failed");

                    }
                    else LoDConsole.WriteLine(WordWrap("Command not found, type help for a list of valid commands"));
                }
                else LoDConsole.WriteLine(WordWrap("Command not found, type help for a list of valid commands"));
            }
            catch (Exception ex)
            {
                string FileName = DateTime.Now.ToString(@"dd-MM-yyyy HHmmss");

                LoDConsole.WriteLine(WordWrap("\nYou have encountered an error.\nThe game engine was not able to handle the command you entered."));
                LoDConsole.WriteLine(WordWrap("\nAn error report has been created in .\\Errors\\" + FileName + ".txt\nPlease submit this to the developer"));

                if (!Directory.Exists(".\\Errors")) Directory.CreateDirectory(".\\Errors");
                using (StreamWriter file = new System.IO.StreamWriter(@".\Errors\" + FileName + ".txt", true))
                {
                    file.WriteLine("---Legend-Of-Drongo---");
                    file.WriteLine("");
                    file.WriteLine("Error logged at {0}", DateTime.Now.ToString(@"dd-MM-yyyy HH:mm:ss"));
                    file.WriteLine("");
                    file.WriteLine("Player Location: Row {0}, Col {1}, Level {2}\n\n", Char.ConvertFromUtf32(Player.CurrentPos[0] + 65), (Player.CurrentPos[1] + 1), (Player.CurrentPos[2] + 1));
                    file.WriteLine("Command Entered: {0}\n\n", PlayerCommand);
                    file.WriteLine("");
                    file.WriteLine("");

                    Random rng = new Random();
                    int output = rng.Next(1, 3);
                    switch (output)
                    {
                        case 1: file.WriteLine("The stacktrace output can be scary, do not say the words out loud as you may summon a demon!"); break;
                        case 2: file.WriteLine("The stacktrace output can be scary, some say it can read your very soul!"); break;
                        case 3: file.WriteLine("The stacktrace output can be scary, don't believe it's lies about being sentient!"); break;
                    }

                    file.WriteLine("Error Message: {0}", ex.Message);
                    file.WriteLine("Stacktrace:");
                    file.WriteLine(ex.StackTrace);
                    file.WriteLine("");
                    file.WriteLine("");
                    file.WriteLine("End of line...");

                }

            }
                #endregion

            #region Level Up

            int XP = Player.XP;
            int Level = Player.Level;

            if (XP >= XPNeeded(Level)) LevelUp(Level + 1);

            #endregion

            #region GameOver
            if (Player.HPBonus <= 0)
            {
                if (Player.CurrentPos[2] == 0)
                {
                    lock (myLock) { stopTime = 0; }

                    LoDConsole.WriteLine("\n\n     Your adventure has come to an end :(");
                    Thread.Sleep(5000);

                    DrawMainMenu();
                    lock (myLock) { stopTime = 1; }
                    ThisFloor = world[Player.CurrentPos[2]];
                    CurrentRoom = ThisFloor.CurrentFloor[Player.CurrentPos[0], Player.CurrentPos[1]];
                    LoDConsole.WriteLine(WordWrap(CurrentRoom.Description));
                }
                else
                {
                    LoDConsole.WriteLine("\n\n     You have died, but this is not the end...");
                    Thread.Sleep(5000);
                    LoDConsole.Clear();
                    LoDConsole.WriteLine(WordWrap("\n\n\tYou fall through darkness and smoke\n\tuntil you feel your feet softly make contact with ground"));

                    Player.HPBonus = 60;
                    world[(Player.CurrentPos[2])] = ThisFloor;
                    Player.CurrentPos[0] = 1;
                    Player.CurrentPos[1] = 1;      //set coodinates of afterlife
                    Player.CurrentPos[2] = 0;
                    ThisFloor = world[0];
                    CurrentRoom = GetRoomInfo(Player.CurrentPos);
                    EventTrigger("moveinto");
                }
            }
            #endregion

            //LoDConsole.DrawEnvironment(CurrentRoom);
        }
Ejemplo n.º 13
0
        public static void DrawMap()
        {
            int row;
            int col;
            LoDConsole.Clear();
            //Console.CursorSize
            LoDConsole.WriteLine("Map of " + ThisFloor.FloorName);
            LoDConsole.WriteLine("──────────────────────");
            LoDConsole.WriteLine("* Dead End");
            LoDConsole.WriteLine("X Blocked");
            LoDConsole.WriteLine("┼ Path\n\n");

            LoDConsole.Write("\t┌────────────┐\n");
            for (row = 0; row < ThisFloor.CurrentFloor.GetLength(0); row++)
            {
                LoDConsole.Write("\t│ ");
                for (col = 0; col < ThisFloor.CurrentFloor.GetLength(1); col++)
                {
                    //Draw the map
                    roomInfo TempRoom = new roomInfo();
                    TempRoom = ThisFloor.CurrentFloor[row, col];
                    if (TempRoom.Explored == true)
                    {
                        if (TempRoom.CanMove == true)
                        {
                            if (row > 0 && row < ThisFloor.CurrentFloor.GetLength(0) && col > 0 && col < ThisFloor.CurrentFloor.GetLength(1))
                            {
                                bool north = false;
                                bool east = false;
                                bool south = false;
                                bool west = false;
                                bool isPlayer = false;

                                if (row == Player.CurrentPos[0] && col == Player.CurrentPos[1]) isPlayer = true;
                                if (ThisFloor.CurrentFloor[row - 1, col].CanMove == true) north = true;
                                if (ThisFloor.CurrentFloor[row + 1, col].CanMove == true) south = true;
                                if (ThisFloor.CurrentFloor[row, col - 1].CanMove == true) west = true;
                                if (ThisFloor.CurrentFloor[row, col + 1].CanMove == true) east = true;

                                /*
                                 *      http://www.theasciicode.com.ar/
                                 */

                                if (isPlayer == true) Console.Write("O");
                                //North Combinations
                                else if (north == true && south == true && east == true && west == true) LoDConsole.Write("┼");
                                else if (north == true && south == true && east == true && west == false) LoDConsole.Write("├");
                                else if (north == true && south == true && east == false && west == true) LoDConsole.Write("┤");
                                else if (north == true && south == true && east == false && west == false) LoDConsole.Write("│");
                                else if (north == true && south == false && east == true && west == true) LoDConsole.Write("┴");
                                else if (north == true && south == false && east == true && west == false) LoDConsole.Write("└");
                                else if (north == true && south == false && east == false && west == true) LoDConsole.Write("┘");

                                //South Combinations
                                else if (north == false && south == true && east == true && west == true) LoDConsole.Write("┬");
                                else if (north == false && south == true && east == true && west == false) LoDConsole.Write("┌");
                                else if (north == false && south == true && east == false && west == true) LoDConsole.Write("┐");

                                //East West Combinations
                                else if (north == false && south == false && east == true && west == true) LoDConsole.Write("─");
                                else LoDConsole.Write("X");
                            }
                        }
                        else LoDConsole.Write("*");
                    }
                    else LoDConsole.Write(" ");

                }
                LoDConsole.Write(" │\n");
            }
            LoDConsole.WriteLine("\t└────────────┘");
        }
Ejemplo n.º 14
0
        public static void StartGame(PlayerProfile Player)
        {
            LoDConsole.ToggleMenuButtons(false);

            ParseOptions();

            ThisFloor = world[Player.CurrentPos[2]];
            CurrentRoom = GetRoomInfo(Player.CurrentPos);
            CurrentRoom.Explored = true;
            //if (Player.InBuilding == true)
            //{
            //    CurrentRoom = GoIntoBuilding(CurrentRoom.Building);
            //    Player.InBuilding = true;
            //}

            WorldState.WorldTime = 512; //Set the clock to 8am and start ticking
            Thread TimeThread = new Thread(TimeTicker);
            TimeThread.Start();

            //The starting floor has a song that is not the one currently playing
            if (ThisFloor.FloorSong != null && File.Exists(ThisFloor.FloorSong) && ThisFloor.FloorSong != MusicPlayer.SoundLocation)
            {
                MusicPlayer.SoundLocation = ThisFloor.FloorSong;
                Music("Start");
            }

            //LoDConsole.WriteLine(WordWrap(CurrentRoom.Description));
            //LoDConsole.DrawEnvironment(CurrentRoom);
        }
Ejemplo n.º 15
0
        Dictionary <int, deskNode> dic = new Dictionary <int, deskNode>();//用来保存座位号,和对应的桌子


        private RoomControll()
        {
            RoomInfo = new roomInfo();
            EventDispatch.addEventListener(this, "do");
            Debug.Log("newlControll");
        }
Ejemplo n.º 16
0
        public static roomInfo GoIntoBuilding(Building thisBuilding)
        {
            LoDConsole.WriteLine("Entering " + thisBuilding.BuildingName);
            //Thread.Sleep(1000);

            DataTypes dt = new DataTypes();
            roomInfo ThisRoom = new roomInfo();
            ThisRoom = dt.BuildingIntoRoom(thisBuilding);
            Player.InBuilding = true;

            return ThisRoom;
        }
Ejemplo n.º 17
0
        public static roomInfo GetRoomInfo(int[] UserPos)
        {
            //SaveWorld();

            roomInfo ThisRoom = new roomInfo();

            //ThisFloor = world[UserPos[2]];

            ThisFloor = world[UserPos[2]];

            DataTypes dt = new DataTypes();
            if (Player.InBuilding) ThisRoom = dt.BuildingIntoRoom(ThisFloor.CurrentFloor[UserPos[0], UserPos[1]].Building);
            else ThisRoom = ThisFloor.CurrentFloor[UserPos[0], UserPos[1]];

            return (ThisRoom);
        }