feat: implement character and property reputation system#1964
Draft
aronwk-aaron wants to merge 9 commits intomainfrom
Draft
feat: implement character and property reputation system#1964aronwk-aaron wants to merge 9 commits intomainfrom
aronwk-aaron wants to merge 9 commits intomainfrom
Conversation
- 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.
Contributor
There was a problem hiding this comment.
Pull request overview
Implements a database-backed reputation system for characters and property activity, including schema migrations and a one-time migration of legacy reputation stored in character XML.
Changes:
- Added new DB tables + accessors for character reputation and per-property daily contribution tracking (MySQL + SQLite).
- Updated gameplay components to load/persist character reputation and to award/decay property reputation based on player activity.
- Added a migration runner hook to migrate existing XML-stored character reputation into the new DB table.
Reviewed changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| migrations/dlu/sqlite/10_character_reputation.sql | Adds SQLite character_reputation table. |
| migrations/dlu/sqlite/11_property_reputation.sql | Adds SQLite property_reputation_contribution table. |
| migrations/dlu/mysql/27_character_reputation.sql | Adds MySQL character_reputation table. |
| migrations/dlu/mysql/28_property_reputation.sql | Adds MySQL property_reputation_contribution table. |
| dGame/dMission/Mission.cpp | Stops sending UpdateReputation directly (now sent via CharacterComponent::SetReputation). |
| dGame/dComponents/PropertyManagementComponent.h | Adds per-player activity tracking + timers/config for property reputation. |
| dGame/dComponents/PropertyManagementComponent.cpp | Implements property reputation accrual/decay, DB persistence, and position-update observer wiring. |
| dGame/dComponents/CharacterComponent.h | Moves SetReputation to out-of-line implementation. |
| dGame/dComponents/CharacterComponent.cpp | Loads/saves reputation from DB and sends UpdateReputation when changed. |
| dDatabase/MigrationRunner.cpp | Detects character reputation migration SQL and triggers XML→DB data migration pass. |
| dDatabase/GameDatabase/TestSQL/TestSQLDatabase.h | Adds in-memory stubs for character reputation methods used by tests/migration. |
| dDatabase/GameDatabase/SQLite/Tables/PropertyReputationContribution.cpp | SQLite queries/upserts for property reputation contribution + property reputation update. |
| dDatabase/GameDatabase/SQLite/Tables/CMakeLists.txt | Builds new SQLite table source files. |
| dDatabase/GameDatabase/SQLite/Tables/CharInfo.cpp | Adds GetAllCharacterIds() for migration. |
| dDatabase/GameDatabase/SQLite/Tables/CharacterReputation.cpp | SQLite get/set for character reputation. |
| dDatabase/GameDatabase/SQLite/SQLiteDatabase.h | Exposes new reputation-related DB APIs for SQLite implementation. |
| dDatabase/GameDatabase/MySQL/Tables/PropertyReputationContribution.cpp | MySQL queries/upserts for property reputation contribution + property reputation update. |
| dDatabase/GameDatabase/MySQL/Tables/CMakeLists.txt | Builds new MySQL table source files. |
| dDatabase/GameDatabase/MySQL/Tables/CharInfo.cpp | Adds GetAllCharacterIds() for migration. |
| dDatabase/GameDatabase/MySQL/Tables/CharacterReputation.cpp | MySQL get/set for character reputation. |
| dDatabase/GameDatabase/MySQL/MySQLDatabase.h | Exposes new reputation-related DB APIs for MySQL implementation. |
| dDatabase/GameDatabase/ITables/IPropertyReputationContribution.h | New interface for property contribution + property reputation update. |
| dDatabase/GameDatabase/ITables/ICharInfo.h | Adds GetAllCharacterIds() to support migration. |
| dDatabase/GameDatabase/ITables/ICharacterReputation.h | New interface for character reputation get/set. |
| dDatabase/GameDatabase/GameDatabase.h | Wires new reputation interfaces into the GameDatabase base. |
| dDatabase/CMakeLists.txt | Adds CharacterReputationMigration to the dDatabase build. |
| dDatabase/CharacterReputationMigration.h | Declares XML→DB reputation migration. |
| dDatabase/CharacterReputationMigration.cpp | Implements XML attribute rpt extraction and DB write-back. |
| dCommon/GeneralUtils.h | Adds GeneralUtils::GetCurrentUTCDate() utility for daily tracking. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Agent-Logs-Url: https://github.com/DarkflameUniverse/DarkflameServer/sessions/4cb00fe2-a85e-45f6-95c7-1ac972e244bc Co-authored-by: aronwk-aaron <26027722+aronwk-aaron@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ReputationMigration Agent-Logs-Url: https://github.com/DarkflameUniverse/DarkflameServer/sessions/63bf6fda-1e52-4ad7-a08c-3535f744ae5d Co-authored-by: aronwk-aaron <26027722+aronwk-aaron@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Agent-Logs-Url: https://github.com/DarkflameUniverse/DarkflameServer/sessions/603b2808-f042-447c-ba49-e4a8d9f87856 Co-authored-by: aronwk-aaron <26027722+aronwk-aaron@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements a database-backed reputation system for characters and property activity, including schema migrations and a one-time migration of legacy reputation stored in character XML.
Changes Made
GetCharacterReputationandSetCharacterReputationcalls to useCharacter::GetID()(raw DB id) instead ofCharacter::GetObjectID()(runtime object id with CHARACTER bit set) so read/write paths use the same DB key.%lluformat specifier forLWOOBJID(int64_t) inCharacterReputationMigration.cppby casting touint64_tto avoid undefined behavior on some platforms.Tests
Added
PropertyReputationTests.cppwith focused unit tests covering:CharacterComponent::SetReputationstores atCharacter::GetID(), notGetObjectID()(regression guard for the id-key bug).CharacterComponentreputation round-trip and load-from-DB on construction.UpdatePropertyReputation/GetPropertyReputationround-trip viaTestSQLDatabase.UpdatePropertyReputationContributionupsert behavior, date isolation, and multi-player contribution scenarios.TestSQLDatabaseproperty reputation and contribution stubs are now backed by real in-memory storage to support these and future tests.