mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-19 06:17:43 +01:00
Code cleanup (#2439)
* Use new Lock objects * Fix CA1513: Use ObjectDisposedException.ThrowIf * Fix CA1860: Avoid using 'Enumerable.Any()' extension method * Fix IDE0028: Use collection initializers or expressions * Fix CA2263: Prefer generic overload when type is known * Fix CA1862: Use the 'StringComparison' method overloads to perform case-insensitive string comparisons * Fix IDE0270: Null check can be simplified * Fix IDE0280: Use 'nameof' * Fix IDE0009: Add '.this' * Fix IDE0007: Use 'var' instead of explicit type * Fix IDE0062: Make local function static * Fix CA1859: Use concrete types when possible for improved performance * Fix IDE0066: Use switch expression Only applied to where it doesn't look horrendous. * Use is over switch * Fix CA1847: Use String.Contains(char) instead of String.Contains(string) with single characters * Fix SYSLIB1045: Use 'GeneratedRegexAttribute' to generate the regular expression implementation at compile-time. * Fix CA1866: Use 'string.EndsWith(char)' instead of 'string.EndsWith(string)' when you have a string with a single char * Fix IDE0057: Substring can be simplified * Fix IDE0059: Remove unnecessary value assignment * Fix CA1510: Use ArgumentNullException throw helper * Fix IDE0300: Use collection expression for array * Fix IDE0250: Struct can be made 'readonly' * Fix IDE0018: Inline variable declaration * Fix CA1850: Prefer static HashData method over ComputeHash * Fi CA1872: Prefer 'Convert.ToHexString' and 'Convert.ToHexStringLower' over call chains based on 'BitConverter.ToString' * Update ModuleLog instantiations * Organize usings
This commit is contained in:
parent
27414d33dd
commit
c93f04f0e4
295 changed files with 830 additions and 932 deletions
|
|
@ -37,7 +37,7 @@ internal class JobGauges : IServiceType, IJobGauges
|
|||
// Since the gauge itself reads from live memory, there isn't much downside to doing this.
|
||||
if (!this.cache.TryGetValue(typeof(T), out var gauge))
|
||||
{
|
||||
gauge = this.cache[typeof(T)] = (T)Activator.CreateInstance(typeof(T), BindingFlags.NonPublic | BindingFlags.Instance, null, new object[] { this.Address }, null);
|
||||
gauge = this.cache[typeof(T)] = (T)Activator.CreateInstance(typeof(T), BindingFlags.NonPublic | BindingFlags.Instance, null, [this.Address], null);
|
||||
}
|
||||
|
||||
return (T)gauge;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using Dalamud.Game.ClientState.JobGauge.Enums;
|
||||
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.Gauge;
|
||||
|
||||
namespace Dalamud.Game.ClientState.JobGauge.Types;
|
||||
|
|
@ -82,12 +83,12 @@ public unsafe class BRDGauge : JobGaugeBase<FFXIVClientStructs.FFXIV.Client.Game
|
|||
{
|
||||
get
|
||||
{
|
||||
return new[]
|
||||
{
|
||||
return
|
||||
[
|
||||
this.Struct->SongFlags.HasFlag(SongFlags.MagesBalladCoda) ? Song.Mage : Song.None,
|
||||
this.Struct->SongFlags.HasFlag(SongFlags.ArmysPaeonCoda) ? Song.Army : Song.None,
|
||||
this.Struct->SongFlags.HasFlag(SongFlags.WanderersMinuetCoda) ? Song.Wanderer : Song.None,
|
||||
};
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using Dalamud.Game.ClientState.JobGauge.Enums;
|
||||
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.Gauge;
|
||||
|
||||
namespace Dalamud.Game.ClientState.JobGauge.Types;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using FFXIVClientStructs.FFXIV.Client.Game.Gauge;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.Gauge;
|
||||
|
||||
using CanvasFlags = Dalamud.Game.ClientState.JobGauge.Enums.CanvasFlags;
|
||||
using CreatureFlags = Dalamud.Game.ClientState.JobGauge.Enums.CreatureFlags;
|
||||
|
|
@ -22,45 +22,45 @@ public unsafe class PCTGauge : JobGaugeBase<PictomancerGauge>
|
|||
/// <summary>
|
||||
/// Gets the use of subjective pallete.
|
||||
/// </summary>
|
||||
public byte PalleteGauge => Struct->PalleteGauge;
|
||||
public byte PalleteGauge => this.Struct->PalleteGauge;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the amount of paint the player has.
|
||||
/// </summary>
|
||||
public byte Paint => Struct->Paint;
|
||||
public byte Paint => this.Struct->Paint;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether a creature motif is drawn.
|
||||
/// </summary>
|
||||
public bool CreatureMotifDrawn => Struct->CreatureMotifDrawn;
|
||||
public bool CreatureMotifDrawn => this.Struct->CreatureMotifDrawn;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether a weapon motif is drawn.
|
||||
/// </summary>
|
||||
public bool WeaponMotifDrawn => Struct->WeaponMotifDrawn;
|
||||
public bool WeaponMotifDrawn => this.Struct->WeaponMotifDrawn;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether a landscape motif is drawn.
|
||||
/// </summary>
|
||||
public bool LandscapeMotifDrawn => Struct->LandscapeMotifDrawn;
|
||||
public bool LandscapeMotifDrawn => this.Struct->LandscapeMotifDrawn;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether a moogle portrait is ready.
|
||||
/// </summary>
|
||||
public bool MooglePortraitReady => Struct->MooglePortraitReady;
|
||||
public bool MooglePortraitReady => this.Struct->MooglePortraitReady;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether a madeen portrait is ready.
|
||||
/// </summary>
|
||||
public bool MadeenPortraitReady => Struct->MadeenPortraitReady;
|
||||
public bool MadeenPortraitReady => this.Struct->MadeenPortraitReady;
|
||||
|
||||
/// <summary>
|
||||
/// Gets which creature flags are present.
|
||||
/// </summary>
|
||||
public CreatureFlags CreatureFlags => (CreatureFlags)Struct->CreatureFlags;
|
||||
public CreatureFlags CreatureFlags => (CreatureFlags)this.Struct->CreatureFlags;
|
||||
|
||||
/// <summary>
|
||||
/// Gets which canvas flags are present.
|
||||
/// </summary>
|
||||
public CanvasFlags CanvasFlags => (CanvasFlags)Struct->CanvasFlags;
|
||||
public CanvasFlags CanvasFlags => (CanvasFlags)this.Struct->CanvasFlags;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using Dalamud.Game.ClientState.JobGauge.Enums;
|
||||
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.Gauge;
|
||||
|
||||
namespace Dalamud.Game.ClientState.JobGauge.Types;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
using FFXIVClientStructs.FFXIV.Client.Game.Gauge;
|
||||
|
||||
using Reloaded.Memory;
|
||||
|
||||
using DreadCombo = Dalamud.Game.ClientState.JobGauge.Enums.DreadCombo;
|
||||
using SerpentCombo = Dalamud.Game.ClientState.JobGauge.Enums.SerpentCombo;
|
||||
|
||||
|
|
@ -24,25 +22,25 @@ public unsafe class VPRGauge : JobGaugeBase<ViperGauge>
|
|||
/// <summary>
|
||||
/// Gets how many uses of uncoiled fury the player has.
|
||||
/// </summary>
|
||||
public byte RattlingCoilStacks => Struct->RattlingCoilStacks;
|
||||
public byte RattlingCoilStacks => this.Struct->RattlingCoilStacks;
|
||||
|
||||
/// <summary>
|
||||
/// Gets Serpent Offering stacks and gauge.
|
||||
/// </summary>
|
||||
public byte SerpentOffering => Struct->SerpentOffering;
|
||||
public byte SerpentOffering => this.Struct->SerpentOffering;
|
||||
|
||||
/// <summary>
|
||||
/// Gets value indicating the use of 1st, 2nd, 3rd, 4th generation and Ouroboros.
|
||||
/// </summary>
|
||||
public byte AnguineTribute => Struct->AnguineTribute;
|
||||
public byte AnguineTribute => this.Struct->AnguineTribute;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the last Weaponskill used in DreadWinder/Pit of Dread combo.
|
||||
/// </summary>
|
||||
public DreadCombo DreadCombo => (DreadCombo)Struct->DreadCombo;
|
||||
public DreadCombo DreadCombo => (DreadCombo)this.Struct->DreadCombo;
|
||||
|
||||
/// <summary>
|
||||
/// Gets current ability for Serpent's Tail.
|
||||
/// </summary>
|
||||
public SerpentCombo SerpentCombo => (SerpentCombo)Struct->SerpentCombo;
|
||||
public SerpentCombo SerpentCombo => (SerpentCombo)this.Struct->SerpentCombo;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue