Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- case "reset_exp":
- {
- WindowsAPI.IniFile ini = new WindowsAPI.IniFile("");
- string usersDirectory = Program.ServerConfig.DbLocation + "\\Users\\";
- string[] userFiles = System.IO.Directory.GetFiles(usersDirectory);
- int totalUsers = userFiles.Length;
- int resetUsers = 0;
- foreach (string fname in userFiles)
- {
- ini.FileName = fname;
- ulong experience = ini.ReadUInt64("Character", "Experience", 0);
- if (experience > 0)
- {
- ulong newExperience = experience / 2;
- ini.Write<ulong>("Character", "Experience", newExperience);
- resetUsers++;
- string playerId = System.IO.Path.GetFileNameWithoutExtension(fname);
- Console.WriteLine($"Experience reduced for player ID: {playerId}, previous Experience: {experience}, new Experience: {newExperience}");
- }
- }
- Console.WriteLine($"Total players: {totalUsers}");
- Console.WriteLine($"Players with Experience reduced: {resetUsers}");
- break;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement