private void button3_Click(object sender, EventArgs e)
 {
     if (deleteOnExit)
     {
         ProtoManager.Remove(this.pc.Id);
     }
     if (this.parent != null)
     {
         parent.RefreshList();
     }
     this.Close();
 }
Exemple #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            ProtoCritter newpc = this.pc.DeepCopy();

            if (newpc.Parse(this.rtbData.Lines.ToList(), ProtoManager.CorrectFile(newpc.Savefile)))
            {
                newpc.Id  = pc.Id;
                this.pc   = newpc;
                parent.pc = newpc;
                ProtoManager.Protos[newpc.Id] = newpc;
                this.parent.LoadProto();
                this.parent.parent.RefreshList();
                this.Close();
            }
        }
        private void button2_Click(object sender, EventArgs e)
        {
            SaveProto();
            ProtoManager.SaveProtoAs(this.pc, this.pc.Id);
            if (this.parent != null)
            {
                parent.RefreshList();
            }
            else
            {
                ProtoManager.Save();
            }

            this.Close();
        }
        private void button4_Click(object sender, EventArgs e)
        {
            ArrayList objs = (ArrayList)protoList.SelectedObjects;

            foreach (Object obj in objs)
            {
                if (obj is KeyValuePair <int, ProtoCritter> )
                {
                    KeyValuePair <int, ProtoCritter> pair = (KeyValuePair <int, ProtoCritter>)obj;
                    ProtoManager.Remove(pair.Key);
                }
            }
            if (objs.Count > 0)
            {
                RefreshList();
            }
        }
 private void button3_Click(object sender, EventArgs e)
 {
     if (rdbAssignFree.Checked)
     {
         int newProto = ProtoManager.AddProto();
         RefreshList();
         frmProtoCritterEditor form = new frmProtoCritterEditor(this, newProto, true);
         form.Show();
     }
     else
     {
         if (ProtoManager.AddProto((int)numPid.Value))
         {
             RefreshList();
             frmProtoCritterEditor form = new frmProtoCritterEditor(this, (int)numPid.Value, true);
             form.Show();
         }
     }
 }
        private void frmProtoCritterEditor_Load(object sender, EventArgs e)
        {
            this.Text = "Critter Proto Editor: PID " + pc.Id;
            PrepareUpDown(hpBaseNum);
            PrepareUpDown(apBaseNum);
            PrepareUpDown(acBaseNum);
            PrepareUpDown(mdBaseNum);
            PrepareUpDown(cwBaseNum);
            PrepareUpDown(seqBaseNum);
            PrepareUpDown(hrBaseNum);
            PrepareUpDown(critBaseNum);
            PrepareUpDown(hpFullNum);
            PrepareUpDown(apFullNum);
            PrepareUpDown(acFullNum);
            PrepareUpDown(mdFullNum);
            PrepareUpDown(cwFullNum);
            PrepareUpDown(seqFullNum);
            PrepareUpDown(hrFullNum);
            PrepareUpDown(critFullNum);
            PrepareUpDown(poisonBaseNum);
            PrepareUpDown(radBaseNum);
            PrepareUpDown(poisonFullNum);
            PrepareUpDown(radFullNum);
            ParamsDefines.FillBodytypes(bodytypeBox);
            ParamsDefines.FillModes(modesBox);
            ParamsDefines.FillTraits(traitsBox);
            ParamsDefines.FillPerks(perksBox);
            ProtoManager.FillFilenames(savefileBox);

            GroupStatNums();
            GroupSkillsNums();
            GroupDamageNums();
            PrepareUpDowns(SkillBaseNums);
            PrepareUpDowns(skillFullNums);

            LoadProto();

            perksList.DataSource  = Perks;
            modesList.DataSource  = Modes;
            traitsList.DataSource = Traits;
            this.Refresh();
        }
 private void protoList_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.Control && e.KeyCode == Keys.C)
     {
         Object obj = protoList.SelectedObject;
         if (obj != null)
         {
             var kvp = (KeyValuePair <int, ProtoCritter>)obj;
             copiedCritter  = (ProtoCritter)kvp.Value;
             lblCopied.Text = getCopiedText();
         }
         e.Handled = true;
     }
     else if (e.Control && e.KeyCode == Keys.V)
     {
         ProtoCritter cr = copiedCritter.DeepCopy();
         ProtoManager.AddProto(cr);
         RefreshList();
         lblCopied.Text     = getCopiedText() + " Cloned into PID " + cr.Id;
         e.SuppressKeyPress = true;
     }
 }
 private void button1_Click(object sender, EventArgs e)
 {
     ProtoManager.Save();
     this.Close();
 }
        public void LoadProto()
        {
            for (int i = Consts.ST_STRENGTH; i <= Consts.ST_LUCK; i++)
            {
                StatNums[i].Value = pc.Params[i];
            }

            hpNum.Value                 = pc.Params[Consts.ST_MAX_LIFE];
            apNum.Value                 = pc.Params[Consts.ST_ACTION_POINTS];
            acNum.Value                 = pc.Params[Consts.ST_ARMOR_CLASS];
            mdNum.Value                 = pc.Params[Consts.ST_MELEE_DAMAGE];
            cwNum.Value                 = pc.Params[Consts.ST_CARRY_WEIGHT];
            seqNum.Value                = pc.Params[Consts.ST_SEQUENCE];
            hrNum.Value                 = pc.Params[Consts.ST_HEALING_RATE];
            critNum.Value               = pc.Params[Consts.ST_CRITICAL_CHANCE];
            killExpNum.Value            = pc.Params[Consts.ST_KILL_EXPERIENCE];
            ageNum.Value                = pc.Params[Consts.ST_AGE];
            baseCrTypeNum.Value         = pc.Params[Consts.ST_BASE_CRTYPE];
            dialogIdNum.Value           = pc.Params[Consts.ST_DIALOG_ID];
            aiPackNum.Value             = pc.Params[Consts.ST_AI_ID];
            teamIdNum.Value             = pc.Params[Consts.ST_TEAM_ID];
            bagIdNum.Value              = pc.Params[Consts.ST_BAG_ID];
            nameText.Text               = pc.Name;
            descText.Text               = pc.Desc;
            locomotionBox.SelectedIndex = pc.Params[Consts.ST_LOCOMOTION_TYPE];
            damageTypeBox.SelectedIndex = pc.Params[Consts.ST_DAMAGE_TYPE];
            genderBox.SelectedIndex     = pc.Params[Consts.ST_GENDER];
            bodytypeBox.SelectedIndex   = pc.Params[Consts.ST_BODY_TYPE];

            for (int i = Consts.SK_SMALL_GUNS; i <= Consts.SK_OUTDOORSMAN; i++)
            {
                SkillNums[i - Consts.SK_SMALL_GUNS].Value = pc.Params[i];
            }

            for (int i = Consts.ST_NORMAL_ABSORB; i <= Consts.ST_EXPLODE_ABSORB; i++)
            {
                DTNums[i - Consts.ST_NORMAL_ABSORB].Value = pc.Params[i];
            }

            for (int i = Consts.ST_NORMAL_RESIST; i <= Consts.ST_EXPLODE_RESIST; i++)
            {
                DRNums[i - Consts.ST_NORMAL_RESIST].Value = pc.Params[i];
            }

            poisonNum.Value = pc.Params[Consts.ST_POISON_RESISTANCE];
            radNum.Value    = pc.Params[Consts.ST_RADIATION_RESISTANCE];

            savefileBox.SelectedIndex = ProtoManager.CorrectFileIndex(pc.Savefile);
            Perks.Clear();
            PerksLevels.Clear();
            Traits.Clear();
            TraitsLevels.Clear();
            Modes.Clear();
            ModesLevels.Clear();

            for (int i = Consts.PERK_BEGIN; i <= Consts.PERK_END; i++)
            {
                SetParam(PerksLevels, Perks, i, pc.Params[i]);
            }

            for (int i = Consts.MODE_BEGIN; i <= Consts.MODE_END; i++)
            {
                SetParam(ModesLevels, Modes, i, pc.Params[i]);
            }

            for (int i = Consts.TRAIT_BEGIN; i <= Consts.TRAIT_END; i++)
            {
                SetParam(TraitsLevels, Traits, i, pc.Params[i]);
            }

            UpdateBaseStats();
            for (int i = 0; i < 18; i++)
            {
                UpdateFullSkill(i);
            }
        }