punish v6.8.18.0
This commit is contained in:
commit
cfb4dea47e
316 changed files with 554088 additions and 0 deletions
50
Questionable/Questionable.External/ArtisanIpc.cs
Normal file
50
Questionable/Questionable.External/ArtisanIpc.cs
Normal file
|
@ -0,0 +1,50 @@
|
|||
using Dalamud.Plugin;
|
||||
using Dalamud.Plugin.Ipc;
|
||||
using Dalamud.Plugin.Ipc.Exceptions;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Questionable.External;
|
||||
|
||||
internal sealed class ArtisanIpc
|
||||
{
|
||||
private readonly ILogger<ArtisanIpc> _logger;
|
||||
|
||||
private readonly ICallGateSubscriber<ushort, int, object> _craftItem;
|
||||
|
||||
private readonly ICallGateSubscriber<bool> _getEnduranceStatus;
|
||||
|
||||
public ArtisanIpc(IDalamudPluginInterface pluginInterface, ILogger<ArtisanIpc> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
_craftItem = pluginInterface.GetIpcSubscriber<ushort, int, object>("Artisan.CraftItem");
|
||||
_getEnduranceStatus = pluginInterface.GetIpcSubscriber<bool>("Artisan.GetEnduranceStatus");
|
||||
}
|
||||
|
||||
public bool CraftItem(ushort recipeId, int quantity)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger.LogInformation("Attempting to craft {Quantity} items with recipe {RecipeId} with Artisan", quantity, recipeId);
|
||||
_craftItem.InvokeAction(recipeId, quantity);
|
||||
return true;
|
||||
}
|
||||
catch (IpcError exception)
|
||||
{
|
||||
_logger.LogError(exception, "Unable to craft items");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsCrafting()
|
||||
{
|
||||
try
|
||||
{
|
||||
return _getEnduranceStatus.InvokeFunc();
|
||||
}
|
||||
catch (IpcError exception)
|
||||
{
|
||||
_logger.LogError(exception, "Unable to check for Artisan endurance status");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue