예제 #1
0
        public static string getBasicInfo(AccountEntry character)
        {
            string       dick;
            MySqlCommand getRecruit = new MySqlCommand("SELECT * FROM `recruits` WHERE `char_id1` LIKE '" + character.CharacterID + "' OR `char_id2` LIKE '" + character.CharacterID + "' OR `char_id3` LIKE '" + character.CharacterID + "'", conn);

            conn.Open();
            MySqlDataReader rdr = getRecruit.ExecuteReader();

            while (rdr.Read())
            {
                auth.KeyID         = int.Parse(rdr.GetString("vID"));
                auth.VCode         = rdr.GetString("vCode");
                auth.CharacterID   = character.CharacterID;
                api.Authentication = auth;
                // MessageBox.Show(auth.KeyID.ToString() + " : " + auth.VCode + " : " + auth.CharacterID.ToString());
            }
            conn.Dispose();
            CharacterSheet charSheet = api.GetCharacterSheet();

            dick = "Character Name: " + charSheet.Name + "\nWallet Balance: " + String.Format("{0:N0}", charSheet.Balance) + "\n"
                   + "Date of Birth: " + charSheet.DateOfBirth + "\nCorporation: " + charSheet.CorporationName + "\n"
                   + "Skill Points: " + String.Format("{0:N0}", charSheet.SkillpointTotal) + "\n"
                   + "Max Clone SP: " + String.Format("{0:N0}", charSheet.CloneSkillpoints) + "\n";

            //api.Authentication = auth;
            return(dick);
        }
예제 #2
0
        //Print the current character balance. Use separate charID.
        //Uses libeveapi
        //Says to channel
        private static void PrintAccountBalance(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);

            connection.privmsg(CHANNEL, String.Format("{0} has {1} isk", character.Name, character.Balance.ToString("N")));
        }
예제 #3
0
        public static void CharacterSheetExample()
        {
            CharacterSheet characterSheet = EveApi.GetCharacterSheet(4378412, 453272742, "apiKey");

            long totalSkillpoints = 0;

            foreach (CharacterSheet.SkillItem skillItem in characterSheet.SkillItemList)
            {
                totalSkillpoints += skillItem.Skillpoints;
            }

            Console.WriteLine("Character Name: {0} Total Skillpoints: {1}", characterSheet.Name, totalSkillpoints);
        }
예제 #4
0
        public void CharacterSheetPersist()
        {
            ResponseCache.Clear();
            CharacterSheet cs = EveApi.GetCharacterSheet(432435, 234523, "apiKey");

            ResponseCache.Save("ResponseCache.xml");
            ResponseCache.Clear();
            ResponseCache.Load("ResponseCache.xml");
            CharacterSheet cached = EveApi.GetCharacterSheet(432435, 234523, "apiKey");

            Assert.AreEqual(cached.CachedUntilLocal, cs.CachedUntilLocal);

            Assert.AreEqual(cached.CharacterId, cs.CharacterId);
            Assert.AreEqual(cached.Name, cs.Name);
            Assert.AreEqual(cached.Race, cs.Race);
            Assert.AreEqual(cached.BloodLine, cs.BloodLine);
            Assert.AreEqual(cached.Gender, cs.Gender);
            Assert.AreEqual(cached.CorporationName, cs.CorporationName);
            Assert.AreEqual(cached.CorporationId, cs.CorporationId);
            Assert.AreEqual(cached.Balance, cs.Balance);

            Assert.AreEqual(cached.MemoryBonus.Name, cs.MemoryBonus.Name);
            Assert.AreEqual(cached.MemoryBonus.Value, cs.MemoryBonus.Value);
            Assert.AreEqual(cached.WillpowerBonus.Name, cs.WillpowerBonus.Name);
            Assert.AreEqual(cached.WillpowerBonus.Value, cs.WillpowerBonus.Value);
            Assert.AreEqual(cached.PerceptionBonus.Name, cs.PerceptionBonus.Name);
            Assert.AreEqual(cached.PerceptionBonus.Value, cs.PerceptionBonus.Value);
            Assert.AreEqual(cached.IntelligenceBonus.Name, cs.IntelligenceBonus.Name);
            Assert.AreEqual(cached.IntelligenceBonus.Value, cs.IntelligenceBonus.Value);
            Assert.AreEqual(cached.CharismaBonus.Name, cs.CharismaBonus.Name);
            Assert.AreEqual(cached.CharismaBonus.Value, cs.CharismaBonus.Value);

            Assert.AreEqual(cached.Intelligence, cs.Intelligence);
            Assert.AreEqual(cached.Memory, cs.Memory);
            Assert.AreEqual(cached.Charisma, cs.Charisma);
            Assert.AreEqual(cached.Perception, cs.Perception);
            Assert.AreEqual(cached.Willpower, cs.Willpower);

            for (int i = 0; i < cs.SkillItemList.Length; i++)
            {
                Assert.AreEqual(cached.SkillItemList[i].TypeId, cs.SkillItemList[i].TypeId);
                Assert.AreEqual(cached.SkillItemList[i].Skillpoints, cs.SkillItemList[i].Skillpoints);
                Assert.AreEqual(cached.SkillItemList[i].Level, cs.SkillItemList[i].Level);
                Assert.AreEqual(cached.SkillItemList[i].Unpublished, cs.SkillItemList[i].Unpublished);
            }
        }
예제 #5
0
        public override void respond(Input input)
        {
            string[] message = input.message.Split(new char[] { ' ' }, 2);
            if (message.Length < 2)
            {
                addResponse("You are lacking skill, tell me which one you want to check");
                return;
            }
            string skillName = message[1];

            if (!IrcBot.nickDict.ContainsKey(input.speaker))
            {
                addResponse("Add an api key for your username first");
                return;
            }
            User           user      = IrcBot.nickDict[input.speaker];
            UserApi        api       = user.apis.ElementAt(0);
            CharacterSheet character = EveApi.GetCharacterSheet(api.apiUserId, user.defaultChar, api.apiKeyId);

            if (!IrcBot.skillIds.ContainsKey(skillName.ToLower()))
            {
                addResponse(String.Format("I have no mapping for '{0}'", skillName));
                return;
            }
            int target = IrcBot.skillIds[skillName.ToLower()];
            var ids    = from skill in character.SkillItemList select skill.TypeId;

            skillName = IrcBot.getSkillById(target).TypeName;
            int i = 0;

            foreach (int id in ids)
            {
                if (id == target)
                {
                    addResponse(String.Format("{0} has trained {1} to level {2}", character.Name, skillName, character.SkillItemList[i].Level));
                    return;
                }
                i += 1;
            }
            addResponse(String.Format("{0} has not trained {1}", character.Name, skillName));
            return;
        }
예제 #6
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));
            }
        }
예제 #7
0
        public void GetCharacterSheet()
        {
            ResponseCache.Clear();

            CharacterSheet cs = EveApi.GetCharacterSheet(432435, 234523, "apiKey");

            Assert.AreEqual(150337897, cs.CharacterId);
            Assert.AreEqual("corpslave", cs.Name);
            Assert.AreEqual("Minmatar", cs.Race);
            Assert.AreEqual("Brutor", cs.BloodLine);
            Assert.AreEqual("Female", cs.Gender);
            Assert.AreEqual("corpexport Corp", cs.CorporationName);
            Assert.AreEqual(150337746, cs.CorporationId);
            Assert.AreEqual(190210393.87, cs.Balance);

            Assert.AreEqual("Memory Augmentation - Basic", cs.MemoryBonus.Name);
            Assert.AreEqual(3, cs.MemoryBonus.Value);
            Assert.AreEqual("Neural Boost - Basic", cs.WillpowerBonus.Name);
            Assert.AreEqual(3, cs.WillpowerBonus.Value);
            Assert.AreEqual("Ocular Filter - Standard", cs.PerceptionBonus.Name);
            Assert.AreEqual(4, cs.PerceptionBonus.Value);
            Assert.AreEqual(string.Empty, cs.IntelligenceBonus.Name);
            Assert.AreEqual(0, cs.IntelligenceBonus.Value);
            Assert.AreEqual("Social Adaptation Chip - Standard", cs.CharismaBonus.Name);
            Assert.AreEqual(4, cs.CharismaBonus.Value);

            Assert.AreEqual(8, cs.Intelligence);
            Assert.AreEqual(8, cs.Memory);
            Assert.AreEqual(6, cs.Charisma);
            Assert.AreEqual(8, cs.Perception);
            Assert.AreEqual(9, cs.Willpower);

            Assert.AreEqual(11584, cs.SkillItemList[0].TypeId);
            Assert.AreEqual(768000, cs.SkillItemList[0].Skillpoints);
            Assert.AreEqual(5, cs.SkillItemList[0].Level);
            Assert.AreEqual(null, cs.SkillItemList[0].Unpublished);
        }