Dalamud API10

This commit is contained in:
Loporrit
2024-07-03 18:44:23 +00:00
parent 00ab63a253
commit 47b292f4bb
31 changed files with 220 additions and 223 deletions

View File

@@ -1,4 +1,4 @@
using Dalamud.ContextMenu;
using Dalamud.Game.Gui.ContextMenu;
using Dalamud.Game.Text.SeStringHandling;
using Lumina.Excel.GeneratedSheets2;
using MareSynchronos.API.Data;
@@ -57,34 +57,38 @@ public class Pair
private PairHandler? CachedPlayer { get; set; }
public void AddContextMenu(GameObjectContextMenuOpenArgs args)
public void AddContextMenu(IMenuOpenedArgs args)
{
if (CachedPlayer == null || args.ObjectId != CachedPlayer.PlayerCharacterId || IsPaused) return;
if (CachedPlayer == null || true /* TODO: Check target */ || IsPaused) return;
SeStringBuilder seStringBuilder = new();
SeStringBuilder seStringBuilder2 = new();
SeStringBuilder seStringBuilder3 = new();
SeStringBuilder seStringBuilder4 = new();
var openProfileSeString = seStringBuilder.AddUiForeground(559).AddText(" ").AddUiForegroundOff().AddText("Open Profile").Build();
var reapplyDataSeString = seStringBuilder2.AddUiForeground(559).AddText(" ").AddUiForegroundOff().AddText("Reapply last data").Build();
var cyclePauseState = seStringBuilder3.AddUiForeground(559).AddText(" ").AddUiForegroundOff().AddText("Cycle pause state").Build();
var changePermissions = seStringBuilder4.AddUiForeground(559).AddText(" ").AddUiForegroundOff().AddText("Change Permissions").Build();
args.AddCustomItem(new GameObjectContextMenuItem(openProfileSeString, (a) =>
args.AddMenuItem(new MenuItem()
{
_mediator.Publish(new ProfileOpenStandaloneMessage(this));
}));
args.AddCustomItem(new GameObjectContextMenuItem(reapplyDataSeString, (a) =>
Name = "Open Profile",
OnClicked = (a) => _mediator.Publish(new ProfileOpenStandaloneMessage(this)),
PrefixColor = 559,
PrefixChar = '',
});
args.AddMenuItem(new MenuItem()
{
ApplyLastReceivedData(forced: true);
}, useDalamudIndicator: false));
args.AddCustomItem(new GameObjectContextMenuItem(changePermissions, (a) =>
Name = "Reapply last data",
OnClicked = (a) => ApplyLastReceivedData(forced: true),
PrefixColor = 559,
PrefixChar = '',
});
args.AddMenuItem(new MenuItem()
{
_mediator.Publish(new OpenPermissionWindow(this));
}, useDalamudIndicator: false));
args.AddCustomItem(new GameObjectContextMenuItem(cyclePauseState, (a) =>
Name = "Change Permissions",
OnClicked = (a) => _mediator.Publish(new OpenPermissionWindow(this)),
PrefixColor = 559,
PrefixChar = '',
});
args.AddMenuItem(new MenuItem()
{
_mediator.Publish(new CyclePauseMessage(UserData));
}, useDalamudIndicator: false));
Name = "Cycle pause state",
OnClicked = (a) => _mediator.Publish(new CyclePauseMessage(UserData)),
PrefixColor = 559,
PrefixChar = '',
});
}
public void ApplyData(OnlineUserCharaDataDto data)