public override void EndQuest(Caravan caravan = null, EndCondition condition = EndCondition.None) { if (condition == EndCondition.Success) { CaravanMaker.MakeCaravan(EnteredPawns, RimWorld.Faction.OfPlayer, Site.Tile, false); Find.LetterStack.ReceiveLetter("BuildingSeccessEndTitle".Translate(), "BuildingSeccessEnd".Translate(Faction.Name), LetterDefOf.PositiveEvent); CommOption_GetHelp.AddComponentWithStack(Faction, 1); Faction.TryAffectGoodwillWith(Faction.OfPlayer, 25); OldSettlement.Tile = Site.Tile; } if (condition == EndCondition.Timeout || condition == EndCondition.Fail) { Faction.TryAffectGoodwillWith(Faction.OfPlayer, -15); } base.EndQuest(caravan, condition); }
public override void DoWindowContents(Rect inRect) { Listing_Standard listing = new Listing_Standard(); listing.Begin(inRect); if (listing.ButtonText("Try add GetHelp option")) { List <FloatMenuOption> list = new List <FloatMenuOption>(); foreach (var faction in QuestsManager.Communications.FactionManager.Factions) { list.Add(new FloatMenuOption(faction.Faction.Name, delegate { CommOption_GetHelp.AddComponentWithStack(faction.Faction, 1); })); } Find.WindowStack.Add(new FloatMenu(list)); } if (listing.ButtonText("Create test message")) { EmailMessage message = new EmailMessage(); Find.WindowStack.Add(new CreateMessageWindow(message)); } if (listing.ButtonText("End quest...")) { List <FloatMenuOption> list = new List <FloatMenuOption>(); foreach (EndCondition condition in Enum.GetValues(typeof(EndCondition))) { list.Add(new FloatMenuOption(condition.ToString(), delegate { List <FloatMenuOption> list2 = new List <FloatMenuOption>(); foreach (var quest in QuestsManager.Communications.Quests) { list2.Add(new FloatMenuOption(quest.CardLabel, delegate { if (quest.Site != null) { quest.Site.EndQuest(null, condition); } else { quest.EndQuest(null, condition); } })); } Find.WindowStack.Add(new FloatMenu(list2)); })); } Find.WindowStack.Add(new FloatMenu(list)); } if (listing.ButtonText("Add scout component")) { List <FloatMenuOption> list = new List <FloatMenuOption>(); foreach (var faction in QuestsManager.Communications.FactionManager.Factions) { list.Add(new FloatMenuOption(faction.Faction.Name, delegate { if (!ScoutingComp.ScoutAlready(faction.Faction, out ScoutingComp outComp)) { ScoutingComp comp = new ScoutingComp(faction.Faction, 4000, 200000, 5); comp.id = QuestsManager.Communications.UniqueIdManager.GetNextComponentID(); QuestsManager.Communications.RegisterComponent(comp); } else { Messages.Message("Already has", MessageTypeDefOf.PositiveEvent, false); } }));
public override void EndQuest(Caravan caravan = null, EndCondition condition = EndCondition.None) { base.EndQuest(caravan, condition); var interaction = QuestsManager.Communications.FactionManager.GetInteraction(Faction); if (condition == EndCondition.Timeout) { if (savedPawns != null) { if (saved && savedPawns.Count > 0) { foreach (var pawn in savedPawns) { if (pawn != null && pawn.Faction != Faction) { pawn.SetFaction(Faction); } } Faction.TryAffectGoodwillWith(Faction.OfPlayer, -50); Find.LetterStack.ReceiveLetter("Quest_MissingPeople_ThiefTitle".Translate(), "Quest_MissingPeople_Thief".Translate(), LetterDefOf.NegativeEvent); for (int i = 0; i < QuestsManager.Communications.Components.Count; i++) { CommunicationComponent comp = QuestsManager.Communications.Components[i]; if (comp is ScoutingComp comp2 && comp2.Faction == Faction) { QuestsManager.Communications.RemoveComponent(comp); } } CommOption_GetHelp.AddComponentWithStack(Faction, -999); } if (interaction != null) { interaction.Trust -= 5; } } } if (condition == EndCondition.Fail) { Faction.TryAffectGoodwillWith(Faction.OfPlayer, -25); if (interaction != null) { interaction.Trust -= 15; } } if (condition == EndCondition.Success) { Faction.TryAffectGoodwillWith(Faction.OfPlayer, 20); if (savedPawns != null) { if (interaction != null) { interaction.Trust += savedPawns.Count * 5; } } } }