Add chat message when turn in is finished
This commit is contained in:
parent
2ad03c86ef
commit
6a76b259bb
@ -15,6 +15,7 @@ internal sealed class Configuration : IPluginConfiguration
|
|||||||
public int ReservedSealCount { get; set; }
|
public int ReservedSealCount { get; set; }
|
||||||
public bool ReserveDifferentSealCountAtMaxRank { get; set; }
|
public bool ReserveDifferentSealCountAtMaxRank { get; set; }
|
||||||
public int ReservedSealCountAtMaxRank { get; set; }
|
public int ReservedSealCountAtMaxRank { get; set; }
|
||||||
|
public XivChatType ChatType { get; set; } = XivChatType.Debug;
|
||||||
public int PauseAtRank { get; set; }
|
public int PauseAtRank { get; set; }
|
||||||
public EBehaviorOnOtherWorld BehaviorOnOtherWorld { get; set; } = EBehaviorOnOtherWorld.Warning;
|
public EBehaviorOnOtherWorld BehaviorOnOtherWorld { get; set; } = EBehaviorOnOtherWorld.Warning;
|
||||||
public bool DisableFrameLimiter { get; set; } = true;
|
public bool DisableFrameLimiter { get; set; } = true;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0-windows</TargetFramework>
|
<TargetFramework>net8.0-windows</TargetFramework>
|
||||||
<Version>4.6</Version>
|
<Version>4.7</Version>
|
||||||
<LangVersion>12</LangVersion>
|
<LangVersion>12</LangVersion>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||||
|
@ -82,7 +82,7 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin
|
|||||||
var itemCache = new ItemCache(dataManager);
|
var itemCache = new ItemCache(dataManager);
|
||||||
|
|
||||||
_exchangeHandler = new ExchangeHandler(this, _gameFunctions, targetManager, _gameGui, _chatGui, _pluginLog);
|
_exchangeHandler = new ExchangeHandler(this, _gameFunctions, targetManager, _gameGui, _chatGui, _pluginLog);
|
||||||
_supplyHandler = new SupplyHandler(this, _gameFunctions, targetManager, _gameGui, _chatGui, itemCache,
|
_supplyHandler = new SupplyHandler(this, _gameFunctions, targetManager, _gameGui, itemCache,
|
||||||
_pluginLog);
|
_pluginLog);
|
||||||
|
|
||||||
_configWindow = new ConfigWindow(_pluginInterface, this, _configuration, _gcRewardsCache, _clientState,
|
_configWindow = new ConfigWindow(_pluginInterface, this, _configuration, _gcRewardsCache, _clientState,
|
||||||
@ -132,7 +132,12 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin
|
|||||||
{
|
{
|
||||||
_turnInWindow.State = false;
|
_turnInWindow.State = false;
|
||||||
_pluginLog.Information($"Pausing GC delivery, FC reached rank {rank}");
|
_pluginLog.Information($"Pausing GC delivery, FC reached rank {rank}");
|
||||||
_chatGui.Print($"Pausing Deliveroo, your FC reached rank {rank}.");
|
DeliveryResult = new DeliveryResult
|
||||||
|
{
|
||||||
|
Message = new SeStringBuilder()
|
||||||
|
.Append($"Pausing Deliveroo, your FC reached rank {rank}.")
|
||||||
|
.Build(),
|
||||||
|
};
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -155,8 +160,9 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal DateTime ContinueAt { private get; set; } = DateTime.MinValue;
|
internal DateTime ContinueAt { private get; set; } = DateTime.MinValue;
|
||||||
internal List<PurchaseItemRequest> ItemsToPurchaseNow { get; set; } = new();
|
internal List<PurchaseItemRequest> ItemsToPurchaseNow { get; private set; } = new();
|
||||||
internal int LastTurnInListSize { get; set; } = int.MaxValue;
|
internal int LastTurnInListSize { get; set; } = int.MaxValue;
|
||||||
|
internal DeliveryResult? DeliveryResult { get; set; }
|
||||||
|
|
||||||
internal bool TurnInState
|
internal bool TurnInState
|
||||||
{
|
{
|
||||||
@ -234,11 +240,7 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin
|
|||||||
{
|
{
|
||||||
_turnInWindow.IsOpen = false;
|
_turnInWindow.IsOpen = false;
|
||||||
_turnInWindow.State = false;
|
_turnInWindow.State = false;
|
||||||
if (CurrentStage != Stage.Stopped)
|
StopTurnIn();
|
||||||
{
|
|
||||||
_externalPluginHandler.Restore();
|
|
||||||
CurrentStage = Stage.Stopped;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (DateTime.Now > ContinueAt)
|
else if (DateTime.Now > ContinueAt)
|
||||||
{
|
{
|
||||||
@ -247,18 +249,14 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin
|
|||||||
|
|
||||||
if (!_turnInWindow.State)
|
if (!_turnInWindow.State)
|
||||||
{
|
{
|
||||||
if (CurrentStage != Stage.Stopped)
|
StopTurnIn();
|
||||||
{
|
|
||||||
_externalPluginHandler.Restore();
|
|
||||||
CurrentStage = Stage.Stopped;
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (_turnInWindow.State && CurrentStage == Stage.Stopped)
|
else if (_turnInWindow.State && CurrentStage == Stage.Stopped)
|
||||||
{
|
{
|
||||||
CurrentStage = Stage.TargetPersonnelOfficer;
|
CurrentStage = Stage.TargetPersonnelOfficer;
|
||||||
ItemsToPurchaseNow = _turnInWindow.SelectedItems;
|
ItemsToPurchaseNow = _turnInWindow.SelectedItems;
|
||||||
|
DeliveryResult = new();
|
||||||
_supplyHandler.ResetTurnInErrorHandling();
|
_supplyHandler.ResetTurnInErrorHandling();
|
||||||
if (ItemsToPurchaseNow.Count > 0)
|
if (ItemsToPurchaseNow.Count > 0)
|
||||||
{
|
{
|
||||||
@ -351,10 +349,9 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Stage.RequestStop:
|
case Stage.RequestStop:
|
||||||
_externalPluginHandler.Restore();
|
StopTurnIn();
|
||||||
CurrentStage = Stage.Stopped;
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Stage.Stopped:
|
case Stage.Stopped:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -365,6 +362,51 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void StopTurnIn()
|
||||||
|
{
|
||||||
|
if (CurrentStage != Stage.Stopped)
|
||||||
|
{
|
||||||
|
_externalPluginHandler.Restore();
|
||||||
|
CurrentStage = Stage.Stopped;
|
||||||
|
|
||||||
|
var text = DeliveryResult?.Message ?? "Delivery completed.";
|
||||||
|
var message = _configuration.ChatType switch
|
||||||
|
{
|
||||||
|
XivChatType.Say
|
||||||
|
or XivChatType.Shout
|
||||||
|
or XivChatType.TellOutgoing
|
||||||
|
or XivChatType.TellIncoming
|
||||||
|
or XivChatType.Party
|
||||||
|
or XivChatType.Alliance
|
||||||
|
or (>= XivChatType.Ls1 and <= XivChatType.Ls8)
|
||||||
|
or XivChatType.FreeCompany
|
||||||
|
or XivChatType.NoviceNetwork
|
||||||
|
or XivChatType.Yell
|
||||||
|
or XivChatType.CrossParty
|
||||||
|
or XivChatType.PvPTeam
|
||||||
|
or XivChatType.CrossLinkShell1
|
||||||
|
or XivChatType.NPCDialogue
|
||||||
|
or XivChatType.NPCDialogueAnnouncements
|
||||||
|
or (>= XivChatType.CrossLinkShell2 and <= XivChatType.CrossLinkShell8)
|
||||||
|
=> new XivChatEntry
|
||||||
|
{
|
||||||
|
Message = text,
|
||||||
|
Type = _configuration.ChatType,
|
||||||
|
Name = new SeStringBuilder().AddUiForeground("Deliveroo", 52).Build(),
|
||||||
|
},
|
||||||
|
_ => new XivChatEntry
|
||||||
|
{
|
||||||
|
Message = new SeStringBuilder().AddUiForeground("[Deliveroo] ", 52)
|
||||||
|
.Append(text)
|
||||||
|
.Build(),
|
||||||
|
Type = _configuration.ChatType,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
_chatGui.Print(message);
|
||||||
|
|
||||||
|
DeliveryResult = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
|
9
Deliveroo/DeliveryResult.cs
Normal file
9
Deliveroo/DeliveryResult.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
using Dalamud.Game.Text.SeStringHandling;
|
||||||
|
|
||||||
|
namespace Deliveroo
|
||||||
|
{
|
||||||
|
internal sealed class DeliveryResult
|
||||||
|
{
|
||||||
|
public SeString? Message { get; init; }
|
||||||
|
}
|
||||||
|
}
|
@ -9,11 +9,10 @@ using Deliveroo.GameData;
|
|||||||
using FFXIVClientStructs.FFXIV.Client.UI;
|
using FFXIVClientStructs.FFXIV.Client.UI;
|
||||||
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
|
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
|
||||||
using FFXIVClientStructs.FFXIV.Component.GUI;
|
using FFXIVClientStructs.FFXIV.Component.GUI;
|
||||||
using LLib;
|
|
||||||
using LLib.GameUI;
|
using LLib.GameUI;
|
||||||
using ValueType = FFXIVClientStructs.FFXIV.Component.GUI.ValueType;
|
using ValueType = FFXIVClientStructs.FFXIV.Component.GUI.ValueType;
|
||||||
|
|
||||||
namespace Deliveroo;
|
namespace Deliveroo.Handlers;
|
||||||
|
|
||||||
internal sealed class SupplyHandler
|
internal sealed class SupplyHandler
|
||||||
{
|
{
|
||||||
@ -21,20 +20,18 @@ internal sealed class SupplyHandler
|
|||||||
private readonly GameFunctions _gameFunctions;
|
private readonly GameFunctions _gameFunctions;
|
||||||
private readonly ITargetManager _targetManager;
|
private readonly ITargetManager _targetManager;
|
||||||
private readonly IGameGui _gameGui;
|
private readonly IGameGui _gameGui;
|
||||||
private readonly IChatGui _chatGui;
|
|
||||||
private readonly ItemCache _itemCache;
|
private readonly ItemCache _itemCache;
|
||||||
private readonly IPluginLog _pluginLog;
|
private readonly IPluginLog _pluginLog;
|
||||||
|
|
||||||
private uint _turnInErrors;
|
private uint _turnInErrors;
|
||||||
|
|
||||||
public SupplyHandler(DeliverooPlugin plugin, GameFunctions gameFunctions, ITargetManager targetManager,
|
public SupplyHandler(DeliverooPlugin plugin, GameFunctions gameFunctions, ITargetManager targetManager,
|
||||||
IGameGui gameGui, IChatGui chatGui, ItemCache itemCache, IPluginLog pluginLog)
|
IGameGui gameGui, ItemCache itemCache, IPluginLog pluginLog)
|
||||||
{
|
{
|
||||||
_plugin = plugin;
|
_plugin = plugin;
|
||||||
_gameFunctions = gameFunctions;
|
_gameFunctions = gameFunctions;
|
||||||
_targetManager = targetManager;
|
_targetManager = targetManager;
|
||||||
_gameGui = gameGui;
|
_gameGui = gameGui;
|
||||||
_chatGui = chatGui;
|
|
||||||
_itemCache = itemCache;
|
_itemCache = itemCache;
|
||||||
_pluginLog = pluginLog;
|
_pluginLog = pluginLog;
|
||||||
}
|
}
|
||||||
@ -210,10 +207,14 @@ internal sealed class SupplyHandler
|
|||||||
if (itemName != null && _itemCache.GetItemIdFromItemName(itemName)
|
if (itemName != null && _itemCache.GetItemIdFromItemName(itemName)
|
||||||
.Any(itemId => InternalConfiguration.QuickVentureExclusiveItems.Contains(itemId)))
|
.Any(itemId => InternalConfiguration.QuickVentureExclusiveItems.Contains(itemId)))
|
||||||
{
|
{
|
||||||
_chatGui.Print(new SeStringBuilder().Append("Won't turn in ")
|
_plugin.DeliveryResult = new DeliveryResult
|
||||||
|
{
|
||||||
|
Message = new SeStringBuilder()
|
||||||
|
.Append("Won't turn in ")
|
||||||
.AddItemLink(_itemCache.GetItemIdFromItemName(itemName).First())
|
.AddItemLink(_itemCache.GetItemIdFromItemName(itemName).First())
|
||||||
.Append(", as it can only be obtained through Quick Ventures.")
|
.Append(", as it can only be obtained through Quick Ventures.")
|
||||||
.Build());
|
.Build(),
|
||||||
|
};
|
||||||
|
|
||||||
addonSupplyReward->AtkUnitBase.FireCallbackInt(1);
|
addonSupplyReward->AtkUnitBase.FireCallbackInt(1);
|
||||||
_plugin.CurrentStage = Stage.CloseGcSupplyWindowThenStop;
|
_plugin.CurrentStage = Stage.CloseGcSupplyWindowThenStop;
|
||||||
|
@ -9,6 +9,7 @@ using Dalamud.Interface.Internal;
|
|||||||
using Dalamud.Interface.Utility;
|
using Dalamud.Interface.Utility;
|
||||||
using Dalamud.Plugin;
|
using Dalamud.Plugin;
|
||||||
using Dalamud.Plugin.Services;
|
using Dalamud.Plugin.Services;
|
||||||
|
using Dalamud.Utility;
|
||||||
using Deliveroo.GameData;
|
using Deliveroo.GameData;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
using LLib;
|
using LLib;
|
||||||
@ -359,6 +360,21 @@ internal sealed class ConfigWindow : LWindow
|
|||||||
|
|
||||||
ImGui.EndDisabled();
|
ImGui.EndDisabled();
|
||||||
|
|
||||||
|
ImGui.SetNextItemWidth(ImGuiHelpers.GlobalScale * 120);
|
||||||
|
var xivChatTypes = Enum.GetValues<XivChatType>()
|
||||||
|
.Where(x => x != XivChatType.StandardEmote)
|
||||||
|
.ToArray();
|
||||||
|
var selectedChatType = Array.IndexOf(xivChatTypes, _configuration.ChatType);
|
||||||
|
string[] chatTypeNames = xivChatTypes
|
||||||
|
.Select(t => t.GetAttribute<XivChatTypeInfoAttribute>()?.FancyName ?? t.ToString())
|
||||||
|
.ToArray();
|
||||||
|
if (ImGui.Combo("Chat channel for status updates", ref selectedChatType, chatTypeNames,
|
||||||
|
chatTypeNames.Length))
|
||||||
|
{
|
||||||
|
_configuration.ChatType = xivChatTypes[selectedChatType];
|
||||||
|
Save();
|
||||||
|
}
|
||||||
|
|
||||||
ImGui.SetNextItemWidth(ImGuiHelpers.GlobalScale * 120);
|
ImGui.SetNextItemWidth(ImGuiHelpers.GlobalScale * 120);
|
||||||
List<(int Rank, string Name)> rankUpComboValues = Enumerable.Range(1, 30)
|
List<(int Rank, string Name)> rankUpComboValues = Enumerable.Range(1, 30)
|
||||||
.Select(x => x == 1 ? (0, "---") : (x, $"Rank {x}"))
|
.Select(x => x == 1 ? (0, "---") : (x, $"Rank {x}"))
|
||||||
|
Loading…
Reference in New Issue
Block a user