Skip to content

Commit

Permalink
Fix TC formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Rochet2 committed Oct 14, 2023
1 parent 8720eef commit 12797aa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
14 changes: 11 additions & 3 deletions ElunaUtility.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#ifdef TRINITY
#include "QueryResult.h"
#include "Log.h"
#include "fmt/printf.h"
#ifdef CATA
#include "Object.h"
#endif
Expand Down Expand Up @@ -49,9 +50,16 @@ typedef QueryResult ElunaQuery;
#endif

#ifdef TRINITY
#define ELUNA_LOG_INFO(...) TC_LOG_INFO("eluna", __VA_ARGS__);
#define ELUNA_LOG_ERROR(...) TC_LOG_ERROR("eluna", __VA_ARGS__);
#define ELUNA_LOG_DEBUG(...) TC_LOG_DEBUG("eluna", __VA_ARGS__);
#define ELUNA_LOG_TC_FMT(TC_LOG_MACRO, ...) \
try { \
std::string message = fmt::sprintf(__VA_ARGS__); \
TC_LOG_MACRO("eluna", "{}", message); \
} catch (const std::exception& e) { \
TC_LOG_MACRO("eluna", "Failed to format log message: {}", e.what()); \
}
#define ELUNA_LOG_INFO(...) ELUNA_LOG_TC_FMT(TC_LOG_INFO, __VA_ARGS__);
#define ELUNA_LOG_ERROR(...) ELUNA_LOG_TC_FMT(TC_LOG_ERROR, __VA_ARGS__);
#define ELUNA_LOG_DEBUG(...) ELUNA_LOG_TC_FMT(TC_LOG_DEBUG, __VA_ARGS__);
#elif defined(AZEROTHCORE)
#define ELUNA_LOG_INFO(...) LOG_INFO("eluna", __VA_ARGS__);
#define ELUNA_LOG_ERROR(...) LOG_ERROR("eluna", __VA_ARGS__);
Expand Down
4 changes: 1 addition & 3 deletions TrinityCore/PlayerMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -2092,9 +2092,7 @@ namespace LuaPlayer

time_t muteTime = time(NULL) + muteseconds;
player->GetSession()->m_muteTime = muteTime;
std::ostringstream oss;
oss << "UPDATE account SET mutetime = " << muteTime << " WHERE id = " << player->GetSession()->GetAccountId();
LoginDatabase.PExecute("%s", oss.str().c_str());
LoginDatabase.PExecute("UPDATE account SET mutetime = {} WHERE id = {}", muteTime, player->GetSession()->GetAccountId());
return 0;
}

Expand Down

0 comments on commit 12797aa

Please sign in to comment.