mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-22 05:27:19 +00:00
Merge pull request #476 from EmosewaMC/bugReportFixing
Added more specific bug reporting. There is a new migration called migrations/dlu/2_reporter_id.sql to run on the database.
This commit is contained in:
commit
db0f363967
@ -5925,6 +5925,7 @@ void GameMessages::HandleReportBug(RakNet::BitStream* inStream, Entity* entity)
|
||||
std::string nOtherPlayerID;
|
||||
std::string selection;
|
||||
uint32_t messageLength;
|
||||
int32_t reporterID = 0;
|
||||
|
||||
//Reading:
|
||||
inStream->Read(messageLength);
|
||||
@ -5935,6 +5936,9 @@ void GameMessages::HandleReportBug(RakNet::BitStream* inStream, Entity* entity)
|
||||
body.push_back(character);
|
||||
}
|
||||
|
||||
auto character = entity->GetCharacter();
|
||||
if (character) reporterID = character->GetID();
|
||||
|
||||
uint32_t clientVersionLength;
|
||||
inStream->Read(clientVersionLength);
|
||||
for (unsigned int k = 0; k < clientVersionLength; k++) {
|
||||
@ -5950,6 +5954,9 @@ void GameMessages::HandleReportBug(RakNet::BitStream* inStream, Entity* entity)
|
||||
inStream->Read(character);
|
||||
nOtherPlayerID.push_back(character);
|
||||
}
|
||||
// Convert other player id from LWOOBJID to the database id.
|
||||
uint32_t otherPlayer = LWOOBJID_EMPTY;
|
||||
if (nOtherPlayerID != "") otherPlayer = std::atoi(nOtherPlayerID.c_str());
|
||||
|
||||
uint32_t selectionLength;
|
||||
inStream->Read(selectionLength);
|
||||
@ -5960,16 +5967,17 @@ void GameMessages::HandleReportBug(RakNet::BitStream* inStream, Entity* entity)
|
||||
}
|
||||
|
||||
try {
|
||||
sql::PreparedStatement* insertBug = Database::CreatePreppedStmt("INSERT INTO `bug_reports`(body, client_version, other_player_id, selection) VALUES (?, ?, ?, ?)");
|
||||
sql::PreparedStatement* insertBug = Database::CreatePreppedStmt("INSERT INTO `bug_reports`(body, client_version, other_player_id, selection, reporter_id) VALUES (?, ?, ?, ?, ?)");
|
||||
insertBug->setString(1, GeneralUtils::UTF16ToWTF8(body));
|
||||
insertBug->setString(2, clientVersion);
|
||||
insertBug->setString(3, nOtherPlayerID);
|
||||
insertBug->setString(3, std::to_string(otherPlayer));
|
||||
insertBug->setString(4, selection);
|
||||
insertBug->setInt(5, reporterID);
|
||||
insertBug->execute();
|
||||
delete insertBug;
|
||||
}
|
||||
catch (sql::SQLException& e) {
|
||||
Game::logger->Log("HandleReportBug", "Couldn't save bug report!\n");
|
||||
Game::logger->Log("HandleReportBug", "Couldn't save bug report! (%s)\n", e.what());
|
||||
}
|
||||
}
|
||||
|
||||
|
1
migrations/dlu/2_reporter_id.sql
Normal file
1
migrations/dlu/2_reporter_id.sql
Normal file
@ -0,0 +1 @@
|
||||
ALTER TABLE bug_reports ADD reporter_id INT NOT NULL DEFAULT 0;
|
Loading…
Reference in New Issue
Block a user