refactor: update for api 9

This commit is contained in:
Anna 2023-09-28 01:57:00 -04:00
parent 38177fa27f
commit b15d22d533
Signed by: anna
GPG Key ID: D0943384CD9F87D1
7 changed files with 23 additions and 26 deletions

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6-windows</TargetFramework> <TargetFramework>net7-windows</TargetFramework>
<Version>1.2.6</Version> <Version>1.2.6</Version>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>

View File

@ -1,4 +1,4 @@
author: ascclemens author: Anna
name: Better Party Finder name: Better Party Finder
punchline: Use advanced Party Finder filter presets. punchline: Use advanced Party Finder filter presets.
description: |- description: |-
@ -12,4 +12,4 @@ description: |-
- Remove PFs above maximum item level - Remove PFs above maximum item level
- Filter on item level range - Filter on item level range
- Filter on multiple jobs and slots (ex. MCH + GNB available) - Filter on multiple jobs and slots (ex. MCH + GNB available)
repo_url: https://git.annaclemens.io/ascclemens/BetterPartyFinder repo_url: https://git.anna.lgbt/anna/BetterPartyFinder

View File

@ -25,7 +25,7 @@ namespace BetterPartyFinder {
SeString msg = "Party description: "; SeString msg = "Party description: ";
msg.Payloads.AddRange(listing.Description.Payloads); msg.Payloads.AddRange(listing.Description.Payloads);
this.Plugin.ChatGui.PrintChat(new XivChatEntry { this.Plugin.ChatGui.Print(new XivChatEntry {
Name = "Better Party Finder", Name = "Better Party Finder",
Type = XivChatType.SystemMessage, Type = XivChatType.SystemMessage,
Message = msg, Message = msg,

View File

@ -1,37 +1,33 @@
using Dalamud.Data; using Dalamud.IoC;
using Dalamud.Game.ClientState;
using Dalamud.Game.Command;
using Dalamud.Game.Gui;
using Dalamud.Game.Gui.PartyFinder;
using Dalamud.IoC;
using Dalamud.Plugin; using Dalamud.Plugin;
using Dalamud.Plugin.Services;
using XivCommon; using XivCommon;
namespace BetterPartyFinder { namespace BetterPartyFinder {
// ReSharper disable once ClassNeverInstantiated.Global // ReSharper disable once ClassNeverInstantiated.Global
public class Plugin : IDalamudPlugin { public class Plugin : IDalamudPlugin {
public string Name => "Better Party Finder"; internal static string Name => "Better Party Finder";
[PluginService] [PluginService]
internal DalamudPluginInterface Interface { get; init; } = null!; internal DalamudPluginInterface Interface { get; init; } = null!;
[PluginService] [PluginService]
internal ChatGui ChatGui { get; init; } = null!; internal IChatGui ChatGui { get; init; } = null!;
[PluginService] [PluginService]
internal ClientState ClientState { get; init; } = null!; internal IClientState ClientState { get; init; } = null!;
[PluginService] [PluginService]
internal CommandManager CommandManager { get; init; } = null!; internal ICommandManager CommandManager { get; init; } = null!;
[PluginService] [PluginService]
internal DataManager DataManager { get; init; } = null!; internal IDataManager DataManager { get; init; } = null!;
[PluginService] [PluginService]
internal GameGui GameGui { get; init; } = null!; internal IGameGui GameGui { get; init; } = null!;
[PluginService] [PluginService]
internal PartyFinderGui PartyFinderGui { get; init; } = null!; internal IPartyFinderGui PartyFinderGui { get; init; } = null!;
internal Configuration Config { get; } internal Configuration Config { get; }
private Filter Filter { get; } private Filter Filter { get; }

View File

@ -2,10 +2,11 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Numerics; using System.Numerics;
using Dalamud.Data;
using Dalamud.Game.Gui.PartyFinder.Types; using Dalamud.Game.Gui.PartyFinder.Types;
using Dalamud.Game.Text.SeStringHandling; using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Interface; using Dalamud.Interface;
using Dalamud.Interface.Utility;
using Dalamud.Plugin.Services;
using FFXIVClientStructs.FFXIV.Component.GUI; using FFXIVClientStructs.FFXIV.Component.GUI;
using ImGuiNET; using ImGuiNET;
using Lumina.Excel.GeneratedSheets; using Lumina.Excel.GeneratedSheets;
@ -88,7 +89,7 @@ namespace BetterPartyFinder {
private void DrawSettingsWindow() { private void DrawSettingsWindow() {
ImGui.SetNextWindowSize(new Vector2(-1f, -1f), ImGuiCond.FirstUseEver); ImGui.SetNextWindowSize(new Vector2(-1f, -1f), ImGuiCond.FirstUseEver);
if (!this.SettingsVisible || !ImGui.Begin($"{this.Plugin.Name} settings", ref this._settingsVisible)) { if (!this.SettingsVisible || !ImGui.Begin($"{Plugin.Name} settings", ref this._settingsVisible)) {
return; return;
} }
@ -141,7 +142,7 @@ namespace BetterPartyFinder {
return; return;
} }
if (!ImGui.Begin(this.Plugin.Name, ref this._visible, ImGuiWindowFlags.NoDocking)) { if (!ImGui.Begin(Plugin.Name, ref this._visible, ImGuiWindowFlags.NoDocking)) {
if (ImGui.IsWindowCollapsed() && addon != null && addon->IsVisible) { if (ImGui.IsWindowCollapsed() && addon != null && addon->IsVisible) {
// wait until addon is initialised to show // wait until addon is initialised to show
var rootNode = addon->RootNode; var rootNode = addon->RootNode;
@ -678,7 +679,7 @@ namespace BetterPartyFinder {
} }
internal static class UiCategoryExt { internal static class UiCategoryExt {
internal static string? Name(this UiCategory category, DataManager data) { internal static string? Name(this UiCategory category, IDataManager data) {
var ct = data.GetExcelSheet<ContentType>()!; var ct = data.GetExcelSheet<ContentType>()!;
var addon = data.GetExcelSheet<Addon>()!; var addon = data.GetExcelSheet<Addon>()!;
@ -702,7 +703,7 @@ namespace BetterPartyFinder {
}; };
} }
internal static bool ListingMatches(this UiCategory category, DataManager data, PartyFinderListing listing) { internal static bool ListingMatches(this UiCategory category, IDataManager data, PartyFinderListing listing) {
var cr = data.GetExcelSheet<ContentRoulette>()!; var cr = data.GetExcelSheet<ContentRoulette>()!;
var isDuty = listing.Category == DutyCategory.Duty; var isDuty = listing.Category == DutyCategory.Duty;

View File

@ -1,15 +1,15 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Linq; using System.Linq;
using Dalamud.Data;
using Dalamud.Game.ClientState.Objects.SubKinds; using Dalamud.Game.ClientState.Objects.SubKinds;
using Dalamud.Plugin.Services;
using Lumina.Excel.GeneratedSheets; using Lumina.Excel.GeneratedSheets;
namespace BetterPartyFinder { namespace BetterPartyFinder {
public static class Util { public static class Util {
internal static uint MaxItemLevel { get; private set; } internal static uint MaxItemLevel { get; private set; }
internal static void CalculateMaxItemLevel(DataManager data) { internal static void CalculateMaxItemLevel(IDataManager data) {
if (MaxItemLevel > 0) { if (MaxItemLevel > 0) {
return; return;
} }
@ -28,7 +28,7 @@ namespace BetterPartyFinder {
return CultureInfo.InvariantCulture.CompareInfo.IndexOf(haystack, needle, CompareOptions.IgnoreCase) >= 0; return CultureInfo.InvariantCulture.CompareInfo.IndexOf(haystack, needle, CompareOptions.IgnoreCase) >= 0;
} }
internal static IEnumerable<World> WorldsOnDataCentre(DataManager data, PlayerCharacter character) { internal static IEnumerable<World> WorldsOnDataCentre(IDataManager data, PlayerCharacter character) {
var dcRow = character.HomeWorld.GameData.DataCenter.Row; var dcRow = character.HomeWorld.GameData.DataCenter.Row;
return data.GetExcelSheet<World>()! return data.GetExcelSheet<World>()!
.Where(world => world.IsPublic && world.DataCenter.Row == dcRow); .Where(world => world.IsPublic && world.DataCenter.Row == dcRow);

View File

@ -1,7 +1,7 @@
{ {
"version": 1, "version": 1,
"dependencies": { "dependencies": {
"net6.0-windows7.0": { "net7.0-windows7.0": {
"DalamudPackager": { "DalamudPackager": {
"type": "Direct", "type": "Direct",
"requested": "[2.1.8, )", "requested": "[2.1.8, )",