-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathConfigBuild.cs
225 lines (202 loc) · 7.79 KB
/
ConfigBuild.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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
using Interactables.Interobjects.DoorUtils;
using PlayerRoles;
using System.Collections.Generic;
using UnityEngine;
using Exiled.API.Extensions;
using System;
using Exiled.API.Features;
namespace FacilityManagement
{
public class AhpProccessBuild
{
public float Amount { get; set; }
public float Regen { get; set; }
public float Efficacy { get; set; }
public float Sustain { get; set; }
}
public class DoorBuild
{
public float? Health { get; set; }
public KeycardPermissions? RequiredPermission { get; set; }
public bool? RequireAllPermission { get; set; }
public DoorDamageType? DamageTypeIgnored { get; set; }
}
public class GlassBuild
{
public float? Health { get; set; }
public bool? DisableScpDamage { get; set; }
}
public class TeslaBuild
{
public List<RoleTypeId> IgnoredRoles { get; set; }
public float? TriggerRange { get; set; }
public float? IdleRange { get; set; }
public float? ActivationTime { get; set; }
public float? CooldownTime { get; set; }
}
public class Scp914Build
{
public float? KnobChangeCooldown { get; set; }
public float? DoorCloseTime { get; set; }
public float? ItemUpgradeTime { get; set; }
public float? DoorOpenTime { get; set; }
public float? ActivationCooldown { get; set; }
}
public class GeneratorBuild
{
public float? UnlockCooldown { get; set; }
public float? LeverDelay { get; set; }
public float? DoorPanelCooldown { get; set; }
public float? InteractionCooldown { get; set; }
public float? DeactivationTime { get; set; }
public Exiled.API.Enums.KeycardPermissions? RequiredPermission { get; set; }
}
public class ItemBuild
{
public Dictionary<string, string> Custom { get; set; }
public static object Parse(string value, Type targetType, out bool success)
{
success = true;
// Handle enums
if (targetType.IsEnum)
{
return Enum.Parse(targetType, value);
}
// Handle Vector3 (assuming the format is "(x,y)" "(x,y,z)""(x,y,z,w)")
if (targetType == typeof(Vector2) || targetType == typeof(Vector3) || targetType == typeof(Vector4))
{
success = true;
value = value.Replace('(', ' ').Replace(')', ' ').Replace(" ", string.Empty);
string[] components = value.Split(',');
float x, y, z, w;
if (components.Length == 2 && float.TryParse(components[0], out x) && float.TryParse(components[1], out y))
{
return new Vector2(x, y);
}
if (components.Length == 3 && float.TryParse(components[0], out x) && float.TryParse(components[1], out y) && float.TryParse(components[2], out z))
{
return new Vector3(x, y, z);
}
if (components.Length == 2 && float.TryParse(components[0], out x) && float.TryParse(components[1], out y) && float.TryParse(components[2], out z) && float.TryParse(components[2], out w))
{
return new Vector4(x, y, z, w);
}
success = false;
Log.Info($"Invalid Vector {value}");
return default;
}
// Handle nullable value types (e.g., int?, float?, double?)
if (Nullable.GetUnderlyingType(targetType) != null || targetType.IsValueType)
{
// Check if the value is null or empty and return null
if (string.IsNullOrWhiteSpace(value))
{
success = false;
return default;
}
try
{
return Convert.ChangeType(value, targetType);
}
catch (InvalidCastException)
{
success = false;
return default;
}
}
// WTF are you really implemented a AnimationCurve config are you fine bro ???
if (targetType == typeof(AnimationCurve))
{
return default;
}
Log.Error("End");
success = false;
return default;
}
}
public class RoleBuild
{
public Dictionary<string, string> Custom { get; set; }
}
public class AnnimationCurveBuild
{
public float? AddCurve { get; set; }
public float? MultiplyCurve { get; set; }
public AnimationCurve ModifyCurve(AnimationCurve animationCurve)
{
if (AddCurve is not null)
animationCurve.Add(AddCurve.Value);
if (MultiplyCurve is not null)
animationCurve.Multiply(MultiplyCurve.Value);
return animationCurve;
}
}
/* Wait Futur Exiled
public class FlashbangBuild
{
public AnnimationCurveBuild BlindingOverDistance { get; set; }
public AnnimationCurveBuild TurnedAwayBlindingDistance { get; set; }
public AnnimationCurveBuild DeafenDurationOverDistance { get; set; }
public AnnimationCurveBuild TurnedAwayDeafenDurationOverDistance { get; set; }
public float? DurfaceZoneDistanceIntensifier { get; set; }
public float? AdditionalBlurDuration { get; set; }
public float? MinimalEffectDuration { get; set; }
public float? BlindTime { get; set; }
}
public class FragGrenadeBuild
{
public AnnimationCurveBuild BlindingOverDistance { get; set; }
public AnnimationCurveBuild TurnedAwayBlindingDistance { get; set; }
public AnnimationCurveBuild DeafenDurationOverDistance { get; set; }
public AnnimationCurveBuild TurnedAwayDeafenDurationOverDistance { get; set; }
public float? DurfaceZoneDistanceIntensifier { get; set; }
public float? AdditionalBlurDuration { get; set; }
public float? MinimalEffectDuration { get; set; }
public float? BlindTime { get; set; }
}
public class Scp244Build
{
public AnnimationCurveBuild DamageOverTemperature { get; set; }
public AnnimationCurveBuild GrowSpeedOverLifetime { get; set; }
public float? MaxExitTemp { get; set; }
public float? TemperatureDrop { get; set; }
public float? MinimalEffectDuration { get; set; }
public float? BlindTime { get; set; }
public float? Scp244Health { get; set; }
public float? DeployedPickupTime { get; set; }
}
/*
public class Scp018Build
{
public AnnimationCurveBuild DamageOverVelocity { get; set; }
public float? MaximumVelocity { get; set; }
public float? OnBounceVelocityAddition { get; set; }
public float? ActivationVelocitySqr { get; set; }
public float? DoorDamageMultiplier { get; set; }
public float? ScpDamageMultiplier { get; set; }
public float? FriendlyFireTime { get; set; }
public float? BounceHitregRadius { get; set; }
}
public class ExplosionGrenadeBuild
{
public AnnimationCurveBuild PlayerDamageOverDistance { get; set; }
public AnnimationCurveBuild EffectDurationOverDistance { get; set; }
public AnnimationCurveBuild DoorDamageOverDistance { get; set; }
public float? ScpDamageMultiplier { get; set; }
public float? MaxRadius { get; set; }
public float? BurnedDuration { get; set; }
public float? DeafenedDuration { get; set; }
public float? ConcussedDuration { get; set; }
public float? MinimalDuration { get; set; }
public float? BounceHitregRadius { get; set; }
}
public class RegenerationBuild
{
public AnnimationCurveBuild Scp500HealProgress { get; set; }
public AnnimationCurveBuild PainkillersHealProgress { get; set; }
}
public class Scp939Build
{
public AnnimationCurveBuild StaminaRegeneration { get; set; }
}*/
}