-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
33b5ab2
commit b4b84d6
Showing
10 changed files
with
287 additions
and
145 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using System; | ||
using System.Linq; | ||
using System.Numerics; | ||
using Dalamud.Divination.Common.Api.Chat; | ||
using Dalamud.Divination.Common.Api.Dalamud; | ||
using Dalamud.Plugin; | ||
using Dalamud.Plugin.Ipc; | ||
using Divination.AetheryteLinkInChat.IpcModel; | ||
|
||
namespace Divination.FaloopIntegration.Ipc; | ||
|
||
public class AetheryteLinkInChatIpc(DalamudPluginInterface pluginInterface, IChatClient chatClient) | ||
{ | ||
private readonly ICallGateSubscriber<TeleportPayload, bool> subscriber = pluginInterface.GetIpcSubscriber<TeleportPayload, bool>(TeleportPayload.Name); | ||
|
||
public bool Teleport(uint territoryTypeId, uint mapId, Vector2 coordinates, uint worldId) | ||
{ | ||
if (!IsPluginInstalled()) | ||
{ | ||
chatClient.PrintError(Localization.AetheryteLinkInChatPluginNotInstalled); | ||
return false; | ||
} | ||
|
||
var payload = new TeleportPayload() | ||
{ | ||
TerritoryTypeId = territoryTypeId, | ||
MapId = mapId, | ||
Coordinates = coordinates, | ||
WorldId = worldId, | ||
}; | ||
|
||
try | ||
{ | ||
return subscriber.InvokeFunc(payload); | ||
} | ||
catch (Exception e) | ||
{ | ||
DalamudLog.Log.Error(e, "failed to invoke Teleport"); | ||
return false; | ||
} | ||
} | ||
|
||
private bool IsPluginInstalled() | ||
{ | ||
return pluginInterface.InstalledPlugins.Any(x => x.Name == "Divination.AetheryteLinkInChat" && x.IsLoaded); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.