Option to hide chat in battle

This commit is contained in:
Infi
2024-05-11 01:11:53 +02:00
parent 57f8546372
commit 5d6acf7d08
5 changed files with 40 additions and 1 deletions
+2
View File
@@ -18,6 +18,7 @@ internal class Configuration : IPluginConfiguration
public bool HideWhenNotLoggedIn = true;
public bool HideWhenUiHidden = true;
public bool HideInLoadingScreens;
public bool HideInBattle;
public bool NativeItemTooltips = true;
public bool PrettierTimestamps = true;
public bool MoreCompactPretty;
@@ -70,6 +71,7 @@ internal class Configuration : IPluginConfiguration
HideWhenNotLoggedIn = other.HideWhenNotLoggedIn;
HideWhenUiHidden = other.HideWhenUiHidden;
HideInLoadingScreens = other.HideInLoadingScreens;
HideInBattle = other.HideInBattle;
NativeItemTooltips = other.NativeItemTooltips;
PrettierTimestamps = other.PrettierTimestamps;
MoreCompactPretty = other.MoreCompactPretty;
+18
View File
@@ -2021,6 +2021,24 @@ namespace ChatTwo.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Hide the chat during battles..
/// </summary>
internal static string Options_HideInBattle_Description {
get {
return ResourceManager.GetString("Options_HideInBattle_Description", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Hide during battle.
/// </summary>
internal static string Options_HideInBattle_Name {
get {
return ResourceManager.GetString("Options_HideInBattle_Name", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Hide {0} during loading screens..
/// </summary>
+6
View File
@@ -1033,4 +1033,10 @@
<data name="Options_Emote_EmoteTable" xml:space="preserve">
<value>Emote</value>
</data>
<data name="Options_HideInBattle_Name" xml:space="preserve">
<value>Hide during battle</value>
</data>
<data name="Options_HideInBattle_Description" xml:space="preserve">
<value>Hide the chat during battles.</value>
</data>
</root>
+11 -1
View File
@@ -397,6 +397,7 @@ public sealed class ChatLogWindow : Window
SetChannel(tab.Channel ?? tab.PreviousChannel);
}
private static bool InBattle => Plugin.Condition[ConditionFlag.InCombat];
private static bool GposeActive => Plugin.Condition[ConditionFlag.WatchingCutscene];
private static bool CutsceneActive => Plugin.Condition[ConditionFlag.OccupiedInCutSceneEvent] || Plugin.Condition[ConditionFlag.WatchingCutscene78];
@@ -406,6 +407,7 @@ public sealed class ChatLogWindow : Window
Cutscene,
CutsceneOverride,
User,
Battle
}
private HideState CurrentHideState = HideState.None;
@@ -413,6 +415,14 @@ public sealed class ChatLogWindow : Window
public bool IsHidden;
public void HideStateCheck()
{
// if the chat has no hide state set, and the player has entered battle, we hide chat if they have configured it
if (Plugin.Config.HideInBattle && CurrentHideState == HideState.None && InBattle)
CurrentHideState = HideState.Battle;
// If the chat is hidden because of battle, we reset it here
if (CurrentHideState is HideState.Battle && !InBattle)
CurrentHideState = HideState.None;
// if the chat has no hide state and in a cutscene, set the hide state to cutscene
if (Plugin.Config.HideDuringCutscenes && CurrentHideState == HideState.None && (CutsceneActive || GposeActive))
CurrentHideState = HideState.Cutscene;
@@ -429,7 +439,7 @@ public sealed class ChatLogWindow : Window
if (CurrentHideState == HideState.User && Activate)
CurrentHideState = HideState.None;
if (CurrentHideState is HideState.Cutscene or HideState.User || (Plugin.Config.HideWhenNotLoggedIn && !Plugin.ClientState.IsLoggedIn))
if (CurrentHideState is HideState.Cutscene or HideState.User or HideState.Battle || (Plugin.Config.HideWhenNotLoggedIn && !Plugin.ClientState.IsLoggedIn))
{
IsHidden = true;
return;
+3
View File
@@ -36,6 +36,9 @@ internal sealed class Display : ISettingsTab
ImGuiUtil.OptionCheckbox(ref Mutable.HideInLoadingScreens, Language.Options_HideInLoadingScreens_Name, string.Format(Language.Options_HideInLoadingScreens_Description, Plugin.PluginName));
ImGui.Spacing();
ImGuiUtil.OptionCheckbox(ref Mutable.HideInBattle, Language.Options_HideInBattle_Name, Language.Options_HideInBattle_Description);
ImGui.Spacing();
ImGuiUtil.OptionCheckbox(ref Mutable.PrettierTimestamps, Language.Options_PrettierTimestamps_Name, Language.Options_PrettierTimestamps_Description);
if (Mutable.PrettierTimestamps)