Exemplo n.º 1
0
        public void GetSkillInTraining()
        {
            ResponseCache.Clear();
            SkillQueue skillqueue = EveApi.GetSkillQueue(456456, 456436, "asdf");

            SkillQueue.Skill skill0 = skillqueue.SkillList[0];
            SkillQueue.Skill skill1 = skillqueue.SkillList[1];

            //Attributes of the first skill in the queue
            Assert.AreEqual(1, skill0.QueuePosition);
            Assert.AreEqual(11441, skill0.TrainingTypeId);
            Assert.AreEqual(3, skill0.TrainingToLevel);
            Assert.AreEqual(7072, skill0.TrainingStartSP);
            Assert.AreEqual(40000, skill0.TrainingEndSP);
            Assert.AreEqual(new DateTime(2009, 03, 18, 02, 01, 06), skill0.TrainingStartTime);
            Assert.AreEqual(new DateTime(2009, 03, 18, 15, 19, 21), skill0.TrainingEndTime);
            Assert.AreEqual(new DateTime(2009, 03, 17, 21, 01, 06), skill0.TrainingStartTimeLocal);
            Assert.AreEqual(new DateTime(2009, 03, 18, 10, 19, 21), skill0.TrainingEndTimeLocal);

            //Attributes of the second skill in the queue
            Assert.AreEqual(2, skill1.QueuePosition);
            Assert.AreEqual(20533, skill1.TrainingTypeId);
            Assert.AreEqual(4, skill1.TrainingToLevel);
            Assert.AreEqual(112000, skill1.TrainingStartSP);
            Assert.AreEqual(633542, skill1.TrainingEndSP);
            Assert.AreEqual(new DateTime(2009, 03, 18, 15, 19, 21), skill1.TrainingStartTime);
            Assert.AreEqual(new DateTime(2009, 03, 30, 03, 16, 14), skill1.TrainingEndTime);
            Assert.AreEqual(new DateTime(2009, 03, 18, 10, 19, 21), skill1.TrainingStartTimeLocal);
            Assert.AreEqual(new DateTime(2009, 03, 29, 22, 16, 14), skill1.TrainingEndTimeLocal);
        }
Exemplo n.º 2
0
        public void PersistSkillInTraining()
        {
            ResponseCache.Clear();
            SkillQueue skillqueue = EveApi.GetSkillQueue(56456, 4564356, "asdf");

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

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

            //Attributes of the first skill in the queue
            Assert.AreEqual(cached.SkillList[0].QueuePosition, skillqueue.SkillList[0].QueuePosition);
            Assert.AreEqual(cached.SkillList[0].TrainingTypeId, skillqueue.SkillList[0].TrainingTypeId);
            Assert.AreEqual(cached.SkillList[0].TrainingToLevel, skillqueue.SkillList[0].TrainingToLevel);
            Assert.AreEqual(cached.SkillList[0].TrainingStartSP, skillqueue.SkillList[0].TrainingStartSP);
            Assert.AreEqual(cached.SkillList[0].TrainingEndSP, skillqueue.SkillList[0].TrainingEndSP);
            Assert.AreEqual(cached.SkillList[0].TrainingStartTime, skillqueue.SkillList[0].TrainingStartTime);
            Assert.AreEqual(cached.SkillList[0].TrainingEndTime, skillqueue.SkillList[0].TrainingEndTime);
            Assert.AreEqual(cached.SkillList[0].TrainingStartTimeLocal, skillqueue.SkillList[0].TrainingStartTimeLocal);
            Assert.AreEqual(cached.SkillList[0].TrainingEndTimeLocal, skillqueue.SkillList[0].TrainingEndTimeLocal);

            //Attributes of the second skill in the queue
            Assert.AreEqual(cached.SkillList[1].QueuePosition, skillqueue.SkillList[1].QueuePosition);
            Assert.AreEqual(cached.SkillList[1].TrainingTypeId, skillqueue.SkillList[1].TrainingTypeId);
            Assert.AreEqual(cached.SkillList[1].TrainingToLevel, skillqueue.SkillList[1].TrainingToLevel);
            Assert.AreEqual(cached.SkillList[1].TrainingStartSP, skillqueue.SkillList[1].TrainingStartSP);
            Assert.AreEqual(cached.SkillList[1].TrainingEndSP, skillqueue.SkillList[1].TrainingEndSP);
            Assert.AreEqual(cached.SkillList[1].TrainingStartTime, skillqueue.SkillList[1].TrainingStartTime);
            Assert.AreEqual(cached.SkillList[1].TrainingEndTime, skillqueue.SkillList[1].TrainingEndTime);
            Assert.AreEqual(cached.SkillList[1].TrainingStartTimeLocal, skillqueue.SkillList[1].TrainingStartTimeLocal);
            Assert.AreEqual(cached.SkillList[1].TrainingEndTimeLocal, skillqueue.SkillList[1].TrainingEndTimeLocal);
        }
Exemplo n.º 3
0
        public override void action(IrcConnection connection, string channel)
        {
            IList <Character> characters = IrcBot.mySession.CreateCriteria <Character>().List <Character>();

            foreach (Character character in characters)
            {
                //Get their skillQueue, and determine if time remaining is less than 24 hours.
                SkillQueue skillQueue = null;
                try
                {
                    skillQueue = EveApi.GetSkillQueue(character.api.apiUserId, character.apiCharacterId, character.api.apiKeyId);
                }
                catch (FormatException)
                {
                    continue;
                }
                catch (Exception)
                {
                    continue;
                }
                if (skillQueue == null)
                {
                    continue;
                }
                DateTime tomorrow = DateTime.Now + new TimeSpan(24, 0, 0);//24 hours

                if (skillQueue.SkillList.Length > 0)
                {
                    if (skillQueue.SkillList.Last().TrainingEndTimeLocal < tomorrow) // If the skill finishes before tomorrow.
                    {
                        connection.privmsg(channel, "Character " + character.characterName + " has less than 24 hours remaining in his skill queue");
                    }
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Base constructor.
        /// </summary>
        /// <param name="identity"></param>
        /// <param name="guid"></param>
        private CCPCharacter(CharacterIdentity identity, Guid guid)
            : base(identity, guid)
        {
            m_queue = new SkillQueue(this);
            m_marketOrders = new MarketOrderCollection(this);
            m_industryJobs = new IndustryJobCollection(this);
            m_researchPoints = new ResearchPointCollection(this);
            m_eveMailMessages = new EveMailMessagesCollection(this);
            m_eveMailingLists = new EveMailingListsCollection(this);
            m_eveNotifications = new EveNotificationsCollection(this);
            m_monitors = new QueryMonitorCollection();

            // Initializes the query monitors 
            m_charSheetMonitor = new CharacterQueryMonitor<SerializableAPICharacterSheet>(this, APIMethods.CharacterSheet);
            m_charSheetMonitor.Updated += OnCharacterSheetUpdated;
            m_monitors.Add(m_charSheetMonitor);

            m_skillQueueMonitor = new CharacterQueryMonitor<SerializableAPISkillQueue>(this, APIMethods.SkillQueue);
            m_skillQueueMonitor.Updated += OnSkillQueueUpdated;
            m_monitors.Add(m_skillQueueMonitor);

            m_charMarketOrdersMonitor = new CharacterQueryMonitor<SerializableAPIMarketOrders>(this, APIMethods.MarketOrders);
            m_charMarketOrdersMonitor.Updated += OnCharacterMarketOrdersUpdated;
            m_monitors.Add(m_charMarketOrdersMonitor);

            m_corpMarketOrdersMonitor = new CharacterQueryMonitor<SerializableAPIMarketOrders>(this, APIMethods.CorporationMarketOrders);
            m_corpMarketOrdersMonitor.Updated += OnCorporationMarketOrdersUpdated;
            m_monitors.Add(m_corpMarketOrdersMonitor);

            m_charIndustryJobsMonitor = new CharacterQueryMonitor<SerializableAPIIndustryJobs>(this, APIMethods.IndustryJobs);
            m_charIndustryJobsMonitor.Updated += OnCharacterJobsUpdated;
            m_monitors.Add(m_charIndustryJobsMonitor);

            m_corpIndustryJobsMonitor = new CharacterQueryMonitor<SerializableAPIIndustryJobs>(this, APIMethods.CorporationIndustryJobs);
            m_corpIndustryJobsMonitor.Updated += OnCorporationJobsUpdated;
            m_monitors.Add(m_corpIndustryJobsMonitor);

            m_charResearchPointsMonitor = new CharacterQueryMonitor<SerializableAPIResearch>(this, APIMethods.ResearchPoints);
            m_charResearchPointsMonitor.Updated += OnCharacterResearchPointsUpdated;
            m_monitors.Add(m_charResearchPointsMonitor);

            m_charEVEMailMessagesMonitor = new CharacterQueryMonitor<SerializableAPIMailMessages>(this, APIMethods.MailMessages);
            m_charEVEMailMessagesMonitor.Updated += OnCharacterEVEMailMessagesUpdated;
            m_monitors.Add(m_charEVEMailMessagesMonitor);

            m_charEVENotificationsMonitor = new CharacterQueryMonitor<SerializableAPINotifications>(this, APIMethods.Notifications);
            m_charEVENotificationsMonitor.Updated += OnCharacterEVENotificationsUpdated;
            m_monitors.Add(m_charEVENotificationsMonitor);

            // We enable only the monitors that require a limited api key,
            // full api key required monitors will be enabled individually
            // through each character's enabled full api key feature
            foreach (var monitor in m_monitors)
            {
                monitor.Enabled = !monitor.IsFullKeyNeeded;
            }
        }
Exemplo n.º 5
0
    private void UpdatePlayerSkill(int player_id, SkillQueue skillq, int pointsAdd)
    {
        Skill _skill  = SkillFind(skillq.skill_id);
        long  _points = SkillLearned(player_id, skillq.skill_id, skillq.tech);


        GetComponent <SkillsDB>().AddPointsToSkill(0, _skill.id, _skill.tech, pointsAdd);

        if (skillq.level <= SkillLevelCalc(skillq.tech, _skill.difficulty, _points))
        {
            GetComponent <SkillsDB> ().DeleteFromQueue(0, skillq.skill_id, skillq.tech, skillq.level);
        }
    }
Exemplo n.º 6
0
        private void OnAnyBehaviourApplied(Behaviour behaviour)
        {
            if (!behaviour.Target.GetComponent <BehavioursComponent>().IsUncontrollable)
            {
                return;
            }

            Timer.Instance.WaitForEndOfFrame(() =>
            {
                SkillQueue.Clear(behaviour.Target);
                MaybeEndTurn(behaviour.Target);
            });
        }
Exemplo n.º 7
0
        /// <summary>
        /// Draws the boxes.
        /// </summary>
        /// <param name="skill">The skill.</param>
        /// <param name="e">The <see cref="System.Windows.Forms.DrawItemEventArgs"/> instance containing the event data.</param>
        private void DrawBoxes(Skill skill, DrawItemEventArgs e)
        {
            Graphics g = e.Graphics;

            g.DrawRectangle(Pens.Black,
                            new Rectangle(e.Bounds.Right - BoxWidth - PadRight, e.Bounds.Top + PadTop, BoxWidth, BoxHeight));

            const int LevelBoxWidth = (BoxWidth - 4 - 3) / 5;

            for (int level = 1; level <= 5; level++)
            {
                Rectangle brect = new Rectangle(
                    e.Bounds.Right - BoxWidth - PadRight + 2 + LevelBoxWidth * (level - 1) + (level - 1),
                    e.Bounds.Top + PadTop + 2, LevelBoxWidth, BoxHeight - 3);

                g.FillRectangle(level <= skill.Level ? Brushes.Black : Brushes.DarkGray, brect);

                // Color indicator for a queued level
                CCPCharacter ccpCharacter = Character as CCPCharacter;
                if (ccpCharacter != null)
                {
                    SkillQueue skillQueue = ccpCharacter.SkillQueue;
                    if (skillQueue
                        .Any(qskill =>
                             (!skill.IsTraining && skill == qskill.Skill && level == qskill.Level) ||
                             (skill.IsTraining && skill == qskill.Skill && level == qskill.Level &&
                              level > skill.Level + 1)))
                    {
                        g.FillRectangle(Brushes.RoyalBlue, brect);
                    }
                }

                // Blinking indicator of skill in training level
                if (!skill.IsTraining || level != skill.Level + 1)
                {
                    continue;
                }

                if (m_blinkAction == BlinkAction.Blink)
                {
                    g.FillRectangle(Brushes.RoyalBlue, brect);
                }

                m_blinkAction = m_blinkAction == BlinkAction.Reset
                    ? BlinkAction.Blink
                    : BlinkAction.Stop;
            }
        }
Exemplo n.º 8
0
        public static void SkillQueueExample()
        {
            SkillQueue skillQueue = EveApi.GetSkillQueue(1234, 1234, "apiKey");

            foreach (SkillQueue.Skill skill in skillQueue.SkillList)
            {
                Console.WriteLine("Queue Position: {0}", skill.QueuePosition);
                Console.WriteLine("Skill ID: {0}", skill.TrainingTypeId);
                Console.WriteLine("Skill Level: {0}", skill.TrainingToLevel);
                Console.WriteLine("Start SP: {0}", skill.TrainingStartSP);
                Console.WriteLine("End SP: {0}", skill.TrainingEndSP);
                Console.WriteLine("StartTime: {0}", skill.TrainingStartTime);
                Console.WriteLine("EndTime: {0}", skill.TrainingEndTime);
                Console.WriteLine("Start Local: {0}", skill.TrainingStartTimeLocal);
                Console.WriteLine("End Local: {0}", skill.TrainingEndTimeLocal);
                Console.WriteLine("");
            }
        }
Exemplo n.º 9
0
        private void StartTurn(GameObject entity)
        {
            var behaviours = entity.GetComponent <BehavioursComponent>();

            if (behaviours.IsUncontrollable || !entity.IsAlive())
            {
                SkillQueue.Clear(entity);

                Acting = entity;
                AnyCombatTurnStarted?.Invoke(Acting);

                EndTurn(Acting);

                return;
            }

            Acting = entity;

            SkillQueue.Run(entity, () =>
            {
                AnyCombatTurnStarted?.Invoke(Acting);
            });
        }
Exemplo n.º 10
0
        /// <summary>
        /// Process the selected character skill queue into the selected calendar.
        /// </summary>
        /// <param name="character">The character.</param>
        /// <exception cref="System.ArgumentNullException">character</exception>
        public static async Task UpdateCalendar(CCPCharacter character)
        {
            character.ThrowIfNull(nameof(character));

            SkillQueue skillQueue = character.SkillQueue;

            foreach (QueuedSkill queuedSkill in skillQueue)
            {
                bool lastSkillInQueue = queuedSkill == skillQueue.Last();
                int  queuePosition    = skillQueue.IndexOf(queuedSkill) + 1;

                // Continue if user has selected 'Last Queued Skill Only'
                if (Settings.Calendar.LastQueuedSkillOnly && !lastSkillInQueue)
                {
                    continue;
                }

                try
                {
                    if (Settings.Calendar.Provider == CalendarProvider.Outlook && OutlookInstalled)
                    {
                        await DoOutlookAppointmentAsync(queuedSkill, queuePosition, lastSkillInQueue);
                    }

                    if (Settings.Calendar.Provider == CalendarProvider.Google)
                    {
                        await DoGoogleAppointmentAsync(queuedSkill, queuePosition, lastSkillInQueue);
                    }
                }
                catch (Exception ex)
                {
                    ExceptionHandler.LogRethrowException(ex);
                    throw;
                }
            }
        }
Exemplo n.º 11
0
    public List <SkillQueue> PlayerQueue(int player_id)
    {
        List <SkillQueue> retQueue = new List <SkillQueue>();

        string qwery = "select skill_id,tech,level,queue from skill_queue where player_id=" + player_id.ToString();

        GetReader(qwery);
        while (reader.Read())
        {
            SkillQueue _skillQueue = new SkillQueue();

//			Debug.Log ("reader.read");
            if (!reader.IsDBNull(0))
            {
//				Debug.Log ("reader0 "+reader.GetInt32(0));
                _skillQueue.skill_id = reader.GetInt32(0);
//				Debug.Log ("reader1 "+reader.GetInt32(1));
                if (!reader.IsDBNull(1))
                {
                    _skillQueue.tech = reader.GetInt32(1);
                }
//				Debug.Log ("reader2 "+reader.GetInt32(2));
                if (!reader.IsDBNull(2))
                {
                    _skillQueue.level = reader.GetInt32(2);
                }
                if (!reader.IsDBNull(3))
                {
                    _skillQueue.queue = reader.GetInt32(3);
                }
                retQueue.Add(_skillQueue);
            }
        }

        return(retQueue);
    }
Exemplo n.º 12
0
        /// <summary>
        /// Draws the list item for the given skill
        /// </summary>
        /// <param name="skill"></param>
        /// <param name="e"></param>
        public void DrawItem(QueuedSkill skill, DrawItemEventArgs e)
        {
            Graphics g = e.Graphics;

            // Draw background
            if (e.Index % 2 == 0)
            {
                // Not in training - odd
                g.FillRectangle(Brushes.LightGray, e.Bounds);
            }
            else
            {
                // Not in training - even
                g.FillRectangle(Brushes.White, e.Bounds);
            }


            // Measure texts
            var format = TextFormatFlags.NoPadding | TextFormatFlags.NoClipping;

            double percentCompleted       = 0;
            int    skillPoints            = (skill.Skill == null ? 0 : skill.Skill.SkillPoints);
            int    skillPointsToNextLevel = (skill.Skill == null
                                              ? 0
                                              : skill.Skill.StaticData.GetPointsRequiredForLevel(
                                                 Math.Min(skill.Level, 5)));

            if (skill.Skill != null && skill.Level == skill.Skill.Level + 1)
            {
                percentCompleted = skill.Skill.PercentCompleted;
            }

            if (skill.Skill != null && skill.Level > skill.Skill.Level + 1)
            {
                skillPoints = skill.CurrentSP;
            }

            string rankText = String.Format(CultureConstants.DefaultCulture, " (Rank {0})",
                                            (skill.Skill == null ? 0 : skill.Skill.Rank));
            string spText = String.Format(CultureConstants.DefaultCulture, "SP: {0:#,##0}/{1:#,##0}", skillPoints,
                                          skillPointsToNextLevel);
            string levelText = String.Format(CultureConstants.DefaultCulture, "Level {0}", skill.Level);
            string pctText   = String.Format(CultureConstants.DefaultCulture, "{0}% Done", Math.Floor(percentCompleted));

            Size skillNameSize = TextRenderer.MeasureText(g, skill.SkillName, m_boldSkillsQueueFont, Size.Empty, format);
            Size rankTextSize  = TextRenderer.MeasureText(g, rankText, m_skillsQueueFont, Size.Empty, format);
            Size levelTextSize = TextRenderer.MeasureText(g, levelText, m_skillsQueueFont, Size.Empty, format);
            Size spTextSize    = TextRenderer.MeasureText(g, spText, m_skillsQueueFont, Size.Empty, format);
            Size pctTextSize   = TextRenderer.MeasureText(g, pctText, m_skillsQueueFont, Size.Empty, format);


            // Draw texts
            Color highlightColor = Color.Black;

            TextRenderer.DrawText(g, skill.SkillName, m_boldSkillsQueueFont,
                                  new Rectangle(e.Bounds.Left + PadLeft, e.Bounds.Top + PadTop,
                                                skillNameSize.Width + PadLeft, skillNameSize.Height), highlightColor);
            TextRenderer.DrawText(g, rankText, m_skillsQueueFont,
                                  new Rectangle(e.Bounds.Left + PadLeft + skillNameSize.Width, e.Bounds.Top + PadTop,
                                                rankTextSize.Width + PadLeft, rankTextSize.Height), highlightColor);
            TextRenderer.DrawText(g, spText, m_skillsQueueFont,
                                  new Rectangle(e.Bounds.Left + PadLeft,
                                                e.Bounds.Top + PadTop + skillNameSize.Height + LineVPad,
                                                spTextSize.Width + PadLeft, spTextSize.Height), highlightColor);


            // Boxes
            g.DrawRectangle(Pens.Black,
                            new Rectangle(e.Bounds.Right - BoxWidth - PadRight, e.Bounds.Top + PadTop, BoxWidth,
                                          BoxHeight));

            int levelBoxWidth = (BoxWidth - 4 - 3) / 5;

            for (int level = 1; level <= 5; level++)
            {
                var brect =
                    new Rectangle(e.Bounds.Right - BoxWidth - PadRight + 2 + (levelBoxWidth * (level - 1)) + (level - 1),
                                  e.Bounds.Top + PadTop + 2, levelBoxWidth, BoxHeight - 3);

                if (skill.Skill != null && level <= skill.Skill.Level)
                {
                    g.FillRectangle(Brushes.Black, brect);
                }
                else
                {
                    g.FillRectangle(Brushes.DarkGray, brect);
                }

                // Color indicator for a queued level
                SkillQueue skillQueue = m_ccpCharacter.SkillQueue;
                if (skill.Skill != null)
                {
                    Brush brush = (Settings.UI.SafeForWork ? Brushes.Gray : Brushes.RoyalBlue);

                    foreach (QueuedSkill qskill in skillQueue)
                    {
                        if ((!skill.Skill.IsTraining && skill == qskill && level == qskill.Level) ||
                            (skill == qskill && level <= qskill.Level && level > skill.Skill.Level &&
                             percentCompleted == 0))
                        {
                            g.FillRectangle(brush, brect);
                        }

                        // Blinking indicator of skill level in training
                        if (skill.Skill.IsTraining && skill == qskill && level == skill.Level &&
                            percentCompleted > 0)
                        {
                            if (m_count == 0)
                            {
                                g.FillRectangle(Brushes.White, brect);
                            }

                            if (m_count == 1)
                            {
                                m_count = -1;
                            }

                            m_count++;
                        }
                    }
                }
            }

            // Draw progression bar
            g.DrawRectangle(Pens.Black,
                            new Rectangle(e.Bounds.Right - BoxWidth - PadRight,
                                          e.Bounds.Top + PadTop + BoxHeight + BoxVPad, BoxWidth, LowerBoxHeight));

            var pctBarRect = new Rectangle(e.Bounds.Right - BoxWidth - PadRight + 2,
                                           e.Bounds.Top + PadTop + BoxHeight + BoxVPad + 2,
                                           BoxWidth - 3, LowerBoxHeight - 3);

            g.FillRectangle(Brushes.DarkGray, pctBarRect);
            var fillWidth = (int)(pctBarRect.Width * (percentCompleted / 100));

            if (fillWidth > 0)
            {
                var fillRect = new Rectangle(pctBarRect.X, pctBarRect.Y, fillWidth, pctBarRect.Height);
                g.FillRectangle(Brushes.Black, fillRect);
            }


            // Draw level and percent texts
            TextRenderer.DrawText(g, levelText, m_skillsQueueFont, new Rectangle(
                                      e.Bounds.Right - BoxWidth - PadRight - BoxHPad -
                                      levelTextSize.Width,
                                      e.Bounds.Top + PadTop,
                                      levelTextSize.Width + PadRight,
                                      levelTextSize.Height), Color.Black);

            TextRenderer.DrawText(g, pctText, m_skillsQueueFont, new Rectangle(
                                      e.Bounds.Right - BoxWidth - PadRight - BoxHPad -
                                      pctTextSize.Width,
                                      e.Bounds.Top + PadTop + levelTextSize.Height +
                                      LineVPad, pctTextSize.Width + PadRight,
                                      pctTextSize.Height), Color.Black);

            // Draw the queue color bar
            DrawQueueColorBar(g, e);
        }
Exemplo n.º 13
0
        /// <summary>
        /// Base constructor.
        /// </summary>
        /// <param name="identity"></param>
        /// <param name="guid"></param>
        private CCPCharacter(CharacterIdentity identity, Guid guid)
            : base(identity, guid)
        {
            QueryMonitors = new QueryMonitorCollection();
            SkillQueue = new SkillQueue(this);
            Standings = new StandingCollection(this);
            Assets = new AssetCollection(this);
            WalletJournal = new WalletJournalCollection(this);
            WalletTransactions = new WalletTransactionsCollection(this);
            CharacterMarketOrders = new MarketOrderCollection(this);
            CorporationMarketOrders = new MarketOrderCollection(this);
            CharacterContracts = new ContractCollection(this);
            CorporationContracts = new ContractCollection(this);
            CharacterContractBids = new ContractBidCollection(this);
            CorporationContractBids = new ContractBidCollection(this);
            CharacterIndustryJobs = new IndustryJobCollection(this);
            CorporationIndustryJobs = new IndustryJobCollection(this);
            ResearchPoints = new ResearchPointCollection(this);
            EVEMailMessages = new EveMailMessageCollection(this);
            EVEMailingLists = new EveMailingListCollection(this);
            EVENotifications = new EveNotificationCollection(this);
            Contacts = new ContactCollection(this);
            CharacterMedals = new MedalCollection(this);
            CorporationMedals = new MedalCollection(this);
            UpcomingCalendarEvents = new UpcomingCalendarEventCollection(this);
            KillLog = new KillLogCollection(this);
            PlanetaryColonies = new PlanetaryColonyCollection(this);

            m_endedOrdersForCharacter = new List<MarketOrder>();
            m_endedOrdersForCorporation = new List<MarketOrder>();

            m_endedContractsForCharacter = new List<Contract>();
            m_endedContractsForCorporation = new List<Contract>();

            m_jobsCompletedForCharacter = new List<IndustryJob>();

            EveMonClient.CharacterAssetsUpdated += EveMonClient_CharacterAssetsUpdated;
            EveMonClient.CharacterMarketOrdersUpdated += EveMonClient_CharacterMarketOrdersUpdated;
            EveMonClient.CorporationMarketOrdersUpdated += EveMonClient_CorporationMarketOrdersUpdated;
            EveMonClient.CharacterContractsUpdated += EveMonClient_CharacterContractsUpdated;
            EveMonClient.CorporationContractsUpdated += EveMonClient_CorporationContractsUpdated;
            EveMonClient.CharacterIndustryJobsUpdated += EveMonClient_CharacterIndustryJobsUpdated;
            EveMonClient.CorporationIndustryJobsUpdated += EveMonClient_CorporationIndustryJobsUpdated;
            EveMonClient.CharacterIndustryJobsCompleted += EveMonClient_CharacterIndustryJobsCompleted;
            EveMonClient.CorporationIndustryJobsCompleted += EveMonClient_CorporationIndustryJobsCompleted;
            EveMonClient.CharacterPlaneteryPinsCompleted += EveMonClient_CharacterPlaneteryPinsCompleted;
            EveMonClient.APIKeyInfoUpdated += EveMonClient_APIKeyInfoUpdated;
            EveMonClient.TimerTick += EveMonClient_TimerTick;
        }
Exemplo n.º 14
0
        public void SkillQueueWithEntriesIsNotEmpty()
        {
            var queue = new SkillQueue(List(new SkillQueue.Entry(1, "two", 3, 4, 5, DateTime.Now, DateTime.Now)));

            Assert.False(queue.IsEmpty());
        }
Exemplo n.º 15
0
        public void SkillQueueWithNoEntriesIsEmpty()
        {
            var queue = new SkillQueue(List <SkillQueue.Entry>());

            Assert.True(queue.IsEmpty());
        }
Exemplo n.º 16
0
        /// <summary>
        /// Draws the list item for the given skill
        /// </summary>
        /// <param name="skill"></param>
        /// <param name="e"></param>
        public void DrawItem(QueuedSkill skill, DrawItemEventArgs e)
        {
            Graphics g = e.Graphics;

            // Draw background
            if ((e.Index % 2) == 0)
            {
                // Not in training - odd
                g.FillRectangle(Brushes.LightGray, e.Bounds);
            }
            else
            {
                // Not in training - even
                g.FillRectangle(Brushes.White, e.Bounds);
            }


            // Measure texts
            TextFormatFlags format = TextFormatFlags.NoPadding | TextFormatFlags.NoClipping;

            float percentComplete        = 0;
            int   skillPoints            = skill.Skill.SkillPoints;
            int   skillPointsToNextLevel = skill.Skill.StaticData.GetPointsRequiredForLevel(Math.Min(skill.Level, 5));

            if (skill.Level == skill.Skill.LastConfirmedLvl + 1)
            {
                percentComplete = skill.FractionCompleted;
            }
            if (skill.Level > skill.Skill.LastConfirmedLvl + 1)
            {
                skillPoints = skill.CurrentSP;
            }
            string rankText  = String.Format(CultureInfo.CurrentCulture, " (Rank {0})", skill.Skill.Rank);
            string spText    = String.Format(CultureInfo.CurrentCulture, "SP: {0:#,##0}/{1:#,##0}", skillPoints, skillPointsToNextLevel);
            string levelText = String.Format(CultureInfo.CurrentCulture, "Level {0}", skill.Level);
            string pctText   = String.Format(CultureInfo.CurrentCulture, "{0:0}% Done", Math.Floor(percentComplete * 100));

            Size skillNameSize = TextRenderer.MeasureText(g, skill.Skill.Name, m_boldSkillsQueueFont, Size.Empty, format);
            Size levelTextSize = TextRenderer.MeasureText(g, levelText, m_skillsQueueFont, Size.Empty, format);
            Size pctTextSize   = TextRenderer.MeasureText(g, pctText, m_skillsQueueFont, Size.Empty, format);


            // Draw texts
            Color highlightColor = Color.Black;

            TextRenderer.DrawText(g, skill.Skill.Name, m_boldSkillsQueueFont, new Point(e.Bounds.Left + PadLeft, e.Bounds.Top + PadTop), highlightColor);
            TextRenderer.DrawText(g, rankText, m_skillsQueueFont, new Point(e.Bounds.Left + PadLeft + skillNameSize.Width, e.Bounds.Top + PadTop), highlightColor);
            TextRenderer.DrawText(g, spText, m_skillsQueueFont,
                                  new Point(e.Bounds.Left + PadLeft, e.Bounds.Top + PadTop + skillNameSize.Height + LineVPad), highlightColor);


            // Boxes
            g.DrawRectangle(Pens.Black, new Rectangle(e.Bounds.Right - BoxWidth - PadRight, e.Bounds.Top + PadTop, BoxWidth, BoxHeight));

            int levelBoxWidth = (BoxWidth - 4 - 3) / 5;

            for (int level = 1; level <= 5; level++)
            {
                Rectangle brect = new Rectangle(e.Bounds.Right - BoxWidth - PadRight + 2 + (levelBoxWidth * (level - 1)) + (level - 1),
                                                e.Bounds.Top + PadTop + 2, levelBoxWidth, BoxHeight - 3);

                if (level <= skill.Skill.LastConfirmedLvl)
                {
                    g.FillRectangle(Brushes.Black, brect);
                }
                else
                {
                    g.FillRectangle(Brushes.DarkGray, brect);
                }

                // Color indicator for a queued level
                SkillQueue skillQueue = ccpCharacter.SkillQueue;
                foreach (var qskill in skillQueue)
                {
                    if ((!skill.Skill.IsTraining && skill == qskill && level == qskill.Level) ||
                        (skill == qskill && level <= qskill.Level && level > skill.Skill.LastConfirmedLvl && percentComplete == 0.0))

                    {
                        g.FillRectangle(Brushes.RoyalBlue, brect);
                    }

                    // Blinking indicator of skill in training level
                    if (skill.Skill.IsTraining && skill == qskill && level == skill.Level && percentComplete > 0.0)
                    {
                        if (count == 0)
                        {
                            g.FillRectangle(Brushes.White, brect);
                        }
                        if (count == 1)
                        {
                            count = -1;
                        }
                        count++;
                    }
                }
            }

            // Draw progression bar
            g.DrawRectangle(Pens.Black,
                            new Rectangle(e.Bounds.Right - BoxWidth - PadRight, e.Bounds.Top + PadTop + BoxHeight + BoxVPad, BoxWidth, LowerBoxHeight));

            Rectangle pctBarRect = new Rectangle(e.Bounds.Right - BoxWidth - PadRight + 2,
                                                 e.Bounds.Top + PadTop + BoxHeight + BoxVPad + 2,
                                                 BoxWidth - 3, LowerBoxHeight - 3);

            g.FillRectangle(Brushes.DarkGray, pctBarRect);
            int fillWidth = (int)(pctBarRect.Width * percentComplete);

            if (fillWidth > 0)
            {
                Rectangle fillRect = new Rectangle(pctBarRect.X, pctBarRect.Y, fillWidth, pctBarRect.Height);
                g.FillRectangle(Brushes.Black, fillRect);
            }


            // Draw level and percent texts
            TextRenderer.DrawText(g, levelText, m_skillsQueueFont, new Point(
                                      e.Bounds.Right - BoxWidth - PadRight - BoxHPad - levelTextSize.Width,
                                      e.Bounds.Top + PadTop), Color.Black);

            TextRenderer.DrawText(g, pctText, m_skillsQueueFont,
                                  new Point(e.Bounds.Right - BoxWidth - PadRight - BoxHPad - pctTextSize.Width,
                                            e.Bounds.Top + PadTop + levelTextSize.Height + LineVPad), Color.Black);

            // Draw skill queue color bar
            Rectangle qBarRect = new Rectangle(e.Bounds.Left, GetItemHeight - LowerBoxHeight, e.Bounds.Width, LowerBoxHeight);

            g.FillRectangle(Brushes.DimGray, qBarRect);
            Rectangle skillRect = GetSkillRect(item, qBarRect.Width, LowerBoxHeight - 1);

            g.FillRectangle(Brushes.CornflowerBlue,
                            new Rectangle(skillRect.X, GetItemHeight - LowerBoxHeight, skillRect.Width, skillRect.Height));
        }
Exemplo n.º 17
0
        /// <summary>
        /// Draws the list item for the given skill
        /// </summary>
        /// <param name="skill"></param>
        /// <param name="e"></param>
        public void DrawItem(Skill skill, DrawItemEventArgs e)
        {
            Graphics g = e.Graphics;

            // Draw background
            if (skill.IsTraining)
            {
                // In training
                g.FillRectangle(Brushes.LightSteelBlue, e.Bounds);
            }
            else if ((e.Index % 2) == 0)
            {
                // Not in training - odd
                g.FillRectangle(Brushes.White, e.Bounds);
            }
            else
            {
                // Not in training - even
                g.FillRectangle(Brushes.LightGray, e.Bounds);
            }


            // Measure texts
            TextFormatFlags format = TextFormatFlags.NoPadding | TextFormatFlags.NoClipping;

            int skillLevel             = skill.Level;
            int skillPointsToNextLevel = skill.StaticData.GetPointsRequiredForLevel(Math.Min(skill.Level + 1, 5));

            for (int i = 0; skill.SkillPoints >= skillPointsToNextLevel && skillLevel < 5; i++)
            {
                skillLevel++;
                skillPointsToNextLevel = skill.StaticData.GetPointsRequiredForLevel(Math.Min(skillLevel + 1, 5));
            }

            float percentComplete = skill.FractionCompleted;

            for (int i = 0; percentComplete >= 1; i++)
            {
                percentComplete--;
            }

            string rankText  = String.Format(CultureInfo.CurrentCulture, " (Rank {0})", skill.Rank);
            string spText    = String.Format(CultureInfo.CurrentCulture, "SP: {0:#,##0}/{1:#,##0}", skill.SkillPoints, skillPointsToNextLevel);
            string levelText = String.Format(CultureInfo.CurrentCulture, "Level {0}", skillLevel);
            string pctText   = String.Format(CultureInfo.CurrentCulture, "{0:0}% Done", Math.Floor(percentComplete * 100));

            Size skillNameSize = TextRenderer.MeasureText(g, skill.Name, m_boldSkillsFont, Size.Empty, format);
            Size levelTextSize = TextRenderer.MeasureText(g, levelText, m_skillsFont, Size.Empty, format);
            Size pctTextSize   = TextRenderer.MeasureText(g, pctText, m_skillsFont, Size.Empty, format);


            // Draw texts
            Color highlightColor = Color.Black;

            if (!skill.IsKnown)
            {
                highlightColor = Color.Red;
            }
            if (!skill.IsPublic)
            {
                highlightColor = Color.DarkRed;
            }
            if (skill.ArePrerequisitesMet && skill.IsPublic && !skill.IsKnown)
            {
                highlightColor = Color.SlateGray;
            }
            if (Settings.UI.MainWindow.HighlightPartialSkills && skill.IsPartiallyTrained && !skill.IsTraining)
            {
                highlightColor = Color.Green;
            }
            if (Settings.UI.MainWindow.HighlightQueuedSkills && skill.IsQueued && !skill.IsTraining)
            {
                highlightColor = Color.RoyalBlue;
            }

            TextRenderer.DrawText(g, skill.Name, m_boldSkillsFont, new Point(e.Bounds.Left + PadLeft, e.Bounds.Top + PadTop), highlightColor);
            TextRenderer.DrawText(g, rankText, m_skillsFont, new Point(e.Bounds.Left + PadLeft + skillNameSize.Width, e.Bounds.Top + PadTop), highlightColor);
            TextRenderer.DrawText(g, spText, m_skillsFont,
                                  new Point(e.Bounds.Left + PadLeft, e.Bounds.Top + PadTop + skillNameSize.Height + LineVPad), highlightColor);


            // Boxes
            g.DrawRectangle(Pens.Black, new Rectangle(e.Bounds.Right - BoxWidth - PadRight, e.Bounds.Top + PadTop, BoxWidth, BoxHeight));

            int levelBoxWidth = (BoxWidth - 4 - 3) / 5;

            for (int level = 1; level <= 5; level++)
            {
                Rectangle brect = new Rectangle(e.Bounds.Right - BoxWidth - PadRight + 2 + (levelBoxWidth * (level - 1)) + (level - 1),
                                                e.Bounds.Top + PadTop + 2, levelBoxWidth, BoxHeight - 3);

                if (level <= skillLevel)
                {
                    g.FillRectangle(Brushes.Black, brect);
                }
                else
                {
                    g.FillRectangle(Brushes.DarkGray, brect);
                }

                // Color indicator for a queued level
                CCPCharacter ccpCharacter = m_character as CCPCharacter;
                if (ccpCharacter != null)
                {
                    SkillQueue skillQueue = ccpCharacter.SkillQueue;
                    foreach (var qskill in skillQueue)
                    {
                        if ((!skill.IsTraining && skill == qskill.Skill && level == qskill.Level) ||
                            (skill.IsTraining && skill == qskill.Skill && level == qskill.Level && level > skillLevel + 1))
                        {
                            g.FillRectangle(Brushes.RoyalBlue, brect);
                        }
                    }
                }

                // Blinking indicator of skill in training level
                if (skill.IsTraining && level == skillLevel + 1)
                {
                    if (count == 0)
                    {
                        g.FillRectangle(Brushes.White, brect);
                    }
                    if (count == 1)
                    {
                        count = -1;
                    }
                    count++;
                }
            }

            // Draw progression bar
            g.DrawRectangle(Pens.Black,
                            new Rectangle(e.Bounds.Right - BoxWidth - PadRight, e.Bounds.Top + PadTop + BoxHeight + BoxVPad, BoxWidth, LowerBoxHeight));

            Rectangle pctBarRect = new Rectangle(e.Bounds.Right - BoxWidth - PadRight + 2,
                                                 e.Bounds.Top + PadTop + BoxHeight + BoxVPad + 2,
                                                 BoxWidth - 3, LowerBoxHeight - 3);

            g.FillRectangle(Brushes.DarkGray, pctBarRect);
            int fillWidth = (int)(pctBarRect.Width * percentComplete);

            if (fillWidth > 0)
            {
                Rectangle fillRect = new Rectangle(pctBarRect.X, pctBarRect.Y, fillWidth, pctBarRect.Height);
                g.FillRectangle(Brushes.Black, fillRect);
            }


            // Draw level and percent texts
            TextRenderer.DrawText(g, levelText, m_skillsFont, new Point(
                                      e.Bounds.Right - BoxWidth - PadRight - BoxHPad - levelTextSize.Width,
                                      e.Bounds.Top + PadTop), Color.Black);

            TextRenderer.DrawText(g, pctText, m_skillsFont,
                                  new Point(e.Bounds.Right - BoxWidth - PadRight - BoxHPad - pctTextSize.Width,
                                            e.Bounds.Top + PadTop + levelTextSize.Height + LineVPad), Color.Black);
        }
Exemplo n.º 18
0
 private static Character Character(string name = null, ApiKey apiKey = null, int?id = null, int?sp = null, SkillQueue skillQueue = null)
 {
     return(new Character
     {
         Name = name ?? "Foo",
         ApiKey = apiKey ?? new ApiKey {
             Id = 1234, Secret = "asdf"
         },
         Id = id ?? 3,
         SP = sp ?? 5,
         SkillQueue = skillQueue ?? new SkillQueue(new List <SkillQueue.Entry>()),
     });
 }