diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..48051fb --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,11 @@ + + + net9.0 + latest + true + enable + true + true + true + + \ No newline at end of file diff --git a/Directory.Packages.props b/Directory.Packages.props index bacb0cd..ea22792 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -6,24 +6,24 @@ - - - - - - - - + + + + + + + + - + - - - + + + - + diff --git a/Open5ETools.sln b/Open5ETools.sln deleted file mode 100644 index a222e0c..0000000 --- a/Open5ETools.sln +++ /dev/null @@ -1,70 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.0.31903.59 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{D34F588F-65B1-45D5-A633-1F00B90DE706}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Open5ETools.Core", "src\Open5ETools.Core\Open5ETools.Core.csproj", "{7D5E4F1B-649F-4D45-B2DF-83C2D11A216F}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Open5ETools.Infrastructure", "src\Open5ETools.Infrastructure\Open5ETools.Infrastructure.csproj", "{B7EDA877-24EC-4E4A-A3E2-BAD75AC67D3C}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Open5ETools.Resources", "src\Open5ETools.Resources\Open5ETools.Resources.csproj", "{C976A039-B5CE-4947-91FA-CD56D974E9A5}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Open5ETools.Web", "src\Open5ETools.Web\Open5ETools.Web.csproj", "{23AE35F2-D757-439D-8208-A506CACC33E0}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{4EDA6E00-B995-409A-A0D7-9B6EC26D0576}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Open5ETools.Core.Tests", "tests\Open5ETools.Core.Tests\Open5ETools.Core.Tests.csproj", "{E11E5455-995F-4BD5-B429-03AAC8C39852}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{980674C6-A531-4C0E-B6BD-F2AAA1BF782B}" - ProjectSection(SolutionItems) = preProject - .gitignore = .gitignore - Directory.Packages.props = Directory.Packages.props - docker-compose.yml = docker-compose.yml - LICENSE = LICENSE - OpenGameLicense.txt = OpenGameLicense.txt - README.md = README.md - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {7D5E4F1B-649F-4D45-B2DF-83C2D11A216F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7D5E4F1B-649F-4D45-B2DF-83C2D11A216F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7D5E4F1B-649F-4D45-B2DF-83C2D11A216F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7D5E4F1B-649F-4D45-B2DF-83C2D11A216F}.Release|Any CPU.Build.0 = Release|Any CPU - {B7EDA877-24EC-4E4A-A3E2-BAD75AC67D3C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B7EDA877-24EC-4E4A-A3E2-BAD75AC67D3C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B7EDA877-24EC-4E4A-A3E2-BAD75AC67D3C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B7EDA877-24EC-4E4A-A3E2-BAD75AC67D3C}.Release|Any CPU.Build.0 = Release|Any CPU - {C976A039-B5CE-4947-91FA-CD56D974E9A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C976A039-B5CE-4947-91FA-CD56D974E9A5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C976A039-B5CE-4947-91FA-CD56D974E9A5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C976A039-B5CE-4947-91FA-CD56D974E9A5}.Release|Any CPU.Build.0 = Release|Any CPU - {23AE35F2-D757-439D-8208-A506CACC33E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {23AE35F2-D757-439D-8208-A506CACC33E0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {23AE35F2-D757-439D-8208-A506CACC33E0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {23AE35F2-D757-439D-8208-A506CACC33E0}.Release|Any CPU.Build.0 = Release|Any CPU - {E11E5455-995F-4BD5-B429-03AAC8C39852}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E11E5455-995F-4BD5-B429-03AAC8C39852}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E11E5455-995F-4BD5-B429-03AAC8C39852}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E11E5455-995F-4BD5-B429-03AAC8C39852}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {7D5E4F1B-649F-4D45-B2DF-83C2D11A216F} = {D34F588F-65B1-45D5-A633-1F00B90DE706} - {B7EDA877-24EC-4E4A-A3E2-BAD75AC67D3C} = {D34F588F-65B1-45D5-A633-1F00B90DE706} - {C976A039-B5CE-4947-91FA-CD56D974E9A5} = {D34F588F-65B1-45D5-A633-1F00B90DE706} - {23AE35F2-D757-439D-8208-A506CACC33E0} = {D34F588F-65B1-45D5-A633-1F00B90DE706} - {E11E5455-995F-4BD5-B429-03AAC8C39852} = {4EDA6E00-B995-409A-A0D7-9B6EC26D0576} - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {4C60A8FA-82E5-4760-84F7-44FD39C5FD06} - EndGlobalSection -EndGlobal diff --git a/Open5ETools.slnx b/Open5ETools.slnx new file mode 100644 index 0000000..5d3ec7f --- /dev/null +++ b/Open5ETools.slnx @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/src/Open5ETools.Core/Common/Constants.cs b/src/Open5ETools.Core/Common/Constants.cs index 4daaf06..8be994c 100644 --- a/src/Open5ETools.Core/Common/Constants.cs +++ b/src/Open5ETools.Core/Common/Constants.cs @@ -229,7 +229,6 @@ public static class Constants "28", "29", "30" -, ]; public static readonly int[,] Thresholds = { diff --git a/src/Open5ETools.Core/Common/Exceptions/ServiceAggregateException.cs b/src/Open5ETools.Core/Common/Exceptions/ServiceAggregateException.cs index 2ba7af8..185420a 100644 --- a/src/Open5ETools.Core/Common/Exceptions/ServiceAggregateException.cs +++ b/src/Open5ETools.Core/Common/Exceptions/ServiceAggregateException.cs @@ -1,13 +1,14 @@ using System.Collections.ObjectModel; namespace Open5ETools.Core.Common.Exceptions; + public class ServiceAggregateException : Exception { private readonly IEnumerable _innerExceptions; public ReadOnlyCollection GetInnerExceptions() { - return new ReadOnlyCollection(_innerExceptions.ToList()); + return new ReadOnlyCollection([.. _innerExceptions]); } public ServiceAggregateException(IEnumerable innerExceptions) diff --git a/src/Open5ETools.Core/Common/Exceptions/ServiceException.cs b/src/Open5ETools.Core/Common/Exceptions/ServiceException.cs index 23b254a..8720924 100644 --- a/src/Open5ETools.Core/Common/Exceptions/ServiceException.cs +++ b/src/Open5ETools.Core/Common/Exceptions/ServiceException.cs @@ -2,7 +2,6 @@ public class ServiceException : Exception { - public const string GeneralError = "GeneralError"; public const string GeneralAggregateError = "GeneralAggregateError"; public const string EntityNotFoundException = "EntityNotFoundException"; public const string RequiredValidation = "RequiredValidation"; @@ -12,30 +11,28 @@ public class ServiceException : Exception public string? Field { get; } - public ServiceException() : base(GeneralError) - { - } - - public ServiceException(string message, params string[] args) : base(message) + public ServiceException(string message, params object[] args) : base(message) { Field = null; Args = args; } - public ServiceException(string message, string field, params string[] args) : base(message) + public ServiceException(string message, string field, params object[] args) : base(message) { Field = field; Args = args; } - public ServiceException(string message, Exception innerException, params string[] args) : base(message, innerException) + public ServiceException(string message, Exception innerException, params object[] args) : base(message, + innerException) { Field = null; Args = args; } - public ServiceException(string message, string field, Exception innerException, params string[] args) : base(message, innerException) + public ServiceException(string message, string field, Exception innerException, params object[] args) : base( + message, innerException) { Field = field; Args = args; diff --git a/src/Open5ETools.Core/Common/Exceptions/ServiceExceptionExtensions.cs b/src/Open5ETools.Core/Common/Exceptions/ServiceExceptionExtensions.cs index e5d9790..5d50889 100644 --- a/src/Open5ETools.Core/Common/Exceptions/ServiceExceptionExtensions.cs +++ b/src/Open5ETools.Core/Common/Exceptions/ServiceExceptionExtensions.cs @@ -1,9 +1,10 @@ using System.Resources; namespace Open5ETools.Core.Common.Exceptions; + public static class ServiceExceptionExtensions { - public static string? LocalizedMessage(this ServiceException serviceException, ResourceManager resourceManager) + private static string? LocalizedMessage(this ServiceException? serviceException, ResourceManager? resourceManager) { if (string.IsNullOrEmpty(serviceException?.Message)) return null; @@ -12,8 +13,10 @@ public static class ServiceExceptionExtensions return serviceException.Message; try { - return serviceException.Args != null ? string.Format(resourceManager.GetString(serviceException.Message) ?? string.Empty, - serviceException.Args) : resourceManager.GetString(serviceException.Message); + return serviceException.Args != null + ? string.Format(resourceManager.GetString(serviceException.Message) ?? string.Empty, + serviceException.Args) + : resourceManager.GetString(serviceException.Message); } catch (Exception) { @@ -25,17 +28,14 @@ public static class ServiceExceptionExtensions public static string? LocalizedMessage(this Exception exception) { - var message = "Internal Generic Error"; - - switch (exception) + var message = exception switch { - case ServiceAggregateException aex: - message = string.Join(" ", aex.GetInnerExceptions().Select(serviceException => serviceException.LocalizedMessage(Resources.Error.ResourceManager))); - break; - case ServiceException ex: - message = ex.LocalizedMessage(Resources.Error.ResourceManager); - break; - } + ServiceAggregateException aex => string.Join(" ", + aex.GetInnerExceptions() + .Select(serviceException => serviceException.LocalizedMessage(Resources.Error.ResourceManager))), + ServiceException ex => ex.LocalizedMessage(Resources.Error.ResourceManager), + _ => "Internal Generic Error" + }; return message; } diff --git a/src/Open5ETools.Core/Common/Extensions/ServiceExtensions.cs b/src/Open5ETools.Core/Common/Extensions/ServiceExtensions.cs index 821a544..60fbb15 100644 --- a/src/Open5ETools.Core/Common/Extensions/ServiceExtensions.cs +++ b/src/Open5ETools.Core/Common/Extensions/ServiceExtensions.cs @@ -8,7 +8,10 @@ public static class ThreadSafeRandom public static Random ThisThreadsRandom { - get { return _local ??= new Random(unchecked(Environment.TickCount * 31 + Environment.CurrentManagedThreadId)); } + get + { + return _local ??= new Random(unchecked(Environment.TickCount * 31 + Environment.CurrentManagedThreadId)); + } } } @@ -32,7 +35,7 @@ public static void Shuffle(this IList list) } } - public static string GetName(this Enum value, ResourceManager resourceManager, string? defaultValue = null) + public static string GetName(this Enum? value, ResourceManager? resourceManager, string? defaultValue = null) { if (value is null) return string.Empty; diff --git a/src/Open5ETools.Core/Common/Helpers/AbilityHelper.cs b/src/Open5ETools.Core/Common/Helpers/AbilityHelper.cs index 00663cb..cb5b90b 100644 --- a/src/Open5ETools.Core/Common/Helpers/AbilityHelper.cs +++ b/src/Open5ETools.Core/Common/Helpers/AbilityHelper.cs @@ -1,14 +1,17 @@ +using System.Globalization; + namespace Open5ETools.Core.Common.Helpers; public static class AbilityHelper { public static string CalcMod(int ability) { - var result = -5 + Math.Floor((decimal)(ability / 2)); + var result = -5 + Math.Floor((decimal)(ability / 2.0)); if (result > 0) { - return '+' + result.ToString(); + return '+' + result.ToString(CultureInfo.InvariantCulture); } - return result.ToString(); + + return result.ToString(CultureInfo.InvariantCulture); } -} +} \ No newline at end of file diff --git a/src/Open5ETools.Core/Common/Helpers/DungeonHelper.cs b/src/Open5ETools.Core/Common/Helpers/DungeonHelper.cs index 6afe876..47a55a4 100644 --- a/src/Open5ETools.Core/Common/Helpers/DungeonHelper.cs +++ b/src/Open5ETools.Core/Common/Helpers/DungeonHelper.cs @@ -5,7 +5,6 @@ using Open5ETools.Core.Common.Interfaces.Services.DM.Generator; using Open5ETools.Core.Common.Models.DM.Generator; using Open5ETools.Core.Common.Models.DM.Services; -using Open5ETools.Core.Helpers; using Open5ETools.Core.Services.DM.Generator; using System.Text; @@ -18,14 +17,18 @@ public class DungeonHelper(IAppDbContext context) : IDungeonHelper // encounter private IList _filteredMonsters = []; private int _sumXp; - private readonly int[] _difficulty = [ + + private readonly int[] _difficulty = + [ 0, 0, 0, 0 ]; + // treasure private int _sumValue; + // door private DungeonTile[][] DungeonTiles { get; set; } = []; private ICollection DoorList { get; set; } = []; @@ -33,7 +36,6 @@ public class DungeonHelper(IAppDbContext context) : IDungeonHelper private int _southCount; private int _eastCount; private int _northCount; - private static readonly Random Random = new(); private IList TreasureList { get; set; } = []; private IList _monsterList = []; @@ -59,7 +61,7 @@ private int GetTreasurePercentage() 1 => GetRandomInt(30, 81), 2 => GetRandomInt(40, 91), 3 => GetRandomInt(50, 101), - _ => 0, + _ => 0 }; } @@ -71,7 +73,7 @@ private int GetMonsterPercentage() 1 => GetRandomInt(50, 91), 2 => GetRandomInt(60, 101), 3 => GetRandomInt(70, 101), - _ => 0, + _ => 0 }; } @@ -82,7 +84,8 @@ public static int GetRandomInt(int min, int max) return max; } - public void AddRoomDescription(DungeonTile[][] dungeonTiles, int x, int y, ICollection roomDescription, ICollection currentDoors) + public void AddRoomDescription(DungeonTile[][] dungeonTiles, int x, int y, + ICollection roomDescription, ICollection currentDoors) { dungeonTiles[x][y].Index = roomDescription.Count; DungeonTiles = dungeonTiles; @@ -104,9 +107,9 @@ public void AddTrapDescription(DungeonTile dungeonTile, ICollection roamingMonsterDescription) + public void AddRoamingMonsterDescription(DungeonTile dungeonTile, + ICollection roamingMonsterDescription) { - dungeonTile.Index = roamingMonsterDescription.Count; roamingMonsterDescription.Add(new RoamingMonsterDescription( GetRoamingName(roamingMonsterDescription.Count + 1), @@ -124,7 +127,8 @@ private static string GetRoomName(int x) return "#ROOM" + x + "#"; } - public void AddNcRoomDescription(DungeonTile dungeonTile, ICollection roomDescription, string doors) + public void AddNcRoomDescription(DungeonTile dungeonTile, ICollection roomDescription, + string doors) { dungeonTile.Index = roomDescription.Count; roomDescription.Add(new RoomDescription( @@ -139,15 +143,19 @@ public void AddNcRoomDescription(DungeonTile dungeonTile, ICollection Parse(monster.ChallengeRating) <= PartyLevel + 2 && + return + [ + .. monsters.Where(monster => Parse(monster.ChallengeRating) <= PartyLevel + 2 && Parse(monster.ChallengeRating) >= PartyLevel / 4.0) - .ToList(); + ]; } - return monsters.Where(monster => Parse(monster.ChallengeRating) <= PartyLevel + 2 && + return + [ + .. monsters.Where(monster => Parse(monster.ChallengeRating) <= PartyLevel + 2 && Parse(monster.ChallengeRating) >= PartyLevel / 4.0 && MonsterType.Contains(monster.Type)) - .ToList(); + ]; } public string GetMonsterDescription() @@ -180,8 +188,8 @@ public void Init(DungeonOptionModel model) ItemsRarity = model.ItemsRarity; DungeonDifficulty = model.DungeonDifficulty; MonsterType = model.MonsterType; - MonsterList = _context.Monsters.AsNoTracking().Select(m => m.JsonMonster).ToList(); - TreasureList = _context.Treasures.AsNoTracking().Select(m => m.TreasureDescription).ToList(); + MonsterList = [.. _context.Monsters.AsNoTracking().Select(m => m.JsonMonster)]; + TreasureList = [.. _context.Treasures.AsNoTracking().Select(m => m.TreasureDescription)]; EncounterInit(); } @@ -192,8 +200,9 @@ private static string GetRoamingName(int count) public string GetRoamingMonsterDescription() { - return CheckPossible() ? CalcEncounter()[9..] : // remove "Monster: " - "No suitable monsters with this settings"; + return CheckPossible() + ? CalcEncounter()[9..] // remove "Monster: " + : "No suitable monsters with this settings"; } private void EncounterInit() @@ -227,8 +236,10 @@ private string CalcEncounter() result.Append(AddMonster(_sumXp / x)); result.Append(", "); } + result.Length -= 2; } + return result.Replace($", {Constants.None}", "").ToString(); } @@ -246,12 +257,15 @@ private string AddMonster(int currentXp) var count = (int)Constants.Multipliers[i, 0]; var allXp = monsterXp * count * Constants.Multipliers[i, 1]; if (allXp <= currentXp && count > 1) - return count + "x " + currentMonster.Name + " (CR: " + currentMonster.ChallengeRating + ") " + monsterXp * count + " XP"; + return count + "x " + currentMonster.Name + " (CR: " + currentMonster.ChallengeRating + ") " + + monsterXp * count + " XP"; if (allXp <= currentXp) return currentMonster.Name + " (CR: " + currentMonster.ChallengeRating + ") " + monsterXp + " XP"; } + monster++; } + return Constants.None; } @@ -263,15 +277,19 @@ public static int GetMonsterXp(Models.Json.Monster monster) public string GetRandomTrapDescription(bool door) { var trapSeverity = GetTrapSeverity(); - var trap = door ? Constants.DoorTraps[GetRandomInt(0, Constants.DoorTraps.Length)] : Constants.SimpleTraps[GetRandomInt(0, Constants.SimpleTraps.Length)]; // get random trap - var trapBase = $"{trap.Name} [{trapSeverity}]: {Constants.Dc} {trap.Spot} to spot, {Constants.Dc} {trap.Disable} to disable ({trap.DisableCheck.GetDescription()})" + - $", {Constants.Dc} {GetTrapSaveDc((int)trapSeverity)} {trap.Save} save or"; + var trap = door + ? Constants.DoorTraps[GetRandomInt(0, Constants.DoorTraps.Length)] + : Constants.SimpleTraps[GetRandomInt(0, Constants.SimpleTraps.Length)]; // get random trap + var trapBase = + $"{trap.Name} [{trapSeverity}]: {Constants.Dc} {trap.Spot} to spot, {Constants.Dc} {trap.Disable} to disable ({trap.DisableCheck.GetDescription()})" + + $", {Constants.Dc} {GetTrapSaveDc((int)trapSeverity)} {trap.Save} save or"; if (trap.DmgType.HasValue) - return $"{trapBase} take {GetTrapDamage((int)trapSeverity)}D10 ({trap.DmgType}) damage{GetTrapAttackBonus((int)trapSeverity, trap)}"; + return + $"{trapBase} take {GetTrapDamage((int)trapSeverity)}D10 ({trap.DmgType}) damage{GetTrapAttackBonus((int)trapSeverity, trap)}"; return trapBase + trap.Special; } - private string GetTrapAttackBonus(int trapDanger, Trap trap) + private static string GetTrapAttackBonus(int trapDanger, Trap trap) { if (!trap.AttackMod) return "."; @@ -291,7 +309,7 @@ private int GetTrapDamage(int trapDanger) }; } - private int GetTrapSaveDc(int trapDanger) + private static int GetTrapSaveDc(int trapDanger) { var min = Constants.TrapSave[trapDanger]; var max = Constants.TrapSave[trapDanger + 1]; @@ -305,7 +323,7 @@ private TrapSeverity GetTrapSeverity() 0 => TrapSeverity.Setback, 1 or 2 => TrapSeverity.Dangerous, 3 => TrapSeverity.Deadly, - _ => TrapSeverity.Setback, + _ => TrapSeverity.Setback }; } @@ -336,13 +354,16 @@ private string CalcTreasure() { var currentTreasure = filteredTreasures[GetRandomInt(0, filteredTreasures.Count)]; if (currentValue + currentTreasure.Cost < _sumValue) - { // if it's still affordable add to list + { + // if it's still affordable add to list currentValue += currentTreasure.Cost; finalList.Add(currentTreasure); currentCount++; } + maxAttempt--; } + var query = finalList // get occurrence .GroupBy(x => x) .ToDictionary(x => x.Key, y => y.Count()); @@ -353,9 +374,11 @@ private string CalcTreasure() sb.Append(item.Value); sb.Append("x "); } + sb.Append(item.Key.Name); sb.Append(", "); } + sb.Append(GetRandomInt(1, _sumValue - currentValue)); // get the remaining value randomly sb.Append(" gp"); return sb.ToString(); @@ -369,7 +392,7 @@ private int GetItemsCount() 1 => GetRandomInt(2, Constants.ItemCount[PartyLevel]), 2 => GetRandomInt(3, Constants.ItemCount[PartyLevel]), 3 => GetRandomInt(4, Constants.ItemCount[PartyLevel]), - _ => 0, + _ => 0 }; } @@ -377,14 +400,14 @@ private List GetFilteredList() { if (MonsterType.Equals("any", StringComparison.OrdinalIgnoreCase)) { - return TreasureList - .Where(item => item.Rarity <= ItemsRarity && item.Cost < _sumValue) - .ToList(); + return [.. TreasureList.Where(item => item.Rarity <= ItemsRarity && item.Cost < _sumValue)]; } - return TreasureList - .Where(item => item.Rarity <= ItemsRarity && item.Cost < _sumValue && item.Types.Contains(MonsterType)) - .ToList(); + return + [ + .. TreasureList.Where(item => + item.Rarity <= ItemsRarity && item.Cost < _sumValue && item.Types.Contains(MonsterType)) + ]; } private void GetAllCost() @@ -407,6 +430,7 @@ private string GetDoorDescription() var end = sb.Length; DungeonTiles[door.I][door.J].Description = sb.ToString(start, end - start); } + sb.Length -= 1; return sb.ToString(); } @@ -414,12 +438,16 @@ private string GetDoorDescription() private string GetDoorText(Texture texture, int x) { if (RoomPosition.Up) - return Constants.SouthEntry + _southCount++ + Constants.ColonWithSpace + Constants.DoorTypes[x] + GetState(texture, x) + Constants.LineBreak; + return Constants.SouthEntry + _southCount++ + Constants.ColonWithSpace + Constants.DoorTypes[x] + + GetState(texture, x) + Constants.LineBreak; if (RoomPosition.Down) - return Constants.NorthEntry + _northCount++ + Constants.ColonWithSpace + Constants.DoorTypes[x] + GetState(texture, x) + Constants.LineBreak; + return Constants.NorthEntry + _northCount++ + Constants.ColonWithSpace + Constants.DoorTypes[x] + + GetState(texture, x) + Constants.LineBreak; if (RoomPosition.Right) - return Constants.WestEntry + _westCount++ + Constants.ColonWithSpace + Constants.DoorTypes[x] + GetState(texture, x) + Constants.LineBreak; - return Constants.EastEntry + _eastCount++ + Constants.ColonWithSpace + Constants.DoorTypes[x] + GetState(texture, x) + Constants.LineBreak; + return Constants.WestEntry + _westCount++ + Constants.ColonWithSpace + Constants.DoorTypes[x] + + GetState(texture, x) + Constants.LineBreak; + return Constants.EastEntry + _eastCount++ + Constants.ColonWithSpace + Constants.DoorTypes[x] + + GetState(texture, x) + Constants.LineBreak; } private string GetState(Texture texture, int x) @@ -442,13 +470,14 @@ private int GetDoorDc() 1 => GetRandomInt(1, 4), 2 => GetRandomInt(1, 6), 3 => GetRandomInt(2, 7), - _ => 0, + _ => 0 }; } public bool CheckNcDoor(DungeonTile dungeonTile) { - return dungeonTile.Texture is Texture.NoCorridorDoor or Texture.NoCorridorDoorLocked or Texture.NoCorridorDoorTrapped; + return dungeonTile.Texture is Texture.NoCorridorDoor or Texture.NoCorridorDoorLocked + or Texture.NoCorridorDoorTrapped; } public string GetNcDoorDescription(DungeonTile[][] dungeonTiles, IEnumerable closedList) @@ -485,6 +514,7 @@ public string GetNcDoorDescription(DungeonTile[][] dungeonTiles, IEnumerable DeserializeJson(string fileName) { - var json = File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + "/Data/" + fileName) ?? throw new FileNotFoundException(fileName); - return JsonSerializer.Deserialize>(json, _options) ?? []; + var json = File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + "/Data/" + fileName) ?? + throw new FileNotFoundException(fileName); + return JsonSerializer.Deserialize>(json, Options) ?? []; } -} - +} \ No newline at end of file diff --git a/src/Open5ETools.Core/Common/Helpers/PasswordHelper.cs b/src/Open5ETools.Core/Common/Helpers/PasswordHelper.cs index 57fcf73..7f5f69c 100644 --- a/src/Open5ETools.Core/Common/Helpers/PasswordHelper.cs +++ b/src/Open5ETools.Core/Common/Helpers/PasswordHelper.cs @@ -1,6 +1,6 @@ using System.Security.Cryptography; -namespace Open5ETools.Core.Helpers; +namespace Open5ETools.Core.Common.Helpers; public static class PasswordHelper { diff --git a/src/Open5ETools.Core/Common/Helpers/SelectListHelper.cs b/src/Open5ETools.Core/Common/Helpers/SelectListHelper.cs index e790b4e..dfc9d68 100644 --- a/src/Open5ETools.Core/Common/Helpers/SelectListHelper.cs +++ b/src/Open5ETools.Core/Common/Helpers/SelectListHelper.cs @@ -1,14 +1,15 @@ using Microsoft.AspNetCore.Mvc.Rendering; namespace Open5ETools.Core.Common.Helpers; + public static class SelectListHelper { public static List GetBool() { return [ - new() { Text = Resources.Common.Yes, Value = "true", Selected = true }, - new() { Text = Resources.Common.No, Value = "false" } + new SelectListItem { Text = Resources.Common.Yes, Value = "true", Selected = true }, + new SelectListItem { Text = Resources.Common.No, Value = "false" } ]; } @@ -19,6 +20,7 @@ public static List GenerateIntSelectList(int from, int to) { list.Add(new SelectListItem { Text = i.ToString(), Value = i.ToString() }); } + return list; } } \ No newline at end of file diff --git a/src/Open5ETools.Core/Common/Models/DM/Generator/RoamingMonsterDescription.cs b/src/Open5ETools.Core/Common/Models/DM/Generator/RoamingMonsterDescription.cs index 751bb82..84e945c 100644 --- a/src/Open5ETools.Core/Common/Models/DM/Generator/RoamingMonsterDescription.cs +++ b/src/Open5ETools.Core/Common/Models/DM/Generator/RoamingMonsterDescription.cs @@ -1,7 +1,3 @@ namespace Open5ETools.Core.Common.Models.DM.Generator; -public class RoamingMonsterDescription(string name, string description) -{ - public string Name { get; } = name; - public string Description { get; } = description; -} \ No newline at end of file +public record RoamingMonsterDescription(string Name, string Description); \ No newline at end of file diff --git a/src/Open5ETools.Core/Common/Models/DM/Generator/RoomDescription.cs b/src/Open5ETools.Core/Common/Models/DM/Generator/RoomDescription.cs index f98142e..d946823 100644 --- a/src/Open5ETools.Core/Common/Models/DM/Generator/RoomDescription.cs +++ b/src/Open5ETools.Core/Common/Models/DM/Generator/RoomDescription.cs @@ -1,9 +1,3 @@ namespace Open5ETools.Core.Common.Models.DM.Generator; -public class RoomDescription(string name, string treasure, string monster, string doors) -{ - public string Name { get; } = name; - public string Treasure { get; } = treasure; - public string Monster { get; } = monster; - public string Doors { get; } = doors; -} \ No newline at end of file +public record RoomDescription(string Name, string Treasure, string Monster, string Doors); \ No newline at end of file diff --git a/src/Open5ETools.Core/Common/Models/DM/Generator/Trap.cs b/src/Open5ETools.Core/Common/Models/DM/Generator/Trap.cs index 8046e84..9a83fad 100644 --- a/src/Open5ETools.Core/Common/Models/DM/Generator/Trap.cs +++ b/src/Open5ETools.Core/Common/Models/DM/Generator/Trap.cs @@ -2,14 +2,13 @@ namespace Open5ETools.Core.Common.Models.DM.Generator; -public class Trap(string name, Save save, int spot, int disable, DisableCheck disableCheck, bool attackMod, DamageType? dmgType, string special) -{ - public string Name { get; } = name; - public Save Save { get; } = save; - public int Spot { get; } = spot; - public int Disable { get; } = disable; - public DisableCheck DisableCheck { get; } = disableCheck; - public bool AttackMod { get; } = attackMod; - public DamageType? DmgType { get; } = dmgType; - public string Special { get; } = special; -} \ No newline at end of file +public record Trap( + string Name, + Save Save, + int Spot, + int Disable, + DisableCheck DisableCheck, + bool AttackMod, + DamageType? DmgType, + string Special +); \ No newline at end of file diff --git a/src/Open5ETools.Core/Common/Models/DM/Generator/TrapDescription.cs b/src/Open5ETools.Core/Common/Models/DM/Generator/TrapDescription.cs index d2fe44d..5d25381 100644 --- a/src/Open5ETools.Core/Common/Models/DM/Generator/TrapDescription.cs +++ b/src/Open5ETools.Core/Common/Models/DM/Generator/TrapDescription.cs @@ -1,7 +1,3 @@ namespace Open5ETools.Core.Common.Models.DM.Generator; -public class TrapDescription(string name, string description) -{ - public string Name { get; } = name; - public string Description { get; } = description; -} \ No newline at end of file +public record TrapDescription(string Name, string Description); \ No newline at end of file diff --git a/src/Open5ETools.Core/Common/Models/DM/Generator/TreasureDescription.cs b/src/Open5ETools.Core/Common/Models/DM/Generator/TreasureDescription.cs index b9ab302..805d6d4 100644 --- a/src/Open5ETools.Core/Common/Models/DM/Generator/TreasureDescription.cs +++ b/src/Open5ETools.Core/Common/Models/DM/Generator/TreasureDescription.cs @@ -1,10 +1,9 @@ namespace Open5ETools.Core.Common.Models.DM.Generator; -public class TreasureDescription -{ - public string Name { get; set; } = string.Empty; - public int Cost { get; set; } - public int Rarity { get; set; } - public bool Magical { get; set; } - public List Types { get; set; } = []; -} \ No newline at end of file +public record TreasureDescription( + string Name, + int Cost, + int Rarity, + bool Magical, + IReadOnlyCollection Types +); \ No newline at end of file diff --git a/src/Open5ETools.Core/Common/Models/DM/Services/DungeonOptionModel.cs b/src/Open5ETools.Core/Common/Models/DM/Services/DungeonOptionModel.cs index c8bab94..d43d472 100644 --- a/src/Open5ETools.Core/Common/Models/DM/Services/DungeonOptionModel.cs +++ b/src/Open5ETools.Core/Common/Models/DM/Services/DungeonOptionModel.cs @@ -21,5 +21,5 @@ public class DungeonOptionModel : EditModel public int RoamingPercent { get; set; } public int Width { get; set; } = 800; public int Height { get; set; } = 800; - public IEnumerable Dungeons { get; } = new List(); + public IEnumerable Dungeons { get; set; } = []; } \ No newline at end of file diff --git a/src/Open5ETools.Core/Open5ETools.Core.csproj b/src/Open5ETools.Core/Open5ETools.Core.csproj index f4784be..cb84815 100644 --- a/src/Open5ETools.Core/Open5ETools.Core.csproj +++ b/src/Open5ETools.Core/Open5ETools.Core.csproj @@ -1,11 +1,4 @@ - - - net9.0 - enable - enable - - diff --git a/src/Open5ETools.Core/Services/AuthService.cs b/src/Open5ETools.Core/Services/AuthService.cs index f421200..1e36ca9 100644 --- a/src/Open5ETools.Core/Services/AuthService.cs +++ b/src/Open5ETools.Core/Services/AuthService.cs @@ -1,10 +1,10 @@ using AutoMapper; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; +using Open5ETools.Core.Common.Helpers; using Open5ETools.Core.Common.Interfaces.Data; using Open5ETools.Core.Common.Interfaces.Services; using Open5ETools.Core.Common.Models.Services; -using Open5ETools.Core.Helpers; namespace Open5ETools.Core.Services; diff --git a/src/Open5ETools.Core/Services/DM/OptionService.cs b/src/Open5ETools.Core/Services/DM/OptionService.cs index cf3a0f6..40d0073 100644 --- a/src/Open5ETools.Core/Services/DM/OptionService.cs +++ b/src/Open5ETools.Core/Services/DM/OptionService.cs @@ -9,7 +9,8 @@ namespace Open5ETools.Core.Services.DM; -public class OptionService(IMapper mapper, +public class OptionService( + IMapper mapper, IAppDbContext context, IMemoryCache memoryCache, ILogger logger) : IOptionService @@ -19,7 +20,8 @@ public class OptionService(IMapper mapper, private readonly IMapper _mapper = mapper; private readonly ILogger _logger = logger; - public async Task> ListOptionsAsync(OptionKey? filter = null, CancellationToken cancellationToken = default) + public async Task> ListOptionsAsync(OptionKey? filter = null, + CancellationToken cancellationToken = default) { try { @@ -27,10 +29,10 @@ public async Task> ListOptionsAsync(OptionKey? filter = return filter.HasValue ? cacheEntry?.Where(o => o.Key == filter.Value) ?? [] : cacheEntry ?? []; var options = await _context.Options - .AsNoTracking() - .ToListAsync(cancellationToken); + .AsNoTracking() + .ToListAsync(cancellationToken); - cacheEntry = options.Select(_mapper.Map).ToList(); + cacheEntry = [.. options.Select(_mapper.Map)]; var cacheEntryOptions = new MemoryCacheEntryOptions() .SetSlidingExpiration(TimeSpan.FromMinutes(10)); diff --git a/src/Open5ETools.Core/Services/EG/EncounterService.cs b/src/Open5ETools.Core/Services/EG/EncounterService.cs index a4c615b..d4944c5 100644 --- a/src/Open5ETools.Core/Services/EG/EncounterService.cs +++ b/src/Open5ETools.Core/Services/EG/EncounterService.cs @@ -17,7 +17,7 @@ public class EncounterService( IMapper mapper, IAppDbContext context, ILogger logger - ) : IEncounterService +) : IEncounterService { private readonly IMapper _mapper = mapper; private readonly IAppDbContext _context = context; @@ -34,9 +34,9 @@ public async Task>> GetEnumListAsync() return await Task.Run(() => (from object e in Enum.GetValues(typeof(T)) - select new KeyValuePair(((Enum)e) - .GetName(Resources.Enum.ResourceManager), (int)e)) - .ToList()); + select new KeyValuePair(((Enum)e) + .GetName(Resources.Enum.ResourceManager), (int)e)) + .ToList()); } public async Task GenerateAsync(EncounterOption option) @@ -46,10 +46,10 @@ public async Task GenerateAsync(EncounterOption option) _partySize = option.PartySize; _xpList = [ - new(Difficulty.Easy , Constants.Thresholds[_partyLevel, 0] * _partySize), - new(Difficulty.Medium , Constants.Thresholds[_partyLevel, 1] * _partySize), - new(Difficulty.Hard , Constants.Thresholds[_partyLevel, 2] * _partySize), - new(Difficulty.Deadly , Constants.Thresholds[_partyLevel, 3] * _partySize) + new KeyValuePair(Difficulty.Easy, Constants.Thresholds[_partyLevel, 0] * _partySize), + new KeyValuePair(Difficulty.Medium, Constants.Thresholds[_partyLevel, 1] * _partySize), + new KeyValuePair(Difficulty.Hard, Constants.Thresholds[_partyLevel, 2] * _partySize), + new KeyValuePair(Difficulty.Deadly, Constants.Thresholds[_partyLevel, 3] * _partySize) ]; try { @@ -60,13 +60,13 @@ public async Task GenerateAsync(EncounterOption option) if (option.MonsterTypes.Any()) { var selectedMonsters = option.MonsterTypes.Select(m => m.ToString().ToLower()); - _monsters = _monsters.Where(m => selectedMonsters.Any(m.JsonMonster.Type.ToLower().Equals)).ToList(); + _monsters = [.. _monsters.Where(m => selectedMonsters.Any(m.JsonMonster.Type.ToLower().Equals))]; } if (option.Sizes.Any()) { var selectedSizes = option.Sizes.Select(s => s.ToString().ToLower()); - _monsters = _monsters.Where(m => selectedSizes.Any(m.JsonMonster.Size.ToLower().Equals)).ToList(); + _monsters = [.. _monsters.Where(m => selectedSizes.Any(m.JsonMonster.Size.ToLower().Equals))]; } if (option.Difficulty.HasValue) @@ -74,7 +74,9 @@ public async Task GenerateAsync(EncounterOption option) foreach (var monster in _monsters) { - monsterXps.Add(Constants.ChallengeRatingXp[Constants.ChallengeRating.IndexOf(monster.JsonMonster.ChallengeRating)]); + monsterXps.Add( + Constants.ChallengeRatingXp[ + Constants.ChallengeRating.IndexOf(monster.JsonMonster.ChallengeRating)]); } CheckPossible(sumXp, monsterXps); @@ -99,7 +101,6 @@ await Task.Run(() => } }); - result.Monsters.RemoveAll(mm => mm is null); // cleanup if needed result.SumXp = result.Monsters.Sum(mm => mm.JsonMonsterModel.Xp); return result; @@ -116,7 +117,7 @@ private int CalcSumXp(int difficulty) return Constants.Thresholds[_partyLevel, difficulty] * _partySize; } - private static void ValidateOption(EncounterOption option) + private static void ValidateOption(EncounterOption? option) { var exceptions = new List(); @@ -176,6 +177,7 @@ private static void CheckPossible(int sumXp, IReadOnlyCollection monsterXps return GetEncounterDetail(difficulties.First(), currentMonster, (int)allXp, count); } } + monster++; } @@ -188,7 +190,8 @@ private MonsterModel GetEncounterDetail(Difficulty difficulty, Monster currentMo monsterModel.JsonMonsterModel.Xp = allXp; monsterModel.JsonMonsterModel.Count = count; monsterModel.JsonMonsterModel.Difficulty = difficulty.GetName(Resources.Enum.ResourceManager); - monsterModel.JsonMonsterModel.Size = Enum.Parse(currentMonster.JsonMonster.Size).GetName(Resources.Enum.ResourceManager); + monsterModel.JsonMonsterModel.Size = + Enum.Parse(currentMonster.JsonMonster.Size).GetName(Resources.Enum.ResourceManager); if (Enum.TryParse(monsterModel.JsonMonsterModel.Type, out MonsterType type)) monsterModel.JsonMonsterModel.Type = type.GetName(Resources.Enum.ResourceManager); @@ -199,8 +202,8 @@ private MonsterModel GetEncounterDetail(Difficulty difficulty, Monster currentMo public async Task GetMonsterByIdAsync(int id) { var monster = await _context.Monsters - .AsNoTracking() - .FirstOrDefaultAsync(m => m.Id == id); + .AsNoTracking() + .FirstOrDefaultAsync(m => m.Id == id); return _mapper.Map(monster); } diff --git a/src/Open5ETools.Core/Services/UserService.cs b/src/Open5ETools.Core/Services/UserService.cs index 22c0c2b..6d44b9b 100644 --- a/src/Open5ETools.Core/Services/UserService.cs +++ b/src/Open5ETools.Core/Services/UserService.cs @@ -3,11 +3,11 @@ using Microsoft.Extensions.Logging; using Open5ETools.Core.Common.Enums; using Open5ETools.Core.Common.Exceptions; +using Open5ETools.Core.Common.Helpers; using Open5ETools.Core.Common.Interfaces.Data; using Open5ETools.Core.Common.Interfaces.Services; using Open5ETools.Core.Common.Models.Services; using Open5ETools.Core.Domain; -using Open5ETools.Core.Helpers; namespace Open5ETools.Core.Services; diff --git a/src/Open5ETools.Infrastructure/Data/AppDbContextInitializer.cs b/src/Open5ETools.Infrastructure/Data/AppDbContextInitializer.cs index 7378d10..6c1c92e 100644 --- a/src/Open5ETools.Infrastructure/Data/AppDbContextInitializer.cs +++ b/src/Open5ETools.Infrastructure/Data/AppDbContextInitializer.cs @@ -12,7 +12,6 @@ using Open5ETools.Core.Common.Models.Json; using Open5ETools.Core.Domain; using Open5ETools.Core.Domain.DM; -using Open5ETools.Core.Helpers; using Spell = Open5ETools.Core.Common.Models.Json.Spell; namespace Open5ETools.Infrastructure.Data; @@ -47,7 +46,7 @@ public async Task SeedDataAsync(CancellationToken cancellationToken) await SeedMonstersAsync(cancellationToken); await SeedTreasuresAsync(cancellationToken); await SeedOptionsAsync(cancellationToken); - await SeedDungeonsAsync(cancellationToken, 1); + await SeedDungeonsAsync(1, cancellationToken); await SeedSpellsAsync(cancellationToken); } } @@ -60,8 +59,8 @@ public async Task SeedTestBaseAsync(CancellationToken cancellationToken) await SeedMonstersAsync(cancellationToken); await SeedTreasuresAsync(cancellationToken); await SeedOptionsAsync(cancellationToken); - await SeedDungeonsAsync(cancellationToken, 1); - await SeedDungeonsAsync(cancellationToken, 2); + await SeedDungeonsAsync(1, cancellationToken); + await SeedDungeonsAsync(2, cancellationToken); await SeedSpellsAsync(cancellationToken); } } @@ -467,8 +466,7 @@ private async Task SeedSizeAsync(CancellationToken token) await _context.SaveChangesAsync(token); } - private async Task SeedDungeonsAsync(CancellationToken token, - int userId) + private async Task SeedDungeonsAsync(int userId, CancellationToken token) { var dungeonOption = new DungeonOption { diff --git a/src/Open5ETools.Infrastructure/Open5ETools.Infrastructure.csproj b/src/Open5ETools.Infrastructure/Open5ETools.Infrastructure.csproj index 4ec0c90..9edc9dd 100644 --- a/src/Open5ETools.Infrastructure/Open5ETools.Infrastructure.csproj +++ b/src/Open5ETools.Infrastructure/Open5ETools.Infrastructure.csproj @@ -1,20 +1,11 @@ - - - net9.0 - enable - enable - - - - diff --git a/src/Open5ETools.Resources/Common.Designer.cs b/src/Open5ETools.Resources/Common.Designer.cs index eeba8cc..38936d2 100644 --- a/src/Open5ETools.Resources/Common.Designer.cs +++ b/src/Open5ETools.Resources/Common.Designer.cs @@ -1,549 +1,372 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Open5ETools.Resources { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - public class Common { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Common() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - public static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Open5ETools.Resources.Common", typeof(Common).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - public static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to You don't have permission to access this page.. - /// - public static string AccessDenied { - get { - return ResourceManager.GetString("AccessDenied", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Actions. - /// - public static string Actions { - get { - return ResourceManager.GetString("Actions", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Activate. - /// - public static string Activate { - get { - return ResourceManager.GetString("Activate", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Are you sure?. - /// - public static string Alert { - get { - return ResourceManager.GetString("Alert", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Alignment. - /// - public static string Alignment { - get { - return ResourceManager.GetString("Alignment", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Back. - /// - public static string Back { - get { - return ResourceManager.GetString("Back", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Cancel. - /// - public static string Cancel { - get { - return ResourceManager.GetString("Cancel", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Close. - /// - public static string Close { - get { - return ResourceManager.GetString("Close", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Common. - /// - public static string CommonValue { - get { - return ResourceManager.GetString("CommonValue", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to 2024 - Open5ETools. - /// - public static string Copyright { - get { - return ResourceManager.GetString("Copyright", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Count. - /// - public static string Count { - get { - return ResourceManager.GetString("Count", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Create. - /// - public static string Create { - get { - return ResourceManager.GetString("Create", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Deadly. - /// - public static string Deadly { - get { - return ResourceManager.GetString("Deadly", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Delete. - /// - public static string Delete { - get { - return ResourceManager.GetString("Delete", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Description. - /// - public static string Description { - get { - return ResourceManager.GetString("Description", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Details. - /// - public static string Details { - get { - return ResourceManager.GetString("Details", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Difficulty. - /// - public static string Difficulty { - get { - return ResourceManager.GetString("Difficulty", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Easy. - /// - public static string Easy { - get { - return ResourceManager.GetString("Easy", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Edit. - /// - public static string Edit { - get { - return ResourceManager.GetString("Edit", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Few. - /// - public static string Few { - get { - return ResourceManager.GetString("Few", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Forbidden. - /// - public static string Forbidden { - get { - return ResourceManager.GetString("Forbidden", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Generate. - /// - public static string Generate { - get { - return ResourceManager.GetString("Generate", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Hard. - /// - public static string Hard { - get { - return ResourceManager.GetString("Hard", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to High. - /// - public static string High { - get { - return ResourceManager.GetString("High", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Large. - /// - public static string Large { - get { - return ResourceManager.GetString("Large", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Legendary. - /// - public static string Legendary { - get { - return ResourceManager.GetString("Legendary", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Login. - /// - public static string Login { - get { - return ResourceManager.GetString("Login", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Low. - /// - public static string Low { - get { - return ResourceManager.GetString("Low", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Medium. - /// - public static string Medium { - get { - return ResourceManager.GetString("Medium", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to More. - /// - public static string More { - get { - return ResourceManager.GetString("More", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to About. - /// - public static string NavAbout { - get { - return ResourceManager.GetString("NavAbout", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Contact. - /// - public static string NavContact { - get { - return ResourceManager.GetString("NavContact", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Dungeon generator. - /// - public static string NavDungeons { - get { - return ResourceManager.GetString("NavDungeons", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Encounter generator. - /// - public static string NavEncounter { - get { - return ResourceManager.GetString("NavEncounter", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Open5ETools. - /// - public static string NavHome { - get { - return ResourceManager.GetString("NavHome", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Logout. - /// - public static string NavLogout { - get { - return ResourceManager.GetString("NavLogout", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Spells. - /// - public static string NavSpells { - get { - return ResourceManager.GetString("NavSpells", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to User management. - /// - public static string NavUserManagement { - get { - return ResourceManager.GetString("NavUserManagement", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to No. - /// - public static string No { - get { - return ResourceManager.GetString("No", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to None. - /// - public static string None { - get { - return ResourceManager.GetString("None", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Ok. - /// - public static string Ok { - get { - return ResourceManager.GetString("Ok", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Party level. - /// - public static string PartyLevel { - get { - return ResourceManager.GetString("PartyLevel", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Party size. - /// - public static string PartySize { - get { - return ResourceManager.GetString("PartySize", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Privacy. - /// - public static string Privacy { - get { - return ResourceManager.GetString("Privacy", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Rare. - /// - public static string Rare { - get { - return ResourceManager.GetString("Rare", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Save. - /// - public static string Save { - get { - return ResourceManager.GetString("Save", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Search. - /// - public static string Search { - get { - return ResourceManager.GetString("Search", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Size. - /// - public static string Size { - get { - return ResourceManager.GetString("Size", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Small. - /// - public static string Small { - get { - return ResourceManager.GetString("Small", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Speed. - /// - public static string Speed { - get { - return ResourceManager.GetString("Speed", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Standard. - /// - public static string Standard { - get { - return ResourceManager.GetString("Standard", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Uncommon. - /// - public static string Uncommon { - get { - return ResourceManager.GetString("Uncommon", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Very Rare. - /// - public static string VeryRare { - get { - return ResourceManager.GetString("VeryRare", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Yes. - /// - public static string Yes { - get { - return ResourceManager.GetString("Yes", resourceCulture); - } - } - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Open5ETools.Resources { + using System; + + + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [System.Diagnostics.DebuggerNonUserCodeAttribute()] + [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + public class Common { + + private static System.Resources.ResourceManager resourceMan; + + private static System.Globalization.CultureInfo resourceCulture; + + [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Common() { + } + + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + public static System.Resources.ResourceManager ResourceManager { + get { + if (object.Equals(null, resourceMan)) { + System.Resources.ResourceManager temp = new System.Resources.ResourceManager("Open5ETools.Resources.Common", typeof(Common).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + public static System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + public static string AccessDenied { + get { + return ResourceManager.GetString("AccessDenied", resourceCulture); + } + } + + public static string Actions { + get { + return ResourceManager.GetString("Actions", resourceCulture); + } + } + + public static string Activate { + get { + return ResourceManager.GetString("Activate", resourceCulture); + } + } + + public static string Alert { + get { + return ResourceManager.GetString("Alert", resourceCulture); + } + } + + public static string Alignment { + get { + return ResourceManager.GetString("Alignment", resourceCulture); + } + } + + public static string Back { + get { + return ResourceManager.GetString("Back", resourceCulture); + } + } + + public static string Cancel { + get { + return ResourceManager.GetString("Cancel", resourceCulture); + } + } + + public static string Close { + get { + return ResourceManager.GetString("Close", resourceCulture); + } + } + + public static string CommonValue { + get { + return ResourceManager.GetString("CommonValue", resourceCulture); + } + } + + public static string Copyright { + get { + return ResourceManager.GetString("Copyright", resourceCulture); + } + } + + public static string Count { + get { + return ResourceManager.GetString("Count", resourceCulture); + } + } + + public static string Create { + get { + return ResourceManager.GetString("Create", resourceCulture); + } + } + + public static string Deadly { + get { + return ResourceManager.GetString("Deadly", resourceCulture); + } + } + + public static string Delete { + get { + return ResourceManager.GetString("Delete", resourceCulture); + } + } + + public static string Description { + get { + return ResourceManager.GetString("Description", resourceCulture); + } + } + + public static string Details { + get { + return ResourceManager.GetString("Details", resourceCulture); + } + } + + public static string Difficulty { + get { + return ResourceManager.GetString("Difficulty", resourceCulture); + } + } + + public static string Easy { + get { + return ResourceManager.GetString("Easy", resourceCulture); + } + } + + public static string Edit { + get { + return ResourceManager.GetString("Edit", resourceCulture); + } + } + + public static string Few { + get { + return ResourceManager.GetString("Few", resourceCulture); + } + } + + public static string Forbidden { + get { + return ResourceManager.GetString("Forbidden", resourceCulture); + } + } + + public static string Generate { + get { + return ResourceManager.GetString("Generate", resourceCulture); + } + } + + public static string Hard { + get { + return ResourceManager.GetString("Hard", resourceCulture); + } + } + + public static string High { + get { + return ResourceManager.GetString("High", resourceCulture); + } + } + + public static string Large { + get { + return ResourceManager.GetString("Large", resourceCulture); + } + } + + public static string Legendary { + get { + return ResourceManager.GetString("Legendary", resourceCulture); + } + } + + public static string Login { + get { + return ResourceManager.GetString("Login", resourceCulture); + } + } + + public static string Low { + get { + return ResourceManager.GetString("Low", resourceCulture); + } + } + + public static string Medium { + get { + return ResourceManager.GetString("Medium", resourceCulture); + } + } + + public static string More { + get { + return ResourceManager.GetString("More", resourceCulture); + } + } + + public static string NavAbout { + get { + return ResourceManager.GetString("NavAbout", resourceCulture); + } + } + + public static string NavContact { + get { + return ResourceManager.GetString("NavContact", resourceCulture); + } + } + + public static string NavDungeons { + get { + return ResourceManager.GetString("NavDungeons", resourceCulture); + } + } + + public static string NavEncounter { + get { + return ResourceManager.GetString("NavEncounter", resourceCulture); + } + } + + public static string NavHome { + get { + return ResourceManager.GetString("NavHome", resourceCulture); + } + } + + public static string NavLogout { + get { + return ResourceManager.GetString("NavLogout", resourceCulture); + } + } + + public static string NavSpells { + get { + return ResourceManager.GetString("NavSpells", resourceCulture); + } + } + + public static string NavUserManagement { + get { + return ResourceManager.GetString("NavUserManagement", resourceCulture); + } + } + + public static string No { + get { + return ResourceManager.GetString("No", resourceCulture); + } + } + + public static string None { + get { + return ResourceManager.GetString("None", resourceCulture); + } + } + + public static string Ok { + get { + return ResourceManager.GetString("Ok", resourceCulture); + } + } + + public static string PartyLevel { + get { + return ResourceManager.GetString("PartyLevel", resourceCulture); + } + } + + public static string PartySize { + get { + return ResourceManager.GetString("PartySize", resourceCulture); + } + } + + public static string Privacy { + get { + return ResourceManager.GetString("Privacy", resourceCulture); + } + } + + public static string Rare { + get { + return ResourceManager.GetString("Rare", resourceCulture); + } + } + + public static string Save { + get { + return ResourceManager.GetString("Save", resourceCulture); + } + } + + public static string Search { + get { + return ResourceManager.GetString("Search", resourceCulture); + } + } + + public static string Size { + get { + return ResourceManager.GetString("Size", resourceCulture); + } + } + + public static string Small { + get { + return ResourceManager.GetString("Small", resourceCulture); + } + } + + public static string Speed { + get { + return ResourceManager.GetString("Speed", resourceCulture); + } + } + + public static string Standard { + get { + return ResourceManager.GetString("Standard", resourceCulture); + } + } + + public static string Uncommon { + get { + return ResourceManager.GetString("Uncommon", resourceCulture); + } + } + + public static string VeryRare { + get { + return ResourceManager.GetString("VeryRare", resourceCulture); + } + } + + public static string Yes { + get { + return ResourceManager.GetString("Yes", resourceCulture); + } + } + } +} diff --git a/src/Open5ETools.Resources/Common.resx b/src/Open5ETools.Resources/Common.resx index ee56c14..e780f1b 100644 --- a/src/Open5ETools.Resources/Common.resx +++ b/src/Open5ETools.Resources/Common.resx @@ -145,7 +145,7 @@ Common - 2024 - Open5ETools + Open5ETools Count diff --git a/src/Open5ETools.Resources/Open5ETools.Resources.csproj b/src/Open5ETools.Resources/Open5ETools.Resources.csproj index 93287b3..3f36994 100644 --- a/src/Open5ETools.Resources/Open5ETools.Resources.csproj +++ b/src/Open5ETools.Resources/Open5ETools.Resources.csproj @@ -1,11 +1,5 @@ - - - net9.0 - enable - enable - - + diff --git a/src/Open5ETools.Web/ConfigureServices.cs b/src/Open5ETools.Web/ConfigureServices.cs index b198782..7f0b53c 100644 --- a/src/Open5ETools.Web/ConfigureServices.cs +++ b/src/Open5ETools.Web/ConfigureServices.cs @@ -23,7 +23,7 @@ public static IServiceCollection AddWebServices(this IServiceCollection services var supportedCultures = new List { new("hu"), - new("en"), + new("en") }; opts.DefaultRequestCulture = new RequestCulture("en"); opts.SupportedCultures = supportedCultures; diff --git a/src/Open5ETools.Web/Open5ETools.Web.csproj b/src/Open5ETools.Web/Open5ETools.Web.csproj index a54c9be..de487af 100644 --- a/src/Open5ETools.Web/Open5ETools.Web.csproj +++ b/src/Open5ETools.Web/Open5ETools.Web.csproj @@ -1,12 +1,9 @@ - net9.0 - enable - enable true true - 1.0.2.0 + 1.0.2.1 diff --git a/src/Open5ETools.Web/Views/Dungeon/Create.cshtml b/src/Open5ETools.Web/Views/Dungeon/Create.cshtml index c374617..88fc0f6 100644 --- a/src/Open5ETools.Web/Views/Dungeon/Create.cshtml +++ b/src/Open5ETools.Web/Views/Dungeon/Create.cshtml @@ -7,20 +7,20 @@ + title="@Resources.Common.Back"> - - - - + + + + - + @@ -31,17 +31,17 @@ + title="@Resources.Dungeon.LevelTooltip"> - + } else { - + } @@ -53,7 +53,7 @@ + class="form-select"> @@ -96,7 +96,7 @@ + onchange="Utils.monsterTypeOnChange(this)"> @@ -115,14 +115,14 @@ + onchange="Utils.corridorOnchange(this)"> + class="form-select"> @@ -135,31 +135,32 @@ @if (Model.AddDungeon) { - + + title="@Resources.Dungeon.AddDungeonTooltip"> } else { + class="btn btn-sm btn-success btn-block"/> } - + - + @section Scripts { - - + +