-
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.
* Always use other character renderer for public/group chat * Play sound effect when admin chat sent * Make group chat handler use party members instead of map data * Add PM Close clickable areas after tabs and fixed positions * Add SFX for PM target not found * Dispatch right-click handler to chat tab Solution: adjust coordinates (and child control offsets) so chat tabs are *only* the click area (and not the full panel size). Fixes bug where right-clicking would always try to dispatch to the sys tab, which wouldn't have name data for the PM target. * Reset PM targets in login Fixes bug where relogging and attempting to PM a character you'd previously PM'd would not show the chat tab for the PM session. --------- Co-authored-by: Dan Oak <coderdan@protonmail.com> Co-authored-by: Ethan Moffat <ethan@moffat.io>
- Loading branch information
1 parent
5866310
commit d37ba3e
Showing
8 changed files
with
72 additions
and
52 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 |
---|---|---|
@@ -1,55 +1,59 @@ | ||
using System.Collections.Generic; | ||
using AutomaticTypeMapper; | ||
using EOLib.Domain.Character; | ||
using EOLib.Domain.Chat; | ||
using EOLib.Domain.Login; | ||
using EOLib.Domain.Map; | ||
using EOLib.Domain.Notifiers; | ||
using EOLib.Domain.Party; | ||
using EOLib.Net.Handlers; | ||
using Moffat.EndlessOnline.SDK.Protocol.Net; | ||
using Moffat.EndlessOnline.SDK.Protocol.Net.Server; | ||
using Optional.Collections; | ||
|
||
namespace EOLib.PacketHandlers.Chat | ||
{ | ||
[AutoMappedType] | ||
public class GroupChatHandler : PlayerChatByIDHandler<TalkOpenServerPacket> | ||
public class GroupChatHandler : InGameOnlyPacketHandler<TalkOpenServerPacket> | ||
{ | ||
private readonly IChatRepository _chatRepository; | ||
private readonly IPartyDataProvider _partyDataProvider; | ||
private readonly IEnumerable<IOtherCharacterEventNotifier> _otherCharacterEventNotifiers; | ||
private readonly IEnumerable<IChatEventNotifier> _chatEventNotifiers; | ||
|
||
public override PacketFamily Family => PacketFamily.Talk; | ||
public override PacketAction Action => PacketAction.Open; | ||
|
||
public GroupChatHandler(IPlayerInfoProvider playerInfoProvider, | ||
ICurrentMapStateRepository currentMapStateRepository, | ||
ICharacterProvider characterProvider, | ||
IChatRepository chatRepository, | ||
IPartyDataProvider partyDataProvider, | ||
IEnumerable<IOtherCharacterEventNotifier> otherCharacterEventNotifiers, | ||
IEnumerable<IChatEventNotifier> chatEventNotifiers) | ||
: base(playerInfoProvider, currentMapStateRepository, characterProvider) | ||
: base(playerInfoProvider) | ||
{ | ||
_chatRepository = chatRepository; | ||
_partyDataProvider = partyDataProvider; | ||
_otherCharacterEventNotifiers = otherCharacterEventNotifiers; | ||
_chatEventNotifiers = chatEventNotifiers; | ||
} | ||
|
||
public override bool HandlePacket(TalkOpenServerPacket packet) | ||
{ | ||
return Handle(packet, packet.PlayerId); | ||
} | ||
_partyDataProvider.Members.SingleOrNone(member => member.CharacterID == packet.PlayerId) | ||
.MatchSome(member => | ||
{ | ||
var localChatData = new ChatData(ChatTab.Local, member.Name, packet.Message, ChatIcon.PlayerPartyDark, ChatColor.PM); | ||
_chatRepository.AllChat[ChatTab.Local].Add(localChatData); | ||
|
||
protected override void DoTalk(TalkOpenServerPacket packet, Character character) | ||
{ | ||
var localChatData = new ChatData(ChatTab.Local, character.Name, packet.Message, ChatIcon.PlayerPartyDark, ChatColor.PM); | ||
_chatRepository.AllChat[ChatTab.Local].Add(localChatData); | ||
var chatData = new ChatData(ChatTab.Group, member.Name, packet.Message, ChatIcon.PlayerPartyDark); | ||
_chatRepository.AllChat[ChatTab.Group].Add(chatData); | ||
|
||
var chatData = new ChatData(ChatTab.Group, character.Name, packet.Message, ChatIcon.PlayerPartyDark); | ||
_chatRepository.AllChat[ChatTab.Group].Add(chatData); | ||
foreach (var notifier in _otherCharacterEventNotifiers) | ||
notifier.OtherCharacterSaySomethingToGroup(member.CharacterID, packet.Message); | ||
|
||
foreach (var notifier in _otherCharacterEventNotifiers) | ||
notifier.OtherCharacterSaySomethingToGroup(character.ID, packet.Message); | ||
foreach (var notifier in _chatEventNotifiers) | ||
notifier.NotifyChatReceived(ChatEventType.Group); | ||
}); | ||
|
||
foreach (var notifier in _chatEventNotifiers) | ||
notifier.NotifyChatReceived(ChatEventType.Group); | ||
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
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