public override bool CanResolve(ResolveParams rp)
        {
            if (!base.CanResolve(rp))
            {
                return(false);
            }
            if (rp.singleThingToSpawn != null && rp.singleThingToSpawn.Spawned)
            {
                return(true);
            }
            IntVec3 cell;

            if (rp.singleThingToSpawn is Pawn)
            {
                ResolveParams rp2 = rp;
                rp2.singlePawnToSpawn = (Pawn)rp.singleThingToSpawn;
                if (!SymbolResolver_SinglePawn.TryFindSpawnCell(rp2, out cell))
                {
                    return(false);
                }
            }
            if (((rp.singleThingDef != null && rp.singleThingDef.category == ThingCategory.Item) || (rp.singleThingToSpawn != null && rp.singleThingToSpawn.def.category == ThingCategory.Item)) && !TryFindSpawnCellForItem(rp.rect, out cell))
            {
                return(false);
            }
            return(true);
        }
        public override bool CanResolve(ResolveParams rp)
        {
            bool result;

            if (!base.CanResolve(rp))
            {
                result = false;
            }
            else if (rp.singleThingToSpawn != null && rp.singleThingToSpawn.Spawned)
            {
                result = true;
            }
            else
            {
                IntVec3 intVec;
                if (rp.singleThingToSpawn is Pawn)
                {
                    ResolveParams rp2 = rp;
                    rp2.singlePawnToSpawn = (Pawn)rp.singleThingToSpawn;
                    if (!SymbolResolver_SinglePawn.TryFindSpawnCell(rp2, out intVec))
                    {
                        return(false);
                    }
                }
                result = (((rp.singleThingDef == null || rp.singleThingDef.category != ThingCategory.Item) && (rp.singleThingToSpawn == null || rp.singleThingToSpawn.def.category != ThingCategory.Item)) || this.TryFindSpawnCellForItem(rp.rect, out intVec));
            }
            return(result);
        }
        public override bool CanResolve(ResolveParams rp)
        {
            if (!base.CanResolve(rp))
            {
                return(false);
            }
            if (rp.singlePawnToSpawn != null && rp.singlePawnToSpawn.Spawned)
            {
                return(true);
            }
            IntVec3 intVec = default(IntVec3);

            if (!SymbolResolver_SinglePawn.TryFindSpawnCell(rp, out intVec))
            {
                return(false);
            }
            return(true);
        }
        public override bool CanResolve(ResolveParams rp)
        {
            if (!base.CanResolve(rp))
            {
                return(false);
            }
            if (rp.singleThingToSpawn != null && rp.singleThingToSpawn.Spawned)
            {
                return(true);
            }
            IntVec3 intVec = default(IntVec3);

            if (rp.singleThingToSpawn is Pawn)
            {
                ResolveParams rp2 = rp;
                rp2.singlePawnToSpawn = (Pawn)rp.singleThingToSpawn;
                if (!SymbolResolver_SinglePawn.TryFindSpawnCell(rp2, out intVec))
                {
                    return(false);
                }
            }
            if (rp.singleThingDef != null && rp.singleThingDef.category == ThingCategory.Item)
            {
                goto IL_00a3;
            }
            if (rp.singleThingToSpawn != null && rp.singleThingToSpawn.def.category == ThingCategory.Item)
            {
                goto IL_00a3;
            }
            goto IL_00b9;
IL_00b9:
            return(true);

IL_00a3:
            if (!this.TryFindSpawnCellForItem(rp.rect, out intVec))
            {
                return(false);
            }
            goto IL_00b9;
        }
 public override void Resolve(ResolveParams rp)
 {
     if (rp.singlePawnToSpawn == null || !rp.singlePawnToSpawn.Spawned)
     {
         Map     map = BaseGen.globalSettings.map;
         IntVec3 loc;
         if (!SymbolResolver_SinglePawn.TryFindSpawnCell(rp, out loc))
         {
             if (rp.singlePawnToSpawn != null)
             {
                 Find.WorldPawns.PassToWorld(rp.singlePawnToSpawn, PawnDiscardDecideMode.Decide);
             }
         }
         else
         {
             Pawn pawn;
             if (rp.singlePawnToSpawn == null)
             {
                 PawnGenerationRequest value;
                 if (rp.singlePawnGenerationRequest != null)
                 {
                     value = rp.singlePawnGenerationRequest.Value;
                 }
                 else
                 {
                     PawnKindDef pawnKindDef;
                     if ((pawnKindDef = rp.singlePawnKindDef) == null)
                     {
                         pawnKindDef = (from x in DefDatabase <PawnKindDef> .AllDefsListForReading
                                        where x.defaultFactionType == null || !x.defaultFactionType.isPlayer
                                        select x).RandomElement <PawnKindDef>();
                     }
                     PawnKindDef pawnKindDef2 = pawnKindDef;
                     Faction     faction      = rp.faction;
                     if (faction == null && pawnKindDef2.RaceProps.Humanlike)
                     {
                         if (pawnKindDef2.defaultFactionType != null)
                         {
                             faction = FactionUtility.DefaultFactionFrom(pawnKindDef2.defaultFactionType);
                             if (faction == null)
                             {
                                 return;
                             }
                         }
                         else if (!(from x in Find.FactionManager.AllFactions
                                    where !x.IsPlayer
                                    select x).TryRandomElement(out faction))
                         {
                             return;
                         }
                     }
                     PawnKindDef kind     = pawnKindDef2;
                     Faction     faction2 = faction;
                     int         tile     = map.Tile;
                     value = new PawnGenerationRequest(kind, faction2, PawnGenerationContext.NonPlayer, tile, false, false, false, false, true, false, 1f, false, true, true, false, false, false, false, null, null, null, null, null, null, null, null);
                 }
                 pawn = PawnGenerator.GeneratePawn(value);
                 if (rp.postThingGenerate != null)
                 {
                     rp.postThingGenerate(pawn);
                 }
             }
             else
             {
                 pawn = rp.singlePawnToSpawn;
             }
             if (!pawn.Dead && rp.disableSinglePawn != null && rp.disableSinglePawn.Value)
             {
                 pawn.mindState.Active = false;
             }
             GenSpawn.Spawn(pawn, loc, map, WipeMode.Vanish);
             if (rp.singlePawnLord != null)
             {
                 rp.singlePawnLord.AddPawn(pawn);
             }
             if (rp.postThingSpawn != null)
             {
                 rp.postThingSpawn(pawn);
             }
         }
     }
 }
        public override bool CanResolve(ResolveParams rp)
        {
            IntVec3 intVec;

            return(base.CanResolve(rp) && ((rp.singlePawnToSpawn != null && rp.singlePawnToSpawn.Spawned) || SymbolResolver_SinglePawn.TryFindSpawnCell(rp, out intVec)));
        }