This repository was archived by the owner on Sep 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 441
/
Copy pathApiGameEvents.cs
195 lines (176 loc) · 6.94 KB
/
ApiGameEvents.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
using GameServerLib.GameObjects.AttackableUnits;
using LeaguePackets.Game.Events;
using LeagueSandbox.GameServer.GameObjects.AttackableUnits.AI;
using LeagueSandbox.GameServer.Logging;
using log4net;
namespace LeagueSandbox.GameServer.API
{
public static class ApiGameEvents
{
private static Game _game;
private static ILog _logger = LoggerProvider.GetLogger();
public static void SetGame(Game game)
{
_game = game;
}
public static void AnnounceCaptureAltar(Minion altar, byte index)
{
_game.PacketNotifier.NotifyS2C_OnEventWorld(new OnCaptureAltar() { CapturePoint = index, OtherNetID = altar.NetId });
}
public static void AnnounceCapturePointCaptured(LaneTurret turret, char point, Champion captor = null)
{
IEvent captured;
switch (char.ToUpper(point))
{
case 'A':
captured = new OnCapturePointCaptured_A();
break;
case 'B':
captured = new OnCapturePointCaptured_B();
break;
case 'C':
captured = new OnCapturePointCaptured_C();
break;
case 'D':
captured = new OnCapturePointCaptured_D();
break;
case 'E':
captured = new OnCapturePointCaptured_E();
break;
default:
_logger.Warn($"Announcement with Id {point} doesn't exist! Please use numbers between 1 and 5");
return;
}
if (captor != null)
{
captured.OtherNetID = captor.NetId;
}
_game.PacketNotifier.NotifyOnEvent(captured, turret);
}
public static void AnnounceCapturePointNeutralized(LaneTurret turret, char point)
{
IEvent neutralized;
switch (char.ToUpper(point))
{
case 'A':
neutralized = new OnCapturePointNeutralized_A();
break;
case 'B':
neutralized = new OnCapturePointNeutralized_B();
break;
case 'C':
neutralized = new OnCapturePointNeutralized_C();
break;
case 'D':
neutralized = new OnCapturePointNeutralized_D();
break;
case 'E':
neutralized = new OnCapturePointNeutralized_E();
break;
default:
_logger.Warn($"Announcement with Id {point} doesn't exist! Please use numbers between 1 and 5");
return;
}
_game.PacketNotifier.NotifyOnEvent(neutralized, turret);
}
public static void AnnounceChampionAscended(Champion champion)
{
_game.PacketNotifier.NotifyS2C_OnEventWorld(new OnChampionAscended() { OtherNetID = champion.NetId }, champion);
}
public static void AnnounceClearAscended()
{
_game.PacketNotifier.NotifyS2C_OnEventWorld(new OnClearAscended());
ApiMapFunctionManager.NotifyAscendant();
}
public static void AnnounceKillDragon(DeathData data)
{
var killDragon = new OnKillDragon()
{
//TODO: Figure out all the parameters, their values look random(?).
//All Map11 replays have the same values in this event besides OtherNetId.
OtherNetID = data.Unit.NetId
};
_game.PacketNotifier.NotifyS2C_OnEventWorld(killDragon, data.Killer);
}
public static void AnnounceKillWorm(DeathData data)
{
var killDragon = new OnKillWorm()
{
//TODO: Figure out all the parameters, their values look random(?).
OtherNetID = data.Unit.NetId
};
_game.PacketNotifier.NotifyS2C_OnEventWorld(killDragon, data.Killer);
}
public static void AnnounceKillSpiderBoss(DeathData data)
{
var killDragon = new OnKillSpiderBoss()
{
//Couldn't find a replay with this event, but i assume it should follow the same logic as the other 2.
OtherNetID = data.Unit.NetId
};
_game.PacketNotifier.NotifyS2C_OnEventWorld(killDragon, data.Killer);
}
public static void AnnounceMinionAscended(Minion minion)
{
_game.PacketNotifier.NotifyS2C_OnEventWorld(new OnMinionAscended() { OtherNetID = minion.NetId }, minion);
}
public static void AnnounceMinionsSpawn()
{
_game.PacketNotifier.NotifyS2C_OnEventWorld(new OnMinionsSpawn());
}
public static void AnnouceNexusCrystalStart()
{
_game.PacketNotifier.NotifyS2C_OnEventWorld(new OnNexusCrystalStart());
}
public static void AnnounceStartGameMessage(int message, int map = 0)
{
IEvent annoucement;
switch (message)
{
case 1:
annoucement = new OnStartGameMessage1();
break;
case 2:
annoucement = new OnStartGameMessage2();
break;
case 3:
annoucement = new OnStartGameMessage3();
break;
case 4:
annoucement = new OnStartGameMessage4();
break;
case 5:
annoucement = new OnStartGameMessage5();
break;
default:
_logger.Warn($"Announcement with Id {message} doesn't exist! Please use numbers between 1 and 5");
return;
}
(annoucement as ArgsGlobalMessageGeneric).MapNumber = map;
_game.PacketNotifier.NotifyS2C_OnEventWorld(annoucement);
}
public static void AnnounceVictoryPointThreshold(LaneTurret turret, int index)
{
IEvent pointThreshHold;
switch (index)
{
case 1:
pointThreshHold = new OnVictoryPointThreshold1();
break;
case 2:
pointThreshHold = new OnVictoryPointThreshold2();
break;
case 3:
pointThreshHold = new OnVictoryPointThreshold3();
break;
case 4:
pointThreshHold = new OnVictoryPointThreshold4();
break;
default:
_logger.Warn($"Announcement with Id {index} doesn't exist! Please use numbers between 1 and 5");
return;
}
_game.PacketNotifier.NotifyOnEvent(pointThreshHold, turret);
}
}
}