示例#1
0
        /// <summary>
        /// Gets the implant name for the given slot and the provided set.
        /// </summary>
        /// <param name="set"></param>
        /// <param name="slot"></param>
        /// <returns></returns>
        private static Implant GetImplant(SerializableSettingsImplantSet set, ImplantSlots slot)
        {
            // Invoke the property getter with the matching name through reflection
            object implantName = typeof(SerializableSettingsImplantSet).GetProperty(slot.ToString()).GetValue(set, null);

            return(StaticItems.GetImplants(slot)[(string)implantName]);
        }
示例#2
0
        /// <summary>
        /// Update the comboboxes' selections.
        /// </summary>
        private void UpdateSlots()
        {
            SerializableSettingsImplantSet set = GetSelectedSet();

            // No set selected or row name empty?
            if (set == null || String.IsNullOrEmpty(set.Name))
            {
                foreach (DropDownMouseMoveComboBox combo in Controls.OfType <DropDownMouseMoveComboBox>())
                {
                    // Disable the combo with the <None> implant
                    combo.SelectedIndex = 0;
                    combo.Visible       = true;
                    combo.Enabled       = false;

                    // Hide the label used for read-only sets
                    ImplantSlots slot  = (ImplantSlots)combo.Tag;
                    Label        label = m_labels[(int)slot];
                    label.Visible = false;
                }
                return;
            }

            // Scroll through comboboxes
            bool isReadOnly = set == m_sets.ActiveClone || m_sets.JumpClones.Any(x => x == set);

            foreach (DropDownMouseMoveComboBox combo in Controls.OfType <DropDownMouseMoveComboBox>())
            {
                // Enable the combo with the <None> implant
                combo.SelectedIndex = 0;
                combo.Visible       = !isReadOnly;
                combo.Enabled       = true;

                ImplantSlots slot            = (ImplantSlots)combo.Tag;
                Implant      selectedImplant = GetImplant(set, slot);

                // Scroll through every implant and check whether it is the selected one.
                int index = 0;
                foreach (Implant implant in combo.Items)
                {
                    if (implant == selectedImplant)
                    {
                        combo.SelectedIndex = index;
                        break;
                    }
                    index++;
                }

                // Set "none" when the implant was not found.
                if (index == combo.Items.Count)
                {
                    combo.SelectedIndex = 0;
                }

                // Updates the label displayed for read-only sets.
                Label label = m_labels[(int)slot];
                label.Visible = isReadOnly;
                label.Text    = selectedImplant.Name;
                label.Tag     = selectedImplant;
            }
        }
示例#3
0
        /// <summary>
        /// Deserialization constructor.
        /// </summary>
        /// <param name="group"></param>
        /// <param name="src"></param>
        internal Implant(MarketGroup group, SerializableItem src)
            : base(group, src)
        {
            // Gets the slot
            var slotProperty = this.Properties[DBConstants.ImplantSlotPropertyID];
            m_implantSlot = (slotProperty == null ? ImplantSlots.None : (ImplantSlots)(slotProperty.Value.IValue - 1));

            // Get the bonus
            switch (m_implantSlot)
            {
                case ImplantSlots.Charisma:
                    m_bonus = this.Properties[DBConstants.CharismaModifierPropertyID].Value.IValue;
                    break;
                case ImplantSlots.Intelligence:
                    m_bonus = this.Properties[DBConstants.IntelligenceModifierPropertyID].Value.IValue;
                    break;
                case ImplantSlots.Memory:
                    m_bonus = this.Properties[DBConstants.MemoryModifierPropertyID].Value.IValue;
                    break;
                case ImplantSlots.Perception:
                    m_bonus = this.Properties[DBConstants.PerceptionModifierPropertyID].Value.IValue;
                    break;
                case ImplantSlots.Willpower:
                    m_bonus = this.Properties[DBConstants.WillpowerModifierPropertyID].Value.IValue;
                    break;
                default:
                    break;
            }

            // Adds itself to the implants slot
            StaticItems.GetImplants(m_implantSlot).Add(this);
        }
示例#4
0
        /// <summary>
        /// Gets or sets the implant for the given slot.
        /// </summary>
        /// <param name="slot">The slot for the implant to retrieve</param>
        /// <returns>The requested implant when found; null otherwise.</returns>
        public Implant this[ImplantSlots slot]
        {
            get
            {
                if (slot == ImplantSlots.None)
                {
                    return(null);
                }
                return(m_values[(int)slot]);
            }
            set
            {
                if (slot == ImplantSlots.None)
                {
                    throw new InvalidOperationException("Cannot assign 'none' slot");
                }

                if (value != null && value.Slot != slot)
                {
                    throw new InvalidOperationException("Slot mismatch");
                }

                if (value == null)
                {
                    value = Implant.None;
                }
                else
                {
                    m_values[(int)slot] = value;
                }

                EveClient.OnCharacterChanged(m_owner);
            }
        }
示例#5
0
        /// <summary>
        /// Updates the given slot with the provided serialization object.
        /// </summary>
        /// <param name="slot"></param>
        /// <param name="name"></param>
        private void Import(ImplantSlots slot, string name)
        {
            // Backwards compatibility for older versions
            name = name.Replace("<", String.Empty).Replace(">", String.Empty);

            m_values[(int)slot] = StaticItems.GetImplants(slot)[name] ?? new Implant(slot);
        }
示例#6
0
        /// <summary>
        /// Sets the implant name for the given slot and the provided set.
        /// </summary>
        /// <param name="set"></param>
        /// <param name="slot"></param>
        /// <param name="implant"></param>
        /// <returns></returns>
        private static void SetImplant(SerializableSettingsImplantSet set, ImplantSlots slot, Implant implant)
        {
            // Set may be null when the user is editing the phantom line
            if (set == null)
            {
                return;
            }

            // Invoke the property setter with the matching name through reflection
            typeof(SerializableSettingsImplantSet).GetProperty(slot.ToString()).SetValue(set, implant.Name, null);
        }
示例#7
0
        /// <summary>
        /// When the selection changes, we change the implant
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cbSlotN_DropDownClosed(object sender, EventArgs e)
        {
            if (setsGrid.SelectedRows.Count != 0)
            {
                EnsureRowSetInitialized(setsGrid.SelectedRows[0]);
            }

            DropDownMouseMoveComboBox combo = (DropDownMouseMoveComboBox)sender;
            ImplantSlots slot = (ImplantSlots)combo.Tag;

            SetImplant(GetSelectedSet(), slot, (Implant)combo.SelectedItem);
        }
示例#8
0
        /// <summary>
        /// Adds the combo box and label.
        /// </summary>
        /// <param name="control">The control.</param>
        private void AddComboBoxAndLabel(IDisposable control)
        {
            DropDownMouseMoveComboBox combo = control as DropDownMouseMoveComboBox;

            if (combo == null)
            {
                return;
            }

            int slotIndex;

            if (!combo.Name.Replace("cbSlot", string.Empty).TryParseInv(out slotIndex) ||
                slotIndex < 1)
            {
                return;
            }
            ImplantSlots slot = (ImplantSlots)(slotIndex - 1);

            combo.Tag                = slot;
            combo.MouseMove         += combo_MouseMove;
            combo.DropDownClosed    += combo_DropDownClosed;
            combo.DropDownMouseMove += combo_DropDownMouseMove;
            foreach (Implant implant in StaticItems.GetImplants(slot))
            {
                combo.Items.Add(implant);
            }

            Label tempLabel = null;

            try
            {
                tempLabel            = new Label();
                tempLabel.MouseMove += label_MouseMove;
                tempLabel.AutoSize   = false;
                tempLabel.Anchor     = combo.Anchor;
                tempLabel.Bounds     = combo.Bounds;
                tempLabel.TextAlign  = ContentAlignment.MiddleLeft;

                Label label = tempLabel;
                tempLabel = null;

                m_labels[(int)slot] = label;
            }
            finally
            {
                tempLabel?.Dispose();
            }
        }
示例#9
0
 /// <summary>
 /// Converts the provided slot to an attribute. Returns <see cref="Attribute.None"/> when the provided slot does not match any attribute.
 /// </summary>
 /// <param name="slot"></param>
 /// <returns></returns>
 public static EveAttribute SlotToAttrib(ImplantSlots slot)
 {
     switch (slot)
     {
         case ImplantSlots.Perception:
             return EveAttribute.Perception;
         case ImplantSlots.Memory:
             return EveAttribute.Memory;
         case ImplantSlots.Willpower:
             return EveAttribute.Willpower;
         case ImplantSlots.Intelligence:
             return EveAttribute.Intelligence;
         case ImplantSlots.Charisma:
             return EveAttribute.Charisma;
         default:
             return EveAttribute.None;
     }
 }
示例#10
0
        /// <summary>
        /// Gets or sets the implant for the given slot.
        /// </summary>
        /// <param name="slot">The slot for the implant to retrieve</param>
        /// <returns>The requested implant when found; null otherwise.</returns>
        private Implant this[ImplantSlots slot]
        {
            get { return(slot == ImplantSlots.None ? new Implant(slot) : m_values[(int)slot]); }
            set
            {
                if (slot == ImplantSlots.None)
                {
                    throw new InvalidOperationException("Cannot assign 'none' slot");
                }

                if (value != null && value.Slot != slot)
                {
                    throw new InvalidOperationException("Slot mismatch");
                }

                m_values[(int)slot] = value ?? new Implant(slot);

                EveMonClient.OnCharacterUpdated(m_owner);
            }
        }
示例#11
0
        /// <summary>
        /// Deserialization constructor.
        /// </summary>
        /// <param name="group"></param>
        /// <param name="src"></param>
        internal Implant(MarketGroup group, SerializableItem src)
            : base(group, src)
        {
            // Gets the slot
            var slotProperty = this.Properties[DBConstants.ImplantSlotPropertyID];

            m_implantSlot = (slotProperty == null ? ImplantSlots.None : (ImplantSlots)(slotProperty.Value.IValue - 1));

            // Get the bonus
            switch (m_implantSlot)
            {
            case ImplantSlots.Charisma:
                m_bonus = this.Properties[DBConstants.CharismaModifierPropertyID].Value.IValue;
                break;

            case ImplantSlots.Intelligence:
                m_bonus = this.Properties[DBConstants.IntelligenceModifierPropertyID].Value.IValue;
                break;

            case ImplantSlots.Memory:
                m_bonus = this.Properties[DBConstants.MemoryModifierPropertyID].Value.IValue;
                break;

            case ImplantSlots.Perception:
                m_bonus = this.Properties[DBConstants.PerceptionModifierPropertyID].Value.IValue;
                break;

            case ImplantSlots.Willpower:
                m_bonus = this.Properties[DBConstants.WillpowerModifierPropertyID].Value.IValue;
                break;

            default:
                break;
            }

            // Adds itself to the implants slot
            StaticItems.GetImplants(m_implantSlot).Add(this);
        }
示例#12
0
        /// <summary>
        /// Converts the provided slot to an attribute. Returns <see cref="EveAttribute.None"/> when the provided slot does not match any attribute.
        /// </summary>
        /// <param name="slot"></param>
        /// <returns></returns>
        public static EveAttribute SlotToAttrib(ImplantSlots slot)
        {
            switch (slot)
            {
            case ImplantSlots.Perception:
                return(EveAttribute.Perception);

            case ImplantSlots.Memory:
                return(EveAttribute.Memory);

            case ImplantSlots.Willpower:
                return(EveAttribute.Willpower);

            case ImplantSlots.Intelligence:
                return(EveAttribute.Intelligence);

            case ImplantSlots.Charisma:
                return(EveAttribute.Charisma);

            default:
                return(EveAttribute.None);
            }
        }
示例#13
0
 /// <summary>
 /// Gets the collection of implants for the given slot.
 /// </summary>
 /// <param name="slot"></param>
 /// <returns></returns>
 public static ImplantCollection GetImplants(ImplantSlots slot) => s_implantSlots[(int)slot];
示例#14
0
 /// <summary>
 /// Deserialization constructor.
 /// </summary>
 /// <param name="slot"></param>
 internal ImplantCollection(ImplantSlots slot)
 {
     Items.Add(new Implant(slot));
 }
示例#15
0
 /// <summary>
 /// Private constructor for the default.
 /// </summary>
 internal Implant()
     : base(-1, ImplantSlots.None.ToString())
 {
     m_implantSlot = ImplantSlots.None;
 }
示例#16
0
 /// <summary>
 /// Deserialization constructor.
 /// </summary>
 /// <param name="src"></param>
 internal ImplantCollection(ImplantSlots slot)
     : base()
 {
     m_slot = slot;
 }
示例#17
0
 /// <summary>
 /// Gets the collection of implants for the given slot.
 /// </summary>
 /// <param name="slot"></param>
 /// <returns></returns>
 public static ImplantSlot GetImplants(ImplantSlots slot)
 {
     return(s_implantSlots[(int)slot]);
 }
示例#18
0
        /// <summary>
        /// Gets the implant name for the given slot and the provided set.
        /// </summary>
        /// <param name="set"></param>
        /// <param name="slot"></param>
        /// <returns></returns>
        private Implant GetImplant(SerializableSettingsImplantSet set, ImplantSlots slot)
        {
            // Invoke the property getter with the matching name through reflection
            var implantName = typeof(SerializableSettingsImplantSet).GetProperty(slot.ToString()).GetValue(set, null);

            return StaticItems.GetImplants(slot)[(string)implantName] as Implant;
        }
示例#19
0
 /// <summary>
 /// Exports an implant as a serialization object.
 /// </summary>
 /// <param name="slot"></param>
 /// <returns></returns>
 private string Export(ImplantSlots slot)
 {
     return(m_values[(int)slot].Name);
 }
示例#20
0
 /// <summary>
 /// Updates the given slot with the provided serialization object
 /// </summary>
 /// <param name="slot"></param>
 /// <param name="serial"></param>
 private void Import(ImplantSlots slot, string name)
 {
     m_values[(int)slot] = StaticItems.GetImplants(slot)[name];
 }
示例#21
0
 /// <summary>
 /// Internal constructor for the default.
 /// </summary>
 internal Implant(ImplantSlots slot)
     : base(-1, ImplantSlots.None.ToString())
 {
     Slot = slot;
 }
示例#22
0
 /// <summary>
 /// Gets the collection of implants for the given slot.
 /// </summary>
 /// <param name="slot"></param>
 /// <returns></returns>
 public static ImplantCollection GetImplants(ImplantSlots slot) => s_implantSlots[(int)slot];
示例#23
0
文件: Implant.cs 项目: Almamu/evemon
 /// <summary>
 /// Private constructor for the default.
 /// </summary>
 internal Implant()
     : base(-1, "<None>")
 {
     m_implantSlot = ImplantSlots.None;
 }
示例#24
0
 /// <summary>
 /// Exports an implant as a serialization object.
 /// </summary>
 /// <param name="slot"></param>
 /// <returns></returns>
 private string Export(ImplantSlots slot) => m_values[(int)slot].Name;
示例#25
0
 /// <summary>
 /// Private constructor for the default.
 /// </summary>
 internal Implant()
     : base(-1, ImplantSlots.None.ToString())
 {
     m_implantSlot = ImplantSlots.None;
 }
示例#26
0
        /// <summary>
        /// Sets the implant name for the given slot and the provided set.
        /// </summary>
        /// <param name="set"></param>
        /// <param name="slot"></param>
        /// <param name="implantName"></param>
        /// <returns></returns>
        private void SetImplant(SerializableSettingsImplantSet set, ImplantSlots slot, Implant implant)
        {
            // Set may be null when the user is editing the phantom line
            if (set == null) return;

            // Invoke the property setter with the matching name through reflection
            typeof(SerializableSettingsImplantSet).GetProperty(slot.ToString()).SetValue(set, implant.Name, null);
        }
示例#27
0
        /// <summary>
        /// Updates the given slot with the provided implant's name.
        /// </summary>
        /// <param name="slot"></param>
        /// <param name="src"></param>
        private void Import(ImplantSlots slot, SerializableImplant src)
        {
            int index = (int)slot;

            m_values[index] = (src == null ? Implant.None : StaticItems.GetImplants(slot)[src.Name]);
        }
示例#28
0
 /// <summary>
 /// Internal constructor for the default.
 /// </summary>
 internal Implant(ImplantSlots slot)
     : base(-1, ImplantSlots.None.ToString())
 {
     Slot = slot;
 }
示例#29
0
文件: Implant.cs 项目: Almamu/evemon
 /// <summary>
 /// Deserialization constructor
 /// </summary>
 /// <param name="src"></param>
 internal ImplantSlot(ImplantSlots slot)
     : base()
 {
     m_slot = slot;
 }