refactor: use DI attributes
This commit is contained in:
parent
e3c3060ef2
commit
eac0cfb973
|
@ -45,7 +45,7 @@ namespace GoodMemory {
|
||||||
}
|
}
|
||||||
|
|
||||||
var cardId = item.AdditionalData;
|
var cardId = item.AdditionalData;
|
||||||
var card = this.Plugin.DataManager.GetExcelSheet<TripleTriadCard>().GetRow(cardId);
|
var card = this.Plugin.DataManager.GetExcelSheet<TripleTriadCard>()!.GetRow(cardId);
|
||||||
return card != null && this.HasCard((ushort) card.RowId);
|
return card != null && this.HasCard((ushort) card.RowId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ using Dalamud.Game;
|
||||||
using Dalamud.Game.ClientState;
|
using Dalamud.Game.ClientState;
|
||||||
using Dalamud.Game.Text.SeStringHandling;
|
using Dalamud.Game.Text.SeStringHandling;
|
||||||
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
||||||
|
using Dalamud.IoC;
|
||||||
using XivCommon;
|
using XivCommon;
|
||||||
using XivCommon.Functions.Tooltips;
|
using XivCommon.Functions.Tooltips;
|
||||||
|
|
||||||
|
@ -15,17 +16,19 @@ namespace GoodMemory {
|
||||||
public class Plugin : IDalamudPlugin {
|
public class Plugin : IDalamudPlugin {
|
||||||
public string Name => "Good Memory";
|
public string Name => "Good Memory";
|
||||||
|
|
||||||
private ClientState ClientState { get; }
|
[PluginService]
|
||||||
internal DataManager DataManager { get; }
|
private ClientState ClientState { get; init; } = null!;
|
||||||
internal SigScanner SigScanner { get; }
|
|
||||||
|
[PluginService]
|
||||||
|
internal DataManager DataManager { get; init; } = null!;
|
||||||
|
|
||||||
|
[PluginService]
|
||||||
|
internal SigScanner SigScanner { get; init; } = null!;
|
||||||
|
|
||||||
private GameFunctions Functions { get; }
|
private GameFunctions Functions { get; }
|
||||||
private XivCommonBase Common { get; }
|
private XivCommonBase Common { get; }
|
||||||
|
|
||||||
public Plugin(ClientState clientState, DataManager dataManager, SigScanner sigScanner) {
|
public Plugin() {
|
||||||
this.ClientState = clientState;
|
|
||||||
this.DataManager = dataManager;
|
|
||||||
this.SigScanner = sigScanner;
|
|
||||||
|
|
||||||
this.Common = new XivCommonBase(Hooks.Tooltips);
|
this.Common = new XivCommonBase(Hooks.Tooltips);
|
||||||
this.Common.Functions.Tooltips.OnItemTooltip += this.OnItemTooltip;
|
this.Common.Functions.Tooltips.OnItemTooltip += this.OnItemTooltip;
|
||||||
|
|
||||||
|
@ -50,7 +53,7 @@ namespace GoodMemory {
|
||||||
itemId -= 1_000_000;
|
itemId -= 1_000_000;
|
||||||
}
|
}
|
||||||
|
|
||||||
var item = this.DataManager.GetExcelSheet<Item>().GetRow((uint) itemId);
|
var item = this.DataManager.GetExcelSheet<Item>()!.GetRow((uint) itemId);
|
||||||
if (item == null) {
|
if (item == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -59,7 +62,7 @@ namespace GoodMemory {
|
||||||
|
|
||||||
// Faded Copies
|
// Faded Copies
|
||||||
if (item.FilterGroup == 12 && item.ItemUICategory.Value?.RowId == 94 && item.LevelItem.Value?.RowId == 1) {
|
if (item.FilterGroup == 12 && item.ItemUICategory.Value?.RowId == 94 && item.LevelItem.Value?.RowId == 1) {
|
||||||
var recipeResults = this.DataManager.GetExcelSheet<Recipe>()
|
var recipeResults = this.DataManager.GetExcelSheet<Recipe>()!
|
||||||
.Where(recipe => recipe.UnkStruct5.Any(ritem => ritem.ItemIngredient == item.RowId))
|
.Where(recipe => recipe.UnkStruct5.Any(ritem => ritem.ItemIngredient == item.RowId))
|
||||||
.Select(recipe => recipe.ItemResult.Value)
|
.Select(recipe => recipe.ItemResult.Value)
|
||||||
.Where(result => result != null)
|
.Where(result => result != null)
|
||||||
|
@ -74,7 +77,7 @@ namespace GoodMemory {
|
||||||
Debug.Assert(resultAction != null, nameof(resultAction) + " != null");
|
Debug.Assert(resultAction != null, nameof(resultAction) + " != null");
|
||||||
|
|
||||||
uint orchId = resultAction.Data[0];
|
uint orchId = resultAction.Data[0];
|
||||||
var orch = this.DataManager.GetExcelSheet<Orchestrion>().GetRow(orchId);
|
var orch = this.DataManager.GetExcelSheet<Orchestrion>()!.GetRow(orchId);
|
||||||
if (orch == null) {
|
if (orch == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue