예제 #1
0
        public override bool TryGiveQuestTo(Pawn questPawn, QuestDef questDef)
        {
            EventSettings settings = Settings.EventsSettings["Quest_MissingPeople"];

            if (!settings.Active)
            {
                return(false);
            }

            Faction = questPawn.Faction;
            Map map = questPawn.Map ?? Find.AnyPlayerHomeMap;

            if (!IncidentWorker_Quest_MissingPeople.TryGetNewTile(map.Tile, out int newTile))
            {
                return(false);
            }

            TicksToPass = Rand.Range(5, 9) * 60000;
            minDays     = Rand.Range(5, 20);
            passedDays  = Rand.Range(minDays + 3, minDays + 7);
            id          = QuestsManager.Communications.UniqueIdManager.GetNextQuestID();

            int additionalValue = passedDays * 15;

            GenerateRewards(GetQuestThingFilter(), new FloatRange(700 + additionalValue, 1400 + additionalValue), new IntRange(3, 8), null, null);

            ShowInConsole = false;

            QuestsManager.Communications.AddQuestPawn(questPawn, this);
            QuestsManager.Communications.AddQuest(this);

            return(true);
        }
예제 #2
0
        public override void TakeQuestByQuester(QuestPawn quester, bool notify = true)
        {
            IncidentWorker_Quest_MissingPeople.TryGetNewTile(quester.Pawn.Tile, out int newTile);

            LookTargets target = new LookTargets(newTile);

            Target = target;

            QuestSite questPlace = (QuestSite)WorldObjectMaker.MakeWorldObject(QuestRim.WorldObjectDefOfLocal.QuestPlace);

            questPlace.Tile = newTile;
            questPlace.SetFaction(Faction);
            questPlace.Init(this);
            questPlace.RemoveAfterLeave = false;

            Site = questPlace;

            Find.WorldObjects.Add(questPlace);

            base.TakeQuestByQuester(quester, notify);
        }