public static ILookup <int, ItemNameInfo> GetNameLookup(WZProperty stringFile)
        {
            ILookup <int, ItemNameInfo> itemNameLookup = null;

            if (stringFile.FileContainer.Collection.VersionCache.TryGetValue("itemNameLookup", out object itemNameLookupCached))
            {
                itemNameLookup = (ILookup <int, ItemNameInfo>)itemNameLookupCached;
            }
            else
            {
                itemNameLookup = (stringFile.Resolve("Eqp.img/Eqp") ?? stringFile.Resolve("Item/Eqp")).Children
                                 .SelectMany(c => c.Children)
                                 //Etc
                                 .Concat((stringFile.Resolve("Etc.img/Etc") ?? stringFile.Resolve("Item.img/Etc")).Children)
                                 //Cash
                                 .Concat((stringFile.Resolve("Cash.img") ?? stringFile.Resolve("Item.img/Cash")).Children)
                                 //Ins
                                 .Concat((stringFile.Resolve("Ins.img") ?? stringFile.Resolve("Item.img/Ins")).Children)
                                 //Consume
                                 .Concat((stringFile.Resolve("Consume.img") ?? stringFile.Resolve("Item.img/Con")).Children)
                                 //Pet
                                 .Concat((stringFile.Resolve("Pet.img") ?? stringFile.Resolve("Item.img/Pet")).Children)
                                 .ToLookup(c => int.Parse(c.NameWithoutExtension), c => ItemNameInfo.Parse(c));
                stringFile.FileContainer.Collection.VersionCache.AddOrUpdate("itemNameLookup", itemNameLookup, (a, b) => b);
            }

            return(itemNameLookup);
        }
 public static ItemNameInfo Parse(WZProperty c)
 => new ItemNameInfo()
 {
     Id   = int.Parse(c.NameWithoutExtension),
     Name = c.ResolveForOrNull <string>("name"),
     Desc = string.Join("", c.ResolveForOrNull <string>("desc") ?? "", c.ResolveForOrNull <string>("autodesc") ?? "")
 };
        public static IEnumerable <ItemNameInfo> GetNames(WZProperty stringFile)
        {
            IEnumerable <ItemNameInfo> itemNames = null;

            if (stringFile.FileContainer.Collection.VersionCache.TryGetValue("itemNames", out object itemNamesCached))
            {
                itemNames = (IEnumerable <ItemNameInfo>)itemNamesCached;
            }
            else
            {
                IEnumerable <WZProperty> eqp     = (stringFile.Resolve("Eqp/Eqp") ?? stringFile.Resolve("Item/Eqp")).Children.SelectMany(c => c.Children);
                IEnumerable <WZProperty> etc     = (stringFile.Resolve("Etc/Etc") ?? stringFile.Resolve("Item/Etc")).Children;
                IEnumerable <WZProperty> ins     = (stringFile.Resolve("Ins") ?? stringFile.Resolve("Item/Ins")).Children;
                IEnumerable <WZProperty> cash    = (stringFile.Resolve("Cash") ?? stringFile.Resolve("Item/Cash"))?.Children;
                IEnumerable <WZProperty> consume = (stringFile.Resolve("Consume") ?? stringFile.Resolve("Item/Con")).Children;
                IEnumerable <WZProperty> pet     = (stringFile.Resolve("Pet") ?? stringFile.Resolve("Item/Pet")).Children;

                IEnumerable <WZProperty> allItems = eqp.Concat(etc).Concat(ins).Concat(consume).Concat(pet);
                if (cash != null)
                {
                    allItems = allItems.Concat(cash);
                }
                itemNames = allItems.Select(ItemNameInfo.Parse);

                stringFile.FileContainer.Collection.VersionCache.AddOrUpdate("itemNames", itemNames, (a, b) => b);
            }

            return(itemNames);
        }
 public IEnumerable <MapName> GetMapNames(string searchFor = null, int startPosition = 0, int?count = null)
 {
     if (!string.IsNullOrEmpty(searchFor))
     {
         searchFor.ToLower();
     }
     return(WZ.Resolve("String/Map").Children
            .SelectMany(c => c.Children)
            .Where(c =>
     {
         int mapId = 0;
         if (!int.TryParse(c.NameWithoutExtension, out mapId))
         {
             return false;
         }
         string eightDigitId = mapId.ToString("D8");
         string nineDigitId = mapId.ToString("D9");
         WZProperty eightDigits = WZ.Resolve($"Map/Map/Map{eightDigitId[0]}");
         WZProperty nineDigits = WZ.Resolve($"Map/Map/Map{nineDigitId[0]}");
         return (eightDigits?.Children?.Any(m => m.NameWithoutExtension.Equals(eightDigitId) || m.NameWithoutExtension.Equals(nineDigitId)) ?? false) || (nineDigits?.Children?.Any(m => m.NameWithoutExtension.Equals(eightDigitId) || m.NameWithoutExtension.Equals(nineDigitId)) ?? false);
     })
            .Where(c => c != null)
            .Select(c => MapName.Parse(c))
            .Where(c => string.IsNullOrEmpty(searchFor) || (!string.IsNullOrEmpty(c.Name) && c.Name.ToLower().Contains(searchFor)) || (!string.IsNullOrEmpty(c.StreetName) && c.StreetName.ToLower().Contains(searchFor)))
            .Skip(startPosition)
            .Take(count ?? int.MaxValue));
 }
Exemple #5
0
        public static Map Parse(WZProperty mapEntry, Map result)
        {
            if (mapEntry == null)
            {
                return(null);
            }
            WZProperty mapInfo = mapEntry.Resolve("info");

            Task loadLadders = Task.Run(() =>
            {
                List <LadderRope> ladderRopes = new List <LadderRope>();
                foreach (WZProperty entry in mapEntry.Resolve("ladderRope").Children)
                {
                    ladderRopes.Add(LadderRope.Parse(entry));
                }
                result.LadderRopes = ladderRopes;
            });

            ParseInfo(result, mapEntry, mapInfo);
            ParseFootholds(result, mapEntry);
            ParseLife(result, mapEntry);
            Task.WaitAll(loadLadders);

            return(result);
        }
Exemple #6
0
        public static LadderRope Parse(WZProperty entry)
        {
            LadderRope result = new LadderRope();

            foreach (WZProperty prop in entry.Children)
            {
                if (prop.Name == "x")
                {
                    result.x = prop.ResolveFor <int>() ?? 0;
                }
                if (prop.Name == "y1")
                {
                    result.y1 = prop.ResolveFor <int>() ?? 0;
                }
                if (prop.Name == "y2")
                {
                    result.y2 = prop.ResolveFor <int>() ?? 0;
                }
                if (prop.Name == "l")
                {
                    result.IsLadder = prop.ResolveFor <bool>() ?? false;
                }
            }

            return(result);
        }
Exemple #7
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);
        }
        public static SkillLevelTemplate Parse(int templateID, int level, WZProperty p)
        {
            var x = new Argument("x", level);

            var u = new Function("u", "ceil(x)", "x");
            var d = new Function("d", "floor(x)", "x");

            return(new SkillLevelTemplate
            {
                TemplateID = templateID,
                HP = ResolveExpression(p.ResolveForOrNull <string>("hp"), x, u, d),
                MP = ResolveExpression(p.ResolveForOrNull <string>("mp"), x, u, d),
                PAD = ResolveExpression(p.ResolveForOrNull <string>("pad"), x, u, d),
                PDD = ResolveExpression(p.ResolveForOrNull <string>("pdd"), x, u, d),
                MAD = ResolveExpression(p.ResolveForOrNull <string>("mad"), x, u, d),
                MDD = ResolveExpression(p.ResolveForOrNull <string>("mdd"), x, u, d),
                ACC = ResolveExpression(p.ResolveForOrNull <string>("acc"), x, u, d),
                EVA = ResolveExpression(p.ResolveForOrNull <string>("eva"), x, u, d),
                Craft = ResolveExpression(p.ResolveForOrNull <string>("craft"), x, u, d),
                Speed = ResolveExpression(p.ResolveForOrNull <string>("speed"), x, u, d),
                Jump = ResolveExpression(p.ResolveForOrNull <string>("jump"), x, u, d),
                Morph = ResolveExpression(p.ResolveForOrNull <string>("morph"), x, u, d),
                Time = ResolveExpression(p.ResolveForOrNull <string>("time"), x, u, d),
                X = ResolveExpression(p.ResolveForOrNull <string>("x"), x, u, d),
                Y = ResolveExpression(p.ResolveForOrNull <string>("y"), x, u, d),
                Z = ResolveExpression(p.ResolveForOrNull <string>("z"), x, u, d),
                EMHP = ResolveExpression(p.ResolveForOrNull <string>("emhp"), x, u, d),
                EMMP = ResolveExpression(p.ResolveForOrNull <string>("emmp"), x, u, d),
                EPAD = ResolveExpression(p.ResolveForOrNull <string>("epad"), x, u, d),
                EMAD = ResolveExpression(p.ResolveForOrNull <string>("emad"), x, u, d),
                EPDD = ResolveExpression(p.ResolveForOrNull <string>("epdd"), x, u, d),
                EMDD = ResolveExpression(p.ResolveForOrNull <string>("emdd"), x, u, d)
            });
        }
Exemple #9
0
        public override void Parse(int templateId, WZProperty p)
        {
            base.Parse(templateId, p);

            RecoveryHP = p.ResolveFor <int>("info/recoveryHP") ?? 0;
            RecoveryMP = p.ResolveFor <int>("info/recoveryMP") ?? 0;
        }
Exemple #10
0
        public override void Parse(int templateId, WZProperty p)
        {
            base.Parse(templateId, p);

            IncSTR   = p.ResolveFor <short>("info/incSTR") ?? 0;
            IncDEX   = p.ResolveFor <short>("info/incDEX") ?? 0;
            IncINT   = p.ResolveFor <short>("info/incINT") ?? 0;
            IncLUK   = p.ResolveFor <short>("info/incLUK") ?? 0;
            IncMaxHP = p.ResolveFor <int>("info/incMHP") ?? 0;
            IncMaxMP = p.ResolveFor <int>("info/incMMP") ?? 0;
            IncPAD   = p.ResolveFor <short>("info/incPAD") ?? 0;
            IncMAD   = p.ResolveFor <short>("info/incMAD") ?? 0;
            IncPDD   = p.ResolveFor <short>("info/incPDD") ?? 0;
            IncMDD   = p.ResolveFor <short>("info/incMDD") ?? 0;
            IncACC   = p.ResolveFor <short>("info/incACC") ?? 0;
            IncEVA   = p.ResolveFor <short>("info/incEVA") ?? 0;
            IncCraft = p.ResolveFor <short>("info/incCraft") ?? 0;
            IncSpeed = p.ResolveFor <short>("info/incSpeed") ?? 0;
            IncJump  = p.ResolveFor <short>("info/incJump") ?? 0;

            PreventSlip = p.ResolveFor <bool>("info/preventslip") ?? false;
            WarmSupport = p.ResolveFor <bool>("info/warmsupport") ?? false;

            Success = p.ResolveFor <int>("info/success") ?? 0;
            Cursed  = p.ResolveFor <int>("info/cursed") ?? 0;

            RandomStat = p.ResolveFor <bool>("info/randstat") ?? false;

            ReqItem = p.Resolve("req")?.Children
                      .Select(c => c.ResolveFor <int>() ?? 0)
                      .ToList() ?? new List <int>();
        }
        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);
        }
Exemple #12
0
        public Skill GetSkill(int id)
        {
            WZProperty skillBooks = WZ.Resolve("Skill");
            string     friendlyId = id.ToString();
            WZProperty skillBook  = null;

            if (skillBook == null)
            {
                skillBook = skillBooks.Children.FirstOrDefault(c => c.NameWithoutExtension.Equals(friendlyId.Substring(0, 6)))?.Resolve($"skill/{friendlyId}");
            }
            if (skillBook == null)
            {
                skillBook = skillBooks.Children.FirstOrDefault(c => c.NameWithoutExtension.Equals(friendlyId.Substring(0, 5)))?.Resolve($"{friendlyId.Substring(0, 5)}/skill/{friendlyId}");
            }
            if (skillBook == null)
            {
                skillBook = skillBooks.Children.FirstOrDefault(c => c.NameWithoutExtension.Equals(friendlyId.Substring(0, 4)))?.Resolve($"{friendlyId.Substring(0, 4)}/skill/{friendlyId}");
            }
            if (skillBook == null)
            {
                skillBook = skillBooks.Children.FirstOrDefault(c => c.NameWithoutExtension.Equals(friendlyId.Substring(0, 3)))?.Resolve($"{friendlyId.Substring(0, 3)}/skill/{friendlyId}");
            }
            if (skillBook == null)
            {
                skillBook = skillBooks.Children.SelectMany(c => c.Resolve("skill")?.Children).Where(c => c != null && c.NameWithoutExtension.Equals(friendlyId)).First();
            }

            return(Skill.Parse(skillBook, GetSkillDescription));
        }
Exemple #13
0
        public static SkillDescription Parse(WZProperty child)
        {
            if (child == null)
            {
                return(null);
            }
            int itemId = -1;

            if (!int.TryParse(child.NameWithoutExtension, out itemId))
            {
                return(null);
            }

            string bookName = "", name = "", shortDesc = "", desc = "";

            if (child.Children.Any(c => c.NameWithoutExtension.Equals("bookName")))
            {
                bookName = child.ResolveForOrNull <string>("bookName");
            }
            else
            {
                name      = child.ResolveForOrNull <string>("name");
                desc      = child.ResolveForOrNull <string>("desc");
                shortDesc = child.ResolveForOrNull <string>("h");
            }

            return(new SkillDescription(itemId, name, desc, shortDesc, bookName));
        }
Exemple #14
0
            public static DirectMaps Parse(WZProperty prop)
            {
                if (prop == null)
                {
                    return(null);
                }

                DirectMaps result = new DirectMaps();

                result.Spot = prop.ResolveFor <Point>("spot");
                if (result.Spot == null)
                {
                    string[] childrenNames = prop.Children.Select(c => c.NameWithoutExtension).ToArray();
                    if (childrenNames.Contains("x") && childrenNames.Contains("y"))
                    {
                        result.Spot = new Point(prop.ResolveFor <int>("x").Value, prop.ResolveFor <int>("y").Value);
                    }
                }
                result.Type        = prop.ResolveFor <int>("type");
                result.Title       = prop.ResolveForOrNull <string>("desc");
                result.Description = prop.ResolveForOrNull <string>("title");
                result.NoTooltip   = prop.ResolveFor <bool>("noToolTip");
                result.MapNumbers  = prop.Resolve("mapNo").Children.Select(c => c.ResolveFor <int>()).Where(c => c.HasValue).Select(c => c.Value).ToArray();

                return(result);
            }
Exemple #15
0
        public static IEnumerable <Quest> GetQuests(WZProperty questWz)
        {
            Dictionary <int, QuestRewards[]> rewards = questWz.Resolve("Act").Children
                                                       .AsParallel()
                                                       .Select(QuestRewards.Parse)
                                                       .Select(c => c.Where(b => b != null).ToArray())
                                                       .Where(c => c.Length > 0)
                                                       .ToDictionary(c => c.First().Id, c => c);
            Dictionary <int, QuestRequirements[]> requirements = questWz.Resolve("Check").Children
                                                                 .AsParallel()
                                                                 .Select(QuestRequirements.Parse)
                                                                 .Select(c => c.Where(b => b != null).ToArray())
                                                                 .Where(c => c.Length > 0)
                                                                 .ToDictionary(c => c.First().Id, c => c);

            return(questWz.Resolve("QuestInfo").Children
                   .AsParallel()
                   .Select(Quest.Parse)
                   .Select(c =>
            {
                QuestRewards[] questRewards = rewards.ContainsKey(c.Id) ? rewards[c.Id] : null;
                QuestRequirements[] questRequirements = requirements.ContainsKey(c.Id) ? requirements[c.Id] : null;

                c.RequirementToComplete = questRequirements?.Where(b => b.State == QuestState.Complete).FirstOrDefault();
                c.RequirementToStart = questRequirements?.Where(b => b.State == QuestState.Start).FirstOrDefault();
                c.RewardOnStart = questRewards?.Where(b => b.State == QuestState.Start).FirstOrDefault();
                c.RewardOnComplete = questRewards?.Where(b => b.State == QuestState.Complete).FirstOrDefault();

                return c;
            }));
        }
        internal static CashEffect Parse(WZProperty wZProperty)
        {
            CashEffect effect = new CashEffect();

            bool isOnlyDefault = false;

            effect.isFollow = wZProperty.ResolveFor <bool>("follow") ?? false;

            foreach (WZProperty obj in wZProperty.Children.Where(c => c.NameWithoutExtension != "follow" && c.NameWithoutExtension != "info"))
            {
                int frameTest = 0;
                if (isOnlyDefault = (obj.Type == PropertyType.Canvas || int.TryParse(obj.NameWithoutExtension, out frameTest)))
                {
                    break;
                }

                if (obj.Children.Count() == 0)
                {
                    continue;
                }
                effect.framebooks.Add(obj.NameWithoutExtension, FrameBook.Parse(obj));
            }

            if (isOnlyDefault)
            {
                effect.framebooks.Add("default", FrameBook.Parse(wZProperty));
            }

            return(effect);
        }
Exemple #17
0
        public static Tuple <ItemPotential, IEnumerable <ItemPotentialLevel> > Parse(WZProperty potentialEntry)
        {
            ItemPotential potential = new ItemPotential();

            if (!int.TryParse(potentialEntry.NameWithoutExtension, out potential.id))
            {
                return(null);
            }

            WZProperty info = potentialEntry.Resolve("info");

            if (info.Children.Any(c => c.NameWithoutExtension.Equals("string")))
            {
                potential.Message = info.ResolveForOrNull <string>("string");
            }
            else
            {
                return(null);
            }

            potential.OptionType    = info.ResolveFor <int>("optionType") ?? 0;
            potential.RequiredLevel = info.ResolveFor <int>("reqLevel") ?? 0;

            return(new Tuple <ItemPotential, IEnumerable <ItemPotentialLevel> >(potential, ItemPotentialLevel.Parse(potential.id, potentialEntry.Resolve("level"))));
        }
Exemple #18
0
        public static Android Parse(WZProperty data, int id)
        {
            Android result = new Android();

            result.Id = id;

            result.ActionMessages = data.Resolve("action").Children.ToDictionary(c => c.NameWithoutExtension, c => c.Children.Select(b => AndroidMessage.Parse(b)).ToArray());

            result.DefaultEquips = data.Resolve("basic").Children.Select(c => ((WZPropertyVal <int>)c).Value).Where(c => c != 0).ToArray();

            if (data.Children.Any(c => c.NameWithoutExtension.Equals("costume")))
            {
                WZProperty costume = data.Resolve("costume");
                result.PossibleFaces = costume.Resolve("face").Children.Select(c => ((WZPropertyVal <int>)c).Value).Where(c => c != 0).ToArray();
                result.PossibleHairs = costume.Resolve("hair").Children.Select(c => ((WZPropertyVal <int>)c).Value).Where(c => c != 0).ToArray();
                result.PossibleSkins = costume.Resolve("skin").Children.Select(c => ((WZPropertyVal <int>)c).Value).Where(c => c != 0).ToArray();
            }

            if (data.Children.Any(c => c.NameWithoutExtension.Equals("info")))
            {
                WZProperty info = data.Resolve("info");
                result.ChatBalloonStyle = info.ResolveFor <int>("chatBalloon");
                result.Gender           = info.ResolveFor <int>("gender");
                result.NameTagStyle     = info.ResolveFor <int>("nameTag");
            }

            return(result);
        }
        public static SkillTemplate Parse(int templateId, WZProperty p)
        {
            var entry = p.Resolve("common");
            var levelData = new Dictionary<int, SkillLevelTemplate>();

            if (entry != null)
            {
                var maxLevel = entry.ResolveFor<int>("maxLevel");

                for (var i = 1; i <= maxLevel; i++)
                    levelData.Add(i, SkillLevelTemplate.Parse(templateId, i, entry));
            }
            else
            {
                entry = p.Resolve("level");
                levelData = entry.Children
                    .ToDictionary(
                        c => Convert.ToInt32(c.Name),
                        c => SkillLevelTemplate.Parse(templateId, Convert.ToInt32(c.Name), c)
                    );
            }

            return new SkillTemplate
            {
                TemplateID = templateId,
                MaxLevel = (short) levelData.Count,
                ReqSkill = p.Resolve("req")?.Children
                               .ToDictionary(
                                   c => Convert.ToInt32(c.Name),
                                   c => c.ResolveFor<int>() ?? 0
                               ) ?? new Dictionary<int, int>(),
                LevelData = levelData
            };
        }
Exemple #20
0
 public static MobInfo Parse(WZProperty stringWz)
 {
     if (stringWz == null)
     {
         return(null);
     }
     else
     {
         int mobId = int.Parse(stringWz.NameWithoutExtension);
         if (stringWz.FileContainer.Collection is MSPackageCollection)
         {
             MSPackageCollection collection = (MSPackageCollection)stringWz.FileContainer.Collection;
             if (collection.MobMeta.ContainsKey(mobId))
             {
                 Tuple <string, int, bool> mobMeta = collection.MobMeta[mobId];
                 return(new MobInfo(
                            mobId,
                            stringWz.ResolveForOrNull <string>("name"),
                            mobMeta.Item1,
                            mobMeta.Item2,
                            mobMeta.Item3
                            ));
             }
         }
         return(new MobInfo(
                    mobId,
                    stringWz.ResolveForOrNull <string>("name")
                    ));
     }
 }
        public static IEnumerable <ItemPotentialLevel> Parse(int potentialId, WZProperty levels)
        {
            if (levels == null)
            {
                yield break;
            }

            foreach (WZProperty level in levels.Children)
            {
                int potLevel = 0;

                if (!int.TryParse(level.NameWithoutExtension, out potLevel))
                {
                    continue;
                }

                yield return(new ItemPotentialLevel()
                {
                    Level = potLevel,
                    Modifiers = level
                                .Children
                                .Select(c => new Tuple <string, string>(c.NameWithoutExtension, Convert.ToString(((IWZPropertyVal)c).GetValue())))
                                .ToList(),
                    PotentialId = potentialId
                });
            }
        }
Exemple #22
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);
        }
Exemple #23
0
 public static SMap Parse(WZProperty BaseWz)
 => new SMap()
 {
     Ordering = BaseWz.Resolve("smap").Children
                .Where(c => c.Type == PropertyType.String)
                .Select(c => new Tuple <string, string>(c.NameWithoutExtension, ((IWZPropertyVal)c).GetValue().ToString())).ToArray()
 };
Exemple #24
0
 public static ZMap Parse(WZProperty BaseWz)
 => new ZMap()
 {
     Ordering = BaseWz.Resolve("zmap").Children
                .Select(c => c.NameWithoutExtension)
                .ToArray()
                .Reverse()
 };
        public override void Parse(int templateId, WZProperty p)
        {
            base.Parse(templateId, p);

            IncPAD        = p.ResolveFor <short>("info/incPAD") ?? 0;
            ReqLevel      = p.ResolveFor <byte>("info/reqLevel") ?? 0;
            SellUnitPrice = p.ResolveFor <float>("info/unitPrice") ?? 0.0f;
        }
Exemple #26
0
 public static MobSummonEntry Parse(WZProperty p)
 {
     return(new MobSummonEntry
     {
         TemplateID = p.ResolveFor <int>("id") ?? 0,
         Prob = p.ResolveFor <int>("prob") ?? 0
     });
 }
Exemple #27
0
        // TODO: Flesh out set effect attributes
        // activeSkill + EquipInfo + Others?
        //public Dictionary<int, > Effects;

        public static ItemSet ParseItemInfo(WZProperty info)
        {
            if (!info.Children.Any(c => c.NameWithoutExtension.Equals("setItemID")))
            {
                return(null);
            }

            return(Parse(info.ResolveOutlink(Path.Combine("Etc", "SetItemInfo", (info.ResolveFor <int>("setItemID") ?? -1).ToString()))));
        }
 public static NPCScriptTemplate Parse(WZProperty p)
 {
     return(new NPCScriptTemplate
     {
         Script = p.ResolveForOrNull <string>("script"),
         Start = p.ResolveFor <int>("start") ?? 0,
         End = p.ResolveFor <int>("end") ?? 0
     });
 }
Exemple #29
0
        public override void Parse(int templateId, WZProperty p)
        {
            base.Parse(templateId, p);

            Type = p.ResolveFor <int>("info/type") ?? 0;
            Mobs = p.Resolve("mob")?.Children
                   .Select(MobSummonEntry.Parse)
                   .ToList() ?? new List <MobSummonEntry>();
        }
Exemple #30
0
        private void Load(WZProperty mapNode)
        {
            Portals.Load(mapNode);
            Footholds.Load(mapNode);
            Npcs.Load(mapNode);

            Mobs.Load(mapNode);
            Mobs.DoMobLogic();
        }