Minor touch ups

master
Liza 2024-05-29 01:23:54 +02:00
parent 40a3e6c202
commit 63553e2326
Signed by: liza
GPG Key ID: 7199F8D727D55F67
2 changed files with 25 additions and 30 deletions

View File

@ -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<uint, Book> books = new Dictionary<uint, Book>();
private readonly IDictionary<uint, Book> _books = new Dictionary<uint, Book>();
private ISet<uint> atmaWeapons = new HashSet<uint> {
private readonly ISet<uint> _atmaWeapons = new HashSet<uint> {
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<Excel.RelicNote>()!;
var relicNoteSheet = this._dataManager.GetExcelSheet<Excel.RelicNote>()!;
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);
}
}

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<LangVersion>9.0</LangVersion>
<Version>2.0.0.0</Version>
<DebugType>none</DebugType>
@ -14,7 +14,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DalamudPackager" Version="2.1.8" />
<PackageReference Include="DalamudPackager" Version="2.1.12" />
</ItemGroup>
<ItemGroup>