public override bool TryGiveQuestTo(Pawn questPawn, QuestDef questDef) { if (!Rand.Chance(QuestChance)) { return(false); } Faction faction = FactionGetter; if (faction == null) { faction = Find.FactionManager.RandomEnemyFaction(); } Faction = faction; id = QuestsManager.Communications.UniqueIdManager.GetNextQuestID(); GenerateRewards(GetQuestThingFilter(), RewardRange, CountRange, null, null); ShowInConsole = false; DefDatabase <MapGeneratorBlueprints.MapGenerator.MapGeneratorDef> .AllDefsListForReading.Where(gen => gen.targetTags != null && gen.targetTags.Contains(MapTargetTag)).TryRandomElementByWeight(w => w.Commonality, out MapGenerator); QuestsManager.Communications.AddQuest(this); return(true); }
private void PaintSelectedQuest() { int questStage = GameState.Instance.CampaignState.GetQuestStage(SelectedQuest); QuestDef qd = QuestModel.GetDef(SelectedQuest); if (qd == null) { SelectedTitle.text = SelectedQuest; SelectedDescription.text = "{missing def}"; } else { SelectedTitle.text = qd.NiceName; SelectedDescription.text = Sub.Macro(qd.Description); Texture2D tex = CoreUtils.LoadResource <Texture2D>("UI/Icons/" + qd.Image); if (tex != null) { SelectedImage.texture = tex; } string stageText = qd.GetStageText(questStage); if (stageText != null) { SelectedStageDescription.text = Sub.Macro(stageText); } } }
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); }
public Quest(string title, string location, QuestDef main, QuestDef side, QuestDef cond, int moneyReward, int expReward) { this.title = title; this.location = location; this.main = main; this.side = side; this.cond = cond; this.money = moneyReward; this.exp = expReward; }
public override bool TryGiveQuestTo(Pawn questPawn, QuestDef questDef) { if (questPawn == null) { return(false); } EventSettings settings = Settings.EventsSettings["Quest_KillOrder"]; if (!settings.Active) { return(false); } if (!TryResolveTwoFaction(out Faction faction1, out Faction faction2)) { return(false); } if (!TileFinder.TryFindPassableTileWithTraversalDistance(Find.AnyPlayerHomeMap.Tile, 8, 24, out int result)) { return(false); } Pawn pawn = PawnGenerator.GeneratePawn(PawnKindDefOf.AncientSoldier, faction2); Find.WorldPawns.PassToWorld(pawn); if (pawn == null) { return(false); } TargetPawn = pawn; Faction = faction1; TicksToPass = Rand.Range(6, 12) * 60000; id = QuestsManager.Communications.UniqueIdManager.GetNextQuestID(); GenerateRewards(); ShowInConsole = false; QuestsManager.Communications.AddQuestPawn(questPawn, this); QuestsManager.Communications.AddQuest(this); if (TargetPawn == null) { return(false); } return(true); }
public override bool TryGiveQuestTo(Pawn questPawn, QuestDef questDef) { EventSettings settings = Settings.EventsSettings["Quest_KillLeader"]; if (!settings.Active) { return(false); } if (!TryResolveTwoFactions(out Faction alliedFaction, out Faction enemyFaction)) { return(false); } if (enemyFaction.leader == null) { return(false); } if (!TileFinder.TryFindPassableTileWithTraversalDistance(Find.AnyPlayerHomeMap.Tile, 8, 20, out int result)) { return(false); } Faction = alliedFaction; TicksToPass = Rand.Range(8, 15) * 60000; id = QuestsManager.Communications.UniqueIdManager.GetNextQuestID(); TargetPawn = enemyFaction.leader; GenerateRewards(GetQuestThingFilter(), new FloatRange(600, 800) * (float)enemyFaction.def.techLevel, new IntRange(1, 3), null, null); ShowInConsole = false; QuestsManager.Communications.AddQuestPawn(questPawn, this); QuestsManager.Communications.AddQuest(this); return(true); }