コード例 #1
0
        private void Fulfill(Caravan caravan)
        {
            int          remaining = requestCount;
            List <Thing> list      = CaravanInventoryUtility.TakeThings(caravan, delegate(Thing thing)
            {
                if (requestThingDef != thing.def)
                {
                    return(0);
                }
                if (!PlayerCanGive(thing))
                {
                    return(0);
                }
                int num    = Mathf.Min(remaining, thing.stackCount);
                remaining -= num;
                return(num);
            });

            for (int i = 0; i < list.Count; i++)
            {
                list[i].Destroy();
            }
            if (parent.Faction != null)
            {
                parent.Faction.TryAffectGoodwillWith(Faction.OfPlayer, 12, canSendMessage: true, canSendHostilityLetter: true, "GoodwillChangedReason_FulfilledTradeRequest".Translate(), parent);
            }
            QuestUtility.SendQuestTargetSignals(parent.questTags, "TradeRequestFulfilled", parent.Named("SUBJECT"), caravan.Named("CARAVAN"));
            Disable();
        }