More cleanup
This commit is contained in:
@@ -6,101 +6,102 @@ using FFXIVClientStructs.FFXIV.Component.GUI;
|
||||
|
||||
namespace ChatTwo.GameFunctions;
|
||||
|
||||
internal sealed unsafe class Party {
|
||||
internal sealed unsafe class Party
|
||||
{
|
||||
[Signature("E8 ?? ?? ?? ?? 33 C0 EB 51", Fallibility = Fallibility.Fallible)]
|
||||
private readonly delegate* unmanaged<IntPtr, ulong, byte*, ushort, byte> _inviteToParty = null!;
|
||||
private readonly delegate* unmanaged<IntPtr, ulong, byte*, ushort, byte> InviteToPartyNative = null!;
|
||||
|
||||
[Signature("48 83 EC 38 41 B1 09", Fallibility = Fallibility.Fallible)]
|
||||
private readonly delegate* unmanaged<IntPtr, ulong, ushort, byte> _inviteToPartyContentId = null!;
|
||||
private readonly delegate* unmanaged<IntPtr, ulong, ushort, byte> InviteToPartyContentIdNative = null!;
|
||||
|
||||
[Signature("E8 ?? ?? ?? ?? E9 ?? ?? ?? ?? 48 8B 83 ?? ?? ?? ?? 48 85 C0 74 62", Fallibility = Fallibility.Fallible)]
|
||||
private readonly delegate* unmanaged<IntPtr, ulong, byte> _inviteToPartyInInstance = null!;
|
||||
private readonly delegate* unmanaged<IntPtr, ulong, byte> InviteToPartyInInstanceNative = null!;
|
||||
|
||||
[Signature("E8 ?? ?? ?? ?? E9 ?? ?? ?? ?? 49 8B 56 20", Fallibility = Fallibility.Fallible)]
|
||||
private readonly delegate* unmanaged<AgentInterface*, byte*, ushort, ulong, void> _promote = null!;
|
||||
private readonly delegate* unmanaged<AgentInterface*, byte*, ushort, ulong, void> PromoteNative = null!;
|
||||
|
||||
[Signature("E8 ?? ?? ?? ?? EB 66 49 8B 4E 20", Fallibility = Fallibility.Fallible)]
|
||||
private readonly delegate* unmanaged<AgentInterface*, byte*, ushort, ulong, void> _kick = null!;
|
||||
private readonly delegate* unmanaged<AgentInterface*, byte*, ushort, ulong, void> KickNative = null!;
|
||||
|
||||
private Plugin Plugin { get; }
|
||||
|
||||
internal Party(Plugin plugin) {
|
||||
internal Party(Plugin plugin)
|
||||
{
|
||||
Plugin = plugin;
|
||||
Plugin.GameInteropProvider.InitializeFromAttributes(this);
|
||||
}
|
||||
|
||||
internal void InviteSameWorld(string name, ushort world, ulong contentId) {
|
||||
if (_inviteToParty == null) {
|
||||
internal void InviteSameWorld(string name, ushort world, ulong contentId)
|
||||
{
|
||||
if (InviteToPartyNative == null)
|
||||
return;
|
||||
}
|
||||
|
||||
// 6.11: 214A55
|
||||
var a1 = Plugin.Functions.GetInfoProxyByIndex(2);
|
||||
|
||||
// this only works if target is on the same world
|
||||
fixed (byte* namePtr = name.ToTerminatedBytes()) {
|
||||
// this only works if target is on the same world
|
||||
_inviteToParty(a1, contentId, namePtr, world);
|
||||
InviteToPartyNative(a1, contentId, namePtr, world);
|
||||
}
|
||||
}
|
||||
|
||||
internal void InviteOtherWorld(ulong contentId) {
|
||||
if (_inviteToPartyContentId == null) {
|
||||
internal void InviteOtherWorld(ulong contentId)
|
||||
{
|
||||
if (InviteToPartyContentIdNative == null)
|
||||
return;
|
||||
}
|
||||
|
||||
// 6.11: 214A55
|
||||
var a1 = Plugin.Functions.GetInfoProxyByIndex(2);
|
||||
if (contentId != 0) {
|
||||
// third param is world, but it requires a specific world
|
||||
// if they're not on that world, it will fail
|
||||
// pass 0 and it will work on any world EXCEPT for the world the
|
||||
// current player is on
|
||||
_inviteToPartyContentId(a1, contentId, 0);
|
||||
}
|
||||
|
||||
// third param is world, but it requires a specific world
|
||||
// if they're not on that world, it will fail
|
||||
// pass 0 and it will work on any world EXCEPT for the world the
|
||||
// current player is on
|
||||
if (contentId != 0)
|
||||
InviteToPartyContentIdNative(a1, contentId, 0);
|
||||
}
|
||||
|
||||
internal void InviteInInstance(ulong contentId) {
|
||||
if (_inviteToPartyInInstance == null) {
|
||||
internal void InviteInInstance(ulong contentId)
|
||||
{
|
||||
if (InviteToPartyInInstanceNative == null)
|
||||
return;
|
||||
}
|
||||
|
||||
// 6.11: 214A55
|
||||
var a1 = Plugin.Functions.GetInfoProxyByIndex(2);
|
||||
if (contentId != 0) {
|
||||
// third param is world, but it requires a specific world
|
||||
// if they're not on that world, it will fail
|
||||
// pass 0 and it will work on any world EXCEPT for the world the
|
||||
// current player is on
|
||||
_inviteToPartyInInstance(a1, contentId);
|
||||
}
|
||||
|
||||
// third param is world, but it requires a specific world
|
||||
// if they're not on that world, it will fail
|
||||
// pass 0 and it will work on any world EXCEPT for the world the
|
||||
// current player is on
|
||||
if (contentId != 0)
|
||||
InviteToPartyInInstanceNative(a1, contentId);
|
||||
}
|
||||
|
||||
internal void Kick(string name, ulong contentId) {
|
||||
if (_kick == null) {
|
||||
internal void Kick(string name, ulong contentId)
|
||||
{
|
||||
if (KickNative == null)
|
||||
return;
|
||||
}
|
||||
|
||||
var agent = Framework.Instance()->GetUiModule()->GetAgentModule()->GetAgentByInternalId(AgentId.SocialPartyMember);
|
||||
if (agent == null) {
|
||||
if (agent == null)
|
||||
return;
|
||||
}
|
||||
|
||||
fixed (byte* namePtr = name.ToTerminatedBytes()) {
|
||||
_kick(agent, namePtr, 0, contentId);
|
||||
KickNative(agent, namePtr, 0, contentId);
|
||||
}
|
||||
}
|
||||
|
||||
internal void Promote(string name, ulong contentId) {
|
||||
if (_promote == null) {
|
||||
internal void Promote(string name, ulong contentId)
|
||||
{
|
||||
if (PromoteNative == null)
|
||||
return;
|
||||
}
|
||||
|
||||
var agent = Framework.Instance()->GetUiModule()->GetAgentModule()->GetAgentByInternalId(AgentId.SocialPartyMember);
|
||||
if (agent == null) {
|
||||
if (agent == null)
|
||||
return;
|
||||
}
|
||||
|
||||
fixed (byte* namePtr = name.ToTerminatedBytes()) {
|
||||
_promote(agent, namePtr, 0, contentId);
|
||||
PromoteNative(agent, namePtr, 0, contentId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user