Пример #1
0
        //private static void AddInjuryDays(SimGameState sim, Pilot pilot, int days)
        //{
        //    int timeoutRemainingDays = sim.GetPilotTimeoutTimeRemaining(pilot);
        //    Logger.Log($"Applying injury time: (existing: {timeoutRemainingDays}) + (new: {days})");
        //    pilot.pilotDef.SetTimeoutTime(timeoutRemainingDays + days);
        //    pilot.pilotDef.PilotTags.Add("pilot_lightinjury");
        //    sim.RefreshInjuries();

        //    //int timeoutRemainingDays = 0;
        //    //if (pilot.pilotDef.TimeoutRemaining > 0)
        //    //{
        //    //    var med = sim.MedBayQueue.GetSubEntry(pilot.Description.Id);
        //    //    Logger.Log($"med.GetRemainingCost: {med.GetRemainingCost()}");
        //    //    Logger.Log($"med.GetCostPaid: {med.GetCostPaid()}");
        //    //    Logger.Log($"med.GetCost: {med.GetCost()}");
        //    //    Logger.Log($"sim.GetDailyHealValue: {sim.GetDailyHealValue()}");
        //    //    timeoutRemainingDays = (int)Math.Ceiling((double)med.GetRemainingCost() / sim.GetDailyHealValue());
        //    //    sim.MedBayQueue.RemoveSubEntry(pilot.Description.Id);
        //    //}
        //    //Logger.Log($"timeoutRemainingDays: {timeoutRemainingDays}, adding: {days}");
        //    //pilot.pilotDef.SetTimeoutTime(timeoutRemainingDays + days);
        //    //pilot.pilotDef.PilotTags.Add("pilot_lightinjury");

        //    //this.RoomManager.RefreshTimeline(false);

        //}



        private static void RespecPilot(Pilot pilot)
        {
            SimGameState sim      = UnityGameInstance.BattleTechGame.Simulation;
            PilotDef     pilotDef = pilot.pilotDef.CopyToSim();

            foreach (string value in sim.Constants.Story.CampaignCommanderUpdateTags)
            {
                if (!sim.CompanyTags.Contains(value))
                {
                    sim.CompanyTags.Add(value);
                }
            }
            //int num = 0;
            //if (pilotDef.BonusPiloting > 0)
            //{
            //    num += sim.GetLevelRangeCost(pilotDef.BasePiloting, pilotDef.SkillPiloting - 1);
            //}
            //if (pilotDef.BonusGunnery > 0)
            //{
            //    num += sim.GetLevelRangeCost(pilotDef.BaseGunnery, pilotDef.SkillGunnery - 1);
            //}
            //if (pilotDef.BonusGuts > 0)
            //{
            //    num += sim.GetLevelRangeCost(pilotDef.BaseGuts, pilotDef.SkillGuts - 1);
            //}
            //if (pilotDef.BonusTactics > 0)
            //{
            //    num += sim.GetLevelRangeCost(pilotDef.BaseTactics, pilotDef.SkillTactics - 1);
            //}
            //if (num <= 0)
            //{
            //    return;
            //}

            // alternate: broken because some pilots start with values in this:
            //int num = pilot.pilotDef.ExperienceSpent;

            int num = GetTrueSpentExperienceValue(sim, pilot);

            Logger.Log($"num: {num}");
            // nerf the pilotdef
            Traverse.Create(pilotDef).Property("BaseGunnery").SetValue(1);
            Traverse.Create(pilotDef).Property("BasePiloting").SetValue(1);
            Traverse.Create(pilotDef).Property("BaseGuts").SetValue(1);
            Traverse.Create(pilotDef).Property("BaseTactics").SetValue(1);

            pilotDef.abilityDefNames.Clear();
            List <string> abilities = SimGameState.GetAbilities(pilotDef.BaseGunnery, pilotDef.BasePiloting, pilotDef.BaseGuts, pilotDef.BaseTactics);

            pilotDef.abilityDefNames.AddRange(abilities);
            pilotDef.SetSpentExperience(0);
            pilotDef.ForceRefreshAbilityDefs();
            pilotDef.ResetBonusStats();
            pilot.FromPilotDef(pilotDef);
            pilot.AddExperience(0, "Respec", num);
        }
Пример #2
0
        // copied and changed from RespecPilot()
        private static void WipePilotStats(Pilot pilot)
        {
            var sim      = UnityGameInstance.BattleTechGame.Simulation;
            var pilotDef = pilot.pilotDef.CopyToSim();

            foreach (var value in sim.Constants.Story.CampaignCommanderUpdateTags)
            {
                if (!sim.CompanyTags.Contains(value))
                {
                    sim.CompanyTags.Add(value);
                }
            }

            try
            {
                Log($"Base:\t {pilotDef.BaseGunnery} / {pilotDef.BasePiloting} / {pilotDef.BaseGuts} / {pilotDef.BaseTactics}");
                Log($"Bonus:\t {pilotDef.BonusGunnery} / {pilotDef.BonusPiloting} / {pilotDef.BonusGuts} / {pilotDef.BonusTactics}");

                var num = 0;
                num += sim.GetLevelRangeCost(1, pilotDef.SkillGunnery - 1);
                num += sim.GetLevelRangeCost(1, pilotDef.SkillPiloting - 1);
                num += sim.GetLevelRangeCost(1, pilotDef.SkillGuts - 1);
                num += sim.GetLevelRangeCost(1, pilotDef.SkillTactics - 1);

                Traverse.Create(pilotDef).Property("BaseGunnery").SetValue(1);
                Traverse.Create(pilotDef).Property("BasePiloting").SetValue(1);
                Traverse.Create(pilotDef).Property("BaseGuts").SetValue(1);
                Traverse.Create(pilotDef).Property("BaseTactics").SetValue(1);
                Traverse.Create(pilotDef).Property("BonusGunnery").SetValue(1);
                Traverse.Create(pilotDef).Property("BonusPiloting").SetValue(1);
                Traverse.Create(pilotDef).Property("BonusGuts").SetValue(1);
                Traverse.Create(pilotDef).Property("BonusTactics").SetValue(1);



                // pilotDef.abilityDefNames.Clear();
                pilotDef.abilityDefNames.RemoveAll(x => !modSettings.ignoredAbilities.Contains(x));


                pilotDef.SetSpentExperience(0);
                pilotDef.ForceRefreshAbilityDefs();
                pilotDef.ResetBonusStats();
                pilot.FromPilotDef(pilotDef);
                pilot.AddExperience(0, "Respec", num);
            }
            catch (Exception ex)
            {
                Log(ex);
            }
        }
Пример #3
0
        PilotReskill(SGBarracksMWDetailPanel __instance, Pilot ___curPilot)
        {
            var sim      = UnityGameInstance.BattleTechGame.Simulation;
            var pilotDef = ___curPilot.pilotDef.CopyToSim();

            foreach (var val in sim.Constants.Story.CampaignCommanderUpdateTags)
            {
                if (!sim.CompanyTags.Contains(val))
                {
                    sim.CompanyTags.Add(val);
                }
            }
            // save xpUsed
            var xpUsed = (
                sim.GetLevelRangeCost(1, pilotDef.SkillPiloting - 1)
                + sim.GetLevelRangeCost(1, pilotDef.SkillGunnery - 1)
                + sim.GetLevelRangeCost(1, pilotDef.SkillGuts - 1)
                + sim.GetLevelRangeCost(1, pilotDef.SkillTactics - 1)
                );

            // handle xpUsed overflow
            if (xpUsed < 0)
            {
                xpUsed = 0x40000000;
            }
            // reset ___curPilot
            Traverse.Create(pilotDef).Property("BasePiloting").SetValue(1);
            Traverse.Create(pilotDef).Property("BaseGunnery").SetValue(1);
            Traverse.Create(pilotDef).Property("BaseGuts").SetValue(1);
            Traverse.Create(pilotDef).Property("BaseTactics").SetValue(1);
            Traverse.Create(pilotDef).Property("BonusPiloting").SetValue(1);
            Traverse.Create(pilotDef).Property("BonusGunnery").SetValue(1);
            Traverse.Create(pilotDef).Property("BonusGuts").SetValue(1);
            Traverse.Create(pilotDef).Property("BonusTactics").SetValue(1);
            pilotDef.abilityDefNames.Clear();
            pilotDef.SetSpentExperience(0);
            pilotDef.ForceRefreshAbilityDefs();
            pilotDef.ResetBonusStats();
            ___curPilot.FromPilotDef(pilotDef);
            // reset xpUsed
            ___curPilot.AddExperience(0, "reset", xpUsed);
            // ___curPilot.AddExperience(0, "reset", 1234567);
            __instance.DisplayPilot(___curPilot);
        }
Пример #4
0
            public static bool Prefix(
                SGBarracksAdvancementPanel __instance,
                Pilot ___curPilot,
                List <SGBarracksSkillPip> ___gunPips,
                List <SGBarracksSkillPip> ___pilotPips,
                List <SGBarracksSkillPip> ___gutPips,
                List <SGBarracksSkillPip> ___tacPips,
                string type,
                int value)
            {
                try
                {
                    ___curPilot.AddExperience(0, "", 100000);

                    var sim  = UnityGameInstance.BattleTechGame.Simulation;
                    var pips = new Dictionary <string, List <SGBarracksSkillPip> >
                    {
                        { "Gunnery", ___gunPips },
                        { "Piloting", ___pilotPips },
                        { "Guts", ___gutPips },
                        { "Tactics", ___tacPips },
                    };

                    // removal of pip
                    if (___curPilot.StatCollection.GetValue <int>(type) > value)
                    {
                        Trace($"Removing {type} {value}");
                        Trace(pips[type][value].Ability);
                        Helpers.SetTempPilotSkill(type, value, -sim.GetLevelCost(value));
                        ___curPilot.pilotDef.abilityDefNames.Do(Trace);
                        Log("\n");
                        Helpers.ForceResetCharacter(__instance);
                        Traverse.Create(__instance).Method("ForceResetCharacter").GetValue();
                        return(false);
                    }

                    // add non-ability pip
                    if (!Traverse.Create(pips[type][value]).Field("hasAbility").GetValue <bool>())
                    {
                        Trace("Non-ability pip");
                        Helpers.SetTempPilotSkill(type, value, sim.GetLevelCost(value));
                        ___curPilot.pilotDef.abilityDefNames.Do(Trace);
                        Trace("\n");
                        return(false);
                    }

                    // Ability pips
                    // build complete list of defs from HBS and imported json

//                    var abilityDefs = Helpers.ModAbilities
//                        .Where(x => x.ReqSkillLevel == value + 1 && x.ReqSkill.ToString() == type).ToList();

                    var abilityDefs         = new List <AbilityDef>();
                    var abilityDictionaries = sim.AbilityTree.Select(x => x.Value).ToList();
                    foreach (var abilityDictionary in abilityDictionaries)
                    {
                        abilityDefs.AddRange(abilityDictionary[value].Where(x => x.ReqSkill.ToString() == type));
                    }

                    // don't create choice popups with 1 option
                    if (abilityDefs.Count <= 1)
                    {
                        Trace($"Single ability for {type}|{value}, skipping");
                        Helpers.SetTempPilotSkill(type, value, sim.GetLevelCost(value));
                        return(false);
                    }

                    // prevents which were ability buttons before other primaries were selected from being abilities
                    // not every ability button is visible all the time
                    var curButton   = Traverse.Create(pips[type][value]).Field("curButton").GetValue <HBSDOTweenToggle>();
                    var skillButton = Traverse.Create(pips[type][value]).Field("skillButton").GetValue <HBSDOTweenToggle>();
                    if (curButton != skillButton)
                    {
                        Trace(new string('=', 50));
                        Trace("curButton != skillButton");
                        Helpers.SetTempPilotSkill(type, value, sim.GetLevelCost(value));
                        return(false);
                    }

                    // dynamic buttons based on available abilities
                    string abilityDescs = null;
                    foreach (var abilityDef in abilityDefs)
                    {
                        string abilityID   = abilityDef.Id + "Desc";
                        string abilityName = abilityDef.Description.Name;
                        if (Mod.modSettings.usePopUpsForAbilityDesc == true)
                        {
                            abilityDescs += "[[DM.BaseDescriptionDefs[" + abilityID + "],<b>" + abilityName + "</b>]]" + "\n\n";
                        }
                        else
                        {
                            abilityDescs += abilityDef.Description.Name + ": " + abilityDef.Description.Details + "\n\n";
                        }
                    }

                    var popup = GenericPopupBuilder
                                .Create("Select an ability",
                                        abilityDescs)
                                .AddFader();
                    popup.AlwaysOnTop = true;
                    var pip = pips[type][value];
                    foreach (var abilityDef in abilityDefs)
                    {
                        popup.AddButton(abilityDef.Description.Name,
                                        () =>
                        {
                            // have to change the Ability so SetPips later, SetActiveAbilityVisible works
                            Traverse.Create(pip).Field("thisAbility").SetValue(abilityDef);
                            Traverse.Create(pip).Field("abilityIcon").GetValue <SVGImage>().vectorGraphics = abilityDef.AbilityIcon;
                            Traverse.Create(pip).Field("AbilityTooltip").GetValue <HBSTooltip>()
                            .SetDefaultStateData(TooltipUtilities.GetStateDataFromObject(abilityDef.Description));
                            Helpers.SetTempPilotSkill(type, value, sim.GetLevelCost(value), abilityDef);
                        });
                    }

                    popup.Render();
                }
                catch (Exception ex)
                {
                    Log(ex);
                }

                return(false);
            }
Пример #5
0
            public static void Postfix(SimGameState __instance, ref Pilot pilot)
            {
                try
                {
                    PilotDef pilotDef = pilot.pilotDef.CopyToSim();
                    isIncreased = false;
                    isDecreased = false;
                    isBookish   = pilot.pilotDef.PilotTags.Contains("pilot_bookish");
                    isKlutz     = pilot.pilotDef.PilotTags.Contains("pilot_klutz");
                    isAssassin  = pilot.pilotDef.PilotTags.Contains("pilot_assassin");

                    if (isBookish || isKlutz || isAssassin)
                    {
                        int NewXP = 0;
                        if (pilotDef.BonusPiloting > 0)
                        {
                            if (isKlutz)
                            {
                                isIncreased = true;
                            }
                            else
                            {
                                isIncreased = false;
                            }
                            isDecreased = false;
                            NewXP      += __instance.GetLevelRangeCost(pilotDef.BasePiloting, pilotDef.SkillPiloting - 1);
                        }
                        if (pilotDef.BonusGunnery > 0)
                        {
                            isIncreased = false;
                            if (isAssassin)
                            {
                                isDecreased = true;
                            }
                            else
                            {
                                isDecreased = false;
                            }
                            NewXP += __instance.GetLevelRangeCost(pilotDef.BaseGunnery, pilotDef.SkillGunnery - 1);
                        }
                        if (pilotDef.BonusGunnery > 0)
                        {
                            if (isBookish)
                            {
                                isIncreased = true;
                            }
                            else
                            {
                                isIncreased = false;
                            }
                            isDecreased = false;
                            NewXP      += __instance.GetLevelRangeCost(pilotDef.BaseGunnery, pilotDef.SkillGunnery - 1);
                        }
                        if (pilotDef.BonusTactics > 0)
                        {
                            isIncreased = false;
                            if (isBookish)
                            {
                                isDecreased = true;
                            }
                            else
                            {
                                isDecreased = false;
                            }
                            NewXP += __instance.GetLevelRangeCost(pilotDef.BaseTactics, pilotDef.SkillTactics - 1);
                        }
                        int XPAdjust = NewXP - pilot.pilotDef.ExperienceUnspent;
                        pilot.AddExperience(0, "Respec", XPAdjust);
                    }
                }
                catch (Exception e)
                {
                    Logger.LogError(e);
                }
            }
Пример #6
0
        public static void Add(string param)
        {
            SimGameState simGameState = SceneSingletonBehavior <UnityGameInstance> .Instance.Game.Simulation;

            if (param == "help")
            {
                string help = "";
                help += "• This command will add experience for pilots in your roster";
                help += Environment.NewLine;
                help += "• Params: 'All', 'all' or the callsign of some pilot '+' the desired xp";
                help += Environment.NewLine;
                help += "• Example: '/xp Behemoth+50000'";
                help += Environment.NewLine;
                help += "• Example: '/xp All+10000'";
                PopupHelper.Info(help);

                return;
            }



            string message = "";

            string[] array = param.Split(new char[] { '+' });
            if (array.Length != 2)
            {
                message = $"Param should be id+number. Type '/ronin help' to get some examples.";
                Logger.Debug($"[Cheater_Experience_Add] {message}");
                PopupHelper.Info(message);

                return;
            }

            string callsign = array[0];

            int.TryParse(array[1], out int xp);

            if (xp <= 0)
            {
                message = $"XP is not a positive number.";
                Logger.Debug($"[Cheater_Experience_Add] {message}");
                PopupHelper.Info(message);

                return;
            }


            if (callsign == "All" || callsign == "all")
            {
                List <string> pilotCallsigns = new List <string>();

                simGameState.Commander.AddExperience(0, "FellOffACargoShip.AddXP", xp);
                pilotCallsigns.Add(simGameState.Commander.Callsign);

                foreach (var item in simGameState.PilotRoster.Select((value, i) => new { i, value }))
                {
                    Pilot pilot = item.value;
                    int   index = item.i;

                    pilot.AddExperience(index, "FellOffACargoShip.AddXP", xp);
                    pilotCallsigns.Add(pilot.Callsign);
                }

                string allAffectedPilots = String.Join(", ", pilotCallsigns);

                message = $"Added {xp} XP to {allAffectedPilots}.";
                Logger.Debug($"[Cheater_Experience_Add] {message}");
                PopupHelper.Info(message);
            }
            else
            {
                bool success = false;

                if (callsign == simGameState.Commander.Callsign || callsign == simGameState.Commander.Callsign.ToLower())
                {
                    simGameState.Commander.AddExperience(0, "FellOffACargoShip.AddXP", xp);

                    success = true;
                    message = $"Added {xp} XP to {simGameState.Commander.Callsign}.";
                }
                else
                {
                    foreach (var item in simGameState.PilotRoster.Select((value, i) => new { i, value }))
                    {
                        Pilot pilot = item.value;
                        int   index = item.i;

                        if (callsign == pilot.Callsign || callsign == pilot.Callsign.ToLower())
                        {
                            pilot.AddExperience(index, "FellOffACargoShip.AddXP", xp);

                            success = true;
                            message = $"Added {xp} XP to {pilot.Callsign}.";
                        }
                    }
                }

                if (success)
                {
                    Logger.Debug($"[Cheater_Experience_Add] {message}");
                    PopupHelper.Info(message);
                }
                else
                {
                    message = $"Couldn't find pilot with callsign: {callsign}";
                    Logger.Debug($"[Cheater_Ronin_Add] {message}");
                    PopupHelper.Info(message);
                }
            }
        }
Пример #7
0
            public static bool Prefix(
                SGBarracksAdvancementPanel __instance,
                Pilot ___curPilot,
                List <SGBarracksSkillPip> ___gunPips,
                List <SGBarracksSkillPip> ___pilotPips,
                List <SGBarracksSkillPip> ___gutPips,
                List <SGBarracksSkillPip> ___tacPips,
                string type,
                int value)
            {
                try
                {
                    if (modSettings.debugXP == true)
                    {
                        ___curPilot.AddExperience(0, "", 100000);
                    }

                    var sim  = UnityGameInstance.BattleTechGame.Simulation;
                    var pips = new Dictionary <string, List <SGBarracksSkillPip> >
                    {
                        { "Gunnery", ___gunPips },
                        { "Piloting", ___pilotPips },
                        { "Guts", ___gutPips },
                        { "Tactics", ___tacPips },
                    };

                    // removal of pip
                    if (___curPilot.StatCollection.GetValue <int>(type) > value)
                    {
                        Trace($"Removing {type} {value}");
                        Trace(pips[type][value].Ability);
                        Helpers.SetTempPilotSkill(type, value, -sim.GetLevelCost(value));
                        ___curPilot.pilotDef.abilityDefNames.Do(Trace);
                        Log("\n");
                        Helpers.ForceResetCharacter(__instance);
                        //    Traverse.Create(__instance).Method("ForceResetCharacter").GetValue();
                        return(false);
                    }

                    // add non-ability pip
                    if (!Traverse.Create(pips[type][value]).Field("hasAbility").GetValue <bool>())
                    {
                        Trace("Non-ability pip");
                        Helpers.SetTempPilotSkill(type, value, sim.GetLevelCost(value));
                        ___curPilot.pilotDef.abilityDefNames.Do(Trace);
                        Trace("\n");
                        return(false);
                    }

                    // Ability pips
                    // build complete list of defs from HBS and imported json

                    //                    var abilityDefs = Helpers.ModAbilities
                    //                        .Where(x => x.ReqSkillLevel == value + 1 && x.ReqSkill.ToString() == type).ToList();


                    var abilityDictionaries = sim.AbilityTree.Select(x => x.Value).ToList();

                    //List<AbilityDef> abilityDefs = sim.GetAbilityDefFromTree(type, value); //does same thing as below?
                    var abilityDefs = new List <AbilityDef>();
                    foreach (var abilityDictionary in abilityDictionaries)
                    {
                        abilityDefs.AddRange(abilityDictionary[value].Where(x => x.ReqSkill.ToString() == type));
                    }



                    // don't create choice popups with 1 option
                    if (abilityDefs.Count <= 1)
                    {
                        Trace($"Single ability for {type}|{value}, skipping");
                        Helpers.SetTempPilotSkill(type, value, sim.GetLevelCost(value));
                        return(false);
                    }

                    // prevents which were ability buttons before other primaries were selected from being abilities
                    // not every ability button is visible all the time
                    var curButton   = Traverse.Create(pips[type][value]).Field("curButton").GetValue <HBSDOTweenToggle>();
                    var skillButton = Traverse.Create(pips[type][value]).Field("skillButton").GetValue <HBSDOTweenToggle>();
                    if (curButton != skillButton)
                    {
                        Trace(new string('=', 50));
                        Trace("curButton != skillButton");
                        Helpers.SetTempPilotSkill(type, value, sim.GetLevelCost(value));
                        return(false);
                    }

                    // dynamic buttons based on available abilities

                    //new code below//
                    //new code below for ability requirements
                    List <string> pilotAbilityDefNames = ___curPilot.pilotDef.abilityDefNames;

                    var abilityFilter = modSettings.abilityReqs.Values.SelectMany(x => x).ToList();

                    List <AbilityDef> abilitiesWithReqs = abilityDefs.Where(ability => abilityFilter.Any(filter => filter.Equals(ability.Id))).ToList();

                    var abilityDefsForDesc = new List <AbilityDef>();
                    abilityDefsForDesc.AddRange(abilityDefs);
                    foreach (var abilityWithReq in abilitiesWithReqs)
                    {
                        if (!pilotAbilityDefNames.Contains(modSettings.abilityReqs.FirstOrDefault(x => x.Value.Contains(abilityWithReq.Id)).Key))
                        {
                            abilityDefs.Remove(abilityWithReq);
                        }
                    }

                    //original code continues below//
                    string abilityDescs = null;
                    foreach (var abilityDefDesc in abilityDefsForDesc)
                    {
                        if (abilityDefs.Contains(abilityDefDesc))
                        {
                            string abilityID   = abilityDefDesc.Id + "Desc";
                            string abilityName = abilityDefDesc.Description.Name;
                            if (modSettings.usePopUpsForAbilityDesc == true)
                            {
                                abilityDescs += "[[DM.BaseDescriptionDefs[" + abilityID + "],<b>" + abilityName + "</b>]]" + "\n\n";
                            }
                            else
                            {
                                abilityDescs += "<color=#33f9ff>" + abilityDefDesc.Description.Name + ": </color>" + abilityDefDesc.Description.Details + "\n\n";
                            }
                        }
                        else
                        {
                            var    dm          = UnityGameInstance.BattleTechGame.DataManager;
                            string abilityID   = abilityDefDesc.Id + "Desc";
                            string abilityName = abilityDefDesc.Description.Name;

                            var reqAbilityName = modSettings.abilityReqs.FirstOrDefault(x => x.Value.Contains(abilityDefDesc.Id)).Key;
                            var allAbilities   = new List <AbilityDef>();

                            allAbilities = sim.AbilityTree[type].SelectMany(x => x.Value).ToList();
                            // allAbilities.AddRange(Traverse.Create(dm).Field("abilityDefs").GetValue<List<AbilityDef>>());

                            var reqAbility = allAbilities.Find(x => x.Id == reqAbilityName);


                            if (modSettings.usePopUpsForAbilityDesc == true)
                            {
                                //abilityDescs += "<color=#FF0000>(Requirements Unmet)</color> " + "[[DM.BaseDescriptionDefs[" + abilityID + "],<b>" + abilityName + "</b>]]" + "\n\n";
                                abilityDescs += "<color=#FF0000> Requires <u>" + reqAbility.Description.Name + "</u></color> " + "[[DM.BaseDescriptionDefs[" + abilityID + "],<b>" + abilityName + "</b>]]" + "\n\n";
                            }
                            else
                            {
                                //abilityDescs += "<color=#FF0000>(Requirements Unmet)</color> " + "<color=#0000FF>" + abilityDefDesc.Description.Name + ": </color>" + abilityDefDesc.Description.Details + "\n\n";
                                abilityDescs += "<color=#FF0000> Requires <u>" + reqAbility.Description.Name + "</u></color> " + "<color=#33f9ff>" + abilityDefDesc.Description.Name + ": </color>" + abilityDefDesc.Description.Details + "\n\n";
                            }
                        }
                    }

                    var popup = GenericPopupBuilder
                                .Create("Select an ability",
                                        abilityDescs)
                                .AddFader();
                    popup.AlwaysOnTop = true;
                    var pip = pips[type][value];
                    foreach (var abilityDef in abilityDefs)
                    {
                        popup.AddButton(abilityDef.Description.Name,
                                        () =>
                        {
                            // have to change the Ability so SetPips later, SetActiveAbilityVisible works
                            Traverse.Create(pip).Field("thisAbility").SetValue(abilityDef);
                            Traverse.Create(pip).Field("abilityIcon").GetValue <SVGImage>().vectorGraphics = abilityDef.AbilityIcon;
                            Traverse.Create(pip).Field("AbilityTooltip").GetValue <HBSTooltip>()
                            .SetDefaultStateData(TooltipUtilities.GetStateDataFromObject(abilityDef.Description));
                            Helpers.SetTempPilotSkill(type, value, sim.GetLevelCost(value), abilityDef);
                        });
                    }
                    popup.Render();
                }
                catch (Exception ex)
                {
                    Log(ex);
                }

                return(false);
            }