Пример #1
0
        public void GiveSoldThingToPlayer(Thing toGive, int countToGive, Pawn playerNegotiator)
        {
            Thing thing = toGive.SplitOff(countToGive);

            thing.PreTraded(TradeAction.PlayerBuys, playerNegotiator, this);
            Pawn pawn = thing as Pawn;

            if (pawn != null)
            {
                this.soldPrisoners.Remove(pawn);
            }
            TradeUtility.SpawnDropPod(DropCellFinder.TradeDropSpot(base.Map), base.Map, thing);
        }
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

                this.$PC = -1;
                switch (num)
                {
                case 0u:
                    if (base.ArchivedOnly)
                    {
                        this.$current = base.Option_Close;
                        if (!this.$disposing)
                        {
                            this.$PC = 1;
                        }
                        return(true);
                    }
                    accept        = new DiaOption("RansomDemand_Accept".Translate());
                    accept.action = delegate()
                    {
                        this.faction.kidnapped.RemoveKidnappedPawn(this.kidnapped);
                        Find.WorldPawns.RemovePawn(this.kidnapped);
                        IntVec3 intVec;
                        if (this.faction.def.techLevel < TechLevel.Industrial)
                        {
                            if (!CellFinder.TryFindRandomEdgeCellWith((IntVec3 c) => c.Standable(this.map) && this.map.reachability.CanReachColony(c), this.map, CellFinder.EdgeRoadChance_Friendly, out intVec) && !CellFinder.TryFindRandomEdgeCellWith((IntVec3 c) => c.Standable(this.map), this.map, CellFinder.EdgeRoadChance_Friendly, out intVec))
                            {
                                Log.Warning("Could not find any edge cell.", false);
                                intVec = DropCellFinder.TradeDropSpot(this.map);
                            }
                            GenSpawn.Spawn(this.kidnapped, intVec, this.map, WipeMode.Vanish);
                        }
                        else
                        {
                            intVec = DropCellFinder.TradeDropSpot(this.map);
                            TradeUtility.SpawnDropPod(intVec, this.map, this.kidnapped);
                        }
                        CameraJumper.TryJump(intVec, this.map);
                        TradeUtility.LaunchSilver(this.map, this.fee);
                        Find.LetterStack.RemoveLetter(this);
                    };
                    accept.resolveTree = true;
                    if (!TradeUtility.ColonyHasEnoughSilver(this.map, this.fee))
                    {
                        accept.Disable("NeedSilverLaunchable".Translate(new object[]
                        {
                            this.fee.ToString()
                        }));
                    }
                    this.$current = accept;
                    if (!this.$disposing)
                    {
                        this.$PC = 2;
                    }
                    return(true);

                case 2u:
                    this.$current = base.Option_Reject;
                    if (!this.$disposing)
                    {
                        this.$PC = 3;
                    }
                    return(true);

                case 3u:
                    this.$current = base.Option_Postpone;
                    if (!this.$disposing)
                    {
                        this.$PC = 4;
                    }
                    return(true);

                case 4u:
                    this.$PC = -1;
                    break;
                }
                return(false);
            }