Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using ShatteredRelic.Networking;
- using UnityEngine;
- public class RequestLogin : IMessageBuilder
- {
- /// <summary>
- /// Represents the Username Request
- /// </summary>
- private string Username;
- /// <summary>
- /// Represents the Password Request
- /// </summary>
- private string Password;
- /// <summary>
- /// Represents if Logging into the World
- /// </summary>
- private bool World;
- /// <summary>
- /// Represents the Character Name
- /// </summary>
- private string CharacterName;
- /// <summary>
- /// Creates a new Request Default Login Packet
- /// </summary>
- /// <param name="Username"></param>
- /// <param name="Password"></param>
- public RequestLogin(string Username, string Password)
- {
- this.Username = Username;
- this.Password = Password;
- }
- /// <summary>
- /// Creates a new Request Login Packet
- /// </summary>
- /// <param name="Username"></param>
- /// <param name="Password"></param>
- /// <param name="CharacterName"></param>
- public RequestLogin(string Username, string Password, string CharacterName)
- {
- this.Username = Username;
- this.Password = Password;
- this.CharacterName = CharacterName;
- World = true;
- }
- /// <summary>
- /// Builds a Login Request to send to the Server
- /// </summary>
- /// <returns></returns>
- public OutputByteBuffer Build() {
- OutputByteBuffer buffer = new OutputByteBuffer((int) ClientMessages.LOGIN_REQUEST);
- buffer.writeByte(1);
- buffer.writeInt(116);
- buffer.writeShort(10267);
- buffer.writeString(Username);
- buffer.writeString(Password);
- buffer.writeByte(World ? 1 : 0);
- if (World)
- buffer.writeString(CharacterName);
- Debug.Log("Sending Login Request: " + Username + ", " + Password);
- return buffer;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement