Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: sql/0055_add_user_birthdate.sql
- ===================================================================
- --- sql/0055_add_user_birthdate.sql (revision 0)
- +++ sql/0055_add_user_birthdate.sql (revision 0)
- @@ -0,0 +1 @@
- +ALTER TABLE `users` ADD `birthdate` DATE NOT NULL DEFAULT '0000-00-00' AFTER `gm`;
- Index: src/LoginServer/Characters.cpp
- ===================================================================
- --- src/LoginServer/Characters.cpp (revision 1551)
- +++ src/LoginServer/Characters.cpp (working copy)
- @@ -193,36 +193,40 @@
- void Characters::deleteCharacter(PlayerLogin *player, PacketReader &packet) {
- int32_t data = packet.getInt();
- int32_t id = packet.getInt();
- -
- +
- if (!ownerCheck(player, id)) {
- // hacking
- return;
- }
- - mysqlpp::Query query = Database::getCharDB().query();
- + if (data == player->getBirthdate()) {
- + mysqlpp::Query query = Database::getCharDB().query();
- - query << "DELETE FROM characters WHERE id = " << id;
- - query.exec();
- + query << "DELETE FROM characters WHERE id = " << id;
- + query.exec();
- - query << "DELETE FROM keymap WHERE charid = " << id;
- - query.exec();
- + query << "DELETE FROM keymap WHERE charid = " << id;
- + query.exec();
- - query << "DELETE pets, items FROM pets LEFT JOIN items ON pets.id = items.petid WHERE items.charid = " << id;
- - query.exec();
- + query << "DELETE pets, items FROM pets LEFT JOIN items ON pets.id = items.petid WHERE items.charid = " << id;
- + query.exec();
- - query << "DELETE FROM items WHERE charid = " << id;
- - query.exec();
- + query << "DELETE FROM items WHERE charid = " << id;
- + query.exec();
- - query << "DELETE FROM skills WHERE charid = " << id;
- - query.exec();
- + query << "DELETE FROM skills WHERE charid = " << id;
- + query.exec();
- - query << "DELETE FROM skillmacros WHERE charid = " << id;
- - query.exec();
- + query << "DELETE FROM skillmacros WHERE charid = " << id;
- + query.exec();
- - query << "DELETE FROM character_variables WHERE charid = " << id;
- - query.exec();
- + query << "DELETE FROM character_variables WHERE charid = " << id;
- + query.exec();
- - LoginPacket::deleteCharacter(player, id);
- + LoginPacket::deleteCharacter(player, id, true);
- + }
- + else
- + LoginPacket::deleteCharacter(player, id, false);
- }
- void Characters::connectGame(PlayerLogin *player, int32_t charid) {
- Index: src/LoginServer/Login.cpp
- ===================================================================
- --- src/LoginServer/Login.cpp (revision 1551)
- +++ src/LoginServer/Login.cpp (working copy)
- @@ -38,7 +38,7 @@
- }
- mysqlpp::Query query = Database::getCharDB().query();
- - query << "SELECT id, password, salt, online, pin, gender, ban_reason, ban_expire, (ban_expire > NOW()) as banned FROM users WHERE username = " << mysqlpp::quote << username << " LIMIT 1";
- + query << "SELECT id, password, salt, online, pin, gender, ban_reason, ban_expire, (ban_expire > NOW()) as banned, DATE_FORMAT(birthdate,'%Y%m%d') AS dob FROM users WHERE username = " << mysqlpp::quote << username << " LIMIT 1";
- mysqlpp::StoreQueryResult res = query.store();
- bool valid = true;
- @@ -97,6 +97,8 @@
- player->setStatus(5);
- else
- player->setGender((uint8_t) res[0]["gender"]);
- +
- + player->setBirthdate((uint32_t) res[0]["dob"]);
- LoginPacket::loginConnect(player, username);
- }
- }
- Index: src/LoginServer/LoginPacket.cpp
- ===================================================================
- --- src/LoginServer/LoginPacket.cpp (revision 1551)
- +++ src/LoginServer/LoginPacket.cpp (working copy)
- @@ -201,11 +201,11 @@
- player->getSession()->send(packet);
- }
- -void LoginPacket::deleteCharacter(PlayerLogin *player, int32_t ID) {
- +void LoginPacket::deleteCharacter(PlayerLogin *player, int32_t ID, bool success) {
- PacketCreator packet;
- packet.addShort(SEND_DELETE_CHAR);
- packet.addInt(ID);
- - packet.addByte(0);
- + packet.addByte((success ? 0x00 : 0x12));
- player->getSession()->send(packet);
- }
- Index: src/LoginServer/LoginPacket.h
- ===================================================================
- --- src/LoginServer/LoginPacket.h (revision 1551)
- +++ src/LoginServer/LoginPacket.h (working copy)
- @@ -47,7 +47,7 @@
- void showCharacters(PlayerLogin *player, const vector<Character> &chars);
- void showCharacter(PlayerLogin *player, const Character &charc);
- void checkName(PlayerLogin *player, const string &name, bool taken);
- - void deleteCharacter(PlayerLogin *player, int32_t ID);
- + void deleteCharacter(PlayerLogin *player, int32_t ID, bool success);
- void connectIP(PlayerLogin *player, int32_t charid);
- void relogResponse(PlayerLogin *player);
- };
- Index: src/LoginServer/PlayerLogin.h
- ===================================================================
- --- src/LoginServer/PlayerLogin.h (revision 1551)
- +++ src/LoginServer/PlayerLogin.h (working copy)
- @@ -37,6 +37,7 @@
- void setUserid(int32_t id) { this->userid = id; }
- void setStatus(int32_t status) { this->status = status; }
- void setPin(int32_t pin) { this->pin = pin; }
- + void setBirthdate(int32_t birthdate) { this->birthdate = birthdate; }
- int8_t getGender() const { return this->gender; }
- int8_t getWorld() const { return this->world; }
- @@ -45,6 +46,7 @@
- int32_t getStatus() const { return this->status; }
- int32_t getPin() const { return this->pin; }
- int32_t addInvalidLogin() { return ++invalid_logins; }
- + int32_t getBirthdate() { return this->birthdate; }
- void setOnline(bool online);
- private:
- @@ -56,6 +58,7 @@
- int32_t pin;
- int32_t invalid_logins;
- bool checked_pin;
- + int32_t birthdate;
- };
- class PlayerLoginFactory : public AbstractPlayerFactory {
Add Comment
Please, Sign In to add comment