Exemplo n.º 1
0
        /// <summary>
        /// Gets a character scratchpad representing this character after a switch to the provided implant set.
        /// </summary>
        /// <param name="set">The set.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentNullException">set</exception>
        public CharacterScratchpad After(ImplantSet set)
        {
            set.ThrowIfNull(nameof(set));

            CharacterScratchpad scratchpad = new CharacterScratchpad(this);

            for (int i = 0; i < 5; i++)
            {
                EveAttribute attribute = (EveAttribute)i;
                scratchpad[attribute].ImplantBonus = set[attribute].Bonus;
            }
            return(scratchpad);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets a string representation of the attribute.
        /// </summary>
        /// <param name="attrib">The attribute.</param>
        /// <param name="oldScratchpad">The old scratchpad.</param>
        /// <param name="newScratchpad">The new scratchpad.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentNullException">
        /// oldScratchpad
        /// or
        /// newScratchpad
        /// </exception>
        public static string GetStringForAttribute(EveAttribute attrib, CharacterScratchpad oldScratchpad,
                                                   CharacterScratchpad newScratchpad)
        {
            oldScratchpad.ThrowIfNull(nameof(oldScratchpad));

            newScratchpad.ThrowIfNull(nameof(newScratchpad));

            long bonusDifference = newScratchpad[attrib].Base - oldScratchpad[attrib].Base;

            if (bonusDifference == 0)
            {
                return(newScratchpad[attrib].ToString("%N (0) = %e = (%B + %r + %i)"));
            }

            return(newScratchpad[attrib].ToString(bonusDifference > 0
                ? $"%N (+{bonusDifference}) = %e = (%B + %r + %i)"
                : $"%N ({bonusDifference}) = %e = (%B + %r + %i)"));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Will set the provided character scratchpad's base attributes as the target values to remap.
        /// </summary>
        /// <param name="newScratchpad">The scratchpad with the target base values to assign to this point</param>
        /// <param name="oldScratchpad">The scratchpad before we remapped</param>
        internal void SetBaseAttributes(CharacterScratchpad newScratchpad, CharacterScratchpad oldScratchpad)
        {
            // Update the status
            Status = RemappingPointStatus.UpToDate;

            // Initialize the string
            StringBuilder builder = new StringBuilder();

            // Scroll through attributes
            for (int i = 0; i < 5; i++)
            {
                // Compute the new base attribute
                EveAttribute attrib = (EveAttribute)i;
                m_attributes[i] = newScratchpad[attrib].Base;

                // Update description
                builder.AppendLine().Append(GetStringForAttribute(attrib, oldScratchpad, newScratchpad));
            }

            // Return the final string
            m_description = builder.ToString();
        }
Exemplo n.º 4
0
 /// <summary>
 /// Gets the base attribute value for the given attribute.
 /// </summary>
 /// <param name="attribute">The attribute to retrieve.</param>
 /// <returns></returns>
 protected override ICharacterAttribute GetAttribute(EveAttribute attribute) => m_attributes[(int)attribute];
Exemplo n.º 5
0
 /// <summary>
 /// Attributes include current implants! Therefore, subtract the information
 /// about current implants since those were fetched with Implants beforehand.
 /// </summary>
 /// <param name="attribute">The attribute to set.</param>
 /// <param name="value">The value reported by Attributes ESI call.</param>
 private void SetAttribute(EveAttribute attribute, int value)
 {
     m_attributes[(int)attribute].Base = value - CurrentImplants[attribute]?.Bonus ?? 0;
 }
Exemplo n.º 6
0
 /// <summary>
 /// Constructor from a character attribute.
 /// </summary>
 /// <param name="character"></param>
 /// <param name="attrib"></param>
 internal CharacterAttribute(Character character, EveAttribute attrib)
 {
     Base        = EveConstants.CharacterBaseAttributePoints;
     m_attrib    = attrib;
     m_character = character;
 }
Exemplo n.º 7
0
 /// <summary>
 /// Gets the <see cref="ICharacterAttribute"/> with the specified attribute.
 /// </summary>
 /// <value></value>
 public ICharacterAttribute this[EveAttribute attribute] => GetAttribute(attribute);
Exemplo n.º 8
0
 protected abstract ICharacterAttribute GetAttribute(EveAttribute attribute);
Exemplo n.º 9
0
 /// <summary>
 /// Gets the new base value for the given attribute.
 /// </summary>
 /// <param name="attrib"></param>
 /// <returns></returns>
 public long this[EveAttribute attrib] => m_attributes[(int)attrib];
Exemplo n.º 10
0
 /// <summary>
 /// Gets / sets the implant for the given slot.
 /// </summary>
 /// <param name="attrib">The attribute for the implant to retrieve</param>
 /// <returns>The requested implant when found; null otherwise.</returns>
 public Implant this[EveAttribute attrib]
 {
     get { return(this[Implant.AttribToSlot(attrib)]); }
     set { this[Implant.AttribToSlot(attrib)] = value; }
 }
Exemplo n.º 11
0
 /// <summary>
 /// Gets the new base value for the given attribute.
 /// </summary>
 /// <param name="attrib"></param>
 /// <returns></returns>
 public Int64 this[EveAttribute attrib] => m_attributes[(int)attrib];