Skip to content

Commit

Permalink
Hotfix: Endless loop while generating
Browse files Browse the repository at this point in the history
  • Loading branch information
RenNagasaki committed Aug 10, 2024
1 parent 85b5a14 commit d032048
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Echokraut/Echokraut.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Project="Dalamud.Plugin.Bootstrap.targets" />

<PropertyGroup>
<Version>0.10.5.4</Version>
<Version>0.10.5.5</Version>
<Description>A TTS Dalamud Plugin that breaks the silence! For self hosted TTS Services.</Description>
<PackageProjectUrl>https://github.com/RenNagasaki/Echokraut</PackageProjectUrl>
<PackageLicenseExpression>AGPL-3.0-or-later</PackageLicenseExpression>
Expand Down
7 changes: 7 additions & 0 deletions Echokraut/Helper/AddonBattleTalkHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ private record struct AddonBattleTalkState(string? Speaker, string? Text);
private readonly Echokraut plugin;
public bool nextIsVoice = false;
public DateTime timeNextVoice = DateTime.Now;
private AddonBattleTalkState lastValue;

public AddonBattleTalkHelper(Echokraut plugin, IAddonLifecycle addonLifecycle, IClientState clientState, IObjectTable objects, Configuration config)
{
Expand Down Expand Up @@ -75,6 +76,12 @@ private unsafe AddonBattleTalkState GetTalkAddonState(AddonBattleTalk* addonTalk

private void Mutate(AddonBattleTalkState nextValue)
{
if (lastValue.Equals(nextValue))
{
return;
}

lastValue = nextValue;
HandleChange(nextValue);
}

Expand Down
16 changes: 16 additions & 0 deletions Echokraut/Helper/AddonTalkHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
using Echokraut.TextToTalk.Utils;
using Dalamud.Configuration;
using Echokraut.DataClasses;
using static Dalamud.Plugin.Services.IFramework;
using System.IO;
using Dalamud.Game.ClientState.Conditions;
using FFXIVClientStructs.FFXIV.Client.UI;
using Echokraut.Enums;
using Echokraut.Utils;
Expand All @@ -26,6 +29,7 @@ private record struct AddonTalkState(string? Speaker, string? Text);
public DateTime timeNextVoice = DateTime.Now;

public static nint Address { get; set; }
private AddonTalkState lastValue;

public AddonTalkHelper(Echokraut plugin, IAddonLifecycle addonLifecycle, IClientState clientState, IObjectTable objects, Configuration config)
{
Expand Down Expand Up @@ -60,6 +64,12 @@ private unsafe void Handle(AddonTalk* addonTalk)

private void Mutate(AddonTalkState nextValue)
{
if (lastValue.Equals(nextValue))
{
return;
}

lastValue = nextValue;
HandleChange(nextValue);
}

Expand Down Expand Up @@ -126,6 +136,12 @@ private void HandleChange(AddonTalkState state)
return addonTalk == null ? null : TalkUtils.ReadTalkAddon(addonTalk);
}

public unsafe bool IsVisible()
{
var addonTalk = GetAddonTalk();
return addonTalk != null && addonTalk->AtkUnitBase.IsVisible;
}

private unsafe AddonTalk* GetAddonTalk()
{
return (AddonTalk*)Address.ToPointer();
Expand Down

0 comments on commit d032048

Please sign in to comment.