~ruther/NosSmooth

46cd10970fbb240fcbb8d38ad4ea84e4a38be712 — Rutherther 2 years ago 99aaa9b + 06cbef8
Merge pull request #72 from plsfixrito/MonsterInfoFields

Add more fields to MonsterInfo
M Data/NosSmooth.Data.Abstractions/Infos/IMonsterInfo.cs => Data/NosSmooth.Data.Abstractions/Infos/IMonsterInfo.cs +20 -0
@@ 22,4 22,24 @@ public interface IMonsterInfo : IVNumInfo
    /// Gets the default level of the monster.
    /// </summary>
    ushort Level { get; }

    /// <summary>
    /// Gets the default Range of the monster.
    /// </summary>
    short Range { get; }

    /// <summary>
    /// Gets the default NoticeRange of the monster.
    /// </summary>
    short NoticeRange { get; }

    /// <summary>
    /// Gets the default castTime of the monster.
    /// </summary>
    int CastTime { get; }

    /// <summary>
    /// Gets if the monster is Hostile.
    /// </summary>
    bool Hostile { get; }
}
\ No newline at end of file

M Data/NosSmooth.Data.Database/Data/MonsterInfo.cs => Data/NosSmooth.Data.Database/Data/MonsterInfo.cs +12 -0
@@ 39,4 39,16 @@ public class MonsterInfo : IMonsterInfo

    /// <inheritdoc />
    public ushort Level { get; set; }

    /// <inheritdoc />
    public short Range { get; set; }

    /// <inheritdoc />
    public short NoticeRange { get; set; }

    /// <inheritdoc />
    public int CastTime { get; set; }

    /// <inheritdoc />
    public bool Hostile { get; set; }
}
\ No newline at end of file

M Data/NosSmooth.Data.Database/DatabaseMigrator.cs => Data/NosSmooth.Data.Database/DatabaseMigrator.cs +5 -1
@@ 166,7 166,11 @@ public class DatabaseMigrator
            {
                VNum = monster.VNum,
                NameKey = monster.Name.Key,
                Level = monster.Level
                Level = monster.Level,
                Range = monster.Range,
                NoticeRange = monster.NoticeRange,
                CastTime = monster.CastTime,
                Hostile = monster.Hostile,
            };
            dbContext.Add(monsterInfo);
        }

M Data/NosSmooth.Data.NOSFiles/Parsers/MonsterParser.cs => Data/NosSmooth.Data.NOSFiles/Parsers/MonsterParser.cs +9 -3
@@ 4,7 4,6 @@
//  Copyright (c) František Boháček. All rights reserved.
//  Licensed under the MIT license. See LICENSE file in the project root for full license information.

using NosSmooth.Data.Abstractions.Enums;
using NosSmooth.Data.Abstractions.Infos;
using NosSmooth.Data.Abstractions.Language;
using NosSmooth.Data.NOSFiles.Parsers.Dat;


@@ 32,6 31,9 @@ public class MonsterParser : IInfoParser<IMonsterInfo>

            var vnum = item.GetEntry("VNUM").Read<int>(1);
            var nameKey = item.GetEntry("NAME").Read<string>(1);
            var zSkill = item.GetEntry("ZSKILL");
            var preatt = item.GetEntry("PREATT");

            result.Add
            (
                vnum,


@@ 39,7 41,11 @@ public class MonsterParser : IInfoParser<IMonsterInfo>
                (
                    vnum,
                    new TranslatableString(TranslationRoot.Monster, nameKey),
                    item.GetEntry("LEVEL").Read<ushort>(1)
                    item.GetEntry("LEVEL").Read<ushort>(1),
                    zSkill.Read<short>(2),
                    preatt.Read<short>(2),
                    zSkill.Read<int>(3),
                    preatt.Read<int>(1) == 0
                )
            );
        }


@@ 47,5 53,5 @@ public class MonsterParser : IInfoParser<IMonsterInfo>
        return result;
    }

    private record MonsterInfo(int VNum, TranslatableString Name, ushort Level) : IMonsterInfo;
    private record MonsterInfo(int VNum, TranslatableString Name, ushort Level, short Range, short NoticeRange, int CastTime, bool Hostile) : IMonsterInfo;
}
\ No newline at end of file

Do not follow this link