Пример #1
0
bool Socket::HandleVerpassInput()
{
    Player* mob = GetPlayer();
    std::string input = PopCommand();

    if (!IsValidPassword(input))
        {
            Write("That password isn't valid, please try again.\n");
            return true;
        }

    mob->SetTempPassword(input);
//passwords  did not match, transfer control back to new password.
    if (!mob->ComparePassword())
        {
            Write("That password isn't valid, please try again.\n");
            SetConnectionType(ConnectionType::Newpass);
            return true;
        }

    Write(TELNET_ECHO_OFF);
    Write("What is your gender? Please enter male or female.\n");
    SetConnectionType(ConnectionType::Gender);

    return true;
}
Пример #2
0
bool Socket::HandleNameInput()
{
    Player* mob = nullptr;
    std::string input;
    World* world = World::GetPtr();
    Server* server = world->GetServer();
    input = PopCommand();

//new player:
    if (input=="new")
        {
            Write("Welcome, what name would you like?\n");
            AllocatePlayer();
            mob = GetPlayer();
            SetConnectionType(CON_Newname);
            return true;
        }

//checks to see if the username is valid
    if (!IsValidUserName(input))
        {
            Write("Invalid name, try again.\n");
            return true;
        }

//check to see if the player exists
    if (!PlayerExists(input))
        {
            Write("That player doesn't exist.\nWhat is your name? Type new for a new character.\n");
            return true;
        }

    mob = server->GetLinkdeadUser(input);
    if (mob)
        {
            _mobile = mob;
            Write(TELNET_ECHO_OFF);
            Write("\n");
            Write("Password?\n");
            SetConnectionType(CON_Password);
            return true;
        }

    AllocatePlayer();
    mob = GetPlayer();
//set the players name to the one specified and try to load the file.
    mob->SetName(input);
    mob->Load();

    Write(TELNET_ECHO_OFF);
    Write("\n");
    Write("Password?\n");
    SetConnectionType(CON_Password);
    return true;
}
Пример #3
0
bool Socket::HandlePasswordInput()
{
    World* world = World::GetPtr();
    Server* server = world->GetServer();
    Player* mobile = GetPlayer();
    std::string input;

    input = PopCommand();
    mobile->SetTempPassword(input);

    if (!mobile->ComparePassword())
        {
            Write("That password isn't valid!\n");
            mobile->IncInvalidPassword();
            return false;
        }

    Write(TELNET_ECHO_ON);
    SetConnectionType(CON_Game);
    mobile->SetSocket(this);
    if (server->GetLinkdeadUser(mobile->GetName()))
        {
            server->RemoveLinkdeadUser(mobile->GetName());
            Write("Reconnected.\n");
            return true;
        }

    mobile->SetLastLogin((UINT)time(NULL));
    mobile->EnterGame(false);
    return true;
}
Пример #4
0
bool Socket::HandleNameInput()
{
    Player* mob = nullptr;
    std::string input;

//we associate a player with the socket object so we can store data and later load.
    AllocatePlayer();
    mob = GetPlayer();
    input = PopCommand();

//new player:
    if (input=="new")
        {
            Write("Welcome, what name would you like?\n");
            SetConnectionType(ConnectionType::Newname);
            return true;
        }

//checks to see if the username is valid
    if (!IsValidUserName(input))
        {
            Write("Invalid name, try again.\n");
            return true;
        }

//check to see if the player exists
    if (!PlayerExists(input))
        {
            Write("That player doesn't exist.\nWhat is your name? Type new for a new character.\n");
            return true;
        }

//set the players name to the one specified and try to load the file.
    mob->SetName(input);
    mob->Load();

    Write(TELNET_ECHO_OFF);
    Write("\n");
    Write("Password?\n");
    SetConnectionType(ConnectionType::Password);
    return true;
}
Пример #5
0
bool Socket::HandleNewpassInput()
{
    std::string input;
    Player* mob = GetPlayer();

    input=PopCommand();
    if (!IsValidPassword(input))
        {
            Write("That password isn't valid, please try again.\n");
            return true;
        }

//transfer control to password verification
    Write("Please re-enter your password for varification.\n");
    mob->SetPassword(input);
    SetConnectionType(ConnectionType::Verpass);

    return true;
}
Пример #6
0
void Socket::InitializeNewPlayer()
{
    Player* mob = GetPlayer();
    World* world = World::GetPtr();

    mob->InitializeUuid();
//passwords matched, see if the player is the first user. If so, make it a god.
    if (IsFirstUser())
        {
            mob->SetRank(RANK_PLAYER|RANK_PLAYTESTER|RANK_NEWBIEHELPER|RANK_BUILDER|RANK_ADMIN|RANK_GOD);
            Write("You are the first player to create, rank set to God.\n");
        }

    mob->SetFirstLogin((UINT)time(NULL));
//Set the connection type to game and enter the player.
    SetConnectionType(ConnectionType::Game);
    mob->SetSocket(this);
//call the Create event:
    mob->EnterGame(false);
    world->events.CallEvent("PlayerCreated", NULL, (void*)mob);
}
Пример #7
0
bool Socket::HandlePasswordInput()
{
    Player* mobile = GetPlayer();
    std::string input;

    input = PopCommand();
    mobile->SetTempPassword(input);

    if (!mobile->ComparePassword())
        {
            Write("That password isn't valid!\n");
            mobile->IncInvalidPassword();
            return false;
        }

    Write(TELNET_ECHO_ON);
    SetConnectionType(ConnectionType::Game);
    mobile->SetSocket(this);
    mobile->SetLastLogin((UINT)time(NULL));
    mobile->EnterGame(false);

    return true;
}
Пример #8
0
bool Socket::HandleNewnameInput()
{
    std::string input;
    Player* mobile = GetPlayer();
    input = PopCommand();

    if (!IsValidUserName(input))
        {
            Write("That is not a valid username. Usernames must contain 4-12 characters.\nWhat name would you like?\n");
            return true;
        }
    if (PlayerExists(input))
        {
            Write("That player already exists, please try again.\nWhat name would you like?\n");
            return true;
        }

    Write("Please choose a password. Please make your password between 5 and 20 characters long.\nStrong passwords contain both lower and uppercase letters, numbers, letters and a dash ('-').\nEnter your new password?\n");
    Write(TELNET_ECHO_OFF);
//name was valid, set it in the player class.
    mobile->SetName(input);
    SetConnectionType(ConnectionType::Newpass);
    return true;
}