예제 #1
0
        public void CMD_Ban(Client client, Client player, string grund)
        {
            Players tarInfo = PlayerHelper.GetPlayer(player);
            Players p       = PlayerHelper.GetPlayer(player);
            BanLog  Banlog  = PlayerHelper.BanLogs(client);

            if (!AdminSystem.HasRank(client, 2))
            {
                client.SendNotification("~r~Vous n'avez pas l'autorisation!");
                return;
            }

            if (p.username == null)
            {
                client.SendNotification("Le joueur n'existe pas!");
            }

            tarInfo.ban = 1;
            Database.Update(tarInfo);
            tarInfo.Update();
            player.SendChatMessage("~r~Vous avez été banni!");
            NAPI.Chat.SendChatMessageToAll($"[~r~SERVER~w~]Le joueur {player.Name} à cause de: {grund}, ~r~ban");
            client.SendNotification($"Vous avez ban le joueur { player.Name} avec succès!");
            Banlog          = new BanLog();
            Banlog.banned   = player.Name;
            Banlog.bannedby = client.Name;
            Banlog.grund    = grund;
            Database.Upsert(Banlog);
            player.Kick();
        }
예제 #2
0
        public void CMD_UnBan(Client client, Client player)
        {
            Players tarInfo = PlayerHelper.GetPlayer(player);

            if (!AdminSystem.HasRank(client, 2))
            {
                client.SendNotification("~r~Vous n'avez pas l'autorisation!");
                return;
            }

            if (tarInfo == null)
            {
                client.SendNotification("Le joueur n'a pas pu être trouvé dans la base de données.");
                return;
            }

            if (tarInfo.ban <= 0 && tarInfo.ban >= 2)
            {
                client.SendNotification("Le joueur n'est pas banni!");
                return;
            }

            if (tarInfo.ban == 1)
            {
                tarInfo.ban = 0;
                client.SendNotification("Le joueur a été deban avec succès!");
                tarInfo.Update();
            }
        }
예제 #3
0
        public void CMD_MakeAdmin(Client client, string playerName, int rank)
        {
            Client player = NAPI.Player.GetPlayerFromName(playerName);

            if (!AdminSystem.HasRank(client, 3))
            {
                client.SendNotification("~r~Du hast dazu keine Berechtigung!");
                return;
            }

            if (player != null)
            {
                if (AdminSystem.SetRank(client, playerName, rank))
                {
                    client.SendNotification("Rank wurde gesetzt!");
                    return;
                }
                else
                {
                    client.SendNotification("Rank wurde NICHT gesetzt!");
                    return;
                }
            }
            else
            {
                client.SendChatMessage("Spieler wurde nicht gefunden!");
                return;
            }
        }
예제 #4
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         Admin admin = new Admin();
         admin.UserName      = UserName.Text.ToString();
         admin.Password      = FormsAuthentication.HashPasswordForStoringInConfigFile(Password.Text.ToString(), "MD5");
         admin.LastLoginIP   = Request.UserHostAddress;
         admin.LastLoginTime = DateTime.Now;
         AdminSystem adminSystem = new AdminSystem();
         if (!adminSystem.Login_Admin(admin.UserName))
         {
             if (adminSystem.Add_Admin(admin) > 0)
             {
                 Response.Write("<script>alert('添加成功');location.href='Get_admin.aspx';</script>");
             }
             else
             {
                 Response.Write("<script>alert('添加失败');location.href='Get_admin.aspx';</script>");
             }
         }
         else
         {
             Response.Write("<script>alert('管理员已存在');history.back(1);</script>");
         }
     }
 }
예제 #5
0
 protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
 {
     if (Page.IsValid)
     {
         if (sValidator == Code.Text.ToString())
         {
             AdminSystem adminSystem = new AdminSystem();
             Admin       admin       = new Admin();
             admin = adminSystem.Get_SingAdmin(UserName.Text.ToString());
             if (admin.UserName == UserName.Text.ToString())
             {
                 if (FormsAuthentication.HashPasswordForStoringInConfigFile(PassWord.Text.ToString(), "MD5") == admin.Password.ToString())
                 {
                     Session["Admin_User"] = UserName.Text.ToString();
                     Response.Redirect("Default.aspx", false);
                 }
                 else
                 {
                     Response.Write("<script>alert('管理员密码错误');location.href='login.aspx';</script>");
                 }
             }
             else
             {
                 Response.Write("<script>alert('管理员不存在');location.href='login.aspx';</script>");
             }
         }
         else
         {
             Response.Write("<script>alert('验证码错误');location.href='login.aspx';</script>");
         }
     }
 }
예제 #6
0
        public void CMD_Ban(Client client, Client player, string grund)
        {
            Players tarInfo = PlayerHelper.GetPlayer(player);
            Players p       = PlayerHelper.GetPlayer(player);
            BanLog  Banlog  = PlayerHelper.BanLogs(client);

            if (!AdminSystem.HasRank(client, 2))
            {
                client.SendNotification("~r~Du hast dazu keine Berechtigung!");
                return;
            }

            if (p.username == null)
            {
                client.SendNotification("Spieler existiert nicht!");
            }

            tarInfo.ban = 1;
            Database.Update(tarInfo);
            tarInfo.Update();
            player.SendChatMessage("~r~Du wurdest gebannt!");
            NAPI.Chat.SendChatMessageToAll($"[~r~SERVER~w~]Der Spieler {player.Name} wurde wegen: {grund}, ~r~gebannt!");
            client.SendNotification($"Du hast den Spieler {player.Name} erfolgreich gebannt!");
            Banlog          = new BanLog();
            Banlog.banned   = player.Name;
            Banlog.bannedby = client.Name;
            Banlog.grund    = grund;
            Database.Upsert(Banlog);
            player.Kick();
        }
예제 #7
0
        public void CMD_DelWarn(Client client, Client player)
        {
            //Spieler Statistiken
            PlayerInfo leaderInfo = PlayerHelper.GetPlayerStats(client);
            Players    playerInfo = PlayerHelper.GetPlayer(player);

            //Abfrage ob man ein Leader ist
            if (!AdminSystem.HasRank(client, 1))
            {
                client.SendNotification("~r~Tu n'es pas Admin.");
                return;
            }

            if (client.Name == player.Name)
            {
                client.SendNotification("~r~Vous ne pouvez pas vous spécifier vous même");
                return;
            }

            if (playerInfo.warn == 0)
            {
                player.SendNotification("Le joueur n'a pas d'avertissement");
                return;
            }

            playerInfo.warn -= 1;
            playerInfo.Update();

            player.SendChatMessage($"[~r~Server~w~]: un avertissement à été suppriméx. Il possède maintenant {playerInfo.warn} avertissement(s).");
        }
예제 #8
0
        public void CMD_DelWarn(Client client, Client player)
        {
            //Spieler Statistiken
            PlayerInfo leaderInfo = PlayerHelper.GetPlayerStats(client);
            Players    playerInfo = PlayerHelper.GetPlayer(player);

            //Abfrage ob man ein Leader ist
            if (!AdminSystem.HasRank(client, 1))
            {
                client.SendNotification("~r~Du bist kein Admin!");
                return;
            }

            if (client.Name == player.Name)
            {
                client.SendNotification("~r~Du kannst dich nicht selber angeben!");
                return;
            }

            if (playerInfo.warn == 0)
            {
                player.SendNotification("Spieler besitzt keine Warn's!");
                return;
            }

            playerInfo.warn -= 1;
            playerInfo.Update();

            player.SendChatMessage($"[~r~Server~w~]: Eine Verwarnung wurde entfernt! du besitzt nun {playerInfo.warn} Verwarnungen.");
        }
예제 #9
0
        public void CMD_MakeAdmin(Client client, string playerName, int rank)
        {
            Client player = NAPI.Player.GetPlayerFromName(playerName);

            if (!AdminSystem.HasRank(client, 3))
            {
                client.SendNotification("~r~Vous n'avez pas l'autorisation!");
                return;
            }

            if (player != null)
            {
                if (AdminSystem.SetRank(client, playerName, rank))
                {
                    client.SendNotification("Le rang à était défini!");
                    return;
                }
                else
                {
                    client.SendNotification("Le rang n'a pas était défini!");
                    return;
                }
            }
            else
            {
                client.SendChatMessage("Le joueur n'a pas été trouvé!");
                return;
            }
        }
예제 #10
0
        public void CMD_Warn(Client client, Client player)
        {
            //Spieler Statistiken
            PlayerInfo leaderInfo = PlayerHelper.GetPlayerStats(client);
            PlayerInfo playerInfo = PlayerHelper.GetPlayerStats(player);

            //Abfrage ob man ein Leader ist
            if (!AdminSystem.HasRank(client, 1))
            {
                client.SendNotification("~r~Du bist kein Admin!");
                return;
            }

            if (client.Name == player.Name)
            {
                client.SendNotification("~r~Du kannst dich nicht selber angeben!");
                return;
            }

            playerInfo.warn += 1;
            playerInfo.Update();

            player.SendChatMessage($"[~r~Server~w~]: Du bekamst eine Verwarnung und besitzt nun ~r~{playerInfo.warn}~w~ Verwarnungen.");

            if (playerInfo.warn == 3)
            {
                player.SendChatMessage("[~r~Server~w~]: Du besitzt zu viele Verwarnungen weswegen du auf diesem Server gesperrt wurdest!");

                playerInfo.ban = 1;
                playerInfo.Update();

                player.Kick();
            }
        }
        private void SaveMultiDocUpload(string dbConnectionString, string dbPwd, byte sid, bool overwrite)
        {
            if (Request.Files.Count > 0 && Request.Files[0].FileName != string.Empty)
            {
                byte[] dc;
                using (System.IO.BinaryReader sm = new BinaryReader(Request.Files[0].InputStream))
                {
                    dc = new byte[Request.Files[0].InputStream.Length];
                    sm.Read(dc, 0, dc.Length); sm.Close();
                }
                // In case DocId has not been saved properly, always find the most recent to replace as long as it has the same file name:
                string DocId = string.Empty;
                DocId = new AdminSystem().GetDocId(Request.QueryString["key"], Request.QueryString["tbl"], Path.GetFileName(Request.Files[0].FileName), base.LUser.UsrId.ToString(), dbConnectionString, dbPwd);
                if (DocId == string.Empty || !overwrite)
                {
                    DocId = new AdminSystem().AddDbDoc(Request.QueryString["key"], Request.QueryString["tbl"], Path.GetFileName(Request.Files[0].FileName), Request.Files[0].ContentType, dc.Length, dc, dbConnectionString, dbPwd, base.LUser);
                }
                else
                {
                    new AdminSystem().UpdDbDoc(DocId, Request.QueryString["tbl"], Path.GetFileName(Request.Files[0].FileName), Request.Files[0].ContentType, dc.Length, dc, dbConnectionString, dbPwd, base.LUser);
                }

                Response.Buffer = true; Response.ClearHeaders(); Response.ClearContent();
                string json = "{\"newDocId\":\"" + DocId + "\"}";
                Response.Clear();
                Response.ContentType = "application/json; charset=utf-8";
                Response.Write(json);
                Response.End();
            }
        }
예제 #12
0
        public void CMD_UnBan(Client client, Client player)
        {
            Players tarInfo = PlayerHelper.GetPlayer(player);

            if (!AdminSystem.HasRank(client, 2))
            {
                client.SendNotification("~r~Du hast dazu keine Berechtigung!");
                return;
            }

            if (tarInfo == null)
            {
                client.SendNotification("Spieler konnte in der Datenbank NICHT gefunden werden.");
                return;
            }

            if (tarInfo.ban <= 0 && tarInfo.ban >= 2)
            {
                client.SendNotification("Spieler ist nicht gebannt!");
                return;
            }

            if (tarInfo.ban == 1)
            {
                tarInfo.ban = 0;
                client.SendNotification("Spieler wurde erfolgreich entbannt!");
                tarInfo.Update();
            }
        }
예제 #13
0
    protected void Admin_List_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int         nID         = Int32.Parse(Admin_List.DataKeys[e.RowIndex].Value.ToString());
        AdminSystem adminSystem = new AdminSystem();

        adminSystem.Delete_Admin(nID);
        BinData();
    }
예제 #14
0
 public IActionResult DeleteBackupByFname([FromQuery] string fname)
 {
     if (Backup.DeleteBackupByFname(fname))
     {
         AdminSystem.AddLog(GetAdminName(), "删除时间为" + fname + "的备份");
         return(Json(new { code = 0, msg = "删除成功!" }));
     }
     return(Json(new { code = -1, msg = "删除失败!" }));
 }
예제 #15
0
 public IActionResult Restore([FromQuery] string fname)
 {
     if (Backup.Load(fname))
     {
         AdminSystem.AddLog(GetAdminName(), "恢复数据库为当前状态");
         return(Json(new { code = 0, msg = "恢复成功!" }));
     }
     return(Json(new { code = -1, msg = "恢复失败!" }));
 }
예제 #16
0
 public IActionResult Backups()
 {
     if (Backup.Save())
     {
         AdminSystem.AddLog(GetAdminName(), "备份当前数据库");
         return(Json(new { code = 0, msg = "备份成功!" }));
     }
     return(Json(new { code = -1, msg = "备份失败!" }));
 }
예제 #17
0
 public PlayerTab()
 {
     _adminSystem = EntitySystem.Get <AdminSystem>();
     RobustXamlLoader.Load(this);
     RefreshPlayerList(_adminSystem.PlayerList);
     _adminSystem.PlayerListChanged += RefreshPlayerList;
     OverlayButtonOn.OnPressed      += _adminSystem.AdminOverlayOn;
     OverlayButtonOff.OnPressed     += _adminSystem.AdminOverlayOff;
 }
예제 #18
0
    public void BinData()
    {
        AdminSystem  adminSystem = new AdminSystem();
        List <Admin> List_Admin  = new List <Admin>();

        List_Admin            = adminSystem.Get_Admin();
        Admin_List.DataSource = List_Admin;
        Admin_List.DataBind();
    }
예제 #19
0
        public void CMD_AC(Client client, string message)
        {
            if (!AdminSystem.HasRank(client, 1))
            {
                client.SendNotification("~r~Vous n'avez aucune autorisation!");
                return;
            }

            NAPI.Chat.SendChatMessageToAll($"[~r~AC~w~] {client.Name} dit: {message}");
        }
예제 #20
0
        public void CMD_SetHealth(Client client, int wert)
        {
            if (!AdminSystem.HasRank(client, 3))
            {
                client.SendNotification("~r~Du hast dazu keine Berechtigung!");
                return;
            }

            client.Health = wert;
        }
예제 #21
0
        public void CMD_AC(Client client, string message)
        {
            if (!AdminSystem.HasRank(client, 1))
            {
                client.SendNotification("~r~Du hast dazu keine Berechtigung!");
                return;
            }

            NAPI.Chat.SendChatMessageToAll($"[~r~AC~w~] {client.Name} sagt: {message}");
        }
예제 #22
0
        public void CMD_GetWeapon(Client client, WeaponHash hash)
        {
            if (!AdminSystem.HasRank(client, 2))
            {
                client.SendNotification("~r~Du hast dazu keine Berechtigung!");
                return;
            }

            client.GiveWeapon(hash, 999);
        }
예제 #23
0
        public void CMD_Teleport(Client client, Client player1, Client player2)
        {
            if (!AdminSystem.HasRank(client, 1))
            {
                client.SendNotification("~r~Du hast dazu keine Berechtigung!");
                return;
            }

            player1.Position = player2.Position;
        }
예제 #24
0
        public void CMD_GoTo(Client client, Client player)
        {
            if (!AdminSystem.HasRank(client, 1))
            {
                client.SendNotification("~r~Du hast dazu keine Berechtigung!");
                return;
            }

            client.Position = player.Position;
        }
예제 #25
0
        public void CMD_SetWeather(Client client, string weather)
        {
            if (!AdminSystem.HasRank(client, 2))
            {
                client.SendNotification("~r~Du bist dazu nicht befugt!");
                return;
            }

            NAPI.World.SetWeather(weather);
        }
        private void TranslateItems()
        {
            DataTable   dtLabel = GetLabels();
            AdminSystem adm     = new AdminSystem();

            if (dtLabel != null)
            {
                TranslateItem(cImage, dtLabel.Rows, "cHelpImg");
            }
        }
예제 #27
0
        public async Task <IActionResult> GetAdmins([FromQuery] AdminDtoParameters parameters)
        {
            if (!JudgeRoles(1))
            {
                return(Json(new { code = -1, msg = "您没有权限进行此操作!" }));
            }
            var admins = await AdminSystem.GetAdminsAsync(parameters);

            return(Ok(new { code = 0, data = new { items = admins, total = admins.TotalCount } }));
        }
예제 #28
0
        public void CMD_SetTime(Client client, int hours, int minutes, int seconds)
        {
            if (!AdminSystem.HasRank(client, 2))
            {
                client.SendNotification("~r~Du bist dazu nicht befugt!");
                return;
            }

            NAPI.World.SetTime(hours, minutes, seconds);
        }
예제 #29
0
        public void CMD_SetHealth(Client client, int wert)
        {
            if (!AdminSystem.HasRank(client, 3))
            {
                client.SendNotification("~r~Vous n'avez aucune autorisation!");
                return;
            }

            client.Health = wert;
        }
예제 #30
0
        public void CMD_GetHere(Client client, Client player1, Client player2)
        {
            if (!AdminSystem.HasRank(client, 1))
            {
                client.SendNotification("~r~Du hast dazu keine Berechtigung!");
                return;
            }

            player1.Position = new Vector3(player2.Position.X, player2.Position.Y, player2.Position.Z);
        }