public AdventureBegins(ISpecialModEvents modEvents, IModEvents gameEvents, IContentLoader contentLoader, IMonitor monitor) : base() { this.modEvents = modEvents; this.gameEvents = gameEvents; this.contentLoader = contentLoader; this.monitor = monitor; }
public AdventureBegins(ISpecialModEvents modEvents, IQuestFrameworkEvents questEvents, IModEvents gameEvents, IContentLoader contentLoader, Config config, IMonitor monitor) : base() { this.modEvents = modEvents; this.questEvents = questEvents; this.gameEvents = gameEvents; this.contentLoader = contentLoader; this.config = config; this.monitor = monitor; }
internal static void Setup(HarmonyInstance harmony, ISpecialModEvents events) { harmony.Patch( original: AccessTools.Method(typeof(GameLocation), "draw"), postfix: new HarmonyMethod(typeof(GameLocationDrawPatch), nameof(GameLocationDrawPatch.Postfix)) ); GameLocationDrawPatch.events = events as SpecialModEvents; }
private void GameLoop_GameLaunched(object sender, GameLaunchedEventArgs e) { // Setup third party mod compatibility bridge TPMC.Setup(this.Helper.ModRegistry); // Mod's services and drivers this.SpecialEvents = new SpecialModEvents(); this.DialogueDriver = new DialogueDriver(this.Helper.Events); this.HintDriver = new HintDriver(this.Helper.Events); this.StuffDriver = new StuffDriver(this.Helper.Data, this.Monitor); this.contentLoader = new ContentLoader(this.Helper.Content, this.Helper.ContentPacks, this.ModManifest.UniqueID, "assets", this.Helper.DirectoryPath, this.Monitor); this.companionHud = new CompanionDisplay(this.config, this.contentLoader); this.companionManager = new CompanionManager(this.DialogueDriver, this.HintDriver, this.companionHud, this.config, this.Monitor); this.StuffDriver.RegisterEvents(this.Helper.Events); // Harmony HarmonyInstance harmony = HarmonyInstance.Create("Purrplingcat.NpcAdventure"); Patches.SpouseReturnHomePatch.Setup(harmony); Patches.CompanionSayHiPatch.Setup(harmony, this.companionManager); Patches.GameLocationDrawPatch.Setup(harmony, this.SpecialEvents); }
public RecruitedState(CompanionStateMachine stateMachine, IModEvents events, ISpecialModEvents specialEvents, IMonitor monitor) : base(stateMachine, events, monitor) { this.BuffManager = new BuffManager(stateMachine.Companion, stateMachine.CompanionManager.Farmer, stateMachine.ContentLoader, this.monitor); this.SpecialEvents = specialEvents; }
/// <summary> /// Companion initializator. Call it after saved game is loaded /// </summary> /// <param name="loader"></param> /// <param name="gameEvents"></param> /// <param name="reflection"></param> public void InitializeCompanions(IContentLoader loader, IModEvents gameEvents, ISpecialModEvents specialEvents, IReflectionHelper reflection) { Dictionary <string, string> dispositions = loader.Load <Dictionary <string, string> >("Data/CompanionDispositions"); foreach (string npcName in dispositions.Keys) { NPC companion = Game1.getCharacterFromName(npcName, true); if (companion == null) { throw new Exception($"Can't find NPC with name '{npcName}'"); } CompanionStateMachine csm = new CompanionStateMachine(this, companion, new CompanionMetaData(dispositions[npcName]), loader, reflection, this.monitor); Dictionary <StateFlag, ICompanionState> stateHandlers = new Dictionary <StateFlag, ICompanionState>() { [StateFlag.RESET] = new ResetState(csm, gameEvents, this.monitor), [StateFlag.AVAILABLE] = new AvailableState(csm, gameEvents, this.monitor), [StateFlag.RECRUITED] = new RecruitedState(csm, gameEvents, specialEvents, this.monitor), [StateFlag.UNAVAILABLE] = new UnavailableState(csm, gameEvents, this.monitor), }; csm.Setup(stateHandlers); this.PossibleCompanions.Add(npcName, csm); } this.monitor.Log($"Initalized {this.PossibleCompanions.Count} companions.", LogLevel.Info); }
public RecruitedState(CompanionStateMachine stateMachine, IModEvents events, ISpecialModEvents specialEvents, IMonitor monitor) : base(stateMachine, events, monitor) { this.BuffManager = new BuffManager(stateMachine.Companion, stateMachine.CompanionManager.Farmer, stateMachine.ContentLoader, this.monitor); this.SpecialEvents = specialEvents; this.TimeToBye = 2200; // Companions auto-dismiss at 10pm, except married (see end of Entry() method) }
internal void RegisterEvents(ISpecialModEvents events) { events.MailboxOpen += this.Events_MailboxOpen; }
/// <summary> /// Companion initializator. Call it after saved game is loaded /// </summary> /// <param name="loader"></param> /// <param name="gameEvents"></param> /// <param name="reflection"></param> public void InitializeCompanions(IContentLoader loader, IModEvents gameEvents, ISpecialModEvents specialEvents, IReflectionHelper reflection) { Dictionary <string, string> dispositions = loader.LoadData <string, string>("Data/CompanionDispositions"); foreach (string npcName in dispositions.Keys) { NPC companion = Game1.getCharacterFromName(npcName, true); if (companion == null) { this.monitor.Log($"Unable to initialize companion `{npcName}`, because this NPC cannot be found in the game. " + "Are you trying to add a custom NPC as a companion? Check the mod which adds this NPC into the game. " + "Don't report this as a bug to NPC Adventures unless it's a vanilla game NPC.", LogLevel.Error); continue; } CompanionStateMachine csm = new CompanionStateMachine(this, companion, new CompanionMetaData(dispositions[npcName]), loader, reflection, this.monitor); Dictionary <StateFlag, ICompanionState> stateHandlers = new Dictionary <StateFlag, ICompanionState>() { [StateFlag.RESET] = new ResetState(csm, gameEvents, this.monitor), [StateFlag.AVAILABLE] = new AvailableState(csm, gameEvents, this.monitor), [StateFlag.RECRUITED] = new RecruitedState(csm, gameEvents, specialEvents, this.monitor), [StateFlag.UNAVAILABLE] = new UnavailableState(csm, gameEvents, this.monitor), }; csm.Setup(stateHandlers); this.PossibleCompanions.Add(npcName, csm); } this.monitor.Log($"Initalized {this.PossibleCompanions.Count} companions.", LogLevel.Info); }
/// <summary> /// Companion initializator. Call it after saved game is loaded /// </summary> /// <param name="loader"></param> /// <param name="gameEvents"></param> /// <param name="reflection"></param> public void InitializeCompanions(IContentLoader loader, IModEvents gameEvents, ISpecialModEvents specialEvents, IReflectionHelper reflection) { Dictionary <string, string> dispositions = loader.LoadData <string, string>("Data/CompanionDispositions"); foreach (string npcName in dispositions.Keys) { CompanionStateMachine csm = new CompanionStateMachine(npcName, this, new CompanionMetaData(dispositions[npcName]), loader, reflection, this.monitor); Dictionary <StateFlag, ICompanionState> stateHandlers = new Dictionary <StateFlag, ICompanionState>() { [StateFlag.RESET] = new ResetState(csm, gameEvents, this.monitor), [StateFlag.AVAILABLE] = new AvailableState(csm, gameEvents, this.monitor), [StateFlag.RECRUITED] = new RecruitedState(csm, gameEvents, specialEvents, this.monitor), [StateFlag.UNAVAILABLE] = new UnavailableState(csm, gameEvents, this.monitor), }; csm.Setup(stateHandlers); this.PossibleCompanions.Add(npcName, csm); } this.monitor.Log($"Initalized {this.PossibleCompanions.Count} companions.", LogLevel.Info); }
public QuestScenario(ISpecialModEvents events, IContentLoader contentLoader, IMonitor monitor) { this.events = events; this.contentLoader = contentLoader; this.monitor = monitor; }