/// <summary> /// On load, update the controls states. /// </summary> /// <param name="e"></param> protected override void OnLoad(EventArgs e) { m_character = (Character)m_plan.Character; m_characterScratchpad = m_plan.Character.After(m_plan.ChosenImplantSet); m_set = m_plan.ChosenImplantSet; // Set the min and max values of the NumericUpDown controls // based on character attributes value foreach (var control in AtrributesPanel.Controls) { NumericUpDown nud = control as NumericUpDown; if (nud == null) { continue; } var attrib = (EveAttribute)(int.Parse((string)nud.Tag)); nud.Minimum = m_character[attrib].EffectiveValue - m_character[attrib].ImplantBonus; nud.Maximum = (m_plan.ChosenImplantSet[attrib].Bonus > EveConstants.MaxImplantPoints ? nud.Minimum + m_plan.ChosenImplantSet[attrib].Bonus : nud.Minimum + EveConstants.MaxImplantPoints); } UpdateContent(); base.OnLoad(e); }
/// <summary> /// When an implant set menu item is clicked, we update the member for the current character. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void implantSetMenuitem_Click(object sender, EventArgs e) { // Update the character to a scratchpad using the implant set attacthed to the sender menu as its tag. var menu = (ToolStripItem)sender; m_set = menu.Tag as ImplantSet; m_characterScratchpad = m_character.After(m_set); UpdateContent(); }
/// <summary> /// Gets the multiplier of an implant. /// </summary> /// <param name="implantType"></param> /// <returns></returns> private double GetImplantMultiplier(string implantType) { ImplantSet implantSet = (ImplantSet)cbImplantSet.Tag; string implantSubname = String.Format("Zainou 'Beancounter' {0}", implantType); Implant implant = implantSet.FirstOrDefault(x => x.Name.Contains(implantSubname)); if (implant == null) { return(1.0d); } double bonus = implant.Properties.FirstOrDefault(x => Array.IndexOf(DBConstants.IndustryModifyingPropertyIDs, x.Property.ID) != -1).IValue; double multiplier = 1.0d + (bonus / 100); return(multiplier); }
/// <summary> /// Gets the multiplier of an implant. /// </summary> /// <returns></returns> private double GetImplantMultiplier(ICollection <int> implantIDs) { ImplantSet implantSet = (ImplantSet)cbImplantSet.Tag; Implant implant = implantSet?.FirstOrDefault(x => implantIDs.Contains(x.ID)); if (implant == null) { return(1.0d); } double bonus = implant.Properties .FirstOrDefault(x => DBConstants.IndustryModifyingPropertyIDs.IndexOf(x.Property.ID) != -1) .Int64Value; double multiplier = 1.0d + bonus / 100; return(multiplier); }
/// <summary> /// Update all the times on the right pane (base time, best time, etc). /// </summary> private async Task UpdateTimesAsync() { // Current (with implants) TimeSpan currentSpan = await UpdateTimesForCharacter(m_character.After(m_plan.ChosenImplantSet)); // Current (without implants) ImplantSet noneImplantSet = m_character.ImplantSets.None; TimeSpan baseSpan = await UpdateTimesForCharacter(m_character.After(noneImplantSet)); // This CharacterScratchpad scratchpad = CreateModifiedScratchpad(m_character.After(m_plan.ChosenImplantSet)); TimeSpan thisSpan = await UpdateTimesForCharacter(scratchpad); lblCurrentSpan.Text = currentSpan.ToDescriptiveText(DescriptiveTextOptions.IncludeCommas); lblCurrentDate.Text = DateTime.Now.Add(currentSpan).ToString(CultureConstants.DefaultCulture); lblBaseSpan.Text = baseSpan.ToDescriptiveText(DescriptiveTextOptions.IncludeCommas); lblBaseDate.Text = DateTime.Now.Add(baseSpan).ToString(CultureConstants.DefaultCulture); lblThisSpan.Text = thisSpan.ToDescriptiveText(DescriptiveTextOptions.IncludeCommas); lblThisDate.Text = DateTime.Now.Add(thisSpan).ToString(CultureConstants.DefaultCulture); // Are the new attributes better than current (without implants) ? lblComparedToBase.ForeColor = thisSpan > baseSpan ? Color.Red : thisSpan < baseSpan ? Color.Green : SystemColors.ControlText; lblComparedToBase.Text = thisSpan > baseSpan ? $"{thisSpan.Subtract(baseSpan).ToDescriptiveText(DescriptiveTextOptions.IncludeCommas)} slower than current base" : thisSpan < baseSpan ? $"{baseSpan.Subtract(thisSpan).ToDescriptiveText(DescriptiveTextOptions.IncludeCommas)} faster than current base" : @"No time difference than current base"; // Are the new attributes better than current (with implants) ? lblComparedToCurrent.ForeColor = thisSpan > currentSpan ? Color.DarkRed : thisSpan < currentSpan ? Color.DarkGreen : SystemColors.ControlText; lblComparedToCurrent.Text = thisSpan > currentSpan ? $"{thisSpan.Subtract(currentSpan).ToDescriptiveText(DescriptiveTextOptions.IncludeCommas)} slower than current" : thisSpan < currentSpan ? $"{currentSpan.Subtract(thisSpan).ToDescriptiveText(DescriptiveTextOptions.IncludeCommas)} faster than current" : @"No time difference than current base"; // Update the plan's pluggable column m_planEditor?.ShowWithPluggable(this); }
/// <summary> /// On load, update the controls states. /// </summary> /// <param name="e"></param> protected override void OnLoad(EventArgs e) { m_character = (Character)m_plan.Character; m_characterScratchpad = m_plan.Character.After(m_plan.ChosenImplantSet); m_set = m_plan.ChosenImplantSet; // Set the min and max values of the NumericUpDown controls // based on character attributes value foreach (var control in AtrributesPanel.Controls) { NumericUpDown nud = control as NumericUpDown; if (nud == null) continue; var attrib = (EveAttribute)(int.Parse((string)nud.Tag)); nud.Minimum = m_character[attrib].EffectiveValue - m_character[attrib].ImplantBonus; nud.Maximum = (m_plan.ChosenImplantSet[attrib].Bonus > EveConstants.MaxImplantPoints ? nud.Minimum + m_plan.ChosenImplantSet[attrib].Bonus : nud.Minimum + EveConstants.MaxImplantPoints); } UpdateContent(); base.OnLoad(e); }