TeleportConsumer.cs 752 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System;
  2. using Dalamud.Logging;
  3. using Dalamud.Plugin.Ipc;
  4. namespace HuntBuddy.Ipc
  5. {
  6. public class TeleportConsumer
  7. {
  8. private ICallGateSubscriber<uint, byte, bool> _consumerTeleport = null!;
  9. private void Subscribe()
  10. {
  11. try
  12. {
  13. this._consumerTeleport = Plugin.PluginInterface.GetIpcSubscriber<uint, byte, bool>("Teleport");
  14. }
  15. catch (Exception ex)
  16. {
  17. PluginLog.LogDebug($"Failed to subscribe to Teleporter\nReason: {ex}");
  18. }
  19. }
  20. public TeleportConsumer() => this.Subscribe();
  21. public bool Teleport(uint aetheryteId)
  22. {
  23. try
  24. {
  25. return this._consumerTeleport.InvokeFunc(aetheryteId, 0);
  26. }
  27. catch
  28. {
  29. Plugin.Chat.PrintError("Teleporter plugin is not responding");
  30. return false;
  31. }
  32. }
  33. }
  34. }