Example #1
0
        public static QuestRewards Parse(int id, WZProperty data, QuestState state)
        {
            if (data == null)
            {
                return(null);
            }

            QuestRewards result = new QuestRewards();

            result.Id         = id;
            result.State      = state;
            result.Message    = data.ResolveForOrNull <string>("message");
            result.Exp        = data.ResolveFor <int>("exp");
            result.BuffItemId = data.ResolveFor <int>("buffItemId");
            result.charmExp   = data.ResolveFor <int>("charmEXP");
            result.SenseEXP   = data.ResolveFor <int>("senseEXP");
            result.Fame       = data.ResolveFor <int>("pop");
            result.PetSkill   = data.ResolveFor <int>("petskill");
            result.Items      = data.Resolve("item")?.Children.Select(c => ItemReward.Parse(c));
            result.Skills     = data.Resolve("skill")?.Children.Select(c => SkillReward.Parse(c));
            result.Meso       = data.ResolveFor <int>("money");
            result.MoveToMap  = (uint?)data.ResolveFor <int>("transferField");

            return(result);
        }
Example #2
0
        public static Quest GetQuest(WZProperty questWz, int questId)
        {
            QuestRewards[]      rewards      = QuestRewards.Parse(questWz.Resolve($"Act/{questId}")) ?? new QuestRewards[0];
            QuestRequirements[] requirements = QuestRequirements.Parse(questWz.Resolve($"Check/{questId}")) ?? new QuestRequirements[0];
            Quest quest = Quest.Parse(questWz.Resolve($"QuestInfo/{questId}"));

            if (quest == null)
            {
                return(null);
            }

            quest.RequirementToComplete = requirements?.Where(b => b != null && b.State == QuestState.Complete).FirstOrDefault();
            quest.RequirementToStart    = requirements?.Where(b => b != null && b.State == QuestState.Start).FirstOrDefault();
            quest.RewardOnStart         = rewards?.Where(b => b != null && b.State == QuestState.Start).FirstOrDefault();
            quest.RewardOnComplete      = rewards?.Where(b => b != null && b.State == QuestState.Complete).FirstOrDefault();
            if (questWz.FileContainer.Collection is MSPackageCollection)
            {
                MSPackageCollection collection = (MSPackageCollection)questWz.FileContainer.Collection;
                if (collection.AvailableOnCompleteTable.ContainsKey(quest.Id))
                {
                    quest.QuestsAvailableOnComplete = collection.AvailableOnCompleteTable[quest.Id];
                }
            }

            return(quest);
        }
Example #3
0
        public static QuestRewards[] Parse(WZProperty data)
        {
            if (data == null)
            {
                return(null);
            }
            int          id         = int.Parse(data.NameWithoutExtension);
            QuestRewards onStart    = QuestRewards.Parse(id, data.Resolve("0"), QuestState.Start);
            QuestRewards onComplete = QuestRewards.Parse(id, data.Resolve("1"), QuestState.Complete);

            return(new QuestRewards[] { onStart, onComplete });
        }