示例#1
0
        public static void ProcessLoginRequest(string username, string password, int playerNumber)
        {
            int groupID  = 0;
            int playerID = 0;

            for (int i = 0; i < Network.Players.Length; i++)
            {
                if (Network.Players[i].Username.ToLower() == username.ToLower())
                {
                    Network.SendTextToPlayer("This account is already logged on in this server.", playerNumber);
                    return;
                }
            }
            if (DatabaseController.Login(ref username, password, ref playerID, ref groupID))
            {
                Network.Players[playerNumber].Username = username;
                Network.Players[playerNumber].ID       = playerID;
                if (groupID == 0)
                {
                    groupID = Network.DefaultGroup.ID;
                    DatabaseController.SetPlayerGroup(playerID, groupID);
                }
                Network.Players[playerNumber].Group = Network.GetGroupByID(groupID);
                if (Network.Players[playerNumber].UsingHEROsMod)
                {
                    LoginSuccess(playerNumber);
                }
                Network.SendTextToPlayer("You have successfully logged in.  You are in the " + Network.Players[playerNumber].Group.Name + " Group.", playerNumber, Color.Green);
            }
            else
            {
                Network.SendTextToPlayer("Invalid Username or Password", playerNumber, Color.Red);
            }
        }
示例#2
0
        public static void ProcessLoginRequest(string username, string password, int playerNumber)
        {
            int groupID  = 0;
            int playerID = 0;

            for (int i = 0; i < Network.Players.Length; i++)
            {
                if (Network.Players[i].Username.ToLower() == username.ToLower())
                {
                    Network.SendTextToPlayer(HEROsMod.HeroText("AccountAlreadyLoggedIn"), playerNumber);
                    return;
                }
            }
            if (DatabaseController.Login(ref username, password, ref playerID, ref groupID))
            {
                Network.Players[playerNumber].Username = username;
                Network.Players[playerNumber].ID       = playerID;
                if (groupID == 0)
                {
                    groupID = Network.DefaultGroup.ID;
                    DatabaseController.SetPlayerGroup(playerID, groupID);
                }
                Network.Players[playerNumber].Group = Network.GetGroupByID(groupID);
                if (Network.Players[playerNumber].UsingHEROsMod)
                {
                    LoginSuccess(playerNumber);
                }
                Network.SendTextToPlayer(string.Format(HEROsMod.HeroText("LoggedInSuccessfully"), Network.Players[playerNumber].Group.Name), playerNumber, Color.Green);
            }
            else
            {
                Network.SendTextToPlayer(HEROsMod.HeroText("InvalidUsernameOrPassword"), playerNumber, Color.Red);
            }
        }