Beispiel #1
0
        public static void Postfix(SGBarracksServicePanel __instance, Pilot p)
        {
            string affinityDescriptors = PilotAffinityManager.Instance.getMechAffinityDescription(p);
            //Main.modLog.LogMessage(affinityDescriptors);
            LocalizableText bioText = (LocalizableText)finfo.GetValue(__instance);

            bioText.AppendTextAndRefresh(affinityDescriptors, (object[])Array.Empty <object>());
            finfo.SetValue(__instance, bioText);
            methodRefreshPanel.Invoke(__instance, new object[] { });
        }
Beispiel #2
0
 public static void Postfix(TooltipPrefab_Chassis __instance, object data, LocalizableText ___descriptionText)
 {
     if (data is ChassisDef chassisDef)
     {
         Main.modLog.LogMessage($"finding chassisdef affinity descriptor for {chassisDef.Description.UIName}");
         string affinityDescriptors = PilotAffinityManager.Instance.getMechChassisAffinityDescription(chassisDef);
         //Main.modLog.LogMessage(affinityDescriptors);
         ___descriptionText.AppendTextAndRefresh(affinityDescriptors, (object[])Array.Empty <object>());
     }
     else
     {
         Main.modLog.LogMessage("chassisdef is null!");
     }
 }
Beispiel #3
0
 public static void Postfix(MechLabStockInfoPopup __instance, MechDef def, LocalizableText ___descriptionText)
 {
     if (def != null)
     {
         Main.modLog.LogMessage($"finding mechdef affinity descriptor for {def.Description.UIName}");
         string affinityDescriptors = PilotAffinityManager.Instance.getMechChassisAffinityDescription(def);
         //Main.modLog.LogMessage(affinityDescriptors);
         ___descriptionText.AppendTextAndRefresh(affinityDescriptors, (object[])Array.Empty <object>());
         //descriptor.SetValue(__instance, bioText);
         __instance.ForceRefreshImmediate();
     }
     else
     {
         Main.modLog.LogMessage("mechdef is null!");
     }
 }
Beispiel #4
0
        public static void Postfix(MechDetails __instance)
        {
            MechDef mech = (MechDef)mechdef.GetValue(__instance);

            if (mech != null)
            {
                Main.modLog.LogMessage($"finding mechdef affinity descriptor for {mech.Description.UIName}");
                string affinityDescriptors = PilotAffinityManager.Instance.getMechChassisAffinityDescription(mech);
                //Main.modLog.LogMessage(affinityDescriptors);
                LocalizableText bioText = (LocalizableText)descriptor.GetValue(__instance);
                bioText.AppendTextAndRefresh(affinityDescriptors, (object[])Array.Empty <object>());
                descriptor.SetValue(__instance, bioText);
            }
            else
            {
                Main.modLog.LogMessage("mechdef is null!");
            }
        }
            public static void Postfix(SG_Stores_MiniFactionWidget __instance, FactionValue theFaction, FactionValue ___owningFactionValue, LocalizableText ___ReputationBonusText)
            {
                if (GlobalVars.sim == null)
                {
                    return;
                }
                var sellBonus = 0f;

                var curPilots = new List <string>();

                curPilots.Add(GlobalVars.sim.Commander.FetchGUID());
                foreach (var p in GlobalVars.sim.PilotRoster)
                {
                    SpecHolder.HolderInstance.AddToMaps(p);
                    curPilots.Add(p.FetchGUID());
                }

                foreach (var pKey in curPilots)
                {
                    if (SpecHolder.HolderInstance.OpForSpecMap.ContainsKey(pKey))
                    {
                        foreach (var spec in SpecHolder.HolderInstance.OpForSpecMap[pKey])
                        {
                            var opSpec =
                                SpecManager.ManagerInstance.OpForSpecList.FirstOrDefault(x => x.OpForSpecID == spec);
                            if (opSpec != null && opSpec.storeBonus.ContainsKey(___owningFactionValue.Name))
                            {
                                sellBonus += opSpec.storeBonus[___owningFactionValue.Name];
                                ModInit.modLog.LogMessage($"Current sell multiplier from specs: {sellBonus}");
                            }
                        }
                    }
                }

                if (sellBonus == 0f)
                {
                    return;
                }
                ___ReputationBonusText.AppendTextAndRefresh(", {0}% Sell Bonus", new object[]
                {
                    Mathf.RoundToInt(sellBonus * 100f)
                });
            }
Beispiel #6
0
        public static void Postfix(AAR_ContractTermsWidget __instance, Contract ___theContract, LocalizableText ___DescriptionText)
        {
            try
            {
                // Only for successful opportunity missions
                if (___theContract.IsOpportunityMission() && ___theContract.State == Contract.ContractState.Complete)
                {
                    Logger.Debug($"[AAR_ContractTermsWidget_SetFactionResponseText_POSTFIX] Append text for {___theContract.Override.ID} if special tags are present.");

                    foreach (MissionObjectiveResult missionObjectiveResult in ___theContract.MissionObjectiveResultList)
                    {
                        // Successful secondary objective
                        if (!missionObjectiveResult.isPrimary && missionObjectiveResult.status == ObjectiveStatus.Succeeded)
                        {
                            foreach (SimGameEventResult simGameEventResult in missionObjectiveResult.simGameEventResultList)
                            {
                                // If any result of the objective contains a special tag, which is a key of the internal dictionary, append the related text (value of the dict.key)
                                string lineBreak  = "\r\n\r\n";
                                string appendText = "";
                                foreach (string tag in simGameEventResult.AddedTags)
                                {
                                    if (Fields.FactionResponseTextAppendices.TryGetValue(tag, out appendText))
                                    {
                                        ___DescriptionText.AppendTextAndRefresh($"{lineBreak}{appendText}", new object[] { });
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }
        }