From 06cbef88f73b06f58bea61cbc6fb2581ea6dc19b Mon Sep 17 00:00:00 2001 From: NotKappa Date: Fri, 10 Feb 2023 22:29:18 +0300 Subject: [PATCH] Add more fields to MonsterInfo --- .../Infos/IMonsterInfo.cs | 20 +++++++++++++++++++ .../Data/MonsterInfo.cs | 12 +++++++++++ .../DatabaseMigrator.cs | 6 +++++- .../Parsers/MonsterParser.cs | 12 ++++++++--- 4 files changed, 46 insertions(+), 4 deletions(-) diff --git a/Data/NosSmooth.Data.Abstractions/Infos/IMonsterInfo.cs b/Data/NosSmooth.Data.Abstractions/Infos/IMonsterInfo.cs index 49a01a5..dac5502 100644 --- a/Data/NosSmooth.Data.Abstractions/Infos/IMonsterInfo.cs +++ b/Data/NosSmooth.Data.Abstractions/Infos/IMonsterInfo.cs @@ -22,4 +22,24 @@ public interface IMonsterInfo : IVNumInfo /// Gets the default level of the monster. /// ushort Level { get; } + + /// + /// Gets the default Range of the monster. + /// + short Range { get; } + + /// + /// Gets the default NoticeRange of the monster. + /// + short NoticeRange { get; } + + /// + /// Gets the default castTime of the monster. + /// + int CastTime { get; } + + /// + /// Gets if the monster is Hostile. + /// + bool Hostile { get; } } \ No newline at end of file diff --git a/Data/NosSmooth.Data.Database/Data/MonsterInfo.cs b/Data/NosSmooth.Data.Database/Data/MonsterInfo.cs index 3790f55..436050c 100644 --- a/Data/NosSmooth.Data.Database/Data/MonsterInfo.cs +++ b/Data/NosSmooth.Data.Database/Data/MonsterInfo.cs @@ -39,4 +39,16 @@ public class MonsterInfo : IMonsterInfo /// public ushort Level { get; set; } + + /// + public short Range { get; set; } + + /// + public short NoticeRange { get; set; } + + /// + public int CastTime { get; set; } + + /// + public bool Hostile { get; set; } } \ No newline at end of file diff --git a/Data/NosSmooth.Data.Database/DatabaseMigrator.cs b/Data/NosSmooth.Data.Database/DatabaseMigrator.cs index 20dd4e6..b8c5c99 100644 --- a/Data/NosSmooth.Data.Database/DatabaseMigrator.cs +++ b/Data/NosSmooth.Data.Database/DatabaseMigrator.cs @@ -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); } diff --git a/Data/NosSmooth.Data.NOSFiles/Parsers/MonsterParser.cs b/Data/NosSmooth.Data.NOSFiles/Parsers/MonsterParser.cs index b021f70..6c39ec6 100644 --- a/Data/NosSmooth.Data.NOSFiles/Parsers/MonsterParser.cs +++ b/Data/NosSmooth.Data.NOSFiles/Parsers/MonsterParser.cs @@ -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 var vnum = item.GetEntry("VNUM").Read(1); var nameKey = item.GetEntry("NAME").Read(1); + var zSkill = item.GetEntry("ZSKILL"); + var preatt = item.GetEntry("PREATT"); + result.Add ( vnum, @@ -39,7 +41,11 @@ public class MonsterParser : IInfoParser ( vnum, new TranslatableString(TranslationRoot.Monster, nameKey), - item.GetEntry("LEVEL").Read(1) + item.GetEntry("LEVEL").Read(1), + zSkill.Read(2), + preatt.Read(2), + zSkill.Read(3), + preatt.Read(1) == 0 ) ); } @@ -47,5 +53,5 @@ public class MonsterParser : IInfoParser 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 -- 2.49.0