Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
        public void RegisterCustomBoard(CustomBoardTrigger boardTrigger)
        {
            if (boardTrigger == null)
            {
                throw new ArgumentNullException(nameof(boardTrigger));
            }

            this.CustomBoardController.RegisterBoardTrigger(boardTrigger);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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);
            }
        }
Exemplo n.º 5
0
        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);
            }
        }
Exemplo n.º 6
0
 public void RegisterCustomBoard(CustomBoardTrigger boardTrigger)
 {
     this.CustomBoardController.RegisterBoardTrigger(boardTrigger);
 }
Exemplo n.º 7
0
 private static bool ShouldShowIndicator(CustomBoardTrigger boardTrigger)
 {
     return(boardTrigger.ShowIndicator &&
            boardTrigger.IsUnlocked() &&
            IsOfferingQuest(boardTrigger));
 }
Exemplo n.º 8
0
 private static bool OnlyUnlockedSpecialOrdersBoard(CustomBoardTrigger boardTrigger)
 {
     return(boardTrigger.BoardType == BoardType.SpecialOrders && boardTrigger.IsUnlocked());
 }
Exemplo n.º 9
0
 private static bool OnlyUnlockedQuestsBoard(CustomBoardTrigger boardTrigger)
 {
     return(boardTrigger.BoardType == BoardType.Quests && boardTrigger.IsUnlocked());
 }