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") ?? "")
 };
Exemple #2
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 #3
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")
                    ));
     }
 }
Exemple #4
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);
        }
Exemple #5
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 #6
0
        public static AndroidMessage Parse(WZProperty data)
        {
            AndroidMessage result = new AndroidMessage();

            result.Message     = data.ResolveForOrNull <string>("chat");
            result.Face        = data.ResolveForOrNull <string>("face");
            result.Sound       = data.ResolveForOrNull <string>("sound");
            result.Probability = data.ResolveFor <int>("prob") ?? 100;

            return(result);
        }
Exemple #7
0
        public static IconInfo Parse(WZProperty info)
        {
            IconInfo results = new IconInfo();

            string infoPath = info.Path;
            string itemId   = infoPath.Substring(infoPath.Length - 13, 8);
            int    id       = -1;

            if (int.TryParse(itemId, out id))
            {
                string iconName = null;
                //Rank D Nebulite
                if (3060000 <= id && id < 3061000)
                {
                    iconName = "nebulite-D";
                }
                //Rank C Nebulite
                if (3061000 <= id && id < 3062000)
                {
                    iconName = "nebulite-C";
                }
                //Rank B Nebulite
                if (3062000 <= id && id < 3063000)
                {
                    iconName = "nebulite-B";
                }
                //Rank A Nebulite
                if (3063000 <= id && id < 3064000)
                {
                    iconName = "nebulite-A";
                }

                if (iconName != null)
                {
                    Image <Rgba32> icon = Image.Load($"assets/{iconName}.png");
                    results.Icon    = icon;
                    results.IconRaw = icon;

                    return(results);
                }
            }

            if (!info.Children.Any(c => mustContainOne.Contains(c.NameWithoutExtension)))
            {
                return(null);
            }

            results.Icon          = info.ResolveForOrNull <Image <Rgba32> >("icon");
            results.IconRaw       = info.ResolveForOrNull <Image <Rgba32> >("iconRaw");
            results.IconOrigin    = info.ResolveFor <Point>("icon/origin");
            results.IconRawOrigin = info.ResolveFor <Point>("iconRaw/origin");

            return(results);
        }
        public static ItemDescription Parse(WZProperty itemString, int itemId)
        {
            if (!itemString.Children.Any(c => c.NameWithoutExtension.Equals("name")))
            {
                return(null);
            }

            return(new ItemDescription(
                       itemId,
                       itemString.ResolveForOrNull <string>("name"),
                       string.Join("", itemString.ResolveForOrNull <string>("desc") ?? "", itemString.ResolveForOrNull <string>("autodesc") ?? "")
                       ));
        }
Exemple #9
0
 public static MapName Parse(WZProperty mapEntry)
 {
     if (mapEntry == null)
     {
         return(null);
     }
     return(new MapName()
     {
         Id = int.Parse(mapEntry.NameWithoutExtension),
         Name = mapEntry.ResolveForOrNull <string>("mapName"),
         StreetName = mapEntry.ResolveForOrNull <string>("streetName")
     });
 }
Exemple #10
0
            public static WorldMapLink Parse(WZProperty prop)
            {
                if (prop == null)
                {
                    return(null);
                }

                WorldMapLink result = new WorldMapLink();

                result.ToolTip   = prop.ResolveForOrNull <string>("toolTip");
                result.LinkImage = Frame.Parse(prop.Resolve("link/linkImg"));
                result.LinksTo   = prop.ResolveForOrNull <string>("link/linkMap");

                return(result);
            }
        public static FieldPortalTemplate Parse(WZProperty p)
        {
            var res = new FieldPortalTemplate
            {
                ID     = Convert.ToInt32(p.Name),
                Name   = p.ResolveForOrNull <string>("pn"),
                Type   = (FieldPortalType)(p.ResolveFor <int>("pt") ?? 0),
                Script = p.ResolveForOrNull <string>("script"),
                ToMap  = p.ResolveFor <int>("tm") ?? int.MinValue,
                ToName = p.ResolveForOrNull <string>("tn"),
                X      = p.ResolveFor <int>("x") ?? int.MinValue,
                Y      = p.ResolveFor <int>("y") ?? int.MinValue
            };

            return(res);
        }
        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 #13
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 #14
0
        public static WorldMap Parse(WZProperty worldMapNode)
        {
            if (worldMapNode == null)
            {
                return(null);
            }

            WorldMap result = new WorldMap();

            result.BaseImage    = worldMapNode.Resolve("BaseImg").Children.Select(c => Frame.Parse(c)).ToArray();
            result.WorldMapName = worldMapNode.ResolveForOrNull <string>("info/WorldMap");
            result.ParentWorld  = worldMapNode.ResolveForOrNull <string>("info/parentMap");
            result.Links        = worldMapNode.Resolve("MapLink")?.Children.Select(c => WorldMapLink.Parse(c)).Where(c => c != null).ToArray();
            result.Maps         = worldMapNode.Resolve("MapList")?.Children.Select(c => DirectMaps.Parse(c)).Where(c => c != null).ToArray();

            return(result);
        }
 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
     });
 }
        public static MapBackground Parse(WZProperty data)
        {
            MapBackground result = new MapBackground();

            result.BackgroundSet = data.ResolveForOrNull <string>("bS");
            result.pathToImage   = string.Join("/", new [] {
                result.BackgroundSet, // backgroundSet,
                "back",
                data.ResolveForOrNull <string>("no")
            });
            result.Index = int.Parse(data.Name);
            result.Front = data.ResolveFor <bool>("front") ?? false;
            result.Alpha = (data.ResolveFor <int>("a") ?? 255) / 255;
            result.Flip  = data.ResolveFor <bool>("f") ?? false;
            WZProperty tileCanvas = data.ResolveOutlink($"Map/Back/{result.pathToImage}") ?? data.ResolveOutlink($"Map2/Back/{result.pathToImage}") ?? data.ResolveOutlink($"Map001/Back/{result.pathToImage}");

            if (tileCanvas != null) // Could be null as we're not supporting ani backgrounds
            {
                result.Canvas = Frame.Parse(tileCanvas?.Children.FirstOrDefault(c => c.Type == PropertyType.Canvas) ?? tileCanvas);
            }
            else
            {
                return(null);
            }
            if (result.Canvas.Image == null)
            {
                return(null);
            }
            if (result.Flip && result.Canvas != null && result.Canvas.Image != null)
            {
                result.Canvas.Image = result.Canvas.Image.Clone(c => c.Flip(FlipMode.Horizontal));
            }
            result.Type     = (BackgroundType)(data.ResolveFor <int>("type") ?? 0);
            result.Position = new Vector3(
                data.ResolveFor <int>("x") ?? 0,
                data.ResolveFor <int>("y") ?? 0,
                result.Front ? 100000000 : int.Parse(data.NameWithoutExtension)
                );
            result.rx = data.ResolveFor <int>("rx") ?? 0;
            result.ry = data.ResolveFor <int>("ry") ?? 0;
            result.cx = data.ResolveFor <int>("cx") ?? 0;
            result.cy = data.ResolveFor <int>("cy") ?? 0;
            return(result);
        }
        public static GraphicsSet Parse(WZProperty data, int index, int frame)
        {
            GraphicsSet result = new GraphicsSet();

            result.Index   = index;
            result.TileSet = data.ResolveForOrNull <string>("info/tS");
            result.Objects = data.Resolve("obj")?.Children.Select(c => MapObject.Parse(c, frame)).Where(c => c != null);
            result.Tiles   = data.Resolve("tile")?.Children.Select(c => MapTile.Parse(c, result.TileSet, frame)).Where(c => c != null);

            return(result);
        }
Exemple #18
0
        public Image <Rgba32> GetIcon(int itemId)
        {
            WZProperty     itemNode = GetItemNode(itemId);
            Image <Rgba32> icon     = itemNode.ResolveForOrNull <Image <Rgba32> >("info/icon");

            if (icon == null)
            {
                WZProperty action = itemNode.Children.First(c => c.NameWithoutExtension != "info");
                return(EquipFrameBook.Parse(action).frames?.FirstOrDefault()?.Effects?.Values.FirstOrDefault()?.Image);
            }
            return(icon);
        }
Exemple #19
0
        public static MapObject Parse(WZProperty data, int frame)
        {
            MapObject result = new MapObject();

            result.pathToImage = string.Join("/", (new [] {
                data.ResolveForOrNull <string>("oS"),
                data.ResolveForOrNull <string>("l0"),
                data.ResolveForOrNull <string>("l1"),
                data.ResolveForOrNull <string>("l2"),
            }).Where(c => c != null));
            result.FrontMost = data.ResolveFor <bool>("front") ?? false;
            result.Position  = new Vector3(
                data.ResolveFor <float>("x") ?? 0,
                data.ResolveFor <float>("y") ?? 0,
                result.FrontMost ? 100000000 : data.ResolveFor <float>("z") ?? 0
                );
            result.SecondZ = data.ResolveFor <float>("zM") ?? 0;
            result.Quests  = data.Resolve("quest")?.Children?
                             .Where(c => int.TryParse(c.NameWithoutExtension, out int blah))
                             .Select(c => int.Parse(c.NameWithoutExtension))
                             .ToArray();
            result.Tags     = data.ResolveForOrNull <string>("tags");
            result.Rotation = data.ResolveFor <float>("r");
            WZProperty objCanvas = data.ResolveOutlink($"Map/Obj/{result.pathToImage}") ?? data.ResolveOutlink($"Map2/Obj/{result.pathToImage}");

            if (objCanvas == null)
            {
                return(null);
            }
            int frameCount = objCanvas.Resolve().Children.Select(c => int.TryParse(c.NameWithoutExtension, out int frameNum) ? (int?)frameNum : null).Where(c => c.HasValue).Select(c => c.Value).Max();

            result.Canvas = Frame.Parse(objCanvas.Resolve((frame % (frameCount + 1)).ToString()) ?? objCanvas);
            result.Flip   = data.ResolveFor <bool>("f") ?? false;
            if (result.Flip && result.Canvas != null && result.Canvas.Image != null)
            {
                result.Canvas.Image = result.Canvas.Image.Clone(c => c.Flip(FlipMode.Horizontal));
            }

            return(result);
        }
Exemple #20
0
        public static Tips Parse(WZProperty tipMessages, WZProperty tipInfo, WorldType worldType, string[] AllMessages)
        {
            Tips result = new Tips();

            result.All          = tipInfo.ResolveFor <int>("all");
            result.TipGroupName = tipInfo.ResolveForOrNull <string>("tip") ?? "all";
            result.LevelMin     = tipInfo.ResolveFor <byte>("levelMin");
            result.LevelMax     = tipInfo.ResolveFor <byte>("levelMax");
            result.Job          = tipInfo.ResolveFor <int>("job");
            result.Interval     = tipInfo.ResolveFor <int>("interval");
            result.Messages     = tipMessages.Children.Select(c => ((IWZPropertyVal)c).GetValue().ToString()).Concat(AllMessages).Distinct();
            result.World        = worldType;

            return(result);
        }
Exemple #21
0
        public static SkillBook Parse(WZProperty skillBook, int id, Job relatedJob, Func <int, SkillDescription> skillDescriptions)
        {
            SkillBook book = new SkillBook();

            if (skillBook.Children.Any(c => c.NameWithoutExtension.Equals("info")))
            {
                book.Icon = skillBook.ResolveForOrNull <Image <Rgba32> >("info/icon");
            }

            book.id          = id;
            book.Description = skillDescriptions(id); //skillDescriptions.FirstOrDefault(c => c.Id == id && !string.IsNullOrEmpty(c.bookName));
            book.Skills      = skillBook.Resolve("skill").Children.Select(c => Skill.Parse(c, skillDescriptions));
            book.Job         = relatedJob;

            return(book);
        }
Exemple #22
0
        public static MiniMap Parse(WZProperty data)
        {
            if (data == null)
            {
                return(null);
            }
            MiniMap result = new MiniMap();

            result.canvas        = data.ResolveForOrNull <Image <Rgba32> >("canvas");
            result.centerX       = data.ResolveFor <int>("centerX") ?? -1;
            result.centerY       = data.ResolveFor <int>("centerY") ?? -1;
            result.height        = data.ResolveFor <int>("height") ?? -1;
            result.width         = data.ResolveFor <int>("width") ?? -1;
            result.magnification = data.ResolveFor <int>("mag") ?? -1;
            return(result);
        }
Exemple #23
0
        public static Frame GetFirstFrame(WZProperty anyWz, string id)
        {
            WZProperty npcImg = anyWz.ResolveOutlink($"Npc/{id}");

            if (npcImg == null)
            {
                return(null);
            }
            string linksTo = npcImg.ResolveForOrNull <string>("info/link");

            if (linksTo != null)
            {
                return(GetFirstFrame(anyWz, linksTo));
            }
            return(FrameBook.Parse(npcImg.Children.Where(c => c.NameWithoutExtension != "info").Select(c => c).FirstOrDefault())
                   .FirstOrDefault().frames.FirstOrDefault());
        }
        public static ItemReward Parse(WZProperty data)
        {
            if (data == null)
            {
                return(null);
            }

            ItemReward result = new ItemReward();

            result.Id             = data.ResolveFor <int>("id") ?? -1;
            result.Count          = data.ResolveFor <int>("count") ?? 0;
            result.PotentialGrade = data.ResolveForOrNull <string>("potentialGrade");
            result.Gender         = data.ResolveFor <bool>("gender");
            result.Job            = data.ResolveFor <int>("job");

            return(result);
        }
Exemple #25
0
        public static MobMeta Parse(WZProperty info)
        {
            MobMeta result = new MobMeta();

            result.IsBodyAttack        = info.ResolveFor <bool>("bodyAttack");
            result.Level               = info.ResolveFor <int>("level");
            result.MaxHP               = info.ResolveFor <long>("maxHP");
            result.MaxMP               = info.ResolveFor <long>("maxMP");
            result.Speed               = info.ResolveFor <int>("speed");
            result.FlySpeed            = info.ResolveFor <int>("flySpeed");
            result.PhysicalDamage      = info.ResolveFor <int>("PADamage");
            result.PhysicalDefense     = info.ResolveFor <int>("PDDamage");
            result.PhysicalDefenseRate = info.ResolveFor <int>("PDRate");
            result.MagicDamage         = info.ResolveFor <int>("MADamage");
            result.MagicDefense        = info.ResolveFor <int>("MDDamage");
            result.MagicDefenseRate    = info.ResolveFor <int>("MDRate");
            result.Accuracy            = info.ResolveFor <int>("acc");
            result.Evasion             = info.ResolveFor <int>("eva");
            result.EXP                  = info.ResolveFor <long>("exp");
            result.IsUndead             = info.ResolveFor <bool>("undead");
            result.MinimumPushDamage    = info.ResolveFor <int>("pushed");
            result.HPRecovery           = info.ResolveFor <int>("hpRecovery");
            result.MPRecovery           = info.ResolveFor <int>("mpRecovery");
            result.ElementalAttributes  = info.ResolveForOrNull <string>("elemAttr");
            result.SummonType           = (SummonType)(info.ResolveFor <int>("summonType") ?? 1);
            result.HPTagColor           = info.ResolveFor <int>("hpTagColor");
            result.HPTagBackgroundColor = info.ResolveFor <int>("hpTagBgcolor");
            result.HPGaugeHide          = info.ResolveFor <bool>("HPgaugeHide");
            result.NoRespawn            = info.ResolveFor <bool>("noRegen");
            result.RevivesMonsterId     = info.Resolve("revive")?.Children?.Select(c => Convert.ToInt32(((IWZPropertyVal)c).GetValue())).Select(c => MobInfo.GetFromId(info, c)).Where(c => c != null);
            result.LinksToOtherMob      = info.ResolveFor <int>("link");
            result.OnlyNormalAttack     = info.ResolveFor <bool>("onlyNormalAttack");
            result.FixedDamageAmount    = info.ResolveFor <uint>("fixedDamage");
            result.IsBoss               = info.ResolveFor <bool>("boss");
            result.IsAutoAggro          = info.ResolveFor <bool>("firstAttack");
            result.PublicReward         = info.ResolveFor <bool>("publicReward");
            result.ExplosiveReward      = info.ResolveFor <bool>("explosiveReward");
            result.IsInvincible         = info.ResolveFor <bool>("invincible");
            result.NoAttack             = info.ResolveFor <bool>("notAttack");
            result.RemoveAfterTime      = info.ResolveFor <int>("removeAfter");
            result.BuffId               = info.ResolveFor <uint>("buff");
            result.HideName             = info.ResolveFor <bool>("hideName");
            result.MonsterBookId        = info.ResolveFor <uint>("mbookID");

            return(result);
        }
        public static FieldLifeTemplate Parse(WZProperty p)
        {
            var res = new FieldLifeTemplate
            {
                TemplateID = p.ResolveFor <int>("id") ?? -1,
                Type       = p.ResolveForOrNull <string>("type").ToLower() == "n"
                    ? FieldLifeType.NPC
                    : FieldLifeType.Monster,
                F   = (byte)(p.ResolveFor <bool>("f") ?? false ? 0 : 1),
                X   = p.ResolveFor <int>("x") ?? int.MinValue,
                Y   = p.ResolveFor <int>("y") ?? int.MinValue,
                RX0 = p.ResolveFor <int>("rx0") ?? int.MinValue,
                RX1 = p.ResolveFor <int>("rx1") ?? int.MinValue,
                FH  = p.ResolveFor <int>("fh") ?? 0
            };

            return(res);
        }
Exemple #27
0
        public static Quest Parse(WZProperty data)
        {
            if (data == null)
            {
                return(null);
            }
            Quest result = new Quest();

            result.Id = int.Parse(data.NameWithoutExtension);
            result.AutoPreComplete = data.ResolveFor <bool>("autoPreComplete");
            result.AutoStart       = data.ResolveFor <bool>("autoStart");
            result.AutoCancel      = data.ResolveFor <bool>("autoCancel");
            result.AutoComplete    = data.ResolveFor <bool>("autoComplete");
            result.AutoAccept      = data.ResolveFor <bool>("autoAccept");
            result.Name            = data.ResolveForOrNull <string>("name");
            result.Area            = data.ResolveFor <int>("area");
            if (result.Area.HasValue && data.FileContainer.Collection is MSPackageCollection)
            {
                ((MSPackageCollection)(data.FileContainer.Collection)).QuestAreaNames.TryGetValue(result.Area.Value, out result.AreaName);
            }
            result.DemandSummary        = data.ResolveForOrNull <string>("demandSummary");
            result.RewardSummary        = data.ResolveForOrNull <string>("rewardSummary");
            result.PlaceSummary         = data.ResolveForOrNull <string>("placeSummary");
            result.Summary              = data.ResolveForOrNull <string>("summary");
            result.DisableAtCompleteTab = data.ResolveFor <bool>("disableAtCompleteTab");
            result.DisableAtNPC         = data.ResolveFor <bool>("disableAtNPC");
            result.DisableAtPerformTab  = data.ResolveFor <bool>("disableAtPerformTab");
            result.DisableAtStartTab    = data.ResolveFor <bool>("disableAtStartTab");
            result.Blocked              = data.ResolveFor <bool>("blocked");
            result.ResignBlocked        = data.ResolveFor <bool>("resignBlocked");
            result.Type            = data.ResolveForOrNull <string>("type");
            result.MedalCategory   = data.ResolveFor <int>("medalCategory");
            result.MedalId         = data.ResolveFor <int>("viewMedalItem");
            result.StartNavigation = data.ResolveFor <bool>("startNavi");
            result.TargetMapId     = data.ResolveFor <int>("targetMapId");
            result.TimeLimit       = data.ResolveFor <int>("timeLimit");
            result.TimerUI         = data.ResolveForOrNull <string>("timerUI");
            result.HasSelectedMob  = data.ResolveFor <bool>("selectedMob");
            result.StraightStart   = data.ResolveFor <bool>("straightStart");
            result.ValidMaps       = data.Resolve("validField")?.Children.Select(c => ((WZPropertyVal <int>)c).Value);
            result.ShowEffect      = data.ResolveFor <bool>("showEffect");
            result.Messages        = data.Children.Where(c => int.TryParse(c.NameWithoutExtension, out int bogus)).Select(c => ((IWZPropertyVal)c).GetValue().ToString()).Where(c => !string.IsNullOrEmpty(c));
            result.DeleteItems     = data.Resolve("deleteItem")?.Children.Select(c => ((WZPropertyVal <int>)c).Value);

            return(result);
        }
Exemple #28
0
        public static ItemSet Parse(WZProperty set)
        {
            ItemSet result = new ItemSet();
            ILookup <int, ItemNameInfo> itemNameLookup = ItemNameInfo.GetNameLookup(set.ResolveOutlink("String"));

            result.SetName       = set.ResolveForOrNull <string>("setItemName");
            result.CompleteCount = set.ResolveFor <int>("completeCount") ?? 1;
            result.RequiredItems = set.Resolve("ItemID").Children.Select(c =>
            {
                if (c.Type == PropertyType.SubProperty)
                {
                    return(c.Children.Where(b => int.TryParse(b.NameWithoutExtension, out int blah)).Select(b => b.ResolveFor <int>() ?? -1));
                }
                else
                {
                    return new int[] { c.ResolveFor <int>() ?? -1 }
                };
            }).Select(c => c.Select(b => itemNameLookup[b].First()));

            return(result);
        }
Exemple #29
0
        public IActionResult Query(Region region, string version, string path)
        {
            MSPackageCollection wz = _wzFactory.GetWZ(region, version);

            if (string.IsNullOrEmpty(path))
            {
                return(Json(new
                {
                    children = wz.Packages.Keys.ToArray(),
                    location = wz.Folder,
                    version = wz.MapleVersion?.MapleVersionId,
                    type = -1
                }));
            }

            WZProperty prop = wz.Resolve(path);

            if (prop == null)
            {
                return(NotFound());
            }

            if (prop is IWZPropertyVal)
            {
                return(Json(new
                {
                    children = prop.Children.Select(c => c.Name),
                    type = prop.Type,
                    value = prop.Type == PropertyType.Canvas ? prop.ResolveForOrNull <Image <Rgba32> >() : ((IWZPropertyVal)prop).GetValue()
                }));
            }

            return(Json(new
            {
                children = prop.Children.Select(c => c.Name),
                type = prop.Type
            }));
        }
Exemple #30
0
        public Drop(WZProperty drop)
        {
            isMesos = drop.Resolve("money") != null;
            string prob = drop.ResolveForOrNull <string>("prob");

            if (prob.Length > 4)
            {
                prob = prob.Replace("[R8]", "");
                decimal.TryParse(prob, out Probability);
            }

            if (isMesos)
            {
                Min = Max = drop.ResolveFor <int>("money") ?? 0;
            }
            else
            {
                Min    = drop.ResolveFor <int>("min") ?? 1;
                Max    = drop.ResolveFor <int>("max") ?? 1;
                ItemId = drop.ResolveFor <int>("item") ?? -1;
            }

            IsPremium = drop.ResolveFor <bool>("premium") ?? false;
        }