b1f01d2794
- Add debug logging (gated by Debug) and scan mode to find party-invite addon - Listen for PartyInvite and SelectYesno addons - Cache friends and FC members on login: open Friends/FC addons briefly, scrape names, close; persist cache to HSRToolsFriendFcCache.json - Auto-accept checks cache first, then live proxy (works without opening UIs) - Config: CacheFriendsAndFcOnLogin, AutoAcceptScanAddons - FC: RequestData() + longer wait; clearer log when 0 FC members Co-authored-by: Cursor <cursoragent@cursor.com>
120 lines
5.0 KiB
C#
120 lines
5.0 KiB
C#
using Dalamud.Bindings.ImGui;
|
|
using Dalamud.Interface.Windowing;
|
|
using HSRTools.Configuration;
|
|
|
|
namespace HSRTools.UI;
|
|
|
|
public sealed class ConfigWindow : Window
|
|
{
|
|
private readonly HSRToolsConfiguration _config;
|
|
private string _triggerTextInput = string.Empty;
|
|
private bool _caseSensitive;
|
|
private bool _monitorFreeCompany;
|
|
private bool _monitorLinkShell;
|
|
private bool _monitorCrossWorldLinkShell;
|
|
private bool _monitorTell;
|
|
private bool _enabled;
|
|
private bool _debug;
|
|
private bool _autoAcceptEnabled;
|
|
private bool _autoAcceptFromFriends;
|
|
private bool _autoAcceptFromFreeCompany;
|
|
private bool _autoAcceptScanAddons;
|
|
private bool _cacheFriendsAndFcOnLogin;
|
|
|
|
public ConfigWindow(HSRToolsConfiguration config)
|
|
: base("HSRTools Configuration", ImGuiWindowFlags.AlwaysAutoResize)
|
|
{
|
|
_config = config;
|
|
SyncFromConfig();
|
|
}
|
|
|
|
private void SyncFromConfig()
|
|
{
|
|
_triggerTextInput = _config.TriggerText ?? string.Empty;
|
|
_caseSensitive = _config.CaseSensitive;
|
|
_monitorFreeCompany = _config.MonitorFreeCompany;
|
|
_monitorLinkShell = _config.MonitorLinkShell;
|
|
_monitorCrossWorldLinkShell = _config.MonitorCrossWorldLinkShell;
|
|
_monitorTell = _config.MonitorTell;
|
|
_enabled = _config.Enabled;
|
|
_debug = _config.Debug;
|
|
_autoAcceptEnabled = _config.AutoAcceptEnabled;
|
|
_autoAcceptFromFriends = _config.AutoAcceptFromFriends;
|
|
_autoAcceptFromFreeCompany = _config.AutoAcceptFromFreeCompany;
|
|
_autoAcceptScanAddons = _config.AutoAcceptScanAddons;
|
|
_cacheFriendsAndFcOnLogin = _config.CacheFriendsAndFcOnLogin;
|
|
}
|
|
|
|
public override void Draw()
|
|
{
|
|
if (ImGui.Button("Reset to defaults"))
|
|
{
|
|
_config.TriggerText = "inv";
|
|
_config.CaseSensitive = false;
|
|
_config.MonitorFreeCompany = true;
|
|
_config.MonitorLinkShell = true;
|
|
_config.MonitorCrossWorldLinkShell = true;
|
|
_config.MonitorTell = true;
|
|
_config.Enabled = true;
|
|
_config.Debug = false;
|
|
_config.AutoAcceptEnabled = false;
|
|
_config.AutoAcceptFromFriends = true;
|
|
_config.AutoAcceptFromFreeCompany = true;
|
|
_config.AutoAcceptScanAddons = false;
|
|
_config.CacheFriendsAndFcOnLogin = true;
|
|
SyncFromConfig();
|
|
}
|
|
|
|
ImGui.Separator();
|
|
ImGui.Checkbox("Plugin enabled", ref _enabled);
|
|
_config.Enabled = _enabled;
|
|
|
|
ImGui.Spacing();
|
|
ImGui.Text("Trigger text (word or phrase that triggers an invite when seen in chat):");
|
|
if (ImGui.InputText("##trigger", ref _triggerTextInput, 128))
|
|
_config.TriggerText = _triggerTextInput.Trim();
|
|
|
|
ImGui.Checkbox("Case sensitive", ref _caseSensitive);
|
|
_config.CaseSensitive = _caseSensitive;
|
|
|
|
ImGui.Separator();
|
|
ImGui.Text("Monitor these channels:");
|
|
ImGui.Indent();
|
|
if (ImGui.Checkbox("Free Company", ref _monitorFreeCompany))
|
|
_config.MonitorFreeCompany = _monitorFreeCompany;
|
|
if (ImGui.Checkbox("Link Shell (1-8)", ref _monitorLinkShell))
|
|
_config.MonitorLinkShell = _monitorLinkShell;
|
|
if (ImGui.Checkbox("Cross-World Link Shell (1-8)", ref _monitorCrossWorldLinkShell))
|
|
_config.MonitorCrossWorldLinkShell = _monitorCrossWorldLinkShell;
|
|
if (ImGui.Checkbox("Tells / Whispers", ref _monitorTell))
|
|
_config.MonitorTell = _monitorTell;
|
|
ImGui.Unindent();
|
|
|
|
ImGui.Separator();
|
|
if (ImGui.Checkbox("Debug logging (diagnose cross-world invite)", ref _debug))
|
|
_config.Debug = _debug;
|
|
|
|
ImGui.Separator();
|
|
ImGui.Text("Auto-accept party invites:");
|
|
ImGui.Indent();
|
|
if (ImGui.Checkbox("Auto-accept from friends and FC members", ref _autoAcceptEnabled))
|
|
_config.AutoAcceptEnabled = _autoAcceptEnabled;
|
|
if (_autoAcceptEnabled)
|
|
{
|
|
if (ImGui.Checkbox(" From friends", ref _autoAcceptFromFriends))
|
|
_config.AutoAcceptFromFriends = _autoAcceptFromFriends;
|
|
if (ImGui.Checkbox(" From Free Company members", ref _autoAcceptFromFreeCompany))
|
|
_config.AutoAcceptFromFreeCompany = _autoAcceptFromFreeCompany;
|
|
}
|
|
if (ImGui.Checkbox("Scan mode: log all addons that open", ref _autoAcceptScanAddons))
|
|
_config.AutoAcceptScanAddons = _autoAcceptScanAddons;
|
|
if (_autoAcceptScanAddons)
|
|
ImGui.TextColored(new System.Numerics.Vector4(1, 0.8f, 0, 1), " Enable, get a party invite, check log for addon name. Disable after.");
|
|
if (ImGui.Checkbox("Cache friends & FC on login", ref _cacheFriendsAndFcOnLogin))
|
|
_config.CacheFriendsAndFcOnLogin = _cacheFriendsAndFcOnLogin;
|
|
if (_cacheFriendsAndFcOnLogin)
|
|
ImGui.TextColored(new System.Numerics.Vector4(0.7f, 0.7f, 0.7f, 1f), " Opens Friends and FC windows briefly on login to cache names, then closes them.");
|
|
ImGui.Unindent();
|
|
}
|
|
}
|