Exemplo n.º 1
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);
            }
Exemplo n.º 2
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"))));
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
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;
        }
        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;
        }
Exemplo n.º 6
0
 public static MobSummonEntry Parse(WZProperty p)
 {
     return(new MobSummonEntry
     {
         TemplateID = p.ResolveFor <int>("id") ?? 0,
         Prob = p.ResolveFor <int>("prob") ?? 0
     });
 }
 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
     });
 }
Exemplo n.º 8
0
        public override void Parse(int templateId, WZProperty p)
        {
            base.Parse(templateId, p);

            RandomMoveInFieldSet = p.ResolveFor <bool>("spec/randomMoveInFieldSet") ?? false;
            IgnoreContinent      = p.ResolveFor <bool>("spec/ignoreContinent") ?? false;
            MoveTo      = p.ResolveFor <int>("spec/moveTo") ?? 999999999;
            ReturnMapQR = p.ResolveFor <int>("spec/returnMapQR") ?? 0;
        }
        public override void Parse(int templateId, WZProperty p)
        {
            base.Parse(templateId, p);

            CreateItemID      = p.ResolveFor <int>("info/create") ?? 0;
            CreateItemPeriod  = p.ResolveFor <int>("info/period") ?? 0;
            CatchPercentageHP = p.ResolveFor <int>("info/mobHP") ?? 0;
            BridleMsgType     = p.ResolveFor <int>("info/bridleMsgType") ?? 0;
            UseDelay          = p.ResolveFor <int>("info/useDelay") ?? 0;
        }
Exemplo n.º 10
0
        public int?State; // state

        public static Requirement Parse(WZProperty c)
        {
            Requirement result = new Requirement();

            result.Count = c.ResolveFor <int>("count");
            result.Id    = c.ResolveFor <int>("id");
            result.State = c.ResolveFor <int>("state");

            return(result);
        }
Exemplo n.º 11
0
 public static MobTemplate Parse(int templateId, WZProperty p)
 {
     return(new MobTemplate
     {
         TemplateID = templateId,
         Level = p.ResolveFor <short>("info/level") ?? 0,
         MaxHP = p.ResolveFor <int>("info/maxHP") ?? 1,
         MaxMP = p.ResolveFor <int>("info/maxMP") ?? 0
     });
 }
Exemplo n.º 12
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);
        }
Exemplo n.º 13
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 override void Parse(int templateId, WZProperty p)
        {
            base.Parse(templateId, p);

            MasterLevel = p.ResolveFor <int>("info/masterLevel") ?? 0;
            ReqLevel    = p.ResolveFor <int>("info/reqSkillLevel") ?? 0;
            Skill       = p.Resolve("info/skill")?.Children
                          .Select(c => c.ResolveFor <int>() ?? 0)
                          .ToList() ?? new List <int>();

            Success = p.ResolveFor <int>("info/success") ?? 0;
        }
Exemplo n.º 15
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);
        }
Exemplo n.º 16
0
 public static ItemOptionTemplate Parse(int templateId, WZProperty p)
 {
     return(new ItemOptionTemplate
     {
         TemplateID = templateId,
         ReqLevel = p.ResolveFor <short>("info/reqLevel") ?? 0,
         OptionType = p.ResolveFor <short>("info/optionType") ?? 0,
         LevelData = p.Resolve("level").Children
                     .ToDictionary(
             c => Convert.ToInt32(c.Name),
             ItemOptionLevelTemplate.Parse
             )
     });
 }
Exemplo n.º 17
0
        public int SkillLevel;                 // skillLevel

        public static SkillReward Parse(WZProperty data)
        {
            if (data == null)
            {
                return(null);
            }
            SkillReward result = new SkillReward();

            result.Id           = data.ResolveFor <int>("id") ?? -1;
            result.RequiredJobs = data.Resolve("job")?.Children.Select(c => Convert.ToInt32(((IWZPropertyVal)c).GetValue()));
            result.MasterLevel  = data.ResolveFor <int>("masterLevel") ?? -1;
            result.SkillLevel   = data.ResolveFor <int>("skillLevel") ?? -1;

            return(result);
        }
Exemplo n.º 18
0
        public static ChairInfo Parse(WZProperty info)
        {
            if (!info.Children.Any(c => mustContainOne.Contains(c.NameWithoutExtension)))
            {
                return(null);
            }

            ChairInfo results = new ChairInfo();

            results.recoveryHP = info.ResolveFor <int>("recoveryHP");
            results.recoveryMP = info.ResolveFor <int>("recoveryMP");
            results.reqLevel   = info.ResolveFor <int>("reqLevel");

            return(results);
        }
Exemplo n.º 19
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);
        }
Exemplo n.º 20
0
        public static ShopInfo Parse(WZProperty info)
        {
            if (!info.Children.Any(c => mustContainOne.Contains(c.NameWithoutExtension)))
            {
                return(null);
            }

            ShopInfo results = new ShopInfo();

            results.price       = info.ResolveFor <int>("price");
            results.notSale     = info.ResolveFor <bool>("notSale");
            results.monsterBook = info.ResolveFor <bool>("monsterBook");

            return(results);
        }
Exemplo n.º 21
0
        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);
        }
Exemplo n.º 22
0
 public static NPCTemplate Parse(int templateId, WZProperty p)
 {
     return(new NPCTemplate
     {
         TemplateID = templateId,
         TrunkPut = p.ResolveFor <int>("info/trunkPut") ?? 0,
         TrunkGet = p.ResolveFor <int>("info/trunkGet") ?? 0,
         StoreBank = p.ResolveFor <bool>("info/storeBank") ?? false,
         Parcel = p.ResolveFor <bool>("info/parcel") ?? false,
         Scripts = p.Resolve("info/script")?.Children
                   .Select(NPCScriptTemplate.Parse)
                   .ToList()
                   ?? new List <NPCScriptTemplate>(),
         Move = p.Resolve("move") != null
     });
 }
Exemplo n.º 23
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);
        }
        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);
        }
Exemplo n.º 25
0
        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);
        }
Exemplo n.º 26
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>();
        }
Exemplo n.º 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()))));
        }
Exemplo n.º 28
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);
        }
Exemplo n.º 29
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);
        }
Exemplo n.º 30
0
        public static Effects Parse(WZProperty effectContainer)
        {
            Effects effects = new Effects();

            int?z = effectContainer.ResolveFor <int>("effect/z");//itemEffect["effect"].HasChild("z") ? itemEffect["effect"]["z"].ValueOrDefault<int>(0) : 0;

            effects.entries = effectContainer.Children
                              .Where(c => !blacklistEntries.Contains(c.NameWithoutExtension))
                              .ToDictionary(c => c.NameWithoutExtension, c => FrameBook.Parse(c));

            return(effects);
        }