master #3

Open
cacahuetes wants to merge 653 commits from liza/Questionable:master into cacahuetes-ShB-Healer
3 changed files with 14 additions and 19 deletions
Showing only changes of commit 03f4c39ba8 - Show all commits

View File

@ -3,16 +3,12 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Numerics; using System.Numerics;
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization.Metadata;
using Dalamud.Game.ClientState.Objects; using Dalamud.Game.ClientState.Objects;
using Dalamud.Game.ClientState.Objects.Enums; using Dalamud.Game.ClientState.Objects.Enums;
using Dalamud.Game.ClientState.Objects.Types; using Dalamud.Game.ClientState.Objects.Types;
using Dalamud.Game.Command; using Dalamud.Game.Command;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using Lumina.Excel.GeneratedSheets; using Lumina.Excel.Sheets;
using Questionable.Model; using Questionable.Model;
using Questionable.Model.Gathering; using Questionable.Model.Gathering;
using Questionable.Model.Questing; using Questionable.Model.Questing;
@ -70,14 +66,14 @@ internal sealed class EditorCommands : IDisposable
if (target == null || target.ObjectKind != ObjectKind.GatheringPoint) if (target == null || target.ObjectKind != ObjectKind.GatheringPoint)
throw new Exception("No valid target"); throw new Exception("No valid target");
var gatheringPoint = _dataManager.GetExcelSheet<GatheringPoint>()!.GetRow(target.DataId); var gatheringPoint = _dataManager.GetExcelSheet<GatheringPoint>().GetRowOrDefault(target.DataId);
if (gatheringPoint == null) if (gatheringPoint == null)
throw new Exception("Invalid gathering point"); throw new Exception("Invalid gathering point");
FileInfo targetFile; FileInfo targetFile;
GatheringRoot root; GatheringRoot root;
var locationsInTerritory = _plugin.GetLocationsInTerritory(_clientState.TerritoryType).ToList(); var locationsInTerritory = _plugin.GetLocationsInTerritory(_clientState.TerritoryType).ToList();
var location = locationsInTerritory.SingleOrDefault(x => x.Id == gatheringPoint.GatheringPointBase.Row); var location = locationsInTerritory.SingleOrDefault(x => x.Id == gatheringPoint.Value.GatheringPointBase.RowId);
if (location != null) if (location != null)
{ {
targetFile = location.File; targetFile = location.File;
@ -96,7 +92,7 @@ internal sealed class EditorCommands : IDisposable
} }
else else
{ {
(targetFile, root) = CreateNewFile(gatheringPoint, target); (targetFile, root) = CreateNewFile(gatheringPoint.Value, target);
_chatGui.Print($"Creating new file under {targetFile.FullName}", "qG"); _chatGui.Print($"Creating new file under {targetFile.FullName}", "qG");
} }
@ -174,16 +170,16 @@ internal sealed class EditorCommands : IDisposable
?.File.Directory; ?.File.Directory;
if (targetFolder == null) if (targetFolder == null)
{ {
var territoryInfo = _dataManager.GetExcelSheet<TerritoryType>()!.GetRow(_clientState.TerritoryType)!; var territoryInfo = _dataManager.GetExcelSheet<TerritoryType>().GetRow(_clientState.TerritoryType);
targetFolder = _plugin.PathsDirectory targetFolder = _plugin.PathsDirectory
.CreateSubdirectory(ExpansionData.ExpansionFolders[(EExpansionVersion)territoryInfo.ExVersion.Row]) .CreateSubdirectory(ExpansionData.ExpansionFolders[(EExpansionVersion)territoryInfo.ExVersion.RowId])
.CreateSubdirectory(territoryInfo.PlaceName.Value!.Name.ToString()); .CreateSubdirectory(territoryInfo.PlaceName.Value.Name.ToString());
} }
FileInfo targetFile = FileInfo targetFile =
new FileInfo( new FileInfo(
Path.Combine(targetFolder.FullName, Path.Combine(targetFolder.FullName,
$"{gatheringPoint.GatheringPointBase.Row}_{gatheringPoint.PlaceName.Value!.Name}_{(_clientState.LocalPlayer!.ClassJob.Id == 16 ? "MIN" : "BTN")}.json")); $"{gatheringPoint.GatheringPointBase.RowId}_{gatheringPoint.PlaceName.Value.Name}_{(_clientState.LocalPlayer!.ClassJob.RowId == 16 ? "MIN" : "BTN")}.json"));
var root = new GatheringRoot var root = new GatheringRoot
{ {
Author = [_configuration.AuthorName], Author = [_configuration.AuthorName],

View File

@ -59,7 +59,7 @@ public sealed class RendererPlugin : IDalamudPlugin
_editorWindow = new EditorWindow(this, _editorCommands, dataManager, targetManager, clientState, objectTable) _editorWindow = new EditorWindow(this, _editorCommands, dataManager, targetManager, clientState, objectTable)
{ IsOpen = true }; { IsOpen = true };
_windowSystem.AddWindow(_editorWindow); _windowSystem.AddWindow(_editorWindow);
_currentClassJob = (EClassJob?)_clientState.LocalPlayer?.ClassJob.Id ?? EClassJob.Adventurer; _currentClassJob = (EClassJob?)_clientState.LocalPlayer?.ClassJob.RowId ?? EClassJob.Adventurer;
_pluginInterface.GetIpcSubscriber<object>("Questionable.ReloadData") _pluginInterface.GetIpcSubscriber<object>("Questionable.ReloadData")
.Subscribe(Reload); .Subscribe(Reload);

View File

@ -1,7 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.IO;
using System.Linq; using System.Linq;
using System.Numerics; using System.Numerics;
using Dalamud.Game.ClientState.Objects; using Dalamud.Game.ClientState.Objects;
@ -11,7 +10,7 @@ using Dalamud.Interface.Colors;
using Dalamud.Interface.Windowing; using Dalamud.Interface.Windowing;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
using ImGuiNET; using ImGuiNET;
using Lumina.Excel.GeneratedSheets; using Lumina.Excel.Sheets;
using Questionable.Model.Gathering; using Questionable.Model.Gathering;
namespace GatheringPathRenderer.Windows; namespace GatheringPathRenderer.Windows;
@ -205,12 +204,12 @@ internal sealed class EditorWindow : Window
} }
else if (_target != null) else if (_target != null)
{ {
var gatheringPoint = _dataManager.GetExcelSheet<GatheringPoint>()!.GetRow(_target.DataId); var gatheringPoint = _dataManager.GetExcelSheet<GatheringPoint>().GetRowOrDefault(_target.DataId);
if (gatheringPoint == null) if (gatheringPoint == null)
return; return;
var locationsInTerritory = _plugin.GetLocationsInTerritory(_clientState.TerritoryType).ToList(); var locationsInTerritory = _plugin.GetLocationsInTerritory(_clientState.TerritoryType).ToList();
var location = locationsInTerritory.SingleOrDefault(x => x.Id == gatheringPoint.GatheringPointBase.Row); var location = locationsInTerritory.SingleOrDefault(x => x.Id == gatheringPoint.Value.GatheringPointBase.RowId);
if (location != null) if (location != null)
{ {
var targetFile = location.File; var targetFile = location.File;
@ -234,9 +233,9 @@ internal sealed class EditorWindow : Window
} }
else else
{ {
if (ImGui.Button($"Create location ({gatheringPoint.GatheringPointBase.Row})")) if (ImGui.Button($"Create location ({gatheringPoint.Value.GatheringPointBase.RowId})"))
{ {
var (targetFile, root) = _editorCommands.CreateNewFile(gatheringPoint, _target); var (targetFile, root) = _editorCommands.CreateNewFile(gatheringPoint.Value, _target);
_plugin.Save(targetFile, root); _plugin.Save(targetFile, root);
} }
} }