diff --git a/Plugin.cs b/Plugin.cs index dbd2f8b..aa31f97 100644 --- a/Plugin.cs +++ b/Plugin.cs @@ -13,16 +13,15 @@ namespace ZodiacFinder { public class Plugin : IDalamudPlugin { - private readonly DalamudPluginInterface pluginInterface; - private readonly IChatGui chat; - private readonly IClientState clientState; - private readonly IObjectTable objectTable; - private readonly IDataManager dataManager; - private readonly IGameGui gameGui; + private readonly DalamudPluginInterface _pluginInterface; + private readonly IClientState _clientState; + private readonly IObjectTable _objectTable; + private readonly IDataManager _dataManager; + private readonly IGameGui _gameGui; - private readonly IDictionary books = new Dictionary(); + private readonly IDictionary _books = new Dictionary(); - private ISet atmaWeapons = new HashSet { + private readonly ISet _atmaWeapons = new HashSet { 7824, // Curtana Atma 7825, // Sphairai Atma 7826, // Bravura Atma @@ -36,25 +35,21 @@ namespace ZodiacFinder 9251, // Yoshimitsu Atma }; - public string Name => "ZodiacFinder"; - public Plugin( DalamudPluginInterface pi, - ICommandManager commands, IChatGui chat, IClientState clientState, IObjectTable objectTable, IDataManager dataManager, IGameGui gameGui) { - this.pluginInterface = pi; - this.chat = chat; - this.clientState = clientState; - this.objectTable = objectTable; - this.dataManager = dataManager; - this.gameGui = gameGui; + this._pluginInterface = pi; + this._clientState = clientState; + this._objectTable = objectTable; + this._dataManager = dataManager; + this._gameGui = gameGui; - this.pluginInterface.UiBuilder.Draw += this.Draw; + this._pluginInterface.UiBuilder.Draw += this.Draw; this.PopulateBooks(); } @@ -64,7 +59,7 @@ namespace ZodiacFinder { if (!disposing) return; - this.pluginInterface.UiBuilder.Draw -= this.Draw; + this._pluginInterface.UiBuilder.Draw -= this.Draw; } public void Dispose() @@ -76,7 +71,7 @@ namespace ZodiacFinder private unsafe void Draw() { - if (!clientState.IsLoggedIn || clientState.IsPvP || objectTable == null || !HasAtmaWeaponEquipped()) + if (!_clientState.IsLoggedIn || _clientState.IsPvP || _objectTable == null || !HasAtmaWeaponEquipped()) return; var bookId = GetCurrentBook(); @@ -87,10 +82,10 @@ namespace ZodiacFinder if (relicNote == null) return; - var book = books[bookId]; - for (int index = 0; index < objectTable.Length; ++index) + var book = _books[bookId]; + for (int index = 0; index < _objectTable.Length; ++index) { - GameObject obj = objectTable[index]; + GameObject obj = _objectTable[index]; if (!(obj is BattleNpc npc) || npc.CurrentHp == 0) continue; @@ -101,7 +96,7 @@ namespace ZodiacFinder if (relicNote->GetMonsterProgress(indexInBook) >= 3) continue; - if (!gameGui.WorldToScreen(new Vector3(obj.Position.X, obj.Position.Y, obj.Position.Z), out var pos)) + if (!_gameGui.WorldToScreen(new Vector3(obj.Position.X, obj.Position.Y, obj.Position.Z), out var pos)) continue; ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, new Vector2(0, 0)); @@ -122,7 +117,7 @@ namespace ZodiacFinder private bool HasAtmaWeaponEquipped() { - return atmaWeapons.Contains(GetEquippedItem(0)) || atmaWeapons.Contains(GetEquippedItem(1)); + return _atmaWeapons.Contains(GetEquippedItem(0)) || _atmaWeapons.Contains(GetEquippedItem(1)); } private unsafe uint GetCurrentBook() @@ -139,7 +134,7 @@ namespace ZodiacFinder continue; uint itemId = slot->ItemID; - if (books.ContainsKey(itemId)) + if (_books.ContainsKey(itemId)) return itemId; } @@ -165,7 +160,7 @@ namespace ZodiacFinder private void PopulateBooks() { - var relicNoteSheet = this.dataManager.GetExcelSheet()!; + var relicNoteSheet = this._dataManager.GetExcelSheet()!; foreach (var row in relicNoteSheet) { if (row.EventItem == null || row.EventItem.Row == 0) @@ -177,7 +172,7 @@ namespace ZodiacFinder book.Enemies.Add(row.MonsterNoteTargetCommon[i].MonsterNoteTargetCommon.Value!.BNpcName.Row); } //chat.Print($"{row.EventItem.Row} - {book}"); - books.Add(row.EventItem.Row, book); + _books.Add(row.EventItem.Row, book); } } diff --git a/ZodiacFinder.csproj b/ZodiacFinder.csproj index 8194e3d..01e4eb5 100644 --- a/ZodiacFinder.csproj +++ b/ZodiacFinder.csproj @@ -1,7 +1,7 @@  - net7.0-windows + net8.0-windows 9.0 2.0.0.0 none @@ -14,7 +14,7 @@ - +