Exemple #1
0
 private ResearchProjectDef GetCurProj()
 {
     if (ResearchInfo.Clean)
     {
         return(Find.ResearchManager.currentProj);
     }
     if (_userpawn != null && ResearchInfo.ModHumanResources)
     {
         return(Aux_HR.HRCurrentProject(_userpawn));
     }
     if (_userpawn != null && ResearchInfo.ModPawnsChooseResearch && !ResearchInfo.ModHumanResources && !Aux_PCR.VersionMismatch)
     {
         return(Aux_PCR.PCRCurrentProject(_userpawn));
     }
     return(null);
 }
Exemple #2
0
        public string InspectStringInfo(Thing thing, bool study = false)
        {
            StringBuilder      sb = new StringBuilder();
            ResearchProjectDef curProj;

            if (study)
            {
                Pawn pawn = ListOfCurrentResearchers(study: true).Where(x => x.CurJob.targetA.Thing == thing).FirstOrDefault();
                if (pawn != null)
                {
                    curProj = Aux_HR.HRCurrentProject(pawn);
                    sb.AppendInNewLine(RI_Mod.settings.showCurrentProject ? $"{"RqRI_CurrentProject".Translate() + curProj.LabelCap}" : "");
                    sb.AppendInNewLine(RI_Mod.settings.showResearchProgress ? $"{"RqRI_LearningProgress".Translate() + Aux_HR.HRExpertise(pawn)[curProj].ToStringPercent("F0")}" : "");
                    sb.AppendInNewLine(RI_Mod.settings.showTimeToComplete ? $"{"RqRI_TimeToComplete".Translate() + TimeToCompleteLearning(curProj, pawn)}" : "");
                }
                return(sb.ToString());
            }
            if (ResearchInfo.Clean)
            {
                curProj = Find.ResearchManager.currentProj;
                sb.AppendInNewLine(RI_Mod.settings.showCurrentProject ? $"{"RqRI_CurrentProject".Translate() + (curProj != null ? curProj.LabelCap : "None".Translate())}" : "");
                if (curProj != null)
                {
                    sb.AppendInNewLine(RI_Mod.settings.showResearchProgress ? $"{"RqRI_ResearchProgress".Translate() + curProj.ProgressApparent.ToString("F0") + " / " + curProj.CostApparent.ToString("F0") + $" ({curProj.ProgressPercent.ToStringPercent("F1")})"}" : "");
                    sb.AppendInNewLine(RI_Mod.settings.showTimeToComplete && TimeToCompleteResearch(curProj) != "-" ? $"{"RqRI_TimeToComplete".Translate() + TimeToCompleteResearch(curProj)}" : "");
                }
                return(sb.ToString());
            }
            if (ResearchInfo.ModHumanResources)
            {
                Pawn pawn = ListOfCurrentResearchers().Where(x => x.CurJob.targetA.Thing == thing).FirstOrDefault();
                if (pawn != null)
                {
                    curProj = Aux_HR.HRCurrentProject(pawn);
                    sb.AppendInNewLine(RI_Mod.settings.showCurrentProject ? $"{"RqRI_CurrentProject".Translate() + curProj.LabelCap}" : "");
                    sb.AppendInNewLine(RI_Mod.settings.showResearchProgress ? $"{"RqRI_ResearchProgress".Translate() + Aux_HR.HRExpertise(pawn)[curProj].ToStringPercent("F1")}" : "");
                    sb.AppendInNewLine(RI_Mod.settings.showTimeToComplete ? $"{"RqRI_TimeToComplete".Translate() + TimeToCompleteResearch(curProj, pawn)}" : "");
                }
                else
                {
                    sb.Append("RqRI_NotCurrentlyInUse".Translate());
                }
                return(sb.ToString());
            }
            if (ResearchInfo.ModPawnsChooseResearch && !ResearchInfo.ModHumanResources)
            {
                if (Aux_PCR.VersionMismatch)
                {
                    sb.Append("You are using an incompatible version of the 'Pawns Choose Research' mod.");
                    return(sb.ToString());
                }
                Pawn pawn = ListOfCurrentResearchers().Where(x => x.CurJob.targetA.Thing == thing).FirstOrDefault();
                if (pawn != null)
                {
                    curProj = Aux_PCR.PCRCurrentProject(pawn);
                    if (curProj != null)
                    {
                        sb.AppendInNewLine(RI_Mod.settings.showCurrentProject ? $"{"RqRI_CurrentProject".Translate() + curProj.LabelCap}" : "");
                        sb.AppendInNewLine(RI_Mod.settings.showResearchProgress ? $"{"RqRI_ResearchProgress".Translate() + $"{curProj.ProgressApparent.ToString("F0")} / {curProj.CostApparent.ToString("F0")} ({curProj.ProgressPercent.ToStringPercent("F1")})"}" : "");
                        sb.AppendInNewLine(RI_Mod.settings.showTimeToComplete ? $"{"RqRI_TimeToComplete".Translate() + TimeToCompleteResearch(curProj)}" : "");
                    }
                }
                else
                {
                    sb.Append("RqRI_NotCurrentlyInUse".Translate());
                }
                return(sb.ToString());
            }
            return(string.Empty);
        }