Skip to content

Commit a94feb5

Browse files
committed
Lots of bug fixes
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
1 parent 3ab2811 commit a94feb5

File tree

4 files changed

+35
-57
lines changed

4 files changed

+35
-57
lines changed

talis.xivplugin.twintania/EventSubscriber.cs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,9 @@ private static void OnNewMonsterEntries(object sender, ActorEntitiesEvent actorE
100100
var monsterEntities = actorEntitiesEvent.ActorEntities;
101101

102102
ActorEntity twintania = monsterEntities.SingleOrDefault(monster => (monster.NPCID1 == 4295027 && monster.NPCID2 == 2021));
103-
104-
TwintaniaWidgetViewModel.Instance.TwintaniaEntity = twintania;
105-
if (twintania != null && twintania.IsValid)
103+
if (twintania != null && twintania.IsValid && twintania.HPCurrent > 0)
106104
{
105+
TwintaniaWidgetViewModel.Instance.TwintaniaEntity = twintania;
107106
TwintaniaWidgetViewModel.Instance.TwintaniaIsValid = true;
108107
TwintaniaWidgetViewModel.Instance.TwintaniaHPPercent = (double) twintania.HPPercent;
109108
if(twintania.IsClaimed && !TwintaniaWidgetViewModel.Instance.TwintaniaEngaged)
@@ -112,8 +111,11 @@ private static void OnNewMonsterEntries(object sender, ActorEntitiesEvent actorE
112111
TwintaniaWidgetViewModel.Instance.TwintaniaEngaged = true;
113112
}
114113
}
115-
else if(TwintaniaWidgetViewModel.Instance.TwintaniaIsValid && !TwintaniaWidgetViewModel.Instance.TestMode)
114+
else if(TwintaniaWidgetViewModel.Instance.TwintaniaIsValid)
116115
{
116+
TwintaniaWidgetViewModel.Instance.DivebombTimerStop();
117+
TwintaniaWidgetViewModel.Instance.EnrageTimerStop();
118+
TwintaniaWidgetViewModel.Instance.TwintaniaEntity = null;
117119
TwintaniaWidgetViewModel.Instance.TwintaniaIsValid = false;
118120
TwintaniaWidgetViewModel.Instance.TwintaniaEngaged = false;
119121
TwintaniaWidgetViewModel.Instance.TwintaniaHPPercent = 0;
@@ -123,15 +125,15 @@ private static void OnNewMonsterEntries(object sender, ActorEntitiesEvent actorE
123125
}
124126

125127
var dreadknight = monsterEntities.SingleOrDefault(monster => (monster.NPCID1 == 4295031 && monster.NPCID2 == 2026));
126-
127-
TwintaniaWidgetViewModel.Instance.DreadknightEntity = dreadknight;
128-
if (dreadknight != null && dreadknight.IsValid)
128+
if (dreadknight != null && dreadknight.IsValid && dreadknight.HPCurrent > 0)
129129
{
130+
TwintaniaWidgetViewModel.Instance.DreadknightEntity = dreadknight;
130131
TwintaniaWidgetViewModel.Instance.DreadknightIsValid = true;
131132
TwintaniaWidgetViewModel.Instance.DreadknightHPPercent = (double) dreadknight.HPPercent;
132133
}
133-
else if(TwintaniaWidgetViewModel.Instance.DreadknightIsValid && !TwintaniaWidgetViewModel.Instance.TestMode)
134+
else if(TwintaniaWidgetViewModel.Instance.DreadknightIsValid)
134135
{
136+
TwintaniaWidgetViewModel.Instance.DreadknightEntity = null;
135137
TwintaniaWidgetViewModel.Instance.DreadknightIsValid = false;
136138
TwintaniaWidgetViewModel.Instance.DreadknightHPPercent = 0;
137139
}

talis.xivplugin.twintania/Utilities/LogPublisher.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,11 @@ public static void Process(ChatLogEntry chatLogEntry)
5656
var line = chatLogEntry.Line.Replace(" ", " ");
5757
var name = TwintaniaWidgetViewModel.Instance.TwintaniaEntity.Name;
5858

59-
if(Regex.IsMatch(line ,@"^\s*\b" + name + @"\b.*\b(" + string.Join("|", divebomb.Select(Regex.Escape).ToArray()) + @"\b)"))
59+
if (Regex.IsMatch(line, @"(?i)^\s*.*\b" + name + @"\b.*\b(" + string.Join("|", divebomb.Select(Regex.Escape).ToArray()) + @"\b)"))
6060
{
6161
TwintaniaWidgetViewModel.Instance.TriggerDiveBomb();
62-
} else if(Regex.IsMatch(line ,@"^\s*\b" + name + @"\b.*\b(" + string.Join("|", twister.Select(Regex.Escape).ToArray()) + @"\b)"))
62+
}
63+
else if (Regex.IsMatch(line, @"(?i)^\s*.*\b" + name + @"\b.*\b(" + string.Join("|", twister.Select(Regex.Escape).ToArray()) + @"\b)"))
6364
{
6465
SoundHelper.Play(@"\AlertSounds\aruba.wav", Settings.Default.TwintaniaWidgetTwisterVolume);
6566
//DispatcherHelper.Invoke(() => SoundHelper.Play(@"\AlertSounds\aruba.wav", Settings.Default.TwintaniaWidgetTwisterVolume));

talis.xivplugin.twintania/Windows/TwintaniaWidgetViewModel.cs

Lines changed: 22 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// TwintaniaWidgetViewModel.cs
33

44
using FFXIVAPP.Common.Core.Memory;
5+
using FFXIVAPP.Common.Core.Memory.Enums;
56
using NLog;
67
using System;
78
using System.Collections.Generic;
@@ -41,11 +42,10 @@ private static Logger Logger
4142
private ActorEntity _dreadknightEntity;
4243
private double _dreadknightHPPercent;
4344
private bool _dreadknightIsValid;
44-
private ActorEntity _dreadknightTestActor;
4545
private bool _forceTop;
4646
private bool _testMode;
4747

48-
private int _twintaniaDivebombCount;
48+
private int _twintaniaDivebombCount = 1;
4949
private int _twintaniaDivebombTimeFull;
5050
private double _twintaniaDivebombTimeToNextCur;
5151
private double _twintaniaDivebombTimeToNextMax;
@@ -58,7 +58,6 @@ private static Logger Logger
5858
private double _twintaniaHPPercent;
5959
private bool _twintaniaIsValid;
6060

61-
private ActorEntity _twintaniaTestActor;
6261
private Queue<Tuple<string, double>> _twintaniaTestList;
6362
private double _twintaniaTestTimeToNextCur;
6463
private double _twintaniaTestTimeToNextMax;
@@ -99,26 +98,6 @@ public ActorEntity TwintaniaEntity
9998
}
10099
}
101100

102-
public ActorEntity TwintaniaTestActor
103-
{
104-
get { return _twintaniaTestActor ?? (_twintaniaTestActor = new ActorEntity()); }
105-
set
106-
{
107-
_twintaniaTestActor = value;
108-
RaisePropertyChanged();
109-
}
110-
}
111-
112-
public ActorEntity DreadknightTestActor
113-
{
114-
get { return _dreadknightTestActor ?? (_dreadknightTestActor = new ActorEntity()); }
115-
set
116-
{
117-
_dreadknightTestActor = value;
118-
RaisePropertyChanged();
119-
}
120-
}
121-
122101
public bool TwintaniaIsValid
123102
{
124103
get { return _twintaniaIsValid; }
@@ -260,8 +239,6 @@ public Timer TwintaniaTestTimer
260239
{
261240
TwintaniaTestTimeToNextCur -= 0.1;
262241

263-
TwintaniaEntity = TwintaniaTestActor;
264-
265242
if (TwintaniaTestTimeToNextCur <= 0.00)
266243
{
267244
var next = TwintaniaTestList.Dequeue();
@@ -372,28 +349,28 @@ public void TestModeStart()
372349

373350
TestMode = true;
374351

375-
TwintaniaTestActor.Name = "Twintania";
376-
TwintaniaTestActor.HPMax = 514596;
377-
TwintaniaTestActor.HPCurrent = 514596;
378-
379-
TwintaniaEntity = TwintaniaTestActor;
380-
381-
TwintaniaIsValid = true;
352+
TwintaniaEntity = new ActorEntity
353+
{
354+
Name = "Twintania",
355+
HPMax = 514596,
356+
HPCurrent = 514596
357+
};
382358
TwintaniaEngaged = true;
359+
TwintaniaIsValid = true;
360+
TwintaniaHPPercent = 1;
383361

384362
EnrageTimerStart();
385-
386-
TwintaniaHPPercent = 1;
363+
387364
TwintaniaDivebombCount = 1;
388365
TwintaniaDivebombTimeToNextCur = 0;
389366
TwintaniaDivebombTimeToNextMax = 0;
390367

391-
DreadknightTestActor.Name = "Dreadknight";
392-
DreadknightTestActor.HPMax = 11250;
393-
DreadknightTestActor.HPCurrent = 11250;
394-
395-
DreadknightEntity = DreadknightTestActor;
396-
368+
DreadknightEntity = new ActorEntity
369+
{
370+
Name = "Dreadknight",
371+
HPMax = 11250,
372+
HPCurrent = 11250
373+
};
397374
DreadknightIsValid = true;
398375
DreadknightHPPercent = 1;
399376

@@ -422,6 +399,9 @@ public void TestModeStop()
422399
{
423400
return;
424401
}
402+
403+
TwintaniaTestTimer.Stop();
404+
425405
LogHelper.Log(Logger, "Test Mode Stopped", LogLevel.Trace);
426406
ForceTop = false;
427407

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

433413
TwintaniaEntity = null;
434-
TwintaniaTestActor = null;
435-
436-
TwintaniaIsValid = false;
437414
TwintaniaEngaged = false;
438-
415+
TwintaniaIsValid = false;
439416
TwintaniaHPPercent = 0;
417+
440418
TwintaniaDivebombCount = 1;
441419
TwintaniaDivebombTimeToNextCur = 0;
442420
TwintaniaDivebombTimeToNextMax = 0;
443421

444422
DreadknightEntity = null;
445-
DreadknightTestActor = null;
446-
447423
DreadknightIsValid = false;
448424
DreadknightHPPercent = 0;
449425

talis.xivplugin.twintania/talis.xivplugin.twintania.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@
137137
<SubType>Designer</SubType>
138138
<Generator>MSBuild:Compile</Generator>
139139
</Page>
140-
<Resource Include="Defaults\Settings.xml" />
141140
<Resource Include="Defaults\Settings.xml">
142141
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
143142
</Resource>

0 commit comments

Comments
 (0)