Skip to content

Commit

Permalink
Fix packet code handling
Browse files Browse the repository at this point in the history
  • Loading branch information
easly1989 committed Nov 20, 2019
1 parent dddef2d commit 420f7e6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
19 changes: 8 additions & 11 deletions DFAssist.Core/Network/FFXIVPacketHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<ILogger>();
Expand Down Expand Up @@ -50,15 +48,14 @@ public void HandleMessage(byte[] message, Action<EventType, int[]> 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++)
{
Expand Down Expand Up @@ -102,7 +99,7 @@ public void HandleMessage(byte[] message, Action<EventType, int[]> 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);
}
Expand All @@ -113,7 +110,7 @@ public void HandleMessage(byte[] message, Action<EventType, int[]> 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);
Expand All @@ -124,19 +121,19 @@ public void HandleMessage(byte[] message, Action<EventType, int[]> 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);
}
Expand Down
4 changes: 2 additions & 2 deletions SharedAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit 420f7e6

Please sign in to comment.