Skip to content
This repository has been archived by the owner on Nov 10, 2021. It is now read-only.

Commit

Permalink
Updated enchanting extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
erri120 committed May 17, 2020
1 parent 900a561 commit 2829e82
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 34 deletions.
2 changes: 1 addition & 1 deletion AddressLibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static class AddressLibrary
/// <see cref="ExtraContainerChanges.ItemEntry.ExtraData"/>.
/// </para>
///
/// <para>See <see cref="UtilityLibrary.SoulGemType"/> for all return types.</para>
/// <para>See <see cref="UtilityLibrary.SoulType"/> for all return types.</para>
/// </summary>
public static IntPtr GetSoulTypeFunc { get; internal set; }

Expand Down
28 changes: 1 addition & 27 deletions Extensions/ItemEntryExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public static partial class UtilityLibrary
/// from an extra enchantment in the way that the extra enchantment is what you apply
/// when enchanting the item using the enchantment table and the base enchantment being
/// the enchantment set in the actual form.
/// <para>THIS WILL CRASH YOUR GAME IF THE ITEM DOES NOT HAVE AN BASE ENCHANTMENT!</para>
/// </summary>
/// <param name="itemEntry">The item</param>
/// <param name="enchantment">The pointer to the base enchantment if return true, else <see cref="IntPtr.Zero"/></param>
Expand Down Expand Up @@ -76,33 +77,6 @@ public static bool TryGetBaseEnchantment([NotNull] this ExtraContainerChanges.It
return extraEnchantment != null;
}

/// <summary>
/// Checks if the item has the given enchantment. Only works with weapons and
/// armors.
/// </summary>
/// <param name="itemEntry">The Item</param>
/// <param name="enchantment">The Enchantment</param>
/// <returns>True if the item has the enchantment, false if not</returns>
public static bool HasEnchantment([NotNull] this ExtraContainerChanges.ItemEntry itemEntry,
EnchantmentItem enchantment)
{
var item = itemEntry.Template;
if (item == null)
return false;

if (itemEntry.TryGetBaseEnchantment(out var baseEnchantment))
{
return enchantment.Address == baseEnchantment;
}

if (itemEntry.TryGetExtraEnchantment(out var extraEnchantment))
{
return extraEnchantment.Enchantment == enchantment;
}

return false;
}

/// <summary>
/// Enum for the type of soul in a soul gem.
/// Do note that <see cref="None"/> means there is
Expand Down
11 changes: 5 additions & 6 deletions Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ protected override bool Initialize(bool loadedAny)
AddressLibrary.GetRealHoursPassedFunc = Main.GameInfo.GetAddressOf(54842);
AddressLibrary.GetSoulTypeFunc = Main.GameInfo.GetAddressOf(11561);

AddressLibrary.SmithingTempering = Main.GameInfo.GetAddressOf(50477, 0x115, 6);//, "FF 90 B8 07 00 00");
/*AddressLibrary.SmithingCrafting = Main.GameInfo.GetAddressOf(50476, 0x91, 6, "FF 90 B8 07 00 00");
AddressLibrary.Enchanting = Main.GameInfo.GetAddressOf(50450, 0x275, 6, "FF 90 B8 07 00 00");
AddressLibrary.Disenchanting = Main.GameInfo.GetAddressOf(50459, 0xBA, 6, "FF 90 B8 07 00 00");
AddressLibrary.Alchemy = Main.GameInfo.GetAddressOf(50449, 0x207, 6, "FF 90 B8 07 00 00");
*/
AddressLibrary.SmithingTempering = Main.GameInfo.GetAddressOf(50477, 0x115, 6);
AddressLibrary.SmithingCrafting = Main.GameInfo.GetAddressOf(50476, 0x91, 6);
AddressLibrary.Enchanting = Main.GameInfo.GetAddressOf(50450, 0x275, 6);
AddressLibrary.Disenchanting = Main.GameInfo.GetAddressOf(50459, 0xBA, 6);
AddressLibrary.Alchemy = Main.GameInfo.GetAddressOf(50449, 0x207, 6);

Events.OnTempering = new EventHook<Events.TemperingEventArgs>(EventHookFlags.None, "smithing.tempering", Events.TemperingEventHookParameters);

Expand Down

0 comments on commit 2829e82

Please sign in to comment.