This repository has been archived by the owner on Nov 10, 2021. It is now read-only.
generated from erri120/netscriptframework-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
102 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using NetScriptFramework; | ||
|
||
namespace UtilityLibrary | ||
{ | ||
public static partial class Events | ||
{ | ||
/// <summary> | ||
/// Event is raised when tempering Armor. | ||
/// </summary> | ||
public static Event<TemperingEventArgs> OnTempering { get; internal set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
using System; | ||
using NetScriptFramework; | ||
using NetScriptFramework.SkyrimSE; | ||
|
||
namespace UtilityLibrary | ||
{ | ||
public partial class Events | ||
{ | ||
public class TemperingEventArgs : HookedEventArgs | ||
{ | ||
/// <summary> | ||
/// The item that gets tempered | ||
/// </summary> | ||
public TESForm Item { get; internal set; } | ||
|
||
/// <summary> | ||
/// The old quality of the item | ||
/// </summary> | ||
public float OldQuality { get; set; } | ||
|
||
/// <summary> | ||
/// The new quality of the item | ||
/// </summary> | ||
public float NewQuality { get; set; } | ||
|
||
/// <summary> | ||
/// Temper information | ||
/// </summary> | ||
public BGSConstructibleObject TemperForm { get; set; } | ||
|
||
/// <summary> | ||
/// XP gained from tempering | ||
/// </summary> | ||
public float XP { get; set; } | ||
} | ||
|
||
internal static EventHookParameters<TemperingEventArgs> TemperingEventHookParameters => | ||
new EventHookParameters<TemperingEventArgs>(AddressLibrary.SmithingTempering, 6, 6, "FF 90 B8 07 00 00", | ||
ctx => | ||
{ | ||
var args = new TemperingEventArgs(); | ||
var ptr = Memory.ReadPointer(ctx.BX); | ||
if (ptr != IntPtr.Zero) | ||
{ | ||
ptr = Memory.ReadPointer(ptr); | ||
args.Item = MemoryObject.FromAddress<TESForm>(ptr); | ||
} | ||
args.OldQuality = Memory.ReadFloat(ctx.BX + 0x18); | ||
args.NewQuality = Memory.ReadFloat(ctx.BX + 0x1C); | ||
args.TemperForm = MemoryObject.FromAddress<BGSConstructibleObject>(Memory.ReadPointer(ctx.BX + 0x10)); | ||
args.XP = ctx.XMM2f; | ||
return args; | ||
}, (ctx, args) => | ||
{ | ||
Memory.WriteFloat(ctx.BX + 0x18, args.OldQuality); | ||
Memory.WriteFloat(ctx.BX + 0x1C, args.NewQuality); | ||
Memory.WritePointer(ctx.BX + 0x10, args.TemperForm.Cast<BGSConstructibleObject>()); | ||
ctx.XMM2f = args.XP; | ||
}); | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters