static bool Prefix(CharacterObject __instance, CharacterSkills ____characterSkills, ref int __result, SkillObject skill)
        {
            int focus = __instance.HeroObject.HeroDeveloper.GetFocus(skill);
            int attr  = __instance.HeroObject.GetAttributeValue(skill.CharacterAttributesEnum);

            __result = (int)(____characterSkills.GetPropertyValue(skill) + focus * Reworked_SkillsSubModule.__FOCUS_VALUE + attr * Reworked_SkillsSubModule.__ATTR_VALUE);
            return(false);
        }
        public static void CSSetEquip(Hero hero, int tier)
        {
            SkillObject HBestSkill1; SkillObject HBestSkill2; SkillObject HBestSkill3;
            Dictionary <SkillObject, int> HeroSkills = new Dictionary <SkillObject, int>();
            CharacterSkills skills = hero.GetHeroSkills();

            foreach (SkillObject skill in (from s in SkillObject.All
                                           where s.IsPersonalSkill
                                           group s by s.CharacterAttribute.Id).SelectMany((IGrouping <MBGUID, SkillObject> s) => s).ToList <SkillObject>())
            {
                HeroSkills.Add(skill, skills.GetPropertyValue(skill)); //Add All the heros personal skills
            }
            HeroSkills.OrderByDescending(x => x.Value);                //Sorts dictionary by highest skills
            foreach (SkillObject skill in HeroSkills.Keys)
            {
            }
            List <CharacterObject> CharOptions = (from y in CharacterObject.All //Gets all possible troop options
                                                  where y.Tier == tier && y.Culture.StringId == hero.Culture.StringId && !y.IsHero
                                                  select y).ToList();

            CharOptions.Shuffle <CharacterObject>(); //shuffling to make it so there is still some possiblity of random. So x Cultue + x skill combo doesn't always get same
            CharacterObject IdealTroop = null;
            float           ratio1 = 0; float ratio2 = 0; float ratio3 = 0; float ratiocur;


            foreach (CharacterObject character in CharOptions) //Loop them and figure out which is the best option
            {
                Dictionary <SkillObject, int> troopskills = new Dictionary <SkillObject, int>();
                foreach (SkillObject troopskill in (from t in SkillObject.All
                                                    where t.IsPersonalSkill
                                                    group t by t.CharacterAttribute.Id).SelectMany((IGrouping <MBGUID, SkillObject> t) => t).ToList <SkillObject>())
                {
                    troopskills.Add(troopskill, character.GetSkillValue(troopskill));
                }
            }
            if (IdealTroop == null) //Fall back if idea troop logic fails
            {
                IdealTroop = (from y in CharacterObject.All
                              where y.Tier == tier && y.Culture.StringId == hero.Culture.StringId && !y.IsHero
                              select y).GetRandomElement <CharacterObject>();
            }
            Equipment equipment = IdealTroop.Equipment;

            hero.BattleEquipment.FillFrom(equipment);
        }