Skip to content

Commit

Permalink
fix not being able to disable alarms #61 Fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
xorus committed Jun 16, 2024
1 parent 5f7a50b commit 4e7a939
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
1 change: 1 addition & 0 deletions Plugin/EngageTimer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ category_tags:
- jobs
changelog: |-
- Hide floating window border by default (you can re-enable it in floating window -> styling)
- Fix not being able to disable alarms
7 changes: 4 additions & 3 deletions Plugin/Status/CombatAlarm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ private void ConfigurationChanged(object? sender, EventArgs e)
for (var index = 0; index < Plugin.Config.CombatAlarms.Alarms.Count; index++)
{
var alarm = Plugin.Config.CombatAlarms.Alarms[index];
if (!alarm.Enabled) continue;
_alarms[alarm.StartTime] = new AlarmAction()
{
Type = AlarmActionType.Start,
Expand Down Expand Up @@ -148,7 +149,7 @@ private void FrameworkUpdate(IFramework framework)
if (!Plugin.State.InCombat) return;

// only run once a second
var time = (int) Math.Floor(Plugin.State.CombatDuration.TotalSeconds);
var time = (int)Math.Floor(Plugin.State.CombatDuration.TotalSeconds);
if (_lastCheck == time) return;
_lastCheck = time;

Expand All @@ -167,14 +168,14 @@ public static void AlarmSfx(CombatAlarmsConfiguration.Alarm alarm)
{
if (alarm.Sfx != null)
{
Plugin.SfxPlay.SoundEffect((uint) (SfxPlay.FirstSeSfx + alarm.Sfx));
Plugin.SfxPlay.SoundEffect((uint)(SfxPlay.FirstSeSfx + alarm.Sfx));
}
}

public static void AlarmText(CombatAlarmsConfiguration.Alarm alarm)
{
var trimText = alarm.Text?.Trim();
if (trimText is not {Length: > 0}) return;
if (trimText is not { Length: > 0 }) return;
switch (alarm.TextType)
{
case CombatAlarmsConfiguration.TextType.DalamudNotification:
Expand Down
11 changes: 4 additions & 7 deletions Plugin/Ui/SettingsTab/AlarmsTab.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ private static void AlarmElement(int index, CombatAlarmsConfiguration.Alarm alar
}
{
ImGui.TableNextColumn();
ImGui.Checkbox("###enabled" + index, ref alarm.Enabled);
if (ImGui.Checkbox("###enabled" + index, ref alarm.Enabled)) Plugin.Config.Save();
}
{
ImGui.TableNextColumn();
Expand Down Expand Up @@ -211,10 +211,7 @@ private static void AlarmElement(int index, CombatAlarmsConfiguration.Alarm alar
}
{
ImGui.TableNextColumn();
if (ImGui.Checkbox("###blink", ref alarm.Blink))
{
Plugin.Config.Save();
}
if (ImGui.Checkbox("###blink", ref alarm.Blink)) Plugin.Config.Save();
}
{
ImGui.TableNextColumn();
Expand Down Expand Up @@ -248,13 +245,13 @@ private static void AlarmElement(int index, CombatAlarmsConfiguration.Alarm alar
ImGui.TableNextColumn();
if (EditingTexts.Contains(index))
{
var type = (int) alarm.TextType;
var type = (int)alarm.TextType;
ImGui.PushItemWidth(150f);
if (ImGui.Combo("Type", ref type, Strings.AlarmEdit_Type_ChatLog + "\0"
+ Strings.AlarmEdit_Type_DalamudNotification + "\0"
+ Strings.AlarmEdit_Type_GameToast + "\0"))
{
alarm.TextType = (CombatAlarmsConfiguration.TextType) type;
alarm.TextType = (CombatAlarmsConfiguration.TextType)type;
Plugin.Config.Save();
}

Expand Down

0 comments on commit 4e7a939

Please sign in to comment.