Ejemplo n.º 1
0
        public static QuestRequirements Parse(int id, WZProperty data, QuestState state)
        {
            QuestRequirements result = new QuestRequirements();

            result.Id    = id;
            result.State = state;
            result.Jobs  = data.Resolve("job")?.Children.Select(c => Convert.ToInt32(((IWZPropertyVal)c).GetValue()));                        // job
            result.RequiredFieldsEntered = data.Resolve("fieldEnter")?.Children.Select(c => Convert.ToInt32(((IWZPropertyVal)c).GetValue())); // fieldEnter
            result.StartTime             = (DateTime?)ResolveDateTimeString(data.ResolveForOrNull <string>("start"));
            result.EndTime      = (DateTime?)ResolveDateTimeString(data.ResolveForOrNull <string>("end"));
            result.LevelMinimum = data.ResolveFor <byte>("lvmin");
            result.LevelMaximum = data.ResolveFor <byte>("lvmax");
            result.Mobs         = data.Resolve("mob")?.Children.Select(c => Requirement.Parse(c));
            result.Items        = data.Resolve("item")?.Children.Select(c => Requirement.Parse(c));
            result.Quests       = data.Resolve("quest")?.Children.Select(c => Requirement.Parse(c));
            result.NPCId        = data.ResolveFor <int>("npc");
            string dayOfWeek = data.ResolveForOrNull <string>("dayOfWeek");

            result.OnDayOfWeek             = ResolveDayOfWeek(dayOfWeek != null ? new string[] { dayOfWeek } : data.Resolve("dayOfWeek")?.Children?.Select(c => c.NameWithoutExtension).ToArray()); // dayOfWeek
            result.AnyPet                  = data.ResolveFor <bool>("allPet");
            result.Pet                     = data.Resolve("pet")?.Children.Select(c => Requirement.Parse(c));
            result.PetTamenessMin          = data.ResolveFor <int>("pettamenessmin");
            result.DayByDay                = data.ResolveFor <bool>("dayByDay");
            result.NormalAutoStart         = data.ResolveFor <bool>("normalAutoStart");
            result.MinimumMonsterBookCards = data.ResolveFor <int>("mbmin");
            result.RepeatInterval          = data.ResolveFor <int>("interval");

            return(result);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
        public static QuestRequirements[] Parse(WZProperty data)
        {
            if (data == null)
            {
                return(null);
            }
            int id = int.Parse(data.NameWithoutExtension);
            QuestRequirements onStart    = QuestRequirements.Parse(id, data.Resolve("0"), QuestState.Start);
            QuestRequirements onComplete = QuestRequirements.Parse(id, data.Resolve("1"), QuestState.Complete);

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