feat: stop using the abandonware context menus
This commit is contained in:
parent
8f7534891c
commit
7e19d6c775
|
@ -1,12 +1,12 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Dalamud.ContextMenu;
|
||||||
using Dalamud.Data;
|
using Dalamud.Data;
|
||||||
using Dalamud.Game;
|
using Dalamud.Game;
|
||||||
using Dalamud.Game.ClientState;
|
using Dalamud.Game.ClientState;
|
||||||
using Dalamud.Game.ClientState.Objects;
|
using Dalamud.Game.ClientState.Objects;
|
||||||
using Dalamud.Game.Command;
|
using Dalamud.Game.Command;
|
||||||
using Dalamud.Game.Gui;
|
using Dalamud.Game.Gui;
|
||||||
using Dalamud.Game.Gui.ContextMenus;
|
|
||||||
using Dalamud.IoC;
|
using Dalamud.IoC;
|
||||||
using Dalamud.Plugin;
|
using Dalamud.Plugin;
|
||||||
using RoleplayersToolbox.Tools;
|
using RoleplayersToolbox.Tools;
|
||||||
|
@ -38,9 +38,11 @@ namespace RoleplayersToolbox {
|
||||||
|
|
||||||
[PluginService]
|
[PluginService]
|
||||||
internal CommandManager CommandManager { get; init; } = null!;
|
internal CommandManager CommandManager { get; init; } = null!;
|
||||||
|
|
||||||
[PluginService]
|
// [PluginService]
|
||||||
internal ContextMenu ContextMenu { get; init; } = null!;
|
// internal ContextMenu ContextMenu { get; init; } = null!;
|
||||||
|
|
||||||
|
internal DalamudContextMenu ContextMenu { get; }
|
||||||
|
|
||||||
[PluginService]
|
[PluginService]
|
||||||
internal DataManager DataManager { get; init; } = null!;
|
internal DataManager DataManager { get; init; } = null!;
|
||||||
|
@ -67,6 +69,8 @@ namespace RoleplayersToolbox {
|
||||||
this.Config = this.Interface.GetPluginConfig() as Configuration ?? new Configuration();
|
this.Config = this.Interface.GetPluginConfig() as Configuration ?? new Configuration();
|
||||||
this.Common = new XivCommonBase(Hooks.PartyFinderListings);
|
this.Common = new XivCommonBase(Hooks.PartyFinderListings);
|
||||||
|
|
||||||
|
this.ContextMenu = new DalamudContextMenu();
|
||||||
|
|
||||||
this.Tools.Add(new HousingTool(this));
|
this.Tools.Add(new HousingTool(this));
|
||||||
this.Tools.Add(new TargetingTool(this));
|
this.Tools.Add(new TargetingTool(this));
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,7 @@
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Dalamud.ContextMenu" Version="1.1.1"/>
|
||||||
<PackageReference Include="DalamudPackager" Version="2.1.7"/>
|
<PackageReference Include="DalamudPackager" Version="2.1.7"/>
|
||||||
<PackageReference Include="F23.StringSimilarity" Version="5.0.0"/>
|
<PackageReference Include="F23.StringSimilarity" Version="5.0.0"/>
|
||||||
<PackageReference Include="XivCommon" Version="5.0.1-alpha.1"/>
|
<PackageReference Include="XivCommon" Version="5.0.1-alpha.1"/>
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using Dalamud.ContextMenu;
|
||||||
using Dalamud.Game;
|
using Dalamud.Game;
|
||||||
using Dalamud.Game.Command;
|
using Dalamud.Game.Command;
|
||||||
using Dalamud.Game.Gui.ContextMenus;
|
|
||||||
using Dalamud.Game.Text.SeStringHandling;
|
using Dalamud.Game.Text.SeStringHandling;
|
||||||
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
||||||
using FFXIVClientStructs.FFXIV.Client.UI;
|
using FFXIVClientStructs.FFXIV.Client.UI;
|
||||||
|
@ -58,7 +58,7 @@ namespace RoleplayersToolbox.Tools.Housing {
|
||||||
this._addonMapHide = Marshal.GetDelegateForFunctionPointer<AddonMapHideDelegate>(addonMapHidePtr);
|
this._addonMapHide = Marshal.GetDelegateForFunctionPointer<AddonMapHideDelegate>(addonMapHidePtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.Plugin.ContextMenu.ContextMenuOpened += this.OnContextMenu;
|
this.Plugin.ContextMenu.OnOpenGameObjectContextMenu += this.OnContextMenu;
|
||||||
this.Plugin.Framework.Update += this.OnFramework;
|
this.Plugin.Framework.Update += this.OnFramework;
|
||||||
this.Plugin.CommandManager.AddHandler("/route", new CommandInfo(this.OnRouteCommand) {
|
this.Plugin.CommandManager.AddHandler("/route", new CommandInfo(this.OnRouteCommand) {
|
||||||
HelpMessage = "Extract housing information from the given text and open the routing window",
|
HelpMessage = "Extract housing information from the given text and open the routing window",
|
||||||
|
@ -72,7 +72,7 @@ namespace RoleplayersToolbox.Tools.Housing {
|
||||||
this.Plugin.CommandManager.RemoveHandler("/bookmarks");
|
this.Plugin.CommandManager.RemoveHandler("/bookmarks");
|
||||||
this.Plugin.CommandManager.RemoveHandler("/route");
|
this.Plugin.CommandManager.RemoveHandler("/route");
|
||||||
this.Plugin.Framework.Update -= this.OnFramework;
|
this.Plugin.Framework.Update -= this.OnFramework;
|
||||||
this.Plugin.ContextMenu.ContextMenuOpened -= this.OnContextMenu;
|
this.Plugin.ContextMenu.OnOpenGameObjectContextMenu -= this.OnContextMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void DrawSettings(ref bool anyChanged) {
|
public override void DrawSettings(ref bool anyChanged) {
|
||||||
|
@ -198,20 +198,18 @@ namespace RoleplayersToolbox.Tools.Housing {
|
||||||
this.BookmarksUi.ShouldDraw ^= true;
|
this.BookmarksUi.ShouldDraw ^= true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnContextMenu(ContextMenuOpenedArgs args) {
|
private void OnContextMenu(GameObjectContextMenuOpenArgs args) {
|
||||||
if (args.ParentAddonName != "LookingForGroup" || args.GameObjectContext?.ContentId is null or 0) {
|
if (args.ParentAddonName != "LookingForGroup" || args.ContentIdLower is 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
args.AddCustomSubMenu("Roleplayer's Toolbox", args => {
|
args.AddCustomItem(new GameObjectContextMenuItem("Select as Destination", this.SelectDestination));
|
||||||
args.AddCustomItem("Select as Destination", this.SelectDestination);
|
args.AddCustomItem(new GameObjectContextMenuItem("Add Bookmark", this.AddBookmark));
|
||||||
args.AddCustomItem("Add Bookmark", this.AddBookmark);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SelectDestination(CustomContextMenuItemSelectedArgs args) {
|
private void SelectDestination(GameObjectContextMenuItemSelectedArgs args) {
|
||||||
var contentId = args.ContextMenuOpenedArgs.GameObjectContext?.ContentId;
|
var contentId = args.ContentIdLower;
|
||||||
if (contentId is null or 0) {
|
if (contentId is 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,9 +224,9 @@ namespace RoleplayersToolbox.Tools.Housing {
|
||||||
this.Destination = InfoExtractor.Extract(listing.Description.TextValue, listing.World.Value.DataCenter.Row, this.Plugin.DataManager, this.Info);
|
this.Destination = InfoExtractor.Extract(listing.Description.TextValue, listing.World.Value.DataCenter.Row, this.Plugin.DataManager, this.Info);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddBookmark(CustomContextMenuItemSelectedArgs args) {
|
private void AddBookmark(GameObjectContextMenuItemSelectedArgs args) {
|
||||||
var contentId = args.ContextMenuOpenedArgs.GameObjectContext?.ContentId;
|
var contentId = args.ContentIdLower;
|
||||||
if (contentId is null or 0) {
|
if (contentId is 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue