Example #1
0
        public Quest GetSocialQuest(FactionFile.SocialGroups socialGroup, int factionId, Genders gender, int rep, int level)
        {
#if UNITY_EDITOR    // Reload every time when in editor
            LoadQuestLists();
#endif
            List <QuestData> socialQuests;
            if (social.TryGetValue(socialGroup, out socialQuests))
            {
                List <QuestData> pool = new List <QuestData>();
                foreach (QuestData quest in socialQuests)
                {
                    if (((quest.minReq < 10 && quest.minReq <= level) || rep >= quest.minReq) &&
                        (quest.membership == 'N' ||
                         (quest.membership == 'M' && gender == Genders.Male) ||
                         (quest.membership == 'F' && gender == Genders.Female)))
                    {
                        if (!quest.adult || DaggerfallUnity.Settings.PlayerNudity)
                        {
                            pool.Add(quest);
                        }
                    }
                }
                return(SelectQuest(pool, factionId));
            }
            return(null);
        }
Example #2
0
        public DaggerfallQuestOfferWindow(IUserInterfaceManager uiManager, StaticNPC.NPCData npc, FactionFile.SocialGroups socialGroup)
            : base(uiManager)
        {
            questorNPC       = npc;
            this.socialGroup = socialGroup;

            // Remove potential questor from pool after quest has been offered
            TalkManager.Instance.RemoveNpcQuestor(npc.nameSeed);

            // Clear background
            ParentPanel.BackgroundColor = Color.clear;
        }
        private void ParseQuestList(Table questsTable, string questsPath = "")
        {
            for (int i = 0; i < questsTable.RowCount; i++)
            {
                QuestData questData = new QuestData();
                questData.path = questsPath;
                string minRep = questsTable.GetValue("minRep", i);
                if (minRep.EndsWith("X"))
                {
                    questData.unitWildC = true;
                    minRep = minRep.Replace("X", "0");
                }
                int d = 0;
                if (int.TryParse(minRep, out d))
                {
                    questData.name       = questsTable.GetValue("name", i);
                    questData.group      = questsTable.GetValue("group", i);
                    questData.membership = questsTable.GetValue("membership", i)[0];
                    questData.minRep     = d;

                    // Is the group a guild group?
                    if (Enum.IsDefined(typeof(FactionFile.GuildGroups), questData.group))
                    {
                        FactionFile.GuildGroups guildGroup = (FactionFile.GuildGroups)Enum.Parse(typeof(FactionFile.GuildGroups), questData.group);
                        List <QuestData>        guildQuests;
                        if (!guilds.TryGetValue(guildGroup, out guildQuests))
                        {
                            guildQuests = new List <QuestData>();
                            guilds.Add(guildGroup, guildQuests);
                        }
                        guildQuests.Add(questData);
                    }
                    // Is the group a social group?
                    else if (Enum.IsDefined(typeof(FactionFile.SocialGroups), questData.group))
                    {
                        FactionFile.SocialGroups socialGroup = (FactionFile.SocialGroups)Enum.Parse(typeof(FactionFile.SocialGroups), questData.group);
                        List <QuestData>         socialQuests;
                        if (!social.TryGetValue(socialGroup, out socialQuests))
                        {
                            socialQuests = new List <QuestData>();
                            social.Add(socialGroup, socialQuests);
                        }
                        socialQuests.Add(questData);
                    }
                    // Is this a quest initialised when a new game is started?
                    else if (questData.group == InitAtGameStart)
                    {
                        init.Add(questData);
                    }
                    // else TODO other groups
                }
            }
        }
        public Quest GetSocialQuest(FactionFile.SocialGroups socialGroup, int factionId, int rep)
        {
#if UNITY_EDITOR    // Reload every time when in editor
            LoadQuestLists();
#endif
            List <QuestData> socialQuests;
            if (social.TryGetValue(socialGroup, out socialQuests))
            {
                List <QuestData> pool = new List <QuestData>();
                foreach (QuestData quest in socialQuests)
                {
                    if (rep >= quest.minRep && (!quest.unitWildC || rep < quest.minRep + 10))
                    {
                        pool.Add(quest);
                    }
                }
                return(SelectQuest(pool, factionId));
            }
            return(null);
        }
        public DaggerfallQuestOfferWindow(IUserInterfaceManager uiManager, StaticNPC npc, FactionFile.SocialGroups socialGroup)
            : base(uiManager)
        {
            questorNPC = npc;
            TalkManager.Instance.RemoveMerchantQuestor(npc.Data.nameSeed); // Remove potential questor from pool after quest has been offered
            // TODO - assemble quest lists for more social groups
            switch (socialGroup)
            {
            default:
            case FactionFile.SocialGroups.Merchants:
                questsFilename = tempMerchantsQuestsFilename;
                break;

            case FactionFile.SocialGroups.Nobility:
                questsFilename = tempNobilityQuestsFilename;
                break;
            }
            // Clear background
            ParentPanel.BackgroundColor = Color.clear;
        }