File tree Expand file tree Collapse file tree 2 files changed +56
-0
lines changed
Expand file tree Collapse file tree 2 files changed +56
-0
lines changed Original file line number Diff line number Diff line change 1+ using TaleKit . Game . Entities ;
2+ using TaleKit . Game . Event ;
3+
4+ namespace TaleKit . Game . Animation ;
5+
6+ public class EffectEvent : IEvent
7+ {
8+ public Session Session { get ; init ; }
9+ public Entity Entity { get ; init ; }
10+ public int EffectId { get ; init ; }
11+ }
Original file line number Diff line number Diff line change 1+ using TaleKit . Extension ;
2+ using TaleKit . Game ;
3+ using TaleKit . Game . Animation ;
4+ using TaleKit . Game . Entities ;
5+
6+ namespace TaleKit . Network . Packet . Animation ;
7+
8+ public class Eff : IPacket
9+ {
10+ public EntityType EntityType { get ; set ; }
11+ public int EntityId { get ; set ; }
12+ public int EffectId { get ; set ; }
13+ }
14+
15+ public class EffBuilder : PacketBuilder < Eff >
16+ {
17+ public override string Header { get ; } = "eff" ;
18+
19+ protected override Eff CreatePacket ( string [ ] body )
20+ {
21+ return new Eff
22+ {
23+ EntityType = body [ 0 ] . ToEnum < EntityType > ( ) ,
24+ EntityId = body [ 1 ] . ToInt ( ) ,
25+ EffectId = body [ 2 ] . ToInt ( )
26+ } ;
27+ }
28+ }
29+
30+ public class EffProcessor : PacketProcessor < Eff >
31+ {
32+ protected override void Process ( Session session , Eff packet )
33+ {
34+ var entity = session . Character . Map . GetEntity < Entity > ( packet . EntityType , packet . EntityId ) ;
35+ if ( entity is null )
36+ return ;
37+
38+ session . Emit ( new EffectEvent
39+ {
40+ Session = session ,
41+ Entity = entity ,
42+ EffectId = packet . EffectId
43+ } ) ;
44+ }
45+ }
You can’t perform that action at this time.
0 commit comments