fix: handle non-native event item tooltips

This commit is contained in:
Anna 2022-02-08 18:05:05 -05:00
parent 90d9818f94
commit b02473d32a
1 changed files with 26 additions and 0 deletions

View File

@ -204,6 +204,11 @@ internal sealed class PayloadHandler {
}
private void HoverItem(ItemPayload item) {
if (item.Kind == ItemPayload.ItemKind.EventItem) {
this.HoverEventItem(item);
return;
}
if (item.Item == null) {
return;
}
@ -220,6 +225,27 @@ internal sealed class PayloadHandler {
this.Log.DrawChunks(desc.ToList());
}
private void HoverEventItem(ItemPayload payload) {
var item = this.Ui.Plugin.DataManager.GetExcelSheet<EventItem>()?.GetRow(payload.RawItemId);
if (item == null) {
return;
}
if (this.Ui.Plugin.TextureCache.GetEventItem(item) is { } icon) {
InlineIcon(icon);
}
var name = ChunkUtil.ToChunks(item.Name.ToDalamudString(), null);
this.Log.DrawChunks(name.ToList());
ImGui.Separator();
var help = this.Ui.Plugin.DataManager.GetExcelSheet<EventItemHelp>()?.GetRow(payload.RawItemId);
if (help != null) {
var desc = ChunkUtil.ToChunks(help.Description.ToDalamudString(), null);
this.Log.DrawChunks(desc.ToList());
}
}
private void LeftClickPayload(Chunk chunk, Payload? payload) {
switch (payload) {
case MapLinkPayload map: {