muffin v7.38.1

This commit is contained in:
alydev 2025-11-18 10:16:09 +10:00
parent e5b98b3d57
commit 0336b9c9e9
12 changed files with 4618 additions and 4245 deletions

View file

@ -29,6 +29,12 @@ internal sealed class ItemUseModule : ICombatModule
private DateTime _continueAt;
private bool _itemUsePending;
private DateTime _itemUsePendingUntil;
private int _lastKnownItemCount;
public ItemUseModule(IServiceProvider serviceProvider, ICondition condition, ILogger<ItemUseModule> logger)
{
_serviceProvider = serviceProvider;
@ -49,13 +55,19 @@ internal sealed class ItemUseModule : ICombatModule
return _delegate != null;
}
public bool Start(CombatController.CombatData combatData)
public unsafe bool Start(CombatController.CombatData combatData)
{
if (_delegate.Start(combatData))
{
_combatData = combatData;
_isDoingRotation = true;
_continueAt = DateTime.Now;
if (_combatData?.CombatItemUse != null)
{
InventoryManager* ptr = InventoryManager.Instance();
_lastKnownItemCount = ptr->GetInventoryItemCount(_combatData.CombatItemUse.ItemId, isHq: false, checkEquipped: true, checkArmory: true, 0);
_itemUsePending = false;
}
return true;
}
return false;
@ -88,16 +100,29 @@ internal sealed class ItemUseModule : ICombatModule
{
if (_isDoingRotation)
{
if (InventoryManager.Instance()->GetInventoryItemCount(_combatData.CombatItemUse.ItemId, isHq: false, checkEquipped: true, checkArmory: true, 0) == 0)
int inventoryItemCount = InventoryManager.Instance()->GetInventoryItemCount(_combatData.CombatItemUse.ItemId, isHq: false, checkEquipped: true, checkArmory: true, 0);
if (_itemUsePending)
{
_isDoingRotation = false;
_delegate.Stop();
if (DateTime.Now < _itemUsePendingUntil)
{
_logger.LogDebug("Item use pending; ignoring temporary inventory count={Count}", inventoryItemCount);
}
else
{
_itemUsePending = false;
}
}
else if (ShouldUseItem(nextTarget))
if (!_itemUsePending && inventoryItemCount == 0)
{
_isDoingRotation = false;
_delegate.Stop();
_logger.LogInformation("Using item {ItemId}", _combatData.CombatItemUse.ItemId);
return;
}
_lastKnownItemCount = inventoryItemCount;
if (ShouldUseItem(nextTarget))
{
_itemUsePending = true;
_itemUsePendingUntil = DateTime.Now.AddSeconds(3.0);
AgentInventoryContext.Instance()->UseItem(_combatData.CombatItemUse.ItemId, InventoryType.Invalid, 0u, 0);
_continueAt = DateTime.Now.AddSeconds(2.0);
}

File diff suppressed because it is too large Load diff

View file

@ -34,6 +34,7 @@ internal sealed class JsonSchemaValidator : IQuestValidator
SchemaRegistry.Global.Register(new Uri("https://github.com/WigglyMuffin/Questionable/raw/refs/heads/main/Questionable.Model/common-aetheryte.json"), JsonSchema.FromStream(AssemblyModelLoader.CommonAetheryte).AsTask().Result);
SchemaRegistry.Global.Register(new Uri("https://github.com/WigglyMuffin/Questionable/raw/refs/heads/main/Questionable.Model/common-classjob.json"), JsonSchema.FromStream(AssemblyModelLoader.CommonClassJob).AsTask().Result);
SchemaRegistry.Global.Register(new Uri("https://github.com/WigglyMuffin/Questionable/raw/refs/heads/main/Questionable.Model/common-completionflags.json"), JsonSchema.FromStream(AssemblyModelLoader.CommonCompletionFlags).AsTask().Result);
SchemaRegistry.Global.Register(new Uri("https://github.com/WigglyMuffin/Questionable/raw/refs/heads/main/Questionable.Model/common-requiredvariables.json"), JsonSchema.FromStream(AssemblyModelLoader.CommonRequiredVariables).AsTask().Result);
SchemaRegistry.Global.Register(new Uri("https://github.com/WigglyMuffin/Questionable/raw/refs/heads/main/Questionable.Model/common-vector3.json"), JsonSchema.FromStream(AssemblyModelLoader.CommonVector3).AsTask().Result);
SchemaRegistry.Global.Register(new Uri("https://github.com/WigglyMuffin/Questionable/raw/refs/heads/main/QuestPaths/quest-v1.json"), JsonSchema.FromStream(AssemblyQuestLoader.QuestSchema).AsTask().Result);
}
@ -67,6 +68,7 @@ internal sealed class JsonSchemaValidator : IQuestValidator
RegisterLocalIfExistsFromPath(Find("common-aetheryte.json"), "https://github.com/WigglyMuffin/Questionable/raw/refs/heads/main/Questionable.Model/common-aetheryte.json");
RegisterLocalIfExistsFromPath(Find("common-classjob.json"), "https://github.com/WigglyMuffin/Questionable/raw/refs/heads/main/Questionable.Model/common-classjob.json");
RegisterLocalIfExistsFromPath(Find("common-completionflags.json"), "https://github.com/WigglyMuffin/Questionable/raw/refs/heads/main/Questionable.Model/common-completionflags.json");
RegisterLocalIfExistsFromPath(Find("common-requiredvariables.json"), "https://github.com/WigglyMuffin/Questionable/raw/refs/heads/main/Questionable.Model/common-requiredvariables.json");
RegisterLocalIfExistsFromPath(Find("common-vector3.json"), "https://github.com/WigglyMuffin/Questionable/raw/refs/heads/main/Questionable.Model/common-vector3.json");
RegisterLocalIfExistsFromPath(Find("quest-v1.json"), "https://github.com/WigglyMuffin/Questionable/raw/refs/heads/main/QuestPaths/quest-v1.json");
static void RegisterLocalIfExistsFromPath(string? path, string registrationUri)

View file

@ -56,7 +56,10 @@ internal static class ChangelogCategoryComponent
{
ImGui.SetCursorPosX(baseX + changeIndent);
float cursorPosY = ImGui.GetCursorPosY();
ImGui.TextColored(new Vector4(0.95f, 0.95f, 1f, 1f), "\ufffd");
using (ImRaii.PushFont(UiBuilder.IconFont))
{
ImGui.TextColored(new Vector4(0.95f, 0.95f, 1f, 1f), FontAwesomeIcon.CaretRight.ToIconString());
}
ImGui.SameLine();
ImGui.SetCursorPosY(cursorPosY);
float num = ImGui.GetContentRegionAvail().X - 8f;
@ -76,7 +79,10 @@ internal static class ChangelogCategoryComponent
{
ImGui.SetCursorPosX(baseX + num);
float cursorPosY = ImGui.GetCursorPosY();
ImGui.TextColored(new Vector4(0.85f, 0.85f, 0.92f, 1f), "\ufffd");
using (ImRaii.PushFont(UiBuilder.IconFont))
{
ImGui.TextColored(new Vector4(0.85f, 0.85f, 0.92f, 1f), FontAwesomeIcon.AngleRight.ToIconString());
}
ImGui.SameLine();
ImGui.SetCursorPosY(cursorPosY);
float num2 = ImGui.GetContentRegionAvail().X - 8f;