Skip to content

Commit

Permalink
migrate to XIVHuntUtils (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
dit-zy authored Sep 16, 2024
1 parent eb82d75 commit a08c52a
Show file tree
Hide file tree
Showing 24 changed files with 89 additions and 890 deletions.
1 change: 1 addition & 0 deletions ScoutHelper/Config/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Dalamud.Plugin;
using Dalamud.Plugin.Services;
using ScoutHelper.Models;
using XIVHuntUtils.Models;
using static ScoutHelper.Utils.Utils;

namespace ScoutHelper.Config;
Expand Down
1 change: 1 addition & 0 deletions ScoutHelper/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Net.Http.Headers;
using System.Reflection;
using ScoutHelper.Models;
using XIVHuntUtils.Models;

namespace ScoutHelper;

Expand Down
2 changes: 2 additions & 0 deletions ScoutHelper/Managers/BearManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
using ScoutHelper.Models;
using ScoutHelper.Models.Http;
using ScoutHelper.Utils;
using XIVHuntUtils.Models;
using TrainMob = ScoutHelper.Models.TrainMob;

namespace ScoutHelper.Managers;

Expand Down
5 changes: 3 additions & 2 deletions ScoutHelper/Managers/InitializationManager.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
using System.Linq;
using Dalamud.Plugin.Services;
using ScoutHelper.Config;
using ScoutHelper.Models;
using XIVHuntUtils.Managers;
using XIVHuntUtils.Models;
using static ScoutHelper.Utils.Utils;

namespace ScoutHelper.Managers;
Expand Down Expand Up @@ -50,5 +51,5 @@ private void InitializeInstanceMap() {
}

private void InitializeTerritoryInstances() =>
TerritoryExtensions.SetTerritoryInstances(_conf, _territoryManager.GetTerritoryIds());
TerritoryExtensions.SetTerritoryInstances(_conf.Instances, _territoryManager.GetTerritoryIds());
}
61 changes: 0 additions & 61 deletions ScoutHelper/Managers/MobManager.cs

This file was deleted.

25 changes: 13 additions & 12 deletions ScoutHelper/Managers/SirenManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@
using CSharpFunctionalExtensions;
using Dalamud.Plugin.Services;
using Dalamud.Utility;
using DitzyExtensions.Functional;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using ScoutHelper.Config;
using ScoutHelper.Models;
using ScoutHelper.Models.Json;
using ScoutHelper.Utils;
using ScoutHelper.Utils.Functional;
using XIVHuntUtils.Managers;
using XIVHuntUtils.Models;
using static DitzyExtensions.MathUtils;
using static ScoutHelper.Utils.Utils;
using TrainMob = ScoutHelper.Models.TrainMob;

namespace ScoutHelper.Managers;

Expand All @@ -40,7 +43,9 @@ MobManager mobManager
(_patchData, _mobToPatch) = LoadData(options.SirenDataFile, territoryManager, mobManager);
}

public AccResults<Maybe<(string Url, Patch HighestPatch)>, string> GenerateSirenLink(IList<TrainMob> mobList) {
public AccumulatedResults<Maybe<(string Url, Patch HighestPatch)>, string> GenerateSirenLink(
IList<TrainMob> mobList
) {
_log.Debug("Generating a siren link for mob list: {0}", mobList);

var patches = mobList
Expand All @@ -53,9 +58,9 @@ MobManager mobManager
_log.Debug("Patches represented in mob list: {0}", patches);

if (patches.IsEmpty())
return AccResults.From(
return AccumulatedResults.From(
Maybe<(string, Patch)>.None,
"No mobs in the train are supported by Siren Hunts ;-;".AsSingletonList()
"No mobs in the train are supported by Siren Hunts ;-;"
);

return patches
Expand Down Expand Up @@ -140,7 +145,7 @@ MobManager mobManager
return (patchesData.Value, mobToPatch);
}

private static AccResults<(Patch patch, SirenPatchData), string> ParsePatchData(
private static AccumulatedResults<(Patch patch, SirenPatchData), string> ParsePatchData(
TerritoryManager territoryManager,
MobManager mobManager,
KeyValuePair<string, SirenJsonPatchData> patchData
Expand All @@ -159,11 +164,7 @@ KeyValuePair<string, SirenJsonPatchData> patchData
.Map(
mapId => mapMobs
.Mobs
.SelectResults(
mobName => mobManager
.GetMobId(mobName)
.ToResult($"No mobId found for mobName: {mobName}")
)
.SelectResults(mobManager.GetMobId)
.WithValue(mobIds => SirenMapData.From(mapId, mobIds))
)
);
Expand Down Expand Up @@ -200,7 +201,7 @@ KeyValuePair<string, SirenJsonPatchData> patchData
)
.WithValue(value => value.ToDict());

return parsedMobOrder.Join(
return parsedMobOrder.JoinWith(
mapResults,
(mobOrder, maps) => (patch, SirenPatchData.From(mobOrder, maps))
);
Expand Down
143 changes: 0 additions & 143 deletions ScoutHelper/Managers/TerritoryManager.cs

This file was deleted.

Loading

0 comments on commit a08c52a

Please sign in to comment.