-
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.
Make guild npcs interactable and add Guild_Open handler (#356)
Also adds some resource IDs for guild icons and text
- Loading branch information
Showing
12 changed files
with
388 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using AutomaticTypeMapper; | ||
using EOLib.Net.Communication; | ||
using Moffat.EndlessOnline.SDK.Protocol.Net.Client; | ||
|
||
namespace EOLib.Domain.Interact.Guild | ||
{ | ||
[AutoMappedType] | ||
public class GuildActions : IGuildActions | ||
{ | ||
private readonly IGuildSessionProvider _guildSessionProvider; | ||
private readonly IPacketSendService _packetSendService; | ||
|
||
public GuildActions(IGuildSessionProvider guildSessionProvider, | ||
IPacketSendService packetSendService) | ||
{ | ||
_guildSessionProvider = guildSessionProvider; | ||
_packetSendService = packetSendService; | ||
} | ||
|
||
public void Lookup(string identity) | ||
{ | ||
_packetSendService.SendPacket(new GuildReportClientPacket { SessionId = _guildSessionProvider.SessionID, GuildIdentity = identity }); | ||
} | ||
|
||
public void ViewMembers(string identity) | ||
{ | ||
_packetSendService.SendPacket(new GuildTellClientPacket { SessionId = _guildSessionProvider.SessionID, GuildIdentity = identity }); | ||
} | ||
} | ||
|
||
public interface IGuildActions | ||
{ | ||
void Lookup(string identity); | ||
|
||
void ViewMembers(string identity); | ||
} | ||
} |
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,25 @@ | ||
using AutomaticTypeMapper; | ||
|
||
namespace EOLib.Domain.Interact.Guild | ||
{ | ||
public interface IGuildSessionProvider | ||
{ | ||
int SessionID { get; } | ||
} | ||
|
||
public interface IGuildSessionRepository | ||
{ | ||
int SessionID { get; set; } | ||
} | ||
|
||
[AutoMappedType(IsSingleton = true)] | ||
public class GuildSessionRepository : IGuildSessionRepository, IGuildSessionProvider | ||
{ | ||
public int SessionID { get; set; } | ||
|
||
public GuildSessionRepository() | ||
{ | ||
SessionID = 0; | ||
} | ||
} | ||
} |
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,45 @@ | ||
using AutomaticTypeMapper; | ||
using EOLib.Domain.Interact; | ||
using EOLib.Domain.Interact.Guild; | ||
using EOLib.Domain.Login; | ||
using EOLib.Domain.Map; | ||
using EOLib.Net.Handlers; | ||
using Moffat.EndlessOnline.SDK.Protocol.Net; | ||
using Moffat.EndlessOnline.SDK.Protocol.Net.Server; | ||
using Optional; | ||
using System.Collections.Generic; | ||
|
||
namespace EOLib.PacketHandlers.Guild | ||
{ | ||
[AutoMappedType] | ||
|
||
public class GuildOpenHandler : InGameOnlyPacketHandler<GuildOpenServerPacket> | ||
{ | ||
private readonly IGuildSessionRepository _guildSessionRepository; | ||
|
||
private readonly IEnumerable<INPCInteractionNotifier> _npcInteractionNotifiers; | ||
|
||
public override PacketFamily Family => PacketFamily.Guild; | ||
|
||
public override PacketAction Action => PacketAction.Open; | ||
|
||
public GuildOpenHandler(IPlayerInfoProvider playerInfoProvider, | ||
IGuildSessionRepository guildSessionRepository, | ||
IEnumerable<INPCInteractionNotifier> npcInteractionNotifiers) | ||
: base(playerInfoProvider) | ||
{ | ||
_guildSessionRepository = guildSessionRepository; | ||
_npcInteractionNotifiers = npcInteractionNotifiers; | ||
} | ||
|
||
public override bool HandlePacket(GuildOpenServerPacket packet) | ||
{ | ||
_guildSessionRepository.SessionID = packet.SessionId; | ||
|
||
foreach (var notifier in _npcInteractionNotifiers) | ||
notifier.NotifyInteractionFromNPC(IO.NPCType.Guild); | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
using AutomaticTypeMapper; | ||
using EndlessClient.Content; | ||
using EndlessClient.Dialogs.Services; | ||
using EOLib.Domain.Interact.Guild; | ||
using EOLib.Domain.Map; | ||
using EOLib.Graphics; | ||
using EOLib.IO.Repositories; | ||
using EOLib.Localization; | ||
|
||
namespace EndlessClient.Dialogs.Factories | ||
{ | ||
[AutoMappedType] | ||
public class GuildDialogFactory : IGuildDialogFactory | ||
{ | ||
private readonly INativeGraphicsManager _nativeGraphicsManager; | ||
private readonly IEODialogButtonService _dialogButtonService; | ||
private readonly IEODialogIconService _dialogIconService; | ||
private readonly ILocalizedStringFinder _localizedStringFinder; | ||
private readonly ITextInputDialogFactory _textInputDialogFactory; | ||
private readonly IGuildActions _GuildActions; | ||
private readonly IContentProvider _contentProvider; | ||
private readonly ICurrentMapStateProvider _currentMapStateProvider; | ||
private readonly IENFFileProvider _enfFileProvider; | ||
|
||
public GuildDialogFactory(INativeGraphicsManager nativeGraphicsManager, | ||
IEODialogButtonService dialogButtonService, | ||
IEODialogIconService dialogIconService, | ||
ILocalizedStringFinder localizedStringFinder, | ||
ITextInputDialogFactory textInputDialogFactory, | ||
IGuildActions GuildActions, | ||
IContentProvider contentProvider, | ||
ICurrentMapStateProvider currentMapStateProvider, | ||
IENFFileProvider enfFileProvider) | ||
{ | ||
_nativeGraphicsManager = nativeGraphicsManager; | ||
_dialogButtonService = dialogButtonService; | ||
_dialogIconService = dialogIconService; | ||
_localizedStringFinder = localizedStringFinder; | ||
_textInputDialogFactory = textInputDialogFactory; | ||
_GuildActions = GuildActions; | ||
_contentProvider = contentProvider; | ||
_currentMapStateProvider = currentMapStateProvider; | ||
_enfFileProvider = enfFileProvider; | ||
} | ||
|
||
public GuildDialog Create() | ||
{ | ||
return new GuildDialog(_nativeGraphicsManager, | ||
_dialogButtonService, | ||
_dialogIconService, | ||
_localizedStringFinder, | ||
_textInputDialogFactory, | ||
_GuildActions, | ||
_contentProvider, | ||
_currentMapStateProvider, | ||
_enfFileProvider); | ||
} | ||
} | ||
|
||
public interface IGuildDialogFactory | ||
{ | ||
GuildDialog Create(); | ||
} | ||
} |
Oops, something went wrong.