Display current boss fight
This commit is contained in:
parent
2fe76eb65c
commit
d8f44fb9b2
@ -20,12 +20,19 @@ namespace rabi_splitter_WPF
|
|||||||
public int nDeathsAlt;
|
public int nDeathsAlt;
|
||||||
|
|
||||||
public InGameActivity currentActivity;
|
public InGameActivity currentActivity;
|
||||||
|
public BossFight currentBossFight;
|
||||||
|
public DateTime currentBossStartTime;
|
||||||
|
|
||||||
|
public BossFight lastBossFight;
|
||||||
|
public TimeSpan lastBossFightDuration;
|
||||||
|
|
||||||
public int lastNonZeroPlayTime = -1;
|
public int lastNonZeroPlayTime = -1;
|
||||||
|
|
||||||
public InGameState()
|
public InGameState()
|
||||||
{
|
{
|
||||||
currentActivity = InGameActivity.STARTING;
|
currentActivity = InGameActivity.STARTING;
|
||||||
|
currentBossFight = null;
|
||||||
|
lastBossFight = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CurrentActivityIs(InGameActivity gameActivity)
|
public bool CurrentActivityIs(InGameActivity gameActivity)
|
||||||
@ -38,6 +45,25 @@ namespace rabi_splitter_WPF
|
|||||||
return !CurrentActivityIs(InGameActivity.STARTING);
|
return !CurrentActivityIs(InGameActivity.STARTING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void StartBossFight(BossFight bossFight)
|
||||||
|
{
|
||||||
|
currentActivity = InGameActivity.BOSS_BATTLE;
|
||||||
|
currentBossStartTime = DateTime.Now;
|
||||||
|
currentBossFight = bossFight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StopBossFight()
|
||||||
|
{
|
||||||
|
currentActivity = InGameActivity.WALKING;
|
||||||
|
currentBossFight = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void FinishBossFight()
|
||||||
|
{
|
||||||
|
lastBossFight = currentBossFight;
|
||||||
|
lastBossFightDuration = (DateTime.Now - currentBossStartTime);
|
||||||
|
currentActivity = InGameActivity.WALKING;
|
||||||
|
currentBossFight = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,17 +81,25 @@ namespace rabi_splitter_WPF
|
|||||||
DebugLog("IGT start?");
|
DebugLog("IGT start?");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (MusicChanged())
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Detect Reload
|
||||||
|
|
||||||
|
bool reloading = snapshot.playtime == 0 || ((prevSnapshot != null) && (snapshot.playtime < prevSnapshot.playtime));
|
||||||
|
if (inGameState.IsGameStarted() && snapshot.playtime > 0)
|
||||||
|
{
|
||||||
|
if (snapshot.playtime < inGameState.lastNonZeroPlayTime)
|
||||||
{
|
{
|
||||||
if (StaticData.IsBossMusic(snapshot.musicid))
|
if (InGame())
|
||||||
{
|
{
|
||||||
inGameState.currentActivity = InGameActivity.BOSS_BATTLE;
|
inGameState.nRestarts++;
|
||||||
}
|
UpdateTextFile();
|
||||||
else
|
|
||||||
{
|
|
||||||
inGameState.currentActivity = InGameActivity.WALKING;
|
|
||||||
}
|
}
|
||||||
|
DebugLog("Reload Game! " + snapshot.playtime + " <- " + inGameState.lastNonZeroPlayTime);
|
||||||
}
|
}
|
||||||
|
inGameState.lastNonZeroPlayTime = snapshot.playtime;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -117,8 +125,22 @@ namespace rabi_splitter_WPF
|
|||||||
DebugLog($"Minimap Shift! {prevSnapshot.minimapPosition} -> {snapshot.minimapPosition}");
|
DebugLog($"Minimap Shift! {prevSnapshot.minimapPosition} -> {snapshot.minimapPosition}");
|
||||||
if (snapshot.minimapPosition == 1)
|
if (snapshot.minimapPosition == 1)
|
||||||
{
|
{
|
||||||
DebugLog($"BOSS FIGHT: {BossFightIdentifier.IdentifyBossFight(snapshot).displayName}");
|
var bossFight = BossFightIdentifier.IdentifyBossFight(snapshot);
|
||||||
|
DebugLog($"BOSS FIGHT: {bossFight.displayName}");
|
||||||
DebugLog($"Fighting Bosses: {string.Join(", ", snapshot.bossList.Select(boss => StaticData.GetBossName(boss.id)))}");
|
DebugLog($"Fighting Bosses: {string.Join(", ", snapshot.bossList.Select(boss => StaticData.GetBossName(boss.id)))}");
|
||||||
|
|
||||||
|
inGameState.StartBossFight(bossFight);
|
||||||
|
}
|
||||||
|
else // snapshot.minimapPosition == 0
|
||||||
|
{
|
||||||
|
if (reloading)
|
||||||
|
{
|
||||||
|
inGameState.StopBossFight();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
inGameState.FinishBossFight();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,25 +166,6 @@ namespace rabi_splitter_WPF
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Detect Reload
|
|
||||||
|
|
||||||
bool reloading = snapshot.playtime == 0 || ((prevSnapshot != null) && (snapshot.playtime < prevSnapshot.playtime));
|
|
||||||
if (inGameState.IsGameStarted() && snapshot.playtime > 0)
|
|
||||||
{
|
|
||||||
if (snapshot.playtime < inGameState.lastNonZeroPlayTime)
|
|
||||||
{
|
|
||||||
if (InGame())
|
|
||||||
{
|
|
||||||
inGameState.nRestarts++;
|
|
||||||
UpdateTextFile();
|
|
||||||
}
|
|
||||||
DebugLog("Reload Game! " + snapshot.playtime + " <- " + inGameState.lastNonZeroPlayTime);
|
|
||||||
}
|
|
||||||
inGameState.lastNonZeroPlayTime = snapshot.playtime;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Detect Death
|
#region Detect Death
|
||||||
|
|
||||||
if (prevSnapshot != null)
|
if (prevSnapshot != null)
|
||||||
@ -237,6 +240,29 @@ namespace rabi_splitter_WPF
|
|||||||
|
|
||||||
mainContext.Text15 = $"Map Tile: ({snapshot.mapTile.x}, {snapshot.mapTile.y})";
|
mainContext.Text15 = $"Map Tile: ({snapshot.mapTile.x}, {snapshot.mapTile.y})";
|
||||||
|
|
||||||
|
{
|
||||||
|
if (inGameState.CurrentActivityIs(InGameActivity.BOSS_BATTLE))
|
||||||
|
{
|
||||||
|
var time = DateTime.Now - inGameState.currentBossStartTime;
|
||||||
|
mainContext.Text16 = $"Boss: {inGameState.currentBossFight.displayName}\n" +
|
||||||
|
$"Time: {time:mm\\:ss\\.ff}";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mainContext.Text16 = "Not in boss fight";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (inGameState.lastBossFight != null)
|
||||||
|
{
|
||||||
|
mainContext.Text17 = $"Last Boss: {inGameState.lastBossFight.displayName}\n" +
|
||||||
|
$"Time: {inGameState.lastBossFightDuration:mm\\:ss\\.ff}";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mainContext.Text17 = "Last Boss: None";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
string bosstext = "Boss Fight: " + (inGameState.currentActivity == InGameActivity.BOSS_BATTLE) + "\n";
|
string bosstext = "Boss Fight: " + (inGameState.currentActivity == InGameActivity.BOSS_BATTLE) + "\n";
|
||||||
bosstext += "Bosses: " + snapshot.bossList.Count + "\n";
|
bosstext += "Bosses: " + snapshot.bossList.Count + "\n";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user