mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-27 15:46:24 +00:00
feat(core): add standalone functions for player settings (#22703)
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
|
||||
#ifndef _PLAYER_SETTINGS_H
|
||||
#define _PLAYER_SETTINGS_H
|
||||
#include "DatabaseEnvFwd.h"
|
||||
|
||||
class Player;
|
||||
|
||||
@@ -51,4 +52,18 @@ struct PlayerSetting
|
||||
typedef std::vector<PlayerSetting> PlayerSettingVector;
|
||||
typedef std::map<std::string, PlayerSettingVector> PlayerSettingMap;
|
||||
|
||||
// Standalone API: update a player's setting directly on DB by GUID (low part) without requiring a Player instance
|
||||
namespace PlayerSettingsStore
|
||||
{
|
||||
// Update a single setting value for any player by GUID (works for online or offline players).
|
||||
// This reads the existing "source" row from character_settings, adjusts the index, and REPLACE's it back.
|
||||
void UpdateSetting(uint32 playerLowGuid, std::string const& source, uint8 index, uint32 value);
|
||||
|
||||
// Common helpers for parsing and serializing settings data
|
||||
PlayerSettingVector ParseSettingsData(std::string const& data);
|
||||
std::string SerializeSettingsData(PlayerSettingVector const& settings);
|
||||
// Prepare a REPLACE statement populated with given settings data. Caller may execute or append to a transaction.
|
||||
CharacterDatabasePreparedStatement* PrepareReplaceStatement(uint32 playerLowGuid, std::string const& source, PlayerSettingVector const& settings);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user