Esempio n. 1
0
        public void LogWorldPawns()
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendLine("======= World Pawns =======");
            stringBuilder.AppendLine("Count: " + AllPawnsAliveOrDead.Count());
            stringBuilder.AppendLine($"(Live: {pawnsAlive.Count} - Mothballed: {pawnsMothballed.Count} - Dead: {pawnsDead.Count}; {pawnsForcefullyKeptAsWorldPawns.Count} forcefully kept)");
            WorldPawnSituation[] array = (WorldPawnSituation[])Enum.GetValues(typeof(WorldPawnSituation));
            foreach (WorldPawnSituation worldPawnSituation in array)
            {
                if (worldPawnSituation != 0)
                {
                    stringBuilder.AppendLine();
                    stringBuilder.AppendLine("== " + worldPawnSituation + " ==");
                    foreach (Pawn item in from x in GetPawnsBySituation(worldPawnSituation)
                             orderby(x.Faction != null) ? x.Faction.loadID : (-1)
                             select x)
                    {
                        string str = (item.Name != null) ? item.Name.ToStringFull : item.LabelCap;
                        str = str + ", " + item.KindLabel;
                        if (item.royalty != null && item.royalty.AllTitlesForReading.Count > 0)
                        {
                            foreach (RoyalTitle item2 in item.royalty.AllTitlesForReading)
                            {
                                str = str + ", " + item2.def.GetLabelFor(item);
                            }
                        }
                        str = str + ", " + item.Faction;
                        stringBuilder.AppendLine(str);
                    }
                }
            }
            stringBuilder.AppendLine("===========================");
            Log.Message(stringBuilder.ToString());
        }
Esempio n. 2
0
 public IEnumerable <Pawn> GetPawnsBySituation(WorldPawnSituation situation)
 {
     return(AllPawnsAliveOrDead.Where((Pawn x) => GetSituation(x) == situation));
 }