private void RegisterBoards(IContentPack pack, List <CustomBoardData> customBoards) { if (customBoards == null) { return; } CustomBoardTrigger trigger; foreach (var boardData in customBoards) { trigger = new CustomBoardTrigger() { BoardName = boardData.BoardName, BoardType = boardData.BoardType, LocationName = boardData.Location, Tile = boardData.Tile, IndicatorOffset = boardData.IndicatorOffset, ShowIndicator = boardData.ShowIndicator, Texture = this.LoadTexture(pack, boardData.Texture), }; if (boardData.UnlockWhen != null) { trigger.unlockConditionFunc = () => this.ConditionManager.CheckConditions(boardData.UnlockWhen, new object()); } this.CustomBoardController.RegisterBoardTrigger(trigger); } }
public void RegisterCustomBoard(CustomBoardTrigger boardTrigger) { if (boardTrigger == null) { throw new ArgumentNullException(nameof(boardTrigger)); } this.CustomBoardController.RegisterBoardTrigger(boardTrigger); }
public void RegisterBoardTrigger(CustomBoardTrigger trigger) { if (QuestFrameworkMod.Instance.Status != State.LAUNCHING) { throw new InvalidOperationException($"Cannot register new board trigger when in state `{QuestFrameworkMod.Instance.Status}`."); } this._customBoardTriggers.Value.Add(trigger); }
private IClickableMenu CreateBoardMenu(CustomBoardTrigger boardTrigger) { switch (boardTrigger.BoardType) { case BoardType.Quests: return(new CustomBoard(boardTrigger.BoardName, boardTrigger.Texture)); case BoardType.SpecialOrders: return(new CustomOrderBoard( !string.IsNullOrEmpty(boardTrigger.BoardName) ? $"QF:{boardTrigger.BoardName}" : "", boardTrigger.Texture)); default: QuestFrameworkMod.Instance.Monitor.Log($"Unknown board type `{boardTrigger.BoardName}` for board `{boardTrigger.BoardName}`.", LogLevel.Error); return(null); } }
private static bool IsOfferingQuest(CustomBoardTrigger boardTrigger) { if (!Context.IsWorldReady) { return(false); } switch (boardTrigger.BoardType) { case BoardType.Quests: return(CustomBoard.todayQuests.ContainsKey(boardTrigger.BoardName) && CustomBoard.todayQuests[boardTrigger.BoardName] != null && CustomBoard.todayQuests[boardTrigger.BoardName].accepted.Value == false); case BoardType.SpecialOrders: string orderType = $"QF:{boardTrigger.BoardName}"; return(Game1.player.team.availableSpecialOrders.Where(so => so.orderType.Value == orderType).Any() && !Game1.player.team.acceptedSpecialOrderTypes.Contains(orderType) && !Game1.eventUp); default: return(false); } }
public void RegisterCustomBoard(CustomBoardTrigger boardTrigger) { this.CustomBoardController.RegisterBoardTrigger(boardTrigger); }
private static bool ShouldShowIndicator(CustomBoardTrigger boardTrigger) { return(boardTrigger.ShowIndicator && boardTrigger.IsUnlocked() && IsOfferingQuest(boardTrigger)); }
private static bool OnlyUnlockedSpecialOrdersBoard(CustomBoardTrigger boardTrigger) { return(boardTrigger.BoardType == BoardType.SpecialOrders && boardTrigger.IsUnlocked()); }
private static bool OnlyUnlockedQuestsBoard(CustomBoardTrigger boardTrigger) { return(boardTrigger.BoardType == BoardType.Quests && boardTrigger.IsUnlocked()); }