-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgungame_api.cs
80 lines (80 loc) · 2.86 KB
/
gungame_api.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
using GunGame;
using GunGame.Variables;
namespace GunGame.API
{
public class CoreAPI : IAPI
{
private GunGame _gunGame;
public CoreAPI(GunGame gunGame)
{
_gunGame = gunGame; // Initialize it through the constructor
}
public event Action<WinnerEventArgs>? WinnerEvent;
public void RaiseWinnerEvent(int winner, int looser)
{
var args = new WinnerEventArgs(winner, looser);
WinnerEvent?.Invoke(args);
}
public event Action<WinnerEventArgs>? KnifeStealEvent;
public void RaiseKnifeStealEvent(int killer, int victim)
{
var args = new WinnerEventArgs(killer, victim);
KnifeStealEvent?.Invoke(args);
}
public event Action<KillEventArgs>? KillEvent;
public bool RaiseKillEvent(int killer, int victim, string weapon, bool teamkill)
{
var args = new KillEventArgs(killer, victim, weapon, teamkill);
KillEvent?.Invoke(args);
return args.Result;
}
public event Action<LevelChangeEventArgs>? LevelChangeEvent;
public bool RaiseLevelChangeEvent(int killer, int level, int difference, bool knifesteal, bool lastlevel, bool knife, int victim)
{
var args = new LevelChangeEventArgs(killer, level, difference, knifesteal, lastlevel, knife, victim);
LevelChangeEvent?.Invoke(args);
return args.Result;
}
public event Action<PointChangeEventArgs>? PointChangeEvent;
public bool RaisePointChangeEvent(int killer, int kills, int victim)
{
var args = new PointChangeEventArgs(killer, kills, victim);
PointChangeEvent?.Invoke(args);
return args.Result;
}
public event Action<WeaponFragEventArgs>? WeaponFragEvent;
public bool RaiseWeaponFragEvent(int killer, string weapon)
{
var args = new WeaponFragEventArgs(killer, weapon);
WeaponFragEvent?.Invoke(args);
return args.Result;
}
public event Action? RestartEvent;
public void RaiseRestartEvent()
{
RestartEvent?.Invoke();
}
public int GetMaxLevel()
{
return GGVariables.Instance.WeaponOrderCount;
}
public int GetPlayerLevel(int slot)
{
var player = _gunGame.playerManager.FindBySlot(slot, "GetPlayerLevel");
if (player != null)
return (int)player.Level;
return 0;
}
public int GetMaxCurrentLevel()
{
var player = _gunGame.playerManager.FindLeader();
if (player != null)
return (int)player.Level;
return 0;
}
public bool IsWarmupInProgress()
{
return _gunGame.warmupInitialized;
}
}
}