Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small analyzer fixes #162

Merged
merged 2 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ public class CarryPackageAnalyzer : IContextualRecordAnalyzer<INpcGetter>
Severity.Warning)
.WithFormatting< IFormLinkGetter<ISkyrimMajorRecordGetter>>("Npc uses carry package, but StopCarryingEvent property in carry script is not set to OffsetStop but {0}");

public IEnumerable<TopicDefinition> Topics { get; } = [CarryPackageWithoutScript, NoStopCarryingEventProperty];
public static readonly TopicDefinition< IFormLinkGetter<ISkyrimMajorRecordGetter>> NoCarryItemProperty = MutagenTopicBuilder.DevelopmentTopic(
"Carry package without CarryItem property",
Severity.Warning)
.WithFormatting< IFormLinkGetter<ISkyrimMajorRecordGetter>>("Npc uses carry package, but has no CarryItem property filled");

public IEnumerable<TopicDefinition> Topics { get; } = [CarryPackageWithoutScript, NoStopCarryingEventProperty, NoCarryItemProperty];

public void AnalyzeRecord(ContextualRecordAnalyzerParams<INpcGetter> param)
{
Expand Down Expand Up @@ -62,7 +67,7 @@ public void AnalyzeRecord(ContextualRecordAnalyzerParams<INpcGetter> param)
if (carryItemIngredientProperty is not null) return;

param.AddTopic(
CarryPackageWithoutScript.Format());
NoCarryItemProperty.Format());
}

public IEnumerable<Func<INpcGetter, object?>> FieldsOfInterest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,12 @@ public void AnalyzeRecord(ContextualRecordAnalyzerParams<IQuestGetter> param)

// TODO: potentially replace with reference cache

foreach (var mod in param.LoadOrder.Select(l => l.Value.Mod).NotNull())
if (param.LinkCache.PriorityOrder.WinningOverrides<IStoryManagerQuestNodeGetter>()
.SelectMany(questNode => questNode.Quests.Select(n => n.Quest.FormKey))
.All(questFormKey => questFormKey != quest.FormKey))
{
foreach (var questNode in mod.EnumerateMajorRecords<IStoryManagerQuestNodeGetter>())
{
foreach (var questFormKey in questNode.Quests.Select(n => n.Quest.FormKey))
{
if (questFormKey == quest.FormKey)
{
param.AddTopic(
mod.ModKey,
quest,
StoryManagerQuestNotAssigned.Format());
return;
}
}
}
param.AddTopic(
StoryManagerQuestNotAssigned.Format());
}
}

Expand Down
Loading