Exemple #1
0
        public static void SkillInTrainingExample()
        {
            SkillInTraining skillInTraining = EveApi.GetSkillInTraining(1234, 5678, "apiKey");

            if (skillInTraining.SkillCurrentlyInTraining)
            {
                Console.WriteLine("Training of skill: {0} will finish at {1}", skillInTraining.TrainingTypeId, skillInTraining.TrainingEndTimeLocal);
            }
            else
            {
                Console.WriteLine("You should start a skill training!");
            }
        }
        public void GetSkillInTraining()
        {
            ResponseCache.Clear();
            SkillInTraining skillintraining = EveApi.GetSkillInTraining(456456, 456436, "asdf");

            //Attributes of the currently training skill
            Assert.AreEqual(new DateTime(2008, 01, 27, 01, 42, 38), skillintraining.TrainingEndTime);
            Assert.AreEqual(new DateTime(2008, 01, 25, 01, 04, 23), skillintraining.TrainingStartTime);
            Assert.AreEqual(3412, skillintraining.TrainingTypeId);
            Assert.AreEqual(36253, skillintraining.TrainingStartSP);
            Assert.AreEqual(135765, skillintraining.TrainingDestinationSP);
            Assert.AreEqual(4, skillintraining.TrainingToLevel);
            Assert.AreEqual(true, skillintraining.SkillCurrentlyInTraining);
        }
Exemple #3
0
        //Print the current skill in training. Use separate charID.
        //Uses libeveapi
        //Says to channel
        private static void PrintSkillTraining(User user, int characterID)
        {
            Character       eveChar      = mySession.CreateCriteria <Character>().Add(Restrictions.Eq("apiCharacterId", characterID)).UniqueResult <Character>();
            UserApi         api          = eveChar.api;
            CharacterSheet  character    = EveApi.GetCharacterSheet(api.apiUserId, characterID, api.apiKeyId);
            SkillInTraining skillInTrain = EveApi.GetSkillInTraining(api.apiUserId, characterID, api.apiKeyId);

            if (skillInTrain.SkillCurrentlyInTraining)
            {
                DateTime dt                 = DateTime.SpecifyKind(Convert.ToDateTime(skillInTrain.TrainingEndTime), DateTimeKind.Utc);
                TimeSpan timeTillDone       = dt - skillInTrain.CurrentTime;
                string   timeTillDoneString = getTimeTillDoneString(ref timeTillDone);
                connection.privmsg(CHANNEL, String.Format("{0} is currently training {1} to level {2} which finishes at {3}. ({4})",
                                                          character.Name, getSkillById(skillInTrain.TrainingTypeId).TypeName, skillInTrain.TrainingToLevel, dt.ToString(), timeTillDoneString));
            }
            else
            {
                connection.privmsg(CHANNEL, String.Format("{0} isn't currently training anything", character.Name));
            }
        }
        public void PersistSkillInTraining()
        {
            ResponseCache.Clear();
            SkillInTraining skillintraining = EveApi.GetSkillInTraining(56456, 4564356, "asdf");

            ResponseCache.Save("ResponseCache.xml");
            ResponseCache.Clear();
            ResponseCache.Load("ResponseCache.xml");
            SkillInTraining cached = EveApi.GetSkillInTraining(4563456, 36456, "asdf");

            //Test the Cache Time
            Assert.AreEqual(skillintraining.CachedUntilLocal, cached.CachedUntilLocal);

            //Attributes of the currently training skill
            Assert.AreEqual(cached.TrainingEndTime, skillintraining.TrainingEndTime);
            Assert.AreEqual(cached.TrainingStartTime, skillintraining.TrainingStartTime);
            Assert.AreEqual(cached.TrainingTypeId, skillintraining.TrainingTypeId);
            Assert.AreEqual(cached.TrainingStartSP, skillintraining.TrainingStartSP);
            Assert.AreEqual(cached.TrainingDestinationSP, skillintraining.TrainingDestinationSP);
            Assert.AreEqual(cached.TrainingToLevel, skillintraining.TrainingToLevel);
            Assert.AreEqual(cached.SkillCurrentlyInTraining, skillintraining.SkillCurrentlyInTraining);
        }