Esempio n. 1
0
 public static int CompareByPriority(PlanEntry x, PlanEntry y)
 {
     return x.Priority - y.Priority;
 }
Esempio n. 2
0
 public static int CompareByPlanGroup(PlanEntry x, PlanEntry y)
 {
     return String.Compare(x.PlanGroupsDescription, y.PlanGroupsDescription);
 }
Esempio n. 3
0
 /// <summary>
 /// Adds an item.
 /// </summary>
 /// <param name="entry"></param>
 public void Add(PlanEntry entry)
 {
     AddCore(entry);
 }
Esempio n. 4
0
 public static int CompareByTrainingTime(PlanEntry x, PlanEntry y)
 {
     return(x.TrainingTime.CompareTo(y.TrainingTime));
 }
Esempio n. 5
0
 public static int CompareByRank(PlanEntry x, PlanEntry y)
 {
     return x.Skill.Rank - y.Skill.Rank;
 }
Esempio n. 6
0
 public static int CompareBySkillGroupDuration(PlanEntry x, PlanEntry y, IEnumerable<PlanEntry> entries, Dictionary<StaticSkillGroup, TimeSpan> skillGroupsDurations)
 {
     var xDuration = GetSkillGroupDuration(x.Skill.Group, entries, skillGroupsDurations);
     var yDuration = GetSkillGroupDuration(y.Skill.Group, entries, skillGroupsDurations);
     return xDuration.CompareTo(yDuration);
 }
Esempio n. 7
0
 public static int CompareByName(PlanEntry x, PlanEntry y)
 {
     int nameDiff = String.CompareOrdinal(x.Skill.Name, y.Skill.Name);
     if (nameDiff != 0) return nameDiff;
     return x.Level - y.Level;
 }
Esempio n. 8
0
 public static int CompareByTimeDifference(PlanEntry x, PlanEntry y)
 {
     var xDuration = x.TrainingTime - x.OldTrainingTime;
     var yDuration = y.TrainingTime - y.OldTrainingTime;
     return xDuration.CompareTo(yDuration);
 }
Esempio n. 9
0
 /// <summary>
 /// From an entry of the display plan, retrieve the entry of the base plan.
 /// </summary>
 /// <param name="lvi"></param>
 /// <returns></returns>
 private PlanEntry GetOriginalEntry(PlanEntry displayEntry)
 {
     return m_plan.GetEntry(displayEntry.Skill, displayEntry.Level);
 }
Esempio n. 10
0
        /// <summary>
        /// Applies formatting to a ListViewItem if the entry is queued.
        /// </summary>
        /// <param name="lvi">ListViewItem to be formatted.</param>
        /// <param name="entry">Entry used to identify is queued.</param>
        private void HighlightQueuedSkills(ListViewItem lvi, PlanEntry entry)
        {
            if (!Settings.UI.PlanWindow.HighlightQueuedSkills)
                return;

            var ccpCharacter = m_character as CCPCharacter;

            // Current character isn't a CCP character, so can't have a Queue.
            if (ccpCharacter == null)
                return;

            string entrySkill = entry.ToString();

            foreach (var skill in ccpCharacter.SkillQueue)
            {
                string queuedSkill = skill.ToString();
                if (entrySkill == queuedSkill)
                    lvi.ForeColor = Color.RoyalBlue;
            }
        }
Esempio n. 11
0
        /// <summary>
        /// Creates a plan entry and a list view item for it, from the given skill.
        /// </summary>
        /// <param name="gs"></param>
        /// <returns></returns>
        private ListViewItem CreatePlanItemForSkill(Skill skill)
        {
            // Gets the planned level of the skill.
            int newLevel = m_plan.GetPlannedLevel(skill) + 1;
            if (skill.Level >= newLevel)
                newLevel = skill.Level + 1;

            // Quits if already on lv5
            if (newLevel > 5)
                return null;

            // Creates the plan entry and list item for this level
            PlanEntry newEntry = new PlanEntry(m_plan, skill, newLevel);
            ListViewItem newItem = new ListViewItem(newEntry.ToString());
            newItem.Tag = newEntry;

            return newItem;
        }
Esempio n. 12
0
        /// <summary>
        /// Gets the text to display in the given column for the provided entry.
        /// </summary>
        /// <param name="pe"></param>
        /// <param name="column"></param>
        /// <param name="blockingEntry"></param>
        /// <param name="format"></param>
        /// <returns></returns>
        private static string GetColumnTextForItem(PlanEntry entry, PlanColumn column, string blockingEntry, NumberFormatInfo format)
        {
            const int MaxNotesLength = 60;

            switch (column)
            {
                case PlanColumn.SkillName:
                    return entry.ToString();

                case PlanColumn.PlanGroup:
                    return entry.PlanGroupsDescription;

                case PlanColumn.TrainingTime:
                    return entry.TrainingTime.ToDescriptiveText(DescriptiveTextOptions.IncludeCommas, false);

                case PlanColumn.TrainingTimeNatural:
                    return entry.NaturalTrainingTime.ToDescriptiveText(DescriptiveTextOptions.IncludeCommas, false);

                case PlanColumn.EarliestStart:
                    return entry.StartTime.ToString("ddd ") + entry.StartTime.ToString();

                case PlanColumn.EarliestEnd:
                    return entry.EndTime.ToString("ddd ") + entry.EndTime.ToString();

                case PlanColumn.PercentComplete:
                    return entry.FractionCompleted.ToString("0%");

                case PlanColumn.SkillRank:
                    return entry.Skill.Rank.ToString();

                case PlanColumn.PrimaryAttribute:
                    return entry.Skill.PrimaryAttribute.ToString();

                case PlanColumn.SecondaryAttribute:
                    return entry.Skill.SecondaryAttribute.ToString();

                case PlanColumn.SkillGroup:
                    return entry.Skill.Group.Name;

                case PlanColumn.PlanType:
                    return entry.Type.ToString();

                case PlanColumn.SPTotal:
                    return entry.EstimatedTotalSkillPoints.ToString("N00", format);

                case PlanColumn.SPPerHour:
                    return entry.SpPerHour.ToString();

                case PlanColumn.Priority:
                    return entry.Priority.ToString();

                case PlanColumn.Conflicts:
                    return blockingEntry;

                case PlanColumn.Notes:
                    if (String.IsNullOrEmpty(entry.Notes))
                        return String.Empty;

                    string result = Regex.Replace(entry.Notes, @"(\r|\n)+", " ", RegexOptions.None);
                    if (result.Length <= MaxNotesLength)
                        return result;

                    return result.Substring(0, MaxNotesLength) + "...";

                case PlanColumn.Cost:
                    if (entry.Level != 1 || entry.CharacterSkill.IsKnown)
                        return String.Empty;
                    if (entry.CharacterSkill.IsOwned)
                        return "Owned";

                    return entry.Skill.FormattedCost;

                case PlanColumn.SkillPointsRequired:
                    return entry.SkillPointsRequired.ToString("N00", format);

                default:
                    throw new NotImplementedException();
            }
        }
Esempio n. 13
0
 /// <summary>
 /// Creates a clone of this entry for the given plan
 /// </summary>
 /// <param name="plan"></param>
 /// <returns></returns>
 internal PlanEntry Clone(BasePlan plan)
 {
     // We need a skill for the plan's character
     PlanEntry clone = new PlanEntry(plan, m_skill, m_level);
     clone.m_entryType = m_entryType;
     clone.m_priority = m_priority;
     clone.m_notes = m_notes;
     clone.m_planGroups.AddRange(m_planGroups);
     clone.m_remapping = (m_remapping != null ? m_remapping.Clone() : null);
     clone.m_oldTrainingTime = m_oldTrainingTime;
     clone.m_trainingTime = m_trainingTime;
     return clone;
 }
Esempio n. 14
0
 public static int CompareByPlanType(PlanEntry x, PlanEntry y)
 {
     return (int)x.Type - (int)y.Type;
 }
Esempio n. 15
0
 public static int CompareByCost(PlanEntry x, PlanEntry y)
 {
     long xCost = (x.Level == 1 && !x.CharacterSkill.IsOwned ? x.Skill.Cost : 0);
     long yCost = (y.Level == 1 && !x.CharacterSkill.IsOwned ? y.Skill.Cost : 0);
     return xCost.CompareTo(yCost);
 }
Esempio n. 16
0
 public static int CompareByNotes(PlanEntry x, PlanEntry y)
 {
     return String.Compare(x.Notes, y.Notes);
 }
Esempio n. 17
0
 public static int CompareByTrainingTime(PlanEntry x, PlanEntry y)
 {
     return x.TrainingTime.CompareTo(y.TrainingTime);
 }
Esempio n. 18
0
 public static int CompareByPercentCompleted(PlanEntry x, PlanEntry y)
 {
     float xRatio = x.CharacterSkill.FractionCompleted;
     float yRatio = y.CharacterSkill.FractionCompleted;
     return xRatio.CompareTo(yRatio);
 }
Esempio n. 19
0
 public static int CompareByTrainingTimeNatural(PlanEntry x, PlanEntry y)
 {
     return x.NaturalTrainingTime.CompareTo(y.NaturalTrainingTime);
 }
Esempio n. 20
0
 public static int CompareBySkillPointsRequired(PlanEntry x, PlanEntry y)
 {
     return x.SkillPointsRequired.CompareTo(y.SkillPointsRequired);
 }
Esempio n. 21
0
 public static int CompareBySPPerHour(PlanEntry x, PlanEntry y)
 {
     return x.SpPerHour - y.SpPerHour;
 }
Esempio n. 22
0
        /// <summary>
        /// Prints a single entry
        /// </summary>
        /// <param name="g">The graphics canvas.</param>
        /// <param name="index">The index.</param>
        /// <param name="pe">The plan entry.</param>
        private void PrintEntry(Graphics g, int index, PlanEntry pe)
        {
            SizeF size;

            // Print entry index
            if (m_settings.EntryNumber)
            {
                size = Print(g, index.ToString() + ": ", m_point);
                m_point.X += (int)size.Width;
            }

            // Print skill name and level
            size = PrintBold(g, pe.ToString(), m_point);
            m_point.X += (int)size.Width;

            // Print Notes ?
            if (m_settings.EntryNotes)
            {
                // Jump to next line
                m_point.Y += (int)size.Height;
                m_point.X = 20;

                // Note
                size = Print(g, pe.Notes, m_point);
                m_point.X += (int)size.Width;
            }

            // Print additional infos below
            if (m_settings.EntryTrainingTimes || m_settings.EntryStartDate || m_settings.EntryFinishDate)
            {
                // Jump to next line
                m_point.Y += (int)size.Height;
                m_point.X = 20;

                // Open parenthesis
                size = Print(g, " (", m_point);
                m_point.X += (int)size.Width;

                // Training time ?
                bool needComma = false;
                if (m_settings.EntryTrainingTimes)
                {
                    size = Print(g, pe.TrainingTime.ToDescriptiveText(
                        DescriptiveTextOptions.FullText |
                        DescriptiveTextOptions.IncludeCommas |
                        DescriptiveTextOptions.SpaceText), m_point);
                    m_point.X += (int)size.Width;
                    needComma = true;
                }

                // Start date ?
                if (m_settings.EntryStartDate)
                {
                    if (needComma)
                    {
                        size = Print(g, "; ", m_point);
                        m_point.X += (int)size.Width;
                    }

                    size = Print(g, "Start: ", m_point);
                    m_point.X += (int)size.Width;

                    size = Print(g, pe.StartTime.ToString(), m_point);
                    m_point.X += (int)size.Width;

                    needComma = true;
                }

                // End date ?
                if (m_settings.EntryFinishDate)
                {
                    if (needComma)
                    {
                        size = Print(g, "; ", m_point);
                        m_point.X += (int)size.Width;
                    }
                    size = Print(g, "Finish: ", m_point);
                    m_point.X += (int)size.Width;

                    size = Print(g, pe.EndTime.ToString(), m_point);
                    m_point.X += (int)size.Width;

                    needComma = true;
                }

                // Close parenthesis
                size = Print(g, ")", m_point);
                m_point.X += (int)size.Width;
            }

            // Jump to next line
            m_point.X = 5;
            m_point.Y += (int)size.Height;
        }
Esempio n. 23
0
 public static int CompareBySecondaryAttribute(PlanEntry x, PlanEntry y)
 {
     return (int)x.Skill.SecondaryAttribute - (int)y.Skill.SecondaryAttribute;
 }
Esempio n. 24
0
 /// <summary>
 /// Removes an item.
 /// </summary>
 /// <param name="entry"></param>
 public void Remove(PlanEntry entry)
 {
     int index = IndexOf(entry.Skill, entry.Level);
     if (index != -1) RemoveCore(index);
 }
Esempio n. 25
0
 /// <summary>
 /// Adds an item.
 /// </summary>
 /// <param name="entry"></param>
 public void Add(PlanEntry entry)
 {
     AddCore(entry);
 }