[Logging] Logging Improvements (#2755)

* Console logging improvements

* stderr handling

* Add origination information

* Formatting

* Update zoneserver.cpp

* Update eqemu_logsys.cpp

* Remove semicolon from MySQLQuery log output

* Remove IsRfc5424LogCategory

* Remove no longer used functions

* Remove definition BUILD_LOGGING

* Deprecate categories UCSServer & WorldServer

* Deprecate UCS / World Server / Zone Server categories

* Deprecate Status, QSServer, Normal

* Update login_server.cpp

* Deprecate Emergency, Alert, Critical, Notice

* Deprecate Alert

* Fix terminal color resetting

* Deprecate headless client

* Move LogAIModerate to Detail

* Deprecate moderate logging level for detail

* Update logs.cpp

* Logs list simplify

* Update logs.cpp

* Add discord to log command

* Remove unused headers

* Windows fix

* Error in world when zones fail to load

* Show warning color properly

* Keep loginserver thread log from colliding with other logs during startup

* Deprecate Loginserver category
This commit is contained in:
Chris Miles 2023-01-17 21:18:40 -06:00 committed by GitHub
parent ee2079ec35
commit 40d1c33351
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
61 changed files with 1159 additions and 1109 deletions

View File

@ -343,11 +343,6 @@ INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/websocketpp")
# silence obnoxious deprecation message
ADD_DEFINITIONS(-DBOOST_BIND_GLOBAL_PLACEHOLDERS)
OPTION(EQEMU_BUILD_LOGGING "Build Logging (To speed up compilation)" ON)
IF(EQEMU_BUILD_LOGGING)
ADD_DEFINITIONS(-DBUILD_LOGGING)
ENDIF()
IF(TLS_LIBRARY_ENABLED)
SET(SERVER_LIBS ${SERVER_LIBS} ${TLS_LIBRARY_LIBS})
INCLUDE_DIRECTORIES(SYSTEM "${TLS_LIBRARY_INCLUDE}")

View File

@ -652,6 +652,7 @@ SET(common_headers
patches/uf_limits.h
patches/uf_ops.h
patches/uf_structs.h
termcolor/rang.hpp
stacktrace/backward.hpp
StackWalker/StackWalker.h
util/memory_stream.h

View File

@ -71,11 +71,11 @@ bool Database::Connect(const char* host, const char* user, const char* passwd, c
uint32 errnum= 0;
char errbuf[MYSQL_ERRMSG_SIZE];
if (!Open(host, user, passwd, database, port, &errnum, errbuf)) {
LogError("[MySQL] Connection [{}] Failed to connect to database: Error [{}]", connection_label, errbuf);
LogError("Connection [{}] Failed to connect to database Error [{}]", connection_label, errbuf);
return false;
}
else {
LogInfo("[MySQL] Connection [{}] database [{}] at [{}]:[{}]", connection_label, database, host,port);
LogInfo("Connected to database [{}] [{}] @ [{}:{}]", connection_label, database, host,port);
return true;
}
}
@ -975,6 +975,8 @@ bool Database::LoadVariables() {
varcache.Add(key, value);
}
LogInfo("Loaded [{}] variable(s)", Strings::Commify(std::to_string(results.RowCount())));
return true;
}

View File

@ -167,7 +167,7 @@ MySQLRequestResult DBcore::QueryDatabase(const char *query, uint32 querylen, boo
if (LogSys.log_settings[Logs::MySQLQuery].is_category_enabled == 1) {
if ((strncasecmp(query, "select", 6) == 0)) {
LogMySQLQuery(
"{0}; -- ({1} row{2} returned) ({3}s)",
"{0} -- ({1} row{2} returned) ({3}s)",
query,
requestResult.RowCount(),
requestResult.RowCount() == 1 ? "" : "s",
@ -176,7 +176,7 @@ MySQLRequestResult DBcore::QueryDatabase(const char *query, uint32 querylen, boo
}
else {
LogMySQLQuery(
"{0}; -- ({1} row{2} affected) ({3}s)",
"{0} -- ({1} row{2} affected) ({3}s)",
query,
requestResult.RowsAffected(),
requestResult.RowsAffected() == 1 ? "" : "s",

View File

@ -22,21 +22,19 @@
#include "rulesys.h"
#include "platform.h"
#include "strings.h"
#include "misc.h"
#include "discord/discord.h"
#include "repositories/discord_webhooks_repository.h"
#include "repositories/logsys_categories_repository.h"
#include "termcolor/rang.hpp"
#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
#include <time.h>
#include <sys/stat.h>
#include <algorithm>
std::ofstream process_log;
#include <filesystem>
#ifdef _WINDOWS
#include <direct.h>
#include <conio.h>
@ -52,40 +50,6 @@ std::ofstream process_log;
#endif
/**
* Linux ANSI console color defines
*/
#define LC_RESET "\033[0m"
#define LC_BLACK "\033[30m" /* Black */
#define LC_RED "\033[31m" /* Red */
#define LC_GREEN "\033[32m" /* Green */
#define LC_YELLOW "\033[33m" /* Yellow */
#define LC_BLUE "\033[34m" /* Blue */
#define LC_MAGENTA "\033[35m" /* Magenta */
#define LC_CYAN "\033[36m" /* Cyan */
#define LC_WHITE "\033[37m" /* White */
namespace Console {
enum Color {
Black = 0,
Blue = 1,
Green = 2,
Cyan = 3,
Red = 4,
Magenta = 5,
Brown = 6,
LightGray = 7,
DarkGray = 8,
LightBlue = 9,
LightGreen = 10,
LightCyan = 11,
LightRed = 12,
LightMagenta = 13,
Yellow = 14,
White = 15
};
}
/**
* EQEmuLogSys Constructor
*/
@ -120,14 +84,8 @@ EQEmuLogSys *EQEmuLogSys::LoadLogSettingsDefaults()
/**
* Set Defaults
*/
log_settings[Logs::WorldServer].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::ZoneServer].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::QSServer].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::UCSServer].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::Crash].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::MySQLError].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::Loginserver].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::HeadlessClient].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::NPCScaling].log_to_gmsay = static_cast<uint8>(Logs::General);
log_settings[Logs::HotReload].log_to_gmsay = static_cast<uint8>(Logs::General);
log_settings[Logs::HotReload].log_to_console = static_cast<uint8>(Logs::General);
@ -146,12 +104,8 @@ EQEmuLogSys *EQEmuLogSys::LoadLogSettingsDefaults()
/**
* RFC 5424
*/
log_settings[Logs::Emergency].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::Alert].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::Critical].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::Error].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::Warning].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::Notice].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::Info].log_to_console = static_cast<uint8>(Logs::General);
/**
@ -196,24 +150,6 @@ EQEmuLogSys *EQEmuLogSys::LoadLogSettingsDefaults()
return this;
}
/**
* @param log_category
* @return
*/
bool EQEmuLogSys::IsRfc5424LogCategory(uint16 log_category)
{
return (
log_category == Logs::Emergency ||
log_category == Logs::Alert ||
log_category == Logs::Critical ||
log_category == Logs::Error ||
log_category == Logs::Warning ||
log_category == Logs::Notice ||
log_category == Logs::Info ||
log_category == Logs::Debug
);
}
/**
* @param debug_level
* @param log_category
@ -244,66 +180,6 @@ void EQEmuLogSys::ProcessLogWrite(
}
}
/**
* @param log_category
* @return
*/
uint16 EQEmuLogSys::GetWindowsConsoleColorFromCategory(uint16 log_category)
{
switch (log_category) {
case Logs::Status:
case Logs::Normal:
return Console::Color::Yellow;
case Logs::MySQLError:
case Logs::Error:
case Logs::QuestErrors:
return Console::Color::LightRed;
case Logs::MySQLQuery:
case Logs::Debug:
return Console::Color::LightGreen;
case Logs::Quests:
return Console::Color::LightCyan;
case Logs::Commands:
case Logs::Mercenaries:
return Console::Color::LightMagenta;
case Logs::Crash:
return Console::Color::LightRed;
default:
return Console::Color::Yellow;
}
}
/**
* @param log_category
* @return
*/
std::string EQEmuLogSys::GetLinuxConsoleColorFromCategory(uint16 log_category)
{
switch (log_category) {
case Logs::Status:
case Logs::Normal:
return LC_YELLOW;
case Logs::MySQLError:
case Logs::QuestErrors:
case Logs::Warning:
case Logs::Critical:
case Logs::Error:
return LC_RED;
case Logs::MySQLQuery:
case Logs::Debug:
return LC_GREEN;
case Logs::Quests:
return LC_CYAN;
case Logs::Commands:
case Logs::Mercenaries:
return LC_MAGENTA;
case Logs::Crash:
return LC_RED;
default:
return LC_YELLOW;
}
}
/**
* @param log_category
* @return
@ -311,9 +187,6 @@ std::string EQEmuLogSys::GetLinuxConsoleColorFromCategory(uint16 log_category)
uint16 EQEmuLogSys::GetGMSayColorFromCategory(uint16 log_category)
{
switch (log_category) {
case Logs::Status:
case Logs::Normal:
return Chat::Yellow;
case Logs::MySQLError:
case Logs::QuestErrors:
case Logs::Error:
@ -333,28 +206,139 @@ uint16 EQEmuLogSys::GetGMSayColorFromCategory(uint16 log_category)
}
}
/**
* @param debug_level
* @param log_category
* @param message
*/
void EQEmuLogSys::ProcessConsoleMessage(uint16 log_category, const std::string &message)
void EQEmuLogSys::ProcessConsoleMessage(
uint16 log_category,
const std::string &message,
const char *file,
const char *func,
int line
)
{
#ifdef _WINDOWS
HANDLE console_handle;
console_handle = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_FONT_INFOEX info = { 0 };
info.cbSize = sizeof(info);
info.dwFontSize.Y = 12; // leave X as zero
info.FontWeight = FW_NORMAL;
wcscpy(info.FaceName, L"Lucida Console");
SetCurrentConsoleFontEx(console_handle, NULL, &info);
SetConsoleTextAttribute(console_handle, EQEmuLogSys::GetWindowsConsoleColorFromCategory(log_category));
std::cout << message << "\n";
SetConsoleTextAttribute(console_handle, Console::Color::White);
#else
std::cout << EQEmuLogSys::GetLinuxConsoleColorFromCategory(log_category) << message << LC_RESET << std::endl;
#endif
bool is_error = (
log_category == Logs::LogCategory::Error ||
log_category == Logs::LogCategory::MySQLError ||
log_category == Logs::LogCategory::QuestErrors
);
bool is_warning = (
log_category == Logs::LogCategory::Warning
);
(!is_error ? std::cout : std::cerr)
<< ""
<< rang::fgB::black
<< rang::style::bold
<< fmt::format("{:>6}", GetPlatformName().substr(0, 6))
<< rang::style::reset
<< rang::fgB::gray
<< " | "
<< (is_error || is_warning ? rang::fgB::red : rang::fgB::gray)
<< rang::style::bold
<< fmt::format("{:^10}", fmt::format("{}", Logs::LogCategoryName[log_category]).substr(0, 10))
<< rang::style::reset
<< rang::fgB::gray
<< " | "
<< rang::fgB::gray
<< rang::style::bold
<< fmt::format("{}", func)
<< " ";
if (RuleB(Logging, PrintFileFunctionAndLine)) {
(!is_error ? std::cout : std::cerr)
<< ""
<< rang::fgB::green
<< rang::style::bold
<< fmt::format("{:}", fmt::format("{}:{}:{}", std::filesystem::path(file).filename().string(), func, line))
<< rang::style::reset
<< " | ";
}
if (log_category == Logs::LogCategory::MySQLQuery) {
auto s = Strings::Split(message, "--");
std::string query = Strings::Trim(s[0]);
std::string meta = Strings::Trim(s[1]);
std::cout <<
rang::fgB::green
<<
query
<<
rang::style::reset;
std::cout <<
rang::fgB::black
<<
" -- "
<<
meta
<<
rang::style::reset;
}
else if (Strings::Contains(message, "[")) {
for (auto &e: Strings::Split(message, " ")) {
if (Strings::Contains(e, "[") && Strings::Contains(e, "]")) {
e = Strings::Replace(e, "[", "");
e = Strings::Replace(e, "]", "");
bool is_upper = false;
for (int i = 0; i < strlen(e.c_str()); i++) {
if (isupper(e[i])) {
is_upper = true;
}
}
if (!is_upper) {
(!is_error ? std::cout : std::cerr)
<< rang::fgB::gray
<< "["
<< rang::style::bold
<< rang::fgB::yellow
<< e
<< rang::fgB::gray
<< "] "
;
}
else {
(!is_error ? std::cout : std::cerr) << rang::fgB::gray << "[" << e << "] ";
}
}
else {
(!is_error ? std::cout : std::cerr)
<< (is_error ? rang::fgB::red : rang::fgB::gray)
<< e
<< " ";
}
}
}
else {
(!is_error ? std::cout : std::cerr)
<< (is_error ? rang::fgB::red : rang::fgB::gray)
<< message
<< " ";
}
if (!origination_info.zone_short_name.empty()) {
(!is_error ? std::cout : std::cerr)
<<
rang::fgB::black
<<
"-- "
<<
fmt::format(
"[{}] ({}) inst_id [{}]",
origination_info.zone_short_name,
origination_info.zone_long_name,
origination_info.instance_id
);
}
(!is_error ? std::cout : std::cerr) << rang::style::reset << std::endl;
m_on_log_console_hook(log_category, message);
}
@ -368,33 +352,6 @@ constexpr const char *str_end(const char *str)
return *str ? str_end(str + 1) : str;
}
/**
* @param str
* @return
*/
constexpr bool str_slant(const char *str)
{
return *str == '/' ? true : (*str ? str_slant(str + 1) : false);
}
/**
* @param str
* @return
*/
constexpr const char *r_slant(const char *str)
{
return *str == '/' ? (str + 1) : r_slant(str - 1);
}
/**
* @param str
* @return
*/
constexpr const char *base_file_name(const char *str)
{
return str_slant(str) ? r_slant(str_end(str)) : str;
}
/**
* Core logging function
*
@ -422,7 +379,7 @@ void EQEmuLogSys::Out(
std::string prefix;
if (RuleB(Logging, PrintFileFunctionAndLine)) {
prefix = fmt::format("[{0}::{1}:{2}] ", base_file_name(file), func, line);
prefix = fmt::format("[{0}::{1}:{2}] ", std::filesystem::path(file).filename().string(), func, line);
}
// remove this when we remove all legacy logs
@ -445,7 +402,10 @@ void EQEmuLogSys::Out(
if (l.log_to_console_enabled) {
EQEmuLogSys::ProcessConsoleMessage(
log_category,
fmt::format("[{}] [{}] {}", GetPlatformName(), Logs::LogCategoryName[log_category], prefix + output_message)
output_message,
file,
func,
line
);
}
if (l.log_to_gmsay_enabled) {

View File

@ -39,8 +39,7 @@
namespace Logs {
enum DebugLevel {
General = 1, // 1 - Low-Level general debugging, useful info on single line
Moderate, // 2 - Informational based, used in functions, when particular things load
Detail // 3 - Use this for extreme detail in logging, usually in extreme debugging in the stack or interprocess communication
Detail // 2 - Use this for very chatty logging you want to leave in but don't want on by default
};
/**
@ -54,7 +53,7 @@ namespace Logs {
AI,
Aggro,
Attack,
DeprecatedCS,
DeprecatedCS, // deprecated
Combat,
Commands,
Crash,
@ -65,36 +64,36 @@ namespace Logs {
Inventory,
Launcher,
Netcode,
Normal,
Normal, // deprecated
Object,
Pathing,
QSServer,
QSServer, // deprecated
Quests,
Rules,
Skills,
Spawns,
Spells,
Status,
Status, // deprecated
TCPConnection,
Tasks,
Tradeskills,
Trading,
Tribute,
UCSServer,
WebInterfaceServer,
WorldServer,
ZoneServer,
UCSServer, // deprecated
WebInterfaceServer, // deprecated
WorldServer, // deprecated
ZoneServer, // deprecated
MySQLError,
MySQLQuery,
Mercenaries,
QuestDebug,
DeprecatedSC,
DeprecatedCSU,
DeprecatedSCD,
DeprecatedCSD,
Loginserver,
DeprecatedSC, // deprecated
DeprecatedCSU, // deprecated
DeprecatedSCD, // deprecated
DeprecatedCSD, // deprecated
Loginserver, // deprecated
ClientLogin,
HeadlessClient,
HeadlessClient, // deprecated
HPUpdate,
FixZ,
Food,
@ -104,10 +103,10 @@ namespace Logs {
MobAppearance,
Info,
Warning,
Critical,
Emergency,
Alert,
Notice,
Critical, // deprecated
Emergency, // deprecated
Alert, // deprecated
Notice, // deprecated
AIScanClose,
AIYellForHelp,
AICastBeneficialClose,
@ -160,52 +159,52 @@ namespace Logs {
"Inventory",
"Launcher",
"Netcode",
"Normal",
"Normal (Deprecated)",
"Object",
"Pathing",
"QS Server",
"QS Server (Deprecated)",
"Quests",
"Rules",
"Skills",
"Spawns",
"Spells",
"Status",
"Status (Deprecated)",
"TCP Connection",
"Tasks",
"Tradeskills",
"Trading",
"Tribute",
"UCS Server",
"WebInterface Server",
"World Server",
"Zone Server",
"MySQL Error",
"MySQL Query",
"UCS Server (Deprecated)",
"Web Interface (Deprecated)",
"World Server (Deprecated)",
"Zone Server (Deprecated)",
"QueryErr",
"Query",
"Mercenaries",
"Quest Debug",
"Deprecated",
"Deprecated",
"Deprecated",
"Deprecated",
"Login Server",
"Legacy Packet Logging (Deprecated)",
"Legacy Packet Logging (Deprecated)",
"Legacy Packet Logging (Deprecated)",
"Legacy Packet Logging (Deprecated)",
"Login Server (Deprecated)",
"Client Login",
"Headless Client",
"Headless Client (Deprecated)",
"HP Update",
"FixZ",
"Food",
"Traps",
"NPC Roam Box",
"NPC Scaling",
"Mob Appearance",
"MobAppearance",
"Info",
"Warning",
"Critical",
"Emergency",
"Alert",
"Notice",
"AI Scan Close",
"AI Yell For Help",
"AI Cast Beneficial Close",
"Critical (Deprecated)",
"Emergency (Deprecated)",
"Alert (Deprecated)",
"Notice (Deprecated)",
"AI Scan",
"AI Yell",
"AI CastBeneficial",
"AOE Cast",
"Entity Management",
"Flee",
@ -222,14 +221,14 @@ namespace Logs {
"DialogueWindow",
"HTTP",
"Saylink",
"ChecksumVerification",
"ChecksumVer",
"CombatRecord",
"Hate",
"Discord",
"Faction",
"Packet-S->C",
"Packet-C->S",
"Packet-S->S",
"Packet S->C",
"Packet C->S",
"Packet S->S",
"Bugs",
"QuestErrors"
};
@ -386,12 +385,14 @@ private:
std::string m_platform_file_name;
std::string m_log_path;
std::string GetLinuxConsoleColorFromCategory(uint16 log_category);
uint16 GetWindowsConsoleColorFromCategory(uint16 log_category);
void ProcessConsoleMessage(uint16 log_category, const std::string &message);
void ProcessConsoleMessage(
uint16 log_category,
const std::string &message,
const char *file,
const char *func,
int line
);
void ProcessLogWrite(uint16 log_category, const std::string &message);
bool IsRfc5424LogCategory(uint16 log_category);
void InjectTablesIfNotExist();
};

View File

@ -21,8 +21,6 @@
#ifndef EQEMU_EQEMU_LOGSYS_LOG_ALIASES_H
#define EQEMU_EQEMU_LOGSYS_LOG_ALIASES_H
#ifdef BUILD_LOGGING
#define LogAA(message, ...) do {\
if (LogSys.IsLogEnabled(Logs::General, Logs::AA))\
OutF(LogSys, Logs::General, Logs::AA, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
@ -38,11 +36,6 @@
OutF(LogSys, Logs::General, Logs::AI, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogAIModerate(message, ...) do {\
if (LogSys.IsLogEnabled(Logs::Moderate, Logs::AI))\
OutF(LogSys, Logs::Moderate, Logs::AI, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogAIDetail(message, ...) do {\
if (LogSys.IsLogEnabled(Logs::Detail, Logs::AI))\
OutF(LogSys, Logs::Detail, Logs::AI, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
@ -83,11 +76,6 @@
OutF(LogSys, Logs::General, Logs::Combat, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogCombatModerate(message, ...) do {\
if (LogSys.IsLogEnabled(Logs::Moderate, Logs::Combat))\
OutF(LogSys, Logs::Moderate, Logs::Combat, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogCombatDetail(message, ...) do {\
if (LogSys.IsLogEnabled(Logs::Detail, Logs::Combat))\
OutF(LogSys, Logs::Detail, Logs::Combat, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
@ -213,16 +201,6 @@
OutF(LogSys, Logs::Detail, Logs::Pathing, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogQSServer(message, ...) do {\
if (LogSys.IsLogEnabled(Logs::General, Logs::QSServer))\
OutF(LogSys, Logs::General, Logs::QSServer, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogQSServerDetail(message, ...) do {\
if (LogSys.IsLogEnabled(Logs::Detail, Logs::QSServer))\
OutF(LogSys, Logs::Detail, Logs::QSServer, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogQuests(message, ...) do {\
if (LogSys.IsLogEnabled(Logs::General, Logs::Quests))\
OutF(LogSys, Logs::General, Logs::Quests, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
@ -268,11 +246,6 @@
OutF(LogSys, Logs::General, Logs::Spells, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogSpellsModerate(message, ...) do {\
if (LogSys.IsLogEnabled(Logs::Moderate, Logs::Spells))\
OutF(LogSys, Logs::Moderate, Logs::Spells, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogSpellsDetail(message, ...) do {\
if (LogSys.IsLogEnabled(Logs::Detail, Logs::Spells))\
OutF(LogSys, Logs::Detail, Logs::Spells, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
@ -338,46 +311,6 @@
OutF(LogSys, Logs::Detail, Logs::Tribute, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogUCSServer(message, ...) do {\
if (LogSys.IsLogEnabled(Logs::General, Logs::UCSServer))\
OutF(LogSys, Logs::General, Logs::UCSServer, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogUCSServerDetail(message, ...) do {\
if (LogSys.IsLogEnabled(Logs::Detail, Logs::UCSServer))\
OutF(LogSys, Logs::Detail, Logs::UCSServer, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogWebInterfaceServer(message, ...) do {\
if (LogSys.IsLogEnabled(Logs::General, Logs::WebInterfaceServer))\
OutF(LogSys, Logs::General, Logs::WebInterfaceServer, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogWebInterfaceServerDetail(message, ...) do {\
if (LogSys.IsLogEnabled(Logs::Detail, Logs::WebInterfaceServer))\
OutF(LogSys, Logs::Detail, Logs::WebInterfaceServer, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogWorldServer(message, ...) do {\
if (LogSys.IsLogEnabled(Logs::General, Logs::WorldServer))\
OutF(LogSys, Logs::General, Logs::WorldServer, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogWorldServerDetail(message, ...) do {\
if (LogSys.IsLogEnabled(Logs::Detail, Logs::WorldServer))\
OutF(LogSys, Logs::Detail, Logs::WorldServer, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogZoneServer(message, ...) do {\
if (LogSys.IsLogEnabled(Logs::General, Logs::ZoneServer))\
OutF(LogSys, Logs::General, Logs::ZoneServer, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogZoneServerDetail(message, ...) do {\
if (LogSys.IsLogEnabled(Logs::Detail, Logs::ZoneServer))\
OutF(LogSys, Logs::Detail, Logs::ZoneServer, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogMySQLError(message, ...) do {\
if (LogSys.IsLogEnabled(Logs::General, Logs::MySQLError))\
OutF(LogSys, Logs::General, Logs::MySQLError, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
@ -449,16 +382,6 @@
OutF(LogSys, Logs::Detail, Logs::ClientLogin, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogHeadlessClient(message, ...) do {\
if (LogSys.IsLogEnabled(Logs::General, Logs::HeadlessClient))\
OutF(LogSys, Logs::General, Logs::HeadlessClient, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogHeadlessClientDetail(message, ...) do {\
if (LogSys.IsLogEnabled(Logs::Detail, Logs::HeadlessClient))\
OutF(LogSys, Logs::Detail, Logs::HeadlessClient, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogHPUpdate(message, ...) do {\
if (LogSys.IsLogEnabled(Logs::General, Logs::HPUpdate))\
OutF(LogSys, Logs::General, Logs::HPUpdate, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
@ -594,11 +517,6 @@
OutF(LogSys, Logs::General, Logs::AIScanClose, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogAIScanCloseModerate(message, ...) do {\
if (LogSys.IsLogEnabled(Logs::Moderate, Logs::AIScanClose))\
OutF(LogSys, Logs::Moderate, Logs::AIScanClose, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogAIScanCloseDetail(message, ...) do {\
if (LogSys.IsLogEnabled(Logs::Detail, Logs::AIScanClose))\
OutF(LogSys, Logs::Detail, Logs::AIScanClose, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
@ -846,11 +764,6 @@
// manually created
#define LogExpeditionsModerate(message, ...) do {\
if (LogSys.IsLogEnabled(Logs::Moderate, Logs::Expeditions))\
OutF(LogSys, Logs::Moderate, Logs::Expeditions, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogBugs(message, ...) do {\
if (LogSys.IsLogEnabled(Logs::General, Logs::Bugs))\
OutF(LogSys, Logs::General, Logs::Bugs, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
@ -881,469 +794,5 @@
OutF(LogSys, debug_level, log_category, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#else
#define LogEmergency(message, ...) do {\
} while (0)
#define LogAlert(message, ...) do {\
} while (0)
#define LogCritical(message, ...) do {\
} while (0)
#define LogError(message, ...) do {\
} while (0)
#define LogWarning(message, ...) do {\
} while (0)
#define LogNotice(message, ...) do {\
} while (0)
#define LogInfo(message, ...) do {\
} while (0)
#define LogDebug(message, ...) do {\
} while (0)
/**
* Category
*/
#define LogAA(message, ...) do {\
} while (0)
#define LogAADetail(message, ...) do {\
} while (0)
#define LogAI(message, ...) do {\
} while (0)
#define LogAIModerate(message, ...) do {\
} while (0)
#define LogAIDetail(message, ...) do {\
} while (0)
#define LogAggro(message, ...) do {\
} while (0)
#define LogAggroDetail(message, ...) do {\
} while (0)
#define LogAttack(message, ...) do {\
} while (0)
#define LogAttackDetail(message, ...) do {\
} while (0)
#define LogPacketClientServer(message, ...) do {\
} while (0)
#define LogPacketClientServerDetail(message, ...) do {\
} while (0)
#define LogCombat(message, ...) do {\
} while (0)
#define LogCombatModerate(message, ...) do {\
} while (0)
#define LogCombatDetail(message, ...) do {\
} while (0)
#define LogCommands(message, ...) do {\
} while (0)
#define LogCommandsDetail(message, ...) do {\
} while (0)
#define LogCrash(message, ...) do {\
} while (0)
#define LogCrashDetail(message, ...) do {\
} while (0)
#define LogDoors(message, ...) do {\
} while (0)
#define LogDoorsDetail(message, ...) do {\
} while (0)
#define LogGroup(message, ...) do {\
} while (0)
#define LogGroupDetail(message, ...) do {\
} while (0)
#define LogGuilds(message, ...) do {\
} while (0)
#define LogGuildsDetail(message, ...) do {\
} while (0)
#define LogInventory(message, ...) do {\
} while (0)
#define LogInventoryDetail(message, ...) do {\
} while (0)
#define LogLauncher(message, ...) do {\
} while (0)
#define LogLauncherDetail(message, ...) do {\
} while (0)
#define LogNetcode(message, ...) do {\
} while (0)
#define LogNetcodeDetail(message, ...) do {\
} while (0)
#define LogNormal(message, ...) do {\
} while (0)
#define LogNormalDetail(message, ...) do {\
} while (0)
#define LogObject(message, ...) do {\
} while (0)
#define LogObjectDetail(message, ...) do {\
} while (0)
#define LogPathing(message, ...) do {\
} while (0)
#define LogPathingDetail(message, ...) do {\
} while (0)
#define LogQSServer(message, ...) do {\
} while (0)
#define LogQSServerDetail(message, ...) do {\
} while (0)
#define LogQuests(message, ...) do {\
} while (0)
#define LogQuestsDetail(message, ...) do {\
} while (0)
#define LogRules(message, ...) do {\
} while (0)
#define LogRulesDetail(message, ...) do {\
} while (0)
#define LogSkills(message, ...) do {\
} while (0)
#define LogSkillsDetail(message, ...) do {\
} while (0)
#define LogSpawns(message, ...) do {\
} while (0)
#define LogSpawnsDetail(message, ...) do {\
} while (0)
#define LogSpells(message, ...) do {\
} while (0)
#define LogSpellsModerate(message, ...) do {\
} while (0)
#define LogSpellsDetail(message, ...) do {\
} while (0)
#define LogTCPConnection(message, ...) do {\
} while (0)
#define LogTCPConnectionDetail(message, ...) do {\
} while (0)
#define LogTasks(message, ...) do {\
} while (0)
#define LogTasksDetail(message, ...) do {\
} while (0)
#define LogTradeskills(message, ...) do {\
} while (0)
#define LogTradeskillsDetail(message, ...) do {\
} while (0)
#define LogTrading(message, ...) do {\
} while (0)
#define LogTradingDetail(message, ...) do {\
} while (0)
#define LogTribute(message, ...) do {\
} while (0)
#define LogTributeDetail(message, ...) do {\
} while (0)
#define LogMySQLError(message, ...) do {\
} while (0)
#define LogMySQLErrorDetail(message, ...) do {\
} while (0)
#define LogMySQLQuery(message, ...) do {\
} while (0)
#define LogMySQLQueryDetail(message, ...) do {\
} while (0)
#define LogMercenaries(message, ...) do {\
} while (0)
#define LogMercenariesDetail(message, ...) do {\
} while (0)
#define LogQuestDebug(message, ...) do {\
} while (0)
#define LogQuestDebugDetail(message, ...) do {\
} while (0)
#define LogLoginserver(message, ...) do {\
} while (0)
#define LogLoginserverDetail(message, ...) do {\
} while (0)
#define LogClientLogin(message, ...) do {\
} while (0)
#define LogClientLoginDetail(message, ...) do {\
} while (0)
#define LogHeadlessClient(message, ...) do {\
} while (0)
#define LogHeadlessClientDetail(message, ...) do {\
} while (0)
#define LogHPUpdate(message, ...) do {\
} while (0)
#define LogHPUpdateDetail(message, ...) do {\
} while (0)
#define LogFixZ(message, ...) do {\
} while (0)
#define LogFixZDetail(message, ...) do {\
} while (0)
#define LogFood(message, ...) do {\
} while (0)
#define LogFoodDetail(message, ...) do {\
} while (0)
#define LogTraps(message, ...) do {\
} while (0)
#define LogTrapsDetail(message, ...) do {\
} while (0)
#define LogNPCRoamBox(message, ...) do {\
} while (0)
#define LogNPCRoamBoxDetail(message, ...) do {\
} while (0)
#define LogNPCScaling(message, ...) do {\
} while (0)
#define LogNPCScalingDetail(message, ...) do {\
} while (0)
#define LogMobAppearance(message, ...) do {\
} while (0)
#define LogMobAppearanceDetail(message, ...) do {\
} while (0)
#define LogStatus(message, ...) do {\
} while (0)
#define LogStatusDetail(message, ...) do {\
} while (0)
#define LogAIScanClose(message, ...) do {\
} while (0)
#define LogAIScanCloseModerate(message, ...) do {\
} while (0)
#define LogAIScanCloseDetail(message, ...) do {\
} while (0)
#define LogAIYellForHelp(message, ...) do {\
} while (0)
#define LogAIYellForHelpDetail(message, ...) do {\
} while (0)
#define LogAICastBeneficialClose(message, ...) do {\
} while (0)
#define LogAICastBeneficialCloseDetail(message, ...) do {\
} while (0)
#define LogAoeCast(message, ...) do {\
} while (0)
#define LogAoeCastDetail(message, ...) do {\
} while (0)
#define LogEntityManagement(message, ...) do {\
} while (0)
#define LogEntityManagementDetail(message, ...) do {\
} while (0)
#define LogFlee(message, ...) do {\
} while (0)
#define LogFleeDetail(message, ...) do {\
} while (0)
#define LogAura(message, ...) do {\
} while (0)
#define LogAuraDetail(message, ...) do {\
} while (0)
#define LogHotReload(message, ...) do {\
} while (0)
#define LogHotReloadDetail(message, ...) do {\
} while (0)
#define LogMerchants(message, ...) do {\
} while (0)
#define LogMerchantsDetail(message, ...) do {\
} while (0)
#define LogZonePoints(message, ...) do {\
} while (0)
#define LogZonePointsDetail(message, ...) do {\
} while (0)
#define LogExpeditions(message, ...) do {\
} while (0)
#define LogExpeditionsModerate(message, ...) do {\
} while (0)
#define LogExpeditionsDetail(message, ...) do {\
} while (0)
#define LogDynamicZones(message, ...) do {\
} while (0)
#define LogDynamicZonesDetail(message, ...) do {\
} while (0)
#define LogCheatList(message, ...) do {\
} while (0)
#define LogCheatDetail(message, ...) do {\
} while (0)
#define LogClientList(message, ...) do {\
} while (0)
#define LogClientListDetail(message, ...) do {\
} while (0)
#define LogDiaWind(message, ...) do {\
} while (0)
#define LogDiaWindDetail(message, ...) do {\
} while (0)
#define LogHTTP(message, ...) do {\
} while (0)
#define LogHTTPDetail(message, ...) do {\
} while (0)
#define LogSaylink(message, ...) do {\
} while (0)
#define LogSaylinkDetail(message, ...) do {\
} while (0)
#define LogScheduler(message, ...) do {\
} while (0)
#define LogSchedulerDetail(message, ...) do {\
} while (0)
#define LogCheat(message, ...) do {\
} while (0)
#define LogCheatDetail(message, ...) do {\
} while (0)
#define LogLoot(message, ...) do {\
} while (0)
#define LogLootDetail(message, ...) do {\
} while (0)
#define LogFood(message, ...) do {\
} while (0)
#define LogFoodDetail(message, ...) do {\
} while (0)
#define LogChecksumVerification(message, ...) do {\
} while (0)
#define LogChecksumVerificationDetail(message, ...) do {\
} while (0)
#define LogCombatRecord(message, ...) do {\
} while (0)
#define LogCombatRecordDetail(message, ...) do {\
} while (0)
#define LogHate(message, ...) do {\
} while (0)
#define LogHateDetail(message, ...) do {\
} while (0)
#define LogFaction(message, ...) do {\
} while (0)
#define LogFactionDetail(message, ...) do {\
} while (0)
#define LogBugs(message, ...) do {\
} while (0)
#define LogBugsDetail(message, ...) do {\
} while (0)
#define Log(debug_level, log_category, message, ...) do {\
} while (0)
#define LogF(debug_level, log_category, message, ...) do {\
} while (0)
#endif
#endif //EQEMU_EQEMU_LOGSYS_LOG_ALIASES_H

View File

@ -63,7 +63,9 @@ bool BaseGuildManager::LoadGuilds() {
for (auto row=results.begin();row!=results.end();++row)
_CreateGuild(atoi(row[0]), row[1], atoi(row[2]), atoi(row[3]), row[4], row[5], row[6], row[7]);
query = "SELECT guild_id,`rank`,title,can_hear,can_speak,can_invite,can_remove,can_promote,can_demote,can_motd,can_warpeace FROM guild_ranks";
LogInfo("Loaded [{}] Guilds", Strings::Commify(std::to_string(results.RowCount())));
query = "SELECT guild_id,`rank`,title,can_hear,can_speak,can_invite,can_remove,can_promote,can_demote,can_motd,can_warpeace FROM guild_ranks";
results = m_db->QueryDatabase(query);
if (!results.Success())

View File

@ -665,7 +665,7 @@ namespace RoF
ENCODE(OP_DeleteCharge)
{
Log(Logs::Moderate, Logs::Netcode, "RoF::ENCODE(OP_DeleteCharge)");
Log(Logs::Detail, Logs::Netcode, "RoF::ENCODE(OP_DeleteCharge)");
ENCODE_FORWARD(OP_MoveItem);
}
@ -1593,7 +1593,7 @@ namespace RoF
ENCODE_LENGTH_EXACT(LootingItem_Struct);
SETUP_DIRECT_ENCODE(LootingItem_Struct, structs::LootingItem_Struct);
Log(Logs::Moderate, Logs::Netcode, "RoF::ENCODE(OP_LootItem)");
Log(Logs::Detail, Logs::Netcode, "RoF::ENCODE(OP_LootItem)");
OUT(lootee);
OUT(looter);
@ -1751,7 +1751,7 @@ namespace RoF
ENCODE_LENGTH_EXACT(MoveItem_Struct);
SETUP_DIRECT_ENCODE(MoveItem_Struct, structs::MoveItem_Struct);
Log(Logs::Moderate, Logs::Netcode, "RoF::ENCODE(OP_MoveItem)");
Log(Logs::Detail, Logs::Netcode, "RoF::ENCODE(OP_MoveItem)");
eq->from_slot = ServerToRoFSlot(emu->from_slot);
eq->to_slot = ServerToRoFSlot(emu->to_slot);
@ -3831,7 +3831,7 @@ namespace RoF
}
float SpawnSize = emu->size;
if (!((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
if (!((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522))
)
{
@ -3965,7 +3965,7 @@ namespace RoF
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0xffffffff); // unknown18
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0xffffffff); // unknown19
if ((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
if ((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522)
)
{
@ -4822,7 +4822,7 @@ namespace RoF
DECODE_LENGTH_EXACT(structs::LootingItem_Struct);
SETUP_DIRECT_DECODE(LootingItem_Struct, structs::LootingItem_Struct);
Log(Logs::Moderate, Logs::Netcode, "RoF::DECODE(OP_LootItem)");
Log(Logs::Detail, Logs::Netcode, "RoF::DECODE(OP_LootItem)");
IN(lootee);
IN(looter);
@ -4837,7 +4837,7 @@ namespace RoF
DECODE_LENGTH_EXACT(structs::MoveItem_Struct);
SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct);
Log(Logs::Moderate, Logs::Netcode, "RoF::DECODE(OP_MoveItem)");
Log(Logs::Detail, Logs::Netcode, "RoF::DECODE(OP_MoveItem)");
emu->from_slot = RoFToServerSlot(eq->from_slot);
emu->to_slot = RoFToServerSlot(eq->to_slot);

View File

@ -716,7 +716,7 @@ namespace RoF2
ENCODE(OP_DeleteCharge)
{
Log(Logs::Moderate, Logs::Netcode, "RoF2::ENCODE(OP_DeleteCharge)");
Log(Logs::Detail, Logs::Netcode, "RoF2::ENCODE(OP_DeleteCharge)");
ENCODE_FORWARD(OP_MoveItem);
}
@ -1644,7 +1644,7 @@ namespace RoF2
ENCODE_LENGTH_EXACT(LootingItem_Struct);
SETUP_DIRECT_ENCODE(LootingItem_Struct, structs::LootingItem_Struct);
Log(Logs::Moderate, Logs::Netcode, "RoF2::ENCODE(OP_LootItem)");
Log(Logs::Detail, Logs::Netcode, "RoF2::ENCODE(OP_LootItem)");
OUT(lootee);
OUT(looter);
@ -1802,7 +1802,7 @@ namespace RoF2
ENCODE_LENGTH_EXACT(MoveItem_Struct);
SETUP_DIRECT_ENCODE(MoveItem_Struct, structs::MoveItem_Struct);
Log(Logs::Moderate, Logs::Netcode, "RoF2::ENCODE(OP_MoveItem)");
Log(Logs::Detail, Logs::Netcode, "RoF2::ENCODE(OP_MoveItem)");
eq->from_slot = ServerToRoF2Slot(emu->from_slot);
eq->to_slot = ServerToRoF2Slot(emu->to_slot);
@ -3967,7 +3967,7 @@ namespace RoF2
}
float SpawnSize = emu->size;
if (!((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
if (!((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522))
)
{
@ -4172,7 +4172,7 @@ namespace RoF2
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0xffffffff); // These do something with OP_WeaponEquip1
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0xffffffff); // ^
if ((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
if ((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522)
)
{
@ -5023,7 +5023,7 @@ namespace RoF2
DECODE_LENGTH_EXACT(structs::LootingItem_Struct);
SETUP_DIRECT_DECODE(LootingItem_Struct, structs::LootingItem_Struct);
Log(Logs::Moderate, Logs::Netcode, "RoF2::DECODE(OP_LootItem)");
Log(Logs::Detail, Logs::Netcode, "RoF2::DECODE(OP_LootItem)");
IN(lootee);
IN(looter);
@ -5038,7 +5038,7 @@ namespace RoF2
DECODE_LENGTH_EXACT(structs::MoveItem_Struct);
SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct);
Log(Logs::Moderate, Logs::Netcode, "RoF2::DECODE(OP_MoveItem)");
Log(Logs::Detail, Logs::Netcode, "RoF2::DECODE(OP_MoveItem)");
emu->from_slot = RoF2ToServerSlot(eq->from_slot);
emu->to_slot = RoF2ToServerSlot(eq->to_slot);

View File

@ -458,7 +458,7 @@ namespace SoD
ENCODE(OP_DeleteCharge)
{
Log(Logs::Moderate, Logs::Netcode, "SoD::ENCODE(OP_DeleteCharge)");
Log(Logs::Detail, Logs::Netcode, "SoD::ENCODE(OP_DeleteCharge)");
ENCODE_FORWARD(OP_MoveItem);
}
@ -1128,7 +1128,7 @@ namespace SoD
ENCODE_LENGTH_EXACT(LootingItem_Struct);
SETUP_DIRECT_ENCODE(LootingItem_Struct, structs::LootingItem_Struct);
Log(Logs::Moderate, Logs::Netcode, "SoD::ENCODE(OP_LootItem)");
Log(Logs::Detail, Logs::Netcode, "SoD::ENCODE(OP_LootItem)");
OUT(lootee);
OUT(looter);
@ -1277,7 +1277,7 @@ namespace SoD
ENCODE_LENGTH_EXACT(MoveItem_Struct);
SETUP_DIRECT_ENCODE(MoveItem_Struct, structs::MoveItem_Struct);
Log(Logs::Moderate, Logs::Netcode, "SoD::ENCODE(OP_MoveItem)");
Log(Logs::Detail, Logs::Netcode, "SoD::ENCODE(OP_MoveItem)");
eq->from_slot = ServerToSoDSlot(emu->from_slot);
eq->to_slot = ServerToSoDSlot(emu->to_slot);
@ -2467,7 +2467,7 @@ namespace SoD
}
float SpawnSize = emu->size;
if (!((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
if (!((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522))
)
{
@ -2666,7 +2666,7 @@ namespace SoD
Buffer += sizeof(structs::Spawn_Struct_Position);
if ((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
if ((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522)
)
{
@ -2693,7 +2693,7 @@ namespace SoD
}
if ((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
if ((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522)
)
{
@ -3226,7 +3226,7 @@ namespace SoD
DECODE_LENGTH_EXACT(structs::LootingItem_Struct);
SETUP_DIRECT_DECODE(LootingItem_Struct, structs::LootingItem_Struct);
Log(Logs::Moderate, Logs::Netcode, "SoD::DECODE(OP_LootItem)");
Log(Logs::Detail, Logs::Netcode, "SoD::DECODE(OP_LootItem)");
IN(lootee);
IN(looter);
@ -3241,7 +3241,7 @@ namespace SoD
DECODE_LENGTH_EXACT(structs::MoveItem_Struct);
SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct);
Log(Logs::Moderate, Logs::Netcode, "SoD::DECODE(OP_MoveItem)");
Log(Logs::Detail, Logs::Netcode, "SoD::DECODE(OP_MoveItem)");
emu->from_slot = SoDToServerSlot(eq->from_slot);
emu->to_slot = SoDToServerSlot(eq->to_slot);

View File

@ -436,7 +436,7 @@ namespace SoF
ENCODE(OP_DeleteCharge)
{
Log(Logs::Moderate, Logs::Netcode, "SoF::ENCODE(OP_DeleteCharge)");
Log(Logs::Detail, Logs::Netcode, "SoF::ENCODE(OP_DeleteCharge)");
ENCODE_FORWARD(OP_MoveItem);
}
@ -923,7 +923,7 @@ namespace SoF
ENCODE_LENGTH_EXACT(LootingItem_Struct);
SETUP_DIRECT_ENCODE(LootingItem_Struct, structs::LootingItem_Struct);
Log(Logs::Moderate, Logs::Netcode, "SoF::ENCODE(OP_LootItem)");
Log(Logs::Detail, Logs::Netcode, "SoF::ENCODE(OP_LootItem)");
OUT(lootee);
OUT(looter);
@ -954,7 +954,7 @@ namespace SoF
ENCODE_LENGTH_EXACT(MoveItem_Struct);
SETUP_DIRECT_ENCODE(MoveItem_Struct, structs::MoveItem_Struct);
Log(Logs::Moderate, Logs::Netcode, "SoF::ENCODE(OP_MoveItem)");
Log(Logs::Detail, Logs::Netcode, "SoF::ENCODE(OP_MoveItem)");
eq->from_slot = ServerToSoFSlot(emu->from_slot);
eq->to_slot = ServerToSoFSlot(emu->to_slot);
@ -2631,7 +2631,7 @@ namespace SoF
DECODE_LENGTH_EXACT(structs::LootingItem_Struct);
SETUP_DIRECT_DECODE(LootingItem_Struct, structs::LootingItem_Struct);
Log(Logs::Moderate, Logs::Netcode, "SoF::DECODE(OP_LootItem)");
Log(Logs::Detail, Logs::Netcode, "SoF::DECODE(OP_LootItem)");
IN(lootee);
IN(looter);
@ -2646,7 +2646,7 @@ namespace SoF
DECODE_LENGTH_EXACT(structs::MoveItem_Struct);
SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct);
Log(Logs::Moderate, Logs::Netcode, "SoF::DECODE(OP_MoveItem)");
Log(Logs::Detail, Logs::Netcode, "SoF::DECODE(OP_MoveItem)");
emu->from_slot = SoFToServerSlot(eq->from_slot);
emu->to_slot = SoFToServerSlot(eq->to_slot);

View File

@ -380,7 +380,7 @@ namespace Titanium
ENCODE(OP_DeleteCharge)
{
Log(Logs::Moderate, Logs::Netcode, "Titanium::ENCODE(OP_DeleteCharge)");
Log(Logs::Detail, Logs::Netcode, "Titanium::ENCODE(OP_DeleteCharge)");
ENCODE_FORWARD(OP_MoveItem);
}
@ -890,7 +890,7 @@ namespace Titanium
ENCODE_LENGTH_EXACT(LootingItem_Struct);
SETUP_DIRECT_ENCODE(LootingItem_Struct, structs::LootingItem_Struct);
Log(Logs::Moderate, Logs::Netcode, "Titanium::ENCODE(OP_LootItem)");
Log(Logs::Detail, Logs::Netcode, "Titanium::ENCODE(OP_LootItem)");
OUT(lootee);
OUT(looter);
@ -934,7 +934,7 @@ namespace Titanium
ENCODE_LENGTH_EXACT(MoveItem_Struct);
SETUP_DIRECT_ENCODE(MoveItem_Struct, structs::MoveItem_Struct);
Log(Logs::Moderate, Logs::Netcode, "Titanium::ENCODE(OP_MoveItem)");
Log(Logs::Detail, Logs::Netcode, "Titanium::ENCODE(OP_MoveItem)");
eq->from_slot = ServerToTitaniumSlot(emu->from_slot);
eq->to_slot = ServerToTitaniumSlot(emu->to_slot);
@ -2178,7 +2178,7 @@ namespace Titanium
DECODE_LENGTH_EXACT(structs::LootingItem_Struct);
SETUP_DIRECT_DECODE(LootingItem_Struct, structs::LootingItem_Struct);
Log(Logs::Moderate, Logs::Netcode, "Titanium::DECODE(OP_LootItem)");
Log(Logs::Detail, Logs::Netcode, "Titanium::DECODE(OP_LootItem)");
IN(lootee);
IN(looter);
@ -2193,7 +2193,7 @@ namespace Titanium
DECODE_LENGTH_EXACT(structs::MoveItem_Struct);
SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct);
Log(Logs::Moderate, Logs::Netcode, "Titanium::DECODE(OP_MoveItem)");
Log(Logs::Detail, Logs::Netcode, "Titanium::DECODE(OP_MoveItem)");
emu->from_slot = TitaniumToServerSlot(eq->from_slot);
emu->to_slot = TitaniumToServerSlot(eq->to_slot);

View File

@ -579,7 +579,7 @@ namespace UF
ENCODE(OP_DeleteCharge)
{
Log(Logs::Moderate, Logs::Netcode, "UF::ENCODE(OP_DeleteCharge)");
Log(Logs::Detail, Logs::Netcode, "UF::ENCODE(OP_DeleteCharge)");
ENCODE_FORWARD(OP_MoveItem);
}
@ -1349,7 +1349,7 @@ namespace UF
ENCODE_LENGTH_EXACT(LootingItem_Struct);
SETUP_DIRECT_ENCODE(LootingItem_Struct, structs::LootingItem_Struct);
Log(Logs::Moderate, Logs::Netcode, "UF::ENCODE(OP_LootItem)");
Log(Logs::Detail, Logs::Netcode, "UF::ENCODE(OP_LootItem)");
OUT(lootee);
OUT(looter);
@ -1502,7 +1502,7 @@ namespace UF
ENCODE_LENGTH_EXACT(MoveItem_Struct);
SETUP_DIRECT_ENCODE(MoveItem_Struct, structs::MoveItem_Struct);
Log(Logs::Moderate, Logs::Netcode, "UF::ENCODE(OP_MoveItem)");
Log(Logs::Detail, Logs::Netcode, "UF::ENCODE(OP_MoveItem)");
eq->from_slot = ServerToUFSlot(emu->from_slot);
eq->to_slot = ServerToUFSlot(emu->to_slot);
@ -2739,7 +2739,7 @@ namespace UF
}
float SpawnSize = emu->size;
if (!((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
if (!((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522))
)
{
@ -2942,7 +2942,7 @@ namespace UF
Buffer += sizeof(structs::Spawn_Struct_Position);
if ((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
if ((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522)
)
{
@ -2978,7 +2978,7 @@ namespace UF
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
}
if ((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
if ((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522)
)
{
@ -3584,7 +3584,7 @@ namespace UF
DECODE_LENGTH_EXACT(structs::LootingItem_Struct);
SETUP_DIRECT_DECODE(LootingItem_Struct, structs::LootingItem_Struct);
Log(Logs::Moderate, Logs::Netcode, "UF::DECODE(OP_LootItem)");
Log(Logs::Detail, Logs::Netcode, "UF::DECODE(OP_LootItem)");
IN(lootee);
IN(looter);
@ -3599,7 +3599,7 @@ namespace UF
DECODE_LENGTH_EXACT(structs::MoveItem_Struct);
SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct);
Log(Logs::Moderate, Logs::Netcode, "UF::DECODE(OP_MoveItem)");
Log(Logs::Detail, Logs::Netcode, "UF::DECODE(OP_MoveItem)");
emu->from_slot = UFToServerSlot(eq->from_slot);
emu->to_slot = UFToServerSlot(eq->to_slot);

View File

@ -22,10 +22,10 @@ void PathManager::LoadPaths()
std::filesystem::current_path(m_server_path);
LogInfo("[PathManager] server [{}]", m_server_path);
LogInfo("server [{}]", m_server_path);
if (!EQEmuConfig::LoadConfig()) {
LogError("[PathManager] Failed to load eqemu config");
LogError("Failed to load eqemu config");
return;
}
@ -77,14 +77,14 @@ void PathManager::LoadPaths()
m_log_path = fs::relative(fs::path{m_server_path + "/" + c->LogDir}).string();
}
LogInfo("[PathManager] logs [{}]", m_log_path);
LogInfo("[PathManager] lua mods [{}]", m_lua_mods_path);
LogInfo("[PathManager] lua_modules [{}]", m_lua_modules_path);
LogInfo("[PathManager] maps [{}]", m_maps_path);
LogInfo("[PathManager] patches [{}]", m_patch_path);
LogInfo("[PathManager] plugins [{}]", m_plugins_path);
LogInfo("[PathManager] quests [{}]", m_quests_path);
LogInfo("[PathManager] shared_memory [{}]", m_shared_memory_path);
LogInfo("logs path [{}]", m_log_path);
LogInfo("lua mods path [{}]", m_lua_mods_path);
LogInfo("lua_modules path [{}]", m_lua_modules_path);
LogInfo("maps path [{}]", m_maps_path);
LogInfo("patches path [{}]", m_patch_path);
LogInfo("plugins path [{}]", m_plugins_path);
LogInfo("quests path [{}]", m_quests_path);
LogInfo("shared_memory path [{}]", m_shared_memory_path);
}
const std::string &PathManager::GetServerPath() const

View File

@ -55,14 +55,12 @@ std::string GetPlatformName()
return "UCS";
case EQEmuExePlatform::ExePlatformLogin:
return "Login";
case EQEmuExePlatform::ExePlatformSocket_Server:
return "SocketServer";
case EQEmuExePlatform::ExePlatformSharedMemory:
return "SharedMemory";
return "SharedMem";
case EQEmuExePlatform::ExePlatformClientImport:
return "ClientImport";
return "Import";
case EQEmuExePlatform::ExePlatformClientExport:
return "ClientExport";
return "Export";
case EQEmuExePlatform::ExePlatformLaunch:
return "Launch";
case EQEmuExePlatform::ExePlatformHC:

View File

@ -18,6 +18,7 @@
*/
#include "profanity_manager.h"
#include "eqemu_logsys.h"
#include "dbcore.h"
#include "strings.h"
@ -235,6 +236,8 @@ bool EQ::ProfanityManager::load_database_entries(DBcore *db) {
}
}
LogInfo("Loaded [{}] profanity entries", Strings::Commify(profanity_list.size()));
return true;
}

View File

@ -304,6 +304,13 @@ bool RuleManager::LoadRules(Database *db, const std::string &rule_set_name, bool
}
}
LogInfo(
"Loaded [{}] rules(s) in rule_set [{}] id [{}]",
Strings::Commify(std::to_string(l.size())),
rule_set_name,
rule_set_id
);
return true;
}

View File

@ -42,6 +42,7 @@
#include "repositories/account_repository.h"
#include "repositories/faction_association_repository.h"
#include "path_manager.h"
#include "repositories/loottable_repository.h"
namespace ItemField
{
@ -942,10 +943,11 @@ bool SharedDatabase::LoadItems(const std::string &prefix) {
EQ::IPCMutex mutex("items");
mutex.Lock();
std::string file_name = fmt::format("{}/{}{}", path.GetSharedMemoryPath(), prefix, std::string("items"));
LogInfo("[Shared Memory] Attempting to load file [{}]", file_name);
items_mmf = std::make_unique<EQ::MemoryMappedFile>(file_name);
items_hash = std::make_unique<EQ::FixedMemoryHashSet<EQ::ItemData>>(static_cast<uint8*>(items_mmf->Get()), items_mmf->Size());
mutex.Unlock();
LogInfo("Loaded [{}] items via shared memory", Strings::Commify(m_shared_items_count));
} catch(std::exception& ex) {
LogError("Error Loading Items: {}", ex.what());
return false;
@ -1438,10 +1440,12 @@ bool SharedDatabase::LoadNPCFactionLists(const std::string &prefix) {
EQ::IPCMutex mutex("faction");
mutex.Lock();
std::string file_name = fmt::format("{}/{}{}", path.GetSharedMemoryPath(), prefix, std::string("faction"));
LogInfo("[Shared Memory] Attempting to load file [{}]", file_name);
LogInfo("Loading [{}]", file_name);
faction_mmf = std::make_unique<EQ::MemoryMappedFile>(file_name);
faction_hash = std::make_unique<EQ::FixedMemoryHashSet<NPCFactionList>>(static_cast<uint8*>(faction_mmf->Get()), faction_mmf->Size());
mutex.Unlock();
LogInfo("Loaded faction lists via shared memory");
} catch(std::exception& ex) {
LogError("Error Loading npc factions: {}", ex.what());
return false;
@ -1516,6 +1520,8 @@ bool SharedDatabase::LoadFactionAssociation(const std::string &prefix)
new EQ::FixedMemoryHashSet<FactionAssociations>(reinterpret_cast<uint8 *>(faction_associations_mmf->Get()),
faction_associations_mmf->Size()));
mutex.Unlock();
LogInfo("Loaded faction associations via shared memory");
} catch (std::exception &ex) {
LogError("Error Loading faction associations: {}", ex.what());
return false;
@ -1724,8 +1730,11 @@ bool SharedDatabase::LoadSkillCaps(const std::string &prefix) {
EQ::IPCMutex mutex("skill_caps");
mutex.Lock();
std::string file_name = fmt::format("{}/{}{}", path.GetSharedMemoryPath(), prefix, std::string("skill_caps"));
LogInfo("[Shared Memory] Attempting to load file [{}]", file_name);
LogInfo("Loading [{}]", file_name);
skill_caps_mmf = std::make_unique<EQ::MemoryMappedFile>(file_name);
LogInfo("Loaded skill caps via shared memory");
mutex.Unlock();
} catch(std::exception &ex) {
LogError("Error loading skill caps: {}", ex.what());
@ -1884,10 +1893,12 @@ bool SharedDatabase::LoadSpells(const std::string &prefix, int32 *records, const
std::string file_name = fmt::format("{}/{}{}", path.GetSharedMemoryPath(), prefix, std::string("spells"));
spells_mmf = std::make_unique<EQ::MemoryMappedFile>(file_name);
LogInfo("[Shared Memory] Attempting to load file [{}]", file_name);
LogInfo("Loading [{}]", file_name);
*records = *static_cast<uint32*>(spells_mmf->Get());
*sp = reinterpret_cast<const SPDat_Spell_Struct*>(static_cast<char*>(spells_mmf->Get()) + 4);
mutex.Unlock();
LogInfo("Loaded [{}] spells via shared memory", Strings::Commify(m_shared_spells_count));
}
catch(std::exception& ex) {
LogError("Error Loading Spells: {}", ex.what());
@ -2099,6 +2110,8 @@ bool SharedDatabase::LoadBaseData(const std::string &prefix) {
std::string file_name = fmt::format("{}/{}{}", path.GetSharedMemoryPath(), prefix, std::string("base_data"));
base_data_mmf = std::make_unique<EQ::MemoryMappedFile>(file_name);
mutex.Unlock();
LogInfo("Loaded base data via shared memory");
} catch(std::exception& ex) {
LogError("Error Loading Base Data: {}", ex.what());
return false;
@ -2423,6 +2436,9 @@ bool SharedDatabase::LoadLoot(const std::string &prefix) {
loot_table_hash = std::make_unique<EQ::FixedMemoryVariableHashSet<LootTable_Struct>>(
static_cast<uint8*>(loot_table_mmf->Get()),
loot_table_mmf->Size());
LogInfo("Loaded loot tables via shared memory");
std::string file_name_ld = fmt::format("{}/{}{}", path.GetSharedMemoryPath(), prefix, std::string("loot_drop"));
loot_drop_mmf = std::make_unique<EQ::MemoryMappedFile>(file_name_ld);
loot_drop_hash = std::make_unique<EQ::FixedMemoryVariableHashSet<LootDrop_Struct>>(

View File

@ -95,6 +95,12 @@ public:
static std::string &RTrim(std::string &str, const std::string &chars = "\t\n\v\f\r ");
static std::string &Trim(std::string &str, const std::string &chars = "\t\n\v\f\r ");
static std::string Commify(const std::string &number);
static std::string Commify(uint16 number) { return Strings::Commify(std::to_string(number)); };
static std::string Commify(uint32 number) { return Strings::Commify(std::to_string(number)); };
static std::string Commify(uint64 number) { return Strings::Commify(std::to_string(number)); };
static std::string Commify(int16 number) { return Strings::Commify(std::to_string(number)); };
static std::string Commify(int32 number) { return Strings::Commify(std::to_string(number)); };
static std::string Commify(int64 number) { return Strings::Commify(std::to_string(number)); };
static std::string ConvertToDigit(int n, std::string suffix);
static std::string Escape(const std::string &s);
static std::string GetBetween(const std::string &s, std::string start_delim, std::string stop_delim);

502
common/termcolor/rang.hpp Normal file
View File

@ -0,0 +1,502 @@
#ifndef RANG_DOT_HPP
#define RANG_DOT_HPP
#if defined(__unix__) || defined(__unix) || defined(__linux__)
#define OS_LINUX
#elif defined(WIN32) || defined(_WIN32) || defined(_WIN64)
#define OS_WIN
#elif defined(__APPLE__) || defined(__MACH__)
#define OS_MAC
#else
#error Unknown Platform
#endif
#if defined(OS_LINUX) || defined(OS_MAC)
#include <unistd.h>
#elif defined(OS_WIN)
#if defined(_WIN32_WINNT) && (_WIN32_WINNT < 0x0600)
#error \
"Please include rang.hpp before any windows system headers or set _WIN32_WINNT at least to _WIN32_WINNT_VISTA"
#elif !defined(_WIN32_WINNT)
#define _WIN32_WINNT _WIN32_WINNT_VISTA
#endif
#include <windows.h>
#include <io.h>
#include <memory>
// Only defined in windows 10 onwards, redefining in lower windows since it
// doesn't gets used in lower versions
// https://docs.microsoft.com/en-us/windows/console/getconsolemode
#ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING
#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
#endif
#endif
#include <algorithm>
#include <atomic>
#include <cstdlib>
#include <cstring>
#include <iostream>
namespace rang {
/* For better compability with most of terminals do not use any style settings
* except of reset, bold and reversed.
* Note that on Windows terminals bold style is same as fgB color.
*/
enum class style {
reset = 0,
bold = 1,
dim = 2,
italic = 3,
underline = 4,
blink = 5,
rblink = 6,
reversed = 7,
conceal = 8,
crossed = 9
};
enum class fg {
black = 30,
red = 31,
green = 32,
yellow = 33,
blue = 34,
magenta = 35,
cyan = 36,
gray = 37,
reset = 39
};
enum class bg {
black = 40,
red = 41,
green = 42,
yellow = 43,
blue = 44,
magenta = 45,
cyan = 46,
gray = 47,
reset = 49
};
enum class fgB {
black = 90,
red = 91,
green = 92,
yellow = 93,
blue = 94,
magenta = 95,
cyan = 96,
gray = 97
};
enum class bgB {
black = 100,
red = 101,
green = 102,
yellow = 103,
blue = 104,
magenta = 105,
cyan = 106,
gray = 107
};
enum class control { // Behaviour of rang function calls
Off = 0, // toggle off rang style/color calls
Auto = 1, // (Default) autodect terminal and colorize if needed
Force = 2 // force ansi color output to non terminal streams
};
// Use rang::setControlMode to set rang control mode
enum class winTerm { // Windows Terminal Mode
Auto = 0, // (Default) automatically detects wheter Ansi or Native API
Ansi = 1, // Force use Ansi API
Native = 2 // Force use Native API
};
// Use rang::setWinTermMode to explicitly set terminal API for Windows
// Calling rang::setWinTermMode have no effect on other OS
namespace rang_implementation {
inline std::atomic<control> &controlMode() noexcept
{
static std::atomic<control> value(control::Auto);
return value;
}
inline std::atomic<winTerm> &winTermMode() noexcept
{
static std::atomic<winTerm> termMode(winTerm::Auto);
return termMode;
}
inline bool supportsColor() noexcept
{
#if defined(OS_LINUX) || defined(OS_MAC)
static const bool result = [] {
const char *Terms[]
= { "ansi", "color", "console", "cygwin", "gnome",
"konsole", "kterm", "linux", "msys", "putty",
"rxvt", "screen", "vt100", "xterm" };
const char *env_p = std::getenv("TERM");
if (env_p == nullptr) {
return false;
}
return std::any_of(std::begin(Terms), std::end(Terms),
[&](const char *term) {
return std::strstr(env_p, term) != nullptr;
});
}();
#elif defined(OS_WIN)
// All windows versions support colors through native console methods
static constexpr bool result = true;
#endif
return result;
}
#ifdef OS_WIN
inline bool isMsysPty(int fd) noexcept
{
// Dynamic load for binary compability with old Windows
const auto ptrGetFileInformationByHandleEx
= reinterpret_cast<decltype(&GetFileInformationByHandleEx)>(
GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")),
"GetFileInformationByHandleEx"));
if (!ptrGetFileInformationByHandleEx) {
return false;
}
HANDLE h = reinterpret_cast<HANDLE>(_get_osfhandle(fd));
if (h == INVALID_HANDLE_VALUE) {
return false;
}
// Check that it's a pipe:
if (GetFileType(h) != FILE_TYPE_PIPE) {
return false;
}
// POD type is binary compatible with FILE_NAME_INFO from WinBase.h
// It have the same alignment and used to avoid UB in caller code
struct MY_FILE_NAME_INFO {
DWORD FileNameLength;
WCHAR FileName[MAX_PATH];
};
auto pNameInfo = std::unique_ptr<MY_FILE_NAME_INFO>(
new (std::nothrow) MY_FILE_NAME_INFO());
if (!pNameInfo) {
return false;
}
// Check pipe name is template of
// {"cygwin-","msys-"}XXXXXXXXXXXXXXX-ptyX-XX
if (!ptrGetFileInformationByHandleEx(h, FileNameInfo, pNameInfo.get(),
sizeof(MY_FILE_NAME_INFO))) {
return false;
}
std::wstring name(pNameInfo->FileName, pNameInfo->FileNameLength / sizeof(WCHAR));
if ((name.find(L"msys-") == std::wstring::npos
&& name.find(L"cygwin-") == std::wstring::npos)
|| name.find(L"-pty") == std::wstring::npos) {
return false;
}
return true;
}
#endif
inline bool isTerminal(const std::streambuf *osbuf) noexcept
{
using std::cerr;
using std::clog;
using std::cout;
#if defined(OS_LINUX) || defined(OS_MAC)
if (osbuf == cout.rdbuf()) {
static const bool cout_term = isatty(fileno(stdout)) != 0;
return cout_term;
} else if (osbuf == cerr.rdbuf() || osbuf == clog.rdbuf()) {
static const bool cerr_term = isatty(fileno(stderr)) != 0;
return cerr_term;
}
#elif defined(OS_WIN)
if (osbuf == cout.rdbuf()) {
static const bool cout_term
= (_isatty(_fileno(stdout)) || isMsysPty(_fileno(stdout)));
return cout_term;
} else if (osbuf == cerr.rdbuf() || osbuf == clog.rdbuf()) {
static const bool cerr_term
= (_isatty(_fileno(stderr)) || isMsysPty(_fileno(stderr)));
return cerr_term;
}
#endif
return false;
}
template <typename T>
using enableStd = typename std::enable_if<
std::is_same<T, rang::style>::value || std::is_same<T, rang::fg>::value
|| std::is_same<T, rang::bg>::value || std::is_same<T, rang::fgB>::value
|| std::is_same<T, rang::bgB>::value,
std::ostream &>::type;
#ifdef OS_WIN
struct SGR { // Select Graphic Rendition parameters for Windows console
BYTE fgColor; // foreground color (0-15) lower 3 rgb bits + intense bit
BYTE bgColor; // background color (0-15) lower 3 rgb bits + intense bit
BYTE bold; // emulated as FOREGROUND_INTENSITY bit
BYTE underline; // emulated as BACKGROUND_INTENSITY bit
BOOLEAN inverse; // swap foreground/bold & background/underline
BOOLEAN conceal; // set foreground/bold to background/underline
};
enum class AttrColor : BYTE { // Color attributes for console screen buffer
black = 0,
red = 4,
green = 2,
yellow = 6,
blue = 1,
magenta = 5,
cyan = 3,
gray = 7
};
inline HANDLE getConsoleHandle(const std::streambuf *osbuf) noexcept
{
if (osbuf == std::cout.rdbuf()) {
static const HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
return hStdout;
} else if (osbuf == std::cerr.rdbuf() || osbuf == std::clog.rdbuf()) {
static const HANDLE hStderr = GetStdHandle(STD_ERROR_HANDLE);
return hStderr;
}
return INVALID_HANDLE_VALUE;
}
inline bool setWinTermAnsiColors(const std::streambuf *osbuf) noexcept
{
HANDLE h = getConsoleHandle(osbuf);
if (h == INVALID_HANDLE_VALUE) {
return false;
}
DWORD dwMode = 0;
if (!GetConsoleMode(h, &dwMode)) {
return false;
}
dwMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
if (!SetConsoleMode(h, dwMode)) {
return false;
}
return true;
}
inline bool supportsAnsi(const std::streambuf *osbuf) noexcept
{
using std::cerr;
using std::clog;
using std::cout;
if (osbuf == cout.rdbuf()) {
static const bool cout_ansi
= (isMsysPty(_fileno(stdout)) || setWinTermAnsiColors(osbuf));
return cout_ansi;
} else if (osbuf == cerr.rdbuf() || osbuf == clog.rdbuf()) {
static const bool cerr_ansi
= (isMsysPty(_fileno(stderr)) || setWinTermAnsiColors(osbuf));
return cerr_ansi;
}
return false;
}
inline const SGR &defaultState() noexcept
{
static const SGR defaultSgr = []() -> SGR {
CONSOLE_SCREEN_BUFFER_INFO info;
WORD attrib = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE;
if (GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE),
&info)
|| GetConsoleScreenBufferInfo(GetStdHandle(STD_ERROR_HANDLE),
&info)) {
attrib = info.wAttributes;
}
SGR sgr = { 0, 0, 0, 0, FALSE, FALSE };
sgr.fgColor = attrib & 0x0F;
sgr.bgColor = (attrib & 0xF0) >> 4;
return sgr;
}();
return defaultSgr;
}
inline BYTE ansi2attr(BYTE rgb) noexcept
{
static const AttrColor rev[8]
= { AttrColor::black, AttrColor::red, AttrColor::green,
AttrColor::yellow, AttrColor::blue, AttrColor::magenta,
AttrColor::cyan, AttrColor::gray };
return static_cast<BYTE>(rev[rgb]);
}
inline void setWinSGR(rang::bg col, SGR &state) noexcept
{
if (col != rang::bg::reset) {
state.bgColor = ansi2attr(static_cast<BYTE>(col) - 40);
} else {
state.bgColor = defaultState().bgColor;
}
}
inline void setWinSGR(rang::fg col, SGR &state) noexcept
{
if (col != rang::fg::reset) {
state.fgColor = ansi2attr(static_cast<BYTE>(col) - 30);
} else {
state.fgColor = defaultState().fgColor;
}
}
inline void setWinSGR(rang::bgB col, SGR &state) noexcept
{
state.bgColor = (BACKGROUND_INTENSITY >> 4)
| ansi2attr(static_cast<BYTE>(col) - 100);
}
inline void setWinSGR(rang::fgB col, SGR &state) noexcept
{
state.fgColor
= FOREGROUND_INTENSITY | ansi2attr(static_cast<BYTE>(col) - 90);
}
inline void setWinSGR(rang::style style, SGR &state) noexcept
{
switch (style) {
case rang::style::reset: state = defaultState(); break;
case rang::style::bold: state.bold = FOREGROUND_INTENSITY; break;
case rang::style::underline:
case rang::style::blink:
state.underline = BACKGROUND_INTENSITY;
break;
case rang::style::reversed: state.inverse = TRUE; break;
case rang::style::conceal: state.conceal = TRUE; break;
default: break;
}
}
inline SGR &current_state() noexcept
{
static SGR state = defaultState();
return state;
}
inline WORD SGR2Attr(const SGR &state) noexcept
{
WORD attrib = 0;
if (state.conceal) {
if (state.inverse) {
attrib = (state.fgColor << 4) | state.fgColor;
if (state.bold)
attrib |= FOREGROUND_INTENSITY | BACKGROUND_INTENSITY;
} else {
attrib = (state.bgColor << 4) | state.bgColor;
if (state.underline)
attrib |= FOREGROUND_INTENSITY | BACKGROUND_INTENSITY;
}
} else if (state.inverse) {
attrib = (state.fgColor << 4) | state.bgColor;
if (state.bold) attrib |= BACKGROUND_INTENSITY;
if (state.underline) attrib |= FOREGROUND_INTENSITY;
} else {
attrib = state.fgColor | (state.bgColor << 4) | state.bold
| state.underline;
}
return attrib;
}
template <typename T>
inline void setWinColorAnsi(std::ostream &os, T const value)
{
os << "\033[" << static_cast<int>(value) << "m";
}
template <typename T>
inline void setWinColorNative(std::ostream &os, T const value)
{
const HANDLE h = getConsoleHandle(os.rdbuf());
if (h != INVALID_HANDLE_VALUE) {
setWinSGR(value, current_state());
// Out all buffered text to console with previous settings:
os.flush();
SetConsoleTextAttribute(h, SGR2Attr(current_state()));
}
}
template <typename T>
inline enableStd<T> setColor(std::ostream &os, T const value)
{
if (winTermMode() == winTerm::Auto) {
if (supportsAnsi(os.rdbuf())) {
setWinColorAnsi(os, value);
} else {
setWinColorNative(os, value);
}
} else if (winTermMode() == winTerm::Ansi) {
setWinColorAnsi(os, value);
} else {
setWinColorNative(os, value);
}
return os;
}
#else
template <typename T>
inline enableStd<T> setColor(std::ostream &os, T const value)
{
return os << "\033[" << static_cast<int>(value) << "m";
}
#endif
} // namespace rang_implementation
template <typename T>
inline rang_implementation::enableStd<T> operator<<(std::ostream &os,
const T value)
{
const control option = rang_implementation::controlMode();
switch (option) {
case control::Auto:
return rang_implementation::supportsColor()
&& rang_implementation::isTerminal(os.rdbuf())
? rang_implementation::setColor(os, value)
: os;
case control::Force: return rang_implementation::setColor(os, value);
default: return os;
}
}
inline void setWinTermMode(const rang::winTerm value) noexcept
{
rang_implementation::winTermMode() = value;
}
inline void setControlMode(const control value) noexcept
{
rang_implementation::controlMode() = value;
}
} // namespace rang
#undef OS_LINUX
#undef OS_WIN
#undef OS_MAC
#endif /* ifndef RANG_DOT_HPP */

View File

@ -30,7 +30,7 @@ void ZoneStore::LoadZones(Database &db)
{
m_zones = ZoneRepository::All(db);
LogInfo("[ZoneStore] Loaded [{}] zones", m_zones.size());
LogInfo("Loaded [{}] zones", m_zones.size());
}
/**

View File

@ -41,7 +41,7 @@ Database::Database(
exit(1);
}
else {
LogStatus("Using database [{0}] at [{1}:{2}]", name, host, port);
LogInfo("Using database [{0}] at [{1}:{2}]", name, host, port);
}
}

View File

@ -148,6 +148,8 @@ void LoadServerConfig()
void start_web_server()
{
sleep(1);
int web_api_port = server.config.GetVariableInt("web_api", "port", 6000);
LogInfo("Webserver API now listening on port [{0}]", web_api_port);
@ -253,9 +255,6 @@ int main(int argc, char **argv)
#endif
LogInfo("Server Started");
if (LogSys.log_settings[Logs::Loginserver].log_to_console == 1) {
LogInfo("Loginserver logging set to level [1] for more debugging, enable detail [3]");
}
/**
* Web API
@ -267,8 +266,8 @@ int main(int argc, char **argv)
}
LogInfo("[Config] [Account] CanAutoCreateAccounts [{0}]", server.options.CanAutoCreateAccounts());
LogInfo("[Config] [Client_Configuration] DisplayExpansions [{0}]", server.options.IsDisplayExpansions());
LogInfo("[Config] [Client_Configuration] MaxExpansions [{0}]", server.options.GetMaxExpansions());
LogInfo("[Config] [ClientConfiguration] DisplayExpansions [{0}]", server.options.IsDisplayExpansions());
LogInfo("[Config] [ClientConfiguration] MaxExpansions [{0}]", server.options.GetMaxExpansions());
#ifdef LSPX
LogInfo("[Config] [Account] CanAutoLinkAccounts [{0}]", server.options.CanAutoLinkAccounts());

View File

@ -164,13 +164,9 @@ int main(int argc, char **argv)
if (!RuleManager::Instance()->LoadRules(&database, "default", false)) {
LogInfo("No rule set configured, using default rules");
}
else {
LogInfo("Loaded default rule set 'default'");
}
}
EQ::InitializeDynamicLookups();
LogInfo("Initialized dynamic dictionary entries");
}
@ -272,7 +268,6 @@ int main(int argc, char **argv)
}
if (load_all || load_factions) {
LogInfo("Loading factions");
try {
LoadFactions(&content_db, hotfix_name);
} catch (std::exception &ex) {

View File

@ -487,7 +487,7 @@ Clientlist::Clientlist(int ChatPort) {
exit(1);
chatsf->OnNewConnection([this](std::shared_ptr<EQ::Net::EQStream> stream) {
LogF(Logs::General, Logs::Loginserver, "New Client UDP connection from {0}:{1}", stream->GetRemoteIP(), stream->GetRemotePort());
LogInfo("New Client UDP connection from [{0}] [{1}]", stream->GetRemoteIP(), stream->GetRemotePort());
stream->SetOpcodeManager(&ChatOpMgr);
auto c = new Client(stream);

View File

@ -153,13 +153,10 @@ int main() {
} else {
if(!RuleManager::Instance()->LoadRules(&database, "default", false)) {
LogInfo("No rule set configured, using default rules");
} else {
LogInfo("Loaded default rule set 'default'", tmp);
}
}
EQ::InitializeDynamicLookups();
LogInfo("Initialized dynamic dictionary entries");
database.ExpireMail();

94
world/cli/test_colors.cpp Normal file
View File

@ -0,0 +1,94 @@
#include "../../common/zone_store.h"
#include "../../common/termcolor/rang.hpp"
void WorldserverCLI::TestColors(int argc, char **argv, argh::parser &cmd, std::string &description)
{
description = "Test command";
if (cmd[{"-h", "--help"}]) {
return;
}
using namespace std;
using namespace rang;
// Because rang use static values it means that all redirections should be done
// before calling rang functions.
// Visual test for background colors
cout << bg::green
<< "This text has green background." << bg::reset << endl
<< bg::red << "This text has red background." << bg::reset << endl
<< bg::black << "This text has black background." << bg::reset << endl
<< bg::yellow << "This text has yellow background." << bg::reset
<< endl
<< bg::blue << "This text has blue background." << bg::reset << endl
<< bg::magenta << "This text has magenta background." << bg::reset
<< endl
<< bg::cyan << "This text has cyan background." << bg::reset << endl
<< bg::gray << fg::black << "This text has gray background."
<< bg::reset << style::reset << endl
<< endl
// Visual test for foreground colors
<< fg::green << "This text has green color." << fg::reset << endl
<< fg::red << "This text has red color." << fg::reset << endl
<< fg::black << bg::gray << "This text has black color." << fg::reset
<< bg::reset << endl
<< fg::yellow << "This text has yellow color." << fg::reset << endl
<< fg::blue << "This text has blue color." << fg::reset << endl
<< fg::magenta << "This text has magenta color." << fg::reset << endl
<< fg::cyan << "This text has cyan color." << fg::reset << endl
<< fg::gray << "This text has gray color." << style::reset << endl
<< endl
// Visual test for bright background colors
<< bgB::green << fg::black << "This text has bright green background."
<< style::reset << endl
<< bgB::red << "This text has bright red background." << style::reset
<< endl
<< bgB::black << "This text has bright black background."
<< style::reset << endl
<< bgB::yellow << fg::black
<< "This text has bright yellow background." << style::reset << endl
<< bgB::blue << "This text has bright blue background." << style::reset
<< endl
<< bgB::magenta << "This text has bright magenta background."
<< style::reset << endl
<< bgB::cyan << "This text has bright cyan background." << style::reset
<< endl
<< bgB::gray << fg::black << "This text has bright gray background."
<< style::reset << style::reset << endl
<< endl
// Visual test for bright foreground colors
<< fgB::green << "This text has bright green color." << endl
<< fgB::red << "This text has bright red color." << endl
<< fgB::black << "This text has bright black color." << endl
<< fgB::yellow << "This text has bright yellow color." << endl
<< fgB::blue << "This text has bright blue color." << endl
<< fgB::magenta << "This text has bright magenta color." << endl
<< fgB::cyan << "This text has bright cyan color." << endl
<< fgB::gray << "This text has bright gray color." << style::reset
<< endl
<< endl
// Visual test for text effects
<< style::bold << "This text is bold." << style::reset << endl
<< style::dim << "This text is dim." << style::reset << endl
<< style::italic << "This text is italic." << style::reset << endl
<< style::underline << "This text is underlined." << style::reset
<< endl
<< style::blink << "This text text has blink effect." << style::reset
<< endl
<< style::rblink << "This text text has rapid blink effect."
<< style::reset << endl
<< style::reversed << "This text is reversed." << style::reset << endl
<< style::conceal << "This text is concealed." << style::reset << endl
<< style::crossed << "This text is crossed."
<< style::reset << endl;
}

View File

@ -457,10 +457,10 @@ bool Client::HandleSendLoginInfoPacket(const EQApplicationPacket *app)
return false;
}
LogClientLogin("[HandleSendLoginInfoPacket] Checking Auth id [{}]", id);
LogClientLogin("Checking authentication id [{}]", id);
if ((cle = client_list.CheckAuth(id, password))) {
LogClientLogin("[HandleSendLoginInfoPacket] Checking Auth id [{}] passed", id);
LogClientLogin("Checking authentication id [{}] passed", id);
if (!is_player_zoning) {
// Track who is in and who is out of the game
char *inout= (char *) "";
@ -1604,17 +1604,38 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc)
in.s_addr = GetIP();
LogInfo("Character creation request from [{}] LS#[{}] ([{}]:[{}]) : ", GetCLE()->LSName(), GetCLE()->LSID(), inet_ntoa(in), GetPort());
LogInfo("Name: [{}]", name);
Log(Logs::Detail, Logs::WorldServer, "Race: %d Class: %d Gender: %d Deity: %d Start zone: %d Tutorial: %s",
cc->race, cc->class_, cc->gender, cc->deity, cc->start_zone, cc->tutorial ? "true" : "false");
LogInfo("STR STA AGI DEX WIS INT CHA Total");
Log(Logs::Detail, Logs::WorldServer, "%3d %3d %3d %3d %3d %3d %3d %3d",
cc->STR, cc->STA, cc->AGI, cc->DEX, cc->WIS, cc->INT, cc->CHA,
stats_sum);
LogInfo("Face: [{}] Eye colors: [{}] [{}]", cc->face, cc->eyecolor1, cc->eyecolor2);
LogInfo("Hairstyle: [{}] Haircolor: [{}]", cc->hairstyle, cc->haircolor);
LogInfo("Beard: [{}] Beardcolor: [{}]", cc->beard, cc->beardcolor);
LogInfo(
"Character creation request from [{}] LS [{}] [{}] [{}]",
GetCLE()->LSName(),
GetCLE()->LSID(),
inet_ntoa(in),
GetPort()
);
LogInfo("Name [{}]", name);
LogInfo(
"Race [{}] Class [{}] Gender [{}] Deity [{}] Start zone [{}] Tutorial [{}]",
cc->race,
cc->class_,
cc->gender,
cc->deity,
cc->start_zone,
cc->tutorial ? "true" : "false"
);
LogInfo("STR STA AGI DEX WIS INT CHA Total");
LogInfo(
" [{}] [{}] [{}] [{}] [{}] [{}] [{}] [{}]",
cc->STR,
cc->STA,
cc->AGI,
cc->DEX,
cc->WIS,
cc->INT,
cc->CHA,
stats_sum
);
LogInfo("Face [{}] Eye colors [{}] [{}]", cc->face, cc->eyecolor1, cc->eyecolor2);
LogInfo("Hairstyle [{}] Haircolor [{}]", cc->hairstyle, cc->haircolor);
LogInfo("Beard [{}] Beardcolor [{}]", cc->beard, cc->beardcolor);
/* Validate the char creation struct */
if (m_ClientVersionBit & EQ::versions::maskSoFAndLater) {
@ -1685,14 +1706,14 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc)
/* If it is an SoF Client and the SoF Start Zone rule is set, send new chars there */
if (m_ClientVersionBit & EQ::versions::maskSoFAndLater) {
LogInfo("Found 'SoFStartZoneID' rule setting: [{}]", RuleI(World, SoFStartZoneID));
LogInfo("Found [SoFStartZoneID] rule setting [{}]", RuleI(World, SoFStartZoneID));
if (RuleI(World, SoFStartZoneID) > 0) {
pp.zone_id = RuleI(World, SoFStartZoneID);
cc->start_zone = pp.zone_id;
}
}
else {
LogInfo("Found 'TitaniumStartZoneID' rule setting: [{}]", RuleI(World, TitaniumStartZoneID));
LogInfo("Found [TitaniumStartZoneID] rule setting [{}]", RuleI(World, TitaniumStartZoneID));
if (RuleI(World, TitaniumStartZoneID) > 0) { /* if there's a startzone variable put them in there */
pp.zone_id = RuleI(World, TitaniumStartZoneID);
@ -1757,12 +1778,12 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc)
pp.binds[0].heading = pp.heading;
}
Log(Logs::Detail, Logs::WorldServer, "Current location: %s (%d) %0.2f, %0.2f, %0.2f, %0.2f",
ZoneName(pp.zone_id), pp.zone_id, pp.x, pp.y, pp.z, pp.heading);
Log(Logs::Detail, Logs::WorldServer, "Bind location: %s (%d) %0.2f, %0.2f, %0.2f",
ZoneName(pp.binds[0].zone_id), pp.binds[0].zone_id, pp.binds[0].x, pp.binds[0].y, pp.binds[0].z);
Log(Logs::Detail, Logs::WorldServer, "Home location: %s (%d) %0.2f, %0.2f, %0.2f",
ZoneName(pp.binds[4].zone_id), pp.binds[4].zone_id, pp.binds[4].x, pp.binds[4].y, pp.binds[4].z);
LogInfo("Current location [{}] [{}] [{}] [{}] [{}] [{}]",
ZoneName(pp.zone_id), pp.zone_id, pp.x, pp.y, pp.z, pp.heading);
LogInfo("Bind location [{}] [{}] [{}] [{}] [{}]",
ZoneName(pp.binds[0].zone_id), pp.binds[0].zone_id, pp.binds[0].x, pp.binds[0].y, pp.binds[0].z);
LogInfo("Home location [{}] [{}] [{}] [{}] [{}]",
ZoneName(pp.binds[4].zone_id), pp.binds[4].zone_id, pp.binds[4].x, pp.binds[4].y, pp.binds[4].z);
/* Starting Items inventory */
content_db.SetStartingItems(&pp, &inv, pp.race, pp.class_, pp.deity, pp.zone_id, pp.name, GetAdmin());
@ -1966,16 +1987,16 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc)
// if out of range looking it up in the table would crash stuff
// so we return from these
if (classtemp >= PLAYER_CLASS_COUNT) {
LogInfo(" class is out of range");
LogInfo(" class is out of range");
return false;
}
if (racetemp >= _TABLE_RACES) {
LogInfo(" race is out of range");
LogInfo(" race is out of range");
return false;
}
if (!ClassRaceLookupTable[classtemp][racetemp]) { //Lookup table better than a bunch of ifs?
LogInfo(" invalid race/class combination");
LogInfo(" invalid race/class combination");
// we return from this one, since if it's an invalid combination our table
// doesn't have meaningful values for the stats
return false;
@ -2003,36 +2024,36 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc)
// that are messed up not just the first hit
if (bTOTAL + stat_points != cTOTAL) {
LogInfo(" stat points total doesn't match expected value: expecting [{}] got [{}]", bTOTAL + stat_points, cTOTAL);
LogInfo(" stat points total doesn't match expected value: expecting [{}] got [{}]", bTOTAL + stat_points, cTOTAL);
Charerrors++;
}
if (cc->STR > bSTR + stat_points || cc->STR < bSTR) {
LogInfo(" stat STR is out of range");
LogInfo(" stat STR is out of range");
Charerrors++;
}
if (cc->STA > bSTA + stat_points || cc->STA < bSTA) {
LogInfo(" stat STA is out of range");
LogInfo(" stat STA is out of range");
Charerrors++;
}
if (cc->AGI > bAGI + stat_points || cc->AGI < bAGI) {
LogInfo(" stat AGI is out of range");
LogInfo(" stat AGI is out of range");
Charerrors++;
}
if (cc->DEX > bDEX + stat_points || cc->DEX < bDEX) {
LogInfo(" stat DEX is out of range");
LogInfo(" stat DEX is out of range");
Charerrors++;
}
if (cc->WIS > bWIS + stat_points || cc->WIS < bWIS) {
LogInfo(" stat WIS is out of range");
LogInfo(" stat WIS is out of range");
Charerrors++;
}
if (cc->INT > bINT + stat_points || cc->INT < bINT) {
LogInfo(" stat INT is out of range");
LogInfo(" stat INT is out of range");
Charerrors++;
}
if (cc->CHA > bCHA + stat_points || cc->CHA < bCHA) {
LogInfo(" stat CHA is out of range");
LogInfo(" stat CHA is out of range");
Charerrors++;
}

View File

@ -141,7 +141,7 @@ void ClientListEntry::SetOnline(ZoneServer *iZS, CLE_Status iOnline)
void ClientListEntry::SetOnline(CLE_Status iOnline)
{
LogClientLogin(
"ClientListEntry::SetOnline for [{}] ({}) = [{}] ({})",
"Online status [{}] ({}) status [{}] ({})",
AccountName(),
AccountID(),
CLEStatusString[CLE_Status::Online],

View File

@ -636,13 +636,6 @@ void ConsoleZoneBootup(
tmpname[0] = '*';
strcpy(&tmpname[1], connection->UserName().c_str());
Log(Logs::Detail,
Logs::WorldServer,
"Console ZoneBootup: %s, %s, %s",
tmpname,
args[1].c_str(),
args[0].c_str());
if (args.size() > 2) {
zoneserver_list.SOPZoneBootup(
tmpname,

View File

@ -626,7 +626,7 @@ void LoginServer::SendInfo()
}
LogInfo(
"[LoginServer::SendInfo] protocol_version [{}] server_version [{}] long_name [{}] short_name [{}] account_name [{}] remote_ip_address [{}] local_ip [{}]",
"protocol_version [{}] server_version [{}] long_name [{}] short_name [{}] account_name [{}] remote_ip_address [{}] local_ip [{}]",
l->protocol_version,
l->server_version,
l->server_long_name,

View File

@ -155,7 +155,7 @@ int main(int argc, char **argv)
Config = WorldConfig::get();
LogInfo("CURRENT_VERSION: [{}]", CURRENT_VERSION);
LogInfo("CURRENT_VERSION [{}]", CURRENT_VERSION);
if (signal(SIGINT, CatchSignal) == SIG_ERR) {
LogError("Could not set signal handler");
@ -214,7 +214,7 @@ int main(int argc, char **argv)
zoneserver_list.Add(new ZoneServer(connection, console.get()));
LogInfo(
"New Zone Server connection from [{}] at [{}:{}] zone_count ({})",
"New Zone Server connection from [{}] at [{}:{}] zone_count [{}]",
connection->Handle()->RemoteIP(),
connection->Handle()->RemotePort(),
connection->GetUUID(),

View File

@ -324,6 +324,11 @@ bool WorldBoot::DatabaseLoadRoutines(int argc, char **argv)
zone_store.LoadZones(content_db);
if (zone_store.GetZones().empty()) {
LogError("Failed to load zones data, check your schema for possible errors");
return 1;
}
LogInfo("Clearing groups");
database.ClearGroup();
LogInfo("Clearing raids");
@ -338,12 +343,10 @@ bool WorldBoot::DatabaseLoadRoutines(int argc, char **argv)
LogError("Error: Could not load item data. But ignoring");
}
LogInfo("Loading skill caps");
if (!content_db.LoadSkillCaps(std::string(hotfix_name))) {
LogError("Error: Could not load skill cap data. But ignoring");
}
LogInfo("Loading guilds");
guild_mgr.LoadGuilds();
//rules:
@ -369,9 +372,6 @@ bool WorldBoot::DatabaseLoadRoutines(int argc, char **argv)
if (!RuleManager::Instance()->LoadRules(&database, "default", false)) {
LogInfo("No rule set configured, using default rules");
}
else {
LogInfo("Loaded default rule set [default]", tmp.c_str());
}
}
if (!RuleManager::Instance()->RestoreRuleNotes(&database)) {
@ -380,7 +380,6 @@ bool WorldBoot::DatabaseLoadRoutines(int argc, char **argv)
}
EQ::InitializeDynamicLookups();
LogInfo("Initialized dynamic dictionary entries");
if (RuleB(World, ClearTempMerchantlist)) {
LogInfo("Clearing temporary merchant lists");

View File

@ -1,4 +1,5 @@
#include "world_server_cli.h"
/**
* @param argc
* @param argv
@ -26,6 +27,7 @@ void WorldserverCLI::CommandHandler(int argc, char **argv)
function_map["database:schema"] = &WorldserverCLI::DatabaseGetSchema;
function_map["database:dump"] = &WorldserverCLI::DatabaseDump;
function_map["test:test"] = &WorldserverCLI::TestCommand;
function_map["test:colors"] = &WorldserverCLI::TestColors;
function_map["test:expansion"] = &WorldserverCLI::ExpansionTestCommand;
function_map["test:repository"] = &WorldserverCLI::TestRepository;
function_map["test:repository2"] = &WorldserverCLI::TestRepository2;
@ -39,6 +41,7 @@ void WorldserverCLI::CommandHandler(int argc, char **argv)
#include "cli/database_set_account_status.cpp"
#include "cli/database_version.cpp"
#include "cli/test.cpp"
#include "cli/test_colors.cpp"
#include "cli/test_expansion.cpp"
#include "cli/test_repository.cpp"
#include "cli/test_repository_2.cpp"

View File

@ -14,6 +14,7 @@ public:
static void DatabaseGetSchema(int argc, char **argv, argh::parser &cmd, std::string &description);
static void DatabaseDump(int argc, char **argv, argh::parser &cmd, std::string &description);
static void TestCommand(int argc, char **argv, argh::parser &cmd, std::string &description);
static void TestColors(int argc, char **argv, argh::parser &cmd, std::string &description);
static void ExpansionTestCommand(int argc, char **argv, argh::parser &cmd, std::string &description);
static void TestRepository(int argc, char **argv, argh::parser &cmd, std::string &description);
static void TestRepository2(int argc, char **argv, argh::parser &cmd, std::string &description);

View File

@ -102,7 +102,7 @@ bool ZoneServer::SetZone(uint32 in_zone_id, uint32 in_instance_id, bool in_is_st
if (in_zone_id) {
LogInfo(
"Setting zone process to Zone: {} ({}) ID: {}{}{}",
"Setting zone process to Zone [{}] [{}] zone_id [{}] {}{}",
zone_long_name,
zone_short_name,
in_zone_id,

View File

@ -1700,7 +1700,6 @@ bool Mob::CanPurchaseAlternateAdvancementRank(AA::Rank *rank, bool check_price,
}
void Zone::LoadAlternateAdvancement() {
LogInfo("Loading Alternate Advancement Data");
if(!content_db.LoadAlternateAdvancementAbilities(aa_abilities,
aa_ranks))
{
@ -1710,7 +1709,6 @@ void Zone::LoadAlternateAdvancement() {
return;
}
LogInfo("Processing Alternate Advancement Data");
for(const auto &ability : aa_abilities) {
ability.second->first = GetAlternateAdvancementRank(ability.second->first_rank_id);
@ -1760,14 +1758,11 @@ void Zone::LoadAlternateAdvancement() {
current = current->next;
}
}
LogInfo("Loaded Alternate Advancement Data");
}
bool ZoneDatabase::LoadAlternateAdvancementAbilities(std::unordered_map<int, std::unique_ptr<AA::Ability>> &abilities,
std::unordered_map<int, std::unique_ptr<AA::Rank>> &ranks)
{
LogInfo("Loading Alternate Advancement Abilities");
abilities.clear();
std::string query = "SELECT id, name, category, classes, races, deities, drakkin_heritage, status, type, charges, "
"grant_only, reset_on_death, first_rank_id FROM aa_ability WHERE enabled = 1";
@ -1798,11 +1793,10 @@ bool ZoneDatabase::LoadAlternateAdvancementAbilities(std::unordered_map<int, std
return false;
}
LogInfo("Loaded [{}] Alternate Advancement Abilities", (int)abilities.size());
LogInfo("Loaded [{}] Alternate Advancement Abilities", Strings::Commify((int)abilities.size()));
int expansion = RuleI(Expansion, CurrentExpansion);
bool use_expansion_aa = RuleB(Expansion, UseCurrentExpansionAAOnly);
LogInfo("Loading Alternate Advancement Ability Ranks");
ranks.clear();
if (use_expansion_aa && expansion >= 0) {
query = fmt::format("SELECT id, upper_hotkey_sid, lower_hotkey_sid, title_sid, desc_sid, cost, level_req, spell, spell_type, recast_time, "
@ -1840,9 +1834,8 @@ bool ZoneDatabase::LoadAlternateAdvancementAbilities(std::unordered_map<int, std
return false;
}
LogInfo("Loaded [{}] Alternate Advancement Ability Ranks", (int)ranks.size());
LogInfo("Loaded [{}] Alternate Advancement Ability Ranks", Strings::Commify((int)ranks.size()));
LogInfo("Loading Alternate Advancement Ability Rank Effects");
query = "SELECT rank_id, slot, effect_id, base1, base2 FROM aa_rank_effects";
results = QueryDatabase(query);
if(results.Success()) {
@ -1867,9 +1860,8 @@ bool ZoneDatabase::LoadAlternateAdvancementAbilities(std::unordered_map<int, std
return false;
}
LogInfo("Loaded Alternate Advancement Ability Rank Effects");
LogInfo("Loaded [{}] Alternate Advancement Ability Rank Effects", Strings::Commify(results.RowCount()));
LogInfo("Loading Alternate Advancement Ability Rank Prereqs");
query = "SELECT rank_id, aa_id, points FROM aa_rank_prereqs";
results = QueryDatabase(query);
if(results.Success()) {
@ -1892,7 +1884,7 @@ bool ZoneDatabase::LoadAlternateAdvancementAbilities(std::unordered_map<int, std
return false;
}
LogInfo("Loaded Alternate Advancement Ability Rank Prereqs");
LogInfo("Loaded [{}] Alternate Advancement Ability Rank Prereqs", Strings::Commify(results.RowCount()));
return true;
}

View File

@ -2332,21 +2332,21 @@ void Bot::BotRangedAttack(Mob* other) {
//break invis when you attack
if(invisible) {
LogCombatModerate("[Bot::BotRangedAttack] Removing invisibility due to melee attack");
LogCombatDetail("Removing invisibility due to melee attack");
BuffFadeByEffect(SE_Invisibility);
BuffFadeByEffect(SE_Invisibility2);
invisible = false;
}
if(invisible_undead) {
LogCombatModerate("[Bot::BotRangedAttack] Removing invisibility vs. undead due to melee attack");
LogCombatDetail("Removing invisibility vs. undead due to melee attack");
BuffFadeByEffect(SE_InvisVsUndead);
BuffFadeByEffect(SE_InvisVsUndead2);
invisible_undead = false;
}
if(invisible_animals) {
LogCombatModerate("[Bot::BotRangedAttack] Removing invisibility vs. animals due to melee attack");
LogCombatDetail("Removing invisibility vs. animals due to melee attack");
BuffFadeByEffect(SE_InvisVsAnimals);
invisible_animals = false;
}
@ -5330,7 +5330,7 @@ bool Bot::Attack(Mob* other, int Hand, bool FromRiposte, bool IsStrikethrough, b
if ((GetHP() <= 0) || (GetAppearance() == eaDead)) {
SetTarget(nullptr);
LogCombatModerate("[Bot::Attack] Attempted to attack [{}] while unconscious or, otherwise, appearing dead", other->GetCleanName());
LogCombatDetail("Attempted to attack [{}] while unconscious or, otherwise, appearing dead", other->GetCleanName());
return false;
}
@ -6498,7 +6498,7 @@ bool Bot::CastSpell(
(IsSilenced() && !IsDiscipline(spell_id)) ||
(IsAmnesiad() && IsDiscipline(spell_id))
) {
LogSpellsModerate("[Bot::CastSpell] Spell casting canceled: not able to cast now. Valid? [{}] casting [{}] waiting? [{}] spellend? [{}] stunned? [{}] feared? [{}] mezed? [{}] silenced? [{}]",
LogSpellsDetail("Spell casting canceled: not able to cast now. Valid? [{}] casting [{}] waiting? [{}] spellend? [{}] stunned? [{}] feared? [{}] mezed? [{}] silenced? [{}]",
IsValidSpell(spell_id), casting_spell_id, delaytimer, spellend_timer.Enabled(), IsStunned(), IsFeared(), IsMezzed(), IsSilenced()
);
if (IsSilenced() && !IsDiscipline(spell_id)) {
@ -6537,7 +6537,7 @@ bool Bot::CastSpell(
InterruptSpell(fizzle_msg, 0x121, spell_id);
uint32 use_mana = ((spells[spell_id].mana) / 4);
LogSpellsModerate("[Bot::CastSpell] Spell casting canceled: fizzled. [{}] mana has been consumed", use_mana);
LogSpellsDetail("Spell casting canceled: fizzled. [{}] mana has been consumed", use_mana);
SetMana(GetMana() - use_mana);
return false;
}
@ -6595,19 +6595,19 @@ bool Bot::IsImmuneToSpell(uint16 spell_id, Mob *caster) {
if(caster->IsBot()) {
if(spells[spell_id].target_type == ST_Undead) {
if((GetBodyType() != BT_SummonedUndead) && (GetBodyType() != BT_Undead) && (GetBodyType() != BT_Vampire)) {
LogSpellsModerate("[Bot::IsImmuneToSpell] Bot's target is not an undead");
LogSpellsDetail("Bot's target is not an undead");
return true;
}
}
if(spells[spell_id].target_type == ST_Summoned) {
if((GetBodyType() != BT_SummonedUndead) && (GetBodyType() != BT_Summoned) && (GetBodyType() != BT_Summoned2) && (GetBodyType() != BT_Summoned3)) {
LogSpellsModerate("[Bot::IsImmuneToSpell] Bot's target is not a summoned creature");
LogSpellsDetail("Bot's target is not a summoned creature");
return true;
}
}
}
LogSpellsModerate("[Bot::IsImmuneToSpell] No bot immunities to spell [{}] found", spell_id);
LogSpellsDetail("No bot immunities to spell [{}] found", spell_id);
}
}
@ -8712,7 +8712,7 @@ void EntityList::ScanCloseClientMobs(std::unordered_map<uint16, Mob*>& close_mob
}
}
LogAIScanCloseModerate("[EntityList::ScanCloseClientMobs] Close Client Mob List Size [{}] for mob [{}]", close_mobs.size(), scanning_mob->GetCleanName());
LogAIScanCloseDetail("Close Client Mob List Size [{}] for mob [{}]", close_mobs.size(), scanning_mob->GetCleanName());
}
uint8 Bot::GetNumberNeedingHealedInGroup(uint8 hpr, bool includePets) {

View File

@ -76,9 +76,8 @@ bool BotDatabase::UpdateInjectedBotCommandSettings(const std::vector<std::pair<s
return false;
}
Log(Logs::General,
Logs::Status,
"%u New Bot Command%s Added",
LogInfo(
"[{}] New Bot Command{} Added",
injected.size(),
(injected.size() == 1 ? "" : "s")
);
@ -100,9 +99,8 @@ bool BotDatabase::UpdateOrphanedBotCommandSettings(const std::vector<std::string
return false;
}
Log(Logs::General,
Logs::Status,
"%u Orphaned Bot Command%s Deleted",
LogInfo(
"[{}] Orphaned Bot Command{} Deleted",
orphaned.size(),
(orphaned.size() == 1 ? "" : "s")
);

View File

@ -1751,7 +1751,7 @@ bool Bot::AIHealRotation(Mob* tar, bool useFastHeals) {
}
}
LogAIModerate("[Bot::AIHealRotation] heal spellid [{}] fastheals [{}] casterlevel [{}]",
LogAIDetail("[Bot::AIHealRotation] heal spellid [{}] fastheals [{}] casterlevel [{}]",
botSpell.SpellId, ((useFastHeals) ? ('T') : ('F')), GetLevel());
LogAIDetail("[Bot::AIHealRotation] target [{}] current_time [{}] donthealmebefore [{}]", tar->GetCleanName(), Timer::GetCurrentTime(), tar->DontHealMeBefore());

View File

@ -430,6 +430,8 @@ void MapOpcodes()
ConnectedOpcodes[OP_SharedTaskAcceptNew] = &Client::Handle_OP_SharedTaskAccept;
ConnectedOpcodes[OP_SharedTaskQuit] = &Client::Handle_OP_SharedTaskQuit;
ConnectedOpcodes[OP_SharedTaskPlayerList] = &Client::Handle_OP_SharedTaskPlayerList;
LogInfo("Mapped [{}] client opcode handlers", _maxEmuOpcode);
}
void ClearMappedOpcode(EmuOpcode op)

View File

@ -718,14 +718,12 @@ int ZoneDatabase::GetDoorsDBCountPlusOne(std::string zone_short_name, int16 vers
std::vector<DoorsRepository::Doors> ZoneDatabase::LoadDoors(const std::string &zone_name, int16 version)
{
LogInfo("Loading Doors from database");
auto door_entries = DoorsRepository::GetWhere(
*this, fmt::format(
"zone = '{}' AND (version = {} OR version = -1) {} ORDER BY doorid ASC",
zone_name, version, ContentFilterCriteria::apply()));
LogDoors("Loaded [{}] doors for [{}] version [{}]", door_entries.size(), zone_name, version);
LogDoors("Loaded [{}] doors for [{}] version [{}]", Strings::Commify(door_entries.size()), zone_name, version);
return door_entries;
}

View File

@ -145,6 +145,7 @@ void DynamicZone::CacheAllFromDatabase()
zone->dynamic_zone_cache.emplace(dz_id, std::move(dz));
}
LogInfo("Loaded [{}] dynamic zone(s)", Strings::Commify(zone->dynamic_zone_cache.size()));
LogDynamicZones("Caching [{}] dynamic zone(s) took [{}s]", zone->dynamic_zone_cache.size(), bench.elapsed());
}
@ -240,7 +241,7 @@ void DynamicZone::HandleWorldMessage(ServerPacket* pack)
auto expedition = Expedition::FindCachedExpeditionByDynamicZoneID(dz->GetID());
if (expedition)
{
LogExpeditionsModerate("Deleting expedition [{}] from zone cache", expedition->GetID());
LogExpeditionsDetail("Deleting expedition [{}] from zone cache", expedition->GetID());
zone->expedition_cache.erase(expedition->GetID());
}
}

View File

@ -697,12 +697,12 @@ void EntityList::AddNPC(NPC *npc, bool send_spawn_packet, bool dont_queue)
owner->SetPetID(npc->GetID());
}
}
npc_list.insert(std::pair<uint16, NPC *>(npc->GetID(), npc));
mob_list.insert(std::pair<uint16, Mob *>(npc->GetID(), npc));
parse->EventNPC(EVENT_SPAWN, npc, nullptr, "", 0);
const auto emote_id = npc->GetEmoteID();
if (emote_id != 0) {
npc->DoNPCEmote(EQ::constants::EmoteEventTypes::OnSpawn, emote_id);
@ -2956,7 +2956,7 @@ void EntityList::ScanCloseMobs(
}
}
LogAIScanCloseModerate(
LogAIScanCloseDetail(
"[{}] Scanning Close List | list_size [{}] moving [{}]",
scanning_mob->GetCleanName(),
close_mobs.size(),

View File

@ -92,7 +92,7 @@ Expedition* Expedition::TryCreate(Client* requester, DynamicZone& dz_request, bo
// request parses leader, members list, and lockouts while validating
if (!request.Validate(requester))
{
LogExpeditionsModerate("[{}] request by [{}] denied", request.GetExpeditionName(), requester->GetName());
LogExpeditionsDetail("[{}] request by [{}] denied", request.GetExpeditionName(), requester->GetName());
return nullptr;
}
@ -231,6 +231,8 @@ bool Expedition::CacheAllFromDatabase()
CacheExpeditions(std::move(expeditions));
LogInfo("Loaded [{}] expedition(s)", Strings::Commify(zone->expedition_cache.size()));
LogExpeditions("Caching [{}] expedition(s) took [{}s]", zone->expedition_cache.size(), benchmark.elapsed());
return true;
@ -430,7 +432,7 @@ void Expedition::SendClientExpeditionInvite(
return;
}
LogExpeditionsModerate(
LogExpeditionsDetail(
"Sending expedition [{}] invite to player [{}] inviter [{}] swap name [{}]",
m_id, client->GetName(), inviter_name, swap_remove_name
);
@ -575,7 +577,7 @@ void Expedition::DzInviteResponse(Client* add_client, bool accepted, const std::
return;
}
LogExpeditionsModerate("Invite response by [{}] accepted [{}] swap_name [{}]",
LogExpeditionsDetail("Invite response by [{}] accepted [{}] swap_name [{}]",
add_client->GetName(), accepted, swap_remove_name);
// a null leader_client is handled by SendLeaderMessage fallbacks
@ -681,7 +683,7 @@ void Expedition::TryAddClient(
return;
}
LogExpeditionsModerate(
LogExpeditionsDetail(
"Add player request for expedition [{}] by inviter [{}] add name [{}] swap name [{}]",
m_id, inviter_name, add_client->GetName(), swap_remove_name
);

View File

@ -3,10 +3,6 @@
extern WorldServer worldserver;
inline void print_legend(Client *c) {
c->Message(Chat::White, "[Legend] [G = GM Say] [F = File] [C = Console] [D = Discord]");
}
void command_logs(Client *c, const Seperator *sep)
{
int arguments = sep->argnum;
@ -30,9 +26,9 @@ void command_logs(Client *c, const Seperator *sep)
return;
}
bool is_list = !strcasecmp(sep->arg[1], "list");
bool is_list = !strcasecmp(sep->arg[1], "list");
bool is_reload = !strcasecmp(sep->arg[1], "reload");
bool is_set = !strcasecmp(sep->arg[1], "set");
bool is_set = !strcasecmp(sep->arg[1], "set");
if (!is_list && !is_reload && !is_set) {
c->Message(
@ -62,7 +58,6 @@ void command_logs(Client *c, const Seperator *sep)
uint32 max_category_id = (start_category_id + 49);
print_legend(c);
c->Message(Chat::White, "------------------------------------------------");
for (int index = start_category_id; index <= max_category_id; index++) {
@ -71,16 +66,16 @@ void command_logs(Client *c, const Seperator *sep)
break;
}
bool is_deprecated_category = Strings::Contains(fmt::format("{}", Logs::LogCategoryName[index]), "Deprecated");
bool is_deprecated_category = Strings::Contains(
fmt::format("{}", Logs::LogCategoryName[index]),
"Deprecated"
);
if (is_deprecated_category) {
continue;
}
std::vector<std::string> gmsay;
for (int i = 0; i <= 3; i++) {
if (i == 2) {
continue;
}
for (int i = 0; i <= 2; i++) {
if (LogSys.log_settings[index].log_to_gmsay == i) {
gmsay.emplace_back(std::to_string(i));
continue;
@ -94,10 +89,7 @@ void command_logs(Client *c, const Seperator *sep)
}
std::vector<std::string> file;
for (int i = 0; i <= 3; i++) {
if (i == 2) {
continue;
}
for (int i = 0; i <= 2; i++) {
if (LogSys.log_settings[index].log_to_file == i) {
file.emplace_back(std::to_string(i));
continue;
@ -111,10 +103,7 @@ void command_logs(Client *c, const Seperator *sep)
}
std::vector<std::string> console;
for (int i = 0; i <= 3; i++) {
if (i == 2) {
continue;
}
for (int i = 0; i <= 2; i++) {
if (LogSys.log_settings[index].log_to_console == i) {
console.emplace_back(std::to_string(i));
continue;
@ -128,10 +117,7 @@ void command_logs(Client *c, const Seperator *sep)
}
std::vector<std::string> discord;
for (int i = 0; i <= 3; i++) {
if (i == 2) {
continue;
}
for (int i = 0; i <= 2; i++) {
if (LogSys.log_settings[index].log_to_discord == i) {
discord.emplace_back(std::to_string(i));
continue;
@ -144,29 +130,23 @@ void command_logs(Client *c, const Seperator *sep)
);
}
std::string gmsay_string = Strings::Join(gmsay, "-");
std::string gmsay_string = Strings::Join(gmsay, "-");
std::string console_string = Strings::Join(console, "-");
std::string file_string = Strings::Join(file, "-");
std::string file_string = Strings::Join(file, "-");
std::string discord_string = Strings::Join(discord, "-");
c->Message(
0,
fmt::format(
"G [{}] C [{}] F [{}] D [{}] [{}] [{}] ",
"[{}] GM [{}] Console [{}] File [{}] Discord [{}] [{}] ",
index,
Strings::RTrim(gmsay_string, "-"),
Strings::RTrim(console_string, "-"),
Strings::RTrim(file_string, "-"),
Strings::RTrim(discord_string, "-"),
index,
Logs::LogCategoryName[index]
).c_str()
);
if (index % 10 == 0) {
c->Message(Chat::White, "------------------------------------------------");
print_legend(c);
c->Message(Chat::White, "------------------------------------------------");
}
}
c->Message(Chat::White, "------------------------------------------------");
@ -199,18 +179,21 @@ void command_logs(Client *c, const Seperator *sep)
).c_str()
);
}
} else if (is_reload) {
}
else if (is_reload) {
c->Message(Chat::White, "Attempting to reload Log Settings globally.");
auto pack = new ServerPacket(ServerOP_ReloadLogs, 0);
worldserver.SendPacket(pack);
safe_delete(pack);
} else if (is_set && sep->IsNumber(3)) {
auto logs_set = false;
}
else if (is_set && sep->IsNumber(3)) {
auto logs_set = false;
bool is_console = !strcasecmp(sep->arg[2], "console");
bool is_file = !strcasecmp(sep->arg[2], "file");
bool is_gmsay = !strcasecmp(sep->arg[2], "gmsay");
bool is_file = !strcasecmp(sep->arg[2], "file");
bool is_gmsay = !strcasecmp(sep->arg[2], "gmsay");
bool is_discord = !strcasecmp(sep->arg[2], "discord");
if (!sep->IsNumber(4) || (!is_console && !is_file && !is_gmsay)) {
if (!sep->IsNumber(4) || (!is_console && !is_file && !is_gmsay && !is_discord)) {
c->Message(
Chat::White,
"#logs set [console|file|gmsay] [Category ID] [Debug Level (1-3)] - Sets log settings during the lifetime of the zone"
@ -222,15 +205,20 @@ void command_logs(Client *c, const Seperator *sep)
logs_set = true;
auto category_id = std::stoul(sep->arg[3]);
auto setting = std::stoul(sep->arg[4]);
auto setting = std::stoul(sep->arg[4]);
if (is_console) {
LogSys.log_settings[category_id].log_to_console = setting;
} else if (is_file) {
}
else if (is_file) {
LogSys.log_settings[category_id].log_to_file = setting;
} else if (is_gmsay) {
}
else if (is_gmsay) {
LogSys.log_settings[category_id].log_to_gmsay = setting;
}
else if (is_discord) {
LogSys.log_settings[category_id].log_to_discord = setting;
}
if (logs_set) {
c->Message(

View File

@ -618,6 +618,8 @@ void ZoneDatabase::LoadGlobalLoot()
return;
}
LogInfo("Loaded [{}] global loot entries", Strings::Commify(results.RowCount()));
// we might need this, lets not keep doing it in a loop
auto zoneid = std::to_string(zone->GetZoneID());
for (auto row = results.begin(); row != results.end(); ++row) {

View File

@ -151,7 +151,7 @@ int main(int argc, char** argv) {
QServ = new QueryServ;
LogInfo("Loading server configuration..");
LogInfo("Loading server configuration");
if (!ZoneConfig::LoadConfig()) {
LogError("Loading server configuration failed");
return 1;
@ -231,7 +231,7 @@ int main(int argc, char** argv) {
worldserver.SetLauncherName("NONE");
}
LogInfo("Connecting to MySQL... ");
LogInfo("Connecting to MySQL");
if (!database.Connect(
Config->DatabaseHost.c_str(),
Config->DatabaseUsername.c_str(),
@ -276,7 +276,7 @@ int main(int argc, char** argv) {
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
#endif
LogInfo("CURRENT_VERSION: {}", CURRENT_VERSION);
LogInfo("CURRENT_VERSION [{}]", CURRENT_VERSION);
/*
* Setup nice signal handlers
@ -296,10 +296,8 @@ int main(int argc, char** argv) {
}
#endif
LogInfo("Mapping Incoming Opcodes");
MapOpcodes();
LogInfo("Loading Variables");
database.LoadVariables();
std::string hotfix_name;
@ -309,40 +307,10 @@ int main(int argc, char** argv) {
}
}
LogInfo("Loading zone names");
zone_store.LoadZones(content_db);
LogInfo("Loading items");
if (!database.LoadItems(hotfix_name)) {
LogError("Loading items failed!");
LogError("Failed. But ignoring error and going on..");
}
LogInfo("Loading npc faction lists");
if (!content_db.LoadNPCFactionLists(hotfix_name)) {
LogError("Loading npcs faction lists failed!");
return 1;
}
LogInfo("Loading faction association hits");
if (!content_db.LoadFactionAssociation(hotfix_name)) {
LogError("Loading faction association hits failed!");
return 1;
}
LogInfo("Loading loot tables");
if (!database.LoadLoot(hotfix_name)) {
LogError("Loading loot failed!");
return 1;
}
LogInfo("Loading skill caps");
if (!content_db.LoadSkillCaps(std::string(hotfix_name))) {
LogError("Loading skill caps failed!");
return 1;
}
LogInfo("Loading spells");
if (!database.LoadSpells(hotfix_name, &SPDAT_RECORDS, &spells)) {
LogError("Loading spells failed!");
if (zone_store.GetZones().empty()) {
LogError("Failed to load zones data, check your schema for possible errors");
return 1;
}
@ -350,37 +318,55 @@ int main(int argc, char** argv) {
database.SetSharedItemsCount(content_db.GetItemsCount());
database.SetSharedSpellsCount(content_db.GetSpellsCount());
LogInfo("Loading base data");
if (!database.LoadItems(hotfix_name)) {
LogError("Loading items failed!");
LogError("Failed. But ignoring error and going on..");
}
if (!content_db.LoadNPCFactionLists(hotfix_name)) {
LogError("Loading npcs faction lists failed!");
return 1;
}
if (!content_db.LoadFactionAssociation(hotfix_name)) {
LogError("Loading faction association hits failed!");
return 1;
}
if (!database.LoadLoot(hotfix_name)) {
LogError("Loading loot failed!");
return 1;
}
if (!content_db.LoadSkillCaps(std::string(hotfix_name))) {
LogError("Loading skill caps failed!");
return 1;
}
if (!database.LoadSpells(hotfix_name, &SPDAT_RECORDS, &spells)) {
LogError("Loading spells failed!");
return 1;
}
if (!database.LoadBaseData(hotfix_name)) {
LogError("Loading base data failed!");
return 1;
}
LogInfo("Loading guilds");
guild_mgr.LoadGuilds();
LogInfo("Loading factions");
content_db.LoadFactionData();
LogInfo("Loading titles");
title_manager.LoadTitles();
LogInfo("Loading tributes");
content_db.LoadTributes();
LogInfo("Loading corpse timers");
database.GetDecayTimes(npcCorpseDecayTimes);
LogInfo("Loading profanity list");
if (!EQ::ProfanityManager::LoadProfanityList(&database))
if (!EQ::ProfanityManager::LoadProfanityList(&database)) {
LogError("Loading profanity list failed!");
}
LogInfo("Loading commands");
int retval = command_init();
if (retval < 0)
if (retval < 0) {
LogError("Command loading failed");
else
LogInfo("{} commands loaded", retval);
}
else {
LogInfo("Loaded [{}] commands loaded", Strings::Commify(std::to_string(retval)));
}
//rules:
{
@ -395,13 +381,9 @@ int main(int argc, char** argv) {
if (!RuleManager::Instance()->LoadRules(&database, "default", false)) {
LogInfo("No rule set configured, using default rules");
}
else {
LogInfo("Loaded default rule set 'default'");
}
}
EQ::InitializeDynamicLookups();
LogInfo("Initialized dynamic dictionary entries");
}
content_service.SetDatabase(&database)
@ -509,7 +491,7 @@ int main(int argc, char** argv) {
* Websocket server
*/
if (!websocker_server_opened && Config->ZonePort != 0) {
LogInfo("Websocket Server listener started ([{}]:[{}])", Config->TelnetIP.c_str(), Config->ZonePort);
LogInfo("Websocket Server listener started on address [{}] port [{}]", Config->TelnetIP.c_str(), Config->ZonePort);
ws_server = std::make_unique<EQ::Net::WebsocketServer>(Config->TelnetIP, Config->ZonePort);
RegisterApiService(ws_server);
websocker_server_opened = true;
@ -519,7 +501,7 @@ int main(int argc, char** argv) {
* EQStreamManager
*/
if (!eqsf_open && Config->ZonePort != 0) {
LogInfo("Starting EQ Network server on port {}", Config->ZonePort);
LogInfo("Starting EQ Network server on port [{}]", Config->ZonePort);
EQStreamManagerInterfaceOptions opts(Config->ZonePort, false, RuleB(Network, CompressZoneStream));
opts.daybreak_options.resend_delay_ms = RuleI(Network, ResendDelayBaseMS);
@ -530,10 +512,16 @@ int main(int argc, char** argv) {
eqsm = std::make_unique<EQ::Net::EQStreamManager>(opts);
eqsf_open = true;
eqsm->OnNewConnection([&stream_identifier](std::shared_ptr<EQ::Net::EQStream> stream) {
stream_identifier.AddStream(stream);
LogInfo("New connection from IP {}:{}", long2ip(stream->GetRemoteIP()), ntohs(stream->GetRemotePort()));
});
eqsm->OnNewConnection(
[&stream_identifier](std::shared_ptr<EQ::Net::EQStream> stream) {
stream_identifier.AddStream(stream);
LogInfo(
"New connection from address [{}] port [{}]",
long2ip(stream->GetRemoteIP()),
ntohs(stream->GetRemotePort())
);
}
);
}
//give the stream identifier a chance to do its work....

View File

@ -6047,7 +6047,7 @@ void Client::SendMercMerchantResponsePacket(int32 response_type) {
MercenaryMerchantResponse_Struct* mmr = (MercenaryMerchantResponse_Struct*)outapp->pBuffer;
mmr->ResponseType = response_type; // send specified response type
FastQueuePacket(&outapp);
Log(Logs::Moderate, Logs::Mercenaries, "Sent SendMercMerchantResponsePacket ResponseType: %i, Client: %s.", response_type, GetName());
Log(Logs::Detail, Logs::Mercenaries, "Sent SendMercMerchantResponsePacket ResponseType: %i, Client: %s.", response_type, GetName());
}
}
@ -6056,7 +6056,7 @@ void Client::SendMercenaryUnknownPacket(uint8 type) {
auto outapp = new EQApplicationPacket(OP_MercenaryUnknown1, 1);
outapp->WriteUInt8(type);
FastQueuePacket(&outapp);
Log(Logs::Moderate, Logs::Mercenaries, "Sent SendMercenaryUnknownPacket Type: %i, Client: %s.", type, GetName());
Log(Logs::Detail, Logs::Mercenaries, "Sent SendMercenaryUnknownPacket Type: %i, Client: %s.", type, GetName());
}
@ -6065,7 +6065,7 @@ void Client::SendMercenaryUnsuspendPacket(uint8 type) {
auto outapp = new EQApplicationPacket(OP_MercenaryUnsuspendResponse, 1);
outapp->WriteUInt8(type);
FastQueuePacket(&outapp);
Log(Logs::Moderate, Logs::Mercenaries, "Sent SendMercenaryUnsuspendPacket Type: %i, Client: %s.", type, GetName());
Log(Logs::Detail, Logs::Mercenaries, "Sent SendMercenaryUnsuspendPacket Type: %i, Client: %s.", type, GetName());
}
@ -6075,7 +6075,7 @@ void Client::SendMercSuspendResponsePacket(uint32 suspended_time) {
SuspendMercenaryResponse_Struct* smr = (SuspendMercenaryResponse_Struct*)outapp->pBuffer;
smr->SuspendTime = suspended_time; // Seen 0 (not suspended) or c9 c2 64 4f (suspended on Sat Mar 17 11:58:49 2012) - Unix Timestamp
FastQueuePacket(&outapp);
Log(Logs::Moderate, Logs::Mercenaries, "Sent SendMercSuspendResponsePacket Time: %i, Client: %s.", suspended_time, GetName());
Log(Logs::Detail, Logs::Mercenaries, "Sent SendMercSuspendResponsePacket Time: %i, Client: %s.", suspended_time, GetName());
}
@ -6090,7 +6090,7 @@ void Client::SendMercTimerPacket(int32 entity_id, int32 merc_state, int32 suspen
mss->UpdateInterval = update_interval; // Seen 900000 - 15 minutes in ms
mss->MercUnk01 = unk01; // Seen 180000 - 3 minutes in ms - Used for the unsuspend button refresh timer
FastQueuePacket(&outapp);
Log(Logs::Moderate, Logs::Mercenaries, "Sent SendMercTimerPacket EndID: %i, State: %i, SuspendTime: %i, Interval: %i, Unk1: %i, Client: %s.", entity_id, merc_state, suspended_time, update_interval, unk01, GetName());
Log(Logs::Detail, Logs::Mercenaries, "Sent SendMercTimerPacket EndID: %i, State: %i, SuspendTime: %i, Interval: %i, Unk1: %i, Client: %s.", entity_id, merc_state, suspended_time, update_interval, unk01, GetName());
}
@ -6101,7 +6101,7 @@ void Client::SendMercAssignPacket(uint32 entityID, uint32 unk01, uint32 unk02) {
mas->MercUnk01 = unk01;
mas->MercUnk02 = unk02;
FastQueuePacket(&outapp);
Log(Logs::Moderate, Logs::Mercenaries, "Sent SendMercAssignPacket EndID: %i, Unk1: %i, Unk2: %i, Client: %s.", entityID, unk01, unk02, GetName());
Log(Logs::Detail, Logs::Mercenaries, "Sent SendMercAssignPacket EndID: %i, Unk1: %i, Unk2: %i, Client: %s.", entityID, unk01, unk02, GetName());
}
void NPC::LoadMercTypes() {

View File

@ -179,7 +179,8 @@ void NpcScaleManager::ResetNPCScaling(NPC *npc)
bool NpcScaleManager::LoadScaleData()
{
for (auto &s: NpcScaleGlobalBaseRepository::All(content_db)) {
auto rows = NpcScaleGlobalBaseRepository::All(content_db);
for (auto &s: rows) {
global_npc_scale scale_data;
scale_data.type = s.type;
@ -222,7 +223,7 @@ bool NpcScaleManager::LoadScaleData()
);
}
LogNPCScaling("Global Base Scaling Data Loaded");
LogInfo("Loaded [{}] global scaling data entries", Strings::Commify(rows.size()));
return true;
}

View File

@ -575,6 +575,8 @@ bool ZoneDatabase::PopulateZoneSpawnList(uint32 zoneid, LinkedList<Spawn2*> &spa
}
}
LogInfo("Loaded [{}] respawn timer(s)", Strings::Commify(results.RowCount()));
const char *zone_name = ZoneName(zoneid);
std::string query = StringFormat(
"SELECT "
@ -634,6 +636,8 @@ bool ZoneDatabase::PopulateZoneSpawnList(uint32 zoneid, LinkedList<Spawn2*> &spa
spawn2_list.Insert(new_spawn);
}
LogInfo("Loaded [{}] spawn2 entries", Strings::Commify(results.RowCount()));
NPC::SpawnZoneController();
return true;
@ -1006,6 +1010,8 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in
LogSpawns("Loaded spawn condition [{}] with value [{}] and on_change [{}]", cond.condition_id, cond.value, cond.on_change);
}
LogInfo("Loaded [{}] spawn_conditions", Strings::Commify(std::to_string(results.RowCount())));
//load values
query = StringFormat("SELECT id, value FROM spawn_condition_values "
"WHERE zone = '%s' AND instance_id = %u",
@ -1032,6 +1038,8 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in
return false;
}
LogInfo("Loaded [{}] spawn_events", Strings::Commify(std::to_string(results.RowCount())));
for (auto row = results.begin(); row != results.end(); ++row) {
SpawnEvent event;

View File

@ -225,6 +225,8 @@ bool ZoneDatabase::LoadSpawnGroups(const char *zone_name, uint16 version, SpawnG
spawn_group_list->AddSpawnGroup(new_spawn_group);
}
LogInfo("Loaded [{}] spawn group(s)", Strings::Commify(results.RowCount()));
query = fmt::format(
SQL(
SELECT
@ -273,6 +275,9 @@ bool ZoneDatabase::LoadSpawnGroups(const char *zone_name, uint16 version, SpawnG
spawn_group->AddSpawnEntry(new_spawn_entry);
}
LogInfo("Loaded [{}] spawn entries", Strings::Commify(results.RowCount()));
return true;
}

View File

@ -3481,7 +3481,7 @@ int Mob::CanBuffStack(uint16 spellid, uint8 caster_level, bool iFailIfOverwrite)
{
int i, ret, firstfree = -2;
LogAIModerate("Checking if buff [{}] cast at level [{}] can stack on me.[{}]", spellid, caster_level, iFailIfOverwrite?" failing if we would overwrite something":"");
LogAIDetail("Checking if buff [{}] cast at level [{}] can stack on me.[{}]", spellid, caster_level, iFailIfOverwrite?" failing if we would overwrite something":"");
int buff_count = GetMaxTotalSlots();
for (i=0; i < buff_count; i++)
@ -3518,7 +3518,7 @@ int Mob::CanBuffStack(uint16 spellid, uint8 caster_level, bool iFailIfOverwrite)
}
}
LogAIModerate("Reporting that buff [{}] could successfully be placed into slot [{}]", spellid, firstfree);
LogAIDetail("Reporting that buff [{}] could successfully be placed into slot [{}]", spellid, firstfree);
return firstfree;
}
@ -5901,9 +5901,12 @@ bool Mob::FindType(uint16 type, bool bOffensive, uint16 threshold) {
spells[buffs[i].spellid].base_value[j],
spells[buffs[i].spellid].max_value[j],
buffs[i].casterlevel, buffs[i].spellid);
Log(Logs::General, Logs::Normal,
"FindType: type = %d; value = %d; threshold = %d",
type, value, threshold);
LogSpells(
"FindType type [{}] value [{}] threshold [{}]",
type,
value,
threshold
);
if (value < threshold)
return true;
}

View File

@ -64,6 +64,8 @@ bool TitleManager::LoadTitles()
titles.push_back(title);
}
LogInfo("Loaded [{}] titles", Strings::Commify(std::to_string(results.RowCount())));
return true;
}

View File

@ -495,6 +495,8 @@ bool ZoneDatabase::LoadTraps(const char* zonename, int16 version) {
Log(Logs::General, Logs::Traps, "Trap %d successfully loaded.", trap->trap_id);
}
LogInfo("Loaded [{}] trap(s)", Strings::Commify(results.RowCount()));
return true;
}

View File

@ -403,6 +403,8 @@ bool ZoneDatabase::LoadTributes() {
tribute_list[id] = tributeData;
}
LogInfo("Loaded [{}] tributes", Strings::Commify(results.RowCount()));
const std::string query2 = "SELECT tribute_id, level, cost, item_id FROM tribute_levels ORDER BY tribute_id, level";
results = QueryDatabase(query2);
if (!results.Success()) {
@ -432,6 +434,8 @@ bool ZoneDatabase::LoadTributes() {
cur.tier_count++;
}
LogInfo("Loaded [{}] tribute levels", Strings::Commify(results.RowCount()));
return true;
}

View File

@ -239,7 +239,7 @@ void NPC::MoveTo(const glm::vec4 &position, bool saveguardspot)
if (m_GuardPoint.w == -1)
m_GuardPoint.w = CalculateHeadingToTarget(position.x, position.y);
LogAIModerate("Setting guard position to [{}]", to_string(static_cast<glm::vec3>(m_GuardPoint)).c_str());
LogAIDetail("Setting guard position to [{}]", to_string(static_cast<glm::vec3>(m_GuardPoint)).c_str());
}
cur_wp_pause = 0;
@ -261,7 +261,7 @@ void NPC::UpdateWaypoint(int wp_index)
m_CurrentWayPoint = glm::vec4(cur->x, cur->y, cur->z, cur->heading);
cur_wp_pause = cur->pause;
LogAIModerate("Next waypoint [{}]: ({}, {}, {}, {})", wp_index, m_CurrentWayPoint.x, m_CurrentWayPoint.y, m_CurrentWayPoint.z, m_CurrentWayPoint.w);
LogAIDetail("Next waypoint [{}]: ({}, {}, {}, {})", wp_index, m_CurrentWayPoint.x, m_CurrentWayPoint.y, m_CurrentWayPoint.z, m_CurrentWayPoint.w);
}
@ -559,7 +559,7 @@ void NPC::SetWaypointPause()
void NPC::SaveGuardSpot(bool ClearGuardSpot) {
if (ClearGuardSpot) {
LogAIModerate("Clearing guard order.");
LogAIDetail("Clearing guard order.");
m_GuardPoint = glm::vec4();
} else {
m_GuardPoint = m_Position;
@ -728,7 +728,7 @@ void Mob::SendTo(float new_x, float new_y, float new_z) {
float newz = zone->zonemap->FindBestZ(dest, nullptr);
LogAIModerate("BestZ returned {} at {}, {}, {}", newz, m_Position.x, m_Position.y, m_Position.z);
LogAIDetail("BestZ returned {} at {}, {}, {}", newz, m_Position.x, m_Position.y, m_Position.z);
if ((newz > -2000) && std::abs(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaSendTo)) // Sanity check.
m_Position.z = newz + 1;

View File

@ -204,11 +204,11 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
ServerConnectInfo* sci = (ServerConnectInfo*)pack->pBuffer;
if (sci->port == 0) {
LogCritical("World did not have a port to assign from this server, the port range was not large enough.");
LogError("World did not have a port to assign from this server, the port range was not large enough.");
Shutdown();
}
else {
LogInfo("World assigned Port: [{}] for this zone", sci->port);
LogInfo("World assigned Port [{}] for this zone", sci->port);
ZoneConfig::SetZonePort(sci->port);
LogSys.SetDiscordHandler(&Zone::DiscordWebhookMessageHandler);
@ -3305,7 +3305,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
break;
}
default: {
LogInfo("[HandleMessage] Unknown ZS Opcode [{}] size [{}]", (int)pack->opcode, pack->size);
LogInfo("Unknown ZS Opcode [{}] size [{}]", (int)pack->opcode, pack->size);
break;
}
}

View File

@ -151,8 +151,8 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool is_static) {
delete pack;
}
LogInfo("---- Zone server [{}], listening on port:[{}] ----", zonename, ZoneConfig::get()->ZonePort);
LogInfo("Zone Bootup: [{}] [{}] ([{}]: [{}])",
LogInfo("Zone server [{}] listening on port [{}]", zonename, ZoneConfig::get()->ZonePort);
LogInfo("Zone bootup type [{}] short_name [{}] zone_id [{}] instance_id [{}]",
(is_static) ? "Static" : "Dynamic", zonename, iZoneID, iInstanceID);
parse->Init();
UpdateWindowTitle(nullptr);
@ -193,7 +193,6 @@ bool Zone::LoadZoneObjects()
return false;
}
LogInfo("Loading Objects from DB");
for (auto row = results.begin(); row != results.end(); ++row) {
if (atoi(row[9]) == 0) {
// Type == 0 - Static Object
@ -316,6 +315,8 @@ bool Zone::LoadZoneObjects()
safe_delete(inst);
}
LogInfo("Loaded [{}] world objects", Strings::Commify(results.RowCount()));
return true;
}
@ -325,11 +326,11 @@ bool Zone::LoadGroundSpawns() {
memset(&groundspawn, 0, sizeof(groundspawn));
int gsindex=0;
LogInfo("Loading Ground Spawns from DB");
content_db.LoadGroundSpawns(zoneid, GetInstanceVersion(), &groundspawn);
uint32 ix=0;
char* name = nullptr;
uint32 gsnumber=0;
int added = 0;
for(gsindex=0;gsindex<50;gsindex++){
if(groundspawn.spawn[gsindex].item>0 && groundspawn.spawn[gsindex].item<SAYLINK_ITEM_ID){
EQ::ItemInstance* inst = nullptr;
@ -346,11 +347,15 @@ bool Zone::LoadGroundSpawns() {
groundspawn.spawn[gsindex].heading,
groundspawn.spawn[gsindex].respawntimer); // new object with id of 10000+
entity_list.AddObject(object, false);
added++;
}
safe_delete(inst);
}
}
}
LogInfo("Loaded [{}] ground spawns", Strings::Commify(added));
return(true);
}
@ -521,8 +526,6 @@ uint32 Zone::GetTempMerchantQuantity(uint32 NPCID, uint32 Slot) {
void Zone::LoadTempMerchantData()
{
LogInfo("Loading Temporary Merchant Lists");
auto results = content_db.QueryDatabase(
fmt::format(
SQL(
@ -568,6 +571,8 @@ void Zone::LoadTempMerchantData()
)
);
LogInfo("Loaded [{}] temporary merchant entries", Strings::Commify(results.RowCount()));
std::map<uint32, std::list<TempMerchantList> >::iterator temp_merchant_table_entry;
uint32 npc_id = 0;
@ -652,8 +657,6 @@ void Zone::LoadNewMerchantData(uint32 merchantid) {
}
void Zone::GetMerchantDataForZoneLoad() {
LogInfo("Loading Merchant Lists");
auto query = fmt::format(
SQL (
SELECT
@ -686,6 +689,8 @@ void Zone::GetMerchantDataForZoneLoad() {
auto results = content_db.QueryDatabase(query);
LogInfo("Loaded [{}] merchant lists", Strings::Commify(results.RowCount()));
std::map<uint32, std::list<MerchantList> >::iterator merchant_list;
uint32 npc_id = 0;
@ -935,8 +940,6 @@ void Zone::Shutdown(bool quiet)
void Zone::LoadZoneDoors()
{
LogInfo("Loading doors for [{}] ", GetShortName());
auto door_entries = content_db.LoadDoors(GetShortName(), GetInstanceVersion());
if (door_entries.empty()) {
LogInfo("No doors loaded");
@ -1124,37 +1127,31 @@ bool Zone::Init(bool is_static) {
watermap = WaterMap::LoadWaterMapfile(map_name);
pathing = IPathfinder::Load(map_name);
LogInfo("Loading spawn conditions");
if(!spawn_conditions.LoadSpawnConditions(short_name, instanceid)) {
LogError("Loading spawn conditions failed, continuing without them");
}
LogInfo("Loading static zone points");
if (!content_db.LoadStaticZonePoints(&zone_point_list, short_name, GetInstanceVersion())) {
LogError("Loading static zone points failed");
return false;
}
LogInfo("Loading spawn groups");
if (!content_db.LoadSpawnGroups(short_name, GetInstanceVersion(), &spawn_group_list)) {
LogError("Loading spawn groups failed");
return false;
}
LogInfo("Loading spawn2 points");
if (!content_db.PopulateZoneSpawnList(zoneid, spawn2_list, GetInstanceVersion()))
{
LogError("Loading spawn2 points failed");
return false;
}
LogInfo("Loading player corpses");
if (!database.LoadCharacterCorpses(zoneid, instanceid)) {
LogError("Loading player corpses failed");
return false;
}
LogInfo("Loading traps");
if (!content_db.LoadTraps(short_name, GetInstanceVersion()))
{
LogError("Loading traps failed");
@ -1164,19 +1161,16 @@ bool Zone::Init(bool is_static) {
LogInfo("Loading adventure flavor text");
LoadAdventureFlavor();
LogInfo("Loading ground spawns");
if (!LoadGroundSpawns())
{
LogError("Loading ground spawns failed. continuing");
}
LogInfo("Loading World Objects from DB");
if (!LoadZoneObjects())
{
LogError("Loading World Objects failed. continuing");
}
LogInfo("Flushing old respawn timers");
database.QueryDatabase("DELETE FROM `respawn_times` WHERE (`start` + `duration`) < UNIX_TIMESTAMP(NOW())");
LoadZoneDoors();
@ -1219,16 +1213,13 @@ bool Zone::Init(bool is_static) {
LoadDynamicZoneTemplates();
LogInfo("Loading dynamic zones");
DynamicZone::CacheAllFromDatabase();
LogInfo("Loading active Expeditions");
Expedition::CacheAllFromDatabase();
LogInfo("Loading timezone data");
zone_time.setEQTimeZone(content_db.GetZoneTZ(zoneid, GetInstanceVersion()));
LogInfo("Init Finished: ZoneID = [{}], Time Offset = [{}]", zoneid, zone_time.getEQTimeZone());
LogInfo("Zone booted successfully zone_id [{}] time_offset [{}]", zoneid, zone_time.getEQTimeZone());
LoadGrids();
LoadTickItems();
@ -1247,7 +1238,6 @@ bool Zone::Init(bool is_static) {
void Zone::ReloadStaticData() {
LogInfo("Reloading Zone Static Data");
LogInfo("Reloading static zone points");
if (!content_db.LoadStaticZonePoints(&zone_point_list, GetShortName(), GetInstanceVersion())) {
LogError("Loading static zone points failed");
}
@ -1421,7 +1411,7 @@ bool Zone::LoadZoneCFG(const char* filename, uint16 instance_version)
strcpy(newzone_data.zone_short_name2, GetShortName());
LogInfo(
"Successfully loaded Zone Config for Zone [{}] ({}) Version [{}] Instance ID [{}]",
"Successfully loaded zone headers for zone [{}] long_name [{}] version [{}] instance_id [{}]",
GetShortName(),
GetLongName(),
GetInstanceVersion(),
@ -1836,7 +1826,7 @@ void Zone::StartShutdownTimer(uint32 set_time)
if (set_time != autoshutdown_timer.GetDuration()) {
LogInfo(
"[StartShutdownTimer] Reset to [{}] {} from original remaining time [{}] duration [{}] zone [{}]",
"Reset to [{}] {} from original remaining time [{}] duration [{}] zone [{}]",
Strings::SecondsToTime(set_time, true),
!loaded_from.empty() ? fmt::format("(Loaded from [{}])", loaded_from) : "",
Strings::SecondsToTime(autoshutdown_timer.GetRemainingTime(), true),
@ -1930,7 +1920,6 @@ void Zone::Repop()
LogError("Loading spawn groups failed");
}
LogInfo("Loading spawn conditions");
if (!spawn_conditions.LoadSpawnConditions(short_name, instanceid)) {
LogError("Loading spawn conditions failed, continuing without them");
}
@ -2173,6 +2162,8 @@ bool ZoneDatabase::LoadStaticZonePoints(LinkedList<ZonePoint *> *zone_point_list
zone->numzonepoints++;
}
LogInfo("Loaded [{}] zone_points", Strings::Commify(std::to_string(zone_points.size())));
return true;
}
@ -2193,6 +2184,8 @@ bool ZoneDatabase::GetDecayTimes(npcDecayTimes_Struct *npcCorpseDecayTimes)
npcCorpseDecayTimes[index].seconds = std::min(24 * 60 * 60, atoi(row[1]));
}
LogInfo("Loaded [{}] decay timers", Strings::Commify(results.RowCount()));
return true;
}
@ -2241,6 +2234,8 @@ void Zone::LoadZoneBlockedSpells()
ClearBlockedSpells();
}
}
LogInfo("Loaded [{}] blocked spells(s)", Strings::Commify(zone_total_blocked_spells));
}
}
@ -2414,6 +2409,8 @@ void Zone::LoadVeteranRewards()
return;
}
LogInfo("Loaded [{}] veteran reward(s)", Strings::Commify(results.RowCount()));
int index = 0;
for (auto row = results.begin(); row != results.end(); ++row, ++index)
{
@ -2465,6 +2462,7 @@ void Zone::LoadAlternateCurrencies()
AlternateCurrencies.push_back(current_currency);
}
LogInfo("Loaded [{}] alternate currencies", Strings::Commify(results.RowCount()));
}
void Zone::UpdateQGlobal(uint32 qid, QGlobal newGlobal)
@ -2510,6 +2508,7 @@ void Zone::LoadAdventureFlavor()
adventure_entry_list_flavor[id] = row[1];
}
LogInfo("Loaded [{}] adventure text entries", Strings::Commify(results.RowCount()));
}
void Zone::DoAdventureCountIncrease()
@ -2595,6 +2594,8 @@ void Zone::LoadNPCEmotes(LinkedList<NPC_Emote_Struct*>* NPCEmoteList)
NPCEmoteList->Insert(nes);
}
LogInfo("Loaded [{}] npc emotes", Strings::Commify(results.RowCount()));
}
void Zone::ReloadWorld(uint8 global_repop)
@ -2684,6 +2685,7 @@ void Zone::LoadTickItems()
}
LogInfo("Loaded [{}] item_tick entries", Strings::Commify(results.RowCount()));
}
uint32 Zone::GetSpawnKillCount(uint32 in_spawnid) {
@ -2796,6 +2798,12 @@ void Zone::LoadGrids()
{
zone_grids = GridRepository::GetZoneGrids(content_db, GetZoneID());
zone_grid_entries = GridEntriesRepository::GetZoneGridEntries(content_db, GetZoneID());
LogInfo(
"Loaded [{}] grids and [{}] grid_entries",
Strings::Commify(zone_grids.size()),
Strings::Commify(zone_grid_entries.size())
);
}
Timer Zone::GetInitgridsTimer()

View File

@ -3689,7 +3689,7 @@ bool ZoneDatabase::LoadFactionData()
faction_ids.push_back(fr_row[0]);
}
LogInfo("[{}] Faction(s) loaded...", faction_ids.size());
LogInfo("Loaded [{}] faction(s)", Strings::Commify(std::to_string(faction_ids.size())));
const std::string faction_id_criteria(Strings::Implode(",", faction_ids));
@ -3716,7 +3716,7 @@ bool ZoneDatabase::LoadFactionData()
faction_array[index]->max = atoi(br_row[2]);
}
LogInfo("[{}] Faction Base(s) loaded...", base_results.RowCount());
LogInfo("Loaded [{}] faction base(s)", Strings::Commify(std::to_string(base_results.RowCount())));
}
else {
LogInfo("Unable to load Faction Base data...");
@ -3744,7 +3744,7 @@ bool ZoneDatabase::LoadFactionData()
faction_array[index]->mods[mr_row[2]] = atoi(mr_row[1]);
}
LogInfo("[{}] Faction Modifier(s) loaded", modifier_results.RowCount());
LogInfo("Loaded [{}] faction modifier(s)", Strings::Commify(std::to_string(modifier_results.RowCount())));
}
else {
LogError("Unable to load Faction Modifier data");
@ -4370,6 +4370,8 @@ bool ZoneDatabase::LoadCharacterCorpses(uint32 zone_id, uint16 instance_id) {
);
}
LogInfo("Loaded [{}] player corpse(s)", Strings::Commify(results.RowCount()));
return true;
}