Skip to content

Commit

Permalink
Lots of bug fixes
Browse files Browse the repository at this point in the history
Fixed Twintania HP being wonky after using Test Mode
Fixed Divebombs starting at 1 instead of at 2
Fixed Enrage Timer not ending
Fixed Twintania & Dread Knight lingering after death
Fixed Test Mode Timer not stopping properly
Improved Twintania Ability Regex to make it more lax ( just in case )
Improved code by removing unnecessary Dreadknight & Twintania Test
Actors
  • Loading branch information
Bio2hazard committed Jan 6, 2014
1 parent 3ab2811 commit a94feb5
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 57 deletions.
18 changes: 10 additions & 8 deletions talis.xivplugin.twintania/EventSubscriber.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,9 @@ private static void OnNewMonsterEntries(object sender, ActorEntitiesEvent actorE
var monsterEntities = actorEntitiesEvent.ActorEntities;

ActorEntity twintania = monsterEntities.SingleOrDefault(monster => (monster.NPCID1 == 4295027 && monster.NPCID2 == 2021));

TwintaniaWidgetViewModel.Instance.TwintaniaEntity = twintania;
if (twintania != null && twintania.IsValid)
if (twintania != null && twintania.IsValid && twintania.HPCurrent > 0)
{
TwintaniaWidgetViewModel.Instance.TwintaniaEntity = twintania;
TwintaniaWidgetViewModel.Instance.TwintaniaIsValid = true;
TwintaniaWidgetViewModel.Instance.TwintaniaHPPercent = (double) twintania.HPPercent;
if(twintania.IsClaimed && !TwintaniaWidgetViewModel.Instance.TwintaniaEngaged)
Expand All @@ -112,8 +111,11 @@ private static void OnNewMonsterEntries(object sender, ActorEntitiesEvent actorE
TwintaniaWidgetViewModel.Instance.TwintaniaEngaged = true;
}
}
else if(TwintaniaWidgetViewModel.Instance.TwintaniaIsValid && !TwintaniaWidgetViewModel.Instance.TestMode)
else if(TwintaniaWidgetViewModel.Instance.TwintaniaIsValid)
{
TwintaniaWidgetViewModel.Instance.DivebombTimerStop();
TwintaniaWidgetViewModel.Instance.EnrageTimerStop();
TwintaniaWidgetViewModel.Instance.TwintaniaEntity = null;
TwintaniaWidgetViewModel.Instance.TwintaniaIsValid = false;
TwintaniaWidgetViewModel.Instance.TwintaniaEngaged = false;
TwintaniaWidgetViewModel.Instance.TwintaniaHPPercent = 0;
Expand All @@ -123,15 +125,15 @@ private static void OnNewMonsterEntries(object sender, ActorEntitiesEvent actorE
}

var dreadknight = monsterEntities.SingleOrDefault(monster => (monster.NPCID1 == 4295031 && monster.NPCID2 == 2026));

TwintaniaWidgetViewModel.Instance.DreadknightEntity = dreadknight;
if (dreadknight != null && dreadknight.IsValid)
if (dreadknight != null && dreadknight.IsValid && dreadknight.HPCurrent > 0)
{
TwintaniaWidgetViewModel.Instance.DreadknightEntity = dreadknight;
TwintaniaWidgetViewModel.Instance.DreadknightIsValid = true;
TwintaniaWidgetViewModel.Instance.DreadknightHPPercent = (double) dreadknight.HPPercent;
}
else if(TwintaniaWidgetViewModel.Instance.DreadknightIsValid && !TwintaniaWidgetViewModel.Instance.TestMode)
else if(TwintaniaWidgetViewModel.Instance.DreadknightIsValid)
{
TwintaniaWidgetViewModel.Instance.DreadknightEntity = null;
TwintaniaWidgetViewModel.Instance.DreadknightIsValid = false;
TwintaniaWidgetViewModel.Instance.DreadknightHPPercent = 0;
}
Expand Down
5 changes: 3 additions & 2 deletions talis.xivplugin.twintania/Utilities/LogPublisher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,11 @@ public static void Process(ChatLogEntry chatLogEntry)
var line = chatLogEntry.Line.Replace(" ", " ");
var name = TwintaniaWidgetViewModel.Instance.TwintaniaEntity.Name;

if(Regex.IsMatch(line ,@"^\s*\b" + name + @"\b.*\b(" + string.Join("|", divebomb.Select(Regex.Escape).ToArray()) + @"\b)"))
if (Regex.IsMatch(line, @"(?i)^\s*.*\b" + name + @"\b.*\b(" + string.Join("|", divebomb.Select(Regex.Escape).ToArray()) + @"\b)"))
{
TwintaniaWidgetViewModel.Instance.TriggerDiveBomb();
} else if(Regex.IsMatch(line ,@"^\s*\b" + name + @"\b.*\b(" + string.Join("|", twister.Select(Regex.Escape).ToArray()) + @"\b)"))
}
else if (Regex.IsMatch(line, @"(?i)^\s*.*\b" + name + @"\b.*\b(" + string.Join("|", twister.Select(Regex.Escape).ToArray()) + @"\b)"))
{
SoundHelper.Play(@"\AlertSounds\aruba.wav", Settings.Default.TwintaniaWidgetTwisterVolume);
//DispatcherHelper.Invoke(() => SoundHelper.Play(@"\AlertSounds\aruba.wav", Settings.Default.TwintaniaWidgetTwisterVolume));
Expand Down
68 changes: 22 additions & 46 deletions talis.xivplugin.twintania/Windows/TwintaniaWidgetViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// TwintaniaWidgetViewModel.cs

using FFXIVAPP.Common.Core.Memory;
using FFXIVAPP.Common.Core.Memory.Enums;
using NLog;
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -41,11 +42,10 @@ private static Logger Logger
private ActorEntity _dreadknightEntity;
private double _dreadknightHPPercent;
private bool _dreadknightIsValid;
private ActorEntity _dreadknightTestActor;
private bool _forceTop;
private bool _testMode;

private int _twintaniaDivebombCount;
private int _twintaniaDivebombCount = 1;
private int _twintaniaDivebombTimeFull;
private double _twintaniaDivebombTimeToNextCur;
private double _twintaniaDivebombTimeToNextMax;
Expand All @@ -58,7 +58,6 @@ private static Logger Logger
private double _twintaniaHPPercent;
private bool _twintaniaIsValid;

private ActorEntity _twintaniaTestActor;
private Queue<Tuple<string, double>> _twintaniaTestList;
private double _twintaniaTestTimeToNextCur;
private double _twintaniaTestTimeToNextMax;
Expand Down Expand Up @@ -99,26 +98,6 @@ public ActorEntity TwintaniaEntity
}
}

public ActorEntity TwintaniaTestActor
{
get { return _twintaniaTestActor ?? (_twintaniaTestActor = new ActorEntity()); }
set
{
_twintaniaTestActor = value;
RaisePropertyChanged();
}
}

public ActorEntity DreadknightTestActor
{
get { return _dreadknightTestActor ?? (_dreadknightTestActor = new ActorEntity()); }
set
{
_dreadknightTestActor = value;
RaisePropertyChanged();
}
}

public bool TwintaniaIsValid
{
get { return _twintaniaIsValid; }
Expand Down Expand Up @@ -260,8 +239,6 @@ public Timer TwintaniaTestTimer
{
TwintaniaTestTimeToNextCur -= 0.1;

TwintaniaEntity = TwintaniaTestActor;

if (TwintaniaTestTimeToNextCur <= 0.00)
{
var next = TwintaniaTestList.Dequeue();
Expand Down Expand Up @@ -372,28 +349,28 @@ public void TestModeStart()

TestMode = true;

TwintaniaTestActor.Name = "Twintania";
TwintaniaTestActor.HPMax = 514596;
TwintaniaTestActor.HPCurrent = 514596;

TwintaniaEntity = TwintaniaTestActor;

TwintaniaIsValid = true;
TwintaniaEntity = new ActorEntity
{
Name = "Twintania",
HPMax = 514596,
HPCurrent = 514596
};
TwintaniaEngaged = true;
TwintaniaIsValid = true;
TwintaniaHPPercent = 1;

EnrageTimerStart();

TwintaniaHPPercent = 1;

TwintaniaDivebombCount = 1;
TwintaniaDivebombTimeToNextCur = 0;
TwintaniaDivebombTimeToNextMax = 0;

DreadknightTestActor.Name = "Dreadknight";
DreadknightTestActor.HPMax = 11250;
DreadknightTestActor.HPCurrent = 11250;

DreadknightEntity = DreadknightTestActor;

DreadknightEntity = new ActorEntity
{
Name = "Dreadknight",
HPMax = 11250,
HPCurrent = 11250
};
DreadknightIsValid = true;
DreadknightHPPercent = 1;

Expand Down Expand Up @@ -422,6 +399,9 @@ public void TestModeStop()
{
return;
}

TwintaniaTestTimer.Stop();

LogHelper.Log(Logger, "Test Mode Stopped", LogLevel.Trace);
ForceTop = false;

Expand All @@ -431,19 +411,15 @@ public void TestModeStop()
TwintaniaTestList.Clear();

TwintaniaEntity = null;
TwintaniaTestActor = null;

TwintaniaIsValid = false;
TwintaniaEngaged = false;

TwintaniaIsValid = false;
TwintaniaHPPercent = 0;

TwintaniaDivebombCount = 1;
TwintaniaDivebombTimeToNextCur = 0;
TwintaniaDivebombTimeToNextMax = 0;

DreadknightEntity = null;
DreadknightTestActor = null;

DreadknightIsValid = false;
DreadknightHPPercent = 0;

Expand Down
1 change: 0 additions & 1 deletion talis.xivplugin.twintania/talis.xivplugin.twintania.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Resource Include="Defaults\Settings.xml" />
<Resource Include="Defaults\Settings.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
Expand Down

0 comments on commit a94feb5

Please sign in to comment.