diff --git a/ChatTwo/GameFunctions/Party.cs b/ChatTwo/GameFunctions/Party.cs index 0437d3b..2e94ec2 100755 --- a/ChatTwo/GameFunctions/Party.cs +++ b/ChatTwo/GameFunctions/Party.cs @@ -9,7 +9,10 @@ namespace ChatTwo.GameFunctions; internal sealed unsafe class Party { [Signature("E8 ?? ?? ?? ?? 33 C0 EB 51", Fallibility = Fallibility.Fallible)] - private readonly delegate* unmanaged _inviteToParty = null!; + private readonly delegate* unmanaged _inviteToParty = null!; + + [Signature("48 83 EC 38 41 B1 09", Fallibility = Fallibility.Fallible)] + private readonly delegate* unmanaged _inviteToPartyContentId = null!; [Signature("E8 ?? ?? ?? ?? E9 ?? ?? ?? ?? 49 8B 56 20", Fallibility = Fallibility.Fallible)] private readonly delegate* unmanaged _promote = null!; @@ -24,7 +27,7 @@ internal sealed unsafe class Party { Siggingway.Siggingway.Initialise(this.Plugin.SigScanner, this); } - internal void Invite(string name, ushort world) { + internal void Invite(string name, ushort world, ulong contentId) { if (this._inviteToParty == null || this.Plugin.Functions.Indexer == null) { return; } @@ -35,9 +38,17 @@ internal sealed unsafe class Party { var toIndex = func(uiModule); var a1 = this.Plugin.Functions.Indexer(toIndex, 1); + 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 + this._inviteToPartyContentId(a1, contentId, 0); + } + fixed (byte* namePtr = name.ToTerminatedBytes()) { - // can specify content id if we have it, but there's no need - this._inviteToParty(a1, 0, namePtr, world); + // this only works if target is on the same world + this._inviteToParty(a1, contentId, namePtr, world); } } diff --git a/ChatTwo/PayloadHandler.cs b/ChatTwo/PayloadHandler.cs index 9a449d3..d5ea0ef 100755 --- a/ChatTwo/PayloadHandler.cs +++ b/ChatTwo/PayloadHandler.cs @@ -298,7 +298,7 @@ internal sealed class PayloadHandler { var isInParty = member != default; if (isLeader) { if (!isInParty && ImGui.Selectable("Invite to Party")) { - this.Ui.Plugin.Functions.Party.Invite(player.PlayerName, (ushort) player.World.RowId); + this.Ui.Plugin.Functions.Party.Invite(player.PlayerName, (ushort) player.World.RowId, chunk.Message?.ContentId ?? 0); } if (isInParty && member != null) {