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;
        }
Beispiel #2
0
 private void cmdCloneItem_Click(object sender, EventArgs e)
 {
     if (lstInventory.SelectedIndex > -1)
     {
         DataTypes dt = new DataTypes();
         NPC.inventory.Add(dt.CloneItem(NPC.inventory[lstInventory.SelectedIndex]));
         GetAllItems();
     }
     else
     {
         MessageBox.Show("Select an item to clone");
     }
 }
Beispiel #3
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);
        }
 private void cmdCloneItem_Click(object sender, EventArgs e)
 {
     if (Player.invspace > 0)
     {
         if (lstInventory.SelectedIndex > -1)
         {
             DataTypes dt = new DataTypes();
             Player.inventory.Add(dt.CloneItem(Player.inventory[lstInventory.SelectedIndex]));
             Player.invspace = Player.invspace - 1;
             lblInv.Text     = "Inventory " + (Player.MaxItems - Player.invspace) + "/";
             PopulateInventory();
         }
     }
     else
     {
         MessageBox.Show("The player inventory is full, you cannot add more items");
     }
 }
 private void cmdCloneItem_Click(object sender, EventArgs e)
 {
     if (lstItems.SelectedIndex > -1)
     {
         DataTypes dt = new DataTypes();
         Room.items.Add(dt.CloneItem(Room.items[lstItems.SelectedIndex]));
         GetAllItems();
     }
     else MessageBox.Show("Select an item to clone");
 }