feat: add PF links
This commit is contained in:
parent
8bd6cf0b0c
commit
ca38814902
|
@ -26,6 +26,9 @@ internal unsafe class GameFunctions : IDisposable {
|
|||
[Signature("E8 ?? ?? ?? ?? 84 C0 74 0D B0 02", Fallibility = Fallibility.Fallible)]
|
||||
private readonly delegate* unmanaged<IntPtr, byte> _isMentor = null!;
|
||||
|
||||
[Signature("48 89 5C 24 ?? 57 48 83 EC 20 48 8B FA 48 8B D9 E8 ?? ?? ?? ?? 48 8B 8B ?? ?? ?? ?? 48 85 C9", Fallibility = Fallibility.Fallible)]
|
||||
private readonly delegate* unmanaged<AgentInterface*, ulong, byte> _openPartyFinder = null!;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Hooks
|
||||
|
@ -217,6 +220,17 @@ internal unsafe class GameFunctions : IDisposable {
|
|||
return this._isMentor(this._isMentorA1.Value) > 0;
|
||||
}
|
||||
|
||||
internal void OpenPartyFinder(uint id) {
|
||||
if (this._openPartyFinder == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
var agent = Framework.Instance()->GetUiModule()->GetAgentModule()->GetAgentByInternalId(AgentId.LookingForGroup);
|
||||
if (agent != null) {
|
||||
this._openPartyFinder(agent, id);
|
||||
}
|
||||
}
|
||||
|
||||
private readonly IntPtr _placeholderNamePtr = Marshal.AllocHGlobal(128);
|
||||
private readonly string _placeholder = $"<{Guid.NewGuid():N}>";
|
||||
private string? _replacementName;
|
||||
|
|
|
@ -180,6 +180,10 @@ internal sealed class PayloadHandler {
|
|||
this.ClickLinkPayload(chunk, payload, link);
|
||||
break;
|
||||
}
|
||||
case PartyFinderPayload pf: {
|
||||
this.Ui.Plugin.Functions.OpenPartyFinder(pf.Id);
|
||||
break;
|
||||
}
|
||||
case RawPayload raw: {
|
||||
if (Equals(raw, ChunkUtil.PeriodicRecruitmentLink)) {
|
||||
GameFunctions.GameFunctions.OpenPartyFinder();
|
||||
|
|
|
@ -65,9 +65,20 @@ internal static class ChunkUtil {
|
|||
break;
|
||||
case PayloadType.Unknown:
|
||||
var rawPayload = (RawPayload) payload;
|
||||
if (rawPayload.Data[1] == 0x13) {
|
||||
if (rawPayload.Data.Length > 1 && rawPayload.Data[1] == 0x13) {
|
||||
foreground.Pop();
|
||||
glow.Pop();
|
||||
} else if (rawPayload.Data.Length > 7 && rawPayload.Data[1] == 0x27 && rawPayload.Data[3] == 0x0A) {
|
||||
// pf payload
|
||||
unsafe {
|
||||
fixed (byte* data = rawPayload.Data) {
|
||||
var id = *(uint*) (data + 4) >> 8;
|
||||
id = ((id & 0xFF) << 16)
|
||||
| (id & 0xFF00)
|
||||
| (id & 0xFF0000) >> 16;
|
||||
link = new PartyFinderPayload(id);
|
||||
}
|
||||
}
|
||||
} else if (Equals(rawPayload, RawPayload.LinkTerminator)) {
|
||||
link = null;
|
||||
} else if (Equals(rawPayload, PeriodicRecruitmentLink)) {
|
||||
|
|
21
ChatTwo/Util/Payloads.cs
Executable file
21
ChatTwo/Util/Payloads.cs
Executable file
|
@ -0,0 +1,21 @@
|
|||
using Dalamud.Game.Text.SeStringHandling;
|
||||
|
||||
namespace ChatTwo.Util;
|
||||
|
||||
internal class PartyFinderPayload : Payload {
|
||||
public override PayloadType Type => (PayloadType) 0x50;
|
||||
|
||||
internal uint Id { get; }
|
||||
|
||||
internal PartyFinderPayload(uint id) {
|
||||
this.Id = id;
|
||||
}
|
||||
|
||||
protected override byte[] EncodeImpl() {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
protected override void DecodeImpl(BinaryReader reader, long endOfStream) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user