mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-04-09 17:26:58 +00:00
feat: implement character and property reputation system
- Added ICharacterReputation and IPropertyReputationContribution interfaces for managing character and property reputations. - Implemented MySQL and SQLite database methods for getting and setting character reputations. - Created migration scripts for character and property reputation tables in both MySQL and SQLite. - Updated CharacterComponent to retrieve and set character reputation. - Enhanced PropertyManagementComponent to manage property reputation and contributions. - Added methods for handling reputation contributions and decay. - Introduced CharacterReputationMigration to migrate existing character reputations from XML to the database.
This commit is contained in:
17
dDatabase/GameDatabase/MySQL/Tables/CharacterReputation.cpp
Normal file
17
dDatabase/GameDatabase/MySQL/Tables/CharacterReputation.cpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#include "MySQLDatabase.h"
|
||||
|
||||
int64_t MySQLDatabase::GetCharacterReputation(const LWOOBJID charId) {
|
||||
auto result = ExecuteSelect("SELECT reputation FROM character_reputation WHERE character_id = ? LIMIT 1;", charId);
|
||||
|
||||
if (!result->next()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return result->getInt64("reputation");
|
||||
}
|
||||
|
||||
void MySQLDatabase::SetCharacterReputation(const LWOOBJID charId, const int64_t reputation) {
|
||||
ExecuteInsert(
|
||||
"INSERT INTO character_reputation (character_id, reputation) VALUES (?, ?) ON DUPLICATE KEY UPDATE reputation = ?;",
|
||||
charId, reputation, reputation);
|
||||
}
|
||||
Reference in New Issue
Block a user