示例#1
0
        public ContinentTemplate(int id, IDataProperty property)
        {
            ID = id;

            Info = property.ResolveOrDefault <string>("info");

            property.Resolve("field").ResolveAll(f =>
            {
                StartShipMoveFieldID = f.Resolve <int>("startShipMoveFieldID") ?? 999999999;
                WaitFieldID          = f.Resolve <int>("waitFieldID") ?? 999999999;
                MoveFieldID          = f.Resolve <int>("moveFieldID") ?? 999999999;
                CabinFieldID         = f.Resolve <int>("cabinFieldID");
                EndFieldID           = f.Resolve <int>("endFieldID") ?? 999999999;
                EndShipMoveFieldID   = f.Resolve <int>("endShipMoveFieldID") ?? 999999999;
            });

            property.Resolve("scheduler").ResolveAll(s =>
            {
                Term  = s.Resolve <int>("tTerm") ?? 1;
                Delay = s.Resolve <int>("tDelay") ?? 0;
            });

            property.Resolve("genMob")?.ResolveAll(g =>
                                                   GenMob = new ContinentGenMobTemplate(0, g.ResolveAll())
                                                   );

            Event = GenMob != null;

            property.Resolve("time").ResolveAll(t =>
            {
                Wait     = t.Resolve <int>("tWait") ?? 1;
                EventEnd = t.Resolve <int>("tEventEnd") ?? 0;
                Required = t.Resolve <int>("tRequired") ?? 0;
            });
        }
        public static ModifiedCommodityTemplate Parse(int id, IDataProperty property)
        {
            var t = new ModifiedCommodityTemplate {
                ID = id
            };

            property.Resolve(p =>
            {
                t.ItemID         = p.Resolve <int>("itemId");
                t.Count          = p.Resolve <short>("count");
                t.Priority       = p.Resolve <byte>("priority");
                t.Price          = p.Resolve <int>("price");
                t.Bonus          = p.Resolve <byte>("bonus");
                t.Period         = p.Resolve <short>("period");
                t.ReqPOP         = p.Resolve <short>("reqPOP");
                t.ReqLEV         = p.Resolve <short>("reqLEV");
                t.MaplePoint     = p.Resolve <int>("maplePoint");
                t.Meso           = p.Resolve <int>("meso");
                t.ForPremiumUser = p.Resolve <bool>("premium");
                t.Gender         = p.Resolve <byte>("gender");
                t.OnSale         = p.Resolve <bool>("onSale");
                t.Class          = p.Resolve <byte>("class");
                t.Limit          = p.Resolve <byte>("limit");
                t.PbCash         = p.Resolve <short>("pbCash");
                t.PbPoint        = p.Resolve <short>("pbPoint");
                t.PbGift         = p.Resolve <short>("pbGift");
                t.PackageSN      = property.Resolve("package")?.Children
                                   .Select(c => c.Resolve <int>() ?? 0)
                                   .ToArray() ?? null;
            });

            return(t);
        }
示例#3
0
        public NPCScriptTemplate(IDataProperty property)
        {
            ID = Convert.ToInt32(property.Name);

            Script = property.ResolveOrDefault <string>("script");
            Start  = property.Resolve <int>("start") ?? 0;
            End    = property.Resolve <int>("end") ?? 0;
        }
        public ContinentGenMobTemplate(int id, IDataProperty property)
        {
            ID = id;

            TemplateID = property.Resolve <int>("genMobItemID") ?? 0;
            Position   = new Point(
                property.Resolve <int>("genMobPosition_x") ?? 0,
                property.Resolve <int>("genMobPosition_y") ?? 0
                );
        }
示例#5
0
        public RewardEntryTemplate(int id, IDataProperty property)
        {
            ID = id;

            TemplateID  = property.Resolve <int>("item") ?? 0;
            MinQuantity = property.Resolve <int>("min") ?? 1;
            MaxQuantity = property.Resolve <int>("max") ?? 1;

            Money = property.Resolve <int>("money") ?? 0;

            Prob = property.Resolve <float>("prob") ?? 0.0f;
        }
示例#6
0
        public FieldReactorTemplate(IDataProperty property)
        {
            ID = property.Resolve <int>("id") ?? -1;

            ReactorTime = property.Resolve <int>("reactorTime") ?? 0;

            F        = property.Resolve <bool>("f") ?? false;
            Position = new Point(
                property.Resolve <int>("x") ?? int.MinValue,
                property.Resolve <int>("y") ?? int.MinValue
                );
        }
示例#7
0
 public FieldPortalTemplate(IDataProperty property)
 {
     ID       = Convert.ToInt32(property.Name);
     Name     = property.ResolveOrDefault <string>("pn");
     Type     = (FieldPortalType)(property.Resolve <int>("pt") ?? 0);
     Script   = property.ResolveOrDefault <string>("script");
     ToMap    = property.Resolve <int>("tm") ?? int.MinValue;
     ToName   = property.ResolveOrDefault <string>("tn");
     Position = new Point(
         property.Resolve <int>("x") ?? int.MinValue,
         property.Resolve <int>("y") ?? int.MinValue
         );
 }
示例#8
0
        public SetItemInfoTemplate(int id, IDataProperty property)
        {
            ID = id;

            SetCompleteCount = property.Resolve <int>("completeCount") ?? 0;

            TemplateID = property.Resolve("ItemID")?.Children
                         .Select(c => c.Resolve <int>() ?? 0)
                         .ToImmutableList();
            Effect = property.Resolve("Effect")?.Children
                     .ToImmutableDictionary(
                c => Convert.ToInt32(c.Name),
                c => new SetItemEffectTemplate(Convert.ToInt32(c.Name), c.ResolveAll())
                );
        }
示例#9
0
        public static CommodityTemplate Parse(int id, IDataProperty property)
        {
            var t = new CommodityTemplate {
                ID = id
            };

            property.Resolve(p =>
            {
                t.ItemID         = p.Resolve <int>("ItemId") ?? 0;
                t.Count          = p.Resolve <short>("Count") ?? 1;
                t.Priority       = p.Resolve <byte>("Priority") ?? 0;
                t.Price          = p.Resolve <int>("Price") ?? 0;
                t.Bonus          = p.Resolve <byte>("Bonus") ?? 0;
                t.Period         = p.Resolve <short>("Period") ?? 0;
                t.ReqPOP         = p.Resolve <short>("ReqPOP") ?? 0;
                t.ReqLEV         = p.Resolve <short>("ReqLEV") ?? 0;
                t.MaplePoint     = p.Resolve <int>("MaplePoint") ?? 0;
                t.Meso           = p.Resolve <int>("Meso") ?? 0;
                t.ForPremiumUser = p.Resolve <bool>("Premium") ?? false;
                t.Gender         = p.Resolve <sbyte>("Gender") ?? 0;
                t.OnSale         = p.Resolve <bool>("OnSale") ?? false;
                t.Class          = p.Resolve <byte>("Class") ?? 0;
                t.Limit          = p.Resolve <byte>("Limit") ?? 0;
                t.PbCash         = p.Resolve <short>("PbCash") ?? 0;
                t.PbPoint        = p.Resolve <short>("PbPoint") ?? 0;
                t.PbGift         = p.Resolve <short>("PbGift") ?? 0;
            });

            return(t);
        }
示例#10
0
        public ItemOptionTemplate(int id, IDataProperty property)
        {
            ID = id;

            property.Resolve("info")?.ResolveAll(i =>
            {
                ReqLevel   = i?.Resolve <short>("reqLevel") ?? 0;
                OptionType = i?.Resolve <short>("optionType") ?? 0;
            });

            LevelData = property.Resolve("level").Children
                        .ToImmutableDictionary(
                l => Convert.ToInt32(l.Name),
                l => new ItemOptionLevelTemplate(Convert.ToInt32(l.Name), l.ResolveAll())
                );
        }
示例#11
0
        public static SetItemEffectTemplate Parse(int id, IDataProperty property)
        {
            var t = new SetItemEffectTemplate {
                ID = id
            };

            property.Resolve(p =>
            {
                t.IncSTR   = p.Resolve <short>("incSTR") ?? 0;
                t.IncDEX   = p.Resolve <short>("incDEX") ?? 0;
                t.IncINT   = p.Resolve <short>("incINT") ?? 0;
                t.IncLUK   = p.Resolve <short>("incLUK") ?? 0;
                t.IncMaxHP = p.Resolve <short>("incMHP") ?? 0;
                t.IncMaxMP = p.Resolve <short>("incMMP") ?? 0;
                t.IncPAD   = p.Resolve <short>("incPAD") ?? 0;
                t.IncMAD   = p.Resolve <short>("incMAD") ?? 0;
                t.IncPDD   = p.Resolve <short>("incPDD") ?? 0;
                t.IncMDD   = p.Resolve <short>("incMDD") ?? 0;
                t.IncACC   = p.Resolve <short>("incACC") ?? 0;
                t.IncEVA   = p.Resolve <short>("incEVA") ?? 0;
                t.IncCraft = p.Resolve <short>("incCraft") ?? 0;
                t.IncSpeed = p.Resolve <short>("incSpeed") ?? 0;
                t.IncJump  = p.Resolve <short>("incJump") ?? 0;
            });
            return(t);
        }
示例#12
0
 public CashPackageTemplate(int id, IDataProperty property)
 {
     ID        = id;
     PackageSN = property.Resolve("SN").Children
                 .Select(c => c.Resolve <int>() ?? 0)
                 .ToArray();
 }
        public static ItemOptionLevelTemplate Parse(int id, IDataProperty property)
        {
            var t = new ItemOptionLevelTemplate {
                ID = id
            };

            property.Resolve(p =>
            {
                t.Prob     = p.Resolve <int>("prop") ?? 0;
                t.Time     = p.Resolve <int>("time") ?? 0;
                t.IncSTR   = p.Resolve <short>("incSTR") ?? 0;
                t.IncDEX   = p.Resolve <short>("incDEX") ?? 0;
                t.IncINT   = p.Resolve <short>("incINT") ?? 0;
                t.IncLUK   = p.Resolve <short>("incLUK") ?? 0;
                t.IncHP    = p.Resolve <int>("incHP") ?? 0;
                t.IncMP    = p.Resolve <int>("incMP") ?? 0;
                t.IncACC   = p.Resolve <short>("incACC") ?? 0;
                t.IncEVA   = p.Resolve <short>("incEVA") ?? 0;
                t.IncSpeed = p.Resolve <short>("incSpeed") ?? 0;
                t.IncJump  = p.Resolve <short>("incJump") ?? 0;
                t.IncMaxHP = p.Resolve <short>("incMHP") ?? 0;
                t.IncMaxMP = p.Resolve <short>("incMMP") ?? 0;
                t.IncPAD   = p.Resolve <short>("incPAD") ?? 0;
                t.IncMAD   = p.Resolve <short>("incMAD") ?? 0;
                t.IncPDD   = p.Resolve <short>("incPDD") ?? 0;
                t.IncMDD   = p.Resolve <short>("incMDD") ?? 0;

                t.IncSTRr   = p.Resolve <short>("incSTRr") ?? 0;
                t.IncDEXr   = p.Resolve <short>("incDEXr") ?? 0;
                t.IncINTr   = p.Resolve <short>("incINTr") ?? 0;
                t.IncLUKr   = p.Resolve <short>("incLUKr") ?? 0;
                t.IncACCr   = p.Resolve <short>("incACCr") ?? 0;
                t.IncEVAr   = p.Resolve <short>("incEVAr") ?? 0;
                t.IncMaxHPr = p.Resolve <short>("incMHPr") ?? 0;
                t.IncMaxMPr = p.Resolve <short>("incMMPr") ?? 0;
                t.IncPADr   = p.Resolve <short>("incPADr") ?? 0;
                t.IncMADr   = p.Resolve <short>("incMADr") ?? 0;
                t.IncPDDr   = p.Resolve <short>("incPDDr") ?? 0;
                t.IncMDDr   = p.Resolve <short>("incMDDr") ?? 0;

                t.IncCr           = p.Resolve <short>("incCr") ?? 0;
                t.IncAllSkill     = p.Resolve <short>("incAllskill") ?? 0;
                t.RecoveryHP      = p.Resolve <short>("RecoveryHP") ?? 0;
                t.RecoveryMP      = p.Resolve <short>("RecoveryMP") ?? 0;
                t.RecoveryUP      = p.Resolve <short>("RecoveryUP") ?? 0;
                t.MPConReduce     = p.Resolve <short>("mpconReduce") ?? 0;
                t.MPConRestore    = p.Resolve <short>("mpRestore") ?? 0;
                t.IgnoreTargetDEF = p.Resolve <short>("ignoreTargetDEF") ?? 0;
                t.IgnoreDAM       = p.Resolve <short>("ignoreDAM") ?? 0;
                t.IgnoreDAMr      = p.Resolve <short>("ignoreDAMr") ?? 0;
                t.IncDAMr         = p.Resolve <short>("incDAMr") ?? 0;
                t.DAMReflect      = p.Resolve <short>("DAMreflect") ?? 0;
                t.AttackType      = p.Resolve <short>("attackType") ?? 0;
                t.IncMesoProb     = p.Resolve <int>("incMesoProp") ?? 0;
                t.IncRewardProb   = p.Resolve <int>("incRewardProp") ?? 0;
                t.Level           = p.Resolve <short>("level") ?? 0;
                t.Boss            = p.Resolve <short>("boss") ?? 0;
            });
            return(t);
        }
示例#14
0
        public BestTemplate(int id, IDataProperty property)
        {
            ID = id;

            Category    = Convert.ToInt32(property.Parent.Parent.Name);
            Gender      = property.Parent.Name == "male" ? 0 : 1;
            CommoditySN = property.Resolve <int>() ?? 0;
        }
示例#15
0
        public CategoryDiscountTemplate(int id, IDataProperty property)
        {
            ID = id;

            Category     = Convert.ToByte(property.Parent.Name);
            CategorySub  = Convert.ToByte(property.Name);
            DiscountRate = property.Resolve <byte>() ?? 0;
        }
示例#16
0
        public MobTemplate(int id, IDataProperty property)
        {
            ID = id;

            if (property.Resolve("fly") != null)
            {
                MoveAbility = MoveAbilityType.Fly;
            }
            else if (property.Resolve("jump") != null)
            {
                MoveAbility = MoveAbilityType.Jump;
            }
            else if (property.Resolve("move") != null)
            {
                MoveAbility = MoveAbilityType.Walk;
            }
            else
            {
                MoveAbility = MoveAbilityType.Stop;
            }

            Level = property.Resolve <short>("info/level") ?? 0;
            EXP   = property.Resolve <int>("info/exp") ?? 0;
            MaxHP = property.Resolve <int>("info/maxHP") ?? 1;
            MaxMP = property.Resolve <int>("info/maxMP") ?? 0;
        }
        public QuestOperationTemplate(int id, IDataProperty property)
        {
            ID = id;

            Items = property.Resolve("item")?.Children
                    .Select(c => new QuestItemEntry(c.ResolveAll()))
                    .ToImmutableList()
                    ?? ImmutableList <QuestItemEntry> .Empty;
        }
示例#18
0
        public NPCTemplate(int id, IDataProperty property)
        {
            ID = id;

            property.Resolve("info").ResolveAll(i =>
            {
                TrunkPut  = i.Resolve <int>("trunkPut") ?? 0;
                TrunkGet  = i.Resolve <int>("trunkGet") ?? 0;
                StoreBank = i.Resolve <bool>("storeBank") ?? false;
                Parcel    = i.Resolve <bool>("parcel") ?? false;
                Scripts   = i.Resolve("script")?.Children
                            .Select(p => new NPCScriptTemplate(p))
                            .ToImmutableList()
                            ?? ImmutableList <NPCScriptTemplate> .Empty;
            });

            Move = property.Resolve("move") != null;
        }
示例#19
0
        public override void Parse(int id, IDataProperty p)
        {
            p.Resolve("info").Resolve(info =>
            {
                base.Parse(id, info);

                Life = info.Resolve <short>("life") ?? -1;
            });
        }
示例#20
0
 public static CashPackageTemplate Parse(int id, IDataProperty property)
 {
     return(new CashPackageTemplate
     {
         ID = id,
         PackageSN = property.Resolve("SN").Children
                     .Select(c => c.Resolve <int>() ?? 0)
                     .ToArray()
     });
 }
示例#21
0
        public override void Parse(int id, IDataProperty p)
        {
            p.Resolve("info").Resolve(info =>
            {
                base.Parse(id, info);

                UnitPrice  = info.Resolve <double>("unitPrice") ?? 0.0;
                MaxPerSlot = info.Resolve <short>("slotMax") ?? 100;
            });
        }
示例#22
0
        public static FieldTemplate Parse(int id, IDataProperty property)
        {
            var t = new FieldTemplate {
                ID = id
            };

            property.Resolve(p =>
            {
                t.Footholds = p.Resolve("foothold").Children
                              .SelectMany(c => c.Children)
                              .SelectMany(c => c.Children)
                              .Select(FieldFootholdTemplate.Parse)
                              .DistinctBy(x => x.ID) // 211040101 has duplicate footholds
                              .ToDictionary(x => x.ID, x => x);
                t.Portals = p.Resolve("portal").Children
                            .Select(FieldPortalTemplate.Parse)
                            .DistinctBy(x => x.ID)
                            .ToDictionary(x => x.ID, x => x);
                t.Life = p.Resolve("life").Children
                         .Select(FieldLifeTemplate.Parse)
                         .ToList();
                t.Reactors = p.Resolve("reactor").Children
                             .Select(FieldReactorTemplate.Parse)
                             .ToList();

                p.Resolve("info").Resolve(i =>
                {
                    t.Limit = (FieldOpt)(i.Resolve <int>("fieldLimit") ?? 0);

                    var footholds = t.Footholds.Values;
                    var leftTop   = new Point(
                        footholds.Select(f => f.X1 > f.X2 ? f.X2 : f.X1).OrderBy(f => f).First(),
                        footholds.Select(f => f.Y1 > f.Y2 ? f.Y2 : f.Y1).OrderBy(f => f).First()
                        );
                    var rightBottom = new Point(
                        footholds.Select(f => f.X1 > f.X2 ? f.X1 : f.X2).OrderByDescending(f => f).First(),
                        footholds.Select(f => f.Y1 > f.Y2 ? f.Y1 : f.Y2).OrderByDescending(f => f).First()
                        );

                    leftTop = new Point(
                        i.Resolve <int>("VRLeft") ?? leftTop.X,
                        i.Resolve <int>("VRTop") ?? leftTop.Y
                        );
                    rightBottom = new Point(
                        i.Resolve <int>("VRRight") ?? rightBottom.X,
                        i.Resolve <int>("VRBottom") ?? rightBottom.Y
                        );

                    t.Bounds = Rectangle.FromLTRB(leftTop.X, leftTop.Y, rightBottom.X, rightBottom.Y);
                });
            });
            return(t);
        }
        public static CategoryDiscountTemplate Parse(int id, IDataProperty property)
        {
            var t = new CategoryDiscountTemplate
            {
                ID           = id,
                Category     = Convert.ToByte(property.Parent.Name),
                CategorySub  = Convert.ToByte(property.Name),
                DiscountRate = property.Resolve <byte>() ?? 0
            };

            return(t);
        }
示例#24
0
        public static BestTemplate Parse(int id, IDataProperty property)
        {
            var t = new BestTemplate
            {
                ID          = id,
                Category    = Convert.ToInt32(property.Parent.Parent.Name),
                Gender      = property.Parent.Name == "male" ? 0 : 1,
                CommoditySN = property.Resolve <int>() ?? 0
            };

            return(t);
        }
示例#25
0
        public static FieldStringTemplate Parse(int id, IDataProperty property)
        {
            var t = new FieldStringTemplate {
                ID = id
            };

            property.Resolve(p =>
            {
                t.Name       = p.ResolveOrDefault <string>("mapName") ?? "NO-NAME";
                t.StreetName = p.ResolveOrDefault <string>("streetName");
            });
            return(t);
        }
示例#26
0
        public static ItemStringTemplate Parse(int id, IDataProperty property)
        {
            var t = new ItemStringTemplate {
                ID = id
            };

            property.Resolve(p =>
            {
                t.Name = p.ResolveOrDefault <string>("name") ?? "NO-NAME";
                //t.Desc = p.ResolveOrDefault<string>("desc");
            });
            return(t);
        }
示例#27
0
        public MakeCharInfoTemplate(MakeCharInfoType type, byte gender, IDataProperty property)
        {
            ID     = (int)type * 0x2 + gender;
            Type   = type;
            Gender = gender;

            Face      = property.Resolve("0").Children.Select(c => c.Resolve <int>() ?? 0).ToArray();
            Hair      = property.Resolve("1").Children.Select(c => c.Resolve <int>() ?? 0).ToArray();
            HairColor = property.Resolve("2").Children.Select(c => c.Resolve <int>() ?? 0).ToArray();
            Skin      = property.Resolve("3").Children.Select(c => c.Resolve <int>() ?? 0).ToArray();
            Coat      = property.Resolve("4").Children.Select(c => c.Resolve <int>() ?? 0).ToArray();
            Pants     = property.Resolve("5").Children.Select(c => c.Resolve <int>() ?? 0).ToArray();
            Shoes     = property.Resolve("6").Children.Select(c => c.Resolve <int>() ?? 0).ToArray();
            Weapon    = property.Resolve("7").Children.Select(c => c.Resolve <int>() ?? 0).ToArray();
        }
示例#28
0
        public static NPCScriptTemplate Parse(IDataProperty property)
        {
            var t = new NPCScriptTemplate();

            property.Resolve(s =>
            {
                t.ID = Convert.ToInt32(s.Name);

                t.Script = s.ResolveOrDefault <string>("script");
                t.Start  = s.Resolve <int>("start") ?? 0;
                t.End    = s.Resolve <int>("end") ?? 0;
            });
            return(t);
        }
示例#29
0
        public static FieldReactorTemplate Parse(IDataProperty property)
        {
            var t = new FieldReactorTemplate();

            property.Resolve(p =>
            {
                t.ID       = p.Resolve <int>("id") ?? -1;
                t.F        = p.Resolve <bool>("f") ?? false;
                t.Position = new Point(
                    p.Resolve <int>("x") ?? int.MinValue,
                    p.Resolve <int>("y") ?? int.MinValue
                    );
            });
            return(t);
        }
示例#30
0
        public SkillTemplate(int id, IDataProperty property)
        {
            ID = id;

            var entry = property.Resolve("common");
            ImmutableDictionary <int, SkillLevelTemplate> levelData;

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

                levelData = Enumerable
                            .Range(1, maxLevel)
                            .ToImmutableDictionary(
                    i => i,
                    i => new SkillLevelTemplate(i, id, entry.ResolveAll())
                    );
            }
            else
            {
                entry     = property.Resolve("level");
                levelData = entry.Children.ToImmutableDictionary(
                    c => Convert.ToInt32(c.Name),
                    c => new SkillLevelTemplate(Convert.ToInt32(c.Name), id, c.ResolveAll(), false)
                    );
            }

            MaxLevel = (short)levelData.Count;
            Summon   = property.Resolve("summon") != null;
            ReqSkill = property.Resolve("req")?.Children
                       .ToImmutableDictionary(
                c => Convert.ToInt32(c.Name),
                c => c.Resolve <int>() ?? 0
                ) ?? ImmutableDictionary <int, int> .Empty;
            LevelData = levelData;
        }