-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPlugin.cs
More file actions
98 lines (91 loc) · 4.65 KB
/
Plugin.cs
File metadata and controls
98 lines (91 loc) · 4.65 KB
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
using SPTarkov.DI.Annotations;
using SPTarkov.Server.Core.DI;
using SPTarkov.Server.Core.Models.Common;
using SPTarkov.Server.Core.Models.Eft.Common.Tables;
using SPTarkov.Server.Core.Models.Spt.Mod;
using SPTarkov.Server.Core.Models.Utils;
using SPTarkov.Server.Core.Services;
using System.Collections.Generic;
using System.Threading.Tasks;
using Range = SemanticVersioning.Range;
using Version = SemanticVersioning.Version;
namespace BossHealthChanger
{
public record ModMetadata : AbstractModMetadata
{
public override string ModGuid { get; init; } = "com.SkebbZ.BossHealthChanger";
public override string Name { get; init; } = "Boss Health Changer";
public override string Author { get; init; } = "SkebbZ";
public override Version Version { get; init; } = new("1.0.1");
public override Range SptVersion { get; init; } = new("~4.0.0");
public override string License { get; init; } = "MIT";
public override List<string>? Contributors { get; init; } = null;
public override List<string>? Incompatibilities { get; init; } = new List<string>
{
"com.waldfee.spt.fairbothealth"
};
public override Dictionary<string, Range>? ModDependencies { get; init; } = null;
public override string? Url { get; init; } = null;
public override bool? IsBundleMod { get; init; } = null;
}
[Injectable(TypePriority = OnLoadOrder.PostDBModLoader + 999)]
public class BossHealthChanger(
ISptLogger<BossHealthChanger> logger,
DatabaseService databaseService)
: IOnLoad
{
//private static readonly List<string> BossRoles = new List<string>
//{
// "bossbully", "bossboar", "bossboarsniper", "bossgluhar", "bosskilla", "bosskillaagro", "bosskojaniy", "bosskolontay",
// "bosssanitar", "bosstagilla", "bosstagillaagro", "tagillahelperagro", "bosszryachiy", "sectantpriest", "sectantwarrior", "bosspartisan",
// "sectantprizrak", "followerbully", "followergluharassault", "followerboar", "followerboarclose1", "followerboarclose2",
// "followergluharscout", "followergluharsecurity", "followergluharsnipe", "sectantpredvestnik", "sectantoni",
// "followerkilla", "followersanitar", "followertagilla", "followerkojaniy", "followerkolontayassault", "followerkolontaysecurity",
// "followerzryachiy", "gifter", "followerbigpipe", "followerbirdeye", "bossknight", "arenafighterevent", "crazyassaultevent", "cursedassault", "exusec", "pmcbot"
//};
public Task OnLoad()
{
logger.Info("[Boss Health Changer]: Mod loading...");
try {
ModifyBossHealth();
logger.Success("[Boss Health Changer]: Finished applying health changes!");
}
catch (System.Exception ex)
{
logger.Error($"[Boss Health Changer]: An error occurred while applying health changes: {ex.Message}");
}
return Task.CompletedTask;
}
private void ModifyBossHealth()
{
var botTypes = databaseService.GetBots().Types;
var newHealthBodyParts = new BodyPart[1];
newHealthBodyParts[0] = new BodyPart
{
Chest = new MinMax<double> { Min = 85, Max = 85 },
Head = new MinMax<double> { Min = 35, Max = 35 },
LeftArm = new MinMax<double> { Min = 60, Max = 60 },
RightArm = new MinMax<double> { Min = 60, Max = 60 },
LeftLeg = new MinMax<double> { Min = 65, Max = 65 },
RightLeg = new MinMax<double> { Min = 65, Max = 65 },
Stomach = new MinMax<double> { Min = 70, Max = 70 }
};
int changedCount = 0;
foreach (var bot in botTypes)
{
//if (BossRoles.Contains(bot.Key.ToLower()))
if (bot.Key.ToLower().Contains("infected"))
{
logger.Debug($"[Boss Health Changer]: Skipped changing health for infected bot type: {bot.Key}");
}
else if (bot.Value != null && bot.Value.BotHealth != null)
{
bot.Value.BotHealth.BodyParts = newHealthBodyParts;
logger.Debug($"[Boss Health Changer]: Changed health for bot type: {bot.Key}");
changedCount++;
}
}
logger.Info($"[Boss Health Changer]: Successfully applied standard player/PMC health values to {changedCount} boss/special bot types.");
}
}
}