Tried to manually merge kamilprzyb and main repo's code (#45)

* Merge kamilprzyb and main repo's code

* Update Makefile by FunnHornhoover

* Update Makefile by FinnHornhoover

* Add flag to Makefile by FinnHornhoover

* Remove extra line from makefile

* Remove lbcrypt from Makefile

* Fix flag to Makefile by FinnHornhoover

* Reimplement potential fix for tutorial blackscreen by Dongresources

* Update CMakeLists.txt

* Update CMakeLists.txt

* Reinsert Jade's changes

* Cosmetic Changes to Databases .h & .cpp

* Remove CMakeSettings.json

* Update Makefile by Finn Hornhoover

* More cosmetic changes to Databases.cpp

* More cosmetic changes to Databases.cpp

* Remove unnecessary line (CMakeSettings.json)

* Fix CNLoginServer.cpp

* More cosmetic Changes to Database.hpp, edit Database.cpp to use JSON library onstead of json11 library, and delete json11 library files

* Delete json11 library files

* Delete JSON library to reupload

* Reupload JSON library from main repo

* Reupload JSON library from main repo

* Fix syntax error

* Fix Makefile

* Remove commented line of code to be like master

Co-authored-by: CPunch <sethtstubbs@gmail.com>
This commit is contained in:
darkredtitan
2020-08-28 20:02:03 +02:00
committed by GitHub
parent 5c8a0069fc
commit 5cf7225f52
28 changed files with 268523 additions and 53 deletions

31
src/Database.hpp Normal file
View File

@@ -0,0 +1,31 @@
#pragma once
#include "CNStructs.hpp"
#include "Player.hpp"
#include <list>
#include <string>
namespace Database {
void open();
//checks regex
bool isLoginDataGood(std::string login, std::string password);
void addAccount(std::string login, std::string password);
bool doesUserExist(std::string login);
bool isPasswordCorrect(std::string login, std::string password);
int getUserID(std::string login);
int getUserSlotsNum(int AccountId);
bool isNameFree(std::string First, std::string Second);
//after chosing name
void createCharacter(sP_CL2LS_REQ_SAVE_CHAR_NAME* save, int AccountID);
//after finishing creation
void finishCharacter(sP_CL2LS_REQ_CHAR_CREATE* character);
void finishTutorial(int PlayerID);
//returns slot nr if success
int deleteCharacter(int characterID, int accountID);
int getCharacterID(int AccountID, int slot);
std::list <Player> getCharacters(int userID);
//some json parsing crap
std::string CharacterToJson(sP_CL2LS_REQ_SAVE_CHAR_NAME* save);
std::string CharacterToJson(sP_CL2LS_REQ_CHAR_CREATE* character);
Player JsonToPlayer(std::string input, int PC_UID);
std::string PlayerToJson(Player player);
}