-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- All packets implemented - Client-side arena block timer implemented - SFX names added - Unknown chat icon name added - Missing resource IDs added
- Loading branch information
1 parent
23d6661
commit 739ecf0
Showing
13 changed files
with
446 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using AutomaticTypeMapper; | ||
|
||
namespace EOLib.Domain.Notifiers | ||
{ | ||
public interface IArenaNotifier | ||
{ | ||
void NotifyArenaBusy(); | ||
|
||
void NotifyArenaStart(int players); | ||
|
||
void NotifyArenaKill(int killCount, string killer, string victim); | ||
|
||
void NotifyArenaWin(string winner); | ||
} | ||
|
||
[AutoMappedType] | ||
public class NoOpArenaNotifer : IArenaNotifier | ||
{ | ||
public void NotifyArenaBusy() { } | ||
|
||
public void NotifyArenaStart(int players) { } | ||
|
||
public void NotifyArenaKill(int killCount, string killer, string victim) { } | ||
|
||
public void NotifyArenaWin(string winner) { } | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using AutomaticTypeMapper; | ||
using EOLib.Domain.Login; | ||
using EOLib.Domain.Notifiers; | ||
using EOLib.Net; | ||
using EOLib.Net.Handlers; | ||
using System.Collections.Generic; | ||
|
||
namespace EOLib.PacketHandlers.Arena | ||
{ | ||
/// <summary> | ||
/// Arena win message | ||
/// </summary> | ||
[AutoMappedType] | ||
public class ArenaAcceptHandler : InGameOnlyPacketHandler | ||
{ | ||
private readonly IEnumerable<IArenaNotifier> _arenaNotifiers; | ||
|
||
public override PacketFamily Family => PacketFamily.Arena; | ||
|
||
public override PacketAction Action => PacketAction.Accept; | ||
|
||
public ArenaAcceptHandler(IPlayerInfoProvider playerInfoProvider, | ||
IEnumerable<IArenaNotifier> arenaNotifiers) | ||
: base(playerInfoProvider) | ||
{ | ||
_arenaNotifiers = arenaNotifiers; | ||
} | ||
|
||
public override bool HandlePacket(IPacket packet) | ||
{ | ||
var winnerName = packet.ReadBreakString(); | ||
|
||
var killsCount = packet.ReadInt(); | ||
packet.ReadByte(); | ||
|
||
var killerName = packet.ReadBreakString(); | ||
var victimName = packet.ReadBreakString(); | ||
|
||
foreach (var notifier in _arenaNotifiers) | ||
{ | ||
notifier.NotifyArenaKill(killsCount, killerName, victimName); | ||
notifier.NotifyArenaWin(winnerName); | ||
} | ||
|
||
return true; | ||
} | ||
} | ||
} |
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,42 @@ | ||
using AutomaticTypeMapper; | ||
using EOLib.Domain.Login; | ||
using EOLib.Domain.Notifiers; | ||
using EOLib.Net; | ||
using EOLib.Net.Handlers; | ||
using System.Collections.Generic; | ||
|
||
namespace EOLib.PacketHandlers.Arena | ||
{ | ||
/// <summary> | ||
/// "Arena is blocked" message | ||
/// </summary> | ||
[AutoMappedType] | ||
public class ArenaDropHandler : InGameOnlyPacketHandler | ||
{ | ||
private readonly IEnumerable<IArenaNotifier> _arenaNotifiers; | ||
|
||
public override PacketFamily Family => PacketFamily.Arena; | ||
|
||
public override PacketAction Action => PacketAction.Drop; | ||
|
||
public ArenaDropHandler(IPlayerInfoProvider playerInfoProvider, | ||
IEnumerable<IArenaNotifier> arenaNotifiers) | ||
: base(playerInfoProvider) | ||
{ | ||
_arenaNotifiers = arenaNotifiers; | ||
} | ||
|
||
public override bool HandlePacket(IPacket packet) | ||
{ | ||
if (packet.ReadEndString().Length < 1) | ||
return false; | ||
|
||
foreach (var notifier in _arenaNotifiers) | ||
{ | ||
notifier.NotifyArenaBusy(); | ||
} | ||
|
||
return true; | ||
} | ||
} | ||
} |
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,76 @@ | ||
using AutomaticTypeMapper; | ||
using EOLib.Domain.Character; | ||
using EOLib.Domain.Login; | ||
using EOLib.Domain.Map; | ||
using EOLib.Domain.Notifiers; | ||
using EOLib.Net; | ||
using EOLib.Net.Handlers; | ||
using System.Collections.Generic; | ||
|
||
namespace EOLib.PacketHandlers.Arena | ||
{ | ||
/// <summary> | ||
/// Arena kill message | ||
/// </summary> | ||
[AutoMappedType] | ||
public class ArenaSpecHandler : InGameOnlyPacketHandler | ||
{ | ||
private readonly ICharacterRepository _characterRepository; | ||
private readonly ICurrentMapStateRepository _currentMapStateRepository; | ||
private readonly IEnumerable<IArenaNotifier> _arenaNotifiers; | ||
|
||
public override PacketFamily Family => PacketFamily.Arena; | ||
|
||
public override PacketAction Action => PacketAction.Spec; | ||
|
||
public ArenaSpecHandler(IPlayerInfoProvider playerInfoProvider, | ||
ICharacterRepository characterRepository, | ||
ICurrentMapStateRepository currentMapStateRepository, | ||
IEnumerable<IArenaNotifier> arenaNotifiers) | ||
: base(playerInfoProvider) | ||
{ | ||
_characterRepository = characterRepository; | ||
_currentMapStateRepository = currentMapStateRepository; | ||
_arenaNotifiers = arenaNotifiers; | ||
} | ||
|
||
public override bool HandlePacket(IPacket packet) | ||
{ | ||
var playerId = packet.ReadShort(); | ||
packet.ReadByte(); | ||
|
||
var playerDirection = (EODirection)packet.ReadChar(); | ||
packet.ReadByte(); | ||
|
||
if (playerId == _characterRepository.MainCharacter.ID) | ||
{ | ||
var rp = _characterRepository.MainCharacter.RenderProperties.WithDirection(playerDirection); | ||
_characterRepository.MainCharacter = _characterRepository.MainCharacter.WithRenderProperties(rp); | ||
} | ||
else if (_currentMapStateRepository.Characters.ContainsKey(playerId)) | ||
{ | ||
var character = _currentMapStateRepository.Characters[playerId]; | ||
var rp = character.RenderProperties.WithDirection(playerDirection); | ||
var newCharacter = character.WithRenderProperties(rp); | ||
_currentMapStateRepository.Characters.Update(character, newCharacter); | ||
} | ||
else if (playerId > 0) | ||
{ | ||
_currentMapStateRepository.UnknownPlayerIDs.Add(playerId); | ||
} | ||
|
||
var killsCount = packet.ReadInt(); | ||
packet.ReadByte(); | ||
|
||
var killerName = packet.ReadBreakString(); | ||
var victimName = packet.ReadBreakString(); | ||
|
||
foreach (var notifier in _arenaNotifiers) | ||
{ | ||
notifier.NotifyArenaKill(killsCount, killerName, victimName); | ||
} | ||
|
||
return true; | ||
} | ||
} | ||
} |
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,41 @@ | ||
using AutomaticTypeMapper; | ||
using EOLib.Domain.Login; | ||
using EOLib.Domain.Notifiers; | ||
using EOLib.Net; | ||
using EOLib.Net.Handlers; | ||
using System.Collections.Generic; | ||
|
||
namespace EOLib.PacketHandlers.Arena | ||
{ | ||
/// <summary> | ||
/// Arena start message | ||
/// </summary> | ||
[AutoMappedType] | ||
public class ArenaUseHandler : InGameOnlyPacketHandler | ||
{ | ||
private readonly IEnumerable<IArenaNotifier> _arenaNotifiers; | ||
|
||
public override PacketFamily Family => PacketFamily.Arena; | ||
|
||
public override PacketAction Action => PacketAction.Use; | ||
|
||
public ArenaUseHandler(IPlayerInfoProvider playerInfoProvider, | ||
IEnumerable<IArenaNotifier> arenaNotifiers) | ||
: base(playerInfoProvider) | ||
{ | ||
_arenaNotifiers = arenaNotifiers; | ||
} | ||
|
||
public override bool HandlePacket(IPacket packet) | ||
{ | ||
var playersCount = packet.ReadChar(); | ||
|
||
foreach (var notifier in _arenaNotifiers) | ||
{ | ||
notifier.NotifyArenaStart(playersCount); | ||
} | ||
|
||
return true; | ||
} | ||
} | ||
} |
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
Oops, something went wrong.