Beispiel #1
0
 private void AddChest(ChestData ChestData)
 {
     if (FormDetails.ItemManager.ChestData.ContainsKey(ChestData.Name))
     {
         DialogResult result = MessageBox.Show(
         ChestData.Name + " already exists. Overwrite it?",
         "Existing Chest",
         MessageBoxButtons.YesNo);
         if (result == DialogResult.No)
             return;
         itemManager.ChestData[ChestData.Name] = ChestData;
         FillListBox();
         return;
     }
     itemManager.ChestData.Add(ChestData.Name, ChestData);
     lbDetails.Items.Add(ChestData);
 }
Beispiel #2
0
        public override object Clone()
        {
            ChestData data = new ChestData();
            data.Name = chestData.Name;
            data.DifficultyLevel = chestData.DifficultyLevel;
            data.IsLocked = chestData.IsLocked;
            data.IsTrapped = chestData.IsTrapped;
            data.TrapName = chestData.TrapName;
            data.KeyName = chestData.KeyName;
            data.KeyType = chestData.KeyType;
            data.KeysRequired = chestData.KeysRequired;
            data.MinGold = chestData.MinGold;
            data.MaxGold = chestData.MaxGold;

            foreach (KeyValuePair<string, string> item in chestData.ItemCollection)
                data.ItemCollection.Add(item.Key, item.Value);

            Chest chest = new Chest(data);
            return chest;
        }
Beispiel #3
0
        public override object Clone()
        {
            ChestData data = new ChestData();

            data.Name            = chestData.Name;
            data.DifficultyLevel = chestData.DifficultyLevel;
            data.IsLocked        = chestData.IsLocked;
            data.IsTrapped       = chestData.IsTrapped;
            data.TrapName        = chestData.TrapName;
            data.KeyName         = chestData.KeyName;
            data.KeyType         = chestData.KeyType;
            data.KeysRequired    = chestData.KeysRequired;
            data.MinGold         = chestData.MinGold;
            data.MaxGold         = chestData.MaxGold;

            foreach (KeyValuePair <string, string> item in chestData.ItemCollection)
            {
                data.ItemCollection.Add(item.Key, item.Value);
            }

            Chest chest = new Chest(data);

            return(chest);
        }
Beispiel #4
0
 public Chest(ChestData data)
     : base(data.Name, "", 0, 0)
 {
     chestData = data;
 }
Beispiel #5
0
        void btnOK_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(tbName.Text))
            {
                MessageBox.Show("You must enter a name for the chest.");
                return;
            }

            if (cbTrap.Checked && string.IsNullOrEmpty(tbTrap.Text))
            {
                MessageBox.Show("you must enter a name for the trap on the chest.");
                return;
            }

            if (nudMaxGold.Value < nudMinGold.Value)
            {
                MessageBox.Show("Maximum gold in chest must be either greater or equal to minimum gold in chest.");
                return;
            }

            ChestData data = new ChestData();

            data.Name = tbName.Text;
            data.IsLocked = cbLock.Checked;

            if (cbLock.Checked)
            {
                data.DifficultyLevel = (DifficultyLevel)cboDifficulty.SelectedIndex;
                data.KeyName = tbKeyName.Text;
                data.KeyType = tbKeyType.Text;
                data.KeysRequired = (int)nudKeys.Value;
            }

            data.IsTrapped = cbTrap.Checked;

            if (cbTrap.Checked)
            {
                data.TrapName = tbTrap.Text;
            }

            data.MinGold = (int)nudMinGold.Value;
            data.MaxGold = (int)nudMaxGold.Value;

            chest = data;
            this.FormClosing -= FormChestDetails_FormClosing;
            this.Close();
        }
Beispiel #6
0
 void btnCancel_Click(object sender, EventArgs e)
 {
     chest = null;
     this.FormClosing -= FormChestDetails_FormClosing;
     this.Close();
 }
Beispiel #7
0
 public Chest(ChestData data)
     : base(data.Name, "", 0, 0)
 {
     chestData = data;
 }