protected override bool TryExecuteWorker(IncidentParms parms) { Quest quest = QuestUtility.GenerateQuestAndMakeAvailable(def.questScriptDef ?? parms.questScriptDef ?? NaturalRandomQuestChooser.ChooseNaturalRandomQuest(parms.points, parms.target), parms.points); if (!quest.hidden) { QuestUtility.SendLetterQuestAvailable(quest); } return(true); }
public static void GenerateBestowingCeremonyQuest(Pawn pawn, Faction faction) { Slate slate = new Slate(); slate.Set("titleHolder", pawn); slate.Set("bestowingFaction", faction); if (QuestScriptDefOf.BestowingCeremony.CanRun(slate)) { QuestUtility.SendLetterQuestAvailable(QuestUtility.GenerateQuestAndMakeAvailable(QuestScriptDefOf.BestowingCeremony, slate)); } }
public override IEnumerable <Gizmo> GetGizmos() { foreach (Gizmo gizmo in base.GetGizmos()) { yield return(gizmo); } foreach (Gizmo questRelatedGizmo in QuestUtility.GetQuestRelatedGizmos(this)) { yield return(questRelatedGizmo); } }
protected override Lord MakeLord() { if (!TryGetCeremonySpot(target, bestower.Faction, out var spot, out var absoluteSpot)) { Log.Error("Cannot find ceremony spot for bestowing ceremony!"); return(null); } Lord lord = LordMaker.MakeNewLord(faction, new LordJob_BestowingCeremony(bestower, target, spot, absoluteSpot, shuttle, questTag + ".QuestEnded"), base.Map); QuestUtility.AddQuestTag(ref lord.questTags, questTag); return(lord); }
public static string GetPawnSituationLabel(Pawn pawn, Pawn fromPOV) { if (pawn.Dead) { return("Dead".Translate()); } if (pawn.Destroyed) { return("Missing".Translate()); } if (PawnUtility.IsKidnappedPawn(pawn)) { return("Kidnapped".Translate()); } QuestPart_LendColonistsToFaction questPart_LendColonistsToFaction = QuestUtility.GetAllQuestPartsOfType <QuestPart_LendColonistsToFaction>().FirstOrDefault((QuestPart_LendColonistsToFaction p) => p.LentColonistsListForReading.Contains(pawn)); if (questPart_LendColonistsToFaction != null) { return("Lent".Translate(questPart_LendColonistsToFaction.lendColonistsToFaction.Named("FACTION"), questPart_LendColonistsToFaction.returnLentColonistsInTicks.ToStringTicksToDays("0.0"))); } if (pawn.kindDef == PawnKindDefOf.Slave) { return("Slave".Translate()); } if (PawnUtility.IsFactionLeader(pawn)) { return("FactionLeader".Translate()); } Faction faction = pawn.Faction; if (faction != fromPOV.Faction) { if (faction == null || fromPOV.Faction == null) { return("Neutral".Translate()); } switch (faction.RelationKindWith(fromPOV.Faction)) { case FactionRelationKind.Hostile: return("Hostile".Translate() + ", " + faction.Name); case FactionRelationKind.Neutral: return("Neutral".Translate() + ", " + faction.Name); case FactionRelationKind.Ally: return("Ally".Translate() + ", " + faction.Name); default: return(""); } } return(""); }
public override IEnumerable <Gizmo> GetGizmos() { foreach (Gizmo gizmo in base.GetGizmos()) { yield return(gizmo); } Gizmo selectMonumentMarkerGizmo = QuestUtility.GetSelectMonumentMarkerGizmo(this); if (selectMonumentMarkerGizmo != null) { yield return(selectMonumentMarkerGizmo); } }
protected override void DoFind(Pawn worker) { Slate slate = new Slate(); slate.Set("map", parent.Map); slate.Set("targetMineable", targetMineable); slate.Set("worker", worker); if (QuestScriptDefOf.LongRangeMineralScannerLump.CanRun(slate)) { Quest quest = QuestUtility.GenerateQuestAndMakeAvailable(QuestScriptDefOf.LongRangeMineralScannerLump, slate); Find.LetterStack.ReceiveLetter(quest.name, quest.description, LetterDefOf.PositiveEvent, null, null, quest); } }
private static DiaOption RequestAICoreQuest(Map map, Faction faction, Pawn negotiator) { TaggedString taggedString = "RequestAICoreInformation".Translate(ThingDefOf.AIPersonaCore.label, 1500.ToString()); if (faction.PlayerGoodwill < 40) { DiaOption diaOption = new DiaOption(taggedString); diaOption.Disable("NeedGoodwill".Translate(40.ToString("F0"))); return(diaOption); } bool num = PlayerItemAccessibilityUtility.ItemStashHas(ThingDefOf.AIPersonaCore); Slate slate = new Slate(); slate.Set("points", StorytellerUtility.DefaultThreatPointsNow(Find.World)); slate.Set("asker", faction.leader); slate.Set("itemStashSingleThing", ThingDefOf.AIPersonaCore); bool flag = QuestScriptDefOf.OpportunitySite_ItemStash.CanRun(slate); if (num || !flag) { DiaOption diaOption2 = new DiaOption(taggedString); diaOption2.Disable("NoKnownAICore".Translate(1500)); return(diaOption2); } if (AmountSendableSilver(map) < 1500) { DiaOption diaOption3 = new DiaOption(taggedString); diaOption3.Disable("NeedSilverLaunchable".Translate(1500)); return(diaOption3); } return(new DiaOption(taggedString) { action = delegate { Quest quest = QuestUtility.GenerateQuestAndMakeAvailable(QuestScriptDefOf.OpportunitySite_ItemStash, slate); if (!quest.hidden) { QuestUtility.SendLetterQuestAvailable(quest); } TradeUtility.LaunchThingsOfType(ThingDefOf.Silver, 1500, map, null); Current.Game.GetComponent <GameComponent_OnetimeNotification>().sendAICoreRequestReminder = false; }, link = new DiaNode("RequestAICoreInformationResult".Translate(faction.leader).CapitalizeFirst()) { options = { OKToRoot(faction, negotiator) } } }); }
public static DiaNode RoyalHeirChangeCandidates(Faction faction, Pawn factionRepresentative, Pawn negotiator) { DiaNode diaNode = new DiaNode("ChooseHeir".Translate(negotiator.Named("HOLDER"))); RoyalTitleDef title = negotiator.royalty.GetCurrentTitle(faction); Pawn heir2 = negotiator.royalty.GetHeir(faction); foreach (Pawn item in PawnsFinder.AllMaps_FreeColonistsAndPrisonersSpawned) { DiaOption diaOption = new DiaOption(item.Name.ToStringFull); if (item == negotiator || item == heir2) { continue; } if (item.royalty != null) { RoyalTitleDef currentTitle = item.royalty.GetCurrentTitle(faction); if (currentTitle != null && currentTitle.seniority >= title.seniority) { continue; } } if (item.IsQuestLodger()) { continue; } Pawn heir = item; Action confirmedAct = delegate { QuestScriptDef changeRoyalHeir = QuestScriptDefOf.ChangeRoyalHeir; Slate slate = new Slate(); slate.Set("points", title.changeHeirQuestPoints); slate.Set("asker", factionRepresentative); slate.Set("titleHolder", negotiator); slate.Set("titleHeir", heir); slate.Set("titlePreviousHeir", negotiator.royalty.GetHeir(faction)); Quest quest = QuestUtility.GenerateQuestAndMakeAvailable(changeRoyalHeir, slate); if (!quest.hidden) { QuestUtility.SendLetterQuestAvailable(quest); } }; diaOption.link = RoyalHeirChangeConfirm(faction, negotiator, heir2, confirmedAct); diaNode.options.Add(diaOption); } DiaOption diaOption2 = new DiaOption("GoBack".Translate()); diaOption2.linkLateBind = ResetToRoot(faction, negotiator); diaNode.options.Add(diaOption2); return(diaNode); }
public static Thing SpawnTunnels(int hiveCount, Map map, bool spawnAnywhereIfNoGoodCell = false, bool ignoreRoofedRequirement = false, string questTag = null) { if (!InfestationCellFinder.TryFindCell(out var cell, map)) { if (!spawnAnywhereIfNoGoodCell) { return(null); } if (!RCellFinder.TryFindRandomCellNearTheCenterOfTheMapWith(delegate(IntVec3 x) { if (!x.Standable(map) || x.Fogged(map)) { return(false); } bool flag = false; int num = GenRadial.NumCellsInRadius(3f); for (int j = 0; j < num; j++) { IntVec3 c = x + GenRadial.RadialPattern[j]; if (c.InBounds(map)) { RoofDef roof = c.GetRoof(map); if (roof != null && roof.isThickRoof) { flag = true; break; } } } return(flag ? true : false); }, map, out cell)) { return(null); } } Thing thing = GenSpawn.Spawn(ThingMaker.MakeThing(ThingDefOf.TunnelHiveSpawner), cell, map, WipeMode.FullRefund); QuestUtility.AddQuestTag(thing, questTag); for (int i = 0; i < hiveCount - 1; i++) { cell = CompSpawnerHives.FindChildHiveLocation(thing.Position, map, ThingDefOf.Hive, ThingDefOf.Hive.GetCompProperties <CompProperties_SpawnerHives>(), ignoreRoofedRequirement, allowUnreachable: true); if (cell.IsValid) { thing = GenSpawn.Spawn(ThingMaker.MakeThing(ThingDefOf.TunnelHiveSpawner), cell, map, WipeMode.FullRefund); QuestUtility.AddQuestTag(thing, questTag); } } return(thing); }
public override IEnumerable <Gizmo> CompGetGizmosExtra() { foreach (Gizmo item in base.CompGetGizmosExtra()) { yield return(item); } if (ShowLoadingGizmos) { if (Autoloadable) { Command_Toggle command_Toggle = new Command_Toggle(); command_Toggle.defaultLabel = "CommandAutoloadTransporters".Translate(); command_Toggle.defaultDesc = "CommandAutoloadTransportersDesc".Translate(); command_Toggle.icon = AutoloadToggleTex; command_Toggle.isActive = () => autoload; command_Toggle.toggleAction = delegate { autoload = !autoload; if (autoload && !LoadingInProgressOrReadyToLaunch) { TransporterUtility.InitiateLoading(Gen.YieldSingle(Transporter)); } CheckAutoload(); }; yield return(command_Toggle); } if (!IsMissionShuttle) { Command_Action command_Action = new Command_Action(); command_Action.defaultLabel = "CommandSendShuttle".Translate(); command_Action.defaultDesc = "CommandSendShuttleDesc".Translate(); command_Action.icon = SendCommandTex; command_Action.alsoClickIfOtherInGroupClicked = false; command_Action.action = delegate { Send(); }; if (!LoadingInProgressOrReadyToLaunch || !AllRequiredThingsLoaded) { command_Action.Disable("CommandSendShuttleFailMissingRequiredThing".Translate()); } yield return(command_Action); } } foreach (Gizmo questRelatedGizmo in QuestUtility.GetQuestRelatedGizmos(parent)) { yield return(questRelatedGizmo); } }
public override void Tick() { if (!this.IsHashIntervalTick(177)) { return; } bool allDone = AllDone; if (!complete && allDone) { complete = true; QuestUtility.SendQuestTargetSignals(questTags, "MonumentCompleted", this.Named("SUBJECT")); } if (complete && !allDone) { QuestUtility.SendQuestTargetSignals(questTags, "MonumentDestroyed", this.Named("SUBJECT")); if (!base.Destroyed) { Destroy(); } } else { if (!allDone) { return; } if (AnyDisallowedBuilding) { ticksSinceDisallowedBuilding += 177; if (DisallowedBuildingTicksExpired) { Messages.Message("MessageMonumentDestroyedBecauseOfDisallowedBuilding".Translate(), new TargetInfo(base.Position, base.Map), MessageTypeDefOf.NegativeEvent); QuestUtility.SendQuestTargetSignals(questTags, "MonumentDestroyed", this.Named("SUBJECT")); if (!base.Destroyed) { Destroy(); } } } else { ticksSinceDisallowedBuilding = 0; } } }
public virtual void MakeLords(IncidentParms parms, List <Pawn> pawns) { Map map = (Map)parms.target; List <List <Pawn> > list = IncidentParmsUtility.SplitIntoGroups(pawns, parms.pawnGroups); int @int = Rand.Int; for (int i = 0; i < list.Count; i++) { List <Pawn> list2 = list[i]; Lord lord = LordMaker.MakeNewLord(parms.faction, MakeLordJob(parms, map, list2, @int), map, list2); lord.inSignalLeave = parms.inSignalEnd; QuestUtility.AddQuestTag(lord, parms.questTag); if (DebugViewSettings.drawStealDebug && parms.faction.HostileTo(Faction.OfPlayer)) { Log.Message("Market value threshold to start stealing (raiders=" + lord.ownedPawns.Count + "): " + StealAIUtility.StartStealingMarketValueThreshold(lord) + " (colony wealth=" + map.wealthWatcher.WealthTotal + ")"); } } }
private void CallShuttle(IntVec3 landingCell) { if (caller.Spawned) { QuestScriptDef permit_CallShuttle = QuestScriptDefOf.Permit_CallShuttle; Slate slate = new Slate(); slate.Set("asker", caller); slate.Set("map", caller.Map); slate.Set("landingCell", landingCell); slate.Set("permitFaction", calledFaction); QuestUtility.GenerateQuestAndMakeAvailable(permit_CallShuttle, slate); caller.royalty.GetPermit(def, calledFaction).Notify_Used(); if (!free) { caller.royalty.TryRemoveFavor(calledFaction, def.royalAid.favorCost); } } }
private void CallLaborers(Pawn pawn, Map map, Faction faction, bool free) { if (!faction.HostileTo(Faction.OfPlayer)) { QuestScriptDef permit_CallLaborers = QuestScriptDefOf.Permit_CallLaborers; Slate slate = new Slate(); slate.Set("map", map); slate.Set("laborersCount", def.royalAid.pawnCount); slate.Set("permitFaction", faction); slate.Set("laborersPawnKind", def.royalAid.pawnKindDef); slate.Set("laborersDurationDays", def.royalAid.aidDurationDays); QuestUtility.GenerateQuestAndMakeAvailable(permit_CallLaborers, slate); pawn.royalty.GetPermit(def, faction).Notify_Used(); if (!free) { pawn.royalty.TryRemoveFavor(faction, def.royalAid.favorCost); } } }
public static QuestPart_Delay MakeAndAddQuestTimeoutDelay(Quest quest, int delayTicks, WorldObject worldObject) { QuestPart_WorldObjectTimeout questPart_WorldObjectTimeout = new QuestPart_WorldObjectTimeout(); questPart_WorldObjectTimeout.delayTicks = delayTicks; questPart_WorldObjectTimeout.expiryInfoPart = "QuestExpiresIn".Translate(); questPart_WorldObjectTimeout.expiryInfoPartTip = "QuestExpiresOn".Translate(); questPart_WorldObjectTimeout.isBad = true; questPart_WorldObjectTimeout.outcomeCompletedSignalArg = QuestEndOutcome.Fail; questPart_WorldObjectTimeout.inSignalEnable = quest.InitiateSignal; quest.AddPart(questPart_WorldObjectTimeout); string text = "Quest" + quest.id + ".DelayingWorldObject"; QuestUtility.AddQuestTag(ref worldObject.questTags, text); questPart_WorldObjectTimeout.inSignalDisable = text + ".MapGenerated"; QuestPart_QuestEnd questPart_QuestEnd = new QuestPart_QuestEnd(); questPart_QuestEnd.inSignal = questPart_WorldObjectTimeout.OutSignalCompleted; quest.AddPart(questPart_QuestEnd); return(questPart_WorldObjectTimeout); }
public override void Destroy(DestroyMode mode = DestroyMode.Vanish) { if (!questTags.NullOrEmpty()) { bool flag = false; List <Thing> list = base.Map.listerThings.ThingsOfDef(def); for (int i = 0; i < list.Count; i++) { Hive hive; if ((hive = (list[i] as Hive)) != null && hive != this && hive.CompDormant.Awake && !hive.questTags.NullOrEmpty() && QuestUtility.AnyMatchingTags(hive.questTags, questTags)) { flag = true; break; } } if (!flag) { QuestUtility.SendQuestTargetSignals(questTags, "AllHivesDestroyed"); } } base.Destroy(mode); }
public void Kidnap(Pawn pawn, Pawn kidnapper) { if (kidnappedPawns.Contains(pawn)) { Log.Error("Tried to kidnap already kidnapped pawn " + pawn); return; } if (pawn.Faction == faction) { Log.Error("Tried to kidnap pawn with the same faction: " + pawn); return; } pawn.PreKidnapped(kidnapper); if (pawn.Spawned) { pawn.DeSpawn(); } kidnappedPawns.Add(pawn); if (!Find.WorldPawns.Contains(pawn)) { Find.WorldPawns.PassToWorld(pawn); if (!Find.WorldPawns.Contains(pawn)) { Log.Error("WorldPawns discarded kidnapped pawn."); kidnappedPawns.Remove(pawn); } } if (pawn.Faction == Faction.OfPlayer) { PawnDiedOrDownedThoughtsUtility.TryGiveThoughts(pawn, null, PawnDiedOrDownedThoughtsKind.Lost); BillUtility.Notify_ColonistUnavailable(pawn); if (kidnapper != null) { Find.LetterStack.ReceiveLetter("LetterLabelPawnsKidnapped".Translate(pawn.Named("PAWN")), "LetterPawnsKidnapped".Translate(pawn.Named("PAWN"), kidnapper.Faction.Named("FACTION")), LetterDefOf.NegativeEvent); } } QuestUtility.SendQuestTargetSignals(pawn.questTags, "Kidnapped", this.Named("SUBJECT"), kidnapper.Named("KIDNAPPER")); Find.GameEnder.CheckOrUpdateGameOver(); }
private void OnPostTitleChanged(Faction faction, RoyalTitleDef newTitle) { pawn.Notify_DisabledWorkTypesChanged(); pawn.needs?.AddOrRemoveNeedsAsAppropriate(); if (newTitle != null) { if (newTitle.disabledJoyKinds != null && pawn.jobs != null && RoyalTitleUtility.ShouldBecomeConceitedOnNewTitle(pawn)) { foreach (JoyKindDef disabledJoyKind in newTitle.disabledJoyKinds) { pawn.jobs.Notify_JoyKindDisabled(disabledJoyKind); } } for (int i = 0; i < newTitle.grantedAbilities.Count; i++) { pawn.abilities.GainAbility(newTitle.grantedAbilities[i]); } UpdateHighestTitleAchieved(faction, newTitle); } QuestUtility.SendQuestTargetSignals(pawn.questTags, "TitleChanged", pawn.Named("SUBJECT")); MeditationFocusTypeAvailabilityCache.ClearFor(pawn); }
public void MakeCeremonyFail() { QuestUtility.SendQuestTargetSignals(lord.questTags, "CeremonyFailed", lord.Named("SUBJECT")); }
public static List <Thing> SpawnCluster(IntVec3 center, Map map, MechClusterSketch sketch, bool dropInPods = true, bool canAssaultColony = false, string questTag = null) { List <Thing> spawnedThings = new List <Thing>(); Sketch.SpawnMode spawnMode = (!dropInPods) ? Sketch.SpawnMode.Normal : Sketch.SpawnMode.TransportPod; sketch.buildingsSketch.Spawn(map, center, Faction.OfMechanoids, Sketch.SpawnPosType.Unchanged, spawnMode, wipeIfCollides : false, clearEdificeWhereFloor : false, spawnedThings, sketch.startDormant, buildRoofsInstantly : false, null, delegate(IntVec3 spot, SketchEntity entity) { SketchThing sketchThing; if ((sketchThing = (entity as SketchThing)) != null && sketchThing.def != ThingDefOf.Wall && sketchThing.def != ThingDefOf.Barricade) { entity.SpawnNear(spot, map, 12f, Faction.OfMechanoids, spawnMode, wipeIfCollides: false, spawnedThings, sketch.startDormant); } }); float defendRadius = Mathf.Sqrt(sketch.buildingsSketch.OccupiedSize.x * sketch.buildingsSketch.OccupiedSize.x + sketch.buildingsSketch.OccupiedSize.z * sketch.buildingsSketch.OccupiedSize.z) / 2f + 6f; LordJob_MechanoidDefendBase lordJob_MechanoidDefendBase = null; lordJob_MechanoidDefendBase = ((!sketch.startDormant) ? ((LordJob_MechanoidDefendBase) new LordJob_MechanoidsDefend(spawnedThings, Faction.OfMechanoids, defendRadius, center, canAssaultColony, isMechCluster: true)) : ((LordJob_MechanoidDefendBase) new LordJob_SleepThenMechanoidsDefend(spawnedThings, Faction.OfMechanoids, defendRadius, center, canAssaultColony, isMechCluster: true))); Lord lord = LordMaker.MakeNewLord(Faction.OfMechanoids, lordJob_MechanoidDefendBase, map); QuestUtility.AddQuestTag(lord, questTag); bool flag = Rand.Chance(0.6f); float randomInRange = InitiationDelay.RandomInRange; int num = (int)(MechAssemblerInitialDelayDays.RandomInRange * 60000f); for (int i = 0; i < spawnedThings.Count; i++) { Thing thing = spawnedThings[i]; thing.TryGetComp <CompSpawnerPawn>()?.CalculateNextPawnSpawnTick(num); if (thing.TryGetComp <CompProjectileInterceptor>() != null) { lordJob_MechanoidDefendBase.AddThingToNotifyOnDefeat(thing); } if (flag) { CompInitiatable compInitiatable = thing.TryGetComp <CompInitiatable>(); if (compInitiatable != null) { compInitiatable.initiationDelayTicksOverride = (int)(60000f * randomInRange); } } Building b; if ((b = (thing as Building)) != null && IsBuildingThreat(b)) { lord.AddBuilding(b); } thing.SetFaction(Faction.OfMechanoids); } if (!sketch.pawns.NullOrEmpty()) { foreach (MechClusterSketch.Mech pawn2 in sketch.pawns) { IntVec3 result = pawn2.position + center; if (result.Standable(map) || CellFinder.TryFindRandomCellNear(result, map, 12, (IntVec3 x) => x.Standable(map), out result)) { Pawn pawn = PawnGenerator.GeneratePawn(pawn2.kindDef, Faction.OfMechanoids); CompCanBeDormant compCanBeDormant = pawn.TryGetComp <CompCanBeDormant>(); if (compCanBeDormant != null) { if (sketch.startDormant) { compCanBeDormant.ToSleep(); } else { compCanBeDormant.WakeUp(); } } lord.AddPawn(pawn); spawnedThings.Add(pawn); if (dropInPods) { ActiveDropPodInfo activeDropPodInfo = new ActiveDropPodInfo(); activeDropPodInfo.innerContainer.TryAdd(pawn, 1); activeDropPodInfo.openDelay = 60; activeDropPodInfo.leaveSlag = false; activeDropPodInfo.despawnPodBeforeSpawningThing = true; activeDropPodInfo.spawnWipeMode = WipeMode.Vanish; DropPodUtility.MakeDropPodAt(result, map, activeDropPodInfo); } else { GenSpawn.Spawn(pawn, result, map); } } } } foreach (Thing item in spawnedThings) { if (!sketch.startDormant) { item.TryGetComp <CompWakeUpDormant>()?.Activate(sendSignal: true, silent: true); } } return(spawnedThings); }
public void SetGuestStatus(Faction newHost, bool prisoner = false) { if (newHost != null) { Released = false; } if (newHost == HostFaction && prisoner == IsPrisoner) { return; } if (!prisoner && pawn.Faction.HostileTo(newHost)) { Log.Error("Tried to make " + pawn + " a guest of " + newHost + " but their faction " + pawn.Faction + " is hostile to " + newHost); return; } if (newHost != null && newHost == pawn.Faction && !prisoner) { Log.Error("Tried to make " + pawn + " a guest of their own faction " + pawn.Faction); return; } bool num = prisoner && (!IsPrisoner || HostFaction != newHost); isPrisonerInt = prisoner; Faction faction = hostFactionInt; hostFactionInt = newHost; Pawn obj = pawn; bool clearMentalState = prisoner; obj.ClearMind(newHost != null, clearInspiration: false, clearMentalState); if (num) { pawn.DropAndForbidEverything(); pawn.GetLord()?.Notify_PawnLost(pawn, PawnLostCondition.MadePrisoner); if (pawn.Drafted) { pawn.drafter.Drafted = false; } float x = pawn.RecruitDifficulty(Faction.OfPlayer); resistance = StartingResistancePerRecruitDifficultyCurve.Evaluate(x); resistance *= StartingResistanceFactorFromPopulationIntentCurve.Evaluate(StorytellerUtilityPopulation.PopulationIntent); resistance *= StartingResistanceRandomFactorRange.RandomInRange; if (pawn.royalty != null) { RoyalTitle mostSeniorTitle = pawn.royalty.MostSeniorTitle; if (mostSeniorTitle != null) { resistance *= mostSeniorTitle.def.recruitmentResistanceFactor; resistance += mostSeniorTitle.def.recruitmentResistanceOffset; } } resistance = GenMath.RoundRandom(resistance); } PawnComponentsUtility.AddAndRemoveDynamicComponents(pawn); pawn.health.surgeryBills.Clear(); if (pawn.ownership != null) { pawn.ownership.Notify_ChangedGuestStatus(); } ReachabilityUtility.ClearCacheFor(pawn); if (pawn.Spawned) { pawn.Map.mapPawns.UpdateRegistryForPawn(pawn); pawn.Map.attackTargetsCache.UpdateTarget(pawn); } AddictionUtility.CheckDrugAddictionTeachOpportunity(pawn); if (prisoner && pawn.playerSettings != null) { pawn.playerSettings.Notify_MadePrisoner(); } if (faction != hostFactionInt) { QuestUtility.SendQuestTargetSignals(pawn.questTags, "ChangedHostFaction", pawn.Named("SUBJECT"), hostFactionInt.Named("FACTION")); } }
public override IEnumerable <Gizmo> GetGizmos() { foreach (Gizmo gizmo in base.GetGizmos()) { yield return(gizmo); } if (!AllDone) { Command_Action command_Action = new Command_Action(); command_Action.defaultLabel = "CommandCancelMonumentMarker".Translate(); command_Action.defaultDesc = "CommandCancelMonumentMarkerDesc".Translate(); command_Action.icon = CancelCommandTex; command_Action.action = delegate { Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmCancelMonumentMarker".Translate(), delegate { QuestUtility.SendQuestTargetSignals(questTags, "MonumentCancelled", this.Named("SUBJECT")); RemovePossiblyRelatedBlueprints(); this.Uninstall(); }, destructive: true)); }; yield return(command_Action); } bool flag = false; foreach (SketchEntity entity in sketch.Entities) { SketchBuildable sketchBuildable = entity as SketchBuildable; if (sketchBuildable != null && !entity.IsSameSpawnedOrBlueprintOrFrame(entity.pos + base.Position, base.Map) && !entity.IsSpawningBlocked(entity.pos + base.Position, base.Map) && BuildCopyCommandUtility.FindAllowedDesignator(sketchBuildable.Buildable) != null) { flag = true; break; } } if (flag) { Command_Action command_Action2 = new Command_Action(); command_Action2.defaultLabel = "CommandPlaceBlueprints".Translate(); command_Action2.defaultDesc = "CommandPlaceBlueprintsDesc".Translate(); command_Action2.icon = PlaceBlueprintsCommandTex; MonumentMarker monumentMarker = default(MonumentMarker); ThingDef stuffLocal = default(ThingDef); command_Action2.action = delegate { IEnumerable <ThingDef> enumerable = AllowedStuffs(); if (!enumerable.Any()) { PlaceAllBlueprints(null); SoundDefOf.Click.PlayOneShotOnCamera(); } else if (enumerable.Count() == 1) { PlaceAllBlueprints(enumerable.First()); SoundDefOf.Click.PlayOneShotOnCamera(); } else { List <FloatMenuOption> list = new List <FloatMenuOption>(); bool flag4 = false; foreach (ThingDef item in enumerable) { if (base.Map.listerThings.ThingsOfDef(item).Count > 0) { flag4 = true; break; } } foreach (ThingDef item2 in enumerable) { monumentMarker = this; if (!flag4 || base.Map.listerThings.ThingsOfDef(item2).Count != 0) { stuffLocal = item2; list.Add(new FloatMenuOption(stuffLocal.LabelCap, delegate { monumentMarker.PlaceAllBlueprints(stuffLocal); }, item2)); } } Find.WindowStack.Add(new FloatMenu(list)); } }; yield return(command_Action2); } foreach (Gizmo questRelatedGizmo in QuestUtility.GetQuestRelatedGizmos(this)) { yield return(questRelatedGizmo); } if (Prefs.DevMode) { bool flag2 = false; foreach (SketchEntity entity2 in sketch.Entities) { if (!entity2.IsSameSpawned(entity2.pos + base.Position, base.Map) && !entity2.IsSpawningBlocked(entity2.pos + base.Position, base.Map)) { flag2 = true; break; } } if (flag2) { Command_Action command_Action3 = new Command_Action(); command_Action3.defaultLabel = "Dev: Build all"; command_Action3.action = delegate { DebugBuildAll(); SoundDefOf.Click.PlayOneShotOnCamera(); }; yield return(command_Action3); } } tmpUniqueBuildableDefs.Clear(); foreach (SketchEntity entity3 in sketch.Entities) { SketchBuildable sketchBuildable2 = entity3 as SketchBuildable; if (sketchBuildable2 != null && !entity3.IsSameSpawnedOrBlueprintOrFrame(entity3.pos + base.Position, base.Map) && tmpUniqueBuildableDefs.Add(new Pair <BuildableDef, ThingDef>(sketchBuildable2.Buildable, sketchBuildable2.Stuff))) { SketchTerrain sketchTerrain; if ((sketchTerrain = (sketchBuildable2 as SketchTerrain)) != null && sketchTerrain.treatSimilarAsSame) { TerrainDef terrain = sketchBuildable2.Buildable as TerrainDef; if (terrain.designatorDropdown != null) { Designator designator = BuildCopyCommandUtility.FindAllowedDesignatorRoot(sketchBuildable2.Buildable); if (designator != null) { yield return(designator); } } else { IEnumerable <TerrainDef> allDefs = DefDatabase <TerrainDef> .AllDefs; foreach (TerrainDef item3 in allDefs) { if (item3.BuildableByPlayer && item3.designatorDropdown == null) { bool flag3 = true; for (int i = 0; i < terrain.affordances.Count; i++) { if (!item3.affordances.Contains(terrain.affordances[i])) { flag3 = false; break; } } if (flag3) { Command command = BuildCopyCommandUtility.BuildCommand(item3, null, item3.label, item3.description, allowHotKey: false); if (command != null) { yield return(command); } } } } } } else { Command command2 = BuildCopyCommandUtility.BuildCommand(sketchBuildable2.Buildable, sketchBuildable2.Stuff, entity3.Label, sketchBuildable2.Buildable.description, allowHotKey: false); if (command2 != null) { yield return(command2); } } } } tmpUniqueBuildableDefs.Clear(); }
protected override IEnumerable <Toil> MakeNewToils() { this.FailOnDestroyedOrNull(TargetIndex.A); this.FailOnDestroyedOrNull(TargetIndex.B); this.FailOnAggroMentalStateAndHostile(TargetIndex.A); this.FailOn(delegate { if (job.def.makeTargetPrisoner) { if (!DropBed.ForPrisoners) { return(true); } } else if (DropBed.ForPrisoners != Takee.IsPrisoner) { return(true); } return(false); }); yield return(Toils_Bed.ClaimBedIfNonMedical(TargetIndex.B, TargetIndex.A)); AddFinishAction(delegate { if (job.def.makeTargetPrisoner && Takee.ownership.OwnedBed == DropBed && Takee.Position != RestUtility.GetBedSleepingSlotPosFor(Takee, DropBed)) { Takee.ownership.UnclaimBed(); } }); yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnDespawnedNullOrForbidden(TargetIndex.A).FailOnDespawnedNullOrForbidden(TargetIndex.B) .FailOn(() => job.def == JobDefOf.Arrest && !Takee.CanBeArrestedBy(pawn)) .FailOn(() => !pawn.CanReach(DropBed, PathEndMode.OnCell, Danger.Deadly)) .FailOn(() => (job.def == JobDefOf.Rescue || job.def == JobDefOf.Capture) && !Takee.Downed) .FailOnSomeonePhysicallyInteracting(TargetIndex.A)); Toil toil = new Toil(); toil.initAction = delegate { if (job.def.makeTargetPrisoner) { Pawn pawn = (Pawn)job.targetA.Thing; pawn.GetLord()?.Notify_PawnAttemptArrested(pawn); GenClamor.DoClamor(pawn, 10f, ClamorDefOf.Harm); if (job.def == JobDefOf.Arrest && !pawn.CheckAcceptArrest(base.pawn)) { base.pawn.jobs.EndCurrentJob(JobCondition.Incompletable); } if (!pawn.IsPrisoner) { QuestUtility.SendQuestTargetSignals(pawn.questTags, "Arrested", pawn.Named("SUBJECT")); } } }; yield return(toil); Toil toil2 = Toils_Haul.StartCarryThing(TargetIndex.A).FailOnNonMedicalBedNotOwned(TargetIndex.B, TargetIndex.A); toil2.AddPreInitAction(CheckMakeTakeeGuest); yield return(toil2); yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.Touch)); Toil toil3 = new Toil(); toil3.initAction = delegate { CheckMakeTakeePrisoner(); if (Takee.playerSettings == null) { Takee.playerSettings = new Pawn_PlayerSettings(Takee); } }; yield return(toil3); yield return(Toils_Reserve.Release(TargetIndex.B)); Toil toil4 = new Toil(); toil4.initAction = delegate { IntVec3 position = DropBed.Position; pawn.carryTracker.TryDropCarriedThing(position, ThingPlaceMode.Direct, out Thing _); if (!DropBed.Destroyed && (DropBed.OwnersForReading.Contains(Takee) || (DropBed.Medical && DropBed.AnyUnoccupiedSleepingSlot) || Takee.ownership == null)) { Takee.jobs.Notify_TuckedIntoBed(DropBed); if (Takee.RaceProps.Humanlike && job.def != JobDefOf.Arrest && !Takee.IsPrisonerOfColony) { Takee.relations.Notify_RescuedBy(pawn); } Takee.mindState.Notify_TuckedIntoBed(); } if (Takee.IsPrisonerOfColony) { LessonAutoActivator.TeachOpportunity(ConceptDefOf.PrisonerTab, Takee, OpportunityType.GoodToKnow); } }; toil4.defaultCompleteMode = ToilCompleteMode.Instant; yield return(toil4); }
public static void DoRecruit(Pawn recruiter, Pawn recruitee, float recruitChance, out string letterLabel, out string letter, bool useAudiovisualEffects = true, bool sendLetter = true) { letterLabel = null; letter = null; recruitChance = Mathf.Clamp01(recruitChance); string value = recruitee.LabelIndefinite(); if (recruitee.apparel != null && recruitee.apparel.LockedApparel != null) { List<Apparel> lockedApparel = recruitee.apparel.LockedApparel; for (int num = lockedApparel.Count - 1; num >= 0; num--) { recruitee.apparel.Unlock(lockedApparel[num]); } } if (recruitee.royalty != null) { foreach (RoyalTitle item in recruitee.royalty.AllTitlesForReading) { if (item.def.replaceOnRecruited != null) { recruitee.royalty.SetTitle(item.faction, item.def.replaceOnRecruited, grantRewards: false, rewardsOnlyForNewestTitle: false, sendLetter: false); } } } if (recruitee.guest != null) { recruitee.guest.SetGuestStatus(null); } bool flag = recruitee.Name != null; if (recruitee.Faction != recruiter.Faction) { recruitee.SetFaction(recruiter.Faction, recruiter); } if (recruitee.RaceProps.Humanlike) { if (useAudiovisualEffects) { letterLabel = "LetterLabelMessageRecruitSuccess".Translate() + ": " + recruitee.LabelShortCap; if (sendLetter) { Find.LetterStack.ReceiveLetter(letterLabel, "MessageRecruitSuccess".Translate(recruiter, recruitee, recruitChance.ToStringPercent(), recruiter.Named("RECRUITER"), recruitee.Named("RECRUITEE")), LetterDefOf.PositiveEvent, recruitee); } } TaleRecorder.RecordTale(TaleDefOf.Recruited, recruiter, recruitee); recruiter.records.Increment(RecordDefOf.PrisonersRecruited); if (recruitee.needs.mood != null) { recruitee.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.RecruitedMe, recruiter); } QuestUtility.SendQuestTargetSignals(recruitee.questTags, "Recruited", recruitee.Named("SUBJECT")); } else { if (useAudiovisualEffects) { if (!flag) { Messages.Message("MessageTameAndNameSuccess".Translate(recruiter.LabelShort, value, recruitChance.ToStringPercent(), recruitee.Name.ToStringFull, recruiter.Named("RECRUITER"), recruitee.Named("RECRUITEE")).AdjustedFor(recruitee), recruitee, MessageTypeDefOf.PositiveEvent); } else { Messages.Message("MessageTameSuccess".Translate(recruiter.LabelShort, value, recruitChance.ToStringPercent(), recruiter.Named("RECRUITER")), recruitee, MessageTypeDefOf.PositiveEvent); } if (recruiter.Spawned && recruitee.Spawned) { MoteMaker.ThrowText((recruiter.DrawPos + recruitee.DrawPos) / 2f, recruiter.Map, "TextMote_TameSuccess".Translate(recruitChance.ToStringPercent()), 8f); } } recruiter.records.Increment(RecordDefOf.AnimalsTamed); RelationsUtility.TryDevelopBondRelation(recruiter, recruitee, 0.01f); if (Rand.Chance(Mathf.Lerp(0.02f, 1f, recruitee.RaceProps.wildness)) || recruitee.IsWildMan()) { TaleRecorder.RecordTale(TaleDefOf.TamedAnimal, recruiter, recruitee); } if (PawnsFinder.AllMapsWorldAndTemporary_Alive.Count((Pawn p) => p.playerSettings != null && p.playerSettings.Master == recruiter) >= 5) { TaleRecorder.RecordTale(TaleDefOf.IncreasedMenagerie, recruiter, recruitee); } } if (recruitee.caller != null) { recruitee.caller.DoCall(); } }
protected virtual void GiveQuest(IncidentParms parms, QuestScriptDef questDef) { QuestUtility.SendLetterQuestAvailable(QuestUtility.GenerateQuestAndMakeAvailable(questDef, parms.points)); }
public override IEnumerable <Gizmo> GetGizmos() { foreach (Gizmo gizmo in base.GetGizmos()) { yield return(gizmo); } if (!AllDone) { Command_Action command_Action = new Command_Action(); command_Action.defaultLabel = "CommandCancelMonumentMarker".Translate(); command_Action.defaultDesc = "CommandCancelMonumentMarkerDesc".Translate(); command_Action.icon = CancelCommandTex; command_Action.action = delegate { Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmCancelMonumentMarker".Translate(), delegate { QuestUtility.SendQuestTargetSignals(questTags, "MonumentCancelled", this.Named("SUBJECT")); RemovePossiblyRelatedBlueprints(); this.Uninstall(); }, destructive: true)); }; yield return(command_Action); } bool flag = false; foreach (SketchEntity entity in sketch.Entities) { SketchBuildable sketchBuildable = entity as SketchBuildable; if (sketchBuildable != null && !entity.IsSameSpawnedOrBlueprintOrFrame(entity.pos + base.Position, base.Map) && !entity.IsSpawningBlocked(entity.pos + base.Position, base.Map) && BuildCopyCommandUtility.FindAllowedDesignator(sketchBuildable.Buildable) != null) { flag = true; break; } } if (flag) { Command_Action command_Action2 = new Command_Action(); command_Action2.defaultLabel = "CommandPlaceBlueprints".Translate(); command_Action2.defaultDesc = "CommandPlaceBlueprintsDesc".Translate(); command_Action2.icon = PlaceBlueprintsCommandTex; command_Action2.action = delegate { IEnumerable <ThingDef> enumerable = AllowedStuffs(); if (!enumerable.Any()) { PlaceAllBlueprints(null); SoundDefOf.Click.PlayOneShotOnCamera(); } else if (enumerable.Count() == 1) { PlaceAllBlueprints(enumerable.First()); SoundDefOf.Click.PlayOneShotOnCamera(); } else { ListFloatMenuOptions(enumerable, delegate(ThingDef stuff) { PlaceAllBlueprints(stuff); }); } }; yield return(command_Action2); } foreach (Gizmo questRelatedGizmo in QuestUtility.GetQuestRelatedGizmos(this)) { yield return(questRelatedGizmo); } if (Prefs.DevMode) { bool flag2 = false; foreach (SketchEntity entity2 in sketch.Entities) { if (!entity2.IsSameSpawned(entity2.pos + base.Position, base.Map) && !entity2.IsSpawningBlocked(entity2.pos + base.Position, base.Map)) { flag2 = true; break; } } if (flag2) { Command_Action command_Action3 = new Command_Action(); command_Action3.defaultLabel = "Dev: Build all"; command_Action3.action = delegate { DebugBuildAll(); SoundDefOf.Click.PlayOneShotOnCamera(); }; yield return(command_Action3); } if (AllDone && AnyDisallowedBuilding && !DisallowedBuildingTicksExpired) { Command_Action command_Action4 = new Command_Action(); command_Action4.defaultLabel = "Dev: Disallowed building ticks +6 hours"; command_Action4.action = delegate { ticksSinceDisallowedBuilding += 15000; }; yield return(command_Action4); } } tmpUniqueBuildableDefs.Clear(); foreach (SketchEntity entity3 in sketch.Entities) { SketchBuildable buildable = entity3 as SketchBuildable; if (buildable == null || entity3.IsSameSpawnedOrBlueprintOrFrame(entity3.pos + base.Position, base.Map) || !tmpUniqueBuildableDefs.Add(new Pair <BuildableDef, ThingDef>(buildable.Buildable, buildable.Stuff))) { continue; } SketchTerrain sketchTerrain; if ((sketchTerrain = buildable as SketchTerrain) != null && sketchTerrain.treatSimilarAsSame) { TerrainDef terrain = buildable.Buildable as TerrainDef; if (terrain.designatorDropdown != null) { Designator designator = BuildCopyCommandUtility.FindAllowedDesignatorRoot(buildable.Buildable); if (designator != null) { yield return(designator); } } else { IEnumerable <TerrainDef> allDefs = DefDatabase <TerrainDef> .AllDefs; foreach (TerrainDef item in allDefs) { if (!item.BuildableByPlayer || item.designatorDropdown != null) { continue; } bool flag3 = true; for (int i = 0; i < terrain.affordances.Count; i++) { if (!item.affordances.Contains(terrain.affordances[i])) { flag3 = false; break; } } if (flag3) { Command command = BuildCopyCommandUtility.BuildCommand(item, null, item.label, item.description, allowHotKey: false); if (command != null) { yield return(command); } } } } } else { Command command2 = BuildCopyCommandUtility.BuildCommand(buildable.Buildable, buildable.Stuff, entity3.LabelCap, buildable.Buildable.description, allowHotKey: false); if (command2 != null) { yield return(command2); } } Command_Action placeBlueprintsCommand = GetPlaceBlueprintsCommand(buildable); if (placeBlueprintsCommand != null) { yield return(placeBlueprintsCommand); } } tmpUniqueBuildableDefs.Clear(); }
public void CheckOrUpdateGameOver() { if (Find.TickManager.TicksGame < 300) { return; } if (ShipCountdown.CountingDown) { gameEnding = false; return; } List <Map> maps = Find.Maps; for (int i = 0; i < maps.Count; i++) { if (maps[i].mapPawns.FreeColonistsSpawnedOrInPlayerEjectablePodsCount >= 1) { gameEnding = false; return; } } for (int j = 0; j < maps.Count; j++) { List <Pawn> allPawnsSpawned = maps[j].mapPawns.AllPawnsSpawned; for (int k = 0; k < allPawnsSpawned.Count; k++) { if (allPawnsSpawned[k].carryTracker != null) { Pawn pawn = allPawnsSpawned[k].carryTracker.CarriedThing as Pawn; if (pawn != null && pawn.IsFreeColonist) { gameEnding = false; return; } } } } List <Caravan> caravans = Find.WorldObjects.Caravans; for (int l = 0; l < caravans.Count; l++) { if (IsPlayerControlledWithFreeColonist(caravans[l])) { gameEnding = false; return; } } List <TravelingTransportPods> travelingTransportPods = Find.WorldObjects.TravelingTransportPods; for (int m = 0; m < travelingTransportPods.Count; m++) { if (travelingTransportPods[m].PodsHaveAnyFreeColonist) { gameEnding = false; return; } } if (QuestUtility.TotalBorrowedColonistCount() <= 0 && !gameEnding) { gameEnding = true; ticksToGameOver = 400; } }
public static void DrawCharacterCard(Rect rect, Pawn pawn, Action randomizeCallback = null, Rect creationRect = default(Rect)) { bool creationMode = randomizeCallback != null; GUI.BeginGroup(creationMode ? creationRect : rect); Rect rect2 = new Rect(0f, 0f, 300f, 30f); NameTriple nameTriple = pawn.Name as NameTriple; if (creationMode && nameTriple != null) { Rect rect3 = new Rect(rect2); rect3.width *= 0.333f; Rect rect4 = new Rect(rect2); rect4.width *= 0.333f; rect4.x += rect4.width; Rect rect5 = new Rect(rect2); rect5.width *= 0.333f; rect5.x += rect4.width * 2f; string name = nameTriple.First; string name2 = nameTriple.Nick; string name3 = nameTriple.Last; DoNameInputRect(rect3, ref name, 12); if (nameTriple.Nick == nameTriple.First || nameTriple.Nick == nameTriple.Last) { GUI.color = new Color(1f, 1f, 1f, 0.5f); } DoNameInputRect(rect4, ref name2, 16); GUI.color = Color.white; DoNameInputRect(rect5, ref name3, 12); if (nameTriple.First != name || nameTriple.Nick != name2 || nameTriple.Last != name3) { pawn.Name = new NameTriple(name, string.IsNullOrEmpty(name2) ? name : name2, name3); } TooltipHandler.TipRegionByKey(rect3, "FirstNameDesc"); TooltipHandler.TipRegionByKey(rect4, "ShortIdentifierDesc"); TooltipHandler.TipRegionByKey(rect5, "LastNameDesc"); } else { rect2.width = 999f; Text.Font = GameFont.Medium; Widgets.Label(rect2, pawn.Name.ToStringFull); Text.Font = GameFont.Small; } if (randomizeCallback != null) { Rect rect6 = new Rect(creationRect.width - 24f - 100f, 0f, 100f, rect2.height); if (Widgets.ButtonText(rect6, "Randomize".Translate())) { SoundDefOf.Tick_Tiny.PlayOneShotOnCamera(); randomizeCallback(); } UIHighlighter.HighlightOpportunity(rect6, "RandomizePawn"); } if (creationMode) { Widgets.InfoCardButton(creationRect.width - 24f, 0f, pawn); } else if (!pawn.health.Dead) { float num = PawnCardSize(pawn).x - 85f; if (pawn.IsFreeColonist && pawn.Spawned) { Rect rect7 = new Rect(num, 0f, 30f, 30f); if (Mouse.IsOver(rect7)) { TooltipHandler.TipRegion(rect7, PawnBanishUtility.GetBanishButtonTip(pawn)); } if (Widgets.ButtonImage(rect7, TexButton.Banish)) { if (pawn.Downed) { Messages.Message("MessageCantBanishDownedPawn".Translate(pawn.LabelShort, pawn).AdjustedFor(pawn), pawn, MessageTypeDefOf.RejectInput, historical: false); } else { PawnBanishUtility.ShowBanishPawnConfirmationDialog(pawn); } } num -= 40f; } if (pawn.IsColonist) { Rect rect8 = new Rect(num, 0f, 30f, 30f); TooltipHandler.TipRegionByKey(rect8, "RenameColonist"); if (Widgets.ButtonImage(rect8, TexButton.Rename)) { Find.WindowStack.Add(new Dialog_NamePawn(pawn)); } num -= 40f; } if (pawn.IsFreeColonist && !pawn.IsQuestLodger() && pawn.royalty != null && pawn.royalty.AllTitlesForReading.Count > 0) { Rect rect9 = new Rect(num, 0f, 30f, 30f); TooltipHandler.TipRegionByKey(rect9, "RenounceTitle"); if (Widgets.ButtonImage(rect9, TexButton.RenounceTitle)) { FloatMenuUtility.MakeMenu(pawn.royalty.AllTitlesForReading, (RoyalTitle title) => "RenounceTitle".Translate() + ": " + "TitleOfFaction".Translate(title.def.GetLabelCapFor(pawn), title.faction.GetCallLabel()), (RoyalTitle title) => delegate { RoyalTitleUtility.FindLostAndGainedPermits(title.def, null, out List <RoyalTitlePermitDef> _, out List <RoyalTitlePermitDef> lostPermits); StringBuilder stringBuilder = new StringBuilder(); if (lostPermits.Count > 0) { stringBuilder.AppendLine("RenounceTitleWillLoosePermits".Translate(pawn.Named("PAWN")) + ":"); foreach (RoyalTitlePermitDef item2 in lostPermits) { stringBuilder.AppendLine("- " + item2.LabelCap + " (" + FirstTitleWithPermit(item2).GetLabelFor(pawn) + ")"); } stringBuilder.AppendLine(); } if (!title.faction.def.renounceTitleMessage.NullOrEmpty()) { stringBuilder.AppendLine(title.faction.def.renounceTitleMessage); } Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("RenounceTitleDescription".Translate(pawn.Named("PAWN"), "TitleOfFaction".Translate(title.def.GetLabelCapFor(pawn), title.faction.GetCallLabel()).Named("TITLE"), stringBuilder.ToString().TrimEndNewlines().Named("EFFECTS")), delegate { pawn.royalty.SetTitle(title.faction, null, grantRewards: false); }, destructive: true)); }); } num -= 40f; } } List <GenUI.AnonymousStackElement> stackElements = new List <GenUI.AnonymousStackElement>(); Text.Font = GameFont.Small; string text = pawn.MainDesc(writeFaction: false); Vector2 vector = Text.CalcSize(text); Rect rect10 = new Rect(0f, 45f, vector.x + 5f, 24f); Widgets.Label(rect10, text); float height = Text.CalcHeight(text, rect10.width); Rect rect11 = new Rect(rect10.x, rect10.y, rect10.width, height); if (Mouse.IsOver(rect11)) { TooltipHandler.TipRegion(rect11, () => pawn.ageTracker.AgeTooltipString, 6873641); } float num2 = 0f; if (pawn.Faction != null && !pawn.Faction.def.hidden) { float num3 = Text.CalcSize(pawn.Faction.Name).x + 22f + 15f; stackElements.Add(new GenUI.AnonymousStackElement { drawer = delegate(Rect r) { Rect rect23 = new Rect(r.x, r.y, r.width, r.height); Color color7 = GUI.color; GUI.color = StackElementBackground; GUI.DrawTexture(rect23, BaseContent.WhiteTex); GUI.color = color7; Widgets.DrawHighlightIfMouseover(rect23); Rect rect24 = new Rect(r.x, r.y, r.width, r.height); Rect position4 = new Rect(r.x + 1f, r.y + 1f, 20f, 20f); GUI.color = pawn.Faction.Color; GUI.DrawTexture(position4, pawn.Faction.def.FactionIcon); GUI.color = color7; Widgets.Label(new Rect(rect24.x + rect24.height + 5f, rect24.y, rect24.width - 10f, rect24.height), pawn.Faction.Name); if (Widgets.ButtonInvisible(rect23)) { if (creationMode) { Find.WindowStack.Add(new Dialog_FactionDuringLanding()); } else { Find.MainTabsRoot.SetCurrentTab(MainButtonDefOf.Factions); } } if (Mouse.IsOver(rect23)) { TipSignal tip6 = new TipSignal(() => "Faction".Translate() + "\n\n" + "FactionDesc".Translate(pawn.Named("PAWN")) + "\n\n" + "ClickToViewFactions".Translate(), pawn.Faction.loadID * 37); TooltipHandler.TipRegion(rect23, tip6); } }, width = num3 }); num2 += num3; } bool flag = false; float num4 = rect.width - vector.x - 10f; tmpExtraFactions.Clear(); QuestUtility.GetExtraFactionsFromQuestParts(pawn, tmpExtraFactions); foreach (ExtraFaction tmpExtraFaction in tmpExtraFactions) { ExtraFaction localExtraFaction = tmpExtraFaction; string factionName = localExtraFaction.faction.Name; bool drawExtraFactionIcon = localExtraFaction.factionType == ExtraFactionType.HomeFaction; float num5 = ElementWidth(); if (flag || num2 + num5 >= num4) { factionName = "..."; num5 = ElementWidth(); flag = true; } stackElements.Add(new GenUI.AnonymousStackElement { drawer = delegate(Rect r) { Rect rect20 = new Rect(r.x, r.y, r.width, r.height); Rect rect21 = drawExtraFactionIcon ? rect20 : r; Color color6 = GUI.color; GUI.color = StackElementBackground; GUI.DrawTexture(rect21, BaseContent.WhiteTex); GUI.color = color6; Widgets.DrawHighlightIfMouseover(rect21); if (drawExtraFactionIcon) { Rect rect22 = new Rect(r.x, r.y, r.width, r.height); Rect position3 = new Rect(r.x + 1f, r.y + 1f, 20f, 20f); GUI.color = localExtraFaction.faction.Color; GUI.DrawTexture(position3, localExtraFaction.faction.def.FactionIcon); GUI.color = color6; Widgets.Label(new Rect(rect22.x + rect22.height + 5f, rect22.y, rect22.width - 10f, rect22.height), factionName); } else { Widgets.Label(new Rect(r.x + 5f, r.y, r.width - 10f, r.height), factionName); } if (Widgets.ButtonInvisible(rect20)) { Find.MainTabsRoot.SetCurrentTab(MainButtonDefOf.Factions); } if (Mouse.IsOver(rect21)) { TipSignal tip5 = new TipSignal(() => localExtraFaction.factionType.GetLabel().CapitalizeFirst() + "\n\n" + "ExtraFactionDesc".Translate(pawn.Named("PAWN")) + "\n\n" + "ClickToViewFactions".Translate(), localExtraFaction.faction.loadID ^ 0x738AC053); TooltipHandler.TipRegion(rect21, tip5); } }, width = num5 }); num2 += num5; float ElementWidth() { return(Text.CalcSize(factionName).x + (float)(drawExtraFactionIcon ? 22 : 0) + 15f); } } GenUI.DrawElementStack(new Rect(vector.x + 10f, 45f, 999f, 24f), 22f, stackElements, delegate(Rect r, GenUI.AnonymousStackElement obj) { obj.drawer(r); }, (GenUI.AnonymousStackElement obj) => obj.width, 4f, 5f, allowOrderOptimization: false); stackElements.Clear(); float curY = 72f; if (pawn.royalty != null && pawn.royalty.AllTitlesForReading.Count > 0) { foreach (RoyalTitle title2 in pawn.royalty.AllTitlesForReading) { RoyalTitle localTitle = title2; string titleLabel = localTitle.def.GetLabelCapFor(pawn) + " (" + pawn.royalty.GetFavor(localTitle.faction) + ")"; stackElements.Add(new GenUI.AnonymousStackElement { drawer = delegate(Rect r) { Color color5 = GUI.color; Rect rect18 = new Rect(r.x, r.y, r.width + 22f, r.height); GUI.color = StackElementBackground; GUI.DrawTexture(rect18, BaseContent.WhiteTex); GUI.color = color5; int favor = pawn.royalty.GetFavor(localTitle.faction); if (Mouse.IsOver(rect18)) { Widgets.DrawHighlight(rect18); } Rect rect19 = new Rect(r.x, r.y, r.width + 22f, r.height); Rect position2 = new Rect(r.x + 1f, r.y + 1f, 20f, 20f); GUI.color = title2.faction.Color; GUI.DrawTexture(position2, localTitle.faction.def.FactionIcon); GUI.color = color5; Widgets.Label(new Rect(rect19.x + rect19.height + 5f, rect19.y, rect19.width - 10f, rect19.height), titleLabel); if (Widgets.ButtonInvisible(rect18)) { Find.WindowStack.Add(new Dialog_InfoCard(localTitle.def, localTitle.faction)); } if (Mouse.IsOver(rect18)) { TipSignal tip4 = new TipSignal(() => GetTitleTipString(pawn, localTitle.faction, localTitle, favor), (int)curY * 37); TooltipHandler.TipRegion(rect18, tip4); } }, width = Text.CalcSize(titleLabel).x + 15f }); } } QuestUtility.AppendInspectStringsFromQuestParts(delegate(string str, Quest quest) { stackElements.Add(new GenUI.AnonymousStackElement { drawer = delegate(Rect r) { Color color4 = GUI.color; GUI.color = StackElementBackground; GUI.DrawTexture(r, BaseContent.WhiteTex); GUI.color = color4; DoQuestLine(r, str, quest); }, width = GetQuestLineSize(str, quest).x }); }, pawn, out int _); curY += GenUI.DrawElementStack(new Rect(0f, curY, rect.width - 5f, 50f), 22f, stackElements, delegate(Rect r, GenUI.AnonymousStackElement obj) { obj.drawer(r); }, (GenUI.AnonymousStackElement obj) => obj.width).height; if (stackElements.Any()) { curY += 10f; } Rect leftRect = new Rect(0f, curY, 250f, 355f); Rect position = new Rect(leftRect.xMax, curY, 258f, 355f); GUI.BeginGroup(leftRect); curY = 0f; Pawn pawnLocal = pawn; List <Ability> abilities = (from a in pawn.abilities.abilities orderby a.def.level, a.def.EntropyGain select a).ToList(); int numSections = abilities.Any() ? 5 : 4; float num6 = (float)Enum.GetValues(typeof(BackstorySlot)).Length * 22f; if (pawn.story != null && pawn.story.title != null) { num6 += 22f; } List <LeftRectSection> list = new List <LeftRectSection>(); LeftRectSection item = new LeftRectSection { rect = new Rect(0f, 0f, leftRect.width, num6), drawer = delegate(Rect sectionRect) { float num12 = sectionRect.y; Text.Font = GameFont.Small; foreach (BackstorySlot value6 in Enum.GetValues(typeof(BackstorySlot))) { Backstory backstory = pawn.story.GetBackstory(value6); if (backstory != null) { Rect rect14 = new Rect(sectionRect.x, num12, leftRect.width, 22f); if (Mouse.IsOver(rect14)) { Widgets.DrawHighlight(rect14); } if (Mouse.IsOver(rect14)) { TooltipHandler.TipRegion(rect14, backstory.FullDescriptionFor(pawn).Resolve()); } Text.Anchor = TextAnchor.MiddleLeft; string str2 = (value6 == BackstorySlot.Adulthood) ? "Adulthood".Translate() : "Childhood".Translate(); Widgets.Label(rect14, str2 + ":"); Text.Anchor = TextAnchor.UpperLeft; Rect rect15 = new Rect(rect14); rect15.x += 90f; rect15.width -= 90f; string str3 = backstory.TitleCapFor(pawn.gender); Widgets.Label(rect15, str3.Truncate(rect15.width)); num12 += rect14.height; } } if (pawn.story != null && pawn.story.title != null) { Rect rect16 = new Rect(sectionRect.x, num12, leftRect.width, 22f); Text.Anchor = TextAnchor.MiddleLeft; Widgets.Label(rect16, "Current".Translate() + ":"); Text.Anchor = TextAnchor.UpperLeft; Rect rect17 = new Rect(rect16); rect17.x += 90f; rect17.width -= 90f; Widgets.Label(rect17, pawn.story.title); num12 += rect16.height; } } }; list.Add(item); num6 = 30f; WorkTags disabledTags = pawn.CombinedDisabledWorkTags; List <WorkTags> disabledTagsList = WorkTagsFrom(disabledTags).ToList(); bool allowWorkTagVerticalLayout = false; GenUI.StackElementWidthGetter <WorkTags> workTagWidthGetter = (WorkTags tag) => Text.CalcSize(tag.LabelTranslated().CapitalizeFirst()).x + 10f; if (disabledTags == WorkTags.None) { num6 += 22f; } else { disabledTagsList.Sort(delegate(WorkTags a, WorkTags b) { int num11 = GetWorkTypeDisableCauses(pawn, a).Any((object c) => c is RoyalTitleDef) ? 1 : (-1); int value5 = GetWorkTypeDisableCauses(pawn, b).Any((object c) => c is RoyalTitleDef) ? 1 : (-1); return(num11.CompareTo(value5)); }); num6 += GenUI.DrawElementStack(new Rect(0f, 0f, leftRect.width - 5f, leftRect.height), 22f, disabledTagsList, delegate { }, workTagWidthGetter, 4f, 5f, allowOrderOptimization: false).height; num6 += 12f; allowWorkTagVerticalLayout = (GenUI.DrawElementStackVertical(new Rect(0f, 0f, rect.width, leftRect.height / (float)numSections), 22f, disabledTagsList, delegate { }, workTagWidthGetter).width <= leftRect.width); } item = new LeftRectSection { rect = new Rect(0f, 0f, leftRect.width, num6), drawer = delegate(Rect sectionRect) { Text.Font = GameFont.Medium; float currentY3 = sectionRect.y; Widgets.Label(new Rect(sectionRect.x, currentY3, 200f, 30f), "IncapableOf".Translate(pawn)); currentY3 += 30f; Text.Font = GameFont.Small; if (disabledTags == WorkTags.None) { GUI.color = Color.gray; Rect rect13 = new Rect(sectionRect.x, currentY3, leftRect.width, 24f); if (Mouse.IsOver(rect13)) { Widgets.DrawHighlight(rect13); } Widgets.Label(rect13, "None".Translate()); TooltipHandler.TipRegionByKey(rect13, "None"); } else { GenUI.StackElementDrawer <WorkTags> drawer = delegate(Rect r, WorkTags tag) { Color color3 = GUI.color; GUI.color = StackElementBackground; GUI.DrawTexture(r, BaseContent.WhiteTex); GUI.color = color3; GUI.color = GetDisabledWorkTagLabelColor(pawn, tag); if (Mouse.IsOver(r)) { Widgets.DrawHighlight(r); } Widgets.Label(new Rect(r.x + 5f, r.y, r.width - 10f, r.height), tag.LabelTranslated().CapitalizeFirst()); if (Mouse.IsOver(r)) { TooltipHandler.TipRegion(tip: new TipSignal(() => GetWorkTypeDisabledCausedBy(pawnLocal, tag) + "\n" + GetWorkTypesDisabledByWorkTag(tag), (int)currentY3 * 32), rect: r); } }; if (allowWorkTagVerticalLayout) { GenUI.DrawElementStackVertical(new Rect(sectionRect.x, currentY3, leftRect.width - 5f, leftRect.height / (float)numSections), 22f, disabledTagsList, drawer, workTagWidthGetter); } else { GenUI.DrawElementStack(new Rect(sectionRect.x, currentY3, leftRect.width - 5f, leftRect.height / (float)numSections), 22f, disabledTagsList, drawer, workTagWidthGetter, 5f); } } GUI.color = Color.white; } }; list.Add(item); num6 = 30f; List <Trait> traits = pawn.story.traits.allTraits; num6 = ((traits != null && traits.Count != 0) ? (num6 + GenUI.DrawElementStack(new Rect(0f, 0f, leftRect.width - 5f, leftRect.height), 22f, pawn.story.traits.allTraits, delegate { }, (Trait trait) => Text.CalcSize(trait.LabelCap).x + 10f).height) : (num6 + 22f)); num6 += 12f; item = new LeftRectSection { rect = new Rect(0f, 0f, leftRect.width, num6), drawer = delegate(Rect sectionRect) { Text.Font = GameFont.Medium; float currentY2 = sectionRect.y; Widgets.Label(new Rect(sectionRect.x, currentY2, 200f, 30f), "Traits".Translate()); currentY2 += 30f; Text.Font = GameFont.Small; if (traits == null || traits.Count == 0) { Color color = GUI.color; GUI.color = Color.gray; Rect rect12 = new Rect(sectionRect.x, currentY2, leftRect.width, 24f); if (Mouse.IsOver(rect12)) { Widgets.DrawHighlight(rect12); } Widgets.Label(rect12, "None".Translate()); currentY2 += rect12.height + 2f; TooltipHandler.TipRegionByKey(rect12, "None"); GUI.color = color; } else { GenUI.DrawElementStack(new Rect(sectionRect.x, currentY2, leftRect.width - 5f, leftRect.height / (float)numSections), 22f, pawn.story.traits.allTraits, delegate(Rect r, Trait trait) { Color color2 = GUI.color; GUI.color = StackElementBackground; GUI.DrawTexture(r, BaseContent.WhiteTex); GUI.color = color2; if (Mouse.IsOver(r)) { Widgets.DrawHighlight(r); } Widgets.Label(new Rect(r.x + 5f, r.y, r.width - 10f, r.height), trait.LabelCap); if (Mouse.IsOver(r)) { TooltipHandler.TipRegion(tip: new TipSignal(() => trait.TipString(pawn), (int)currentY2 * 37), rect: r); } }, (Trait trait) => Text.CalcSize(trait.LabelCap).x + 10f); } } }; list.Add(item); if (abilities.Any()) { num6 = 30f; num6 += GenUI.DrawElementStack(new Rect(0f, 0f, leftRect.width - 5f, leftRect.height), 32f, abilities, delegate { }, (Ability abil) => 32f).height; item = new LeftRectSection { rect = new Rect(0f, 0f, leftRect.width, num6), drawer = delegate(Rect sectionRect) { Text.Font = GameFont.Medium; float currentY = sectionRect.y; Widgets.Label(new Rect(sectionRect.x, currentY, 200f, 30f), "Abilities".Translate(pawn)); currentY += 30f; Text.Font = GameFont.Small; GenUI.DrawElementStack(new Rect(sectionRect.x, currentY, leftRect.width - 5f, leftRect.height), 32f, abilities, delegate(Rect r, Ability abil) { GUI.DrawTexture(r, BaseContent.ClearTex); if (Mouse.IsOver(r)) { Widgets.DrawHighlight(r); } if (Widgets.ButtonImage(r, abil.def.uiIcon, doMouseoverSound: false)) { Find.WindowStack.Add(new Dialog_InfoCard(abil.def)); } if (Mouse.IsOver(r)) { TipSignal tip = new TipSignal(() => abil.def.GetTooltip() + "\n\n" + "ClickToLearnMore".Translate(), (int)currentY * 37); TooltipHandler.TipRegion(r, tip); } }, (Ability abil) => 32f); GUI.color = Color.white; } }; list.Add(item); } float num7 = leftRect.height / (float)list.Count; float num8 = 0f; for (int i = 0; i < list.Count; i++) { LeftRectSection value = list[i]; if (value.rect.height > num7) { num8 += value.rect.height - num7; value.calculatedSize = value.rect.height; } else { value.calculatedSize = num7; } list[i] = value; } bool flag2 = false; float num9 = 0f; if (num8 > 0f) { LeftRectSection value2 = list[0]; float num10 = value2.rect.height + 12f; num8 -= value2.calculatedSize - num10; value2.calculatedSize = num10; list[0] = value2; } while (num8 > 0f) { bool flag3 = true; for (int j = 0; j < list.Count; j++) { LeftRectSection value3 = list[j]; if (value3.calculatedSize - value3.rect.height > 0f) { value3.calculatedSize -= 1f; num8 -= 1f; flag3 = false; } list[j] = value3; } if (!flag3) { continue; } for (int k = 0; k < list.Count; k++) { LeftRectSection value4 = list[k]; if (k > 0) { value4.calculatedSize = Mathf.Max(value4.rect.height, num7); } else { value4.calculatedSize = value4.rect.height + 22f; } num9 += value4.calculatedSize; list[k] = value4; } flag2 = true; break; } if (flag2) { Widgets.BeginScrollView(new Rect(0f, 0f, leftRect.width, leftRect.height), ref leftRectScrollPos, new Rect(0f, 0f, leftRect.width - 16f, num9)); } curY = 0f; for (int l = 0; l < list.Count; l++) { LeftRectSection leftRectSection = list[l]; leftRectSection.drawer(new Rect(0f, curY, leftRect.width, leftRectSection.rect.height)); curY += leftRectSection.calculatedSize; } if (flag2) { Widgets.EndScrollView(); } GUI.EndGroup(); GUI.BeginGroup(position); SkillUI.DrawSkillsOf(mode: (Current.ProgramState != ProgramState.Playing) ? SkillUI.SkillDrawMode.Menu : SkillUI.SkillDrawMode.Gameplay, p: pawn, offset: new Vector2(0f, 0f)); GUI.EndGroup(); GUI.EndGroup(); RoyalTitleDef FirstTitleWithPermit(RoyalTitlePermitDef permitDef) { //return title.faction.def.RoyalTitlesAwardableInSeniorityOrderForReading.First((RoyalTitleDef t) => t.permits != null && t.permits.Contains(permitDef)); Log.Message("Todo:>>>>"); return(default);
public override StateGraph CreateGraph() { StateGraph stateGraph = new StateGraph(); if (!ModLister.RoyaltyInstalled) { Log.ErrorOnce("Bestowing ceremony is a Royalty-specific game system. If you want to use this code please check ModLister.RoyaltyInstalled before calling it. See rules on the Ludeon forum for more info.", 3454535); return(stateGraph); } LordToil_Wait lordToil_Wait = new LordToil_Wait(); stateGraph.AddToil(lordToil_Wait); LordToil_Wait lordToil_Wait2 = new LordToil_Wait(); stateGraph.AddToil(lordToil_Wait2); LordToil_Wait lordToil_Wait3 = new LordToil_Wait(); stateGraph.AddToil(lordToil_Wait3); LordToil_BestowingCeremony_MoveInPlace lordToil_BestowingCeremony_MoveInPlace = new LordToil_BestowingCeremony_MoveInPlace(spotCell, target); stateGraph.AddToil(lordToil_BestowingCeremony_MoveInPlace); LordToil_BestowingCeremony_Wait lordToil_BestowingCeremony_Wait = new LordToil_BestowingCeremony_Wait(target); stateGraph.AddToil(lordToil_BestowingCeremony_Wait); exitToil = ((shuttle == null) ? ((LordToil) new LordToil_ExitMap(LocomotionUrgency.Walk)) : ((LordToil) new LordToil_EnterShuttleOrLeave(shuttle, LocomotionUrgency.Walk, canDig: true, interruptCurrentJob: true))); stateGraph.AddToil(exitToil); Transition transition = new Transition(lordToil_Wait, lordToil_Wait2); transition.AddTrigger(new Trigger_Custom((TriggerSignal signal) => signal.type == TriggerSignalType.Tick && bestower.Spawned)); stateGraph.AddTransition(transition); Transition transition2 = new Transition(lordToil_Wait2, lordToil_BestowingCeremony_MoveInPlace); transition2.AddTrigger(new Trigger_TicksPassed(600)); stateGraph.AddTransition(transition2); Transition transition3 = new Transition(lordToil_BestowingCeremony_MoveInPlace, lordToil_BestowingCeremony_Wait); transition3.AddTrigger(new Trigger_Custom((TriggerSignal signal) => signal.type == TriggerSignalType.Tick && bestower.Position == spotCell)); stateGraph.AddTransition(transition3); Transition transition4 = new Transition(lordToil_BestowingCeremony_Wait, exitToil); transition4.AddTrigger(new Trigger_TicksPassed(30000)); transition4.AddPostAction(new TransitionAction_Custom((Action) delegate { QuestUtility.SendQuestTargetSignals(lord.questTags, "CeremonyExpired", lord.Named("SUBJECT")); })); stateGraph.AddTransition(transition4); Transition transition5 = new Transition(lordToil_BestowingCeremony_Wait, lordToil_Wait3); transition5.AddTrigger(new Trigger_Memo("CeremonyFinished")); transition5.AddPostAction(new TransitionAction_Custom((Action) delegate { QuestUtility.SendQuestTargetSignals(lord.questTags, "CeremonyDone", lord.Named("SUBJECT")); })); stateGraph.AddTransition(transition5); Transition transition6 = new Transition(lordToil_Wait3, exitToil); transition6.AddTrigger(new Trigger_TicksPassed(600)); stateGraph.AddTransition(transition6); Transition transition7 = new Transition(lordToil_BestowingCeremony_MoveInPlace, exitToil); transition7.AddSource(lordToil_BestowingCeremony_Wait); transition7.AddTrigger(new Trigger_BecamePlayerEnemy()); stateGraph.AddTransition(transition7); Transition transition8 = new Transition(lordToil_BestowingCeremony_MoveInPlace, exitToil); transition8.AddSource(lordToil_BestowingCeremony_Wait); transition8.AddTrigger(new Trigger_Custom((TriggerSignal signal) => signal.type == TriggerSignalType.Tick && bestower.Spawned && !bestower.CanReach(spotCell, PathEndMode.OnCell, Danger.Deadly))); transition8.AddPostAction(new TransitionAction_Custom((Action) delegate { Messages.Message("MessageBestowingSpotUnreachable".Translate(), bestower, MessageTypeDefOf.NegativeEvent); QuestUtility.SendQuestTargetSignals(lord.questTags, "CeremonyFailed", lord.Named("SUBJECT")); })); stateGraph.AddTransition(transition8); if (!questEndedSignal.NullOrEmpty()) { Transition transition9 = new Transition(lordToil_BestowingCeremony_MoveInPlace, exitToil); transition9.AddSource(lordToil_BestowingCeremony_Wait); transition9.AddSource(lordToil_Wait); transition9.AddSource(lordToil_Wait2); transition9.AddTrigger(new Trigger_Signal(questEndedSignal)); stateGraph.AddTransition(transition9); } return(stateGraph); }