Skip to content

Commit 8fdc7c4

Browse files
authored
2.0.0
1 parent d7f1b23 commit 8fdc7c4

10 files changed

+2185
-0
lines changed

Config/Configs.cs

+196
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
using System.Text.Json;
2+
using System.Text.Json.Serialization;
3+
using Microsoft.Extensions.Localization;
4+
5+
namespace Game_Manager_GoldKingZ.Config
6+
{
7+
public static class Configs
8+
{
9+
public static class Shared {
10+
public static string? CookiesModule { get; set; }
11+
public static IStringLocalizer? StringLocalizer { get; set; }
12+
}
13+
14+
private static readonly string ConfigDirectoryName = "config";
15+
private static readonly string ConfigFileName = "config.json";
16+
private static readonly string jsonFilePath2 = "MySql_Settings.json";
17+
private static string? _jsonFilePath2;
18+
private static string? _configFilePath;
19+
private static ConfigData? _configData;
20+
21+
private static readonly JsonSerializerOptions SerializationOptions = new()
22+
{
23+
Converters =
24+
{
25+
new JsonStringEnumConverter()
26+
},
27+
WriteIndented = true,
28+
AllowTrailingCommas = true,
29+
ReadCommentHandling = JsonCommentHandling.Skip,
30+
};
31+
32+
public static bool IsLoaded()
33+
{
34+
return _configData is not null;
35+
}
36+
37+
public static ConfigData GetConfigData()
38+
{
39+
if (_configData is null)
40+
{
41+
throw new Exception("Config not yet loaded.");
42+
}
43+
44+
return _configData;
45+
}
46+
47+
public static ConfigData Load(string modulePath)
48+
{
49+
var configFileDirectory = Path.Combine(modulePath, ConfigDirectoryName);
50+
if(!Directory.Exists(configFileDirectory))
51+
{
52+
Directory.CreateDirectory(configFileDirectory);
53+
}
54+
_jsonFilePath2 = Path.Combine(configFileDirectory, jsonFilePath2);
55+
Helper.CreateDefaultWeaponsJson2(_jsonFilePath2);
56+
57+
_configFilePath = Path.Combine(configFileDirectory, ConfigFileName);
58+
if (File.Exists(_configFilePath))
59+
{
60+
_configData = JsonSerializer.Deserialize<ConfigData>(File.ReadAllText(_configFilePath), SerializationOptions);
61+
}
62+
else
63+
{
64+
_configData = new ConfigData();
65+
}
66+
67+
if (_configData is null)
68+
{
69+
throw new Exception("Failed to load configs.");
70+
}
71+
72+
SaveConfigData(_configData);
73+
74+
return _configData;
75+
}
76+
77+
private static void SaveConfigData(ConfigData configData)
78+
{
79+
if (_configFilePath is null)
80+
{
81+
throw new Exception("Config not yet loaded.");
82+
}
83+
string json = JsonSerializer.Serialize(configData, SerializationOptions);
84+
85+
86+
File.WriteAllText(_configFilePath, json);
87+
}
88+
89+
public class ConfigData
90+
{
91+
public bool Enable_UseMySql { get; set; }
92+
public bool DisableRadio { get; set; }
93+
public bool DisableBotRadio { get; set; }
94+
public bool DisableChatWheel { get; set; }
95+
public bool DisablePing { get; set; }
96+
public bool DisableGrenadeRadio { get; set; }
97+
public bool DisableRadar { get; set; }
98+
public bool DisableCashAwardsAndMoneyHUD { get; set; }
99+
public bool DisableJumpLandSound { get; set; }
100+
public bool DisableFallDamage { get; set; }
101+
public bool DisableSvCheats { get; set; }
102+
public bool DisableC4 { get; set; }
103+
public bool DisableMPVSound { get; set; }
104+
public int DisableKillfeedMode { get; set; }
105+
public int DisableTeamMateHeadTag { get; set; }
106+
public int DisableDeadBodyMode { get; set; }
107+
public float Mode2_TimeXSecsDelayRemoveDeadBody { get; set; }
108+
public float Mode3_TimeXSecsDecayDeadBody { get; set; }
109+
public int DisableLegsMode { get; set; }
110+
public string Toggle_DisableLegsFlags { get; set; }
111+
public string Toggle_DisableLegsCommandsInGame { get; set; }
112+
public int DisableHUDChatMode { get; set; }
113+
public float DisableHUDChatModeWarningTimerInSecs { get; set; }
114+
public string Toggle_DisableHUDChatFlags { get; set; }
115+
public string Toggle_DisableHUDChatCommandsInGame { get; set; }
116+
public int DisableHUDWeaponsMode { get; set; }
117+
public string Toggle_DisableHUDWeaponsFlags { get; set; }
118+
public string Toggle_DisableHUDWeaponsCommandsInGame { get; set; }
119+
public int Toggle_AutoRemovePlayerCookieOlderThanXDays { get; set; }
120+
public int Toggle_AutoRemovePlayerMySqlOlderThanXDays { get; set; }
121+
122+
public string empty { get; set; }
123+
public bool IgnoreDefaultBombPlantedAnnounce { get; set; }
124+
public bool IgnoreDefaultTeamMateAttackMessages { get; set; }
125+
public bool IgnoreDefaultJoinTeamMessages { get; set; }
126+
public bool IgnoreDefaultDisconnectMessages { get; set; }
127+
128+
public string empty2 { get; set; }
129+
public int CustomJoinTeamMessagesMode { get; set; }
130+
public int CustomThrowNadeMessagesMode { get; set; }
131+
public string empty3 { get; set; }
132+
public int AutoCleanDropWeaponsMode { get; set; }
133+
public string AutoCleanTheseDroppedWeaponsOnly { get; set; }
134+
public float Mode1_TimeXSecsDelayClean { get; set; }
135+
public float Mode2_TimeXSecsDelayClean { get; set; }
136+
public float Mode3_EveryTimeXSecs { get; set; }
137+
public string empty4 { get; set; }
138+
public string Information_For_You_Dont_Delete_it { get; set; }
139+
140+
public ConfigData()
141+
{
142+
Enable_UseMySql = false;
143+
DisableRadio = false;
144+
DisableBotRadio = false;
145+
DisableChatWheel = false;
146+
DisablePing = false;
147+
DisableGrenadeRadio = false;
148+
DisableRadar = false;
149+
DisableCashAwardsAndMoneyHUD = false;
150+
DisableJumpLandSound = false;
151+
DisableFallDamage = false;
152+
DisableSvCheats = false;
153+
DisableC4 = false;
154+
DisableMPVSound = false;
155+
DisableKillfeedMode = 0;
156+
DisableTeamMateHeadTag = 0;
157+
DisableDeadBodyMode = 0;
158+
Mode2_TimeXSecsDelayRemoveDeadBody = 10.0f;
159+
Mode3_TimeXSecsDecayDeadBody = 0.01f;
160+
DisableLegsMode = 0;
161+
Toggle_DisableLegsFlags = "@css/root,@css/admin,@css/vip,#css/admin,#css/vip";
162+
Toggle_DisableLegsCommandsInGame = "!hidelegs,!hideleg,!hl";
163+
DisableHUDChatMode = 0;
164+
DisableHUDChatModeWarningTimerInSecs = 15;
165+
Toggle_DisableHUDChatFlags = "@css/root,@css/admin,@css/vip,#css/admin,#css/vip";
166+
Toggle_DisableHUDChatCommandsInGame = "!hidechat,!hc";
167+
DisableHUDWeaponsMode = 0;
168+
Toggle_DisableHUDWeaponsFlags = "@css/root,@css/admin,@css/vip,#css/admin,#css/vip";
169+
Toggle_DisableHUDWeaponsCommandsInGame = "!hideweapons,!hideweapon,!hw";
170+
Toggle_AutoRemovePlayerCookieOlderThanXDays = 7;
171+
Toggle_AutoRemovePlayerMySqlOlderThanXDays = 7;
172+
empty = "-----------------------------------------------------------------------------------";
173+
IgnoreDefaultBombPlantedAnnounce = false;
174+
IgnoreDefaultTeamMateAttackMessages = false;
175+
IgnoreDefaultJoinTeamMessages = false;
176+
IgnoreDefaultDisconnectMessages = false;
177+
empty2 = "-----------------------------------------------------------------------------------";
178+
CustomJoinTeamMessagesMode = 0;
179+
CustomThrowNadeMessagesMode = 0;
180+
empty3 = "-----------------------------------------------------------------------------------";
181+
AutoCleanDropWeaponsMode = 0;
182+
AutoCleanTheseDroppedWeaponsOnly = "1,2,3";
183+
Mode1_TimeXSecsDelayClean = 10;
184+
Mode2_TimeXSecsDelayClean = 10;
185+
Mode3_EveryTimeXSecs = 10;
186+
empty4 = "-----------------------------------------------------------------------------------";
187+
Information_For_You_Dont_Delete_it = " Vist [https://github.com/oqyh/cs2-Game-Manager-GoldKingZ/tree/main?tab=readme-ov-file#-configuration-] To Understand All Above";
188+
}
189+
}
190+
}
191+
}
192+
193+
// CustomThrowNadeMessagesMode = 0 // DISABLED
194+
// CustomThrowNadeMessagesMode = 1 // Custom Thow Nade + Exclude Bots
195+
// CustomThrowNadeMessagesMode = 2 // Custom Thow Nade + Include Bots
196+
// CustomThrowNadeMessagesMode = 3 // Custom Thow Nade + Hide Nade Message From All When (mp_teammates_are_enemies true)

Config/Globals.cs

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using CounterStrikeSharp.API.Core;
2+
3+
namespace Game_Manager_GoldKingZ;
4+
5+
public class Globals
6+
{
7+
public static bool onetimeclean = false;
8+
public static uint HIDEWEAPONS = 64;
9+
public static uint HIDECHAT = 128;
10+
public static uint CROSSHAIRANDNAMETAGS = 256;
11+
public static Dictionary<ulong, int> Toggle_DisableChat = new Dictionary<ulong, int>();
12+
public static Dictionary<ulong, bool> Toggle_OnDisableChat = new Dictionary<ulong, bool>();
13+
public static Dictionary<ulong, int> Toggle_DisableWeapons = new Dictionary<ulong, int>();
14+
public static Dictionary<ulong, bool> Toggle_OnDisableWeapons = new Dictionary<ulong, bool>();
15+
public static Dictionary<ulong, int> Toggle_DisableLegs = new Dictionary<ulong, int>();
16+
public static CounterStrikeSharp.API.Modules.Timers.Timer? CleanerTimer;
17+
public static Dictionary<CCSPlayerController, CounterStrikeSharp.API.Modules.Timers.Timer> TimerRemoveDeadBody = new Dictionary<CCSPlayerController, CounterStrikeSharp.API.Modules.Timers.Timer>();
18+
19+
public static Dictionary<CCSPlayerController, int> PlayerAlpha = new Dictionary<CCSPlayerController, int>();
20+
}

0 commit comments

Comments
 (0)