//using SharedLibraryCore; //using SharedLibraryCore.Commands; //using SharedLibraryCore.Configuration; //using SharedLibraryCore.Database.Models; //using SharedLibraryCore.Interfaces; //using System; //using System.Threading.Tasks; //namespace ClanTagRankCommands.Commands //{ // /// // /// Example script command // /// // public class ResetRankCommand : Command // { // readonly string rank = "rank"; // string rank_string; // private readonly IMetaServiceV2 _metaService; // private readonly IConfigurationHandler _configurationHandler; // private Configuration Config; // public ResetRankCommand(CommandConfiguration config, ITranslationLookup lookup, IMetaServiceV2 metaService, IConfigurationHandlerFactory configurationHandlerFactory) : base(config, lookup) // { // _metaService = metaService; // _configurationHandler = configurationHandlerFactory.GetConfigurationHandler("ClanTagRankCommands"); // if (_configurationHandler.Configuration() == null) // { // _configurationHandler.Set((Configuration)new Configuration().Generate()); // _configurationHandler.Save(); // } // Config = _configurationHandler.Configuration(); // Name = "ResetRank"; // Description = "set a user's clan tag Rank (does not give permissions)"; // Alias = "rr"; // Permission = EFClient.Permission.Administrator; // RequiresTarget = true; // Arguments = new[] // { // new CommandArgument() // { // //Name = "rank", // //Required = false // } // }; // } // public override async Task ExecuteAsync(GameEvent E) // { // //var S = E.Owner; // rank_string = "none"; // if(E.Target is not null) // { // await _metaService.SetPersistentMeta(rank, rank_string, E.Target.ClientId); // rank_string = E.Target.Level.ClanTag(Config); // E.Origin.Tell(E.Target.Name + "'s rank has been reset to: " + rank_string); // if (E.Target is not null && E.Target.IsIngame ) // { // if (string.IsNullOrWhiteSpace(rank_string)) // { // await E.Owner.ExecuteCommandAsync("resetclantag" + " " + E.Target.ClientNumber.ToString()); // await E.Owner.ExecuteCommandAsync("resetrole " + E.Target.ClientNumber.ToString()); // } // else // { // await E.Owner.ExecuteCommandAsync("setclantag" + " " + E.Target.ClientNumber.ToString() + " " + rank_string.ToString()); // //await E.Owner.SetDvarAsync("sv_iw4madmin_role", "setRole;" + E.Target.ClientNumber.ToString() + ";" + rank_string.ToString()); // await E.Owner.ExecuteCommandAsync("setrole " + E.Target.ClientNumber.ToString() + " " + rank_string.ToString()); // } // } // } // } // } //}