Skip to content

Commit

Permalink
Merge pull request #30 from Synthesis-Collective/3.1.0
Browse files Browse the repository at this point in the history
3.1.0
  • Loading branch information
EzioTheDeadPoet authored Apr 3, 2024
2 parents 310df44 + 41db249 commit 4269464
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 81 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## Version 3.1.0 - 03.04.2024
* Removed only process constructable items cause it isn't creating the limit that's intended for.
* Fixes for SkyrimVR and the Plugin Header Version 1.71

## Version 3.0.0 - 01.04.2024
* Complete rewrite of the item distribution method
* Added filters with sane default values to filter out "dummy" enchantments that are just used for VFX
Expand Down
19 changes: 4 additions & 15 deletions HalgarisRPGLoot/Analyzers/ArmorAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@ namespace HalgarisRPGLoot.Analyzers
{
public class ArmorAnalyzer : GearAnalyzer<IArmorGetter>
{
private readonly Dictionary<IFormLinkGetter<IArmorGetter>, IConstructibleObjectGetter> _armorDictionary;

private readonly ObjectEffectsAnalyzer _objectEffectsAnalyzer;

public ArmorAnalyzer(IPatcherState<ISkyrimMod, ISkyrimModGetter> state,
Dictionary<IFormLinkGetter<IArmorGetter>, IConstructibleObjectGetter> armorDictionary,
ObjectEffectsAnalyzer objectEffectsAnalyzer)
{
RarityAndVariationDistributionSettings = Program.Settings.RarityAndVariationDistributionSettings;
Expand All @@ -30,7 +28,6 @@ public ArmorAnalyzer(IPatcherState<ISkyrimMod, ISkyrimModGetter> state,
ItemTypeDescriptor = " armor";

State = state;
_armorDictionary = armorDictionary;
_objectEffectsAnalyzer = objectEffectsAnalyzer;

VarietyCountPerRarity = GearSettings.VarietyCountPerItem;
Expand Down Expand Up @@ -79,18 +76,8 @@ protected override void AnalyzeGear()
?? Array.Empty<ResolvedListItem<IArmorGetter>>())
.Where(e =>
{
if (Program.Settings.GeneralSettings.OnlyProcessConstructableEquipment)
{
var kws = (e.Resolved.Keywords ?? Array.Empty<IFormLink<IKeywordGetter>>());
return !Extensions.CheckKeywords(kws) &&
(_armorDictionary.ContainsKey(e.Resolved.TemplateArmor) ||
_armorDictionary.ContainsKey(e.Resolved.ToLink()));
}
else
{
var kws = (e.Resolved.Keywords ?? Array.Empty<IFormLink<IKeywordGetter>>());
return !Extensions.CheckKeywords(kws);
}
var kws = (e.Resolved.Keywords ?? Array.Empty<IFormLink<IKeywordGetter>>());
return !Extensions.CheckKeywords(kws);
})
.ToHashSet();

Expand Down Expand Up @@ -193,6 +180,7 @@ protected override FormKey EnchantItem(ResolvedListItem<IArmorGetter> item, int
{
return armorGetter.FormKey;
}

Console.WriteLine("Generating Enchanted version of " + itemName);
var newArmor = State.PatchMod.Armors.AddNewLocking(State.PatchMod.GetNextFormKey());
newArmor.DeepCopyIn(item.Resolved);
Expand All @@ -219,6 +207,7 @@ protected override FormKey EnchantItem(ResolvedListItem<IArmorGetter> item, int
{
return State.PatchMod.Armors.GetOrAddAsOverride(armorGetter).FormKey;
}

var newArmor = State.PatchMod.Armors.AddNewLocking(State.PatchMod.GetNextFormKey());
newArmor.DeepCopyIn(item.Resolved);
newArmor.EditorID = newArmorEditorId;
Expand Down
37 changes: 0 additions & 37 deletions HalgarisRPGLoot/Analyzers/ConstructibleObjectAnalyzer.cs

This file was deleted.

14 changes: 1 addition & 13 deletions HalgarisRPGLoot/Analyzers/WeaponAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@ namespace HalgarisRPGLoot.Analyzers
{
public class WeaponAnalyzer : GearAnalyzer<IWeaponGetter>
{
private readonly Dictionary<IFormLinkGetter<IWeaponGetter>, IConstructibleObjectGetter> _weaponDictionary;

private readonly ObjectEffectsAnalyzer _objectEffectsAnalyzer;

public WeaponAnalyzer(IPatcherState<ISkyrimMod, ISkyrimModGetter> state,
Dictionary<IFormLinkGetter<IWeaponGetter>, IConstructibleObjectGetter> weaponDictionary,
ObjectEffectsAnalyzer objectEffectsAnalyzer)
{
RarityAndVariationDistributionSettings = Program.Settings.RarityAndVariationDistributionSettings;
Expand All @@ -30,7 +28,6 @@ public WeaponAnalyzer(IPatcherState<ISkyrimMod, ISkyrimModGetter> state,
ItemTypeDescriptor = " weapon";

State = state;
_weaponDictionary = weaponDictionary;
_objectEffectsAnalyzer = objectEffectsAnalyzer;

VarietyCountPerRarity = GearSettings.VarietyCountPerItem;
Expand Down Expand Up @@ -79,17 +76,8 @@ protected override void AnalyzeGear()
?? Array.Empty<ResolvedListItem<IWeaponGetter>>())
.Where(e =>
{
if (Program.Settings.GeneralSettings.OnlyProcessConstructableEquipment)
{
var kws = (e.Resolved.Keywords ?? Array.Empty<IFormLink<IKeywordGetter>>());
return !Extensions.CheckKeywords(kws) && (_weaponDictionary.ContainsKey(e.Resolved.Template) ||
_weaponDictionary.ContainsKey(e.Resolved.ToLink()));
}
else
{
var kws = (e.Resolved.Keywords ?? Array.Empty<IFormLink<IKeywordGetter>>());
var kws = (e.Resolved.Keywords ?? Array.Empty<IFormLink<IKeywordGetter>>());
return !Extensions.CheckKeywords(kws);
}
})
.ToHashSet();

Expand Down
12 changes: 7 additions & 5 deletions HalgarisRPGLoot/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,19 @@ private static async Task<int> Main(string[] args)

private static void RunPatch(IPatcherState<ISkyrimMod, ISkyrimModGetter> state)
{
//var armor = new ArmorAnalyzer(state);
//var weapon = new WeaponAnalyzer(state);
// Workaround for VR Support until Mutagen adds support for the 1.71 header in VR
if (state.PatchMod.ModHeader.Stats.NextFormID <= 0x800)
{
state.PatchMod.ModHeader.Stats.NextFormID = 0x800;
}

Settings.RarityAndVariationDistributionSettings.ArmorSettings.RarityClasses.Sort();
Settings.RarityAndVariationDistributionSettings.WeaponSettings.RarityClasses.Sort();

ObjectEffectsAnalyzer objectEffectsAnalyzer = new(state);
ConstructibleObjectAnalyzer constructibleObjectAnalyzer = new(state);

var armor = new ArmorAnalyzer(state, constructibleObjectAnalyzer.ArmorDictionary,objectEffectsAnalyzer);
var weapon = new WeaponAnalyzer(state, constructibleObjectAnalyzer.WeaponDictionary,objectEffectsAnalyzer);
var armor = new ArmorAnalyzer(state, objectEffectsAnalyzer);
var weapon = new WeaponAnalyzer(state, objectEffectsAnalyzer);

Console.WriteLine("Analyzing mod list");
var th1 = new Thread(() => armor.Analyze());
Expand Down
13 changes: 2 additions & 11 deletions HalgarisRPGLoot/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,6 @@ public class Settings

public class GeneralSettings
{
[MaintainOrder]
[SynthesisSettingName("Only process constructable equipment")]
[SynthesisDescription(
"This Setting makes it so only Armor that is a CNAM (Created Object) in an COBJ (Constructable Object) Record will be considered." +
"\nThis is to keep unique artefacts and rewards unique in their look and enchantment.")]
[SynthesisTooltip(
"This Setting makes it so only Armor that is a CNAM (Created Object) in an COBJ (Constructable Object) Record will be considered." +
"\nThis is to keep unique artefacts and rewards unique in their look and enchantment.")]
public bool OnlyProcessConstructableEquipment = true;

[MaintainOrder]
[SynthesisSettingName("Enchantment Separator")]
[SynthesisDescription("This is the string(text) that will be written between the enchantments listed in enchantments and item names.")]
Expand Down Expand Up @@ -80,7 +70,8 @@ [MaintainOrder] [SynthesisSettingName("Enchantment List")] [SynthesisDescription
{
Skyrim.ObjectEffect.BoundBattleaxeEnchantment,
Skyrim.ObjectEffect.BoundBowEnchantment,
Skyrim.ObjectEffect.BoundSwordEnchantment
Skyrim.ObjectEffect.BoundSwordEnchantment,
Dragonborn.ObjectEffect.BoundDaggerEnchantment
};

[MaintainOrder]
Expand Down

0 comments on commit 4269464

Please sign in to comment.