public override IEnumerable <string> ConfigErrors(HediffDef parentDef)
 {
     foreach (string err in base.ConfigErrors(parentDef))
     {
         yield return(err);
     }
     if (this.tools != null)
     {
         Tool dupeTool = this.tools.SelectMany(delegate(Tool lhs)
         {
             HediffCompProperties_VerbGiver $this = this.$this;
             return(from rhs in this.$this.tools
                    where lhs != rhs && lhs.id == rhs.id
                    select rhs);
         }).FirstOrDefault <Tool>();
         if (dupeTool != null)
         {
             yield return(string.Format("duplicate hediff tool id {0}", dupeTool.id));
         }
         foreach (Tool t in this.tools)
         {
             foreach (string e in t.ConfigErrors())
             {
                 yield return(e);
             }
         }
     }
 }
        public override IEnumerable <string> ConfigErrors(HediffDef parentDef)
        {
            using (IEnumerator <string> enumerator = base.ConfigErrors(parentDef).GetEnumerator())
            {
                if (enumerator.MoveNext())
                {
                    string err = enumerator.Current;
                    yield return(err);

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
            if (this.tools == null)
            {
                yield break;
            }
            Tool dupeTool = this.tools.SelectMany(delegate(Tool lhs)
            {
                HediffCompProperties_VerbGiver _0024this = ((_003CConfigErrors_003Ec__Iterator0) /*Error near IL_00d6: stateMachine*/)._0024this;
                return(from rhs in ((_003CConfigErrors_003Ec__Iterator0) /*Error near IL_00d6: stateMachine*/)._0024this.tools
                       where lhs != rhs && lhs.label == rhs.label
                       select rhs);
            }).FirstOrDefault();

            if (dupeTool == null)
            {
                yield break;
            }
            yield return(string.Format("duplicate hediff tool id {0}", dupeTool.Id));

            /*Error: Unable to find new state assignment for yield return*/;
IL_0134:
            /*Error near IL_0135: Unexpected return in MoveNext()*/;
        }
        public override IEnumerable <string> ConfigErrors(HediffDef parentDef)
        {
            using (IEnumerator <string> enumerator = base.ConfigErrors(parentDef).GetEnumerator())
            {
                if (enumerator.MoveNext())
                {
                    string err = enumerator.Current;
                    yield return(err);

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
            if (tools != null)
            {
                Tool dupeTool = tools.SelectMany(delegate(Tool lhs)
                {
                    HediffCompProperties_VerbGiver _0024this = ((_003CConfigErrors_003Ec__Iterator0) /*Error near IL_00da: stateMachine*/)._0024this;
                    return(from rhs in ((_003CConfigErrors_003Ec__Iterator0) /*Error near IL_00da: stateMachine*/)._0024this.tools
                           where lhs != rhs && lhs.id == rhs.id
                           select rhs);
                }).FirstOrDefault();
                if (dupeTool != null)
                {
                    yield return($"duplicate hediff tool id {dupeTool.id}");

                    /*Error: Unable to find new state assignment for yield return*/;
                }
                foreach (Tool tool in tools)
                {
                    using (IEnumerator <string> enumerator3 = tool.ConfigErrors().GetEnumerator())
                    {
                        if (enumerator3.MoveNext())
                        {
                            string e = enumerator3.Current;
                            yield return(e);

                            /*Error: Unable to find new state assignment for yield return*/;
                        }
                    }
                }
            }
            yield break;
IL_022b:
            /*Error near IL_022c: Unexpected return in MoveNext()*/;
        }
Esempio n. 4
0
        public override IEnumerable <StatDrawEntry> SpecialDisplayStats()
        {
            if (this.apparel != null)
            {
                string coveredParts = this.apparel.GetCoveredOuterPartsString(BodyDefOf.Human);
                yield return(new StatDrawEntry(StatCategoryDefOf.Apparel, "Covers".Translate(), coveredParts, 100, string.Empty));
            }
            if (this.IsMedicine && this.MedicineTendXpGainFactor != 1f)
            {
                yield return(new StatDrawEntry(StatCategoryDefOf.Basics, "MedicineXpGainFactor".Translate(), this.MedicineTendXpGainFactor.ToStringPercent(), 0, string.Empty));
            }
            if (this.fillPercent > 0f && this.fillPercent < 1f && (this.category == ThingCategory.Item || this.category == ThingCategory.Building || this.category == ThingCategory.Plant))
            {
                yield return(new StatDrawEntry(StatCategoryDefOf.Basics, "CoverEffectiveness".Translate(), this.BaseBlockChance().ToStringPercent(), 0, string.Empty)
                {
                    overrideReportText = "CoverEffectivenessExplanation".Translate()
                });
            }
            if (this.constructionSkillPrerequisite > 0)
            {
                StatCategoryDef basics             = StatCategoryDefOf.Basics;
                string          label              = "ConstructionSkillRequired".Translate();
                string          valueString        = this.constructionSkillPrerequisite.ToString();
                string          overrideReportText = "ConstructionSkillRequiredExplanation".Translate();
                yield return(new StatDrawEntry(basics, label, valueString, 0, overrideReportText));
            }
            if (!this.verbs.NullOrEmpty <VerbProperties>())
            {
                VerbProperties verb = (from x in this.verbs
                                       where x.isPrimary
                                       select x).First <VerbProperties>();
                StatCategoryDef verbStatCategory = (this.category != ThingCategory.Pawn) ? (verbStatCategory = StatCategoryDefOf.Weapon) : (verbStatCategory = StatCategoryDefOf.PawnCombat);
                float           warmup           = verb.warmupTime;
                if (warmup > 0f)
                {
                    string warmupLabel = (this.category != ThingCategory.Pawn) ? "WarmupTime".Translate() : "MeleeWarmupTime".Translate();
                    yield return(new StatDrawEntry(verbStatCategory, warmupLabel, warmup.ToString("0.##") + " s", 40, string.Empty));
                }
                if (verb.defaultProjectile != null)
                {
                    float dam = (float)verb.defaultProjectile.projectile.damageAmountBase;
                    yield return(new StatDrawEntry(verbStatCategory, "Damage".Translate(), dam.ToString(), 50, string.Empty));
                }
                if (verb.LaunchesProjectile)
                {
                    int   burstShotCount    = verb.burstShotCount;
                    float burstShotFireRate = 60f / verb.ticksBetweenBurstShots.TicksToSeconds();
                    float range             = verb.range;
                    if (burstShotCount > 1)
                    {
                        yield return(new StatDrawEntry(verbStatCategory, "BurstShotCount".Translate(), burstShotCount.ToString(), 20, string.Empty));

                        yield return(new StatDrawEntry(verbStatCategory, "BurstShotFireRate".Translate(), burstShotFireRate.ToString("0.##") + " rpm", 19, string.Empty));
                    }
                    yield return(new StatDrawEntry(verbStatCategory, "Range".Translate(), range.ToString("0.##"), 10, string.Empty));
                }
            }
            if (this.plant != null)
            {
                foreach (StatDrawEntry s in this.plant.SpecialDisplayStats())
                {
                    yield return(s);
                }
            }
            if (this.ingestible != null)
            {
                foreach (StatDrawEntry s2 in this.ingestible.SpecialDisplayStats(this))
                {
                    yield return(s2);
                }
            }
            if (this.race != null)
            {
                foreach (StatDrawEntry s3 in this.race.SpecialDisplayStats(this))
                {
                    yield return(s3);
                }
            }
            if (this.isBodyPartOrImplant)
            {
                foreach (RecipeDef def in from x in DefDatabase <RecipeDef> .AllDefs
                         where x.IsIngredient(this.$this)
                         select x)
                {
                    HediffDef diff = def.addsHediff;
                    if (diff != null)
                    {
                        if (diff.addedPartProps != null)
                        {
                            yield return(new StatDrawEntry(StatCategoryDefOf.Basics, "BodyPartEfficiency".Translate(), diff.addedPartProps.partEfficiency.ToStringByStyle(ToStringStyle.PercentZero, ToStringNumberSense.Absolute), 0, string.Empty));
                        }
                        foreach (StatDrawEntry s4 in diff.SpecialDisplayStats())
                        {
                            yield return(s4);
                        }
                        HediffCompProperties_VerbGiver vg = diff.CompProps <HediffCompProperties_VerbGiver>();
                        if (vg != null)
                        {
                            if (!vg.verbs.NullOrEmpty <VerbProperties>())
                            {
                                VerbProperties verb2 = vg.verbs[0];
                                if (!verb2.MeleeRange)
                                {
                                    if (verb2.defaultProjectile != null)
                                    {
                                        int projDamage = verb2.defaultProjectile.projectile.damageAmountBase;
                                        yield return(new StatDrawEntry(StatCategoryDefOf.Basics, "Damage".Translate(), projDamage.ToString(), 0, string.Empty));
                                    }
                                }
                                else
                                {
                                    int meleeDamage = verb2.meleeDamageBaseAmount;
                                    yield return(new StatDrawEntry(StatCategoryDefOf.Weapon, "Damage".Translate(), meleeDamage.ToString(), 0, string.Empty));
                                }
                            }
                            else if (!vg.tools.NullOrEmpty <Tool>())
                            {
                                Tool tool = vg.tools[0];
                                yield return(new StatDrawEntry(StatCategoryDefOf.Weapon, "Damage".Translate(), tool.power.ToString(), 0, string.Empty));
                            }
                        }
                        ThoughtDef thought = DefDatabase <ThoughtDef> .AllDefs.FirstOrDefault((ThoughtDef x) => x.hediff == diff);

                        if (thought != null && thought.stages != null && thought.stages.Any <ThoughtStage>())
                        {
                            yield return(new StatDrawEntry(StatCategoryDefOf.Basics, "MoodChange".Translate(), thought.stages.First <ThoughtStage>().baseMoodEffect.ToStringByStyle(ToStringStyle.Integer, ToStringNumberSense.Offset), 0, string.Empty));
                        }
                    }
                }
            }
            for (int i = 0; i < this.comps.Count; i++)
            {
                foreach (StatDrawEntry s5 in this.comps[i].SpecialDisplayStats())
                {
                    yield return(s5);
                }
            }
        }