Fix workshops not in Lavender Beds
This commit is contained in:
parent
2dbbf8a16c
commit
e41e01d64b
@ -94,8 +94,7 @@ internal sealed class MainWindow : Window
|
||||
$"Hold CTRL to remove this as craft. You have to manually use the fabrication station to cancel or finish this craft before you can continue using the queue.");
|
||||
ImGui.EndDisabled();
|
||||
|
||||
if (!IsDiscipleOfHand)
|
||||
ImGui.TextColored(ImGuiColors.DalamudRed, "You need to be a Disciple of the Hand to start crafting.");
|
||||
ShowErrorConditions();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -119,8 +118,7 @@ internal sealed class MainWindow : Window
|
||||
State = ButtonState.Start;
|
||||
ImGui.EndDisabled();
|
||||
|
||||
if (!IsDiscipleOfHand)
|
||||
ImGui.TextColored(ImGuiColors.DalamudRed, "You need to be a Disciple of the Hand to start crafting.");
|
||||
ShowErrorConditions();
|
||||
}
|
||||
|
||||
if (ImGui.BeginPopup(nameof(CheckMaterial)))
|
||||
@ -262,6 +260,18 @@ internal sealed class MainWindow : Window
|
||||
completedForCurrentCraft[itemId] = quantity;
|
||||
}
|
||||
|
||||
private void ShowErrorConditions()
|
||||
{
|
||||
|
||||
if (!_plugin.WorkshopTerritories.Contains(_clientState.TerritoryType))
|
||||
ImGui.TextColored(ImGuiColors.DalamudRed, "You are not in the Company Workshop.");
|
||||
else if (!NearFabricationStation)
|
||||
ImGui.TextColored(ImGuiColors.DalamudRed, "You are not near a Farbrication Station.");
|
||||
|
||||
if (!IsDiscipleOfHand)
|
||||
ImGui.TextColored(ImGuiColors.DalamudRed, "You need to be a Disciple of the Hand to start crafting.");
|
||||
}
|
||||
|
||||
public enum ButtonState
|
||||
{
|
||||
None,
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Runtime.InteropServices;
|
||||
using Dalamud.Game.ClientState.Objects.Enums;
|
||||
using Dalamud.Game.ClientState.Objects.Types;
|
||||
using Dalamud.Memory;
|
||||
@ -30,13 +29,13 @@ partial class WorkshopPlugin
|
||||
(FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject*)obj.Address, false);
|
||||
}
|
||||
|
||||
private float GetDistanceToEventObject(int npcId, out GameObject? o)
|
||||
private float GetDistanceToEventObject(IReadOnlyList<uint> npcIds, out GameObject? o)
|
||||
{
|
||||
foreach (var obj in _objectTable)
|
||||
{
|
||||
if (obj.ObjectKind == ObjectKind.EventObj)
|
||||
{
|
||||
if (GetNpcId(obj) == npcId)
|
||||
if (npcIds.Contains(GetNpcId(obj)))
|
||||
{
|
||||
o = obj;
|
||||
return Vector3.Distance(_clientState.LocalPlayer!.Position, obj.Position);
|
||||
@ -48,9 +47,9 @@ partial class WorkshopPlugin
|
||||
return float.MaxValue;
|
||||
}
|
||||
|
||||
private int GetNpcId(GameObject obj)
|
||||
private unsafe uint GetNpcId(GameObject obj)
|
||||
{
|
||||
return Marshal.ReadInt32(obj.Address + 128);
|
||||
return ((FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject*)obj.Address)->GetNpcID();
|
||||
}
|
||||
|
||||
private unsafe bool TryGetAddonByName<T>(string addonName, out T* addonPtr)
|
||||
|
@ -16,8 +16,8 @@ namespace Workshoppa;
|
||||
[SuppressMessage("ReSharper", "UnusedType.Global")]
|
||||
public sealed partial class WorkshopPlugin : IDalamudPlugin
|
||||
{
|
||||
private const int FabricationStationId = 0x1E98F4;
|
||||
private readonly IReadOnlyList<ushort> _workshopTerritories = new ushort[] { 423, 424, 425, 653, 984 }.AsReadOnly();
|
||||
private readonly IReadOnlyList<uint> FabricationStationIds = new uint[] { 2005236, 2005238, 2005240, 2007821, 2011588 }.AsReadOnly();
|
||||
internal readonly IReadOnlyList<ushort> WorkshopTerritories = new ushort[] { 423, 424, 425, 653, 984 }.AsReadOnly();
|
||||
private readonly WindowSystem _windowSystem = new WindowSystem(nameof(WorkshopPlugin));
|
||||
|
||||
private readonly DalamudPluginInterface _pluginInterface;
|
||||
@ -84,9 +84,9 @@ public sealed partial class WorkshopPlugin : IDalamudPlugin
|
||||
private void FrameworkUpdate(IFramework framework)
|
||||
{
|
||||
if (!_clientState.IsLoggedIn ||
|
||||
!_workshopTerritories.Contains(_clientState.TerritoryType) ||
|
||||
!WorkshopTerritories.Contains(_clientState.TerritoryType) ||
|
||||
_condition[ConditionFlag.BoundByDuty] ||
|
||||
GetDistanceToEventObject(FabricationStationId, out var fabricationStation) >= 5f)
|
||||
GetDistanceToEventObject(FabricationStationIds, out var fabricationStation) >= 5f)
|
||||
{
|
||||
_mainWindow.NearFabricationStation = false;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0-windows</TargetFramework>
|
||||
<Version>2.0</Version>
|
||||
<Version>2.1</Version>
|
||||
<LangVersion>11.0</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
|
Loading…
Reference in New Issue
Block a user