From 420f7e6e5c6de4c354a2bf3facf14c3261f7dd6e Mon Sep 17 00:00:00 2001 From: easly1989 Date: Wed, 20 Nov 2019 08:38:23 +0100 Subject: [PATCH] Fix packet code handling --- DFAssist.Core/Network/FFXIVPacketHandler.cs | 19 ++++++++----------- SharedAssemblyInfo.cs | 4 ++-- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/DFAssist.Core/Network/FFXIVPacketHandler.cs b/DFAssist.Core/Network/FFXIVPacketHandler.cs index 73a4f91..a46be1a 100644 --- a/DFAssist.Core/Network/FFXIVPacketHandler.cs +++ b/DFAssist.Core/Network/FFXIVPacketHandler.cs @@ -14,8 +14,6 @@ public class FFXIVPacketHandler : IPacketHandler private readonly ILogger _logger; private readonly IDataRepository _dataRepository; - private byte _rouletteCode; - public FFXIVPacketHandler() { _logger = Locator.Current.GetService(); @@ -50,15 +48,14 @@ public void HandleMessage(byte[] message, Action fireEvent) var data = message.Skip(32).ToArray(); if (opcode == 0x0164) // 5.11 Duties { - _rouletteCode = data[8]; + var rouletteCode = data[8]; - if (_rouletteCode != 0 && (data[15] == 0 || data[15] == 64)) // Roulette, on Korean Server || on Global Server + if (rouletteCode != 0 && (data[15] == 0 || data[15] == 64)) // Roulette, on Korean Server || on Global Server { - _logger.Write($"Q: Duty Roulette Matching Started [{_rouletteCode}] - {_dataRepository.GetRoulette(_rouletteCode).Name}", LogLevel.Debug); + _logger.Write($"Q: Duty Roulette Matching Started [{rouletteCode}] - {_dataRepository.GetRoulette(rouletteCode).Name}", LogLevel.Debug); } else // Specific Duty (Dungeon/Trial/Raid) { - _rouletteCode = 0; _logger.Write("Q: Matching started for duties: ", LogLevel.Debug); for (var i = 0; i < 5; i++) { @@ -102,7 +99,7 @@ public void HandleMessage(byte[] message, Action fireEvent) var healerMax = data[11]; var dps = data[12]; var dpsMax = data[13]; - + var memberinfo = $"Tanks: {tank}/{tankMax}, Healers: {healer}/{healerMax}, Dps: {dps}/{dpsMax}"; _logger.Write($"Q: Matching State Updated [{memberinfo}] - WaitList: {waitList} | WaitTime: {waitTime}", LogLevel.Debug); } @@ -113,7 +110,7 @@ public void HandleMessage(byte[] message, Action fireEvent) var healer = data[14]; var healerMax = data[15]; var dps = data[16]; - var dpsMax = data[15]; + var dpsMax = data[17]; var memberinfo = $"Tanks: {tank}/{tankMax}, Healers: {healer}/{healerMax}, Dps: {dps}/{dpsMax}"; var code = BitConverter.ToUInt16(data, 8); @@ -124,19 +121,19 @@ public void HandleMessage(byte[] message, Action fireEvent) else if (opcode == 0x0339) // 5.11 Entering/Leaving an Instance (Zone change?) { var code = BitConverter.ToInt16(data, 4); - var instanceName = code == 0 ? "Unknown Instance" : _dataRepository.GetInstance(code).Name; switch (data[8]) { case 0x0B: // Entering + var instanceName = code == 0 ? "Unknown Instance" : _dataRepository.GetInstance(code).Name; _logger.Write($"I: Entered Instance Area [{code}] - {instanceName}", LogLevel.Debug); break; case 0x0C: // Leaving - _logger.Write($"I: Left Instance Area [{code}] - {instanceName}", LogLevel.Debug); + _logger.Write($"I: Left Instance Area [{code}]", LogLevel.Debug); break; } } - else if(opcode == 0x0002) // 5.11 Duty Matching Complete + else if (opcode == 0x0002) // 5.11 Duty Matching Complete { _logger.Write("Q: Matching Completed!", LogLevel.Debug); } diff --git a/SharedAssemblyInfo.cs b/SharedAssemblyInfo.cs index 0406861..5e82d1a 100644 --- a/SharedAssemblyInfo.cs +++ b/SharedAssemblyInfo.cs @@ -35,12 +35,12 @@ // to distinguish one build from another. AssemblyFileVersion is specified // in AssemblyVersionInfo.cs so that it can be easily incremented by the // automated build process. -[assembly: AssemblyVersion("2.2.4")] +[assembly: AssemblyVersion("2.2.5")] // By default, the "Product version" shown in the file properties window is // the same as the value specified for AssemblyFileVersionAttribute. // Set AssemblyInformationalVersionAttribute to be the same as // AssemblyVersionAttribute so that the "Product version" in the file // properties window matches the version displayed in the GAC shell extension. -[assembly: AssemblyInformationalVersion("2.2.4")] // a.k.a. "Product version" +[assembly: AssemblyInformationalVersion("2.2.5")] // a.k.a. "Product version"