-
Notifications
You must be signed in to change notification settings - Fork 16
/
MapNPCActions.cs
56 lines (46 loc) · 1.61 KB
/
MapNPCActions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using AutomaticTypeMapper;
using EOLib.Domain.Interact.Quest;
using EOLib.Domain.NPC;
using EOLib.IO.Repositories;
using EOLib.Net;
using EOLib.Net.Communication;
namespace EOLib.Domain.Interact
{
[AutoMappedType]
public class MapNPCActions : IMapNPCActions
{
private readonly IPacketSendService _packetSendService;
private readonly IENFFileProvider _enfFileProvider;
private readonly IQuestDataRepository _questDataRepository;
public MapNPCActions(IPacketSendService packetSendService,
IENFFileProvider enfFileProvider,
IQuestDataRepository questDataRepository)
{
_packetSendService = packetSendService;
_enfFileProvider = enfFileProvider;
_questDataRepository = questDataRepository;
}
public void RequestShop(INPC npc)
{
var packet = new PacketBuilder(PacketFamily.Shop, PacketAction.Open)
.AddShort(npc.Index)
.Build();
_packetSendService.SendPacket(packet);
}
public void RequestQuest(INPC npc)
{
_questDataRepository.RequestedNPC = npc;
var data = _enfFileProvider.ENFFile[npc.ID];
var packet = new PacketBuilder(PacketFamily.Quest, PacketAction.Use)
.AddShort(npc.Index)
.AddShort(data.VendorID)
.Build();
_packetSendService.SendPacket(packet);
}
}
public interface IMapNPCActions
{
void RequestShop(INPC npc);
void RequestQuest(INPC npc);
}
}