Ejemplo n.º 1
0
        protected override void ReadEntry(JObject entry)
        {
            entry.AssertNotMissing("monsterId", "className", "name");

            var info = new MonsterData();

            info.Id              = entry.ReadInt("monsterId");
            info.ClassName       = entry.ReadString("className");
            info.Name            = entry.ReadString("name");
            info.Level           = entry.ReadInt("level");
            info.Exp             = entry.ReadInt("exp");
            info.ClassExp        = entry.ReadInt("classExp");
            info.Hp              = entry.ReadInt("hp");
            info.PhysicalDefense = entry.ReadInt("physicalDefense");

            if (entry.ContainsKey("drops"))
            {
                foreach (JObject dropEntry in entry["drops"])
                {
                    dropEntry.AssertNotMissing("itemId", "dropChance", "minQuantity", "maxQuantity");

                    var dropData = new DropData();

                    dropData.ItemId     = dropEntry.ReadInt("itemId");
                    dropData.DropChance = dropEntry.ReadFloat("dropChance");
                    dropData.MinAmount  = dropEntry.ReadInt("minQuantity");
                    dropData.MaxAmount  = dropEntry.ReadInt("maxQuantity");

                    info.Drops.Add(dropData);
                }
            }

            this.Entries[info.Id] = info;
        }
Ejemplo n.º 2
0
        protected override void ReadEntry(JObject entry)
        {
            entry.AssertNotMissing("monsterId", "className", "name", "localKey", "level", "exp", "classExp", "race", "size", "hp", "sp", "pAttackMin", "pAttackMax", "mAttackMin", "mAttackMax", "pDefense", "mDefense");

            var info = new MonsterData();

            info.Id        = entry.ReadInt("monsterId");
            info.ClassName = entry.ReadString("className");
            info.Name      = entry.ReadString("name");
            info.LocalKey  = entry.ReadString("localKey");
            info.Race      = entry.ReadEnum <RaceType>("race");
            info.Size      = entry.ReadEnum <Size>("size");

            info.Level    = entry.ReadInt("level");
            info.Exp      = entry.ReadInt("exp");
            info.ClassExp = entry.ReadInt("classExp");
            info.Hp       = entry.ReadInt("hp");
            info.Sp       = entry.ReadInt("sp");

            info.PhysicalAttackMin = entry.ReadInt("pAttackMin");
            info.PhysicalAttackMax = entry.ReadInt("pAttackMax");
            info.MagicalAttackMin  = entry.ReadInt("mAttackMin");
            info.MagicalAttackMax  = entry.ReadInt("mAttackMax");
            info.PhysicalDefense   = entry.ReadInt("pDefense");
            info.MagicalDefense    = entry.ReadInt("mDefense");
            info.HitRatio          = entry.ReadInt("mDefense");
            info.BlockBreak        = entry.ReadInt("mDefense");
            info.BlockRate         = entry.ReadInt("mDefense");
            info.CritAttack        = entry.ReadInt("mDefense");
            info.CritDefenseRate   = entry.ReadInt("mDefense");
            info.CritHitRate       = entry.ReadInt("mDefense");
            info.DodgeRate         = entry.ReadInt("mDefense");

            if (entry.ContainsKey("drops"))
            {
                foreach (JObject dropEntry in entry["drops"])
                {
                    dropEntry.AssertNotMissing("itemId", "chance");

                    var dropData = new DropData();

                    dropData.ItemId     = dropEntry.ReadInt("itemId");
                    dropData.DropChance = dropEntry.ReadFloat("chance");
                    dropData.MinAmount  = dropEntry.ReadInt("minQuantity", 1);
                    dropData.MaxAmount  = dropEntry.ReadInt("maxQuantity", 1);

                    if (dropData.MaxAmount < dropData.MinAmount)
                    {
                        dropData.MaxAmount = dropData.MinAmount;
                    }

                    info.Drops.Add(dropData);
                }
            }

            this.Entries[info.Id] = info;
        }