示例#1
0
 /// <summary>
 /// Performs the given remapping
 /// </summary>
 /// <param name="point"></param>
 public void Remap(RemappingPoint point)
 {
     for (int i = 0; i < m_attributes.Length; i++)
     {
         EveAttribute attrib = (EveAttribute)i;
         m_attributes[i].Base = point[attrib];
     }
 }
示例#2
0
        /// <summary>
        /// Clones the remapping point.
        /// </summary>
        /// <returns></returns>
        public RemappingPoint Clone()
        {
            RemappingPoint clone = new RemappingPoint();

            Array.Copy(m_attributes, clone.m_attributes, 5);
            clone.m_status = m_status;
            clone.m_guid   = m_guid;
            return(clone);
        }
 /// <summary>
 /// Constructor for use in code when the user wants to manually edit a remapping point.
 /// </summary>
 /// <param name="character">Character information</param>
 /// <param name="plan">Plan to optimize for</param>
 /// <param name="strategy">Optimization strategy</param>
 /// <param name="name">Title of this form</param>
 /// <param name="description">Description of the optimization operation</param>
 public AttributesOptimizationForm(Character character, Plan plan, RemappingPoint point)
     : this()
 {
     m_plan = plan;
     m_character = character;
     m_baseCharacter = character.After(plan.ChosenImplantSet);
     m_manuallyEditedRemappingPoint = point;
     m_strategy = Strategy.ManualRemappingPointEdition;
     m_description = "Manual editing of a remapping point";
     Text = "Remapping point manual editing (" + plan.Name + ")";
 }
示例#4
0
        /// <summary>
        /// Deserialization constructor
        /// </summary>
        /// <param name="character"></param>
        /// <param name="serial"></param>
        internal PlanEntry(BasePlan owner, SerializablePlanEntry serial)
        {
            m_owner = owner;
            m_entryType = serial.Type;
            m_skill = GetSkill(serial);
            m_level = serial.Level;
            m_notes = serial.Notes;
            m_priority = serial.Priority;

            serial.PlanGroups.ForEach(x => m_planGroups.Add(x));

            if (serial.Remapping != null)
                m_remapping = new RemappingPoint(serial.Remapping);
        }
示例#5
0
        /// <summary>
        /// Deserialization constructor
        /// </summary>
        /// <param name="character"></param>
        /// <param name="serial"></param>
        internal PlanEntry(BasePlan owner, SerializablePlanEntry serial)
        {
            m_owner     = owner;
            m_entryType = serial.Type;
            m_skill     = GetSkill(serial);
            m_level     = serial.Level;
            m_notes     = serial.Notes;
            m_priority  = serial.Priority;

            serial.PlanGroups.ForEach(x => m_planGroups.Add(x));

            if (serial.Remapping != null)
            {
                m_remapping = new RemappingPoint(serial.Remapping);
            }
        }
示例#6
0
        /// <summary>
        /// Deserialization constructor
        /// </summary>
        /// <param name="character"></param>
        /// <param name="serial"></param>
        internal PlanEntry(BasePlan owner, SerializablePlanEntry serial)
        {
            m_owner     = owner;
            m_entryType = serial.Type;
            m_skill     = StaticSkills.GetSkillByName(serial.SkillName);
            m_level     = serial.Level;
            m_notes     = serial.Notes;
            m_priority  = serial.Priority;

            foreach (var group in serial.PlanGroups)
            {
                m_planGroups.Add(group);
            }

            if (serial.Remapping != null)
            {
                m_remapping = new RemappingPoint(serial.Remapping);
            }
        }
示例#7
0
 /// <summary>
 /// Constructor for a result bound to a remapping point
 /// </summary>
 /// <param name="point">Associated remapping point, may be null.</param>
 /// <param name="baseScratchpad"></param>
 public RemappingResult(RemappingPoint point, CharacterScratchpad baseScratchpad)
     : this(baseScratchpad)
 {
     m_point = point;
 }
        /// <summary>
        /// Starts optimization.
        /// </summary>
        private void Run()
        {
            // Compute best scratchpad
            var bestDuration = TimeSpan.Zero;
            AttributesOptimizer.RemappingResult remapping = null;
            List<AttributesOptimizer.RemappingResult> remappingList = null;

            switch (m_strategy)
            {
                case Strategy.ManualRemappingPointEdition:
                    m_areRemappingPointsActive = true;
                    if (m_update)
                    {
                        remapping = m_remapping;
                        m_manuallyEditedRemappingPoint = remapping.Point.Clone();
                    }
                    else
                    {
                        remapping = AttributesOptimizer.GetResultsFromRemappingPoints(m_plan).Single(x => x.Point == m_manuallyEditedRemappingPoint);
                        m_manuallyEditedRemappingPoint = m_manuallyEditedRemappingPoint.Clone();
                        m_remapping = remapping;
                    }
                    remapping.Optimize(TimeSpan.MaxValue);
                    break;
                case Strategy.Character:
                    m_areRemappingPointsActive = false;
                    remapping = AttributesOptimizer.OptimizeFromCharacter(m_character, m_plan);
                    break;
                case Strategy.OneYearPlan:
                    m_areRemappingPointsActive = false;
                    remapping = AttributesOptimizer.OptimizeFromFirstYearOfPlan(m_plan);
                    break;
                case Strategy.RemappingPoints:
                    m_areRemappingPointsActive = true;
                    remappingList = AttributesOptimizer.OptimizeFromPlanAndRemappingPoints(m_plan);
                    break;
                default:
                    throw new NotImplementedException();
            }

            if (m_update)
            {
                // Update the controls for every attribute on the already shown form
                UpdateForm(remapping, remappingList);
            }
            else
            {
                // Update the controls for every attribute
                this.Invoke((MethodInvoker)(() => UpdateForm(remapping, remappingList)));
            }
        }
示例#9
0
 /// <summary>
 /// Clones the remapping point.
 /// </summary>
 /// <returns></returns>
 public RemappingPoint Clone()
 {
     RemappingPoint clone = new RemappingPoint();
     Array.Copy(m_attributes, clone.m_attributes, 5);
     clone.m_status = m_status;
     clone.m_guid = m_guid;
     return clone;
 }
示例#10
0
        /// <summary>
        /// On a doube-click on one of the list items, we open the skill browser.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lvSkills_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (lvSkills.SelectedItems.Count == 1)
            {
                // When the first entry is a skill, shows it in the skill browser.
                if (GetFirstSelectedEntry() != null)
                {
                    miShowInSkillBrowser_Click(sender, e);
                }
                // When it is a remapping point, edit it
                else
                {
                    // Retrieves the point
                    var nextItem = lvSkills.Items[lvSkills.SelectedIndices[0] + 1];
                    var entry = GetPlanEntry(nextItem);
                    var point = entry.Remapping;

                    // Display the attributes optimization form
                    // if it's not already shown
                    if (point != m_formTag)
                    {
                        // When we click on another point the previous form closes
                        if (m_oldForm != null)
                            m_oldForm.Close();

                        // Creates the form and displays it
                        var form = new AttributesOptimizationForm(m_character, m_plan, point);
                        form.FormClosed += (AttributesOptimizationForm, args) => m_formTag = null;
                        form.PlanEditor = this;
                        form.Show(this);

                        // Update variables for forms display control
                        m_formTag = point;
                        m_oldForm = form;
                    }
                }
            }
        }
        /// <summary>
        /// Updates the controls with the values from the current remapping point.
        /// </summary>
        /// <param name="point"></param>
        public void UpdateValuesFrom(RemappingPoint point)
        {
            // Creates a scratchpad with the base values from the provided point.
            var scratchpad = new CharacterScratchpad(m_character.After(m_plan.ChosenImplantSet));
            for (int i = 0; i < 5; i++)
            {
                scratchpad[(EveAttribute)i].Base = point[(EveAttribute)i];
            }

            var remapping = new AttributesOptimizer.RemappingResult(m_remapping, scratchpad);
            remapping.Update();

            // Update the controls
            UpdateControls(m_character, m_plan, remapping, m_description);

            // Fires the event
            if (AttributeChanged != null)
                AttributeChanged(this, remapping);
        }