public void DoTable_RaidStrategySampled(Faction fac) { int ticksGame = Find.TickManager.TicksGame; Find.TickManager.DebugSetTicksGame(36000000); List <TableDataGetter <RaidStrategyDef> > list = new List <TableDataGetter <RaidStrategyDef> >(); list.Add(new TableDataGetter <RaidStrategyDef>("defName", (RaidStrategyDef d) => d.defName)); foreach (float num in Dialog_DebugActionsMenu.PointsOptions(false)) { float points = num; Dictionary <RaidStrategyDef, int> strats = new Dictionary <RaidStrategyDef, int>(); foreach (RaidStrategyDef key in DefDatabase <RaidStrategyDef> .AllDefs) { strats.Add(key, 0); } for (int i = 0; i < 500; i++) { IncidentParms incidentParms = new IncidentParms(); incidentParms.target = Find.CurrentMap; incidentParms.points = points; incidentParms.faction = fac; if (this.TryResolveRaidFaction(incidentParms)) { this.ResolveRaidStrategy(incidentParms, PawnGroupKindDefOf.Combat); if (incidentParms.raidStrategy != null) { Dictionary <RaidStrategyDef, int> strats2; RaidStrategyDef raidStrategy; (strats2 = strats)[raidStrategy = incidentParms.raidStrategy] = strats2[raidStrategy] + 1; } } } list.Add(new TableDataGetter <RaidStrategyDef>(points.ToString("F0"), delegate(RaidStrategyDef str) { int num2 = strats[str]; return(((float)num2 / 500f).ToStringPercent()); })); } Find.TickManager.DebugSetTicksGame(ticksGame); DebugTables.MakeTablesDialog <RaidStrategyDef>(DefDatabase <RaidStrategyDef> .AllDefs, list.ToArray()); }
public static void PawnGroupsMade() { Dialog_DebugOptionListLister.ShowSimpleDebugMenu(from fac in Find.FactionManager.AllFactions where !fac.def.pawnGroupMakers.NullOrEmpty() select fac, (Faction fac) => fac.Name + " (" + fac.def.defName + ")", delegate(Faction fac) { StringBuilder sb = new StringBuilder(); sb.AppendLine("FACTION: " + fac.Name + " (" + fac.def.defName + ") min=" + fac.def.MinPointsToGeneratePawnGroup(PawnGroupKindDefOf.Combat)); Action <float> action = delegate(float points) { if (!(points < fac.def.MinPointsToGeneratePawnGroup(PawnGroupKindDefOf.Combat))) { PawnGroupMakerParms pawnGroupMakerParms = new PawnGroupMakerParms { groupKind = PawnGroupKindDefOf.Combat, tile = Find.CurrentMap.Tile, points = points, faction = fac }; sb.AppendLine("Group with " + pawnGroupMakerParms.points + " points (max option cost: " + MaxPawnCost(fac, points, RaidStrategyDefOf.ImmediateAttack, PawnGroupKindDefOf.Combat) + ")"); float num = 0f; foreach (Pawn item in GeneratePawns(pawnGroupMakerParms, warnOnZeroResults: false).OrderBy((Pawn pa) => pa.kindDef.combatPower)) { string text = (item.equipment.Primary == null) ? "no-equipment" : item.equipment.Primary.Label; Apparel apparel = item.apparel.FirstApparelOnBodyPartGroup(BodyPartGroupDefOf.Torso); string text2 = (apparel == null) ? "shirtless" : apparel.LabelCap; sb.AppendLine(" " + item.kindDef.combatPower.ToString("F0").PadRight(6) + item.kindDef.defName + ", " + text + ", " + text2); num += item.kindDef.combatPower; } sb.AppendLine(" totalCost " + num); sb.AppendLine(); } }; foreach (float item2 in Dialog_DebugActionsMenu.PointsOptions(extended: false)) { float obj = item2; action(obj); } Log.Message(sb.ToString()); }); }
public void DoTable_RaidArrivalModeSampled(Faction fac) { int ticksGame = Find.TickManager.TicksGame; Find.TickManager.DebugSetTicksGame(36000000); List <TableDataGetter <PawnsArrivalModeDef> > list = new List <TableDataGetter <PawnsArrivalModeDef> >(); list.Add(new TableDataGetter <PawnsArrivalModeDef>("mode", (PawnsArrivalModeDef f) => f.defName)); foreach (float num in Dialog_DebugActionsMenu.PointsOptions(false)) { float points = num; Dictionary <PawnsArrivalModeDef, int> modeCount = new Dictionary <PawnsArrivalModeDef, int>(); foreach (PawnsArrivalModeDef key in DefDatabase <PawnsArrivalModeDef> .AllDefs) { modeCount.Add(key, 0); } for (int i = 0; i < 500; i++) { IncidentParms incidentParms = new IncidentParms(); incidentParms.target = Find.CurrentMap; incidentParms.points = points; incidentParms.faction = fac; if (this.TryResolveRaidFaction(incidentParms)) { this.ResolveRaidStrategy(incidentParms, PawnGroupKindDefOf.Combat); this.ResolveRaidArriveMode(incidentParms); Dictionary <PawnsArrivalModeDef, int> modeCount2; PawnsArrivalModeDef raidArrivalMode; (modeCount2 = modeCount)[raidArrivalMode = incidentParms.raidArrivalMode] = modeCount2[raidArrivalMode] + 1; } } list.Add(new TableDataGetter <PawnsArrivalModeDef>(points.ToString("F0"), delegate(PawnsArrivalModeDef str) { int num2 = modeCount[str]; return(((float)num2 / 500f).ToStringPercent()); })); } Find.TickManager.DebugSetTicksGame(ticksGame); DebugTables.MakeTablesDialog <PawnsArrivalModeDef>(DefDatabase <PawnsArrivalModeDef> .AllDefs, list.ToArray()); }
public void DoTable_RaidFactionSampled() { int ticksGame = Find.TickManager.TicksGame; Find.TickManager.DebugSetTicksGame(36000000); List <TableDataGetter <Faction> > list = new List <TableDataGetter <Faction> >(); list.Add(new TableDataGetter <Faction>("name", (Faction f) => f.Name)); foreach (float num in Dialog_DebugActionsMenu.PointsOptions(false)) { float points = num; Dictionary <Faction, int> factionCount = new Dictionary <Faction, int>(); foreach (Faction key in Find.FactionManager.AllFactions) { factionCount.Add(key, 0); } for (int i = 0; i < 500; i++) { IncidentParms incidentParms = new IncidentParms(); incidentParms.target = Find.CurrentMap; incidentParms.points = points; if (this.TryResolveRaidFaction(incidentParms)) { Dictionary <Faction, int> factionCount2; Faction faction; (factionCount2 = factionCount)[faction = incidentParms.faction] = factionCount2[faction] + 1; } } list.Add(new TableDataGetter <Faction>(points.ToString("F0"), delegate(Faction str) { int num2 = factionCount[str]; return(((float)num2 / 500f).ToStringPercent()); })); } Find.TickManager.DebugSetTicksGame(ticksGame); DebugTables.MakeTablesDialog <Faction>(Find.FactionManager.AllFactions, list.ToArray()); }
private static void <PawnGroupsMade> m__3(Faction fac) { StringBuilder sb = new StringBuilder(); sb.AppendLine(string.Concat(new object[] { "FACTION: ", fac.Name, " (", fac.def.defName, ") min=", fac.def.MinPointsToGeneratePawnGroup(PawnGroupKindDefOf.Combat) })); Action <float> action = delegate(float points) { if (points < fac.def.MinPointsToGeneratePawnGroup(PawnGroupKindDefOf.Combat)) { return; } PawnGroupMakerParms pawnGroupMakerParms = new PawnGroupMakerParms(); pawnGroupMakerParms.groupKind = PawnGroupKindDefOf.Combat; pawnGroupMakerParms.tile = Find.CurrentMap.Tile; pawnGroupMakerParms.points = points; pawnGroupMakerParms.faction = fac; sb.AppendLine(string.Concat(new object[] { "Group with ", pawnGroupMakerParms.points, " points (max option cost: ", PawnGroupMakerUtility.MaxPawnCost(fac, points, RaidStrategyDefOf.ImmediateAttack, PawnGroupKindDefOf.Combat), ")" })); float num2 = 0f; foreach (Pawn pawn in from pa in PawnGroupMakerUtility.GeneratePawns(pawnGroupMakerParms, false) orderby pa.kindDef.combatPower select pa) { string text; if (pawn.equipment.Primary != null) { text = pawn.equipment.Primary.Label; } else { text = "no-equipment"; } Apparel apparel = pawn.apparel.FirstApparelOnBodyPartGroup(BodyPartGroupDefOf.Torso); string text2; if (apparel != null) { text2 = apparel.LabelCap; } else { text2 = "shirtless"; } sb.AppendLine(string.Concat(new string[] { " ", pawn.kindDef.combatPower.ToString("F0").PadRight(6), pawn.kindDef.defName, ", ", text, ", ", text2 })); num2 += pawn.kindDef.combatPower; } sb.AppendLine(" totalCost " + num2); sb.AppendLine(); }; foreach (float num in Dialog_DebugActionsMenu.PointsOptions(false)) { float obj = num; action(obj); } Log.Message(sb.ToString(), false); }
public static void PawnGroupsMade() { Dialog_DebugOptionListLister.ShowSimpleDebugMenu <Faction>(from fac in Find.FactionManager.AllFactions where !fac.def.pawnGroupMakers.NullOrEmpty <PawnGroupMaker>() select fac, (Faction fac) => fac.Name + " (" + fac.def.defName + ")", delegate(Faction fac) { StringBuilder sb = new StringBuilder(); sb.AppendLine(string.Concat(new object[] { "FACTION: ", fac.Name, " (", fac.def.defName, ") min=", fac.def.MinPointsToGeneratePawnGroup(PawnGroupKindDefOf.Combat) })); Action <float> action = delegate(float points) { if (points < fac.def.MinPointsToGeneratePawnGroup(PawnGroupKindDefOf.Combat)) { return; } PawnGroupMakerParms pawnGroupMakerParms = new PawnGroupMakerParms(); pawnGroupMakerParms.groupKind = PawnGroupKindDefOf.Combat; pawnGroupMakerParms.tile = Find.CurrentMap.Tile; pawnGroupMakerParms.points = points; pawnGroupMakerParms.faction = fac; sb.AppendLine(string.Concat(new object[] { "Group with ", pawnGroupMakerParms.points, " points (max option cost: ", PawnGroupMakerUtility.MaxPawnCost(fac, points, RaidStrategyDefOf.ImmediateAttack, PawnGroupKindDefOf.Combat), ")" })); float num = 0f; foreach (Pawn current in PawnGroupMakerUtility.GeneratePawns(pawnGroupMakerParms, false).OrderBy((Pawn pa) => pa.kindDef.combatPower)) { string text; if (current.equipment.Primary != null) { text = current.equipment.Primary.Label; } else { text = "no-equipment"; } Apparel apparel = current.apparel.FirstApparelOnBodyPartGroup(BodyPartGroupDefOf.Torso); string text2; if (apparel != null) { text2 = apparel.LabelCap; } else { text2 = "shirtless"; } sb.AppendLine(string.Concat(new string[] { " ", current.kindDef.combatPower.ToString("F0").PadRight(6), current.kindDef.defName, ", ", text, ", ", text2 })); num += current.kindDef.combatPower; } sb.AppendLine(" totalCost " + num); sb.AppendLine(); }; foreach (float obj in Dialog_DebugActionsMenu.PointsOptions(false)) { action(obj); } Log.Message(sb.ToString(), false); }); }