1
0
Fork 0
forked from aly/qstbak

qstcompanion v1.0.6

This commit is contained in:
alydev 2025-12-07 10:54:53 +10:00
parent 5e1e1decc5
commit ada27cf05b
30 changed files with 3403 additions and 426 deletions

View file

@ -1,6 +1,5 @@
using System;
using Dalamud.Plugin.Services;
using FFXIVClientStructs.FFXIV.Client.UI;
using FFXIVClientStructs.FFXIV.Component.GUI;
namespace QuestionableCompanion.Services;
@ -21,6 +20,8 @@ public class PartyInviteAutoAccept : IDisposable
private DateTime autoAcceptUntil = DateTime.MinValue;
private bool hasLoggedAlwaysAccept;
public PartyInviteAutoAccept(IPluginLog log, IFramework framework, IGameGui gameGui, IPartyList partyList, Configuration configuration)
{
this.log = log;
@ -47,16 +48,50 @@ public class PartyInviteAutoAccept : IDisposable
log.Information("[PartyInviteAutoAccept] Will accept ALL party invites during this time!");
}
public void EnableForQuester(string questerName)
{
shouldAutoAccept = true;
autoAcceptUntil = DateTime.Now.AddSeconds(60.0);
log.Information("[PartyInviteAutoAccept] Auto-accept enabled for quester: " + questerName);
log.Information("[PartyInviteAutoAccept] Will accept invites for 60 seconds");
}
private unsafe void OnFrameworkUpdate(IFramework framework)
{
if (!shouldAutoAccept)
bool shouldAcceptNow = false;
if (configuration.IsHighLevelHelper && configuration.AlwaysAutoAcceptInvites)
{
return;
if (!hasLoggedAlwaysAccept)
{
log.Information("[PartyInviteAutoAccept] === ALWAYS AUTO-ACCEPT ENABLED ===");
log.Information("[PartyInviteAutoAccept] Helper will continuously accept ALL party invites");
log.Information("[PartyInviteAutoAccept] This mode is ALWAYS ON (no timeout)");
hasLoggedAlwaysAccept = true;
}
shouldAcceptNow = true;
}
if (DateTime.Now > autoAcceptUntil)
else if (shouldAutoAccept)
{
if (hasLoggedAlwaysAccept)
{
log.Information("[PartyInviteAutoAccept] Always auto-accept disabled");
hasLoggedAlwaysAccept = false;
}
if (DateTime.Now > autoAcceptUntil)
{
shouldAutoAccept = false;
log.Information("[PartyInviteAutoAccept] Auto-accept window expired");
return;
}
shouldAcceptNow = true;
}
else if (hasLoggedAlwaysAccept)
{
log.Information("[PartyInviteAutoAccept] Always auto-accept disabled");
hasLoggedAlwaysAccept = false;
}
if (!shouldAcceptNow)
{
shouldAutoAccept = false;
log.Information("[PartyInviteAutoAccept] Auto-accept window expired");
return;
}
try
@ -72,66 +107,35 @@ public class PartyInviteAutoAccept : IDisposable
break;
}
}
if (addonPtr == IntPtr.Zero)
if (addonPtr != IntPtr.Zero)
{
if (DateTime.Now.Second % 5 != 0)
{
return;
}
log.Debug($"[PartyInviteAutoAccept] Still waiting for party invite dialog... ({(autoAcceptUntil - DateTime.Now).TotalSeconds:F0}s remaining)");
if (DateTime.Now.Second % 10 != 0)
{
return;
}
log.Warning("[PartyInviteAutoAccept] === DUMPING ALL VISIBLE ADDONS ===");
RaptureAtkUnitManager* atkStage = RaptureAtkUnitManager.Instance();
if (atkStage != null)
{
AtkUnitManager* unitManager = &atkStage->AtkUnitManager;
for (int j = 0; j < unitManager->AllLoadedUnitsList.Count; j++)
{
AtkUnitBase* addon = unitManager->AllLoadedUnitsList.Entries[j].Value;
if (addon != null && addon->IsVisible)
{
string name2 = addon->NameString;
log.Warning("[PartyInviteAutoAccept] Visible addon: " + name2);
}
}
}
log.Warning("[PartyInviteAutoAccept] === END ADDON DUMP ===");
}
else
{
AtkUnitBase* addon2 = (AtkUnitBase*)addonPtr;
if (addon2 == null)
AtkUnitBase* addon = (AtkUnitBase*)addonPtr;
if (addon == null)
{
log.Warning("[PartyInviteAutoAccept] Addon pointer is null!");
return;
}
if (!addon2->IsVisible)
else if (addon->IsVisible)
{
log.Debug("[PartyInviteAutoAccept] Addon exists but not visible yet");
return;
AtkValue* values = stackalloc AtkValue[1];
*values = new AtkValue
{
Type = FFXIVClientStructs.FFXIV.Component.GUI.ValueType.Int,
Int = 0
};
addon->FireCallback(1u, values);
AtkValue* values2 = stackalloc AtkValue[2];
*values2 = new AtkValue
{
Type = FFXIVClientStructs.FFXIV.Component.GUI.ValueType.Int,
Int = 0
};
values2[1] = new AtkValue
{
Type = FFXIVClientStructs.FFXIV.Component.GUI.ValueType.UInt,
UInt = 0u
};
addon->FireCallback(2u, values2);
}
AtkValue* values = stackalloc AtkValue[1];
*values = new AtkValue
{
Type = FFXIVClientStructs.FFXIV.Component.GUI.ValueType.Int,
Int = 0
};
addon2->FireCallback(1u, values);
AtkValue* values2 = stackalloc AtkValue[2];
*values2 = new AtkValue
{
Type = FFXIVClientStructs.FFXIV.Component.GUI.ValueType.Int,
Int = 0
};
values2[1] = new AtkValue
{
Type = FFXIVClientStructs.FFXIV.Component.GUI.ValueType.UInt,
UInt = 0u
};
addon2->FireCallback(2u, values2);
}
}
catch (Exception ex)