Skip to content

Commit

Permalink
Merge branch 'dev' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Triky313 committed Nov 10, 2023
2 parents a6621cb + 3601bea commit f9c9a7e
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 18 deletions.
20 changes: 16 additions & 4 deletions src/StatisticsAnalysisTool/Dungeon/DungeonController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
using System.Reflection;
using System.Threading.Tasks;
using System.Windows;
using StatisticsAnalysisTool.Exceptions;
using Loot = StatisticsAnalysisTool.Dungeon.Models.Loot;
using ValueType = StatisticsAnalysisTool.Enumerations.ValueType;
// ReSharper disable PossibleMultipleEnumeration
Expand Down Expand Up @@ -702,11 +703,22 @@ public async Task LoadDungeonFromFileAsync()
FileController.TransferFileIfExistFromOldPathToUserDataDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, Settings.Default.DungeonRunsFileName));
var dungeons = await FileController.LoadAsync<List<DungeonDto>>(
Path.Combine(AppDomain.CurrentDomain.BaseDirectory, Settings.Default.UserDataDirectoryName, Settings.Default.DungeonRunsFileName));

var dungeonsToAdd = new List<DungeonBaseFragment>();
foreach (DungeonDto dungeonDto in dungeons.Where(x => x.Mode != DungeonMode.Unknown))
{
try
{
dungeonsToAdd.Add(DungeonMapping.Mapping(dungeonDto));
}
catch (MappingException e)
{
ConsoleManager.WriteLineForError(MethodBase.GetCurrentMethod()?.DeclaringType, e);
Log.Error(e, "{message}", MethodBase.GetCurrentMethod()?.DeclaringType);
}
}

_mainWindowViewModel.DungeonBindings.Dungeons.AddRange(dungeons
.Where(x => x.Mode != DungeonMode.Unknown).Select(DungeonMapping.Mapping)
.OrderBy(x => x.EnterDungeonFirstTime)
.ToList());
_mainWindowViewModel.DungeonBindings.Dungeons.AddRange(dungeonsToAdd.OrderBy(x => x?.EnterDungeonFirstTime).ToList());
_mainWindowViewModel.DungeonBindings.InitListCollectionView();
}

Expand Down
5 changes: 3 additions & 2 deletions src/StatisticsAnalysisTool/Dungeon/DungeonMapping.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using StatisticsAnalysisTool.Dungeon.Models;
using StatisticsAnalysisTool.Enumerations;
using StatisticsAnalysisTool.Exceptions;
using System.Linq;

namespace StatisticsAnalysisTool.Dungeon;
Expand Down Expand Up @@ -77,13 +78,13 @@ public static DungeonBaseFragment Mapping(DungeonDto dto)
{
return dto.Mode switch
{
DungeonMode.Solo or DungeonMode.Standard => new RandomDungeonFragment(dto),
DungeonMode.Solo or DungeonMode.Standard or DungeonMode.Avalon => new RandomDungeonFragment(dto),
DungeonMode.Corrupted => new CorruptedFragment(dto),
DungeonMode.HellGate => new HellGateFragment(dto),
DungeonMode.Expedition => new ExpeditionFragment(dto),
DungeonMode.Mists => new MistsFragment(dto),
DungeonMode.MistsDungeon => new MistsDungeonFragment(dto),
_ => null
_ => throw new MappingException("Unknown dungeon mode")
};
}

Expand Down
10 changes: 10 additions & 0 deletions src/StatisticsAnalysisTool/Exceptions/MappingException.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System;

namespace StatisticsAnalysisTool.Exceptions;

public class MappingException : Exception
{
public MappingException(string message) : base(message)
{
}
}
29 changes: 19 additions & 10 deletions src/StatisticsAnalysisTool/Network/Manager/TrackingController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,25 @@ public async Task StartTrackingAsync()
return;
}

await Task.WhenAll(
EstimatedMarketValueController.LoadFromFileAsync(),
StatisticController.LoadFromFileAsync(),
TradeController.LoadFromFileAsync(),
TreasureController.LoadFromFileAsync(),
DungeonController.LoadDungeonFromFileAsync(),
GatheringController.LoadFromFileAsync(),
VaultController.LoadFromFileAsync(),
GuildController.LoadFromFileAsync()
);
try
{
await Task.WhenAll(
EstimatedMarketValueController.LoadFromFileAsync(),
StatisticController.LoadFromFileAsync(),
TradeController.LoadFromFileAsync(),
TreasureController.LoadFromFileAsync(),
DungeonController.LoadDungeonFromFileAsync(),
GatheringController.LoadFromFileAsync(),
VaultController.LoadFromFileAsync(),
GuildController.LoadFromFileAsync()
);
}
catch (Exception e)
{
ConsoleManager.WriteLineForError(MethodBase.GetCurrentMethod()?.DeclaringType, e);
Log.Error(e, "{message}", MethodBase.GetCurrentMethod()?.DeclaringType);
_mainWindowViewModel.SetErrorBar(Visibility.Visible, e.Message);
}

ClusterController?.RegisterEvents();
LootController?.RegisterEvents();
Expand Down
4 changes: 2 additions & 2 deletions src/StatisticsAnalysisTool/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// indem Sie "*" wie unten gezeigt eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("7.1.4.*")]
[assembly: AssemblyFileVersion("7.1.4.0")]
[assembly: AssemblyVersion("7.1.5.*")]
[assembly: AssemblyFileVersion("7.1.5.0")]
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,7 @@ private async Task SetRequiredResourcesAsync()

var enchantments = Item?.FullItemInformation switch
{
Weapon weapon => weapon.Enchantments,
EquipmentItem equipmentItem => equipmentItem.Enchantments,
ConsumableItem consumableItem => consumableItem.Enchantments,
TransformationWeapon transformationWeapon => transformationWeapon.Enchantments,
Expand Down

0 comments on commit f9c9a7e

Please sign in to comment.