-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Items that can be crossbred will now show as a source/use
- Added basic shop highlighting(only gil shops so far) - The required column now has a icon that when hovered will give you a breakdown of that particular item in relation to the craft(required, missing, etc) - Add to curated list context menu feature - New installs now come with a housing list - The inventory data now saves on it's own thread to stop hitching when a user has a lot of items - Exterior house storage should now be scanned properly - Items that are considered currency will no longer be grouped as currency if they are to be purchased - Fixed some bugs related to how craft numbers are calculated - Fixed a few imgui asserts - The can be equipped filter and favourites should work again - The monster drop tooltip was showing a monster instead the map - NPCs with no shop locations will now longer show up in the action menu in the craft overlay - Window positions should save properly(they weren't saving if the window was open) - Grand company shops had the wrong seal counts - Spectacles will now be considered acquirable and will show in the acquired tooltip - Added missing gathering points - When crafting an item that relied on inspection, the subcrafts were not being generated properly
- Loading branch information
1 parent
6ba0539
commit afc7ec9
Showing
39 changed files
with
1,418 additions
and
297 deletions.
There are no files selected for viewing
Submodule CriticalCommonLib
updated
12 files
+1 −1 | Addons/AddonHousingGoods.cs | |
+13 −0 | Crafting/CraftItem.cs | |
+46 −26 | Crafting/CraftList.cs | |
+16 −0 | Crafting/CraftListConfiguration.cs | |
+1 −1 | CriticalCommonLib.csproj | |
+1 −0 | Models/Icons.cs | |
+96 −4 | Services/CharacterMonitor.cs | |
+2 −0 | Services/ICharacterMonitor.cs | |
+1 −1 | Services/InventoryMonitor.cs | |
+7 −3 | Services/InventoryScanner.cs | |
+10 −0 | Services/Ui/AtkShop.cs | |
+6 −6 | packages.lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace InventoryTools.Enums; | ||
|
||
public enum ShopType | ||
{ | ||
Gil, | ||
SpecialShop, | ||
Collectable, | ||
InclusionShop, | ||
FreeCompanyShop, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,189 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Dalamud.Game.Addon.Lifecycle; | ||
using Dalamud.Game.Addon.Lifecycle.AddonArgTypes; | ||
using Dalamud.Plugin.Services; | ||
using FFXIVClientStructs.FFXIV.Component.GUI; | ||
using ImGuiNET; | ||
using ValueType = FFXIVClientStructs.FFXIV.Component.GUI.ValueType; | ||
|
||
namespace InventoryTools.Highlighting; | ||
|
||
public class ShopHighlighting : IDisposable | ||
{ | ||
private readonly IGameGui gameGui; | ||
private readonly IAddonLifecycle addonLifecycle; | ||
private readonly IPluginLog pluginLog; | ||
private uint shopItemsAtkIndex = 441; | ||
private uint shopCountAtkIndex = 2; | ||
private HashSet<uint> highlightedItems = new HashSet<uint>(); | ||
private Dictionary<int, uint>? itemIndexMap = null; | ||
|
||
public ShopHighlighting(IGameGui gameGui, IAddonLifecycle addonLifecycle, IPluginLog pluginLog) | ||
{ | ||
this.gameGui = gameGui; | ||
this.addonLifecycle = addonLifecycle; | ||
this.pluginLog = pluginLog; | ||
addonLifecycle.RegisterListener(AddonEvent.PostSetup, "Shop", AddonSetup); | ||
addonLifecycle.RegisterListener(AddonEvent.PostDraw, "Shop", AddonPostDraw); | ||
} | ||
|
||
public void AddItem(uint itemId) | ||
{ | ||
highlightedItems.Add(itemId); | ||
} | ||
|
||
public void RemoveItem(uint itemId) | ||
{ | ||
highlightedItems.Remove(itemId); | ||
} | ||
|
||
public void SetItems(List<uint> items) | ||
{ | ||
highlightedItems = [..items]; | ||
} | ||
|
||
public void SetItems(HashSet<uint> items) | ||
{ | ||
highlightedItems = items; | ||
} | ||
|
||
public void ClearItems() | ||
{ | ||
highlightedItems.Clear(); | ||
} | ||
|
||
private string itemIdString = ""; | ||
private uint itemId; | ||
|
||
public unsafe void DrawDebug() | ||
{ | ||
var addon = gameGui.GetAddonByName("Shop"); | ||
if (addon != IntPtr.Zero) | ||
{ | ||
var atkUnitBase = (AtkUnitBase*)addon; | ||
var atkComponentBase = atkUnitBase->GetComponentByNodeId(16); | ||
if (atkComponentBase != null) | ||
{ | ||
var listNode = (AtkComponentList*)atkComponentBase; | ||
var listItemIndex = listNode->ItemRendererList->AtkComponentListItemRenderer->ListItemIndex; | ||
ImGui.TextUnformatted($"List Item Index: {listItemIndex}"); | ||
if (itemIndexMap != null) | ||
{ | ||
foreach (var item in itemIndexMap) | ||
{ | ||
ImGui.TextUnformatted(item.Key + ": " + item.Value); | ||
} | ||
} | ||
|
||
if (ImGui.InputText("Item", ref itemIdString, 128)) | ||
{ | ||
if (uint.TryParse(itemIdString, out itemId)) | ||
{ | ||
itemId = itemId; | ||
} | ||
itemIdString = itemId.ToString(); | ||
} | ||
if (ImGui.Button("Add Item")) | ||
{ | ||
if (uint.TryParse(itemIdString, out itemId)) | ||
{ | ||
highlightedItems.Add(itemId); | ||
} | ||
} | ||
if (ImGui.Button("Remove Item")) | ||
{ | ||
if (uint.TryParse(itemIdString, out itemId)) | ||
{ | ||
highlightedItems.Remove(itemId); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
||
private unsafe void AddonPostDraw(AddonEvent type, AddonArgs args) | ||
{ | ||
if (args.Addon != IntPtr.Zero) | ||
{ | ||
var atkUnitBase = (AtkUnitBase*)args.Addon; | ||
var atkComponentBase = atkUnitBase->GetComponentByNodeId(16); | ||
if (atkComponentBase != null) | ||
{ | ||
var listNode = (AtkComponentList*)atkComponentBase; | ||
if (this.itemIndexMap == null) | ||
{ | ||
CalculateItemIndexMap(atkUnitBase); | ||
} | ||
|
||
for (int i = 0; i < listNode->ListLength; i++) | ||
{ | ||
if (!highlightedItems.Any()) | ||
{ | ||
listNode->SetItemDisabledState(i, false); | ||
listNode->SetItemHighlightedState(i, false); | ||
} | ||
else if (itemIndexMap!.ContainsKey(i)) | ||
{ | ||
if (highlightedItems.Contains(itemIndexMap[i])) | ||
{ | ||
if (!listNode->GetItemHighlightedState(i)) | ||
{ | ||
listNode->SetItemHighlightedState(i, true); | ||
} | ||
if (listNode->GetItemDisabledState(i)) | ||
{ | ||
listNode->SetItemDisabledState(i, false); | ||
} | ||
} | ||
else | ||
{ | ||
if (!listNode->GetItemDisabledState(i)) | ||
{ | ||
listNode->SetItemDisabledState(i, true); | ||
} | ||
if (listNode->GetItemHighlightedState(i)) | ||
{ | ||
listNode->SetItemHighlightedState(i, false); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
private unsafe void CalculateItemIndexMap(AtkUnitBase* atkUnitBase) | ||
{ | ||
var itemIndexMap = new Dictionary<int, uint>(); | ||
var shopLength = atkUnitBase->AtkValues[shopCountAtkIndex].UInt; | ||
for (var i = shopItemsAtkIndex; i < shopItemsAtkIndex + shopLength; i++) | ||
{ | ||
var atkValue = atkUnitBase->AtkValues[i]; | ||
if (atkValue.Type != ValueType.UInt) | ||
{ | ||
break; | ||
} | ||
|
||
itemIndexMap[(int)(i - shopItemsAtkIndex)] = atkValue.UInt; | ||
} | ||
this.itemIndexMap = itemIndexMap; | ||
} | ||
|
||
private unsafe void AddonSetup(AddonEvent type, AddonArgs args) | ||
{ | ||
if (args.Addon != IntPtr.Zero) | ||
{ | ||
var atkUnitBase = (AtkUnitBase*)args.Addon; | ||
CalculateItemIndexMap(atkUnitBase); | ||
} | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
addonLifecycle.UnregisterListener(AddonEvent.PostSetup, "Shop", AddonSetup); | ||
addonLifecycle.UnregisterListener(AddonEvent.PostDraw, "Shop", AddonPostDraw); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.