Exemplo n.º 1
0
        public override string GetTipString()
        {
            string text  = base.GetTipString();
            string text2 = tolerances.TolerancesString();

            if (!string.IsNullOrEmpty(text2))
            {
                text = text + "\n\n" + text2;
            }
            if (pawn.MapHeld != null)
            {
                ExpectationDef expectationDef = ExpectationsUtility.CurrentExpectationFor(pawn);
                text += "\n\n" + "CurrentExpectationsAndRecreation".Translate(expectationDef.label, expectationDef.joyToleranceDropPerDay.ToStringPercent(), expectationDef.joyKindsNeeded);
                text  = text + "\n\n" + JoyUtility.JoyKindsOnMapString(pawn.MapHeld);
            }
            else
            {
                Caravan caravan = pawn.GetCaravan();
                if (caravan != null)
                {
                    float num = caravan.needs.GetCurrentJoyGainPerTick(pawn) * 2500f;
                    if (num > 0f)
                    {
                        text += "\n\n" + "GainingJoyBecauseCaravanNotMoving".Translate() + ": +" + num.ToStringPercent() + "/" + "LetterHour".Translate();
                    }
                }
            }
            return(text);
        }
 public static ExpectationDef CurrentExpectationFor(Pawn p)
 {
     if (Current.ProgramState != ProgramState.Playing)
     {
         return(null);
     }
     if (p.Faction != Faction.OfPlayer && !p.IsPrisonerOfColony)
     {
         return(ExpectationDefOf.ExtremelyLow);
     }
     if (p.MapHeld != null)
     {
         ExpectationDef expectationDef = CurrentExpectationFor(p.MapHeld);
         if (p.royalty != null && p.MapHeld.IsPlayerHome)
         {
             foreach (Faction item in Find.FactionManager.AllFactionsListForReading)
             {
                 RoyalTitle currentTitleInFaction = p.royalty.GetCurrentTitleInFaction(item);
                 if (currentTitleInFaction != null && currentTitleInFaction.conceited && currentTitleInFaction.def.minExpectation != null && currentTitleInFaction.def.minExpectation.order > expectationDef.order)
                 {
                     expectationDef = currentTitleInFaction.def.minExpectation;
                 }
             }
             return(expectationDef);
         }
         return(expectationDef);
     }
     return(ExpectationDefOf.VeryLow);
 }
Exemplo n.º 3
0
        protected override ThoughtState CurrentStateInternal(Pawn p)
        {
            ExpectationDef expectationDef = ExpectationsUtility.CurrentExpectationFor(p);

            if (expectationDef == null)
            {
                return(ThoughtState.Inactive);
            }
            return(ThoughtState.ActiveAtStage(expectationDef.thoughtStage));
        }
        public override string GetExplanation()
        {
            Map            map            = this.BadMap();
            int            value          = JoyUtility.JoyKindsOnMapCount(map);
            string         label          = map.info.parent.Label;
            ExpectationDef expectationDef = ExpectationsUtility.CurrentExpectationFor(map);
            int            joyKindsNeeded = expectationDef.joyKindsNeeded;
            string         value2         = "AvailableRecreationTypes".Translate() + ":\n\n" + JoyUtility.JoyKindsOnMapString(map);
            string         value3         = "MissingRecreationTypes".Translate() + ":\n\n" + JoyUtility.JoyKindsNotOnMapString(map);

            return("NeedJoySourceDesc".Translate(value, label, expectationDef.label, joyKindsNeeded, value2, value3));
        }
        public static ExpectationDef CurrentExpectationFor(Map m)
        {
            float wealthTotal = m.wealthWatcher.WealthTotal;

            for (int i = 0; i < ExpectationsUtility.expectationsInOrder.Count; i++)
            {
                ExpectationDef expectationDef = ExpectationsUtility.expectationsInOrder[i];
                if (wealthTotal < expectationDef.maxMapWealth)
                {
                    return(expectationDef);
                }
            }
            return(ExpectationsUtility.expectationsInOrder[ExpectationsUtility.expectationsInOrder.Count - 1]);
        }
Exemplo n.º 6
0
        public override string GetTipString()
        {
            string text  = base.GetTipString();
            string text2 = this.tolerances.TolerancesString();

            if (!string.IsNullOrEmpty(text2))
            {
                text = text + "\n\n" + text2;
            }
            Map mapHeld = this.pawn.MapHeld;

            if (mapHeld != null)
            {
                ExpectationDef expectationDef = ExpectationsUtility.CurrentExpectationFor(this.pawn);
                text = text + "\n\n" + "CurrentExpectationsAndRecreation".Translate(new object[]
                {
                    expectationDef.label,
                    expectationDef.joyToleranceDropPerDay.ToStringPercent(),
                    expectationDef.joyKindsNeeded
                });
                text = text + "\n\n" + JoyUtility.JoyKindsOnMapString(this.pawn.MapHeld);
            }
            else
            {
                Caravan caravan = this.pawn.GetCaravan();
                if (caravan != null)
                {
                    float num = caravan.needs.GetCurrentJoyGainPerTick(this.pawn) * 2500f;
                    if (num > 0f)
                    {
                        string text3 = text;
                        text = string.Concat(new string[]
                        {
                            text3,
                            "\n\n",
                            "GainingJoyBecauseCaravanNotMoving".Translate(),
                            ": +",
                            num.ToStringPercent(),
                            "/",
                            "LetterHour".Translate()
                        });
                    }
                }
            }
            return(text);
        }
Exemplo n.º 7
0
        public static ExpectationDef CurrentExpectationFor(Map m)
        {
            if (ExpectationsUtility.expectationsInOrder == null)
            {
                ExpectationsUtility.expectationsInOrder = (from ed in DefDatabase <ExpectationDef> .AllDefs
                                                           orderby ed.maxMapWealth
                                                           select ed).ToList <ExpectationDef>();
            }
            float wealthTotal = m.wealthWatcher.WealthTotal;

            for (int i = 0; i < ExpectationsUtility.expectationsInOrder.Count; i++)
            {
                ExpectationDef expectationDef = ExpectationsUtility.expectationsInOrder[i];
                if (wealthTotal < expectationDef.maxMapWealth)
                {
                    return(expectationDef);
                }
            }
            return(ExpectationsUtility.expectationsInOrder[ExpectationsUtility.expectationsInOrder.Count - 1]);
        }
Exemplo n.º 8
0
 private static float <CurrentExpectationFor> m__0(ExpectationDef ed)
 {
     return(ed.maxMapWealth);
 }
 private static float <Reset> m__0(ExpectationDef ed)
 {
     return(ed.maxMapWealth);
 }