updated readme & small refactor

This commit is contained in:
CPunch 2020-09-07 12:23:00 -05:00
parent 458843958b
commit c8c4ec7d01
3 changed files with 9 additions and 2 deletions

View File

@ -115,3 +115,7 @@ To make your landwalking experience more pleasant, you can make use of a few adm
* `/nano_equip [id] (1-36) [slot] (0-2)`
* `/nano_unequip [slot] (0-2)`
* `/nano_active [slot] (0-2)`
## Accounts
A basic account system has been added, when logging in if the username doesn't exist in the database, a new account with the provided password will be made and you'll be automatically logged in. Otherwise a login attempt will be made. A username must be between 4 and 32 characters, and a password must be between 8 and 32 characters otherwise the account will be rejected. Characters currently save only upon creation, any items add/traded will not be saved.

View File

@ -340,13 +340,16 @@ void CNLoginServer::handlePacket(CNSocket* sock, CNPacketData* data) {
case P_CL2LS_REQ_PC_EXIT_DUPLICATE:{
if (data->size != sizeof(sP_CL2LS_REQ_PC_EXIT_DUPLICATE))
return;
sP_CL2LS_REQ_PC_EXIT_DUPLICATE* exit = (sP_CL2LS_REQ_PC_EXIT_DUPLICATE*)data->buf;
auto account = Database::findAccount(U16toU8(exit->szID));
if (account == nullptr)
break;
int accountId = account->AccountID;
if (!exitDuplicate(accountId))
PlayerManager::exitDuplicate(accountId);
PlayerManager::exitDuplicate(accountId);
break;
}
default:

View File

@ -73,7 +73,7 @@ void Database::open()
int Database::addAccount(std::string login, std::string password)
{
password = BCrypt::generateHash(password);
Account x;
Account x = {};
x.Login = login;
x.Password = password;
x.Selected = 1;