Skip to content

Commit

Permalink
1.7.0.13
Browse files Browse the repository at this point in the history
  • Loading branch information
Critical-Impact committed Jul 18, 2024
1 parent b91c826 commit fad7e60
Show file tree
Hide file tree
Showing 19 changed files with 343 additions and 29 deletions.
14 changes: 14 additions & 0 deletions InventoryTools/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Removed

## [1.7.0.13] - 2024-07-18

### Added

- Added a new "Seach" context menu, provides similar functionality to the game's search but will search across whatever scope you define
- Bicolour Gem Vendors will now show NPCs and their respective locations
- Added new mob spawn data (thanks to Emma <3)

### Fixed

- The context menu shortcuts will now work correctly in the market board
- When using "Active Character" in any of the inventory scopes, this will now consider any "characters" owned by your logged in character as also active
- Removed some old incorrect mob spawn data

## [1.7.0.12] - 2024-07-14

### Added
Expand Down
4 changes: 2 additions & 2 deletions InventoryTools/InventoryTools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Import Project="Dalamud.Plugin.Bootstrap.targets"/>

<PropertyGroup>
<LangVersion>10</LangVersion>
<LangVersion>12</LangVersion>
<Version>1.2.0.11</Version>
<AssemblyName>InventoryTools</AssemblyName>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
Expand All @@ -29,7 +29,7 @@
<ItemGroup>
<PackageReference Include="Autofac" Version="8.0.0" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="9.0.0" />
<PackageReference Include="DalaMock.Host" Version="2.0.14" />
<PackageReference Include="DalaMock.Host" Version="2.0.16" />
<PackageReference Include="Humanizer.Core" Version="2.14.1" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="7.0.11" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" Version="7.0.11" />
Expand Down
22 changes: 22 additions & 0 deletions InventoryTools/InventoryToolsConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public class InventoryToolsConfiguration : IPluginConfiguration
private bool _addMoreInformationContextMenu = false;
private bool _addToCraftListContextMenu = false;
private bool _addToActiveCraftListContextMenu = false;
private bool _itemSearchContextMenu = false;

private bool _isVisible;
private int _marketRefreshTimeHours = 24;
Expand All @@ -70,6 +71,7 @@ public class InventoryToolsConfiguration : IPluginConfiguration
private List<uint>? _tooltipWhitelistCategories = new();
private bool _tooltipWhitelistBlacklist = false;
private List<InventorySearchScope>? _tooltipSearchScope = null;
private List<InventorySearchScope>? _itemSearchScope = null;
private HashSet<string>? _windowsIgnoreEscape = new HashSet<string>();
private HashSet<uint>? _favouriteItemsList = new HashSet<uint>();

Expand Down Expand Up @@ -228,6 +230,26 @@ public bool AddToActiveCraftListContextMenu
IsDirty = true;
}
}
[DefaultValue(false)]
public bool ItemSearchContextMenu
{
get => _itemSearchContextMenu;
set
{
_itemSearchContextMenu = value;
IsDirty = true;
}
}

public List<InventorySearchScope>? ItemSearchScope
{
get => _itemSearchScope;
set
{
_itemSearchScope = value;
IsDirty = true;
}
}

public void AddWindowToIgnoreEscape(Type windowType)
{
Expand Down
2 changes: 2 additions & 0 deletions InventoryTools/InventoryToolsPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ public override void PreBuild(IHostBuilder hostBuilder)
builder.RegisterType<TeleporterService>().SingleInstance().ExternallyOwned();
builder.RegisterType<LaunchButtonService>().SingleInstance().ExternallyOwned();
builder.RegisterType<HostedInventoryHistory>().SingleInstance().ExternallyOwned();
builder.RegisterType<ItemSearchService>().SingleInstance().ExternallyOwned();
});

hostBuilder.ConfigureContainer<ContainerBuilder>(builder =>
Expand Down Expand Up @@ -449,6 +450,7 @@ public override void PreBuild(IHostBuilder hostBuilder)
collection.AddHostedService(p => p.GetRequiredService<HostedInventoryHistory>());
collection.AddHostedService(p => p.GetRequiredService<IPCService>());
collection.AddHostedService(p => p.GetRequiredService<HostedCraftMonitor>());
collection.AddHostedService(p => p.GetRequiredService<ItemSearchService>());
});
}

Expand Down
2 changes: 1 addition & 1 deletion InventoryTools/Logic/Editors/InventoryScopePicker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public bool Filter(InventorySearchScope searchScope, InventoryItem inventoryItem
}
else if (searchScope.ActiveCharacter is true)
{
if (inventoryItem.RetainerId == _characterMonitor.ActiveCharacterId)
if(_characterMonitor.BelongsToActiveCharacter(inventoryItem.RetainerId))
{
topLevelMatch = true;
}
Expand Down
4 changes: 4 additions & 0 deletions InventoryTools/Logic/Settings/Abstract/Setting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ public virtual string WizardName
public virtual bool HasValueSet(InventoryToolsConfiguration configuration)
{
var currentValue = CurrentValue(configuration);
if (currentValue == null && DefaultValue == null)
{
return false;
}
return !currentValue?.Equals(DefaultValue) ?? true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace InventoryTools.Logic.Settings
{
public class ContextMenuAddToActiveCraftListSetting : BooleanSetting
{
public ContextMenuAddToActiveCraftListSetting(ILogger<ContextMenuMoreInformationSetting> logger, ImGuiService imGuiService) : base(logger, imGuiService)
public ContextMenuAddToActiveCraftListSetting(ILogger<ContextMenuAddToActiveCraftListSetting> logger, ImGuiService imGuiService) : base(logger, imGuiService)
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace InventoryTools.Logic.Settings
{
public class ContextMenuAddToCraftListSetting : BooleanSetting
{
public ContextMenuAddToCraftListSetting(ILogger<ContextMenuMoreInformationSetting> logger, ImGuiService imGuiService) : base(logger, imGuiService)
public ContextMenuAddToCraftListSetting(ILogger<ContextMenuAddToCraftListSetting> logger, ImGuiService imGuiService) : base(logger, imGuiService)
{
}

Expand Down
79 changes: 79 additions & 0 deletions InventoryTools/Logic/Settings/ContextMenuItemSearchScopeSetting.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
using System.Collections.Generic;
using Dalamud.Interface.Colors;
using ImGuiNET;
using InventoryTools.Logic.Editors;
using InventoryTools.Logic.Settings.Abstract;
using InventoryTools.Services;
using Microsoft.Extensions.Logging;
using OtterGui;
using OtterGui.Raii;

namespace InventoryTools.Logic.Settings;



public class ContextMenuItemSearchScopeSetting : Setting<List<InventorySearchScope>?>
{
private readonly InventoryScopePicker _scopePicker;

public ContextMenuItemSearchScopeSetting(ILogger<ContextMenuItemSearchScopeSetting> logger, ImGuiService imGuiService, InventoryScopePicker scopePicker) : base(logger, imGuiService)
{
_scopePicker = scopePicker;
}
public override List<InventorySearchScope>? DefaultValue { get; set; } = null;
public override List<InventorySearchScope>? CurrentValue(InventoryToolsConfiguration configuration)
{
if (configuration.ItemSearchScope == null || configuration.ItemSearchScope.Count == 0)
{
return DefaultValue;
}
return configuration.ItemSearchScope;
}

public override void Draw(InventoryToolsConfiguration configuration)
{
var currentScopes = CurrentValue(configuration) ?? new List<InventorySearchScope>();
ImGui.SetNextItemWidth(LabelSize);
if (ColourModified && HasValueSet(configuration))
{
ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.HealerGreen);
ImGui.LabelText("##" + Key + "Label", Name);
ImGui.PopStyleColor();
}
else
{
ImGui.LabelText("##" + Key + "Label", Name);
}

ImGui.SetNextItemWidth(InputSize - 26);
if (_scopePicker.Draw("##tooltipScope", currentScopes))
{
UpdateFilterConfiguration(configuration, currentScopes);
}

ImGui.SameLine();
ImGuiService.HelpMarker(HelpText, Image, ImageSize);
if (!HideReset && HasValueSet(configuration))
{
ImGui.SameLine();
if (ImGui.Button("Reset##" + Key + "Reset"))
{
Reset(configuration);
}
}
}

public override void UpdateFilterConfiguration(InventoryToolsConfiguration configuration, List<InventorySearchScope>? newValue)
{
configuration.ItemSearchScope = newValue;
}

public override string Key { get; set; } = "ItemSearchScope";
public override string Name { get; set; } = "Context Menu - Search Scope";
public override string HelpText { get; set; } = "When searching for an item across the inventories AT knows about, which inventories should be searched?";

public override string WizardName { get; } = "Search Scope";
public override SettingCategory SettingCategory { get; set; } = SettingCategory.ContextMenu;
public override SettingSubCategory SettingSubCategory { get; } = SettingSubCategory.General;
public override string Version => "1.7.0.13";
}
36 changes: 36 additions & 0 deletions InventoryTools/Logic/Settings/ContextMenuItemSearchSetting.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using InventoryTools.Logic.Settings.Abstract;
using InventoryTools.Services;
using Microsoft.Extensions.Logging;

namespace InventoryTools.Logic.Settings
{
public class ContextMenuItemSearchSetting : BooleanSetting
{
public ContextMenuItemSearchSetting(ILogger<ContextMenuItemSearchSetting> logger, ImGuiService imGuiService) : base(logger, imGuiService)
{
}

public override bool DefaultValue { get; set; } = false;
public override bool CurrentValue(InventoryToolsConfiguration configuration)
{
return configuration.ItemSearchContextMenu;
}

public override void UpdateFilterConfiguration(InventoryToolsConfiguration configuration, bool newValue)
{
configuration.ItemSearchContextMenu = newValue;
}

public override string Key { get; set; } = "ItemSearchContextMenu";
public override string Name { get; set; } = "Context Menu - Search";

public override string WizardName { get; } = "Search";

public override string HelpText { get; set; } =
"Performs a search covering either all inventories or the scope defined below?";

public override SettingCategory SettingCategory { get; set; } = SettingCategory.ContextMenu;
public override SettingSubCategory SettingSubCategory { get; } = SettingSubCategory.General;
public override string Version => "1.7.0.13";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ public TooltipLocationScopeLimitSetting(ILogger<TooltipLocationScopeLimitSetting
public override List<InventorySearchScope>? DefaultValue { get; set; } = null;
public override List<InventorySearchScope>? CurrentValue(InventoryToolsConfiguration configuration)
{
if (configuration.TooltipSearchScope == null || configuration.TooltipSearchScope.Count == 0)
{
return DefaultValue;
}
return configuration.TooltipSearchScope;
}

Expand Down
1 change: 1 addition & 0 deletions InventoryTools/Mediator/Messages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ public record AddToNewCraftListMessage(uint ItemId, uint Quantity, InventoryItem
public record FocusListMessage(Type windowType, FilterConfiguration FilterConfiguration) : MessageBase;
public record RequestTeleportMessage(uint aetheryteId) : MessageBase;
public record OverlaysRequestRefreshMessage() : MessageBase;
public record ItemSearchRequestedMessage(uint ItemId, InventoryItem.ItemFlags Flags) : MessageBase;
25 changes: 25 additions & 0 deletions InventoryTools/Services/ContextMenuService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,15 @@ private void MenuOpened(IMenuOpenedArgs args)
args.AddMenuItem(menuItem);
}

if (_configuration.ItemSearchContextMenu)
{
var menuItem = new MenuItem();
menuItem.Name = "Search";
menuItem.PrefixChar = 'A';
menuItem.OnClicked += clickedArgs => ItemSearchClicked(clickedArgs, itemId);
args.AddMenuItem(menuItem);
}

if (_configuration.AddToActiveCraftListContextMenu)
{
var activeList = _listService.GetActiveCraftList();
Expand Down Expand Up @@ -280,6 +289,22 @@ private void MoreInformationClicked(IMenuItemClickedArgs obj, uint? itemId = nul
MediatorService.Publish(new OpenUintWindowMessage(typeof(ItemWindow), itemId.Value));
}
}

private void ItemSearchClicked(IMenuItemClickedArgs obj, uint? itemId = null)
{
if (obj.Target is MenuTargetInventory inventory)
{
if (inventory.TargetItem != null)
{
itemId ??= inventory.TargetItem.Value.ItemId;
MediatorService.Publish(new ItemSearchRequestedMessage(itemId.Value, inventory.TargetItem.Value.IsHq ? InventoryItem.ItemFlags.HighQuality : InventoryItem.ItemFlags.None));
}
}
else if(itemId != null)
{
MediatorService.Publish(new ItemSearchRequestedMessage(itemId.Value, InventoryItem.ItemFlags.None));
}
}

public Task StartAsync(CancellationToken cancellationToken)
{
Expand Down
Loading

0 comments on commit fad7e60

Please sign in to comment.