public float getSkillFactor(Pawn current)
        {
            HediffLeader h1    = (HediffLeader)current.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("leader1"));
            HediffLeader h2    = (HediffLeader)current.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("leader2"));
            HediffLeader h3    = (HediffLeader)current.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("leader3"));
            HediffLeader h4    = (HediffLeader)current.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("leader4"));
            float        score = IncidentWorker_SetLeadership.getBotanistScore(current);

            if (h2 != null)
            {
                h1 = h2; score = IncidentWorker_SetLeadership.getWarriorScore(current);
            }
            if (h3 != null)
            {
                h1 = h3; score = IncidentWorker_SetLeadership.getCarpenterScore(current);
            }
            if (h4 != null)
            {
                h1 = h4; score = IncidentWorker_SetLeadership.getScientistScore(current);
            }

            return(((score / 20f) * 0.3f) + 1f);
        }
        public override void DoWindowContents(Rect inRect)
        {
            Text.Font = GameFont.Small;
            bool flag = false;

            if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Return)
            {
                flag = true;
                Event.current.Use();
            }
            Listing_Standard listing_Standard = new Listing_Standard();

            listing_Standard.Begin(inRect);

            listing_Standard.Label("ChooseLeader".Translate());
            String label = (chosenPawn == null ? "NoneL" : chosenPawn.Name.ToStringShort);

            if (listing_Standard.ButtonText(label, null))
            {
                List <FloatMenuOption> list    = new List <FloatMenuOption>();
                List <Pawn>            tpawns2 = new List <Pawn>();

                list.Add(new FloatMenuOption("-" + "NoneL".Translate() + "-", delegate
                {
                    this.chosenPawn = null;
                }, MenuOptionPriority.Default, null, null, 0f, null, null));

                foreach (Pawn current in IncidentWorker_SetLeadership.getAllColonists())
                {
                    Hediff h1 = current.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("leader1"));
                    Hediff h2 = current.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("leader2"));
                    Hediff h3 = current.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("leader3"));
                    Hediff h4 = current.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("leader4"));
                    Hediff h5 = current.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("leaderExpired"));
                    //Hediff h6 = current.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("ruler1"));
                    if (h1 == null && h2 == null && h3 == null && h4 == null && h5 == null && !current.WorkTagIsDisabled(WorkTags.Social))
                    {
                        tpawns2.Add(current);
                    }
                }

                foreach (Pawn p in tpawns2)
                {
                    list.Add(new FloatMenuOption(p.Name.ToStringShort, delegate
                    {
                        this.chosenPawn = p;
                    }, MenuOptionPriority.Default, null, null, 0f, null, null));
                }
                if (list.Count() == 1)
                {
                    TooltipHandler.TipRegion(inRect, "ChooseLeader_NoAbleColonists".Translate());
                }

                Find.WindowStack.Add(new FloatMenu(list));
            }


            if (listing_Standard.ButtonText("OK".Translate(), null))
            {
                if (this.chosenPawn != null)
                {
                    Pawn most = this.chosenPawn;
                    if (Utility.getGov().name == "Democracy".Translate() || Utility.getGov().name == "Dictatorship".Translate())
                    {
                        String targetLeader = "";
                        float  maxValue = new float[] { IncidentWorker_SetLeadership.getBotanistScore(most), IncidentWorker_SetLeadership.getWarriorScore(most), IncidentWorker_SetLeadership.getCarpenterScore(most), IncidentWorker_SetLeadership.getScientistScore(most) }.Max();
                        if (maxValue == IncidentWorker_SetLeadership.getBotanistScore(most))
                        {
                            targetLeader = "leader1";
                        }
                        if (maxValue == IncidentWorker_SetLeadership.getWarriorScore(most))
                        {
                            targetLeader = "leader2";
                        }
                        if (maxValue == IncidentWorker_SetLeadership.getCarpenterScore(most))
                        {
                            targetLeader = "leader3";
                        }
                        if (maxValue == IncidentWorker_SetLeadership.getScientistScore(most))
                        {
                            targetLeader = "leader4";
                        }
                        Hediff hediff = HediffMaker.MakeHediff(HediffDef.Named(targetLeader), most, null);
                        IncidentWorker_SetLeadership.doElect(most, hediff, true);
                    }

                    /**
                     * else if(Utility.getGov().name == "Monarchy")
                     * {
                     *  Hediff hediff = HediffMaker.MakeHediff(HediffDef.Named("ruler1"), most, null);
                     *  IncidentWorker_SetLeadership.setRuler(most, hediff, true);
                     * }
                     **/
                }
                Find.WindowStack.TryRemove(this, true);
            }
            listing_Standard.End();
        }