Ejemplo n.º 1
0
        private static void on_ignore_player(BasicPlayerInfo player, IgnorePlayerResult r)
        {
            if (r.IsIgnored)
            {
                if (BasicPlayerInfoOps.Contains(ignored, player))
                {
                    Debug.Log("Server said to us player is ignored and the data store already have that player as ignored. Hopefully we just tried to ignore an already ignored player.");
                    return;
                }

                ignored.Add(player);
            }
        }
Ejemplo n.º 2
0
        public override async Task <IgnorePlayerResult> IgnorePlayer(IgnorePlayerAttempt request, ServerCallContext context)
        {
            var result = new IgnorePlayerResult
            {
                IsIgnored = false
            };

            Player          player;
            BasicPlayerInfo target;

            try
            {
                player = auth.GetPlayer(context);
                if (player == null)
                {
                    return(result);
                }
                var target_permanent_id = request.PlayerId;
                target = await db.GetBasicInfoOfPlayer(target_permanent_id);

                if (target == null)
                {
                    return(result);
                }
            } catch (Exception e)
            {
                Log.Exception(e);
                return(result);
            }

            try
            {
                return(await in_memory_worker.Schedule(() =>
                {
                    player.AddIgnoredPlayerIfNotAlreadyThere(target);
                    result.IsIgnored = true;
                    return result;
                }));
            } catch (Exception e)
            {
                Log.Exception(e);
                return(result);
            }
        }