feat: add instanced inviting
This commit is contained in:
parent
9068199236
commit
7e4f6e1ed7
@ -13,6 +13,9 @@ internal sealed unsafe class Party {
|
||||
[Signature("48 83 EC 38 41 B1 09", Fallibility = Fallibility.Fallible)]
|
||||
private readonly delegate* unmanaged<IntPtr, ulong, ushort, byte> _inviteToPartyContentId = null!;
|
||||
|
||||
[Signature("E8 ?? ?? ?? ?? E9 ?? ?? ?? ?? 48 8B 83 ?? ?? ?? ?? 48 85 C0 74 62", Fallibility = Fallibility.Fallible)]
|
||||
private readonly delegate* unmanaged<IntPtr, ulong, byte> _inviteToPartyInInstance = null!;
|
||||
|
||||
[Signature("E8 ?? ?? ?? ?? E9 ?? ?? ?? ?? 49 8B 56 20", Fallibility = Fallibility.Fallible)]
|
||||
private readonly delegate* unmanaged<AgentInterface*, byte*, ushort, ulong, void> _promote = null!;
|
||||
|
||||
@ -40,7 +43,7 @@ internal sealed unsafe class Party {
|
||||
}
|
||||
|
||||
internal void InviteOtherWorld(ulong contentId) {
|
||||
if (this._inviteToPartyContentId != null) {
|
||||
if (this._inviteToPartyContentId == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -55,6 +58,22 @@ internal sealed unsafe class Party {
|
||||
}
|
||||
}
|
||||
|
||||
internal void InviteInInstance(ulong contentId) {
|
||||
if (this._inviteToPartyInInstance == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 6.11: 214A55
|
||||
var a1 = this.Plugin.Functions.GetInfoProxyByIndex(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._inviteToPartyInInstance(a1, contentId);
|
||||
}
|
||||
}
|
||||
|
||||
internal void Kick(string name, ulong contentId) {
|
||||
if (this._kick == null) {
|
||||
return;
|
||||
|
@ -450,17 +450,24 @@ internal sealed class PayloadHandler {
|
||||
var isLeader = party.Length == 0 || this.Ui.Plugin.ClientState.LocalContentId == leader;
|
||||
var member = party.FirstOrDefault(member => member.Name.TextValue == player.PlayerName && member.World.Id == player.World.RowId);
|
||||
var isInParty = member != default;
|
||||
var inPartyInstance = this.Ui.Plugin.DataManager.GetExcelSheet<TerritoryType>()!.GetRow(this.Ui.Plugin.ClientState.TerritoryType)?.TerritoryIntendedUse is (41 or 47 or 48 or 52 or 53);
|
||||
if (isLeader) {
|
||||
if (!isInParty && ImGui.BeginMenu("Invite to Party")) {
|
||||
if (ImGui.Selectable("Same world")) {
|
||||
this.Ui.Plugin.Functions.Party.InviteSameWorld(player.PlayerName, (ushort) player.World.RowId, chunk.Message?.ContentId ?? 0);
|
||||
}
|
||||
if (!isInParty) {
|
||||
if (inPartyInstance) {
|
||||
if (chunk.Message?.ContentId is not null or 0 && ImGui.Selectable("Invite to Party")) {
|
||||
this.Ui.Plugin.Functions.Party.InviteInInstance(chunk.Message!.ContentId);
|
||||
}
|
||||
} else if (ImGui.BeginMenu("Invite to Party")) {
|
||||
if (ImGui.Selectable("Same world")) {
|
||||
this.Ui.Plugin.Functions.Party.InviteSameWorld(player.PlayerName, (ushort) player.World.RowId, chunk.Message?.ContentId ?? 0);
|
||||
}
|
||||
|
||||
if (chunk.Message?.ContentId is not null or 0 && ImGui.Selectable("Different world")) {
|
||||
this.Ui.Plugin.Functions.Party.InviteOtherWorld(chunk.Message!.ContentId);
|
||||
}
|
||||
if (chunk.Message?.ContentId is not null or 0 && ImGui.Selectable("Different world")) {
|
||||
this.Ui.Plugin.Functions.Party.InviteOtherWorld(chunk.Message!.ContentId);
|
||||
}
|
||||
|
||||
ImGui.EndMenu();
|
||||
ImGui.EndMenu();
|
||||
}
|
||||
}
|
||||
|
||||
if (isInParty && member != null) {
|
||||
|
Loading…
Reference in New Issue
Block a user