Skip to content

Commit 79d3f3c

Browse files
committed
Death Sentence Tank Fix & Sound Selection
Fixed Death Sentence for tanks, added sound file selectors, added sound test for divebomb & enrage alerts.
1 parent 91110c8 commit 79d3f3c

File tree

7 files changed

+213
-84
lines changed

7 files changed

+213
-84
lines changed

talis.xivplugin.twintania/Initializer.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public static void LoadSettings()
5050

5151
public static void LoadAndCacheSounds()
5252
{
53-
PluginViewModel.Instance.SoundFiles.Clear();
53+
//PluginViewModel.Instance.SoundFiles.Clear();
5454
//do your gui stuff here
5555
var legacyFiles = new List<FileInfo>();
5656
var filters = new List<string>
@@ -91,7 +91,9 @@ public static void LoadAndCacheSounds()
9191
{
9292
}
9393
}
94-
foreach (var cachedSoundFile in SoundPlayerHelper.SoundFileKeys())
94+
95+
var cachedSoundFiles = SoundPlayerHelper.SoundFileKeys().Except(PluginViewModel.Instance.SoundFiles);
96+
foreach (var cachedSoundFile in cachedSoundFiles)
9597
{
9698
PluginViewModel.Instance.SoundFiles.Add(cachedSoundFile);
9799
}

talis.xivplugin.twintania/Properties/Settings.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -76,37 +76,37 @@ private void DefaultSettings()
7676
Constants.Settings.Add("TwintaniaWidgetEnrageTime");
7777
Constants.Settings.Add("TwintaniaWidgetEnrageCounting");
7878
Constants.Settings.Add("TwintaniaWidgetEnrageVolume");
79-
//Constants.Settings.Add("TwintaniaWidgetEnrageAlertFile");
79+
Constants.Settings.Add("TwintaniaWidgetEnrageAlertFile");
8080

8181
Constants.Settings.Add("TwintaniaWidgetDivebombTimeFast");
8282
Constants.Settings.Add("TwintaniaWidgetDivebombTimeSlow");
8383
Constants.Settings.Add("TwintaniaWidgetDivebombCounting");
8484
Constants.Settings.Add("TwintaniaWidgetDivebombVolume");
85-
//Constants.Settings.Add("TwintaniaWidgetDivebombAlertFile");
85+
Constants.Settings.Add("TwintaniaWidgetDivebombAlertFile");
8686

8787
Constants.Settings.Add("TwintaniaWidgetDeathSentenceAlertPlaySound");
8888
Constants.Settings.Add("TwintaniaWidgetDeathSentenceAlertVolume");
89-
//Constants.Settings.Add("TwintaniaWidgetDeathSentenceAlertFile");
89+
Constants.Settings.Add("TwintaniaWidgetDeathSentenceAlertFile");
9090

9191
Constants.Settings.Add("TwintaniaWidgetDeathSentenceWarningEnabled");
9292
Constants.Settings.Add("TwintaniaWidgetDeathSentenceWarningShowTimer");
9393
Constants.Settings.Add("TwintaniaWidgetDeathSentenceWarningTime");
9494
Constants.Settings.Add("TwintaniaWidgetDeathSentenceWarningPlaySound");
9595
Constants.Settings.Add("TwintaniaWidgetDeathSentenceWarningCounting");
9696
Constants.Settings.Add("TwintaniaWidgetDeathSentenceWarningVolume");
97-
//Constants.Settings.Add("TwintaniaWidgetDeathSentenceWarningFile");
97+
Constants.Settings.Add("TwintaniaWidgetDeathSentenceWarningFile");
9898

9999
Constants.Settings.Add("TwintaniaWidgetTwisterAlertPlaySound");
100100
Constants.Settings.Add("TwintaniaWidgetTwisterAlertVolume");
101-
//Constants.Settings.Add("TwintaniaWidgetTwisterAlertFile");
101+
Constants.Settings.Add("TwintaniaWidgetTwisterAlertFile");
102102

103103
Constants.Settings.Add("TwintaniaWidgetTwisterWarningEnabled");
104104
Constants.Settings.Add("TwintaniaWidgetTwisterWarningShowTimer");
105105
Constants.Settings.Add("TwintaniaWidgetTwisterWarningTime");
106106
Constants.Settings.Add("TwintaniaWidgetTwisterWarningPlaySound");
107107
Constants.Settings.Add("TwintaniaWidgetTwisterWarningCounting");
108108
Constants.Settings.Add("TwintaniaWidgetTwisterWarningVolume");
109-
//Constants.Settings.Add("TwintaniaWidgetTwisterWarningFile");
109+
Constants.Settings.Add("TwintaniaWidgetTwisterWarningFile");
110110
}
111111

112112
public new void Reset()
@@ -426,7 +426,7 @@ public int TwintaniaWidgetEnrageVolume
426426

427427
[UserScopedSetting]
428428
[DebuggerNonUserCode]
429-
[DefaultSettingValue("AlertSounds/LowHealth.wav")]
429+
[DefaultSettingValue("AlertSounds\\LowHealth.wav")]
430430
public string TwintaniaWidgetEnrageAlertFile
431431
{
432432
get { return ((string)(this["TwintaniaWidgetEnrageAlertFile"])); }
@@ -491,7 +491,7 @@ public int TwintaniaWidgetDivebombVolume
491491

492492
[UserScopedSetting]
493493
[DebuggerNonUserCode]
494-
[DefaultSettingValue("AlertSounds/LowHealth.wav")]
494+
[DefaultSettingValue("AlertSounds\\LowHealth.wav")]
495495
public string TwintaniaWidgetDivebombAlertFile
496496
{
497497
get { return ((string) (this["TwintaniaWidgetDivebombAlertFile"])); }
@@ -531,7 +531,7 @@ public int TwintaniaWidgetDeathSentenceAlertVolume
531531

532532
[UserScopedSetting]
533533
[DebuggerNonUserCode]
534-
[DefaultSettingValue("AlertSounds/LowHealth.wav")]
534+
[DefaultSettingValue("AlertSounds\\LowHealth.wav")]
535535
public string TwintaniaWidgetDeathSentenceAlertFile
536536
{
537537
get { return ((string)(this["TwintaniaWidgetDeathSentenceAlertFile"])); }
@@ -622,7 +622,7 @@ public int TwintaniaWidgetDeathSentenceWarningVolume
622622

623623
[UserScopedSetting]
624624
[DebuggerNonUserCode]
625-
[DefaultSettingValue("AlertSounds/Gasp.wav")]
625+
[DefaultSettingValue("AlertSounds\\Gasp.wav")]
626626
public string TwintaniaWidgetDeathSentenceWarningFile
627627
{
628628
get { return ((string)(this["TwintaniaWidgetDeathSentenceWarningFile"])); }
@@ -661,7 +661,7 @@ public int TwintaniaWidgetTwisterAlertVolume
661661

662662
[UserScopedSetting]
663663
[DebuggerNonUserCode]
664-
[DefaultSettingValue("AlertSounds/aruba.wav")]
664+
[DefaultSettingValue("AlertSounds\\aruba.wav")]
665665
public string TwintaniaWidgetTwisterAlertFile
666666
{
667667
get { return ((string)(this["TwintaniaWidgetTwisterAlertFile"])); }
@@ -752,7 +752,7 @@ public int TwintaniaWidgetTwisterWarningVolume
752752

753753
[UserScopedSetting]
754754
[DebuggerNonUserCode]
755-
[DefaultSettingValue("AlertSounds/sonar.wav")]
755+
[DefaultSettingValue("AlertSounds\\sonar.wav")]
756756
public string TwintaniaWidgetTwisterWarningFile
757757
{
758758
get { return ((string)(this["TwintaniaWidgetTwisterWarningFile"])); }

talis.xivplugin.twintania/ShellViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ public static ShellViewModel Instance
4646
public ShellViewModel()
4747
{
4848
Initializer.LoadSettings();
49-
Initializer.LoadAndCacheSounds();
5049
Initializer.SetupWidgetTopMost();
5150
Settings.Default.PropertyChanged += DefaultOnPropertyChanged;
5251
}
5352

5453
internal static void Loaded(object sender, RoutedEventArgs e)
5554
{
5655
ShellView.View.Loaded -= Loaded;
56+
Initializer.LoadAndCacheSounds();
5757
}
5858

5959
private static void DefaultOnPropertyChanged(object sender, PropertyChangedEventArgs propertyChangedEventArgs)

talis.xivplugin.twintania/Utilities/LogPublisher.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public static void Process(ChatLogEntry chatLogEntry)
7373
{
7474
TwintaniaWidgetViewModel.Instance.TriggerTwister();
7575
}
76-
else if ( (chatLogEntry.Code == "292B" || chatLogEntry.Code == "312B") && Regex.IsMatch(line, @"(?i)^\s*.*\b" + name + @"\b.*\b(" + string.Join("|", deathsentence.Select(Regex.Escape).ToArray()) + @"\b)"))
76+
else if ((chatLogEntry.Code == "292B" || chatLogEntry.Code == "312B" || chatLogEntry.Code == "28AB") && Regex.IsMatch(line, @"(?i)^\s*.*\b" + name + @"\b.*\b(" + string.Join("|", deathsentence.Select(Regex.Escape).ToArray()) + @"\b)"))
7777
{
7878
TwintaniaWidgetViewModel.Instance.TriggerDeathSentence();
7979
}

talis.xivplugin.twintania/ViewModels/SettingsViewModel.cs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,23 @@ namespace talis.xivplugin.twintania.ViewModels
1919
{
2020
internal sealed class SettingsViewModel : INotifyPropertyChanged
2121
{
22+
#region Logger
23+
24+
private static Logger _logger;
25+
26+
private static Logger Logger
27+
{
28+
get
29+
{
30+
if (FFXIVAPP.Common.Constants.EnableNLog)
31+
{
32+
return _logger ?? (_logger = LogManager.GetCurrentClassLogger());
33+
}
34+
return null;
35+
}
36+
}
37+
38+
#endregion
2239

2340
#region Property Bindings
2441

@@ -37,10 +54,14 @@ public static SettingsViewModel Instance
3754
public ICommand LoadDivebombTimersCommand { get; private set; }
3855
public ICommand ResetDivebombTimersCommand { get; private set; }
3956

57+
public ICommand TestDiveBombAlertCommand { get; private set; }
58+
4059
public ICommand SaveEnrageTimersCommand { get; private set; }
4160
public ICommand LoadEnrageTimersCommand { get; private set; }
4261
public ICommand ResetEnrageTimersCommand { get; private set; }
4362

63+
public ICommand TestEnrageAlertCommand { get; private set; }
64+
4465
public ICommand SaveTwisterWarningTimerCommand { get; private set; }
4566
public ICommand LoadTwisterWarningTimerCommand { get; private set; }
4667
public ICommand ResetTwisterWarningTimerCommand { get; private set; }
@@ -72,10 +93,14 @@ public SettingsViewModel()
7293
LoadDivebombTimersCommand = new DelegateCommand(LoadDivebombTimers);
7394
ResetDivebombTimersCommand = new DelegateCommand(ResetDivebombTimers);
7495

96+
TestDiveBombAlertCommand = new DelegateCommand(TestDivebombAlert);
97+
7598
SaveEnrageTimersCommand = new DelegateCommand(SaveEnrageTimers);
7699
LoadEnrageTimersCommand = new DelegateCommand(LoadEnrageTimers);
77100
ResetEnrageTimersCommand = new DelegateCommand(ResetEnrageTimers);
78101

102+
TestEnrageAlertCommand = new DelegateCommand(TestEnrageAlert);
103+
79104
SaveTwisterWarningTimerCommand = new DelegateCommand(SaveTwisterWarningTimer);
80105
LoadTwisterWarningTimerCommand = new DelegateCommand(LoadTwisterWarningTimer);
81106
ResetTwisterWarningTimerCommand = new DelegateCommand(ResetTwisterWarningTimer);
@@ -171,6 +196,11 @@ public void ResetDivebombTimers()
171196
}
172197
}
173198

199+
public void TestDivebombAlert()
200+
{
201+
SoundPlayerHelper.PlayCached(Settings.Default.TwintaniaWidgetDivebombAlertFile, Settings.Default.TwintaniaWidgetDivebombVolume);
202+
}
203+
174204
public void SaveEnrageTimers()
175205
{
176206
double result;
@@ -211,6 +241,11 @@ public void ResetEnrageTimers()
211241
}
212242
}
213243

244+
public void TestEnrageAlert()
245+
{
246+
SoundPlayerHelper.PlayCached(Settings.Default.TwintaniaWidgetEnrageAlertFile, Settings.Default.TwintaniaWidgetEnrageVolume);
247+
}
248+
214249
public void SaveTwisterWarningTimer()
215250
{
216251
double result;

0 commit comments

Comments
 (0)