mirror of
https://github.com/EQEmu/Server.git
synced 2026-01-05 00:03:52 +00:00
Merge plus changed getposition to return a reference
This commit is contained in:
commit
34bec5913b
@ -292,8 +292,17 @@ bool Database::SetAccountStatus(const char* name, int16 status) {
|
||||
|
||||
/* This initially creates the character during character create */
|
||||
bool Database::ReserveName(uint32 account_id, char* name) {
|
||||
std::string query = StringFormat("INSERT INTO `character_data` SET `account_id` = %i, `name` = '%s'", account_id, name);
|
||||
std::string query = StringFormat("SELECT `account_id`, `name` FROM `character_data` WHERE `name` = '%s'", name);
|
||||
auto results = QueryDatabase(query);
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
if (row[0] && atoi(row[0]) > 0){
|
||||
Log.Out(Logs::General, Logs::World_Server, "Account: %i tried to request name: %s, but it is already taken...", account_id, name);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
query = StringFormat("INSERT INTO `character_data` SET `account_id` = %i, `name` = '%s'", account_id, name);
|
||||
results = QueryDatabase(query);
|
||||
if (!results.Success() || results.ErrorMessage() != ""){ return false; }
|
||||
return true;
|
||||
}
|
||||
@ -3847,10 +3856,8 @@ void Database::PurgeExpiredInstances()
|
||||
|
||||
bool Database::AddClientToInstance(uint16 instance_id, uint32 char_id)
|
||||
{
|
||||
std::string query = StringFormat("INSERT INTO instance_list_player(id, charid) values(%lu, %lu)",
|
||||
(unsigned long)instance_id, (unsigned long)char_id);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
std::string query = StringFormat("REPLACE INTO instance_list_player(id, charid) VALUES (%lu, %lu)", (unsigned long)instance_id, (unsigned long)char_id);
|
||||
auto results = QueryDatabase(query);
|
||||
return results.Success();
|
||||
}
|
||||
|
||||
|
||||
@ -24,10 +24,11 @@
|
||||
#include "misc.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <iomanip>
|
||||
#include <time.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
std::ofstream process_log;
|
||||
|
||||
@ -75,13 +76,15 @@ namespace Console {
|
||||
};
|
||||
}
|
||||
|
||||
EQEmuLogSys::EQEmuLogSys(){
|
||||
on_log_gmsay_hook = [](uint16 log_type, std::string&) {};
|
||||
bool file_logs_enabled = false;
|
||||
EQEmuLogSys::EQEmuLogSys()
|
||||
{
|
||||
on_log_gmsay_hook = [](uint16 log_type, const std::string&) {};
|
||||
bool file_logs_enabled = false;
|
||||
int log_platform = 0;
|
||||
}
|
||||
|
||||
EQEmuLogSys::~EQEmuLogSys(){
|
||||
EQEmuLogSys::~EQEmuLogSys()
|
||||
{
|
||||
}
|
||||
|
||||
void EQEmuLogSys::LoadLogSettingsDefaults()
|
||||
@ -90,11 +93,7 @@ void EQEmuLogSys::LoadLogSettingsDefaults()
|
||||
log_platform = GetExecutablePlatformInt();
|
||||
|
||||
/* Zero out Array */
|
||||
for (int i = 0; i < Logs::LogCategory::MaxCategoryID; i++){
|
||||
log_settings[i].log_to_console = 0;
|
||||
log_settings[i].log_to_file = 0;
|
||||
log_settings[i].log_to_gmsay = 0;
|
||||
}
|
||||
memset(log_settings, 0, sizeof(LogSettings) * Logs::LogCategory::MaxCategoryID);
|
||||
|
||||
/* Set Defaults */
|
||||
log_settings[Logs::World_Server].log_to_console = Logs::General;
|
||||
@ -104,38 +103,32 @@ void EQEmuLogSys::LoadLogSettingsDefaults()
|
||||
log_settings[Logs::Crash].log_to_console = Logs::General;
|
||||
log_settings[Logs::MySQLError].log_to_console = Logs::General;
|
||||
|
||||
/* Declare process file names for log writing
|
||||
/* Declare process file names for log writing
|
||||
If there is no process_file_name declared, no log file will be written, simply
|
||||
*/
|
||||
if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformWorld){
|
||||
platform_file_name = "world";
|
||||
}
|
||||
if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformQueryServ){
|
||||
platform_file_name = "query_server";
|
||||
}
|
||||
if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone){
|
||||
if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformWorld)
|
||||
platform_file_name = "world";
|
||||
else if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformQueryServ)
|
||||
platform_file_name = "query_server";
|
||||
else if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone)
|
||||
platform_file_name = "zone";
|
||||
}
|
||||
if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformUCS){
|
||||
else if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformUCS)
|
||||
platform_file_name = "ucs";
|
||||
}
|
||||
if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformLogin){
|
||||
else if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformLogin)
|
||||
platform_file_name = "login";
|
||||
}
|
||||
if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformLogin){
|
||||
else if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformLogin)
|
||||
platform_file_name = "launcher";
|
||||
}
|
||||
}
|
||||
|
||||
std::string EQEmuLogSys::FormatOutMessageString(uint16 log_category, std::string in_message){
|
||||
std::string category_string = "";
|
||||
if (log_category > 0 && Logs::LogCategoryName[log_category]){
|
||||
std::string EQEmuLogSys::FormatOutMessageString(uint16 log_category, const std::string &in_message)
|
||||
{
|
||||
std::string category_string;
|
||||
if (log_category > 0 && Logs::LogCategoryName[log_category])
|
||||
category_string = StringFormat("[%s] ", Logs::LogCategoryName[log_category]);
|
||||
}
|
||||
return StringFormat("%s%s", category_string.c_str(), in_message.c_str());
|
||||
return StringFormat("%s%s", category_string.c_str(), in_message.c_str());
|
||||
}
|
||||
|
||||
void EQEmuLogSys::ProcessGMSay(uint16 debug_level, uint16 log_category, std::string message)
|
||||
void EQEmuLogSys::ProcessGMSay(uint16 debug_level, uint16 log_category, const std::string &message)
|
||||
{
|
||||
/* Check if category enabled for process */
|
||||
if (log_settings[log_category].log_to_gmsay == 0)
|
||||
@ -150,17 +143,16 @@ void EQEmuLogSys::ProcessGMSay(uint16 debug_level, uint16 log_category, std::str
|
||||
return;
|
||||
|
||||
/* Check to see if the process that actually ran this is zone */
|
||||
if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone){
|
||||
if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone)
|
||||
on_log_gmsay_hook(log_category, message);
|
||||
}
|
||||
}
|
||||
|
||||
void EQEmuLogSys::ProcessLogWrite(uint16 debug_level, uint16 log_category, std::string message)
|
||||
void EQEmuLogSys::ProcessLogWrite(uint16 debug_level, uint16 log_category, const std::string &message)
|
||||
{
|
||||
if (log_category == Logs::Crash){
|
||||
if (log_category == Logs::Crash) {
|
||||
char time_stamp[80];
|
||||
EQEmuLogSys::SetCurrentTimeStamp(time_stamp);
|
||||
std::ofstream crash_log;
|
||||
std::ofstream crash_log;
|
||||
EQEmuLogSys::MakeDirectory("logs/crashes");
|
||||
crash_log.open(StringFormat("logs/crashes/crash_%s_%i.log", platform_file_name.c_str(), getpid()), std::ios_base::app | std::ios_base::out);
|
||||
crash_log << time_stamp << " " << message << "\n";
|
||||
@ -178,9 +170,8 @@ void EQEmuLogSys::ProcessLogWrite(uint16 debug_level, uint16 log_category, std::
|
||||
char time_stamp[80];
|
||||
EQEmuLogSys::SetCurrentTimeStamp(time_stamp);
|
||||
|
||||
if (process_log){
|
||||
if (process_log)
|
||||
process_log << time_stamp << " " << message << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
uint16 EQEmuLogSys::GetWindowsConsoleColorFromCategory(uint16 log_category){
|
||||
@ -198,7 +189,7 @@ uint16 EQEmuLogSys::GetWindowsConsoleColorFromCategory(uint16 log_category){
|
||||
return Console::Color::LightCyan;
|
||||
case Logs::Commands:
|
||||
return Console::Color::LightMagenta;
|
||||
case Logs::Crash:
|
||||
case Logs::Crash:
|
||||
return Console::Color::LightRed;
|
||||
default:
|
||||
return Console::Color::Yellow;
|
||||
@ -239,7 +230,7 @@ uint16 EQEmuLogSys::GetGMSayColorFromCategory(uint16 log_category){
|
||||
case Logs::Debug:
|
||||
return 14; /* Light Green */
|
||||
case Logs::Quests:
|
||||
return 258; /* Light Cyan */
|
||||
return 258; /* Light Cyan */
|
||||
case Logs::Commands:
|
||||
return 5; /* Light Purple */
|
||||
case Logs::Crash:
|
||||
@ -249,7 +240,7 @@ uint16 EQEmuLogSys::GetGMSayColorFromCategory(uint16 log_category){
|
||||
}
|
||||
}
|
||||
|
||||
void EQEmuLogSys::ProcessConsoleMessage(uint16 debug_level, uint16 log_category, std::string message)
|
||||
void EQEmuLogSys::ProcessConsoleMessage(uint16 debug_level, uint16 log_category, const std::string &message)
|
||||
{
|
||||
/* Check if category enabled for process */
|
||||
if (log_settings[log_category].log_to_console == 0)
|
||||
@ -290,7 +281,8 @@ void EQEmuLogSys::Out(Logs::DebugLevel debug_level, uint16 log_category, std::st
|
||||
EQEmuLogSys::ProcessLogWrite(debug_level, log_category, output_message);
|
||||
}
|
||||
|
||||
void EQEmuLogSys::SetCurrentTimeStamp(char* time_stamp){
|
||||
void EQEmuLogSys::SetCurrentTimeStamp(char* time_stamp)
|
||||
{
|
||||
time_t raw_time;
|
||||
struct tm * time_info;
|
||||
time(&raw_time);
|
||||
@ -298,10 +290,17 @@ void EQEmuLogSys::SetCurrentTimeStamp(char* time_stamp){
|
||||
strftime(time_stamp, 80, "[%m-%d-%Y :: %H:%M:%S]", time_info);
|
||||
}
|
||||
|
||||
void EQEmuLogSys::MakeDirectory(std::string directory_name){
|
||||
void EQEmuLogSys::MakeDirectory(const std::string &directory_name)
|
||||
{
|
||||
#ifdef _WINDOWS
|
||||
struct _stat st;
|
||||
if (_stat(directory_name.c_str(), &st) == 0) // exists
|
||||
return;
|
||||
_mkdir(directory_name.c_str());
|
||||
#else
|
||||
struct stat st;
|
||||
if (stat(directory_name.c_str(), &st) == 0) // exists
|
||||
return;
|
||||
mkdir(directory_name.c_str(), 0755);
|
||||
#endif
|
||||
}
|
||||
@ -313,7 +312,7 @@ void EQEmuLogSys::CloseFileLogs()
|
||||
}
|
||||
}
|
||||
|
||||
void EQEmuLogSys::StartFileLogs(std::string log_name)
|
||||
void EQEmuLogSys::StartFileLogs(const std::string &log_name)
|
||||
{
|
||||
EQEmuLogSys::CloseFileLogs();
|
||||
|
||||
@ -321,23 +320,21 @@ void EQEmuLogSys::StartFileLogs(std::string log_name)
|
||||
if (file_logs_enabled == false)
|
||||
return;
|
||||
|
||||
if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone){
|
||||
if (log_name != "")
|
||||
if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone) {
|
||||
if (!log_name.empty())
|
||||
platform_file_name = log_name;
|
||||
|
||||
if (platform_file_name == ""){
|
||||
if (platform_file_name.empty())
|
||||
return;
|
||||
}
|
||||
|
||||
EQEmuLogSys::Out(Logs::General, Logs::Status, "Starting File Log 'logs/%s_%i.log'", platform_file_name.c_str(), getpid());
|
||||
EQEmuLogSys::MakeDirectory("logs/zone");
|
||||
process_log.open(StringFormat("logs/zone/%s_%i.log", platform_file_name.c_str(), getpid()), std::ios_base::app | std::ios_base::out);
|
||||
}
|
||||
else{
|
||||
if (platform_file_name == ""){
|
||||
} else {
|
||||
if (platform_file_name.empty())
|
||||
return;
|
||||
}
|
||||
EQEmuLogSys::Out(Logs::General, Logs::Status, "Starting File Log 'logs/%s_%i.txt'", platform_file_name.c_str(), getpid());
|
||||
process_log.open(StringFormat("logs/%s_%i.txt", platform_file_name.c_str(), getpid()), std::ios_base::app | std::ios_base::out);
|
||||
|
||||
EQEmuLogSys::Out(Logs::General, Logs::Status, "Starting File Log 'logs/%s_%i.log'", platform_file_name.c_str(), getpid());
|
||||
process_log.open(StringFormat("logs/%s_%i.log", platform_file_name.c_str(), getpid()), std::ios_base::app | std::ios_base::out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
#define EQEMU_LOGSYS_H
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <fstream>
|
||||
#include <stdio.h>
|
||||
#include <functional>
|
||||
|
||||
@ -118,7 +118,7 @@ namespace Logs{
|
||||
"Zone Server",
|
||||
"MySQL Error",
|
||||
"MySQL Query",
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
class EQEmuLogSys {
|
||||
@ -128,23 +128,23 @@ public:
|
||||
|
||||
void CloseFileLogs(); /* Close File Logs wherever necessary, either at zone shutdown or entire process shutdown for everything else. This should be handled on deconstructor but to be safe we use it anyways. */
|
||||
void LoadLogSettingsDefaults(); /* Initializes log_settings and sets some defaults if DB is not present */
|
||||
void MakeDirectory(std::string directory_name); /* Platform independent way of performing a MakeDirectory based on name */
|
||||
/*
|
||||
void MakeDirectory(const std::string &directory_name); /* Platform independent way of performing a MakeDirectory based on name */
|
||||
/*
|
||||
The one and only Logging function that uses a debug level as a parameter, as well as a log_category
|
||||
log_category - defined in Logs::LogCategory::[]
|
||||
log_category name resolution works by passing the enum int ID to Logs::LogCategoryName[category_id]
|
||||
|
||||
Example: EQEmuLogSys::Out(Logs::General, Logs::Guilds, "This guild has no leader present");
|
||||
- This would pipe the same category and debug level to all output formats, but the internal memory reference of log_settings would
|
||||
- This would pipe the same category and debug level to all output formats, but the internal memory reference of log_settings would
|
||||
be checked against to see if that piped output is set to actually process it for the category and debug level
|
||||
*/
|
||||
void Out(Logs::DebugLevel debug_level, uint16 log_category, std::string message, ...);
|
||||
void Out(Logs::DebugLevel debug_level, uint16 log_category, std::string message, ...);
|
||||
void SetCurrentTimeStamp(char* time_stamp); /* Used in file logs to prepend a timestamp entry for logs */
|
||||
void StartFileLogs(std::string log_name = ""); /* Used to declare the processes file log and to keep it open for later use */
|
||||
void StartFileLogs(const std::string &log_name = ""); /* Used to declare the processes file log and to keep it open for later use */
|
||||
|
||||
/*
|
||||
/*
|
||||
LogSettings Struct
|
||||
|
||||
|
||||
This struct is the master reference for all settings for each category, and for each output
|
||||
|
||||
log_to_file[category_id] = [1-3] - Sets debug level for category to output to file
|
||||
@ -162,31 +162,30 @@ public:
|
||||
These are loaded via DB and have defaults loaded in LoadLogSettingsDefaults.
|
||||
Database loaded via Database::LoadLogSettings(log_settings)
|
||||
*/
|
||||
LogSettings log_settings[Logs::LogCategory::MaxCategoryID];
|
||||
LogSettings log_settings[Logs::LogCategory::MaxCategoryID];
|
||||
|
||||
bool file_logs_enabled; /* Set when log settings are loaded to determine if keeping a file open is necessary */
|
||||
|
||||
int log_platform; /* Sets Executable platform (Zone/World/UCS) etc. */
|
||||
|
||||
std::string platform_file_name; /* File name used in writing logs */
|
||||
std::string platform_file_name; /* File name used in writing logs */
|
||||
|
||||
uint16 GetGMSayColorFromCategory(uint16 log_category); /* GMSay Client Message colors mapped by category */
|
||||
|
||||
void OnLogHookCallBackZone(std::function<void(uint16 log_type, std::string&)> f) { on_log_gmsay_hook = f; }
|
||||
void OnLogHookCallBackZone(std::function<void(uint16 log_type, const std::string&)> f) { on_log_gmsay_hook = f; }
|
||||
|
||||
private:
|
||||
|
||||
std::function<void(uint16 log_category, std::string&)> on_log_gmsay_hook; /* Callback pointer to zone process for hooking logs to zone using GMSay */
|
||||
std::string FormatOutMessageString(uint16 log_category, std::string in_message); /* Formats log messages like '[Category] This is a log message' */
|
||||
std::function<void(uint16 log_category, const std::string&)> on_log_gmsay_hook; /* Callback pointer to zone process for hooking logs to zone using GMSay */
|
||||
std::string FormatOutMessageString(uint16 log_category, const std::string &in_message); /* Formats log messages like '[Category] This is a log message' */
|
||||
std::string GetLinuxConsoleColorFromCategory(uint16 log_category); /* Linux console color messages mapped by category */
|
||||
|
||||
|
||||
uint16 GetWindowsConsoleColorFromCategory(uint16 log_category); /* Windows console color messages mapped by category */
|
||||
|
||||
void ProcessConsoleMessage(uint16 debug_level, uint16 log_category, std::string message); /* ProcessConsoleMessage called via Log.Out */
|
||||
void ProcessGMSay(uint16 debug_level, uint16 log_category, std::string message); /* ProcessGMSay called via Log.Out */
|
||||
void ProcessLogWrite(uint16 debug_level, uint16 log_category, std::string message); /* ProcessLogWrite called via Log.Out */
|
||||
void ProcessConsoleMessage(uint16 debug_level, uint16 log_category, const std::string &message); /* ProcessConsoleMessage called via Log.Out */
|
||||
void ProcessGMSay(uint16 debug_level, uint16 log_category, const std::string &message); /* ProcessGMSay called via Log.Out */
|
||||
void ProcessLogWrite(uint16 debug_level, uint16 log_category, const std::string &message); /* ProcessLogWrite called via Log.Out */
|
||||
};
|
||||
|
||||
extern EQEmuLogSys Log;
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -134,9 +134,7 @@ bool PersistentTimer::Load(Database *db) {
|
||||
(unsigned long)_char_id, _type);
|
||||
auto results = db->QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
#if EQDEBUG > 5
|
||||
Log.Out(Logs::General, Logs::Error, "Error in PersistentTimer::Load, error: %s", results.ErrorMessage().c_str());
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -405,7 +405,7 @@ void Console::ProcessCommand(const char* command) {
|
||||
state = CONSOLE_STATE_CLOSED;
|
||||
return;
|
||||
}
|
||||
paccountid = database.CheckLogin(paccountname,command);
|
||||
paccountid = database.CheckLogin(paccountname ,command);
|
||||
if (paccountid == 0) {
|
||||
SendMessage(1, 0);
|
||||
SendMessage(2, "Login failed.");
|
||||
@ -431,7 +431,7 @@ void Console::ProcessCommand(const char* command) {
|
||||
break;
|
||||
}
|
||||
case CONSOLE_STATE_CONNECTED: {
|
||||
Log.Out(Logs::Detail, Logs::World_Server,"TCP command: %s: \"%s\"",paccountname,command);
|
||||
Log.Out(Logs::Detail, Logs::World_Server,"TCP command: %s: \"%s\"",paccountname ,command);
|
||||
Seperator sep(command);
|
||||
if (strcasecmp(sep.arg[0], "help") == 0 || strcmp(sep.arg[0], "?") == 0) {
|
||||
SendMessage(1, " whoami");
|
||||
|
||||
@ -335,7 +335,6 @@ Client::~Client() {
|
||||
m_tradeskill_object = nullptr;
|
||||
}
|
||||
|
||||
ChangeSQLLog(nullptr);
|
||||
if(IsDueling() && GetDuelTarget() != 0) {
|
||||
Entity* entity = entity_list.GetID(GetDuelTarget());
|
||||
if(entity != nullptr && entity->IsClient()) {
|
||||
@ -3484,37 +3483,6 @@ void Client::Insight(uint32 t_id)
|
||||
Message(0,"Your target is a level %i %s. It appears %s and %s for its level. It seems %s",who->GetLevel(),GetEQClassName(who->GetClass(),1),dmg,hitpoints,resists);
|
||||
}
|
||||
|
||||
void Client::ChangeSQLLog(const char *file) {
|
||||
if(SQL_log != nullptr) {
|
||||
fclose(SQL_log);
|
||||
SQL_log = nullptr;
|
||||
}
|
||||
if(file != nullptr) {
|
||||
if(strstr(file, "..") != nullptr) {
|
||||
Message(13, ".. is forbibben in SQL log file names.");
|
||||
return;
|
||||
}
|
||||
char buf[512];
|
||||
snprintf(buf, 511, "%s%s", SQL_LOG_PATH, file);
|
||||
buf[511] = '\0';
|
||||
SQL_log = fopen(buf, "a");
|
||||
if(SQL_log == nullptr) {
|
||||
Message(13, "Unable to open SQL log file: %s\n", strerror(errno));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Client::LogSQL(const char *fmt, ...) {
|
||||
if(SQL_log == nullptr)
|
||||
return;
|
||||
|
||||
va_list argptr;
|
||||
va_start(argptr, fmt);
|
||||
vfprintf(SQL_log, fmt, argptr );
|
||||
fputc('\n', SQL_log);
|
||||
va_end(argptr);
|
||||
}
|
||||
|
||||
void Client::GetGroupAAs(GroupLeadershipAA_Struct *into) const {
|
||||
memcpy(into, &m_pp.leader_abilities.group, sizeof(GroupLeadershipAA_Struct));
|
||||
}
|
||||
@ -8265,10 +8233,8 @@ std::string Client::TextLink::GenerateLink()
|
||||
m_Link = "<LINKER ERROR>";
|
||||
Log.Out(Logs::General, Logs::Error, "TextLink::GenerateLink() failed to generate a useable text link (LinkType: %i, Lengths: {link: %u, body: %u, text: %u})",
|
||||
m_LinkType, m_Link.length(), m_LinkBody.length(), m_LinkText.length());
|
||||
#if EQDEBUG >= 5
|
||||
Log.Out(Logs::General, Logs::Error, ">> LinkBody: %s", m_LinkBody.c_str());
|
||||
Log.Out(Logs::General, Logs::Error, ">> LinkText: %s", m_LinkText.c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
return m_Link;
|
||||
|
||||
@ -914,8 +914,6 @@ public:
|
||||
void SendZoneFlagInfo(Client *to) const;
|
||||
void LoadZoneFlags();
|
||||
|
||||
void ChangeSQLLog(const char *file);
|
||||
void LogSQL(const char *fmt, ...);
|
||||
bool CanFish();
|
||||
void GoFish();
|
||||
void ForageItem(bool guarantee = false);
|
||||
|
||||
2015
zone/client_mods.cpp
2015
zone/client_mods.cpp
File diff suppressed because it is too large
Load Diff
2096
zone/command.cpp
2096
zone/command.cpp
File diff suppressed because it is too large
Load Diff
@ -258,7 +258,6 @@ void command_undye(Client *c, const Seperator *sep);
|
||||
void command_undyeme(Client *c, const Seperator *sep);
|
||||
void command_hp(Client *c, const Seperator *sep);
|
||||
void command_ginfo(Client *c, const Seperator *sep);
|
||||
void command_logsql(Client *c, const Seperator *sep);
|
||||
void command_qglobal(Client *c, const Seperator *sep);
|
||||
void command_path(Client *c, const Seperator *sep);
|
||||
void command_ginfo(Client *c, const Seperator *sep);
|
||||
@ -325,7 +324,7 @@ void command_shownumhits(Client *c, const Seperator *sep);
|
||||
void command_tune(Client *c, const Seperator *sep);
|
||||
void command_logtest(Client *c, const Seperator *sep);
|
||||
void command_logs(Client *c, const Seperator *sep);
|
||||
|
||||
|
||||
#ifdef EQPROFILE
|
||||
void command_profiledump(Client *c, const Seperator *sep);
|
||||
void command_profilereset(Client *c, const Seperator *sep);
|
||||
|
||||
@ -560,10 +560,8 @@ public:
|
||||
// Audit trade
|
||||
void LogTrade();
|
||||
|
||||
// Debug only method
|
||||
#if (EQDEBUG >= 9)
|
||||
void DumpTrade();
|
||||
#endif
|
||||
void DumpTrade();
|
||||
|
||||
|
||||
public:
|
||||
// Object state
|
||||
|
||||
@ -29,7 +29,7 @@ public:
|
||||
char* GetDoorName() { return door_name; }
|
||||
uint32 GetDoorParam() { return door_param; }
|
||||
int GetInvertState() { return invert_state; }
|
||||
const glm::vec4 GetPosition() const{ return m_Position; }
|
||||
const glm::vec4& GetPosition() const{ return m_Position; }
|
||||
int GetIncline() { return incline; }
|
||||
bool triggered;
|
||||
void SetOpenState(bool st) { isopen = st; }
|
||||
|
||||
@ -399,7 +399,7 @@ public:
|
||||
((static_cast<float>(cur_mana) / max_mana) * 100); }
|
||||
virtual int32 CalcMaxMana();
|
||||
uint32 GetNPCTypeID() const { return npctype_id; }
|
||||
inline const glm::vec4 GetPosition() const { return m_Position; }
|
||||
inline const glm::vec4& GetPosition() const { return m_Position; }
|
||||
inline const float GetX() const { return m_Position.x; }
|
||||
inline const float GetY() const { return m_Position.y; }
|
||||
inline const float GetZ() const { return m_Position.z; }
|
||||
|
||||
19
zone/npc.cpp
19
zone/npc.cpp
@ -1013,7 +1013,6 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C
|
||||
}
|
||||
|
||||
if(client)
|
||||
client->LogSQL(query.c_str());
|
||||
|
||||
query = StringFormat("INSERT INTO spawngroup (id, name) VALUES(%i, '%s-%s')", 0, zone, spawn->GetName());
|
||||
auto results = QueryDatabase(query);
|
||||
@ -1023,7 +1022,6 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C
|
||||
uint32 spawngroupid = results.LastInsertedID();
|
||||
|
||||
if(client)
|
||||
client->LogSQL(query.c_str());
|
||||
|
||||
query = StringFormat("INSERT INTO spawn2 (zone, version, x, y, z, respawntime, heading, spawngroupID) "
|
||||
"VALUES('%s', %u, %f, %f, %f, %i, %f, %i)",
|
||||
@ -1035,7 +1033,6 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C
|
||||
}
|
||||
|
||||
if(client)
|
||||
client->LogSQL(query.c_str());
|
||||
|
||||
query = StringFormat("INSERT INTO spawnentry (spawngroupID, npcID, chance) VALUES(%i, %i, %i)",
|
||||
spawngroupid, npc_type_id, 100);
|
||||
@ -1045,7 +1042,6 @@ uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,C
|
||||
}
|
||||
|
||||
if(client)
|
||||
client->LogSQL(query.c_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1061,9 +1057,6 @@ uint32 ZoneDatabase::AddNewNPCSpawnGroupCommand(const char* zone, uint32 zone_ve
|
||||
}
|
||||
last_insert_id = results.LastInsertedID();
|
||||
|
||||
if(client)
|
||||
client->LogSQL(query.c_str());
|
||||
|
||||
uint32 respawntime = 0;
|
||||
uint32 spawnid = 0;
|
||||
if (respawnTime)
|
||||
@ -1084,7 +1077,6 @@ uint32 ZoneDatabase::AddNewNPCSpawnGroupCommand(const char* zone, uint32 zone_ve
|
||||
spawnid = results.LastInsertedID();
|
||||
|
||||
if(client)
|
||||
client->LogSQL(query.c_str());
|
||||
|
||||
query = StringFormat("INSERT INTO spawnentry (spawngroupID, npcID, chance) VALUES(%i, %i, %i)",
|
||||
last_insert_id, spawn->GetNPCTypeID(), 100);
|
||||
@ -1094,7 +1086,6 @@ uint32 ZoneDatabase::AddNewNPCSpawnGroupCommand(const char* zone, uint32 zone_ve
|
||||
}
|
||||
|
||||
if(client)
|
||||
client->LogSQL(query.c_str());
|
||||
|
||||
return spawnid;
|
||||
}
|
||||
@ -1110,7 +1101,6 @@ uint32 ZoneDatabase::UpdateNPCTypeAppearance(Client *client, NPC* spawn) {
|
||||
spawn->MerchantType, spawn->GetNPCTypeID());
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success() && client)
|
||||
client->LogSQL(query.c_str());
|
||||
|
||||
return results.Success() == true? 1: 0;
|
||||
}
|
||||
@ -1141,7 +1131,6 @@ uint32 ZoneDatabase::DeleteSpawnLeaveInNPCTypeTable(const char* zone, Client *cl
|
||||
return 0;
|
||||
|
||||
if(client)
|
||||
client->LogSQL(query.c_str());
|
||||
|
||||
query = StringFormat("DELETE FROM spawngroup WHERE id = '%i'", spawngroupID);
|
||||
results = QueryDatabase(query);
|
||||
@ -1149,7 +1138,6 @@ uint32 ZoneDatabase::DeleteSpawnLeaveInNPCTypeTable(const char* zone, Client *cl
|
||||
return 0;
|
||||
|
||||
if(client)
|
||||
client->LogSQL(query.c_str());
|
||||
|
||||
query = StringFormat("DELETE FROM spawnentry WHERE spawngroupID = '%i'", spawngroupID);
|
||||
results = QueryDatabase(query);
|
||||
@ -1157,7 +1145,6 @@ uint32 ZoneDatabase::DeleteSpawnLeaveInNPCTypeTable(const char* zone, Client *cl
|
||||
return 0;
|
||||
|
||||
if(client)
|
||||
client->LogSQL(query.c_str());
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -1191,7 +1178,6 @@ uint32 ZoneDatabase::DeleteSpawnRemoveFromNPCTypeTable(const char* zone, uint32
|
||||
return 0;
|
||||
|
||||
if(client)
|
||||
client->LogSQL(query.c_str());
|
||||
|
||||
query = StringFormat("DELETE FROM spawngroup WHERE id = '%i'", spawngroupID);
|
||||
results = QueryDatabase(query);
|
||||
@ -1199,7 +1185,6 @@ uint32 ZoneDatabase::DeleteSpawnRemoveFromNPCTypeTable(const char* zone, uint32
|
||||
return 0;
|
||||
|
||||
if(client)
|
||||
client->LogSQL(query.c_str());
|
||||
|
||||
query = StringFormat("DELETE FROM spawnentry WHERE spawngroupID = '%i'", spawngroupID);
|
||||
results = QueryDatabase(query);
|
||||
@ -1207,7 +1192,6 @@ uint32 ZoneDatabase::DeleteSpawnRemoveFromNPCTypeTable(const char* zone, uint32
|
||||
return 0;
|
||||
|
||||
if(client)
|
||||
client->LogSQL(query.c_str());
|
||||
|
||||
query = StringFormat("DELETE FROM npc_types WHERE id = '%i'", spawn->GetNPCTypeID());
|
||||
results = QueryDatabase(query);
|
||||
@ -1215,7 +1199,6 @@ uint32 ZoneDatabase::DeleteSpawnRemoveFromNPCTypeTable(const char* zone, uint32
|
||||
return 0;
|
||||
|
||||
if(client)
|
||||
client->LogSQL(query.c_str());
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -1232,7 +1215,6 @@ uint32 ZoneDatabase::AddSpawnFromSpawnGroup(const char* zone, uint32 zone_versi
|
||||
return 0;
|
||||
|
||||
if(client)
|
||||
client->LogSQL(query.c_str());
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -1257,7 +1239,6 @@ uint32 ZoneDatabase::AddNPCTypes(const char* zone, uint32 zone_version, Client *
|
||||
npc_type_id = results.LastInsertedID();
|
||||
|
||||
if(client)
|
||||
client->LogSQL(query.c_str());
|
||||
|
||||
if(client)
|
||||
client->Message(0, "%s npc_type ID %i created successfully!", numberlessName, npc_type_id);
|
||||
|
||||
@ -428,7 +428,6 @@ bool ZoneDatabase::CreateSpawn2(Client *client, uint32 spawngroup, const char* z
|
||||
return false;
|
||||
|
||||
if(client)
|
||||
client->LogSQL(query.c_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -148,7 +148,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot,
|
||||
uint32 timer, uint32 timer_duration, uint32 type, int16 *resist_adjust)
|
||||
{
|
||||
Log.Out(Logs::Detail, Logs::Spells, "CastSpell called for spell %s (%d) on entity %d, slot %d, time %d, mana %d, from item slot %d",
|
||||
spells[spell_id].name, spell_id, target_id, slot, cast_time, mana_cost, (item_slot==0xFFFFFFFF)?999:item_slot);
|
||||
(IsValidSpell(spell_id))?spells[spell_id].name:"UNKNOWN SPELL", spell_id, target_id, slot, cast_time, mana_cost, (item_slot==0xFFFFFFFF)?999:item_slot);
|
||||
|
||||
if(casting_spell_id == spell_id)
|
||||
ZeroCastingVars();
|
||||
@ -1116,11 +1116,11 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot,
|
||||
break;
|
||||
|
||||
default: // some non-instrument component. Let it go, but record it in the log
|
||||
Log.Out(Logs::Detail, Logs::Spells, "Something odd happened: Song %d required component %s", spell_id, component);
|
||||
Log.Out(Logs::Detail, Logs::Spells, "Something odd happened: Song %d required component %d", spell_id, component);
|
||||
}
|
||||
|
||||
if(!HasInstrument) { // if the instrument is missing, log it and interrupt the song
|
||||
Log.Out(Logs::Detail, Logs::Spells, "Song %d: Canceled. Missing required instrument %s", spell_id, component);
|
||||
Log.Out(Logs::Detail, Logs::Spells, "Song %d: Canceled. Missing required instrument %d", spell_id, component);
|
||||
if(c->GetGM())
|
||||
c->Message(0, "Your GM status allows you to finish casting even though you're missing a required instrument.");
|
||||
else {
|
||||
|
||||
@ -292,11 +292,11 @@ void Trade::LogTrade()
|
||||
}
|
||||
}
|
||||
|
||||
#if (EQDEBUG >= 9)
|
||||
|
||||
void Trade::DumpTrade()
|
||||
{
|
||||
Mob* with = With();
|
||||
Log.Out(Logs::General, Logs::None, "Dumping trade data: '%s' in TradeState %i with '%s'",
|
||||
Log.Out(Logs::Detail, Logs::Trading, "Dumping trade data: '%s' in TradeState %i with '%s'",
|
||||
this->owner->GetName(), state, ((with==nullptr)?"(null)":with->GetName()));
|
||||
|
||||
if (!owner->IsClient())
|
||||
@ -307,7 +307,7 @@ void Trade::DumpTrade()
|
||||
const ItemInst* inst = trader->GetInv().GetItem(i);
|
||||
|
||||
if (inst) {
|
||||
Log.Out(Logs::General, Logs::None, "Item %i (Charges=%i, Slot=%i, IsBag=%s)",
|
||||
Log.Out(Logs::Detail, Logs::Trading, "Item %i (Charges=%i, Slot=%i, IsBag=%s)",
|
||||
inst->GetItem()->ID, inst->GetCharges(),
|
||||
i, ((inst->IsType(ItemClassContainer)) ? "True" : "False"));
|
||||
|
||||
@ -315,7 +315,7 @@ void Trade::DumpTrade()
|
||||
for (uint8 j = SUB_BEGIN; j < EmuConstants::ITEM_CONTAINER_SIZE; j++) {
|
||||
inst = trader->GetInv().GetItem(i, j);
|
||||
if (inst) {
|
||||
Log.Out(Logs::General, Logs::None, "\tBagItem %i (Charges=%i, Slot=%i)",
|
||||
Log.Out(Logs::Detail, Logs::Trading, "\tBagItem %i (Charges=%i, Slot=%i)",
|
||||
inst->GetItem()->ID, inst->GetCharges(),
|
||||
Inventory::CalcSlotId(i, j));
|
||||
}
|
||||
@ -324,9 +324,9 @@ void Trade::DumpTrade()
|
||||
}
|
||||
}
|
||||
|
||||
Log.Out(Logs::General, Logs::None, "\tpp:%i, gp:%i, sp:%i, cp:%i", pp, gp, sp, cp);
|
||||
Log.Out(Logs::Detail, Logs::Trading, "\tpp:%i, gp:%i, sp:%i, cp:%i", pp, gp, sp, cp);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void Client::ResetTrade() {
|
||||
AddMoneyToPP(trade->cp, trade->sp, trade->gp, trade->pp, true);
|
||||
@ -588,7 +588,7 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st
|
||||
break;
|
||||
|
||||
if (partial_inst->GetID() != inst->GetID()) {
|
||||
Log.Out(Logs::Detail, Logs::None, "[CLIENT] Client::ResetTrade() - an incompatible location reference was returned by Inventory::FindFreeSlotForTradeItem()");
|
||||
Log.Out(Logs::Detail, Logs::Trading, "[CLIENT] Client::ResetTrade() - an incompatible location reference was returned by Inventory::FindFreeSlotForTradeItem()");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -1092,9 +1092,6 @@ void ZoneDatabase::AssignGrid(Client *client, const glm::vec2& location, uint32
|
||||
return;
|
||||
}
|
||||
|
||||
if(client)
|
||||
client->LogSQL(query.c_str());
|
||||
|
||||
if (!fuzzy)
|
||||
{
|
||||
client->Message(0, "Grid assign: spawn2 id = %d updated - exact match", spawn2id);
|
||||
@ -1146,9 +1143,6 @@ void ZoneDatabase::AddWP(Client *client, uint32 gridid, uint32 wpnum, const glm:
|
||||
if (!results.Success()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(client)
|
||||
client->LogSQL(query.c_str());
|
||||
}
|
||||
|
||||
|
||||
@ -1171,9 +1165,6 @@ void ZoneDatabase::DeleteWaypoint(Client *client, uint32 grid_num, uint32 wp_num
|
||||
if(!results.Success()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(client)
|
||||
client->LogSQL(query.c_str());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -258,15 +258,15 @@ public:
|
||||
|
||||
LinkedList<NPC_Emote_Struct*> NPCEmoteList;
|
||||
|
||||
void LoadTickItems();
|
||||
uint32 GetSpawnKillCount(uint32 in_spawnid);
|
||||
void UpdateHotzone();
|
||||
void LoadTickItems();
|
||||
uint32 GetSpawnKillCount(uint32 in_spawnid);
|
||||
void UpdateHotzone();
|
||||
std::unordered_map<int, item_tick_struct> tick_items;
|
||||
|
||||
// random object that provides random values for the zone
|
||||
EQEmu::Random random;
|
||||
|
||||
static void GMSayHookCallBackProcess(uint16 log_category, std::string& message){ entity_list.MessageStatus(0, 80, Log.GetGMSayColorFromCategory(log_category), "%s", message.c_str()); }
|
||||
static void GMSayHookCallBackProcess(uint16 log_category, const std::string& message){ entity_list.MessageStatus(0, 80, Log.GetGMSayColorFromCategory(log_category), "%s", message.c_str()); }
|
||||
|
||||
//MODDING HOOKS
|
||||
void mod_init();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user