Skip to content

Commit

Permalink
Death Sentence Tank Fix & Sound Selection
Browse files Browse the repository at this point in the history
Fixed Death Sentence for tanks, added sound file selectors, added sound
test for divebomb & enrage alerts.
  • Loading branch information
Bio2hazard committed Jan 29, 2014
1 parent 91110c8 commit 79d3f3c
Show file tree
Hide file tree
Showing 7 changed files with 213 additions and 84 deletions.
6 changes: 4 additions & 2 deletions talis.xivplugin.twintania/Initializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static void LoadSettings()

public static void LoadAndCacheSounds()
{
PluginViewModel.Instance.SoundFiles.Clear();
//PluginViewModel.Instance.SoundFiles.Clear();
//do your gui stuff here
var legacyFiles = new List<FileInfo>();
var filters = new List<string>
Expand Down Expand Up @@ -91,7 +91,9 @@ public static void LoadAndCacheSounds()
{
}
}
foreach (var cachedSoundFile in SoundPlayerHelper.SoundFileKeys())

var cachedSoundFiles = SoundPlayerHelper.SoundFileKeys().Except(PluginViewModel.Instance.SoundFiles);
foreach (var cachedSoundFile in cachedSoundFiles)
{
PluginViewModel.Instance.SoundFiles.Add(cachedSoundFile);
}
Expand Down
24 changes: 12 additions & 12 deletions talis.xivplugin.twintania/Properties/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,37 +76,37 @@ private void DefaultSettings()
Constants.Settings.Add("TwintaniaWidgetEnrageTime");
Constants.Settings.Add("TwintaniaWidgetEnrageCounting");
Constants.Settings.Add("TwintaniaWidgetEnrageVolume");
//Constants.Settings.Add("TwintaniaWidgetEnrageAlertFile");
Constants.Settings.Add("TwintaniaWidgetEnrageAlertFile");

Constants.Settings.Add("TwintaniaWidgetDivebombTimeFast");
Constants.Settings.Add("TwintaniaWidgetDivebombTimeSlow");
Constants.Settings.Add("TwintaniaWidgetDivebombCounting");
Constants.Settings.Add("TwintaniaWidgetDivebombVolume");
//Constants.Settings.Add("TwintaniaWidgetDivebombAlertFile");
Constants.Settings.Add("TwintaniaWidgetDivebombAlertFile");

Constants.Settings.Add("TwintaniaWidgetDeathSentenceAlertPlaySound");
Constants.Settings.Add("TwintaniaWidgetDeathSentenceAlertVolume");
//Constants.Settings.Add("TwintaniaWidgetDeathSentenceAlertFile");
Constants.Settings.Add("TwintaniaWidgetDeathSentenceAlertFile");

Constants.Settings.Add("TwintaniaWidgetDeathSentenceWarningEnabled");
Constants.Settings.Add("TwintaniaWidgetDeathSentenceWarningShowTimer");
Constants.Settings.Add("TwintaniaWidgetDeathSentenceWarningTime");
Constants.Settings.Add("TwintaniaWidgetDeathSentenceWarningPlaySound");
Constants.Settings.Add("TwintaniaWidgetDeathSentenceWarningCounting");
Constants.Settings.Add("TwintaniaWidgetDeathSentenceWarningVolume");
//Constants.Settings.Add("TwintaniaWidgetDeathSentenceWarningFile");
Constants.Settings.Add("TwintaniaWidgetDeathSentenceWarningFile");

Constants.Settings.Add("TwintaniaWidgetTwisterAlertPlaySound");
Constants.Settings.Add("TwintaniaWidgetTwisterAlertVolume");
//Constants.Settings.Add("TwintaniaWidgetTwisterAlertFile");
Constants.Settings.Add("TwintaniaWidgetTwisterAlertFile");

Constants.Settings.Add("TwintaniaWidgetTwisterWarningEnabled");
Constants.Settings.Add("TwintaniaWidgetTwisterWarningShowTimer");
Constants.Settings.Add("TwintaniaWidgetTwisterWarningTime");
Constants.Settings.Add("TwintaniaWidgetTwisterWarningPlaySound");
Constants.Settings.Add("TwintaniaWidgetTwisterWarningCounting");
Constants.Settings.Add("TwintaniaWidgetTwisterWarningVolume");
//Constants.Settings.Add("TwintaniaWidgetTwisterWarningFile");
Constants.Settings.Add("TwintaniaWidgetTwisterWarningFile");
}

public new void Reset()
Expand Down Expand Up @@ -426,7 +426,7 @@ public int TwintaniaWidgetEnrageVolume

[UserScopedSetting]
[DebuggerNonUserCode]
[DefaultSettingValue("AlertSounds/LowHealth.wav")]
[DefaultSettingValue("AlertSounds\\LowHealth.wav")]
public string TwintaniaWidgetEnrageAlertFile
{
get { return ((string)(this["TwintaniaWidgetEnrageAlertFile"])); }
Expand Down Expand Up @@ -491,7 +491,7 @@ public int TwintaniaWidgetDivebombVolume

[UserScopedSetting]
[DebuggerNonUserCode]
[DefaultSettingValue("AlertSounds/LowHealth.wav")]
[DefaultSettingValue("AlertSounds\\LowHealth.wav")]
public string TwintaniaWidgetDivebombAlertFile
{
get { return ((string) (this["TwintaniaWidgetDivebombAlertFile"])); }
Expand Down Expand Up @@ -531,7 +531,7 @@ public int TwintaniaWidgetDeathSentenceAlertVolume

[UserScopedSetting]
[DebuggerNonUserCode]
[DefaultSettingValue("AlertSounds/LowHealth.wav")]
[DefaultSettingValue("AlertSounds\\LowHealth.wav")]
public string TwintaniaWidgetDeathSentenceAlertFile
{
get { return ((string)(this["TwintaniaWidgetDeathSentenceAlertFile"])); }
Expand Down Expand Up @@ -622,7 +622,7 @@ public int TwintaniaWidgetDeathSentenceWarningVolume

[UserScopedSetting]
[DebuggerNonUserCode]
[DefaultSettingValue("AlertSounds/Gasp.wav")]
[DefaultSettingValue("AlertSounds\\Gasp.wav")]
public string TwintaniaWidgetDeathSentenceWarningFile
{
get { return ((string)(this["TwintaniaWidgetDeathSentenceWarningFile"])); }
Expand Down Expand Up @@ -661,7 +661,7 @@ public int TwintaniaWidgetTwisterAlertVolume

[UserScopedSetting]
[DebuggerNonUserCode]
[DefaultSettingValue("AlertSounds/aruba.wav")]
[DefaultSettingValue("AlertSounds\\aruba.wav")]
public string TwintaniaWidgetTwisterAlertFile
{
get { return ((string)(this["TwintaniaWidgetTwisterAlertFile"])); }
Expand Down Expand Up @@ -752,7 +752,7 @@ public int TwintaniaWidgetTwisterWarningVolume

[UserScopedSetting]
[DebuggerNonUserCode]
[DefaultSettingValue("AlertSounds/sonar.wav")]
[DefaultSettingValue("AlertSounds\\sonar.wav")]
public string TwintaniaWidgetTwisterWarningFile
{
get { return ((string)(this["TwintaniaWidgetTwisterWarningFile"])); }
Expand Down
2 changes: 1 addition & 1 deletion talis.xivplugin.twintania/ShellViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ public static ShellViewModel Instance
public ShellViewModel()
{
Initializer.LoadSettings();
Initializer.LoadAndCacheSounds();
Initializer.SetupWidgetTopMost();
Settings.Default.PropertyChanged += DefaultOnPropertyChanged;
}

internal static void Loaded(object sender, RoutedEventArgs e)
{
ShellView.View.Loaded -= Loaded;
Initializer.LoadAndCacheSounds();
}

private static void DefaultOnPropertyChanged(object sender, PropertyChangedEventArgs propertyChangedEventArgs)
Expand Down
2 changes: 1 addition & 1 deletion talis.xivplugin.twintania/Utilities/LogPublisher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public static void Process(ChatLogEntry chatLogEntry)
{
TwintaniaWidgetViewModel.Instance.TriggerTwister();
}
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)"))
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)"))
{
TwintaniaWidgetViewModel.Instance.TriggerDeathSentence();
}
Expand Down
35 changes: 35 additions & 0 deletions talis.xivplugin.twintania/ViewModels/SettingsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,23 @@ namespace talis.xivplugin.twintania.ViewModels
{
internal sealed class SettingsViewModel : INotifyPropertyChanged
{
#region Logger

private static Logger _logger;

private static Logger Logger
{
get
{
if (FFXIVAPP.Common.Constants.EnableNLog)
{
return _logger ?? (_logger = LogManager.GetCurrentClassLogger());
}
return null;
}
}

#endregion

#region Property Bindings

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

public ICommand TestDiveBombAlertCommand { get; private set; }

public ICommand SaveEnrageTimersCommand { get; private set; }
public ICommand LoadEnrageTimersCommand { get; private set; }
public ICommand ResetEnrageTimersCommand { get; private set; }

public ICommand TestEnrageAlertCommand { get; private set; }

public ICommand SaveTwisterWarningTimerCommand { get; private set; }
public ICommand LoadTwisterWarningTimerCommand { get; private set; }
public ICommand ResetTwisterWarningTimerCommand { get; private set; }
Expand Down Expand Up @@ -72,10 +93,14 @@ public SettingsViewModel()
LoadDivebombTimersCommand = new DelegateCommand(LoadDivebombTimers);
ResetDivebombTimersCommand = new DelegateCommand(ResetDivebombTimers);

TestDiveBombAlertCommand = new DelegateCommand(TestDivebombAlert);

SaveEnrageTimersCommand = new DelegateCommand(SaveEnrageTimers);
LoadEnrageTimersCommand = new DelegateCommand(LoadEnrageTimers);
ResetEnrageTimersCommand = new DelegateCommand(ResetEnrageTimers);

TestEnrageAlertCommand = new DelegateCommand(TestEnrageAlert);

SaveTwisterWarningTimerCommand = new DelegateCommand(SaveTwisterWarningTimer);
LoadTwisterWarningTimerCommand = new DelegateCommand(LoadTwisterWarningTimer);
ResetTwisterWarningTimerCommand = new DelegateCommand(ResetTwisterWarningTimer);
Expand Down Expand Up @@ -171,6 +196,11 @@ public void ResetDivebombTimers()
}
}

public void TestDivebombAlert()
{
SoundPlayerHelper.PlayCached(Settings.Default.TwintaniaWidgetDivebombAlertFile, Settings.Default.TwintaniaWidgetDivebombVolume);
}

public void SaveEnrageTimers()
{
double result;
Expand Down Expand Up @@ -211,6 +241,11 @@ public void ResetEnrageTimers()
}
}

public void TestEnrageAlert()
{
SoundPlayerHelper.PlayCached(Settings.Default.TwintaniaWidgetEnrageAlertFile, Settings.Default.TwintaniaWidgetEnrageVolume);
}

public void SaveTwisterWarningTimer()
{
double result;
Expand Down
Loading

0 comments on commit 79d3f3c

Please sign in to comment.