Skip to content

Commit

Permalink
only index mobs that actually belong to the hunts
Browse files Browse the repository at this point in the history
the notorious monster sheet is the list of hunt marks
  • Loading branch information
dit-zy committed Feb 12, 2024
1 parent 8c5b8ae commit 81ce85c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions ScoutHelper/Managers/MobManager.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using CSharpFunctionalExtensions;
using Dalamud;
Expand Down Expand Up @@ -30,17 +31,22 @@ public MobManager(IPluginLog log, IDataManager dataManager) {
IDataManager dataManager
) {
_log.Debug("Building mob data from game files...");

var notoriousMonsters = dataManager.GetExcelSheet<NotoriousMonster>(ClientLanguage.English)!
.Select(monster => monster.BNpcName.Row)
.ToImmutableHashSet();

var nameToId = dataManager.GetExcelSheet<BNpcName>(ClientLanguage.English)!
.Select(name => (name.Singular.ToString().Lower(), name.RowId))
.Select(name => (name: name.Singular.ToString().Lower(), mobId: name.RowId))
.Where(name => notoriousMonsters.Contains(name.mobId))
.GroupBy(entry => entry.Item1)
.Select(
grouping => {
if (1 < grouping.Count()) {
_log.Debug(
"Duplicate mobs found for name [{0:l}]: {1:l}",
grouping.Key,
grouping.Select(entry => entry.RowId.ToString()).Join(", ")
grouping.Select(entry => entry.mobId.ToString()).Join(", ")
);
}
return grouping.First();
Expand Down

0 comments on commit 81ce85c

Please sign in to comment.