Exemplo n.º 1
0
        /// <summary>
        /// Constructor for the individual shield component in each ship.
        /// </summary>
        /// <param name="definition">definition of the shield.</param>
        public ShieldTN(ShieldDefTN definition)
        {
            ShieldDef = definition;

            Name = definition.Name;

            isDestroyed = false;
        }
Exemplo n.º 2
0
        /// <summary>
        /// This Code, along with the DllImport allows for halting and resuming message sending during ResizeBegin and ResizeEnd. It was an attempt to eliminate cpu usage on window moves that did not work
        /// however. References in Components() must be uncommented for this to work, and the ResizeBegin and ResizeEnd functions must likewise have their contents uncommented.
        /// </summary>
        //private IntPtr eventMask;

        //[DllImport("user32", CharSet = CharSet.Auto)]
        //private extern static IntPtr SendMessage(IntPtr hWnd, int msg, int wParam, IntPtr lParam);

        public Components()
        {

            //eventMask = IntPtr.Zero;

            m_oComponentDesignPanel = new Panels.Component_Design();

            VM = new ComponentsViewModel();

            /// <summary>
            /// Bind factions to the empire selection combo box.
            /// </summary>
            m_oComponentDesignPanel.FactionComboBox.Bind(c => c.DataSource, VM, d => d.Factions);
            m_oComponentDesignPanel.FactionComboBox.Bind(c => c.SelectedItem, VM, d => d.CurrentFaction, DataSourceUpdateMode.OnPropertyChanged);
            m_oComponentDesignPanel.FactionComboBox.DisplayMember = "Name";
            VM.FactionChanged += (s, args) => _CurrnetFaction = VM.CurrentFaction;
            _CurrnetFaction = VM.CurrentFaction;
            m_oComponentDesignPanel.FactionComboBox.SelectedIndexChanged += (s, args) => m_oComponentDesignPanel.FactionComboBox.DataBindings["SelectedItem"].WriteValue();
            m_oComponentDesignPanel.FactionComboBox.SelectedIndexChanged += new EventHandler(FactionComboBox_SelectedIndexChanged);


            /// <summary>
            /// Load the tech names. Commented out code commented out because it seizes control of the control away from the user for reasons I don't understand.
            /// </summary>
            m_oComponentDesignPanel.ResearchComboBox.Bind(c => c.DataSource, VM, d => d.RPTechs);
            //m_oComponentDesignPanel.ResearchComboBox.Bind(c => c.SelectedItem, VM, d => d.CurrentComponent, DataSourceUpdateMode.OnPropertyChanged);
            //m_oComponentDesignPanel.ResearchComboBox.DisplayMember = "Name";
            VM.ComponentChanged += (s, args) => _CurrnetComponent = VM.CurrentComponent;
            _CurrnetComponent = VM.CurrentComponent;
            //m_oComponentDesignPanel.ResearchComboBox.SelectedIndexChanged += (s, args) => m_oComponentDesignPanel.ResearchComboBox.DataBindings["SelectedItem"].WriteValue();
            m_oComponentDesignPanel.ResearchComboBox.SelectedIndexChanged += new EventHandler(ResearchComboBox_SelectedIndexChanged);

            m_oComponentDesignPanel.TechComboBoxOne.SelectedIndexChanged += new EventHandler(TechComboBox_SelectedIndexChanged);
            m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndexChanged += new EventHandler(TechComboBox_SelectedIndexChanged);
            m_oComponentDesignPanel.TechComboBoxThree.SelectedIndexChanged += new EventHandler(TechComboBox_SelectedIndexChanged);
            m_oComponentDesignPanel.TechComboBoxFour.SelectedIndexChanged += new EventHandler(TechComboBox_SelectedIndexChanged);
            m_oComponentDesignPanel.TechComboBoxFive.SelectedIndexChanged += new EventHandler(TechComboBox_SelectedIndexChanged);
            m_oComponentDesignPanel.TechComboBoxSix.SelectedIndexChanged += new EventHandler(TechComboBox_SelectedIndexChanged);
            m_oComponentDesignPanel.TechComboBoxSeven.SelectedIndexChanged += new EventHandler(TechComboBox_SelectedIndexChanged);

            m_oComponentDesignPanel.CloseButton.Click += new EventHandler(CloseButton_Click);

            m_oComponentDesignPanel.SizeTonsCheckBox.Click += new EventHandler(SizeTonsCheckBox_Click);

            m_oComponentDesignPanel.InstantButton.Click += new EventHandler(InstantButton_Click);

            m_oComponentDesignPanel.MissileButton.Click += new EventHandler(MissileButton_Click);

            m_oComponentDesignPanel.TurretButton.Click += new EventHandler(TurretButton_Click);

            //m_oComponentDesignPanel.ResizeBegin +=new EventHandler(ResizeBegin);
            //m_oComponentDesignPanel.ResizeEnd += new EventHandler(ResizeEnd);

            ActiveSensorProject = null;
            PassiveSensorProject = null;
            BeamFCProject = null;
            ReactorProject = null;
            ShieldProject = null;
            EngineProject = null;
            BeamProject = null;
            LauncherProject = null;
            MagazineProject = null;
            MissileEngineProject = null;
            JumpEngineProject = null;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Update the display/Name for the proposed component.
        /// </summary>
        private void BuildSystemParameters()
        {
            String Entry = "N/A";
            float Size = 0.0f;
            float Hard = 1.0f;
            float Boost = 1.0f;
            int FactTech = -1;

            m_oComponentDesignPanel.TechNameTextBox.Clear();
            m_oComponentDesignPanel.ParametersTextBox.Clear();

            #region BuildSystemParameters Switch
            switch ((ComponentsViewModel.Components)m_oComponentDesignPanel.ResearchComboBox.SelectedIndex)
            {
                #region Active Sensors / MFC
                case ComponentsViewModel.Components.ActiveMFC:

                    /// <summary>
                    /// Sanity check.
                    /// </summary>
                    if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxFive.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxSix.SelectedIndex != -1)
                    {


                        #region Size
                        /// <summary>
                        /// Pull size out of this mess.
                        /// </summary>
                        if (m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex < 9)
                        {
                            Size = (float)(m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex + 1) / 10.0f;
                        }
                        else if (m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex >= 9 && m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex <= 13)
                        {
                            Size = 1.0f + (float)((m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex - 9) * 2) / 10.0f;
                        }
                        else if (m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex >= 14 && m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex <= 25)
                        {
                            Size = 2.0f + (float)(((m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex - 14) * 25) / 100.0f);
                        }
                        else if (m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex > 25)
                        {
                            Size = (float)(m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex - 21);
                        }
                        #endregion

                        #region Resolution
                        ushort Resolution = 501;
                        if (m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex < 20)
                        {
                            Resolution = (ushort)(m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex + 1);
                        }
                        else if (m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex >= 20 && m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex <= 55)
                        {
                            Resolution = (ushort)(20 + ((m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex - 19) * 5));
                        }
                        else if (m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex > 55)
                        {
                            Resolution = (ushort)(200 + ((m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex - 55) * 20));
                        }
                        #endregion

                        #region Hardening
                        /// <summary>
                        /// Get chance of destruction due to electronic damage.
                        /// </summary>
                        switch (m_oComponentDesignPanel.TechComboBoxFive.SelectedIndex)
                        {
                            case 0:
                                Hard = 1.0f;
                                break;
                            case 1:
                                Hard = 0.7f;
                                break;
                            case 2:
                                Hard = 0.5f;
                                break;
                            case 3:
                                Hard = 0.4f;
                                break;
                            case 4:
                                Hard = 0.3f;
                                break;
                            case 5:
                                Hard = 0.25f;
                                break;
                            case 6:
                                Hard = 0.2f;
                                break;
                            case 7:
                                Hard = 0.15f;
                                break;
                            case 8:
                                Hard = 0.1f;
                                break;
                            default:
                                Hard = 1.0f;
                                break;
                        }
                        #endregion

                        bool isMFC = false;

                        if (m_oComponentDesignPanel.TechComboBoxSix.SelectedIndex == 0)
                        {
                            Entry = "Active Search Sensor MR";
                            isMFC = false;
                        }
                        else
                        {
                            Entry = "Missile Fire Control FC";
                            isMFC = true;
                        }

                        FactTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.ActiveSensorStrength];

                        /// <summary>
                        /// More sanity checking as give all does not do this. I might not want to hard code all of this however.
                        /// </summary>
                        if (FactTech > 11)
                            FactTech = 11;

                        int AS = FactTech - m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex;

                        FactTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.EMSensorSensitivity];

                        if (FactTech > 11)
                            FactTech = 11;

                        int EM = FactTech - m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex;

                        ActiveSensorProject = new ActiveSensorDefTN(Entry, Size, Constants.SensorTN.ActiveStrength[AS],
                                                                               Constants.SensorTN.PassiveStrength[EM],
                                                                               Resolution, isMFC,
                                                                               Hard, (byte)(m_oComponentDesignPanel.TechComboBoxFive.SelectedIndex + 1));

                        int mkm = (int)Math.Floor((float)ActiveSensorProject.maxRange / 100.0f);

                        Entry = String.Format("{0}{1}-R{2}", Entry, mkm, Resolution);

                        if (Hard != 1.0f)
                        {
                            Entry = String.Format("{0} ({1}%)", Entry, (Hard * 100.0f));
                        }

                        ActiveSensorProject.Name = Entry;

                        m_oComponentDesignPanel.TechNameTextBox.Text = ActiveSensorProject.Name;

                        Entry = String.Format("Active Sensor Strength: {0} Sensitivity Modifier: {1}%\n", (ActiveSensorProject.activeStrength * ActiveSensorProject.size), ((float)ActiveSensorProject.eMRecv * 10.0f));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        if (m_oComponentDesignPanel.SizeTonsCheckBox.Checked == true)
                            Entry = String.Format("Sensor Size: {0} Tons  Sensor HTK: {1}\n", (ActiveSensorProject.size * 50.0f), ActiveSensorProject.htk);
                        else
                            Entry = String.Format("Sensor Size: {0} HS  Sensor HTK: {1}\n", ActiveSensorProject.size, ActiveSensorProject.htk);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);


                        int RangeFormat = (ActiveSensorProject.maxRange * 10);
                        string FormattedRange = RangeFormat.ToString("#,##0");



                        Entry = String.Format("Resolution: {0}    Maximum Range vs {1} ton object (or larger): {2},000 km\n", ActiveSensorProject.resolution, (ActiveSensorProject.resolution * 50), FormattedRange);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        if (Resolution == 1)
                        {
                            RangeFormat = ActiveSensorProject.GetActiveDetectionRange(0, 0) * 10;
                            if (RangeFormat < 100)
                            {
                                int Range1 = (int)((float)ActiveSensorProject.maxRange * 10000.0f * (float)Math.Pow((0.33 / (float)Resolution), 2.0f));
                                FormattedRange = Range1.ToString("#,##0");
                                Entry = String.Format("Range vs Size 6 Missile (or smaller): {0} km\n", FormattedRange);
                                m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                                int Range2 = (int)((float)ActiveSensorProject.maxRange * 10000.0f * (float)Math.Pow((0.40 / (float)Resolution), 2.0f));
                                FormattedRange = Range2.ToString("#,##0");
                                Entry = String.Format("Range vs Size 8 Missile: {0} km\n", FormattedRange);
                                m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                                int Range3 = (int)((float)ActiveSensorProject.maxRange * 10000.0f * (float)Math.Pow((0.60 / (float)Resolution), 2.0f));
                                FormattedRange = Range3.ToString("#,##0");
                                Entry = String.Format("Range vs Size 12 Missile: {0} km\n", FormattedRange);
                                m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                            }
                            else
                            {

                                FormattedRange = RangeFormat.ToString("#,##0");
                                Entry = String.Format("Range vs Size 6 Missile (or smaller): {0},000 km\n", FormattedRange);
                                m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                                RangeFormat = ActiveSensorProject.GetActiveDetectionRange(0, 2) * 10;
                                FormattedRange = RangeFormat.ToString("#,##0");
                                Entry = String.Format("Range vs Size 8 Missile: {0},000 km\n", FormattedRange);
                                m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                                RangeFormat = ActiveSensorProject.GetActiveDetectionRange(0, 4) * 10;
                                FormattedRange = RangeFormat.ToString("#,##0");
                                Entry = String.Format("Range vs Size 12 Missile: {0},000 km\n", FormattedRange);
                                m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                            }
                        }
                        else
                        {
                            RangeFormat = ActiveSensorProject.GetActiveDetectionRange(19, -1) * 10;
                            FormattedRange = RangeFormat.ToString("#,##0");
                            Entry = String.Format("Range vs 1000 ton object: {0},000 km\n", FormattedRange);
                            m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                            RangeFormat = ActiveSensorProject.GetActiveDetectionRange(4, -1) * 10;
                            FormattedRange = RangeFormat.ToString("#,##0");
                            Entry = String.Format("Range vs 250 ton object: {0},000 km\n", FormattedRange);
                            m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                        }

                        Entry = String.Format("Chance of destruction by electronic damage: {0}%\n", (Hard * 100.0f));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Cost: {0}    Crew: {1}\n", ActiveSensorProject.cost, ActiveSensorProject.crew);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Materials Required:");

                        for (int mineralIterator = 0; mineralIterator < (int)Constants.Minerals.MinerialNames.MinerialCount; mineralIterator++)
                        {
                            if (ActiveSensorProject.minerialsCost[mineralIterator] != 0)
                            {
                                Entry = String.Format("{0} {1:N1}x {2}", Entry, ActiveSensorProject.minerialsCost[mineralIterator], (Constants.Minerals.MinerialNames)mineralIterator);
                            }
                        }
                        Entry = String.Format("{0}\n\n", Entry);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Development Cost for Project: {0}RP\n", ActiveSensorProject.cost * 10);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                    }

                    break;
                #endregion

                #region Beam Fire Control
                case ComponentsViewModel.Components.BFC:
                    /// <summary>
                    /// Sanity check.
                    /// </summary>
                    if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxFive.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxSix.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxSeven.SelectedIndex != -1)
                    {

                        #region Get Stats
                        FactTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.BeamFireControlRange];

                        if (FactTech > 11)
                            FactTech = 11;

                        int BR = FactTech - m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex;

                        FactTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.BeamFireControlTracking];

                        if (FactTech > 11)
                            FactTech = 11;

                        int BT = FactTech - m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex;

                        float modR = 1.0f;

                        switch (m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex)
                        {
                            case 0:
                                modR = 1.0f;
                                break;
                            case 1:
                                modR = 1.5f;
                                break;
                            case 2:
                                modR = 2.0f;
                                break;
                            case 3:
                                modR = 3.0f;
                                break;
                            case 4:
                                modR = 0.5f;
                                break;
                            case 5:
                                modR = 4.0f;
                                break;
                            case 6:
                                modR = 0.34f;
                                break;
                            case 7:
                                modR = 0.25f;
                                break;
                            default:
                                modR = 1.0f;
                                break;
                        }

                        float modT = 1.0f;

                        switch (m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex)
                        {
                            case 0:
                                modT = 1.0f;
                                break;
                            case 1:
                                modT = 1.25f;
                                break;
                            case 2:
                                modT = 0.5f;
                                break;
                            case 3:
                                modT = 1.5f;
                                break;
                            case 4:
                                modT = 2.0f;
                                break;
                            case 5:
                                modT = 3.0f;
                                break;
                            case 6:
                                modT = 4.0f;
                                break;
                            default:
                                modT = 1.0f;
                                break;
                        }

                        switch (m_oComponentDesignPanel.TechComboBoxFive.SelectedIndex)
                        {
                            case 0:
                                Hard = 1.0f;
                                break;
                            case 1:
                                Hard = 0.7f;
                                break;
                            case 2:
                                Hard = 0.5f;
                                break;
                            case 3:
                                Hard = 0.4f;
                                break;
                            case 4:
                                Hard = 0.3f;
                                break;
                            case 5:
                                Hard = 0.25f;
                                break;
                            case 6:
                                Hard = 0.2f;
                                break;
                            case 7:
                                Hard = 0.15f;
                                break;
                            case 8:
                                Hard = 0.1f;
                                break;
                            default:
                                Hard = 1.0f;
                                break;
                        }

                        bool isPDC = false;
                        if (m_oComponentDesignPanel.TechComboBoxSix.SelectedIndex == 0)
                            isPDC = false;
                        else
                            isPDC = true;

                        bool isFighter = false;
                        if (m_oComponentDesignPanel.TechComboBoxSeven.SelectedIndex == 0)
                            isFighter = false;
                        else
                            isFighter = true;

                        #endregion


                        BeamFCProject = new BeamFireControlDefTN("Fire Control S", BR, BT,
                                                                 modR, modT, isPDC, isFighter, Hard, (byte)(m_oComponentDesignPanel.TechComboBoxFive.SelectedIndex + 1));

                        Entry = "N/A";
                        if (BeamFCProject.size >= 10.0f)
                            Entry = String.Format("{0}{1} {2}-{3}", BeamFCProject.Name, BeamFCProject.size, (BeamFCProject.range / 1000.0f), BeamFCProject.tracking);
                        else
                            Entry = String.Format("{0}0{1} {2}-{3}", BeamFCProject.Name, BeamFCProject.size, (BeamFCProject.range / 1000.0f), BeamFCProject.tracking);

                        if (Hard != 1.0f)
                        {
                            Entry = String.Format("{0} H{1}", Entry, (Hard * 100.0f));
                        }

                        if (isPDC == true)
                        {
                            Entry = String.Format("PDC {0}", Entry);
                        }
                        else if (isFighter == true && isPDC == false)
                        {
                            Entry = String.Format("{0} (FTR)", Entry);
                        }

                        m_oComponentDesignPanel.TechNameTextBox.Text = Entry;
                        BeamFCProject.Name = Entry;

                        String FormattedRange = BeamFCProject.range.ToString("#,##0");
                        Entry = String.Format("50% Accuracy at Range: {0} km     Tracking Speed: {1} km/s\n", FormattedRange, BeamFCProject.tracking);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        if (m_oComponentDesignPanel.SizeTonsCheckBox.Checked == true)
                            Entry = String.Format("Size: {0} Tons    HTK: {1}    Cost: {2}    Crew: {3}\n", (BeamFCProject.size * 50.0f), BeamFCProject.htk, BeamFCProject.cost, BeamFCProject.crew);
                        else
                            Entry = String.Format("Size: {0} HS    HTK: {1}    Cost: {2}    Crew: {3}\n", BeamFCProject.size, BeamFCProject.htk, BeamFCProject.cost, BeamFCProject.crew);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Chance of destruction by electronic damage: {0}%\n", (Hard * 100.0f));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Materials Required:");

                        for (int mineralIterator = 0; mineralIterator < (int)Constants.Minerals.MinerialNames.MinerialCount; mineralIterator++)
                        {
                            if (BeamFCProject.minerialsCost[mineralIterator] != 0)
                            {
                                Entry = String.Format("{0} {1:N1}x {2}", Entry, BeamFCProject.minerialsCost[mineralIterator], (Constants.Minerals.MinerialNames)mineralIterator);
                            }
                        }
                        Entry = String.Format("{0}\n\n", Entry);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Development Cost for Project: {0}RP\n", BeamFCProject.cost * 10);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                    }
                    break;
                #endregion

                #region CIWS
                case ComponentsViewModel.Components.CIWS:
                    /// <summary>
                    /// Sanity check.
                    /// </summary>
                    if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxFive.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxSix.SelectedIndex != -1)
                    {
                        FactTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.GaussCannonROF];
                        if (FactTech > 6)
                            FactTech = 6;

                        int GR = FactTech - m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex;

                        FactTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.BeamFireControlRange];

                        if (FactTech > 11)
                            FactTech = 11;

                        int BR = FactTech - m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex;

                        FactTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.BeamFireControlTracking];

                        if (FactTech > 11)
                            FactTech = 11;

                        int BT = FactTech - m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex;

                        FactTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.ActiveSensorStrength];

                        if (FactTech > 11)
                            FactTech = 11;

                        int AS = FactTech - m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex;

                        FactTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.TurretTracking];

                        if (FactTech > 11)
                            FactTech = 11;

                        int TT = FactTech - m_oComponentDesignPanel.TechComboBoxFive.SelectedIndex;

                        FactTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.ECCM];

                        if (FactTech > 10)
                            FactTech = 10;

                        int ECCM = FactTech - m_oComponentDesignPanel.TechComboBoxSix.SelectedIndex;

                        Entry = "CIWS";

                        CloseInProject = new CIWSDefTN(Entry, GR, BR, BT, AS, TT, ECCM);

                        Entry = String.Format("CIWS-{0}", (CloseInProject.tracking / 100)); ;
                        CloseInProject.Name = Entry;
                        m_oComponentDesignPanel.TechNameTextBox.Text = Entry;

                        Entry = String.Format("Rate of Fire: {0} shots every 5 seconds\n", CloseInProject.rOF);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        float GearCount = (float)CloseInProject.tracking / Constants.BFCTN.BeamFireControlTracking[CloseInProject.turretGearTech];
                        float FCfactor = ((float)Constants.BFCTN.BeamFireControlRange[CloseInProject.beamFCRangeTech] * 1000.0f) / 20000.0f;
                        float CIWS_ECCM = 0.0f;
                        if (CloseInProject.eCCM != 0)
                            CIWS_ECCM = 0.5f;

                        String TurretSize = String.Format("{0:N2}", (GearCount * 0.5f));
                        String FCSize = String.Format("{0:N4}", (1.0f / FCfactor));
                        String SensorSize = String.Format("{0:N4}", (3.0f / (float)Constants.SensorTN.ActiveStrength[CloseInProject.activeStrengthTech]));
                        String ECCMSize = String.Format("{0}", CIWS_ECCM);

                        Entry = String.Format("Dual GC: 5HS Turret: {0} HS    Fire Control: {1} HS    Sensor {2} HS    ECCM: {3}\n", TurretSize, FCSize, SensorSize, ECCMSize);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        if (m_oComponentDesignPanel.SizeTonsCheckBox.Checked == true)
                            Entry = String.Format("Overall Size: {0:N1} Tons    HTK: {1}\n", (CloseInProject.size * 50.0f), CloseInProject.htk);
                        else
                            Entry = String.Format("Overall Size: {0:N1} HS    HTK: {1}\n", CloseInProject.size, CloseInProject.htk);

                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Tracking Speed: {0} km/s     ECCM Level: {1}\n", CloseInProject.tracking, CloseInProject.eCCM);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Cost: {0}    Crew: {1}\n", CloseInProject.cost, CloseInProject.crew);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Materials Required:");

                        for (int mineralIterator = 0; mineralIterator < (int)Constants.Minerals.MinerialNames.MinerialCount; mineralIterator++)
                        {
                            if (CloseInProject.minerialsCost[mineralIterator] != 0)
                            {
                                Entry = String.Format("{0} {1:N1}x {2}", Entry, CloseInProject.minerialsCost[mineralIterator], (Constants.Minerals.MinerialNames)mineralIterator);
                            }
                        }
                        Entry = String.Format("{0}\n", Entry);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Base Chance to Hit: 50%\nDevelopment Cost for Project: {0}RP\n", CloseInProject.cost * 10);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                    }
                    break;
                #endregion

                #region Cloak
                case ComponentsViewModel.Components.Cloak:
                    break;
                #endregion

                #region EM
                case ComponentsViewModel.Components.EM:

                    if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex != -1)
                    {
                        #region Size
                        /// <summary>
                        /// Pull size out of this mess.
                        /// </summary>
                        if (m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex < 9)
                        {
                            Size = (float)(m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex + 1) / 10.0f;
                        }
                        else if (m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex >= 9 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex <= 13)
                        {
                            Size = 1.0f + (float)((m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex - 9) * 2) / 10.0f;
                        }
                        else if (m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex >= 14 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex <= 25)
                        {
                            Size = 2.0f + (float)(((m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex - 14) * 25) / 100.0f);
                        }
                        else if (m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex > 25)
                        {
                            Size = (float)(m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex - 21);
                        }
                        #endregion

                        #region Hardening
                        /// <summary>
                        /// Get chance of destruction due to electronic damage.
                        /// </summary>
                        switch (m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex)
                        {
                            case 0:
                                Hard = 1.0f;
                                break;
                            case 1:
                                Hard = 0.7f;
                                break;
                            case 2:
                                Hard = 0.5f;
                                break;
                            case 3:
                                Hard = 0.4f;
                                break;
                            case 4:
                                Hard = 0.3f;
                                break;
                            case 5:
                                Hard = 0.25f;
                                break;
                            case 6:
                                Hard = 0.2f;
                                break;
                            case 7:
                                Hard = 0.15f;
                                break;
                            case 8:
                                Hard = 0.1f;
                                break;
                        }
                        #endregion

                        FactTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.EMSensorSensitivity];

                        if (FactTech > 11)
                            FactTech = 11;

                        int EM = FactTech - m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex;

                        Entry = "EM Detection Sensor EM";
                        PassiveSensorProject = new PassiveSensorDefTN(Entry, Size, Constants.SensorTN.PassiveStrength[EM], PassiveSensorType.EM, Hard,
                                                                     (byte)(m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex + 1));

                        if (Hard == 1.0f)
                            Entry = String.Format("{0}{1}-{2}", Entry, Size, PassiveSensorProject.rating);
                        else
                            Entry = String.Format("{0}{1}-{2}({3}%)", Entry, Size, PassiveSensorProject.rating, (Hard * 100.0f));

                        m_oComponentDesignPanel.TechNameTextBox.Text = Entry;

                        Entry = String.Format("EM Sensitivity: {0}\n", PassiveSensorProject.rating);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        if (m_oComponentDesignPanel.SizeTonsCheckBox.Checked == true)
                            Entry = String.Format("Sensor Size: {0} Tons    Sensor HTK: {1}\n", (PassiveSensorProject.size * 50.0f), PassiveSensorProject.htk);
                        else
                            Entry = String.Format("Sensor Size: {0} HS    Sensor HTK: {1}\n", PassiveSensorProject.size, PassiveSensorProject.htk);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Chance of destruction by electronic damage: {0}%\n", (Hard * 100.0f));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Cost: {0}    Crew: {1}\n", PassiveSensorProject.cost, PassiveSensorProject.crew);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Materials Required:");

                        for (int mineralIterator = 0; mineralIterator < (int)Constants.Minerals.MinerialNames.MinerialCount; mineralIterator++)
                        {
                            if (PassiveSensorProject.minerialsCost[mineralIterator] != 0)
                            {
                                Entry = String.Format("{0} {1:N1}x {2}", Entry, PassiveSensorProject.minerialsCost[mineralIterator], (Constants.Minerals.MinerialNames)mineralIterator);
                            }
                        }
                        Entry = String.Format("{0}\n\n", Entry);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Development Cost for Project: {0}RP", (PassiveSensorProject.cost * 10));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);


                    }



                    break;
                #endregion

                #region Engines
                case ComponentsViewModel.Components.Engine:

                    /// <summary>
                    /// Sanity check.
                    /// </summary>
                    if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxFive.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxSix.SelectedIndex != -1)
                    {

                        #region Engine Name

                        FactTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.EngineBaseTech];

                        if (FactTech > 12)
                            FactTech = 12;

                        int EngineBase = FactTech - m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex;


                        switch (EngineBase)
                        {
                            case 0:
                                Entry = "Conventional Engine";
                                break;
                            case 1:
                                Entry = "Nuclear Thermal Engine";
                                break;
                            case 2:
                                Entry = "Nuclear Pulse Engine";
                                break;
                            case 3:
                                Entry = "Ion Drive";
                                break;
                            case 4:
                                Entry = "Magneto-Plasma Drive";
                                break;
                            case 5:
                                Entry = "Internal Fusion Drive";
                                break;
                            case 6:
                                Entry = "Magnetic Fusion Drive";
                                break;
                            case 7:
                                Entry = "Inertial Fusion Drive";
                                break;
                            case 8:
                                Entry = "Solid-Core Antimatter Drive";
                                break;
                            case 9:
                                Entry = "Gas-Core Antimatter Drive";
                                break;
                            case 10:
                                Entry = "Plasma-Core Antimatter Drive";
                                break;
                            case 11:
                                Entry = "Beam-Core Antimatter Drive";
                                break;
                            case 12:
                                Entry = "Photonic Drive";
                                break;
                        }

                        #endregion

                        #region Power Mod
                        int MinPowerTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.MinEnginePowerMod];
                        int MaxPowerTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.MaxEnginePowerMod];

                        if (MinPowerTech > 5)
                            MinPowerTech = 5;
                        if (MaxPowerTech > 5)
                            MaxPowerTech = 5;

                        int minPower = 50;
                        switch (MinPowerTech)
                        {
                            case 0:
                                minPower = 40;
                                break;
                            case 1:
                                minPower = 30;
                                break;
                            case 2:
                                minPower = 25;
                                break;
                            case 3:
                                minPower = 20;
                                break;
                            case 4:
                                minPower = 15;
                                break;
                            case 5:
                                minPower = 10;
                                break;
                        }

                        float Power = (float)(minPower + (5 * m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex)) / 100.0f;

                        #endregion

                        #region Fuel Consumption

                        FactTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.FuelConsumption];

                        if (FactTech > 12)
                            FactTech = 12;

                        int FC = FactTech - m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex;

                        #endregion

                        #region Thermal Reduction

                        int TR = m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex;

                        #endregion

                        #region HyperDrive

                        float HD = -1.0f;
                        if (m_oComponentDesignPanel.TechComboBoxSix.SelectedIndex != 0)
                        {
                            FactTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.HyperdriveSizeMod];

                            if (FactTech > 10)
                                FactTech = 10;

                            HD = Constants.EngineTN.HyperDriveSize[(FactTech - (m_oComponentDesignPanel.TechComboBoxSix.SelectedIndex - 1))];
                        }

                        #endregion

                        EngineProject = new EngineDefTN(Entry, Constants.EngineTN.EngineBase[EngineBase], Power, Constants.EngineTN.FuelConsumption[FC],
                                                        Constants.EngineTN.ThermalReduction[TR], (byte)(TR + 1), (m_oComponentDesignPanel.TechComboBoxFive.SelectedIndex + 1), HD);

                        Entry = String.Format("{0} EP {1}", EngineProject.enginePower, Entry);


                        if (EngineProject.isMilitary == false)
                        {
                            Entry = String.Format("Commercial {0}", Entry);
                        }
                        else
                        {
                            Entry = String.Format("Military {0}", Entry);
                        }

                        m_oComponentDesignPanel.TechNameTextBox.Text = Entry;
                        EngineProject.Name = Entry;

                        Entry = String.Format("Engine Power: {0}     Fuel Use Per Hour: {1:N2} Litres\n", EngineProject.enginePower, EngineProject.fuelUsePerHour);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Fuel Consumption per Engine Power Hour: {0:N3} Litres\n", (EngineProject.fuelUsePerHour / EngineProject.enginePower));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        if (m_oComponentDesignPanel.SizeTonsCheckBox.Checked == true)
                            Entry = String.Format("Engine Size: {0} Tons    Engine HTK: {1}\n", (EngineProject.size * 50.0f), EngineProject.htk);
                        else
                            Entry = String.Format("Engine Size: {0} HS    Engine HTK: {1}\n", EngineProject.size, EngineProject.htk);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Thermal Signature: {0}     Exp Chance: {1}\n", EngineProject.thermalSignature, EngineProject.expRisk);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Cost: {0}    Crew: {1}\n", EngineProject.cost, EngineProject.crew);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Materials Required:");

                        for (int mineralIterator = 0; mineralIterator < (int)Constants.Minerals.MinerialNames.MinerialCount; mineralIterator++)
                        {
                            if (EngineProject.minerialsCost[mineralIterator] != 0)
                            {
                                Entry = String.Format("{0} {1:N1}x {2}", Entry, EngineProject.minerialsCost[mineralIterator], (Constants.Minerals.MinerialNames)mineralIterator);
                            }
                        }
                        Entry = String.Format("{0}\n", Entry);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        if (EngineProject.isMilitary == true)
                        {
                            Entry = String.Format("Military Engine\n");
                            m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                        }
                        if (EngineProject.hyperDriveMod != -1.0f)
                        {
                            Entry = String.Format("Hyper Drive\n");
                            m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                        }

                        Entry = String.Format("\nDevelopment Cost for Project: {0}RP\n", (EngineProject.cost * 10));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                    }
                    break;
                #endregion

                #region Gauss Cannon
                case ComponentsViewModel.Components.Gauss:
                    /// <summary>
                    /// Sanity check.
                    /// </summary>
                    if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex != -1)
                    {
                        int GaussROF = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.GaussCannonROF];
                        int GaussVel = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.GaussCannonVelocity];

                        if (GaussROF > 6)
                            GaussROF = 6;

                        if (GaussVel > 5)
                            GaussVel = 5;

                        int GR = GaussROF - m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex;

                        int GV = GaussVel - m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex;

                        int GA = m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex;

                        Entry = String.Format("Gauss Cannon R{0}-{1}", (GV + 1), (Constants.BeamWeaponTN.GaussAccuracy[GA] * 100.0f));
                        BeamProject = new BeamDefTN(Entry, ComponentTypeTN.Gauss, (byte)GA, (byte)GV, (byte)GR, 1.0f);

                        m_oComponentDesignPanel.TechNameTextBox.Text = Entry;

                        Entry = String.Format("Damage Output 1     Rate of Fire: {0} shots every 5 seconds     Range Modifier: {1}\n", BeamProject.shotCount, (BeamProject.weaponRangeTech + 1));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        String FormattedRange = BeamProject.range.ToString("#,###0");
                        if (m_oComponentDesignPanel.SizeTonsCheckBox.Checked == true)
                            Entry = String.Format("Max Range {0} km     Size: {1} Tons    HTK: {2}\n", FormattedRange, (BeamProject.size * 50.0f), BeamProject.htk);
                        else
                            Entry = String.Format("Max Range {0} km     Size: {1} HS    HTK: {2}\n", FormattedRange, BeamProject.size, BeamProject.htk);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Cost: {0}    Crew: {1}\n", BeamProject.cost, BeamProject.crew);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Materials Required:");

                        for (int mineralIterator = 0; mineralIterator < (int)Constants.Minerals.MinerialNames.MinerialCount; mineralIterator++)
                        {
                            if (BeamProject.minerialsCost[mineralIterator] != 0)
                            {
                                Entry = String.Format("{0} {1:N1}x {2}", Entry, BeamProject.minerialsCost[mineralIterator], (Constants.Minerals.MinerialNames)mineralIterator);
                            }
                        }
                        Entry = String.Format("{0}\n", Entry);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        if (BeamProject.size != 6.0f)
                        {
                            Entry = String.Format("This weapon has a penalty to accuracy. Chance to hit is multiplied by {0}\n", Constants.BeamWeaponTN.GaussAccuracy[GA]);
                            m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                        }
                        Entry = String.Format("\nDevelopment Cost for Project: {0}RP\n", (BeamProject.cost * 50));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                    }
                    break;
                #endregion

                #region High Power Microwave
                case ComponentsViewModel.Components.Microwave:
                    /// <summary>
                    /// Sanity check.
                    /// </summary>
                    if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex != -1)
                    {
                        int MicroTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.MicrowaveFocal];
                        int MicroFocusTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.MicrowaveFocusing];
                        int CapTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.CapacitorChargeRate];

                        if (MicroTech > 11)
                            MicroTech = 11;
                        if (MicroFocusTech > 11)
                            MicroFocusTech = 11;
                        if (CapTech > 11)
                            CapTech = 11;

                        int Cal = MicroTech - m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex;
                        ComponentTypeTN BeamType = ComponentTypeTN.Meson;
                        int Cap = CapTech - m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex;
                        int Foc = MicroFocusTech - m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex;

                        BeamProject = new BeamDefTN("Microwave", BeamType, (byte)Cal, (byte)Foc, (byte)Cap, 1.0f);

                        float RangeAdjust = BeamProject.range / 10000.0f;

                        Entry = String.Format("R{0}/C{1} High Power Microwave", RangeAdjust, BeamProject.weaponCapacitor);
                        BeamProject.Name = Entry;

                        m_oComponentDesignPanel.TechNameTextBox.Text = Entry;

                        String FormattedRange = BeamProject.range.ToString("#,###0");
                        Entry = String.Format("Max Range {0} km     Rate of Fire: {1} seconds     Focus Modifier: {2}\n", FormattedRange, BeamProject.rof, (BeamProject.weaponRangeTech + 1));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        if (m_oComponentDesignPanel.SizeTonsCheckBox.Checked == true)
                            Entry = String.Format("HPM Size: {0} Tons    HTK: {1}\n", (BeamProject.size * 50.0f), BeamProject.htk);
                        else
                            Entry = String.Format("HPM Size: {0} HS    HTK: {1}\n", BeamProject.size, BeamProject.htk);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Power Requirement: {0}    Power Recharge per 5 Secs: {1}\n", BeamProject.powerRequirement, BeamProject.weaponCapacitor);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Cost: {0}    Crew: {1}\n", BeamProject.cost, BeamProject.crew);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Materials Required:");

                        for (int mineralIterator = 0; mineralIterator < (int)Constants.Minerals.MinerialNames.MinerialCount; mineralIterator++)
                        {
                            if (BeamProject.minerialsCost[mineralIterator] != 0)
                            {
                                Entry = String.Format("{0} {1:N1}x {2}", Entry, BeamProject.minerialsCost[mineralIterator], (Constants.Minerals.MinerialNames)mineralIterator);
                            }
                        }
                        Entry = String.Format("{0}\n", Entry);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("\nDevelopment Cost for Project: {0}RP\n", (BeamProject.cost * 50));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                    }
                    break;
                #endregion

                #region Jump Engines
                case ComponentsViewModel.Components.Jump:
                    /// <summary>
                    /// Sanity check.
                    /// </summary>
                    if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxFive.SelectedIndex != -1)
                    {
                        int JumpEffTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.JumpEngineEfficiency];
                        int SquadSizeTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.MaxSquadJumpSize];
                        int JumpRadiusTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.MaxSquadJumpRadius];
                        int MinSizeTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.MinJumpEngineSize];

                        if (JumpEffTech > Constants.JumpEngineTN.JumpEfficiencyMax)
                            JumpEffTech = Constants.JumpEngineTN.JumpEfficiencyMax;
                        if (SquadSizeTech > Constants.JumpEngineTN.SquadSizeMax)
                            SquadSizeTech = Constants.JumpEngineTN.SquadSizeMax;
                        if (JumpRadiusTech > Constants.JumpEngineTN.JumpRadiusMax)
                            JumpRadiusTech = Constants.JumpEngineTN.JumpRadiusMax;
                        if (MinSizeTech > Constants.JumpEngineTN.MinimumSizeMax)
                            MinSizeTech = Constants.JumpEngineTN.MinimumSizeMax;

                        int Eff = JumpEffTech - m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex;
                        int SquadSize = SquadSizeTech - m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex;
                        int JumpRadius = JumpRadiusTech - m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex;

                        int JESize = 1;
                        int Count = 0;
                        while (JESize <= 1000)
                        {
                            if(Count == m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex)
                            {
                                break;
                            }

                            if (JESize < 50)
                                JESize++;
                            else if (JESize < 100)
                                JESize += 5;
                            else
                                JESize += 10;

                            Count++;
                        }
                        JumpEngineDefTN.JDType JumpType = (JumpEngineDefTN.JDType)m_oComponentDesignPanel.TechComboBoxFive.SelectedIndex;

                        JumpEngineProject = new JumpEngineDefTN("JumpEngine", Eff, SquadSize, JumpRadius, MinSizeTech, JumpType, JESize);

                        if (JumpType == JumpEngineDefTN.JDType.Military)
                        {
                            int JR = (int)Math.Round((float)JumpEngineProject.jumpRadius / 1000.0f);
                            Entry = String.Format("J{0}({1}-{2}) Military Jump Drive",JumpEngineProject.maxJumpRating, JumpEngineProject.squadronSize, JR);
                            JumpEngineProject.Name = Entry;
                        }
                        else if (JumpType == JumpEngineDefTN.JDType.Commercial)
                        {
                            int CSize = (int)Math.Round((float)JumpEngineProject.maxJumpRating / 1000.0f);
                            Entry = String.Format("JC{0}K Commerical Jump Drive", CSize);
                            JumpEngineProject.Name = Entry;
                        }
                        m_oComponentDesignPanel.TechNameTextBox.Text = Entry;

                        int SSize = JumpEngineProject.maxJumpRating / (int)Constants.ShipTN.TonsPerHS;
                        int JRadius = (int)Math.Round((float)JumpEngineProject.jumpRadius / 1000.0f);
                        Entry = String.Format("Max Ship Size: {0} ({1} tons)     Max Squadron Size: {2}     Max Jump Radius: {3}\n", SSize, JumpEngineProject.maxJumpRating, 
                                              JumpEngineProject.squadronSize, JRadius );
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        if (m_oComponentDesignPanel.SizeTonsCheckBox.Checked == true)
                            Entry = String.Format("Jump Engine Size: {0} Tons    Efficiency: {1}    Jump Engine HTK: {2}\n", JumpEngineProject.size * (int)Constants.ShipTN.TonsPerHS, 
                                                  JumpEngineProject.jumpEngineEfficiency, JumpEngineProject.htk);
                        else
                            Entry = String.Format("Jump Engine Size: {0} HS    Efficiency: {1}    Jump Engine HTK: {2}\n", JumpEngineProject.size, JumpEngineProject.jumpEngineEfficiency,
                                                  JumpEngineProject.htk);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Cost: {0}    Crew: {1}\n", JumpEngineProject.cost, JumpEngineProject.crew);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Materials Required:");

                        for (int mineralIterator = 0; mineralIterator < (int)Constants.Minerals.MinerialNames.MinerialCount; mineralIterator++)
                        {
                            if (JumpEngineProject.minerialsCost[mineralIterator] != 0)
                            {
                                Entry = String.Format("{0} {1:N1}x {2}", Entry, JumpEngineProject.minerialsCost[mineralIterator], (Constants.Minerals.MinerialNames)mineralIterator);
                            }
                        }
                        Entry = String.Format("{0}\n", Entry);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("\nDevelopment Cost for Project: {0}RP\n", (JumpEngineProject.cost * 50));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                    }
                    break;
                #endregion

                #region Lasers
                case ComponentsViewModel.Components.Laser:
                    /// <summary>
                    /// Sanity check.
                    /// </summary>
                    if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxFive.SelectedIndex != -1)
                    {
                        int AdvLaserTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.AdvancedLaserFocal];
                        int LaserTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.LaserFocal];
                        int WaveTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.LaserWavelength];
                        int CapTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.CapacitorChargeRate];
                        int ReduceTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.ReducedSizeLasers];
                        int SpinalTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.SpinalMount];

                        if (AdvLaserTech > 11)
                            AdvLaserTech = 11;
                        if (LaserTech > 11)
                            LaserTech = 11;
                        if (WaveTech > 11)
                            WaveTech = 11;
                        if (CapTech > 11)
                            CapTech = 11;
                        if (ReduceTech > 1)
                            ReduceTech = 1;
                        if (SpinalTech > 1)
                            SpinalTech = 1;

                        int Cal = -1;
                        ComponentTypeTN BeamType = ComponentTypeTN.TypeCount;
                        int Cap = CapTech - m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex;
                        int Vel = WaveTech - m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex;
                        int Reduce = (ReduceTech - m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex + 1);
                        int Spinal = (SpinalTech - m_oComponentDesignPanel.TechComboBoxFive.SelectedIndex + 1);
                        float red = 1.0f;
                        BeamDefTN.MountType MType = BeamDefTN.MountType.Standard;

                        if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex > AdvLaserTech)
                        {
                            Cal = LaserTech - (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex - AdvLaserTech - 1);
                            BeamType = ComponentTypeTN.Laser;

                            float Capacitor = Constants.BeamWeaponTN.Capacitor[Cap];
                            switch (Reduce)
                            {
                                case 1:
                                    Capacitor = Capacitor / 4.0f;
                                    red = 0.75f;
                                    break;
                                case 0:
                                    Capacitor = Capacitor / 20.0f;
                                    red = 0.5f;
                                    break;
                            }

                            String CapString = "N/A";
                            if (red == 1.0f)
                                CapString = String.Format("{0}", Capacitor);
                            else
                                CapString = String.Format("{0:N1}", Capacitor);


                            String Calibre = Constants.BeamWeaponTN.SizeClass[Cal].ToString();
                            switch (Spinal)
                            {
                                case 1:
                                    MType = BeamDefTN.MountType.Spinal;
                                    Calibre = Math.Round(Constants.BeamWeaponTN.SizeClass[Cal] * 1.25f).ToString();
                                    break;
                                case 0:
                                    MType = BeamDefTN.MountType.AdvancedSpinal;
                                    Calibre = Math.Round(Constants.BeamWeaponTN.SizeClass[Cal] * 1.5f).ToString();
                                    break;
                            }


                            Entry = String.Format("{0}cm C{1} {2}", Calibre, CapString, m_oComponentDesignPanel.TechComboBoxTwo.SelectedItem);


                        }
                        else
                        {
                            Cal = AdvLaserTech - m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex;
                            BeamType = ComponentTypeTN.AdvLaser;

                            float Capacitor = Constants.BeamWeaponTN.Capacitor[Cap];
                            switch (Reduce)
                            {
                                case 1:
                                    Capacitor = Capacitor / 4.0f;
                                    red = 0.75f;
                                    break;
                                case 0:
                                    Capacitor = Capacitor / 20.0f;
                                    red = 0.5f;
                                    break;
                            }

                            String CapString = "N/A";
                            if (red == 1.0f)
                                CapString = String.Format("{0}", Capacitor);
                            else
                                CapString = String.Format("{0:N1}", Capacitor);


                            String Calibre = Constants.BeamWeaponTN.SizeClass[Cal].ToString();
                            switch (Spinal)
                            {
                                case 1:
                                    MType = BeamDefTN.MountType.Spinal;
                                    Calibre = Math.Round(Constants.BeamWeaponTN.SizeClass[Cal] * 1.25f).ToString();
                                    break;
                                case 0:
                                    MType = BeamDefTN.MountType.AdvancedSpinal;
                                    Calibre = Math.Round(Constants.BeamWeaponTN.SizeClass[Cal] * 1.5f).ToString();
                                    break;
                            }


                            Entry = String.Format("{0}cm C{1} Advanced {2}", Calibre, CapString, m_oComponentDesignPanel.TechComboBoxTwo.SelectedItem);
                        }
                        m_oComponentDesignPanel.TechNameTextBox.Text = Entry;

                        BeamProject = new BeamDefTN(Entry, BeamType, (byte)Cal, (byte)Vel, (byte)Cap, red, MType);

                        Entry = String.Format("Damage Output {0}     Rate of Fire: {1} seconds     Range Modifier: {2}\n", BeamProject.damage[0], BeamProject.rof, (Vel + 1));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        String FormattedRange = BeamProject.range.ToString("#,###0");

                        if (m_oComponentDesignPanel.SizeTonsCheckBox.Checked == true)
                            Entry = String.Format("Max Range {0} km     Laser Size: {1} Tons    Laser HTK: {2}\n", FormattedRange, (BeamProject.size * 50.0f), BeamProject.htk);
                        else
                            Entry = String.Format("Max Range {0} km     Laser Size: {1} HS    Laser HTK: {2}\n", FormattedRange, BeamProject.size, BeamProject.htk);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Power Requirement: {0}    Power Recharge per 5 Secs: {1}\n", BeamProject.powerRequirement, BeamProject.weaponCapacitor);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Cost: {0}    Crew: {1}\n", BeamProject.cost, BeamProject.crew);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        if (Spinal != 2)
                        {
                            m_oComponentDesignPanel.ParametersTextBox.AppendText("Spinal Weapon Only\n");
                        }

                        Entry = String.Format("Materials Required:");

                        for (int mineralIterator = 0; mineralIterator < (int)Constants.Minerals.MinerialNames.MinerialCount; mineralIterator++)
                        {
                            if (BeamProject.minerialsCost[mineralIterator] != 0)
                            {
                                Entry = String.Format("{0} {1:N1}x {2}", Entry, BeamProject.minerialsCost[mineralIterator], (Constants.Minerals.MinerialNames)mineralIterator);
                            }
                        }
                        Entry = String.Format("{0}\n", Entry);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("\nDevelopment Cost for Project: {0}RP\n", (BeamProject.cost * 50));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                    }
                    break;
                #endregion

                #region Magazines
                case ComponentsViewModel.Components.Magazine:

                    /// <summary>
                    /// Sanity check.
                    /// </summary>
                    if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxFive.SelectedIndex != -1)
                    {
                        int FeedTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.MagazineFeedEfficiency];
                        int EjectTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.MagazineEjectionSystem];
                        int ArmourTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.ArmourProtection];

                        if (FeedTech > 8)
                            FeedTech = 8;
                        if (EjectTech > 8)
                            EjectTech = 8;
                        if (ArmourTech > 12)
                            ArmourTech = 12;

                        int feed = FeedTech - m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex;
                        int eject = EjectTech - m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex;
                        int armour = ArmourTech - m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex;
                        int size = m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex + 1;
                        int htk = m_oComponentDesignPanel.TechComboBoxFive.SelectedIndex + 1;

                        Entry = "Magazine";
                        MagazineProject = new MagazineDefTN(Entry, (float)size, (byte)htk, feed, eject, armour);

                        Entry = String.Format("Capacity {0} Magazine: Exp {1}%  HTK{2}", MagazineProject.capacity, Math.Round((1.0f - Constants.MagazineTN.Ejection[eject]) * 100.0f), htk);
                        MagazineProject.Name = Entry;

                        m_oComponentDesignPanel.TechNameTextBox.Text = Entry;

                        switch (MagazineProject.armorTech)
                        {
                            case 0:
                                Entry = "Conventional";
                                break;
                            case 1:
                                Entry = "Duranium";
                                break;
                            case 2:
                                Entry = "High Density Duranium";
                                break;
                            case 3:
                                Entry = "Composite";
                                break;
                            case 4:
                                Entry = "Ceramic Composite";
                                break;
                            case 5:
                                Entry = "Laminate Composite";
                                break;
                            case 6:
                                Entry = "Compressed Carbon";
                                break;
                            case 7:
                                Entry = "Biphased Carbide";
                                break;
                            case 8:
                                Entry = "Crystaline Composite";
                                break;
                            case 9:
                                Entry = "Superdense";
                                break;
                            case 10:
                                Entry = "Bonded Superdense";
                                break;
                            case 11:
                                Entry = "Coherent Superdense";
                                break;
                            case 12:
                                Entry = "Collapsium";
                                break;
                        }

                        String ArmourString = String.Format("{0} Armour", Entry);

                        Entry = String.Format("Capacity: {0}     Internal Armour: {1} HS     Explosion Chance: {2}\nArmour used: {3}\n", MagazineProject.capacity, MagazineProject.armourFactor,
                                              Math.Round((1.0f - Constants.MagazineTN.Ejection[eject]) * 100.0f), ArmourString);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        if (m_oComponentDesignPanel.SizeTonsCheckBox.Checked == true)
                            Entry = String.Format("Magazine Size: {0} Tons    Magazine HTK: {1}\n", (MagazineProject.size * 50.0f), MagazineProject.htk);
                        else
                            Entry = String.Format("Magazine Size: {0} HS    Magazine HTK: {1}\n", MagazineProject.size, MagazineProject.htk);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Cost: {0}    Crew: {1}\n", MagazineProject.cost, MagazineProject.crew);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Materials Required:");

                        for (int mineralIterator = 0; mineralIterator < (int)Constants.Minerals.MinerialNames.MinerialCount; mineralIterator++)
                        {
                            if (MagazineProject.minerialsCost[mineralIterator] != 0)
                            {
                                Entry = String.Format("{0} {1:N1}x {2}", Entry, MagazineProject.minerialsCost[mineralIterator], (Constants.Minerals.MinerialNames)mineralIterator);
                            }
                        }
                        Entry = String.Format("{0}\n", Entry);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("\nDevelopment Cost for Project: {0}RP\n", (MagazineProject.cost * 10));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        //FormattedRange = RangeFormat.ToString("#,##0");
                    }
                    break;
                #endregion

                #region Meson Cannons
                case ComponentsViewModel.Components.Meson:
                    /// <summary>
                    /// Sanity check.
                    /// </summary>
                    if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex != -1)
                    {
                        int MesonTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.MesonFocal];
                        int MesonFocusTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.MesonFocusing];
                        int CapTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.CapacitorChargeRate];

                        if (MesonTech > 11)
                            MesonTech = 11;
                        if (MesonFocusTech > 11)
                            MesonFocusTech = 11;
                        if (CapTech > 11)
                            CapTech = 11;

                        int Cal = MesonTech - m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex;
                        ComponentTypeTN BeamType = ComponentTypeTN.Meson;
                        int Cap = CapTech - m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex;
                        int Foc = MesonFocusTech - m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex;

                        BeamProject = new BeamDefTN("Meson", BeamType, (byte)Cal, (byte)Foc, (byte)Cap, 1.0f);

                        float RangeAdjust = BeamProject.range / 10000.0f;

                        Entry = String.Format("R{0}/C{1} Meson Cannon", RangeAdjust, BeamProject.weaponCapacitor);
                        BeamProject.Name = Entry;

                        m_oComponentDesignPanel.TechNameTextBox.Text = Entry;

                        String FormattedRange = BeamProject.range.ToString("#,###0");
                        Entry = String.Format("Max Range {0} km     Rate of Fire: {1} seconds     Focus Modifier: {2}\n", FormattedRange, BeamProject.rof, (BeamProject.weaponRangeTech + 1));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        if (m_oComponentDesignPanel.SizeTonsCheckBox.Checked == true)
                            Entry = String.Format("Meson Cannon Size: {0} Tons    Meson Cannon HTK: {1}\n", (BeamProject.size * 50.0f), BeamProject.htk);
                        else
                            Entry = String.Format("Meson Cannon Size: {0} HS    Meson Cannon HTK: {1}\n", BeamProject.size, BeamProject.htk);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Power Requirement: {0}    Power Recharge per 5 Secs: {1}\n", BeamProject.powerRequirement, BeamProject.weaponCapacitor);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Cost: {0}    Crew: {1}\n", BeamProject.cost, BeamProject.crew);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Materials Required:");

                        for (int mineralIterator = 0; mineralIterator < (int)Constants.Minerals.MinerialNames.MinerialCount; mineralIterator++)
                        {
                            if (BeamProject.minerialsCost[mineralIterator] != 0)
                            {
                                Entry = String.Format("{0} {1:N1}x {2}", Entry, BeamProject.minerialsCost[mineralIterator], (Constants.Minerals.MinerialNames)mineralIterator);
                            }
                        }
                        Entry = String.Format("{0}\n", Entry);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("\nDevelopment Cost for Project: {0}RP\n", (BeamProject.cost * 50));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                    }
                    break;
                #endregion

                #region Missile Engines
                case ComponentsViewModel.Components.MissileEngine:
                    /// <summary>
                    /// Sanity Check:
                    /// </summary>
                    if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex != -1)
                    {
                        #region Missile Engine Name / Tech Base

                        FactTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.EngineBaseTech];

                        if (FactTech > 12)
                            FactTech = 12;

                        int EngineBase = FactTech - m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex;


                        switch (EngineBase)
                        {
                            case 0:
                                Entry = "Conventional Engine";
                                break;
                            case 1:
                                Entry = "Nuclear Thermal Engine";
                                break;
                            case 2:
                                Entry = "Nuclear Pulse Engine";
                                break;
                            case 3:
                                Entry = "Ion Drive";
                                break;
                            case 4:
                                Entry = "Magneto-Plasma Drive";
                                break;
                            case 5:
                                Entry = "Internal Fusion Drive";
                                break;
                            case 6:
                                Entry = "Magnetic Fusion Drive";
                                break;
                            case 7:
                                Entry = "Inertial Fusion Drive";
                                break;
                            case 8:
                                Entry = "Solid-Core Antimatter Drive";
                                break;
                            case 9:
                                Entry = "Gas-Core Antimatter Drive";
                                break;
                            case 10:
                                Entry = "Plasma-Core Antimatter Drive";
                                break;
                            case 11:
                                Entry = "Beam-Core Antimatter Drive";
                                break;
                            case 12:
                                Entry = "Photonic Drive";
                                break;
                        }

                        #endregion

                        #region Power Mod
                        int MinPowerTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.MinEnginePowerMod];
                        int MaxPowerTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.MaxEnginePowerMod];

                        if (MinPowerTech > 5)
                            MinPowerTech = 5;
                        if (MaxPowerTech > 5)
                            MaxPowerTech = 5;

                        int minPower = 50;
                        switch (MinPowerTech)
                        {
                            case 0:
                                minPower = 40;
                                break;
                            case 1:
                                minPower = 30;
                                break;
                            case 2:
                                minPower = 25;
                                break;
                            case 3:
                                minPower = 20;
                                break;
                            case 4:
                                minPower = 15;
                                break;
                            case 5:
                                minPower = 10;
                                break;
                        }

                        float Power = (float)(minPower + (5 * m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex)) / 100.0f;
                        #endregion

                        #region Fuel Consumption

                        FactTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.FuelConsumption];

                        if (FactTech > 12)
                            FactTech = 12;

                        int FC = FactTech - m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex;

                        #endregion

                        float size = (10.0f + (float)(m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex)) / 100.0f;

                        if (size < 0.1f)
                            size = 0.1f;

                        MissileEngineProject = new MissileEngineDefTN(Entry, Constants.EngineTN.EngineBase[EngineBase], Power, Constants.EngineTN.FuelConsumption[FC], size);

                        Entry = String.Format("{0} EP {1}", MissileEngineProject.enginePower, Entry);
                        MissileEngineProject.Name = Entry;

                        m_oComponentDesignPanel.TechNameTextBox.Text = Entry;

                        Entry = String.Format("Engine Power: {0:N3}      Fuel Use Per Hour: {1:N2} Litres\n", MissileEngineProject.enginePower, MissileEngineProject.fuelConsumption);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        float EPH = MissileEngineProject.fuelConsumption / MissileEngineProject.enginePower;
                        Entry = String.Format("Fuel Consumption per Engine Power Hour: {0:N3} Litres\n", EPH);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        if (m_oComponentDesignPanel.SizeTonsCheckBox.Checked == true)
                            Entry = String.Format("Engine Size: {0:N2} Tons      Cost: {1}\n", (MissileEngineProject.size * 50.0f), MissileEngineProject.cost);
                        else
                            Entry = String.Format("Engine Size: {0:N2} MSP      Cost: {1}\n", (MissileEngineProject.size * 20.0f), MissileEngineProject.cost);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Thermal Signature: {0:N2}\n", MissileEngineProject.thermalSignature);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Materials Required:");

                        for (int mineralIterator = 0; mineralIterator < (int)Constants.Minerals.MinerialNames.MinerialCount; mineralIterator++)
                        {
                            if (MissileEngineProject.minerialsCost[mineralIterator] != 0)
                            {
                                Entry = String.Format("{0} {1:N1}x {2}", Entry, MissileEngineProject.minerialsCost[mineralIterator], (Constants.Minerals.MinerialNames)mineralIterator);
                            }
                        }
                        Entry = String.Format("{0}\n", Entry);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("\nDevelopment Cost for Project: {0:N0}RP\n", (MissileEngineProject.cost * 200));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                    }
                    break;
                #endregion

                #region Missile Launcher
                case ComponentsViewModel.Components.MissileLauncher:
                    /// <summary>
                    /// Sanity check.
                    /// </summary>
                    if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex != -1)
                    {

                        int ReloadTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.LauncherReloadRate];
                        int ReduceTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.ReducedSizeLaunchers];

                        if (ReloadTech > 11)
                            ReloadTech = 11;
                        if (ReduceTech > 5)
                            ReduceTech = 5;

                        int size = m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex + 1;
                        int reload = (ReloadTech - m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex) + 1;

                        bool ShipPDC = false;
                        if (m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex == 0)
                        {
                            ShipPDC = false;
                            Entry = String.Format("Size {0}", size);
                        }
                        else
                        {
                            ShipPDC = true;
                            Entry = String.Format("PDC Size {0}", size);
                        }

                        int Reduce = m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex;

                        if (Reduce == Constants.LauncherTN.BoxLauncher)
                        {
                            Entry = String.Format("{0} Box Launcher", Entry);
                        }
                        else if (Reduce == 0)
                        {
                            Entry = String.Format("{0} Missile Launcher", Entry);
                        }
                        else
                        {
                            Entry = String.Format("{0} Missile Launcher ({1}% Reduction)", Entry, (Constants.LauncherTN.Reduction[Reduce] * 100.0f));
                        }

                        LauncherProject = new MissileLauncherDefTN(Entry, (float)size, reload, ShipPDC, Reduce);

                        m_oComponentDesignPanel.TechNameTextBox.Text = Entry;

                        Entry = String.Format("Maximum Missile Size: {0}", size);

                        if (Reduce != Constants.LauncherTN.BoxLauncher)
                        {
                            Entry = String.Format("{0}     Rate of Fire: {1} seconds\n", Entry, LauncherProject.rateOfFire);
                        }
                        else
                        {
                            float HR = (float)LauncherProject.hangarReload / 60.0f;
                            float MF = (float)LauncherProject.mFReload / 3600.0f;
                            Entry = String.Format("{0}     Hangar Reload: {1} minutes    MF Reload: {2} hours\n", Entry, HR, MF);
                        }
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        if (m_oComponentDesignPanel.SizeTonsCheckBox.Checked == true)
                            Entry = String.Format("Launcher Size: {0} Tons    Launcher HTK: {1}\n", (LauncherProject.size * 50.0f), LauncherProject.htk);
                        else
                            Entry = String.Format("Launcher Size: {0} HS    Launcher HTK: {1}\n", LauncherProject.size, LauncherProject.htk);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Cost Per Launcher: {0}    Crew Per Launcher: {1}\n", LauncherProject.cost, LauncherProject.crew);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        if (ShipPDC == true)
                        {
                            Entry = "PDC Only\n";
                            m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                        }

                        Entry = String.Format("Materials Required:");

                        for (int mineralIterator = 0; mineralIterator < (int)Constants.Minerals.MinerialNames.MinerialCount; mineralIterator++)
                        {
                            if (LauncherProject.minerialsCost[mineralIterator] != 0)
                            {
                                Entry = String.Format("{0} {1:N1}x {2}", Entry, LauncherProject.minerialsCost[mineralIterator], (Constants.Minerals.MinerialNames)mineralIterator);
                            }
                        }
                        Entry = String.Format("{0}\n", Entry);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("\nDevelopment Cost for Project: {0}RP\n", Math.Round(LauncherProject.cost * 10));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        if (Reduce == Constants.LauncherTN.BoxLauncher)
                        {
                            Entry = "\nNote that Box Launchers are not affected by increases in Reload Rate Technology as they are reloaded externally in a hangar deck or at maintenance facilities\n";
                            m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                        }
                    }
                    break;
                #endregion

                #region New Species
                case ComponentsViewModel.Components.NewSpecies:
                    break;
                #endregion

                #region Particle beams
                case ComponentsViewModel.Components.Particle:
                    /// <summary>
                    /// Sanity check.
                    /// </summary>
                    if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex != -1)
                    {
                        int AdvPartTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.AdvancedParticleBeamStrength];
                        int PartTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.ParticleBeamStrength];
                        int PartRangeTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.ParticleBeamRange];
                        int CapTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.CapacitorChargeRate];

                        if (AdvPartTech > 10)
                            AdvPartTech = 10;
                        if (PartTech > 10)
                            PartTech = 10;
                        if (PartRangeTech > 11)
                            PartRangeTech = 11;
                        if (CapTech > 11)
                            CapTech = 11;

                        int Cal = -1;
                        ComponentTypeTN BeamType = ComponentTypeTN.TypeCount;
                        int Range = PartRangeTech - m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex;
                        int Cap = CapTech - m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex;

                        if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex > AdvPartTech)
                        {
                            BeamType = ComponentTypeTN.Particle;
                            Cal = PartTech - (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex - AdvPartTech - 1);

                            float RangeAdjust = (float)Constants.BeamWeaponTN.ParticleRange[Range];
                            Entry = String.Format("Particle Beam-{0} C{1}/R{2}", Constants.BeamWeaponTN.ParticleDamage[Cal], Constants.BeamWeaponTN.Capacitor[Cap], RangeAdjust);
                        }
                        else
                        {
                            BeamType = ComponentTypeTN.AdvParticle;
                            Cal = AdvPartTech - m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex;

                            float RangeAdjust = (float)Constants.BeamWeaponTN.ParticleRange[Range];
                            Entry = String.Format("Advanced Particle Beam-{0} C{1}/R{2}", Constants.BeamWeaponTN.AdvancedParticleDamage[Cal], Constants.BeamWeaponTN.Capacitor[Cap], RangeAdjust);
                        }

                        BeamProject = new BeamDefTN(Entry, BeamType, (byte)Cal, (byte)Range, (byte)Cap, 1.0f);

                        m_oComponentDesignPanel.TechNameTextBox.Text = Entry;

                        String FormattedRange = BeamProject.range.ToString("#,###0");

                        Entry = String.Format("Beam Strength {0}     Rate of Fire: {1} seconds     Maximum Range: {2} km\n", BeamProject.damage[0], BeamProject.rof, FormattedRange);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        if (m_oComponentDesignPanel.SizeTonsCheckBox.Checked == true)
                            Entry = String.Format("Launcher Size: {0} Tons    Launcher HTK: {1}\n", (BeamProject.size * 50.0f), BeamProject.htk);
                        else
                            Entry = String.Format("Launcher Size: {0} HS    Launcher HTK: {1}\n", BeamProject.size, BeamProject.htk);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Power Requirement: {0}    Power Recharge per 5 Secs: {1}\n", BeamProject.powerRequirement, BeamProject.weaponCapacitor);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Cost: {0}    Crew: {1}\n", BeamProject.cost, BeamProject.crew);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Materials Required:");

                        for (int mineralIterator = 0; mineralIterator < (int)Constants.Minerals.MinerialNames.MinerialCount; mineralIterator++)
                        {
                            if (BeamProject.minerialsCost[mineralIterator] != 0)
                            {
                                Entry = String.Format("{0} {1:N1}x {2}", Entry, BeamProject.minerialsCost[mineralIterator], (Constants.Minerals.MinerialNames)mineralIterator);
                            }
                        }
                        Entry = String.Format("{0}\n", Entry);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("\nDevelopment Cost for Project: {0}RP\n", (BeamProject.cost * 50));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                    }
                    break;
                #endregion

                #region Plasma Carronades
                case ComponentsViewModel.Components.Plasma:

                    /// <summary>
                    /// Sanity check.
                    /// </summary>
                    if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex != -1)
                    {

                        int AdvPlasmaTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.AdvancedPlasmaCarronadeCalibre];
                        int PlasmaTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.PlasmaCarronadeCalibre];
                        int CapTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.CapacitorChargeRate];

                        if (AdvPlasmaTech > 9)
                            AdvPlasmaTech = 9;
                        if (PlasmaTech > 9)
                            PlasmaTech = 9;
                        if (CapTech > 11)
                            CapTech = 11;

                        int Cal = -1;
                        ComponentTypeTN BeamType = ComponentTypeTN.TypeCount;
                        int Cap = CapTech - m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex;

                        if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex > AdvPlasmaTech)
                        {
                            Cal = PlasmaTech - (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex - AdvPlasmaTech - 1);
                            BeamType = ComponentTypeTN.Plasma;

                            Entry = String.Format("{0}cm C{1} Carronade", Constants.BeamWeaponTN.SizeClass[Cal + 2], Constants.BeamWeaponTN.Capacitor[Cap]);
                        }
                        else
                        {
                            Cal = AdvPlasmaTech - m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex;
                            BeamType = ComponentTypeTN.AdvPlasma;

                            Entry = String.Format("{0}cm C{1} Advanced Carronade", Constants.BeamWeaponTN.SizeClass[Cal + 2], Constants.BeamWeaponTN.Capacitor[Cap]);
                        }


                        BeamProject = new BeamDefTN(Entry, BeamType, (byte)(Cal + 2), 1, (byte)Cap, 1.0f);

                        m_oComponentDesignPanel.TechNameTextBox.Text = Entry;

                        Entry = String.Format("Damage Output {0}     Rate of Fire: {1} seconds\n", BeamProject.damage[0], BeamProject.rof);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        String FormattedRange = BeamProject.range.ToString("#,###0");

                        if (m_oComponentDesignPanel.SizeTonsCheckBox.Checked == true)
                            Entry = String.Format("Max Range {0} km     Carronade Size: {1} Tons    Carronade HTK: {2}\n", FormattedRange, (BeamProject.size * 50.0f), BeamProject.htk);
                        else
                            Entry = String.Format("Max Range {0} km     Carronade Size: {1} HS    Carronade HTK: {2}\n", FormattedRange, BeamProject.size, BeamProject.htk);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Power Requirement: {0}    Power Recharge per 5 Secs: {1}\n", BeamProject.powerRequirement, BeamProject.weaponCapacitor);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Cost: {0}    Crew: {1}\n", BeamProject.cost, BeamProject.crew);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Materials Required:");

                        for (int mineralIterator = 0; mineralIterator < (int)Constants.Minerals.MinerialNames.MinerialCount; mineralIterator++)
                        {
                            if (BeamProject.minerialsCost[mineralIterator] != 0)
                            {
                                Entry = String.Format("{0} {1:N1}x {2}", Entry, BeamProject.minerialsCost[mineralIterator], (Constants.Minerals.MinerialNames)mineralIterator);
                            }
                        }
                        Entry = String.Format("{0}\n", Entry);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("\nDevelopment Cost for Project: {0}RP\n", (BeamProject.cost * 50));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                    }


                    break;
                #endregion

                #region Plasma Torpedos
                case ComponentsViewModel.Components.PlasmaTorp:
                    break;
                #endregion

                #region Power Plants
                case ComponentsViewModel.Components.Reactor:

                    /// <summary>
                    /// Sanity check.
                    /// </summary>
                    if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex != -1)
                    {

                        #region Get boost
                        switch (m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex)
                        {
                            case 0:
                                Boost = 1.0f;
                                break;
                            case 1:
                                Boost = 1.05f;
                                break;
                            case 2:
                                Boost = 1.10f;
                                break;
                            case 3:
                                Boost = 1.15f;
                                break;
                            case 4:
                                Boost = 1.2f;
                                break;
                            case 5:
                                Boost = 1.25f;
                                break;
                            case 6:
                                Boost = 1.3f;
                                break;
                            case 7:
                                Boost = 1.4f;
                                break;
                            case 8:
                                Boost = 1.5f;
                                break;
                        }
                        #endregion

                        #region Get size
                        switch (m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex)
                        {
                            case 0:
                                Size = 0.1f;
                                break;
                            case 1:
                                Size = 0.2f;
                                break;
                            case 2:
                                Size = 0.5f;
                                break;
                            default:
                                Size = (float)(m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex - 2);
                                break;
                        }
                        #endregion

                        #region Set Name. Hard coded again, DB here as well.
                        switch (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex)
                        {
                            case 0:
                                Entry = "Vacuum Energy Power Plant Technology";
                                break;
                            case 1:
                                Entry = "Beam-Core Antimatter Reactor Technology";
                                break;
                            case 2:
                                Entry = "Plasma-Core Antimatter Reactor Technology";
                                break;
                            case 3:
                                Entry = "Gas-Core Antimatter Reactor Technology";
                                break;
                            case 4:
                                Entry = "Solid-Core Antimatter Reactor Technology";
                                break;
                            case 5:
                                Entry = "Inertial Confinement Fusion Reactor Technology";
                                break;
                            case 6:
                                Entry = "Magnetic Confinement Fusion Reactor Technology";
                                break;
                            case 7:
                                Entry = "Tokamak Fusion Reactor Technology";
                                break;
                            case 8:
                                Entry = "Stellarator Fusion Reactor Technology";
                                break;
                            case 9:
                                Entry = "Gas Cooled Fast Reactor Technology";
                                break;
                            case 10:
                                Entry = "Pebble Bed Reactor Technology";
                                break;
                            case 11:
                                Entry = "Pressurised Water Reactor Technology";
                                break;
                        }
                        #endregion

                        if (Boost == 1.0f)
                            Entry = String.Format("{0} PB-1", Entry);
                        else
                            Entry = String.Format("{0} PB-{1}", Entry, Boost);

                        ReactorProject = new ReactorDefTN(Entry, (byte)(11 - m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex), Size, Boost);

                        m_oComponentDesignPanel.TechNameTextBox.Text = Entry;

                        Entry = String.Format("Power Output: {0}     Explosion Chance: {1}\n", ReactorProject.powerGen, ReactorProject.expRisk);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        if (m_oComponentDesignPanel.SizeTonsCheckBox.Checked == true)
                            Entry = String.Format("Reactor Size: {0} Tons    Reactor HTK: {1}\n", (ReactorProject.size * 50.0f), ReactorProject.htk);
                        else
                            Entry = String.Format("Reactor Size: {0} HS    Reactor HTK: {1}\n", ReactorProject.size, ReactorProject.htk);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Cost: {0}    Crew: {1}\n", ReactorProject.cost, ReactorProject.crew);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Materials Required:");

                        for (int mineralIterator = 0; mineralIterator < (int)Constants.Minerals.MinerialNames.MinerialCount; mineralIterator++)
                        {
                            if (ReactorProject.minerialsCost[mineralIterator] != 0)
                            {
                                Entry = String.Format("{0} {1:N1}x {2}", Entry, ReactorProject.minerialsCost[mineralIterator], (Constants.Minerals.MinerialNames)mineralIterator);
                            }
                        }
                        Entry = String.Format("{0}\n\n", Entry);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Development Cost for Project: {0}RP\n", (ReactorProject.cost) * 10);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                    }

                    break;
                #endregion

                #region Railguns
                case ComponentsViewModel.Components.Rail:
                    /// <summary>
                    /// Sanity check.
                    /// </summary>
                    if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex != -1)
                    {
                        int AdvRailTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.AdvancedRailgun];
                        int RailTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.Railgun];
                        int RailVelTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.RailgunVelocity];
                        int CapTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.CapacitorChargeRate];

                        if (AdvRailTech > 9)
                            AdvRailTech = 9;
                        if (RailTech > 9)
                            RailTech = 9;
                        if (RailVelTech > 9)
                            RailVelTech = 9;
                        if (CapTech > 11)
                            CapTech = 11;

                        int Cal = -1;
                        ComponentTypeTN BeamType = ComponentTypeTN.TypeCount;
                        int Cap = CapTech - m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex;
                        int Vel = RailVelTech - m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex;

                        if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex > AdvRailTech)
                        {
                            Cal = RailTech - (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex - AdvRailTech - 1);
                            BeamType = ComponentTypeTN.Rail;


                            /// <summary>
                            /// This is the counterpart to the earlier kludge of allowing 45cm rail guns:
                            /// </summary>
                            switch (Cal)
                            {
                                case 9:
                                    Entry = String.Format("{0}cm Railgun V{1}/C{2}", "50", Vel, Constants.BeamWeaponTN.Capacitor[Cap]);
                                    break;
                                case 8:
                                    Entry = String.Format("{0}cm Railgun V{1}/C{2}", "45", Vel, Constants.BeamWeaponTN.Capacitor[Cap]);
                                    break;
                                default:
                                    Entry = String.Format("{0}cm Railgun V{1}/C{2}", Constants.BeamWeaponTN.SizeClass[Cal], Vel, Constants.BeamWeaponTN.Capacitor[Cap]);
                                    break;
                            }
                        }
                        else
                        {
                            Cal = AdvRailTech - m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex;
                            BeamType = ComponentTypeTN.AdvRail;

                            switch (Cal)
                            {
                                case 9:
                                    Entry = String.Format("{0}cm Advanced Railgun V{1}/C{2}", "50", Vel, Constants.BeamWeaponTN.Capacitor[Cap]);
                                    break;
                                case 8:
                                    Entry = String.Format("{0}cm Advanced Railgun V{1}/C{2}", "45", Vel, Constants.BeamWeaponTN.Capacitor[Cap]);
                                    break;
                                default:
                                    Entry = String.Format("{0}cm Advanced Railgun V{1}/C{2}", Constants.BeamWeaponTN.SizeClass[Cal], Vel, Constants.BeamWeaponTN.Capacitor[Cap]);
                                    break;
                            }
                        }

                        m_oComponentDesignPanel.TechNameTextBox.Text = Entry;

                        BeamProject = new BeamDefTN(Entry, BeamType, (byte)Cal, (byte)Vel, (byte)Cap, 1.0f);

                        Entry = String.Format("Damage Per Shot ({0}): {1}     Rate of Fire: {2} seconds     Range Modifier: {3}\n", BeamProject.shotCount, BeamProject.damage[0], BeamProject.rof, Vel);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        String FormattedRange = BeamProject.range.ToString("#,###0");

                        if (m_oComponentDesignPanel.SizeTonsCheckBox.Checked == true)
                            Entry = String.Format("Max Range {0} km     Railgun Size: {1} Tons    Railgun HTK: {2}\n", FormattedRange, (BeamProject.size * 50.0f), BeamProject.htk);
                        else
                            Entry = String.Format("Max Range {0} km     Railgun Size: {1} HS    Railgun HTK: {2}\n", FormattedRange, BeamProject.size, BeamProject.htk);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Power Requirement: {0}    Power Recharge per 5 Secs: {1}\n", BeamProject.powerRequirement, BeamProject.weaponCapacitor);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Cost: {0}    Crew: {1}\n", BeamProject.cost, BeamProject.crew);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Materials Required:");

                        for (int mineralIterator = 0; mineralIterator < (int)Constants.Minerals.MinerialNames.MinerialCount; mineralIterator++)
                        {
                            if (BeamProject.minerialsCost[mineralIterator] != 0)
                            {
                                Entry = String.Format("{0} {1:N1}x {2}", Entry, BeamProject.minerialsCost[mineralIterator], (Constants.Minerals.MinerialNames)mineralIterator);
                            }
                        }
                        Entry = String.Format("{0}\n", Entry);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("\nDevelopment Cost for Project: {0}RP\n", (BeamProject.cost * 50));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                    }
                    break;
                #endregion

                #region Absorption Shields
                case ComponentsViewModel.Components.ShieldAbs:
                    break;
                #endregion

                #region Standard Shields
                case ComponentsViewModel.Components.ShieldStd:

                    /// <summary>
                    /// Sanity check.
                    /// </summary>
                    if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex != -1)
                    {

                        FactTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.StandardShieldStrength];

                        if (FactTech > 11)
                            FactTech = 11;

                        int SS = FactTech - m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex;

                        FactTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.StandardShieldRegen];

                        if (FactTech > 11)
                            FactTech = 11;

                        int SR = FactTech - m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex;

                        FactTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.FuelConsumption];

                        if (FactTech > 12)
                            FactTech = 12;

                        int FC = FactTech - m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex;

                        #region name
                        switch (SS)
                        {
                            case 0:
                                Entry = "Alpha";
                                break;
                            case 1:
                                Entry = "Beta";
                                break;
                            case 2:
                                Entry = "Gamma";
                                break;
                            case 3:
                                Entry = "Delta";
                                break;
                            case 4:
                                Entry = "Epsilon";
                                break;
                            case 5:
                                Entry = "Theta";
                                break;
                            case 6:
                                Entry = "Xi";
                                break;
                            case 7:
                                Entry = "Omicron";
                                break;
                            case 8:
                                Entry = "Sigma";
                                break;
                            case 9:
                                Entry = "Tau";
                                break;
                            case 10:
                                Entry = "Psi";
                                break;
                            case 11:
                                Entry = "Omega";
                                break;
                        }
                        #endregion

                        ShieldProject = new ShieldDefTN(Entry, SS, SR, Constants.EngineTN.FuelConsumption[FC], 1.0f, ComponentTypeTN.Shield);

                        float RechargeTime = (ShieldProject.shieldPool / ShieldProject.shieldGen) * 300.0f;

                        Entry = String.Format("{0} R{1}/{2} Shields", Entry, RechargeTime, (ShieldProject.fuelCostPerHour * 24.0f));

                        ShieldProject.Name = Entry;

                        m_oComponentDesignPanel.TechNameTextBox.Text = Entry;

                        Entry = String.Format("Shield Strength: {0}\n", ShieldProject.shieldPool);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Recharge Rate: {0}    Recharge Time: {1} seconds\n", ShieldProject.shieldGen, RechargeTime);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Cost: {0}    Crew: {1}     Daily Fuel Cost while Active: {2} Litres\n", ShieldProject.cost, ShieldProject.crew, (ShieldProject.fuelCostPerHour * 24.0f));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Materials Required:");

                        for (int mineralIterator = 0; mineralIterator < (int)Constants.Minerals.MinerialNames.MinerialCount; mineralIterator++)
                        {
                            if (ShieldProject.minerialsCost[mineralIterator] != 0)
                            {
                                Entry = String.Format("{0} {1:N1}x {2}", Entry, ShieldProject.minerialsCost[mineralIterator], (Constants.Minerals.MinerialNames)mineralIterator);
                            }
                        }
                        Entry = String.Format("{0}\n\n", Entry);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Development Cost for Project: {0}RP\n", (ShieldProject.cost * 100));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                    }

                    break;
                #endregion

                #region Thermal Sensors
                case ComponentsViewModel.Components.Thermal:
                    if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex != -1)
                    {
                        #region Size
                        /// <summary>
                        /// Pull size out of this mess.
                        /// </summary>
                        if (m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex < 9)
                        {
                            Size = (float)(m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex + 1) / 10.0f;
                        }
                        else if (m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex >= 9 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex <= 13)
                        {
                            Size = 1.0f + (float)((m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex - 9) * 2) / 10.0f;
                        }
                        else if (m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex >= 14 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex <= 25)
                        {
                            Size = 2.0f + (float)(((m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex - 14) * 25) / 100.0f);
                        }
                        else if (m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex > 25)
                        {
                            Size = (float)(m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex - 21);
                        }
                        #endregion

                        #region Hardening
                        /// <summary>
                        /// Get chance of destruction due to electronic damage.
                        /// </summary>
                        switch (m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex)
                        {
                            case 0:
                                Hard = 1.0f;
                                break;
                            case 1:
                                Hard = 0.7f;
                                break;
                            case 2:
                                Hard = 0.5f;
                                break;
                            case 3:
                                Hard = 0.4f;
                                break;
                            case 4:
                                Hard = 0.3f;
                                break;
                            case 5:
                                Hard = 0.25f;
                                break;
                            case 6:
                                Hard = 0.2f;
                                break;
                            case 7:
                                Hard = 0.15f;
                                break;
                            case 8:
                                Hard = 0.1f;
                                break;
                        }
                        #endregion

                        FactTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.ThermalSensorSensitivity];

                        if (FactTech > 11)
                            FactTech = 11;

                        int TH = FactTech - m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex;

                        Entry = "Thermal Sensor TH";
                        PassiveSensorProject = new PassiveSensorDefTN(Entry, Size, Constants.SensorTN.PassiveStrength[TH], PassiveSensorType.Thermal, Hard,
                                                                     (byte)(m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex + 1));

                        if (Hard == 1.0f)
                            Entry = String.Format("{0}{1}-{2}", Entry, Size, PassiveSensorProject.rating);
                        else
                            Entry = String.Format("{0}{1}-{2}({3}%)", Entry, Size, PassiveSensorProject.rating, (Hard * 100.0f));

                        m_oComponentDesignPanel.TechNameTextBox.Text = Entry;

                        Entry = String.Format("Thermal Sensor Sensitivity: {0}\n", PassiveSensorProject.rating);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        if (m_oComponentDesignPanel.SizeTonsCheckBox.Checked == true)
                            Entry = String.Format("Sensor Size: {0} Tons    Sensor HTK: {1}\n", (PassiveSensorProject.size * 50.0f), PassiveSensorProject.htk);
                        else
                            Entry = String.Format("Sensor Size: {0} HS    Sensor HTK: {1}\n", PassiveSensorProject.size, PassiveSensorProject.htk);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Chance of destruction by electronic damage: {0}%\n", (Hard * 100.0f));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Cost: {0}    Crew: {1}\n", PassiveSensorProject.cost, PassiveSensorProject.crew);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Materials Required:");

                        for (int mineralIterator = 0; mineralIterator < (int)Constants.Minerals.MinerialNames.MinerialCount; mineralIterator++)
                        {
                            if (PassiveSensorProject.minerialsCost[mineralIterator] != 0)
                            {
                                Entry = String.Format("{0} {1:N1}x {2}", Entry, PassiveSensorProject.minerialsCost[mineralIterator], (Constants.Minerals.MinerialNames)mineralIterator);
                            }
                        }
                        Entry = String.Format("{0}\n\n", Entry);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Development Cost for Project: {0}RP", (PassiveSensorProject.cost * 10));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);


                    }
                    break;
                #endregion
            }
            #endregion
        }
Exemplo n.º 4
0
        /// <summary>
        /// Every faction will start with some components defined and ready to use, though the engines and sensors shouldn't be here just yet.
        /// </summary>
        public void AddInitialComponents()
        {
            /// <summary>
            /// Watch total component count when adding or subtracting from this function
            /// </summary>
            TotalComponents = 0;

            GeneralComponentDefTN CrewQ  = new GeneralComponentDefTN("Crew Quarters", 1.0f, 0, 10.0m, ComponentTypeTN.Crew);
            GeneralComponentDefTN CrewQS = new GeneralComponentDefTN("Crew Quarters - Small", 0.2f, 0, 2.0m, ComponentTypeTN.Crew);
            GeneralComponentDefTN FuelT  = new GeneralComponentDefTN("Fuel Storage", 1.0f, 0, 10.0m, ComponentTypeTN.Fuel);
            GeneralComponentDefTN FuelTS = new GeneralComponentDefTN("Fuel Storage - Small", 0.2f, 0, 3.0m, ComponentTypeTN.Fuel);
            GeneralComponentDefTN EBay   = new GeneralComponentDefTN("Engineering Spaces", 1.0f, 5, 10.0m, ComponentTypeTN.Engineering);
            GeneralComponentDefTN Bridge = new GeneralComponentDefTN("Bridge", 1.0f, 5, 10.0m, ComponentTypeTN.Bridge);

            TotalComponents = TotalComponents + 6;

            CrewQuarters.Add(CrewQ);
            CrewQuarters.Add(CrewQS);
            FuelStorage.Add(FuelT);
            FuelStorage.Add(FuelTS);
            EngineeringSpaces.Add(EBay);
            OtherComponents.Add(Bridge);

            /// <summary>
            /// These components aren't really basic, but I'll put them in anyway for the time being. Count 6 to 17
            /// </summary>
            EngineDefTN          EngDef     = new EngineDefTN("25 EP Nuclear Thermal Engine", 5.0f, 1.0f, 1.0f, 1.0f, 1, 5, -1.0f);
            ActiveSensorDefTN    ActDef     = new ActiveSensorDefTN("Search 5M - 5000", 1.0f, 10, 5, 100, false, 1.0f, 1);
            PassiveSensorDefTN   ThPasDef   = new PassiveSensorDefTN("Thermal Sensor TH1-5", 1.0f, 5, PassiveSensorType.Thermal, 1.0f, 1);
            PassiveSensorDefTN   EMPasDef   = new PassiveSensorDefTN("EM Sensor EM1-5", 1.0f, 5, PassiveSensorType.EM, 1.0f, 1);
            BeamFireControlDefTN BFCDef     = new BeamFireControlDefTN("Fire Control S01 10-1250", 0, 0, 1.0f, 1.0f, false, false, 1.0f, 1);
            BeamDefTN            BeamDef    = new BeamDefTN("10cm C1 Infrared Laser", ComponentTypeTN.Laser, 0, 0, 0, 1.0f);
            ReactorDefTN         ReactDef   = new ReactorDefTN("PWR S1 P2", 0, 1.0f, 1.0f);
            ShieldDefTN          AShieldDef = new ShieldDefTN("Alpha R300/240 Shields", 0, 0, 1.0f, 1.0f, ComponentTypeTN.Shield);
            MissileLauncherDefTN TubeDef    = new MissileLauncherDefTN("Size 1 Launcher", 1.0f, 1, false, 0);
            MagazineDefTN        MagDef     = new MagazineDefTN("Mag S1", 1.0f, 1, 0, 0, 1);
            ActiveSensorDefTN    MFCDef     = new ActiveSensorDefTN("Wasp I FC", 1.0f, 10, 5, 100, true, 1.0f, 1);

            TotalComponents = TotalComponents + 11;


            Engines.Add(EngDef);
            ActiveSensorDef.Add(ActDef);
            PassiveSensorDef.Add(ThPasDef);
            PassiveSensorDef.Add(EMPasDef);

            BeamFireControlDef.Add(BFCDef);
            BeamWeaponDef.Add(BeamDef);
            ReactorDef.Add(ReactDef);

            ShieldDef.Add(AShieldDef);

            MLauncherDef.Add(TubeDef);
            MagazineDef.Add(MagDef);
            MissileFireControlDef.Add(MFCDef);

            TurretableBeamDef.Add(BeamDef);


            /// <summary>
            /// Everyone starts with cargoholds. Count 17 to 19
            /// </summary>
            CargoDefTN CargoStandard = new CargoDefTN("Cargo Hold - Standard", 500.0f, 50.0m, 5);
            CargoDefTN CargoSmall    = new CargoDefTN("Cargo Hold - Small", 100.0f, 12.5m, 2);

            TotalComponents = TotalComponents + 2;

            CargoHoldDef.Add(CargoStandard);
            CargoHoldDef.Add(CargoSmall);

            /// <summary>
            /// Cryostorage is a TN only starting option. otherwise it must be researched. Count, 19 to 22
            /// </summary>
            ColonyDefTN ColonyStandard  = new ColonyDefTN("Cryogenic Transport", 50.0f, 100.0m, 10);
            ColonyDefTN ColonySmall     = new ColonyDefTN("Cryogenic Transport - Small", 5.0f, 20.0m, 2);
            ColonyDefTN ColonyEmergency = new ColonyDefTN("Cryogenic Transport - Emergency", 1.0f, 5.0m, 0);

            TotalComponents = TotalComponents + 3;

            ColonyBayDef.Add(ColonyStandard);
            ColonyBayDef.Add(ColonySmall);
            ColonyBayDef.Add(ColonyEmergency);


            /// <summary>
            /// Only TN starts begin with this component for now. the improved,advanced, and grav-assisted variants have to be researched. Count 22, to 23
            /// </summary>
            CargoHandlingDefTN CHS = new CargoHandlingDefTN("Cargo Handling System", 5, 10.0m);

            CargoHandleSystemDef.Add(CHS);
            TotalComponents = TotalComponents + 1;

            /// <summary>
            /// Alpha build components: Count 23, to 39
            /// </summary>

            EngineDefTN          AlphaEngine        = new EngineDefTN("Ion Engine 120", 12.0f, 1.0f, 0.7f, 1.0f, 1, 10.0f, -1.0f);
            ActiveSensorDefTN    AlphaBigSensor     = new ActiveSensorDefTN("Search 181M - 10000", 10.0f, 16, 8, 200, false, 1.0f, 1);
            ActiveSensorDefTN    AlphaSmallSensor   = new ActiveSensorDefTN("Search 57M - 1000", 10.0f, 16, 8, 20, false, 1.0f, 1);
            ActiveSensorDefTN    AlphaMissileSensor = new ActiveSensorDefTN("Search 1.4M - Missile", 10.0f, 16, 8, 1, false, 1.0f, 1);
            PassiveSensorDefTN   AlphaEMSensor      = new PassiveSensorDefTN("EM Detection Sensor EM10-80", 10.0f, 8, PassiveSensorType.EM, 1.0f, 1);
            PassiveSensorDefTN   AlphaTHSensor      = new PassiveSensorDefTN("TH Detection Sensor TH10-80", 10.0f, 8, PassiveSensorType.Thermal, 1.0f, 1);
            BeamFireControlDefTN AlphaFireControl   = new BeamFireControlDefTN("Primary III FC R96K T6K", 2, 2, 4.0f, 2.0f, false, false, 1.0f, 1);

            BeamDefTN AlphaRailGun  = new BeamDefTN("15cm Railgun V3/C3", ComponentTypeTN.Rail, 2, 2, 2, 1.0f);
            BeamDefTN AlphaLaser    = new BeamDefTN("15cm C3 Near UV Laser", ComponentTypeTN.Laser, 2, 2, 2, 1.0f);
            BeamDefTN AlphaParticle = new BeamDefTN("PBW-4 150K", ComponentTypeTN.Particle, 2, 2, 2, 1.0f);
            BeamDefTN AlphaPlasma   = new BeamDefTN("15cm C3 Plasma Beam", ComponentTypeTN.Plasma, 2, 2, 2, 1.0f);
            BeamDefTN AlphaMeson    = new BeamDefTN("R9/C3 Meson Cannon", ComponentTypeTN.Meson, 2, 2, 2, 1.0f);
            BeamDefTN AlphaHPM      = new BeamDefTN("R9/C3 Microwave", ComponentTypeTN.Microwave, 2, 2, 2, 1.0f);
            BeamDefTN AlphaGauss    = new BeamDefTN("Gauss R3-100", ComponentTypeTN.Gauss, 0, 2, 2, 1.0f);

            ReactorDefTN AlphaReactor = new ReactorDefTN("GCFR S1 P4.5", 2, 1.0f, 1.0f);

            ShieldDefTN AlphaShield = new ShieldDefTN("Gamma R300/336 Shields", 2, 2, 0.7f, 1.0f, ComponentTypeTN.Shield);

            TotalComponents = TotalComponents + 16;

            Engines.Add(AlphaEngine);

            ActiveSensorDef.Add(AlphaBigSensor);
            ActiveSensorDef.Add(AlphaSmallSensor);
            ActiveSensorDef.Add(AlphaMissileSensor);

            PassiveSensorDef.Add(AlphaEMSensor);
            PassiveSensorDef.Add(AlphaTHSensor);

            BeamFireControlDef.Add(AlphaFireControl);

            BeamWeaponDef.Add(AlphaRailGun);
            BeamWeaponDef.Add(AlphaLaser);
            BeamWeaponDef.Add(AlphaParticle);
            BeamWeaponDef.Add(AlphaPlasma);
            BeamWeaponDef.Add(AlphaMeson);
            BeamWeaponDef.Add(AlphaHPM);
            BeamWeaponDef.Add(AlphaGauss);

            ReactorDef.Add(AlphaReactor);

            ShieldDef.Add(AlphaShield);

            TurretableBeamDef.Add(AlphaLaser);
            TurretableBeamDef.Add(AlphaMeson);
            TurretableBeamDef.Add(AlphaGauss);

            /// <summary>
            /// Missile Combat Alpha Components: Count at 44 from 39 OrdnanceDefTN and MissileEngineDefTN are _NOT_ included in the total count.
            /// </summary>
            EngineDefTN          AlphaMCEngine             = new EngineDefTN("Military 5000 EP Photonic Drive", 100.0f, 1.0f, 0.1f, 1.0f, 1, 50.0f, -1.0f);
            ActiveSensorDefTN    AlphaMCSensor             = new ActiveSensorDefTN("Active Search Sensor MR13500-R100", 10.0f, 180, 75, 100, false, 1.0f, 0);
            ActiveSensorDefTN    AlphaMCMissileFireControl = new ActiveSensorDefTN("Missile Fire Control FC40500-R100", 10.0f, 180, 75, 100, true, 1.0f, 0);
            MagazineDefTN        MagazineMCDef             = new MagazineDefTN("Capacity 587 Magazine: Exp 1%  HTK4", 30.0f, 4, 8, 8, 12);
            MissileLauncherDefTN TubeMCDef          = new MissileLauncherDefTN("Size 4 Launcher", 4.0f, 11, false, 0);
            MissileEngineDefTN   MissileEngineMCDef = new MissileEngineDefTN("Photonic Missile Drive", 100.0f, 1.0f, 0.1f, 1.5f);
            OrdnanceDefTN        MissileMCDef       = new OrdnanceDefTN("Size 4 Missile", null, 0.5f, 11, 1.0f, 1.0f, 11, 0.0f, 0, 0.0f, 0, 0.0f, 0, 0.0f, 0, 100, 0, 0.0f, 0.0f, 0, false, 0, false, 0,
                                                                        MissileEngineMCDef, 1);

            TotalComponents = TotalComponents + 5;

            Engines.Add(AlphaMCEngine);
            ActiveSensorDef.Add(AlphaMCSensor);
            MissileFireControlDef.Add(AlphaMCMissileFireControl);
            MagazineDef.Add(MagazineMCDef);
            MLauncherDef.Add(TubeMCDef);
            MissileEngineDef.Add(MissileEngineMCDef);
            MissileDef.Add(MissileMCDef);

            MissileLauncherDefTN TubeAMMDef          = new MissileLauncherDefTN("Size 1 Launcher", 1.0f, 11, false, 0);
            MissileEngineDefTN   MissileEngineAMMDef = new MissileEngineDefTN("Small Photonic Missile Drive", 100.0f, 6.0f, 0.1f, 0.4f);
            ActiveSensorDefTN    AMMSensor           = new ActiveSensorDefTN("AMM Sensor", 10.0f, 180, 75, 1, false, 1.0f, 0);
            ActiveSensorDefTN    AMMMFC        = new ActiveSensorDefTN("AMM MFC", 10.0f, 180, 75, 1, true, 1.0f, 0);
            OrdnanceDefTN        MissileAMMDef = new OrdnanceDefTN("Size 1 Missile", null, 0.14f, 11, 0.23f, 0.23f, 11, 0.0f, 0, 0.0f, 0, 0.0f, 0, 0.0f, 0, 1, 0, 0.0f, 0.0f, 0, false, 0, false, 0,
                                                                   MissileEngineAMMDef, 1);

            TotalComponents = TotalComponents + 3;

            MLauncherDef.Add(TubeAMMDef);
            MissileEngineDef.Add(MissileEngineAMMDef);
            ActiveSensorDef.Add(AMMSensor);
            MissileFireControlDef.Add(AMMMFC);
            MissileDef.Add(MissileAMMDef);


            /// <summary>
            /// Sensor components should be added upon researching the appropriate technology, as they cannot be designed, Count should be at 46
            /// </summary>
            SurveySensorDefTN GeoSurvey  = new SurveySensorDefTN("Geological Survey Sensor", SurveySensorDefTN.SurveySensorType.Geological, 1.0f);
            SurveySensorDefTN GravSurvey = new SurveySensorDefTN("Gravitational Survey Sensor", SurveySensorDefTN.SurveySensorType.Gravitational, 1.0f);

            SurveySensorDef.Add(GeoSurvey);
            SurveySensorDef.Add(GravSurvey);

            TotalComponents = TotalComponents + 2;
        }
Exemplo n.º 5
0
        /// <summary>
        /// Every faction will start with some components defined and ready to use, though the engines and sensors shouldn't be here just yet.
        /// </summary>
        public void AddInitialComponents()
        {
            /// <summary>
            /// Watch total component count when adding or subtracting from this function
            /// </summary>
            TotalComponents = 0;

            GeneralComponentDefTN CrewQ = new GeneralComponentDefTN("Crew Quarters", 1.0f, 0, 10.0m, ComponentTypeTN.Crew);
            GeneralComponentDefTN CrewQS = new GeneralComponentDefTN("Crew Quarters - Small", 0.2f, 0, 2.0m, ComponentTypeTN.Crew);
            GeneralComponentDefTN FuelT = new GeneralComponentDefTN("Fuel Storage", 1.0f, 0, 10.0m, ComponentTypeTN.Fuel);
            GeneralComponentDefTN FuelTS = new GeneralComponentDefTN("Fuel Storage - Small", 0.2f, 0, 3.0m, ComponentTypeTN.Fuel);
            GeneralComponentDefTN EBay = new GeneralComponentDefTN("Engineering Spaces", 1.0f, 5, 10.0m, ComponentTypeTN.Engineering);
            GeneralComponentDefTN Bridge = new GeneralComponentDefTN("Bridge", 1.0f, 5, 10.0m, ComponentTypeTN.Bridge);
            TotalComponents = TotalComponents + 6;

            CrewQuarters.Add(CrewQ);
            CrewQuarters.Add(CrewQS);
            FuelStorage.Add(FuelT);
            FuelStorage.Add(FuelTS);
            EngineeringSpaces.Add(EBay);
            OtherComponents.Add(Bridge);

            /// <summary>
            /// These components aren't really basic, but I'll put them in anyway for the time being. Count 6 to 17
            /// </summary>
            EngineDefTN EngDef = new EngineDefTN("25 EP Nuclear Thermal Engine", 5.0f, 1.0f, 1.0f, 1.0f, 1, 5, -1.0f);
            ActiveSensorDefTN ActDef = new ActiveSensorDefTN("Search 5M - 5000", 1.0f, 10, 5, 100, false, 1.0f, 1);
            PassiveSensorDefTN ThPasDef = new PassiveSensorDefTN("Thermal Sensor TH1-5", 1.0f, 5, PassiveSensorType.Thermal, 1.0f, 1);
            PassiveSensorDefTN EMPasDef = new PassiveSensorDefTN("EM Sensor EM1-5", 1.0f, 5, PassiveSensorType.EM, 1.0f, 1);
            BeamFireControlDefTN BFCDef = new BeamFireControlDefTN("Fire Control S01 10-1250", 0, 0, 1.0f, 1.0f, false, false, 1.0f, 1);
            BeamDefTN BeamDef = new BeamDefTN("10cm C1 Infrared Laser", ComponentTypeTN.Laser, 0, 0, 0, 1.0f);
            ReactorDefTN ReactDef = new ReactorDefTN("PWR S1 P2", 0, 1.0f, 1.0f);
            ShieldDefTN AShieldDef = new ShieldDefTN("Alpha R300/240 Shields", 0, 0, 1.0f, 1.0f, ComponentTypeTN.Shield);
            MissileLauncherDefTN TubeDef = new MissileLauncherDefTN("Size 1 Launcher", 1.0f, 1, false, 0);
            MagazineDefTN MagDef = new MagazineDefTN("Mag S1", 1.0f, 1, 0, 0, 1);
            ActiveSensorDefTN MFCDef = new ActiveSensorDefTN("Wasp I FC", 1.0f, 10, 5, 100, true, 1.0f, 1);
            TotalComponents = TotalComponents + 11;


            Engines.Add(EngDef);
            ActiveSensorDef.Add(ActDef);
            PassiveSensorDef.Add(ThPasDef);
            PassiveSensorDef.Add(EMPasDef);

            BeamFireControlDef.Add(BFCDef);
            BeamWeaponDef.Add(BeamDef);
            ReactorDef.Add(ReactDef);

            ShieldDef.Add(AShieldDef);

            MLauncherDef.Add(TubeDef);
            MagazineDef.Add(MagDef);
            MissileFireControlDef.Add(MFCDef);

            TurretableBeamDef.Add(BeamDef);


            /// <summary>
            /// Everyone starts with cargoholds. Count 17 to 19
            /// </summary>
            CargoDefTN CargoStandard = new CargoDefTN("Cargo Hold - Standard", 500.0f, 50.0m, 5);
            CargoDefTN CargoSmall = new CargoDefTN("Cargo Hold - Small", 100.0f, 12.5m, 2);
            TotalComponents = TotalComponents + 2;

            CargoHoldDef.Add(CargoStandard);
            CargoHoldDef.Add(CargoSmall);

            /// <summary>
            /// Cryostorage is a TN only starting option. otherwise it must be researched. Count, 19 to 22
            /// </summary>
            ColonyDefTN ColonyStandard = new ColonyDefTN("Cryogenic Transport", 50.0f, 100.0m, 10);
            ColonyDefTN ColonySmall = new ColonyDefTN("Cryogenic Transport - Small", 5.0f, 20.0m, 2);
            ColonyDefTN ColonyEmergency = new ColonyDefTN("Cryogenic Transport - Emergency", 1.0f, 5.0m, 0);
            TotalComponents = TotalComponents + 3;

            ColonyBayDef.Add(ColonyStandard);
            ColonyBayDef.Add(ColonySmall);
            ColonyBayDef.Add(ColonyEmergency);


            /// <summary>
            /// Only TN starts begin with this component for now. the improved,advanced, and grav-assisted variants have to be researched. Count 22, to 23
            /// </summary>
            CargoHandlingDefTN CHS = new CargoHandlingDefTN("Cargo Handling System", 5, 10.0m);
            CargoHandleSystemDef.Add(CHS);
            TotalComponents = TotalComponents + 1;

            /// <summary>
            /// Alpha build components: Count 23, to 39
            /// </summary>

            EngineDefTN AlphaEngine = new EngineDefTN("Ion Engine 120", 12.0f, 1.0f, 0.7f, 1.0f, 1, 10.0f, -1.0f);
            ActiveSensorDefTN AlphaBigSensor = new ActiveSensorDefTN("Search 181M - 10000", 10.0f, 16, 8, 200, false, 1.0f, 1);
            ActiveSensorDefTN AlphaSmallSensor = new ActiveSensorDefTN("Search 57M - 1000", 10.0f, 16, 8, 20, false, 1.0f, 1);
            ActiveSensorDefTN AlphaMissileSensor = new ActiveSensorDefTN("Search 1.4M - Missile", 10.0f, 16, 8, 1, false, 1.0f, 1);
            PassiveSensorDefTN AlphaEMSensor = new PassiveSensorDefTN("EM Detection Sensor EM10-80", 10.0f, 8, PassiveSensorType.EM, 1.0f, 1);
            PassiveSensorDefTN AlphaTHSensor = new PassiveSensorDefTN("TH Detection Sensor TH10-80", 10.0f, 8, PassiveSensorType.Thermal, 1.0f, 1);
            BeamFireControlDefTN AlphaFireControl = new BeamFireControlDefTN("Primary III FC R96K T6K", 2, 2, 4.0f, 2.0f, false, false, 1.0f, 1);

            BeamDefTN AlphaRailGun = new BeamDefTN("15cm Railgun V3/C3", ComponentTypeTN.Rail, 2, 2, 2, 1.0f);
            BeamDefTN AlphaLaser = new BeamDefTN("15cm C3 Near UV Laser", ComponentTypeTN.Laser, 2, 2, 2, 1.0f);
            BeamDefTN AlphaParticle = new BeamDefTN("PBW-4 150K", ComponentTypeTN.Particle, 2, 2, 2, 1.0f);
            BeamDefTN AlphaPlasma = new BeamDefTN("15cm C3 Plasma Beam", ComponentTypeTN.Plasma, 2, 2, 2, 1.0f);
            BeamDefTN AlphaMeson = new BeamDefTN("R9/C3 Meson Cannon", ComponentTypeTN.Meson, 2, 2, 2, 1.0f);
            BeamDefTN AlphaHPM = new BeamDefTN("R9/C3 Microwave", ComponentTypeTN.Microwave, 2, 2, 2, 1.0f);
            BeamDefTN AlphaGauss = new BeamDefTN("Gauss R3-100", ComponentTypeTN.Gauss, 0, 2, 2, 1.0f);

            ReactorDefTN AlphaReactor = new ReactorDefTN("GCFR S1 P4.5", 2, 1.0f, 1.0f);

            ShieldDefTN AlphaShield = new ShieldDefTN("Gamma R300/336 Shields", 2, 2, 0.7f, 1.0f, ComponentTypeTN.Shield);
            TotalComponents = TotalComponents + 16;

            Engines.Add(AlphaEngine);

            ActiveSensorDef.Add(AlphaBigSensor);
            ActiveSensorDef.Add(AlphaSmallSensor);
            ActiveSensorDef.Add(AlphaMissileSensor);

            PassiveSensorDef.Add(AlphaEMSensor);
            PassiveSensorDef.Add(AlphaTHSensor);

            BeamFireControlDef.Add(AlphaFireControl);

            BeamWeaponDef.Add(AlphaRailGun);
            BeamWeaponDef.Add(AlphaLaser);
            BeamWeaponDef.Add(AlphaParticle);
            BeamWeaponDef.Add(AlphaPlasma);
            BeamWeaponDef.Add(AlphaMeson);
            BeamWeaponDef.Add(AlphaHPM);
            BeamWeaponDef.Add(AlphaGauss);

            ReactorDef.Add(AlphaReactor);

            ShieldDef.Add(AlphaShield);

            TurretableBeamDef.Add(AlphaLaser);
            TurretableBeamDef.Add(AlphaMeson);
            TurretableBeamDef.Add(AlphaGauss);

            /// <summary>
            /// Missile Combat Alpha Components: Count at 44 from 39 OrdnanceDefTN and MissileEngineDefTN are _NOT_ included in the total count.
            /// </summary>
            EngineDefTN AlphaMCEngine = new EngineDefTN("Military 5000 EP Photonic Drive", 100.0f, 1.0f, 0.1f, 1.0f, 1, 50.0f, -1.0f);
            ActiveSensorDefTN AlphaMCSensor = new ActiveSensorDefTN("Active Search Sensor MR13500-R100", 10.0f, 180, 75, 100, false, 1.0f, 0);
            ActiveSensorDefTN AlphaMCMissileFireControl = new ActiveSensorDefTN("Missile Fire Control FC40500-R100", 10.0f, 180, 75, 100, true, 1.0f, 0);
            MagazineDefTN MagazineMCDef = new MagazineDefTN("Capacity 587 Magazine: Exp 1%  HTK4", 30.0f, 4, 8, 8, 12);
            MissileLauncherDefTN TubeMCDef = new MissileLauncherDefTN("Size 4 Launcher", 4.0f, 11, false, 0);
            MissileEngineDefTN MissileEngineMCDef = new MissileEngineDefTN("Photonic Missile Drive", 100.0f, 1.0f, 0.1f, 1.5f);
            OrdnanceDefTN MissileMCDef = new OrdnanceDefTN("Size 4 Missile", null, 0.5f, 11, 1.0f, 1.0f, 11, 0.0f, 0, 0.0f, 0, 0.0f, 0, 0.0f, 0, 100, 0, 0.0f, 0.0f, 0, false, 0, false, 0,
                                                           MissileEngineMCDef, 1);
            TotalComponents = TotalComponents + 5;

            Engines.Add(AlphaMCEngine);
            ActiveSensorDef.Add(AlphaMCSensor);
            MissileFireControlDef.Add(AlphaMCMissileFireControl);
            MagazineDef.Add(MagazineMCDef);
            MLauncherDef.Add(TubeMCDef);
            MissileEngineDef.Add(MissileEngineMCDef);
            MissileDef.Add(MissileMCDef);

            MissileLauncherDefTN TubeAMMDef = new MissileLauncherDefTN("Size 1 Launcher", 1.0f, 11, false, 0);
            MissileEngineDefTN MissileEngineAMMDef = new MissileEngineDefTN("Small Photonic Missile Drive", 100.0f, 6.0f, 0.1f, 0.4f);
            ActiveSensorDefTN AMMSensor = new ActiveSensorDefTN("AMM Sensor", 10.0f, 180, 75, 1, false, 1.0f, 0);
            ActiveSensorDefTN AMMMFC = new ActiveSensorDefTN("AMM MFC", 10.0f, 180, 75, 1, true, 1.0f, 0);
            OrdnanceDefTN MissileAMMDef = new OrdnanceDefTN("Size 1 Missile", null, 0.14f, 11, 0.23f, 0.23f, 11, 0.0f, 0, 0.0f, 0, 0.0f, 0, 0.0f, 0, 1, 0, 0.0f, 0.0f, 0, false, 0, false, 0,
                                                            MissileEngineAMMDef, 1);

            TotalComponents = TotalComponents + 3;

            MLauncherDef.Add(TubeAMMDef);
            MissileEngineDef.Add(MissileEngineAMMDef);
            ActiveSensorDef.Add(AMMSensor);
            MissileFireControlDef.Add(AMMMFC);
            MissileDef.Add(MissileAMMDef);



        }
Exemplo n.º 6
0
        /// <summary>
        /// Constructor for the individual shield component in each ship.
        /// </summary>
        /// <param name="definition">definition of the shield.</param>
        public ShieldTN(ShieldDefTN definition)
        {
            ShieldDef = definition;

            Name = definition.Name;

            isDestroyed = false;
        }
Exemplo n.º 7
0
        /// <summary>
        /// AddShield puts the specified shield onto this shipclass design.
        /// </summary>
        /// <param name="Shield">Shield definition</param>
        /// <param name="inc">Amount to add or remove</param>
        public void AddShield(ShieldDefTN Shield, short inc)
        {
            bool ShieldAllowed = true;
            /// <summary>
            /// Just blow away the previous definition.
            /// </summary>
            if (ShipShieldDef == Shield)
            {
                if (ShipShieldDef.componentType != ComponentTypeTN.AbsorptionShield)
                {
                    ShipShieldCount = (ushort)((short)ShipShieldCount + inc);

                    if (ShipShieldCount != 0)
                    {
                        TotalShieldPool = TotalShieldPool + (ShipShieldDef.shieldPool * inc);
                        TotalShieldGenPerTick = TotalShieldGenPerTick + (ShipShieldDef.shieldGenPerTick * inc);
                        TotalShieldFuelCostPerTick = TotalShieldFuelCostPerTick + ((ShipShieldDef.fuelCostPerHour / 720.0f) * inc);
                    }
                    else
                    {
                        TotalShieldPool = 0.0f;
                        TotalShieldGenPerTick = 0.0f;
                        TotalShieldFuelCostPerTick = 0.0f;
                        ShipShieldDef = null;
                    }
                }
                else
                {
                    if (ShipShieldCount == 1 && inc == -1)
                    {
                        ShipShieldCount = 0;
                        TotalShieldPool = 0.0f;
                        TotalShieldGenPerTick = 0.0f;
                        TotalShieldFuelCostPerTick = 0.0f;
                        ShipShieldDef = null;
                    }
                    else
                    {
                        /// <summary>
                        /// Multiple shields of this type are not allowed.
                        /// </summary>
                    }
                }
            }
            else if (ShipShieldDef == null)
            {
                ShipShieldDef = Shield;
                ShipShieldCount = (ushort)((short)ShipShieldCount + inc);
                TotalShieldPool = TotalShieldPool + (ShipShieldDef.shieldPool * inc);
                TotalShieldGenPerTick = TotalShieldGenPerTick + (ShipShieldDef.shieldGenPerTick * inc);
                TotalShieldFuelCostPerTick = TotalShieldFuelCostPerTick + ((ShipShieldDef.fuelCostPerHour / 720.0f) * inc);
            }
            else
            {
                /// <summary>
                /// Multiple shield types are not allowed.
                /// </summary>
                ShieldAllowed = false;
            }

            if (ShieldAllowed == true)
            {
                MaxEMSignature = MaxEMSignature + (int)(Shield.shieldPool * 30.0f * (float)inc);
                UpdateClass(Shield, inc);
            }
        }