-
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.
Reimplement Message_Open handler for setting status label from quest
- Loading branch information
1 parent
574fb4f
commit ca9611f
Showing
6 changed files
with
65 additions
and
32 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using AutomaticTypeMapper; | ||
|
||
namespace EOLib.Domain.Interact.Quest | ||
{ | ||
public interface IStatusLabelNotifier | ||
{ | ||
void ShowWarning(string message); | ||
} | ||
|
||
[AutoMappedType] | ||
public class NoOpStatusLabelNotifier : IStatusLabelNotifier | ||
{ | ||
public void ShowWarning(string message) { } | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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,43 @@ | ||
using AutomaticTypeMapper; | ||
using EOLib.Domain.Chat; | ||
using EOLib.Domain.Interact.Quest; | ||
using EOLib.Domain.Login; | ||
using EOLib.Net; | ||
using EOLib.Net.Handlers; | ||
using System.Collections.Generic; | ||
|
||
namespace EOLib.PacketHandlers.Quest | ||
{ | ||
[AutoMappedType] | ||
public class QuestStatusMessageHandler : InGameOnlyPacketHandler | ||
{ | ||
private readonly IChatRepository _chatRepository; | ||
private readonly IEnumerable<IStatusLabelNotifier> _statusLabelNotifiers; | ||
|
||
public override PacketFamily Family => PacketFamily.Message; | ||
|
||
public override PacketAction Action => PacketAction.Open; | ||
|
||
public QuestStatusMessageHandler(IPlayerInfoProvider playerInfoProvider, | ||
IChatRepository chatRepository, | ||
IEnumerable<IStatusLabelNotifier> statusLabelNotifiers) | ||
: base(playerInfoProvider) | ||
{ | ||
_chatRepository = chatRepository; | ||
_statusLabelNotifiers = statusLabelNotifiers; | ||
} | ||
|
||
public override bool HandlePacket(IPacket packet) | ||
{ | ||
var message = packet.ReadEndString(); | ||
|
||
foreach (var notifier in _statusLabelNotifiers) | ||
notifier.ShowWarning(message); | ||
|
||
var chatData = new ChatData(string.Empty, message, ChatIcon.QuestMessage, ChatColor.Server); | ||
_chatRepository.AllChat[ChatTab.System].Add(chatData); | ||
|
||
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