mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-27 19:09:18 +01:00
Add 'Good Vibes'
This commit is contained in:
parent
210afc4f09
commit
382a1c0c96
2 changed files with 56 additions and 1 deletions
|
|
@ -95,7 +95,7 @@ internal class FoolsManager : IDisposable, IServiceType
|
|||
Name = "Oops, Maybe Lalafells!",
|
||||
InternalName = "OopsMaybeLalafellsPlugin",
|
||||
Description = "Turn everyone into Lalafells? Maybe. We haven't quite tested it yet.",
|
||||
Author = "Chrip",
|
||||
Author = "Chirpopo Chirpo",
|
||||
RealAuthor = "Chirp",
|
||||
Type = typeof(OopsMaybeLalafells),
|
||||
},
|
||||
|
|
@ -126,6 +126,15 @@ internal class FoolsManager : IDisposable, IServiceType
|
|||
RealAuthor = "NotNite",
|
||||
Type = typeof(YesSolicitingPlugin),
|
||||
},
|
||||
new()
|
||||
{
|
||||
Name = "Good Vibes",
|
||||
InternalName = "GoodVibesPlugin",
|
||||
Description = "Shake things up with this vibe plugin!",
|
||||
Author = "C h i r p",
|
||||
RealAuthor = "Chirp",
|
||||
Type = typeof(GoodVibesPlugin),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
46
Dalamud/Fools/Plugins/GoodVibesPlugin.cs
Normal file
46
Dalamud/Fools/Plugins/GoodVibesPlugin.cs
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
using System;
|
||||
using System.Numerics;
|
||||
|
||||
using Dalamud.Game;
|
||||
using Dalamud.Hooking;
|
||||
|
||||
namespace Dalamud.Fools.Plugins
|
||||
{
|
||||
public class GoodVibesPlugin : IFoolsPlugin
|
||||
{
|
||||
// Plugin
|
||||
|
||||
public GoodVibesPlugin()
|
||||
{
|
||||
var addr = Service<SigScanner>.Get().ScanText("48 83 EC 08 8B 02");
|
||||
OffsetModelHook = Hook<OffsetModelDelegate>.FromAddress(addr, OffsetModelDetour);
|
||||
OffsetModelHook.Enable();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
OffsetModelHook.Disable();
|
||||
OffsetModelHook.Dispose();
|
||||
}
|
||||
|
||||
// brrrrrrrr
|
||||
|
||||
private readonly Random Rng = new();
|
||||
|
||||
private Vector3 GenRandVec()
|
||||
{
|
||||
var Pos = new float[3];
|
||||
for (var i = 0; i < 3; i++)
|
||||
Pos[i] = Rng.Next(-5, 5) / 1000f;
|
||||
return new Vector3(Pos);
|
||||
}
|
||||
|
||||
private delegate nint OffsetModelDelegate(nint a1, nint a2);
|
||||
private Hook<OffsetModelDelegate> OffsetModelHook = null!;
|
||||
private unsafe nint OffsetModelDetour(nint a1, nint a2)
|
||||
{
|
||||
*(Vector3*)a2 += GenRandVec();
|
||||
return OffsetModelHook.Original(a1, a2);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue