/// <summary> /// Imports data from the given skills information. /// </summary> /// <param name="skills">The serialized character skill information</param> internal void Import(EsiAPISkills skills, EsiAPISkillQueue queue) { var newSkills = new LinkedList <SerializableCharacterSkill>(); DateTime uselessDate = DateTime.UtcNow; FreeSkillPoints = skills.UnallocatedSP; // Keep track of the current skill queue's completed skills, as ESI does not // transfer them to the skills list until you login var dict = new Dictionary <long, SerializableQueuedSkill>(); if (queue != null) { foreach (var queuedSkill in queue.CreateSkillQueue()) { // If the skill is completed or currently training, we need it later to // copy the progress over to the imported skills if (queuedSkill.IsCompleted || queuedSkill.IsTraining) { if (!dict.ContainsKey(queuedSkill.ID)) { dict.Add(queuedSkill.ID, queuedSkill); } else { dict[queuedSkill.ID] = queuedSkill; } } } } // Convert skills to EVE format foreach (var skill in skills.Skills) { // Check if the skill is in the queue, and completed at a higher level or has // higher current SP if (dict.ContainsKey(skill.ID)) { var queuedSkill = dict[skill.ID]; if (queuedSkill.IsCompleted) { // Queued skill is completed, so make sure the imported skill is // updated skill.ActiveLevel = Math.Max(skill.ActiveLevel, queuedSkill.Level); skill.Level = Math.Max(skill.Level, queuedSkill.Level); skill.Skillpoints = Math.Max(skill.Skillpoints, queuedSkill.EndSP); } else if (queuedSkill.IsTraining) { // Queued skill is currently training - use QueuedSkill class to // calculate the CurrentSP of the skill var tempSkill = new QueuedSkill(this, queuedSkill, ref uselessDate); skill.Skillpoints = Math.Max(skill.Skillpoints, tempSkill.CurrentSP); } } newSkills.AddLast(skill.ToXMLItem()); } Skills.Import(newSkills, true); UpdateMasteries(); }
/// <summary> /// Processes the queried character's skills. /// </summary> /// <param name="result"></param> private void OnCharacterSkillsUpdated(EsiAPISkills result) { var target = m_ccpCharacter; // Character may have been deleted since we queried if (target != null) { target.Import(result, m_charSkillQueueMonitor?.LastResult?.Result); } }
/// <summary> /// Imports data from the given skills information. /// </summary> /// <param name="skills">The serialized character skill information</param> internal void Import(EsiAPISkills skills) { var newSkills = new LinkedList <SerializableCharacterSkill>(); FreeSkillPoints = skills.UnallocatedSP; // Convert skills to EVE format foreach (var skill in skills.Skills) { newSkills.AddLast(skill.ToXMLItem()); } Skills.Import(newSkills, true); }
/// <summary> /// Processes the queried character's skills. /// </summary> /// <param name="result"></param> private void OnCharacterSkillsUpdated(EsiAPISkills result) { var target = m_ccpCharacter; // Character may have been deleted since we queried if (target != null) { target.Import(result); QueryCharacterData <List <int> >(ESIAPICharacterMethods.Implants, EveMonClient.Notifications.NotifyCharacterImplantsError, OnCharacterImplantsUpdated); } }
/// <summary> /// Processes the queried character's skills. /// </summary> /// <param name="result"></param> private void OnCharacterSkillsUpdated(EsiAPISkills result) { var target = m_ccpCharacter; // Character may have been deleted since we queried if (target != null) { target.Import(result); QueryCharacterData <EsiAPIEmploymentHistory>(ESIAPICharacterMethods. EmploymentHistory, EveMonClient.Notifications. NotifyCharacterEmploymentError, OnCharacterEmploymentUpdated); } }
/// <summary> /// Imports data from the given skills information. /// </summary> /// <param name="skills">The serialized character skill information</param> internal void Import(EsiAPISkills skills, EsiAPISkillQueue queue) { var newSkills = new LinkedList <SerializableCharacterSkill>(); FreeSkillPoints = skills.UnallocatedSP; // Keep track of the current skill queue's completed skills, as ESI doesn't transfer them to the skills list until you login Dictionary <long, QueuedSkill> dict = new Dictionary <long, QueuedSkill>(); if (queue != null && IsTraining) { DateTime uselessDate = DateTime.UtcNow; foreach (var serialSkill in queue.ToXMLItem().Queue) { var queuedSkill = new QueuedSkill(this, serialSkill, ref uselessDate); if (!dict.ContainsKey(queuedSkill.Skill.ID)) { dict.Add(queuedSkill.Skill.ID, queuedSkill); } else if (queuedSkill.Level > dict[queuedSkill.Skill.ID].Level) { dict[queuedSkill.Skill.ID] = queuedSkill; } } } // Convert skills to EVE format foreach (var skill in skills.Skills) { // Check if the skill is in the queue, and completed at a higher level or has higher current SP if (dict.ContainsKey(skill.ID)) { var queuedSkill = dict[skill.ID]; if (queuedSkill.IsCompleted) { skill.ActiveLevel = Math.Max(skill.ActiveLevel, queuedSkill.Level); skill.Level = Math.Max(skill.Level, queuedSkill.Level); skill.Skillpoints = Math.Max(skill.Skillpoints, queuedSkill.EndSP); } else { skill.Skillpoints = Math.Max(skill.Skillpoints, queuedSkill.CurrentSP); } } newSkills.AddLast(skill.ToXMLItem()); } Skills.Import(newSkills, true); }