Exemple #1
0
        private void ModEvents_QuestCompleted(object sender, IQuestCompletedArgs e)
        {
            int id = StoryHelper.ResolveId(e.Quest.id.Value);

            if (id == 4 && !Game1.player.hasOrWillReceiveMail(DONE_LETTER_KEY))
            {
                Game1.addMailForTomorrow(DONE_LETTER_KEY);
            }
        }
Exemple #2
0
        private void Events_ReloadObjective(object sender, IQuestReloadObjectiveArgs e)
        {
            if (e.Quest.questType.Value != StoryHelper.ADVENTURE_QUEST_TYPE)
            {
                return; // Update only mod's kind of quests
            }
            int    id   = StoryHelper.ResolveId(e.Quest.id.Value);
            string type = this.StoryHelper.GetQuestType(id);

            if (type.Equals(TYPE_RECRUITMENT))
            {
                // Update current objective for recruitment quest type (example: 2/10 companions recruited)
                var ps = this.GameMaster.Data.GetPlayerState();

                e.Quest.currentObjective = this.contentLoader.LoadString($"Strings/Strings:questObjective.recruitment", ps.recruited.Count, e.Quest.completionString.Value);
            }
        }
Exemple #3
0
        private void CheckForComplete(Quest quest, IGameMasterMessage completionMessage = null)
        {
            bool completed;

            switch (this.StoryHelper.GetQuestType(StoryHelper.ResolveId(quest.id.Value)))
            {
            case TYPE_RECRUITMENT:
                // Is recruitment quest done? Check via compare count of current recruited companions stat with goal from quest
                var ps = this.GameMaster.Data.GetPlayerState();
                completed = int.TryParse(quest.completionString.Value, out int goal) && ps.recruited.Count >= goal;
                break;

            default:
                // Is basic quest done? Check via completion string
                completed = quest.completionString.Value.Equals(completionMessage?.Name);
                break;
            }

            if (completed)
            {
                quest.questComplete();
            }
        }