feat: separate invite to party
This commit is contained in:
parent
2af0466d94
commit
fb3ee2efe2
|
@ -49,8 +49,7 @@
|
|||
<ItemGroup>
|
||||
<PackageReference Include="DalamudPackager" Version="2.1.5"/>
|
||||
<PackageReference Include="JetBrains.Annotations" Version="2021.3.0"/>
|
||||
<PackageReference Include="Siggingway" Version="1.1.1"/>
|
||||
<PackageReference Include="XivCommon" Version="4.0.0"/>
|
||||
<PackageReference Include="XivCommon" Version="5.0.0"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -7,6 +7,7 @@ using Dalamud.Game.Text.SeStringHandling;
|
|||
using Dalamud.Hooking;
|
||||
using Dalamud.Logging;
|
||||
using Dalamud.Memory;
|
||||
using Dalamud.Utility.Signatures;
|
||||
using FFXIVClientStructs.FFXIV.Client.System.Framework;
|
||||
using FFXIVClientStructs.FFXIV.Client.System.String;
|
||||
using FFXIVClientStructs.FFXIV.Client.UI;
|
||||
|
@ -14,7 +15,6 @@ using FFXIVClientStructs.FFXIV.Client.UI.Agent;
|
|||
using FFXIVClientStructs.FFXIV.Client.UI.Misc;
|
||||
using FFXIVClientStructs.FFXIV.Client.UI.Shell;
|
||||
using FFXIVClientStructs.FFXIV.Component.GUI;
|
||||
using Siggingway;
|
||||
using ValueType = FFXIVClientStructs.FFXIV.Component.GUI.ValueType;
|
||||
|
||||
namespace ChatTwo.GameFunctions;
|
||||
|
@ -119,7 +119,7 @@ internal sealed unsafe class Chat : IDisposable {
|
|||
|
||||
internal Chat(Plugin plugin) {
|
||||
this.Plugin = plugin;
|
||||
Siggingway.Siggingway.Initialise(this.Plugin.SigScanner, this);
|
||||
SignatureHelper.Initialise(this);
|
||||
|
||||
this.ChatLogRefreshHook?.Enable();
|
||||
this.ChangeChannelNameHook?.Enable();
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
using ChatTwo.Util;
|
||||
using Dalamud.Utility.Signatures;
|
||||
using FFXIVClientStructs.FFXIV.Client.System.Framework;
|
||||
using FFXIVClientStructs.FFXIV.Client.UI;
|
||||
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
|
||||
using FFXIVClientStructs.FFXIV.Component.GUI;
|
||||
using Siggingway;
|
||||
|
||||
namespace ChatTwo.GameFunctions;
|
||||
|
||||
|
@ -30,7 +30,7 @@ internal sealed unsafe class Context {
|
|||
|
||||
internal Context(Plugin plugin) {
|
||||
this.Plugin = plugin;
|
||||
Siggingway.Siggingway.Initialise(this.Plugin.SigScanner, this);
|
||||
SignatureHelper.Initialise(this);
|
||||
}
|
||||
|
||||
internal void InviteToNoviceNetwork(string name, ushort world) {
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
using System.Runtime.InteropServices;
|
||||
using Dalamud.Hooking;
|
||||
using Dalamud.Memory;
|
||||
using Dalamud.Utility.Signatures;
|
||||
using FFXIVClientStructs.FFXIV.Client.System.Framework;
|
||||
using FFXIVClientStructs.FFXIV.Client.UI;
|
||||
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
|
||||
using FFXIVClientStructs.FFXIV.Component.GUI;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
using Siggingway;
|
||||
|
||||
namespace ChatTwo.GameFunctions;
|
||||
|
||||
|
@ -63,7 +63,7 @@ internal unsafe class GameFunctions : IDisposable {
|
|||
this.Chat = new Chat(this.Plugin);
|
||||
this.Context = new Context(this.Plugin);
|
||||
|
||||
Siggingway.Siggingway.Initialise(this.Plugin.SigScanner, this);
|
||||
SignatureHelper.Initialise(this);
|
||||
|
||||
this.ResolveTextCommandPlaceholderHook?.Enable();
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
using ChatTwo.Util;
|
||||
using Dalamud.Utility.Signatures;
|
||||
using FFXIVClientStructs.FFXIV.Client.System.Framework;
|
||||
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
|
||||
using FFXIVClientStructs.FFXIV.Component.GUI;
|
||||
using Siggingway;
|
||||
|
||||
namespace ChatTwo.GameFunctions;
|
||||
|
||||
|
@ -23,17 +23,29 @@ internal sealed unsafe class Party {
|
|||
|
||||
internal Party(Plugin plugin) {
|
||||
this.Plugin = plugin;
|
||||
Siggingway.Siggingway.Initialise(this.Plugin.SigScanner, this);
|
||||
SignatureHelper.Initialise(this);
|
||||
}
|
||||
|
||||
internal void Invite(string name, ushort world, ulong contentId) {
|
||||
internal void InviteSameWorld(string name, ushort world, ulong contentId) {
|
||||
if (this._inviteToParty == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 6.05: 20D722
|
||||
var a1 = this.Plugin.Functions.GetInfoProxyByIndex(1);
|
||||
fixed (byte* namePtr = name.ToTerminatedBytes()) {
|
||||
// this only works if target is on the same world
|
||||
this._inviteToParty(a1, contentId, namePtr, world);
|
||||
}
|
||||
}
|
||||
|
||||
internal void InviteOtherWorld(ulong contentId) {
|
||||
if (this._inviteToPartyContentId != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 6.05: 20D722
|
||||
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
|
||||
|
@ -41,11 +53,6 @@ internal sealed unsafe class Party {
|
|||
// current player is on
|
||||
this._inviteToPartyContentId(a1, contentId, 0);
|
||||
}
|
||||
|
||||
fixed (byte* namePtr = name.ToTerminatedBytes()) {
|
||||
// this only works if target is on the same world
|
||||
this._inviteToParty(a1, contentId, namePtr, world);
|
||||
}
|
||||
}
|
||||
|
||||
internal void Kick(string name, ulong contentId) {
|
||||
|
|
|
@ -326,12 +326,15 @@ internal sealed class PayloadHandler {
|
|||
}
|
||||
|
||||
private void DrawPlayerPopup(Chunk chunk, PlayerPayload player) {
|
||||
var name = player.PlayerName;
|
||||
var name = new List<Chunk> { new TextChunk(null, null, player.PlayerName) };
|
||||
if (player.World.IsPublic) {
|
||||
name += $"{player.World.Name}";
|
||||
name.AddRange(new Chunk[] {
|
||||
new IconChunk(null, null, BitmapFontIcon.CrossWorld),
|
||||
new TextChunk(null, null, player.World.Name),
|
||||
});
|
||||
}
|
||||
|
||||
ImGui.TextUnformatted(name);
|
||||
this.Log.DrawChunks(name, false);
|
||||
ImGui.Separator();
|
||||
|
||||
if (player.World.IsPublic) {
|
||||
|
@ -346,8 +349,16 @@ internal sealed class PayloadHandler {
|
|||
var member = party.FirstOrDefault(member => member.Name.TextValue == player.PlayerName && member.World.Id == player.World.RowId);
|
||||
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, chunk.Message?.ContentId ?? 0);
|
||||
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 (chunk.Message?.ContentId is not null or 0 && ImGui.Selectable("Different world")) {
|
||||
this.Ui.Plugin.Functions.Party.InviteOtherWorld(chunk.Message!.ContentId);
|
||||
}
|
||||
|
||||
ImGui.EndMenu();
|
||||
}
|
||||
|
||||
if (isInParty && member != null) {
|
||||
|
|
Loading…
Reference in New Issue