mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-01-22 04:37:02 +00:00
Shortened reputation update
This commit is contained in:
parent
f72c2dcaa5
commit
b903c81a0a
@ -524,32 +524,16 @@ void Mission::YieldRewards() {
|
|||||||
auto charId = character->GetID();
|
auto charId = character->GetID();
|
||||||
auto propertyCloneId = character->GetPropertyCloneID();
|
auto propertyCloneId = character->GetPropertyCloneID();
|
||||||
|
|
||||||
auto properties = Database::CreatePreppedStmt("SELECT reputation FROM properties WHERE owner_id = ? AND clone_id = ?");
|
auto reputationUpdate = Database::CreatePreppedStmt("UPDATE properties SET reputation = reputation + ? where owner_id = ? AND clone_id = ?");
|
||||||
|
|
||||||
properties->setInt(1, charId);
|
reputationUpdate->setInt64(1, info->reward_reputation);
|
||||||
properties->setInt64(2, propertyCloneId);
|
reputationUpdate->setInt(2, charId);
|
||||||
|
reputationUpdate->setInt64(3, propertyCloneId);
|
||||||
|
|
||||||
auto results = properties->executeQuery();
|
reputationUpdate->executeUpdate();
|
||||||
|
|
||||||
while (results->next()) {
|
delete reputationUpdate;
|
||||||
const auto oldReputation = results->getInt(1);
|
reputationUpdate = nullptr;
|
||||||
|
|
||||||
auto reputationUpdate = Database::CreatePreppedStmt("UPDATE properties SET reputation = ? where owner_id = ? AND clone_id = ?");
|
|
||||||
|
|
||||||
reputationUpdate->setInt64(1, oldReputation + info->reward_reputation);
|
|
||||||
reputationUpdate->setInt(2, charId);
|
|
||||||
reputationUpdate->setInt64(3, propertyCloneId);
|
|
||||||
|
|
||||||
reputationUpdate->execute();
|
|
||||||
|
|
||||||
delete reputationUpdate;
|
|
||||||
reputationUpdate = nullptr;
|
|
||||||
}
|
|
||||||
delete results;
|
|
||||||
results = nullptr;
|
|
||||||
|
|
||||||
delete properties;
|
|
||||||
properties = nullptr;
|
|
||||||
|
|
||||||
GameMessages::SendUpdateReputation(entity->GetObjectID(), info->reward_reputation, entity->GetSystemAddress());
|
GameMessages::SendUpdateReputation(entity->GetObjectID(), info->reward_reputation, entity->GetSystemAddress());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user