forked from Elfocrash/L2dotNET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathL2Trainer.cs
More file actions
49 lines (43 loc) · 1.46 KB
/
Copy pathL2Trainer.cs
File metadata and controls
49 lines (43 loc) · 1.46 KB
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
using System.Threading.Tasks;
using L2dotNET.Templates;
using L2dotNET.Network.serverpackets;
using L2dotNET.World;
using L2dotNET.Models.Player;
using L2dotNET.Network;
using L2dotNET.Tables;
using NLog;
namespace L2dotNET.Models.Npcs
{
class L2Trainer : L2Npc
{
private static readonly Logger Log = LogManager.GetCurrentClassLogger();
public L2Trainer(SpawnTable spawnTable, int objectId, NpcTemplate template, L2Spawn spawn) : base(spawnTable, objectId, template, spawn)
{
Template = template;
Name = template.Name;
InitializeCharacterStatus();
CharStatus.SetCurrentHp(MaxHp);
CharStatus.SetCurrentMp(MaxMp);
//Stats = new CharacterStat(this);
}
public override async Task SendPacketAsync(GameserverPacket pk)
{
foreach (L2Player pl in L2World.GetPlayers())
{
// TODO: Sends to all players on the server. It is not right
await pl.Gameclient.SendPacketAsync(pk);
}
}
public override async Task OnActionAsync(L2Player player)
{
if (player.Target != this)
{
player.SetTargetAsync(this);
return;
}
player.CharMovement.MoveTo(X, Y, Z);
await player.SendPacketAsync(new MoveToPawn(player, this, 150));
player.ShowHtm($"trainer/{NpcId}.htm",this);
}
}
}