예제 #1
0
 public async void LockerGunStatus(EFClient client, string mapName)
 {
     if ((await _metaService.GetPersistentMeta($"{mapName}_gun", client)) == null)
     {
         await _metaService.AddPersistentMeta($"{mapName}_gun", "none", client);
     }
 }
예제 #2
0
        public async Task <IActionResult> Clientguid(string clientguid)
        {
            long decimalNetworkId = clientguid.ConvertGuidToLong(System.Globalization.NumberStyles.Integer);
            var  clientInfo       = Manager.GetActiveClients()
                                    .FirstOrDefault(c => c.NetworkId == decimalNetworkId);

            if (clientInfo != null)
            {
                rankName = clientInfo.Level.ClanTag(Config);

                customRankName = await _metaService.GetPersistentMeta("rank", clientInfo);

                if (customRankName == null)
                {
                    await _metaService.AddPersistentMeta("rank", "none", clientInfo);

                    customRankName = await _metaService.GetPersistentMeta("rank", clientInfo);
                }

                if (!(customRankName.Value.Contains("none")) && !(customRankName.Value.Contains("None")) && !(customRankName.Value.Contains("NONE")))
                {
                    rankName = customRankName.Value;
                }

                var sb = new StringBuilder();
                sb.AppendLine(rankName);

                return(Content(sb.ToString()));
            }

            return(Content("Error: Client info is null"));
        }
예제 #3
0
 public async Task <int> GetBankMeta(EFClient C)
 {
     if (await _metaService.GetPersistentMeta("BankBalance", C) == null)
     {
         _ = _metaService.AddPersistentMeta("BankBalance", "0", C);
         return(0);
     }
     return(Convert.ToInt32((await _metaService.GetPersistentMeta("BankBalance", C)).Value));
 }
예제 #4
0
        public async Task OnEventAsync(GameEvent E, Server S)// => Task.CompletedTask;
        {
            if (E.Type == GameEvent.EventType.Join || E.Type == GameEvent.EventType.ChangePermission)
            {
                Thread.Sleep(10000);
                var rank_player_var = await _metaService.GetPersistentMeta(rank, E.Origin);

                rankName = E.Origin.Level.ClanTag(Config);

                rank_player_var = await _metaService.GetPersistentMeta("rank", E.Origin);

                if (rank_player_var == null)
                {
                    await _metaService.AddPersistentMeta("rank", "none", E.Origin);

                    rank_player_var = await _metaService.GetPersistentMeta("rank", E.Origin);
                }

                if (!(rank_player_var.Value.Contains("none")) && !(rank_player_var.Value.Contains("None")) && !(rank_player_var.Value.Contains("NONE")))
                {
                    rankName = rank_player_var.Value;
                }

                await S.ExecuteCommandAsync("setclantag" + " " + E.Origin.ClientNumber + " " + rankName);
            }
            if (E.Type == GameEvent.EventType.Start || E.Type == GameEvent.EventType.MapEnd || E.Type == GameEvent.EventType.MapChange)
            {
                Thread.Sleep(10000);
                IList <EFClient> currentclients = E.Owner.Manager.GetActiveClients();
                foreach (EFClient client in currentclients)
                {
                    var rank_player_var = await _metaService.GetPersistentMeta(rank, client);

                    rankName = client.Level.ClanTag(Config);

                    rank_player_var = await _metaService.GetPersistentMeta("rank", client);

                    if (rank_player_var == null)
                    {
                        await _metaService.AddPersistentMeta("rank", "none", client);

                        rank_player_var = await _metaService.GetPersistentMeta("rank", client);
                    }

                    if (!(rank_player_var.Value.Contains("none")) && !(rank_player_var.Value.Contains("None")) && !(rank_player_var.Value.Contains("NONE")))
                    {
                        rankName = rank_player_var.Value;
                    }

                    await S.ExecuteCommandAsync("setclantag" + " " + client.ClientNumber + " " + rankName);
                }
            }
            //return Task.CompletedTask;
        }
예제 #5
0
        public override async Task ExecuteAsync(GameEvent E)
        {
            //var S = E.Owner;
            rank_string = "none";
            if (E.Data != null)
            {
                rank_string = E.Data;
            }
            var rank_player_var = await _metaService.GetPersistentMeta(rank, E.Target);

            if (rank_player_var == null)
            {
                await _metaService.AddPersistentMeta(rank, "none", E.Target);

                rank_player_var = await _metaService.GetPersistentMeta(rank, E.Target);
            }

            if (rank_string.Length > 0 && rank_string.Length < 9)
            {
                await _metaService.AddPersistentMeta(rank, rank_string, E.Target);

                rank_player_var = await _metaService.GetPersistentMeta(rank, E.Target);

                if (rank_player_var.Value == "none" || rank_player_var.Value == "None" || rank_player_var.Value == "NONE")
                {
                    //E.Origin.Tell(E.Target.Name + "'s rank has been reset");
                    rank_string = E.Target.Level.ClanTag(Config);
                    E.Origin.Tell(E.Target.Name + "'s rank has been reset to: " + rank_string);
                }

                else
                {
                    rank_string = rank_player_var.Value;
                    E.Origin.Tell("New rank set: [" + rank_player_var.Value + "]" + E.Target.Name);
                }
            }
            else
            {
                E.Origin.Tell($"invalid rank length (between 1-8 characters), set rank to none, or use !ResetRank to reset");
            }


            await E.Owner.ExecuteCommandAsync("setclantag" + " " + E.Target.ClientNumber + " " + rank_string);
        }
        public override async Task ExecuteAsync(GameEvent E)
        {
            //var S = E.Owner;
            rank_string = "none";
            await _metaService.AddPersistentMeta(rank, rank_string, E.Target);

            rank_string = E.Target.Level.ClanTag(Config);
            E.Origin.Tell(E.Target.Name + "'s rank has been reset to: " + rank_string);
            await E.Owner.ExecuteCommandAsync("setclantag" + " " + E.Target.ClientNumber + " " + rank_string);
        }
예제 #7
0
        public override async Task ExecuteAsync(GameEvent E)
        {
            using (var md5 = MD5.Create())
            {
                string gravatarEmail = string.Concat(md5.ComputeHash(E.Data.ToLower().Select(d => Convert.ToByte(d)).ToArray())
                                                     .Select(h => h.ToString("x2")));
                await _metaService.AddPersistentMeta("GravatarEmail", gravatarEmail, E.Origin);
            }

            E.Origin.Tell(_translationLookup["COMMANDS_GRAVATAR_SUCCESS_NEW"]);
        }
예제 #8
0
        public override async Task ExecuteAsync(GameEvent gameEvent)
        {
            var availableTags = await _metaService.GetPersistentMeta(EFMeta.ClientTagName);

            var matchingTag = availableTags.FirstOrDefault(tag => tag.Value == gameEvent.Data);

            if (matchingTag == null)
            {
                gameEvent.Origin.Tell(_translationLookup["COMMANDS_SET_CLIENT_TAG_FAIL"].FormatExt(gameEvent.Data));
                return;
            }

            gameEvent.Target.Tag = matchingTag.Value;
            await _metaService.AddPersistentMeta(EFMeta.ClientTag, string.Empty, gameEvent.Target, matchingTag);

            gameEvent.Origin.Tell(_translationLookup["COMMANDS_SET_CLIENT_TAG_SUCCESS"].FormatExt(matchingTag.Value));
        }
예제 #9
0
        public override async Task ExecuteAsync(GameEvent gameEvent)
        {
            await _metaService.AddPersistentMeta(EFMeta.ClientTagName, gameEvent.Data);

            gameEvent.Origin.Tell(_translationLookup["COMMANDS_ADD_CLIENT_TAG_SUCCESS"].FormatExt(gameEvent.Data));
        }