Skip to content

Commit

Permalink
Merge pull request #16 from Synthesis-Collective/empty-effects-fix
Browse files Browse the repository at this point in the history
fix + new setting
  • Loading branch information
EzioTheDeadPoet authored Aug 9, 2021
2 parents 5c94c86 + 0da3d61 commit 14f6d9f
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 5 deletions.
7 changes: 6 additions & 1 deletion HalgarisRPGLoot/ArmorAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ public void Generate()

for (var j = 0; j < numEntries; j++)
{
var level = ench.Entry.Data.Level;
var forLevel = ByLevelIndexed[level];
if (forLevel.Length.Equals(0))continue;

var itm = GenerateEnchantment(ench, e.Label, e.NumEnchantments);
var entry = ench.Entry.DeepCopy();
entry.Data!.Reference.SetTo(itm);
Expand Down Expand Up @@ -194,7 +198,7 @@ private int[] GenerateRarityEntryCounts(Random rand)
var counts = new int[spawnChances.Count()];
if (Settings.UseRNGRarities)
{
// Precalculate the maximum number in our rolls for each range
// Calculate the maximum number in our rolls for each range
for (int i = 0; i < spawnChances.Count(); i++)
{
for (int j = 0; j < i; j++)
Expand Down Expand Up @@ -231,6 +235,7 @@ private FormKey GenerateEnchantment(
string rarityName, int rarityEnchCount)
{
var level = item.Entry.Data.Level;

var forLevel = ByLevelIndexed[level];
var takeMin = Math.Min(rarityEnchCount, forLevel.Length);
var effects = Extensions.Repeatedly(() => forLevel.RandomItem())
Expand Down
8 changes: 8 additions & 0 deletions HalgarisRPGLoot/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,13 @@ public static TC AddNewLocking<TC>(this Group<TC> itms, FormKey val)
return itms.AddNew(val);
}
}

public static Exception IncompatibleLoadOrderException
{
get
{
return IncompatibleLoadOrderException;
}
}
}
}
22 changes: 19 additions & 3 deletions HalgarisRPGLoot/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ public class Settings
public WeaponSettings WeaponSettings = new WeaponSettings();

}

public class ArmorSettings
{
[SynthesisSettingName("Number of variations per Item")]
[SynthesisTooltip("This determines how many different versions\n" +
"of the same Armor you can find.")]
"of the same Armor you can find.")]
public int VarietyCountPerItem = 8;
[SynthesisSettingName("Rarity Levels")]
[SynthesisTooltip("Custom defineable rarity levels")]
Expand All @@ -35,7 +36,7 @@ public class WeaponSettings
{
[SynthesisSettingName("Number of variations per Item")]
[SynthesisTooltip("This determines how many different versions\n" +
"of the same Weapon you can find.")]
"of the same Weapon you can find.")]
public int VarietyCountPerItem = 8;
[SynthesisSettingName("Rarity Levels")]
[SynthesisTooltip("Custom defineable rarity levels")]
Expand All @@ -47,7 +48,7 @@ public class WeaponSettings
};
[SynthesisSettingName("Use RNGRarity")]
[SynthesisTooltip("With this set to true the number of variations\n" +
"per item will be randomised.")]
"per item will be randomised.")]
public bool UseRNGRarities = true;
}

Expand All @@ -61,4 +62,19 @@ public class Rarity
[SynthesisTooltip("The higher the number the more common it is.")]
public int LLEntries;
}

public enum SearchMode
{
ClosestLevel,
OnlyHigherLevel,
OnlyLowerLevel

}

public enum PreferredLevel
{
Higher,
Lower
}

}
8 changes: 7 additions & 1 deletion HalgarisRPGLoot/WeaponAnalyer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,15 @@ public void Generate()

for (var j = 0; j < numEntries; j++)
{
var level = ench.Entry.Data.Level;
var forLevel = ByLevelIndexed[level];
if (forLevel.Length.Equals(0)) continue;

var itm = GenerateEnchantment(ench, e.Label, e.NumEnchantments);
var entry = ench.Entry.DeepCopy();
entry.Data!.Reference.SetTo(itm);
nlst.Entries.Add(entry);

}

for (var j = 0; j < e.LLEntries; j++)
Expand Down Expand Up @@ -195,7 +200,7 @@ private int[] GenerateRarityEntryCounts(Random rand)
var counts = new int[spawnChances.Count()];
if (Settings.UseRNGRarities)
{
// Precalculate the maximum number in our rolls for each range
// Calculate the maximum number in our rolls for each range
for (int i = 0; i < spawnChances.Count(); i++)
{
for (int j = 0; j < i; j++)
Expand Down Expand Up @@ -232,6 +237,7 @@ private FormKey GenerateEnchantment(
string rarityName, int rarityEnchCount)
{
var level = item.Entry.Data.Level;

var forLevel = ByLevelIndexed[level];
var takeMin = Math.Min(rarityEnchCount, forLevel.Length);
var effects = Extensions.Repeatedly(() => forLevel.RandomItem())
Expand Down

0 comments on commit 14f6d9f

Please sign in to comment.