Skip to content

Commit 060d9e0

Browse files
committed
add some glacernon raid
1 parent 91bf9c4 commit 060d9e0

File tree

4 files changed

+93
-6
lines changed

4 files changed

+93
-6
lines changed

TaleKit/Game/Entities/Player.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
namespace TaleKit.Game.Entities;
22

3+
public enum GlacernonSide
4+
{
5+
Angel,
6+
Demon
7+
}
8+
39
public class Player : LivingEntity
410
{
511
public override EntityType EntityType => EntityType.Player;
12+
public GlacernonSide GlacernonSide { get; set; }
613
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using TaleKit.Game.Entities;
2+
3+
namespace TaleKit.Game.Event.Glacernon;
4+
5+
public class GlacernonMukrajuSpawnedEvent : IEvent
6+
{
7+
public required Session Session { get; init; }
8+
public required int TimeLeftInSeconds { get; init; }
9+
public required GlacernonSide Side { get; init; }
10+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using TaleKit.Game.Entities;
2+
3+
namespace TaleKit.Game.Event.Glacernon;
4+
5+
public enum RaidKind
6+
{
7+
Morcos,
8+
Hatus,
9+
Calvina,
10+
Berios
11+
}
12+
13+
public class GlacernonRaidOpenedEvent : IEvent
14+
{
15+
public required Session Session { get; init; }
16+
public required int TimeLeft { get; init; }
17+
public required GlacernonSide Side { get; init; }
18+
public required RaidKind RaidKind { get; init; }
19+
}
Lines changed: 57 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,26 @@
11
using TaleKit.Extension;
22
using TaleKit.Game;
3+
using TaleKit.Game.Entities;
34
using TaleKit.Game.Event.Glacernon;
45

56
namespace TaleKit.Network.Packet.Glacernon;
67

8+
79
public class Fc : IPacket
810
{
911
public int AngelPercent { get; set; }
1012
public int DemonPercent { get; set; }
13+
14+
public int AngelEvent { get; set; }
15+
public int DemonEvent { get; set; }
16+
17+
public int AngelTime { get; set; }
18+
public int DemonTime { get; set; }
19+
20+
public bool IsHatus { get; set; }
21+
public bool IsMorcos { get; set; }
22+
public bool IsCalvina { get; set; }
23+
public bool IsBerios { get; set; }
1124
}
1225

1326
public class FcBuilder : PacketBuilder<Fc>
@@ -19,7 +32,15 @@ protected override Fc CreatePacket(string[] body)
1932
return new Fc
2033
{
2134
AngelPercent = body[2].ToInt(),
22-
DemonPercent = body[11].ToInt()
35+
AngelEvent = body[3].ToInt(),
36+
AngelTime = body[4].ToInt(),
37+
DemonPercent = body[11].ToInt(),
38+
DemonEvent = body[12].ToInt(),
39+
DemonTime = body[13].ToInt(),
40+
IsMorcos = body[15] == "1",
41+
IsHatus = body[16] == "1",
42+
IsCalvina = body[17] == "1",
43+
IsBerios = body[18] == "1"
2344
};
2445
}
2546
}
@@ -28,11 +49,41 @@ public class FcProcessor : PacketProcessor<Fc>
2849
{
2950
protected override void Process(Session session, Fc packet)
3051
{
31-
session.Emit(new GlacernonPercentChangedEvent
52+
if (packet.AngelEvent == 0 && packet.DemonEvent == 0)
53+
{
54+
session.Emit(new GlacernonPercentChangedEvent
55+
{
56+
Session = session,
57+
AngelPercent = packet.AngelPercent,
58+
DemonPercent = packet.DemonPercent
59+
});
60+
}
61+
62+
if (packet.AngelEvent == 2 || packet.DemonEvent == 2)
63+
{
64+
session.Emit(new GlacernonMukrajuSpawnedEvent
65+
{
66+
Session = session,
67+
Side = packet.AngelEvent == 2 ? GlacernonSide.Angel : GlacernonSide.Demon,
68+
TimeLeftInSeconds = packet.AngelEvent == 2 ? packet.AngelTime : packet.DemonTime
69+
});
70+
}
71+
72+
if (packet.AngelEvent == 3 || packet.DemonEvent == 3)
3273
{
33-
Session = session,
34-
AngelPercent = packet.AngelPercent,
35-
DemonPercent = packet.DemonPercent
36-
});
74+
session.Emit(new GlacernonRaidOpenedEvent
75+
{
76+
Session = session,
77+
Side = packet.AngelEvent == 3 ? GlacernonSide.Angel : GlacernonSide.Demon,
78+
TimeLeft = packet.AngelEvent == 3 ? packet.AngelTime : packet.DemonTime,
79+
RaidKind = packet.IsMorcos
80+
? RaidKind.Morcos
81+
: packet.IsHatus
82+
? RaidKind.Hatus
83+
: packet.IsCalvina
84+
? RaidKind.Calvina
85+
: RaidKind.Berios
86+
});
87+
}
3788
}
3889
}

0 commit comments

Comments
 (0)