mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-04-10 01:36:57 +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:
@@ -33,6 +33,9 @@ public:
|
||||
// Get the character ids for the given account.
|
||||
virtual std::vector<LWOOBJID> GetAccountCharacterIds(const LWOOBJID accountId) = 0;
|
||||
|
||||
// Get all character ids.
|
||||
virtual std::vector<LWOOBJID> GetAllCharacterIds() = 0;
|
||||
|
||||
// Insert a new character into the database.
|
||||
virtual void InsertNewCharacter(const ICharInfo::Info info) = 0;
|
||||
|
||||
|
||||
14
dDatabase/GameDatabase/ITables/ICharacterReputation.h
Normal file
14
dDatabase/GameDatabase/ITables/ICharacterReputation.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef __ICHARACTERREPUTATION__H__
|
||||
#define __ICHARACTERREPUTATION__H__
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "dCommonVars.h"
|
||||
|
||||
class ICharacterReputation {
|
||||
public:
|
||||
virtual int64_t GetCharacterReputation(const LWOOBJID charId) = 0;
|
||||
virtual void SetCharacterReputation(const LWOOBJID charId, const int64_t reputation) = 0;
|
||||
};
|
||||
|
||||
#endif //!__ICHARACTERREPUTATION__H__
|
||||
@@ -0,0 +1,30 @@
|
||||
#ifndef __IPROPERTYREPUTATIONCONTRIBUTION__H__
|
||||
#define __IPROPERTYREPUTATIONCONTRIBUTION__H__
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "dCommonVars.h"
|
||||
|
||||
class IPropertyReputationContribution {
|
||||
public:
|
||||
struct ContributionInfo {
|
||||
LWOOBJID playerId{};
|
||||
uint32_t reputationGained{};
|
||||
};
|
||||
|
||||
// Get today's reputation contributions for a property.
|
||||
virtual std::vector<ContributionInfo> GetPropertyReputationContributions(
|
||||
const LWOOBJID propertyId, const std::string& date) = 0;
|
||||
|
||||
// Upsert a player's reputation contribution for a property on a given date.
|
||||
virtual void UpdatePropertyReputationContribution(
|
||||
const LWOOBJID propertyId, const LWOOBJID playerId,
|
||||
const std::string& date, const uint32_t reputationGained) = 0;
|
||||
|
||||
// Update the total reputation on a property.
|
||||
virtual void UpdatePropertyReputation(const LWOOBJID propertyId, const uint32_t reputation) = 0;
|
||||
};
|
||||
|
||||
#endif //!__IPROPERTYREPUTATIONCONTRIBUTION__H__
|
||||
Reference in New Issue
Block a user