Ejemplo n.º 1
0
 /// <summary>
 /// Constructor for CCP Characters.
 /// </summary>
 /// <param name="uri">URI of the character</param>
 /// <param name="result">Serialized Result</param>
 public UriCharacterEventArgs(Uri uri, SerializableCCPCharacter result)
 {
     m_uri    = uri;
     m_result = result;
     HasError = false;
     Error    = String.Empty;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Constructor for CCP Characters.
 /// </summary>
 /// <param name="uri">URI of the character</param>
 /// <param name="result">Serialized Result</param>
 public UriCharacterEventArgs(Uri uri, SerializableCharacterSheetBase result)
 {
     Uri      = uri;
     m_result = result;
     HasError = false;
     Error    = String.Empty;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Imports data from the given character sheet informations.
        /// </summary>
        /// <param name="serial">The serialized character sheet</param>
        private void Import(SerializableCharacterSheetBase serial)
        {
            // Bio
            m_name                = serial.Name;
            homeStation           = serial.HomeStationID;
            Birthday              = serial.Birthday;
            Race                  = serial.Race;
            Bloodline             = serial.BloodLine;
            Ancestry              = serial.Ancestry;
            Gender                = serial.Gender;
            CorporationName       = serial.CorporationName;
            CorporationID         = serial.CorporationID;
            AllianceName          = serial.AllianceName;
            AllianceID            = serial.AllianceID;
            FreeSkillPoints       = serial.FreeSkillPoints;
            AvailableReMaps       = serial.FreeRespecs;
            JumpCloneLastJumpDate = serial.CloneJumpDate;
            LastReMapDate         = serial.LastRespecDate;
            LastReMapTimed        = serial.LastTimedRespec;
            RemoteStationDate     = serial.RemoteStationDate;
            JumpActivationDate    = serial.JumpActivationDate;
            JumpFatigueDate       = serial.JumpFatigueDate;
            JumpLastUpdateDate    = serial.JumpLastUpdateDate;
            Balance               = serial.Balance;

            // Read clone status override, or "Auto"
            AccountStatusMode cloneState;

            if (Enum.TryParse(serial.CloneState ?? "", out cloneState))
            {
                AccountStatusSettings = cloneState;
            }

            var settingsChar = serial as SerializableSettingsCharacter;

            if (settingsChar != null)
            {
                // Info
                m_label           = settingsChar.Label ?? string.Empty;
                ShipName          = settingsChar.ShipName;
                ShipTypeName      = settingsChar.ShipTypeName;
                SecurityStatus    = settingsChar.SecurityStatus;
                LastKnownLocation = settingsChar.LastKnownLocation;

                // Employment History
                EmploymentHistory.Import(settingsChar.EmploymentHistory);
            }

            // Attributes
            m_attributes[(int)EveAttribute.Intelligence].Base = serial.Attributes.Intelligence;
            m_attributes[(int)EveAttribute.Perception].Base   = serial.Attributes.Perception;
            m_attributes[(int)EveAttribute.Willpower].Base    = serial.Attributes.Willpower;
            m_attributes[(int)EveAttribute.Charisma].Base     = serial.Attributes.Charisma;
            m_attributes[(int)EveAttribute.Memory].Base       = serial.Attributes.Memory;

            // Skills
            Skills.Import(serial.Skills, serial is SerializableAPICharacterSheet);

            UpdateMasteries();
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Constructor for API Characters.
 /// </summary>
 /// <param name="uri">URI of the character</param>
 /// <param name="result">API Result</param>
 public UriCharacterEventArgs(Uri uri, APIResult <SerializableAPICharacterSheet> result)
 {
     m_uri       = uri;
     m_apiResult = result;
     m_result    = m_apiResult.Result;
     HasError    = m_apiResult.HasError;
     Error       = m_apiResult.ErrorMessage;
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Constructor for API Characters.
        /// </summary>
        /// <param name="uri">URI of the character</param>
        /// <param name="result">API Result</param>
        /// <exception cref="System.ArgumentNullException">result</exception>
        public UriCharacterEventArgs(Uri uri, CCPAPIResult <SerializableAPICharacterSheet> result)
        {
            result.ThrowIfNull(nameof(result));

            Uri         = uri;
            m_apiResult = result;
            m_result    = m_apiResult.Result;
            HasError    = m_apiResult.HasError;
            Error       = m_apiResult.ErrorMessage;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Gets the character identity.
        /// </summary>
        /// <param name="character">The character.</param>
        /// <returns></returns>
        private CharacterIdentity GetIdentity(SerializableCharacterSheetBase character)
        {
            // Retrieve the identity and create one if needed
            var identity = EveClient.CharacterIdentities[character.ID];

            if (identity == null)
            {
                identity = EveClient.CharacterIdentities.Add(character.ID, character.Name);
            }
            return(identity);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Imports data from the given character sheet informations.
        /// </summary>
        /// <param name="serial">The serialized character sheet</param>
        private void Import(SerializableCharacterSheetBase serial)
        {
            // Bio
            m_name                = serial.Name;
            HomeStationID         = serial.HomeStationID;
            Birthday              = serial.Birthday;
            Race                  = serial.Race;
            Bloodline             = serial.BloodLine;
            Ancestry              = serial.Ancestry;
            Gender                = serial.Gender;
            CorporationName       = serial.CorporationName;
            CorporationID         = serial.CorporationID;
            AllianceName          = serial.AllianceName;
            AllianceID            = serial.AllianceID;
            FreeSkillPoints       = serial.FreeSkillPoints;
            AvailableReMaps       = serial.FreeRespecs;
            JumpCloneLastJumpDate = serial.CloneJumpDate;
            LastReMapDate         = serial.LastRespecDate;
            LastReMapTimed        = serial.LastTimedRespec;
            RemoteStationDate     = serial.RemoteStationDate;
            JumpActivationDate    = serial.JumpActivationDate;
            JumpFatigueDate       = serial.JumpFatigueDate;
            JumpLastUpdateDate    = serial.JumpLastUpdateDate;
            Balance               = serial.Balance;

            if (serial is SerializableSettingsCharacter)
            {
                // Info
                ShipName          = serial.ShipName;
                ShipTypeName      = serial.ShipTypeName;
                SecurityStatus    = serial.SecurityStatus;
                LastKnownLocation = serial.LastKnownLocation;

                // Employment History
                EmploymentHistory.Import(serial.EmploymentHistory);
            }

            // Attributes
            m_attributes[(int)EveAttribute.Intelligence].Base = serial.Attributes.Intelligence;
            m_attributes[(int)EveAttribute.Perception].Base   = serial.Attributes.Perception;
            m_attributes[(int)EveAttribute.Willpower].Base    = serial.Attributes.Willpower;
            m_attributes[(int)EveAttribute.Charisma].Base     = serial.Attributes.Charisma;
            m_attributes[(int)EveAttribute.Memory].Base       = serial.Attributes.Memory;

            // Skills
            Skills.Import(serial.Skills, serial is SerializableAPICharacterSheet);

            // Certificates
            Certificates.Initialize();

            // Masteries
            MasteryShips.Initialize();
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Imports data from the given character sheet informations
        /// </summary>
        /// <param name="serial">The serialized character sheet</param>
        protected void Import(SerializableCharacterSheetBase serial)
        {
            bool fromCCP = (serial is SerializableAPICharacterSheet);

            // Bio
            m_name             = serial.Name;
            m_birthday         = serial.Birthday;
            m_race             = serial.Race;
            m_ancestry         = serial.Ancestry;
            m_gender           = serial.Gender;
            m_balance          = serial.Balance;
            m_bloodLine        = serial.BloodLine;
            m_corporationName  = serial.CorporationName;
            m_corporationID    = serial.CorporationID;
            m_allianceName     = serial.AllianceName;
            m_allianceID       = serial.AllianceID;
            m_cloneName        = serial.CloneName;
            m_cloneSkillPoints = serial.CloneSkillPoints;

            // Attributes
            m_attributes[(int)EveAttribute.Intelligence].Base = serial.Attributes.Intelligence;
            m_attributes[(int)EveAttribute.Perception].Base   = serial.Attributes.Perception;
            m_attributes[(int)EveAttribute.Willpower].Base    = serial.Attributes.Willpower;
            m_attributes[(int)EveAttribute.Charisma].Base     = serial.Attributes.Charisma;
            m_attributes[(int)EveAttribute.Memory].Base       = serial.Attributes.Memory;

            // Skills : reset all > update all
            foreach (var skill in m_skills)
            {
                skill.Reset(fromCCP);
            }

            foreach (var serialSkill in serial.Skills.Where(x => m_skills[x.ID] != null))
            {
                // Take care of the new skills not in our datafiles yet. Update if it exists.
                m_skills[serialSkill.ID].Import(serialSkill, fromCCP);
            }

            // Certificates : reset > mark the granted ones > update the other ones
            foreach (var cert in m_certificates)
            {
                cert.Reset();
            }

            foreach (var serialCert in serial.Certificates.Where(x => m_certificates[x.CertificateID] != null))
            {
                // Take care of the new certs not in our datafiles yet. Mark as granted if it exists.
                m_certificates[serialCert.CertificateID].MarkAsGranted();
            }

            while (true)
            {
                bool updatedAnything = false;
                foreach (var cert in m_certificates)
                {
                    updatedAnything |= cert.TryUpdateCertificateStatus();
                }
                if (!updatedAnything)
                {
                    break;
                }
            }
        }