-
Notifications
You must be signed in to change notification settings - Fork 13
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
3b0d230
commit ae5492b
Showing
16 changed files
with
1,475 additions
and
1,538 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,15 +1,12 @@ | ||
using System; | ||
|
||
namespace HuntBuddy.Attributes | ||
{ | ||
[AttributeUsage(AttributeTargets.Method)] | ||
public class AliasesAttribute : Attribute | ||
{ | ||
public string[] Aliases { get; } | ||
namespace HuntBuddy.Attributes; | ||
|
||
public AliasesAttribute(params string[] aliases) | ||
{ | ||
this.Aliases = aliases; | ||
} | ||
[AttributeUsage(AttributeTargets.Method)] | ||
public class AliasesAttribute: Attribute { | ||
public string[] Aliases { | ||
get; | ||
} | ||
} | ||
|
||
public AliasesAttribute(params string[] aliases) => this.Aliases = aliases; | ||
} |
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 |
---|---|---|
@@ -1,15 +1,10 @@ | ||
using System; | ||
|
||
namespace HuntBuddy.Attributes | ||
{ | ||
[AttributeUsage(AttributeTargets.Method)] | ||
public class CommandAttribute : Attribute | ||
{ | ||
public string Command { get; } | ||
namespace HuntBuddy.Attributes; | ||
|
||
public CommandAttribute(string command) | ||
{ | ||
this.Command = command; | ||
} | ||
} | ||
} | ||
[AttributeUsage(AttributeTargets.Method)] | ||
public class CommandAttribute: Attribute { | ||
public string Command { get; } | ||
|
||
public CommandAttribute(string command) => this.Command = command; | ||
} |
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 |
---|---|---|
@@ -1,9 +1,6 @@ | ||
using System; | ||
|
||
namespace HuntBuddy.Attributes | ||
{ | ||
[AttributeUsage(AttributeTargets.Method)] | ||
public class DoNotShowInHelpAttribute : Attribute | ||
{ | ||
} | ||
} | ||
namespace HuntBuddy.Attributes; | ||
|
||
[AttributeUsage(AttributeTargets.Method)] | ||
public class DoNotShowInHelpAttribute: Attribute; |
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 |
---|---|---|
@@ -1,15 +1,12 @@ | ||
using System; | ||
|
||
namespace HuntBuddy.Attributes | ||
{ | ||
[AttributeUsage(AttributeTargets.Method)] | ||
public class HelpMessageAttribute : Attribute | ||
{ | ||
public string HelpMessage { get; } | ||
namespace HuntBuddy.Attributes; | ||
|
||
public HelpMessageAttribute(string helpMessage) | ||
{ | ||
this.HelpMessage = helpMessage; | ||
} | ||
[AttributeUsage(AttributeTargets.Method)] | ||
public class HelpMessageAttribute: Attribute { | ||
public string HelpMessage { | ||
get; | ||
} | ||
} | ||
|
||
public HelpMessageAttribute(string helpMessage) => this.HelpMessage = helpMessage; | ||
} |
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 |
---|---|---|
@@ -1,27 +1,26 @@ | ||
using System.Numerics; | ||
using System.Text.Json.Serialization; | ||
|
||
using Dalamud.Configuration; | ||
|
||
namespace HuntBuddy | ||
{ | ||
public class Configuration : IPluginConfiguration | ||
{ | ||
public int Version { get; set; } | ||
namespace HuntBuddy; | ||
|
||
public class Configuration: IPluginConfiguration { | ||
public int Version { | ||
get; | ||
set; | ||
} | ||
|
||
public bool IncludeAreaOnMap; | ||
public bool LockWindowPositions; | ||
public bool ShowLocalHunts; | ||
public bool ShowLocalHuntIcons; | ||
public bool HideLocalHuntBackground; | ||
public bool HideCompletedHunts; | ||
public float IconScale = 1f; | ||
public Vector4 IconBackgroundColour = new (0.76f, 0.75f, 0.76f, 0.8f); | ||
public bool IncludeAreaOnMap; | ||
public bool LockWindowPositions; | ||
public bool ShowLocalHunts; | ||
public bool ShowLocalHuntIcons; | ||
public bool HideLocalHuntBackground; | ||
public bool HideCompletedHunts; | ||
public float IconScale = 1f; | ||
public Vector4 IconBackgroundColour = new(0.76f, 0.75f, 0.76f, 0.8f); | ||
|
||
[JsonIgnore] public uint IconBackgroundColourU32; | ||
[JsonIgnore] public uint IconBackgroundColourU32; | ||
|
||
public void Save() | ||
{ | ||
Service.PluginInterface.SavePluginConfig(this); | ||
} | ||
} | ||
} | ||
public void Save() => Service.PluginInterface.SavePluginConfig(this); | ||
} |
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 |
---|---|---|
@@ -1,66 +1,54 @@ | ||
using System; | ||
using Dalamud.Plugin.Ipc; | ||
|
||
namespace HuntBuddy.Ipc | ||
{ | ||
public class TeleportConsumer | ||
{ | ||
private bool isAvailable; | ||
private long timeSinceLastCheck; | ||
using Dalamud.Plugin.Ipc; | ||
|
||
public bool IsAvailable | ||
{ | ||
get | ||
{ | ||
if (this.timeSinceLastCheck + 5000 > Environment.TickCount64) | ||
{ | ||
return this.isAvailable; | ||
} | ||
namespace HuntBuddy.Ipc; | ||
|
||
try | ||
{ | ||
this.consumerMessageSetting.InvokeFunc(); | ||
this.isAvailable = true; | ||
this.timeSinceLastCheck = Environment.TickCount64; | ||
} | ||
catch | ||
{ | ||
this.isAvailable = false; | ||
} | ||
public class TeleportConsumer { | ||
private bool isAvailable; | ||
private long timeSinceLastCheck; | ||
|
||
public bool IsAvailable { | ||
get { | ||
if (this.timeSinceLastCheck + 5000 > Environment.TickCount64) { | ||
return this.isAvailable; | ||
} | ||
} | ||
|
||
private ICallGateSubscriber<bool> consumerMessageSetting = null!; | ||
private ICallGateSubscriber<uint, byte, bool> consumerTeleport = null!; | ||
|
||
private void Subscribe() | ||
{ | ||
try | ||
{ | ||
this.consumerTeleport = Service.PluginInterface.GetIpcSubscriber<uint, byte, bool>("Teleport"); | ||
this.consumerMessageSetting = Service.PluginInterface.GetIpcSubscriber<bool>("Teleport.ChatMessage"); | ||
try { | ||
this.consumerMessageSetting.InvokeFunc(); | ||
this.isAvailable = true; | ||
this.timeSinceLastCheck = Environment.TickCount64; | ||
} | ||
catch (Exception ex) | ||
{ | ||
Service.PluginLog.Debug($"Failed to subscribe to Teleporter\nReason: {ex}"); | ||
catch { | ||
this.isAvailable = false; | ||
} | ||
|
||
return this.isAvailable; | ||
} | ||
} | ||
|
||
public TeleportConsumer() => this.Subscribe(); | ||
private ICallGateSubscriber<bool> consumerMessageSetting = null!; | ||
private ICallGateSubscriber<uint, byte, bool> consumerTeleport = null!; | ||
|
||
public bool Teleport(uint aetheryteId) | ||
{ | ||
try | ||
{ | ||
return this.consumerTeleport.InvokeFunc(aetheryteId, 0); | ||
} | ||
catch | ||
{ | ||
Service.Chat.PrintError("Teleporter plugin is not responding"); | ||
return false; | ||
} | ||
private void Subscribe() { | ||
try { | ||
this.consumerTeleport = Service.PluginInterface.GetIpcSubscriber<uint, byte, bool>("Teleport"); | ||
this.consumerMessageSetting = Service.PluginInterface.GetIpcSubscriber<bool>("Teleport.ChatMessage"); | ||
} | ||
catch (Exception ex) { | ||
Service.PluginLog.Debug($"Failed to subscribe to Teleporter\nReason: {ex}"); | ||
} | ||
} | ||
|
||
public TeleportConsumer() => this.Subscribe(); | ||
|
||
public bool Teleport(uint aetheryteId) { | ||
try { | ||
return this.consumerTeleport.InvokeFunc(aetheryteId, 0); | ||
} | ||
catch { | ||
Service.Chat.PrintError("Teleporter plugin is not responding"); | ||
return false; | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.