Skip to content

Commit

Permalink
1.7.0.12
Browse files Browse the repository at this point in the history
  • Loading branch information
Critical-Impact committed Jul 14, 2024
1 parent 66cd4b2 commit e5c7084
Show file tree
Hide file tree
Showing 38 changed files with 1,346 additions and 983 deletions.
2 changes: 1 addition & 1 deletion CriticalCommonLib
30 changes: 30 additions & 0 deletions InventoryTools/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added

### Changed

### Removed

## [1.7.0.12] - 2024-07-14

### Added

- The output items of craft lists can now be ordered based on the "Output Ordering" setting by class or name
- Added a "Is custom delivery hand in?" column/filter
- Added a new menu in craft lists that allows you to clear all items and import/export the contents of the list(to your clipboard)
- Added a new hotkey for opening the lists window
- The item window has a new "Owned" section showing all the locations of items within your characters that the plugin knows about
### Fixed

- Certain columns were not showing as available to add within craft lists
- The active search scopes were not fully working
- All slash commands that open AT windows will now toggle instead of only opening
- The configuration wizard's labels should no longer clip
10 changes: 5 additions & 5 deletions InventoryTools/Commands/PluginCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,27 @@ public PluginCommands(MediatorService mediatorService, IChatUtilities chatUtilit
[HelpMessage("Shows the allagan tools items list window.")]
public void ShowHideInventoryToolsCommand(string command, string args)
{
_mediatorService.Publish(new OpenGenericWindowMessage(typeof(FiltersWindow)));
_mediatorService.Publish(new ToggleGenericWindowMessage(typeof(FiltersWindow)));
}
[Command("/duties")]
[Aliases("/atduties")]
[HelpMessage("Shows the allagan tools duties window.")]
public void ShowHideDutiesWindow(string command, string args)
{
_mediatorService.Publish(new OpenGenericWindowMessage(typeof(DutiesWindow)));
_mediatorService.Publish(new ToggleGenericWindowMessage(typeof(DutiesWindow)));
}
[Command("/mobs")]
[Aliases("/atmobs")]
[HelpMessage("Shows the allagan tools mobs window.")]
public void ShowHideMobsWindow(string command, string args)
{
_mediatorService.Publish(new OpenGenericWindowMessage(typeof(BNpcsWindow)));
_mediatorService.Publish(new ToggleGenericWindowMessage(typeof(BNpcsWindow)));
}
[Command("/atnpcs")]
[HelpMessage("Shows the allagan tools npcs window.")]
public void ShowHideNpcsWindow(string command, string args)
{
_mediatorService.Publish(new OpenGenericWindowMessage(typeof(ENpcsWindow)));
_mediatorService.Publish(new ToggleGenericWindowMessage(typeof(ENpcsWindow)));
}


Expand Down Expand Up @@ -102,7 +102,7 @@ public void OpenFilterCommand(string command, string args)
[HelpMessage("Opens the allagan tools crafts window")]
public void OpenCraftsWindow(string command, string args)
{
_mediatorService.Publish(new OpenGenericWindowMessage(typeof(CraftsWindow)));
_mediatorService.Publish(new ToggleGenericWindowMessage(typeof(CraftsWindow)));
}

[Command("/airships")]
Expand Down
93 changes: 0 additions & 93 deletions InventoryTools/Host/PluginLoader.cs

This file was deleted.

22 changes: 22 additions & 0 deletions InventoryTools/Hotkeys/ListsWindowHotkey.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using CriticalCommonLib.Services.Mediator;
using InventoryTools.Logic.Settings;
using InventoryTools.Mediator;
using InventoryTools.Ui;
using Microsoft.Extensions.Logging;
using OtterGui.Classes;

namespace InventoryTools.Hotkeys;

public class ListsWindowHotkey : Hotkey
{
public ListsWindowHotkey(ILogger<ListsWindowHotkey> logger, MediatorService mediatorService, InventoryToolsConfiguration configuration) : base(logger, mediatorService, configuration)
{
}
public override ModifiableHotkey? ModifiableHotkey =>
Configuration.GetHotkey(HotKeyListsWindowSetting.AsKey);
public override bool OnHotKey()
{
MediatorService.Publish(new ToggleGenericWindowMessage(typeof(FiltersWindow)));
return true;
}
}
2 changes: 1 addition & 1 deletion InventoryTools/InventoryTools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -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.8" />
<PackageReference Include="DalaMock.Host" Version="2.0.14" />
<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
2 changes: 1 addition & 1 deletion InventoryTools/InventoryToolsPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class InventoryToolsPlugin : HostedPlugin
{
private readonly IPluginLog _pluginLog;
private Service? _service;
private IDalamudPluginInterface? PluginInterface { get; set; }
private IDalamudPluginInterface PluginInterface { get; set; }

public InventoryToolsPlugin(IDalamudPluginInterface pluginInterface, IPluginLog pluginLog,
IAddonLifecycle addonLifecycle, IChatGui chatGui, IClientState clientState, ICommandManager commandManager,
Expand Down
73 changes: 72 additions & 1 deletion InventoryTools/Lists/ListImportExportService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,24 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CriticalCommonLib.Crafting;
using CriticalCommonLib.Models;
using CriticalCommonLib.Services;
using InventoryTools.Extensions;
using InventoryTools.Logic;
using InventoryTools.Services;
using Newtonsoft.Json;
using InventoryItem = FFXIVClientStructs.FFXIV.Client.Game.InventoryItem;

namespace InventoryTools.Lists;

public class ListImportExportService
{
public ListImportExportService(VersionInfo info)
private readonly ExcelCache _excelCache;

public ListImportExportService(VersionInfo info ,ExcelCache excelCache)
{
_excelCache = excelCache;
CurrentVersion = (byte)info.ImportExportVersion;
}

Expand Down Expand Up @@ -60,4 +66,69 @@ public bool FromBase64(string data, out FilterConfiguration filterConfiguration)
return false;
}
}

/// <summary>
/// Parses a teamcraft/AT list of items and returns the item ID and quantity of the item as a list of tuples. HQ items have 500000 added to them.
/// </summary>
/// <param name="teamCraftList"></param>
/// <returns></returns>
public List<(uint, uint)>? FromTCString(string teamCraftList)
{
if (string.IsNullOrEmpty(teamCraftList)) return null;
List<(uint, uint)> output = new List<(uint, uint)>();
using (System.IO.StringReader reader = new System.IO.StringReader(teamCraftList))
{
string line;
while ((line = reader.ReadLine()!) != null)
{
var parts = line.Split(" ", StringSplitOptions.RemoveEmptyEntries);
if (parts.Length < 2)
continue;

if (parts[0][^1] == 'x')
{
int numberOfItem = int.Parse(parts[0].Substring(0, parts[0].Length - 1));
var builder = new StringBuilder();
for (int i = 1; i < parts.Length; i++)
{
builder.Append(parts[i]);
builder.Append(" ");
}

var isHq = false;
var item = builder.ToString().Trim();

if (item.Contains("(HQ)"))
{
item = item.Replace("(HQ)", string.Empty);
isHq = true;
}

var itemEx = _excelCache.GetItemExSheet().FirstOrDefault(c => c!.NameString == item, null);

if (itemEx != null && _excelCache.CanCraftItem(itemEx.RowId))
{
output.Add(((uint)(itemEx.RowId + (isHq ? 500000 : 0)), (uint)numberOfItem));
}
}

}
}

if (output.Count == 0) return null;

return output;
}

public string ToTCString(List<CraftItem> craftItems)
{
List<string> lines = new();
lines.Add("Items :");
foreach (var craftItem in craftItems)
{
lines.Add($"{craftItem.QuantityRequired}x {craftItem.Name} {(craftItem.Flags == InventoryItem.ItemFlags.HighQuality ? " (HQ)" : "")}");
}

return string.Join(Environment.NewLine, lines);
}
}
4 changes: 2 additions & 2 deletions InventoryTools/Logic/Columns/Abstract/ButtonColumn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public virtual void Dispose()
public virtual bool IsDebug { get; set; } = false;
public virtual FilterType AvailableIn { get; } = Logic.FilterType.SearchFilter | Logic.FilterType.SortingFilter |
Logic.FilterType.GameItemFilter | Logic.FilterType.HistoryFilter |
Logic.FilterType.FavouriteFilter;
Logic.FilterType.FavouriteFilter | Logic.FilterType.CraftFilter;

public bool AvailableInType(FilterType type) =>
AvailableIn.HasFlag(InventoryTools.Logic.FilterType.SearchFilter) &&
Expand All @@ -43,7 +43,7 @@ public bool AvailableInType(FilterType type) =>
(AvailableIn.HasFlag(InventoryTools.Logic.FilterType.HistoryFilter) &&
type.HasFlag(InventoryTools.Logic.FilterType.HistoryFilter));

public virtual bool? CraftOnly { get; } = false;
public virtual bool? CraftOnly { get; } = null;
public bool IsConfigurable => false;
public virtual string? RenderName { get; }
public virtual IEnumerable<InventoryItem> Filter(ColumnConfiguration columnConfiguration, IEnumerable<InventoryItem> items)
Expand Down
41 changes: 41 additions & 0 deletions InventoryTools/Logic/Columns/IsCustomDeliveryItemColumn.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using CriticalCommonLib.Models;
using CriticalCommonLib.Services;
using CriticalCommonLib.Sheets;
using InventoryTools.Logic.Columns.Abstract;
using InventoryTools.Services;
using Microsoft.Extensions.Logging;

namespace InventoryTools.Logic.Columns;

public class IsCustomDeliveryItemColumn : CheckboxColumn
{
private readonly ExcelCache _excelCache;

public IsCustomDeliveryItemColumn(ILogger<IsCustomDeliveryItemColumn> logger, ImGuiService imGuiService, ExcelCache excelCache) : base(logger, imGuiService)
{
_excelCache = excelCache;
}

public override string Name { get; set; } = "Is custom delivery item?";
public override string? RenderName { get; } = "Custom delivery item?";
public override float Width { get; set; } = 80;
public override string HelpText { get; set; } = "Is this item used for custom deliveries?";
public override ColumnCategory ColumnCategory { get; } = ColumnCategory.Basic;
public override bool HasFilter { get; set; } = true;
public override ColumnFilterType FilterType { get; set; } = ColumnFilterType.Boolean;

public override bool? CurrentValue(ColumnConfiguration columnConfiguration, InventoryItem item)
{
return CurrentValue(columnConfiguration, item.Item);
}

public override bool? CurrentValue(ColumnConfiguration columnConfiguration, ItemEx item)
{
return item.HandInGrandCompanySupply;
}

public override bool? CurrentValue(ColumnConfiguration columnConfiguration, SortingResult item)
{
return CurrentValue(columnConfiguration, item.Item);
}
}
Loading

0 comments on commit e5c7084

Please sign in to comment.