Exemplo n.º 1
0
        public void Invoke(ShPlayer player, string target = null)
        {
            if (target != null && !player.svPlayer.HasPermission($"{Core.Instance.Info.GroupNamespace}.{nameof(WarnList)}.viewotherplayers"))
            {
                player.TS("warns_noPermission_viewOtherPlayers");
                return;
            }

            if (target == null)
            {
                SendWarnList(player, player.username, player.GetWarns());
                return;
            }

            if (EntityCollections.TryGetPlayerByNameOrID(target, out var shTarget))
            {
                SendWarnList(player, shTarget.username, shTarget.GetWarns());
                return;
            }

            if (Core.Instance.SvManager.TryGetUserData(target, out var user))
            {
                SendWarnList(player, user.ID, user.GetWarns());
                return;
            }

            player.TS("user_not_found", target.CleanerMessage());
        }
Exemplo n.º 2
0
        public void Invoke(ShPlayer player, string target, int warnId)
        {
            if (warnId < 1)
            {
                player.TS("warn_remove_error_null_or_negative", warnId.ToString());
                return;
            }

            if (EntityCollections.TryGetPlayerByNameOrID(target, out var shTarget))
            {
                if (CheckWarnCount(player, warnId, shTarget.GetWarns()))
                {
                    return;
                }
                shTarget.RemoveWarn(warnId - 1);
                return;
            }

            if (Core.Instance.SvManager.TryGetUserData(target, out var user))
            {
                if (CheckWarnCount(player, warnId, user.GetWarns()))
                {
                    return;
                }
                user.RemoveWarn(warnId - 1);
                Core.Instance.SvManager.database.Users.Upsert(user);
                return;
            }

            player.TS("user_not_found", target.CleanerMessage());
        }
Exemplo n.º 3
0
Arquivo: Info.cs Projeto: ggggg/Core
        public void Invoke(ShPlayer player, string targetStr)
        {
            StringBuilder sb;
            var           target = Core.Instance.SvManager.database.Users.FindById(targetStr);

            if (target != null)
            {
                sb = GetOfflineInfo(target);
            }
            else if (EntityCollections.TryGetPlayerByNameOrID(targetStr, out ShPlayer shPlayer))
            {
                sb = GetOnlineInfo(shPlayer);
            }
            else
            {
                player.SendChatMessage($"No account found with the id '{targetStr}'.");
                return;
            }
            player.svPlayer.Send(SvSendType.Self, Channel.Reliable, ClPacket.ServerInfo, sb.ToString());
        }
Exemplo n.º 4
0
        public void Invoke(ShPlayer player, string target, string reason)
        {
            if (EntityCollections.TryGetPlayerByNameOrID(target, out var shTarget))
            {
                shTarget.AddWarn(player, reason);
                ChatUtils.SendToAllEnabledChatT("all_warned", player.username.CleanerMessage(), shTarget.username.CleanerMessage(), reason.CleanerMessage());
                player.TS("player_warn", shTarget.username.CleanerMessage(), reason.CleanerMessage());
                shTarget.TS("target_warn", shTarget.username.CleanerMessage(), reason.CleanerMessage());
                return;
            }

            if (Core.Instance.SvManager.TryGetUserData(target, out var user))
            {
                user.AddWarn(player, reason);
                ChatUtils.SendToAllEnabledChatT("all_warned", player.username.CleanerMessage(), target.CleanerMessage(), reason.CleanerMessage());
                player.TS("player_warn", target.CleanerMessage(), reason.CleanerMessage());
                Core.Instance.SvManager.database.Users.Upsert(user);
                return;
            }

            player.TS("user_not_found", target.CleanerMessage());
        }
Exemplo n.º 5
0
        public void Invoke(ShPlayer player, string targetStr)
        {
            StringBuilder sb;

            if (EntityCollections.TryGetPlayerByNameOrID(targetStr, out ShPlayer shPlayer))
            {
                sb = GetOnlineInfo(shPlayer);
            }
            else
            {
                var target = Core.Instance.SvManager.database.Users.FindById(targetStr);
                if (target != null)
                {
                    sb = GetOfflineInfo(target);
                }
                else
                {
                    player.SendChatMessage($"No account found with the id '{targetStr}'.");
                    return;
                }
            }
            player.svPlayer.SendTextMenu(player.T("info_title"), sb.ToString());
        }
Exemplo n.º 6
0
 public HackingContainer(ShPlayer player, int apartmentID, string username)
 {
     this.player     = player;
     targetApartment = EntityCollections.FindByID <ShApartment>(apartmentID);
     EntityCollections.TryGetPlayerByNameOrID(username, out targetPlayer);
 }
Exemplo n.º 7
0
 public HackingContainer(ShPlayer player, int apartmentID, string username) : base(player, apartmentID)
 {
     targetApartment = targetEntity as ShApartment;
     EntityCollections.TryGetPlayerByNameOrID(username, out targetPlayer);
 }