public static bool ReadMyCharacterSheetSkills() { if (DateTime.UtcNow < _nextSkillTrainingAction) { if (Settings.Instance.DebugSkillTraining) { Logging.Log("SkillPlan.ReadMyCharacterSheetSkills:", "Next Skill Training Action is set to continue in [" + Math.Round(_nextSkillTrainingAction.Subtract(DateTime.UtcNow).TotalSeconds, 0) + "] seconds", Logging.White); } return(false); } if (MyCharacterSheetSkills == null || !MyCharacterSheetSkills.Any()) { if (Settings.Instance.DebugSkillTraining) { Logging.Log("readMyCharacterSheetSkills", "if (!MyCharacterSheetSkills.Any())", Logging.Teal); } MyCharacterSheetSkills = Cache.Instance.DirectEve.Skills.MySkills; return(false); } int iCount = 1; if (!Cache.Instance.DirectEve.Skills.AreMySkillsReady) { if (Settings.Instance.DebugSkillTraining) { Logging.Log("readMyCharacterSheetSkills", "if (!Cache.Instance.DirectEve.Skills.AreMySkillsReady)", Logging.Teal); } return(false); } if (DateTime.UtcNow > _nextRetrieveCharactersheetInfoAction) { if (Settings.Instance.DebugSkillTraining) { Logging.Log("readMyCharacterSheetSkills", "Updating Character sheet again", Logging.Teal); } MyCharacterSheetSkills = Cache.Instance.DirectEve.Skills.MySkills; _nextRetrieveCharactersheetInfoAction.AddSeconds(13); return(true); } foreach (DirectSkill trainedskill in MyCharacterSheetSkills) { iCount++; //if (Settings.Instance.DebugSkillTraining) Logging.Log("Skills.MyCharacterSheetSkills", "[" + iCount + "] SkillName [" + trainedskill.TypeName + "] lvl [" + trainedskill.Level + "] SkillPoints [" + trainedskill.SkillPoints + "] inTraining [" + trainedskill.InTraining + "]", Logging.Teal); } return(true); }
public static bool InjectSkillBook(int skillID) { IEnumerable <DirectItem> items = Cache.Instance.ItemHangar.Items.Where(k => k.TypeId == skillID).ToList(); if (DoWeHaveThisSkillAlreadyInOurItemHangar(skillID)) { if (Settings.Instance.DebugSkillTraining) { Logging.Log("InjectSkillBook", "SkillBook [" + skillID.ToString() + "] found in ItemHangar", Logging.Debug); } DirectItem SkillBookToInject = items.FirstOrDefault(s => s.TypeId == skillID); if (SkillBookToInject != null) { if (MyCharacterSheetSkills != null && !MyCharacterSheetSkills.Any(i => i.TypeName == SkillBookToInject.TypeName || i.GivenName == SkillBookToInject.TypeName)) { if (Settings.Instance.DebugSkillTraining) { Logging.Log("InjectSkillBook", "SkillBook: GivenName [" + SkillBookToInject.GivenName + "] TypeName [" + SkillBookToInject.TypeName + "] is being injected", Logging.Debug); } if (DoWeHaveTheRightPrerequisites(SkillBookToInject.TypeId)) { SkillBookToInject.InjectSkill(); skillWasInjected = true; return(true); } else { if (Settings.Instance.DebugSkillTraining) { Logging.Log("InjectSkillBook", "Skillbook: We don't have the right Prerequisites for " + SkillBookToInject.GivenName, Logging.Debug); } } } if (MyCharacterSheetSkills != null && MyCharacterSheetSkills.Any(i => i.TypeName == SkillBookToInject.TypeName)) { if (Settings.Instance.DebugSkillTraining) { Logging.Log("InjectSkillBook", "SkillBook: TypeName [" + SkillBookToInject.TypeName + "] is already injected, why are we trying to do so again? aborting injection attempt ", Logging.Debug); } return(true); } } return(false); } Logging.Log("InjectSkillBook", "We don't have this skill in our hangar", Logging.Debug); return(false); }
public static bool DoWeHaveTheRightPrerequisites(int skillID) { try { if (skillPreReqs == null) { skillPreReqs = XDocument.Load(Settings.Instance.Path + "\\Skill_Prerequisites.xml"); if (Settings.Instance.DebugSkillTraining) { Logging.Log("DoWeHaveTheRightPrerequisites", "Skill_Prerequisites.xml Loaded.", Logging.Debug); } } } catch (Exception) { if (Settings.Instance.DebugSkillTraining) { Logging.Log("DoWeHaveTheRightPrerequisites", "Skill_Prerequisites.xml exception -- does the file exist?", Logging.Debug); } return(false); } foreach (var skills in skillPreReqs.Descendants("skill")) { if (skillID.ToString().Equals(skills.Attribute("id").Value)) { if (Settings.Instance.DebugSkillTraining) { Logging.Log("DoWeHaveTheRightPrerequisites", "skillID.ToString().Equals(skills.Attribute(\"id\").Value == TRUE", Logging.Debug); } foreach (var preRegs in skills.Descendants("preqskill")) { if (MyCharacterSheetSkills.Any(i => i.TypeId.ToString().Equals(preRegs.Attribute("id").Value))) { if (Settings.Instance.DebugSkillTraining) { Logging.Log("DoWeHaveTheRightPrerequisites", "We have this Prerequisite: " + preRegs.Attribute("id").Value, Logging.Debug); } if (MyCharacterSheetSkills.Any(i => i.TypeId.ToString().Equals(preRegs.Attribute("id").Value) && i.Level < Convert.ToInt32(preRegs.Value))) { if (Settings.Instance.DebugSkillTraining) { Logging.Log("DoWeHaveTheRightPrerequisites", "We don't meet the required level on this skill: " + preRegs.Attribute("id").Value, Logging.Debug); } return(false); } else { if (Settings.Instance.DebugSkillTraining) { Logging.Log("DoWeHaveTheRightPrerequisites", "We meet the required skill level on this skill: " + preRegs.Attribute("id").Value, Logging.Debug); } } } else { if (Settings.Instance.DebugSkillTraining) { Logging.Log("DoWeHaveTheRightPrerequisites", "We don't have this prerequisite: " + preRegs.Attribute("id").Value, Logging.Debug); } } } // this is also good for skills with no pre requirements return(true); } } return(false); // not in list which is unlikely }