public void Teleport(string aetheryteName, bool matchPartial, bool useMapName = false) { try { if (useMapName) { var name = AetheryteDataManager.GetAetheryteLocationsByTerritoryName(aetheryteName, _plugin.Language, matchPartial).FirstOrDefault()?.Name; if (name == null) { _plugin.LogError($"No Aetheryte found for Map '{aetheryteName}'."); return; } aetheryteName = name; } var location = GetLocationByName(aetheryteName, matchPartial); if (location == null) { _plugin.LogError($"No attuned Aetheryte found for '{aetheryteName}'."); if (!_plugin.IsInHomeWorld && aetheryteName.Contains('(')) { _plugin.Log("Note: Estate Teleports not available while visiting other Worlds."); } return; } _plugin.Log($"Teleporting to '{location.Name}'."); _sendCommand?.Invoke(0xCA, location.AetheryteId, false, location.SubIndex, 0); } catch { _plugin.LogError("Error in Teleport(string,bool)"); } }
public void TeleportTicket(string aetheryteName, bool skipPopup, bool matchPartial, bool useMapName = false) { try { _tpTicketHook?.Disable(); if (useMapName) { var name = AetheryteDataManager.GetAetheryteLocationsByTerritoryName(aetheryteName, _plugin.Language, matchPartial).FirstOrDefault()?.Name; if (name == null) { _plugin.LogError($"No Aetheryte found for Map '{aetheryteName}'."); return; } aetheryteName = name; } var location = GetLocationByName(aetheryteName, matchPartial); if (location == null) { _plugin.LogError($"No attuned Aetheryte found for '{aetheryteName}'."); if (!_plugin.IsInHomeWorld && aetheryteName.Contains('(')) { _plugin.Log("Note: Estate Teleports not available while visiting other Worlds."); } return; } if (skipPopup) { var tickets = GetAetheryteTicketCount(); if (tickets > 0) { _plugin.Log($"Teleporting to '{location.Name}'. (Tickets: {tickets})"); _sendCommand?.Invoke(0xCA, location.AetheryteId, true, location.SubIndex, 0); return; } } else { bool?result = false; if (TeleportStatusAddress != IntPtr.Zero) { result = _tryTeleportWithTicket?.Invoke(TeleportStatusAddress, location.AetheryteId, location.SubIndex); } if (result == true) { _plugin.Log($"Teleporting to '{location.Name}'."); return; } } _plugin.Log($"Teleporting to '{location.Name}'. (Not using Tickets)"); _sendCommand?.Invoke(0xCA, location.AetheryteId, false, location.SubIndex, 0); } catch { _plugin.LogError("Error in TeleportTicket(string,bool,bool)"); } finally { _tpTicketHook?.Enable(); } }