Skip to content

Commit

Permalink
Apply style changes to project
Browse files Browse the repository at this point in the history
  • Loading branch information
SheepGoMeh committed Dec 26, 2023
1 parent 3b0d230 commit ae5492b
Show file tree
Hide file tree
Showing 16 changed files with 1,475 additions and 1,538 deletions.
19 changes: 8 additions & 11 deletions HuntBuddy/Attributes/AliasesAttribute.cs
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;
}
19 changes: 7 additions & 12 deletions HuntBuddy/Attributes/CommandAttribute.cs
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;
}
11 changes: 4 additions & 7 deletions HuntBuddy/Attributes/DoNotShowInHelpAttribute.cs
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;
19 changes: 8 additions & 11 deletions HuntBuddy/Attributes/HelpMessageAttribute.cs
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;
}
39 changes: 19 additions & 20 deletions HuntBuddy/Configuration.cs
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);
}
90 changes: 39 additions & 51 deletions HuntBuddy/Ipc/TeleportConsumer.cs
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;
}
}
}
}
Loading

0 comments on commit ae5492b

Please sign in to comment.