Ejemplo n.º 1
0
        /// <summary>
        /// Exports the skills in the skill group.
        /// </summary>
        /// <param name="group">The group.</param>
        /// <returns></returns>
        private static IEnumerable <SerializableSkill> ExportSkillsInGroup(IHasID group)
        {
            List <SerializableSkill> listOfSkillsInGroup = new List <SerializableSkill>();

            var alphaLimit = HoboleaksAlphaSkills.GetAlphaSkillLimits();
            var l5         = new SerializableSkillPrerequisite()
            {
                ID    = 3348, // Leadership
                Level = 5,
                Name  = Database.InvTypesTable[3348].Name
            };

            foreach (InvTypes skill in Database.InvTypesTable.Where(x => x.GroupID == group.ID))
            {
                Util.UpdatePercentDone(Database.SkillsTotalCount);

                int skillID = skill.ID;
                SerializableSkill singleSkill = new SerializableSkill
                {
                    ID          = skillID,
                    Name        = skill.Name,
                    Description = skill.Description,
                    Public      = skill.Published,
                    Cost        = (long)skill.BasePrice,
                    AlphaLimit  = (alphaLimit.ContainsKey(skill.ID)) ? alphaLimit[skill.ID] : 0,
                };

                // Export skill atributes
                Dictionary <int, long> skillAttributes = Database.DgmTypeAttributesTable.Where(
                    x => x.ItemID == skill.ID).ToDictionary(
                    attribute => attribute.AttributeID, attribute => attribute.GetInt64Value);

                singleSkill.Rank = skillAttributes.ContainsKey(DBConstants.SkillTimeConstantPropertyID) &&
                                   skillAttributes[DBConstants.SkillTimeConstantPropertyID] > 0
                    ? skillAttributes[DBConstants.SkillTimeConstantPropertyID]
                    : 1;

                singleSkill.PrimaryAttribute = skillAttributes.ContainsKey(DBConstants.PrimaryAttributePropertyID)
                    ? IntToEveAttribute(skillAttributes[DBConstants.PrimaryAttributePropertyID])
                    : EveAttribute.None;
                singleSkill.SecondaryAttribute = skillAttributes.ContainsKey(DBConstants.SecondaryAttributePropertyID)
                    ? IntToEveAttribute(
                    skillAttributes[DBConstants.SecondaryAttributePropertyID])
                    : EveAttribute.None;

                // Export prerequisites
                List <SerializableSkillPrerequisite> listOfPrerequisites = new List <SerializableSkillPrerequisite>();

                for (int i = 0; i < DBConstants.RequiredSkillPropertyIDs.Count; i++)
                {
                    if (!skillAttributes.ContainsKey(DBConstants.RequiredSkillPropertyIDs[i]) ||
                        !skillAttributes.ContainsKey(DBConstants.RequiredSkillLevelPropertyIDs[i]))
                    {
                        continue;
                    }

                    InvTypes prereqSkill = Database.InvTypesTable[skillAttributes[DBConstants.RequiredSkillPropertyIDs[i]]];

                    SerializableSkillPrerequisite preReq = new SerializableSkillPrerequisite
                    {
                        ID    = prereqSkill.ID,
                        Level =
                            skillAttributes[DBConstants.RequiredSkillLevelPropertyIDs[i]],
                        Name = prereqSkill.Name
                    };

                    // Add prerequisites
                    listOfPrerequisites.Add(preReq);
                }

                // Add prerequesites to skill
                singleSkill.SkillPrerequisites.AddRange(listOfPrerequisites);

                // Hack: Fleet formation skills have all NULL attributes. CCPlease.
                if (skillID == DBConstants.FleetCoordinationSkillID)
                {
                    singleSkill.Description        = "Advanced fleet support skill allowing commanders to increase the size and spread of their fleet formations. Unlocks additional formation scaling options at each level of training.";
                    singleSkill.Rank               = 8;
                    singleSkill.Cost               = 40000000L;
                    singleSkill.PrimaryAttribute   = EveAttribute.Charisma;
                    singleSkill.SecondaryAttribute = EveAttribute.Willpower;
                    singleSkill.AlphaLimit         = 0;
                    singleSkill.SkillPrerequisites.Add(l5);
                    singleSkill.SkillPrerequisites.Add(new SerializableSkillPrerequisite()
                    {
                        ID    = DBConstants.FleetFormationsSkillID,
                        Level = 1,
                        Name  = Database.InvTypesTable[DBConstants.FleetFormationsSkillID].Name
                    });
                }
                else if (skillID == DBConstants.FleetFormationsSkillID)
                {
                    singleSkill.Description        = "Fleet support skill allowing commanders to organize and warp fleets in formation. Unlocks additional formation types at each level of training.";
                    singleSkill.Rank               = 5;
                    singleSkill.Cost               = 40000000L;
                    singleSkill.PrimaryAttribute   = EveAttribute.Charisma;
                    singleSkill.SecondaryAttribute = EveAttribute.Willpower;
                    singleSkill.AlphaLimit         = 0;
                    singleSkill.SkillPrerequisites.Add(l5);
                }

                // Add skill
                listOfSkillsInGroup.Add(singleSkill);
            }
            return(listOfSkillsInGroup);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Exports the skills in the skill group.
        /// </summary>
        /// <param name="group">The group.</param>
        /// <returns></returns>
        private static IEnumerable <SerializableSkill> ExportSkillsInGroup(IHasID group)
        {
            List <SerializableSkill> listOfSkillsInGroup = new List <SerializableSkill>();

            var alphaLimit = HoboleaksAlphaSkills.GetAlphaSkillLimits();

            foreach (InvTypes skill in Database.InvTypesTable.Where(x => x.GroupID == group.ID))
            {
                Util.UpdatePercentDone(Database.SkillsTotalCount);

                SerializableSkill singleSkill = new SerializableSkill
                {
                    ID          = skill.ID,
                    Name        = skill.Name,
                    Description = skill.Description,
                    Public      = skill.Published,
                    Cost        = (long)skill.BasePrice,
                    AlphaLimit  = (alphaLimit.ContainsKey(skill.ID)) ? alphaLimit[skill.ID] : 0,
                };

                // Export skill atributes
                Dictionary <int, long> skillAttributes = Database.DgmTypeAttributesTable.Where(
                    x => x.ItemID == skill.ID).ToDictionary(
                    attribute => attribute.AttributeID, attribute => attribute.GetInt64Value);

                singleSkill.Rank = skillAttributes.ContainsKey(DBConstants.SkillTimeConstantPropertyID) &&
                                   skillAttributes[DBConstants.SkillTimeConstantPropertyID] > 0
                    ? skillAttributes[DBConstants.SkillTimeConstantPropertyID]
                    : 1;

                singleSkill.PrimaryAttribute = skillAttributes.ContainsKey(DBConstants.PrimaryAttributePropertyID)
                    ? IntToEveAttribute(skillAttributes[DBConstants.PrimaryAttributePropertyID])
                    : EveAttribute.None;
                singleSkill.SecondaryAttribute = skillAttributes.ContainsKey(DBConstants.SecondaryAttributePropertyID)
                    ? IntToEveAttribute(
                    skillAttributes[DBConstants.SecondaryAttributePropertyID])
                    : EveAttribute.None;

                // Export prerequisites
                List <SerializableSkillPrerequisite> listOfPrerequisites = new List <SerializableSkillPrerequisite>();

                for (int i = 0; i < DBConstants.RequiredSkillPropertyIDs.Count; i++)
                {
                    if (!skillAttributes.ContainsKey(DBConstants.RequiredSkillPropertyIDs[i]) ||
                        !skillAttributes.ContainsKey(DBConstants.RequiredSkillLevelPropertyIDs[i]))
                    {
                        continue;
                    }

                    InvTypes prereqSkill = Database.InvTypesTable[skillAttributes[DBConstants.RequiredSkillPropertyIDs[i]]];

                    SerializableSkillPrerequisite preReq = new SerializableSkillPrerequisite
                    {
                        ID    = prereqSkill.ID,
                        Level =
                            skillAttributes[DBConstants.RequiredSkillLevelPropertyIDs[i]],
                        Name = prereqSkill.Name
                    };

                    // Add prerequisites
                    listOfPrerequisites.Add(preReq);
                }

                // Add prerequesites to skill
                singleSkill.SkillPrerequisites.AddRange(listOfPrerequisites);

                // Add skill
                listOfSkillsInGroup.Add(singleSkill);
            }
            return(listOfSkillsInGroup);
        }