-
Notifications
You must be signed in to change notification settings - Fork 1
/
GNACurrency.cs
56 lines (49 loc) · 1.74 KB
/
GNACurrency.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
using BattleBitAPI.Common;
using BBRAPIModules;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace BBRModules
{
[Module("A module used to make CurrencyLib additions for GNA.", "1.0.0")]
[RequireModule(typeof(CurrencySystem))]
public class GNACurrency : BattleBitModule
{
public Dictionary<string, int> Killstreaks = new();
public override Task OnPlayerConnected(RunnerPlayer player)
{
Killstreaks.Add(player.SteamID.ToString(), 0);
return Task.CompletedTask;
}
public override Task OnPlayerDisconnected(RunnerPlayer player)
{
Killstreaks.Remove(player.SteamID.ToString());
return Task.CompletedTask;
}
[ModuleReference]
public CurrencySystem CurrencySystem { get; set; } = null!;
public override async Task OnAPlayerDownedAnotherPlayer(OnPlayerKillArguments<RunnerPlayer> args)
{
double multi = GetKillstreakMultiplier(args.Killer);
CurrencyPlayer currencyPlayer = CurrencySystem.GetCurrencyPlayer(args.Killer);
currencyPlayer.Increment(Convert.ToInt32(multi));
}
public double GetKillstreakMultiplier(RunnerPlayer player)
{
int value = Killstreaks[player.SteamID.ToString()];
switch (value)
{
case < 4:
return value * 1.25;
case >= 4 and < 8:
return value * 1.65;
case >= 8 and < 12:
return value * 1.5;
case >= 12 and < 20:
return value * 2.5;
case >= 20:
return value * 3;
}
}
}
}