-
-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
129 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/StatisticsAnalysisTool/Network/Events/PartyJoinedEvent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using StatisticsAnalysisTool.Common; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Reflection; | ||
|
||
namespace StatisticsAnalysisTool.Network.Events; | ||
|
||
public class PartyJoinedEvent | ||
{ | ||
public Guid UserGuid { get; private set; } = Guid.Empty; | ||
public string Username { get; private set; } = string.Empty; | ||
public string GuildName { get; private set; } = string.Empty; | ||
|
||
public PartyJoinedEvent(Dictionary<byte, object> parameters) | ||
{ | ||
ConsoleManager.WriteLineForNetworkHandler(GetType().Name, parameters); | ||
|
||
try | ||
{ | ||
if (parameters.TryGetValue(1, out object userGuid) && userGuid is Guid) | ||
{ | ||
UserGuid = userGuid.ObjectToGuid() ?? Guid.Empty; | ||
} | ||
|
||
if (parameters.TryGetValue(1, out object username) && username is string usernameString && !string.IsNullOrEmpty(usernameString)) | ||
{ | ||
Username = usernameString; | ||
} | ||
|
||
if (parameters.TryGetValue(5, out object guildName) && guildName is string guildNameString && !string.IsNullOrEmpty(guildNameString)) | ||
{ | ||
GuildName = guildNameString; | ||
} | ||
} | ||
catch (Exception e) | ||
{ | ||
ConsoleManager.WriteLineForError(MethodBase.GetCurrentMethod()?.DeclaringType, e); | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/StatisticsAnalysisTool/Network/Handler/PartyJoinedEventHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using StatisticsAnalysisTool.Enumerations; | ||
using StatisticsAnalysisTool.Network.Events; | ||
using StatisticsAnalysisTool.Network.Manager; | ||
using System.Threading.Tasks; | ||
|
||
namespace StatisticsAnalysisTool.Network.Handler; | ||
|
||
public class PartyJoinedEventHandler : EventPacketHandler<PartyJoinedEvent> | ||
{ | ||
private readonly TrackingController _trackingController; | ||
|
||
public PartyJoinedEventHandler(TrackingController trackingController) : base((int) EventCodes.PartyJoined) | ||
{ | ||
_trackingController = trackingController; | ||
} | ||
|
||
protected override async Task OnActionAsync(PartyJoinedEvent value) | ||
{ | ||
_trackingController.EntityController.AddEntity(null, value.UserGuid, null, value.Username, value.GuildName, null, null, GameObjectType.Player, GameObjectSubType.LocalPlayer); | ||
await _trackingController.EntityController.AddToPartyAsync(value.UserGuid); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters