Compare commits

..

No commits in common. "master" and "v5.7" have entirely different histories.
master ... v5.7

7 changed files with 5 additions and 112 deletions

View File

@ -1,6 +1,6 @@
<Project Sdk="Dalamud.NET.Sdk/9.0.2">
<PropertyGroup>
<Version>5.8</Version>
<Version>5.7</Version>
<OutputPath>dist</OutputPath>
</PropertyGroup>

View File

@ -44,16 +44,6 @@ partial class AutoRetainerControlPlugin
save = true;
}
if (_clientState.LocalContentId == registeredCharacterId)
{
var unlockedFolkloreBooks = _gameCache.FolkloreBooks.Values.Where(x => x.IsUnlocked()).Select(x => x.ItemId).ToHashSet();
if (character.UnlockedFolkloreBooks != unlockedFolkloreBooks)
{
character.UnlockedFolkloreBooks = unlockedFolkloreBooks;
save = true;
}
}
// remove retainers without name
save |= character.Retainers.RemoveAll(x => string.IsNullOrEmpty(x.Name)) > 0;

View File

@ -81,7 +81,6 @@ internal sealed class Configuration : IPluginConfiguration
public List<RetainerConfiguration> Retainers { get; set; } = new();
public HashSet<uint> GatheredItems { get; set; } = new();
public HashSet<uint> UnlockedFolkloreBooks { get; set; } = new();
public override string ToString() => $"{CharacterName} @ {WorldName}";
}

View File

@ -1,18 +0,0 @@
using System.Collections.Generic;
using FFXIVClientStructs.FFXIV.Client.Game.UI;
namespace ARControl.GameData;
internal sealed class FolkloreBook
{
public required uint ItemId { get; init; }
public required string Name { get; init; }
public required IReadOnlyList<ushort> GatheringSubCategories { get; init; }
public List<uint> GatheringItemIds { get; } = [];
public ushort TomeId { get; set; }
public unsafe bool IsUnlocked()
{
return PlayerState.Instance()->IsFolkloreBookUnlocked(TomeId);
}
}

View File

@ -22,74 +22,9 @@ internal sealed class GameCache
.OrderBy(x => x.Name)
.ToList()
.AsReadOnly();
FolkloreBooks = dataManager.GetExcelSheet<GatheringSubCategory>()!
.Where(x => x.RowId > 0)
.Where(x => x.Item.Row != 0)
.Select(x => new
{
x.RowId,
ItemId = x.Item.Row,
ItemName = x.Item.Value!.Name.ToString()
})
.GroupBy(x => (x.ItemId, x.ItemName))
.Select(x =>
new FolkloreBook
{
ItemId = x.Key.ItemId,
Name = x.Key.ItemName,
GatheringSubCategories = x.Select(y => (ushort)y.RowId).ToList(),
})
.ToDictionary(x => x.ItemId, x => x);
var gatheringNodes = dataManager.GetExcelSheet<GatheringPointBase>()!
.Where(x => x.RowId > 0 && x.GatheringType.Row <= 3)
.Select(x =>
new
{
GatheringPointBaseId = x.RowId,
GatheringPoint =
dataManager.GetExcelSheet<GatheringPoint>()!.FirstOrDefault(y =>
y.GatheringPointBase.Row == x.RowId),
Items = x.Item.Where(y => y > 0).ToList()
})
.Where(x => x.GatheringPoint != null)
.Select(x =>
new
{
x.GatheringPointBaseId,
CategoryId = (ushort)x.GatheringPoint!.GatheringSubCategory.Row,
x.Items,
})
.ToList();
var itemsWithoutTomes = gatheringNodes
.Where(x => !FolkloreBooks.Values.Any(y => y.GatheringSubCategories.Contains(x.CategoryId)))
.SelectMany(x => x.Items)
.ToList();
var itemsWithTomes = gatheringNodes
.SelectMany(x => x.Items
.Where(y => !itemsWithoutTomes.Contains(y))
.Select(
y =>
new
{
x.CategoryId,
ItemId = (uint)y
}))
.GroupBy(x => x.CategoryId)
.ToDictionary(x => x.Key, x => x.Select(y => y.ItemId).ToList());
foreach (var book in FolkloreBooks.Values)
{
book.TomeId = dataManager.GetExcelSheet<Item>()!.GetRow(book.ItemId)!.ItemAction.Value!.Data[0];
foreach (var category in book.GatheringSubCategories)
{
if (itemsWithTomes.TryGetValue(category, out var itemsInCategory))
book.GatheringItemIds.AddRange(itemsInCategory);
}
}
}
public IReadOnlyDictionary<uint, string> Jobs { get; }
public IReadOnlyList<Venture> Ventures { get; }
public IReadOnlyList<ItemToGather> ItemsToGather { get; }
public Dictionary<uint, FolkloreBook> FolkloreBooks { get; }
}

View File

@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using ARControl.GameData;
using Dalamud.Game.Text;
using Dalamud.Interface;
using Dalamud.Interface.Colors;
using Dalamud.Interface.Components;
@ -115,16 +114,10 @@ internal sealed class LockedItemsTab : ITab
var color = ch.Items[item.ItemId];
if (color != ColorGrey)
{
string itemName = item.GatheredItem.Name;
var folkloreBook = _gameCache.FolkloreBooks.Values.FirstOrDefault(x =>
x.GatheringItemIds.Contains(item.GatheredItem.GatheredItemId));
if (folkloreBook != null && !ch.Character.UnlockedFolkloreBooks.Contains(folkloreBook.ItemId))
itemName += $" ({SeIconChar.Prohibited.ToIconString()} {folkloreBook.Name})";
ImGui.PushStyleColor(ImGuiCol.Text, color);
if (currentCharacter && color == ColorRed)
{
ImGui.Selectable(itemName);
ImGui.Selectable(item.GatheredItem.Name);
if (ImGui.IsItemClicked(ImGuiMouseButton.Left))
{
uint classJob = _clientState.LocalPlayer!.ClassJob.Id;
@ -140,7 +133,7 @@ internal sealed class LockedItemsTab : ITab
}
else
{
ImGui.Text(itemName);
ImGui.Text(item.GatheredItem.Name);
}
ImGui.PopStyleColor();
@ -156,8 +149,6 @@ internal sealed class LockedItemsTab : ITab
foreach (var item in itemsToCheck.Where(x =>
charactersToCheck.Any(y => y.ToCheck(onlyShowMissing).ContainsKey(x.ItemId))))
{
var folkloreBook = _gameCache.FolkloreBooks.Values.FirstOrDefault(x =>
x.GatheringItemIds.Contains(item.GatheredItem.GatheredItemId));
if (ImGui.CollapsingHeader($"{item.GatheredItem.Name}##Gathered{item.GatheredItem.ItemId}"))
{
ImGui.Indent(_configWindow.MainIndentSize + ImGui.GetStyle().FramePadding.X);
@ -180,12 +171,8 @@ internal sealed class LockedItemsTab : ITab
ImGui.PopFont();
}
string characterName = ch.Character.ToString();
if (folkloreBook != null && !ch.Character.UnlockedFolkloreBooks.Contains(folkloreBook.ItemId))
characterName += $" ({SeIconChar.Prohibited.ToIconString()} {folkloreBook.Name})";
ImGui.PushStyleColor(ImGuiCol.Text, color);
ImGui.TextUnformatted(characterName);
ImGui.TextUnformatted(ch.Character.ToString());
ImGui.PopStyleColor();
}
}

View File

@ -294,7 +294,7 @@ internal sealed class VentureListTab : ITab
ImGui.GetWindowDrawList().AddRect(topLeft, bottomRight, ImGui.GetColorU32(ImGuiColors.DalamudGrey), 3f,
ImDrawFlags.RoundCornersAll);
int newIndex = itemPositions.FindIndex(x => ImGui.IsMouseHoveringRect(x.TopLeft, x.BottomRight, true));
int newIndex = itemPositions.IndexOf(x => ImGui.IsMouseHoveringRect(x.TopLeft, x.BottomRight, true));
if (newIndex >= 0 && oldIndex != newIndex)
{
itemToAdd = list.Items.Single(x => x.InternalId == _draggedItem.Value.Item2);