public static void Postfix(KingdomEventUIView ___m_KingdomEventView, bool __state) { if (__state) { EventBus.RaiseEvent((IKingdomUIStartSpendTimeEvent h) => h.OnStartSpendTimeEvent(___m_KingdomEventView.Blueprint)); KingdomTaskEvent kingdomTaskEvent = ___m_KingdomEventView?.Task; EventBus.RaiseEvent((IKingdomUICloseEventWindow h) => h.OnClose()); kingdomTaskEvent?.Start(false); if (kingdomTaskEvent == null) { return; } if (kingdomTaskEvent.IsFinished || kingdomTaskEvent.AssignedLeader == null || ___m_KingdomEventView.Blueprint.NeedToVisitTheThroneRoom) { return; } kingdomTaskEvent.Event.Resolve(kingdomTaskEvent); if (___m_KingdomEventView.RulerTimeRequired <= 0) { return; } foreach (UnitEntityData unitEntityData in player.AllCharacters) { RestController.ApplyRest(unitEntityData.Descriptor); } new KingdomTimelineManager().MaybeUpdateTimeline(); } }
public void mod_OnStart() { if (!KingmakerPatchSettings.KingdomEvents.InstantComplete) { this.source_OnStart(); return; } KingdomEventUIView previousView = this.alias_m_KingdomEventView; EventBus.RaiseEvent((IKingdomUIStartSpendTimeEvent h) => h.OnStartSpendTimeEvent(previousView.Blueprint)); KingdomTaskEvent task = previousView.Task; EventBus.RaiseEvent((IKingdomUICloseEventWindow h) => h.OnClose()); task?.Start(false); if (task == null || task.IsFinished || task.AssignedLeader == null || previousView.Blueprint.NeedToVisitTheThroneRoom) { return; } task.Event.Resolve(task); if (previousView.RulerTimeRequired <= 0) { return; } foreach (UnitEntityData unitEntityData in Kingmaker.Game.Instance.Player.AllCharacters) { RestController.ApplyRest(unitEntityData.Descriptor); } }