mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 23:01:30 +00:00
[Repositories] Convert Character Inspect Messages to Repositories (#4997)
This commit is contained in:
parent
9668074d94
commit
33df8ea665
@ -51,6 +51,7 @@
|
|||||||
#include "repositories/inventory_repository.h"
|
#include "repositories/inventory_repository.h"
|
||||||
#include "repositories/books_repository.h"
|
#include "repositories/books_repository.h"
|
||||||
#include "repositories/sharedbank_repository.h"
|
#include "repositories/sharedbank_repository.h"
|
||||||
|
#include "repositories/character_inspect_messages_repository.h"
|
||||||
|
|
||||||
namespace ItemField
|
namespace ItemField
|
||||||
{
|
{
|
||||||
@ -1906,18 +1907,29 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) {
|
|||||||
LoadDamageShieldTypes(sp, max_spells);
|
LoadDamageShieldTypes(sp, max_spells);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SharedDatabase::LoadCharacterInspectMessage(uint32 character_id, InspectMessage_Struct* message) {
|
void SharedDatabase::LoadCharacterInspectMessage(uint32 character_id, InspectMessage_Struct* s)
|
||||||
const std::string query = StringFormat("SELECT `inspect_message` FROM `character_inspect_messages` WHERE `id` = %u LIMIT 1", character_id);
|
{
|
||||||
auto results = QueryDatabase(query);
|
const auto& e = CharacterInspectMessagesRepository::FindOne(*this, character_id);
|
||||||
memset(message, '\0', sizeof(InspectMessage_Struct));
|
|
||||||
for (auto& row = results.begin(); row != results.end(); ++row) {
|
memset(s, '\0', sizeof(InspectMessage_Struct));
|
||||||
memcpy(message, row[0], sizeof(InspectMessage_Struct));
|
|
||||||
|
if (!e.id) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
memcpy(s, e.inspect_message.c_str(), sizeof(InspectMessage_Struct));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SharedDatabase::SaveCharacterInspectMessage(uint32 character_id, const InspectMessage_Struct* message) {
|
void SharedDatabase::SaveCharacterInspectMessage(uint32 character_id, const InspectMessage_Struct* s)
|
||||||
const std::string query = StringFormat("REPLACE INTO `character_inspect_messages` (id, inspect_message) VALUES (%u, '%s')", character_id, Strings::Escape(message->text).c_str());
|
{
|
||||||
auto results = QueryDatabase(query);
|
auto e = CharacterInspectMessagesRepository::NewEntity();
|
||||||
|
|
||||||
|
e.id = character_id;
|
||||||
|
e.inspect_message = s->text;
|
||||||
|
|
||||||
|
if (!CharacterInspectMessagesRepository::ReplaceOne(*this, e)) {
|
||||||
|
LogError("Failed to save character inspect message of [{}] for character_id [{}]", s->text, character_id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 SharedDatabase::GetSpellsCount()
|
uint32 SharedDatabase::GetSpellsCount()
|
||||||
|
|||||||
@ -76,8 +76,8 @@ public:
|
|||||||
uint8 GetGMSpeed(uint32 account_id);
|
uint8 GetGMSpeed(uint32 account_id);
|
||||||
bool SetHideMe(uint32 account_id, uint8 hideme);
|
bool SetHideMe(uint32 account_id, uint8 hideme);
|
||||||
int DeleteStalePlayerCorpses();
|
int DeleteStalePlayerCorpses();
|
||||||
void LoadCharacterInspectMessage(uint32 character_id, InspectMessage_Struct *message);
|
void LoadCharacterInspectMessage(uint32 character_id, InspectMessage_Struct* s);
|
||||||
void SaveCharacterInspectMessage(uint32 character_id, const InspectMessage_Struct *message);
|
void SaveCharacterInspectMessage(uint32 character_id, const InspectMessage_Struct* s);
|
||||||
bool GetCommandSettings(std::map<std::string, std::pair<uint8, std::vector<std::string>>> &command_settings);
|
bool GetCommandSettings(std::map<std::string, std::pair<uint8, std::vector<std::string>>> &command_settings);
|
||||||
bool UpdateInjectedCommandSettings(const std::vector<std::pair<std::string, uint8>> &injected);
|
bool UpdateInjectedCommandSettings(const std::vector<std::pair<std::string, uint8>> &injected);
|
||||||
bool UpdateOrphanedCommandSettings(const std::vector<std::string> &orphaned);
|
bool UpdateOrphanedCommandSettings(const std::vector<std::string> &orphaned);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user