private Dictionary<String, Int32> GetBestProfessions(Character gnome) { var professionSkills = GetSkillsByProfession(); Dictionary<String, Int32> professionScores = new Dictionary<String, Int32>(); foreach (var professionSkill in professionSkills) { var profession = professionSkill.Key; var skills = professionSkill.Value; Int32 score = 0; Int32 skillCount = skills.Count; var skillWeights = GetRatios(skillCount); for (Int32 i = 0; i < skillCount; i++) { // Professions consist of multiple jobs. // The other of the jobs within the profession is used when determining the next job a Gnome will perform. // Note: All tasks must be completed for all higher jobs before a gnome will queue a task in a lower priority job // As a result, we should weight each gnome's skills based on the likelihood of them queuing for those tasks in a given job. Int32 rawSkill = gnome.SkillLevel(skills[i]); Double weightedSkill = rawSkill * skillWeights[i]; Int32 weightedRoundedSkill = (Int32)Math.Round(weightedSkill, 0); score += weightedRoundedSkill; } professionScores.Add(profession, score); } return professionScores.OrderByDescending(obj => obj.Value).ToDictionary(obj => obj.Key, obj => obj.Value); }
public GnomeSkill(Character gameGnome, SkillDef skill) { Name = skill.Name; Skill = gameGnome.SkillLevel(skill.ID); }
public GnomeRow(Character character) : base(character) { Name = character.Name(); Profession = character.Mind.Profession; Mining = character.SkillLevel(CharacterSkillType.Mining.ToString()); Masonry = character.SkillLevel(CharacterSkillType.Masonry.ToString()); Stonecarving = character.SkillLevel(CharacterSkillType.Stonecarving.ToString()); WoodCutting = character.SkillLevel(CharacterSkillType.Woodcutting.ToString()); Carpentry = character.SkillLevel(CharacterSkillType.Carpentry.ToString()); Woodcarving = character.SkillLevel(CharacterSkillType.Woodcarving.ToString()); Smelting = character.SkillLevel(CharacterSkillType.Smelting.ToString()); Blacksmithing = character.SkillLevel(CharacterSkillType.Blacksmithing.ToString()); Metalworking = character.SkillLevel(CharacterSkillType.Metalworking.ToString()); WeaponCrafting = character.SkillLevel(CharacterSkillType.WeaponCrafting.ToString()); ArmorCrafting = character.SkillLevel(CharacterSkillType.ArmorCrafting.ToString()); Gemcutting = character.SkillLevel(CharacterSkillType.Gemcutting.ToString()); JewelryMaking = character.SkillLevel(CharacterSkillType.JewelryMaking.ToString()); Weaving = character.SkillLevel(CharacterSkillType.Weaving.ToString()); Tailoring = character.SkillLevel(CharacterSkillType.Tailoring.ToString()); Pottery = character.SkillLevel(CharacterSkillType.Pottery.ToString()); Leatherworking = character.SkillLevel(CharacterSkillType.Leatherworking.ToString()); Bonecarving = character.SkillLevel(CharacterSkillType.Bonecarving.ToString()); Prospecting = character.SkillLevel(CharacterSkillType.Prospecting.ToString()); Tinkering = character.SkillLevel(CharacterSkillType.Tinkering.ToString()); Machining = character.SkillLevel(CharacterSkillType.Machining.ToString()); Engineering = character.SkillLevel(CharacterSkillType.Engineering.ToString()); Mechanic = character.SkillLevel(CharacterSkillType.Mechanic.ToString()); AnimalHusbandry = character.SkillLevel(CharacterSkillType.AnimalHusbandry.ToString()); Butchery = character.SkillLevel(CharacterSkillType.Butchery.ToString()); Horticulture = character.SkillLevel(CharacterSkillType.Horticulture.ToString()); Farming = character.SkillLevel(CharacterSkillType.Farming.ToString()); Cooking = character.SkillLevel(CharacterSkillType.Cooking.ToString()); Brewing = character.SkillLevel(CharacterSkillType.Brewing.ToString()); Medic = character.SkillLevel(CharacterSkillType.Medic.ToString()); Caretaking = character.SkillLevel(CharacterSkillType.Caretaking.ToString()); Construction = character.SkillLevel(CharacterSkillType.Construction.ToString()); Hauling = character.SkillLevel(CharacterSkillType.Hauling.ToString()); }
public Gnome(Character gnome, int level, int row, int column, int mapCellPosition, int realIndex) { this.name = gnome.Name(); this.id = realIndex; this.level = level; this.row = row; this.column = column; this.position = mapCellPosition; this.profession = gnome.Mind.Profession; this.mining = gnome.SkillLevel(CharacterSkillType.Mining); foreach (var skill in SkillDef.AllLaborSkills()) this.laborSkills.Add(new SkillEntry(skill, gnome.SkillLevel(skill), gnome.Mind.IsSkillAllowed(skill))); foreach (var skill in SkillDef.AllCombatSkills()) this.combatSkills.Add(new SkillEntry(skill, gnome.SkillLevel(skill), gnome.Mind.IsSkillAllowed(skill))); foreach (var attribute in Enum.GetValues(typeof(CharacterAttributeType))) this.attributes.Add(new AttributeEntry((CharacterAttributeType)attribute, gnome.AttributeLevel((CharacterAttributeType)attribute))); }