github.com/LagrangeDev/LagrangeGo@v0.0.0-20240512064304-ad4a85e10cb4/client/packets/wtlogin/loginState/enum.go (about)

     1  package loginState
     2  
     3  type State int
     4  
     5  const (
     6  	TokenExpired     State = 140022015
     7  	UnusualVerify    State = 140022011
     8  	LoginFailure     State = 140022013
     9  	UserTokenExpired State = 140022016
    10  	ServerFailure    State = 140022002 //unknown reason
    11  	WrongCaptcha     State = 140022007
    12  	WrongArgument    State = 140022001
    13  	NewDeviceVerify  State = 140022010
    14  	CaptchaVerify    State = 140022008
    15  	UnknownError     State = -1
    16  	Success          State = 0
    17  )
    18  
    19  var statenames = map[State]string{
    20  	TokenExpired:     "TokenExpired",
    21  	UnusualVerify:    "UnusualVerify",
    22  	LoginFailure:     "LoginFailure",
    23  	UserTokenExpired: "UserTokenExpired",
    24  	ServerFailure:    "ServerFailure",
    25  	WrongCaptcha:     "WrongCaptcha",
    26  	WrongArgument:    "WrongArgument",
    27  	NewDeviceVerify:  "NewDeviceVerify",
    28  	CaptchaVerify:    "CaptchaVerify",
    29  	UnknownError:     "UnknownError",
    30  	Success:          "Success",
    31  }
    32  
    33  func (r State) Name() string {
    34  	name, ok := statenames[r]
    35  	if ok {
    36  		return name
    37  	}
    38  	return "Unknown"
    39  }
    40  
    41  func (r State) Missing() bool {
    42  	return r == UnknownError
    43  }
    44  
    45  func (r State) Successful() bool {
    46  	return r == Success
    47  }