diff options
Diffstat (limited to 'src')
397 files changed, 13793 insertions, 14977 deletions
diff --git a/src/server/authserver/Main.cpp b/src/server/authserver/Main.cpp index b16e86a7f9f..80a810e4ce1 100644 --- a/src/server/authserver/Main.cpp +++ b/src/server/authserver/Main.cpp @@ -77,7 +77,7 @@ public: /// Print out the usage string for this program on the console. void usage(const char* prog) { - TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "Usage: \n %s [<options>]\n" + TC_LOG_INFO("server.authserver", "Usage: \n %s [<options>]\n" " -c config_file use config_file as configuration file\n\r", prog); } @@ -111,11 +111,11 @@ extern int main(int argc, char** argv) return 1; } - TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "%s (authserver)", _FULLVERSION); - TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "<Ctrl-C> to stop.\n"); - TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "Using configuration file %s.", configFile); + TC_LOG_INFO("server.authserver", "%s (authserver)", _FULLVERSION); + TC_LOG_INFO("server.authserver", "<Ctrl-C> to stop.\n"); + TC_LOG_INFO("server.authserver", "Using configuration file %s.", configFile); - TC_LOG_WARN(LOG_FILTER_AUTHSERVER, "%s (Library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION)); + TC_LOG_WARN("server.authserver", "%s (Library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION)); #if defined (ACE_HAS_EVENT_POLL) || defined (ACE_HAS_DEV_POLL) ACE_Reactor::instance(new ACE_Reactor(new ACE_Dev_Poll_Reactor(ACE::max_handles(), 1), 1), true); @@ -123,17 +123,17 @@ extern int main(int argc, char** argv) ACE_Reactor::instance(new ACE_Reactor(new ACE_TP_Reactor(), true), true); #endif - TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "Max allowed open files is %d", ACE::max_handles()); + TC_LOG_DEBUG("server.authserver", "Max allowed open files is %d", ACE::max_handles()); // authserver PID file creation std::string pidFile = sConfigMgr->GetStringDefault("PidFile", ""); if (!pidFile.empty()) { if (uint32 pid = CreatePIDFile(pidFile)) - TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "Daemon PID: %u\n", pid); + TC_LOG_INFO("server.authserver", "Daemon PID: %u\n", pid); else { - TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Cannot create PID file %s.\n", pidFile.c_str()); + TC_LOG_ERROR("server.authserver", "Cannot create PID file %s.\n", pidFile.c_str()); return 1; } } @@ -146,7 +146,7 @@ extern int main(int argc, char** argv) sRealmList->Initialize(sConfigMgr->GetIntDefault("RealmsStateUpdateDelay", 20)); if (sRealmList->size() == 0) { - TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "No valid realms specified."); + TC_LOG_ERROR("server.authserver", "No valid realms specified."); return 1; } @@ -156,7 +156,7 @@ extern int main(int argc, char** argv) int32 rmport = sConfigMgr->GetIntDefault("RealmServerPort", 3724); if (rmport < 0 || rmport > 0xFFFF) { - TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Specified port out of allowed range (1-65535)"); + TC_LOG_ERROR("server.authserver", "Specified port out of allowed range (1-65535)"); return 1; } @@ -166,7 +166,7 @@ extern int main(int argc, char** argv) if (acceptor.open(bind_addr, ACE_Reactor::instance(), ACE_NONBLOCK) == -1) { - TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Auth server can not bind to %s:%d", bind_ip.c_str(), rmport); + TC_LOG_ERROR("server.authserver", "Auth server can not bind to %s:%d", bind_ip.c_str(), rmport); return 1; } @@ -196,20 +196,20 @@ extern int main(int argc, char** argv) ULONG_PTR currentAffinity = affinity & appAff; // remove non accessible processors if (!currentAffinity) - TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Processors marked in UseProcessors bitmask (hex) %x are not accessible for the authserver. Accessible processors bitmask (hex): %x", affinity, appAff); + TC_LOG_ERROR("server.authserver", "Processors marked in UseProcessors bitmask (hex) %x are not accessible for the authserver. Accessible processors bitmask (hex): %x", affinity, appAff); else if (SetProcessAffinityMask(hProcess, currentAffinity)) - TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "Using processors (bitmask, hex): %x", currentAffinity); + TC_LOG_INFO("server.authserver", "Using processors (bitmask, hex): %x", currentAffinity); else - TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Can't set used processors (hex): %x", currentAffinity); + TC_LOG_ERROR("server.authserver", "Can't set used processors (hex): %x", currentAffinity); } } if (highPriority) { if (SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS)) - TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "authserver process priority class set to HIGH"); + TC_LOG_INFO("server.authserver", "authserver process priority class set to HIGH"); else - TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Can't set authserver process priority class."); + TC_LOG_ERROR("server.authserver", "Can't set authserver process priority class."); } } #elif __linux__ // Linux @@ -224,21 +224,21 @@ extern int main(int argc, char** argv) CPU_SET(i, &mask); if (sched_setaffinity(0, sizeof(mask), &mask)) - TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Can't set used processors (hex): %x, error: %s", affinity, strerror(errno)); + TC_LOG_ERROR("server.authserver", "Can't set used processors (hex): %x, error: %s", affinity, strerror(errno)); else { CPU_ZERO(&mask); sched_getaffinity(0, sizeof(mask), &mask); - TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "Using processors (bitmask, hex): %x", *(uint32*)(&mask)); + TC_LOG_INFO("server.authserver", "Using processors (bitmask, hex): %x", *(uint32*)(&mask)); } } if (highPriority) { if (setpriority(PRIO_PROCESS, 0, PROCESS_HIGH_PRIORITY)) - TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Can't set authserver process priority class, error: %s", strerror(errno)); + TC_LOG_ERROR("server.authserver", "Can't set authserver process priority class, error: %s", strerror(errno)); else - TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "authserver process priority class set to %i", getpriority(PRIO_PROCESS, 0)); + TC_LOG_INFO("server.authserver", "authserver process priority class set to %i", getpriority(PRIO_PROCESS, 0)); } #endif @@ -259,7 +259,7 @@ extern int main(int argc, char** argv) if ((++loopCounter) == numLoops) { loopCounter = 0; - TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "Ping MySQL to keep connection alive"); + TC_LOG_INFO("server.authserver", "Ping MySQL to keep connection alive"); LoginDatabase.KeepAlive(); } } @@ -267,7 +267,7 @@ extern int main(int argc, char** argv) // Close the Database Pool and library StopDB(); - TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "Halting process..."); + TC_LOG_INFO("server.authserver", "Halting process..."); return 0; } @@ -279,32 +279,32 @@ bool StartDB() std::string dbstring = sConfigMgr->GetStringDefault("LoginDatabaseInfo", ""); if (dbstring.empty()) { - TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Database not specified"); + TC_LOG_ERROR("server.authserver", "Database not specified"); return false; } int32 worker_threads = sConfigMgr->GetIntDefault("LoginDatabase.WorkerThreads", 1); if (worker_threads < 1 || worker_threads > 32) { - TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Improper value specified for LoginDatabase.WorkerThreads, defaulting to 1."); + TC_LOG_ERROR("server.authserver", "Improper value specified for LoginDatabase.WorkerThreads, defaulting to 1."); worker_threads = 1; } int32 synch_threads = sConfigMgr->GetIntDefault("LoginDatabase.SynchThreads", 1); if (synch_threads < 1 || synch_threads > 32) { - TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Improper value specified for LoginDatabase.SynchThreads, defaulting to 1."); + TC_LOG_ERROR("server.authserver", "Improper value specified for LoginDatabase.SynchThreads, defaulting to 1."); synch_threads = 1; } // NOTE: While authserver is singlethreaded you should keep synch_threads == 1. Increasing it is just silly since only 1 will be used ever. if (!LoginDatabase.Open(dbstring, uint8(worker_threads), uint8(synch_threads))) { - TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Cannot connect to database"); + TC_LOG_ERROR("server.authserver", "Cannot connect to database"); return false; } - TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "Started auth database connection pool."); + TC_LOG_INFO("server.authserver", "Started auth database connection pool."); sLog->SetRealmId(0); // Enables DB appenders when realm is set. return true; } diff --git a/src/server/authserver/Realms/RealmList.cpp b/src/server/authserver/Realms/RealmList.cpp index 0d8764a61c0..34120f75e88 100644 --- a/src/server/authserver/Realms/RealmList.cpp +++ b/src/server/authserver/Realms/RealmList.cpp @@ -68,7 +68,7 @@ void RealmList::UpdateIfNeed() void RealmList::UpdateRealms(bool init) { - TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "Updating Realm List..."); + TC_LOG_INFO("server.authserver", "Updating Realm List..."); PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_REALMLIST); PreparedQueryResult result = LoginDatabase.Query(stmt); @@ -99,7 +99,7 @@ void RealmList::UpdateRealms(bool init) UpdateRealm(realmId, name, externalAddr, localAddr, submask, icon, flag, timezone, (allowedSecurityLevel <= SEC_ADMINISTRATOR ? AccountTypes(allowedSecurityLevel) : SEC_ADMINISTRATOR), pop, build); if (init) - TC_LOG_INFO(LOG_FILTER_AUTHSERVER, "Added realm \"%s\" at %s:%u.", name.c_str(), m_realms[name].ExternalAddress.get_host_addr(), port); + TC_LOG_INFO("server.authserver", "Added realm \"%s\" at %s:%u.", name.c_str(), m_realms[name].ExternalAddress.get_host_addr(), port); } while (result->NextRow()); } diff --git a/src/server/authserver/Server/AuthSocket.cpp b/src/server/authserver/Server/AuthSocket.cpp index 4312548116a..6595b6238b2 100644 --- a/src/server/authserver/Server/AuthSocket.cpp +++ b/src/server/authserver/Server/AuthSocket.cpp @@ -211,12 +211,12 @@ AuthSocket::~AuthSocket(void) { } // Accept the connection void AuthSocket::OnAccept(void) { - TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "'%s:%d' Accepting connection", socket().getRemoteAddress().c_str(), socket().getRemotePort()); + TC_LOG_DEBUG("server.authserver", "'%s:%d' Accepting connection", socket().getRemoteAddress().c_str(), socket().getRemotePort()); } void AuthSocket::OnClose(void) { - TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "AuthSocket::OnClose"); + TC_LOG_DEBUG("server.authserver", "AuthSocket::OnClose"); } // Read the packet from the client @@ -235,7 +235,7 @@ void AuthSocket::OnRead() ++challengesInARow; if (challengesInARow == MAX_AUTH_LOGON_CHALLENGES_IN_A_ROW) { - TC_LOG_WARN(LOG_FILTER_AUTHSERVER, "Got %u AUTH_LOGON_CHALLENGE in a row from '%s', possible ongoing DoS", challengesInARow, socket().getRemoteAddress().c_str()); + TC_LOG_WARN("server.authserver", "Got %u AUTH_LOGON_CHALLENGE in a row from '%s', possible ongoing DoS", challengesInARow, socket().getRemoteAddress().c_str()); socket().shutdown(); return; } @@ -248,11 +248,11 @@ void AuthSocket::OnRead() { if ((uint8)table[i].cmd == _cmd && (table[i].status == STATUS_CONNECTED || (_authed && table[i].status == STATUS_AUTHED))) { - TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "Got data for cmd %u recv length %u", (uint32)_cmd, (uint32)socket().recv_len()); + TC_LOG_DEBUG("server.authserver", "Got data for cmd %u recv length %u", (uint32)_cmd, (uint32)socket().recv_len()); if (!(*this.*table[i].handler)()) { - TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "Command handler failed for cmd %u recv length %u", (uint32)_cmd, (uint32)socket().recv_len()); + TC_LOG_DEBUG("server.authserver", "Command handler failed for cmd %u recv length %u", (uint32)_cmd, (uint32)socket().recv_len()); return; } break; @@ -262,7 +262,7 @@ void AuthSocket::OnRead() // Report unknown packets in the error log if (i == AUTH_TOTAL_COMMANDS) { - TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Got unknown packet from '%s'", socket().getRemoteAddress().c_str()); + TC_LOG_ERROR("server.authserver", "Got unknown packet from '%s'", socket().getRemoteAddress().c_str()); socket().shutdown(); return; } @@ -311,7 +311,7 @@ void AuthSocket::_SetVSFields(const std::string& rI) // Logon Challenge command handler bool AuthSocket::_HandleLogonChallenge() { - TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "Entering _HandleLogonChallenge"); + TC_LOG_DEBUG("server.authserver", "Entering _HandleLogonChallenge"); if (socket().recv_len() < sizeof(sAuthLogonChallenge_C)) return false; @@ -326,7 +326,7 @@ bool AuthSocket::_HandleLogonChallenge() #endif uint16 remaining = ((sAuthLogonChallenge_C *)&buf[0])->size; - TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "[AuthChallenge] got header, body is %#04x bytes", remaining); + TC_LOG_DEBUG("server.authserver", "[AuthChallenge] got header, body is %#04x bytes", remaining); if ((remaining < sizeof(sAuthLogonChallenge_C) - buf.size()) || (socket().recv_len() < remaining)) return false; @@ -338,8 +338,8 @@ bool AuthSocket::_HandleLogonChallenge() // Read the remaining of the packet socket().recv((char *)&buf[4], remaining); - TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "[AuthChallenge] got full packet, %#04x bytes", ch->size); - TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "[AuthChallenge] name(%d): '%s'", ch->I_len, ch->I); + TC_LOG_DEBUG("server.authserver", "[AuthChallenge] got full packet, %#04x bytes", ch->size); + TC_LOG_DEBUG("server.authserver", "[AuthChallenge] name(%d): '%s'", ch->I_len, ch->I); // BigEndian code, nop in little endian case // size already converted @@ -379,7 +379,7 @@ bool AuthSocket::_HandleLogonChallenge() if (result) { pkt << uint8(WOW_FAIL_BANNED); - TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] Banned ip tries to login!", socket().getRemoteAddress().c_str(), socket().getRemotePort()); + TC_LOG_DEBUG("server.authserver", "'%s:%d' [AuthChallenge] Banned ip tries to login!", socket().getRemoteAddress().c_str(), socket().getRemotePort()); } else { @@ -397,24 +397,24 @@ bool AuthSocket::_HandleLogonChallenge() bool locked = false; if (fields[2].GetUInt8() == 1) // if ip is locked { - TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "[AuthChallenge] Account '%s' is locked to IP - '%s'", _login.c_str(), fields[3].GetCString()); - TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "[AuthChallenge] Player address is '%s'", ip_address.c_str()); + TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Account '%s' is locked to IP - '%s'", _login.c_str(), fields[3].GetCString()); + TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Player address is '%s'", ip_address.c_str()); if (strcmp(fields[4].GetCString(), ip_address.c_str()) != 0) { - TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "[AuthChallenge] Account IP differs"); + TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Account IP differs"); pkt << uint8(WOW_FAIL_LOCKED_ENFORCED); locked = true; } else - TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "[AuthChallenge] Account IP matches"); + TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Account IP matches"); } else { - TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "[AuthChallenge] Account '%s' is not locked to ip", _login.c_str()); + TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Account '%s' is not locked to ip", _login.c_str()); std::string accountCountry = fields[3].GetString(); if (accountCountry.empty() || accountCountry == "00") - TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "[AuthChallenge] Account '%s' is not locked to country", _login.c_str()); + TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Account '%s' is not locked to country", _login.c_str()); else if (!accountCountry.empty()) { uint32 ip = inet_addr(ip_address.c_str()); @@ -425,18 +425,18 @@ bool AuthSocket::_HandleLogonChallenge() if (PreparedQueryResult sessionCountryQuery = LoginDatabase.Query(stmt)) { std::string loginCountry = (*sessionCountryQuery)[0].GetString(); - TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "[AuthChallenge] Account '%s' is locked to country: '%s' Player country is '%s'", _login.c_str(), accountCountry.c_str(), loginCountry.c_str()); + TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Account '%s' is locked to country: '%s' Player country is '%s'", _login.c_str(), accountCountry.c_str(), loginCountry.c_str()); if (loginCountry != accountCountry) { - TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "[AuthChallenge] Account country differs."); + TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Account country differs."); pkt << uint8(WOW_FAIL_UNLOCKABLE_LOCK); locked = true; } else - TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "[AuthChallenge] Account country matches"); + TC_LOG_DEBUG("server.authserver", "[AuthChallenge] Account country matches"); } else - TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "[AuthChallenge] IP2NATION Table empty"); + TC_LOG_DEBUG("server.authserver", "[AuthChallenge] IP2NATION Table empty"); } } @@ -454,12 +454,12 @@ bool AuthSocket::_HandleLogonChallenge() if ((*banresult)[0].GetUInt32() == (*banresult)[1].GetUInt32()) { pkt << uint8(WOW_FAIL_BANNED); - TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] Banned account %s tried to login!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ()); + TC_LOG_DEBUG("server.authserver", "'%s:%d' [AuthChallenge] Banned account %s tried to login!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ()); } else { pkt << uint8(WOW_FAIL_SUSPENDED); - TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] Temporarily banned account %s tried to login!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ()); + TC_LOG_DEBUG("server.authserver", "'%s:%d' [AuthChallenge] Temporarily banned account %s tried to login!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ()); } } else @@ -471,7 +471,7 @@ bool AuthSocket::_HandleLogonChallenge() std::string databaseV = fields[6].GetString(); std::string databaseS = fields[7].GetString(); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "database authentication values: v='%s' s='%s'", databaseV.c_str(), databaseS.c_str()); + TC_LOG_DEBUG("network", "database authentication values: v='%s' s='%s'", databaseV.c_str(), databaseS.c_str()); // multiply with 2 since bytes are stored as hexstring if (databaseV.size() != s_BYTE_SIZE * 2 || databaseS.size() != s_BYTE_SIZE * 2) @@ -539,7 +539,7 @@ bool AuthSocket::_HandleLogonChallenge() for (int i = 0; i < 4; ++i) _localizationName[i] = ch->country[4-i-1]; - TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] account %s is using '%c%c%c%c' locale (%u)", socket().getRemoteAddress().c_str(), socket().getRemotePort(), + TC_LOG_DEBUG("server.authserver", "'%s:%d' [AuthChallenge] account %s is using '%c%c%c%c' locale (%u)", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str (), ch->country[3], ch->country[2], ch->country[1], ch->country[0], GetLocaleByName(_localizationName) ); } @@ -556,7 +556,7 @@ bool AuthSocket::_HandleLogonChallenge() // Logon Proof command handler bool AuthSocket::_HandleLogonProof() { - TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "Entering _HandleLogonProof"); + TC_LOG_DEBUG("server.authserver", "Entering _HandleLogonProof"); // Read the packet sAuthLogonProof_C lp; @@ -567,7 +567,7 @@ bool AuthSocket::_HandleLogonProof() if (_expversion == NO_VALID_EXP_FLAG) { // Check if we have the appropriate patch on the disk - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Client with invalid version, patching is not implemented"); + TC_LOG_DEBUG("network", "Client with invalid version, patching is not implemented"); socket().shutdown(); return true; } @@ -651,7 +651,7 @@ bool AuthSocket::_HandleLogonProof() // Check if SRP6 results match (password is correct), else send an error if (!memcmp(M.AsByteArray().get(), lp.M1, 20)) { - TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "'%s:%d' User '%s' successfully authenticated", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str()); + TC_LOG_DEBUG("server.authserver", "'%s:%d' User '%s' successfully authenticated", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str()); // Update the sessionkey, last_ip, last login time and reset number of failed logins in the account table for this account // No SQL injection (escaped user name) and IP address as received by socket @@ -663,7 +663,7 @@ bool AuthSocket::_HandleLogonProof() stmt->setUInt32(2, GetLocaleByName(_localizationName)); stmt->setString(3, _os); stmt->setString(4, _login); - LoginDatabase.Execute(stmt); + LoginDatabase.DirectExecute(stmt); OPENSSL_free((void*)K_hex); @@ -719,7 +719,7 @@ bool AuthSocket::_HandleLogonProof() char data[4] = { AUTH_LOGON_PROOF, WOW_FAIL_UNKNOWN_ACCOUNT, 3, 0 }; socket().send(data, sizeof(data)); - TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] account %s tried to login with invalid password!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ()); + TC_LOG_DEBUG("server.authserver", "'%s:%d' [AuthChallenge] account %s tried to login with invalid password!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ()); uint32 MaxWrongPassCount = sConfigMgr->GetIntDefault("WrongPass.MaxCount", 0); if (MaxWrongPassCount > 0) @@ -749,7 +749,7 @@ bool AuthSocket::_HandleLogonProof() stmt->setUInt32(1, WrongPassBanTime); LoginDatabase.Execute(stmt); - TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] account %s got banned for '%u' seconds because it failed to authenticate '%u' times", + TC_LOG_DEBUG("server.authserver", "'%s:%d' [AuthChallenge] account %s got banned for '%u' seconds because it failed to authenticate '%u' times", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str(), WrongPassBanTime, failed_logins); } else @@ -759,7 +759,7 @@ bool AuthSocket::_HandleLogonProof() stmt->setUInt32(1, WrongPassBanTime); LoginDatabase.Execute(stmt); - TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] IP %s got banned for '%u' seconds because account %s failed to authenticate '%u' times", + TC_LOG_DEBUG("server.authserver", "'%s:%d' [AuthChallenge] IP %s got banned for '%u' seconds because account %s failed to authenticate '%u' times", socket().getRemoteAddress().c_str(), socket().getRemotePort(), socket().getRemoteAddress().c_str(), WrongPassBanTime, _login.c_str(), failed_logins); } } @@ -773,7 +773,7 @@ bool AuthSocket::_HandleLogonProof() // Reconnect Challenge command handler bool AuthSocket::_HandleReconnectChallenge() { - TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "Entering _HandleReconnectChallenge"); + TC_LOG_DEBUG("server.authserver", "Entering _HandleReconnectChallenge"); if (socket().recv_len() < sizeof(sAuthLogonChallenge_C)) return false; @@ -788,7 +788,7 @@ bool AuthSocket::_HandleReconnectChallenge() #endif uint16 remaining = ((sAuthLogonChallenge_C *)&buf[0])->size; - TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "[ReconnectChallenge] got header, body is %#04x bytes", remaining); + TC_LOG_DEBUG("server.authserver", "[ReconnectChallenge] got header, body is %#04x bytes", remaining); if ((remaining < sizeof(sAuthLogonChallenge_C) - buf.size()) || (socket().recv_len() < remaining)) return false; @@ -800,8 +800,8 @@ bool AuthSocket::_HandleReconnectChallenge() // Read the remaining of the packet socket().recv((char *)&buf[4], remaining); - TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "[ReconnectChallenge] got full packet, %#04x bytes", ch->size); - TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "[ReconnectChallenge] name(%d): '%s'", ch->I_len, ch->I); + TC_LOG_DEBUG("server.authserver", "[ReconnectChallenge] got full packet, %#04x bytes", ch->size); + TC_LOG_DEBUG("server.authserver", "[ReconnectChallenge] name(%d): '%s'", ch->I_len, ch->I); _login = (const char*)ch->I; @@ -812,7 +812,7 @@ bool AuthSocket::_HandleReconnectChallenge() // Stop if the account is not found if (!result) { - TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "'%s:%d' [ERROR] user %s tried to login and we cannot find his session key in the database.", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str()); + TC_LOG_ERROR("server.authserver", "'%s:%d' [ERROR] user %s tried to login and we cannot find his session key in the database.", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str()); socket().shutdown(); return false; } @@ -848,7 +848,7 @@ bool AuthSocket::_HandleReconnectChallenge() // Reconnect Proof command handler bool AuthSocket::_HandleReconnectProof() { - TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "Entering _HandleReconnectProof"); + TC_LOG_DEBUG("server.authserver", "Entering _HandleReconnectProof"); // Read the packet sAuthReconnectProof_C lp; if (!socket().recv((char *)&lp, sizeof(sAuthReconnectProof_C))) @@ -879,7 +879,7 @@ bool AuthSocket::_HandleReconnectProof() } else { - TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "'%s:%d' [ERROR] user %s tried to login, but session is invalid.", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str()); + TC_LOG_ERROR("server.authserver", "'%s:%d' [ERROR] user %s tried to login, but session is invalid.", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str()); socket().shutdown(); return false; } @@ -910,7 +910,7 @@ ACE_INET_Addr const& AuthSocket::GetAddressForClient(Realm const& realm, ACE_INE // Realm List command handler bool AuthSocket::_HandleRealmList() { - TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "Entering _HandleRealmList"); + TC_LOG_DEBUG("server.authserver", "Entering _HandleRealmList"); if (socket().recv_len() < 5) return false; @@ -923,7 +923,7 @@ bool AuthSocket::_HandleRealmList() PreparedQueryResult result = LoginDatabase.Query(stmt); if (!result) { - TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "'%s:%d' [ERROR] user %s tried to login but we cannot find him in the database.", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str()); + TC_LOG_ERROR("server.authserver", "'%s:%d' [ERROR] user %s tried to login but we cannot find him in the database.", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str()); socket().shutdown(); return false; } @@ -1040,11 +1040,11 @@ bool AuthSocket::_HandleRealmList() // Resume patch transfer bool AuthSocket::_HandleXferResume() { - TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "Entering _HandleXferResume"); + TC_LOG_DEBUG("server.authserver", "Entering _HandleXferResume"); // Check packet length and patch existence if (socket().recv_len() < 9 || !pPatch) // FIXME: pPatch is never used { - TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Error while resuming patch transfer (wrong packet)"); + TC_LOG_ERROR("server.authserver", "Error while resuming patch transfer (wrong packet)"); return false; } @@ -1061,7 +1061,7 @@ bool AuthSocket::_HandleXferResume() // Cancel patch transfer bool AuthSocket::_HandleXferCancel() { - TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "Entering _HandleXferCancel"); + TC_LOG_DEBUG("server.authserver", "Entering _HandleXferCancel"); // Close and delete the socket socket().recv_skip(1); //clear input buffer @@ -1073,12 +1073,12 @@ bool AuthSocket::_HandleXferCancel() // Accept patch transfer bool AuthSocket::_HandleXferAccept() { - TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "Entering _HandleXferAccept"); + TC_LOG_DEBUG("server.authserver", "Entering _HandleXferAccept"); // Check packet length and patch existence if (!pPatch) { - TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Error while accepting patch transfer (wrong packet)"); + TC_LOG_ERROR("server.authserver", "Error while accepting patch transfer (wrong packet)"); return false; } @@ -1159,11 +1159,11 @@ void Patcher::LoadPatchMD5(char *szFileName) std::string path = "./patches/"; path += szFileName; FILE* pPatch = fopen(path.c_str(), "rb"); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Loading patch info from %s\n", path.c_str()); + TC_LOG_DEBUG("network", "Loading patch info from %s\n", path.c_str()); if (!pPatch) { - TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Error loading patch %s\n", path.c_str()); + TC_LOG_ERROR("server.authserver", "Error loading patch %s\n", path.c_str()); return; } diff --git a/src/server/authserver/Server/RealmAcceptor.h b/src/server/authserver/Server/RealmAcceptor.h index a982417c3d6..39877f71538 100644 --- a/src/server/authserver/Server/RealmAcceptor.h +++ b/src/server/authserver/Server/RealmAcceptor.h @@ -48,7 +48,7 @@ protected: virtual int handle_timeout(const ACE_Time_Value& /*current_time*/, const void* /*act = 0*/) { - TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "Resuming acceptor"); + TC_LOG_DEBUG("server.authserver", "Resuming acceptor"); reactor()->cancel_timer(this, 1); return reactor()->register_handler(this, ACE_Event_Handler::ACCEPT_MASK); } @@ -58,7 +58,7 @@ protected: #if defined(ENFILE) && defined(EMFILE) if (errno == ENFILE || errno == EMFILE) { - TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Out of file descriptors, suspending incoming connections for 10 seconds"); + TC_LOG_ERROR("server.authserver", "Out of file descriptors, suspending incoming connections for 10 seconds"); reactor()->remove_handler(this, ACE_Event_Handler::ACCEPT_MASK | ACE_Event_Handler::DONT_CALL); reactor()->schedule_timer(this, NULL, ACE_Time_Value(10)); } diff --git a/src/server/authserver/Server/RealmSocket.cpp b/src/server/authserver/Server/RealmSocket.cpp index acefa4b1af7..13bc71f99a4 100644 --- a/src/server/authserver/Server/RealmSocket.cpp +++ b/src/server/authserver/Server/RealmSocket.cpp @@ -56,7 +56,7 @@ int RealmSocket::open(void * arg) if (peer().get_remote_addr(addr) == -1) { - TC_LOG_ERROR(LOG_FILTER_AUTHSERVER, "Error %s while opening realm socket!", ACE_OS::strerror(errno)); + TC_LOG_ERROR("server.authserver", "Error %s while opening realm socket!", ACE_OS::strerror(errno)); return -1; } diff --git a/src/server/authserver/authserver.conf.dist b/src/server/authserver/authserver.conf.dist index 3c811eda3b3..83edf9669ac 100644 --- a/src/server/authserver/authserver.conf.dist +++ b/src/server/authserver/authserver.conf.dist @@ -219,6 +219,11 @@ LoginDatabase.WorkerThreads = 1 Appender.Console=1,2,0 Appender.Auth=2,2,0,Auth.log,w +# Logger config values: Given a logger "name" +# Logger.name +# Description: Defines 'What to log' +# Format: LogLevel,AppenderList +# # LogLevel # 0 - (Disabled) # 1 - (Trace) @@ -231,33 +236,8 @@ Appender.Auth=2,2,0,Auth.log,w # AppenderList: List of appenders linked to logger # (Using spaces as separator). # -# Appenders -# Description: List of Appenders to read from config -# (Using spaces as separator). -# Default: "Console Server" - -Appenders=Console Auth - -# Logger config values: Given a logger "name" -# Logger.name -# Description: Defines 'What to log' -# Format: Type,LogLevel,AppenderList -# Type -# 0 - Default. Each type that has no config will -# rely on this one. Core will create this logger -# (disabled) if it's not configured -# 7 - Network input/output, -# 30 - Authserver - -Logger.Root=0,3,Console Auth - -# -# Loggers -# Description: List of Loggers to read from config -# (Using spaces as separator). -# Default: "root" -Loggers=Root +Logger.root=3,Console Auth # ################################################################################################### diff --git a/src/server/collision/DynamicTree.cpp b/src/server/collision/DynamicTree.cpp index 4b2878169d7..2f4985757db 100644 --- a/src/server/collision/DynamicTree.cpp +++ b/src/server/collision/DynamicTree.cpp @@ -163,16 +163,16 @@ struct DynamicTreeIntersectionCallback_WithLogger uint32 phase_mask; DynamicTreeIntersectionCallback_WithLogger(uint32 phasemask) : did_hit(false), phase_mask(phasemask) { - TC_LOG_DEBUG(LOG_FILTER_MAPS, "Dynamic Intersection log"); + TC_LOG_DEBUG("maps", "Dynamic Intersection log"); } bool operator()(const G3D::Ray& r, const GameObjectModel& obj, float& distance) { - TC_LOG_DEBUG(LOG_FILTER_MAPS, "testing intersection with %s", obj.name.c_str()); + TC_LOG_DEBUG("maps", "testing intersection with %s", obj.name.c_str()); bool hit = obj.intersectRay(r, distance, true, phase_mask); if (hit) { did_hit = true; - TC_LOG_DEBUG(LOG_FILTER_MAPS, "result: intersects"); + TC_LOG_DEBUG("maps", "result: intersects"); } return hit; } diff --git a/src/server/collision/Management/MMapManager.cpp b/src/server/collision/Management/MMapManager.cpp index 71867ff5554..d3bfe17aaa4 100644 --- a/src/server/collision/Management/MMapManager.cpp +++ b/src/server/collision/Management/MMapManager.cpp @@ -43,7 +43,7 @@ namespace MMAP FILE* file = fopen(fileName, "rb"); if (!file) { - TC_LOG_DEBUG(LOG_FILTER_MAPS, "MMAP::LoadMap: Error: Could not open mmap file '%s'", fileName); + TC_LOG_DEBUG("maps", "MMAP::LoadMap: Error: Could not open mmap file '%s'", fileName); delete[] fileName; return false; } @@ -53,7 +53,7 @@ namespace MMAP fclose(file); if (count != 1) { - TC_LOG_DEBUG(LOG_FILTER_MAPS, "MMAP::LoadMap: Error: Could not read params from file '%s'", fileName); + TC_LOG_DEBUG("maps", "MMAP::LoadMap: Error: Could not read params from file '%s'", fileName); delete[] fileName; return false; } @@ -62,14 +62,14 @@ namespace MMAP if (dtStatusFailed(mesh->init(¶ms))) { dtFreeNavMesh(mesh); - TC_LOG_ERROR(LOG_FILTER_MAPS, "MMAP::LoadMap: Failed to initialize dtNavMesh for mmap %03u from file %s", mapId, fileName); + TC_LOG_ERROR("maps", "MMAP::LoadMap: Failed to initialize dtNavMesh for mmap %03u from file %s", mapId, fileName); delete[] fileName; return false; } delete[] fileName; - TC_LOG_INFO(LOG_FILTER_MAPS, "MMAP::LoadMap: Loaded %03i.mmap", mapId); + TC_LOG_INFO("maps", "MMAP::LoadMap: Loaded %03i.mmap", mapId); // store inside our map list MMapData* mmapData = new MMapData(mesh); @@ -103,7 +103,7 @@ namespace MMAP FILE* file = fopen(fileName, "rb"); if (!file) { - TC_LOG_DEBUG(LOG_FILTER_MAPS, "MMAP::LoadMapTile: Could not open mmtile file '%s'", fileName); + TC_LOG_DEBUG("maps", "MMAP::LoadMapTile: Could not open mmtile file '%s'", fileName); delete[] fileName; return false; } @@ -114,14 +114,14 @@ namespace MMAP MmapTileHeader fileHeader; if (fread(&fileHeader, sizeof(MmapTileHeader), 1, file) != 1 || fileHeader.mmapMagic != MMAP_MAGIC) { - TC_LOG_ERROR(LOG_FILTER_MAPS, "MMAP::LoadMapTile: Bad header in mmap %03u%02i%02i.mmtile", mapId, x, y); + TC_LOG_ERROR("maps", "MMAP::LoadMapTile: Bad header in mmap %03u%02i%02i.mmtile", mapId, x, y); fclose(file); return false; } if (fileHeader.mmapVersion != MMAP_VERSION) { - TC_LOG_ERROR(LOG_FILTER_MAPS, "MMAP::LoadMapTile: %03u%02i%02i.mmtile was built with generator v%i, expected v%i", + TC_LOG_ERROR("maps", "MMAP::LoadMapTile: %03u%02i%02i.mmtile was built with generator v%i, expected v%i", mapId, x, y, fileHeader.mmapVersion, MMAP_VERSION); fclose(file); return false; @@ -133,7 +133,7 @@ namespace MMAP size_t result = fread(data, fileHeader.size, 1, file); if (result != 1) { - TC_LOG_ERROR(LOG_FILTER_MAPS, "MMAP::LoadMapTile: Bad header or data in mmap %03u%02i%02i.mmtile", mapId, x, y); + TC_LOG_ERROR("maps", "MMAP::LoadMapTile: Bad header or data in mmap %03u%02i%02i.mmtile", mapId, x, y); fclose(file); return false; } @@ -148,12 +148,12 @@ namespace MMAP { mmap->_loadedTiles.insert(std::pair<uint32, dtTileRef>(pos, tileRef)); ++_loadedTiles; - TC_LOG_INFO(LOG_FILTER_MAPS, "MMAP::LoadMapTile: Loaded mmtile %03i[%02i, %02i] into %03i[%02i, %02i]", mapId, x, y, mapId, header->x, header->y); + TC_LOG_INFO("maps", "MMAP::LoadMapTile: Loaded mmtile %03i[%02i, %02i] into %03i[%02i, %02i]", mapId, x, y, mapId, header->x, header->y); return true; } else { - TC_LOG_ERROR(LOG_FILTER_MAPS, "MMAP::LoadMapTile: Could not load %03u%02i%02i.mmtile into navmesh", mapId, x, y); + TC_LOG_ERROR("maps", "MMAP::LoadMapTile: Could not load %03u%02i%02i.mmtile into navmesh", mapId, x, y); dtFree(data); return false; } @@ -166,7 +166,7 @@ namespace MMAP // Do not attempt to remove tiles from a not-loaded map if (_loadedMaps.find(mapId) == _loadedMaps.end()) { - TC_LOG_DEBUG(LOG_FILTER_MAPS, "MMAP::UnloadMapTile: Asked to unload not loaded navmesh map. %03u%02i%02i.mmtile", mapId, x, y); + TC_LOG_DEBUG("maps", "MMAP::UnloadMapTile: Asked to unload not loaded navmesh map. %03u%02i%02i.mmtile", mapId, x, y); return false; } @@ -176,7 +176,7 @@ namespace MMAP uint32 pos = PackTileId(x, y); if (mmap->_loadedTiles.find(pos) == mmap->_loadedTiles.end()) { - TC_LOG_DEBUG(LOG_FILTER_MAPS, "MMAP::UnloadMapTile: Asked to unload not loaded navmesh tile. %03u%02i%02i.mmtile", mapId, x, y); + TC_LOG_DEBUG("maps", "MMAP::UnloadMapTile: Asked to unload not loaded navmesh tile. %03u%02i%02i.mmtile", mapId, x, y); return false; } @@ -188,14 +188,14 @@ namespace MMAP // this is technically a memory leak // if the grid is later reloaded, dtNavMesh::addTile will return error but no extra memory is used // we cannot recover from this error - assert out - TC_LOG_ERROR(LOG_FILTER_MAPS, "MMAP::UnloadMapTile: Could not unload %03u%02i%02i.mmtile from navmesh", mapId, x, y); + TC_LOG_ERROR("maps", "MMAP::UnloadMapTile: Could not unload %03u%02i%02i.mmtile from navmesh", mapId, x, y); ASSERT(false); } else { mmap->_loadedTiles.erase(pos); --_loadedTiles; - TC_LOG_INFO(LOG_FILTER_MAPS, "MMAP::UnloadMapTile: Unloaded mmtile [%02i, %02i] from %03i", x, y, mapId); + TC_LOG_INFO("maps", "MMAP::UnloadMapTile: Unloaded mmtile [%02i, %02i] from %03i", x, y, mapId); return true; } @@ -207,7 +207,7 @@ namespace MMAP if (_loadedMaps.find(mapId) == _loadedMaps.end()) { // file may not exist, therefore not loaded - TC_LOG_DEBUG(LOG_FILTER_MAPS, "MMAP::UnloadMap: Asked to unload not loaded navmesh map %03u", mapId); + TC_LOG_DEBUG("maps", "MMAP::UnloadMap: Asked to unload not loaded navmesh map %03u", mapId); return false; } @@ -218,17 +218,17 @@ namespace MMAP uint32 x = (i->first >> 16); uint32 y = (i->first & 0x0000FFFF); if (dtStatusFailed(mmap->navMesh->removeTile(i->second, NULL, NULL))) - TC_LOG_ERROR(LOG_FILTER_MAPS, "MMAP::UnloadMap: Could not unload %03u%02u%02u.mmtile from navmesh", mapId, x, y); + TC_LOG_ERROR("maps", "MMAP::UnloadMap: Could not unload %03u%02u%02u.mmtile from navmesh", mapId, x, y); else { --_loadedTiles; - TC_LOG_INFO(LOG_FILTER_MAPS, "MMAP::UnloadMap: Unloaded mmtile [%02u, %02u] from %03u", mapId, x, y, mapId); + TC_LOG_INFO("maps", "MMAP::UnloadMap: Unloaded mmtile [%02u, %02u] from %03u", mapId, x, y, mapId); } } delete mmap; _loadedMaps.erase(mapId); - TC_LOG_INFO(LOG_FILTER_MAPS, "MMAP::UnloadMap: Unloaded %03u.mmap", mapId); + TC_LOG_INFO("maps", "MMAP::UnloadMap: Unloaded %03u.mmap", mapId); return true; } @@ -239,14 +239,14 @@ namespace MMAP if (_loadedMaps.find(mapId) == _loadedMaps.end()) { // file may not exist, therefore not loaded - TC_LOG_DEBUG(LOG_FILTER_MAPS, "MMAP::UnloadMapInstance: Asked to unload not loaded navmesh map %03u", mapId); + TC_LOG_DEBUG("maps", "MMAP::UnloadMapInstance: Asked to unload not loaded navmesh map %03u", mapId); return false; } MMapData* mmap = _loadedMaps[mapId]; if (mmap->_navMeshQueries.find(instanceId) == mmap->_navMeshQueries.end()) { - TC_LOG_DEBUG(LOG_FILTER_MAPS, "MMAP::UnloadMapInstance: Asked to unload not loaded dtNavMeshQuery mapId %03u instanceId %u", mapId, instanceId); + TC_LOG_DEBUG("maps", "MMAP::UnloadMapInstance: Asked to unload not loaded dtNavMeshQuery mapId %03u instanceId %u", mapId, instanceId); return false; } @@ -254,7 +254,7 @@ namespace MMAP dtFreeNavMeshQuery(query); mmap->_navMeshQueries.erase(instanceId); - TC_LOG_INFO(LOG_FILTER_MAPS, "MMAP::UnloadMapInstance: Unloaded mapId %03u instanceId %u", mapId, instanceId); + TC_LOG_INFO("maps", "MMAP::UnloadMapInstance: Unloaded mapId %03u instanceId %u", mapId, instanceId); return true; } @@ -280,11 +280,11 @@ namespace MMAP if (dtStatusFailed(query->init(mmap->navMesh, 2048))) { dtFreeNavMeshQuery(query); - TC_LOG_ERROR(LOG_FILTER_MAPS, "MMAP::GetNavMeshQuery: Failed to initialize dtNavMeshQuery for mapId %03u instanceId %u", mapId, instanceId); + TC_LOG_ERROR("maps", "MMAP::GetNavMeshQuery: Failed to initialize dtNavMeshQuery for mapId %03u instanceId %u", mapId, instanceId); return NULL; } - TC_LOG_INFO(LOG_FILTER_MAPS, "MMAP:GetNavMeshQuery: created dtNavMeshQuery for mapId %03u instanceId %u", mapId, instanceId); + TC_LOG_INFO("maps", "MMAP:GetNavMeshQuery: created dtNavMeshQuery for mapId %03u instanceId %u", mapId, instanceId); mmap->_navMeshQueries.insert(std::pair<uint32, dtNavMeshQuery*>(instanceId, query)); } diff --git a/src/server/collision/Management/VMapManager2.cpp b/src/server/collision/Management/VMapManager2.cpp index 6355dbcf4ce..975c6777774 100644 --- a/src/server/collision/Management/VMapManager2.cpp +++ b/src/server/collision/Management/VMapManager2.cpp @@ -260,11 +260,11 @@ namespace VMAP WorldModel* worldmodel = new WorldModel(); if (!worldmodel->readFile(basepath + filename + ".vmo")) { - VMAP_ERROR_LOG(LOG_FILTER_GENERAL, "VMapManager2: could not load '%s%s.vmo'", basepath.c_str(), filename.c_str()); + VMAP_ERROR_LOG("misc", "VMapManager2: could not load '%s%s.vmo'", basepath.c_str(), filename.c_str()); delete worldmodel; return NULL; } - VMAP_DEBUG_LOG(LOG_FILTER_MAPS, "VMapManager2: loading file '%s%s'", basepath.c_str(), filename.c_str()); + VMAP_DEBUG_LOG("maps", "VMapManager2: loading file '%s%s'", basepath.c_str(), filename.c_str()); model = iLoadedModelFiles.insert(std::pair<std::string, ManagedModel>(filename, ManagedModel())).first; model->second.setModel(worldmodel); } @@ -280,12 +280,12 @@ namespace VMAP ModelFileMap::iterator model = iLoadedModelFiles.find(filename); if (model == iLoadedModelFiles.end()) { - VMAP_ERROR_LOG(LOG_FILTER_GENERAL, "VMapManager2: trying to unload non-loaded file '%s'", filename.c_str()); + VMAP_ERROR_LOG("misc", "VMapManager2: trying to unload non-loaded file '%s'", filename.c_str()); return; } if (model->second.decRefCount() == 0) { - VMAP_DEBUG_LOG(LOG_FILTER_MAPS, "VMapManager2: unloading file '%s'", filename.c_str()); + VMAP_DEBUG_LOG("maps", "VMapManager2: unloading file '%s'", filename.c_str()); delete model->second.getModel(); iLoadedModelFiles.erase(model); } diff --git a/src/server/collision/Maps/MapTree.cpp b/src/server/collision/Maps/MapTree.cpp index d20c572cf71..8cb1e3d7064 100644 --- a/src/server/collision/Maps/MapTree.cpp +++ b/src/server/collision/Maps/MapTree.cpp @@ -57,7 +57,7 @@ namespace VMAP void operator()(const Vector3& point, uint32 entry) { #ifdef VMAP_DEBUG - TC_LOG_DEBUG(LOG_FILTER_MAPS, "AreaInfoCallback: trying to intersect '%s'", prims[entry].name.c_str()); + TC_LOG_DEBUG("maps", "AreaInfoCallback: trying to intersect '%s'", prims[entry].name.c_str()); #endif prims[entry].intersectPoint(point, aInfo); } @@ -73,7 +73,7 @@ namespace VMAP void operator()(const Vector3& point, uint32 entry) { #ifdef VMAP_DEBUG - TC_LOG_DEBUG(LOG_FILTER_MAPS, "LocationInfoCallback: trying to intersect '%s'", prims[entry].name.c_str()); + TC_LOG_DEBUG("maps", "LocationInfoCallback: trying to intersect '%s'", prims[entry].name.c_str()); #endif if (prims[entry].GetLocationInfo(point, locInfo)) result = true; @@ -278,7 +278,7 @@ namespace VMAP bool StaticMapTree::InitMap(const std::string &fname, VMapManager2* vm) { - VMAP_DEBUG_LOG(LOG_FILTER_MAPS, "StaticMapTree::InitMap() : initializing StaticMapTree '%s'", fname.c_str()); + VMAP_DEBUG_LOG("maps", "StaticMapTree::InitMap() : initializing StaticMapTree '%s'", fname.c_str()); bool success = false; std::string fullname = iBasePath + fname; FILE* rf = fopen(fullname.c_str(), "rb"); @@ -302,12 +302,12 @@ namespace VMAP // only non-tiled maps have them, and if so exactly one (so far at least...) ModelSpawn spawn; #ifdef VMAP_DEBUG - TC_LOG_DEBUG(LOG_FILTER_MAPS, "StaticMapTree::InitMap() : map isTiled: %u", static_cast<uint32>(iIsTiled)); + TC_LOG_DEBUG("maps", "StaticMapTree::InitMap() : map isTiled: %u", static_cast<uint32>(iIsTiled)); #endif if (!iIsTiled && ModelSpawn::readFromFile(rf, spawn)) { WorldModel* model = vm->acquireModelInstance(iBasePath, spawn.name); - VMAP_DEBUG_LOG(LOG_FILTER_MAPS, "StaticMapTree::InitMap() : loading %s", spawn.name.c_str()); + VMAP_DEBUG_LOG("maps", "StaticMapTree::InitMap() : loading %s", spawn.name.c_str()); if (model) { // assume that global model always is the first and only tree value (could be improved...) @@ -317,7 +317,7 @@ namespace VMAP else { success = false; - VMAP_ERROR_LOG(LOG_FILTER_GENERAL, "StaticMapTree::InitMap() : could not acquire WorldModel pointer for '%s'", spawn.name.c_str()); + VMAP_ERROR_LOG("misc", "StaticMapTree::InitMap() : could not acquire WorldModel pointer for '%s'", spawn.name.c_str()); } } @@ -352,7 +352,7 @@ namespace VMAP } if (!iTreeValues) { - VMAP_ERROR_LOG(LOG_FILTER_GENERAL, "StaticMapTree::LoadMapTile() : tree has not been initialized [%u, %u]", tileX, tileY); + VMAP_ERROR_LOG("misc", "StaticMapTree::LoadMapTile() : tree has not been initialized [%u, %u]", tileX, tileY); return false; } bool result = true; @@ -378,7 +378,7 @@ namespace VMAP // acquire model instance WorldModel* model = vm->acquireModelInstance(iBasePath, spawn.name); if (!model) - VMAP_ERROR_LOG(LOG_FILTER_GENERAL, "StaticMapTree::LoadMapTile() : could not acquire WorldModel pointer [%u, %u]", tileX, tileY); + VMAP_ERROR_LOG("misc", "StaticMapTree::LoadMapTile() : could not acquire WorldModel pointer [%u, %u]", tileX, tileY); // update tree uint32 referencedVal; @@ -390,7 +390,7 @@ namespace VMAP #ifdef VMAP_DEBUG if (referencedVal > iNTreeValues) { - TC_LOG_DEBUG(LOG_FILTER_MAPS, "StaticMapTree::LoadMapTile() : invalid tree element (%u/%u)", referencedVal, iNTreeValues); + TC_LOG_DEBUG("maps", "StaticMapTree::LoadMapTile() : invalid tree element (%u/%u)", referencedVal, iNTreeValues); continue; } #endif @@ -402,9 +402,9 @@ namespace VMAP ++iLoadedSpawns[referencedVal]; #ifdef VMAP_DEBUG if (iTreeValues[referencedVal].ID != spawn.ID) - TC_LOG_DEBUG(LOG_FILTER_MAPS, "StaticMapTree::LoadMapTile() : trying to load wrong spawn in node"); + TC_LOG_DEBUG("maps", "StaticMapTree::LoadMapTile() : trying to load wrong spawn in node"); else if (iTreeValues[referencedVal].name != spawn.name) - TC_LOG_DEBUG(LOG_FILTER_MAPS, "StaticMapTree::LoadMapTile() : name collision on GUID=%u", spawn.ID); + TC_LOG_DEBUG("maps", "StaticMapTree::LoadMapTile() : name collision on GUID=%u", spawn.ID); #endif } } @@ -428,7 +428,7 @@ namespace VMAP loadedTileMap::iterator tile = iLoadedTiles.find(tileID); if (tile == iLoadedTiles.end()) { - VMAP_ERROR_LOG(LOG_FILTER_GENERAL, "StaticMapTree::UnloadMapTile() : trying to unload non-loaded tile - Map:%u X:%u Y:%u", iMapID, tileX, tileY); + VMAP_ERROR_LOG("misc", "StaticMapTree::UnloadMapTile() : trying to unload non-loaded tile - Map:%u X:%u Y:%u", iMapID, tileX, tileY); return; } if (tile->second) // file associated with tile @@ -462,7 +462,7 @@ namespace VMAP else { if (!iLoadedSpawns.count(referencedNode)) - VMAP_ERROR_LOG(LOG_FILTER_GENERAL, "StaticMapTree::UnloadMapTile() : trying to unload non-referenced model '%s' (ID:%u)", spawn.name.c_str(), spawn.ID); + VMAP_ERROR_LOG("misc", "StaticMapTree::UnloadMapTile() : trying to unload non-referenced model '%s' (ID:%u)", spawn.name.c_str(), spawn.ID); else if (--iLoadedSpawns[referencedNode] == 0) { iTreeValues[referencedNode].setUnloaded(); diff --git a/src/server/collision/Models/GameObjectModel.cpp b/src/server/collision/Models/GameObjectModel.cpp index fee165ef44a..8bba2cf1b1b 100644 --- a/src/server/collision/Models/GameObjectModel.cpp +++ b/src/server/collision/Models/GameObjectModel.cpp @@ -55,7 +55,7 @@ void LoadGameObjectModelList() FILE* model_list_file = fopen((sWorld->GetDataPath() + "vmaps/" + VMAP::GAMEOBJECT_MODELS).c_str(), "rb"); if (!model_list_file) { - VMAP_ERROR_LOG(LOG_FILTER_GENERAL, "Unable to open '%s' file.", VMAP::GAMEOBJECT_MODELS); + VMAP_ERROR_LOG("misc", "Unable to open '%s' file.", VMAP::GAMEOBJECT_MODELS); return; } @@ -74,7 +74,7 @@ void LoadGameObjectModelList() || fread(&v1, sizeof(Vector3), 1, model_list_file) != 1 || fread(&v2, sizeof(Vector3), 1, model_list_file) != 1) { - VMAP_ERROR_LOG(LOG_FILTER_GENERAL, "File '%s' seems to be corrupted!", VMAP::GAMEOBJECT_MODELS); + VMAP_ERROR_LOG("misc", "File '%s' seems to be corrupted!", VMAP::GAMEOBJECT_MODELS); break; } @@ -85,7 +85,7 @@ void LoadGameObjectModelList() } fclose(model_list_file); - VMAP_INFO_LOG(LOG_FILTER_SERVER_LOADING, ">> Loaded %u GameObject models in %u ms", uint32(model_list.size()), GetMSTimeDiffToNow(oldMSTime)); + VMAP_INFO_LOG("server.loading", ">> Loaded %u GameObject models in %u ms", uint32(model_list.size()), GetMSTimeDiffToNow(oldMSTime)); } GameObjectModel::~GameObjectModel() @@ -104,7 +104,7 @@ bool GameObjectModel::initialize(const GameObject& go, const GameObjectDisplayIn // ignore models with no bounds if (mdl_box == G3D::AABox::zero()) { - VMAP_ERROR_LOG(LOG_FILTER_GENERAL, "GameObject model %s has zero bounds, loading skipped", it->second.name.c_str()); + VMAP_ERROR_LOG("misc", "GameObject model %s has zero bounds, loading skipped", it->second.name.c_str()); return false; } diff --git a/src/server/collision/Models/WorldModel.h b/src/server/collision/Models/WorldModel.h index 23fb1cdb7b6..309b6d8051c 100644 --- a/src/server/collision/Models/WorldModel.h +++ b/src/server/collision/Models/WorldModel.h @@ -36,7 +36,7 @@ namespace VMAP class MeshTriangle { public: - MeshTriangle(){ } + MeshTriangle() : idx0(0), idx1(0), idx2(0) { } MeshTriangle(uint32 na, uint32 nb, uint32 nc): idx0(na), idx1(nb), idx2(nc) { } uint32 idx0; @@ -59,7 +59,7 @@ namespace VMAP bool writeToFile(FILE* wf); static bool readFromFile(FILE* rf, WmoLiquid* &liquid); private: - WmoLiquid(): iHeight(0), iFlags(0) { } + WmoLiquid(): iTilesX(0), iTilesY(0), iType(0), iHeight(0), iFlags(0) { } uint32 iTilesX; //!< number of tiles in x direction, each uint32 iTilesY; G3D::Vector3 iCorner; //!< the lower corner @@ -74,7 +74,7 @@ namespace VMAP class GroupModel { public: - GroupModel(): iLiquid(0) { } + GroupModel(): iMogpFlags(0), iGroupWMOID(0), iLiquid(0) { } GroupModel(const GroupModel &other); GroupModel(uint32 mogpFlags, uint32 groupWMOID, const G3D::AABox &bound): iBound(bound), iMogpFlags(mogpFlags), iGroupWMOID(groupWMOID), iLiquid(0) { } diff --git a/src/server/game/AI/CoreAI/CombatAI.cpp b/src/server/game/AI/CoreAI/CombatAI.cpp index 3ad52aedb34..4f015e3f016 100644 --- a/src/server/game/AI/CoreAI/CombatAI.cpp +++ b/src/server/game/AI/CoreAI/CombatAI.cpp @@ -188,7 +188,7 @@ void CasterAI::UpdateAI(uint32 diff) ArcherAI::ArcherAI(Creature* c) : CreatureAI(c) { if (!me->m_spells[0]) - TC_LOG_ERROR(LOG_FILTER_GENERAL, "ArcherAI set for creature (entry = %u) with spell1=0. AI will do nothing", me->GetEntry()); + TC_LOG_ERROR("misc", "ArcherAI set for creature (entry = %u) with spell1=0. AI will do nothing", me->GetEntry()); SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(me->m_spells[0]); m_minRange = spellInfo ? spellInfo->GetMinRange(false) : 0; @@ -237,7 +237,7 @@ void ArcherAI::UpdateAI(uint32 /*diff*/) TurretAI::TurretAI(Creature* c) : CreatureAI(c) { if (!me->m_spells[0]) - TC_LOG_ERROR(LOG_FILTER_GENERAL, "TurretAI set for creature (entry = %u) with spell1=0. AI will do nothing", me->GetEntry()); + TC_LOG_ERROR("misc", "TurretAI set for creature (entry = %u) with spell1=0. AI will do nothing", me->GetEntry()); SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(me->m_spells[0]); m_minRange = spellInfo ? spellInfo->GetMinRange(false) : 0; @@ -321,7 +321,7 @@ void VehicleAI::LoadConditions() { conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_CREATURE_TEMPLATE_VEHICLE, me->GetEntry()); if (!conditions.empty()) - TC_LOG_DEBUG(LOG_FILTER_CONDITIONSYS, "VehicleAI::LoadConditions: loaded %u conditions", uint32(conditions.size())); + TC_LOG_DEBUG("condition", "VehicleAI::LoadConditions: loaded %u conditions", uint32(conditions.size())); } void VehicleAI::CheckConditions(const uint32 diff) @@ -330,7 +330,7 @@ void VehicleAI::CheckConditions(const uint32 diff) { if (!conditions.empty()) { - if( Vehicle* vehicleKit = me->GetVehicleKit()) + if (Vehicle* vehicleKit = me->GetVehicleKit()) for (SeatMap::iterator itr = vehicleKit->Seats.begin(); itr != vehicleKit->Seats.end(); ++itr) if (Unit* passenger = ObjectAccessor::GetUnit(*me, itr->second.Passenger.Guid)) { diff --git a/src/server/game/AI/CoreAI/CombatAI.h b/src/server/game/AI/CoreAI/CombatAI.h index 16167d1be59..3fac2c78962 100644 --- a/src/server/game/AI/CoreAI/CombatAI.h +++ b/src/server/game/AI/CoreAI/CombatAI.h @@ -72,7 +72,7 @@ struct ArcherAI : public CreatureAI void AttackStart(Unit* who); void UpdateAI(uint32 diff); - static int Permissible(const Creature*); + static int Permissible(Creature const*); protected: float m_minRange; }; @@ -81,11 +81,11 @@ struct TurretAI : public CreatureAI { public: explicit TurretAI(Creature* c); - bool CanAIAttack(const Unit* who) const; + bool CanAIAttack(Unit const* who) const; void AttackStart(Unit* who); void UpdateAI(uint32 diff); - static int Permissible(const Creature*); + static int Permissible(Creature const*); protected: float m_minRange; }; @@ -98,7 +98,7 @@ struct VehicleAI : public CreatureAI explicit VehicleAI(Creature* c); void UpdateAI(uint32 diff); - static int Permissible(const Creature*); + static int Permissible(Creature const*); void Reset(); void MoveInLineOfSight(Unit*) { } void AttackStart(Unit*) { } diff --git a/src/server/game/AI/CoreAI/GuardAI.cpp b/src/server/game/AI/CoreAI/GuardAI.cpp index 188ad4fb450..c38be3aa22a 100644 --- a/src/server/game/AI/CoreAI/GuardAI.cpp +++ b/src/server/game/AI/CoreAI/GuardAI.cpp @@ -56,7 +56,7 @@ void GuardAI::EnterEvadeMode() return; } - TC_LOG_DEBUG(LOG_FILTER_UNITS, "Guard entry: %u enters evade mode.", me->GetEntry()); + TC_LOG_DEBUG("entities.unit", "Guard entry: %u enters evade mode.", me->GetEntry()); me->RemoveAllAuras(); me->DeleteThreatList(); diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp index 4d657ec2b2b..18daf1ef8de 100644 --- a/src/server/game/AI/CoreAI/PetAI.cpp +++ b/src/server/game/AI/CoreAI/PetAI.cpp @@ -56,7 +56,7 @@ void PetAI::_stopAttack() { if (!me->IsAlive()) { - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "Creature stoped attacking cuz his dead [guid=%u]", me->GetGUIDLow()); + TC_LOG_DEBUG("misc", "Creature stoped attacking cuz his dead [guid=%u]", me->GetGUIDLow()); me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveIdle(); me->CombatStop(); @@ -97,7 +97,7 @@ void PetAI::UpdateAI(uint32 diff) if (_needToStop()) { - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "Pet AI stopped attacking [guid=%u]", me->GetGUIDLow()); + TC_LOG_DEBUG("misc", "Pet AI stopped attacking [guid=%u]", me->GetGUIDLow()); _stopAttack(); return; } @@ -409,7 +409,7 @@ Unit* PetAI::SelectNextTarget(bool allowAutoSelect) const if (me->HasReactState(REACT_AGGRESSIVE) && allowAutoSelect) { if (!me->GetCharmInfo()->IsReturning() || me->GetCharmInfo()->IsFollowing() || me->GetCharmInfo()->IsAtStay()) - if (Unit* nearTarget = me->ToCreature()->SelectNearestHostileUnitInAggroRange(true)) + if (Unit* nearTarget = me->SelectNearestHostileUnitInAggroRange(true)) return nearTarget; } diff --git a/src/server/game/AI/CoreAI/PetAI.h b/src/server/game/AI/CoreAI/PetAI.h index 9cce00440e1..6e24a079f9f 100644 --- a/src/server/game/AI/CoreAI/PetAI.h +++ b/src/server/game/AI/CoreAI/PetAI.h @@ -57,7 +57,6 @@ class PetAI : public CreatureAI void UpdateAllies(); TimeTracker i_tracker; - bool inCombat; std::set<uint64> m_AllySet; uint32 m_updateAlliesTimer; diff --git a/src/server/game/AI/CoreAI/TotemAI.cpp b/src/server/game/AI/CoreAI/TotemAI.cpp index 03ba024384f..6f8452176e5 100644 --- a/src/server/game/AI/CoreAI/TotemAI.cpp +++ b/src/server/game/AI/CoreAI/TotemAI.cpp @@ -104,6 +104,6 @@ void TotemAI::AttackStart(Unit* /*victim*/) data << me->GetGUID(); data << me->GetPositionX(); data << me->GetPositionY(); - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(&data); } } diff --git a/src/server/game/AI/CoreAI/UnitAI.cpp b/src/server/game/AI/CoreAI/UnitAI.cpp index 9abdf9e8cfc..1b6cdee737c 100644 --- a/src/server/game/AI/CoreAI/UnitAI.cpp +++ b/src/server/game/AI/CoreAI/UnitAI.cpp @@ -28,6 +28,7 @@ void UnitAI::AttackStart(Unit* victim) { + if (victim && me->Attack(victim, true)) me->GetMotionMaster()->MoveChase(victim); } @@ -44,14 +45,18 @@ void UnitAI::DoMeleeAttackIfReady() return; Unit* victim = me->GetVictim(); + + if (!me->IsWithinMeleeRange(victim)) + return; + //Make sure our attack is ready and we aren't currently casting before checking distance - if (me->isAttackReady() && me->IsWithinMeleeRange(victim)) + if (me->isAttackReady()) { me->AttackerStateUpdate(victim); me->resetAttackTimer(); } - if (me->haveOffhandWeapon() && me->isAttackReady(OFF_ATTACK) && me->IsWithinMeleeRange(victim)) + if (me->haveOffhandWeapon() && me->isAttackReady(OFF_ATTACK)) { me->AttackerStateUpdate(victim, OFF_ATTACK); me->resetAttackTimer(OFF_ATTACK); diff --git a/src/server/game/AI/CoreAI/UnitAI.h b/src/server/game/AI/CoreAI/UnitAI.h index 71fc86f112b..33a09fd03b0 100644 --- a/src/server/game/AI/CoreAI/UnitAI.h +++ b/src/server/game/AI/CoreAI/UnitAI.h @@ -26,7 +26,6 @@ class Player; class Quest; -class Unit; struct AISpellInfoType; //Selection method used by SelectTarget @@ -142,9 +141,9 @@ class UnitAI virtual uint64 GetGUID(int32 /*id*/ = 0) const { return 0; } Unit* SelectTarget(SelectAggroTarget targetType, uint32 position = 0, float dist = 0.0f, bool playerOnly = false, int32 aura = 0); - // Select the targets satifying the predicate. + // Select the targets satisfying the predicate. // predicate shall extend std::unary_function<Unit*, bool> - template <class PREDICATE> Unit* SelectTarget(SelectAggroTarget targetType, uint32 position, PREDICATE const& predicate) + template<class PREDICATE> Unit* SelectTarget(SelectAggroTarget targetType, uint32 position, PREDICATE const& predicate) { ThreatContainer::StorageType const& threatlist = me->getThreatManager().getThreatList(); if (position >= threatlist.size()) diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp index 75a1488ed45..2ec0e4ff3ca 100644 --- a/src/server/game/AI/CreatureAI.cpp +++ b/src/server/game/AI/CreatureAI.cpp @@ -54,7 +54,7 @@ void CreatureAI::DoZoneInCombat(Creature* creature /*= NULL*/, float maxRangeToN Map* map = creature->GetMap(); if (!map->IsDungeon()) //use IsDungeon instead of Instanceable, in case battlegrounds will be instantiated { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "DoZoneInCombat call for map that isn't an instance (creature entry = %d)", creature->GetTypeId() == TYPEID_UNIT ? creature->ToCreature()->GetEntry() : 0); + TC_LOG_ERROR("misc", "DoZoneInCombat call for map that isn't an instance (creature entry = %d)", creature->GetTypeId() == TYPEID_UNIT ? creature->ToCreature()->GetEntry() : 0); return; } @@ -79,7 +79,7 @@ void CreatureAI::DoZoneInCombat(Creature* creature /*= NULL*/, float maxRangeToN // If it can't find a suitable attack target then we should error out. if (!creature->HasReactState(REACT_PASSIVE) && !creature->GetVictim()) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "DoZoneInCombat called for creature that has empty threat list (creature entry = %u)", creature->GetEntry()); + TC_LOG_ERROR("misc", "DoZoneInCombat called for creature that has empty threat list (creature entry = %u)", creature->GetEntry()); return; } @@ -145,7 +145,7 @@ void CreatureAI::EnterEvadeMode() if (!_EnterEvadeMode()) return; - TC_LOG_DEBUG(LOG_FILTER_UNITS, "Creature %u enters evade mode.", me->GetEntry()); + TC_LOG_DEBUG("entities.unit", "Creature %u enters evade mode.", me->GetEntry()); if (!me->GetVehicle()) // otherwise me will be in evade mode forever { diff --git a/src/server/game/AI/CreatureAIFactory.h b/src/server/game/AI/CreatureAIFactory.h index 30576cf28bd..809c17cadb8 100644 --- a/src/server/game/AI/CreatureAIFactory.h +++ b/src/server/game/AI/CreatureAIFactory.h @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License along * with this program. If not, see <http://www.gnu.org/licenses/>. */ + #ifndef TRINITY_CREATUREAIFACTORY_H #define TRINITY_CREATUREAIFACTORY_H diff --git a/src/server/game/AI/CreatureAIRegistry.cpp b/src/server/game/AI/CreatureAIRegistry.cpp index 8f035667a34..8b74db24a42 100644 --- a/src/server/game/AI/CreatureAIRegistry.cpp +++ b/src/server/game/AI/CreatureAIRegistry.cpp @@ -22,7 +22,6 @@ #include "GuardAI.h" #include "PetAI.h" #include "TotemAI.h" -#include "CreatureEventAI.h" #include "RandomMovementGenerator.h" #include "MovementGeneratorImpl.h" #include "CreatureAIRegistry.h" @@ -46,7 +45,6 @@ namespace AIRegistry (new CreatureAIFactory<CombatAI>("CombatAI"))->RegisterSelf(); (new CreatureAIFactory<ArcherAI>("ArcherAI"))->RegisterSelf(); (new CreatureAIFactory<TurretAI>("TurretAI"))->RegisterSelf(); - (new CreatureAIFactory<CreatureEventAI>("EventAI"))->RegisterSelf(); (new CreatureAIFactory<VehicleAI>("VehicleAI"))->RegisterSelf(); (new CreatureAIFactory<SmartAI>("SmartAI"))->RegisterSelf(); diff --git a/src/server/game/AI/CreatureAISelector.cpp b/src/server/game/AI/CreatureAISelector.cpp index 203ee37edb3..597ad24d4e1 100644 --- a/src/server/game/AI/CreatureAISelector.cpp +++ b/src/server/game/AI/CreatureAISelector.cpp @@ -95,7 +95,7 @@ namespace FactorySelector // select NullCreatureAI if not another cases ainame = (ai_factory == NULL) ? "NullCreatureAI" : ai_factory->key(); - TC_LOG_DEBUG(LOG_FILTER_TSCR, "Creature %s (Entry: %u GUID: %u DB GUID: %u) is using AI type: %s.", creature->GetName().c_str(), creature->GetEntry(), creature->GetGUIDLow(), creature->GetDBTableGUIDLow(), ainame.c_str()); + TC_LOG_DEBUG("scripts", "Creature %s (Entry: %u GUID: %u DB GUID: %u) is using AI type: %s.", creature->GetName().c_str(), creature->GetEntry(), creature->GetGUIDLow(), creature->GetDBTableGUIDLow(), ainame.c_str()); return (ai_factory == NULL ? new NullCreatureAI(creature) : ai_factory->Create(creature)); } @@ -142,9 +142,8 @@ namespace FactorySelector std::string ainame = (ai_factory == NULL || go->GetScriptId()) ? "NullGameObjectAI" : ai_factory->key(); - TC_LOG_DEBUG(LOG_FILTER_TSCR, "GameObject %u used AI is %s.", go->GetGUIDLow(), ainame.c_str()); + TC_LOG_DEBUG("scripts", "GameObject %u used AI is %s.", go->GetGUIDLow(), ainame.c_str()); return (ai_factory == NULL ? new NullGameObjectAI(go) : ai_factory->Create(go)); } } - diff --git a/src/server/game/AI/EventAI/CreatureEventAI.cpp b/src/server/game/AI/EventAI/CreatureEventAI.cpp deleted file mode 100644 index c7180836040..00000000000 --- a/src/server/game/AI/EventAI/CreatureEventAI.cpp +++ /dev/null @@ -1,1327 +0,0 @@ -/* - * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> - * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "Common.h" -#include "CreatureEventAI.h" -#include "CreatureEventAIMgr.h" -#include "ObjectMgr.h" -#include "Spell.h" -#include "World.h" -#include "Cell.h" -#include "CellImpl.h" -#include "GameEventMgr.h" -#include "GridNotifiers.h" -#include "GridNotifiersImpl.h" -#include "InstanceScript.h" -#include "SpellMgr.h" -#include "CreatureAIImpl.h" -#include "ConditionMgr.h" - -bool CreatureEventAIHolder::UpdateRepeatTimer(Creature* creature, uint32 repeatMin, uint32 repeatMax) -{ - if (repeatMin == repeatMax) - Time = repeatMin; - else if (repeatMax > repeatMin) - Time = urand(repeatMin, repeatMax); - else - { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Creature %u using Event %u (Type = %u) has RandomMax < RandomMin. Event repeating disabled.", creature->GetEntry(), Event.event_id, Event.event_type); - Enabled = false; - return false; - } - - return true; -} - -int CreatureEventAI::Permissible(const Creature* creature) -{ - if (creature->GetAIName() == "EventAI") - return PERMIT_BASE_SPECIAL; - return PERMIT_BASE_NO; -} - -CreatureEventAI::CreatureEventAI(Creature* c) : CreatureAI(c) -{ - // Need make copy for filter unneeded steps and safe in case table reload - CreatureEventAI_Event_Map::const_iterator CreatureEvents = sEventAIMgr->GetCreatureEventAIMap().find(me->GetEntry()); - if (CreatureEvents != sEventAIMgr->GetCreatureEventAIMap().end()) - { - std::vector<CreatureEventAI_Event>::const_iterator i; - for (i = (*CreatureEvents).second.begin(); i != (*CreatureEvents).second.end(); ++i) - { - //Debug check - #ifndef TRINITY_DEBUG - if ((*i).event_flags & EFLAG_DEBUG_ONLY) - continue; - #endif - if (me->GetMap()->IsDungeon()) - { - if ((1 << (me->GetMap()->GetSpawnMode()+1)) & (*i).event_flags) - { - //event flagged for instance mode - m_CreatureEventAIList.push_back(CreatureEventAIHolder(*i)); - } - continue; - } - m_CreatureEventAIList.push_back(CreatureEventAIHolder(*i)); - } - //EventMap had events but they were not added because they must be for instance - if (m_CreatureEventAIList.empty()) - TC_LOG_ERROR(LOG_FILTER_GENERAL, "CreatureEventAI: Creature %u has events but no events added to list because of instance flags.", me->GetEntry()); - } - else - TC_LOG_ERROR(LOG_FILTER_GENERAL, "CreatureEventAI: EventMap for Creature %u is empty but creature is using CreatureEventAI.", me->GetEntry()); - - m_bEmptyList = m_CreatureEventAIList.empty(); - m_Phase = 0; - m_CombatMovementEnabled = true; - m_MeleeEnabled = true; - m_AttackDistance = 0.0f; - m_AttackAngle = 0.0f; - - m_InvincibilityHpLevel = 0; - - //Handle Spawned Events - if (!m_bEmptyList) - { - for (CreatureEventAIList::iterator i = m_CreatureEventAIList.begin(); i != m_CreatureEventAIList.end(); ++i) - if (SpawnedEventConditionsCheck((*i).Event)) - ProcessEvent(*i); - } -} - -bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& holder, Unit* actionInvoker /*=NULL*/) -{ - if (!holder.Enabled || holder.Time) - return false; - - //Check the inverse phase mask (event doesn't trigger if current phase bit is set in mask) - if (holder.Event.event_inverse_phase_mask & (1 << m_Phase)) - return false; - - CreatureEventAI_Event const& event = holder.Event; - - //Check event conditions based on the event type, also reset events - switch (event.event_type) - { - case EVENT_T_TIMER: - if (!me->IsInCombat()) - return false; - - //Repeat Timers - holder.UpdateRepeatTimer(me, event.timer.repeatMin, event.timer.repeatMax); - break; - case EVENT_T_TIMER_OOC: - if (me->IsInCombat()) - return false; - - //Repeat Timers - holder.UpdateRepeatTimer(me, event.timer.repeatMin, event.timer.repeatMax); - break; - case EVENT_T_HP: - { - if (!me->IsInCombat() || !me->GetMaxHealth()) - return false; - - uint32 perc = uint32(me->GetHealthPct()); - - if (perc > event.percent_range.percentMax || perc < event.percent_range.percentMin) - return false; - - //Repeat Timers - holder.UpdateRepeatTimer(me, event.percent_range.repeatMin, event.percent_range.repeatMax); - break; - } - case EVENT_T_MANA: - { - if (!me->IsInCombat() || !me->GetMaxPower(POWER_MANA)) - return false; - - uint32 perc = (me->GetPower(POWER_MANA)*100) / me->GetMaxPower(POWER_MANA); - - if (perc > event.percent_range.percentMax || perc < event.percent_range.percentMin) - return false; - - //Repeat Timers - holder.UpdateRepeatTimer(me, event.percent_range.repeatMin, event.percent_range.repeatMax); - break; - } - case EVENT_T_AGGRO: - break; - case EVENT_T_KILL: - //Repeat Timers - holder.UpdateRepeatTimer(me, event.kill.repeatMin, event.kill.repeatMax); - break; - case EVENT_T_DEATH: - case EVENT_T_EVADE: - break; - case EVENT_T_SPELLHIT: - //Spell hit is special case, param1 and param2 handled within CreatureEventAI::SpellHit - - //Repeat Timers - holder.UpdateRepeatTimer(me, event.spell_hit.repeatMin, event.spell_hit.repeatMax); - break; - case EVENT_T_RANGE: - //Repeat Timers - holder.UpdateRepeatTimer(me, event.range.repeatMin, event.range.repeatMax); - break; - case EVENT_T_OOC_LOS: - //Repeat Timers - holder.UpdateRepeatTimer(me, event.ooc_los.repeatMin, event.ooc_los.repeatMax); - break; - case EVENT_T_RESET: - case EVENT_T_SPAWNED: - break; - case EVENT_T_TARGET_HP: - { - if (!me->IsInCombat() || !me->GetVictim() || !me->GetVictim()->GetMaxHealth()) - return false; - - uint32 perc = uint32(me->GetVictim()->GetHealthPct()); - - if (perc > event.percent_range.percentMax || perc < event.percent_range.percentMin) - return false; - - //Repeat Timers - holder.UpdateRepeatTimer(me, event.percent_range.repeatMin, event.percent_range.repeatMax); - break; - } - case EVENT_T_TARGET_CASTING: - if (!me->IsInCombat() || !me->GetVictim() || !me->GetVictim()->IsNonMeleeSpellCasted(false, false, true)) - return false; - - //Repeat Timers - holder.UpdateRepeatTimer(me, event.target_casting.repeatMin, event.target_casting.repeatMax); - break; - case EVENT_T_FRIENDLY_HP: - { - if (!me->IsInCombat()) - return false; - - Unit* unit = DoSelectLowestHpFriendly((float)event.friendly_hp.radius, event.friendly_hp.hpDeficit); - if (!unit) - return false; - - actionInvoker = unit; - - //Repeat Timers - holder.UpdateRepeatTimer(me, event.friendly_hp.repeatMin, event.friendly_hp.repeatMax); - break; - } - case EVENT_T_FRIENDLY_IS_CC: - { - if (!me->IsInCombat()) - return false; - - std::list<Creature*> pList; - DoFindFriendlyCC(pList, (float)event.friendly_is_cc.radius); - - //List is empty - if (pList.empty()) - return false; - - //We don't really care about the whole list, just return first available - actionInvoker = *(pList.begin()); - - //Repeat Timers - holder.UpdateRepeatTimer(me, event.friendly_is_cc.repeatMin, event.friendly_is_cc.repeatMax); - break; - } - case EVENT_T_FRIENDLY_MISSING_BUFF: - { - std::list<Creature*> pList; - DoFindFriendlyMissingBuff(pList, (float)event.friendly_buff.radius, event.friendly_buff.spellId); - - //List is empty - if (pList.empty()) - return false; - - //We don't really care about the whole list, just return first available - actionInvoker = *(pList.begin()); - - //Repeat Timers - holder.UpdateRepeatTimer(me, event.friendly_buff.repeatMin, event.friendly_buff.repeatMax); - break; - } - case EVENT_T_SUMMONED_UNIT: - { - //Prevent event from occuring on no unit or non creatures - if (!actionInvoker || actionInvoker->GetTypeId() != TYPEID_UNIT) - return false; - - //Creature id doesn't match up - if (actionInvoker->ToCreature()->GetEntry() != event.summon_unit.creatureId) - return false; - - //Repeat Timers - holder.UpdateRepeatTimer(me, event.summon_unit.repeatMin, event.summon_unit.repeatMax); - break; - } - case EVENT_T_TARGET_MANA: - { - if (!me->IsInCombat() || !me->GetVictim() || !me->GetVictim()->GetMaxPower(POWER_MANA)) - return false; - - uint32 perc = (me->GetVictim()->GetPower(POWER_MANA)*100) / me->GetVictim()->GetMaxPower(POWER_MANA); - - if (perc > event.percent_range.percentMax || perc < event.percent_range.percentMin) - return false; - - //Repeat Timers - holder.UpdateRepeatTimer(me, event.percent_range.repeatMin, event.percent_range.repeatMax); - break; - } - case EVENT_T_REACHED_HOME: - case EVENT_T_RECEIVE_EMOTE: - break; - case EVENT_T_BUFFED: - { - //Note: checked only aura for effect 0, if need check aura for effect 1/2 then - // possible way: pack in event.buffed.amount 2 uint16 (ammount+effectIdx) - Aura const* aura = me->GetAura(event.buffed.spellId); - if (!aura || aura->GetStackAmount() < event.buffed.amount) - return false; - - //Repeat Timers - holder.UpdateRepeatTimer(me, event.buffed.repeatMin, event.buffed.repeatMax); - break; - } - case EVENT_T_TARGET_BUFFED: - { - //Prevent event from occuring on no unit - if (!actionInvoker) - return false; - - //Note: checked only aura for effect 0, if need check aura for effect 1/2 then - // possible way: pack in event.buffed.amount 2 uint16 (ammount+effectIdx) - Aura const* aura = actionInvoker->GetAura(event.buffed.spellId); - if (!aura || aura->GetStackAmount() < event.buffed.amount) - return false; - - //Repeat Timers - holder.UpdateRepeatTimer(me, event.buffed.repeatMin, event.buffed.repeatMax); - break; - } - default: - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Creature %u using Event %u has invalid Event Type(%u), missing from ProcessEvent() Switch.", me->GetEntry(), holder.Event.event_id, holder.Event.event_type); - break; - } - - //Disable non-repeatable events - if (!(holder.Event.event_flags & EFLAG_REPEATABLE)) - holder.Enabled = false; - - //Store random here so that all random actions match up - uint32 rnd = rand(); - - //Return if chance for event is not met - if (holder.Event.event_chance <= rnd % 100) - return false; - - //Process actions - for (uint8 j = 0; j < MAX_ACTIONS; ++j) - ProcessAction(holder.Event.action[j], rnd, holder.Event.event_id, actionInvoker); - - return true; -} - -void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 rnd, uint32 eventId, Unit* actionInvoker) -{ - switch (action.type) - { - case ACTION_T_TEXT: - { - if (!action.text.TextId1) - return; - - int32 temp = action.text.TextId1; - - if (action.text.TextId2 && action.text.TextId3) - temp = RAND(action.text.TextId1, action.text.TextId2, action.text.TextId3); - else if (action.text.TextId2 && urand(0, 1)) - temp = action.text.TextId2; - - if (temp) - { - Unit* target = NULL; - - if (actionInvoker) - { - if (actionInvoker->GetTypeId() == TYPEID_PLAYER) - target = actionInvoker; - else if (Unit* owner = actionInvoker->GetOwner()) - { - if (owner->GetTypeId() == TYPEID_PLAYER) - target = owner; - } - } - else - { - target = me->GetVictim(); - if (target && target->GetTypeId() != TYPEID_PLAYER) - if (Unit* owner = target->GetOwner()) - if (owner->GetTypeId() == TYPEID_PLAYER) - target = owner; - } - - DoScriptText(temp, me, target); - } - break; - } - case ACTION_T_SET_FACTION: - { - if (action.set_faction.factionId) - me->setFaction(action.set_faction.factionId); - else - { - if (CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(me->GetEntry())) - { - //if no id provided, assume reset and then use default - if (me->getFaction() != ci->faction_A) - me->setFaction(ci->faction_A); - } - } - break; - } - case ACTION_T_MORPH_TO_ENTRY_OR_MODEL: - { - if (action.morph.creatureId || action.morph.modelId) - { - //set model based on entry from creature_template - if (action.morph.creatureId) - { - if (CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(action.morph.creatureId)) - me->SetDisplayId(ObjectMgr::ChooseDisplayId(ci)); - } - //if no param1, then use value from param2 (modelId) - else - me->SetDisplayId(action.morph.modelId); - } - else - me->DeMorph(); - break; - } - case ACTION_T_SOUND: - me->PlayDirectSound(action.sound.soundId); - break; - case ACTION_T_EMOTE: - me->HandleEmoteCommand(action.emote.emoteId); - break; - case ACTION_T_RANDOM_SOUND: - { - int32 temp = GetRandActionParam(rnd, action.random_sound.soundId1, action.random_sound.soundId2, action.random_sound.soundId3); - if (temp >= 0) - me->PlayDirectSound(temp); - break; - } - case ACTION_T_RANDOM_EMOTE: - { - int32 temp = GetRandActionParam(rnd, action.random_emote.emoteId1, action.random_emote.emoteId2, action.random_emote.emoteId3); - if (temp >= 0) - me->HandleEmoteCommand(temp); - break; - } - case ACTION_T_CAST: - { - Unit* target = GetTargetByType(action.cast.target, actionInvoker); - Unit* caster = me; - - if (!target) - return; - - if (action.cast.castFlags & CAST_FORCE_TARGET_SELF) - caster = target; - - //Allowed to cast only if not casting (unless we interrupt ourself) or if spell is triggered - bool canCast = !caster->IsNonMeleeSpellCasted(false) || (action.cast.castFlags & (CAST_TRIGGERED | CAST_INTERRUPT_PREVIOUS)); - - // If cast flag CAST_AURA_NOT_PRESENT is active, check if target already has aura on them - if (action.cast.castFlags & CAST_AURA_NOT_PRESENT) - { - if (target->HasAura(action.cast.spellId)) - return; - } - - if (canCast) - { - const SpellInfo* tSpell = sSpellMgr->GetSpellInfo(action.cast.spellId); - - //Verify that spell exists - if (tSpell) - { - //Check if cannot cast spell - if (!(action.cast.castFlags & (CAST_FORCE_TARGET_SELF | CAST_FORCE_CAST)) && - !CanCast(target, tSpell, (action.cast.castFlags & CAST_TRIGGERED))) - { - //Melee current victim if flag not set - if (!(action.cast.castFlags & CAST_NO_MELEE_IF_OOM)) - { - if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE) - { - m_AttackDistance = 0.0f; - m_AttackAngle = 0.0f; - - me->GetMotionMaster()->MoveChase(me->GetVictim(), m_AttackDistance, m_AttackAngle); - } - } - } - else - { - //Interrupt any previous spell - if (caster->IsNonMeleeSpellCasted(false) && action.cast.castFlags & CAST_INTERRUPT_PREVIOUS) - caster->InterruptNonMeleeSpells(false); - - caster->CastSpell(target, action.cast.spellId, (action.cast.castFlags & CAST_TRIGGERED)); - } - } - else - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: event %d creature %d attempt to cast spell that doesn't exist %d", eventId, me->GetEntry(), action.cast.spellId); - } - break; - } - case ACTION_T_THREAT_SINGLE_PCT: - if (Unit* target = GetTargetByType(action.threat_single_pct.target, actionInvoker)) - me->getThreatManager().modifyThreatPercent(target, action.threat_single_pct.percent); - break; - case ACTION_T_THREAT_ALL_PCT: - { - ThreatContainer::StorageType const& threatList = me->getThreatManager().getThreatList(); - for (ThreatContainer::StorageType::const_iterator i = threatList.begin(); i != threatList.end(); ++i) - if (Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid())) - me->getThreatManager().modifyThreatPercent(unit, action.threat_all_pct.percent); - break; - } - case ACTION_T_QUEST_EVENT: - if (Unit* target = GetTargetByType(action.quest_event.target, actionInvoker)) - if (target->GetTypeId() == TYPEID_PLAYER) - target->ToPlayer()->AreaExploredOrEventHappens(action.quest_event.questId); - break; - case ACTION_T_SET_UNIT_FIELD: - { - Unit* target = GetTargetByType(action.set_unit_field.target, actionInvoker); - - // not allow modify important for integrity object fields - if (action.set_unit_field.field < OBJECT_END || action.set_unit_field.field >= UNIT_END) - return; - - if (target) - target->SetUInt32Value(action.set_unit_field.field, action.set_unit_field.value); - - break; - } - case ACTION_T_SET_UNIT_FLAG: - if (Unit* target = GetTargetByType(action.unit_flag.target, actionInvoker)) - target->SetFlag(UNIT_FIELD_FLAGS, action.unit_flag.value); - break; - case ACTION_T_REMOVE_UNIT_FLAG: - if (Unit* target = GetTargetByType(action.unit_flag.target, actionInvoker)) - target->RemoveFlag(UNIT_FIELD_FLAGS, action.unit_flag.value); - break; - case ACTION_T_AUTO_ATTACK: - m_MeleeEnabled = action.auto_attack.state != 0; - break; - case ACTION_T_COMBAT_MOVEMENT: - // ignore no affect case - if (m_CombatMovementEnabled == (action.combat_movement.state != 0)) - return; - - m_CombatMovementEnabled = action.combat_movement.state != 0; - - //Allow movement (create new targeted movement gen only if idle) - if (m_CombatMovementEnabled) - { - Unit* victim = me->GetVictim(); - if (me->IsInCombat() && victim) - { - if (action.combat_movement.melee) - { - me->AddUnitState(UNIT_STATE_MELEE_ATTACKING); - me->SendMeleeAttackStart(victim); - } - if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == IDLE_MOTION_TYPE) - me->GetMotionMaster()->MoveChase(victim, m_AttackDistance, m_AttackAngle); // Targeted movement generator will start melee automatically, no need to send it explicitly - } - } - else - { - if (me->IsInCombat()) - { - Unit* victim = me->GetVictim(); - if (action.combat_movement.melee && victim) - { - me->ClearUnitState(UNIT_STATE_MELEE_ATTACKING); - me->SendMeleeAttackStop(victim); - } - if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE) - me->GetMotionMaster()->MoveIdle(); - } - } - break; - case ACTION_T_SET_PHASE: - m_Phase = action.set_phase.phase; - break; - case ACTION_T_INC_PHASE: - { - int32 new_phase = int32(m_Phase)+action.set_inc_phase.step; - if (new_phase < 0) - { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %d decrease m_Phase under 0. CreatureEntry = %d", eventId, me->GetEntry()); - m_Phase = 0; - } - else if (new_phase >= MAX_PHASE) - { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %d incremented m_Phase above %u. m_Phase mask cannot be used with phases past %u. CreatureEntry = %d", eventId, MAX_PHASE-1, MAX_PHASE-1, me->GetEntry()); - m_Phase = MAX_PHASE-1; - } - else - m_Phase = new_phase; - - break; - } - case ACTION_T_EVADE: - EnterEvadeMode(); - break; - case ACTION_T_FLEE_FOR_ASSIST: - me->DoFleeToGetAssistance(); - break; - case ACTION_T_QUEST_EVENT_ALL: - if (actionInvoker && actionInvoker->GetTypeId() == TYPEID_PLAYER) - { - if (Unit* Temp = Unit::GetUnit(*me, actionInvoker->GetGUID())) - if (Temp->GetTypeId() == TYPEID_PLAYER) - Temp->ToPlayer()->GroupEventHappens(action.quest_event_all.questId, me); - } - break; - case ACTION_T_REMOVEAURASFROMSPELL: - if (Unit* target = GetTargetByType(action.remove_aura.target, actionInvoker)) - target->RemoveAurasDueToSpell(action.remove_aura.spellId); - break; - case ACTION_T_RANGED_MOVEMENT: - m_AttackDistance = (float)action.ranged_movement.distance; - m_AttackAngle = action.ranged_movement.angle/180.0f*M_PI; - - if (m_CombatMovementEnabled) - { - me->GetMotionMaster()->MoveChase(me->GetVictim(), m_AttackDistance, m_AttackAngle); - } - break; - case ACTION_T_RANDOM_PHASE: - m_Phase = GetRandActionParam(rnd, action.random_phase.phase1, action.random_phase.phase2, action.random_phase.phase3); - break; - case ACTION_T_RANDOM_PHASE_RANGE: - if (action.random_phase_range.phaseMin <= action.random_phase_range.phaseMax) - m_Phase = urand(action.random_phase_range.phaseMin, action.random_phase_range.phaseMax); - else - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: ACTION_T_RANDOM_PHASE_RANGE cannot have Param2 < Param1. Event = %d. CreatureEntry = %d", eventId, me->GetEntry()); - break; - case ACTION_T_KILLED_MONSTER: - //first attempt player who tapped creature - if (Player* player = me->GetLootRecipient()) - player->RewardPlayerAndGroupAtEvent(action.killed_monster.creatureId, player); // player as param is a hacky solution not to use GUID - else - { - //if not available, use actionInvoker - if (Unit* target = GetTargetByType(action.killed_monster.target, actionInvoker)) - if (Player* player2 = target->GetCharmerOrOwnerPlayerOrPlayerItself()) - player2->RewardPlayerAndGroupAtEvent(action.killed_monster.creatureId, player2); - } - break; - case ACTION_T_SET_INST_DATA: - { - InstanceScript* instance = me->GetInstanceScript(); - if (!instance) - { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %d attempt to set instance data without instance script. Creature %d", eventId, me->GetEntry()); - return; - } - - instance->SetData(action.set_inst_data.field, action.set_inst_data.value); - break; - } - case ACTION_T_SET_INST_DATA64: - { - Unit* target = GetTargetByType(action.set_inst_data64.target, actionInvoker); - if (!target) - { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %d attempt to set instance data64 but Target == NULL. Creature %d", eventId, me->GetEntry()); - return; - } - - InstanceScript* instance = me->GetInstanceScript(); - if (!instance) - { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %d attempt to set instance data64 without instance script. Creature %d", eventId, me->GetEntry()); - return; - } - - instance->SetData64(action.set_inst_data64.field, target->GetGUID()); - break; - } - case ACTION_T_UPDATE_TEMPLATE: - if (me->GetEntry() == action.update_template.creatureId) - { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %d ACTION_T_UPDATE_TEMPLATE call with param1 == current entry. Creature %d", eventId, me->GetEntry()); - return; - } - - me->UpdateEntry(action.update_template.creatureId, action.update_template.team ? HORDE : ALLIANCE); - break; - case ACTION_T_DIE: - if (me->isDead()) - { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %d ACTION_T_DIE on dead creature. Creature %d", eventId, me->GetEntry()); - return; - } - me->Kill(me); - break; - case ACTION_T_ZONE_COMBAT_PULSE: - { - me->SetInCombatWithZone(); - break; - } - case ACTION_T_CALL_FOR_HELP: - { - me->CallForHelp((float)action.call_for_help.radius); - break; - } - break; - - // TRINITY ONLY - case ACTION_T_MOVE_RANDOM_POINT: //dosen't work in combat - { - float x, y, z; - me->GetClosePoint(x, y, z, me->GetObjectSize() / 3, (float)action.raw.param1); - me->GetMotionMaster()->MovePoint(0, x, y, z); - break; - } - case ACTION_T_SET_STAND_STATE: - me->SetStandState(UnitStandStateType(action.raw.param1)); - break; - case ACTION_T_SET_PHASE_MASK: - me->SetPhaseMask(action.raw.param1, true); - break; - case ACTION_T_SET_VISIBILITY: - me->SetVisible(bool(action.raw.param1)); - break; - case ACTION_T_SET_ACTIVE: - me->setActive(action.raw.param1 ? true : false); - break; - case ACTION_T_SET_AGGRESSIVE: - me->SetReactState(ReactStates(action.raw.param1)); - break; - case ACTION_T_ATTACK_START_PULSE: - AttackStart(me->SelectNearestTarget((float)action.raw.param1)); - break; - case ACTION_T_SUMMON_GO: - { - float x, y, z; - me->GetPosition(x, y, z); - GameObject* object = me->SummonGameObject(action.raw.param1, x, y, z, 0, 0, 0, 0, 0, action.raw.param2); - if (!object) - TC_LOG_ERROR(LOG_FILTER_TSCR, "EventAI failed to spawn object %u. Spawn event %d is on creature %d", action.raw.param1, eventId, me->GetEntry()); - - break; - } - case ACTION_T_SET_SHEATH: - { - me->SetSheath(SheathState(action.set_sheath.sheath)); - break; - } - case ACTION_T_FORCE_DESPAWN: - { - me->DespawnOrUnsummon(action.forced_despawn.msDelay); - break; - } - case ACTION_T_SET_INVINCIBILITY_HP_LEVEL: - { - if (action.invincibility_hp_level.is_percent) - m_InvincibilityHpLevel = me->CountPctFromMaxHealth(action.invincibility_hp_level.hp_level); - else - m_InvincibilityHpLevel = action.invincibility_hp_level.hp_level; - break; - } - case ACTION_T_MOUNT_TO_ENTRY_OR_MODEL: - { - if (action.mount.creatureId || action.mount.modelId) - { - // set model based on entry from creature_template - if (action.mount.creatureId) - { - if (CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(action.mount.creatureId)) - me->Mount(ObjectMgr::ChooseDisplayId(cInfo)); - } - //if no param1, then use value from param2 (modelId) - else - me->Mount(action.mount.modelId); - } - else - me->Dismount(); - - break; - } - default: - break; - } -} - -void CreatureEventAI::JustRespawned() -{ - Reset(); - - if (m_bEmptyList) - return; - - //Handle Spawned Events - for (CreatureEventAIList::iterator i = m_CreatureEventAIList.begin(); i != m_CreatureEventAIList.end(); ++i) - if (SpawnedEventConditionsCheck((*i).Event)) - ProcessEvent(*i); -} - -void CreatureEventAI::Reset() -{ - m_EventUpdateTime = EVENT_UPDATE_TIME; - m_EventDiff = 0; - - if (m_bEmptyList) - return; - - for (CreatureEventAIList::iterator i = m_CreatureEventAIList.begin(); i != m_CreatureEventAIList.end(); ++i) - { - if ((*i).Event.event_type == EVENT_T_RESET) - ProcessEvent(*i); - } - - //Reset all events to enabled - for (CreatureEventAIList::iterator i = m_CreatureEventAIList.begin(); i != m_CreatureEventAIList.end(); ++i) - { - CreatureEventAI_Event const& event = (*i).Event; - switch (event.event_type) - { - //Reset all out of combat timers - case EVENT_T_TIMER_OOC: - { - if ((*i).UpdateRepeatTimer(me, event.timer.initialMin, event.timer.initialMax)) - (*i).Enabled = true; - break; - } - default: - /// @todo enable below code line / verify this is correct to enable events previously disabled (ex. aggro yell), instead of enable this in void EnterCombat() - //(*i).Enabled = true; - //(*i).Time = 0; - break; - } - } -} - -void CreatureEventAI::JustReachedHome() -{ - if (!m_bEmptyList) - { - for (CreatureEventAIList::iterator i = m_CreatureEventAIList.begin(); i != m_CreatureEventAIList.end(); ++i) - { - if ((*i).Event.event_type == EVENT_T_REACHED_HOME) - ProcessEvent(*i); - } - } - - Reset(); -} - -void CreatureEventAI::EnterEvadeMode() -{ - CreatureAI::EnterEvadeMode(); - - if (m_bEmptyList) - return; - - //Handle Evade events - for (CreatureEventAIList::iterator i = m_CreatureEventAIList.begin(); i != m_CreatureEventAIList.end(); ++i) - { - if ((*i).Event.event_type == EVENT_T_EVADE) - ProcessEvent(*i); - } -} - -void CreatureEventAI::JustDied(Unit* killer) -{ - Reset(); - - if (m_bEmptyList) - return; - - //Handle Evade events - for (CreatureEventAIList::iterator i = m_CreatureEventAIList.begin(); i != m_CreatureEventAIList.end(); ++i) - { - if ((*i).Event.event_type == EVENT_T_DEATH) - ProcessEvent(*i, killer); - } - - // reset phase after any death state events - m_Phase = 0; -} - -void CreatureEventAI::KilledUnit(Unit* victim) -{ - if (m_bEmptyList || victim->GetTypeId() != TYPEID_PLAYER) - return; - - for (CreatureEventAIList::iterator i = m_CreatureEventAIList.begin(); i != m_CreatureEventAIList.end(); ++i) - { - if ((*i).Event.event_type == EVENT_T_KILL) - ProcessEvent(*i, victim); - } -} - -void CreatureEventAI::JustSummoned(Creature* unit) -{ - if (m_bEmptyList || !unit) - return; - - for (CreatureEventAIList::iterator i = m_CreatureEventAIList.begin(); i != m_CreatureEventAIList.end(); ++i) - { - if ((*i).Event.event_type == EVENT_T_SUMMONED_UNIT) - ProcessEvent(*i, unit); - } -} - -void CreatureEventAI::EnterCombat(Unit* enemy) -{ - //Check for on combat start events - if (!m_bEmptyList) - { - for (CreatureEventAIList::iterator i = m_CreatureEventAIList.begin(); i != m_CreatureEventAIList.end(); ++i) - { - CreatureEventAI_Event const& event = (*i).Event; - switch (event.event_type) - { - case EVENT_T_AGGRO: - (*i).Enabled = true; - ProcessEvent(*i, enemy); - break; - //Reset all in combat timers - case EVENT_T_TIMER: - if ((*i).UpdateRepeatTimer(me, event.timer.initialMin, event.timer.initialMax)) - (*i).Enabled = true; - break; - //All normal events need to be re-enabled and their time set to 0 - default: - (*i).Enabled = true; - (*i).Time = 0; - break; - } - } - } - - m_EventUpdateTime = EVENT_UPDATE_TIME; - m_EventDiff = 0; -} - -void CreatureEventAI::AttackStart(Unit* who) -{ - if (!who) - return; - - if (me->Attack(who, m_MeleeEnabled)) - { - if (m_CombatMovementEnabled) - { - me->GetMotionMaster()->MoveChase(who, m_AttackDistance, m_AttackAngle); - } - else - { - me->GetMotionMaster()->MoveIdle(); - } - } -} - -void CreatureEventAI::MoveInLineOfSight(Unit* who) -{ - if (me->GetVictim()) - return; - - //Check for OOC LOS Event - if (!m_bEmptyList) - { - for (CreatureEventAIList::iterator itr = m_CreatureEventAIList.begin(); itr != m_CreatureEventAIList.end(); ++itr) - { - if ((*itr).Event.event_type == EVENT_T_OOC_LOS) - { - //can trigger if closer than fMaxAllowedRange - float fMaxAllowedRange = (float)((*itr).Event.ooc_los.maxRange); - - //if range is ok and we are actually in LOS - if (me->IsWithinDistInMap(who, fMaxAllowedRange) && me->IsWithinLOSInMap(who)) - { - //if friendly event&&who is not hostile OR hostile event&&who is hostile - if (((*itr).Event.ooc_los.noHostile && !me->IsHostileTo(who)) || - ((!(*itr).Event.ooc_los.noHostile) && me->IsHostileTo(who))) - ProcessEvent(*itr, who); - } - } - } - } - - CreatureAI::MoveInLineOfSight(who); -} - -void CreatureEventAI::SpellHit(Unit* unit, const SpellInfo* spell) -{ - if (m_bEmptyList) - return; - - for (CreatureEventAIList::iterator i = m_CreatureEventAIList.begin(); i != m_CreatureEventAIList.end(); ++i) - if ((*i).Event.event_type == EVENT_T_SPELLHIT) - //If spell id matches (or no spell id) & if spell school matches (or no spell school) - if (!(*i).Event.spell_hit.spellId || spell->Id == (*i).Event.spell_hit.spellId) - if (spell->SchoolMask & (*i).Event.spell_hit.schoolMask) - ProcessEvent(*i, unit); -} - -void CreatureEventAI::UpdateAI(uint32 diff) -{ - //Check if we are in combat (also updates calls threat update code) - bool Combat = UpdateVictim(); - - if (!m_bEmptyList) - { - //Events are only updated once every EVENT_UPDATE_TIME ms to prevent lag with large amount of events - if (m_EventUpdateTime <= diff) - { - m_EventDiff += diff; - - //Check for time based events - for (CreatureEventAIList::iterator i = m_CreatureEventAIList.begin(); i != m_CreatureEventAIList.end(); ++i) - { - //Decrement Timers - if ((*i).Time) - { - if (m_EventDiff <= (*i).Time) - { - //Do not decrement timers if event cannot trigger in this phase - if (!((*i).Event.event_inverse_phase_mask & (1 << m_Phase))) - (*i).Time -= m_EventDiff; - - //Skip processing of events that have time remaining - continue; - } - else (*i).Time = 0; - } - - //Events that are updated every EVENT_UPDATE_TIME - switch ((*i).Event.event_type) - { - case EVENT_T_TIMER_OOC: - ProcessEvent(*i); - break; - case EVENT_T_TIMER: - case EVENT_T_MANA: - case EVENT_T_HP: - case EVENT_T_TARGET_HP: - case EVENT_T_TARGET_CASTING: - case EVENT_T_FRIENDLY_HP: - if (me->GetVictim()) - ProcessEvent(*i); - break; - case EVENT_T_RANGE: - if (me->GetVictim()) - if (me->IsInMap(me->GetVictim()) && me->InSamePhase(me->GetVictim())) - if (me->IsInRange(me->GetVictim(), (float)(*i).Event.range.minDist, (float)(*i).Event.range.maxDist)) - ProcessEvent(*i); - break; - default: - break; - } - } - - m_EventDiff = 0; - m_EventUpdateTime = EVENT_UPDATE_TIME; - } - else - { - m_EventDiff += diff; - m_EventUpdateTime -= diff; - } - } - - //Melee Auto-Attack - if (Combat && m_MeleeEnabled) - DoMeleeAttackIfReady(); -} - -inline uint32 CreatureEventAI::GetRandActionParam(uint32 rnd, uint32 param1, uint32 param2, uint32 param3) -{ - switch (rnd % 3) - { - case 0: return param1; - case 1: return param2; - case 2: break; - } - - return param3; -} - -inline int32 CreatureEventAI::GetRandActionParam(uint32 rnd, int32 param1, int32 param2, int32 param3) -{ - switch (rnd % 3) - { - case 0: return param1; - case 1: return param2; - case 2: break; - } - - return param3; -} - -inline Unit* CreatureEventAI::GetTargetByType(uint32 target, Unit* actionInvoker) -{ - switch (target) - { - case TARGET_T_SELF: - return me; - case TARGET_T_HOSTILE: - return me->GetVictim(); - case TARGET_T_HOSTILE_SECOND_AGGRO: - return SelectTarget(SELECT_TARGET_TOPAGGRO, 1); - case TARGET_T_HOSTILE_LAST_AGGRO: - return SelectTarget(SELECT_TARGET_BOTTOMAGGRO, 0); - case TARGET_T_HOSTILE_RANDOM: - return SelectTarget(SELECT_TARGET_RANDOM, 0); - case TARGET_T_HOSTILE_RANDOM_NOT_TOP: - return SelectTarget(SELECT_TARGET_RANDOM, 1); - case TARGET_T_ACTION_INVOKER: - return actionInvoker; - default: - return NULL; - }; -} - -Unit* CreatureEventAI::DoSelectLowestHpFriendly(float range, uint32 minHPDiff) -{ - CellCoord p(Trinity::ComputeCellCoord(me->GetPositionX(), me->GetPositionY())); - Cell cell(p); - cell.SetNoCreate(); - - Unit* unit = NULL; - - Trinity::MostHPMissingInRange u_check(me, range, minHPDiff); - Trinity::UnitLastSearcher<Trinity::MostHPMissingInRange> searcher(me, unit, u_check); - - /* - typedef TYPELIST_4(GameObject, Creature*except pets*, DynamicObject, Corpse*Bones*) AllGridObjectTypes; - This means that if we only search grid then we cannot possibly return pets or players so this is safe - */ - TypeContainerVisitor<Trinity::UnitLastSearcher<Trinity::MostHPMissingInRange>, GridTypeMapContainer > grid_unit_searcher(searcher); - - cell.Visit(p, grid_unit_searcher, *me->GetMap(), *me, range); - return unit; -} - -void CreatureEventAI::DoFindFriendlyCC(std::list<Creature*>& _list, float range) -{ - CellCoord p(Trinity::ComputeCellCoord(me->GetPositionX(), me->GetPositionY())); - Cell cell(p); - cell.SetNoCreate(); - - Trinity::FriendlyCCedInRange u_check(me, range); - Trinity::CreatureListSearcher<Trinity::FriendlyCCedInRange> searcher(me, _list, u_check); - - TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::FriendlyCCedInRange>, GridTypeMapContainer > grid_creature_searcher(searcher); - - cell.Visit(p, grid_creature_searcher, *me->GetMap(), *me, range); -} - -void CreatureEventAI::DoFindFriendlyMissingBuff(std::list<Creature*>& _list, float range, uint32 spellid) -{ - CellCoord p(Trinity::ComputeCellCoord(me->GetPositionX(), me->GetPositionY())); - Cell cell(p); - cell.SetNoCreate(); - - Trinity::FriendlyMissingBuffInRange u_check(me, range, spellid); - Trinity::CreatureListSearcher<Trinity::FriendlyMissingBuffInRange> searcher(me, _list, u_check); - - TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::FriendlyMissingBuffInRange>, GridTypeMapContainer > grid_creature_searcher(searcher); - - cell.Visit(p, grid_creature_searcher, *me->GetMap(), *me, range); -} - -// ********************************* -// *** Functions used globally *** - -void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* source, Unit* target) -{ - if (!source) - { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: DoScriptText entry %i, invalid Source pointer.", textEntry); - return; - } - - if (textEntry >= 0) - { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: DoScriptText with source entry %u (TypeId=%u, guid=%u) attempts to process text entry %i, but text entry must be negative.", source->GetEntry(), source->GetTypeId(), source->GetGUIDLow(), textEntry); - return; - } - - CreatureEventAI_TextMap::const_iterator i = sEventAIMgr->GetCreatureEventAITextMap().find(textEntry); - - if (i == sEventAIMgr->GetCreatureEventAITextMap().end()) - { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: DoScriptText with source entry %u (TypeId=%u, guid=%u) could not find text entry %i.", source->GetEntry(), source->GetTypeId(), source->GetGUIDLow(), textEntry); - return; - } - - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "CreatureEventAI: DoScriptText: text entry=%i, Sound=%u, Type=%u, Language=%u, Emote=%u", textEntry, (*i).second.SoundId, (*i).second.Type, (*i).second.Language, (*i).second.Emote); - - if ((*i).second.SoundId) - { - if (sSoundEntriesStore.LookupEntry((*i).second.SoundId)) - source->PlayDirectSound((*i).second.SoundId); - else - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: DoScriptText entry %i tried to process invalid sound id %u.", textEntry, (*i).second.SoundId); - } - - if ((*i).second.Emote) - { - if (source->GetTypeId() == TYPEID_UNIT || source->GetTypeId() == TYPEID_PLAYER) - { - ((Unit*)source)->HandleEmoteCommand((*i).second.Emote); - } - else - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: DoScriptText entry %i tried to process emote for invalid TypeId (%u).", textEntry, source->GetTypeId()); - } - - switch ((*i).second.Type) - { - case CHAT_TYPE_SAY: - source->MonsterSay(textEntry, (*i).second.Language, target ? target->GetGUID() : 0); - break; - case CHAT_TYPE_YELL: - source->MonsterYell(textEntry, (*i).second.Language, target ? target->GetGUID() : 0); - break; - case CHAT_TYPE_TEXT_EMOTE: - source->MonsterTextEmote(textEntry, target ? target->GetGUID() : 0); - break; - case CHAT_TYPE_BOSS_EMOTE: - source->MonsterTextEmote(textEntry, target ? target->GetGUID() : 0, true); - break; - case CHAT_TYPE_WHISPER: - { - if (target && target->GetTypeId() == TYPEID_PLAYER) - source->MonsterWhisper(textEntry, target->GetGUID()); - else TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", textEntry); - }break; - case CHAT_TYPE_BOSS_WHISPER: - { - if (target && target->GetTypeId() == TYPEID_PLAYER) - source->MonsterWhisper(textEntry, target->GetGUID(), true); - else TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", textEntry); - }break; - case CHAT_TYPE_ZONE_YELL: - source->MonsterYellToZone(textEntry, (*i).second.Language, target ? target->GetGUID() : 0); - break; - } -} - -bool CreatureEventAI::CanCast(Unit* target, SpellInfo const* spell, bool triggered) -{ - //No target so we can't cast - if (!target || !spell) - return false; - - //Silenced so we can't cast - if (!triggered && me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED)) - return false; - - //Check for power - if (!triggered && me->GetPower((Powers)spell->PowerType) < uint32(spell->CalcPowerCost(me, spell->GetSchoolMask()))) - return false; - - //Unit is out of range of this spell - if (!me->IsInRange(target, spell->GetMinRange(false), spell->GetMaxRange(false))) - return false; - - //Spell is on cooldown - if (me->HasSpellCooldown(spell->Id)) - return false; - - return true; -} - -void CreatureEventAI::ReceiveEmote(Player* player, uint32 textEmote) -{ - if (m_bEmptyList) - return; - - for (CreatureEventAIList::iterator itr = m_CreatureEventAIList.begin(); itr != m_CreatureEventAIList.end(); ++itr) - { - if ((*itr).Event.event_type == EVENT_T_RECEIVE_EMOTE) - { - if ((*itr).Event.receive_emote.emoteId != textEmote) - return; - - Condition cond; - cond.ConditionType = ConditionTypes((*itr).Event.receive_emote.condition); - cond.ConditionValue1 = (*itr).Event.receive_emote.conditionValue1; - cond.ConditionValue2 = (*itr).Event.receive_emote.conditionValue2; - - ConditionSourceInfo srcInfo = ConditionSourceInfo(player); - if (cond.Meets(srcInfo)) - { - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "CreatureEventAI: ReceiveEmote CreatureEventAI: Condition ok, processing"); - ProcessEvent(*itr, player); - } - } - } -} - -void CreatureEventAI::DamageTaken(Unit* /*done_by*/, uint32& damage) -{ - if (m_InvincibilityHpLevel > 0 && me->GetHealth() < m_InvincibilityHpLevel+damage) - { - if (me->GetHealth() <= m_InvincibilityHpLevel) - damage = 0; - else - damage = me->GetHealth() - m_InvincibilityHpLevel; - } -} - -bool CreatureEventAI::SpawnedEventConditionsCheck(CreatureEventAI_Event const& event) -{ - if (event.event_type != EVENT_T_SPAWNED) - return false; - - switch (event.spawned.condition) - { - case SPAWNED_EVENT_ALWAY: - // always - return true; - case SPAWNED_EVENT_MAP: - // map ID check - return me->GetMapId() == event.spawned.conditionValue1; - case SPAWNED_EVENT_ZONE: - { - // zone ID check - uint32 zone, area; - me->GetZoneAndAreaId(zone, area); - return zone == event.spawned.conditionValue1 || area == event.spawned.conditionValue1; - } - default: - break; - } - - return false; -} diff --git a/src/server/game/AI/EventAI/CreatureEventAI.h b/src/server/game/AI/EventAI/CreatureEventAI.h deleted file mode 100644 index c16f0901b05..00000000000 --- a/src/server/game/AI/EventAI/CreatureEventAI.h +++ /dev/null @@ -1,630 +0,0 @@ -/* - * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> - * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef TRINITY_CREATURE_EAI_H -#define TRINITY_CREATURE_EAI_H - -#include "Common.h" -#include "Creature.h" -#include "CreatureAI.h" -#include "Unit.h" - -class Player; -class WorldObject; - -#define EVENT_UPDATE_TIME 500 -#define MAX_ACTIONS 3 -#define MAX_PHASE 32 - -enum EventAI_Type -{ - EVENT_T_TIMER = 0, // InitialMin, InitialMax, RepeatMin, RepeatMax - EVENT_T_TIMER_OOC = 1, // InitialMin, InitialMax, RepeatMin, RepeatMax - EVENT_T_HP = 2, // HPMax%, HPMin%, RepeatMin, RepeatMax - EVENT_T_MANA = 3, // ManaMax%, ManaMin% RepeatMin, RepeatMax - EVENT_T_AGGRO = 4, // NONE - EVENT_T_KILL = 5, // RepeatMin, RepeatMax - EVENT_T_DEATH = 6, // NONE - EVENT_T_EVADE = 7, // NONE - EVENT_T_SPELLHIT = 8, // SpellID, School, RepeatMin, RepeatMax - EVENT_T_RANGE = 9, // MinDist, MaxDist, RepeatMin, RepeatMax - EVENT_T_OOC_LOS = 10, // NoHostile, MaxRnage, RepeatMin, RepeatMax - EVENT_T_SPAWNED = 11, // Condition, CondValue1 - EVENT_T_TARGET_HP = 12, // HPMax%, HPMin%, RepeatMin, RepeatMax - EVENT_T_TARGET_CASTING = 13, // RepeatMin, RepeatMax - EVENT_T_FRIENDLY_HP = 14, // HPDeficit, Radius, RepeatMin, RepeatMax - EVENT_T_FRIENDLY_IS_CC = 15, // DispelType, Radius, RepeatMin, RepeatMax - EVENT_T_FRIENDLY_MISSING_BUFF = 16, // SpellId, Radius, RepeatMin, RepeatMax - EVENT_T_SUMMONED_UNIT = 17, // CreatureId, RepeatMin, RepeatMax - EVENT_T_TARGET_MANA = 18, // ManaMax%, ManaMin%, RepeatMin, RepeatMax - EVENT_T_QUEST_ACCEPT = 19, // QuestID - EVENT_T_QUEST_COMPLETE = 20, // - EVENT_T_REACHED_HOME = 21, // NONE - EVENT_T_RECEIVE_EMOTE = 22, // EmoteId, Condition, CondValue1, CondValue2 - EVENT_T_BUFFED = 23, // Param1 = SpellID, Param2 = Number of Time STacked, Param3/4 Repeat Min/Max - EVENT_T_TARGET_BUFFED = 24, // Param1 = SpellID, Param2 = Number of Time STacked, Param3/4 Repeat Min/Max - EVENT_T_RESET = 35, // Is it called after combat, when the creature respawn and spawn. -- TRINITY ONLY - - EVENT_T_END -}; - -enum EventAI_ActionType -{ - ACTION_T_NONE = 0, // No action - ACTION_T_TEXT = 1, // TextId1, optionally -TextId2, optionally -TextId3(if -TextId2 exist). If more than just -TextId1 is defined, randomize. Negative values. - ACTION_T_SET_FACTION = 2, // FactionId (or 0 for default) - ACTION_T_MORPH_TO_ENTRY_OR_MODEL = 3, // Creature_template entry(param1) OR ModelId (param2) (or 0 for both to demorph) - ACTION_T_SOUND = 4, // SoundId - ACTION_T_EMOTE = 5, // EmoteId - ACTION_T_RANDOM_SAY = 6, // UNUSED - ACTION_T_RANDOM_YELL = 7, // UNUSED - ACTION_T_RANDOM_TEXTEMOTE = 8, // UNUSED - ACTION_T_RANDOM_SOUND = 9, // SoundId1, SoundId2, SoundId3 (-1 in any field means no output if randomed that field) - ACTION_T_RANDOM_EMOTE = 10, // EmoteId1, EmoteId2, EmoteId3 (-1 in any field means no output if randomed that field) - ACTION_T_CAST = 11, // SpellId, Target, CastFlags - ACTION_T_SUMMON = 12, // CreatureID, Target, Duration in ms - ACTION_T_THREAT_SINGLE_PCT = 13, // Threat%, Target - ACTION_T_THREAT_ALL_PCT = 14, // Threat% - ACTION_T_QUEST_EVENT = 15, // QuestID, Target - // none = 16, - ACTION_T_SET_UNIT_FIELD = 17, // Field_Number, Value, Target - ACTION_T_SET_UNIT_FLAG = 18, // Flags (may be more than one field OR'd together), Target - ACTION_T_REMOVE_UNIT_FLAG = 19, // Flags (may be more than one field OR'd together), Target - ACTION_T_AUTO_ATTACK = 20, // AllowAttackState (0 = stop attack, anything else means continue attacking) - ACTION_T_COMBAT_MOVEMENT = 21, // AllowCombatMovement (0 = stop combat based movement, anything else continue attacking) - ACTION_T_SET_PHASE = 22, // Phase - ACTION_T_INC_PHASE = 23, // Value (may be negative to decrement phase, should not be 0) - ACTION_T_EVADE = 24, // No Params - ACTION_T_FLEE_FOR_ASSIST = 25, // No Params - ACTION_T_QUEST_EVENT_ALL = 26, // QuestID - // none = 27, - ACTION_T_REMOVEAURASFROMSPELL = 28, // Target, Spellid - ACTION_T_RANGED_MOVEMENT = 29, // Distance, Angle - ACTION_T_RANDOM_PHASE = 30, // PhaseId1, PhaseId2, PhaseId3 - ACTION_T_RANDOM_PHASE_RANGE = 31, // PhaseMin, PhaseMax - ACTION_T_SUMMON_ID = 32, // CreatureId, Target, SpawnId - ACTION_T_KILLED_MONSTER = 33, // CreatureId, Target - ACTION_T_SET_INST_DATA = 34, // Field, Data - ACTION_T_SET_INST_DATA64 = 35, // Field, Target - ACTION_T_UPDATE_TEMPLATE = 36, // Entry, Team - ACTION_T_DIE = 37, // No Params - ACTION_T_ZONE_COMBAT_PULSE = 38, // No Params - ACTION_T_CALL_FOR_HELP = 39, // Radius - ACTION_T_SET_SHEATH = 40, // Sheath (0-passive, 1-melee, 2-ranged) - ACTION_T_FORCE_DESPAWN = 41, // No Params - ACTION_T_SET_INVINCIBILITY_HP_LEVEL = 42, // MinHpValue, format(0-flat, 1-percent from max health) - ACTION_T_MOUNT_TO_ENTRY_OR_MODEL = 43, // Creature_template entry(param1) OR ModelId (param2) (or 0 for both to dismount) - - ACTION_T_SET_PHASE_MASK = 97, - ACTION_T_SET_STAND_STATE = 98, - ACTION_T_MOVE_RANDOM_POINT = 99, - ACTION_T_SET_VISIBILITY = 100, - ACTION_T_SET_ACTIVE = 101, //Apply - ACTION_T_SET_AGGRESSIVE = 102, //Apply - ACTION_T_ATTACK_START_PULSE = 103, //Distance - ACTION_T_SUMMON_GO = 104, //GameObjectID, DespawnTime in ms - - ACTION_T_END = 105 -}; - -enum Target -{ - //Self (me) - TARGET_T_SELF = 0, //Self cast - - //Hostile targets (if pet then returns pet owner) - TARGET_T_HOSTILE, //Our current target (ie: highest aggro) - TARGET_T_HOSTILE_SECOND_AGGRO, //Second highest aggro (generaly used for cleaves and some special attacks) - TARGET_T_HOSTILE_LAST_AGGRO, //Dead last on aggro (no idea what this could be used for) - TARGET_T_HOSTILE_RANDOM, //Just any random target on our threat list - TARGET_T_HOSTILE_RANDOM_NOT_TOP, //Any random target except top threat - - //Invoker targets (if pet then returns pet owner) - TARGET_T_ACTION_INVOKER, //Unit who caused this Event to occur (only works for EVENT_T_AGGRO, EVENT_T_KILL, EVENT_T_DEATH, EVENT_T_SPELLHIT, EVENT_T_OOC_LOS, EVENT_T_FRIENDLY_HP, EVENT_T_FRIENDLY_IS_CC, EVENT_T_FRIENDLY_MISSING_BUFF) - - //Hostile targets (including pets) - TARGET_T_HOSTILE_WPET, //Current target (can be a pet) - TARGET_T_HOSTILE_WPET_SECOND_AGGRO, //Second highest aggro (generaly used for cleaves and some special attacks) - TARGET_T_HOSTILE_WPET_LAST_AGGRO, //Dead last on aggro (no idea what this could be used for) - TARGET_T_HOSTILE_WPET_RANDOM, //Just any random target on our threat list - TARGET_T_HOSTILE_WPET_RANDOM_NOT_TOP, //Any random target except top threat - - TARGET_T_ACTION_INVOKER_WPET, - - TARGET_T_END -}; - -enum CastFlags -{ - CAST_INTERRUPT_PREVIOUS = 0x01, //Interrupt any spell casting - CAST_TRIGGERED = 0x02, //Triggered (this makes spell cost zero mana and have no cast time) - CAST_FORCE_CAST = 0x04, //Forces cast even if creature is out of mana or out of range - CAST_NO_MELEE_IF_OOM = 0x08, //Prevents creature from entering melee if out of mana or out of range - CAST_FORCE_TARGET_SELF = 0x10, //Forces the target to cast this spell on itself - CAST_AURA_NOT_PRESENT = 0x20 //Only casts the spell if the target does not have an aura from the spell -}; - -enum EventFlags -{ - EFLAG_REPEATABLE = 0x01, //Event repeats - EFLAG_DIFFICULTY_0 = 0x02, //Event only occurs in instance difficulty 0 - EFLAG_DIFFICULTY_1 = 0x04, //Event only occurs in instance difficulty 1 - EFLAG_DIFFICULTY_2 = 0x08, //Event only occurs in instance difficulty 2 - EFLAG_DIFFICULTY_3 = 0x10, //Event only occurs in instance difficulty 3 - EFLAG_RESERVED_5 = 0x20, - EFLAG_RESERVED_6 = 0x40, - EFLAG_DEBUG_ONLY = 0x80, //Event only occurs in debug build - - EFLAG_DIFFICULTY_ALL = (EFLAG_DIFFICULTY_0|EFLAG_DIFFICULTY_1|EFLAG_DIFFICULTY_2|EFLAG_DIFFICULTY_3) -}; - -enum SpawnedEventMode -{ - SPAWNED_EVENT_ALWAY = 0, - SPAWNED_EVENT_MAP = 1, - SPAWNED_EVENT_ZONE = 2 -}; - -// String text additional data, used in (CreatureEventAI) -struct StringTextData -{ - uint32 SoundId; - uint8 Type; - uint32 Language; - uint32 Emote; -}; -// Text Maps -typedef UNORDERED_MAP<int32, StringTextData> CreatureEventAI_TextMap; - -struct CreatureEventAI_Action -{ - EventAI_ActionType type: 16; - union - { - // ACTION_T_TEXT = 1 - struct - { - int32 TextId1; - int32 TextId2; - int32 TextId3; - } text; - // ACTION_T_SET_FACTION = 2 - struct - { - uint32 factionId; // faction or 0 for default) - } set_faction; - // ACTION_T_MORPH_TO_ENTRY_OR_MODEL = 3 - struct - { - uint32 creatureId; // set one from fields (or 0 for both to demorph) - uint32 modelId; - } morph; - // ACTION_T_SOUND = 4 - struct - { - uint32 soundId; - } sound; - // ACTION_T_EMOTE = 5 - struct - { - uint32 emoteId; - } emote; - // ACTION_T_RANDOM_SOUND = 9 - struct - { - int32 soundId1; // (-1 in any field means no output if randomed that field) - int32 soundId2; - int32 soundId3; - } random_sound; - // ACTION_T_RANDOM_EMOTE = 10 - struct - { - int32 emoteId1; // (-1 in any field means no output if randomed that field) - int32 emoteId2; - int32 emoteId3; - } random_emote; - // ACTION_T_CAST = 11 - struct - { - uint32 spellId; - uint32 target; - uint32 castFlags; - } cast; - // ACTION_T_SUMMON = 12 - struct - { - uint32 creatureId; - uint32 target; - uint32 duration; - } summon; - // ACTION_T_THREAT_SINGLE_PCT = 13 - struct - { - int32 percent; - uint32 target; - } threat_single_pct; - // ACTION_T_THREAT_ALL_PCT = 14 - struct - { - int32 percent; - } threat_all_pct; - // ACTION_T_QUEST_EVENT = 15 - struct - { - uint32 questId; - uint32 target; - } quest_event; - // ACTION_T_SET_UNIT_FIELD = 17 - struct - { - uint32 field; - uint32 value; - uint32 target; - } set_unit_field; - // ACTION_T_SET_UNIT_FLAG = 18, // value provided mask bits that will be set - // ACTION_T_REMOVE_UNIT_FLAG = 19, // value provided mask bits that will be clear - struct - { - uint32 value; - uint32 target; - } unit_flag; - // ACTION_T_AUTO_ATTACK = 20 - struct - { - uint32 state; // 0 = stop attack, anything else means continue attacking - } auto_attack; - // ACTION_T_COMBAT_MOVEMENT = 21 - struct - { - uint32 state; // 0 = stop combat based movement, anything else continue attacking - uint32 melee; // if set: at stop send melee combat stop if in combat, use for terminate melee fighting state for switch to ranged - } combat_movement; - // ACTION_T_SET_PHASE = 22 - struct - { - uint32 phase; - } set_phase; - // ACTION_T_INC_PHASE = 23 - struct - { - int32 step; - } set_inc_phase; - // ACTION_T_QUEST_EVENT_ALL = 26 - struct - { - uint32 questId; - } quest_event_all; - // ACTION_T_REMOVEAURASFROMSPELL = 28 - struct - { - uint32 target; - uint32 spellId; - } remove_aura; - // ACTION_T_RANGED_MOVEMENT = 29 - struct - { - uint32 distance; - int32 angle; - } ranged_movement; - // ACTION_T_RANDOM_PHASE = 30 - struct - { - uint32 phase1; - uint32 phase2; - uint32 phase3; - } random_phase; - // ACTION_T_RANDOM_PHASE_RANGE = 31 - struct - { - uint32 phaseMin; - uint32 phaseMax; - } random_phase_range; - // ACTION_T_SUMMON_ID = 32 - struct - { - uint32 creatureId; - uint32 target; - uint32 spawnId; - } summon_id; - // ACTION_T_KILLED_MONSTER = 33 - struct - { - uint32 creatureId; - uint32 target; - } killed_monster; - // ACTION_T_SET_INST_DATA = 34 - struct - { - uint32 field; - uint32 value; - } set_inst_data; - // ACTION_T_SET_INST_DATA64 = 35 - struct - { - uint32 field; - uint32 target; - } set_inst_data64; - // ACTION_T_UPDATE_TEMPLATE = 36 - struct - { - uint32 creatureId; - uint32 team; - } update_template; - // ACTION_T_CALL_FOR_HELP = 39 - struct - { - uint32 radius; - } call_for_help; - // ACTION_T_SET_SHEATH = 40 - struct - { - uint32 sheath; - } set_sheath; - // ACTION_T_FORCE_DESPAWN = 41 - struct - { - uint32 msDelay; - } forced_despawn; - // ACTION_T_SET_INVINCIBILITY_HP_LEVEL = 42 - struct - { - uint32 hp_level; - uint32 is_percent; - } invincibility_hp_level; - // ACTION_T_MOUNT_TO_ENTRY_OR_MODEL = 43 - struct - { - uint32 creatureId; // set one from fields (or 0 for both to dismount) - uint32 modelId; - } mount; - // RAW - struct - { - uint32 param1; - uint32 param2; - uint32 param3; - } raw; - }; -}; - -struct CreatureEventAI_Event -{ - uint32 event_id; - - uint32 creature_id; - - uint32 event_inverse_phase_mask; - - EventAI_Type event_type : 16; - uint8 event_chance : 8; - uint8 event_flags : 8; - - union - { - // EVENT_T_TIMER = 0 - // EVENT_T_TIMER_OOC = 1 - struct - { - uint32 initialMin; - uint32 initialMax; - uint32 repeatMin; - uint32 repeatMax; - } timer; - // EVENT_T_HP = 2 - // EVENT_T_MANA = 3 - // EVENT_T_TARGET_HP = 12 - // EVENT_T_TARGET_MANA = 18 - struct - { - uint32 percentMax; - uint32 percentMin; - uint32 repeatMin; - uint32 repeatMax; - } percent_range; - // EVENT_T_KILL = 5 - struct - { - uint32 repeatMin; - uint32 repeatMax; - } kill; - // EVENT_T_SPELLHIT = 8 - struct - { - uint32 spellId; - uint32 schoolMask; // -1 ( == 0xffffffff) is ok value for full mask, or must be more limited mask like (0 < 1) = 1 for normal/physical school - uint32 repeatMin; - uint32 repeatMax; - } spell_hit; - // EVENT_T_RANGE = 9 - struct - { - uint32 minDist; - uint32 maxDist; - uint32 repeatMin; - uint32 repeatMax; - } range; - // EVENT_T_OOC_LOS = 10 - struct - { - uint32 noHostile; - uint32 maxRange; - uint32 repeatMin; - uint32 repeatMax; - } ooc_los; - // EVENT_T_SPAWNED = 11 - struct - { - uint32 condition; - uint32 conditionValue1; - } spawned; - // EVENT_T_TARGET_CASTING = 13 - struct - { - uint32 repeatMin; - uint32 repeatMax; - } target_casting; - // EVENT_T_FRIENDLY_HP = 14 - struct - { - uint32 hpDeficit; - uint32 radius; - uint32 repeatMin; - uint32 repeatMax; - } friendly_hp; - // EVENT_T_FRIENDLY_IS_CC = 15 - struct - { - uint32 dispelType; // unused ? - uint32 radius; - uint32 repeatMin; - uint32 repeatMax; - } friendly_is_cc; - // EVENT_T_FRIENDLY_MISSING_BUFF = 16 - struct - { - uint32 spellId; - uint32 radius; - uint32 repeatMin; - uint32 repeatMax; - } friendly_buff; - // EVENT_T_SUMMONED_UNIT = 17 - struct - { - uint32 creatureId; - uint32 repeatMin; - uint32 repeatMax; - } summon_unit; - // EVENT_T_QUEST_ACCEPT = 19 - // EVENT_T_QUEST_COMPLETE = 20 - struct - { - uint32 questId; - } quest; - // EVENT_T_RECEIVE_EMOTE = 22 - struct - { - uint32 emoteId; - uint32 condition; - uint32 conditionValue1; - uint32 conditionValue2; - } receive_emote; - // EVENT_T_BUFFED = 23 - // EVENT_T_TARGET_BUFFED = 24 - struct - { - uint32 spellId; - uint32 amount; - uint32 repeatMin; - uint32 repeatMax; - } buffed; - - // RAW - struct - { - uint32 param1; - uint32 param2; - uint32 param3; - uint32 param4; - } raw; - }; - - CreatureEventAI_Action action[MAX_ACTIONS]; -}; -//Event_Map -typedef UNORDERED_MAP<uint32, std::vector<CreatureEventAI_Event> > CreatureEventAI_Event_Map; - -struct CreatureEventAI_Summon -{ - //uint32 id; - - float position_x; - float position_y; - float position_z; - float orientation; - uint32 SpawnTimeSecs; -}; - -//EventSummon_Map -typedef UNORDERED_MAP<uint32, CreatureEventAI_Summon> CreatureEventAI_Summon_Map; - -struct CreatureEventAIHolder -{ - CreatureEventAIHolder(CreatureEventAI_Event const& p) : Event(p), Time(0), Enabled(true){ } - - CreatureEventAI_Event Event; - uint32 Time; - bool Enabled; - - // helper - bool UpdateRepeatTimer(Creature* creature, uint32 repeatMin, uint32 repeatMax); -}; - -class CreatureEventAI : public CreatureAI -{ - public: - explicit CreatureEventAI(Creature* c); - ~CreatureEventAI() { } - - void JustRespawned(); - void Reset(); - void JustReachedHome(); - void EnterCombat(Unit* enemy); - void EnterEvadeMode(); - void JustDied(Unit* /*killer*/); - void KilledUnit(Unit* victim); - void JustSummoned(Creature* unit); - void AttackStart(Unit* who); - void MoveInLineOfSight(Unit* who); - void SpellHit(Unit* unit, const SpellInfo* spell); - void DamageTaken(Unit* done_by, uint32& damage); - void HealReceived(Unit* /*done_by*/, uint32& /*addhealth*/) { } - void UpdateAI(uint32 diff); - void ReceiveEmote(Player* player, uint32 textEmote); - static int Permissible(const Creature*); - - bool ProcessEvent(CreatureEventAIHolder& holder, Unit* actionInvoker = NULL); - void ProcessAction(CreatureEventAI_Action const& action, uint32 rnd, uint32 eventId, Unit* actionInvoker); - inline uint32 GetRandActionParam(uint32 rnd, uint32 param1, uint32 param2, uint32 param3); - inline int32 GetRandActionParam(uint32 rnd, int32 param1, int32 param2, int32 param3); - inline Unit* GetTargetByType(uint32 target, Unit* actionInvoker); - - void DoScriptText(int32 textEntry, WorldObject* source, Unit* target); - bool CanCast(Unit* target, SpellInfo const* spell, bool triggered); - - bool SpawnedEventConditionsCheck(CreatureEventAI_Event const& event); - - Unit* DoSelectLowestHpFriendly(float range, uint32 minHPDiff); - void DoFindFriendlyMissingBuff(std::list<Creature*>& _list, float range, uint32 spellid); - void DoFindFriendlyCC(std::list<Creature*>& _list, float range); - - protected: - uint32 m_EventUpdateTime; // Time between event updates - uint32 m_EventDiff; // Time between the last event call - bool m_bEmptyList; - - typedef std::vector<CreatureEventAIHolder> CreatureEventAIList; - CreatureEventAIList m_CreatureEventAIList; // Holder for events (stores enabled, time, and eventid) - // Variables used by Events themselves - uint8 m_Phase; // Current phase, max 32 phases - bool m_CombatMovementEnabled; // If we allow targeted movment gen (movement twoards top threat) - bool m_MeleeEnabled; // If we allow melee auto attack - float m_AttackDistance; // Distance to attack from - float m_AttackAngle; // Angle of attack - uint32 m_InvincibilityHpLevel; // Minimal health level allowed at damage apply -}; -#endif diff --git a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp deleted file mode 100644 index c6bfd33d57d..00000000000 --- a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp +++ /dev/null @@ -1,680 +0,0 @@ -/* - * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> - * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "Common.h" -#include "DatabaseEnv.h" -#include "CreatureEventAI.h" -#include "CreatureEventAIMgr.h" -#include "ObjectMgr.h" -#include "ObjectDefines.h" -#include "GridDefines.h" -#include "ConditionMgr.h" -#include "SpellMgr.h" -#include "SpellInfo.h" -#include "Player.h" - -// ------------------- -void CreatureEventAIMgr::LoadCreatureEventAI_Texts() -{ - uint32 oldMSTime = getMSTime(); - - // Drop Existing Text Map, only done once and we are ready to add data from multiple sources. - m_CreatureEventAI_TextMap.clear(); - - // Load EventAI Text - sObjectMgr->LoadTrinityStrings("creature_ai_texts", MIN_CREATURE_AI_TEXT_STRING_ID, MAX_CREATURE_AI_TEXT_STRING_ID); - - // Gather Additional data from EventAI Texts 0 1 2 3 4 - QueryResult result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM creature_ai_texts"); - - if (!result) - { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 additional CreatureEventAI Texts data. DB table `creature_ai_texts` is empty."); - return; - } - - uint32 count = 0; - - do - { - Field* fields = result->Fetch(); - StringTextData temp; - - int32 i = fields[0].GetInt32(); - temp.SoundId = fields[1].GetUInt32(); - temp.Type = fields[2].GetUInt8(); - temp.Language = fields[3].GetUInt8(); - temp.Emote = fields[4].GetUInt16(); - - // range negative - if (i > MIN_CREATURE_AI_TEXT_STRING_ID || i <= MAX_CREATURE_AI_TEXT_STRING_ID) - { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Entry %i in table `creature_ai_texts` is not in valid range(%d-%d)", i, MIN_CREATURE_AI_TEXT_STRING_ID, MAX_CREATURE_AI_TEXT_STRING_ID); - continue; - } - - // range negative (must not happen, loaded from same table) - if (!sObjectMgr->GetTrinityStringLocale(i)) - { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Entry %i in table `creature_ai_texts` not found", i); - continue; - } - - if (temp.SoundId) - { - if (!sSoundEntriesStore.LookupEntry(temp.SoundId)) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Entry %i in table `creature_ai_texts` has Sound %u but sound does not exist.", i, temp.SoundId); - } - - if (!GetLanguageDescByID(temp.Language)) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Entry %i in table `creature_ai_texts` using Language %u but Language does not exist.", i, temp.Language); - - if (temp.Type > CHAT_TYPE_ZONE_YELL) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Entry %i in table `creature_ai_texts` has Type %u but this Chat Type does not exist.", i, temp.Type); - - if (temp.Emote) - { - if (!sEmotesStore.LookupEntry(temp.Emote)) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Entry %i in table `creature_ai_texts` has Emote %u but emote does not exist.", i, temp.Emote); - } - - m_CreatureEventAI_TextMap[i] = temp; - ++count; - } - while (result->NextRow()); - - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u additional CreatureEventAI Texts data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); -} - -void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() -{ - uint32 oldMSTime = getMSTime(); - - //Drop Existing EventAI List - m_CreatureEventAI_Event_Map.clear(); - - // Gather event data - QueryResult result = WorldDatabase.Query("SELECT id, creature_id, event_type, event_inverse_phase_mask, event_chance, event_flags, " - "event_param1, event_param2, event_param3, event_param4, " - "action1_type, action1_param1, action1_param2, action1_param3, " - "action2_type, action2_param1, action2_param2, action2_param3, " - "action3_type, action3_param1, action3_param2, action3_param3 " - "FROM creature_ai_scripts"); - - if (!result) - { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 CreatureEventAI scripts. DB table `creature_ai_scripts` is empty."); - return; - } - - uint32 count = 0; - - do - { - Field* fields = result->Fetch(); - - CreatureEventAI_Event temp; - temp.event_id = EventAI_Type(fields[0].GetUInt32()); - uint32 i = temp.event_id; - - temp.creature_id = fields[1].GetUInt32(); - uint32 creature_id = temp.creature_id; - - uint32 e_type = fields[2].GetUInt8(); - //Report any errors in event - if (e_type >= EVENT_T_END) - { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u have wrong type (%u), skipping.", i, e_type); - continue; - } - temp.event_type = EventAI_Type(e_type); - - temp.event_inverse_phase_mask = fields[3].GetInt32(); - temp.event_chance = fields[4].GetUInt32(); - temp.event_flags = fields[5].GetUInt32(); - temp.raw.param1 = fields[6].GetInt32(); - temp.raw.param2 = fields[7].GetInt32(); - temp.raw.param3 = fields[8].GetInt32(); - temp.raw.param4 = fields[9].GetInt32(); - - CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(creature_id); - //Creature does not exist in database - if (!cInfo) - { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u has script for non-existing creature entry (%u), skipping.", i, creature_id); - continue; - } - - // Only on the first script - if (cInfo->AIName != "EventAI" && m_CreatureEventAI_Event_Map[creature_id].empty()) - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature entry %u has EventAI scripts, but its AIName is not 'EventAI' - possible AI-mismatch?", temp.creature_id); - - //No chance of this event occuring - if (temp.event_chance == 0) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u has 0 percent chance. Event will never trigger!", i); - //Chance above 100, force it to be 100 - else if (temp.event_chance > 100) - { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using event %u with more than 100 percent chance. Adjusting to 100 percent.", temp.creature_id, i); - temp.event_chance = 100; - } - - //Individual event checks - switch (temp.event_type) - { - case EVENT_T_TIMER: - case EVENT_T_TIMER_OOC: - if (temp.timer.initialMax < temp.timer.initialMin) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using timed event(%u) with param2 < param1 (InitialMax < InitialMin). Event will never repeat.", temp.creature_id, i); - if (temp.timer.repeatMax < temp.timer.repeatMin) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); - break; - case EVENT_T_HP: - case EVENT_T_MANA: - case EVENT_T_TARGET_HP: - case EVENT_T_TARGET_MANA: - if (temp.percent_range.percentMax > 100) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using percentage event(%u) with param2 (MinPercent) > 100. Event will never trigger! ", temp.creature_id, i); - - if (temp.percent_range.percentMax <= temp.percent_range.percentMin) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using percentage event(%u) with param1 <= param2 (MaxPercent <= MinPercent). Event will never trigger! ", temp.creature_id, i); - - if (temp.event_flags & EFLAG_REPEATABLE && !temp.percent_range.repeatMin && !temp.percent_range.repeatMax) - { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Creature %u has param3 and param4=0 (RepeatMin/RepeatMax) but cannot be repeatable without timers. Removing EFLAG_REPEATABLE for event %u.", temp.creature_id, i); - temp.event_flags &= ~EFLAG_REPEATABLE; - } - break; - case EVENT_T_SPELLHIT: - if (temp.spell_hit.spellId) - { - SpellInfo const* spell = sSpellMgr->GetSpellInfo(temp.spell_hit.spellId); - if (!spell) - { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.spell_hit.spellId, i); - continue; - } - - if ((temp.spell_hit.schoolMask & spell->SchoolMask) != spell->SchoolMask) - { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Creature %u has param1(spellId %u) but param2 is not -1 and not equal to spell's school mask. Event %u can never trigger.", - temp.creature_id, temp.spell_hit.schoolMask, i); - } - } - - if (!temp.spell_hit.schoolMask) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Creature %u is using invalid SpellSchoolMask(%u) defined in event %u.", temp.creature_id, temp.spell_hit.schoolMask, i); - - if (temp.spell_hit.repeatMax < temp.spell_hit.repeatMin) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); - break; - case EVENT_T_RANGE: - if (temp.range.maxDist < temp.range.minDist) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using event(%u) with param2 < param1 (MaxDist < MinDist). Event will never repeat.", temp.creature_id, i); - if (temp.range.repeatMax < temp.range.repeatMin) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); - break; - case EVENT_T_OOC_LOS: - if (temp.ooc_los.repeatMax < temp.ooc_los.repeatMin) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); - break; - case EVENT_T_SPAWNED: - switch (temp.spawned.condition) - { - case SPAWNED_EVENT_ALWAY: - break; - case SPAWNED_EVENT_MAP: - if (!sMapStore.LookupEntry(temp.spawned.conditionValue1)) - { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using spawned event(%u) with param1 = %u 'map specific' but with not existed map (%u) in param2. Event will never repeat.", - temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1); - } - break; - case SPAWNED_EVENT_ZONE: - if (!GetAreaEntryByAreaID(temp.spawned.conditionValue1)) - { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using spawned event(%u) with param1 = %u 'area specific' but with not existed area (%u) in param2. Event will never repeat.", - temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1); - } - break; - default: - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using invalid spawned event %u mode (%u) in param1", temp.creature_id, i, temp.spawned.condition); - break; - } - break; - case EVENT_T_FRIENDLY_HP: - if (temp.friendly_hp.repeatMax < temp.friendly_hp.repeatMin) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); - break; - case EVENT_T_FRIENDLY_IS_CC: - if (temp.friendly_is_cc.repeatMax < temp.friendly_is_cc.repeatMin) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); - break; - case EVENT_T_FRIENDLY_MISSING_BUFF: - { - SpellInfo const* spell = sSpellMgr->GetSpellInfo(temp.spell_hit.spellId); - if (!spell) - { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.spell_hit.spellId, i); - continue; - } - if (temp.friendly_buff.repeatMax < temp.friendly_buff.repeatMin) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); - break; - } - case EVENT_T_KILL: - if (temp.kill.repeatMax < temp.kill.repeatMin) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); - break; - case EVENT_T_TARGET_CASTING: - if (temp.target_casting.repeatMax < temp.target_casting.repeatMin) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); - break; - case EVENT_T_SUMMONED_UNIT: - if (!sObjectMgr->GetCreatureTemplate(temp.summon_unit.creatureId)) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using event(%u) with not existed creature template id (%u) in param1, skipped.", temp.creature_id, i, temp.summon_unit.creatureId); - if (temp.summon_unit.repeatMax < temp.summon_unit.repeatMin) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); - break; - case EVENT_T_QUEST_ACCEPT: - case EVENT_T_QUEST_COMPLETE: - if (!sObjectMgr->GetQuestTemplate(temp.quest.questId)) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using event(%u) with not existed qyest id (%u) in param1, skipped.", temp.creature_id, i, temp.quest.questId); - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Creature %u using not implemented event (%u) in event %u.", temp.creature_id, temp.event_id, i); - continue; - - case EVENT_T_AGGRO: - case EVENT_T_DEATH: - case EVENT_T_EVADE: - case EVENT_T_REACHED_HOME: - { - if (temp.event_flags & EFLAG_REPEATABLE) - { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Creature %u has EFLAG_REPEATABLE set. Event can never be repeatable. Removing flag for event %u.", temp.creature_id, i); - temp.event_flags &= ~EFLAG_REPEATABLE; - } - - break; - } - - case EVENT_T_RECEIVE_EMOTE: - { - if (!sEmotesTextStore.LookupEntry(temp.receive_emote.emoteId)) - { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Creature %u using event %u: param1 (EmoteTextId: %u) are not valid.", temp.creature_id, i, temp.receive_emote.emoteId); - continue; - } - if (temp.receive_emote.condition) - { - Condition cond; - cond.ConditionType = ConditionTypes(temp.receive_emote.condition); - cond.ConditionValue1 = temp.receive_emote.conditionValue1; - cond.ConditionValue2 = temp.receive_emote.conditionValue2; - if (!sConditionMgr->isConditionTypeValid(&cond)) - { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Creature %u using event %u: param2 (Condition: %u) are not valid.", temp.creature_id, i, temp.receive_emote.condition); - continue; - } - } - - if (!(temp.event_flags & EFLAG_REPEATABLE)) - { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Creature %u using event %u: EFLAG_REPEATABLE not set. Event must always be repeatable. Flag applied.", temp.creature_id, i); - temp.event_flags |= EFLAG_REPEATABLE; - } - - break; - } - - case EVENT_T_BUFFED: - case EVENT_T_TARGET_BUFFED: - { - SpellInfo const* spell = sSpellMgr->GetSpellInfo(temp.buffed.spellId); - if (!spell) - { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.spell_hit.spellId, i); - continue; - } - if (temp.buffed.repeatMax < temp.buffed.repeatMin) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i); - break; - } - - default: - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Creature %u using not checked at load event (%u) in event %u. Need check code update?", temp.creature_id, temp.event_id, i); - break; - } - - for (uint32 j = 0; j < MAX_ACTIONS; j++) - { - uint16 action_type = fields[10+(j*4)].GetUInt8(); - if (action_type >= ACTION_T_END) - { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u has incorrect action type (%u), replace by ACTION_T_NONE.", i, j+1, action_type); - temp.action[j].type = ACTION_T_NONE; - continue; - } - - CreatureEventAI_Action& action = temp.action[j]; - - action.type = EventAI_ActionType(action_type); - action.raw.param1 = fields[11+(j*4)].GetInt32(); - action.raw.param2 = fields[12+(j*4)].GetInt32(); - action.raw.param3 = fields[13+(j*4)].GetInt32(); - - //Report any errors in actions - switch (action.type) - { - case ACTION_T_NONE: - break; - case ACTION_T_TEXT: - { - if (action.text.TextId1 < 0) - { - if (m_CreatureEventAI_TextMap.find(action.text.TextId1) == m_CreatureEventAI_TextMap.end()) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param1 refrences non-existing entry in texts table.", i, j+1); - } - if (action.text.TextId2 < 0) - { - if (m_CreatureEventAI_TextMap.find(action.text.TextId2) == m_CreatureEventAI_TextMap.end()) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param2 refrences non-existing entry in texts table.", i, j+1); - - if (!action.text.TextId1) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u has param2, but param1 is not set. Required for randomized text.", i, j+1); - } - if (action.text.TextId3 < 0) - { - if (m_CreatureEventAI_TextMap.find(action.text.TextId3) == m_CreatureEventAI_TextMap.end()) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param3 refrences non-existing entry in texts table.", i, j+1); - - if (!action.text.TextId1 || !action.text.TextId2) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u has param3, but param1 and/or param2 is not set. Required for randomized text.", i, j+1); - } - break; - } - case ACTION_T_SET_FACTION: - if (action.set_faction.factionId !=0 && !sFactionStore.LookupEntry(action.set_faction.factionId)) - { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existent FactionId %u.", i, j+1, action.set_faction.factionId); - action.set_faction.factionId = 0; - } - break; - case ACTION_T_MORPH_TO_ENTRY_OR_MODEL: - if (action.morph.creatureId !=0 || action.morph.modelId !=0) - { - if (action.morph.creatureId && !sObjectMgr->GetCreatureTemplate(action.morph.creatureId)) - { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existant Creature entry %u.", i, j+1, action.morph.creatureId); - action.morph.creatureId = 0; - } - - if (action.morph.modelId) - { - if (action.morph.creatureId) - { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u have unused ModelId %u with also set creature id %u.", i, j+1, action.morph.modelId, action.morph.creatureId); - action.morph.modelId = 0; - } - else if (!sCreatureDisplayInfoStore.LookupEntry(action.morph.modelId)) - { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existant ModelId %u.", i, j+1, action.morph.modelId); - action.morph.modelId = 0; - } - } - } - break; - case ACTION_T_SOUND: - if (!sSoundEntriesStore.LookupEntry(action.sound.soundId)) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existant SoundID %u.", i, j+1, action.sound.soundId); - break; - case ACTION_T_EMOTE: - if (!sEmotesStore.LookupEntry(action.emote.emoteId)) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param1 (EmoteId: %u) are not valid.", i, j+1, action.emote.emoteId); - break; - case ACTION_T_RANDOM_SOUND: - if (!sSoundEntriesStore.LookupEntry(action.random_sound.soundId1)) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param1 uses non-existant SoundID %u.", i, j+1, action.random_sound.soundId1); - if (action.random_sound.soundId2 >= 0 && !sSoundEntriesStore.LookupEntry(action.random_sound.soundId2)) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param2 uses non-existant SoundID %u.", i, j+1, action.random_sound.soundId2); - if (action.random_sound.soundId3 >= 0 && !sSoundEntriesStore.LookupEntry(action.random_sound.soundId3)) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param3 uses non-existant SoundID %u.", i, j+1, action.random_sound.soundId3); - break; - case ACTION_T_RANDOM_EMOTE: - if (!sEmotesStore.LookupEntry(action.random_emote.emoteId1)) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param1 (EmoteId: %u) are not valid.", i, j+1, action.random_emote.emoteId1); - if (action.random_emote.emoteId2 >= 0 && !sEmotesStore.LookupEntry(action.random_emote.emoteId2)) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param2 (EmoteId: %u) are not valid.", i, j+1, action.random_emote.emoteId2); - if (action.random_emote.emoteId3 >= 0 && !sEmotesStore.LookupEntry(action.random_emote.emoteId3)) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param3 (EmoteId: %u) are not valid.", i, j+1, action.random_emote.emoteId3); - break; - case ACTION_T_CAST: - { - const SpellInfo* spell = sSpellMgr->GetSpellInfo(action.cast.spellId); - if (!spell) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.cast.spellId); - /* FIXME: temp.raw.param3 not have event tipes with recovery time in it.... - else - { - if (spell->RecoveryTime > 0 && temp.event_flags & EFLAG_REPEATABLE) - { - //output as debug for now, also because there's no general rule all spells have RecoveryTime - if (temp.event_param3 < spell->RecoveryTime) - TC_LOG_DEBUG("CreatureEventAI: Event %u Action %u uses SpellID %u but cooldown is longer(%u) than minumum defined in event param3(%u).", i, j+1, action.cast.spellId, spell->RecoveryTime, temp.event_param3); - } - } - */ - - //Cast is always triggered if target is forced to cast on self - if (action.cast.castFlags & CAST_FORCE_TARGET_SELF) - action.cast.castFlags |= CAST_TRIGGERED; - - if (action.cast.target >= TARGET_T_END) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); - break; - } - case ACTION_T_SUMMON: - if (!sObjectMgr->GetCreatureTemplate(action.summon.creatureId)) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existent creature entry %u.", i, j+1, action.summon.creatureId); - - if (action.summon.target >= TARGET_T_END) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); - break; - case ACTION_T_THREAT_SINGLE_PCT: - if (std::abs(action.threat_single_pct.percent) > 100) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses invalid percent value %u.", i, j+1, action.threat_single_pct.percent); - if (action.threat_single_pct.target >= TARGET_T_END) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); - break; - case ACTION_T_THREAT_ALL_PCT: - if (std::abs(action.threat_all_pct.percent) > 100) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses invalid percent value %u.", i, j+1, action.threat_all_pct.percent); - break; - case ACTION_T_QUEST_EVENT: - if (Quest const* qid = sObjectMgr->GetQuestTemplate(action.quest_event.questId)) - { - if (!qid->HasSpecialFlag(QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT)) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u. SpecialFlags for quest entry %u does not include |2, Action will not have any effect.", i, j+1, action.quest_event.questId); - } - else - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existent Quest entry %u.", i, j+1, action.quest_event.questId); - - if (action.quest_event.target >= TARGET_T_END) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); - - break; - case ACTION_T_SET_UNIT_FIELD: - if (action.set_unit_field.field < OBJECT_END || action.set_unit_field.field >= UNIT_END) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param1 (UNIT_FIELD*). Index out of range for intended use.", i, j+1); - if (action.set_unit_field.target >= TARGET_T_END) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); - break; - case ACTION_T_SET_UNIT_FLAG: - case ACTION_T_REMOVE_UNIT_FLAG: - if (action.unit_flag.target >= TARGET_T_END) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); - break; - case ACTION_T_SET_PHASE: - if (action.set_phase.phase >= MAX_PHASE) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u attempts to set phase >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1); - break; - case ACTION_T_INC_PHASE: - if (action.set_inc_phase.step == 0) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u is incrementing phase by 0. Was this intended?", i, j+1); - else if (std::abs(action.set_inc_phase.step) > MAX_PHASE-1) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u is change phase by too large for any use %i.", i, j+1, action.set_inc_phase.step); - break; - case ACTION_T_QUEST_EVENT_ALL: - if (Quest const* qid = sObjectMgr->GetQuestTemplate(action.quest_event_all.questId)) - { - if (!qid->HasSpecialFlag(QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT)) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u. SpecialFlags for quest entry %u does not include |2, Action will not have any effect.", i, j+1, action.quest_event_all.questId); - } - else - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existent Quest entry %u.", i, j+1, action.quest_event_all.questId); - break; - case ACTION_T_REMOVEAURASFROMSPELL: - if (!sSpellMgr->GetSpellInfo(action.remove_aura.spellId)) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.remove_aura.spellId); - if (action.remove_aura.target >= TARGET_T_END) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); - break; - case ACTION_T_RANDOM_PHASE: //PhaseId1, PhaseId2, PhaseId3 - if (action.random_phase.phase1 >= MAX_PHASE) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u attempts to set phase1 >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1); - if (action.random_phase.phase2 >= MAX_PHASE) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u attempts to set phase2 >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1); - if (action.random_phase.phase3 >= MAX_PHASE) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u attempts to set phase3 >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1); - break; - case ACTION_T_RANDOM_PHASE_RANGE: //PhaseMin, PhaseMax - if (action.random_phase_range.phaseMin >= MAX_PHASE) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u attempts to set phaseMin >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1); - if (action.random_phase_range.phaseMin >= MAX_PHASE) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u attempts to set phaseMax >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1); - if (action.random_phase_range.phaseMin >= action.random_phase_range.phaseMax) - { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u attempts to set phaseMax <= phaseMin.", i, j+1); - std::swap(action.random_phase_range.phaseMin, action.random_phase_range.phaseMax); - // equal case processed at call - } - break; - case ACTION_T_KILLED_MONSTER: - if (!sObjectMgr->GetCreatureTemplate(action.killed_monster.creatureId)) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existant creature entry %u.", i, j+1, action.killed_monster.creatureId); - if (action.killed_monster.target >= TARGET_T_END) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); - break; - case ACTION_T_SET_INST_DATA: - if (!(temp.event_flags & EFLAG_DIFFICULTY_ALL)) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u. Cannot set instance data without difficulty event flags.", i, j+1); - if (action.set_inst_data.value > 4/*SPECIAL*/) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u attempts to set instance data above encounter state 4. Custom case?", i, j+1); - break; - case ACTION_T_SET_INST_DATA64: - if (!(temp.event_flags & EFLAG_DIFFICULTY_ALL)) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u. Cannot set instance data without difficulty event flags.", i, j+1); - if (action.set_inst_data64.target >= TARGET_T_END) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); - break; - case ACTION_T_UPDATE_TEMPLATE: - if (!sObjectMgr->GetCreatureTemplate(action.update_template.creatureId)) - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existant creature entry %u.", i, j+1, action.update_template.creatureId); - break; - case ACTION_T_SET_SHEATH: - if (action.set_sheath.sheath >= MAX_SHEATH_STATE) - { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses wrong sheath state %u.", i, j+1, action.set_sheath.sheath); - action.set_sheath.sheath = SHEATH_STATE_UNARMED; - } - break; - case ACTION_T_SET_INVINCIBILITY_HP_LEVEL: - if (action.invincibility_hp_level.is_percent) - { - if (action.invincibility_hp_level.hp_level > 100) - { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses wrong percent value %u.", i, j+1, action.invincibility_hp_level.hp_level); - action.invincibility_hp_level.hp_level = 100; - } - } - break; - case ACTION_T_MOUNT_TO_ENTRY_OR_MODEL: - if (action.mount.creatureId != 0 || action.mount.modelId != 0) - { - if (action.mount.creatureId && !sObjectMgr->GetCreatureTemplate(action.mount.creatureId)) - { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses nonexistent Creature entry %u.", i, j+1, action.mount.creatureId); - action.morph.creatureId = 0; - } - - if (action.mount.modelId) - { - if (action.mount.creatureId) - { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u have unused ModelId %u with also set creature id %u.", i, j+1, action.mount.modelId, action.mount.creatureId); - action.mount.modelId = 0; - } - else if (!sCreatureDisplayInfoStore.LookupEntry(action.mount.modelId)) - { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses nonexistent ModelId %u.", i, j+1, action.mount.modelId); - action.mount.modelId = 0; - } - } - } - break; - case ACTION_T_EVADE: //No Params - case ACTION_T_FLEE_FOR_ASSIST: //No Params - case ACTION_T_DIE: //No Params - case ACTION_T_ZONE_COMBAT_PULSE: //No Params - case ACTION_T_FORCE_DESPAWN: //No Params - case ACTION_T_AUTO_ATTACK: //AllowAttackState (0 = stop attack, anything else means continue attacking) - case ACTION_T_COMBAT_MOVEMENT: //AllowCombatMovement (0 = stop combat based movement, anything else continue attacking) - case ACTION_T_RANGED_MOVEMENT: //Distance, Angle - case ACTION_T_CALL_FOR_HELP: //Distance - break; - - case ACTION_T_RANDOM_SAY: - case ACTION_T_RANDOM_YELL: - case ACTION_T_RANDOM_TEXTEMOTE: - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u currently unused ACTION type. Did you forget to update database?", i, j+1); - break; - - case ACTION_T_MOVE_RANDOM_POINT: - case ACTION_T_SET_STAND_STATE: - case ACTION_T_SET_PHASE_MASK: - case ACTION_T_SET_VISIBILITY: - case ACTION_T_SET_ACTIVE: - case ACTION_T_SET_AGGRESSIVE: - case ACTION_T_ATTACK_START_PULSE: - case ACTION_T_SUMMON_GO: - break; - - default: - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u have currently not checked at load action type (%u). Need check code update?", i, j+1, action.type); - break; - } - } - - //Add to list - m_CreatureEventAI_Event_Map[creature_id].push_back(temp); - ++count; - - } - while (result->NextRow()); - - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u CreatureEventAI scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); -} diff --git a/src/server/game/AI/EventAI/CreatureEventAIMgr.h b/src/server/game/AI/EventAI/CreatureEventAIMgr.h deleted file mode 100644 index 577958b6f5b..00000000000 --- a/src/server/game/AI/EventAI/CreatureEventAIMgr.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> - * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef TRINITY_CREATURE_EAI_MGR_H -#define TRINITY_CREATURE_EAI_MGR_H - -#include "Common.h" -#include "CreatureEventAI.h" - -class CreatureEventAIMgr -{ - friend class ACE_Singleton<CreatureEventAIMgr, ACE_Null_Mutex>; - - private: - CreatureEventAIMgr(){ } - ~CreatureEventAIMgr(){ } - - public: - void LoadCreatureEventAI_Texts(); - void LoadCreatureEventAI_Scripts(); - - CreatureEventAI_Event_Map const& GetCreatureEventAIMap() const { return m_CreatureEventAI_Event_Map; } - CreatureEventAI_TextMap const& GetCreatureEventAITextMap() const { return m_CreatureEventAI_TextMap; } - - private: - CreatureEventAI_Event_Map m_CreatureEventAI_Event_Map; - CreatureEventAI_TextMap m_CreatureEventAI_TextMap; -}; - -#define sEventAIMgr ACE_Singleton<CreatureEventAIMgr, ACE_Null_Mutex>::instance() -#endif diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp index 837129fdaa6..68c7869f8b7 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp @@ -1,9 +1,20 @@ -/* Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> +/* + * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> * - * Thanks to the original authors: ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * - * This program is free software licensed under GPL version 2 - * Please see the included DOCS/LICENSE.TXT for more information */ + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ #include "ScriptedCreature.h" #include "Item.h" @@ -159,7 +170,7 @@ void ScriptedAI::DoPlaySoundToSet(WorldObject* source, uint32 soundId) if (!sSoundEntriesStore.LookupEntry(soundId)) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "Invalid soundId %u used in DoPlaySoundToSet (Source: TypeId %u, GUID %u)", soundId, source->GetTypeId(), source->GetGUIDLow()); + TC_LOG_ERROR("scripts", "Invalid soundId %u used in DoPlaySoundToSet (Source: TypeId %u, GUID %u)", soundId, source->GetTypeId(), source->GetGUIDLow()); return; } @@ -252,7 +263,7 @@ void ScriptedAI::DoResetThreat() { if (!me->CanHaveThreatList() || me->getThreatManager().isThreatListEmpty()) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "DoResetThreat called for creature that either cannot have threat list or has empty threat list (me entry = %d)", me->GetEntry()); + TC_LOG_ERROR("scripts", "DoResetThreat called for creature that either cannot have threat list or has empty threat list (me entry = %d)", me->GetEntry()); return; } @@ -300,7 +311,7 @@ void ScriptedAI::DoTeleportPlayer(Unit* unit, float x, float y, float z, float o if (Player* player = unit->ToPlayer()) player->TeleportTo(unit->GetMapId(), x, y, z, o, TELE_TO_NOT_LEAVE_COMBAT); else - TC_LOG_ERROR(LOG_FILTER_TSCR, "Creature " UI64FMTD " (Entry: %u) Tried to teleport non-player unit (Type: %u GUID: " UI64FMTD ") to x: %f y:%f z: %f o: %f. Aborted.", + TC_LOG_ERROR("scripts", "Creature " UI64FMTD " (Entry: %u) Tried to teleport non-player unit (Type: %u GUID: " UI64FMTD ") to x: %f y:%f z: %f o: %f. Aborted.", me->GetGUID(), me->GetEntry(), unit->GetTypeId(), unit->GetGUID(), x, y, z, o); } @@ -433,7 +444,7 @@ bool ScriptedAI::EnterEvadeIfOutOfCombatArea(uint32 const diff) return false; break; default: // For most of creatures that certain area is their home area. - TC_LOG_INFO(LOG_FILTER_GENERAL, "TSCR: EnterEvadeIfOutOfCombatArea used for creature entry %u, but does not have any definition. Using the default one.", me->GetEntry()); + TC_LOG_INFO("misc", "TSCR: EnterEvadeIfOutOfCombatArea used for creature entry %u, but does not have any definition. Using the default one.", me->GetEntry()); uint32 homeAreaId = me->GetMap()->GetAreaId(me->GetHomePosition().GetPositionX(), me->GetHomePosition().GetPositionY(), me->GetHomePosition().GetPositionZ()); if (me->GetAreaId() == homeAreaId) return false; diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp index a21e7787197..dbc8989c530 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp @@ -1,6 +1,20 @@ -/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> - * This program is free software licensed under GPL version 2 - * Please see the included DOCS/LICENSE.TXT for more information */ +/* + * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ /* ScriptData SDName: Npc_EscortAI @@ -176,7 +190,7 @@ void npc_escortAI::EnterEvadeMode() { AddEscortState(STATE_ESCORT_RETURNING); ReturnToLastPoint(); - TC_LOG_DEBUG(LOG_FILTER_TSCR, "EscortAI has left combat and is now returning to last point"); + TC_LOG_DEBUG("scripts", "EscortAI has left combat and is now returning to last point"); } else { @@ -217,7 +231,7 @@ void npc_escortAI::UpdateAI(uint32 diff) { if (DespawnAtEnd) { - TC_LOG_DEBUG(LOG_FILTER_TSCR, "EscortAI reached end of waypoints"); + TC_LOG_DEBUG("scripts", "EscortAI reached end of waypoints"); if (m_bCanReturnToStart) { @@ -228,7 +242,7 @@ void npc_escortAI::UpdateAI(uint32 diff) m_uiWPWaitTimer = 0; - TC_LOG_DEBUG(LOG_FILTER_TSCR, "EscortAI are returning home to spawn location: %u, %f, %f, %f", POINT_HOME, fRetX, fRetY, fRetZ); + TC_LOG_DEBUG("scripts", "EscortAI are returning home to spawn location: %u, %f, %f, %f", POINT_HOME, fRetX, fRetY, fRetZ); return; } @@ -244,7 +258,7 @@ void npc_escortAI::UpdateAI(uint32 diff) } else { - TC_LOG_DEBUG(LOG_FILTER_TSCR, "EscortAI reached end of waypoints with Despawn off"); + TC_LOG_DEBUG("scripts", "EscortAI reached end of waypoints with Despawn off"); return; } @@ -253,7 +267,7 @@ void npc_escortAI::UpdateAI(uint32 diff) if (!HasEscortState(STATE_ESCORT_PAUSED)) { me->GetMotionMaster()->MovePoint(CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z); - TC_LOG_DEBUG(LOG_FILTER_TSCR, "EscortAI start waypoint %u (%f, %f, %f).", CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z); + TC_LOG_DEBUG("scripts", "EscortAI start waypoint %u (%f, %f, %f).", CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z); WaypointStart(CurrentWP->id); @@ -271,7 +285,7 @@ void npc_escortAI::UpdateAI(uint32 diff) { if (DespawnAtFar && !IsPlayerOrGroupInRange()) { - TC_LOG_DEBUG(LOG_FILTER_TSCR, "EscortAI failed because player/group was to far away or not found"); + TC_LOG_DEBUG("scripts", "EscortAI failed because player/group was to far away or not found"); if (m_bCanInstantRespawn) { @@ -309,7 +323,7 @@ void npc_escortAI::MovementInform(uint32 moveType, uint32 pointId) //Combat start position reached, continue waypoint movement if (pointId == POINT_LAST_POINT) { - TC_LOG_DEBUG(LOG_FILTER_TSCR, "EscortAI has returned to original position before combat"); + TC_LOG_DEBUG("scripts", "EscortAI has returned to original position before combat"); me->SetWalk(!m_bIsRunning); RemoveEscortState(STATE_ESCORT_RETURNING); @@ -319,7 +333,7 @@ void npc_escortAI::MovementInform(uint32 moveType, uint32 pointId) } else if (pointId == POINT_HOME) { - TC_LOG_DEBUG(LOG_FILTER_TSCR, "EscortAI has returned to original home location and will continue from beginning of waypoint list."); + TC_LOG_DEBUG("scripts", "EscortAI has returned to original home location and will continue from beginning of waypoint list."); CurrentWP = WaypointList.begin(); m_uiWPWaitTimer = 1; @@ -329,11 +343,11 @@ void npc_escortAI::MovementInform(uint32 moveType, uint32 pointId) //Make sure that we are still on the right waypoint if (CurrentWP->id != pointId) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "TSCR ERROR: EscortAI reached waypoint out of order %u, expected %u, creature entry %u", pointId, CurrentWP->id, me->GetEntry()); + TC_LOG_ERROR("misc", "TSCR ERROR: EscortAI reached waypoint out of order %u, expected %u, creature entry %u", pointId, CurrentWP->id, me->GetEntry()); return; } - TC_LOG_DEBUG(LOG_FILTER_TSCR, "EscortAI Waypoint %u reached", CurrentWP->id); + TC_LOG_DEBUG("scripts", "EscortAI Waypoint %u reached", CurrentWP->id); //Call WP function WaypointReached(CurrentWP->id); @@ -402,14 +416,14 @@ void npc_escortAI::SetRun(bool on) if (!m_bIsRunning) me->SetWalk(false); else - TC_LOG_DEBUG(LOG_FILTER_TSCR, "EscortAI attempt to set run mode, but is already running."); + TC_LOG_DEBUG("scripts", "EscortAI attempt to set run mode, but is already running."); } else { if (m_bIsRunning) me->SetWalk(true); else - TC_LOG_DEBUG(LOG_FILTER_TSCR, "EscortAI attempt to set walk mode, but is already walking."); + TC_LOG_DEBUG("scripts", "EscortAI attempt to set walk mode, but is already walking."); } m_bIsRunning = on; @@ -420,13 +434,13 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false { if (me->GetVictim()) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "TSCR ERROR: EscortAI (script: %s, creature entry: %u) attempts to Start while in combat", me->GetScriptName().c_str(), me->GetEntry()); + TC_LOG_ERROR("misc", "TSCR ERROR: EscortAI (script: %s, creature entry: %u) attempts to Start while in combat", me->GetScriptName().c_str(), me->GetEntry()); return; } if (HasEscortState(STATE_ESCORT_ESCORTING)) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "EscortAI (script: %s, creature entry: %u) attempts to Start while already escorting", me->GetScriptName().c_str(), me->GetEntry()); + TC_LOG_ERROR("scripts", "EscortAI (script: %s, creature entry: %u) attempts to Start while already escorting", me->GetScriptName().c_str(), me->GetEntry()); return; } @@ -439,7 +453,7 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false if (WaypointList.empty()) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "EscortAI (script: %s, creature entry: %u) starts with 0 waypoints (possible missing entry in script_waypoint. Quest: %u).", + TC_LOG_ERROR("scripts", "EscortAI (script: %s, creature entry: %u) starts with 0 waypoints (possible missing entry in script_waypoint. Quest: %u).", me->GetScriptName().c_str(), me->GetEntry(), quest ? quest->GetQuestId() : 0); return; } @@ -455,13 +469,13 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false m_bCanReturnToStart = canLoopPath; if (m_bCanReturnToStart && m_bCanInstantRespawn) - TC_LOG_DEBUG(LOG_FILTER_TSCR, "EscortAI is set to return home after waypoint end and instant respawn at waypoint end. Creature will never despawn."); + TC_LOG_DEBUG("scripts", "EscortAI is set to return home after waypoint end and instant respawn at waypoint end. Creature will never despawn."); if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE) { me->GetMotionMaster()->MovementExpired(); me->GetMotionMaster()->MoveIdle(); - TC_LOG_DEBUG(LOG_FILTER_TSCR, "EscortAI start with WAYPOINT_MOTION_TYPE, changed to MoveIdle."); + TC_LOG_DEBUG("scripts", "EscortAI start with WAYPOINT_MOTION_TYPE, changed to MoveIdle."); } //disable npcflags @@ -472,7 +486,7 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); } - TC_LOG_DEBUG(LOG_FILTER_TSCR, "EscortAI started with " UI64FMTD " waypoints. ActiveAttacker = %d, Run = %d, PlayerGUID = " UI64FMTD "", uint64(WaypointList.size()), m_bIsActiveAttacker, m_bIsRunning, m_uiPlayerGUID); + TC_LOG_DEBUG("scripts", "EscortAI started with " UI64FMTD " waypoints. ActiveAttacker = %d, Run = %d, PlayerGUID = " UI64FMTD "", uint64(WaypointList.size()), m_bIsActiveAttacker, m_bIsRunning, m_uiPlayerGUID); CurrentWP = WaypointList.begin(); diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h index 4b0f4e97a1c..280990fd648 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h @@ -1,6 +1,20 @@ -/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> - * This program is free software licensed under GPL version 2 - * Please see the included DOCS/LICENSE.TXT for more information */ +/* + * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ #ifndef SC_ESCORTAI_H #define SC_ESCORTAI_H diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp index a5176644f34..5cc128fda5f 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp @@ -1,6 +1,20 @@ -/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> - * This program is free software licensed under GPL version 2 - * Please see the included DOCS/LICENSE.TXT for more information */ +/* + * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ /* ScriptData SDName: FollowerAI @@ -166,7 +180,7 @@ void FollowerAI::EnterEvadeMode() if (HasFollowState(STATE_FOLLOW_INPROGRESS)) { - TC_LOG_DEBUG(LOG_FILTER_TSCR, "FollowerAI left combat, returning to CombatStartPosition."); + TC_LOG_DEBUG("scripts", "FollowerAI left combat, returning to CombatStartPosition."); if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE) { @@ -192,7 +206,7 @@ void FollowerAI::UpdateAI(uint32 uiDiff) { if (HasFollowState(STATE_FOLLOW_COMPLETE) && !HasFollowState(STATE_FOLLOW_POSTEVENT)) { - TC_LOG_DEBUG(LOG_FILTER_TSCR, "FollowerAI is set completed, despawns."); + TC_LOG_DEBUG("scripts", "FollowerAI is set completed, despawns."); me->DespawnOrUnsummon(); return; } @@ -203,7 +217,7 @@ void FollowerAI::UpdateAI(uint32 uiDiff) { if (HasFollowState(STATE_FOLLOW_RETURNING)) { - TC_LOG_DEBUG(LOG_FILTER_TSCR, "FollowerAI is returning to leader."); + TC_LOG_DEBUG("scripts", "FollowerAI is returning to leader."); RemoveFollowState(STATE_FOLLOW_RETURNING); me->GetMotionMaster()->MoveFollow(player, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); @@ -232,7 +246,7 @@ void FollowerAI::UpdateAI(uint32 uiDiff) if (bIsMaxRangeExceeded) { - TC_LOG_DEBUG(LOG_FILTER_TSCR, "FollowerAI failed because player/group was to far away or not found"); + TC_LOG_DEBUG("scripts", "FollowerAI failed because player/group was to far away or not found"); me->DespawnOrUnsummon(); return; } @@ -275,13 +289,13 @@ void FollowerAI::StartFollow(Player* player, uint32 factionForFollower, const Qu { if (me->GetVictim()) { - TC_LOG_DEBUG(LOG_FILTER_TSCR, "FollowerAI attempt to StartFollow while in combat."); + TC_LOG_DEBUG("scripts", "FollowerAI attempt to StartFollow while in combat."); return; } if (HasFollowState(STATE_FOLLOW_INPROGRESS)) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "FollowerAI attempt to StartFollow while already following."); + TC_LOG_ERROR("scripts", "FollowerAI attempt to StartFollow while already following."); return; } @@ -297,7 +311,7 @@ void FollowerAI::StartFollow(Player* player, uint32 factionForFollower, const Qu { me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveIdle(); - TC_LOG_DEBUG(LOG_FILTER_TSCR, "FollowerAI start with WAYPOINT_MOTION_TYPE, set to MoveIdle."); + TC_LOG_DEBUG("scripts", "FollowerAI start with WAYPOINT_MOTION_TYPE, set to MoveIdle."); } me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); @@ -306,7 +320,7 @@ void FollowerAI::StartFollow(Player* player, uint32 factionForFollower, const Qu me->GetMotionMaster()->MoveFollow(player, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); - TC_LOG_DEBUG(LOG_FILTER_TSCR, "FollowerAI start follow %s (GUID " UI64FMTD ")", player->GetName().c_str(), m_uiLeaderGUID); + TC_LOG_DEBUG("scripts", "FollowerAI start follow %s (GUID " UI64FMTD ")", player->GetName().c_str(), m_uiLeaderGUID); } Player* FollowerAI::GetLeaderForFollower() @@ -325,7 +339,7 @@ Player* FollowerAI::GetLeaderForFollower() if (member && member->IsAlive() && me->IsWithinDistInMap(member, MAX_PLAYER_DISTANCE)) { - TC_LOG_DEBUG(LOG_FILTER_TSCR, "FollowerAI GetLeader changed and returned new leader."); + TC_LOG_DEBUG("scripts", "FollowerAI GetLeader changed and returned new leader."); m_uiLeaderGUID = member->GetGUID(); return member; } @@ -334,7 +348,7 @@ Player* FollowerAI::GetLeaderForFollower() } } - TC_LOG_DEBUG(LOG_FILTER_TSCR, "FollowerAI GetLeader can not find suitable leader."); + TC_LOG_DEBUG("scripts", "FollowerAI GetLeader can not find suitable leader."); return NULL; } diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h index cdd6d31c0b4..c1fa3275bb8 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h +++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h @@ -1,6 +1,20 @@ -/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> - * This program is free software licensed under GPL version 2 - * Please see the included DOCS/LICENSE.TXT for more information */ +/* + * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ #ifndef SC_FOLLOWERAI_H #define SC_FOLLOWERAI_H diff --git a/src/server/game/AI/ScriptedAI/ScriptedGossip.h b/src/server/game/AI/ScriptedAI/ScriptedGossip.h index 93add2ae652..5e76c1f83f4 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedGossip.h +++ b/src/server/game/AI/ScriptedAI/ScriptedGossip.h @@ -1,9 +1,20 @@ -/* Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> +/* + * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> * - * Thanks to the original authors: ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. * - * This program is free software licensed under GPL version 2 - * Please see the included DOCS/LICENSE.TXT for more information */ + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ #ifndef SC_GOSSIP_H #define SC_GOSSIP_H diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index 4ec0a3e52f2..1ced9e79672 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -67,7 +67,10 @@ SmartAI::SmartAI(Creature* c) : CreatureAI(c) mFollowCredit = 0; mFollowArrivedEntry = 0; mFollowCreditType = 0; + mFollowArrivedTimer = 0; mInvincibilityHpLevel = 0; + + mJustReset = false; } void SmartAI::UpdateDespawn(const uint32 diff) @@ -88,13 +91,6 @@ void SmartAI::UpdateDespawn(const uint32 diff) } else mDespawnTime -= diff; } -void SmartAI::Reset() -{ - if (!HasEscortState(SMART_ESCORT_ESCORTING))//dont mess up escort movement after combat - SetRun(mRun); - GetScript()->OnReset(); -} - WayPoint* SmartAI::GetNextWayPoint() { if (!mWayPoints || mWayPoints->empty()) @@ -107,7 +103,7 @@ WayPoint* SmartAI::GetNextWayPoint() mLastWP = (*itr).second; if (mLastWP->id != mCurrentWPID) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "SmartAI::GetNextWayPoint: Got not expected waypoint id %u, expected %u", mLastWP->id, mCurrentWPID); + TC_LOG_ERROR("misc", "SmartAI::GetNextWayPoint: Got not expected waypoint id %u, expected %u", mLastWP->id, mCurrentWPID); } return (*itr).second; } @@ -118,7 +114,7 @@ void SmartAI::StartPath(bool run, uint32 path, bool repeat, Unit* /*invoker*/) { if (me->IsInCombat())// no wp movement in combat { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "SmartAI::StartPath: Creature entry %u wanted to start waypoint movement while in combat, ignoring.", me->GetEntry()); + TC_LOG_ERROR("misc", "SmartAI::StartPath: Creature entry %u wanted to start waypoint movement while in combat, ignoring.", me->GetEntry()); return; } if (HasEscortState(SMART_ESCORT_ESCORTING)) @@ -162,7 +158,7 @@ void SmartAI::PausePath(uint32 delay, bool forced) return; if (HasEscortState(SMART_ESCORT_PAUSED)) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "SmartAI::StartPath: Creature entry %u wanted to pause waypoint movement while already paused, ignoring.", me->GetEntry()); + TC_LOG_ERROR("misc", "SmartAI::StartPath: Creature entry %u wanted to pause waypoint movement while already paused, ignoring.", me->GetEntry()); return; } mForcedPaused = forced; @@ -343,27 +339,10 @@ void SmartAI::UpdateAI(uint32 diff) { if (me->FindNearestCreature(mFollowArrivedEntry, INTERACTION_DISTANCE, true)) { - if (Player* player = ObjectAccessor::GetPlayer(*me, mFollowGuid)) - { - if (!mFollowCreditType) - player->RewardPlayerAndGroupAtEvent(mFollowCredit, me); - else - player->GroupEventHappens(mFollowCredit, me); - } - mFollowGuid = 0; - mFollowDist = 0; - mFollowAngle = 0; - mFollowCredit = 0; - mFollowArrivedTimer = 1000; - mFollowArrivedEntry = 0; - mFollowCreditType = 0; - SetDespawnTime(5000); - me->StopMoving(); - me->GetMotionMaster()->MoveIdle(); - StartDespawn(); - GetScript()->ProcessEventsFor(SMART_EVENT_FOLLOW_COMPLETED); + StopFollow(); return; } + mFollowArrivedTimer = 1000; } else @@ -460,7 +439,6 @@ void SmartAI::EnterEvadeMode() me->LoadCreaturesAddon(); me->SetLootRecipient(NULL); me->ResetPlayerDamageReq(); - GetScript()->ProcessEventsFor(SMART_EVENT_EVADE);//must be after aura clear so we can cast spells from db SetRun(mRun); @@ -477,7 +455,8 @@ void SmartAI::EnterEvadeMode() else me->GetMotionMaster()->MoveTargetedHome(); - Reset(); + if (!HasEscortState(SMART_ESCORT_ESCORTING))//dont mess up escort movement after combat + SetRun(mRun); } void SmartAI::MoveInLineOfSight(Unit* who) @@ -568,7 +547,8 @@ void SmartAI::JustRespawned() if (me->getFaction() != me->GetCreatureTemplate()->faction_A) me->RestoreFaction(); GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN); - Reset(); + mJustReset = true; + JustReachedHome(); mFollowGuid = 0;//do not reset follower on Reset(), we need it after combat evade mFollowDist = 0; mFollowAngle = 0; @@ -587,7 +567,17 @@ int SmartAI::Permissible(const Creature* creature) void SmartAI::JustReachedHome() { - GetScript()->ProcessEventsFor(SMART_EVENT_REACHED_HOME); + GetScript()->OnReset(); + + if (!mJustReset) + { + GetScript()->ProcessEventsFor(SMART_EVENT_REACHED_HOME); + + if (!UpdateVictim() && me->GetMotionMaster()->GetCurrentMovementGeneratorType() == IDLE_MOTION_TYPE && me->GetWaypointPath()) + me->ToCreature()->GetMotionMaster()->MovePath(me->GetWaypointPath(), true); + } + + mJustReset = false; } void SmartAI::EnterCombat(Unit* enemy) @@ -595,6 +585,9 @@ void SmartAI::EnterCombat(Unit* enemy) me->InterruptNonMeleeSpells(false); // must be before ProcessEvents GetScript()->ProcessEventsFor(SMART_EVENT_AGGRO, enemy); me->GetPosition(&mLastOOCPos); + SetRun(mRun); + if (me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_ACTIVE) == POINT_MOTION_TYPE) + me->GetMotionMaster()->MovementExpired(); } void SmartAI::JustDied(Unit* killer) @@ -616,16 +609,10 @@ void SmartAI::JustSummoned(Creature* creature) void SmartAI::AttackStart(Unit* who) { - if (who && me->Attack(who, true)) + if (who && me->Attack(who, me->IsWithinMeleeRange(who))) { - SetRun(mRun); - if (me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_ACTIVE) == POINT_MOTION_TYPE) - me->GetMotionMaster()->MovementExpired(); - if (mCanCombatMove) me->GetMotionMaster()->MoveChase(who); - - me->GetPosition(&mLastOOCPos); } } @@ -690,7 +677,8 @@ void SmartAI::InitializeAI() { GetScript()->OnInitialize(me); if (!me->isDead()) - Reset(); + mJustReset = true; + JustReachedHome(); GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN); } @@ -787,6 +775,8 @@ void SmartAI::SetCombatMove(bool on) } else { + me->GetMotionMaster()->MovementExpired(); + me->GetMotionMaster()->Clear(true); me->StopMoving(); me->GetMotionMaster()->MoveIdle(); } @@ -796,7 +786,11 @@ void SmartAI::SetCombatMove(bool on) void SmartAI::SetFollow(Unit* target, float dist, float angle, uint32 credit, uint32 end, uint32 creditType) { if (!target) + { + StopFollow(); return; + } + SetRun(mRun); mFollowGuid = target->GetGUID(); mFollowDist = dist >= 0.0f ? dist : PET_FOLLOW_DIST; @@ -808,6 +802,29 @@ void SmartAI::SetFollow(Unit* target, float dist, float angle, uint32 credit, ui mFollowCreditType = creditType; } +void SmartAI::StopFollow() +{ + if (Player* player = ObjectAccessor::GetPlayer(*me, mFollowGuid)) + { + if (!mFollowCreditType) + player->RewardPlayerAndGroupAtEvent(mFollowCredit, me); + else + player->GroupEventHappens(mFollowCredit, me); + } + + mFollowGuid = 0; + mFollowDist = 0; + mFollowAngle = 0; + mFollowCredit = 0; + mFollowArrivedTimer = 1000; + mFollowArrivedEntry = 0; + mFollowCreditType = 0; + SetDespawnTime(5000); + me->StopMoving(); + me->GetMotionMaster()->MoveIdle(); + StartDespawn(); + GetScript()->ProcessEventsFor(SMART_EVENT_FOLLOW_COMPLETED); +} void SmartAI::SetScript9(SmartScriptHolder& e, uint32 entry, Unit* invoker) { if (invoker) @@ -855,7 +872,7 @@ void SmartGameObjectAI::Reset() // Called when a player opens a gossip dialog with the gameobject. bool SmartGameObjectAI::GossipHello(Player* player) { - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartGameObjectAI::GossipHello"); + TC_LOG_DEBUG("scripts.ai", "SmartGameObjectAI::GossipHello"); GetScript()->ProcessEventsFor(SMART_EVENT_GOSSIP_HELLO, player, 0, 0, false, NULL, go); return false; } @@ -934,7 +951,7 @@ class SmartTrigger : public AreaTriggerScript if (!player->IsAlive()) return false; - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "AreaTrigger %u is using SmartTrigger script", trigger->id); + TC_LOG_DEBUG("scripts.ai", "AreaTrigger %u is using SmartTrigger script", trigger->id); SmartScript script; script.OnInitialize(NULL, trigger); script.ProcessEventsFor(SMART_EVENT_AREATRIGGER_ONTRIGGER, player, trigger->id); diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h index ae6719aa8f3..5c56736a673 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.h +++ b/src/server/game/AI/SmartScripts/SmartAI.h @@ -56,13 +56,14 @@ class SmartAI : public CreatureAI void EndPath(bool fail = false); void ResumePath(); WayPoint* GetNextWayPoint(); - bool HasEscortState(uint32 uiEscortState) { return (mEscortState & uiEscortState); } + bool HasEscortState(uint32 uiEscortState) const { return (mEscortState & uiEscortState) != 0; } void AddEscortState(uint32 uiEscortState) { mEscortState |= uiEscortState; } void RemoveEscortState(uint32 uiEscortState) { mEscortState &= ~uiEscortState; } void SetAutoAttack(bool on) { mCanAutoAttack = on; } void SetCombatMove(bool on); bool CanCombatMove() { return mCanCombatMove; } void SetFollow(Unit* target, float dist = 0.0f, float angle = 0.0f, uint32 credit = 0, uint32 end = 0, uint32 creditType = 0); + void StopFollow(); void SetScript9(SmartScriptHolder& e, uint32 entry, Unit* invoker); SmartScript* GetScript() { return &mScript; } @@ -71,10 +72,7 @@ class SmartAI : public CreatureAI // Called when creature is spawned or respawned void JustRespawned(); - // Called after InitializeAI(), EnterEvadeMode() for resetting variables - void Reset(); - - // Called at reaching home after evade + // Called at reaching home after evade, InitializeAI(), EnterEvadeMode() for resetting variables void JustReachedHome(); // Called for reaction at enter to combat if not in combat yet (enemy can be NULL) @@ -232,6 +230,7 @@ class SmartAI : public CreatureAI uint32 mDespawnState; void UpdateDespawn(const uint32 diff); uint32 mEscortInvokerCheckTimer; + bool mJustReset; }; class SmartGameObjectAI : public GameObjectAI diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index d064c5e62bc..44da73482a7 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -155,7 +155,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u mLastInvoker = unit->GetGUID(); if (Unit* tempInvoker = GetLastInvoker()) - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: Invoker: %s (guidlow: %u)", tempInvoker->GetName().c_str(), tempInvoker->GetGUIDLow()); + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction: Invoker: %s (guidlow: %u)", tempInvoker->GetName().c_str(), tempInvoker->GetGUIDLow()); switch (e.GetActionType()) { @@ -168,12 +168,12 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u { for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) { - if (IsCreature((*itr)) && !(*itr)->ToCreature()->IsPet()) // Prevented sending text to pets. + if (IsCreature(*itr) && !(*itr)->ToCreature()->IsPet()) // Prevented sending text to pets. { talker = (*itr)->ToCreature(); break; } - else if (IsPlayer((*itr))) + else if (IsPlayer(*itr)) { targetPlayer = (*itr)->ToPlayer(); break; @@ -198,7 +198,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u mUseTextTimer = true; sCreatureTextMgr->SendChat(talker, uint8(e.action.talk.textGroupID), mTextGUID); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_TALK: talker: %s (GuidLow: %u), textGuid: %u", + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction: SMART_ACTION_TALK: talker: %s (GuidLow: %u), textGuid: %u", talker->GetName().c_str(), talker->GetGUIDLow(), GUID_LOPART(mTextGUID)); break; } @@ -216,7 +216,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u Unit* templastInvoker = GetLastInvoker(); sCreatureTextMgr->SendChat(me, uint8(e.action.talk.textGroupID), IsPlayer(templastInvoker) ? templastInvoker->GetGUID() : 0, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_NORMAL, 0, TEAM_OTHER, false, (*itr)->ToPlayer()); } - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SIMPLE_TALK: talker: %s (GuidLow: %u), textGroupId: %u", + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_SIMPLE_TALK: talker: %s (GuidLow: %u), textGroupId: %u", (*itr)->GetName().c_str(), (*itr)->GetGUIDLow(), uint8(e.action.talk.textGroupID)); } @@ -234,7 +234,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (IsUnit(*itr)) { (*itr)->ToUnit()->HandleEmoteCommand(e.action.emote.emote); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_PLAY_EMOTE: target: %s (GuidLow: %u), emote: %u", + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_PLAY_EMOTE: target: %s (GuidLow: %u), emote: %u", (*itr)->GetName().c_str(), (*itr)->GetGUIDLow(), e.action.emote.emote); } } @@ -253,7 +253,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (IsUnit(*itr)) { (*itr)->SendPlaySound(e.action.sound.sound, e.action.sound.onlySelf > 0); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SOUND: target: %s (GuidLow: %u), sound: %u, onlyself: %u", + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_SOUND: target: %s (GuidLow: %u), sound: %u, onlyself: %u", (*itr)->GetName().c_str(), (*itr)->GetGUIDLow(), e.action.sound.sound, e.action.sound.onlySelf); } } @@ -274,7 +274,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (e.action.faction.factionID) { (*itr)->ToCreature()->setFaction(e.action.faction.factionID); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SET_FACTION: Creature entry %u, GuidLow %u set faction to %u", + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_SET_FACTION: Creature entry %u, GuidLow %u set faction to %u", (*itr)->GetEntry(), (*itr)->GetGUIDLow(), e.action.faction.factionID); } else @@ -284,7 +284,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if ((*itr)->ToCreature()->getFaction() != ci->faction_A) { (*itr)->ToCreature()->setFaction(ci->faction_A); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SET_FACTION: Creature entry %u, GuidLow %u set faction to %u", + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_SET_FACTION: Creature entry %u, GuidLow %u set faction to %u", (*itr)->GetEntry(), (*itr)->GetGUIDLow(), ci->faction_A); } } @@ -316,7 +316,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u { uint32 displayId = ObjectMgr::ChooseDisplayId(ci); (*itr)->ToCreature()->SetDisplayId(displayId); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_MORPH_TO_ENTRY_OR_MODEL: Creature entry %u, GuidLow %u set displayid to %u", + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_MORPH_TO_ENTRY_OR_MODEL: Creature entry %u, GuidLow %u set displayid to %u", (*itr)->GetEntry(), (*itr)->GetGUIDLow(), displayId); } } @@ -324,14 +324,14 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u else { (*itr)->ToCreature()->SetDisplayId(e.action.morphOrMount.model); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_MORPH_TO_ENTRY_OR_MODEL: Creature entry %u, GuidLow %u set displayid to %u", + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_MORPH_TO_ENTRY_OR_MODEL: Creature entry %u, GuidLow %u set displayid to %u", (*itr)->GetEntry(), (*itr)->GetGUIDLow(), e.action.morphOrMount.model); } } else { (*itr)->ToCreature()->DeMorph(); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_MORPH_TO_ENTRY_OR_MODEL: Creature entry %u, GuidLow %u demorphs.", + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_MORPH_TO_ENTRY_OR_MODEL: Creature entry %u, GuidLow %u demorphs.", (*itr)->GetEntry(), (*itr)->GetGUIDLow()); } } @@ -350,7 +350,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (IsPlayer(*itr)) { (*itr)->ToPlayer()->FailQuest(e.action.quest.quest); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_FAIL_QUEST: Player guidLow %u fails quest %u", + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_FAIL_QUEST: Player guidLow %u fails quest %u", (*itr)->GetGUIDLow(), e.action.quest.quest); } } @@ -367,12 +367,14 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) { if (IsPlayer(*itr)) + { if (Quest const* q = sObjectMgr->GetQuestTemplate(e.action.quest.quest)) { - (*itr)->ToPlayer()->AddQuest(q, NULL); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_ADD_QUEST: Player guidLow %u add quest %u", + (*itr)->ToPlayer()->AddQuestAndCheckCompletion(q, NULL); + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_ADD_QUEST: Player guidLow %u add quest %u", (*itr)->GetGUIDLow(), e.action.quest.quest); } + } } delete targets; @@ -380,12 +382,19 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u } case SMART_ACTION_SET_REACT_STATE: { - if (!me) + ObjectList* targets = GetTargets(e, unit); + if (!targets) break; - me->SetReactState(ReactStates(e.action.react.state)); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SET_REACT_STATE: Creature guidLow %u set reactstate %u", - me->GetGUIDLow(), e.action.react.state); + for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) + { + if (!IsCreature(*itr)) + continue; + + (*itr)->ToCreature()->SetReactState(ReactStates(e.action.react.state)); + } + + delete targets; break; } case SMART_ACTION_RANDOM_EMOTE: @@ -424,7 +433,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u { uint32 emote = temp[urand(0, count - 1)]; (*itr)->ToUnit()->HandleEmoteCommand(emote); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_RANDOM_EMOTE: Creature guidLow %u handle random emote %u", + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_RANDOM_EMOTE: Creature guidLow %u handle random emote %u", (*itr)->GetGUIDLow(), emote); } } @@ -443,7 +452,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (Unit* target = Unit::GetUnit(*me, (*i)->getUnitGuid())) { me->getThreatManager().modifyThreatPercent(target, e.action.threatPCT.threatINC ? (int32)e.action.threatPCT.threatINC : -(int32)e.action.threatPCT.threatDEC); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_THREAT_ALL_PCT: Creature guidLow %u modify threat for unit %u, value %i", + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_THREAT_ALL_PCT: Creature guidLow %u modify threat for unit %u, value %i", me->GetGUIDLow(), target->GetGUIDLow(), e.action.threatPCT.threatINC ? (int32)e.action.threatPCT.threatINC : -(int32)e.action.threatPCT.threatDEC); } } @@ -463,7 +472,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (IsUnit(*itr)) { me->getThreatManager().modifyThreatPercent((*itr)->ToUnit(), e.action.threatPCT.threatINC ? (int32)e.action.threatPCT.threatINC : -(int32)e.action.threatPCT.threatDEC); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_THREAT_SINGLE_PCT: Creature guidLow %u modify threat for unit %u, value %i", + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_THREAT_SINGLE_PCT: Creature guidLow %u modify threat for unit %u, value %i", me->GetGUIDLow(), (*itr)->GetGUIDLow(), e.action.threatPCT.threatINC ? (int32)e.action.threatPCT.threatINC : -(int32)e.action.threatPCT.threatDEC); } } @@ -489,7 +498,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (IsPlayer(*itr)) { (*itr)->ToPlayer()->AreaExploredOrEventHappens(e.action.quest.quest); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_CALL_AREAEXPLOREDOREVENTHAPPENS: Player guidLow %u credited quest %u", + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_CALL_AREAEXPLOREDOREVENTHAPPENS: Player guidLow %u credited quest %u", (*itr)->GetGUIDLow(), e.action.quest.quest); } } @@ -516,12 +525,31 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (e.action.cast.flags & SMARTCAST_INTERRUPT_PREVIOUS) me->InterruptNonMeleeSpells(false); + if (e.action.cast.flags & SMARTCAST_COMBAT_MOVE) + { + // If cast flag SMARTCAST_COMBAT_MOVE is set combat movement will not be allowed + // unless target is outside spell range, out of mana, or LOS. + + bool _allowMove = false; + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(e.action.cast.spell); + int32 mana = me->GetPower(POWER_MANA); + + if (me->GetDistance(*itr) > spellInfo->GetMaxRange(true) || + me->GetDistance(*itr) < spellInfo->GetMinRange(true) || + !me->IsWithinLOSInMap(*itr) || + mana < spellInfo->CalcPowerCost(me, spellInfo->GetSchoolMask())) + _allowMove = true; + + CAST_AI(SmartAI, me->AI())->SetCombatMove(_allowMove); + } + me->CastSpell((*itr)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED)); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_CAST:: Creature %u casts spell %u on target %u with castflags %u", + + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_CAST:: Creature %u casts spell %u on target %u with castflags %u", me->GetGUIDLow(), e.action.cast.spell, (*itr)->GetGUIDLow(), e.action.cast.flags); } else - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "Spell %u not casted because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (Guid: " UI64FMTD " Entry: %u Type: %u) already has the aura", e.action.cast.spell, (*itr)->GetGUID(), (*itr)->GetEntry(), uint32((*itr)->GetTypeId())); + TC_LOG_DEBUG("scripts.ai", "Spell %u not casted because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (Guid: " UI64FMTD " Entry: %u Type: %u) already has the aura", e.action.cast.spell, (*itr)->GetGUID(), (*itr)->GetEntry(), uint32((*itr)->GetTypeId())); } delete targets; @@ -542,17 +570,17 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (!IsUnit(*itr)) continue; - if (!(e.action.cast.flags & SMARTCAST_AURA_NOT_PRESENT) || !(*itr)->ToUnit()->HasAura(e.action.cast.spell)) - { - if (e.action.cast.flags & SMARTCAST_INTERRUPT_PREVIOUS) - tempLastInvoker->InterruptNonMeleeSpells(false); + if (!(e.action.cast.flags & SMARTCAST_AURA_NOT_PRESENT) || !(*itr)->ToUnit()->HasAura(e.action.cast.spell)) + { + if (e.action.cast.flags & SMARTCAST_INTERRUPT_PREVIOUS) + tempLastInvoker->InterruptNonMeleeSpells(false); - tempLastInvoker->CastSpell((*itr)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED)); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_INVOKER_CAST: Invoker %u casts spell %u on target %u with castflags %u", - tempLastInvoker->GetGUIDLow(), e.action.cast.spell, (*itr)->GetGUIDLow(), e.action.cast.flags); - } - else - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "Spell %u not casted because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (Guid: " UI64FMTD " Entry: %u Type: %u) already has the aura", e.action.cast.spell, (*itr)->GetGUID(), (*itr)->GetEntry(), uint32((*itr)->GetTypeId())); + tempLastInvoker->CastSpell((*itr)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED)); + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_INVOKER_CAST: Invoker %u casts spell %u on target %u with castflags %u", + tempLastInvoker->GetGUIDLow(), e.action.cast.spell, (*itr)->GetGUIDLow(), e.action.cast.flags); + } + else + TC_LOG_DEBUG("scripts.ai", "Spell %u not casted because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (Guid: " UI64FMTD " Entry: %u Type: %u) already has the aura", e.action.cast.spell, (*itr)->GetGUID(), (*itr)->GetEntry(), uint32((*itr)->GetTypeId())); } delete targets; @@ -569,7 +597,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (IsUnit(*itr)) { (*itr)->ToUnit()->AddAura(e.action.cast.spell, (*itr)->ToUnit()); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_ADD_AURA: Adding aura %u to unit %u", + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_ADD_AURA: Adding aura %u to unit %u", e.action.cast.spell, (*itr)->GetGUIDLow()); } } @@ -590,7 +618,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u // Activate (*itr)->ToGameObject()->SetLootState(GO_READY); (*itr)->ToGameObject()->UseDoorOrButton(0, false, unit); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_ACTIVATE_GOBJECT. Gameobject %u (entry: %u) activated", + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_ACTIVATE_GOBJECT. Gameobject %u (entry: %u) activated", (*itr)->GetGUIDLow(), (*itr)->GetEntry()); } } @@ -609,7 +637,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (IsGameObject(*itr)) { (*itr)->ToGameObject()->ResetDoorOrButton(); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_RESET_GOBJECT. Gameobject %u (entry: %u) reset", + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_RESET_GOBJECT. Gameobject %u (entry: %u) reset", (*itr)->GetGUIDLow(), (*itr)->GetEntry()); } } @@ -628,7 +656,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (IsUnit(*itr)) { (*itr)->ToUnit()->SetUInt32Value(UNIT_NPC_EMOTESTATE, e.action.emote.emote); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SET_EMOTE_STATE. Unit %u set emotestate to %u", + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_SET_EMOTE_STATE. Unit %u set emotestate to %u", (*itr)->GetGUIDLow(), e.action.emote.emote); } } @@ -649,13 +677,13 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (!e.action.unitFlag.type) { (*itr)->ToUnit()->SetFlag(UNIT_FIELD_FLAGS, e.action.unitFlag.flag); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SET_UNIT_FLAG. Unit %u added flag %u to UNIT_FIELD_FLAGS", + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_SET_UNIT_FLAG. Unit %u added flag %u to UNIT_FIELD_FLAGS", (*itr)->GetGUIDLow(), e.action.unitFlag.flag); } else { (*itr)->ToUnit()->SetFlag(UNIT_FIELD_FLAGS_2, e.action.unitFlag.flag); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SET_UNIT_FLAG. Unit %u added flag %u to UNIT_FIELD_FLAGS_2", + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_SET_UNIT_FLAG. Unit %u added flag %u to UNIT_FIELD_FLAGS_2", (*itr)->GetGUIDLow(), e.action.unitFlag.flag); } } @@ -677,13 +705,13 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (!e.action.unitFlag.type) { (*itr)->ToUnit()->RemoveFlag(UNIT_FIELD_FLAGS, e.action.unitFlag.flag); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_REMOVE_UNIT_FLAG. Unit %u removed flag %u to UNIT_FIELD_FLAGS", + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_REMOVE_UNIT_FLAG. Unit %u removed flag %u to UNIT_FIELD_FLAGS", (*itr)->GetGUIDLow(), e.action.unitFlag.flag); } else { (*itr)->ToUnit()->RemoveFlag(UNIT_FIELD_FLAGS_2, e.action.unitFlag.flag); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_REMOVE_UNIT_FLAG. Unit %u removed flag %u to UNIT_FIELD_FLAGS_2", + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_REMOVE_UNIT_FLAG. Unit %u removed flag %u to UNIT_FIELD_FLAGS_2", (*itr)->GetGUIDLow(), e.action.unitFlag.flag); } } @@ -698,7 +726,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u break; CAST_AI(SmartAI, me->AI())->SetAutoAttack(e.action.autoAttack.attack); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_AUTO_ATTACK: Creature: %u bool on = %u", + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_AUTO_ATTACK: Creature: %u bool on = %u", me->GetGUIDLow(), e.action.autoAttack.attack); break; } @@ -709,7 +737,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u bool move = e.action.combatMove.move; CAST_AI(SmartAI, me->AI())->SetCombatMove(move); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_ALLOW_COMBAT_MOVEMENT: Creature %u bool on = %u", + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_ALLOW_COMBAT_MOVEMENT: Creature %u bool on = %u", me->GetGUIDLow(), e.action.combatMove.move); break; } @@ -719,7 +747,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u break; SetPhase(e.action.setEventPhase.phase); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SET_EVENT_PHASE: Creature %u set event phase %u", + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_SET_EVENT_PHASE: Creature %u set event phase %u", GetBaseObject()->GetGUIDLow(), e.action.setEventPhase.phase); break; } @@ -730,7 +758,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u IncPhase(e.action.incEventPhase.inc); DecPhase(e.action.incEventPhase.dec); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_INC_EVENT_PHASE: Creature %u inc event phase by %u, " + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_INC_EVENT_PHASE: Creature %u inc event phase by %u, " "decrease by %u", GetBaseObject()->GetGUIDLow(), e.action.incEventPhase.inc, e.action.incEventPhase.dec); break; } @@ -740,7 +768,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u break; me->AI()->EnterEvadeMode(); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_EVADE: Creature %u EnterEvadeMode", me->GetGUIDLow()); + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_EVADE: Creature %u EnterEvadeMode", me->GetGUIDLow()); break; } case SMART_ACTION_FLEE_FOR_ASSIST: @@ -754,7 +782,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u TrinityStringTextBuilder builder(me, CHAT_MSG_MONSTER_EMOTE, LANG_FLEE, LANG_UNIVERSAL, 0); sCreatureTextMgr->SendChatPacket(me, builder, CHAT_MSG_MONSTER_EMOTE); } - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_FLEE_FOR_ASSIST: Creature %u DoFleeToGetAssistance", me->GetGUIDLow()); + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_FLEE_FOR_ASSIST: Creature %u DoFleeToGetAssistance", me->GetGUIDLow()); break; } case SMART_ACTION_CALL_GROUPEVENTHAPPENS: @@ -765,7 +793,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (IsPlayer(unit) && GetBaseObject()) { unit->ToPlayer()->GroupEventHappens(e.action.quest.quest, GetBaseObject()); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_CALL_GROUPEVENTHAPPENS: Player %u, group credit for quest %u", + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction: SMART_ACTION_CALL_GROUPEVENTHAPPENS: Player %u, group credit for quest %u", unit->GetGUIDLow(), e.action.quest.quest); } @@ -784,15 +812,15 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) { - if (!IsUnit((*itr))) + if (!IsUnit(*itr)) continue; - if (e.action.removeAura.spell == 0) - (*itr)->ToUnit()->RemoveAllAuras(); - else + if (e.action.removeAura.spell) (*itr)->ToUnit()->RemoveAurasDueToSpell(e.action.removeAura.spell); + else + (*itr)->ToUnit()->RemoveAllAuras(); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_REMOVEAURASFROMSPELL: Unit %u, spell %u", + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction: SMART_ACTION_REMOVEAURASFROMSPELL: Unit %u, spell %u", (*itr)->GetGUIDLow(), e.action.removeAura.spell); } @@ -806,14 +834,17 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u ObjectList* targets = GetTargets(e, unit); if (!targets) + { + CAST_AI(SmartAI, me->AI())->StopFollow(); break; + } for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) { - if (IsUnit((*itr))) + if (IsUnit(*itr)) { CAST_AI(SmartAI, me->AI())->SetFollow((*itr)->ToUnit(), (float)e.action.follow.dist, (float)e.action.follow.angle, e.action.follow.credit, e.action.follow.entry, e.action.follow.creditType); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_FOLLOW: Creature %u following target %u", + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction: SMART_ACTION_FOLLOW: Creature %u following target %u", me->GetGUIDLow(), (*itr)->GetGUIDLow()); break; } @@ -850,7 +881,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u uint32 phase = temp[urand(0, count - 1)]; SetPhase(phase); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_RANDOM_PHASE: Creature %u sets event phase to %u", + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction: SMART_ACTION_RANDOM_PHASE: Creature %u sets event phase to %u", GetBaseObject()->GetGUIDLow(), phase); break; } @@ -861,7 +892,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u uint32 phase = urand(e.action.randomPhaseRange.phaseMin, e.action.randomPhaseRange.phaseMax); SetPhase(phase); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_RANDOM_PHASE_RANGE: Creature %u sets event phase to %u", + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction: SMART_ACTION_RANDOM_PHASE_RANGE: Creature %u sets event phase to %u", GetBaseObject()->GetGUIDLow(), phase); break; } @@ -875,7 +906,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (Player* player = me->GetLootRecipient()) { player->RewardPlayerAndGroupAtEvent(e.action.killedMonster.creature, player); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_CALL_KILLEDMONSTER: Player %u, Killcredit: %u", + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction: SMART_ACTION_CALL_KILLEDMONSTER: Player %u, Killcredit: %u", player->GetGUIDLow(), e.action.killedMonster.creature); } } @@ -890,7 +921,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (IsPlayer(*itr)) { (*itr)->ToPlayer()->KilledMonsterCredit(e.action.killedMonster.creature); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_CALL_KILLEDMONSTER: Player %u, Killcredit: %u", + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction: SMART_ACTION_CALL_KILLEDMONSTER: Player %u, Killcredit: %u", (*itr)->GetGUIDLow(), e.action.killedMonster.creature); } else if (IsUnit(*itr)) // Special handling for vehicles @@ -916,12 +947,12 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u InstanceScript* instance = obj->GetInstanceScript(); if (!instance) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartScript: Event %u attempt to set instance data without instance script. EntryOrGuid %d", e.GetEventType(), e.entryOrGuid); + TC_LOG_ERROR("sql.sql", "SmartScript: Event %u attempt to set instance data without instance script. EntryOrGuid %d", e.GetEventType(), e.entryOrGuid); break; } instance->SetData(e.action.setInstanceData.field, e.action.setInstanceData.data); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_SET_INST_DATA: Field: %u, data: %u", + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction: SMART_ACTION_SET_INST_DATA: Field: %u, data: %u", e.action.setInstanceData.field, e.action.setInstanceData.data); break; } @@ -937,7 +968,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u InstanceScript* instance = obj->GetInstanceScript(); if (!instance) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartScript: Event %u attempt to set instance data without instance script. EntryOrGuid %d", e.GetEventType(), e.entryOrGuid); + TC_LOG_ERROR("sql.sql", "SmartScript: Event %u attempt to set instance data without instance script. EntryOrGuid %d", e.GetEventType(), e.entryOrGuid); break; } @@ -946,7 +977,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u break; instance->SetData64(e.action.setInstanceData64.field, targets->front()->GetGUID()); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_SET_INST_DATA64: Field: %u, data: " UI64FMTD, + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction: SMART_ACTION_SET_INST_DATA64: Field: %u, data: " UI64FMTD, e.action.setInstanceData64.field, targets->front()->GetGUID()); delete targets; @@ -954,12 +985,16 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u } case SMART_ACTION_UPDATE_TEMPLATE: { - if (!me || me->GetEntry() == e.action.updateTemplate.creature) + ObjectList* targets = GetTargets(e, unit); + + if (!targets) break; - me->UpdateEntry(e.action.updateTemplate.creature, e.action.updateTemplate.team ? HORDE : ALLIANCE); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_UPDATE_TEMPLATE: Creature %u, Template: %u, Team: %u", - me->GetGUIDLow(), me->GetEntry(), e.action.updateTemplate.team ? HORDE : ALLIANCE); + for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) + if (IsCreature(*itr)) + (*itr)->ToCreature()->UpdateEntry(e.action.updateTemplate.creature, e.action.updateTemplate.team ? HORDE : ALLIANCE); + + delete targets; break; } case SMART_ACTION_DIE: @@ -967,7 +1002,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (me && !me->isDead()) { me->Kill(me); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_DIE: Creature %u", me->GetGUIDLow()); + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction: SMART_ACTION_DIE: Creature %u", me->GetGUIDLow()); } break; } @@ -976,7 +1011,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (me) { me->SetInCombatWithZone(); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_SET_IN_COMBAT_WITH_ZONE: Creature %u", me->GetGUIDLow()); + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction: SMART_ACTION_SET_IN_COMBAT_WITH_ZONE: Creature %u", me->GetGUIDLow()); } break; } @@ -990,7 +1025,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u TrinityStringTextBuilder builder(me, CHAT_MSG_MONSTER_EMOTE, LANG_CALL_FOR_HELP, LANG_UNIVERSAL, 0); sCreatureTextMgr->SendChatPacket(me, builder, CHAT_MSG_MONSTER_EMOTE); } - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_CALL_FOR_HELP: Creature %u", me->GetGUIDLow()); + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction: SMART_ACTION_CALL_FOR_HELP: Creature %u", me->GetGUIDLow()); } break; } @@ -999,32 +1034,51 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (me) { me->SetSheath(SheathState(e.action.setSheath.sheath)); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_SET_SHEATH: Creature %u, State: %u", + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction: SMART_ACTION_SET_SHEATH: Creature %u, State: %u", me->GetGUIDLow(), e.action.setSheath.sheath); } break; } case SMART_ACTION_FORCE_DESPAWN: { - if (!IsSmart()) + ObjectList* targets = GetTargets(e, unit); + + if (!targets) break; - // The AI is only updated if the creature is alive - if (me->IsAlive()) + for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) { - CAST_AI(SmartAI, me->AI())->SetDespawnTime(e.action.forceDespawn.delay + 1); // Next tick - CAST_AI(SmartAI, me->AI())->StartDespawn(); + if (!IsCreature(*itr)) + continue; + + if ((*itr)->ToUnit()->IsAlive() && IsSmart((*itr)->ToCreature())) + { + CAST_AI(SmartAI, (*itr)->ToCreature()->AI())->SetDespawnTime(e.action.forceDespawn.delay + 1); // Next tick + CAST_AI(SmartAI, (*itr)->ToCreature()->AI())->StartDespawn(); + } + else + (*itr)->ToCreature()->DespawnOrUnsummon(e.action.forceDespawn.delay); } - // Otherwise we call the despawn directly - else - me->DespawnOrUnsummon(e.action.forceDespawn.delay); + delete targets; break; } case SMART_ACTION_SET_INGAME_PHASE_MASK: { - if (GetBaseObject()) - GetBaseObject()->SetPhaseMask(e.action.ingamePhaseMask.mask, true); + ObjectList* targets = GetTargets(e, unit); + + if (!targets) + break; + + for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) + { + if (IsUnit(*itr)) + (*itr)->ToUnit()->SetPhaseMask(e.action.ingamePhaseMask.mask, true); + else if (IsGameObject(*itr)) + (*itr)->ToGameObject()->SetPhaseMask(e.action.ingamePhaseMask.mask, true); + } + + delete targets; break; } case SMART_ACTION_MOUNT_TO_ENTRY_OR_MODEL: @@ -1069,6 +1123,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u ai->SetInvincibilityHpLevel(me->CountPctFromMaxHealth(e.action.invincHP.percent)); else ai->SetInvincibilityHpLevel(e.action.invincHP.minHP); + break; } case SMART_ACTION_SET_DATA: @@ -1108,6 +1163,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u { if (WorldObject* baseObj = GetBaseObject()) baseObj->setActive(e.action.active.state); + break; } case SMART_ACTION_ATTACK_START: @@ -1467,7 +1523,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u EquipmentInfo const* einfo = sObjectMgr->GetEquipmentInfo(npc->GetEntry(), equipId); if (!einfo) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartScript: SMART_ACTION_EQUIP uses non-existent equipment info id %u for creature %u", equipId, npc->GetEntry()); + TC_LOG_ERROR("sql.sql", "SmartScript: SMART_ACTION_EQUIP uses non-existent equipment info id %u for creature %u", equipId, npc->GetEntry()); break; } @@ -1593,7 +1649,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u { if (e.GetTargetType() == SMART_TARGET_NONE) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartScript: Entry %d SourceType %u Event %u Action %u is using TARGET_NONE(0) for Script9 target. Please correct target_type in database.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType()); + TC_LOG_ERROR("sql.sql", "SmartScript: Entry %d SourceType %u Event %u Action %u is using TARGET_NONE(0) for Script9 target. Please correct target_type in database.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType()); break; } @@ -1624,7 +1680,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u break; for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) - if (IsUnit(*itr)) + if (IsCreature(*itr)) (*itr)->ToUnit()->SetUInt32Value(UNIT_NPC_FLAGS, e.action.unitFlag.flag); delete targets; @@ -1637,7 +1693,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u break; for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) - if (IsUnit(*itr)) + if (IsCreature(*itr)) (*itr)->ToUnit()->SetFlag(UNIT_NPC_FLAGS, e.action.unitFlag.flag); delete targets; @@ -1650,7 +1706,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u break; for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) - if (IsUnit(*itr)) + if (IsCreature(*itr)) (*itr)->ToUnit()->RemoveFlag(UNIT_NPC_FLAGS, e.action.unitFlag.flag); delete targets; @@ -1674,6 +1730,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (!IsUnit(*itr)) continue; + Unit* unit = (*itr)->ToUnit(); + bool interruptedSpell = false; for (ObjectList::const_iterator it = targets->begin(); it != targets->end(); ++it) @@ -1685,14 +1743,14 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u { if (!interruptedSpell && e.action.cast.flags & SMARTCAST_INTERRUPT_PREVIOUS) { - (*itr)->ToUnit()->InterruptNonMeleeSpells(false); + unit->InterruptNonMeleeSpells(false); interruptedSpell = true; } - (*itr)->ToUnit()->CastSpell((*it)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED)); + unit->CastSpell((*it)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED)); } else - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "Spell %u not casted because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (Guid: " UI64FMTD " Entry: %u Type: %u) already has the aura", e.action.cast.spell, (*it)->GetGUID(), (*it)->GetEntry(), uint32((*it)->GetTypeId())); + TC_LOG_DEBUG("scripts.ai", "Spell %u not casted because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (Guid: " UI64FMTD " Entry: %u Type: %u) already has the aura", e.action.cast.spell, (*it)->GetGUID(), (*it)->GetEntry(), uint32((*it)->GetTypeId())); } } @@ -1726,7 +1784,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u uint32 id = temp[urand(0, count - 1)]; if (e.GetTargetType() == SMART_TARGET_NONE) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartScript: Entry %d SourceType %u Event %u Action %u is using TARGET_NONE(0) for Script9 target. Please correct target_type in database.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType()); + TC_LOG_ERROR("sql.sql", "SmartScript: Entry %d SourceType %u Event %u Action %u is using TARGET_NONE(0) for Script9 target. Please correct target_type in database.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType()); break; } @@ -1756,7 +1814,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u uint32 id = urand(e.action.randTimedActionList.entry1, e.action.randTimedActionList.entry2); if (e.GetTargetType() == SMART_TARGET_NONE) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartScript: Entry %d SourceType %u Event %u Action %u is using TARGET_NONE(0) for Script9 target. Please correct target_type in database.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType()); + TC_LOG_ERROR("sql.sql", "SmartScript: Entry %d SourceType %u Event %u Action %u is using TARGET_NONE(0) for Script9 target. Please correct target_type in database.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType()); break; } @@ -1969,14 +2027,14 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (SmartAI* ai = CAST_AI(SmartAI, (*itr)->ToCreature()->AI())) ai->GetScript()->StoreTargetList(new ObjectList(*storedTargets), e.action.sendTargetToTarget.id); // store a copy of target list else - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartScript: Action target for SMART_ACTION_SEND_TARGET_TO_TARGET is not using SmartAI, skipping"); + TC_LOG_ERROR("sql.sql", "SmartScript: Action target for SMART_ACTION_SEND_TARGET_TO_TARGET is not using SmartAI, skipping"); } else if (IsGameObject(*itr)) { if (SmartGameObjectAI* ai = CAST_AI(SmartGameObjectAI, (*itr)->ToGameObject()->AI())) ai->GetScript()->StoreTargetList(new ObjectList(*storedTargets), e.action.sendTargetToTarget.id); // store a copy of target list else - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartScript: Action target for SMART_ACTION_SEND_TARGET_TO_TARGET is not using SmartGameObjectAI, skipping"); + TC_LOG_ERROR("sql.sql", "SmartScript: Action target for SMART_ACTION_SEND_TARGET_TO_TARGET is not using SmartGameObjectAI, skipping"); } } @@ -1988,7 +2046,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (!GetBaseObject()) break; - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SEND_GOSSIP_MENU: gossipMenuId %d, gossipNpcTextId %d", + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_SEND_GOSSIP_MENU: gossipMenuId %d, gossipNpcTextId %d", e.action.sendGossipMenu.gossipMenuId, e.action.sendGossipMenu.gossipNpcTextId); ObjectList* targets = GetTargets(e, unit); @@ -2035,7 +2093,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u (*itr)->ToCreature()->SetHomePosition((*itr)->GetPositionX(), (*itr)->GetPositionY(), (*itr)->GetPositionZ(), (*itr)->GetOrientation()); } else - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartScript: Action target for SMART_ACTION_SET_HOME_POS is invalid, skipping"); + TC_LOG_ERROR("sql.sql", "SmartScript: Action target for SMART_ACTION_SET_HOME_POS is invalid, skipping"); } } @@ -2159,7 +2217,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u uint32 eventId = e.action.gameEventStop.id; if (!sGameEventMgr->IsActiveEvent(eventId)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartScript::ProcessAction: At case SMART_ACTION_GAME_EVENT_STOP, inactive event (id: %u)", eventId); + TC_LOG_ERROR("sql.sql", "SmartScript::ProcessAction: At case SMART_ACTION_GAME_EVENT_STOP, inactive event (id: %u)", eventId); break; } sGameEventMgr->StopEvent(eventId, true); @@ -2170,14 +2228,14 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u uint32 eventId = e.action.gameEventStart.id; if (sGameEventMgr->IsActiveEvent(eventId)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartScript::ProcessAction: At case SMART_ACTION_GAME_EVENT_START, already activated event (id: %u)", eventId); + TC_LOG_ERROR("sql.sql", "SmartScript::ProcessAction: At case SMART_ACTION_GAME_EVENT_START, already activated event (id: %u)", eventId); break; } sGameEventMgr->StartEvent(eventId, true); break; } default: - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartScript::ProcessAction: Entry %d SourceType %u, Event %u, Unhandled Action type %u", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); + TC_LOG_ERROR("sql.sql", "SmartScript::ProcessAction: Entry %d SourceType %u, Event %u, Unhandled Action type %u", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); break; } @@ -2187,7 +2245,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (linked.GetActionType() && linked.GetEventType() == SMART_EVENT_LINK) ProcessEvent(linked, unit, var0, var1, bvar, spell, gob); else - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartScript::ProcessAction: Entry %d SourceType %u, Event %u, Link Event %u not found or invalid, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.link); + TC_LOG_ERROR("sql.sql", "SmartScript::ProcessAction: Entry %d SourceType %u, Event %u, Link Event %u not found or invalid, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.link); } } @@ -2208,7 +2266,7 @@ void SmartScript::InstallTemplate(SmartScriptHolder const& e) return; if (mTemplate) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartScript::InstallTemplate: Entry %d SourceType %u AI Template can not be set more then once, skipped.", e.entryOrGuid, e.GetScriptType()); + TC_LOG_ERROR("sql.sql", "SmartScript::InstallTemplate: Entry %d SourceType %u AI Template can not be set more then once, skipped.", e.entryOrGuid, e.GetScriptType()); return; } mTemplate = (SMARTAI_TEMPLATE)e.action.installTtemplate.id; @@ -2461,7 +2519,7 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /* Creature* target = NULL; if (!scriptTrigger && !baseObject) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SMART_TARGET_CREATURE_GUID can not be used without invoker"); + TC_LOG_ERROR("sql.sql", "SMART_TARGET_CREATURE_GUID can not be used without invoker"); break; } @@ -2476,7 +2534,7 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /* GameObject* target = NULL; if (!scriptTrigger && !baseObject) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SMART_TARGET_GAMEOBJECT_GUID can not be used without invoker"); + TC_LOG_ERROR("sql.sql", "SMART_TARGET_GAMEOBJECT_GUID can not be used without invoker"); break; } @@ -2985,7 +3043,7 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui } case SMART_EVENT_GOSSIP_SELECT: { - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript: Gossip Select: menu %u action %u", var0, var1);//little help for scripters + TC_LOG_DEBUG("scripts.ai", "SmartScript: Gossip Select: menu %u action %u", var0, var1);//little help for scripters if (e.event.gossip.sender != var0 || e.event.gossip.action != var1) return; ProcessAction(e, unit, var0, var1); @@ -3077,7 +3135,7 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui break; } default: - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartScript::ProcessEvent: Unhandled Event type %u", e.GetEventType()); + TC_LOG_ERROR("sql.sql", "SmartScript::ProcessEvent: Unhandled Event type %u", e.GetEventType()); break; } } @@ -3251,9 +3309,9 @@ void SmartScript::FillScript(SmartAIEventList e, WorldObject* obj, AreaTriggerEn if (e.empty()) { if (obj) - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript: EventMap for Entry %u is empty but is using SmartScript.", obj->GetEntry()); + TC_LOG_DEBUG("scripts.ai", "SmartScript: EventMap for Entry %u is empty but is using SmartScript.", obj->GetEntry()); if (at) - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript: EventMap for AreaTrigger %u is empty but is using SmartScript.", at->id); + TC_LOG_DEBUG("scripts.ai", "SmartScript: EventMap for AreaTrigger %u is empty but is using SmartScript.", at->id); return; } for (SmartAIEventList::iterator i = e.begin(); i != e.end(); ++i) @@ -3277,9 +3335,9 @@ void SmartScript::FillScript(SmartAIEventList e, WorldObject* obj, AreaTriggerEn mEvents.push_back((*i));//NOTE: 'world(0)' events still get processed in ANY instance mode } if (mEvents.empty() && obj) - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartScript: Entry %u has events but no events added to list because of instance flags.", obj->GetEntry()); + TC_LOG_ERROR("sql.sql", "SmartScript: Entry %u has events but no events added to list because of instance flags.", obj->GetEntry()); if (mEvents.empty() && at) - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartScript: AreaTrigger %u has events but no events added to list because of instance flags. NOTE: triggers can not handle any instance flags.", at->id); + TC_LOG_ERROR("sql.sql", "SmartScript: AreaTrigger %u has events but no events added to list because of instance flags. NOTE: triggers can not handle any instance flags.", at->id); } void SmartScript::GetScript() @@ -3315,26 +3373,26 @@ void SmartScript::OnInitialize(WorldObject* obj, AreaTriggerEntry const* at) case TYPEID_UNIT: mScriptType = SMART_SCRIPT_TYPE_CREATURE; me = obj->ToCreature(); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::OnInitialize: source is Creature %u", me->GetEntry()); + TC_LOG_DEBUG("scripts.ai", "SmartScript::OnInitialize: source is Creature %u", me->GetEntry()); break; case TYPEID_GAMEOBJECT: mScriptType = SMART_SCRIPT_TYPE_GAMEOBJECT; go = obj->ToGameObject(); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::OnInitialize: source is GameObject %u", go->GetEntry()); + TC_LOG_DEBUG("scripts.ai", "SmartScript::OnInitialize: source is GameObject %u", go->GetEntry()); break; default: - TC_LOG_ERROR(LOG_FILTER_GENERAL, "SmartScript::OnInitialize: Unhandled TypeID !WARNING!"); + TC_LOG_ERROR("misc", "SmartScript::OnInitialize: Unhandled TypeID !WARNING!"); return; } } else if (at) { mScriptType = SMART_SCRIPT_TYPE_AREATRIGGER; trigger = at; - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::OnInitialize: source is AreaTrigger %u", trigger->id); + TC_LOG_DEBUG("scripts.ai", "SmartScript::OnInitialize: source is AreaTrigger %u", trigger->id); } else { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "SmartScript::OnInitialize: !WARNING! Initialized objects are NULL."); + TC_LOG_ERROR("misc", "SmartScript::OnInitialize: !WARNING! Initialized objects are NULL."); return; } diff --git a/src/server/game/AI/SmartScripts/SmartScript.h b/src/server/game/AI/SmartScripts/SmartScript.h index b1b9f4d6725..f9eff2ec96e 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.h +++ b/src/server/game/AI/SmartScripts/SmartScript.h @@ -118,7 +118,7 @@ class SmartScript smart = false; if (!smart) - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartScript: Action target Creature (GUID: %u Entry: %u) is not using SmartAI, action skipped to prevent crash.", c ? c->GetDBTableGUIDLow() : (me ? me->GetDBTableGUIDLow() : 0), c ? c->GetEntry() : (me ? me->GetEntry() : 0)); + TC_LOG_ERROR("sql.sql", "SmartScript: Action target Creature (GUID: %u Entry: %u) is not using SmartAI, action skipped to prevent crash.", c ? c->GetDBTableGUIDLow() : (me ? me->GetDBTableGUIDLow() : 0), c ? c->GetEntry() : (me ? me->GetEntry() : 0)); return smart; } @@ -132,7 +132,7 @@ class SmartScript if (!go || go->GetAIName() != "SmartGameObjectAI") smart = false; if (!smart) - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartScript: Action target GameObject (GUID: %u Entry: %u) is not using SmartGameObjectAI, action skipped to prevent crash.", g ? g->GetDBTableGUIDLow() : (go ? go->GetDBTableGUIDLow() : 0), g ? g->GetEntry() : (go ? go->GetEntry() : 0)); + TC_LOG_ERROR("sql.sql", "SmartScript: Action target GameObject (GUID: %u Entry: %u) is not using SmartGameObjectAI, action skipped to prevent crash.", g ? g->GetDBTableGUIDLow() : (go ? go->GetDBTableGUIDLow() : 0), g ? g->GetEntry() : (go ? go->GetEntry() : 0)); return smart; } @@ -244,7 +244,7 @@ class SmartScript SMARTAI_TEMPLATE mTemplate; void InstallEvents(); - void RemoveStoredEvent (uint32 id) + void RemoveStoredEvent(uint32 id) { if (!mStoredEvents.empty()) { @@ -258,7 +258,7 @@ class SmartScript } } } - SmartScriptHolder FindLinkedEvent (uint32 link) + SmartScriptHolder FindLinkedEvent(uint32 link) { if (!mEvents.empty()) { diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index 87c35d59cc0..414e204ad5a 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -52,7 +52,7 @@ void SmartWaypointMgr::LoadFromDB() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 SmartAI Waypoint Paths. DB table `waypoints` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 SmartAI Waypoint Paths. DB table `waypoints` is empty."); return; } @@ -80,7 +80,7 @@ void SmartWaypointMgr::LoadFromDB() } if (last_id != id) - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartWaypointMgr::LoadFromDB: Path entry %u, unexpected point id %u, expected %u.", entry, id, last_id); + TC_LOG_ERROR("sql.sql", "SmartWaypointMgr::LoadFromDB: Path entry %u, unexpected point id %u, expected %u.", entry, id, last_id); last_id++; (*waypoint_map[entry])[id] = new WayPoint(id, x, y, z); @@ -90,7 +90,7 @@ void SmartWaypointMgr::LoadFromDB() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u SmartAI waypoint paths (total %u waypoints) in %u ms", count, total, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u SmartAI waypoint paths (total %u waypoints) in %u ms", count, total, GetMSTimeDiffToNow(oldMSTime)); } @@ -107,6 +107,8 @@ SmartWaypointMgr::~SmartWaypointMgr() void SmartAIMgr::LoadSmartAIFromDB() { + LoadHelperStores(); + uint32 oldMSTime = getMSTime(); for (uint8 i = 0; i < SMART_SCRIPT_TYPE_MAX; i++) @@ -117,8 +119,7 @@ void SmartAIMgr::LoadSmartAIFromDB() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 SmartAI scripts. DB table `smartai_scripts` is empty."); - + TC_LOG_INFO("server.loading", ">> Loaded 0 SmartAI scripts. DB table `smartai_scripts` is empty."); return; } @@ -134,7 +135,7 @@ void SmartAIMgr::LoadSmartAIFromDB() SmartScriptType source_type = (SmartScriptType)fields[1].GetUInt8(); if (source_type >= SMART_SCRIPT_TYPE_MAX) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr::LoadSmartAIFromDB: invalid source_type (%u), skipped loading.", uint32(source_type)); + TC_LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: invalid source_type (%u), skipped loading.", uint32(source_type)); continue; } if (temp.entryOrGuid >= 0) @@ -145,7 +146,7 @@ void SmartAIMgr::LoadSmartAIFromDB() { if (!sObjectMgr->GetCreatureTemplate((uint32)temp.entryOrGuid)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr::LoadSmartAIFromDB: Creature entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid)); + TC_LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: Creature entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid)); continue; } break; @@ -154,7 +155,7 @@ void SmartAIMgr::LoadSmartAIFromDB() { if (!sObjectMgr->GetGameObjectTemplate((uint32)temp.entryOrGuid)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr::LoadSmartAIFromDB: GameObject entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid)); + TC_LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: GameObject entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid)); continue; } break; @@ -163,7 +164,7 @@ void SmartAIMgr::LoadSmartAIFromDB() { if (!sAreaTriggerStore.LookupEntry((uint32)temp.entryOrGuid)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr::LoadSmartAIFromDB: AreaTrigger entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid)); + TC_LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: AreaTrigger entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid)); continue; } break; @@ -171,7 +172,7 @@ void SmartAIMgr::LoadSmartAIFromDB() case SMART_SCRIPT_TYPE_TIMED_ACTIONLIST: break;//nothing to check, really default: - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr::LoadSmartAIFromDB: not yet implemented source_type %u", (uint32)source_type); + TC_LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: not yet implemented source_type %u", (uint32)source_type); continue; } } @@ -179,7 +180,7 @@ void SmartAIMgr::LoadSmartAIFromDB() { if (!sObjectMgr->GetCreatureData(uint32(abs(temp.entryOrGuid)))) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr::LoadSmartAIFromDB: Creature guid (%u) does not exist, skipped loading.", uint32(abs(temp.entryOrGuid))); + TC_LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: Creature guid (%u) does not exist, skipped loading.", uint32(abs(temp.entryOrGuid))); continue; } } @@ -234,8 +235,9 @@ void SmartAIMgr::LoadSmartAIFromDB() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u SmartAI scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u SmartAI scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + UnLoadHelperStores(); } bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e) @@ -249,7 +251,7 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e) { if (e.target.unitDistance.creature && !sObjectMgr->GetCreatureTemplate(e.target.unitDistance.creature)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Creature entry %u as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.target.unitDistance.creature); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Creature entry %u as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.target.unitDistance.creature); return false; } break; @@ -259,7 +261,7 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e) { if (e.target.goDistance.entry && !sObjectMgr->GetGameObjectTemplate(e.target.goDistance.entry)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent GameObject entry %u as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.target.goDistance.entry); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent GameObject entry %u as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.target.goDistance.entry); return false; } break; @@ -281,7 +283,7 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e) { if (e.target.playerDistance.dist == 0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u has maxDist 0 as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u has maxDist 0 as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); return false; } break; @@ -307,7 +309,7 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e) case SMART_TARGET_STORED: break; default: - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Not handled target_type(%u), Entry %d SourceType %u Event %u Action %u, skipped.", e.GetTargetType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Not handled target_type(%u), Entry %d SourceType %u Event %u Action %u, skipped.", e.GetTargetType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); return false; } return true; @@ -317,28 +319,28 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) { if (e.event.type >= SMART_EVENT_END) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: EntryOrGuid %d using event(%u) has invalid event type (%u), skipped.", e.entryOrGuid, e.event_id, e.GetEventType()); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid %d using event(%u) has invalid event type (%u), skipped.", e.entryOrGuid, e.event_id, e.GetEventType()); return false; } // in SMART_SCRIPT_TYPE_TIMED_ACTIONLIST all event types are overriden by core if (e.GetScriptType() != SMART_SCRIPT_TYPE_TIMED_ACTIONLIST && !(SmartAIEventMask[e.event.type][1] & SmartAITypeMask[e.GetScriptType()][1])) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: EntryOrGuid %d, event type %u can not be used for Script type %u", e.entryOrGuid, e.GetEventType(), e.GetScriptType()); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid %d, event type %u can not be used for Script type %u", e.entryOrGuid, e.GetEventType(), e.GetScriptType()); return false; } if (e.action.type <= 0 || e.action.type >= SMART_ACTION_END) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: EntryOrGuid %d using event(%u) has invalid action type (%u), skipped.", e.entryOrGuid, e.event_id, e.GetActionType()); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid %d using event(%u) has invalid action type (%u), skipped.", e.entryOrGuid, e.event_id, e.GetActionType()); return false; } if (e.event.event_phase_mask > SMART_EVENT_PHASE_ALL) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: EntryOrGuid %d using event(%u) has invalid phase mask (%u), skipped.", e.entryOrGuid, e.event_id, e.event.event_phase_mask); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid %d using event(%u) has invalid phase mask (%u), skipped.", e.entryOrGuid, e.event_id, e.event.event_phase_mask); return false; } if (e.event.event_flags > SMART_EVENT_FLAGS_ALL) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: EntryOrGuid %d using event(%u) has invalid event flags (%u), skipped.", e.entryOrGuid, e.event_id, e.event.event_flags); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid %d using event(%u) has invalid event flags (%u), skipped.", e.entryOrGuid, e.event_id, e.event.event_flags); return false; } if (e.GetScriptType() == SMART_SCRIPT_TYPE_TIMED_ACTIONLIST) @@ -379,12 +381,12 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(e.event.spellHit.spell); if (!spellInfo) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell); return false; } if (e.event.spellHit.school && (e.event.spellHit.school & spellInfo->SchoolMask) != spellInfo->SchoolMask) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses Spell entry %u with invalid school mask, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses Spell entry %u with invalid school mask, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell); return false; } } @@ -399,12 +401,12 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) case SMART_EVENT_RESPAWN: if (e.event.respawn.type == SMART_SCRIPT_RESPAWN_CONDITION_MAP && !sMapStore.LookupEntry(e.event.respawn.map)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Map entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.respawn.map); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Map entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.respawn.map); return false; } if (e.event.respawn.type == SMART_SCRIPT_RESPAWN_CONDITION_AREA && !GetAreaEntryByAreaID(e.event.respawn.area)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Area entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.respawn.area); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Area entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.respawn.area); return false; } break; @@ -441,7 +443,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) case SMART_EVENT_VICTIM_CASTING: if (e.event.targetCasting.spellId > 0 && !sSpellMgr->GetSpellInfo(e.event.targetCasting.spellId)) { - sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell); return false; } @@ -495,7 +497,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) { if (e.event.movementInform.type > NULL_MOTION_TYPE) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Motion type %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.movementInform.type); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Motion type %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.movementInform.type); return false; } break; @@ -519,7 +521,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) { if (e.link && e.link == e.event_id) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u, Event %u, Link Event is linking self (infinite loop), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u, Event %u, Link Event is linking self (infinite loop), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id); return false; } break; @@ -551,7 +553,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) { if (e.event.doAction.eventId > EVENT_CHARGE) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid event id %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.doAction.eventId); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid event id %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.doAction.eventId); return false; } break; @@ -562,7 +564,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) if (e.event.friendlyHealthPct.maxHpPct > 100 || e.event.friendlyHealthPct.minHpPct > 100) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u has pct value above 100, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u has pct value above 100, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); return false; } @@ -577,7 +579,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) case SMART_TARGET_PLAYER_DISTANCE: break; default: - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid target_type %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.GetTargetType()); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid target_type %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.GetTargetType()); return false; } break; @@ -616,7 +618,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) case SMART_EVENT_ON_SPELLCLICK: break; default: - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Not handled event_type(%u), Entry %d SourceType %u Event %u Action %u, skipped.", e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Not handled event_type(%u), Entry %d SourceType %u Event %u Action %u, skipped.", e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); return false; } } @@ -626,7 +628,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) case SMART_ACTION_SET_FACTION: if (e.action.faction.factionID && !sFactionTemplateStore.LookupEntry(e.action.faction.factionID)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Faction %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.faction.factionID); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Faction %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.faction.factionID); return false; } break; @@ -636,7 +638,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) { if (e.action.morphOrMount.creature > 0 && !sObjectMgr->GetCreatureTemplate(e.action.morphOrMount.creature)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Creature entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.morphOrMount.creature); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Creature entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.morphOrMount.creature); return false; } @@ -644,12 +646,12 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) { if (e.action.morphOrMount.creature) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u has ModelID set with also set CreatureId, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u has ModelID set with also set CreatureId, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); return false; } else if (!sCreatureDisplayInfoStore.LookupEntry(e.action.morphOrMount.model)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Model id %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.morphOrMount.model); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Model id %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.morphOrMount.model); return false; } } @@ -673,7 +675,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) { if (!sTaxiPathStore.LookupEntry(e.action.taxi.id)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Taxi path ID %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.taxi.id); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Taxi path ID %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.taxi.id); return false; } break; @@ -709,32 +711,32 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) { if (!qid->HasSpecialFlag(QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u SpecialFlags for Quest entry %u does not include FLAGS_EXPLORATION_OR_EVENT(2), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.quest.quest); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u SpecialFlags for Quest entry %u does not include FLAGS_EXPLORATION_OR_EVENT(2), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.quest.quest); return false; } } else { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Quest entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.quest.quest); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Quest entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.quest.quest); return false; } break; case SMART_ACTION_SET_EVENT_PHASE: if (e.action.setEventPhase.phase >= SMART_EVENT_PHASE_MAX) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set phase %u. Phase mask cannot be used past phase %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.setEventPhase.phase, SMART_EVENT_PHASE_MAX-1); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set phase %u. Phase mask cannot be used past phase %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.setEventPhase.phase, SMART_EVENT_PHASE_MAX-1); return false; } break; case SMART_ACTION_INC_EVENT_PHASE: if (!e.action.incEventPhase.inc && !e.action.incEventPhase.dec) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u is incrementing phase by 0, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u is incrementing phase by 0, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); return false; } else if (e.action.incEventPhase.inc > SMART_EVENT_PHASE_MAX || e.action.incEventPhase.dec > SMART_EVENT_PHASE_MAX) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to increment phase by too large value, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to increment phase by too large value, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); return false; } break; @@ -751,7 +753,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) e.action.randomPhase.phase5 >= SMART_EVENT_PHASE_MAX || e.action.randomPhase.phase6 >= SMART_EVENT_PHASE_MAX) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set invalid phase, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set invalid phase, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); return false; } } @@ -761,7 +763,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) if (e.action.randomPhaseRange.phaseMin >= SMART_EVENT_PHASE_MAX || e.action.randomPhaseRange.phaseMax >= SMART_EVENT_PHASE_MAX) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set invalid phase, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set invalid phase, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); return false; } if (!IsMinMaxValid(e, e.action.randomPhaseRange.phaseMin, e.action.randomPhaseRange.phaseMax)) @@ -769,70 +771,47 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) break; } case SMART_ACTION_SUMMON_CREATURE: + { if (!IsCreatureValid(e, e.action.summonCreature.creature)) return false; - for (uint32 i = 0; i < sSpellMgr->GetSpellInfoStoreSize(); ++i) - { - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(i); - if (!spellInfo) - continue; - - for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j) - { - if (spellInfo->Effects[j].Effect == SPELL_EFFECT_SUMMON) - { - uint32 creatureSummonEntry = spellInfo->Effects[j].MiscValue; - - if (e.action.summonCreature.creature == creatureSummonEntry) - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u creature summon: %u has already summon spell (SpellId: %u effect: %u)", - e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.summonCreature.creature, spellInfo->Id, j); - } - } - } + CacheSpellContainerBounds sBounds = GetSummonCreatureSpellContainerBounds(e.action.summonCreature.creature); + for (CacheSpellContainer::const_iterator itr = sBounds.first; itr != sBounds.second; ++itr) + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u creature summon: There is a summon spell for creature entry %u (SpellId: %u, effect: %u)", + e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.summonCreature.creature, itr->second.first, itr->second.second); if (e.action.summonCreature.type < TEMPSUMMON_TIMED_OR_DEAD_DESPAWN || e.action.summonCreature.type > TEMPSUMMON_MANUAL_DESPAWN) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses incorrect TempSummonType %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.summonCreature.type); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses incorrect TempSummonType %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.summonCreature.type); return false; } break; + } case SMART_ACTION_CALL_KILLEDMONSTER: + { if (!IsCreatureValid(e, e.action.killedMonster.creature)) return false; - for (uint32 i = 0; i < sSpellMgr->GetSpellInfoStoreSize(); ++i) - { - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(i); - if (!spellInfo) - continue; - - for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j) - { - if (spellInfo->Effects[j].Effect == SPELL_EFFECT_KILL_CREDIT || spellInfo->Effects[j].Effect == SPELL_EFFECT_KILL_CREDIT2) - { - uint32 killCredit = spellInfo->Effects[j].MiscValue; - - if (e.action.killedMonster.creature == killCredit) - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u Kill Credit: %u has already spell kill credit (SpellId: %u effect: %u)", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.killedMonster.creature, spellInfo->Id, j); - } - } - } + CacheSpellContainerBounds sBounds = GetKillCreditSpellContainerBounds(e.action.killedMonster.creature); + for (CacheSpellContainer::const_iterator itr = sBounds.first; itr != sBounds.second; ++itr) + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u Kill Credit: There is a killcredit spell for creatureEntry %u (SpellId: %u effect: %u)", + e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.killedMonster.creature, itr->second.first, itr->second.second); if (e.GetTargetType() == SMART_TARGET_POSITION) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses incorrect TargetType %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.GetTargetType()); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses incorrect TargetType %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.GetTargetType()); return false; } break; + } case SMART_ACTION_UPDATE_TEMPLATE: - if (e.action.updateTemplate.creature && !IsCreatureValid(e, e.action.updateTemplate.creature)) + if (!IsCreatureValid(e, e.action.updateTemplate.creature)) return false; break; case SMART_ACTION_SET_SHEATH: if (e.action.setSheath.sheath && e.action.setSheath.sheath >= MAX_SHEATH_STATE) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses incorrect Sheath state %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.setSheath.sheath); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses incorrect Sheath state %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.setSheath.sheath); return false; } break; @@ -840,34 +819,22 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) { if (e.action.react.state > REACT_AGGRESSIVE) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Creature %d Event %u Action %u uses invalid React State %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.react.state); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Creature %d Event %u Action %u uses invalid React State %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.react.state); return false; } break; } case SMART_ACTION_SUMMON_GO: + { if (!IsGameObjectValid(e, e.action.summonGO.entry)) return false; - for (uint32 i = 0; i < sSpellMgr->GetSpellInfoStoreSize(); ++i) - { - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(i); - if (!spellInfo) - continue; - - for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j) - { - if (spellInfo->Effects[j].Effect == SPELL_EFFECT_SUMMON_OBJECT_WILD) - { - uint32 goSummonEntry = spellInfo->Effects[j].MiscValue; - - if (e.action.summonGO.entry == goSummonEntry) - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u gameobject summon: %u has already summon spell (SpellId: %u effect: %u)", - e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.summonGO.entry, spellInfo->Id, j); - } - } - } + CacheSpellContainerBounds sBounds = GetSummonGameObjectSpellContainerBounds(e.action.summonGO.entry); + for (CacheSpellContainer::const_iterator itr = sBounds.first; itr != sBounds.second; ++itr) + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u gameobject summon: There is a summon spell for gameobject entry %u (SpellId: %u, effect: %u)", + e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.summonGO.entry, itr->second.first, itr->second.second); break; + } case SMART_ACTION_ADD_ITEM: case SMART_ACTION_REMOVE_ITEM: if (!IsItemValid(e, e.action.item.entry)) @@ -879,14 +846,14 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) case SMART_ACTION_TELEPORT: if (!sMapStore.LookupEntry(e.action.teleport.mapID)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Map entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.teleport.mapID); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Map entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.teleport.mapID); return false; } break; case SMART_ACTION_INSTALL_AI_TEMPLATE: if (e.action.installTtemplate.id >= SMARTAI_TEMPLATE_END) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Creature %d Event %u Action %u uses non-existent AI template id %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.installTtemplate.id); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Creature %d Event %u Action %u uses non-existent AI template id %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.installTtemplate.id); return false; } break; @@ -898,14 +865,14 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) { if (!sSmartWaypointMgr->GetPath(e.action.wpStart.pathID)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Creature %d Event %u Action %u uses non-existent WaypointPath id %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.wpStart.pathID); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Creature %d Event %u Action %u uses non-existent WaypointPath id %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.wpStart.pathID); return false; } if (e.action.wpStart.quest && !IsQuestValid(e, e.action.wpStart.quest)) return false; if (e.action.wpStart.reactState > REACT_AGGRESSIVE) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Creature %d Event %u Action %u uses invalid React State %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.wpStart.reactState); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Creature %d Event %u Action %u uses invalid React State %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.wpStart.reactState); return false; } break; @@ -924,7 +891,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) case SMART_ACTION_REMOVE_POWER: if (e.action.power.powerType > MAX_POWERS) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Power %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.power.powerType); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Power %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.power.powerType); return false; } break; @@ -935,14 +902,14 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap(); if (eventId < 1 || eventId >= events.size()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %u SourceType %u Event %u Action %u uses non-existent event, eventId %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.gameEventStop.id); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %u SourceType %u Event %u Action %u uses non-existent event, eventId %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.gameEventStop.id); return false; } GameEventData const& eventData = events[eventId]; if (!eventData.isValid()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %u SourceType %u Event %u Action %u uses non-existent event, eventId %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.gameEventStop.id); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %u SourceType %u Event %u Action %u uses non-existent event, eventId %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.gameEventStop.id); return false; } break; @@ -954,14 +921,14 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap(); if (eventId < 1 || eventId >= events.size()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %u SourceType %u Event %u Action %u uses non-existent event, eventId %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.gameEventStart.id); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %u SourceType %u Event %u Action %u uses non-existent event, eventId %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.gameEventStart.id); return false; } GameEventData const& eventData = events[eventId]; if (!eventData.isValid()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %u SourceType %u Event %u Action %u uses non-existent event, eventId %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.gameEventStart.id); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %u SourceType %u Event %u Action %u uses non-existent event, eventId %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.gameEventStart.id); return false; } break; @@ -1040,7 +1007,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) case SMART_ACTION_SUMMON_CREATURE_GROUP: break; default: - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Not handled action_type(%u), event_type(%u), Entry %d SourceType %u Event %u, skipped.", e.GetActionType(), e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Not handled action_type(%u), event_type(%u), Entry %d SourceType %u Event %u, skipped.", e.GetActionType(), e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id); return false; } @@ -1058,7 +1025,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) CreatureData const* data = sObjectMgr->GetCreatureData(entry); if (!data) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u using non-existent Creature guid %d, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u using non-existent Creature guid %d, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); return false; } else @@ -1068,8 +1035,57 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) error = true; if (error) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u using non-existent Text id %d, skipped.", e.entryOrGuid, e.GetScriptType(), e.source_type, e.GetActionType(), id); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u using non-existent Text id %d, skipped.", e.entryOrGuid, e.GetScriptType(), e.source_type, e.GetActionType(), id); return false; } return true; }*/ + +void SmartAIMgr::LoadHelperStores() +{ + uint32 oldMSTime = getMSTime(); + + SpellInfo const* spellInfo = NULL; + for (uint32 i = 0; i < sSpellMgr->GetSpellInfoStoreSize(); ++i) + { + spellInfo = sSpellMgr->GetSpellInfo(i); + if (!spellInfo) + continue; + + for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j) + { + if (spellInfo->Effects[j].IsEffect(SPELL_EFFECT_SUMMON)) + SummonCreatureSpellStore.insert(std::make_pair(uint32(spellInfo->Effects[j].MiscValue), std::make_pair(i, SpellEffIndex(j)))); + + else if (spellInfo->Effects[j].IsEffect(SPELL_EFFECT_SUMMON_OBJECT_WILD)) + SummonGameObjectSpellStore.insert(std::make_pair(uint32(spellInfo->Effects[j].MiscValue), std::make_pair(i, SpellEffIndex(j)))); + + else if (spellInfo->Effects[j].IsEffect(SPELL_EFFECT_KILL_CREDIT) || spellInfo->Effects[j].IsEffect(SPELL_EFFECT_KILL_CREDIT2)) + KillCreditSpellStore.insert(std::make_pair(uint32(spellInfo->Effects[j].MiscValue), std::make_pair(i, SpellEffIndex(j)))); + } + } + + TC_LOG_INFO("server.loading", ">> Loaded SmartAIMgr Helpers in %u ms", GetMSTimeDiffToNow(oldMSTime)); +} + +void SmartAIMgr::UnLoadHelperStores() +{ + SummonCreatureSpellStore.clear(); + SummonGameObjectSpellStore.clear(); + KillCreditSpellStore.clear(); +} + +CacheSpellContainerBounds SmartAIMgr::GetSummonCreatureSpellContainerBounds(uint32 creatureEntry) const +{ + return SummonCreatureSpellStore.equal_range(creatureEntry); +} + +CacheSpellContainerBounds SmartAIMgr::GetSummonGameObjectSpellContainerBounds(uint32 gameObjectEntry) const +{ + return SummonGameObjectSpellStore.equal_range(gameObjectEntry); +} + +CacheSpellContainerBounds SmartAIMgr::GetKillCreditSpellContainerBounds(uint32 killCredit) const +{ + return KillCreditSpellStore.equal_range(killCredit); +} diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index 50289d9c620..f6ace2f9881 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -735,7 +735,7 @@ struct SmartAction } summonGO; struct - { + { uint32 state; } active; @@ -1036,6 +1036,10 @@ struct SmartTarget raw.param1 = p1; raw.param2 = p2; raw.param3 = p3; + x = 0.0f; + y = 0.0f; + z = 0.0f; + o = 0.0f; } SMARTAI_TARGETS type; float x, y, z, o; @@ -1280,10 +1284,11 @@ enum SmartCastFlags { SMARTCAST_INTERRUPT_PREVIOUS = 0x01, //Interrupt any spell casting SMARTCAST_TRIGGERED = 0x02, //Triggered (this makes spell cost zero mana and have no cast time) - //CAST_FORCE_CAST = 0x04, //Forces cast even if creature is out of mana or out of range - //CAST_NO_MELEE_IF_OOM = 0x08, //Prevents creature from entering melee if out of mana or out of range - //CAST_FORCE_TARGET_SELF = 0x10, //Forces the target to cast this spell on itself - SMARTCAST_AURA_NOT_PRESENT = 0x20 //Only casts the spell if the target does not have an aura from the spell + //SMARTCAST_FORCE_CAST = 0x04, //Forces cast even if creature is out of mana or out of range + //SMARTCAST_NO_MELEE_IF_OOM = 0x08, //Prevents creature from entering melee if out of mana or out of range + //SMARTCAST_FORCE_TARGET_SELF = 0x10, //Forces the target to cast this spell on itself + SMARTCAST_AURA_NOT_PRESENT = 0x20, //Only casts the spell if the target does not have an aura from the spell + SMARTCAST_COMBAT_MOVE = 0x40 //Prevents combat movement if cast successful. Allows movement on range, OOM, LOS }; // one line in DB is one event @@ -1302,11 +1307,10 @@ struct SmartScriptHolder SmartAction action; SmartTarget target; - public: - uint32 GetScriptType() const { return (uint32)source_type; } - uint32 GetEventType() const { return (uint32)event.type; } - uint32 GetActionType() const { return (uint32)action.type; } - uint32 GetTargetType() const { return (uint32)target.type; } + uint32 GetScriptType() const { return (uint32)source_type; } + uint32 GetEventType() const { return (uint32)event.type; } + uint32 GetActionType() const { return (uint32)action.type; } + uint32 GetTargetType() const { return (uint32)target.type; } uint32 timer; bool active; @@ -1345,12 +1349,16 @@ typedef std::vector<SmartScriptHolder> SmartAIEventList; // all events for all entries / guids typedef UNORDERED_MAP<int32, SmartAIEventList> SmartAIEventMap; +// Helper Stores +typedef std::map<uint32 /*entry*/, std::pair<uint32 /*spellId*/, SpellEffIndex /*effIndex*/> > CacheSpellContainer; +typedef std::pair<CacheSpellContainer::const_iterator, CacheSpellContainer::const_iterator> CacheSpellContainerBounds; + class SmartAIMgr { friend class ACE_Singleton<SmartAIMgr, ACE_Null_Mutex>; - SmartAIMgr(){ } + SmartAIMgr() { } public: - ~SmartAIMgr(){ } + ~SmartAIMgr() { } void LoadSmartAIFromDB(); @@ -1362,7 +1370,7 @@ class SmartAIMgr else { if (entry > 0)//first search is for guid (negative), do not drop error if not found - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartAIMgr::GetScript: Could not load Script for Entry %d ScriptType %u.", entry, uint32(type)); + TC_LOG_DEBUG("scripts.ai", "SmartAIMgr::GetScript: Could not load Script for Entry %d ScriptType %u.", entry, uint32(type)); return temp; } } @@ -1378,7 +1386,7 @@ class SmartAIMgr { if (target < SMART_TARGET_NONE || target >= SMART_TARGET_END) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Target type %d, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), target); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Target type %d, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), target); return false; } return true; @@ -1388,7 +1396,7 @@ class SmartAIMgr { if (max < min) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses min/max params wrong (%u/%u), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), min, max); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses min/max params wrong (%u/%u), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), min, max); return false; } return true; @@ -1398,7 +1406,7 @@ class SmartAIMgr { if (pct < -100 || pct > 100) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u has invalid Percent set (%d), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), pct); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u has invalid Percent set (%d), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), pct); return false; } return true; @@ -1408,7 +1416,7 @@ class SmartAIMgr { if (!data) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u Parameter can not be NULL, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u Parameter can not be NULL, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); return false; } return true; @@ -1418,7 +1426,7 @@ class SmartAIMgr { if (!sObjectMgr->GetCreatureTemplate(entry)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Creature entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Creature entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); return false; } return true; @@ -1428,7 +1436,7 @@ class SmartAIMgr { if (!sObjectMgr->GetQuestTemplate(entry)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Quest entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Quest entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); return false; } return true; @@ -1438,7 +1446,7 @@ class SmartAIMgr { if (!sObjectMgr->GetGameObjectTemplate(entry)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent GameObject entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent GameObject entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); return false; } return true; @@ -1448,7 +1456,7 @@ class SmartAIMgr { if (!sSpellMgr->GetSpellInfo(entry)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); return false; } return true; @@ -1458,7 +1466,7 @@ class SmartAIMgr { if (!sItemStore.LookupEntry(entry)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Item entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Item entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); return false; } return true; @@ -1468,7 +1476,7 @@ class SmartAIMgr { if (!sEmotesTextStore.LookupEntry(entry)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Text Emote entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Text Emote entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); return false; } return true; @@ -1478,7 +1486,7 @@ class SmartAIMgr { if (!sEmotesStore.LookupEntry(entry)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Emote entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Emote entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); return false; } return true; @@ -1488,7 +1496,7 @@ class SmartAIMgr { if (!sAreaTriggerStore.LookupEntry(entry)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent AreaTrigger entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent AreaTrigger entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); return false; } return true; @@ -1498,13 +1506,25 @@ class SmartAIMgr { if (!sSoundEntriesStore.LookupEntry(entry)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Sound entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); + TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Sound entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); return false; } return true; } //bool IsTextValid(SmartScriptHolder const& e, uint32 id); + + // Helpers + void LoadHelperStores(); + void UnLoadHelperStores(); + + CacheSpellContainerBounds GetSummonCreatureSpellContainerBounds(uint32 creatureEntry) const; + CacheSpellContainerBounds GetSummonGameObjectSpellContainerBounds(uint32 gameObjectEntry) const; + CacheSpellContainerBounds GetKillCreditSpellContainerBounds(uint32 killCredit) const; + + CacheSpellContainer SummonCreatureSpellStore; + CacheSpellContainer SummonGameObjectSpellStore; + CacheSpellContainer KillCreditSpellStore; }; #define sSmartScriptMgr ACE_Singleton<SmartAIMgr, ACE_Null_Mutex>::instance() diff --git a/src/server/game/Accounts/AccountMgr.cpp b/src/server/game/Accounts/AccountMgr.cpp index 4d95b913e05..4c71a044488 100644 --- a/src/server/game/Accounts/AccountMgr.cpp +++ b/src/server/game/Accounts/AccountMgr.cpp @@ -390,17 +390,17 @@ void AccountMgr::LoadRBAC() { ClearRBAC(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "AccountMgr::LoadRBAC"); + TC_LOG_DEBUG("rbac", "AccountMgr::LoadRBAC"); uint32 oldMSTime = getMSTime(); uint32 count1 = 0; uint32 count2 = 0; uint32 count3 = 0; - TC_LOG_DEBUG(LOG_FILTER_RBAC, "AccountMgr::LoadRBAC: Loading permissions"); + TC_LOG_DEBUG("rbac", "AccountMgr::LoadRBAC: Loading permissions"); QueryResult result = LoginDatabase.Query("SELECT id, name FROM rbac_permissions"); if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 account permission definitions. DB table `rbac_permissions` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 account permission definitions. DB table `rbac_permissions` is empty."); return; } @@ -413,11 +413,11 @@ void AccountMgr::LoadRBAC() } while (result->NextRow()); - TC_LOG_DEBUG(LOG_FILTER_RBAC, "AccountMgr::LoadRBAC: Loading linked permissions"); + TC_LOG_DEBUG("rbac", "AccountMgr::LoadRBAC: Loading linked permissions"); result = LoginDatabase.Query("SELECT id, linkedId FROM rbac_linked_permissions ORDER BY id ASC"); if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 linked permissions. DB table `rbac_linked_permissions` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 linked permissions. DB table `rbac_linked_permissions` is empty."); return; } @@ -437,7 +437,7 @@ void AccountMgr::LoadRBAC() uint32 linkedPermissionId = field[1].GetUInt32(); if (linkedPermissionId == permissionId) { - TC_LOG_ERROR(LOG_FILTER_SQL, "RBAC Permission %u has itself as linked permission. Ignored", permissionId); + TC_LOG_ERROR("sql.sql", "RBAC Permission %u has itself as linked permission. Ignored", permissionId); continue; } permission->AddLinkedPermission(linkedPermissionId); @@ -445,11 +445,11 @@ void AccountMgr::LoadRBAC() } while (result->NextRow()); - TC_LOG_DEBUG(LOG_FILTER_RBAC, "AccountMgr::LoadRBAC: Loading default permissions"); + TC_LOG_DEBUG("rbac", "AccountMgr::LoadRBAC: Loading default permissions"); result = LoginDatabase.Query("SELECT secId, permissionId FROM rbac_default_permissions ORDER BY secId ASC"); if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 default permission definitions. DB table `rbac_default_permissions` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 default permission definitions. DB table `rbac_default_permissions` is empty."); return; } @@ -459,7 +459,7 @@ void AccountMgr::LoadRBAC() { Field* field = result->Fetch(); uint32 newId = field[0].GetUInt32(); - if (secId != newId) + if (secId != newId || permissions == NULL) { secId = newId; permissions = &_defaultPermissions[secId]; @@ -470,7 +470,7 @@ void AccountMgr::LoadRBAC() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u permission definitions, %u linked permissions and %u default permissions in %u ms", count1, count2, count3, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u permission definitions, %u linked permissions and %u default permissions in %u ms", count1, count2, count3, GetMSTimeDiffToNow(oldMSTime)); } void AccountMgr::UpdateAccountAccess(rbac::RBACData* rbac, uint32 accountId, uint8 securityLevel, int32 realmId) @@ -506,7 +506,7 @@ void AccountMgr::UpdateAccountAccess(rbac::RBACData* rbac, uint32 accountId, uin rbac::RBACPermission const* AccountMgr::GetRBACPermission(uint32 permissionId) const { - TC_LOG_TRACE(LOG_FILTER_RBAC, "AccountMgr::GetRBACPermission: %u", permissionId); + TC_LOG_TRACE("rbac", "AccountMgr::GetRBACPermission: %u", permissionId); rbac::RBACPermissionsContainer::const_iterator it = _permissions.find(permissionId); if (it != _permissions.end()) return it->second; @@ -518,7 +518,7 @@ bool AccountMgr::HasPermission(uint32 accountId, uint32 permissionId, uint32 rea { if (!accountId) { - TC_LOG_ERROR(LOG_FILTER_RBAC, "AccountMgr::HasPermission: Wrong accountId 0"); + TC_LOG_ERROR("rbac", "AccountMgr::HasPermission: Wrong accountId 0"); return false; } @@ -526,7 +526,7 @@ bool AccountMgr::HasPermission(uint32 accountId, uint32 permissionId, uint32 rea rbac.LoadFromDB(); bool hasPermission = rbac.HasPermission(permissionId); - TC_LOG_DEBUG(LOG_FILTER_RBAC, "AccountMgr::HasPermission [AccountId: %u, PermissionId: %u, realmId: %d]: %u", + TC_LOG_DEBUG("rbac", "AccountMgr::HasPermission [AccountId: %u, PermissionId: %u, realmId: %d]: %u", accountId, permissionId, realmId, hasPermission); return hasPermission; } @@ -542,6 +542,6 @@ void AccountMgr::ClearRBAC() rbac::RBACPermissionContainer const& AccountMgr::GetRBACDefaultPermissions(uint8 secLevel) { - TC_LOG_TRACE(LOG_FILTER_RBAC, "AccountMgr::GetRBACDefaultPermissions: secLevel %u - size: %u", secLevel, uint32(_defaultPermissions[secLevel].size())); + TC_LOG_TRACE("rbac", "AccountMgr::GetRBACDefaultPermissions: secLevel %u - size: %u", secLevel, uint32(_defaultPermissions[secLevel].size())); return _defaultPermissions[secLevel]; } diff --git a/src/server/game/Accounts/RBAC.cpp b/src/server/game/Accounts/RBAC.cpp index f7c9444cdb0..1d42ed819cd 100644 --- a/src/server/game/Accounts/RBAC.cpp +++ b/src/server/game/Accounts/RBAC.cpp @@ -45,7 +45,7 @@ RBACCommandResult RBACData::GrantPermission(uint32 permissionId, int32 realmId / RBACPermission const* perm = sAccountMgr->GetRBACPermission(permissionId);
if (!perm)
{
- TC_LOG_TRACE(LOG_FILTER_RBAC, "RBACData::GrantPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Permission does not exists",
+ TC_LOG_TRACE("rbac", "RBACData::GrantPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Permission does not exists",
GetId(), GetName().c_str(), permissionId, realmId);
return RBAC_ID_DOES_NOT_EXISTS;
}
@@ -53,7 +53,7 @@ RBACCommandResult RBACData::GrantPermission(uint32 permissionId, int32 realmId / // Check if already added in denied list
if (HasDeniedPermission(permissionId))
{
- TC_LOG_TRACE(LOG_FILTER_RBAC, "RBACData::GrantPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Permission in deny list",
+ TC_LOG_TRACE("rbac", "RBACData::GrantPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Permission in deny list",
GetId(), GetName().c_str(), permissionId, realmId);
return RBAC_IN_DENIED_LIST;
}
@@ -61,7 +61,7 @@ RBACCommandResult RBACData::GrantPermission(uint32 permissionId, int32 realmId / // Already added?
if (HasGrantedPermission(permissionId))
{
- TC_LOG_TRACE(LOG_FILTER_RBAC, "RBACData::GrantPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Permission already granted",
+ TC_LOG_TRACE("rbac", "RBACData::GrantPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Permission already granted",
GetId(), GetName().c_str(), permissionId, realmId);
return RBAC_CANT_ADD_ALREADY_ADDED;
}
@@ -71,13 +71,13 @@ RBACCommandResult RBACData::GrantPermission(uint32 permissionId, int32 realmId / // Do not save to db when loading data from DB (realmId = 0)
if (realmId)
{
- TC_LOG_TRACE(LOG_FILTER_RBAC, "RBACData::GrantPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Ok and DB updated",
+ TC_LOG_TRACE("rbac", "RBACData::GrantPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Ok and DB updated",
GetId(), GetName().c_str(), permissionId, realmId);
SavePermission(permissionId, true, realmId);
CalculateNewPermissions();
}
else
- TC_LOG_TRACE(LOG_FILTER_RBAC, "RBACData::GrantPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Ok",
+ TC_LOG_TRACE("rbac", "RBACData::GrantPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Ok",
GetId(), GetName().c_str(), permissionId, realmId);
return RBAC_OK;
@@ -89,7 +89,7 @@ RBACCommandResult RBACData::DenyPermission(uint32 permissionId, int32 realmId /* RBACPermission const* perm = sAccountMgr->GetRBACPermission(permissionId);
if (!perm)
{
- TC_LOG_TRACE(LOG_FILTER_RBAC, "RBACData::DenyPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Permission does not exists",
+ TC_LOG_TRACE("rbac", "RBACData::DenyPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Permission does not exists",
GetId(), GetName().c_str(), permissionId, realmId);
return RBAC_ID_DOES_NOT_EXISTS;
}
@@ -97,7 +97,7 @@ RBACCommandResult RBACData::DenyPermission(uint32 permissionId, int32 realmId /* // Check if already added in granted list
if (HasGrantedPermission(permissionId))
{
- TC_LOG_TRACE(LOG_FILTER_RBAC, "RBACData::DenyPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Permission in grant list",
+ TC_LOG_TRACE("rbac", "RBACData::DenyPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Permission in grant list",
GetId(), GetName().c_str(), permissionId, realmId);
return RBAC_IN_GRANTED_LIST;
}
@@ -105,7 +105,7 @@ RBACCommandResult RBACData::DenyPermission(uint32 permissionId, int32 realmId /* // Already added?
if (HasDeniedPermission(permissionId))
{
- TC_LOG_TRACE(LOG_FILTER_RBAC, "RBACData::DenyPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Permission already denied",
+ TC_LOG_TRACE("rbac", "RBACData::DenyPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Permission already denied",
GetId(), GetName().c_str(), permissionId, realmId);
return RBAC_CANT_ADD_ALREADY_ADDED;
}
@@ -115,13 +115,13 @@ RBACCommandResult RBACData::DenyPermission(uint32 permissionId, int32 realmId /* // Do not save to db when loading data from DB (realmId = 0)
if (realmId)
{
- TC_LOG_TRACE(LOG_FILTER_RBAC, "RBACData::DenyPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Ok and DB updated",
+ TC_LOG_TRACE("rbac", "RBACData::DenyPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Ok and DB updated",
GetId(), GetName().c_str(), permissionId, realmId);
SavePermission(permissionId, false, realmId);
CalculateNewPermissions();
}
else
- TC_LOG_TRACE(LOG_FILTER_RBAC, "RBACData::DenyPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Ok",
+ TC_LOG_TRACE("rbac", "RBACData::DenyPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Ok",
GetId(), GetName().c_str(), permissionId, realmId);
return RBAC_OK;
@@ -142,7 +142,7 @@ RBACCommandResult RBACData::RevokePermission(uint32 permissionId, int32 realmId // Check if it's present in any list
if (!HasGrantedPermission(permissionId) && !HasDeniedPermission(permissionId))
{
- TC_LOG_TRACE(LOG_FILTER_RBAC, "RBACData::RevokePermission [Id: %u Name: %s] (Permission %u, RealmId %d). Not granted or revoked",
+ TC_LOG_TRACE("rbac", "RBACData::RevokePermission [Id: %u Name: %s] (Permission %u, RealmId %d). Not granted or revoked",
GetId(), GetName().c_str(), permissionId, realmId);
return RBAC_CANT_REVOKE_NOT_IN_LIST;
}
@@ -153,7 +153,7 @@ RBACCommandResult RBACData::RevokePermission(uint32 permissionId, int32 realmId // Do not save to db when loading data from DB (realmId = 0)
if (realmId)
{
- TC_LOG_TRACE(LOG_FILTER_RBAC, "RBACData::RevokePermission [Id: %u Name: %s] (Permission %u, RealmId %d). Ok and DB updated",
+ TC_LOG_TRACE("rbac", "RBACData::RevokePermission [Id: %u Name: %s] (Permission %u, RealmId %d). Ok and DB updated",
GetId(), GetName().c_str(), permissionId, realmId);
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_RBAC_ACCOUNT_PERMISSION);
stmt->setUInt32(0, GetId());
@@ -164,7 +164,7 @@ RBACCommandResult RBACData::RevokePermission(uint32 permissionId, int32 realmId CalculateNewPermissions();
}
else
- TC_LOG_TRACE(LOG_FILTER_RBAC, "RBACData::RevokePermission [Id: %u Name: %s] (Permission %u, RealmId %d). Ok",
+ TC_LOG_TRACE("rbac", "RBACData::RevokePermission [Id: %u Name: %s] (Permission %u, RealmId %d). Ok",
GetId(), GetName().c_str(), permissionId, realmId);
return RBAC_OK;
@@ -174,7 +174,7 @@ void RBACData::LoadFromDB() {
ClearData();
- TC_LOG_DEBUG(LOG_FILTER_RBAC, "RBACData::LoadFromDB [Id: %u Name: %s]: Loading permissions", GetId(), GetName().c_str());
+ TC_LOG_DEBUG("rbac", "RBACData::LoadFromDB [Id: %u Name: %s]: Loading permissions", GetId(), GetName().c_str());
// Load account permissions (granted and denied) that affect current realm
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_RBAC_ACCOUNT_PERMISSIONS);
stmt->setUInt32(0, GetId());
@@ -205,7 +205,7 @@ void RBACData::LoadFromDB() void RBACData::CalculateNewPermissions()
{
- TC_LOG_TRACE(LOG_FILTER_RBAC, "RBACData::CalculateNewPermissions [Id: %u Name: %s]", GetId(), GetName().c_str());
+ TC_LOG_TRACE("rbac", "RBACData::CalculateNewPermissions [Id: %u Name: %s]", GetId(), GetName().c_str());
// Get the list of granted permissions
_globalPerms = GetGrantedPermissions();
@@ -252,7 +252,7 @@ void RBACData::ExpandPermissions(RBACPermissionContainer& permissions) toCheck.insert(*itr);
}
- TC_LOG_DEBUG(LOG_FILTER_RBAC, "RBACData::ExpandPermissions: Expanded: %s", GetDebugPermissionString(permissions).c_str());
+ TC_LOG_DEBUG("rbac", "RBACData::ExpandPermissions: Expanded: %s", GetDebugPermissionString(permissions).c_str());
}
void RBACData::ClearData()
diff --git a/src/server/game/Accounts/RBAC.h b/src/server/game/Accounts/RBAC.h index bcc4122ea5b..b18996f2af0 100644 --- a/src/server/game/Accounts/RBAC.h +++ b/src/server/game/Accounts/RBAC.h @@ -517,7 +517,7 @@ enum RBACPermissions RBAC_PERM_COMMAND_RELOAD_ALL = 611, RBAC_PERM_COMMAND_RELOAD_ALL_ACHIEVEMENT = 612, RBAC_PERM_COMMAND_RELOAD_ALL_AREA = 613, - RBAC_PERM_COMMAND_RELOAD_ALL_EVENTAI = 614, + RBAC_PERM_UNUSED_614 = 614, // unused RBAC_PERM_COMMAND_RELOAD_ALL_GOSSIP = 615, RBAC_PERM_COMMAND_RELOAD_ALL_ITEM = 616, RBAC_PERM_COMMAND_RELOAD_ALL_LOCALES = 617, @@ -534,8 +534,8 @@ enum RBACPermissions RBAC_PERM_COMMAND_RELOAD_COMMAND = 628, RBAC_PERM_COMMAND_RELOAD_CONDITIONS = 629, RBAC_PERM_COMMAND_RELOAD_CONFIG = 630, - RBAC_PERM_COMMAND_RELOAD_CREATURE_AI_SCRIPTS = 631, - RBAC_PERM_COMMAND_RELOAD_CREATURE_AI_TEXTS = 632, + RBAC_PERM_UNUSED_631 = 631, // unused + RBAC_PERM_UNUSED_632 = 632, // unused RBAC_PERM_COMMAND_RELOAD_CREATURE_LINKED_RESPAWN = 633, RBAC_PERM_COMMAND_RELOAD_CREATURE_LOOT_TEMPLATE = 634, RBAC_PERM_COMMAND_RELOAD_CREATURE_ONKILL_REPUTATION = 635, @@ -788,7 +788,7 @@ class RBACData * // previously defined "RBACData* rbac" with proper initialization * uint32 permissionId = 2; * if (rbac->GrantRole(permissionId) == RBAC_IN_DENIED_LIST) - * TC_LOG_DEBUG(LOG_FILTER_PLAYER, "Failed to grant permission %u, already denied", permissionId); + * TC_LOG_DEBUG("entities.player", "Failed to grant permission %u, already denied", permissionId); * @endcode */ RBACCommandResult GrantPermission(uint32 permissionId, int32 realmId = 0); @@ -811,7 +811,7 @@ class RBACData * // previously defined "RBACData* rbac" with proper initialization * uint32 permissionId = 2; * if (rbac->DenyRole(permissionId) == RBAC_ID_DOES_NOT_EXISTS) - * TC_LOG_DEBUG(LOG_FILTER_PLAYER, "Role Id %u does not exists", permissionId); + * TC_LOG_DEBUG("entities.player", "Role Id %u does not exists", permissionId); * @endcode */ RBACCommandResult DenyPermission(uint32 permissionId, int32 realmId = 0); @@ -835,7 +835,7 @@ class RBACData * // previously defined "RBACData* rbac" with proper initialization * uint32 permissionId = 2; * if (rbac->RevokeRole(permissionId) == RBAC_OK) - * TC_LOG_DEBUG(LOG_FILTER_PLAYER, "Permission %u succesfully removed", permissionId); + * TC_LOG_DEBUG("entities.player", "Permission %u succesfully removed", permissionId); * @endcode */ RBACCommandResult RevokePermission(uint32 permissionId, int32 realmId = 0); diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp index 2449aa76992..0f1dd1c53c6 100644 --- a/src/server/game/Achievements/AchievementMgr.cpp +++ b/src/server/game/Achievements/AchievementMgr.cpp @@ -75,7 +75,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) { if (dataType >= MAX_ACHIEVEMENT_CRITERIA_DATA_TYPE) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `achievement_criteria_data` for criteria (Entry: %u) has wrong data type (%u), ignored.", criteria->ID, dataType); + TC_LOG_ERROR("sql.sql", "Table `achievement_criteria_data` for criteria (Entry: %u) has wrong data type (%u), ignored.", criteria->ID, dataType); return false; } @@ -108,7 +108,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) default: if (dataType != ACHIEVEMENT_CRITERIA_DATA_TYPE_SCRIPT) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `achievement_criteria_data` has data for non-supported criteria type (Entry: %u Type: %u), ignored.", criteria->ID, criteria->requiredType); + TC_LOG_ERROR("sql.sql", "Table `achievement_criteria_data` has data for non-supported criteria type (Entry: %u Type: %u), ignored.", criteria->ID, criteria->requiredType); return false; } break; @@ -122,7 +122,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_CREATURE: if (!creature.id || !sObjectMgr->GetCreatureTemplate(creature.id)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_CREATURE (%u) has non-existing creature id in value1 (%u), ignored.", + TC_LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_CREATURE (%u) has non-existing creature id in value1 (%u), ignored.", criteria->ID, criteria->requiredType, dataType, creature.id); return false; } @@ -130,13 +130,13 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE: if (classRace.class_id && ((1 << (classRace.class_id-1)) & CLASSMASK_ALL_PLAYABLE) == 0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE (%u) has non-existing class in value1 (%u), ignored.", + TC_LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE (%u) has non-existing class in value1 (%u), ignored.", criteria->ID, criteria->requiredType, dataType, classRace.class_id); return false; } if (classRace.race_id && ((1 << (classRace.race_id-1)) & RACEMASK_ALL_PLAYABLE) == 0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE (%u) has non-existing race in value2 (%u), ignored.", + TC_LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE (%u) has non-existing race in value2 (%u), ignored.", criteria->ID, criteria->requiredType, dataType, classRace.race_id); return false; } @@ -144,7 +144,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_LESS_HEALTH: if (health.percent < 1 || health.percent > 100) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_PLAYER_LESS_HEALTH (%u) has wrong percent value in value1 (%u), ignored.", + TC_LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_PLAYER_LESS_HEALTH (%u) has wrong percent value in value1 (%u), ignored.", criteria->ID, criteria->requiredType, dataType, health.percent); return false; } @@ -152,7 +152,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_DEAD: if (player_dead.own_team_flag > 1) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_DEAD (%u) has wrong boolean value1 (%u).", + TC_LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_DEAD (%u) has wrong boolean value1 (%u).", criteria->ID, criteria->requiredType, dataType, player_dead.own_team_flag); return false; } @@ -163,19 +163,19 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(aura.spell_id); if (!spellEntry) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) has wrong spell id in value1 (%u), ignored.", + TC_LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) has wrong spell id in value1 (%u), ignored.", criteria->ID, criteria->requiredType, (dataType == ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA?"ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA":"ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA"), dataType, aura.spell_id); return false; } if (aura.effect_idx >= 3) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) has wrong spell effect index in value2 (%u), ignored.", + TC_LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) has wrong spell effect index in value2 (%u), ignored.", criteria->ID, criteria->requiredType, (dataType == ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA?"ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA":"ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA"), dataType, aura.effect_idx); return false; } if (!spellEntry->Effects[aura.effect_idx].ApplyAuraName) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) has non-aura spell effect (ID: %u Effect: %u), ignores.", + TC_LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) has non-aura spell effect (ID: %u Effect: %u), ignores.", criteria->ID, criteria->requiredType, (dataType == ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA?"ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA":"ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA"), dataType, aura.spell_id, aura.effect_idx); return false; } @@ -184,7 +184,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AREA: if (!GetAreaEntryByAreaID(area.id)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AREA (%u) has wrong area id in value1 (%u), ignored.", + TC_LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AREA (%u) has wrong area id in value1 (%u), ignored.", criteria->ID, criteria->requiredType, dataType, area.id); return false; } @@ -192,7 +192,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_VALUE: if (value.compType >= COMP_TYPE_MAX) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_VALUE (%u) has wrong ComparisionType in value2 (%u), ignored.", + TC_LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_VALUE (%u) has wrong ComparisionType in value2 (%u), ignored.", criteria->ID, criteria->requiredType, dataType, value.compType); return false; } @@ -200,7 +200,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_LEVEL: if (level.minlevel > STRONG_MAX_LEVEL) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_LEVEL (%u) has wrong minlevel in value1 (%u), ignored.", + TC_LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_LEVEL (%u) has wrong minlevel in value1 (%u), ignored.", criteria->ID, criteria->requiredType, dataType, level.minlevel); return false; } @@ -208,7 +208,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_GENDER: if (gender.gender > GENDER_NONE) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_GENDER (%u) has wrong gender in value1 (%u), ignored.", + TC_LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_GENDER (%u) has wrong gender in value1 (%u), ignored.", criteria->ID, criteria->requiredType, dataType, gender.gender); return false; } @@ -216,7 +216,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_SCRIPT: if (!ScriptId) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_SCRIPT (%u) does not have ScriptName set, ignored.", + TC_LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_SCRIPT (%u) does not have ScriptName set, ignored.", criteria->ID, criteria->requiredType, dataType); return false; } @@ -224,7 +224,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_DIFFICULTY: if (difficulty.difficulty >= MAX_DIFFICULTY) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_DIFFICULTY (%u) has wrong difficulty in value1 (%u), ignored.", + TC_LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_DIFFICULTY (%u) has wrong difficulty in value1 (%u), ignored.", criteria->ID, criteria->requiredType, dataType, difficulty.difficulty); return false; } @@ -232,7 +232,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_PLAYER_COUNT: if (map_players.maxcount <= 0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_PLAYER_COUNT (%u) has wrong max players count in value1 (%u), ignored.", + TC_LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_PLAYER_COUNT (%u) has wrong max players count in value1 (%u), ignored.", criteria->ID, criteria->requiredType, dataType, map_players.maxcount); return false; } @@ -240,7 +240,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_TEAM: if (team.team != ALLIANCE && team.team != HORDE) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_TEAM (%u) has unknown team in value1 (%u), ignored.", + TC_LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_TEAM (%u) has unknown team in value1 (%u), ignored.", criteria->ID, criteria->requiredType, dataType, team.team); return false; } @@ -248,7 +248,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_DRUNK: if (drunk.state >= MAX_DRUNKEN) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_DRUNK (%u) has unknown drunken state in value1 (%u), ignored.", + TC_LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_DRUNK (%u) has unknown drunken state in value1 (%u), ignored.", criteria->ID, criteria->requiredType, dataType, drunk.state); return false; } @@ -256,7 +256,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_HOLIDAY: if (!sHolidaysStore.LookupEntry(holiday.id)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_HOLIDAY (%u) has unknown holiday in value1 (%u), ignored.", + TC_LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_HOLIDAY (%u) has unknown holiday in value1 (%u), ignored.", criteria->ID, criteria->requiredType, dataType, holiday.id); return false; } @@ -266,7 +266,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_EQUIPED_ITEM: if (equipped_item.item_quality >= MAX_ITEM_QUALITY) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `achievement_criteria_requirement` (Entry: %u Type: %u) for requirement ACHIEVEMENT_CRITERIA_REQUIRE_S_EQUIPED_ITEM (%u) has unknown quality state in value1 (%u), ignored.", + TC_LOG_ERROR("sql.sql", "Table `achievement_criteria_requirement` (Entry: %u Type: %u) for requirement ACHIEVEMENT_CRITERIA_REQUIRE_S_EQUIPED_ITEM (%u) has unknown quality state in value1 (%u), ignored.", criteria->ID, criteria->requiredType, dataType, equipped_item.item_quality); return false; } @@ -274,7 +274,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_ID: if (!sMapStore.LookupEntry(map_id.mapId)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `achievement_criteria_requirement` (Entry: %u Type: %u) for requirement ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_ID (%u) has unknown map id in value1 (%u), ignored.", + TC_LOG_ERROR("sql.sql", "Table `achievement_criteria_requirement` (Entry: %u Type: %u) for requirement ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_ID (%u) has unknown map id in value1 (%u), ignored.", criteria->ID, criteria->requiredType, dataType, map_id.mapId); return false; } @@ -282,25 +282,25 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_PLAYER_CLASS_RACE: if (!classRace.class_id && !classRace.race_id) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_PLAYER_CLASS_RACE (%u) must not have 0 in either value field, ignored.", + TC_LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_PLAYER_CLASS_RACE (%u) must not have 0 in either value field, ignored.", criteria->ID, criteria->requiredType, dataType); return false; } if (classRace.class_id && ((1 << (classRace.class_id-1)) & CLASSMASK_ALL_PLAYABLE) == 0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_PLAYER_CLASS_RACE (%u) has non-existing class in value1 (%u), ignored.", + TC_LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_PLAYER_CLASS_RACE (%u) has non-existing class in value1 (%u), ignored.", criteria->ID, criteria->requiredType, dataType, classRace.class_id); return false; } if (classRace.race_id && ((1 << (classRace.race_id-1)) & RACEMASK_ALL_PLAYABLE) == 0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_PLAYER_CLASS_RACE (%u) has non-existing race in value2 (%u), ignored.", + TC_LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_PLAYER_CLASS_RACE (%u) has non-existing race in value2 (%u), ignored.", criteria->ID, criteria->requiredType, dataType, classRace.race_id); return false; } return true; default: - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) has data for non-supported data type (%u), ignored.", criteria->ID, criteria->requiredType, dataType); + TC_LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) has data for non-supported data type (%u), ignored.", criteria->ID, criteria->requiredType, dataType); return false; } } @@ -395,14 +395,14 @@ bool AchievementCriteriaData::Meets(uint32 criteria_id, Player const* source, Un Map* map = source->GetMap(); if (!map->IsDungeon()) { - TC_LOG_ERROR(LOG_FILTER_ACHIEVEMENTSYS, "Achievement system call ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT (%u) for achievement criteria %u for non-dungeon/non-raid map %u", + TC_LOG_ERROR("achievement", "Achievement system call ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT (%u) for achievement criteria %u for non-dungeon/non-raid map %u", ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT, criteria_id, map->GetId()); return false; } InstanceScript* instance = ((InstanceMap*)map)->GetInstanceScript(); if (!instance) { - TC_LOG_ERROR(LOG_FILTER_ACHIEVEMENTSYS, "Achievement system call ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT (%u) for achievement criteria %u for map %u but map does not have a instance script", + TC_LOG_ERROR("achievement", "Achievement system call ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT (%u) for achievement criteria %u for map %u but map does not have a instance script", ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT, criteria_id, map->GetId()); return false; } @@ -465,7 +465,7 @@ void AchievementMgr::Reset() void AchievementMgr::ResetAchievementCriteria(AchievementCriteriaTypes type, uint32 miscvalue1, uint32 miscvalue2, bool evenIfCriteriaComplete) { - TC_LOG_DEBUG(LOG_FILTER_ACHIEVEMENTSYS, "AchievementMgr::ResetAchievementCriteria(%u, %u, %u)", type, miscvalue1, miscvalue2); + TC_LOG_DEBUG("achievement", "AchievementMgr::ResetAchievementCriteria(%u, %u, %u)", type, miscvalue1, miscvalue2); // disable for gamemasters with GM-mode enabled if (m_player->IsGameMaster()) @@ -601,7 +601,7 @@ void AchievementMgr::LoadFromDB(PreparedQueryResult achievementResult, PreparedQ if (!criteria) { // we will remove not existed criteria for all characters - TC_LOG_ERROR(LOG_FILTER_ACHIEVEMENTSYS, "Non-existing achievement criteria %u data removed from table `character_achievement_progress`.", id); + TC_LOG_ERROR("achievement", "Non-existing achievement criteria %u data removed from table `character_achievement_progress`.", id); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_ACHIEV_PROGRESS_CRITERIA); @@ -633,7 +633,7 @@ void AchievementMgr::SendAchievementEarned(AchievementEntry const* achievement) return; #ifdef TRINITY_DEBUG - TC_LOG_DEBUG(LOG_FILTER_ACHIEVEMENTSYS, "AchievementMgr::SendAchievementEarned(%u)", achievement->ID); + TC_LOG_DEBUG("achievement", "AchievementMgr::SendAchievementEarned(%u)", achievement->ID); #endif if (Guild* guild = sGuildMgr->GetGuildById(GetPlayer()->GetGuildId())) @@ -722,7 +722,7 @@ static const uint32 achievIdForDungeon[][4] = */ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1 /*= 0*/, uint32 miscValue2 /*= 0*/, Unit* unit /*= NULL*/) { - TC_LOG_DEBUG(LOG_FILTER_ACHIEVEMENTSYS, "AchievementMgr::UpdateAchievementCriteria(%u, %u, %u)", type, miscValue1, miscValue2); + TC_LOG_DEBUG("achievement", "AchievementMgr::UpdateAchievementCriteria(%u, %u, %u)", type, miscValue1, miscValue2); // disable for gamemasters with GM-mode enabled if (m_player->IsGameMaster()) @@ -1858,7 +1858,7 @@ void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* entry, if (entry->timeLimit && timedIter == m_timedAchievements.end()) return; - TC_LOG_DEBUG(LOG_FILTER_ACHIEVEMENTSYS, "AchievementMgr::SetCriteriaProgress(%u, %u) for (GUID:%u)", entry->ID, changeValue, m_player->GetGUIDLow()); + TC_LOG_DEBUG("achievement", "AchievementMgr::SetCriteriaProgress(%u, %u) for (GUID:%u)", entry->ID, changeValue, m_player->GetGUIDLow()); CriteriaProgress* progress = GetCriteriaProgress(entry); if (!progress) @@ -2010,7 +2010,7 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement) if (achievement->flags & ACHIEVEMENT_FLAG_COUNTER || HasAchieved(achievement->ID)) return; - TC_LOG_INFO(LOG_FILTER_ACHIEVEMENTSYS, "AchievementMgr::CompletedAchievement(%u). Player: %s (%u)", + TC_LOG_INFO("achievement", "AchievementMgr::CompletedAchievement(%u). Player: %s (%u)", achievement->ID, m_player->GetName().c_str(), m_player->GetGUIDLow()); SendAchievementEarned(achievement); @@ -2175,7 +2175,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaList() if (sAchievementCriteriaStore.GetNumRows() == 0) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 achievement criteria."); + TC_LOG_ERROR("server.loading", ">> Loaded 0 achievement criteria."); return; } @@ -2195,7 +2195,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaList() ++loaded; } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u achievement criteria in %u ms", loaded, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u achievement criteria in %u ms", loaded, GetMSTimeDiffToNow(oldMSTime)); } void AchievementGlobalMgr::LoadAchievementReferenceList() @@ -2204,7 +2204,7 @@ void AchievementGlobalMgr::LoadAchievementReferenceList() if (sAchievementStore.GetNumRows() == 0) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 achievement references."); + TC_LOG_INFO("server.loading", ">> Loaded 0 achievement references."); return; } @@ -2224,7 +2224,7 @@ void AchievementGlobalMgr::LoadAchievementReferenceList() if (AchievementEntry const* achievement = sAchievementMgr->GetAchievement(4539)) const_cast<AchievementEntry*>(achievement)->mapID = 631; // Correct map requirement (currently has Ulduar) - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u achievement references in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u achievement references in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void AchievementGlobalMgr::LoadAchievementCriteriaData() @@ -2237,7 +2237,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 additional achievement criteria data. DB table `achievement_criteria_data` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 additional achievement criteria data. DB table `achievement_criteria_data` is empty."); return; } @@ -2252,7 +2252,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData() if (!criteria) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `achievement_criteria_data` has data for non-existing criteria (Entry: %u), ignore.", criteria_id); + TC_LOG_ERROR("sql.sql", "Table `achievement_criteria_data` has data for non-existing criteria (Entry: %u), ignore.", criteria_id); continue; } @@ -2262,7 +2262,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData() if (scriptName.length()) // not empty { if (dataType != ACHIEVEMENT_CRITERIA_DATA_TYPE_SCRIPT) - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `achievement_criteria_data` has ScriptName set for non-scripted data type (Entry: %u, type %u), useless data.", criteria_id, dataType); + TC_LOG_ERROR("sql.sql", "Table `achievement_criteria_data` has ScriptName set for non-scripted data type (Entry: %u, type %u), useless data.", criteria_id, dataType); else scriptId = sObjectMgr->GetScriptId(scriptName.c_str()); } @@ -2366,10 +2366,10 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData() } if (!GetCriteriaDataSet(criteria) && !DisableMgr::IsDisabledFor(DISABLE_TYPE_ACHIEVEMENT_CRITERIA, entryId, NULL)) - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `achievement_criteria_data` does not have expected data for criteria (Entry: %u Type: %u) for achievement %u.", criteria->ID, criteria->requiredType, criteria->referredAchievement); + TC_LOG_ERROR("sql.sql", "Table `achievement_criteria_data` does not have expected data for criteria (Entry: %u Type: %u) for achievement %u.", criteria->ID, criteria->requiredType, criteria->referredAchievement); } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u additional achievement criteria data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u additional achievement criteria data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void AchievementGlobalMgr::LoadCompletedAchievements() @@ -2380,7 +2380,7 @@ void AchievementGlobalMgr::LoadCompletedAchievements() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 realm first completed achievements. DB table `character_achievement` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 realm first completed achievements. DB table `character_achievement` is empty."); return; } @@ -2393,7 +2393,7 @@ void AchievementGlobalMgr::LoadCompletedAchievements() if (!achievement) { // Remove non existent achievements from all characters - TC_LOG_ERROR(LOG_FILTER_ACHIEVEMENTSYS, "Non-existing achievement %u data removed from table `character_achievement`.", achievementId); + TC_LOG_ERROR("achievement", "Non-existing achievement %u data removed from table `character_achievement`.", achievementId); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_ACHIEVMENT); stmt->setUInt16(0, uint16(achievementId)); @@ -2406,7 +2406,7 @@ void AchievementGlobalMgr::LoadCompletedAchievements() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu realm first completed achievements in %u ms", (unsigned long)m_allCompletedAchievements.size(), GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %lu realm first completed achievements in %u ms", (unsigned long)m_allCompletedAchievements.size(), GetMSTimeDiffToNow(oldMSTime)); } void AchievementGlobalMgr::LoadRewards() @@ -2420,7 +2420,7 @@ void AchievementGlobalMgr::LoadRewards() if (!result) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 achievement rewards. DB table `achievement_reward` is empty."); + TC_LOG_ERROR("server.loading", ">> Loaded 0 achievement rewards. DB table `achievement_reward` is empty."); return; } @@ -2433,7 +2433,7 @@ void AchievementGlobalMgr::LoadRewards() const AchievementEntry* pAchievement = GetAchievement(entry); if (!pAchievement) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `achievement_reward` has wrong achievement (Entry: %u), ignored.", entry); + TC_LOG_ERROR("sql.sql", "Table `achievement_reward` has wrong achievement (Entry: %u), ignored.", entry); continue; } @@ -2448,19 +2448,19 @@ void AchievementGlobalMgr::LoadRewards() // must be title or mail at least if (!reward.titleId[0] && !reward.titleId[1] && !reward.sender) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `achievement_reward` (Entry: %u) does not have title or item reward data, ignored.", entry); + TC_LOG_ERROR("sql.sql", "Table `achievement_reward` (Entry: %u) does not have title or item reward data, ignored.", entry); continue; } if (pAchievement->requiredFaction == ACHIEVEMENT_FACTION_ANY && ((reward.titleId[0] == 0) != (reward.titleId[1] == 0))) - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `achievement_reward` (Entry: %u) has title (A: %u H: %u) for only one team.", entry, reward.titleId[0], reward.titleId[1]); + TC_LOG_ERROR("sql.sql", "Table `achievement_reward` (Entry: %u) has title (A: %u H: %u) for only one team.", entry, reward.titleId[0], reward.titleId[1]); if (reward.titleId[0]) { CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(reward.titleId[0]); if (!titleEntry) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `achievement_reward` (Entry: %u) has invalid title id (%u) in `title_A`, set to 0", entry, reward.titleId[0]); + TC_LOG_ERROR("sql.sql", "Table `achievement_reward` (Entry: %u) has invalid title id (%u) in `title_A`, set to 0", entry, reward.titleId[0]); reward.titleId[0] = 0; } } @@ -2470,7 +2470,7 @@ void AchievementGlobalMgr::LoadRewards() CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(reward.titleId[1]); if (!titleEntry) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `achievement_reward` (Entry: %u) has invalid title id (%u) in `title_H`, set to 0", entry, reward.titleId[1]); + TC_LOG_ERROR("sql.sql", "Table `achievement_reward` (Entry: %u) has invalid title id (%u) in `title_H`, set to 0", entry, reward.titleId[1]); reward.titleId[1] = 0; } } @@ -2480,27 +2480,27 @@ void AchievementGlobalMgr::LoadRewards() { if (!sObjectMgr->GetCreatureTemplate(reward.sender)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `achievement_reward` (Entry: %u) has invalid creature entry %u as sender, mail reward skipped.", entry, reward.sender); + TC_LOG_ERROR("sql.sql", "Table `achievement_reward` (Entry: %u) has invalid creature entry %u as sender, mail reward skipped.", entry, reward.sender); reward.sender = 0; } } else { if (reward.itemId) - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `achievement_reward` (Entry: %u) does not have sender data but has item reward, item will not be rewarded.", entry); + TC_LOG_ERROR("sql.sql", "Table `achievement_reward` (Entry: %u) does not have sender data but has item reward, item will not be rewarded.", entry); if (!reward.subject.empty()) - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `achievement_reward` (Entry: %u) does not have sender data but has mail subject.", entry); + TC_LOG_ERROR("sql.sql", "Table `achievement_reward` (Entry: %u) does not have sender data but has mail subject.", entry); if (!reward.text.empty()) - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `achievement_reward` (Entry: %u) does not have sender data but has mail text.", entry); + TC_LOG_ERROR("sql.sql", "Table `achievement_reward` (Entry: %u) does not have sender data but has mail text.", entry); } if (reward.itemId) { if (!sObjectMgr->GetItemTemplate(reward.itemId)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `achievement_reward` (Entry: %u) has invalid item id %u, reward mail will not contain item.", entry, reward.itemId); + TC_LOG_ERROR("sql.sql", "Table `achievement_reward` (Entry: %u) has invalid item id %u, reward mail will not contain item.", entry, reward.itemId); reward.itemId = 0; } } @@ -2510,7 +2510,7 @@ void AchievementGlobalMgr::LoadRewards() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u achievement rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u achievement rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void AchievementGlobalMgr::LoadRewardLocales() @@ -2525,7 +2525,7 @@ void AchievementGlobalMgr::LoadRewardLocales() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 achievement reward locale strings. DB table `locales_achievement_reward` is empty"); + TC_LOG_INFO("server.loading", ">> Loaded 0 achievement reward locale strings. DB table `locales_achievement_reward` is empty"); return; } @@ -2537,7 +2537,7 @@ void AchievementGlobalMgr::LoadRewardLocales() if (m_achievementRewards.find(entry) == m_achievementRewards.end()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `locales_achievement_reward` (Entry: %u) has locale strings for non-existing achievement reward.", entry); + TC_LOG_ERROR("sql.sql", "Table `locales_achievement_reward` (Entry: %u) has locale strings for non-existing achievement reward.", entry); continue; } @@ -2552,7 +2552,7 @@ void AchievementGlobalMgr::LoadRewardLocales() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu achievement reward locale strings in %u ms", (unsigned long)m_achievementRewardLocales.size(), GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %lu achievement reward locale strings in %u ms", (unsigned long)m_achievementRewardLocales.size(), GetMSTimeDiffToNow(oldMSTime)); } AchievementEntry const* AchievementGlobalMgr::GetAchievement(uint32 achievementId) const diff --git a/src/server/game/Addons/AddonMgr.cpp b/src/server/game/Addons/AddonMgr.cpp index 46a2b4bafe2..ec78a7565d4 100644 --- a/src/server/game/Addons/AddonMgr.cpp +++ b/src/server/game/Addons/AddonMgr.cpp @@ -60,10 +60,10 @@ void LoadFromDB() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u known addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u known addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } else - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 known addons. DB table `addons` is empty!"); + TC_LOG_INFO("server.loading", ">> Loaded 0 known addons. DB table `addons` is empty!"); oldMSTime = getMSTime(); result = CharacterDatabase.Query("SELECT id, name, version, UNIX_TIMESTAMP(timestamp) FROM banned_addons"); @@ -92,7 +92,7 @@ void LoadFromDB() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u banned addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u banned addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp index 7c3c1a59712..ec2dec8df08 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp @@ -73,10 +73,10 @@ uint32 AuctionHouseMgr::GetAuctionDeposit(AuctionHouseEntry const* entry, uint32 uint32 timeHr = (((time / 60) / 60) / 12); uint32 deposit = uint32(((multiplier * MSV * count / 3) * timeHr * 3) * sWorld->getRate(RATE_AUCTION_DEPOSIT)); - TC_LOG_DEBUG(LOG_FILTER_AUCTIONHOUSE, "MSV: %u", MSV); - TC_LOG_DEBUG(LOG_FILTER_AUCTIONHOUSE, "Items: %u", count); - TC_LOG_DEBUG(LOG_FILTER_AUCTIONHOUSE, "Multiplier: %f", multiplier); - TC_LOG_DEBUG(LOG_FILTER_AUCTIONHOUSE, "Deposit: %u", deposit); + TC_LOG_DEBUG("auctionHouse", "MSV: %u", MSV); + TC_LOG_DEBUG("auctionHouse", "Items: %u", count); + TC_LOG_DEBUG("auctionHouse", "Multiplier: %f", multiplier); + TC_LOG_DEBUG("auctionHouse", "Deposit: %u", deposit); if (deposit < AH_MINIMUM_DEPOSIT) return AH_MINIMUM_DEPOSIT; @@ -266,7 +266,7 @@ void AuctionHouseMgr::LoadAuctionItems() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 auction items. DB table `auctionhouse` or `item_instance` is empty!"); + TC_LOG_INFO("server.loading", ">> Loaded 0 auction items. DB table `auctionhouse` or `item_instance` is empty!"); return; } @@ -283,7 +283,7 @@ void AuctionHouseMgr::LoadAuctionItems() ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemEntry); if (!proto) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "AuctionHouseMgr::LoadAuctionItems: Unknown item (GUID: %u id: #%u) in auction, skipped.", item_guid, itemEntry); + TC_LOG_ERROR("misc", "AuctionHouseMgr::LoadAuctionItems: Unknown item (GUID: %u id: #%u) in auction, skipped.", item_guid, itemEntry); continue; } @@ -299,7 +299,7 @@ void AuctionHouseMgr::LoadAuctionItems() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u auction items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u auction items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -312,7 +312,7 @@ void AuctionHouseMgr::LoadAuctions() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 auctions. DB table `auctionhouse` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 auctions. DB table `auctionhouse` is empty."); return; } @@ -338,7 +338,7 @@ void AuctionHouseMgr::LoadAuctions() CharacterDatabase.CommitTransaction(trans); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u auctions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u auctions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -608,7 +608,7 @@ bool AuctionEntry::BuildAuctionInfo(WorldPacket& data) const Item* item = sAuctionMgr->GetAItem(itemGUIDLow); if (!item) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "AuctionEntry::BuildAuctionInfo: Auction %u has a non-existent item: %u", Id, itemGUIDLow); + TC_LOG_ERROR("misc", "AuctionEntry::BuildAuctionInfo: Auction %u has a non-existent item: %u", Id, itemGUIDLow); return false; } data << uint32(Id); @@ -691,14 +691,14 @@ bool AuctionEntry::LoadFromDB(Field* fields) CreatureData const* auctioneerData = sObjectMgr->GetCreatureData(auctioneer); if (!auctioneerData) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Auction %u has not a existing auctioneer (GUID : %u)", Id, auctioneer); + TC_LOG_ERROR("misc", "Auction %u has not a existing auctioneer (GUID : %u)", Id, auctioneer); return false; } CreatureTemplate const* auctioneerInfo = sObjectMgr->GetCreatureTemplate(auctioneerData->id); if (!auctioneerInfo) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Auction %u has not a existing auctioneer (GUID : %u Entry: %u)", Id, auctioneer, auctioneerData->id); + TC_LOG_ERROR("misc", "Auction %u has not a existing auctioneer (GUID : %u Entry: %u)", Id, auctioneer, auctioneerData->id); return false; } @@ -706,7 +706,7 @@ bool AuctionEntry::LoadFromDB(Field* fields) auctionHouseEntry = AuctionHouseMgr::GetAuctionHouseEntry(factionTemplateId); if (!auctionHouseEntry) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Auction %u has auctioneer (GUID : %u Entry: %u) with wrong faction %u", Id, auctioneer, auctioneerData->id, factionTemplateId); + TC_LOG_ERROR("misc", "Auction %u has auctioneer (GUID : %u Entry: %u) with wrong faction %u", Id, auctioneer, auctioneerData->id, factionTemplateId); return false; } @@ -714,7 +714,7 @@ bool AuctionEntry::LoadFromDB(Field* fields) // and itemEntry in fact (GetAItem will fail if problematic in result check in AuctionHouseMgr::LoadAuctionItems) if (!sAuctionMgr->GetAItem(itemGUIDLow)) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Auction %u has not a existing item : %u", Id, itemGUIDLow); + TC_LOG_ERROR("misc", "Auction %u has not a existing item : %u", Id, itemGUIDLow); return false; } return true; @@ -738,7 +738,7 @@ void AuctionHouseMgr::DeleteExpiredAuctionsAtStartup() if (!expAuctions) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> No expired auctions to delete"); + TC_LOG_INFO("server.loading", ">> No expired auctions to delete"); return; } @@ -787,7 +787,7 @@ void AuctionHouseMgr::DeleteExpiredAuctionsAtStartup() } while (expAuctions->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Deleted %u expired auctions in %u ms", expirecount, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Deleted %u expired auctions in %u ms", expirecount, GetMSTimeDiffToNow(oldMSTime)); } @@ -814,14 +814,14 @@ bool AuctionEntry::LoadFromFieldList(Field* fields) CreatureData const* auctioneerData = sObjectMgr->GetCreatureData(auctioneer); if (!auctioneerData) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "AuctionEntry::LoadFromFieldList() - Auction %u has not a existing auctioneer (GUID : %u)", Id, auctioneer); + TC_LOG_ERROR("misc", "AuctionEntry::LoadFromFieldList() - Auction %u has not a existing auctioneer (GUID : %u)", Id, auctioneer); return false; } CreatureTemplate const* auctioneerInfo = sObjectMgr->GetCreatureTemplate(auctioneerData->id); if (!auctioneerInfo) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "AuctionEntry::LoadFromFieldList() - Auction %u has not a existing auctioneer (GUID : %u Entry: %u)", Id, auctioneer, auctioneerData->id); + TC_LOG_ERROR("misc", "AuctionEntry::LoadFromFieldList() - Auction %u has not a existing auctioneer (GUID : %u Entry: %u)", Id, auctioneer, auctioneerData->id); return false; } @@ -830,7 +830,7 @@ bool AuctionEntry::LoadFromFieldList(Field* fields) if (!auctionHouseEntry) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "AuctionEntry::LoadFromFieldList() - Auction %u has auctioneer (GUID : %u Entry: %u) with wrong faction %u", Id, auctioneer, auctioneerData->id, factionTemplateId); + TC_LOG_ERROR("misc", "AuctionEntry::LoadFromFieldList() - Auction %u has auctioneer (GUID : %u Entry: %u) with wrong faction %u", Id, auctioneer, auctioneerData->id, factionTemplateId); return false; } diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index 97f91e7ba7a..f85f8bc77db 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -45,8 +45,10 @@ Battlefield::Battlefield() m_MapId = 0; m_MaxPlayer = 0; m_MinPlayer = 0; + m_MinLevel = 0; m_BattleTime = 0; m_NoWarBattleTime = 0; + m_RestartAfterCrash = 0; m_TimeForAcceptInvite = 20; m_uiKickDontAcceptTimer = 1000; @@ -286,7 +288,7 @@ void Battlefield::InitStalker(uint32 entry, float x, float y, float z, float o) if (Creature* creature = SpawnCreature(entry, x, y, z, o, TEAM_NEUTRAL)) StalkerGuid = creature->GetGUID(); else - TC_LOG_ERROR(LOG_FILTER_BATTLEFIELD, "Battlefield::InitStalker: could not spawn Stalker (Creature entry %u), zone messeges will be un-available", entry); + TC_LOG_ERROR("bg.battlefield", "Battlefield::InitStalker: could not spawn Stalker (Creature entry %u), zone messeges will be un-available", entry); } void Battlefield::KickAfkPlayers() @@ -595,10 +597,10 @@ BfGraveyard* Battlefield::GetGraveyardById(uint32 id) const if (BfGraveyard* graveyard = m_GraveyardList.at(id)) return graveyard; else - TC_LOG_ERROR(LOG_FILTER_BATTLEFIELD, "Battlefield::GetGraveyardById Id:%u not existed", id); + TC_LOG_ERROR("bg.battlefield", "Battlefield::GetGraveyardById Id:%u not existed", id); } else - TC_LOG_ERROR(LOG_FILTER_BATTLEFIELD, "Battlefield::GetGraveyardById Id:%u cant be found", id); + TC_LOG_ERROR("bg.battlefield", "Battlefield::GetGraveyardById Id:%u cant be found", id); return NULL; } @@ -691,7 +693,7 @@ void BfGraveyard::SetSpirit(Creature* spirit, TeamId team) { if (!spirit) { - TC_LOG_ERROR(LOG_FILTER_BATTLEFIELD, "BfGraveyard::SetSpirit: Invalid Spirit."); + TC_LOG_ERROR("bg.battlefield", "BfGraveyard::SetSpirit: Invalid Spirit."); return; } @@ -817,14 +819,14 @@ Creature* Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl Map* map = sMapMgr->CreateBaseMap(m_MapId); if (!map) { - TC_LOG_ERROR(LOG_FILTER_BATTLEFIELD, "Battlefield::SpawnCreature: Can't create creature entry: %u map not found", entry); + TC_LOG_ERROR("bg.battlefield", "Battlefield::SpawnCreature: Can't create creature entry: %u map not found", entry); return 0; } - Creature* creature = new Creature; + Creature* creature = new Creature(); if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, 0, team, x, y, z, o)) { - TC_LOG_ERROR(LOG_FILTER_BATTLEFIELD, "Battlefield::SpawnCreature: Can't create creature entry: %u", entry); + TC_LOG_ERROR("bg.battlefield", "Battlefield::SpawnCreature: Can't create creature entry: %u", entry); delete creature; return NULL; } @@ -834,7 +836,7 @@ Creature* Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry); if (!cinfo) { - TC_LOG_ERROR(LOG_FILTER_BATTLEFIELD, "Battlefield::SpawnCreature: entry %u does not exist.", entry); + TC_LOG_ERROR("bg.battlefield", "Battlefield::SpawnCreature: entry %u does not exist.", entry); return NULL; } // force using DB speeds -- do we really need this? @@ -860,8 +862,8 @@ GameObject* Battlefield::SpawnGameObject(uint32 entry, float x, float y, float z GameObject* go = new GameObject; if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, map, PHASEMASK_NORMAL, x, y, z, o, 0, 0, 0, 0, 100, GO_STATE_READY)) { - TC_LOG_ERROR(LOG_FILTER_BATTLEFIELD, "Battlefield::SpawnGameObject: Gameobject template %u not found in database! Battlefield not created!", entry); - TC_LOG_ERROR(LOG_FILTER_BATTLEFIELD, "Battlefield::SpawnGameObject: Cannot create gameobject template %u! Battlefield not created!", entry); + TC_LOG_ERROR("bg.battlefield", "Battlefield::SpawnGameObject: Gameobject template %u not found in database! Battlefield not created!", entry); + TC_LOG_ERROR("bg.battlefield", "Battlefield::SpawnGameObject: Cannot create gameobject template %u! Battlefield not created!", entry); delete go; return NULL; } @@ -954,7 +956,7 @@ bool BfCapturePoint::SetCapturePointData(GameObject* capturePoint) { ASSERT(capturePoint); - TC_LOG_DEBUG(LOG_FILTER_BATTLEFIELD, "Creating capture point %u", capturePoint->GetEntry()); + TC_LOG_DEBUG("bg.battlefield", "Creating capture point %u", capturePoint->GetEntry()); m_capturePointGUID = MAKE_NEW_GUID(capturePoint->GetGUIDLow(), capturePoint->GetEntry(), HIGHGUID_GAMEOBJECT); @@ -962,7 +964,7 @@ bool BfCapturePoint::SetCapturePointData(GameObject* capturePoint) GameObjectTemplate const* goinfo = capturePoint->GetGOInfo(); if (goinfo->type != GAMEOBJECT_TYPE_CAPTURE_POINT) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "OutdoorPvP: GO %u is not capture point!", capturePoint->GetEntry()); + TC_LOG_ERROR("misc", "OutdoorPvP: GO %u is not capture point!", capturePoint->GetEntry()); return false; } @@ -1120,7 +1122,7 @@ bool BfCapturePoint::Update(uint32 diff) if (m_OldState != m_State) { - //TC_LOG_ERROR(LOG_FILTER_BATTLEFIELD, "%u->%u", m_OldState, m_State); + //TC_LOG_ERROR("bg.battlefield", "%u->%u", m_OldState, m_State); if (oldTeam != m_team) ChangeTeam(oldTeam); return true; diff --git a/src/server/game/Battlefield/BattlefieldMgr.cpp b/src/server/game/Battlefield/BattlefieldMgr.cpp index 8bce2342899..1585724334d 100644 --- a/src/server/game/Battlefield/BattlefieldMgr.cpp +++ b/src/server/game/Battlefield/BattlefieldMgr.cpp @@ -23,12 +23,12 @@ BattlefieldMgr::BattlefieldMgr() { m_UpdateTimer = 0; - //TC_LOG_DEBUG(LOG_FILTER_BATTLEFIELD, "Instantiating BattlefieldMgr"); + //TC_LOG_DEBUG("bg.battlefield", "Instantiating BattlefieldMgr"); } BattlefieldMgr::~BattlefieldMgr() { - //TC_LOG_DEBUG(LOG_FILTER_BATTLEFIELD, "Deleting BattlefieldMgr"); + //TC_LOG_DEBUG("bg.battlefield", "Deleting BattlefieldMgr"); for (BattlefieldSet::iterator itr = m_BattlefieldSet.begin(); itr != m_BattlefieldSet.end(); ++itr) delete *itr; } @@ -39,13 +39,13 @@ void BattlefieldMgr::InitBattlefield() // respawn, init variables if (!pBf->SetupBattlefield()) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Battlefield : Wintergrasp init failed."); + TC_LOG_INFO("misc", "Battlefield : Wintergrasp init failed."); delete pBf; } else { m_BattlefieldSet.push_back(pBf); - TC_LOG_INFO(LOG_FILTER_GENERAL, "Battlefield : Wintergrasp successfully initiated."); + TC_LOG_INFO("misc", "Battlefield : Wintergrasp successfully initiated."); } /* For Cataclysm: Tol Barad @@ -53,13 +53,13 @@ void BattlefieldMgr::InitBattlefield() // respawn, init variables if (!pBf->SetupBattlefield()) { - TC_LOG_DEBUG(LOG_FILTER_BATTLEFIELD, "Battlefield : Tol Barad init failed."); + TC_LOG_DEBUG("bg.battlefield", "Battlefield : Tol Barad init failed."); delete pBf; } else { m_BattlefieldSet.push_back(pBf); - TC_LOG_DEBUG(LOG_FILTER_BATTLEFIELD, "Battlefield : Tol Barad successfully initiated."); + TC_LOG_DEBUG("bg.battlefield", "Battlefield : Tol Barad successfully initiated."); } */ } @@ -79,7 +79,7 @@ void BattlefieldMgr::HandlePlayerEnterZone(Player* player, uint32 zoneid) return; bf->HandlePlayerEnterZone(player, zoneid); - TC_LOG_DEBUG(LOG_FILTER_BATTLEFIELD, "Player %u entered outdoorpvp id %u", player->GetGUIDLow(), bf->GetTypeId()); + TC_LOG_DEBUG("bg.battlefield", "Player %u entered outdoorpvp id %u", player->GetGUIDLow(), bf->GetTypeId()); } void BattlefieldMgr::HandlePlayerLeaveZone(Player* player, uint32 zoneid) @@ -92,7 +92,7 @@ void BattlefieldMgr::HandlePlayerLeaveZone(Player* player, uint32 zoneid) if (!itr->second->HasPlayer(player)) return; itr->second->HandlePlayerLeaveZone(player, zoneid); - TC_LOG_DEBUG(LOG_FILTER_BATTLEFIELD, "Player %u left outdoorpvp id %u", player->GetGUIDLow(), itr->second->GetTypeId()); + TC_LOG_DEBUG("bg.battlefield", "Player %u left outdoorpvp id %u", player->GetGUIDLow(), itr->second->GetTypeId()); } Battlefield *BattlefieldMgr::GetBattlefieldToZoneId(uint32 zoneid) diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index f246f15a81d..a5602a1b415 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -228,7 +228,7 @@ void BattlefieldWG::OnBattleStart() m_titansRelicGUID = relic->GetGUID(); } else - TC_LOG_ERROR(LOG_FILTER_BATTLEFIELD, "WG: Failed to spawn titan relic."); + TC_LOG_ERROR("bg.battlefield", "WG: Failed to spawn titan relic."); // Update tower visibility and update faction @@ -473,7 +473,7 @@ uint8 BattlefieldWG::GetSpiritGraveyardId(uint32 areaId) const case AREA_THE_CHILLED_QUAGMIRE: return BATTLEFIELD_WG_GY_HORDE; default: - TC_LOG_ERROR(LOG_FILTER_BATTLEFIELD, "BattlefieldWG::GetSpiritGraveyardId: Unexpected Area Id %u", areaId); + TC_LOG_ERROR("bg.battlefield", "BattlefieldWG::GetSpiritGraveyardId: Unexpected Area Id %u", areaId); break; } @@ -1064,4 +1064,5 @@ void WintergraspCapturePoint::ChangeTeam(TeamId /*oldTeam*/) BfGraveyardWG::BfGraveyardWG(BattlefieldWG* battlefield) : BfGraveyard(battlefield) { m_Bf = battlefield; + m_GossipTextId = 0; } diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index ee18545b0c4..22a93e6a495 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -1188,7 +1188,7 @@ struct BfWGGameObjectBuilding if (m_WG->GetRelic()) m_WG->GetRelic()->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); else - TC_LOG_ERROR(LOG_FILTER_GENERAL, "BattlefieldWG: Relic not found."); + TC_LOG_ERROR("misc", "BattlefieldWG: Relic not found."); break; } @@ -1481,6 +1481,7 @@ struct WGWorkshop bf = _bf; workshopId = _workshopId; teamControl = BATTLEFIELD_WG_TEAM_NEUTRAL; + state = BATTLEFIELD_WG_OBJECTSTATE_NONE; } void GiveControlTo(uint8 team, bool init /* for first call in setup*/) diff --git a/src/server/game/Battlegrounds/ArenaTeam.cpp b/src/server/game/Battlegrounds/ArenaTeam.cpp index 82d02c538dc..222a3f55387 100644 --- a/src/server/game/Battlegrounds/ArenaTeam.cpp +++ b/src/server/game/Battlegrounds/ArenaTeam.cpp @@ -82,7 +82,7 @@ bool ArenaTeam::Create(uint64 captainGuid, uint8 type, std::string const& teamNa // Add captain as member AddMember(CaptainGuid); - TC_LOG_DEBUG(LOG_FILTER_ARENAS, "New ArenaTeam created [Id: %u, Name: %s] [Type: %u] [Captain low GUID: %u]", GetId(), GetName().c_str(), GetType(), captainLowGuid); + TC_LOG_DEBUG("bg.arena", "New ArenaTeam created [Id: %u, Name: %s] [Type: %u] [Captain low GUID: %u]", GetId(), GetName().c_str(), GetType(), captainLowGuid); return true; } @@ -120,7 +120,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid) // Check if player is already in a similar arena team if ((player && player->GetArenaTeamId(GetSlot())) || Player::GetArenaTeamIdFromDB(playerGuid, GetType()) != 0) { - TC_LOG_DEBUG(LOG_FILTER_ARENAS, "Arena: Player %s (guid: %u) already has an arena team of type %u", playerName.c_str(), GUID_LOPART(playerGuid), GetType()); + TC_LOG_DEBUG("bg.arena", "Arena: Player %s (guid: %u) already has an arena team of type %u", playerName.c_str(), GUID_LOPART(playerGuid), GetType()); return false; } @@ -179,7 +179,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid) player->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 1); } - TC_LOG_INFO(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] joined arena team type: %u [Id: %u, Name: %s].", playerName.c_str(), GUID_LOPART(playerGuid), GetType(), GetId(), GetName().c_str()); + TC_LOG_INFO("bg.arena", "Player: %s [GUID: %u] joined arena team type: %u [Id: %u, Name: %s].", playerName.c_str(), GUID_LOPART(playerGuid), GetType(), GetId(), GetName().c_str()); return true; } @@ -245,7 +245,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result) // Delete member if character information is missing if (newMember.Name.empty()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "ArenaTeam %u has member with empty name - probably player %u doesn't exist, deleting him from memberlist!", arenaTeamId, GUID_LOPART(newMember.Guid)); + TC_LOG_ERROR("sql.sql", "ArenaTeam %u has member with empty name - probably player %u doesn't exist, deleting him from memberlist!", arenaTeamId, GUID_LOPART(newMember.Guid)); DelMember(newMember.Guid, true); continue; } @@ -262,7 +262,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result) if (Empty() || !captainPresentInTeam) { // Arena team is empty or captain is not in team, delete from db - TC_LOG_DEBUG(LOG_FILTER_ARENAS, "ArenaTeam %u does not have any members or its captain is not in team, disbanding it...", TeamId); + TC_LOG_DEBUG("bg.arena", "ArenaTeam %u does not have any members or its captain is not in team, disbanding it...", TeamId); return false; } @@ -304,7 +304,7 @@ void ArenaTeam::SetCaptain(uint64 guid) newCaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 0); if (oldCaptain) { - TC_LOG_DEBUG(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] promoted player: %s [GUID: %u] to leader of arena team [Id: %u, Name: %s] [Type: %u].", + TC_LOG_DEBUG("bg.arena", "Player: %s [GUID: %u] promoted player: %s [GUID: %u] to leader of arena team [Id: %u, Name: %s] [Type: %u].", oldCaptain->GetName().c_str(), oldCaptain->GetGUIDLow(), newCaptain->GetName().c_str(), newCaptain->GetGUIDLow(), GetId(), GetName().c_str(), GetType()); } @@ -328,7 +328,7 @@ void ArenaTeam::DelMember(uint64 guid, bool cleanDb) // delete all info regarding this team for (uint32 i = 0; i < ARENA_TEAM_END; ++i) player->SetArenaTeamInfoField(GetSlot(), ArenaTeamInfoType(i), 0); - TC_LOG_DEBUG(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] left arena team type: %u [Id: %u, Name: %s].", player->GetName().c_str(), player->GetGUIDLow(), GetType(), GetId(), GetName().c_str()); + TC_LOG_DEBUG("bg.arena", "Player: %s [GUID: %u] left arena team type: %u [Id: %u, Name: %s].", player->GetName().c_str(), player->GetGUIDLow(), GetType(), GetId(), GetName().c_str()); } // Only used for single member deletion, for arena team disband we use a single query for more efficiency @@ -353,7 +353,7 @@ void ArenaTeam::Disband(WorldSession* session) BroadcastEvent(ERR_ARENA_TEAM_DISBANDED_S, 0, 2, session->GetPlayerName(), GetName(), ""); if (Player* player = session->GetPlayer()) - TC_LOG_DEBUG(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] disbanded arena team type: %u [Id: %u, Name: %s].", player->GetName().c_str(), player->GetGUIDLow(), GetType(), GetId(), GetName().c_str()); + TC_LOG_DEBUG("bg.arena", "Player: %s [GUID: %u] disbanded arena team type: %u [Id: %u, Name: %s].", player->GetName().c_str(), player->GetGUIDLow(), GetType(), GetId(), GetName().c_str()); } // Update database @@ -431,7 +431,7 @@ void ArenaTeam::Roster(WorldSession* session) } session->SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_ARENA_TEAM_ROSTER"); + TC_LOG_DEBUG("network", "WORLD: Sent SMSG_ARENA_TEAM_ROSTER"); } void ArenaTeam::Query(WorldSession* session) @@ -446,7 +446,7 @@ void ArenaTeam::Query(WorldSession* session) data << uint32(BorderStyle); // border style data << uint32(BorderColor); // border color session->SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_ARENA_TEAM_QUERY_RESPONSE"); + TC_LOG_DEBUG("network", "WORLD: Sent SMSG_ARENA_TEAM_QUERY_RESPONSE"); } void ArenaTeam::SendStats(WorldSession* session) @@ -537,7 +537,7 @@ void ArenaTeam::BroadcastEvent(ArenaTeamEvents event, uint64 guid, uint8 strCoun data << str1 << str2 << str3; break; default: - TC_LOG_ERROR(LOG_FILTER_ARENAS, "Unhandled strCount %u in ArenaTeam::BroadcastEvent", strCount); + TC_LOG_ERROR("bg.arena", "Unhandled strCount %u in ArenaTeam::BroadcastEvent", strCount); return; } @@ -546,7 +546,7 @@ void ArenaTeam::BroadcastEvent(ArenaTeamEvents event, uint64 guid, uint8 strCoun BroadcastPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_ARENA_TEAM_EVENT"); + TC_LOG_DEBUG("network", "WORLD: Sent SMSG_ARENA_TEAM_EVENT"); } void ArenaTeam::MassInviteToEvent(WorldSession* session) @@ -576,7 +576,7 @@ uint8 ArenaTeam::GetSlotByType(uint32 type) default: break; } - TC_LOG_ERROR(LOG_FILTER_ARENAS, "FATAL: Unknown arena team type %u for some arena team", type); + TC_LOG_ERROR("bg.arena", "FATAL: Unknown arena team type %u for some arena team", type); return 0xFF; } diff --git a/src/server/game/Battlegrounds/ArenaTeamMgr.cpp b/src/server/game/Battlegrounds/ArenaTeamMgr.cpp index cb3388151bd..ac15440e564 100644 --- a/src/server/game/Battlegrounds/ArenaTeamMgr.cpp +++ b/src/server/game/Battlegrounds/ArenaTeamMgr.cpp @@ -82,7 +82,7 @@ uint32 ArenaTeamMgr::GenerateArenaTeamId() { if (NextArenaTeamId >= 0xFFFFFFFE) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Arena team ids overflow!! Can't continue, shutting down server. "); + TC_LOG_ERROR("bg.battleground", "Arena team ids overflow!! Can't continue, shutting down server. "); World::StopNow(ERROR_EXIT_CODE); } return NextArenaTeamId++; @@ -102,7 +102,7 @@ void ArenaTeamMgr::LoadArenaTeams() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 arena teams. DB table `arena_team` is empty!"); + TC_LOG_INFO("server.loading", ">> Loaded 0 arena teams. DB table `arena_team` is empty!"); return; } @@ -132,7 +132,7 @@ void ArenaTeamMgr::LoadArenaTeams() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u arena teams in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u arena teams in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void ArenaTeamMgr::DistributeArenaPoints() diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 8f0cc0c8688..81507e4b620 100644 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -146,6 +146,7 @@ Battleground::Battleground() m_ResetStatTimer = 0; m_ValidStartPositionTimer = 0; m_Events = 0; + m_StartDelayTime = 0; m_IsRated = false; m_BuffChange = false; m_IsRandom = false; @@ -163,6 +164,7 @@ Battleground::Battleground() m_MapId = 0; m_Map = NULL; m_StartMaxDist = 0.0f; + ScriptId = 0; m_TeamStartLocX[TEAM_ALLIANCE] = 0; m_TeamStartLocX[TEAM_HORDE] = 0; @@ -182,6 +184,9 @@ Battleground::Battleground() m_ArenaTeamRatingChanges[TEAM_ALLIANCE] = 0; m_ArenaTeamRatingChanges[TEAM_HORDE] = 0; + m_ArenaTeamMMR[TEAM_ALLIANCE] = 0; + m_ArenaTeamMMR[TEAM_HORDE] = 0; + m_BgRaids[TEAM_ALLIANCE] = NULL; m_BgRaids[TEAM_HORDE] = NULL; @@ -192,6 +197,7 @@ Battleground::Battleground() m_TeamScores[TEAM_HORDE] = 0; m_PrematureCountDown = false; + m_PrematureCountDownTimer = 0; m_HonorMode = BG_NORMAL; @@ -320,7 +326,7 @@ inline void Battleground::_CheckSafePositions(uint32 diff) GetTeamStartLoc(player->GetBGTeam(), x, y, z, o); if (pos.GetExactDistSq(x, y, z) > maxDist) { - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "BATTLEGROUND: Sending %s back to start location (map: %u) (possible exploit)", player->GetName().c_str(), GetMapId()); + TC_LOG_DEBUG("bg.battleground", "BATTLEGROUND: Sending %s back to start location (map: %u) (possible exploit)", player->GetName().c_str(), GetMapId()); player->TeleportTo(GetMapId(), x, y, z, o); } } @@ -472,7 +478,7 @@ inline void Battleground::_ProcessJoin(uint32 diff) if (!FindBgMap()) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Battleground::_ProcessJoin: map (map id: %u, instance id: %u) is not created!", m_MapId, m_InstanceID); + TC_LOG_ERROR("bg.battleground", "Battleground::_ProcessJoin: map (map id: %u, instance id: %u) is not created!", m_MapId, m_InstanceID); EndNow(); return; } @@ -596,7 +602,7 @@ inline Player* Battleground::_GetPlayer(uint64 guid, bool offlineRemove, char co { player = ObjectAccessor::FindPlayer(guid); if (!player) - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Battleground::%s: player (GUID: %u) not found for BG (map: %u, instance id: %u)!", + TC_LOG_ERROR("bg.battleground", "Battleground::%s: player (GUID: %u) not found for BG (map: %u, instance id: %u)!", context, GUID_LOPART(guid), m_MapId, m_InstanceID); } return player; @@ -785,18 +791,18 @@ void Battleground::EndBattleground(uint32 winner) winnerMatchmakerRating = GetArenaMatchmakerRating(winner); winnerMatchmakerChange = winnerArenaTeam->WonAgainst(winnerMatchmakerRating, loserMatchmakerRating, winnerChange); loserMatchmakerChange = loserArenaTeam->LostAgainst(loserMatchmakerRating, winnerMatchmakerRating, loserChange); - TC_LOG_DEBUG(LOG_FILTER_ARENAS, "match Type: %u --- Winner: old rating: %u, rating gain: %d, old MMR: %u, MMR gain: %d --- Loser: old rating: %u, rating loss: %d, old MMR: %u, MMR loss: %d ---", m_ArenaType, winnerTeamRating, winnerChange, winnerMatchmakerRating, + TC_LOG_DEBUG("bg.arena", "match Type: %u --- Winner: old rating: %u, rating gain: %d, old MMR: %u, MMR gain: %d --- Loser: old rating: %u, rating loss: %d, old MMR: %u, MMR loss: %d ---", m_ArenaType, winnerTeamRating, winnerChange, winnerMatchmakerRating, winnerMatchmakerChange, loserTeamRating, loserChange, loserMatchmakerRating, loserMatchmakerChange); SetArenaMatchmakerRating(winner, winnerMatchmakerRating + winnerMatchmakerChange); SetArenaMatchmakerRating(GetOtherTeam(winner), loserMatchmakerRating + loserMatchmakerChange); SetArenaTeamRatingChangeForTeam(winner, winnerChange); SetArenaTeamRatingChangeForTeam(GetOtherTeam(winner), loserChange); - TC_LOG_DEBUG(LOG_FILTER_ARENAS, "Arena match Type: %u for Team1Id: %u - Team2Id: %u ended. WinnerTeamId: %u. Winner rating: +%d, Loser rating: %d", m_ArenaType, m_ArenaTeamIds[TEAM_ALLIANCE], m_ArenaTeamIds[TEAM_HORDE], winnerArenaTeam->GetId(), winnerChange, loserChange); + TC_LOG_DEBUG("bg.arena", "Arena match Type: %u for Team1Id: %u - Team2Id: %u ended. WinnerTeamId: %u. Winner rating: +%d, Loser rating: %d", m_ArenaType, m_ArenaTeamIds[TEAM_ALLIANCE], m_ArenaTeamIds[TEAM_HORDE], winnerArenaTeam->GetId(), winnerChange, loserChange); if (sWorld->getBoolConfig(CONFIG_ARENA_LOG_EXTENDED_INFO)) for (Battleground::BattlegroundScoreMap::const_iterator itr = GetPlayerScoresBegin(); itr != GetPlayerScoresEnd(); ++itr) if (Player* player = ObjectAccessor::FindPlayer(itr->first)) { - TC_LOG_DEBUG(LOG_FILTER_ARENAS, "Statistics match Type: %u for %s (GUID: " UI64FMTD ", Team: %d, IP: %s): %u damage, %u healing, %u killing blows", + TC_LOG_DEBUG("bg.arena", "Statistics match Type: %u for %s (GUID: " UI64FMTD ", Team: %d, IP: %s): %u damage, %u healing, %u killing blows", m_ArenaType, player->GetName().c_str(), itr->first, player->GetArenaTeamId(m_ArenaType == 5 ? 2 : m_ArenaType == 3), player->GetSession()->GetRemoteAddress().c_str(), itr->second->DamageDone, itr->second->HealingDone, itr->second->KillingBlows); @@ -1073,7 +1079,7 @@ void Battleground::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac if (Transport) player->TeleportToBGEntryPoint(); - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "Removed player %s from Battleground.", player->GetName().c_str()); + TC_LOG_DEBUG("bg.battleground", "Removed player %s from Battleground.", player->GetName().c_str()); } //battleground object will be deleted next Battleground::Update() call @@ -1090,7 +1096,7 @@ void Battleground::Reset() m_Events = 0; if (m_InvitedAlliance > 0 || m_InvitedHorde > 0) - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Battleground::Reset: one of the counters is not 0 (alliance: %u, horde: %u) for BG (map: %u, instance id: %u)!", + TC_LOG_ERROR("bg.battleground", "Battleground::Reset: one of the counters is not 0 (alliance: %u, horde: %u) for BG (map: %u, instance id: %u)!", m_InvitedAlliance, m_InvitedHorde, m_MapId, m_InstanceID); m_InvitedAlliance = 0; @@ -1119,7 +1125,7 @@ void Battleground::StartBattleground() sBattlegroundMgr->AddBattleground(this); if (m_IsRated) - TC_LOG_DEBUG(LOG_FILTER_ARENAS, "Arena match type: %u for Team1Id: %u - Team2Id: %u started.", m_ArenaType, m_ArenaTeamIds[TEAM_ALLIANCE], m_ArenaTeamIds[TEAM_HORDE]); + TC_LOG_DEBUG("bg.arena", "Arena match type: %u for Team1Id: %u - Team2Id: %u started.", m_ArenaType, m_ArenaTeamIds[TEAM_ALLIANCE], m_ArenaTeamIds[TEAM_HORDE]); } void Battleground::AddPlayer(Player* player) @@ -1390,7 +1396,7 @@ void Battleground::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, itr->second->HealingDone += value; break; default: - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Battleground::UpdatePlayerScore: unknown score type (%u) for BG (map: %u, instance id: %u)!", + TC_LOG_ERROR("bg.battleground", "Battleground::UpdatePlayerScore: unknown score type (%u) for BG (map: %u, instance id: %u)!", type, m_MapId, m_InstanceID); break; } @@ -1462,9 +1468,9 @@ bool Battleground::AddObject(uint32 type, uint32 entry, float x, float y, float if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, GetBgMap(), PHASEMASK_NORMAL, x, y, z, o, rotation0, rotation1, rotation2, rotation3, 100, GO_STATE_READY)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Battleground::AddObject: cannot create gameobject (entry: %u) for BG (map: %u, instance id: %u)!", + TC_LOG_ERROR("sql.sql", "Battleground::AddObject: cannot create gameobject (entry: %u) for BG (map: %u, instance id: %u)!", entry, m_MapId, m_InstanceID); - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Battleground::AddObject: cannot create gameobject (entry: %u) for BG (map: %u, instance id: %u)!", + TC_LOG_ERROR("bg.battleground", "Battleground::AddObject: cannot create gameobject (entry: %u) for BG (map: %u, instance id: %u)!", entry, m_MapId, m_InstanceID); delete go; return false; @@ -1515,7 +1521,7 @@ void Battleground::DoorClose(uint32 type) } } else - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Battleground::DoorClose: door gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", + TC_LOG_ERROR("bg.battleground", "Battleground::DoorClose: door gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID); } @@ -1527,7 +1533,7 @@ void Battleground::DoorOpen(uint32 type) obj->SetGoState(GO_STATE_ACTIVE); } else - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Battleground::DoorOpen: door gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", + TC_LOG_ERROR("bg.battleground", "Battleground::DoorOpen: door gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID); } @@ -1535,7 +1541,7 @@ GameObject* Battleground::GetBGObject(uint32 type) { GameObject* obj = GetBgMap()->GetGameObject(BgObjects[type]); if (!obj) - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Battleground::GetBGObject: gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", + TC_LOG_ERROR("bg.battleground", "Battleground::GetBGObject: gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID); return obj; } @@ -1544,7 +1550,7 @@ Creature* Battleground::GetBGCreature(uint32 type) { Creature* creature = GetBgMap()->GetCreature(BgCreatures[type]); if (!creature) - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Battleground::GetBGCreature: creature (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", + TC_LOG_ERROR("bg.battleground", "Battleground::GetBGCreature: creature (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", type, GUID_LOPART(BgCreatures[type]), m_MapId, m_InstanceID); return creature; } @@ -1574,10 +1580,10 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, uint32 teamval, f if (!map) return NULL; - Creature* creature = new Creature; + Creature* creature = new Creature(); if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, 0, teamval, x, y, z, o)) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Battleground::AddCreature: cannot create creature (entry: %u) for BG (map: %u, instance id: %u)!", + TC_LOG_ERROR("bg.battleground", "Battleground::AddCreature: cannot create creature (entry: %u) for BG (map: %u, instance id: %u)!", entry, m_MapId, m_InstanceID); delete creature; return NULL; @@ -1588,7 +1594,7 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, uint32 teamval, f CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry); if (!cinfo) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Battleground::AddCreature: creature template (entry: %u) does not exist for BG (map: %u, instance id: %u)!", + TC_LOG_ERROR("bg.battleground", "Battleground::AddCreature: creature template (entry: %u) does not exist for BG (map: %u, instance id: %u)!", entry, m_MapId, m_InstanceID); delete creature; return NULL; @@ -1623,7 +1629,7 @@ bool Battleground::DelCreature(uint32 type) return true; } - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Battleground::DelCreature: creature (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", + TC_LOG_ERROR("bg.battleground", "Battleground::DelCreature: creature (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", type, GUID_LOPART(BgCreatures[type]), m_MapId, m_InstanceID); BgCreatures[type] = 0; return false; @@ -1641,7 +1647,7 @@ bool Battleground::DelObject(uint32 type) BgObjects[type] = 0; return true; } - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Battleground::DelObject: gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", + TC_LOG_ERROR("bg.battleground", "Battleground::DelObject: gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID); BgObjects[type] = 0; return false; @@ -1667,7 +1673,7 @@ bool Battleground::AddSpiritGuide(uint32 type, float x, float y, float z, float //creature->CastSpell(creature, SPELL_SPIRIT_HEAL_CHANNEL, true); return true; } - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Battleground::AddSpiritGuide: cannot create spirit guide (type: %u, entry: %u) for BG (map: %u, instance id: %u)!", + TC_LOG_ERROR("bg.battleground", "Battleground::AddSpiritGuide: cannot create spirit guide (type: %u, entry: %u) for BG (map: %u, instance id: %u)!", type, entry, m_MapId, m_InstanceID); EndNow(); return false; @@ -1765,7 +1771,7 @@ void Battleground::HandleTriggerBuff(uint64 go_guid) index--; if (index < 0) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Battleground::HandleTriggerBuff: cannot find buff gameobject (GUID: %u, entry: %u, type: %u) in internal data for BG (map: %u, instance id: %u)!", + TC_LOG_ERROR("bg.battleground", "Battleground::HandleTriggerBuff: cannot find buff gameobject (GUID: %u, entry: %u, type: %u) in internal data for BG (map: %u, instance id: %u)!", GUID_LOPART(go_guid), obj->GetEntry(), obj->GetGoType(), m_MapId, m_InstanceID); return; } @@ -1889,7 +1895,7 @@ int32 Battleground::GetObjectType(uint64 guid) for (uint32 i = 0; i < BgObjects.size(); ++i) if (BgObjects[i] == guid) return i; - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Battleground::GetObjectType: player used gameobject (GUID: %u) which is not in internal data for BG (map: %u, instance id: %u), cheating?", + TC_LOG_ERROR("bg.battleground", "Battleground::GetObjectType: player used gameobject (GUID: %u) which is not in internal data for BG (map: %u, instance id: %u), cheating?", GUID_LOPART(guid), m_MapId, m_InstanceID); return -1; } @@ -1954,18 +1960,18 @@ uint32 Battleground::GetTeamScore(uint32 teamId) const if (teamId == TEAM_ALLIANCE || teamId == TEAM_HORDE) return m_TeamScores[teamId]; - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "GetTeamScore with wrong Team %u for BG %u", teamId, GetTypeID()); + TC_LOG_ERROR("bg.battleground", "GetTeamScore with wrong Team %u for BG %u", teamId, GetTypeID()); return 0; } void Battleground::HandleAreaTrigger(Player* player, uint32 trigger) { - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "Unhandled AreaTrigger %u in Battleground %u. Player coords (x: %f, y: %f, z: %f)", + TC_LOG_DEBUG("bg.battleground", "Unhandled AreaTrigger %u in Battleground %u. Player coords (x: %f, y: %f, z: %f)", trigger, player->GetMapId(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ()); } bool Battleground::CheckAchievementCriteriaMeet(uint32 criteriaId, Player const* /*source*/, Unit const* /*target*/, uint32 /*miscvalue1*/) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Battleground::CheckAchievementCriteriaMeet: No implementation for criteria %u", criteriaId); + TC_LOG_ERROR("bg.battleground", "Battleground::CheckAchievementCriteriaMeet: No implementation for criteria %u", criteriaId); return false; } diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp index 936cc88462f..8b1d83c04c0 100644 --- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp +++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp @@ -52,6 +52,7 @@ BattlegroundMgr::BattlegroundMgr() : m_NextRatedArenaUpdate(sWorld->getIntConfig(CONFIG_ARENA_RATED_UPDATE_TIMER)), + m_NextAutoDistributionTime(0), m_AutoDistributionTimeChecker(0), m_ArenaTesting(false), m_Testing(false) { } @@ -132,7 +133,7 @@ void BattlegroundMgr::Update(uint32 diff) if (m_NextRatedArenaUpdate < diff) { // forced update for rated arenas (scan all, but skipped non rated) - TC_LOG_TRACE(LOG_FILTER_ARENAS, "BattlegroundMgr: UPDATING ARENA QUEUES"); + TC_LOG_TRACE("bg.arena", "BattlegroundMgr: UPDATING ARENA QUEUES"); for (int qtype = BATTLEGROUND_QUEUE_2v2; qtype <= BATTLEGROUND_QUEUE_5v5; ++qtype) for (int bracket = BG_BRACKET_ID_FIRST; bracket < MAX_BATTLEGROUND_BRACKETS; ++bracket) m_BattlegroundQueues[qtype].BattlegroundQueueUpdate(diff, @@ -178,7 +179,7 @@ void BattlegroundMgr::BuildBattlegroundStatusPacket(WorldPacket* data, Battlegro *data << uint32(QueueSlot); // queue id (0...1) - player can be in 2 queues in time // The following segment is read as uint64 in client but can be appended as their original type. *data << uint8(arenatype); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "BattlegroundMgr::BuildBattlegroundStatusPacket: arenatype = %u for bg instanceID %u, TypeID %u.", arenatype, bg->GetClientInstanceID(), bg->GetTypeID()); + TC_LOG_DEBUG("network", "BattlegroundMgr::BuildBattlegroundStatusPacket: arenatype = %u for bg instanceID %u, TypeID %u.", arenatype, bg->GetClientInstanceID(), bg->GetTypeID()); *data << uint8(bg->isArena() ? 0xE : 0x0); *data << uint32(bg->GetTypeID()); *data << uint16(0x1F90); @@ -210,7 +211,7 @@ void BattlegroundMgr::BuildBattlegroundStatusPacket(WorldPacket* data, Battlegro *data << uint8(arenaFaction == ALLIANCE ? 1 : 0); // arenafaction (0 for horde, 1 for alliance) break; default: - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Unknown BG status!"); + TC_LOG_ERROR("bg.battleground", "Unknown BG status!"); break; } } @@ -236,7 +237,7 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg) *data << uint32(pointsLost); // Rating Lost *data << uint32(pointsGained); // Rating gained *data << uint32(MatchmakerRating); // Matchmaking Value - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "rating change: %d", rating_change); + TC_LOG_DEBUG("bg.battleground", "rating change: %d", rating_change); } for (int8 i = 1; i >= 0; --i) { @@ -266,7 +267,7 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg) BattlegroundScore* score = itr2->second; if (!bg->IsPlayerInBattleground(itr2->first)) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Player " UI64FMTD " has scoreboard entry for battleground %u but is not in battleground!", itr->first, bg->GetTypeID(true)); + TC_LOG_ERROR("bg.battleground", "Player " UI64FMTD " has scoreboard entry for battleground %u but is not in battleground!", itr->first, bg->GetTypeID(true)); continue; } @@ -370,14 +371,14 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg) *data << uint32(0); break; default: - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Unhandled MSG_PVP_LOG_DATA for BG id %u", bg->GetTypeID()); + TC_LOG_DEBUG("network", "Unhandled MSG_PVP_LOG_DATA for BG id %u", bg->GetTypeID()); *data << uint32(0); break; } // should never happen if (++scoreCount >= bg->GetMaxPlayers() && itr != bg->GetPlayerScoresEnd()) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Battleground %u scoreboard has more entries (%u) than allowed players in this bg (%u)", bg->GetTypeID(true), bg->GetPlayerScoresSize(), bg->GetMaxPlayers()); + TC_LOG_ERROR("bg.battleground", "Battleground %u scoreboard has more entries (%u) than allowed players in this bg (%u)", bg->GetTypeID(true), bg->GetPlayerScoresSize(), bg->GetMaxPlayers()); break; } } @@ -532,7 +533,7 @@ Battleground* BattlegroundMgr::CreateNewBattleground(BattlegroundTypeId original if (!bg_template) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Battleground: CreateNewBattleground - bg template not found for %u", bgTypeId); + TC_LOG_ERROR("bg.battleground", "Battleground: CreateNewBattleground - bg template not found for %u", bgTypeId); return NULL; } @@ -695,7 +696,7 @@ void BattlegroundMgr::CreateInitialBattlegrounds() if (!result) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 battlegrounds. DB table `battleground_template` is empty."); + TC_LOG_ERROR("server.loading", ">> Loaded 0 battlegrounds. DB table `battleground_template` is empty."); return; } @@ -713,7 +714,7 @@ void BattlegroundMgr::CreateInitialBattlegrounds() BattlemasterListEntry const* bl = sBattlemasterListStore.LookupEntry(bgTypeId); if (!bl) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Battleground ID %u not found in BattlemasterList.dbc. Battleground not created.", bgTypeId); + TC_LOG_ERROR("bg.battleground", "Battleground ID %u not found in BattlemasterList.dbc. Battleground not created.", bgTypeId); continue; } @@ -733,14 +734,14 @@ void BattlegroundMgr::CreateInitialBattlegrounds() if (data.MaxPlayersPerTeam == 0 || data.MinPlayersPerTeam > data.MaxPlayersPerTeam) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `battleground_template` for id %u has bad values for MinPlayersPerTeam (%u) and MaxPlayersPerTeam(%u)", + TC_LOG_ERROR("sql.sql", "Table `battleground_template` for id %u has bad values for MinPlayersPerTeam (%u) and MaxPlayersPerTeam(%u)", data.bgTypeId, data.MinPlayersPerTeam, data.MaxPlayersPerTeam); continue; } if (data.LevelMin == 0 || data.LevelMax == 0 || data.LevelMin > data.LevelMax) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `battleground_template` for id %u has bad values for LevelMin (%u) and LevelMax(%u)", + TC_LOG_ERROR("sql.sql", "Table `battleground_template` for id %u has bad values for LevelMin (%u) and LevelMax(%u)", data.bgTypeId, data.LevelMin, data.LevelMax); continue; } @@ -768,7 +769,7 @@ void BattlegroundMgr::CreateInitialBattlegrounds() } else { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `battleground_template` for id %u have non-existed WorldSafeLocs.dbc id %u in field `AllianceStartLoc`. BG not created.", data.bgTypeId, startId); + TC_LOG_ERROR("sql.sql", "Table `battleground_template` for id %u have non-existed WorldSafeLocs.dbc id %u in field `AllianceStartLoc`. BG not created.", data.bgTypeId, startId); continue; } @@ -782,7 +783,7 @@ void BattlegroundMgr::CreateInitialBattlegrounds() } else { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `battleground_template` for id %u have non-existed WorldSafeLocs.dbc id %u in field `HordeStartLoc`. BG not created.", data.bgTypeId, startId); + TC_LOG_ERROR("sql.sql", "Table `battleground_template` for id %u have non-existed WorldSafeLocs.dbc id %u in field `HordeStartLoc`. BG not created.", data.bgTypeId, startId); continue; } } @@ -802,7 +803,7 @@ void BattlegroundMgr::CreateInitialBattlegrounds() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u battlegrounds in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u battlegrounds in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void BattlegroundMgr::InitAutomaticArenaPointDistribution() @@ -812,15 +813,15 @@ void BattlegroundMgr::InitAutomaticArenaPointDistribution() time_t wstime = time_t(sWorld->getWorldState(WS_ARENA_DISTRIBUTION_TIME)); time_t curtime = time(NULL); - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "Initializing Automatic Arena Point Distribution"); + TC_LOG_DEBUG("bg.battleground", "Initializing Automatic Arena Point Distribution"); if (wstime < curtime) { m_NextAutoDistributionTime = curtime; // reset will be called in the next update - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "Battleground: Next arena point distribution time in the past, reseting it now."); + TC_LOG_DEBUG("bg.battleground", "Battleground: Next arena point distribution time in the past, reseting it now."); } else m_NextAutoDistributionTime = wstime; - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "Automatic Arena Point Distribution initialized."); + TC_LOG_DEBUG("bg.battleground", "Automatic Arena Point Distribution initialized."); } void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, uint64 guid, Player* player, BattlegroundTypeId bgTypeId, uint8 fromWhere) @@ -898,11 +899,11 @@ void BattlegroundMgr::SendToBattleground(Player* player, uint32 instanceId, Batt team = player->GetTeam(); bg->GetTeamStartLoc(team, x, y, z, O); - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "BattlegroundMgr::SendToBattleground: Sending %s to map %u, X %f, Y %f, Z %f, O %f (bgType %u)", player->GetName().c_str(), mapid, x, y, z, O, bgTypeId); + TC_LOG_DEBUG("bg.battleground", "BattlegroundMgr::SendToBattleground: Sending %s to map %u, X %f, Y %f, Z %f, O %f (bgType %u)", player->GetName().c_str(), mapid, x, y, z, O, bgTypeId); player->TeleportTo(mapid, x, y, z, O); } else - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "BattlegroundMgr::SendToBattleground: Instance %u (bgType %u) not found while trying to teleport player %s", instanceId, bgTypeId, player->GetName().c_str()); + TC_LOG_ERROR("bg.battleground", "BattlegroundMgr::SendToBattleground: Instance %u (bgType %u) not found while trying to teleport player %s", instanceId, bgTypeId, player->GetName().c_str()); } void BattlegroundMgr::SendAreaSpiritHealerQueryOpcode(Player* player, Battleground* bg, uint64 guid) @@ -1068,7 +1069,7 @@ void BattlegroundMgr::LoadBattleMastersEntry() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 battlemaster entries. DB table `battlemaster_entry` is empty!"); + TC_LOG_INFO("server.loading", ">> Loaded 0 battlemaster entries. DB table `battlemaster_entry` is empty!"); return; } @@ -1084,7 +1085,7 @@ void BattlegroundMgr::LoadBattleMastersEntry() uint32 bgTypeId = fields[1].GetUInt32(); if (!sBattlemasterListStore.LookupEntry(bgTypeId)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `battlemaster_entry` contain entry %u for not existed battleground type %u, ignored.", entry, bgTypeId); + TC_LOG_ERROR("sql.sql", "Table `battlemaster_entry` contain entry %u for not existed battleground type %u, ignored.", entry, bgTypeId); continue; } @@ -1092,7 +1093,7 @@ void BattlegroundMgr::LoadBattleMastersEntry() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u battlemaster entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u battlemaster entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } HolidayIds BattlegroundMgr::BGTypeToWeekendHolidayId(BattlegroundTypeId bgTypeId) diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.cpp b/src/server/game/Battlegrounds/BattlegroundQueue.cpp index e52d64a4f72..ae7a8d2e191 100644 --- a/src/server/game/Battlegrounds/BattlegroundQueue.cpp +++ b/src/server/game/Battlegrounds/BattlegroundQueue.cpp @@ -154,7 +154,7 @@ GroupQueueInfo* BattlegroundQueue::AddGroup(Player* leader, Group* grp, Battlegr index += BG_TEAMS_COUNT; if (ginfo->Team == HORDE) index++; - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "Adding Group to BattlegroundQueue bgTypeId : %u, bracket_id : %u, index : %u", BgTypeId, bracketId, index); + TC_LOG_DEBUG("bg.battleground", "Adding Group to BattlegroundQueue bgTypeId : %u, bracket_id : %u, index : %u", BgTypeId, bracketId, index); uint32 lastOnlineTime = getMSTime(); @@ -295,7 +295,7 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount) std::string playerName = "Unknown"; if (Player* player = ObjectAccessor::FindPlayer(guid)) playerName = player->GetName(); - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "BattlegroundQueue: couldn't find player %s (GUID: %u)", playerName.c_str(), GUID_LOPART(guid)); + TC_LOG_ERROR("bg.battleground", "BattlegroundQueue: couldn't find player %s (GUID: %u)", playerName.c_str(), GUID_LOPART(guid)); return; } @@ -330,10 +330,10 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount) //player can't be in queue without group, but just in case if (bracket_id == -1) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "BattlegroundQueue: ERROR Cannot find groupinfo for player GUID: %u", GUID_LOPART(guid)); + TC_LOG_ERROR("bg.battleground", "BattlegroundQueue: ERROR Cannot find groupinfo for player GUID: %u", GUID_LOPART(guid)); return; } - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "BattlegroundQueue: Removing player GUID %u, from bracket_id %u", GUID_LOPART(guid), (uint32)bracket_id); + TC_LOG_DEBUG("bg.battleground", "BattlegroundQueue: Removing player GUID %u, from bracket_id %u", GUID_LOPART(guid), (uint32)bracket_id); // ALL variables are correctly set // We can ignore leveling up in queue - it should not cause crash @@ -363,7 +363,7 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount) { if (ArenaTeam* at = sArenaTeamMgr->GetArenaTeamById(group->ArenaTeamId)) { - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "UPDATING memberLost's personal arena rating for %u by opponents rating: %u", GUID_LOPART(guid), group->OpponentsTeamRating); + TC_LOG_DEBUG("bg.battleground", "UPDATING memberLost's personal arena rating for %u by opponents rating: %u", GUID_LOPART(guid), group->OpponentsTeamRating); if (Player* player = ObjectAccessor::FindPlayer(guid)) at->MemberLost(player, group->OpponentsMatchmakerRating); else @@ -476,7 +476,7 @@ bool BattlegroundQueue::InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, uint32 queueSlot = player->GetBattlegroundQueueIndex(bgQueueTypeId); - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "Battleground: invited player %s (%u) to BG instance %u queueindex %u bgtype %u", + TC_LOG_DEBUG("bg.battleground", "Battleground: invited player %s (%u) to BG instance %u queueindex %u bgtype %u", player->GetName().c_str(), player->GetGUIDLow(), bg->GetInstanceID(), queueSlot, bg->GetTypeID()); // send status packet @@ -784,14 +784,14 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 /*diff*/, BattlegroundTyp Battleground* bg_template = sBattlegroundMgr->GetBattlegroundTemplate(bgTypeId); if (!bg_template) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Battleground: Update: bg template not found for %u", bgTypeId); + TC_LOG_ERROR("bg.battleground", "Battleground: Update: bg template not found for %u", bgTypeId); return; } PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketById(bg_template->GetMapId(), bracket_id); if (!bracketEntry) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Battleground: Update: bg bracket entry not found for map %u bracket id %u", bg_template->GetMapId(), bracket_id); + TC_LOG_ERROR("bg.battleground", "Battleground: Update: bg bracket entry not found for map %u bracket id %u", bg_template->GetMapId(), bracket_id); return; } @@ -818,7 +818,7 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 /*diff*/, BattlegroundTyp Battleground* bg2 = sBattlegroundMgr->CreateNewBattleground(bgTypeId, bracketEntry, 0, false); if (!bg2) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "BattlegroundQueue::Update - Cannot create battleground: %u", bgTypeId); + TC_LOG_ERROR("bg.battleground", "BattlegroundQueue::Update - Cannot create battleground: %u", bgTypeId); return; } // invite those selection pools @@ -844,7 +844,7 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 /*diff*/, BattlegroundTyp Battleground* bg2 = sBattlegroundMgr->CreateNewBattleground(bgTypeId, bracketEntry, arenaType, false); if (!bg2) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "BattlegroundQueue::Update - Cannot create battleground: %u", bgTypeId); + TC_LOG_ERROR("bg.battleground", "BattlegroundQueue::Update - Cannot create battleground: %u", bgTypeId); return; } @@ -942,7 +942,7 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 /*diff*/, BattlegroundTyp Battleground* arena = sBattlegroundMgr->CreateNewBattleground(bgTypeId, bracketEntry, arenaType, true); if (!arena) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "BattlegroundQueue::Update couldn't create arena instance for rated arena match!"); + TC_LOG_ERROR("bg.battleground", "BattlegroundQueue::Update couldn't create arena instance for rated arena match!"); return; } @@ -950,8 +950,8 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 /*diff*/, BattlegroundTyp hTeam->OpponentsTeamRating = aTeam->ArenaTeamRating; aTeam->OpponentsMatchmakerRating = hTeam->ArenaMatchmakerRating; hTeam->OpponentsMatchmakerRating = aTeam->ArenaMatchmakerRating; - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "setting oposite teamrating for team %u to %u", aTeam->ArenaTeamId, aTeam->OpponentsTeamRating); - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "setting oposite teamrating for team %u to %u", hTeam->ArenaTeamId, hTeam->OpponentsTeamRating); + TC_LOG_DEBUG("bg.battleground", "setting oposite teamrating for team %u to %u", aTeam->ArenaTeamId, aTeam->OpponentsTeamRating); + TC_LOG_DEBUG("bg.battleground", "setting oposite teamrating for team %u to %u", hTeam->ArenaTeamId, hTeam->OpponentsTeamRating); // now we must move team if we changed its faction to another faction queue, because then we will spam log by errors in Queue::RemovePlayer if (aTeam->Team != ALLIANCE) @@ -970,7 +970,7 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 /*diff*/, BattlegroundTyp InviteGroupToBG(aTeam, arena, ALLIANCE); InviteGroupToBG(hTeam, arena, HORDE); - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "Starting rated arena match!"); + TC_LOG_DEBUG("bg.battleground", "Starting rated arena match!"); arena->StartBattleground(); } } @@ -1041,7 +1041,7 @@ bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) BattlegroundQueue &bgQueue = sBattlegroundMgr->GetBattlegroundQueue(m_BgQueueTypeId); if (bgQueue.IsPlayerInvited(m_PlayerGuid, m_BgInstanceGUID, m_RemoveTime)) { - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "Battleground: removing player %u from bg queue for instance %u because of not pressing enter battle in time.", player->GetGUIDLow(), m_BgInstanceGUID); + TC_LOG_DEBUG("bg.battleground", "Battleground: removing player %u from bg queue for instance %u because of not pressing enter battle in time.", player->GetGUIDLow(), m_BgInstanceGUID); player->RemoveBattlegroundQueueId(m_BgQueueTypeId); bgQueue.RemovePlayer(m_PlayerGuid, true); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp index d7cb4af5a42..e5d93dd9300 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp @@ -35,6 +35,27 @@ BattlegroundAB::BattlegroundAB() BgObjects.resize(BG_AB_OBJECT_MAX); BgCreatures.resize(BG_AB_ALL_NODES_COUNT + 5);//+5 for aura triggers + for (uint8 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i) + { + m_Nodes[i] = 0; + m_prevNodes[i] = 0; + m_NodeTimers[i] = 0; + m_BannerTimers[i].timer = 0; + m_BannerTimers[i].type = 0; + m_BannerTimers[i].teamIndex = 0; + } + + for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i) + { + m_lastTick[i] = 0; + m_HonorScoreTics[i] = 0; + m_ReputationScoreTics[i] = 0; + m_TeamScores500Disadvantage[i] = false; + } + + m_HonorTics = 0; + m_ReputationTics = 0; + StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_AB_START_TWO_MINUTES; StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_AB_START_ONE_MINUTE; StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_AB_START_HALF_MINUTE; @@ -361,7 +382,7 @@ void BattlegroundAB::_SendNodeUpdate(uint8 node) void BattlegroundAB::_NodeOccupied(uint8 node, Team team) { if (!AddSpiritGuide(node, BG_AB_SpiritGuidePos[node][0], BG_AB_SpiritGuidePos[node][1], BG_AB_SpiritGuidePos[node][2], BG_AB_SpiritGuidePos[node][3], team)) - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Failed to spawn spirit guide! point: %u, team: %u, ", node, team); + TC_LOG_ERROR("bg.battleground", "Failed to spawn spirit guide! point: %u, team: %u, ", node, team); if (node >= BG_AB_DYNAMIC_NODES_COUNT)//only dynamic nodes, no start points return; @@ -567,7 +588,7 @@ bool BattlegroundAB::SetupBattleground() || !AddObject(BG_AB_OBJECT_AURA_CONTESTED + 8*i, BG_AB_OBJECTID_AURA_C, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3]/2), std::cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY) ) { - TC_LOG_ERROR(LOG_FILTER_SQL, "BatteGroundAB: Failed to spawn some object Battleground not created!"); + TC_LOG_ERROR("sql.sql", "BatteGroundAB: Failed to spawn some object Battleground not created!"); return false; } } @@ -575,7 +596,7 @@ bool BattlegroundAB::SetupBattleground() || !AddObject(BG_AB_OBJECT_GATE_H, BG_AB_OBJECTID_GATE_H, BG_AB_DoorPositions[1][0], BG_AB_DoorPositions[1][1], BG_AB_DoorPositions[1][2], BG_AB_DoorPositions[1][3], BG_AB_DoorPositions[1][4], BG_AB_DoorPositions[1][5], BG_AB_DoorPositions[1][6], BG_AB_DoorPositions[1][7], RESPAWN_IMMEDIATELY) ) { - TC_LOG_ERROR(LOG_FILTER_SQL, "BatteGroundAB: Failed to spawn door object Battleground not created!"); + TC_LOG_ERROR("sql.sql", "BatteGroundAB: Failed to spawn door object Battleground not created!"); return false; } //buffs @@ -585,7 +606,7 @@ bool BattlegroundAB::SetupBattleground() || !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 1, Buff_Entries[1], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, std::sin(BG_AB_BuffPositions[i][3]/2), std::cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY) || !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 2, Buff_Entries[2], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, std::sin(BG_AB_BuffPositions[i][3]/2), std::cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY) ) - TC_LOG_ERROR(LOG_FILTER_SQL, "BatteGroundAB: Failed to spawn buff object!"); + TC_LOG_ERROR("sql.sql", "BatteGroundAB: Failed to spawn buff object!"); } return true; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp index d5d9ac7577f..8edf5ea0bdb 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp @@ -33,6 +33,25 @@ BattlegroundAV::BattlegroundAV() BgObjects.resize(BG_AV_OBJECT_MAX); BgCreatures.resize(AV_CPLACE_MAX+AV_STATICCPLACE_MAX); + for (uint8 i = 0; i < 2; i++) + { + for (uint8 j = 0; j < 9; j++) + m_Team_QuestStatus[i][j] = 0; + m_Team_Scores[i] = 0; + m_IsInformedNearVictory[i] = false; + m_CaptainAlive[i] = true; + m_CaptainBuffTimer[i] = 0; + m_Mine_Owner[i] = 0; + m_Mine_PrevOwner[i] = 0; + m_Mine_Reclaim_Timer[i] = 0; + } + + m_Mine_Timer = 0; + m_MaxLevel = 0; + + for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i) + InitNode(i, 0, false); + StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_AV_START_TWO_MINUTES; StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_AV_START_ONE_MINUTE; StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_AV_START_HALF_MINUTE; @@ -57,7 +76,7 @@ void BattlegroundAV::HandleKillPlayer(Player* player, Player* killer) void BattlegroundAV::HandleKillUnit(Creature* unit, Player* killer) { - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "bg_av HandleKillUnit %i", unit->GetEntry()); + TC_LOG_DEBUG("bg.battleground", "bg_av HandleKillUnit %i", unit->GetEntry()); if (GetStatus() != STATUS_IN_PROGRESS) return; uint32 entry = unit->GetEntry(); @@ -92,7 +111,7 @@ void BattlegroundAV::HandleKillUnit(Creature* unit, Player* killer) { if (!m_CaptainAlive[0]) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Killed a Captain twice, please report this bug, if you haven't done \".respawn\""); + TC_LOG_ERROR("bg.battleground", "Killed a Captain twice, please report this bug, if you haven't done \".respawn\""); return; } m_CaptainAlive[0]=false; @@ -111,7 +130,7 @@ void BattlegroundAV::HandleKillUnit(Creature* unit, Player* killer) { if (!m_CaptainAlive[1]) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Killed a Captain twice, please report this bug, if you haven't done \".respawn\""); + TC_LOG_ERROR("bg.battleground", "Killed a Captain twice, please report this bug, if you haven't done \".respawn\""); return; } m_CaptainAlive[1]=false; @@ -138,7 +157,7 @@ void BattlegroundAV::HandleQuestComplete(uint32 questid, Player* player) return;//maybe we should log this, cause this must be a cheater or a big bug uint8 team = GetTeamIndexByTeamId(player->GetTeam()); /// @todo add reputation, events (including quest not available anymore, next quest availabe, go/npc de/spawning)and maybe honor - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed", questid); + TC_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed", questid); switch (questid) { case AV_QUEST_A_SCRAPS1: @@ -148,7 +167,7 @@ void BattlegroundAV::HandleQuestComplete(uint32 questid, Player* player) m_Team_QuestStatus[team][0]+=20; if (m_Team_QuestStatus[team][0] == 500 || m_Team_QuestStatus[team][0] == 1000 || m_Team_QuestStatus[team][0] == 1500) //25, 50, 75 turn ins { - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed starting with unit upgrading..", questid); + TC_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed starting with unit upgrading..", questid); for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_FROSTWOLF_HUT; ++i) if (m_Nodes[i].Owner == player->GetTeam() && m_Nodes[i].State == POINT_CONTROLED) { @@ -163,21 +182,21 @@ void BattlegroundAV::HandleQuestComplete(uint32 questid, Player* player) m_Team_QuestStatus[team][1]++; RewardReputationToTeam(team, 1, player->GetTeam()); if (m_Team_QuestStatus[team][1] == 30) - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed (need to implement some events here", questid); + TC_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here", questid); break; case AV_QUEST_A_COMMANDER2: case AV_QUEST_H_COMMANDER2: m_Team_QuestStatus[team][2]++; RewardReputationToTeam(team, 1, player->GetTeam()); if (m_Team_QuestStatus[team][2] == 60) - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed (need to implement some events here", questid); + TC_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here", questid); break; case AV_QUEST_A_COMMANDER3: case AV_QUEST_H_COMMANDER3: m_Team_QuestStatus[team][3]++; RewardReputationToTeam(team, 1, player->GetTeam()); if (m_Team_QuestStatus[team][3] == 120) - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed (need to implement some events here", questid); + TC_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here", questid); break; case AV_QUEST_A_BOSS1: case AV_QUEST_H_BOSS1: @@ -186,16 +205,16 @@ void BattlegroundAV::HandleQuestComplete(uint32 questid, Player* player) case AV_QUEST_H_BOSS2: m_Team_QuestStatus[team][4]++; if (m_Team_QuestStatus[team][4] >= 200) - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed (need to implement some events here", questid); + TC_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here", questid); break; case AV_QUEST_A_NEAR_MINE: case AV_QUEST_H_NEAR_MINE: m_Team_QuestStatus[team][5]++; if (m_Team_QuestStatus[team][5] == 28) { - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed (need to implement some events here", questid); + TC_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here", questid); if (m_Team_QuestStatus[team][6] == 7) - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed (need to implement some events here - ground assault ready", questid); + TC_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here - ground assault ready", questid); } break; case AV_QUEST_A_OTHER_MINE: @@ -203,9 +222,9 @@ void BattlegroundAV::HandleQuestComplete(uint32 questid, Player* player) m_Team_QuestStatus[team][6]++; if (m_Team_QuestStatus[team][6] == 7) { - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed (need to implement some events here", questid); + TC_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here", questid); if (m_Team_QuestStatus[team][5] == 20) - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed (need to implement some events here - ground assault ready", questid); + TC_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here - ground assault ready", questid); } break; case AV_QUEST_A_RIDER_HIDE: @@ -213,9 +232,9 @@ void BattlegroundAV::HandleQuestComplete(uint32 questid, Player* player) m_Team_QuestStatus[team][7]++; if (m_Team_QuestStatus[team][7] == 25) { - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed (need to implement some events here", questid); + TC_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here", questid); if (m_Team_QuestStatus[team][8] == 25) - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed (need to implement some events here - rider assault ready", questid); + TC_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here - rider assault ready", questid); } break; case AV_QUEST_A_RIDER_TAME: @@ -223,13 +242,13 @@ void BattlegroundAV::HandleQuestComplete(uint32 questid, Player* player) m_Team_QuestStatus[team][8]++; if (m_Team_QuestStatus[team][8] == 25) { - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed (need to implement some events here", questid); + TC_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here", questid); if (m_Team_QuestStatus[team][7] == 25) - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed (need to implement some events here - rider assault ready", questid); + TC_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here - rider assault ready", questid); } break; default: - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed but is not interesting at all", questid); + TC_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed but is not interesting at all", questid); return; //was no interesting quest at all break; } @@ -428,7 +447,7 @@ void BattlegroundAV::StartingEventCloseDoors() void BattlegroundAV::StartingEventOpenDoors() { - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "BG_AV: start spawning mine stuff"); + TC_LOG_DEBUG("bg.battleground", "BG_AV: start spawning mine stuff"); for (uint16 i= BG_AV_OBJECT_MINE_SUPPLY_N_MIN; i <= BG_AV_OBJECT_MINE_SUPPLY_N_MAX; i++) SpawnBGObject(i, RESPAWN_IMMEDIATELY); for (uint16 i= BG_AV_OBJECT_MINE_SUPPLY_S_MIN; i <= BG_AV_OBJECT_MINE_SUPPLY_S_MAX; i++) @@ -500,7 +519,7 @@ void BattlegroundAV::RemovePlayer(Player* player, uint64 /*guid*/, uint32 /*team { if (!player) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "bg_AV no player at remove"); + TC_LOG_ERROR("bg.battleground", "bg_AV no player at remove"); return; } /// @todo search more buffs @@ -585,7 +604,7 @@ void BattlegroundAV::UpdatePlayerScore(Player* Source, uint32 type, uint32 value void BattlegroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node) { uint32 object = GetObjectThroughNode(node); - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "bg_av: player destroyed point node %i object %i", node, object); + TC_LOG_DEBUG("bg.battleground", "bg_av: player destroyed point node %i object %i", node, object); //despawn banner SpawnBGObject(object, RESPAWN_ONE_DAY); @@ -600,7 +619,7 @@ void BattlegroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node) if (BgCreatures[AV_CPLACE_A_MARSHAL_SOUTH + tmp]) DelCreature(AV_CPLACE_A_MARSHAL_SOUTH + tmp); else - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "BG_AV: playerdestroyedpoint: marshal %i doesn't exist", AV_CPLACE_A_MARSHAL_SOUTH + tmp); + TC_LOG_ERROR("bg.battleground", "BG_AV: playerdestroyedpoint: marshal %i doesn't exist", AV_CPLACE_A_MARSHAL_SOUTH + tmp); //spawn destroyed aura for (uint8 i=0; i <= 9; i++) SpawnBGObject(BG_AV_OBJECT_BURN_DUNBALDAR_SOUTH + i + (tmp * 10), RESPAWN_IMMEDIATELY); @@ -660,7 +679,7 @@ void BattlegroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial) if (!initial) { - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "bg_av depopulating mine %i (0=north, 1=south)", mine); + TC_LOG_DEBUG("bg.battleground", "bg_av depopulating mine %i (0=north, 1=south)", mine); if (mine == AV_SOUTH_MINE) for (uint16 i=AV_CPLACE_MINE_S_S_MIN; i <= AV_CPLACE_MINE_S_S_MAX; i++) if (BgCreatures[i]) @@ -671,7 +690,7 @@ void BattlegroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial) } SendMineWorldStates(mine); - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "bg_av populating mine %i (0=north, 1=south)", mine); + TC_LOG_DEBUG("bg.battleground", "bg_av populating mine %i (0=north, 1=south)", mine); uint16 miner; //also neutral team exists.. after a big time, the neutral team tries to conquer the mine if (mine == AV_NORTH_MINE) @@ -693,7 +712,7 @@ void BattlegroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial) else miner = AV_NPC_S_MINE_N_1; //vermin - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "spawning vermin"); + TC_LOG_DEBUG("bg.battleground", "spawning vermin"); if (team == ALLIANCE) cinfo = AV_NPC_S_MINE_A_3; else if (team == HORDE) @@ -764,7 +783,7 @@ void BattlegroundAV::PopulateNode(BG_AV_Nodes node) if (BgCreatures[node]) DelCreature(node); if (!AddSpiritGuide(node, BG_AV_CreaturePos[node][0], BG_AV_CreaturePos[node][1], BG_AV_CreaturePos[node][2], BG_AV_CreaturePos[node][3], owner)) - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "AV: couldn't spawn spiritguide at node %i", node); + TC_LOG_ERROR("bg.battleground", "AV: couldn't spawn spiritguide at node %i", node); } for (uint8 i=0; i<4; i++) AddAVCreature(creatureid, c_place+i); @@ -814,7 +833,7 @@ void BattlegroundAV::DePopulateNode(BG_AV_Nodes node) BG_AV_Nodes BattlegroundAV::GetNodeThroughObject(uint32 object) { - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "bg_AV getnodethroughobject %i", object); + TC_LOG_DEBUG("bg.battleground", "bg_AV getnodethroughobject %i", object); if (object <= BG_AV_OBJECT_FLAG_A_STONEHEART_BUNKER) return BG_AV_Nodes(object); if (object <= BG_AV_OBJECT_FLAG_C_A_FROSTWOLF_HUT) @@ -829,14 +848,14 @@ BG_AV_Nodes BattlegroundAV::GetNodeThroughObject(uint32 object) return BG_AV_Nodes(object - 29); if (object == BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE) return BG_AV_NODES_SNOWFALL_GRAVE; - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "BattlegroundAV: ERROR! GetPlace got a wrong object :("); + TC_LOG_ERROR("bg.battleground", "BattlegroundAV: ERROR! GetPlace got a wrong object :("); ASSERT(false); return BG_AV_Nodes(0); } uint32 BattlegroundAV::GetObjectThroughNode(BG_AV_Nodes node) { //this function is the counterpart to GetNodeThroughObject() - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "bg_AV GetObjectThroughNode %i", node); + TC_LOG_DEBUG("bg.battleground", "bg_AV GetObjectThroughNode %i", node); if (m_Nodes[node].Owner == ALLIANCE) { if (m_Nodes[node].State == POINT_ASSAULTED) @@ -867,7 +886,7 @@ uint32 BattlegroundAV::GetObjectThroughNode(BG_AV_Nodes node) } else if (m_Nodes[node].Owner == AV_NEUTRAL_TEAM) return BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE; - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "BattlegroundAV: Error! GetPlaceNode couldn't resolve node %i", node); + TC_LOG_ERROR("bg.battleground", "BattlegroundAV: Error! GetPlaceNode couldn't resolve node %i", node); ASSERT(false); return 0; } @@ -879,7 +898,7 @@ void BattlegroundAV::EventPlayerClickedOnFlag(Player* source, GameObject* target if (GetStatus() != STATUS_IN_PROGRESS) return; int32 object = GetObjectType(target_obj->GetGUID()); - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "BG_AV using gameobject %i with type %i", target_obj->GetEntry(), object); + TC_LOG_DEBUG("bg.battleground", "BG_AV using gameobject %i with type %i", target_obj->GetEntry(), object); if (object < 0) return; switch (target_obj->GetEntry()) @@ -918,10 +937,10 @@ void BattlegroundAV::EventPlayerDefendsPoint(Player* player, uint32 object) EventPlayerAssaultsPoint(player, object); return; } - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "player defends point object: %i node: %i", object, node); + TC_LOG_DEBUG("bg.battleground", "player defends point object: %i node: %i", object, node); if (m_Nodes[node].PrevOwner != team) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "BG_AV: player defends point which doesn't belong to his team %i", node); + TC_LOG_ERROR("bg.battleground", "BG_AV: player defends point which doesn't belong to his team %i", node); return; } @@ -981,7 +1000,7 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object) BG_AV_Nodes node = GetNodeThroughObject(object); uint32 owner = m_Nodes[node].Owner; //maybe name it prevowner uint32 team = player->GetTeam(); - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "bg_av: player assaults point object %i node %i", object, node); + TC_LOG_DEBUG("bg.battleground", "bg_av: player assaults point object %i node %i", object, node); if (owner == team || team == m_Nodes[node].TotalOwner) return; //surely a gm used this object @@ -1127,7 +1146,7 @@ uint8 BattlegroundAV::GetWorldStateType(uint8 state, uint16 team) //this is used if (state == POINT_ASSAULTED) return 3; } - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "BG_AV: should update a strange worldstate state:%i team:%i", state, team); + TC_LOG_ERROR("bg.battleground", "BG_AV: should update a strange worldstate state:%i team:%i", state, team); return 5; //this will crash the game, but i want to know if something is wrong here } @@ -1210,7 +1229,7 @@ bool BattlegroundAV::SetupBattleground() BG_AV_DoorPositons[1][0], BG_AV_DoorPositons[1][1], BG_AV_DoorPositons[1][2], BG_AV_DoorPositons[1][3], 0, 0, std::sin(BG_AV_DoorPositons[1][3]/2), std::cos(BG_AV_DoorPositons[1][3]/2), RESPAWN_IMMEDIATELY)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "BatteGroundAV: Failed to spawn some object Battleground not created!1"); + TC_LOG_ERROR("sql.sql", "BatteGroundAV: Failed to spawn some object Battleground not created!1"); return false; } @@ -1242,7 +1261,7 @@ bool BattlegroundAV::SetupBattleground() BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!2"); + TC_LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!2"); return false; } } @@ -1269,7 +1288,7 @@ bool BattlegroundAV::SetupBattleground() BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!3"); + TC_LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!3"); return false; } } @@ -1294,7 +1313,7 @@ bool BattlegroundAV::SetupBattleground() BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!4"); + TC_LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!4"); return false; } } @@ -1312,7 +1331,7 @@ bool BattlegroundAV::SetupBattleground() std::cos(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3]/2), RESPAWN_ONE_DAY)) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!5.%i", i); + TC_LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!5.%i", i); return false; } } @@ -1336,7 +1355,7 @@ bool BattlegroundAV::SetupBattleground() std::cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), RESPAWN_ONE_DAY)) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!6.%i", i); + TC_LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!6.%i", i); return false; } } @@ -1354,7 +1373,7 @@ bool BattlegroundAV::SetupBattleground() std::cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), RESPAWN_ONE_DAY)) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!7.%i", i); + TC_LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!7.%i", i); return false; } } @@ -1374,7 +1393,7 @@ bool BattlegroundAV::SetupBattleground() std::cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3]/2), RESPAWN_ONE_DAY)) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some mine supplies Battleground not created!7.5.%i", i); + TC_LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some mine supplies Battleground not created!7.5.%i", i); return false; } } @@ -1392,7 +1411,7 @@ bool BattlegroundAV::SetupBattleground() std::cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2), RESPAWN_ONE_DAY)) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some mine supplies Battleground not created!7.6.%i", i); + TC_LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some mine supplies Battleground not created!7.6.%i", i); return false; } } @@ -1409,7 +1428,7 @@ bool BattlegroundAV::SetupBattleground() std::cos(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2), RESPAWN_ONE_DAY)) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!8"); + TC_LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!8"); return false; } for (uint8 i = 0; i < 4; i++) @@ -1427,13 +1446,13 @@ bool BattlegroundAV::SetupBattleground() BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!9.%i", i); + TC_LOG_ERROR("bg.battleground", "BatteGroundAV: Failed to spawn some object Battleground not created!9.%i", i); return false; } } uint16 i; - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "Alterac Valley: entering state STATUS_WAIT_JOIN ..."); + TC_LOG_DEBUG("bg.battleground", "Alterac Valley: entering state STATUS_WAIT_JOIN ..."); // Initial Nodes for (i = 0; i < BG_AV_OBJECT_MAX; i++) SpawnBGObject(i, RESPAWN_ONE_DAY); @@ -1473,22 +1492,22 @@ bool BattlegroundAV::SetupBattleground() SpawnBGObject(BG_AV_OBJECT_AURA_N_SNOWFALL_GRAVE, RESPAWN_IMMEDIATELY); //creatures - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "BG_AV start poputlating nodes"); + TC_LOG_DEBUG("bg.battleground", "BG_AV start poputlating nodes"); for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i) { if (m_Nodes[i].Owner) PopulateNode(i); } //all creatures which don't get despawned through the script are static - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "BG_AV: start spawning static creatures"); + TC_LOG_DEBUG("bg.battleground", "BG_AV: start spawning static creatures"); for (i = 0; i < AV_STATICCPLACE_MAX; i++) AddAVCreature(0, i + AV_CPLACE_MAX); //mainspiritguides: - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "BG_AV: start spawning spiritguides creatures"); + TC_LOG_DEBUG("bg.battleground", "BG_AV: start spawning spiritguides creatures"); AddSpiritGuide(7, BG_AV_CreaturePos[7][0], BG_AV_CreaturePos[7][1], BG_AV_CreaturePos[7][2], BG_AV_CreaturePos[7][3], ALLIANCE); AddSpiritGuide(8, BG_AV_CreaturePos[8][0], BG_AV_CreaturePos[8][1], BG_AV_CreaturePos[8][2], BG_AV_CreaturePos[8][3], HORDE); //spawn the marshals (those who get deleted, if a tower gets destroyed) - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "BG_AV: start spawning marshal creatures"); + TC_LOG_DEBUG("bg.battleground", "BG_AV: start spawning marshal creatures"); for (i = AV_NPC_A_MARSHAL_SOUTH; i <= AV_NPC_H_MARSHAL_WTOWER; i++) AddAVCreature(i, AV_CPLACE_A_MARSHAL_SOUTH + (i - AV_NPC_A_MARSHAL_SOUTH)); AddAVCreature(AV_NPC_HERALD, AV_CPLACE_HERALD); @@ -1515,7 +1534,7 @@ char const* BattlegroundAV::GetNodeName(BG_AV_Nodes node) case BG_AV_NODES_FROSTWOLF_WTOWER: return GetTrinityString(LANG_BG_AV_NODE_TOWER_FROST_W); case BG_AV_NODES_FROSTWOLF_HUT: return GetTrinityString(LANG_BG_AV_NODE_GRAVE_FROST_HUT); default: - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "tried to get name for node %u", node); + TC_LOG_ERROR("bg.battleground", "tried to get name for node %u", node); break; } @@ -1526,22 +1545,22 @@ void BattlegroundAV::AssaultNode(BG_AV_Nodes node, uint16 team) { if (m_Nodes[node].TotalOwner == team) { - TC_LOG_FATAL(LOG_FILTER_BATTLEGROUND, "Assaulting team is TotalOwner of node"); + TC_LOG_FATAL("bg.battleground", "Assaulting team is TotalOwner of node"); ASSERT(false); } if (m_Nodes[node].Owner == team) { - TC_LOG_FATAL(LOG_FILTER_BATTLEGROUND, "Assaulting team is owner of node"); + TC_LOG_FATAL("bg.battleground", "Assaulting team is owner of node"); ASSERT(false); } if (m_Nodes[node].State == POINT_DESTROYED) { - TC_LOG_FATAL(LOG_FILTER_BATTLEGROUND, "Destroyed node is being assaulted"); + TC_LOG_FATAL("bg.battleground", "Destroyed node is being assaulted"); ASSERT(false); } if (m_Nodes[node].State == POINT_ASSAULTED && m_Nodes[node].TotalOwner) //only assault an assaulted node if no totalowner exists { - TC_LOG_FATAL(LOG_FILTER_BATTLEGROUND, "Assault on an not assaulted node with total owner"); + TC_LOG_FATAL("bg.battleground", "Assault on an not assaulted node with total owner"); ASSERT(false); } //the timer gets another time, if the previous owner was 0 == Neutral diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp index b49ae97493c..264f421d9f7 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp @@ -84,7 +84,7 @@ void BattlegroundBE::HandleKillPlayer(Player* player, Player* killer) if (!killer) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Killer player not found"); + TC_LOG_ERROR("bg.battleground", "Killer player not found"); return; } @@ -133,7 +133,7 @@ bool BattlegroundBE::SetupBattleground() || !AddObject(BG_BE_OBJECT_BUFF_1, BG_BE_OBJECT_TYPE_BUFF_1, 6249.042f, 275.3239f, 11.22033f, -1.448624f, 0, 0, 0.6626201f, -0.7489557f, 120) || !AddObject(BG_BE_OBJECT_BUFF_2, BG_BE_OBJECT_TYPE_BUFF_2, 6228.26f, 249.566f, 11.21812f, -0.06981307f, 0, 0, 0.03489945f, -0.9993908f, 120)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "BatteGroundBE: Failed to spawn some object!"); + TC_LOG_ERROR("sql.sql", "BatteGroundBE: Failed to spawn some object!"); return false; } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp index 83965884029..567b3c248f7 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp @@ -29,6 +29,12 @@ BattlegroundDS::BattlegroundDS() BgObjects.resize(BG_DS_OBJECT_MAX); BgCreatures.resize(BG_DS_NPC_MAX); + _waterfallTimer = 0; + _waterfallStatus = 0; + _waterfallKnockbackTimer = 0; + _pipeKnockBackTimer = 0; + _pipeKnockBackCount = 0; + StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M; StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S; StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S; @@ -166,7 +172,7 @@ void BattlegroundDS::HandleKillPlayer(Player* player, Player* killer) if (!killer) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "BattlegroundDS: Killer player not found"); + TC_LOG_ERROR("bg.battleground", "BattlegroundDS: Killer player not found"); return; } @@ -228,7 +234,7 @@ bool BattlegroundDS::SetupBattleground() || !AddCreature(BG_DS_NPC_TYPE_WATER_SPOUT, BG_DS_NPC_PIPE_KNOCKBACK_1, 0, 1369.977f, 817.2882f, 16.08718f, 3.106686f, RESPAWN_IMMEDIATELY) || !AddCreature(BG_DS_NPC_TYPE_WATER_SPOUT, BG_DS_NPC_PIPE_KNOCKBACK_2, 0, 1212.833f, 765.3871f, 16.09484f, 0.0f, RESPAWN_IMMEDIATELY)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "BatteGroundDS: Failed to spawn some object!"); + TC_LOG_ERROR("sql.sql", "BatteGroundDS: Failed to spawn some object!"); return false; } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp index 600106dbdc1..d4035f95cda 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp @@ -43,6 +43,28 @@ BattlegroundEY::BattlegroundEY() m_Points_Trigger[BLOOD_ELF] = TR_BLOOD_ELF_BUFF; m_Points_Trigger[DRAENEI_RUINS] = TR_DRAENEI_RUINS_BUFF; m_Points_Trigger[MAGE_TOWER] = TR_MAGE_TOWER_BUFF; + m_HonorScoreTics[TEAM_ALLIANCE] = 0; + m_HonorScoreTics[TEAM_HORDE] = 0; + m_TeamPointsCount[TEAM_ALLIANCE] = 0; + m_TeamPointsCount[TEAM_HORDE] = 0; + m_FlagKeeper = 0; + m_DroppedFlagGUID = 0; + m_FlagCapturedBgObjectType = 0; + m_FlagState = BG_EY_FLAG_STATE_ON_BASE; + m_FlagsTimer = 0; + m_TowerCapCheckTimer = 0; + m_PointAddingTimer = 0; + m_HonorTics = 0; + + for (uint8 i = 0; i < EY_POINTS_MAX; ++i) + { + m_PointOwnedByTeam[i] = EY_POINT_NO_OWNER; + m_PointState[i] = EY_POINT_STATE_UNCONTROLLED; + m_PointBarStatus[i] = BG_EY_PROGRESS_BAR_STATE_MIDDLE; + } + + for (uint8 i = 0; i < 2 * EY_POINTS_MAX; ++i) + m_CurrentPointPlayersCount[i] = 0; StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_EY_START_TWO_MINUTES; StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_EY_START_ONE_MINUTE; @@ -150,7 +172,7 @@ void BattlegroundEY::CheckSomeoneJoinedPoint() Player* player = ObjectAccessor::FindPlayer(m_PlayersNearPoint[EY_POINTS_MAX][j]); if (!player) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "BattlegroundEY:CheckSomeoneJoinedPoint: Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[EY_POINTS_MAX][j])); + TC_LOG_ERROR("bg.battleground", "BattlegroundEY:CheckSomeoneJoinedPoint: Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[EY_POINTS_MAX][j])); ++j; continue; } @@ -190,7 +212,7 @@ void BattlegroundEY::CheckSomeoneLeftPoint() Player* player = ObjectAccessor::FindPlayer(m_PlayersNearPoint[i][j]); if (!player) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "BattlegroundEY:CheckSomeoneLeftPoint Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[i][j])); + TC_LOG_ERROR("bg.battleground", "BattlegroundEY:CheckSomeoneLeftPoint Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[i][j])); //move not existed player to "free space" - this will cause many error showing in log, but it is a very important bug m_PlayersNearPoint[EY_POINTS_MAX].push_back(m_PlayersNearPoint[i][j]); m_PlayersNearPoint[i].erase(m_PlayersNearPoint[i].begin() + j); @@ -479,7 +501,7 @@ bool BattlegroundEY::SetupBattleground() || !AddObject(BG_EY_OBJECT_TOWER_CAP_MAGE_TOWER, BG_OBJECT_HU_TOWER_CAP_EY_ENTRY, 2282.121582f, 1760.006958f, 1189.707153f, 1.919862f, 0, 0, 0.819152f, 0.573576f, RESPAWN_ONE_DAY) ) { - TC_LOG_ERROR(LOG_FILTER_SQL, "BatteGroundEY: Failed to spawn some object Battleground not created!"); + TC_LOG_ERROR("sql.sql", "BatteGroundEY: Failed to spawn some object Battleground not created!"); return false; } @@ -489,28 +511,28 @@ bool BattlegroundEY::SetupBattleground() AreaTriggerEntry const* at = sAreaTriggerStore.LookupEntry(m_Points_Trigger[i]); if (!at) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "BattlegroundEY: Unknown trigger: %u", m_Points_Trigger[i]); + TC_LOG_ERROR("bg.battleground", "BattlegroundEY: Unknown trigger: %u", m_Points_Trigger[i]); continue; } if (!AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + i * 3, Buff_Entries[0], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY) || !AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + i * 3 + 1, Buff_Entries[1], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY) || !AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + i * 3 + 2, Buff_Entries[2], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY) ) - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "BattlegroundEY: Cannot spawn buff"); + TC_LOG_ERROR("bg.battleground", "BattlegroundEY: Cannot spawn buff"); } WorldSafeLocsEntry const* sg = NULL; sg = sWorldSafeLocsStore.LookupEntry(EY_GRAVEYARD_MAIN_ALLIANCE); if (!sg || !AddSpiritGuide(EY_SPIRIT_MAIN_ALLIANCE, sg->x, sg->y, sg->z, 3.124139f, ALLIANCE)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "BatteGroundEY: Failed to spawn spirit guide! Battleground not created!"); + TC_LOG_ERROR("sql.sql", "BatteGroundEY: Failed to spawn spirit guide! Battleground not created!"); return false; } sg = sWorldSafeLocsStore.LookupEntry(EY_GRAVEYARD_MAIN_HORDE); if (!sg || !AddSpiritGuide(EY_SPIRIT_MAIN_HORDE, sg->x, sg->y, sg->z, 3.193953f, HORDE)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "BatteGroundEY: Failed to spawn spirit guide! Battleground not created!"); + TC_LOG_ERROR("sql.sql", "BatteGroundEY: Failed to spawn spirit guide! Battleground not created!"); return false; } @@ -575,7 +597,7 @@ void BattlegroundEY::RespawnFlagAfterDrop() if (obj) obj->Delete(); else - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "BattlegroundEY: Unknown dropped flag guid: %u", GUID_LOPART(GetDroppedFlagGUID())); + TC_LOG_ERROR("bg.battleground", "BattlegroundEY: Unknown dropped flag guid: %u", GUID_LOPART(GetDroppedFlagGUID())); SetDroppedFlagGUID(0); } @@ -747,7 +769,7 @@ void BattlegroundEY::EventTeamCapturedPoint(Player* player, uint32 Point) WorldSafeLocsEntry const* sg = NULL; sg = sWorldSafeLocsStore.LookupEntry(m_CapturingPointTypes[Point].GraveYardId); if (!sg || !AddSpiritGuide(Point, sg->x, sg->y, sg->z, 3.124139f, Team)) - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "BatteGroundEY: Failed to spawn spirit guide! point: %u, team: %u, graveyard_id: %u", + TC_LOG_ERROR("bg.battleground", "BatteGroundEY: Failed to spawn spirit guide! point: %u, team: %u, graveyard_id: %u", Point, Team, m_CapturingPointTypes[Point].GraveYardId); // SpawnBGCreature(Point, RESPAWN_IMMEDIATELY); @@ -899,7 +921,7 @@ WorldSafeLocsEntry const* BattlegroundEY::GetClosestGraveYard(Player* player) if (!entry) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "BattlegroundEY: Not found the main team graveyard. Graveyard system isn't working!"); + TC_LOG_ERROR("bg.battleground", "BattlegroundEY: Not found the main team graveyard. Graveyard system isn't working!"); return NULL; } @@ -916,7 +938,7 @@ WorldSafeLocsEntry const* BattlegroundEY::GetClosestGraveYard(Player* player) { entry = sWorldSafeLocsStore.LookupEntry(m_CapturingPointTypes[i].GraveYardId); if (!entry) - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "BattlegroundEY: Not found graveyard: %u", m_CapturingPointTypes[i].GraveYardId); + TC_LOG_ERROR("bg.battleground", "BattlegroundEY: Not found graveyard: %u", m_CapturingPointTypes[i].GraveYardId); else { distance = (entry->x - plr_x)*(entry->x - plr_x) + (entry->y - plr_y)*(entry->y - plr_y) + (entry->z - plr_z)*(entry->z - plr_z); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp index 60a725b3eb7..aa3568a62d5 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp @@ -266,7 +266,7 @@ void BattlegroundIC::StartingEventOpenDoors() BG_IC_Teleporters[i].z, BG_IC_Teleporters[i].o, 0, 0, 0, 0, RESPAWN_ONE_DAY)) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Isle of Conquest | Starting Event Open Doors: There was an error spawning gameobject %u", BG_IC_Teleporters[i].entry); + TC_LOG_ERROR("bg.battleground", "Isle of Conquest | Starting Event Open Doors: There was an error spawning gameobject %u", BG_IC_Teleporters[i].entry); } } } @@ -362,7 +362,7 @@ bool BattlegroundIC::SetupBattleground() BG_IC_ObjSpawnlocs[i].z, BG_IC_ObjSpawnlocs[i].o, 0, 0, 0, 0, RESPAWN_ONE_DAY)) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Isle of Conquest: There was an error spawning gameobject %u", BG_IC_ObjSpawnlocs[i].entry); + TC_LOG_ERROR("bg.battleground", "Isle of Conquest: There was an error spawning gameobject %u", BG_IC_ObjSpawnlocs[i].entry); return false; } } @@ -374,7 +374,7 @@ bool BattlegroundIC::SetupBattleground() BG_IC_NpcSpawnlocs[i].z, BG_IC_NpcSpawnlocs[i].o, RESPAWN_ONE_DAY)) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Isle of Conquest: There was an error spawning creature %u", BG_IC_NpcSpawnlocs[i].entry); + TC_LOG_ERROR("bg.battleground", "Isle of Conquest: There was an error spawning creature %u", BG_IC_NpcSpawnlocs[i].entry); return false; } } @@ -384,7 +384,7 @@ bool BattlegroundIC::SetupBattleground() || !AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1+3, BG_IC_SpiritGuidePos[7][0], BG_IC_SpiritGuidePos[7][1], BG_IC_SpiritGuidePos[7][2], BG_IC_SpiritGuidePos[7][3], ALLIANCE) || !AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1+4, BG_IC_SpiritGuidePos[8][0], BG_IC_SpiritGuidePos[8][1], BG_IC_SpiritGuidePos[8][2], BG_IC_SpiritGuidePos[8][3], HORDE)) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Isle of Conquest: Failed to spawn initial spirit guide!"); + TC_LOG_ERROR("bg.battleground", "Isle of Conquest: Failed to spawn initial spirit guide!"); return false; } @@ -393,7 +393,7 @@ bool BattlegroundIC::SetupBattleground() if (!gunshipAlliance || !gunshipHorde) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Isle of Conquest: There was an error creating gunships!"); + TC_LOG_ERROR("bg.battleground", "Isle of Conquest: There was an error creating gunships!"); return false; } @@ -523,7 +523,7 @@ void BattlegroundIC::EventPlayerClickedOnFlag(Player* player, GameObject* target DelObject(nodePoint[i].gameobject_type); if (!AddObject(nodePoint[i].gameobject_type, nodePoint[i].gameobject_entry, cords[0], cords[1], cords[2], cords[3], 0, 0, 0, 0, RESPAWN_ONE_DAY)) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Isle of Conquest: There was an error spawning a banner (type: %u, entry: %u). Isle of Conquest BG cancelled.", nodePoint[i].gameobject_type, nodePoint[i].gameobject_entry); + TC_LOG_ERROR("bg.battleground", "Isle of Conquest: There was an error spawning a banner (type: %u, entry: %u). Isle of Conquest BG cancelled.", nodePoint[i].gameobject_type, nodePoint[i].gameobject_entry); Battleground::EndBattleground(WINNER_NONE); } @@ -558,8 +558,12 @@ void BattlegroundIC::UpdateNodeWorldState(ICNodePoint* nodePoint) uint32 worldstate = nodePoint->worldStates[nodePoint->nodeState]; // with this we are sure we dont bug the client - for (uint8 i = 0; i < 4; ++i) + for (uint8 i = 0; i < 5; ++i) + { + if (nodePoint->worldStates[i] == worldstate) + continue; UpdateWorldState(nodePoint->worldStates[i], 0); + } UpdateWorldState(worldstate, 1); } @@ -585,7 +589,7 @@ uint32 BattlegroundIC::GetNextBanner(ICNodePoint* nodePoint, uint32 team, bool r return nodePoint->last_entry; // we should never be here... - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Isle Of Conquest: Unexpected return in GetNextBanner function"); + TC_LOG_ERROR("bg.battleground", "Isle Of Conquest: Unexpected return in GetNextBanner function"); return 0; } @@ -609,7 +613,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture) BG_IC_SpiritGuidePos[nodePoint->nodeType][0], BG_IC_SpiritGuidePos[nodePoint->nodeType][1], BG_IC_SpiritGuidePos[nodePoint->nodeType][2], BG_IC_SpiritGuidePos[nodePoint->nodeType][3], (nodePoint->faction == TEAM_ALLIANCE ? ALLIANCE : HORDE))) - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Isle of Conquest: Failed to spawn spirit guide! point: %u, team: %u, ", nodePoint->nodeType, nodePoint->faction); + TC_LOG_ERROR("bg.battleground", "Isle of Conquest: Failed to spawn spirit guide! point: %u, team: %u, ", nodePoint->nodeType, nodePoint->faction); } switch (nodePoint->gameobject_type) @@ -627,11 +631,11 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture) BG_IC_HangarTeleporters[u].GetPositionZ(), BG_IC_HangarTeleporters[u].GetOrientation(), 0, 0, 0, 0, RESPAWN_ONE_DAY)) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Isle of Conquest: There was an error spawning a gunship portal. Type: %u", BG_IC_GO_HANGAR_TELEPORTER_1+u); + TC_LOG_ERROR("bg.battleground", "Isle of Conquest: There was an error spawning a gunship portal. Type: %u", BG_IC_GO_HANGAR_TELEPORTER_1+u); } } - //TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "BG_IC_GO_HANGAR_BANNER CAPTURED Faction: %u", nodePoint->faction); + //TC_LOG_ERROR("bg.battleground", "BG_IC_GO_HANGAR_BANNER CAPTURED Faction: %u", nodePoint->faction); (nodePoint->faction == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde)->EnableMovement(true); (nodePoint->faction == TEAM_ALLIANCE ? gunshipHorde : gunshipAlliance)->EnableMovement(false); @@ -829,12 +833,12 @@ void BattlegroundIC::DestroyGate(Player* player, GameObject* go) if (go->GetEntry() == GO_HORDE_GATE_1 || go->GetEntry() == GO_HORDE_GATE_2 || go->GetEntry() == GO_HORDE_GATE_3) { if (!GetBgMap()->GetCreature(BgCreatures[BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].type]) && !AddCreature(BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].entry, BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].type, BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].team, BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].x, BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].y, BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].z, BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].o, RESPAWN_ONE_DAY)) - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Isle of Conquest: There was an error spawning creature %u", BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].entry); + TC_LOG_ERROR("bg.battleground", "Isle of Conquest: There was an error spawning creature %u", BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].entry); } else if (go->GetEntry() == GO_ALLIANCE_GATE_1 || go->GetEntry() == GO_ALLIANCE_GATE_2 || go->GetEntry() == GO_ALLIANCE_GATE_3) { if (!GetBgMap()->GetCreature(BgCreatures[BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].type]) && !AddCreature(BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].entry, BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].type, BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].team, BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].x, BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].y, BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].z, BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].o, RESPAWN_ONE_DAY)) - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Isle of Conquest: There was an error spawning creature %u", BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].entry); + TC_LOG_ERROR("bg.battleground", "Isle of Conquest: There was an error spawning creature %u", BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].entry); } SendMessage2ToAll(lang_entry, CHAT_MSG_BG_SYSTEM_NEUTRAL, NULL, (player->GetTeamId() == TEAM_ALLIANCE ? LANG_BG_IC_HORDE_KEEP : LANG_BG_IC_ALLIANCE_KEEP)); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp index 3f644936262..a2c1ca42406 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp @@ -81,7 +81,7 @@ void BattlegroundNA::HandleKillPlayer(Player* player, Player* killer) if (!killer) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "BattlegroundNA: Killer player not found"); + TC_LOG_ERROR("bg.battleground", "BattlegroundNA: Killer player not found"); return; } @@ -130,7 +130,7 @@ bool BattlegroundNA::SetupBattleground() || !AddObject(BG_NA_OBJECT_BUFF_1, BG_NA_OBJECT_TYPE_BUFF_1, 4009.189941f, 2895.250000f, 13.052700f, -1.448624f, 0, 0, 0.6626201f, -0.7489557f, 120) || !AddObject(BG_NA_OBJECT_BUFF_2, BG_NA_OBJECT_TYPE_BUFF_2, 4103.330078f, 2946.350098f, 13.051300f, -0.06981307f, 0, 0, 0.03489945f, -0.9993908f, 120)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "BatteGroundNA: Failed to spawn some object!"); + TC_LOG_ERROR("sql.sql", "BatteGroundNA: Failed to spawn some object!"); return false; } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp index b7c19175632..045e007bdb7 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp @@ -81,7 +81,7 @@ void BattlegroundRL::HandleKillPlayer(Player* player, Player* killer) if (!killer) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Killer player not found"); + TC_LOG_ERROR("bg.battleground", "Killer player not found"); return; } @@ -128,7 +128,7 @@ bool BattlegroundRL::SetupBattleground() || !AddObject(BG_RL_OBJECT_BUFF_1, BG_RL_OBJECT_TYPE_BUFF_1, 1328.719971f, 1632.719971f, 36.730400f, -1.448624f, 0, 0, 0.6626201f, -0.7489557f, 120) || !AddObject(BG_RL_OBJECT_BUFF_2, BG_RL_OBJECT_TYPE_BUFF_2, 1243.300049f, 1699.170044f, 34.872601f, -0.06981307f, 0, 0, 0.03489945f, -0.9993908f, 120)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "BatteGroundRL: Failed to spawn some object!"); + TC_LOG_ERROR("sql.sql", "BatteGroundRL: Failed to spawn some object!"); return false; } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp index d88c9c7a73f..79b732026cc 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp @@ -28,6 +28,10 @@ BattlegroundRV::BattlegroundRV() { BgObjects.resize(BG_RV_OBJECT_MAX); + Timer = 0; + State = 0; + PillarCollision = false; + StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M; StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S; StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S; @@ -119,7 +123,7 @@ void BattlegroundRV::HandleKillPlayer(Player* player, Player* killer) if (!killer) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "BattlegroundRV: Killer player not found"); + TC_LOG_ERROR("bg.battleground", "BattlegroundRV: Killer player not found"); return; } @@ -196,7 +200,7 @@ bool BattlegroundRV::SetupBattleground() ) { - TC_LOG_ERROR(LOG_FILTER_SQL, "BatteGroundRV: Failed to spawn some object!"); + TC_LOG_ERROR("sql.sql", "BatteGroundRV: Failed to spawn some object!"); return false; } return true; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp index 4eb56db700a..323411ab93f 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp @@ -37,6 +37,22 @@ BattlegroundSA::BattlegroundSA() SignaledRoundTwo = false; SignaledRoundTwoHalfMin = false; InitSecondRound = false; + gateDestroyed = false; + Attackers = TEAM_ALLIANCE; + TotalTime = 0; + EndRoundTimer = 0; + ShipsStarted = false; + Status = BG_SA_NOTSTARTED; + + for (uint8 i = 0; i < 6; i++) + GateStatus[i] = BG_SA_GATE_OK; + + for (uint8 i = 0; i < 2; i++) + { + RoundScores[i].winner = TEAM_ALLIANCE; + RoundScores[i].time = 0; + _allVehiclesAlive[i] = true; + } //! This is here to prevent an uninitialised variable warning //! The warning only occurs when SetUpBattleGround fails though. @@ -163,7 +179,7 @@ bool BattlegroundSA::ResetObjs() if (!sg) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "SOTA: Can't find GY entry %u", BG_SA_GYEntries[i]); + TC_LOG_ERROR("bg.battleground", "SOTA: Can't find GY entry %u", BG_SA_GYEntries[i]); return false; } @@ -176,7 +192,7 @@ bool BattlegroundSA::ResetObjs() { GraveyardStatus[i] = ((Attackers == TEAM_HORDE)? TEAM_ALLIANCE : TEAM_HORDE); if (!AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], ((Attackers == TEAM_HORDE)? ALLIANCE : HORDE))) - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "SOTA: couldn't spawn GY: %u", i); + TC_LOG_ERROR("bg.battleground", "SOTA: couldn't spawn GY: %u", i); } } @@ -726,7 +742,7 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source) WorldSafeLocsEntry const* sg = sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[i]); if (!sg) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "BattlegroundSA::CaptureGraveyard: non-existant GY entry: %u", BG_SA_GYEntries[i]); + TC_LOG_ERROR("bg.battleground", "BattlegroundSA::CaptureGraveyard: non-existant GY entry: %u", BG_SA_GYEntries[i]); return; } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp index f0e66d1e15d..98f143b6dae 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp @@ -54,6 +54,21 @@ BattlegroundWS::BattlegroundWS() _flagSpellForceTimer = 0; _bothFlagsKept = false; _flagDebuffState = 0; + m_FlagKeepers[TEAM_ALLIANCE] = 0; + m_FlagKeepers[TEAM_HORDE] = 0; + m_DroppedFlagGUID[TEAM_ALLIANCE] = 0; + m_DroppedFlagGUID[TEAM_HORDE] = 0; + _flagState[TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE; + _flagState[TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE; + _flagsTimer[TEAM_ALLIANCE] = 0; + _flagsTimer[TEAM_HORDE] = 0; + _flagsDropTimer[TEAM_ALLIANCE] = 0; + _flagsDropTimer[TEAM_HORDE] = 0; + _lastFlagCaptureTeam = 0; + m_ReputationCapture = 0; + m_HonorWinKills = 0; + m_HonorEndKills = 0; + _minutesElapsed = 0; } BattlegroundWS::~BattlegroundWS() { } @@ -224,12 +239,12 @@ void BattlegroundWS::RespawnFlag(uint32 Team, bool captured) { if (Team == ALLIANCE) { - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "Respawn Alliance flag"); + TC_LOG_DEBUG("bg.battleground", "Respawn Alliance flag"); _flagState[TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE; } else { - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "Respawn Horde flag"); + TC_LOG_DEBUG("bg.battleground", "Respawn Horde flag"); _flagState[TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE; } @@ -266,7 +281,7 @@ void BattlegroundWS::RespawnFlagAfterDrop(uint32 team) if (GameObject* obj = GetBgMap()->GetGameObject(GetDroppedFlagGUID(team))) obj->Delete(); else - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "unknown droped flag bg, guid: %u", GUID_LOPART(GetDroppedFlagGUID(team))); + TC_LOG_ERROR("bg.battleground", "unknown droped flag bg, guid: %u", GUID_LOPART(GetDroppedFlagGUID(team))); SetDroppedFlagGUID(0, GetTeamIndexByTeamId(team)); _bothFlagsKept = false; @@ -578,7 +593,7 @@ void BattlegroundWS::RemovePlayer(Player* player, uint64 guid, uint32 /*team*/) { if (!player) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "BattlegroundWS: Removing offline player who has the FLAG!!"); + TC_LOG_ERROR("bg.battleground", "BattlegroundWS: Removing offline player who has the FLAG!!"); SetAllianceFlagPicker(0); RespawnFlag(ALLIANCE, false); } @@ -589,7 +604,7 @@ void BattlegroundWS::RemovePlayer(Player* player, uint64 guid, uint32 /*team*/) { if (!player) { - TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "BattlegroundWS: Removing offline player who has the FLAG!!"); + TC_LOG_ERROR("bg.battleground", "BattlegroundWS: Removing offline player who has the FLAG!!"); SetHordeFlagPicker(0); RespawnFlag(HORDE, false); } @@ -691,25 +706,25 @@ bool BattlegroundWS::SetupBattleground() || !AddObject(BG_WS_OBJECT_DOOR_H_4, BG_OBJECT_DOOR_H_4_WS_ENTRY, 950.7952f, 1459.583f, 342.1523f, 0.05235988f, 0, 0, 0.02617695f, 0.9996573f, RESPAWN_IMMEDIATELY) ) { - TC_LOG_ERROR(LOG_FILTER_SQL, "BatteGroundWS: Failed to spawn some object Battleground not created!"); + TC_LOG_ERROR("sql.sql", "BatteGroundWS: Failed to spawn some object Battleground not created!"); return false; } WorldSafeLocsEntry const* sg = sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_ALLIANCE); if (!sg || !AddSpiritGuide(WS_SPIRIT_MAIN_ALLIANCE, sg->x, sg->y, sg->z, 3.124139f, ALLIANCE)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "BatteGroundWS: Failed to spawn Alliance spirit guide! Battleground not created!"); + TC_LOG_ERROR("sql.sql", "BatteGroundWS: Failed to spawn Alliance spirit guide! Battleground not created!"); return false; } sg = sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_HORDE); if (!sg || !AddSpiritGuide(WS_SPIRIT_MAIN_HORDE, sg->x, sg->y, sg->z, 3.193953f, HORDE)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "BatteGroundWS: Failed to spawn Horde spirit guide! Battleground not created!"); + TC_LOG_ERROR("sql.sql", "BatteGroundWS: Failed to spawn Horde spirit guide! Battleground not created!"); return false; } - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "BatteGroundWS: BG objects and spirit guides spawned"); + TC_LOG_DEBUG("bg.battleground", "BatteGroundWS: BG objects and spirit guides spawned"); return true; } diff --git a/src/server/game/CMakeLists.txt b/src/server/game/CMakeLists.txt index f455610666e..be3997243e4 100644 --- a/src/server/game/CMakeLists.txt +++ b/src/server/game/CMakeLists.txt @@ -130,7 +130,6 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/Addons ${CMAKE_CURRENT_SOURCE_DIR}/AI ${CMAKE_CURRENT_SOURCE_DIR}/AI/CoreAI - ${CMAKE_CURRENT_SOURCE_DIR}/AI/EventAI ${CMAKE_CURRENT_SOURCE_DIR}/AI/ScriptedAI ${CMAKE_CURRENT_SOURCE_DIR}/AI/SmartScripts ${CMAKE_CURRENT_SOURCE_DIR}/AuctionHouse diff --git a/src/server/game/Calendar/CalendarMgr.cpp b/src/server/game/Calendar/CalendarMgr.cpp index 3272ded7829..5ac5e8fabee 100644 --- a/src/server/game/Calendar/CalendarMgr.cpp +++ b/src/server/game/Calendar/CalendarMgr.cpp @@ -34,7 +34,7 @@ CalendarEvent::~CalendarEvent() sCalendarMgr->FreeEventId(_eventId); } -CalendarMgr::CalendarMgr() { } +CalendarMgr::CalendarMgr() : _maxEventId(0), _maxInviteId(0) { } CalendarMgr::~CalendarMgr() { @@ -81,7 +81,7 @@ void CalendarMgr::LoadFromDB() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u calendar events", count); + TC_LOG_INFO("server.loading", ">> Loaded %u calendar events", count); count = 0; // 0 1 2 3 4 5 6 7 @@ -108,7 +108,7 @@ void CalendarMgr::LoadFromDB() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u calendar invites", count); + TC_LOG_INFO("server.loading", ">> Loaded %u calendar invites", count); for (uint64 i = 1; i < _maxEventId; ++i) if (!GetEvent(i)) @@ -282,7 +282,7 @@ CalendarEvent* CalendarMgr::GetEvent(uint64 eventId) const if ((*itr)->GetEventId() == eventId) return *itr; - TC_LOG_DEBUG(LOG_FILTER_CALENDAR, "CalendarMgr::GetEvent: [" UI64FMTD "] not found!", eventId); + TC_LOG_DEBUG("calendar", "CalendarMgr::GetEvent: [" UI64FMTD "] not found!", eventId); return NULL; } @@ -293,7 +293,7 @@ CalendarInvite* CalendarMgr::GetInvite(uint64 inviteId) const if ((*itr2)->GetInviteId() == inviteId) return *itr2; - TC_LOG_DEBUG(LOG_FILTER_CALENDAR, "CalendarMgr::GetInvite: [" UI64FMTD "] not found!", inviteId); + TC_LOG_DEBUG("calendar", "CalendarMgr::GetInvite: [" UI64FMTD "] not found!", inviteId); return NULL; } diff --git a/src/server/game/Chat/Channels/Channel.cpp b/src/server/game/Chat/Channels/Channel.cpp index 10af9f4fb1a..9e0747c3d11 100644 --- a/src/server/game/Chat/Channels/Channel.cpp +++ b/src/server/game/Chat/Channels/Channel.cpp @@ -83,7 +83,7 @@ Channel::Channel(std::string const& name, uint32 channelId, uint32 team): uint64 banned_guid = atol(*i); if (banned_guid) { - TC_LOG_DEBUG(LOG_FILTER_CHATSYS, "Channel(%s) loaded bannedStore guid:" UI64FMTD "", name.c_str(), banned_guid); + TC_LOG_DEBUG("chat.system", "Channel(%s) loaded bannedStore guid:" UI64FMTD "", name.c_str(), banned_guid); bannedStore.insert(banned_guid); } } @@ -95,7 +95,7 @@ Channel::Channel(std::string const& name, uint32 channelId, uint32 team): stmt->setString(0, name); stmt->setUInt32(1, _Team); CharacterDatabase.Execute(stmt); - TC_LOG_DEBUG(LOG_FILTER_CHATSYS, "Channel(%s) saved in database", name.c_str()); + TC_LOG_DEBUG("chat.system", "Channel(%s) saved in database", name.c_str()); } _IsSaved = true; @@ -123,7 +123,7 @@ void Channel::UpdateChannelInDB() const stmt->setUInt32(5, _Team); CharacterDatabase.Execute(stmt); - TC_LOG_DEBUG(LOG_FILTER_CHATSYS, "Channel(%s) updated in database", _name.c_str()); + TC_LOG_DEBUG("chat.system", "Channel(%s) updated in database", _name.c_str()); } } @@ -143,7 +143,7 @@ void Channel::CleanOldChannelsInDB() stmt->setUInt32(0, sWorld->getIntConfig(CONFIG_PRESERVE_CUSTOM_CHANNEL_DURATION) * DAY); CharacterDatabase.Execute(stmt); - TC_LOG_DEBUG(LOG_FILTER_CHATSYS, "Cleaned out unused custom chat channels."); + TC_LOG_DEBUG("chat.system", "Cleaned out unused custom chat channels."); } } @@ -527,7 +527,7 @@ void Channel::List(Player const* player) return; } - TC_LOG_DEBUG(LOG_FILTER_CHATSYS, "SMSG_CHANNEL_LIST %s Channel: %s", + TC_LOG_DEBUG("chat.system", "SMSG_CHANNEL_LIST %s Channel: %s", player->GetSession()->GetPlayerInfo().c_str(), GetName().c_str()); WorldPacket data(SMSG_CHANNEL_LIST, 1+(GetName().size()+1)+1+4+playersStore.size()*(8+1)); diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp index 6d806336315..99dd23aa649 100644 --- a/src/server/game/Chat/Chat.cpp +++ b/src/server/game/Chat/Chat.cpp @@ -412,12 +412,12 @@ bool ChatHandler::SetDataForCommandInTable(ChatCommand* table, char const* text, // expected subcommand by full name DB content else if (*text) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `command` have unexpected subcommand '%s' in command '%s', skip.", text, fullcommand.c_str()); + TC_LOG_ERROR("sql.sql", "Table `command` have unexpected subcommand '%s' in command '%s', skip.", text, fullcommand.c_str()); return false; } if (table[i].Permission != permission) - TC_LOG_INFO(LOG_FILTER_GENERAL, "Table `command` overwrite for command '%s' default permission (%u) by %u", fullcommand.c_str(), table[i].Permission, permission); + TC_LOG_INFO("misc", "Table `command` overwrite for command '%s' default permission (%u) by %u", fullcommand.c_str(), table[i].Permission, permission); table[i].Permission = permission; table[i].Help = help; @@ -428,9 +428,9 @@ bool ChatHandler::SetDataForCommandInTable(ChatCommand* table, char const* text, if (!cmd.empty()) { if (table == getCommandTable()) - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `command` have not existed command '%s', skip.", cmd.c_str()); + TC_LOG_ERROR("sql.sql", "Table `command` have not existed command '%s', skip.", cmd.c_str()); else - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `command` have not existed subcommand '%s' in command '%s', skip.", cmd.c_str(), fullcommand.c_str()); + TC_LOG_ERROR("sql.sql", "Table `command` have not existed subcommand '%s' in command '%s', skip.", cmd.c_str(), fullcommand.c_str()); } return false; diff --git a/src/server/game/Chat/ChatLink.cpp b/src/server/game/Chat/ChatLink.cpp index 3305492520b..dd602ea07ab 100644 --- a/src/server/game/Chat/ChatLink.cpp +++ b/src/server/game/Chat/ChatLink.cpp @@ -76,7 +76,7 @@ inline bool CheckDelimiter(std::istringstream& iss, char delimiter, const char* char c = iss.peek(); if (c != delimiter) { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): invalid %s link structure ('%c' expected, '%c' found)", iss.str().c_str(), context, delimiter, c); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): invalid %s link structure ('%c' expected, '%c' found)", iss.str().c_str(), context, delimiter, c); return false; } iss.ignore(1); @@ -110,20 +110,20 @@ bool ItemChatLink::Initialize(std::istringstream& iss) uint32 itemEntry = 0; if (!ReadUInt32(iss, itemEntry)) { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading item entry", iss.str().c_str()); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading item entry", iss.str().c_str()); return false; } // Validate item _item = sObjectMgr->GetItemTemplate(itemEntry); if (!_item) { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid itemEntry %u in |item command", iss.str().c_str(), itemEntry); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): got invalid itemEntry %u in |item command", iss.str().c_str(), itemEntry); return false; } // Validate item's color if (_color != ItemQualityColors[_item->Quality]) { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked item has color %u, but user claims %u", iss.str().c_str(), ItemQualityColors[_item->Quality], _color); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): linked item has color %u, but user claims %u", iss.str().c_str(), ItemQualityColors[_item->Quality], _color); return false; } // Number of various item properties after item entry @@ -137,7 +137,7 @@ bool ItemChatLink::Initialize(std::istringstream& iss) int32 id = 0; if (!ReadInt32(iss, id)) { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading item property (%u)", iss.str().c_str(), index); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading item property (%u)", iss.str().c_str(), index); return false; } if (id && (index == randomPropertyPosition)) @@ -148,7 +148,7 @@ bool ItemChatLink::Initialize(std::istringstream& iss) _property = sItemRandomPropertiesStore.LookupEntry(id); if (!_property) { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid item property id %u in |item command", iss.str().c_str(), id); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): got invalid item property id %u in |item command", iss.str().c_str(), id); return false; } } @@ -157,7 +157,7 @@ bool ItemChatLink::Initialize(std::istringstream& iss) _suffix = sItemRandomSuffixStore.LookupEntry(-id); if (!_suffix) { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid item suffix id %u in |item command", iss.str().c_str(), -id); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): got invalid item suffix id %u in |item command", iss.str().c_str(), -id); return false; } } @@ -199,7 +199,7 @@ bool ItemChatLink::ValidateName(char* buffer, const char* context) } } if (!res) - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked item (id: %u) name wasn't found in any localization", context, _item->ItemId); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): linked item (id: %u) name wasn't found in any localization", context, _item->ItemId); return res; } @@ -211,14 +211,14 @@ bool QuestChatLink::Initialize(std::istringstream& iss) uint32 questId = 0; if (!ReadUInt32(iss, questId)) { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading quest entry", iss.str().c_str()); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading quest entry", iss.str().c_str()); return false; } // Validate quest _quest = sObjectMgr->GetQuestTemplate(questId); if (!_quest) { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): quest template %u not found", iss.str().c_str(), questId); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): quest template %u not found", iss.str().c_str(), questId); return false; } // Check delimiter @@ -227,13 +227,13 @@ bool QuestChatLink::Initialize(std::istringstream& iss) // Read quest level if (!ReadInt32(iss, _questLevel)) { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading quest level", iss.str().c_str()); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading quest level", iss.str().c_str()); return false; } // Validate quest level if (_questLevel >= STRONG_MAX_LEVEL) { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): quest level %d is too big", iss.str().c_str(), _questLevel); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): quest level %d is too big", iss.str().c_str(), _questLevel); return false; } return true; @@ -253,7 +253,7 @@ bool QuestChatLink::ValidateName(char* buffer, const char* context) break; } if (!res) - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked quest (id: %u) title wasn't found in any localization", context, _quest->GetQuestId()); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): linked quest (id: %u) title wasn't found in any localization", context, _quest->GetQuestId()); return res; } @@ -267,14 +267,14 @@ bool SpellChatLink::Initialize(std::istringstream& iss) uint32 spellId = 0; if (!ReadUInt32(iss, spellId)) { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading spell entry", iss.str().c_str()); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading spell entry", iss.str().c_str()); return false; } // Validate spell _spell = sSpellMgr->GetSpellInfo(spellId); if (!_spell) { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |spell command", iss.str().c_str(), spellId); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |spell command", iss.str().c_str(), spellId); return false; } return true; @@ -290,19 +290,19 @@ bool SpellChatLink::ValidateName(char* buffer, const char* context) SkillLineAbilityMapBounds bounds = sSpellMgr->GetSkillLineAbilityMapBounds(_spell->Id); if (bounds.first == bounds.second) { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): skill line not found for spell %u", context, _spell->Id); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): skill line not found for spell %u", context, _spell->Id); return false; } SkillLineAbilityEntry const* skillInfo = bounds.first->second; if (!skillInfo) { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): skill line ability not found for spell %u", context, _spell->Id); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): skill line ability not found for spell %u", context, _spell->Id); return false; } SkillLineEntry const* skillLine = sSkillLineStore.LookupEntry(skillInfo->skillId); if (!skillLine) { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): skill line not found for skill %u", context, skillInfo->skillId); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): skill line not found for skill %u", context, skillInfo->skillId); return false; } @@ -323,7 +323,7 @@ bool SpellChatLink::ValidateName(char* buffer, const char* context) if (*_spell->SpellName[i] && strcmp(_spell->SpellName[i], buffer) == 0) return true; - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked spell (id: %u) name wasn't found in any localization", context, _spell->Id); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): linked spell (id: %u) name wasn't found in any localization", context, _spell->Id); return false; } @@ -337,14 +337,14 @@ bool AchievementChatLink::Initialize(std::istringstream& iss) uint32 achievementId = 0; if (!ReadUInt32(iss, achievementId)) { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading achievement entry", iss.str().c_str()); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading achievement entry", iss.str().c_str()); return false; } // Validate achievement _achievement = sAchievementMgr->GetAchievement(achievementId); if (!_achievement) { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid achivement id %u in |achievement command", iss.str().c_str(), achievementId); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): got invalid achivement id %u in |achievement command", iss.str().c_str(), achievementId); return false; } // Check delimiter @@ -353,7 +353,7 @@ bool AchievementChatLink::Initialize(std::istringstream& iss) // Read HEX if (!ReadHex(iss, _guid, 0)) { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): invalid hexadecimal number while reading char's guid", iss.str().c_str()); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): invalid hexadecimal number while reading char's guid", iss.str().c_str()); return false; } // Skip progress @@ -365,7 +365,7 @@ bool AchievementChatLink::Initialize(std::istringstream& iss) if (!ReadUInt32(iss, _data[index])) { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading achievement property (%u)", iss.str().c_str(), index); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading achievement property (%u)", iss.str().c_str(), index); return false; } } @@ -380,7 +380,7 @@ bool AchievementChatLink::ValidateName(char* buffer, const char* context) if (*_achievement->name[i] && strcmp(_achievement->name[i], buffer) == 0) return true; - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked achievement (id: %u) name wasn't found in any localization", context, _achievement->ID); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): linked achievement (id: %u) name wasn't found in any localization", context, _achievement->ID); return false; } @@ -394,14 +394,14 @@ bool TradeChatLink::Initialize(std::istringstream& iss) uint32 spellId = 0; if (!ReadUInt32(iss, spellId)) { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading achievement entry", iss.str().c_str()); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading achievement entry", iss.str().c_str()); return false; } // Validate spell _spell = sSpellMgr->GetSpellInfo(spellId); if (!_spell) { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |trade command", iss.str().c_str(), spellId); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |trade command", iss.str().c_str(), spellId); return false; } // Check delimiter @@ -410,7 +410,7 @@ bool TradeChatLink::Initialize(std::istringstream& iss) // Minimum talent level if (!ReadInt32(iss, _minSkillLevel)) { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading minimum talent level", iss.str().c_str()); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading minimum talent level", iss.str().c_str()); return false; } // Check delimiter @@ -419,7 +419,7 @@ bool TradeChatLink::Initialize(std::istringstream& iss) // Maximum talent level if (!ReadInt32(iss, _maxSkillLevel)) { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading maximum talent level", iss.str().c_str()); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading maximum talent level", iss.str().c_str()); return false; } // Check delimiter @@ -428,7 +428,7 @@ bool TradeChatLink::Initialize(std::istringstream& iss) // Something hexadecimal if (!ReadHex(iss, _guid, 0)) { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading achievement's owner guid", iss.str().c_str()); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading achievement's owner guid", iss.str().c_str()); return false; } // Skip base64 encoded stuff @@ -445,21 +445,21 @@ bool TalentChatLink::Initialize(std::istringstream& iss) // Read talent entry if (!ReadUInt32(iss, _talentId)) { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading talent entry", iss.str().c_str()); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading talent entry", iss.str().c_str()); return false; } // Validate talent TalentEntry const* talentInfo = sTalentStore.LookupEntry(_talentId); if (!talentInfo) { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid talent id %u in |talent command", iss.str().c_str(), _talentId); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): got invalid talent id %u in |talent command", iss.str().c_str(), _talentId); return false; } // Validate talent's spell _spell = sSpellMgr->GetSpellInfo(talentInfo->RankID[0]); if (!_spell) { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |trade command", iss.str().c_str(), talentInfo->RankID[0]); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |trade command", iss.str().c_str(), talentInfo->RankID[0]); return false; } // Delimiter @@ -468,7 +468,7 @@ bool TalentChatLink::Initialize(std::istringstream& iss) // Rank if (!ReadInt32(iss, _rankId)) { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading talent rank", iss.str().c_str()); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading talent rank", iss.str().c_str()); return false; } return true; @@ -484,14 +484,14 @@ bool EnchantmentChatLink::Initialize(std::istringstream& iss) uint32 spellId = 0; if (!ReadUInt32(iss, spellId)) { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading enchantment spell entry", iss.str().c_str()); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading enchantment spell entry", iss.str().c_str()); return false; } // Validate spell _spell = sSpellMgr->GetSpellInfo(spellId); if (!_spell) { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |enchant command", iss.str().c_str(), spellId); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |enchant command", iss.str().c_str(), spellId); return false; } return true; @@ -506,7 +506,7 @@ bool GlyphChatLink::Initialize(std::istringstream& iss) // Slot if (!ReadUInt32(iss, _slotId)) { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading slot id", iss.str().c_str()); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading slot id", iss.str().c_str()); return false; } // Check delimiter @@ -516,21 +516,21 @@ bool GlyphChatLink::Initialize(std::istringstream& iss) uint32 glyphId = 0; if (!ReadUInt32(iss, glyphId)) { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading glyph entry", iss.str().c_str()); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading glyph entry", iss.str().c_str()); return false; } // Validate glyph _glyph = sGlyphPropertiesStore.LookupEntry(glyphId); if (!_glyph) { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid glyph id %u in |glyph command", iss.str().c_str(), glyphId); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): got invalid glyph id %u in |glyph command", iss.str().c_str(), glyphId); return false; } // Validate glyph's spell _spell = sSpellMgr->GetSpellInfo(_glyph->SpellId); if (!_spell) { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |glyph command", iss.str().c_str(), _glyph->SpellId); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |glyph command", iss.str().c_str(), _glyph->SpellId); return false; } return true; @@ -566,14 +566,14 @@ bool LinkExtractor::IsValidMessage() } else if (_iss.get() != PIPE_CHAR) { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence aborted unexpectedly", _iss.str().c_str()); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): sequence aborted unexpectedly", _iss.str().c_str()); return false; } // pipe has always to be followed by at least one char if (_iss.peek() == '\0') { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): pipe followed by '\\0'", _iss.str().c_str()); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): pipe followed by '\\0'", _iss.str().c_str()); return false; } @@ -596,14 +596,14 @@ bool LinkExtractor::IsValidMessage() } else { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): invalid sequence, expected '%c' but got '%c'", _iss.str().c_str(), *validSequenceIterator, commandChar); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): invalid sequence, expected '%c' but got '%c'", _iss.str().c_str(), *validSequenceIterator, commandChar); return false; } } else if (validSequence != validSequenceIterator) { // no escaped pipes in sequences - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got escaped pipe in sequence", _iss.str().c_str()); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): got escaped pipe in sequence", _iss.str().c_str()); return false; } @@ -612,7 +612,7 @@ bool LinkExtractor::IsValidMessage() case 'c': if (!ReadHex(_iss, color, 8)) { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): invalid hexadecimal number while reading color", _iss.str().c_str()); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): invalid hexadecimal number while reading color", _iss.str().c_str()); return false; } break; @@ -621,7 +621,7 @@ bool LinkExtractor::IsValidMessage() _iss.getline(buffer, 256, DELIMITER); if (_iss.eof()) { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly", _iss.str().c_str()); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly", _iss.str().c_str()); return false; } @@ -643,7 +643,7 @@ bool LinkExtractor::IsValidMessage() link = new GlyphChatLink(); else { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): user sent unsupported link type '%s'", _iss.str().c_str(), buffer); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): user sent unsupported link type '%s'", _iss.str().c_str(), buffer); return false; } _links.push_back(link); @@ -658,13 +658,13 @@ bool LinkExtractor::IsValidMessage() // links start with '[' if (_iss.get() != '[') { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): link caption doesn't start with '['", _iss.str().c_str()); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): link caption doesn't start with '['", _iss.str().c_str()); return false; } _iss.getline(buffer, 256, ']'); if (_iss.eof()) { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly", _iss.str().c_str()); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly", _iss.str().c_str()); return false; } @@ -682,7 +682,7 @@ bool LinkExtractor::IsValidMessage() // no further payload break; default: - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid command |%c", _iss.str().c_str(), commandChar); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): got invalid command |%c", _iss.str().c_str(), commandChar); return false; } } @@ -690,7 +690,7 @@ bool LinkExtractor::IsValidMessage() // check if every opened sequence was also closed properly if (validSequence != validSequenceIterator) { - TC_LOG_TRACE(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): EOF in active sequence", _iss.str().c_str()); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): EOF in active sequence", _iss.str().c_str()); return false; } diff --git a/src/server/game/Chat/ChatLink.h b/src/server/game/Chat/ChatLink.h index 57785fbe1a0..c77fcf7ad76 100644 --- a/src/server/game/Chat/ChatLink.h +++ b/src/server/game/Chat/ChatLink.h @@ -56,7 +56,10 @@ protected: class ItemChatLink : public ChatLink { public: - ItemChatLink() : ChatLink(), _item(NULL), _suffix(NULL), _property(NULL) { } + ItemChatLink() : ChatLink(), _item(NULL), _suffix(NULL), _property(NULL) + { + memset(_data, 0, sizeof(_data)); + } virtual bool Initialize(std::istringstream& iss); virtual bool ValidateName(char* buffer, const char* context); @@ -98,7 +101,10 @@ protected: class AchievementChatLink : public ChatLink { public: - AchievementChatLink() : ChatLink(), _guid(0), _achievement(NULL) { } + AchievementChatLink() : ChatLink(), _guid(0), _achievement(NULL) + { + memset(_data, 0, sizeof(_data)); + } virtual bool Initialize(std::istringstream& iss); virtual bool ValidateName(char* buffer, const char* context); diff --git a/src/server/game/Combat/UnitEvents.h b/src/server/game/Combat/UnitEvents.h index 0e568d139a8..8bb7d95a384 100644 --- a/src/server/game/Combat/UnitEvents.h +++ b/src/server/game/Combat/UnitEvents.h @@ -93,13 +93,13 @@ class ThreatRefStatusChangeEvent : public UnitBaseEvent }; ThreatManager* iThreatManager; public: - ThreatRefStatusChangeEvent(uint32 pType) : UnitBaseEvent(pType) { iHostileReference = NULL; } + ThreatRefStatusChangeEvent(uint32 pType) : UnitBaseEvent(pType), iThreatManager(NULL) { iHostileReference = NULL; } - ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference) : UnitBaseEvent(pType) { iHostileReference = pHostileReference; } + ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference) : UnitBaseEvent(pType), iThreatManager(NULL) { iHostileReference = pHostileReference; } - ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference, float pValue) : UnitBaseEvent(pType) { iHostileReference = pHostileReference; iFValue = pValue; } + ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference, float pValue) : UnitBaseEvent(pType), iThreatManager(NULL) { iHostileReference = pHostileReference; iFValue = pValue; } - ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference, bool pValue) : UnitBaseEvent(pType) { iHostileReference = pHostileReference; iBValue = pValue; } + ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference, bool pValue) : UnitBaseEvent(pType), iThreatManager(NULL) { iHostileReference = pHostileReference; iBValue = pValue; } int32 getIValue() const { return iIValue; } diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index f6d6c47e96f..2160fbdd173 100644 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -38,7 +38,7 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) // object not present, return false if (!object) { - TC_LOG_DEBUG(LOG_FILTER_CONDITIONSYS, "Condition object not found for condition (Entry: %u Type: %u Group: %u)", SourceEntry, SourceType, SourceGroup); + TC_LOG_DEBUG("condition", "Condition object not found for condition (Entry: %u Type: %u Group: %u)", SourceEntry, SourceType, SourceGroup); return false; } bool condMeets = false; @@ -577,7 +577,7 @@ bool ConditionMgr::IsObjectMeetToConditionList(ConditionSourceInfo& sourceInfo, std::map<uint32, bool> ElseGroupStore; for (ConditionList::const_iterator i = conditions.begin(); i != conditions.end(); ++i) { - TC_LOG_DEBUG(LOG_FILTER_CONDITIONSYS, "ConditionMgr::IsPlayerMeetToConditionList condType: %u val1: %u", (*i)->ConditionType, (*i)->ConditionValue1); + TC_LOG_DEBUG("condition", "ConditionMgr::IsPlayerMeetToConditionList condType: %u val1: %u", (*i)->ConditionType, (*i)->ConditionValue1); if ((*i)->isLoaded()) { //! Find ElseGroup in ElseGroupStore @@ -598,7 +598,7 @@ bool ConditionMgr::IsObjectMeetToConditionList(ConditionSourceInfo& sourceInfo, } else { - TC_LOG_DEBUG(LOG_FILTER_CONDITIONSYS, "IsPlayerMeetToConditionList: Reference template -%u not found", + TC_LOG_DEBUG("condition", "IsPlayerMeetToConditionList: Reference template -%u not found", (*i)->ReferenceId);//checked at loading, should never happen } @@ -634,7 +634,7 @@ bool ConditionMgr::IsObjectMeetToConditions(ConditionSourceInfo& sourceInfo, Con if (conditions.empty()) return true; - TC_LOG_DEBUG(LOG_FILTER_CONDITIONSYS, "ConditionMgr::IsObjectMeetToConditions"); + TC_LOG_DEBUG("condition", "ConditionMgr::IsObjectMeetToConditions"); return IsObjectMeetToConditionList(sourceInfo, conditions); } @@ -678,7 +678,7 @@ ConditionList ConditionMgr::GetConditionsForNotGroupedEntry(ConditionSourceType if (i != (*itr).second.end()) { spellCond = (*i).second; - TC_LOG_DEBUG(LOG_FILTER_CONDITIONSYS, "GetConditionsForNotGroupedEntry: found conditions for type %u and entry %u", uint32(sourceType), entry); + TC_LOG_DEBUG("condition", "GetConditionsForNotGroupedEntry: found conditions for type %u and entry %u", uint32(sourceType), entry); } } } @@ -695,7 +695,7 @@ ConditionList ConditionMgr::GetConditionsForSpellClickEvent(uint32 creatureId, u if (i != (*itr).second.end()) { cond = (*i).second; - TC_LOG_DEBUG(LOG_FILTER_CONDITIONSYS, "GetConditionsForSpellClickEvent: found conditions for Vehicle entry %u spell %u", creatureId, spellId); + TC_LOG_DEBUG("condition", "GetConditionsForSpellClickEvent: found conditions for Vehicle entry %u spell %u", creatureId, spellId); } } return cond; @@ -711,7 +711,7 @@ ConditionList ConditionMgr::GetConditionsForVehicleSpell(uint32 creatureId, uint if (i != (*itr).second.end()) { cond = (*i).second; - TC_LOG_DEBUG(LOG_FILTER_CONDITIONSYS, "GetConditionsForVehicleSpell: found conditions for Vehicle entry %u spell %u", creatureId, spellId); + TC_LOG_DEBUG("condition", "GetConditionsForVehicleSpell: found conditions for Vehicle entry %u spell %u", creatureId, spellId); } } return cond; @@ -727,7 +727,7 @@ ConditionList ConditionMgr::GetConditionsForSmartEvent(int32 entryOrGuid, uint32 if (i != (*itr).second.end()) { cond = (*i).second; - TC_LOG_DEBUG(LOG_FILTER_CONDITIONSYS, "GetConditionsForSmartEvent: found conditions for Smart Event entry or guid %d event_id %u", entryOrGuid, eventId); + TC_LOG_DEBUG("condition", "GetConditionsForSmartEvent: found conditions for Smart Event entry or guid %d event_id %u", entryOrGuid, eventId); } } return cond; @@ -743,7 +743,7 @@ ConditionList ConditionMgr::GetConditionsForNpcVendorEvent(uint32 creatureId, ui if (i != (*itr).second.end()) { cond = (*i).second; - TC_LOG_DEBUG(LOG_FILTER_CONDITIONSYS, "GetConditionsForNpcVendorEvent: found conditions for creature entry %u item %u", creatureId, itemId); + TC_LOG_DEBUG("condition", "GetConditionsForNpcVendorEvent: found conditions for creature entry %u item %u", creatureId, itemId); } } return cond; @@ -758,7 +758,7 @@ void ConditionMgr::LoadConditions(bool isReload) //must clear all custom handled cases (groupped types) before reload if (isReload) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Reseting Loot Conditions..."); + TC_LOG_INFO("misc", "Reseting Loot Conditions..."); LootTemplates_Creature.ResetConditions(); LootTemplates_Fishing.ResetConditions(); LootTemplates_Gameobject.ResetConditions(); @@ -772,10 +772,10 @@ void ConditionMgr::LoadConditions(bool isReload) LootTemplates_Prospecting.ResetConditions(); LootTemplates_Spell.ResetConditions(); - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading `gossip_menu` Table for Conditions!"); + TC_LOG_INFO("misc", "Re-Loading `gossip_menu` Table for Conditions!"); sObjectMgr->LoadGossipMenu(); - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading `gossip_menu_option` Table for Conditions!"); + TC_LOG_INFO("misc", "Re-Loading `gossip_menu_option` Table for Conditions!"); sObjectMgr->LoadGossipMenuItems(); sSpellMgr->UnloadSpellInfoImplicitTargetConditionLists(); } @@ -785,7 +785,7 @@ void ConditionMgr::LoadConditions(bool isReload) if (!result) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 conditions. DB table `conditions` is empty!"); + TC_LOG_ERROR("server.loading", ">> Loaded 0 conditions. DB table `conditions` is empty!"); return; } @@ -821,7 +821,7 @@ void ConditionMgr::LoadConditions(bool isReload) { if (iConditionTypeOrReference == iSourceTypeOrReferenceId)//self referencing, skip { - TC_LOG_ERROR(LOG_FILTER_SQL, "Condition reference %i is referencing self, skipped", iSourceTypeOrReferenceId); + TC_LOG_ERROR("sql.sql", "Condition reference %i is referencing self, skipped", iSourceTypeOrReferenceId); delete cond; continue; } @@ -832,19 +832,19 @@ void ConditionMgr::LoadConditions(bool isReload) rowType = "reference"; //check for useless data if (cond->ConditionTarget) - TC_LOG_ERROR(LOG_FILTER_SQL, "Condition %s %i has useless data in ConditionTarget (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionTarget); + TC_LOG_ERROR("sql.sql", "Condition %s %i has useless data in ConditionTarget (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionTarget); if (cond->ConditionValue1) - TC_LOG_ERROR(LOG_FILTER_SQL, "Condition %s %i has useless data in value1 (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionValue1); + TC_LOG_ERROR("sql.sql", "Condition %s %i has useless data in value1 (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionValue1); if (cond->ConditionValue2) - TC_LOG_ERROR(LOG_FILTER_SQL, "Condition %s %i has useless data in value2 (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionValue2); + TC_LOG_ERROR("sql.sql", "Condition %s %i has useless data in value2 (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionValue2); if (cond->ConditionValue3) - TC_LOG_ERROR(LOG_FILTER_SQL, "Condition %s %i has useless data in value3 (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionValue3); + TC_LOG_ERROR("sql.sql", "Condition %s %i has useless data in value3 (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionValue3); if (cond->NegativeCondition) - TC_LOG_ERROR(LOG_FILTER_SQL, "Condition %s %i has useless data in NegativeCondition (%u)!", rowType, iSourceTypeOrReferenceId, cond->NegativeCondition); + TC_LOG_ERROR("sql.sql", "Condition %s %i has useless data in NegativeCondition (%u)!", rowType, iSourceTypeOrReferenceId, cond->NegativeCondition); if (cond->SourceGroup && iSourceTypeOrReferenceId < 0) - TC_LOG_ERROR(LOG_FILTER_SQL, "Condition %s %i has useless data in SourceGroup (%u)!", rowType, iSourceTypeOrReferenceId, cond->SourceGroup); + TC_LOG_ERROR("sql.sql", "Condition %s %i has useless data in SourceGroup (%u)!", rowType, iSourceTypeOrReferenceId, cond->SourceGroup); if (cond->SourceEntry && iSourceTypeOrReferenceId < 0) - TC_LOG_ERROR(LOG_FILTER_SQL, "Condition %s %i has useless data in SourceEntry (%u)!", rowType, iSourceTypeOrReferenceId, cond->SourceEntry); + TC_LOG_ERROR("sql.sql", "Condition %s %i has useless data in SourceEntry (%u)!", rowType, iSourceTypeOrReferenceId, cond->SourceEntry); } else if (!isConditionTypeValid(cond))//doesn't have reference, validate ConditionType { @@ -875,26 +875,26 @@ void ConditionMgr::LoadConditions(bool isReload) //Grouping is only allowed for some types (loot templates, gossip menus, gossip items) if (cond->SourceGroup && !CanHaveSourceGroupSet(cond->SourceType)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Condition type %u has not allowed value of SourceGroup = %u!", uint32(cond->SourceType), cond->SourceGroup); + TC_LOG_ERROR("sql.sql", "Condition type %u has not allowed value of SourceGroup = %u!", uint32(cond->SourceType), cond->SourceGroup); delete cond; continue; } if (cond->SourceId && !CanHaveSourceIdSet(cond->SourceType)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Condition type %u has not allowed value of SourceId = %u!", uint32(cond->SourceType), cond->SourceId); + TC_LOG_ERROR("sql.sql", "Condition type %u has not allowed value of SourceId = %u!", uint32(cond->SourceType), cond->SourceId); delete cond; continue; } if (cond->ErrorType && cond->SourceType != CONDITION_SOURCE_TYPE_SPELL) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Condition type %u entry %i can't have ErrorType (%u), set to 0!", uint32(cond->SourceType), cond->SourceEntry, cond->ErrorType); + TC_LOG_ERROR("sql.sql", "Condition type %u entry %i can't have ErrorType (%u), set to 0!", uint32(cond->SourceType), cond->SourceEntry, cond->ErrorType); cond->ErrorType = 0; } if (cond->ErrorTextId && !cond->ErrorType) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Condition type %u entry %i has any ErrorType, ErrorTextId (%u) is set, set to 0!", uint32(cond->SourceType), cond->SourceEntry, cond->ErrorTextId); + TC_LOG_ERROR("sql.sql", "Condition type %u entry %i has any ErrorType, ErrorTextId (%u) is set, set to 0!", uint32(cond->SourceType), cond->SourceEntry, cond->ErrorTextId); cond->ErrorTextId = 0; } @@ -985,7 +985,7 @@ void ConditionMgr::LoadConditions(bool isReload) if (!valid) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Not handled grouped condition, SourceGroup %u", cond->SourceGroup); + TC_LOG_ERROR("sql.sql", "Not handled grouped condition, SourceGroup %u", cond->SourceGroup); delete cond; } else @@ -1017,7 +1017,7 @@ void ConditionMgr::LoadConditions(bool isReload) } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -1025,14 +1025,14 @@ bool ConditionMgr::addToLootTemplate(Condition* cond, LootTemplate* loot) { if (!loot) { - TC_LOG_ERROR(LOG_FILTER_SQL, "ConditionMgr: LootTemplate %u not found", cond->SourceGroup); + TC_LOG_ERROR("sql.sql", "ConditionMgr: LootTemplate %u not found", cond->SourceGroup); return false; } if (loot->addConditionItem(cond)) return true; - TC_LOG_ERROR(LOG_FILTER_SQL, "ConditionMgr: Item %u not found in LootTemplate %u", cond->SourceEntry, cond->SourceGroup); + TC_LOG_ERROR("sql.sql", "ConditionMgr: Item %u not found in LootTemplate %u", cond->SourceEntry, cond->SourceGroup); return false; } @@ -1052,7 +1052,7 @@ bool ConditionMgr::addToGossipMenus(Condition* cond) } } - TC_LOG_ERROR(LOG_FILTER_SQL, "addToGossipMenus: GossipMenu %u not found", cond->SourceGroup); + TC_LOG_ERROR("sql.sql", "addToGossipMenus: GossipMenu %u not found", cond->SourceGroup); return false; } @@ -1071,7 +1071,7 @@ bool ConditionMgr::addToGossipMenuItems(Condition* cond) } } - TC_LOG_ERROR(LOG_FILTER_SQL, "addToGossipMenuItems: GossipMenuId %u Item %u not found", cond->SourceGroup, cond->SourceEntry); + TC_LOG_ERROR("sql.sql", "addToGossipMenuItems: GossipMenuId %u Item %u not found", cond->SourceGroup, cond->SourceEntry); return false; } @@ -1129,7 +1129,7 @@ bool ConditionMgr::addToSpellImplicitTargetConditions(Condition* cond) // we have overlapping masks in db if (conditionEffMask != *itr) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, has incorrect SourceGroup %u (spell effectMask) set - " + TC_LOG_ERROR("sql.sql", "SourceEntry %u in `condition` table, has incorrect SourceGroup %u (spell effectMask) set - " "effect masks are overlapping (all SourceGroup values having given bit set must be equal) - ignoring.", cond->SourceEntry, cond->SourceGroup); return false; } @@ -1163,7 +1163,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) { if (cond->SourceType == CONDITION_SOURCE_TYPE_NONE || cond->SourceType >= CONDITION_SOURCE_TYPE_MAX) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Invalid ConditionSourceType %u in `condition` table, ignoring.", uint32(cond->SourceType)); + TC_LOG_ERROR("sql.sql", "Invalid ConditionSourceType %u in `condition` table, ignoring.", uint32(cond->SourceType)); return false; } @@ -1173,7 +1173,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) { if (!LootTemplates_Creature.HaveLootFor(cond->SourceGroup)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `creature_loot_template`, ignoring.", cond->SourceGroup); + TC_LOG_ERROR("sql.sql", "SourceGroup %u in `condition` table, does not exist in `creature_loot_template`, ignoring.", cond->SourceGroup); return false; } @@ -1181,7 +1181,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); + TC_LOG_ERROR("sql.sql", "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; @@ -1190,7 +1190,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) { if (!LootTemplates_Disenchant.HaveLootFor(cond->SourceGroup)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `disenchant_loot_template`, ignoring.", cond->SourceGroup); + TC_LOG_ERROR("sql.sql", "SourceGroup %u in `condition` table, does not exist in `disenchant_loot_template`, ignoring.", cond->SourceGroup); return false; } @@ -1198,7 +1198,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); + TC_LOG_ERROR("sql.sql", "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; @@ -1207,7 +1207,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) { if (!LootTemplates_Fishing.HaveLootFor(cond->SourceGroup)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `fishing_loot_template`, ignoring.", cond->SourceGroup); + TC_LOG_ERROR("sql.sql", "SourceGroup %u in `condition` table, does not exist in `fishing_loot_template`, ignoring.", cond->SourceGroup); return false; } @@ -1215,7 +1215,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); + TC_LOG_ERROR("sql.sql", "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; @@ -1224,7 +1224,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) { if (!LootTemplates_Gameobject.HaveLootFor(cond->SourceGroup)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `gameobject_loot_template`, ignoring.", cond->SourceGroup); + TC_LOG_ERROR("sql.sql", "SourceGroup %u in `condition` table, does not exist in `gameobject_loot_template`, ignoring.", cond->SourceGroup); return false; } @@ -1232,7 +1232,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); + TC_LOG_ERROR("sql.sql", "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; @@ -1241,7 +1241,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) { if (!LootTemplates_Item.HaveLootFor(cond->SourceGroup)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `item_loot_template`, ignoring.", cond->SourceGroup); + TC_LOG_ERROR("sql.sql", "SourceGroup %u in `condition` table, does not exist in `item_loot_template`, ignoring.", cond->SourceGroup); return false; } @@ -1249,7 +1249,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); + TC_LOG_ERROR("sql.sql", "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; @@ -1258,7 +1258,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) { if (!LootTemplates_Mail.HaveLootFor(cond->SourceGroup)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `mail_loot_template`, ignoring.", cond->SourceGroup); + TC_LOG_ERROR("sql.sql", "SourceGroup %u in `condition` table, does not exist in `mail_loot_template`, ignoring.", cond->SourceGroup); return false; } @@ -1266,7 +1266,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); + TC_LOG_ERROR("sql.sql", "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; @@ -1275,7 +1275,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) { if (!LootTemplates_Milling.HaveLootFor(cond->SourceGroup)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `milling_loot_template`, ignoring.", cond->SourceGroup); + TC_LOG_ERROR("sql.sql", "SourceGroup %u in `condition` table, does not exist in `milling_loot_template`, ignoring.", cond->SourceGroup); return false; } @@ -1283,7 +1283,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); + TC_LOG_ERROR("sql.sql", "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; @@ -1292,7 +1292,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) { if (!LootTemplates_Pickpocketing.HaveLootFor(cond->SourceGroup)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `pickpocketing_loot_template`, ignoring.", cond->SourceGroup); + TC_LOG_ERROR("sql.sql", "SourceGroup %u in `condition` table, does not exist in `pickpocketing_loot_template`, ignoring.", cond->SourceGroup); return false; } @@ -1300,7 +1300,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); + TC_LOG_ERROR("sql.sql", "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; @@ -1309,7 +1309,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) { if (!LootTemplates_Prospecting.HaveLootFor(cond->SourceGroup)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `prospecting_loot_template`, ignoring.", cond->SourceGroup); + TC_LOG_ERROR("sql.sql", "SourceGroup %u in `condition` table, does not exist in `prospecting_loot_template`, ignoring.", cond->SourceGroup); return false; } @@ -1317,7 +1317,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); + TC_LOG_ERROR("sql.sql", "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; @@ -1326,7 +1326,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) { if (!LootTemplates_Reference.HaveLootFor(cond->SourceGroup)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `reference_loot_template`, ignoring.", cond->SourceGroup); + TC_LOG_ERROR("sql.sql", "SourceGroup %u in `condition` table, does not exist in `reference_loot_template`, ignoring.", cond->SourceGroup); return false; } @@ -1334,7 +1334,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); + TC_LOG_ERROR("sql.sql", "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; @@ -1343,7 +1343,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) { if (!LootTemplates_Skinning.HaveLootFor(cond->SourceGroup)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `skinning_loot_template`, ignoring.", cond->SourceGroup); + TC_LOG_ERROR("sql.sql", "SourceGroup %u in `condition` table, does not exist in `skinning_loot_template`, ignoring.", cond->SourceGroup); return false; } @@ -1351,7 +1351,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); + TC_LOG_ERROR("sql.sql", "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; @@ -1360,7 +1360,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) { if (!LootTemplates_Spell.HaveLootFor(cond->SourceGroup)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `spell_loot_template`, ignoring.", cond->SourceGroup); + TC_LOG_ERROR("sql.sql", "SourceGroup %u in `condition` table, does not exist in `spell_loot_template`, ignoring.", cond->SourceGroup); return false; } @@ -1368,7 +1368,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); + TC_LOG_ERROR("sql.sql", "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; @@ -1378,13 +1378,13 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(cond->SourceEntry); if (!spellInfo) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry); + TC_LOG_ERROR("sql.sql", "SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry); return false; } if ((cond->SourceGroup > MAX_EFFECT_MASK) || !cond->SourceGroup) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, has incorrect SourceGroup %u (spell effectMask) set, ignoring.", cond->SourceEntry, cond->SourceGroup); + TC_LOG_ERROR("sql.sql", "SourceEntry %u in `condition` table, has incorrect SourceGroup %u (spell effectMask) set, ignoring.", cond->SourceEntry, cond->SourceGroup); return false; } @@ -1415,7 +1415,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) break; } - TC_LOG_ERROR(LOG_FILTER_SQL, "SourceEntry %u SourceGroup %u in `condition` table - spell %u does not have implicit targets of types: _AREA_, _CONE_, _NEARBY_ for effect %u, SourceGroup needs correction, ignoring.", cond->SourceEntry, origGroup, cond->SourceEntry, uint32(i)); + TC_LOG_ERROR("sql.sql", "SourceEntry %u SourceGroup %u in `condition` table - spell %u does not have implicit targets of types: _AREA_, _CONE_, _NEARBY_ for effect %u, SourceGroup needs correction, ignoring.", cond->SourceEntry, origGroup, cond->SourceEntry, uint32(i)); cond->SourceGroup &= ~(1<<i); } // all effects were removed, no need to add the condition at all @@ -1427,7 +1427,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) { if (!sObjectMgr->GetCreatureTemplate(cond->SourceEntry)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->SourceEntry); + TC_LOG_ERROR("sql.sql", "SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->SourceEntry); return false; } break; @@ -1438,7 +1438,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(cond->SourceEntry); if (!spellProto) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry); + TC_LOG_ERROR("sql.sql", "SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry); return false; } break; @@ -1446,40 +1446,40 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) case CONDITION_SOURCE_TYPE_QUEST_ACCEPT: if (!sObjectMgr->GetQuestTemplate(cond->SourceEntry)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "CONDITION_SOURCE_TYPE_QUEST_ACCEPT specifies non-existing quest (%u), skipped", cond->SourceEntry); + TC_LOG_ERROR("sql.sql", "CONDITION_SOURCE_TYPE_QUEST_ACCEPT specifies non-existing quest (%u), skipped", cond->SourceEntry); return false; } break; case CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK: if (!sObjectMgr->GetQuestTemplate(cond->SourceEntry)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK specifies non-existing quest (%u), skipped", cond->SourceEntry); + TC_LOG_ERROR("sql.sql", "CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK specifies non-existing quest (%u), skipped", cond->SourceEntry); return false; } break; case CONDITION_SOURCE_TYPE_VEHICLE_SPELL: if (!sObjectMgr->GetCreatureTemplate(cond->SourceGroup)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->SourceGroup); + TC_LOG_ERROR("sql.sql", "SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->SourceGroup); return false; } if (!sSpellMgr->GetSpellInfo(cond->SourceEntry)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry); + TC_LOG_ERROR("sql.sql", "SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry); return false; } break; case CONDITION_SOURCE_TYPE_SPELL_CLICK_EVENT: if (!sObjectMgr->GetCreatureTemplate(cond->SourceGroup)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->SourceGroup); + TC_LOG_ERROR("sql.sql", "SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->SourceGroup); return false; } if (!sSpellMgr->GetSpellInfo(cond->SourceEntry)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry); + TC_LOG_ERROR("sql.sql", "SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry); return false; } break; @@ -1487,20 +1487,20 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) { if (!sObjectMgr->GetCreatureTemplate(cond->SourceGroup)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->SourceGroup); + TC_LOG_ERROR("sql.sql", "SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->SourceGroup); return false; } ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(cond->SourceEntry); if (!itemTemplate) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceEntry); + TC_LOG_ERROR("sql.sql", "SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceEntry); return false; } break; } case CONDITION_SOURCE_TYPE_PHASE_DEFINITION: { - TC_LOG_ERROR(LOG_FILTER_SQL, "CONDITION_SOURCE_TYPE_PHASE_DEFINITION:: is only for 4.3.4 branch, skipped"); + TC_LOG_ERROR("sql.sql", "CONDITION_SOURCE_TYPE_PHASE_DEFINITION:: is only for 4.3.4 branch, skipped"); return false; } case CONDITION_SOURCE_TYPE_GOSSIP_MENU: @@ -1518,13 +1518,13 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) { if (cond->ConditionType == CONDITION_NONE || cond->ConditionType >= CONDITION_MAX) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Invalid ConditionType %u at SourceEntry %u in `condition` table, ignoring.", uint32(cond->ConditionType), cond->SourceEntry); + TC_LOG_ERROR("sql.sql", "Invalid ConditionType %u at SourceEntry %u in `condition` table, ignoring.", uint32(cond->ConditionType), cond->SourceEntry); return false; } if (cond->ConditionTarget >= cond->GetMaxAvailableConditionTargets()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u, SourceGroup %u in `condition` table, has incorrect ConditionTarget set, ignoring.", cond->SourceType, cond->SourceEntry, cond->SourceGroup); + TC_LOG_ERROR("sql.sql", "SourceType %u, SourceEntry %u, SourceGroup %u in `condition` table, has incorrect ConditionTarget set, ignoring.", cond->SourceType, cond->SourceEntry, cond->SourceGroup); return false; } @@ -1534,17 +1534,17 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) { if (!sSpellMgr->GetSpellInfo(cond->ConditionValue1)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Aura condition has non existing spell (Id: %d), skipped", cond->ConditionValue1); + TC_LOG_ERROR("sql.sql", "Aura condition has non existing spell (Id: %d), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue2 > EFFECT_2) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Aura condition has non existing effect index (%u) (must be 0..2), skipped", cond->ConditionValue2); + TC_LOG_ERROR("sql.sql", "Aura condition has non existing effect index (%u) (must be 0..2), skipped", cond->ConditionValue2); return false; } if (cond->ConditionValue3) - TC_LOG_ERROR(LOG_FILTER_SQL, "Aura condition has useless data in value3 (%u)!", cond->ConditionValue3); + TC_LOG_ERROR("sql.sql", "Aura condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_ITEM: @@ -1552,13 +1552,13 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) ItemTemplate const* proto = sObjectMgr->GetItemTemplate(cond->ConditionValue1); if (!proto) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item condition has non existing item (%u), skipped", cond->ConditionValue1); + TC_LOG_ERROR("sql.sql", "Item condition has non existing item (%u), skipped", cond->ConditionValue1); return false; } if (!cond->ConditionValue2) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item condition has 0 set for item count in value2 (%u), skipped", cond->ConditionValue2); + TC_LOG_ERROR("sql.sql", "Item condition has 0 set for item count in value2 (%u), skipped", cond->ConditionValue2); return false; } break; @@ -1568,14 +1568,14 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) ItemTemplate const* proto = sObjectMgr->GetItemTemplate(cond->ConditionValue1); if (!proto) { - TC_LOG_ERROR(LOG_FILTER_SQL, "ItemEquipped condition has non existing item (%u), skipped", cond->ConditionValue1); + TC_LOG_ERROR("sql.sql", "ItemEquipped condition has non existing item (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue2) - TC_LOG_ERROR(LOG_FILTER_SQL, "ItemEquipped condition has useless data in value2 (%u)!", cond->ConditionValue2); + TC_LOG_ERROR("sql.sql", "ItemEquipped condition has useless data in value2 (%u)!", cond->ConditionValue2); if (cond->ConditionValue3) - TC_LOG_ERROR(LOG_FILTER_SQL, "ItemEquipped condition has useless data in value3 (%u)!", cond->ConditionValue3); + TC_LOG_ERROR("sql.sql", "ItemEquipped condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_ZONEID: @@ -1583,20 +1583,20 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(cond->ConditionValue1); if (!areaEntry) { - TC_LOG_ERROR(LOG_FILTER_SQL, "ZoneID condition has non existing area (%u), skipped", cond->ConditionValue1); + TC_LOG_ERROR("sql.sql", "ZoneID condition has non existing area (%u), skipped", cond->ConditionValue1); return false; } if (areaEntry->zone != 0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "ZoneID condition requires to be in area (%u) which is a subzone but zone expected, skipped", cond->ConditionValue1); + TC_LOG_ERROR("sql.sql", "ZoneID condition requires to be in area (%u) which is a subzone but zone expected, skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue2) - TC_LOG_ERROR(LOG_FILTER_SQL, "ZoneID condition has useless data in value2 (%u)!", cond->ConditionValue2); + TC_LOG_ERROR("sql.sql", "ZoneID condition has useless data in value2 (%u)!", cond->ConditionValue2); if (cond->ConditionValue3) - TC_LOG_ERROR(LOG_FILTER_SQL, "ZoneID condition has useless data in value3 (%u)!", cond->ConditionValue3); + TC_LOG_ERROR("sql.sql", "ZoneID condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_REPUTATION_RANK: @@ -1604,25 +1604,25 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) FactionEntry const* factionEntry = sFactionStore.LookupEntry(cond->ConditionValue1); if (!factionEntry) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Reputation condition has non existing faction (%u), skipped", cond->ConditionValue1); + TC_LOG_ERROR("sql.sql", "Reputation condition has non existing faction (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue3) - TC_LOG_ERROR(LOG_FILTER_SQL, "Reputation condition has useless data in value3 (%u)!", cond->ConditionValue3); + TC_LOG_ERROR("sql.sql", "Reputation condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_TEAM: { if (cond->ConditionValue1 != ALLIANCE && cond->ConditionValue1 != HORDE) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Team condition specifies unknown team (%u), skipped", cond->ConditionValue1); + TC_LOG_ERROR("sql.sql", "Team condition specifies unknown team (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue2) - TC_LOG_ERROR(LOG_FILTER_SQL, "Team condition has useless data in value2 (%u)!", cond->ConditionValue2); + TC_LOG_ERROR("sql.sql", "Team condition has useless data in value2 (%u)!", cond->ConditionValue2); if (cond->ConditionValue3) - TC_LOG_ERROR(LOG_FILTER_SQL, "Team condition has useless data in value3 (%u)!", cond->ConditionValue3); + TC_LOG_ERROR("sql.sql", "Team condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_SKILL: @@ -1630,17 +1630,17 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(cond->ConditionValue1); if (!pSkill) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Skill condition specifies non-existing skill (%u), skipped", cond->ConditionValue1); + TC_LOG_ERROR("sql.sql", "Skill condition specifies non-existing skill (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue2 < 1 || cond->ConditionValue2 > sWorld->GetConfigMaxSkillValue()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Skill condition specifies skill (%u) with invalid value (%u), skipped", cond->ConditionValue1, cond->ConditionValue2); + TC_LOG_ERROR("sql.sql", "Skill condition specifies skill (%u) with invalid value (%u), skipped", cond->ConditionValue1, cond->ConditionValue2); return false; } if (cond->ConditionValue3) - TC_LOG_ERROR(LOG_FILTER_SQL, "Skill condition has useless data in value3 (%u)!", cond->ConditionValue3); + TC_LOG_ERROR("sql.sql", "Skill condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_QUESTREWARDED: @@ -1650,15 +1650,15 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) { if (!sObjectMgr->GetQuestTemplate(cond->ConditionValue1)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest condition (Type: %u) points to non-existing quest (%u) for Source Entry %u. SourceGroup: %u, SourceTypeOrReferenceId: %u", + TC_LOG_ERROR("sql.sql", "Quest condition (Type: %u) points to non-existing quest (%u) for Source Entry %u. SourceGroup: %u, SourceTypeOrReferenceId: %u", cond->ConditionType, cond->ConditionValue1, cond->SourceEntry, cond->SourceGroup, cond->SourceType); return false; } if (cond->ConditionValue2 > 1) - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest condition has useless data in value2 (%u)!", cond->ConditionValue2); + TC_LOG_ERROR("sql.sql", "Quest condition has useless data in value2 (%u)!", cond->ConditionValue2); if (cond->ConditionValue3) - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest condition has useless data in value3 (%u)!", cond->ConditionValue3); + TC_LOG_ERROR("sql.sql", "Quest condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_ACTIVE_EVENT: @@ -1666,14 +1666,14 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap(); if (cond->ConditionValue1 >=events.size() || !events[cond->ConditionValue1].isValid()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "ActiveEvent condition has non existing event id (%u), skipped", cond->ConditionValue1); + TC_LOG_ERROR("sql.sql", "ActiveEvent condition has non existing event id (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue2) - TC_LOG_ERROR(LOG_FILTER_SQL, "ActiveEvent condition has useless data in value2 (%u)!", cond->ConditionValue2); + TC_LOG_ERROR("sql.sql", "ActiveEvent condition has useless data in value2 (%u)!", cond->ConditionValue2); if (cond->ConditionValue3) - TC_LOG_ERROR(LOG_FILTER_SQL, "ActiveEvent condition has useless data in value3 (%u)!", cond->ConditionValue3); + TC_LOG_ERROR("sql.sql", "ActiveEvent condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_ACHIEVEMENT: @@ -1681,56 +1681,56 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) AchievementEntry const* achievement = sAchievementMgr->GetAchievement(cond->ConditionValue1); if (!achievement) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Achivement condition has non existing achivement id (%u), skipped", cond->ConditionValue1); + TC_LOG_ERROR("sql.sql", "Achivement condition has non existing achivement id (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue2) - TC_LOG_ERROR(LOG_FILTER_SQL, "Achivement condition has useless data in value2 (%u)!", cond->ConditionValue2); + TC_LOG_ERROR("sql.sql", "Achivement condition has useless data in value2 (%u)!", cond->ConditionValue2); if (cond->ConditionValue3) - TC_LOG_ERROR(LOG_FILTER_SQL, "Achivement condition has useless data in value3 (%u)!", cond->ConditionValue3); + TC_LOG_ERROR("sql.sql", "Achivement condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_CLASS: { if (!(cond->ConditionValue1 & CLASSMASK_ALL_PLAYABLE)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Class condition has non existing classmask (%u), skipped", cond->ConditionValue1 & ~CLASSMASK_ALL_PLAYABLE); + TC_LOG_ERROR("sql.sql", "Class condition has non existing classmask (%u), skipped", cond->ConditionValue1 & ~CLASSMASK_ALL_PLAYABLE); return false; } if (cond->ConditionValue2) - TC_LOG_ERROR(LOG_FILTER_SQL, "Class condition has useless data in value2 (%u)!", cond->ConditionValue2); + TC_LOG_ERROR("sql.sql", "Class condition has useless data in value2 (%u)!", cond->ConditionValue2); if (cond->ConditionValue3) - TC_LOG_ERROR(LOG_FILTER_SQL, "Class condition has useless data in value3 (%u)!", cond->ConditionValue3); + TC_LOG_ERROR("sql.sql", "Class condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_RACE: { if (!(cond->ConditionValue1 & RACEMASK_ALL_PLAYABLE)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Race condition has non existing racemask (%u), skipped", cond->ConditionValue1 & ~RACEMASK_ALL_PLAYABLE); + TC_LOG_ERROR("sql.sql", "Race condition has non existing racemask (%u), skipped", cond->ConditionValue1 & ~RACEMASK_ALL_PLAYABLE); return false; } if (cond->ConditionValue2) - TC_LOG_ERROR(LOG_FILTER_SQL, "Race condition has useless data in value2 (%u)!", cond->ConditionValue2); + TC_LOG_ERROR("sql.sql", "Race condition has useless data in value2 (%u)!", cond->ConditionValue2); if (cond->ConditionValue3) - TC_LOG_ERROR(LOG_FILTER_SQL, "Race condition has useless data in value3 (%u)!", cond->ConditionValue3); + TC_LOG_ERROR("sql.sql", "Race condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_GENDER: { if (!Player::IsValidGender(uint8(cond->ConditionValue1))) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Gender condition has invalid gender (%u), skipped", cond->ConditionValue1); + TC_LOG_ERROR("sql.sql", "Gender condition has invalid gender (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue2) - TC_LOG_ERROR(LOG_FILTER_SQL, "Gender condition has useless data in value2 (%u)!", cond->ConditionValue2); + TC_LOG_ERROR("sql.sql", "Gender condition has useless data in value2 (%u)!", cond->ConditionValue2); if (cond->ConditionValue3) - TC_LOG_ERROR(LOG_FILTER_SQL, "Gender condition has useless data in value3 (%u)!", cond->ConditionValue3); + TC_LOG_ERROR("sql.sql", "Gender condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_MAPID: @@ -1738,77 +1738,77 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) MapEntry const* me = sMapStore.LookupEntry(cond->ConditionValue1); if (!me) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Map condition has non existing map (%u), skipped", cond->ConditionValue1); + TC_LOG_ERROR("sql.sql", "Map condition has non existing map (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue2) - TC_LOG_ERROR(LOG_FILTER_SQL, "Map condition has useless data in value2 (%u)!", cond->ConditionValue2); + TC_LOG_ERROR("sql.sql", "Map condition has useless data in value2 (%u)!", cond->ConditionValue2); if (cond->ConditionValue3) - TC_LOG_ERROR(LOG_FILTER_SQL, "Map condition has useless data in value3 (%u)!", cond->ConditionValue3); + TC_LOG_ERROR("sql.sql", "Map condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_SPELL: { if (!sSpellMgr->GetSpellInfo(cond->ConditionValue1)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell condition has non existing spell (Id: %d), skipped", cond->ConditionValue1); + TC_LOG_ERROR("sql.sql", "Spell condition has non existing spell (Id: %d), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue2) - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell condition has useless data in value2 (%u)!", cond->ConditionValue2); + TC_LOG_ERROR("sql.sql", "Spell condition has useless data in value2 (%u)!", cond->ConditionValue2); if (cond->ConditionValue3) - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell condition has useless data in value3 (%u)!", cond->ConditionValue3); + TC_LOG_ERROR("sql.sql", "Spell condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_LEVEL: { if (cond->ConditionValue2 >= COMP_TYPE_MAX) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Level condition has invalid ComparisionType (%u), skipped", cond->ConditionValue2); + TC_LOG_ERROR("sql.sql", "Level condition has invalid ComparisionType (%u), skipped", cond->ConditionValue2); return false; } if (cond->ConditionValue3) - TC_LOG_ERROR(LOG_FILTER_SQL, "Level condition has useless data in value3 (%u)!", cond->ConditionValue3); + TC_LOG_ERROR("sql.sql", "Level condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_DRUNKENSTATE: { if (cond->ConditionValue1 > DRUNKEN_SMASHED) { - TC_LOG_ERROR(LOG_FILTER_SQL, "DrunkState condition has invalid state (%u), skipped", cond->ConditionValue1); + TC_LOG_ERROR("sql.sql", "DrunkState condition has invalid state (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue2) { - TC_LOG_ERROR(LOG_FILTER_SQL, "DrunkState condition has useless data in value2 (%u)!", cond->ConditionValue2); + TC_LOG_ERROR("sql.sql", "DrunkState condition has useless data in value2 (%u)!", cond->ConditionValue2); return false; } if (cond->ConditionValue3) - TC_LOG_ERROR(LOG_FILTER_SQL, "DrunkState condition has useless data in value3 (%u)!", cond->ConditionValue3); + TC_LOG_ERROR("sql.sql", "DrunkState condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_NEAR_CREATURE: { if (!sObjectMgr->GetCreatureTemplate(cond->ConditionValue1)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "NearCreature condition has non existing creature template entry (%u), skipped", cond->ConditionValue1); + TC_LOG_ERROR("sql.sql", "NearCreature condition has non existing creature template entry (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue3) - TC_LOG_ERROR(LOG_FILTER_SQL, "NearCreature condition has useless data in value3 (%u)!", cond->ConditionValue3); + TC_LOG_ERROR("sql.sql", "NearCreature condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_NEAR_GAMEOBJECT: { if (!sObjectMgr->GetGameObjectTemplate(cond->ConditionValue1)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "NearGameObject condition has non existing gameobject template entry (%u), skipped", cond->ConditionValue1); + TC_LOG_ERROR("sql.sql", "NearGameObject condition has non existing gameobject template entry (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue3) - TC_LOG_ERROR(LOG_FILTER_SQL, "NearGameObject condition has useless data in value3 (%u)!", cond->ConditionValue3); + TC_LOG_ERROR("sql.sql", "NearGameObject condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_OBJECT_ENTRY: @@ -1818,79 +1818,79 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) case TYPEID_UNIT: if (cond->ConditionValue2 && !sObjectMgr->GetCreatureTemplate(cond->ConditionValue2)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "ObjectEntry condition has non existing creature template entry (%u), skipped", cond->ConditionValue2); + TC_LOG_ERROR("sql.sql", "ObjectEntry condition has non existing creature template entry (%u), skipped", cond->ConditionValue2); return false; } break; case TYPEID_GAMEOBJECT: if (cond->ConditionValue2 && !sObjectMgr->GetGameObjectTemplate(cond->ConditionValue2)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "ObjectEntry condition has non existing game object template entry (%u), skipped", cond->ConditionValue2); + TC_LOG_ERROR("sql.sql", "ObjectEntry condition has non existing game object template entry (%u), skipped", cond->ConditionValue2); return false; } break; case TYPEID_PLAYER: case TYPEID_CORPSE: if (cond->ConditionValue2) - TC_LOG_ERROR(LOG_FILTER_SQL, "ObjectEntry condition has useless data in value2 (%u)!", cond->ConditionValue2); + TC_LOG_ERROR("sql.sql", "ObjectEntry condition has useless data in value2 (%u)!", cond->ConditionValue2); break; default: - TC_LOG_ERROR(LOG_FILTER_SQL, "ObjectEntry condition has wrong typeid set (%u), skipped", cond->ConditionValue1); + TC_LOG_ERROR("sql.sql", "ObjectEntry condition has wrong typeid set (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue3) - TC_LOG_ERROR(LOG_FILTER_SQL, "ObjectEntry condition has useless data in value3 (%u)!", cond->ConditionValue3); + TC_LOG_ERROR("sql.sql", "ObjectEntry condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_TYPE_MASK: { if (!cond->ConditionValue1 || (cond->ConditionValue1 & ~(TYPEMASK_UNIT | TYPEMASK_PLAYER | TYPEMASK_GAMEOBJECT | TYPEMASK_CORPSE))) { - TC_LOG_ERROR(LOG_FILTER_SQL, "TypeMask condition has invalid typemask set (%u), skipped", cond->ConditionValue2); + TC_LOG_ERROR("sql.sql", "TypeMask condition has invalid typemask set (%u), skipped", cond->ConditionValue2); return false; } if (cond->ConditionValue2) - TC_LOG_ERROR(LOG_FILTER_SQL, "TypeMask condition has useless data in value2 (%u)!", cond->ConditionValue2); + TC_LOG_ERROR("sql.sql", "TypeMask condition has useless data in value2 (%u)!", cond->ConditionValue2); if (cond->ConditionValue3) - TC_LOG_ERROR(LOG_FILTER_SQL, "TypeMask condition has useless data in value3 (%u)!", cond->ConditionValue3); + TC_LOG_ERROR("sql.sql", "TypeMask condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_RELATION_TO: { if (cond->ConditionValue1 >= cond->GetMaxAvailableConditionTargets()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "RelationTo condition has invalid ConditionValue1(ConditionTarget selection) (%u), skipped", cond->ConditionValue1); + TC_LOG_ERROR("sql.sql", "RelationTo condition has invalid ConditionValue1(ConditionTarget selection) (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue1 == cond->ConditionTarget) { - TC_LOG_ERROR(LOG_FILTER_SQL, "RelationTo condition has ConditionValue1(ConditionTarget selection) set to self (%u), skipped", cond->ConditionValue1); + TC_LOG_ERROR("sql.sql", "RelationTo condition has ConditionValue1(ConditionTarget selection) set to self (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue2 >= RELATION_MAX) { - TC_LOG_ERROR(LOG_FILTER_SQL, "RelationTo condition has invalid ConditionValue2(RelationType) (%u), skipped", cond->ConditionValue2); + TC_LOG_ERROR("sql.sql", "RelationTo condition has invalid ConditionValue2(RelationType) (%u), skipped", cond->ConditionValue2); return false; } if (cond->ConditionValue3) - TC_LOG_ERROR(LOG_FILTER_SQL, "RelationTo condition has useless data in value3 (%u)!", cond->ConditionValue3); + TC_LOG_ERROR("sql.sql", "RelationTo condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_REACTION_TO: { if (cond->ConditionValue1 >= cond->GetMaxAvailableConditionTargets()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "ReactionTo condition has invalid ConditionValue1(ConditionTarget selection) (%u), skipped", cond->ConditionValue1); + TC_LOG_ERROR("sql.sql", "ReactionTo condition has invalid ConditionValue1(ConditionTarget selection) (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue1 == cond->ConditionTarget) { - TC_LOG_ERROR(LOG_FILTER_SQL, "ReactionTo condition has ConditionValue1(ConditionTarget selection) set to self (%u), skipped", cond->ConditionValue1); + TC_LOG_ERROR("sql.sql", "ReactionTo condition has ConditionValue1(ConditionTarget selection) set to self (%u), skipped", cond->ConditionValue1); return false; } if (!cond->ConditionValue2) { - TC_LOG_ERROR(LOG_FILTER_SQL, "mConditionValue2 condition has invalid ConditionValue2(rankMask) (%u), skipped", cond->ConditionValue2); + TC_LOG_ERROR("sql.sql", "mConditionValue2 condition has invalid ConditionValue2(rankMask) (%u), skipped", cond->ConditionValue2); return false; } break; @@ -1899,17 +1899,17 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) { if (cond->ConditionValue1 >= cond->GetMaxAvailableConditionTargets()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "DistanceTo condition has invalid ConditionValue1(ConditionTarget selection) (%u), skipped", cond->ConditionValue1); + TC_LOG_ERROR("sql.sql", "DistanceTo condition has invalid ConditionValue1(ConditionTarget selection) (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue1 == cond->ConditionTarget) { - TC_LOG_ERROR(LOG_FILTER_SQL, "DistanceTo condition has ConditionValue1(ConditionTarget selection) set to self (%u), skipped", cond->ConditionValue1); + TC_LOG_ERROR("sql.sql", "DistanceTo condition has ConditionValue1(ConditionTarget selection) set to self (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue3 >= COMP_TYPE_MAX) { - TC_LOG_ERROR(LOG_FILTER_SQL, "DistanceTo condition has invalid ComparisionType (%u), skipped", cond->ConditionValue3); + TC_LOG_ERROR("sql.sql", "DistanceTo condition has invalid ComparisionType (%u), skipped", cond->ConditionValue3); return false; } break; @@ -1917,38 +1917,38 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) case CONDITION_ALIVE: { if (cond->ConditionValue1) - TC_LOG_ERROR(LOG_FILTER_SQL, "Alive condition has useless data in value1 (%u)!", cond->ConditionValue1); + TC_LOG_ERROR("sql.sql", "Alive condition has useless data in value1 (%u)!", cond->ConditionValue1); if (cond->ConditionValue2) - TC_LOG_ERROR(LOG_FILTER_SQL, "Alive condition has useless data in value2 (%u)!", cond->ConditionValue2); + TC_LOG_ERROR("sql.sql", "Alive condition has useless data in value2 (%u)!", cond->ConditionValue2); if (cond->ConditionValue3) - TC_LOG_ERROR(LOG_FILTER_SQL, "Alive condition has useless data in value3 (%u)!", cond->ConditionValue3); + TC_LOG_ERROR("sql.sql", "Alive condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_HP_VAL: { if (cond->ConditionValue2 >= COMP_TYPE_MAX) { - TC_LOG_ERROR(LOG_FILTER_SQL, "HpVal condition has invalid ComparisionType (%u), skipped", cond->ConditionValue2); + TC_LOG_ERROR("sql.sql", "HpVal condition has invalid ComparisionType (%u), skipped", cond->ConditionValue2); return false; } if (cond->ConditionValue3) - TC_LOG_ERROR(LOG_FILTER_SQL, "HpVal condition has useless data in value3 (%u)!", cond->ConditionValue3); + TC_LOG_ERROR("sql.sql", "HpVal condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_HP_PCT: { if (cond->ConditionValue1 > 100) { - TC_LOG_ERROR(LOG_FILTER_SQL, "HpPct condition has too big percent value (%u), skipped", cond->ConditionValue1); + TC_LOG_ERROR("sql.sql", "HpPct condition has too big percent value (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue2 >= COMP_TYPE_MAX) { - TC_LOG_ERROR(LOG_FILTER_SQL, "HpPct condition has invalid ComparisionType (%u), skipped", cond->ConditionValue2); + TC_LOG_ERROR("sql.sql", "HpPct condition has invalid ComparisionType (%u), skipped", cond->ConditionValue2); return false; } if (cond->ConditionValue3) - TC_LOG_ERROR(LOG_FILTER_SQL, "HpPct condition has useless data in value3 (%u)!", cond->ConditionValue3); + TC_LOG_ERROR("sql.sql", "HpPct condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_AREAID: @@ -1958,19 +1958,19 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) { if (!sWorld->getWorldState(cond->ConditionValue1)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "World state condition has non existing world state in value1 (%u), skipped", cond->ConditionValue1); + TC_LOG_ERROR("sql.sql", "World state condition has non existing world state in value1 (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue3) - TC_LOG_ERROR(LOG_FILTER_SQL, "World state condition has useless data in value3 (%u)!", cond->ConditionValue3); + TC_LOG_ERROR("sql.sql", "World state condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_PHASEMASK: { if (cond->ConditionValue2) - TC_LOG_ERROR(LOG_FILTER_SQL, "Phasemask condition has useless data in value2 (%u)!", cond->ConditionValue2); + TC_LOG_ERROR("sql.sql", "Phasemask condition has useless data in value2 (%u)!", cond->ConditionValue2); if (cond->ConditionValue3) - TC_LOG_ERROR(LOG_FILTER_SQL, "Phasemask condition has useless data in value3 (%u)!", cond->ConditionValue3); + TC_LOG_ERROR("sql.sql", "Phasemask condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_TITLE: @@ -1978,7 +1978,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(cond->ConditionValue1); if (!titleEntry) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Title condition has non existing title in value1 (%u), skipped", cond->ConditionValue1); + TC_LOG_ERROR("sql.sql", "Title condition has non existing title in value1 (%u), skipped", cond->ConditionValue1); return false; } break; @@ -1987,7 +1987,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) { if (cond->ConditionValue1 > SPAWNMASK_RAID_ALL) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SpawnMask condition has non existing SpawnMask in value1 (%u), skipped", cond->ConditionValue1); + TC_LOG_ERROR("sql.sql", "SpawnMask condition has non existing SpawnMask in value1 (%u), skipped", cond->ConditionValue1); return false; } break; @@ -1996,7 +1996,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) { if (cond->ConditionValue1 > uint32(UNIT_STATE_ALL_STATE)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "UnitState condition has non existing UnitState in value1 (%u), skipped", cond->ConditionValue1); + TC_LOG_ERROR("sql.sql", "UnitState condition has non existing UnitState in value1 (%u), skipped", cond->ConditionValue1); return false; } break; @@ -2005,7 +2005,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) { if (!cond->ConditionValue1 || cond->ConditionValue1 > CREATURE_TYPE_GAS_CLOUD) { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureType condition has non existing CreatureType in value1 (%u), skipped", cond->ConditionValue1); + TC_LOG_ERROR("sql.sql", "CreatureType condition has non existing CreatureType in value1 (%u), skipped", cond->ConditionValue1); return false; } break; diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h index cc2db10e437..9249ad1ef1f 100644 --- a/src/server/game/Conditions/ConditionMgr.h +++ b/src/server/game/Conditions/ConditionMgr.h @@ -192,6 +192,7 @@ struct Condition SourceType = CONDITION_SOURCE_TYPE_NONE; SourceGroup = 0; SourceEntry = 0; + SourceId = 0; ElseGroup = 0; ConditionType = CONDITION_NONE; ConditionTarget = 0; diff --git a/src/server/game/Conditions/DisableMgr.cpp b/src/server/game/Conditions/DisableMgr.cpp index 529ca8dc9ec..c32d4e4120e 100644 --- a/src/server/game/Conditions/DisableMgr.cpp +++ b/src/server/game/Conditions/DisableMgr.cpp @@ -61,7 +61,7 @@ void LoadDisables() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 disables. DB table `disables` is empty!"); + TC_LOG_INFO("server.loading", ">> Loaded 0 disables. DB table `disables` is empty!"); return; } @@ -72,7 +72,7 @@ void LoadDisables() DisableType type = DisableType(fields[0].GetUInt32()); if (type >= MAX_DISABLE_TYPES) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Invalid type %u specified in `disables` table, skipped.", type); + TC_LOG_ERROR("sql.sql", "Invalid type %u specified in `disables` table, skipped.", type); continue; } @@ -89,13 +89,13 @@ void LoadDisables() case DISABLE_TYPE_SPELL: if (!(sSpellMgr->GetSpellInfo(entry) || flags & SPELL_DISABLE_DEPRECATED_SPELL)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell entry %u from `disables` doesn't exist in dbc, skipped.", entry); + TC_LOG_ERROR("sql.sql", "Spell entry %u from `disables` doesn't exist in dbc, skipped.", entry); continue; } if (!flags || flags > MAX_SPELL_DISABLE_TYPE) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Disable flags for spell %u are invalid, skipped.", entry); + TC_LOG_ERROR("sql.sql", "Disable flags for spell %u are invalid, skipped.", entry); continue; } @@ -122,7 +122,7 @@ void LoadDisables() MapEntry const* mapEntry = sMapStore.LookupEntry(entry); if (!mapEntry) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Map entry %u from `disables` doesn't exist in dbc, skipped.", entry); + TC_LOG_ERROR("sql.sql", "Map entry %u from `disables` doesn't exist in dbc, skipped.", entry); continue; } bool isFlagInvalid = false; @@ -145,12 +145,12 @@ void LoadDisables() break; case MAP_BATTLEGROUND: case MAP_ARENA: - TC_LOG_ERROR(LOG_FILTER_SQL, "Battleground map %u specified to be disabled in map case, skipped.", entry); + TC_LOG_ERROR("sql.sql", "Battleground map %u specified to be disabled in map case, skipped.", entry); continue; } if (isFlagInvalid) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Disable flags for map %u are invalid, skipped.", entry); + TC_LOG_ERROR("sql.sql", "Disable flags for map %u are invalid, skipped.", entry); continue; } break; @@ -158,64 +158,64 @@ void LoadDisables() case DISABLE_TYPE_BATTLEGROUND: if (!sBattlemasterListStore.LookupEntry(entry)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Battleground entry %u from `disables` doesn't exist in dbc, skipped.", entry); + TC_LOG_ERROR("sql.sql", "Battleground entry %u from `disables` doesn't exist in dbc, skipped.", entry); continue; } if (flags) - TC_LOG_ERROR(LOG_FILTER_SQL, "Disable flags specified for battleground %u, useless data.", entry); + TC_LOG_ERROR("sql.sql", "Disable flags specified for battleground %u, useless data.", entry); break; case DISABLE_TYPE_OUTDOORPVP: if (entry > MAX_OUTDOORPVP_TYPES) { - TC_LOG_ERROR(LOG_FILTER_SQL, "OutdoorPvPTypes value %u from `disables` is invalid, skipped.", entry); + TC_LOG_ERROR("sql.sql", "OutdoorPvPTypes value %u from `disables` is invalid, skipped.", entry); continue; } if (flags) - TC_LOG_ERROR(LOG_FILTER_SQL, "Disable flags specified for outdoor PvP %u, useless data.", entry); + TC_LOG_ERROR("sql.sql", "Disable flags specified for outdoor PvP %u, useless data.", entry); break; case DISABLE_TYPE_ACHIEVEMENT_CRITERIA: if (!sAchievementMgr->GetAchievementCriteria(entry)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Achievement Criteria entry %u from `disables` doesn't exist in dbc, skipped.", entry); + TC_LOG_ERROR("sql.sql", "Achievement Criteria entry %u from `disables` doesn't exist in dbc, skipped.", entry); continue; } if (flags) - TC_LOG_ERROR(LOG_FILTER_SQL, "Disable flags specified for Achievement Criteria %u, useless data.", entry); + TC_LOG_ERROR("sql.sql", "Disable flags specified for Achievement Criteria %u, useless data.", entry); break; case DISABLE_TYPE_VMAP: { MapEntry const* mapEntry = sMapStore.LookupEntry(entry); if (!mapEntry) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Map entry %u from `disables` doesn't exist in dbc, skipped.", entry); + TC_LOG_ERROR("sql.sql", "Map entry %u from `disables` doesn't exist in dbc, skipped.", entry); continue; } switch (mapEntry->map_type) { case MAP_COMMON: if (flags & VMAP_DISABLE_AREAFLAG) - TC_LOG_INFO(LOG_FILTER_GENERAL, "Areaflag disabled for world map %u.", entry); + TC_LOG_INFO("misc", "Areaflag disabled for world map %u.", entry); if (flags & VMAP_DISABLE_LIQUIDSTATUS) - TC_LOG_INFO(LOG_FILTER_GENERAL, "Liquid status disabled for world map %u.", entry); + TC_LOG_INFO("misc", "Liquid status disabled for world map %u.", entry); break; case MAP_INSTANCE: case MAP_RAID: if (flags & VMAP_DISABLE_HEIGHT) - TC_LOG_INFO(LOG_FILTER_GENERAL, "Height disabled for instance map %u.", entry); + TC_LOG_INFO("misc", "Height disabled for instance map %u.", entry); if (flags & VMAP_DISABLE_LOS) - TC_LOG_INFO(LOG_FILTER_GENERAL, "LoS disabled for instance map %u.", entry); + TC_LOG_INFO("misc", "LoS disabled for instance map %u.", entry); break; case MAP_BATTLEGROUND: if (flags & VMAP_DISABLE_HEIGHT) - TC_LOG_INFO(LOG_FILTER_GENERAL, "Height disabled for battleground map %u.", entry); + TC_LOG_INFO("misc", "Height disabled for battleground map %u.", entry); if (flags & VMAP_DISABLE_LOS) - TC_LOG_INFO(LOG_FILTER_GENERAL, "LoS disabled for battleground map %u.", entry); + TC_LOG_INFO("misc", "LoS disabled for battleground map %u.", entry); break; case MAP_ARENA: if (flags & VMAP_DISABLE_HEIGHT) - TC_LOG_INFO(LOG_FILTER_GENERAL, "Height disabled for arena map %u.", entry); + TC_LOG_INFO("misc", "Height disabled for arena map %u.", entry); if (flags & VMAP_DISABLE_LOS) - TC_LOG_INFO(LOG_FILTER_GENERAL, "LoS disabled for arena map %u.", entry); + TC_LOG_INFO("misc", "LoS disabled for arena map %u.", entry); break; default: break; @@ -227,23 +227,23 @@ void LoadDisables() MapEntry const* mapEntry = sMapStore.LookupEntry(entry); if (!mapEntry) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Map entry %u from `disables` doesn't exist in dbc, skipped.", entry); + TC_LOG_ERROR("sql.sql", "Map entry %u from `disables` doesn't exist in dbc, skipped.", entry); continue; } switch (mapEntry->map_type) { case MAP_COMMON: - TC_LOG_INFO(LOG_FILTER_GENERAL, "Pathfinding disabled for world map %u.", entry); + TC_LOG_INFO("misc", "Pathfinding disabled for world map %u.", entry); break; case MAP_INSTANCE: case MAP_RAID: - TC_LOG_INFO(LOG_FILTER_GENERAL, "Pathfinding disabled for instance map %u.", entry); + TC_LOG_INFO("misc", "Pathfinding disabled for instance map %u.", entry); break; case MAP_BATTLEGROUND: - TC_LOG_INFO(LOG_FILTER_GENERAL, "Pathfinding disabled for battleground map %u.", entry); + TC_LOG_INFO("misc", "Pathfinding disabled for battleground map %u.", entry); break; case MAP_ARENA: - TC_LOG_INFO(LOG_FILTER_GENERAL, "Pathfinding disabled for arena map %u.", entry); + TC_LOG_INFO("misc", "Pathfinding disabled for arena map %u.", entry); break; default: break; @@ -259,7 +259,7 @@ void LoadDisables() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u disables in %u ms", total_count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u disables in %u ms", total_count, GetMSTimeDiffToNow(oldMSTime)); } void CheckQuestDisables() @@ -269,7 +269,7 @@ void CheckQuestDisables() uint32 count = m_DisableMap[DISABLE_TYPE_QUEST].size(); if (!count) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Checked 0 quest disables."); + TC_LOG_INFO("server.loading", ">> Checked 0 quest disables."); return; } @@ -279,16 +279,16 @@ void CheckQuestDisables() const uint32 entry = itr->first; if (!sObjectMgr->GetQuestTemplate(entry)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest entry %u from `disables` doesn't exist, skipped.", entry); + TC_LOG_ERROR("sql.sql", "Quest entry %u from `disables` doesn't exist, skipped.", entry); m_DisableMap[DISABLE_TYPE_QUEST].erase(itr++); continue; } if (itr->second.flags) - TC_LOG_ERROR(LOG_FILTER_SQL, "Disable flags specified for quest %u, useless data.", entry); + TC_LOG_ERROR("sql.sql", "Disable flags specified for quest %u, useless data.", entry); ++itr; } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Checked %u quest disables in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Checked %u quest disables in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags) diff --git a/src/server/game/DataStores/DBCEnums.h b/src/server/game/DataStores/DBCEnums.h index 171d0fe8cc2..e976704c215 100644 --- a/src/server/game/DataStores/DBCEnums.h +++ b/src/server/game/DataStores/DBCEnums.h @@ -224,35 +224,35 @@ enum AchievementCategory enum AreaFlags { - AREA_FLAG_UNK0 = 0x00000001, // Unknown - AREA_FLAG_UNK1 = 0x00000002, // Razorfen Downs, Naxxramas and Acherus: The Ebon Hold (3.3.5a) - AREA_FLAG_UNK2 = 0x00000004, // Only used for areas on map 571 (development before) - AREA_FLAG_SLAVE_CAPITAL = 0x00000008, // city and city subsones - AREA_FLAG_UNK3 = 0x00000010, // can't find common meaning - AREA_FLAG_SLAVE_CAPITAL2 = 0x00000020, // slave capital city flag? - AREA_FLAG_ALLOW_DUELS = 0x00000040, // allow to duel here - AREA_FLAG_ARENA = 0x00000080, // arena, both instanced and world arenas - AREA_FLAG_CAPITAL = 0x00000100, // main capital city flag - AREA_FLAG_CITY = 0x00000200, // only for one zone named "City" (where it located?) - AREA_FLAG_OUTLAND = 0x00000400, // expansion zones? (only Eye of the Storm not have this flag, but have 0x00004000 flag) - AREA_FLAG_SANCTUARY = 0x00000800, // sanctuary area (PvP disabled) - AREA_FLAG_NEED_FLY = 0x00001000, // Respawn alive at the graveyard without corpse - AREA_FLAG_UNUSED1 = 0x00002000, // Unused in 3.3.5a - AREA_FLAG_OUTLAND2 = 0x00004000, // expansion zones? (only Circle of Blood Arena not have this flag, but have 0x00000400 flag) - AREA_FLAG_OUTDOOR_PVP = 0x00008000, // pvp objective area? (Death's Door also has this flag although it's no pvp object area) - AREA_FLAG_ARENA_INSTANCE = 0x00010000, // used by instanced arenas only - AREA_FLAG_UNUSED2 = 0x00020000, // Unused in 3.3.5a - AREA_FLAG_CONTESTED_AREA = 0x00040000, // On PvP servers these areas are considered contested, even though the zone it is contained in is a Horde/Alliance territory. - AREA_FLAG_UNK6 = 0x00080000, // Valgarde and Acherus: The Ebon Hold - AREA_FLAG_LOWLEVEL = 0x00100000, // used for some starting areas with area_level <= 15 - AREA_FLAG_TOWN = 0x00200000, // small towns with Inn - AREA_FLAG_UNK7 = 0x00400000, // Warsong Hold, Acherus: The Ebon Hold, New Agamand Inn, Vengeance Landing Inn, Sunreaver Pavilion (Something to do with team?) - AREA_FLAG_UNK8 = 0x00800000, // Valgarde, Acherus: The Ebon Hold, Westguard Inn, Silver Covenant Pavilion (Something to do with team?) - AREA_FLAG_WINTERGRASP = 0x01000000, // Wintergrasp and it's subzones - AREA_FLAG_INSIDE = 0x02000000, // used for determinating spell related inside/outside questions in Map::IsOutdoors - AREA_FLAG_OUTSIDE = 0x04000000, // used for determinating spell related inside/outside questions in Map::IsOutdoors - AREA_FLAG_WINTERGRASP_2 = 0x08000000, // Can Hearth And Resurrect From Area - AREA_FLAG_NO_FLY_ZONE = 0x20000000 // Marks zones where you cannot fly + AREA_FLAG_UNK0 = 0x00000001, // Unknown + AREA_FLAG_UNK1 = 0x00000002, // Razorfen Downs, Naxxramas and Acherus: The Ebon Hold (3.3.5a) + AREA_FLAG_UNK2 = 0x00000004, // Only used for areas on map 571 (development before) + AREA_FLAG_SLAVE_CAPITAL = 0x00000008, // city and city subsones + AREA_FLAG_UNK3 = 0x00000010, // can't find common meaning + AREA_FLAG_SLAVE_CAPITAL2 = 0x00000020, // slave capital city flag? + AREA_FLAG_ALLOW_DUELS = 0x00000040, // allow to duel here + AREA_FLAG_ARENA = 0x00000080, // arena, both instanced and world arenas + AREA_FLAG_CAPITAL = 0x00000100, // main capital city flag + AREA_FLAG_CITY = 0x00000200, // only for one zone named "City" (where it located?) + AREA_FLAG_OUTLAND = 0x00000400, // expansion zones? (only Eye of the Storm not have this flag, but have 0x00004000 flag) + AREA_FLAG_SANCTUARY = 0x00000800, // sanctuary area (PvP disabled) + AREA_FLAG_NEED_FLY = 0x00001000, // Respawn alive at the graveyard without corpse + AREA_FLAG_UNUSED1 = 0x00002000, // Unused in 3.3.5a + AREA_FLAG_OUTLAND2 = 0x00004000, // expansion zones? (only Circle of Blood Arena not have this flag, but have 0x00000400 flag) + AREA_FLAG_OUTDOOR_PVP = 0x00008000, // pvp objective area? (Death's Door also has this flag although it's no pvp object area) + AREA_FLAG_ARENA_INSTANCE = 0x00010000, // used by instanced arenas only + AREA_FLAG_UNUSED2 = 0x00020000, // Unused in 3.3.5a + AREA_FLAG_CONTESTED_AREA = 0x00040000, // On PvP servers these areas are considered contested, even though the zone it is contained in is a Horde/Alliance territory. + AREA_FLAG_UNK4 = 0x00080000, // Valgarde and Acherus: The Ebon Hold + AREA_FLAG_LOWLEVEL = 0x00100000, // used for some starting areas with area_level <= 15 + AREA_FLAG_TOWN = 0x00200000, // small towns with Inn + AREA_FLAG_REST_ZONE_HORDE = 0x00400000, // Instead of using areatriggers, the zone will act as one for Horde players (Warsong Hold, Acherus: The Ebon Hold, New Agamand Inn, Vengeance Landing Inn, Sunreaver Pavilion, etc) + AREA_FLAG_REST_ZONE_ALLIANCE = 0x00800000, // Instead of using areatriggers, the zone will act as one for Alliance players (Valgarde, Acherus: The Ebon Hold, Westguard Inn, Silver Covenant Pavilion, etc) + AREA_FLAG_WINTERGRASP = 0x01000000, // Wintergrasp and it's subzones + AREA_FLAG_INSIDE = 0x02000000, // used for determinating spell related inside/outside questions in Map::IsOutdoors + AREA_FLAG_OUTSIDE = 0x04000000, // used for determinating spell related inside/outside questions in Map::IsOutdoors + AREA_FLAG_WINTERGRASP_2 = 0x08000000, // Can Hearth And Resurrect From Area + AREA_FLAG_NO_FLY_ZONE = 0x20000000 // Marks zones where you cannot fly }; enum Difficulty diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp index aa292934021..1fc2c3ee9f2 100644 --- a/src/server/game/DataStores/DBCStores.cpp +++ b/src/server/game/DataStores/DBCStores.cpp @@ -207,7 +207,7 @@ uint32 DBCFileCount = 0; static bool LoadDBC_assert_print(uint32 fsize, uint32 rsize, const std::string& filename) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Size of '%s' set by format string (%u) not equal size of C++ structure (%u).", filename.c_str(), fsize, rsize); + TC_LOG_ERROR("misc", "Size of '%s' set by format string (%u) not equal size of C++ structure (%u).", filename.c_str(), fsize, rsize); // ASSERT must fail after function call return false; @@ -472,7 +472,7 @@ void LoadDBCStores(const std::string& dataPath) if (spellDiff->SpellID[x] <= 0 || !sSpellStore.LookupEntry(spellDiff->SpellID[x])) { if (spellDiff->SpellID[x] > 0)//don't show error if spell is <= 0, not all modes have spells and there are unknown negative values - TC_LOG_ERROR(LOG_FILTER_SQL, "spelldifficulty_dbc: spell %i at field id:%u at spellid%i does not exist in SpellStore (spell.dbc), loaded as 0", spellDiff->SpellID[x], spellDiff->ID, x); + TC_LOG_ERROR("sql.sql", "spelldifficulty_dbc: spell %i at field id:%u at spellid%i does not exist in SpellStore (spell.dbc), loaded as 0", spellDiff->SpellID[x], spellDiff->ID, x); newEntry.SpellID[x] = 0;//spell was <= 0 or invalid, set to 0 } else @@ -643,7 +643,7 @@ void LoadDBCStores(const std::string& dataPath) // error checks if (bad_dbc_files.size() >= DBCFileCount) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Incorrect DataDir value in worldserver.conf or ALL required *.dbc files (%d) not found by path: %sdbc", DBCFileCount, dataPath.c_str()); + TC_LOG_ERROR("misc", "Incorrect DataDir value in worldserver.conf or ALL required *.dbc files (%d) not found by path: %sdbc", DBCFileCount, dataPath.c_str()); exit(1); } else if (!bad_dbc_files.empty()) @@ -652,7 +652,7 @@ void LoadDBCStores(const std::string& dataPath) for (StoreProblemList::iterator i = bad_dbc_files.begin(); i != bad_dbc_files.end(); ++i) str += *i + "\n"; - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Some required *.dbc files (%u from %d) not found or not compatible:\n%s", (uint32)bad_dbc_files.size(), DBCFileCount, str.c_str()); + TC_LOG_ERROR("misc", "Some required *.dbc files (%u from %d) not found or not compatible:\n%s", (uint32)bad_dbc_files.size(), DBCFileCount, str.c_str()); exit(1); } @@ -665,11 +665,11 @@ void LoadDBCStores(const std::string& dataPath) !sMapStore.LookupEntry(724) || // last map added in 3.3.5a !sSpellStore.LookupEntry(80864) ) // last client known item added in 3.3.5a { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "You have _outdated_ DBC files. Please extract correct versions from current using client."); + TC_LOG_ERROR("misc", "You have _outdated_ DBC files. Please extract correct versions from current using client."); exit(1); } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Initialized %d data stores in %u ms", DBCFileCount, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Initialized %d data stores in %u ms", DBCFileCount, GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index 75b09914080..f8a7e8bd649 100644 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -113,7 +113,7 @@ void LFGMgr::LoadRewards() if (!result) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 lfg dungeon rewards. DB table `lfg_dungeon_rewards` is empty!"); + TC_LOG_ERROR("server.loading", ">> Loaded 0 lfg dungeon rewards. DB table `lfg_dungeon_rewards` is empty!"); return; } @@ -130,25 +130,25 @@ void LFGMgr::LoadRewards() if (!GetLFGDungeonEntry(dungeonId)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Dungeon %u specified in table `lfg_dungeon_rewards` does not exist!", dungeonId); + TC_LOG_ERROR("sql.sql", "Dungeon %u specified in table `lfg_dungeon_rewards` does not exist!", dungeonId); continue; } if (!maxLevel || maxLevel > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Level %u specified for dungeon %u in table `lfg_dungeon_rewards` can never be reached!", maxLevel, dungeonId); + TC_LOG_ERROR("sql.sql", "Level %u specified for dungeon %u in table `lfg_dungeon_rewards` can never be reached!", maxLevel, dungeonId); maxLevel = sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL); } if (!firstQuestId || !sObjectMgr->GetQuestTemplate(firstQuestId)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "First quest %u specified for dungeon %u in table `lfg_dungeon_rewards` does not exist!", firstQuestId, dungeonId); + TC_LOG_ERROR("sql.sql", "First quest %u specified for dungeon %u in table `lfg_dungeon_rewards` does not exist!", firstQuestId, dungeonId); continue; } if (otherQuestId && !sObjectMgr->GetQuestTemplate(otherQuestId)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Other quest %u specified for dungeon %u in table `lfg_dungeon_rewards` does not exist!", otherQuestId, dungeonId); + TC_LOG_ERROR("sql.sql", "Other quest %u specified for dungeon %u in table `lfg_dungeon_rewards` does not exist!", otherQuestId, dungeonId); otherQuestId = 0; } @@ -157,7 +157,7 @@ void LFGMgr::LoadRewards() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u lfg dungeon rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u lfg dungeon rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } LFGDungeonData const* LFGMgr::GetLFGDungeon(uint32 id) @@ -198,7 +198,7 @@ void LFGMgr::LoadLFGDungeons(bool reload /* = false */) if (!result) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 lfg entrance positions. DB table `lfg_entrances` is empty!"); + TC_LOG_ERROR("server.loading", ">> Loaded 0 lfg entrance positions. DB table `lfg_entrances` is empty!"); return; } @@ -211,7 +211,7 @@ void LFGMgr::LoadLFGDungeons(bool reload /* = false */) LFGDungeonContainer::iterator dungeonItr = LfgDungeonStore.find(dungeonId); if (dungeonItr == LfgDungeonStore.end()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "table `lfg_entrances` contains coordinates for wrong dungeon %u", dungeonId); + TC_LOG_ERROR("sql.sql", "table `lfg_entrances` contains coordinates for wrong dungeon %u", dungeonId); continue; } @@ -225,7 +225,7 @@ void LFGMgr::LoadLFGDungeons(bool reload /* = false */) } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u lfg entrance positions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u lfg entrance positions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); // Fill all other teleport coords from areatriggers for (LFGDungeonContainer::iterator itr = LfgDungeonStore.begin(); itr != LfgDungeonStore.end(); ++itr) @@ -238,7 +238,7 @@ void LFGMgr::LoadLFGDungeons(bool reload /* = false */) AreaTrigger const* at = sObjectMgr->GetMapEntranceTrigger(dungeon.map); if (!at) { - TC_LOG_ERROR(LOG_FILTER_LFG, "LFGMgr::LoadLFGDungeons: Failed to load dungeon %s, cant find areatrigger for map %u", dungeon.name.c_str(), dungeon.map); + TC_LOG_ERROR("sql.sql", "Failed to load dungeon %s, cant find areatrigger for map %u", dungeon.name.c_str(), dungeon.map); continue; } @@ -325,7 +325,7 @@ void LFGMgr::Update(uint32 diff) // Check if a proposal can be formed with the new groups being added for (LfgQueueContainer::iterator it = QueuesStore.begin(); it != QueuesStore.end(); ++it) if (uint8 newProposals = it->second.FindGroups()) - TC_LOG_DEBUG(LOG_FILTER_LFG, "LFGMgr::Update: Found %u new groups in queue %u", newProposals, it->first); + TC_LOG_DEBUG("lfg.update", "Found %u new groups in queue %u", newProposals, it->first); if (lastProposalId != m_lfgProposalId) { @@ -542,7 +542,6 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const isRaid = true; break; default: - TC_LOG_ERROR(LOG_FILTER_LFG, "Wrong dungeon type %u for dungeon %u", type, *it); joinData.result = LFG_JOIN_DUNGEON_INVALID; break; } @@ -565,7 +564,9 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const // Can't join. Send result if (joinData.result != LFG_JOIN_OK) { - TC_LOG_DEBUG(LOG_FILTER_LFG, "LFGMgr::Join: [" UI64FMTD "] joining with %u members. result: %u", guid, grp ? grp->GetMembersCount() : 1, joinData.result); + TC_LOG_DEBUG("lfg.join", "%u joining with %u members. Result: %u, Dungeons: %s", + GUID_LOPART(guid), grp ? grp->GetMembersCount() : 1, joinData.result, ConcatenateDungeons(dungeons).c_str()); + if (!dungeons.empty()) // Only should show lockmap when have no dungeons available joinData.lockmap.clear(); player->GetSession()->SendLfgJoinResult(joinData); @@ -576,7 +577,7 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const if (isRaid) { - TC_LOG_DEBUG(LOG_FILTER_LFG, "LFGMgr::Join: [" UI64FMTD "] trying to join raid browser and it's disabled.", guid); + TC_LOG_DEBUG("lfg.join", "%u trying to join raid browser and it's disabled.", GUID_LOPART(guid)); return; } @@ -642,13 +643,8 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const debugNames.append(player->GetName()); } - if (sLog->ShouldLog(LOG_FILTER_LFG, LOG_LEVEL_DEBUG)) - { - std::ostringstream o; - o << "LFGMgr::Join: [" << guid << "] joined (" << (grp ? "group" : "player") << ") Members: " << debugNames.c_str() - << ". Dungeons (" << uint32(dungeons.size()) << "): " << ConcatenateDungeons(dungeons); - TC_LOG_DEBUG(LOG_FILTER_LFG, "%s", o.str().c_str()); - } + TC_LOG_DEBUG("lfg.join", "%u joined (%s), Members: %s. Dungeons (%u): %s", GUID_LOPART(guid), + grp ? "group" : "player", debugNames.c_str(), uint32(dungeons.size()), ConcatenateDungeons(dungeons).c_str()); } /** @@ -659,9 +655,10 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const */ void LFGMgr::LeaveLfg(uint64 guid) { - TC_LOG_DEBUG(LOG_FILTER_LFG, "LFGMgr::LeaveLfg: [" UI64FMTD "]", guid); - uint64 gguid = IS_GROUP_GUID(guid) ? guid : GetGroup(guid); + + TC_LOG_DEBUG("lfg.leave", "%u left (%s)", GUID_LOPART(guid), guid == gguid ? "group" : "player"); + LfgState state = GetState(guid); switch (state) { @@ -1017,7 +1014,7 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept) LfgProposalPlayer& player = itProposalPlayer->second; player.accept = LfgAnswer(accept); - TC_LOG_DEBUG(LOG_FILTER_LFG, "LFGMgr::UpdateProposal: Player [" UI64FMTD "] of proposal %u selected: %u", guid, proposalId, accept); + TC_LOG_DEBUG("lfg.proposal.update", "Player %u, Proposal %u, Selection: %u", GUID_LOPART(guid), proposalId, accept); if (!accept) { RemoveProposal(itProposal, LFG_UPDATETYPE_PROPOSAL_DECLINED); @@ -1108,7 +1105,7 @@ void LFGMgr::RemoveProposal(LfgProposalContainer::iterator itProposal, LfgUpdate LfgProposal& proposal = itProposal->second; proposal.state = LFG_PROPOSAL_FAILED; - TC_LOG_DEBUG(LOG_FILTER_LFG, "LFGMgr::RemoveProposal: Proposal %u, state FAILED, UpdateType %u", itProposal->first, type); + TC_LOG_DEBUG("lfg.proposal.remove", "Proposal %u, state FAILED, UpdateType %u", itProposal->first, type); // Mark all people that didn't answered as no accept if (type == LFG_UPDATETYPE_PROPOSAL_FAILED) for (LfgProposalPlayerContainer::iterator it = proposal.players.begin(); it != proposal.players.end(); ++it) @@ -1145,12 +1142,12 @@ void LFGMgr::RemoveProposal(LfgProposalContainer::iterator itProposal, LfgUpdate if (it->second.accept == LFG_ANSWER_DENY) { updateData.updateType = type; - TC_LOG_DEBUG(LOG_FILTER_LFG, "LFGMgr::RemoveProposal: [" UI64FMTD "] didn't accept. Removing from queue and compatible cache", guid); + TC_LOG_DEBUG("lfg.proposal.remove", "%u didn't accept. Removing from queue and compatible cache", GUID_LOPART(guid)); } else { updateData.updateType = LFG_UPDATETYPE_REMOVED_FROM_QUEUE; - TC_LOG_DEBUG(LOG_FILTER_LFG, "LFGMgr::RemoveProposal: [" UI64FMTD "] in same group that someone that didn't accept. Removing from queue and compatible cache", guid); + TC_LOG_DEBUG("lfg.proposal.remove", "%u in same group that someone that didn't accept. Removing from queue and compatible cache", GUID_LOPART(guid)); } RestoreState(guid, "Proposal Fail (didn't accepted or in group with someone that didn't accept"); @@ -1164,7 +1161,7 @@ void LFGMgr::RemoveProposal(LfgProposalContainer::iterator itProposal, LfgUpdate } else { - TC_LOG_DEBUG(LOG_FILTER_LFG, "LFGMgr::RemoveProposal: Readding [" UI64FMTD "] to queue.", guid); + TC_LOG_DEBUG("lfg.proposal.remove", "Readding %u to queue.", GUID_LOPART(guid)); SetState(guid, LFG_STATE_QUEUED); if (gguid != guid) { @@ -1309,7 +1306,7 @@ void LFGMgr::TeleportPlayer(Player* player, bool out, bool fromOpcode /*= false* if (!dungeon) { - TC_LOG_DEBUG(LOG_FILTER_LFG, "TeleportPlayer: Player %s not in group/lfggroup or dungeon not found!", + TC_LOG_DEBUG("lfg.teleport", "Player %s not in group/lfggroup or dungeon not found!", player->GetName().c_str()); player->GetSession()->SendLfgTeleportError(uint8(LFG_TELEPORTERROR_INVALID_LOCATION)); return; @@ -1317,7 +1314,7 @@ void LFGMgr::TeleportPlayer(Player* player, bool out, bool fromOpcode /*= false* if (out) { - TC_LOG_DEBUG(LOG_FILTER_LFG, "TeleportPlayer: Player %s is being teleported out. Current Map %u - Expected Map %u", + TC_LOG_DEBUG("lfg.teleport", "Player %s is being teleported out. Current Map %u - Expected Map %u", player->GetName().c_str(), player->GetMapId(), uint32(dungeon->map)); if (player->GetMapId() == uint32(dungeon->map)) player->TeleportToBGEntryPoint(); @@ -1381,7 +1378,7 @@ void LFGMgr::TeleportPlayer(Player* player, bool out, bool fromOpcode /*= false* if (error != LFG_TELEPORTERROR_OK) player->GetSession()->SendLfgTeleportError(uint8(error)); - TC_LOG_DEBUG(LOG_FILTER_LFG, "TeleportPlayer: Player %s is being teleported in to map %u " + TC_LOG_DEBUG("lfg.teleport", "Player %s is being teleported in to map %u " "(x: %f, y: %f, z: %f) Result: %u", player->GetName().c_str(), dungeon->map, dungeon->x, dungeon->y, dungeon->z, error); } @@ -1397,13 +1394,13 @@ void LFGMgr::FinishDungeon(uint64 gguid, const uint32 dungeonId) uint32 gDungeonId = GetDungeon(gguid); if (gDungeonId != dungeonId) { - TC_LOG_DEBUG(LOG_FILTER_LFG, "LFGMgr::FinishDungeon: [" UI64FMTD "] Finished dungeon %u but group queued for %u. Ignoring", gguid, dungeonId, gDungeonId); + TC_LOG_DEBUG("lfg.dungeon.finish", "Group %u finished dungeon %u but queued for %u", GUID_LOPART(gguid), dungeonId, gDungeonId); return; } if (GetState(gguid) == LFG_STATE_FINISHED_DUNGEON) // Shouldn't happen. Do not reward multiple times { - TC_LOG_DEBUG(LOG_FILTER_LFG, "LFGMgr::FinishDungeon: [" UI64FMTD "] Already rewarded group. Ignoring", gguid); + TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u already rewarded", GUID_LOPART(gguid)); return; } @@ -1415,7 +1412,7 @@ void LFGMgr::FinishDungeon(uint64 gguid, const uint32 dungeonId) uint64 guid = (*it); if (GetState(guid) == LFG_STATE_FINISHED_DUNGEON) { - TC_LOG_DEBUG(LOG_FILTER_LFG, "LFGMgr::FinishDungeon: [" UI64FMTD "] Already rewarded player. Ignoring", guid); + TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u already rewarded", GUID_LOPART(gguid), GUID_LOPART(guid)); continue; } @@ -1431,14 +1428,14 @@ void LFGMgr::FinishDungeon(uint64 gguid, const uint32 dungeonId) if (!dungeon || (dungeon->type != LFG_TYPE_RANDOM && !dungeon->seasonal)) { - TC_LOG_DEBUG(LOG_FILTER_LFG, "LFGMgr::FinishDungeon: [" UI64FMTD "] dungeon %u is not random or seasonal", guid, rDungeonId); + TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u dungeon %u is not random or seasonal", GUID_LOPART(gguid), GUID_LOPART(guid), rDungeonId); continue; } Player* player = ObjectAccessor::FindPlayer(guid); if (!player || !player->IsInWorld()) { - TC_LOG_DEBUG(LOG_FILTER_LFG, "LFGMgr::FinishDungeon: [" UI64FMTD "] not found in world", guid); + TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u not found in world", GUID_LOPART(gguid), GUID_LOPART(guid)); continue; } @@ -1447,7 +1444,7 @@ void LFGMgr::FinishDungeon(uint64 gguid, const uint32 dungeonId) if (player->GetMapId() != mapId) { - TC_LOG_DEBUG(LOG_FILTER_LFG, "LFGMgr::FinishDungeon: [" UI64FMTD "] is in map %u and should be in %u to get reward", guid, player->GetMapId(), mapId); + TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u is in map %u and should be in %u to get reward", GUID_LOPART(gguid), GUID_LOPART(guid), player->GetMapId(), mapId); continue; } @@ -1478,7 +1475,7 @@ void LFGMgr::FinishDungeon(uint64 gguid, const uint32 dungeonId) } // Give rewards - TC_LOG_DEBUG(LOG_FILTER_LFG, "LFGMgr::FinishDungeon: [" UI64FMTD "] done dungeon %u, %s previously done.", player->GetGUID(), GetDungeon(gguid), done? " " : " not"); + TC_LOG_DEBUG("lfg.dungeon.finish", "Group: %u, Player: %u done dungeon %u, %s previously done.", GUID_LOPART(gguid), GUID_LOPART(guid), GetDungeon(gguid), done? " " : " not"); LfgPlayerRewardData data = LfgPlayerRewardData(dungeon->Entry(), GetDungeon(gguid, false), done, quest); player->GetSession()->SendLfgPlayerReward(data); } @@ -1542,11 +1539,16 @@ LfgState LFGMgr::GetState(uint64 guid) { LfgState state; if (IS_GROUP_GUID(guid)) + { state = GroupsStore[guid].GetState(); + TC_LOG_TRACE("lfg.data.group.state.get", "Group: %u, State: %u", GUID_LOPART(guid), state); + } else + { state = PlayersStore[guid].GetState(); + TC_LOG_TRACE("lfg.data.player.state.get", "Player: %u, State: %u", GUID_LOPART(guid), state); + } - TC_LOG_TRACE(LOG_FILTER_LFG, "LFGMgr::GetState: [" UI64FMTD "] = %u", guid, state); return state; } @@ -1554,18 +1556,23 @@ LfgState LFGMgr::GetOldState(uint64 guid) { LfgState state; if (IS_GROUP_GUID(guid)) + { state = GroupsStore[guid].GetOldState(); + TC_LOG_TRACE("lfg.data.group.oldstate.get", "Group: %u, Old state: %u", GUID_LOPART(guid), state); + } else + { state = PlayersStore[guid].GetOldState(); + TC_LOG_TRACE("lfg.data.player.oldstate.get", "Player: %u, Old state: %u", GUID_LOPART(guid), state); + } - TC_LOG_TRACE(LOG_FILTER_LFG, "LFGMgr::GetOldState: [" UI64FMTD "] = %u", guid, state); return state; } uint32 LFGMgr::GetDungeon(uint64 guid, bool asId /*= true */) { uint32 dungeon = GroupsStore[guid].GetDungeon(asId); - TC_LOG_TRACE(LOG_FILTER_LFG, "LFGMgr::GetDungeon: [" UI64FMTD "] asId: %u = %u", guid, asId, dungeon); + TC_LOG_TRACE("lfg.data.group.dungeon.get", "Group: %u, asId: %u, Dungeon: %u", GUID_LOPART(guid), asId, dungeon); return dungeon; } @@ -1577,39 +1584,40 @@ uint32 LFGMgr::GetDungeonMapId(uint64 guid) if (LFGDungeonData const* dungeon = GetLFGDungeon(dungeonId)) mapId = dungeon->map; - TC_LOG_TRACE(LOG_FILTER_LFG, "LFGMgr::GetDungeonMapId: [" UI64FMTD "] = %u (DungeonId = %u)", guid, mapId, dungeonId); + TC_LOG_TRACE("lfg.data.group.dungeon.map", "Group: %u, MapId: %u (DungeonId: %u)", GUID_LOPART(guid), mapId, dungeonId); + return mapId; } uint8 LFGMgr::GetRoles(uint64 guid) { uint8 roles = PlayersStore[guid].GetRoles(); - TC_LOG_TRACE(LOG_FILTER_LFG, "LFGMgr::GetRoles: [" UI64FMTD "] = %u", guid, roles); + TC_LOG_TRACE("lfg.data.player.role.get", "Player: %u, Role: %u", GUID_LOPART(guid), roles); return roles; } const std::string& LFGMgr::GetComment(uint64 guid) { - TC_LOG_TRACE(LOG_FILTER_LFG, "LFGMgr::GetComment: [" UI64FMTD "] = %s", guid, PlayersStore[guid].GetComment().c_str()); + TC_LOG_TRACE("lfg.data.player.comment.get", "Player: %u, Comment: %s", GUID_LOPART(guid), PlayersStore[guid].GetComment().c_str()); return PlayersStore[guid].GetComment(); } LfgDungeonSet const& LFGMgr::GetSelectedDungeons(uint64 guid) { - TC_LOG_TRACE(LOG_FILTER_LFG, "LFGMgr::GetSelectedDungeons: [" UI64FMTD "]", guid); + TC_LOG_TRACE("lfg.data.player.dungeons.selected.get", "Player: %u, Selected Dungeons: %s", GUID_LOPART(guid), ConcatenateDungeons(PlayersStore[guid].GetSelectedDungeons()).c_str()); return PlayersStore[guid].GetSelectedDungeons(); } LfgLockMap const& LFGMgr::GetLockedDungeons(uint64 guid) { - TC_LOG_TRACE(LOG_FILTER_LFG, "LFGMgr::GetLockedDungeons: [" UI64FMTD "]", guid); + TC_LOG_TRACE("lfg.data.player.dungeons.locked.get", "Player: %u, LockedDungeons.", GUID_LOPART(guid)); return PlayersStore[guid].GetLockedDungeons(); } uint8 LFGMgr::GetKicksLeft(uint64 guid) { uint8 kicks = GroupsStore[guid].GetKicksLeft(); - TC_LOG_TRACE(LOG_FILTER_LFG, "LFGMgr::GetKicksLeft: [" UI64FMTD "] = %u", guid, kicks); + TC_LOG_TRACE("lfg.data.group.kickleft.get", "Group: %u, Kicks left: %u", GUID_LOPART(guid), kicks); return kicks; } @@ -1618,26 +1626,19 @@ void LFGMgr::RestoreState(uint64 guid, char const* debugMsg) if (IS_GROUP_GUID(guid)) { LfgGroupData& data = GroupsStore[guid]; - if (sLog->ShouldLog(LOG_FILTER_LFG, LOG_LEVEL_DEBUG)) - { - std::string const& ps = GetStateString(data.GetState()); - std::string const& os = GetStateString(data.GetOldState()); - TC_LOG_TRACE(LOG_FILTER_LFG, "LFGMgr::RestoreState: Group: [" UI64FMTD "] (%s) State: %s, oldState: %s", - guid, debugMsg, ps.c_str(), os.c_str()); - } + TC_LOG_TRACE("lfg.data.group.state.restore", "Group: %u (%s), State: %s, Old state: %s", + GUID_LOPART(guid), debugMsg, GetStateString(data.GetState()).c_str(), + GetStateString(data.GetOldState()).c_str()); data.RestoreState(); } else { LfgPlayerData& data = PlayersStore[guid]; - if (sLog->ShouldLog(LOG_FILTER_LFG, LOG_LEVEL_DEBUG)) - { - std::string const& ps = GetStateString(data.GetState()); - std::string const& os = GetStateString(data.GetOldState()); - TC_LOG_TRACE(LOG_FILTER_LFG, "LFGMgr::RestoreState: Player: [" UI64FMTD "] (%s) State: %s, oldState: %s", - guid, debugMsg, ps.c_str(), os.c_str()); - } + TC_LOG_TRACE("lfg.data.player.state.restore", "Player: %u (%s), State: %s, Old state: %s", + GUID_LOPART(guid), debugMsg, GetStateString(data.GetState()).c_str(), + GetStateString(data.GetOldState()).c_str()); + data.RestoreState(); } } @@ -1647,70 +1648,62 @@ void LFGMgr::SetState(uint64 guid, LfgState state) if (IS_GROUP_GUID(guid)) { LfgGroupData& data = GroupsStore[guid]; - if (sLog->ShouldLog(LOG_FILTER_LFG, LOG_LEVEL_TRACE)) - { - std::string const& ns = GetStateString(state); - std::string const& ps = GetStateString(data.GetState()); - std::string const& os = GetStateString(data.GetOldState()); - TC_LOG_TRACE(LOG_FILTER_LFG, "LFGMgr::SetState: Group: [" UI64FMTD "] newState: %s, previous: %s, oldState: %s", - guid, ns.c_str(), ps.c_str(), os.c_str()); - } + TC_LOG_TRACE("lfg.data.group.state.set", "Group: %u, New state: %s, Previous: %s, Old state: %s", + GUID_LOPART(guid), GetStateString(state).c_str(), GetStateString(data.GetState()).c_str(), + GetStateString(data.GetOldState()).c_str()); + data.SetState(state); } else { LfgPlayerData& data = PlayersStore[guid]; - if (sLog->ShouldLog(LOG_FILTER_LFG, LOG_LEVEL_TRACE)) - { - std::string const& ns = GetStateString(state); - std::string const& ps = GetStateString(data.GetState()); - std::string const& os = GetStateString(data.GetOldState()); - TC_LOG_TRACE(LOG_FILTER_LFG, "LFGMgr::SetState: Player: [" UI64FMTD "] newState: %s, previous: %s, oldState: %s", - guid, ns.c_str(), ps.c_str(), os.c_str()); - } + TC_LOG_TRACE("lfg.data.player.state.set", "Player: %u, New state: %s, Previous: %s, OldState: %s", + GUID_LOPART(guid), GetStateString(state).c_str(), GetStateString(data.GetState()).c_str(), + GetStateString(data.GetOldState()).c_str()); + data.SetState(state); } } void LFGMgr::SetDungeon(uint64 guid, uint32 dungeon) { - TC_LOG_TRACE(LOG_FILTER_LFG, "LFGMgr::SetDungeon: [" UI64FMTD "] dungeon %u", guid, dungeon); + TC_LOG_TRACE("lfg.data.group.dungeon.set", "Group: %u, Dungeon: %u", GUID_LOPART(guid), dungeon); GroupsStore[guid].SetDungeon(dungeon); } void LFGMgr::SetRoles(uint64 guid, uint8 roles) { - TC_LOG_TRACE(LOG_FILTER_LFG, "LFGMgr::SetRoles: [" UI64FMTD "] roles: %u", guid, roles); + TC_LOG_TRACE("lfg.data.player.role.set", "Player: %u, Roles: %u", GUID_LOPART(guid), roles); PlayersStore[guid].SetRoles(roles); } void LFGMgr::SetComment(uint64 guid, std::string const& comment) { - TC_LOG_TRACE(LOG_FILTER_LFG, "LFGMgr::SetComment: [" UI64FMTD "] comment: %s", guid, comment.c_str()); + TC_LOG_TRACE("lfg.data.player.comment.set", "Player: %u, Comment: %s", GUID_LOPART(guid), comment.c_str()); PlayersStore[guid].SetComment(comment); } void LFGMgr::SetSelectedDungeons(uint64 guid, LfgDungeonSet const& dungeons) { - TC_LOG_TRACE(LOG_FILTER_LFG, "LFGMgr::SetSelectedDungeons: [" UI64FMTD "] Dungeons: %s", guid, ConcatenateDungeons(dungeons).c_str()); + TC_LOG_TRACE("lfg.data.player.dungeon.selected.set", "Player: %u, Dungeons: %s", GUID_LOPART(guid), ConcatenateDungeons(dungeons).c_str()); PlayersStore[guid].SetSelectedDungeons(dungeons); } void LFGMgr::SetLockedDungeons(uint64 guid, LfgLockMap const& lock) { - TC_LOG_TRACE(LOG_FILTER_LFG, "LFGMgr::SetLockedDungeons: [" UI64FMTD "]", guid); + TC_LOG_TRACE("lfg.data.player.dungeon.locked.set", "Player: %u, LockedDungeons", GUID_LOPART(guid)); PlayersStore[guid].SetLockedDungeons(lock); } void LFGMgr::DecreaseKicksLeft(uint64 guid) { - TC_LOG_TRACE(LOG_FILTER_LFG, "LFGMgr::DecreaseKicksLeft: [" UI64FMTD "]", guid); GroupsStore[guid].DecreaseKicksLeft(); + TC_LOG_TRACE("lfg.data.group.kicksleft.decrease", "Group: %u, Kicks: %u", GUID_LOPART(guid), GroupsStore[guid].GetKicksLeft()); } void LFGMgr::RemovePlayerData(uint64 guid) { - TC_LOG_TRACE(LOG_FILTER_LFG, "LFGMgr::RemovePlayerData: [" UI64FMTD "]", guid); + TC_LOG_TRACE("lfg.data.player.remove", "Player: %u", GUID_LOPART(guid)); LfgPlayerDataContainer::iterator it = PlayersStore.find(guid); if (it != PlayersStore.end()) PlayersStore.erase(it); @@ -1718,7 +1711,7 @@ void LFGMgr::RemovePlayerData(uint64 guid) void LFGMgr::RemoveGroupData(uint64 guid) { - TC_LOG_TRACE(LOG_FILTER_LFG, "LFGMgr::RemoveGroupData: [" UI64FMTD "]", guid); + TC_LOG_TRACE("lfg.data.group.remove", "Group: %u", GUID_LOPART(guid)); LfgGroupDataContainer::iterator it = GroupsStore.find(guid); if (it == GroupsStore.end()) return; @@ -1741,7 +1734,9 @@ void LFGMgr::RemoveGroupData(uint64 guid) uint8 LFGMgr::GetTeam(uint64 guid) { - return PlayersStore[guid].GetTeam(); + uint8 team = PlayersStore[guid].GetTeam(); + TC_LOG_TRACE("lfg.data.player.team.get", "Player: %u, Team: %u", GUID_LOPART(guid), team); + return team; } uint8 LFGMgr::RemovePlayerFromGroup(uint64 gguid, uint64 guid) diff --git a/src/server/game/DungeonFinding/LFGQueue.cpp b/src/server/game/DungeonFinding/LFGQueue.cpp index 178855e25e8..14f09fc6161 100644 --- a/src/server/game/DungeonFinding/LFGQueue.cpp +++ b/src/server/game/DungeonFinding/LFGQueue.cpp @@ -88,7 +88,7 @@ void LFGQueue::AddToQueue(uint64 guid) LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(guid); if (itQueue == QueueDataStore.end()) { - TC_LOG_ERROR(LOG_FILTER_LFG, "LFGQueue::AddToQueue: Queue data not found for [" UI64FMTD "]", guid); + TC_LOG_ERROR("lfg.queue.add", "Queue data not found for [" UI64FMTD "]", guid); return; } @@ -194,7 +194,7 @@ void LFGQueue::RemoveFromCompatibles(uint64 guid) out << guid; std::string strGuid = out.str(); - TC_LOG_DEBUG(LOG_FILTER_LFG, "LFGQueue::RemoveFromCompatibles: Removing [" UI64FMTD "]", guid); + TC_LOG_DEBUG("lfg.queue.data.compatibles.remove", "Removing [" UI64FMTD "]", guid); for (LfgCompatibleContainer::iterator itNext = CompatibleMapStore.begin(); itNext != CompatibleMapStore.end();) { LfgCompatibleContainer::iterator it = itNext++; @@ -251,7 +251,7 @@ uint8 LFGQueue::FindGroups() while (!newToQueueStore.empty()) { uint64 frontguid = newToQueueStore.front(); - TC_LOG_DEBUG(LOG_FILTER_LFG, "LFGQueue::FindGroups: checking [" UI64FMTD "] newToQueue(%u), currentQueue(%u)", frontguid, uint32(newToQueueStore.size()), uint32(currentQueueStore.size())); + TC_LOG_DEBUG("lfg.queue.match.check.new", "Checking [" UI64FMTD "] newToQueue(%u), currentQueue(%u)", frontguid, uint32(newToQueueStore.size()), uint32(currentQueueStore.size())); firstNew.clear(); firstNew.push_back(frontguid); RemoveFromNewQueue(frontguid); @@ -279,13 +279,13 @@ LfgCompatibility LFGQueue::FindNewGroups(LfgGuidList& check, LfgGuidList& all) std::string strGuids = ConcatenateGuids(check); LfgCompatibility compatibles = GetCompatibles(strGuids); - TC_LOG_DEBUG(LOG_FILTER_LFG, "LFGQueue::FindNewGroup: (%s): %s - all(%s)", strGuids.c_str(), GetCompatibleString(compatibles), ConcatenateGuids(all).c_str()); + TC_LOG_DEBUG("lfg.queue.match.check", "Guids: (%s): %s - all(%s)", strGuids.c_str(), GetCompatibleString(compatibles), ConcatenateGuids(all).c_str()); if (compatibles == LFG_COMPATIBILITY_PENDING) // Not previously cached, calculate compatibles = CheckCompatibility(check); if (compatibles == LFG_COMPATIBLES_BAD_STATES && sLFGMgr->AllQueued(check)) { - TC_LOG_DEBUG(LOG_FILTER_LFG, "LFGQueue::FindNewGroup: (%s) compatibles (cached) changed from bad states to match", strGuids.c_str()); + TC_LOG_DEBUG("lfg.queue.match.check", "Guids: (%s) compatibles (cached) changed from bad states to match", strGuids.c_str()); SetCompatibles(strGuids, LFG_COMPATIBLES_MATCH); return LFG_COMPATIBLES_MATCH; } @@ -323,7 +323,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check) // Check for correct size if (check.size() > MAXGROUPSIZE || check.empty()) { - TC_LOG_DEBUG(LOG_FILTER_LFG, "LFGQueue::CheckCompatibility: (%s): Size wrong - Not compatibles", strGuids.c_str()); + TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: (%s): Size wrong - Not compatibles", strGuids.c_str()); return LFG_INCOMPATIBLES_WRONG_GROUP_SIZE; } @@ -337,7 +337,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check) LfgCompatibility child_compatibles = CheckCompatibility(check); if (child_compatibles < LFG_COMPATIBLES_WITH_LESS_PLAYERS) // Group not compatible { - TC_LOG_DEBUG(LOG_FILTER_LFG, "LFGQueue::CheckCompatibility: (%s) child %s not compatibles", strGuids.c_str(), ConcatenateGuids(check).c_str()); + TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: (%s) child %s not compatibles", strGuids.c_str(), ConcatenateGuids(check).c_str()); SetCompatibles(strGuids, child_compatibles); return child_compatibles; } @@ -353,7 +353,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check) LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(guid); if (itQueue == QueueDataStore.end()) { - TC_LOG_ERROR(LOG_FILTER_LFG, "LFGQueue::CheckCompatibility: [" UI64FMTD "] is not queued but listed as queued!", guid); + TC_LOG_ERROR("lfg.queue.match.compatibility.check", "Guid: [" UI64FMTD "] is not queued but listed as queued!", guid); RemoveFromQueue(guid); return LFG_COMPATIBILITY_PENDING; } @@ -375,7 +375,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check) // Group with less that MAXGROUPSIZE members always compatible if (check.size() == 1 && numPlayers != MAXGROUPSIZE) { - TC_LOG_DEBUG(LOG_FILTER_LFG, "LFGQueue::CheckCompatibility: (%s) sigle group. Compatibles", strGuids.c_str()); + TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: (%s) sigle group. Compatibles", strGuids.c_str()); LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(check.front()); LfgCompatibilityData data(LFG_COMPATIBLES_WITH_LESS_PLAYERS); @@ -389,14 +389,14 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check) if (numLfgGroups > 1) { - TC_LOG_DEBUG(LOG_FILTER_LFG, "LFGQueue::CheckCompatibility: (%s) More than one Lfggroup (%u)", strGuids.c_str(), numLfgGroups); + TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: (%s) More than one Lfggroup (%u)", strGuids.c_str(), numLfgGroups); SetCompatibles(strGuids, LFG_INCOMPATIBLES_MULTIPLE_LFG_GROUPS); return LFG_INCOMPATIBLES_MULTIPLE_LFG_GROUPS; } if (numPlayers > MAXGROUPSIZE) { - TC_LOG_DEBUG(LOG_FILTER_LFG, "LFGQueue::CheckCompatibility: (%s) Too much players (%u)", strGuids.c_str(), numPlayers); + TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: (%s) Too much players (%u)", strGuids.c_str(), numPlayers); SetCompatibles(strGuids, LFG_INCOMPATIBLES_TOO_MUCH_PLAYERS); return LFG_INCOMPATIBLES_TOO_MUCH_PLAYERS; } @@ -413,7 +413,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check) for (itPlayer = proposalRoles.begin(); itPlayer != proposalRoles.end(); ++itPlayer) { if (itRoles->first == itPlayer->first) - TC_LOG_ERROR(LOG_FILTER_LFG, "LFGQueue::CheckCompatibility: ERROR! Player multiple times in queue! [" UI64FMTD "]", itRoles->first); + TC_LOG_ERROR("lfg.queue.match.compatibility.check", "Guids: ERROR! Player multiple times in queue! [" UI64FMTD "]", itRoles->first); else if (sLFGMgr->HasIgnore(itRoles->first, itPlayer->first)) break; } @@ -424,7 +424,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check) if (uint8 playersize = numPlayers - proposalRoles.size()) { - TC_LOG_DEBUG(LOG_FILTER_LFG, "LFGQueue::CheckCompatibility: (%s) not compatible, %u players are ignoring each other", strGuids.c_str(), playersize); + TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: (%s) not compatible, %u players are ignoring each other", strGuids.c_str(), playersize); SetCompatibles(strGuids, LFG_INCOMPATIBLES_HAS_IGNORES); return LFG_INCOMPATIBLES_HAS_IGNORES; } @@ -436,7 +436,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check) for (LfgRolesMap::const_iterator it = debugRoles.begin(); it != debugRoles.end(); ++it) o << ", " << it->first << ": " << GetRolesString(it->second); - TC_LOG_DEBUG(LOG_FILTER_LFG, "LFGQueue::CheckCompatibility: (%s) Roles not compatible%s", strGuids.c_str(), o.str().c_str()); + TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: (%s) Roles not compatible%s", strGuids.c_str(), o.str().c_str()); SetCompatibles(strGuids, LFG_INCOMPATIBLES_NO_ROLES); return LFG_INCOMPATIBLES_NO_ROLES; } @@ -456,7 +456,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check) if (proposalDungeons.empty()) { - TC_LOG_DEBUG(LOG_FILTER_LFG, "LFGQueue::CheckCompatibility: (%s) No compatible dungeons%s", strGuids.c_str(), o.str().c_str()); + TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: (%s) No compatible dungeons%s", strGuids.c_str(), o.str().c_str()); SetCompatibles(strGuids, LFG_INCOMPATIBLES_NO_DUNGEONS); return LFG_INCOMPATIBLES_NO_DUNGEONS; } @@ -473,7 +473,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check) // Enough players? if (numPlayers != MAXGROUPSIZE) { - TC_LOG_DEBUG(LOG_FILTER_LFG, "LFGQueue::CheckCompatibility: (%s) Compatibles but not enough players(%u)", strGuids.c_str(), numPlayers); + TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: (%s) Compatibles but not enough players(%u)", strGuids.c_str(), numPlayers); LfgCompatibilityData data(LFG_COMPATIBLES_WITH_LESS_PLAYERS); data.roles = proposalRoles; @@ -490,7 +490,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check) if (!sLFGMgr->AllQueued(check)) { - TC_LOG_DEBUG(LOG_FILTER_LFG, "LFGQueue::CheckCompatibility: (%s) Group MATCH but can't create proposal!", strGuids.c_str()); + TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: (%s) Group MATCH but can't create proposal!", strGuids.c_str()); SetCompatibles(strGuids, LFG_COMPATIBLES_BAD_STATES); return LFG_COMPATIBLES_BAD_STATES; } @@ -532,14 +532,14 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check) sLFGMgr->AddProposal(proposal); - TC_LOG_DEBUG(LOG_FILTER_LFG, "LFGQueue::CheckCompatibility: (%s) MATCH! Group formed", strGuids.c_str()); + TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: (%s) MATCH! Group formed", strGuids.c_str()); SetCompatibles(strGuids, LFG_COMPATIBLES_MATCH); return LFG_COMPATIBLES_MATCH; } void LFGQueue::UpdateQueueTimers(time_t currTime) { - TC_LOG_TRACE(LOG_FILTER_LFG, "Updating queue timers..."); + TC_LOG_TRACE("lfg.queue.timers.update", "Updating queue timers..."); for (LfgQueueDataContainer::iterator itQueue = QueueDataStore.begin(); itQueue != QueueDataStore.end(); ++itQueue) { LfgQueueData& queueinfo = itQueue->second; @@ -631,7 +631,7 @@ std::string LFGQueue::DumpCompatibleInfo(bool full /* = false */) const void LFGQueue::FindBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQueue) { - TC_LOG_DEBUG(LOG_FILTER_LFG, "LFGQueue::FindBestCompatibleInQueue: " UI64FMTD, itrQueue->first); + TC_LOG_DEBUG("lfg.queue.compatibles.find", "Guid: " UI64FMTD, itrQueue->first); std::ostringstream o; o << itrQueue->first; std::string sguid = o.str(); @@ -656,7 +656,7 @@ void LFGQueue::UpdateBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQu if (size <= storedSize) return; - TC_LOG_DEBUG(LOG_FILTER_LFG, "LFGQueue::UpdateBestCompatibleInQueue: Changed (%s) to (%s) as best compatible group for " UI64FMTD, + TC_LOG_DEBUG("lfg.queue.compatibles.update", "Changed (%s) to (%s) as best compatible group for " UI64FMTD, queueData.bestCompatible.c_str(), key.c_str(), itrQueue->first); queueData.bestCompatible = key; diff --git a/src/server/game/DungeonFinding/LFGScripts.cpp b/src/server/game/DungeonFinding/LFGScripts.cpp index 2a4096a45ae..5f4e5c664a0 100644 --- a/src/server/game/DungeonFinding/LFGScripts.cpp +++ b/src/server/game/DungeonFinding/LFGScripts.cpp @@ -68,7 +68,7 @@ void LFGPlayerScript::OnLogin(Player* player) uint64 gguid2 = group->GetGUID(); if (gguid != gguid2) { - TC_LOG_ERROR(LOG_FILTER_LFG, "%s on group %u but LFG has group %u saved... Fixing.", + TC_LOG_ERROR("lfg", "%s on group %u but LFG has group %u saved... Fixing.", player->GetSession()->GetPlayerInfo().c_str(), GUID_LOPART(gguid2), GUID_LOPART(gguid)); sLFGMgr->SetupGroupMember(guid, group->GetGUID()); } @@ -102,7 +102,7 @@ void LFGPlayerScript::OnMapChanged(Player* player) sLFGMgr->LeaveLfg(player->GetGUID()); player->RemoveAurasDueToSpell(LFG_SPELL_LUCK_OF_THE_DRAW); player->TeleportTo(player->m_homebindMapId, player->m_homebindX, player->m_homebindY, player->m_homebindZ, 0.0f); - TC_LOG_ERROR(LOG_FILTER_LFG, "LFGPlayerScript::OnMapChanged, Player %s (%u) is in LFG dungeon map but does not have a valid group! " + TC_LOG_ERROR("lfg", "LFGPlayerScript::OnMapChanged, Player %s (%u) is in LFG dungeon map but does not have a valid group! " "Teleporting to homebind.", player->GetName().c_str(), player->GetGUIDLow()); return; } @@ -130,14 +130,14 @@ void LFGGroupScript::OnAddMember(Group* group, uint64 guid) if (leader == guid) { - TC_LOG_DEBUG(LOG_FILTER_LFG, "LFGScripts::OnAddMember [" UI64FMTD "]: added [" UI64FMTD "] leader " UI64FMTD "]", gguid, guid, leader); + TC_LOG_DEBUG("lfg", "LFGScripts::OnAddMember [" UI64FMTD "]: added [" UI64FMTD "] leader " UI64FMTD "]", gguid, guid, leader); sLFGMgr->SetLeader(gguid, guid); } else { LfgState gstate = sLFGMgr->GetState(gguid); LfgState state = sLFGMgr->GetState(guid); - TC_LOG_DEBUG(LOG_FILTER_LFG, "LFGScripts::OnAddMember [" UI64FMTD "]: added [" UI64FMTD "] leader " UI64FMTD "] gstate: %u, state: %u", gguid, guid, leader, gstate, state); + TC_LOG_DEBUG("lfg", "LFGScripts::OnAddMember [" UI64FMTD "]: added [" UI64FMTD "] leader " UI64FMTD "] gstate: %u, state: %u", gguid, guid, leader, gstate, state); if (state == LFG_STATE_QUEUED) sLFGMgr->LeaveLfg(guid); @@ -156,7 +156,7 @@ void LFGGroupScript::OnRemoveMember(Group* group, uint64 guid, RemoveMethod meth return; uint64 gguid = group->GetGUID(); - TC_LOG_DEBUG(LOG_FILTER_LFG, "LFGScripts::OnRemoveMember [" UI64FMTD "]: remove [" UI64FMTD "] Method: %d Kicker: [" UI64FMTD "] Reason: %s", gguid, guid, method, kicker, (reason ? reason : "")); + TC_LOG_DEBUG("lfg", "LFGScripts::OnRemoveMember [" UI64FMTD "]: remove [" UI64FMTD "] Method: %d Kicker: [" UI64FMTD "] Reason: %s", gguid, guid, method, kicker, (reason ? reason : "")); bool isLFG = group->isLFGGroup(); @@ -209,7 +209,7 @@ void LFGGroupScript::OnDisband(Group* group) return; uint64 gguid = group->GetGUID(); - TC_LOG_DEBUG(LOG_FILTER_LFG, "LFGScripts::OnDisband [" UI64FMTD "]", gguid); + TC_LOG_DEBUG("lfg", "LFGScripts::OnDisband [" UI64FMTD "]", gguid); sLFGMgr->RemoveGroupData(gguid); } @@ -221,7 +221,7 @@ void LFGGroupScript::OnChangeLeader(Group* group, uint64 newLeaderGuid, uint64 o uint64 gguid = group->GetGUID(); - TC_LOG_DEBUG(LOG_FILTER_LFG, "LFGScripts::OnChangeLeader [" UI64FMTD "]: old [" UI64FMTD "] new [" UI64FMTD "]", gguid, newLeaderGuid, oldLeaderGuid); + TC_LOG_DEBUG("lfg", "LFGScripts::OnChangeLeader [" UI64FMTD "]: old [" UI64FMTD "] new [" UI64FMTD "]", gguid, newLeaderGuid, oldLeaderGuid); sLFGMgr->SetLeader(gguid, newLeaderGuid); } @@ -232,7 +232,7 @@ void LFGGroupScript::OnInviteMember(Group* group, uint64 guid) uint64 gguid = group->GetGUID(); uint64 leader = group->GetLeaderGUID(); - TC_LOG_DEBUG(LOG_FILTER_LFG, "LFGScripts::OnInviteMember [" UI64FMTD "]: invite [" UI64FMTD "] leader [" UI64FMTD "]", gguid, guid, leader); + TC_LOG_DEBUG("lfg", "LFGScripts::OnInviteMember [" UI64FMTD "]: invite [" UI64FMTD "] leader [" UI64FMTD "]", gguid, guid, leader); // No gguid == new group being formed // No leader == after group creation first invite is new leader // leader and no gguid == first invite after leader is added to new group (this is the real invite) diff --git a/src/server/game/Entities/Corpse/Corpse.cpp b/src/server/game/Entities/Corpse/Corpse.cpp index 58e21b5096c..9d3ee045c61 100644 --- a/src/server/game/Entities/Corpse/Corpse.cpp +++ b/src/server/game/Entities/Corpse/Corpse.cpp @@ -76,7 +76,7 @@ bool Corpse::Create(uint32 guidlow, Player* owner) if (!IsPositionValid()) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Corpse (guidlow %d, owner %s) not created. Suggested coordinates isn't valid (X: %f Y: %f)", + TC_LOG_ERROR("entities.player", "Corpse (guidlow %d, owner %s) not created. Suggested coordinates isn't valid (X: %f Y: %f)", guidlow, owner->GetName().c_str(), owner->GetPositionX(), owner->GetPositionY()); return false; } @@ -133,7 +133,7 @@ void Corpse::DeleteBonesFromWorld() if (!corpse) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Bones %u not found in world.", GetGUIDLow()); + TC_LOG_ERROR("entities.player", "Bones %u not found in world.", GetGUIDLow()); return; } @@ -194,7 +194,7 @@ bool Corpse::LoadCorpseFromDB(uint32 guid, Field* fields) if (!IsPositionValid()) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Corpse (guid: %u, owner: %u) is not created, given coordinates are not valid (X: %f, Y: %f, Z: %f)", + TC_LOG_ERROR("entities.player", "Corpse (guid: %u, owner: %u) is not created, given coordinates are not valid (X: %f, Y: %f, Z: %f)", GetGUIDLow(), GUID_LOPART(GetOwnerGUID()), posX, posY, posZ); return false; } diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index e4fda515c8a..d039ee385ec 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -147,7 +147,7 @@ m_PlayerDamageReq(0), m_lootRecipient(0), m_lootRecipientGroup(0), m_corpseRemov m_respawnDelay(300), m_corpseDelay(60), m_respawnradius(0.0f), m_reactState(REACT_AGGRESSIVE), m_defaultMovementType(IDLE_MOTION_TYPE), m_DBTableGuid(0), m_equipmentId(0), m_originalEquipmentId(0), m_AlreadyCallAssistance(false), m_AlreadySearchedAssistance(false), m_regenHealth(true), m_AI_locked(false), m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL), -m_creatureInfo(NULL), m_creatureData(NULL), m_path_id(0), m_formation(NULL) +m_originalEntry(0), m_homePosition(), m_transportHomePosition(), m_creatureInfo(NULL), m_creatureData(NULL), m_waypointID(0), m_path_id(0), m_formation(NULL) { m_regenTimer = CREATURE_REGEN_INTERVAL; m_valuesCount = UNIT_END; @@ -174,7 +174,7 @@ Creature::~Creature() i_AI = NULL; //if (m_uint32Values) - // TC_LOG_ERROR(LOG_FILTER_UNITS, "Deconstruct Creature Entry = %u", GetEntry()); + // TC_LOG_ERROR("entities.unit", "Deconstruct Creature Entry = %u", GetEntry()); } void Creature::AddToWorld() @@ -262,7 +262,7 @@ bool Creature::InitEntry(uint32 entry, uint32 /*team*/, const CreatureData* data CreatureTemplate const* normalInfo = sObjectMgr->GetCreatureTemplate(entry); if (!normalInfo) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature::InitEntry creature entry %u does not exist.", entry); + TC_LOG_ERROR("sql.sql", "Creature::InitEntry creature entry %u does not exist.", entry); return false; } @@ -304,7 +304,7 @@ bool Creature::InitEntry(uint32 entry, uint32 /*team*/, const CreatureData* data // Cancel load if no model defined if (!(cinfo->GetFirstValidModelId())) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (Entry: %u) has no model defined in table `creature_template`, can't load. ", entry); + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has no model defined in table `creature_template`, can't load. ", entry); return false; } @@ -312,7 +312,7 @@ bool Creature::InitEntry(uint32 entry, uint32 /*team*/, const CreatureData* data CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelRandomGender(&displayID); if (!minfo) // Cancel load if no model defined { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (Entry: %u) has no model defined in table `creature_template`, can't load. ", entry); + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has no model defined in table `creature_template`, can't load. ", entry); return false; } @@ -457,11 +457,11 @@ void Creature::Update(uint32 diff) { case JUST_RESPAWNED: // Must not be called, see Creature::setDeathState JUST_RESPAWNED -> ALIVE promoting. - TC_LOG_ERROR(LOG_FILTER_UNITS, "Creature (GUID: %u Entry: %u) in wrong state: JUST_RESPAWNED (4)", GetGUIDLow(), GetEntry()); + TC_LOG_ERROR("entities.unit", "Creature (GUID: %u Entry: %u) in wrong state: JUST_RESPAWNED (4)", GetGUIDLow(), GetEntry()); break; case JUST_DIED: // Must not be called, see Creature::setDeathState JUST_DIED -> CORPSE promoting. - TC_LOG_ERROR(LOG_FILTER_UNITS, "Creature (GUID: %u Entry: %u) in wrong state: JUST_DEAD (1)", GetGUIDLow(), GetEntry()); + TC_LOG_ERROR("entities.unit", "Creature (GUID: %u Entry: %u) in wrong state: JUST_DEAD (1)", GetGUIDLow(), GetEntry()); break; case DEAD: { @@ -510,7 +510,7 @@ void Creature::Update(uint32 diff) else if (m_corpseRemoveTime <= time(NULL)) { RemoveCorpse(false); - TC_LOG_DEBUG(LOG_FILTER_UNITS, "Removing corpse... %u ", GetUInt32Value(OBJECT_FIELD_ENTRY)); + TC_LOG_DEBUG("entities.unit", "Removing corpse... %u ", GetUInt32Value(OBJECT_FIELD_ENTRY)); } break; } @@ -705,7 +705,7 @@ bool Creature::AIM_Initialize(CreatureAI* ai) // make sure nothing can change the AI during AI update if (m_AI_locked) { - TC_LOG_DEBUG(LOG_FILTER_TSCR, "AIM_Initialize: failed to init, locked."); + TC_LOG_DEBUG("scripts", "AIM_Initialize: failed to init, locked."); return false; } @@ -726,16 +726,16 @@ bool Creature::AIM_Initialize(CreatureAI* ai) void Creature::Motion_Initialize() { if (!m_formation) - i_motionMaster.Initialize(); + GetMotionMaster()->Initialize(); else if (m_formation->getLeader() == this) { m_formation->FormationReset(false); - i_motionMaster.Initialize(); + GetMotionMaster()->Initialize(); } else if (m_formation->isFormed()) - i_motionMaster.MoveIdle(); //wait the order of leader + GetMotionMaster()->MoveIdle(); //wait the order of leader else - i_motionMaster.Initialize(); + GetMotionMaster()->Initialize(); } bool Creature::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry, uint32 vehId, uint32 team, float x, float y, float z, float ang, const CreatureData* data) @@ -747,7 +747,7 @@ bool Creature::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry, CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(Entry); if (!cinfo) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature::Create(): creature template (guidlow: %u, entry: %u) does not exist.", guidlow, Entry); + TC_LOG_ERROR("sql.sql", "Creature::Create(): creature template (guidlow: %u, entry: %u) does not exist.", guidlow, Entry); return false; } @@ -761,7 +761,7 @@ bool Creature::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry, if (!IsPositionValid()) { - TC_LOG_ERROR(LOG_FILTER_UNITS, "Creature::Create(): given coordinates for creature (guidlow %d, entry %d) are not valid (X: %f, Y: %f, Z: %f, O: %f)", guidlow, Entry, x, y, z, ang); + TC_LOG_ERROR("entities.unit", "Creature::Create(): given coordinates for creature (guidlow %d, entry %d) are not valid (X: %f, Y: %f, Z: %f, O: %f)", guidlow, Entry, x, y, z, ang); return false; } @@ -930,7 +930,7 @@ void Creature::SaveToDB() CreatureData const* data = sObjectMgr->GetCreatureData(m_DBTableGuid); if (!data) { - TC_LOG_ERROR(LOG_FILTER_UNITS, "Creature::SaveToDB failed, cannot get creature data!"); + TC_LOG_ERROR("entities.unit", "Creature::SaveToDB failed, cannot get creature data!"); return; } @@ -1162,7 +1162,7 @@ bool Creature::CreateFromProto(uint32 guidlow, uint32 Entry, uint32 vehId, uint3 CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(Entry); if (!cinfo) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature::CreateFromProto(): creature template (guidlow: %u, entry: %u) does not exist.", guidlow, Entry); + TC_LOG_ERROR("sql.sql", "Creature::CreateFromProto(): creature template (guidlow: %u, entry: %u) does not exist.", guidlow, Entry); return false; } @@ -1188,7 +1188,7 @@ bool Creature::LoadCreatureFromDB(uint32 guid, Map* map, bool addToMap) if (!data) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (GUID: %u) not found in table `creature`, can't load. ", guid); + TC_LOG_ERROR("sql.sql", "Creature (GUID: %u) not found in table `creature`, can't load. ", guid); return false; } @@ -1304,7 +1304,7 @@ void Creature::DeleteFromDB() { if (!m_DBTableGuid) { - TC_LOG_ERROR(LOG_FILTER_UNITS, "Trying to delete not saved creature! LowGUID: %u, Entry: %u", GetGUIDLow(), GetEntry()); + TC_LOG_ERROR("entities.unit", "Trying to delete not saved creature! LowGUID: %u, Entry: %u", GetGUIDLow(), GetEntry()); return; } @@ -1337,7 +1337,7 @@ bool Creature::IsInvisibleDueToDespawn() const if (Unit::IsInvisibleDueToDespawn()) return true; - if (IsAlive() || m_corpseRemoveTime > time(NULL)) + if (IsAlive() || isDying() || m_corpseRemoveTime > time(NULL)) return false; return true; @@ -1461,7 +1461,7 @@ void Creature::setDeathState(DeathState s) m_formation->FormationReset(true); if ((CanFly() || IsFlying())) - i_motionMaster.MoveFall(); + GetMotionMaster()->MoveFall(); Unit::setDeathState(CORPSE); } @@ -1506,7 +1506,7 @@ void Creature::Respawn(bool force) if (m_DBTableGuid) GetMap()->RemoveCreatureRespawnTime(m_DBTableGuid); - TC_LOG_DEBUG(LOG_FILTER_UNITS, "Respawning creature %s (GuidLow: %u, Full GUID: " UI64FMTD " Entry: %u)", + TC_LOG_DEBUG("entities.unit", "Respawning creature %s (GuidLow: %u, Full GUID: " UI64FMTD " Entry: %u)", GetName().c_str(), GetGUIDLow(), GetGUID(), GetEntry()); m_respawnTime = 0; lootForPickPocketed = false; @@ -1533,7 +1533,11 @@ void Creature::Respawn(bool force) //Call AI respawn virtual function if (IsAIEnabled) + { + //reset the AI to be sure no dirty or uninitialized values will be used till next tick + AI()->Reset(); TriggerJustRespawned = true;//delay event to next tick so all creatures are created on the map before processing + } uint32 poolid = GetDBTableGUIDLow() ? sPoolMgr->IsPartOfAPool<Creature>(GetDBTableGUIDLow()) : 0; if (poolid) @@ -1638,7 +1642,7 @@ SpellInfo const* Creature::reachWithSpellAttack(Unit* victim) SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(m_spells[i]); if (!spellInfo) { - TC_LOG_ERROR(LOG_FILTER_UNITS, "WORLD: unknown spell id %i", m_spells[i]); + TC_LOG_ERROR("entities.unit", "WORLD: unknown spell id %i", m_spells[i]); continue; } @@ -1686,7 +1690,7 @@ SpellInfo const* Creature::reachWithSpellCure(Unit* victim) SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(m_spells[i]); if (!spellInfo) { - TC_LOG_ERROR(LOG_FILTER_UNITS, "WORLD: unknown spell id %i", m_spells[i]); + TC_LOG_ERROR("entities.unit", "WORLD: unknown spell id %i", m_spells[i]); continue; } @@ -1758,7 +1762,7 @@ Unit* Creature::SelectNearestTargetInAttackDistance(float dist) const if (dist > MAX_VISIBILITY_DISTANCE) { - TC_LOG_ERROR(LOG_FILTER_UNITS, "Creature (GUID: %u Entry: %u) SelectNearestTargetInAttackDistance called with dist > MAX_VISIBILITY_DISTANCE. Distance set to ATTACK_DISTANCE.", GetGUIDLow(), GetEntry()); + TC_LOG_ERROR("entities.unit", "Creature (GUID: %u Entry: %u) SelectNearestTargetInAttackDistance called with dist > MAX_VISIBILITY_DISTANCE. Distance set to ATTACK_DISTANCE.", GetGUIDLow(), GetEntry()); dist = ATTACK_DISTANCE; } @@ -1796,7 +1800,7 @@ void Creature::SendAIReaction(AiReaction reactionType) ((WorldObject*)this)->SendMessageToSet(&data, true); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_AI_REACTION, type %u.", reactionType); + TC_LOG_DEBUG("network", "WORLD: Sent SMSG_AI_REACTION, type %u.", reactionType); } void Creature::CallAssistance() @@ -2044,7 +2048,7 @@ bool Creature::LoadCreaturesAddon(bool reload) SpellInfo const* AdditionalSpellInfo = sSpellMgr->GetSpellInfo(*itr); if (!AdditionalSpellInfo) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (GUID: %u Entry: %u) has wrong spell %u defined in `auras` field.", GetGUIDLow(), GetEntry(), *itr); + TC_LOG_ERROR("sql.sql", "Creature (GUID: %u Entry: %u) has wrong spell %u defined in `auras` field.", GetGUIDLow(), GetEntry(), *itr); continue; } @@ -2052,13 +2056,13 @@ bool Creature::LoadCreaturesAddon(bool reload) if (HasAura(*itr)) { if (!reload) - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (GUID: %u Entry: %u) has duplicate aura (spell %u) in `auras` field.", GetDBTableGUIDLow(), GetEntry(), *itr); + TC_LOG_ERROR("sql.sql", "Creature (GUID: %u Entry: %u) has duplicate aura (spell %u) in `auras` field.", GetDBTableGUIDLow(), GetEntry(), *itr); continue; } AddAura(*itr, this); - TC_LOG_DEBUG(LOG_FILTER_UNITS, "Spell: %u added to creature (GUID: %u Entry: %u)", *itr, GetGUIDLow(), GetEntry()); + TC_LOG_DEBUG("entities.unit", "Spell: %u added to creature (GUID: %u Entry: %u)", *itr, GetGUIDLow(), GetEntry()); } } @@ -2079,7 +2083,7 @@ void Creature::SetInCombatWithZone() { if (!CanHaveThreatList()) { - TC_LOG_ERROR(LOG_FILTER_UNITS, "Creature entry %u call SetInCombatWithZone but creature cannot have threat list.", GetEntry()); + TC_LOG_ERROR("entities.unit", "Creature entry %u call SetInCombatWithZone but creature cannot have threat list.", GetEntry()); return; } @@ -2087,7 +2091,7 @@ void Creature::SetInCombatWithZone() if (!map->IsDungeon()) { - TC_LOG_ERROR(LOG_FILTER_UNITS, "Creature entry %u call SetInCombatWithZone for map (id: %u) that isn't an instance.", GetEntry(), map->GetId()); + TC_LOG_ERROR("entities.unit", "Creature entry %u call SetInCombatWithZone for map (id: %u) that isn't an instance.", GetEntry(), map->GetId()); return; } @@ -2417,7 +2421,7 @@ void Creature::SetPosition(float x, float y, float z, float o) // prevent crash when a bad coord is sent by the client if (!Trinity::IsValidMapCoord(x, y, z, o)) { - TC_LOG_DEBUG(LOG_FILTER_UNITS, "Creature::SetPosition(%f, %f, %f) .. bad coordinates!", x, y, z); + TC_LOG_DEBUG("entities.unit", "Creature::SetPosition(%f, %f, %f) .. bad coordinates!", x, y, z); return; } diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index 08d3610594f..7826fb30614 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -246,7 +246,10 @@ typedef UNORDERED_MAP<uint32, EquipmentInfoContainerInternal> EquipmentInfoConta // from `creature` table struct CreatureData { - CreatureData() : dbData(true) { } + CreatureData() : id(0), mapid(0), phaseMask(0), displayid(0), equipmentId(0), + posX(0.0f), posY(0.0f), posZ(0.0f), orientation(0.0f), spawntimesecs(0), + spawndist(0.0f), currentwaypoint(0), curhealth(0), curmana(0), movementType(0), + spawnMask(0), npcflag(0), unit_flags(0), dynamicflags(0), dbData(true) { } uint32 id; // entry in creature_template uint16 mapid; uint32 phaseMask; @@ -641,15 +644,15 @@ class Creature : public Unit, public GridObject<Creature>, public MapObject void GetTransportHomePosition(float &x, float &y, float &z, float &ori) { m_transportHomePosition.GetPosition(x, y, z, ori); } Position GetTransportHomePosition() { return m_transportHomePosition; } - uint32 GetWaypointPath(){return m_path_id;} + uint32 GetWaypointPath() const { return m_path_id; } void LoadPath(uint32 pathid) { m_path_id = pathid; } uint32 GetCurrentWaypointID() const { return m_waypointID; } void UpdateWaypointID(uint32 wpID) { m_waypointID = wpID; } void SearchFormation(); - CreatureGroup* GetFormation() {return m_formation;} - void SetFormation(CreatureGroup* formation) {m_formation = formation;} + CreatureGroup* GetFormation() { return m_formation; } + void SetFormation(CreatureGroup* formation) { m_formation = formation; } Unit* SelectVictim(); @@ -721,10 +724,10 @@ class Creature : public Unit, public GridObject<Creature>, public MapObject CreatureData const* m_creatureData; uint16 m_LootMode; // Bitmask (default: LOOT_MODE_DEFAULT) that determines what loot will be lootable - uint32 guid_transport; bool IsInvisibleDueToDespawn() const; bool CanAlwaysSee(WorldObject const* obj) const; + private: void ForcedDespawn(uint32 timeMSToDespawn = 0); diff --git a/src/server/game/Entities/Creature/CreatureGroups.cpp b/src/server/game/Entities/Creature/CreatureGroups.cpp index 2a3829b7aeb..fc56fc011d4 100644 --- a/src/server/game/Entities/Creature/CreatureGroups.cpp +++ b/src/server/game/Entities/Creature/CreatureGroups.cpp @@ -41,13 +41,13 @@ void FormationMgr::AddCreatureToGroup(uint32 groupId, Creature* member) //Add member to an existing group if (itr != map->CreatureGroupHolder.end()) { - TC_LOG_DEBUG(LOG_FILTER_UNITS, "Group found: %u, inserting creature GUID: %u, Group InstanceID %u", groupId, member->GetGUIDLow(), member->GetInstanceId()); + TC_LOG_DEBUG("entities.unit", "Group found: %u, inserting creature GUID: %u, Group InstanceID %u", groupId, member->GetGUIDLow(), member->GetInstanceId()); itr->second->AddMember(member); } //Create new group else { - TC_LOG_DEBUG(LOG_FILTER_UNITS, "Group not found: %u. Creating new group.", groupId); + TC_LOG_DEBUG("entities.unit", "Group not found: %u. Creating new group.", groupId); CreatureGroup* group = new CreatureGroup(groupId); map->CreatureGroupHolder[groupId] = group; group->AddMember(member); @@ -56,7 +56,7 @@ void FormationMgr::AddCreatureToGroup(uint32 groupId, Creature* member) void FormationMgr::RemoveCreatureFromGroup(CreatureGroup* group, Creature* member) { - TC_LOG_DEBUG(LOG_FILTER_UNITS, "Deleting member pointer to GUID: %u from group %u", group->GetId(), member->GetDBTableGUIDLow()); + TC_LOG_DEBUG("entities.unit", "Deleting member pointer to GUID: %u from group %u", group->GetId(), member->GetDBTableGUIDLow()); group->RemoveMember(member); if (group->isEmpty()) @@ -65,7 +65,7 @@ void FormationMgr::RemoveCreatureFromGroup(CreatureGroup* group, Creature* membe if (!map) return; - TC_LOG_DEBUG(LOG_FILTER_UNITS, "Deleting group with InstanceID %u", member->GetInstanceId()); + TC_LOG_DEBUG("entities.unit", "Deleting group with InstanceID %u", member->GetInstanceId()); map->CreatureGroupHolder.erase(group->GetId()); delete group; } @@ -80,11 +80,11 @@ void FormationMgr::LoadCreatureFormations() CreatureGroupMap.clear(); //Get group data - QueryResult result = WorldDatabase.Query("SELECT leaderGUID, memberGUID, dist, angle, groupAI FROM creature_formations ORDER BY leaderGUID"); + QueryResult result = WorldDatabase.Query("SELECT leaderGUID, memberGUID, dist, angle, groupAI, point_1, point_2 FROM creature_formations ORDER BY leaderGUID"); if (!result) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creatures in formations. DB table `creature_formations` is empty!"); + TC_LOG_ERROR("server.loading", ">> Loaded 0 creatures in formations. DB table `creature_formations` is empty!"); return; } @@ -101,6 +101,8 @@ void FormationMgr::LoadCreatureFormations() group_member->leaderGUID = fields[0].GetUInt32(); uint32 memberGUID = fields[1].GetUInt32(); group_member->groupAI = fields[4].GetUInt32(); + group_member->point_1 = fields[5].GetUInt16(); + group_member->point_2 = fields[6].GetUInt16(); //If creature is group leader we may skip loading of dist/angle if (group_member->leaderGUID != memberGUID) { @@ -117,14 +119,14 @@ void FormationMgr::LoadCreatureFormations() { if (!sObjectMgr->GetCreatureData(group_member->leaderGUID)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "creature_formations table leader guid %u incorrect (not exist)", group_member->leaderGUID); + TC_LOG_ERROR("sql.sql", "creature_formations table leader guid %u incorrect (not exist)", group_member->leaderGUID); delete group_member; continue; } if (!sObjectMgr->GetCreatureData(memberGUID)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "creature_formations table member guid %u incorrect (not exist)", memberGUID); + TC_LOG_ERROR("sql.sql", "creature_formations table member guid %u incorrect (not exist)", memberGUID); delete group_member; continue; } @@ -135,17 +137,17 @@ void FormationMgr::LoadCreatureFormations() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creatures in formations in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u creatures in formations in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void CreatureGroup::AddMember(Creature* member) { - TC_LOG_DEBUG(LOG_FILTER_UNITS, "CreatureGroup::AddMember: Adding unit GUID: %u.", member->GetGUIDLow()); + TC_LOG_DEBUG("entities.unit", "CreatureGroup::AddMember: Adding unit GUID: %u.", member->GetGUIDLow()); //Check if it is a leader if (member->GetDBTableGUIDLow() == m_groupID) { - TC_LOG_DEBUG(LOG_FILTER_UNITS, "Unit GUID: %u is formation leader. Adding group.", member->GetGUIDLow()); + TC_LOG_DEBUG("entities.unit", "Unit GUID: %u is formation leader. Adding group.", member->GetGUIDLow()); m_leader = member; } @@ -174,7 +176,7 @@ void CreatureGroup::MemberAttackStart(Creature* member, Unit* target) for (CreatureGroupMemberType::iterator itr = m_members.begin(); itr != m_members.end(); ++itr) { if (m_leader) // avoid crash if leader was killed and reset. - TC_LOG_DEBUG(LOG_FILTER_UNITS, "GROUP ATTACK: group instance id %u calls member instid %u", m_leader->GetInstanceId(), member->GetInstanceId()); + TC_LOG_DEBUG("entities.unit", "GROUP ATTACK: group instance id %u calls member instid %u", m_leader->GetInstanceId(), member->GetInstanceId()); Creature* other = itr->first; @@ -203,7 +205,7 @@ void CreatureGroup::FormationReset(bool dismiss) itr->first->GetMotionMaster()->Initialize(); else itr->first->GetMotionMaster()->MoveIdle(); - TC_LOG_DEBUG(LOG_FILTER_UNITS, "Set %s movement for member GUID: %u", dismiss ? "default" : "idle", itr->first->GetGUIDLow()); + TC_LOG_DEBUG("entities.unit", "Set %s movement for member GUID: %u", dismiss ? "default" : "idle", itr->first->GetGUIDLow()); } } m_Formed = !dismiss; @@ -224,6 +226,14 @@ void CreatureGroup::LeaderMoveTo(float x, float y, float z) if (member == m_leader || !member->IsAlive() || member->GetVictim()) continue; + if (itr->second->point_1) + { + if (m_leader->GetCurrentWaypointID() == itr->second->point_1) + itr->second->follow_angle = (2 * M_PI) - itr->second->follow_angle; + if (m_leader->GetCurrentWaypointID() == itr->second->point_2) + itr->second->follow_angle = (2 * M_PI) + itr->second->follow_angle; + } + float angle = itr->second->follow_angle; float dist = itr->second->follow_dist; diff --git a/src/server/game/Entities/Creature/CreatureGroups.h b/src/server/game/Entities/Creature/CreatureGroups.h index 91a7ac7ff5e..ea115bd2efd 100644 --- a/src/server/game/Entities/Creature/CreatureGroups.h +++ b/src/server/game/Entities/Creature/CreatureGroups.h @@ -32,6 +32,8 @@ struct FormationInfo float follow_dist; float follow_angle; uint8 groupAI; + uint16 point_1; + uint16 point_2; }; typedef UNORDERED_MAP<uint32/*memberDBGUID*/, FormationInfo*> CreatureGroupInfoType; diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp index e86935f49f8..d04fde46713 100644 --- a/src/server/game/Entities/Creature/GossipDef.cpp +++ b/src/server/game/Entities/Creature/GossipDef.cpp @@ -27,6 +27,7 @@ GossipMenu::GossipMenu() { _menuId = 0; + _locale = DEFAULT_LOCALE; } GossipMenu::~GossipMenu() @@ -232,7 +233,7 @@ void PlayerMenu::SendPointOfInterest(uint32 poiId) const PointOfInterest const* poi = sObjectMgr->GetPointOfInterest(poiId); if (!poi) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Request to send non-existing POI (Id: %u), ignored.", poiId); + TC_LOG_ERROR("sql.sql", "Request to send non-existing POI (Id: %u), ignored.", poiId); return; } @@ -341,7 +342,7 @@ void PlayerMenu::SendQuestGiverQuestList(QEmote eEmote, const std::string& Title data.put<uint8>(count_pos, count); _session->SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTGIVER_QUEST_LIST NPC Guid=%u", GUID_LOPART(npcGUID)); + TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_LIST NPC Guid=%u", GUID_LOPART(npcGUID)); } void PlayerMenu::SendQuestGiverStatus(uint8 questStatus, uint64 npcGUID) const @@ -351,7 +352,7 @@ void PlayerMenu::SendQuestGiverStatus(uint8 questStatus, uint64 npcGUID) const data << uint8(questStatus); _session->SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTGIVER_STATUS NPC Guid=%u, status=%u", GUID_LOPART(npcGUID), questStatus); + TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_STATUS NPC Guid=%u, status=%u", GUID_LOPART(npcGUID), questStatus); } void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, uint64 npcGUID, bool activateAccept) const @@ -459,7 +460,7 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, uint64 npcGUID, } _session->SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTGIVER_QUEST_DETAILS NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), quest->GetQuestId()); + TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_DETAILS NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), quest->GetQuestId()); } void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const @@ -596,7 +597,7 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const data << questObjectiveText[i]; _session->SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUEST_QUERY_RESPONSE questid=%u", quest->GetQuestId()); + TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUEST_QUERY_RESPONSE questid=%u", quest->GetQuestId()); } void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, bool enableNext) const @@ -690,7 +691,7 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, b data << uint32(quest->RewardFactionValueIdOverride[i]); _session->SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTGIVER_OFFER_REWARD NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), quest->GetQuestId()); + TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_OFFER_REWARD NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), quest->GetQuestId()); } void PlayerMenu::SendQuestGiverRequestItems(Quest const* quest, uint64 npcGUID, bool canComplete, bool closeOnCancel) const @@ -767,7 +768,7 @@ void PlayerMenu::SendQuestGiverRequestItems(Quest const* quest, uint64 npcGUID, data << uint32(0x10); _session->SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTGIVER_REQUEST_ITEMS NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), quest->GetQuestId()); + TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_REQUEST_ITEMS NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), quest->GetQuestId()); } void PlayerMenu::AddQuestLevelToTitle(std::string &title, int32 level) diff --git a/src/server/game/Entities/Creature/TemporarySummon.cpp b/src/server/game/Entities/Creature/TemporarySummon.cpp index 05bedf907a0..9fee6b8237d 100644 --- a/src/server/game/Entities/Creature/TemporarySummon.cpp +++ b/src/server/game/Entities/Creature/TemporarySummon.cpp @@ -166,7 +166,7 @@ void TempSummon::Update(uint32 diff) } default: UnSummon(); - TC_LOG_ERROR(LOG_FILTER_UNITS, "Temporary summoned creature (entry: %u) have unknown type %u of ", GetEntry(), m_type); + TC_LOG_ERROR("entities.unit", "Temporary summoned creature (entry: %u) have unknown type %u of ", GetEntry(), m_type); break; } } @@ -274,7 +274,7 @@ void TempSummon::RemoveFromWorld() owner->m_SummonSlot[slot] = 0; //if (GetOwnerGUID()) - // TC_LOG_ERROR(LOG_FILTER_UNITS, "Unit %u has owner guid when removed from world", GetEntry()); + // TC_LOG_ERROR("entities.unit", "Unit %u has owner guid when removed from world", GetEntry()); Creature::RemoveFromWorld(); } diff --git a/src/server/game/Entities/DynamicObject/DynamicObject.cpp b/src/server/game/Entities/DynamicObject/DynamicObject.cpp index 92eab703155..ec90ad7cb48 100644 --- a/src/server/game/Entities/DynamicObject/DynamicObject.cpp +++ b/src/server/game/Entities/DynamicObject/DynamicObject.cpp @@ -85,7 +85,7 @@ bool DynamicObject::CreateDynamicObject(uint32 guidlow, Unit* caster, uint32 spe Relocate(pos); if (!IsPositionValid()) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "DynamicObject (spell %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", spellId, GetPositionX(), GetPositionY()); + TC_LOG_ERROR("misc", "DynamicObject (spell %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", spellId, GetPositionX(), GetPositionY()); return false; } diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 6d940623963..3c44c8e6035 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -64,6 +64,7 @@ GameObject::GameObject() : WorldObject(false), MapObject(), lootingGroupLowGUID = 0; ResetLootMode(); // restore default loot mode + m_stationaryPosition.Relocate(0.0f, 0.0f, 0.0f, 0.0f); } GameObject::~GameObject() @@ -131,7 +132,7 @@ void GameObject::RemoveFromOwner() else if (IS_PET_GUID(ownerGUID)) ownerType = "pet"; - TC_LOG_FATAL(LOG_FILTER_GENERAL, "Removed GameObject (GUID: %u Entry: %u SpellId: %u LinkedGO: %u) that just lost any reference to the owner (GUID: %u Type: '%s') GO list", + TC_LOG_FATAL("misc", "Removed GameObject (GUID: %u Entry: %u SpellId: %u LinkedGO: %u) that just lost any reference to the owner (GUID: %u Type: '%s') GO list", GetGUIDLow(), GetGOInfo()->entry, m_spellId, GetGOInfo()->GetLinkedGameObjectEntry(), GUID_LOPART(ownerGUID), ownerType); SetOwnerGUID(0); } @@ -182,7 +183,7 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa m_stationaryPosition.Relocate(x, y, z, ang); if (!IsPositionValid()) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Gameobject (GUID: %u Entry: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", guidlow, name_id, x, y); + TC_LOG_ERROR("misc", "Gameobject (GUID: %u Entry: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", guidlow, name_id, x, y); return false; } @@ -199,7 +200,7 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(name_id); if (!goinfo) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Gameobject (GUID: %u Entry: %u) not created: non-existing entry in `gameobject_template`. Map: %u (X: %f Y: %f Z: %f)", guidlow, name_id, map->GetId(), x, y, z); + TC_LOG_ERROR("sql.sql", "Gameobject (GUID: %u Entry: %u) not created: non-existing entry in `gameobject_template`. Map: %u (X: %f Y: %f Z: %f)", guidlow, name_id, map->GetId(), x, y, z); return false; } @@ -212,7 +213,7 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa if (goinfo->type >= MAX_GAMEOBJECT_TYPE) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Gameobject (GUID: %u Entry: %u) not created: non-existing GO type '%u' in `gameobject_template`. It will crash client if created.", guidlow, name_id, goinfo->type); + TC_LOG_ERROR("sql.sql", "Gameobject (GUID: %u Entry: %u) not created: non-existing GO type '%u' in `gameobject_template`. It will crash client if created.", guidlow, name_id, goinfo->type); return false; } @@ -293,7 +294,7 @@ void GameObject::Update(uint32 diff) if (AI()) AI()->UpdateAI(diff); else if (!AIM_Initialize()) - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Could not initialize GameObjectAI"); + TC_LOG_ERROR("misc", "Could not initialize GameObjectAI"); switch (m_lootState) { @@ -340,7 +341,7 @@ void GameObject::Update(uint32 diff) G3D::Vector3 src(GetPositionX(), GetPositionY(), GetPositionZ()); - sLog->outInfo(LOG_FILTER_GENERAL, "Src: %s Dest: %s", src.toString().c_str(), pos.toString().c_str()); + TC_LOG_INFO("misc", "Src: %s Dest: %s", src.toString().c_str(), pos.toString().c_str()); GetMap()->GameObjectRelocation(this, pos.x, pos.y, pos.z, GetOrientation()); } @@ -701,7 +702,7 @@ void GameObject::SaveToDB() GameObjectData const* data = sObjectMgr->GetGOData(m_DBTableGuid); if (!data) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "GameObject::SaveToDB failed, cannot get gameobject data!"); + TC_LOG_ERROR("misc", "GameObject::SaveToDB failed, cannot get gameobject data!"); return; } @@ -775,7 +776,7 @@ bool GameObject::LoadGameObjectFromDB(uint32 guid, Map* map, bool addToMap) if (!data) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Gameobject (GUID: %u) not found in table `gameobject`, can't load. ", guid); + TC_LOG_ERROR("sql.sql", "Gameobject (GUID: %u) not found in table `gameobject`, can't load. ", guid); return false; } @@ -1283,7 +1284,7 @@ void GameObject::Use(Unit* user) if (info->goober.eventId) { - TC_LOG_DEBUG(LOG_FILTER_MAPSCRIPTS, "Goober ScriptStart id %u for GO entry %u (GUID %u).", info->goober.eventId, GetEntry(), GetDBTableGUIDLow()); + TC_LOG_DEBUG("maps.script", "Goober ScriptStart id %u for GO entry %u (GUID %u).", info->goober.eventId, GetEntry(), GetDBTableGUIDLow()); GetMap()->ScriptsStart(sEventScripts, info->goober.eventId, player, this); EventInform(info->goober.eventId); } @@ -1364,7 +1365,7 @@ void GameObject::Use(Unit* user) //provide error, no fishable zone or area should be 0 if (!zone_skill) - TC_LOG_ERROR(LOG_FILTER_SQL, "Fishable areaId %u are not properly defined in `skill_fishing_base_level`.", subzone); + TC_LOG_ERROR("sql.sql", "Fishable areaId %u are not properly defined in `skill_fishing_base_level`.", subzone); int32 skill = player->GetSkillValue(SKILL_FISHING); @@ -1380,7 +1381,7 @@ void GameObject::Use(Unit* user) int32 roll = irand(1, 100); - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "Fishing check (skill: %i zone min skill: %i chance %i roll: %i", skill, zone_skill, chance, roll); + TC_LOG_DEBUG("misc", "Fishing check (skill: %i zone min skill: %i chance %i roll: %i", skill, zone_skill, chance, roll); // but you will likely cause junk in areas that require a high fishing skill (not yet implemented) if (chance >= roll) @@ -1685,7 +1686,7 @@ void GameObject::Use(Unit* user) } default: if (GetGoType() >= MAX_GAMEOBJECT_TYPE) - TC_LOG_ERROR(LOG_FILTER_GENERAL, "GameObject::Use(): unit (type: %u, guid: %u, name: %s) tries to use object (guid: %u, entry: %u, name: %s) of unknown type (%u)", + TC_LOG_ERROR("misc", "GameObject::Use(): unit (type: %u, guid: %u, name: %s) tries to use object (guid: %u, entry: %u, name: %s) of unknown type (%u)", user->GetTypeId(), user->GetGUIDLow(), user->GetName().c_str(), GetGUIDLow(), GetEntry(), GetGOInfo()->name.c_str(), GetGoType()); break; } @@ -1697,9 +1698,9 @@ void GameObject::Use(Unit* user) if (!spellInfo) { if (user->GetTypeId() != TYPEID_PLAYER || !sOutdoorPvPMgr->HandleCustomSpell(user->ToPlayer(), spellId, this)) - TC_LOG_ERROR(LOG_FILTER_GENERAL, "WORLD: unknown spell id %u at use action for gameobject (Entry: %u GoType: %u)", spellId, GetEntry(), GetGoType()); + TC_LOG_ERROR("misc", "WORLD: unknown spell id %u at use action for gameobject (Entry: %u GoType: %u)", spellId, GetEntry(), GetGoType()); else - TC_LOG_DEBUG(LOG_FILTER_OUTDOORPVP, "WORLD: %u non-dbc spell was handled by OutdoorPvP", spellId); + TC_LOG_DEBUG("outdoorpvp", "WORLD: %u non-dbc spell was handled by OutdoorPvP", spellId); return; } diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h index 27ea15c38ff..8930806bca5 100644 --- a/src/server/game/Entities/GameObject/GameObject.h +++ b/src/server/game/Entities/GameObject/GameObject.h @@ -589,7 +589,9 @@ enum GOState // from `gameobject` struct GameObjectData { - explicit GameObjectData() : dbData(true) { } + explicit GameObjectData() : id(0), mapid(0), phaseMask(0), posX(0.0f), posY(0.0f), posZ(0.0f), orientation(0.0f), + rotation0(0.0f), rotation1(0.0f), rotation2(0.0f), rotation3(0.0f), spawntimesecs(0), + animprogress(0), go_state(GO_STATE_ACTIVE), spawnMask(0), artKit(0), dbData(true) { } uint32 id; // entry in gamobject_template uint16 mapid; uint32 phaseMask; diff --git a/src/server/game/Entities/Item/Container/Bag.cpp b/src/server/game/Entities/Item/Container/Bag.cpp index 5d7aa72a59b..56c29c1d1c7 100644 --- a/src/server/game/Entities/Item/Container/Bag.cpp +++ b/src/server/game/Entities/Item/Container/Bag.cpp @@ -42,7 +42,7 @@ Bag::~Bag() { if (item->IsInWorld()) { - TC_LOG_FATAL(LOG_FILTER_PLAYER_ITEMS, "Item %u (slot %u, bag slot %u) in bag %u (slot %u, bag slot %u, m_bagslot %u) is to be deleted but is still in world.", + TC_LOG_FATAL("entities.player.items", "Item %u (slot %u, bag slot %u) in bag %u (slot %u, bag slot %u, m_bagslot %u) is to be deleted but is still in world.", item->GetEntry(), (uint32)item->GetSlot(), (uint32)item->GetBagSlot(), GetEntry(), (uint32)GetSlot(), (uint32)GetBagSlot(), (uint32)i); item->RemoveFromWorld(); diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp index a0b6fdafb06..747884e197c 100644 --- a/src/server/game/Entities/Item/Item.cpp +++ b/src/server/game/Entities/Item/Item.cpp @@ -38,7 +38,7 @@ void AddItemsSetItem(Player* player, Item* item) if (!set) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item set %u for item (id %u) not found, mods not applied.", setid, proto->ItemId); + TC_LOG_ERROR("sql.sql", "Item set %u for item (id %u) not found, mods not applied.", setid, proto->ItemId); return; } @@ -98,7 +98,7 @@ void AddItemsSetItem(Player* player, Item* item) SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(set->spells[x]); if (!spellInfo) { - TC_LOG_ERROR(LOG_FILTER_PLAYER_ITEMS, "WORLD: unknown spell id %u in items set %u effects", set->spells[x], setid); + TC_LOG_ERROR("entities.player.items", "WORLD: unknown spell id %u in items set %u effects", set->spells[x], setid); break; } @@ -119,7 +119,7 @@ void RemoveItemsSetItem(Player*player, ItemTemplate const* proto) if (!set) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item set #%u for item #%u not found, mods not removed.", setid, proto->ItemId); + TC_LOG_ERROR("sql.sql", "Item set #%u for item #%u not found, mods not removed.", setid, proto->ItemId); return; } @@ -295,7 +295,7 @@ void Item::UpdateDuration(Player* owner, uint32 diff) if (!GetUInt32Value(ITEM_FIELD_DURATION)) return; - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "Item::UpdateDuration Item (Entry: %u Duration %u Diff %u)", GetEntry(), GetUInt32Value(ITEM_FIELD_DURATION), diff); + TC_LOG_DEBUG("entities.player.items", "Item::UpdateDuration Item (Entry: %u Duration %u Diff %u)", GetEntry(), GetUInt32Value(ITEM_FIELD_DURATION), diff); if (GetUInt32Value(ITEM_FIELD_DURATION) <= diff) { @@ -607,7 +607,7 @@ int32 Item::GenerateItemRandomPropertyId(uint32 item_id) // item can have not null only one from field values if ((itemProto->RandomProperty) && (itemProto->RandomSuffix)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item template %u have RandomProperty == %u and RandomSuffix == %u, but must have one from field =0", itemProto->ItemId, itemProto->RandomProperty, itemProto->RandomSuffix); + TC_LOG_ERROR("sql.sql", "Item template %u have RandomProperty == %u and RandomSuffix == %u, but must have one from field =0", itemProto->ItemId, itemProto->RandomProperty, itemProto->RandomSuffix); return 0; } @@ -618,7 +618,7 @@ int32 Item::GenerateItemRandomPropertyId(uint32 item_id) ItemRandomPropertiesEntry const* random_id = sItemRandomPropertiesStore.LookupEntry(randomPropId); if (!random_id) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Enchantment id #%u used but it doesn't have records in 'ItemRandomProperties.dbc'", randomPropId); + TC_LOG_ERROR("sql.sql", "Enchantment id #%u used but it doesn't have records in 'ItemRandomProperties.dbc'", randomPropId); return 0; } @@ -631,7 +631,7 @@ int32 Item::GenerateItemRandomPropertyId(uint32 item_id) ItemRandomSuffixEntry const* random_id = sItemRandomSuffixStore.LookupEntry(randomPropId); if (!random_id) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Enchantment id #%u used but it doesn't have records in sItemRandomSuffixStore.", randomPropId); + TC_LOG_ERROR("sql.sql", "Enchantment id #%u used but it doesn't have records in sItemRandomSuffixStore.", randomPropId); return 0; } @@ -721,7 +721,7 @@ void Item::AddToUpdateQueueOf(Player* player) if (player->GetGUID() != GetOwnerGUID()) { - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "Item::AddToUpdateQueueOf - Owner's guid (%u) and player's guid (%u) don't match!", GUID_LOPART(GetOwnerGUID()), player->GetGUIDLow()); + TC_LOG_DEBUG("entities.player.items", "Item::AddToUpdateQueueOf - Owner's guid (%u) and player's guid (%u) don't match!", GUID_LOPART(GetOwnerGUID()), player->GetGUIDLow()); return; } @@ -741,7 +741,7 @@ void Item::RemoveFromUpdateQueueOf(Player* player) if (player->GetGUID() != GetOwnerGUID()) { - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "Item::RemoveFromUpdateQueueOf - Owner's guid (%u) and player's guid (%u) don't match!", GUID_LOPART(GetOwnerGUID()), player->GetGUIDLow()); + TC_LOG_DEBUG("entities.player.items", "Item::RemoveFromUpdateQueueOf - Owner's guid (%u) and player's guid (%u) don't match!", GUID_LOPART(GetOwnerGUID()), player->GetGUIDLow()); return; } diff --git a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp index 1d0b7b66d6d..527329a9d61 100644 --- a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp +++ b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp @@ -71,10 +71,10 @@ void LoadRandomEnchantmentsTable() ++count; } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Item Enchantment definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u Item Enchantment definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } else - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 Item Enchantment definitions. DB table `item_enchantment_template` is empty."); + TC_LOG_ERROR("server.loading", ">> Loaded 0 Item Enchantment definitions. DB table `item_enchantment_template` is empty."); } uint32 GetItemEnchantMod(int32 entry) @@ -88,7 +88,7 @@ uint32 GetItemEnchantMod(int32 entry) EnchantmentStore::const_iterator tab = RandomItemEnch.find(entry); if (tab == RandomItemEnch.end()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item RandomProperty / RandomSuffix id #%u used in `item_template` but it does not have records in `item_enchantment_template` table.", entry); + TC_LOG_ERROR("sql.sql", "Item RandomProperty / RandomSuffix id #%u used in `item_template` but it does not have records in `item_enchantment_template` table.", entry); return 0; } diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index b7417c0e7c6..9ca28ea83f5 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -91,7 +91,7 @@ WorldObject::~WorldObject() { if (GetTypeId() == TYPEID_CORPSE) { - TC_LOG_FATAL(LOG_FILTER_GENERAL, "Object::~Object Corpse guid=" UI64FMTD ", type=%d, entry=%u deleted but still in map!!", + TC_LOG_FATAL("misc", "Object::~Object Corpse guid=" UI64FMTD ", type=%d, entry=%u deleted but still in map!!", GetGUID(), ((Corpse*)this)->GetType(), GetEntry()); ASSERT(false); } @@ -103,16 +103,16 @@ Object::~Object() { if (IsInWorld()) { - TC_LOG_FATAL(LOG_FILTER_GENERAL, "Object::~Object - guid=" UI64FMTD ", typeid=%d, entry=%u deleted but still in world!!", GetGUID(), GetTypeId(), GetEntry()); + TC_LOG_FATAL("misc", "Object::~Object - guid=" UI64FMTD ", typeid=%d, entry=%u deleted but still in world!!", GetGUID(), GetTypeId(), GetEntry()); if (isType(TYPEMASK_ITEM)) - TC_LOG_FATAL(LOG_FILTER_GENERAL, "Item slot %u", ((Item*)this)->GetSlot()); + TC_LOG_FATAL("misc", "Item slot %u", ((Item*)this)->GetSlot()); ASSERT(false); RemoveFromWorld(); } if (m_objectUpdated) { - TC_LOG_FATAL(LOG_FILTER_GENERAL, "Object::~Object - guid=" UI64FMTD ", typeid=%d, entry=%u deleted but still in update list!!", GetGUID(), GetTypeId(), GetEntry()); + TC_LOG_FATAL("misc", "Object::~Object - guid=" UI64FMTD ", typeid=%d, entry=%u deleted but still in update list!!", GetGUID(), GetTypeId(), GetEntry()); ASSERT(false); sObjectAccessor->RemoveUpdateObject(this); } @@ -737,7 +737,7 @@ void Object::SetByteValue(uint16 index, uint8 offset, uint8 value) if (offset > 4) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Object::SetByteValue: wrong offset %u", offset); + TC_LOG_ERROR("misc", "Object::SetByteValue: wrong offset %u", offset); return; } @@ -761,7 +761,7 @@ void Object::SetUInt16Value(uint16 index, uint8 offset, uint16 value) if (offset > 2) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Object::SetUInt16Value: wrong offset %u", offset); + TC_LOG_ERROR("misc", "Object::SetUInt16Value: wrong offset %u", offset); return; } @@ -901,7 +901,7 @@ void Object::SetByteFlag(uint16 index, uint8 offset, uint8 newFlag) if (offset > 4) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Object::SetByteFlag: wrong offset %u", offset); + TC_LOG_ERROR("misc", "Object::SetByteFlag: wrong offset %u", offset); return; } @@ -924,7 +924,7 @@ void Object::RemoveByteFlag(uint16 index, uint8 offset, uint8 oldFlag) if (offset > 4) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Object::RemoveByteFlag: wrong offset %u", offset); + TC_LOG_ERROR("misc", "Object::RemoveByteFlag: wrong offset %u", offset); return; } @@ -991,7 +991,7 @@ void Object::ApplyModFlag64(uint16 index, uint64 flag, bool apply) bool Object::PrintIndexError(uint32 index, bool set) const { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Attempt %s non-existed value field: %u (count: %u) for object typeid: %u type mask: %u", (set ? "set value to" : "get value from"), index, m_valuesCount, GetTypeId(), m_objectType); + TC_LOG_ERROR("misc", "Attempt %s non-existed value field: %u (count: %u) for object typeid: %u type mask: %u", (set ? "set value to" : "get value from"), index, m_valuesCount, GetTypeId(), m_objectType); // ASSERT must fail after function call return false; @@ -1054,35 +1054,35 @@ ByteBuffer& operator<<(ByteBuffer& buf, Position::PositionXYZOStreamer const& st void MovementInfo::OutDebug() { - TC_LOG_INFO(LOG_FILTER_GENERAL, "MOVEMENT INFO"); - TC_LOG_INFO(LOG_FILTER_GENERAL, "guid " UI64FMTD, guid); - TC_LOG_INFO(LOG_FILTER_GENERAL, "flags %u", flags); - TC_LOG_INFO(LOG_FILTER_GENERAL, "flags2 %u", flags2); - TC_LOG_INFO(LOG_FILTER_GENERAL, "time %u current time " UI64FMTD "", flags2, uint64(::time(NULL))); - TC_LOG_INFO(LOG_FILTER_GENERAL, "position: `%s`", pos.ToString().c_str()); + TC_LOG_INFO("misc", "MOVEMENT INFO"); + TC_LOG_INFO("misc", "guid " UI64FMTD, guid); + TC_LOG_INFO("misc", "flags %u", flags); + TC_LOG_INFO("misc", "flags2 %u", flags2); + TC_LOG_INFO("misc", "time %u current time " UI64FMTD "", flags2, uint64(::time(NULL))); + TC_LOG_INFO("misc", "position: `%s`", pos.ToString().c_str()); if (flags & MOVEMENTFLAG_ONTRANSPORT) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "TRANSPORT:"); - TC_LOG_INFO(LOG_FILTER_GENERAL, "guid: " UI64FMTD, transport.guid); - TC_LOG_INFO(LOG_FILTER_GENERAL, "position: `%s`", transport.pos.ToString().c_str()); - TC_LOG_INFO(LOG_FILTER_GENERAL, "seat: %i", transport.seat); - TC_LOG_INFO(LOG_FILTER_GENERAL, "time: %u", transport.time); + TC_LOG_INFO("misc", "TRANSPORT:"); + TC_LOG_INFO("misc", "guid: " UI64FMTD, transport.guid); + TC_LOG_INFO("misc", "position: `%s`", transport.pos.ToString().c_str()); + TC_LOG_INFO("misc", "seat: %i", transport.seat); + TC_LOG_INFO("misc", "time: %u", transport.time); if (flags2 & MOVEMENTFLAG2_INTERPOLATED_MOVEMENT) - TC_LOG_INFO(LOG_FILTER_GENERAL, "time2: %u", transport.time2); + TC_LOG_INFO("misc", "time2: %u", transport.time2); } if ((flags & (MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_FLYING)) || (flags2 & MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING)) - TC_LOG_INFO(LOG_FILTER_GENERAL, "pitch: %f", pitch); + TC_LOG_INFO("misc", "pitch: %f", pitch); - TC_LOG_INFO(LOG_FILTER_GENERAL, "fallTime: %u", fallTime); + TC_LOG_INFO("misc", "fallTime: %u", fallTime); if (flags & MOVEMENTFLAG_FALLING) - TC_LOG_INFO(LOG_FILTER_GENERAL, "j_zspeed: %f j_sinAngle: %f j_cosAngle: %f j_xyspeed: %f", jump.zspeed, jump.sinAngle, jump.cosAngle, jump.xyspeed); + TC_LOG_INFO("misc", "j_zspeed: %f j_sinAngle: %f j_cosAngle: %f j_xyspeed: %f", jump.zspeed, jump.sinAngle, jump.cosAngle, jump.xyspeed); if (flags & MOVEMENTFLAG_SPLINE_ELEVATION) - TC_LOG_INFO(LOG_FILTER_GENERAL, "splineElevation: %f", splineElevation); + TC_LOG_INFO("misc", "splineElevation: %f", splineElevation); } -WorldObject::WorldObject(bool isWorldObject): WorldLocation(), +WorldObject::WorldObject(bool isWorldObject) : WorldLocation(), LastUsedScriptID(0), m_name(""), m_isActive(false), m_isWorldObject(isWorldObject), m_zoneScript(NULL), m_transport(NULL), m_currMap(NULL), m_InstanceId(0), m_phaseMask(PHASEMASK_NORMAL), m_notifyflags(0), m_executed_notifies(0) @@ -2096,7 +2096,7 @@ void WorldObject::SetMap(Map* map) return; if (m_currMap) { - TC_LOG_FATAL(LOG_FILTER_GENERAL, "WorldObject::SetMap: obj %u new map %u %u, old map %u %u", (uint32)GetTypeId(), map->GetId(), map->GetInstanceId(), m_currMap->GetId(), m_currMap->GetInstanceId()); + TC_LOG_FATAL("misc", "WorldObject::SetMap: obj %u new map %u %u, old map %u %u", (uint32)GetTypeId(), map->GetId(), map->GetInstanceId(), m_currMap->GetId(), m_currMap->GetInstanceId()); ASSERT(false); } m_currMap = map; @@ -2131,7 +2131,7 @@ void WorldObject::AddObjectToRemoveList() Map* map = FindMap(); if (!map) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Object (TypeId: %u Entry: %u GUID: %u) at attempt add to move list not have valid map (Id: %u).", GetTypeId(), GetEntry(), GetGUIDLow(), GetMapId()); + TC_LOG_ERROR("misc", "Object (TypeId: %u Entry: %u GUID: %u) at attempt add to move list not have valid map (Id: %u).", GetTypeId(), GetEntry(), GetGUIDLow(), GetMapId()); return; } @@ -2305,7 +2305,7 @@ GameObject* WorldObject::SummonGameObject(uint32 entry, float x, float y, float GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(entry); if (!goinfo) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Gameobject template %u not found in database!", entry); + TC_LOG_ERROR("sql.sql", "Gameobject template %u not found in database!", entry); return NULL; } @@ -2673,7 +2673,7 @@ void WorldObject::MovePosition(Position &pos, float dist, float angle) // Prevent invalid coordinates here, position is unchanged if (!Trinity::IsValidMapCoord(destx, desty, pos.m_positionZ)) { - TC_LOG_FATAL(LOG_FILTER_GENERAL, "WorldObject::MovePosition: Object (TypeId: %u Entry: %u GUID: %u) has invalid coordinates X: %f and Y: %f were passed!", + TC_LOG_FATAL("misc", "WorldObject::MovePosition: Object (TypeId: %u Entry: %u GUID: %u) has invalid coordinates X: %f and Y: %f were passed!", GetTypeId(), GetEntry(), GetGUIDLow(), destx, desty); return; } @@ -2720,7 +2720,7 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float // Prevent invalid coordinates here, position is unchanged if (!Trinity::IsValidMapCoord(destx, desty)) { - TC_LOG_FATAL(LOG_FILTER_GENERAL, "WorldObject::MovePositionToFirstCollision invalid coordinates X: %f and Y: %f were passed!", destx, desty); + TC_LOG_FATAL("misc", "WorldObject::MovePositionToFirstCollision invalid coordinates X: %f and Y: %f were passed!", destx, desty); return; } diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index f03b95d0cc7..aeeb1d691f0 100644 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -536,7 +536,10 @@ class MapObject friend class ObjectGridLoader; //grid loader for loading creatures protected: - MapObject() : _moveState(MAP_OBJECT_CELL_MOVE_NONE) { } + MapObject() : _moveState(MAP_OBJECT_CELL_MOVE_NONE) + { + _newPosition.Relocate(0.0f, 0.0f, 0.0f, 0.0f); + } private: Cell _currentCell; diff --git a/src/server/game/Entities/Object/Updates/UpdateData.cpp b/src/server/game/Entities/Object/Updates/UpdateData.cpp index acf1e12b11b..be04a38c2d0 100644 --- a/src/server/game/Entities/Object/Updates/UpdateData.cpp +++ b/src/server/game/Entities/Object/Updates/UpdateData.cpp @@ -55,7 +55,7 @@ void UpdateData::Compress(void* dst, uint32 *dst_size, void* src, int src_size) int z_res = deflateInit(&c_stream, sWorld->getIntConfig(CONFIG_COMPRESSION)); if (z_res != Z_OK) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Can't compress update packet (zlib: deflateInit) Error code: %i (%s)", z_res, zError(z_res)); + TC_LOG_ERROR("misc", "Can't compress update packet (zlib: deflateInit) Error code: %i (%s)", z_res, zError(z_res)); *dst_size = 0; return; } @@ -68,14 +68,14 @@ void UpdateData::Compress(void* dst, uint32 *dst_size, void* src, int src_size) z_res = deflate(&c_stream, Z_NO_FLUSH); if (z_res != Z_OK) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Can't compress update packet (zlib: deflate) Error code: %i (%s)", z_res, zError(z_res)); + TC_LOG_ERROR("misc", "Can't compress update packet (zlib: deflate) Error code: %i (%s)", z_res, zError(z_res)); *dst_size = 0; return; } if (c_stream.avail_in != 0) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Can't compress update packet (zlib: deflate not greedy)"); + TC_LOG_ERROR("misc", "Can't compress update packet (zlib: deflate not greedy)"); *dst_size = 0; return; } @@ -83,7 +83,7 @@ void UpdateData::Compress(void* dst, uint32 *dst_size, void* src, int src_size) z_res = deflate(&c_stream, Z_FINISH); if (z_res != Z_STREAM_END) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Can't compress update packet (zlib: deflate should report Z_STREAM_END instead %i (%s)", z_res, zError(z_res)); + TC_LOG_ERROR("misc", "Can't compress update packet (zlib: deflate should report Z_STREAM_END instead %i (%s)", z_res, zError(z_res)); *dst_size = 0; return; } @@ -91,7 +91,7 @@ void UpdateData::Compress(void* dst, uint32 *dst_size, void* src, int src_size) z_res = deflateEnd(&c_stream); if (z_res != Z_OK) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Can't compress update packet (zlib: deflateEnd) Error code: %i (%s)", z_res, zError(z_res)); + TC_LOG_ERROR("misc", "Can't compress update packet (zlib: deflateEnd) Error code: %i (%s)", z_res, zError(z_res)); *dst_size = 0; return; } diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index dfe658a30d3..b019cd7e423 100644 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -178,17 +178,6 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petEntry, uint32 petnumber, bool c if (!Create(guid, map, owner->GetPhaseMask(), petEntry, petId)) return false; - float px, py, pz; - owner->GetClosePoint(px, py, pz, GetObjectSize(), PET_FOLLOW_DIST, GetFollowAngle()); - Relocate(px, py, pz, owner->GetOrientation()); - - if (!IsPositionValid()) - { - TC_LOG_ERROR(LOG_FILTER_PETS, "Pet (guidlow %d, entry %d) not loaded. Suggested coordinates isn't valid (X: %f Y: %f)", - GetGUIDLow(), GetEntry(), GetPositionX(), GetPositionY()); - return false; - } - setPetType(petType); setFaction(owner->getFaction()); SetUInt32Value(UNIT_CREATED_BY_SPELL, summonSpellId); @@ -196,6 +185,17 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petEntry, uint32 petnumber, bool c CreatureTemplate const* cinfo = GetCreatureTemplate(); if (cinfo->type == CREATURE_TYPE_CRITTER) { + float px, py, pz; + owner->GetClosePoint(px, py, pz, GetObjectSize(), PET_FOLLOW_DIST, GetFollowAngle()); + Relocate(px, py, pz, owner->GetOrientation()); + + if (!IsPositionValid()) + { + TC_LOG_ERROR("entities.pet", "Pet (guidlow %d, entry %d) not loaded. Suggested coordinates isn't valid (X: %f Y: %f)", + GetGUIDLow(), GetEntry(), GetPositionX(), GetPositionY()); + return false; + } + map->AddToMap(this->ToCreature()); return true; } @@ -230,7 +230,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petEntry, uint32 petnumber, bool c break; default: if (!IsPetGhoul()) - TC_LOG_ERROR(LOG_FILTER_PETS, "Pet have incorrect type (%u) for pet loading.", getPetType()); + TC_LOG_ERROR("entities.pet", "Pet have incorrect type (%u) for pet loading.", getPetType()); break; } @@ -242,6 +242,17 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petEntry, uint32 petnumber, bool c SynchronizeLevelWithOwner(); + // Set pet's position after setting level, its size depends on it + float px, py, pz; + owner->GetClosePoint(px, py, pz, GetObjectSize(), PET_FOLLOW_DIST, GetFollowAngle()); + Relocate(px, py, pz, owner->GetOrientation()); + if (!IsPositionValid()) + { + TC_LOG_ERROR("entities.pet", "Pet (guidlow %d, entry %d) not loaded. Suggested coordinates isn't valid (X: %f Y: %f)", + GetGUIDLow(), GetEntry(), GetPositionX(), GetPositionY()); + return false; + } + SetReactState(ReactStates(fields[6].GetUInt8())); SetCanModifyStats(true); @@ -322,7 +333,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petEntry, uint32 petnumber, bool c CleanupActionBar(); // remove unknown spells from action bar after load - TC_LOG_DEBUG(LOG_FILTER_PETS, "New Pet has guid %u", GetGUIDLow()); + TC_LOG_DEBUG("entities.pet", "New Pet has guid %u", GetGUIDLow()); owner->PetSpellInitialize(); @@ -563,7 +574,7 @@ void Pet::Update(uint32 diff) { if (owner->GetPetGUID() != GetGUID()) { - TC_LOG_ERROR(LOG_FILTER_PETS, "Pet %u is not pet of owner %s, removed", GetEntry(), GetOwner()->GetName().c_str()); + TC_LOG_ERROR("entities.pet", "Pet %u is not pet of owner %s, removed", GetEntry(), GetOwner()->GetName().c_str()); Remove(getPetType() == HUNTER_PET?PET_SAVE_AS_DELETED:PET_SAVE_NOT_IN_SLOT); return; } @@ -761,7 +772,7 @@ bool Pet::CreateBaseAtCreature(Creature* creature) if (!IsPositionValid()) { - TC_LOG_ERROR(LOG_FILTER_PETS, "Pet (guidlow %d, entry %d) not created base at creature. Suggested coordinates isn't valid (X: %f Y: %f)", + TC_LOG_ERROR("entities.pet", "Pet (guidlow %d, entry %d) not created base at creature. Suggested coordinates isn't valid (X: %f Y: %f)", GetGUIDLow(), GetEntry(), GetPositionX(), GetPositionY()); return false; } @@ -769,7 +780,7 @@ bool Pet::CreateBaseAtCreature(Creature* creature) CreatureTemplate const* cinfo = GetCreatureTemplate(); if (!cinfo) { - TC_LOG_ERROR(LOG_FILTER_PETS, "CreateBaseAtCreature() failed, creatureInfo is missing!"); + TC_LOG_ERROR("entities.pet", "CreateBaseAtCreature() failed, creatureInfo is missing!"); return false; } @@ -798,7 +809,7 @@ bool Pet::CreateBaseAtCreatureInfo(CreatureTemplate const* cinfo, Unit* owner) bool Pet::CreateBaseAtTamed(CreatureTemplate const* cinfo, Map* map, uint32 phaseMask) { - TC_LOG_DEBUG(LOG_FILTER_PETS, "Pet::CreateBaseForTamed"); + TC_LOG_DEBUG("entities.pet", "Pet::CreateBaseForTamed"); uint32 guid=sObjectMgr->GenerateLowGuid(HIGHGUID_PET); uint32 petId = sObjectMgr->GeneratePetNumber(); if (!Create(guid, map, phaseMask, cinfo->Entry, petId)) @@ -847,7 +858,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) } else { - TC_LOG_ERROR(LOG_FILTER_PETS, "Unknown type pet %u is summoned by player class %u", + TC_LOG_ERROR("entities.pet", "Unknown type pet %u is summoned by player class %u", GetEntry(), GetOwner()->getClass()); } } @@ -1124,7 +1135,7 @@ void Pet::_LoadSpellCooldowns() if (!sSpellMgr->GetSpellInfo(spell_id)) { - TC_LOG_ERROR(LOG_FILTER_PETS, "Pet %u have unknown spell %u in `pet_spell_cooldown`, skipping.", m_charmInfo->GetPetNumber(), spell_id); + TC_LOG_ERROR("entities.pet", "Pet %u have unknown spell %u in `pet_spell_cooldown`, skipping.", m_charmInfo->GetPetNumber(), spell_id); continue; } @@ -1137,7 +1148,7 @@ void Pet::_LoadSpellCooldowns() _AddCreatureSpellCooldown(spell_id, db_time); - TC_LOG_DEBUG(LOG_FILTER_PETS, "Pet (Number: %u) spell %u cooldown loaded (%u secs).", m_charmInfo->GetPetNumber(), spell_id, uint32(db_time-curTime)); + TC_LOG_DEBUG("entities.pet", "Pet (Number: %u) spell %u cooldown loaded (%u secs).", m_charmInfo->GetPetNumber(), spell_id, uint32(db_time-curTime)); } while (result->NextRow()); @@ -1241,7 +1252,7 @@ void Pet::_SaveSpells(SQLTransaction& trans) void Pet::_LoadAuras(uint32 timediff) { - TC_LOG_DEBUG(LOG_FILTER_PETS, "Loading auras for pet %u", GetGUIDLow()); + TC_LOG_DEBUG("entities.pet", "Loading auras for pet %u", GetGUIDLow()); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_AURA); stmt->setUInt32(0, m_charmInfo->GetPetNumber()); @@ -1275,7 +1286,7 @@ void Pet::_LoadAuras(uint32 timediff) SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid); if (!spellInfo) { - TC_LOG_ERROR(LOG_FILTER_PETS, "Unknown aura (spellid %u), ignore.", spellid); + TC_LOG_ERROR("entities.pet", "Unknown aura (spellid %u), ignore.", spellid); continue; } @@ -1306,7 +1317,7 @@ void Pet::_LoadAuras(uint32 timediff) } aura->SetLoadedState(maxduration, remaintime, remaincharges, stackcount, recalculatemask, &damage[0]); aura->ApplyForTargets(); - TC_LOG_INFO(LOG_FILTER_PETS, "Added aura spellid %u, effectmask %u", spellInfo->Id, effmask); + TC_LOG_INFO("entities.pet", "Added aura spellid %u, effectmask %u", spellInfo->Id, effmask); } } while (result->NextRow()); @@ -1382,7 +1393,7 @@ bool Pet::addSpell(uint32 spellId, ActiveStates active /*= ACT_DECIDE*/, PetSpel // do pet spell book cleanup if (state == PETSPELL_UNCHANGED) // spell load case { - TC_LOG_ERROR(LOG_FILTER_PETS, "Pet::addSpell: Non-existed in SpellStore spell #%u request, deleting for all pets in `pet_spell`.", spellId); + TC_LOG_ERROR("entities.pet", "Pet::addSpell: Non-existed in SpellStore spell #%u request, deleting for all pets in `pet_spell`.", spellId); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_PET_SPELL); @@ -1391,7 +1402,7 @@ bool Pet::addSpell(uint32 spellId, ActiveStates active /*= ACT_DECIDE*/, PetSpel CharacterDatabase.Execute(stmt); } else - TC_LOG_ERROR(LOG_FILTER_PETS, "Pet::addSpell: Non-existed in SpellStore spell #%u request.", spellId); + TC_LOG_ERROR("entities.pet", "Pet::addSpell: Non-existed in SpellStore spell #%u request.", spellId); return false; } diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index ea18a9836a7..94c2f2e9f26 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -77,6 +77,7 @@ #include "World.h" #include "WorldPacket.h" #include "WorldSession.h" +#include "GameObjectAI.h" #define ZONE_UPDATE_INTERVAL (1*IN_MILLISECONDS) @@ -663,6 +664,7 @@ Player::Player(WorldSession* session): Unit(true) m_session = session; m_divider = 0; + m_ingametime = 0; m_ExtraFlags = 0; @@ -689,6 +691,7 @@ Player::Player(WorldSession* session): Unit(true) m_zoneUpdateTimer = 0; m_areaUpdateId = 0; + m_team = 0; m_nextSave = sWorld->getIntConfig(CONFIG_INTERVAL_SAVE); @@ -750,6 +753,8 @@ Player::Player(WorldSession* session): Unit(true) m_logintime = time(NULL); m_Last_tick = m_logintime; + m_Played_time[PLAYED_TIME_TOTAL] = 0; + m_Played_time[PLAYED_TIME_LEVEL] = 0; m_WeaponProficiency = 0; m_ArmorProficiency = 0; m_canParry = false; @@ -795,6 +800,7 @@ Player::Player(WorldSession* session): Unit(true) m_InstanceValid = true; m_dungeonDifficulty = DUNGEON_DIFFICULTY_NORMAL; m_raidDifficulty = RAID_DIFFICULTY_10MAN_NORMAL; + m_raidMapDifficulty = RAID_DIFFICULTY_10MAN_NORMAL; m_lastPotionId = 0; @@ -840,6 +846,18 @@ Player::Player(WorldSession* session): Unit(true) m_movedPlayer = this; m_seer = this; + m_recallMap = 0; + m_recallX = 0; + m_recallY = 0; + m_recallZ = 0; + m_recallO = 0; + + m_homebindMapId = 0; + m_homebindAreaId = 0; + m_homebindX = 0; + m_homebindY = 0; + m_homebindZ = 0; + m_contestedPvPTimer = 0; m_declinedname = NULL; @@ -859,6 +877,11 @@ Player::Player(WorldSession* session): Unit(true) m_ChampioningFaction = 0; + m_timeSyncCounter = 0; + m_timeSyncTimer = 0; + m_timeSyncClient = 0; + m_timeSyncServer = 0; + for (uint8 i = 0; i < MAX_POWERS; ++i) m_powerFraction[i] = 0; @@ -943,7 +966,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo) PlayerInfo const* info = sObjectMgr->GetPlayerInfo(createInfo->Race, createInfo->Class); if (!info) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player::Create: Possible hacking-attempt: Account %u tried creating a character named '%s' with an invalid race/class pair (%u/%u) - refusing to do so.", + TC_LOG_ERROR("entities.player", "Player::Create: Possible hacking-attempt: Account %u tried creating a character named '%s' with an invalid race/class pair (%u/%u) - refusing to do so.", GetSession()->GetAccountId(), m_name.c_str(), createInfo->Race, createInfo->Class); return false; } @@ -956,7 +979,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo) ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(createInfo->Class); if (!cEntry) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player::Create: Possible hacking-attempt: Account %u tried creating a character named '%s' with an invalid character class (%u) - refusing to do so (wrong DBC-files?)", + TC_LOG_ERROR("entities.player", "Player::Create: Possible hacking-attempt: Account %u tried creating a character named '%s' with an invalid character class (%u) - refusing to do so (wrong DBC-files?)", GetSession()->GetAccountId(), m_name.c_str(), createInfo->Class); return false; } @@ -971,7 +994,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo) if (!IsValidGender(createInfo->Gender)) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player::Create: Possible hacking-attempt: Account %u tried creating a character named '%s' with an invalid gender (%u) - refusing to do so", + TC_LOG_ERROR("entities.player", "Player::Create: Possible hacking-attempt: Account %u tried creating a character named '%s' with an invalid gender (%u) - refusing to do so", GetSession()->GetAccountId(), m_name.c_str(), createInfo->Gender); return false; } @@ -1198,7 +1221,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo) bool Player::StoreNewItemInBestSlots(uint32 titem_id, uint32 titem_amount) { - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "STORAGE: Creating initial item, itemId = %u, count = %u", titem_id, titem_amount); + TC_LOG_DEBUG("entities.player.items", "STORAGE: Creating initial item, itemId = %u, count = %u", titem_id, titem_amount); // attempt equip by one while (titem_amount > 0) @@ -1227,7 +1250,7 @@ bool Player::StoreNewItemInBestSlots(uint32 titem_id, uint32 titem_amount) } // item can't be added - TC_LOG_ERROR(LOG_FILTER_PLAYER_ITEMS, "STORAGE: Can't equip or store initial item %u for race %u class %u, error msg = %u", titem_id, getRace(), getClass(), msg); + TC_LOG_ERROR("entities.player.items", "STORAGE: Can't equip or store initial item %u for race %u class %u, error msg = %u", titem_id, getRace(), getClass(), msg); return false; } @@ -1294,7 +1317,7 @@ uint32 Player::EnvironmentalDamage(EnviromentalDamage type, uint32 damage) { if (type == DAMAGE_FALL) // DealDamage not apply item durability loss at self damage { - TC_LOG_DEBUG(LOG_FILTER_PLAYER, "We are fall to death, loosing 10 percents durability"); + TC_LOG_DEBUG("entities.player", "We are fall to death, loosing 10 percents durability"); DurabilityLossAll(0.10f, false); // durability lost message WorldPacket data2(SMSG_DURABILITY_DAMAGE_DEATH, 0); @@ -1544,9 +1567,9 @@ void Player::Update(uint32 p_time) //ASSERT (!m_spellModTakingSpell); if (m_spellModTakingSpell) { - //TC_LOG_FATAL(LOG_FILTER_PLAYER, "Player has m_pad %u during update!", m_pad); + //TC_LOG_FATAL("entities.player", "Player has m_pad %u during update!", m_pad); //if (m_spellModTakingSpell) - TC_LOG_FATAL(LOG_FILTER_SPELLS_AURAS, "Player has m_spellModTakingSpell %u during update!", m_spellModTakingSpell->m_spellInfo->Id); + TC_LOG_FATAL("spells", "Player has m_spellModTakingSpell %u during update!", m_spellModTakingSpell->m_spellInfo->Id); m_spellModTakingSpell = NULL; } @@ -1756,7 +1779,7 @@ void Player::Update(uint32 p_time) // m_nextSave reset in SaveToDB call sScriptMgr->OnPlayerSave(this); SaveToDB(); - TC_LOG_DEBUG(LOG_FILTER_PLAYER, "Player '%s' (GUID: %u) saved", GetName().c_str(), GetGUIDLow()); + TC_LOG_DEBUG("entities.player", "Player '%s' (GUID: %u) saved", GetName().c_str(), GetGUIDLow()); } else m_nextSave -= p_time; @@ -1845,7 +1868,7 @@ void Player::setDeathState(DeathState s) { if (!cur) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "setDeathState: attempt to kill a dead player %s(%d)", GetName().c_str(), GetGUIDLow()); + TC_LOG_ERROR("entities.player", "setDeathState: attempt to kill a dead player %s(%d)", GetName().c_str(), GetGUIDLow()); return; } @@ -1912,12 +1935,12 @@ bool Player::BuildEnumData(PreparedQueryResult result, WorldPacket* data) PlayerInfo const* info = sObjectMgr->GetPlayerInfo(plrRace, plrClass); if (!info) { - TC_LOG_ERROR(LOG_FILTER_PLAYER_LOADING, "Player %u has incorrect race/class pair. Don't build enum.", guid); + TC_LOG_ERROR("entities.player.loading", "Player %u has incorrect race/class pair. Don't build enum.", guid); return false; } else if (!IsValidGender(gender)) { - TC_LOG_ERROR(LOG_FILTER_PLAYER_LOADING, "Player (%u) has incorrect gender (%u), don't build enum.", guid, gender); + TC_LOG_ERROR("entities.player.loading", "Player (%u) has incorrect gender (%u), don't build enum.", guid, gender); return false; } @@ -2084,14 +2107,14 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati { if (!MapManager::IsValidMapCoord(mapid, x, y, z, orientation)) { - TC_LOG_ERROR(LOG_FILTER_MAPS, "TeleportTo: invalid map (%d) or invalid coordinates (X: %f, Y: %f, Z: %f, O: %f) given when teleporting player (GUID: %u, name: %s, map: %d, X: %f, Y: %f, Z: %f, O: %f).", + TC_LOG_ERROR("maps", "TeleportTo: invalid map (%d) or invalid coordinates (X: %f, Y: %f, Z: %f, O: %f) given when teleporting player (GUID: %u, name: %s, map: %d, X: %f, Y: %f, Z: %f, O: %f).", mapid, x, y, z, orientation, GetGUIDLow(), GetName().c_str(), GetMapId(), GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); return false; } if (!GetSession()->HasPermission(rbac::RBAC_PERM_SKIP_CHECK_DISABLE_MAP) && DisableMgr::IsDisabledFor(DISABLE_TYPE_MAP, mapid, this)) { - TC_LOG_ERROR(LOG_FILTER_MAPS, "Player (GUID: %u, name: %s) tried to enter a forbidden map %u", GetGUIDLow(), GetName().c_str(), mapid); + TC_LOG_ERROR("maps", "Player (GUID: %u, name: %s) tried to enter a forbidden map %u", GetGUIDLow(), GetName().c_str(), mapid); SendTransferAborted(mapid, TRANSFER_ABORT_MAP_NOT_ALLOWED); return false; } @@ -2109,7 +2132,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati // client without expansion support if (GetSession()->Expansion() < mEntry->Expansion()) { - TC_LOG_DEBUG(LOG_FILTER_MAPS, "Player %s using client without required expansion tried teleport to non accessible map %u", GetName().c_str(), mapid); + TC_LOG_DEBUG("maps", "Player %s using client without required expansion tried teleport to non accessible map %u", GetName().c_str(), mapid); if (GetTransport()) { @@ -2124,7 +2147,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati return false; // normal client can't teleport to this map... } else - TC_LOG_DEBUG(LOG_FILTER_MAPS, "Player %s is being teleported to map %u", GetName().c_str(), mapid); + TC_LOG_DEBUG("maps", "Player %s is being teleported to map %u", GetName().c_str(), mapid); if (m_vehicle) ExitVehicle(); @@ -2178,26 +2201,8 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati if (!(options & TELE_TO_NOT_LEAVE_COMBAT)) CombatStop(); - // new final coordinates - float final_x = x; - float final_y = y; - float final_z = z; - float final_o = orientation; - - // Calculate final positions if on transport - if (m_transport) - { - float tx, ty, tz, to; - m_movementInfo.transport.pos.GetPosition(tx, ty, tz, to); - - final_x = x + tx * std::cos(orientation) - ty * std::sin(orientation); - final_y = y + ty * std::cos(orientation) + tx * std::sin(orientation); - final_z = z + tz; - final_o = Position::NormalizeOrientation(orientation + m_movementInfo.transport.pos.GetOrientation()); - } - // this will be used instead of the current location in SaveToDB - m_teleport_dest = WorldLocation(mapid, final_x, final_y, final_z, final_o); + m_teleport_dest = WorldLocation(mapid, x, y, z, orientation); SetFallInformation(0, z); // code for finish transfer called in WorldSession::HandleMovementOpcodes() @@ -2208,7 +2213,9 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati { Position oldPos; GetPosition(&oldPos); - Relocate(final_x, final_y, final_z, final_o); + if (HasUnitMovementFlag(MOVEMENTFLAG_HOVER)) + z += GetFloatValue(UNIT_FIELD_HOVERHEIGHT); + Relocate(x, y, z, orientation); SendTeleportAckPacket(); SendTeleportPacket(oldPos); // this automatically relocates to oldPos in order to broadcast the packet in the right place } @@ -2304,25 +2311,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati if (oldmap) oldmap->RemovePlayerFromMap(this, false); - // new final coordinates - float final_x = x; - float final_y = y; - float final_z = z; - float final_o = orientation; - - // Calculate final positions if on transport - if (m_transport) - { - float tx, ty, tz, to; - m_movementInfo.transport.pos.GetPosition(tx, ty, tz, to); - - final_x = x + tx * std::cos(orientation) - ty * std::sin(orientation); - final_y = y + ty * std::cos(orientation) + tx * std::sin(orientation); - final_z = z + tz; - final_o = Position::NormalizeOrientation(orientation + m_movementInfo.transport.pos.GetOrientation()); - } - - m_teleport_dest = WorldLocation(mapid, final_x, final_y, final_z, final_o); + m_teleport_dest = WorldLocation(mapid, x, y, z, orientation); SetFallInformation(0, z); // if the player is saved before worldportack (at logout for example) // this will be used instead of the current location in SaveToDB @@ -2471,7 +2460,7 @@ void Player::RemoveFromWorld() { if (WorldObject* viewpoint = GetViewpoint()) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player %s has viewpoint %u %u when removed from world", + TC_LOG_ERROR("entities.player", "Player %s has viewpoint %u %u when removed from world", GetName().c_str(), viewpoint->GetEntry(), viewpoint->GetTypeId()); SetViewpoint(viewpoint, false); } @@ -2797,7 +2786,7 @@ GameObject* Player::GetGameObjectIfCanInteractWith(uint64 guid, GameobjectTypes if (go->IsWithinDistInMap(this, maxdist)) return go; - TC_LOG_DEBUG(LOG_FILTER_MAPS, "IsGameObjectOfTypeInRange: GameObject '%s' [GUID: %u] is too far away from player %s [GUID: %u] to be used by him (distance=%f, maximal 10 is allowed)", go->GetGOInfo()->name.c_str(), + TC_LOG_DEBUG("maps", "IsGameObjectOfTypeInRange: GameObject '%s' [GUID: %u] is too far away from player %s [GUID: %u] to be used by him (distance=%f, maximal 10 is allowed)", go->GetGOInfo()->name.c_str(), go->GetGUIDLow(), GetName().c_str(), GetGUIDLow(), go->GetDistance(this)); } } @@ -3410,7 +3399,7 @@ void Player::SendInitialSpells() GetSession()->SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CHARACTER: Sent Initial Spells"); + TC_LOG_DEBUG("network", "CHARACTER: Sent Initial Spells"); } void Player::RemoveMail(uint32 id) @@ -3504,12 +3493,12 @@ bool Player::AddTalent(uint32 spellId, uint8 spec, bool learning) // do character spell book cleanup (all characters) if (!IsInWorld() && !learning) // spell load case { - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.", spellId); + TC_LOG_ERROR("spells", "Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.", spellId); DeleteSpellFromAllPlayers(spellId); } else - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Non-existed in SpellStore spell #%u request.", spellId); + TC_LOG_ERROR("spells", "Player::addSpell: Non-existed in SpellStore spell #%u request.", spellId); return false; } @@ -3519,12 +3508,12 @@ bool Player::AddTalent(uint32 spellId, uint8 spec, bool learning) // do character spell book cleanup (all characters) if (!IsInWorld() && !learning) // spell load case { - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Player::addTalent: Broken spell #%u learning not allowed, deleting for all characters in `character_talent`.", spellId); + TC_LOG_ERROR("spells", "Player::addTalent: Broken spell #%u learning not allowed, deleting for all characters in `character_talent`.", spellId); DeleteSpellFromAllPlayers(spellId); } else - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Player::addTalent: Broken spell #%u learning not allowed.", spellId); + TC_LOG_ERROR("spells", "Player::addTalent: Broken spell #%u learning not allowed.", spellId); return false; } @@ -3569,12 +3558,12 @@ bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent // do character spell book cleanup (all characters) if (!IsInWorld() && !learning) // spell load case { - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.", spellId); + TC_LOG_ERROR("spells", "Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.", spellId); DeleteSpellFromAllPlayers(spellId); } else - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Non-existed in SpellStore spell #%u request.", spellId); + TC_LOG_ERROR("spells", "Player::addSpell: Non-existed in SpellStore spell #%u request.", spellId); return false; } @@ -3584,12 +3573,12 @@ bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent // do character spell book cleanup (all characters) if (!IsInWorld() && !learning) // spell load case { - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Broken spell #%u learning not allowed, deleting for all characters in `character_spell`.", spellId); + TC_LOG_ERROR("spells", "Player::addSpell: Broken spell #%u learning not allowed, deleting for all characters in `character_spell`.", spellId); DeleteSpellFromAllPlayers(spellId); } else - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Broken spell #%u learning not allowed.", spellId); + TC_LOG_ERROR("spells", "Player::addSpell: Broken spell #%u learning not allowed.", spellId); return false; } @@ -4344,7 +4333,7 @@ void Player::_LoadSpellCooldowns(PreparedQueryResult result) if (!sSpellMgr->GetSpellInfo(spell_id)) { - TC_LOG_ERROR(LOG_FILTER_PLAYER_LOADING, "Player %u has unknown spell %u in `character_spell_cooldown`, skipping.", GetGUIDLow(), spell_id); + TC_LOG_ERROR("entities.player.loading", "Player %u has unknown spell %u in `character_spell_cooldown`, skipping.", GetGUIDLow(), spell_id); continue; } @@ -4354,7 +4343,7 @@ void Player::_LoadSpellCooldowns(PreparedQueryResult result) AddSpellCooldown(spell_id, item_id, db_time); - TC_LOG_DEBUG(LOG_FILTER_PLAYER_LOADING, "Player (GUID: %u) spell %u, item %u cooldown loaded (%u secs).", GetGUIDLow(), spell_id, item_id, uint32(db_time-curTime)); + TC_LOG_DEBUG("entities.player.loading", "Player (GUID: %u) spell %u, item %u cooldown loaded (%u secs).", GetGUIDLow(), spell_id, item_id, uint32(db_time-curTime)); } while (result->NextRow()); } @@ -5025,7 +5014,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC break; } default: - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player::DeleteFromDB: Unsupported delete method: %u.", charDelete_method); + TC_LOG_ERROR("entities.player", "Player::DeleteFromDB: Unsupported delete method: %u.", charDelete_method); return; } @@ -5058,7 +5047,7 @@ void Player::DeleteOldCharacters() */ void Player::DeleteOldCharacters(uint32 keepDays) { - TC_LOG_INFO(LOG_FILTER_PLAYER, "Player::DeleteOldChars: Deleting all characters which have been deleted %u days before...", keepDays); + TC_LOG_INFO("entities.player", "Player::DeleteOldChars: Deleting all characters which have been deleted %u days before...", keepDays); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_OLD_CHARS); stmt->setUInt32(0, uint32(time(NULL) - time_t(keepDays * DAY))); @@ -5066,7 +5055,7 @@ void Player::DeleteOldCharacters(uint32 keepDays) if (result) { - TC_LOG_DEBUG(LOG_FILTER_PLAYER, "Player::DeleteOldChars: Found " UI64FMTD " character(s) to delete", result->GetRowCount()); + TC_LOG_DEBUG("entities.player", "Player::DeleteOldChars: Found " UI64FMTD " character(s) to delete", result->GetRowCount()); do { Field* fields = result->Fetch(); @@ -5086,7 +5075,7 @@ void Player::SetMovement(PlayerMovementType pType) case MOVE_WATER_WALK: data.Initialize(SMSG_MOVE_WATER_WALK, GetPackGUID().size()+4); break; case MOVE_LAND_WALK: data.Initialize(SMSG_MOVE_LAND_WALK, GetPackGUID().size()+4); break; default: - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player::SetMovement: Unsupported move type (%d), data not sent to client.", pType); + TC_LOG_ERROR("entities.player", "Player::SetMovement: Unsupported move type (%d), data not sent to client.", pType); return; } data.append(GetPackGUID()); @@ -5115,7 +5104,7 @@ void Player::BuildPlayerRepop() // the player cannot have a corpse already, only bones which are not returned by GetCorpse if (GetCorpse()) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "BuildPlayerRepop: player %s(%d) already has a corpse", GetName().c_str(), GetGUIDLow()); + TC_LOG_ERROR("entities.player", "BuildPlayerRepop: player %s(%d) already has a corpse", GetName().c_str(), GetGUIDLow()); return; } @@ -5124,7 +5113,7 @@ void Player::BuildPlayerRepop() Corpse* corpse = GetCorpse(); if (!corpse) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Error creating corpse for Player %s [%u]", GetName().c_str(), GetGUIDLow()); + TC_LOG_ERROR("entities.player", "Error creating corpse for Player %s [%u]", GetName().c_str(), GetGUIDLow()); return; } GetMap()->AddToMap(corpse); @@ -5231,7 +5220,7 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness) void Player::KillPlayer() { if (IsFlying() && !GetTransport()) - i_motionMaster.MoveFall(); + GetMotionMaster()->MoveFall(); SetMovement(MOVE_ROOT); @@ -5479,7 +5468,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g DurabilityCostsEntry const* dcost = sDurabilityCostsStore.LookupEntry(ditemProto->ItemLevel); if (!dcost) { - TC_LOG_ERROR(LOG_FILTER_PLAYER_ITEMS, "RepairDurability: Wrong item lvl %u", ditemProto->ItemLevel); + TC_LOG_ERROR("entities.player.items", "RepairDurability: Wrong item lvl %u", ditemProto->ItemLevel); return TotalCost; } @@ -5487,7 +5476,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g DurabilityQualityEntry const* dQualitymodEntry = sDurabilityQualityStore.LookupEntry(dQualitymodEntryId); if (!dQualitymodEntry) { - TC_LOG_ERROR(LOG_FILTER_PLAYER_ITEMS, "RepairDurability: Wrong dQualityModEntry %u", dQualitymodEntryId); + TC_LOG_ERROR("entities.player.items", "RepairDurability: Wrong dQualityModEntry %u", dQualitymodEntryId); return TotalCost; } @@ -5503,7 +5492,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g { if (GetGuildId() == 0) { - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "You are not member of a guild"); + TC_LOG_DEBUG("entities.player.items", "You are not member of a guild"); return TotalCost; } @@ -5518,7 +5507,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g } else if (!HasEnoughMoney(costs)) { - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "You do not have enough money"); + TC_LOG_DEBUG("entities.player.items", "You do not have enough money"); return TotalCost; } else @@ -5618,7 +5607,7 @@ void Player::CleanupChannels() if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetTeam())) cMgr->LeftChannel(ch->GetName()); // deleted channel if empty } - TC_LOG_DEBUG(LOG_FILTER_CHATSYS, "Player %s: channels cleaned up!", GetName().c_str()); + TC_LOG_DEBUG("chat.system", "Player %s: channels cleaned up!", GetName().c_str()); } void Player::UpdateLocalChannels(uint32 newZone) @@ -5726,7 +5715,7 @@ void Player::HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, floa { if (modGroup >= BASEMOD_END || modType >= MOD_END) { - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "ERROR in HandleBaseModValue(): non existed BaseModGroup of wrong BaseModType!"); + TC_LOG_ERROR("spells", "ERROR in HandleBaseModValue(): non existed BaseModGroup of wrong BaseModType!"); return; } @@ -5752,7 +5741,7 @@ float Player::GetBaseModValue(BaseModGroup modGroup, BaseModType modType) const { if (modGroup >= BASEMOD_END || modType >= MOD_END) { - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "trial to access non existed BaseModGroup or wrong BaseModType!"); + TC_LOG_ERROR("spells", "trial to access non existed BaseModGroup or wrong BaseModType!"); return 0.0f; } @@ -5766,7 +5755,7 @@ float Player::GetTotalBaseModValue(BaseModGroup modGroup) const { if (modGroup >= BASEMOD_END) { - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "wrong BaseModGroup in GetTotalBaseModValue()!"); + TC_LOG_ERROR("spells", "wrong BaseModGroup in GetTotalBaseModValue()!"); return 0.0f; } @@ -6141,7 +6130,7 @@ inline int SkillGainChance(uint32 SkillValue, uint32 GrayLevel, uint32 GreenLeve bool Player::UpdateCraftSkill(uint32 spellid) { - TC_LOG_DEBUG(LOG_FILTER_PLAYER_SKILLS, "UpdateCraftSkill spellid %d", spellid); + TC_LOG_DEBUG("entities.player.skills", "UpdateCraftSkill spellid %d", spellid); SkillLineAbilityMapBounds bounds = sSpellMgr->GetSkillLineAbilityMapBounds(spellid); @@ -6173,7 +6162,7 @@ bool Player::UpdateCraftSkill(uint32 spellid) bool Player::UpdateGatherSkill(uint32 SkillId, uint32 SkillValue, uint32 RedLevel, uint32 Multiplicator) { - TC_LOG_DEBUG(LOG_FILTER_PLAYER_SKILLS, "UpdateGatherSkill(SkillId %d SkillLevel %d RedLevel %d)", SkillId, SkillValue, RedLevel); + TC_LOG_DEBUG("entities.player.skills", "UpdateGatherSkill(SkillId %d SkillLevel %d RedLevel %d)", SkillId, SkillValue, RedLevel); uint32 gathering_skill_gain = sWorld->getIntConfig(CONFIG_SKILL_GAIN_GATHERING); @@ -6201,7 +6190,7 @@ bool Player::UpdateGatherSkill(uint32 SkillId, uint32 SkillValue, uint32 RedLeve bool Player::UpdateFishingSkill() { - TC_LOG_DEBUG(LOG_FILTER_PLAYER_SKILLS, "UpdateFishingSkill"); + TC_LOG_DEBUG("entities.player.skills", "UpdateFishingSkill"); uint32 SkillValue = GetPureSkillValue(SKILL_FISHING); @@ -6220,13 +6209,13 @@ static const size_t bonusSkillLevelsSize = sizeof(bonusSkillLevels) / sizeof(uin bool Player::UpdateSkillPro(uint16 SkillId, int32 Chance, uint32 step) { - TC_LOG_DEBUG(LOG_FILTER_PLAYER_SKILLS, "UpdateSkillPro(SkillId %d, Chance %3.1f%%)", SkillId, Chance / 10.0f); + TC_LOG_DEBUG("entities.player.skills", "UpdateSkillPro(SkillId %d, Chance %3.1f%%)", SkillId, Chance / 10.0f); if (!SkillId) return false; if (Chance <= 0) // speedup in 0 chance case { - TC_LOG_DEBUG(LOG_FILTER_PLAYER_SKILLS, "Player::UpdateSkillPro Chance=%3.1f%% missed", Chance / 10.0f); + TC_LOG_DEBUG("entities.player.skills", "Player::UpdateSkillPro Chance=%3.1f%% missed", Chance / 10.0f); return false; } @@ -6265,11 +6254,11 @@ bool Player::UpdateSkillPro(uint16 SkillId, int32 Chance, uint32 step) } UpdateSkillEnchantments(SkillId, SkillValue, new_value); UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL, SkillId); - TC_LOG_DEBUG(LOG_FILTER_PLAYER_SKILLS, "Player::UpdateSkillPro Chance=%3.1f%% taken", Chance / 10.0f); + TC_LOG_DEBUG("entities.player.skills", "Player::UpdateSkillPro Chance=%3.1f%% taken", Chance / 10.0f); return true; } - TC_LOG_DEBUG(LOG_FILTER_PLAYER_SKILLS, "Player::UpdateSkillPro Chance=%3.1f%% missed", Chance / 10.0f); + TC_LOG_DEBUG("entities.player.skills", "Player::UpdateSkillPro Chance=%3.1f%% missed", Chance / 10.0f); return false; } @@ -6488,7 +6477,7 @@ void Player::SetSkill(uint16 id, uint16 step, uint16 newVal, uint16 maxVal) SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(id); if (!pSkill) { - TC_LOG_ERROR(LOG_FILTER_PLAYER_SKILLS, "Skill not found in SkillLineStore: skill #%u", id); + TC_LOG_ERROR("entities.player.skills", "Skill not found in SkillLineStore: skill #%u", id); return; } @@ -6669,20 +6658,20 @@ void Player::SendActionButtons(uint32 state) const } GetSession()->SendPacket(&data); - TC_LOG_INFO(LOG_FILTER_NETWORKIO, "SMSG_ACTION_BUTTONS sent '%u' spec '%u' Sent", GetGUIDLow(), m_activeSpec); + TC_LOG_INFO("network", "SMSG_ACTION_BUTTONS sent '%u' spec '%u' Sent", GetGUIDLow(), m_activeSpec); } bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type) { if (button >= MAX_ACTION_BUTTONS) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Action %u not added into button %u for player %s (GUID: %u): button must be < %u", action, button, GetName().c_str(), GUID_LOPART(GetGUID()), MAX_ACTION_BUTTONS ); + TC_LOG_ERROR("entities.player", "Action %u not added into button %u for player %s (GUID: %u): button must be < %u", action, button, GetName().c_str(), GUID_LOPART(GetGUID()), MAX_ACTION_BUTTONS ); return false; } if (action >= MAX_ACTION_BUTTON_ACTION_VALUE) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Action %u not added into button %u for player %s (GUID: %u): action must be < %u", action, button, GetName().c_str(), GUID_LOPART(GetGUID()), MAX_ACTION_BUTTON_ACTION_VALUE); + TC_LOG_ERROR("entities.player", "Action %u not added into button %u for player %s (GUID: %u): action must be < %u", action, button, GetName().c_str(), GUID_LOPART(GetGUID()), MAX_ACTION_BUTTON_ACTION_VALUE); return false; } @@ -6691,20 +6680,20 @@ bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type) case ACTION_BUTTON_SPELL: if (!sSpellMgr->GetSpellInfo(action)) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Spell action %u not added into button %u for player %s (GUID: %u): spell not exist", action, button, GetName().c_str(), GUID_LOPART(GetGUID())); + TC_LOG_ERROR("entities.player", "Spell action %u not added into button %u for player %s (GUID: %u): spell not exist", action, button, GetName().c_str(), GUID_LOPART(GetGUID())); return false; } if (!HasSpell(action)) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Spell action %u not added into button %u for player %s (GUID: %u): player don't known this spell", action, button, GetName().c_str(), GUID_LOPART(GetGUID())); + TC_LOG_ERROR("entities.player", "Spell action %u not added into button %u for player %s (GUID: %u): player don't known this spell", action, button, GetName().c_str(), GUID_LOPART(GetGUID())); return false; } break; case ACTION_BUTTON_ITEM: if (!sObjectMgr->GetItemTemplate(action)) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Item action %u not added into button %u for player %s (GUID: %u): item not exist", action, button, GetName().c_str(), GUID_LOPART(GetGUID())); + TC_LOG_ERROR("entities.player", "Item action %u not added into button %u for player %s (GUID: %u): item not exist", action, button, GetName().c_str(), GUID_LOPART(GetGUID())); return false; } break; @@ -6714,7 +6703,7 @@ bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type) case ACTION_BUTTON_EQSET: break; default: - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Unknown action type %u", type); + TC_LOG_ERROR("entities.player", "Unknown action type %u", type); return false; // other cases not checked at this moment } @@ -6732,7 +6721,7 @@ ActionButton* Player::addActionButton(uint8 button, uint32 action, uint8 type) // set data and update to CHANGED if not NEW ab.SetActionAndType(action, ActionButtonType(type)); - TC_LOG_DEBUG(LOG_FILTER_PLAYER, "Player '%u' Added Action '%u' (type %u) to Button '%u'", GetGUIDLow(), action, type, button); + TC_LOG_DEBUG("entities.player", "Player '%u' Added Action '%u' (type %u) to Button '%u'", GetGUIDLow(), action, type, button); return &ab; } @@ -6747,7 +6736,7 @@ void Player::removeActionButton(uint8 button) else buttonItr->second.uState = ACTIONBUTTON_DELETED; // saved, will deleted at next save - TC_LOG_DEBUG(LOG_FILTER_PLAYER, "Action Button '%u' Removed from Player '%u'", button, GetGUIDLow()); + TC_LOG_DEBUG("entities.player", "Action Button '%u' Removed from Player '%u'", button, GetGUIDLow()); } ActionButton const* Player::GetActionButton(uint8 button) @@ -6859,7 +6848,7 @@ void Player::CheckAreaExploreAndOutdoor() if (offset >= PLAYER_EXPLORED_ZONES_SIZE) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Wrong area flag %u in map data for (X: %f Y: %f) point to field PLAYER_EXPLORED_ZONES_1 + %u ( %u must be < %u ).", areaFlag, GetPositionX(), GetPositionY(), offset, offset, PLAYER_EXPLORED_ZONES_SIZE); + TC_LOG_ERROR("entities.player", "Wrong area flag %u in map data for (X: %f Y: %f) point to field PLAYER_EXPLORED_ZONES_1 + %u ( %u must be < %u ).", areaFlag, GetPositionX(), GetPositionY(), offset, offset, PLAYER_EXPLORED_ZONES_SIZE); return; } @@ -6875,7 +6864,7 @@ void Player::CheckAreaExploreAndOutdoor() AreaTableEntry const* areaEntry = GetAreaEntryByAreaFlagAndMap(areaFlag, GetMapId()); if (!areaEntry) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player %u discovered unknown area (x: %f y: %f z: %f map: %u", GetGUIDLow(), GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId()); + TC_LOG_ERROR("entities.player", "Player %u discovered unknown area (x: %f y: %f z: %f map: %u", GetGUIDLow(), GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId()); return; } @@ -6910,7 +6899,7 @@ void Player::CheckAreaExploreAndOutdoor() GiveXP(XP, NULL); SendExplorationExperience(area, XP); } - TC_LOG_INFO(LOG_FILTER_PLAYER, "Player %u discovered a new area: %u", GetGUIDLow(), area); + TC_LOG_INFO("entities.player", "Player %u discovered a new area: %u", GetGUIDLow(), area); } } } @@ -6924,10 +6913,10 @@ uint32 Player::TeamForRace(uint8 race) case 1: return HORDE; case 7: return ALLIANCE; } - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Race (%u) has wrong teamid (%u) in DBC: wrong DBC files?", uint32(race), rEntry->TeamID); + TC_LOG_ERROR("entities.player", "Race (%u) has wrong teamid (%u) in DBC: wrong DBC files?", uint32(race), rEntry->TeamID); } else - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Race (%u) not found in DBC: wrong DBC files?", uint32(race)); + TC_LOG_ERROR("entities.player", "Race (%u) not found in DBC: wrong DBC files?", uint32(race)); return ALLIANCE; } @@ -7656,7 +7645,7 @@ void Player::DuelComplete(DuelCompleteType type) if (!duel) return; - TC_LOG_DEBUG(LOG_FILTER_UNITS, "Duel Complete %s %s", GetName().c_str(), duel->opponent->GetName().c_str()); + TC_LOG_DEBUG("entities.unit", "Duel Complete %s %s", GetName().c_str(), duel->opponent->GetName().c_str()); WorldPacket data(SMSG_DUEL_COMPLETE, (1)); data << (uint8)((type != DUEL_INTERRUPTED) ? 1 : 0); @@ -7780,7 +7769,7 @@ void Player::_ApplyItemMods(Item* item, uint8 slot, bool apply) if (item->IsBroken()) return; - TC_LOG_INFO(LOG_FILTER_PLAYER_ITEMS, "applying mods for item %u ", item->GetGUIDLow()); + TC_LOG_INFO("entities.player.items", "applying mods for item %u ", item->GetGUIDLow()); uint8 attacktype = Player::GetAttackBySlot(slot); @@ -7798,7 +7787,7 @@ void Player::_ApplyItemMods(Item* item, uint8 slot, bool apply) ApplyItemEquipSpell(item, apply); ApplyEnchantment(item, apply); - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "_ApplyItemMods complete."); + TC_LOG_DEBUG("entities.player.items", "_ApplyItemMods complete."); } void Player::_ApplyItemBonuses(ItemTemplate const* proto, uint8 slot, bool apply, bool only_level_scale /*= false*/) @@ -8272,7 +8261,7 @@ void Player::ApplyEquipSpell(SpellInfo const* spellInfo, Item* item, bool apply, return; } - TC_LOG_DEBUG(LOG_FILTER_PLAYER, "WORLD: cast %s Equip spellId - %i", (item ? "item" : "itemset"), spellInfo->Id); + TC_LOG_DEBUG("entities.player", "WORLD: cast %s Equip spellId - %i", (item ? "item" : "itemset"), spellInfo->Id); CastSpell(this, spellInfo, true, item); } @@ -8378,7 +8367,7 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellData.SpellId); if (!spellInfo) { - TC_LOG_ERROR(LOG_FILTER_PLAYER_ITEMS, "WORLD: unknown Item spellid %i", spellData.SpellId); + TC_LOG_ERROR("entities.player.items", "WORLD: unknown Item spellid %i", spellData.SpellId); continue; } @@ -8433,7 +8422,7 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(pEnchant->spellid[s]); if (!spellInfo) { - TC_LOG_ERROR(LOG_FILTER_PLAYER_ITEMS, "Player::CastItemCombatSpell(GUID: %u, name: %s, enchant: %i): unknown spell %i is casted, ignoring...", + TC_LOG_ERROR("entities.player.items", "Player::CastItemCombatSpell(GUID: %u, name: %s, enchant: %i): unknown spell %i is casted, ignoring...", GetGUIDLow(), GetName().c_str(), pEnchant->ID, pEnchant->spellid[s]); continue; } @@ -8478,7 +8467,7 @@ void Player::CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(learn_spell_id); if (!spellInfo) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player::CastItemUseSpell: Item (Entry: %u) in have wrong spell id %u, ignoring ", proto->ItemId, learn_spell_id); + TC_LOG_ERROR("entities.player", "Player::CastItemUseSpell: Item (Entry: %u) in have wrong spell id %u, ignoring ", proto->ItemId, learn_spell_id); SendEquipError(EQUIP_ERR_NONE, item, NULL); return; } @@ -8510,7 +8499,7 @@ void Player::CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellData.SpellId); if (!spellInfo) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player::CastItemUseSpell: Item (Entry: %u) in have wrong spell id %u, ignoring", proto->ItemId, spellData.SpellId); + TC_LOG_ERROR("entities.player", "Player::CastItemUseSpell: Item (Entry: %u) in have wrong spell id %u, ignoring", proto->ItemId, spellData.SpellId); continue; } @@ -8538,7 +8527,7 @@ void Player::CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(pEnchant->spellid[s]); if (!spellInfo) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player::CastItemUseSpell Enchant %i, cast unknown spell %i", pEnchant->ID, pEnchant->spellid[s]); + TC_LOG_ERROR("entities.player", "Player::CastItemUseSpell Enchant %i, cast unknown spell %i", pEnchant->ID, pEnchant->spellid[s]); continue; } @@ -8555,7 +8544,7 @@ void Player::CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8 void Player::_RemoveAllItemMods() { - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "_RemoveAllItemMods start."); + TC_LOG_DEBUG("entities.player.items", "_RemoveAllItemMods start."); for (uint8 i = 0; i < INVENTORY_SLOT_BAG_END; ++i) { @@ -8598,12 +8587,12 @@ void Player::_RemoveAllItemMods() } } - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "_RemoveAllItemMods complete."); + TC_LOG_DEBUG("entities.player.items", "_RemoveAllItemMods complete."); } void Player::_ApplyAllItemMods() { - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "_ApplyAllItemMods start."); + TC_LOG_DEBUG("entities.player.items", "_ApplyAllItemMods start."); for (uint8 i = 0; i < INVENTORY_SLOT_BAG_END; ++i) { @@ -8647,7 +8636,7 @@ void Player::_ApplyAllItemMods() } } - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "_ApplyAllItemMods complete."); + TC_LOG_DEBUG("entities.player.items", "_ApplyAllItemMods complete."); } void Player::_ApplyAllLevelScaleItemMods(bool apply) @@ -8771,10 +8760,10 @@ void Player::SendLoot(uint64 guid, LootType loot_type) Loot* loot = 0; PermissionTypes permission = ALL_PERMISSION; - TC_LOG_DEBUG(LOG_FILTER_LOOT, "Player::SendLoot"); + TC_LOG_DEBUG("loot", "Player::SendLoot"); if (IS_GAMEOBJECT_GUID(guid)) { - TC_LOG_DEBUG(LOG_FILTER_LOOT, "IS_GAMEOBJECT_GUID(guid)"); + TC_LOG_DEBUG("loot", "IS_GAMEOBJECT_GUID(guid)"); GameObject* go = GetMap()->GetGameObject(guid); // not check distance for GO in case owned GO (fishing bobber case, for example) @@ -9110,7 +9099,7 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid) InstanceScript* instance = GetInstanceScript(); Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(zoneid); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Sending SMSG_INIT_WORLD_STATES to Map: %u, Zone: %u", mapid, zoneid); + TC_LOG_DEBUG("network", "Sending SMSG_INIT_WORLD_STATES to Map: %u, Zone: %u", mapid, zoneid); WorldPacket data(SMSG_INIT_WORLD_STATES, (4+4+4+2+(12*8))); data << uint32(mapid); // mapid @@ -9663,6 +9652,16 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid) data << uint32(3932) << uint32(0); // 13 WORLDSTATE_TIME_GUARDIAN_SHOW } break; + // The Oculus + case 4228: + if (instance && mapid == 578) + instance->FillInitialWorldStates(data); + else + { + data << uint32(3524) << uint32(0); // 9 WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW + data << uint32(3486) << uint32(0); // 10 WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT + } + break; // Ulduar case 4273: if (instance && mapid == 603) @@ -9673,13 +9672,7 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid) data << uint32(4131) << uint32(0); // 10 WORLDSTATE_ALGALON_DESPAWN_TIMER } break; - // Wintergrasp - case 4197: - if (bf && bf->GetTypeId() == BATTLEFIELD_WG) - { - bf->FillInitialWorldStates(data); - break; - } + // Halls of Refection case 4820: if (instance && mapid == 668) instance->FillInitialWorldStates(data); @@ -9689,7 +9682,13 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid) data << uint32(4882) << uint32(0); // 10 WORLD_STATE_HOR_WAVE_COUNT } break; - + // Wintergrasp + case 4197: + if (bf && bf->GetTypeId() == BATTLEFIELD_WG) + { + bf->FillInitialWorldStates(data); + break; + } // No break here, intended. default: data << uint32(0x914) << uint32(0x0); // 7 @@ -9749,7 +9748,7 @@ uint32 Player::GetXPRestBonus(uint32 xp) SetRestBonus(GetRestBonus() - rested_bonus); - TC_LOG_INFO(LOG_FILTER_PLAYER, "Player gain %u xp (+ %u Rested Bonus). Rested points=%f", xp+rested_bonus, rested_bonus, GetRestBonus()); + TC_LOG_INFO("entities.player", "Player gain %u xp (+ %u Rested Bonus). Rested points=%f", xp+rested_bonus, rested_bonus, GetRestBonus()); return rested_bonus; } @@ -9781,7 +9780,7 @@ void Player::ResetPetTalents() CharmInfo* charmInfo = pet->GetCharmInfo(); if (!charmInfo) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId()); + TC_LOG_ERROR("entities.player", "Object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId()); return; } pet->resetTalents(); @@ -10813,7 +10812,7 @@ InventoryResult Player::CanStoreItem_InInventorySlots(uint8 slot_begin, uint8 sl InventoryResult Player::CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, uint32 entry, uint32 count, Item* pItem, bool swap, uint32* no_space_count) const { - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanStoreItem bag = %u, slot = %u, item = %u, count = %u", bag, slot, entry, count); + TC_LOG_DEBUG("entities.player.items", "STORAGE: CanStoreItem bag = %u, slot = %u, item = %u, count = %u", bag, slot, entry, count); ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(entry); if (!pProto) @@ -11298,7 +11297,7 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const if (!pItem) continue; - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanStoreItems %i. item = %u, count = %u", k + 1, pItem->GetEntry(), pItem->GetCount()); + TC_LOG_DEBUG("entities.player.items", "STORAGE: CanStoreItems %i. item = %u, count = %u", k + 1, pItem->GetEntry(), pItem->GetCount()); ItemTemplate const* pProto = pItem->GetTemplate(); // strange item @@ -11515,7 +11514,7 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16 &dest, Item* pItem, bool dest = 0; if (pItem) { - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanEquipItem slot = %u, item = %u, count = %u", slot, pItem->GetEntry(), pItem->GetCount()); + TC_LOG_DEBUG("entities.player.items", "STORAGE: CanEquipItem slot = %u, item = %u, count = %u", slot, pItem->GetEntry(), pItem->GetCount()); ItemTemplate const* pProto = pItem->GetTemplate(); if (pProto) { @@ -11685,7 +11684,7 @@ InventoryResult Player::CanUnequipItem(uint16 pos, bool swap) const if (!pItem) return EQUIP_ERR_OK; - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanUnequipItem slot = %u, item = %u, count = %u", pos, pItem->GetEntry(), pItem->GetCount()); + TC_LOG_DEBUG("entities.player.items", "STORAGE: CanUnequipItem slot = %u, item = %u, count = %u", pos, pItem->GetEntry(), pItem->GetCount()); ItemTemplate const* pProto = pItem->GetTemplate(); if (!pProto) @@ -11721,7 +11720,7 @@ InventoryResult Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec &dest uint32 count = pItem->GetCount(); - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanBankItem bag = %u, slot = %u, item = %u, count = %u", bag, slot, pItem->GetEntry(), pItem->GetCount()); + TC_LOG_DEBUG("entities.player.items", "STORAGE: CanBankItem bag = %u, slot = %u, item = %u, count = %u", bag, slot, pItem->GetEntry(), pItem->GetCount()); ItemTemplate const* pProto = pItem->GetTemplate(); if (!pProto) return swap ? EQUIP_ERR_ITEMS_CANT_BE_SWAPPED : EQUIP_ERR_ITEM_NOT_FOUND; @@ -11737,7 +11736,7 @@ InventoryResult Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec &dest uint8 pItemslot = pItem->GetSlot(); if (pItemslot >= CURRENCYTOKEN_SLOT_START && pItemslot < CURRENCYTOKEN_SLOT_END) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Possible hacking attempt: Player %s [guid: %u] tried to move token [guid: %u, entry: %u] out of the currency bag!", + TC_LOG_ERROR("entities.player", "Possible hacking attempt: Player %s [guid: %u] tried to move token [guid: %u, entry: %u] out of the currency bag!", GetName().c_str(), GetGUIDLow(), pItem->GetGUIDLow(), pProto->ItemId); return EQUIP_ERR_ITEMS_CANT_BE_SWAPPED; } @@ -11905,7 +11904,7 @@ InventoryResult Player::CanUseItem(Item* pItem, bool not_loading) const { if (pItem) { - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanUseItem item = %u", pItem->GetEntry()); + TC_LOG_DEBUG("entities.player.items", "STORAGE: CanUseItem item = %u", pItem->GetEntry()); if (!IsAlive() && not_loading) return EQUIP_ERR_YOU_ARE_DEAD; @@ -12078,7 +12077,7 @@ InventoryResult Player::CanRollForItemInLFG(ItemTemplate const* proto, WorldObje InventoryResult Player::CanUseAmmo(uint32 item) const { - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanUseAmmo item = %u", item); + TC_LOG_DEBUG("entities.player.items", "STORAGE: CanUseAmmo item = %u", item); if (!IsAlive()) return EQUIP_ERR_YOU_ARE_DEAD; //if (isStunned()) @@ -12213,7 +12212,7 @@ Item* Player::_StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool uint8 bag = pos >> 8; uint8 slot = pos & 255; - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "STORAGE: StoreItem bag = %u, slot = %u, item = %u, count = %u, guid = %u", bag, slot, pItem->GetEntry(), count, pItem->GetGUIDLow()); + TC_LOG_DEBUG("entities.player.items", "STORAGE: StoreItem bag = %u, slot = %u, item = %u, count = %u, guid = %u", bag, slot, pItem->GetEntry(), count, pItem->GetGUIDLow()); Item* pItem2 = GetItemByPos(bag, slot); @@ -12359,7 +12358,7 @@ Item* Player::EquipItem(uint16 pos, Item* pItem, bool update) SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(cooldownSpell); if (!spellProto) - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Weapon switch cooldown spell %u couldn't be found in Spell.dbc", cooldownSpell); + TC_LOG_ERROR("entities.player", "Weapon switch cooldown spell %u couldn't be found in Spell.dbc", cooldownSpell); else { m_weaponChangeTimer = spellProto->StartRecoveryTime; @@ -12483,7 +12482,7 @@ void Player::VisualizeItem(uint8 slot, Item* pItem) if (pItem->GetTemplate()->Bonding == BIND_WHEN_EQUIPED || pItem->GetTemplate()->Bonding == BIND_WHEN_PICKED_UP || pItem->GetTemplate()->Bonding == BIND_QUEST_ITEM) pItem->SetBinding(true); - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "STORAGE: EquipItem slot = %u, item = %u", slot, pItem->GetEntry()); + TC_LOG_DEBUG("entities.player.items", "STORAGE: EquipItem slot = %u, item = %u", slot, pItem->GetEntry()); m_items[slot] = pItem; SetUInt64Value(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), pItem->GetGUID()); @@ -12513,7 +12512,7 @@ void Player::RemoveItem(uint8 bag, uint8 slot, bool update) Item* pItem = GetItemByPos(bag, slot); if (pItem) { - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "STORAGE: RemoveItem bag = %u, slot = %u, item = %u", bag, slot, pItem->GetEntry()); + TC_LOG_DEBUG("entities.player.items", "STORAGE: RemoveItem bag = %u, slot = %u, item = %u", bag, slot, pItem->GetEntry()); RemoveEnchantmentDurations(pItem); RemoveItemDurations(pItem); @@ -12632,7 +12631,7 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update) Item* pItem = GetItemByPos(bag, slot); if (pItem) { - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "STORAGE: DestroyItem bag = %u, slot = %u, item = %u", bag, slot, pItem->GetEntry()); + TC_LOG_DEBUG("entities.player.items", "STORAGE: DestroyItem bag = %u, slot = %u, item = %u", bag, slot, pItem->GetEntry()); // Also remove all contained items if the item is a bag. // This if () prevents item saving crashes if the condition for a bag to be empty before being destroyed was bypassed somehow. if (pItem->IsNotEmptyBag()) @@ -12729,7 +12728,7 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update) void Player::DestroyItemCount(uint32 itemEntry, uint32 count, bool update, bool unequip_check) { - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "STORAGE: DestroyItemCount item = %u, count = %u", itemEntry, count); + TC_LOG_DEBUG("entities.player.items", "STORAGE: DestroyItemCount item = %u, count = %u", itemEntry, count); uint32 remcount = 0; // in inventory @@ -12920,7 +12919,7 @@ void Player::DestroyItemCount(uint32 itemEntry, uint32 count, bool update, bool void Player::DestroyZoneLimitedItem(bool update, uint32 new_zone) { - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "STORAGE: DestroyZoneLimitedItem in map %u and area %u", GetMapId(), new_zone); + TC_LOG_DEBUG("entities.player.items", "STORAGE: DestroyZoneLimitedItem in map %u and area %u", GetMapId(), new_zone); // in inventory for (uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++) @@ -12952,7 +12951,7 @@ void Player::DestroyConjuredItems(bool update) { // used when entering arena // destroys all conjured items - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "STORAGE: DestroyConjuredItems"); + TC_LOG_DEBUG("entities.player.items", "STORAGE: DestroyConjuredItems"); // in inventory for (uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++) @@ -13008,7 +13007,7 @@ void Player::DestroyItemCount(Item* pItem, uint32 &count, bool update) if (!pItem) return; - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "STORAGE: DestroyItemCount item (GUID: %u, Entry: %u) count = %u", pItem->GetGUIDLow(), pItem->GetEntry(), count); + TC_LOG_DEBUG("entities.player.items", "STORAGE: DestroyItemCount item (GUID: %u, Entry: %u) count = %u", pItem->GetGUIDLow(), pItem->GetEntry(), count); if (pItem->GetCount() <= count) { @@ -13071,7 +13070,7 @@ void Player::SplitItem(uint16 src, uint16 dst, uint32 count) return; } - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "STORAGE: SplitItem bag = %u, slot = %u, item = %u, count = %u", dstbag, dstslot, pSrcItem->GetEntry(), count); + TC_LOG_DEBUG("entities.player.items", "STORAGE: SplitItem bag = %u, slot = %u, item = %u, count = %u", dstbag, dstslot, pSrcItem->GetEntry(), count); Item* pNewItem = pSrcItem->CloneItem(count, this); if (!pNewItem) { @@ -13156,7 +13155,7 @@ void Player::SwapItem(uint16 src, uint16 dst) if (!pSrcItem) return; - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "STORAGE: SwapItem bag = %u, slot = %u, item = %u", dstbag, dstslot, pSrcItem->GetEntry()); + TC_LOG_DEBUG("entities.player.items", "STORAGE: SwapItem bag = %u, slot = %u, item = %u", dstbag, dstslot, pSrcItem->GetEntry()); if (!IsAlive()) { @@ -13532,7 +13531,7 @@ void Player::AddItemToBuyBackSlot(Item* pItem) } RemoveItemFromBuyBackSlot(slot, true); - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "STORAGE: AddItemToBuyBackSlot item = %u, slot = %u", pItem->GetEntry(), slot); + TC_LOG_DEBUG("entities.player.items", "STORAGE: AddItemToBuyBackSlot item = %u, slot = %u", pItem->GetEntry(), slot); m_items[slot] = pItem; time_t base = time(NULL); @@ -13554,7 +13553,7 @@ void Player::AddItemToBuyBackSlot(Item* pItem) Item* Player::GetItemFromBuyBackSlot(uint32 slot) { - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "STORAGE: GetItemFromBuyBackSlot slot = %u", slot); + TC_LOG_DEBUG("entities.player.items", "STORAGE: GetItemFromBuyBackSlot slot = %u", slot); if (slot >= BUYBACK_SLOT_START && slot < BUYBACK_SLOT_END) return m_items[slot]; return NULL; @@ -13562,7 +13561,7 @@ Item* Player::GetItemFromBuyBackSlot(uint32 slot) void Player::RemoveItemFromBuyBackSlot(uint32 slot, bool del) { - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "STORAGE: RemoveItemFromBuyBackSlot slot = %u", slot); + TC_LOG_DEBUG("entities.player.items", "STORAGE: RemoveItemFromBuyBackSlot slot = %u", slot); if (slot >= BUYBACK_SLOT_START && slot < BUYBACK_SLOT_END) { Item* pItem = m_items[slot]; @@ -13588,7 +13587,7 @@ void Player::RemoveItemFromBuyBackSlot(uint32 slot, bool del) void Player::SendEquipError(InventoryResult msg, Item* pItem, Item* pItem2, uint32 itemid) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_INVENTORY_CHANGE_FAILURE (%u)", msg); + TC_LOG_DEBUG("network", "WORLD: Sent SMSG_INVENTORY_CHANGE_FAILURE (%u)", msg); WorldPacket data(SMSG_INVENTORY_CHANGE_FAILURE, (msg == EQUIP_ERR_CANT_EQUIP_LEVEL_I ? 22 : 18)); data << uint8(msg); @@ -13631,7 +13630,7 @@ void Player::SendEquipError(InventoryResult msg, Item* pItem, Item* pItem2, uint void Player::SendBuyError(BuyResult msg, Creature* creature, uint32 item, uint32 param) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_BUY_FAILED"); + TC_LOG_DEBUG("network", "WORLD: Sent SMSG_BUY_FAILED"); WorldPacket data(SMSG_BUY_FAILED, (8+4+4+1)); data << uint64(creature ? creature->GetGUID() : 0); data << uint32(item); @@ -13643,7 +13642,7 @@ void Player::SendBuyError(BuyResult msg, Creature* creature, uint32 item, uint32 void Player::SendSellError(SellResult msg, Creature* creature, uint64 guid, uint32 param) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_SELL_ITEM"); + TC_LOG_DEBUG("network", "WORLD: Sent SMSG_SELL_ITEM"); WorldPacket data(SMSG_SELL_ITEM, (8+8+(param?4:0)+1)); // last check 2.0.10 data << uint64(creature ? creature->GetGUID() : 0); data << uint64(guid); @@ -13724,7 +13723,7 @@ void Player::UpdateItemDuration(uint32 time, bool realtimeonly) if (m_itemDuration.empty()) return; - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "Player::UpdateItemDuration(%u, %u)", time, realtimeonly); + TC_LOG_DEBUG("entities.player.items", "Player::UpdateItemDuration(%u, %u)", time, realtimeonly); for (ItemDurationList::const_iterator itr = m_itemDuration.begin(); itr != m_itemDuration.end();) { @@ -13993,81 +13992,81 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool } } - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "Adding %u to stat nb %u", enchant_amount, enchant_spell_id); + TC_LOG_DEBUG("entities.player.items", "Adding %u to stat nb %u", enchant_amount, enchant_spell_id); switch (enchant_spell_id) { case ITEM_MOD_MANA: - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "+ %u MANA", enchant_amount); + TC_LOG_DEBUG("entities.player.items", "+ %u MANA", enchant_amount); HandleStatModifier(UNIT_MOD_MANA, BASE_VALUE, float(enchant_amount), apply); break; case ITEM_MOD_HEALTH: - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "+ %u HEALTH", enchant_amount); + TC_LOG_DEBUG("entities.player.items", "+ %u HEALTH", enchant_amount); HandleStatModifier(UNIT_MOD_HEALTH, BASE_VALUE, float(enchant_amount), apply); break; case ITEM_MOD_AGILITY: - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "+ %u AGILITY", enchant_amount); + TC_LOG_DEBUG("entities.player.items", "+ %u AGILITY", enchant_amount); HandleStatModifier(UNIT_MOD_STAT_AGILITY, TOTAL_VALUE, float(enchant_amount), apply); ApplyStatBuffMod(STAT_AGILITY, (float)enchant_amount, apply); break; case ITEM_MOD_STRENGTH: - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "+ %u STRENGTH", enchant_amount); + TC_LOG_DEBUG("entities.player.items", "+ %u STRENGTH", enchant_amount); HandleStatModifier(UNIT_MOD_STAT_STRENGTH, TOTAL_VALUE, float(enchant_amount), apply); ApplyStatBuffMod(STAT_STRENGTH, (float)enchant_amount, apply); break; case ITEM_MOD_INTELLECT: - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "+ %u INTELLECT", enchant_amount); + TC_LOG_DEBUG("entities.player.items", "+ %u INTELLECT", enchant_amount); HandleStatModifier(UNIT_MOD_STAT_INTELLECT, TOTAL_VALUE, float(enchant_amount), apply); ApplyStatBuffMod(STAT_INTELLECT, (float)enchant_amount, apply); break; case ITEM_MOD_SPIRIT: - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "+ %u SPIRIT", enchant_amount); + TC_LOG_DEBUG("entities.player.items", "+ %u SPIRIT", enchant_amount); HandleStatModifier(UNIT_MOD_STAT_SPIRIT, TOTAL_VALUE, float(enchant_amount), apply); ApplyStatBuffMod(STAT_SPIRIT, (float)enchant_amount, apply); break; case ITEM_MOD_STAMINA: - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "+ %u STAMINA", enchant_amount); + TC_LOG_DEBUG("entities.player.items", "+ %u STAMINA", enchant_amount); HandleStatModifier(UNIT_MOD_STAT_STAMINA, TOTAL_VALUE, float(enchant_amount), apply); ApplyStatBuffMod(STAT_STAMINA, (float)enchant_amount, apply); break; case ITEM_MOD_DEFENSE_SKILL_RATING: ApplyRatingMod(CR_DEFENSE_SKILL, enchant_amount, apply); - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "+ %u DEFENCE", enchant_amount); + TC_LOG_DEBUG("entities.player.items", "+ %u DEFENCE", enchant_amount); break; case ITEM_MOD_DODGE_RATING: ApplyRatingMod(CR_DODGE, enchant_amount, apply); - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "+ %u DODGE", enchant_amount); + TC_LOG_DEBUG("entities.player.items", "+ %u DODGE", enchant_amount); break; case ITEM_MOD_PARRY_RATING: ApplyRatingMod(CR_PARRY, enchant_amount, apply); - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "+ %u PARRY", enchant_amount); + TC_LOG_DEBUG("entities.player.items", "+ %u PARRY", enchant_amount); break; case ITEM_MOD_BLOCK_RATING: ApplyRatingMod(CR_BLOCK, enchant_amount, apply); - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "+ %u SHIELD_BLOCK", enchant_amount); + TC_LOG_DEBUG("entities.player.items", "+ %u SHIELD_BLOCK", enchant_amount); break; case ITEM_MOD_HIT_MELEE_RATING: ApplyRatingMod(CR_HIT_MELEE, enchant_amount, apply); - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "+ %u MELEE_HIT", enchant_amount); + TC_LOG_DEBUG("entities.player.items", "+ %u MELEE_HIT", enchant_amount); break; case ITEM_MOD_HIT_RANGED_RATING: ApplyRatingMod(CR_HIT_RANGED, enchant_amount, apply); - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "+ %u RANGED_HIT", enchant_amount); + TC_LOG_DEBUG("entities.player.items", "+ %u RANGED_HIT", enchant_amount); break; case ITEM_MOD_HIT_SPELL_RATING: ApplyRatingMod(CR_HIT_SPELL, enchant_amount, apply); - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "+ %u SPELL_HIT", enchant_amount); + TC_LOG_DEBUG("entities.player.items", "+ %u SPELL_HIT", enchant_amount); break; case ITEM_MOD_CRIT_MELEE_RATING: ApplyRatingMod(CR_CRIT_MELEE, enchant_amount, apply); - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "+ %u MELEE_CRIT", enchant_amount); + TC_LOG_DEBUG("entities.player.items", "+ %u MELEE_CRIT", enchant_amount); break; case ITEM_MOD_CRIT_RANGED_RATING: ApplyRatingMod(CR_CRIT_RANGED, enchant_amount, apply); - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "+ %u RANGED_CRIT", enchant_amount); + TC_LOG_DEBUG("entities.player.items", "+ %u RANGED_CRIT", enchant_amount); break; case ITEM_MOD_CRIT_SPELL_RATING: ApplyRatingMod(CR_CRIT_SPELL, enchant_amount, apply); - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "+ %u SPELL_CRIT", enchant_amount); + TC_LOG_DEBUG("entities.player.items", "+ %u SPELL_CRIT", enchant_amount); break; // Values from ITEM_STAT_MELEE_HA_RATING to ITEM_MOD_HASTE_RANGED_RATING are never used // in Enchantments @@ -14102,13 +14101,13 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool ApplyRatingMod(CR_HIT_MELEE, enchant_amount, apply); ApplyRatingMod(CR_HIT_RANGED, enchant_amount, apply); ApplyRatingMod(CR_HIT_SPELL, enchant_amount, apply); - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "+ %u HIT", enchant_amount); + TC_LOG_DEBUG("entities.player.items", "+ %u HIT", enchant_amount); break; case ITEM_MOD_CRIT_RATING: ApplyRatingMod(CR_CRIT_MELEE, enchant_amount, apply); ApplyRatingMod(CR_CRIT_RANGED, enchant_amount, apply); ApplyRatingMod(CR_CRIT_SPELL, enchant_amount, apply); - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "+ %u CRITICAL", enchant_amount); + TC_LOG_DEBUG("entities.player.items", "+ %u CRITICAL", enchant_amount); break; // Values ITEM_MOD_HIT_TAKEN_RATING and ITEM_MOD_CRIT_TAKEN_RATING are never used in Enchantment // case ITEM_MOD_HIT_TAKEN_RATING: @@ -14125,54 +14124,54 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool ApplyRatingMod(CR_CRIT_TAKEN_MELEE, enchant_amount, apply); ApplyRatingMod(CR_CRIT_TAKEN_RANGED, enchant_amount, apply); ApplyRatingMod(CR_CRIT_TAKEN_SPELL, enchant_amount, apply); - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "+ %u RESILIENCE", enchant_amount); + TC_LOG_DEBUG("entities.player.items", "+ %u RESILIENCE", enchant_amount); break; case ITEM_MOD_HASTE_RATING: ApplyRatingMod(CR_HASTE_MELEE, enchant_amount, apply); ApplyRatingMod(CR_HASTE_RANGED, enchant_amount, apply); ApplyRatingMod(CR_HASTE_SPELL, enchant_amount, apply); - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "+ %u HASTE", enchant_amount); + TC_LOG_DEBUG("entities.player.items", "+ %u HASTE", enchant_amount); break; case ITEM_MOD_EXPERTISE_RATING: ApplyRatingMod(CR_EXPERTISE, enchant_amount, apply); - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "+ %u EXPERTISE", enchant_amount); + TC_LOG_DEBUG("entities.player.items", "+ %u EXPERTISE", enchant_amount); break; case ITEM_MOD_ATTACK_POWER: HandleStatModifier(UNIT_MOD_ATTACK_POWER, TOTAL_VALUE, float(enchant_amount), apply); HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED, TOTAL_VALUE, float(enchant_amount), apply); - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "+ %u ATTACK_POWER", enchant_amount); + TC_LOG_DEBUG("entities.player.items", "+ %u ATTACK_POWER", enchant_amount); break; case ITEM_MOD_RANGED_ATTACK_POWER: HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED, TOTAL_VALUE, float(enchant_amount), apply); - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "+ %u RANGED_ATTACK_POWER", enchant_amount); + TC_LOG_DEBUG("entities.player.items", "+ %u RANGED_ATTACK_POWER", enchant_amount); break; // case ITEM_MOD_FERAL_ATTACK_POWER: // ApplyFeralAPBonus(enchant_amount, apply); -// TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "+ %u FERAL_ATTACK_POWER", enchant_amount); +// TC_LOG_DEBUG("entities.player.items", "+ %u FERAL_ATTACK_POWER", enchant_amount); // break; case ITEM_MOD_MANA_REGENERATION: ApplyManaRegenBonus(enchant_amount, apply); - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "+ %u MANA_REGENERATION", enchant_amount); + TC_LOG_DEBUG("entities.player.items", "+ %u MANA_REGENERATION", enchant_amount); break; case ITEM_MOD_ARMOR_PENETRATION_RATING: ApplyRatingMod(CR_ARMOR_PENETRATION, enchant_amount, apply); - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "+ %u ARMOR PENETRATION", enchant_amount); + TC_LOG_DEBUG("entities.player.items", "+ %u ARMOR PENETRATION", enchant_amount); break; case ITEM_MOD_SPELL_POWER: ApplySpellPowerBonus(enchant_amount, apply); - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "+ %u SPELL_POWER", enchant_amount); + TC_LOG_DEBUG("entities.player.items", "+ %u SPELL_POWER", enchant_amount); break; case ITEM_MOD_HEALTH_REGEN: ApplyHealthRegenBonus(enchant_amount, apply); - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "+ %u HEALTH_REGENERATION", enchant_amount); + TC_LOG_DEBUG("entities.player.items", "+ %u HEALTH_REGENERATION", enchant_amount); break; case ITEM_MOD_SPELL_PENETRATION: ApplySpellPenetrationBonus(enchant_amount, apply); - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "+ %u SPELL_PENETRATION", enchant_amount); + TC_LOG_DEBUG("entities.player.items", "+ %u SPELL_PENETRATION", enchant_amount); break; case ITEM_MOD_BLOCK_VALUE: HandleBaseModValue(SHIELD_BLOCK_VALUE, FLAT_MOD, float(enchant_amount), apply); - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "+ %u BLOCK_VALUE", enchant_amount); + TC_LOG_DEBUG("entities.player.items", "+ %u BLOCK_VALUE", enchant_amount); break; case ITEM_MOD_SPELL_HEALING_DONE: // deprecated case ITEM_MOD_SPELL_DAMAGE_DONE: // deprecated @@ -14206,7 +14205,7 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool // nothing do.. break; default: - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Unknown item enchantment (id = %d) display type: %d", enchant_id, enchant_display_type); + TC_LOG_ERROR("entities.player", "Unknown item enchantment (id = %d) display type: %d", enchant_id, enchant_display_type); break; } /*switch (enchant_display_type)*/ } /*for*/ @@ -14377,7 +14376,7 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool VendorItemData const* vendorItems = creature->GetVendorItems(); if (!vendorItems || vendorItems->Empty()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature %s (Entry: %u GUID: %u DB GUID: %u) has UNIT_NPC_FLAG_VENDOR set but has an empty trading item list.", creature->GetName().c_str(), creature->GetEntry(), creature->GetGUIDLow(), creature->GetDBTableGUIDLow()); + TC_LOG_ERROR("sql.sql", "Creature %s (Entry: %u GUID: %u DB GUID: %u) has UNIT_NPC_FLAG_VENDOR set but has an empty trading item list.", creature->GetName().c_str(), creature->GetEntry(), creature->GetGUIDLow(), creature->GetDBTableGUIDLow()); canTalk = false; } break; @@ -14411,7 +14410,7 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool break; case GOSSIP_OPTION_TRAINER: if (getClass() != creature->GetCreatureTemplate()->trainer_class && creature->GetCreatureTemplate()->trainer_type == TRAINER_TYPE_CLASS) - TC_LOG_ERROR(LOG_FILTER_SQL, "GOSSIP_OPTION_TRAINER:: Player %s (GUID: %u) request wrong gossip menu: %u with wrong class: %u at Creature: %s (Entry: %u, Trainer Class: %u)", + TC_LOG_ERROR("sql.sql", "GOSSIP_OPTION_TRAINER:: Player %s (GUID: %u) request wrong gossip menu: %u with wrong class: %u at Creature: %s (Entry: %u, Trainer Class: %u)", GetName().c_str(), GetGUIDLow(), menu->GetGossipMenu().GetMenuId(), getClass(), creature->GetName().c_str(), creature->GetEntry(), creature->GetCreatureTemplate()->trainer_class); // no break; case GOSSIP_OPTION_GOSSIP: @@ -14427,7 +14426,7 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool canTalk = false; break; default: - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature entry %u has unknown gossip option %u for menu %u", creature->GetEntry(), itr->second.OptionType, itr->second.MenuId); + TC_LOG_ERROR("sql.sql", "Creature entry %u has unknown gossip option %u for menu %u", creature->GetEntry(), itr->second.OptionType, itr->second.MenuId); canTalk = false; break; } @@ -14522,7 +14521,7 @@ void Player::OnGossipSelect(WorldObject* source, uint32 gossipListId, uint32 men { if (gossipOptionId > GOSSIP_OPTION_QUESTGIVER) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player guid %u request invalid gossip option for GameObject entry %u", GetGUIDLow(), source->GetEntry()); + TC_LOG_ERROR("entities.player", "Player guid %u request invalid gossip option for GameObject entry %u", GetGUIDLow(), source->GetEntry()); return; } } @@ -14626,7 +14625,7 @@ void Player::OnGossipSelect(WorldObject* source, uint32 gossipListId, uint32 men if (bgTypeId == BATTLEGROUND_TYPE_NONE) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "a user (guid %u) requested battlegroundlist from a npc who is no battlemaster", GetGUIDLow()); + TC_LOG_ERROR("entities.player", "a user (guid %u) requested battlegroundlist from a npc who is no battlemaster", GetGUIDLow()); return; } @@ -14772,11 +14771,7 @@ void Player::SendPreparedQuest(uint64 guid) } if (quest->IsAutoAccept() && CanAddQuest(quest, true) && CanTakeQuest(quest, true)) - { - AddQuest(quest, object); - if (CanCompleteQuest(questId)) - CompleteQuest(questId); - } + AddQuestAndCheckCompletion(quest, object); if ((quest->IsAutoComplete() && quest->IsRepeatable() && !quest->IsDailyOrWeekly()) || quest->HasFlag(QUEST_FLAGS_AUTOCOMPLETE)) PlayerTalkClass->SendQuestGiverRequestItems(quest, guid, CanCompleteRepeatableQuest(quest), true); @@ -15044,6 +15039,53 @@ bool Player::CanRewardQuest(Quest const* quest, bool msg) return true; } +void Player::AddQuestAndCheckCompletion(Quest const* quest, Object* questGiver) +{ + AddQuest(quest, questGiver); + + if (CanCompleteQuest(quest->GetQuestId())) + CompleteQuest(quest->GetQuestId()); + + if (!questGiver) + return; + + switch (questGiver->GetTypeId()) + { + case TYPEID_UNIT: + sScriptMgr->OnQuestAccept(this, (questGiver->ToCreature()), quest); + questGiver->ToCreature()->AI()->sQuestAccept(this, quest); + break; + case TYPEID_ITEM: + case TYPEID_CONTAINER: + { + Item* item = (Item*)questGiver; + sScriptMgr->OnQuestAccept(this, item, quest); + + // destroy not required for quest finish quest starting item + bool destroyItem = true; + for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i) + { + if (quest->RequiredItemId[i] == item->GetEntry() && item->GetTemplate()->MaxCount > 0) + { + destroyItem = false; + break; + } + } + + if (destroyItem) + DestroyItem(item->GetBagSlot(), item->GetSlot(), true); + + break; + } + case TYPEID_GAMEOBJECT: + sScriptMgr->OnQuestAccept(this, questGiver->ToGameObject(), quest); + questGiver->ToGameObject()->AI()->QuestAccept(this, quest); + break; + default: + break; + } +} + bool Player::CanRewardQuest(Quest const* quest, uint32 reward, bool msg) { // prevent receive reward with quest items in bank or for not completed quest @@ -15335,9 +15377,27 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver, // cast spells after mark quest complete (some spells have quest completed state requirements in spell_area data) if (quest->GetRewSpellCast() > 0) - CastSpell(this, quest->GetRewSpellCast(), true); + { + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(quest->GetRewSpellCast()); + if (questGiver->isType(TYPEMASK_UNIT) && !spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL) && !spellInfo->HasEffect(SPELL_EFFECT_CREATE_ITEM)) + { + if (Creature* creature = GetMap()->GetCreature(questGiver->GetGUID())) + creature->CastSpell(this, quest->GetRewSpellCast(), true); + } + else + CastSpell(this, quest->GetRewSpellCast(), true); + } else if (quest->GetRewSpell() > 0) - CastSpell(this, quest->GetRewSpell(), true); + { + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(quest->GetRewSpell()); + if (questGiver->isType(TYPEMASK_UNIT) && !spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL) && !spellInfo->HasEffect(SPELL_EFFECT_CREATE_ITEM)) + { + if (Creature* creature = GetMap()->GetCreature(questGiver->GetGUID())) + creature->CastSpell(this, quest->GetRewSpell(), true); + } + else + CastSpell(this, quest->GetRewSpell(), true); + } if (quest->GetZoneOrSort() > 0) UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE, quest->GetZoneOrSort()); @@ -15406,7 +15466,7 @@ bool Player::SatisfyQuestSkill(Quest const* qInfo, bool msg) const if (msg) { SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestSkill: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player does not have required skill value.", qInfo->GetQuestId()); + TC_LOG_DEBUG("misc", "SatisfyQuestSkill: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player does not have required skill value.", qInfo->GetQuestId()); } return false; @@ -15422,7 +15482,7 @@ bool Player::SatisfyQuestLevel(Quest const* qInfo, bool msg) if (msg) { SendCanTakeQuestResponse(INVALIDREASON_QUEST_FAILED_LOW_LEVEL); - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestLevel: Sent INVALIDREASON_QUEST_FAILED_LOW_LEVEL (questId: %u) because player does not have required (min) level.", qInfo->GetQuestId()); + TC_LOG_DEBUG("misc", "SatisfyQuestLevel: Sent INVALIDREASON_QUEST_FAILED_LOW_LEVEL (questId: %u) because player does not have required (min) level.", qInfo->GetQuestId()); } return false; } @@ -15431,7 +15491,7 @@ bool Player::SatisfyQuestLevel(Quest const* qInfo, bool msg) if (msg) { SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); // There doesn't seem to be a specific response for too high player level - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestLevel: Sent INVALIDREASON_QUEST_FAILED_LOW_LEVEL (questId: %u) because player does not have required (max) level.", qInfo->GetQuestId()); + TC_LOG_DEBUG("misc", "SatisfyQuestLevel: Sent INVALIDREASON_QUEST_FAILED_LOW_LEVEL (questId: %u) because player does not have required (max) level.", qInfo->GetQuestId()); } return false; } @@ -15448,7 +15508,7 @@ bool Player::SatisfyQuestLog(bool msg) { WorldPacket data(SMSG_QUESTLOG_FULL, 0); GetSession()->SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTLOG_FULL"); + TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTLOG_FULL"); } return false; } @@ -15492,7 +15552,7 @@ bool Player::SatisfyQuestPreviousQuest(Quest const* qInfo, bool msg) if (msg) { SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestPreviousQuest: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player does not have required quest (1).", qInfo->GetQuestId()); + TC_LOG_DEBUG("misc", "SatisfyQuestPreviousQuest: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player does not have required quest (1).", qInfo->GetQuestId()); } return false; } @@ -15525,7 +15585,7 @@ bool Player::SatisfyQuestPreviousQuest(Quest const* qInfo, bool msg) if (msg) { SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestPreviousQuest: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player does not have required quest (2).", qInfo->GetQuestId()); + TC_LOG_DEBUG("misc", "SatisfyQuestPreviousQuest: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player does not have required quest (2).", qInfo->GetQuestId()); } return false; @@ -15541,7 +15601,7 @@ bool Player::SatisfyQuestPreviousQuest(Quest const* qInfo, bool msg) if (msg) { SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestPreviousQuest: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player does not have required quest (3).", qInfo->GetQuestId()); + TC_LOG_DEBUG("misc", "SatisfyQuestPreviousQuest: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player does not have required quest (3).", qInfo->GetQuestId()); } return false; @@ -15559,7 +15619,7 @@ bool Player::SatisfyQuestClass(Quest const* qInfo, bool msg) const if (msg) { SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestClass: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player does not have required class.", qInfo->GetQuestId()); + TC_LOG_DEBUG("misc", "SatisfyQuestClass: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player does not have required class.", qInfo->GetQuestId()); } return false; @@ -15578,7 +15638,7 @@ bool Player::SatisfyQuestRace(Quest const* qInfo, bool msg) if (msg) { SendCanTakeQuestResponse(INVALIDREASON_QUEST_FAILED_WRONG_RACE); - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestRace: Sent INVALIDREASON_QUEST_FAILED_WRONG_RACE (questId: %u) because player does not have required race.", qInfo->GetQuestId()); + TC_LOG_DEBUG("misc", "SatisfyQuestRace: Sent INVALIDREASON_QUEST_FAILED_WRONG_RACE (questId: %u) because player does not have required race.", qInfo->GetQuestId()); } return false; @@ -15594,7 +15654,7 @@ bool Player::SatisfyQuestReputation(Quest const* qInfo, bool msg) if (msg) { SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestReputation: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player does not have required reputation (min).", qInfo->GetQuestId()); + TC_LOG_DEBUG("misc", "SatisfyQuestReputation: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player does not have required reputation (min).", qInfo->GetQuestId()); } return false; } @@ -15605,7 +15665,7 @@ bool Player::SatisfyQuestReputation(Quest const* qInfo, bool msg) if (msg) { SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestReputation: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player does not have required reputation (max).", qInfo->GetQuestId()); + TC_LOG_DEBUG("misc", "SatisfyQuestReputation: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player does not have required reputation (max).", qInfo->GetQuestId()); } return false; } @@ -15618,7 +15678,7 @@ bool Player::SatisfyQuestReputation(Quest const* qInfo, bool msg) if (msg) { SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestReputation: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player does not have required reputation (ReputationObjective2).", qInfo->GetQuestId()); + TC_LOG_DEBUG("misc", "SatisfyQuestReputation: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player does not have required reputation (ReputationObjective2).", qInfo->GetQuestId()); } return false; } @@ -15633,7 +15693,7 @@ bool Player::SatisfyQuestStatus(Quest const* qInfo, bool msg) if (msg) { SendCanTakeQuestResponse(INVALIDREASON_QUEST_ALREADY_ON); - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestStatus: Sent INVALIDREASON_QUEST_ALREADY_ON (questId: %u) because player quest status is not NONE.", qInfo->GetQuestId()); + TC_LOG_DEBUG("misc", "SatisfyQuestStatus: Sent INVALIDREASON_QUEST_ALREADY_ON (questId: %u) because player quest status is not NONE.", qInfo->GetQuestId()); } return false; } @@ -15648,9 +15708,9 @@ bool Player::SatisfyQuestConditions(Quest const* qInfo, bool msg) if (msg) { SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestConditions: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player does not meet conditions.", qInfo->GetQuestId()); + TC_LOG_DEBUG("misc", "SatisfyQuestConditions: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player does not meet conditions.", qInfo->GetQuestId()); } - TC_LOG_DEBUG(LOG_FILTER_CONDITIONSYS, "Player::SatisfyQuestConditions: conditions not met for quest %u", qInfo->GetQuestId()); + TC_LOG_DEBUG("condition", "Player::SatisfyQuestConditions: conditions not met for quest %u", qInfo->GetQuestId()); return false; } return true; @@ -15663,7 +15723,7 @@ bool Player::SatisfyQuestTimed(Quest const* qInfo, bool msg) if (msg) { SendCanTakeQuestResponse(INVALIDREASON_QUEST_ONLY_ONE_TIMED); - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestTimed: Sent INVALIDREASON_QUEST_ONLY_ONE_TIMED (questId: %u) because player is already on a timed quest.", qInfo->GetQuestId()); + TC_LOG_DEBUG("misc", "SatisfyQuestTimed: Sent INVALIDREASON_QUEST_ONLY_ONE_TIMED (questId: %u) because player is already on a timed quest.", qInfo->GetQuestId()); } return false; } @@ -15693,7 +15753,7 @@ bool Player::SatisfyQuestExclusiveGroup(Quest const* qInfo, bool msg) if (msg) { SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestExclusiveGroup: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player already did daily quests in exclusive group.", qInfo->GetQuestId()); + TC_LOG_DEBUG("misc", "SatisfyQuestExclusiveGroup: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player already did daily quests in exclusive group.", qInfo->GetQuestId()); } return false; @@ -15705,7 +15765,7 @@ bool Player::SatisfyQuestExclusiveGroup(Quest const* qInfo, bool msg) if (msg) { SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestExclusiveGroup: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player already did quest in exclusive group.", qInfo->GetQuestId()); + TC_LOG_DEBUG("misc", "SatisfyQuestExclusiveGroup: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player already did quest in exclusive group.", qInfo->GetQuestId()); } return false; } @@ -15725,7 +15785,7 @@ bool Player::SatisfyQuestNextChain(Quest const* qInfo, bool msg) if (msg) { SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestNextChain: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player already did or started next quest in chain.", qInfo->GetQuestId()); + TC_LOG_DEBUG("misc", "SatisfyQuestNextChain: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player already did or started next quest in chain.", qInfo->GetQuestId()); } return false; } @@ -15752,7 +15812,7 @@ bool Player::SatisfyQuestPrevChain(Quest const* qInfo, bool msg) if (msg) { SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestNextChain: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player already did or started next quest in chain.", qInfo->GetQuestId()); + TC_LOG_DEBUG("misc", "SatisfyQuestNextChain: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player already did or started next quest in chain.", qInfo->GetQuestId()); } return false; } @@ -15796,7 +15856,7 @@ bool Player::SatisfyQuestDay(Quest const* qInfo, bool msg) if (msg) { SendCanTakeQuestResponse(INVALIDREASON_DAILY_QUESTS_REMAINING); - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestDay: Sent INVALIDREASON_DAILY_QUESTS_REMAINING (questId: %u) because player already did all possible quests today.", qInfo->GetQuestId()); + TC_LOG_DEBUG("misc", "SatisfyQuestDay: Sent INVALIDREASON_DAILY_QUESTS_REMAINING (questId: %u) because player already did all possible quests today.", qInfo->GetQuestId()); } return false; } @@ -16602,14 +16662,14 @@ void Player::SendQuestComplete(uint32 quest_id) WorldPacket data(SMSG_QUESTUPDATE_COMPLETE, 4); data << uint32(quest_id); GetSession()->SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTUPDATE_COMPLETE quest = %u", quest_id); + TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTUPDATE_COMPLETE quest = %u", quest_id); } } void Player::SendQuestReward(Quest const* quest, uint32 XP) { uint32 questid = quest->GetQuestId(); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTGIVER_QUEST_COMPLETE quest = %u", questid); + TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_COMPLETE quest = %u", questid); sGameEventMgr->HandleQuestComplete(questid); WorldPacket data(SMSG_QUESTGIVER_QUEST_COMPLETE, (4+4+4+4+4)); data << uint32(questid); @@ -16639,7 +16699,7 @@ void Player::SendQuestFailed(uint32 questId, InventoryResult reason) data << uint32(questId); data << uint32(reason); // failed reason (valid reasons: 4, 16, 50, 17, 74, other values show default message) GetSession()->SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTGIVER_QUEST_FAILED"); + TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_FAILED"); } } @@ -16650,7 +16710,7 @@ void Player::SendQuestTimerFailed(uint32 quest_id) WorldPacket data(SMSG_QUESTUPDATE_FAILEDTIMER, 4); data << uint32(quest_id); GetSession()->SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTUPDATE_FAILEDTIMER"); + TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTUPDATE_FAILEDTIMER"); } } @@ -16659,7 +16719,7 @@ void Player::SendCanTakeQuestResponse(QuestFailedReason msg) const WorldPacket data(SMSG_QUESTGIVER_QUEST_INVALID, 4); data << uint32(msg); GetSession()->SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTGIVER_QUEST_INVALID"); + TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_INVALID"); } void Player::SendQuestConfirmAccept(const Quest* quest, Player* pReceiver) @@ -16679,7 +16739,7 @@ void Player::SendQuestConfirmAccept(const Quest* quest, Player* pReceiver) data << uint64(GetGUID()); pReceiver->GetSession()->SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUEST_CONFIRM_ACCEPT"); + TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUEST_CONFIRM_ACCEPT"); } } @@ -16691,14 +16751,14 @@ void Player::SendPushToPartyResponse(Player* player, uint8 msg) data << uint64(player->GetGUID()); data << uint8(msg); // valid values: 0-8 GetSession()->SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent MSG_QUEST_PUSH_RESULT"); + TC_LOG_DEBUG("network", "WORLD: Sent MSG_QUEST_PUSH_RESULT"); } } void Player::SendQuestUpdateAddItem(Quest const* /*quest*/, uint32 /*item_idx*/, uint16 /*count*/) { WorldPacket data(SMSG_QUESTUPDATE_ADD_ITEM, 0); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTUPDATE_ADD_ITEM"); + TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTUPDATE_ADD_ITEM"); //data << quest->RequiredItemId[item_idx]; //data << count; GetSession()->SendPacket(&data); @@ -16714,7 +16774,7 @@ void Player::SendQuestUpdateAddCreatureOrGo(Quest const* quest, uint64 guid, uin entry = (-entry) | 0x80000000; WorldPacket data(SMSG_QUESTUPDATE_ADD_KILL, (4*4+8)); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTUPDATE_ADD_KILL"); + TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTUPDATE_ADD_KILL"); data << uint32(quest->GetQuestId()); data << uint32(entry); data << uint32(old_count + add_count); @@ -16732,7 +16792,7 @@ void Player::SendQuestUpdateAddPlayer(Quest const* quest, uint16 old_count, uint ASSERT(old_count + add_count < 65536 && "player count store in 16 bits"); WorldPacket data(SMSG_QUESTUPDATE_ADD_PVP_KILL, (3*4)); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTUPDATE_ADD_PVP_KILL"); + TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTUPDATE_ADD_PVP_KILL"); data << uint32(quest->GetQuestId()); data << uint32(old_count + add_count); data << uint32(quest->GetPlayersSlain()); @@ -16800,7 +16860,7 @@ void Player::_LoadArenaTeamInfo(PreparedQueryResult result) ArenaTeam* arenaTeam = sArenaTeamMgr->GetArenaTeamById(arenaTeamId); if (!arenaTeam) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player::_LoadArenaTeamInfo: couldn't load arenateam %u", arenaTeamId); + TC_LOG_ERROR("entities.player", "Player::_LoadArenaTeamInfo: couldn't load arenateam %u", arenaTeamId); continue; } @@ -16955,7 +17015,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) { std::string name = "<unknown>"; sObjectMgr->GetPlayerNameByGUID(guid, name); - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player %s (GUID: %u) not found in table `characters`, can't load. ", name.c_str(), guid); + TC_LOG_ERROR("entities.player", "Player %s (GUID: %u) not found in table `characters`, can't load. ", name.c_str(), guid); return false; } @@ -16967,13 +17027,13 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) // player should be able to load/delete character only with correct account! if (dbAccountId != GetSession()->GetAccountId()) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player (GUID: %u) loading from wrong account (is: %u, should be: %u)", guid, GetSession()->GetAccountId(), dbAccountId); + TC_LOG_ERROR("entities.player", "Player (GUID: %u) loading from wrong account (is: %u, should be: %u)", guid, GetSession()->GetAccountId(), dbAccountId); return false; } if (holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_BANNED)) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player (GUID: %u) is banned, can't load.", guid); + TC_LOG_ERROR("entities.player", "Player (GUID: %u) is banned, can't load.", guid); return false; } @@ -16999,7 +17059,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) uint8 gender = fields[5].GetUInt8(); if (!IsValidGender(gender)) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player (GUID: %u) has wrong gender (%u), can't be loaded.", guid, gender); + TC_LOG_ERROR("entities.player", "Player (GUID: %u) has wrong gender (%u), can't be loaded.", guid, gender); return false; } @@ -17053,7 +17113,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) m_items[slot] = NULL; } - TC_LOG_DEBUG(LOG_FILTER_PLAYER_LOADING, "Load Basic value of player %s is: ", m_name.c_str()); + TC_LOG_DEBUG("entities.player.loading", "Load Basic value of player %s is: ", m_name.c_str()); outDebugValues(); //Need to call it to initialize m_team (m_team can be calculated from race) @@ -17067,7 +17127,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) InitPrimaryProfessions(); // to max set before any spell loaded // init saved position, and fix it later if problematic - uint32 transGUID = fields[30].GetUInt32(); + uint32 transLowGUID = fields[30].GetUInt32(); Relocate(fields[12].GetFloat(), fields[13].GetFloat(), fields[14].GetFloat(), fields[16].GetFloat()); uint32 mapId = fields[15].GetUInt16(); uint32 instanceId = fields[58].GetUInt32(); @@ -17122,7 +17182,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) MapEntry const* mapEntry = sMapStore.LookupEntry(mapId); if (!mapEntry || !IsPositionValid()) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player (guidlow %d) have invalid coordinates (MapId: %u X: %f Y: %f Z: %f O: %f). Teleport to default race/class locations.", guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); + TC_LOG_ERROR("entities.player", "Player (guidlow %d) have invalid coordinates (MapId: %u X: %f Y: %f Z: %f O: %f). Teleport to default race/class locations.", guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); RelocateToHomebind(); } // Player was saved in Arena or Bg @@ -17162,7 +17222,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) //if (mapId == MAPID_INVALID) -- code kept for reference if (int16(mapId) == int16(-1)) // Battleground Entry Point not found (???) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player (guidlow %d) was in BG in database, but BG was not found, and entry point was invalid! Teleport to default race/class locations.", guid); + TC_LOG_ERROR("entities.player", "Player (guidlow %d) was in BG in database, but BG was not found, and entry point was invalid! Teleport to default race/class locations.", guid); RelocateToHomebind(); } else @@ -17173,41 +17233,50 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) } } // currently we do not support transport in bg - else if (transGUID) + else if (transLowGUID) { - m_movementInfo.transport.guid = MAKE_NEW_GUID(transGUID, 0, HIGHGUID_MO_TRANSPORT); - m_movementInfo.transport.pos.Relocate(fields[26].GetFloat(), fields[27].GetFloat(), fields[28].GetFloat(), fields[29].GetFloat()); + uint64 transGUID = MAKE_NEW_GUID(transLowGUID, 0, HIGHGUID_MO_TRANSPORT); - if (!Trinity::IsValidMapCoord( - GetPositionX()+m_movementInfo.transport.pos.m_positionX, GetPositionY()+m_movementInfo.transport.pos.m_positionY, - GetPositionZ()+m_movementInfo.transport.pos.m_positionZ, GetOrientation()+m_movementInfo.transport.pos.m_orientation) || - // transport size limited - m_movementInfo.transport.pos.m_positionX > 250 || m_movementInfo.transport.pos.m_positionY > 250 || m_movementInfo.transport.pos.m_positionZ > 250) - { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player (guidlow %d) have invalid transport coordinates (X: %f Y: %f Z: %f O: %f). Teleport to bind location.", - guid, GetPositionX()+m_movementInfo.transport.pos.m_positionX, GetPositionY()+m_movementInfo.transport.pos.m_positionY, - GetPositionZ()+m_movementInfo.transport.pos.m_positionZ, GetOrientation()+m_movementInfo.transport.pos.m_orientation); + if (GameObject* go = HashMapHolder<GameObject>::Find(transGUID)) + m_transport = go->ToTransport(); - RelocateToHomebind(); - } - else + if (m_transport) { - if (GameObject* go = HashMapHolder<GameObject>::Find(m_movementInfo.transport.guid)) - m_transport = go->ToTransport(); + m_movementInfo.transport.guid = transGUID; + float x = fields[26].GetFloat(), y = fields[27].GetFloat(), z = fields[28].GetFloat(), o = fields[29].GetFloat(); + m_movementInfo.transport.pos.Relocate(x, y, z, o); + m_transport->CalculatePassengerPosition(x, y, z, &o); - if (m_transport) + if (!Trinity::IsValidMapCoord(x, y, z, o) || + // transport size limited + std::fabs(m_movementInfo.transport.pos.GetPositionX()) > 250.0f || + std::fabs(m_movementInfo.transport.pos.GetPositionY()) > 250.0f || + std::fabs(m_movementInfo.transport.pos.GetPositionZ()) > 250.0f) { - m_transport->AddPassenger(this); - mapId = m_transport->GetMapId(); + TC_LOG_ERROR("entities.player", "Player (guidlow %d) have invalid transport coordinates (X: %f Y: %f Z: %f O: %f). Teleport to bind location.", + guid, x, y, z, o); + + m_transport = NULL; + m_movementInfo.transport.Reset(); + + RelocateToHomebind(); } else { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player (guidlow %d) have problems with transport guid (%u). Teleport to bind location.", - guid, transGUID); + Relocate(x, y, z, o); + mapId = m_transport->GetMapId(); - RelocateToHomebind(); + m_transport->AddPassenger(this); + AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT); } } + else + { + TC_LOG_ERROR("entities.player", "Player (guidlow %u) have problems with transport guid (%u). Teleport to bind location.", + guid, transLowGUID); + + RelocateToHomebind(); + } } // currently we do not support taxi in instance else if (!taxi_nodes.empty()) @@ -17229,12 +17298,12 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) if (!nodeEntry) // don't know taxi start node, to homebind { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Character %u have wrong data in taxi destination list, teleport to homebind.", GetGUIDLow()); + TC_LOG_ERROR("entities.player", "Character %u have wrong data in taxi destination list, teleport to homebind.", GetGUIDLow()); RelocateToHomebind(); } else // have start node, to it { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Character %u have too short taxi destination list, teleport to original node.", GetGUIDLow()); + TC_LOG_ERROR("entities.player", "Character %u have too short taxi destination list, teleport to original node.", GetGUIDLow()); mapId = nodeEntry->map_id; Relocate(nodeEntry->x, nodeEntry->y, nodeEntry->z, 0.0f); } @@ -17263,7 +17332,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) { if (GetSession()->Expansion() < mapEntry->Expansion()) { - TC_LOG_DEBUG(LOG_FILTER_PLAYER_LOADING, "Player %s using client without required expansion tried login at non accessible map %u", GetName().c_str(), mapId); + TC_LOG_DEBUG("entities.player.loading", "Player %s using client without required expansion tried login at non accessible map %u", GetName().c_str(), mapId); RelocateToHomebind(); } @@ -17284,13 +17353,13 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) AreaTrigger const* at = sObjectMgr->GetGoBackTrigger(mapId); if (at) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player (guidlow %d) is teleported to gobacktrigger (Map: %u X: %f Y: %f Z: %f O: %f).", guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); + TC_LOG_ERROR("entities.player", "Player (guidlow %d) is teleported to gobacktrigger (Map: %u X: %f Y: %f Z: %f O: %f).", guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); Relocate(at->target_X, at->target_Y, at->target_Z, GetOrientation()); mapId = at->target_mapId; } else { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player (guidlow %d) is teleported to home (Map: %u X: %f Y: %f Z: %f O: %f).", guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); + TC_LOG_ERROR("entities.player", "Player (guidlow %d) is teleported to home (Map: %u X: %f Y: %f Z: %f O: %f).", guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); RelocateToHomebind(); } @@ -17300,11 +17369,11 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass()); mapId = info->mapId; Relocate(info->positionX, info->positionY, info->positionZ, 0.0f); - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player (guidlow %d) have invalid coordinates (X: %f Y: %f Z: %f O: %f). Teleport to default race/class locations.", guid, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); + TC_LOG_ERROR("entities.player", "Player (guidlow %d) have invalid coordinates (X: %f Y: %f Z: %f O: %f). Teleport to default race/class locations.", guid, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); map = sMapMgr->CreateMap(mapId, this); if (!map) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player (guidlow %d) has invalid default map coordinates (X: %f Y: %f Z: %f O: %f). or instance couldn't be created", guid, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); + TC_LOG_ERROR("entities.player", "Player (guidlow %d) has invalid default map coordinates (X: %f Y: %f Z: %f O: %f). or instance couldn't be created", guid, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); return false; } } @@ -17318,7 +17387,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) Relocate(at->target_X, at->target_Y, at->target_Z, at->target_Orientation); else { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player %s(GUID: %u) logged in to a reset instance (map: %u) and there is no area-trigger leading to this map. Thus he can't be ported back to the entrance. This _might_ be an exploit attempt.", GetName().c_str(), GetGUIDLow(), mapId); + TC_LOG_ERROR("entities.player", "Player %s(GUID: %u) logged in to a reset instance (map: %u) and there is no area-trigger leading to this map. Thus he can't be ported back to the entrance. This _might_ be an exploit attempt.", GetName().c_str(), GetGUIDLow(), mapId); RelocateToHomebind(); } } @@ -17360,7 +17429,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) m_stableSlots = fields[32].GetUInt8(); if (m_stableSlots > MAX_PET_STABLES) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player can have not more %u stable slots, but have in DB %u", MAX_PET_STABLES, uint32(m_stableSlots)); + TC_LOG_ERROR("entities.player", "Player can have not more %u stable slots, but have in DB %u", MAX_PET_STABLES, uint32(m_stableSlots)); m_stableSlots = MAX_PET_STABLES; } @@ -17438,7 +17507,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) if (m_specsCount > MAX_TALENT_SPECS || m_activeSpec > MAX_TALENT_SPEC || m_specsCount < MIN_TALENT_SPECS) { m_activeSpec = 0; - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player %s(GUID: %u) has SpecCount = %u and ActiveSpec = %u.", GetName().c_str(), GetGUIDLow(), m_specsCount, m_activeSpec); + TC_LOG_ERROR("entities.player", "Player %s(GUID: %u) has SpecCount = %u and ActiveSpec = %u.", GetName().c_str(), GetGUIDLow(), m_specsCount, m_activeSpec); } _LoadTalents(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_TALENTS)); @@ -17512,7 +17581,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) SetPower(Powers(i), savedPower > GetMaxPower(Powers(i)) ? GetMaxPower(Powers(i)) : savedPower); } - TC_LOG_DEBUG(LOG_FILTER_PLAYER_LOADING, "The value of player %s after load item and aura is: ", m_name.c_str()); + TC_LOG_DEBUG("entities.player.loading", "The value of player %s after load item and aura is: ", m_name.c_str()); outDebugValues(); // GM state @@ -17644,7 +17713,7 @@ void Player::_LoadActions(PreparedQueryResult result) ab->uState = ACTIONBUTTON_UNCHANGED; else { - TC_LOG_ERROR(LOG_FILTER_PLAYER, " ...at loading, and will deleted in DB also"); + TC_LOG_ERROR("entities.player", " ...at loading, and will deleted in DB also"); // Will deleted in DB at next save (it can create data until save but marked as deleted) m_actionButtons[button].uState = ACTIONBUTTON_DELETED; @@ -17655,7 +17724,7 @@ void Player::_LoadActions(PreparedQueryResult result) void Player::_LoadAuras(PreparedQueryResult result, uint32 timediff) { - TC_LOG_DEBUG(LOG_FILTER_PLAYER_LOADING, "Loading auras for player %u", GetGUIDLow()); + TC_LOG_DEBUG("entities.player.loading", "Loading auras for player %u", GetGUIDLow()); /* 0 1 2 3 4 5 6 7 8 9 10 QueryResult* result = CharacterDatabase.PQuery("SELECT caster_guid, spell, effect_mask, recalculate_mask, stackcount, amount0, amount1, amount2, base_amount0, base_amount1, base_amount2, @@ -17688,7 +17757,7 @@ void Player::_LoadAuras(PreparedQueryResult result, uint32 timediff) SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid); if (!spellInfo) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Unknown aura (spellid %u), ignore.", spellid); + TC_LOG_ERROR("entities.player", "Unknown aura (spellid %u), ignore.", spellid); continue; } @@ -17722,7 +17791,7 @@ void Player::_LoadAuras(PreparedQueryResult result, uint32 timediff) aura->SetLoadedState(maxduration, remaintime, remaincharges, stackcount, recalculatemask, &damage[0]); aura->ApplyForTargets(); - TC_LOG_INFO(LOG_FILTER_PLAYER, "Added aura spellid %u, effectmask %u", spellInfo->Id, effmask); + TC_LOG_INFO("entities.player", "Added aura spellid %u, effectmask %u", spellInfo->Id, effmask); } } while (result->NextRow()); @@ -17745,13 +17814,13 @@ void Player::_LoadGlyphAuras() continue; } else - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player %s has glyph with typeflags %u in slot with typeflags %u, removing.", m_name.c_str(), gp->TypeFlags, gs->TypeFlags); + TC_LOG_ERROR("entities.player", "Player %s has glyph with typeflags %u in slot with typeflags %u, removing.", m_name.c_str(), gp->TypeFlags, gs->TypeFlags); } else - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player %s has not existing glyph slot entry %u on index %u", m_name.c_str(), GetGlyphSlot(i), i); + TC_LOG_ERROR("entities.player", "Player %s has not existing glyph slot entry %u on index %u", m_name.c_str(), GetGlyphSlot(i), i); } else - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player %s has not existing glyph entry %u on index %u", m_name.c_str(), glyph, i); + TC_LOG_ERROR("entities.player", "Player %s has not existing glyph entry %u on index %u", m_name.c_str(), glyph, i); // On any error remove glyph SetGlyph(i, 0); @@ -17861,7 +17930,7 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff) } else { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player::_LoadInventory: player (GUID: %u, name: '%s') has item (GUID: %u, entry: %u) which doesnt have a valid bag (Bag GUID: %u, slot: %u). Possible cheat?", + TC_LOG_ERROR("entities.player", "Player::_LoadInventory: player (GUID: %u, name: '%s') has item (GUID: %u, entry: %u) which doesnt have a valid bag (Bag GUID: %u, slot: %u). Possible cheat?", GetGUIDLow(), GetName().c_str(), item->GetGUIDLow(), item->GetEntry(), bagGuid, slot); item->DeleteFromInventoryDB(trans); delete item; @@ -17875,7 +17944,7 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff) item->SetState(ITEM_UNCHANGED, this); else { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player::_LoadInventory: player (GUID: %u, name: '%s') has item (GUID: %u, entry: %u) which can't be loaded into inventory (Bag GUID: %u, slot: %u) by reason %u. Item will be sent by mail.", + TC_LOG_ERROR("entities.player", "Player::_LoadInventory: player (GUID: %u, name: '%s') has item (GUID: %u, entry: %u) which can't be loaded into inventory (Bag GUID: %u, slot: %u) by reason %u. Item will be sent by mail.", GetGUIDLow(), GetName().c_str(), item->GetGUIDLow(), item->GetEntry(), bagGuid, slot, err); item->DeleteFromInventoryDB(trans); problematicItems.push_back(item); @@ -17920,14 +17989,14 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F // Do not allow to have item limited to another map/zone in alive state if (IsAlive() && item->IsLimitedToAnotherMapOrZone(GetMapId(), zoneId)) { - TC_LOG_DEBUG(LOG_FILTER_PLAYER_LOADING, "Player::_LoadInventory: player (GUID: %u, name: '%s', map: %u) has item (GUID: %u, entry: %u) limited to another map (%u). Deleting item.", + TC_LOG_DEBUG("entities.player.loading", "Player::_LoadInventory: player (GUID: %u, name: '%s', map: %u) has item (GUID: %u, entry: %u) limited to another map (%u). Deleting item.", GetGUIDLow(), GetName().c_str(), GetMapId(), item->GetGUIDLow(), item->GetEntry(), zoneId); remove = true; } // "Conjured items disappear if you are logged out for more than 15 minutes" else if (timeDiff > 15 * MINUTE && proto->Flags & ITEM_PROTO_FLAG_CONJURED) { - TC_LOG_DEBUG(LOG_FILTER_PLAYER_LOADING, "Player::_LoadInventory: player (GUID: %u, name: '%s', diff: %u) has conjured item (GUID: %u, entry: %u) with expired lifetime (15 minutes). Deleting item.", + TC_LOG_DEBUG("entities.player.loading", "Player::_LoadInventory: player (GUID: %u, name: '%s', diff: %u) has conjured item (GUID: %u, entry: %u) with expired lifetime (15 minutes). Deleting item.", GetGUIDLow(), GetName().c_str(), timeDiff, item->GetGUIDLow(), item->GetEntry()); remove = true; } @@ -17935,7 +18004,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F { if (item->GetPlayedTime() > (2 * HOUR)) { - TC_LOG_DEBUG(LOG_FILTER_PLAYER_LOADING, "Player::_LoadInventory: player (GUID: %u, name: '%s') has item (GUID: %u, entry: %u) with expired refund time (%u). Deleting refund data and removing refundable flag.", + TC_LOG_DEBUG("entities.player.loading", "Player::_LoadInventory: player (GUID: %u, name: '%s') has item (GUID: %u, entry: %u) with expired refund time (%u). Deleting refund data and removing refundable flag.", GetGUIDLow(), GetName().c_str(), item->GetGUIDLow(), item->GetEntry(), item->GetPlayedTime()); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_REFUND_INSTANCE); @@ -17958,7 +18027,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F } else { - TC_LOG_DEBUG(LOG_FILTER_PLAYER_LOADING, "Player::_LoadInventory: player (GUID: %u, name: '%s') has item (GUID: %u, entry: %u) with refundable flags, but without data in item_refund_instance. Removing flag.", + TC_LOG_DEBUG("entities.player.loading", "Player::_LoadInventory: player (GUID: %u, name: '%s') has item (GUID: %u, entry: %u) with refundable flags, but without data in item_refund_instance. Removing flag.", GetGUIDLow(), GetName().c_str(), item->GetGUIDLow(), item->GetEntry()); item->RemoveFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_REFUNDABLE); } @@ -17986,7 +18055,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F } else { - TC_LOG_DEBUG(LOG_FILTER_PLAYER_LOADING, "Player::_LoadInventory: player (GUID: %u, name: '%s') has item (GUID: %u, entry: %u) with ITEM_FLAG_BOP_TRADEABLE flag, but without data in item_soulbound_trade_data. Removing flag.", + TC_LOG_DEBUG("entities.player.loading", "Player::_LoadInventory: player (GUID: %u, name: '%s') has item (GUID: %u, entry: %u) with ITEM_FLAG_BOP_TRADEABLE flag, but without data in item_soulbound_trade_data. Removing flag.", GetGUIDLow(), GetName().c_str(), item->GetGUIDLow(), item->GetEntry()); item->RemoveFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_BOP_TRADEABLE); } @@ -18008,7 +18077,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F } else { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player::_LoadInventory: player (GUID: %u, name: '%s') has broken item (GUID: %u, entry: %u) in inventory. Deleting item.", + TC_LOG_ERROR("entities.player", "Player::_LoadInventory: player (GUID: %u, name: '%s') has broken item (GUID: %u, entry: %u) in inventory. Deleting item.", GetGUIDLow(), GetName().c_str(), itemGuid, itemEntry); remove = true; } @@ -18023,7 +18092,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F } else { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player::_LoadInventory: player (GUID: %u, name: '%s') has unknown item (entry: %u) in inventory. Deleting item.", + TC_LOG_ERROR("entities.player", "Player::_LoadInventory: player (GUID: %u, name: '%s') has unknown item (entry: %u) in inventory. Deleting item.", GetGUIDLow(), GetName().c_str(), itemEntry); Item::DeleteFromInventoryDB(trans, itemGuid); Item::DeleteFromDB(trans, itemGuid); @@ -18054,7 +18123,7 @@ void Player::_LoadMailedItems(Mail* mail) if (!proto) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player %u has unknown item_template (ProtoType) in mailed items(GUID: %u template: %u) in mail (%u), deleted.", GetGUIDLow(), itemGuid, itemTemplate, mail->messageID); + TC_LOG_ERROR("entities.player", "Player %u has unknown item_template (ProtoType) in mailed items(GUID: %u template: %u) in mail (%u), deleted.", GetGUIDLow(), itemGuid, itemTemplate, mail->messageID); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_MAIL_ITEM); stmt->setUInt32(0, itemGuid); @@ -18070,7 +18139,7 @@ void Player::_LoadMailedItems(Mail* mail) if (!item->LoadFromDB(itemGuid, MAKE_NEW_GUID(fields[13].GetUInt32(), 0, HIGHGUID_PLAYER), fields, itemTemplate)) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player::_LoadMailedItems - Item in mail (%u) doesn't exist !!!! - item guid: %u, deleted from mail", mail->messageID, itemGuid); + TC_LOG_ERROR("entities.player", "Player::_LoadMailedItems - Item in mail (%u) doesn't exist !!!! - item guid: %u, deleted from mail", mail->messageID, itemGuid); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEM); stmt->setUInt32(0, itemGuid); @@ -18133,7 +18202,7 @@ void Player::_LoadMail() if (m->mailTemplateId && !sMailTemplateStore.LookupEntry(m->mailTemplateId)) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player::_LoadMail - Mail (%u) have not existed MailTemplateId (%u), remove at load", m->messageID, m->mailTemplateId); + TC_LOG_ERROR("entities.player", "Player::_LoadMail - Mail (%u) have not existed MailTemplateId (%u), remove at load", m->messageID, m->mailTemplateId); m->mailTemplateId = 0; } @@ -18190,7 +18259,7 @@ void Player::_LoadQuestStatus(PreparedQueryResult result) else { questStatusData.Status = QUEST_STATUS_INCOMPLETE; - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player %s (GUID: %u) has invalid quest %d status (%u), replaced by QUEST_STATUS_INCOMPLETE(3).", + TC_LOG_ERROR("entities.player", "Player %s (GUID: %u) has invalid quest %d status (%u), replaced by QUEST_STATUS_INCOMPLETE(3).", GetName().c_str(), GetGUIDLow(), quest_id, qstatus); } @@ -18240,7 +18309,7 @@ void Player::_LoadQuestStatus(PreparedQueryResult result) ++slot; } - TC_LOG_DEBUG(LOG_FILTER_PLAYER_LOADING, "Quest status is {%u} for quest {%u} for player (GUID: %u)", questStatusData.Status, quest_id, GetGUIDLow()); + TC_LOG_DEBUG("entities.player.loading", "Quest status is {%u} for quest {%u} for player (GUID: %u)", questStatusData.Status, quest_id, GetGUIDLow()); } } while (result->NextRow()); @@ -18314,7 +18383,7 @@ void Player::_LoadDailyQuestStatus(PreparedQueryResult result) if (quest_daily_idx >= PLAYER_MAX_DAILY_QUESTS) // max amount with exist data in query { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player (GUID: %u) have more 25 daily quest records in `charcter_queststatus_daily`", GetGUIDLow()); + TC_LOG_ERROR("entities.player", "Player (GUID: %u) have more 25 daily quest records in `charcter_queststatus_daily`", GetGUIDLow()); break; } @@ -18330,7 +18399,7 @@ void Player::_LoadDailyQuestStatus(PreparedQueryResult result) SetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx, quest_id); ++quest_daily_idx; - TC_LOG_DEBUG(LOG_FILTER_PLAYER_LOADING, "Daily quest (%u) cooldown for player (GUID: %u)", quest_id, GetGUIDLow()); + TC_LOG_DEBUG("entities.player.loading", "Daily quest (%u) cooldown for player (GUID: %u)", quest_id, GetGUIDLow()); } while (result->NextRow()); } @@ -18353,7 +18422,7 @@ void Player::_LoadWeeklyQuestStatus(PreparedQueryResult result) continue; m_weeklyquests.insert(quest_id); - TC_LOG_DEBUG(LOG_FILTER_PLAYER_LOADING, "Weekly quest {%u} cooldown for player (GUID: %u)", quest_id, GetGUIDLow()); + TC_LOG_DEBUG("entities.player.loading", "Weekly quest {%u} cooldown for player (GUID: %u)", quest_id, GetGUIDLow()); } while (result->NextRow()); } @@ -18377,7 +18446,7 @@ void Player::_LoadSeasonalQuestStatus(PreparedQueryResult result) continue; m_seasonalquests[event_id].insert(quest_id); - TC_LOG_DEBUG(LOG_FILTER_PLAYER_LOADING, "Seasonal quest {%u} cooldown for player (GUID: %u)", quest_id, GetGUIDLow()); + TC_LOG_DEBUG("entities.player.loading", "Seasonal quest {%u} cooldown for player (GUID: %u)", quest_id, GetGUIDLow()); } while (result->NextRow()); } @@ -18400,7 +18469,7 @@ void Player::_LoadMonthlyQuestStatus(PreparedQueryResult result) continue; m_monthlyquests.insert(quest_id); - TC_LOG_DEBUG(LOG_FILTER_PLAYER_LOADING, "Monthly quest {%u} cooldown for player (GUID: %u)", quest_id, GetGUIDLow()); + TC_LOG_DEBUG("entities.player.loading", "Monthly quest {%u} cooldown for player (GUID: %u)", quest_id, GetGUIDLow()); } while (result->NextRow()); } @@ -18470,12 +18539,12 @@ void Player::_LoadBoundInstances(PreparedQueryResult result) if (!mapEntry || !mapEntry->IsDungeon()) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "_LoadBoundInstances: player %s(%d) has bind to not existed or not dungeon map %d (%s)", GetName().c_str(), GetGUIDLow(), mapId, mapname.c_str()); + TC_LOG_ERROR("entities.player", "_LoadBoundInstances: player %s(%d) has bind to not existed or not dungeon map %d (%s)", GetName().c_str(), GetGUIDLow(), mapId, mapname.c_str()); deleteInstance = true; } else if (difficulty >= MAX_DIFFICULTY) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "_LoadBoundInstances: player %s(%d) has bind to not existed difficulty %d instance for map %u (%s)", GetName().c_str(), GetGUIDLow(), difficulty, mapId, mapname.c_str()); + TC_LOG_ERROR("entities.player", "_LoadBoundInstances: player %s(%d) has bind to not existed difficulty %d instance for map %u (%s)", GetName().c_str(), GetGUIDLow(), difficulty, mapId, mapname.c_str()); deleteInstance = true; } else @@ -18483,12 +18552,12 @@ void Player::_LoadBoundInstances(PreparedQueryResult result) MapDifficulty const* mapDiff = GetMapDifficultyData(mapId, Difficulty(difficulty)); if (!mapDiff) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "_LoadBoundInstances: player %s(%d) has bind to not existed difficulty %d instance for map %u (%s)", GetName().c_str(), GetGUIDLow(), difficulty, mapId, mapname.c_str()); + TC_LOG_ERROR("entities.player", "_LoadBoundInstances: player %s(%d) has bind to not existed difficulty %d instance for map %u (%s)", GetName().c_str(), GetGUIDLow(), difficulty, mapId, mapname.c_str()); deleteInstance = true; } else if (!perm && group) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "_LoadBoundInstances: player %s(%d) is in group %d but has a non-permanent character bind to map %d (%s), %d, %d", GetName().c_str(), GetGUIDLow(), GUID_LOPART(group->GetGUID()), mapId, mapname.c_str(), instanceId, difficulty); + TC_LOG_ERROR("entities.player", "_LoadBoundInstances: player %s(%d) is in group %d but has a non-permanent character bind to map %d (%s), %d, %d", GetName().c_str(), GetGUIDLow(), GUID_LOPART(group->GetGUID()), mapId, mapname.c_str(), instanceId, difficulty); deleteInstance = true; } } @@ -18614,7 +18683,7 @@ InstancePlayerBind* Player::BindToInstance(InstanceSave* save, bool permanent, b bind.save = save; bind.perm = permanent; if (!load) - TC_LOG_DEBUG(LOG_FILTER_MAPS, "Player::BindToInstance: %s(%d) is now bound to map %d, instance %d, difficulty %d", GetName().c_str(), GetGUIDLow(), save->GetMapId(), save->GetInstanceId(), save->GetDifficulty()); + TC_LOG_DEBUG("maps", "Player::BindToInstance: %s(%d) is now bound to map %d, instance %d, difficulty %d", GetName().c_str(), GetGUIDLow(), save->GetMapId(), save->GetInstanceId(), save->GetDifficulty()); sScriptMgr->OnPlayerBindToInstance(this, save->GetDifficulty(), save->GetMapId(), permanent); return &bind; } @@ -18856,7 +18925,7 @@ bool Player::_LoadHomeBind(PreparedQueryResult result) PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass()); if (!info) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player (Name %s) has incorrect race/class pair. Can't be loaded.", GetName().c_str()); + TC_LOG_ERROR("entities.player", "Player (Name %s) has incorrect race/class pair. Can't be loaded.", GetName().c_str()); return false; } @@ -18904,7 +18973,7 @@ bool Player::_LoadHomeBind(PreparedQueryResult result) CharacterDatabase.Execute(stmt); } - TC_LOG_DEBUG(LOG_FILTER_PLAYER, "Setting player home position - mapid: %u, areaid: %u, X: %f, Y: %f, Z: %f", + TC_LOG_DEBUG("entities.player", "Setting player home position - mapid: %u, areaid: %u, X: %f, Y: %f, Z: %f", m_homebindMapId, m_homebindAreaId, m_homebindX, m_homebindY, m_homebindZ); return true; @@ -18929,7 +18998,7 @@ void Player::SaveToDB(bool create /*=false*/) // first save/honor gain after midnight will also update the player's honor fields UpdateHonorFields(); - TC_LOG_DEBUG(LOG_FILTER_UNITS, "The value of player %s at save: ", m_name.c_str()); + TC_LOG_DEBUG("entities.unit", "The value of player %s at save: ", m_name.c_str()); outDebugValues(); PreparedStatement* stmt = NULL; @@ -18959,6 +19028,14 @@ void Player::SaveToDB(bool create /*=false*/) stmt->setFloat(index++, finiteAlways(GetPositionY())); stmt->setFloat(index++, finiteAlways(GetPositionZ())); stmt->setFloat(index++, finiteAlways(GetOrientation())); + stmt->setFloat(index++, finiteAlways(GetTransOffsetX())); + stmt->setFloat(index++, finiteAlways(GetTransOffsetY())); + stmt->setFloat(index++, finiteAlways(GetTransOffsetZ())); + stmt->setFloat(index++, finiteAlways(GetTransOffsetO())); + uint32 transLowGUID = 0; + if (GetTransport()) + transLowGUID = GetTransport()->GetGUIDLow(); + stmt->setUInt32(index++, transLowGUID); std::ostringstream ss; ss << m_taxi; @@ -19071,6 +19148,15 @@ void Player::SaveToDB(bool create /*=false*/) stmt->setFloat(index++, finiteAlways(GetTeleportDest().GetOrientation())); } + stmt->setFloat(index++, finiteAlways(GetTransOffsetX())); + stmt->setFloat(index++, finiteAlways(GetTransOffsetY())); + stmt->setFloat(index++, finiteAlways(GetTransOffsetZ())); + stmt->setFloat(index++, finiteAlways(GetTransOffsetO())); + uint32 transLowGUID = 0; + if (GetTransport()) + transLowGUID = GetTransport()->GetGUIDLow(); + stmt->setUInt32(index++, transLowGUID); + std::ostringstream ss; ss << m_taxi; stmt->setString(index++, ss.str()); @@ -19349,7 +19435,7 @@ void Player::_SaveInventory(SQLTransaction& trans) } else { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Can't find item guid %u but is in refundable storage for player %u ! Removing.", *itr, GetGUIDLow()); + TC_LOG_ERROR("entities.player", "Can't find item guid %u but is in refundable storage for player %u ! Removing.", *itr, GetGUIDLow()); m_refundableItems.erase(itr); } } @@ -19380,7 +19466,7 @@ void Player::_SaveInventory(SQLTransaction& trans) uint32 bagTestGUID = 0; if (Item* test2 = GetItemByPos(INVENTORY_SLOT_BAG_0, item->GetBagSlot())) bagTestGUID = test2->GetGUIDLow(); - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player(GUID: %u Name: %s)::_SaveInventory - the bag(%u) and slot(%u) values for the item with guid %u (state %d) are incorrect, the player doesn't have an item at that position!", lowGuid, GetName().c_str(), item->GetBagSlot(), item->GetSlot(), item->GetGUIDLow(), (int32)item->GetState()); + TC_LOG_ERROR("entities.player", "Player(GUID: %u Name: %s)::_SaveInventory - the bag(%u) and slot(%u) values for the item with guid %u (state %d) are incorrect, the player doesn't have an item at that position!", lowGuid, GetName().c_str(), item->GetBagSlot(), item->GetSlot(), item->GetGUIDLow(), (int32)item->GetState()); // according to the test that was just performed nothing should be in this slot, delete stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INVENTORY_BY_BAG_SLOT); stmt->setUInt32(0, bagTestGUID); @@ -19396,7 +19482,7 @@ void Player::_SaveInventory(SQLTransaction& trans) } else if (test != item) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player(GUID: %u Name: %s)::_SaveInventory - the bag(%u) and slot(%u) values for the item with guid %u are incorrect, the item with guid %u is there instead!", lowGuid, GetName().c_str(), item->GetBagSlot(), item->GetSlot(), item->GetGUIDLow(), test->GetGUIDLow()); + TC_LOG_ERROR("entities.player", "Player(GUID: %u Name: %s)::_SaveInventory - the bag(%u) and slot(%u) values for the item with guid %u are incorrect, the item with guid %u is there instead!", lowGuid, GetName().c_str(), item->GetBagSlot(), item->GetSlot(), item->GetGUIDLow(), test->GetGUIDLow()); // save all changes to the item... if (item->GetState() != ITEM_NEW) // only for existing items, no dupes item->SaveToDB(trans); @@ -19826,21 +19912,21 @@ void Player::_SaveStats(SQLTransaction& trans) void Player::outDebugValues() const { - if (!sLog->ShouldLog(LOG_FILTER_UNITS, LOG_LEVEL_DEBUG)) + if (!sLog->ShouldLog("entities.unit", LOG_LEVEL_DEBUG)) return; - TC_LOG_DEBUG(LOG_FILTER_UNITS, "HP is: \t\t\t%u\t\tMP is: \t\t\t%u", GetMaxHealth(), GetMaxPower(POWER_MANA)); - TC_LOG_DEBUG(LOG_FILTER_UNITS, "AGILITY is: \t\t%f\t\tSTRENGTH is: \t\t%f", GetStat(STAT_AGILITY), GetStat(STAT_STRENGTH)); - TC_LOG_DEBUG(LOG_FILTER_UNITS, "INTELLECT is: \t\t%f\t\tSPIRIT is: \t\t%f", GetStat(STAT_INTELLECT), GetStat(STAT_SPIRIT)); - TC_LOG_DEBUG(LOG_FILTER_UNITS, "STAMINA is: \t\t%f", GetStat(STAT_STAMINA)); - TC_LOG_DEBUG(LOG_FILTER_UNITS, "Armor is: \t\t%u\t\tBlock is: \t\t%f", GetArmor(), GetFloatValue(PLAYER_BLOCK_PERCENTAGE)); - TC_LOG_DEBUG(LOG_FILTER_UNITS, "HolyRes is: \t\t%u\t\tFireRes is: \t\t%u", GetResistance(SPELL_SCHOOL_HOLY), GetResistance(SPELL_SCHOOL_FIRE)); - TC_LOG_DEBUG(LOG_FILTER_UNITS, "NatureRes is: \t\t%u\t\tFrostRes is: \t\t%u", GetResistance(SPELL_SCHOOL_NATURE), GetResistance(SPELL_SCHOOL_FROST)); - TC_LOG_DEBUG(LOG_FILTER_UNITS, "ShadowRes is: \t\t%u\t\tArcaneRes is: \t\t%u", GetResistance(SPELL_SCHOOL_SHADOW), GetResistance(SPELL_SCHOOL_ARCANE)); - TC_LOG_DEBUG(LOG_FILTER_UNITS, "MIN_DAMAGE is: \t\t%f\tMAX_DAMAGE is: \t\t%f", GetFloatValue(UNIT_FIELD_MINDAMAGE), GetFloatValue(UNIT_FIELD_MAXDAMAGE)); - TC_LOG_DEBUG(LOG_FILTER_UNITS, "MIN_OFFHAND_DAMAGE is: \t%f\tMAX_OFFHAND_DAMAGE is: \t%f", GetFloatValue(UNIT_FIELD_MINOFFHANDDAMAGE), GetFloatValue(UNIT_FIELD_MAXOFFHANDDAMAGE)); - TC_LOG_DEBUG(LOG_FILTER_UNITS, "MIN_RANGED_DAMAGE is: \t%f\tMAX_RANGED_DAMAGE is: \t%f", GetFloatValue(UNIT_FIELD_MINRANGEDDAMAGE), GetFloatValue(UNIT_FIELD_MAXRANGEDDAMAGE)); - TC_LOG_DEBUG(LOG_FILTER_UNITS, "ATTACK_TIME is: \t%u\t\tRANGE_ATTACK_TIME is: \t%u", GetAttackTime(BASE_ATTACK), GetAttackTime(RANGED_ATTACK)); + TC_LOG_DEBUG("entities.unit", "HP is: \t\t\t%u\t\tMP is: \t\t\t%u", GetMaxHealth(), GetMaxPower(POWER_MANA)); + TC_LOG_DEBUG("entities.unit", "AGILITY is: \t\t%f\t\tSTRENGTH is: \t\t%f", GetStat(STAT_AGILITY), GetStat(STAT_STRENGTH)); + TC_LOG_DEBUG("entities.unit", "INTELLECT is: \t\t%f\t\tSPIRIT is: \t\t%f", GetStat(STAT_INTELLECT), GetStat(STAT_SPIRIT)); + TC_LOG_DEBUG("entities.unit", "STAMINA is: \t\t%f", GetStat(STAT_STAMINA)); + TC_LOG_DEBUG("entities.unit", "Armor is: \t\t%u\t\tBlock is: \t\t%f", GetArmor(), GetFloatValue(PLAYER_BLOCK_PERCENTAGE)); + TC_LOG_DEBUG("entities.unit", "HolyRes is: \t\t%u\t\tFireRes is: \t\t%u", GetResistance(SPELL_SCHOOL_HOLY), GetResistance(SPELL_SCHOOL_FIRE)); + TC_LOG_DEBUG("entities.unit", "NatureRes is: \t\t%u\t\tFrostRes is: \t\t%u", GetResistance(SPELL_SCHOOL_NATURE), GetResistance(SPELL_SCHOOL_FROST)); + TC_LOG_DEBUG("entities.unit", "ShadowRes is: \t\t%u\t\tArcaneRes is: \t\t%u", GetResistance(SPELL_SCHOOL_SHADOW), GetResistance(SPELL_SCHOOL_ARCANE)); + TC_LOG_DEBUG("entities.unit", "MIN_DAMAGE is: \t\t%f\tMAX_DAMAGE is: \t\t%f", GetFloatValue(UNIT_FIELD_MINDAMAGE), GetFloatValue(UNIT_FIELD_MAXDAMAGE)); + TC_LOG_DEBUG("entities.unit", "MIN_OFFHAND_DAMAGE is: \t%f\tMAX_OFFHAND_DAMAGE is: \t%f", GetFloatValue(UNIT_FIELD_MINOFFHANDDAMAGE), GetFloatValue(UNIT_FIELD_MAXOFFHANDDAMAGE)); + TC_LOG_DEBUG("entities.unit", "MIN_RANGED_DAMAGE is: \t%f\tMAX_RANGED_DAMAGE is: \t%f", GetFloatValue(UNIT_FIELD_MINRANGEDDAMAGE), GetFloatValue(UNIT_FIELD_MAXRANGEDDAMAGE)); + TC_LOG_DEBUG("entities.unit", "ATTACK_TIME is: \t%u\t\tRANGE_ATTACK_TIME is: \t%u", GetAttackTime(BASE_ATTACK), GetAttackTime(RANGED_ATTACK)); } /*********************************************************/ @@ -19872,7 +19958,7 @@ void Player::UpdateSpeakTime() } } else - m_speakCount = 0; + m_speakCount = 1; m_speakTime = current + sWorld->getIntConfig(CONFIG_CHATFLOOD_MESSAGE_DELAY); } @@ -20154,7 +20240,7 @@ Pet* Player::GetPet() const return pet; //there may be a guardian in slot - //TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player::GetPet: Pet %u not exist.", GUID_LOPART(pet_guid)); + //TC_LOG_ERROR("entities.player", "Player::GetPet: Pet %u not exist.", GUID_LOPART(pet_guid)); //const_cast<Player*>(this)->SetPetGUID(0); } @@ -20168,7 +20254,7 @@ void Player::RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent) if (pet) { - TC_LOG_DEBUG(LOG_FILTER_PETS, "RemovePet %u, %u, %u", pet->GetEntry(), mode, returnreagent); + TC_LOG_DEBUG("entities.pet", "RemovePet %u, %u, %u", pet->GetEntry(), mode, returnreagent); if (pet->m_removed) return; @@ -20256,10 +20342,10 @@ void Player::StopCastingCharm() if (GetCharmGUID()) { - TC_LOG_FATAL(LOG_FILTER_PLAYER, "Player %s (GUID: " UI64FMTD " is not able to uncharm unit (GUID: " UI64FMTD " Entry: %u, Type: %u)", GetName().c_str(), GetGUID(), GetCharmGUID(), charm->GetEntry(), charm->GetTypeId()); + TC_LOG_FATAL("entities.player", "Player %s (GUID: " UI64FMTD " is not able to uncharm unit (GUID: " UI64FMTD " Entry: %u, Type: %u)", GetName().c_str(), GetGUID(), GetCharmGUID(), charm->GetEntry(), charm->GetTypeId()); if (charm->GetCharmerGUID()) { - TC_LOG_FATAL(LOG_FILTER_PLAYER, "Charmed unit has charmer guid " UI64FMTD, charm->GetCharmerGUID()); + TC_LOG_FATAL("entities.player", "Charmed unit has charmer guid " UI64FMTD, charm->GetCharmerGUID()); ASSERT(false); } else @@ -20377,7 +20463,7 @@ void Player::PetSpellInitialize() if (!pet) return; - TC_LOG_DEBUG(LOG_FILTER_PETS, "Pet Spells Groups"); + TC_LOG_DEBUG("entities.pet", "Pet Spells Groups"); CharmInfo* charmInfo = pet->GetCharmInfo(); @@ -20462,7 +20548,7 @@ void Player::PossessSpellInitialize() if (!charmInfo) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player::PossessSpellInitialize(): charm (" UI64FMTD ") has no charminfo!", charm->GetGUID()); + TC_LOG_ERROR("entities.player", "Player::PossessSpellInitialize(): charm (" UI64FMTD ") has no charminfo!", charm->GetGUID()); return; } @@ -20510,7 +20596,7 @@ void Player::VehicleSpellInitialize() ConditionList conditions = sConditionMgr->GetConditionsForVehicleSpell(vehicle->GetEntry(), spellId); if (!sConditionMgr->IsObjectMeetToConditions(this, vehicle, conditions)) { - TC_LOG_DEBUG(LOG_FILTER_CONDITIONSYS, "VehicleSpellInitialize: conditions not met for Vehicle entry %u spell %u", vehicle->ToCreature()->GetEntry(), spellId); + TC_LOG_DEBUG("condition", "VehicleSpellInitialize: conditions not met for Vehicle entry %u spell %u", vehicle->ToCreature()->GetEntry(), spellId); data << uint16(0) << uint8(0) << uint8(i+8); continue; } @@ -20574,7 +20660,7 @@ void Player::CharmSpellInitialize() CharmInfo* charmInfo = charm->GetCharmInfo(); if (!charmInfo) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player::CharmSpellInitialize(): the player's charm (" UI64FMTD ") has no charminfo!", charm->GetGUID()); + TC_LOG_ERROR("entities.player", "Player::CharmSpellInitialize(): the player's charm (" UI64FMTD ") has no charminfo!", charm->GetGUID()); return; } @@ -20644,7 +20730,7 @@ bool Player::IsAffectedBySpellmod(SpellInfo const* spellInfo, SpellModifier* mod void Player::AddSpellMod(SpellModifier* mod, bool apply) { - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Player::AddSpellMod %d", mod->spellId); + TC_LOG_DEBUG("spells", "Player::AddSpellMod %d", mod->spellId); uint16 Opcode = (mod->type == SPELLMOD_FLAT) ? SMSG_SET_FLAT_SPELL_MODIFIER : SMSG_SET_PCT_SPELL_MODIFIER; int i = 0; @@ -20689,13 +20775,15 @@ void Player::RestoreSpellMods(Spell* spell, uint32 ownerAuraId, Aura* aura) if (!spell || spell->m_appliedMods.empty()) return; + std::list<Aura*> aurasQueue; + for (uint8 i=0; i<MAX_SPELLMOD; ++i) { for (SpellModList::iterator itr = m_spellMods[i].begin(); itr != m_spellMods[i].end(); ++itr) { SpellModifier* mod = *itr; - // spellmods without aura set cannot be charged + // Spellmods without aura set cannot be charged if (!mod->ownerAura || !mod->ownerAura->IsUsingCharges()) continue; @@ -20706,17 +20794,20 @@ void Player::RestoreSpellMods(Spell* spell, uint32 ownerAuraId, Aura* aura) if (aura && mod->ownerAura != aura) continue; - // check if mod affected this spell - // first, check if the mod aura applied at least one spellmod to this spell + // Check if mod affected this spell + // First, check if the mod aura applied at least one spellmod to this spell Spell::UsedSpellMods::iterator iterMod = spell->m_appliedMods.find(mod->ownerAura); if (iterMod == spell->m_appliedMods.end()) continue; - // secondly, check if the current mod is one of the spellmods applied by the mod aura + // Second, check if the current mod is one of those applied by the mod aura if (!(mod->mask & spell->m_spellInfo->SpellFamilyFlags)) continue; - // remove from list - spell->m_appliedMods.erase(iterMod); + // remove from list - This will be done after all mods have been gone through + // to ensure we iterate over all mods of an aura before removing said aura + // from applied mods (Else, an aura with two mods on the current spell would + // only see the first of its modifier restored) + aurasQueue.push_back(mod->ownerAura); // add mod charges back to mod if (mod->charges == -1) @@ -20724,15 +20815,22 @@ void Player::RestoreSpellMods(Spell* spell, uint32 ownerAuraId, Aura* aura) else mod->charges++; - // Do not set more spellmods than avalible + // Do not set more spellmods than available if (mod->ownerAura->GetCharges() < mod->charges) mod->charges = mod->ownerAura->GetCharges(); // Skip this check for now - aura charges may change due to various reason - /// @todo trac these changes correctly + /// @todo track these changes correctly //ASSERT (mod->ownerAura->GetCharges() <= mod->charges); } } + + for (std::list<Aura*>::iterator itr = aurasQueue.begin(); itr != aurasQueue.end(); ++itr) + { + Spell::UsedSpellMods::iterator iterMod = spell->m_appliedMods.find(*itr); + if (iterMod != spell->m_appliedMods.end()) + spell->m_appliedMods.erase(iterMod); + } } void Player::RestoreAllSpellMods(uint32 ownerAuraId, Aura* aura) @@ -21150,7 +21248,7 @@ void Player::ContinueTaxiFlight() if (!sourceNode) return; - TC_LOG_DEBUG(LOG_FILTER_UNITS, "WORLD: Restart character %u taxi flight", GetGUIDLow()); + TC_LOG_DEBUG("entities.unit", "WORLD: Restart character %u taxi flight", GetGUIDLow()); uint32 mountDisplayId = sObjectMgr->GetTaxiMountDisplayId(sourceNode, GetTeam(), true); if (!mountDisplayId) @@ -21288,7 +21386,7 @@ void Player::InitDisplayIds() PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass()); if (!info) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player %u has incorrect race/class pair. Can't init display ids.", GetGUIDLow()); + TC_LOG_ERROR("entities.player", "Player %u has incorrect race/class pair. Can't init display ids.", GetGUIDLow()); return; } @@ -21304,7 +21402,7 @@ void Player::InitDisplayIds() SetNativeDisplayId(info->displayId_m); break; default: - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Invalid gender %u for player", gender); + TC_LOG_ERROR("entities.player", "Invalid gender %u for player", gender); return; } } @@ -21394,7 +21492,7 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 Creature* creature = GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR); if (!creature) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: BuyItemFromVendor - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(vendorguid))); + TC_LOG_DEBUG("network", "WORLD: BuyItemFromVendor - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(vendorguid))); SendBuyError(BUY_ERR_DISTANCE_TOO_FAR, NULL, item, 0); return false; } @@ -21441,7 +21539,7 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 ItemExtendedCostEntry const* iece = sItemExtendedCostStore.LookupEntry(crItem->ExtendedCost); if (!iece) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Item %u have wrong ExtendedCost field value %u", pProto->ItemId, crItem->ExtendedCost); + TC_LOG_ERROR("entities.player", "Item %u have wrong ExtendedCost field value %u", pProto->ItemId, crItem->ExtendedCost); return false; } @@ -21484,7 +21582,7 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 uint32 maxCount = MAX_MONEY_AMOUNT / pProto->BuyPrice; if ((uint32)count > maxCount) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player %s tried to buy %u item id %u, causing overflow", GetName().c_str(), (uint32)count, pProto->ItemId); + TC_LOG_ERROR("entities.player", "Player %s tried to buy %u item id %u, causing overflow", GetName().c_str(), (uint32)count, pProto->ItemId); count = (uint8)maxCount; } price = pProto->BuyPrice * count; //it should not exceed MAX_MONEY_AMOUNT @@ -21578,7 +21676,7 @@ void Player::UpdateHomebindTime(uint32 time) data << uint32(m_HomebindTimer); data << uint32(1); GetSession()->SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_MAPS, "PLAYER: Player '%s' (GUID: %u) will be teleported to homebind in 60 seconds", GetName().c_str(), GetGUIDLow()); + TC_LOG_DEBUG("maps", "PLAYER: Player '%s' (GUID: %u) will be teleported to homebind in 60 seconds", GetName().c_str(), GetGUIDLow()); } } @@ -21882,7 +21980,7 @@ bool Player::EnchantmentFitsRequirements(uint32 enchantmentcondition, int8 slot) } } - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "Checking Condition %u, there are %u Meta Gems, %u Red Gems, %u Yellow Gems and %u Blue Gems, Activate:%s", enchantmentcondition, curcount[0], curcount[1], curcount[2], curcount[3], activate ? "yes" : "no"); + TC_LOG_DEBUG("entities.player.items", "Checking Condition %u, there are %u Meta Gems, %u Red Gems, %u Yellow Gems and %u Blue Gems, Activate:%s", enchantmentcondition, curcount[0], curcount[1], curcount[2], curcount[3], activate ? "yes" : "no"); return activate; } @@ -21994,7 +22092,7 @@ void Player::SetBattlegroundEntryPoint() if (const WorldSafeLocsEntry* entry = sObjectMgr->GetClosestGraveYard(GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam())) m_bgData.joinPos = WorldLocation(entry->map_id, entry->x, entry->y, entry->z, 0.0f); else - TC_LOG_ERROR(LOG_FILTER_PLAYER, "SetBattlegroundEntryPoint: Dungeon map %u has no linked graveyard, setting home location as entry point.", GetMapId()); + TC_LOG_ERROR("entities.player", "SetBattlegroundEntryPoint: Dungeon map %u has no linked graveyard, setting home location as entry point.", GetMapId()); } // If new entry point is not BG or arena set it else if (!GetMap()->IsBattlegroundOrArena()) @@ -22215,7 +22313,7 @@ void Player::UpdateVisibilityOf(WorldObject* target) m_clientGUIDs.erase(target->GetGUID()); #ifdef TRINITY_DEBUG - TC_LOG_DEBUG(LOG_FILTER_MAPS, "Object %u (Type: %u) out of range for player %u. Distance = %f", target->GetGUIDLow(), target->GetTypeId(), GetGUIDLow(), GetDistance(target)); + TC_LOG_DEBUG("maps", "Object %u (Type: %u) out of range for player %u. Distance = %f", target->GetGUIDLow(), target->GetTypeId(), GetGUIDLow(), GetDistance(target)); #endif } } @@ -22227,7 +22325,7 @@ void Player::UpdateVisibilityOf(WorldObject* target) m_clientGUIDs.insert(target->GetGUID()); #ifdef TRINITY_DEBUG - TC_LOG_DEBUG(LOG_FILTER_MAPS, "Object %u (Type: %u) is visible now for player %u. Distance = %f", target->GetGUIDLow(), target->GetTypeId(), GetGUIDLow(), GetDistance(target)); + TC_LOG_DEBUG("maps", "Object %u (Type: %u) is visible now for player %u. Distance = %f", target->GetGUIDLow(), target->GetTypeId(), GetGUIDLow(), GetDistance(target)); #endif // target aura duration for caster show only if target exist at caster client @@ -22303,7 +22401,7 @@ void Player::UpdateVisibilityOf(T* target, UpdateData& data, std::set<Unit*>& vi m_clientGUIDs.erase(target->GetGUID()); #ifdef TRINITY_DEBUG - TC_LOG_DEBUG(LOG_FILTER_MAPS, "Object %u (Type: %u, Entry: %u) is out of range for player %u. Distance = %f", target->GetGUIDLow(), target->GetTypeId(), target->GetEntry(), GetGUIDLow(), GetDistance(target)); + TC_LOG_DEBUG("maps", "Object %u (Type: %u, Entry: %u) is out of range for player %u. Distance = %f", target->GetGUIDLow(), target->GetTypeId(), target->GetEntry(), GetGUIDLow(), GetDistance(target)); #endif } } @@ -22315,7 +22413,7 @@ void Player::UpdateVisibilityOf(T* target, UpdateData& data, std::set<Unit*>& vi UpdateVisibilityOf_helper(m_clientGUIDs, target, visibleNow); #ifdef TRINITY_DEBUG - TC_LOG_DEBUG(LOG_FILTER_MAPS, "Object %u (Type: %u, Entry: %u) is visible now for player %u. Distance = %f", target->GetGUIDLow(), target->GetTypeId(), target->GetEntry(), GetGUIDLow(), GetDistance(target)); + TC_LOG_DEBUG("maps", "Object %u (Type: %u, Entry: %u) is visible now for player %u. Distance = %f", target->GetGUIDLow(), target->GetTypeId(), target->GetEntry(), GetGUIDLow(), GetDistance(target)); #endif } } @@ -22774,7 +22872,7 @@ void Player::learnDefaultSpells() for (PlayerCreateInfoSpells::const_iterator itr = info->spell.begin(); itr != info->spell.end(); ++itr) { uint32 tspell = *itr; - TC_LOG_DEBUG(LOG_FILTER_PLAYER_LOADING, "PLAYER (Class: %u Race: %u): Adding initial spell, id = %u", uint32(getClass()), uint32(getRace()), tspell); + TC_LOG_DEBUG("entities.player.loading", "PLAYER (Class: %u Race: %u): Adding initial spell, id = %u", uint32(getClass()), uint32(getRace()), tspell); if (!IsInWorld()) // will send in INITIAL_SPELLS in list anyway at map add addSpell(tspell, true, true, true, false); else // but send in normal spell in game learn case @@ -23409,7 +23507,7 @@ bool Player::HasItemFitToSpellRequirements(SpellInfo const* spellInfo, Item cons break; } default: - TC_LOG_ERROR(LOG_FILTER_PLAYER, "HasItemFitToSpellRequirements: Not handled spell requirement for item class %u", spellInfo->EquippedItemClass); + TC_LOG_ERROR("entities.player", "HasItemFitToSpellRequirements: Not handled spell requirement for item class %u", spellInfo->EquippedItemClass); break; } @@ -23487,7 +23585,7 @@ uint32 Player::GetResurrectionSpellId() case 27239: spell_id = 27240; break; // rank 6 case 47883: spell_id = 47882; break; // rank 7 default: - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Unhandled spell %u: S.Resurrection", (*itr)->GetId()); + TC_LOG_ERROR("entities.player", "Unhandled spell %u: S.Resurrection", (*itr)->GetId()); continue; } @@ -24059,11 +24157,11 @@ void Player::SetViewpoint(WorldObject* target, bool apply) { if (apply) { - TC_LOG_DEBUG(LOG_FILTER_MAPS, "Player::CreateViewpoint: Player %s create seer %u (TypeId: %u).", GetName().c_str(), target->GetEntry(), target->GetTypeId()); + TC_LOG_DEBUG("maps", "Player::CreateViewpoint: Player %s create seer %u (TypeId: %u).", GetName().c_str(), target->GetEntry(), target->GetTypeId()); if (!AddUInt64Value(PLAYER_FARSIGHT, target->GetGUID())) { - TC_LOG_FATAL(LOG_FILTER_PLAYER, "Player::CreateViewpoint: Player %s cannot add new viewpoint!", GetName().c_str()); + TC_LOG_FATAL("entities.player", "Player::CreateViewpoint: Player %s cannot add new viewpoint!", GetName().c_str()); return; } @@ -24075,11 +24173,11 @@ void Player::SetViewpoint(WorldObject* target, bool apply) } else { - TC_LOG_DEBUG(LOG_FILTER_MAPS, "Player::CreateViewpoint: Player %s remove seer", GetName().c_str()); + TC_LOG_DEBUG("maps", "Player::CreateViewpoint: Player %s remove seer", GetName().c_str()); if (!RemoveUInt64Value(PLAYER_FARSIGHT, target->GetGUID())) { - TC_LOG_FATAL(LOG_FILTER_PLAYER, "Player::CreateViewpoint: Player %s cannot remove current viewpoint!", GetName().c_str()); + TC_LOG_FATAL("entities.player", "Player::CreateViewpoint: Player %s cannot remove current viewpoint!", GetName().c_str()); return; } @@ -24584,7 +24682,7 @@ void Player::_LoadSkills(PreparedQueryResult result) SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(skill); if (!pSkill) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Character %u has skill %u that does not exist.", GetGUIDLow(), skill); + TC_LOG_ERROR("entities.player", "Character %u has skill %u that does not exist.", GetGUIDLow(), skill); continue; } @@ -24602,7 +24700,7 @@ void Player::_LoadSkills(PreparedQueryResult result) } if (value == 0) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Character %u has skill %u with value 0. Will be deleted.", GetGUIDLow(), skill); + TC_LOG_ERROR("entities.player", "Character %u has skill %u with value 0. Will be deleted.", GetGUIDLow(), skill); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHARACTER_SKILL); @@ -24631,7 +24729,7 @@ void Player::_LoadSkills(PreparedQueryResult result) if (count >= PLAYER_MAX_SKILLS) // client limit { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Character %u has more than %u skills.", GetGUIDLow(), PLAYER_MAX_SKILLS); + TC_LOG_ERROR("entities.player", "Character %u has more than %u skills.", GetGUIDLow(), PLAYER_MAX_SKILLS); break; } } @@ -24805,7 +24903,7 @@ void Player::HandleFall(MovementInfo const& movementInfo) } //Z given by moveinfo, LastZ, FallTime, WaterZ, MapZ, Damage, Safefall reduction - TC_LOG_DEBUG(LOG_FILTER_PLAYER, "FALLDAMAGE z=%f sz=%f pZ=%f FallTime=%d mZ=%f damage=%d SF=%d", movementInfo.pos.GetPositionZ(), height, GetPositionZ(), movementInfo.fallTime, height, damage, safe_fall); + TC_LOG_DEBUG("entities.player", "FALLDAMAGE z=%f sz=%f pZ=%f FallTime=%d mZ=%f damage=%d SF=%d", movementInfo.pos.GetPositionZ(), height, GetPositionZ(), movementInfo.fallTime, height, damage, safe_fall); } } RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_LANDING); // No fly zone - Parachute @@ -24949,7 +25047,7 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank) uint32 spellid = talentInfo->RankID[talentRank]; if (spellid == 0) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Talent.dbc have for talent: %u Rank: %u spell id = 0", talentId, talentRank); + TC_LOG_ERROR("entities.player", "Talent.dbc have for talent: %u Rank: %u spell id = 0", talentId, talentRank); return; } @@ -24961,7 +25059,7 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank) learnSpell(spellid, false); AddTalent(spellid, m_activeSpec, true); - TC_LOG_INFO(LOG_FILTER_PLAYER, "TalentID: %u Rank: %u Spell: %u Spec: %u\n", talentId, talentRank, spellid, m_activeSpec); + TC_LOG_INFO("entities.player", "TalentID: %u Rank: %u Spell: %u Spec: %u\n", talentId, talentRank, spellid, m_activeSpec); // update free talent points SetFreeTalentPoints(CurTalentPoints - (talentRank - curtalent_maxrank + 1)); @@ -25086,7 +25184,7 @@ void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank) uint32 spellid = talentInfo->RankID[talentRank]; if (spellid == 0) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Talent.dbc have for talent: %u Rank: %u spell id = 0", talentId, talentRank); + TC_LOG_ERROR("entities.player", "Talent.dbc have for talent: %u Rank: %u spell id = 0", talentId, talentRank); return; } @@ -25096,7 +25194,7 @@ void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank) // learn! (other talent ranks will unlearned at learning) pet->learnSpell(spellid); - TC_LOG_INFO(LOG_FILTER_PLAYER, "PetTalentID: %u Rank: %u Spell: %u\n", talentId, talentRank, spellid); + TC_LOG_INFO("entities.player", "PetTalentID: %u Rank: %u Spell: %u\n", talentId, talentRank, spellid); // update free talent points pet->SetFreeTalentPoints(CurTalentPoints - (talentRank - curtalent_maxrank + 1)); @@ -25415,7 +25513,7 @@ void Player::SetEquipmentSet(uint32 index, EquipmentSet eqset) if (!found) // something wrong... { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player %s tried to save equipment set " UI64FMTD " (index %u), but that equipment set not found!", GetName().c_str(), eqset.Guid, index); + TC_LOG_ERROR("entities.player", "Player %s tried to save equipment set " UI64FMTD " (index %u), but that equipment set not found!", GetName().c_str(), eqset.Guid, index); return; } } @@ -25916,13 +26014,13 @@ void Player::SendRefundInfo(Item* item) if (!item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_REFUNDABLE)) { - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "Item refund: item not refundable!"); + TC_LOG_DEBUG("entities.player.items", "Item refund: item not refundable!"); return; } if (GetGUIDLow() != item->GetRefundRecipient()) // Formerly refundable item got traded { - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "Item refund: item was traded!"); + TC_LOG_DEBUG("entities.player.items", "Item refund: item was traded!"); item->SetNotRefundable(this); return; } @@ -25930,7 +26028,7 @@ void Player::SendRefundInfo(Item* item) ItemExtendedCostEntry const* iece = sItemExtendedCostStore.LookupEntry(item->GetPaidExtendedCost()); if (!iece) { - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "Item refund: cannot find extendedcost data."); + TC_LOG_DEBUG("entities.player.items", "Item refund: cannot find extendedcost data."); return; } @@ -25976,7 +26074,7 @@ void Player::RefundItem(Item* item) { if (!item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_REFUNDABLE)) { - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "Item refund: item not refundable!"); + TC_LOG_DEBUG("entities.player.items", "Item refund: item not refundable!"); return; } @@ -25992,7 +26090,7 @@ void Player::RefundItem(Item* item) if (GetGUIDLow() != item->GetRefundRecipient()) // Formerly refundable item got traded { - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "Item refund: item was traded!"); + TC_LOG_DEBUG("entities.player.items", "Item refund: item was traded!"); item->SetNotRefundable(this); return; } @@ -26000,7 +26098,7 @@ void Player::RefundItem(Item* item) ItemExtendedCostEntry const* iece = sItemExtendedCostStore.LookupEntry(item->GetPaidExtendedCost()); if (!iece) { - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "Item refund: cannot find extendedcost data."); + TC_LOG_DEBUG("entities.player.items", "Item refund: cannot find extendedcost data."); return; } @@ -26352,7 +26450,7 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy pet->Relocate(x, y, z, ang); if (!pet->IsPositionValid()) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Pet (guidlow %d, entry %d) not summoned. Suggested coordinates isn't valid (X: %f Y: %f)", pet->GetGUIDLow(), pet->GetEntry(), pet->GetPositionX(), pet->GetPositionY()); + TC_LOG_ERROR("misc", "Pet (guidlow %d, entry %d) not summoned. Suggested coordinates isn't valid (X: %f Y: %f)", pet->GetGUIDLow(), pet->GetEntry(), pet->GetPositionX(), pet->GetPositionY()); delete pet; return NULL; } @@ -26361,7 +26459,7 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy uint32 pet_number = sObjectMgr->GeneratePetNumber(); if (!pet->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_PET), map, GetPhaseMask(), entry, pet_number)) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "no such creature entry %u", entry); + TC_LOG_ERROR("misc", "no such creature entry %u", entry); delete pet; return NULL; } diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 35a3f5f10d4..c445bd9027a 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -251,7 +251,7 @@ typedef std::list<PlayerCreateInfoAction> PlayerCreateInfoActions; struct PlayerInfo { // existence checked by displayId != 0 - PlayerInfo() : displayId_m(0), displayId_f(0), levelInfo(NULL) { } + PlayerInfo() : mapId(0), areaId(0), positionX(0.0f), positionY(0.0f), positionZ(0.0f), orientation(0.0f), displayId_m(0), displayId_f(0), levelInfo(NULL) { } uint32 mapId; uint32 areaId; @@ -1357,6 +1357,7 @@ class Player : public Unit, public GridObject<Player> bool CanCompleteRepeatableQuest(Quest const* quest); bool CanRewardQuest(Quest const* quest, bool msg); bool CanRewardQuest(Quest const* quest, uint32 reward, bool msg); + void AddQuestAndCheckCompletion(Quest const* quest, Object* questGiver); void AddQuest(Quest const* quest, Object* questGiver); void CompleteQuest(uint32 quest_id); void IncompleteQuest(uint32 quest_id); diff --git a/src/server/game/Entities/Player/SocialMgr.cpp b/src/server/game/Entities/Player/SocialMgr.cpp index 6416455ebb6..e7cc8f92ce2 100644 --- a/src/server/game/Entities/Player/SocialMgr.cpp +++ b/src/server/game/Entities/Player/SocialMgr.cpp @@ -172,7 +172,7 @@ void PlayerSocial::SendSocialList(Player* player) } player->GetSession()->SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_CONTACT_LIST"); + TC_LOG_DEBUG("network", "WORLD: Sent SMSG_CONTACT_LIST"); } bool PlayerSocial::HasFriend(uint32 friendGuid) diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp index ea8aae2af8c..386a36ae1f0 100644 --- a/src/server/game/Entities/Transport/Transport.cpp +++ b/src/server/game/Entities/Transport/Transport.cpp @@ -33,7 +33,8 @@ #include "CellImpl.h" Transport::Transport() : GameObject(), - _transportInfo(NULL), _isMoving(true), _pendingStop(false) + _transportInfo(NULL), _isMoving(true), _pendingStop(false), + _triggeredArrivalEvent(false), _triggeredDepartureEvent(false) { m_updateFlag = UPDATEFLAG_TRANSPORT | UPDATEFLAG_LOWGUID | UPDATEFLAG_STATIONARY_POSITION | UPDATEFLAG_ROTATION; } @@ -50,7 +51,7 @@ bool Transport::Create(uint32 guidlow, uint32 entry, uint32 mapid, float x, floa if (!IsPositionValid()) { - TC_LOG_ERROR(LOG_FILTER_TRANSPORTS, "Transport (GUID: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", + TC_LOG_ERROR("entities.transport", "Transport (GUID: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", guidlow, x, y); return false; } @@ -61,7 +62,7 @@ bool Transport::Create(uint32 guidlow, uint32 entry, uint32 mapid, float x, floa if (!goinfo) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Transport not created: entry in `gameobject_template` not found, guidlow: %u map: %u (X: %f Y: %f Z: %f) ang: %f", guidlow, mapid, x, y, z, ang); + TC_LOG_ERROR("sql.sql", "Transport not created: entry in `gameobject_template` not found, guidlow: %u map: %u (X: %f Y: %f Z: %f) ang: %f", guidlow, mapid, x, y, z, ang); return false; } @@ -70,7 +71,7 @@ bool Transport::Create(uint32 guidlow, uint32 entry, uint32 mapid, float x, floa TransportTemplate const* tInfo = sTransportMgr->GetTransportTemplate(entry); if (!tInfo) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Transport %u (name: %s) will not be created, missing `transport_template` entry.", entry, goinfo->name.c_str()); + TC_LOG_ERROR("sql.sql", "Transport %u (name: %s) will not be created, missing `transport_template` entry.", entry, goinfo->name.c_str()); return false; } @@ -105,7 +106,7 @@ void Transport::Update(uint32 diff) if (AI()) AI()->UpdateAI(diff); else if (!AIM_Initialize()) - TC_LOG_ERROR(LOG_FILTER_TRANSPORTS, "Could not initialize GameObjectAI for Transport"); + TC_LOG_ERROR("entities.transport", "Could not initialize GameObjectAI for Transport"); if (GetKeyFrames().size() <= 1) return; @@ -163,13 +164,14 @@ void Transport::Update(uint32 diff) if (GetGOInfo()->moTransport.canBeStopped) SetGoState(GO_STATE_ACTIVE); - // Departure event - if (_currentFrame->IsTeleportFrame()) - TeleportTransport(_nextFrame->Node->mapid, _nextFrame->Node->x, _nextFrame->Node->y, _nextFrame->Node->z); - sScriptMgr->OnRelocate(this, _currentFrame->Node->index, _currentFrame->Node->mapid, _currentFrame->Node->x, _currentFrame->Node->y, _currentFrame->Node->z); - TC_LOG_DEBUG(LOG_FILTER_TRANSPORTS, "Transport %u (%s) moved to node %u %u %f %f %f", GetEntry(), GetName().c_str(), _currentFrame->Node->index, _currentFrame->Node->mapid, _currentFrame->Node->x, _currentFrame->Node->y, _currentFrame->Node->z); + TC_LOG_DEBUG("entities.transport", "Transport %u (%s) moved to node %u %u %f %f %f", GetEntry(), GetName().c_str(), _currentFrame->Node->index, _currentFrame->Node->mapid, _currentFrame->Node->x, _currentFrame->Node->y, _currentFrame->Node->z); + + // Departure event + if (_currentFrame->IsTeleportFrame()) + if (TeleportTransport(_nextFrame->Node->mapid, _nextFrame->Node->x, _nextFrame->Node->y, _nextFrame->Node->z)) + return; // Update more in new map thread } // Set position @@ -194,7 +196,7 @@ void Transport::AddPassenger(WorldObject* passenger) { if (_passengers.insert(passenger).second) { - TC_LOG_DEBUG(LOG_FILTER_TRANSPORTS, "Object %s boarded transport %s.", passenger->GetName().c_str(), GetName().c_str()); + TC_LOG_DEBUG("entities.transport", "Object %s boarded transport %s.", passenger->GetName().c_str(), GetName().c_str()); if (Player* plr = passenger->ToPlayer()) sScriptMgr->OnAddPassenger(this, plr); @@ -205,7 +207,7 @@ void Transport::RemovePassenger(WorldObject* passenger) { if (_passengers.erase(passenger) || _staticPassengers.erase(passenger)) // static passenger can remove itself in case of grid unload { - TC_LOG_DEBUG(LOG_FILTER_TRANSPORTS, "Object %s removed from transport %s.", passenger->GetName().c_str(), GetName().c_str()); + TC_LOG_DEBUG("entities.transport", "Object %s removed from transport %s.", passenger->GetName().c_str(), GetName().c_str()); if (Player* plr = passenger->ToPlayer()) sScriptMgr->OnRemovePassenger(this, plr); @@ -237,9 +239,13 @@ Creature* Transport::CreateNPCPassenger(uint32 guid, CreatureData const* data) creature->SetHomePosition(creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ(), creature->GetOrientation()); creature->SetTransportHomePosition(creature->m_movementInfo.transport.pos); + /// @HACK - transport models are not added to map's dynamic LoS calculations + /// because the current GameObjectModel cannot be moved without recreating + creature->AddUnitState(UNIT_STATE_IGNORE_PATHFINDING); + if (!creature->IsPositionValid()) { - TC_LOG_ERROR(LOG_FILTER_TRANSPORTS, "Creature (guidlow %d, entry %d) not created. Suggested coordinates aren't valid (X: %f Y: %f)",creature->GetGUIDLow(),creature->GetEntry(),creature->GetPositionX(),creature->GetPositionY()); + TC_LOG_ERROR("entities.transport", "Creature (guidlow %d, entry %d) not created. Suggested coordinates aren't valid (X: %f Y: %f)",creature->GetGUIDLow(),creature->GetEntry(),creature->GetPositionX(),creature->GetPositionY()); delete creature; return NULL; } @@ -279,7 +285,7 @@ GameObject* Transport::CreateGOPassenger(uint32 guid, GameObjectData const* data if (!go->IsPositionValid()) { - TC_LOG_ERROR(LOG_FILTER_TRANSPORTS, "GameObject (guidlow %d, entry %d) not created. Suggested coordinates aren't valid (X: %f Y: %f)", go->GetGUIDLow(), go->GetEntry(), go->GetPositionX(), go->GetPositionY()); + TC_LOG_ERROR("entities.transport", "GameObject (guidlow %d, entry %d) not created. Suggested coordinates aren't valid (X: %f Y: %f)", go->GetGUIDLow(), go->GetEntry(), go->GetPositionX(), go->GetPositionY()); delete go; return NULL; } @@ -294,30 +300,6 @@ GameObject* Transport::CreateGOPassenger(uint32 guid, GameObjectData const* data return go; } -void Transport::CalculatePassengerPosition(float& x, float& y, float& z, float* o /*= NULL*/) const -{ - float inx = x, iny = y, inz = z; - if (o) - *o = Position::NormalizeOrientation(GetOrientation() + *o); - - x = GetPositionX() + inx * std::cos(GetOrientation()) - iny * std::sin(GetOrientation()); - y = GetPositionY() + iny * std::cos(GetOrientation()) + inx * std::sin(GetOrientation()); - z = GetPositionZ() + inz; -} - -void Transport::CalculatePassengerOffset(float& x, float& y, float& z, float* o /*= NULL*/) const -{ - if (o) - *o = Position::NormalizeOrientation(*o - GetOrientation()); - - z -= GetPositionZ(); - y -= GetPositionY(); // y = searchedY * std::cos(o) + searchedX * std::sin(o) - x -= GetPositionX(); // x = searchedX * std::cos(o) + searchedY * std::sin(o + pi) - float inx = x, iny = y; - y = (iny - inx * std::tan(GetOrientation())) / (std::cos(GetOrientation()) + std::sin(GetOrientation()) * std::tan(GetOrientation())); - x = (inx + iny * std::tan(GetOrientation())) / (std::cos(GetOrientation()) + std::sin(GetOrientation()) * std::tan(GetOrientation())); -} - void Transport::UpdatePosition(float x, float y, float z, float o) { bool newActive = GetMap()->IsGridLoaded(x, y); @@ -422,7 +404,7 @@ float Transport::CalculateSegmentPos(float now) return segmentPos / frame.NextDistFromPrev; } -void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z) +bool Transport::TeleportTransport(uint32 newMapid, float x, float y, float z) { Map const* oldMap = GetMap(); @@ -465,23 +447,27 @@ void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z) { WorldObject* obj = (*itr++); + float destX, destY, destZ, destO; + obj->m_movementInfo.transport.pos.GetPosition(destX, destY, destZ, destO); + TransportBase::CalculatePassengerPosition(destX, destY, destZ, &destO, x, y, z, GetOrientation()); + switch (obj->GetTypeId()) { case TYPEID_UNIT: if (!IS_PLAYER_GUID(obj->ToUnit()->GetOwnerGUID())) // pets should be teleported with player - obj->ToCreature()->FarTeleportTo(newMap, x, y, z, obj->GetOrientation()); + obj->ToCreature()->FarTeleportTo(newMap, destX, destY, destZ, destO); break; case TYPEID_GAMEOBJECT: { GameObject* go = obj->ToGameObject(); go->GetMap()->RemoveFromMap(go, false); - Relocate(x, y, z, go->GetOrientation()); - SetMap(newMap); + go->Relocate(destX, destY, destZ, destO); + go->SetMap(newMap); newMap->AddToMap(go); break; } case TYPEID_PLAYER: - if (!obj->ToPlayer()->TeleportTo(newMapid, x, y, z, GetOrientation(), TELE_TO_NOT_LEAVE_TRANSPORT)) + if (!obj->ToPlayer()->TeleportTo(newMapid, destX, destY, destZ, destO, TELE_TO_NOT_LEAVE_TRANSPORT)) _passengers.erase(obj); break; default: @@ -489,17 +475,28 @@ void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z) } } + Relocate(x, y, z, GetOrientation()); GetMap()->AddToMap<Transport>(this); + return true; } else { // Teleport players, they need to know it for (std::set<WorldObject*>::iterator itr = _passengers.begin(); itr != _passengers.end(); ++itr) + { if ((*itr)->GetTypeId() == TYPEID_PLAYER) - (*itr)->ToUnit()->NearTeleportTo(x, y, z, GetOrientation()); - } + { + float destX, destY, destZ, destO; + (*itr)->m_movementInfo.transport.pos.GetPosition(destX, destY, destZ, destO); + TransportBase::CalculatePassengerPosition(destX, destY, destZ, &destO, x, y, z, GetOrientation()); - UpdatePosition(x, y, z, GetOrientation()); + (*itr)->ToUnit()->NearTeleportTo(destX, destY, destZ, destO); + } + } + + UpdatePosition(x, y, z, GetOrientation()); + return false; + } } void Transport::UpdatePassengerPositions(std::set<WorldObject*>& passengers) @@ -534,7 +531,9 @@ void Transport::UpdatePassengerPositions(std::set<WorldObject*>& passengers) break; } case TYPEID_PLAYER: - GetMap()->PlayerRelocation(passenger->ToPlayer(), x, y, z, o); + //relocate only passengers in world and skip any player that might be still logging in/teleporting + if (passenger->IsInWorld()) + GetMap()->PlayerRelocation(passenger->ToPlayer(), x, y, z, o); break; case TYPEID_GAMEOBJECT: GetMap()->GameObjectRelocation(passenger->ToGameObject(), x, y, z, o, false); @@ -553,7 +552,7 @@ void Transport::DoEventIfAny(KeyFrame const& node, bool departure) { if (uint32 eventid = departure ? node.Node->departureEventID : node.Node->arrivalEventID) { - TC_LOG_DEBUG(LOG_FILTER_MAPSCRIPTS, "Taxi %s event %u of node %u of %s path", departure ? "departure" : "arrival", eventid, node.Node->index, GetName().c_str()); + TC_LOG_DEBUG("maps.script", "Taxi %s event %u of node %u of %s path", departure ? "departure" : "arrival", eventid, node.Node->index, GetName().c_str()); GetMap()->ScriptsStart(sEventScripts, eventid, this, this); EventInform(eventid); } diff --git a/src/server/game/Entities/Transport/Transport.h b/src/server/game/Entities/Transport/Transport.h index 0d020fe2c34..e290a5d5e00 100644 --- a/src/server/game/Entities/Transport/Transport.h +++ b/src/server/game/Entities/Transport/Transport.h @@ -46,10 +46,16 @@ class Transport : public GameObject, public TransportBase GameObject* CreateGOPassenger(uint32 guid, GameObjectData const* data); /// This method transforms supplied transport offsets into global coordinates - void CalculatePassengerPosition(float& x, float& y, float& z, float* o = NULL) const; + void CalculatePassengerPosition(float& x, float& y, float& z, float* o /*= NULL*/) const + { + TransportBase::CalculatePassengerPosition(x, y, z, o, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); + } /// This method transforms supplied global coordinates into local offsets - void CalculatePassengerOffset(float& x, float& y, float& z, float* o = NULL) const; + void CalculatePassengerOffset(float& x, float& y, float& z, float* o /*= NULL*/) const + { + TransportBase::CalculatePassengerOffset(x, y, z, o, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); + } uint32 GetPeriod() const { return GetUInt32Value(GAMEOBJECT_LEVEL); } void SetPeriod(uint32 period) { SetUInt32Value(GAMEOBJECT_LEVEL, period); } @@ -72,7 +78,7 @@ class Transport : public GameObject, public TransportBase private: void MoveToNextWaypoint(); float CalculateSegmentPos(float perc); - void TeleportTransport(uint32 newMapid, float x, float y, float z); + bool TeleportTransport(uint32 newMapid, float x, float y, float z); void UpdatePassengerPositions(std::set<WorldObject*>& passengers); void DoEventIfAny(KeyFrame const& node, bool departure); @@ -84,7 +90,6 @@ class Transport : public GameObject, public TransportBase KeyFrameVec::const_iterator _currentFrame; KeyFrameVec::const_iterator _nextFrame; - uint32 _moveTimer; TimeTrackerSmall _positionChangeTimer; bool _isMoving; bool _pendingStop; diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index f861d0cba7b..32dfee3409b 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -165,7 +165,7 @@ Unit::Unit(bool isWorldObject) : IsAIEnabled(false), NeedChangeAI(false), LastCharmerGUID(0), m_ControlledByPlayer(false), movespline(new Movement::MoveSpline()), i_AI(NULL), i_disabledAI(NULL), m_AutoRepeatFirstCast(false), m_procDeep(0), - m_removedAurasCount(0), i_motionMaster(this), m_ThreatManager(this), + m_removedAurasCount(0), i_motionMaster(new MotionMaster(this)), m_regenTimer(0), m_ThreatManager(this), m_vehicle(NULL), m_vehicleKit(NULL), m_unitTypeMask(UNIT_MASK_NONE), m_HostileRefManager(this), _lastDamagedTime(0) { @@ -241,8 +241,6 @@ Unit::Unit(bool isWorldObject) : for (uint8 i = 0; i < MAX_SPELL_SCHOOL; ++i) m_threatModifier[i] = 1.0f; - m_isSorted = true; - for (uint8 i = 0; i < MAX_MOVE_TYPE; ++i) m_speed_rate[i] = 1.0f; @@ -295,6 +293,7 @@ Unit::~Unit() _DeleteRemovedAuras(); + delete i_motionMaster; delete m_charmInfo; delete movespline; @@ -364,7 +363,7 @@ void Unit::Update(uint32 p_time) } UpdateSplineMovement(p_time); - i_motionMaster.UpdateMotion(p_time); + i_motionMaster->UpdateMotion(p_time); } bool Unit::haveOffhandWeapon() const @@ -385,8 +384,6 @@ void Unit::MonsterMoveWithSpeed(float x, float y, float z, float speed, bool gen void Unit::UpdateSplineMovement(uint32 t_diff) { - uint32 const positionUpdateDelay = 400; - if (movespline->Finalized()) return; @@ -398,27 +395,32 @@ void Unit::UpdateSplineMovement(uint32 t_diff) m_movesplineTimer.Update(t_diff); if (m_movesplineTimer.Passed() || arrived) - { - m_movesplineTimer.Reset(positionUpdateDelay); - Movement::Location loc = movespline->ComputePosition(); + UpdateSplinePosition(); +} - if (HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) - { - Position& pos = m_movementInfo.transport.pos; - pos.m_positionX = loc.x; - pos.m_positionY = loc.y; - pos.m_positionZ = loc.z; - pos.m_orientation = loc.orientation; +void Unit::UpdateSplinePosition() +{ + static uint32 const positionUpdateDelay = 400; - if (TransportBase* transport = GetDirectTransport()) - transport->CalculatePassengerPosition(loc.x, loc.y, loc.z, &loc.orientation); - } + m_movesplineTimer.Reset(positionUpdateDelay); + Movement::Location loc = movespline->ComputePosition(); - if (HasUnitState(UNIT_STATE_CANNOT_TURN)) - loc.orientation = GetOrientation(); + if (HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) + { + Position& pos = m_movementInfo.transport.pos; + pos.m_positionX = loc.x; + pos.m_positionY = loc.y; + pos.m_positionZ = loc.z; + pos.m_orientation = loc.orientation; - UpdatePosition(loc.x, loc.y, loc.z, loc.orientation); + if (TransportBase* transport = GetDirectTransport()) + transport->CalculatePassengerPosition(loc.x, loc.y, loc.z, &loc.orientation); } + + if (HasUnitState(UNIT_STATE_CANNOT_TURN)) + loc.orientation = GetOrientation(); + + UpdatePosition(loc.x, loc.y, loc.z, loc.orientation); } void Unit::DisableSpline() @@ -667,10 +669,10 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam return 0; } - TC_LOG_DEBUG(LOG_FILTER_UNITS, "DealDamageStart"); + TC_LOG_DEBUG("entities.unit", "DealDamageStart"); uint32 health = victim->GetHealth(); - TC_LOG_DEBUG(LOG_FILTER_UNITS, "Unit " UI64FMTD " dealt %u damage to unit " UI64FMTD, GetGUID(), damage, victim->GetGUID()); + TC_LOG_DEBUG("entities.unit", "Unit " UI64FMTD " dealt %u damage to unit " UI64FMTD, GetGUID(), damage, victim->GetGUID()); // duel ends when player has 1 or less hp bool duel_hasEnded = false; @@ -724,7 +726,7 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam if (health <= damage) { - TC_LOG_DEBUG(LOG_FILTER_UNITS, "DealDamage: victim just died"); + TC_LOG_DEBUG("entities.unit", "DealDamage: victim just died"); if (victim->GetTypeId() == TYPEID_PLAYER && victim != this) victim->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_DAMAGE_RECEIVED, health); @@ -733,7 +735,7 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam } else { - TC_LOG_DEBUG(LOG_FILTER_UNITS, "DealDamageAlive"); + TC_LOG_DEBUG("entities.unit", "DealDamageAlive"); if (victim->GetTypeId() == TYPEID_PLAYER) victim->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_DAMAGE_RECEIVED, damage); @@ -821,7 +823,7 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam } } - TC_LOG_DEBUG(LOG_FILTER_UNITS, "DealDamageEnd returned %d damage", damage); + TC_LOG_DEBUG("entities.unit", "DealDamageEnd returned %d damage", damage); return damage; } @@ -837,7 +839,7 @@ void Unit::CastSpell(SpellCastTargets const& targets, SpellInfo const* spellInfo { if (!spellInfo) { - TC_LOG_ERROR(LOG_FILTER_UNITS, "CastSpell: unknown spell by caster: %s %u)", (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry())); + TC_LOG_ERROR("entities.unit", "CastSpell: unknown spell by caster: %s %u)", (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry())); return; } @@ -865,7 +867,7 @@ void Unit::CastSpell(Unit* victim, uint32 spellId, TriggerCastFlags triggerFlags SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); if (!spellInfo) { - TC_LOG_ERROR(LOG_FILTER_UNITS, "CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry())); + TC_LOG_ERROR("entities.unit", "CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry())); return; } @@ -915,7 +917,7 @@ void Unit::CastCustomSpell(uint32 spellId, CustomSpellValues const& value, Unit* SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); if (!spellInfo) { - TC_LOG_ERROR(LOG_FILTER_UNITS, "CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry())); + TC_LOG_ERROR("entities.unit", "CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry())); return; } SpellCastTargets targets; @@ -929,7 +931,7 @@ void Unit::CastSpell(float x, float y, float z, uint32 spellId, bool triggered, SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); if (!spellInfo) { - TC_LOG_ERROR(LOG_FILTER_UNITS, "CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry())); + TC_LOG_ERROR("entities.unit", "CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry())); return; } SpellCastTargets targets; @@ -943,7 +945,7 @@ void Unit::CastSpell(GameObject* go, uint32 spellId, bool triggered, Item* castI SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); if (!spellInfo) { - TC_LOG_ERROR(LOG_FILTER_UNITS, "CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry())); + TC_LOG_ERROR("entities.unit", "CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry())); return; } SpellCastTargets targets; @@ -956,6 +958,8 @@ void Unit::CastSpell(GameObject* go, uint32 spellId, bool triggered, Item* castI uint32 Unit::SpellNonMeleeDamageLog(Unit* victim, uint32 spellID, uint32 damage) { SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellID); + if (!spellInfo) + return 0; SpellNonMeleeDamage damageInfo(this, victim, spellInfo->Id, spellInfo->SchoolMask); damage = SpellDamageBonusDone(victim, spellInfo, damage, SPELL_DIRECT_DAMAGE); damage = victim->SpellDamageBonusTaken(this, spellInfo, damage, SPELL_DIRECT_DAMAGE); @@ -1092,7 +1096,7 @@ void Unit::DealSpellDamage(SpellNonMeleeDamage* damageInfo, bool durabilityLoss) SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(damageInfo->SpellID); if (spellProto == NULL) { - TC_LOG_DEBUG(LOG_FILTER_UNITS, "Unit::DealSpellDamage has wrong damageInfo->SpellID: %u", damageInfo->SpellID); + TC_LOG_DEBUG("entities.unit", "Unit::DealSpellDamage has wrong damageInfo->SpellID: %u", damageInfo->SpellID); return; } @@ -1952,10 +1956,10 @@ void Unit::AttackerStateUpdate (Unit* victim, WeaponAttackType attType, bool ext DealMeleeDamage(&damageInfo, true); if (GetTypeId() == TYPEID_PLAYER) - TC_LOG_DEBUG(LOG_FILTER_UNITS, "AttackerStateUpdate: (Player) %u attacked %u (TypeId: %u) for %u dmg, absorbed %u, blocked %u, resisted %u.", + TC_LOG_DEBUG("entities.unit", "AttackerStateUpdate: (Player) %u attacked %u (TypeId: %u) for %u dmg, absorbed %u, blocked %u, resisted %u.", GetGUIDLow(), victim->GetGUIDLow(), victim->GetTypeId(), damageInfo.damage, damageInfo.absorb, damageInfo.blocked_amount, damageInfo.resist); else - TC_LOG_DEBUG(LOG_FILTER_UNITS, "AttackerStateUpdate: (NPC) %u attacked %u (TypeId: %u) for %u dmg, absorbed %u, blocked %u, resisted %u.", + TC_LOG_DEBUG("entities.unit", "AttackerStateUpdate: (NPC) %u attacked %u (TypeId: %u) for %u dmg, absorbed %u, blocked %u, resisted %u.", GetGUIDLow(), victim->GetGUIDLow(), victim->GetTypeId(), damageInfo.damage, damageInfo.absorb, damageInfo.blocked_amount, damageInfo.resist); } } @@ -1986,7 +1990,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit* victim, WeaponAttackTy float parry_chance = victim->GetUnitParryChance(); // Useful if want to specify crit & miss chances for melee, else it could be removed - TC_LOG_DEBUG(LOG_FILTER_UNITS, "MELEE OUTCOME: miss %f crit %f dodge %f parry %f block %f", miss_chance, crit_chance, dodge_chance, parry_chance, block_chance); + TC_LOG_DEBUG("entities.unit", "MELEE OUTCOME: miss %f crit %f dodge %f parry %f block %f", miss_chance, crit_chance, dodge_chance, parry_chance, block_chance); return RollMeleeOutcomeAgainst(victim, attType, int32(crit_chance*100), int32(miss_chance*100), int32(dodge_chance*100), int32(parry_chance*100), int32(block_chance*100)); } @@ -2007,22 +2011,22 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT int32 sum = 0, tmp = 0; int32 roll = urand (0, 10000); - TC_LOG_DEBUG(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: skill bonus of %d for attacker", skillBonus); - TC_LOG_DEBUG(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: rolled %d, miss %d, dodge %d, parry %d, block %d, crit %d", + TC_LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: skill bonus of %d for attacker", skillBonus); + TC_LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: rolled %d, miss %d, dodge %d, parry %d, block %d, crit %d", roll, miss_chance, dodge_chance, parry_chance, block_chance, crit_chance); tmp = miss_chance; if (tmp > 0 && roll < (sum += tmp)) { - TC_LOG_DEBUG(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: MISS"); + TC_LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: MISS"); return MELEE_HIT_MISS; } // always crit against a sitting target (except 0 crit chance) if (victim->GetTypeId() == TYPEID_PLAYER && crit_chance > 0 && !victim->IsStandState()) { - TC_LOG_DEBUG(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: CRIT (sitting victim)"); + TC_LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: CRIT (sitting victim)"); return MELEE_HIT_CRIT; } @@ -2031,7 +2035,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT // only players can't dodge if attacker is behind if (victim->GetTypeId() == TYPEID_PLAYER && !victim->HasInArc(M_PI, this) && !victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION)) { - TC_LOG_DEBUG(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: attack came from behind and victim was a player."); + TC_LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: attack came from behind and victim was a player."); } else { @@ -2050,7 +2054,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT && ((tmp -= skillBonus) > 0) && roll < (sum += tmp)) { - TC_LOG_DEBUG(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: DODGE <%d, %d)", sum-tmp, sum); + TC_LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: DODGE <%d, %d)", sum-tmp, sum); return MELEE_HIT_DODGE; } } @@ -2059,7 +2063,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT // check if attack comes from behind, nobody can parry or block if attacker is behind if (!victim->HasInArc(M_PI, this) && !victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION)) - TC_LOG_DEBUG(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: attack came from behind."); + TC_LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: attack came from behind."); else { // Reduce parry chance by attacker expertise rating @@ -2075,7 +2079,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT && (tmp2 -= skillBonus) > 0 && roll < (sum += tmp2)) { - TC_LOG_DEBUG(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: PARRY <%d, %d)", sum-tmp2, sum); + TC_LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: PARRY <%d, %d)", sum-tmp2, sum); return MELEE_HIT_PARRY; } } @@ -2087,7 +2091,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT && (tmp -= skillBonus) > 0 && roll < (sum += tmp)) { - TC_LOG_DEBUG(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: BLOCK <%d, %d)", sum-tmp, sum); + TC_LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: BLOCK <%d, %d)", sum-tmp, sum); return MELEE_HIT_BLOCK; } } @@ -2098,9 +2102,9 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT if (tmp > 0 && roll < (sum += tmp)) { - TC_LOG_DEBUG(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: CRIT <%d, %d)", sum-tmp, sum); + TC_LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: CRIT <%d, %d)", sum-tmp, sum); if (GetTypeId() == TYPEID_UNIT && (ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRIT)) - TC_LOG_DEBUG(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: CRIT DISABLED)"); + TC_LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: CRIT DISABLED)"); else return MELEE_HIT_CRIT; } @@ -2120,7 +2124,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT tmp = tmp > 4000 ? 4000 : tmp; if (roll < (sum += tmp)) { - TC_LOG_DEBUG(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: GLANCING <%d, %d)", sum-4000, sum); + TC_LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: GLANCING <%d, %d)", sum-4000, sum); return MELEE_HIT_GLANCING; } } @@ -2144,13 +2148,13 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT tmp = tmp * 200 - 1500; if (roll < (sum += tmp)) { - TC_LOG_DEBUG(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: CRUSHING <%d, %d)", sum-tmp, sum); + TC_LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: CRUSHING <%d, %d)", sum-tmp, sum); return MELEE_HIT_CRUSHING; } } } - TC_LOG_DEBUG(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: NORMAL"); + TC_LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: NORMAL"); return MELEE_HIT_NORMAL; } @@ -2215,7 +2219,7 @@ void Unit::SendMeleeAttackStart(Unit* victim) data << uint64(GetGUID()); data << uint64(victim->GetGUID()); SendMessageToSet(&data, true); - TC_LOG_DEBUG(LOG_FILTER_UNITS, "WORLD: Sent SMSG_ATTACKSTART"); + TC_LOG_DEBUG("entities.unit", "WORLD: Sent SMSG_ATTACKSTART"); } void Unit::SendMeleeAttackStop(Unit* victim) @@ -2225,12 +2229,12 @@ void Unit::SendMeleeAttackStop(Unit* victim) data.append(victim ? victim->GetPackGUID() : 0); data << uint32(0); //! Can also take the value 0x01, which seems related to updating rotation SendMessageToSet(&data, true); - TC_LOG_DEBUG(LOG_FILTER_UNITS, "WORLD: Sent SMSG_ATTACKSTOP"); + TC_LOG_DEBUG("entities.unit", "WORLD: Sent SMSG_ATTACKSTOP"); if (victim) - TC_LOG_INFO(LOG_FILTER_UNITS, "%s %u stopped attacking %s %u", (GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), GetGUIDLow(), (victim->GetTypeId() == TYPEID_PLAYER ? "player" : "creature"), victim->GetGUIDLow()); + TC_LOG_INFO("entities.unit", "%s %u stopped attacking %s %u", (GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), GetGUIDLow(), (victim->GetTypeId() == TYPEID_PLAYER ? "player" : "creature"), victim->GetGUIDLow()); else - TC_LOG_INFO(LOG_FILTER_UNITS, "%s %u stopped attacking", (GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), GetGUIDLow()); + TC_LOG_INFO("entities.unit", "%s %u stopped attacking", (GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), GetGUIDLow()); } bool Unit::isSpellBlocked(Unit* victim, SpellInfo const* spellProto, WeaponAttackType attackType) @@ -2426,7 +2430,7 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spellInfo canParry = false; break; default: - TC_LOG_DEBUG(LOG_FILTER_UNITS, "Spell %u SPELL_AURA_IGNORE_COMBAT_RESULT has unhandled state %d", (*i)->GetId(), (*i)->GetMiscValue()); + TC_LOG_DEBUG("entities.unit", "Spell %u SPELL_AURA_IGNORE_COMBAT_RESULT has unhandled state %d", (*i)->GetId(), (*i)->GetMiscValue()); break; } } @@ -3038,7 +3042,7 @@ void Unit::SetCurrentCastedSpell(Spell* pSpell) void Unit::InterruptSpell(CurrentSpellTypes spellType, bool withDelayed, bool withInstant) { - //TC_LOG_DEBUG(LOG_FILTER_UNITS, "Interrupt spell for unit %u.", GetEntry()); + //TC_LOG_DEBUG("entities.unit", "Interrupt spell for unit %u.", GetEntry()); Spell* spell = m_currentSpells[spellType]; if (spell && (withDelayed || spell->getState() != SPELL_STATE_DELAYED) @@ -3404,7 +3408,7 @@ void Unit::_UnapplyAura(AuraApplicationMap::iterator &i, AuraRemoveMode removeMo aurApp->SetRemoveMode(removeMode); Aura* aura = aurApp->GetBase(); - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Aura %u now is remove mode %d", aura->GetId(), removeMode); + TC_LOG_DEBUG("spells", "Aura %u now is remove mode %d", aura->GetId(), removeMode); // dead loop is killing the server probably ASSERT(m_removedAurasCount < 0xFFFFFFFF); @@ -4132,7 +4136,7 @@ void Unit::DelayOwnedAuras(uint32 spellId, uint64 caster, int32 delaytime) // update for out of range group members (on 1 slot use) aura->SetNeedClientUpdateForTargets(); - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Aura %u partially interrupted on unit %u, new duration: %u ms", aura->GetId(), GetGUIDLow(), aura->GetDuration()); + TC_LOG_DEBUG("spells", "Aura %u partially interrupted on unit %u, new duration: %u ms", aura->GetId(), GetGUIDLow(), aura->GetDuration()); } } } @@ -5005,7 +5009,7 @@ void Unit::SendPeriodicAuraLog(SpellPeriodicAuraLogInfo* pInfo) data << float(pInfo->multiplier); // gain multiplier break; default: - TC_LOG_ERROR(LOG_FILTER_UNITS, "Unit::SendPeriodicAuraLog: unknown aura %u", uint32(aura->GetAuraType())); + TC_LOG_ERROR("entities.unit", "Unit::SendPeriodicAuraLog: unknown aura %u", uint32(aura->GetAuraType())); return; } @@ -5048,7 +5052,7 @@ void Unit::SendSpellDamageImmune(Unit* target, uint32 spellId) void Unit::SendAttackStateUpdate(CalcDamageInfo* damageInfo) { - TC_LOG_DEBUG(LOG_FILTER_UNITS, "WORLD: Sending SMSG_ATTACKERSTATEUPDATE"); + TC_LOG_DEBUG("entities.unit", "WORLD: Sending SMSG_ATTACKERSTATEUPDATE"); uint32 count = 1; size_t maxsize = 4+5+5+4+4+1+4+4+4+4+4+1+4+4+4+4+4*12; @@ -5554,7 +5558,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere case 31571: triggered_spell_id = 57529; break; case 31572: triggered_spell_id = 57531; break; default: - TC_LOG_ERROR(LOG_FILTER_UNITS, "Unit::HandleDummyAuraProc: non handled spell id: %u", dummySpell->Id); + TC_LOG_ERROR("entities.unit", "Unit::HandleDummyAuraProc: non handled spell id: %u", dummySpell->Id); return false; } break; @@ -5691,7 +5695,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere case 29834: triggered_spell_id=29841; break; case 42770: triggered_spell_id=42771; break; default: - TC_LOG_ERROR(LOG_FILTER_UNITS, "Unit::HandleDummyAuraProc: non handled spell id: %u (SW)", dummySpell->Id); + TC_LOG_ERROR("entities.unit", "Unit::HandleDummyAuraProc: non handled spell id: %u (SW)", dummySpell->Id); return false; } @@ -6779,7 +6783,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere case 3787:spellId = 58804; break; // 8 Rank default: { - TC_LOG_ERROR(LOG_FILTER_UNITS, "Unit::HandleDummyAuraProc: non handled item enchantment (rank?) %u for spell id: %u (Windfury)", + TC_LOG_ERROR("entities.unit", "Unit::HandleDummyAuraProc: non handled item enchantment (rank?) %u for spell id: %u (Windfury)", castItem->GetEnchantmentId(EnchantmentSlot(TEMP_ENCHANTMENT_SLOT)), dummySpell->Id); return false; } @@ -6788,7 +6792,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere SpellInfo const* windfurySpellInfo = sSpellMgr->GetSpellInfo(spellId); if (!windfurySpellInfo) { - TC_LOG_ERROR(LOG_FILTER_UNITS, "Unit::HandleDummyAuraProc: non-existing spell id: %u (Windfury)", spellId); + TC_LOG_ERROR("entities.unit", "Unit::HandleDummyAuraProc: non-existing spell id: %u (Windfury)", spellId); return false; } @@ -7104,7 +7108,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere case 49270: spellId = 49268; break; // Rank 7 case 49271: spellId = 49269; break; // Rank 8 default: - TC_LOG_ERROR(LOG_FILTER_UNITS, "Unit::HandleDummyAuraProc: non handled spell id: %u (LO)", procSpell->Id); + TC_LOG_ERROR("entities.unit", "Unit::HandleDummyAuraProc: non handled spell id: %u (LO)", procSpell->Id); return false; } @@ -7424,7 +7428,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere SpellInfo const* triggerEntry = sSpellMgr->GetSpellInfo(triggered_spell_id); if (!triggerEntry) { - TC_LOG_ERROR(LOG_FILTER_UNITS, "Unit::HandleDummyAuraProc: Spell %u has non-existing triggered spell %u", dummySpell->Id, triggered_spell_id); + TC_LOG_ERROR("entities.unit", "Unit::HandleDummyAuraProc: Spell %u has non-existing triggered spell %u", dummySpell->Id, triggered_spell_id); return false; } @@ -7812,7 +7816,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg trigger_spell_id = 31643; break; default: - TC_LOG_ERROR(LOG_FILTER_UNITS, "Unit::HandleProcTriggerSpell: Spell %u miss posibly Blazing Speed", auraSpellInfo->Id); + TC_LOG_ERROR("entities.unit", "Unit::HandleProcTriggerSpell: Spell %u miss posibly Blazing Speed", auraSpellInfo->Id); return false; } } @@ -7871,7 +7875,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg case 27815: trigger_spell_id = 27817; break; case 27816: trigger_spell_id = 27818; break; default: - TC_LOG_ERROR(LOG_FILTER_UNITS, "Unit::HandleProcTriggerSpell: Spell %u not handled in BR", auraSpellInfo->Id); + TC_LOG_ERROR("entities.unit", "Unit::HandleProcTriggerSpell: Spell %u not handled in BR", auraSpellInfo->Id); return false; } basepoints0 = CalculatePct(int32(damage), triggerAmount) / 3; @@ -7931,7 +7935,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg trigger_spell_id = 63468; break; default: - TC_LOG_ERROR(LOG_FILTER_UNITS, "Unit::HandleProcTriggerSpell: Spell %u miss posibly Piercing Shots", auraSpellInfo->Id); + TC_LOG_ERROR("entities.unit", "Unit::HandleProcTriggerSpell: Spell %u miss posibly Piercing Shots", auraSpellInfo->Id); return false; } SpellInfo const* TriggerPS = sSpellMgr->GetSpellInfo(trigger_spell_id); @@ -8037,14 +8041,14 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg case 48820: originalSpellId = 48824; break; case 48821: originalSpellId = 48825; break; default: - TC_LOG_ERROR(LOG_FILTER_UNITS, "Unit::HandleProcTriggerSpell: Spell %u not handled in HShock", procSpell->Id); + TC_LOG_ERROR("entities.unit", "Unit::HandleProcTriggerSpell: Spell %u not handled in HShock", procSpell->Id); return false; } } SpellInfo const* originalSpell = sSpellMgr->GetSpellInfo(originalSpellId); if (!originalSpell) { - TC_LOG_ERROR(LOG_FILTER_UNITS, "Unit::HandleProcTriggerSpell: Spell %u unknown but selected as original in Illu", originalSpellId); + TC_LOG_ERROR("entities.unit", "Unit::HandleProcTriggerSpell: Spell %u unknown but selected as original in Illu", originalSpellId); return false; } // percent stored in effect 1 (class scripts) base points @@ -8169,7 +8173,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg if (triggerEntry == NULL) { // Don't cast unknown spell - // TC_LOG_ERROR(LOG_FILTER_UNITS, "Unit::HandleProcTriggerSpell: Spell %u has 0 in EffectTriggered[%d]. Unhandled custom case?", auraSpellInfo->Id, triggeredByAura->GetEffIndex()); + // TC_LOG_ERROR("entities.unit", "Unit::HandleProcTriggerSpell: Spell %u has 0 in EffectTriggered[%d]. Unhandled custom case?", auraSpellInfo->Id, triggeredByAura->GetEffIndex()); return false; } @@ -8646,7 +8650,7 @@ bool Unit::HandleOverrideClassScriptAuraProc(Unit* victim, uint32 /*damage*/, Au if (!triggerEntry) { - TC_LOG_ERROR(LOG_FILTER_UNITS, "Unit::HandleOverrideClassScriptAuraProc: Spell %u triggering for class script id %u", triggered_spell_id, scriptId); + TC_LOG_ERROR("entities.unit", "Unit::HandleOverrideClassScriptAuraProc: Spell %u triggering for class script id %u", triggered_spell_id, scriptId); return false; } @@ -8713,11 +8717,11 @@ FactionTemplateEntry const* Unit::GetFactionTemplateEntry() const if (GetGUID() != guid) { if (Player const* player = ToPlayer()) - TC_LOG_ERROR(LOG_FILTER_UNITS, "Player %s has invalid faction (faction template id) #%u", player->GetName().c_str(), getFaction()); + TC_LOG_ERROR("entities.unit", "Player %s has invalid faction (faction template id) #%u", player->GetName().c_str(), getFaction()); else if (Creature const* creature = ToCreature()) - TC_LOG_ERROR(LOG_FILTER_UNITS, "Creature (template id: %u) has invalid faction (faction template id) #%u", creature->GetCreatureTemplate()->Entry, getFaction()); + TC_LOG_ERROR("entities.unit", "Creature (template id: %u) has invalid faction (faction template id) #%u", creature->GetCreatureTemplate()->Entry, getFaction()); else - TC_LOG_ERROR(LOG_FILTER_UNITS, "Unit (name=%s, type=%u) has invalid faction (faction template id) #%u", GetName().c_str(), uint32(GetTypeId()), getFaction()); + TC_LOG_ERROR("entities.unit", "Unit (name=%s, type=%u) has invalid faction (faction template id) #%u", GetName().c_str(), uint32(GetTypeId()), getFaction()); guid = GetGUID(); } @@ -9089,7 +9093,7 @@ void Unit::RemoveAllAttackers() AttackerSet::iterator iter = m_attackers.begin(); if (!(*iter)->AttackStop()) { - TC_LOG_ERROR(LOG_FILTER_UNITS, "WORLD: Unit has an attacker that isn't attacking it!"); + TC_LOG_ERROR("entities.unit", "WORLD: Unit has an attacker that isn't attacking it!"); m_attackers.erase(iter); } } @@ -9259,7 +9263,7 @@ Minion *Unit::GetFirstMinion() const if (pet->HasUnitTypeMask(UNIT_MASK_MINION)) return (Minion*)pet; - TC_LOG_ERROR(LOG_FILTER_UNITS, "Unit::GetFirstMinion: Minion %u not exist.", GUID_LOPART(pet_guid)); + TC_LOG_ERROR("entities.unit", "Unit::GetFirstMinion: Minion %u not exist.", GUID_LOPART(pet_guid)); const_cast<Unit*>(this)->SetMinionGUID(0); } @@ -9274,7 +9278,7 @@ Guardian* Unit::GetGuardianPet() const if (pet->HasUnitTypeMask(UNIT_MASK_GUARDIAN)) return (Guardian*)pet; - TC_LOG_FATAL(LOG_FILTER_UNITS, "Unit::GetGuardianPet: Guardian " UI64FMTD " not exist.", pet_guid); + TC_LOG_FATAL("entities.unit", "Unit::GetGuardianPet: Guardian " UI64FMTD " not exist.", pet_guid); const_cast<Unit*>(this)->SetPetGUID(0); } @@ -9288,7 +9292,7 @@ Unit* Unit::GetCharm() const if (Unit* pet = ObjectAccessor::GetUnit(*this, charm_guid)) return pet; - TC_LOG_ERROR(LOG_FILTER_UNITS, "Unit::GetCharm: Charmed creature %u not exist.", GUID_LOPART(charm_guid)); + TC_LOG_ERROR("entities.unit", "Unit::GetCharm: Charmed creature %u not exist.", GUID_LOPART(charm_guid)); const_cast<Unit*>(this)->SetUInt64Value(UNIT_FIELD_CHARM, 0); } @@ -9310,13 +9314,13 @@ Unit* Unit::GetCharmerOrOwnerOrSelf() const void Unit::SetMinion(Minion *minion, bool apply) { - TC_LOG_DEBUG(LOG_FILTER_UNITS, "SetMinion %u for %u, apply %u", minion->GetEntry(), GetEntry(), apply); + TC_LOG_DEBUG("entities.unit", "SetMinion %u for %u, apply %u", minion->GetEntry(), GetEntry(), apply); if (apply) { if (minion->GetOwnerGUID()) { - TC_LOG_FATAL(LOG_FILTER_UNITS, "SetMinion: Minion %u is not the minion of owner %u", minion->GetEntry(), GetEntry()); + TC_LOG_FATAL("entities.unit", "SetMinion: Minion %u is not the minion of owner %u", minion->GetEntry(), GetEntry()); return; } @@ -9390,7 +9394,7 @@ void Unit::SetMinion(Minion *minion, bool apply) { if (minion->GetOwnerGUID() != GetGUID()) { - TC_LOG_FATAL(LOG_FILTER_UNITS, "SetMinion: Minion %u is not the minion of owner %u", minion->GetEntry(), GetEntry()); + TC_LOG_FATAL("entities.unit", "SetMinion: Minion %u is not the minion of owner %u", minion->GetEntry(), GetEntry()); return; } @@ -9502,7 +9506,7 @@ void Unit::SetCharm(Unit* charm, bool apply) if (GetTypeId() == TYPEID_PLAYER) { if (!AddUInt64Value(UNIT_FIELD_CHARM, charm->GetGUID())) - TC_LOG_FATAL(LOG_FILTER_UNITS, "Player %s is trying to charm unit %u, but it already has a charmed unit " UI64FMTD "", GetName().c_str(), charm->GetEntry(), GetCharmGUID()); + TC_LOG_FATAL("entities.unit", "Player %s is trying to charm unit %u, but it already has a charmed unit " UI64FMTD "", GetName().c_str(), charm->GetEntry(), GetCharmGUID()); charm->m_ControlledByPlayer = true; /// @todo maybe we can use this flag to check if controlled by player @@ -9515,7 +9519,7 @@ void Unit::SetCharm(Unit* charm, bool apply) charm->SetByteValue(UNIT_FIELD_BYTES_2, 1, GetByteValue(UNIT_FIELD_BYTES_2, 1)); if (!charm->AddUInt64Value(UNIT_FIELD_CHARMEDBY, GetGUID())) - TC_LOG_FATAL(LOG_FILTER_UNITS, "Unit %u is being charmed, but it already has a charmer " UI64FMTD "", charm->GetEntry(), charm->GetCharmerGUID()); + TC_LOG_FATAL("entities.unit", "Unit %u is being charmed, but it already has a charmer " UI64FMTD "", charm->GetEntry(), charm->GetCharmerGUID()); _isWalkingBeforeCharm = charm->IsWalking(); if (_isWalkingBeforeCharm) @@ -9531,11 +9535,11 @@ void Unit::SetCharm(Unit* charm, bool apply) if (GetTypeId() == TYPEID_PLAYER) { if (!RemoveUInt64Value(UNIT_FIELD_CHARM, charm->GetGUID())) - TC_LOG_FATAL(LOG_FILTER_UNITS, "Player %s is trying to uncharm unit %u, but it has another charmed unit " UI64FMTD "", GetName().c_str(), charm->GetEntry(), GetCharmGUID()); + TC_LOG_FATAL("entities.unit", "Player %s is trying to uncharm unit %u, but it has another charmed unit " UI64FMTD "", GetName().c_str(), charm->GetEntry(), GetCharmGUID()); } if (!charm->RemoveUInt64Value(UNIT_FIELD_CHARMEDBY, GetGUID())) - TC_LOG_FATAL(LOG_FILTER_UNITS, "Unit %u is being uncharmed, but it has another charmer " UI64FMTD "", charm->GetEntry(), charm->GetCharmerGUID()); + TC_LOG_FATAL("entities.unit", "Unit %u is being uncharmed, but it has another charmer " UI64FMTD "", charm->GetEntry(), charm->GetCharmerGUID()); if (charm->GetTypeId() == TYPEID_PLAYER) { @@ -9679,14 +9683,14 @@ void Unit::RemoveAllControlled() else if (target->GetOwnerGUID() == GetGUID() && target->IsSummon()) target->ToTempSummon()->UnSummon(); else - TC_LOG_ERROR(LOG_FILTER_UNITS, "Unit %u is trying to release unit %u which is neither charmed nor owned by it", GetEntry(), target->GetEntry()); + TC_LOG_ERROR("entities.unit", "Unit %u is trying to release unit %u which is neither charmed nor owned by it", GetEntry(), target->GetEntry()); } if (GetPetGUID()) - TC_LOG_FATAL(LOG_FILTER_UNITS, "Unit %u is not able to release its pet " UI64FMTD, GetEntry(), GetPetGUID()); + TC_LOG_FATAL("entities.unit", "Unit %u is not able to release its pet " UI64FMTD, GetEntry(), GetPetGUID()); if (GetMinionGUID()) - TC_LOG_FATAL(LOG_FILTER_UNITS, "Unit %u is not able to release its minion " UI64FMTD, GetEntry(), GetMinionGUID()); + TC_LOG_FATAL("entities.unit", "Unit %u is not able to release its minion " UI64FMTD, GetEntry(), GetMinionGUID()); if (GetCharmGUID()) - TC_LOG_FATAL(LOG_FILTER_UNITS, "Unit %u is not able to release its charm " UI64FMTD, GetEntry(), GetCharmGUID()); + TC_LOG_FATAL("entities.unit", "Unit %u is not able to release its charm " UI64FMTD, GetEntry(), GetCharmGUID()); } bool Unit::isPossessedByPlayer() const @@ -12200,7 +12204,7 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced) break; } default: - TC_LOG_ERROR(LOG_FILTER_UNITS, "Unit::UpdateSpeed: Unsupported move type (%d)", mtype); + TC_LOG_ERROR("entities.unit", "Unit::UpdateSpeed: Unsupported move type (%d)", mtype); return; } @@ -12325,7 +12329,7 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced) data.Initialize(MSG_MOVE_SET_PITCH_RATE, 8+4+2+4+4+4+4+4+4+4); break; default: - TC_LOG_ERROR(LOG_FILTER_UNITS, "Unit::SetSpeed: Unsupported move type (%d), data not sent to client.", mtype); + TC_LOG_ERROR("entities.unit", "Unit::SetSpeed: Unsupported move type (%d), data not sent to client.", mtype); return; } @@ -12376,7 +12380,7 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced) data.Initialize(SMSG_FORCE_PITCH_RATE_CHANGE, 16); break; default: - TC_LOG_ERROR(LOG_FILTER_UNITS, "Unit::SetSpeed: Unsupported move type (%d), data not sent to client.", mtype); + TC_LOG_ERROR("entities.unit", "Unit::SetSpeed: Unsupported move type (%d), data not sent to client.", mtype); return; } data.append(GetPackGUID()); @@ -12390,6 +12394,9 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced) void Unit::setDeathState(DeathState s) { + // Death state needs to be updated before RemoveAllAurasOnDeath() is called, to prevent entering combat + m_deathState = s; + if (s != ALIVE && s != JUST_RESPAWNED) { CombatStop(); @@ -12438,8 +12445,6 @@ void Unit::setDeathState(DeathState s) } else if (s == JUST_RESPAWNED) RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); // clear skinnable for creature and player (at battleground) - - m_deathState = s; } /*######################################## @@ -12447,14 +12452,14 @@ void Unit::setDeathState(DeathState s) ######## AGGRO SYSTEM ######## ######## ######## ########################################*/ -bool Unit::CanHaveThreatList() const +bool Unit::CanHaveThreatList(bool skipAliveCheck) const { // only creatures can have threat list if (GetTypeId() != TYPEID_UNIT) return false; // only alive units can have threat list - if (!IsAlive() || isDying()) + if (!skipAliveCheck && !IsAlive()) return false; // totems can not have threat list @@ -12497,7 +12502,7 @@ void Unit::AddThreat(Unit* victim, float fThreat, SpellSchoolMask schoolMask, Sp void Unit::DeleteThreatList() { - if (CanHaveThreatList() && !m_ThreatManager.isThreatListEmpty()) + if (CanHaveThreatList(true) && !m_ThreatManager.isThreatListEmpty()) SendClearThreatListOpcode(); m_ThreatManager.clearReferences(); } @@ -13069,7 +13074,7 @@ bool Unit::HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, f { if (unitMod >= UNIT_MOD_END || modifierType >= MODIFIER_TYPE_END) { - TC_LOG_ERROR(LOG_FILTER_UNITS, "ERROR in HandleStatModifier(): non-existing UnitMods or wrong UnitModifierType!"); + TC_LOG_ERROR("entities.unit", "ERROR in HandleStatModifier(): non-existing UnitMods or wrong UnitModifierType!"); return false; } @@ -13134,7 +13139,7 @@ float Unit::GetModifierValue(UnitMods unitMod, UnitModifierType modifierType) co { if (unitMod >= UNIT_MOD_END || modifierType >= MODIFIER_TYPE_END) { - TC_LOG_ERROR(LOG_FILTER_UNITS, "attempt to access non-existing modifier value from UnitMods!"); + TC_LOG_ERROR("entities.unit", "attempt to access non-existing modifier value from UnitMods!"); return 0.0f; } @@ -13164,7 +13169,7 @@ float Unit::GetTotalAuraModValue(UnitMods unitMod) const { if (unitMod >= UNIT_MOD_END) { - TC_LOG_ERROR(LOG_FILTER_UNITS, "attempt to access non-existing UnitMods in GetTotalAuraModValue()!"); + TC_LOG_ERROR("entities.unit", "attempt to access non-existing UnitMods in GetTotalAuraModValue()!"); return 0.0f; } @@ -13454,7 +13459,7 @@ void Unit::RemoveFromWorld() if (GetCharmerGUID()) { - TC_LOG_FATAL(LOG_FILTER_UNITS, "Unit %u has charmer guid when removed from world", GetEntry()); + TC_LOG_FATAL("entities.unit", "Unit %u has charmer guid when removed from world", GetEntry()); ASSERT(false); } @@ -13462,7 +13467,7 @@ void Unit::RemoveFromWorld() { if (owner->m_Controlled.find(this) != owner->m_Controlled.end()) { - TC_LOG_FATAL(LOG_FILTER_UNITS, "Unit %u is in controlled list of %u when removed from world", GetEntry(), owner->GetEntry()); + TC_LOG_FATAL("entities.unit", "Unit %u is in controlled list of %u when removed from world", GetEntry(), owner->GetEntry()); ASSERT(false); } } @@ -13556,8 +13561,8 @@ void Unit::DeleteCharmInfo() } CharmInfo::CharmInfo(Unit* unit) -: _unit(unit), _CommandState(COMMAND_FOLLOW), _petnumber(0), _barInit(false), - _isCommandAttack(false), _isAtStay(false), _isFollowing(false), _isReturning(false), +: _unit(unit), _CommandState(COMMAND_FOLLOW), _petnumber(0), _barInit(false), _oldReactState(REACT_PASSIVE), + _isCommandAttack(false), _isCommandFollow(false), _isAtStay(false), _isFollowing(false), _isReturning(false), _stayX(0.0f), _stayY(0.0f), _stayZ(0.0f) { for (uint8 i = 0; i < MAX_SPELL_CHARM; ++i) @@ -13606,9 +13611,22 @@ void CharmInfo::InitEmptyActionBar(bool withAttack) void CharmInfo::InitPossessCreateSpells() { - InitEmptyActionBar(); if (_unit->GetTypeId() == TYPEID_UNIT) { + // Adding switch until better way is found. Malcrom + // Adding entrys to this switch will prevent COMMAND_ATTACK being added to pet bar. + switch (_unit->GetEntry()) + { + case 23575: // Mindless Abomination + case 24783: // Trained Rock Falcon + case 27664: // Crashin' Thrashin' Racer + case 40281: // Crashin' Thrashin' Racer + break; + default: + InitEmptyActionBar(); + break; + } + for (uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i) { uint32 spellId = _unit->ToCreature()->m_spells[i]; @@ -13622,6 +13640,8 @@ void CharmInfo::InitPossessCreateSpells() } } } + else + InitEmptyActionBar(); } void CharmInfo::InitCharmCreateSpells() @@ -14091,7 +14111,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u // "handled" is needed as long as proc can be handled in multiple places if (!handled && HandleAuraProc(target, damage, i->aura, procSpell, procFlag, procExtra, cooldown, &handled)) { - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "ProcDamageAndSpell: casting spell %u (triggered with value by %s aura of spell %u)", spellInfo->Id, (isVictim?"a victim's":"an attacker's"), Id); + TC_LOG_DEBUG("spells", "ProcDamageAndSpell: casting spell %u (triggered with value by %s aura of spell %u)", spellInfo->Id, (isVictim?"a victim's":"an attacker's"), Id); takeCharges = true; } @@ -14116,7 +14136,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u { case SPELL_AURA_PROC_TRIGGER_SPELL: { - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "ProcDamageAndSpell: casting spell %u (triggered by %s aura of spell %u)", spellInfo->Id, (isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId()); + TC_LOG_DEBUG("spells", "ProcDamageAndSpell: casting spell %u (triggered by %s aura of spell %u)", spellInfo->Id, (isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId()); // Don`t drop charge or add cooldown for not started trigger if (HandleProcTriggerSpell(target, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown)) takeCharges = true; @@ -14135,7 +14155,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u case SPELL_AURA_MANA_SHIELD: case SPELL_AURA_DUMMY: { - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "ProcDamageAndSpell: casting spell id %u (triggered by %s dummy aura of spell %u)", spellInfo->Id, (isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId()); + TC_LOG_DEBUG("spells", "ProcDamageAndSpell: casting spell id %u (triggered by %s dummy aura of spell %u)", spellInfo->Id, (isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId()); if (HandleDummyAuraProc(target, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown)) takeCharges = true; break; @@ -14144,19 +14164,19 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u case SPELL_AURA_MOD_SPELL_CRIT_CHANCE: case SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN: case SPELL_AURA_MOD_MELEE_HASTE: - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "ProcDamageAndSpell: casting spell id %u (triggered by %s aura of spell %u)", spellInfo->Id, isVictim ? "a victim's" : "an attacker's", triggeredByAura->GetId()); + TC_LOG_DEBUG("spells", "ProcDamageAndSpell: casting spell id %u (triggered by %s aura of spell %u)", spellInfo->Id, isVictim ? "a victim's" : "an attacker's", triggeredByAura->GetId()); takeCharges = true; break; case SPELL_AURA_OVERRIDE_CLASS_SCRIPTS: { - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "ProcDamageAndSpell: casting spell id %u (triggered by %s aura of spell %u)", spellInfo->Id, (isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId()); + TC_LOG_DEBUG("spells", "ProcDamageAndSpell: casting spell id %u (triggered by %s aura of spell %u)", spellInfo->Id, (isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId()); if (HandleOverrideClassScriptAuraProc(target, damage, triggeredByAura, procSpell, cooldown)) takeCharges = true; break; } case SPELL_AURA_RAID_PROC_FROM_CHARGE_WITH_VALUE: { - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "ProcDamageAndSpell: casting mending (triggered by %s dummy aura of spell %u)", + TC_LOG_DEBUG("spells", "ProcDamageAndSpell: casting mending (triggered by %s dummy aura of spell %u)", (isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId()); HandleAuraRaidProcFromChargeWithValue(triggeredByAura); @@ -14165,7 +14185,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u } case SPELL_AURA_RAID_PROC_FROM_CHARGE: { - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "ProcDamageAndSpell: casting mending (triggered by %s dummy aura of spell %u)", + TC_LOG_DEBUG("spells", "ProcDamageAndSpell: casting mending (triggered by %s dummy aura of spell %u)", (isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId()); HandleAuraRaidProcFromCharge(triggeredByAura); @@ -14174,7 +14194,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u } case SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE: { - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "ProcDamageAndSpell: casting spell %u (triggered with value by %s aura of spell %u)", spellInfo->Id, (isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId()); + TC_LOG_DEBUG("spells", "ProcDamageAndSpell: casting spell %u (triggered with value by %s aura of spell %u)", spellInfo->Id, (isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId()); if (HandleProcTriggerSpell(target, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown)) takeCharges = true; @@ -14413,14 +14433,14 @@ void Unit::StopMoving() { ClearUnitState(UNIT_STATE_MOVING); - // not need send any packets if not in world - if (!IsInWorld()) + // not need send any packets if not in world or not moving + if (!IsInWorld() || movespline->Finalized()) return; + // Update position now since Stop does not start a new movement that can be updated later + UpdateSplinePosition(); Movement::MoveSplineInit init(this); - init.MoveTo(GetPositionX(), GetPositionY(), GetPositionZMinusOffset(), false); - init.SetFacing(GetOrientation()); - init.Launch(); + init.Stop(); } void Unit::SendMovementFlagUpdate(bool self /* = false */) @@ -14906,7 +14926,7 @@ bool Unit::InitTamedPet(Pet* pet, uint8 level, uint32 spell_id) if (!pet->InitStatsForLevel(level)) { - TC_LOG_ERROR(LOG_FILTER_UNITS, "Pet::InitStatsForLevel() failed for creature (Entry: %u)!", pet->GetEntry()); + TC_LOG_ERROR("entities.unit", "Pet::InitStatsForLevel() failed for creature (Entry: %u)!", pet->GetEntry()); return false; } @@ -15034,7 +15054,7 @@ bool Unit::HandleAuraRaidProcFromChargeWithValue(AuraEffect* triggeredByAura) // Currently only Prayer of Mending if (!(spellProto->SpellFamilyName == SPELLFAMILY_PRIEST && spellProto->SpellFamilyFlags[1] & 0x20)) { - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Unit::HandleAuraRaidProcFromChargeWithValue, received not handled spell: %u", spellProto->Id); + TC_LOG_DEBUG("spells", "Unit::HandleAuraRaidProcFromChargeWithValue, received not handled spell: %u", spellProto->Id); return false; } @@ -15084,7 +15104,7 @@ bool Unit::HandleAuraRaidProcFromCharge(AuraEffect* triggeredByAura) damageSpellId = 43594; break; default: - TC_LOG_ERROR(LOG_FILTER_UNITS, "Unit::HandleAuraRaidProcFromCharge, received unhandled spell: %u", spellProto->Id); + TC_LOG_ERROR("entities.unit", "Unit::HandleAuraRaidProcFromCharge, received unhandled spell: %u", spellProto->Id); return false; } @@ -15246,7 +15266,7 @@ void Unit::Kill(Unit* victim, bool durabilityLoss) if (!spiritOfRedemption) { - TC_LOG_DEBUG(LOG_FILTER_UNITS, "SET JUST_DIED"); + TC_LOG_DEBUG("entities.unit", "SET JUST_DIED"); victim->setDeathState(JUST_DIED); } @@ -15271,7 +15291,7 @@ void Unit::Kill(Unit* victim, bool durabilityLoss) // only if not player and not controlled by player pet. And not at BG if ((durabilityLoss && !player && !victim->ToPlayer()->InBattleground()) || (player && sWorld->getBoolConfig(CONFIG_DURABILITY_LOSS_IN_PVP))) { - TC_LOG_DEBUG(LOG_FILTER_UNITS, "We are dead, losing %f percent durability", sWorld->getRate(RATE_DURABILITY_LOSS_ON_DEATH)); + TC_LOG_DEBUG("entities.unit", "We are dead, losing %f percent durability", sWorld->getRate(RATE_DURABILITY_LOSS_ON_DEATH)); plrVictim->DurabilityLossAll(sWorld->getRate(RATE_DURABILITY_LOSS_ON_DEATH), false); // durability lost message WorldPacket data(SMSG_DURABILITY_DAMAGE_DEATH, 0); @@ -15291,7 +15311,7 @@ void Unit::Kill(Unit* victim, bool durabilityLoss) } else // creature died { - TC_LOG_DEBUG(LOG_FILTER_UNITS, "DealDamageNotPlayer"); + TC_LOG_DEBUG("entities.unit", "DealDamageNotPlayer"); if (!creature->IsPet()) { @@ -15656,11 +15676,11 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au ASSERT(type != CHARM_TYPE_POSSESS || charmer->GetTypeId() == TYPEID_PLAYER); ASSERT((type == CHARM_TYPE_VEHICLE) == IsVehicle()); - TC_LOG_DEBUG(LOG_FILTER_UNITS, "SetCharmedBy: charmer %u (GUID %u), charmed %u (GUID %u), type %u.", charmer->GetEntry(), charmer->GetGUIDLow(), GetEntry(), GetGUIDLow(), uint32(type)); + TC_LOG_DEBUG("entities.unit", "SetCharmedBy: charmer %u (GUID %u), charmed %u (GUID %u), type %u.", charmer->GetEntry(), charmer->GetGUIDLow(), GetEntry(), GetGUIDLow(), uint32(type)); if (this == charmer) { - TC_LOG_FATAL(LOG_FILTER_UNITS, "Unit::SetCharmedBy: Unit %u (GUID %u) is trying to charm itself!", GetEntry(), GetGUIDLow()); + TC_LOG_FATAL("entities.unit", "Unit::SetCharmedBy: Unit %u (GUID %u) is trying to charm itself!", GetEntry(), GetGUIDLow()); return false; } @@ -15669,14 +15689,14 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au if (GetTypeId() == TYPEID_PLAYER && ToPlayer()->GetTransport()) { - TC_LOG_FATAL(LOG_FILTER_UNITS, "Unit::SetCharmedBy: Player on transport is trying to charm %u (GUID %u)", GetEntry(), GetGUIDLow()); + TC_LOG_FATAL("entities.unit", "Unit::SetCharmedBy: Player on transport is trying to charm %u (GUID %u)", GetEntry(), GetGUIDLow()); return false; } // Already charmed if (GetCharmerGUID()) { - TC_LOG_FATAL(LOG_FILTER_UNITS, "Unit::SetCharmedBy: %u (GUID %u) has already been charmed but %u (GUID %u) is trying to charm it!", GetEntry(), GetGUIDLow(), charmer->GetEntry(), charmer->GetGUIDLow()); + TC_LOG_FATAL("entities.unit", "Unit::SetCharmedBy: %u (GUID %u) has already been charmed but %u (GUID %u) is trying to charm it!", GetEntry(), GetGUIDLow(), charmer->GetEntry(), charmer->GetGUIDLow()); return false; } @@ -15701,7 +15721,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au // StopCastingCharm may remove a possessed pet? if (!IsInWorld()) { - TC_LOG_FATAL(LOG_FILTER_UNITS, "Unit::SetCharmedBy: %u (GUID %u) is not in world but %u (GUID %u) is trying to charm it!", GetEntry(), GetGUIDLow(), charmer->GetEntry(), charmer->GetGUIDLow()); + TC_LOG_FATAL("entities.unit", "Unit::SetCharmedBy: %u (GUID %u) is not in world but %u (GUID %u) is trying to charm it!", GetEntry(), GetGUIDLow(), charmer->GetEntry(), charmer->GetGUIDLow()); return false; } @@ -15801,7 +15821,7 @@ void Unit::RemoveCharmedBy(Unit* charmer) charmer = GetCharmer(); if (charmer != GetCharmer()) // one aura overrides another? { -// TC_LOG_FATAL(LOG_FILTER_UNITS, "Unit::RemoveCharmedBy: this: " UI64FMTD " true charmer: " UI64FMTD " false charmer: " UI64FMTD, +// TC_LOG_FATAL("entities.unit", "Unit::RemoveCharmedBy: this: " UI64FMTD " true charmer: " UI64FMTD " false charmer: " UI64FMTD, // GetGUID(), GetCharmerGUID(), charmer->GetGUID()); // ASSERT(false); return; @@ -15881,11 +15901,10 @@ void Unit::RemoveCharmedBy(Unit* charmer) if (GetCharmInfo()) GetCharmInfo()->SetPetNumber(0, true); else - TC_LOG_ERROR(LOG_FILTER_UNITS, "Aura::HandleModCharm: target=" UI64FMTD " with typeid=%d has a charm aura but no charm info!", GetGUID(), GetTypeId()); + TC_LOG_ERROR("entities.unit", "Aura::HandleModCharm: target=" UI64FMTD " with typeid=%d has a charm aura but no charm info!", GetGUID(), GetTypeId()); } } break; - default: case CHARM_TYPE_CONVERT: break; } @@ -16724,7 +16743,7 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId) if (!valid) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u specified in npc_spellclick_spells is not a valid vehicle enter aura!", itr->second.spellId); + TC_LOG_ERROR("sql.sql", "Spell %u specified in npc_spellclick_spells is not a valid vehicle enter aura!", itr->second.spellId); continue; } @@ -16775,7 +16794,7 @@ void Unit::_EnterVehicle(Vehicle* vehicle, int8 seatId, AuraApplication const* a { if (m_vehicle != vehicle) { - TC_LOG_DEBUG(LOG_FILTER_VEHICLES, "EnterVehicle: %u exit %u and enter %u.", GetEntry(), m_vehicle->GetBase()->GetEntry(), vehicle->GetBase()->GetEntry()); + TC_LOG_DEBUG("entities.vehicle", "EnterVehicle: %u exit %u and enter %u.", GetEntry(), m_vehicle->GetBase()->GetEntry(), vehicle->GetBase()->GetEntry()); ExitVehicle(); } else if (seatId >= 0 && seatId == GetTransSeat()) @@ -17009,7 +17028,7 @@ bool Unit::UpdatePosition(float x, float y, float z, float orientation, bool tel // prevent crash when a bad coord is sent by the client if (!Trinity::IsValidMapCoord(x, y, z, orientation)) { - TC_LOG_DEBUG(LOG_FILTER_UNITS, "Unit::UpdatePosition(%f, %f, %f) .. bad coordinates!", x, y, z); + TC_LOG_DEBUG("entities.unit", "Unit::UpdatePosition(%f, %f, %f) .. bad coordinates!", x, y, z); return false; } @@ -17065,7 +17084,7 @@ void Unit::SendThreatListUpdate() { uint32 count = getThreatManager().getThreatList().size(); - //TC_LOG_DEBUG(LOG_FILTER_UNITS, "WORLD: Send SMSG_THREAT_UPDATE Message"); + //TC_LOG_DEBUG("entities.unit", "WORLD: Send SMSG_THREAT_UPDATE Message"); WorldPacket data(SMSG_THREAT_UPDATE, 8 + count * 8); data.append(GetPackGUID()); data << uint32(count); @@ -17085,7 +17104,7 @@ void Unit::SendChangeCurrentVictimOpcode(HostileReference* pHostileReference) { uint32 count = getThreatManager().getThreatList().size(); - TC_LOG_DEBUG(LOG_FILTER_UNITS, "WORLD: Send SMSG_HIGHEST_THREAT_UPDATE Message"); + TC_LOG_DEBUG("entities.unit", "WORLD: Send SMSG_HIGHEST_THREAT_UPDATE Message"); WorldPacket data(SMSG_HIGHEST_THREAT_UPDATE, 8 + 8 + count * 8); data.append(GetPackGUID()); data.appendPackGUID(pHostileReference->getUnitGuid()); @@ -17102,7 +17121,7 @@ void Unit::SendChangeCurrentVictimOpcode(HostileReference* pHostileReference) void Unit::SendClearThreatListOpcode() { - TC_LOG_DEBUG(LOG_FILTER_UNITS, "WORLD: Send SMSG_THREAT_CLEAR Message"); + TC_LOG_DEBUG("entities.unit", "WORLD: Send SMSG_THREAT_CLEAR Message"); WorldPacket data(SMSG_THREAT_CLEAR, 8); data.append(GetPackGUID()); SendMessageToSet(&data, false); @@ -17110,7 +17129,7 @@ void Unit::SendClearThreatListOpcode() void Unit::SendRemoveFromThreatListOpcode(HostileReference* pHostileReference) { - TC_LOG_DEBUG(LOG_FILTER_UNITS, "WORLD: Send SMSG_THREAT_REMOVE Message"); + TC_LOG_DEBUG("entities.unit", "WORLD: Send SMSG_THREAT_REMOVE Message"); WorldPacket data(SMSG_THREAT_REMOVE, 8 + 8); data.append(GetPackGUID()); data.appendPackGUID(pHostileReference->getUnitGuid()); @@ -17184,31 +17203,31 @@ void Unit::StopAttackFaction(uint32 faction_id) void Unit::OutDebugInfo() const { - TC_LOG_ERROR(LOG_FILTER_UNITS, "Unit::OutDebugInfo"); - TC_LOG_INFO(LOG_FILTER_UNITS, "GUID " UI64FMTD ", entry %u, type %u, name %s", GetGUID(), GetEntry(), (uint32)GetTypeId(), GetName().c_str()); - TC_LOG_INFO(LOG_FILTER_UNITS, "OwnerGUID " UI64FMTD ", MinionGUID " UI64FMTD ", CharmerGUID " UI64FMTD ", CharmedGUID "UI64FMTD, GetOwnerGUID(), GetMinionGUID(), GetCharmerGUID(), GetCharmGUID()); - TC_LOG_INFO(LOG_FILTER_UNITS, "In world %u, unit type mask %u", (uint32)(IsInWorld() ? 1 : 0), m_unitTypeMask); + TC_LOG_ERROR("entities.unit", "Unit::OutDebugInfo"); + TC_LOG_INFO("entities.unit", "GUID " UI64FMTD ", entry %u, type %u, name %s", GetGUID(), GetEntry(), (uint32)GetTypeId(), GetName().c_str()); + TC_LOG_INFO("entities.unit", "OwnerGUID " UI64FMTD ", MinionGUID " UI64FMTD ", CharmerGUID " UI64FMTD ", CharmedGUID "UI64FMTD, GetOwnerGUID(), GetMinionGUID(), GetCharmerGUID(), GetCharmGUID()); + TC_LOG_INFO("entities.unit", "In world %u, unit type mask %u", (uint32)(IsInWorld() ? 1 : 0), m_unitTypeMask); if (IsInWorld()) - TC_LOG_INFO(LOG_FILTER_UNITS, "Mapid %u", GetMapId()); + TC_LOG_INFO("entities.unit", "Mapid %u", GetMapId()); std::ostringstream o; o << "Summon Slot: "; for (uint32 i = 0; i < MAX_SUMMON_SLOT; ++i) o << m_SummonSlot[i] << ", "; - TC_LOG_INFO(LOG_FILTER_UNITS, "%s", o.str().c_str()); + TC_LOG_INFO("entities.unit", "%s", o.str().c_str()); o.str(""); o << "Controlled List: "; for (ControlList::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr) o << (*itr)->GetGUID() << ", "; - TC_LOG_INFO(LOG_FILTER_UNITS, "%s", o.str().c_str()); + TC_LOG_INFO("entities.unit", "%s", o.str().c_str()); o.str(""); o << "Aura List: "; for (AuraApplicationMap::const_iterator itr = m_appliedAuras.begin(); itr != m_appliedAuras.end(); ++itr) o << itr->first << ", "; - TC_LOG_INFO(LOG_FILTER_UNITS, "%s", o.str().c_str()); + TC_LOG_INFO("entities.unit", "%s", o.str().c_str()); o.str(""); if (IsVehicle()) @@ -17217,11 +17236,11 @@ void Unit::OutDebugInfo() const for (SeatMap::iterator itr = GetVehicleKit()->Seats.begin(); itr != GetVehicleKit()->Seats.end(); ++itr) if (Unit* passenger = ObjectAccessor::GetUnit(*GetVehicleBase(), itr->second.Passenger.Guid)) o << passenger->GetGUID() << ", "; - TC_LOG_INFO(LOG_FILTER_UNITS, "%s", o.str().c_str()); + TC_LOG_INFO("entities.unit", "%s", o.str().c_str()); } if (GetVehicle()) - TC_LOG_INFO(LOG_FILTER_UNITS, "On vehicle %u.", GetVehicleBase()->GetEntry()); + TC_LOG_INFO("entities.unit", "On vehicle %u.", GetVehicleBase()->GetEntry()); } uint32 Unit::GetRemainingPeriodicAmount(uint64 caster, uint32 spellId, AuraType auraType, uint8 effectIndex) const diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index f8d5964beca..d9e49ab6a4d 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1894,7 +1894,7 @@ class Unit : public WorldObject uint32 m_lastSanctuaryTime; // Threat related methods - bool CanHaveThreatList() const; + bool CanHaveThreatList(bool skipAliveCheck = false) const; void AddThreat(Unit* victim, float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const* threatSpell = NULL); float ApplyTotalThreatModifier(float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL); void DeleteThreatList(); @@ -2005,8 +2005,8 @@ class Unit : public WorldObject static Player* GetPlayer(WorldObject& object, uint64 guid); static Creature* GetCreature(WorldObject& object, uint64 guid); - MotionMaster* GetMotionMaster() { return &i_motionMaster; } - const MotionMaster* GetMotionMaster() const { return &i_motionMaster; } + MotionMaster* GetMotionMaster() { return i_motionMaster; } + const MotionMaster* GetMotionMaster() const { return i_motionMaster; } bool IsStopped() const { return !(HasUnitState(UNIT_STATE_MOVING)); } void StopMoving(); @@ -2158,7 +2158,7 @@ class Unit : public WorldObject typedef std::list<GameObject*> GameObjectList; GameObjectList m_gameObj; - bool m_isSorted; + uint32 m_transform; Spell* m_currentSpells[CURRENT_MAX_SPELL]; @@ -2187,7 +2187,7 @@ class Unit : public WorldObject virtual SpellSchoolMask GetMeleeDamageSchoolMask() const; - MotionMaster i_motionMaster; + MotionMaster* i_motionMaster; uint32 m_reactiveTimer[MAX_REACTIVE]; uint32 m_regenTimer; @@ -2214,6 +2214,7 @@ class Unit : public WorldObject bool HandleAuraRaidProcFromCharge(AuraEffect* triggeredByAura); void UpdateSplineMovement(uint32 t_diff); + void UpdateSplinePosition(); // player or player's pet float GetCombatRatingReduction(CombatRating cr) const; diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp index 88c9ab203b0..28ec4fb9569 100755 --- a/src/server/game/Entities/Vehicle/Vehicle.cpp +++ b/src/server/game/Entities/Vehicle/Vehicle.cpp @@ -35,7 +35,7 @@ #include "Battleground.h" Vehicle::Vehicle(Unit* unit, VehicleEntry const* vehInfo, uint32 creatureEntry) : -UsableSeatNum(0), _me(unit), _vehicleInfo(vehInfo), _creatureEntry(creatureEntry), _status(STATUS_NONE) +UsableSeatNum(0), _me(unit), _vehicleInfo(vehInfo), _creatureEntry(creatureEntry), _status(STATUS_NONE), _lastShootPos() { for (uint32 i = 0; i < MAX_VEHICLE_SEATS; ++i) { @@ -102,7 +102,7 @@ void Vehicle::Install() if (!spellInfo) continue; - if (spellInfo->PowerType == POWER_ENERGY) + if (spellInfo->PowerType == POWER_ENERGY && spellInfo->CalcPowerCost(_me, spellInfo->GetSchoolMask()) > 0) { _me->setPowerType(POWER_ENERGY); _me->SetMaxPower(POWER_ENERGY, 100); @@ -147,13 +147,13 @@ void Vehicle::Uninstall() /// @Prevent recursive uninstall call. (Bad script in OnUninstall/OnRemovePassenger/PassengerBoarded hook.) if (_status == STATUS_UNINSTALLING && !GetBase()->HasUnitTypeMask(UNIT_MASK_MINION)) { - TC_LOG_ERROR(LOG_FILTER_VEHICLES, "Vehicle GuidLow: %u, Entry: %u attempts to uninstall, but already has STATUS_UNINSTALLING! " + TC_LOG_ERROR("entities.vehicle", "Vehicle GuidLow: %u, Entry: %u attempts to uninstall, but already has STATUS_UNINSTALLING! " "Check Uninstall/PassengerBoarded script hooks for errors.", _me->GetGUIDLow(), _me->GetEntry()); return; } _status = STATUS_UNINSTALLING; - TC_LOG_DEBUG(LOG_FILTER_VEHICLES, "Vehicle::Uninstall Entry: %u, GuidLow: %u", _creatureEntry, _me->GetGUIDLow()); + TC_LOG_DEBUG("entities.vehicle", "Vehicle::Uninstall Entry: %u, GuidLow: %u", _creatureEntry, _me->GetGUIDLow()); RemoveAllPassengers(); if (GetBase()->GetTypeId() == TYPEID_UNIT) @@ -176,7 +176,7 @@ void Vehicle::Reset(bool evading /*= false*/) if (GetBase()->GetTypeId() != TYPEID_UNIT) return; - TC_LOG_DEBUG(LOG_FILTER_VEHICLES, "Vehicle::Reset (Entry: %u, GuidLow: %u, DBGuid: %u)", GetCreatureEntry(), _me->GetGUIDLow(), _me->ToCreature()->GetDBTableGUIDLow()); + TC_LOG_DEBUG("entities.vehicle", "Vehicle::Reset (Entry: %u, GuidLow: %u, DBGuid: %u)", GetCreatureEntry(), _me->GetGUIDLow(), _me->ToCreature()->GetDBTableGUIDLow()); ApplyAllImmunities(); InstallAllAccessories(evading); @@ -252,7 +252,7 @@ void Vehicle::ApplyAllImmunities() void Vehicle::RemoveAllPassengers() { - TC_LOG_DEBUG(LOG_FILTER_VEHICLES, "Vehicle::RemoveAllPassengers. Entry: %u, GuidLow: %u", _creatureEntry, _me->GetGUIDLow()); + TC_LOG_DEBUG("entities.vehicle", "Vehicle::RemoveAllPassengers. Entry: %u, GuidLow: %u", _creatureEntry, _me->GetGUIDLow()); /// Setting to_Abort to true will cause @VehicleJoinEvent::Abort to be executed on next @Unit::UpdateEvents call /// This will properly "reset" the pending join process for the passenger. @@ -388,13 +388,13 @@ void Vehicle::InstallAccessory(uint32 entry, int8 seatId, bool minion, uint8 typ /// @Prevent adding accessories when vehicle is uninstalling. (Bad script in OnUninstall/OnRemovePassenger/PassengerBoarded hook.) if (_status == STATUS_UNINSTALLING) { - TC_LOG_ERROR(LOG_FILTER_VEHICLES, "Vehicle (GuidLow: %u, DB GUID: %u, Entry: %u) attempts to install accessory (Entry: %u) on seat %d with STATUS_UNINSTALLING! " + TC_LOG_ERROR("entities.vehicle", "Vehicle (GuidLow: %u, DB GUID: %u, Entry: %u) attempts to install accessory (Entry: %u) on seat %d with STATUS_UNINSTALLING! " "Check Uninstall/PassengerBoarded script hooks for errors.", _me->GetGUIDLow(), (_me->GetTypeId() == TYPEID_UNIT ? _me->ToCreature()->GetDBTableGUIDLow() : _me->GetGUIDLow()), GetCreatureEntry(), entry, (int32)seatId); return; } - TC_LOG_DEBUG(LOG_FILTER_VEHICLES, "Vehicle (GuidLow: %u, DB Guid: %u, Entry %u): installing accessory (Entry: %u) on seat: %d", + TC_LOG_DEBUG("entities.vehicle", "Vehicle (GuidLow: %u, DB Guid: %u, Entry %u): installing accessory (Entry: %u) on seat: %d", _me->GetGUIDLow(), (_me->GetTypeId() == TYPEID_UNIT ? _me->ToCreature()->GetDBTableGUIDLow() : _me->GetGUIDLow()), GetCreatureEntry(), entry, (int32)seatId); @@ -429,12 +429,12 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId) /// @Prevent adding passengers when vehicle is uninstalling. (Bad script in OnUninstall/OnRemovePassenger/PassengerBoarded hook.) if (_status == STATUS_UNINSTALLING) { - TC_LOG_ERROR(LOG_FILTER_VEHICLES, "Passenger GuidLow: %u, Entry: %u, attempting to board vehicle GuidLow: %u, Entry: %u during uninstall! SeatId: %d", + TC_LOG_ERROR("entities.vehicle", "Passenger GuidLow: %u, Entry: %u, attempting to board vehicle GuidLow: %u, Entry: %u during uninstall! SeatId: %d", unit->GetGUIDLow(), unit->GetEntry(), _me->GetGUIDLow(), _me->GetEntry(), (int32)seatId); return false; } - TC_LOG_DEBUG(LOG_FILTER_VEHICLES, "Unit %s scheduling enter vehicle (entry: %u, vehicleId: %u, guid: %u (dbguid: %u) on seat %d", + TC_LOG_DEBUG("entities.vehicle", "Unit %s scheduling enter vehicle (entry: %u, vehicleId: %u, guid: %u (dbguid: %u) on seat %d", unit->GetName().c_str(), _me->GetEntry(), _vehicleInfo->m_ID, _me->GetGUIDLow(), (_me->GetTypeId() == TYPEID_UNIT ? _me->ToCreature()->GetDBTableGUIDLow() : 0), (int32)seatId); @@ -504,7 +504,7 @@ Vehicle* Vehicle::RemovePassenger(Unit* unit) SeatMap::iterator seat = GetSeatIteratorForPassenger(unit); ASSERT(seat != Seats.end()); - TC_LOG_DEBUG(LOG_FILTER_VEHICLES, "Unit %s exit vehicle entry %u id %u dbguid %u seat %d", + TC_LOG_DEBUG("entities.vehicle", "Unit %s exit vehicle entry %u id %u dbguid %u seat %d", unit->GetName().c_str(), _me->GetEntry(), _vehicleInfo->m_ID, _me->GetGUIDLow(), (int32)seat->first); if (seat->second.SeatInfo->CanEnterOrExit() && ++UsableSeatNum) @@ -679,30 +679,6 @@ uint8 Vehicle::GetAvailableSeatCount() const return ret; } -void Vehicle::CalculatePassengerPosition(float& x, float& y, float& z, float* o /*= NULL*/) const -{ - float inx = x, iny = y, inz = z; - if (o) - *o = Position::NormalizeOrientation(GetBase()->GetOrientation() + *o); - - x = GetBase()->GetPositionX() + inx * std::cos(GetBase()->GetOrientation()) - iny * std::sin(GetBase()->GetOrientation()); - y = GetBase()->GetPositionY() + iny * std::cos(GetBase()->GetOrientation()) + inx * std::sin(GetBase()->GetOrientation()); - z = GetBase()->GetPositionZ() + inz; -} - -void Vehicle::CalculatePassengerOffset(float& x, float& y, float& z, float* o /*= NULL*/) const -{ - if (o) - *o = Position::NormalizeOrientation(*o - GetBase()->GetOrientation()); - - z -= GetBase()->GetPositionZ(); - y -= GetBase()->GetPositionY(); // y = searchedY * std::cos(o) + searchedX * std::sin(o) - x -= GetBase()->GetPositionX(); // x = searchedX * std::cos(o) + searchedY * std::sin(o + pi) - float inx = x, iny = y; - y = (iny - inx * std::tan(GetBase()->GetOrientation())) / (std::cos(GetBase()->GetOrientation()) + std::sin(GetBase()->GetOrientation()) * std::tan(GetBase()->GetOrientation())); - x = (inx + iny * std::tan(GetBase()->GetOrientation())) / (std::cos(GetBase()->GetOrientation()) + std::sin(GetBase()->GetOrientation()) * std::tan(GetBase()->GetOrientation())); -} - /** * @fn void Vehicle::RemovePendingEvent(VehicleJoinEvent* e) * @@ -896,7 +872,7 @@ void VehicleJoinEvent::Abort(uint64) /// Check if the Vehicle was already uninstalled, in which case all auras were removed already if (Target) { - TC_LOG_DEBUG(LOG_FILTER_VEHICLES, "Passenger GuidLow: %u, Entry: %u, board on vehicle GuidLow: %u, Entry: %u SeatId: %d cancelled", + TC_LOG_DEBUG("entities.vehicle", "Passenger GuidLow: %u, Entry: %u, board on vehicle GuidLow: %u, Entry: %u SeatId: %d cancelled", Passenger->GetGUIDLow(), Passenger->GetEntry(), Target->GetBase()->GetGUIDLow(), Target->GetBase()->GetEntry(), (int32)Seat->first); /// @SPELL_AURA_CONTROL_VEHICLE auras can be applied even when the passenger is not (yet) on the vehicle. @@ -905,7 +881,7 @@ void VehicleJoinEvent::Abort(uint64) Target->GetBase()->RemoveAurasByType(SPELL_AURA_CONTROL_VEHICLE, Passenger->GetGUID()); } else - TC_LOG_DEBUG(LOG_FILTER_VEHICLES, "Passenger GuidLow: %u, Entry: %u, board on uninstalled vehicle SeatId: %d cancelled", + TC_LOG_DEBUG("entities.vehicle", "Passenger GuidLow: %u, Entry: %u, board on uninstalled vehicle SeatId: %d cancelled", Passenger->GetGUIDLow(), Passenger->GetEntry(), (int32)Seat->first); if (Passenger->IsInWorld() && Passenger->HasUnitTypeMask(UNIT_MASK_ACCESSORY)) diff --git a/src/server/game/Entities/Vehicle/Vehicle.h b/src/server/game/Entities/Vehicle/Vehicle.h index f71ccded926..7dc9c36ecef 100644 --- a/src/server/game/Entities/Vehicle/Vehicle.h +++ b/src/server/game/Entities/Vehicle/Vehicle.h @@ -89,10 +89,20 @@ class Vehicle : public TransportBase void InitMovementInfoForBase(); /// This method transforms supplied transport offsets into global coordinates - void CalculatePassengerPosition(float& x, float& y, float& z, float* o = NULL) const; + void CalculatePassengerPosition(float& x, float& y, float& z, float* o /*= NULL*/) const + { + TransportBase::CalculatePassengerPosition(x, y, z, o, + GetBase()->GetPositionX(), GetBase()->GetPositionY(), + GetBase()->GetPositionZ(), GetBase()->GetOrientation()); + } /// This method transforms supplied global coordinates into local offsets - void CalculatePassengerOffset(float& x, float& y, float& z, float* o = NULL) const; + void CalculatePassengerOffset(float& x, float& y, float& z, float* o /*= NULL*/) const + { + TransportBase::CalculatePassengerOffset(x, y, z, o, + GetBase()->GetPositionX(), GetBase()->GetPositionY(), + GetBase()->GetPositionZ(), GetBase()->GetOrientation()); + } void RemovePendingEvent(VehicleJoinEvent* e); void RemovePendingEventsForSeat(int8 seatId); diff --git a/src/server/game/Entities/Vehicle/VehicleDefines.h b/src/server/game/Entities/Vehicle/VehicleDefines.h index 1c3a57593c3..0290ecf7859 100644 --- a/src/server/game/Entities/Vehicle/VehicleDefines.h +++ b/src/server/game/Entities/Vehicle/VehicleDefines.h @@ -105,6 +105,31 @@ public: /// This method transforms supplied global coordinates into local offsets virtual void CalculatePassengerOffset(float& x, float& y, float& z, float* o = NULL) const = 0; + +protected: + static void CalculatePassengerPosition(float& x, float& y, float& z, float* o, float transX, float transY, float transZ, float transO) + { + float inx = x, iny = y, inz = z; + if (o) + *o = Position::NormalizeOrientation(transO + *o); + + x = transX + inx * std::cos(transO) - iny * std::sin(transO); + y = transY + iny * std::cos(transO) + inx * std::sin(transO); + z = transZ + inz; + } + + static void CalculatePassengerOffset(float& x, float& y, float& z, float* o, float transX, float transY, float transZ, float transO) + { + if (o) + *o = Position::NormalizeOrientation(*o - transO); + + z -= transZ; + y -= transY; // y = searchedY * std::cos(o) + searchedX * std::sin(o) + x -= transX; // x = searchedX * std::cos(o) + searchedY * std::sin(o + pi) + float inx = x, iny = y; + y = (iny - inx * std::tan(transO)) / (std::cos(transO) + std::sin(transO) * std::tan(transO)); + x = (inx + iny * std::tan(transO)) / (std::cos(transO) + std::sin(transO) * std::tan(transO)); + } }; #endif diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp index 892a23687de..55550dc019b 100644 --- a/src/server/game/Events/GameEventMgr.cpp +++ b/src/server/game/Events/GameEventMgr.cpp @@ -210,7 +210,7 @@ void GameEventMgr::LoadFromDB() if (!result) { mGameEvent.clear(); - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 game events. DB table `game_event` is empty."); + TC_LOG_ERROR("server.loading", ">> Loaded 0 game events. DB table `game_event` is empty."); return; } @@ -222,7 +222,7 @@ void GameEventMgr::LoadFromDB() uint8 event_id = fields[0].GetUInt8(); if (event_id == 0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "`game_event` game event entry 0 is reserved and can't be used."); + TC_LOG_ERROR("sql.sql", "`game_event` game event entry 0 is reserved and can't be used."); continue; } @@ -241,7 +241,7 @@ void GameEventMgr::LoadFromDB() if (pGameEvent.length == 0 && pGameEvent.state == GAMEEVENT_NORMAL) // length>0 is validity check { - TC_LOG_ERROR(LOG_FILTER_SQL, "`game_event` game event id (%i) isn't a world event and has length = 0, thus it can't be used.", event_id); + TC_LOG_ERROR("sql.sql", "`game_event` game event id (%i) isn't a world event and has length = 0, thus it can't be used.", event_id); continue; } @@ -249,7 +249,7 @@ void GameEventMgr::LoadFromDB() { if (!sHolidaysStore.LookupEntry(pGameEvent.holiday_id)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "`game_event` game event id (%i) have not existed holiday id %u.", event_id, pGameEvent.holiday_id); + TC_LOG_ERROR("sql.sql", "`game_event` game event id (%i) have not existed holiday id %u.", event_id, pGameEvent.holiday_id); pGameEvent.holiday_id = HOLIDAY_NONE; } } @@ -260,11 +260,11 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Game Event Saves Data..."); + TC_LOG_INFO("server.loading", "Loading Game Event Saves Data..."); { uint32 oldMSTime = getMSTime(); @@ -272,7 +272,7 @@ void GameEventMgr::LoadFromDB() QueryResult result = CharacterDatabase.Query("SELECT eventEntry, state, next_start FROM game_event_save"); if (!result) - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 game event saves in game events. DB table `game_event_save` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 game event saves in game events. DB table `game_event_save` is empty."); else { uint32 count = 0; @@ -284,7 +284,7 @@ void GameEventMgr::LoadFromDB() if (event_id >= mGameEvent.size()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "`game_event_save` game event entry (%i) is out of range compared to max event entry in `game_event`", event_id); + TC_LOG_ERROR("sql.sql", "`game_event_save` game event entry (%i) is out of range compared to max event entry in `game_event`", event_id); continue; } @@ -295,7 +295,7 @@ void GameEventMgr::LoadFromDB() } else { - TC_LOG_ERROR(LOG_FILTER_SQL, "game_event_save includes event save for non-worldevent id %u", event_id); + TC_LOG_ERROR("sql.sql", "game_event_save includes event save for non-worldevent id %u", event_id); continue; } @@ -303,19 +303,19 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u game event saves in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u game event saves in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Game Event Prerequisite Data..."); + TC_LOG_INFO("server.loading", "Loading Game Event Prerequisite Data..."); { uint32 oldMSTime = getMSTime(); // 0 1 QueryResult result = WorldDatabase.Query("SELECT eventEntry, prerequisite_event FROM game_event_prerequisite"); if (!result) - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 game event prerequisites in game events. DB table `game_event_prerequisite` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 game event prerequisites in game events. DB table `game_event_prerequisite` is empty."); else { uint32 count = 0; @@ -327,7 +327,7 @@ void GameEventMgr::LoadFromDB() if (event_id >= mGameEvent.size()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "`game_event_prerequisite` game event id (%i) is out of range compared to max event id in `game_event`", event_id); + TC_LOG_ERROR("sql.sql", "`game_event_prerequisite` game event id (%i) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -336,14 +336,14 @@ void GameEventMgr::LoadFromDB() uint16 prerequisite_event = fields[1].GetUInt32(); if (prerequisite_event >= mGameEvent.size()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "`game_event_prerequisite` game event prerequisite id (%i) is out of range compared to max event id in `game_event`", prerequisite_event); + TC_LOG_ERROR("sql.sql", "`game_event_prerequisite` game event prerequisite id (%i) is out of range compared to max event id in `game_event`", prerequisite_event); continue; } mGameEvent[event_id].prerequisite_events.insert(prerequisite_event); } else { - TC_LOG_ERROR(LOG_FILTER_SQL, "game_event_prerequisiste includes event entry for non-worldevent id %u", event_id); + TC_LOG_ERROR("sql.sql", "game_event_prerequisiste includes event entry for non-worldevent id %u", event_id); continue; } @@ -351,12 +351,12 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u game event prerequisites in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u game event prerequisites in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Game Event Creature Data..."); + TC_LOG_INFO("server.loading", "Loading Game Event Creature Data..."); { uint32 oldMSTime = getMSTime(); @@ -364,7 +364,7 @@ void GameEventMgr::LoadFromDB() QueryResult result = WorldDatabase.Query("SELECT guid, eventEntry FROM game_event_creature"); if (!result) - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creatures in game events. DB table `game_event_creature` is empty"); + TC_LOG_INFO("server.loading", ">> Loaded 0 creatures in game events. DB table `game_event_creature` is empty"); else { uint32 count = 0; @@ -380,13 +380,13 @@ void GameEventMgr::LoadFromDB() CreatureData const* data = sObjectMgr->GetCreatureData(guid); if (!data) { - TC_LOG_ERROR(LOG_FILTER_SQL, "`game_event_creature` contains creature (GUID: %u) not found in `creature` table.", guid); + TC_LOG_ERROR("sql.sql", "`game_event_creature` contains creature (GUID: %u) not found in `creature` table.", guid); continue; } if (internal_event_id < 0 || internal_event_id >= int32(mGameEventCreatureGuids.size())) { - TC_LOG_ERROR(LOG_FILTER_SQL, "`game_event_creature` game event id (%i) is out of range compared to max event id in `game_event`", event_id); + TC_LOG_ERROR("sql.sql", "`game_event_creature` game event id (%i) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -397,12 +397,12 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creatures in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u creatures in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Game Event GO Data..."); + TC_LOG_INFO("server.loading", "Loading Game Event GO Data..."); { uint32 oldMSTime = getMSTime(); @@ -410,7 +410,7 @@ void GameEventMgr::LoadFromDB() QueryResult result = WorldDatabase.Query("SELECT guid, eventEntry FROM game_event_gameobject"); if (!result) - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 gameobjects in game events. DB table `game_event_gameobject` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 gameobjects in game events. DB table `game_event_gameobject` is empty."); else { uint32 count = 0; @@ -426,13 +426,13 @@ void GameEventMgr::LoadFromDB() GameObjectData const* data = sObjectMgr->GetGOData(guid); if (!data) { - TC_LOG_ERROR(LOG_FILTER_SQL, "`game_event_gameobject` contains gameobject (GUID: %u) not found in `gameobject` table.", guid); + TC_LOG_ERROR("sql.sql", "`game_event_gameobject` contains gameobject (GUID: %u) not found in `gameobject` table.", guid); continue; } if (internal_event_id < 0 || internal_event_id >= int32(mGameEventGameobjectGuids.size())) { - TC_LOG_ERROR(LOG_FILTER_SQL, "`game_event_gameobject` game event id (%i) is out of range compared to max event id in `game_event`", event_id); + TC_LOG_ERROR("sql.sql", "`game_event_gameobject` game event id (%i) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -443,11 +443,11 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u gameobjects in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u gameobjects in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Game Event Model/Equipment Change Data..."); + TC_LOG_INFO("server.loading", "Loading Game Event Model/Equipment Change Data..."); { uint32 oldMSTime = getMSTime(); @@ -456,7 +456,7 @@ void GameEventMgr::LoadFromDB() "FROM creature JOIN game_event_model_equip ON creature.guid=game_event_model_equip.guid"); if (!result) - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 model/equipment changes in game events. DB table `game_event_model_equip` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 model/equipment changes in game events. DB table `game_event_model_equip` is empty."); else { uint32 count = 0; @@ -470,7 +470,7 @@ void GameEventMgr::LoadFromDB() if (event_id >= mGameEventModelEquip.size()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "`game_event_model_equip` game event id (%u) is out of range compared to max event id in `game_event`", event_id); + TC_LOG_ERROR("sql.sql", "`game_event_model_equip` game event id (%u) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -486,7 +486,7 @@ void GameEventMgr::LoadFromDB() int8 equipId = static_cast<int8>(newModelEquipSet.equipment_id); if (!sObjectMgr->GetEquipmentInfo(entry, equipId)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `game_event_model_equip` have creature (Guid: %u, entry: %u) with equipment_id %u not found in table `creature_equip_template`, set to no equipment.", + TC_LOG_ERROR("sql.sql", "Table `game_event_model_equip` have creature (Guid: %u, entry: %u) with equipment_id %u not found in table `creature_equip_template`, set to no equipment.", guid, entry, newModelEquipSet.equipment_id); continue; } @@ -498,11 +498,11 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u model/equipment changes in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u model/equipment changes in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Game Event Quest Data..."); + TC_LOG_INFO("server.loading", "Loading Game Event Quest Data..."); { uint32 oldMSTime = getMSTime(); @@ -510,7 +510,7 @@ void GameEventMgr::LoadFromDB() QueryResult result = WorldDatabase.Query("SELECT id, quest, eventEntry FROM game_event_creature_quest"); if (!result) - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 quests additions in game events. DB table `game_event_creature_quest` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 quests additions in game events. DB table `game_event_creature_quest` is empty."); else { uint32 count = 0; @@ -524,7 +524,7 @@ void GameEventMgr::LoadFromDB() if (event_id >= mGameEventCreatureQuests.size()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "`game_event_creature_quest` game event id (%u) is out of range compared to max event id in `game_event`", event_id); + TC_LOG_ERROR("sql.sql", "`game_event_creature_quest` game event id (%u) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -535,11 +535,11 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Game Event GO Quest Data..."); + TC_LOG_INFO("server.loading", "Loading Game Event GO Quest Data..."); { uint32 oldMSTime = getMSTime(); @@ -547,7 +547,7 @@ void GameEventMgr::LoadFromDB() QueryResult result = WorldDatabase.Query("SELECT id, quest, eventEntry FROM game_event_gameobject_quest"); if (!result) - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 go quests additions in game events. DB table `game_event_gameobject_quest` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 go quests additions in game events. DB table `game_event_gameobject_quest` is empty."); else { uint32 count = 0; @@ -561,7 +561,7 @@ void GameEventMgr::LoadFromDB() if (event_id >= mGameEventGameObjectQuests.size()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "`game_event_gameobject_quest` game event id (%u) is out of range compared to max event id in `game_event`", event_id); + TC_LOG_ERROR("sql.sql", "`game_event_gameobject_quest` game event id (%u) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -572,11 +572,11 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Game Event Quest Condition Data..."); + TC_LOG_INFO("server.loading", "Loading Game Event Quest Condition Data..."); { uint32 oldMSTime = getMSTime(); @@ -584,7 +584,7 @@ void GameEventMgr::LoadFromDB() QueryResult result = WorldDatabase.Query("SELECT quest, eventEntry, condition_id, num FROM game_event_quest_condition"); if (!result) - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 quest event conditions in game events. DB table `game_event_quest_condition` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 quest event conditions in game events. DB table `game_event_quest_condition` is empty."); else { uint32 count = 0; @@ -599,7 +599,7 @@ void GameEventMgr::LoadFromDB() if (event_id >= mGameEvent.size()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "`game_event_quest_condition` game event id (%u) is out of range compared to max event id in `game_event`", event_id); + TC_LOG_ERROR("sql.sql", "`game_event_quest_condition` game event id (%u) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -611,11 +611,11 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quest event conditions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u quest event conditions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Game Event Condition Data..."); + TC_LOG_INFO("server.loading", "Loading Game Event Condition Data..."); { uint32 oldMSTime = getMSTime(); @@ -623,7 +623,7 @@ void GameEventMgr::LoadFromDB() QueryResult result = WorldDatabase.Query("SELECT eventEntry, condition_id, req_num, max_world_state_field, done_world_state_field FROM game_event_condition"); if (!result) - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 conditions in game events. DB table `game_event_condition` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 conditions in game events. DB table `game_event_condition` is empty."); else { uint32 count = 0; @@ -636,7 +636,7 @@ void GameEventMgr::LoadFromDB() if (event_id >= mGameEvent.size()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "`game_event_condition` game event id (%u) is out of range compared to max event id in `game_event`", event_id); + TC_LOG_ERROR("sql.sql", "`game_event_condition` game event id (%u) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -649,11 +649,11 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u conditions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u conditions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Game Event Condition Save Data..."); + TC_LOG_INFO("server.loading", "Loading Game Event Condition Save Data..."); { uint32 oldMSTime = getMSTime(); @@ -661,7 +661,7 @@ void GameEventMgr::LoadFromDB() QueryResult result = CharacterDatabase.Query("SELECT eventEntry, condition_id, done FROM game_event_condition_save"); if (!result) - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 condition saves in game events. DB table `game_event_condition_save` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 condition saves in game events. DB table `game_event_condition_save` is empty."); else { uint32 count = 0; @@ -674,7 +674,7 @@ void GameEventMgr::LoadFromDB() if (event_id >= mGameEvent.size()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "`game_event_condition_save` game event id (%u) is out of range compared to max event id in `game_event`", event_id); + TC_LOG_ERROR("sql.sql", "`game_event_condition_save` game event id (%u) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -685,7 +685,7 @@ void GameEventMgr::LoadFromDB() } else { - TC_LOG_ERROR(LOG_FILTER_SQL, "game_event_condition_save contains not present condition evt id %u cond id %u", event_id, condition); + TC_LOG_ERROR("sql.sql", "game_event_condition_save contains not present condition evt id %u cond id %u", event_id, condition); continue; } @@ -693,11 +693,11 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u condition saves in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u condition saves in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Game Event NPCflag Data..."); + TC_LOG_INFO("server.loading", "Loading Game Event NPCflag Data..."); { uint32 oldMSTime = getMSTime(); @@ -705,7 +705,7 @@ void GameEventMgr::LoadFromDB() QueryResult result = WorldDatabase.Query("SELECT guid, eventEntry, npcflag FROM game_event_npcflag"); if (!result) - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 npcflags in game events. DB table `game_event_npcflag` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 npcflags in game events. DB table `game_event_npcflag` is empty."); else { uint32 count = 0; @@ -719,7 +719,7 @@ void GameEventMgr::LoadFromDB() if (event_id >= mGameEvent.size()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "`game_event_npcflag` game event id (%u) is out of range compared to max event id in `game_event`", event_id); + TC_LOG_ERROR("sql.sql", "`game_event_npcflag` game event id (%u) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -729,11 +729,11 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u npcflags in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u npcflags in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Game Event Seasonal Quest Relations..."); + TC_LOG_INFO("server.loading", "Loading Game Event Seasonal Quest Relations..."); { uint32 oldMSTime = getMSTime(); @@ -741,7 +741,7 @@ void GameEventMgr::LoadFromDB() QueryResult result = WorldDatabase.Query("SELECT questId, eventEntry FROM game_event_seasonal_questrelation"); if (!result) - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 seasonal quests additions in game events. DB table `game_event_seasonal_questrelation` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 seasonal quests additions in game events. DB table `game_event_seasonal_questrelation` is empty."); else { uint32 count = 0; @@ -754,13 +754,13 @@ void GameEventMgr::LoadFromDB() if (!sObjectMgr->GetQuestTemplate(questId)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "`game_event_seasonal_questrelation` quest id (%u) does not exist in `quest_template`", questId); + TC_LOG_ERROR("sql.sql", "`game_event_seasonal_questrelation` quest id (%u) does not exist in `quest_template`", questId); continue; } if (eventEntry >= mGameEvent.size()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "`game_event_seasonal_questrelation` event id (%u) is out of range compared to max event in `game_event`", eventEntry); + TC_LOG_ERROR("sql.sql", "`game_event_seasonal_questrelation` event id (%u) is out of range compared to max event in `game_event`", eventEntry); continue; } @@ -769,11 +769,11 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Game Event Vendor Additions Data..."); + TC_LOG_INFO("server.loading", "Loading Game Event Vendor Additions Data..."); { uint32 oldMSTime = getMSTime(); @@ -781,7 +781,7 @@ void GameEventMgr::LoadFromDB() QueryResult result = WorldDatabase.Query("SELECT eventEntry, guid, item, maxcount, incrtime, ExtendedCost FROM game_event_npc_vendor ORDER BY guid, slot ASC"); if (!result) - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 vendor additions in game events. DB table `game_event_npc_vendor` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 vendor additions in game events. DB table `game_event_npc_vendor` is empty."); else { uint32 count = 0; @@ -793,7 +793,7 @@ void GameEventMgr::LoadFromDB() if (event_id >= mGameEventVendors.size()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "`game_event_npc_vendor` game event id (%u) is out of range compared to max event id in `game_event`", event_id); + TC_LOG_ERROR("sql.sql", "`game_event_npc_vendor` game event id (%u) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -831,11 +831,11 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u vendor additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u vendor additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Game Event Battleground Data..."); + TC_LOG_INFO("server.loading", "Loading Game Event Battleground Data..."); { uint32 oldMSTime = getMSTime(); @@ -843,7 +843,7 @@ void GameEventMgr::LoadFromDB() QueryResult result = WorldDatabase.Query("SELECT eventEntry, bgflag FROM game_event_battleground_holiday"); if (!result) - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 battleground holidays in game events. DB table `game_event_battleground_holiday` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 battleground holidays in game events. DB table `game_event_battleground_holiday` is empty."); else { uint32 count = 0; @@ -855,7 +855,7 @@ void GameEventMgr::LoadFromDB() if (event_id >= mGameEvent.size()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "`game_event_battleground_holiday` game event id (%u) is out of range compared to max event id in `game_event`", event_id); + TC_LOG_ERROR("sql.sql", "`game_event_battleground_holiday` game event id (%u) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -865,11 +865,11 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u battleground holidays in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u battleground holidays in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Game Event Pool Data..."); + TC_LOG_INFO("server.loading", "Loading Game Event Pool Data..."); { uint32 oldMSTime = getMSTime(); @@ -878,7 +878,7 @@ void GameEventMgr::LoadFromDB() " JOIN game_event_pool ON pool_template.entry = game_event_pool.pool_entry"); if (!result) - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 pools for game events. DB table `game_event_pool` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 pools for game events. DB table `game_event_pool` is empty."); else { uint32 count = 0; @@ -893,13 +893,13 @@ void GameEventMgr::LoadFromDB() if (internal_event_id < 0 || internal_event_id >= int32(mGameEventPoolIds.size())) { - TC_LOG_ERROR(LOG_FILTER_SQL, "`game_event_pool` game event id (%i) is out of range compared to max event id in `game_event`", event_id); + TC_LOG_ERROR("sql.sql", "`game_event_pool` game event id (%i) is out of range compared to max event id in `game_event`", event_id); continue; } if (!sPoolMgr->CheckPool(entry)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Pool Id (%u) has all creatures or gameobjects with explicit chance sum <>100 and no equal chance defined. The pool system cannot pick one to spawn.", entry); + TC_LOG_ERROR("sql.sql", "Pool Id (%u) has all creatures or gameobjects with explicit chance sum <>100 and no equal chance defined. The pool system cannot pick one to spawn.", entry); continue; } @@ -910,7 +910,7 @@ void GameEventMgr::LoadFromDB() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u pools for game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u pools for game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } } @@ -972,7 +972,7 @@ void GameEventMgr::StartArenaSeason() if (!result) { - TC_LOG_ERROR(LOG_FILTER_GAMEEVENTS, "ArenaSeason (%u) must be an existant Arena Season", season); + TC_LOG_ERROR("gameevent", "ArenaSeason (%u) must be an existant Arena Season", season); return; } @@ -981,12 +981,12 @@ void GameEventMgr::StartArenaSeason() if (eventId >= mGameEvent.size()) { - TC_LOG_ERROR(LOG_FILTER_GAMEEVENTS, "EventEntry %u for ArenaSeason (%u) does not exists", eventId, season); + TC_LOG_ERROR("gameevent", "EventEntry %u for ArenaSeason (%u) does not exists", eventId, season); return; } StartEvent(eventId, true); - TC_LOG_INFO(LOG_FILTER_GAMEEVENTS, "Arena Season %u started...", season); + TC_LOG_INFO("gameevent", "Arena Season %u started...", season); } @@ -1000,7 +1000,7 @@ uint32 GameEventMgr::Update() // return the next e { // must do the activating first, and after that the deactivating // so first queue it - //TC_LOG_ERROR(LOG_FILTER_SQL, "Checking event %u", itr); + //TC_LOG_ERROR("sql.sql", "Checking event %u", itr); if (CheckOneGameEvent(itr)) { // if the world event is in NEXTPHASE state, and the time has passed to finish this event, then do so @@ -1021,14 +1021,14 @@ uint32 GameEventMgr::Update() // return the next e // changed, save to DB the gameevent state, will be updated in next update cycle SaveWorldEventStateToDB(itr); - //TC_LOG_DEBUG(LOG_FILTER_GENERAL, "GameEvent %u is active", itr->first); + //TC_LOG_DEBUG("misc", "GameEvent %u is active", itr->first); // queue for activation if (!IsActiveEvent(itr)) activate.insert(itr); } else { - //TC_LOG_DEBUG(LOG_FILTER_GENERAL, "GameEvent %u is not active", itr->first); + //TC_LOG_DEBUG("misc", "GameEvent %u is not active", itr->first); if (IsActiveEvent(itr)) deactivate.insert(itr); else @@ -1056,13 +1056,13 @@ uint32 GameEventMgr::Update() // return the next e nextEventDelay = 0; for (std::set<uint16>::iterator itr = deactivate.begin(); itr != deactivate.end(); ++itr) StopEvent(*itr); - TC_LOG_INFO(LOG_FILTER_GAMEEVENTS, "Next game event check in %u seconds.", nextEventDelay + 1); + TC_LOG_INFO("gameevent", "Next game event check in %u seconds.", nextEventDelay + 1); return (nextEventDelay + 1) * IN_MILLISECONDS; // Add 1 second to be sure event has started/stopped at next call } void GameEventMgr::UnApplyEvent(uint16 event_id) { - TC_LOG_INFO(LOG_FILTER_GAMEEVENTS, "GameEvent %u \"%s\" removed.", event_id, mGameEvent[event_id].description.c_str()); + TC_LOG_INFO("gameevent", "GameEvent %u \"%s\" removed.", event_id, mGameEvent[event_id].description.c_str()); //! Run SAI scripts with SMART_EVENT_GAME_EVENT_END RunSmartAIScripts(event_id, false); // un-spawn positive event tagged objects @@ -1089,7 +1089,7 @@ void GameEventMgr::ApplyNewEvent(uint16 event_id) if (announce == 1 || (announce == 2 && sWorld->getBoolConfig(CONFIG_EVENT_ANNOUNCE))) sWorld->SendWorldText(LANG_EVENTMESSAGE, mGameEvent[event_id].description.c_str()); - TC_LOG_INFO(LOG_FILTER_GAMEEVENTS, "GameEvent %u \"%s\" started.", event_id, mGameEvent[event_id].description.c_str()); + TC_LOG_INFO("gameevent", "GameEvent %u \"%s\" started.", event_id, mGameEvent[event_id].description.c_str()); //! Run SAI scripts with SMART_EVENT_GAME_EVENT_END RunSmartAIScripts(event_id, true); @@ -1163,7 +1163,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id) if (internal_event_id < 0 || internal_event_id >= int32(mGameEventCreatureGuids.size())) { - TC_LOG_ERROR(LOG_FILTER_GAMEEVENTS, "GameEventMgr::GameEventSpawn attempt access to out of range mGameEventCreatureGuids element %i (size: " SIZEFMTD ")", + TC_LOG_ERROR("gameevent", "GameEventMgr::GameEventSpawn attempt access to out of range mGameEventCreatureGuids element %i (size: " SIZEFMTD ")", internal_event_id, mGameEventCreatureGuids.size()); return; } @@ -1180,8 +1180,8 @@ void GameEventMgr::GameEventSpawn(int16 event_id) // We use spawn coords to spawn if (!map->Instanceable() && map->IsGridLoaded(data->posX, data->posY)) { - Creature* creature = new Creature; - //TC_LOG_DEBUG(LOG_FILTER_GENERAL, "Spawning creature %u", *itr); + Creature* creature = new Creature(); + //TC_LOG_DEBUG("misc", "Spawning creature %u", *itr); if (!creature->LoadCreatureFromDB(*itr, map)) delete creature; } @@ -1190,7 +1190,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id) if (internal_event_id < 0 || internal_event_id >= int32(mGameEventGameobjectGuids.size())) { - TC_LOG_ERROR(LOG_FILTER_GAMEEVENTS, "GameEventMgr::GameEventSpawn attempt access to out of range mGameEventGameobjectGuids element %i (size: " SIZEFMTD ")", + TC_LOG_ERROR("gameevent", "GameEventMgr::GameEventSpawn attempt access to out of range mGameEventGameobjectGuids element %i (size: " SIZEFMTD ")", internal_event_id, mGameEventGameobjectGuids.size()); return; } @@ -1208,7 +1208,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id) if (!map->Instanceable() && map->IsGridLoaded(data->posX, data->posY)) { GameObject* pGameobject = new GameObject; - //TC_LOG_DEBUG(LOG_FILTER_GENERAL, "Spawning gameobject %u", *itr); + //TC_LOG_DEBUG("misc", "Spawning gameobject %u", *itr); /// @todo find out when it is add to map if (!pGameobject->LoadGameObjectFromDB(*itr, map, false)) delete pGameobject; @@ -1223,7 +1223,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id) if (internal_event_id < 0 || internal_event_id >= int32(mGameEventPoolIds.size())) { - TC_LOG_ERROR(LOG_FILTER_GAMEEVENTS, "GameEventMgr::GameEventSpawn attempt access to out of range mGameEventPoolIds element %u (size: " SIZEFMTD ")", + TC_LOG_ERROR("gameevent", "GameEventMgr::GameEventSpawn attempt access to out of range mGameEventPoolIds element %u (size: " SIZEFMTD ")", internal_event_id, mGameEventPoolIds.size()); return; } @@ -1238,7 +1238,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id) if (internal_event_id < 0 || internal_event_id >= int32(mGameEventCreatureGuids.size())) { - TC_LOG_ERROR(LOG_FILTER_GAMEEVENTS, "GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventCreatureGuids element %i (size: " SIZEFMTD ")", + TC_LOG_ERROR("gameevent", "GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventCreatureGuids element %i (size: " SIZEFMTD ")", internal_event_id, mGameEventCreatureGuids.size()); return; } @@ -1260,7 +1260,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id) if (internal_event_id < 0 || internal_event_id >= int32(mGameEventGameobjectGuids.size())) { - TC_LOG_ERROR(LOG_FILTER_GAMEEVENTS, "GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventGameobjectGuids element %i (size: " SIZEFMTD ")", + TC_LOG_ERROR("gameevent", "GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventGameobjectGuids element %i (size: " SIZEFMTD ")", internal_event_id, mGameEventGameobjectGuids.size()); return; } @@ -1281,7 +1281,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id) } if (internal_event_id < 0 || internal_event_id >= int32(mGameEventPoolIds.size())) { - TC_LOG_ERROR(LOG_FILTER_GAMEEVENTS, "GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventPoolIds element %u (size: " SIZEFMTD ")", internal_event_id, mGameEventPoolIds.size()); + TC_LOG_ERROR("gameevent", "GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventPoolIds element %u (size: " SIZEFMTD ")", internal_event_id, mGameEventPoolIds.size()); return; } diff --git a/src/server/game/Events/GameEventMgr.h b/src/server/game/Events/GameEventMgr.h index d25da0db89d..73d86e869bf 100644 --- a/src/server/game/Events/GameEventMgr.h +++ b/src/server/game/Events/GameEventMgr.h @@ -55,7 +55,8 @@ typedef std::map<uint32 /*condition id*/, GameEventFinishCondition> GameEventCon struct GameEventData { - GameEventData() : start(1), end(0), nextstart(0), occurence(0), length(0), holiday_id(HOLIDAY_NONE), state(GAMEEVENT_NORMAL) { } + GameEventData() : start(1), end(0), nextstart(0), occurence(0), length(0), holiday_id(HOLIDAY_NONE), state(GAMEEVENT_NORMAL), + announce(0) { } time_t start; // occurs after this time time_t end; // occurs before this time time_t nextstart; // after this time the follow-up events count this phase completed diff --git a/src/server/game/Globals/ObjectAccessor.cpp b/src/server/game/Globals/ObjectAccessor.cpp index 77d455d72a7..cf1a813d287 100644 --- a/src/server/game/Globals/ObjectAccessor.cpp +++ b/src/server/game/Globals/ObjectAccessor.cpp @@ -52,14 +52,14 @@ template<class T> T* ObjectAccessor::GetObjectInWorld(uint32 mapid, float x, flo CellCoord p = Trinity::ComputeCellCoord(x, y); if (!p.IsCoordValid()) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "ObjectAccessor::GetObjectInWorld: invalid coordinates supplied X:%f Y:%f grid cell [%u:%u]", x, y, p.x_coord, p.y_coord); + TC_LOG_ERROR("misc", "ObjectAccessor::GetObjectInWorld: invalid coordinates supplied X:%f Y:%f grid cell [%u:%u]", x, y, p.x_coord, p.y_coord); return NULL; } CellCoord q = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY()); if (!q.IsCoordValid()) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "ObjectAccessor::GetObjecInWorld: object (GUID: %u TypeId: %u) has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUIDLow(), obj->GetTypeId(), obj->GetPositionX(), obj->GetPositionY(), q.x_coord, q.y_coord); + TC_LOG_ERROR("misc", "ObjectAccessor::GetObjecInWorld: object (GUID: %u TypeId: %u) has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUIDLow(), obj->GetTypeId(), obj->GetPositionX(), obj->GetPositionY(), q.x_coord, q.y_coord); return NULL; } @@ -330,7 +330,7 @@ Corpse* ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia return NULL; } - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "Deleting Corpse and spawned bones."); + TC_LOG_DEBUG("misc", "Deleting Corpse and spawned bones."); // Map can be NULL Map* map = corpse->FindMap(); diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index d515a9c20e9..3d56225bc00 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -234,7 +234,8 @@ ObjectMgr::ObjectMgr(): _hiGoGuid(1), _hiDoGuid(1), _hiCorpseGuid(1), - _hiMoTransGuid(1) + _hiMoTransGuid(1), + DBCLocaleIndex(LOCALE_enUS) { for (uint8 i = 0; i < MAX_CLASSES; ++i) { @@ -321,7 +322,7 @@ void ObjectMgr::LoadCreatureLocales() } } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu creature locale strings in %u ms", (unsigned long)_creatureLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %lu creature locale strings in %u ms", (unsigned long)_creatureLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadGossipMenuItemsLocales() @@ -357,7 +358,7 @@ void ObjectMgr::LoadGossipMenuItemsLocales() } } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu gossip_menu_option locale strings in %u ms", (unsigned long)_gossipMenuItemsLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %lu gossip_menu_option locale strings in %u ms", (unsigned long)_gossipMenuItemsLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadPointOfInterestLocales() @@ -383,7 +384,7 @@ void ObjectMgr::LoadPointOfInterestLocales() AddLocaleString(fields[i].GetString(), LocaleConstant(i), data.IconName); } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu points_of_interest locale strings in %u ms", (unsigned long)_pointOfInterestLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %lu points_of_interest locale strings in %u ms", (unsigned long)_pointOfInterestLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadCreatureTemplates() @@ -410,7 +411,7 @@ void ObjectMgr::LoadCreatureTemplates() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature template definitions. DB table `creature_template` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 creature template definitions. DB table `creature_template` is empty."); return; } @@ -512,7 +513,7 @@ void ObjectMgr::LoadCreatureTemplates() for (CreatureTemplateContainer::const_iterator itr = _creatureTemplateStore.begin(); itr != _creatureTemplateStore.end(); ++itr) CheckCreatureTemplate(&itr->second); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u creature definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadCreatureTemplateAddons() @@ -524,7 +525,7 @@ void ObjectMgr::LoadCreatureTemplateAddons() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature template addon definitions. DB table `creature_template_addon` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 creature template addon definitions. DB table `creature_template_addon` is empty."); return; } @@ -537,7 +538,7 @@ void ObjectMgr::LoadCreatureTemplateAddons() if (!sObjectMgr->GetCreatureTemplate(entry)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature template (Entry: %u) does not exist but has a record in `creature_template_addon`", entry); + TC_LOG_ERROR("sql.sql", "Creature template (Entry: %u) does not exist but has a record in `creature_template_addon`", entry); continue; } @@ -557,12 +558,12 @@ void ObjectMgr::LoadCreatureTemplateAddons() SpellInfo const* AdditionalSpellInfo = sSpellMgr->GetSpellInfo(uint32(atol(*itr))); if (!AdditionalSpellInfo) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (Entry: %u) has wrong spell %u defined in `auras` field in `creature_template_addon`.", entry, uint32(atol(*itr))); + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has wrong spell %u defined in `auras` field in `creature_template_addon`.", entry, uint32(atol(*itr))); continue; } if (AdditionalSpellInfo->HasAura(SPELL_AURA_CONTROL_VEHICLE)) - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (Entry: %u) has SPELL_AURA_CONTROL_VEHICLE aura %u defined in `auras` field in `creature_template_addon`.", entry, uint32(atol(*itr))); + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has SPELL_AURA_CONTROL_VEHICLE aura %u defined in `auras` field in `creature_template_addon`.", entry, uint32(atol(*itr))); creatureAddon.auras[i++] = uint32(atol(*itr)); } @@ -571,14 +572,14 @@ void ObjectMgr::LoadCreatureTemplateAddons() { if (!sCreatureDisplayInfoStore.LookupEntry(creatureAddon.mount)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (Entry: %u) has invalid displayInfoId (%u) for mount defined in `creature_template_addon`", entry, creatureAddon.mount); + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has invalid displayInfoId (%u) for mount defined in `creature_template_addon`", entry, creatureAddon.mount); creatureAddon.mount = 0; } } if (!sEmotesStore.LookupEntry(creatureAddon.emote)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (Entry: %u) has invalid emote (%u) defined in `creature_template_addon`.", entry, creatureAddon.emote); + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has invalid emote (%u) defined in `creature_template_addon`.", entry, creatureAddon.emote); creatureAddon.emote = 0; } @@ -586,7 +587,7 @@ void ObjectMgr::LoadCreatureTemplateAddons() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature template addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u creature template addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) @@ -604,7 +605,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) CreatureTemplate const* difficultyInfo = GetCreatureTemplate(cInfo->DifficultyEntry[diff]); if (!difficultyInfo) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (Entry: %u) has `difficulty_entry_%u`=%u but creature entry %u does not exist.", + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has `difficulty_entry_%u`=%u but creature entry %u does not exist.", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff], cInfo->DifficultyEntry[diff]); continue; } @@ -615,20 +616,20 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) ok2 = false; if (_difficultyEntries[diff2].find(cInfo->Entry) != _difficultyEntries[diff2].end()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (Entry: %u) is listed as `difficulty_entry_%u` of another creature, but itself lists %u in `difficulty_entry_%u`.", + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) is listed as `difficulty_entry_%u` of another creature, but itself lists %u in `difficulty_entry_%u`.", cInfo->Entry, diff2 + 1, cInfo->DifficultyEntry[diff], diff + 1); continue; } if (_difficultyEntries[diff2].find(cInfo->DifficultyEntry[diff]) != _difficultyEntries[diff2].end()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (Entry: %u) already listed as `difficulty_entry_%u` for another entry.", cInfo->DifficultyEntry[diff], diff2 + 1); + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) already listed as `difficulty_entry_%u` for another entry.", cInfo->DifficultyEntry[diff], diff2 + 1); continue; } if (_hasDifficultyEntries[diff2].find(cInfo->DifficultyEntry[diff]) != _hasDifficultyEntries[diff2].end()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (Entry: %u) has `difficulty_entry_%u`=%u but creature entry %u has itself a value in `difficulty_entry_%u`.", + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has `difficulty_entry_%u`=%u but creature entry %u has itself a value in `difficulty_entry_%u`.", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff], cInfo->DifficultyEntry[diff], diff2 + 1); continue; } @@ -639,51 +640,51 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) if (cInfo->unit_class != difficultyInfo->unit_class) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (Entry: %u, class %u) has different `unit_class` in difficulty %u mode (Entry: %u, class %u).", + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u, class %u) has different `unit_class` in difficulty %u mode (Entry: %u, class %u).", cInfo->Entry, cInfo->unit_class, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->unit_class); continue; } if (cInfo->npcflag != difficultyInfo->npcflag) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (Entry: %u) has different `npcflag` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has different `npcflag` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); continue; } if (cInfo->trainer_class != difficultyInfo->trainer_class) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (Entry: %u) has different `trainer_class` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has different `trainer_class` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); continue; } if (cInfo->trainer_race != difficultyInfo->trainer_race) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (Entry: %u) has different `trainer_race` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has different `trainer_race` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); continue; } if (cInfo->trainer_type != difficultyInfo->trainer_type) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (Entry: %u) has different `trainer_type` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has different `trainer_type` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); continue; } if (cInfo->trainer_spell != difficultyInfo->trainer_spell) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (Entry: %u) has different `trainer_spell` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has different `trainer_spell` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); continue; } if (!difficultyInfo->AIName.empty()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (Entry: %u) lists difficulty %u mode entry %u with `AIName` filled in. `AIName` of difficulty 0 mode creature is always used instead.", + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) lists difficulty %u mode entry %u with `AIName` filled in. `AIName` of difficulty 0 mode creature is always used instead.", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); continue; } if (difficultyInfo->ScriptID) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (Entry: %u) lists difficulty %u mode entry %u with `ScriptName` filled in. `ScriptName` of difficulty 0 mode creature is always used instead.", + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) lists difficulty %u mode entry %u with `ScriptName` filled in. `ScriptName` of difficulty 0 mode creature is always used instead.", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); continue; } @@ -695,11 +696,11 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(cInfo->faction_A); if (!factionTemplate) - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (Entry: %u) has non-existing faction_A template (%u).", cInfo->Entry, cInfo->faction_A); + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has non-existing faction_A template (%u).", cInfo->Entry, cInfo->faction_A); factionTemplate = sFactionTemplateStore.LookupEntry(cInfo->faction_H); if (!factionTemplate) - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (Entry: %u) has non-existing faction_H template (%u).", cInfo->Entry, cInfo->faction_H); + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has non-existing faction_H template (%u).", cInfo->Entry, cInfo->faction_H); // used later for scale CreatureDisplayInfoEntry const* displayScaleEntry = NULL; @@ -709,7 +710,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->Modelid1); if (!displayEntry) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (Entry: %u) lists non-existing Modelid1 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid1); + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) lists non-existing Modelid1 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid1); const_cast<CreatureTemplate*>(cInfo)->Modelid1 = 0; } else if (!displayScaleEntry) @@ -717,7 +718,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid1); if (!modelInfo) - TC_LOG_ERROR(LOG_FILTER_SQL, "No model data exist for `Modelid1` = %u listed by creature (Entry: %u).", cInfo->Modelid1, cInfo->Entry); + TC_LOG_ERROR("sql.sql", "No model data exist for `Modelid1` = %u listed by creature (Entry: %u).", cInfo->Modelid1, cInfo->Entry); } if (cInfo->Modelid2) @@ -725,7 +726,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->Modelid2); if (!displayEntry) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (Entry: %u) lists non-existing Modelid2 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid2); + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) lists non-existing Modelid2 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid2); const_cast<CreatureTemplate*>(cInfo)->Modelid2 = 0; } else if (!displayScaleEntry) @@ -733,7 +734,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid2); if (!modelInfo) - TC_LOG_ERROR(LOG_FILTER_SQL, "No model data exist for `Modelid2` = %u listed by creature (Entry: %u).", cInfo->Modelid2, cInfo->Entry); + TC_LOG_ERROR("sql.sql", "No model data exist for `Modelid2` = %u listed by creature (Entry: %u).", cInfo->Modelid2, cInfo->Entry); } if (cInfo->Modelid3) @@ -741,7 +742,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->Modelid3); if (!displayEntry) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (Entry: %u) lists non-existing Modelid3 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid3); + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) lists non-existing Modelid3 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid3); const_cast<CreatureTemplate*>(cInfo)->Modelid3 = 0; } else if (!displayScaleEntry) @@ -749,7 +750,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid3); if (!modelInfo) - TC_LOG_ERROR(LOG_FILTER_SQL, "No model data exist for `Modelid3` = %u listed by creature (Entry: %u).", cInfo->Modelid3, cInfo->Entry); + TC_LOG_ERROR("sql.sql", "No model data exist for `Modelid3` = %u listed by creature (Entry: %u).", cInfo->Modelid3, cInfo->Entry); } if (cInfo->Modelid4) @@ -757,7 +758,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->Modelid4); if (!displayEntry) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (Entry: %u) lists non-existing Modelid4 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid4); + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) lists non-existing Modelid4 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid4); const_cast<CreatureTemplate*>(cInfo)->Modelid4 = 0; } else if (!displayScaleEntry) @@ -765,11 +766,11 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid4); if (!modelInfo) - TC_LOG_ERROR(LOG_FILTER_SQL, "No model data exist for `Modelid4` = %u listed by creature (Entry: %u).", cInfo->Modelid4, cInfo->Entry); + TC_LOG_ERROR("sql.sql", "No model data exist for `Modelid4` = %u listed by creature (Entry: %u).", cInfo->Modelid4, cInfo->Entry); } if (!displayScaleEntry) - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (Entry: %u) does not have any existing display id in Modelid1/Modelid2/Modelid3/Modelid4.", cInfo->Entry); + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) does not have any existing display id in Modelid1/Modelid2/Modelid3/Modelid4.", cInfo->Entry); for (int k = 0; k < MAX_KILL_CREDIT; ++k) { @@ -777,7 +778,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) { if (!GetCreatureTemplate(cInfo->KillCredit[k])) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (Entry: %u) lists non-existing creature entry %u in `KillCredit%d`.", cInfo->Entry, cInfo->KillCredit[k], k + 1); + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) lists non-existing creature entry %u in `KillCredit%d`.", cInfo->Entry, cInfo->KillCredit[k], k + 1); const_cast<CreatureTemplate*>(cInfo)->KillCredit[k] = 0; } } @@ -785,13 +786,13 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) if (!cInfo->unit_class || ((1 << (cInfo->unit_class-1)) & CLASSMASK_ALL_CREATURES) == 0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (Entry: %u) has invalid unit_class (%u) in creature_template. Set to 1 (UNIT_CLASS_WARRIOR).", cInfo->Entry, cInfo->unit_class); + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has invalid unit_class (%u) in creature_template. Set to 1 (UNIT_CLASS_WARRIOR).", cInfo->Entry, cInfo->unit_class); const_cast<CreatureTemplate*>(cInfo)->unit_class = UNIT_CLASS_WARRIOR; } if (cInfo->dmgschool >= MAX_SPELL_SCHOOL) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (Entry: %u) has invalid spell school value (%u) in `dmgschool`.", cInfo->Entry, cInfo->dmgschool); + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has invalid spell school value (%u) in `dmgschool`.", cInfo->Entry, cInfo->dmgschool); const_cast<CreatureTemplate*>(cInfo)->dmgschool = SPELL_SCHOOL_NORMAL; } @@ -802,42 +803,42 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) const_cast<CreatureTemplate*>(cInfo)->rangeattacktime = BASE_ATTACK_TIME; if ((cInfo->npcflag & UNIT_NPC_FLAG_TRAINER) && cInfo->trainer_type >= MAX_TRAINER_TYPE) - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (Entry: %u) has wrong trainer type %u.", cInfo->Entry, cInfo->trainer_type); + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has wrong trainer type %u.", cInfo->Entry, cInfo->trainer_type); if (cInfo->speed_walk == 0.0f) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (Entry: %u) has wrong value (%f) in speed_walk, set to 1.", cInfo->Entry, cInfo->speed_walk); + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has wrong value (%f) in speed_walk, set to 1.", cInfo->Entry, cInfo->speed_walk); const_cast<CreatureTemplate*>(cInfo)->speed_walk = 1.0f; } if (cInfo->speed_run == 0.0f) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (Entry: %u) has wrong value (%f) in speed_run, set to 1.14286.", cInfo->Entry, cInfo->speed_run); + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has wrong value (%f) in speed_run, set to 1.14286.", cInfo->Entry, cInfo->speed_run); const_cast<CreatureTemplate*>(cInfo)->speed_run = 1.14286f; } if (cInfo->type && !sCreatureTypeStore.LookupEntry(cInfo->type)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (Entry: %u) has invalid creature type (%u) in `type`.", cInfo->Entry, cInfo->type); + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has invalid creature type (%u) in `type`.", cInfo->Entry, cInfo->type); const_cast<CreatureTemplate*>(cInfo)->type = CREATURE_TYPE_HUMANOID; } // must exist or used hidden but used in data horse case if (cInfo->family && !sCreatureFamilyStore.LookupEntry(cInfo->family) && cInfo->family != CREATURE_FAMILY_HORSE_CUSTOM) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (Entry: %u) has invalid creature family (%u) in `family`.", cInfo->Entry, cInfo->family); + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has invalid creature family (%u) in `family`.", cInfo->Entry, cInfo->family); const_cast<CreatureTemplate*>(cInfo)->family = 0; } if (cInfo->InhabitType <= 0 || cInfo->InhabitType > INHABIT_ANYWHERE) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (Entry: %u) has wrong value (%u) in `InhabitType`, creature will not correctly walk/swim/fly.", cInfo->Entry, cInfo->InhabitType); + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has wrong value (%u) in `InhabitType`, creature will not correctly walk/swim/fly.", cInfo->Entry, cInfo->InhabitType); const_cast<CreatureTemplate*>(cInfo)->InhabitType = INHABIT_ANYWHERE; } if (cInfo->HoverHeight < 0.0f) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (Entry: %u) has wrong value (%f) in `HoverHeight`", cInfo->Entry, cInfo->HoverHeight); + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has wrong value (%f) in `HoverHeight`", cInfo->Entry, cInfo->HoverHeight); const_cast<CreatureTemplate*>(cInfo)->HoverHeight = 1.0f; } @@ -846,7 +847,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) VehicleEntry const* vehId = sVehicleStore.LookupEntry(cInfo->VehicleId); if (!vehId) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (Entry: %u) has a non-existing VehicleId (%u). This *WILL* cause the client to freeze!", cInfo->Entry, cInfo->VehicleId); + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has a non-existing VehicleId (%u). This *WILL* cause the client to freeze!", cInfo->Entry, cInfo->VehicleId); const_cast<CreatureTemplate*>(cInfo)->VehicleId = 0; } } @@ -855,21 +856,21 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) { CreatureSpellDataEntry const* spellDataId = sCreatureSpellDataStore.LookupEntry(cInfo->PetSpellDataId); if (!spellDataId) - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (Entry: %u) has non-existing PetSpellDataId (%u).", cInfo->Entry, cInfo->PetSpellDataId); + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has non-existing PetSpellDataId (%u).", cInfo->Entry, cInfo->PetSpellDataId); } for (uint8 j = 0; j < CREATURE_MAX_SPELLS; ++j) { if (cInfo->spells[j] && !sSpellMgr->GetSpellInfo(cInfo->spells[j])) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (Entry: %u) has non-existing Spell%d (%u), set to 0.", cInfo->Entry, j+1, cInfo->spells[j]); + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has non-existing Spell%d (%u), set to 0.", cInfo->Entry, j+1, cInfo->spells[j]); const_cast<CreatureTemplate*>(cInfo)->spells[j] = 0; } } if (cInfo->MovementType >= MAX_DB_MOTION_TYPE) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (Entry: %u) has wrong movement generator type (%u), ignored and set to IDLE.", cInfo->Entry, cInfo->MovementType); + TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has wrong movement generator type (%u), ignored and set to IDLE.", cInfo->Entry, cInfo->MovementType); const_cast<CreatureTemplate*>(cInfo)->MovementType = IDLE_MOTION_TYPE; } @@ -884,13 +885,13 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) if (cInfo->expansion > (MAX_CREATURE_BASE_HP - 1)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `creature_template` lists creature (Entry: %u) with expansion %u. Ignored and set to 0.", cInfo->Entry, cInfo->expansion); + TC_LOG_ERROR("sql.sql", "Table `creature_template` lists creature (Entry: %u) with expansion %u. Ignored and set to 0.", cInfo->Entry, cInfo->expansion); const_cast<CreatureTemplate*>(cInfo)->expansion = 0; } if (uint32 badFlags = (cInfo->flags_extra & ~CREATURE_FLAG_EXTRA_DB_ALLOWED)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `creature_template` lists creature (Entry: %u) with disallowed `flags_extra` %u, removing incorrect flag.", cInfo->Entry, badFlags); + TC_LOG_ERROR("sql.sql", "Table `creature_template` lists creature (Entry: %u) with disallowed `flags_extra` %u, removing incorrect flag.", cInfo->Entry, badFlags); const_cast<CreatureTemplate*>(cInfo)->flags_extra &= CREATURE_FLAG_EXTRA_DB_ALLOWED; } @@ -906,7 +907,7 @@ void ObjectMgr::LoadCreatureAddons() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature addon definitions. DB table `creature_addon` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 creature addon definitions. DB table `creature_addon` is empty."); return; } @@ -920,7 +921,7 @@ void ObjectMgr::LoadCreatureAddons() CreatureData const* creData = GetCreatureData(guid); if (!creData) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (GUID: %u) does not exist but has a record in `creature_addon`", guid); + TC_LOG_ERROR("sql.sql", "Creature (GUID: %u) does not exist but has a record in `creature_addon`", guid); continue; } @@ -930,7 +931,7 @@ void ObjectMgr::LoadCreatureAddons() if (creData->movementType == WAYPOINT_MOTION_TYPE && !creatureAddon.path_id) { const_cast<CreatureData*>(creData)->movementType = IDLE_MOTION_TYPE; - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (GUID %u) has movement type set to WAYPOINT_MOTION_TYPE but no path assigned", guid); + TC_LOG_ERROR("sql.sql", "Creature (GUID %u) has movement type set to WAYPOINT_MOTION_TYPE but no path assigned", guid); } creatureAddon.mount = fields[2].GetUInt32(); @@ -946,12 +947,12 @@ void ObjectMgr::LoadCreatureAddons() SpellInfo const* AdditionalSpellInfo = sSpellMgr->GetSpellInfo(uint32(atol(*itr))); if (!AdditionalSpellInfo) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (GUID: %u) has wrong spell %u defined in `auras` field in `creature_addon`.", guid, uint32(atol(*itr))); + TC_LOG_ERROR("sql.sql", "Creature (GUID: %u) has wrong spell %u defined in `auras` field in `creature_addon`.", guid, uint32(atol(*itr))); continue; } if (AdditionalSpellInfo->HasAura(SPELL_AURA_CONTROL_VEHICLE)) - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (GUID: %u) has SPELL_AURA_CONTROL_VEHICLE aura %u defined in `auras` field in `creature_addon`.", guid, uint32(atol(*itr))); + TC_LOG_ERROR("sql.sql", "Creature (GUID: %u) has SPELL_AURA_CONTROL_VEHICLE aura %u defined in `auras` field in `creature_addon`.", guid, uint32(atol(*itr))); creatureAddon.auras[i++] = uint32(atol(*itr)); } @@ -960,14 +961,14 @@ void ObjectMgr::LoadCreatureAddons() { if (!sCreatureDisplayInfoStore.LookupEntry(creatureAddon.mount)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (GUID: %u) has invalid displayInfoId (%u) for mount defined in `creature_addon`", guid, creatureAddon.mount); + TC_LOG_ERROR("sql.sql", "Creature (GUID: %u) has invalid displayInfoId (%u) for mount defined in `creature_addon`", guid, creatureAddon.mount); creatureAddon.mount = 0; } } if (!sEmotesStore.LookupEntry(creatureAddon.emote)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature (GUID: %u) has invalid emote (%u) defined in `creature_addon`.", guid, creatureAddon.emote); + TC_LOG_ERROR("sql.sql", "Creature (GUID: %u) has invalid emote (%u) defined in `creature_addon`.", guid, creatureAddon.emote); creatureAddon.emote = 0; } @@ -975,7 +976,7 @@ void ObjectMgr::LoadCreatureAddons() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u creature addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } CreatureAddon const* ObjectMgr::GetCreatureAddon(uint32 lowguid) @@ -1031,7 +1032,7 @@ void ObjectMgr::LoadEquipmentTemplates() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature equipment templates. DB table `creature_equip_template` is empty!"); + TC_LOG_INFO("server.loading", ">> Loaded 0 creature equipment templates. DB table `creature_equip_template` is empty!"); return; } @@ -1044,7 +1045,7 @@ void ObjectMgr::LoadEquipmentTemplates() if (!sObjectMgr->GetCreatureTemplate(entry)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature template (Entry: %u) does not exist but has a record in `creature_equip_template`", entry); + TC_LOG_ERROR("sql.sql", "Creature template (Entry: %u) does not exist but has a record in `creature_equip_template`", entry); continue; } @@ -1065,7 +1066,7 @@ void ObjectMgr::LoadEquipmentTemplates() if (!dbcItem) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Unknown item (entry=%u) in creature_equip_template.itemEntry%u for entry = %u and id=%u, forced to 0.", + TC_LOG_ERROR("sql.sql", "Unknown item (entry=%u) in creature_equip_template.itemEntry%u for entry = %u and id=%u, forced to 0.", equipmentInfo.ItemEntry[i], i+1, entry, id); equipmentInfo.ItemEntry[i] = 0; continue; @@ -1081,7 +1082,7 @@ void ObjectMgr::LoadEquipmentTemplates() dbcItem->InventoryType != INVTYPE_THROWN && dbcItem->InventoryType != INVTYPE_RANGEDRIGHT) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (entry=%u) in creature_equip_template.itemEntry%u for entry = %u and id = %u is not equipable in a hand, forced to 0.", + TC_LOG_ERROR("sql.sql", "Item (entry=%u) in creature_equip_template.itemEntry%u for entry = %u and id = %u is not equipable in a hand, forced to 0.", equipmentInfo.ItemEntry[i], i+1, entry, id); equipmentInfo.ItemEntry[i] = 0; } @@ -1091,7 +1092,7 @@ void ObjectMgr::LoadEquipmentTemplates() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u equipment templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u equipment templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } CreatureModelInfo const* ObjectMgr::GetCreatureModelInfo(uint32 modelId) @@ -1142,7 +1143,7 @@ CreatureModelInfo const* ObjectMgr::GetCreatureModelRandomGender(uint32* display { CreatureModelInfo const* minfo_tmp = GetCreatureModelInfo(modelInfo->modelid_other_gender); if (!minfo_tmp) - TC_LOG_ERROR(LOG_FILTER_SQL, "Model (Entry: %u) has modelid_other_gender %u not found in table `creature_model_info`. ", *displayID, modelInfo->modelid_other_gender); + TC_LOG_ERROR("sql.sql", "Model (Entry: %u) has modelid_other_gender %u not found in table `creature_model_info`. ", *displayID, modelInfo->modelid_other_gender); else { // Model ID changed @@ -1162,7 +1163,7 @@ void ObjectMgr::LoadCreatureModelInfo() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature model definitions. DB table `creature_model_info` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 creature model definitions. DB table `creature_model_info` is empty."); return; } @@ -1185,17 +1186,17 @@ void ObjectMgr::LoadCreatureModelInfo() // Checks if (!sCreatureDisplayInfoStore.LookupEntry(modelId)) - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `creature_model_info` has model for not existed display id (%u).", modelId); + TC_LOG_ERROR("sql.sql", "Table `creature_model_info` has model for not existed display id (%u).", modelId); if (modelInfo.gender > GENDER_NONE) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `creature_model_info` has wrong gender (%u) for display id (%u).", uint32(modelInfo.gender), modelId); + TC_LOG_ERROR("sql.sql", "Table `creature_model_info` has wrong gender (%u) for display id (%u).", uint32(modelInfo.gender), modelId); modelInfo.gender = GENDER_MALE; } if (modelInfo.modelid_other_gender && !sCreatureDisplayInfoStore.LookupEntry(modelInfo.modelid_other_gender)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `creature_model_info` has not existed alt.gender model (%u) for existed display id (%u).", modelInfo.modelid_other_gender, modelId); + TC_LOG_ERROR("sql.sql", "Table `creature_model_info` has not existed alt.gender model (%u) for existed display id (%u).", modelInfo.modelid_other_gender, modelId); modelInfo.modelid_other_gender = 0; } @@ -1206,7 +1207,7 @@ void ObjectMgr::LoadCreatureModelInfo() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature model based info in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u creature model based info in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadLinkedRespawn() @@ -1219,7 +1220,7 @@ void ObjectMgr::LoadLinkedRespawn() if (!result) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 linked respawns. DB table `linked_respawn` is empty."); + TC_LOG_ERROR("server.loading", ">> Loaded 0 linked respawns. DB table `linked_respawn` is empty."); return; } @@ -1240,7 +1241,7 @@ void ObjectMgr::LoadLinkedRespawn() const CreatureData* slave = GetCreatureData(guidLow); if (!slave) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Couldn't get creature data for GUIDLow %u", guidLow); + TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature (guid) '%u' not found in creature table", guidLow); error = true; break; } @@ -1248,7 +1249,7 @@ void ObjectMgr::LoadLinkedRespawn() const CreatureData* master = GetCreatureData(linkedGuidLow); if (!master) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Couldn't get creature data for GUIDLow %u", linkedGuidLow); + TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature (linkedGuid) '%u' not found in creature table", linkedGuidLow); error = true; break; } @@ -1256,14 +1257,14 @@ void ObjectMgr::LoadLinkedRespawn() const MapEntry* const map = sMapStore.LookupEntry(master->mapid); if (!map || !map->Instanceable() || (master->mapid != slave->mapid)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow); + TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature '%u' linking to Creature '%u' on an unpermitted map.", guidLow, linkedGuidLow); error = true; break; } if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty) { - TC_LOG_ERROR(LOG_FILTER_SQL, "LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); + TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature '%u' linking to Creature '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); error = true; break; } @@ -1277,7 +1278,7 @@ void ObjectMgr::LoadLinkedRespawn() const CreatureData* slave = GetCreatureData(guidLow); if (!slave) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Couldn't get creature data for GUIDLow %u", guidLow); + TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature (guid) '%u' not found in creature table", guidLow); error = true; break; } @@ -1285,7 +1286,7 @@ void ObjectMgr::LoadLinkedRespawn() const GameObjectData* master = GetGOData(linkedGuidLow); if (!master) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Couldn't get gameobject data for GUIDLow %u", linkedGuidLow); + TC_LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject (linkedGuid) '%u' not found in gameobject table", linkedGuidLow); error = true; break; } @@ -1293,14 +1294,14 @@ void ObjectMgr::LoadLinkedRespawn() const MapEntry* const map = sMapStore.LookupEntry(master->mapid); if (!map || !map->Instanceable() || (master->mapid != slave->mapid)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow); + TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature '%u' linking to Gameobject '%u' on an unpermitted map.", guidLow, linkedGuidLow); error = true; break; } if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty) { - TC_LOG_ERROR(LOG_FILTER_SQL, "LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); + TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature '%u' linking to Gameobject '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); error = true; break; } @@ -1314,7 +1315,7 @@ void ObjectMgr::LoadLinkedRespawn() const GameObjectData* slave = GetGOData(guidLow); if (!slave) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Couldn't get gameobject data for GUIDLow %u", guidLow); + TC_LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject (guid) '%u' not found in gameobject table", guidLow); error = true; break; } @@ -1322,7 +1323,7 @@ void ObjectMgr::LoadLinkedRespawn() const GameObjectData* master = GetGOData(linkedGuidLow); if (!master) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Couldn't get gameobject data for GUIDLow %u", linkedGuidLow); + TC_LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject (linkedGuid) '%u' not found in gameobject table", linkedGuidLow); error = true; break; } @@ -1330,14 +1331,14 @@ void ObjectMgr::LoadLinkedRespawn() const MapEntry* const map = sMapStore.LookupEntry(master->mapid); if (!map || !map->Instanceable() || (master->mapid != slave->mapid)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow); + TC_LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject '%u' linking to Gameobject '%u' on an unpermitted map.", guidLow, linkedGuidLow); error = true; break; } if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty) { - TC_LOG_ERROR(LOG_FILTER_SQL, "LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); + TC_LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject '%u' linking to Gameobject '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); error = true; break; } @@ -1351,7 +1352,7 @@ void ObjectMgr::LoadLinkedRespawn() const GameObjectData* slave = GetGOData(guidLow); if (!slave) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Couldn't get gameobject data for GUIDLow %u", guidLow); + TC_LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject (guid) '%u' not found in gameobject table", guidLow); error = true; break; } @@ -1359,7 +1360,7 @@ void ObjectMgr::LoadLinkedRespawn() const CreatureData* master = GetCreatureData(linkedGuidLow); if (!master) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Couldn't get creature data for GUIDLow %u", linkedGuidLow); + TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature (linkedGuid) '%u' not found in creature table", linkedGuidLow); error = true; break; } @@ -1367,14 +1368,14 @@ void ObjectMgr::LoadLinkedRespawn() const MapEntry* const map = sMapStore.LookupEntry(master->mapid); if (!map || !map->Instanceable() || (master->mapid != slave->mapid)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow); + TC_LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject '%u' linking to Creature '%u' on an unpermitted map.", guidLow, linkedGuidLow); error = true; break; } if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty) { - TC_LOG_ERROR(LOG_FILTER_SQL, "LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); + TC_LOG_ERROR("sql.sql", "LinkedRespawn: Gameobject '%u' linking to Creature '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); error = true; break; } @@ -1390,7 +1391,7 @@ void ObjectMgr::LoadLinkedRespawn() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded " UI64FMTD " linked respawns in %u ms", uint64(_linkedRespawnStore.size()), GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded " UI64FMTD " linked respawns in %u ms", uint64(_linkedRespawnStore.size()), GetMSTimeDiffToNow(oldMSTime)); } bool ObjectMgr::SetCreatureLinkedRespawn(uint32 guidLow, uint32 linkedGuidLow) @@ -1411,17 +1412,22 @@ bool ObjectMgr::SetCreatureLinkedRespawn(uint32 guidLow, uint32 linkedGuidLow) } const CreatureData* slave = GetCreatureData(linkedGuidLow); + if (!slave) + { + TC_LOG_ERROR("sql.sql", "Creature '%u' linking to non-existent creature '%u'.", guidLow, linkedGuidLow); + return false; + } const MapEntry* const map = sMapStore.LookupEntry(master->mapid); if (!map || !map->Instanceable() || (master->mapid != slave->mapid)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow); + TC_LOG_ERROR("sql.sql", "Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow); return false; } if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty) { - TC_LOG_ERROR(LOG_FILTER_SQL, "LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); + TC_LOG_ERROR("sql.sql", "LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); return false; } @@ -1446,7 +1452,7 @@ void ObjectMgr::LoadTempSummons() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 temp summons. DB table `creature_summon_groups` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 temp summons. DB table `creature_summon_groups` is empty."); return; } @@ -1464,26 +1470,26 @@ void ObjectMgr::LoadTempSummons() case SUMMONER_TYPE_CREATURE: if (!GetCreatureTemplate(summonerId)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `creature_summon_groups` has summoner with non existing entry %u for creature summoner type, skipped.", summonerId); + TC_LOG_ERROR("sql.sql", "Table `creature_summon_groups` has summoner with non existing entry %u for creature summoner type, skipped.", summonerId); continue; } break; case SUMMONER_TYPE_GAMEOBJECT: if (!GetGameObjectTemplate(summonerId)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `creature_summon_groups` has summoner with non existing entry %u for gameobject summoner type, skipped.", summonerId); + TC_LOG_ERROR("sql.sql", "Table `creature_summon_groups` has summoner with non existing entry %u for gameobject summoner type, skipped.", summonerId); continue; } break; case SUMMONER_TYPE_MAP: if (!sMapStore.LookupEntry(summonerId)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `creature_summon_groups` has summoner with non existing entry %u for map summoner type, skipped.", summonerId); + TC_LOG_ERROR("sql.sql", "Table `creature_summon_groups` has summoner with non existing entry %u for map summoner type, skipped.", summonerId); continue; } break; default: - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `creature_summon_groups` has unhandled summoner type %u for summoner %u, skipped.", summonerType, summonerId); + TC_LOG_ERROR("sql.sql", "Table `creature_summon_groups` has unhandled summoner type %u for summoner %u, skipped.", summonerType, summonerId); continue; } @@ -1492,7 +1498,7 @@ void ObjectMgr::LoadTempSummons() if (!GetCreatureTemplate(data.entry)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `creature_summon_groups` has creature in group [Summoner ID: %u, Summoner Type: %u, Group ID: %u] with non existing creature entry %u, skipped.", summonerId, summonerType, group, data.entry); + TC_LOG_ERROR("sql.sql", "Table `creature_summon_groups` has creature in group [Summoner ID: %u, Summoner Type: %u, Group ID: %u] with non existing creature entry %u, skipped.", summonerId, summonerType, group, data.entry); continue; } @@ -1507,7 +1513,7 @@ void ObjectMgr::LoadTempSummons() if (data.type > TEMPSUMMON_MANUAL_DESPAWN) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `creature_summon_groups` has unhandled temp summon type %u in group [Summoner ID: %u, Summoner Type: %u, Group ID: %u] for creature entry %u, skipped.", data.type, summonerId, summonerType, group, data.entry); + TC_LOG_ERROR("sql.sql", "Table `creature_summon_groups` has unhandled temp summon type %u in group [Summoner ID: %u, Summoner Type: %u, Group ID: %u] for creature entry %u, skipped.", data.type, summonerId, summonerType, group, data.entry); continue; } @@ -1520,7 +1526,7 @@ void ObjectMgr::LoadTempSummons() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u temp summons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u temp summons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadCreatures() @@ -1537,7 +1543,7 @@ void ObjectMgr::LoadCreatures() if (!result) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creatures. DB table `creature` is empty."); + TC_LOG_ERROR("server.loading", ">> Loaded 0 creatures. DB table `creature` is empty."); return; } @@ -1561,7 +1567,7 @@ void ObjectMgr::LoadCreatures() CreatureTemplate const* cInfo = GetCreatureTemplate(entry); if (!cInfo) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `creature` has creature (GUID: %u) with non existing creature entry %u, skipped.", guid, entry); + TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: %u) with non existing creature entry %u, skipped.", guid, entry); continue; } @@ -1591,19 +1597,19 @@ void ObjectMgr::LoadCreatures() MapEntry const* mapEntry = sMapStore.LookupEntry(data.mapid); if (!mapEntry) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `creature` have creature (GUID: %u) that spawned at not existed map (Id: %u), skipped.", guid, data.mapid); + TC_LOG_ERROR("sql.sql", "Table `creature` have creature (GUID: %u) that spawned at not existed map (Id: %u), skipped.", guid, data.mapid); continue; } if (data.spawnMask & ~spawnMasks[data.mapid]) - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `creature` have creature (GUID: %u) that have wrong spawn mask %u including not supported difficulty modes for map (Id: %u).", guid, data.spawnMask, data.mapid); + TC_LOG_ERROR("sql.sql", "Table `creature` have creature (GUID: %u) that have wrong spawn mask %u including not supported difficulty modes for map (Id: %u).", guid, data.spawnMask, data.mapid); bool ok = true; for (uint32 diff = 0; diff < MAX_DIFFICULTY - 1 && ok; ++diff) { if (_difficultyEntries[diff].find(data.id) != _difficultyEntries[diff].end()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `creature` have creature (GUID: %u) that listed as difficulty %u template (entry: %u) in `creature_template`, skipped.", + TC_LOG_ERROR("sql.sql", "Table `creature` have creature (GUID: %u) that listed as difficulty %u template (entry: %u) in `creature_template`, skipped.", guid, diff + 1, data.id); ok = false; } @@ -1616,7 +1622,7 @@ void ObjectMgr::LoadCreatures() { if (!GetEquipmentInfo(data.id, data.equipmentId)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `creature` have creature (Entry: %u) with equipment_id %u not found in table `creature_equip_template`, set to no equipment.", data.id, data.equipmentId); + TC_LOG_ERROR("sql.sql", "Table `creature` have creature (Entry: %u) with equipment_id %u not found in table `creature_equip_template`, set to no equipment.", data.id, data.equipmentId); data.equipmentId = 0; } } @@ -1624,19 +1630,19 @@ void ObjectMgr::LoadCreatures() if (cInfo->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND) { if (!mapEntry || !mapEntry->IsDungeon()) - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `creature` have creature (GUID: %u Entry: %u) with `creature_template`.`flags_extra` including CREATURE_FLAG_EXTRA_INSTANCE_BIND but creature are not in instance.", guid, data.id); + TC_LOG_ERROR("sql.sql", "Table `creature` have creature (GUID: %u Entry: %u) with `creature_template`.`flags_extra` including CREATURE_FLAG_EXTRA_INSTANCE_BIND but creature are not in instance.", guid, data.id); } if (data.spawndist < 0.0f) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `creature` have creature (GUID: %u Entry: %u) with `spawndist`< 0, set to 0.", guid, data.id); + TC_LOG_ERROR("sql.sql", "Table `creature` have creature (GUID: %u Entry: %u) with `spawndist`< 0, set to 0.", guid, data.id); data.spawndist = 0.0f; } else if (data.movementType == RANDOM_MOTION_TYPE) { if (data.spawndist == 0.0f) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `creature` have creature (GUID: %u Entry: %u) with `MovementType`=1 (random movement) but with `spawndist`=0, replace by idle movement type (0).", guid, data.id); + TC_LOG_ERROR("sql.sql", "Table `creature` have creature (GUID: %u Entry: %u) with `MovementType`=1 (random movement) but with `spawndist`=0, replace by idle movement type (0).", guid, data.id); data.movementType = IDLE_MOTION_TYPE; } } @@ -1644,14 +1650,14 @@ void ObjectMgr::LoadCreatures() { if (data.spawndist != 0.0f) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `creature` have creature (GUID: %u Entry: %u) with `MovementType`=0 (idle) have `spawndist`<>0, set to 0.", guid, data.id); + TC_LOG_ERROR("sql.sql", "Table `creature` have creature (GUID: %u Entry: %u) with `MovementType`=0 (idle) have `spawndist`<>0, set to 0.", guid, data.id); data.spawndist = 0.0f; } } if (data.phaseMask == 0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `creature` have creature (GUID: %u Entry: %u) with `phaseMask`=0 (not visible for anyone), set to 1.", guid, data.id); + TC_LOG_ERROR("sql.sql", "Table `creature` have creature (GUID: %u Entry: %u) with `phaseMask`=0 (not visible for anyone), set to 1.", guid, data.id); data.phaseMask = 1; } @@ -1663,7 +1669,7 @@ void ObjectMgr::LoadCreatures() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creatures in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u creatures in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::AddCreatureToGrid(uint32 guid, CreatureData const* data) @@ -1733,13 +1739,13 @@ uint32 ObjectMgr::AddGOData(uint32 entry, uint32 mapId, float x, float y, float GameObject* go = new GameObject; if (!go->LoadGameObjectFromDB(guid, map)) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "AddGOData: cannot add gameobject entry %u to map", entry); + TC_LOG_ERROR("misc", "AddGOData: cannot add gameobject entry %u to map", entry); delete go; return 0; } } - TC_LOG_DEBUG(LOG_FILTER_MAPS, "AddGOData: dbguid %u entry %u map %u x %f y %f z %f o %f", guid, entry, mapId, x, y, z, o); + TC_LOG_DEBUG("maps", "AddGOData: dbguid %u entry %u map %u x %f y %f z %f o %f", guid, entry, mapId, x, y, z, o); return guid; } @@ -1768,7 +1774,7 @@ bool ObjectMgr::MoveCreData(uint32 guid, uint32 mapId, const Position& pos) Creature* creature = new Creature; if (!creature->LoadCreatureFromDB(guid, map)) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "MoveCreData: Cannot add creature guid %u to map", guid); + TC_LOG_ERROR("misc", "MoveCreData: Cannot add creature guid %u to map", guid); delete creature; return false; } @@ -1820,7 +1826,7 @@ uint32 ObjectMgr::AddCreData(uint32 entry, uint32 /*team*/, uint32 mapId, float Creature* creature = new Creature; if (!creature->LoadCreatureFromDB(guid, map)) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "AddCreature: Cannot add creature entry %u to map", entry); + TC_LOG_ERROR("misc", "AddCreature: Cannot add creature entry %u to map", entry); delete creature; return 0; } @@ -1845,7 +1851,7 @@ void ObjectMgr::LoadGameobjects() if (!result) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 gameobjects. DB table `gameobject` is empty."); + TC_LOG_ERROR("server.loading", ">> Loaded 0 gameobjects. DB table `gameobject` is empty."); return; } @@ -1868,7 +1874,7 @@ void ObjectMgr::LoadGameobjects() GameObjectTemplate const* gInfo = GetGameObjectTemplate(entry); if (!gInfo) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `gameobject` has gameobject (GUID: %u) with non existing gameobject entry %u, skipped.", guid, entry); + TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: %u) with non existing gameobject entry %u, skipped.", guid, entry); continue; } @@ -1880,14 +1886,14 @@ void ObjectMgr::LoadGameobjects() case GAMEOBJECT_TYPE_SPELL_FOCUS: break; default: - TC_LOG_ERROR(LOG_FILTER_SQL, "Gameobject (GUID: %u Entry %u GoType: %u) doesn't have a displayId (%u), not loaded.", guid, entry, gInfo->type, gInfo->displayId); + TC_LOG_ERROR("sql.sql", "Gameobject (GUID: %u Entry %u GoType: %u) doesn't have a displayId (%u), not loaded.", guid, entry, gInfo->type, gInfo->displayId); break; } } if (gInfo->displayId && !sGameObjectDisplayInfoStore.LookupEntry(gInfo->displayId)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Gameobject (GUID: %u Entry %u GoType: %u) has an invalid displayId (%u), not loaded.", guid, entry, gInfo->type, gInfo->displayId); + TC_LOG_ERROR("sql.sql", "Gameobject (GUID: %u Entry %u GoType: %u) has an invalid displayId (%u), not loaded.", guid, entry, gInfo->type, gInfo->displayId); continue; } @@ -1908,13 +1914,13 @@ void ObjectMgr::LoadGameobjects() MapEntry const* mapEntry = sMapStore.LookupEntry(data.mapid); if (!mapEntry) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `gameobject` has gameobject (GUID: %u Entry: %u) spawned on a non-existed map (Id: %u), skip", guid, data.id, data.mapid); + TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: %u Entry: %u) spawned on a non-existed map (Id: %u), skip", guid, data.id, data.mapid); continue; } if (data.spawntimesecs == 0 && gInfo->IsDespawnAtAction()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `gameobject` has gameobject (GUID: %u Entry: %u) with `spawntimesecs` (0) value, but the gameobejct is marked as despawnable at action.", guid, data.id); + TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: %u Entry: %u) with `spawntimesecs` (0) value, but the gameobejct is marked as despawnable at action.", guid, data.id); } data.animprogress = fields[12].GetUInt8(); @@ -1923,7 +1929,7 @@ void ObjectMgr::LoadGameobjects() uint32 go_state = fields[13].GetUInt8(); if (go_state >= MAX_GO_STATE) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid `state` (%u) value, skip", guid, data.id, go_state); + TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid `state` (%u) value, skip", guid, data.id, go_state); continue; } data.go_state = GOState(go_state); @@ -1931,7 +1937,7 @@ void ObjectMgr::LoadGameobjects() data.spawnMask = fields[14].GetUInt8(); if (data.spawnMask & ~spawnMasks[data.mapid]) - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `gameobject` has gameobject (GUID: %u Entry: %u) that has wrong spawn mask %u including not supported difficulty modes for map (Id: %u), skip", guid, data.id, data.spawnMask, data.mapid); + TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: %u Entry: %u) that has wrong spawn mask %u including not supported difficulty modes for map (Id: %u), skip", guid, data.id, data.spawnMask, data.mapid); data.phaseMask = fields[15].GetUInt32(); int16 gameEvent = fields[16].GetInt8(); @@ -1939,25 +1945,25 @@ void ObjectMgr::LoadGameobjects() if (data.rotation2 < -1.0f || data.rotation2 > 1.0f) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid rotation2 (%f) value, skip", guid, data.id, data.rotation2); + TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid rotation2 (%f) value, skip", guid, data.id, data.rotation2); continue; } if (data.rotation3 < -1.0f || data.rotation3 > 1.0f) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid rotation3 (%f) value, skip", guid, data.id, data.rotation3); + TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid rotation3 (%f) value, skip", guid, data.id, data.rotation3); continue; } if (!MapManager::IsValidMapCoord(data.mapid, data.posX, data.posY, data.posZ, data.orientation)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid coordinates, skip", guid, data.id); + TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid coordinates, skip", guid, data.id); continue; } if (data.phaseMask == 0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `gameobject` has gameobject (GUID: %u Entry: %u) with `phaseMask`=0 (not visible for anyone), set to 1.", guid, data.id); + TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: %u Entry: %u) with `phaseMask`=0 (not visible for anyone), set to 1.", guid, data.id); data.phaseMask = 1; } @@ -1966,7 +1972,7 @@ void ObjectMgr::LoadGameobjects() ++count; } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu gameobjects in %u ms", (unsigned long)_gameObjectDataStore.size(), GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %lu gameobjects in %u ms", (unsigned long)_gameObjectDataStore.size(), GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::AddGameobjectToGrid(uint32 guid, GameObjectData const* data) @@ -2134,7 +2140,7 @@ void ObjectMgr::LoadItemLocales() } } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu Item locale strings in %u ms", (unsigned long)_itemLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %lu Item locale strings in %u ms", (unsigned long)_itemLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadItemTemplates() @@ -2176,7 +2182,7 @@ void ObjectMgr::LoadItemTemplates() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 item templates. DB table `item_template` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 item templates. DB table `item_template` is empty."); return; } @@ -2306,61 +2312,61 @@ void ObjectMgr::LoadItemTemplates() { if (itemTemplate.Class != dbcitem->Class) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) does not have a correct class %u, must be %u .", entry, itemTemplate.Class, dbcitem->Class); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) does not have a correct class %u, must be %u .", entry, itemTemplate.Class, dbcitem->Class); if (enforceDBCAttributes) itemTemplate.Class = dbcitem->Class; } if (itemTemplate.SoundOverrideSubclass != dbcitem->SoundOverrideSubclass) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) does not have a correct SoundOverrideSubclass (%i), must be %i .", entry, itemTemplate.SoundOverrideSubclass, dbcitem->SoundOverrideSubclass); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) does not have a correct SoundOverrideSubclass (%i), must be %i .", entry, itemTemplate.SoundOverrideSubclass, dbcitem->SoundOverrideSubclass); if (enforceDBCAttributes) itemTemplate.SoundOverrideSubclass = dbcitem->SoundOverrideSubclass; } if (itemTemplate.Material != dbcitem->Material) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) does not have a correct material (%i), must be %i .", entry, itemTemplate.Material, dbcitem->Material); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) does not have a correct material (%i), must be %i .", entry, itemTemplate.Material, dbcitem->Material); if (enforceDBCAttributes) itemTemplate.Material = dbcitem->Material; } if (itemTemplate.InventoryType != dbcitem->InventoryType) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) does not have a correct inventory type (%u), must be %u .", entry, itemTemplate.InventoryType, dbcitem->InventoryType); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) does not have a correct inventory type (%u), must be %u .", entry, itemTemplate.InventoryType, dbcitem->InventoryType); if (enforceDBCAttributes) itemTemplate.InventoryType = dbcitem->InventoryType; } if (itemTemplate.DisplayInfoID != dbcitem->DisplayId) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) does not have a correct display id (%u), must be %u .", entry, itemTemplate.DisplayInfoID, dbcitem->DisplayId); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) does not have a correct display id (%u), must be %u .", entry, itemTemplate.DisplayInfoID, dbcitem->DisplayId); if (enforceDBCAttributes) itemTemplate.DisplayInfoID = dbcitem->DisplayId; } if (itemTemplate.Sheath != dbcitem->Sheath) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) does not have a correct sheathid (%u), must be %u .", entry, itemTemplate.Sheath, dbcitem->Sheath); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) does not have a correct sheathid (%u), must be %u .", entry, itemTemplate.Sheath, dbcitem->Sheath); if (enforceDBCAttributes) itemTemplate.Sheath = dbcitem->Sheath; } } else - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) does not exist in item.dbc! (not correct id?).", entry); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) does not exist in item.dbc! (not correct id?).", entry); if (itemTemplate.Class >= MAX_ITEM_CLASS) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has wrong Class value (%u)", entry, itemTemplate.Class); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong Class value (%u)", entry, itemTemplate.Class); itemTemplate.Class = ITEM_CLASS_MISC; } if (itemTemplate.SubClass >= MaxItemSubclassValues[itemTemplate.Class]) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has wrong Subclass value (%u) for class %u", entry, itemTemplate.SubClass, itemTemplate.Class); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong Subclass value (%u) for class %u", entry, itemTemplate.SubClass, itemTemplate.Class); itemTemplate.SubClass = 0;// exist for all item classes } if (itemTemplate.Quality >= MAX_ITEM_QUALITY) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has wrong Quality value (%u)", entry, itemTemplate.Quality); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong Quality value (%u)", entry, itemTemplate.Quality); itemTemplate.Quality = ITEM_QUALITY_NORMAL; } @@ -2368,36 +2374,36 @@ void ObjectMgr::LoadItemTemplates() { if (FactionEntry const* faction = sFactionStore.LookupEntry(HORDE)) if ((itemTemplate.AllowableRace & faction->BaseRepRaceMask[0]) == 0) - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has value (%u) in `AllowableRace` races, not compatible with ITEM_FLAGS_EXTRA_HORDE_ONLY (%u) in Flags field, item cannot be equipped or used by these races.", + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has value (%u) in `AllowableRace` races, not compatible with ITEM_FLAGS_EXTRA_HORDE_ONLY (%u) in Flags field, item cannot be equipped or used by these races.", entry, itemTemplate.AllowableRace, ITEM_FLAGS_EXTRA_HORDE_ONLY); if (itemTemplate.Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has value (%u) in `Flags2` flags (ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) and ITEM_FLAGS_EXTRA_HORDE_ONLY (%u) in Flags field, this is a wrong combination.", + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has value (%u) in `Flags2` flags (ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) and ITEM_FLAGS_EXTRA_HORDE_ONLY (%u) in Flags field, this is a wrong combination.", entry, ITEM_FLAGS_EXTRA_ALLIANCE_ONLY, ITEM_FLAGS_EXTRA_HORDE_ONLY); } else if (itemTemplate.Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) { if (FactionEntry const* faction = sFactionStore.LookupEntry(ALLIANCE)) if ((itemTemplate.AllowableRace & faction->BaseRepRaceMask[0]) == 0) - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has value (%u) in `AllowableRace` races, not compatible with ITEM_FLAGS_EXTRA_ALLIANCE_ONLY (%u) in Flags field, item cannot be equipped or used by these races.", + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has value (%u) in `AllowableRace` races, not compatible with ITEM_FLAGS_EXTRA_ALLIANCE_ONLY (%u) in Flags field, item cannot be equipped or used by these races.", entry, itemTemplate.AllowableRace, ITEM_FLAGS_EXTRA_ALLIANCE_ONLY); } if (itemTemplate.BuyCount <= 0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has wrong BuyCount value (%u), set to default(1).", entry, itemTemplate.BuyCount); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong BuyCount value (%u), set to default(1).", entry, itemTemplate.BuyCount); itemTemplate.BuyCount = 1; } if (itemTemplate.InventoryType >= MAX_INVTYPE) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has wrong InventoryType value (%u)", entry, itemTemplate.InventoryType); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong InventoryType value (%u)", entry, itemTemplate.InventoryType); itemTemplate.InventoryType = INVTYPE_NON_EQUIP; } if (itemTemplate.RequiredSkill >= MAX_SKILL_TYPE) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has wrong RequiredSkill value (%u)", entry, itemTemplate.RequiredSkill); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong RequiredSkill value (%u)", entry, itemTemplate.RequiredSkill); itemTemplate.RequiredSkill = 0; } @@ -2417,60 +2423,60 @@ void ObjectMgr::LoadItemTemplates() if (req) { if (!(itemTemplate.AllowableClass & CLASSMASK_ALL_PLAYABLE)) - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) does not have any playable classes (%u) in `AllowableClass` and can't be equipped or used.", entry, itemTemplate.AllowableClass); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) does not have any playable classes (%u) in `AllowableClass` and can't be equipped or used.", entry, itemTemplate.AllowableClass); if (!(itemTemplate.AllowableRace & RACEMASK_ALL_PLAYABLE)) - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) does not have any playable races (%u) in `AllowableRace` and can't be equipped or used.", entry, itemTemplate.AllowableRace); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) does not have any playable races (%u) in `AllowableRace` and can't be equipped or used.", entry, itemTemplate.AllowableRace); } } if (itemTemplate.RequiredSpell && !sSpellMgr->GetSpellInfo(itemTemplate.RequiredSpell)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has a wrong (non-existing) spell in RequiredSpell (%u)", entry, itemTemplate.RequiredSpell); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has a wrong (non-existing) spell in RequiredSpell (%u)", entry, itemTemplate.RequiredSpell); itemTemplate.RequiredSpell = 0; } if (itemTemplate.RequiredReputationRank >= MAX_REPUTATION_RANK) - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has wrong reputation rank in RequiredReputationRank (%u), item can't be used.", entry, itemTemplate.RequiredReputationRank); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong reputation rank in RequiredReputationRank (%u), item can't be used.", entry, itemTemplate.RequiredReputationRank); if (itemTemplate.RequiredReputationFaction) { if (!sFactionStore.LookupEntry(itemTemplate.RequiredReputationFaction)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has wrong (not existing) faction in RequiredReputationFaction (%u)", entry, itemTemplate.RequiredReputationFaction); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong (not existing) faction in RequiredReputationFaction (%u)", entry, itemTemplate.RequiredReputationFaction); itemTemplate.RequiredReputationFaction = 0; } if (itemTemplate.RequiredReputationRank == MIN_REPUTATION_RANK) - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has min. reputation rank in RequiredReputationRank (0) but RequiredReputationFaction > 0, faction setting is useless.", entry); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has min. reputation rank in RequiredReputationRank (0) but RequiredReputationFaction > 0, faction setting is useless.", entry); } if (itemTemplate.MaxCount < -1) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has too large negative in maxcount (%i), replace by value (-1) no storing limits.", entry, itemTemplate.MaxCount); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has too large negative in maxcount (%i), replace by value (-1) no storing limits.", entry, itemTemplate.MaxCount); itemTemplate.MaxCount = -1; } if (itemTemplate.Stackable == 0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has wrong value in stackable (%i), replace by default 1.", entry, itemTemplate.Stackable); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong value in stackable (%i), replace by default 1.", entry, itemTemplate.Stackable); itemTemplate.Stackable = 1; } else if (itemTemplate.Stackable < -1) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has too large negative in stackable (%i), replace by value (-1) no stacking limits.", entry, itemTemplate.Stackable); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has too large negative in stackable (%i), replace by value (-1) no stacking limits.", entry, itemTemplate.Stackable); itemTemplate.Stackable = -1; } if (itemTemplate.ContainerSlots > MAX_BAG_SIZE) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has too large value in ContainerSlots (%u), replace by hardcoded limit (%u).", entry, itemTemplate.ContainerSlots, MAX_BAG_SIZE); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has too large value in ContainerSlots (%u), replace by hardcoded limit (%u).", entry, itemTemplate.ContainerSlots, MAX_BAG_SIZE); itemTemplate.ContainerSlots = MAX_BAG_SIZE; } if (itemTemplate.StatsCount > MAX_ITEM_PROTO_STATS) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has too large value in statscount (%u), replace by hardcoded limit (%u).", entry, itemTemplate.StatsCount, MAX_ITEM_PROTO_STATS); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has too large value in statscount (%u), replace by hardcoded limit (%u).", entry, itemTemplate.StatsCount, MAX_ITEM_PROTO_STATS); itemTemplate.StatsCount = MAX_ITEM_PROTO_STATS; } @@ -2479,7 +2485,7 @@ void ObjectMgr::LoadItemTemplates() // for ItemStatValue != 0 if (itemTemplate.ItemStat[j].ItemStatValue && itemTemplate.ItemStat[j].ItemStatType >= MAX_ITEM_MOD) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has wrong (non-existing?) stat_type%d (%u)", entry, j+1, itemTemplate.ItemStat[j].ItemStatType); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong (non-existing?) stat_type%d (%u)", entry, j+1, itemTemplate.ItemStat[j].ItemStatType); itemTemplate.ItemStat[j].ItemStatType = 0; } @@ -2487,7 +2493,7 @@ void ObjectMgr::LoadItemTemplates() { case ITEM_MOD_SPELL_HEALING_DONE: case ITEM_MOD_SPELL_DAMAGE_DONE: - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has deprecated stat_type%d (%u)", entry, j+1, itemTemplate.ItemStat[j].ItemStatType); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has deprecated stat_type%d (%u)", entry, j+1, itemTemplate.ItemStat[j].ItemStatType); break; default: break; @@ -2498,7 +2504,7 @@ void ObjectMgr::LoadItemTemplates() { if (itemTemplate.Damage[j].DamageType >= MAX_SPELL_SCHOOL) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has wrong dmg_type%d (%u)", entry, j+1, itemTemplate.Damage[j].DamageType); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong dmg_type%d (%u)", entry, j+1, itemTemplate.Damage[j].DamageType); itemTemplate.Damage[j].DamageType = 0; } } @@ -2509,7 +2515,7 @@ void ObjectMgr::LoadItemTemplates() // spell_1 if (itemTemplate.Spells[0].SpellTrigger != ITEM_SPELLTRIGGER_ON_USE) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u) for special learning format", entry, 0+1, itemTemplate.Spells[0].SpellTrigger); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u) for special learning format", entry, 0+1, itemTemplate.Spells[0].SpellTrigger); itemTemplate.Spells[0].SpellId = 0; itemTemplate.Spells[0].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; itemTemplate.Spells[1].SpellId = 0; @@ -2519,14 +2525,14 @@ void ObjectMgr::LoadItemTemplates() // spell_2 have learning spell if (itemTemplate.Spells[1].SpellTrigger != ITEM_SPELLTRIGGER_LEARN_SPELL_ID) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u) for special learning format.", entry, 1+1, itemTemplate.Spells[1].SpellTrigger); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u) for special learning format.", entry, 1+1, itemTemplate.Spells[1].SpellTrigger); itemTemplate.Spells[0].SpellId = 0; itemTemplate.Spells[1].SpellId = 0; itemTemplate.Spells[1].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; } else if (!itemTemplate.Spells[1].SpellId) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) does not have an expected spell in spellid_%d in special learning format.", entry, 1+1); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) does not have an expected spell in spellid_%d in special learning format.", entry, 1+1); itemTemplate.Spells[0].SpellId = 0; itemTemplate.Spells[1].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; } @@ -2535,7 +2541,7 @@ void ObjectMgr::LoadItemTemplates() SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itemTemplate.Spells[1].SpellId); if (!spellInfo && !DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, itemTemplate.Spells[1].SpellId, NULL)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%d)", entry, 1+1, itemTemplate.Spells[1].SpellId); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%d)", entry, 1+1, itemTemplate.Spells[1].SpellId); itemTemplate.Spells[0].SpellId = 0; itemTemplate.Spells[1].SpellId = 0; itemTemplate.Spells[1].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; @@ -2543,7 +2549,7 @@ void ObjectMgr::LoadItemTemplates() // allowed only in special format else if ((itemTemplate.Spells[1].SpellId == 483) || (itemTemplate.Spells[1].SpellId == 55884)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has broken spell in spellid_%d (%d)", entry, 1+1, itemTemplate.Spells[1].SpellId); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has broken spell in spellid_%d (%d)", entry, 1+1, itemTemplate.Spells[1].SpellId); itemTemplate.Spells[0].SpellId = 0; itemTemplate.Spells[1].SpellId = 0; itemTemplate.Spells[1].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; @@ -2555,13 +2561,13 @@ void ObjectMgr::LoadItemTemplates() { if (itemTemplate.Spells[j].SpellTrigger != ITEM_SPELLTRIGGER_ON_USE) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u)", entry, j+1, itemTemplate.Spells[j].SpellTrigger); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u)", entry, j+1, itemTemplate.Spells[j].SpellTrigger); itemTemplate.Spells[j].SpellId = 0; itemTemplate.Spells[j].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; } else if (itemTemplate.Spells[j].SpellId != 0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has wrong spell in spellid_%d (%d) for learning special format", entry, j+1, itemTemplate.Spells[j].SpellId); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong spell in spellid_%d (%d) for learning special format", entry, j+1, itemTemplate.Spells[j].SpellId); itemTemplate.Spells[j].SpellId = 0; } } @@ -2573,7 +2579,7 @@ void ObjectMgr::LoadItemTemplates() { if (itemTemplate.Spells[j].SpellTrigger >= MAX_ITEM_SPELLTRIGGER || itemTemplate.Spells[j].SpellTrigger == ITEM_SPELLTRIGGER_LEARN_SPELL_ID) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u)", entry, j+1, itemTemplate.Spells[j].SpellTrigger); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u)", entry, j+1, itemTemplate.Spells[j].SpellTrigger); itemTemplate.Spells[j].SpellId = 0; itemTemplate.Spells[j].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; } @@ -2583,13 +2589,13 @@ void ObjectMgr::LoadItemTemplates() SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itemTemplate.Spells[j].SpellId); if (!spellInfo && !DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, itemTemplate.Spells[j].SpellId, NULL)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%d)", entry, j+1, itemTemplate.Spells[j].SpellId); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%d)", entry, j+1, itemTemplate.Spells[j].SpellId); itemTemplate.Spells[j].SpellId = 0; } // allowed only in special format else if ((itemTemplate.Spells[j].SpellId == 483) || (itemTemplate.Spells[j].SpellId == 55884)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has broken spell in spellid_%d (%d)", entry, j+1, itemTemplate.Spells[j].SpellId); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has broken spell in spellid_%d (%d)", entry, j+1, itemTemplate.Spells[j].SpellId); itemTemplate.Spells[j].SpellId = 0; } } @@ -2597,17 +2603,17 @@ void ObjectMgr::LoadItemTemplates() } if (itemTemplate.Bonding >= MAX_BIND_TYPE) - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has wrong Bonding value (%u)", entry, itemTemplate.Bonding); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong Bonding value (%u)", entry, itemTemplate.Bonding); if (itemTemplate.PageText && !GetPageText(itemTemplate.PageText)) - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has non existing first page (Id:%u)", entry, itemTemplate.PageText); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has non existing first page (Id:%u)", entry, itemTemplate.PageText); if (itemTemplate.LockID && !sLockStore.LookupEntry(itemTemplate.LockID)) - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has wrong LockID (%u)", entry, itemTemplate.LockID); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong LockID (%u)", entry, itemTemplate.LockID); if (itemTemplate.Sheath >= MAX_SHEATHETYPE) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has wrong Sheath (%u)", entry, itemTemplate.Sheath); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong Sheath (%u)", entry, itemTemplate.Sheath); itemTemplate.Sheath = SHEATHETYPE_NONE; } @@ -2619,28 +2625,28 @@ void ObjectMgr::LoadItemTemplates() else if (!sItemRandomPropertiesStore.LookupEntry(GetItemEnchantMod(itemTemplate.RandomProperty))) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has unknown (wrong or not listed in `item_enchantment_template`) RandomProperty (%u)", entry, itemTemplate.RandomProperty); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has unknown (wrong or not listed in `item_enchantment_template`) RandomProperty (%u)", entry, itemTemplate.RandomProperty); itemTemplate.RandomProperty = 0; } } if (itemTemplate.RandomSuffix && !sItemRandomSuffixStore.LookupEntry(GetItemEnchantMod(itemTemplate.RandomSuffix))) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has wrong RandomSuffix (%u)", entry, itemTemplate.RandomSuffix); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong RandomSuffix (%u)", entry, itemTemplate.RandomSuffix); itemTemplate.RandomSuffix = 0; } if (itemTemplate.ItemSet && !sItemSetStore.LookupEntry(itemTemplate.ItemSet)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) have wrong ItemSet (%u)", entry, itemTemplate.ItemSet); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) have wrong ItemSet (%u)", entry, itemTemplate.ItemSet); itemTemplate.ItemSet = 0; } if (itemTemplate.Area && !GetAreaEntryByAreaID(itemTemplate.Area)) - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has wrong Area (%u)", entry, itemTemplate.Area); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong Area (%u)", entry, itemTemplate.Area); if (itemTemplate.Map && !sMapStore.LookupEntry(itemTemplate.Map)) - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has wrong Map (%u)", entry, itemTemplate.Map); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong Map (%u)", entry, itemTemplate.Map); if (itemTemplate.BagFamily) { @@ -2654,7 +2660,7 @@ void ObjectMgr::LoadItemTemplates() ItemBagFamilyEntry const* bf = sItemBagFamilyStore.LookupEntry(j+1); if (!bf) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has bag family bit set not listed in ItemBagFamily.dbc, remove bit", entry); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has bag family bit set not listed in ItemBagFamily.dbc, remove bit", entry); itemTemplate.BagFamily &= ~mask; continue; } @@ -2664,7 +2670,7 @@ void ObjectMgr::LoadItemTemplates() CurrencyTypesEntry const* ctEntry = sCurrencyTypesStore.LookupEntry(itemTemplate.ItemId); if (!ctEntry) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has currency bag family bit set in BagFamily but not listed in CurrencyTypes.dbc, remove bit", entry); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has currency bag family bit set in BagFamily but not listed in CurrencyTypes.dbc, remove bit", entry); itemTemplate.BagFamily &= ~mask; } } @@ -2672,41 +2678,41 @@ void ObjectMgr::LoadItemTemplates() } if (itemTemplate.TotemCategory && !sTotemCategoryStore.LookupEntry(itemTemplate.TotemCategory)) - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has wrong TotemCategory (%u)", entry, itemTemplate.TotemCategory); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong TotemCategory (%u)", entry, itemTemplate.TotemCategory); for (uint8 j = 0; j < MAX_ITEM_PROTO_SOCKETS; ++j) { if (itemTemplate.Socket[j].Color && (itemTemplate.Socket[j].Color & SOCKET_COLOR_ALL) != itemTemplate.Socket[j].Color) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has wrong socketColor_%d (%u)", entry, j+1, itemTemplate.Socket[j].Color); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong socketColor_%d (%u)", entry, j+1, itemTemplate.Socket[j].Color); itemTemplate.Socket[j].Color = 0; } } if (itemTemplate.GemProperties && !sGemPropertiesStore.LookupEntry(itemTemplate.GemProperties)) - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has wrong GemProperties (%u)", entry, itemTemplate.GemProperties); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong GemProperties (%u)", entry, itemTemplate.GemProperties); if (itemTemplate.FoodType >= MAX_PET_DIET) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has wrong FoodType value (%u)", entry, itemTemplate.FoodType); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong FoodType value (%u)", entry, itemTemplate.FoodType); itemTemplate.FoodType = 0; } if (itemTemplate.ItemLimitCategory && !sItemLimitCategoryStore.LookupEntry(itemTemplate.ItemLimitCategory)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has wrong LimitCategory value (%u)", entry, itemTemplate.ItemLimitCategory); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong LimitCategory value (%u)", entry, itemTemplate.ItemLimitCategory); itemTemplate.ItemLimitCategory = 0; } if (itemTemplate.HolidayId && !sHolidaysStore.LookupEntry(itemTemplate.HolidayId)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) has wrong HolidayId value (%u)", entry, itemTemplate.HolidayId); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong HolidayId value (%u)", entry, itemTemplate.HolidayId); itemTemplate.HolidayId = 0; } if (itemTemplate.FlagsCu & ITEM_FLAGS_CU_DURATION_REAL_TIME && !itemTemplate.Duration) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry %u) has flag ITEM_FLAGS_CU_DURATION_REAL_TIME but it does not have duration limit", entry); + TC_LOG_ERROR("sql.sql", "Item (Entry %u) has flag ITEM_FLAGS_CU_DURATION_REAL_TIME but it does not have duration limit", entry); itemTemplate.FlagsCu &= ~ITEM_FLAGS_CU_DURATION_REAL_TIME; } @@ -2735,9 +2741,9 @@ void ObjectMgr::LoadItemTemplates() } for (std::set<uint32>::const_iterator itr = notFoundOutfit.begin(); itr != notFoundOutfit.end(); ++itr) - TC_LOG_ERROR(LOG_FILTER_SQL, "Item (Entry: %u) does not exist in `item_template` but is referenced in `CharStartOutfit.dbc`", *itr); + TC_LOG_ERROR("sql.sql", "Item (Entry: %u) does not exist in `item_template` but is referenced in `CharStartOutfit.dbc`", *itr); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u item templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u item templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } ItemTemplate const* ObjectMgr::GetItemTemplate(uint32 entry) @@ -2772,7 +2778,7 @@ void ObjectMgr::LoadItemSetNameLocales() AddLocaleString(fields[i].GetString(), LocaleConstant(i), data.Name); } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded " UI64FMTD " Item set name locale strings in %u ms", uint64(_itemSetNameLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded " UI64FMTD " Item set name locale strings in %u ms", uint64(_itemSetNameLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadItemSetNames() @@ -2800,7 +2806,7 @@ void ObjectMgr::LoadItemSetNames() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 item set names. DB table `item_set_names` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 item set names. DB table `item_set_names` is empty."); return; } @@ -2814,7 +2820,7 @@ void ObjectMgr::LoadItemSetNames() uint32 entry = fields[0].GetUInt32(); if (itemSetItems.find(entry) == itemSetItems.end()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item set name (Entry: %u) not found in ItemSet.dbc, data useless.", entry); + TC_LOG_ERROR("sql.sql", "Item set name (Entry: %u) not found in ItemSet.dbc, data useless.", entry); continue; } @@ -2824,7 +2830,7 @@ void ObjectMgr::LoadItemSetNames() uint32 invType = fields[2].GetUInt8(); if (invType >= MAX_INVTYPE) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item set name (Entry: %u) has wrong InventoryType value (%u)", entry, invType); + TC_LOG_ERROR("sql.sql", "Item set name (Entry: %u) has wrong InventoryType value (%u)", entry, invType); invType = INVTYPE_NON_EQUIP; } @@ -2843,18 +2849,18 @@ void ObjectMgr::LoadItemSetNames() pProto = sObjectMgr->GetItemTemplate(entry); if (pProto) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item set part (Entry: %u) does not have entry in `item_set_names`, adding data from `item_template`.", entry); + TC_LOG_ERROR("sql.sql", "Item set part (Entry: %u) does not have entry in `item_set_names`, adding data from `item_template`.", entry); ItemSetNameEntry &data = _itemSetNameStore[entry]; data.name = pProto->Name1; data.InventoryType = pProto->InventoryType; ++count; } else - TC_LOG_ERROR(LOG_FILTER_SQL, "Item set part (Entry: %u) does not have entry in `item_set_names`, set will not display properly.", entry); + TC_LOG_ERROR("sql.sql", "Item set part (Entry: %u) does not have entry in `item_set_names`, set will not display properly.", entry); } } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u item set names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u item set names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadVehicleTemplateAccessories() @@ -2870,7 +2876,7 @@ void ObjectMgr::LoadVehicleTemplateAccessories() if (!result) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 vehicle template accessories. DB table `vehicle_template_accessory` is empty."); + TC_LOG_ERROR("server.loading", ">> Loaded 0 vehicle template accessories. DB table `vehicle_template_accessory` is empty."); return; } @@ -2887,19 +2893,19 @@ void ObjectMgr::LoadVehicleTemplateAccessories() if (!sObjectMgr->GetCreatureTemplate(uiEntry)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `vehicle_template_accessory`: creature template entry %u does not exist.", uiEntry); + TC_LOG_ERROR("sql.sql", "Table `vehicle_template_accessory`: creature template entry %u does not exist.", uiEntry); continue; } if (!sObjectMgr->GetCreatureTemplate(uiAccessory)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `vehicle_template_accessory`: Accessory %u does not exist.", uiAccessory); + TC_LOG_ERROR("sql.sql", "Table `vehicle_template_accessory`: Accessory %u does not exist.", uiAccessory); continue; } if (_spellClickInfoStore.find(uiEntry) == _spellClickInfoStore.end()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `vehicle_template_accessory`: creature template entry %u has no data in npc_spellclick_spells", uiEntry); + TC_LOG_ERROR("sql.sql", "Table `vehicle_template_accessory`: creature template entry %u has no data in npc_spellclick_spells", uiEntry); continue; } @@ -2909,7 +2915,7 @@ void ObjectMgr::LoadVehicleTemplateAccessories() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Vehicle Template Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u Vehicle Template Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadVehicleAccessories() @@ -2925,7 +2931,7 @@ void ObjectMgr::LoadVehicleAccessories() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 Vehicle Accessories in %u ms", GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded 0 Vehicle Accessories in %u ms", GetMSTimeDiffToNow(oldMSTime)); return; } @@ -2942,7 +2948,7 @@ void ObjectMgr::LoadVehicleAccessories() if (!sObjectMgr->GetCreatureTemplate(uiAccessory)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `vehicle_accessory`: Accessory %u does not exist.", uiAccessory); + TC_LOG_ERROR("sql.sql", "Table `vehicle_accessory`: Accessory %u does not exist.", uiAccessory); continue; } @@ -2952,7 +2958,7 @@ void ObjectMgr::LoadVehicleAccessories() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Vehicle Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u Vehicle Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadPetLevelInfo() @@ -2964,7 +2970,7 @@ void ObjectMgr::LoadPetLevelInfo() if (!result) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 level pet stats definitions. DB table `pet_levelstats` is empty."); + TC_LOG_ERROR("server.loading", ">> Loaded 0 level pet stats definitions. DB table `pet_levelstats` is empty."); return; } @@ -2977,7 +2983,7 @@ void ObjectMgr::LoadPetLevelInfo() uint32 creature_id = fields[0].GetUInt32(); if (!sObjectMgr->GetCreatureTemplate(creature_id)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Wrong creature id %u in `pet_levelstats` table, ignoring.", creature_id); + TC_LOG_ERROR("sql.sql", "Wrong creature id %u in `pet_levelstats` table, ignoring.", creature_id); continue; } @@ -2985,17 +2991,17 @@ void ObjectMgr::LoadPetLevelInfo() if (current_level > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) { if (current_level > STRONG_MAX_LEVEL) // hardcoded level maximum - TC_LOG_ERROR(LOG_FILTER_SQL, "Wrong (> %u) level %u in `pet_levelstats` table, ignoring.", STRONG_MAX_LEVEL, current_level); + TC_LOG_ERROR("sql.sql", "Wrong (> %u) level %u in `pet_levelstats` table, ignoring.", STRONG_MAX_LEVEL, current_level); else { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Unused (> MaxPlayerLevel in worldserver.conf) level %u in `pet_levelstats` table, ignoring.", current_level); + TC_LOG_INFO("misc", "Unused (> MaxPlayerLevel in worldserver.conf) level %u in `pet_levelstats` table, ignoring.", current_level); ++count; // make result loading percent "expected" correct in case disabled detail mode for example. } continue; } else if (current_level < 1) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Wrong (<1) level %u in `pet_levelstats` table, ignoring.", current_level); + TC_LOG_ERROR("sql.sql", "Wrong (<1) level %u in `pet_levelstats` table, ignoring.", current_level); continue; } @@ -3028,7 +3034,7 @@ void ObjectMgr::LoadPetLevelInfo() // fatal error if no level 1 data if (!pInfo || pInfo[0].health == 0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature %u does not have pet stats data for Level 1!", itr->first); + TC_LOG_ERROR("sql.sql", "Creature %u does not have pet stats data for Level 1!", itr->first); exit(1); } @@ -3037,13 +3043,13 @@ void ObjectMgr::LoadPetLevelInfo() { if (pInfo[level].health == 0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature %u has no data for Level %i pet stats data, using data of Level %i.", itr->first, level+1, level); + TC_LOG_ERROR("sql.sql", "Creature %u has no data for Level %i pet stats data, using data of Level %i.", itr->first, level+1, level); pInfo[level] = pInfo[level-1]; } } } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u level pet stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u level pet stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } PetLevelInfo const* ObjectMgr::GetPetLevelInfo(uint32 creature_id, uint8 level) const @@ -3068,7 +3074,7 @@ void ObjectMgr::PlayerCreateInfoAddItemHelper(uint32 race_, uint32 class_, uint3 else { if (count < -1) - TC_LOG_ERROR(LOG_FILTER_SQL, "Invalid count %i specified on item %u be removed from original player create info (use -1)!", count, itemId); + TC_LOG_ERROR("sql.sql", "Invalid count %i specified on item %u be removed from original player create info (use -1)!", count, itemId); for (uint32 gender = 0; gender < GENDER_NONE; ++gender) { @@ -3086,7 +3092,7 @@ void ObjectMgr::PlayerCreateInfoAddItemHelper(uint32 race_, uint32 class_, uint3 } if (!found) - TC_LOG_ERROR(LOG_FILTER_SQL, "Item %u specified to be removed from original create info not found in dbc!", itemId); + TC_LOG_ERROR("sql.sql", "Item %u specified to be removed from original create info not found in dbc!", itemId); } } } @@ -3102,7 +3108,7 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 player create definitions. DB table `playercreateinfo` is empty."); + TC_LOG_ERROR("server.loading", ">> Loaded 0 player create definitions. DB table `playercreateinfo` is empty."); exit(1); } else @@ -3124,39 +3130,39 @@ void ObjectMgr::LoadPlayerInfo() if (current_race >= MAX_RACES) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Wrong race %u in `playercreateinfo` table, ignoring.", current_race); + TC_LOG_ERROR("sql.sql", "Wrong race %u in `playercreateinfo` table, ignoring.", current_race); continue; } ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(current_race); if (!rEntry) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Wrong race %u in `playercreateinfo` table, ignoring.", current_race); + TC_LOG_ERROR("sql.sql", "Wrong race %u in `playercreateinfo` table, ignoring.", current_race); continue; } if (current_class >= MAX_CLASSES) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Wrong class %u in `playercreateinfo` table, ignoring.", current_class); + TC_LOG_ERROR("sql.sql", "Wrong class %u in `playercreateinfo` table, ignoring.", current_class); continue; } if (!sChrClassesStore.LookupEntry(current_class)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Wrong class %u in `playercreateinfo` table, ignoring.", current_class); + TC_LOG_ERROR("sql.sql", "Wrong class %u in `playercreateinfo` table, ignoring.", current_class); continue; } // accept DB data only for valid position (and non instanceable) if (!MapManager::IsValidMapCoord(mapId, positionX, positionY, positionZ, orientation)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Wrong home position for class %u race %u pair in `playercreateinfo` table, ignoring.", current_class, current_race); + TC_LOG_ERROR("sql.sql", "Wrong home position for class %u race %u pair in `playercreateinfo` table, ignoring.", current_class, current_race); continue; } if (sMapStore.LookupEntry(mapId)->Instanceable()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Home position in instanceable map for class %u race %u pair in `playercreateinfo` table, ignoring.", current_class, current_race); + TC_LOG_ERROR("sql.sql", "Home position in instanceable map for class %u race %u pair in `playercreateinfo` table, ignoring.", current_class, current_race); continue; } @@ -3175,12 +3181,12 @@ void ObjectMgr::LoadPlayerInfo() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u player create definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u player create definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } // Load playercreate items - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Player Create Items Data..."); + TC_LOG_INFO("server.loading", "Loading Player Create Items Data..."); { uint32 oldMSTime = getMSTime(); // 0 1 2 3 @@ -3188,7 +3194,7 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 custom player create items. DB table `playercreateinfo_item` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 custom player create items. DB table `playercreateinfo_item` is empty."); } else { @@ -3201,14 +3207,14 @@ void ObjectMgr::LoadPlayerInfo() uint32 current_race = fields[0].GetUInt8(); if (current_race >= MAX_RACES) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Wrong race %u in `playercreateinfo_item` table, ignoring.", current_race); + TC_LOG_ERROR("sql.sql", "Wrong race %u in `playercreateinfo_item` table, ignoring.", current_race); continue; } uint32 current_class = fields[1].GetUInt8(); if (current_class >= MAX_CLASSES) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Wrong class %u in `playercreateinfo_item` table, ignoring.", current_class); + TC_LOG_ERROR("sql.sql", "Wrong class %u in `playercreateinfo_item` table, ignoring.", current_class); continue; } @@ -3216,7 +3222,7 @@ void ObjectMgr::LoadPlayerInfo() if (!GetItemTemplate(item_id)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item id %u (race %u class %u) in `playercreateinfo_item` table but not listed in `item_template`, ignoring.", item_id, current_race, current_class); + TC_LOG_ERROR("sql.sql", "Item id %u (race %u class %u) in `playercreateinfo_item` table but not listed in `item_template`, ignoring.", item_id, current_race, current_class); continue; } @@ -3224,7 +3230,7 @@ void ObjectMgr::LoadPlayerInfo() if (!amount) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Item id %u (class %u race %u) have amount == 0 in `playercreateinfo_item` table, ignoring.", item_id, current_race, current_class); + TC_LOG_ERROR("sql.sql", "Item id %u (class %u race %u) have amount == 0 in `playercreateinfo_item` table, ignoring.", item_id, current_race, current_class); continue; } @@ -3245,12 +3251,12 @@ void ObjectMgr::LoadPlayerInfo() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u custom player create items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u custom player create items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } // Load playercreate spells - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Player Create Spell Data..."); + TC_LOG_INFO("server.loading", "Loading Player Create Spell Data..."); { uint32 oldMSTime = getMSTime(); @@ -3259,7 +3265,7 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 player create spells. DB table `%s` is empty.", sWorld->getBoolConfig(CONFIG_START_ALL_SPELLS) ? "playercreateinfo_spell_custom" : "playercreateinfo_spell"); + TC_LOG_ERROR("server.loading", ">> Loaded 0 player create spells. DB table `%s` is empty.", sWorld->getBoolConfig(CONFIG_START_ALL_SPELLS) ? "playercreateinfo_spell_custom" : "playercreateinfo_spell"); } else { @@ -3274,13 +3280,13 @@ void ObjectMgr::LoadPlayerInfo() if (raceMask != 0 && !(raceMask & RACEMASK_ALL_PLAYABLE)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Wrong race mask %u in `playercreateinfo_spell` table, ignoring.", raceMask); + TC_LOG_ERROR("sql.sql", "Wrong race mask %u in `playercreateinfo_spell` table, ignoring.", raceMask); continue; } if (classMask != 0 && !(classMask & CLASSMASK_ALL_PLAYABLE)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Wrong class mask %u in `playercreateinfo_spell` table, ignoring.", classMask); + TC_LOG_ERROR("sql.sql", "Wrong class mask %u in `playercreateinfo_spell` table, ignoring.", classMask); continue; } @@ -3300,7 +3306,7 @@ void ObjectMgr::LoadPlayerInfo() // We need something better here, the check is not accounting for spells used by multiple races/classes but not all of them. // Either split the masks per class, or per race, which kind of kills the point yet. // else if (raceMask != 0 && classMask != 0) - // TC_LOG_ERROR(LOG_FILTER_SQL, "Racemask/classmask (%u/%u) combination was found containing an invalid race/class combination (%u/%u) in `playercreateinfo_spell` (Spell %u), ignoring.", raceMask, classMask, raceIndex, classIndex, spellId); + // TC_LOG_ERROR("sql.sql", "Racemask/classmask (%u/%u) combination was found containing an invalid race/class combination (%u/%u) in `playercreateinfo_spell` (Spell %u), ignoring.", raceMask, classMask, raceIndex, classIndex, spellId); } } } @@ -3308,12 +3314,12 @@ void ObjectMgr::LoadPlayerInfo() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u player create spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u player create spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } // Load playercreate actions - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Player Create Action Data..."); + TC_LOG_INFO("server.loading", "Loading Player Create Action Data..."); { uint32 oldMSTime = getMSTime(); @@ -3322,7 +3328,7 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 player create actions. DB table `playercreateinfo_action` is empty."); + TC_LOG_ERROR("server.loading", ">> Loaded 0 player create actions. DB table `playercreateinfo_action` is empty."); } else { @@ -3335,14 +3341,14 @@ void ObjectMgr::LoadPlayerInfo() uint32 current_race = fields[0].GetUInt8(); if (current_race >= MAX_RACES) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Wrong race %u in `playercreateinfo_action` table, ignoring.", current_race); + TC_LOG_ERROR("sql.sql", "Wrong race %u in `playercreateinfo_action` table, ignoring.", current_race); continue; } uint32 current_class = fields[1].GetUInt8(); if (current_class >= MAX_CLASSES) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Wrong class %u in `playercreateinfo_action` table, ignoring.", current_class); + TC_LOG_ERROR("sql.sql", "Wrong class %u in `playercreateinfo_action` table, ignoring.", current_class); continue; } @@ -3353,12 +3359,12 @@ void ObjectMgr::LoadPlayerInfo() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u player create actions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u player create actions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } // Loading levels data (class only dependent) - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Player Create Level HP/Mana Data..."); + TC_LOG_INFO("server.loading", "Loading Player Create Level HP/Mana Data..."); { uint32 oldMSTime = getMSTime(); @@ -3367,7 +3373,7 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 level health/mana definitions. DB table `game_event_condition` is empty."); + TC_LOG_ERROR("server.loading", ">> Loaded 0 level health/mana definitions. DB table `game_event_condition` is empty."); exit(1); } @@ -3380,14 +3386,14 @@ void ObjectMgr::LoadPlayerInfo() uint32 current_class = fields[0].GetUInt8(); if (current_class >= MAX_CLASSES) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Wrong class %u in `player_classlevelstats` table, ignoring.", current_class); + TC_LOG_ERROR("sql.sql", "Wrong class %u in `player_classlevelstats` table, ignoring.", current_class); continue; } uint8 current_level = fields[1].GetUInt8(); // Can't be > than STRONG_MAX_LEVEL (hardcoded level maximum) due to var type if (current_level > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Unused (> MaxPlayerLevel in worldserver.conf) level %u in `player_classlevelstats` table, ignoring.", current_level); + TC_LOG_INFO("misc", "Unused (> MaxPlayerLevel in worldserver.conf) level %u in `player_classlevelstats` table, ignoring.", current_level); ++count; // make result loading percent "expected" correct in case disabled detail mode for example. continue; } @@ -3421,7 +3427,7 @@ void ObjectMgr::LoadPlayerInfo() // fatal error if no level 1 data if (!pClassInfo->levelInfo || pClassInfo->levelInfo[0].basehealth == 0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Class %i Level 1 does not have health/mana data!", class_); + TC_LOG_ERROR("sql.sql", "Class %i Level 1 does not have health/mana data!", class_); exit(1); } @@ -3430,17 +3436,17 @@ void ObjectMgr::LoadPlayerInfo() { if (pClassInfo->levelInfo[level].basehealth == 0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Class %i Level %i does not have health/mana data. Using stats data of level %i.", class_, level+1, level); + TC_LOG_ERROR("sql.sql", "Class %i Level %i does not have health/mana data. Using stats data of level %i.", class_, level+1, level); pClassInfo->levelInfo[level] = pClassInfo->levelInfo[level-1]; } } } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u level health/mana definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u level health/mana definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } // Loading levels data (class/race dependent) - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Player Create Level Stats Data..."); + TC_LOG_INFO("server.loading", "Loading Player Create Level Stats Data..."); { uint32 oldMSTime = getMSTime(); @@ -3449,7 +3455,7 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 level stats definitions. DB table `player_levelstats` is empty."); + TC_LOG_ERROR("server.loading", ">> Loaded 0 level stats definitions. DB table `player_levelstats` is empty."); exit(1); } @@ -3462,14 +3468,14 @@ void ObjectMgr::LoadPlayerInfo() uint32 current_race = fields[0].GetUInt8(); if (current_race >= MAX_RACES) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Wrong race %u in `player_levelstats` table, ignoring.", current_race); + TC_LOG_ERROR("sql.sql", "Wrong race %u in `player_levelstats` table, ignoring.", current_race); continue; } uint32 current_class = fields[1].GetUInt8(); if (current_class >= MAX_CLASSES) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Wrong class %u in `player_levelstats` table, ignoring.", current_class); + TC_LOG_ERROR("sql.sql", "Wrong class %u in `player_levelstats` table, ignoring.", current_class); continue; } @@ -3477,10 +3483,10 @@ void ObjectMgr::LoadPlayerInfo() if (current_level > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) { if (current_level > STRONG_MAX_LEVEL) // hardcoded level maximum - TC_LOG_ERROR(LOG_FILTER_SQL, "Wrong (> %u) level %u in `player_levelstats` table, ignoring.", STRONG_MAX_LEVEL, current_level); + TC_LOG_ERROR("sql.sql", "Wrong (> %u) level %u in `player_levelstats` table, ignoring.", STRONG_MAX_LEVEL, current_level); else { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Unused (> MaxPlayerLevel in worldserver.conf) level %u in `player_levelstats` table, ignoring.", current_level); + TC_LOG_INFO("misc", "Unused (> MaxPlayerLevel in worldserver.conf) level %u in `player_levelstats` table, ignoring.", current_level); ++count; // make result loading percent "expected" correct in case disabled detail mode for example. } continue; @@ -3528,7 +3534,7 @@ void ObjectMgr::LoadPlayerInfo() // fatal error if no level 1 data if (!info->levelInfo || info->levelInfo[0].stats[0] == 0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Race %i Class %i Level 1 does not have stats data!", race, class_); + TC_LOG_ERROR("sql.sql", "Race %i Class %i Level 1 does not have stats data!", race, class_); exit(1); } @@ -3537,18 +3543,18 @@ void ObjectMgr::LoadPlayerInfo() { if (info->levelInfo[level].stats[0] == 0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Race %i Class %i Level %i does not have stats data. Using stats data of level %i.", race, class_, level+1, level); + TC_LOG_ERROR("sql.sql", "Race %i Class %i Level %i does not have stats data. Using stats data of level %i.", race, class_, level+1, level); info->levelInfo[level] = info->levelInfo[level-1]; } } } } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u level stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u level stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } // Loading xp per level data - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Player Create XP Data..."); + TC_LOG_INFO("server.loading", "Loading Player Create XP Data..."); { uint32 oldMSTime = getMSTime(); @@ -3561,7 +3567,7 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 xp for level definitions. DB table `player_xp_for_level` is empty."); + TC_LOG_ERROR("server.loading", ">> Loaded 0 xp for level definitions. DB table `player_xp_for_level` is empty."); exit(1); } @@ -3577,10 +3583,10 @@ void ObjectMgr::LoadPlayerInfo() if (current_level >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) { if (current_level > STRONG_MAX_LEVEL) // hardcoded level maximum - TC_LOG_ERROR(LOG_FILTER_SQL, "Wrong (> %u) level %u in `player_xp_for_level` table, ignoring.", STRONG_MAX_LEVEL, current_level); + TC_LOG_ERROR("sql.sql", "Wrong (> %u) level %u in `player_xp_for_level` table, ignoring.", STRONG_MAX_LEVEL, current_level); else { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Unused (> MaxPlayerLevel in worldserver.conf) level %u in `player_xp_for_levels` table, ignoring.", current_level); + TC_LOG_INFO("misc", "Unused (> MaxPlayerLevel in worldserver.conf) level %u in `player_xp_for_levels` table, ignoring.", current_level); ++count; // make result loading percent "expected" correct in case disabled detail mode for example. } continue; @@ -3596,12 +3602,12 @@ void ObjectMgr::LoadPlayerInfo() { if (_playerXPperLevel[level] == 0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Level %i does not have XP for level data. Using data of level [%i] + 100.", level+1, level); + TC_LOG_ERROR("sql.sql", "Level %i does not have XP for level data. Using data of level [%i] + 100.", level+1, level); _playerXPperLevel[level] = _playerXPperLevel[level-1]+100; } } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u xp for level definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u xp for level definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } @@ -3754,7 +3760,7 @@ void ObjectMgr::LoadQuests() " FROM quest_template"); if (!result) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 quests definitions. DB table `quest_template` is empty."); + TC_LOG_ERROR("server.loading", ">> Loaded 0 quests definitions. DB table `quest_template` is empty."); return; } @@ -3783,18 +3789,18 @@ void ObjectMgr::LoadQuests() // additional quest integrity checks (GO, creature_template and item_template must be loaded already) if (qinfo->GetQuestMethod() >= 3) - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `Method` = %u, expected values are 0, 1 or 2.", qinfo->GetQuestId(), qinfo->GetQuestMethod()); + TC_LOG_ERROR("sql.sql", "Quest %u has `Method` = %u, expected values are 0, 1 or 2.", qinfo->GetQuestId(), qinfo->GetQuestMethod()); if (qinfo->SpecialFlags & ~QUEST_SPECIAL_FLAGS_DB_ALLOWED) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `SpecialFlags` = %u > max allowed value. Correct `SpecialFlags` to value <= %u", + TC_LOG_ERROR("sql.sql", "Quest %u has `SpecialFlags` = %u > max allowed value. Correct `SpecialFlags` to value <= %u", qinfo->GetQuestId(), qinfo->SpecialFlags, QUEST_SPECIAL_FLAGS_DB_ALLOWED); qinfo->SpecialFlags &= QUEST_SPECIAL_FLAGS_DB_ALLOWED; } if (qinfo->Flags & QUEST_FLAGS_DAILY && qinfo->Flags & QUEST_FLAGS_WEEKLY) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Weekly Quest %u is marked as daily quest in `Flags`, removed daily flag.", qinfo->GetQuestId()); + TC_LOG_ERROR("sql.sql", "Weekly Quest %u is marked as daily quest in `Flags`, removed daily flag.", qinfo->GetQuestId()); qinfo->Flags &= ~QUEST_FLAGS_DAILY; } @@ -3802,7 +3808,7 @@ void ObjectMgr::LoadQuests() { if (!(qinfo->SpecialFlags & QUEST_SPECIAL_FLAGS_REPEATABLE)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Daily Quest %u not marked as repeatable in `SpecialFlags`, added.", qinfo->GetQuestId()); + TC_LOG_ERROR("sql.sql", "Daily Quest %u not marked as repeatable in `SpecialFlags`, added.", qinfo->GetQuestId()); qinfo->SpecialFlags |= QUEST_SPECIAL_FLAGS_REPEATABLE; } } @@ -3811,7 +3817,7 @@ void ObjectMgr::LoadQuests() { if (!(qinfo->SpecialFlags & QUEST_SPECIAL_FLAGS_REPEATABLE)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Weekly Quest %u not marked as repeatable in `SpecialFlags`, added.", qinfo->GetQuestId()); + TC_LOG_ERROR("sql.sql", "Weekly Quest %u not marked as repeatable in `SpecialFlags`, added.", qinfo->GetQuestId()); qinfo->SpecialFlags |= QUEST_SPECIAL_FLAGS_REPEATABLE; } } @@ -3820,7 +3826,7 @@ void ObjectMgr::LoadQuests() { if (!(qinfo->SpecialFlags & QUEST_SPECIAL_FLAGS_REPEATABLE)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Monthly quest %u not marked as repeatable in `SpecialFlags`, added.", qinfo->GetQuestId()); + TC_LOG_ERROR("sql.sql", "Monthly quest %u not marked as repeatable in `SpecialFlags`, added.", qinfo->GetQuestId()); qinfo->SpecialFlags |= QUEST_SPECIAL_FLAGS_REPEATABLE; } } @@ -3832,7 +3838,7 @@ void ObjectMgr::LoadQuests() { if (uint32 id = qinfo->RewardChoiceItemId[j]) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `RewardChoiceItemId%d` = %u but item from `RewardChoiceItemId%d` can't be rewarded with quest flag QUEST_FLAGS_TRACKING.", + TC_LOG_ERROR("sql.sql", "Quest %u has `RewardChoiceItemId%d` = %u but item from `RewardChoiceItemId%d` can't be rewarded with quest flag QUEST_FLAGS_TRACKING.", qinfo->GetQuestId(), j+1, id, j+1); // no changes, quest ignore this data } @@ -3844,7 +3850,7 @@ void ObjectMgr::LoadQuests() { if (!GetAreaEntryByAreaID(qinfo->ZoneOrSort)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `ZoneOrSort` = %u (zone case) but zone with this id does not exist.", + TC_LOG_ERROR("sql.sql", "Quest %u has `ZoneOrSort` = %u (zone case) but zone with this id does not exist.", qinfo->GetQuestId(), qinfo->ZoneOrSort); // no changes, quest not dependent from this value but can have problems at client } @@ -3855,7 +3861,7 @@ void ObjectMgr::LoadQuests() QuestSortEntry const* qSort = sQuestSortStore.LookupEntry(-int32(qinfo->ZoneOrSort)); if (!qSort) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `ZoneOrSort` = %i (sort case) but quest sort with this id does not exist.", + TC_LOG_ERROR("sql.sql", "Quest %u has `ZoneOrSort` = %i (sort case) but quest sort with this id does not exist.", qinfo->GetQuestId(), qinfo->ZoneOrSort); // no changes, quest not dependent from this value but can have problems at client (note some may be 0, we must allow this so no check) } @@ -3864,7 +3870,7 @@ void ObjectMgr::LoadQuests() { if (qinfo->RequiredSkillId != skill_id) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `ZoneOrSort` = %i but `RequiredSkillId` does not have a corresponding value (%d).", + TC_LOG_ERROR("sql.sql", "Quest %u has `ZoneOrSort` = %i but `RequiredSkillId` does not have a corresponding value (%d).", qinfo->GetQuestId(), qinfo->ZoneOrSort, skill_id); //override, and force proper value here? } @@ -3876,7 +3882,7 @@ void ObjectMgr::LoadQuests() { if (!(qinfo->RequiredClasses & CLASSMASK_ALL_PLAYABLE)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u does not contain any playable classes in `RequiredClasses` (%u), value set to 0 (all classes).", qinfo->GetQuestId(), qinfo->RequiredClasses); + TC_LOG_ERROR("sql.sql", "Quest %u does not contain any playable classes in `RequiredClasses` (%u), value set to 0 (all classes).", qinfo->GetQuestId(), qinfo->RequiredClasses); qinfo->RequiredClasses = 0; } } @@ -3885,7 +3891,7 @@ void ObjectMgr::LoadQuests() { if (!(qinfo->RequiredRaces & RACEMASK_ALL_PLAYABLE)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u does not contain any playable races in `RequiredRaces` (%u), value set to 0 (all races).", qinfo->GetQuestId(), qinfo->RequiredRaces); + TC_LOG_ERROR("sql.sql", "Quest %u does not contain any playable races in `RequiredRaces` (%u), value set to 0 (all races).", qinfo->GetQuestId(), qinfo->RequiredRaces); qinfo->RequiredRaces = 0; } } @@ -3894,7 +3900,7 @@ void ObjectMgr::LoadQuests() { if (!sSkillLineStore.LookupEntry(qinfo->RequiredSkillId)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `RequiredSkillId` = %u but this skill does not exist", + TC_LOG_ERROR("sql.sql", "Quest %u has `RequiredSkillId` = %u but this skill does not exist", qinfo->GetQuestId(), qinfo->RequiredSkillId); } } @@ -3903,7 +3909,7 @@ void ObjectMgr::LoadQuests() { if (qinfo->RequiredSkillPoints > sWorld->GetConfigMaxSkillValue()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `RequiredSkillPoints` = %u but max possible skill is %u, quest can't be done.", + TC_LOG_ERROR("sql.sql", "Quest %u has `RequiredSkillPoints` = %u but max possible skill is %u, quest can't be done.", qinfo->GetQuestId(), qinfo->RequiredSkillPoints, sWorld->GetConfigMaxSkillValue()); // no changes, quest can't be done for this requirement } @@ -3912,77 +3918,77 @@ void ObjectMgr::LoadQuests() if (qinfo->RequiredFactionId2 && !sFactionStore.LookupEntry(qinfo->RequiredFactionId2)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `RequiredFactionId2` = %u but faction template %u does not exist, quest can't be done.", + TC_LOG_ERROR("sql.sql", "Quest %u has `RequiredFactionId2` = %u but faction template %u does not exist, quest can't be done.", qinfo->GetQuestId(), qinfo->RequiredFactionId2, qinfo->RequiredFactionId2); // no changes, quest can't be done for this requirement } if (qinfo->RequiredFactionId1 && !sFactionStore.LookupEntry(qinfo->RequiredFactionId1)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `RequiredFactionId1` = %u but faction template %u does not exist, quest can't be done.", + TC_LOG_ERROR("sql.sql", "Quest %u has `RequiredFactionId1` = %u but faction template %u does not exist, quest can't be done.", qinfo->GetQuestId(), qinfo->RequiredFactionId1, qinfo->RequiredFactionId1); // no changes, quest can't be done for this requirement } if (qinfo->RequiredMinRepFaction && !sFactionStore.LookupEntry(qinfo->RequiredMinRepFaction)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `RequiredMinRepFaction` = %u but faction template %u does not exist, quest can't be done.", + TC_LOG_ERROR("sql.sql", "Quest %u has `RequiredMinRepFaction` = %u but faction template %u does not exist, quest can't be done.", qinfo->GetQuestId(), qinfo->RequiredMinRepFaction, qinfo->RequiredMinRepFaction); // no changes, quest can't be done for this requirement } if (qinfo->RequiredMaxRepFaction && !sFactionStore.LookupEntry(qinfo->RequiredMaxRepFaction)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `RequiredMaxRepFaction` = %u but faction template %u does not exist, quest can't be done.", + TC_LOG_ERROR("sql.sql", "Quest %u has `RequiredMaxRepFaction` = %u but faction template %u does not exist, quest can't be done.", qinfo->GetQuestId(), qinfo->RequiredMaxRepFaction, qinfo->RequiredMaxRepFaction); // no changes, quest can't be done for this requirement } if (qinfo->RequiredMinRepValue && qinfo->RequiredMinRepValue > ReputationMgr::Reputation_Cap) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `RequiredMinRepValue` = %d but max reputation is %u, quest can't be done.", + TC_LOG_ERROR("sql.sql", "Quest %u has `RequiredMinRepValue` = %d but max reputation is %u, quest can't be done.", qinfo->GetQuestId(), qinfo->RequiredMinRepValue, ReputationMgr::Reputation_Cap); // no changes, quest can't be done for this requirement } if (qinfo->RequiredMinRepValue && qinfo->RequiredMaxRepValue && qinfo->RequiredMaxRepValue <= qinfo->RequiredMinRepValue) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `RequiredMaxRepValue` = %d and `RequiredMinRepValue` = %d, quest can't be done.", + TC_LOG_ERROR("sql.sql", "Quest %u has `RequiredMaxRepValue` = %d and `RequiredMinRepValue` = %d, quest can't be done.", qinfo->GetQuestId(), qinfo->RequiredMaxRepValue, qinfo->RequiredMinRepValue); // no changes, quest can't be done for this requirement } if (!qinfo->RequiredFactionId1 && qinfo->RequiredFactionValue1 != 0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `RequiredFactionValue1` = %d but `RequiredFactionId1` is 0, value has no effect", + TC_LOG_ERROR("sql.sql", "Quest %u has `RequiredFactionValue1` = %d but `RequiredFactionId1` is 0, value has no effect", qinfo->GetQuestId(), qinfo->RequiredFactionValue1); // warning } if (!qinfo->RequiredFactionId2 && qinfo->RequiredFactionValue2 != 0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `RequiredFactionValue2` = %d but `RequiredFactionId2` is 0, value has no effect", + TC_LOG_ERROR("sql.sql", "Quest %u has `RequiredFactionValue2` = %d but `RequiredFactionId2` is 0, value has no effect", qinfo->GetQuestId(), qinfo->RequiredFactionValue2); // warning } if (!qinfo->RequiredMinRepFaction && qinfo->RequiredMinRepValue != 0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `RequiredMinRepValue` = %d but `RequiredMinRepFaction` is 0, value has no effect", + TC_LOG_ERROR("sql.sql", "Quest %u has `RequiredMinRepValue` = %d but `RequiredMinRepFaction` is 0, value has no effect", qinfo->GetQuestId(), qinfo->RequiredMinRepValue); // warning } if (!qinfo->RequiredMaxRepFaction && qinfo->RequiredMaxRepValue != 0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `RequiredMaxRepValue` = %d but `RequiredMaxRepFaction` is 0, value has no effect", + TC_LOG_ERROR("sql.sql", "Quest %u has `RequiredMaxRepValue` = %d but `RequiredMaxRepFaction` is 0, value has no effect", qinfo->GetQuestId(), qinfo->RequiredMaxRepValue); // warning } if (qinfo->RewardTitleId && !sCharTitlesStore.LookupEntry(qinfo->RewardTitleId)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `RewardTitleId` = %u but CharTitle Id %u does not exist, quest can't be rewarded with title.", + TC_LOG_ERROR("sql.sql", "Quest %u has `RewardTitleId` = %u but CharTitle Id %u does not exist, quest can't be rewarded with title.", qinfo->GetQuestId(), qinfo->GetCharTitleId(), qinfo->GetCharTitleId()); qinfo->RewardTitleId = 0; // quest can't reward this title @@ -3992,20 +3998,20 @@ void ObjectMgr::LoadQuests() { if (!sObjectMgr->GetItemTemplate(qinfo->SourceItemId)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `SourceItemId` = %u but item with entry %u does not exist, quest can't be done.", + TC_LOG_ERROR("sql.sql", "Quest %u has `SourceItemId` = %u but item with entry %u does not exist, quest can't be done.", qinfo->GetQuestId(), qinfo->SourceItemId, qinfo->SourceItemId); qinfo->SourceItemId = 0; // quest can't be done for this requirement } else if (qinfo->SourceItemIdCount == 0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `SourceItemId` = %u but `SourceItemIdCount` = 0, set to 1 but need fix in DB.", + TC_LOG_ERROR("sql.sql", "Quest %u has `SourceItemId` = %u but `SourceItemIdCount` = 0, set to 1 but need fix in DB.", qinfo->GetQuestId(), qinfo->SourceItemId); qinfo->SourceItemIdCount = 1; // update to 1 for allow quest work for backward compatibility with DB } } else if (qinfo->SourceItemIdCount>0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `SourceItemId` = 0 but `SourceItemIdCount` = %u, useless value.", + TC_LOG_ERROR("sql.sql", "Quest %u has `SourceItemId` = 0 but `SourceItemIdCount` = %u, useless value.", qinfo->GetQuestId(), qinfo->SourceItemIdCount); qinfo->SourceItemIdCount=0; // no quest work changes in fact } @@ -4015,13 +4021,13 @@ void ObjectMgr::LoadQuests() SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(qinfo->SourceSpellid); if (!spellInfo) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `SourceSpellid` = %u but spell %u doesn't exist, quest can't be done.", + TC_LOG_ERROR("sql.sql", "Quest %u has `SourceSpellid` = %u but spell %u doesn't exist, quest can't be done.", qinfo->GetQuestId(), qinfo->SourceSpellid, qinfo->SourceSpellid); qinfo->SourceSpellid = 0; // quest can't be done for this requirement } else if (!SpellMgr::IsSpellValid(spellInfo)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `SourceSpellid` = %u but spell %u is broken, quest can't be done.", + TC_LOG_ERROR("sql.sql", "Quest %u has `SourceSpellid` = %u but spell %u is broken, quest can't be done.", qinfo->GetQuestId(), qinfo->SourceSpellid, qinfo->SourceSpellid); qinfo->SourceSpellid = 0; // quest can't be done for this requirement } @@ -4034,7 +4040,7 @@ void ObjectMgr::LoadQuests() { if (qinfo->RequiredItemCount[j] == 0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `RequiredItemId%d` = %u but `RequiredItemCount%d` = 0, quest can't be done.", + TC_LOG_ERROR("sql.sql", "Quest %u has `RequiredItemId%d` = %u but `RequiredItemCount%d` = 0, quest can't be done.", qinfo->GetQuestId(), j+1, id, j+1); // no changes, quest can't be done for this requirement } @@ -4043,14 +4049,14 @@ void ObjectMgr::LoadQuests() if (!sObjectMgr->GetItemTemplate(id)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `RequiredItemId%d` = %u but item with entry %u does not exist, quest can't be done.", + TC_LOG_ERROR("sql.sql", "Quest %u has `RequiredItemId%d` = %u but item with entry %u does not exist, quest can't be done.", qinfo->GetQuestId(), j+1, id, id); qinfo->RequiredItemCount[j] = 0; // prevent incorrect work of quest } } else if (qinfo->RequiredItemCount[j]>0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `RequiredItemId%d` = 0 but `RequiredItemCount%d` = %u, quest can't be done.", + TC_LOG_ERROR("sql.sql", "Quest %u has `RequiredItemId%d` = 0 but `RequiredItemCount%d` = %u, quest can't be done.", qinfo->GetQuestId(), j+1, j+1, qinfo->RequiredItemCount[j]); qinfo->RequiredItemCount[j] = 0; // prevent incorrect work of quest } @@ -4063,7 +4069,7 @@ void ObjectMgr::LoadQuests() { if (!sObjectMgr->GetItemTemplate(id)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `RequiredSourceItemId%d` = %u but item with entry %u does not exist, quest can't be done.", + TC_LOG_ERROR("sql.sql", "Quest %u has `RequiredSourceItemId%d` = %u but item with entry %u does not exist, quest can't be done.", qinfo->GetQuestId(), j+1, id, id); // no changes, quest can't be done for this requirement } @@ -4072,7 +4078,7 @@ void ObjectMgr::LoadQuests() { if (qinfo->RequiredSourceItemCount[j]>0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `RequiredSourceItemId%d` = 0 but `RequiredSourceItemCount%d` = %u.", + TC_LOG_ERROR("sql.sql", "Quest %u has `RequiredSourceItemId%d` = 0 but `RequiredSourceItemCount%d` = %u.", qinfo->GetQuestId(), j+1, j+1, qinfo->RequiredSourceItemCount[j]); // no changes, quest ignore this data } @@ -4084,14 +4090,14 @@ void ObjectMgr::LoadQuests() int32 id = qinfo->RequiredNpcOrGo[j]; if (id < 0 && !sObjectMgr->GetGameObjectTemplate(-id)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `RequiredNpcOrGo%d` = %i but gameobject %u does not exist, quest can't be done.", + TC_LOG_ERROR("sql.sql", "Quest %u has `RequiredNpcOrGo%d` = %i but gameobject %u does not exist, quest can't be done.", qinfo->GetQuestId(), j+1, id, uint32(-id)); qinfo->RequiredNpcOrGo[j] = 0; // quest can't be done for this requirement } if (id > 0 && !sObjectMgr->GetCreatureTemplate(id)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `RequiredNpcOrGo%d` = %i but creature with entry %u does not exist, quest can't be done.", + TC_LOG_ERROR("sql.sql", "Quest %u has `RequiredNpcOrGo%d` = %i but creature with entry %u does not exist, quest can't be done.", qinfo->GetQuestId(), j+1, id, uint32(id)); qinfo->RequiredNpcOrGo[j] = 0; // quest can't be done for this requirement } @@ -4104,14 +4110,14 @@ void ObjectMgr::LoadQuests() if (!qinfo->RequiredNpcOrGoCount[j]) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `RequiredNpcOrGo%d` = %u but `RequiredNpcOrGoCount%d` = 0, quest can't be done.", + TC_LOG_ERROR("sql.sql", "Quest %u has `RequiredNpcOrGo%d` = %u but `RequiredNpcOrGoCount%d` = 0, quest can't be done.", qinfo->GetQuestId(), j+1, id, j+1); // no changes, quest can be incorrectly done, but we already report this } } else if (qinfo->RequiredNpcOrGoCount[j]>0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `RequiredNpcOrGo%d` = 0 but `RequiredNpcOrGoCount%d` = %u.", + TC_LOG_ERROR("sql.sql", "Quest %u has `RequiredNpcOrGo%d` = 0 but `RequiredNpcOrGoCount%d` = %u.", qinfo->GetQuestId(), j+1, j+1, qinfo->RequiredNpcOrGoCount[j]); // no changes, quest ignore this data } @@ -4124,21 +4130,21 @@ void ObjectMgr::LoadQuests() { if (!sObjectMgr->GetItemTemplate(id)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `RewardChoiceItemId%d` = %u but item with entry %u does not exist, quest will not reward this item.", + TC_LOG_ERROR("sql.sql", "Quest %u has `RewardChoiceItemId%d` = %u but item with entry %u does not exist, quest will not reward this item.", qinfo->GetQuestId(), j+1, id, id); qinfo->RewardChoiceItemId[j] = 0; // no changes, quest will not reward this } if (!qinfo->RewardChoiceItemCount[j]) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `RewardChoiceItemId%d` = %u but `RewardChoiceItemCount%d` = 0, quest can't be done.", + TC_LOG_ERROR("sql.sql", "Quest %u has `RewardChoiceItemId%d` = %u but `RewardChoiceItemCount%d` = 0, quest can't be done.", qinfo->GetQuestId(), j+1, id, j+1); // no changes, quest can't be done } } else if (qinfo->RewardChoiceItemCount[j]>0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `RewardChoiceItemId%d` = 0 but `RewardChoiceItemCount%d` = %u.", + TC_LOG_ERROR("sql.sql", "Quest %u has `RewardChoiceItemId%d` = 0 but `RewardChoiceItemCount%d` = %u.", qinfo->GetQuestId(), j+1, j+1, qinfo->RewardChoiceItemCount[j]); // no changes, quest ignore this data } @@ -4151,21 +4157,21 @@ void ObjectMgr::LoadQuests() { if (!sObjectMgr->GetItemTemplate(id)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `RewardItemId%d` = %u but item with entry %u does not exist, quest will not reward this item.", + TC_LOG_ERROR("sql.sql", "Quest %u has `RewardItemId%d` = %u but item with entry %u does not exist, quest will not reward this item.", qinfo->GetQuestId(), j+1, id, id); qinfo->RewardItemId[j] = 0; // no changes, quest will not reward this item } if (!qinfo->RewardItemIdCount[j]) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `RewardItemId%d` = %u but `RewardItemIdCount%d` = 0, quest will not reward this item.", + TC_LOG_ERROR("sql.sql", "Quest %u has `RewardItemId%d` = %u but `RewardItemIdCount%d` = 0, quest will not reward this item.", qinfo->GetQuestId(), j+1, id, j+1); // no changes } } else if (qinfo->RewardItemIdCount[j]>0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `RewardItemId%d` = 0 but `RewardItemIdCount%d` = %u.", + TC_LOG_ERROR("sql.sql", "Quest %u has `RewardItemId%d` = 0 but `RewardItemIdCount%d` = %u.", qinfo->GetQuestId(), j+1, j+1, qinfo->RewardItemIdCount[j]); // no changes, quest ignore this data } @@ -4177,18 +4183,18 @@ void ObjectMgr::LoadQuests() { if (abs(qinfo->RewardFactionValueId[j]) > 9) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has RewardFactionValueId%d = %i. That is outside the range of valid values (-9 to 9).", qinfo->GetQuestId(), j+1, qinfo->RewardFactionValueId[j]); + TC_LOG_ERROR("sql.sql", "Quest %u has RewardFactionValueId%d = %i. That is outside the range of valid values (-9 to 9).", qinfo->GetQuestId(), j+1, qinfo->RewardFactionValueId[j]); } if (!sFactionStore.LookupEntry(qinfo->RewardFactionId[j])) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `RewardFactionId%d` = %u but raw faction (faction.dbc) %u does not exist, quest will not reward reputation for this faction.", qinfo->GetQuestId(), j+1, qinfo->RewardFactionId[j], qinfo->RewardFactionId[j]); + TC_LOG_ERROR("sql.sql", "Quest %u has `RewardFactionId%d` = %u but raw faction (faction.dbc) %u does not exist, quest will not reward reputation for this faction.", qinfo->GetQuestId(), j+1, qinfo->RewardFactionId[j], qinfo->RewardFactionId[j]); qinfo->RewardFactionId[j] = 0; // quest will not reward this } } else if (qinfo->RewardFactionValueIdOverride[j] != 0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `RewardFactionId%d` = 0 but `RewardFactionValueIdOverride%d` = %i.", + TC_LOG_ERROR("sql.sql", "Quest %u has `RewardFactionId%d` = 0 but `RewardFactionValueIdOverride%d` = %i.", qinfo->GetQuestId(), j+1, j+1, qinfo->RewardFactionValueIdOverride[j]); // no changes, quest ignore this data } @@ -4200,21 +4206,21 @@ void ObjectMgr::LoadQuests() if (!spellInfo) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `RewardSpell` = %u but spell %u does not exist, spell removed as display reward.", + TC_LOG_ERROR("sql.sql", "Quest %u has `RewardSpell` = %u but spell %u does not exist, spell removed as display reward.", qinfo->GetQuestId(), qinfo->RewardSpell, qinfo->RewardSpell); qinfo->RewardSpell = 0; // no spell reward will display for this quest } else if (!SpellMgr::IsSpellValid(spellInfo)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `RewardSpell` = %u but spell %u is broken, quest will not have a spell reward.", + TC_LOG_ERROR("sql.sql", "Quest %u has `RewardSpell` = %u but spell %u is broken, quest will not have a spell reward.", qinfo->GetQuestId(), qinfo->RewardSpell, qinfo->RewardSpell); qinfo->RewardSpell = 0; // no spell reward will display for this quest } else if (GetTalentSpellCost(qinfo->RewardSpell)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `RewardSpell` = %u but spell %u is talent, quest will not have a spell reward.", + TC_LOG_ERROR("sql.sql", "Quest %u has `RewardSpell` = %u but spell %u is talent, quest will not have a spell reward.", qinfo->GetQuestId(), qinfo->RewardSpell, qinfo->RewardSpell); qinfo->RewardSpell = 0; // no spell reward will display for this quest } @@ -4226,21 +4232,21 @@ void ObjectMgr::LoadQuests() if (!spellInfo) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `RewardSpellCast` = %u but spell %u does not exist, quest will not have a spell reward.", + TC_LOG_ERROR("sql.sql", "Quest %u has `RewardSpellCast` = %u but spell %u does not exist, quest will not have a spell reward.", qinfo->GetQuestId(), qinfo->RewardSpellCast, qinfo->RewardSpellCast); qinfo->RewardSpellCast = 0; // no spell will be casted on player } else if (!SpellMgr::IsSpellValid(spellInfo)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `RewardSpellCast` = %u but spell %u is broken, quest will not have a spell reward.", + TC_LOG_ERROR("sql.sql", "Quest %u has `RewardSpellCast` = %u but spell %u is broken, quest will not have a spell reward.", qinfo->GetQuestId(), qinfo->RewardSpellCast, qinfo->RewardSpellCast); qinfo->RewardSpellCast = 0; // no spell will be casted on player } else if (GetTalentSpellCost(qinfo->RewardSpellCast)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `RewardSpell` = %u but spell %u is talent, quest will not have a spell reward.", + TC_LOG_ERROR("sql.sql", "Quest %u has `RewardSpell` = %u but spell %u is talent, quest will not have a spell reward.", qinfo->GetQuestId(), qinfo->RewardSpellCast, qinfo->RewardSpellCast); qinfo->RewardSpellCast = 0; // no spell will be casted on player } @@ -4250,7 +4256,7 @@ void ObjectMgr::LoadQuests() { if (!sMailTemplateStore.LookupEntry(qinfo->RewardMailTemplateId)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `RewardMailTemplateId` = %u but mail template %u does not exist, quest will not have a mail reward.", + TC_LOG_ERROR("sql.sql", "Quest %u has `RewardMailTemplateId` = %u but mail template %u does not exist, quest will not have a mail reward.", qinfo->GetQuestId(), qinfo->RewardMailTemplateId, qinfo->RewardMailTemplateId); qinfo->RewardMailTemplateId = 0; // no mail will send to player qinfo->RewardMailDelay = 0; // no mail will send to player @@ -4258,7 +4264,7 @@ void ObjectMgr::LoadQuests() else if (usedMailTemplates.find(qinfo->RewardMailTemplateId) != usedMailTemplates.end()) { std::map<uint32, uint32>::const_iterator used_mt_itr = usedMailTemplates.find(qinfo->RewardMailTemplateId); - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `RewardMailTemplateId` = %u but mail template %u already used for quest %u, quest will not have a mail reward.", + TC_LOG_ERROR("sql.sql", "Quest %u has `RewardMailTemplateId` = %u but mail template %u already used for quest %u, quest will not have a mail reward.", qinfo->GetQuestId(), qinfo->RewardMailTemplateId, qinfo->RewardMailTemplateId, used_mt_itr->second); qinfo->RewardMailTemplateId = 0; // no mail will send to player qinfo->RewardMailDelay = 0; // no mail will send to player @@ -4272,7 +4278,7 @@ void ObjectMgr::LoadQuests() QuestMap::iterator qNextItr = _questTemplates.find(qinfo->NextQuestIdChain); if (qNextItr == _questTemplates.end()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u has `NextQuestIdChain` = %u but quest %u does not exist, quest chain will not work.", + TC_LOG_ERROR("sql.sql", "Quest %u has `NextQuestIdChain` = %u but quest %u does not exist, quest chain will not work.", qinfo->GetQuestId(), qinfo->NextQuestIdChain, qinfo->NextQuestIdChain); qinfo->NextQuestIdChain = 0; } @@ -4285,7 +4291,7 @@ void ObjectMgr::LoadQuests() { if (_questTemplates.find(abs(qinfo->GetPrevQuestId())) == _questTemplates.end()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %d has PrevQuestId %i, but no such quest", qinfo->GetQuestId(), qinfo->GetPrevQuestId()); + TC_LOG_ERROR("sql.sql", "Quest %d has PrevQuestId %i, but no such quest", qinfo->GetQuestId(), qinfo->GetPrevQuestId()); } else { @@ -4298,7 +4304,7 @@ void ObjectMgr::LoadQuests() QuestMap::iterator qNextItr = _questTemplates.find(abs(qinfo->GetNextQuestId())); if (qNextItr == _questTemplates.end()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %d has NextQuestId %i, but no such quest", qinfo->GetQuestId(), qinfo->GetNextQuestId()); + TC_LOG_ERROR("sql.sql", "Quest %d has NextQuestId %i, but no such quest", qinfo->GetQuestId(), qinfo->GetNextQuestId()); } else { @@ -4337,7 +4343,7 @@ void ObjectMgr::LoadQuests() if (!quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell (id: %u) have SPELL_EFFECT_QUEST_COMPLETE for quest %u, but quest not have flag QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT. Quest flags must be fixed, quest modified to enable objective.", spellInfo->Id, quest_id); + TC_LOG_ERROR("sql.sql", "Spell (id: %u) have SPELL_EFFECT_QUEST_COMPLETE for quest %u, but quest not have flag QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT. Quest flags must be fixed, quest modified to enable objective.", spellInfo->Id, quest_id); // this will prevent quest completing without objective const_cast<Quest*>(quest)->SetSpecialFlag(QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT); @@ -4345,7 +4351,7 @@ void ObjectMgr::LoadQuests() } } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu quests definitions in %u ms", (unsigned long)_questTemplates.size(), GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %lu quests definitions in %u ms", (unsigned long)_questTemplates.size(), GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadQuestLocales() @@ -4393,7 +4399,7 @@ void ObjectMgr::LoadQuestLocales() } } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu Quest locale strings in %u ms", (unsigned long)_questLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %lu Quest locale strings in %u ms", (unsigned long)_questLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadScripts(ScriptsType type) @@ -4411,7 +4417,7 @@ void ObjectMgr::LoadScripts(ScriptsType type) if (sScriptMgr->IsScriptScheduled()) // function cannot be called when scripts are in use. return; - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading %s...", tableName.c_str()); + TC_LOG_INFO("server.loading", "Loading %s...", tableName.c_str()); scripts->clear(); // need for reload support @@ -4421,7 +4427,7 @@ void ObjectMgr::LoadScripts(ScriptsType type) if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 script definitions. DB table `%s` is empty!", tableName.c_str()); + TC_LOG_INFO("server.loading", ">> Loaded 0 script definitions. DB table `%s` is empty!", tableName.c_str()); return; } @@ -4452,19 +4458,19 @@ void ObjectMgr::LoadScripts(ScriptsType type) { if (tmp.Talk.ChatType > CHAT_TYPE_WHISPER && tmp.Talk.ChatType != CHAT_MSG_RAID_BOSS_WHISPER) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `%s` has invalid talk type (datalong = %u) in SCRIPT_COMMAND_TALK for script id %u", + TC_LOG_ERROR("sql.sql", "Table `%s` has invalid talk type (datalong = %u) in SCRIPT_COMMAND_TALK for script id %u", tableName.c_str(), tmp.Talk.ChatType, tmp.id); continue; } if (!tmp.Talk.TextID) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `%s` has invalid talk text id (dataint = %i) in SCRIPT_COMMAND_TALK for script id %u", + TC_LOG_ERROR("sql.sql", "Table `%s` has invalid talk text id (dataint = %i) in SCRIPT_COMMAND_TALK for script id %u", tableName.c_str(), tmp.Talk.TextID, tmp.id); continue; } if (tmp.Talk.TextID < MIN_DB_SCRIPT_STRING_ID || tmp.Talk.TextID >= MAX_DB_SCRIPT_STRING_ID) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `%s` has out of range text id (dataint = %i expected %u-%u) in SCRIPT_COMMAND_TALK for script id %u", + TC_LOG_ERROR("sql.sql", "Table `%s` has out of range text id (dataint = %i expected %u-%u) in SCRIPT_COMMAND_TALK for script id %u", tableName.c_str(), tmp.Talk.TextID, MIN_DB_SCRIPT_STRING_ID, MAX_DB_SCRIPT_STRING_ID, tmp.id); continue; } @@ -4476,7 +4482,7 @@ void ObjectMgr::LoadScripts(ScriptsType type) { if (!sEmotesStore.LookupEntry(tmp.Emote.EmoteID)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `%s` has invalid emote id (datalong = %u) in SCRIPT_COMMAND_EMOTE for script id %u", + TC_LOG_ERROR("sql.sql", "Table `%s` has invalid emote id (datalong = %u) in SCRIPT_COMMAND_EMOTE for script id %u", tableName.c_str(), tmp.Emote.EmoteID, tmp.id); continue; } @@ -4487,14 +4493,14 @@ void ObjectMgr::LoadScripts(ScriptsType type) { if (!sMapStore.LookupEntry(tmp.TeleportTo.MapID)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `%s` has invalid map (Id: %u) in SCRIPT_COMMAND_TELEPORT_TO for script id %u", + TC_LOG_ERROR("sql.sql", "Table `%s` has invalid map (Id: %u) in SCRIPT_COMMAND_TELEPORT_TO for script id %u", tableName.c_str(), tmp.TeleportTo.MapID, tmp.id); continue; } if (!Trinity::IsValidMapCoord(tmp.TeleportTo.DestX, tmp.TeleportTo.DestY, tmp.TeleportTo.DestZ, tmp.TeleportTo.Orientation)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `%s` has invalid coordinates (X: %f Y: %f Z: %f O: %f) in SCRIPT_COMMAND_TELEPORT_TO for script id %u", + TC_LOG_ERROR("sql.sql", "Table `%s` has invalid coordinates (X: %f Y: %f Z: %f O: %f) in SCRIPT_COMMAND_TELEPORT_TO for script id %u", tableName.c_str(), tmp.TeleportTo.DestX, tmp.TeleportTo.DestY, tmp.TeleportTo.DestZ, tmp.TeleportTo.Orientation, tmp.id); continue; } @@ -4506,14 +4512,14 @@ void ObjectMgr::LoadScripts(ScriptsType type) Quest const* quest = GetQuestTemplate(tmp.QuestExplored.QuestID); if (!quest) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `%s` has invalid quest (ID: %u) in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u", + TC_LOG_ERROR("sql.sql", "Table `%s` has invalid quest (ID: %u) in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u", tableName.c_str(), tmp.QuestExplored.QuestID, tmp.id); continue; } if (!quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `%s` has quest (ID: %u) in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, but quest not have flag QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT in quest flags. Script command or quest flags wrong. Quest modified to require objective.", + TC_LOG_ERROR("sql.sql", "Table `%s` has quest (ID: %u) in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, but quest not have flag QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT in quest flags. Script command or quest flags wrong. Quest modified to require objective.", tableName.c_str(), tmp.QuestExplored.QuestID, tmp.id); // this will prevent quest completing without objective @@ -4524,21 +4530,21 @@ void ObjectMgr::LoadScripts(ScriptsType type) if (float(tmp.QuestExplored.Distance) > DEFAULT_VISIBILITY_DISTANCE) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `%s` has too large distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u", + TC_LOG_ERROR("sql.sql", "Table `%s` has too large distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u", tableName.c_str(), tmp.QuestExplored.Distance, tmp.id); continue; } if (tmp.QuestExplored.Distance && float(tmp.QuestExplored.Distance) > DEFAULT_VISIBILITY_DISTANCE) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `%s` has too large distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, max distance is %f or 0 for disable distance check", + TC_LOG_ERROR("sql.sql", "Table `%s` has too large distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, max distance is %f or 0 for disable distance check", tableName.c_str(), tmp.QuestExplored.Distance, tmp.id, DEFAULT_VISIBILITY_DISTANCE); continue; } if (tmp.QuestExplored.Distance && float(tmp.QuestExplored.Distance) < INTERACTION_DISTANCE) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `%s` has too small distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, min distance is %f or 0 for disable distance check", + TC_LOG_ERROR("sql.sql", "Table `%s` has too small distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, min distance is %f or 0 for disable distance check", tableName.c_str(), tmp.QuestExplored.Distance, tmp.id, INTERACTION_DISTANCE); continue; } @@ -4550,7 +4556,7 @@ void ObjectMgr::LoadScripts(ScriptsType type) { if (!GetCreatureTemplate(tmp.KillCredit.CreatureEntry)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `%s` has invalid creature (Entry: %u) in SCRIPT_COMMAND_KILL_CREDIT for script id %u", + TC_LOG_ERROR("sql.sql", "Table `%s` has invalid creature (Entry: %u) in SCRIPT_COMMAND_KILL_CREDIT for script id %u", tableName.c_str(), tmp.KillCredit.CreatureEntry, tmp.id); continue; } @@ -4562,7 +4568,7 @@ void ObjectMgr::LoadScripts(ScriptsType type) GameObjectData const* data = GetGOData(tmp.RespawnGameobject.GOGuid); if (!data) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `%s` has invalid gameobject (GUID: %u) in SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u", + TC_LOG_ERROR("sql.sql", "Table `%s` has invalid gameobject (GUID: %u) in SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u", tableName.c_str(), tmp.RespawnGameobject.GOGuid, tmp.id); continue; } @@ -4570,7 +4576,7 @@ void ObjectMgr::LoadScripts(ScriptsType type) GameObjectTemplate const* info = GetGameObjectTemplate(data->id); if (!info) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `%s` has gameobject with invalid entry (GUID: %u Entry: %u) in SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u", + TC_LOG_ERROR("sql.sql", "Table `%s` has gameobject with invalid entry (GUID: %u Entry: %u) in SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u", tableName.c_str(), tmp.RespawnGameobject.GOGuid, data->id, tmp.id); continue; } @@ -4581,7 +4587,7 @@ void ObjectMgr::LoadScripts(ScriptsType type) info->type == GAMEOBJECT_TYPE_BUTTON || info->type == GAMEOBJECT_TYPE_TRAP) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `%s` have gameobject type (%u) unsupported by command SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u", + TC_LOG_ERROR("sql.sql", "Table `%s` have gameobject type (%u) unsupported by command SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u", tableName.c_str(), info->entry, tmp.id); continue; } @@ -4592,14 +4598,14 @@ void ObjectMgr::LoadScripts(ScriptsType type) { if (!Trinity::IsValidMapCoord(tmp.TempSummonCreature.PosX, tmp.TempSummonCreature.PosY, tmp.TempSummonCreature.PosZ, tmp.TempSummonCreature.Orientation)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `%s` has invalid coordinates (X: %f Y: %f Z: %f O: %f) in SCRIPT_COMMAND_TEMP_SUMMON_CREATURE for script id %u", + TC_LOG_ERROR("sql.sql", "Table `%s` has invalid coordinates (X: %f Y: %f Z: %f O: %f) in SCRIPT_COMMAND_TEMP_SUMMON_CREATURE for script id %u", tableName.c_str(), tmp.TempSummonCreature.PosX, tmp.TempSummonCreature.PosY, tmp.TempSummonCreature.PosZ, tmp.TempSummonCreature.Orientation, tmp.id); continue; } if (!GetCreatureTemplate(tmp.TempSummonCreature.CreatureEntry)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `%s` has invalid creature (Entry: %u) in SCRIPT_COMMAND_TEMP_SUMMON_CREATURE for script id %u", + TC_LOG_ERROR("sql.sql", "Table `%s` has invalid creature (Entry: %u) in SCRIPT_COMMAND_TEMP_SUMMON_CREATURE for script id %u", tableName.c_str(), tmp.TempSummonCreature.CreatureEntry, tmp.id); continue; } @@ -4612,7 +4618,7 @@ void ObjectMgr::LoadScripts(ScriptsType type) GameObjectData const* data = GetGOData(tmp.ToggleDoor.GOGuid); if (!data) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `%s` has invalid gameobject (GUID: %u) in %s for script id %u", + TC_LOG_ERROR("sql.sql", "Table `%s` has invalid gameobject (GUID: %u) in %s for script id %u", tableName.c_str(), tmp.ToggleDoor.GOGuid, GetScriptCommandName(tmp.command).c_str(), tmp.id); continue; } @@ -4620,14 +4626,14 @@ void ObjectMgr::LoadScripts(ScriptsType type) GameObjectTemplate const* info = GetGameObjectTemplate(data->id); if (!info) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `%s` has gameobject with invalid entry (GUID: %u Entry: %u) in %s for script id %u", + TC_LOG_ERROR("sql.sql", "Table `%s` has gameobject with invalid entry (GUID: %u Entry: %u) in %s for script id %u", tableName.c_str(), tmp.ToggleDoor.GOGuid, data->id, GetScriptCommandName(tmp.command).c_str(), tmp.id); continue; } if (info->type != GAMEOBJECT_TYPE_DOOR) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `%s` has gameobject type (%u) non supported by command %s for script id %u", + TC_LOG_ERROR("sql.sql", "Table `%s` has gameobject type (%u) non supported by command %s for script id %u", tableName.c_str(), info->entry, GetScriptCommandName(tmp.command).c_str(), tmp.id); continue; } @@ -4639,13 +4645,13 @@ void ObjectMgr::LoadScripts(ScriptsType type) { if (!sSpellMgr->GetSpellInfo(tmp.RemoveAura.SpellID)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `%s` using non-existent spell (id: %u) in SCRIPT_COMMAND_REMOVE_AURA for script id %u", + TC_LOG_ERROR("sql.sql", "Table `%s` using non-existent spell (id: %u) in SCRIPT_COMMAND_REMOVE_AURA for script id %u", tableName.c_str(), tmp.RemoveAura.SpellID, tmp.id); continue; } if (tmp.RemoveAura.Flags & ~0x1) // 1 bits (0, 1) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `%s` using unknown flags in datalong2 (%u) in SCRIPT_COMMAND_REMOVE_AURA for script id %u", + TC_LOG_ERROR("sql.sql", "Table `%s` using unknown flags in datalong2 (%u) in SCRIPT_COMMAND_REMOVE_AURA for script id %u", tableName.c_str(), tmp.RemoveAura.Flags, tmp.id); continue; } @@ -4656,25 +4662,25 @@ void ObjectMgr::LoadScripts(ScriptsType type) { if (!sSpellMgr->GetSpellInfo(tmp.CastSpell.SpellID)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `%s` using non-existent spell (id: %u) in SCRIPT_COMMAND_CAST_SPELL for script id %u", + TC_LOG_ERROR("sql.sql", "Table `%s` using non-existent spell (id: %u) in SCRIPT_COMMAND_CAST_SPELL for script id %u", tableName.c_str(), tmp.CastSpell.SpellID, tmp.id); continue; } if (tmp.CastSpell.Flags > 4) // targeting type { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `%s` using unknown target in datalong2 (%u) in SCRIPT_COMMAND_CAST_SPELL for script id %u", + TC_LOG_ERROR("sql.sql", "Table `%s` using unknown target in datalong2 (%u) in SCRIPT_COMMAND_CAST_SPELL for script id %u", tableName.c_str(), tmp.CastSpell.Flags, tmp.id); continue; } if (tmp.CastSpell.Flags != 4 && tmp.CastSpell.CreatureEntry & ~0x1) // 1 bit (0, 1) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `%s` using unknown flags in dataint (%u) in SCRIPT_COMMAND_CAST_SPELL for script id %u", + TC_LOG_ERROR("sql.sql", "Table `%s` using unknown flags in dataint (%u) in SCRIPT_COMMAND_CAST_SPELL for script id %u", tableName.c_str(), tmp.CastSpell.CreatureEntry, tmp.id); continue; } else if (tmp.CastSpell.Flags == 4 && !GetCreatureTemplate(tmp.CastSpell.CreatureEntry)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `%s` using invalid creature entry in dataint (%u) in SCRIPT_COMMAND_CAST_SPELL for script id %u", + TC_LOG_ERROR("sql.sql", "Table `%s` using invalid creature entry in dataint (%u) in SCRIPT_COMMAND_CAST_SPELL for script id %u", tableName.c_str(), tmp.CastSpell.CreatureEntry, tmp.id); continue; } @@ -4685,13 +4691,13 @@ void ObjectMgr::LoadScripts(ScriptsType type) { if (!GetItemTemplate(tmp.CreateItem.ItemEntry)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `%s` has nonexistent item (entry: %u) in SCRIPT_COMMAND_CREATE_ITEM for script id %u", + TC_LOG_ERROR("sql.sql", "Table `%s` has nonexistent item (entry: %u) in SCRIPT_COMMAND_CREATE_ITEM for script id %u", tableName.c_str(), tmp.CreateItem.ItemEntry, tmp.id); continue; } if (!tmp.CreateItem.Amount) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `%s` SCRIPT_COMMAND_CREATE_ITEM but amount is %u for script id %u", + TC_LOG_ERROR("sql.sql", "Table `%s` SCRIPT_COMMAND_CREATE_ITEM but amount is %u for script id %u", tableName.c_str(), tmp.CreateItem.Amount, tmp.id); continue; } @@ -4712,7 +4718,7 @@ void ObjectMgr::LoadScripts(ScriptsType type) } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u script definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u script definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadSpellScripts() @@ -4727,14 +4733,14 @@ void ObjectMgr::LoadSpellScripts() if (!spellInfo) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `spell_scripts` has not existing spell (Id: %u) as script id", spellId); + TC_LOG_ERROR("sql.sql", "Table `spell_scripts` has not existing spell (Id: %u) as script id", spellId); continue; } uint8 i = (uint8)((uint32(itr->first) >> 24) & 0x000000FF); //check for correct spellEffect if (!spellInfo->Effects[i].Effect || (spellInfo->Effects[i].Effect != SPELL_EFFECT_SCRIPT_EFFECT && spellInfo->Effects[i].Effect != SPELL_EFFECT_DUMMY)) - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `spell_scripts` - spell %u effect %u is not SPELL_EFFECT_SCRIPT_EFFECT or SPELL_EFFECT_DUMMY", spellId, i); + TC_LOG_ERROR("sql.sql", "Table `spell_scripts` - spell %u effect %u is not SPELL_EFFECT_SCRIPT_EFFECT or SPELL_EFFECT_DUMMY", spellId, i); } } @@ -4776,7 +4782,7 @@ void ObjectMgr::LoadEventScripts() { std::set<uint32>::const_iterator itr2 = evt_scripts.find(itr->first); if (itr2 == evt_scripts.end()) - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `event_scripts` has script (Id: %u) not referring to any gameobject_template type 10 data2 field, type 3 data6 field, type 13 data 2 field or any spell effect %u", + TC_LOG_ERROR("sql.sql", "Table `event_scripts` has script (Id: %u) not referring to any gameobject_template type 10 data2 field, type 3 data6 field, type 13 data 2 field or any spell effect %u", itr->first, SPELL_EFFECT_SEND_EVENT); } } @@ -4807,7 +4813,7 @@ void ObjectMgr::LoadWaypointScripts() } for (std::set<uint32>::iterator itr = actionSet.begin(); itr != actionSet.end(); ++itr) - TC_LOG_ERROR(LOG_FILTER_SQL, "There is no waypoint which links to the waypoint script %u", *itr); + TC_LOG_ERROR("sql.sql", "There is no waypoint which links to the waypoint script %u", *itr); } void ObjectMgr::LoadSpellScriptNames() @@ -4820,7 +4826,7 @@ void ObjectMgr::LoadSpellScriptNames() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell script names. DB table `spell_script_names` is empty!"); + TC_LOG_INFO("server.loading", ">> Loaded 0 spell script names. DB table `spell_script_names` is empty!"); return; } @@ -4844,18 +4850,18 @@ void ObjectMgr::LoadSpellScriptNames() SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); if (!spellInfo) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Scriptname: `%s` spell (Id: %d) does not exist.", scriptName, spellId); + TC_LOG_ERROR("sql.sql", "Scriptname: `%s` spell (Id: %d) does not exist.", scriptName, spellId); continue; } if (allRanks) { if (!spellInfo->IsRanked()) - TC_LOG_ERROR(LOG_FILTER_SQL, "Scriptname: `%s` spell (Id: %d) has no ranks of spell.", scriptName, fields[0].GetInt32()); + TC_LOG_ERROR("sql.sql", "Scriptname: `%s` spell (Id: %d) has no ranks of spell.", scriptName, fields[0].GetInt32()); if (spellInfo->GetFirstRankSpell()->Id != uint32(spellId)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Scriptname: `%s` spell (Id: %d) is not first rank of spell.", scriptName, fields[0].GetInt32()); + TC_LOG_ERROR("sql.sql", "Scriptname: `%s` spell (Id: %d) is not first rank of spell.", scriptName, fields[0].GetInt32()); continue; } @@ -4868,7 +4874,7 @@ void ObjectMgr::LoadSpellScriptNames() else { if (spellInfo->IsRanked()) - TC_LOG_ERROR(LOG_FILTER_SQL, "Scriptname: `%s` spell (Id: %d) is ranked spell. Perhaps not all ranks are assigned to this script.", scriptName, spellId); + TC_LOG_ERROR("sql.sql", "Scriptname: `%s` spell (Id: %d) is ranked spell. Perhaps not all ranks are assigned to this script.", scriptName, spellId); _spellScriptsStore.insert(SpellScriptsContainer::value_type(spellInfo->Id, GetScriptId(scriptName))); } @@ -4877,7 +4883,7 @@ void ObjectMgr::LoadSpellScriptNames() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell script names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u spell script names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::ValidateSpellScripts() @@ -4886,7 +4892,7 @@ void ObjectMgr::ValidateSpellScripts() if (_spellScriptsStore.empty()) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Validated 0 scripts."); + TC_LOG_INFO("server.loading", ">> Validated 0 scripts."); return; } @@ -4906,7 +4912,7 @@ void ObjectMgr::ValidateSpellScripts() bool valid = true; if (!spellScript && !auraScript) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "Functions GetSpellScript() and GetAuraScript() of script `%s` do not return objects - script skipped", GetScriptName(sitr->second->second)); + TC_LOG_ERROR("scripts", "Functions GetSpellScript() and GetAuraScript() of script `%s` do not return objects - script skipped", GetScriptName(sitr->second->second)); valid = false; } if (spellScript) @@ -4933,7 +4939,7 @@ void ObjectMgr::ValidateSpellScripts() ++count; } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Validated %u scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Validated %u scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadPageTexts() @@ -4945,7 +4951,7 @@ void ObjectMgr::LoadPageTexts() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 page texts. DB table `page_text` is empty!"); + TC_LOG_INFO("server.loading", ">> Loaded 0 page texts. DB table `page_text` is empty!"); return; } @@ -4969,12 +4975,12 @@ void ObjectMgr::LoadPageTexts() { PageTextContainer::const_iterator itr2 = _pageTextStore.find(itr->second.NextPage); if (itr2 == _pageTextStore.end()) - TC_LOG_ERROR(LOG_FILTER_SQL, "Page text (Id: %u) has not existing next page (Id: %u)", itr->first, itr->second.NextPage); + TC_LOG_ERROR("sql.sql", "Page text (Id: %u) has not existing next page (Id: %u)", itr->first, itr->second.NextPage); } } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u page texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u page texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } PageText const* ObjectMgr::GetPageText(uint32 pageEntry) @@ -5009,7 +5015,7 @@ void ObjectMgr::LoadPageTextLocales() AddLocaleString(fields[i].GetString(), LocaleConstant(i), data.Text); } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu PageText locale strings in %u ms", (unsigned long)_pageTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %lu PageText locale strings in %u ms", (unsigned long)_pageTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadInstanceTemplate() @@ -5021,7 +5027,7 @@ void ObjectMgr::LoadInstanceTemplate() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 instance templates. DB table `page_text` is empty!"); + TC_LOG_INFO("server.loading", ">> Loaded 0 instance templates. DB table `page_text` is empty!"); return; } @@ -5034,7 +5040,7 @@ void ObjectMgr::LoadInstanceTemplate() if (!MapManager::IsValidMAP(mapID, true)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "ObjectMgr::LoadInstanceTemplate: bad mapid %d for template!", mapID); + TC_LOG_ERROR("sql.sql", "ObjectMgr::LoadInstanceTemplate: bad mapid %d for template!", mapID); continue; } @@ -5050,7 +5056,7 @@ void ObjectMgr::LoadInstanceTemplate() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u instance templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u instance templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } InstanceTemplate const* ObjectMgr::GetInstanceTemplate(uint32 mapID) @@ -5070,7 +5076,7 @@ void ObjectMgr::LoadInstanceEncounters() QueryResult result = WorldDatabase.Query("SELECT entry, creditType, creditEntry, lastEncounterDungeon FROM instance_encounters"); if (!result) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 instance encounters, table is empty!"); + TC_LOG_ERROR("server.loading", ">> Loaded 0 instance encounters, table is empty!"); return; } @@ -5086,13 +5092,13 @@ void ObjectMgr::LoadInstanceEncounters() DungeonEncounterEntry const* dungeonEncounter = sDungeonEncounterStore.LookupEntry(entry); if (!dungeonEncounter) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `instance_encounters` has an invalid encounter id %u, skipped!", entry); + TC_LOG_ERROR("sql.sql", "Table `instance_encounters` has an invalid encounter id %u, skipped!", entry); continue; } if (lastEncounterDungeon && !sLFGMgr->GetLFGDungeonEntry(lastEncounterDungeon)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `instance_encounters` has an encounter %u (%s) marked as final for invalid dungeon id %u, skipped!", entry, dungeonEncounter->encounterName[0], lastEncounterDungeon); + TC_LOG_ERROR("sql.sql", "Table `instance_encounters` has an encounter %u (%s) marked as final for invalid dungeon id %u, skipped!", entry, dungeonEncounter->encounterName[0], lastEncounterDungeon); continue; } @@ -5101,7 +5107,7 @@ void ObjectMgr::LoadInstanceEncounters() { if (itr != dungeonLastBosses.end()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `instance_encounters` specified encounter %u (%s) as last encounter but %u (%s) is already marked as one, skipped!", entry, dungeonEncounter->encounterName[0], itr->second->id, itr->second->encounterName[0]); + TC_LOG_ERROR("sql.sql", "Table `instance_encounters` specified encounter %u (%s) as last encounter but %u (%s) is already marked as one, skipped!", entry, dungeonEncounter->encounterName[0], itr->second->id, itr->second->encounterName[0]); continue; } @@ -5115,7 +5121,7 @@ void ObjectMgr::LoadInstanceEncounters() CreatureTemplate const* creatureInfo = GetCreatureTemplate(creditEntry); if (!creatureInfo) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `instance_encounters` has an invalid creature (entry %u) linked to the encounter %u (%s), skipped!", creditEntry, entry, dungeonEncounter->encounterName[0]); + TC_LOG_ERROR("sql.sql", "Table `instance_encounters` has an invalid creature (entry %u) linked to the encounter %u (%s), skipped!", creditEntry, entry, dungeonEncounter->encounterName[0]); continue; } const_cast<CreatureTemplate*>(creatureInfo)->flags_extra |= CREATURE_FLAG_EXTRA_DUNGEON_BOSS; @@ -5124,12 +5130,12 @@ void ObjectMgr::LoadInstanceEncounters() case ENCOUNTER_CREDIT_CAST_SPELL: if (!sSpellMgr->GetSpellInfo(creditEntry)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `instance_encounters` has an invalid spell (entry %u) linked to the encounter %u (%s), skipped!", creditEntry, entry, dungeonEncounter->encounterName[0]); + TC_LOG_ERROR("sql.sql", "Table `instance_encounters` has an invalid spell (entry %u) linked to the encounter %u (%s), skipped!", creditEntry, entry, dungeonEncounter->encounterName[0]); continue; } break; default: - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `instance_encounters` has an invalid credit type (%u) for encounter %u (%s), skipped!", creditType, entry, dungeonEncounter->encounterName[0]); + TC_LOG_ERROR("sql.sql", "Table `instance_encounters` has an invalid credit type (%u) for encounter %u (%s), skipped!", creditType, entry, dungeonEncounter->encounterName[0]); continue; } @@ -5138,7 +5144,7 @@ void ObjectMgr::LoadInstanceEncounters() ++count; } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u instance encounters in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u instance encounters in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } GossipText const* ObjectMgr::GetGossipText(uint32 Text_ID) const @@ -5158,7 +5164,7 @@ void ObjectMgr::LoadGossipText() int count = 0; if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u npc texts", count); + TC_LOG_INFO("server.loading", ">> Loaded %u npc texts", count); return; } _gossipTextStore.rehash(result->GetRowCount()); @@ -5175,7 +5181,7 @@ void ObjectMgr::LoadGossipText() uint32 Text_ID = fields[cic++].GetUInt32(); if (!Text_ID) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `npc_text` has record wit reserved id 0, ignore."); + TC_LOG_ERROR("sql.sql", "Table `npc_text` has record wit reserved id 0, ignore."); continue; } @@ -5197,7 +5203,7 @@ void ObjectMgr::LoadGossipText() } } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u npc texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u npc texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadNpcTextLocales() @@ -5239,7 +5245,7 @@ void ObjectMgr::LoadNpcTextLocales() } } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu NpcText locale strings in %u ms", (unsigned long)_npcTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %lu NpcText locale strings in %u ms", (unsigned long)_npcTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); } //not very fast function but it is called only once a day, or on starting-up @@ -5251,7 +5257,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) tm lt; ACE_OS::localtime_r(&curTime, <); uint64 basetime(curTime); - TC_LOG_INFO(LOG_FILTER_GENERAL, "Returning mails current time: hour: %d, minute: %d, second: %d ", lt.tm_hour, lt.tm_min, lt.tm_sec); + TC_LOG_INFO("misc", "Returning mails current time: hour: %d, minute: %d, second: %d ", lt.tm_hour, lt.tm_min, lt.tm_sec); // Delete all old mails without item and without body immediately, if starting server if (!serverUp) @@ -5265,7 +5271,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) PreparedQueryResult result = CharacterDatabase.Query(stmt); if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> No expired mails found."); + TC_LOG_INFO("server.loading", ">> No expired mails found."); return; // any mails need to be returned or deleted } @@ -5368,7 +5374,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Processed %u expired mails: %u deleted and %u returned in %u ms", deletedCount + returnedCount, deletedCount, returnedCount, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Processed %u expired mails: %u deleted and %u returned in %u ms", deletedCount + returnedCount, deletedCount, returnedCount, GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadQuestAreaTriggers() @@ -5381,7 +5387,7 @@ void ObjectMgr::LoadQuestAreaTriggers() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 quest trigger points. DB table `areatrigger_involvedrelation` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 quest trigger points. DB table `areatrigger_involvedrelation` is empty."); return; } @@ -5399,7 +5405,7 @@ void ObjectMgr::LoadQuestAreaTriggers() AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(trigger_ID); if (!atEntry) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", trigger_ID); + TC_LOG_ERROR("sql.sql", "Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", trigger_ID); continue; } @@ -5407,13 +5413,13 @@ void ObjectMgr::LoadQuestAreaTriggers() if (!quest) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `areatrigger_involvedrelation` has record (id: %u) for not existing quest %u", trigger_ID, quest_ID); + TC_LOG_ERROR("sql.sql", "Table `areatrigger_involvedrelation` has record (id: %u) for not existing quest %u", trigger_ID, quest_ID); continue; } if (!quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `areatrigger_involvedrelation` has record (id: %u) for not quest %u, but quest not have flag QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT. Trigger or quest flags must be fixed, quest modified to require objective.", trigger_ID, quest_ID); + TC_LOG_ERROR("sql.sql", "Table `areatrigger_involvedrelation` has record (id: %u) for not quest %u, but quest not have flag QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT. Trigger or quest flags must be fixed, quest modified to require objective.", trigger_ID, quest_ID); // this will prevent quest completing without objective const_cast<Quest*>(quest)->SetSpecialFlag(QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT); @@ -5425,7 +5431,7 @@ void ObjectMgr::LoadQuestAreaTriggers() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quest trigger points in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u quest trigger points in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadTavernAreaTriggers() @@ -5438,7 +5444,7 @@ void ObjectMgr::LoadTavernAreaTriggers() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 tavern triggers. DB table `areatrigger_tavern` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 tavern triggers. DB table `areatrigger_tavern` is empty."); return; } @@ -5455,14 +5461,14 @@ void ObjectMgr::LoadTavernAreaTriggers() AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(Trigger_ID); if (!atEntry) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", Trigger_ID); + TC_LOG_ERROR("sql.sql", "Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", Trigger_ID); continue; } _tavernAreaTriggerStore.insert(Trigger_ID); } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u tavern triggers in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u tavern triggers in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadAreaTriggerScripts() @@ -5474,7 +5480,7 @@ void ObjectMgr::LoadAreaTriggerScripts() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 areatrigger scripts. DB table `areatrigger_scripts` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 areatrigger scripts. DB table `areatrigger_scripts` is empty."); return; } @@ -5492,13 +5498,13 @@ void ObjectMgr::LoadAreaTriggerScripts() AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(Trigger_ID); if (!atEntry) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", Trigger_ID); + TC_LOG_ERROR("sql.sql", "Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", Trigger_ID); continue; } _areaTriggerScriptStore[Trigger_ID] = GetScriptId(scriptName); } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u areatrigger scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u areatrigger scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } uint32 ObjectMgr::GetNearestTaxiNode(float x, float y, float z, uint32 mapid, uint32 team) @@ -5593,7 +5599,7 @@ uint32 ObjectMgr::GetTaxiMountDisplayId(uint32 id, uint32 team, bool allowed_alt mount_id = mount_info->GetRandomValidModelId(); if (!mount_id) { - TC_LOG_ERROR(LOG_FILTER_SQL, "No displayid found for the taxi mount with the entry %u! Can't load it!", mount_entry); + TC_LOG_ERROR("sql.sql", "No displayid found for the taxi mount with the entry %u! Can't load it!", mount_entry); return 0; } } @@ -5616,7 +5622,7 @@ void ObjectMgr::LoadGraveyardZones() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 graveyard-zone links. DB table `game_graveyard_zone` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 graveyard-zone links. DB table `game_graveyard_zone` is empty."); return; } @@ -5635,34 +5641,34 @@ void ObjectMgr::LoadGraveyardZones() WorldSafeLocsEntry const* entry = sWorldSafeLocsStore.LookupEntry(safeLocId); if (!entry) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `game_graveyard_zone` has a record for not existing graveyard (WorldSafeLocs.dbc id) %u, skipped.", safeLocId); + TC_LOG_ERROR("sql.sql", "Table `game_graveyard_zone` has a record for not existing graveyard (WorldSafeLocs.dbc id) %u, skipped.", safeLocId); continue; } AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(zoneId); if (!areaEntry) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `game_graveyard_zone` has a record for not existing zone id (%u), skipped.", zoneId); + TC_LOG_ERROR("sql.sql", "Table `game_graveyard_zone` has a record for not existing zone id (%u), skipped.", zoneId); continue; } if (areaEntry->zone != 0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `game_graveyard_zone` has a record for subzone id (%u) instead of zone, skipped.", zoneId); + TC_LOG_ERROR("sql.sql", "Table `game_graveyard_zone` has a record for subzone id (%u) instead of zone, skipped.", zoneId); continue; } if (team != 0 && team != HORDE && team != ALLIANCE) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `game_graveyard_zone` has a record for non player faction (%u), skipped.", team); + TC_LOG_ERROR("sql.sql", "Table `game_graveyard_zone` has a record for non player faction (%u), skipped.", team); continue; } if (!AddGraveYardLink(safeLocId, zoneId, team, false)) - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `game_graveyard_zone` has a duplicate record for Graveyard (ID: %u) and Zone (ID: %u), skipped.", safeLocId, zoneId); + TC_LOG_ERROR("sql.sql", "Table `game_graveyard_zone` has a duplicate record for Graveyard (ID: %u) and Zone (ID: %u), skipped.", safeLocId, zoneId); } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u graveyard-zone links in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u graveyard-zone links in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } WorldSafeLocsEntry const* ObjectMgr::GetDefaultGraveYard(uint32 team) @@ -5689,7 +5695,7 @@ WorldSafeLocsEntry const* ObjectMgr::GetClosestGraveYard(float x, float y, float { if (z > -500) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "ZoneId not found for map %u coords (%f, %f, %f)", MapId, x, y, z); + TC_LOG_ERROR("misc", "ZoneId not found for map %u coords (%f, %f, %f)", MapId, x, y, z); return GetDefaultGraveYard(team); } } @@ -5707,7 +5713,7 @@ WorldSafeLocsEntry const* ObjectMgr::GetClosestGraveYard(float x, float y, float // not need to check validity of map object; MapId _MUST_ be valid here if (range.first == range.second && !map->IsBattlegroundOrArena()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `game_graveyard_zone` incomplete: Zone %u Team %u does not have a linked graveyard.", zoneId, team); + TC_LOG_ERROR("sql.sql", "Table `game_graveyard_zone` incomplete: Zone %u Team %u does not have a linked graveyard.", zoneId, team); return GetDefaultGraveYard(team); } @@ -5733,7 +5739,7 @@ WorldSafeLocsEntry const* ObjectMgr::GetClosestGraveYard(float x, float y, float WorldSafeLocsEntry const* entry = sWorldSafeLocsStore.LookupEntry(data.safeLocId); if (!entry) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `game_graveyard_zone` has record for not existing graveyard (WorldSafeLocs.dbc id) %u, skipped.", data.safeLocId); + TC_LOG_ERROR("sql.sql", "Table `game_graveyard_zone` has record for not existing graveyard (WorldSafeLocs.dbc id) %u, skipped.", data.safeLocId); continue; } @@ -5848,7 +5854,7 @@ void ObjectMgr::RemoveGraveYardLink(uint32 id, uint32 zoneId, uint32 team, bool GraveYardMapBoundsNonConst range = GraveYardStore.equal_range(zoneId); if (range.first == range.second) { - //TC_LOG_ERROR(LOG_FILTER_SQL, "Table `game_graveyard_zone` incomplete: Zone %u Team %u does not have a linked graveyard.", zoneId, team); + //TC_LOG_ERROR("sql.sql", "Table `game_graveyard_zone` incomplete: Zone %u Team %u does not have a linked graveyard.", zoneId, team); return; } @@ -5902,7 +5908,7 @@ void ObjectMgr::LoadAreaTriggerTeleports() QueryResult result = WorldDatabase.Query("SELECT id, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM areatrigger_teleport"); if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 area trigger teleport definitions. DB table `areatrigger_teleport` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 area trigger teleport definitions. DB table `areatrigger_teleport` is empty."); return; } @@ -5927,20 +5933,20 @@ void ObjectMgr::LoadAreaTriggerTeleports() AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(Trigger_ID); if (!atEntry) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", Trigger_ID); + TC_LOG_ERROR("sql.sql", "Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", Trigger_ID); continue; } MapEntry const* mapEntry = sMapStore.LookupEntry(at.target_mapId); if (!mapEntry) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Area trigger (ID:%u) target map (ID: %u) does not exist in `Map.dbc`.", Trigger_ID, at.target_mapId); + TC_LOG_ERROR("sql.sql", "Area trigger (ID:%u) target map (ID: %u) does not exist in `Map.dbc`.", Trigger_ID, at.target_mapId); continue; } if (at.target_X == 0 && at.target_Y == 0 && at.target_Z == 0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Area trigger (ID:%u) target coordinates not provided.", Trigger_ID); + TC_LOG_ERROR("sql.sql", "Area trigger (ID:%u) target coordinates not provided.", Trigger_ID); continue; } @@ -5948,7 +5954,7 @@ void ObjectMgr::LoadAreaTriggerTeleports() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u area trigger teleport definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u area trigger teleport definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadAccessRequirements() @@ -5967,7 +5973,7 @@ void ObjectMgr::LoadAccessRequirements() QueryResult result = WorldDatabase.Query("SELECT mapid, difficulty, level_min, level_max, item, item2, quest_done_A, quest_done_H, completed_achievement, quest_failed_text FROM access_requirement"); if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 access requirement definitions. DB table `access_requirement` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 access requirement definitions. DB table `access_requirement` is empty."); return; } @@ -5999,7 +6005,7 @@ void ObjectMgr::LoadAccessRequirements() ItemTemplate const* pProto = GetItemTemplate(ar->item); if (!pProto) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Key item %u does not exist for map %u difficulty %u, removing key requirement.", ar->item, mapid, difficulty); + TC_LOG_ERROR("misc", "Key item %u does not exist for map %u difficulty %u, removing key requirement.", ar->item, mapid, difficulty); ar->item = 0; } } @@ -6009,7 +6015,7 @@ void ObjectMgr::LoadAccessRequirements() ItemTemplate const* pProto = GetItemTemplate(ar->item2); if (!pProto) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Second item %u does not exist for map %u difficulty %u, removing key requirement.", ar->item2, mapid, difficulty); + TC_LOG_ERROR("misc", "Second item %u does not exist for map %u difficulty %u, removing key requirement.", ar->item2, mapid, difficulty); ar->item2 = 0; } } @@ -6018,7 +6024,7 @@ void ObjectMgr::LoadAccessRequirements() { if (!GetQuestTemplate(ar->quest_A)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Required Alliance Quest %u not exist for map %u difficulty %u, remove quest done requirement.", ar->quest_A, mapid, difficulty); + TC_LOG_ERROR("sql.sql", "Required Alliance Quest %u not exist for map %u difficulty %u, remove quest done requirement.", ar->quest_A, mapid, difficulty); ar->quest_A = 0; } } @@ -6027,7 +6033,7 @@ void ObjectMgr::LoadAccessRequirements() { if (!GetQuestTemplate(ar->quest_H)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Required Horde Quest %u not exist for map %u difficulty %u, remove quest done requirement.", ar->quest_H, mapid, difficulty); + TC_LOG_ERROR("sql.sql", "Required Horde Quest %u not exist for map %u difficulty %u, remove quest done requirement.", ar->quest_H, mapid, difficulty); ar->quest_H = 0; } } @@ -6036,7 +6042,7 @@ void ObjectMgr::LoadAccessRequirements() { if (!sAchievementMgr->GetAchievement(ar->achievement)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Required Achievement %u not exist for map %u difficulty %u, remove quest done requirement.", ar->achievement, mapid, difficulty); + TC_LOG_ERROR("sql.sql", "Required Achievement %u not exist for map %u difficulty %u, remove quest done requirement.", ar->achievement, mapid, difficulty); ar->achievement = 0; } } @@ -6044,7 +6050,7 @@ void ObjectMgr::LoadAccessRequirements() _accessRequirementStore[requirement_ID] = ar; } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u access requirement definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u access requirement definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } /* @@ -6158,7 +6164,7 @@ uint32 ObjectMgr::GenerateAuctionID() { if (_auctionId >= 0xFFFFFFFE) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Auctions ids overflow!! Can't continue, shutting down server. "); + TC_LOG_ERROR("misc", "Auctions ids overflow!! Can't continue, shutting down server. "); World::StopNow(ERROR_EXIT_CODE); } return _auctionId++; @@ -6168,7 +6174,7 @@ uint64 ObjectMgr::GenerateEquipmentSetGuid() { if (_equipmentSetGuid >= uint64(0xFFFFFFFFFFFFFFFELL)) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "EquipmentSet guid overflow!! Can't continue, shutting down server. "); + TC_LOG_ERROR("misc", "EquipmentSet guid overflow!! Can't continue, shutting down server. "); World::StopNow(ERROR_EXIT_CODE); } return _equipmentSetGuid++; @@ -6178,7 +6184,7 @@ uint32 ObjectMgr::GenerateMailID() { if (_mailId >= 0xFFFFFFFE) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Mail ids overflow!! Can't continue, shutting down server. "); + TC_LOG_ERROR("misc", "Mail ids overflow!! Can't continue, shutting down server. "); World::StopNow(ERROR_EXIT_CODE); } return _mailId++; @@ -6268,7 +6274,7 @@ void ObjectMgr::LoadGameObjectLocales() AddLocaleString(fields[i + (TOTAL_LOCALES - 1)].GetString(), LocaleConstant(i), data.CastBarCaption); } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu gameobject locale strings in %u ms", (unsigned long)_gameObjectLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %lu gameobject locale strings in %u ms", (unsigned long)_gameObjectLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); } inline void CheckGOLockId(GameObjectTemplate const* goInfo, uint32 dataN, uint32 N) @@ -6276,7 +6282,7 @@ inline void CheckGOLockId(GameObjectTemplate const* goInfo, uint32 dataN, uint32 if (sLockStore.LookupEntry(dataN)) return; - TC_LOG_ERROR(LOG_FILTER_SQL, "Gameobject (Entry: %u GoType: %u) have data%d=%u but lock (Id: %u) not found.", + TC_LOG_ERROR("sql.sql", "Gameobject (Entry: %u GoType: %u) have data%d=%u but lock (Id: %u) not found.", goInfo->entry, goInfo->type, N, goInfo->door.lockId, goInfo->door.lockId); } @@ -6285,7 +6291,7 @@ inline void CheckGOLinkedTrapId(GameObjectTemplate const* goInfo, uint32 dataN, if (GameObjectTemplate const* trapInfo = sObjectMgr->GetGameObjectTemplate(dataN)) { if (trapInfo->type != GAMEOBJECT_TYPE_TRAP) - TC_LOG_ERROR(LOG_FILTER_SQL, "Gameobject (Entry: %u GoType: %u) have data%d=%u but GO (Entry %u) have not GAMEOBJECT_TYPE_TRAP (%u) type.", + TC_LOG_ERROR("sql.sql", "Gameobject (Entry: %u GoType: %u) have data%d=%u but GO (Entry %u) have not GAMEOBJECT_TYPE_TRAP (%u) type.", goInfo->entry, goInfo->type, N, dataN, dataN, GAMEOBJECT_TYPE_TRAP); } } @@ -6295,7 +6301,7 @@ inline void CheckGOSpellId(GameObjectTemplate const* goInfo, uint32 dataN, uint3 if (sSpellMgr->GetSpellInfo(dataN)) return; - TC_LOG_ERROR(LOG_FILTER_SQL, "Gameobject (Entry: %u GoType: %u) have data%d=%u but Spell (Entry %u) not exist.", + TC_LOG_ERROR("sql.sql", "Gameobject (Entry: %u GoType: %u) have data%d=%u but Spell (Entry %u) not exist.", goInfo->entry, goInfo->type, N, dataN, dataN); } @@ -6304,7 +6310,7 @@ inline void CheckAndFixGOChairHeightId(GameObjectTemplate const* goInfo, uint32 if (dataN <= (UNIT_STAND_STATE_SIT_HIGH_CHAIR-UNIT_STAND_STATE_SIT_LOW_CHAIR)) return; - TC_LOG_ERROR(LOG_FILTER_SQL, "Gameobject (Entry: %u GoType: %u) have data%d=%u but correct chair height in range 0..%i.", + TC_LOG_ERROR("sql.sql", "Gameobject (Entry: %u GoType: %u) have data%d=%u but correct chair height in range 0..%i.", goInfo->entry, goInfo->type, N, dataN, UNIT_STAND_STATE_SIT_HIGH_CHAIR-UNIT_STAND_STATE_SIT_LOW_CHAIR); // prevent client and server unexpected work @@ -6317,7 +6323,7 @@ inline void CheckGONoDamageImmuneId(GameObjectTemplate* goTemplate, uint32 dataN if (dataN <= 1) return; - TC_LOG_ERROR(LOG_FILTER_SQL, "Gameobject (Entry: %u GoType: %u) have data%d=%u but expected boolean (0/1) noDamageImmune field value.", goTemplate->entry, goTemplate->type, N, dataN); + TC_LOG_ERROR("sql.sql", "Gameobject (Entry: %u GoType: %u) have data%d=%u but expected boolean (0/1) noDamageImmune field value.", goTemplate->entry, goTemplate->type, N, dataN); } inline void CheckGOConsumable(GameObjectTemplate const* goInfo, uint32 dataN, uint32 N) @@ -6326,7 +6332,7 @@ inline void CheckGOConsumable(GameObjectTemplate const* goInfo, uint32 dataN, ui if (dataN <= 1) return; - TC_LOG_ERROR(LOG_FILTER_SQL, "Gameobject (Entry: %u GoType: %u) have data%d=%u but expected boolean (0/1) consumable field value.", + TC_LOG_ERROR("sql.sql", "Gameobject (Entry: %u GoType: %u) have data%d=%u but expected boolean (0/1) consumable field value.", goInfo->entry, goInfo->type, N, dataN); } @@ -6344,7 +6350,7 @@ void ObjectMgr::LoadGameObjectTemplate() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 gameobject definitions. DB table `gameobject_template` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 gameobject definitions. DB table `gameobject_template` is empty."); return; } @@ -6428,7 +6434,7 @@ void ObjectMgr::LoadGameObjectTemplate() if (got.spellFocus.focusId) { if (!sSpellFocusObjectStore.LookupEntry(got.spellFocus.focusId)) - TC_LOG_ERROR(LOG_FILTER_SQL, "GameObject (Entry: %u GoType: %u) have data0=%u but SpellFocus (Id: %u) not exist.", + TC_LOG_ERROR("sql.sql", "GameObject (Entry: %u GoType: %u) have data0=%u but SpellFocus (Id: %u) not exist.", entry, got.type, got.spellFocus.focusId, got.spellFocus.focusId); } @@ -6446,7 +6452,7 @@ void ObjectMgr::LoadGameObjectTemplate() if (got.goober.pageId) // pageId { if (!GetPageText(got.goober.pageId)) - TC_LOG_ERROR(LOG_FILTER_SQL, "GameObject (Entry: %u GoType: %u) have data7=%u but PageText (Entry %u) not exist.", + TC_LOG_ERROR("sql.sql", "GameObject (Entry: %u GoType: %u) have data7=%u but PageText (Entry %u) not exist.", entry, got.type, got.goober.pageId, got.goober.pageId); } CheckGONoDamageImmuneId(&got, got.goober.noDamageImmune, 11); @@ -6471,7 +6477,7 @@ void ObjectMgr::LoadGameObjectTemplate() if (got.moTransport.taxiPathId) { if (got.moTransport.taxiPathId >= sTaxiPathNodesByPath.size() || sTaxiPathNodesByPath[got.moTransport.taxiPathId].empty()) - TC_LOG_ERROR(LOG_FILTER_SQL, "GameObject (Entry: %u GoType: %u) have data0=%u but TaxiPath (Id: %u) not exist.", + TC_LOG_ERROR("sql.sql", "GameObject (Entry: %u GoType: %u) have data0=%u but TaxiPath (Id: %u) not exist.", entry, got.type, got.moTransport.taxiPathId, got.moTransport.taxiPathId); } break; @@ -6513,7 +6519,7 @@ void ObjectMgr::LoadGameObjectTemplate() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u game object templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u game object templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadExplorationBaseXP() @@ -6524,7 +6530,7 @@ void ObjectMgr::LoadExplorationBaseXP() if (!result) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 BaseXP definitions. DB table `exploration_basexp` is empty."); + TC_LOG_ERROR("server.loading", ">> Loaded 0 BaseXP definitions. DB table `exploration_basexp` is empty."); return; } @@ -6540,7 +6546,7 @@ void ObjectMgr::LoadExplorationBaseXP() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u BaseXP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u BaseXP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } uint32 ObjectMgr::GetBaseXP(uint8 level) @@ -6563,7 +6569,7 @@ void ObjectMgr::LoadPetNames() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 pet name parts. DB table `pet_name_generation` is empty!"); + TC_LOG_INFO("server.loading", ">> Loaded 0 pet name parts. DB table `pet_name_generation` is empty!"); return; } @@ -6583,7 +6589,7 @@ void ObjectMgr::LoadPetNames() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u pet name parts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u pet name parts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadPetNumber() @@ -6597,7 +6603,7 @@ void ObjectMgr::LoadPetNumber() _hiPetNumber = fields[0].GetUInt32()+1; } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded the max pet number: %d in %u ms", _hiPetNumber-1, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded the max pet number: %d in %u ms", _hiPetNumber-1, GetMSTimeDiffToNow(oldMSTime)); } std::string ObjectMgr::GeneratePetName(uint32 entry) @@ -6633,7 +6639,7 @@ void ObjectMgr::LoadCorpses() PreparedQueryResult result = CharacterDatabase.Query(CharacterDatabase.GetPreparedStatement(CHAR_SEL_CORPSES)); if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 corpses. DB table `corpse` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 corpses. DB table `corpse` is empty."); return; } @@ -6645,7 +6651,7 @@ void ObjectMgr::LoadCorpses() CorpseType type = CorpseType(fields[13].GetUInt8()); if (type >= MAX_CORPSE_TYPE) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Corpse (guid: %u) have wrong corpse type (%u), not loading.", guid, type); + TC_LOG_ERROR("misc", "Corpse (guid: %u) have wrong corpse type (%u), not loading.", guid, type); continue; } @@ -6661,7 +6667,7 @@ void ObjectMgr::LoadCorpses() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u corpses in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u corpses in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadReputationRewardRate() @@ -6674,7 +6680,7 @@ void ObjectMgr::LoadReputationRewardRate() QueryResult result = WorldDatabase.Query("SELECT faction, quest_rate, quest_daily_rate, quest_weekly_rate, quest_monthly_rate, quest_repeatable_rate, creature_rate, spell_rate FROM reputation_reward_rate"); if (!result) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded `reputation_reward_rate`, table is empty!"); + TC_LOG_ERROR("server.loading", ">> Loaded `reputation_reward_rate`, table is empty!"); return; } @@ -6697,49 +6703,49 @@ void ObjectMgr::LoadReputationRewardRate() FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionId); if (!factionEntry) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Faction (faction.dbc) %u does not exist but is used in `reputation_reward_rate`", factionId); + TC_LOG_ERROR("sql.sql", "Faction (faction.dbc) %u does not exist but is used in `reputation_reward_rate`", factionId); continue; } if (repRate.questRate < 0.0f) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table reputation_reward_rate has quest_rate with invalid rate %f, skipping data for faction %u", repRate.questRate, factionId); + TC_LOG_ERROR("sql.sql", "Table reputation_reward_rate has quest_rate with invalid rate %f, skipping data for faction %u", repRate.questRate, factionId); continue; } if (repRate.questDailyRate < 0.0f) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table reputation_reward_rate has quest_daily_rate with invalid rate %f, skipping data for faction %u", repRate.questDailyRate, factionId); + TC_LOG_ERROR("sql.sql", "Table reputation_reward_rate has quest_daily_rate with invalid rate %f, skipping data for faction %u", repRate.questDailyRate, factionId); continue; } if (repRate.questWeeklyRate < 0.0f) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table reputation_reward_rate has quest_weekly_rate with invalid rate %f, skipping data for faction %u", repRate.questWeeklyRate, factionId); + TC_LOG_ERROR("sql.sql", "Table reputation_reward_rate has quest_weekly_rate with invalid rate %f, skipping data for faction %u", repRate.questWeeklyRate, factionId); continue; } if (repRate.questMonthlyRate < 0.0f) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table reputation_reward_rate has quest_monthly_rate with invalid rate %f, skipping data for faction %u", repRate.questMonthlyRate, factionId); + TC_LOG_ERROR("sql.sql", "Table reputation_reward_rate has quest_monthly_rate with invalid rate %f, skipping data for faction %u", repRate.questMonthlyRate, factionId); continue; } if (repRate.questRepeatableRate < 0.0f) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table reputation_reward_rate has quest_repeatable_rate with invalid rate %f, skipping data for faction %u", repRate.questRepeatableRate, factionId); + TC_LOG_ERROR("sql.sql", "Table reputation_reward_rate has quest_repeatable_rate with invalid rate %f, skipping data for faction %u", repRate.questRepeatableRate, factionId); continue; } if (repRate.creatureRate < 0.0f) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table reputation_reward_rate has creature_rate with invalid rate %f, skipping data for faction %u", repRate.creatureRate, factionId); + TC_LOG_ERROR("sql.sql", "Table reputation_reward_rate has creature_rate with invalid rate %f, skipping data for faction %u", repRate.creatureRate, factionId); continue; } if (repRate.spellRate < 0.0f) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table reputation_reward_rate has spell_rate with invalid rate %f, skipping data for faction %u", repRate.spellRate, factionId); + TC_LOG_ERROR("sql.sql", "Table reputation_reward_rate has spell_rate with invalid rate %f, skipping data for faction %u", repRate.spellRate, factionId); continue; } @@ -6749,7 +6755,7 @@ void ObjectMgr::LoadReputationRewardRate() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u reputation_reward_rate in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u reputation_reward_rate in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadReputationOnKill() @@ -6769,7 +6775,7 @@ void ObjectMgr::LoadReputationOnKill() if (!result) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature award reputation definitions. DB table `creature_onkill_reputation` is empty."); + TC_LOG_ERROR("server.loading", ">> Loaded 0 creature award reputation definitions. DB table `creature_onkill_reputation` is empty."); return; } @@ -6792,7 +6798,7 @@ void ObjectMgr::LoadReputationOnKill() if (!GetCreatureTemplate(creature_id)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `creature_onkill_reputation` have data for not existed creature entry (%u), skipped", creature_id); + TC_LOG_ERROR("sql.sql", "Table `creature_onkill_reputation` have data for not existed creature entry (%u), skipped", creature_id); continue; } @@ -6801,7 +6807,7 @@ void ObjectMgr::LoadReputationOnKill() FactionEntry const* factionEntry1 = sFactionStore.LookupEntry(repOnKill.RepFaction1); if (!factionEntry1) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Faction (faction.dbc) %u does not exist but is used in `creature_onkill_reputation`", repOnKill.RepFaction1); + TC_LOG_ERROR("sql.sql", "Faction (faction.dbc) %u does not exist but is used in `creature_onkill_reputation`", repOnKill.RepFaction1); continue; } } @@ -6811,7 +6817,7 @@ void ObjectMgr::LoadReputationOnKill() FactionEntry const* factionEntry2 = sFactionStore.LookupEntry(repOnKill.RepFaction2); if (!factionEntry2) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Faction (faction.dbc) %u does not exist but is used in `creature_onkill_reputation`", repOnKill.RepFaction2); + TC_LOG_ERROR("sql.sql", "Faction (faction.dbc) %u does not exist but is used in `creature_onkill_reputation`", repOnKill.RepFaction2); continue; } } @@ -6821,7 +6827,7 @@ void ObjectMgr::LoadReputationOnKill() ++count; } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature award reputation definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u creature award reputation definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadReputationSpilloverTemplate() @@ -6835,7 +6841,7 @@ void ObjectMgr::LoadReputationSpilloverTemplate() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded `reputation_spillover_template`, table is empty."); + TC_LOG_INFO("server.loading", ">> Loaded `reputation_spillover_template`, table is empty."); return; } @@ -6864,13 +6870,13 @@ void ObjectMgr::LoadReputationSpilloverTemplate() if (!factionEntry) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", factionId); + TC_LOG_ERROR("sql.sql", "Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", factionId); continue; } if (factionEntry->team == 0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Faction (faction.dbc) %u in `reputation_spillover_template` does not belong to any team, skipping", factionId); + TC_LOG_ERROR("sql.sql", "Faction (faction.dbc) %u in `reputation_spillover_template` does not belong to any team, skipping", factionId); continue; } @@ -6882,19 +6888,19 @@ void ObjectMgr::LoadReputationSpilloverTemplate() if (!factionSpillover) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spillover faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template` for faction %u, skipping", repTemplate.faction[i], factionId); + TC_LOG_ERROR("sql.sql", "Spillover faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template` for faction %u, skipping", repTemplate.faction[i], factionId); continue; } if (factionSpillover->reputationListID < 0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spillover faction (faction.dbc) %u for faction %u in `reputation_spillover_template` can not be listed for client, and then useless, skipping", repTemplate.faction[i], factionId); + TC_LOG_ERROR("sql.sql", "Spillover faction (faction.dbc) %u for faction %u in `reputation_spillover_template` can not be listed for client, and then useless, skipping", repTemplate.faction[i], factionId); continue; } if (repTemplate.faction_rank[i] >= MAX_REPUTATION_RANK) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Rank %u used in `reputation_spillover_template` for spillover faction %u is not valid, skipping", repTemplate.faction_rank[i], repTemplate.faction[i]); + TC_LOG_ERROR("sql.sql", "Rank %u used in `reputation_spillover_template` for spillover faction %u is not valid, skipping", repTemplate.faction_rank[i], repTemplate.faction[i]); continue; } } @@ -6903,25 +6909,25 @@ void ObjectMgr::LoadReputationSpilloverTemplate() FactionEntry const* factionEntry0 = sFactionStore.LookupEntry(repTemplate.faction[0]); if (repTemplate.faction[0] && !factionEntry0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[0]); + TC_LOG_ERROR("sql.sql", "Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[0]); continue; } FactionEntry const* factionEntry1 = sFactionStore.LookupEntry(repTemplate.faction[1]); if (repTemplate.faction[1] && !factionEntry1) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[1]); + TC_LOG_ERROR("sql.sql", "Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[1]); continue; } FactionEntry const* factionEntry2 = sFactionStore.LookupEntry(repTemplate.faction[2]); if (repTemplate.faction[2] && !factionEntry2) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[2]); + TC_LOG_ERROR("sql.sql", "Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[2]); continue; } FactionEntry const* factionEntry3 = sFactionStore.LookupEntry(repTemplate.faction[3]); if (repTemplate.faction[3] && !factionEntry3) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[3]); + TC_LOG_ERROR("sql.sql", "Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[3]); continue; } @@ -6931,7 +6937,7 @@ void ObjectMgr::LoadReputationSpilloverTemplate() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u reputation_spillover_template in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u reputation_spillover_template in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadPointsOfInterest() @@ -6947,7 +6953,7 @@ void ObjectMgr::LoadPointsOfInterest() if (!result) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 Points of Interest definitions. DB table `points_of_interest` is empty."); + TC_LOG_ERROR("server.loading", ">> Loaded 0 Points of Interest definitions. DB table `points_of_interest` is empty."); return; } @@ -6968,7 +6974,7 @@ void ObjectMgr::LoadPointsOfInterest() if (!Trinity::IsValidMapCoord(POI.x, POI.y)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `points_of_interest` (Entry: %u) have invalid coordinates (X: %f Y: %f), ignored.", point_id, POI.x, POI.y); + TC_LOG_ERROR("sql.sql", "Table `points_of_interest` (Entry: %u) have invalid coordinates (X: %f Y: %f), ignored.", point_id, POI.x, POI.y); continue; } @@ -6977,7 +6983,7 @@ void ObjectMgr::LoadPointsOfInterest() ++count; } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Points of Interest definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u Points of Interest definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadQuestPOI() @@ -6993,7 +6999,7 @@ void ObjectMgr::LoadQuestPOI() if (!result) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 quest POI definitions. DB table `quest_poi` is empty."); + TC_LOG_ERROR("server.loading", ">> Loaded 0 quest POI definitions. DB table `quest_poi` is empty."); return; } @@ -7047,7 +7053,7 @@ void ObjectMgr::LoadQuestPOI() ++count; } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quest POI definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u quest POI definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadNPCSpellClickSpells() @@ -7060,7 +7066,7 @@ void ObjectMgr::LoadNPCSpellClickSpells() if (!result) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spellclick spells. DB table `npc_spellclick_spells` is empty."); + TC_LOG_ERROR("server.loading", ">> Loaded 0 spellclick spells. DB table `npc_spellclick_spells` is empty."); return; } @@ -7074,7 +7080,7 @@ void ObjectMgr::LoadNPCSpellClickSpells() CreatureTemplate const* cInfo = GetCreatureTemplate(npc_entry); if (!cInfo) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table npc_spellclick_spells references unknown creature_template %u. Skipping entry.", npc_entry); + TC_LOG_ERROR("sql.sql", "Table npc_spellclick_spells references unknown creature_template %u. Skipping entry.", npc_entry); continue; } @@ -7082,13 +7088,13 @@ void ObjectMgr::LoadNPCSpellClickSpells() SpellInfo const* spellinfo = sSpellMgr->GetSpellInfo(spellid); if (!spellinfo) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table npc_spellclick_spells references unknown spellid %u. Skipping entry.", spellid); + TC_LOG_ERROR("sql.sql", "Table npc_spellclick_spells references unknown spellid %u. Skipping entry.", spellid); continue; } uint8 userType = fields[3].GetUInt16(); if (userType >= SPELL_CLICK_USER_MAX) - TC_LOG_ERROR(LOG_FILTER_SQL, "Table npc_spellclick_spells references unknown user type %u. Skipping entry.", uint32(userType)); + TC_LOG_ERROR("sql.sql", "Table npc_spellclick_spells references unknown user type %u. Skipping entry.", uint32(userType)); uint8 castFlags = fields[2].GetUInt8(); SpellClickInfo info; @@ -7108,12 +7114,12 @@ void ObjectMgr::LoadNPCSpellClickSpells() { if ((itr->second.npcflag & UNIT_NPC_FLAG_SPELLCLICK) && _spellClickInfoStore.find(itr->second.Entry) == _spellClickInfoStore.end()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "npc_spellclick_spells: Creature template %u has UNIT_NPC_FLAG_SPELLCLICK but no data in spellclick table! Removing flag", itr->second.Entry); + TC_LOG_ERROR("sql.sql", "npc_spellclick_spells: Creature template %u has UNIT_NPC_FLAG_SPELLCLICK but no data in spellclick table! Removing flag", itr->second.Entry); const_cast<CreatureTemplate*>(&itr->second)->npcflag &= ~UNIT_NPC_FLAG_SPELLCLICK; } } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spellclick definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u spellclick definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::DeleteCreatureData(uint32 guid) @@ -7162,7 +7168,7 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, std::string const& if (!result) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 quest relations from `%s`, table is empty.", table.c_str()); + TC_LOG_ERROR("server.loading", ">> Loaded 0 quest relations from `%s`, table is empty.", table.c_str()); return; } @@ -7178,7 +7184,7 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, std::string const& if (_questTemplates.find(quest) == _questTemplates.end()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `%s`: Quest %u listed for entry %u does not exist.", table.c_str(), quest, id); + TC_LOG_ERROR("sql.sql", "Table `%s`: Quest %u listed for entry %u does not exist.", table.c_str(), quest, id); continue; } @@ -7190,7 +7196,7 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, std::string const& ++count; } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quest relations from %s in %u ms", count, table.c_str(), GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u quest relations from %s in %u ms", count, table.c_str(), GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadGameobjectQuestStarters() @@ -7201,9 +7207,9 @@ void ObjectMgr::LoadGameobjectQuestStarters() { GameObjectTemplate const* goInfo = GetGameObjectTemplate(itr->first); if (!goInfo) - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `gameobject_queststarter` have data for not existed gameobject entry (%u) and existed quest %u", itr->first, itr->second); + TC_LOG_ERROR("sql.sql", "Table `gameobject_queststarter` have data for not existed gameobject entry (%u) and existed quest %u", itr->first, itr->second); else if (goInfo->type != GAMEOBJECT_TYPE_QUESTGIVER) - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `gameobject_queststarter` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second); + TC_LOG_ERROR("sql.sql", "Table `gameobject_queststarter` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second); } } @@ -7215,9 +7221,9 @@ void ObjectMgr::LoadGameobjectQuestEnders() { GameObjectTemplate const* goInfo = GetGameObjectTemplate(itr->first); if (!goInfo) - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `gameobject_questender` have data for not existed gameobject entry (%u) and existed quest %u", itr->first, itr->second); + TC_LOG_ERROR("sql.sql", "Table `gameobject_questender` have data for not existed gameobject entry (%u) and existed quest %u", itr->first, itr->second); else if (goInfo->type != GAMEOBJECT_TYPE_QUESTGIVER) - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `gameobject_questender` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second); + TC_LOG_ERROR("sql.sql", "Table `gameobject_questender` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second); } } @@ -7229,9 +7235,9 @@ void ObjectMgr::LoadCreatureQuestStarters() { CreatureTemplate const* cInfo = GetCreatureTemplate(itr->first); if (!cInfo) - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `creature_queststarter` have data for not existed creature entry (%u) and existed quest %u", itr->first, itr->second); + TC_LOG_ERROR("sql.sql", "Table `creature_queststarter` have data for not existed creature entry (%u) and existed quest %u", itr->first, itr->second); else if (!(cInfo->npcflag & UNIT_NPC_FLAG_QUESTGIVER)) - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `creature_queststarter` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second); + TC_LOG_ERROR("sql.sql", "Table `creature_queststarter` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second); } } @@ -7243,9 +7249,9 @@ void ObjectMgr::LoadCreatureQuestEnders() { CreatureTemplate const* cInfo = GetCreatureTemplate(itr->first); if (!cInfo) - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `creature_questender` have data for not existed creature entry (%u) and existed quest %u", itr->first, itr->second); + TC_LOG_ERROR("sql.sql", "Table `creature_questender` have data for not existed creature entry (%u) and existed quest %u", itr->first, itr->second); else if (!(cInfo->npcflag & UNIT_NPC_FLAG_QUESTGIVER)) - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `creature_questender` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second); + TC_LOG_ERROR("sql.sql", "Table `creature_questender` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second); } } @@ -7259,7 +7265,7 @@ void ObjectMgr::LoadReservedPlayersNames() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 reserved player names. DB table `reserved_name` is empty!"); + TC_LOG_INFO("server.loading", ">> Loaded 0 reserved player names. DB table `reserved_name` is empty!"); return; } @@ -7274,7 +7280,7 @@ void ObjectMgr::LoadReservedPlayersNames() std::wstring wstr; if (!Utf8toWStr (name, wstr)) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Table `reserved_name` have invalid name: %s", name.c_str()); + TC_LOG_ERROR("misc", "Table `reserved_name` have invalid name: %s", name.c_str()); continue; } @@ -7285,7 +7291,7 @@ void ObjectMgr::LoadReservedPlayersNames() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u reserved player names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u reserved player names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } bool ObjectMgr::IsReservedName(const std::string& name) const @@ -7443,7 +7449,7 @@ void ObjectMgr::LoadGameObjectForQuests() if (sObjectMgr->GetGameObjectTemplates()->empty()) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 GameObjects for quests"); + TC_LOG_INFO("server.loading", ">> Loaded 0 GameObjects for quests"); return; } @@ -7491,7 +7497,7 @@ void ObjectMgr::LoadGameObjectForQuests() } } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u GameObjects for quests in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u GameObjects for quests in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max_value) @@ -7505,7 +7511,7 @@ bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max { if (end_value >= start_value) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table '%s' attempt loaded with invalid range (%d - %d), strings not loaded.", table, min_value, max_value); + TC_LOG_ERROR("sql.sql", "Table '%s' attempt loaded with invalid range (%d - %d), strings not loaded.", table, min_value, max_value); return false; } @@ -7518,7 +7524,7 @@ bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max { if (start_value >= end_value) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table '%s' attempt loaded with invalid range (%d - %d), strings not loaded.", table, min_value, max_value); + TC_LOG_ERROR("sql.sql", "Table '%s' attempt loaded with invalid range (%d - %d), strings not loaded.", table, min_value, max_value); return false; } } @@ -7537,9 +7543,9 @@ bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max if (!result) { if (min_value == MIN_TRINITY_STRING_ID) // error only in case internal strings - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 trinity strings. DB table `%s` is empty. Cannot continue.", table); + TC_LOG_ERROR("server.loading", ">> Loaded 0 trinity strings. DB table `%s` is empty. Cannot continue.", table); else - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 string templates. DB table `%s` is empty.", table); + TC_LOG_INFO("server.loading", ">> Loaded 0 string templates. DB table `%s` is empty.", table); return false; } @@ -7554,12 +7560,12 @@ bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max if (entry == 0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `%s` contain reserved entry 0, ignored.", table); + TC_LOG_ERROR("sql.sql", "Table `%s` contain reserved entry 0, ignored.", table); continue; } else if (entry < start_value || entry >= end_value) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `%s` contain entry %i out of allowed range (%d - %d), ignored.", table, entry, min_value, max_value); + TC_LOG_ERROR("sql.sql", "Table `%s` contain entry %i out of allowed range (%d - %d), ignored.", table, entry, min_value, max_value); continue; } @@ -7567,7 +7573,7 @@ bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max if (!data.Content.empty()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `%s` contain data for already loaded entry %i (from another table?), ignored.", table, entry); + TC_LOG_ERROR("sql.sql", "Table `%s` contain data for already loaded entry %i (from another table?), ignored.", table, entry); continue; } @@ -7579,9 +7585,9 @@ bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max } while (result->NextRow()); if (min_value == MIN_TRINITY_STRING_ID) - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Trinity strings from table %s in %u ms", count, table, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u Trinity strings from table %s in %u ms", count, table, GetMSTimeDiffToNow(oldMSTime)); else - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u string templates from %s in %u ms", count, table, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u string templates from %s in %u ms", count, table, GetMSTimeDiffToNow(oldMSTime)); return true; } @@ -7597,9 +7603,9 @@ const char *ObjectMgr::GetTrinityString(int32 entry, LocaleConstant locale_idx) } if (entry > 0) - TC_LOG_ERROR(LOG_FILTER_SQL, "Entry %i not found in `trinity_string` table.", entry); + TC_LOG_ERROR("sql.sql", "Entry %i not found in `trinity_string` table.", entry); else - TC_LOG_ERROR(LOG_FILTER_SQL, "Trinity string entry %i not found in DB.", entry); + TC_LOG_ERROR("sql.sql", "Trinity string entry %i not found in DB.", entry); return "<error>"; } @@ -7613,7 +7619,7 @@ void ObjectMgr::LoadFishingBaseSkillLevel() if (!result) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 areas for fishing base skill level. DB table `skill_fishing_base_level` is empty."); + TC_LOG_ERROR("server.loading", ">> Loaded 0 areas for fishing base skill level. DB table `skill_fishing_base_level` is empty."); return; } @@ -7628,7 +7634,7 @@ void ObjectMgr::LoadFishingBaseSkillLevel() AreaTableEntry const* fArea = GetAreaEntryByAreaID(entry); if (!fArea) { - TC_LOG_ERROR(LOG_FILTER_SQL, "AreaId %u defined in `skill_fishing_base_level` does not exist", entry); + TC_LOG_ERROR("sql.sql", "AreaId %u defined in `skill_fishing_base_level` does not exist", entry); continue; } @@ -7637,7 +7643,7 @@ void ObjectMgr::LoadFishingBaseSkillLevel() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u areas for fishing base skill level in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u areas for fishing base skill level in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } bool ObjectMgr::CheckDeclinedNames(const std::wstring& w_ownname, DeclinedName const& names) @@ -7741,7 +7747,7 @@ void ObjectMgr::LoadGameTele() if (!result) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 GameTeleports. DB table `game_tele` is empty!"); + TC_LOG_ERROR("server.loading", ">> Loaded 0 GameTeleports. DB table `game_tele` is empty!"); return; } @@ -7764,13 +7770,13 @@ void ObjectMgr::LoadGameTele() if (!MapManager::IsValidMapCoord(gt.mapId, gt.position_x, gt.position_y, gt.position_z, gt.orientation)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Wrong position for id %u (name: %s) in `game_tele` table, ignoring.", id, gt.name.c_str()); + TC_LOG_ERROR("sql.sql", "Wrong position for id %u (name: %s) in `game_tele` table, ignoring.", id, gt.name.c_str()); continue; } if (!Utf8toWStr(gt.name, gt.wnameLow)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Wrong UTF8 name for id %u in `game_tele` table, ignoring.", id); + TC_LOG_ERROR("sql.sql", "Wrong UTF8 name for id %u in `game_tele` table, ignoring.", id); continue; } @@ -7782,7 +7788,7 @@ void ObjectMgr::LoadGameTele() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u GameTeleports in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u GameTeleports in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } GameTele const* ObjectMgr::GetGameTele(const std::string& name) const @@ -7899,7 +7905,7 @@ void ObjectMgr::LoadMailLevelRewards() if (!result) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 level dependent mail rewards. DB table `mail_level_reward` is empty."); + TC_LOG_ERROR("server.loading", ">> Loaded 0 level dependent mail rewards. DB table `mail_level_reward` is empty."); return; } @@ -7916,25 +7922,25 @@ void ObjectMgr::LoadMailLevelRewards() if (level > MAX_LEVEL) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `mail_level_reward` have data for level %u that more supported by client (%u), ignoring.", level, MAX_LEVEL); + TC_LOG_ERROR("sql.sql", "Table `mail_level_reward` have data for level %u that more supported by client (%u), ignoring.", level, MAX_LEVEL); continue; } if (!(raceMask & RACEMASK_ALL_PLAYABLE)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `mail_level_reward` have raceMask (%u) for level %u that not include any player races, ignoring.", raceMask, level); + TC_LOG_ERROR("sql.sql", "Table `mail_level_reward` have raceMask (%u) for level %u that not include any player races, ignoring.", raceMask, level); continue; } if (!sMailTemplateStore.LookupEntry(mailTemplateId)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `mail_level_reward` have invalid mailTemplateId (%u) for level %u that invalid not include any player races, ignoring.", mailTemplateId, level); + TC_LOG_ERROR("sql.sql", "Table `mail_level_reward` have invalid mailTemplateId (%u) for level %u that invalid not include any player races, ignoring.", mailTemplateId, level); continue; } if (!GetCreatureTemplate(senderEntry)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `mail_level_reward` have not existed sender creature entry (%u) for level %u that invalid not include any player races, ignoring.", senderEntry, level); + TC_LOG_ERROR("sql.sql", "Table `mail_level_reward` have not existed sender creature entry (%u) for level %u that invalid not include any player races, ignoring.", senderEntry, level); continue; } @@ -7944,7 +7950,7 @@ void ObjectMgr::LoadMailLevelRewards() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u level dependent mail rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u level dependent mail rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::AddSpellToTrainer(uint32 entry, uint32 spell, uint32 spellCost, uint32 reqSkill, uint32 reqSkillValue, uint32 reqLevel) @@ -7955,32 +7961,32 @@ void ObjectMgr::AddSpellToTrainer(uint32 entry, uint32 spell, uint32 spellCost, CreatureTemplate const* cInfo = GetCreatureTemplate(entry); if (!cInfo) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `npc_trainer` contains entries for a non-existing creature template (Entry: %u), ignoring", entry); + TC_LOG_ERROR("sql.sql", "Table `npc_trainer` contains entries for a non-existing creature template (Entry: %u), ignoring", entry); return; } if (!(cInfo->npcflag & UNIT_NPC_FLAG_TRAINER)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `npc_trainer` contains entries for a creature template (Entry: %u) without trainer flag, ignoring", entry); + TC_LOG_ERROR("sql.sql", "Table `npc_trainer` contains entries for a creature template (Entry: %u) without trainer flag, ignoring", entry); return; } SpellInfo const* spellinfo = sSpellMgr->GetSpellInfo(spell); if (!spellinfo) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `npc_trainer` contains an entry (Entry: %u) for a non-existing spell (Spell: %u), ignoring", entry, spell); + TC_LOG_ERROR("sql.sql", "Table `npc_trainer` contains an entry (Entry: %u) for a non-existing spell (Spell: %u), ignoring", entry, spell); return; } if (!SpellMgr::IsSpellValid(spellinfo)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `npc_trainer` contains an entry (Entry: %u) for a broken spell (Spell: %u), ignoring", entry, spell); + TC_LOG_ERROR("sql.sql", "Table `npc_trainer` contains an entry (Entry: %u) for a broken spell (Spell: %u), ignoring", entry, spell); return; } if (GetTalentSpellCost(spell)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `npc_trainer` contains an entry (Entry: %u) for a non-existing spell (Spell: %u) which is a talent, ignoring", entry, spell); + TC_LOG_ERROR("sql.sql", "Table `npc_trainer` contains an entry (Entry: %u) for a non-existing spell (Spell: %u) which is a talent, ignoring", entry, spell); return; } @@ -8008,7 +8014,7 @@ void ObjectMgr::AddSpellToTrainer(uint32 entry, uint32 spell, uint32 spellCost, if (spellinfo->Effects[i].TargetA.GetTarget() != 0 && spellinfo->Effects[i].TargetA.GetTarget() != TARGET_UNIT_TARGET_ALLY && spellinfo->Effects[i].TargetA.GetTarget() != TARGET_UNIT_TARGET_ANY && spellinfo->Effects[i].TargetA.GetTarget() != TARGET_UNIT_CASTER) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `npc_trainer` has spell %u for trainer entry %u with learn effect which has incorrect target type, ignoring learn effect!", spell, entry); + TC_LOG_ERROR("sql.sql", "Table `npc_trainer` has spell %u for trainer entry %u with learn effect which has incorrect target type, ignoring learn effect!", spell, entry); continue; } @@ -8038,7 +8044,7 @@ void ObjectMgr::LoadTrainerSpell() if (!result) { - TC_LOG_ERROR(LOG_FILTER_SQL, ">> Loaded 0 Trainers. DB table `npc_trainer` is empty!"); + TC_LOG_ERROR("sql.sql", ">> Loaded 0 Trainers. DB table `npc_trainer` is empty!"); return; } @@ -8062,7 +8068,7 @@ void ObjectMgr::LoadTrainerSpell() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %d Trainers in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %d Trainers in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } int ObjectMgr::LoadReferenceVendor(int32 vendor, int32 item, std::set<uint32> *skip_vendors) @@ -8119,7 +8125,7 @@ void ObjectMgr::LoadVendors() if (!result) { - TC_LOG_ERROR(LOG_FILTER_SQL, ">> Loaded 0 Vendors. DB table `npc_vendor` is empty!"); + TC_LOG_ERROR("sql.sql", ">> Loaded 0 Vendors. DB table `npc_vendor` is empty!"); return; } @@ -8152,7 +8158,7 @@ void ObjectMgr::LoadVendors() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %d Vendors in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %d Vendors in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadGossipMenu() @@ -8165,7 +8171,7 @@ void ObjectMgr::LoadGossipMenu() if (!result) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 gossip_menu entries. DB table `gossip_menu` is empty!"); + TC_LOG_ERROR("server.loading", ">> Loaded 0 gossip_menu entries. DB table `gossip_menu` is empty!"); return; } @@ -8182,7 +8188,7 @@ void ObjectMgr::LoadGossipMenu() if (!GetGossipText(gMenu.text_id)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table gossip_menu entry %u are using non-existing text_id %u", gMenu.entry, gMenu.text_id); + TC_LOG_ERROR("sql.sql", "Table gossip_menu entry %u are using non-existing text_id %u", gMenu.entry, gMenu.text_id); continue; } @@ -8192,7 +8198,7 @@ void ObjectMgr::LoadGossipMenu() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u gossip_menu entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u gossip_menu entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadGossipMenuItems() @@ -8208,7 +8214,7 @@ void ObjectMgr::LoadGossipMenuItems() if (!result) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 gossip_menu_option entries. DB table `gossip_menu_option` is empty!"); + TC_LOG_ERROR("server.loading", ">> Loaded 0 gossip_menu_option entries. DB table `gossip_menu_option` is empty!"); return; } @@ -8234,16 +8240,16 @@ void ObjectMgr::LoadGossipMenuItems() if (gMenuItem.OptionIcon >= GOSSIP_ICON_MAX) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table gossip_menu_option for menu %u, id %u has unknown icon id %u. Replacing with GOSSIP_ICON_CHAT", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.OptionIcon); + TC_LOG_ERROR("sql.sql", "Table gossip_menu_option for menu %u, id %u has unknown icon id %u. Replacing with GOSSIP_ICON_CHAT", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.OptionIcon); gMenuItem.OptionIcon = GOSSIP_ICON_CHAT; } if (gMenuItem.OptionType >= GOSSIP_OPTION_MAX) - TC_LOG_ERROR(LOG_FILTER_SQL, "Table gossip_menu_option for menu %u, id %u has unknown option id %u. Option will not be used", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.OptionType); + TC_LOG_ERROR("sql.sql", "Table gossip_menu_option for menu %u, id %u has unknown option id %u. Option will not be used", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.OptionType); if (gMenuItem.ActionPoiId && !GetPointOfInterest(gMenuItem.ActionPoiId)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table gossip_menu_option for menu %u, id %u use non-existing action_poi_id %u, ignoring", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.ActionPoiId); + TC_LOG_ERROR("sql.sql", "Table gossip_menu_option for menu %u, id %u use non-existing action_poi_id %u, ignoring", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.ActionPoiId); gMenuItem.ActionPoiId = 0; } @@ -8252,7 +8258,7 @@ void ObjectMgr::LoadGossipMenuItems() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u gossip_menu_option entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u gossip_menu_option entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::AddVendorItem(uint32 entry, uint32 item, int32 maxcount, uint32 incrtime, uint32 extendedCost, bool persist /*= true*/) @@ -8304,7 +8310,7 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max if (player) ChatHandler(player->GetSession()).SendSysMessage(LANG_COMMAND_VENDORSELECTION); else - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `(game_event_)npc_vendor` have data for not existed creature template (Entry: %u), ignore", vendor_entry); + TC_LOG_ERROR("sql.sql", "Table `(game_event_)npc_vendor` have data for not existed creature template (Entry: %u), ignore", vendor_entry); return false; } @@ -8315,7 +8321,7 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max if (player) ChatHandler(player->GetSession()).SendSysMessage(LANG_COMMAND_VENDORSELECTION); else - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `(game_event_)npc_vendor` have data for not creature template (Entry: %u) without vendor flag, ignore", vendor_entry); + TC_LOG_ERROR("sql.sql", "Table `(game_event_)npc_vendor` have data for not creature template (Entry: %u) without vendor flag, ignore", vendor_entry); if (skip_vendors) skip_vendors->insert(vendor_entry); @@ -8328,7 +8334,7 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max if (player) ChatHandler(player->GetSession()).PSendSysMessage(LANG_ITEM_NOT_FOUND, item_id); else - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `(game_event_)npc_vendor` for Vendor (Entry: %u) have in item list non-existed item (%u), ignore", vendor_entry, item_id); + TC_LOG_ERROR("sql.sql", "Table `(game_event_)npc_vendor` for Vendor (Entry: %u) have in item list non-existed item (%u), ignore", vendor_entry, item_id); return false; } @@ -8337,7 +8343,7 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max if (player) ChatHandler(player->GetSession()).PSendSysMessage(LANG_EXTENDED_COST_NOT_EXIST, ExtendedCost); else - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `(game_event_)npc_vendor` have Item (Entry: %u) with wrong ExtendedCost (%u) for vendor (%u), ignore", item_id, ExtendedCost, vendor_entry); + TC_LOG_ERROR("sql.sql", "Table `(game_event_)npc_vendor` have Item (Entry: %u) with wrong ExtendedCost (%u) for vendor (%u), ignore", item_id, ExtendedCost, vendor_entry); return false; } @@ -8346,7 +8352,7 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max if (player) ChatHandler(player->GetSession()).PSendSysMessage("MaxCount != 0 (%u) but IncrTime == 0", maxcount); else - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `(game_event_)npc_vendor` has `maxcount` (%u) for item %u of vendor (Entry: %u) but `incrtime`=0, ignore", maxcount, item_id, vendor_entry); + TC_LOG_ERROR("sql.sql", "Table `(game_event_)npc_vendor` has `maxcount` (%u) for item %u of vendor (Entry: %u) but `incrtime`=0, ignore", maxcount, item_id, vendor_entry); return false; } else if (maxcount == 0 && incrtime > 0) @@ -8354,7 +8360,7 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max if (player) ChatHandler(player->GetSession()).PSendSysMessage("MaxCount == 0 but IncrTime<>= 0"); else - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `(game_event_)npc_vendor` has `maxcount`=0 for item %u of vendor (Entry: %u) but `incrtime`<>0, ignore", item_id, vendor_entry); + TC_LOG_ERROR("sql.sql", "Table `(game_event_)npc_vendor` has `maxcount`=0 for item %u of vendor (Entry: %u) but `incrtime`<>0, ignore", item_id, vendor_entry); return false; } @@ -8367,7 +8373,7 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max if (player) ChatHandler(player->GetSession()).PSendSysMessage(LANG_ITEM_ALREADY_IN_LIST, item_id, ExtendedCost); else - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `npc_vendor` has duplicate items %u (with extended cost %u) for vendor (Entry: %u), ignoring", item_id, ExtendedCost, vendor_entry); + TC_LOG_ERROR("sql.sql", "Table `npc_vendor` has duplicate items %u (with extended cost %u) for vendor (Entry: %u), ignoring", item_id, ExtendedCost, vendor_entry); return false; } @@ -8406,7 +8412,7 @@ void ObjectMgr::LoadScriptNames() if (!result) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded empty set of Script Names!"); + TC_LOG_ERROR("server.loading", ">> Loaded empty set of Script Names!"); return; } @@ -8420,7 +8426,7 @@ void ObjectMgr::LoadScriptNames() while (result->NextRow()); std::sort(_scriptNamesStore.begin(), _scriptNamesStore.end()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %d Script Names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %d Script Names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } uint32 ObjectMgr::GetScriptId(const char *name) @@ -8452,7 +8458,7 @@ void ObjectMgr::CheckScripts(ScriptsType type, std::set<int32>& ids) case SCRIPT_COMMAND_TALK: { if (!GetTrinityStringLocale (itrM->second.Talk.TextID)) - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `%s` references invalid text id %u from `db_script_string`, script id: %u.", GetScriptsTableNameByType(type).c_str(), itrM->second.Talk.TextID, itrMM->first); + TC_LOG_ERROR("sql.sql", "Table `%s` references invalid text id %u from `db_script_string`, script id: %u.", GetScriptsTableNameByType(type).c_str(), itrM->second.Talk.TextID, itrMM->first); if (ids.find(itrM->second.Talk.TextID) != ids.end()) ids.erase(itrM->second.Talk.TextID); @@ -8478,7 +8484,7 @@ void ObjectMgr::LoadDbScriptStrings() CheckScripts(ScriptsType(type), ids); for (std::set<int32>::const_iterator itr = ids.begin(); itr != ids.end(); ++itr) - TC_LOG_ERROR(LOG_FILTER_SQL, "Table `db_script_string` has unused string id %u", *itr); + TC_LOG_ERROR("sql.sql", "Table `db_script_string` has unused string id %u", *itr); } bool LoadTrinityStrings(const char* table, int32 start_value, int32 end_value) @@ -8487,7 +8493,7 @@ bool LoadTrinityStrings(const char* table, int32 start_value, int32 end_value) // start/end reversed for negative values if (start_value > MAX_DB_SCRIPT_STRING_ID || end_value >= start_value) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table '%s' load attempted with range (%d - %d) reserved by Trinity, strings not loaded.", table, start_value, end_value+1); + TC_LOG_ERROR("sql.sql", "Table '%s' load attempted with range (%d - %d) reserved by Trinity, strings not loaded.", table, start_value, end_value+1); return false; } @@ -8523,7 +8529,7 @@ void ObjectMgr::LoadCreatureClassLevelStats() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature base stats. DB table `creature_classlevelstats` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 creature base stats. DB table `creature_classlevelstats` is empty."); return; } @@ -8544,13 +8550,13 @@ void ObjectMgr::LoadCreatureClassLevelStats() stats.BaseArmor = fields[6].GetInt16(); if (!Class || ((1 << (Class - 1)) & CLASSMASK_ALL_CREATURES) == 0) - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature base stats for level %u has invalid class %u", Level, Class); + TC_LOG_ERROR("sql.sql", "Creature base stats for level %u has invalid class %u", Level, Class); for (uint8 i = 0; i < MAX_CREATURE_BASE_HP; ++i) { if (stats.BaseHealth[i] < 1) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Creature base stats for class %u, level %u has invalid zero base HP[%u] - set to 1", Class, Level, i); + TC_LOG_ERROR("sql.sql", "Creature base stats for class %u, level %u has invalid zero base HP[%u] - set to 1", Class, Level, i); stats.BaseHealth[i] = 1; } } @@ -8567,11 +8573,11 @@ void ObjectMgr::LoadCreatureClassLevelStats() for (uint16 lvl = itr->second.minlevel; lvl <= itr->second.maxlevel; ++lvl) { if (_creatureBaseStatsStore.find(MAKE_PAIR16(lvl, itr->second.unit_class)) == _creatureBaseStatsStore.end()) - TC_LOG_ERROR(LOG_FILTER_SQL, "Missing base stats for creature class %u level %u", itr->second.unit_class, lvl); + TC_LOG_ERROR("sql.sql", "Missing base stats for creature class %u level %u", itr->second.unit_class, lvl); } } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature base stats in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u creature base stats in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadFactionChangeAchievements() @@ -8582,7 +8588,7 @@ void ObjectMgr::LoadFactionChangeAchievements() if (!result) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 faction change achievement pairs. DB table `player_factionchange_achievement` is empty."); + TC_LOG_ERROR("server.loading", ">> Loaded 0 faction change achievement pairs. DB table `player_factionchange_achievement` is empty."); return; } @@ -8596,9 +8602,9 @@ void ObjectMgr::LoadFactionChangeAchievements() uint32 horde = fields[1].GetUInt32(); if (!sAchievementMgr->GetAchievement(alliance)) - TC_LOG_ERROR(LOG_FILTER_SQL, "Achievement %u (alliance_id) referenced in `player_factionchange_achievement` does not exist, pair skipped!", alliance); + TC_LOG_ERROR("sql.sql", "Achievement %u (alliance_id) referenced in `player_factionchange_achievement` does not exist, pair skipped!", alliance); else if (!sAchievementMgr->GetAchievement(horde)) - TC_LOG_ERROR(LOG_FILTER_SQL, "Achievement %u (horde_id) referenced in `player_factionchange_achievement` does not exist, pair skipped!", horde); + TC_LOG_ERROR("sql.sql", "Achievement %u (horde_id) referenced in `player_factionchange_achievement` does not exist, pair skipped!", horde); else FactionChangeAchievements[alliance] = horde; @@ -8606,7 +8612,7 @@ void ObjectMgr::LoadFactionChangeAchievements() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change achievement pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u faction change achievement pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadFactionChangeItems() @@ -8617,7 +8623,7 @@ void ObjectMgr::LoadFactionChangeItems() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 faction change item pairs. DB table `player_factionchange_items` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 faction change item pairs. DB table `player_factionchange_items` is empty."); return; } @@ -8631,9 +8637,9 @@ void ObjectMgr::LoadFactionChangeItems() uint32 horde = fields[1].GetUInt32(); if (!GetItemTemplate(alliance)) - TC_LOG_ERROR(LOG_FILTER_SQL, "Item %u (alliance_id) referenced in `player_factionchange_items` does not exist, pair skipped!", alliance); + TC_LOG_ERROR("sql.sql", "Item %u (alliance_id) referenced in `player_factionchange_items` does not exist, pair skipped!", alliance); else if (!GetItemTemplate(horde)) - TC_LOG_ERROR(LOG_FILTER_SQL, "Item %u (horde_id) referenced in `player_factionchange_items` does not exist, pair skipped!", horde); + TC_LOG_ERROR("sql.sql", "Item %u (horde_id) referenced in `player_factionchange_items` does not exist, pair skipped!", horde); else FactionChangeItems[alliance] = horde; @@ -8641,7 +8647,7 @@ void ObjectMgr::LoadFactionChangeItems() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change item pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u faction change item pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadFactionChangeQuests() @@ -8652,7 +8658,7 @@ void ObjectMgr::LoadFactionChangeQuests() if (!result) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 faction change quest pairs. DB table `player_factionchange_quests` is empty."); + TC_LOG_ERROR("server.loading", ">> Loaded 0 faction change quest pairs. DB table `player_factionchange_quests` is empty."); return; } @@ -8666,9 +8672,9 @@ void ObjectMgr::LoadFactionChangeQuests() uint32 horde = fields[1].GetUInt32(); if (!sObjectMgr->GetQuestTemplate(alliance)) - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u (alliance_id) referenced in `player_factionchange_quests` does not exist, pair skipped!", alliance); + TC_LOG_ERROR("sql.sql", "Quest %u (alliance_id) referenced in `player_factionchange_quests` does not exist, pair skipped!", alliance); else if (!sObjectMgr->GetQuestTemplate(horde)) - TC_LOG_ERROR(LOG_FILTER_SQL, "Quest %u (horde_id) referenced in `player_factionchange_quests` does not exist, pair skipped!", horde); + TC_LOG_ERROR("sql.sql", "Quest %u (horde_id) referenced in `player_factionchange_quests` does not exist, pair skipped!", horde); else FactionChangeQuests[alliance] = horde; @@ -8676,7 +8682,7 @@ void ObjectMgr::LoadFactionChangeQuests() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change quest pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u faction change quest pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadFactionChangeReputations() @@ -8687,7 +8693,7 @@ void ObjectMgr::LoadFactionChangeReputations() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 faction change reputation pairs. DB table `player_factionchange_reputations` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 faction change reputation pairs. DB table `player_factionchange_reputations` is empty."); return; } @@ -8701,9 +8707,9 @@ void ObjectMgr::LoadFactionChangeReputations() uint32 horde = fields[1].GetUInt32(); if (!sFactionStore.LookupEntry(alliance)) - TC_LOG_ERROR(LOG_FILTER_SQL, "Reputation %u (alliance_id) referenced in `player_factionchange_reputations` does not exist, pair skipped!", alliance); + TC_LOG_ERROR("sql.sql", "Reputation %u (alliance_id) referenced in `player_factionchange_reputations` does not exist, pair skipped!", alliance); else if (!sFactionStore.LookupEntry(horde)) - TC_LOG_ERROR(LOG_FILTER_SQL, "Reputation %u (horde_id) referenced in `player_factionchange_reputations` does not exist, pair skipped!", horde); + TC_LOG_ERROR("sql.sql", "Reputation %u (horde_id) referenced in `player_factionchange_reputations` does not exist, pair skipped!", horde); else FactionChangeReputation[alliance] = horde; @@ -8711,7 +8717,7 @@ void ObjectMgr::LoadFactionChangeReputations() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change reputation pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u faction change reputation pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadFactionChangeSpells() @@ -8722,7 +8728,7 @@ void ObjectMgr::LoadFactionChangeSpells() if (!result) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 faction change spell pairs. DB table `player_factionchange_spells` is empty."); + TC_LOG_ERROR("server.loading", ">> Loaded 0 faction change spell pairs. DB table `player_factionchange_spells` is empty."); return; } @@ -8736,9 +8742,9 @@ void ObjectMgr::LoadFactionChangeSpells() uint32 horde = fields[1].GetUInt32(); if (!sSpellMgr->GetSpellInfo(alliance)) - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u (alliance_id) referenced in `player_factionchange_spells` does not exist, pair skipped!", alliance); + TC_LOG_ERROR("sql.sql", "Spell %u (alliance_id) referenced in `player_factionchange_spells` does not exist, pair skipped!", alliance); else if (!sSpellMgr->GetSpellInfo(horde)) - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u (horde_id) referenced in `player_factionchange_spells` does not exist, pair skipped!", horde); + TC_LOG_ERROR("sql.sql", "Spell %u (horde_id) referenced in `player_factionchange_spells` does not exist, pair skipped!", horde); else FactionChangeSpells[alliance] = horde; @@ -8746,7 +8752,7 @@ void ObjectMgr::LoadFactionChangeSpells() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change spell pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u faction change spell pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadFactionChangeTitles() @@ -8757,7 +8763,7 @@ void ObjectMgr::LoadFactionChangeTitles() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 faction change title pairs. DB table `player_factionchange_title` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 faction change title pairs. DB table `player_factionchange_title` is empty."); return; } @@ -8771,9 +8777,9 @@ void ObjectMgr::LoadFactionChangeTitles() uint32 horde = fields[1].GetUInt32(); if (!sCharTitlesStore.LookupEntry(alliance)) - TC_LOG_ERROR(LOG_FILTER_SQL, "Title %u (alliance_id) referenced in `player_factionchange_title` does not exist, pair skipped!", alliance); + TC_LOG_ERROR("sql.sql", "Title %u (alliance_id) referenced in `player_factionchange_title` does not exist, pair skipped!", alliance); else if (!sCharTitlesStore.LookupEntry(horde)) - TC_LOG_ERROR(LOG_FILTER_SQL, "Title %u (horde_id) referenced in `player_factionchange_title` does not exist, pair skipped!", horde); + TC_LOG_ERROR("sql.sql", "Title %u (horde_id) referenced in `player_factionchange_title` does not exist, pair skipped!", horde); else FactionChangeTitles[alliance] = horde; @@ -8781,7 +8787,7 @@ void ObjectMgr::LoadFactionChangeTitles() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change title pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u faction change title pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } GameObjectTemplate const* ObjectMgr::GetGameObjectTemplate(uint32 entry) diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index 6ec41042653..bf835ed6c4e 100644 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -457,7 +457,7 @@ typedef std::pair<QuestRelations::const_iterator, QuestRelations::const_iterator struct PetLevelInfo { - PetLevelInfo() : health(0), mana(0) { for (uint8 i=0; i < MAX_STATS; ++i) stats[i] = 0; } + PetLevelInfo() : health(0), mana(0), armor(0) { for (uint8 i=0; i < MAX_STATS; ++i) stats[i] = 0; } uint16 stats[MAX_STATS]; uint16 health; @@ -566,13 +566,13 @@ struct QuestPOI int32 ObjectiveIndex; uint32 MapId; uint32 AreaId; - uint32 Unk2; + uint32 FloorId; uint32 Unk3; uint32 Unk4; std::vector<QuestPOIPoint> points; - QuestPOI() : Id(0), ObjectiveIndex(0), MapId(0), AreaId(0), Unk2(0), Unk3(0), Unk4(0) { } - QuestPOI(uint32 id, int32 objIndex, uint32 mapId, uint32 areaId, uint32 unk2, uint32 unk3, uint32 unk4) : Id(id), ObjectiveIndex(objIndex), MapId(mapId), AreaId(areaId), Unk2(unk2), Unk3(unk3), Unk4(unk4) { } + QuestPOI() : Id(0), ObjectiveIndex(0), MapId(0), AreaId(0), FloorId(0), Unk3(0), Unk4(0) { } + QuestPOI(uint32 id, int32 objIndex, uint32 mapId, uint32 areaId, uint32 floorId, uint32 unk3, uint32 unk4) : Id(id), ObjectiveIndex(objIndex), MapId(mapId), AreaId(areaId), FloorId(floorId), Unk3(unk3), Unk4(unk4) { } }; typedef std::vector<QuestPOI> QuestPOIVector; @@ -854,13 +854,13 @@ class ObjectMgr void LoadQuests(); void LoadQuestStartersAndEnders() { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading GO Start Quest Data..."); + TC_LOG_INFO("server.loading", "Loading GO Start Quest Data..."); LoadGameobjectQuestStarters(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading GO End Quest Data..."); + TC_LOG_INFO("server.loading", "Loading GO End Quest Data..."); LoadGameobjectQuestEnders(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Creature Start Quest Data..."); + TC_LOG_INFO("server.loading", "Loading Creature Start Quest Data..."); LoadCreatureQuestStarters(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Creature End Quest Data..."); + TC_LOG_INFO("server.loading", "Loading Creature End Quest Data..."); LoadCreatureQuestEnders(); } void LoadGameobjectQuestStarters(); diff --git a/src/server/game/Grids/GridStates.cpp b/src/server/game/Grids/GridStates.cpp index 478008fd5ae..cc6ceae6996 100644 --- a/src/server/game/Grids/GridStates.cpp +++ b/src/server/game/Grids/GridStates.cpp @@ -25,7 +25,7 @@ bool GridState::checkMagic() { if (i_Magic != MAGIC_TESTVAL) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "!!! GridState: Magic value gone !!!"); + TC_LOG_ERROR("misc", "!!! GridState: Magic value gone !!!"); return false; } return true; @@ -47,7 +47,7 @@ void ActiveState::Update(Map& map, NGridType& grid, GridInfo& info, uint32 diff TypeContainerVisitor<ObjectGridStoper, GridTypeMapContainer> visitor(worker); grid.VisitAllGrids(visitor); grid.SetGridState(GRID_STATE_IDLE); - TC_LOG_DEBUG(LOG_FILTER_MAPS, "Grid[%u, %u] on map %u moved to IDLE state", grid.getX(), grid.getY(), map.GetId()); + TC_LOG_DEBUG("maps", "Grid[%u, %u] on map %u moved to IDLE state", grid.getX(), grid.getY(), map.GetId()); } else map.ResetGridExpiry(grid, 0.1f); @@ -58,7 +58,7 @@ void IdleState::Update(Map& map, NGridType& grid, GridInfo&, uint32) const { map.ResetGridExpiry(grid); grid.SetGridState(GRID_STATE_REMOVAL); - TC_LOG_DEBUG(LOG_FILTER_MAPS, "Grid[%u, %u] on map %u moved to REMOVAL state", grid.getX(), grid.getY(), map.GetId()); + TC_LOG_DEBUG("maps", "Grid[%u, %u] on map %u moved to REMOVAL state", grid.getX(), grid.getY(), map.GetId()); } void RemovalState::Update(Map& map, NGridType& grid, GridInfo& info, uint32 diff) const @@ -68,7 +68,7 @@ void RemovalState::Update(Map& map, NGridType& grid, GridInfo& info, uint32 diff info.UpdateTimeTracker(diff); if (info.getTimeTracker().Passed() && !map.UnloadGrid(grid, false)) { - TC_LOG_DEBUG(LOG_FILTER_MAPS, "Grid[%u, %u] for map %u differed unloading due to players or active objects nearby", grid.getX(), grid.getY(), map.GetId()); + TC_LOG_DEBUG("maps", "Grid[%u, %u] for map %u differed unloading due to players or active objects nearby", grid.getX(), grid.getY(), map.GetId()); map.ResetGridExpiry(grid); } } diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h index 7bf50b60c1c..24c44eb0c56 100644 --- a/src/server/game/Grids/Notifiers/GridNotifiers.h +++ b/src/server/game/Grids/Notifiers/GridNotifiers.h @@ -164,7 +164,6 @@ namespace Trinity template<class T> void Visit(GridRefManager<T> &m); void Visit(PlayerMapType &) { } void Visit(CorpseMapType &) { } - void Visit(CreatureMapType &); }; // SEARCHERS & LIST SEARCHERS & WORKERS diff --git a/src/server/game/Grids/Notifiers/GridNotifiersImpl.h b/src/server/game/Grids/Notifiers/GridNotifiersImpl.h index deb8fa49a6c..dc0e99aaded 100644 --- a/src/server/game/Grids/Notifiers/GridNotifiersImpl.h +++ b/src/server/game/Grids/Notifiers/GridNotifiersImpl.h @@ -38,13 +38,6 @@ inline void Trinity::VisibleNotifier::Visit(GridRefManager<T> &m) } } -inline void Trinity::ObjectUpdater::Visit(CreatureMapType &m) -{ - for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter) - if (iter->GetSource()->IsInWorld()) - iter->GetSource()->Update(i_timeDiff); -} - // SEARCHERS & LIST SEARCHERS & WORKERS // WorldObject searchers & workers diff --git a/src/server/game/Grids/ObjectGridLoader.cpp b/src/server/game/Grids/ObjectGridLoader.cpp index e43c624018e..5c4366e0c25 100644 --- a/src/server/game/Grids/ObjectGridLoader.cpp +++ b/src/server/game/Grids/ObjectGridLoader.cpp @@ -119,7 +119,7 @@ void LoadHelper(CellGuidSet const& guid_set, CellCoord &cell, GridRefManager<T> { T* obj = new T; uint32 guid = *i_guid; - //TC_LOG_INFO(LOG_FILTER_GENERAL, "DEBUG: LoadHelper from table: %s for (guid: %u) Loading", table, guid); + //TC_LOG_INFO("misc", "DEBUG: LoadHelper from table: %s for (guid: %u) Loading", table, guid); if (!obj->LoadFromDB(guid, map)) { delete obj; @@ -210,7 +210,7 @@ void ObjectGridLoader::LoadN(void) } } } - TC_LOG_DEBUG(LOG_FILTER_MAPS, "%u GameObjects, %u Creatures, and %u Corpses/Bones loaded for grid %u on map %u", i_gameObjects, i_creatures, i_corpses, i_grid.GetGridId(), i_map->GetId()); + TC_LOG_DEBUG("maps", "%u GameObjects, %u Creatures, and %u Corpses/Bones loaded for grid %u on map %u", i_gameObjects, i_creatures, i_corpses, i_grid.GetGridId(), i_map->GetId()); } template<class T> diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index e5d737a7b36..272fd89f0a6 100644 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -66,10 +66,10 @@ Group::~Group() { if (m_bgGroup) { - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "Group::~Group: battleground group being deleted."); + TC_LOG_DEBUG("bg.battleground", "Group::~Group: battleground group being deleted."); if (m_bgGroup->GetBgRaid(ALLIANCE) == this) m_bgGroup->SetBgRaid(ALLIANCE, NULL); else if (m_bgGroup->GetBgRaid(HORDE) == this) m_bgGroup->SetBgRaid(HORDE, NULL); - else TC_LOG_ERROR(LOG_FILTER_GENERAL, "Group::~Group: battleground group is not linked to the correct battleground."); + else TC_LOG_ERROR("misc", "Group::~Group: battleground group is not linked to the correct battleground."); } Rolls::iterator itr; while (!RollId.empty()) @@ -909,7 +909,7 @@ void Group::GroupLoot(Loot* loot, WorldObject* pLootedObject) item = sObjectMgr->GetItemTemplate(i->itemid); if (!item) { - //TC_LOG_DEBUG(LOG_FILTER_GENERAL, "Group::GroupLoot: missing item prototype for item with id: %d", i->itemid); + //TC_LOG_DEBUG("misc", "Group::GroupLoot: missing item prototype for item with id: %d", i->itemid); continue; } @@ -996,7 +996,7 @@ void Group::GroupLoot(Loot* loot, WorldObject* pLootedObject) item = sObjectMgr->GetItemTemplate(i->itemid); if (!item) { - //TC_LOG_DEBUG(LOG_FILTER_GENERAL, "Group::GroupLoot: missing item prototype for item with id: %d", i->itemid); + //TC_LOG_DEBUG("misc", "Group::GroupLoot: missing item prototype for item with id: %d", i->itemid); continue; } @@ -1193,7 +1193,7 @@ void Group::NeedBeforeGreed(Loot* loot, WorldObject* lootedObject) void Group::MasterLoot(Loot* /*loot*/, WorldObject* pLootedObject) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Group::MasterLoot (SMSG_LOOT_MASTER_LIST)"); + TC_LOG_DEBUG("network", "Group::MasterLoot (SMSG_LOOT_MASTER_LIST)"); uint32 real_count = 0; @@ -2046,7 +2046,7 @@ InstanceGroupBind* Group::BindToInstance(InstanceSave* save, bool permanent, boo bind.save = save; bind.perm = permanent; if (!load) - TC_LOG_DEBUG(LOG_FILTER_MAPS, "Group::BindToInstance: Group (guid: %u, storage id: %u) is now bound to map %d, instance %d, difficulty %d", + TC_LOG_DEBUG("maps", "Group::BindToInstance: Group (guid: %u, storage id: %u) is now bound to map %d, instance %d, difficulty %d", GUID_LOPART(GetGUID()), m_dbStoreId, save->GetMapId(), save->GetInstanceId(), save->GetDifficulty()); return &bind; @@ -2089,7 +2089,7 @@ void Group::BroadcastGroupUpdate(void) { pp->ForceValuesUpdateAtIndex(UNIT_FIELD_BYTES_2); pp->ForceValuesUpdateAtIndex(UNIT_FIELD_FACTIONTEMPLATE); - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "-- Forced group value update for '%s'", pp->GetName().c_str()); + TC_LOG_DEBUG("misc", "-- Forced group value update for '%s'", pp->GetName().c_str()); } } } diff --git a/src/server/game/Groups/GroupMgr.cpp b/src/server/game/Groups/GroupMgr.cpp index 765a9ad87e3..762199f21d5 100644 --- a/src/server/game/Groups/GroupMgr.cpp +++ b/src/server/game/Groups/GroupMgr.cpp @@ -48,7 +48,7 @@ uint32 GroupMgr::GenerateNewGroupDbStoreId() if (newStorageId == NextGroupDbStoreId) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Group storage ID overflow!! Can't continue, shutting down server. "); + TC_LOG_ERROR("misc", "Group storage ID overflow!! Can't continue, shutting down server. "); World::StopNow(ERROR_EXIT_CODE); } @@ -86,7 +86,7 @@ uint32 GroupMgr::GenerateGroupId() { if (NextGroupId >= 0xFFFFFFFE) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Group guid overflow!! Can't continue, shutting down server. "); + TC_LOG_ERROR("misc", "Group guid overflow!! Can't continue, shutting down server. "); World::StopNow(ERROR_EXIT_CODE); } return NextGroupId++; @@ -127,7 +127,7 @@ void GroupMgr::LoadGroups() ", g.icon7, g.icon8, g.groupType, g.difficulty, g.raiddifficulty, g.guid, lfg.dungeon, lfg.state FROM groups g LEFT JOIN lfg_data lfg ON lfg.guid = g.guid ORDER BY g.guid ASC"); if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 group definitions. DB table `groups` is empty!"); + TC_LOG_INFO("server.loading", ">> Loaded 0 group definitions. DB table `groups` is empty!"); return; } @@ -152,10 +152,10 @@ void GroupMgr::LoadGroups() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Group members..."); + TC_LOG_INFO("server.loading", "Loading Group members..."); { uint32 oldMSTime = getMSTime(); @@ -169,7 +169,7 @@ void GroupMgr::LoadGroups() QueryResult result = CharacterDatabase.Query("SELECT guid, memberGuid, memberFlags, subgroup, roles FROM group_member ORDER BY guid"); if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 group members. DB table `group_member` is empty!"); + TC_LOG_INFO("server.loading", ">> Loaded 0 group members. DB table `group_member` is empty!"); return; } @@ -183,16 +183,16 @@ void GroupMgr::LoadGroups() if (group) group->LoadMemberFromDB(fields[1].GetUInt32(), fields[2].GetUInt8(), fields[3].GetUInt8(), fields[4].GetUInt8()); else - TC_LOG_ERROR(LOG_FILTER_GENERAL, "GroupMgr::LoadGroups: Consistency failed, can't find group (storage id: %u)", fields[0].GetUInt32()); + TC_LOG_ERROR("misc", "GroupMgr::LoadGroups: Consistency failed, can't find group (storage id: %u)", fields[0].GetUInt32()); ++count; } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u group members in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u group members in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Group instance saves..."); + TC_LOG_INFO("server.loading", "Loading Group instance saves..."); { uint32 oldMSTime = getMSTime(); // 0 1 2 3 4 5 6 @@ -201,7 +201,7 @@ void GroupMgr::LoadGroups() "LEFT JOIN character_instance ci LEFT JOIN groups g ON g.leaderGuid = ci.guid ON ci.instance = gi.instance AND ci.permanent = 1 GROUP BY gi.instance ORDER BY gi.guid"); if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 group-instance saves. DB table `group_instance` is empty!"); + TC_LOG_INFO("server.loading", ">> Loaded 0 group-instance saves. DB table `group_instance` is empty!"); return; } @@ -215,14 +215,14 @@ void GroupMgr::LoadGroups() MapEntry const* mapEntry = sMapStore.LookupEntry(fields[1].GetUInt16()); if (!mapEntry || !mapEntry->IsDungeon()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Incorrect entry in group_instance table : no dungeon map %d", fields[1].GetUInt16()); + TC_LOG_ERROR("sql.sql", "Incorrect entry in group_instance table : no dungeon map %d", fields[1].GetUInt16()); continue; } uint32 diff = fields[4].GetUInt8(); if (diff >= uint32(mapEntry->IsRaid() ? MAX_RAID_DIFFICULTY : MAX_DUNGEON_DIFFICULTY)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Wrong dungeon difficulty use in group_instance table: %d", diff + 1); + TC_LOG_ERROR("sql.sql", "Wrong dungeon difficulty use in group_instance table: %d", diff + 1); diff = 0; // default for both difficaly types } @@ -232,6 +232,6 @@ void GroupMgr::LoadGroups() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u group-instance saves in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u group-instance saves in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp index 1a3e48c8217..10bce9e2d51 100644 --- a/src/server/game/Guilds/Guild.cpp +++ b/src/server/game/Guilds/Guild.cpp @@ -72,8 +72,8 @@ std::string _GetGuildEventString(GuildEvents event) return "Bank tab updated"; case GE_BANK_MONEY_SET: return "Bank money set"; - case GE_BANK_MONEY_CHANGED: - return "Bank money changed"; + case GE_BANK_TAB_AND_MONEY_UPDATED: + return "Bank and money updated"; case GE_BANK_TEXT_CHANGED: return "Bank tab text changed"; default: @@ -104,7 +104,7 @@ void Guild::SendCommandResult(WorldSession* session, GuildCommandType type, Guil data << uint32(errCode); session->SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_GUILD, "SMSG_GUILD_COMMAND_RESULT [%s]: Type: %u, code: %u, param: %s" + TC_LOG_DEBUG("guild", "SMSG_GUILD_COMMAND_RESULT [%s]: Type: %u, code: %u, param: %s" , session->GetPlayerInfo().c_str(), type, errCode, param.c_str()); } @@ -114,7 +114,7 @@ void Guild::SendSaveEmblemResult(WorldSession* session, GuildEmblemError errCode data << uint32(errCode); session->SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_GUILD, "MSG_SAVE_GUILD_EMBLEM [%s] Code: %u", session->GetPlayerInfo().c_str(), errCode); + TC_LOG_DEBUG("guild", "MSG_SAVE_GUILD_EMBLEM [%s] Code: %u", session->GetPlayerInfo().c_str(), errCode); } // LogHolder @@ -273,6 +273,7 @@ void Guild::RankInfo::SaveToDB(SQLTransaction& trans) const stmt->setUInt8 (1, m_rankId); stmt->setString(2, m_name); stmt->setUInt32(3, m_rights); + stmt->setUInt32(4, m_bankMoneyPerDay); CharacterDatabase.ExecuteOrAppend(trans, stmt); } @@ -289,7 +290,7 @@ void Guild::RankInfo::CreateMissingTabsIfNeeded(uint8 tabs, SQLTransaction& tran rightsAndSlots.SetGuildMasterValues(); if (logOnCreate) - TC_LOG_ERROR(LOG_FILTER_GUILD, "Guild %u has broken Tab %u for rank %u. Created default tab.", m_guildId, i, m_rankId); + TC_LOG_ERROR("guild", "Guild %u has broken Tab %u for rank %u. Created default tab.", m_guildId, i, m_rankId); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GUILD_BANK_RIGHT); stmt->setUInt32(0, m_guildId); @@ -398,21 +399,21 @@ bool Guild::BankTab::LoadItemFromDB(Field* fields) uint32 itemEntry = fields[15].GetUInt32(); if (slotId >= GUILD_BANK_MAX_SLOTS) { - TC_LOG_ERROR(LOG_FILTER_GUILD, "Invalid slot for item (GUID: %u, id: %u) in guild bank, skipped.", itemGuid, itemEntry); + TC_LOG_ERROR("guild", "Invalid slot for item (GUID: %u, id: %u) in guild bank, skipped.", itemGuid, itemEntry); return false; } ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemEntry); if (!proto) { - TC_LOG_ERROR(LOG_FILTER_GUILD, "Unknown item (GUID: %u, id: %u) in guild bank, skipped.", itemGuid, itemEntry); + TC_LOG_ERROR("guild", "Unknown item (GUID: %u, id: %u) in guild bank, skipped.", itemGuid, itemEntry); return false; } Item* pItem = NewItemOrBag(proto); if (!pItem->LoadFromDB(itemGuid, 0, fields, itemEntry)) { - TC_LOG_ERROR(LOG_FILTER_GUILD, "Item (GUID %u, id: %u) not found in item_instance, deleting from guild bank!", itemGuid, itemEntry); + TC_LOG_ERROR("guild", "Item (GUID %u, id: %u) not found in item_instance, deleting from guild bank!", itemGuid, itemEntry); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_NONEXISTENT_GUILD_BANK_ITEM); stmt->setUInt32(0, m_guildId); @@ -572,13 +573,13 @@ void Guild::BankTab::SendText(Guild const* guild, WorldSession* session) const if (session) { - TC_LOG_DEBUG(LOG_FILTER_GUILD, "MSG_QUERY_GUILD_BANK_TEXT [%s]: Tabid: %u, Text: %s" + TC_LOG_DEBUG("guild", "MSG_QUERY_GUILD_BANK_TEXT [%s]: Tabid: %u, Text: %s" , session->GetPlayerInfo().c_str(), m_tabId, m_text.c_str()); session->SendPacket(&data); } else { - TC_LOG_DEBUG(LOG_FILTER_GUILD, "MSG_QUERY_GUILD_BANK_TEXT [Broadcast]: Tabid: %u, Text: %s", m_tabId, m_text.c_str()); + TC_LOG_DEBUG("guild", "MSG_QUERY_GUILD_BANK_TEXT [Broadcast]: Tabid: %u, Text: %s", m_tabId, m_text.c_str()); guild->BroadcastPacket(&data); } } @@ -676,7 +677,7 @@ bool Guild::Member::LoadFromDB(Field* fields) if (!m_zoneId) { - TC_LOG_ERROR(LOG_FILTER_GUILD, "Player (GUID: %u) has broken zone-data", GUID_LOPART(m_guid)); + TC_LOG_ERROR("guild", "Player (GUID: %u) has broken zone-data", GUID_LOPART(m_guid)); m_zoneId = Player::GetZoneIdFromDB(m_guid); } ResetFlags(); @@ -688,13 +689,13 @@ bool Guild::Member::CheckStats() const { if (m_level < 1) { - TC_LOG_ERROR(LOG_FILTER_GUILD, "Player (GUID: %u) has a broken data in field `characters`.`level`, deleting him from guild!", GUID_LOPART(m_guid)); + TC_LOG_ERROR("guild", "Player (GUID: %u) has a broken data in field `characters`.`level`, deleting him from guild!", GUID_LOPART(m_guid)); return false; } if (m_class < CLASS_WARRIOR || m_class >= MAX_CLASSES) { - TC_LOG_ERROR(LOG_FILTER_GUILD, "Player (GUID: %u) has a broken data in field `characters`.`class`, deleting him from guild!", GUID_LOPART(m_guid)); + TC_LOG_ERROR("guild", "Player (GUID: %u) has a broken data in field `characters`.`class`, deleting him from guild!", GUID_LOPART(m_guid)); return false; } return true; @@ -960,7 +961,7 @@ Item* Guild::BankMoveItemData::StoreItem(SQLTransaction& trans, Item* pItem) ItemPosCount pos(*itr); ++itr; - TC_LOG_DEBUG(LOG_FILTER_GUILD, "GUILD STORAGE: StoreItem tab = %u, slot = %u, item = %u, count = %u", + TC_LOG_DEBUG("guild", "GUILD STORAGE: StoreItem tab = %u, slot = %u, item = %u, count = %u", m_container, m_slotId, pItem->GetEntry(), pItem->GetCount()); pLastItem = _StoreItem(trans, pTab, pItem, pos, itr != m_vec.end()); } @@ -1071,7 +1072,7 @@ void Guild::BankMoveItemData::CanStoreItemInTab(Item* pItem, uint8 skipSlotId, b InventoryResult Guild::BankMoveItemData::CanStore(Item* pItem, bool swap) { - TC_LOG_DEBUG(LOG_FILTER_GUILD, "GUILD STORAGE: CanStore() tab = %u, slot = %u, item = %u, count = %u", + TC_LOG_DEBUG("guild", "GUILD STORAGE: CanStore() tab = %u, slot = %u, item = %u, count = %u", m_container, m_slotId, pItem->GetEntry(), pItem->GetCount()); uint32 count = pItem->GetCount(); @@ -1169,7 +1170,7 @@ bool Guild::Create(Player* pLeader, std::string const& name) m_createdDate = ::time(NULL); _CreateLogHolders(); - TC_LOG_DEBUG(LOG_FILTER_GUILD, "GUILD: creating guild [%s] for leader %s (%u)", + TC_LOG_DEBUG("guild", "GUILD: creating guild [%s] for leader %s (%u)", name.c_str(), pLeader->GetName().c_str(), GUID_LOPART(m_leaderGuid)); SQLTransaction trans = CharacterDatabase.BeginTransaction(); @@ -1268,7 +1269,7 @@ void Guild::UpdateMemberData(Player* player, uint8 dataid, uint32 value) member->SetLevel(value); break; default: - TC_LOG_ERROR(LOG_FILTER_GUILD, "Guild::UpdateMemberData: Called with incorrect DATAID %u (value %u)", dataid, value); + TC_LOG_ERROR("guild", "Guild::UpdateMemberData: Called with incorrect DATAID %u (value %u)", dataid, value); return; } //HandleRoster(); @@ -1315,12 +1316,12 @@ void Guild::HandleRoster(WorldSession* session /*= NULL*/) if (session) { - TC_LOG_DEBUG(LOG_FILTER_GUILD, "SMSG_GUILD_ROSTER [%s]", session->GetPlayerInfo().c_str()); + TC_LOG_DEBUG("guild", "SMSG_GUILD_ROSTER [%s]", session->GetPlayerInfo().c_str()); session->SendPacket(&data); } else { - TC_LOG_DEBUG(LOG_FILTER_GUILD, "SMSG_GUILD_ROSTER [Broadcast]"); + TC_LOG_DEBUG("guild", "SMSG_GUILD_ROSTER [Broadcast]"); BroadcastPacket(&data); } } @@ -1344,7 +1345,7 @@ void Guild::HandleQuery(WorldSession* session) data << uint32(_GetRanksSize()); // Number of ranks used session->SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_GUILD, "SMSG_GUILD_QUERY_RESPONSE [%s]", session->GetPlayerInfo().c_str()); + TC_LOG_DEBUG("guild", "SMSG_GUILD_QUERY_RESPONSE [%s]", session->GetPlayerInfo().c_str()); } void Guild::HandleSetMOTD(WorldSession* session, std::string const& motd) @@ -1433,7 +1434,7 @@ void Guild::HandleSetBankTabInfo(WorldSession* session, uint8 tabId, std::string BankTab* tab = GetBankTab(tabId); if (!tab) { - TC_LOG_ERROR(LOG_FILTER_GUILD, "Guild::HandleSetBankTabInfo: Player %s trying to change bank tab info from unexisting tab %d.", + TC_LOG_ERROR("guild", "Guild::HandleSetBankTabInfo: Player %s trying to change bank tab info from unexisting tab %d.", session->GetPlayerInfo().c_str(), tabId); return; } @@ -1468,7 +1469,7 @@ void Guild::HandleSetRankInfo(WorldSession* session, uint8 rankId, std::string c SendCommandResult(session, GUILD_COMMAND_CHANGE_RANK, ERR_GUILD_PERMISSIONS); else if (RankInfo* rankInfo = GetRankInfo(rankId)) { - TC_LOG_DEBUG(LOG_FILTER_GUILD, "Changed RankName to '%s', rights to 0x%08X", name.c_str(), rights); + TC_LOG_DEBUG("guild", "Changed RankName to '%s', rights to 0x%08X", name.c_str(), rights); rankInfo->SetName(name); rankInfo->SetRights(rights); @@ -1553,7 +1554,7 @@ void Guild::HandleInviteMember(WorldSession* session, std::string const& name) SendCommandResult(session, GUILD_COMMAND_INVITE, ERR_GUILD_COMMAND_SUCCESS, name); - TC_LOG_DEBUG(LOG_FILTER_GUILD, "Player %s invited %s to join his Guild", player->GetName().c_str(), name.c_str()); + TC_LOG_DEBUG("guild", "Player %s invited %s to join his Guild", player->GetName().c_str(), name.c_str()); pInvitee->SetGuildIdInvited(m_id); _LogEvent(GUILD_EVENT_LOG_INVITE_PLAYER, player->GetGUIDLow(), pInvitee->GetGUIDLow()); @@ -1562,7 +1563,7 @@ void Guild::HandleInviteMember(WorldSession* session, std::string const& name) data << player->GetName(); data << m_name; pInvitee->GetSession()->SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_GUILD, "SMSG_GUILD_INVITE [%s]", pInvitee->GetName().c_str()); + TC_LOG_DEBUG("guild", "SMSG_GUILD_INVITE [%s]", pInvitee->GetName().c_str()); } void Guild::HandleAcceptMember(WorldSession* session) @@ -1749,8 +1750,8 @@ void Guild::HandleMemberDepositMoney(WorldSession* session, uint32 amount) CharacterDatabase.CommitTransaction(trans); - std::string aux = ByteArrayToHexStr(reinterpret_cast<uint8*>(&amount), 8, true); - _BroadcastEvent(GE_BANK_MONEY_CHANGED, 0, aux.c_str()); + std::string aux = ByteArrayToHexStr(reinterpret_cast<uint8*>(&m_bankMoney), 8, true); + _BroadcastEvent(GE_BANK_MONEY_SET, 0, aux.c_str()); if (player->GetSession()->HasPermission(rbac::RBAC_PERM_LOG_GM_TRADE)) { @@ -1799,8 +1800,8 @@ bool Guild::HandleMemberWithdrawMoney(WorldSession* session, uint32 amount, bool _LogBankEvent(trans, repair ? GUILD_BANK_LOG_REPAIR_MONEY : GUILD_BANK_LOG_WITHDRAW_MONEY, uint8(0), player->GetGUIDLow(), amount); CharacterDatabase.CommitTransaction(trans); - std::string aux = ByteArrayToHexStr(reinterpret_cast<uint8*>(&amount), 8, true); - _BroadcastEvent(GE_BANK_MONEY_CHANGED, 0, aux.c_str()); + std::string aux = ByteArrayToHexStr(reinterpret_cast<uint8*>(&m_bankMoney), 8, true); + _BroadcastEvent(GE_BANK_MONEY_SET, 0, aux.c_str()); return true; } @@ -1822,7 +1823,7 @@ void Guild::HandleDisband(WorldSession* session) if (_IsLeader(session->GetPlayer())) { Disband(); - TC_LOG_DEBUG(LOG_FILTER_GUILD, "Guild Successfully Disbanded"); + TC_LOG_DEBUG("guild", "Guild Successfully Disbanded"); delete this; } } @@ -1837,7 +1838,7 @@ void Guild::SendInfo(WorldSession* session) const data << m_accountsNumber; // Number of accounts session->SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_GUILD, "SMSG_GUILD_INFO [%s]", session->GetPlayerInfo().c_str()); + TC_LOG_DEBUG("guild", "SMSG_GUILD_INFO [%s]", session->GetPlayerInfo().c_str()); } void Guild::SendEventLog(WorldSession* session) const @@ -1845,7 +1846,7 @@ void Guild::SendEventLog(WorldSession* session) const WorldPacket data(MSG_GUILD_EVENT_LOG_QUERY, 1 + m_eventLog->GetSize() * (1 + 8 + 4)); m_eventLog->WritePacket(data); session->SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_GUILD, "MSG_GUILD_EVENT_LOG_QUERY [%s]", session->GetPlayerInfo().c_str()); + TC_LOG_DEBUG("guild", "MSG_GUILD_EVENT_LOG_QUERY [%s]", session->GetPlayerInfo().c_str()); } void Guild::SendBankLog(WorldSession* session, uint8 tabId) const @@ -1858,7 +1859,7 @@ void Guild::SendBankLog(WorldSession* session, uint8 tabId) const data << uint8(tabId); pLog->WritePacket(data); session->SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_GUILD, "MSG_GUILD_BANK_LOG_QUERY [%s]", session->GetPlayerInfo().c_str()); + TC_LOG_DEBUG("guild", "MSG_GUILD_BANK_LOG_QUERY [%s]", session->GetPlayerInfo().c_str()); } } @@ -1899,7 +1900,7 @@ void Guild::SendPermissions(WorldSession* session) const } session->SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_GUILD, "MSG_GUILD_PERMISSIONS [%s] Rank: %u", session->GetPlayerInfo().c_str(), rankId); + TC_LOG_DEBUG("guild", "MSG_GUILD_PERMISSIONS [%s] Rank: %u", session->GetPlayerInfo().c_str(), rankId); } void Guild::SendMoneyInfo(WorldSession* session) const @@ -1912,7 +1913,7 @@ void Guild::SendMoneyInfo(WorldSession* session) const WorldPacket data(MSG_GUILD_BANK_MONEY_WITHDRAWN, 4); data << int32(amount); session->SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_GUILD, "MSG_GUILD_BANK_MONEY_WITHDRAWN [%s] Money: %u", session->GetPlayerInfo().c_str(), amount); + TC_LOG_DEBUG("guild", "MSG_GUILD_BANK_MONEY_WITHDRAWN [%s] Money: %u", session->GetPlayerInfo().c_str(), amount); } void Guild::SendLoginInfo(WorldSession* session) @@ -1923,7 +1924,7 @@ void Guild::SendLoginInfo(WorldSession* session) data << m_motd; session->SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_GUILD, "SMSG_GUILD_EVENT [%s] MOTD", session->GetPlayerInfo().c_str()); + TC_LOG_DEBUG("guild", "SMSG_GUILD_EVENT [%s] MOTD", session->GetPlayerInfo().c_str()); SendBankTabsInfo(session); @@ -2027,13 +2028,13 @@ bool Guild::LoadBankEventLogFromDB(Field* fields) { if (!isMoneyTab) { - TC_LOG_ERROR(LOG_FILTER_GUILD, "GuildBankEventLog ERROR: MoneyEvent(LogGuid: %u, Guild: %u) does not belong to money tab (%u), ignoring...", guid, m_id, dbTabId); + TC_LOG_ERROR("guild", "GuildBankEventLog ERROR: MoneyEvent(LogGuid: %u, Guild: %u) does not belong to money tab (%u), ignoring...", guid, m_id, dbTabId); return false; } } else if (isMoneyTab) { - TC_LOG_ERROR(LOG_FILTER_GUILD, "GuildBankEventLog ERROR: non-money event (LogGuid: %u, Guild: %u) belongs to money tab, ignoring...", guid, m_id); + TC_LOG_ERROR("guild", "GuildBankEventLog ERROR: non-money event (LogGuid: %u, Guild: %u) belongs to money tab, ignoring...", guid, m_id); return false; } pLog->LoadEvent(new BankEventLogEntry( @@ -2055,7 +2056,7 @@ void Guild::LoadBankTabFromDB(Field* fields) { uint8 tabId = fields[1].GetUInt8(); if (tabId >= _GetPurchasedTabsSize()) - TC_LOG_ERROR(LOG_FILTER_GUILD, "Invalid tab (tabId: %u) in guild bank, skipped.", tabId); + TC_LOG_ERROR("guild", "Invalid tab (tabId: %u) in guild bank, skipped.", tabId); else m_bankTabs[tabId]->LoadFromDB(fields); } @@ -2065,7 +2066,7 @@ bool Guild::LoadBankItemFromDB(Field* fields) uint8 tabId = fields[12].GetUInt8(); if (tabId >= _GetPurchasedTabsSize()) { - TC_LOG_ERROR(LOG_FILTER_GUILD, "Invalid tab for item (GUID: %u, id: #%u) in guild bank, skipped.", + TC_LOG_ERROR("guild", "Invalid tab for item (GUID: %u, id: #%u) in guild bank, skipped.", fields[14].GetUInt32(), fields[15].GetUInt32()); return false; } @@ -2084,7 +2085,7 @@ bool Guild::Validate() uint8 ranks = _GetRanksSize(); if (ranks < GUILD_RANKS_MIN_COUNT || ranks > GUILD_RANKS_MAX_COUNT) { - TC_LOG_ERROR(LOG_FILTER_GUILD, "Guild %u has invalid number of ranks, creating new...", m_id); + TC_LOG_ERROR("guild", "Guild %u has invalid number of ranks, creating new...", m_id); broken_ranks = true; } else @@ -2094,7 +2095,7 @@ bool Guild::Validate() RankInfo* rankInfo = GetRankInfo(rankId); if (rankInfo->GetId() != rankId) { - TC_LOG_ERROR(LOG_FILTER_GUILD, "Guild %u has broken rank id %u, creating default set of ranks...", m_id, rankId); + TC_LOG_ERROR("guild", "Guild %u has broken rank id %u, creating default set of ranks...", m_id, rankId); broken_ranks = true; } else @@ -2693,7 +2694,7 @@ void Guild::_MoveItems(MoveItemData* pSrc, MoveItemData* pDest, uint32 splitedAm /* if (pItemSrc->GetCount() == 0) { - TC_LOG_FATAL(LOG_FILTER_GUILD, "Guild::SwapItems: Player %s(GUIDLow: %u) tried to move item %u from tab %u slot %u to tab %u slot %u, but item %u has a stack of zero!", + TC_LOG_FATAL("guild", "Guild::SwapItems: Player %s(GUIDLow: %u) tried to move item %u from tab %u slot %u to tab %u slot %u, but item %u has a stack of zero!", player->GetName(), player->GetGUIDLow(), pItemSrc->GetEntry(), tabId, slotId, destTabId, destSlotId, pItemSrc->GetEntry()); //return; // Commented out for now, uncomment when it's verified that this causes a crash!! } @@ -2857,8 +2858,8 @@ void Guild::_BroadcastEvent(GuildEvents guildEvent, uint64 guid, const char* par BroadcastPacket(&data); - if (sLog->ShouldLog(LOG_FILTER_GUILD, LOG_LEVEL_DEBUG)) - TC_LOG_DEBUG(LOG_FILTER_GUILD, "SMSG_GUILD_EVENT [Broadcast] Event: %s (%u)", _GetGuildEventString(guildEvent).c_str(), guildEvent); + if (sLog->ShouldLog("guild", LOG_LEVEL_DEBUG)) + TC_LOG_DEBUG("guild", "SMSG_GUILD_EVENT [Broadcast] Event: %s (%u)", _GetGuildEventString(guildEvent).c_str(), guildEvent); } void Guild::_SendBankList(WorldSession* session /* = NULL*/, uint8 tabId /*= 0*/, bool sendAllSlots /*= false*/, SlotIds *slots /*= NULL*/) const @@ -2898,7 +2899,7 @@ void Guild::_SendBankList(WorldSession* session /* = NULL*/, uint8 tabId /*= 0*/ numSlots = _GetMemberRemainingSlots(member, tabId); data.put<uint32>(rempos, numSlots); session->SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_GUILD, "SMSG_GUILD_BANK_LIST [%s]: TabId: %u, FullSlots: %u, slots: %d", + TC_LOG_DEBUG("guild", "SMSG_GUILD_BANK_LIST [%s]: TabId: %u, FullSlots: %u, slots: %d", session->GetPlayerInfo().c_str(), tabId, sendAllSlots, numSlots); } else /// @todo - Probably this is just sent to session + those that have sent CMSG_GUILD_BANKER_ACTIVATE @@ -2914,7 +2915,7 @@ void Guild::_SendBankList(WorldSession* session /* = NULL*/, uint8 tabId /*= 0*/ uint32 numSlots = _GetMemberRemainingSlots(itr->second, tabId); data.put<uint32>(rempos, numSlots); player->GetSession()->SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_GUILD, "SMSG_GUILD_BANK_LIST [%s]: TabId: %u, FullSlots: %u, slots: %u" + TC_LOG_DEBUG("guild", "SMSG_GUILD_BANK_LIST [%s]: TabId: %u, FullSlots: %u, slots: %u" , player->GetName().c_str(), tabId, sendAllSlots, numSlots); } } @@ -2925,6 +2926,5 @@ void Guild::ResetTimes() for (Members::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr) itr->second->ResetValues(); - // Hack... way to force client to ask for money/slots - _BroadcastEvent(GE_RANK_UPDATED, 0, "0", GetRankInfo(0)->GetName().c_str()); + _BroadcastEvent(GE_BANK_TAB_AND_MONEY_UPDATED, 0); } diff --git a/src/server/game/Guilds/Guild.h b/src/server/game/Guilds/Guild.h index 4d8987dbbf0..c695d141afe 100644 --- a/src/server/game/Guilds/Guild.h +++ b/src/server/game/Guilds/Guild.h @@ -146,11 +146,11 @@ enum GuildEvents GE_RANK_DELETED = 11, GE_SIGNED_ON = 12, GE_SIGNED_OFF = 13, - GE_GUILDBANKBAGSLOTS_CHANGED = 14, + GE_GUILDBANKBAGSLOTS_CHANGED = 14, /// TODO: Sent when items are moved in gbank - all players with bank open will send tab query GE_BANK_TAB_PURCHASED = 15, GE_BANK_TAB_UPDATED = 16, GE_BANK_MONEY_SET = 17, - GE_BANK_MONEY_CHANGED = 18, + GE_BANK_TAB_AND_MONEY_UPDATED = 18, GE_BANK_TEXT_CHANGED = 19, }; @@ -471,7 +471,8 @@ private: RankInfo(): m_guildId(0), m_rankId(GUILD_RANK_NONE), m_rights(GR_RIGHT_EMPTY), m_bankMoneyPerDay(0) { } RankInfo(uint32 guildId) : m_guildId(guildId), m_rankId(GUILD_RANK_NONE), m_rights(GR_RIGHT_EMPTY), m_bankMoneyPerDay(0) { } RankInfo(uint32 guildId, uint8 rankId, std::string const& name, uint32 rights, uint32 money) : - m_guildId(guildId), m_rankId(rankId), m_name(name), m_rights(rights), m_bankMoneyPerDay(money) { } + m_guildId(guildId), m_rankId(rankId), m_name(name), m_rights(rights), + m_bankMoneyPerDay(rankId != GR_GUILDMASTER ? money : GUILD_WITHDRAW_MONEY_UNLIMITED) { } void LoadFromDB(Field* fields); void SaveToDB(SQLTransaction& trans) const; diff --git a/src/server/game/Guilds/GuildMgr.cpp b/src/server/game/Guilds/GuildMgr.cpp index 1fcc6ec4e6e..66a763110c1 100644 --- a/src/server/game/Guilds/GuildMgr.cpp +++ b/src/server/game/Guilds/GuildMgr.cpp @@ -41,7 +41,7 @@ uint32 GuildMgr::GenerateGuildId() { if (NextGuildId >= 0xFFFFFFFE) { - TC_LOG_ERROR(LOG_FILTER_GUILD, "Guild ids overflow!! Can't continue, shutting down server. "); + TC_LOG_ERROR("guild", "Guild ids overflow!! Can't continue, shutting down server. "); World::StopNow(ERROR_EXIT_CODE); } return NextGuildId++; @@ -91,7 +91,7 @@ Guild* GuildMgr::GetGuildByLeader(uint64 guid) const void GuildMgr::LoadGuilds() { // 1. Load all guilds - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading guilds definitions..."); + TC_LOG_INFO("server.loading", "Loading guilds definitions..."); { uint32 oldMSTime = getMSTime(); @@ -103,7 +103,7 @@ void GuildMgr::LoadGuilds() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild definitions. DB table `guild` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 guild definitions. DB table `guild` is empty."); return; } else @@ -126,12 +126,12 @@ void GuildMgr::LoadGuilds() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u guild definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } // 2. Load all guild ranks - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading guild ranks..."); + TC_LOG_INFO("server.loading", "Loading guild ranks..."); { uint32 oldMSTime = getMSTime(); @@ -143,7 +143,7 @@ void GuildMgr::LoadGuilds() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild ranks. DB table `guild_rank` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 guild ranks. DB table `guild_rank` is empty."); } else { @@ -160,12 +160,12 @@ void GuildMgr::LoadGuilds() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild ranks in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u guild ranks in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } // 3. Load all guild members - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading guild members..."); + TC_LOG_INFO("server.loading", "Loading guild members..."); { uint32 oldMSTime = getMSTime(); @@ -182,7 +182,7 @@ void GuildMgr::LoadGuilds() "LEFT JOIN characters c ON c.guid = gm.guid ORDER BY guildid ASC"); if (!result) - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild members. DB table `guild_member` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 guild members. DB table `guild_member` is empty."); else { uint32 count = 0; @@ -199,12 +199,12 @@ void GuildMgr::LoadGuilds() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild members in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u guild members in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } // 4. Load all guild bank tab rights - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading bank tab rights..."); + TC_LOG_INFO("server.loading", "Loading bank tab rights..."); { uint32 oldMSTime = getMSTime(); @@ -216,7 +216,7 @@ void GuildMgr::LoadGuilds() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild bank tab rights. DB table `guild_bank_right` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 guild bank tab rights. DB table `guild_bank_right` is empty."); } else { @@ -233,12 +233,12 @@ void GuildMgr::LoadGuilds() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u bank tab rights in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u bank tab rights in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } // 5. Load all event logs - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading guild event logs..."); + TC_LOG_INFO("server.loading", "Loading guild event logs..."); { uint32 oldMSTime = getMSTime(); @@ -249,7 +249,7 @@ void GuildMgr::LoadGuilds() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild event logs. DB table `guild_eventlog` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 guild event logs. DB table `guild_eventlog` is empty."); } else { @@ -266,12 +266,12 @@ void GuildMgr::LoadGuilds() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u guild event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } // 6. Load all bank event logs - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading guild bank event logs..."); + TC_LOG_INFO("server.loading", "Loading guild bank event logs..."); { uint32 oldMSTime = getMSTime(); @@ -283,7 +283,7 @@ void GuildMgr::LoadGuilds() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild bank event logs. DB table `guild_bank_eventlog` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 guild bank event logs. DB table `guild_bank_eventlog` is empty."); } else { @@ -300,12 +300,12 @@ void GuildMgr::LoadGuilds() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild bank event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u guild bank event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } // 7. Load all guild bank tabs - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading guild bank tabs..."); + TC_LOG_INFO("server.loading", "Loading guild bank tabs..."); { uint32 oldMSTime = getMSTime(); @@ -317,7 +317,7 @@ void GuildMgr::LoadGuilds() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild bank tabs. DB table `guild_bank_tab` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 guild bank tabs. DB table `guild_bank_tab` is empty."); } else { @@ -334,12 +334,12 @@ void GuildMgr::LoadGuilds() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild bank tabs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u guild bank tabs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } // 8. Fill all guild bank tabs - TC_LOG_INFO(LOG_FILTER_GUILD, "Filling bank tabs with items..."); + TC_LOG_INFO("guild", "Filling bank tabs with items..."); { uint32 oldMSTime = getMSTime(); @@ -353,7 +353,7 @@ void GuildMgr::LoadGuilds() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild bank tab items. DB table `guild_bank_item` or `item_instance` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 guild bank tab items. DB table `guild_bank_item` or `item_instance` is empty."); } else { @@ -370,12 +370,12 @@ void GuildMgr::LoadGuilds() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild bank tab items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u guild bank tab items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } // 9. Validate loaded guild data - TC_LOG_INFO(LOG_FILTER_GUILD, "Validating data of loaded guilds..."); + TC_LOG_INFO("guild", "Validating data of loaded guilds..."); { uint32 oldMSTime = getMSTime(); @@ -387,7 +387,7 @@ void GuildMgr::LoadGuilds() delete guild; } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Validated data of loaded guilds in %u ms", GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Validated data of loaded guilds in %u ms", GetMSTimeDiffToNow(oldMSTime)); } } diff --git a/src/server/game/Handlers/AddonHandler.cpp b/src/server/game/Handlers/AddonHandler.cpp index 31404113eca..3a5a5ba8bf0 100644 --- a/src/server/game/Handlers/AddonHandler.cpp +++ b/src/server/game/Handlers/AddonHandler.cpp @@ -74,7 +74,7 @@ bool AddonHandler::BuildAddonPacket(WorldPacket* source, WorldPacket* target) AddOnPacked >> enabled >> crc >> unk2; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "ADDON: Name: %s, Enabled: 0x%x, CRC: 0x%x, Unknown2: 0x%x", addonName.c_str(), enabled, crc, unk2); + TC_LOG_DEBUG("network", "ADDON: Name: %s, Enabled: 0x%x, CRC: 0x%x, Unknown2: 0x%x", addonName.c_str(), enabled, crc, unk2); uint8 state = (enabled ? 2 : 1); *target << uint8(state); @@ -128,11 +128,11 @@ bool AddonHandler::BuildAddonPacket(WorldPacket* source, WorldPacket* target) *target << uint32(count); if (AddOnPacked.rpos() != AddOnPacked.size()) - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "packet under read!"); + TC_LOG_DEBUG("network", "packet under read!"); } else { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Addon packet uncompress error :("); + TC_LOG_ERROR("network", "Addon packet uncompress error :("); return false; } return true; diff --git a/src/server/game/Handlers/ArenaTeamHandler.cpp b/src/server/game/Handlers/ArenaTeamHandler.cpp index b2fa49233c3..824c5631da0 100644 --- a/src/server/game/Handlers/ArenaTeamHandler.cpp +++ b/src/server/game/Handlers/ArenaTeamHandler.cpp @@ -31,11 +31,11 @@ void WorldSession::HandleInspectArenaTeamsOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "MSG_INSPECT_ARENA_TEAMS"); + TC_LOG_DEBUG("network", "MSG_INSPECT_ARENA_TEAMS"); uint64 guid; recvData >> guid; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Inspect Arena stats (GUID: %u TypeId: %u)", GUID_LOPART(guid), GuidHigh2TypeId(GUID_HIPART(guid))); + TC_LOG_DEBUG("network", "Inspect Arena stats (GUID: %u TypeId: %u)", GUID_LOPART(guid), GuidHigh2TypeId(GUID_HIPART(guid))); if (Player* player = ObjectAccessor::FindPlayer(guid)) { @@ -52,7 +52,7 @@ void WorldSession::HandleInspectArenaTeamsOpcode(WorldPacket& recvData) void WorldSession::HandleArenaTeamQueryOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_ARENA_TEAM_QUERY"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_ARENA_TEAM_QUERY"); uint32 arenaTeamId; recvData >> arenaTeamId; @@ -66,7 +66,7 @@ void WorldSession::HandleArenaTeamQueryOpcode(WorldPacket& recvData) void WorldSession::HandleArenaTeamRosterOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_ARENA_TEAM_ROSTER"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_ARENA_TEAM_ROSTER"); uint32 arenaTeamId; // arena team id recvData >> arenaTeamId; @@ -77,7 +77,7 @@ void WorldSession::HandleArenaTeamRosterOpcode(WorldPacket& recvData) void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_INVITE"); + TC_LOG_DEBUG("network", "CMSG_ARENA_TEAM_INVITE"); uint32 arenaTeamId; // arena team id std::string invitedName; @@ -141,7 +141,7 @@ void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket& recvData) return; } - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "Player %s Invited %s to Join his ArenaTeam", GetPlayer()->GetName().c_str(), invitedName.c_str()); + TC_LOG_DEBUG("bg.battleground", "Player %s Invited %s to Join his ArenaTeam", GetPlayer()->GetName().c_str(), invitedName.c_str()); player->SetArenaTeamIdInvited(arenaTeam->GetId()); @@ -150,12 +150,12 @@ void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket& recvData) data << arenaTeam->GetName(); player->GetSession()->SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_ARENA_TEAM_INVITE"); + TC_LOG_DEBUG("network", "WORLD: Sent SMSG_ARENA_TEAM_INVITE"); } void WorldSession::HandleArenaTeamAcceptOpcode(WorldPacket & /*recvData*/) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_ACCEPT"); // empty opcode + TC_LOG_DEBUG("network", "CMSG_ARENA_TEAM_ACCEPT"); // empty opcode ArenaTeam* arenaTeam = sArenaTeamMgr->GetArenaTeamById(_player->GetArenaTeamIdInvited()); if (!arenaTeam) @@ -188,7 +188,7 @@ void WorldSession::HandleArenaTeamAcceptOpcode(WorldPacket & /*recvData*/) void WorldSession::HandleArenaTeamDeclineOpcode(WorldPacket & /*recvData*/) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_DECLINE"); // empty opcode + TC_LOG_DEBUG("network", "CMSG_ARENA_TEAM_DECLINE"); // empty opcode // Remove invite from player _player->SetArenaTeamIdInvited(0); @@ -196,7 +196,7 @@ void WorldSession::HandleArenaTeamDeclineOpcode(WorldPacket & /*recvData*/) void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_LEAVE"); + TC_LOG_DEBUG("network", "CMSG_ARENA_TEAM_LEAVE"); uint32 arenaTeamId; recvData >> arenaTeamId; @@ -238,7 +238,7 @@ void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket& recvData) void WorldSession::HandleArenaTeamDisbandOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_DISBAND"); + TC_LOG_DEBUG("network", "CMSG_ARENA_TEAM_DISBAND"); uint32 arenaTeamId; recvData >> arenaTeamId; @@ -260,7 +260,7 @@ void WorldSession::HandleArenaTeamDisbandOpcode(WorldPacket& recvData) void WorldSession::HandleArenaTeamRemoveOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_REMOVE"); + TC_LOG_DEBUG("network", "CMSG_ARENA_TEAM_REMOVE"); uint32 arenaTeamId; std::string name; @@ -306,7 +306,7 @@ void WorldSession::HandleArenaTeamRemoveOpcode(WorldPacket& recvData) void WorldSession::HandleArenaTeamLeaderOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_LEADER"); + TC_LOG_DEBUG("network", "CMSG_ARENA_TEAM_LEADER"); uint32 arenaTeamId; std::string name; diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp index cceac0ef21f..1e5c35cf3ff 100644 --- a/src/server/game/Handlers/AuctionHouseHandler.cpp +++ b/src/server/game/Handlers/AuctionHouseHandler.cpp @@ -39,7 +39,7 @@ void WorldSession::HandleAuctionHelloOpcode(WorldPacket& recvData) Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER); if (!unit) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: HandleAuctionHelloOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: HandleAuctionHelloOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); return; } @@ -149,7 +149,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData) if (bid > MAX_MONEY_AMOUNT || buyout > MAX_MONEY_AMOUNT) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: HandleAuctionSellItem - Player %s (GUID %u) attempted to sell item with higher price than max gold amount.", _player->GetName().c_str(), _player->GetGUIDLow()); + TC_LOG_DEBUG("network", "WORLD: HandleAuctionSellItem - Player %s (GUID %u) attempted to sell item with higher price than max gold amount.", _player->GetName().c_str(), _player->GetGUIDLow()); SendAuctionCommandResult(0, AUCTION_SELL_ITEM, ERR_AUCTION_DATABASE_ERROR); return; } @@ -158,14 +158,14 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData) Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER); if (!creature) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: HandleAuctionSellItem - Unit (GUID: %u) not found or you can't interact with him.", GUID_LOPART(auctioneer)); + TC_LOG_DEBUG("network", "WORLD: HandleAuctionSellItem - Unit (GUID: %u) not found or you can't interact with him.", GUID_LOPART(auctioneer)); return; } AuctionHouseEntry const* auctionHouseEntry = AuctionHouseMgr::GetAuctionHouseEntry(creature->getFaction()); if (!auctionHouseEntry) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: HandleAuctionSellItem - Unit (GUID: %u) has wrong faction.", GUID_LOPART(auctioneer)); + TC_LOG_DEBUG("network", "WORLD: HandleAuctionSellItem - Unit (GUID: %u) has wrong faction.", GUID_LOPART(auctioneer)); return; } @@ -268,7 +268,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData) AH->deposit = deposit; AH->auctionHouseEntry = auctionHouseEntry; - TC_LOG_INFO(LOG_FILTER_NETWORKIO, "CMSG_AUCTION_SELL_ITEM: Player %s (guid %d) is selling item %s entry %u (guid %d) to auctioneer %u with count %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u", _player->GetName().c_str(), _player->GetGUIDLow(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetGUIDLow(), AH->auctioneer, item->GetCount(), bid, buyout, auctionTime, AH->GetHouseId()); + TC_LOG_INFO("network", "CMSG_AUCTION_SELL_ITEM: Player %s (guid %d) is selling item %s entry %u (guid %d) to auctioneer %u with count %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u", _player->GetName().c_str(), _player->GetGUIDLow(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetGUIDLow(), AH->auctioneer, item->GetCount(), bid, buyout, auctionTime, AH->GetHouseId()); sAuctionMgr->AddAItem(item); auctionHouse->AddAuction(AH); @@ -290,7 +290,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData) Item* newItem = item->CloneItem(finalCount, _player); if (!newItem) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "CMSG_AUCTION_SELL_ITEM: Could not create clone of item %u", item->GetEntry()); + TC_LOG_ERROR("network", "CMSG_AUCTION_SELL_ITEM: Could not create clone of item %u", item->GetEntry()); SendAuctionCommandResult(0, AUCTION_SELL_ITEM, ERR_AUCTION_DATABASE_ERROR); delete AH; return; @@ -315,7 +315,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData) AH->deposit = deposit; AH->auctionHouseEntry = auctionHouseEntry; - TC_LOG_INFO(LOG_FILTER_NETWORKIO, "CMSG_AUCTION_SELL_ITEM: Player %s (guid %d) is selling item %s entry %u (guid %d) to auctioneer %u with count %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u", _player->GetName().c_str(), _player->GetGUIDLow(), newItem->GetTemplate()->Name1.c_str(), newItem->GetEntry(), newItem->GetGUIDLow(), AH->auctioneer, newItem->GetCount(), bid, buyout, auctionTime, AH->GetHouseId()); + TC_LOG_INFO("network", "CMSG_AUCTION_SELL_ITEM: Player %s (guid %d) is selling item %s entry %u (guid %d) to auctioneer %u with count %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u", _player->GetName().c_str(), _player->GetGUIDLow(), newItem->GetTemplate()->Name1.c_str(), newItem->GetEntry(), newItem->GetGUIDLow(), AH->auctioneer, newItem->GetCount(), bid, buyout, auctionTime, AH->GetHouseId()); sAuctionMgr->AddAItem(newItem); auctionHouse->AddAuction(AH); @@ -332,6 +332,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData) item2->DeleteFromInventoryDB(trans); item2->DeleteFromDB(trans); CharacterDatabase.CommitTransaction(trans); + delete item2; } else // Item stack count is bigger than required count, update item stack count and save to database - cloned item will be used for auction { @@ -363,7 +364,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData) //this function is called when client bids or buys out auction void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_AUCTION_PLACE_BID"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_PLACE_BID"); uint64 auctioneer; uint32 auctionId; @@ -377,7 +378,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData) Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER); if (!creature) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: HandleAuctionPlaceBid - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer))); + TC_LOG_DEBUG("network", "WORLD: HandleAuctionPlaceBid - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer))); return; } @@ -490,7 +491,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData) //this void is called when auction_owner cancels his auction void WorldSession::HandleAuctionRemoveItem(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_AUCTION_REMOVE_ITEM"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_REMOVE_ITEM"); uint64 auctioneer; uint32 auctionId; @@ -501,7 +502,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket& recvData) Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER); if (!creature) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: HandleAuctionRemoveItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer))); + TC_LOG_DEBUG("network", "WORLD: HandleAuctionRemoveItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer))); return; } @@ -537,7 +538,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket& recvData) } else { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Auction id: %u has non-existed item (item guid : %u)!!!", auction->Id, auction->itemGUIDLow); + TC_LOG_ERROR("network", "Auction id: %u has non-existed item (item guid : %u)!!!", auction->Id, auction->itemGUIDLow); SendAuctionCommandResult(0, AUCTION_CANCEL, ERR_AUCTION_DATABASE_ERROR); return; } @@ -546,7 +547,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket& recvData) { SendAuctionCommandResult(0, AUCTION_CANCEL, ERR_AUCTION_DATABASE_ERROR); //this code isn't possible ... maybe there should be assert - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "CHEATER : %u, he tried to cancel auction (id: %u) of another player, or auction is NULL", player->GetGUIDLow(), auctionId); + TC_LOG_ERROR("network", "CHEATER : %u, he tried to cancel auction (id: %u) of another player, or auction is NULL", player->GetGUIDLow(), auctionId); return; } @@ -567,7 +568,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket& recvData) //called when player lists his bids void WorldSession::HandleAuctionListBidderItems(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_AUCTION_LIST_BIDDER_ITEMS"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_LIST_BIDDER_ITEMS"); uint64 guid; //NPC guid uint32 listfrom; //page of auctions @@ -578,14 +579,14 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket& recvData) recvData >> outbiddedCount; if (recvData.size() != (16 + outbiddedCount * 4)) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Client sent bad opcode!!! with count: %u and size : %lu (must be: %u)", outbiddedCount, (unsigned long)recvData.size(), (16 + outbiddedCount * 4)); + TC_LOG_ERROR("network", "Client sent bad opcode!!! with count: %u and size : %lu (must be: %u)", outbiddedCount, (unsigned long)recvData.size(), (16 + outbiddedCount * 4)); outbiddedCount = 0; } Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER); if (!creature) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: HandleAuctionListBidderItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: HandleAuctionListBidderItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); recvData.rfinish(); return; } @@ -624,7 +625,7 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket& recvData) //this void sends player info about his auctions void WorldSession::HandleAuctionListOwnerItems(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_AUCTION_LIST_OWNER_ITEMS"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_LIST_OWNER_ITEMS"); uint32 listfrom; uint64 guid; @@ -635,7 +636,7 @@ void WorldSession::HandleAuctionListOwnerItems(WorldPacket& recvData) Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER); if (!creature) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: HandleAuctionListOwnerItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: HandleAuctionListOwnerItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); return; } @@ -661,7 +662,7 @@ void WorldSession::HandleAuctionListOwnerItems(WorldPacket& recvData) //this void is called when player clicks on search button void WorldSession::HandleAuctionListItems(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_AUCTION_LIST_ITEMS"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_LIST_ITEMS"); std::string searchedname; uint8 levelmin, levelmax, usable; @@ -690,7 +691,7 @@ void WorldSession::HandleAuctionListItems(WorldPacket& recvData) Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER); if (!creature) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: HandleAuctionListItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: HandleAuctionListItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); return; } @@ -728,7 +729,7 @@ void WorldSession::HandleAuctionListItems(WorldPacket& recvData) void WorldSession::HandleAuctionListPendingSales(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_AUCTION_LIST_PENDING_SALES"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_LIST_PENDING_SALES"); recvData.read_skip<uint64>(); diff --git a/src/server/game/Handlers/BattleGroundHandler.cpp b/src/server/game/Handlers/BattleGroundHandler.cpp index db96c50347c..a88c2e146a1 100644 --- a/src/server/game/Handlers/BattleGroundHandler.cpp +++ b/src/server/game/Handlers/BattleGroundHandler.cpp @@ -39,7 +39,7 @@ void WorldSession::HandleBattlemasterHelloOpcode(WorldPacket& recvData) { uint64 guid; recvData >> guid; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_BATTLEMASTER_HELLO Message from (GUID: %u TypeId:%u)", GUID_LOPART(guid), GuidHigh2TypeId(GUID_HIPART(guid))); + TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_BATTLEMASTER_HELLO Message from (GUID: %u TypeId:%u)", GUID_LOPART(guid), GuidHigh2TypeId(GUID_HIPART(guid))); Creature* unit = GetPlayer()->GetMap()->GetCreature(guid); if (!unit) @@ -86,7 +86,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recvData) if (!sBattlemasterListStore.LookupEntry(bgTypeId_)) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Battleground: invalid bgtype (%u) received. possible cheater? player guid %u", bgTypeId_, _player->GetGUIDLow()); + TC_LOG_ERROR("network", "Battleground: invalid bgtype (%u) received. possible cheater? player guid %u", bgTypeId_, _player->GetGUIDLow()); return; } @@ -98,7 +98,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recvData) BattlegroundTypeId bgTypeId = BattlegroundTypeId(bgTypeId_); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_BATTLEMASTER_JOIN Message from (GUID: %u TypeId:%u)", GUID_LOPART(guid), GuidHigh2TypeId(GUID_HIPART(guid))); + TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_BATTLEMASTER_JOIN Message from (GUID: %u TypeId:%u)", GUID_LOPART(guid), GuidHigh2TypeId(GUID_HIPART(guid))); // can do this, since it's battleground, not arena BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(bgTypeId, 0); @@ -189,7 +189,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recvData) // send status packet (in queue) sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, ginfo->ArenaType, 0); SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "Battleground: player joined queue for bg queue type %u bg type %u: GUID %u, NAME %s", + TC_LOG_DEBUG("bg.battleground", "Battleground: player joined queue for bg queue type %u bg type %u: GUID %u, NAME %s", bgQueueTypeId, bgTypeId, _player->GetGUIDLow(), _player->GetName().c_str()); } else @@ -209,7 +209,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recvData) if (err > 0) { - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "Battleground: the following players are joining as group:"); + TC_LOG_DEBUG("bg.battleground", "Battleground: the following players are joining as group:"); ginfo = bgQueue.AddGroup(_player, grp, bgTypeId, bracketEntry, 0, false, isPremade, 0, 0); avgTime = bgQueue.GetAverageQueueWaitTime(ginfo, bracketEntry->GetBracketId()); } @@ -237,17 +237,17 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recvData) member->GetSession()->SendPacket(&data); sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, err); member->GetSession()->SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "Battleground: player joined queue for bg queue type %u bg type %u: GUID %u, NAME %s", + TC_LOG_DEBUG("bg.battleground", "Battleground: player joined queue for bg queue type %u bg type %u: GUID %u, NAME %s", bgQueueTypeId, bgTypeId, member->GetGUIDLow(), member->GetName().c_str()); } - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "Battleground: group end"); + TC_LOG_DEBUG("bg.battleground", "Battleground: group end"); } sBattlegroundMgr->ScheduleQueueUpdate(0, 0, bgQueueTypeId, bgTypeId, bracketEntry->GetBracketId()); } void WorldSession::HandleBattlegroundPlayerPositionsOpcode(WorldPacket& /*recvData*/) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Recvd MSG_BATTLEGROUND_PLAYER_POSITIONS Message"); + TC_LOG_DEBUG("network", "WORLD: Recvd MSG_BATTLEGROUND_PLAYER_POSITIONS Message"); Battleground* bg = _player->GetBattleground(); if (!bg) // can't be received if player not in battleground @@ -298,7 +298,7 @@ void WorldSession::HandleBattlegroundPlayerPositionsOpcode(WorldPacket& /*recvDa void WorldSession::HandlePVPLogDataOpcode(WorldPacket & /*recvData*/) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Recvd MSG_PVP_LOG_DATA Message"); + TC_LOG_DEBUG("network", "WORLD: Recvd MSG_PVP_LOG_DATA Message"); Battleground* bg = _player->GetBattleground(); if (!bg) @@ -312,12 +312,12 @@ void WorldSession::HandlePVPLogDataOpcode(WorldPacket & /*recvData*/) sBattlegroundMgr->BuildPvpLogDataPacket(&data, bg); SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent MSG_PVP_LOG_DATA Message"); + TC_LOG_DEBUG("network", "WORLD: Sent MSG_PVP_LOG_DATA Message"); } void WorldSession::HandleBattlefieldListOpcode(WorldPacket &recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_BATTLEFIELD_LIST Message"); + TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_BATTLEFIELD_LIST Message"); uint32 bgTypeId; recvData >> bgTypeId; // id from DBC @@ -331,7 +331,7 @@ void WorldSession::HandleBattlefieldListOpcode(WorldPacket &recvData) BattlemasterListEntry const* bl = sBattlemasterListStore.LookupEntry(bgTypeId); if (!bl) { - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "BattlegroundHandler: invalid bgtype (%u) with player (Name: %s, GUID: %u) received.", bgTypeId, _player->GetName().c_str(), _player->GetGUIDLow()); + TC_LOG_DEBUG("bg.battleground", "BattlegroundHandler: invalid bgtype (%u) with player (Name: %s, GUID: %u) received.", bgTypeId, _player->GetName().c_str(), _player->GetGUIDLow()); return; } @@ -351,14 +351,14 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recvData) recvData >> type >> unk2 >> bgTypeId_ >> unk >> action; if (!sBattlemasterListStore.LookupEntry(bgTypeId_)) { - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "CMSG_BATTLEFIELD_PORT %s ArenaType: %u, Unk: %u, BgType: %u, Action: %u. Invalid BgType!", + TC_LOG_DEBUG("bg.battleground", "CMSG_BATTLEFIELD_PORT %s ArenaType: %u, Unk: %u, BgType: %u, Action: %u. Invalid BgType!", GetPlayerInfo().c_str(), type, unk2, bgTypeId_, action); return; } if (!_player->InBattlegroundQueue()) { - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "CMSG_BATTLEFIELD_PORT %s ArenaType: %u, Unk: %u, BgType: %u, Action: %u. Player not in queue!", + TC_LOG_DEBUG("bg.battleground", "CMSG_BATTLEFIELD_PORT %s ArenaType: %u, Unk: %u, BgType: %u, Action: %u. Player not in queue!", GetPlayerInfo().c_str(), type, unk2, bgTypeId_, action); return; } @@ -371,14 +371,14 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recvData) GroupQueueInfo ginfo; if (!bgQueue.GetPlayerGroupInfoData(_player->GetGUID(), &ginfo)) { - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "CMSG_BATTLEFIELD_PORT %s ArenaType: %u, Unk: %u, BgType: %u, Action: %u. Player not in queue (No player Group Info)!", + TC_LOG_DEBUG("bg.battleground", "CMSG_BATTLEFIELD_PORT %s ArenaType: %u, Unk: %u, BgType: %u, Action: %u. Player not in queue (No player Group Info)!", GetPlayerInfo().c_str(), type, unk2, bgTypeId_, action); return; } // if action == 1, then instanceId is required if (!ginfo.IsInvitedToBGInstanceGUID && action == 1) { - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "CMSG_BATTLEFIELD_PORT %s ArenaType: %u, Unk: %u, BgType: %u, Action: %u. Player is not invited to any bg!", + TC_LOG_DEBUG("bg.battleground", "CMSG_BATTLEFIELD_PORT %s ArenaType: %u, Unk: %u, BgType: %u, Action: %u. Player is not invited to any bg!", GetPlayerInfo().c_str(), type, unk2, bgTypeId_, action); return; } @@ -388,7 +388,7 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recvData) { if (action) { - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "CMSG_BATTLEFIELD_PORT %s ArenaType: %u, Unk: %u, BgType: %u, Action: %u. Cant find BG with id %u!", + TC_LOG_DEBUG("bg.battleground", "CMSG_BATTLEFIELD_PORT %s ArenaType: %u, Unk: %u, BgType: %u, Action: %u. Cant find BG with id %u!", GetPlayerInfo().c_str(), type, unk2, bgTypeId_, action, ginfo.IsInvitedToBGInstanceGUID); return; } @@ -396,12 +396,12 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recvData) bg = sBattlegroundMgr->GetBattlegroundTemplate(bgTypeId); if (!bg) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "BattlegroundHandler: bg_template not found for type id %u.", bgTypeId); + TC_LOG_ERROR("network", "BattlegroundHandler: bg_template not found for type id %u.", bgTypeId); return; } } - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "CMSG_BATTLEFIELD_PORT %s ArenaType: %u, Unk: %u, BgType: %u, Action: %u.", + TC_LOG_DEBUG("bg.battleground", "CMSG_BATTLEFIELD_PORT %s ArenaType: %u, Unk: %u, BgType: %u, Action: %u.", GetPlayerInfo().c_str(), type, unk2, bgTypeId_, action); // expected bracket entry @@ -420,12 +420,12 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recvData) sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data2, ERR_GROUP_JOIN_BATTLEGROUND_DESERTERS); _player->GetSession()->SendPacket(&data2); action = 0; - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "Player %s (%u) has a deserter debuff, do not port him to battleground!", _player->GetName().c_str(), _player->GetGUIDLow()); + TC_LOG_DEBUG("bg.battleground", "Player %s (%u) has a deserter debuff, do not port him to battleground!", _player->GetName().c_str(), _player->GetGUIDLow()); } //if player don't match battleground max level, then do not allow him to enter! (this might happen when player leveled up during his waiting in queue if (_player->getLevel() > bg->GetMaxLevel()) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Player %s (%u) has level (%u) higher than maxlevel (%u) of battleground (%u)! Do not port him to battleground!", + TC_LOG_ERROR("network", "Player %s (%u) has level (%u) higher than maxlevel (%u) of battleground (%u)! Do not port him to battleground!", _player->GetName().c_str(), _player->GetGUIDLow(), _player->getLevel(), bg->GetMaxLevel(), bg->GetTypeID()); action = 0; } @@ -472,7 +472,7 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recvData) sBattlegroundMgr->SendToBattleground(_player, ginfo.IsInvitedToBGInstanceGUID, bgTypeId); // add only in HandleMoveWorldPortAck() // bg->AddPlayer(_player, team); - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "Battleground: player %s (%u) joined battle for bg %u, bgtype %u, queue type %u.", _player->GetName().c_str(), _player->GetGUIDLow(), bg->GetInstanceID(), bg->GetTypeID(), bgQueueTypeId); + TC_LOG_DEBUG("bg.battleground", "Battleground: player %s (%u) joined battle for bg %u, bgtype %u, queue type %u.", _player->GetName().c_str(), _player->GetGUIDLow(), bg->GetInstanceID(), bg->GetTypeID(), bgQueueTypeId); } else // leave queue { @@ -485,7 +485,7 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recvData) ArenaTeam* at = sArenaTeamMgr->GetArenaTeamById(ginfo.Team); if (at) { - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "UPDATING memberLost's personal arena rating for %u by opponents rating: %u, because he has left queue!", GUID_LOPART(_player->GetGUID()), ginfo.OpponentsTeamRating); + TC_LOG_DEBUG("bg.battleground", "UPDATING memberLost's personal arena rating for %u by opponents rating: %u, because he has left queue!", GUID_LOPART(_player->GetGUID()), ginfo.OpponentsTeamRating); at->MemberLost(_player, ginfo.OpponentsMatchmakerRating); at->SaveToDB(); } @@ -497,13 +497,13 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recvData) if (!ginfo.ArenaType) sBattlegroundMgr->ScheduleQueueUpdate(ginfo.ArenaMatchmakerRating, ginfo.ArenaType, bgQueueTypeId, bgTypeId, bracketEntry->GetBracketId()); SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "Battleground: player %s (%u) left queue for bgtype %u, queue type %u.", _player->GetName().c_str(), _player->GetGUIDLow(), bg->GetTypeID(), bgQueueTypeId); + TC_LOG_DEBUG("bg.battleground", "Battleground: player %s (%u) left queue for bgtype %u, queue type %u.", _player->GetName().c_str(), _player->GetGUIDLow(), bg->GetTypeID(), bgQueueTypeId); } } void WorldSession::HandleBattlefieldLeaveOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_LEAVE_BATTLEFIELD Message"); + TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_LEAVE_BATTLEFIELD Message"); recvData.read_skip<uint8>(); // unk1 recvData.read_skip<uint8>(); // unk2 @@ -522,7 +522,7 @@ void WorldSession::HandleBattlefieldLeaveOpcode(WorldPacket& recvData) void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket & /*recvData*/) { // empty opcode - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Battleground status"); + TC_LOG_DEBUG("network", "WORLD: Battleground status"); WorldPacket data; // we must update all queues here @@ -585,7 +585,7 @@ void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket & /*recvData*/) void WorldSession::HandleBattlemasterJoinArena(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_BATTLEMASTER_JOIN_ARENA"); + TC_LOG_DEBUG("network", "WORLD: CMSG_BATTLEMASTER_JOIN_ARENA"); uint64 guid; // arena Battlemaster guid uint8 arenaslot; // 2v2, 3v3 or 5v5 @@ -622,7 +622,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket& recvData) arenatype = ARENA_TYPE_5v5; break; default: - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Unknown arena slot %u at HandleBattlemasterJoinArena()", arenaslot); + TC_LOG_ERROR("network", "Unknown arena slot %u at HandleBattlemasterJoinArena()", arenaslot); return; } @@ -630,7 +630,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket& recvData) Battleground* bg = sBattlegroundMgr->GetBattlegroundTemplate(BATTLEGROUND_AA); if (!bg) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Battleground: template bg (all arenas) not found"); + TC_LOG_ERROR("network", "Battleground: template bg (all arenas) not found"); return; } @@ -697,10 +697,10 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket& recvData) if (err > 0) { - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "Battleground: arena join as group start"); + TC_LOG_DEBUG("bg.battleground", "Battleground: arena join as group start"); if (isRated) { - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "Battleground: arena team id %u, leader %s queued with matchmaker rating %u for type %u", _player->GetArenaTeamId(arenaslot), _player->GetName().c_str(), matchmakerRating, arenatype); + TC_LOG_DEBUG("bg.battleground", "Battleground: arena team id %u, leader %s queued with matchmaker rating %u for type %u", _player->GetArenaTeamId(arenaslot), _player->GetName().c_str(), matchmakerRating, arenatype); bg->SetRated(true); } else @@ -733,7 +733,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket& recvData) member->GetSession()->SendPacket(&data); sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, err); member->GetSession()->SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "Battleground: player joined queue for arena as group bg queue type %u bg type %u: GUID %u, NAME %s", bgQueueTypeId, bgTypeId, member->GetGUIDLow(), member->GetName().c_str()); + TC_LOG_DEBUG("bg.battleground", "Battleground: player joined queue for arena as group bg queue type %u bg type %u: GUID %u, NAME %s", bgQueueTypeId, bgTypeId, member->GetGUIDLow(), member->GetName().c_str()); } } else @@ -746,7 +746,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket& recvData) // send status packet (in queue) sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, arenatype, 0); SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "Battleground: player joined queue for arena, skirmish, bg queue type %u bg type %u: GUID %u, NAME %s", bgQueueTypeId, bgTypeId, _player->GetGUIDLow(), _player->GetName().c_str()); + TC_LOG_DEBUG("bg.battleground", "Battleground: player joined queue for arena, skirmish, bg queue type %u bg type %u: GUID %u, NAME %s", bgQueueTypeId, bgTypeId, _player->GetGUIDLow(), _player->GetName().c_str()); } sBattlegroundMgr->ScheduleQueueUpdate(matchmakerRating, arenatype, bgQueueTypeId, bgTypeId, bracketEntry->GetBracketId()); } @@ -759,11 +759,11 @@ void WorldSession::HandleReportPvPAFK(WorldPacket& recvData) if (!reportedPlayer) { - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "WorldSession::HandleReportPvPAFK: player not found"); + TC_LOG_DEBUG("bg.battleground", "WorldSession::HandleReportPvPAFK: player not found"); return; } - TC_LOG_DEBUG(LOG_FILTER_BATTLEGROUND, "WorldSession::HandleReportPvPAFK: %s reported %s", _player->GetName().c_str(), reportedPlayer->GetName().c_str()); + TC_LOG_DEBUG("bg.battleground", "WorldSession::HandleReportPvPAFK: %s reported %s", _player->GetName().c_str(), reportedPlayer->GetName().c_str()); reportedPlayer->ReportedAfkBy(_player); } diff --git a/src/server/game/Handlers/BattlefieldHandler.cpp b/src/server/game/Handlers/BattlefieldHandler.cpp index 11e7789f275..c81822152d8 100644 --- a/src/server/game/Handlers/BattlefieldHandler.cpp +++ b/src/server/game/Handlers/BattlefieldHandler.cpp @@ -101,7 +101,7 @@ void WorldSession::HandleBfQueueInviteResponse(WorldPacket & recvData) uint8 Accepted; recvData >> BattleId >> Accepted; - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "HandleQueueInviteResponse: BattleID:%u Accepted:%u", BattleId, Accepted); + TC_LOG_DEBUG("misc", "HandleQueueInviteResponse: BattleID:%u Accepted:%u", BattleId, Accepted); Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BattleId); if (!Bf) return; @@ -119,7 +119,7 @@ void WorldSession::HandleBfEntryInviteResponse(WorldPacket & recvData) uint8 Accepted; recvData >> BattleId >> Accepted; - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "HandleBattlefieldInviteResponse: BattleID:%u Accepted:%u", BattleId, Accepted); + TC_LOG_DEBUG("misc", "HandleBattlefieldInviteResponse: BattleID:%u Accepted:%u", BattleId, Accepted); Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BattleId); if (!Bf) return; @@ -141,7 +141,7 @@ void WorldSession::HandleBfExitRequest(WorldPacket & recvData) uint32 BattleId; recvData >> BattleId; - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "HandleBfExitRequest: BattleID:%u ", BattleId); + TC_LOG_DEBUG("misc", "HandleBfExitRequest: BattleID:%u ", BattleId); Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BattleId); if (!Bf) return; diff --git a/src/server/game/Handlers/CalendarHandler.cpp b/src/server/game/Handlers/CalendarHandler.cpp index c1756311bc1..b5887ea7c00 100644 --- a/src/server/game/Handlers/CalendarHandler.cpp +++ b/src/server/game/Handlers/CalendarHandler.cpp @@ -51,7 +51,7 @@ Copied events should probably have a new owner void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/) { uint64 guid = _player->GetGUID(); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_GET_CALENDAR [" UI64FMTD "]", guid); + TC_LOG_DEBUG("network", "CMSG_CALENDAR_GET_CALENDAR [" UI64FMTD "]", guid); time_t currTime = time(NULL); @@ -180,7 +180,7 @@ void WorldSession::HandleCalendarGetEvent(WorldPacket& recvData) uint64 eventId; recvData >> eventId; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_GET_EVENT. Player [" + TC_LOG_DEBUG("network", "CMSG_CALENDAR_GET_EVENT. Player [" UI64FMTD "] Event [" UI64FMTD "]", _player->GetGUID(), eventId); if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId)) @@ -191,7 +191,7 @@ void WorldSession::HandleCalendarGetEvent(WorldPacket& recvData) void WorldSession::HandleCalendarGuildFilter(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_GUILD_FILTER [" UI64FMTD "]", _player->GetGUID()); + TC_LOG_DEBUG("network", "CMSG_CALENDAR_GUILD_FILTER [" UI64FMTD "]", _player->GetGUID()); uint32 minLevel; uint32 maxLevel; @@ -202,12 +202,12 @@ void WorldSession::HandleCalendarGuildFilter(WorldPacket& recvData) if (Guild* guild = sGuildMgr->GetGuildById(_player->GetGuildId())) guild->MassInviteToEvent(this, minLevel, maxLevel, minRank); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_GUILD_FILTER: Min level [%d], Max level [%d], Min rank [%d]", minLevel, maxLevel, minRank); + TC_LOG_DEBUG("network", "CMSG_CALENDAR_GUILD_FILTER: Min level [%d], Max level [%d], Min rank [%d]", minLevel, maxLevel, minRank); } void WorldSession::HandleCalendarArenaTeam(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_ARENA_TEAM [" UI64FMTD "]", _player->GetGUID()); + TC_LOG_DEBUG("network", "CMSG_CALENDAR_ARENA_TEAM [" UI64FMTD "]", _player->GetGUID()); uint32 arenaTeamId; recvData >> arenaTeamId; @@ -292,7 +292,7 @@ void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recvData) recvData.ReadPackedTime(timeZoneTime); recvData >> flags; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_UPDATE_EVENT [" UI64FMTD "] EventId [" UI64FMTD + TC_LOG_DEBUG("network", "CMSG_CALENDAR_UPDATE_EVENT [" UI64FMTD "] EventId [" UI64FMTD "], InviteId [" UI64FMTD "] Title %s, Description %s, type %u " "Repeatable %u, MaxInvites %u, Dungeon ID %d, Time %u " "Time2 %u, Flags %u", guid, eventId, inviteId, title.c_str(), @@ -338,7 +338,7 @@ void WorldSession::HandleCalendarCopyEvent(WorldPacket& recvData) recvData >> eventId >> inviteId; recvData.ReadPackedTime(time); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_COPY_EVENT [" UI64FMTD "], EventId [" UI64FMTD + TC_LOG_DEBUG("network", "CMSG_CALENDAR_COPY_EVENT [" UI64FMTD "], EventId [" UI64FMTD "] inviteId [" UI64FMTD "] Time: %u", guid, eventId, inviteId, time); if (CalendarEvent* oldEvent = sCalendarMgr->GetEvent(eventId)) @@ -360,7 +360,7 @@ void WorldSession::HandleCalendarCopyEvent(WorldPacket& recvData) void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_EVENT_INVITE"); + TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_INVITE"); uint64 playerGuid = _player->GetGUID(); @@ -458,7 +458,7 @@ void WorldSession::HandleCalendarEventSignup(WorldPacket& recvData) bool tentative; recvData >> eventId >> tentative; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_EVENT_SIGNUP [" UI64FMTD "] EventId [" UI64FMTD "] Tentative %u", guid, eventId, tentative); + TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_SIGNUP [" UI64FMTD "] EventId [" UI64FMTD "] Tentative %u", guid, eventId, tentative); if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId)) { @@ -485,7 +485,7 @@ void WorldSession::HandleCalendarEventRsvp(WorldPacket& recvData) uint32 status; recvData >> eventId >> inviteId >> status; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_EVENT_RSVP [" UI64FMTD "] EventId [" + TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_RSVP [" UI64FMTD "] EventId [" UI64FMTD "], InviteId [" UI64FMTD "], status %u", guid, eventId, inviteId, status); @@ -525,7 +525,7 @@ void WorldSession::HandleCalendarEventRemoveInvite(WorldPacket& recvData) recvData.readPackGUID(invitee); recvData >> inviteId >> ownerInviteId >> eventId; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_EVENT_REMOVE_INVITE [" + TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_REMOVE_INVITE [" UI64FMTD "] EventId [" UI64FMTD "], ownerInviteId [" UI64FMTD "], Invitee ([" UI64FMTD "] id: [" UI64FMTD "])", guid, eventId, ownerInviteId, invitee, inviteId); @@ -555,7 +555,7 @@ void WorldSession::HandleCalendarEventStatus(WorldPacket& recvData) recvData.readPackGUID(invitee); recvData >> eventId >> inviteId >> ownerInviteId >> status; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_EVENT_STATUS [" UI64FMTD"] EventId [" + TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_STATUS [" UI64FMTD"] EventId [" UI64FMTD "] ownerInviteId [" UI64FMTD "], Invitee ([" UI64FMTD "] id: [" UI64FMTD "], status %u", guid, eventId, ownerInviteId, invitee, inviteId, status); @@ -589,7 +589,7 @@ void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket& recvData) recvData.readPackGUID(invitee); recvData >> eventId >> inviteId >> ownerInviteId >> rank; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_EVENT_MODERATOR_STATUS [" UI64FMTD "] EventId [" + TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_MODERATOR_STATUS [" UI64FMTD "] EventId [" UI64FMTD "] ownerInviteId [" UI64FMTD "], Invitee ([" UI64FMTD "] id: [" UI64FMTD "], rank %u", guid, eventId, ownerInviteId, invitee, inviteId, rank); @@ -615,7 +615,7 @@ void WorldSession::HandleCalendarComplain(WorldPacket& recvData) uint64 complainGUID; recvData >> eventId >> complainGUID; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_COMPLAIN [" UI64FMTD "] EventId [" + TC_LOG_DEBUG("network", "CMSG_CALENDAR_COMPLAIN [" UI64FMTD "] EventId [" UI64FMTD "] guid [" UI64FMTD "]", guid, eventId, complainGUID); // what to do with complains? @@ -626,7 +626,7 @@ void WorldSession::HandleCalendarGetNumPending(WorldPacket& /*recvData*/) uint64 guid = _player->GetGUID(); uint32 pending = sCalendarMgr->GetPlayerNumPending(guid); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_GET_NUM_PENDING: [" UI64FMTD + TC_LOG_DEBUG("network", "CMSG_CALENDAR_GET_NUM_PENDING: [" UI64FMTD "] Pending: %u", guid, pending); WorldPacket data(SMSG_CALENDAR_SEND_NUM_PENDING, 4); @@ -639,7 +639,7 @@ void WorldSession::HandleSetSavedInstanceExtend(WorldPacket& recvData) uint32 mapId, difficulty; uint8 toggleExtend; recvData >> mapId >> difficulty>> toggleExtend; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_SET_SAVED_INSTANCE_EXTEND - MapId: %u, Difficulty: %u, ToggleExtend: %s", mapId, difficulty, toggleExtend ? "On" : "Off"); + TC_LOG_DEBUG("network", "CMSG_SET_SAVED_INSTANCE_EXTEND - MapId: %u, Difficulty: %u, ToggleExtend: %s", mapId, difficulty, toggleExtend ? "On" : "Off"); /* InstancePlayerBind* instanceBind = _player->GetBoundInstance(mapId, Difficulty(difficulty)); @@ -656,7 +656,7 @@ void WorldSession::HandleSetSavedInstanceExtend(WorldPacket& recvData) void WorldSession::SendCalendarRaidLockout(InstanceSave const* save, bool add) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "%s", add ? "SMSG_CALENDAR_RAID_LOCKOUT_ADDED" : "SMSG_CALENDAR_RAID_LOCKOUT_REMOVED"); + TC_LOG_DEBUG("network", "%s", add ? "SMSG_CALENDAR_RAID_LOCKOUT_ADDED" : "SMSG_CALENDAR_RAID_LOCKOUT_REMOVED"); time_t currTime = time(NULL); WorldPacket data(SMSG_CALENDAR_RAID_LOCKOUT_REMOVED, (add ? 4 : 0) + 4 + 4 + 4 + 8); @@ -679,7 +679,7 @@ void WorldSession::SendCalendarRaidLockoutUpdated(InstanceSave const* save) return; uint64 guid = _player->GetGUID(); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_RAID_LOCKOUT_UPDATED [" UI64FMTD + TC_LOG_DEBUG("network", "SMSG_CALENDAR_RAID_LOCKOUT_UPDATED [" UI64FMTD "] Map: %u, Difficulty %u", guid, save->GetMapId(), save->GetDifficulty()); time_t currTime = time(NULL); diff --git a/src/server/game/Handlers/ChannelHandler.cpp b/src/server/game/Handlers/ChannelHandler.cpp index 1ac1e5c78ac..12f6b52bf0a 100644 --- a/src/server/game/Handlers/ChannelHandler.cpp +++ b/src/server/game/Handlers/ChannelHandler.cpp @@ -28,7 +28,7 @@ void WorldSession::HandleJoinChannel(WorldPacket& recvPacket) recvPacket >> channelId >> unknown1 >> unknown2 >> channelName >> password; - TC_LOG_DEBUG(LOG_FILTER_CHATSYS, "CMSG_JOIN_CHANNEL %s Channel: %u, unk1: %u, unk2: %u, channel: %s, password: %s", + TC_LOG_DEBUG("chat.system", "CMSG_JOIN_CHANNEL %s Channel: %u, unk1: %u, unk2: %u, channel: %s, password: %s", GetPlayerInfo().c_str(), channelId, unknown1, unknown2, channelName.c_str(), password.c_str()); if (channelId) @@ -59,7 +59,7 @@ void WorldSession::HandleLeaveChannel(WorldPacket& recvPacket) std::string channelName; recvPacket >> unk >> channelName; - TC_LOG_DEBUG(LOG_FILTER_CHATSYS, "CMSG_LEAVE_CHANNEL %s Channel: %s, unk1: %u", + TC_LOG_DEBUG("chat.system", "CMSG_LEAVE_CHANNEL %s Channel: %s, unk1: %u", GetPlayerInfo().c_str(), channelName.c_str(), unk); if (channelName.empty()) @@ -78,7 +78,7 @@ void WorldSession::HandleChannelList(WorldPacket& recvPacket) std::string channelName; recvPacket >> channelName; - TC_LOG_DEBUG(LOG_FILTER_CHATSYS, "%s %s Channel: %s", + TC_LOG_DEBUG("chat.system", "%s %s Channel: %s", recvPacket.GetOpcode() == CMSG_CHANNEL_DISPLAY_LIST ? "CMSG_CHANNEL_DISPLAY_LIST" : "CMSG_CHANNEL_LIST", GetPlayerInfo().c_str(), channelName.c_str()); @@ -92,7 +92,7 @@ void WorldSession::HandleChannelPassword(WorldPacket& recvPacket) std::string channelName, password; recvPacket >> channelName >> password; - TC_LOG_DEBUG(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_PASSWORD %s Channel: %s, Password: %s", + TC_LOG_DEBUG("chat.system", "CMSG_CHANNEL_PASSWORD %s Channel: %s, Password: %s", GetPlayerInfo().c_str(), channelName.c_str(), password.c_str()); if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam())) @@ -105,7 +105,7 @@ void WorldSession::HandleChannelSetOwner(WorldPacket& recvPacket) std::string channelName, targetName; recvPacket >> channelName >> targetName; - TC_LOG_DEBUG(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_SET_OWNER %s Channel: %s, Target: %s", + TC_LOG_DEBUG("chat.system", "CMSG_CHANNEL_SET_OWNER %s Channel: %s, Target: %s", GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str()); if (!normalizePlayerName(targetName)) @@ -121,7 +121,7 @@ void WorldSession::HandleChannelOwner(WorldPacket& recvPacket) std::string channelName; recvPacket >> channelName; - TC_LOG_DEBUG(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_OWNER %s Channel: %s", + TC_LOG_DEBUG("chat.system", "CMSG_CHANNEL_OWNER %s Channel: %s", GetPlayerInfo().c_str(), channelName.c_str()); if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam())) @@ -134,7 +134,7 @@ void WorldSession::HandleChannelModerator(WorldPacket& recvPacket) std::string channelName, targetName; recvPacket >> channelName >> targetName; - TC_LOG_DEBUG(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_MODERATOR %s Channel: %s, Target: %s", + TC_LOG_DEBUG("chat.system", "CMSG_CHANNEL_MODERATOR %s Channel: %s, Target: %s", GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str()); if (!normalizePlayerName(targetName)) @@ -150,7 +150,7 @@ void WorldSession::HandleChannelUnmoderator(WorldPacket& recvPacket) std::string channelName, targetName; recvPacket >> channelName >> targetName; - TC_LOG_DEBUG(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_UNMODERATOR %s Channel: %s, Target: %s", + TC_LOG_DEBUG("chat.system", "CMSG_CHANNEL_UNMODERATOR %s Channel: %s, Target: %s", GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str()); if (!normalizePlayerName(targetName)) @@ -166,7 +166,7 @@ void WorldSession::HandleChannelMute(WorldPacket& recvPacket) std::string channelName, targetName; recvPacket >> channelName >> targetName; - TC_LOG_DEBUG(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_MUTE %s Channel: %s, Target: %s", + TC_LOG_DEBUG("chat.system", "CMSG_CHANNEL_MUTE %s Channel: %s, Target: %s", GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str()); if (!normalizePlayerName(targetName)) @@ -182,7 +182,7 @@ void WorldSession::HandleChannelUnmute(WorldPacket& recvPacket) std::string channelName, targetName; recvPacket >> channelName >> targetName; - TC_LOG_DEBUG(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_UNMUTE %s Channel: %s, Target: %s", + TC_LOG_DEBUG("chat.system", "CMSG_CHANNEL_UNMUTE %s Channel: %s, Target: %s", GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str()); if (!normalizePlayerName(targetName)) @@ -198,7 +198,7 @@ void WorldSession::HandleChannelInvite(WorldPacket& recvPacket) std::string channelName, targetName; recvPacket >> channelName >> targetName; - TC_LOG_DEBUG(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_INVITE %s Channel: %s, Target: %s", + TC_LOG_DEBUG("chat.system", "CMSG_CHANNEL_INVITE %s Channel: %s, Target: %s", GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str()); if (!normalizePlayerName(targetName)) @@ -214,7 +214,7 @@ void WorldSession::HandleChannelKick(WorldPacket& recvPacket) std::string channelName, targetName; recvPacket >> channelName >> targetName; - TC_LOG_DEBUG(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_KICK %s Channel: %s, Target: %s", + TC_LOG_DEBUG("chat.system", "CMSG_CHANNEL_KICK %s Channel: %s, Target: %s", GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str()); if (!normalizePlayerName(targetName)) @@ -230,7 +230,7 @@ void WorldSession::HandleChannelBan(WorldPacket& recvPacket) std::string channelName, targetName; recvPacket >> channelName >> targetName; - TC_LOG_DEBUG(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_BAN %s Channel: %s, Target: %s", + TC_LOG_DEBUG("chat.system", "CMSG_CHANNEL_BAN %s Channel: %s, Target: %s", GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str()); if (!normalizePlayerName(targetName)) @@ -246,7 +246,7 @@ void WorldSession::HandleChannelUnban(WorldPacket& recvPacket) std::string channelName, targetName; recvPacket >> channelName >> targetName; - TC_LOG_DEBUG(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_UNBAN %s Channel: %s, Target: %s", + TC_LOG_DEBUG("chat.system", "CMSG_CHANNEL_UNBAN %s Channel: %s, Target: %s", GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str()); if (!normalizePlayerName(targetName)) @@ -262,7 +262,7 @@ void WorldSession::HandleChannelAnnouncements(WorldPacket& recvPacket) std::string channelName; recvPacket >> channelName; - TC_LOG_DEBUG(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_ANNOUNCEMENTS %s Channel: %s", + TC_LOG_DEBUG("chat.system", "CMSG_CHANNEL_ANNOUNCEMENTS %s Channel: %s", GetPlayerInfo().c_str(), channelName.c_str()); if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam())) @@ -281,14 +281,14 @@ void WorldSession::HandleGetChannelMemberCount(WorldPacket &recvPacket) std::string channelName; recvPacket >> channelName; - TC_LOG_DEBUG(LOG_FILTER_CHATSYS, "CMSG_GET_CHANNEL_MEMBER_COUNT %s Channel: %s", + TC_LOG_DEBUG("chat.system", "CMSG_GET_CHANNEL_MEMBER_COUNT %s Channel: %s", GetPlayerInfo().c_str(), channelName.c_str()); if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam())) { if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer())) { - TC_LOG_DEBUG(LOG_FILTER_CHATSYS, "SMSG_CHANNEL_MEMBER_COUNT %s Channel: %s Count: %u", + TC_LOG_DEBUG("chat.system", "SMSG_CHANNEL_MEMBER_COUNT %s Channel: %s Count: %u", GetPlayerInfo().c_str(), channelName.c_str(), channel->GetNumPlayers()); WorldPacket data(SMSG_CHANNEL_MEMBER_COUNT, channel->GetName().size() + 1 + 4); @@ -305,7 +305,7 @@ void WorldSession::HandleSetChannelWatch(WorldPacket &recvPacket) std::string channelName; recvPacket >> channelName; - TC_LOG_DEBUG(LOG_FILTER_CHATSYS, "CMSG_SET_CHANNEL_WATCH %s Channel: %s", + TC_LOG_DEBUG("chat.system", "CMSG_SET_CHANNEL_WATCH %s Channel: %s", GetPlayerInfo().c_str(), channelName.c_str()); /* diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index f079d6af261..25164b82936 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -221,7 +221,7 @@ void WorldSession::HandleCharEnum(PreparedQueryResult result) do { uint32 guidlow = (*result)[0].GetUInt32(); - TC_LOG_INFO(LOG_FILTER_NETWORKIO, "Loading char guid %u from account %u.", guidlow, GetAccountId()); + TC_LOG_INFO("network", "Loading char guid %u from account %u.", guidlow, GetAccountId()); if (Player::BuildEnumData(result, &data)) { // Do not allow banned characters to log in @@ -310,7 +310,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData) { data << uint8(CHAR_CREATE_FAILED); SendPacket(&data); - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Class (%u) not found in DBC while creating new char for account (ID: %u): wrong DBC files or cheater?", class_, GetAccountId()); + TC_LOG_ERROR("network", "Class (%u) not found in DBC while creating new char for account (ID: %u): wrong DBC files or cheater?", class_, GetAccountId()); return; } @@ -319,7 +319,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData) { data << uint8(CHAR_CREATE_FAILED); SendPacket(&data); - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Race (%u) not found in DBC while creating new char for account (ID: %u): wrong DBC files or cheater?", race_, GetAccountId()); + TC_LOG_ERROR("network", "Race (%u) not found in DBC while creating new char for account (ID: %u): wrong DBC files or cheater?", race_, GetAccountId()); return; } @@ -327,7 +327,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData) if (raceEntry->expansion > Expansion()) { data << uint8(CHAR_CREATE_EXPANSION); - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Expansion %u account:[%d] tried to Create character with expansion %u race (%u)", Expansion(), GetAccountId(), raceEntry->expansion, race_); + TC_LOG_ERROR("network", "Expansion %u account:[%d] tried to Create character with expansion %u race (%u)", Expansion(), GetAccountId(), raceEntry->expansion, race_); SendPacket(&data); return; } @@ -336,7 +336,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData) if (classEntry->expansion > Expansion()) { data << uint8(CHAR_CREATE_EXPANSION_CLASS); - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Expansion %u account:[%d] tried to Create character with expansion %u class (%u)", Expansion(), GetAccountId(), classEntry->expansion, class_); + TC_LOG_ERROR("network", "Expansion %u account:[%d] tried to Create character with expansion %u class (%u)", Expansion(), GetAccountId(), classEntry->expansion, class_); SendPacket(&data); return; } @@ -368,7 +368,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData) { data << uint8(CHAR_NAME_NO_NAME); SendPacket(&data); - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Account:[%d] but tried to Create character with empty [name] ", GetAccountId()); + TC_LOG_ERROR("network", "Account:[%d] but tried to Create character with empty [name] ", GetAccountId()); return; } @@ -635,7 +635,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte { uint8 unk; createInfo->Data >> unk; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Character creation %s (account %u) has unhandled tail data: [%u]", createInfo->Name.c_str(), GetAccountId(), unk); + TC_LOG_DEBUG("network", "Character creation %s (account %u) has unhandled tail data: [%u]", createInfo->Name.c_str(), GetAccountId(), unk); } Player newChar(this); @@ -683,7 +683,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte AntiDOS.AllowOpcode(CMSG_CHAR_ENUM, true); std::string IP_str = GetRemoteAddress(); - TC_LOG_INFO(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow()); + TC_LOG_INFO("entities.player.character", "Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow()); sScriptMgr->OnPlayerCreate(&newChar); sWorld->AddCharacterNameData(newChar.GetGUIDLow(), newChar.GetName(), newChar.getGender(), newChar.getRace(), newChar.getClass(), newChar.getLevel()); @@ -742,10 +742,10 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket& recvData) return; std::string IP_str = GetRemoteAddress(); - TC_LOG_INFO(LOG_FILTER_CHARACTER, "Account: %d, IP: %s deleted character: %s, GUID: %u, Level: %u", accountId, IP_str.c_str(), name.c_str(), GUID_LOPART(guid), level); + TC_LOG_INFO("entities.player.character", "Account: %d, IP: %s deleted character: %s, GUID: %u, Level: %u", accountId, IP_str.c_str(), name.c_str(), GUID_LOPART(guid), level); sScriptMgr->OnPlayerDelete(guid); - if (sLog->ShouldLog(LOG_FILTER_PLAYER_DUMP, LOG_LEVEL_INFO)) // optimize GetPlayerDump call + if (sLog->ShouldLog("entities.player.dump", LOG_LEVEL_INFO)) // optimize GetPlayerDump call { std::string dump; if (PlayerDumpWriter().GetDump(GUID_LOPART(guid), dump)) @@ -766,20 +766,20 @@ void WorldSession::HandlePlayerLoginOpcode(WorldPacket& recvData) { if (PlayerLoading() || GetPlayer() != NULL) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Player tryes to login again, AccountId = %d", GetAccountId()); + TC_LOG_ERROR("network", "Player tryes to login again, AccountId = %d", GetAccountId()); return; } m_playerLoading = true; uint64 playerGuid = 0; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Recvd Player Logon Message"); + TC_LOG_DEBUG("network", "WORLD: Recvd Player Logon Message"); recvData >> playerGuid; if (!IsLegitCharacterForAccount(GUID_LOPART(playerGuid))) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Account (%u) can't login with that character (%u).", GetAccountId(), GUID_LOPART(playerGuid)); + TC_LOG_ERROR("network", "Account (%u) can't login with that character (%u).", GetAccountId(), GUID_LOPART(playerGuid)); KickPlayer(); return; } @@ -863,13 +863,13 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder) data.put(0, linecount); SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent motd (SMSG_MOTD)"); + TC_LOG_DEBUG("network", "WORLD: Sent motd (SMSG_MOTD)"); // send server info if (sWorld->getIntConfig(CONFIG_ENABLE_SINFO_LOGIN) == 1) chH.PSendSysMessage(_FULLVERSION); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent server info"); + TC_LOG_DEBUG("network", "WORLD: Sent server info"); } //QueryResult* result = CharacterDatabase.PQuery("SELECT guildid, rank FROM guild_member WHERE guid = '%u'", pCurrChar->GetGUIDLow()); @@ -892,7 +892,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder) else { // remove wrong guild data - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Player %s (GUID: %u) marked as member of not existing guild (id: %u), removing guild membership for player.", pCurrChar->GetName().c_str(), pCurrChar->GetGUIDLow(), pCurrChar->GetGuildId()); + TC_LOG_ERROR("network", "Player %s (GUID: %u) marked as member of not existing guild (id: %u), removing guild membership for player.", pCurrChar->GetName().c_str(), pCurrChar->GetGUIDLow(), pCurrChar->GetGuildId()); pCurrChar->SetInGuild(0); } } @@ -1019,7 +1019,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder) SendNotification(LANG_GM_ON); std::string IP_str = GetRemoteAddress(); - TC_LOG_INFO(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Login Character:[%s] (GUID: %u) Level: %d", + TC_LOG_INFO("entities.player.character", "Account: %d (IP: %s) Login Character:[%s] (GUID: %u) Level: %d", GetAccountId(), IP_str.c_str(), pCurrChar->GetName().c_str(), pCurrChar->GetGUIDLow(), pCurrChar->getLevel()); if (!pCurrChar->IsStandState() && !pCurrChar->HasUnitState(UNIT_STATE_STUNNED)) @@ -1033,7 +1033,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder) void WorldSession::HandleSetFactionAtWar(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_SET_FACTION_ATWAR"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_SET_FACTION_ATWAR"); uint32 repListID; uint8 flag; @@ -1047,7 +1047,7 @@ void WorldSession::HandleSetFactionAtWar(WorldPacket& recvData) //I think this function is never used :/ I dunno, but i guess this opcode not exists void WorldSession::HandleSetFactionCheat(WorldPacket & /*recvData*/) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "WORLD SESSION: HandleSetFactionCheat, not expected call, please report."); + TC_LOG_ERROR("network", "WORLD SESSION: HandleSetFactionCheat, not expected call, please report."); GetPlayer()->GetReputationMgr().SendStates(); } @@ -1081,7 +1081,7 @@ void WorldSession::HandleTutorialReset(WorldPacket & /*recvData*/) void WorldSession::HandleSetWatchedFactionOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_SET_WATCHED_FACTION"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_SET_WATCHED_FACTION"); uint32 fact; recvData >> fact; GetPlayer()->SetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, fact); @@ -1089,7 +1089,7 @@ void WorldSession::HandleSetWatchedFactionOpcode(WorldPacket& recvData) void WorldSession::HandleSetFactionInactiveOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_SET_FACTION_INACTIVE"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_SET_FACTION_INACTIVE"); uint32 replistid; uint8 inactive; recvData >> replistid >> inactive; @@ -1099,14 +1099,14 @@ void WorldSession::HandleSetFactionInactiveOpcode(WorldPacket& recvData) void WorldSession::HandleShowingHelmOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_SHOWING_HELM for %s", _player->GetName().c_str()); + TC_LOG_DEBUG("network", "CMSG_SHOWING_HELM for %s", _player->GetName().c_str()); recvData.read_skip<uint8>(); // unknown, bool? _player->ToggleFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_HELM); } void WorldSession::HandleShowingCloakOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_SHOWING_CLOAK for %s", _player->GetName().c_str()); + TC_LOG_DEBUG("network", "CMSG_SHOWING_CLOAK for %s", _player->GetName().c_str()); recvData.read_skip<uint8>(); // unknown, bool? _player->ToggleFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_CLOAK); } @@ -1197,7 +1197,7 @@ void WorldSession::HandleChangePlayerNameOpcodeCallBack(PreparedQueryResult resu CharacterDatabase.Execute(stmt); - TC_LOG_INFO(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Character:[%s] (guid:%u) Changed name to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldName.c_str(), guidLow, newName.c_str()); + TC_LOG_INFO("entities.player.character", "Account: %d (IP: %s) Character:[%s] (guid:%u) Changed name to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldName.c_str(), guidLow, newName.c_str()); WorldPacket data(SMSG_CHAR_RENAME, 1+8+(newName.size()+1)); data << uint8(RESPONSE_SUCCESS); @@ -1307,7 +1307,7 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recvData) void WorldSession::HandleAlterAppearance(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_ALTER_APPEARANCE"); + TC_LOG_DEBUG("network", "CMSG_ALTER_APPEARANCE"); uint32 Hair, Color, FacialHair, SkinColor; recvData >> Hair >> Color >> FacialHair >> SkinColor; @@ -1384,7 +1384,7 @@ void WorldSession::HandleRemoveGlyph(WorldPacket& recvData) if (slot >= MAX_GLYPH_SLOT_INDEX) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Client sent wrong glyph slot number in opcode CMSG_REMOVE_GLYPH %u", slot); + TC_LOG_DEBUG("network", "Client sent wrong glyph slot number in opcode CMSG_REMOVE_GLYPH %u", slot); return; } @@ -1407,7 +1407,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData) recvData >> guid; if (!IsLegitCharacterForAccount(GUID_LOPART(guid))) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Account %u, IP: %s tried to customise character %u, but it does not belong to their account!", + TC_LOG_ERROR("network", "Account %u, IP: %s tried to customise character %u, but it does not belong to their account!", GetAccountId(), GetRemoteAddress().c_str(), GUID_LOPART(guid)); recvData.rfinish(); KickPlayer(); @@ -1492,7 +1492,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData) if (result) { std::string oldname = result->Fetch()[0].GetString(); - TC_LOG_INFO(LOG_FILTER_CHARACTER, "Account: %d (IP: %s), Character[%s] (guid:%u) Customized to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldname.c_str(), GUID_LOPART(guid), newName.c_str()); + TC_LOG_INFO("entities.player.character", "Account: %d (IP: %s), Character[%s] (guid:%u) Customized to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldname.c_str(), GUID_LOPART(guid), newName.c_str()); } Player::Customize(guid, gender, skin, face, hairStyle, hairColor, facialHair); @@ -1528,7 +1528,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData) void WorldSession::HandleEquipmentSetSave(WorldPacket &recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_EQUIPMENT_SET_SAVE"); + TC_LOG_DEBUG("network", "CMSG_EQUIPMENT_SET_SAVE"); uint64 setGuid; recvData.readPackGUID(setGuid); @@ -1580,7 +1580,7 @@ void WorldSession::HandleEquipmentSetSave(WorldPacket &recvData) void WorldSession::HandleEquipmentSetDelete(WorldPacket &recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_EQUIPMENT_SET_DELETE"); + TC_LOG_DEBUG("network", "CMSG_EQUIPMENT_SET_DELETE"); uint64 setGuid; recvData.readPackGUID(setGuid); @@ -1593,7 +1593,7 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recvData) if (_player->IsInCombat()) return; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_EQUIPMENT_SET_USE"); + TC_LOG_DEBUG("network", "CMSG_EQUIPMENT_SET_USE"); for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i) { @@ -1603,7 +1603,7 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recvData) uint8 srcbag, srcslot; recvData >> srcbag >> srcslot; - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "Item " UI64FMTD ": srcbag %u, srcslot %u", itemGuid, srcbag, srcslot); + TC_LOG_DEBUG("entities.player.items", "Item " UI64FMTD ": srcbag %u, srcslot %u", itemGuid, srcbag, srcslot); // check if item slot is set to "ignored" (raw value == 1), must not be unequipped then if (itemGuid == 1) @@ -1652,7 +1652,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData) if (!IsLegitCharacterForAccount(GUID_LOPART(guid))) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Account %u, IP: %s tried to factionchange character %u, but it does not belong to their account!", + TC_LOG_ERROR("network", "Account %u, IP: %s tried to factionchange character %u, but it does not belong to their account!", GetAccountId(), GetRemoteAddress().c_str(), GUID_LOPART(guid)); recvData.rfinish(); KickPlayer(); @@ -2176,7 +2176,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData) CharacterDatabase.CommitTransaction(trans); std::string IP_str = GetRemoteAddress(); - TC_LOG_DEBUG(LOG_FILTER_PLAYER, "%s (IP: %s) changed race from %u to %u", GetPlayerInfo().c_str(), IP_str.c_str(), oldRace, race); + TC_LOG_DEBUG("entities.player", "%s (IP: %s) changed race from %u to %u", GetPlayerInfo().c_str(), IP_str.c_str(), oldRace, race); WorldPacket data(SMSG_CHAR_FACTION_CHANGE, 1 + 8 + (newname.size() + 1) + 1 + 1 + 1 + 1 + 1 + 1 + 1); data << uint8(RESPONSE_SUCCESS); diff --git a/src/server/game/Handlers/ChatHandler.cpp b/src/server/game/Handlers/ChatHandler.cpp index 35f1bbbdb56..bea3fc76cf2 100644 --- a/src/server/game/Handlers/ChatHandler.cpp +++ b/src/server/game/Handlers/ChatHandler.cpp @@ -50,7 +50,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData) if (type >= MAX_CHAT_MSG_TYPE) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "CHAT: Wrong message type received: %u", type); + TC_LOG_ERROR("network", "CHAT: Wrong message type received: %u", type); recvData.rfinish(); return; } @@ -114,7 +114,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData) return; break; default: - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Player %s (GUID: %u) sent a chatmessage with an invalid language/message type combination", + TC_LOG_ERROR("network", "Player %s (GUID: %u) sent a chatmessage with an invalid language/message type combination", GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow()); recvData.rfinish(); @@ -225,7 +225,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData) if (sWorld->getIntConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_SEVERITY) && !ChatHandler(this).isValidChatMessage(msg.c_str())) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Player %s (GUID: %u) sent a chatmessage with an invalid link: %s", GetPlayer()->GetName().c_str(), + TC_LOG_ERROR("network", "Player %s (GUID: %u) sent a chatmessage with an invalid link: %s", GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow(), msg.c_str()); if (sWorld->getIntConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_KICK)) @@ -481,7 +481,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData) break; } default: - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "CHAT: unknown message type %u, lang: %u", type, lang); + TC_LOG_ERROR("network", "CHAT: unknown message type %u, lang: %u", type, lang); break; } } @@ -595,7 +595,7 @@ void WorldSession::HandleChatIgnoredOpcode(WorldPacket& recvData) { uint64 iguid; uint8 unk; - //TC_LOG_DEBUG(LOG_FILTER_PACKETIO, "WORLD: Received CMSG_CHAT_IGNORED"); + //TC_LOG_DEBUG("network", "WORLD: Received CMSG_CHAT_IGNORED"); recvData >> iguid; recvData >> unk; // probably related to spam reporting @@ -611,7 +611,7 @@ void WorldSession::HandleChatIgnoredOpcode(WorldPacket& recvData) void WorldSession::HandleChannelDeclineInvite(WorldPacket &recvPacket) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); + TC_LOG_DEBUG("network", "Opcode %u", recvPacket.GetOpcode()); } void WorldSession::SendPlayerNotFoundNotice(std::string const& name) diff --git a/src/server/game/Handlers/CombatHandler.cpp b/src/server/game/Handlers/CombatHandler.cpp index a326ba54baa..3c5bdfd1f58 100644 --- a/src/server/game/Handlers/CombatHandler.cpp +++ b/src/server/game/Handlers/CombatHandler.cpp @@ -33,7 +33,7 @@ void WorldSession::HandleAttackSwingOpcode(WorldPacket& recvData) uint64 guid; recvData >> guid; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_ATTACKSWING Message guidlow:%u guidhigh:%u", GUID_LOPART(guid), GUID_HIPART(guid)); + TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_ATTACKSWING Message guidlow:%u guidhigh:%u", GUID_LOPART(guid), GUID_HIPART(guid)); Unit* pEnemy = ObjectAccessor::GetUnit(*_player, guid); @@ -78,11 +78,11 @@ void WorldSession::HandleSetSheathedOpcode(WorldPacket& recvData) uint32 sheathed; recvData >> sheathed; - //TC_LOG_DEBUG(LOG_FILTER_PACKETIO, "WORLD: Recvd CMSG_SETSHEATHED Message guidlow:%u value1:%u", GetPlayer()->GetGUIDLow(), sheathed); + //TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_SETSHEATHED Message guidlow:%u value1:%u", GetPlayer()->GetGUIDLow(), sheathed); if (sheathed >= MAX_SHEATH_STATE) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Unknown sheath state %u ??", sheathed); + TC_LOG_ERROR("network", "Unknown sheath state %u ??", sheathed); return; } diff --git a/src/server/game/Handlers/DuelHandler.cpp b/src/server/game/Handlers/DuelHandler.cpp index bff1f20008b..01c2257c3dc 100644 --- a/src/server/game/Handlers/DuelHandler.cpp +++ b/src/server/game/Handlers/DuelHandler.cpp @@ -41,9 +41,9 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket) if (player == player->duel->initiator || !plTarget || player == plTarget || player->duel->startTime != 0 || plTarget->duel->startTime != 0) return; - //TC_LOG_DEBUG(LOG_FILTER_PACKETIO, "WORLD: Received CMSG_DUEL_ACCEPTED"); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Player 1 is: %u (%s)", player->GetGUIDLow(), player->GetName().c_str()); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Player 2 is: %u (%s)", plTarget->GetGUIDLow(), plTarget->GetName().c_str()); + //TC_LOG_DEBUG("network", "WORLD: Received CMSG_DUEL_ACCEPTED"); + TC_LOG_DEBUG("network", "Player 1 is: %u (%s)", player->GetGUIDLow(), player->GetName().c_str()); + TC_LOG_DEBUG("network", "Player 2 is: %u (%s)", plTarget->GetGUIDLow(), plTarget->GetName().c_str()); time_t now = time(NULL); player->duel->startTimer = now; @@ -55,7 +55,7 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket) void WorldSession::HandleDuelCancelledOpcode(WorldPacket& recvPacket) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_DUEL_CANCELLED"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_DUEL_CANCELLED"); uint64 guid; recvPacket >> guid; diff --git a/src/server/game/Handlers/GroupHandler.cpp b/src/server/game/Handlers/GroupHandler.cpp index 27ef4960f79..4333f4f75d4 100644 --- a/src/server/game/Handlers/GroupHandler.cpp +++ b/src/server/game/Handlers/GroupHandler.cpp @@ -59,7 +59,7 @@ void WorldSession::SendPartyResult(PartyOperation operation, const std::string& void WorldSession::HandleGroupInviteOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_INVITE"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_GROUP_INVITE"); std::string membername; recvData >> membername; @@ -198,7 +198,7 @@ void WorldSession::HandleGroupInviteOpcode(WorldPacket& recvData) void WorldSession::HandleGroupAcceptOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_ACCEPT"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_GROUP_ACCEPT"); recvData.read_skip<uint32>(); Group* group = GetPlayer()->GetGroupInvite(); @@ -211,7 +211,7 @@ void WorldSession::HandleGroupAcceptOpcode(WorldPacket& recvData) if (group->GetLeaderGUID() == GetPlayer()->GetGUID()) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "HandleGroupAcceptOpcode: player %s(%d) tried to accept an invite to his own group", GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow()); + TC_LOG_ERROR("network", "HandleGroupAcceptOpcode: player %s(%d) tried to accept an invite to his own group", GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow()); return; } @@ -250,7 +250,7 @@ void WorldSession::HandleGroupAcceptOpcode(WorldPacket& recvData) void WorldSession::HandleGroupDeclineOpcode(WorldPacket & /*recvData*/) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_DECLINE"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_GROUP_DECLINE"); Group* group = GetPlayer()->GetGroupInvite(); if (!group) @@ -273,7 +273,7 @@ void WorldSession::HandleGroupDeclineOpcode(WorldPacket & /*recvData*/) void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_UNINVITE_GUID"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_GROUP_UNINVITE_GUID"); uint64 guid; std::string reason; @@ -283,7 +283,7 @@ void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket& recvData) //can't uninvite yourself if (guid == GetPlayer()->GetGUID()) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "WorldSession::HandleGroupUninviteGuidOpcode: leader %s(%d) tried to uninvite himself from the group.", + TC_LOG_ERROR("network", "WorldSession::HandleGroupUninviteGuidOpcode: leader %s(%d) tried to uninvite himself from the group.", GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow()); return; } @@ -322,7 +322,7 @@ void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket& recvData) void WorldSession::HandleGroupUninviteOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_UNINVITE"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_GROUP_UNINVITE"); std::string membername; recvData >> membername; @@ -334,7 +334,7 @@ void WorldSession::HandleGroupUninviteOpcode(WorldPacket& recvData) // can't uninvite yourself if (GetPlayer()->GetName() == membername) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "WorldSession::HandleGroupUninviteOpcode: leader %s(%d) tried to uninvite himself from the group.", + TC_LOG_ERROR("network", "WorldSession::HandleGroupUninviteOpcode: leader %s(%d) tried to uninvite himself from the group.", GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow()); return; } @@ -367,7 +367,7 @@ void WorldSession::HandleGroupUninviteOpcode(WorldPacket& recvData) void WorldSession::HandleGroupSetLeaderOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_SET_LEADER"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_GROUP_SET_LEADER"); uint64 guid; recvData >> guid; @@ -388,7 +388,7 @@ void WorldSession::HandleGroupSetLeaderOpcode(WorldPacket& recvData) void WorldSession::HandleGroupDisbandOpcode(WorldPacket & /*recvData*/) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_DISBAND"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_GROUP_DISBAND"); Group* grp = GetPlayer()->GetGroup(); if (!grp) @@ -411,7 +411,7 @@ void WorldSession::HandleGroupDisbandOpcode(WorldPacket & /*recvData*/) void WorldSession::HandleLootMethodOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_LOOT_METHOD"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_LOOT_METHOD"); uint32 lootMethod; uint64 lootMaster; @@ -462,7 +462,7 @@ void WorldSession::HandleLootRoll(WorldPacket& recvData) void WorldSession::HandleMinimapPingOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received MSG_MINIMAP_PING"); + TC_LOG_DEBUG("network", "WORLD: Received MSG_MINIMAP_PING"); if (!GetPlayer()->GetGroup()) return; @@ -486,7 +486,7 @@ void WorldSession::HandleMinimapPingOpcode(WorldPacket& recvData) void WorldSession::HandleRandomRollOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received MSG_RANDOM_ROLL"); + TC_LOG_DEBUG("network", "WORLD: Received MSG_RANDOM_ROLL"); uint32 minimum, maximum, roll; recvData >> minimum; @@ -515,7 +515,7 @@ void WorldSession::HandleRandomRollOpcode(WorldPacket& recvData) void WorldSession::HandleRaidTargetUpdateOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received MSG_RAID_TARGET_UPDATE"); + TC_LOG_DEBUG("network", "WORLD: Received MSG_RAID_TARGET_UPDATE"); Group* group = GetPlayer()->GetGroup(); if (!group) @@ -545,7 +545,7 @@ void WorldSession::HandleRaidTargetUpdateOpcode(WorldPacket& recvData) void WorldSession::HandleGroupRaidConvertOpcode(WorldPacket & /*recvData*/) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_RAID_CONVERT"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_GROUP_RAID_CONVERT"); Group* group = GetPlayer()->GetGroup(); if (!group) @@ -566,7 +566,7 @@ void WorldSession::HandleGroupRaidConvertOpcode(WorldPacket & /*recvData*/) void WorldSession::HandleGroupChangeSubGroupOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_CHANGE_SUB_GROUP"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_GROUP_CHANGE_SUB_GROUP"); // we will get correct pointer for group here, so we don't have to check if group is BG raid Group* group = GetPlayer()->GetGroup(); @@ -605,7 +605,7 @@ void WorldSession::HandleGroupChangeSubGroupOpcode(WorldPacket& recvData) void WorldSession::HandleGroupAssistantLeaderOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_ASSISTANT_LEADER"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_GROUP_ASSISTANT_LEADER"); Group* group = GetPlayer()->GetGroup(); if (!group) @@ -626,7 +626,7 @@ void WorldSession::HandleGroupAssistantLeaderOpcode(WorldPacket& recvData) void WorldSession::HandlePartyAssignmentOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received MSG_PARTY_ASSIGNMENT"); + TC_LOG_DEBUG("network", "WORLD: Received MSG_PARTY_ASSIGNMENT"); Group* group = GetPlayer()->GetGroup(); if (!group) @@ -660,7 +660,7 @@ void WorldSession::HandlePartyAssignmentOpcode(WorldPacket& recvData) void WorldSession::HandleRaidReadyCheckOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received MSG_RAID_READY_CHECK"); + TC_LOG_DEBUG("network", "WORLD: Received MSG_RAID_READY_CHECK"); Group* group = GetPlayer()->GetGroup(); if (!group) @@ -893,7 +893,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player* player, WorldPacke /*this procedure handles clients CMSG_REQUEST_PARTY_MEMBER_STATS request*/ void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket &recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_REQUEST_PARTY_MEMBER_STATS"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_REQUEST_PARTY_MEMBER_STATS"); uint64 Guid; recvData >> Guid; @@ -1039,7 +1039,7 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket &recvData) void WorldSession::HandleOptOutOfLootOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_OPT_OUT_OF_LOOT"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_OPT_OUT_OF_LOOT"); uint32 passOnLoot; recvData >> passOnLoot; // 1 always pass, 0 do not pass @@ -1048,7 +1048,7 @@ void WorldSession::HandleOptOutOfLootOpcode(WorldPacket& recvData) if (!GetPlayer()) // needed because STATUS_AUTHED { if (passOnLoot != 0) - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "CMSG_OPT_OUT_OF_LOOT value<>0 for not-loaded character!"); + TC_LOG_ERROR("network", "CMSG_OPT_OUT_OF_LOOT value<>0 for not-loaded character!"); return; } diff --git a/src/server/game/Handlers/GuildHandler.cpp b/src/server/game/Handlers/GuildHandler.cpp index aa7c4b0b34a..96f1ce49d47 100644 --- a/src/server/game/Handlers/GuildHandler.cpp +++ b/src/server/game/Handlers/GuildHandler.cpp @@ -33,7 +33,7 @@ void WorldSession::HandleGuildQueryOpcode(WorldPacket& recvPacket) uint32 guildId; recvPacket >> guildId; - TC_LOG_DEBUG(LOG_FILTER_GUILD, "CMSG_GUILD_QUERY [%s]: Guild: %u", GetPlayerInfo().c_str(), guildId); + TC_LOG_DEBUG("guild", "CMSG_GUILD_QUERY [%s]: Guild: %u", GetPlayerInfo().c_str(), guildId); if (!guildId) return; @@ -43,7 +43,7 @@ void WorldSession::HandleGuildQueryOpcode(WorldPacket& recvPacket) void WorldSession::HandleGuildCreateOpcode(WorldPacket& recvPacket) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GUILD_CREATE"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_GUILD_CREATE"); std::string name; recvPacket >> name; @@ -63,7 +63,7 @@ void WorldSession::HandleGuildInviteOpcode(WorldPacket& recvPacket) std::string invitedName; recvPacket >> invitedName; - TC_LOG_DEBUG(LOG_FILTER_GUILD, "CMSG_GUILD_INVITE [%s]: Invited: %s", GetPlayerInfo().c_str(), invitedName.c_str()); + TC_LOG_DEBUG("guild", "CMSG_GUILD_INVITE [%s]: Invited: %s", GetPlayerInfo().c_str(), invitedName.c_str()); if (normalizePlayerName(invitedName)) if (Guild* guild = GetPlayer()->GetGuild()) guild->HandleInviteMember(this, invitedName); @@ -74,7 +74,7 @@ void WorldSession::HandleGuildRemoveOpcode(WorldPacket& recvPacket) std::string playerName; recvPacket >> playerName; - TC_LOG_DEBUG(LOG_FILTER_GUILD, "CMSG_GUILD_REMOVE [%s]: Target: %s", GetPlayerInfo().c_str(), playerName.c_str()); + TC_LOG_DEBUG("guild", "CMSG_GUILD_REMOVE [%s]: Target: %s", GetPlayerInfo().c_str(), playerName.c_str()); if (normalizePlayerName(playerName)) if (Guild* guild = GetPlayer()->GetGuild()) @@ -83,7 +83,7 @@ void WorldSession::HandleGuildRemoveOpcode(WorldPacket& recvPacket) void WorldSession::HandleGuildAcceptOpcode(WorldPacket& /*recvPacket*/) { - TC_LOG_DEBUG(LOG_FILTER_GUILD, "CMSG_GUILD_ACCEPT [%s]", GetPlayer()->GetName().c_str()); + TC_LOG_DEBUG("guild", "CMSG_GUILD_ACCEPT [%s]", GetPlayer()->GetName().c_str()); if (!GetPlayer()->GetGuildId()) if (Guild* guild = sGuildMgr->GetGuildById(GetPlayer()->GetGuildIdInvited())) @@ -92,7 +92,7 @@ void WorldSession::HandleGuildAcceptOpcode(WorldPacket& /*recvPacket*/) void WorldSession::HandleGuildDeclineOpcode(WorldPacket& /*recvPacket*/) { - TC_LOG_DEBUG(LOG_FILTER_GUILD, "CMSG_GUILD_DECLINE [%s]", GetPlayerInfo().c_str()); + TC_LOG_DEBUG("guild", "CMSG_GUILD_DECLINE [%s]", GetPlayerInfo().c_str()); GetPlayer()->SetGuildIdInvited(0); GetPlayer()->SetInGuild(0); @@ -100,7 +100,7 @@ void WorldSession::HandleGuildDeclineOpcode(WorldPacket& /*recvPacket*/) void WorldSession::HandleGuildInfoOpcode(WorldPacket& /*recvPacket*/) { - TC_LOG_DEBUG(LOG_FILTER_GUILD, "CMSG_GUILD_INFO [%s]", GetPlayerInfo().c_str()); + TC_LOG_DEBUG("guild", "CMSG_GUILD_INFO [%s]", GetPlayerInfo().c_str()); if (Guild* guild = GetPlayer()->GetGuild()) guild->SendInfo(this); @@ -108,7 +108,7 @@ void WorldSession::HandleGuildInfoOpcode(WorldPacket& /*recvPacket*/) void WorldSession::HandleGuildRosterOpcode(WorldPacket& /*recvPacket*/) { - TC_LOG_DEBUG(LOG_FILTER_GUILD, "CMSG_GUILD_ROSTER [%s]", GetPlayerInfo().c_str()); + TC_LOG_DEBUG("guild", "CMSG_GUILD_ROSTER [%s]", GetPlayerInfo().c_str()); if (Guild* guild = GetPlayer()->GetGuild()) guild->HandleRoster(this); @@ -121,7 +121,7 @@ void WorldSession::HandleGuildPromoteOpcode(WorldPacket& recvPacket) std::string playerName; recvPacket >> playerName; - TC_LOG_DEBUG(LOG_FILTER_GUILD, "CMSG_GUILD_PROMOTE [%s]: Target: %s", GetPlayerInfo().c_str(), playerName.c_str()); + TC_LOG_DEBUG("guild", "CMSG_GUILD_PROMOTE [%s]: Target: %s", GetPlayerInfo().c_str(), playerName.c_str()); if (normalizePlayerName(playerName)) if (Guild* guild = GetPlayer()->GetGuild()) @@ -133,7 +133,7 @@ void WorldSession::HandleGuildDemoteOpcode(WorldPacket& recvPacket) std::string playerName; recvPacket >> playerName; - TC_LOG_DEBUG(LOG_FILTER_GUILD, "CMSG_GUILD_DEMOTE [%s]: Target: %s", GetPlayerInfo().c_str(), playerName.c_str()); + TC_LOG_DEBUG("guild", "CMSG_GUILD_DEMOTE [%s]: Target: %s", GetPlayerInfo().c_str(), playerName.c_str()); if (normalizePlayerName(playerName)) if (Guild* guild = GetPlayer()->GetGuild()) @@ -142,7 +142,7 @@ void WorldSession::HandleGuildDemoteOpcode(WorldPacket& recvPacket) void WorldSession::HandleGuildLeaveOpcode(WorldPacket& /*recvPacket*/) { - TC_LOG_DEBUG(LOG_FILTER_GUILD, "CMSG_GUILD_LEAVE [%s]", GetPlayerInfo().c_str()); + TC_LOG_DEBUG("guild", "CMSG_GUILD_LEAVE [%s]", GetPlayerInfo().c_str()); if (Guild* guild = GetPlayer()->GetGuild()) guild->HandleLeaveMember(this); @@ -150,7 +150,7 @@ void WorldSession::HandleGuildLeaveOpcode(WorldPacket& /*recvPacket*/) void WorldSession::HandleGuildDisbandOpcode(WorldPacket& /*recvPacket*/) { - TC_LOG_DEBUG(LOG_FILTER_GUILD, "CMSG_GUILD_DISBAND [%s]", GetPlayerInfo().c_str()); + TC_LOG_DEBUG("guild", "CMSG_GUILD_DISBAND [%s]", GetPlayerInfo().c_str()); if (Guild* guild = GetPlayer()->GetGuild()) guild->HandleDisband(this); @@ -161,7 +161,7 @@ void WorldSession::HandleGuildLeaderOpcode(WorldPacket& recvPacket) std::string name; recvPacket >> name; - TC_LOG_DEBUG(LOG_FILTER_GUILD, "CMSG_GUILD_LEADER [%s]: Target: %s", GetPlayerInfo().c_str(), name.c_str()); + TC_LOG_DEBUG("guild", "CMSG_GUILD_LEADER [%s]: Target: %s", GetPlayerInfo().c_str(), name.c_str()); if (normalizePlayerName(name)) if (Guild* guild = GetPlayer()->GetGuild()) @@ -173,7 +173,7 @@ void WorldSession::HandleGuildMOTDOpcode(WorldPacket& recvPacket) std::string motd; recvPacket >> motd; - TC_LOG_DEBUG(LOG_FILTER_GUILD, "CMSG_GUILD_MOTD [%s]: MOTD: %s", GetPlayerInfo().c_str(), motd.c_str()); + TC_LOG_DEBUG("guild", "CMSG_GUILD_MOTD [%s]: MOTD: %s", GetPlayerInfo().c_str(), motd.c_str()); if (Guild* guild = GetPlayer()->GetGuild()) guild->HandleSetMOTD(this, motd); @@ -185,7 +185,7 @@ void WorldSession::HandleGuildSetPublicNoteOpcode(WorldPacket& recvPacket) std::string note; recvPacket >> playerName >> note; - TC_LOG_DEBUG(LOG_FILTER_GUILD, "CMSG_GUILD_SET_PUBLIC_NOTE [%s]: Target: %s, Note: %s", + TC_LOG_DEBUG("guild", "CMSG_GUILD_SET_PUBLIC_NOTE [%s]: Target: %s, Note: %s", GetPlayerInfo().c_str(), playerName.c_str(), note.c_str()); if (normalizePlayerName(playerName)) @@ -199,7 +199,7 @@ void WorldSession::HandleGuildSetOfficerNoteOpcode(WorldPacket& recvPacket) std::string note; recvPacket >> playerName >> note; - TC_LOG_DEBUG(LOG_FILTER_GUILD, "CMSG_GUILD_SET_OFFICER_NOTE [%s]: Target: %s, Note: %s", + TC_LOG_DEBUG("guild", "CMSG_GUILD_SET_OFFICER_NOTE [%s]: Target: %s, Note: %s", GetPlayerInfo().c_str(), playerName.c_str(), note.c_str()); if (normalizePlayerName(playerName)) @@ -221,7 +221,7 @@ void WorldSession::HandleGuildRankOpcode(WorldPacket& recvPacket) uint32 money; recvPacket >> money; - TC_LOG_DEBUG(LOG_FILTER_GUILD, "CMSG_GUILD_RANK [%s]: Rank: %s (%u)", GetPlayerInfo().c_str(), rankName.c_str(), rankId); + TC_LOG_DEBUG("guild", "CMSG_GUILD_RANK [%s]: Rank: %s (%u)", GetPlayerInfo().c_str(), rankName.c_str(), rankId); Guild* guild = GetPlayer()->GetGuild(); if (!guild) @@ -251,7 +251,7 @@ void WorldSession::HandleGuildAddRankOpcode(WorldPacket& recvPacket) std::string rankName; recvPacket >> rankName; - TC_LOG_DEBUG(LOG_FILTER_GUILD, "CMSG_GUILD_ADD_RANK [%s]: Rank: %s", GetPlayerInfo().c_str(), rankName.c_str()); + TC_LOG_DEBUG("guild", "CMSG_GUILD_ADD_RANK [%s]: Rank: %s", GetPlayerInfo().c_str(), rankName.c_str()); if (Guild* guild = GetPlayer()->GetGuild()) guild->HandleAddNewRank(this, rankName); @@ -259,7 +259,7 @@ void WorldSession::HandleGuildAddRankOpcode(WorldPacket& recvPacket) void WorldSession::HandleGuildDelRankOpcode(WorldPacket& /*recvPacket*/) { - TC_LOG_DEBUG(LOG_FILTER_GUILD, "CMSG_GUILD_DEL_RANK [%s]", GetPlayerInfo().c_str()); + TC_LOG_DEBUG("guild", "CMSG_GUILD_DEL_RANK [%s]", GetPlayerInfo().c_str()); if (Guild* guild = GetPlayer()->GetGuild()) guild->HandleRemoveLowestRank(this); @@ -270,7 +270,7 @@ void WorldSession::HandleGuildChangeInfoTextOpcode(WorldPacket& recvPacket) std::string info; recvPacket >> info; - TC_LOG_DEBUG(LOG_FILTER_GUILD, "CMSG_GUILD_INFO_TEXT [%s]: %s", GetPlayerInfo().c_str(), info.c_str()); + TC_LOG_DEBUG("guild", "CMSG_GUILD_INFO_TEXT [%s]: %s", GetPlayerInfo().c_str(), info.c_str()); if (Guild* guild = GetPlayer()->GetGuild()) guild->HandleSetInfo(this, info); @@ -284,7 +284,7 @@ void WorldSession::HandleSaveGuildEmblemOpcode(WorldPacket& recvPacket) EmblemInfo emblemInfo; emblemInfo.ReadPacket(recvPacket); - TC_LOG_DEBUG(LOG_FILTER_GUILD, "MSG_SAVE_GUILD_EMBLEM [%s]: Guid: [" UI64FMTD + TC_LOG_DEBUG("guild", "MSG_SAVE_GUILD_EMBLEM [%s]: Guid: [" UI64FMTD "] Style: %d, Color: %d, BorderStyle: %d, BorderColor: %d, BackgroundColor: %d" , GetPlayerInfo().c_str(), vendorGuid, emblemInfo.GetStyle() , emblemInfo.GetColor(), emblemInfo.GetBorderStyle() @@ -307,7 +307,7 @@ void WorldSession::HandleSaveGuildEmblemOpcode(WorldPacket& recvPacket) void WorldSession::HandleGuildEventLogQueryOpcode(WorldPacket& /* recvPacket */) { - TC_LOG_DEBUG(LOG_FILTER_GUILD, "MSG_GUILD_EVENT_LOG_QUERY [%s]", GetPlayerInfo().c_str()); + TC_LOG_DEBUG("guild", "MSG_GUILD_EVENT_LOG_QUERY [%s]", GetPlayerInfo().c_str()); if (Guild* guild = GetPlayer()->GetGuild()) guild->SendEventLog(this); @@ -315,7 +315,7 @@ void WorldSession::HandleGuildEventLogQueryOpcode(WorldPacket& /* recvPacket */) void WorldSession::HandleGuildBankMoneyWithdrawn(WorldPacket & /* recvData */) { - TC_LOG_DEBUG(LOG_FILTER_GUILD, "MSG_GUILD_BANK_MONEY_WITHDRAWN [%s]", GetPlayerInfo().c_str()); + TC_LOG_DEBUG("guild", "MSG_GUILD_BANK_MONEY_WITHDRAWN [%s]", GetPlayerInfo().c_str()); if (Guild* guild = GetPlayer()->GetGuild()) guild->SendMoneyInfo(this); @@ -323,7 +323,7 @@ void WorldSession::HandleGuildBankMoneyWithdrawn(WorldPacket & /* recvData */) void WorldSession::HandleGuildPermissions(WorldPacket& /* recvData */) { - TC_LOG_DEBUG(LOG_FILTER_GUILD, "MSG_GUILD_PERMISSIONS [%s]", GetPlayerInfo().c_str()); + TC_LOG_DEBUG("guild", "MSG_GUILD_PERMISSIONS [%s]", GetPlayerInfo().c_str()); if (Guild* guild = GetPlayer()->GetGuild()) guild->SendPermissions(this); @@ -336,7 +336,7 @@ void WorldSession::HandleGuildBankerActivate(WorldPacket& recvData) bool sendAllSlots; recvData >> guid >> sendAllSlots; - TC_LOG_DEBUG(LOG_FILTER_GUILD, "CMSG_GUILD_BANKER_ACTIVATE [%s]: Go: [" UI64FMTD "] AllSlots: %u" + TC_LOG_DEBUG("guild", "CMSG_GUILD_BANKER_ACTIVATE [%s]: Go: [" UI64FMTD "] AllSlots: %u" , GetPlayerInfo().c_str(), guid, sendAllSlots); Guild* const guild = GetPlayer()->GetGuild(); @@ -358,7 +358,7 @@ void WorldSession::HandleGuildBankQueryTab(WorldPacket& recvData) recvData >> guid >> tabId >> full; - TC_LOG_DEBUG(LOG_FILTER_GUILD, "CMSG_GUILD_BANK_QUERY_TAB [%s]: Go: [" UI64FMTD "], TabId: %u, ShowTabs: %u" + TC_LOG_DEBUG("guild", "CMSG_GUILD_BANK_QUERY_TAB [%s]: Go: [" UI64FMTD "], TabId: %u, ShowTabs: %u" , GetPlayerInfo().c_str(), guid, tabId, full); if (GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_GUILD_BANK)) @@ -372,7 +372,7 @@ void WorldSession::HandleGuildBankDepositMoney(WorldPacket& recvData) uint32 money; recvData >> guid >> money; - TC_LOG_DEBUG(LOG_FILTER_GUILD, "CMSG_GUILD_BANK_DEPOSIT_MONEY [%s]: Go: [" UI64FMTD "], money: %u", + TC_LOG_DEBUG("guild", "CMSG_GUILD_BANK_DEPOSIT_MONEY [%s]: Go: [" UI64FMTD "], money: %u", GetPlayerInfo().c_str(), guid, money); if (GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_GUILD_BANK)) @@ -387,7 +387,7 @@ void WorldSession::HandleGuildBankWithdrawMoney(WorldPacket& recvData) uint32 money; recvData >> guid >> money; - TC_LOG_DEBUG(LOG_FILTER_GUILD, "CMSG_GUILD_BANK_WITHDRAW_MONEY [%s]: Go: [" UI64FMTD "], money: %u", + TC_LOG_DEBUG("guild", "CMSG_GUILD_BANK_WITHDRAW_MONEY [%s]: Go: [" UI64FMTD "], money: %u", GetPlayerInfo().c_str(), guid, money); if (money && GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_GUILD_BANK)) @@ -397,7 +397,7 @@ void WorldSession::HandleGuildBankWithdrawMoney(WorldPacket& recvData) void WorldSession::HandleGuildBankSwapItems(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_GUILD, "CMSG_GUILD_BANK_SWAP_ITEMS [%s]", GetPlayerInfo().c_str()); + TC_LOG_DEBUG("guild", "CMSG_GUILD_BANK_SWAP_ITEMS [%s]", GetPlayerInfo().c_str()); uint64 GoGuid; recvData >> GoGuid; @@ -483,7 +483,7 @@ void WorldSession::HandleGuildBankBuyTab(WorldPacket& recvData) recvData >> guid >> tabId; - TC_LOG_DEBUG(LOG_FILTER_GUILD, "CMSG_GUILD_BANK_BUY_TAB [%s]: Go: [" UI64FMTD "], TabId: %u", GetPlayerInfo().c_str(), guid, tabId); + TC_LOG_DEBUG("guild", "CMSG_GUILD_BANK_BUY_TAB [%s]: Go: [" UI64FMTD "], TabId: %u", GetPlayerInfo().c_str(), guid, tabId); if (GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_GUILD_BANK)) @@ -499,7 +499,7 @@ void WorldSession::HandleGuildBankUpdateTab(WorldPacket& recvData) recvData >> guid >> tabId >> name >> icon; - TC_LOG_DEBUG(LOG_FILTER_GUILD, "CMSG_GUILD_BANK_UPDATE_TAB [%s]: Go: [" UI64FMTD "], TabId: %u, Name: %s, Icon: %s" + TC_LOG_DEBUG("guild", "CMSG_GUILD_BANK_UPDATE_TAB [%s]: Go: [" UI64FMTD "], TabId: %u, Name: %s, Icon: %s" , GetPlayerInfo().c_str(), guid, tabId, name.c_str(), icon.c_str()); if (!name.empty() && !icon.empty()) @@ -513,7 +513,7 @@ void WorldSession::HandleGuildBankLogQuery(WorldPacket& recvData) uint8 tabId; recvData >> tabId; - TC_LOG_DEBUG(LOG_FILTER_GUILD, "MSG_GUILD_BANK_LOG_QUERY [%s]: TabId: %u", GetPlayerInfo().c_str(), tabId); + TC_LOG_DEBUG("guild", "MSG_GUILD_BANK_LOG_QUERY [%s]: TabId: %u", GetPlayerInfo().c_str(), tabId); if (Guild* guild = GetPlayer()->GetGuild()) guild->SendBankLog(this, tabId); @@ -524,7 +524,7 @@ void WorldSession::HandleQueryGuildBankTabText(WorldPacket &recvData) uint8 tabId; recvData >> tabId; - TC_LOG_DEBUG(LOG_FILTER_GUILD, "MSG_QUERY_GUILD_BANK_TEXT [%s]: TabId: %u", GetPlayerInfo().c_str(), tabId); + TC_LOG_DEBUG("guild", "MSG_QUERY_GUILD_BANK_TEXT [%s]: TabId: %u", GetPlayerInfo().c_str(), tabId); if (Guild* guild = GetPlayer()->GetGuild()) guild->SendBankTabText(this, tabId); @@ -536,7 +536,7 @@ void WorldSession::HandleSetGuildBankTabText(WorldPacket &recvData) std::string text; recvData >> tabId >> text; - TC_LOG_DEBUG(LOG_FILTER_GUILD, "CMSG_SET_GUILD_BANK_TEXT [%s]: TabId: %u, Text: %s", GetPlayerInfo().c_str(), tabId, text.c_str()); + TC_LOG_DEBUG("guild", "CMSG_SET_GUILD_BANK_TEXT [%s]: TabId: %u, Text: %s", GetPlayerInfo().c_str(), tabId, text.c_str()); if (Guild* guild = GetPlayer()->GetGuild()) guild->SetBankTabText(tabId, text); diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp index d9727ea7ded..ad99c009a4f 100644 --- a/src/server/game/Handlers/ItemHandler.cpp +++ b/src/server/game/Handlers/ItemHandler.cpp @@ -30,7 +30,7 @@ void WorldSession::HandleSplitItemOpcode(WorldPacket& recvData) { - //TC_LOG_DEBUG(LOG_FILTER_PACKETIO, "WORLD: CMSG_SPLIT_ITEM"); + //TC_LOG_DEBUG("network", "WORLD: CMSG_SPLIT_ITEM"); uint8 srcbag, srcslot, dstbag, dstslot; uint32 count; @@ -63,7 +63,7 @@ void WorldSession::HandleSplitItemOpcode(WorldPacket& recvData) void WorldSession::HandleSwapInvItemOpcode(WorldPacket& recvData) { - //TC_LOG_DEBUG(LOG_FILTER_PACKETIO, "WORLD: CMSG_SWAP_INV_ITEM"); + //TC_LOG_DEBUG("network", "WORLD: CMSG_SWAP_INV_ITEM"); uint8 srcslot, dstslot; recvData >> dstslot >> srcslot; @@ -112,7 +112,7 @@ void WorldSession::HandleAutoEquipItemSlotOpcode(WorldPacket& recvData) void WorldSession::HandleSwapItem(WorldPacket& recvData) { - //TC_LOG_DEBUG(LOG_FILTER_PACKETIO, "WORLD: CMSG_SWAP_ITEM"); + //TC_LOG_DEBUG("network", "WORLD: CMSG_SWAP_ITEM"); uint8 dstbag, dstslot, srcbag, srcslot; recvData >> dstbag >> dstslot >> srcbag >> srcslot; @@ -142,7 +142,7 @@ void WorldSession::HandleSwapItem(WorldPacket& recvData) void WorldSession::HandleAutoEquipItemOpcode(WorldPacket& recvData) { - //TC_LOG_DEBUG(LOG_FILTER_PACKETIO, "WORLD: CMSG_AUTOEQUIP_ITEM"); + //TC_LOG_DEBUG("network", "WORLD: CMSG_AUTOEQUIP_ITEM"); uint8 srcbag, srcslot; recvData >> srcbag >> srcslot; @@ -236,7 +236,7 @@ void WorldSession::HandleAutoEquipItemOpcode(WorldPacket& recvData) void WorldSession::HandleDestroyItemOpcode(WorldPacket& recvData) { - //TC_LOG_DEBUG(LOG_FILTER_PACKETIO, "WORLD: CMSG_DESTROYITEM"); + //TC_LOG_DEBUG("network", "WORLD: CMSG_DESTROYITEM"); uint8 bag, slot, count, data1, data2, data3; recvData >> bag >> slot >> count >> data1 >> data2 >> data3; @@ -280,11 +280,11 @@ void WorldSession::HandleDestroyItemOpcode(WorldPacket& recvData) // Only _static_ data send in this packet !!! void WorldSession::HandleItemQuerySingleOpcode(WorldPacket& recvData) { - //TC_LOG_DEBUG(LOG_FILTER_PACKETIO, "WORLD: CMSG_ITEM_QUERY_SINGLE"); + //TC_LOG_DEBUG("network", "WORLD: CMSG_ITEM_QUERY_SINGLE"); uint32 item; recvData >> item; - TC_LOG_INFO(LOG_FILTER_NETWORKIO, "STORAGE: Item Query = %u", item); + TC_LOG_INFO("network", "STORAGE: Item Query = %u", item); ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item); if (pProto) @@ -430,7 +430,7 @@ void WorldSession::HandleItemQuerySingleOpcode(WorldPacket& recvData) } else { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_ITEM_QUERY_SINGLE - NO item INFO! (ENTRY: %u)", item); + TC_LOG_DEBUG("network", "WORLD: CMSG_ITEM_QUERY_SINGLE - NO item INFO! (ENTRY: %u)", item); WorldPacket data(SMSG_ITEM_QUERY_SINGLE_RESPONSE, 4); data << uint32(item | 0x80000000); SendPacket(&data); @@ -439,12 +439,12 @@ void WorldSession::HandleItemQuerySingleOpcode(WorldPacket& recvData) void WorldSession::HandleReadItem(WorldPacket& recvData) { - //TC_LOG_DEBUG(LOG_FILTER_PACKETIO, "WORLD: CMSG_READ_ITEM"); + //TC_LOG_DEBUG("network", "WORLD: CMSG_READ_ITEM"); uint8 bag, slot; recvData >> bag >> slot; - //TC_LOG_INFO(LOG_FILTER_NETWORKIO, "STORAGE: Read bag = %u, slot = %u", bag, slot); + //TC_LOG_INFO("network", "STORAGE: Read bag = %u, slot = %u", bag, slot); Item* pItem = _player->GetItemByPos(bag, slot); if (pItem && pItem->GetTemplate()->PageText) @@ -455,12 +455,12 @@ void WorldSession::HandleReadItem(WorldPacket& recvData) if (msg == EQUIP_ERR_OK) { data.Initialize (SMSG_READ_ITEM_OK, 8); - TC_LOG_INFO(LOG_FILTER_NETWORKIO, "STORAGE: Item page sent"); + TC_LOG_INFO("network", "STORAGE: Item page sent"); } else { data.Initialize(SMSG_READ_ITEM_FAILED, 8); - TC_LOG_INFO(LOG_FILTER_NETWORKIO, "STORAGE: Unable to read item"); + TC_LOG_INFO("network", "STORAGE: Unable to read item"); _player->SendEquipError(msg, pItem, NULL); } data << pItem->GetGUID(); @@ -472,20 +472,20 @@ void WorldSession::HandleReadItem(WorldPacket& recvData) void WorldSession::HandlePageQuerySkippedOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_PAGE_TEXT_QUERY"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_PAGE_TEXT_QUERY"); uint32 itemid; uint64 guid; recvData >> itemid >> guid; - TC_LOG_INFO(LOG_FILTER_NETWORKIO, "Packet Info: itemid: %u guidlow: %u guidentry: %u guidhigh: %u", + TC_LOG_INFO("network", "Packet Info: itemid: %u guidlow: %u guidentry: %u guidhigh: %u", itemid, GUID_LOPART(guid), GUID_ENPART(guid), GUID_HIPART(guid)); } void WorldSession::HandleSellItemOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_SELL_ITEM"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_SELL_ITEM"); uint64 vendorguid, itemguid; uint32 count; @@ -497,7 +497,7 @@ void WorldSession::HandleSellItemOpcode(WorldPacket& recvData) Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR); if (!creature) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: HandleSellItemOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(vendorguid))); + TC_LOG_DEBUG("network", "WORLD: HandleSellItemOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(vendorguid))); _player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, NULL, itemguid, 0); return; } @@ -559,7 +559,7 @@ void WorldSession::HandleSellItemOpcode(WorldPacket& recvData) Item* pNewItem = pItem->CloneItem(count, _player); if (!pNewItem) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "WORLD: HandleSellItemOpcode - could not create clone of item %u; count = %u", pItem->GetEntry(), count); + TC_LOG_ERROR("network", "WORLD: HandleSellItemOpcode - could not create clone of item %u; count = %u", pItem->GetEntry(), count); _player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, itemguid, 0); return; } @@ -597,7 +597,7 @@ void WorldSession::HandleSellItemOpcode(WorldPacket& recvData) void WorldSession::HandleBuybackItem(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_BUYBACK_ITEM"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_BUYBACK_ITEM"); uint64 vendorguid; uint32 slot; @@ -606,7 +606,7 @@ void WorldSession::HandleBuybackItem(WorldPacket& recvData) Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR); if (!creature) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: HandleBuybackItem - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(vendorguid))); + TC_LOG_DEBUG("network", "WORLD: HandleBuybackItem - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(vendorguid))); _player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, NULL, 0, 0); return; } @@ -645,7 +645,7 @@ void WorldSession::HandleBuybackItem(WorldPacket& recvData) void WorldSession::HandleBuyItemInSlotOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_BUY_ITEM_IN_SLOT"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_BUY_ITEM_IN_SLOT"); uint64 vendorguid, bagguid; uint32 item, slot, count; uint8 bagslot; @@ -687,7 +687,7 @@ void WorldSession::HandleBuyItemInSlotOpcode(WorldPacket& recvData) void WorldSession::HandleBuyItemOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_BUY_ITEM"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_BUY_ITEM"); uint64 vendorguid; uint32 item, slot, count; uint8 unk1; @@ -712,19 +712,19 @@ void WorldSession::HandleListInventoryOpcode(WorldPacket& recvData) if (!GetPlayer()->IsAlive()) return; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_LIST_INVENTORY"); + TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_LIST_INVENTORY"); SendListInventory(guid); } void WorldSession::SendListInventory(uint64 vendorGuid) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_LIST_INVENTORY"); + TC_LOG_DEBUG("network", "WORLD: Sent SMSG_LIST_INVENTORY"); Creature* vendor = GetPlayer()->GetNPCIfCanInteractWith(vendorGuid, UNIT_NPC_FLAG_VENDOR); if (!vendor) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: SendListInventory - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(vendorGuid))); + TC_LOG_DEBUG("network", "WORLD: SendListInventory - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(vendorGuid))); _player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, NULL, 0, 0); return; } @@ -780,7 +780,7 @@ void WorldSession::SendListInventory(uint64 vendorGuid) ConditionList conditions = sConditionMgr->GetConditionsForNpcVendorEvent(vendor->GetEntry(), item->item); if (!sConditionMgr->IsObjectMeetToConditions(_player, vendor, conditions)) { - TC_LOG_DEBUG(LOG_FILTER_CONDITIONSYS, "SendListInventory: conditions not met for creature entry %u item %u", vendor->GetEntry(), item->item); + TC_LOG_DEBUG("condition", "SendListInventory: conditions not met for creature entry %u item %u", vendor->GetEntry(), item->item); continue; } @@ -815,7 +815,7 @@ void WorldSession::SendListInventory(uint64 vendorGuid) void WorldSession::HandleAutoStoreBagItemOpcode(WorldPacket& recvData) { - //TC_LOG_DEBUG(LOG_FILTER_PACKETIO, "WORLD: CMSG_AUTOSTORE_BAG_ITEM"); + //TC_LOG_DEBUG("network", "WORLD: CMSG_AUTOSTORE_BAG_ITEM"); uint8 srcbag, srcslot, dstbag; recvData >> srcbag >> srcslot >> dstbag; @@ -866,7 +866,7 @@ void WorldSession::HandleAutoStoreBagItemOpcode(WorldPacket& recvData) void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_BUY_BANK_SLOT"); + TC_LOG_DEBUG("network", "WORLD: CMSG_BUY_BANK_SLOT"); uint64 guid; recvPacket >> guid; @@ -886,7 +886,7 @@ void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket) // next slot ++slot; - TC_LOG_INFO(LOG_FILTER_NETWORKIO, "PLAYER: Buy bank bag slot, slot number = %u", slot); + TC_LOG_INFO("network", "PLAYER: Buy bank bag slot, slot number = %u", slot); BankBagSlotPricesEntry const* slotEntry = sBankBagSlotPricesStore.LookupEntry(slot); @@ -919,11 +919,11 @@ void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket) void WorldSession::HandleAutoBankItemOpcode(WorldPacket& recvPacket) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AUTOBANK_ITEM"); + TC_LOG_DEBUG("network", "WORLD: CMSG_AUTOBANK_ITEM"); uint8 srcbag, srcslot; recvPacket >> srcbag >> srcslot; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "STORAGE: receive srcbag = %u, srcslot = %u", srcbag, srcslot); + TC_LOG_DEBUG("network", "STORAGE: receive srcbag = %u, srcslot = %u", srcbag, srcslot); Item* pItem = _player->GetItemByPos(srcbag, srcslot); if (!pItem) @@ -950,11 +950,11 @@ void WorldSession::HandleAutoBankItemOpcode(WorldPacket& recvPacket) void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AUTOSTORE_BANK_ITEM"); + TC_LOG_DEBUG("network", "WORLD: CMSG_AUTOSTORE_BANK_ITEM"); uint8 srcbag, srcslot; recvPacket >> srcbag >> srcslot; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "STORAGE: receive srcbag = %u, srcslot = %u", srcbag, srcslot); + TC_LOG_DEBUG("network", "STORAGE: receive srcbag = %u, srcslot = %u", srcbag, srcslot); Item* pItem = _player->GetItemByPos(srcbag, srcslot); if (!pItem) @@ -997,7 +997,7 @@ void WorldSession::HandleSetAmmoOpcode(WorldPacket& recvData) return; } - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_SET_AMMO"); + TC_LOG_DEBUG("network", "WORLD: CMSG_SET_AMMO"); uint32 item; recvData >> item; @@ -1035,7 +1035,7 @@ void WorldSession::HandleItemNameQueryOpcode(WorldPacket& recvData) recvData >> itemid; recvData.read_skip<uint64>(); // guid - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_ITEM_NAME_QUERY %u", itemid); + TC_LOG_DEBUG("network", "WORLD: CMSG_ITEM_NAME_QUERY %u", itemid); ItemSetNameEntry const* pName = sObjectMgr->GetItemSetNameEntry(itemid); if (pName) { @@ -1055,14 +1055,14 @@ void WorldSession::HandleItemNameQueryOpcode(WorldPacket& recvData) void WorldSession::HandleWrapItemOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Received opcode CMSG_WRAP_ITEM"); + TC_LOG_DEBUG("network", "Received opcode CMSG_WRAP_ITEM"); uint8 gift_bag, gift_slot, item_bag, item_slot; recvData >> gift_bag >> gift_slot; // paper recvData >> item_bag >> item_slot; // item - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WRAP: receive gift_bag = %u, gift_slot = %u, item_bag = %u, item_slot = %u", gift_bag, gift_slot, item_bag, item_slot); + TC_LOG_DEBUG("network", "WRAP: receive gift_bag = %u, gift_slot = %u, item_bag = %u, item_slot = %u", gift_bag, gift_slot, item_bag, item_slot); Item* gift = _player->GetItemByPos(gift_bag, gift_slot); if (!gift) @@ -1166,7 +1166,7 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recvData) void WorldSession::HandleSocketOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_SOCKET_GEMS"); + TC_LOG_DEBUG("network", "WORLD: CMSG_SOCKET_GEMS"); uint64 item_guid; uint64 gem_guids[MAX_GEM_SOCKETS]; @@ -1362,7 +1362,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recvData) void WorldSession::HandleCancelTempEnchantmentOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CANCEL_TEMP_ENCHANTMENT"); + TC_LOG_DEBUG("network", "WORLD: CMSG_CANCEL_TEMP_ENCHANTMENT"); uint32 eslot; @@ -1386,7 +1386,7 @@ void WorldSession::HandleCancelTempEnchantmentOpcode(WorldPacket& recvData) void WorldSession::HandleItemRefundInfoRequest(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_ITEM_REFUND_INFO"); + TC_LOG_DEBUG("network", "WORLD: CMSG_ITEM_REFUND_INFO"); uint64 guid; recvData >> guid; // item guid @@ -1394,7 +1394,7 @@ void WorldSession::HandleItemRefundInfoRequest(WorldPacket& recvData) Item* item = _player->GetItemByGuid(guid); if (!item) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Item refund: item not found!"); + TC_LOG_DEBUG("network", "Item refund: item not found!"); return; } @@ -1403,14 +1403,14 @@ void WorldSession::HandleItemRefundInfoRequest(WorldPacket& recvData) void WorldSession::HandleItemRefund(WorldPacket &recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_ITEM_REFUND"); + TC_LOG_DEBUG("network", "WORLD: CMSG_ITEM_REFUND"); uint64 guid; recvData >> guid; // item guid Item* item = _player->GetItemByGuid(guid); if (!item) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Item refund: item not found!"); + TC_LOG_DEBUG("network", "Item refund: item not found!"); return; } @@ -1427,7 +1427,7 @@ void WorldSession::HandleItemTextQuery(WorldPacket& recvData ) uint64 itemGuid; recvData >> itemGuid; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_ITEM_TEXT_QUERY item guid: %u", GUID_LOPART(itemGuid)); + TC_LOG_DEBUG("network", "CMSG_ITEM_TEXT_QUERY item guid: %u", GUID_LOPART(itemGuid)); WorldPacket data(SMSG_ITEM_TEXT_QUERY_RESPONSE, (4+10)); // guess size diff --git a/src/server/game/Handlers/LFGHandler.cpp b/src/server/game/Handlers/LFGHandler.cpp index d289d0f65b8..b0780873e87 100644 --- a/src/server/game/Handlers/LFGHandler.cpp +++ b/src/server/game/Handlers/LFGHandler.cpp @@ -61,7 +61,7 @@ void WorldSession::HandleLfgJoinOpcode(WorldPacket& recvData) recvData >> numDungeons; if (!numDungeons) { - TC_LOG_DEBUG(LOG_FILTER_LFG, "CMSG_LFG_JOIN %s no dungeons selected", GetPlayerInfo().c_str()); + TC_LOG_DEBUG("lfg", "CMSG_LFG_JOIN %s no dungeons selected", GetPlayerInfo().c_str()); recvData.rfinish(); return; } @@ -78,7 +78,7 @@ void WorldSession::HandleLfgJoinOpcode(WorldPacket& recvData) std::string comment; recvData >> comment; - TC_LOG_DEBUG(LOG_FILTER_LFG, "CMSG_LFG_JOIN %s roles: %u, Dungeons: %u, Comment: %s", + TC_LOG_DEBUG("lfg", "CMSG_LFG_JOIN %s roles: %u, Dungeons: %u, Comment: %s", GetPlayerInfo().c_str(), roles, uint8(newDungeons.size()), comment.c_str()); sLFGMgr->JoinLfg(GetPlayer(), uint8(roles), newDungeons, comment); @@ -90,7 +90,7 @@ void WorldSession::HandleLfgLeaveOpcode(WorldPacket& /*recvData*/) uint64 guid = GetPlayer()->GetGUID(); uint64 gguid = group ? group->GetGUID() : guid; - TC_LOG_DEBUG(LOG_FILTER_LFG, "CMSG_LFG_LEAVE %s in group: %u", + TC_LOG_DEBUG("lfg", "CMSG_LFG_LEAVE %s in group: %u", GetPlayerInfo().c_str(), group ? 1 : 0); // Check cheating - only leader can leave the queue @@ -105,7 +105,7 @@ void WorldSession::HandleLfgProposalResultOpcode(WorldPacket& recvData) recvData >> lfgGroupID; recvData >> accept; - TC_LOG_DEBUG(LOG_FILTER_LFG, "CMSG_LFG_PROPOSAL_RESULT %s proposal: %u accept: %u", + TC_LOG_DEBUG("lfg", "CMSG_LFG_PROPOSAL_RESULT %s proposal: %u accept: %u", GetPlayerInfo().c_str(), lfgGroupID, accept ? 1 : 0); sLFGMgr->UpdateProposal(lfgGroupID, GetPlayer()->GetGUID(), accept); } @@ -118,12 +118,12 @@ void WorldSession::HandleLfgSetRolesOpcode(WorldPacket& recvData) Group* group = GetPlayer()->GetGroup(); if (!group) { - TC_LOG_DEBUG(LOG_FILTER_LFG, "CMSG_LFG_SET_ROLES %s Not in group", + TC_LOG_DEBUG("lfg", "CMSG_LFG_SET_ROLES %s Not in group", GetPlayerInfo().c_str()); return; } uint64 gguid = group->GetGUID(); - TC_LOG_DEBUG(LOG_FILTER_LFG, "CMSG_LFG_SET_ROLES: Group %u, Player %s, Roles: %u", + TC_LOG_DEBUG("lfg", "CMSG_LFG_SET_ROLES: Group %u, Player %s, Roles: %u", GUID_LOPART(gguid), GetPlayerInfo().c_str(), roles); sLFGMgr->UpdateRoleCheck(gguid, guid, roles); } @@ -133,7 +133,7 @@ void WorldSession::HandleLfgSetCommentOpcode(WorldPacket& recvData) std::string comment; recvData >> comment; - TC_LOG_DEBUG(LOG_FILTER_LFG, "CMSG_LFG_SET_COMMENT %s comment: %s", + TC_LOG_DEBUG("lfg", "CMSG_LFG_SET_COMMENT %s comment: %s", GetPlayerInfo().c_str(), comment.c_str()); sLFGMgr->SetComment(GetPlayer()->GetGUID(), comment); @@ -145,7 +145,7 @@ void WorldSession::HandleLfgSetBootVoteOpcode(WorldPacket& recvData) recvData >> agree; uint64 guid = GetPlayer()->GetGUID(); - TC_LOG_DEBUG(LOG_FILTER_LFG, "CMSG_LFG_SET_BOOT_VOTE %s agree: %u", + TC_LOG_DEBUG("lfg", "CMSG_LFG_SET_BOOT_VOTE %s agree: %u", GetPlayerInfo().c_str(), agree ? 1 : 0); sLFGMgr->UpdateBoot(guid, agree); } @@ -155,7 +155,7 @@ void WorldSession::HandleLfgTeleportOpcode(WorldPacket& recvData) bool out; recvData >> out; - TC_LOG_DEBUG(LOG_FILTER_LFG, "CMSG_LFG_TELEPORT %s out: %u", + TC_LOG_DEBUG("lfg", "CMSG_LFG_TELEPORT %s out: %u", GetPlayerInfo().c_str(), out ? 1 : 0); sLFGMgr->TeleportPlayer(GetPlayer(), out, true); } @@ -163,7 +163,7 @@ void WorldSession::HandleLfgTeleportOpcode(WorldPacket& recvData) void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& /*recvData*/) { uint64 guid = GetPlayer()->GetGUID(); - TC_LOG_DEBUG(LOG_FILTER_LFG, "CMSG_LFG_PLAYER_LOCK_INFO_REQUEST %s", + TC_LOG_DEBUG("lfg", "CMSG_LFG_PLAYER_LOCK_INFO_REQUEST %s", GetPlayerInfo().c_str()); // Get Random dungeons that can be done at a certain level and expansion @@ -176,7 +176,7 @@ void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& /*recvData* uint32 rsize = uint32(randomDungeons.size()); uint32 lsize = uint32(lock.size()); - TC_LOG_DEBUG(LOG_FILTER_LFG, "SMSG_LFG_PLAYER_INFO %s", GetPlayerInfo().c_str()); + TC_LOG_DEBUG("lfg", "SMSG_LFG_PLAYER_INFO %s", GetPlayerInfo().c_str()); WorldPacket data(SMSG_LFG_PLAYER_INFO, 1 + rsize * (4 + 1 + 4 + 4 + 4 + 4 + 1 + 4 + 4 + 4) + 4 + lsize * (1 + 4 + 4 + 4 + 4 + 1 + 4 + 4 + 4)); data << uint8(randomDungeons.size()); // Random Dungeon count @@ -234,7 +234,7 @@ void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& /*recvData* void WorldSession::HandleLfgPartyLockInfoRequestOpcode(WorldPacket& /*recvData*/) { uint64 guid = GetPlayer()->GetGUID(); - TC_LOG_DEBUG(LOG_FILTER_LFG, "CMSG_LFG_PARTY_LOCK_INFO_REQUEST %s", GetPlayerInfo().c_str()); + TC_LOG_DEBUG("lfg", "CMSG_LFG_PARTY_LOCK_INFO_REQUEST %s", GetPlayerInfo().c_str()); Group* group = GetPlayer()->GetGroup(); if (!group) @@ -259,7 +259,7 @@ void WorldSession::HandleLfgPartyLockInfoRequestOpcode(WorldPacket& /*recvData* for (lfg::LfgLockPartyMap::const_iterator it = lockMap.begin(); it != lockMap.end(); ++it) size += 8 + 4 + uint32(it->second.size()) * (4 + 4); - TC_LOG_DEBUG(LOG_FILTER_LFG, "SMSG_LFG_PARTY_INFO %s", GetPlayerInfo().c_str()); + TC_LOG_DEBUG("lfg", "SMSG_LFG_PARTY_INFO %s", GetPlayerInfo().c_str()); WorldPacket data(SMSG_LFG_PARTY_INFO, 1 + size); BuildPartyLockDungeonBlock(data, lockMap); SendPacket(&data); @@ -269,7 +269,7 @@ void WorldSession::HandleLfrJoinOpcode(WorldPacket& recvData) { uint32 entry; // Raid id to search recvData >> entry; - TC_LOG_DEBUG(LOG_FILTER_LFG, "CMSG_LFG_LFR_JOIN %s dungeon entry: %u", + TC_LOG_DEBUG("lfg", "CMSG_LFG_LFR_JOIN %s dungeon entry: %u", GetPlayerInfo().c_str(), entry); //SendLfrUpdateListOpcode(entry); } @@ -278,14 +278,14 @@ void WorldSession::HandleLfrLeaveOpcode(WorldPacket& recvData) { uint32 dungeonId; // Raid id queue to leave recvData >> dungeonId; - TC_LOG_DEBUG(LOG_FILTER_LFG, "CMSG_LFG_LFR_LEAVE %s dungeonId: %u", + TC_LOG_DEBUG("lfg", "CMSG_LFG_LFR_LEAVE %s dungeonId: %u", GetPlayerInfo().c_str(), dungeonId); //sLFGMgr->LeaveLfr(GetPlayer(), dungeonId); } void WorldSession::HandleLfgGetStatus(WorldPacket& /*recvData*/) { - TC_LOG_DEBUG(LOG_FILTER_LFG, "CMSG_LFG_GET_STATUS %s", GetPlayerInfo().c_str()); + TC_LOG_DEBUG("lfg", "CMSG_LFG_GET_STATUS %s", GetPlayerInfo().c_str()); uint64 guid = GetPlayer()->GetGUID(); lfg::LfgUpdateData updateData = sLFGMgr->GetLfgStatus(guid); @@ -322,7 +322,7 @@ void WorldSession::SendLfgUpdatePlayer(lfg::LfgUpdateData const& updateData) break; } - TC_LOG_DEBUG(LOG_FILTER_LFG, "SMSG_LFG_UPDATE_PLAYER %s updatetype: %u", + TC_LOG_DEBUG("lfg", "SMSG_LFG_UPDATE_PLAYER %s updatetype: %u", GetPlayerInfo().c_str(), updateData.updateType); WorldPacket data(SMSG_LFG_UPDATE_PLAYER, 1 + 1 + (size > 0 ? 1 : 0) * (1 + 1 + 1 + 1 + size * 4 + updateData.comment.length())); data << uint8(updateData.updateType); // Lfg Update type @@ -363,7 +363,7 @@ void WorldSession::SendLfgUpdateParty(const lfg::LfgUpdateData& updateData) break; } - TC_LOG_DEBUG(LOG_FILTER_LFG, "SMSG_LFG_UPDATE_PARTY %s updatetype: %u", + TC_LOG_DEBUG("lfg", "SMSG_LFG_UPDATE_PARTY %s updatetype: %u", GetPlayerInfo().c_str(), updateData.updateType); WorldPacket data(SMSG_LFG_UPDATE_PARTY, 1 + 1 + (size > 0 ? 1 : 0) * (1 + 1 + 1 + 1 + 1 + size * 4 + updateData.comment.length())); data << uint8(updateData.updateType); // Lfg Update type @@ -387,7 +387,7 @@ void WorldSession::SendLfgUpdateParty(const lfg::LfgUpdateData& updateData) void WorldSession::SendLfgRoleChosen(uint64 guid, uint8 roles) { - TC_LOG_DEBUG(LOG_FILTER_LFG, "SMSG_LFG_ROLE_CHOSEN %s guid: %u roles: %u", + TC_LOG_DEBUG("lfg", "SMSG_LFG_ROLE_CHOSEN %s guid: %u roles: %u", GetPlayerInfo().c_str(), GUID_LOPART(guid), roles); WorldPacket data(SMSG_LFG_ROLE_CHOSEN, 8 + 1 + 4); @@ -405,7 +405,7 @@ void WorldSession::SendLfgRoleCheckUpdate(lfg::LfgRoleCheck const& roleCheck) else dungeons = roleCheck.dungeons; - TC_LOG_DEBUG(LOG_FILTER_LFG, "SMSG_LFG_ROLE_CHECK_UPDATE %s", GetPlayerInfo().c_str()); + TC_LOG_DEBUG("lfg", "SMSG_LFG_ROLE_CHECK_UPDATE %s", GetPlayerInfo().c_str()); WorldPacket data(SMSG_LFG_ROLE_CHECK_UPDATE, 4 + 1 + 1 + dungeons.size() * 4 + 1 + roleCheck.roles.size() * (8 + 1 + 4 + 1)); data << uint32(roleCheck.state); // Check result @@ -450,7 +450,7 @@ void WorldSession::SendLfgJoinResult(lfg::LfgJoinResultData const& joinData) for (lfg::LfgLockPartyMap::const_iterator it = joinData.lockmap.begin(); it != joinData.lockmap.end(); ++it) size += 8 + 4 + uint32(it->second.size()) * (4 + 4); - TC_LOG_DEBUG(LOG_FILTER_LFG, "SMSG_LFG_JOIN_RESULT %s checkResult: %u checkValue: %u", + TC_LOG_DEBUG("lfg", "SMSG_LFG_JOIN_RESULT %s checkResult: %u checkValue: %u", GetPlayerInfo().c_str(), joinData.result, joinData.state); WorldPacket data(SMSG_LFG_JOIN_RESULT, 4 + 4 + size); @@ -463,7 +463,7 @@ void WorldSession::SendLfgJoinResult(lfg::LfgJoinResultData const& joinData) void WorldSession::SendLfgQueueStatus(lfg::LfgQueueStatusData const& queueData) { - TC_LOG_DEBUG(LOG_FILTER_LFG, "SMSG_LFG_QUEUE_STATUS %s dungeon: %u, waitTime: %d, " + TC_LOG_DEBUG("lfg", "SMSG_LFG_QUEUE_STATUS %s dungeon: %u, waitTime: %d, " "avgWaitTime: %d, waitTimeTanks: %d, waitTimeHealer: %d, waitTimeDps: %d, " "queuedTime: %u, tanks: %u, healers: %u, dps: %u", GetPlayerInfo().c_str(), queueData.dungeonId, queueData.waitTime, queueData.waitTimeAvg, @@ -489,7 +489,7 @@ void WorldSession::SendLfgPlayerReward(lfg::LfgPlayerRewardData const& rewardDat if (!rewardData.rdungeonEntry || !rewardData.sdungeonEntry || !rewardData.quest) return; - TC_LOG_DEBUG(LOG_FILTER_LFG, "SMSG_LFG_PLAYER_REWARD %s rdungeonEntry: %u, sdungeonEntry: %u, done: %u", + TC_LOG_DEBUG("lfg", "SMSG_LFG_PLAYER_REWARD %s rdungeonEntry: %u, sdungeonEntry: %u, done: %u", GetPlayerInfo().c_str(), rewardData.rdungeonEntry, rewardData.sdungeonEntry, rewardData.done); uint8 itemNum = rewardData.quest->GetRewItemsCount(); @@ -534,7 +534,7 @@ void WorldSession::SendLfgBootProposalUpdate(lfg::LfgPlayerBoot const& boot) ++agreeNum; } } - TC_LOG_DEBUG(LOG_FILTER_LFG, "SMSG_LFG_BOOT_PROPOSAL_UPDATE %s inProgress: %u - " + TC_LOG_DEBUG("lfg", "SMSG_LFG_BOOT_PROPOSAL_UPDATE %s inProgress: %u - " "didVote: %u - agree: %u - victim: %u votes: %u - agrees: %u - left: %u - " "needed: %u - reason %s", GetPlayerInfo().c_str(), uint8(boot.inProgress), uint8(playerVote != lfg::LFG_ANSWER_PENDING), @@ -560,7 +560,7 @@ void WorldSession::SendLfgUpdateProposal(lfg::LfgProposal const& proposal) bool silent = !proposal.isNew && gguid == proposal.group; uint32 dungeonEntry = proposal.dungeonId; - TC_LOG_DEBUG(LOG_FILTER_LFG, "SMSG_LFG_PROPOSAL_UPDATE %s state: %u", + TC_LOG_DEBUG("lfg", "SMSG_LFG_PROPOSAL_UPDATE %s state: %u", GetPlayerInfo().c_str(), proposal.state); // show random dungeon if player selected random dungeon and it's not lfg group @@ -604,7 +604,7 @@ void WorldSession::SendLfgUpdateProposal(lfg::LfgProposal const& proposal) void WorldSession::SendLfgLfrList(bool update) { - TC_LOG_DEBUG(LOG_FILTER_LFG, "SMSG_LFG_LFR_LIST %s update: %u", + TC_LOG_DEBUG("lfg", "SMSG_LFG_LFR_LIST %s update: %u", GetPlayerInfo().c_str(), update ? 1 : 0); WorldPacket data(SMSG_LFG_UPDATE_SEARCH, 1); data << uint8(update); // In Lfg Queue? @@ -613,14 +613,14 @@ void WorldSession::SendLfgLfrList(bool update) void WorldSession::SendLfgDisabled() { - TC_LOG_DEBUG(LOG_FILTER_LFG, "SMSG_LFG_DISABLED %s", GetPlayerInfo().c_str()); + TC_LOG_DEBUG("lfg", "SMSG_LFG_DISABLED %s", GetPlayerInfo().c_str()); WorldPacket data(SMSG_LFG_DISABLED, 0); SendPacket(&data); } void WorldSession::SendLfgOfferContinue(uint32 dungeonEntry) { - TC_LOG_DEBUG(LOG_FILTER_LFG, "SMSG_LFG_OFFER_CONTINUE %s dungeon entry: %u", + TC_LOG_DEBUG("lfg", "SMSG_LFG_OFFER_CONTINUE %s dungeon entry: %u", GetPlayerInfo().c_str(), dungeonEntry); WorldPacket data(SMSG_LFG_OFFER_CONTINUE, 4); data << uint32(dungeonEntry); @@ -629,7 +629,7 @@ void WorldSession::SendLfgOfferContinue(uint32 dungeonEntry) void WorldSession::SendLfgTeleportError(uint8 err) { - TC_LOG_DEBUG(LOG_FILTER_LFG, "SMSG_LFG_TELEPORT_DENIED %s reason: %u", + TC_LOG_DEBUG("lfg", "SMSG_LFG_TELEPORT_DENIED %s reason: %u", GetPlayerInfo().c_str(), err); WorldPacket data(SMSG_LFG_TELEPORT_DENIED, 4); data << uint32(err); // Error @@ -639,7 +639,7 @@ void WorldSession::SendLfgTeleportError(uint8 err) /* void WorldSession::SendLfrUpdateListOpcode(uint32 dungeonEntry) { - TC_LOG_DEBUG(LOG_FILTER_PACKETIO, "SMSG_LFG_UPDATE_LIST %s dungeon entry: %u", + TC_LOG_DEBUG("network", "SMSG_LFG_UPDATE_LIST %s dungeon entry: %u", GetPlayerInfo().c_str(), dungeonEntry); WorldPacket data(SMSG_LFG_UPDATE_LIST); SendPacket(&data); diff --git a/src/server/game/Handlers/LootHandler.cpp b/src/server/game/Handlers/LootHandler.cpp index cdcf4c53dd3..9a371178044 100644 --- a/src/server/game/Handlers/LootHandler.cpp +++ b/src/server/game/Handlers/LootHandler.cpp @@ -33,7 +33,7 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AUTOSTORE_LOOT_ITEM"); + TC_LOG_DEBUG("network", "WORLD: CMSG_AUTOSTORE_LOOT_ITEM"); Player* player = GetPlayer(); uint64 lguid = player->GetLootGUID(); Loot* loot = NULL; @@ -101,7 +101,7 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket& recvData) void WorldSession::HandleLootMoneyOpcode(WorldPacket& /*recvData*/) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_LOOT_MONEY"); + TC_LOG_DEBUG("network", "WORLD: CMSG_LOOT_MONEY"); Player* player = GetPlayer(); uint64 guid = player->GetLootGUID(); @@ -217,7 +217,7 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket& /*recvData*/) void WorldSession::HandleLootOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_LOOT"); + TC_LOG_DEBUG("network", "WORLD: CMSG_LOOT"); uint64 guid; recvData >> guid; @@ -235,7 +235,7 @@ void WorldSession::HandleLootOpcode(WorldPacket& recvData) void WorldSession::HandleLootReleaseOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_LOOT_RELEASE"); + TC_LOG_DEBUG("network", "WORLD: CMSG_LOOT_RELEASE"); // cheaters can modify lguid to prevent correct apply loot release code and re-loot // use internal stored guid @@ -414,7 +414,7 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket& recvData) if (!target) return; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WorldSession::HandleLootMasterGiveOpcode (CMSG_LOOT_MASTER_GIVE, 0x02A3) Target = [%s].", target->GetName().c_str()); + TC_LOG_DEBUG("network", "WorldSession::HandleLootMasterGiveOpcode (CMSG_LOOT_MASTER_GIVE, 0x02A3) Target = [%s].", target->GetName().c_str()); if (_player->GetLootGUID() != lootguid) return; @@ -443,7 +443,7 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket& recvData) if (slotid >= loot->items.size() + loot->quest_items.size()) { - TC_LOG_DEBUG(LOG_FILTER_LOOT, "MasterLootItem: Player %s might be using a hack! (slot %d, size %lu)", + TC_LOG_DEBUG("loot", "MasterLootItem: Player %s might be using a hack! (slot %d, size %lu)", GetPlayer()->GetName().c_str(), slotid, (unsigned long)loot->items.size()); return; } diff --git a/src/server/game/Handlers/MailHandler.cpp b/src/server/game/Handlers/MailHandler.cpp index 27efe9d28d9..6fde51b7189 100644 --- a/src/server/game/Handlers/MailHandler.cpp +++ b/src/server/game/Handlers/MailHandler.cpp @@ -82,7 +82,7 @@ void WorldSession::HandleSendMail(WorldPacket& recvData) if (!receiverGuid) { - TC_LOG_INFO(LOG_FILTER_NETWORKIO, "Player %u is sending mail to %s (GUID: not existed!) with subject %s " + TC_LOG_INFO("network", "Player %u is sending mail to %s (GUID: not existed!) with subject %s " "and body %s includes %u items, %u copper and %u COD copper with unk1 = %u, unk2 = %u", player->GetGUIDLow(), receiverName.c_str(), subject.c_str(), body.c_str(), items_count, money, COD, unk1, unk2); @@ -90,7 +90,7 @@ void WorldSession::HandleSendMail(WorldPacket& recvData) return; } - TC_LOG_INFO(LOG_FILTER_NETWORKIO, "Player %u is sending mail to %s (GUID: %u) with subject %s and body %s " + TC_LOG_INFO("network", "Player %u is sending mail to %s (GUID: %u) with subject %s and body %s " "includes %u items, %u copper and %u COD copper with unk1 = %u, unk2 = %u", player->GetGUIDLow(), receiverName.c_str(), GUID_LOPART(receiverGuid), subject.c_str(), body.c_str(), items_count, money, COD, unk1, unk2); @@ -715,7 +715,7 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket& recvData) bodyItem->SetUInt32Value(ITEM_FIELD_CREATOR, m->sender); bodyItem->SetFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_MAIL_TEXT_MASK); - TC_LOG_INFO(LOG_FILTER_NETWORKIO, "HandleMailCreateTextItem mailid=%u", mailId); + TC_LOG_INFO("network", "HandleMailCreateTextItem mailid=%u", mailId); ItemPosCountVec dest; uint8 msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, dest, bodyItem, false); diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp index 71453581ed0..4da0d829bae 100644 --- a/src/server/game/Handlers/MiscHandler.cpp +++ b/src/server/game/Handlers/MiscHandler.cpp @@ -58,7 +58,7 @@ void WorldSession::HandleRepopRequestOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_REPOP_REQUEST Message"); + TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_REPOP_REQUEST Message"); recvData.read_skip<uint8>(); @@ -75,7 +75,7 @@ void WorldSession::HandleRepopRequestOpcode(WorldPacket& recvData) // release spirit after he's killed but before he is updated if (GetPlayer()->getDeathState() == JUST_DIED) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "HandleRepopRequestOpcode: got request after player %s(%d) was killed and before he was updated", + TC_LOG_DEBUG("network", "HandleRepopRequestOpcode: got request after player %s(%d) was killed and before he was updated", GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow()); GetPlayer()->KillPlayer(); } @@ -88,7 +88,7 @@ void WorldSession::HandleRepopRequestOpcode(WorldPacket& recvData) void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_GOSSIP_SELECT_OPTION"); + TC_LOG_DEBUG("network", "WORLD: CMSG_GOSSIP_SELECT_OPTION"); uint32 gossipListId; uint32 menuId; @@ -107,7 +107,7 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket& recvData) unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE); if (!unit) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: HandleGossipSelectOptionOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: HandleGossipSelectOptionOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); return; } } @@ -116,13 +116,13 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket& recvData) go = _player->GetMap()->GetGameObject(guid); if (!go) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: HandleGossipSelectOptionOpcode - GameObject (GUID: %u) not found.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: HandleGossipSelectOptionOpcode - GameObject (GUID: %u) not found.", uint32(GUID_LOPART(guid))); return; } } else { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: HandleGossipSelectOptionOpcode - unsupported GUID type for highguid %u. lowpart %u.", uint32(GUID_HIPART(guid)), uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: HandleGossipSelectOptionOpcode - unsupported GUID type for highguid %u. lowpart %u.", uint32(GUID_HIPART(guid)), uint32(GUID_LOPART(guid))); return; } @@ -132,7 +132,7 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket& recvData) if ((unit && unit->GetCreatureTemplate()->ScriptID != unit->LastUsedScriptID) || (go && go->GetGOInfo()->ScriptId != go->LastUsedScriptID)) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: HandleGossipSelectOptionOpcode - Script reloaded while in use, ignoring and set new scipt id"); + TC_LOG_DEBUG("network", "WORLD: HandleGossipSelectOptionOpcode - Script reloaded while in use, ignoring and set new scipt id"); if (unit) unit->LastUsedScriptID = unit->GetCreatureTemplate()->ScriptID; if (go) @@ -173,7 +173,7 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket& recvData) void WorldSession::HandleWhoOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_WHO Message"); + TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_WHO Message"); time_t now = time(NULL); if (now - timeLastWhoCommand < 5) @@ -204,7 +204,7 @@ void WorldSession::HandleWhoOpcode(WorldPacket& recvData) uint32 temp; recvData >> temp; // zone id, 0 if zone is unknown... zoneids[i] = temp; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Zone %u: %u", i, zoneids[i]); + TC_LOG_DEBUG("network", "Zone %u: %u", i, zoneids[i]); } recvData >> str_count; // user entered strings count, client limit=4 (checked on 2.0.10) @@ -212,7 +212,7 @@ void WorldSession::HandleWhoOpcode(WorldPacket& recvData) if (str_count > 4) return; // can't be received from real client or broken packet - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Minlvl %u, maxlvl %u, name %s, guild %s, racemask %u, classmask %u, zones %u, strings %u", level_min, level_max, player_name.c_str(), guild_name.c_str(), racemask, classmask, zones_count, str_count); + TC_LOG_DEBUG("network", "Minlvl %u, maxlvl %u, name %s, guild %s, racemask %u, classmask %u, zones %u, strings %u", level_min, level_max, player_name.c_str(), guild_name.c_str(), racemask, classmask, zones_count, str_count); std::wstring str[4]; // 4 is client limit for (uint32 i = 0; i < str_count; ++i) @@ -225,7 +225,7 @@ void WorldSession::HandleWhoOpcode(WorldPacket& recvData) wstrToLower(str[i]); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "String %u: %s", i, temp.c_str()); + TC_LOG_DEBUG("network", "String %u: %s", i, temp.c_str()); } std::wstring wplayer_name; @@ -362,12 +362,12 @@ void WorldSession::HandleWhoOpcode(WorldPacket& recvData) data.put(4, matchcount); // insert right count, count of matches SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Send SMSG_WHO Message"); + TC_LOG_DEBUG("network", "WORLD: Send SMSG_WHO Message"); } void WorldSession::HandleLogoutRequestOpcode(WorldPacket& /*recvData*/) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_LOGOUT_REQUEST Message, security - %u", GetSecurity()); + TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_LOGOUT_REQUEST Message, security - %u", GetSecurity()); if (uint64 lguid = GetPlayer()->GetLootGUID()) DoLootRelease(lguid); @@ -421,12 +421,12 @@ void WorldSession::HandleLogoutRequestOpcode(WorldPacket& /*recvData*/) void WorldSession::HandlePlayerLogoutOpcode(WorldPacket& /*recvData*/) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_PLAYER_LOGOUT Message"); + TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_PLAYER_LOGOUT Message"); } void WorldSession::HandleLogoutCancelOpcode(WorldPacket& /*recvData*/) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_LOGOUT_CANCEL Message"); + TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_LOGOUT_CANCEL Message"); // Player have already logged out serverside, too late to cancel if (!GetPlayer()) @@ -453,7 +453,7 @@ void WorldSession::HandleLogoutCancelOpcode(WorldPacket& /*recvData*/) GetPlayer()->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); } - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_LOGOUT_CANCEL_ACK Message"); + TC_LOG_DEBUG("network", "WORLD: Sent SMSG_LOGOUT_CANCEL_ACK Message"); } void WorldSession::HandleTogglePvP(WorldPacket& recvData) @@ -492,7 +492,7 @@ void WorldSession::HandleZoneUpdateOpcode(WorldPacket& recvData) uint32 newZone; recvData >> newZone; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Recvd ZONE_UPDATE: %u", newZone); + TC_LOG_DEBUG("network", "WORLD: Recvd ZONE_UPDATE: %u", newZone); // use server size data uint32 newzone, newarea; @@ -511,7 +511,7 @@ void WorldSession::HandleSetSelectionOpcode(WorldPacket& recvData) void WorldSession::HandleStandStateChangeOpcode(WorldPacket& recvData) { - // TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_STANDSTATECHANGE"); -- too many spam in log at lags/debug stop + // TC_LOG_DEBUG("network", "WORLD: Received CMSG_STANDSTATECHANGE"); -- too many spam in log at lags/debug stop uint32 animstate; recvData >> animstate; @@ -522,13 +522,13 @@ void WorldSession::HandleContactListOpcode(WorldPacket& recvData) { uint32 unk; recvData >> unk; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_CONTACT_LIST - Unk: %d", unk); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_CONTACT_LIST - Unk: %d", unk); _player->GetSocial()->SendSocialList(_player); } void WorldSession::HandleAddFriendOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_ADD_FRIEND"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_ADD_FRIEND"); std::string friendName = GetTrinityString(LANG_FRIEND_IGNORE_UNKNOWN); std::string friendNote; @@ -540,7 +540,7 @@ void WorldSession::HandleAddFriendOpcode(WorldPacket& recvData) if (!normalizePlayerName(friendName)) return; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: %s asked to add friend : '%s'", + TC_LOG_DEBUG("network", "WORLD: %s asked to add friend : '%s'", GetPlayer()->GetName().c_str(), friendName.c_str()); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUID_RACE_ACC_BY_NAME); @@ -592,7 +592,7 @@ void WorldSession::HandleAddFriendOpcodeCallBack(PreparedQueryResult result, std if (!GetPlayer()->GetSocial()->AddToSocialList(GUID_LOPART(friendGuid), false)) { friendResult = FRIEND_LIST_FULL; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: %s's friend list is full.", GetPlayer()->GetName().c_str()); + TC_LOG_DEBUG("network", "WORLD: %s's friend list is full.", GetPlayer()->GetName().c_str()); } } GetPlayer()->GetSocial()->SetFriendNote(GUID_LOPART(friendGuid), friendNote); @@ -602,14 +602,14 @@ void WorldSession::HandleAddFriendOpcodeCallBack(PreparedQueryResult result, std sSocialMgr->SendFriendStatus(GetPlayer(), friendResult, GUID_LOPART(friendGuid), false); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent (SMSG_FRIEND_STATUS)"); + TC_LOG_DEBUG("network", "WORLD: Sent (SMSG_FRIEND_STATUS)"); } void WorldSession::HandleDelFriendOpcode(WorldPacket& recvData) { uint64 FriendGUID; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_DEL_FRIEND"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_DEL_FRIEND"); recvData >> FriendGUID; @@ -617,12 +617,12 @@ void WorldSession::HandleDelFriendOpcode(WorldPacket& recvData) sSocialMgr->SendFriendStatus(GetPlayer(), FRIEND_REMOVED, GUID_LOPART(FriendGUID), false); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent motd (SMSG_FRIEND_STATUS)"); + TC_LOG_DEBUG("network", "WORLD: Sent motd (SMSG_FRIEND_STATUS)"); } void WorldSession::HandleAddIgnoreOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_ADD_IGNORE"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_ADD_IGNORE"); std::string ignoreName = GetTrinityString(LANG_FRIEND_IGNORE_UNKNOWN); @@ -631,7 +631,7 @@ void WorldSession::HandleAddIgnoreOpcode(WorldPacket& recvData) if (!normalizePlayerName(ignoreName)) return; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: %s asked to Ignore: '%s'", + TC_LOG_DEBUG("network", "WORLD: %s asked to Ignore: '%s'", GetPlayer()->GetName().c_str(), ignoreName.c_str()); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUID_BY_NAME); @@ -675,14 +675,14 @@ void WorldSession::HandleAddIgnoreOpcodeCallBack(PreparedQueryResult result) sSocialMgr->SendFriendStatus(GetPlayer(), ignoreResult, GUID_LOPART(IgnoreGuid), false); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent (SMSG_FRIEND_STATUS)"); + TC_LOG_DEBUG("network", "WORLD: Sent (SMSG_FRIEND_STATUS)"); } void WorldSession::HandleDelIgnoreOpcode(WorldPacket& recvData) { uint64 IgnoreGUID; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_DEL_IGNORE"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_DEL_IGNORE"); recvData >> IgnoreGUID; @@ -690,12 +690,12 @@ void WorldSession::HandleDelIgnoreOpcode(WorldPacket& recvData) sSocialMgr->SendFriendStatus(GetPlayer(), FRIEND_IGNORE_REMOVED, GUID_LOPART(IgnoreGUID), false); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent motd (SMSG_FRIEND_STATUS)"); + TC_LOG_DEBUG("network", "WORLD: Sent motd (SMSG_FRIEND_STATUS)"); } void WorldSession::HandleSetContactNotesOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_SET_CONTACT_NOTES"); + TC_LOG_DEBUG("network", "CMSG_SET_CONTACT_NOTES"); uint64 guid; std::string note; recvData >> guid >> note; @@ -712,12 +712,12 @@ void WorldSession::HandleBugOpcode(WorldPacket& recvData) recvData >> typelen >> type; if (suggestion == 0) - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_BUG [Bug Report]"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_BUG [Bug Report]"); else - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_BUG [Suggestion]"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_BUG [Suggestion]"); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "%s", type.c_str()); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "%s", content.c_str()); + TC_LOG_DEBUG("network", "%s", type.c_str()); + TC_LOG_DEBUG("network", "%s", content.c_str()); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_BUG_REPORT); @@ -729,7 +729,7 @@ void WorldSession::HandleBugOpcode(WorldPacket& recvData) void WorldSession::HandleReclaimCorpseOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_RECLAIM_CORPSE"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_RECLAIM_CORPSE"); uint64 guid; recvData >> guid; @@ -766,7 +766,7 @@ void WorldSession::HandleReclaimCorpseOpcode(WorldPacket& recvData) void WorldSession::HandleResurrectResponseOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_RESURRECT_RESPONSE"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_RESURRECT_RESPONSE"); uint64 guid; uint8 status; @@ -810,12 +810,12 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recvData) uint32 triggerId; recvData >> triggerId; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_AREATRIGGER. Trigger ID: %u", triggerId); + TC_LOG_DEBUG("network", "CMSG_AREATRIGGER. Trigger ID: %u", triggerId); Player* player = GetPlayer(); if (player->IsInFlight()) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) in flight, ignore Area Trigger ID:%u", + TC_LOG_DEBUG("network", "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) in flight, ignore Area Trigger ID:%u", player->GetName().c_str(), player->GetGUIDLow(), triggerId); return; } @@ -823,14 +823,14 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recvData) AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(triggerId); if (!atEntry) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) send unknown (by DBC) Area Trigger ID:%u", + TC_LOG_DEBUG("network", "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) send unknown (by DBC) Area Trigger ID:%u", player->GetName().c_str(), player->GetGUIDLow(), triggerId); return; } if (player->GetMapId() != atEntry->mapid) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) too far (trigger map: %u player map: %u), ignore Area Trigger ID: %u", + TC_LOG_DEBUG("network", "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) too far (trigger map: %u player map: %u), ignore Area Trigger ID: %u", player->GetName().c_str(), atEntry->mapid, player->GetMapId(), player->GetGUIDLow(), triggerId); return; } @@ -844,7 +844,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recvData) float dist = player->GetDistance(atEntry->x, atEntry->y, atEntry->z); if (dist > atEntry->radius + delta) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) too far (radius: %f distance: %f), ignore Area Trigger ID: %u", + TC_LOG_DEBUG("network", "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) too far (radius: %f distance: %f), ignore Area Trigger ID: %u", player->GetName().c_str(), player->GetGUIDLow(), atEntry->radius, dist, triggerId); return; } @@ -875,7 +875,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recvData) (fabs(dy) > atEntry->box_y / 2 + delta) || (fabs(dz) > atEntry->box_z / 2 + delta)) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) too far (1/2 box X: %f 1/2 box Y: %f 1/2 box Z: %f rotatedPlayerX: %f rotatedPlayerY: %f dZ:%f), ignore Area Trigger ID: %u", + TC_LOG_DEBUG("network", "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) too far (1/2 box X: %f 1/2 box Y: %f 1/2 box Z: %f rotatedPlayerX: %f rotatedPlayerY: %f dZ:%f), ignore Area Trigger ID: %u", player->GetName().c_str(), player->GetGUIDLow(), atEntry->box_x/2, atEntry->box_y/2, atEntry->box_z/2, rotPlayerX, rotPlayerY, dz, triggerId); return; } @@ -937,12 +937,12 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recvData) void WorldSession::HandleUpdateAccountData(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_UPDATE_ACCOUNT_DATA"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_UPDATE_ACCOUNT_DATA"); uint32 type, timestamp, decompressedSize; recvData >> type >> timestamp >> decompressedSize; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "UAD: type %u, time %u, decompressedSize %u", type, timestamp, decompressedSize); + TC_LOG_DEBUG("network", "UAD: type %u, time %u, decompressedSize %u", type, timestamp, decompressedSize); if (type > NUM_ACCOUNT_DATA_TYPES) return; @@ -962,7 +962,7 @@ void WorldSession::HandleUpdateAccountData(WorldPacket& recvData) if (decompressedSize > 0xFFFF) { recvData.rfinish(); // unnneded warning spam in this case - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "UAD: Account data packet too big, size %u", decompressedSize); + TC_LOG_ERROR("network", "UAD: Account data packet too big, size %u", decompressedSize); return; } @@ -973,7 +973,7 @@ void WorldSession::HandleUpdateAccountData(WorldPacket& recvData) if (uncompress(dest.contents(), &realSize, recvData.contents() + recvData.rpos(), recvData.size() - recvData.rpos()) != Z_OK) { recvData.rfinish(); // unnneded warning spam in this case - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "UAD: Failed to decompress account data"); + TC_LOG_ERROR("network", "UAD: Failed to decompress account data"); return; } @@ -992,12 +992,12 @@ void WorldSession::HandleUpdateAccountData(WorldPacket& recvData) void WorldSession::HandleRequestAccountData(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_REQUEST_ACCOUNT_DATA"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_REQUEST_ACCOUNT_DATA"); uint32 type; recvData >> type; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "RAD: type %u", type); + TC_LOG_DEBUG("network", "RAD: type %u", type); if (type >= NUM_ACCOUNT_DATA_TYPES) return; @@ -1013,7 +1013,7 @@ void WorldSession::HandleRequestAccountData(WorldPacket& recvData) if (size && compress(dest.contents(), &destSize, (uint8 const*)adata->Data.c_str(), size) != Z_OK) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "RAD: Failed to compress account data"); + TC_LOG_DEBUG("network", "RAD: Failed to compress account data"); return; } @@ -1033,7 +1033,7 @@ void WorldSession::HandleSetActionButtonOpcode(WorldPacket& recvData) uint8 button; uint32 packetData; recvData >> button >> packetData; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_SET_ACTION_BUTTON Button: %u Data: %u", button, packetData); + TC_LOG_DEBUG("network", "CMSG_SET_ACTION_BUTTON Button: %u Data: %u", button, packetData); if (!packetData) GetPlayer()->removeActionButton(button); @@ -1043,18 +1043,18 @@ void WorldSession::HandleSetActionButtonOpcode(WorldPacket& recvData) void WorldSession::HandleCompleteCinematic(WorldPacket& /*recvData*/) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_COMPLETE_CINEMATIC"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_COMPLETE_CINEMATIC"); } void WorldSession::HandleNextCinematicCamera(WorldPacket& /*recvData*/) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_NEXT_CINEMATIC_CAMERA"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_NEXT_CINEMATIC_CAMERA"); } void WorldSession::HandleMoveTimeSkippedOpcode(WorldPacket& recvData) { /* WorldSession::Update(getMSTime());*/ - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_MOVE_TIME_SKIPPED"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_MOVE_TIME_SKIPPED"); uint64 guid; recvData.readPackGUID(guid); @@ -1064,7 +1064,7 @@ void WorldSession::HandleMoveTimeSkippedOpcode(WorldPacket& recvData) uint32 time_skipped; recvData >> guid; recvData >> time_skipped; - TC_LOG_DEBUG(LOG_FILTER_PACKETIO, "WORLD: CMSG_MOVE_TIME_SKIPPED"); + TC_LOG_DEBUG("network", "WORLD: CMSG_MOVE_TIME_SKIPPED"); //// @todo must be need use in Trinity @@ -1076,7 +1076,7 @@ void WorldSession::HandleMoveTimeSkippedOpcode(WorldPacket& recvData) void WorldSession::HandleFeatherFallAck(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_MOVE_FEATHER_FALL_ACK"); + TC_LOG_DEBUG("network", "WORLD: CMSG_MOVE_FEATHER_FALL_ACK"); // no used recvData.rfinish(); // prevent warnings spam @@ -1097,7 +1097,7 @@ void WorldSession::HandleMoveUnRootAck(WorldPacket& recvData) return; } - TC_LOG_DEBUG(LOG_FILTER_PACKETIO, "WORLD: CMSG_FORCE_MOVE_UNROOT_ACK"); + TC_LOG_DEBUG("network", "WORLD: CMSG_FORCE_MOVE_UNROOT_ACK"); recvData.read_skip<uint32>(); // unk @@ -1123,7 +1123,7 @@ void WorldSession::HandleMoveRootAck(WorldPacket& recvData) return; } - TC_LOG_DEBUG(LOG_FILTER_PACKETIO, "WORLD: CMSG_FORCE_MOVE_ROOT_ACK"); + TC_LOG_DEBUG("network", "WORLD: CMSG_FORCE_MOVE_ROOT_ACK"); recvData.read_skip<uint32>(); // unk @@ -1141,7 +1141,7 @@ void WorldSession::HandleSetActionBarToggles(WorldPacket& recvData) if (!GetPlayer()) // ignore until not logged (check needed because STATUS_AUTHED) { if (actionBar != 0) - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "WorldSession::HandleSetActionBarToggles in not logged state with value: %u, ignored", uint32(actionBar)); + TC_LOG_ERROR("network", "WorldSession::HandleSetActionBarToggles in not logged state with value: %u, ignored", uint32(actionBar)); return; } @@ -1165,12 +1165,12 @@ void WorldSession::HandleInspectOpcode(WorldPacket& recvData) uint64 guid; recvData >> guid; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_INSPECT"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_INSPECT"); Player* player = ObjectAccessor::FindPlayer(guid); if (!player) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_INSPECT: No player found from GUID: " UI64FMTD, guid); + TC_LOG_DEBUG("network", "CMSG_INSPECT: No player found from GUID: " UI64FMTD, guid); return; } @@ -1201,7 +1201,7 @@ void WorldSession::HandleInspectHonorStatsOpcode(WorldPacket& recvData) if (!player) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "MSG_INSPECT_HONOR_STATS: No player found from GUID: " UI64FMTD, guid); + TC_LOG_DEBUG("network", "MSG_INSPECT_HONOR_STATS: No player found from GUID: " UI64FMTD, guid); return; } @@ -1231,16 +1231,16 @@ void WorldSession::HandleWorldTeleportOpcode(WorldPacket& recvData) recvData >> PositionZ; recvData >> Orientation; // o (3.141593 = 180 degrees) - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_WORLD_TELEPORT"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_WORLD_TELEPORT"); if (GetPlayer()->IsInFlight()) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Player '%s' (GUID: %u) in flight, ignore worldport command.", + TC_LOG_DEBUG("network", "Player '%s' (GUID: %u) in flight, ignore worldport command.", GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow()); return; } - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_WORLD_TELEPORT: Player = %s, Time = %u, map = %u, x = %f, y = %f, z = %f, o = %f", + TC_LOG_DEBUG("network", "CMSG_WORLD_TELEPORT: Player = %s, Time = %u, map = %u, x = %f, y = %f, z = %f, o = %f", GetPlayer()->GetName().c_str(), time, mapid, PositionX, PositionY, PositionZ, Orientation); if (HasPermission(rbac::RBAC_PERM_OPCODE_WORLD_TELEPORT)) @@ -1251,7 +1251,7 @@ void WorldSession::HandleWorldTeleportOpcode(WorldPacket& recvData) void WorldSession::HandleWhoisOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Received opcode CMSG_WHOIS"); + TC_LOG_DEBUG("network", "Received opcode CMSG_WHOIS"); std::string charname; recvData >> charname; @@ -1306,13 +1306,13 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recvData) data << msg; SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Received whois command from player %s for character %s", + TC_LOG_DEBUG("network", "Received whois command from player %s for character %s", GetPlayer()->GetName().c_str(), charname.c_str()); } void WorldSession::HandleComplainOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_COMPLAIN"); + TC_LOG_DEBUG("network", "WORLD: CMSG_COMPLAIN"); uint8 spam_type; // 0 - mail, 1 - chat uint64 spammer_guid; @@ -1347,12 +1347,12 @@ void WorldSession::HandleComplainOpcode(WorldPacket& recvData) data << uint8(0); SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "REPORT SPAM: type %u, guid %u, unk1 %u, unk2 %u, unk3 %u, unk4 %u, message %s", spam_type, GUID_LOPART(spammer_guid), unk1, unk2, unk3, unk4, description.c_str()); + TC_LOG_DEBUG("network", "REPORT SPAM: type %u, guid %u, unk1 %u, unk2 %u, unk3 %u, unk4 %u, message %s", spam_type, GUID_LOPART(spammer_guid), unk1, unk2, unk3, unk4, description.c_str()); } void WorldSession::HandleRealmSplitOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_REALM_SPLIT"); + TC_LOG_DEBUG("network", "CMSG_REALM_SPLIT"); uint32 unk; std::string split_date = "01/01/01"; @@ -1372,22 +1372,22 @@ void WorldSession::HandleRealmSplitOpcode(WorldPacket& recvData) void WorldSession::HandleFarSightOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_FAR_SIGHT"); + TC_LOG_DEBUG("network", "WORLD: CMSG_FAR_SIGHT"); bool apply; recvData >> apply; if (apply) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Added FarSight " UI64FMTD " to player %u", _player->GetUInt64Value(PLAYER_FARSIGHT), _player->GetGUIDLow()); + TC_LOG_DEBUG("network", "Added FarSight " UI64FMTD " to player %u", _player->GetUInt64Value(PLAYER_FARSIGHT), _player->GetGUIDLow()); if (WorldObject* target = _player->GetViewpoint()) _player->SetSeer(target); else - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Player %s (GUID: %u) requests non-existing seer " UI64FMTD, _player->GetName().c_str(), GUID_LOPART(_player->GetGUID()), _player->GetUInt64Value(PLAYER_FARSIGHT)); + TC_LOG_ERROR("network", "Player %s (GUID: %u) requests non-existing seer " UI64FMTD, _player->GetName().c_str(), GUID_LOPART(_player->GetGUID()), _player->GetUInt64Value(PLAYER_FARSIGHT)); } else { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Player %u set vision to self", _player->GetGUIDLow()); + TC_LOG_DEBUG("network", "Player %u set vision to self", _player->GetGUIDLow()); _player->SetSeer(_player); } @@ -1396,7 +1396,7 @@ void WorldSession::HandleFarSightOpcode(WorldPacket& recvData) void WorldSession::HandleSetTitleOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_SET_TITLE"); + TC_LOG_DEBUG("network", "CMSG_SET_TITLE"); int32 title; recvData >> title; @@ -1415,27 +1415,27 @@ void WorldSession::HandleSetTitleOpcode(WorldPacket& recvData) void WorldSession::HandleTimeSyncResp(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_TIME_SYNC_RESP"); + TC_LOG_DEBUG("network", "CMSG_TIME_SYNC_RESP"); uint32 counter, clientTicks; recvData >> counter >> clientTicks; if (counter != _player->m_timeSyncCounter - 1) - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Wrong time sync counter from player %s (cheater?)", _player->GetName().c_str()); + TC_LOG_DEBUG("network", "Wrong time sync counter from player %s (cheater?)", _player->GetName().c_str()); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Time sync received: counter %u, client ticks %u, time since last sync %u", counter, clientTicks, clientTicks - _player->m_timeSyncClient); + TC_LOG_DEBUG("network", "Time sync received: counter %u, client ticks %u, time since last sync %u", counter, clientTicks, clientTicks - _player->m_timeSyncClient); uint32 ourTicks = clientTicks + (getMSTime() - _player->m_timeSyncServer); // diff should be small - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Our ticks: %u, diff %u, latency %u", ourTicks, ourTicks - clientTicks, GetLatency()); + TC_LOG_DEBUG("network", "Our ticks: %u, diff %u, latency %u", ourTicks, ourTicks - clientTicks, GetLatency()); _player->m_timeSyncClient = clientTicks; } void WorldSession::HandleResetInstancesOpcode(WorldPacket& /*recvData*/) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_RESET_INSTANCES"); + TC_LOG_DEBUG("network", "WORLD: CMSG_RESET_INSTANCES"); if (Group* group = _player->GetGroup()) { @@ -1448,14 +1448,14 @@ void WorldSession::HandleResetInstancesOpcode(WorldPacket& /*recvData*/) void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "MSG_SET_DUNGEON_DIFFICULTY"); + TC_LOG_DEBUG("network", "MSG_SET_DUNGEON_DIFFICULTY"); uint32 mode; recvData >> mode; if (mode >= MAX_DUNGEON_DIFFICULTY) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WorldSession::HandleSetDungeonDifficultyOpcode: player %d sent an invalid instance mode %d!", _player->GetGUIDLow(), mode); + TC_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: player %d sent an invalid instance mode %d!", _player->GetGUIDLow(), mode); return; } @@ -1466,7 +1466,7 @@ void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket& recvData) Map* map = _player->FindMap(); if (map && map->IsDungeon()) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WorldSession::HandleSetDungeonDifficultyOpcode: player (Name: %s, GUID: %u) tried to reset the instance while player is inside!", + TC_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: player (Name: %s, GUID: %u) tried to reset the instance while player is inside!", _player->GetName().c_str(), _player->GetGUIDLow()); return; } @@ -1487,7 +1487,7 @@ void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket& recvData) if (groupGuy->GetMap()->IsNonRaidDungeon()) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WorldSession::HandleSetDungeonDifficultyOpcode: player %d tried to reset the instance while group member (Name: %s, GUID: %u) is inside!", + TC_LOG_DEBUG("network", "WorldSession::HandleSetDungeonDifficultyOpcode: player %d tried to reset the instance while group member (Name: %s, GUID: %u) is inside!", _player->GetGUIDLow(), groupGuy->GetName().c_str(), groupGuy->GetGUIDLow()); return; } @@ -1507,14 +1507,14 @@ void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket& recvData) void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "MSG_SET_RAID_DIFFICULTY"); + TC_LOG_DEBUG("network", "MSG_SET_RAID_DIFFICULTY"); uint32 mode; recvData >> mode; if (mode >= MAX_RAID_DIFFICULTY) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "WorldSession::HandleSetRaidDifficultyOpcode: player %d sent an invalid instance mode %d!", _player->GetGUIDLow(), mode); + TC_LOG_ERROR("network", "WorldSession::HandleSetRaidDifficultyOpcode: player %d sent an invalid instance mode %d!", _player->GetGUIDLow(), mode); return; } @@ -1522,7 +1522,7 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket& recvData) Map* map = _player->FindMap(); if (map && map->IsDungeon()) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WorldSession::HandleSetRaidDifficultyOpcode: player %d tried to reset the instance while inside!", _player->GetGUIDLow()); + TC_LOG_DEBUG("network", "WorldSession::HandleSetRaidDifficultyOpcode: player %d tried to reset the instance while inside!", _player->GetGUIDLow()); return; } @@ -1545,7 +1545,7 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket& recvData) if (groupGuy->GetMap()->IsRaid()) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WorldSession::HandleSetRaidDifficultyOpcode: player %d tried to reset the instance while inside!", _player->GetGUIDLow()); + TC_LOG_DEBUG("network", "WorldSession::HandleSetRaidDifficultyOpcode: player %d tried to reset the instance while inside!", _player->GetGUIDLow()); return; } } @@ -1564,7 +1564,7 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket& recvData) void WorldSession::HandleCancelMountAuraOpcode(WorldPacket& /*recvData*/) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CANCEL_MOUNT_AURA"); + TC_LOG_DEBUG("network", "WORLD: CMSG_CANCEL_MOUNT_AURA"); //If player is not mounted, so go out :) if (!_player->IsMounted()) // not blizz like; no any messages on blizz @@ -1585,7 +1585,7 @@ void WorldSession::HandleCancelMountAuraOpcode(WorldPacket& /*recvData*/) void WorldSession::HandleMoveSetCanFlyAckOpcode(WorldPacket& recvData) { // fly mode on/off - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_MOVE_SET_CAN_FLY_ACK"); + TC_LOG_DEBUG("network", "WORLD: CMSG_MOVE_SET_CAN_FLY_ACK"); uint64 guid; // guid - unused recvData.readPackGUID(guid); @@ -1604,21 +1604,21 @@ void WorldSession::HandleMoveSetCanFlyAckOpcode(WorldPacket& recvData) void WorldSession::HandleRequestPetInfoOpcode(WorldPacket& /*recvData */) { /* - TC_LOG_DEBUG(LOG_FILTER_PACKETIO, "WORLD: CMSG_REQUEST_PET_INFO"); + TC_LOG_DEBUG("network", "WORLD: CMSG_REQUEST_PET_INFO"); recvData.hexlike(); */ } void WorldSession::HandleSetTaxiBenchmarkOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_SET_TAXI_BENCHMARK_MODE"); + TC_LOG_DEBUG("network", "WORLD: CMSG_SET_TAXI_BENCHMARK_MODE"); uint8 mode; recvData >> mode; mode ? _player->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_TAXI_BENCHMARK) : _player->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_TAXI_BENCHMARK); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Client used \"/timetest %d\" command", mode); + TC_LOG_DEBUG("network", "Client used \"/timetest %d\" command", mode); } void WorldSession::HandleQueryInspectAchievements(WorldPacket& recvData) @@ -1626,7 +1626,7 @@ void WorldSession::HandleQueryInspectAchievements(WorldPacket& recvData) uint64 guid; recvData.readPackGUID(guid); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_QUERY_INSPECT_ACHIEVEMENTS [" UI64FMTD "] Inspected Player [" UI64FMTD "]", _player->GetGUID(), guid); + TC_LOG_DEBUG("network", "CMSG_QUERY_INSPECT_ACHIEVEMENTS [" UI64FMTD "] Inspected Player [" UI64FMTD "]", _player->GetGUID(), guid); Player* player = ObjectAccessor::FindPlayer(guid); if (!player) return; @@ -1637,7 +1637,7 @@ void WorldSession::HandleQueryInspectAchievements(WorldPacket& recvData) void WorldSession::HandleWorldStateUITimerUpdate(WorldPacket& /*recvData*/) { // empty opcode - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_WORLD_STATE_UI_TIMER_UPDATE"); + TC_LOG_DEBUG("network", "WORLD: CMSG_WORLD_STATE_UI_TIMER_UPDATE"); WorldPacket data(SMSG_WORLD_STATE_UI_TIMER_UPDATE, 4); data << uint32(time(NULL)); @@ -1647,7 +1647,7 @@ void WorldSession::HandleWorldStateUITimerUpdate(WorldPacket& /*recvData*/) void WorldSession::HandleReadyForAccountDataTimes(WorldPacket& /*recvData*/) { // empty opcode - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_READY_FOR_ACCOUNT_DATA_TIMES"); + TC_LOG_DEBUG("network", "WORLD: CMSG_READY_FOR_ACCOUNT_DATA_TIMES"); SendAccountDataTimes(GLOBAL_CACHE_MASK); } @@ -1661,7 +1661,7 @@ void WorldSession::SendSetPhaseShift(uint32 PhaseShift) // Battlefield and Battleground void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUERY"); + TC_LOG_DEBUG("network", "WORLD: CMSG_AREA_SPIRIT_HEALER_QUERY"); Battleground* bg = _player->GetBattleground(); @@ -1684,7 +1684,7 @@ void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket& recvData) void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUEUE"); + TC_LOG_DEBUG("network", "WORLD: CMSG_AREA_SPIRIT_HEALER_QUEUE"); Battleground* bg = _player->GetBattleground(); @@ -1732,7 +1732,7 @@ void WorldSession::HandleInstanceLockResponse(WorldPacket& recvPacket) if (!_player->HasPendingBind()) { - TC_LOG_INFO(LOG_FILTER_NETWORKIO, "InstanceLockResponse: Player %s (guid %u) tried to bind himself/teleport to graveyard without a pending bind!", + TC_LOG_INFO("network", "InstanceLockResponse: Player %s (guid %u) tried to bind himself/teleport to graveyard without a pending bind!", _player->GetName().c_str(), _player->GetGUIDLow()); return; } @@ -1747,7 +1747,7 @@ void WorldSession::HandleInstanceLockResponse(WorldPacket& recvPacket) void WorldSession::HandleUpdateMissileTrajectory(WorldPacket& recvPacket) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_UPDATE_MISSILE_TRAJECTORY"); + TC_LOG_DEBUG("network", "WORLD: CMSG_UPDATE_MISSILE_TRAJECTORY"); uint64 guid; uint32 spellId; diff --git a/src/server/game/Handlers/MovementHandler.cpp b/src/server/game/Handlers/MovementHandler.cpp index 955f6b3c456..4b53dedc363 100644 --- a/src/server/game/Handlers/MovementHandler.cpp +++ b/src/server/game/Handlers/MovementHandler.cpp @@ -35,7 +35,7 @@ void WorldSession::HandleMoveWorldportAckOpcode(WorldPacket & /*recvData*/) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: got MSG_MOVE_WORLDPORT_ACK."); + TC_LOG_DEBUG("network", "WORLD: got MSG_MOVE_WORLDPORT_ACK."); HandleMoveWorldportAckOpcode(); } @@ -70,7 +70,7 @@ void WorldSession::HandleMoveWorldportAckOpcode() if (GetPlayer()->IsInWorld()) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Player %s (GUID: %u) is still in world when teleported from map %s (%u) to new map %s (%u)", GetPlayer()->GetName().c_str(), GUID_LOPART(GetPlayer()->GetGUID()), oldMap->GetMapName(), oldMap->GetId(), newMap ? newMap->GetMapName() : "Unknown", loc.GetMapId()); + TC_LOG_ERROR("network", "Player %s (GUID: %u) is still in world when teleported from map %s (%u) to new map %s (%u)", GetPlayer()->GetName().c_str(), GUID_LOPART(GetPlayer()->GetGUID()), oldMap->GetMapName(), oldMap->GetId(), newMap ? newMap->GetMapName() : "Unknown", loc.GetMapId()); oldMap->RemovePlayerFromMap(GetPlayer(), false); } @@ -79,12 +79,15 @@ void WorldSession::HandleMoveWorldportAckOpcode() // while the player is in transit, for example the map may get full if (!newMap || !newMap->CanEnter(GetPlayer())) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Map %d (%s) could not be created for player %d (%s), porting player to homebind", loc.GetMapId(), newMap ? newMap->GetMapName() : "Unknown", GetPlayer()->GetGUIDLow(), GetPlayer()->GetName().c_str()); + TC_LOG_ERROR("network", "Map %d (%s) could not be created for player %d (%s), porting player to homebind", loc.GetMapId(), newMap ? newMap->GetMapName() : "Unknown", GetPlayer()->GetGUIDLow(), GetPlayer()->GetName().c_str()); GetPlayer()->TeleportTo(GetPlayer()->m_homebindMapId, GetPlayer()->m_homebindX, GetPlayer()->m_homebindY, GetPlayer()->m_homebindZ, GetPlayer()->GetOrientation()); return; } - else - GetPlayer()->Relocate(&loc); + + float z = loc.GetPositionZ(); + if (GetPlayer()->HasUnitMovementFlag(MOVEMENTFLAG_HOVER)) + z += GetPlayer()->GetFloatValue(UNIT_FIELD_HOVERHEIGHT); + GetPlayer()->Relocate(loc.GetPositionX(), loc.GetPositionY(), z, loc.GetOrientation()); GetPlayer()->ResetMap(); GetPlayer()->SetMap(newMap); @@ -92,7 +95,7 @@ void WorldSession::HandleMoveWorldportAckOpcode() GetPlayer()->SendInitialPacketsBeforeAddToMap(); if (!GetPlayer()->GetMap()->AddPlayerToMap(GetPlayer())) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "WORLD: failed to teleport player %s (%d) to map %d (%s) because of unknown reason!", + TC_LOG_ERROR("network", "WORLD: failed to teleport player %s (%d) to map %d (%s) because of unknown reason!", GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow(), loc.GetMapId(), newMap ? newMap->GetMapName() : "Unknown"); GetPlayer()->ResetMap(); GetPlayer()->SetMap(oldMap); @@ -193,15 +196,15 @@ void WorldSession::HandleMoveWorldportAckOpcode() void WorldSession::HandleMoveTeleportAck(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "MSG_MOVE_TELEPORT_ACK"); + TC_LOG_DEBUG("network", "MSG_MOVE_TELEPORT_ACK"); uint64 guid; recvData.readPackGUID(guid); uint32 flags, time; recvData >> flags >> time; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Guid " UI64FMTD, guid); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Flags %u, time %u", flags, time/IN_MILLISECONDS); + TC_LOG_DEBUG("network", "Guid " UI64FMTD, guid); + TC_LOG_DEBUG("network", "Flags %u, time %u", flags, time/IN_MILLISECONDS); Player* plMover = _player->m_mover->ToPlayer(); @@ -404,7 +407,7 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData) void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recvData) { uint32 opcode = recvData.GetOpcode(); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Recvd %s (%u, 0x%X) opcode", LookupOpcodeName(opcode), opcode, opcode); + TC_LOG_DEBUG("network", "WORLD: Recvd %s (%u, 0x%X) opcode", LookupOpcodeName(opcode), opcode, opcode); /* extract packet */ uint64 guid; @@ -450,7 +453,7 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recvData) case CMSG_FORCE_FLIGHT_BACK_SPEED_CHANGE_ACK: move_type = MOVE_FLIGHT_BACK; force_move_type = MOVE_FLIGHT_BACK; break; case CMSG_FORCE_PITCH_RATE_CHANGE_ACK: move_type = MOVE_PITCH_RATE; force_move_type = MOVE_PITCH_RATE; break; default: - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "WorldSession::HandleForceSpeedChangeAck: Unknown move type opcode: %u", opcode); + TC_LOG_ERROR("network", "WorldSession::HandleForceSpeedChangeAck: Unknown move type opcode: %u", opcode); return; } @@ -467,13 +470,13 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recvData) { if (_player->GetSpeed(move_type) > newspeed) // must be greater - just correct { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "%sSpeedChange player %s is NOT correct (must be %f instead %f), force set to correct value", + TC_LOG_ERROR("network", "%sSpeedChange player %s is NOT correct (must be %f instead %f), force set to correct value", move_type_name[move_type], _player->GetName().c_str(), _player->GetSpeed(move_type), newspeed); _player->SetSpeed(move_type, _player->GetSpeedRate(move_type), true); } else // must be lesser - cheating { - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "Player %s from account id %u kicked for incorrect speed (must be %f instead %f)", + TC_LOG_DEBUG("misc", "Player %s from account id %u kicked for incorrect speed (must be %f instead %f)", _player->GetName().c_str(), _player->GetSession()->GetAccountId(), _player->GetSpeed(move_type), newspeed); _player->GetSession()->KickPlayer(); } @@ -482,7 +485,7 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recvData) void WorldSession::HandleSetActiveMoverOpcode(WorldPacket &recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_SET_ACTIVE_MOVER"); + TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_SET_ACTIVE_MOVER"); uint64 guid; recvData >> guid; @@ -490,13 +493,13 @@ void WorldSession::HandleSetActiveMoverOpcode(WorldPacket &recvData) if (GetPlayer()->IsInWorld()) { if (_player->m_mover->GetGUID() != guid) - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "HandleSetActiveMoverOpcode: incorrect mover guid: mover is " UI64FMTD " (%s - Entry: %u) and should be " UI64FMTD, guid, GetLogNameForGuid(guid), GUID_ENPART(guid), _player->m_mover->GetGUID()); + TC_LOG_ERROR("network", "HandleSetActiveMoverOpcode: incorrect mover guid: mover is " UI64FMTD " (%s - Entry: %u) and should be " UI64FMTD, guid, GetLogNameForGuid(guid), GUID_ENPART(guid), _player->m_mover->GetGUID()); } } void WorldSession::HandleMoveNotActiveMover(WorldPacket &recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_MOVE_NOT_ACTIVE_MOVER"); + TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_MOVE_NOT_ACTIVE_MOVER"); uint64 old_mover_guid; recvData.readPackGUID(old_mover_guid); @@ -519,7 +522,7 @@ void WorldSession::HandleMountSpecialAnimOpcode(WorldPacket& /*recvData*/) void WorldSession::HandleMoveKnockBackAck(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_MOVE_KNOCK_BACK_ACK"); + TC_LOG_DEBUG("network", "CMSG_MOVE_KNOCK_BACK_ACK"); uint64 guid; recvData.readPackGUID(guid); @@ -549,7 +552,7 @@ void WorldSession::HandleMoveKnockBackAck(WorldPacket& recvData) void WorldSession::HandleMoveHoverAck(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_MOVE_HOVER_ACK"); + TC_LOG_DEBUG("network", "CMSG_MOVE_HOVER_ACK"); uint64 guid; // guid - unused recvData.readPackGUID(guid); @@ -564,7 +567,7 @@ void WorldSession::HandleMoveHoverAck(WorldPacket& recvData) void WorldSession::HandleMoveWaterWalkAck(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_MOVE_WATER_WALK_ACK"); + TC_LOG_DEBUG("network", "CMSG_MOVE_WATER_WALK_ACK"); uint64 guid; // guid - unused recvData.readPackGUID(guid); diff --git a/src/server/game/Handlers/NPCHandler.cpp b/src/server/game/Handlers/NPCHandler.cpp index e3921eec02f..39489e75ab3 100644 --- a/src/server/game/Handlers/NPCHandler.cpp +++ b/src/server/game/Handlers/NPCHandler.cpp @@ -56,7 +56,7 @@ void WorldSession::HandleTabardVendorActivateOpcode(WorldPacket& recvData) Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TABARDDESIGNER); if (!unit) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: HandleTabardVendorActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: HandleTabardVendorActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid))); return; } @@ -78,14 +78,14 @@ void WorldSession::HandleBankerActivateOpcode(WorldPacket& recvData) { uint64 guid; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_BANKER_ACTIVATE"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_BANKER_ACTIVATE"); recvData >> guid; Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_BANKER); if (!unit) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: HandleBankerActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: HandleBankerActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid))); return; } @@ -119,12 +119,12 @@ void WorldSession::SendTrainerList(uint64 guid) void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: SendTrainerList"); + TC_LOG_DEBUG("network", "WORLD: SendTrainerList"); Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TRAINER); if (!unit) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: SendTrainerList - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: SendTrainerList - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid))); return; } @@ -136,14 +136,14 @@ void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle) if (!ci) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: SendTrainerList - (GUID: %u) NO CREATUREINFO!", GUID_LOPART(guid)); + TC_LOG_DEBUG("network", "WORLD: SendTrainerList - (GUID: %u) NO CREATUREINFO!", GUID_LOPART(guid)); return; } TrainerSpellData const* trainer_spells = unit->GetTrainerSpells(); if (!trainer_spells) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: SendTrainerList - Training spells not found for creature (GUID: %u Entry: %u)", + TC_LOG_DEBUG("network", "WORLD: SendTrainerList - Training spells not found for creature (GUID: %u Entry: %u)", GUID_LOPART(guid), unit->GetEntry()); return; } @@ -237,12 +237,12 @@ void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket& recvData) uint32 spellId = 0; recvData >> guid >> spellId; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_TRAINER_BUY_SPELL NpcGUID=%u, learn spell id is: %u", uint32(GUID_LOPART(guid)), spellId); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_TRAINER_BUY_SPELL NpcGUID=%u, learn spell id is: %u", uint32(GUID_LOPART(guid)), spellId); Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TRAINER); if (!unit) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: HandleTrainerBuySpellOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: HandleTrainerBuySpellOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid))); return; } @@ -290,7 +290,7 @@ void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket& recvData) void WorldSession::HandleGossipHelloOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GOSSIP_HELLO"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_GOSSIP_HELLO"); uint64 guid; recvData >> guid; @@ -298,7 +298,7 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket& recvData) Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE); if (!unit) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: HandleGossipHelloOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: HandleGossipHelloOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid))); return; } @@ -339,7 +339,7 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket& recvData) /*void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_PACKETIO, "WORLD: CMSG_GOSSIP_SELECT_OPTION"); + TC_LOG_DEBUG("network", "WORLD: CMSG_GOSSIP_SELECT_OPTION"); uint32 option; uint32 unk; @@ -350,15 +350,15 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket& recvData) if (_player->PlayerTalkClass->GossipOptionCoded(option)) { - TC_LOG_DEBUG(LOG_FILTER_PACKETIO, "reading string"); + TC_LOG_DEBUG("network", "reading string"); recvData >> code; - TC_LOG_DEBUG(LOG_FILTER_PACKETIO, "string read: %s", code.c_str()); + TC_LOG_DEBUG("network", "string read: %s", code.c_str()); } Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE); if (!unit) { - TC_LOG_DEBUG(LOG_FILTER_PACKETIO, "WORLD: HandleGossipSelectOptionOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: HandleGossipSelectOptionOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); return; } @@ -380,7 +380,7 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket& recvData) void WorldSession::HandleSpiritHealerActivateOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_SPIRIT_HEALER_ACTIVATE"); + TC_LOG_DEBUG("network", "WORLD: CMSG_SPIRIT_HEALER_ACTIVATE"); uint64 guid; @@ -389,7 +389,7 @@ void WorldSession::HandleSpiritHealerActivateOpcode(WorldPacket& recvData) Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_SPIRITHEALER); if (!unit) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: HandleSpiritHealerActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: HandleSpiritHealerActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid))); return; } @@ -444,7 +444,7 @@ void WorldSession::HandleBinderActivateOpcode(WorldPacket& recvData) Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID, UNIT_NPC_FLAG_INNKEEPER); if (!unit) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: HandleBinderActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(npcGUID))); + TC_LOG_DEBUG("network", "WORLD: HandleBinderActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(npcGUID))); return; } @@ -476,7 +476,7 @@ void WorldSession::SendBindPoint(Creature* npc) void WorldSession::HandleListStabledPetsOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Recv MSG_LIST_STABLED_PETS"); + TC_LOG_DEBUG("network", "WORLD: Recv MSG_LIST_STABLED_PETS"); uint64 npcGUID; recvData >> npcGUID; @@ -512,7 +512,7 @@ void WorldSession::SendStablePetCallback(PreparedQueryResult result, uint64 guid if (!GetPlayer()) return; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Recv MSG_LIST_STABLED_PETS Send."); + TC_LOG_DEBUG("network", "WORLD: Recv MSG_LIST_STABLED_PETS Send."); WorldPacket data(MSG_LIST_STABLED_PETS, 200); // guess size @@ -569,7 +569,7 @@ void WorldSession::SendStableResult(uint8 res) void WorldSession::HandleStablePet(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Recv CMSG_STABLE_PET"); + TC_LOG_DEBUG("network", "WORLD: Recv CMSG_STABLE_PET"); uint64 npcGUID; recvData >> npcGUID; @@ -644,7 +644,7 @@ void WorldSession::HandleStablePetCallback(PreparedQueryResult result) void WorldSession::HandleUnstablePet(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Recv CMSG_UNSTABLE_PET."); + TC_LOG_DEBUG("network", "WORLD: Recv CMSG_UNSTABLE_PET."); uint64 npcGUID; uint32 petnumber; @@ -725,7 +725,7 @@ void WorldSession::HandleUnstablePetCallback(PreparedQueryResult result, uint32 void WorldSession::HandleBuyStableSlot(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Recv CMSG_BUY_STABLE_SLOT."); + TC_LOG_DEBUG("network", "WORLD: Recv CMSG_BUY_STABLE_SLOT."); uint64 npcGUID; recvData >> npcGUID; @@ -758,12 +758,12 @@ void WorldSession::HandleBuyStableSlot(WorldPacket& recvData) void WorldSession::HandleStableRevivePet(WorldPacket &/* recvData */) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "HandleStableRevivePet: Not implemented"); + TC_LOG_DEBUG("network", "HandleStableRevivePet: Not implemented"); } void WorldSession::HandleStableSwapPet(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Recv CMSG_STABLE_SWAP_PET."); + TC_LOG_DEBUG("network", "WORLD: Recv CMSG_STABLE_SWAP_PET."); uint64 npcGUID; uint32 petId; @@ -855,7 +855,7 @@ void WorldSession::HandleStableSwapPetCallback(PreparedQueryResult result, uint3 void WorldSession::HandleRepairItemOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_REPAIR_ITEM"); + TC_LOG_DEBUG("network", "WORLD: CMSG_REPAIR_ITEM"); uint64 npcGUID, itemGUID; uint8 guildBank; // new in 2.3.2, bool that means from guild bank money @@ -865,7 +865,7 @@ void WorldSession::HandleRepairItemOpcode(WorldPacket& recvData) Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID, UNIT_NPC_FLAG_REPAIR); if (!unit) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: HandleRepairItemOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(npcGUID))); + TC_LOG_DEBUG("network", "WORLD: HandleRepairItemOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(npcGUID))); return; } @@ -878,7 +878,7 @@ void WorldSession::HandleRepairItemOpcode(WorldPacket& recvData) if (itemGUID) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "ITEM: Repair item, itemGUID = %u, npcGUID = %u", GUID_LOPART(itemGUID), GUID_LOPART(npcGUID)); + TC_LOG_DEBUG("network", "ITEM: Repair item, itemGUID = %u, npcGUID = %u", GUID_LOPART(itemGUID), GUID_LOPART(npcGUID)); Item* item = _player->GetItemByGuid(itemGUID); if (item) @@ -886,7 +886,7 @@ void WorldSession::HandleRepairItemOpcode(WorldPacket& recvData) } else { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "ITEM: Repair all items, npcGUID = %u", GUID_LOPART(npcGUID)); + TC_LOG_DEBUG("network", "ITEM: Repair all items, npcGUID = %u", GUID_LOPART(npcGUID)); _player->DurabilityRepairAll(true, discountMod, guildBank); } } diff --git a/src/server/game/Handlers/PetHandler.cpp b/src/server/game/Handlers/PetHandler.cpp index 0badd503c17..d57308d359a 100644 --- a/src/server/game/Handlers/PetHandler.cpp +++ b/src/server/game/Handlers/PetHandler.cpp @@ -38,13 +38,13 @@ void WorldSession::HandleDismissCritter(WorldPacket& recvData) uint64 guid; recvData >> guid; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_DISMISS_CRITTER for GUID " UI64FMTD, guid); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_DISMISS_CRITTER for GUID " UI64FMTD, guid); Unit* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, guid); if (!pet) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Vanitypet (guid: %u) does not exist - player '%s' (guid: %u / account: %u) attempted to dismiss it (possibly lagged out)", + TC_LOG_DEBUG("network", "Vanitypet (guid: %u) does not exist - player '%s' (guid: %u / account: %u) attempted to dismiss it (possibly lagged out)", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow(), GetAccountId()); return; } @@ -70,17 +70,17 @@ void WorldSession::HandlePetAction(WorldPacket& recvData) // used also for charmed creature Unit* pet= ObjectAccessor::GetUnit(*_player, guid1); - TC_LOG_INFO(LOG_FILTER_NETWORKIO, "HandlePetAction: Pet %u - flag: %u, spellid: %u, target: %u.", uint32(GUID_LOPART(guid1)), uint32(flag), spellid, uint32(GUID_LOPART(guid2))); + TC_LOG_INFO("network", "HandlePetAction: Pet %u - flag: %u, spellid: %u, target: %u.", uint32(GUID_LOPART(guid1)), uint32(flag), spellid, uint32(GUID_LOPART(guid2))); if (!pet) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "HandlePetAction: Pet (GUID: %u) doesn't exist for player %s (GUID: %u)", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName().c_str(), GUID_LOPART(GetPlayer()->GetGUID())); + TC_LOG_ERROR("network", "HandlePetAction: Pet (GUID: %u) doesn't exist for player %s (GUID: %u)", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName().c_str(), GUID_LOPART(GetPlayer()->GetGUID())); return; } if (pet != GetPlayer()->GetFirstControlled()) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "HandlePetAction: Pet (GUID: %u) does not belong to player %s (GUID: %u)", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName().c_str(), GUID_LOPART(GetPlayer()->GetGUID())); + TC_LOG_ERROR("network", "HandlePetAction: Pet (GUID: %u) does not belong to player %s (GUID: %u)", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName().c_str(), GUID_LOPART(GetPlayer()->GetGUID())); return; } @@ -116,19 +116,19 @@ void WorldSession::HandlePetStopAttack(WorldPacket &recvData) uint64 guid; recvData >> guid; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_PET_STOP_ATTACK for GUID " UI64FMTD "", guid); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_PET_STOP_ATTACK for GUID " UI64FMTD "", guid); Unit* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, guid); if (!pet) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "HandlePetStopAttack: Pet %u does not exist", uint32(GUID_LOPART(guid))); + TC_LOG_ERROR("network", "HandlePetStopAttack: Pet %u does not exist", uint32(GUID_LOPART(guid))); return; } if (pet != GetPlayer()->GetPet() && pet != GetPlayer()->GetCharm()) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "HandlePetStopAttack: Pet GUID %u isn't a pet or charmed creature of player %s", + TC_LOG_ERROR("network", "HandlePetStopAttack: Pet GUID %u isn't a pet or charmed creature of player %s", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str()); return; } @@ -144,8 +144,8 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint32 spellid CharmInfo* charmInfo = pet->GetCharmInfo(); if (!charmInfo) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "WorldSession::HandlePetAction(petGuid: " UI64FMTD ", tagGuid: " UI64FMTD ", spellId: %u, flag: %u): object (entry: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", - guid1, guid2, spellid, flag, pet->GetGUIDLow(), pet->GetTypeId()); + TC_LOG_ERROR("network", "WorldSession::HandlePetAction(petGuid: " UI64FMTD ", tagGuid: " UI64FMTD ", spellId: %u, flag: %u): object (GUID: %u Entry: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", + guid1, guid2, spellid, flag, pet->GetGUIDLow(), pet->GetEntry(), pet->GetTypeId()); return; } @@ -262,7 +262,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint32 spellid } break; default: - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "WORLD: unknown PET flag Action %i and spellid %i.", uint32(flag), spellid); + TC_LOG_ERROR("network", "WORLD: unknown PET flag Action %i and spellid %i.", uint32(flag), spellid); } break; case ACT_REACTION: // 0x6 @@ -291,7 +291,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint32 spellid SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid); if (!spellInfo) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "WORLD: unknown PET spell id %i", spellid); + TC_LOG_ERROR("network", "WORLD: unknown PET spell id %i", spellid); return; } @@ -392,13 +392,13 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint32 spellid break; } default: - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "WORLD: unknown PET flag Action %i and spellid %i.", uint32(flag), spellid); + TC_LOG_ERROR("network", "WORLD: unknown PET flag Action %i and spellid %i.", uint32(flag), spellid); } } void WorldSession::HandlePetNameQuery(WorldPacket& recvData) { - TC_LOG_INFO(LOG_FILTER_NETWORKIO, "HandlePetNameQuery. CMSG_PET_NAME_QUERY"); + TC_LOG_INFO("network", "HandlePetNameQuery. CMSG_PET_NAME_QUERY"); uint32 petnumber; uint64 petguid; @@ -447,7 +447,7 @@ bool WorldSession::CheckStableMaster(uint64 guid) { if (!GetPlayer()->IsGameMaster() && !GetPlayer()->HasAuraType(SPELL_AURA_OPEN_STABLE)) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Player (GUID:%u) attempt open stable in cheating way.", GUID_LOPART(guid)); + TC_LOG_DEBUG("network", "Player (GUID:%u) attempt open stable in cheating way.", GUID_LOPART(guid)); return false; } } @@ -456,7 +456,7 @@ bool WorldSession::CheckStableMaster(uint64 guid) { if (!GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_STABLEMASTER)) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Stablemaster (GUID:%u) not found or you can't interact with him.", GUID_LOPART(guid)); + TC_LOG_DEBUG("network", "Stablemaster (GUID:%u) not found or you can't interact with him.", GUID_LOPART(guid)); return false; } } @@ -465,7 +465,7 @@ bool WorldSession::CheckStableMaster(uint64 guid) void WorldSession::HandlePetSetAction(WorldPacket& recvData) { - TC_LOG_INFO(LOG_FILTER_NETWORKIO, "HandlePetSetAction. CMSG_PET_SET_ACTION"); + TC_LOG_INFO("network", "HandlePetSetAction. CMSG_PET_SET_ACTION"); uint64 petguid; uint8 count; @@ -476,14 +476,14 @@ void WorldSession::HandlePetSetAction(WorldPacket& recvData) if (!pet || pet != _player->GetFirstControlled()) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "HandlePetSetAction: Unknown pet (GUID: %u) or pet owner (GUID: %u)", GUID_LOPART(petguid), _player->GetGUIDLow()); + TC_LOG_ERROR("network", "HandlePetSetAction: Unknown pet (GUID: %u) or pet owner (GUID: %u)", GUID_LOPART(petguid), _player->GetGUIDLow()); return; } CharmInfo* charmInfo = pet->GetCharmInfo(); if (!charmInfo) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "WorldSession::HandlePetSetAction: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId()); + TC_LOG_ERROR("network", "WorldSession::HandlePetSetAction: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId()); return; } @@ -545,7 +545,7 @@ void WorldSession::HandlePetSetAction(WorldPacket& recvData) uint32 spell_id = UNIT_ACTION_BUTTON_ACTION(data[i]); uint8 act_state = UNIT_ACTION_BUTTON_TYPE(data[i]); - TC_LOG_INFO(LOG_FILTER_NETWORKIO, "Player %s has changed pet spell action. Position: %u, Spell: %u, State: 0x%X", + TC_LOG_INFO("network", "Player %s has changed pet spell action. Position: %u, Spell: %u, State: 0x%X", _player->GetName().c_str(), position[i], spell_id, uint32(act_state)); //if it's act for spell (en/disable/cast) and there is a spell given (0 = remove spell) which pet doesn't know, don't add @@ -582,7 +582,7 @@ void WorldSession::HandlePetSetAction(WorldPacket& recvData) void WorldSession::HandlePetRename(WorldPacket& recvData) { - TC_LOG_INFO(LOG_FILTER_NETWORKIO, "HandlePetRename. CMSG_PET_RENAME"); + TC_LOG_INFO("network", "HandlePetRename. CMSG_PET_RENAME"); uint64 petguid; uint8 isdeclined; @@ -671,7 +671,7 @@ void WorldSession::HandlePetAbandon(WorldPacket& recvData) { uint64 guid; recvData >> guid; //pet guid - TC_LOG_INFO(LOG_FILTER_NETWORKIO, "HandlePetAbandon. CMSG_PET_ABANDON pet guid is %u", GUID_LOPART(guid)); + TC_LOG_INFO("network", "HandlePetAbandon. CMSG_PET_ABANDON pet guid is %u", GUID_LOPART(guid)); if (!_player->IsInWorld()) return; @@ -697,7 +697,7 @@ void WorldSession::HandlePetAbandon(WorldPacket& recvData) void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket) { - TC_LOG_INFO(LOG_FILTER_NETWORKIO, "CMSG_PET_SPELL_AUTOCAST"); + TC_LOG_INFO("network", "CMSG_PET_SPELL_AUTOCAST"); uint64 guid; uint32 spellid; uint8 state; //1 for on, 0 for off @@ -713,11 +713,17 @@ void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket) if (!pet || (pet != _player->GetGuardianPet() && pet != _player->GetCharm())) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "HandlePetSpellAutocastOpcode.Pet %u isn't pet of player %s (GUID: %u).", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str(), GUID_LOPART(GetPlayer()->GetGUID())); + TC_LOG_ERROR("network", "HandlePetSpellAutocastOpcode.Pet %u isn't pet of player %s (GUID: %u).", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str(), GUID_LOPART(GetPlayer()->GetGUID())); return; } SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid); + if (!spellInfo) + { + TC_LOG_ERROR("network", "WORLD: unknown PET spell id %u", spellid); + return; + } + // do not add not learned spells/ passive spells if (!pet->HasSpell(spellid) || !spellInfo->IsAutocastable()) return; @@ -725,7 +731,7 @@ void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket) CharmInfo* charmInfo = pet->GetCharmInfo(); if (!charmInfo) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "WorldSession::HandlePetSpellAutocastOpcod: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId()); + TC_LOG_ERROR("network", "WorldSession::HandlePetSpellAutocastOpcod: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId()); return; } @@ -739,7 +745,7 @@ void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket) void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_PET_CAST_SPELL"); + TC_LOG_DEBUG("network", "WORLD: CMSG_PET_CAST_SPELL"); uint64 guid; uint8 castCount; @@ -748,7 +754,7 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket) recvPacket >> guid >> castCount >> spellId >> castFlags; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_PET_CAST_SPELL, guid: " UI64FMTD ", castCount: %u, spellId %u, castFlags %u", guid, castCount, spellId, castFlags); + TC_LOG_DEBUG("network", "WORLD: CMSG_PET_CAST_SPELL, guid: " UI64FMTD ", castCount: %u, spellId %u, castFlags %u", guid, castCount, spellId, castFlags); // This opcode is also sent from charmed and possessed units (players and creatures) if (!_player->GetGuardianPet() && !_player->GetCharm()) @@ -758,14 +764,14 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket) if (!caster || (caster != _player->GetGuardianPet() && caster != _player->GetCharm())) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "HandlePetCastSpellOpcode: Pet %u isn't pet of player %s (GUID: %u).", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str(), GUID_LOPART(GetPlayer()->GetGUID())); + TC_LOG_ERROR("network", "HandlePetCastSpellOpcode: Pet %u isn't pet of player %s (GUID: %u).", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str(), GUID_LOPART(GetPlayer()->GetGUID())); return; } SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); if (!spellInfo) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "WORLD: unknown PET spell id %i", spellId); + TC_LOG_ERROR("network", "WORLD: unknown PET spell id %i", spellId); return; } @@ -841,7 +847,7 @@ void WorldSession::SendPetNameInvalid(uint32 error, const std::string& name, Dec void WorldSession::HandlePetLearnTalent(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_PET_LEARN_TALENT"); + TC_LOG_DEBUG("network", "WORLD: CMSG_PET_LEARN_TALENT"); uint64 guid; uint32 talentId, requestedRank; @@ -853,7 +859,7 @@ void WorldSession::HandlePetLearnTalent(WorldPacket& recvData) void WorldSession::HandleLearnPreviewTalentsPet(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_LEARN_PREVIEW_TALENTS_PET"); + TC_LOG_DEBUG("network", "CMSG_LEARN_PREVIEW_TALENTS_PET"); uint64 guid; recvData >> guid; diff --git a/src/server/game/Handlers/PetitionsHandler.cpp b/src/server/game/Handlers/PetitionsHandler.cpp index 3b2a76a4b04..23cd0bdfd94 100644 --- a/src/server/game/Handlers/PetitionsHandler.cpp +++ b/src/server/game/Handlers/PetitionsHandler.cpp @@ -52,7 +52,7 @@ enum CharterCosts void WorldSession::HandlePetitionBuyOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Received opcode CMSG_PETITION_BUY"); + TC_LOG_DEBUG("network", "Received opcode CMSG_PETITION_BUY"); uint64 guidNPC; uint32 clientIndex; // 1 for guild and arenaslot+1 for arenas in client @@ -81,13 +81,13 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket& recvData) recvData >> clientIndex; // index recvData.read_skip<uint32>(); // 0 - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Petitioner with GUID %u tried sell petition: name %s", GUID_LOPART(guidNPC), name.c_str()); + TC_LOG_DEBUG("network", "Petitioner with GUID %u tried sell petition: name %s", GUID_LOPART(guidNPC), name.c_str()); // prevent cheating Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guidNPC, UNIT_NPC_FLAG_PETITIONER); if (!creature) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: HandlePetitionBuyOpcode - Unit (GUID: %u) not found or you can't interact with him.", GUID_LOPART(guidNPC)); + TC_LOG_DEBUG("network", "WORLD: HandlePetitionBuyOpcode - Unit (GUID: %u) not found or you can't interact with him.", GUID_LOPART(guidNPC)); return; } @@ -136,7 +136,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket& recvData) type = ARENA_TEAM_CHARTER_5v5_TYPE; break; default: - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "unknown selection at buy arena petition: %u", clientIndex); + TC_LOG_DEBUG("network", "unknown selection at buy arena petition: %u", clientIndex); return; } @@ -229,7 +229,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket& recvData) // delete petitions with the same guid as this one ssInvalidPetitionGUIDs << '\'' << charter->GetGUIDLow() << '\''; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Invalid petition GUIDs: %s", ssInvalidPetitionGUIDs.str().c_str()); + TC_LOG_DEBUG("network", "Invalid petition GUIDs: %s", ssInvalidPetitionGUIDs.str().c_str()); CharacterDatabase.EscapeString(name); SQLTransaction trans = CharacterDatabase.BeginTransaction(); trans->PAppend("DELETE FROM petition WHERE petitionguid IN (%s)", ssInvalidPetitionGUIDs.str().c_str()); @@ -247,7 +247,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket& recvData) void WorldSession::HandlePetitionShowSignOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Received opcode CMSG_PETITION_SHOW_SIGNATURES"); + TC_LOG_DEBUG("network", "Received opcode CMSG_PETITION_SHOW_SIGNATURES"); uint8 signs = 0; uint64 petitionguid; @@ -264,7 +264,7 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket& recvData) if (!result) { - TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "Petition %u is not found for player %u %s", GUID_LOPART(petitionguid), GetPlayer()->GetGUIDLow(), GetPlayer()->GetName().c_str()); + TC_LOG_DEBUG("entities.player.items", "Petition %u is not found for player %u %s", GUID_LOPART(petitionguid), GetPlayer()->GetGUIDLow(), GetPlayer()->GetName().c_str()); return; } Field* fields = result->Fetch(); @@ -284,7 +284,7 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket& recvData) if (result) signs = uint8(result->GetRowCount()); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_PETITION_SHOW_SIGNATURES petition entry: '%u'", petitionGuidLow); + TC_LOG_DEBUG("network", "CMSG_PETITION_SHOW_SIGNATURES petition entry: '%u'", petitionGuidLow); WorldPacket data(SMSG_PETITION_SHOW_SIGNATURES, (8+8+4+1+signs*12)); data << uint64(petitionguid); // petition guid @@ -307,13 +307,13 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket& recvData) void WorldSession::HandlePetitionQueryOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Received opcode CMSG_PETITION_QUERY"); // ok + TC_LOG_DEBUG("network", "Received opcode CMSG_PETITION_QUERY"); // ok uint32 guildguid; uint64 petitionguid; recvData >> guildguid; // in Trinity always same as GUID_LOPART(petitionguid) recvData >> petitionguid; // petition guid - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_PETITION_QUERY Petition GUID %u Guild GUID %u", GUID_LOPART(petitionguid), guildguid); + TC_LOG_DEBUG("network", "CMSG_PETITION_QUERY Petition GUID %u Guild GUID %u", GUID_LOPART(petitionguid), guildguid); SendPetitionQueryOpcode(petitionguid); } @@ -339,7 +339,7 @@ void WorldSession::SendPetitionQueryOpcode(uint64 petitionguid) } else { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_PETITION_QUERY failed for petition (GUID: %u)", GUID_LOPART(petitionguid)); + TC_LOG_DEBUG("network", "CMSG_PETITION_QUERY failed for petition (GUID: %u)", GUID_LOPART(petitionguid)); return; } @@ -382,7 +382,7 @@ void WorldSession::SendPetitionQueryOpcode(uint64 petitionguid) void WorldSession::HandlePetitionRenameOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Received opcode MSG_PETITION_RENAME"); // ok + TC_LOG_DEBUG("network", "Received opcode MSG_PETITION_RENAME"); // ok uint64 petitionGuid; uint32 type; @@ -408,7 +408,7 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket& recvData) } else { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_PETITION_QUERY failed for petition (GUID: %u)", GUID_LOPART(petitionGuid)); + TC_LOG_DEBUG("network", "CMSG_PETITION_QUERY failed for petition (GUID: %u)", GUID_LOPART(petitionGuid)); return; } @@ -446,7 +446,7 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket& recvData) CharacterDatabase.Execute(stmt); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Petition (GUID: %u) renamed to '%s'", GUID_LOPART(petitionGuid), newName.c_str()); + TC_LOG_DEBUG("network", "Petition (GUID: %u) renamed to '%s'", GUID_LOPART(petitionGuid), newName.c_str()); WorldPacket data(MSG_PETITION_RENAME, (8+newName.size()+1)); data << uint64(petitionGuid); data << newName; @@ -455,7 +455,7 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket& recvData) void WorldSession::HandlePetitionSignOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Received opcode CMSG_PETITION_SIGN"); // ok + TC_LOG_DEBUG("network", "Received opcode CMSG_PETITION_SIGN"); // ok Field* fields; uint64 petitionGuid; @@ -472,7 +472,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket& recvData) if (!result) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Petition %u is not found for player %u %s", GUID_LOPART(petitionGuid), GetPlayer()->GetGUIDLow(), GetPlayer()->GetName().c_str()); + TC_LOG_ERROR("network", "Petition %u is not found for player %u %s", GUID_LOPART(petitionGuid), GetPlayer()->GetGUIDLow(), GetPlayer()->GetName().c_str()); return; } @@ -570,7 +570,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket& recvData) CharacterDatabase.Execute(stmt); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "PETITION SIGN: GUID %u by player: %s (GUID: %u Account: %u)", GUID_LOPART(petitionGuid), _player->GetName().c_str(), playerGuid, GetAccountId()); + TC_LOG_DEBUG("network", "PETITION SIGN: GUID %u by player: %s (GUID: %u Account: %u)", GUID_LOPART(petitionGuid), _player->GetName().c_str(), playerGuid, GetAccountId()); WorldPacket data(SMSG_PETITION_SIGN_RESULTS, (8+8+4)); data << uint64(petitionGuid); @@ -592,12 +592,12 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket& recvData) void WorldSession::HandlePetitionDeclineOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Received opcode MSG_PETITION_DECLINE"); // ok + TC_LOG_DEBUG("network", "Received opcode MSG_PETITION_DECLINE"); // ok uint64 petitionguid; uint64 ownerguid; recvData >> petitionguid; // petition guid - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Petition %u declined by %u", GUID_LOPART(petitionguid), _player->GetGUIDLow()); + TC_LOG_DEBUG("network", "Petition %u declined by %u", GUID_LOPART(petitionguid), _player->GetGUIDLow()); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_OWNER_BY_GUID); @@ -622,7 +622,7 @@ void WorldSession::HandlePetitionDeclineOpcode(WorldPacket& recvData) void WorldSession::HandleOfferPetitionOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Received opcode CMSG_OFFER_PETITION"); // ok + TC_LOG_DEBUG("network", "Received opcode CMSG_OFFER_PETITION"); // ok uint8 signs = 0; uint64 petitionguid, plguid; @@ -648,7 +648,7 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket& recvData) Field* fields = result->Fetch(); type = fields[0].GetUInt8(); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "OFFER PETITION: type %u, GUID1 %u, to player id: %u", type, GUID_LOPART(petitionguid), GUID_LOPART(plguid)); + TC_LOG_DEBUG("network", "OFFER PETITION: type %u, GUID1 %u, to player id: %u", type, GUID_LOPART(petitionguid), GUID_LOPART(plguid)); if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && GetPlayer()->GetTeam() != player->GetTeam()) { @@ -731,7 +731,7 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket& recvData) void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Received opcode CMSG_TURN_IN_PETITION"); + TC_LOG_DEBUG("network", "Received opcode CMSG_TURN_IN_PETITION"); // Get petition guid from packet WorldPacket data; @@ -744,7 +744,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData) if (!item) return; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Petition %u turned in by %u", GUID_LOPART(petitionGuid), _player->GetGUIDLow()); + TC_LOG_DEBUG("network", "Petition %u turned in by %u", GUID_LOPART(petitionGuid), _player->GetGUIDLow()); // Get petition data from db uint32 ownerguidlo; @@ -764,7 +764,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData) } else { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Player %s (guid: %u) tried to turn in petition (guid: %u) that is not present in the database", _player->GetName().c_str(), _player->GetGUIDLow(), GUID_LOPART(petitionGuid)); + TC_LOG_ERROR("network", "Player %s (guid: %u) tried to turn in petition (guid: %u) that is not present in the database", _player->GetName().c_str(), _player->GetGUIDLow(), GUID_LOPART(petitionGuid)); return; } @@ -886,14 +886,14 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData) // Register arena team sArenaTeamMgr->AddArenaTeam(arenaTeam); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "PetitonsHandler: Arena team (guid: %u) added to ObjectMgr", arenaTeam->GetId()); + TC_LOG_DEBUG("network", "PetitonsHandler: Arena team (guid: %u) added to ObjectMgr", arenaTeam->GetId()); // Add members for (uint8 i = 0; i < signatures; ++i) { Field* fields = result->Fetch(); uint32 memberGUID = fields[0].GetUInt32(); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "PetitionsHandler: Adding arena team (guid: %u) member %u", arenaTeam->GetId(), memberGUID); + TC_LOG_DEBUG("network", "PetitionsHandler: Adding arena team (guid: %u) member %u", arenaTeam->GetId(), memberGUID); arenaTeam->AddMember(MAKE_NEW_GUID(memberGUID, 0, HIGHGUID_PLAYER)); result->NextRow(); } @@ -912,7 +912,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData) CharacterDatabase.CommitTransaction(trans); // created - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "TURN IN PETITION GUID %u", GUID_LOPART(petitionGuid)); + TC_LOG_DEBUG("network", "TURN IN PETITION GUID %u", GUID_LOPART(petitionGuid)); data.Initialize(SMSG_TURN_IN_PETITION_RESULTS, 4); data << (uint32)PETITION_TURN_OK; @@ -921,7 +921,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData) void WorldSession::HandlePetitionShowListOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Received CMSG_PETITION_SHOWLIST"); + TC_LOG_DEBUG("network", "Received CMSG_PETITION_SHOWLIST"); uint64 guid; recvData >> guid; @@ -934,7 +934,7 @@ void WorldSession::SendPetitionShowList(uint64 guid) Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_PETITIONER); if (!creature) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: HandlePetitionShowListOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: HandlePetitionShowListOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); return; } @@ -978,5 +978,5 @@ void WorldSession::SendPetitionShowList(uint64 guid) } SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Sent SMSG_PETITION_SHOWLIST"); + TC_LOG_DEBUG("network", "Sent SMSG_PETITION_SHOWLIST"); } diff --git a/src/server/game/Handlers/QueryHandler.cpp b/src/server/game/Handlers/QueryHandler.cpp index 4638e05ee3d..01dbf201a82 100644 --- a/src/server/game/Handlers/QueryHandler.cpp +++ b/src/server/game/Handlers/QueryHandler.cpp @@ -70,7 +70,7 @@ void WorldSession::HandleNameQueryOpcode(WorldPacket& recvData) recvData >> guid; // This is disable by default to prevent lots of console spam - // TC_LOG_INFO(LOG_FILTER_NETWORKIO, "HandleNameQueryOpcode %u", guid); + // TC_LOG_INFO("network", "HandleNameQueryOpcode %u", guid); SendNameQueryOpcode(guid); } @@ -113,7 +113,7 @@ void WorldSession::HandleCreatureQueryOpcode(WorldPacket& recvData) ObjectMgr::GetLocaleString(cl->SubName, loc_idx, SubName); } } - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CREATURE_QUERY '%s' - Entry: %u.", ci->Name.c_str(), entry); + TC_LOG_DEBUG("network", "WORLD: CMSG_CREATURE_QUERY '%s' - Entry: %u.", ci->Name.c_str(), entry); // guess size WorldPacket data(SMSG_CREATURE_QUERY_RESPONSE, 100); data << uint32(entry); // creature entry @@ -138,16 +138,16 @@ void WorldSession::HandleCreatureQueryOpcode(WorldPacket& recvData) data << uint32(ci->questItems[i]); // itemId[6], quest drop data << uint32(ci->movementId); // CreatureMovementInfo.dbc SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_CREATURE_QUERY_RESPONSE"); + TC_LOG_DEBUG("network", "WORLD: Sent SMSG_CREATURE_QUERY_RESPONSE"); } else { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CREATURE_QUERY - NO CREATURE INFO! (GUID: %u, ENTRY: %u)", + TC_LOG_DEBUG("network", "WORLD: CMSG_CREATURE_QUERY - NO CREATURE INFO! (GUID: %u, ENTRY: %u)", GUID_LOPART(guid), entry); WorldPacket data(SMSG_CREATURE_QUERY_RESPONSE, 4); data << uint32(entry | 0x80000000); SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_CREATURE_QUERY_RESPONSE"); + TC_LOG_DEBUG("network", "WORLD: Sent SMSG_CREATURE_QUERY_RESPONSE"); } } @@ -179,7 +179,7 @@ void WorldSession::HandleGameObjectQueryOpcode(WorldPacket& recvData) ObjectMgr::GetLocaleString(gl->CastBarCaption, loc_idx, CastBarCaption); } } - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_GAMEOBJECT_QUERY '%s' - Entry: %u. ", info->name.c_str(), entry); + TC_LOG_DEBUG("network", "WORLD: CMSG_GAMEOBJECT_QUERY '%s' - Entry: %u. ", info->name.c_str(), entry); WorldPacket data (SMSG_GAMEOBJECT_QUERY_RESPONSE, 150); data << uint32(entry); data << uint32(info->type); @@ -194,22 +194,22 @@ void WorldSession::HandleGameObjectQueryOpcode(WorldPacket& recvData) for (uint32 i = 0; i < MAX_GAMEOBJECT_QUEST_ITEMS; ++i) data << uint32(info->questItems[i]); // itemId[6], quest drop SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_GAMEOBJECT_QUERY_RESPONSE"); + TC_LOG_DEBUG("network", "WORLD: Sent SMSG_GAMEOBJECT_QUERY_RESPONSE"); } else { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_GAMEOBJECT_QUERY - Missing gameobject info for (GUID: %u, ENTRY: %u)", + TC_LOG_DEBUG("network", "WORLD: CMSG_GAMEOBJECT_QUERY - Missing gameobject info for (GUID: %u, ENTRY: %u)", GUID_LOPART(guid), entry); WorldPacket data (SMSG_GAMEOBJECT_QUERY_RESPONSE, 4); data << uint32(entry | 0x80000000); SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_GAMEOBJECT_QUERY_RESPONSE"); + TC_LOG_DEBUG("network", "WORLD: Sent SMSG_GAMEOBJECT_QUERY_RESPONSE"); } } void WorldSession::HandleCorpseQueryOpcode(WorldPacket & /*recvData*/) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received MSG_CORPSE_QUERY"); + TC_LOG_DEBUG("network", "WORLD: Received MSG_CORPSE_QUERY"); Corpse* corpse = GetPlayer()->GetCorpse(); @@ -264,7 +264,7 @@ void WorldSession::HandleNpcTextQueryOpcode(WorldPacket& recvData) uint64 guid; recvData >> textID; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_NPC_TEXT_QUERY ID '%u'", textID); + TC_LOG_DEBUG("network", "WORLD: CMSG_NPC_TEXT_QUERY ID '%u'", textID); recvData >> guid; @@ -337,13 +337,13 @@ void WorldSession::HandleNpcTextQueryOpcode(WorldPacket& recvData) SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_NPC_TEXT_UPDATE"); + TC_LOG_DEBUG("network", "WORLD: Sent SMSG_NPC_TEXT_UPDATE"); } /// Only _static_ data is sent in this packet !!! void WorldSession::HandlePageTextQueryOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_PAGE_TEXT_QUERY"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_PAGE_TEXT_QUERY"); uint32 pageID; recvData >> pageID; @@ -377,13 +377,13 @@ void WorldSession::HandlePageTextQueryOpcode(WorldPacket& recvData) } SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_PAGE_TEXT_QUERY_RESPONSE"); + TC_LOG_DEBUG("network", "WORLD: Sent SMSG_PAGE_TEXT_QUERY_RESPONSE"); } } void WorldSession::HandleCorpseMapPositionQuery(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Recv CMSG_CORPSE_MAP_POSITION_QUERY"); + TC_LOG_DEBUG("network", "WORLD: Recv CMSG_CORPSE_MAP_POSITION_QUERY"); uint32 unk; recvData >> unk; @@ -437,7 +437,7 @@ void WorldSession::HandleQuestPOIQuery(WorldPacket& recvData) data << int32(itr->ObjectiveIndex); // objective index data << uint32(itr->MapId); // mapid data << uint32(itr->AreaId); // areaid - data << uint32(itr->Unk2); // unknown + data << uint32(itr->FloorId); // floorid data << uint32(itr->Unk3); // unknown data << uint32(itr->Unk4); // unknown data << uint32(itr->points.size()); // POI points count diff --git a/src/server/game/Handlers/QuestHandler.cpp b/src/server/game/Handlers/QuestHandler.cpp index e032c82ab1f..a84d8e33812 100644 --- a/src/server/game/Handlers/QuestHandler.cpp +++ b/src/server/game/Handlers/QuestHandler.cpp @@ -42,7 +42,7 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket& recvData) Object* questgiver = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT); if (!questgiver) { - TC_LOG_INFO(LOG_FILTER_NETWORKIO, "Error in CMSG_QUESTGIVER_STATUS_QUERY, called for non-existing questgiver (Typeid: %u GUID: %u)", GuidHigh2TypeId(GUID_HIPART(guid)), GUID_LOPART(guid)); + TC_LOG_INFO("network", "Error in CMSG_QUESTGIVER_STATUS_QUERY, called for non-existing questgiver (Typeid: %u GUID: %u)", GuidHigh2TypeId(GUID_HIPART(guid)), GUID_LOPART(guid)); return; } @@ -50,7 +50,7 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket& recvData) { case TYPEID_UNIT: { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_STATUS_QUERY for npc, guid = %u", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_STATUS_QUERY for npc, guid = %u", uint32(GUID_LOPART(guid))); Creature* cr_questgiver=questgiver->ToCreature(); if (!cr_questgiver->IsHostileTo(_player)) // do not show quest status to enemies { @@ -62,7 +62,7 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket& recvData) } case TYPEID_GAMEOBJECT: { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_STATUS_QUERY for GameObject guid = %u", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_STATUS_QUERY for GameObject guid = %u", uint32(GUID_LOPART(guid))); GameObject* go_questgiver=(GameObject*)questgiver; questStatus = sScriptMgr->GetDialogStatus(_player, go_questgiver); if (questStatus > 6) @@ -70,7 +70,7 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket& recvData) break; } default: - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "QuestGiver called for unexpected type %u", questgiver->GetTypeId()); + TC_LOG_ERROR("network", "QuestGiver called for unexpected type %u", questgiver->GetTypeId()); break; } @@ -83,12 +83,12 @@ void WorldSession::HandleQuestgiverHelloOpcode(WorldPacket& recvData) uint64 guid; recvData >> guid; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_HELLO npc = %u", GUID_LOPART(guid)); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_HELLO npc = %u", GUID_LOPART(guid)); Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE); if (!creature) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: HandleQuestgiverHelloOpcode - Unit (GUID: %u) not found or you can't interact with him.", + TC_LOG_DEBUG("network", "WORLD: HandleQuestgiverHelloOpcode - Unit (GUID: %u) not found or you can't interact with him.", GUID_LOPART(guid)); return; } @@ -115,7 +115,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket& recvData) uint32 unk1; recvData >> guid >> questId >> unk1; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_ACCEPT_QUEST npc = %u, quest = %u, unk1 = %u", uint32(GUID_LOPART(guid)), questId, unk1); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_ACCEPT_QUEST npc = %u, quest = %u, unk1 = %u", uint32(GUID_LOPART(guid)), questId, unk1); Object* object = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT|TYPEMASK_ITEM|TYPEMASK_PLAYER); @@ -239,6 +239,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket& recvData) default: break; } + _player->PlayerTalkClass->SendCloseGossip(); if (quest->GetSrcSpell() > 0) @@ -259,7 +260,7 @@ void WorldSession::HandleQuestgiverQueryQuestOpcode(WorldPacket& recvData) uint32 questId; uint8 unk1; recvData >> guid >> questId >> unk1; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_QUERY_QUEST npc = %u, quest = %u, unk1 = %u", uint32(GUID_LOPART(guid)), questId, unk1); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_QUERY_QUEST npc = %u, quest = %u, unk1 = %u", uint32(GUID_LOPART(guid)), questId, unk1); // Verify that the guid is valid and is a questgiver or involved in the requested quest Object* object = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT | TYPEMASK_ITEM); @@ -278,11 +279,7 @@ void WorldSession::HandleQuestgiverQueryQuestOpcode(WorldPacket& recvData) return; if (quest->IsAutoAccept() && _player->CanAddQuest(quest, true)) - { - _player->AddQuest(quest, object); - if (_player->CanCompleteQuest(questId)) - _player->CompleteQuest(questId); - } + _player->AddQuestAndCheckCompletion(quest, object); if (quest->HasFlag(QUEST_FLAGS_AUTOCOMPLETE)) _player->PlayerTalkClass->SendQuestGiverRequestItems(quest, object->GetGUID(), _player->CanCompleteQuest(quest->GetQuestId()), true); @@ -298,7 +295,7 @@ void WorldSession::HandleQuestQueryOpcode(WorldPacket& recvData) uint32 questId; recvData >> questId; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUEST_QUERY quest = %u", questId); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUEST_QUERY quest = %u", questId); if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId)) _player->PlayerTalkClass->SendQuestQueryResponse(quest); @@ -312,11 +309,11 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket& recvData) if (reward >= QUEST_REWARD_CHOICES_COUNT) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Error in CMSG_QUESTGIVER_CHOOSE_REWARD: player %s (guid %d) tried to get invalid reward (%u) (possible packet-hacking detected)", _player->GetName().c_str(), _player->GetGUIDLow(), reward); + TC_LOG_ERROR("network", "Error in CMSG_QUESTGIVER_CHOOSE_REWARD: player %s (guid %d) tried to get invalid reward (%u) (possible packet-hacking detected)", _player->GetName().c_str(), _player->GetGUIDLow(), reward); return; } - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_CHOOSE_REWARD npc = %u, quest = %u, reward = %u", uint32(GUID_LOPART(guid)), questId, reward); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_CHOOSE_REWARD npc = %u, quest = %u, reward = %u", uint32(GUID_LOPART(guid)), questId, reward); Object* object = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT); if (!object || !object->hasInvolvedQuest(questId)) @@ -331,7 +328,7 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket& recvData) if ((!_player->CanSeeStartQuest(quest) && _player->GetQuestStatus(questId) == QUEST_STATUS_NONE) || (_player->GetQuestStatus(questId) != QUEST_STATUS_COMPLETE && !quest->IsAutoComplete())) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Error in QUEST_STATUS_COMPLETE: player %s (guid %u) tried to complete quest %u, but is not allowed to do so (possible packet-hacking or high latency)", + TC_LOG_ERROR("network", "Error in QUEST_STATUS_COMPLETE: player %s (guid %u) tried to complete quest %u, but is not allowed to do so (possible packet-hacking or high latency)", _player->GetName().c_str(), _player->GetGUIDLow(), questId); return; } @@ -348,11 +345,7 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket& recvData) if (Quest const* nextQuest = _player->GetNextQuest(guid, quest)) { if (nextQuest->IsAutoAccept() && _player->CanAddQuest(nextQuest, true) && _player->CanTakeQuest(nextQuest, true)) - { - _player->AddQuest(nextQuest, object); - if (_player->CanCompleteQuest(nextQuest->GetQuestId())) - _player->CompleteQuest(nextQuest->GetQuestId()); - } + _player->AddQuestAndCheckCompletion(nextQuest, object); _player->PlayerTalkClass->SendQuestGiverQuestDetails(nextQuest, guid, true); } @@ -367,11 +360,7 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket& recvData) if (Quest const* nextQuest = _player->GetNextQuest(guid, quest)) { if (nextQuest->IsAutoAccept() && _player->CanAddQuest(nextQuest, true) && _player->CanTakeQuest(nextQuest, true)) - { - _player->AddQuest(nextQuest, object); - if (_player->CanCompleteQuest(nextQuest->GetQuestId())) - _player->CompleteQuest(nextQuest->GetQuestId()); - } + _player->AddQuestAndCheckCompletion(nextQuest, object); _player->PlayerTalkClass->SendQuestGiverQuestDetails(nextQuest, guid, true); } @@ -394,7 +383,7 @@ void WorldSession::HandleQuestgiverRequestRewardOpcode(WorldPacket& recvData) uint64 guid; recvData >> guid >> questId; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_REQUEST_REWARD npc = %u, quest = %u", uint32(GUID_LOPART(guid)), questId); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_REQUEST_REWARD npc = %u, quest = %u", uint32(GUID_LOPART(guid)), questId); Object* object = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT); if (!object || !object->hasInvolvedQuest(questId)) @@ -416,7 +405,7 @@ void WorldSession::HandleQuestgiverRequestRewardOpcode(WorldPacket& recvData) void WorldSession::HandleQuestgiverCancel(WorldPacket& /*recvData*/) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_CANCEL"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_CANCEL"); _player->PlayerTalkClass->SendCloseGossip(); } @@ -429,7 +418,7 @@ void WorldSession::HandleQuestLogSwapQuest(WorldPacket& recvData) if (slot1 == slot2 || slot1 >= MAX_QUEST_LOG_SIZE || slot2 >= MAX_QUEST_LOG_SIZE) return; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTLOG_SWAP_QUEST slot 1 = %u, slot 2 = %u", slot1, slot2); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTLOG_SWAP_QUEST slot 1 = %u, slot 2 = %u", slot1, slot2); GetPlayer()->SwapQuestSlot(slot1, slot2); } @@ -439,7 +428,7 @@ void WorldSession::HandleQuestLogRemoveQuest(WorldPacket& recvData) uint8 slot; recvData >> slot; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTLOG_REMOVE_QUEST slot = %u", slot); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTLOG_REMOVE_QUEST slot = %u", slot); if (slot < MAX_QUEST_LOG_SIZE) { @@ -464,7 +453,7 @@ void WorldSession::HandleQuestLogRemoveQuest(WorldPacket& recvData) _player->RemoveActiveQuest(questId); _player->RemoveTimedAchievement(ACHIEVEMENT_TIMED_TYPE_QUEST, questId); - TC_LOG_INFO(LOG_FILTER_NETWORKIO, "Player %u abandoned quest %u", _player->GetGUIDLow(), questId); + TC_LOG_INFO("network", "Player %u abandoned quest %u", _player->GetGUIDLow(), questId); } _player->SetQuestSlot(slot, 0); @@ -478,7 +467,7 @@ void WorldSession::HandleQuestConfirmAccept(WorldPacket& recvData) uint32 questId; recvData >> questId; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUEST_CONFIRM_ACCEPT quest = %u", questId); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUEST_CONFIRM_ACCEPT quest = %u", questId); if (const Quest* quest = sObjectMgr->GetQuestTemplate(questId)) { @@ -494,7 +483,7 @@ void WorldSession::HandleQuestConfirmAccept(WorldPacket& recvData) return; if (_player->CanAddQuest(quest, true)) - _player->AddQuest(quest, NULL); // NULL, this prevent DB script from duplicate running + _player->AddQuestAndCheckCompletion(quest, NULL); // NULL, this prevent DB script from duplicate running _player->SetDivider(0); } @@ -507,7 +496,7 @@ void WorldSession::HandleQuestgiverCompleteQuest(WorldPacket& recvData) recvData >> guid >> questId; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_COMPLETE_QUEST npc = %u, quest = %u", uint32(GUID_LOPART(guid)), questId); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_COMPLETE_QUEST npc = %u, quest = %u", uint32(GUID_LOPART(guid)), questId); Quest const* quest = sObjectMgr->GetQuestTemplate(questId); if (!quest) @@ -523,7 +512,7 @@ void WorldSession::HandleQuestgiverCompleteQuest(WorldPacket& recvData) if (!_player->CanSeeStartQuest(quest) && _player->GetQuestStatus(questId) == QUEST_STATUS_NONE) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Possible hacking attempt: Player %s [guid: %u] tried to complete quest [entry: %u] without being in possession of the quest!", + TC_LOG_ERROR("network", "Possible hacking attempt: Player %s [guid: %u] tried to complete quest [entry: %u] without being in possession of the quest!", _player->GetName().c_str(), _player->GetGUIDLow(), questId); return; } @@ -552,7 +541,7 @@ void WorldSession::HandleQuestgiverCompleteQuest(WorldPacket& recvData) void WorldSession::HandleQuestgiverQuestAutoLaunch(WorldPacket& /*recvPacket*/) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_QUEST_AUTOLAUNCH"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_QUEST_AUTOLAUNCH"); } void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket) @@ -563,7 +552,7 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket) if (!_player->CanShareQuest(questId)) return; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_PUSHQUESTTOPARTY questId = %u", questId); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_PUSHQUESTTOPARTY questId = %u", questId); Quest const* quest = sObjectMgr->GetQuestTemplate(questId); if (!quest) @@ -615,11 +604,7 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket) sender->SendPushToPartyResponse(receiver, QUEST_PARTY_MSG_SHARING_QUEST); if (quest->IsAutoAccept() && receiver->CanAddQuest(quest, true) && receiver->CanTakeQuest(quest, true)) - { - receiver->AddQuest(quest, sender); - if (receiver->CanCompleteQuest(questId)) - receiver->CompleteQuest(questId); - } + receiver->AddQuestAndCheckCompletion(quest, sender); if ((quest->IsAutoComplete() && quest->IsRepeatable() && !quest->IsDailyOrWeekly()) || quest->HasFlag(QUEST_FLAGS_AUTOCOMPLETE)) receiver->PlayerTalkClass->SendQuestGiverRequestItems(quest, sender->GetGUID(), receiver->CanCompleteRepeatableQuest(quest), true); @@ -638,7 +623,7 @@ void WorldSession::HandleQuestPushResult(WorldPacket& recvPacket) uint8 msg; recvPacket >> guid >> questId >> msg; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received MSG_QUEST_PUSH_RESULT"); + TC_LOG_DEBUG("network", "WORLD: Received MSG_QUEST_PUSH_RESULT"); if (_player->GetDivider() && _player->GetDivider() == guid) { @@ -677,7 +662,7 @@ uint32 WorldSession::getDialogStatus(Player* player, Object* questgiver, uint32 } default: //its imposible, but check ^) - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Warning: GetDialogStatus called for unexpected type %u", questgiver->GetTypeId()); + TC_LOG_ERROR("network", "Warning: GetDialogStatus called for unexpected type %u", questgiver->GetTypeId()); return DIALOG_STATUS_NONE; } @@ -754,7 +739,7 @@ uint32 WorldSession::getDialogStatus(Player* player, Object* questgiver, uint32 void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket*/) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_STATUS_MULTIPLE_QUERY"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_STATUS_MULTIPLE_QUERY"); uint32 count = 0; diff --git a/src/server/game/Handlers/ReferAFriendHandler.cpp b/src/server/game/Handlers/ReferAFriendHandler.cpp index 4f4fe226a54..9e0b877f64b 100644 --- a/src/server/game/Handlers/ReferAFriendHandler.cpp +++ b/src/server/game/Handlers/ReferAFriendHandler.cpp @@ -23,7 +23,7 @@ void WorldSession::HandleGrantLevel(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_GRANT_LEVEL"); + TC_LOG_DEBUG("network", "WORLD: CMSG_GRANT_LEVEL"); uint64 guid; recvData.readPackGUID(guid); @@ -65,7 +65,7 @@ void WorldSession::HandleGrantLevel(WorldPacket& recvData) void WorldSession::HandleAcceptGrantLevel(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_ACCEPT_LEVEL_GRANT"); + TC_LOG_DEBUG("network", "WORLD: CMSG_ACCEPT_LEVEL_GRANT"); uint64 guid; recvData.readPackGUID(guid); diff --git a/src/server/game/Handlers/SkillHandler.cpp b/src/server/game/Handlers/SkillHandler.cpp index 04cc468f216..7e2bc11e1b2 100644 --- a/src/server/game/Handlers/SkillHandler.cpp +++ b/src/server/game/Handlers/SkillHandler.cpp @@ -38,7 +38,7 @@ void WorldSession::HandleLearnTalentOpcode(WorldPacket& recvData) void WorldSession::HandleLearnPreviewTalents(WorldPacket& recvPacket) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "CMSG_LEARN_PREVIEW_TALENTS"); + TC_LOG_DEBUG("network", "CMSG_LEARN_PREVIEW_TALENTS"); uint32 talentsCount; recvPacket >> talentsCount; @@ -57,14 +57,14 @@ void WorldSession::HandleLearnPreviewTalents(WorldPacket& recvPacket) void WorldSession::HandleTalentWipeConfirmOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "MSG_TALENT_WIPE_CONFIRM"); + TC_LOG_DEBUG("network", "MSG_TALENT_WIPE_CONFIRM"); uint64 guid; recvData >> guid; Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TRAINER); if (!unit) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: HandleTalentWipeConfirmOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: HandleTalentWipeConfirmOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); return; } diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp index 791e2d4c816..b264b0d2fff 100644 --- a/src/server/game/Handlers/SpellHandler.cpp +++ b/src/server/game/Handlers/SpellHandler.cpp @@ -93,7 +93,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket) return; } - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_USE_ITEM packet, bagIndex: %u, slot: %u, castCount: %u, spellId: %u, Item: %u, glyphIndex: %u, data length = %i", bagIndex, slot, castCount, spellId, pItem->GetEntry(), glyphIndex, (uint32)recvPacket.size()); + TC_LOG_DEBUG("network", "WORLD: CMSG_USE_ITEM packet, bagIndex: %u, slot: %u, castCount: %u, spellId: %u, Item: %u, glyphIndex: %u, data length = %i", bagIndex, slot, castCount, spellId, pItem->GetEntry(), glyphIndex, (uint32)recvPacket.size()); ItemTemplate const* proto = pItem->GetTemplate(); if (!proto) @@ -169,7 +169,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket) void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_OPEN_ITEM packet, data length = %i", (uint32)recvPacket.size()); + TC_LOG_DEBUG("network", "WORLD: CMSG_OPEN_ITEM packet, data length = %i", (uint32)recvPacket.size()); Player* pUser = _player; @@ -181,7 +181,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket) recvPacket >> bagIndex >> slot; - TC_LOG_INFO(LOG_FILTER_NETWORKIO, "bagIndex: %u, slot: %u", bagIndex, slot); + TC_LOG_INFO("network", "bagIndex: %u, slot: %u", bagIndex, slot); Item* item = pUser->GetItemByPos(bagIndex, slot); if (!item) @@ -201,7 +201,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket) if (!(proto->Flags & ITEM_PROTO_FLAG_OPENABLE) && !item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_WRAPPED)) { pUser->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, NULL); - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Possible hacking attempt: Player %s [guid: %u] tried to open item [guid: %u, entry: %u] which is not openable!", + TC_LOG_ERROR("network", "Possible hacking attempt: Player %s [guid: %u] tried to open item [guid: %u, entry: %u] which is not openable!", pUser->GetName().c_str(), pUser->GetGUIDLow(), item->GetGUIDLow(), proto->ItemId); return; } @@ -215,7 +215,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket) if (!lockInfo) { pUser->SendEquipError(EQUIP_ERR_ITEM_LOCKED, item, NULL); - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "WORLD::OpenItem: item [guid = %u] has an unknown lockId: %u!", item->GetGUIDLow(), lockId); + TC_LOG_ERROR("network", "WORLD::OpenItem: item [guid = %u] has an unknown lockId: %u!", item->GetGUIDLow(), lockId); return; } @@ -248,7 +248,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket) } else { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Wrapped item %u don't have record in character_gifts table and will deleted", item->GetGUIDLow()); + TC_LOG_ERROR("network", "Wrapped item %u don't have record in character_gifts table and will deleted", item->GetGUIDLow()); pUser->DestroyItem(item->GetBagSlot(), item->GetSlot(), true); return; } @@ -269,7 +269,7 @@ void WorldSession::HandleGameObjectUseOpcode(WorldPacket& recvData) recvData >> guid; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_GAMEOBJ_USE Message [guid=%u]", GUID_LOPART(guid)); + TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_GAMEOBJ_USE Message [guid=%u]", GUID_LOPART(guid)); if (GameObject* obj = GetPlayer()->GetMap()->GetGameObject(guid)) { @@ -287,7 +287,7 @@ void WorldSession::HandleGameobjectReportUse(WorldPacket& recvPacket) uint64 guid; recvPacket >> guid; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_GAMEOBJ_REPORT_USE Message [in game guid: %u]", GUID_LOPART(guid)); + TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_GAMEOBJ_REPORT_USE Message [in game guid: %u]", GUID_LOPART(guid)); // ignore for remote control state if (_player->m_mover != _player) @@ -312,7 +312,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket) uint8 castCount, castFlags; recvPacket >> castCount >> spellId >> castFlags; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: got cast spell packet, castCount: %u, spellId: %u, castFlags: %u, data length = %u", castCount, spellId, castFlags, (uint32)recvPacket.size()); + TC_LOG_DEBUG("network", "WORLD: got cast spell packet, castCount: %u, spellId: %u, castFlags: %u, data length = %u", castCount, spellId, castFlags, (uint32)recvPacket.size()); // ignore for remote control state (for player case) Unit* mover = _player->m_mover; @@ -325,7 +325,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket) SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); if (!spellInfo) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "WORLD: unknown spell id %u", spellId); + TC_LOG_ERROR("network", "WORLD: unknown spell id %u", spellId); recvPacket.rfinish(); // prevent spam at ignore packet return; } @@ -447,7 +447,7 @@ void WorldSession::HandlePetCancelAuraOpcode(WorldPacket& recvPacket) SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); if (!spellInfo) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "WORLD: unknown PET spell id %u", spellId); + TC_LOG_ERROR("network", "WORLD: unknown PET spell id %u", spellId); return; } @@ -455,13 +455,13 @@ void WorldSession::HandlePetCancelAuraOpcode(WorldPacket& recvPacket) if (!pet) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "HandlePetCancelAura: Attempt to cancel an aura for non-existant pet %u by player '%s'", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str()); + TC_LOG_ERROR("network", "HandlePetCancelAura: Attempt to cancel an aura for non-existant pet %u by player '%s'", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str()); return; } if (pet != GetPlayer()->GetGuardianPet() && pet != GetPlayer()->GetCharm()) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "HandlePetCancelAura: Pet %u is not a pet of player '%s'", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str()); + TC_LOG_ERROR("network", "HandlePetCancelAura: Pet %u is not a pet of player '%s'", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str()); return; } @@ -522,7 +522,7 @@ void WorldSession::HandleTotemDestroyed(WorldPacket& recvPacket) void WorldSession::HandleSelfResOpcode(WorldPacket & /*recvData*/) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_SELF_RES"); // empty opcode + TC_LOG_DEBUG("network", "WORLD: CMSG_SELF_RES"); // empty opcode if (_player->HasAuraType(SPELL_AURA_PREVENT_RESURRECTION)) return; // silent return, client should display error by itself and not send this opcode @@ -557,7 +557,7 @@ void WorldSession::HandleSpellClick(WorldPacket& recvData) void WorldSession::HandleMirrorImageDataRequest(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_GET_MIRRORIMAGE_DATA"); + TC_LOG_DEBUG("network", "WORLD: CMSG_GET_MIRRORIMAGE_DATA"); uint64 guid; recvData >> guid; @@ -644,7 +644,7 @@ void WorldSession::HandleMirrorImageDataRequest(WorldPacket& recvData) void WorldSession::HandleUpdateProjectilePosition(WorldPacket& recvPacket) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_UPDATE_PROJECTILE_POSITION"); + TC_LOG_DEBUG("network", "WORLD: CMSG_UPDATE_PROJECTILE_POSITION"); uint64 casterGuid; uint32 spellId; diff --git a/src/server/game/Handlers/TaxiHandler.cpp b/src/server/game/Handlers/TaxiHandler.cpp index ae25d9f4750..6b42c1a8011 100644 --- a/src/server/game/Handlers/TaxiHandler.cpp +++ b/src/server/game/Handlers/TaxiHandler.cpp @@ -30,7 +30,7 @@ void WorldSession::HandleTaxiNodeStatusQueryOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_TAXINODE_STATUS_QUERY"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_TAXINODE_STATUS_QUERY"); uint64 guid; @@ -44,7 +44,7 @@ void WorldSession::SendTaxiStatus(uint64 guid) Creature* unit = GetPlayer()->GetMap()->GetCreature(guid); if (!unit) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WorldSession::SendTaxiStatus - Unit (GUID: %u) not found.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WorldSession::SendTaxiStatus - Unit (GUID: %u) not found.", uint32(GUID_LOPART(guid))); return; } @@ -54,18 +54,18 @@ void WorldSession::SendTaxiStatus(uint64 guid) if (curloc == 0) return; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: current location %u ", curloc); + TC_LOG_DEBUG("network", "WORLD: current location %u ", curloc); WorldPacket data(SMSG_TAXINODE_STATUS, 9); data << guid; data << uint8(GetPlayer()->m_taxi.IsTaximaskNodeKnown(curloc) ? 1 : 0); SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_TAXINODE_STATUS"); + TC_LOG_DEBUG("network", "WORLD: Sent SMSG_TAXINODE_STATUS"); } void WorldSession::HandleTaxiQueryAvailableNodes(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_TAXIQUERYAVAILABLENODES"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_TAXIQUERYAVAILABLENODES"); uint64 guid; recvData >> guid; @@ -74,7 +74,7 @@ void WorldSession::HandleTaxiQueryAvailableNodes(WorldPacket& recvData) Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_FLIGHTMASTER); if (!unit) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: HandleTaxiQueryAvailableNodes - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: HandleTaxiQueryAvailableNodes - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); return; } @@ -101,7 +101,7 @@ void WorldSession::SendTaxiMenu(Creature* unit) bool lastTaxiCheaterState = GetPlayer()->isTaxiCheater(); if (unit->GetEntry() == 29480) GetPlayer()->SetTaxiCheater(true); // Grimwing in Ebon Hold, special case. NOTE: Not perfect, Zul'Aman should not be included according to WoWhead, and I think taxicheat includes it. - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_TAXINODE_STATUS_QUERY %u ", curloc); + TC_LOG_DEBUG("network", "WORLD: CMSG_TAXINODE_STATUS_QUERY %u ", curloc); WorldPacket data(SMSG_SHOWTAXINODES, (4 + 8 + 4 + 8 * 4)); data << uint32(1); @@ -110,7 +110,7 @@ void WorldSession::SendTaxiMenu(Creature* unit) GetPlayer()->m_taxi.AppendTaximaskTo(data, GetPlayer()->isTaxiCheater()); SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_SHOWTAXINODES"); + TC_LOG_DEBUG("network", "WORLD: Sent SMSG_SHOWTAXINODES"); GetPlayer()->SetTaxiCheater(lastTaxiCheaterState); } @@ -165,7 +165,7 @@ void WorldSession::SendDiscoverNewTaxiNode(uint32 nodeid) void WorldSession::HandleActivateTaxiExpressOpcode (WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_ACTIVATETAXIEXPRESS"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_ACTIVATETAXIEXPRESS"); uint64 guid; uint32 node_count; @@ -175,7 +175,7 @@ void WorldSession::HandleActivateTaxiExpressOpcode (WorldPacket& recvData) Creature* npc = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_FLIGHTMASTER); if (!npc) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: HandleActivateTaxiExpressOpcode - Unit (GUID: %u) not found or you can't interact with it.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: HandleActivateTaxiExpressOpcode - Unit (GUID: %u) not found or you can't interact with it.", uint32(GUID_LOPART(guid))); return; } std::vector<uint32> nodes; @@ -190,14 +190,14 @@ void WorldSession::HandleActivateTaxiExpressOpcode (WorldPacket& recvData) if (nodes.empty()) return; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_ACTIVATETAXIEXPRESS from %d to %d", nodes.front(), nodes.back()); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_ACTIVATETAXIEXPRESS from %d to %d", nodes.front(), nodes.back()); GetPlayer()->ActivateTaxiPathTo(nodes, npc); } void WorldSession::HandleMoveSplineDoneOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_MOVE_SPLINE_DONE"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_MOVE_SPLINE_DONE"); uint64 guid; // used only for proper packet read recvData.readPackGUID(guid); @@ -251,7 +251,7 @@ void WorldSession::HandleMoveSplineDoneOpcode(WorldPacket& recvData) } } - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Taxi has to go from %u to %u", sourcenode, destinationnode); + TC_LOG_DEBUG("network", "WORLD: Taxi has to go from %u to %u", sourcenode, destinationnode); uint32 mountDisplayId = sObjectMgr->GetTaxiMountDisplayId(sourcenode, GetPlayer()->GetTeam()); @@ -275,18 +275,18 @@ void WorldSession::HandleMoveSplineDoneOpcode(WorldPacket& recvData) void WorldSession::HandleActivateTaxiOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_ACTIVATETAXI"); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_ACTIVATETAXI"); uint64 guid; std::vector<uint32> nodes; nodes.resize(2); recvData >> guid >> nodes[0] >> nodes[1]; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_ACTIVATETAXI from %d to %d", nodes[0], nodes[1]); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_ACTIVATETAXI from %d to %d", nodes[0], nodes[1]); Creature* npc = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_FLIGHTMASTER); if (!npc) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: HandleActivateTaxiOpcode - Unit (GUID: %u) not found or you can't interact with it.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: HandleActivateTaxiOpcode - Unit (GUID: %u) not found or you can't interact with it.", uint32(GUID_LOPART(guid))); return; } @@ -299,5 +299,5 @@ void WorldSession::SendActivateTaxiReply(ActivateTaxiReply reply) data << uint32(reply); SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_ACTIVATETAXIREPLY"); + TC_LOG_DEBUG("network", "WORLD: Sent SMSG_ACTIVATETAXIREPLY"); } diff --git a/src/server/game/Handlers/TicketHandler.cpp b/src/server/game/Handlers/TicketHandler.cpp index 57d41be9e23..ceeac75e34e 100644 --- a/src/server/game/Handlers/TicketHandler.cpp +++ b/src/server/game/Handlers/TicketHandler.cpp @@ -81,7 +81,7 @@ void WorldSession::HandleGMTicketCreateOpcode(WorldPacket& recvData) } else { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "CMSG_GMTICKET_CREATE possibly corrupt. Uncompression failed."); + TC_LOG_ERROR("network", "CMSG_GMTICKET_CREATE possibly corrupt. Uncompression failed."); recvData.rfinish(); delete ticket; return; diff --git a/src/server/game/Handlers/TradeHandler.cpp b/src/server/game/Handlers/TradeHandler.cpp index b555aee4544..8befde46550 100644 --- a/src/server/game/Handlers/TradeHandler.cpp +++ b/src/server/game/Handlers/TradeHandler.cpp @@ -70,13 +70,13 @@ void WorldSession::SendTradeStatus(TradeStatus status) void WorldSession::HandleIgnoreTradeOpcode(WorldPacket& /*recvPacket*/) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Ignore Trade %u", _player->GetGUIDLow()); + TC_LOG_DEBUG("network", "WORLD: Ignore Trade %u", _player->GetGUIDLow()); // recvPacket.print_storage(); } void WorldSession::HandleBusyTradeOpcode(WorldPacket& /*recvPacket*/) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Busy Trade %u", _player->GetGUIDLow()); + TC_LOG_DEBUG("network", "WORLD: Busy Trade %u", _player->GetGUIDLow()); // recvPacket.print_storage(); } @@ -151,7 +151,7 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[]) if (myItems[i]) { // logging - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "partner storing: %u", myItems[i]->GetGUIDLow()); + TC_LOG_DEBUG("network", "partner storing: %u", myItems[i]->GetGUIDLow()); if (HasPermission(rbac::RBAC_PERM_LOG_GM_TRADE)) { sLog->outCommand(_player->GetSession()->GetAccountId(), "GM %s (Account: %u) trade: %s (Entry: %d Count: %u) to player: %s (Account: %u)", @@ -169,7 +169,7 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[]) if (hisItems[i]) { // logging - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "player storing: %u", hisItems[i]->GetGUIDLow()); + TC_LOG_DEBUG("network", "player storing: %u", hisItems[i]->GetGUIDLow()); if (HasPermission(rbac::RBAC_PERM_LOG_GM_TRADE)) { sLog->outCommand(trader->GetSession()->GetAccountId(), "GM %s (Account: %u) trade: %s (Entry: %d Count: %u) to player: %s (Account: %u)", @@ -192,21 +192,21 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[]) if (myItems[i]) { if (!traderCanTrade) - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "trader can't store item: %u", myItems[i]->GetGUIDLow()); + TC_LOG_ERROR("network", "trader can't store item: %u", myItems[i]->GetGUIDLow()); if (_player->CanStoreItem(NULL_BAG, NULL_SLOT, playerDst, myItems[i], false) == EQUIP_ERR_OK) _player->MoveItemToInventory(playerDst, myItems[i], true, true); else - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "player can't take item back: %u", myItems[i]->GetGUIDLow()); + TC_LOG_ERROR("network", "player can't take item back: %u", myItems[i]->GetGUIDLow()); } // return the already removed items to the original owner if (hisItems[i]) { if (!playerCanTrade) - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "player can't store item: %u", hisItems[i]->GetGUIDLow()); + TC_LOG_ERROR("network", "player can't store item: %u", hisItems[i]->GetGUIDLow()); if (trader->CanStoreItem(NULL_BAG, NULL_SLOT, traderDst, hisItems[i], false) == EQUIP_ERR_OK) trader->MoveItemToInventory(traderDst, hisItems[i], true, true); else - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "trader can't take item back: %u", hisItems[i]->GetGUIDLow()); + TC_LOG_ERROR("network", "trader can't take item back: %u", hisItems[i]->GetGUIDLow()); } } } @@ -224,7 +224,7 @@ static void setAcceptTradeMode(TradeData* myTrade, TradeData* hisTrade, Item* *m { if (Item* item = myTrade->GetItem(TradeSlots(i))) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "player trade item %u bag: %u slot: %u", item->GetGUIDLow(), item->GetBagSlot(), item->GetSlot()); + TC_LOG_DEBUG("network", "player trade item %u bag: %u slot: %u", item->GetGUIDLow(), item->GetBagSlot(), item->GetSlot()); //Can return NULL myItems[i] = item; myItems[i]->SetInTrade(); @@ -232,7 +232,7 @@ static void setAcceptTradeMode(TradeData* myTrade, TradeData* hisTrade, Item* *m if (Item* item = hisTrade->GetItem(TradeSlots(i))) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "partner trade item %u bag: %u slot: %u", item->GetGUIDLow(), item->GetBagSlot(), item->GetSlot()); + TC_LOG_DEBUG("network", "partner trade item %u bag: %u slot: %u", item->GetGUIDLow(), item->GetBagSlot(), item->GetSlot()); hisItems[i] = item; hisItems[i]->SetInTrade(); } diff --git a/src/server/game/Handlers/VehicleHandler.cpp b/src/server/game/Handlers/VehicleHandler.cpp index b099ba96060..a0beadc644c 100644 --- a/src/server/game/Handlers/VehicleHandler.cpp +++ b/src/server/game/Handlers/VehicleHandler.cpp @@ -25,7 +25,7 @@ void WorldSession::HandleDismissControlledVehicle(WorldPacket &recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_DISMISS_CONTROLLED_VEHICLE"); + TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_DISMISS_CONTROLLED_VEHICLE"); uint64 vehicleGUID = _player->GetCharmGUID(); @@ -50,7 +50,7 @@ void WorldSession::HandleDismissControlledVehicle(WorldPacket &recvData) void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket &recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_CHANGE_SEATS_ON_CONTROLLED_VEHICLE"); + TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_CHANGE_SEATS_ON_CONTROLLED_VEHICLE"); Unit* vehicle_base = GetPlayer()->GetVehicleBase(); if (!vehicle_base) @@ -63,7 +63,7 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket &recvData) if (!seat->CanSwitchFromSeat()) { recvData.rfinish(); // prevent warnings spam - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "HandleChangeSeatsOnControlledVehicle, Opcode: %u, Player %u tried to switch seats but current seatflags %u don't permit that.", + TC_LOG_ERROR("network", "HandleChangeSeatsOnControlledVehicle, Opcode: %u, Player %u tried to switch seats but current seatflags %u don't permit that.", recvData.GetOpcode(), GetPlayer()->GetGUIDLow(), seat->m_flags); return; } @@ -150,7 +150,7 @@ void WorldSession::HandleEjectPassenger(WorldPacket &data) if (!vehicle) { data.rfinish(); // prevent warnings spam - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "HandleEjectPassenger: Player %u is not in a vehicle!", GetPlayer()->GetGUIDLow()); + TC_LOG_ERROR("network", "HandleEjectPassenger: Player %u is not in a vehicle!", GetPlayer()->GetGUIDLow()); return; } @@ -162,13 +162,13 @@ void WorldSession::HandleEjectPassenger(WorldPacket &data) Player* player = ObjectAccessor::FindPlayer(guid); if (!player) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Player %u tried to eject player %u from vehicle, but the latter was not found in world!", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); + TC_LOG_ERROR("network", "Player %u tried to eject player %u from vehicle, but the latter was not found in world!", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); return; } if (!player->IsOnVehicle(vehicle->GetBase())) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Player %u tried to eject player %u, but they are not in the same vehicle", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); + TC_LOG_ERROR("network", "Player %u tried to eject player %u, but they are not in the same vehicle", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); return; } @@ -177,7 +177,7 @@ void WorldSession::HandleEjectPassenger(WorldPacket &data) if (seat->IsEjectable()) player->ExitVehicle(); else - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Player %u attempted to eject player %u from non-ejectable seat.", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); + TC_LOG_ERROR("network", "Player %u attempted to eject player %u from non-ejectable seat.", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); } else if (IS_CREATURE_GUID(guid)) @@ -185,13 +185,13 @@ void WorldSession::HandleEjectPassenger(WorldPacket &data) Unit* unit = ObjectAccessor::GetUnit(*_player, guid); if (!unit) // creatures can be ejected too from player mounts { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Player %u tried to eject creature guid %u from vehicle, but the latter was not found in world!", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); + TC_LOG_ERROR("network", "Player %u tried to eject creature guid %u from vehicle, but the latter was not found in world!", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); return; } if (!unit->IsOnVehicle(vehicle->GetBase())) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Player %u tried to eject unit %u, but they are not in the same vehicle", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); + TC_LOG_ERROR("network", "Player %u tried to eject unit %u, but they are not in the same vehicle", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); return; } @@ -203,15 +203,15 @@ void WorldSession::HandleEjectPassenger(WorldPacket &data) unit->ExitVehicle(); } else - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Player %u attempted to eject creature GUID %u from non-ejectable seat.", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); + TC_LOG_ERROR("network", "Player %u attempted to eject creature GUID %u from non-ejectable seat.", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); } else - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "HandleEjectPassenger: Player %u tried to eject invalid GUID " UI64FMTD, GetPlayer()->GetGUIDLow(), guid); + TC_LOG_ERROR("network", "HandleEjectPassenger: Player %u tried to eject invalid GUID " UI64FMTD, GetPlayer()->GetGUIDLow(), guid); } void WorldSession::HandleRequestVehicleExit(WorldPacket& /*recvData*/) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_REQUEST_VEHICLE_EXIT"); + TC_LOG_DEBUG("network", "WORLD: Recvd CMSG_REQUEST_VEHICLE_EXIT"); if (Vehicle* vehicle = GetPlayer()->GetVehicle()) { @@ -220,7 +220,7 @@ void WorldSession::HandleRequestVehicleExit(WorldPacket& /*recvData*/) if (seat->CanEnterOrExit()) GetPlayer()->ExitVehicle(); else - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Player %u tried to exit vehicle, but seatflags %u (ID: %u) don't permit that.", + TC_LOG_ERROR("network", "Player %u tried to exit vehicle, but seatflags %u (ID: %u) don't permit that.", GetPlayer()->GetGUIDLow(), seat->m_ID, seat->m_flags); } } diff --git a/src/server/game/Handlers/VoiceChatHandler.cpp b/src/server/game/Handlers/VoiceChatHandler.cpp index 36e9d4e716d..456848bf6cc 100644 --- a/src/server/game/Handlers/VoiceChatHandler.cpp +++ b/src/server/game/Handlers/VoiceChatHandler.cpp @@ -24,7 +24,7 @@ void WorldSession::HandleVoiceSessionEnableOpcode(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_VOICE_SESSION_ENABLE"); + TC_LOG_DEBUG("network", "WORLD: CMSG_VOICE_SESSION_ENABLE"); // uint8 isVoiceEnabled, uint8 isMicrophoneEnabled recvData.read_skip<uint8>(); recvData.read_skip<uint8>(); @@ -32,13 +32,13 @@ void WorldSession::HandleVoiceSessionEnableOpcode(WorldPacket& recvData) void WorldSession::HandleChannelVoiceOnOpcode(WorldPacket& /*recvData*/) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CHANNEL_VOICE_ON"); + TC_LOG_DEBUG("network", "WORLD: CMSG_CHANNEL_VOICE_ON"); // Enable Voice button in channel context menu } void WorldSession::HandleSetActiveVoiceChannel(WorldPacket& recvData) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WORLD: CMSG_SET_ACTIVE_VOICE_CHANNEL"); + TC_LOG_DEBUG("network", "WORLD: CMSG_SET_ACTIVE_VOICE_CHANNEL"); recvData.read_skip<uint32>(); recvData.read_skip<char*>(); } diff --git a/src/server/game/Instances/InstanceSaveMgr.cpp b/src/server/game/Instances/InstanceSaveMgr.cpp index d552f822f0a..ee962621048 100644 --- a/src/server/game/Instances/InstanceSaveMgr.cpp +++ b/src/server/game/Instances/InstanceSaveMgr.cpp @@ -74,19 +74,19 @@ InstanceSave* InstanceSaveManager::AddInstanceSave(uint32 mapId, uint32 instance const MapEntry* entry = sMapStore.LookupEntry(mapId); if (!entry) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "InstanceSaveManager::AddInstanceSave: wrong mapid = %d, instanceid = %d!", mapId, instanceId); + TC_LOG_ERROR("misc", "InstanceSaveManager::AddInstanceSave: wrong mapid = %d, instanceid = %d!", mapId, instanceId); return NULL; } if (instanceId == 0) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "InstanceSaveManager::AddInstanceSave: mapid = %d, wrong instanceid = %d!", mapId, instanceId); + TC_LOG_ERROR("misc", "InstanceSaveManager::AddInstanceSave: mapid = %d, wrong instanceid = %d!", mapId, instanceId); return NULL; } if (difficulty >= (entry->IsRaid() ? MAX_RAID_DIFFICULTY : MAX_DUNGEON_DIFFICULTY)) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "InstanceSaveManager::AddInstanceSave: mapid = %d, instanceid = %d, wrong dificalty %u!", mapId, instanceId, difficulty); + TC_LOG_ERROR("misc", "InstanceSaveManager::AddInstanceSave: mapid = %d, instanceid = %d, wrong dificalty %u!", mapId, instanceId, difficulty); return NULL; } @@ -104,7 +104,7 @@ InstanceSave* InstanceSaveManager::AddInstanceSave(uint32 mapId, uint32 instance } } - TC_LOG_DEBUG(LOG_FILTER_MAPS, "InstanceSaveManager::AddInstanceSave: mapid = %d, instanceid = %d", mapId, instanceId); + TC_LOG_DEBUG("maps", "InstanceSaveManager::AddInstanceSave: mapid = %d, instanceid = %d", mapId, instanceId); InstanceSave* save = new InstanceSave(mapId, instanceId, difficulty, resetTime, canReset); if (!load) @@ -272,7 +272,7 @@ void InstanceSaveManager::LoadInstances() // Load reset times and clean expired instances sInstanceSaveMgr->LoadResetTimes(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded instances in %u ms", GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded instances in %u ms", GetMSTimeDiffToNow(oldMSTime)); } @@ -362,7 +362,7 @@ void InstanceSaveManager::LoadResetTimes() MapDifficulty const* mapDiff = GetMapDifficultyData(mapid, difficulty); if (!mapDiff) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "InstanceSaveManager::LoadResetTimes: invalid mapid(%u)/difficulty(%u) pair in instance_reset!", mapid, difficulty); + TC_LOG_ERROR("misc", "InstanceSaveManager::LoadResetTimes: invalid mapid(%u)/difficulty(%u) pair in instance_reset!", mapid, difficulty); CharacterDatabase.DirectPExecute("DELETE FROM instance_reset WHERE mapid = '%u' AND difficulty = '%u'", mapid, difficulty); continue; } @@ -455,7 +455,7 @@ void InstanceSaveManager::ScheduleReset(bool add, time_t time, InstResetEvent ev } if (itr == m_resetTimeQueue.end()) - TC_LOG_ERROR(LOG_FILTER_GENERAL, "InstanceSaveManager::ScheduleReset: cannot cancel the reset, the event(%d, %d, %d) was not found!", event.type, event.mapid, event.instanceId); + TC_LOG_ERROR("misc", "InstanceSaveManager::ScheduleReset: cannot cancel the reset, the event(%d, %d, %d) was not found!", event.type, event.mapid, event.instanceId); } } else @@ -524,7 +524,7 @@ void InstanceSaveManager::_ResetSave(InstanceSaveHashMap::iterator &itr) void InstanceSaveManager::_ResetInstance(uint32 mapid, uint32 instanceId) { - TC_LOG_DEBUG(LOG_FILTER_MAPS, "InstanceSaveMgr::_ResetInstance %u, %u", mapid, instanceId); + TC_LOG_DEBUG("maps", "InstanceSaveMgr::_ResetInstance %u, %u", mapid, instanceId); Map const* map = sMapMgr->CreateBaseMap(mapid); if (!map->Instanceable()) return; @@ -563,7 +563,7 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, b MapDifficulty const* mapDiff = GetMapDifficultyData(mapid, difficulty); if (!mapDiff || !mapDiff->resetTime) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "InstanceSaveManager::ResetOrWarnAll: not valid difficulty or no reset delay for map %d", mapid); + TC_LOG_ERROR("misc", "InstanceSaveManager::ResetOrWarnAll: not valid difficulty or no reset delay for map %d", mapid); return; } diff --git a/src/server/game/Instances/InstanceScript.cpp b/src/server/game/Instances/InstanceScript.cpp index c8b57c9924e..2e5ed1d487e 100644 --- a/src/server/game/Instances/InstanceScript.cpp +++ b/src/server/game/Instances/InstanceScript.cpp @@ -50,7 +50,7 @@ void InstanceScript::HandleGameObject(uint64 GUID, bool open, GameObject* go) if (go) go->SetGoState(open ? GO_STATE_ACTIVE : GO_STATE_READY); else - TC_LOG_DEBUG(LOG_FILTER_TSCR, "InstanceScript: HandleGameObject failed"); + TC_LOG_DEBUG("scripts", "InstanceScript: HandleGameObject failed"); } bool InstanceScript::IsEncounterInProgress() const @@ -71,7 +71,7 @@ void InstanceScript::LoadMinionData(const MinionData* data) ++data; } - TC_LOG_DEBUG(LOG_FILTER_TSCR, "InstanceScript::LoadMinionData: " UI64FMTD " minions loaded.", uint64(minions.size())); + TC_LOG_DEBUG("scripts", "InstanceScript::LoadMinionData: " UI64FMTD " minions loaded.", uint64(minions.size())); } void InstanceScript::LoadDoorData(const DoorData* data) @@ -83,7 +83,7 @@ void InstanceScript::LoadDoorData(const DoorData* data) ++data; } - TC_LOG_DEBUG(LOG_FILTER_TSCR, "InstanceScript::LoadDoorData: " UI64FMTD " doors loaded.", uint64(doors.size())); + TC_LOG_DEBUG("scripts", "InstanceScript::LoadDoorData: " UI64FMTD " doors loaded.", uint64(doors.size())); } void InstanceScript::UpdateMinionState(Creature* minion, EncounterState state) @@ -200,7 +200,7 @@ bool InstanceScript::SetBossState(uint32 id, EncounterState state) if (bossInfo->state == TO_BE_DECIDED) // loading { bossInfo->state = state; - //TC_LOG_ERROR(LOG_FILTER_GENERAL, "Inialize boss %u state as %u.", id, (uint32)state); + //TC_LOG_ERROR("misc", "Inialize boss %u state as %u.", id, (uint32)state); return false; } else @@ -270,7 +270,7 @@ void InstanceScript::DoUseDoorOrButton(uint64 uiGuid, uint32 uiWithRestoreTime, go->ResetDoorOrButton(); } else - TC_LOG_ERROR(LOG_FILTER_GENERAL, "SD2: Script call DoUseDoorOrButton, but gameobject entry %u is type %u.", go->GetEntry(), go->GetGoType()); + TC_LOG_ERROR("misc", "SD2: Script call DoUseDoorOrButton, but gameobject entry %u is type %u.", go->GetEntry(), go->GetGoType()); } } @@ -301,7 +301,7 @@ void InstanceScript::DoUpdateWorldState(uint32 uiStateId, uint32 uiStateData) player->SendUpdateWorldState(uiStateId, uiStateData); } else - TC_LOG_DEBUG(LOG_FILTER_TSCR, "DoUpdateWorldState attempt send data but no players in map."); + TC_LOG_DEBUG("scripts", "DoUpdateWorldState attempt send data but no players in map."); } // Send Notify to all players in instance @@ -387,7 +387,7 @@ void InstanceScript::DoCastSpellOnPlayers(uint32 spell) bool InstanceScript::CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* /*source*/, Unit const* /*target*/ /*= NULL*/, uint32 /*miscvalue1*/ /*= 0*/) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Achievement system call InstanceScript::CheckAchievementCriteriaMeet but instance script for map %u not have implementation for achievement criteria %u", + TC_LOG_ERROR("misc", "Achievement system call InstanceScript::CheckAchievementCriteriaMeet but instance script for map %u not have implementation for achievement criteria %u", instance->GetId(), criteria_id); return false; } @@ -442,7 +442,7 @@ void InstanceScript::UpdateEncounterState(EncounterCreditType type, uint32 credi if (encounter->lastEncounterDungeon) { dungeonId = encounter->lastEncounterDungeon; - TC_LOG_DEBUG(LOG_FILTER_LFG, "UpdateEncounterState: Instance %s (instanceId %u) completed encounter %s. Credit Dungeon: %u", instance->GetMapName(), instance->GetInstanceId(), encounter->dbcEntry->encounterName[0], dungeonId); + TC_LOG_DEBUG("lfg", "UpdateEncounterState: Instance %s (instanceId %u) completed encounter %s. Credit Dungeon: %u", instance->GetMapName(), instance->GetInstanceId(), encounter->dbcEntry->encounterName[0], dungeonId); break; } } diff --git a/src/server/game/Instances/InstanceScript.h b/src/server/game/Instances/InstanceScript.h index 2a2faacd200..acc8012bbbc 100644 --- a/src/server/game/Instances/InstanceScript.h +++ b/src/server/game/Instances/InstanceScript.h @@ -23,11 +23,11 @@ #include "World.h" #include "ObjectMgr.h" -#define OUT_SAVE_INST_DATA TC_LOG_DEBUG(LOG_FILTER_TSCR, "Saving Instance Data for Instance %s (Map %d, Instance Id %d)", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) -#define OUT_SAVE_INST_DATA_COMPLETE TC_LOG_DEBUG(LOG_FILTER_TSCR, "Saving Instance Data for Instance %s (Map %d, Instance Id %d) completed.", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) -#define OUT_LOAD_INST_DATA(a) TC_LOG_DEBUG(LOG_FILTER_TSCR, "Loading Instance Data for Instance %s (Map %d, Instance Id %d). Input is '%s'", instance->GetMapName(), instance->GetId(), instance->GetInstanceId(), a) -#define OUT_LOAD_INST_DATA_COMPLETE TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance Data Load for Instance %s (Map %d, Instance Id: %d) is complete.", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) -#define OUT_LOAD_INST_DATA_FAIL TC_LOG_ERROR(LOG_FILTER_TSCR, "Unable to load Instance Data for Instance %s (Map %d, Instance Id: %d).", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) +#define OUT_SAVE_INST_DATA TC_LOG_DEBUG("scripts", "Saving Instance Data for Instance %s (Map %d, Instance Id %d)", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) +#define OUT_SAVE_INST_DATA_COMPLETE TC_LOG_DEBUG("scripts", "Saving Instance Data for Instance %s (Map %d, Instance Id %d) completed.", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) +#define OUT_LOAD_INST_DATA(a) TC_LOG_DEBUG("scripts", "Loading Instance Data for Instance %s (Map %d, Instance Id %d). Input is '%s'", instance->GetMapName(), instance->GetId(), instance->GetInstanceId(), a) +#define OUT_LOAD_INST_DATA_COMPLETE TC_LOG_DEBUG("scripts", "Instance Data Load for Instance %s (Map %d, Instance Id: %d) is complete.", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) +#define OUT_LOAD_INST_DATA_FAIL TC_LOG_ERROR("scripts", "Unable to load Instance Data for Instance %s (Map %d, Instance Id: %d).", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) class Map; class Unit; diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index cb2e2a8682b..9f5697271aa 100644 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -154,13 +154,13 @@ uint32 LootStore::LoadLootTable() if (maxcount > std::numeric_limits<uint8>::max()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table '%s' entry %d item %d: maxcount value (%u) to large. must be less %u - skipped", GetName(), entry, item, maxcount, std::numeric_limits<uint8>::max()); + TC_LOG_ERROR("sql.sql", "Table '%s' entry %d item %d: maxcount value (%u) to large. must be less %u - skipped", GetName(), entry, item, maxcount, std::numeric_limits<uint8>::max()); continue; // error already printed to log/console. } if (group >= 1 << 7) // it stored in 7 bit field { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table '%s' entry %d item %d: group (%u) must be less %u - skipped", GetName(), entry, item, group, 1 << 7); + TC_LOG_ERROR("sql.sql", "Table '%s' entry %d item %d: group (%u) must be less %u - skipped", GetName(), entry, item, group, 1 << 7); return false; } @@ -267,12 +267,12 @@ void LootStore::ReportUnusedIds(LootIdSet const& lootIdSet) const { // all still listed ids isn't referenced for (LootIdSet::const_iterator itr = lootIdSet.begin(); itr != lootIdSet.end(); ++itr) - TC_LOG_ERROR(LOG_FILTER_SQL, "Table '%s' entry %d isn't %s and not referenced from loot, and then useless.", GetName(), *itr, GetEntryName()); + TC_LOG_ERROR("sql.sql", "Table '%s' entry %d isn't %s and not referenced from loot, and then useless.", GetName(), *itr, GetEntryName()); } void LootStore::ReportNotExistedId(uint32 id) const { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table '%s' entry %d (%s) does not exist but used as loot id in DB.", GetName(), id, GetEntryName()); + TC_LOG_ERROR("sql.sql", "Table '%s' entry %d (%s) does not exist but used as loot id in DB.", GetName(), id, GetEntryName()); } // @@ -301,7 +301,7 @@ bool LootStoreItem::IsValid(LootStore const& store, uint32 entry) const { if (mincountOrRef == 0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table '%s' entry %d item %d: wrong mincountOrRef (%d) - skipped", store.GetName(), entry, itemid, mincountOrRef); + TC_LOG_ERROR("sql.sql", "Table '%s' entry %d item %d: wrong mincountOrRef (%d) - skipped", store.GetName(), entry, itemid, mincountOrRef); return false; } @@ -310,36 +310,36 @@ bool LootStoreItem::IsValid(LootStore const& store, uint32 entry) const ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemid); if (!proto) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table '%s' entry %d item %d: item entry not listed in `item_template` - skipped", store.GetName(), entry, itemid); + TC_LOG_ERROR("sql.sql", "Table '%s' entry %d item %d: item entry not listed in `item_template` - skipped", store.GetName(), entry, itemid); return false; } if (chance == 0 && group == 0) // Zero chance is allowed for grouped entries only { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table '%s' entry %d item %d: equal-chanced grouped entry, but group not defined - skipped", store.GetName(), entry, itemid); + TC_LOG_ERROR("sql.sql", "Table '%s' entry %d item %d: equal-chanced grouped entry, but group not defined - skipped", store.GetName(), entry, itemid); return false; } if (chance != 0 && chance < 0.000001f) // loot with low chance { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table '%s' entry %d item %d: low chance (%f) - skipped", + TC_LOG_ERROR("sql.sql", "Table '%s' entry %d item %d: low chance (%f) - skipped", store.GetName(), entry, itemid, chance); return false; } if (maxcount < mincountOrRef) // wrong max count { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table '%s' entry %d item %d: max count (%u) less that min count (%i) - skipped", store.GetName(), entry, itemid, int32(maxcount), mincountOrRef); + TC_LOG_ERROR("sql.sql", "Table '%s' entry %d item %d: max count (%u) less that min count (%i) - skipped", store.GetName(), entry, itemid, int32(maxcount), mincountOrRef); return false; } } else // mincountOrRef < 0 { if (needs_quest) - TC_LOG_ERROR(LOG_FILTER_SQL, "Table '%s' entry %d item %d: quest chance will be treated as non-quest chance", store.GetName(), entry, itemid); + TC_LOG_ERROR("sql.sql", "Table '%s' entry %d item %d: quest chance will be treated as non-quest chance", store.GetName(), entry, itemid); else if (chance == 0) // no chance for the reference { - TC_LOG_ERROR(LOG_FILTER_SQL, "Table '%s' entry %d item %d: zero chance is specified for a reference, skipped", store.GetName(), entry, itemid); + TC_LOG_ERROR("sql.sql", "Table '%s' entry %d item %d: zero chance is specified for a reference, skipped", store.GetName(), entry, itemid); return false; } } @@ -364,6 +364,7 @@ LootItem::LootItem(LootStoreItem const& li) randomSuffix = GenerateEnchSuffixFactor(itemid); randomPropertyId = Item::GenerateItemRandomPropertyId(itemid); + count = 0; is_looted = 0; is_blocked = 0; is_underthreshold = 0; @@ -449,7 +450,7 @@ bool Loot::FillLoot(uint32 lootId, LootStore const& store, Player* lootOwner, bo if (!tab) { if (!noEmptyError) - TC_LOG_ERROR(LOG_FILTER_SQL, "Table '%s' loot id #%u used but it doesn't have records.", store.GetName(), lootId); + TC_LOG_ERROR("sql.sql", "Table '%s' loot id #%u used but it doesn't have records.", store.GetName(), lootId); return false; } @@ -1186,10 +1187,10 @@ void LootTemplate::LootGroup::Verify(LootStore const& lootstore, uint32 id, uint { float chance = RawTotalChance(); if (chance > 101.0f) /// @todo replace with 100% when DBs will be ready - TC_LOG_ERROR(LOG_FILTER_SQL, "Table '%s' entry %u group %d has total chance > 100%% (%f)", lootstore.GetName(), id, group_id, chance); + TC_LOG_ERROR("sql.sql", "Table '%s' entry %u group %d has total chance > 100%% (%f)", lootstore.GetName(), id, group_id, chance); if (chance >= 100.0f && !EqualChanced.empty()) - TC_LOG_ERROR(LOG_FILTER_SQL, "Table '%s' entry %u group %d has items with chance=0%% but group total chance >= 100%% (%f)", lootstore.GetName(), id, group_id, chance); + TC_LOG_ERROR("sql.sql", "Table '%s' entry %u group %d has items with chance=0%% but group total chance >= 100%% (%f)", lootstore.GetName(), id, group_id, chance); } void LootTemplate::LootGroup::CheckLootRefs(LootTemplateMap const& /*store*/, LootIdSet* ref_set) const @@ -1428,7 +1429,7 @@ bool LootTemplate::addConditionItem(Condition* cond) { if (!cond || !cond->isLoaded())//should never happen, checked at loading { - TC_LOG_ERROR(LOG_FILTER_LOOT, "LootTemplate::addConditionItem: condition is null"); + TC_LOG_ERROR("loot", "LootTemplate::addConditionItem: condition is null"); return false; } @@ -1493,7 +1494,7 @@ bool LootTemplate::isReference(uint32 id) void LoadLootTemplates_Creature() { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading creature loot templates..."); + TC_LOG_INFO("server.loading", "Loading creature loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1520,14 +1521,14 @@ void LoadLootTemplates_Creature() LootTemplates_Creature.ReportUnusedIds(lootIdSet); if (count) - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u creature loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature loot templates. DB table `creature_loot_template` is empty"); + TC_LOG_ERROR("server.loading", ">> Loaded 0 creature loot templates. DB table `creature_loot_template` is empty"); } void LoadLootTemplates_Disenchant() { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading disenchanting loot templates..."); + TC_LOG_INFO("server.loading", "Loading disenchanting loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1553,14 +1554,14 @@ void LoadLootTemplates_Disenchant() LootTemplates_Disenchant.ReportUnusedIds(lootIdSet); if (count) - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u disenchanting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u disenchanting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 disenchanting loot templates. DB table `disenchant_loot_template` is empty"); + TC_LOG_ERROR("server.loading", ">> Loaded 0 disenchanting loot templates. DB table `disenchant_loot_template` is empty"); } void LoadLootTemplates_Fishing() { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading fishing loot templates..."); + TC_LOG_INFO("server.loading", "Loading fishing loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1577,14 +1578,14 @@ void LoadLootTemplates_Fishing() LootTemplates_Fishing.ReportUnusedIds(lootIdSet); if (count) - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u fishing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u fishing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 fishing loot templates. DB table `fishing_loot_template` is empty"); + TC_LOG_ERROR("server.loading", ">> Loaded 0 fishing loot templates. DB table `fishing_loot_template` is empty"); } void LoadLootTemplates_Gameobject() { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading gameobject loot templates..."); + TC_LOG_INFO("server.loading", "Loading gameobject loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1611,14 +1612,14 @@ void LoadLootTemplates_Gameobject() LootTemplates_Gameobject.ReportUnusedIds(lootIdSet); if (count) - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u gameobject loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u gameobject loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 gameobject loot templates. DB table `gameobject_loot_template` is empty"); + TC_LOG_ERROR("server.loading", ">> Loaded 0 gameobject loot templates. DB table `gameobject_loot_template` is empty"); } void LoadLootTemplates_Item() { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading item loot templates..."); + TC_LOG_INFO("server.loading", "Loading item loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1635,14 +1636,14 @@ void LoadLootTemplates_Item() LootTemplates_Item.ReportUnusedIds(lootIdSet); if (count) - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u item loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u item loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 item loot templates. DB table `item_loot_template` is empty"); + TC_LOG_ERROR("server.loading", ">> Loaded 0 item loot templates. DB table `item_loot_template` is empty"); } void LoadLootTemplates_Milling() { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading milling loot templates..."); + TC_LOG_INFO("server.loading", "Loading milling loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1664,14 +1665,14 @@ void LoadLootTemplates_Milling() LootTemplates_Milling.ReportUnusedIds(lootIdSet); if (count) - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u milling loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u milling loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 milling loot templates. DB table `milling_loot_template` is empty"); + TC_LOG_ERROR("server.loading", ">> Loaded 0 milling loot templates. DB table `milling_loot_template` is empty"); } void LoadLootTemplates_Pickpocketing() { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading pickpocketing loot templates..."); + TC_LOG_INFO("server.loading", "Loading pickpocketing loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1698,14 +1699,14 @@ void LoadLootTemplates_Pickpocketing() LootTemplates_Pickpocketing.ReportUnusedIds(lootIdSet); if (count) - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u pickpocketing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u pickpocketing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 pickpocketing loot templates. DB table `pickpocketing_loot_template` is empty"); + TC_LOG_ERROR("server.loading", ">> Loaded 0 pickpocketing loot templates. DB table `pickpocketing_loot_template` is empty"); } void LoadLootTemplates_Prospecting() { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading prospecting loot templates..."); + TC_LOG_INFO("server.loading", "Loading prospecting loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1727,14 +1728,14 @@ void LoadLootTemplates_Prospecting() LootTemplates_Prospecting.ReportUnusedIds(lootIdSet); if (count) - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u prospecting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u prospecting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 prospecting loot templates. DB table `prospecting_loot_template` is empty"); + TC_LOG_ERROR("server.loading", ">> Loaded 0 prospecting loot templates. DB table `prospecting_loot_template` is empty"); } void LoadLootTemplates_Mail() { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading mail loot templates..."); + TC_LOG_INFO("server.loading", "Loading mail loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1751,14 +1752,14 @@ void LoadLootTemplates_Mail() LootTemplates_Mail.ReportUnusedIds(lootIdSet); if (count) - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u mail loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u mail loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 mail loot templates. DB table `mail_loot_template` is empty"); + TC_LOG_ERROR("server.loading", ">> Loaded 0 mail loot templates. DB table `mail_loot_template` is empty"); } void LoadLootTemplates_Skinning() { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading skinning loot templates..."); + TC_LOG_INFO("server.loading", "Loading skinning loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1785,14 +1786,14 @@ void LoadLootTemplates_Skinning() LootTemplates_Skinning.ReportUnusedIds(lootIdSet); if (count) - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u skinning loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u skinning loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 skinning loot templates. DB table `skinning_loot_template` is empty"); + TC_LOG_ERROR("server.loading", ">> Loaded 0 skinning loot templates. DB table `skinning_loot_template` is empty"); } void LoadLootTemplates_Spell() { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading spell loot templates..."); + TC_LOG_INFO("server.loading", "Loading spell loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1827,14 +1828,14 @@ void LoadLootTemplates_Spell() LootTemplates_Spell.ReportUnusedIds(lootIdSet); if (count) - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u spell loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell loot templates. DB table `spell_loot_template` is empty"); + TC_LOG_ERROR("server.loading", ">> Loaded 0 spell loot templates. DB table `spell_loot_template` is empty"); } void LoadLootTemplates_Reference() { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading reference loot templates..."); + TC_LOG_INFO("server.loading", "Loading reference loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1857,5 +1858,5 @@ void LoadLootTemplates_Reference() // output error for any still listed ids (not referenced from any loot table) LootTemplates_Reference.ReportUnusedIds(lootIdSet); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded refence loot templates in %u ms", GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded refence loot templates in %u ms", GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/Loot/LootMgr.h b/src/server/game/Loot/LootMgr.h index 895d09fe7ad..9f7a08c3c6c 100644 --- a/src/server/game/Loot/LootMgr.h +++ b/src/server/game/Loot/LootMgr.h @@ -148,7 +148,9 @@ struct LootItem explicit LootItem(LootStoreItem const& li); // Empty constructor for creating an empty LootItem to be filled in with DB data - LootItem() : canSave(true){ }; + LootItem() : itemid(0), randomSuffix(0), randomPropertyId(0), count(0), is_looted(false), is_blocked(false), + freeforall(false), is_underthreshold(false), is_counted(false), needs_quest(false), follow_loot_rules(false), + canSave(true){ }; // Basic checks for player/item compatibility - if false no chance to see the item in the loot bool AllowedForPlayer(Player const* player) const; @@ -303,7 +305,7 @@ struct Loot // Only set for inventory items that can be right-click looted uint32 containerID; - Loot(uint32 _gold = 0) : gold(_gold), unlootedCount(0), loot_type(LOOT_CORPSE), maxDuplicates(1), containerID(0) { } + Loot(uint32 _gold = 0) : gold(_gold), unlootedCount(0), roundRobinPlayer(0), loot_type(LOOT_CORPSE), maxDuplicates(1), containerID(0) { } ~Loot() { clear(); } // For deleting items at loot removal since there is no backward interface to the Item() diff --git a/src/server/game/Mails/Mail.cpp b/src/server/game/Mails/Mail.cpp index fd4bcbd5dc0..2b47348e5f6 100644 --- a/src/server/game/Mails/Mail.cpp +++ b/src/server/game/Mails/Mail.cpp @@ -51,7 +51,7 @@ MailSender::MailSender(Object* sender, MailStationery stationery) : m_stationery default: m_messageType = MAIL_NORMAL; m_senderId = 0; // will show mail from not existed player - TC_LOG_ERROR(LOG_FILTER_GENERAL, "MailSender::MailSender - Mail have unexpected sender typeid (%u)", sender->GetTypeId()); + TC_LOG_ERROR("misc", "MailSender::MailSender - Mail have unexpected sender typeid (%u)", sender->GetTypeId()); break; } } diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 3692029fa17..367e512d4bb 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -68,12 +68,8 @@ Map::~Map() Transport* transport = *itr; ++itr; - // Destroy local transports - if (transport->GetTransportTemplate()->inInstance) - { - transport->RemoveFromWorld(); - delete transport; - } + transport->RemoveFromWorld(); + delete transport; } if (!m_scriptSchedule.empty()) @@ -94,14 +90,14 @@ bool Map::ExistMap(uint32 mapid, int gx, int gy) FILE* pf = fopen(fileName, "rb"); if (!pf) - TC_LOG_ERROR(LOG_FILTER_MAPS, "Map file '%s': does not exist!", fileName); + TC_LOG_ERROR("maps", "Map file '%s': does not exist!", fileName); else { map_fileheader header; if (fread(&header, sizeof(header), 1, pf) == 1) { if (header.mapMagic.asUInt != MapMagic.asUInt || header.versionMagic.asUInt != MapVersionMagic.asUInt) - TC_LOG_ERROR(LOG_FILTER_MAPS, "Map file '%s' is from an incompatible map version (%.*s %.*s), %.*s %.*s is expected. Please recreate using the mapextractor.", + TC_LOG_ERROR("maps", "Map file '%s' is from an incompatible map version (%.*s %.*s), %.*s %.*s is expected. Please recreate using the mapextractor.", fileName, 4, header.mapMagic.asChar, 4, header.versionMagic.asChar, 4, MapMagic.asChar, 4, MapVersionMagic.asChar); else ret = true; @@ -123,7 +119,7 @@ bool Map::ExistVMap(uint32 mapid, int gx, int gy) if (!exists) { std::string name = vmgr->getDirFileName(mapid, gx, gy); - TC_LOG_ERROR(LOG_FILTER_MAPS, "VMap file '%s' is missing or points to wrong version of vmap file. Redo vmaps with latest version of vmap_assembler.exe.", (sWorld->GetDataPath()+"vmaps/"+name).c_str()); + TC_LOG_ERROR("maps", "VMap file '%s' is missing or points to wrong version of vmap file. Redo vmaps with latest version of vmap_assembler.exe.", (sWorld->GetDataPath()+"vmaps/"+name).c_str()); return false; } } @@ -141,9 +137,9 @@ void Map::LoadMMap(int gx, int gy) mmapLoadResult = MMAP::MMapFactory::CreateOrGetMMapManager()->LoadMapTile(GetId(), gx, gy); if (mmapLoadResult) - TC_LOG_INFO(LOG_FILTER_MAPS, "MMAP loaded name: %s, id: %d, x: %d, y: %d", GetMapName(), GetId(), gx, gy); + TC_LOG_INFO("maps", "MMAP loaded name: %s, id: %d, x: %d, y: %d", GetMapName(), GetId(), gx, gy); else - TC_LOG_INFO(LOG_FILTER_MAPS, "Could not load MMAP name: %s, id: %d, x: %d, y: %d", GetMapName(), GetId(), gx, gy); + TC_LOG_INFO("maps", "Could not load MMAP name: %s, id: %d, x: %d, y: %d", GetMapName(), GetId(), gx, gy); } void Map::LoadVMap(int gx, int gy) @@ -153,13 +149,13 @@ void Map::LoadVMap(int gx, int gy) switch (vmapLoadResult) { case VMAP::VMAP_LOAD_RESULT_OK: - TC_LOG_INFO(LOG_FILTER_MAPS, "VMAP loaded name:%s, id:%d, x:%d, y:%d (vmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy); + TC_LOG_INFO("maps", "VMAP loaded name:%s, id:%d, x:%d, y:%d (vmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy); break; case VMAP::VMAP_LOAD_RESULT_ERROR: - TC_LOG_INFO(LOG_FILTER_MAPS, "Could not load VMAP name:%s, id:%d, x:%d, y:%d (vmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy); + TC_LOG_INFO("maps", "Could not load VMAP name:%s, id:%d, x:%d, y:%d (vmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy); break; case VMAP::VMAP_LOAD_RESULT_IGNORED: - TC_LOG_DEBUG(LOG_FILTER_MAPS, "Ignored VMAP name:%s, id:%d, x:%d, y:%d (vmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy); + TC_LOG_DEBUG("maps", "Ignored VMAP name:%s, id:%d, x:%d, y:%d (vmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy); break; } } @@ -186,7 +182,7 @@ void Map::LoadMap(int gx, int gy, bool reload) //map already load, delete it before reloading (Is it necessary? Do we really need the ability the reload maps during runtime?) if (GridMaps[gx][gy]) { - TC_LOG_INFO(LOG_FILTER_MAPS, "Unloading previously loaded map %u before reloading.", GetId()); + TC_LOG_INFO("maps", "Unloading previously loaded map %u before reloading.", GetId()); sScriptMgr->OnUnloadGridMap(this, GridMaps[gx][gy], gx, gy); delete (GridMaps[gx][gy]); @@ -198,11 +194,11 @@ void Map::LoadMap(int gx, int gy, bool reload) int len = sWorld->GetDataPath().length() + strlen("maps/%03u%02u%02u.map") + 1; tmp = new char[len]; snprintf(tmp, len, (char *)(sWorld->GetDataPath() + "maps/%03u%02u%02u.map").c_str(), GetId(), gx, gy); - TC_LOG_INFO(LOG_FILTER_MAPS, "Loading map %s", tmp); + TC_LOG_INFO("maps", "Loading map %s", tmp); // loading data GridMaps[gx][gy] = new GridMap(); if (!GridMaps[gx][gy]->loadData(tmp)) - TC_LOG_ERROR(LOG_FILTER_MAPS, "Error loading map file: \n %s\n", tmp); + TC_LOG_ERROR("maps", "Error loading map file: \n %s\n", tmp); delete[] tmp; sScriptMgr->OnLoadGridMap(this, GridMaps[gx][gy], gx, gy); @@ -310,7 +306,7 @@ void Map::SwitchGridContainers(Creature* obj, bool on) CellCoord p = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY()); if (!p.IsCoordValid()) { - TC_LOG_ERROR(LOG_FILTER_MAPS, "Map::SwitchGridContainers: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord); + TC_LOG_ERROR("maps", "Map::SwitchGridContainers: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord); return; } @@ -318,7 +314,7 @@ void Map::SwitchGridContainers(Creature* obj, bool on) if (!IsGridLoaded(GridCoord(cell.data.Part.grid_x, cell.data.Part.grid_y))) return; - TC_LOG_DEBUG(LOG_FILTER_MAPS, "Switch object " UI64FMTD " from grid[%u, %u] %u", obj->GetGUID(), cell.data.Part.grid_x, cell.data.Part.grid_y, on); + TC_LOG_DEBUG("maps", "Switch object " UI64FMTD " from grid[%u, %u] %u", obj->GetGUID(), cell.data.Part.grid_x, cell.data.Part.grid_y, on); NGridType *ngrid = getNGrid(cell.GridX(), cell.GridY()); ASSERT(ngrid != NULL); @@ -347,7 +343,7 @@ void Map::SwitchGridContainers(GameObject* obj, bool on) CellCoord p = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY()); if (!p.IsCoordValid()) { - TC_LOG_ERROR(LOG_FILTER_MAPS, "Map::SwitchGridContainers: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord); + TC_LOG_ERROR("maps", "Map::SwitchGridContainers: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord); return; } @@ -355,7 +351,7 @@ void Map::SwitchGridContainers(GameObject* obj, bool on) if (!IsGridLoaded(GridCoord(cell.data.Part.grid_x, cell.data.Part.grid_y))) return; - TC_LOG_DEBUG(LOG_FILTER_MAPS, "Switch object " UI64FMTD " from grid[%u, %u] %u", obj->GetGUID(), cell.data.Part.grid_x, cell.data.Part.grid_y, on); + TC_LOG_DEBUG("maps", "Switch object " UI64FMTD " from grid[%u, %u] %u", obj->GetGUID(), cell.data.Part.grid_x, cell.data.Part.grid_y, on); NGridType *ngrid = getNGrid(cell.GridX(), cell.GridY()); ASSERT(ngrid != NULL); @@ -402,7 +398,7 @@ void Map::EnsureGridCreated_i(const GridCoord &p) { if (!getNGrid(p.x_coord, p.y_coord)) { - TC_LOG_DEBUG(LOG_FILTER_MAPS, "Creating grid[%u, %u] for map %u instance %u", p.x_coord, p.y_coord, GetId(), i_InstanceId); + TC_LOG_DEBUG("maps", "Creating grid[%u, %u] for map %u instance %u", p.x_coord, p.y_coord, GetId(), i_InstanceId); setNGrid(new NGridType(p.x_coord*MAX_NUMBER_OF_GRIDS + p.y_coord, p.x_coord, p.y_coord, i_gridExpiry, sWorld->getBoolConfig(CONFIG_GRID_UNLOAD)), p.x_coord, p.y_coord); @@ -431,7 +427,7 @@ void Map::EnsureGridLoadedForActiveObject(const Cell &cell, WorldObject* object) // refresh grid state & timer if (grid->GetGridState() != GRID_STATE_ACTIVE) { - TC_LOG_DEBUG(LOG_FILTER_MAPS, "Active object " UI64FMTD " triggers loading of grid [%u, %u] on map %u", object->GetGUID(), cell.GridX(), cell.GridY(), GetId()); + TC_LOG_DEBUG("maps", "Active object " UI64FMTD " triggers loading of grid [%u, %u] on map %u", object->GetGUID(), cell.GridX(), cell.GridY(), GetId()); ResetGridExpiry(*grid, 0.1f); grid->SetGridState(GRID_STATE_ACTIVE); } @@ -446,7 +442,7 @@ bool Map::EnsureGridLoaded(const Cell &cell) ASSERT(grid != NULL); if (!isGridObjectDataLoaded(cell.GridX(), cell.GridY())) { - TC_LOG_DEBUG(LOG_FILTER_MAPS, "Loading grid[%u, %u] for map %u instance %u", cell.GridX(), cell.GridY(), GetId(), i_InstanceId); + TC_LOG_DEBUG("maps", "Loading grid[%u, %u] for map %u instance %u", cell.GridX(), cell.GridY(), GetId(), i_InstanceId); setGridObjectDataLoaded(true, cell.GridX(), cell.GridY()); @@ -472,7 +468,7 @@ bool Map::AddPlayerToMap(Player* player) CellCoord cellCoord = Trinity::ComputeCellCoord(player->GetPositionX(), player->GetPositionY()); if (!cellCoord.IsCoordValid()) { - TC_LOG_ERROR(LOG_FILTER_MAPS, "Map::Add: Player (GUID: %u) has invalid coordinates X:%f Y:%f grid cell [%u:%u]", player->GetGUIDLow(), player->GetPositionX(), player->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord); + TC_LOG_ERROR("maps", "Map::Add: Player (GUID: %u) has invalid coordinates X:%f Y:%f grid cell [%u:%u]", player->GetGUIDLow(), player->GetPositionX(), player->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord); return false; } @@ -528,7 +524,7 @@ bool Map::AddToMap(T* obj) ASSERT(cellCoord.IsCoordValid()); if (!cellCoord.IsCoordValid()) { - TC_LOG_ERROR(LOG_FILTER_MAPS, "Map::Add: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord); + TC_LOG_ERROR("maps", "Map::Add: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord); return false; //Should delete object } @@ -538,7 +534,7 @@ bool Map::AddToMap(T* obj) else EnsureGridCreated(GridCoord(cell.GridX(), cell.GridY())); AddToGrid(obj, cell); - TC_LOG_DEBUG(LOG_FILTER_MAPS, "Object %u enters grid[%u, %u]", GUID_LOPART(obj->GetGUID()), cell.GridX(), cell.GridY()); + TC_LOG_DEBUG("maps", "Object %u enters grid[%u, %u]", GUID_LOPART(obj->GetGUID()), cell.GridX(), cell.GridY()); //Must already be set before AddToMap. Usually during obj->Create. //obj->SetMap(this); @@ -565,7 +561,7 @@ bool Map::AddToMap(Transport* obj) CellCoord cellCoord = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY()); if (!cellCoord.IsCoordValid()) { - TC_LOG_ERROR(LOG_FILTER_MAPS, "Map::Add: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord); + TC_LOG_ERROR("maps", "Map::Add: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord); return false; //Should delete object } @@ -862,7 +858,7 @@ void Map::PlayerRelocation(Player* player, float x, float y, float z, float orie if (old_cell.DiffGrid(new_cell) || old_cell.DiffCell(new_cell)) { - TC_LOG_DEBUG(LOG_FILTER_MAPS, "Player %s relocation grid[%u, %u]cell[%u, %u]->grid[%u, %u]cell[%u, %u]", player->GetName().c_str(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY()); + TC_LOG_DEBUG("maps", "Player %s relocation grid[%u, %u]cell[%u, %u]->grid[%u, %u]cell[%u, %u]", player->GetName().c_str(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY()); player->RemoveFromGrid(); @@ -895,7 +891,7 @@ void Map::CreatureRelocation(Creature* creature, float x, float y, float z, floa if (old_cell.DiffCell(new_cell) || old_cell.DiffGrid(new_cell)) { #ifdef TRINITY_DEBUG - TC_LOG_DEBUG(LOG_FILTER_MAPS, "Creature (GUID: %u Entry: %u) added to moving list from grid[%u, %u]cell[%u, %u] to grid[%u, %u]cell[%u, %u].", creature->GetGUIDLow(), creature->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY()); + TC_LOG_DEBUG("maps", "Creature (GUID: %u Entry: %u) added to moving list from grid[%u, %u]cell[%u, %u] to grid[%u, %u]cell[%u, %u].", creature->GetGUIDLow(), creature->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY()); #endif AddCreatureToMoveList(creature, x, y, z, ang); // in diffcell/diffgrid case notifiers called at finishing move creature in Map::MoveAllCreaturesInMoveList @@ -927,7 +923,7 @@ void Map::GameObjectRelocation(GameObject* go, float x, float y, float z, float if (old_cell.DiffCell(new_cell) || old_cell.DiffGrid(new_cell)) { #ifdef TRINITY_DEBUG - TC_LOG_DEBUG(LOG_FILTER_MAPS, "GameObject (GUID: %u Entry: %u) added to moving list from grid[%u, %u]cell[%u, %u] to grid[%u, %u]cell[%u, %u].", go->GetGUIDLow(), go->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY()); + TC_LOG_DEBUG("maps", "GameObject (GUID: %u Entry: %u) added to moving list from grid[%u, %u]cell[%u, %u] to grid[%u, %u]cell[%u, %u].", go->GetGUIDLow(), go->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY()); #endif AddGameObjectToMoveList(go, x, y, z, orientation); // in diffcell/diffgrid case notifiers called at finishing move go in Map::MoveAllGameObjectsInMoveList @@ -1019,7 +1015,7 @@ void Map::MoveAllCreaturesInMoveList() { // ... or unload (if respawn grid also not loaded) #ifdef TRINITY_DEBUG - TC_LOG_DEBUG(LOG_FILTER_MAPS, "Creature (GUID: %u Entry: %u) cannot be move to unloaded respawn grid.", c->GetGUIDLow(), c->GetEntry()); + TC_LOG_DEBUG("maps", "Creature (GUID: %u Entry: %u) cannot be move to unloaded respawn grid.", c->GetGUIDLow(), c->GetEntry()); #endif //AddObjectToRemoveList(Pet*) should only be called in Pet::Remove //This may happen when a player just logs in and a pet moves to a nearby unloaded cell @@ -1072,7 +1068,7 @@ void Map::MoveAllGameObjectsInMoveList() { // ... or unload (if respawn grid also not loaded) #ifdef TRINITY_DEBUG - sLog->outDebug(LOG_FILTER_MAPS, "GameObject (GUID: %u Entry: %u) cannot be move to unloaded respawn grid.", go->GetGUIDLow(), go->GetEntry()); + TC_LOG_DEBUG("maps", "GameObject (GUID: %u Entry: %u) cannot be move to unloaded respawn grid.", go->GetGUIDLow(), go->GetEntry()); #endif AddObjectToRemoveList(go); } @@ -1091,7 +1087,7 @@ bool Map::CreatureCellRelocation(Creature* c, Cell new_cell) if (old_cell.DiffCell(new_cell)) { #ifdef TRINITY_DEBUG - TC_LOG_DEBUG(LOG_FILTER_MAPS, "Creature (GUID: %u Entry: %u) moved in grid[%u, %u] from cell[%u, %u] to cell[%u, %u].", c->GetGUIDLow(), c->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.CellX(), new_cell.CellY()); + TC_LOG_DEBUG("maps", "Creature (GUID: %u Entry: %u) moved in grid[%u, %u] from cell[%u, %u] to cell[%u, %u].", c->GetGUIDLow(), c->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.CellX(), new_cell.CellY()); #endif c->RemoveFromGrid(); @@ -1100,7 +1096,7 @@ bool Map::CreatureCellRelocation(Creature* c, Cell new_cell) else { #ifdef TRINITY_DEBUG - TC_LOG_DEBUG(LOG_FILTER_MAPS, "Creature (GUID: %u Entry: %u) moved in same grid[%u, %u]cell[%u, %u].", c->GetGUIDLow(), c->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY()); + TC_LOG_DEBUG("maps", "Creature (GUID: %u Entry: %u) moved in same grid[%u, %u]cell[%u, %u].", c->GetGUIDLow(), c->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY()); #endif } @@ -1113,7 +1109,7 @@ bool Map::CreatureCellRelocation(Creature* c, Cell new_cell) EnsureGridLoadedForActiveObject(new_cell, c); #ifdef TRINITY_DEBUG - TC_LOG_DEBUG(LOG_FILTER_MAPS, "Active creature (GUID: %u Entry: %u) moved from grid[%u, %u]cell[%u, %u] to grid[%u, %u]cell[%u, %u].", c->GetGUIDLow(), c->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY()); + TC_LOG_DEBUG("maps", "Active creature (GUID: %u Entry: %u) moved from grid[%u, %u]cell[%u, %u] to grid[%u, %u]cell[%u, %u].", c->GetGUIDLow(), c->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY()); #endif c->RemoveFromGrid(); @@ -1126,7 +1122,7 @@ bool Map::CreatureCellRelocation(Creature* c, Cell new_cell) if (IsGridLoaded(GridCoord(new_cell.GridX(), new_cell.GridY()))) { #ifdef TRINITY_DEBUG - TC_LOG_DEBUG(LOG_FILTER_MAPS, "Creature (GUID: %u Entry: %u) moved from grid[%u, %u]cell[%u, %u] to grid[%u, %u]cell[%u, %u].", c->GetGUIDLow(), c->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY()); + TC_LOG_DEBUG("maps", "Creature (GUID: %u Entry: %u) moved from grid[%u, %u]cell[%u, %u] to grid[%u, %u]cell[%u, %u].", c->GetGUIDLow(), c->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY()); #endif c->RemoveFromGrid(); @@ -1138,7 +1134,7 @@ bool Map::CreatureCellRelocation(Creature* c, Cell new_cell) // fail to move: normal creature attempt move to unloaded grid #ifdef TRINITY_DEBUG - TC_LOG_DEBUG(LOG_FILTER_MAPS, "Creature (GUID: %u Entry: %u) attempted to move from grid[%u, %u]cell[%u, %u] to unloaded grid[%u, %u]cell[%u, %u].", c->GetGUIDLow(), c->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY()); + TC_LOG_DEBUG("maps", "Creature (GUID: %u Entry: %u) attempted to move from grid[%u, %u]cell[%u, %u] to unloaded grid[%u, %u]cell[%u, %u].", c->GetGUIDLow(), c->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY()); #endif return false; } @@ -1152,7 +1148,7 @@ bool Map::GameObjectCellRelocation(GameObject* go, Cell new_cell) if (old_cell.DiffCell(new_cell)) { #ifdef TRINITY_DEBUG - TC_LOG_DEBUG(LOG_FILTER_MAPS, "GameObject (GUID: %u Entry: %u) moved in grid[%u, %u] from cell[%u, %u] to cell[%u, %u].", go->GetGUIDLow(), go->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.CellX(), new_cell.CellY()); + TC_LOG_DEBUG("maps", "GameObject (GUID: %u Entry: %u) moved in grid[%u, %u] from cell[%u, %u] to cell[%u, %u].", go->GetGUIDLow(), go->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.CellX(), new_cell.CellY()); #endif go->RemoveFromGrid(); @@ -1161,7 +1157,7 @@ bool Map::GameObjectCellRelocation(GameObject* go, Cell new_cell) else { #ifdef TRINITY_DEBUG - TC_LOG_DEBUG(LOG_FILTER_MAPS, "GameObject (GUID: %u Entry: %u) moved in same grid[%u, %u]cell[%u, %u].", go->GetGUIDLow(), go->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY()); + TC_LOG_DEBUG("maps", "GameObject (GUID: %u Entry: %u) moved in same grid[%u, %u]cell[%u, %u].", go->GetGUIDLow(), go->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY()); #endif } @@ -1174,7 +1170,7 @@ bool Map::GameObjectCellRelocation(GameObject* go, Cell new_cell) EnsureGridLoadedForActiveObject(new_cell, go); #ifdef TRINITY_DEBUG - TC_LOG_DEBUG(LOG_FILTER_MAPS, "Active GameObject (GUID: %u Entry: %u) moved from grid[%u, %u]cell[%u, %u] to grid[%u, %u]cell[%u, %u].", go->GetGUIDLow(), go->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY()); + TC_LOG_DEBUG("maps", "Active GameObject (GUID: %u Entry: %u) moved from grid[%u, %u]cell[%u, %u] to grid[%u, %u]cell[%u, %u].", go->GetGUIDLow(), go->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY()); #endif go->RemoveFromGrid(); @@ -1187,7 +1183,7 @@ bool Map::GameObjectCellRelocation(GameObject* go, Cell new_cell) if (IsGridLoaded(GridCoord(new_cell.GridX(), new_cell.GridY()))) { #ifdef TRINITY_DEBUG - TC_LOG_DEBUG(LOG_FILTER_MAPS, "GameObject (GUID: %u Entry: %u) moved from grid[%u, %u]cell[%u, %u] to grid[%u, %u]cell[%u, %u].", go->GetGUIDLow(), go->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY()); + TC_LOG_DEBUG("maps", "GameObject (GUID: %u Entry: %u) moved from grid[%u, %u]cell[%u, %u] to grid[%u, %u]cell[%u, %u].", go->GetGUIDLow(), go->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY()); #endif go->RemoveFromGrid(); @@ -1199,7 +1195,7 @@ bool Map::GameObjectCellRelocation(GameObject* go, Cell new_cell) // fail to move: normal GameObject attempt move to unloaded grid #ifdef TRINITY_DEBUG - TC_LOG_DEBUG(LOG_FILTER_MAPS, "GameObject (GUID: %u Entry: %u) attempted to move from grid[%u, %u]cell[%u, %u] to unloaded grid[%u, %u]cell[%u, %u].", go->GetGUIDLow(), go->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY()); + TC_LOG_DEBUG("maps", "GameObject (GUID: %u Entry: %u) attempted to move from grid[%u, %u]cell[%u, %u] to unloaded grid[%u, %u]cell[%u, %u].", go->GetGUIDLow(), go->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY()); #endif return false; } @@ -1218,7 +1214,7 @@ bool Map::CreatureRespawnRelocation(Creature* c, bool diffGridOnly) c->GetMotionMaster()->Clear(); #ifdef TRINITY_DEBUG - TC_LOG_DEBUG(LOG_FILTER_MAPS, "Creature (GUID: %u Entry: %u) moved from grid[%u, %u]cell[%u, %u] to respawn grid[%u, %u]cell[%u, %u].", c->GetGUIDLow(), c->GetEntry(), c->GetCurrentCell().GridX(), c->GetCurrentCell().GridY(), c->GetCurrentCell().CellX(), c->GetCurrentCell().CellY(), resp_cell.GridX(), resp_cell.GridY(), resp_cell.CellX(), resp_cell.CellY()); + TC_LOG_DEBUG("maps", "Creature (GUID: %u Entry: %u) moved from grid[%u, %u]cell[%u, %u] to respawn grid[%u, %u]cell[%u, %u].", c->GetGUIDLow(), c->GetEntry(), c->GetCurrentCell().GridX(), c->GetCurrentCell().GridY(), c->GetCurrentCell().CellX(), c->GetCurrentCell().CellY(), resp_cell.GridX(), resp_cell.GridY(), resp_cell.CellX(), resp_cell.CellY()); #endif // teleport it to respawn point (like normal respawn if player see) @@ -1245,7 +1241,7 @@ bool Map::GameObjectRespawnRelocation(GameObject* go, bool diffGridOnly) return true; #ifdef TRINITY_DEBUG - TC_LOG_DEBUG(LOG_FILTER_MAPS, "GameObject (GUID: %u Entry: %u) moved from grid[%u, %u]cell[%u, %u] to respawn grid[%u, %u]cell[%u, %u].", go->GetGUIDLow(), go->GetEntry(), go->GetCurrentCell().GridX(), go->GetCurrentCell().GridY(), go->GetCurrentCell().CellX(), go->GetCurrentCell().CellY(), resp_cell.GridX(), resp_cell.GridY(), resp_cell.CellX(), resp_cell.CellY()); + TC_LOG_DEBUG("maps", "GameObject (GUID: %u Entry: %u) moved from grid[%u, %u]cell[%u, %u] to respawn grid[%u, %u]cell[%u, %u].", go->GetGUIDLow(), go->GetEntry(), go->GetCurrentCell().GridX(), go->GetCurrentCell().GridY(), go->GetCurrentCell().CellX(), go->GetCurrentCell().CellY(), resp_cell.GridX(), resp_cell.GridY(), resp_cell.CellX(), resp_cell.CellY()); #endif // teleport it to respawn point (like normal respawn if player see) @@ -1275,7 +1271,7 @@ bool Map::UnloadGrid(NGridType& ngrid, bool unloadAll) return false; } - TC_LOG_DEBUG(LOG_FILTER_MAPS, "Unloading grid[%u, %u] for map %u", x, y, GetId()); + TC_LOG_DEBUG("maps", "Unloading grid[%u, %u] for map %u", x, y, GetId()); if (!unloadAll) { @@ -1334,7 +1330,7 @@ bool Map::UnloadGrid(NGridType& ngrid, bool unloadAll) GridMaps[gx][gy] = NULL; } - TC_LOG_DEBUG(LOG_FILTER_MAPS, "Unloading grid[%u, %u] for map %u finished", x, y, GetId()); + TC_LOG_DEBUG("maps", "Unloading grid[%u, %u] for map %u finished", x, y, GetId()); return true; } @@ -1348,7 +1344,7 @@ void Map::RemoveAllPlayers() if (!player->IsBeingTeleportedFar()) { // this is happening for bg - TC_LOG_ERROR(LOG_FILTER_MAPS, "Map::UnloadAll: player %s is still in map %u during unload, this should not happen!", player->GetName().c_str(), GetId()); + TC_LOG_ERROR("maps", "Map::UnloadAll: player %s is still in map %u during unload, this should not happen!", player->GetName().c_str(), GetId()); player->TeleportTo(player->m_homebindMapId, player->m_homebindX, player->m_homebindY, player->m_homebindZ, player->GetOrientation()); } } @@ -1381,6 +1377,7 @@ GridMap::GridMap() // Height level data _gridHeight = INVALID_HEIGHT; _gridGetHeight = &GridMap::getHeightFromFlat; + _gridIntHeightMultiplier = 0; m_V9 = NULL; m_V8 = NULL; // Liquid data @@ -1422,21 +1419,21 @@ bool GridMap::loadData(char* filename) // load up area data if (header.areaMapOffset && !loadAreaData(in, header.areaMapOffset, header.areaMapSize)) { - TC_LOG_ERROR(LOG_FILTER_MAPS, "Error loading map area data\n"); + TC_LOG_ERROR("maps", "Error loading map area data\n"); fclose(in); return false; } // load up height data if (header.heightMapOffset && !loadHeightData(in, header.heightMapOffset, header.heightMapSize)) { - TC_LOG_ERROR(LOG_FILTER_MAPS, "Error loading map height data\n"); + TC_LOG_ERROR("maps", "Error loading map height data\n"); fclose(in); return false; } // load up liquid data if (header.liquidMapOffset && !loadLiquidData(in, header.liquidMapOffset, header.liquidMapSize)) { - TC_LOG_ERROR(LOG_FILTER_MAPS, "Error loading map liquids data\n"); + TC_LOG_ERROR("maps", "Error loading map liquids data\n"); fclose(in); return false; } @@ -1444,7 +1441,7 @@ bool GridMap::loadData(char* filename) return true; } - TC_LOG_ERROR(LOG_FILTER_MAPS, "Map file '%s' is from an incompatible map version (%.*s %.*s), %.*s %.*s is expected. Please recreate using the mapextractor.", + TC_LOG_ERROR("maps", "Map file '%s' is from an incompatible map version (%.*s %.*s), %.*s %.*s is expected. Please recreate using the mapextractor.", filename, 4, header.mapMagic.asChar, 4, header.versionMagic.asChar, 4, MapMagic.asChar, 4, MapVersionMagic.asChar); fclose(in); return false; @@ -2035,7 +2032,7 @@ bool Map::IsOutdoors(float x, float y, float z) const WMOAreaTableEntry const* wmoEntry= GetWMOAreaTableEntryByTripple(rootId, adtId, groupId); if (wmoEntry) { - TC_LOG_DEBUG(LOG_FILTER_MAPS, "Got WMOAreaTableEntry! flag %u, areaid %u", wmoEntry->Flags, wmoEntry->areaId); + TC_LOG_DEBUG("maps", "Got WMOAreaTableEntry! flag %u, areaid %u", wmoEntry->Flags, wmoEntry->areaId); atEntry = GetAreaEntryByAreaID(wmoEntry->areaId); } return IsOutdoorWMO(mogpFlags, adtId, rootId, groupId, wmoEntry, atEntry); @@ -2116,7 +2113,7 @@ ZLiquidStatus Map::getLiquidStatus(float x, float y, float z, uint8 ReqLiquidTyp uint32 liquid_type = 0; if (vmgr->GetLiquidLevel(GetId(), x, y, z, ReqLiquidType, liquid_level, ground_level, liquid_type)) { - TC_LOG_DEBUG(LOG_FILTER_MAPS, "getLiquidStatus(): vmap liquid level: %f ground: %f type: %u", liquid_level, ground_level, liquid_type); + TC_LOG_DEBUG("maps", "getLiquidStatus(): vmap liquid level: %f ground: %f type: %u", liquid_level, ground_level, liquid_type); // Check water level and ground level if (liquid_level > ground_level && z > ground_level - 2) { @@ -2271,7 +2268,7 @@ bool Map::CheckGridIntegrity(Creature* c, bool moved) const Cell xy_cell(c->GetPositionX(), c->GetPositionY()); if (xy_cell != cur_cell) { - TC_LOG_DEBUG(LOG_FILTER_MAPS, "Creature (GUID: %u) X: %f Y: %f (%s) is in grid[%u, %u]cell[%u, %u] instead of grid[%u, %u]cell[%u, %u]", + TC_LOG_DEBUG("maps", "Creature (GUID: %u) X: %f Y: %f (%s) is in grid[%u, %u]cell[%u, %u] instead of grid[%u, %u]cell[%u, %u]", c->GetGUIDLow(), c->GetPositionX(), c->GetPositionY(), (moved ? "final" : "original"), cur_cell.GridX(), cur_cell.GridY(), cur_cell.CellX(), cur_cell.CellY(), @@ -2311,7 +2308,7 @@ void Map::UpdateObjectsVisibilityFor(Player* player, Cell cell, CellCoord cellpa void Map::SendInitSelf(Player* player) { - TC_LOG_INFO(LOG_FILTER_MAPS, "Creating player data for himself %u", player->GetGUIDLow()); + TC_LOG_INFO("maps", "Creating player data for himself %u", player->GetGUIDLow()); UpdateData data; @@ -2371,7 +2368,7 @@ inline void Map::setNGrid(NGridType *grid, uint32 x, uint32 y) { if (x >= MAX_NUMBER_OF_GRIDS || y >= MAX_NUMBER_OF_GRIDS) { - TC_LOG_ERROR(LOG_FILTER_MAPS, "map::setNGrid() Invalid grid coordinates found: %d, %d!", x, y); + TC_LOG_ERROR("maps", "map::setNGrid() Invalid grid coordinates found: %d, %d!", x, y); ASSERT(false); } i_grids[x][y] = grid; @@ -2403,7 +2400,7 @@ void Map::AddObjectToRemoveList(WorldObject* obj) obj->CleanupsBeforeDelete(false); // remove or simplify at least cross referenced links i_objectsToRemove.insert(obj); - //TC_LOG_DEBUG(LOG_FILTER_MAPS, "Object (GUID: %u TypeId: %u) added to removing list.", obj->GetGUIDLow(), obj->GetTypeId()); + //TC_LOG_DEBUG("maps", "Object (GUID: %u TypeId: %u) added to removing list.", obj->GetGUIDLow(), obj->GetTypeId()); } void Map::AddObjectToSwitchList(WorldObject* obj, bool on) @@ -2432,11 +2429,23 @@ void Map::RemoveAllObjectsInRemoveList() bool on = itr->second; i_objectsToSwitch.erase(itr); - if ((obj->GetTypeId() == TYPEID_UNIT || obj->GetTypeId() == TYPEID_GAMEOBJECT) && !obj->IsPermanentWorldObject()) - SwitchGridContainers(obj, on); + if (!obj->IsPermanentWorldObject()) + { + switch (obj->GetTypeId()) + { + case TYPEID_UNIT: + SwitchGridContainers<Creature>(obj->ToCreature(), on); + break; + case TYPEID_GAMEOBJECT: + SwitchGridContainers<GameObject>(obj->ToGameObject(), on); + break; + default: + break; + } + } } - //TC_LOG_DEBUG(LOG_FILTER_MAPS, "Object remover 1 check."); + //TC_LOG_DEBUG("maps", "Object remover 1 check."); while (!i_objectsToRemove.empty()) { std::set<WorldObject*>::iterator itr = i_objectsToRemove.begin(); @@ -2448,7 +2457,7 @@ void Map::RemoveAllObjectsInRemoveList() { Corpse* corpse = ObjectAccessor::GetCorpse(*obj, obj->GetGUID()); if (!corpse) - TC_LOG_ERROR(LOG_FILTER_MAPS, "Tried to delete corpse/bones %u that is not in map.", obj->GetGUIDLow()); + TC_LOG_ERROR("maps", "Tried to delete corpse/bones %u that is not in map.", obj->GetGUIDLow()); else RemoveFromMap(corpse, true); break; @@ -2466,14 +2475,14 @@ void Map::RemoveAllObjectsInRemoveList() RemoveFromMap(obj->ToCreature(), true); break; default: - TC_LOG_ERROR(LOG_FILTER_MAPS, "Non-grid object (TypeId: %u) is in grid object remove list, ignored.", obj->GetTypeId()); + TC_LOG_ERROR("maps", "Non-grid object (TypeId: %u) is in grid object remove list, ignored.", obj->GetTypeId()); break; } i_objectsToRemove.erase(itr); } - //TC_LOG_DEBUG(LOG_FILTER_MAPS, "Object remover 2 check."); + //TC_LOG_DEBUG("maps", "Object remover 2 check."); } uint32 Map::GetPlayersCountExceptGMs() const @@ -2550,7 +2559,7 @@ void Map::AddToActive(Creature* c) else { GridCoord p2 = Trinity::ComputeGridCoord(c->GetPositionX(), c->GetPositionY()); - TC_LOG_ERROR(LOG_FILTER_MAPS, "Active creature (GUID: %u Entry: %u) added to grid[%u, %u] but spawn grid[%u, %u] was not loaded.", + TC_LOG_ERROR("maps", "Active creature (GUID: %u Entry: %u) added to grid[%u, %u] but spawn grid[%u, %u] was not loaded.", c->GetGUIDLow(), c->GetEntry(), p.x_coord, p.y_coord, p2.x_coord, p2.y_coord); } } @@ -2581,7 +2590,7 @@ void Map::RemoveFromActive(Creature* c) else { GridCoord p2 = Trinity::ComputeGridCoord(c->GetPositionX(), c->GetPositionY()); - TC_LOG_ERROR(LOG_FILTER_MAPS, "Active creature (GUID: %u Entry: %u) removed from grid[%u, %u] but spawn grid[%u, %u] was not loaded.", + TC_LOG_ERROR("maps", "Active creature (GUID: %u Entry: %u) removed from grid[%u, %u] but spawn grid[%u, %u] was not loaded.", c->GetGUIDLow(), c->GetEntry(), p.x_coord, p.y_coord, p2.x_coord, p2.y_coord); } } @@ -2638,7 +2647,7 @@ bool InstanceMap::CanEnter(Player* player) { if (player->GetMapRef().getTarget() == this) { - TC_LOG_ERROR(LOG_FILTER_MAPS, "InstanceMap::CanEnter - player %s(%u) already in map %d, %d, %d!", player->GetName().c_str(), player->GetGUIDLow(), GetId(), GetInstanceId(), GetSpawnMode()); + TC_LOG_ERROR("maps", "InstanceMap::CanEnter - player %s(%u) already in map %d, %d, %d!", player->GetName().c_str(), player->GetGUIDLow(), GetId(), GetInstanceId(), GetSpawnMode()); ASSERT(false); return false; } @@ -2651,7 +2660,7 @@ bool InstanceMap::CanEnter(Player* player) uint32 maxPlayers = GetMaxPlayers(); if (GetPlayersCountExceptGMs() >= maxPlayers) { - TC_LOG_INFO(LOG_FILTER_MAPS, "MAP: Instance '%u' of map '%s' cannot have more than '%u' players. Player '%s' rejected", GetInstanceId(), GetMapName(), maxPlayers, player->GetName().c_str()); + TC_LOG_INFO("maps", "MAP: Instance '%u' of map '%s' cannot have more than '%u' players. Player '%s' rejected", GetInstanceId(), GetMapName(), maxPlayers, player->GetName().c_str()); player->SendTransferAborted(GetId(), TRANSFER_ABORT_MAX_PLAYERS); return false; } @@ -2721,7 +2730,7 @@ bool InstanceMap::AddPlayerToMap(Player* player) InstanceSave* mapSave = sInstanceSaveMgr->GetInstanceSave(GetInstanceId()); if (!mapSave) { - TC_LOG_INFO(LOG_FILTER_MAPS, "InstanceMap::Add: creating instance save for map %d spawnmode %d with instance id %d", GetId(), GetSpawnMode(), GetInstanceId()); + TC_LOG_INFO("maps", "InstanceMap::Add: creating instance save for map %d spawnmode %d with instance id %d", GetId(), GetSpawnMode(), GetInstanceId()); mapSave = sInstanceSaveMgr->AddInstanceSave(GetId(), GetInstanceId(), Difficulty(GetSpawnMode()), 0, true); } @@ -2734,7 +2743,7 @@ bool InstanceMap::AddPlayerToMap(Player* player) // cannot enter other instances if bound permanently if (playerBind->save != mapSave) { - TC_LOG_ERROR(LOG_FILTER_MAPS, "InstanceMap::Add: player %s(%d) is permanently bound to instance %s %d, %d, %d, %d, %d, %d but he is being put into instance %s %d, %d, %d, %d, %d, %d", player->GetName().c_str(), player->GetGUIDLow(), GetMapName(), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->GetPlayerCount(), playerBind->save->GetGroupCount(), playerBind->save->CanReset(), GetMapName(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->GetPlayerCount(), mapSave->GetGroupCount(), mapSave->CanReset()); + TC_LOG_ERROR("maps", "InstanceMap::Add: player %s(%d) is permanently bound to instance %s %d, %d, %d, %d, %d, %d but he is being put into instance %s %d, %d, %d, %d, %d, %d", player->GetName().c_str(), player->GetGUIDLow(), GetMapName(), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->GetPlayerCount(), playerBind->save->GetGroupCount(), playerBind->save->CanReset(), GetMapName(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->GetPlayerCount(), mapSave->GetGroupCount(), mapSave->CanReset()); return false; } } @@ -2746,9 +2755,9 @@ bool InstanceMap::AddPlayerToMap(Player* player) InstanceGroupBind* groupBind = group->GetBoundInstance(this); if (playerBind && playerBind->save != mapSave) { - TC_LOG_ERROR(LOG_FILTER_MAPS, "InstanceMap::Add: player %s(%d) is being put into instance %s %d, %d, %d, %d, %d, %d but he is in group %d and is bound to instance %d, %d, %d, %d, %d, %d!", player->GetName().c_str(), player->GetGUIDLow(), GetMapName(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->GetPlayerCount(), mapSave->GetGroupCount(), mapSave->CanReset(), GUID_LOPART(group->GetLeaderGUID()), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->GetPlayerCount(), playerBind->save->GetGroupCount(), playerBind->save->CanReset()); + TC_LOG_ERROR("maps", "InstanceMap::Add: player %s(%d) is being put into instance %s %d, %d, %d, %d, %d, %d but he is in group %d and is bound to instance %d, %d, %d, %d, %d, %d!", player->GetName().c_str(), player->GetGUIDLow(), GetMapName(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->GetPlayerCount(), mapSave->GetGroupCount(), mapSave->CanReset(), GUID_LOPART(group->GetLeaderGUID()), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->GetPlayerCount(), playerBind->save->GetGroupCount(), playerBind->save->CanReset()); if (groupBind) - TC_LOG_ERROR(LOG_FILTER_MAPS, "InstanceMap::Add: the group is bound to the instance %s %d, %d, %d, %d, %d, %d", GetMapName(), groupBind->save->GetMapId(), groupBind->save->GetInstanceId(), groupBind->save->GetDifficulty(), groupBind->save->GetPlayerCount(), groupBind->save->GetGroupCount(), groupBind->save->CanReset()); + TC_LOG_ERROR("maps", "InstanceMap::Add: the group is bound to the instance %s %d, %d, %d, %d, %d, %d", GetMapName(), groupBind->save->GetMapId(), groupBind->save->GetInstanceId(), groupBind->save->GetDifficulty(), groupBind->save->GetPlayerCount(), groupBind->save->GetGroupCount(), groupBind->save->CanReset()); //ASSERT(false); return false; } @@ -2760,12 +2769,12 @@ bool InstanceMap::AddPlayerToMap(Player* player) // cannot jump to a different instance without resetting it if (groupBind->save != mapSave) { - TC_LOG_ERROR(LOG_FILTER_MAPS, "InstanceMap::Add: player %s(%d) is being put into instance %d, %d, %d but he is in group %d which is bound to instance %d, %d, %d!", player->GetName().c_str(), player->GetGUIDLow(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), GUID_LOPART(group->GetLeaderGUID()), groupBind->save->GetMapId(), groupBind->save->GetInstanceId(), groupBind->save->GetDifficulty()); - TC_LOG_ERROR(LOG_FILTER_MAPS, "MapSave players: %d, group count: %d", mapSave->GetPlayerCount(), mapSave->GetGroupCount()); + TC_LOG_ERROR("maps", "InstanceMap::Add: player %s(%d) is being put into instance %d, %d, %d but he is in group %d which is bound to instance %d, %d, %d!", player->GetName().c_str(), player->GetGUIDLow(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), GUID_LOPART(group->GetLeaderGUID()), groupBind->save->GetMapId(), groupBind->save->GetInstanceId(), groupBind->save->GetDifficulty()); + TC_LOG_ERROR("maps", "MapSave players: %d, group count: %d", mapSave->GetPlayerCount(), mapSave->GetGroupCount()); if (groupBind->save) - TC_LOG_ERROR(LOG_FILTER_MAPS, "GroupBind save players: %d, group count: %d", groupBind->save->GetPlayerCount(), groupBind->save->GetGroupCount()); + TC_LOG_ERROR("maps", "GroupBind save players: %d, group count: %d", groupBind->save->GetPlayerCount(), groupBind->save->GetGroupCount()); else - TC_LOG_ERROR(LOG_FILTER_MAPS, "GroupBind save NULL"); + TC_LOG_ERROR("maps", "GroupBind save NULL"); return false; } // if the group/leader is permanently bound to the instance @@ -2797,7 +2806,7 @@ bool InstanceMap::AddPlayerToMap(Player* player) // first player enters (no players yet) SetResetSchedule(false); - TC_LOG_INFO(LOG_FILTER_MAPS, "MAP: Player '%s' entered instance '%u' of map '%s'", player->GetName().c_str(), GetInstanceId(), GetMapName()); + TC_LOG_INFO("maps", "MAP: Player '%s' entered instance '%u' of map '%s'", player->GetName().c_str(), GetInstanceId(), GetMapName()); // initialize unload state m_unloadTimer = 0; m_resetAfterUnload = false; @@ -2823,7 +2832,7 @@ void InstanceMap::Update(const uint32 t_diff) void InstanceMap::RemovePlayerFromMap(Player* player, bool remove) { - TC_LOG_INFO(LOG_FILTER_MAPS, "MAP: Removing player '%s' from instance '%u' of map '%s' before relocating to another map", player->GetName().c_str(), GetInstanceId(), GetMapName()); + TC_LOG_INFO("maps", "MAP: Removing player '%s' from instance '%u' of map '%s' before relocating to another map", player->GetName().c_str(), GetInstanceId(), GetMapName()); //if last player set unload timer if (!m_unloadTimer && m_mapRefManager.getSize() == 1) m_unloadTimer = m_unloadWhenEmpty ? MIN_UNLOAD_DELAY : std::max(sWorld->getIntConfig(CONFIG_INSTANCE_UNLOAD_DELAY), (uint32)MIN_UNLOAD_DELAY); @@ -2864,7 +2873,7 @@ void InstanceMap::CreateInstanceData(bool load) i_data->SetCompletedEncountersMask(fields[1].GetUInt32()); if (data != "") { - TC_LOG_DEBUG(LOG_FILTER_MAPS, "Loading instance data for `%s` with id %u", sObjectMgr->GetScriptName(i_script_id), i_InstanceId); + TC_LOG_DEBUG("maps", "Loading instance data for `%s` with id %u", sObjectMgr->GetScriptName(i_script_id), i_InstanceId); i_data->Load(data.c_str()); } } @@ -2918,7 +2927,7 @@ void InstanceMap::PermBindAllPlayers(Player* source) InstanceSave* save = sInstanceSaveMgr->GetInstanceSave(GetInstanceId()); if (!save) { - TC_LOG_ERROR(LOG_FILTER_MAPS, "Cannot bind player (GUID: %u, Name: %s), because no instance save is available for instance map (Name: %s, Entry: %u, InstanceId: %u)!", source->GetGUIDLow(), source->GetName().c_str(), source->GetMap()->GetMapName(), source->GetMapId(), GetInstanceId()); + TC_LOG_ERROR("maps", "Cannot bind player (GUID: %u, Name: %s), because no instance save is available for instance map (Name: %s, Entry: %u, InstanceId: %u)!", source->GetGUIDLow(), source->GetName().c_str(), source->GetMap()->GetMapName(), source->GetMapId(), GetInstanceId()); return; } @@ -2972,7 +2981,7 @@ void InstanceMap::SetResetSchedule(bool on) if (InstanceSave* save = sInstanceSaveMgr->GetInstanceSave(GetInstanceId())) sInstanceSaveMgr->ScheduleReset(on, save->GetResetTime(), InstanceSaveManager::InstResetEvent(0, GetId(), Difficulty(GetSpawnMode()), GetInstanceId())); else - TC_LOG_ERROR(LOG_FILTER_MAPS, "InstanceMap::SetResetSchedule: cannot turn schedule %s, there is no save information for instance (map [id: %u, name: %s], instance id: %u, difficulty: %u)", + TC_LOG_ERROR("maps", "InstanceMap::SetResetSchedule: cannot turn schedule %s, there is no save information for instance (map [id: %u, name: %s], instance id: %u, difficulty: %u)", on ? "on" : "off", GetId(), GetMapName(), GetInstanceId(), Difficulty(GetSpawnMode())); } } @@ -3034,7 +3043,7 @@ bool BattlegroundMap::CanEnter(Player* player) { if (player->GetMapRef().getTarget() == this) { - TC_LOG_ERROR(LOG_FILTER_MAPS, "BGMap::CanEnter - player %u is already in map!", player->GetGUIDLow()); + TC_LOG_ERROR("maps", "BGMap::CanEnter - player %u is already in map!", player->GetGUIDLow()); ASSERT(false); return false; } @@ -3062,7 +3071,7 @@ bool BattlegroundMap::AddPlayerToMap(Player* player) void BattlegroundMap::RemovePlayerFromMap(Player* player, bool remove) { - TC_LOG_INFO(LOG_FILTER_MAPS, "MAP: Removing player '%s' from bg '%u' of map '%s' before relocating to another map", player->GetName().c_str(), GetInstanceId(), GetMapName()); + TC_LOG_INFO("maps", "MAP: Removing player '%s' from bg '%u' of map '%s' before relocating to another map", player->GetName().c_str(), GetInstanceId(), GetMapName()); Map::RemovePlayerFromMap(player, remove); } diff --git a/src/server/game/Maps/MapInstanced.cpp b/src/server/game/Maps/MapInstanced.cpp index 05c430c4d00..d191293ecaf 100644 --- a/src/server/game/Maps/MapInstanced.cpp +++ b/src/server/game/Maps/MapInstanced.cpp @@ -193,20 +193,20 @@ InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave* save, const MapEntry* entry = sMapStore.LookupEntry(GetId()); if (!entry) { - TC_LOG_ERROR(LOG_FILTER_MAPS, "CreateInstance: no entry for map %d", GetId()); + TC_LOG_ERROR("maps", "CreateInstance: no entry for map %d", GetId()); ASSERT(false); } const InstanceTemplate* iTemplate = sObjectMgr->GetInstanceTemplate(GetId()); if (!iTemplate) { - TC_LOG_ERROR(LOG_FILTER_MAPS, "CreateInstance: no instance template for map %d", GetId()); + TC_LOG_ERROR("maps", "CreateInstance: no instance template for map %d", GetId()); ASSERT(false); } // some instances only have one difficulty GetDownscaledMapDifficultyData(GetId(), difficulty); - TC_LOG_DEBUG(LOG_FILTER_MAPS, "MapInstanced::CreateInstance: %s map instance %d for %d created with difficulty %s", save?"":"new ", InstanceId, GetId(), difficulty?"heroic":"normal"); + TC_LOG_DEBUG("maps", "MapInstanced::CreateInstance: %s map instance %d for %d created with difficulty %s", save?"":"new ", InstanceId, GetId(), difficulty?"heroic":"normal"); InstanceMap* map = new InstanceMap(GetId(), GetGridExpiry(), InstanceId, difficulty, this); ASSERT(map->IsDungeon()); @@ -225,7 +225,7 @@ BattlegroundMap* MapInstanced::CreateBattleground(uint32 InstanceId, Battlegroun // load/create a map TRINITY_GUARD(ACE_Thread_Mutex, Lock); - TC_LOG_DEBUG(LOG_FILTER_MAPS, "MapInstanced::CreateBattleground: map bg %d for %d created.", InstanceId, GetId()); + TC_LOG_DEBUG("maps", "MapInstanced::CreateBattleground: map bg %d for %d created.", InstanceId, GetId()); PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bg->GetMapId(), bg->GetMinLevel()); diff --git a/src/server/game/Maps/MapManager.cpp b/src/server/game/Maps/MapManager.cpp index 2d9366cba23..3ac965acbb4 100644 --- a/src/server/game/Maps/MapManager.cpp +++ b/src/server/game/Maps/MapManager.cpp @@ -37,12 +37,11 @@ #include "WorldSession.h" #include "Opcodes.h" -extern GridState* si_GridStates[]; // debugging code, should be deleted some day - MapManager::MapManager() { i_gridCleanUpDelay = sWorld->getIntConfig(CONFIG_INTERVAL_GRIDCLEAN); i_timer.SetInterval(sWorld->getIntConfig(CONFIG_INTERVAL_MAPUPDATE)); + _nextInstanceId = 0; } MapManager::~MapManager() { } @@ -51,13 +50,6 @@ void MapManager::Initialize() { Map::InitStateMachine(); - // debugging code, should be deleted some day - { - for (uint8 i = 0; i < MAX_GRID_STATE; ++i) - i_GridStates[i] = si_GridStates[i]; - - i_GridStateErrorCount = 0; - } int num_threads(sWorld->getIntConfig(CONFIG_NUMTHREADS)); // Start mtmaps if needed. if (num_threads > 0 && m_updater.activate(num_threads) == -1) @@ -70,31 +62,6 @@ void MapManager::InitializeVisibilityDistanceInfo() (*iter).second->InitVisibilityDistance(); } -// debugging code, should be deleted some day -void MapManager::checkAndCorrectGridStatesArray() -{ - bool ok = true; - for (int i=0; i<MAX_GRID_STATE; i++) - { - if (i_GridStates[i] != si_GridStates[i]) - { - TC_LOG_ERROR(LOG_FILTER_MAPS, "MapManager::checkGridStates(), GridState: si_GridStates is currupt !!!"); - ok = false; - si_GridStates[i] = i_GridStates[i]; - } - #ifdef TRINITY_DEBUG - // inner class checking only when compiled with debug - if (!si_GridStates[i]->checkMagic()) - { - ok = false; - si_GridStates[i]->setMagic(); - } - #endif - } - if (!ok) - ++i_GridStateErrorCount; -} - Map* MapManager::CreateBaseMap(uint32 id) { Map* map = FindBaseMap(id); @@ -195,7 +162,7 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player, bool loginCheck) // probably there must be special opcode, because client has this string constant in GlobalStrings.lua /// @todo this is not a good place to send the message player->GetSession()->SendAreaTriggerMessage(player->GetSession()->GetTrinityString(LANG_INSTANCE_RAID_GROUP_ONLY), mapName); - TC_LOG_DEBUG(LOG_FILTER_MAPS, "MAP: Player '%s' must be in a raid group to enter instance '%s'", player->GetName().c_str(), mapName); + TC_LOG_DEBUG("maps", "MAP: Player '%s' must be in a raid group to enter instance '%s'", player->GetName().c_str(), mapName); return false; } } @@ -219,15 +186,15 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player, bool loginCheck) { WorldPacket data(SMSG_CORPSE_NOT_IN_INSTANCE); player->GetSession()->SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_MAPS, "MAP: Player '%s' does not have a corpse in instance '%s' and cannot enter.", player->GetName().c_str(), mapName); + TC_LOG_DEBUG("maps", "MAP: Player '%s' does not have a corpse in instance '%s' and cannot enter.", player->GetName().c_str(), mapName); return false; } - TC_LOG_DEBUG(LOG_FILTER_MAPS, "MAP: Player '%s' has corpse in instance '%s' and can enter.", player->GetName().c_str(), mapName); + TC_LOG_DEBUG("maps", "MAP: Player '%s' has corpse in instance '%s' and can enter.", player->GetName().c_str(), mapName); player->ResurrectPlayer(0.5f, false); player->SpawnCorpseBones(); } else - TC_LOG_DEBUG(LOG_FILTER_MAPS, "Map::CanPlayerEnter - player '%s' is dead but does not have a corpse!", player->GetName().c_str()); + TC_LOG_DEBUG("maps", "Map::CanPlayerEnter - player '%s' is dead but does not have a corpse!", player->GetName().c_str()); } //Get instance where player's group is bound & its map @@ -404,7 +371,7 @@ uint32 MapManager::GenerateInstanceId() if (newInstanceId == _nextInstanceId) { - TC_LOG_ERROR(LOG_FILTER_MAPS, "Instance ID overflow!! Can't continue, shutting down server. "); + TC_LOG_ERROR("maps", "Instance ID overflow!! Can't continue, shutting down server. "); World::StopNow(ERROR_EXIT_CODE); } diff --git a/src/server/game/Maps/MapManager.h b/src/server/game/Maps/MapManager.h index 230b4648f4a..48537558057 100644 --- a/src/server/game/Maps/MapManager.h +++ b/src/server/game/Maps/MapManager.h @@ -129,11 +129,6 @@ class MapManager typedef UNORDERED_MAP<uint32, Map*> MapMapType; typedef std::vector<bool> InstanceIds; - // debugging code, should be deleted some day - void checkAndCorrectGridStatesArray(); // just for debugging to find some memory overwrites - GridState* i_GridStates[MAX_GRID_STATE]; // shadow entries to the global array in Map.cpp - int i_GridStateErrorCount; - MapManager(); ~MapManager(); diff --git a/src/server/game/Maps/TransportMgr.cpp b/src/server/game/Maps/TransportMgr.cpp index c0da12c5614..11798201397 100644 --- a/src/server/game/Maps/TransportMgr.cpp +++ b/src/server/game/Maps/TransportMgr.cpp @@ -49,7 +49,7 @@ void TransportMgr::LoadTransportTemplates() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 transport templates. DB table `gameobject_template` has no transports!"); + TC_LOG_INFO("server.loading", ">> Loaded 0 transport templates. DB table `gameobject_template` has no transports!"); return; } @@ -60,9 +60,15 @@ void TransportMgr::LoadTransportTemplates() Field* fields = result->Fetch(); uint32 entry = fields[0].GetUInt32(); GameObjectTemplate const* goInfo = sObjectMgr->GetGameObjectTemplate(entry); + if (goInfo == NULL) + { + TC_LOG_ERROR("sql.sql", "Transport %u has no associated GameObjectTemplate from `gameobject_template` , skipped.", entry); + continue; + } + if (goInfo->moTransport.taxiPathId >= sTaxiPathNodesByPath.size()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Transport %u (name: %s) has an invalid path specified in `gameobject_template`.`data0` (%u) field, skipped.", entry, goInfo->name.c_str(), goInfo->moTransport.taxiPathId); + TC_LOG_ERROR("sql.sql", "Transport %u (name: %s) has an invalid path specified in `gameobject_template`.`data0` (%u) field, skipped.", entry, goInfo->name.c_str(), goInfo->moTransport.taxiPathId); continue; } @@ -78,7 +84,7 @@ void TransportMgr::LoadTransportTemplates() ++count; } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u transport templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u transport templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void TransportMgr::GeneratePath(GameObjectTemplate const* goInfo, TransportTemplate* transport) @@ -354,7 +360,7 @@ Transport* TransportMgr::CreateTransport(uint32 entry, uint32 guid /*= 0*/, Map* TransportTemplate const* tInfo = GetTransportTemplate(entry); if (!tInfo) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Transport %u will not be loaded, `transport_template` missing", entry); + TC_LOG_ERROR("sql.sql", "Transport %u will not be loaded, `transport_template` missing", entry); return NULL; } @@ -381,7 +387,7 @@ Transport* TransportMgr::CreateTransport(uint32 entry, uint32 guid /*= 0*/, Map* { if (mapEntry->Instanceable() != tInfo->inInstance) { - TC_LOG_ERROR(LOG_FILTER_TRANSPORTS, "Transport %u (name: %s) attempted creation in instance map (id: %u) but it is not an instanced transport!", entry, trans->GetName().c_str(), mapId); + TC_LOG_ERROR("entities.transport", "Transport %u (name: %s) attempted creation in instance map (id: %u) but it is not an instanced transport!", entry, trans->GetName().c_str(), mapId); delete trans; return NULL; } @@ -424,7 +430,7 @@ void TransportMgr::SpawnContinentTransports() } while (result->NextRow()); } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Spawned %u continent transports in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Spawned %u continent transports in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void TransportMgr::CreateInstanceTransports(Map* map) diff --git a/src/server/game/Maps/TransportMgr.h b/src/server/game/Maps/TransportMgr.h index 250a2c50bb1..205a614eabb 100644 --- a/src/server/game/Maps/TransportMgr.h +++ b/src/server/game/Maps/TransportMgr.h @@ -38,7 +38,7 @@ typedef UNORDERED_MAP<uint32, std::set<uint32> > TransportInstanceMap; struct KeyFrame { - explicit KeyFrame(TaxiPathNodeEntry const& _node) : Node(&_node), + explicit KeyFrame(TaxiPathNodeEntry const& _node) : Index(0), Node(&_node), DistSinceStop(-1.0f), DistUntilStop(-1.0f), DistFromPrev(-1.0f), TimeFrom(0.0f), TimeTo(0.0f), Teleport(false), ArriveTime(0), DepartureTime(0), Spline(NULL), NextDistFromPrev(0.0f), NextArriveTime(0) { @@ -66,7 +66,7 @@ struct KeyFrame struct TransportTemplate { - TransportTemplate() : pathTime(0), accelTime(0.0f), accelDist(0.0f) { } + TransportTemplate() : inInstance(false), pathTime(0), accelTime(0.0f), accelDist(0.0f), entry(0) { } ~TransportTemplate(); std::set<uint32> mapsUsed; diff --git a/src/server/game/Miscellaneous/Formulas.h b/src/server/game/Miscellaneous/Formulas.h index f779e3dcb78..715a1f5f2c0 100644 --- a/src/server/game/Miscellaneous/Formulas.h +++ b/src/server/game/Miscellaneous/Formulas.h @@ -129,7 +129,7 @@ namespace Trinity nBaseExp = 580; break; default: - TC_LOG_ERROR(LOG_FILTER_GENERAL, "BaseGain: Unsupported content level %u", content); + TC_LOG_ERROR("misc", "BaseGain: Unsupported content level %u", content); nBaseExp = 45; break; } diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index e9b0087712b..e75e9dea6a8 100644 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -72,7 +72,8 @@ MotionMaster::~MotionMaster() { MovementGenerator *curr = top(); pop(); - if (curr) DirectDelete(curr); + if (curr && !isStatic(curr)) + delete curr; // Skip finalizing on delete, it might launch new movement } } @@ -129,6 +130,9 @@ void MotionMaster::DirectClean(bool reset) if (curr) DirectDelete(curr); } + if (empty()) + return; + if (needInitTop()) InitTop(); else if (reset) @@ -155,7 +159,7 @@ void MotionMaster::DirectExpire(bool reset) DirectDelete(curr); } - while (!top()) + while (!empty() && !top()) --_top; if (empty()) @@ -175,7 +179,7 @@ void MotionMaster::DelayedExpire() DelayedDelete(curr); } - while (!top()) + while (!empty() && !top()) --_top; } @@ -190,7 +194,7 @@ void MotionMaster::MoveRandom(float spawndist) { if (_owner->GetTypeId() == TYPEID_UNIT) { - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "Creature (GUID: %u) start moving random", _owner->GetGUIDLow()); + TC_LOG_DEBUG("misc", "Creature (GUID: %u) start moving random", _owner->GetGUIDLow()); Mutate(new RandomMovementGenerator<Creature>(spawndist), MOTION_SLOT_IDLE); } } @@ -201,22 +205,22 @@ void MotionMaster::MoveTargetedHome() if (_owner->GetTypeId() == TYPEID_UNIT && !_owner->ToCreature()->GetCharmerOrOwnerGUID()) { - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) targeted home", _owner->GetEntry(), _owner->GetGUIDLow()); + TC_LOG_DEBUG("misc", "Creature (Entry: %u GUID: %u) targeted home", _owner->GetEntry(), _owner->GetGUIDLow()); Mutate(new HomeMovementGenerator<Creature>(), MOTION_SLOT_ACTIVE); } else if (_owner->GetTypeId() == TYPEID_UNIT && _owner->ToCreature()->GetCharmerOrOwnerGUID()) { - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "Pet or controlled creature (Entry: %u GUID: %u) targeting home", _owner->GetEntry(), _owner->GetGUIDLow()); + TC_LOG_DEBUG("misc", "Pet or controlled creature (Entry: %u GUID: %u) targeting home", _owner->GetEntry(), _owner->GetGUIDLow()); Unit* target = _owner->ToCreature()->GetCharmerOrOwner(); if (target) { - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "Following %s (GUID: %u)", target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : ((Creature*)target)->GetDBTableGUIDLow()); + TC_LOG_DEBUG("misc", "Following %s (GUID: %u)", target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : ((Creature*)target)->GetDBTableGUIDLow()); Mutate(new FollowMovementGenerator<Creature>(target, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE), MOTION_SLOT_ACTIVE); } } else { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Player (GUID: %u) attempt targeted home", _owner->GetGUIDLow()); + TC_LOG_ERROR("misc", "Player (GUID: %u) attempt targeted home", _owner->GetGUIDLow()); } } @@ -224,12 +228,12 @@ void MotionMaster::MoveConfused() { if (_owner->GetTypeId() == TYPEID_PLAYER) { - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "Player (GUID: %u) move confused", _owner->GetGUIDLow()); + TC_LOG_DEBUG("misc", "Player (GUID: %u) move confused", _owner->GetGUIDLow()); Mutate(new ConfusedMovementGenerator<Player>(), MOTION_SLOT_CONTROLLED); } else { - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) move confused", + TC_LOG_DEBUG("misc", "Creature (Entry: %u GUID: %u) move confused", _owner->GetEntry(), _owner->GetGUIDLow()); Mutate(new ConfusedMovementGenerator<Creature>(), MOTION_SLOT_CONTROLLED); } @@ -244,7 +248,7 @@ void MotionMaster::MoveChase(Unit* target, float dist, float angle) //_owner->ClearUnitState(UNIT_STATE_FOLLOW); if (_owner->GetTypeId() == TYPEID_PLAYER) { - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "Player (GUID: %u) chase to %s (GUID: %u)", + TC_LOG_DEBUG("misc", "Player (GUID: %u) chase to %s (GUID: %u)", _owner->GetGUIDLow(), target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow()); @@ -252,7 +256,7 @@ void MotionMaster::MoveChase(Unit* target, float dist, float angle) } else { - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) chase to %s (GUID: %u)", + TC_LOG_DEBUG("misc", "Creature (Entry: %u GUID: %u) chase to %s (GUID: %u)", _owner->GetEntry(), _owner->GetGUIDLow(), target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow()); @@ -269,14 +273,14 @@ void MotionMaster::MoveFollow(Unit* target, float dist, float angle, MovementSlo //_owner->AddUnitState(UNIT_STATE_FOLLOW); if (_owner->GetTypeId() == TYPEID_PLAYER) { - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "Player (GUID: %u) follow to %s (GUID: %u)", _owner->GetGUIDLow(), + TC_LOG_DEBUG("misc", "Player (GUID: %u) follow to %s (GUID: %u)", _owner->GetGUIDLow(), target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow()); Mutate(new FollowMovementGenerator<Player>(target, dist, angle), slot); } else { - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) follow to %s (GUID: %u)", + TC_LOG_DEBUG("misc", "Creature (Entry: %u GUID: %u) follow to %s (GUID: %u)", _owner->GetEntry(), _owner->GetGUIDLow(), target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow()); @@ -288,12 +292,12 @@ void MotionMaster::MovePoint(uint32 id, float x, float y, float z, bool generate { if (_owner->GetTypeId() == TYPEID_PLAYER) { - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "Player (GUID: %u) targeted point (Id: %u X: %f Y: %f Z: %f)", _owner->GetGUIDLow(), id, x, y, z); + TC_LOG_DEBUG("misc", "Player (GUID: %u) targeted point (Id: %u X: %f Y: %f Z: %f)", _owner->GetGUIDLow(), id, x, y, z); Mutate(new PointMovementGenerator<Player>(id, x, y, z, generatePath), MOTION_SLOT_ACTIVE); } else { - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) targeted point (ID: %u X: %f Y: %f Z: %f)", + TC_LOG_DEBUG("misc", "Creature (Entry: %u GUID: %u) targeted point (ID: %u X: %f Y: %f Z: %f)", _owner->GetEntry(), _owner->GetGUIDLow(), id, x, y, z); Mutate(new PointMovementGenerator<Creature>(id, x, y, z, generatePath), MOTION_SLOT_ACTIVE); } @@ -304,7 +308,7 @@ void MotionMaster::MoveLand(uint32 id, Position const& pos) float x, y, z; pos.GetPosition(x, y, z); - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "Creature (Entry: %u) landing point (ID: %u X: %f Y: %f Z: %f)", _owner->GetEntry(), id, x, y, z); + TC_LOG_DEBUG("misc", "Creature (Entry: %u) landing point (ID: %u X: %f Y: %f Z: %f)", _owner->GetEntry(), id, x, y, z); Movement::MoveSplineInit init(_owner); init.MoveTo(x, y, z); @@ -318,7 +322,7 @@ void MotionMaster::MoveTakeoff(uint32 id, Position const& pos) float x, y, z; pos.GetPosition(x, y, z); - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "Creature (Entry: %u) landing point (ID: %u X: %f Y: %f Z: %f)", _owner->GetEntry(), id, x, y, z); + TC_LOG_DEBUG("misc", "Creature (Entry: %u) landing point (ID: %u X: %f Y: %f Z: %f)", _owner->GetEntry(), id, x, y, z); Movement::MoveSplineInit init(_owner); init.MoveTo(x, y, z); @@ -365,7 +369,7 @@ void MotionMaster::MoveJumpTo(float angle, float speedXY, float speedZ) void MotionMaster::MoveJump(float x, float y, float z, float speedXY, float speedZ, uint32 id) { - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "Unit (GUID: %u) jump to point (X: %f Y: %f Z: %f)", _owner->GetGUIDLow(), x, y, z); + TC_LOG_DEBUG("misc", "Unit (GUID: %u) jump to point (X: %f Y: %f Z: %f)", _owner->GetGUIDLow(), x, y, z); float moveTimeHalf = speedZ / Movement::gravity; float max_height = -Movement::computeFallElevation(moveTimeHalf, false, -speedZ); @@ -384,7 +388,7 @@ void MotionMaster::MoveFall(uint32 id /*=0*/) float tz = _owner->GetMap()->GetHeight(_owner->GetPhaseMask(), _owner->GetPositionX(), _owner->GetPositionY(), _owner->GetPositionZ(), true, MAX_FALL_DISTANCE); if (tz <= INVALID_HEIGHT) { - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "MotionMaster::MoveFall: unable retrive a proper height at map %u (x: %f, y: %f, z: %f).", + TC_LOG_DEBUG("misc", "MotionMaster::MoveFall: unable retrive a proper height at map %u (x: %f, y: %f, z: %f).", _owner->GetMap()->GetId(), _owner->GetPositionX(), _owner->GetPositionY(), _owner->GetPositionZ()); return; } @@ -413,12 +417,12 @@ void MotionMaster::MoveCharge(float x, float y, float z, float speed, uint32 id, if (_owner->GetTypeId() == TYPEID_PLAYER) { - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "Player (GUID: %u) charge point (X: %f Y: %f Z: %f)", _owner->GetGUIDLow(), x, y, z); + TC_LOG_DEBUG("misc", "Player (GUID: %u) charge point (X: %f Y: %f Z: %f)", _owner->GetGUIDLow(), x, y, z); Mutate(new PointMovementGenerator<Player>(id, x, y, z, generatePath, speed), MOTION_SLOT_CONTROLLED); } else { - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) charge point (X: %f Y: %f Z: %f)", + TC_LOG_DEBUG("misc", "Creature (Entry: %u GUID: %u) charge point (X: %f Y: %f Z: %f)", _owner->GetEntry(), _owner->GetGUIDLow(), x, y, z); Mutate(new PointMovementGenerator<Creature>(id, x, y, z, generatePath, speed), MOTION_SLOT_CONTROLLED); } @@ -441,11 +445,11 @@ void MotionMaster::MoveSeekAssistance(float x, float y, float z) { if (_owner->GetTypeId() == TYPEID_PLAYER) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Player (GUID: %u) attempt to seek assistance", _owner->GetGUIDLow()); + TC_LOG_ERROR("misc", "Player (GUID: %u) attempt to seek assistance", _owner->GetGUIDLow()); } else { - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) seek assistance (X: %f Y: %f Z: %f)", + TC_LOG_DEBUG("misc", "Creature (Entry: %u GUID: %u) seek assistance (X: %f Y: %f Z: %f)", _owner->GetEntry(), _owner->GetGUIDLow(), x, y, z); _owner->AttackStop(); _owner->ToCreature()->SetReactState(REACT_PASSIVE); @@ -457,11 +461,11 @@ void MotionMaster::MoveSeekAssistanceDistract(uint32 time) { if (_owner->GetTypeId() == TYPEID_PLAYER) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Player (GUID: %u) attempt to call distract after assistance", _owner->GetGUIDLow()); + TC_LOG_ERROR("misc", "Player (GUID: %u) attempt to call distract after assistance", _owner->GetGUIDLow()); } else { - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) is distracted after assistance call (Time: %u)", + TC_LOG_DEBUG("misc", "Creature (Entry: %u GUID: %u) is distracted after assistance call (Time: %u)", _owner->GetEntry(), _owner->GetGUIDLow(), time); Mutate(new AssistanceDistractMovementGenerator(time), MOTION_SLOT_ACTIVE); } @@ -477,14 +481,14 @@ void MotionMaster::MoveFleeing(Unit* enemy, uint32 time) if (_owner->GetTypeId() == TYPEID_PLAYER) { - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "Player (GUID: %u) flee from %s (GUID: %u)", _owner->GetGUIDLow(), + TC_LOG_DEBUG("misc", "Player (GUID: %u) flee from %s (GUID: %u)", _owner->GetGUIDLow(), enemy->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", enemy->GetTypeId() == TYPEID_PLAYER ? enemy->GetGUIDLow() : enemy->ToCreature()->GetDBTableGUIDLow()); Mutate(new FleeingMovementGenerator<Player>(enemy->GetGUID()), MOTION_SLOT_CONTROLLED); } else { - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) flee from %s (GUID: %u)%s", + TC_LOG_DEBUG("misc", "Creature (Entry: %u GUID: %u) flee from %s (GUID: %u)%s", _owner->GetEntry(), _owner->GetGUIDLow(), enemy->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", enemy->GetTypeId() == TYPEID_PLAYER ? enemy->GetGUIDLow() : enemy->ToCreature()->GetDBTableGUIDLow(), @@ -502,19 +506,19 @@ void MotionMaster::MoveTaxiFlight(uint32 path, uint32 pathnode) { if (path < sTaxiPathNodesByPath.size()) { - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "%s taxi to (Path %u node %u)", _owner->GetName().c_str(), path, pathnode); + TC_LOG_DEBUG("misc", "%s taxi to (Path %u node %u)", _owner->GetName().c_str(), path, pathnode); FlightPathMovementGenerator* mgen = new FlightPathMovementGenerator(sTaxiPathNodesByPath[path], pathnode); Mutate(mgen, MOTION_SLOT_CONTROLLED); } else { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "%s attempt taxi to (not existed Path %u node %u)", + TC_LOG_ERROR("misc", "%s attempt taxi to (not existed Path %u node %u)", _owner->GetName().c_str(), path, pathnode); } } else { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) attempt taxi to (Path %u node %u)", + TC_LOG_ERROR("misc", "Creature (Entry: %u GUID: %u) attempt taxi to (Path %u node %u)", _owner->GetEntry(), _owner->GetGUIDLow(), path, pathnode); } } @@ -526,11 +530,11 @@ void MotionMaster::MoveDistract(uint32 timer) if (_owner->GetTypeId() == TYPEID_PLAYER) { - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "Player (GUID: %u) distracted (timer: %u)", _owner->GetGUIDLow(), timer); + TC_LOG_DEBUG("misc", "Player (GUID: %u) distracted (timer: %u)", _owner->GetGUIDLow(), timer); } else { - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) (timer: %u)", + TC_LOG_DEBUG("misc", "Creature (Entry: %u GUID: %u) (timer: %u)", _owner->GetEntry(), _owner->GetGUIDLow(), timer); } @@ -582,7 +586,7 @@ void MotionMaster::MovePath(uint32 path_id, bool repeatable) //Mutate(new WaypointMovementGenerator<Player>(path_id, repeatable)): Mutate(new WaypointMovementGenerator<Creature>(path_id, repeatable), MOTION_SLOT_IDLE); - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "%s (GUID: %u) start moving over path(Id:%u, repeatable: %s)", + TC_LOG_DEBUG("misc", "%s (GUID: %u) start moving over path(Id:%u, repeatable: %s)", _owner->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature", _owner->GetGUIDLow(), path_id, repeatable ? "YES" : "NO"); } @@ -641,7 +645,7 @@ void MotionMaster::DirectDelete(_Ty curr) void MotionMaster::DelayedDelete(_Ty curr) { - TC_LOG_FATAL(LOG_FILTER_GENERAL, "Unit (Entry %u) is trying to delete its updating MG (Type %u)!", _owner->GetEntry(), curr->GetMovementGeneratorType()); + TC_LOG_FATAL("misc", "Unit (Entry %u) is trying to delete its updating MG (Type %u)!", _owner->GetEntry(), curr->GetMovementGeneratorType()); if (isStatic(curr)) return; if (!_expList) diff --git a/src/server/game/Movement/MotionMaster.h b/src/server/game/Movement/MotionMaster.h index 156813f56fb..f7ec1d8c169 100644 --- a/src/server/game/Movement/MotionMaster.h +++ b/src/server/game/Movement/MotionMaster.h @@ -87,13 +87,21 @@ class MotionMaster //: private std::stack<MovementGenerator *> void pop() { + if (empty()) + return; + Impl[_top] = NULL; - while (!top()) + while (!empty() && !top()) --_top; } void push(_Ty _Val) { ++_top; Impl[_top] = _Val; } - bool needInitTop() const { return _needInit[_top]; } + bool needInitTop() const + { + if (empty()) + return false; + return _needInit[_top]; + } void InitTop(); public: @@ -112,8 +120,16 @@ class MotionMaster //: private std::stack<MovementGenerator *> bool empty() const { return (_top < 0); } int size() const { return _top + 1; } - _Ty top() const { return Impl[_top]; } - _Ty GetMotionSlot(int slot) const { return Impl[slot]; } + _Ty top() const + { + ASSERT(!empty()); + return Impl[_top]; + } + _Ty GetMotionSlot(int slot) const + { + ASSERT(slot >= 0); + return Impl[slot]; + } void DirectDelete(_Ty curr); void DelayedDelete(_Ty curr); diff --git a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.h b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.h index 1fa9465d6e8..ac5e2428652 100755 --- a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.h @@ -26,7 +26,7 @@ template<class T> class ConfusedMovementGenerator : public MovementGeneratorMedium< T, ConfusedMovementGenerator<T> > { public: - explicit ConfusedMovementGenerator() : i_nextMoveTime(0) { } + explicit ConfusedMovementGenerator() : i_nextMoveTime(0), i_x(0), i_y(0), i_z(0) { } void DoInitialize(T*); void DoFinalize(T*); diff --git a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.h b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.h index ef2807a5f48..beb6f09194c 100644 --- a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.h @@ -37,7 +37,6 @@ class RandomMovementGenerator : public MovementGeneratorMedium< T, RandomMovemen private: TimeTrackerSmall i_nextMoveTime; - uint32 i_nextMove; float wander_distance; }; #endif diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp index 5506f74b221..a7674755bce 100755 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp @@ -42,7 +42,7 @@ void WaypointMovementGenerator<Creature>::LoadPath(Creature* creature) if (!i_path) { // No path id found for entry - TC_LOG_ERROR(LOG_FILTER_SQL, "WaypointMovementGenerator::LoadPath: creature %s (Entry: %u GUID: %u DB GUID: %u) doesn't have waypoint path id: %u", creature->GetName().c_str(), creature->GetEntry(), creature->GetGUIDLow(), creature->GetDBTableGUIDLow(), path_id); + TC_LOG_ERROR("sql.sql", "WaypointMovementGenerator::LoadPath: creature %s (Entry: %u GUID: %u DB GUID: %u) doesn't have waypoint path id: %u", creature->GetName().c_str(), creature->GetEntry(), creature->GetGUIDLow(), creature->GetDBTableGUIDLow(), path_id); return; } @@ -74,19 +74,24 @@ void WaypointMovementGenerator<Creature>::OnArrived(Creature* creature) if (m_isArrivalDone) return; - creature->ClearUnitState(UNIT_STATE_ROAMING_MOVE); m_isArrivalDone = true; if (i_path->at(i_currentNode)->event_id && urand(0, 99) < i_path->at(i_currentNode)->event_chance) { - TC_LOG_DEBUG(LOG_FILTER_MAPSCRIPTS, "Creature movement start script %u at point %u for " UI64FMTD ".", i_path->at(i_currentNode)->event_id, i_currentNode, creature->GetGUID()); + TC_LOG_DEBUG("maps.script", "Creature movement start script %u at point %u for " UI64FMTD ".", i_path->at(i_currentNode)->event_id, i_currentNode, creature->GetGUID()); + creature->ClearUnitState(UNIT_STATE_ROAMING_MOVE); creature->GetMap()->ScriptsStart(sWaypointScripts, i_path->at(i_currentNode)->event_id, creature, NULL); } // Inform script MovementInform(creature); creature->UpdateWaypointID(i_currentNode); - Stop(i_path->at(i_currentNode)->delay); + + if (i_path->at(i_currentNode)->delay) + { + creature->ClearUnitState(UNIT_STATE_ROAMING_MOVE); + Stop(i_path->at(i_currentNode)->delay); + } } bool WaypointMovementGenerator<Creature>::StartMove(Creature* creature) @@ -188,7 +193,8 @@ bool WaypointMovementGenerator<Creature>::DoUpdate(Creature* creature, uint32 di { if (creature->IsStopped()) Stop(STOP_TIME_FOR_PLAYER); - else if (creature->movespline->Finalized()) + // Checking just before reaching waypoint gives smother movement than using FinalDestination + else if (creature->movespline->timeElapsed() < 150) { OnArrived(creature); return StartMove(creature); @@ -321,7 +327,7 @@ void FlightPathMovementGenerator::DoEventIfAny(Player* player, TaxiPathNodeEntry { if (uint32 eventid = departure ? node.departureEventID : node.arrivalEventID) { - TC_LOG_DEBUG(LOG_FILTER_MAPSCRIPTS, "Taxi %s event %u of node %u of path %u for player %s", departure ? "departure" : "arrival", eventid, node.index, node.path, player->GetName().c_str()); + TC_LOG_DEBUG("maps.script", "Taxi %s event %u of node %u of path %u for player %s", departure ? "departure" : "arrival", eventid, node.index, node.path, player->GetName().c_str()); player->GetMap()->ScriptsStart(sEventScripts, eventid, player, player); } } @@ -352,9 +358,9 @@ void FlightPathMovementGenerator::PreloadEndGrid() // Load the grid if (endMap) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Preloading rid (%f, %f) for map %u at node index %u/%u", _endGridX, _endGridY, _endMapId, _preloadTargetNode, (uint32)(i_path->size()-1)); + TC_LOG_INFO("misc", "Preloading rid (%f, %f) for map %u at node index %u/%u", _endGridX, _endGridY, _endMapId, _preloadTargetNode, (uint32)(i_path->size()-1)); endMap->LoadGrid(_endGridX, _endGridY); } else - TC_LOG_INFO(LOG_FILTER_GENERAL, "Unable to determine map to preload flightmaster grid"); + TC_LOG_INFO("misc", "Unable to determine map to preload flightmaster grid"); } diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h index c22b0c5296f..357fbd0307c 100755 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h @@ -117,6 +117,10 @@ class FlightPathMovementGenerator : public MovementGeneratorMedium< Player, Flig { i_path = &pathnodes; i_currentNode = startNode; + _endGridX = 0.0f; + _endGridY = 0.0f; + _endMapId = 0; + _preloadTargetNode = 0; } void DoInitialize(Player*); void DoReset(Player*); diff --git a/src/server/game/Movement/PathGenerator.cpp b/src/server/game/Movement/PathGenerator.cpp index 9704bd1feb2..3e32be56fb0 100644 --- a/src/server/game/Movement/PathGenerator.cpp +++ b/src/server/game/Movement/PathGenerator.cpp @@ -34,7 +34,7 @@ PathGenerator::PathGenerator(const Unit* owner) : _type(PATHFIND_BLANK), _endPosition(G3D::Vector3::zero()), _sourceUnit(owner), _navMesh(NULL), _navMeshQuery(NULL) { - TC_LOG_DEBUG(LOG_FILTER_MAPS, "PathGenerator::PathGenerator for %u \n", _sourceUnit->GetGUIDLow()); + TC_LOG_DEBUG("maps", "PathGenerator::PathGenerator for %u \n", _sourceUnit->GetGUIDLow()); uint32 mapId = _sourceUnit->GetMapId(); if (MMAP::MMapFactory::IsPathfindingEnabled(mapId)) @@ -49,7 +49,7 @@ PathGenerator::PathGenerator(const Unit* owner) : PathGenerator::~PathGenerator() { - TC_LOG_DEBUG(LOG_FILTER_MAPS, "PathGenerator::~PathGenerator() for %u \n", _sourceUnit->GetGUIDLow()); + TC_LOG_DEBUG("maps", "PathGenerator::~PathGenerator() for %u \n", _sourceUnit->GetGUIDLow()); } bool PathGenerator::CalculatePath(float destX, float destY, float destZ, bool forceDest) @@ -66,7 +66,7 @@ bool PathGenerator::CalculatePath(float destX, float destY, float destZ, bool fo G3D::Vector3 start(x, y, z); SetStartPosition(start); - TC_LOG_DEBUG(LOG_FILTER_MAPS, "PathGenerator::CalculatePath() for %u \n", _sourceUnit->GetGUIDLow()); + TC_LOG_DEBUG("maps", "PathGenerator::CalculatePath() for %u \n", _sourceUnit->GetGUIDLow()); // make sure navMesh works - we can run on map w/o mmap // check if the start and end point have a .mmtile loaded (can we pass via not loaded tile on the way?) @@ -104,7 +104,7 @@ bool PathGenerator::CalculatePath(float destX, float destY, float destZ, bool fo if (!startRef || !endRef) { - TC_LOG_DEBUG(LOG_FILTER_MAPS, "PathGenerator::CalculatePath() for %u no polygons found for start and end locations\n", _sourceUnit->GetGUIDLow()); + TC_LOG_DEBUG("maps", "PathGenerator::CalculatePath() for %u no polygons found for start and end locations\n", _sourceUnit->GetGUIDLow()); _type = PATHFIND_NOPATH; return false; } @@ -112,10 +112,10 @@ bool PathGenerator::CalculatePath(float destX, float destY, float destZ, bool fo int hops; dtPolyRef* hopBuffer = new dtPolyRef[8192]; dtStatus status = _navMeshQuery->findPath(startRef, endRef, startPos, endPos, &_filter, hopBuffer, &hops, 8192); - + if (!dtStatusSucceed(status)) { - TC_LOG_DEBUG(LOG_FILTER_MAPS, "PathGenerator::CalculatePath() for %u no path found for start and end locations\n", _sourceUnit->GetGUIDLow()); + TC_LOG_DEBUG("maps", "PathGenerator::CalculatePath() for %u no path found for start and end locations\n", _sourceUnit->GetGUIDLow()); _type = PATHFIND_NOPATH; return false; } @@ -128,7 +128,7 @@ bool PathGenerator::CalculatePath(float destX, float destY, float destZ, bool fo status = _navMeshQuery->findStraightPath(startPos, endPos, hopBuffer, hops, straightPath, pathFlags, pathRefs, &resultHopCount, 2048); if (!dtStatusSucceed(status)) { - TC_LOG_DEBUG(LOG_FILTER_MAPS, "PathGenerator::CalculatePath() for %u no straight path found for start and end locations\n", _sourceUnit->GetGUIDLow()); + TC_LOG_DEBUG("maps", "PathGenerator::CalculatePath() for %u no straight path found for start and end locations\n", _sourceUnit->GetGUIDLow()); _type = PATHFIND_NOPATH; return false; } @@ -145,7 +145,7 @@ void PathGenerator::CreateFilter() { uint16 includeFlags = POLY_FLAG_WALK | POLY_FLAG_SWIM; uint16 excludeFlags = 0; - + if (_sourceUnit->GetTypeId() == TYPEID_UNIT && !_sourceUnit->ToCreature()->CanSwim()) { includeFlags = POLY_FLAG_WALK; @@ -160,7 +160,7 @@ void PathGenerator::CreateFilter() void PathGenerator::UpdateFilter() { - + } float PathGenerator::GetTriangleArea(float* verts, int nv) @@ -202,9 +202,9 @@ float PathGenerator::DistanceToWall(float* polyPickExt, float* pos, float* hitPo { float distanceToWall = 0; dtPolyRef ref; - + dtStatus status = _navMeshQuery->findNearestPoly(pos, polyPickExt, &_filter, &ref, 0); - + if (!dtStatusSucceed(status) || ref == 0) return -1; @@ -220,7 +220,7 @@ float PathGenerator::DistanceToWall(float* polyPickExt, float* pos, float* hitPo { dtVcopy(&verts[nv * 3], &tile->verts[poly->verts[i] * 3]); nv++; - } + } bool inside = PathGenerator::PointInPoly(pos, verts, nv, 0.05f); if (!inside) @@ -286,4 +286,4 @@ void PathGenerator::SmoothPath(float* polyPickExt, int pathLength, float*& strai } } } -}
\ No newline at end of file +} diff --git a/src/server/game/Movement/Spline/MoveSpline.cpp b/src/server/game/Movement/Spline/MoveSpline.cpp index ad7aa21a58c..7291c6849c5 100644 --- a/src/server/game/Movement/Spline/MoveSpline.cpp +++ b/src/server/game/Movement/Spline/MoveSpline.cpp @@ -147,7 +147,7 @@ void MoveSpline::init_spline(const MoveSplineInitArgs& args) /// @todo what to do in such cases? problem is in input data (all points are at same coords) if (spline.length() < minimal_duration) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "MoveSpline::init_spline: zero length spline, wrong input data?"); + TC_LOG_ERROR("misc", "MoveSpline::init_spline: zero length spline, wrong input data?"); spline.set_length(spline.last(), spline.isCyclic() ? 1000 : 1); } point_Idx = spline.first(); @@ -165,6 +165,13 @@ void MoveSpline::Initialize(MoveSplineInitArgs const& args) vertical_acceleration = 0.f; effect_start_time = 0; + // Check if its a stop spline + if (args.flags.done) + { + spline.clear(); + return; + } + init_spline(args); // init parabolic / animation @@ -194,7 +201,7 @@ bool MoveSplineInitArgs::Validate(Unit* unit) const #define CHECK(exp) \ if (!(exp))\ {\ - TC_LOG_ERROR(LOG_FILTER_GENERAL, "MoveSplineInitArgs::Validate: expression '%s' failed for GUID: %u Entry: %u", #exp, unit->GetTypeId() == TYPEID_PLAYER ? unit->GetGUIDLow() : unit->ToCreature()->GetDBTableGUIDLow(), unit->GetEntry());\ + TC_LOG_ERROR("misc", "MoveSplineInitArgs::Validate: expression '%s' failed for GUID: %u Entry: %u", #exp, unit->GetTypeId() == TYPEID_PLAYER ? unit->GetGUIDLow() : unit->ToCreature()->GetDBTableGUIDLow(), unit->GetEntry());\ return false;\ } CHECK(path.size() > 1); @@ -221,7 +228,7 @@ bool MoveSplineInitArgs::_checkPathBounds() const offset = path[i] - middle; if (fabs(offset.x) >= MAX_OFFSET || fabs(offset.y) >= MAX_OFFSET || fabs(offset.z) >= MAX_OFFSET) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "MoveSplineInitArgs::_checkPathBounds check failed"); + TC_LOG_ERROR("misc", "MoveSplineInitArgs::_checkPathBounds check failed"); return false; } } @@ -259,7 +266,7 @@ MoveSpline::UpdateResult MoveSpline::_updateState(int32& ms_time_diff) { point_Idx = spline.first(); time_passed = time_passed % Duration(); - result = Result_NextSegment; + result = Result_NextCycle; } else { diff --git a/src/server/game/Movement/Spline/MoveSpline.h b/src/server/game/Movement/Spline/MoveSpline.h index 209f978d658..5a788201e7f 100644 --- a/src/server/game/Movement/Spline/MoveSpline.h +++ b/src/server/game/Movement/Spline/MoveSpline.h @@ -79,10 +79,10 @@ namespace Movement UpdateResult _updateState(int32& ms_time_diff); int32 next_timestamp() const { return spline.length(point_Idx + 1); } int32 segment_time_elapsed() const { return next_timestamp() - time_passed; } - int32 timeElapsed() const { return Duration() - time_passed; } int32 timePassed() const { return time_passed; } public: + int32 timeElapsed() const { return Duration() - time_passed; } int32 Duration() const { return spline.length(); } MySpline const& _Spline() const { return spline; } int32 _currentSplineIdx() const { return point_Idx; } diff --git a/src/server/game/Movement/Spline/MoveSplineInit.cpp b/src/server/game/Movement/Spline/MoveSplineInit.cpp index 4209b9dd202..f6ef219522c 100644 --- a/src/server/game/Movement/Spline/MoveSplineInit.cpp +++ b/src/server/game/Movement/Spline/MoveSplineInit.cpp @@ -109,13 +109,14 @@ namespace Movement if (!args.Validate(unit)) return 0; - unit->m_movementInfo.SetMovementFlags((MovementFlags)moveFlags); + unit->m_movementInfo.SetMovementFlags(moveFlags); move_spline.Initialize(args); - WorldPacket data(!transport ? SMSG_MONSTER_MOVE : SMSG_MONSTER_MOVE_TRANSPORT, 64); + WorldPacket data(SMSG_MONSTER_MOVE, 64); data.append(unit->GetPackGUID()); if (transport) { + data.SetOpcode(SMSG_MONSTER_MOVE_TRANSPORT); data.appendPackGUID(unit->GetTransGUID()); data << int8(unit->GetTransSeat()); } @@ -126,6 +127,32 @@ namespace Movement return move_spline.Duration(); } + void MoveSplineInit::Stop() + { + MoveSpline& move_spline = *unit->movespline; + + // No need to stop if we are not moving + if (move_spline.Finalized()) + return; + + Location loc = move_spline.ComputePosition(); + args.flags = MoveSplineFlag::Done; + unit->m_movementInfo.RemoveMovementFlag(MOVEMENTFLAG_FORWARD | MOVEMENTFLAG_SPLINE_ENABLED); + move_spline.Initialize(args); + + WorldPacket data(SMSG_MONSTER_MOVE, 64); + data.append(unit->GetPackGUID()); + if (unit->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT) && unit->GetTransGUID()) + { + data.SetOpcode(SMSG_MONSTER_MOVE_TRANSPORT); + data.appendPackGUID(unit->GetTransGUID()); + data << int8(unit->GetTransSeat()); + } + + PacketBuilder::WriteStopMovement(loc, args.splineId, data); + unit->SendMessageToSet(&data, true); + } + MoveSplineInit::MoveSplineInit(Unit* m) : unit(m) { args.splineId = splineIdGen.NewId(); diff --git a/src/server/game/Movement/Spline/MoveSplineInit.h b/src/server/game/Movement/Spline/MoveSplineInit.h index 7b0527bb3a0..a94c84d92f3 100644 --- a/src/server/game/Movement/Spline/MoveSplineInit.h +++ b/src/server/game/Movement/Spline/MoveSplineInit.h @@ -59,6 +59,10 @@ namespace Movement */ int32 Launch(); + /* Final pass of initialization that stops movement. + */ + void Stop(); + /* Adds movement by parabolic trajectory * @param amplitude - the maximum height of parabola, value could be negative and positive * @param start_time - delay between movement starting time and beginning to move by parabolic trajectory diff --git a/src/server/game/Movement/Spline/MovementPacketBuilder.cpp b/src/server/game/Movement/Spline/MovementPacketBuilder.cpp index 29d1bb50a8f..ae62dc8b447 100644 --- a/src/server/game/Movement/Spline/MovementPacketBuilder.cpp +++ b/src/server/game/Movement/Spline/MovementPacketBuilder.cpp @@ -19,7 +19,7 @@ #include "MovementPacketBuilder.h" #include "MoveSpline.h" -#include "WorldPacket.h" +#include "ByteBuffer.h" namespace Movement { @@ -42,7 +42,7 @@ namespace Movement MonsterMoveFacingAngle = 4 }; - void PacketBuilder::WriteCommonMonsterMovePart(const MoveSpline& move_spline, WorldPacket& data) + void PacketBuilder::WriteCommonMonsterMovePart(const MoveSpline& move_spline, ByteBuffer& data) { MoveSplineFlag splineflags = move_spline.splineflags; @@ -88,6 +88,14 @@ namespace Movement } } + void PacketBuilder::WriteStopMovement(Vector3 const& pos, uint32 splineId, ByteBuffer& data) + { + data << uint8(0); // sets/unsets MOVEMENTFLAG2_UNK7 (0x40) + data << pos; + data << splineId; + data << uint8(MonsterMoveStop); + } + void WriteLinearPath(const Spline<int32>& spline, ByteBuffer& data) { uint32 last_idx = spline.getPointCount() - 3; @@ -123,7 +131,7 @@ namespace Movement data.append<Vector3>(&spline.getPoint(1), count); } - void PacketBuilder::WriteMonsterMove(const MoveSpline& move_spline, WorldPacket& data) + void PacketBuilder::WriteMonsterMove(const MoveSpline& move_spline, ByteBuffer& data) { WriteCommonMonsterMovePart(move_spline, data); diff --git a/src/server/game/Movement/Spline/MovementPacketBuilder.h b/src/server/game/Movement/Spline/MovementPacketBuilder.h index b502e203656..3643abd2eca 100644 --- a/src/server/game/Movement/Spline/MovementPacketBuilder.h +++ b/src/server/game/Movement/Spline/MovementPacketBuilder.h @@ -20,18 +20,26 @@ #ifndef TRINITYSERVER_PACKET_BUILDER_H #define TRINITYSERVER_PACKET_BUILDER_H +#include "Define.h" + class ByteBuffer; -class WorldPacket; +namespace G3D +{ + class Vector3; +} namespace Movement { + using G3D::Vector3; + class MoveSpline; class PacketBuilder { - static void WriteCommonMonsterMovePart(const MoveSpline& mov, WorldPacket& data); + static void WriteCommonMonsterMovePart(const MoveSpline& mov, ByteBuffer& data); public: - static void WriteMonsterMove(const MoveSpline& mov, WorldPacket& data); + static void WriteMonsterMove(const MoveSpline& mov, ByteBuffer& data); + static void WriteStopMovement(Vector3 const& loc, uint32 splineId, ByteBuffer& data); static void WriteCreate(const MoveSpline& mov, ByteBuffer& data); }; } diff --git a/src/server/game/Movement/Spline/MovementUtil.cpp b/src/server/game/Movement/Spline/MovementUtil.cpp index f68a776d485..375859263ab 100644 --- a/src/server/game/Movement/Spline/MovementUtil.cpp +++ b/src/server/game/Movement/Spline/MovementUtil.cpp @@ -77,7 +77,7 @@ namespace Movement { result = termVel * (t_passed - terminal_time) + start_velocity * terminal_time + - gravity * terminal_time * terminal_time*0.5f; + gravity * terminal_time * terminal_time * 0.5f; } else result = t_passed * (start_velocity + t_passed * gravity * 0.5f); diff --git a/src/server/game/Movement/Waypoints/WaypointManager.cpp b/src/server/game/Movement/Waypoints/WaypointManager.cpp index 406ac95322a..7fc8ae1a63c 100644 --- a/src/server/game/Movement/Waypoints/WaypointManager.cpp +++ b/src/server/game/Movement/Waypoints/WaypointManager.cpp @@ -46,7 +46,7 @@ void WaypointMgr::Load() if (!result) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 waypoints. DB table `waypoint_data` is empty!"); + TC_LOG_ERROR("server.loading", ">> Loaded 0 waypoints. DB table `waypoint_data` is empty!"); return; } @@ -83,7 +83,7 @@ void WaypointMgr::Load() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u waypoints in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u waypoints in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void WaypointMgr::ReloadPath(uint32 id) diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.cpp b/src/server/game/OutdoorPvP/OutdoorPvP.cpp index 4d68e03a1c6..cf14cc2eb56 100644 --- a/src/server/game/OutdoorPvP/OutdoorPvP.cpp +++ b/src/server/game/OutdoorPvP/OutdoorPvP.cpp @@ -116,13 +116,13 @@ bool OPvPCapturePoint::AddCreature(uint32 type, uint32 entry, uint32 team, uint3 bool OPvPCapturePoint::SetCapturePointData(uint32 entry, uint32 map, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3) { - TC_LOG_DEBUG(LOG_FILTER_OUTDOORPVP, "Creating capture point %u", entry); + TC_LOG_DEBUG("outdoorpvp", "Creating capture point %u", entry); // check info existence GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(entry); if (!goinfo || goinfo->type != GAMEOBJECT_TYPE_CAPTURE_POINT) { - TC_LOG_ERROR(LOG_FILTER_OUTDOORPVP, "OutdoorPvP: GO %u is not capture point!", entry); + TC_LOG_ERROR("outdoorpvp", "OutdoorPvP: GO %u is not capture point!", entry); return false; } @@ -143,7 +143,7 @@ bool OPvPCapturePoint::DelCreature(uint32 type) { if (!m_Creatures[type]) { - TC_LOG_DEBUG(LOG_FILTER_OUTDOORPVP, "opvp creature type %u was already deleted", type); + TC_LOG_DEBUG("outdoorpvp", "opvp creature type %u was already deleted", type); return false; } @@ -154,7 +154,7 @@ bool OPvPCapturePoint::DelCreature(uint32 type) m_Creatures[type] = 0; return false; } - TC_LOG_DEBUG(LOG_FILTER_OUTDOORPVP, "deleting opvp creature type %u", type); + TC_LOG_DEBUG("outdoorpvp", "deleting opvp creature type %u", type); uint32 guid = cr->GetDBTableGUIDLow(); // Don't save respawn time cr->SetRespawnTime(0); @@ -231,7 +231,7 @@ void OutdoorPvP::DeleteSpawns() m_capturePoints.clear(); } -OutdoorPvP::OutdoorPvP() : m_sendUpdate(true) { } +OutdoorPvP::OutdoorPvP() : m_TypeId(0), m_sendUpdate(true) { } OutdoorPvP::~OutdoorPvP() { @@ -252,7 +252,7 @@ void OutdoorPvP::HandlePlayerLeaveZone(Player* player, uint32 /*zone*/) if (!player->GetSession()->PlayerLogout()) SendRemoveWorldStates(player); m_players[player->GetTeamId()].erase(player->GetGUID()); - TC_LOG_DEBUG(LOG_FILTER_OUTDOORPVP, "Player %s left an outdoorpvp zone", player->GetName().c_str()); + TC_LOG_DEBUG("outdoorpvp", "Player %s left an outdoorpvp zone", player->GetName().c_str()); } void OutdoorPvP::HandlePlayerResurrects(Player* /*player*/, uint32 /*zone*/) { } @@ -380,7 +380,7 @@ bool OPvPCapturePoint::Update(uint32 diff) if (m_OldState != m_State) { - //TC_LOG_ERROR(LOG_FILTER_OUTDOORPVP, "%u->%u", m_OldState, m_State); + //TC_LOG_ERROR("outdoorpvp", "%u->%u", m_OldState, m_State); if (oldTeam != m_team) ChangeTeam(oldTeam); ChangeState(); diff --git a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp index e5673351aa7..c5e441e079d 100644 --- a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp +++ b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp @@ -24,12 +24,12 @@ OutdoorPvPMgr::OutdoorPvPMgr() { m_UpdateTimer = 0; - //TC_LOG_DEBUG(LOG_FILTER_OUTDOORPVP, "Instantiating OutdoorPvPMgr"); + //TC_LOG_DEBUG("outdoorpvp", "Instantiating OutdoorPvPMgr"); } void OutdoorPvPMgr::Die() { - //TC_LOG_DEBUG(LOG_FILTER_OUTDOORPVP, "Deleting OutdoorPvPMgr"); + //TC_LOG_DEBUG("outdoorpvp", "Deleting OutdoorPvPMgr"); for (OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr) delete *itr; @@ -46,7 +46,7 @@ void OutdoorPvPMgr::InitOutdoorPvP() if (!result) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 outdoor PvP definitions. DB table `outdoorpvp_template` is empty."); + TC_LOG_ERROR("server.loading", ">> Loaded 0 outdoor PvP definitions. DB table `outdoorpvp_template` is empty."); return; } @@ -64,7 +64,7 @@ void OutdoorPvPMgr::InitOutdoorPvP() if (typeId >= MAX_OUTDOORPVP_TYPES) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Invalid OutdoorPvPTypes value %u in outdoorpvp_template; skipped.", typeId); + TC_LOG_ERROR("sql.sql", "Invalid OutdoorPvPTypes value %u in outdoorpvp_template; skipped.", typeId); continue; } @@ -84,20 +84,20 @@ void OutdoorPvPMgr::InitOutdoorPvP() OutdoorPvPDataMap::iterator iter = m_OutdoorPvPDatas.find(OutdoorPvPTypes(i)); if (iter == m_OutdoorPvPDatas.end()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Could not initialize OutdoorPvP object for type ID %u; no entry in database.", uint32(i)); + TC_LOG_ERROR("sql.sql", "Could not initialize OutdoorPvP object for type ID %u; no entry in database.", uint32(i)); continue; } pvp = sScriptMgr->CreateOutdoorPvP(iter->second); if (!pvp) { - TC_LOG_ERROR(LOG_FILTER_OUTDOORPVP, "Could not initialize OutdoorPvP object for type ID %u; got NULL pointer from script.", uint32(i)); + TC_LOG_ERROR("outdoorpvp", "Could not initialize OutdoorPvP object for type ID %u; got NULL pointer from script.", uint32(i)); continue; } if (!pvp->SetupOutdoorPvP()) { - TC_LOG_ERROR(LOG_FILTER_OUTDOORPVP, "Could not initialize OutdoorPvP object for type ID %u; SetupOutdoorPvP failed.", uint32(i)); + TC_LOG_ERROR("outdoorpvp", "Could not initialize OutdoorPvP object for type ID %u; SetupOutdoorPvP failed.", uint32(i)); delete pvp; continue; } @@ -105,7 +105,7 @@ void OutdoorPvPMgr::InitOutdoorPvP() m_OutdoorPvPSet.push_back(pvp); } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u outdoor PvP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u outdoor PvP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void OutdoorPvPMgr::AddZone(uint32 zoneid, OutdoorPvP* handle) @@ -123,7 +123,7 @@ void OutdoorPvPMgr::HandlePlayerEnterZone(Player* player, uint32 zoneid) return; itr->second->HandlePlayerEnterZone(player, zoneid); - TC_LOG_DEBUG(LOG_FILTER_OUTDOORPVP, "Player %u entered outdoorpvp id %u", player->GetGUIDLow(), itr->second->GetTypeId()); + TC_LOG_DEBUG("outdoorpvp", "Player %u entered outdoorpvp id %u", player->GetGUIDLow(), itr->second->GetTypeId()); } void OutdoorPvPMgr::HandlePlayerLeaveZone(Player* player, uint32 zoneid) @@ -137,7 +137,7 @@ void OutdoorPvPMgr::HandlePlayerLeaveZone(Player* player, uint32 zoneid) return; itr->second->HandlePlayerLeaveZone(player, zoneid); - TC_LOG_DEBUG(LOG_FILTER_OUTDOORPVP, "Player %u left outdoorpvp id %u", player->GetGUIDLow(), itr->second->GetTypeId()); + TC_LOG_DEBUG("outdoorpvp", "Player %u left outdoorpvp id %u", player->GetGUIDLow(), itr->second->GetTypeId()); } OutdoorPvP* OutdoorPvPMgr::GetOutdoorPvPToZoneId(uint32 zoneid) diff --git a/src/server/game/Pools/PoolMgr.cpp b/src/server/game/Pools/PoolMgr.cpp index 8cb0c8e6191..1eed9feb289 100644 --- a/src/server/game/Pools/PoolMgr.cpp +++ b/src/server/game/Pools/PoolMgr.cpp @@ -364,8 +364,8 @@ void PoolGroup<Creature>::Spawn1Object(PoolObject* obj) // We use spawn coords to spawn if (!map->Instanceable() && map->IsGridLoaded(data->posX, data->posY)) { - Creature* creature = new Creature; - //TC_LOG_DEBUG(LOG_FILTER_POOLSYS, "Spawning creature %u", guid); + Creature* creature = new Creature(); + //TC_LOG_DEBUG("pool", "Spawning creature %u", guid); if (!creature->LoadCreatureFromDB(obj->guid, map)) { delete creature; @@ -389,7 +389,7 @@ void PoolGroup<GameObject>::Spawn1Object(PoolObject* obj) if (!map->Instanceable() && map->IsGridLoaded(data->posX, data->posY)) { GameObject* pGameobject = new GameObject; - //TC_LOG_DEBUG(LOG_FILTER_POOLSYS, "Spawning gameobject %u", guid); + //TC_LOG_DEBUG("pool", "Spawning gameobject %u", guid); if (!pGameobject->LoadGameObjectFromDB(obj->guid, map, false)) { delete pGameobject; @@ -420,7 +420,7 @@ void PoolGroup<Quest>::Spawn1Object(PoolObject* obj) PooledQuestRelationBoundsNC qr = sPoolMgr->mQuestCreatureRelation.equal_range(obj->guid); for (PooledQuestRelation::iterator itr = qr.first; itr != qr.second; ++itr) { - TC_LOG_DEBUG(LOG_FILTER_POOLSYS, "PoolGroup<Quest>: Adding quest %u to creature %u", itr->first, itr->second); + TC_LOG_DEBUG("pool", "PoolGroup<Quest>: Adding quest %u to creature %u", itr->first, itr->second); questMap->insert(QuestRelations::value_type(itr->second, itr->first)); } @@ -429,7 +429,7 @@ void PoolGroup<Quest>::Spawn1Object(PoolObject* obj) qr = sPoolMgr->mQuestGORelation.equal_range(obj->guid); for (PooledQuestRelation::iterator itr = qr.first; itr != qr.second; ++itr) { - TC_LOG_DEBUG(LOG_FILTER_POOLSYS, "PoolGroup<Quest>: Adding quest %u to GO %u", itr->first, itr->second); + TC_LOG_DEBUG("pool", "PoolGroup<Quest>: Adding quest %u to GO %u", itr->first, itr->second); questMap->insert(QuestRelations::value_type(itr->second, itr->first)); } } @@ -437,7 +437,7 @@ void PoolGroup<Quest>::Spawn1Object(PoolObject* obj) template <> void PoolGroup<Quest>::SpawnObject(ActivePoolData& spawns, uint32 limit, uint32 triggerFrom) { - TC_LOG_DEBUG(LOG_FILTER_POOLSYS, "PoolGroup<Quest>: Spawning pool %u", poolId); + TC_LOG_DEBUG("pool", "PoolGroup<Quest>: Spawning pool %u", poolId); // load state from db if (!triggerFrom) { @@ -566,7 +566,7 @@ void PoolMgr::LoadFromDB() if (!result) { mPoolTemplate.clear(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 object pools. DB table `pool_template` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 object pools. DB table `pool_template` is empty."); return; } @@ -584,12 +584,12 @@ void PoolMgr::LoadFromDB() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u objects pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u objects pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } // Creatures - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Creatures Pooling Data..."); + TC_LOG_INFO("server.loading", "Loading Creatures Pooling Data..."); { uint32 oldMSTime = getMSTime(); @@ -598,7 +598,7 @@ void PoolMgr::LoadFromDB() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creatures in pools. DB table `pool_creature` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 creatures in pools. DB table `pool_creature` is empty."); } else { @@ -614,17 +614,17 @@ void PoolMgr::LoadFromDB() CreatureData const* data = sObjectMgr->GetCreatureData(guid); if (!data) { - TC_LOG_ERROR(LOG_FILTER_SQL, "`pool_creature` has a non existing creature spawn (GUID: %u) defined for pool id (%u), skipped.", guid, pool_id); + TC_LOG_ERROR("sql.sql", "`pool_creature` has a non existing creature spawn (GUID: %u) defined for pool id (%u), skipped.", guid, pool_id); continue; } if (pool_id > max_pool_id) { - TC_LOG_ERROR(LOG_FILTER_SQL, "`pool_creature` pool id (%u) is out of range compared to max pool id in `pool_template`, skipped.", pool_id); + TC_LOG_ERROR("sql.sql", "`pool_creature` pool id (%u) is out of range compared to max pool id in `pool_template`, skipped.", pool_id); continue; } if (chance < 0 || chance > 100) { - TC_LOG_ERROR(LOG_FILTER_SQL, "`pool_creature` has an invalid chance (%f) for creature guid (%u) in pool id (%u), skipped.", chance, guid, pool_id); + TC_LOG_ERROR("sql.sql", "`pool_creature` has an invalid chance (%f) for creature guid (%u) in pool id (%u), skipped.", chance, guid, pool_id); continue; } PoolTemplateData* pPoolTemplate = &mPoolTemplate[pool_id]; @@ -639,13 +639,13 @@ void PoolMgr::LoadFromDB() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creatures in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u creatures in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } // Gameobjects - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Gameobject Pooling Data..."); + TC_LOG_INFO("server.loading", "Loading Gameobject Pooling Data..."); { uint32 oldMSTime = getMSTime(); @@ -654,7 +654,7 @@ void PoolMgr::LoadFromDB() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 gameobjects in pools. DB table `pool_gameobject` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 gameobjects in pools. DB table `pool_gameobject` is empty."); } else { @@ -670,7 +670,7 @@ void PoolMgr::LoadFromDB() GameObjectData const* data = sObjectMgr->GetGOData(guid); if (!data) { - TC_LOG_ERROR(LOG_FILTER_SQL, "`pool_gameobject` has a non existing gameobject spawn (GUID: %u) defined for pool id (%u), skipped.", guid, pool_id); + TC_LOG_ERROR("sql.sql", "`pool_gameobject` has a non existing gameobject spawn (GUID: %u) defined for pool id (%u), skipped.", guid, pool_id); continue; } @@ -679,19 +679,19 @@ void PoolMgr::LoadFromDB() goinfo->type != GAMEOBJECT_TYPE_GOOBER && goinfo->type != GAMEOBJECT_TYPE_FISHINGHOLE) { - TC_LOG_ERROR(LOG_FILTER_SQL, "`pool_gameobject` has a not lootable gameobject spawn (GUID: %u, type: %u) defined for pool id (%u), skipped.", guid, goinfo->type, pool_id); + TC_LOG_ERROR("sql.sql", "`pool_gameobject` has a not lootable gameobject spawn (GUID: %u, type: %u) defined for pool id (%u), skipped.", guid, goinfo->type, pool_id); continue; } if (pool_id > max_pool_id) { - TC_LOG_ERROR(LOG_FILTER_SQL, "`pool_gameobject` pool id (%u) is out of range compared to max pool id in `pool_template`, skipped.", pool_id); + TC_LOG_ERROR("sql.sql", "`pool_gameobject` pool id (%u) is out of range compared to max pool id in `pool_template`, skipped.", pool_id); continue; } if (chance < 0 || chance > 100) { - TC_LOG_ERROR(LOG_FILTER_SQL, "`pool_gameobject` has an invalid chance (%f) for gameobject guid (%u) in pool id (%u), skipped.", chance, guid, pool_id); + TC_LOG_ERROR("sql.sql", "`pool_gameobject` has an invalid chance (%f) for gameobject guid (%u) in pool id (%u), skipped.", chance, guid, pool_id); continue; } @@ -707,13 +707,13 @@ void PoolMgr::LoadFromDB() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u gameobject in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u gameobject in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } // Pool of pools - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Mother Pooling Data..."); + TC_LOG_INFO("server.loading", "Loading Mother Pooling Data..."); { uint32 oldMSTime = getMSTime(); @@ -722,7 +722,7 @@ void PoolMgr::LoadFromDB() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 pools in pools"); + TC_LOG_INFO("server.loading", ">> Loaded 0 pools in pools"); } else { @@ -737,22 +737,22 @@ void PoolMgr::LoadFromDB() if (mother_pool_id > max_pool_id) { - TC_LOG_ERROR(LOG_FILTER_SQL, "`pool_pool` mother_pool id (%u) is out of range compared to max pool id in `pool_template`, skipped.", mother_pool_id); + TC_LOG_ERROR("sql.sql", "`pool_pool` mother_pool id (%u) is out of range compared to max pool id in `pool_template`, skipped.", mother_pool_id); continue; } if (child_pool_id > max_pool_id) { - TC_LOG_ERROR(LOG_FILTER_SQL, "`pool_pool` included pool_id (%u) is out of range compared to max pool id in `pool_template`, skipped.", child_pool_id); + TC_LOG_ERROR("sql.sql", "`pool_pool` included pool_id (%u) is out of range compared to max pool id in `pool_template`, skipped.", child_pool_id); continue; } if (mother_pool_id == child_pool_id) { - TC_LOG_ERROR(LOG_FILTER_SQL, "`pool_pool` pool_id (%u) includes itself, dead-lock detected, skipped.", child_pool_id); + TC_LOG_ERROR("sql.sql", "`pool_pool` pool_id (%u) includes itself, dead-lock detected, skipped.", child_pool_id); continue; } if (chance < 0 || chance > 100) { - TC_LOG_ERROR(LOG_FILTER_SQL, "`pool_pool` has an invalid chance (%f) for pool id (%u) in mother pool id (%u), skipped.", chance, child_pool_id, mother_pool_id); + TC_LOG_ERROR("sql.sql", "`pool_pool` has an invalid chance (%f) for pool id (%u) in mother pool id (%u), skipped.", chance, child_pool_id, mother_pool_id); continue; } PoolTemplateData* pPoolTemplateMother = &mPoolTemplate[mother_pool_id]; @@ -782,7 +782,7 @@ void PoolMgr::LoadFromDB() ss << *itr << ' '; ss << "create(s) a circular reference, which can cause the server to freeze.\nRemoving the last link between mother pool " << poolItr->first << " and child pool " << poolItr->second; - TC_LOG_ERROR(LOG_FILTER_SQL, "%s", ss.str().c_str()); + TC_LOG_ERROR("sql.sql", "%s", ss.str().c_str()); mPoolPoolGroups[poolItr->second].RemoveOneRelation(poolItr->first); mPoolSearchMap.erase(poolItr); --count; @@ -791,11 +791,11 @@ void PoolMgr::LoadFromDB() } } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u pools in mother pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u pools in mother pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Quest Pooling Data..."); + TC_LOG_INFO("server.loading", "Loading Quest Pooling Data..."); { uint32 oldMSTime = getMSTime(); @@ -804,7 +804,7 @@ void PoolMgr::LoadFromDB() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 quests in pools"); + TC_LOG_INFO("server.loading", ">> Loaded 0 quests in pools"); } else { @@ -830,19 +830,19 @@ void PoolMgr::LoadFromDB() Quest const* quest = sObjectMgr->GetQuestTemplate(entry); if (!quest) { - TC_LOG_ERROR(LOG_FILTER_SQL, "`pool_quest` has a non existing quest template (Entry: %u) defined for pool id (%u), skipped.", entry, pool_id); + TC_LOG_ERROR("sql.sql", "`pool_quest` has a non existing quest template (Entry: %u) defined for pool id (%u), skipped.", entry, pool_id); continue; } if (pool_id > max_pool_id) { - TC_LOG_ERROR(LOG_FILTER_SQL, "`pool_quest` pool id (%u) is out of range compared to max pool id in `pool_template`, skipped.", pool_id); + TC_LOG_ERROR("sql.sql", "`pool_quest` pool id (%u) is out of range compared to max pool id in `pool_template`, skipped.", pool_id); continue; } if (!quest->IsDailyOrWeekly()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "`pool_quest` has an quest (%u) which is not daily or weekly in pool id (%u), use ExclusiveGroup instead, skipped.", entry, pool_id); + TC_LOG_ERROR("sql.sql", "`pool_quest` has an quest (%u) which is not daily or weekly in pool id (%u), use ExclusiveGroup instead, skipped.", entry, pool_id); continue; } @@ -853,7 +853,7 @@ void PoolMgr::LoadFromDB() if (poolTypeMap[pool_id] != currType) { - TC_LOG_ERROR(LOG_FILTER_SQL, "`pool_quest` quest %u is %s but pool (%u) is specified for %s, mixing not allowed, skipped.", + TC_LOG_ERROR("sql.sql", "`pool_quest` quest %u is %s but pool (%u) is specified for %s, mixing not allowed, skipped.", entry, currType == QUEST_DAILY ? "QUEST_DAILY" : "QUEST_WEEKLY", pool_id, poolTypeMap[pool_id] == QUEST_DAILY ? "QUEST_DAILY" : "QUEST_WEEKLY"); continue; } @@ -863,7 +863,7 @@ void PoolMgr::LoadFromDB() if (creBounds.first == creBounds.second && goBounds.first == goBounds.second) { - TC_LOG_ERROR(LOG_FILTER_SQL, "`pool_quest` lists entry (%u) as member of pool (%u) but is not started anywhere, skipped.", entry, pool_id); + TC_LOG_ERROR("sql.sql", "`pool_quest` lists entry (%u) as member of pool (%u) but is not started anywhere, skipped.", entry, pool_id); continue; } @@ -879,12 +879,12 @@ void PoolMgr::LoadFromDB() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quests in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u quests in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } // The initialize method will spawn all pools not in an event and not in another pool, this is why there is 2 left joins with 2 null checks - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Starting objects pooling system..."); + TC_LOG_INFO("server.loading", "Starting objects pooling system..."); { uint32 oldMSTime = getMSTime(); @@ -894,7 +894,7 @@ void PoolMgr::LoadFromDB() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Pool handling system initialized, 0 pools spawned."); + TC_LOG_INFO("server.loading", ">> Pool handling system initialized, 0 pools spawned."); } else { @@ -910,9 +910,9 @@ void PoolMgr::LoadFromDB() if (pool_pool_id) // The pool is a child pool in pool_pool table. Ideally we should remove it from the pool handler to ensure it never gets spawned, // however that could recursively invalidate entire chain of mother pools. It can be done in the future but for now we'll do nothing. - TC_LOG_ERROR(LOG_FILTER_SQL, "Pool Id %u has no equal chance pooled entites defined and explicit chance sum is not 100. This broken pool is a child pool of Id %u and cannot be safely removed.", pool_entry, fields[2].GetUInt32()); + TC_LOG_ERROR("sql.sql", "Pool Id %u has no equal chance pooled entites defined and explicit chance sum is not 100. This broken pool is a child pool of Id %u and cannot be safely removed.", pool_entry, fields[2].GetUInt32()); else - TC_LOG_ERROR(LOG_FILTER_SQL, "Pool Id %u has no equal chance pooled entites defined and explicit chance sum is not 100. The pool will not be spawned.", pool_entry); + TC_LOG_ERROR("sql.sql", "Pool Id %u has no equal chance pooled entites defined and explicit chance sum is not 100. The pool will not be spawned.", pool_entry); continue; } @@ -925,7 +925,7 @@ void PoolMgr::LoadFromDB() } while (result->NextRow()); - TC_LOG_DEBUG(LOG_FILTER_POOLSYS, "Pool handling system initialized, %u pools spawned in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_DEBUG("pool", "Pool handling system initialized, %u pools spawned in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } diff --git a/src/server/game/Reputation/ReputationMgr.cpp b/src/server/game/Reputation/ReputationMgr.cpp index 9c996a9c386..272e1bd7a1e 100644 --- a/src/server/game/Reputation/ReputationMgr.cpp +++ b/src/server/game/Reputation/ReputationMgr.cpp @@ -46,7 +46,7 @@ bool ReputationMgr::IsAtWar(uint32 faction_id) const if (!factionEntry) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "ReputationMgr::IsAtWar: Can't get AtWar flag of %s for unknown faction (faction id) #%u.", _player->GetName().c_str(), faction_id); + TC_LOG_ERROR("misc", "ReputationMgr::IsAtWar: Can't get AtWar flag of %s for unknown faction (faction id) #%u.", _player->GetName().c_str(), faction_id); return 0; } @@ -69,7 +69,7 @@ int32 ReputationMgr::GetReputation(uint32 faction_id) const if (!factionEntry) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "ReputationMgr::GetReputation: Can't get reputation of %s for unknown faction (faction id) #%u.", _player->GetName().c_str(), faction_id); + TC_LOG_ERROR("misc", "ReputationMgr::GetReputation: Can't get reputation of %s for unknown faction (faction id) #%u.", _player->GetName().c_str(), faction_id); return 0; } diff --git a/src/server/game/Scripting/MapScripts.cpp b/src/server/game/Scripting/MapScripts.cpp index ff133272724..41c18b850a1 100644 --- a/src/server/game/Scripting/MapScripts.cpp +++ b/src/server/game/Scripting/MapScripts.cpp @@ -103,7 +103,7 @@ inline Player* Map::_GetScriptPlayerSourceOrTarget(Object* source, Object* targe { Player* player = NULL; if (!source && !target) - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s source and target objects are NULL.", scriptInfo->GetDebugInfo().c_str()); + TC_LOG_ERROR("scripts", "%s source and target objects are NULL.", scriptInfo->GetDebugInfo().c_str()); else { // Check target first, then source. @@ -113,7 +113,7 @@ inline Player* Map::_GetScriptPlayerSourceOrTarget(Object* source, Object* targe player = source->ToPlayer(); if (!player) - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s neither source nor target object is player (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.", + TC_LOG_ERROR("scripts", "%s neither source nor target object is player (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.", scriptInfo->GetDebugInfo().c_str(), source ? source->GetTypeId() : 0, source ? source->GetEntry() : 0, source ? source->GetGUIDLow() : 0, target ? target->GetTypeId() : 0, target ? target->GetEntry() : 0, target ? target->GetGUIDLow() : 0); @@ -125,7 +125,7 @@ inline Creature* Map::_GetScriptCreatureSourceOrTarget(Object* source, Object* t { Creature* creature = NULL; if (!source && !target) - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s source and target objects are NULL.", scriptInfo->GetDebugInfo().c_str()); + TC_LOG_ERROR("scripts", "%s source and target objects are NULL.", scriptInfo->GetDebugInfo().c_str()); else { if (bReverse) @@ -146,7 +146,7 @@ inline Creature* Map::_GetScriptCreatureSourceOrTarget(Object* source, Object* t } if (!creature) - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s neither source nor target are creatures (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.", + TC_LOG_ERROR("scripts", "%s neither source nor target are creatures (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.", scriptInfo->GetDebugInfo().c_str(), source ? source->GetTypeId() : 0, source ? source->GetEntry() : 0, source ? source->GetGUIDLow() : 0, target ? target->GetTypeId() : 0, target ? target->GetEntry() : 0, target ? target->GetGUIDLow() : 0); @@ -158,15 +158,15 @@ inline Unit* Map::_GetScriptUnit(Object* obj, bool isSource, const ScriptInfo* s { Unit* unit = NULL; if (!obj) - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s %s object is NULL.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target"); + TC_LOG_ERROR("scripts", "%s %s object is NULL.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target"); else if (!obj->isType(TYPEMASK_UNIT)) - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s %s object is not unit (TypeId: %u, Entry: %u, GUID: %u), skipping.", + TC_LOG_ERROR("scripts", "%s %s object is not unit (TypeId: %u, Entry: %u, GUID: %u), skipping.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUIDLow()); else { unit = obj->ToUnit(); if (!unit) - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s %s object could not be casted to unit.", + TC_LOG_ERROR("scripts", "%s %s object could not be casted to unit.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target"); } return unit; @@ -176,12 +176,12 @@ inline Player* Map::_GetScriptPlayer(Object* obj, bool isSource, const ScriptInf { Player* player = NULL; if (!obj) - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s %s object is NULL.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target"); + TC_LOG_ERROR("scripts", "%s %s object is NULL.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target"); else { player = obj->ToPlayer(); if (!player) - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s %s object is not a player (TypeId: %u, Entry: %u, GUID: %u).", + TC_LOG_ERROR("scripts", "%s %s object is not a player (TypeId: %u, Entry: %u, GUID: %u).", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUIDLow()); } return player; @@ -191,12 +191,12 @@ inline Creature* Map::_GetScriptCreature(Object* obj, bool isSource, const Scrip { Creature* creature = NULL; if (!obj) - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s %s object is NULL.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target"); + TC_LOG_ERROR("scripts", "%s %s object is NULL.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target"); else { creature = obj->ToCreature(); if (!creature) - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s %s object is not a creature (TypeId: %u, Entry: %u, GUID: %u).", scriptInfo->GetDebugInfo().c_str(), + TC_LOG_ERROR("scripts", "%s %s object is not a creature (TypeId: %u, Entry: %u, GUID: %u).", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUIDLow()); } return creature; @@ -206,13 +206,13 @@ inline WorldObject* Map::_GetScriptWorldObject(Object* obj, bool isSource, const { WorldObject* pWorldObject = NULL; if (!obj) - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s %s object is NULL.", + TC_LOG_ERROR("scripts", "%s %s object is NULL.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target"); else { pWorldObject = dynamic_cast<WorldObject*>(obj); if (!pWorldObject) - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s %s object is not a world object (TypeId: %u, Entry: %u, GUID: %u).", + TC_LOG_ERROR("scripts", "%s %s object is not a world object (TypeId: %u, Entry: %u, GUID: %u).", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUIDLow()); } return pWorldObject; @@ -228,29 +228,29 @@ inline void Map::_ScriptProcessDoor(Object* source, Object* target, const Script case SCRIPT_COMMAND_OPEN_DOOR: bOpen = true; break; case SCRIPT_COMMAND_CLOSE_DOOR: break; default: - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s unknown command for _ScriptProcessDoor.", scriptInfo->GetDebugInfo().c_str()); + TC_LOG_ERROR("scripts", "%s unknown command for _ScriptProcessDoor.", scriptInfo->GetDebugInfo().c_str()); return; } if (!guid) - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s door guid is not specified.", scriptInfo->GetDebugInfo().c_str()); + TC_LOG_ERROR("scripts", "%s door guid is not specified.", scriptInfo->GetDebugInfo().c_str()); else if (!source) - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s source object is NULL.", scriptInfo->GetDebugInfo().c_str()); + TC_LOG_ERROR("scripts", "%s source object is NULL.", scriptInfo->GetDebugInfo().c_str()); else if (!source->isType(TYPEMASK_UNIT)) - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s source object is not unit (TypeId: %u, Entry: %u, GUID: %u), skipping.", scriptInfo->GetDebugInfo().c_str(), + TC_LOG_ERROR("scripts", "%s source object is not unit (TypeId: %u, Entry: %u, GUID: %u), skipping.", scriptInfo->GetDebugInfo().c_str(), source->GetTypeId(), source->GetEntry(), source->GetGUIDLow()); else { WorldObject* wSource = dynamic_cast <WorldObject*> (source); if (!wSource) - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s source object could not be casted to world object (TypeId: %u, Entry: %u, GUID: %u), skipping.", + TC_LOG_ERROR("scripts", "%s source object could not be casted to world object (TypeId: %u, Entry: %u, GUID: %u), skipping.", scriptInfo->GetDebugInfo().c_str(), source->GetTypeId(), source->GetEntry(), source->GetGUIDLow()); else { GameObject* pDoor = _FindGameObject(wSource, guid); if (!pDoor) - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s gameobject was not found (guid: %u).", scriptInfo->GetDebugInfo().c_str(), guid); + TC_LOG_ERROR("scripts", "%s gameobject was not found (guid: %u).", scriptInfo->GetDebugInfo().c_str(), guid); else if (pDoor->GetGoType() != GAMEOBJECT_TYPE_DOOR) - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s gameobject is not a door (GoType: %u, Entry: %u, GUID: %u).", + TC_LOG_ERROR("scripts", "%s gameobject is not a door (GoType: %u, Entry: %u, GUID: %u).", scriptInfo->GetDebugInfo().c_str(), pDoor->GetGoType(), pDoor->GetEntry(), pDoor->GetGUIDLow()); else if (bOpen == (pDoor->GetGoState() == GO_STATE_READY)) { @@ -329,7 +329,7 @@ void Map::ScriptsProcess() break; } default: - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s source with unsupported high guid (GUID: " UI64FMTD ", high guid: %u).", + TC_LOG_ERROR("scripts", "%s source with unsupported high guid (GUID: " UI64FMTD ", high guid: %u).", step.script->GetDebugInfo().c_str(), step.sourceGUID, GUID_HIPART(step.sourceGUID)); break; } @@ -364,7 +364,7 @@ void Map::ScriptsProcess() break; } default: - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s target with unsupported high guid (GUID: " UI64FMTD ", high guid: %u).", + TC_LOG_ERROR("scripts", "%s target with unsupported high guid (GUID: " UI64FMTD ", high guid: %u).", step.script->GetDebugInfo().c_str(), step.targetGUID, GUID_HIPART(step.targetGUID)); break; } @@ -375,7 +375,7 @@ void Map::ScriptsProcess() case SCRIPT_COMMAND_TALK: if (step.script->Talk.ChatType > CHAT_TYPE_WHISPER && step.script->Talk.ChatType != CHAT_MSG_RAID_BOSS_WHISPER) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s invalid chat type (%u) specified, skipping.", step.script->GetDebugInfo().c_str(), step.script->Talk.ChatType); + TC_LOG_ERROR("scripts", "%s invalid chat type (%u) specified, skipping.", step.script->GetDebugInfo().c_str(), step.script->Talk.ChatType); break; } if (step.script->Talk.Flags & SF_TALK_USE_PLAYER) @@ -402,7 +402,7 @@ void Map::ScriptsProcess() { uint64 targetGUID = target ? target->GetGUID() : 0; if (!targetGUID || !IS_PLAYER_GUID(targetGUID)) - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s attempt to whisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str()); + TC_LOG_ERROR("scripts", "%s attempt to whisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str()); else player->Whisper(text, LANG_UNIVERSAL, targetGUID); break; @@ -434,13 +434,13 @@ void Map::ScriptsProcess() break; case CHAT_TYPE_WHISPER: if (!targetGUID || !IS_PLAYER_GUID(targetGUID)) - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s attempt to whisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str()); + TC_LOG_ERROR("scripts", "%s attempt to whisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str()); else cSource->Whisper(step.script->Talk.TextID, targetGUID); break; case CHAT_MSG_RAID_BOSS_WHISPER: if (!targetGUID || !IS_PLAYER_GUID(targetGUID)) - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s attempt to raidbosswhisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str()); + TC_LOG_ERROR("scripts", "%s attempt to raidbosswhisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str()); else cSource->MonsterWhisper(step.script->Talk.TextID, targetGUID, true); break; @@ -468,7 +468,7 @@ void Map::ScriptsProcess() { // Validate field number. if (step.script->FieldSet.FieldID <= OBJECT_FIELD_ENTRY || step.script->FieldSet.FieldID >= cSource->GetValuesCount()) - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.", + TC_LOG_ERROR("scripts", "%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.", step.script->GetDebugInfo().c_str(), step.script->FieldSet.FieldID, cSource->GetValuesCount(), cSource->GetTypeId(), cSource->GetEntry(), cSource->GetGUIDLow()); else @@ -497,9 +497,9 @@ void Map::ScriptsProcess() { // Validate field number. if (step.script->FlagToggle.FieldID <= OBJECT_FIELD_ENTRY || step.script->FlagToggle.FieldID >= cSource->GetValuesCount()) - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.", + TC_LOG_ERROR("scripts", "%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.", step.script->GetDebugInfo().c_str(), step.script->FlagToggle.FieldID, - source->GetValuesCount(), source->GetTypeId(), source->GetEntry(), source->GetGUIDLow()); + cSource->GetValuesCount(), cSource->GetTypeId(), cSource->GetEntry(), cSource->GetGUIDLow()); else cSource->SetFlag(step.script->FlagToggle.FieldID, step.script->FlagToggle.FieldValue); } @@ -511,9 +511,9 @@ void Map::ScriptsProcess() { // Validate field number. if (step.script->FlagToggle.FieldID <= OBJECT_FIELD_ENTRY || step.script->FlagToggle.FieldID >= cSource->GetValuesCount()) - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.", + TC_LOG_ERROR("scripts", "%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.", step.script->GetDebugInfo().c_str(), step.script->FlagToggle.FieldID, - source->GetValuesCount(), source->GetTypeId(), source->GetEntry(), source->GetGUIDLow()); + cSource->GetValuesCount(), cSource->GetTypeId(), cSource->GetEntry(), cSource->GetGUIDLow()); else cSource->RemoveFlag(step.script->FlagToggle.FieldID, step.script->FlagToggle.FieldValue); } @@ -538,12 +538,12 @@ void Map::ScriptsProcess() { if (!source) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s source object is NULL.", step.script->GetDebugInfo().c_str()); + TC_LOG_ERROR("scripts", "%s source object is NULL.", step.script->GetDebugInfo().c_str()); break; } if (!target) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s target object is NULL.", step.script->GetDebugInfo().c_str()); + TC_LOG_ERROR("scripts", "%s target object is NULL.", step.script->GetDebugInfo().c_str()); break; } @@ -554,7 +554,7 @@ void Map::ScriptsProcess() { if (source->GetTypeId() != TYPEID_UNIT && source->GetTypeId() != TYPEID_GAMEOBJECT && source->GetTypeId() != TYPEID_PLAYER) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s source is not unit, gameobject or player (TypeId: %u, Entry: %u, GUID: %u), skipping.", + TC_LOG_ERROR("scripts", "%s source is not unit, gameobject or player (TypeId: %u, Entry: %u, GUID: %u), skipping.", step.script->GetDebugInfo().c_str(), source->GetTypeId(), source->GetEntry(), source->GetGUIDLow()); break; } @@ -567,7 +567,7 @@ void Map::ScriptsProcess() { if (target->GetTypeId() != TYPEID_UNIT && target->GetTypeId() != TYPEID_GAMEOBJECT && target->GetTypeId() != TYPEID_PLAYER) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s target is not unit, gameobject or player (TypeId: %u, Entry: %u, GUID: %u), skipping.", + TC_LOG_ERROR("scripts", "%s target is not unit, gameobject or player (TypeId: %u, Entry: %u, GUID: %u), skipping.", step.script->GetDebugInfo().c_str(), target->GetTypeId(), target->GetEntry(), target->GetGUIDLow()); break; } @@ -575,7 +575,7 @@ void Map::ScriptsProcess() } else { - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s neither source nor target is player (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.", + TC_LOG_ERROR("scripts", "%s neither source nor target is player (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.", step.script->GetDebugInfo().c_str(), source->GetTypeId(), source->GetEntry(), source->GetGUIDLow(), target->GetTypeId(), target->GetEntry(), target->GetGUIDLow()); break; @@ -606,7 +606,7 @@ void Map::ScriptsProcess() case SCRIPT_COMMAND_RESPAWN_GAMEOBJECT: if (!step.script->RespawnGameobject.GOGuid) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s gameobject guid (datalong) is not specified.", step.script->GetDebugInfo().c_str()); + TC_LOG_ERROR("scripts", "%s gameobject guid (datalong) is not specified.", step.script->GetDebugInfo().c_str()); break; } @@ -616,7 +616,7 @@ void Map::ScriptsProcess() GameObject* pGO = _FindGameObject(pSummoner, step.script->RespawnGameobject.GOGuid); if (!pGO) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s gameobject was not found (guid: %u).", step.script->GetDebugInfo().c_str(), step.script->RespawnGameobject.GOGuid); + TC_LOG_ERROR("scripts", "%s gameobject was not found (guid: %u).", step.script->GetDebugInfo().c_str(), step.script->RespawnGameobject.GOGuid); break; } @@ -625,7 +625,7 @@ void Map::ScriptsProcess() pGO->GetGoType() == GAMEOBJECT_TYPE_BUTTON || pGO->GetGoType() == GAMEOBJECT_TYPE_TRAP) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s can not be used with gameobject of type %u (guid: %u).", + TC_LOG_ERROR("scripts", "%s can not be used with gameobject of type %u (guid: %u).", step.script->GetDebugInfo().c_str(), uint32(pGO->GetGoType()), step.script->RespawnGameobject.GOGuid); break; } @@ -648,7 +648,7 @@ void Map::ScriptsProcess() if (WorldObject* pSummoner = _GetScriptWorldObject(source, true, step.script)) { if (!step.script->TempSummonCreature.CreatureEntry) - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s creature entry (datalong) is not specified.", step.script->GetDebugInfo().c_str()); + TC_LOG_ERROR("scripts", "%s creature entry (datalong) is not specified.", step.script->GetDebugInfo().c_str()); else { float x = step.script->TempSummonCreature.PosX; @@ -657,7 +657,7 @@ void Map::ScriptsProcess() float o = step.script->TempSummonCreature.Orientation; if (!pSummoner->SummonCreature(step.script->TempSummonCreature.CreatureEntry, x, y, z, o, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, step.script->TempSummonCreature.DespawnDelay)) - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s creature was not spawned (entry: %u).", step.script->GetDebugInfo().c_str(), step.script->TempSummonCreature.CreatureEntry); + TC_LOG_ERROR("scripts", "%s creature was not spawned (entry: %u).", step.script->GetDebugInfo().c_str(), step.script->TempSummonCreature.CreatureEntry); } } break; @@ -675,13 +675,13 @@ void Map::ScriptsProcess() // Target must be GameObject. if (!target) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s target object is NULL.", step.script->GetDebugInfo().c_str()); + TC_LOG_ERROR("scripts", "%s target object is NULL.", step.script->GetDebugInfo().c_str()); break; } if (target->GetTypeId() != TYPEID_GAMEOBJECT) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s target object is not gameobject (TypeId: %u, Entry: %u, GUID: %u), skipping.", + TC_LOG_ERROR("scripts", "%s target object is not gameobject (TypeId: %u, Entry: %u, GUID: %u), skipping.", step.script->GetDebugInfo().c_str(), target->GetTypeId(), target->GetEntry(), target->GetGUIDLow()); break; } @@ -705,7 +705,7 @@ void Map::ScriptsProcess() /// @todo Allow gameobjects to be targets and casters if (!source && !target) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s source and target objects are NULL.", step.script->GetDebugInfo().c_str()); + TC_LOG_ERROR("scripts", "%s source and target objects are NULL.", step.script->GetDebugInfo().c_str()); break; } @@ -738,13 +738,13 @@ void Map::ScriptsProcess() if (!uSource || !uSource->isType(TYPEMASK_UNIT)) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s no source unit found for spell %u", step.script->GetDebugInfo().c_str(), step.script->CastSpell.SpellID); + TC_LOG_ERROR("scripts", "%s no source unit found for spell %u", step.script->GetDebugInfo().c_str(), step.script->CastSpell.SpellID); break; } if (!uTarget || !uTarget->isType(TYPEMASK_UNIT)) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s no target unit found for spell %u", step.script->GetDebugInfo().c_str(), step.script->CastSpell.SpellID); + TC_LOG_ERROR("scripts", "%s no target unit found for spell %u", step.script->GetDebugInfo().c_str(), step.script->CastSpell.SpellID); break; } @@ -804,7 +804,7 @@ void Map::ScriptsProcess() if (Unit* unit = _GetScriptUnit(source, true, step.script)) { if (!sWaypointMgr->GetPath(step.script->LoadPath.PathID)) - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s source object has an invalid path (%u), skipping.", step.script->GetDebugInfo().c_str(), step.script->LoadPath.PathID); + TC_LOG_ERROR("scripts", "%s source object has an invalid path (%u), skipping.", step.script->GetDebugInfo().c_str(), step.script->LoadPath.PathID); else unit->GetMotionMaster()->MovePath(step.script->LoadPath.PathID, step.script->LoadPath.IsRepeatable); } @@ -814,12 +814,12 @@ void Map::ScriptsProcess() { if (!step.script->CallScript.CreatureEntry) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s creature entry is not specified, skipping.", step.script->GetDebugInfo().c_str()); + TC_LOG_ERROR("scripts", "%s creature entry is not specified, skipping.", step.script->GetDebugInfo().c_str()); break; } if (!step.script->CallScript.ScriptID) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s script id is not specified, skipping.", step.script->GetDebugInfo().c_str()); + TC_LOG_ERROR("scripts", "%s script id is not specified, skipping.", step.script->GetDebugInfo().c_str()); break; } @@ -845,7 +845,7 @@ void Map::ScriptsProcess() if (!cTarget) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s target was not found (entry: %u)", step.script->GetDebugInfo().c_str(), step.script->CallScript.CreatureEntry); + TC_LOG_ERROR("scripts", "%s target was not found (entry: %u)", step.script->GetDebugInfo().c_str(), step.script->CallScript.CreatureEntry); break; } @@ -854,7 +854,7 @@ void Map::ScriptsProcess() //if no scriptmap present... if (!datamap) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s unknown scriptmap (%u) specified, skipping.", step.script->GetDebugInfo().c_str(), step.script->CallScript.ScriptType); + TC_LOG_ERROR("scripts", "%s unknown scriptmap (%u) specified, skipping.", step.script->GetDebugInfo().c_str(), step.script->CallScript.ScriptType); break; } @@ -868,7 +868,7 @@ void Map::ScriptsProcess() if (Creature* cSource = _GetScriptCreatureSourceOrTarget(source, target, step.script)) { if (cSource->isDead()) - TC_LOG_ERROR(LOG_FILTER_TSCR, "%s creature is already dead (Entry: %u, GUID: %u)", + TC_LOG_ERROR("scripts", "%s creature is already dead (Entry: %u, GUID: %u)", step.script->GetDebugInfo().c_str(), cSource->GetEntry(), cSource->GetGUIDLow()); else { @@ -922,7 +922,7 @@ void Map::ScriptsProcess() break; default: - TC_LOG_ERROR(LOG_FILTER_TSCR, "Unknown script command %s.", step.script->GetDebugInfo().c_str()); + TC_LOG_ERROR("scripts", "Unknown script command %s.", step.script->GetDebugInfo().c_str()); break; } diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp index 31323a66ba9..3b340f8d147 100644 --- a/src/server/game/Scripting/ScriptLoader.cpp +++ b/src/server/game/Scripting/ScriptLoader.cpp @@ -272,7 +272,6 @@ void AddSC_ironforge(); void AddSC_isle_of_queldanas(); void AddSC_loch_modan(); void AddSC_redridge_mountains(); -void AddSC_silvermoon_city(); void AddSC_silverpine_forest(); void AddSC_stormwind_city(); void AddSC_stranglethorn_vale(); @@ -322,7 +321,10 @@ void AddSC_boss_ptheradras(); void AddSC_instance_maraudon(); void AddSC_boss_onyxia(); //Onyxia's Lair void AddSC_instance_onyxias_lair(); -void AddSC_boss_amnennar_the_coldbringer(); //Razorfen Downs +void AddSC_boss_tuten_kash(); //Razorfen Downs +void AddSC_boss_mordresh_fire_eye(); +void AddSC_boss_glutton(); +void AddSC_boss_amnennar_the_coldbringer(); void AddSC_razorfen_downs(); void AddSC_instance_razorfen_downs(); void AddSC_razorfen_kraul(); //Razorfen Kraul @@ -447,6 +449,7 @@ void AddSC_oculus(); void AddSC_boss_malygos(); // The Nexus: Eye of Eternity void AddSC_instance_eye_of_eternity(); void AddSC_boss_sartharion(); //Obsidian Sanctum +void AddSC_obsidian_sanctum(); void AddSC_instance_obsidian_sanctum(); void AddSC_boss_bjarngrim(); //Ulduar Halls of Lightning void AddSC_boss_loken(); @@ -576,7 +579,8 @@ void AddSC_boss_grandmaster_vorpil(); void AddSC_boss_murmur(); void AddSC_instance_shadow_labyrinth(); -void AddSC_black_temple(); //Black Temple +// Black Temple +void AddSC_black_temple(); void AddSC_boss_illidan(); void AddSC_boss_shade_of_akama(); void AddSC_boss_supremus(); @@ -587,22 +591,35 @@ void AddSC_boss_teron_gorefiend(); void AddSC_boss_najentus(); void AddSC_boss_illidari_council(); void AddSC_instance_black_temple(); -void AddSC_boss_fathomlord_karathress(); //CR Serpent Shrine Cavern + +// Coilfang Reservoir - Serpent Shrine Cavern +void AddSC_boss_fathomlord_karathress(); void AddSC_boss_hydross_the_unstable(); void AddSC_boss_lady_vashj(); void AddSC_boss_leotheras_the_blind(); void AddSC_boss_morogrim_tidewalker(); void AddSC_instance_serpentshrine_cavern(); void AddSC_boss_the_lurker_below(); -void AddSC_boss_hydromancer_thespia(); //CR Steam Vault + +// Coilfang Reservoir - The Steam Vault +void AddSC_boss_hydromancer_thespia(); void AddSC_boss_mekgineer_steamrigger(); void AddSC_boss_warlord_kalithresh(); void AddSC_instance_steam_vault(); -void AddSC_instance_the_slave_pens(); //The Slave Pens -void AddSC_boss_hungarfen(); //CR Underbog -void AddSC_boss_the_black_stalker(); + +// Coilfang Reservoir - The Slave Pens +void AddSC_instance_the_slave_pens(); +void AddSC_boss_mennu_the_betrayer(); +void AddSC_boss_rokmar_the_crackler(); +void AddSC_boss_quagmirran(); + +// Coilfang Reservoir - The Underbog void AddSC_instance_the_underbog(); -void AddSC_boss_gruul(); //Gruul's Lair +void AddSC_boss_hungarfen(); +void AddSC_boss_the_black_stalker(); + +// Gruul's Lair +void AddSC_boss_gruul(); void AddSC_boss_high_king_maulgar(); void AddSC_instance_gruuls_lair(); void AddSC_boss_broggok(); //HC Blood Furnace @@ -620,6 +637,9 @@ void AddSC_boss_omor_the_unscarred(); void AddSC_boss_vazruden_the_herald(); void AddSC_instance_ramparts(); void AddSC_arcatraz(); //TK Arcatraz +void AddSC_boss_zereketh_the_unbound(); +void AddSC_boss_dalliah_the_doomsayer(); +void AddSC_boss_wrath_scryer_soccothrates(); void AddSC_boss_harbinger_skyriss(); void AddSC_instance_arcatraz(); void AddSC_boss_high_botanist_freywinn(); //TK Botanica @@ -963,7 +983,6 @@ void AddEasternKingdomsScripts() AddSC_isle_of_queldanas(); AddSC_loch_modan(); AddSC_redridge_mountains(); - AddSC_silvermoon_city(); AddSC_silverpine_forest(); AddSC_stormwind_city(); AddSC_stranglethorn_vale(); @@ -1017,7 +1036,10 @@ void AddKalimdorScripts() AddSC_instance_maraudon(); AddSC_boss_onyxia(); //Onyxia's Lair AddSC_instance_onyxias_lair(); - AddSC_boss_amnennar_the_coldbringer(); //Razorfen Downs + AddSC_boss_tuten_kash(); //Razorfen Downs + AddSC_boss_mordresh_fire_eye(); + AddSC_boss_glutton(); + AddSC_boss_amnennar_the_coldbringer(); AddSC_razorfen_downs(); AddSC_instance_razorfen_downs(); AddSC_razorfen_kraul(); //Razorfen Kraul @@ -1098,7 +1120,8 @@ void AddOutlandScripts() AddSC_boss_murmur(); AddSC_instance_shadow_labyrinth(); - AddSC_black_temple(); //Black Temple + // Black Temple + AddSC_black_temple(); AddSC_boss_illidan(); AddSC_boss_shade_of_akama(); AddSC_boss_supremus(); @@ -1109,22 +1132,35 @@ void AddOutlandScripts() AddSC_boss_najentus(); AddSC_boss_illidari_council(); AddSC_instance_black_temple(); - AddSC_boss_fathomlord_karathress(); //CR Serpent Shrine Cavern + + // Coilfang Reservoir - Serpent Shrine Cavern + AddSC_boss_fathomlord_karathress(); AddSC_boss_hydross_the_unstable(); AddSC_boss_lady_vashj(); AddSC_boss_leotheras_the_blind(); AddSC_boss_morogrim_tidewalker(); AddSC_instance_serpentshrine_cavern(); AddSC_boss_the_lurker_below(); - AddSC_boss_hydromancer_thespia(); //CR Steam Vault + + // Coilfang Reservoir - The Steam Vault + AddSC_instance_steam_vault(); + AddSC_boss_hydromancer_thespia(); AddSC_boss_mekgineer_steamrigger(); AddSC_boss_warlord_kalithresh(); - AddSC_instance_steam_vault(); - AddSC_instance_the_slave_pens(); //The Slave Pens - AddSC_boss_hungarfen(); //CR Underbog - AddSC_boss_the_black_stalker(); + + // Coilfang Reservoir - The Slave Pens + AddSC_instance_the_slave_pens(); + AddSC_boss_mennu_the_betrayer(); + AddSC_boss_rokmar_the_crackler(); + AddSC_boss_quagmirran(); + + // Coilfang Reservoir - The Underbog AddSC_instance_the_underbog(); - AddSC_boss_gruul(); //Gruul's Lair + AddSC_boss_hungarfen(); + AddSC_boss_the_black_stalker(); + + // Gruul's Lair + AddSC_boss_gruul(); AddSC_boss_high_king_maulgar(); AddSC_instance_gruuls_lair(); AddSC_boss_broggok(); //HC Blood Furnace @@ -1142,6 +1178,9 @@ void AddOutlandScripts() AddSC_boss_vazruden_the_herald(); AddSC_instance_ramparts(); AddSC_arcatraz(); //TK Arcatraz + AddSC_boss_zereketh_the_unbound(); + AddSC_boss_dalliah_the_doomsayer(); + AddSC_boss_wrath_scryer_soccothrates(); AddSC_boss_harbinger_skyriss(); AddSC_instance_arcatraz(); AddSC_boss_high_botanist_freywinn(); //TK Botanica @@ -1249,6 +1288,7 @@ void AddNorthrendScripts() AddSC_boss_malygos(); // The Nexus: Eye of Eternity AddSC_instance_eye_of_eternity(); AddSC_boss_sartharion(); //Obsidian Sanctum + AddSC_obsidian_sanctum(); AddSC_instance_obsidian_sanctum(); AddSC_boss_bjarngrim(); //Ulduar Halls of Lightning AddSC_boss_loken(); diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index c74cf1735ff..3674f8fe15e 100644 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -62,7 +62,7 @@ class ScriptRegistry { if (it->second == script) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "Script '%s' has same memory pointer as '%s'.", + TC_LOG_ERROR("scripts", "Script '%s' has same memory pointer as '%s'.", script->GetName().c_str(), it->second->GetName().c_str()); return; @@ -98,7 +98,7 @@ class ScriptRegistry else { // If the script is already assigned -> delete it! - TC_LOG_ERROR(LOG_FILTER_TSCR, "Script '%s' already assigned with the same script name, so the script can't work.", + TC_LOG_ERROR("scripts", "Script '%s' already assigned with the same script name, so the script can't work.", script->GetName().c_str()); ASSERT(false); // Error that should be fixed ASAP. @@ -108,7 +108,7 @@ class ScriptRegistry { // The script uses a script name from database, but isn't assigned to anything. if (script->GetName().find("example") == std::string::npos && script->GetName().find("Smart") == std::string::npos) - TC_LOG_ERROR(LOG_FILTER_SQL, "Script named '%s' does not have a script name assigned in database.", + TC_LOG_ERROR("sql.sql", "Script named '%s' does not have a script name assigned in database.", script->GetName().c_str()); // These scripts don't get stored anywhere so throw them into this to avoid leaking memory @@ -186,12 +186,12 @@ void ScriptMgr::Initialize() LoadDatabase(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading C++ scripts"); + TC_LOG_INFO("server.loading", "Loading C++ scripts"); FillSpellSummary(); AddScripts(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u C++ scripts in %u ms", GetScriptCount(), GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u C++ scripts in %u ms", GetScriptCount(), GetMSTimeDiffToNow(oldMSTime)); } void ScriptMgr::Unload() @@ -1419,7 +1419,7 @@ WorldMapScript::WorldMapScript(const char* name, uint32 mapId) : ScriptObject(name), MapScript<Map>(mapId) { if (GetEntry() && !GetEntry()->IsWorldMap()) - TC_LOG_ERROR(LOG_FILTER_TSCR, "WorldMapScript for map %u is invalid.", mapId); + TC_LOG_ERROR("scripts", "WorldMapScript for map %u is invalid.", mapId); ScriptRegistry<WorldMapScript>::AddScript(this); } @@ -1428,7 +1428,7 @@ InstanceMapScript::InstanceMapScript(const char* name, uint32 mapId) : ScriptObject(name), MapScript<InstanceMap>(mapId) { if (GetEntry() && !GetEntry()->IsDungeon()) - TC_LOG_ERROR(LOG_FILTER_TSCR, "InstanceMapScript for map %u is invalid.", mapId); + TC_LOG_ERROR("scripts", "InstanceMapScript for map %u is invalid.", mapId); ScriptRegistry<InstanceMapScript>::AddScript(this); } @@ -1437,7 +1437,7 @@ BattlegroundMapScript::BattlegroundMapScript(const char* name, uint32 mapId) : ScriptObject(name), MapScript<BattlegroundMap>(mapId) { if (GetEntry() && !GetEntry()->IsBattleground()) - TC_LOG_ERROR(LOG_FILTER_TSCR, "BattlegroundMapScript for map %u is invalid.", mapId); + TC_LOG_ERROR("scripts", "BattlegroundMapScript for map %u is invalid.", mapId); ScriptRegistry<BattlegroundMapScript>::AddScript(this); } diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h index 37a95c77254..401be45a4e1 100644 --- a/src/server/game/Scripting/ScriptMgr.h +++ b/src/server/game/Scripting/ScriptMgr.h @@ -311,7 +311,7 @@ template<class TMap> class MapScript : public UpdatableScript<TMap> : _mapEntry(sMapStore.LookupEntry(mapId)) { if (!_mapEntry) - TC_LOG_ERROR(LOG_FILTER_TSCR, "Invalid MapScript for %u; no such map ID.", mapId); + TC_LOG_ERROR("scripts", "Invalid MapScript for %u; no such map ID.", mapId); } public: diff --git a/src/server/game/Scripting/ScriptSystem.cpp b/src/server/game/Scripting/ScriptSystem.cpp index d44eeabd254..921ae7cbda6 100644 --- a/src/server/game/Scripting/ScriptSystem.cpp +++ b/src/server/game/Scripting/ScriptSystem.cpp @@ -37,14 +37,14 @@ void SystemMgr::LoadScriptWaypoints() if (result) uiCreatureCount = result->GetRowCount(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Script Waypoints for " UI64FMTD " creature(s)...", uiCreatureCount); + TC_LOG_INFO("server.loading", "Loading Script Waypoints for " UI64FMTD " creature(s)...", uiCreatureCount); // 0 1 2 3 4 5 result = WorldDatabase.Query("SELECT entry, pointid, location_x, location_y, location_z, waittime FROM script_waypoint ORDER BY pointid"); if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 Script Waypoints. DB table `script_waypoint` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 Script Waypoints. DB table `script_waypoint` is empty."); return; } @@ -67,17 +67,17 @@ void SystemMgr::LoadScriptWaypoints() if (!pCInfo) { - TC_LOG_ERROR(LOG_FILTER_SQL, "TSCR: DB table script_waypoint has waypoint for non-existant creature entry %u", temp.uiCreatureEntry); + TC_LOG_ERROR("sql.sql", "TSCR: DB table script_waypoint has waypoint for non-existant creature entry %u", temp.uiCreatureEntry); continue; } if (!pCInfo->ScriptID) - TC_LOG_ERROR(LOG_FILTER_SQL, "TSCR: DB table script_waypoint has waypoint for creature entry %u, but creature does not have ScriptName defined and then useless.", temp.uiCreatureEntry); + TC_LOG_ERROR("sql.sql", "TSCR: DB table script_waypoint has waypoint for creature entry %u, but creature does not have ScriptName defined and then useless.", temp.uiCreatureEntry); m_mPointMoveMap[uiEntry].push_back(temp); ++count; } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Script Waypoint nodes in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u Script Waypoint nodes in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index c33c12ae5d4..696d29ce7f8 100644 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -100,6 +100,7 @@ WorldSession::WorldSession(uint32 id, WorldSocket* sock, AccountTypes sec, uint8 m_muteTime(mute_time), m_timeOutTime(0), AntiDOS(this), + m_GUIDLow(0), _player(NULL), m_Socket(sock), _security(sec), @@ -122,6 +123,8 @@ WorldSession::WorldSession(uint32 id, WorldSocket* sock, AccountTypes sec, uint8 timeLastWhoCommand(0), _RBACData(NULL) { + memset(m_Tutorials, 0, sizeof(m_Tutorials)); + if (sock) { m_Address = sock->GetRemoteAddress(); @@ -212,8 +215,8 @@ void WorldSession::SendPacket(WorldPacket const* packet) { uint64 minTime = uint64(cur_time - lastTime); uint64 fullTime = uint64(lastTime - firstTime); - TC_LOG_INFO(LOG_FILTER_GENERAL, "Send all time packets count: " UI64FMTD " bytes: " UI64FMTD " avr.count/sec: %f avr.bytes/sec: %f time: %u", sendPacketCount, sendPacketBytes, float(sendPacketCount)/fullTime, float(sendPacketBytes)/fullTime, uint32(fullTime)); - TC_LOG_INFO(LOG_FILTER_GENERAL, "Send last min packets count: " UI64FMTD " bytes: " UI64FMTD " avr.count/sec: %f avr.bytes/sec: %f", sendLastPacketCount, sendLastPacketBytes, float(sendLastPacketCount)/minTime, float(sendLastPacketBytes)/minTime); + TC_LOG_INFO("misc", "Send all time packets count: " UI64FMTD " bytes: " UI64FMTD " avr.count/sec: %f avr.bytes/sec: %f time: %u", sendPacketCount, sendPacketBytes, float(sendPacketCount)/fullTime, float(sendPacketBytes)/fullTime, uint32(fullTime)); + TC_LOG_INFO("misc", "Send last min packets count: " UI64FMTD " bytes: " UI64FMTD " avr.count/sec: %f avr.bytes/sec: %f", sendLastPacketCount, sendLastPacketBytes, float(sendLastPacketCount)/minTime, float(sendLastPacketBytes)/minTime); lastTime = cur_time; sendLastPacketCount = 1; @@ -234,17 +237,17 @@ void WorldSession::QueuePacket(WorldPacket* new_packet) /// Logging helper for unexpected opcodes void WorldSession::LogUnexpectedOpcode(WorldPacket* packet, const char* status, const char *reason) { - TC_LOG_ERROR(LOG_FILTER_OPCODES, "Received unexpected opcode %s Status: %s Reason: %s from %s", + TC_LOG_ERROR("network.opcode", "Received unexpected opcode %s Status: %s Reason: %s from %s", GetOpcodeNameForLogging(packet->GetOpcode()).c_str(), status, reason, GetPlayerInfo().c_str()); } /// Logging helper for unexpected opcodes void WorldSession::LogUnprocessedTail(WorldPacket* packet) { - if (!sLog->ShouldLog(LOG_FILTER_OPCODES, LOG_LEVEL_TRACE) || packet->rpos() >= packet->wpos()) + if (!sLog->ShouldLog("network.opcode", LOG_LEVEL_TRACE) || packet->rpos() >= packet->wpos()) return; - TC_LOG_TRACE(LOG_FILTER_OPCODES, "Unprocessed tail data (read stop at %u from %u) Opcode %s from %s", + TC_LOG_TRACE("network.opcode", "Unprocessed tail data (read stop at %u from %u) Opcode %s from %s", uint32(packet->rpos()), uint32(packet->wpos()), GetOpcodeNameForLogging(packet->GetOpcode()).c_str(), GetPlayerInfo().c_str()); packet->print_storage(); } @@ -284,7 +287,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) } else if (packet->GetOpcode() >= NUM_MSG_TYPES) { - TC_LOG_ERROR(LOG_FILTER_OPCODES, "Received non-existed opcode %s from %s", GetOpcodeNameForLogging(packet->GetOpcode()).c_str() + TC_LOG_ERROR("network.opcode", "Received non-existed opcode %s from %s", GetOpcodeNameForLogging(packet->GetOpcode()).c_str() , GetPlayerInfo().c_str()); sScriptMgr->OnUnknownPacketReceive(m_Socket, WorldPacket(*packet)); } @@ -310,7 +313,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) deletePacket = false; QueuePacket(packet); //! Log - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Re-enqueueing packet with opcode %s with with status STATUS_LOGGEDIN. " + TC_LOG_DEBUG("network", "Re-enqueueing packet with opcode %s with with status STATUS_LOGGEDIN. " "Player is currently not in world yet.", GetOpcodeNameForLogging(packet->GetOpcode()).c_str()); } } @@ -364,18 +367,18 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) LogUnprocessedTail(packet); break; case STATUS_NEVER: - TC_LOG_ERROR(LOG_FILTER_OPCODES, "Received not allowed opcode %s from %s", GetOpcodeNameForLogging(packet->GetOpcode()).c_str() + TC_LOG_ERROR("network.opcode", "Received not allowed opcode %s from %s", GetOpcodeNameForLogging(packet->GetOpcode()).c_str() , GetPlayerInfo().c_str()); break; case STATUS_UNHANDLED: - TC_LOG_DEBUG(LOG_FILTER_OPCODES, "Received not handled opcode %s from %s", GetOpcodeNameForLogging(packet->GetOpcode()).c_str() + TC_LOG_DEBUG("network.opcode", "Received not handled opcode %s from %s", GetOpcodeNameForLogging(packet->GetOpcode()).c_str() , GetPlayerInfo().c_str()); break; } } catch (ByteBufferException const&) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "WorldSession::Update ByteBufferException occured while parsing a packet (opcode: %u) from client %s, accountid=%i. Skipped packet.", + TC_LOG_ERROR("misc", "WorldSession::Update ByteBufferException occured while parsing a packet (opcode: %u) from client %s, accountid=%i. Skipped packet.", packet->GetOpcode(), GetRemoteAddress().c_str(), GetAccountId()); packet->hexlike(); } @@ -543,7 +546,7 @@ void WorldSession::LogoutPlayer(bool save) // e.g if he got disconnected during a transfer to another map // calls to GetMap in this case may cause crashes _player->CleanupsBeforeDelete(); - TC_LOG_INFO(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Logout Character:[%s] (GUID: %u) Level: %d", + TC_LOG_INFO("entities.player.character", "Account: %d (IP: %s) Logout Character:[%s] (GUID: %u) Level: %d", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName().c_str(), _player->GetGUIDLow(), _player->getLevel()); if (Map* _map = _player->FindMap()) _map->RemovePlayerFromMap(_player, true); @@ -554,7 +557,7 @@ void WorldSession::LogoutPlayer(bool save) //! Client will respond by sending 3x CMSG_CANCEL_TRADE, which we currently dont handle WorldPacket data(SMSG_LOGOUT_COMPLETE, 0); SendPacket(&data); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "SESSION: Sent SMSG_LOGOUT_COMPLETE Message"); + TC_LOG_DEBUG("network", "SESSION: Sent SMSG_LOGOUT_COMPLETE Message"); //! Since each account can only have one online character at any given time, ensure all characters for active account are marked as offline PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ACCOUNT_ONLINE); @@ -618,25 +621,25 @@ const char *WorldSession::GetTrinityString(int32 entry) const void WorldSession::Handle_NULL(WorldPacket& recvPacket) { - TC_LOG_ERROR(LOG_FILTER_OPCODES, "Received unhandled opcode %s from %s" + TC_LOG_ERROR("network.opcode", "Received unhandled opcode %s from %s" , GetOpcodeNameForLogging(recvPacket.GetOpcode()).c_str(), GetPlayerInfo().c_str()); } void WorldSession::Handle_EarlyProccess(WorldPacket& recvPacket) { - TC_LOG_ERROR(LOG_FILTER_OPCODES, "Received opcode %s that must be processed in WorldSocket::OnRead from %s" + TC_LOG_ERROR("network.opcode", "Received opcode %s that must be processed in WorldSocket::OnRead from %s" , GetOpcodeNameForLogging(recvPacket.GetOpcode()).c_str(), GetPlayerInfo().c_str()); } void WorldSession::Handle_ServerSide(WorldPacket& recvPacket) { - TC_LOG_ERROR(LOG_FILTER_OPCODES, "Received server-side opcode %s from %s" + TC_LOG_ERROR("network.opcode", "Received server-side opcode %s from %s" , GetOpcodeNameForLogging(recvPacket.GetOpcode()).c_str(), GetPlayerInfo().c_str()); } void WorldSession::Handle_Deprecated(WorldPacket& recvPacket) { - TC_LOG_ERROR(LOG_FILTER_OPCODES, "Received deprecated opcode %s from %s" + TC_LOG_ERROR("network.opcode", "Received deprecated opcode %s from %s" , GetOpcodeNameForLogging(recvPacket.GetOpcode()).c_str(), GetPlayerInfo().c_str()); } @@ -680,14 +683,14 @@ void WorldSession::LoadAccountData(PreparedQueryResult result, uint32 mask) uint32 type = fields[0].GetUInt8(); if (type >= NUM_ACCOUNT_DATA_TYPES) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Table `%s` have invalid account data type (%u), ignore.", + TC_LOG_ERROR("misc", "Table `%s` have invalid account data type (%u), ignore.", mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type); continue; } if ((mask & (1 << type)) == 0) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Table `%s` have non appropriate for table account data type (%u), ignore.", + TC_LOG_ERROR("misc", "Table `%s` have non appropriate for table account data type (%u), ignore.", mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type); continue; } @@ -821,7 +824,7 @@ void WorldSession::ReadMovementInfo(WorldPacket &data, MovementInfo* mi) { \ if (check) \ { \ - TC_LOG_DEBUG(LOG_FILTER_UNITS, "WorldSession::ReadMovementInfo: Violation of MovementFlags found (%s). " \ + TC_LOG_DEBUG("entities.unit", "WorldSession::ReadMovementInfo: Violation of MovementFlags found (%s). " \ "MovementFlags: %u, MovementFlags2: %u for player GUID: %u. Mask %u will be removed.", \ STRINGIZE(check), mi->GetMovementFlags(), mi->GetExtraMovementFlags(), GetPlayer()->GetGUIDLow(), maskToRemove); \ mi->RemoveMovementFlag((maskToRemove)); \ @@ -942,7 +945,7 @@ void WorldSession::ReadAddonsInfo(WorldPacket &data) if (size > 0xFFFFF) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "WorldSession::ReadAddonsInfo addon info too big, size %u", size); + TC_LOG_ERROR("misc", "WorldSession::ReadAddonsInfo addon info too big, size %u", size); return; } @@ -972,7 +975,7 @@ void WorldSession::ReadAddonsInfo(WorldPacket &data) addonInfo >> enabled >> crc >> unk1; - TC_LOG_INFO(LOG_FILTER_GENERAL, "ADDON: Name: %s, Enabled: 0x%x, CRC: 0x%x, Unknown2: 0x%x", addonName.c_str(), enabled, crc, unk1); + TC_LOG_INFO("misc", "ADDON: Name: %s, Enabled: 0x%x, CRC: 0x%x, Unknown2: 0x%x", addonName.c_str(), enabled, crc, unk1); AddonInfo addon(addonName, enabled, crc, 2, true); @@ -980,15 +983,15 @@ void WorldSession::ReadAddonsInfo(WorldPacket &data) if (savedAddon) { if (addon.CRC != savedAddon->CRC) - TC_LOG_INFO(LOG_FILTER_GENERAL, "ADDON: %s was known, but didn't match known CRC (0x%x)!", addon.Name.c_str(), savedAddon->CRC); + TC_LOG_INFO("misc", "ADDON: %s was known, but didn't match known CRC (0x%x)!", addon.Name.c_str(), savedAddon->CRC); else - TC_LOG_INFO(LOG_FILTER_GENERAL, "ADDON: %s was known, CRC is correct (0x%x)", addon.Name.c_str(), savedAddon->CRC); + TC_LOG_INFO("misc", "ADDON: %s was known, CRC is correct (0x%x)", addon.Name.c_str(), savedAddon->CRC); } else { AddonMgr::SaveAddon(addon); - TC_LOG_INFO(LOG_FILTER_GENERAL, "ADDON: %s (0x%x) was not known, saving...", addon.Name.c_str(), addon.CRC); + TC_LOG_INFO("misc", "ADDON: %s (0x%x) was not known, saving...", addon.Name.c_str(), addon.CRC); } /// @todo Find out when to not use CRC/pubkey, and other possible states. @@ -997,10 +1000,10 @@ void WorldSession::ReadAddonsInfo(WorldPacket &data) uint32 currentTime; addonInfo >> currentTime; - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "ADDON: CurrentTime: %u", currentTime); + TC_LOG_DEBUG("network", "ADDON: CurrentTime: %u", currentTime); } else - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Addon packet uncompress error!"); + TC_LOG_ERROR("misc", "Addon packet uncompress error!"); } void WorldSession::SendAddonsInfo() @@ -1039,7 +1042,7 @@ void WorldSession::SendAddonsInfo() data << uint8(usepk); if (usepk) // if CRC is wrong, add public key (client need it) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "ADDON: CRC (0x%x) for addon %s is wrong (does not match expected 0x%x), sending pubkey", + TC_LOG_INFO("misc", "ADDON: CRC (0x%x) for addon %s is wrong (does not match expected 0x%x), sending pubkey", itr->CRC, itr->Name.c_str(), STANDARD_ADDON_CRC); data.append(addonPublicKey, sizeof(addonPublicKey)); @@ -1200,7 +1203,7 @@ void WorldSession::LoadPermissions() _RBACData = new rbac::RBACData(id, name, realmID, secLevel); _RBACData->LoadFromDB(); - TC_LOG_DEBUG(LOG_FILTER_RBAC, "WorldSession::LoadPermissions [AccountId: %u, Name: %s, realmId: %d, secLevel: %u]", + TC_LOG_DEBUG("rbac", "WorldSession::LoadPermissions [AccountId: %u, Name: %s, realmId: %d, secLevel: %u]", id, name.c_str(), realmID, secLevel); } @@ -1215,7 +1218,7 @@ bool WorldSession::HasPermission(uint32 permission) LoadPermissions(); bool hasPermission = _RBACData->HasPermission(permission); - TC_LOG_DEBUG(LOG_FILTER_RBAC, "WorldSession::HasPermission [AccountId: %u, Name: %s, realmId: %d]", + TC_LOG_DEBUG("rbac", "WorldSession::HasPermission [AccountId: %u, Name: %s, realmId: %d]", _RBACData->GetId(), _RBACData->GetName().c_str(), realmID); return hasPermission; @@ -1223,7 +1226,7 @@ bool WorldSession::HasPermission(uint32 permission) void WorldSession::InvalidateRBACData() { - TC_LOG_DEBUG(LOG_FILTER_RBAC, "WorldSession::Invalidaterbac::RBACData [AccountId: %u, Name: %s, realmId: %d]", + TC_LOG_DEBUG("rbac", "WorldSession::Invalidaterbac::RBACData [AccountId: %u, Name: %s, realmId: %d]", _RBACData->GetId(), _RBACData->GetName().c_str(), realmID); delete _RBACData; _RBACData = NULL; @@ -1235,7 +1238,7 @@ bool WorldSession::DosProtection::EvaluateOpcode(WorldPacket& p) const return true; // Opcode not allowed, let the punishment begin - TC_LOG_INFO(LOG_FILTER_NETWORKIO, "AntiDOS: Account %u, IP: %s, sent unacceptable packet (opc: %u, size: %u)", + TC_LOG_INFO("network", "AntiDOS: Account %u, IP: %s, sent unacceptable packet (opc: %u, size: %u)", Session->GetAccountId(), Session->GetRemoteAddress().c_str(), p.GetOpcode(), (uint32)p.size()); switch (_policy) @@ -1243,7 +1246,7 @@ bool WorldSession::DosProtection::EvaluateOpcode(WorldPacket& p) const case POLICY_LOG: return true; case POLICY_KICK: - TC_LOG_INFO(LOG_FILTER_NETWORKIO, "AntiDOS: Player kicked!"); + TC_LOG_INFO("network", "AntiDOS: Player kicked!"); return false; case POLICY_BAN: { @@ -1257,7 +1260,7 @@ bool WorldSession::DosProtection::EvaluateOpcode(WorldPacket& p) const case BAN_IP: nameOrIp = Session->GetRemoteAddress(); break; } sWorld->BanAccount(bm, nameOrIp, duration, "DOS (Packet Flooding/Spoofing", "Server: AutoDOS"); - TC_LOG_INFO(LOG_FILTER_NETWORKIO, "AntiDOS: Player automatically banned for %u seconds.", duration); + TC_LOG_INFO("network", "AntiDOS: Player automatically banned for %u seconds.", duration); return false; } diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index 099bfe8e2b2..2d7ec9c68c6 100644 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -359,10 +359,10 @@ class WorldSession void ResetClientTimeDelay() { m_clientTimeDelay = 0; } uint32 getDialogStatus(Player* player, Object* questgiver, uint32 defstatus); - time_t m_timeOutTime; + ACE_Atomic_Op<ACE_Thread_Mutex, time_t> m_timeOutTime; void UpdateTimeOutTime(uint32 diff) { - if (time_t(diff) > m_timeOutTime) + if (time_t(diff) > m_timeOutTime.value()) m_timeOutTime = 0; else m_timeOutTime -= diff; diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp index b7c34f1c28d..1384ba3cc4b 100644 --- a/src/server/game/Server/WorldSocket.cpp +++ b/src/server/game/Server/WorldSocket.cpp @@ -62,7 +62,7 @@ struct ServerPktHeader uint8 headerIndex=0; if (isLargePacket()) { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "initializing large server to client packet. Size: %u, cmd: %u", size, cmd); + TC_LOG_DEBUG("network", "initializing large server to client packet. Size: %u, cmd: %u", size, cmd); header[headerIndex++] = 0x80 | (0xFF & (size >> 16)); } header[headerIndex++] = 0xFF &(size >> 8); @@ -167,7 +167,7 @@ int WorldSocket::SendPacket(WorldPacket const& pct) if (m_Session) - TC_LOG_TRACE(LOG_FILTER_OPCODES, "S->C: %s %s", m_Session->GetPlayerInfo().c_str(), GetOpcodeNameForLogging(pkt->GetOpcode()).c_str()); + TC_LOG_TRACE("network.opcode", "S->C: %s %s", m_Session->GetPlayerInfo().c_str(), GetOpcodeNameForLogging(pkt->GetOpcode()).c_str()); sScriptMgr->OnPacketSend(this, *pkt); @@ -198,7 +198,7 @@ int WorldSocket::SendPacket(WorldPacket const& pct) if (msg_queue()->enqueue_tail(mb, (ACE_Time_Value*)&ACE_Time_Value::zero) == -1) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "WorldSocket::SendPacket enqueue_tail failed"); + TC_LOG_ERROR("network", "WorldSocket::SendPacket enqueue_tail failed"); mb->release(); return -1; } @@ -241,7 +241,7 @@ int WorldSocket::open (void *a) if (peer().get_remote_addr(remote_addr) == -1) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "WorldSocket::open: peer().get_remote_addr errno = %s", ACE_OS::strerror (errno)); + TC_LOG_ERROR("network", "WorldSocket::open: peer().get_remote_addr errno = %s", ACE_OS::strerror (errno)); return -1; } @@ -253,7 +253,7 @@ int WorldSocket::open (void *a) // Register with ACE Reactor if (reactor()->register_handler(this, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::WRITE_MASK) == -1) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "WorldSocket::open: unable to register client handler errno = %s", ACE_OS::strerror (errno)); + TC_LOG_ERROR("network", "WorldSocket::open: unable to register client handler errno = %s", ACE_OS::strerror (errno)); return -1; } @@ -289,14 +289,14 @@ int WorldSocket::handle_input (ACE_HANDLE) return Update(); // interesting line, isn't it ? } - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WorldSocket::handle_input: Peer error closing connection errno = %s", ACE_OS::strerror (errno)); + TC_LOG_DEBUG("network", "WorldSocket::handle_input: Peer error closing connection errno = %s", ACE_OS::strerror (errno)); errno = ECONNRESET; return -1; } case 0: { - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WorldSocket::handle_input: Peer has closed connection"); + TC_LOG_DEBUG("network", "WorldSocket::handle_input: Peer has closed connection"); errno = ECONNRESET; return -1; @@ -365,7 +365,7 @@ int WorldSocket::handle_output_queue (GuardType& g) if (msg_queue()->dequeue_head(mblk, (ACE_Time_Value*)&ACE_Time_Value::zero) == -1) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "WorldSocket::handle_output_queue dequeue_head"); + TC_LOG_ERROR("network", "WorldSocket::handle_output_queue dequeue_head"); return -1; } @@ -400,7 +400,7 @@ int WorldSocket::handle_output_queue (GuardType& g) if (msg_queue()->enqueue_head(mblk, (ACE_Time_Value*) &ACE_Time_Value::zero) == -1) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "WorldSocket::handle_output_queue enqueue_head"); + TC_LOG_ERROR("network", "WorldSocket::handle_output_queue enqueue_head"); mblk->release(); return -1; } @@ -478,7 +478,7 @@ int WorldSocket::handle_input_header (void) if ((header.size < 4) || (header.size > 10240) || (header.cmd > 10240)) { Player* _player = m_Session ? m_Session->GetPlayer() : NULL; - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "WorldSocket::handle_input_header(): client (account: %u, char [GUID: %u, name: %s]) sent malformed packet (size: %d, cmd: %d)", + TC_LOG_ERROR("network", "WorldSocket::handle_input_header(): client (account: %u, char [GUID: %u, name: %s]) sent malformed packet (size: %d, cmd: %d)", m_Session ? m_Session->GetAccountId() : 0, _player ? _player->GetGUIDLow() : 0, _player ? _player->GetName().c_str() : "<none>", @@ -584,7 +584,7 @@ int WorldSocket::handle_input_missing_data (void) // hope this is not hack, as proper m_RecvWPct is asserted around if (!m_RecvWPct) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "Forcing close on input m_RecvWPct = NULL"); + TC_LOG_ERROR("network", "Forcing close on input m_RecvWPct = NULL"); errno = EINVAL; return -1; } @@ -630,7 +630,7 @@ int WorldSocket::cancel_wakeup_output (GuardType& g) (this, ACE_Event_Handler::WRITE_MASK) == -1) { // would be good to store errno from reactor with errno guard - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "WorldSocket::cancel_wakeup_output"); + TC_LOG_ERROR("network", "WorldSocket::cancel_wakeup_output"); return -1; } @@ -649,7 +649,7 @@ int WorldSocket::schedule_wakeup_output (GuardType& g) if (reactor()->schedule_wakeup (this, ACE_Event_Handler::WRITE_MASK) == -1) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "WorldSocket::schedule_wakeup_output"); + TC_LOG_ERROR("network", "WorldSocket::schedule_wakeup_output"); return -1; } @@ -674,7 +674,7 @@ int WorldSocket::ProcessIncoming(WorldPacket* new_pct) std::string opcodeName = GetOpcodeNameForLogging(opcode); if (m_Session) - TC_LOG_TRACE(LOG_FILTER_OPCODES, "C->S: %s %s", m_Session->GetPlayerInfo().c_str(), opcodeName.c_str()); + TC_LOG_TRACE("network.opcode", "C->S: %s %s", m_Session->GetPlayerInfo().c_str(), opcodeName.c_str()); try { @@ -685,14 +685,14 @@ int WorldSocket::ProcessIncoming(WorldPacket* new_pct) case CMSG_AUTH_SESSION: if (m_Session) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "WorldSocket::ProcessIncoming: received duplicate CMSG_AUTH_SESSION from %s", m_Session->GetPlayerInfo().c_str()); + TC_LOG_ERROR("network", "WorldSocket::ProcessIncoming: received duplicate CMSG_AUTH_SESSION from %s", m_Session->GetPlayerInfo().c_str()); return -1; } sScriptMgr->OnPacketReceive(this, WorldPacket(*new_pct)); return HandleAuthSession(*new_pct); case CMSG_KEEP_ALIVE: - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "%s", opcodeName.c_str()); + TC_LOG_DEBUG("network", "%s", opcodeName.c_str()); sScriptMgr->OnPacketReceive(this, WorldPacket(*new_pct)); return 0; default: @@ -700,7 +700,7 @@ int WorldSocket::ProcessIncoming(WorldPacket* new_pct) ACE_GUARD_RETURN(LockType, Guard, m_SessionLock, -1); if (!m_Session) { - TC_LOG_ERROR(LOG_FILTER_OPCODES, "ProcessIncoming: Client not authed opcode = %u", uint32(opcode)); + TC_LOG_ERROR("network.opcode", "ProcessIncoming: Client not authed opcode = %u", uint32(opcode)); return -1; } @@ -719,7 +719,7 @@ int WorldSocket::ProcessIncoming(WorldPacket* new_pct) } catch (ByteBufferException &) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "WorldSocket::ProcessIncoming ByteBufferException occured while parsing an instant handled packet %s from client %s, accountid=%i. Disconnected client.", + TC_LOG_ERROR("network", "WorldSocket::ProcessIncoming ByteBufferException occured while parsing an instant handled packet %s from client %s, accountid=%i. Disconnected client.", opcodeName.c_str(), GetRemoteAddress().c_str(), m_Session ? int32(m_Session->GetAccountId()) : -1); new_pct->hexlike(); return -1; @@ -762,7 +762,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket) if (sWorld->IsClosed()) { SendAuthResponseError(AUTH_REJECT); - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: World closed, denying client (%s).", GetRemoteAddress().c_str()); + TC_LOG_ERROR("network", "WorldSocket::HandleAuthSession: World closed, denying client (%s).", GetRemoteAddress().c_str()); return -1; } @@ -776,7 +776,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket) recvPacket >> unk4; recvPacket.read(digest, 20); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: client %u, unk2 %u, account %s, unk3 %u, clientseed %u", + TC_LOG_DEBUG("network", "WorldSocket::HandleAuthSession: client %u, unk2 %u, account %s, unk3 %u, clientseed %u", clientBuild, unk2, account.c_str(), @@ -796,7 +796,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket) if (!result) { SendAuthResponseError(AUTH_UNKNOWN_ACCOUNT); - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: Sent Auth Response (unknown account)."); + TC_LOG_ERROR("network", "WorldSocket::HandleAuthSession: Sent Auth Response (unknown account)."); return -1; } @@ -813,7 +813,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket) if (strcmp (fields[2].GetCString(), GetRemoteAddress().c_str())) { SendAuthResponseError(AUTH_FAILED); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: Sent Auth Response (Account IP differs)."); + TC_LOG_DEBUG("network", "WorldSocket::HandleAuthSession: Sent Auth Response (Account IP differs)."); return -1; } } @@ -847,7 +847,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket) if (sWorld->getBoolConfig(CONFIG_WARDEN_ENABLED) && os != "Win" && os != "OSX") { SendAuthResponseError(AUTH_REJECT); - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: Client %s attempted to log in using invalid client OS (%s).", GetRemoteAddress().c_str(), os.c_str()); + TC_LOG_ERROR("network", "WorldSocket::HandleAuthSession: Client %s attempted to log in using invalid client OS (%s).", GetRemoteAddress().c_str(), os.c_str()); return -1; } @@ -878,17 +878,17 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket) if (banresult) // if account banned { SendAuthResponseError(AUTH_BANNED); - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: Sent Auth Response (Account banned)."); + TC_LOG_ERROR("network", "WorldSocket::HandleAuthSession: Sent Auth Response (Account banned)."); return -1; } // Check locked state for server AccountTypes allowedAccountType = sWorld->GetPlayerSecurityLimit(); - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Allowed Level: %u Player Level %u", allowedAccountType, AccountTypes(security)); + TC_LOG_DEBUG("network", "Allowed Level: %u Player Level %u", allowedAccountType, AccountTypes(security)); if (allowedAccountType > SEC_PLAYER && AccountTypes(security) < allowedAccountType) { SendAuthResponseError(AUTH_UNAVAILABLE); - TC_LOG_INFO(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: User tries to login but his security level is not enough"); + TC_LOG_INFO("network", "WorldSocket::HandleAuthSession: User tries to login but his security level is not enough"); return -1; } @@ -908,11 +908,11 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket) if (memcmp(sha.GetDigest(), digest, 20)) { SendAuthResponseError(AUTH_FAILED); - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: Authentication failed for account: %u ('%s') address: %s", id, account.c_str(), address.c_str()); + TC_LOG_ERROR("network", "WorldSocket::HandleAuthSession: Authentication failed for account: %u ('%s') address: %s", id, account.c_str(), address.c_str()); return -1; } - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: Client '%s' authenticated successfully from %s.", + TC_LOG_DEBUG("network", "WorldSocket::HandleAuthSession: Client '%s' authenticated successfully from %s.", account.c_str(), address.c_str()); @@ -988,7 +988,7 @@ int WorldSocket::HandlePing (WorldPacket& recvPacket) if (m_Session && !m_Session->HasPermission(rbac::RBAC_PERM_SKIP_CHECK_OVERSPEED_PING)) { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "WorldSocket::HandlePing: %s kicked for over-speed pings (address: %s)", + TC_LOG_ERROR("network", "WorldSocket::HandlePing: %s kicked for over-speed pings (address: %s)", m_Session->GetPlayerInfo().c_str(), GetRemoteAddress().c_str()); return -1; @@ -1010,7 +1010,7 @@ int WorldSocket::HandlePing (WorldPacket& recvPacket) } else { - TC_LOG_ERROR(LOG_FILTER_NETWORKIO, "WorldSocket::HandlePing: peer sent CMSG_PING, " + TC_LOG_ERROR("network", "WorldSocket::HandlePing: peer sent CMSG_PING, " "but is not authenticated or got recently kicked, " " address = %s", GetRemoteAddress().c_str()); diff --git a/src/server/game/Server/WorldSocketAcceptor.h b/src/server/game/Server/WorldSocketAcceptor.h index 041b9778cee..518cf90d17f 100644 --- a/src/server/game/Server/WorldSocketAcceptor.h +++ b/src/server/game/Server/WorldSocketAcceptor.h @@ -44,7 +44,7 @@ protected: virtual int handle_timeout(const ACE_Time_Value& /*current_time*/, const void* /*act = 0*/) { - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "Resuming acceptor"); + TC_LOG_DEBUG("misc", "Resuming acceptor"); reactor()->cancel_timer(this, 1); return reactor()->register_handler(this, ACE_Event_Handler::ACCEPT_MASK); } @@ -54,7 +54,7 @@ protected: #if defined(ENFILE) && defined(EMFILE) if (errno == ENFILE || errno == EMFILE) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Out of file descriptors, suspending incoming connections for 10 seconds"); + TC_LOG_ERROR("misc", "Out of file descriptors, suspending incoming connections for 10 seconds"); reactor()->remove_handler(this, ACE_Event_Handler::ACCEPT_MASK | ACE_Event_Handler::DONT_CALL); reactor()->schedule_timer(this, NULL, ACE_Time_Value(10)); } diff --git a/src/server/game/Server/WorldSocketMgr.cpp b/src/server/game/Server/WorldSocketMgr.cpp index 12da93fb537..5b7b24666e2 100644 --- a/src/server/game/Server/WorldSocketMgr.cpp +++ b/src/server/game/Server/WorldSocketMgr.cpp @@ -155,7 +155,7 @@ class ReactorRunnable : protected ACE_Task_Base virtual int svc() { - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "Network Thread Starting"); + TC_LOG_DEBUG("misc", "Network Thread Starting"); ACE_ASSERT (m_Reactor); @@ -192,7 +192,7 @@ class ReactorRunnable : protected ACE_Task_Base } } - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "Network Thread exits"); + TC_LOG_DEBUG("misc", "Network Thread exits"); return 0; } @@ -234,7 +234,7 @@ WorldSocketMgr::StartReactiveIO (ACE_UINT16 port, const char* address) if (num_threads <= 0) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Network.Threads is wrong in your config file"); + TC_LOG_ERROR("misc", "Network.Threads is wrong in your config file"); return -1; } @@ -242,7 +242,7 @@ WorldSocketMgr::StartReactiveIO (ACE_UINT16 port, const char* address) m_NetThreads = new ReactorRunnable[m_NetThreadsCount]; - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "Max allowed socket connections %d", ACE::max_handles()); + TC_LOG_DEBUG("misc", "Max allowed socket connections %d", ACE::max_handles()); // -1 means use default m_SockOutKBuff = sConfigMgr->GetIntDefault ("Network.OutKBuff", -1); @@ -251,7 +251,7 @@ WorldSocketMgr::StartReactiveIO (ACE_UINT16 port, const char* address) if (m_SockOutUBuff <= 0) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Network.OutUBuff is wrong in your config file"); + TC_LOG_ERROR("misc", "Network.OutUBuff is wrong in your config file"); return -1; } @@ -261,7 +261,7 @@ WorldSocketMgr::StartReactiveIO (ACE_UINT16 port, const char* address) if (m_Acceptor->open(listen_addr, m_NetThreads[0].GetReactor(), ACE_NONBLOCK) == -1) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Failed to open acceptor, check if the port is free"); + TC_LOG_ERROR("misc", "Failed to open acceptor, check if the port is free"); return -1; } @@ -274,7 +274,7 @@ WorldSocketMgr::StartReactiveIO (ACE_UINT16 port, const char* address) int WorldSocketMgr::StartNetwork (ACE_UINT16 port, const char* address) { - if (!sLog->ShouldLog(LOG_FILTER_GENERAL, LOG_LEVEL_DEBUG)) + if (!sLog->ShouldLog("misc", LOG_LEVEL_DEBUG)) ACE_Log_Msg::instance()->priority_mask (LM_ERROR, ACE_Log_Msg::PROCESS); if (StartReactiveIO(port, address) == -1) @@ -325,7 +325,7 @@ WorldSocketMgr::OnSocketOpen (WorldSocket* sock) (void*) & m_SockOutKBuff, sizeof (int)) == -1 && errno != ENOTSUP) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "WorldSocketMgr::OnSocketOpen set_option SO_SNDBUF"); + TC_LOG_ERROR("misc", "WorldSocketMgr::OnSocketOpen set_option SO_SNDBUF"); return -1; } } @@ -340,7 +340,7 @@ WorldSocketMgr::OnSocketOpen (WorldSocket* sock) (void*)&ndoption, sizeof (int)) == -1) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "WorldSocketMgr::OnSocketOpen: peer().set_option TCP_NODELAY errno = %s", ACE_OS::strerror (errno)); + TC_LOG_ERROR("misc", "WorldSocketMgr::OnSocketOpen: peer().set_option TCP_NODELAY errno = %s", ACE_OS::strerror (errno)); return -1; } } diff --git a/src/server/game/Skills/SkillDiscovery.cpp b/src/server/game/Skills/SkillDiscovery.cpp index 94fd0ac4428..d911a20081a 100644 --- a/src/server/game/Skills/SkillDiscovery.cpp +++ b/src/server/game/Skills/SkillDiscovery.cpp @@ -55,7 +55,7 @@ void LoadSkillDiscoveryTable() if (!result) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 skill discovery definitions. DB table `skill_discovery_template` is empty."); + TC_LOG_ERROR("server.loading", ">> Loaded 0 skill discovery definitions. DB table `skill_discovery_template` is empty."); return; } @@ -88,7 +88,7 @@ void LoadSkillDiscoveryTable() { if (reportedReqSpells.find(absReqSkillOrSpell) == reportedReqSpells.end()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell (ID: %u) have not existed spell (ID: %i) in `reqSpell` field in `skill_discovery_template` table", spellId, reqSkillOrSpell); + TC_LOG_ERROR("sql.sql", "Spell (ID: %u) have not existed spell (ID: %i) in `reqSpell` field in `skill_discovery_template` table", spellId, reqSkillOrSpell); reportedReqSpells.insert(absReqSkillOrSpell); } continue; @@ -101,7 +101,7 @@ void LoadSkillDiscoveryTable() { if (reportedReqSpells.find(absReqSkillOrSpell) == reportedReqSpells.end()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell (ID: %u) not have MECHANIC_DISCOVERY (28) value in Mechanic field in spell.dbc" + TC_LOG_ERROR("sql.sql", "Spell (ID: %u) not have MECHANIC_DISCOVERY (28) value in Mechanic field in spell.dbc" " and not 100%% chance random discovery ability but listed for spellId %u (and maybe more) in `skill_discovery_template` table", absReqSkillOrSpell, spellId); reportedReqSpells.insert(absReqSkillOrSpell); @@ -117,7 +117,7 @@ void LoadSkillDiscoveryTable() if (bounds.first == bounds.second) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell (ID: %u) not listed in `SkillLineAbility.dbc` but listed with `reqSpell`=0 in `skill_discovery_template` table", spellId); + TC_LOG_ERROR("sql.sql", "Spell (ID: %u) not listed in `SkillLineAbility.dbc` but listed with `reqSpell`=0 in `skill_discovery_template` table", spellId); continue; } @@ -126,7 +126,7 @@ void LoadSkillDiscoveryTable() } else { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell (ID: %u) have negative value in `reqSpell` field in `skill_discovery_template` table", spellId); + TC_LOG_ERROR("sql.sql", "Spell (ID: %u) have negative value in `reqSpell` field in `skill_discovery_template` table", spellId); continue; } @@ -135,7 +135,7 @@ void LoadSkillDiscoveryTable() while (result->NextRow()); if (!ssNonDiscoverableEntries.str().empty()) - TC_LOG_ERROR(LOG_FILTER_SQL, "Some items can't be successfully discovered: have in chance field value < 0.000001 in `skill_discovery_template` DB table . List:\n%s", ssNonDiscoverableEntries.str().c_str()); + TC_LOG_ERROR("sql.sql", "Some items can't be successfully discovered: have in chance field value < 0.000001 in `skill_discovery_template` DB table . List:\n%s", ssNonDiscoverableEntries.str().c_str()); // report about empty data for explicit discovery spells for (uint32 spell_id = 1; spell_id < sSpellMgr->GetSpellInfoStoreSize(); ++spell_id) @@ -149,10 +149,10 @@ void LoadSkillDiscoveryTable() continue; if (SkillDiscoveryStore.find(int32(spell_id)) == SkillDiscoveryStore.end()) - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell (ID: %u) is 100%% chance random discovery ability but not have data in `skill_discovery_template` table", spell_id); + TC_LOG_ERROR("sql.sql", "Spell (ID: %u) is 100%% chance random discovery ability but not have data in `skill_discovery_template` table", spell_id); } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u skill discovery definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u skill discovery definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } uint32 GetExplicitDiscoverySpell(uint32 spellId, Player* player) diff --git a/src/server/game/Skills/SkillExtraItems.cpp b/src/server/game/Skills/SkillExtraItems.cpp index ddd8d1908fa..fec0c1c7c88 100644 --- a/src/server/game/Skills/SkillExtraItems.cpp +++ b/src/server/game/Skills/SkillExtraItems.cpp @@ -60,7 +60,7 @@ void LoadSkillExtraItemTable() if (!result) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell specialization definitions. DB table `skill_extra_item_template` is empty."); + TC_LOG_ERROR("server.loading", ">> Loaded 0 spell specialization definitions. DB table `skill_extra_item_template` is empty."); return; } @@ -74,28 +74,28 @@ void LoadSkillExtraItemTable() if (!sSpellMgr->GetSpellInfo(spellId)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Skill specialization %u has non-existent spell id in `skill_extra_item_template`!", spellId); + TC_LOG_ERROR("sql.sql", "Skill specialization %u has non-existent spell id in `skill_extra_item_template`!", spellId); continue; } uint32 requiredSpecialization = fields[1].GetUInt32(); if (!sSpellMgr->GetSpellInfo(requiredSpecialization)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Skill specialization %u have not existed required specialization spell id %u in `skill_extra_item_template`!", spellId, requiredSpecialization); + TC_LOG_ERROR("sql.sql", "Skill specialization %u have not existed required specialization spell id %u in `skill_extra_item_template`!", spellId, requiredSpecialization); continue; } float additionalCreateChance = fields[2].GetFloat(); if (additionalCreateChance <= 0.0f) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Skill specialization %u has too low additional create chance in `skill_extra_item_template`!", spellId); + TC_LOG_ERROR("sql.sql", "Skill specialization %u has too low additional create chance in `skill_extra_item_template`!", spellId); continue; } uint8 additionalMaxNum = fields[3].GetUInt8(); if (!additionalMaxNum) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Skill specialization %u has 0 max number of extra items in `skill_extra_item_template`!", spellId); + TC_LOG_ERROR("sql.sql", "Skill specialization %u has 0 max number of extra items in `skill_extra_item_template`!", spellId); continue; } @@ -109,7 +109,7 @@ void LoadSkillExtraItemTable() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell specialization definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u spell specialization definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } bool CanCreateExtraItems(Player* player, uint32 spellId, float &additionalChance, uint8 &additionalMax) diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 3309a8c010e..2a6d53089b9 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -802,7 +802,7 @@ void AuraEffect::UpdatePeriodic(Unit* caster) if (aurEff->GetAuraType() != SPELL_AURA_MOD_POWER_REGEN) { m_isPeriodic = false; - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Aura %d structure has been changed - first aura is no longer SPELL_AURA_MOD_POWER_REGEN", GetId()); + TC_LOG_ERROR("spells", "Aura %d structure has been changed - first aura is no longer SPELL_AURA_MOD_POWER_REGEN", GetId()); } else { @@ -1633,7 +1633,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo case FORM_SPIRITOFREDEMPTION: // 0x20 break; default: - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Auras: Unknown Shapeshift Type: %u", GetMiscValue()); + TC_LOG_ERROR("spells", "Auras: Unknown Shapeshift Type: %u", GetMiscValue()); } modelid = target->GetModelForForm(form); @@ -1993,7 +1993,7 @@ void AuraEffect::HandleAuraTransform(AuraApplication const* aurApp, uint8 mode, if (!ci) { target->SetDisplayId(16358); // pig pink ^_^ - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Auras: unknown creature id = %d (only need its modelid) From Spell Aura Transform in Spell ID = %d", GetMiscValue(), GetId()); + TC_LOG_ERROR("spells", "Auras: unknown creature id = %d (only need its modelid) From Spell Aura Transform in Spell ID = %d", GetMiscValue(), GetId()); } else { @@ -3564,7 +3564,7 @@ void AuraEffect::HandleAuraModStat(AuraApplication const* aurApp, uint8 mode, bo if (GetMiscValue() < -2 || GetMiscValue() > 4) { - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "WARNING: Spell %u effect %u has an unsupported misc value (%i) for SPELL_AURA_MOD_STAT ", GetId(), GetEffIndex(), GetMiscValue()); + TC_LOG_ERROR("spells", "WARNING: Spell %u effect %u has an unsupported misc value (%i) for SPELL_AURA_MOD_STAT ", GetId(), GetEffIndex(), GetMiscValue()); return; } @@ -3590,7 +3590,7 @@ void AuraEffect::HandleModPercentStat(AuraApplication const* aurApp, uint8 mode, if (GetMiscValue() < -1 || GetMiscValue() > 4) { - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid"); + TC_LOG_ERROR("spells", "WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid"); return; } @@ -3688,7 +3688,7 @@ void AuraEffect::HandleModTotalPercentStat(AuraApplication const* aurApp, uint8 if (GetMiscValue() < -1 || GetMiscValue() > 4) { - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid"); + TC_LOG_ERROR("spells", "WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid"); return; } @@ -3726,7 +3726,7 @@ void AuraEffect::HandleAuraModResistenceOfStatPercent(AuraApplication const* aur { // support required adding replace UpdateArmor by loop by UpdateResistence at intellect update // and include in UpdateResistence same code as in UpdateArmor for aura mod apply. - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Aura SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT(182) does not work for non-armor type resistances!"); + TC_LOG_ERROR("spells", "Aura SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT(182) does not work for non-armor type resistances!"); return; } @@ -5739,7 +5739,7 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster) if (Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo) ? caster : target) { triggerCaster->CastSpell(target, triggeredSpellInfo, true, NULL, this); - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "AuraEffect::HandlePeriodicTriggerSpellAuraTick: Spell %u Trigger %u", GetId(), triggeredSpellInfo->Id); + TC_LOG_DEBUG("spells", "AuraEffect::HandlePeriodicTriggerSpellAuraTick: Spell %u Trigger %u", GetId(), triggeredSpellInfo->Id); } } else @@ -5747,7 +5747,7 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster) Creature* c = target->ToCreature(); if (!c || !caster || !sScriptMgr->OnDummyEffect(caster, GetId(), SpellEffIndex(GetEffIndex()), target->ToCreature()) || !c->AI()->sOnDummyEffect(caster, GetId(), SpellEffIndex(GetEffIndex()))) - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "AuraEffect::HandlePeriodicTriggerSpellAuraTick: Spell %u has non-existent spell %u in EffectTriggered[%d] and is therefor not triggered.", GetId(), triggerSpellId, GetEffIndex()); + TC_LOG_DEBUG("spells", "AuraEffect::HandlePeriodicTriggerSpellAuraTick: Spell %u has non-existent spell %u in EffectTriggered[%d] and is therefor not triggered.", GetId(), triggerSpellId, GetEffIndex()); } } @@ -5760,11 +5760,11 @@ void AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick(Unit* target, Unit* { int32 basepoints = GetAmount(); triggerCaster->CastCustomSpell(target, triggerSpellId, &basepoints, &basepoints, &basepoints, true, 0, this); - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell %u Trigger %u", GetId(), triggeredSpellInfo->Id); + TC_LOG_DEBUG("spells", "AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell %u Trigger %u", GetId(), triggeredSpellInfo->Id); } } else - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS,"AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell %u has non-existent spell %u in EffectTriggered[%d] and is therefor not triggered.", GetId(), triggerSpellId, GetEffIndex()); + TC_LOG_DEBUG("spells","AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell %u has non-existent spell %u in EffectTriggered[%d] and is therefor not triggered.", GetId(), triggerSpellId, GetEffIndex()); } void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const @@ -5887,7 +5887,7 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const caster->CalcAbsorbResist(target, GetSpellInfo()->GetSchoolMask(), DOT, damage, &absorb, &resist, GetSpellInfo()); - TC_LOG_INFO(LOG_FILTER_SPELLS_AURAS, "PeriodicTick: %u (TypeId: %u) attacked %u (TypeId: %u) for %u dmg inflicted by %u abs is %u", + TC_LOG_INFO("spells", "PeriodicTick: %u (TypeId: %u) attacked %u (TypeId: %u) for %u dmg inflicted by %u abs is %u", GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), damage, GetId(), absorb); caster->DealDamageMods(target, damage, &absorb); @@ -5957,7 +5957,7 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) c if (target->GetHealth() < damage) damage = uint32(target->GetHealth()); - TC_LOG_INFO(LOG_FILTER_SPELLS_AURAS, "PeriodicTick: %u (TypeId: %u) health leech of %u (TypeId: %u) for %u dmg inflicted by %u abs is %u", + TC_LOG_INFO("spells", "PeriodicTick: %u (TypeId: %u) health leech of %u (TypeId: %u) for %u dmg inflicted by %u abs is %u", GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), damage, GetId(), absorb); caster->SendSpellNonMeleeDamageLog(target, GetId(), damage, GetSpellInfo()->GetSchoolMask(), absorb, resist, false, 0, crit); @@ -6003,7 +6003,7 @@ void AuraEffect::HandlePeriodicHealthFunnelAuraTick(Unit* target, Unit* caster) return; caster->ModifyHealth(-(int32)damage); - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "PeriodicTick: donator %u target %u damage %u.", caster->GetEntry(), target->GetEntry(), damage); + TC_LOG_DEBUG("spells", "PeriodicTick: donator %u target %u damage %u.", caster->GetEntry(), target->GetEntry(), damage); float gainMultiplier = GetSpellInfo()->Effects[GetEffIndex()].CalcValueMultiplier(caster); @@ -6089,7 +6089,7 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const if (crit) damage = caster->SpellCriticalHealingBonus(m_spellInfo, damage, target); - TC_LOG_INFO(LOG_FILTER_SPELLS_AURAS, "PeriodicTick: %u (TypeId: %u) heal of %u (TypeId: %u) for %u health inflicted by %u", + TC_LOG_INFO("spells", "PeriodicTick: %u (TypeId: %u) heal of %u (TypeId: %u) for %u health inflicted by %u", GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), damage, GetId()); uint32 absorb = 0; @@ -6158,7 +6158,7 @@ void AuraEffect::HandlePeriodicManaLeechAuraTick(Unit* target, Unit* caster) con drainAmount = maxmana; } - TC_LOG_INFO(LOG_FILTER_SPELLS_AURAS, "PeriodicTick: %u (TypeId: %u) power leech of %u (TypeId: %u) for %u dmg inflicted by %u", + TC_LOG_INFO("spells", "PeriodicTick: %u (TypeId: %u) power leech of %u (TypeId: %u) for %u dmg inflicted by %u", GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), drainAmount, GetId()); // resilience reduce mana draining effect at spell crit damage reduction (added in 2.4) @@ -6219,7 +6219,7 @@ void AuraEffect::HandleObsModPowerAuraTick(Unit* target, Unit* caster) const // ignore negative values (can be result apply spellmods to aura damage uint32 amount = std::max(m_amount, 0) * target->GetMaxPower(powerType) /100; - TC_LOG_INFO(LOG_FILTER_SPELLS_AURAS, "PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u", + TC_LOG_INFO("spells", "PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u", GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), amount, GetId()); SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f, false); @@ -6254,7 +6254,7 @@ void AuraEffect::HandlePeriodicEnergizeAuraTick(Unit* target, Unit* caster) cons SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f, false); target->SendPeriodicAuraLog(&pInfo); - TC_LOG_INFO(LOG_FILTER_SPELLS_AURAS, "PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u", + TC_LOG_INFO("spells", "PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u", GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), amount, GetId()); int32 gain = target->ModifyPower(powerType, amount); @@ -6317,11 +6317,11 @@ void AuraEffect::HandleProcTriggerSpellAuraProc(AuraApplication* aurApp, ProcEve uint32 triggerSpellId = GetSpellInfo()->Effects[GetEffIndex()].TriggerSpell; if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId)) { - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "AuraEffect::HandleProcTriggerSpellAuraProc: Triggering spell %u from aura %u proc", triggeredSpellInfo->Id, GetId()); + TC_LOG_DEBUG("spells", "AuraEffect::HandleProcTriggerSpellAuraProc: Triggering spell %u from aura %u proc", triggeredSpellInfo->Id, GetId()); triggerCaster->CastSpell(triggerTarget, triggeredSpellInfo, true, NULL, this); } else - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS,"AuraEffect::HandleProcTriggerSpellAuraProc: Could not trigger spell %u from aura %u proc, because the spell does not have an entry in Spell.dbc.", triggerSpellId, GetId()); + TC_LOG_DEBUG("spells","AuraEffect::HandleProcTriggerSpellAuraProc: Could not trigger spell %u from aura %u proc, because the spell does not have an entry in Spell.dbc.", triggerSpellId, GetId()); } void AuraEffect::HandleProcTriggerSpellWithValueAuraProc(AuraApplication* aurApp, ProcEventInfo& eventInfo) @@ -6333,11 +6333,11 @@ void AuraEffect::HandleProcTriggerSpellWithValueAuraProc(AuraApplication* aurApp if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId)) { int32 basepoints0 = GetAmount(); - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "AuraEffect::HandleProcTriggerSpellWithValueAuraProc: Triggering spell %u with value %d from aura %u proc", triggeredSpellInfo->Id, basepoints0, GetId()); + TC_LOG_DEBUG("spells", "AuraEffect::HandleProcTriggerSpellWithValueAuraProc: Triggering spell %u with value %d from aura %u proc", triggeredSpellInfo->Id, basepoints0, GetId()); triggerCaster->CastCustomSpell(triggerTarget, triggerSpellId, &basepoints0, NULL, NULL, true, NULL, this); } else - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS,"AuraEffect::HandleProcTriggerSpellWithValueAuraProc: Could not trigger spell %u from aura %u proc, because the spell does not have an entry in Spell.dbc.", triggerSpellId, GetId()); + TC_LOG_DEBUG("spells","AuraEffect::HandleProcTriggerSpellWithValueAuraProc: Could not trigger spell %u from aura %u proc, because the spell does not have an entry in Spell.dbc.", triggerSpellId, GetId()); } void AuraEffect::HandleProcTriggerDamageAuraProc(AuraApplication* aurApp, ProcEventInfo& eventInfo) @@ -6350,7 +6350,7 @@ void AuraEffect::HandleProcTriggerDamageAuraProc(AuraApplication* aurApp, ProcEv target->CalculateSpellDamageTaken(&damageInfo, damage, GetSpellInfo()); target->DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb); target->SendSpellNonMeleeDamageLog(&damageInfo); - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "AuraEffect::HandleProcTriggerDamageAuraProc: Triggering %u spell damage from aura %u proc", damage, GetId()); + TC_LOG_DEBUG("spells", "AuraEffect::HandleProcTriggerDamageAuraProc: Triggering %u spell damage from aura %u proc", damage, GetId()); target->DealSpellDamage(&damageInfo, true); } @@ -6372,7 +6372,7 @@ void AuraEffect::HandleRaidProcFromChargeAuraProc(AuraApplication* aurApp, ProcE triggerSpellId = 43594; break; default: - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "AuraEffect::HandleRaidProcFromChargeAuraProc: received not handled spell: %u", GetId()); + TC_LOG_DEBUG("spells", "AuraEffect::HandleRaidProcFromChargeAuraProc: received not handled spell: %u", GetId()); return; } @@ -6398,7 +6398,7 @@ void AuraEffect::HandleRaidProcFromChargeAuraProc(AuraApplication* aurApp, ProcE } } - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "AuraEffect::HandleRaidProcFromChargeAuraProc: Triggering spell %u from aura %u proc", triggerSpellId, GetId()); + TC_LOG_DEBUG("spells", "AuraEffect::HandleRaidProcFromChargeAuraProc: Triggering spell %u from aura %u proc", triggerSpellId, GetId()); target->CastSpell(target, triggerSpellId, true, NULL, this, GetCasterGUID()); } @@ -6410,7 +6410,7 @@ void AuraEffect::HandleRaidProcFromChargeWithValueAuraProc(AuraApplication* aurA // Currently only Prayer of Mending if (!(GetSpellInfo()->SpellFamilyName == SPELLFAMILY_PRIEST && GetSpellInfo()->SpellFamilyFlags[1] & 0x20)) { - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "AuraEffect::HandleRaidProcFromChargeWithValueAuraProc: received not handled spell: %u", GetId()); + TC_LOG_DEBUG("spells", "AuraEffect::HandleRaidProcFromChargeWithValueAuraProc: received not handled spell: %u", GetId()); return; } uint32 triggerSpellId = 33110; @@ -6439,6 +6439,6 @@ void AuraEffect::HandleRaidProcFromChargeWithValueAuraProc(AuraApplication* aurA } } - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "AuraEffect::HandleRaidProcFromChargeWithValueAuraProc: Triggering spell %u from aura %u proc", triggerSpellId, GetId()); + TC_LOG_DEBUG("spells", "AuraEffect::HandleRaidProcFromChargeWithValueAuraProc: Triggering spell %u from aura %u proc", triggerSpellId, GetId()); target->CastCustomSpell(target, triggerSpellId, &value, NULL, NULL, true, NULL, this, GetCasterGUID()); } diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 4b6423503c1..70769b50b29 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -73,10 +73,10 @@ _flags(AFLAG_NONE), _effectsToApply(effMask), _needClientUpdate(false) _slot = slot; GetTarget()->SetVisibleAura(slot, this); SetNeedClientUpdate(); - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Aura: %u Effect: %d put to unit visible auras slot: %u", GetBase()->GetId(), GetEffectMask(), slot); + TC_LOG_DEBUG("spells", "Aura: %u Effect: %d put to unit visible auras slot: %u", GetBase()->GetId(), GetEffectMask(), slot); } else - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Aura: %u Effect: %d could not find empty unit visible slot", GetBase()->GetId(), GetEffectMask()); + TC_LOG_DEBUG("spells", "Aura: %u Effect: %d could not find empty unit visible slot", GetBase()->GetId(), GetEffectMask()); } _InitFlags(caster, effMask); @@ -155,7 +155,7 @@ void AuraApplication::_HandleEffect(uint8 effIndex, bool apply) ASSERT(aurEff); ASSERT(HasEffect(effIndex) == (!apply)); ASSERT((1<<effIndex) & _effectsToApply); - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "AuraApplication::_HandleEffect: %u, apply: %u: amount: %u", aurEff->GetAuraType(), apply, aurEff->GetAmount()); + TC_LOG_DEBUG("spells", "AuraApplication::_HandleEffect: %u, apply: %u: amount: %u", aurEff->GetAuraType(), apply, aurEff->GetAmount()); if (apply) { @@ -344,6 +344,7 @@ m_isRemoved(false), m_isSingleTarget(false), m_isUsingCharges(false) m_duration = m_maxDuration; m_procCharges = CalcMaxCharges(caster); m_isUsingCharges = m_procCharges != 0; + memset(m_effects, 0, sizeof(m_effects)); // m_casterLevel = cast item level/caster level, caster level should be saved to db, confirmed with sniffs } @@ -432,7 +433,7 @@ void Aura::_UnapplyForTarget(Unit* target, Unit* caster, AuraApplication * auraA /// @todo Figure out why this happens if (itr == m_applications.end()) { - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Aura::_UnapplyForTarget, target:%u, caster:%u, spell:%u was not found in owners application map!", + TC_LOG_ERROR("spells", "Aura::_UnapplyForTarget, target:%u, caster:%u, spell:%u was not found in owners application map!", target->GetGUIDLow(), caster ? caster->GetGUIDLow() : 0, auraApp->GetBase()->GetSpellInfo()->Id); ASSERT(false); } @@ -574,7 +575,7 @@ void Aura::UpdateTargetMap(Unit* caster, bool apply) if (!GetOwner()->IsSelfOrInSameMap(itr->first)) { /// @todo There is a crash caused by shadowfiend load addon - TC_LOG_FATAL(LOG_FILTER_SPELLS_AURAS, "Aura %u: Owner %s (map %u) is not in the same map as target %s (map %u).", GetSpellInfo()->Id, + TC_LOG_FATAL("spells", "Aura %u: Owner %s (map %u) is not in the same map as target %s (map %u).", GetSpellInfo()->Id, GetOwner()->GetName().c_str(), GetOwner()->IsInWorld() ? GetOwner()->GetMap()->GetId() : uint32(-1), itr->first->GetName().c_str(), itr->first->IsInWorld() ? itr->first->GetMap()->GetId() : uint32(-1)); ASSERT(false); @@ -1225,7 +1226,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b case 31571: spellId = 57529; break; case 31572: spellId = 57531; break; default: - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Aura::HandleAuraSpecificMods: Unknown rank of Arcane Potency (%d) found", aurEff->GetId()); + TC_LOG_ERROR("spells", "Aura::HandleAuraSpecificMods: Unknown rank of Arcane Potency (%d) found", aurEff->GetId()); } if (spellId) caster->CastSpell(caster, spellId, true); @@ -1321,7 +1322,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b case 49631: spellId = 50509; break; case 49032: spellId = 50508; break; default: - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Aura::HandleAuraSpecificMods: Unknown rank of Crypt Fever/Ebon Plague (%d) found", aurEff->GetId()); + TC_LOG_ERROR("spells", "Aura::HandleAuraSpecificMods: Unknown rank of Crypt Fever/Ebon Plague (%d) found", aurEff->GetId()); } caster->CastSpell(target, spellId, true, 0, GetEffect(0)); } @@ -1428,7 +1429,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b case 53759: spellId = 60947; break; case 53754: spellId = 60946; break; default: - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Aura::HandleAuraSpecificMods: Unknown rank of Improved Fear (%d) found", aurEff->GetId()); + TC_LOG_ERROR("spells", "Aura::HandleAuraSpecificMods: Unknown rank of Improved Fear (%d) found", aurEff->GetId()); } if (spellId) caster->CastSpell(target, spellId, true); @@ -1969,7 +1970,7 @@ void Aura::LoadScripts() m_loadedScripts.erase(bitr); continue; } - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Aura::LoadScripts: Script `%s` for aura `%u` is loaded now", (*itr)->_GetScriptName()->c_str(), m_spellInfo->Id); + TC_LOG_DEBUG("spells", "Aura::LoadScripts: Script `%s` for aura `%u` is loaded now", (*itr)->_GetScriptName()->c_str(), m_spellInfo->Id); (*itr)->Register(); ++itr; } diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 94c0c54e065..b4353f3a620 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -70,12 +70,14 @@ SpellDestination::SpellDestination(float x, float y, float z, float orientation, _position.Relocate(x, y, z, orientation); _transportGUID = 0; _position.m_mapId = mapId; + _transportOffset.Relocate(0, 0, 0, 0); } SpellDestination::SpellDestination(Position const& pos) { _position.Relocate(pos); _transportGUID = 0; + _transportOffset.Relocate(0, 0, 0, 0); } SpellDestination::SpellDestination(WorldObject const& wObj) @@ -457,23 +459,23 @@ void SpellCastTargets::Update(Unit* caster) void SpellCastTargets::OutDebug() const { if (!m_targetMask) - TC_LOG_INFO(LOG_FILTER_SPELLS_AURAS, "No targets"); + TC_LOG_INFO("spells", "No targets"); - TC_LOG_INFO(LOG_FILTER_SPELLS_AURAS, "target mask: %u", m_targetMask); + TC_LOG_INFO("spells", "target mask: %u", m_targetMask); if (m_targetMask & (TARGET_FLAG_UNIT_MASK | TARGET_FLAG_CORPSE_MASK | TARGET_FLAG_GAMEOBJECT_MASK)) - TC_LOG_INFO(LOG_FILTER_SPELLS_AURAS, "Object target: " UI64FMTD, m_objectTargetGUID); + TC_LOG_INFO("spells", "Object target: " UI64FMTD, m_objectTargetGUID); if (m_targetMask & TARGET_FLAG_ITEM) - TC_LOG_INFO(LOG_FILTER_SPELLS_AURAS, "Item target: " UI64FMTD, m_itemTargetGUID); + TC_LOG_INFO("spells", "Item target: " UI64FMTD, m_itemTargetGUID); if (m_targetMask & TARGET_FLAG_TRADE_ITEM) - TC_LOG_INFO(LOG_FILTER_SPELLS_AURAS, "Trade item target: " UI64FMTD, m_itemTargetGUID); + TC_LOG_INFO("spells", "Trade item target: " UI64FMTD, m_itemTargetGUID); if (m_targetMask & TARGET_FLAG_SOURCE_LOCATION) - TC_LOG_INFO(LOG_FILTER_SPELLS_AURAS, "Source location: transport guid:" UI64FMTD " trans offset: %s position: %s", m_src._transportGUID, m_src._transportOffset.ToString().c_str(), m_src._position.ToString().c_str()); + TC_LOG_INFO("spells", "Source location: transport guid:" UI64FMTD " trans offset: %s position: %s", m_src._transportGUID, m_src._transportOffset.ToString().c_str(), m_src._position.ToString().c_str()); if (m_targetMask & TARGET_FLAG_DEST_LOCATION) - TC_LOG_INFO(LOG_FILTER_SPELLS_AURAS, "Destination location: transport guid:" UI64FMTD " trans offset: %s position: %s", m_dst._transportGUID, m_dst._transportOffset.ToString().c_str(), m_dst._position.ToString().c_str()); + TC_LOG_INFO("spells", "Destination location: transport guid:" UI64FMTD " trans offset: %s position: %s", m_dst._transportGUID, m_dst._transportOffset.ToString().c_str(), m_dst._position.ToString().c_str()); if (m_targetMask & TARGET_FLAG_STRING) - TC_LOG_INFO(LOG_FILTER_SPELLS_AURAS, "String: %s", m_strTarget.c_str()); - TC_LOG_INFO(LOG_FILTER_SPELLS_AURAS, "speed: %f", m_speed); - TC_LOG_INFO(LOG_FILTER_SPELLS_AURAS, "elevation: %f", m_elevation); + TC_LOG_INFO("spells", "String: %s", m_strTarget.c_str()); + TC_LOG_INFO("spells", "speed: %f", m_speed); + TC_LOG_INFO("spells", "elevation: %f", m_elevation); } SpellValue::SpellValue(SpellInfo const* proto) @@ -502,6 +504,7 @@ m_caster((info->AttributesEx6 & SPELL_ATTR6_CAST_BY_CHARMER && caster->GetCharme m_applyMultiplierMask = 0; m_auraScaleMask = 0; + memset(m_damageMultipliers, 0, sizeof(m_damageMultipliers)); // Get data for type of attack switch (m_spellInfo->DmgClass) @@ -557,6 +560,16 @@ m_caster((info->AttributesEx6 & SPELL_ATTR6_CAST_BY_CHARMER && caster->GetCharme unitTarget = NULL; itemTarget = NULL; gameObjTarget = NULL; + destTarget = NULL; + damage = 0; + effectHandleMode = SPELL_EFFECT_HANDLE_LAUNCH; + m_diminishLevel = DIMINISHING_LEVEL_1; + m_diminishGroup = DIMINISHING_NONE; + m_damage = 0; + m_healing = 0; + m_procAttacker = 0; + m_procVictim = 0; + m_procEx = 0; focusObject = NULL; m_cast_count = 0; m_glyphIndex = 0; @@ -572,6 +585,8 @@ m_caster((info->AttributesEx6 & SPELL_ATTR6_CAST_BY_CHARMER && caster->GetCharme m_casttime = 0; // setup to correct value in Spell::prepare, must not be used before. m_timer = 0; // will set to castime in prepare + m_immediateHandled = false; + m_channelTargetEffectMask = 0; // Determine if spell can be reflected back to the caster @@ -602,7 +617,7 @@ Spell::~Spell() { // Clean the reference to avoid later crash. // If this error is repeating, we may have to add an ASSERT to better track down how we get into this case. - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "SPELL: deleting spell for spell ID %u. However, spell still referenced.", m_spellInfo->Id); + TC_LOG_ERROR("spells", "SPELL: deleting spell for spell ID %u. However, spell still referenced.", m_spellInfo->Id); *m_selfContainer = NULL; } @@ -896,7 +911,7 @@ void Spell::SelectEffectImplicitTargets(SpellEffIndex effIndex, SpellImplicitTar } break; case TARGET_SELECT_CATEGORY_NYI: - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "SPELL: target type %u, found in spellID %u, effect %u is not implemented yet!", m_spellInfo->Id, effIndex, targetType.GetTarget()); + TC_LOG_DEBUG("spells", "SPELL: target type %u, found in spellID %u, effect %u is not implemented yet!", m_spellInfo->Id, effIndex, targetType.GetTarget()); break; default: ASSERT(false && "Spell::SelectEffectImplicitTargets: received not implemented select target category"); @@ -915,7 +930,7 @@ void Spell::SelectImplicitChannelTargets(SpellEffIndex effIndex, SpellImplicitTa Spell* channeledSpell = m_originalCaster->GetCurrentSpell(CURRENT_CHANNELED_SPELL); if (!channeledSpell) { - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Spell::SelectImplicitChannelTargets: cannot find channel spell for spell ID %u, effect %u", m_spellInfo->Id, effIndex); + TC_LOG_DEBUG("spells", "Spell::SelectImplicitChannelTargets: cannot find channel spell for spell ID %u, effect %u", m_spellInfo->Id, effIndex); return; } switch (targetType.GetTarget()) @@ -928,7 +943,7 @@ void Spell::SelectImplicitChannelTargets(SpellEffIndex effIndex, SpellImplicitTa if (target && target->ToUnit()) AddUnitTarget(target->ToUnit(), 1 << effIndex); else - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "SPELL: cannot find channel spell target for spell ID %u, effect %u", m_spellInfo->Id, effIndex); + TC_LOG_DEBUG("spells", "SPELL: cannot find channel spell target for spell ID %u, effect %u", m_spellInfo->Id, effIndex); break; } case TARGET_DEST_CHANNEL_TARGET: @@ -941,7 +956,7 @@ void Spell::SelectImplicitChannelTargets(SpellEffIndex effIndex, SpellImplicitTa m_targets.SetDst(*target); } else - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "SPELL: cannot find channel spell destination for spell ID %u, effect %u", m_spellInfo->Id, effIndex); + TC_LOG_DEBUG("spells", "SPELL: cannot find channel spell destination for spell ID %u, effect %u", m_spellInfo->Id, effIndex); break; case TARGET_DEST_CHANNEL_CASTER: m_targets.SetDst(*channeledSpell->GetCaster()); @@ -986,7 +1001,7 @@ void Spell::SelectImplicitNearbyTargets(SpellEffIndex effIndex, SpellImplicitTar // handle emergency case - try to use other provided targets if no conditions provided if (targetType.GetCheckType() == TARGET_CHECK_ENTRY && (!condList || condList->empty())) { - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Spell::SelectImplicitNearbyTargets: no conditions entry for target with TARGET_CHECK_ENTRY of spell ID %u, effect %u - selecting default targets", m_spellInfo->Id, effIndex); + TC_LOG_DEBUG("spells", "Spell::SelectImplicitNearbyTargets: no conditions entry for target with TARGET_CHECK_ENTRY of spell ID %u, effect %u - selecting default targets", m_spellInfo->Id, effIndex); switch (targetType.GetObjectType()) { case TARGET_OBJECT_TYPE_GOBJ: @@ -1013,7 +1028,7 @@ void Spell::SelectImplicitNearbyTargets(SpellEffIndex effIndex, SpellImplicitTar WorldObject* target = SearchNearbyTarget(range, targetType.GetObjectType(), targetType.GetCheckType(), condList); if (!target) { - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Spell::SelectImplicitNearbyTargets: cannot find nearby target for spell ID %u, effect %u", m_spellInfo->Id, effIndex); + TC_LOG_DEBUG("spells", "Spell::SelectImplicitNearbyTargets: cannot find nearby target for spell ID %u, effect %u", m_spellInfo->Id, effIndex); return; } @@ -1400,7 +1415,7 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplici } else { - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "SPELL: unknown target coordinates for spell ID %u", m_spellInfo->Id); + TC_LOG_DEBUG("spells", "SPELL: unknown target coordinates for spell ID %u", m_spellInfo->Id); WorldObject* target = m_targets.GetObjectTarget(); m_targets.SetDst(target ? *target : *m_caster); } @@ -1658,7 +1673,7 @@ void Spell::SelectImplicitTrajTargets() float a = (srcToDestDelta - dist2d * b) / (dist2d * dist2d); if (a > -0.0001f) a = 0; - DEBUG_TRAJ(TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Spell::SelectTrajTargets: a %f b %f", a, b);) + DEBUG_TRAJ(TC_LOG_ERROR("spells", "Spell::SelectTrajTargets: a %f b %f", a, b);) float bestDist = m_spellInfo->GetMaxRange(false); @@ -1674,11 +1689,11 @@ void Spell::SelectImplicitTrajTargets() const float objDist2d = m_targets.GetSrcPos()->GetExactDist2d(*itr) * std::cos(m_targets.GetSrcPos()->GetRelativeAngle(*itr)); const float dz = (*itr)->GetPositionZ() - m_targets.GetSrcPos()->m_positionZ; - DEBUG_TRAJ(TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Spell::SelectTrajTargets: check %u, dist between %f %f, height between %f %f.", (*itr)->GetEntry(), objDist2d - size, objDist2d + size, dz - size, dz + size);) + DEBUG_TRAJ(TC_LOG_ERROR("spells", "Spell::SelectTrajTargets: check %u, dist between %f %f, height between %f %f.", (*itr)->GetEntry(), objDist2d - size, objDist2d + size, dz - size, dz + size);) float dist = objDist2d - size; float height = dist * (a * dist + b); - DEBUG_TRAJ(TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Spell::SelectTrajTargets: dist %f, height %f.", dist, height);) + DEBUG_TRAJ(TC_LOG_ERROR("spells", "Spell::SelectTrajTargets: dist %f, height %f.", dist, height);) if (dist < bestDist && height < dz + size && height > dz - size) { bestDist = dist > 0 ? dist : 0; @@ -1686,7 +1701,7 @@ void Spell::SelectImplicitTrajTargets() } #define CHECK_DIST {\ - DEBUG_TRAJ(TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Spell::SelectTrajTargets: dist %f, height %f.", dist, height);)\ + DEBUG_TRAJ(TC_LOG_ERROR("spells", "Spell::SelectTrajTargets: dist %f, height %f.", dist, height);)\ if (dist > bestDist)\ continue;\ if (dist < objDist2d + size && dist > objDist2d - size)\ @@ -1748,7 +1763,7 @@ void Spell::SelectImplicitTrajTargets() float distSq = (*itr)->GetExactDistSq(x, y, z); float sizeSq = (*itr)->GetObjectSize(); sizeSq *= sizeSq; - DEBUG_TRAJ(TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Initial %f %f %f %f %f", x, y, z, distSq, sizeSq);) + DEBUG_TRAJ(TC_LOG_ERROR("spells", "Initial %f %f %f %f %f", x, y, z, distSq, sizeSq);) if (distSq > sizeSq) { float factor = 1 - sqrt(sizeSq / distSq); @@ -1757,7 +1772,7 @@ void Spell::SelectImplicitTrajTargets() z += factor * ((*itr)->GetPositionZ() - z); distSq = (*itr)->GetExactDistSq(x, y, z); - DEBUG_TRAJ(TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Initial %f %f %f %f %f", x, y, z, distSq, sizeSq);) + DEBUG_TRAJ(TC_LOG_ERROR("spells", "Initial %f %f %f %f %f", x, y, z, distSq, sizeSq);) } } @@ -2817,7 +2832,7 @@ void Spell::DoTriggersOnSpellHit(Unit* unit, uint8 effMask) if (CanExecuteTriggersOnHit(effMask, i->triggeredByAura) && roll_chance_i(i->chance)) { m_caster->CastSpell(unit, i->triggeredSpell, true); - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Spell %d triggered spell %d by SPELL_AURA_ADD_TARGET_TRIGGER aura", m_spellInfo->Id, i->triggeredSpell->Id); + TC_LOG_DEBUG("spells", "Spell %d triggered spell %d by SPELL_AURA_ADD_TARGET_TRIGGER aura", m_spellInfo->Id, i->triggeredSpell->Id); // SPELL_AURA_ADD_TARGET_TRIGGER auras shouldn't trigger auras without duration // set duration of current aura to the triggered spell @@ -3067,7 +3082,7 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggered // set timer base at cast time ReSetTimer(); - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Spell::prepare: spell id %u source %u caster %d customCastFlags %u mask %u", m_spellInfo->Id, m_caster->GetEntry(), m_originalCaster ? m_originalCaster->GetEntry() : -1, _triggeredCastFlags, m_targets.GetTargetMask()); + TC_LOG_DEBUG("spells", "Spell::prepare: spell id %u source %u caster %d customCastFlags %u mask %u", m_spellInfo->Id, m_caster->GetEntry(), m_originalCaster ? m_originalCaster->GetEntry() : -1, _triggeredCastFlags, m_targets.GetTargetMask()); //Containers for channeled spells have to be set /// @todoApply this to all casted spells if needed @@ -3571,7 +3586,7 @@ void Spell::update(uint32 difftime) if (m_targets.GetUnitTargetGUID() && !m_targets.GetUnitTarget()) { - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Spell %u is cancelled due to removal of target.", m_spellInfo->Id); + TC_LOG_DEBUG("spells", "Spell %u is cancelled due to removal of target.", m_spellInfo->Id); cancel(); return; } @@ -3610,7 +3625,7 @@ void Spell::update(uint32 difftime) // check if there are alive targets left if (!UpdateChanneledTargetList()) { - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Channeled spell %d is removed due to lack of targets", m_spellInfo->Id); + TC_LOG_DEBUG("spells", "Channeled spell %d is removed due to lack of targets", m_spellInfo->Id); SendChannelUpdate(0); finish(); } @@ -3674,7 +3689,7 @@ void Spell::finish(bool ok) SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell); if (spellInfo && spellInfo->SpellIconID == 2056) { - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Statue %d is unsummoned in spell %d finish", m_caster->GetGUIDLow(), m_spellInfo->Id); + TC_LOG_DEBUG("spells", "Statue %d is unsummoned in spell %d finish", m_caster->GetGUIDLow(), m_spellInfo->Id); m_caster->setDeathState(JUST_DIED); return; } @@ -3876,7 +3891,7 @@ void Spell::SendSpellStart() if (!IsNeedSendToClient()) return; - //TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Sending SMSG_SPELL_START id=%u", m_spellInfo->Id); + //TC_LOG_DEBUG("spells", "Sending SMSG_SPELL_START id=%u", m_spellInfo->Id); uint32 castFlags = CAST_FLAG_UNKNOWN_2; @@ -3928,7 +3943,7 @@ void Spell::SendSpellGo() if (!IsNeedSendToClient()) return; - //TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Sending SMSG_SPELL_GO id=%u", m_spellInfo->Id); + //TC_LOG_DEBUG("spells", "Sending SMSG_SPELL_GO id=%u", m_spellInfo->Id); uint32 castFlags = CAST_FLAG_UNKNOWN_9; @@ -4353,7 +4368,7 @@ void Spell::TakeCastItem() { // This code is to avoid a crash // I'm not sure, if this is really an error, but I guess every item needs a prototype - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Cast item has no item prototype highId=%d, lowId=%d", m_CastItem->GetGUIDHigh(), m_CastItem->GetGUIDLow()); + TC_LOG_ERROR("spells", "Cast item has no item prototype highId=%d, lowId=%d", m_CastItem->GetGUIDHigh(), m_CastItem->GetGUIDLow()); return; } @@ -4450,7 +4465,7 @@ void Spell::TakePower() if (powerType >= MAX_POWERS) { - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Spell::TakePower: Unknown power type '%d'", powerType); + TC_LOG_ERROR("spells", "Spell::TakePower: Unknown power type '%d'", powerType); return; } @@ -4699,7 +4714,7 @@ void Spell::HandleThreatSpells() target->AddThreat(m_caster, threat, m_spellInfo->GetSchoolMask(), m_spellInfo); } } - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Spell %u, added an additional %f threat for %s %u target(s)", m_spellInfo->Id, threat, m_spellInfo->_IsPositiveSpell() ? "assisting" : "harming", uint32(m_UniqueTargetInfo.size())); + TC_LOG_DEBUG("spells", "Spell %u, added an additional %f threat for %s %u target(s)", m_spellInfo->Id, threat, m_spellInfo->_IsPositiveSpell() ? "assisting" : "harming", uint32(m_UniqueTargetInfo.size())); } void Spell::HandleEffects(Unit* pUnitTarget, Item* pItemTarget, GameObject* pGOTarget, uint32 i, SpellEffectHandleMode mode) @@ -4712,7 +4727,7 @@ void Spell::HandleEffects(Unit* pUnitTarget, Item* pItemTarget, GameObject* pGOT uint8 eff = m_spellInfo->Effects[i].Effect; - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Spell: %u Effect : %u", m_spellInfo->Id, eff); + TC_LOG_DEBUG("spells", "Spell: %u Effect : %u", m_spellInfo->Id, eff); // we do not need DamageMultiplier here. damage = CalculateDamage(i, NULL); @@ -5836,7 +5851,7 @@ SpellCastResult Spell::CheckPower() // Check valid power type if (m_spellInfo->PowerType >= MAX_POWERS) { - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Spell::CheckPower: Unknown power type '%d'", m_spellInfo->PowerType); + TC_LOG_ERROR("spells", "Spell::CheckPower: Unknown power type '%d'", m_spellInfo->PowerType); return SPELL_FAILED_UNKNOWN; } @@ -6377,7 +6392,7 @@ void Spell::Delayed() // only called in DealDamage() else m_timer += delaytime; - TC_LOG_INFO(LOG_FILTER_SPELLS_AURAS, "Spell %u partially interrupted for (%d) ms at damage", m_spellInfo->Id, delaytime); + TC_LOG_INFO("spells", "Spell %u partially interrupted for (%d) ms at damage", m_spellInfo->Id, delaytime); WorldPacket data(SMSG_SPELL_DELAYED, 8+4); data.append(m_caster->GetPackGUID()); @@ -6412,7 +6427,7 @@ void Spell::DelayedChannel() else m_timer -= delaytime; - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Spell %u partially interrupted for %i ms, new duration: %u ms", m_spellInfo->Id, delaytime, m_timer); + TC_LOG_DEBUG("spells", "Spell %u partially interrupted for %i ms, new duration: %u ms", m_spellInfo->Id, delaytime, m_timer); for (std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) if ((*ihit).missCondition == SPELL_MISS_NONE) @@ -6593,7 +6608,7 @@ SpellEvent::~SpellEvent() } else { - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "~SpellEvent: %s %u tried to delete non-deletable spell %u. Was not deleted, causes memory leak.", + TC_LOG_ERROR("spells", "~SpellEvent: %s %u tried to delete non-deletable spell %u. Was not deleted, causes memory leak.", (m_Spell->GetCaster()->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), m_Spell->GetCaster()->GetGUIDLow(), m_Spell->m_spellInfo->Id); ASSERT(false); } @@ -6952,7 +6967,7 @@ void Spell::LoadScripts() m_loadedScripts.erase(bitr); continue; } - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Spell::LoadScripts: Script `%s` for spell `%u` is loaded now", (*itr)->_GetScriptName()->c_str(), m_spellInfo->Id); + TC_LOG_DEBUG("spells", "Spell::LoadScripts: Script `%s` for spell `%u` is loaded now", (*itr)->_GetScriptName()->c_str(), m_spellInfo->Id); (*itr)->Register(); ++itr; } diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index e580a3d0f2d..6e2bc0c76e1 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -235,7 +235,7 @@ pEffect SpellEffects[TOTAL_SPELL_EFFECTS]= void Spell::EffectNULL(SpellEffIndex /*effIndex*/) { - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "WORLD: Spell Effect DUMMY"); + TC_LOG_DEBUG("spells", "WORLD: Spell Effect DUMMY"); } void Spell::EffectUnused(SpellEffIndex /*effIndex*/) @@ -767,7 +767,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex) if (!spellInfo) { - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "EffectDummy of spell %u: triggering unknown spell id %i\n", m_spellInfo->Id, spell_id); + TC_LOG_ERROR("spells", "EffectDummy of spell %u: triggering unknown spell id %i\n", m_spellInfo->Id, spell_id); return; } @@ -785,7 +785,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex) } // normal DB scripted effect - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Spell ScriptStart spellid %u in EffectDummy(%u)", m_spellInfo->Id, effIndex); + TC_LOG_DEBUG("spells", "Spell ScriptStart spellid %u in EffectDummy(%u)", m_spellInfo->Id, effIndex); m_caster->GetMap()->ScriptsStart(sSpellScripts, uint32(m_spellInfo->Id | (effIndex << 24)), m_caster, unitTarget); // Script based implementation. Must be used only for not good for implementation in core spell effects @@ -910,7 +910,7 @@ void Spell::EffectTriggerSpell(SpellEffIndex effIndex) SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(triggered_spell_id); if (!spellInfo) { - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Spell::EffectTriggerSpell spell %u tried to trigger unknown spell %u", m_spellInfo->Id, triggered_spell_id); + TC_LOG_DEBUG("spells", "Spell::EffectTriggerSpell spell %u tried to trigger unknown spell %u", m_spellInfo->Id, triggered_spell_id); return; } @@ -962,7 +962,7 @@ void Spell::EffectTriggerMissileSpell(SpellEffIndex effIndex) SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(triggered_spell_id); if (!spellInfo) { - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Spell::EffectTriggerMissileSpell spell %u tried to trigger unknown spell %u", m_spellInfo->Id, triggered_spell_id); + TC_LOG_DEBUG("spells", "Spell::EffectTriggerMissileSpell spell %u tried to trigger unknown spell %u", m_spellInfo->Id, triggered_spell_id); return; } @@ -1018,7 +1018,7 @@ void Spell::EffectForceCast(SpellEffIndex effIndex) if (!spellInfo) { - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Spell::EffectForceCast of spell %u: triggering unknown spell id %i", m_spellInfo->Id, triggered_spell_id); + TC_LOG_ERROR("spells", "Spell::EffectForceCast of spell %u: triggering unknown spell id %i", m_spellInfo->Id, triggered_spell_id); return; } @@ -1066,7 +1066,7 @@ void Spell::EffectTriggerRitualOfSummoning(SpellEffIndex effIndex) if (!spellInfo) { - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "EffectTriggerRitualOfSummoning of spell %u: triggering unknown spell id %i", m_spellInfo->Id, triggered_spell_id); + TC_LOG_ERROR("spells", "EffectTriggerRitualOfSummoning of spell %u: triggering unknown spell id %i", m_spellInfo->Id, triggered_spell_id); return; } @@ -1136,7 +1136,7 @@ void Spell::EffectTeleportUnits(SpellEffIndex /*effIndex*/) // If not exist data for dest location - return if (!m_targets.HasDst()) { - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Spell::EffectTeleportUnits - does not have destination for spellId %u.", m_spellInfo->Id); + TC_LOG_ERROR("spells", "Spell::EffectTeleportUnits - does not have destination for spellId %u.", m_spellInfo->Id); return; } @@ -1148,7 +1148,7 @@ void Spell::EffectTeleportUnits(SpellEffIndex /*effIndex*/) destTarget->GetPosition(x, y, z, orientation); if (!orientation && m_targets.GetUnitTarget()) orientation = m_targets.GetUnitTarget()->GetOrientation(); - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Spell::EffectTeleportUnits - teleport unit to %u %f %f %f %f\n", mapid, x, y, z, orientation); + TC_LOG_DEBUG("spells", "Spell::EffectTeleportUnits - teleport unit to %u %f %f %f %f\n", mapid, x, y, z, orientation); if (unitTarget->GetTypeId() == TYPEID_PLAYER) unitTarget->ToPlayer()->TeleportTo(mapid, x, y, z, orientation, unitTarget == m_caster ? TELE_TO_SPELL : 0); @@ -1156,7 +1156,7 @@ void Spell::EffectTeleportUnits(SpellEffIndex /*effIndex*/) unitTarget->NearTeleportTo(x, y, z, orientation, unitTarget == m_caster); else { - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Spell::EffectTeleportUnits - spellId %u attempted to teleport creature to a different map.", m_spellInfo->Id); + TC_LOG_ERROR("spells", "Spell::EffectTeleportUnits - spellId %u attempted to teleport creature to a different map.", m_spellInfo->Id); return; } @@ -1292,7 +1292,7 @@ void Spell::EffectUnlearnSpecialization(SpellEffIndex effIndex) player->removeSpell(spellToUnlearn); - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Spell: Player %u has unlearned spell %u from NpcGUID: %u", player->GetGUIDLow(), spellToUnlearn, m_caster->GetGUIDLow()); + TC_LOG_DEBUG("spells", "Spell: Player %u has unlearned spell %u from NpcGUID: %u", player->GetGUIDLow(), spellToUnlearn, m_caster->GetGUIDLow()); } void Spell::EffectPowerDrain(SpellEffIndex effIndex) @@ -1364,7 +1364,7 @@ void Spell::EffectSendEvent(SpellEffIndex effIndex) /// @todo there should be a possibility to pass dest target to event script } - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Spell ScriptStart %u for spellid %u in EffectSendEvent ", m_spellInfo->Effects[effIndex].MiscValue, m_spellInfo->Id); + TC_LOG_DEBUG("spells", "Spell ScriptStart %u for spellid %u in EffectSendEvent ", m_spellInfo->Effects[effIndex].MiscValue, m_spellInfo->Id); if (ZoneScript* zoneScript = m_caster->GetZoneScript()) zoneScript->ProcessEvent(target, m_spellInfo->Effects[effIndex].MiscValue); @@ -1467,7 +1467,7 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/) if (!targetAura) { - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Target(GUID:" UI64FMTD ") has aurastate AURA_STATE_SWIFTMEND but no matching aura.", unitTarget->GetGUID()); + TC_LOG_ERROR("spells", "Target(GUID:" UI64FMTD ") has aurastate AURA_STATE_SWIFTMEND but no matching aura.", unitTarget->GetGUID()); return; } @@ -1572,7 +1572,7 @@ void Spell::EffectHealthLeech(SpellEffIndex effIndex) damage = m_caster->SpellDamageBonusDone(unitTarget, m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE); damage = unitTarget->SpellDamageBonusTaken(m_caster, m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE); - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "HealthLeech :%i", damage); + TC_LOG_DEBUG("spells", "HealthLeech :%i", damage); float healMultiplier = m_spellInfo->Effects[effIndex].CalcValueMultiplier(m_originalCaster, this); @@ -1937,7 +1937,7 @@ void Spell::SendLoot(uint64 guid, LootType loottype) // Players shouldn't be able to loot gameobjects that are currently despawned if (!gameObjTarget->isSpawned() && !player->IsGameMaster()) { - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Possible hacking attempt: Player %s [guid: %u] tried to loot a gameobject [entry: %u id: %u] which is on respawn time without being in GM mode!", + TC_LOG_ERROR("spells", "Possible hacking attempt: Player %s [guid: %u] tried to loot a gameobject [entry: %u id: %u] which is on respawn time without being in GM mode!", player->GetName().c_str(), player->GetGUIDLow(), gameObjTarget->GetEntry(), gameObjTarget->GetGUIDLow()); return; } @@ -1976,7 +1976,7 @@ void Spell::SendLoot(uint64 guid, LootType loottype) /// @todo possible must be moved to loot release (in different from linked triggering) if (gameObjTarget->GetGOInfo()->chest.eventId) { - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Chest ScriptStart id %u for GO %u", gameObjTarget->GetGOInfo()->chest.eventId, gameObjTarget->GetDBTableGUIDLow()); + TC_LOG_DEBUG("spells", "Chest ScriptStart id %u for GO %u", gameObjTarget->GetGOInfo()->chest.eventId, gameObjTarget->GetDBTableGUIDLow()); player->GetMap()->ScriptsStart(sEventScripts, gameObjTarget->GetGOInfo()->chest.eventId, player, gameObjTarget); } @@ -2001,7 +2001,7 @@ void Spell::EffectOpenLock(SpellEffIndex effIndex) if (m_caster->GetTypeId() != TYPEID_PLAYER) { - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "WORLD: Open Lock - No Player Caster!"); + TC_LOG_DEBUG("spells", "WORLD: Open Lock - No Player Caster!"); return; } @@ -2057,7 +2057,7 @@ void Spell::EffectOpenLock(SpellEffIndex effIndex) } else { - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "WORLD: Open Lock - No GameObject/Item Target!"); + TC_LOG_DEBUG("spells", "WORLD: Open Lock - No GameObject/Item Target!"); return; } @@ -2236,7 +2236,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex) SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(m_spellInfo->Effects[effIndex].MiscValueB); if (!properties) { - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "EffectSummonType: Unhandled summon type %u", m_spellInfo->Effects[effIndex].MiscValueB); + TC_LOG_ERROR("spells", "EffectSummonType: Unhandled summon type %u", m_spellInfo->Effects[effIndex].MiscValueB); return; } @@ -2423,7 +2423,7 @@ void Spell::EffectLearnSpell(SpellEffIndex effIndex) uint32 spellToLearn = (m_spellInfo->Id == 483 || m_spellInfo->Id == 55884) ? damage : m_spellInfo->Effects[effIndex].TriggerSpell; player->learnSpell(spellToLearn, false); - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Spell: Player %u has learned spell %u from NpcGUID=%u", player->GetGUIDLow(), spellToLearn, m_caster->GetGUIDLow()); + TC_LOG_DEBUG("spells", "Spell: Player %u has learned spell %u from NpcGUID=%u", player->GetGUIDLow(), spellToLearn, m_caster->GetGUIDLow()); } typedef std::list< std::pair<uint32, uint64> > DispelList; @@ -2669,7 +2669,7 @@ void Spell::EffectAddHonor(SpellEffIndex /*effIndex*/) if (m_CastItem) { unitTarget->ToPlayer()->RewardHonor(NULL, 1, damage/10); - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "SpellEffect::AddHonor (spell_id %u) rewards %d honor points (item %u) for player: %u", m_spellInfo->Id, damage/10, m_CastItem->GetEntry(), unitTarget->ToPlayer()->GetGUIDLow()); + TC_LOG_DEBUG("spells", "SpellEffect::AddHonor (spell_id %u) rewards %d honor points (item %u) for player: %u", m_spellInfo->Id, damage/10, m_CastItem->GetEntry(), unitTarget->ToPlayer()->GetGUIDLow()); return; } @@ -2678,13 +2678,13 @@ void Spell::EffectAddHonor(SpellEffIndex /*effIndex*/) { uint32 honor_reward = Trinity::Honor::hk_honor_at_level(unitTarget->getLevel(), float(damage)); unitTarget->ToPlayer()->RewardHonor(NULL, 1, honor_reward); - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "SpellEffect::AddHonor (spell_id %u) rewards %u honor points (scale) to player: %u", m_spellInfo->Id, honor_reward, unitTarget->ToPlayer()->GetGUIDLow()); + TC_LOG_DEBUG("spells", "SpellEffect::AddHonor (spell_id %u) rewards %u honor points (scale) to player: %u", m_spellInfo->Id, honor_reward, unitTarget->ToPlayer()->GetGUIDLow()); } else { //maybe we have correct honor_gain in damage already unitTarget->ToPlayer()->RewardHonor(NULL, 1, damage); - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "SpellEffect::AddHonor (spell_id %u) rewards %u honor points (non scale) for player: %u", m_spellInfo->Id, damage, unitTarget->ToPlayer()->GetGUIDLow()); + TC_LOG_DEBUG("spells", "SpellEffect::AddHonor (spell_id %u) rewards %u honor points (non scale) for player: %u", m_spellInfo->Id, damage, unitTarget->ToPlayer()->GetGUIDLow()); } } @@ -2797,7 +2797,7 @@ void Spell::EffectEnchantItemPrismatic(SpellEffIndex effIndex) } if (!add_socket) { - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Spell::EffectEnchantItemPrismatic: attempt apply enchant spell %u with SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC (%u) but without ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET (%u), not suppoted yet.", + TC_LOG_ERROR("spells", "Spell::EffectEnchantItemPrismatic: attempt apply enchant spell %u with SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC (%u) but without ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET (%u), not suppoted yet.", m_spellInfo->Id, SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC, ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET); return; } @@ -2862,14 +2862,14 @@ void Spell::EffectEnchantItemTmp(SpellEffIndex effIndex) case 10: spell_id = 36758; break; // 14% case 11: spell_id = 36760; break; // 20% default: - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Spell::EffectEnchantItemTmp: Damage %u not handled in S'RW", damage); + TC_LOG_ERROR("spells", "Spell::EffectEnchantItemTmp: Damage %u not handled in S'RW", damage); return; } SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id); if (!spellInfo) { - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Spell::EffectEnchantItemTmp: unknown spell id %i", spell_id); + TC_LOG_ERROR("spells", "Spell::EffectEnchantItemTmp: unknown spell id %i", spell_id); return; } @@ -2896,14 +2896,14 @@ void Spell::EffectEnchantItemTmp(SpellEffIndex effIndex) if (!enchant_id) { - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Spell %u Effect %u (SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY) have 0 as enchanting id", m_spellInfo->Id, effIndex); + TC_LOG_ERROR("spells", "Spell %u Effect %u (SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY) have 0 as enchanting id", m_spellInfo->Id, effIndex); return; } SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); if (!pEnchant) { - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Spell %u Effect %u (SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY) have not existed enchanting id %u ", m_spellInfo->Id, effIndex, enchant_id); + TC_LOG_ERROR("spells", "Spell %u Effect %u (SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY) have not existed enchanting id %u ", m_spellInfo->Id, effIndex, enchant_id); return; } @@ -4023,7 +4023,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) case 31893: spell_heal = 48084; break; case 31883: spell_heal = 48085; break; default: - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Unknown Lightwell spell caster %u", m_caster->GetEntry()); + TC_LOG_ERROR("spells", "Unknown Lightwell spell caster %u", m_caster->GetEntry()); return; } @@ -4121,7 +4121,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) case 57774: spellId1 = 20185; break; // Judgement of Light case 53408: spellId1 = 20186; break; // Judgement of Wisdom default: - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Unsupported Judgement (seal trigger) spell (Id: %u) in Spell::EffectScriptEffect", m_spellInfo->Id); + TC_LOG_ERROR("spells", "Unsupported Judgement (seal trigger) spell (Id: %u) in Spell::EffectScriptEffect", m_spellInfo->Id); return; } // all seals have aura dummy in 2 effect @@ -4185,7 +4185,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) } // normal DB scripted effect - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Spell ScriptStart spellid %u in EffectScriptEffect(%u)", m_spellInfo->Id, effIndex); + TC_LOG_DEBUG("spells", "Spell ScriptStart spellid %u in EffectScriptEffect(%u)", m_spellInfo->Id, effIndex); m_caster->GetMap()->ScriptsStart(sSpellScripts, uint32(m_spellInfo->Id | (effIndex << 24)), m_caster, unitTarget); } @@ -4340,8 +4340,8 @@ void Spell::EffectStuck(SpellEffIndex /*effIndex*/) if (!player) return; - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Spell Effect: Stuck"); - TC_LOG_INFO(LOG_FILTER_SPELLS_AURAS, "Player %s (guid %u) used auto-unstuck future at map %u (%f, %f, %f)", player->GetName().c_str(), player->GetGUIDLow(), player->GetMapId(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ()); + TC_LOG_DEBUG("spells", "Spell Effect: Stuck"); + TC_LOG_INFO("spells", "Player %s (guid %u) used auto-unstuck future at map %u (%f, %f, %f)", player->GetName().c_str(), player->GetGUIDLow(), player->GetMapId(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ()); if (player->IsInFlight()) return; @@ -5055,28 +5055,43 @@ void Spell::EffectSummonDeadPet(SpellEffIndex /*effIndex*/) if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT) return; - Player* player = m_caster->ToPlayer(); - if (!player) + if (damage < 0) return; - Pet* pet = player->GetPet(); - if (pet && pet->IsAlive()) + Player* player = m_caster->ToPlayer(); + if (!player) return; - if (damage < 0) - return; - float x, y, z; - player->GetPosition(x, y, z); - if (!pet) + // Maybe player dismissed dead pet or pet despawned? + bool hadPet = true; + if (!player->GetPet()) { - player->SummonPet(0, x, y, z, player->GetOrientation(), SUMMON_PET, 0); - pet = player->GetPet(); + // Position passed to SummonPet is irrelevant with current implementation, + // pet will be relocated without using these coords in Pet::LoadPetFromDB + player->SummonPet(0, 0.0f, 0.0f, 0.0f, 0.0f, SUMMON_PET, 0); + hadPet = false; } + + // TODO: Better to fail Hunter's "Revive Pet" at cast instead of here when casting ends + Pet* pet = player->GetPet(); // Attempt to get current pet if (!pet) return; - player->GetMap()->CreatureRelocation(pet, x, y, z, player->GetOrientation()); + // TODO: Better to fail Hunter's "Revive Pet" at cast instead of here when casting ends + if (pet->IsAlive()) + return; + + // If player did have a pet before reviving, teleport it + if (hadPet) + { + // Reposition the pet's corpse before reviving so as not to grab aggro + // We can use a different, more accurate version of GetClosePoint() since we have a pet + float x, y, z; // Will be used later to reposition the pet if we have one + player->GetClosePoint(x, y, z, pet->GetObjectSize(), PET_FOLLOW_DIST, pet->GetFollowAngle()); + pet->NearTeleportTo(x, y, z, player->GetOrientation()); + pet->Relocate(x, y, z, player->GetOrientation()); // This is needed so SaveStayPosition() will get the proper coords. + } pet->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_NONE); pet->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); @@ -5084,8 +5099,20 @@ void Spell::EffectSummonDeadPet(SpellEffIndex /*effIndex*/) pet->ClearUnitState(uint32(UNIT_STATE_ALL_STATE)); pet->SetHealth(pet->CountPctFromMaxHealth(damage)); - //pet->AIM_Initialize(); - //player->PetSpellInitialize(); + // Reset things for when the AI to takes over + CharmInfo *ci = pet->GetCharmInfo(); + if (ci) + { + // In case the pet was at stay, we don't want it running back + ci->SaveStayPosition(); + ci->SetIsAtStay(ci->HasCommandState(COMMAND_STAY)); + + ci->SetIsFollowing(false); + ci->SetIsCommandAttack(false); + ci->SetIsCommandFollow(false); + ci->SetIsReturning(false); + } + pet->SavePetToDB(PET_SAVE_AS_CURRENT); } @@ -5198,7 +5225,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex) if (!goinfo) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Gameobject (Entry: %u) not exist and not created at spell (ID: %u) cast", name_id, m_spellInfo->Id); + TC_LOG_ERROR("sql.sql", "Gameobject (Entry: %u) not exist and not created at spell (ID: %u) cast", name_id, m_spellInfo->Id); return; } @@ -5286,7 +5313,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex) ExecuteLogEffectSummonObject(effIndex, pGameObj); - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "AddObject at SpellEfects.cpp EffectTransmitted"); + TC_LOG_DEBUG("spells", "AddObject at SpellEfects.cpp EffectTransmitted"); //m_caster->AddGameObject(pGameObj); //m_ObjToDel.push_back(pGameObj); @@ -5371,7 +5398,7 @@ void Spell::EffectSkill(SpellEffIndex /*effIndex*/) if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT) return; - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "WORLD: SkillEFFECT"); + TC_LOG_DEBUG("spells", "WORLD: SkillEFFECT"); } /* There is currently no need for this effect. We handle it in Battleground.cpp @@ -5402,7 +5429,7 @@ void Spell::EffectSkinPlayerCorpse(SpellEffIndex /*effIndex*/) if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Effect: SkinPlayerCorpse"); + TC_LOG_DEBUG("spells", "Effect: SkinPlayerCorpse"); Player* player = m_caster->ToPlayer(); Player* target = unitTarget->ToPlayer(); @@ -5417,7 +5444,7 @@ void Spell::EffectStealBeneficialBuff(SpellEffIndex effIndex) if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Effect: StealBeneficialBuff"); + TC_LOG_DEBUG("spells", "Effect: StealBeneficialBuff"); if (!unitTarget || unitTarget == m_caster) // can't steal from self return; @@ -5568,12 +5595,8 @@ void Spell::EffectQuestStart(SpellEffIndex effIndex) Player* player = unitTarget->ToPlayer(); if (Quest const* qInfo = sObjectMgr->GetQuestTemplate(m_spellInfo->Effects[effIndex].MiscValue)) - { if (player->CanTakeQuest(qInfo, false) && player->CanAddQuest(qInfo, false)) - { - player->AddQuest(qInfo, NULL); - } - } + player->AddQuestAndCheckCompletion(qInfo, NULL); } void Spell::EffectActivateRune(SpellEffIndex effIndex) @@ -5832,7 +5855,7 @@ void Spell::EffectPlayMusic(SpellEffIndex effIndex) if (!sSoundEntriesStore.LookupEntry(soundid)) { - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "EffectPlayMusic: Sound (Id: %u) not exist in spell %u.", soundid, m_spellInfo->Id); + TC_LOG_ERROR("spells", "EffectPlayMusic: Sound (Id: %u) not exist in spell %u.", soundid, m_spellInfo->Id); return; } @@ -5885,7 +5908,7 @@ void Spell::EffectPlaySound(SpellEffIndex effIndex) if (!sSoundEntriesStore.LookupEntry(soundId)) { - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "EffectPlaySound: Sound (Id: %u) not exist in spell %u.", soundId, m_spellInfo->Id); + TC_LOG_ERROR("spells", "EffectPlaySound: Sound (Id: %u) not exist in spell %u.", soundId, m_spellInfo->Id); return; } @@ -6013,7 +6036,7 @@ void Spell::EffectBind(SpellEffIndex effIndex) data << uint32(areaId); player->SendDirectMessage(&data); - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "EffectBind: New homebind X: %f, Y: %f, Z: %f, MapId: %u, AreaId: %u", + TC_LOG_DEBUG("spells", "EffectBind: New homebind X: %f, Y: %f, Z: %f, MapId: %u, AreaId: %u", homeLoc.GetPositionX(), homeLoc.GetPositionY(), homeLoc.GetPositionZ(), homeLoc.GetMapId(), areaId); // zone update diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 0cab2cd4540..6b54df27596 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -1324,7 +1324,7 @@ SpellCastResult SpellInfo::CheckShapeshift(uint32 form) const shapeInfo = sSpellShapeshiftStore.LookupEntry(form); if (!shapeInfo) { - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "GetErrorAtShapeshiftedCast: unknown shapeshift %u", form); + TC_LOG_ERROR("spells", "GetErrorAtShapeshiftedCast: unknown shapeshift %u", form); return SPELL_CAST_OK; } actAsShifted = !(shapeInfo->flags1 & 1); // shapeshift acts as normal form for spells @@ -2142,7 +2142,7 @@ int32 SpellInfo::CalcPowerCost(Unit const* caster, SpellSchoolMask schoolMask) c // Else drain all power if (PowerType < MAX_POWERS) return caster->GetPower(Powers(PowerType)); - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "SpellInfo::CalcPowerCost: Unknown power type '%d' in spell %d", PowerType, Id); + TC_LOG_ERROR("spells", "SpellInfo::CalcPowerCost: Unknown power type '%d' in spell %d", PowerType, Id); return 0; } @@ -2168,10 +2168,10 @@ int32 SpellInfo::CalcPowerCost(Unit const* caster, SpellSchoolMask schoolMask) c break; case POWER_RUNE: case POWER_RUNIC_POWER: - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "CalculateManaCost: Not implemented yet!"); + TC_LOG_DEBUG("spells", "CalculateManaCost: Not implemented yet!"); break; default: - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "CalculateManaCost: Unknown power type '%d' in spell %d", PowerType, Id); + TC_LOG_ERROR("spells", "CalculateManaCost: Unknown power type '%d' in spell %d", PowerType, Id); return 0; } } diff --git a/src/server/game/Spells/SpellInfo.h b/src/server/game/Spells/SpellInfo.h index 2b1dd6a147a..9cb8879a1b8 100644 --- a/src/server/game/Spells/SpellInfo.h +++ b/src/server/game/Spells/SpellInfo.h @@ -250,7 +250,10 @@ public: flag96 SpellClassMask; std::list<Condition*>* ImplicitTargetConditions; - SpellEffectInfo() { } + SpellEffectInfo() : _spellInfo(NULL), _effIndex(0), Effect(0), ApplyAuraName(0), Amplitude(0), DieSides(0), + RealPointsPerLevel(0), BasePoints(0), PointsPerComboPoint(0), ValueMultiplier(0), DamageMultiplier(0), + BonusMultiplier(0), MiscValue(0), MiscValueB(0), Mechanic(MECHANIC_NONE), RadiusEntry(NULL), ChainTarget(0), + ItemType(0), TriggerSpell(0), ImplicitTargetConditions(NULL) {} SpellEffectInfo(SpellEntry const* spellEntry, SpellInfo const* spellInfo, uint8 effIndex); bool IsEffect() const; diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 6138cbef773..730f89a7b6b 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -385,7 +385,7 @@ bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* player, bool msg if (player) ChatHandler(player->GetSession()).PSendSysMessage("Craft spell %u not have create item entry.", spellInfo->Id); else - TC_LOG_ERROR(LOG_FILTER_SQL, "Craft spell %u not have create item entry.", spellInfo->Id); + TC_LOG_ERROR("sql.sql", "Craft spell %u not have create item entry.", spellInfo->Id); } return false; } @@ -399,7 +399,7 @@ bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* player, bool msg if (player) ChatHandler(player->GetSession()).PSendSysMessage("Craft spell %u create not-exist in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Effects[i].ItemType); else - TC_LOG_ERROR(LOG_FILTER_SQL, "Craft spell %u create not-exist in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Effects[i].ItemType); + TC_LOG_ERROR("sql.sql", "Craft spell %u create not-exist in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Effects[i].ItemType); } return false; } @@ -417,7 +417,7 @@ bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* player, bool msg if (player) ChatHandler(player->GetSession()).PSendSysMessage("Spell %u learn to broken spell %u, and then...", spellInfo->Id, spellInfo->Effects[i].TriggerSpell); else - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u learn to invalid spell %u, and then...", spellInfo->Id, spellInfo->Effects[i].TriggerSpell); + TC_LOG_ERROR("sql.sql", "Spell %u learn to invalid spell %u, and then...", spellInfo->Id, spellInfo->Effects[i].TriggerSpell); } return false; } @@ -437,7 +437,7 @@ bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* player, bool msg if (player) ChatHandler(player->GetSession()).PSendSysMessage("Craft spell %u have not-exist reagent in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Reagent[j]); else - TC_LOG_ERROR(LOG_FILTER_SQL, "Craft spell %u have not-exist reagent in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Reagent[j]); + TC_LOG_ERROR("sql.sql", "Craft spell %u have not-exist reagent in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Reagent[j]); } return false; } @@ -469,7 +469,7 @@ uint32 SpellMgr::GetSpellIdForDifficulty(uint32 spellId, Unit const* caster) con uint32 mode = uint32(caster->GetMap()->GetSpawnMode()); if (mode >= MAX_DIFFICULTY) { - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "SpellMgr::GetSpellIdForDifficulty: Incorrect Difficulty for spell %u.", spellId); + TC_LOG_ERROR("spells", "SpellMgr::GetSpellIdForDifficulty: Incorrect Difficulty for spell %u.", spellId); return spellId; //return source spell } @@ -480,23 +480,23 @@ uint32 SpellMgr::GetSpellIdForDifficulty(uint32 spellId, Unit const* caster) con SpellDifficultyEntry const* difficultyEntry = sSpellDifficultyStore.LookupEntry(difficultyId); if (!difficultyEntry) { - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "SpellMgr::GetSpellIdForDifficulty: SpellDifficultyEntry not found for spell %u. This should never happen.", spellId); + TC_LOG_DEBUG("spells", "SpellMgr::GetSpellIdForDifficulty: SpellDifficultyEntry not found for spell %u. This should never happen.", spellId); return spellId; //return source spell } if (difficultyEntry->SpellID[mode] <= 0 && mode > DUNGEON_DIFFICULTY_HEROIC) { - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "SpellMgr::GetSpellIdForDifficulty: spell %u mode %u spell is NULL, using mode %u", spellId, mode, mode - 2); + TC_LOG_DEBUG("spells", "SpellMgr::GetSpellIdForDifficulty: spell %u mode %u spell is NULL, using mode %u", spellId, mode, mode - 2); mode -= 2; } if (difficultyEntry->SpellID[mode] <= 0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SpellMgr::GetSpellIdForDifficulty: spell %u mode %u spell is 0. Check spelldifficulty_dbc!", spellId, mode); + TC_LOG_ERROR("sql.sql", "SpellMgr::GetSpellIdForDifficulty: spell %u mode %u spell is 0. Check spelldifficulty_dbc!", spellId, mode); return spellId; } - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "SpellMgr::GetSpellIdForDifficulty: spellid for spell %u in mode %u is %d", spellId, mode, difficultyEntry->SpellID[mode]); + TC_LOG_DEBUG("spells", "SpellMgr::GetSpellIdForDifficulty: spellid for spell %u in mode %u is %d", spellId, mode, difficultyEntry->SpellID[mode]); return uint32(difficultyEntry->SpellID[mode]); } @@ -509,11 +509,11 @@ SpellInfo const* SpellMgr::GetSpellForDifficultyFromSpell(SpellInfo const* spell SpellInfo const* newSpell = GetSpellInfo(newSpellId); if (!newSpell) { - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "SpellMgr::GetSpellForDifficultyFromSpell: spell %u not found. Check spelldifficulty_dbc!", newSpellId); + TC_LOG_DEBUG("spells", "SpellMgr::GetSpellForDifficultyFromSpell: spell %u not found. Check spelldifficulty_dbc!", newSpellId); return spell; } - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "SpellMgr::GetSpellForDifficultyFromSpell: Spell id for instance mode is %u (original %u)", newSpell->Id, spell->Id); + TC_LOG_DEBUG("spells", "SpellMgr::GetSpellForDifficultyFromSpell: Spell id for instance mode is %u (original %u)", newSpell->Id, spell->Id); return newSpell; } @@ -1216,7 +1216,7 @@ void SpellMgr::LoadSpellTalentRanks() SpellInfo const* firstSpell = GetSpellInfo(talentInfo->RankID[0]); if (!firstSpell) { - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "SpellMgr::LoadSpellTalentRanks: First Rank Spell %u for TalentEntry %u does not exist.", talentInfo->RankID[0], i); + TC_LOG_ERROR("spells", "SpellMgr::LoadSpellTalentRanks: First Rank Spell %u for TalentEntry %u does not exist.", talentInfo->RankID[0], i); continue; } @@ -1230,7 +1230,7 @@ void SpellMgr::LoadSpellTalentRanks() SpellInfo const* currentSpell = GetSpellInfo(spellId); if (!currentSpell) { - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "SpellMgr::LoadSpellTalentRanks: Spell %u (Rank: %u) for TalentEntry %u does not exist.", spellId, rank + 1, i); + TC_LOG_ERROR("spells", "SpellMgr::LoadSpellTalentRanks: Spell %u (Rank: %u) for TalentEntry %u does not exist.", spellId, rank + 1, i); break; } @@ -1262,7 +1262,7 @@ void SpellMgr::LoadSpellRanks() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell rank records. DB table `spell_ranks` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 spell rank records. DB table `spell_ranks` is empty."); return; } @@ -1301,13 +1301,13 @@ void SpellMgr::LoadSpellRanks() SpellInfo const* first = GetSpellInfo(lastSpell); if (!first) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell rank identifier(first_spell_id) %u listed in `spell_ranks` does not exist!", lastSpell); + TC_LOG_ERROR("sql.sql", "Spell rank identifier(first_spell_id) %u listed in `spell_ranks` does not exist!", lastSpell); continue; } // check if chain is long enough if (rankChain.size() < 2) { - TC_LOG_ERROR(LOG_FILTER_SQL, "There is only 1 spell rank for identifier(first_spell_id) %u in `spell_ranks`, entry is not needed!", lastSpell); + TC_LOG_ERROR("sql.sql", "There is only 1 spell rank for identifier(first_spell_id) %u in `spell_ranks`, entry is not needed!", lastSpell); continue; } int32 curRank = 0; @@ -1318,14 +1318,14 @@ void SpellMgr::LoadSpellRanks() SpellInfo const* spell = GetSpellInfo(itr->first); if (!spell) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u (rank %u) listed in `spell_ranks` for chain %u does not exist!", itr->first, itr->second, lastSpell); + TC_LOG_ERROR("sql.sql", "Spell %u (rank %u) listed in `spell_ranks` for chain %u does not exist!", itr->first, itr->second, lastSpell); valid = false; break; } ++curRank; if (itr->second != curRank) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u (rank %u) listed in `spell_ranks` for chain %u does not have proper rank value(should be %u)!", itr->first, itr->second, lastSpell, curRank); + TC_LOG_ERROR("sql.sql", "Spell %u (rank %u) listed in `spell_ranks` for chain %u does not have proper rank value(should be %u)!", itr->first, itr->second, lastSpell, curRank); valid = false; break; } @@ -1341,7 +1341,7 @@ void SpellMgr::LoadSpellRanks() int32 addedSpell = itr->first; if (mSpellInfoMap[addedSpell]->ChainEntry) - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u (rank: %u, first: %u) listed in `spell_ranks` has already ChainEntry from dbc.", addedSpell, itr->second, lastSpell); + TC_LOG_ERROR("sql.sql", "Spell %u (rank: %u, first: %u) listed in `spell_ranks` has already ChainEntry from dbc.", addedSpell, itr->second, lastSpell); mSpellChains[addedSpell].first = GetSpellInfo(lastSpell); mSpellChains[addedSpell].last = GetSpellInfo(rankChain.back().first); @@ -1363,7 +1363,7 @@ void SpellMgr::LoadSpellRanks() } while (!finished); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell rank records in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u spell rank records in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadSpellRequired() @@ -1378,7 +1378,7 @@ void SpellMgr::LoadSpellRequired() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell required records. DB table `spell_required` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 spell required records. DB table `spell_required` is empty."); return; } @@ -1395,26 +1395,26 @@ void SpellMgr::LoadSpellRequired() SpellInfo const* spell = GetSpellInfo(spell_id); if (!spell) { - TC_LOG_ERROR(LOG_FILTER_SQL, "spell_id %u in `spell_required` table is not found in dbcs, skipped", spell_id); + TC_LOG_ERROR("sql.sql", "spell_id %u in `spell_required` table is not found in dbcs, skipped", spell_id); continue; } SpellInfo const* reqSpell = GetSpellInfo(spell_req); if (!reqSpell) { - TC_LOG_ERROR(LOG_FILTER_SQL, "req_spell %u in `spell_required` table is not found in dbcs, skipped", spell_req); + TC_LOG_ERROR("sql.sql", "req_spell %u in `spell_required` table is not found in dbcs, skipped", spell_req); continue; } if (spell->IsRankOf(reqSpell)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "req_spell %u and spell_id %u in `spell_required` table are ranks of the same spell, entry not needed, skipped", spell_req, spell_id); + TC_LOG_ERROR("sql.sql", "req_spell %u and spell_id %u in `spell_required` table are ranks of the same spell, entry not needed, skipped", spell_req, spell_id); continue; } if (IsSpellRequiringSpell(spell_id, spell_req)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "duplicated entry of req_spell %u and spell_id %u in `spell_required`, skipped", spell_req, spell_id); + TC_LOG_ERROR("sql.sql", "duplicated entry of req_spell %u and spell_id %u in `spell_required`, skipped", spell_req, spell_id); continue; } @@ -1423,7 +1423,7 @@ void SpellMgr::LoadSpellRequired() ++count; } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell required records in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u spell required records in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -1461,7 +1461,7 @@ void SpellMgr::LoadSpellLearnSkills() } } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Spell Learn Skills from DBC in %u ms", dbc_count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u Spell Learn Skills from DBC in %u ms", dbc_count, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadSpellLearnSpells() @@ -1474,7 +1474,7 @@ void SpellMgr::LoadSpellLearnSpells() QueryResult result = WorldDatabase.Query("SELECT entry, SpellID, Active FROM spell_learn_spell"); if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell learn spells. DB table `spell_learn_spell` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 spell learn spells. DB table `spell_learn_spell` is empty."); return; } @@ -1492,19 +1492,19 @@ void SpellMgr::LoadSpellLearnSpells() if (!GetSpellInfo(spell_id)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u listed in `spell_learn_spell` does not exist", spell_id); + TC_LOG_ERROR("sql.sql", "Spell %u listed in `spell_learn_spell` does not exist", spell_id); continue; } if (!GetSpellInfo(node.spell)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u listed in `spell_learn_spell` learning not existed spell %u", spell_id, node.spell); + TC_LOG_ERROR("sql.sql", "Spell %u listed in `spell_learn_spell` learning not existed spell %u", spell_id, node.spell); continue; } if (GetTalentSpellCost(node.spell)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u listed in `spell_learn_spell` attempt learning talent spell %u, skipped", spell_id, node.spell); + TC_LOG_ERROR("sql.sql", "Spell %u listed in `spell_learn_spell` attempt learning talent spell %u, skipped", spell_id, node.spell); continue; } @@ -1546,7 +1546,7 @@ void SpellMgr::LoadSpellLearnSpells() { if (itr->second.spell == dbc_node.spell) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u auto-learn spell %u in spell.dbc then the record in `spell_learn_spell` is redundant, please fix DB.", + TC_LOG_ERROR("sql.sql", "Spell %u auto-learn spell %u in spell.dbc then the record in `spell_learn_spell` is redundant, please fix DB.", spell, dbc_node.spell); found = true; break; @@ -1562,7 +1562,7 @@ void SpellMgr::LoadSpellLearnSpells() } } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell learn spells + %u found in DBC in %u ms", count, dbc_count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u spell learn spells + %u found in DBC in %u ms", count, dbc_count, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadSpellTargetPositions() @@ -1575,7 +1575,7 @@ void SpellMgr::LoadSpellTargetPositions() QueryResult result = WorldDatabase.Query("SELECT id, effIndex, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM spell_target_position"); if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell target coordinates. DB table `spell_target_position` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 spell target coordinates. DB table `spell_target_position` is empty."); return; } @@ -1598,20 +1598,20 @@ void SpellMgr::LoadSpellTargetPositions() MapEntry const* mapEntry = sMapStore.LookupEntry(st.target_mapId); if (!mapEntry) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell (Id: %u, effIndex: %u) target map (ID: %u) does not exist in `Map.dbc`.", Spell_ID, effIndex, st.target_mapId); + TC_LOG_ERROR("sql.sql", "Spell (Id: %u, effIndex: %u) target map (ID: %u) does not exist in `Map.dbc`.", Spell_ID, effIndex, st.target_mapId); continue; } if (st.target_X==0 && st.target_Y==0 && st.target_Z==0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell (Id: %u, effIndex: %u) target coordinates not provided.", Spell_ID, effIndex); + TC_LOG_ERROR("sql.sql", "Spell (Id: %u, effIndex: %u) target coordinates not provided.", Spell_ID, effIndex); continue; } SpellInfo const* spellInfo = GetSpellInfo(Spell_ID); if (!spellInfo) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell (Id: %u) listed in `spell_target_position` does not exist.", Spell_ID); + TC_LOG_ERROR("sql.sql", "Spell (Id: %u) listed in `spell_target_position` does not exist.", Spell_ID); continue; } @@ -1623,7 +1623,7 @@ void SpellMgr::LoadSpellTargetPositions() } else { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell (Id: %u, effIndex: %u) listed in `spell_target_position` does not have target TARGET_DEST_DB (17).", Spell_ID, effIndex); + TC_LOG_ERROR("sql.sql", "Spell (Id: %u, effIndex: %u) listed in `spell_target_position` does not have target TARGET_DEST_DB (17).", Spell_ID, effIndex); continue; } @@ -1660,11 +1660,11 @@ void SpellMgr::LoadSpellTargetPositions() if (found) { if (!sSpellMgr->GetSpellTargetPosition(i)) - TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Spell (ID: %u) does not have record in `spell_target_position`", i); + TC_LOG_DEBUG("spells", "Spell (ID: %u) does not have record in `spell_target_position`", i); } }*/ - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell teleport coordinates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u spell teleport coordinates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadSpellGroups() @@ -1678,7 +1678,7 @@ void SpellMgr::LoadSpellGroups() QueryResult result = WorldDatabase.Query("SELECT id, spell_id FROM spell_group"); if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell group definitions. DB table `spell_group` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 spell group definitions. DB table `spell_group` is empty."); return; } @@ -1691,7 +1691,7 @@ void SpellMgr::LoadSpellGroups() uint32 group_id = fields[0].GetUInt32(); if (group_id <= SPELL_GROUP_DB_RANGE_MIN && group_id >= SPELL_GROUP_CORE_RANGE_MAX) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SpellGroup id %u listed in `spell_group` is in core range, but is not defined in core!", group_id); + TC_LOG_ERROR("sql.sql", "SpellGroup id %u listed in `spell_group` is in core range, but is not defined in core!", group_id); continue; } int32 spell_id = fields[1].GetInt32(); @@ -1707,7 +1707,7 @@ void SpellMgr::LoadSpellGroups() { if (groups.find(abs(itr->second)) == groups.end()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SpellGroup id %u listed in `spell_group` does not exist", abs(itr->second)); + TC_LOG_ERROR("sql.sql", "SpellGroup id %u listed in `spell_group` does not exist", abs(itr->second)); mSpellGroupSpell.erase(itr++); } else @@ -1719,12 +1719,12 @@ void SpellMgr::LoadSpellGroups() if (!spellInfo) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u listed in `spell_group` does not exist", itr->second); + TC_LOG_ERROR("sql.sql", "Spell %u listed in `spell_group` does not exist", itr->second); mSpellGroupSpell.erase(itr++); } else if (spellInfo->GetRank() > 1) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u listed in `spell_group` is not first rank of spell", itr->second); + TC_LOG_ERROR("sql.sql", "Spell %u listed in `spell_group` is not first rank of spell", itr->second); mSpellGroupSpell.erase(itr++); } else @@ -1744,7 +1744,7 @@ void SpellMgr::LoadSpellGroups() } } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u spell group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadSpellGroupStackRules() @@ -1757,7 +1757,7 @@ void SpellMgr::LoadSpellGroupStackRules() QueryResult result = WorldDatabase.Query("SELECT group_id, stack_rule FROM spell_group_stack_rules"); if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell group stack rules. DB table `spell_group_stack_rules` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 spell group stack rules. DB table `spell_group_stack_rules` is empty."); return; } @@ -1770,7 +1770,7 @@ void SpellMgr::LoadSpellGroupStackRules() uint8 stack_rule = fields[1].GetInt8(); if (stack_rule >= SPELL_GROUP_STACK_RULE_MAX) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SpellGroupStackRule %u listed in `spell_group_stack_rules` does not exist", stack_rule); + TC_LOG_ERROR("sql.sql", "SpellGroupStackRule %u listed in `spell_group_stack_rules` does not exist", stack_rule); continue; } @@ -1778,7 +1778,7 @@ void SpellMgr::LoadSpellGroupStackRules() if (spellGroup.first == spellGroup.second) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SpellGroup id %u listed in `spell_group_stack_rules` does not exist", group_id); + TC_LOG_ERROR("sql.sql", "SpellGroup id %u listed in `spell_group_stack_rules` does not exist", group_id); continue; } @@ -1787,7 +1787,7 @@ void SpellMgr::LoadSpellGroupStackRules() ++count; } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell group stack rules in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u spell group stack rules in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadSpellProcEvents() @@ -1800,7 +1800,7 @@ void SpellMgr::LoadSpellProcEvents() QueryResult result = WorldDatabase.Query("SELECT entry, SchoolMask, SpellFamilyName, SpellFamilyMask0, SpellFamilyMask1, SpellFamilyMask2, procFlags, procEx, ppmRate, CustomChance, Cooldown FROM spell_proc_event"); if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell proc event conditions. DB table `spell_proc_event` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 spell proc event conditions. DB table `spell_proc_event` is empty."); return; } @@ -1822,18 +1822,18 @@ void SpellMgr::LoadSpellProcEvents() SpellInfo const* spellInfo = GetSpellInfo(spellId); if (!spellInfo) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u listed in `spell_proc_event` does not exist", spellId); + TC_LOG_ERROR("sql.sql", "Spell %u listed in `spell_proc_event` does not exist", spellId); continue; } if (allRanks) { if (!spellInfo->IsRanked()) - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u listed in `spell_proc_event` with all ranks, but spell has no ranks.", spellId); + TC_LOG_ERROR("sql.sql", "Spell %u listed in `spell_proc_event` with all ranks, but spell has no ranks.", spellId); if (spellInfo->GetFirstRankSpell()->Id != uint32(spellId)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u listed in `spell_proc_event` is not first rank of spell.", spellId); + TC_LOG_ERROR("sql.sql", "Spell %u listed in `spell_proc_event` is not first rank of spell.", spellId); continue; } } @@ -1855,12 +1855,12 @@ void SpellMgr::LoadSpellProcEvents() { if (mSpellProcEventMap.find(spellInfo->Id) != mSpellProcEventMap.end()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u listed in `spell_proc_event` already has its first rank in table.", spellInfo->Id); + TC_LOG_ERROR("sql.sql", "Spell %u listed in `spell_proc_event` already has its first rank in table.", spellInfo->Id); break; } if (!spellInfo->ProcFlags && !spellProcEvent.procFlags) - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u listed in `spell_proc_event` probably not triggered spell", spellInfo->Id); + TC_LOG_ERROR("sql.sql", "Spell %u listed in `spell_proc_event` probably not triggered spell", spellInfo->Id); mSpellProcEventMap[spellInfo->Id] = spellProcEvent; @@ -1874,7 +1874,7 @@ void SpellMgr::LoadSpellProcEvents() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u extra spell proc event conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u extra spell proc event conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadSpellProcs() @@ -1887,7 +1887,7 @@ void SpellMgr::LoadSpellProcs() QueryResult result = WorldDatabase.Query("SELECT spellId, schoolMask, spellFamilyName, spellFamilyMask0, spellFamilyMask1, spellFamilyMask2, typeMask, spellTypeMask, spellPhaseMask, hitMask, attributesMask, ratePerMinute, chance, cooldown, charges FROM spell_proc"); if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell proc conditions and data. DB table `spell_proc` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 spell proc conditions and data. DB table `spell_proc` is empty."); return; } @@ -1908,18 +1908,18 @@ void SpellMgr::LoadSpellProcs() SpellInfo const* spellInfo = GetSpellInfo(spellId); if (!spellInfo) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u listed in `spell_proc` does not exist", spellId); + TC_LOG_ERROR("sql.sql", "Spell %u listed in `spell_proc` does not exist", spellId); continue; } if (allRanks) { if (!spellInfo->IsRanked()) - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u listed in `spell_proc` with all ranks, but spell has no ranks.", spellId); + TC_LOG_ERROR("sql.sql", "Spell %u listed in `spell_proc` with all ranks, but spell has no ranks.", spellId); if (spellInfo->GetFirstRankSpell()->Id != uint32(spellId)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u listed in `spell_proc` is not first rank of spell.", spellId); + TC_LOG_ERROR("sql.sql", "Spell %u listed in `spell_proc` is not first rank of spell.", spellId); continue; } } @@ -1946,7 +1946,7 @@ void SpellMgr::LoadSpellProcs() { if (mSpellProcMap.find(spellInfo->Id) != mSpellProcMap.end()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u listed in `spell_proc` already has its first rank in table.", spellInfo->Id); + TC_LOG_ERROR("sql.sql", "Spell %u listed in `spell_proc` already has its first rank in table.", spellInfo->Id); break; } @@ -1962,47 +1962,47 @@ void SpellMgr::LoadSpellProcs() // validate data if (procEntry.schoolMask & ~SPELL_SCHOOL_MASK_ALL) - TC_LOG_ERROR(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has wrong `schoolMask` set: %u", spellInfo->Id, procEntry.schoolMask); + TC_LOG_ERROR("sql.sql", "`spell_proc` table entry for spellId %u has wrong `schoolMask` set: %u", spellInfo->Id, procEntry.schoolMask); if (procEntry.spellFamilyName && (procEntry.spellFamilyName < 3 || procEntry.spellFamilyName > 17 || procEntry.spellFamilyName == 14 || procEntry.spellFamilyName == 16)) - TC_LOG_ERROR(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has wrong `spellFamilyName` set: %u", spellInfo->Id, procEntry.spellFamilyName); + TC_LOG_ERROR("sql.sql", "`spell_proc` table entry for spellId %u has wrong `spellFamilyName` set: %u", spellInfo->Id, procEntry.spellFamilyName); if (procEntry.chance < 0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has negative value in `chance` field", spellInfo->Id); + TC_LOG_ERROR("sql.sql", "`spell_proc` table entry for spellId %u has negative value in `chance` field", spellInfo->Id); procEntry.chance = 0; } if (procEntry.ratePerMinute < 0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has negative value in `ratePerMinute` field", spellInfo->Id); + TC_LOG_ERROR("sql.sql", "`spell_proc` table entry for spellId %u has negative value in `ratePerMinute` field", spellInfo->Id); procEntry.ratePerMinute = 0; } if (cooldown < 0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has negative value in `cooldown` field", spellInfo->Id); + TC_LOG_ERROR("sql.sql", "`spell_proc` table entry for spellId %u has negative value in `cooldown` field", spellInfo->Id); procEntry.cooldown = 0; } if (procEntry.chance == 0 && procEntry.ratePerMinute == 0) - TC_LOG_ERROR(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u doesn't have `chance` and `ratePerMinute` values defined, proc will not be triggered", spellInfo->Id); + TC_LOG_ERROR("sql.sql", "`spell_proc` table entry for spellId %u doesn't have `chance` and `ratePerMinute` values defined, proc will not be triggered", spellInfo->Id); if (procEntry.charges > 99) { - TC_LOG_ERROR(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has too big value in `charges` field", spellInfo->Id); + TC_LOG_ERROR("sql.sql", "`spell_proc` table entry for spellId %u has too big value in `charges` field", spellInfo->Id); procEntry.charges = 99; } if (!procEntry.typeMask) - TC_LOG_ERROR(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u doesn't have `typeMask` value defined, proc will not be triggered", spellInfo->Id); + TC_LOG_ERROR("sql.sql", "`spell_proc` table entry for spellId %u doesn't have `typeMask` value defined, proc will not be triggered", spellInfo->Id); if (procEntry.spellTypeMask & ~PROC_SPELL_TYPE_MASK_ALL) - TC_LOG_ERROR(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has wrong `spellTypeMask` set: %u", spellInfo->Id, procEntry.spellTypeMask); + TC_LOG_ERROR("sql.sql", "`spell_proc` table entry for spellId %u has wrong `spellTypeMask` set: %u", spellInfo->Id, procEntry.spellTypeMask); if (procEntry.spellTypeMask && !(procEntry.typeMask & (SPELL_PROC_FLAG_MASK | PERIODIC_PROC_FLAG_MASK))) - TC_LOG_ERROR(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has `spellTypeMask` value defined, but it won't be used for defined `typeMask` value", spellInfo->Id); + TC_LOG_ERROR("sql.sql", "`spell_proc` table entry for spellId %u has `spellTypeMask` value defined, but it won't be used for defined `typeMask` value", spellInfo->Id); if (!procEntry.spellPhaseMask && procEntry.typeMask & REQ_SPELL_PHASE_PROC_FLAG_MASK) - TC_LOG_ERROR(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u doesn't have `spellPhaseMask` value defined, but it's required for defined `typeMask` value, proc will not be triggered", spellInfo->Id); + TC_LOG_ERROR("sql.sql", "`spell_proc` table entry for spellId %u doesn't have `spellPhaseMask` value defined, but it's required for defined `typeMask` value, proc will not be triggered", spellInfo->Id); if (procEntry.spellPhaseMask & ~PROC_SPELL_PHASE_MASK_ALL) - TC_LOG_ERROR(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has wrong `spellPhaseMask` set: %u", spellInfo->Id, procEntry.spellPhaseMask); + TC_LOG_ERROR("sql.sql", "`spell_proc` table entry for spellId %u has wrong `spellPhaseMask` set: %u", spellInfo->Id, procEntry.spellPhaseMask); if (procEntry.spellPhaseMask && !(procEntry.typeMask & REQ_SPELL_PHASE_PROC_FLAG_MASK)) - TC_LOG_ERROR(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has `spellPhaseMask` value defined, but it won't be used for defined `typeMask` value", spellInfo->Id); + TC_LOG_ERROR("sql.sql", "`spell_proc` table entry for spellId %u has `spellPhaseMask` value defined, but it won't be used for defined `typeMask` value", spellInfo->Id); if (procEntry.hitMask & ~PROC_HIT_MASK_ALL) - TC_LOG_ERROR(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has wrong `hitMask` set: %u", spellInfo->Id, procEntry.hitMask); + TC_LOG_ERROR("sql.sql", "`spell_proc` table entry for spellId %u has wrong `hitMask` set: %u", spellInfo->Id, procEntry.hitMask); if (procEntry.hitMask && !(procEntry.typeMask & TAKEN_HIT_PROC_FLAG_MASK || (procEntry.typeMask & DONE_HIT_PROC_FLAG_MASK && (!procEntry.spellPhaseMask || procEntry.spellPhaseMask & (PROC_SPELL_PHASE_HIT | PROC_SPELL_PHASE_FINISH))))) - TC_LOG_ERROR(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has `hitMask` value defined, but it won't be used for defined `typeMask` and `spellPhaseMask` values", spellInfo->Id); + TC_LOG_ERROR("sql.sql", "`spell_proc` table entry for spellId %u has `hitMask` value defined, but it won't be used for defined `typeMask` and `spellPhaseMask` values", spellInfo->Id); mSpellProcMap[spellInfo->Id] = procEntry; @@ -2015,7 +2015,7 @@ void SpellMgr::LoadSpellProcs() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell proc conditions and data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u spell proc conditions and data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadSpellBonusess() @@ -2028,7 +2028,7 @@ void SpellMgr::LoadSpellBonusess() QueryResult result = WorldDatabase.Query("SELECT entry, direct_bonus, dot_bonus, ap_bonus, ap_dot_bonus FROM spell_bonus_data"); if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell bonus data. DB table `spell_bonus_data` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 spell bonus data. DB table `spell_bonus_data` is empty."); return; } @@ -2041,7 +2041,7 @@ void SpellMgr::LoadSpellBonusess() SpellInfo const* spell = GetSpellInfo(entry); if (!spell) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u listed in `spell_bonus_data` does not exist", entry); + TC_LOG_ERROR("sql.sql", "Spell %u listed in `spell_bonus_data` does not exist", entry); continue; } @@ -2054,7 +2054,7 @@ void SpellMgr::LoadSpellBonusess() ++count; } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u extra spell bonus data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u extra spell bonus data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadSpellThreats() @@ -2067,7 +2067,7 @@ void SpellMgr::LoadSpellThreats() QueryResult result = WorldDatabase.Query("SELECT entry, flatMod, pctMod, apPctMod FROM spell_threat"); if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 aggro generating spells. DB table `spell_threat` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 aggro generating spells. DB table `spell_threat` is empty."); return; } @@ -2080,7 +2080,7 @@ void SpellMgr::LoadSpellThreats() if (!GetSpellInfo(entry)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u listed in `spell_threat` does not exist", entry); + TC_LOG_ERROR("sql.sql", "Spell %u listed in `spell_threat` does not exist", entry); continue; } @@ -2093,7 +2093,7 @@ void SpellMgr::LoadSpellThreats() ++count; } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u SpellThreatEntries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u SpellThreatEntries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadSkillLineAbilityMap() @@ -2114,7 +2114,7 @@ void SpellMgr::LoadSkillLineAbilityMap() ++count; } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u SkillLineAbility MultiMap Data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u SkillLineAbility MultiMap Data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadSpellPetAuras() @@ -2127,7 +2127,7 @@ void SpellMgr::LoadSpellPetAuras() QueryResult result = WorldDatabase.Query("SELECT spell, effectId, pet, aura FROM spell_pet_auras"); if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell pet auras. DB table `spell_pet_auras` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 spell pet auras. DB table `spell_pet_auras` is empty."); return; } @@ -2149,21 +2149,21 @@ void SpellMgr::LoadSpellPetAuras() SpellInfo const* spellInfo = GetSpellInfo(spell); if (!spellInfo) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u listed in `spell_pet_auras` does not exist", spell); + TC_LOG_ERROR("sql.sql", "Spell %u listed in `spell_pet_auras` does not exist", spell); continue; } if (spellInfo->Effects[eff].Effect != SPELL_EFFECT_DUMMY && (spellInfo->Effects[eff].Effect != SPELL_EFFECT_APPLY_AURA || spellInfo->Effects[eff].ApplyAuraName != SPELL_AURA_DUMMY)) { - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Spell %u listed in `spell_pet_auras` does not have dummy aura or dummy effect", spell); + TC_LOG_ERROR("spells", "Spell %u listed in `spell_pet_auras` does not have dummy aura or dummy effect", spell); continue; } SpellInfo const* spellInfo2 = GetSpellInfo(aura); if (!spellInfo2) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Aura %u listed in `spell_pet_auras` does not exist", aura); + TC_LOG_ERROR("sql.sql", "Aura %u listed in `spell_pet_auras` does not exist", aura); continue; } @@ -2174,7 +2174,7 @@ void SpellMgr::LoadSpellPetAuras() ++count; } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell pet auras in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u spell pet auras in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } // Fill custom data about enchancments @@ -2214,7 +2214,7 @@ void SpellMgr::LoadEnchantCustomAttr() } } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u custom enchant attributes in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u custom enchant attributes in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadSpellEnchantProcData() @@ -2227,7 +2227,7 @@ void SpellMgr::LoadSpellEnchantProcData() QueryResult result = WorldDatabase.Query("SELECT entry, customChance, PPMChance, procEx FROM spell_enchant_proc_data"); if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell enchant proc event conditions. DB table `spell_enchant_proc_data` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 spell enchant proc event conditions. DB table `spell_enchant_proc_data` is empty."); return; } @@ -2241,7 +2241,7 @@ void SpellMgr::LoadSpellEnchantProcData() SpellItemEnchantmentEntry const* ench = sSpellItemEnchantmentStore.LookupEntry(enchantId); if (!ench) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Enchancment %u listed in `spell_enchant_proc_data` does not exist", enchantId); + TC_LOG_ERROR("sql.sql", "Enchancment %u listed in `spell_enchant_proc_data` does not exist", enchantId); continue; } @@ -2256,7 +2256,7 @@ void SpellMgr::LoadSpellEnchantProcData() ++count; } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u enchant proc data definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u enchant proc data definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadSpellLinked() @@ -2269,7 +2269,7 @@ void SpellMgr::LoadSpellLinked() QueryResult result = WorldDatabase.Query("SELECT spell_trigger, spell_effect, type FROM spell_linked_spell"); if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 linked spells. DB table `spell_linked_spell` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 linked spells. DB table `spell_linked_spell` is empty."); return; } @@ -2285,13 +2285,13 @@ void SpellMgr::LoadSpellLinked() SpellInfo const* spellInfo = GetSpellInfo(abs(trigger)); if (!spellInfo) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u listed in `spell_linked_spell` does not exist", abs(trigger)); + TC_LOG_ERROR("sql.sql", "Spell %u listed in `spell_linked_spell` does not exist", abs(trigger)); continue; } spellInfo = GetSpellInfo(abs(effect)); if (!spellInfo) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u listed in `spell_linked_spell` does not exist", abs(effect)); + TC_LOG_ERROR("sql.sql", "Spell %u listed in `spell_linked_spell` does not exist", abs(effect)); continue; } @@ -2307,7 +2307,7 @@ void SpellMgr::LoadSpellLinked() ++count; } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u linked spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u linked spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadPetLevelupSpellMap() @@ -2363,7 +2363,7 @@ void SpellMgr::LoadPetLevelupSpellMap() } } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u pet levelup and default spells for %u families in %u ms", count, family_count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u pet levelup and default spells for %u families in %u ms", count, family_count, GetMSTimeDiffToNow(oldMSTime)); } bool LoadPetDefaultSpells_helper(CreatureTemplate const* cInfo, PetDefaultSpellsEntry& petDefSpells) @@ -2447,9 +2447,9 @@ void SpellMgr::LoadPetDefaultSpells() } } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded addition spells for %u pet spell data entries in %u ms", countData, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded addition spells for %u pet spell data entries in %u ms", countData, GetMSTimeDiffToNow(oldMSTime)); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading summonable creature templates..."); + TC_LOG_INFO("server.loading", "Loading summonable creature templates..."); oldMSTime = getMSTime(); // different summon spells @@ -2490,7 +2490,7 @@ void SpellMgr::LoadPetDefaultSpells() } } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u summonable creature templates in %u ms", countCreature, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u summonable creature templates in %u ms", countCreature, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadSpellAreas() @@ -2506,7 +2506,7 @@ void SpellMgr::LoadSpellAreas() QueryResult result = WorldDatabase.Query("SELECT spell, area, quest_start, quest_start_status, quest_end_status, quest_end, aura_spell, racemask, gender, autocast FROM spell_area"); if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell area requirements. DB table `spell_area` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 spell area requirements. DB table `spell_area` is empty."); return; } @@ -2536,7 +2536,7 @@ void SpellMgr::LoadSpellAreas() } else { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u listed in `spell_area` does not exist", spell); + TC_LOG_ERROR("sql.sql", "Spell %u listed in `spell_area` does not exist", spell); continue; } @@ -2565,20 +2565,20 @@ void SpellMgr::LoadSpellAreas() if (!ok) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u listed in `spell_area` already listed with similar requirements.", spell); + TC_LOG_ERROR("sql.sql", "Spell %u listed in `spell_area` already listed with similar requirements.", spell); continue; } } if (spellArea.areaId && !GetAreaEntryByAreaID(spellArea.areaId)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u listed in `spell_area` have wrong area (%u) requirement", spell, spellArea.areaId); + TC_LOG_ERROR("sql.sql", "Spell %u listed in `spell_area` have wrong area (%u) requirement", spell, spellArea.areaId); continue; } if (spellArea.questStart && !sObjectMgr->GetQuestTemplate(spellArea.questStart)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u listed in `spell_area` have wrong start quest (%u) requirement", spell, spellArea.questStart); + TC_LOG_ERROR("sql.sql", "Spell %u listed in `spell_area` have wrong start quest (%u) requirement", spell, spellArea.questStart); continue; } @@ -2586,7 +2586,7 @@ void SpellMgr::LoadSpellAreas() { if (!sObjectMgr->GetQuestTemplate(spellArea.questEnd)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u listed in `spell_area` have wrong end quest (%u) requirement", spell, spellArea.questEnd); + TC_LOG_ERROR("sql.sql", "Spell %u listed in `spell_area` have wrong end quest (%u) requirement", spell, spellArea.questEnd); continue; } } @@ -2596,13 +2596,13 @@ void SpellMgr::LoadSpellAreas() SpellInfo const* spellInfo = GetSpellInfo(abs(spellArea.auraSpell)); if (!spellInfo) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u listed in `spell_area` have wrong aura spell (%u) requirement", spell, abs(spellArea.auraSpell)); + TC_LOG_ERROR("sql.sql", "Spell %u listed in `spell_area` have wrong aura spell (%u) requirement", spell, abs(spellArea.auraSpell)); continue; } if (uint32(abs(spellArea.auraSpell)) == spellArea.spellId) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u listed in `spell_area` have aura spell (%u) requirement for itself", spell, abs(spellArea.auraSpell)); + TC_LOG_ERROR("sql.sql", "Spell %u listed in `spell_area` have aura spell (%u) requirement for itself", spell, abs(spellArea.auraSpell)); continue; } @@ -2622,7 +2622,7 @@ void SpellMgr::LoadSpellAreas() if (chain) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u listed in `spell_area` have aura spell (%u) requirement that itself autocast from aura", spell, spellArea.auraSpell); + TC_LOG_ERROR("sql.sql", "Spell %u listed in `spell_area` have aura spell (%u) requirement that itself autocast from aura", spell, spellArea.auraSpell); continue; } @@ -2638,7 +2638,7 @@ void SpellMgr::LoadSpellAreas() if (chain) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u listed in `spell_area` have aura spell (%u) requirement that itself autocast from aura", spell, spellArea.auraSpell); + TC_LOG_ERROR("sql.sql", "Spell %u listed in `spell_area` have aura spell (%u) requirement that itself autocast from aura", spell, spellArea.auraSpell); continue; } } @@ -2646,13 +2646,13 @@ void SpellMgr::LoadSpellAreas() if (spellArea.raceMask && (spellArea.raceMask & RACEMASK_ALL_PLAYABLE) == 0) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u listed in `spell_area` have wrong race mask (%u) requirement", spell, spellArea.raceMask); + TC_LOG_ERROR("sql.sql", "Spell %u listed in `spell_area` have wrong race mask (%u) requirement", spell, spellArea.raceMask); continue; } if (spellArea.gender != GENDER_NONE && spellArea.gender != GENDER_FEMALE && spellArea.gender != GENDER_MALE) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u listed in `spell_area` have wrong gender (%u) requirement", spell, spellArea.gender); + TC_LOG_ERROR("sql.sql", "Spell %u listed in `spell_area` have wrong gender (%u) requirement", spell, spellArea.gender); continue; } @@ -2677,7 +2677,7 @@ void SpellMgr::LoadSpellAreas() ++count; } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell area requirements in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u spell area requirements in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadSpellInfoStore() @@ -2691,7 +2691,7 @@ void SpellMgr::LoadSpellInfoStore() if (SpellEntry const* spellEntry = sSpellStore.LookupEntry(i)) mSpellInfoMap[i] = new SpellInfo(spellEntry); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded SpellInfo store in %u ms", GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded SpellInfo store in %u ms", GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::UnloadSpellInfoStore() @@ -3002,7 +3002,7 @@ void SpellMgr::LoadSpellInfoCustomAttributes() spellInfo->_InitializeExplicitTargetMask(); } - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded SpellInfo custom attributes in %u ms", GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded SpellInfo custom attributes in %u ms", GetMSTimeDiffToNow(oldMSTime)); } void SpellMgr::LoadSpellInfoCorrections() @@ -3146,6 +3146,7 @@ void SpellMgr::LoadSpellInfoCorrections() case 61588: // Blazing Harpoon case 52479: // Gift of the Harvester case 48246: // Ball of Flame + case 36327: // Shoot Arcane Explosion Arrow spellInfo->MaxAffectedTargets = 1; break; case 36384: // Skartax Purple Beam @@ -3220,6 +3221,9 @@ void SpellMgr::LoadSpellInfoCorrections() case 28200: // Ascendance (Talisman of Ascendance trinket) spellInfo->ProcCharges = 6; break; + case 37408: // Oscillation Field + spellInfo->AttributesEx3 |= SPELL_ATTR3_STACK_FOR_DIFF_CASTERS; + break; case 47201: // Everlasting Affliction case 47202: case 47203: @@ -3389,6 +3393,11 @@ void SpellMgr::LoadSpellInfoCorrections() case 34471: // The Beast Within spellInfo->AttributesEx5 |= SPELL_ATTR5_USABLE_WHILE_CONFUSED | SPELL_ATTR5_USABLE_WHILE_FEARED | SPELL_ATTR5_USABLE_WHILE_STUNNED; break; + case 56606: // Ride Jokkum + case 61791: // Ride Vehicle (Yogg-Saron) + /// @todo: remove this when basepoints of all Ride Vehicle auras are calculated correctly + spellInfo->Effects[EFFECT_0].BasePoints = 1; + break; // ULDUAR SPELLS // case 62374: // Pursued (Flame Leviathan) @@ -3427,10 +3436,6 @@ void SpellMgr::LoadSpellInfoCorrections() // that will be clear if we get more spells with problem like this spellInfo->AttributesEx |= SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY; break; - case 61791: // Ride Vehicle (Yogg-Saron) - // TODO: remove this when basepoints of all Ride Vehicle auras are calculated correctly - spellInfo->Effects[EFFECT_0].BasePoints = 1; - break; case 64468: // Empowering Shadows (Yogg-Saron) case 64486: // Empowering Shadows (Yogg-Saron) spellInfo->MaxAffectedTargets = 3; // same for both modes? @@ -3783,5 +3788,5 @@ void SpellMgr::LoadSpellInfoCorrections() if (SummonPropertiesEntry* properties = const_cast<SummonPropertiesEntry*>(sSummonPropertiesStore.LookupEntry(647))) // 52893 properties->Type = SUMMON_TYPE_TOTEM; - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded SpellInfo corrections in %u ms", GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded SpellInfo corrections in %u ms", GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp index 172a9dbcc52..3eae3f3d698 100644 --- a/src/server/game/Spells/SpellScript.cpp +++ b/src/server/game/Spells/SpellScript.cpp @@ -25,7 +25,7 @@ bool _SpellScript::_Validate(SpellInfo const* entry) { if (!Validate(entry)) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "Spell `%u` did not pass Validate() function of script `%s` - script will be not added to the spell", entry->Id, m_scriptName->c_str()); + TC_LOG_ERROR("scripts", "Spell `%u` did not pass Validate() function of script `%s` - script will be not added to the spell", entry->Id, m_scriptName->c_str()); return false; } return true; @@ -284,27 +284,27 @@ bool SpellScript::_Validate(SpellInfo const* entry) { for (std::list<EffectHandler>::iterator itr = OnEffectLaunch.begin(); itr != OnEffectLaunch.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - TC_LOG_ERROR(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectLaunch` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectLaunch` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list<EffectHandler>::iterator itr = OnEffectLaunchTarget.begin(); itr != OnEffectLaunchTarget.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - TC_LOG_ERROR(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectLaunchTarget` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectLaunchTarget` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list<EffectHandler>::iterator itr = OnEffectHit.begin(); itr != OnEffectHit.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - TC_LOG_ERROR(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectHit` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectHit` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list<EffectHandler>::iterator itr = OnEffectHitTarget.begin(); itr != OnEffectHitTarget.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - TC_LOG_ERROR(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectHitTarget` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectHitTarget` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list<ObjectAreaTargetSelectHandler>::iterator itr = OnObjectAreaTargetSelect.begin(); itr != OnObjectAreaTargetSelect.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - TC_LOG_ERROR(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnObjectAreaTargetSelect` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnObjectAreaTargetSelect` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list<ObjectTargetSelectHandler>::iterator itr = OnObjectTargetSelect.begin(); itr != OnObjectTargetSelect.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - TC_LOG_ERROR(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnObjectTargetSelect` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnObjectTargetSelect` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); return _SpellScript::_Validate(entry); } @@ -412,7 +412,7 @@ Unit* SpellScript::GetHitUnit() { if (!IsInTargetHook()) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::GetHitUnit was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + TC_LOG_ERROR("scripts", "Script: `%s` Spell: `%u`: function SpellScript::GetHitUnit was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return NULL; } return m_spell->unitTarget; @@ -422,7 +422,7 @@ Creature* SpellScript::GetHitCreature() { if (!IsInTargetHook()) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::GetHitCreature was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + TC_LOG_ERROR("scripts", "Script: `%s` Spell: `%u`: function SpellScript::GetHitCreature was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return NULL; } if (m_spell->unitTarget) @@ -435,7 +435,7 @@ Player* SpellScript::GetHitPlayer() { if (!IsInTargetHook()) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::GetHitPlayer was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + TC_LOG_ERROR("scripts", "Script: `%s` Spell: `%u`: function SpellScript::GetHitPlayer was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return NULL; } if (m_spell->unitTarget) @@ -448,7 +448,7 @@ Item* SpellScript::GetHitItem() { if (!IsInTargetHook()) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::GetHitItem was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + TC_LOG_ERROR("scripts", "Script: `%s` Spell: `%u`: function SpellScript::GetHitItem was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return NULL; } return m_spell->itemTarget; @@ -458,7 +458,7 @@ GameObject* SpellScript::GetHitGObj() { if (!IsInTargetHook()) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::GetHitGObj was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + TC_LOG_ERROR("scripts", "Script: `%s` Spell: `%u`: function SpellScript::GetHitGObj was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return NULL; } return m_spell->gameObjTarget; @@ -468,7 +468,7 @@ WorldLocation* SpellScript::GetHitDest() { if (!IsInEffectHook()) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::GetHitDest was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + TC_LOG_ERROR("scripts", "Script: `%s` Spell: `%u`: function SpellScript::GetHitDest was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return NULL; } return m_spell->destTarget; @@ -478,7 +478,7 @@ int32 SpellScript::GetHitDamage() { if (!IsInTargetHook()) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::GetHitDamage was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + TC_LOG_ERROR("scripts", "Script: `%s` Spell: `%u`: function SpellScript::GetHitDamage was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return 0; } return m_spell->m_damage; @@ -488,7 +488,7 @@ void SpellScript::SetHitDamage(int32 damage) { if (!IsInTargetHook()) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::SetHitDamage was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + TC_LOG_ERROR("scripts", "Script: `%s` Spell: `%u`: function SpellScript::SetHitDamage was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return; } m_spell->m_damage = damage; @@ -498,7 +498,7 @@ int32 SpellScript::GetHitHeal() { if (!IsInTargetHook()) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::GetHitHeal was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + TC_LOG_ERROR("scripts", "Script: `%s` Spell: `%u`: function SpellScript::GetHitHeal was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return 0; } return m_spell->m_healing; @@ -508,7 +508,7 @@ void SpellScript::SetHitHeal(int32 heal) { if (!IsInTargetHook()) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::SetHitHeal was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + TC_LOG_ERROR("scripts", "Script: `%s` Spell: `%u`: function SpellScript::SetHitHeal was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return; } m_spell->m_healing = heal; @@ -518,7 +518,7 @@ Aura* SpellScript::GetHitAura() { if (!IsInTargetHook()) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::GetHitAura was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + TC_LOG_ERROR("scripts", "Script: `%s` Spell: `%u`: function SpellScript::GetHitAura was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return NULL; } if (!m_spell->m_spellAura) @@ -532,7 +532,7 @@ void SpellScript::PreventHitAura() { if (!IsInTargetHook()) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::PreventHitAura was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + TC_LOG_ERROR("scripts", "Script: `%s` Spell: `%u`: function SpellScript::PreventHitAura was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return; } if (m_spell->m_spellAura) @@ -543,7 +543,7 @@ void SpellScript::PreventHitEffect(SpellEffIndex effIndex) { if (!IsInHitPhase() && !IsInEffectHook()) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::PreventHitEffect was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + TC_LOG_ERROR("scripts", "Script: `%s` Spell: `%u`: function SpellScript::PreventHitEffect was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return; } m_hitPreventEffectMask |= 1 << effIndex; @@ -554,7 +554,7 @@ void SpellScript::PreventHitDefaultEffect(SpellEffIndex effIndex) { if (!IsInHitPhase() && !IsInEffectHook()) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::PreventHitDefaultEffect was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + TC_LOG_ERROR("scripts", "Script: `%s` Spell: `%u`: function SpellScript::PreventHitDefaultEffect was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return; } m_hitPreventDefaultEffectMask |= 1 << effIndex; @@ -564,7 +564,7 @@ int32 SpellScript::GetEffectValue() { if (!IsInEffectHook()) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::PreventHitDefaultEffect was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + TC_LOG_ERROR("scripts", "Script: `%s` Spell: `%u`: function SpellScript::PreventHitDefaultEffect was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return 0; } return m_spell->damage; @@ -595,7 +595,7 @@ void SpellScript::SetCustomCastResultMessage(SpellCustomErrors result) { if (!IsInCheckCastHook()) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::SetCustomCastResultMessage was called while spell not in check cast phase!", m_scriptName->c_str(), m_scriptSpellId); + TC_LOG_ERROR("scripts", "Script: `%s` Spell: `%u`: function SpellScript::SetCustomCastResultMessage was called while spell not in check cast phase!", m_scriptName->c_str(), m_scriptSpellId); return; } @@ -611,95 +611,95 @@ bool AuraScript::_Validate(SpellInfo const* entry) { for (std::list<CheckAreaTargetHandler>::iterator itr = DoCheckAreaTarget.begin(); itr != DoCheckAreaTarget.end(); ++itr) if (!entry->HasAreaAuraEffect() && !entry->HasEffect(SPELL_EFFECT_PERSISTENT_AREA_AURA)) - TC_LOG_ERROR(LOG_FILTER_TSCR, "Spell `%u` of script `%s` does not have area aura effect - handler bound to hook `DoCheckAreaTarget` of AuraScript won't be executed", entry->Id, m_scriptName->c_str()); + TC_LOG_ERROR("scripts", "Spell `%u` of script `%s` does not have area aura effect - handler bound to hook `DoCheckAreaTarget` of AuraScript won't be executed", entry->Id, m_scriptName->c_str()); for (std::list<AuraDispelHandler>::iterator itr = OnDispel.begin(); itr != OnDispel.end(); ++itr) if (!entry->HasEffect(SPELL_EFFECT_APPLY_AURA) && !entry->HasAreaAuraEffect()) - TC_LOG_ERROR(LOG_FILTER_TSCR, "Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `OnDispel` of AuraScript won't be executed", entry->Id, m_scriptName->c_str()); + TC_LOG_ERROR("scripts", "Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `OnDispel` of AuraScript won't be executed", entry->Id, m_scriptName->c_str()); for (std::list<AuraDispelHandler>::iterator itr = AfterDispel.begin(); itr != AfterDispel.end(); ++itr) if (!entry->HasEffect(SPELL_EFFECT_APPLY_AURA) && !entry->HasAreaAuraEffect()) - TC_LOG_ERROR(LOG_FILTER_TSCR, "Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `AfterDispel` of AuraScript won't be executed", entry->Id, m_scriptName->c_str()); + TC_LOG_ERROR("scripts", "Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `AfterDispel` of AuraScript won't be executed", entry->Id, m_scriptName->c_str()); for (std::list<EffectApplyHandler>::iterator itr = OnEffectApply.begin(); itr != OnEffectApply.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - TC_LOG_ERROR(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectApply` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectApply` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list<EffectApplyHandler>::iterator itr = OnEffectRemove.begin(); itr != OnEffectRemove.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - TC_LOG_ERROR(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectRemove` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectRemove` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list<EffectApplyHandler>::iterator itr = AfterEffectApply.begin(); itr != AfterEffectApply.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - TC_LOG_ERROR(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectApply` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectApply` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list<EffectApplyHandler>::iterator itr = AfterEffectRemove.begin(); itr != AfterEffectRemove.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - TC_LOG_ERROR(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectRemove` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectRemove` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list<EffectPeriodicHandler>::iterator itr = OnEffectPeriodic.begin(); itr != OnEffectPeriodic.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - TC_LOG_ERROR(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectPeriodic` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectPeriodic` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list<EffectUpdatePeriodicHandler>::iterator itr = OnEffectUpdatePeriodic.begin(); itr != OnEffectUpdatePeriodic.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - TC_LOG_ERROR(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectUpdatePeriodic` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectUpdatePeriodic` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list<EffectCalcAmountHandler>::iterator itr = DoEffectCalcAmount.begin(); itr != DoEffectCalcAmount.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - TC_LOG_ERROR(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `DoEffectCalcAmount` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `DoEffectCalcAmount` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list<EffectCalcPeriodicHandler>::iterator itr = DoEffectCalcPeriodic.begin(); itr != DoEffectCalcPeriodic.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - TC_LOG_ERROR(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `DoEffectCalcPeriodic` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `DoEffectCalcPeriodic` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list<EffectCalcSpellModHandler>::iterator itr = DoEffectCalcSpellMod.begin(); itr != DoEffectCalcSpellMod.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - TC_LOG_ERROR(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `DoEffectCalcSpellMod` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `DoEffectCalcSpellMod` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list<EffectAbsorbHandler>::iterator itr = OnEffectAbsorb.begin(); itr != OnEffectAbsorb.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - TC_LOG_ERROR(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectAbsorb` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectAbsorb` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list<EffectAbsorbHandler>::iterator itr = AfterEffectAbsorb.begin(); itr != AfterEffectAbsorb.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - TC_LOG_ERROR(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectAbsorb` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectAbsorb` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list<EffectManaShieldHandler>::iterator itr = OnEffectManaShield.begin(); itr != OnEffectManaShield.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - TC_LOG_ERROR(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectManaShield` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectManaShield` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list<EffectManaShieldHandler>::iterator itr = AfterEffectManaShield.begin(); itr != AfterEffectManaShield.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - TC_LOG_ERROR(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectManaShield` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectManaShield` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list<EffectSplitHandler>::iterator itr = OnEffectSplit.begin(); itr != OnEffectSplit.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - TC_LOG_ERROR(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectSplit` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectSplit` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list<CheckProcHandler>::iterator itr = DoCheckProc.begin(); itr != DoCheckProc.end(); ++itr) if (!entry->HasEffect(SPELL_EFFECT_APPLY_AURA) && !entry->HasAreaAuraEffect()) - TC_LOG_ERROR(LOG_FILTER_TSCR, "Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `DoCheckProc` of AuraScript won't be executed", entry->Id, m_scriptName->c_str()); + TC_LOG_ERROR("scripts", "Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `DoCheckProc` of AuraScript won't be executed", entry->Id, m_scriptName->c_str()); for (std::list<AuraProcHandler>::iterator itr = DoPrepareProc.begin(); itr != DoPrepareProc.end(); ++itr) if (!entry->HasEffect(SPELL_EFFECT_APPLY_AURA) && !entry->HasAreaAuraEffect()) - TC_LOG_ERROR(LOG_FILTER_TSCR, "Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `DoPrepareProc` of AuraScript won't be executed", entry->Id, m_scriptName->c_str()); + TC_LOG_ERROR("scripts", "Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `DoPrepareProc` of AuraScript won't be executed", entry->Id, m_scriptName->c_str()); for (std::list<AuraProcHandler>::iterator itr = OnProc.begin(); itr != OnProc.end(); ++itr) if (!entry->HasEffect(SPELL_EFFECT_APPLY_AURA) && !entry->HasAreaAuraEffect()) - TC_LOG_ERROR(LOG_FILTER_TSCR, "Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `OnProc` of AuraScript won't be executed", entry->Id, m_scriptName->c_str()); + TC_LOG_ERROR("scripts", "Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `OnProc` of AuraScript won't be executed", entry->Id, m_scriptName->c_str()); for (std::list<AuraProcHandler>::iterator itr = AfterProc.begin(); itr != AfterProc.end(); ++itr) if (!entry->HasEffect(SPELL_EFFECT_APPLY_AURA) && !entry->HasAreaAuraEffect()) - TC_LOG_ERROR(LOG_FILTER_TSCR, "Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `AfterProc` of AuraScript won't be executed", entry->Id, m_scriptName->c_str()); + TC_LOG_ERROR("scripts", "Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `AfterProc` of AuraScript won't be executed", entry->Id, m_scriptName->c_str()); for (std::list<EffectProcHandler>::iterator itr = OnEffectProc.begin(); itr != OnEffectProc.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - TC_LOG_ERROR(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectProc` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectProc` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list<EffectProcHandler>::iterator itr = AfterEffectProc.begin(); itr != AfterEffectProc.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - TC_LOG_ERROR(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectProc` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectProc` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); return _SpellScript::_Validate(entry); } @@ -929,7 +929,7 @@ void AuraScript::PreventDefaultAction() m_defaultActionPrevented = true; break; default: - TC_LOG_ERROR(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u` AuraScript::PreventDefaultAction called in a hook in which the call won't have effect!", m_scriptName->c_str(), m_scriptSpellId); + TC_LOG_ERROR("scripts", "Script: `%s` Spell: `%u` AuraScript::PreventDefaultAction called in a hook in which the call won't have effect!", m_scriptName->c_str(), m_scriptSpellId); break; } } @@ -1116,7 +1116,7 @@ Unit* AuraScript::GetTarget() const case AURA_SCRIPT_HOOK_EFFECT_AFTER_PROC: return m_auraApplication->GetTarget(); default: - TC_LOG_ERROR(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u` AuraScript::GetTarget called in a hook in which the call won't have effect!", m_scriptName->c_str(), m_scriptSpellId); + TC_LOG_ERROR("scripts", "Script: `%s` Spell: `%u` AuraScript::GetTarget called in a hook in which the call won't have effect!", m_scriptName->c_str(), m_scriptSpellId); } return NULL; diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h index fe5f102dbe9..0d5643bc50c 100644 --- a/src/server/game/Spells/SpellScript.h +++ b/src/server/game/Spells/SpellScript.h @@ -60,7 +60,7 @@ class _SpellScript virtual bool _Validate(SpellInfo const* entry); public: - _SpellScript() : m_currentScriptState(SPELL_SCRIPT_STATE_NONE) { } + _SpellScript() : m_currentScriptState(SPELL_SCRIPT_STATE_NONE), m_scriptName(NULL), m_scriptSpellId(0) {} virtual ~_SpellScript() { } virtual void _Register(); virtual void _Unload(); diff --git a/src/server/game/Texts/CreatureTextMgr.cpp b/src/server/game/Texts/CreatureTextMgr.cpp index 06989544f55..264b69750f0 100644 --- a/src/server/game/Texts/CreatureTextMgr.cpp +++ b/src/server/game/Texts/CreatureTextMgr.cpp @@ -118,7 +118,7 @@ void CreatureTextMgr::LoadCreatureTexts() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 ceature texts. DB table `creature_texts` is empty."); + TC_LOG_INFO("server.loading", ">> Loaded 0 ceature texts. DB table `creature_texts` is empty."); return; } @@ -145,25 +145,25 @@ void CreatureTextMgr::LoadCreatureTexts() if (temp.sound) { if (!sSoundEntriesStore.LookupEntry(temp.sound)){ - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureTextMgr: Entry %u, Group %u in table `creature_texts` has Sound %u but sound does not exist.", temp.entry, temp.group, temp.sound); + TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u in table `creature_texts` has Sound %u but sound does not exist.", temp.entry, temp.group, temp.sound); temp.sound = 0; } } if (!GetLanguageDescByID(temp.lang)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureTextMgr: Entry %u, Group %u in table `creature_texts` using Language %u but Language does not exist.", temp.entry, temp.group, uint32(temp.lang)); + TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u in table `creature_texts` using Language %u but Language does not exist.", temp.entry, temp.group, uint32(temp.lang)); temp.lang = LANG_UNIVERSAL; } if (temp.type >= MAX_CHAT_MSG_TYPE) { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureTextMgr: Entry %u, Group %u in table `creature_texts` has Type %u but this Chat Type does not exist.", temp.entry, temp.group, uint32(temp.type)); + TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u in table `creature_texts` has Type %u but this Chat Type does not exist.", temp.entry, temp.group, uint32(temp.type)); temp.type = CHAT_MSG_SAY; } if (temp.emote) { if (!sEmotesStore.LookupEntry(temp.emote)) { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureTextMgr: Entry %u, Group %u in table `creature_texts` has Emote %u but emote does not exist.", temp.entry, temp.group, uint32(temp.emote)); + TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u in table `creature_texts` has Emote %u but emote does not exist.", temp.entry, temp.group, uint32(temp.emote)); temp.emote = EMOTE_ONESHOT_NONE; } } @@ -177,7 +177,7 @@ void CreatureTextMgr::LoadCreatureTexts() ++textCount; } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature texts for %u creatures in %u ms", textCount, creatureCount, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u creature texts for %u creatures in %u ms", textCount, creatureCount, GetMSTimeDiffToNow(oldMSTime)); } @@ -207,7 +207,7 @@ void CreatureTextMgr::LoadCreatureTextLocales() ++textCount; } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature localized texts in %u ms", textCount, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u creature localized texts in %u ms", textCount, GetMSTimeDiffToNow(oldMSTime)); } @@ -219,7 +219,7 @@ uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, uint64 whisp CreatureTextMap::const_iterator sList = mTextMap.find(source->GetEntry()); if (sList == mTextMap.end()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureTextMgr: Could not find Text for Creature(%s) Entry %u in 'creature_text' table. Ignoring.", source->GetName().c_str(), source->GetEntry()); + TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Could not find Text for Creature(%s) Entry %u in 'creature_text' table. Ignoring.", source->GetName().c_str(), source->GetEntry()); return 0; } @@ -227,7 +227,7 @@ uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, uint64 whisp CreatureTextHolder::const_iterator itr = textHolder.find(textGroup); if (itr == textHolder.end()) { - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureTextMgr: Could not find TextGroup %u for Creature(%s) GuidLow %u Entry %u. Ignoring.", uint32(textGroup), source->GetName().c_str(), source->GetGUIDLow(), source->GetEntry()); + TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Could not find TextGroup %u for Creature(%s) GuidLow %u Entry %u. Ignoring.", uint32(textGroup), source->GetName().c_str(), source->GetGUIDLow(), source->GetEntry()); return 0; } @@ -432,7 +432,7 @@ void CreatureTextMgr::SetRepeatId(Creature* source, uint8 textGroup, uint8 id) if (std::find(repeats.begin(), repeats.end(), id) == repeats.end()) repeats.push_back(id); else - TC_LOG_ERROR(LOG_FILTER_SQL, "CreatureTextMgr: TextGroup %u for Creature(%s) GuidLow %u Entry %u, id %u already added", uint32(textGroup), source->GetName().c_str(), source->GetGUIDLow(), source->GetEntry(), uint32(id)); + TC_LOG_ERROR("sql.sql", "CreatureTextMgr: TextGroup %u for Creature(%s) GuidLow %u Entry %u, id %u already added", uint32(textGroup), source->GetName().c_str(), source->GetGUIDLow(), source->GetEntry(), uint32(id)); } CreatureTextRepeatIds CreatureTextMgr::GetRepeatGroup(Creature* source, uint8 textGroup) @@ -458,7 +458,7 @@ bool CreatureTextMgr::TextExist(uint32 sourceEntry, uint8 textGroup) CreatureTextMap::const_iterator sList = mTextMap.find(sourceEntry); if (sList == mTextMap.end()) { - TC_LOG_DEBUG(LOG_FILTER_UNITS, "CreatureTextMgr::TextExist: Could not find Text for Creature (entry %u) in 'creature_text' table.", sourceEntry); + TC_LOG_DEBUG("entities.unit", "CreatureTextMgr::TextExist: Could not find Text for Creature (entry %u) in 'creature_text' table.", sourceEntry); return false; } @@ -466,7 +466,7 @@ bool CreatureTextMgr::TextExist(uint32 sourceEntry, uint8 textGroup) CreatureTextHolder::const_iterator itr = textHolder.find(textGroup); if (itr == textHolder.end()) { - TC_LOG_DEBUG(LOG_FILTER_UNITS, "CreatureTextMgr::TextExist: Could not find TextGroup %u for Creature (entry %u).", uint32(textGroup), sourceEntry); + TC_LOG_DEBUG("entities.unit", "CreatureTextMgr::TextExist: Could not find TextGroup %u for Creature (entry %u).", uint32(textGroup), sourceEntry); return false; } diff --git a/src/server/game/Tickets/TicketMgr.cpp b/src/server/game/Tickets/TicketMgr.cpp index 608f0a1ace5..528f17bd259 100644 --- a/src/server/game/Tickets/TicketMgr.cpp +++ b/src/server/game/Tickets/TicketMgr.cpp @@ -32,9 +32,11 @@ inline float GetAge(uint64 t) { return float(time(NULL) - t) / DAY; } /////////////////////////////////////////////////////////////////////////////////////////////////// // GM ticket -GmTicket::GmTicket() { } +GmTicket::GmTicket() : _id(0), _playerGuid(0), _posX(0), _posY(0), _posZ(0), _mapId(0), _createTime(0), _lastModifiedTime(0), + _closedBy(0), _assignedTo(0), _completed(false), _escalatedStatus(TICKET_UNASSIGNED), _viewed(false), + _needResponse(false), _haveTicket(false) { } -GmTicket::GmTicket(Player* player, WorldPacket& recvData) : _createTime(time(NULL)), _lastModifiedTime(time(NULL)), _closedBy(0), _assignedTo(0), _completed(false), _escalatedStatus(TICKET_UNASSIGNED), _haveTicket(false) +GmTicket::GmTicket(Player* player, WorldPacket& recvData) : _createTime(time(NULL)), _lastModifiedTime(time(NULL)), _closedBy(0), _assignedTo(0), _completed(false), _escalatedStatus(TICKET_UNASSIGNED), _viewed(false), _haveTicket(false) { _id = sTicketMgr->GenerateTicketId(); _playerName = player->GetName(); @@ -289,7 +291,7 @@ void TicketMgr::LoadTickets() PreparedQueryResult result = CharacterDatabase.Query(stmt); if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 GM tickets. DB table `gm_tickets` is empty!"); + TC_LOG_INFO("server.loading", ">> Loaded 0 GM tickets. DB table `gm_tickets` is empty!"); return; } @@ -316,7 +318,7 @@ void TicketMgr::LoadTickets() ++count; } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u GM tickets in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u GM tickets in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -329,7 +331,7 @@ void TicketMgr::LoadSurveys() if (QueryResult result = CharacterDatabase.Query("SELECT MAX(surveyId) FROM gm_surveys")) _lastSurveyId = (*result)[0].GetUInt32(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded GM Survey count from database in %u ms", GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded GM Survey count from database in %u ms", GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/Tools/CharacterDatabaseCleaner.cpp b/src/server/game/Tools/CharacterDatabaseCleaner.cpp index b14bd585b8b..9f3787e5943 100644 --- a/src/server/game/Tools/CharacterDatabaseCleaner.cpp +++ b/src/server/game/Tools/CharacterDatabaseCleaner.cpp @@ -30,7 +30,7 @@ void CharacterDatabaseCleaner::CleanDatabase() if (!sWorld->getBoolConfig(CONFIG_CLEAN_CHARACTER_DB)) return; - TC_LOG_INFO(LOG_FILTER_GENERAL, "Cleaning character database..."); + TC_LOG_INFO("misc", "Cleaning character database..."); uint32 oldMSTime = getMSTime(); @@ -64,7 +64,7 @@ void CharacterDatabaseCleaner::CleanDatabase() sWorld->SetCleaningFlags(flags); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Cleaned character database in %u ms", GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Cleaned character database in %u ms", GetMSTimeDiffToNow(oldMSTime)); } void CharacterDatabaseCleaner::CheckUnique(const char* column, const char* table, bool (*check)(uint32)) @@ -72,7 +72,7 @@ void CharacterDatabaseCleaner::CheckUnique(const char* column, const char* table QueryResult result = CharacterDatabase.PQuery("SELECT DISTINCT %s FROM %s", column, table); if (!result) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Table %s is empty.", table); + TC_LOG_INFO("misc", "Table %s is empty.", table); return; } diff --git a/src/server/game/Tools/PlayerDump.cpp b/src/server/game/Tools/PlayerDump.cpp index f7c7414fb6f..087233c5c80 100644 --- a/src/server/game/Tools/PlayerDump.cpp +++ b/src/server/game/Tools/PlayerDump.cpp @@ -321,7 +321,7 @@ bool PlayerDumpWriter::DumpTable(std::string& dump, uint32 guid, char const*tabl case DTT_CHARACTER: { if (result->GetFieldCount() <= 68) // avoid crashes on next check - TC_LOG_FATAL(LOG_FILTER_GENERAL, "PlayerDumpWriter::DumpTable - Trying to access non-existing or wrong positioned field (`deleteInfos_Account`) in `characters` table."); + TC_LOG_FATAL("misc", "PlayerDumpWriter::DumpTable - Trying to access non-existing or wrong positioned field (`deleteInfos_Account`) in `characters` table."); if (result->Fetch()[68].GetUInt32()) // characters.deleteInfos_Account - if filled error return false; @@ -497,7 +497,7 @@ DumpReturn PlayerDumpReader::LoadDump(std::string const& file, uint32 account, s std::string tn = gettablename(line); if (tn.empty()) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "LoadPlayerDump: Can't extract table name from line: '%s'!", line.c_str()); + TC_LOG_ERROR("misc", "LoadPlayerDump: Can't extract table name from line: '%s'!", line.c_str()); ROLLBACK(DUMP_FILE_BROKEN); } @@ -514,7 +514,7 @@ DumpReturn PlayerDumpReader::LoadDump(std::string const& file, uint32 account, s if (i == DUMP_TABLE_COUNT) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "LoadPlayerDump: Unknown table: '%s'!", tn.c_str()); + TC_LOG_ERROR("misc", "LoadPlayerDump: Unknown table: '%s'!", tn.c_str()); ROLLBACK(DUMP_FILE_BROKEN); } @@ -664,7 +664,7 @@ DumpReturn PlayerDumpReader::LoadDump(std::string const& file, uint32 account, s break; } default: - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Unknown dump table type: %u", type); + TC_LOG_ERROR("misc", "Unknown dump table type: %u", type); break; } diff --git a/src/server/game/Warden/Warden.cpp b/src/server/game/Warden/Warden.cpp index 5e2cd82f6cc..6ff2f0f562f 100644 --- a/src/server/game/Warden/Warden.cpp +++ b/src/server/game/Warden/Warden.cpp @@ -30,7 +30,13 @@ #include "Warden.h" #include "AccountMgr.h" -Warden::Warden() : _inputCrypto(16), _outputCrypto(16), _checkTimer(10000/*10 sec*/), _clientResponseTimer(0), _dataSent(false), _initialized(false) { } +Warden::Warden() : _session(NULL), _inputCrypto(16), _outputCrypto(16), _checkTimer(10000/*10 sec*/), _clientResponseTimer(0), + _dataSent(false), _previousTimestamp(0), _module(NULL), _initialized(false) +{ + memset(_inputKey, 0, sizeof(_inputKey)); + memset(_outputKey, 0, sizeof(_outputKey)); + memset(_seed, 0, sizeof(_seed)); +} Warden::~Warden() { @@ -42,7 +48,7 @@ Warden::~Warden() void Warden::SendModuleToClient() { - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "Send module to client"); + TC_LOG_DEBUG("warden", "Send module to client"); // Create packet structure WardenModuleTransfer packet; @@ -68,7 +74,7 @@ void Warden::SendModuleToClient() void Warden::RequestModule() { - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "Request module"); + TC_LOG_DEBUG("warden", "Request module"); // Create packet structure WardenModuleUse request; @@ -103,7 +109,7 @@ void Warden::Update() // Kick player if client response delays more than set in config if (_clientResponseTimer > maxClientResponseDelay * IN_MILLISECONDS) { - TC_LOG_WARN(LOG_FILTER_WARDEN, "%s (latency: %u, IP: %s) exceeded Warden module response delay for more than %s - disconnecting client", + TC_LOG_WARN("warden", "%s (latency: %u, IP: %s) exceeded Warden module response delay for more than %s - disconnecting client", _session->GetPlayerInfo().c_str(), _session->GetLatency(), _session->GetRemoteAddress().c_str(), secsToTimeString(maxClientResponseDelay, true).c_str()); _session->KickPlayer(); } @@ -139,12 +145,12 @@ bool Warden::IsValidCheckSum(uint32 checksum, const uint8* data, const uint16 le if (checksum != newChecksum) { - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "CHECKSUM IS NOT VALID"); + TC_LOG_DEBUG("warden", "CHECKSUM IS NOT VALID"); return false; } else { - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "CHECKSUM IS VALID"); + TC_LOG_DEBUG("warden", "CHECKSUM IS VALID"); return true; } } @@ -220,7 +226,7 @@ void WorldSession::HandleWardenDataOpcode(WorldPacket& recvData) _warden->DecryptData(recvData.contents(), recvData.size()); uint8 opcode; recvData >> opcode; - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "Got packet, opcode %02X, size %u", opcode, uint32(recvData.size())); + TC_LOG_DEBUG("warden", "Got packet, opcode %02X, size %u", opcode, uint32(recvData.size())); recvData.hexlike(); switch (opcode) @@ -235,17 +241,17 @@ void WorldSession::HandleWardenDataOpcode(WorldPacket& recvData) _warden->HandleData(recvData); break; case WARDEN_CMSG_MEM_CHECKS_RESULT: - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "NYI WARDEN_CMSG_MEM_CHECKS_RESULT received!"); + TC_LOG_DEBUG("warden", "NYI WARDEN_CMSG_MEM_CHECKS_RESULT received!"); break; case WARDEN_CMSG_HASH_RESULT: _warden->HandleHashResult(recvData); _warden->InitializeModule(); break; case WARDEN_CMSG_MODULE_FAILED: - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "NYI WARDEN_CMSG_MODULE_FAILED received!"); + TC_LOG_DEBUG("warden", "NYI WARDEN_CMSG_MODULE_FAILED received!"); break; default: - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "Got unknown warden opcode %02X of size %u.", opcode, uint32(recvData.size() - 1)); + TC_LOG_DEBUG("warden", "Got unknown warden opcode %02X of size %u.", opcode, uint32(recvData.size() - 1)); break; } } diff --git a/src/server/game/Warden/WardenCheckMgr.cpp b/src/server/game/Warden/WardenCheckMgr.cpp index cdd2a2f6bac..0aac3711137 100644 --- a/src/server/game/Warden/WardenCheckMgr.cpp +++ b/src/server/game/Warden/WardenCheckMgr.cpp @@ -41,7 +41,7 @@ void WardenCheckMgr::LoadWardenChecks() // Check if Warden is enabled by config before loading anything if (!sWorld->getBoolConfig(CONFIG_WARDEN_ENABLED)) { - TC_LOG_INFO(LOG_FILTER_WARDEN, ">> Warden disabled, loading checks skipped."); + TC_LOG_INFO("warden", ">> Warden disabled, loading checks skipped."); return; } @@ -49,7 +49,7 @@ void WardenCheckMgr::LoadWardenChecks() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 Warden checks. DB table `warden_checks` is empty!"); + TC_LOG_INFO("server.loading", ">> Loaded 0 Warden checks. DB table `warden_checks` is empty!"); return; } @@ -141,7 +141,7 @@ void WardenCheckMgr::LoadWardenChecks() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u warden checks.", count); + TC_LOG_INFO("server.loading", ">> Loaded %u warden checks.", count); } void WardenCheckMgr::LoadWardenOverrides() @@ -149,7 +149,7 @@ void WardenCheckMgr::LoadWardenOverrides() // Check if Warden is enabled by config before loading anything if (!sWorld->getBoolConfig(CONFIG_WARDEN_ENABLED)) { - TC_LOG_INFO(LOG_FILTER_WARDEN, ">> Warden disabled, loading check overrides skipped."); + TC_LOG_INFO("warden", ">> Warden disabled, loading check overrides skipped."); return; } @@ -158,7 +158,7 @@ void WardenCheckMgr::LoadWardenOverrides() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 Warden action overrides. DB table `warden_action` is empty!"); + TC_LOG_INFO("server.loading", ">> Loaded 0 Warden action overrides. DB table `warden_action` is empty!"); return; } @@ -175,10 +175,10 @@ void WardenCheckMgr::LoadWardenOverrides() // Check if action value is in range (0-2, see WardenActions enum) if (action > WARDEN_ACTION_BAN) - TC_LOG_ERROR(LOG_FILTER_WARDEN, "Warden check override action out of range (ID: %u, action: %u)", checkId, action); + TC_LOG_ERROR("warden", "Warden check override action out of range (ID: %u, action: %u)", checkId, action); // Check if check actually exists before accessing the CheckStore vector else if (checkId > CheckStore.size()) - TC_LOG_ERROR(LOG_FILTER_WARDEN, "Warden check action override for non-existing check (ID: %u, action: %u), skipped", checkId, action); + TC_LOG_ERROR("warden", "Warden check action override for non-existing check (ID: %u, action: %u), skipped", checkId, action); else { CheckStore[checkId]->Action = WardenActions(action); @@ -187,7 +187,7 @@ void WardenCheckMgr::LoadWardenOverrides() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u warden action overrides.", count); + TC_LOG_INFO("server.loading", ">> Loaded %u warden action overrides.", count); } WardenCheck* WardenCheckMgr::GetWardenDataById(uint16 Id) diff --git a/src/server/game/Warden/WardenMac.cpp b/src/server/game/Warden/WardenMac.cpp index 1cd4a4ea877..a232a0e0b39 100644 --- a/src/server/game/Warden/WardenMac.cpp +++ b/src/server/game/Warden/WardenMac.cpp @@ -54,16 +54,16 @@ void WardenMac::Init(WorldSession* pClient, BigNumber* K) _inputCrypto.Init(_inputKey); _outputCrypto.Init(_outputKey); - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "Server side warden for client %u initializing...", pClient->GetAccountId()); - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "C->S Key: %s", ByteArrayToHexStr(_inputKey, 16).c_str()); - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "S->C Key: %s", ByteArrayToHexStr(_outputKey, 16).c_str()); - TC_LOG_DEBUG(LOG_FILTER_WARDEN, " Seed: %s", ByteArrayToHexStr(_seed, 16).c_str()); - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "Loading Module..."); + TC_LOG_DEBUG("warden", "Server side warden for client %u initializing...", pClient->GetAccountId()); + TC_LOG_DEBUG("warden", "C->S Key: %s", ByteArrayToHexStr(_inputKey, 16).c_str()); + TC_LOG_DEBUG("warden", "S->C Key: %s", ByteArrayToHexStr(_outputKey, 16).c_str()); + TC_LOG_DEBUG("warden", " Seed: %s", ByteArrayToHexStr(_seed, 16).c_str()); + TC_LOG_DEBUG("warden", "Loading Module..."); _module = GetModuleForClient(); - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "Module Key: %s", ByteArrayToHexStr(_module->Key, 16).c_str()); - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "Module ID: %s", ByteArrayToHexStr(_module->Id, 16).c_str()); + TC_LOG_DEBUG("warden", "Module Key: %s", ByteArrayToHexStr(_module->Key, 16).c_str()); + TC_LOG_DEBUG("warden", "Module ID: %s", ByteArrayToHexStr(_module->Id, 16).c_str()); RequestModule(); } @@ -90,12 +90,12 @@ ClientWardenModule* WardenMac::GetModuleForClient() void WardenMac::InitializeModule() { - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "Initialize module"); + TC_LOG_DEBUG("warden", "Initialize module"); } void WardenMac::RequestHash() { - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "Request hash"); + TC_LOG_DEBUG("warden", "Request hash"); // Create packet structure WardenHashRequest Request; @@ -163,11 +163,11 @@ void WardenMac::HandleHashResult(ByteBuffer &buff) // Verify key if (memcmp(buff.contents() + 1, sha1.GetDigest(), 20) != 0) { - TC_LOG_WARN(LOG_FILTER_WARDEN, "%s failed hash reply. Action: %s", _session->GetPlayerInfo().c_str(), Penalty().c_str()); + TC_LOG_WARN("warden", "%s failed hash reply. Action: %s", _session->GetPlayerInfo().c_str(), Penalty().c_str()); return; } - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "Request hash reply: succeed"); + TC_LOG_DEBUG("warden", "Request hash reply: succeed"); // client 7F96EEFDA5B63D20A4DF8E00CBF48304 //const uint8 client_key[16] = { 0x7F, 0x96, 0xEE, 0xFD, 0xA5, 0xB6, 0x3D, 0x20, 0xA4, 0xDF, 0x8E, 0x00, 0xCB, 0xF4, 0x83, 0x04 }; @@ -189,7 +189,7 @@ void WardenMac::HandleHashResult(ByteBuffer &buff) void WardenMac::RequestData() { - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "Request data"); + TC_LOG_DEBUG("warden", "Request data"); ByteBuffer buff; buff << uint8(WARDEN_SMSG_CHEAT_CHECKS_REQUEST); @@ -213,7 +213,7 @@ void WardenMac::RequestData() void WardenMac::HandleData(ByteBuffer &buff) { - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "Handle data"); + TC_LOG_DEBUG("warden", "Handle data"); _dataSent = false; _clientResponseTimer = 0; @@ -246,7 +246,7 @@ void WardenMac::HandleData(ByteBuffer &buff) if (memcmp(sha1Hash, sha1.GetDigest(), 20)) { - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "Handle data failed: SHA1 hash is wrong!"); + TC_LOG_DEBUG("warden", "Handle data failed: SHA1 hash is wrong!"); //found = true; } @@ -261,7 +261,7 @@ void WardenMac::HandleData(ByteBuffer &buff) if (memcmp(ourMD5Hash, theirsMD5Hash, 16)) { - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "Handle data failed: MD5 hash is wrong!"); + TC_LOG_DEBUG("warden", "Handle data failed: MD5 hash is wrong!"); //found = true; } diff --git a/src/server/game/Warden/WardenWin.cpp b/src/server/game/Warden/WardenWin.cpp index a9fcc041ff6..d3225fe445b 100644 --- a/src/server/game/Warden/WardenWin.cpp +++ b/src/server/game/Warden/WardenWin.cpp @@ -34,7 +34,7 @@ #include "WardenCheckMgr.h" #include "AccountMgr.h" -WardenWin::WardenWin() : Warden() { } +WardenWin::WardenWin() : Warden(), _serverTicks(0) {} WardenWin::~WardenWin() { } @@ -50,16 +50,16 @@ void WardenWin::Init(WorldSession* session, BigNumber* k) _inputCrypto.Init(_inputKey); _outputCrypto.Init(_outputKey); - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "Server side warden for client %u initializing...", session->GetAccountId()); - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "C->S Key: %s", ByteArrayToHexStr(_inputKey, 16).c_str()); - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "S->C Key: %s", ByteArrayToHexStr(_outputKey, 16).c_str()); - TC_LOG_DEBUG(LOG_FILTER_WARDEN, " Seed: %s", ByteArrayToHexStr(_seed, 16).c_str()); - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "Loading Module..."); + TC_LOG_DEBUG("warden", "Server side warden for client %u initializing...", session->GetAccountId()); + TC_LOG_DEBUG("warden", "C->S Key: %s", ByteArrayToHexStr(_inputKey, 16).c_str()); + TC_LOG_DEBUG("warden", "S->C Key: %s", ByteArrayToHexStr(_outputKey, 16).c_str()); + TC_LOG_DEBUG("warden", " Seed: %s", ByteArrayToHexStr(_seed, 16).c_str()); + TC_LOG_DEBUG("warden", "Loading Module..."); _module = GetModuleForClient(); - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "Module Key: %s", ByteArrayToHexStr(_module->Key, 16).c_str()); - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "Module ID: %s", ByteArrayToHexStr(_module->Id, 16).c_str()); + TC_LOG_DEBUG("warden", "Module Key: %s", ByteArrayToHexStr(_module->Key, 16).c_str()); + TC_LOG_DEBUG("warden", "Module ID: %s", ByteArrayToHexStr(_module->Id, 16).c_str()); RequestModule(); } @@ -86,7 +86,7 @@ ClientWardenModule* WardenWin::GetModuleForClient() void WardenWin::InitializeModule() { - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "Initialize module"); + TC_LOG_DEBUG("warden", "Initialize module"); // Create packet structure WardenInitModuleRequest Request; @@ -130,7 +130,7 @@ void WardenWin::InitializeModule() void WardenWin::RequestHash() { - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "Request hash"); + TC_LOG_DEBUG("warden", "Request hash"); // Create packet structure WardenHashRequest Request; @@ -152,11 +152,11 @@ void WardenWin::HandleHashResult(ByteBuffer &buff) // Verify key if (memcmp(buff.contents() + 1, Module.ClientKeySeedHash, 20) != 0) { - TC_LOG_WARN(LOG_FILTER_WARDEN, "%s failed hash reply. Action: %s", _session->GetPlayerInfo().c_str(), Penalty().c_str()); + TC_LOG_WARN("warden", "%s failed hash reply. Action: %s", _session->GetPlayerInfo().c_str(), Penalty().c_str()); return; } - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "Request hash reply: succeed"); + TC_LOG_DEBUG("warden", "Request hash reply: succeed"); // Change keys here memcpy(_inputKey, Module.ClientKeySeed, 16); @@ -172,7 +172,7 @@ void WardenWin::HandleHashResult(ByteBuffer &buff) void WardenWin::RequestData() { - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "Request data"); + TC_LOG_DEBUG("warden", "Request data"); // If all checks were done, fill the todo list again if (_memChecksTodo.empty()) @@ -319,12 +319,12 @@ void WardenWin::RequestData() for (std::list<uint16>::iterator itr = _currentChecks.begin(); itr != _currentChecks.end(); ++itr) stream << *itr << " "; - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "%s", stream.str().c_str()); + TC_LOG_DEBUG("warden", "%s", stream.str().c_str()); } void WardenWin::HandleData(ByteBuffer &buff) { - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "Handle data"); + TC_LOG_DEBUG("warden", "Handle data"); _dataSent = false; _clientResponseTimer = 0; @@ -337,7 +337,7 @@ void WardenWin::HandleData(ByteBuffer &buff) if (!IsValidCheckSum(Checksum, buff.contents() + buff.rpos(), Length)) { buff.rpos(buff.wpos()); - TC_LOG_WARN(LOG_FILTER_WARDEN, "%s failed checksum. Action: %s", _session->GetPlayerInfo().c_str(), Penalty().c_str()); + TC_LOG_WARN("warden", "%s failed checksum. Action: %s", _session->GetPlayerInfo().c_str(), Penalty().c_str()); return; } @@ -348,7 +348,7 @@ void WardenWin::HandleData(ByteBuffer &buff) /// @todo test it. if (result == 0x00) { - TC_LOG_WARN(LOG_FILTER_WARDEN, "%s failed timing check. Action: %s", _session->GetPlayerInfo().c_str(), Penalty().c_str()); + TC_LOG_WARN("warden", "%s failed timing check. Action: %s", _session->GetPlayerInfo().c_str(), Penalty().c_str()); return; } @@ -358,10 +358,10 @@ void WardenWin::HandleData(ByteBuffer &buff) uint32 ticksNow = getMSTime(); uint32 ourTicks = newClientTicks + (ticksNow - _serverTicks); - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "ServerTicks %u", ticksNow); // Now - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "RequestTicks %u", _serverTicks); // At request - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "Ticks %u", newClientTicks); // At response - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "Ticks diff %u", ourTicks - newClientTicks); + TC_LOG_DEBUG("warden", "ServerTicks %u", ticksNow); // Now + TC_LOG_DEBUG("warden", "RequestTicks %u", _serverTicks); // At request + TC_LOG_DEBUG("warden", "Ticks %u", newClientTicks); // At response + TC_LOG_DEBUG("warden", "Ticks diff %u", ourTicks - newClientTicks); } WardenCheckResult* rs; @@ -386,21 +386,21 @@ void WardenWin::HandleData(ByteBuffer &buff) if (Mem_Result != 0) { - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "RESULT MEM_CHECK not 0x00, CheckId %u account Id %u", *itr, _session->GetAccountId()); + TC_LOG_DEBUG("warden", "RESULT MEM_CHECK not 0x00, CheckId %u account Id %u", *itr, _session->GetAccountId()); checkFailed = *itr; continue; } if (memcmp(buff.contents() + buff.rpos(), rs->Result.AsByteArray(0, false).get(), rd->Length) != 0) { - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "RESULT MEM_CHECK fail CheckId %u account Id %u", *itr, _session->GetAccountId()); + TC_LOG_DEBUG("warden", "RESULT MEM_CHECK fail CheckId %u account Id %u", *itr, _session->GetAccountId()); checkFailed = *itr; buff.rpos(buff.rpos() + rd->Length); continue; } buff.rpos(buff.rpos() + rd->Length); - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "RESULT MEM_CHECK passed CheckId %u account Id %u", *itr, _session->GetAccountId()); + TC_LOG_DEBUG("warden", "RESULT MEM_CHECK passed CheckId %u account Id %u", *itr, _session->GetAccountId()); break; } case PAGE_CHECK_A: @@ -412,11 +412,11 @@ void WardenWin::HandleData(ByteBuffer &buff) if (memcmp(buff.contents() + buff.rpos(), &byte, sizeof(uint8)) != 0) { if (type == PAGE_CHECK_A || type == PAGE_CHECK_B) - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "RESULT PAGE_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId()); + TC_LOG_DEBUG("warden", "RESULT PAGE_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId()); if (type == MODULE_CHECK) - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "RESULT MODULE_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId()); + TC_LOG_DEBUG("warden", "RESULT MODULE_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId()); if (type == DRIVER_CHECK) - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "RESULT DRIVER_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId()); + TC_LOG_DEBUG("warden", "RESULT DRIVER_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId()); checkFailed = *itr; buff.rpos(buff.rpos() + 1); continue; @@ -424,11 +424,11 @@ void WardenWin::HandleData(ByteBuffer &buff) buff.rpos(buff.rpos() + 1); if (type == PAGE_CHECK_A || type == PAGE_CHECK_B) - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "RESULT PAGE_CHECK passed CheckId %u account Id %u", *itr, _session->GetAccountId()); + TC_LOG_DEBUG("warden", "RESULT PAGE_CHECK passed CheckId %u account Id %u", *itr, _session->GetAccountId()); else if (type == MODULE_CHECK) - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "RESULT MODULE_CHECK passed CheckId %u account Id %u", *itr, _session->GetAccountId()); + TC_LOG_DEBUG("warden", "RESULT MODULE_CHECK passed CheckId %u account Id %u", *itr, _session->GetAccountId()); else if (type == DRIVER_CHECK) - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "RESULT DRIVER_CHECK passed CheckId %u account Id %u", *itr, _session->GetAccountId()); + TC_LOG_DEBUG("warden", "RESULT DRIVER_CHECK passed CheckId %u account Id %u", *itr, _session->GetAccountId()); break; } case LUA_STR_CHECK: @@ -438,7 +438,7 @@ void WardenWin::HandleData(ByteBuffer &buff) if (Lua_Result != 0) { - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "RESULT LUA_STR_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId()); + TC_LOG_DEBUG("warden", "RESULT LUA_STR_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId()); checkFailed = *itr; continue; } @@ -451,11 +451,11 @@ void WardenWin::HandleData(ByteBuffer &buff) char *str = new char[luaStrLen + 1]; memcpy(str, buff.contents() + buff.rpos(), luaStrLen); str[luaStrLen] = '\0'; // null terminator - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "Lua string: %s", str); + TC_LOG_DEBUG("warden", "Lua string: %s", str); delete[] str; } buff.rpos(buff.rpos() + luaStrLen); // Skip string - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "RESULT LUA_STR_CHECK passed, CheckId %u account Id %u", *itr, _session->GetAccountId()); + TC_LOG_DEBUG("warden", "RESULT LUA_STR_CHECK passed, CheckId %u account Id %u", *itr, _session->GetAccountId()); break; } case MPQ_CHECK: @@ -465,21 +465,21 @@ void WardenWin::HandleData(ByteBuffer &buff) if (Mpq_Result != 0) { - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "RESULT MPQ_CHECK not 0x00 account id %u", _session->GetAccountId()); + TC_LOG_DEBUG("warden", "RESULT MPQ_CHECK not 0x00 account id %u", _session->GetAccountId()); checkFailed = *itr; continue; } if (memcmp(buff.contents() + buff.rpos(), rs->Result.AsByteArray(0, false).get(), 20) != 0) // SHA1 { - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "RESULT MPQ_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId()); + TC_LOG_DEBUG("warden", "RESULT MPQ_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId()); checkFailed = *itr; buff.rpos(buff.rpos() + 20); // 20 bytes SHA1 continue; } buff.rpos(buff.rpos() + 20); // 20 bytes SHA1 - TC_LOG_DEBUG(LOG_FILTER_WARDEN, "RESULT MPQ_CHECK passed, CheckId %u account Id %u", *itr, _session->GetAccountId()); + TC_LOG_DEBUG("warden", "RESULT MPQ_CHECK passed, CheckId %u account Id %u", *itr, _session->GetAccountId()); break; } default: // Should never happen @@ -490,7 +490,7 @@ void WardenWin::HandleData(ByteBuffer &buff) if (checkFailed > 0) { WardenCheck* check = sWardenCheckMgr->GetWardenDataById(checkFailed); - TC_LOG_WARN(LOG_FILTER_WARDEN, "%s failed Warden check %u. Action: %s", _session->GetPlayerInfo().c_str(), checkFailed, Penalty(check).c_str()); + TC_LOG_WARN("warden", "%s failed Warden check %u. Action: %s", _session->GetPlayerInfo().c_str(), checkFailed, Penalty(check).c_str()); } // Set hold off timer, minimum timer should at least be 1 second diff --git a/src/server/game/Weather/Weather.cpp b/src/server/game/Weather/Weather.cpp index 0457dc7e033..5c03c816e6d 100644 --- a/src/server/game/Weather/Weather.cpp +++ b/src/server/game/Weather/Weather.cpp @@ -38,7 +38,7 @@ Weather::Weather(uint32 zone, WeatherData const* weatherChances) m_type = WEATHER_TYPE_FINE; m_grade = 0; - TC_LOG_INFO(LOG_FILTER_GENERAL, "WORLD: Starting weather system for zone %u (change every %u minutes).", m_zone, (uint32)(m_timer.GetInterval() / (MINUTE*IN_MILLISECONDS))); + TC_LOG_INFO("misc", "WORLD: Starting weather system for zone %u (change every %u minutes).", m_zone, (uint32)(m_timer.GetInterval() / (MINUTE*IN_MILLISECONDS))); } /// Launch a weather update @@ -99,7 +99,7 @@ bool Weather::ReGenerate() static char const* seasonName[WEATHER_SEASONS] = { "spring", "summer", "fall", "winter" }; - TC_LOG_INFO(LOG_FILTER_GENERAL, "Generating a change in %s weather for zone %u.", seasonName[season], m_zone); + TC_LOG_INFO("misc", "Generating a change in %s weather for zone %u.", seasonName[season], m_zone); if ((u < 60) && (m_grade < 0.33333334f)) // Get fair { @@ -263,7 +263,7 @@ bool Weather::UpdateWeather() wthstr = "fine"; break; } - TC_LOG_INFO(LOG_FILTER_GENERAL, "Change the weather of zone %u to %s.", m_zone, wthstr); + TC_LOG_INFO("misc", "Change the weather of zone %u to %s.", m_zone, wthstr); sScriptMgr->OnWeatherChange(this, state, m_grade); return true; diff --git a/src/server/game/Weather/WeatherMgr.cpp b/src/server/game/Weather/WeatherMgr.cpp index 0a09d8a5dff..1b36bc4653c 100644 --- a/src/server/game/Weather/WeatherMgr.cpp +++ b/src/server/game/Weather/WeatherMgr.cpp @@ -96,7 +96,7 @@ void LoadWeatherData() if (!result) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 weather definitions. DB table `game_weather` is empty."); + TC_LOG_ERROR("server.loading", ">> Loaded 0 weather definitions. DB table `game_weather` is empty."); return; } @@ -117,19 +117,19 @@ void LoadWeatherData() if (wzc.data[season].rainChance > 100) { wzc.data[season].rainChance = 25; - TC_LOG_ERROR(LOG_FILTER_SQL, "Weather for zone %u season %u has wrong rain chance > 100%%", zone_id, season); + TC_LOG_ERROR("sql.sql", "Weather for zone %u season %u has wrong rain chance > 100%%", zone_id, season); } if (wzc.data[season].snowChance > 100) { wzc.data[season].snowChance = 25; - TC_LOG_ERROR(LOG_FILTER_SQL, "Weather for zone %u season %u has wrong snow chance > 100%%", zone_id, season); + TC_LOG_ERROR("sql.sql", "Weather for zone %u season %u has wrong snow chance > 100%%", zone_id, season); } if (wzc.data[season].stormChance > 100) { wzc.data[season].stormChance = 25; - TC_LOG_ERROR(LOG_FILTER_SQL, "Weather for zone %u season %u has wrong storm chance > 100%%", zone_id, season); + TC_LOG_ERROR("sql.sql", "Weather for zone %u season %u has wrong storm chance > 100%%", zone_id, season); } } @@ -139,7 +139,7 @@ void LoadWeatherData() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u weather definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u weather definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } void SendFineWeatherUpdateToPlayer(Player* player) diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 1a18e26d049..3e64b1c67da 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -41,7 +41,6 @@ #include "ArenaTeamMgr.h" #include "GuildMgr.h" #include "TicketMgr.h" -#include "CreatureEventAIMgr.h" #include "SpellMgr.h" #include "GroupMgr.h" #include "Chat.h" @@ -110,16 +109,28 @@ World::World() m_MaxPlayerCount = 0; m_NextDailyQuestReset = 0; m_NextWeeklyQuestReset = 0; + m_NextMonthlyQuestReset = 0; + m_NextRandomBGReset = 0; + m_NextGuildReset = 0; m_defaultDbcLocale = LOCALE_enUS; m_availableDbcLocaleMask = 0; + mail_timer = 0; + mail_timer_expires = 0; + m_updateTime = 0; m_updateTimeSum = 0; m_updateTimeCount = 0; + m_currentTime = 0; m_isClosed = false; m_CleaningFlags = 0; + + memset(rate_values, 0, sizeof(rate_values)); + memset(m_int_configs, 0, sizeof(m_int_configs)); + memset(m_bool_configs, 0, sizeof(m_bool_configs)); + memset(m_float_configs, 0, sizeof(m_float_configs)); } /// World destructor @@ -272,7 +283,7 @@ void World::AddSession_(WorldSession* s) { AddQueuedPlayer(s); UpdateMaxSessionCounters(); - TC_LOG_INFO(LOG_FILTER_GENERAL, "PlayerQueue: Account id %u is in Queue Position (%u).", s->GetAccountId(), ++QueueSize); + TC_LOG_INFO("misc", "PlayerQueue: Account id %u is in Queue Position (%u).", s->GetAccountId(), ++QueueSize); return; } @@ -289,7 +300,7 @@ void World::AddSession_(WorldSession* s) float popu = (float)GetActiveSessionCount(); // updated number of users on the server popu /= pLimit; popu *= 2; - TC_LOG_INFO(LOG_FILTER_GENERAL, "Server Population (%f).", popu); + TC_LOG_INFO("misc", "Server Population (%f).", popu); } } @@ -400,7 +411,7 @@ void World::LoadConfigSettings(bool reload) { if (!sConfigMgr->Reload()) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "World settings reload fail: can't read settings from %s.", sConfigMgr->GetFilename().c_str()); + TC_LOG_ERROR("misc", "World settings reload fail: can't read settings from %s.", sConfigMgr->GetFilename().c_str()); return; } sLog->LoadFromConfig(); @@ -423,27 +434,27 @@ void World::LoadConfigSettings(bool reload) rate_values[RATE_HEALTH] = sConfigMgr->GetFloatDefault("Rate.Health", 1); if (rate_values[RATE_HEALTH] < 0) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "Rate.Health (%f) must be > 0. Using 1 instead.", rate_values[RATE_HEALTH]); + TC_LOG_ERROR("server.loading", "Rate.Health (%f) must be > 0. Using 1 instead.", rate_values[RATE_HEALTH]); rate_values[RATE_HEALTH] = 1; } rate_values[RATE_POWER_MANA] = sConfigMgr->GetFloatDefault("Rate.Mana", 1); if (rate_values[RATE_POWER_MANA] < 0) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "Rate.Mana (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_MANA]); + TC_LOG_ERROR("server.loading", "Rate.Mana (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_MANA]); rate_values[RATE_POWER_MANA] = 1; } rate_values[RATE_POWER_RAGE_INCOME] = sConfigMgr->GetFloatDefault("Rate.Rage.Income", 1); rate_values[RATE_POWER_RAGE_LOSS] = sConfigMgr->GetFloatDefault("Rate.Rage.Loss", 1); if (rate_values[RATE_POWER_RAGE_LOSS] < 0) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "Rate.Rage.Loss (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_RAGE_LOSS]); + TC_LOG_ERROR("server.loading", "Rate.Rage.Loss (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_RAGE_LOSS]); rate_values[RATE_POWER_RAGE_LOSS] = 1; } rate_values[RATE_POWER_RUNICPOWER_INCOME] = sConfigMgr->GetFloatDefault("Rate.RunicPower.Income", 1); rate_values[RATE_POWER_RUNICPOWER_LOSS] = sConfigMgr->GetFloatDefault("Rate.RunicPower.Loss", 1); if (rate_values[RATE_POWER_RUNICPOWER_LOSS] < 0) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "Rate.RunicPower.Loss (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_RUNICPOWER_LOSS]); + TC_LOG_ERROR("server.loading", "Rate.RunicPower.Loss (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_RUNICPOWER_LOSS]); rate_values[RATE_POWER_RUNICPOWER_LOSS] = 1; } rate_values[RATE_POWER_FOCUS] = sConfigMgr->GetFloatDefault("Rate.Focus", 1.0f); @@ -467,7 +478,7 @@ void World::LoadConfigSettings(bool reload) rate_values[RATE_REPAIRCOST] = sConfigMgr->GetFloatDefault("Rate.RepairCost", 1.0f); if (rate_values[RATE_REPAIRCOST] < 0.0f) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "Rate.RepairCost (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_REPAIRCOST]); + TC_LOG_ERROR("server.loading", "Rate.RepairCost (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_REPAIRCOST]); rate_values[RATE_REPAIRCOST] = 0.0f; } rate_values[RATE_REPUTATION_GAIN] = sConfigMgr->GetFloatDefault("Rate.Reputation.Gain", 1.0f); @@ -502,13 +513,13 @@ void World::LoadConfigSettings(bool reload) rate_values[RATE_TALENT] = sConfigMgr->GetFloatDefault("Rate.Talent", 1.0f); if (rate_values[RATE_TALENT] < 0.0f) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "Rate.Talent (%f) must be > 0. Using 1 instead.", rate_values[RATE_TALENT]); + TC_LOG_ERROR("server.loading", "Rate.Talent (%f) must be > 0. Using 1 instead.", rate_values[RATE_TALENT]); rate_values[RATE_TALENT] = 1.0f; } rate_values[RATE_MOVESPEED] = sConfigMgr->GetFloatDefault("Rate.MoveSpeed", 1.0f); if (rate_values[RATE_MOVESPEED] < 0) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "Rate.MoveSpeed (%f) must be > 0. Using 1 instead.", rate_values[RATE_MOVESPEED]); + TC_LOG_ERROR("server.loading", "Rate.MoveSpeed (%f) must be > 0. Using 1 instead.", rate_values[RATE_MOVESPEED]); rate_values[RATE_MOVESPEED] = 1.0f; } for (uint8 i = 0; i < MAX_MOVE_TYPE; ++i) playerBaseMoveSpeed[i] = baseMoveSpeed[i] * rate_values[RATE_MOVESPEED]; @@ -517,12 +528,12 @@ void World::LoadConfigSettings(bool reload) rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] = sConfigMgr->GetFloatDefault("TargetPosRecalculateRange", 1.5f); if (rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] < CONTACT_DISTANCE) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "TargetPosRecalculateRange (%f) must be >= %f. Using %f instead.", rate_values[RATE_TARGET_POS_RECALCULATION_RANGE], CONTACT_DISTANCE, CONTACT_DISTANCE); + TC_LOG_ERROR("server.loading", "TargetPosRecalculateRange (%f) must be >= %f. Using %f instead.", rate_values[RATE_TARGET_POS_RECALCULATION_RANGE], CONTACT_DISTANCE, CONTACT_DISTANCE); rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] = CONTACT_DISTANCE; } else if (rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] > NOMINAL_MELEE_RANGE) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "TargetPosRecalculateRange (%f) must be <= %f. Using %f instead.", + TC_LOG_ERROR("server.loading", "TargetPosRecalculateRange (%f) must be <= %f. Using %f instead.", rate_values[RATE_TARGET_POS_RECALCULATION_RANGE], NOMINAL_MELEE_RANGE, NOMINAL_MELEE_RANGE); rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] = NOMINAL_MELEE_RANGE; } @@ -530,12 +541,12 @@ void World::LoadConfigSettings(bool reload) rate_values[RATE_DURABILITY_LOSS_ON_DEATH] = sConfigMgr->GetFloatDefault("DurabilityLoss.OnDeath", 10.0f); if (rate_values[RATE_DURABILITY_LOSS_ON_DEATH] < 0.0f) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "DurabilityLoss.OnDeath (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_ON_DEATH]); + TC_LOG_ERROR("server.loading", "DurabilityLoss.OnDeath (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_ON_DEATH]); rate_values[RATE_DURABILITY_LOSS_ON_DEATH] = 0.0f; } if (rate_values[RATE_DURABILITY_LOSS_ON_DEATH] > 100.0f) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "DurabilityLoss.OnDeath (%f) must be <= 100. Using 100.0 instead.", rate_values[RATE_DURABILITY_LOSS_ON_DEATH]); + TC_LOG_ERROR("server.loading", "DurabilityLoss.OnDeath (%f) must be <= 100. Using 100.0 instead.", rate_values[RATE_DURABILITY_LOSS_ON_DEATH]); rate_values[RATE_DURABILITY_LOSS_ON_DEATH] = 0.0f; } rate_values[RATE_DURABILITY_LOSS_ON_DEATH] = rate_values[RATE_DURABILITY_LOSS_ON_DEATH] / 100.0f; @@ -543,25 +554,25 @@ void World::LoadConfigSettings(bool reload) rate_values[RATE_DURABILITY_LOSS_DAMAGE] = sConfigMgr->GetFloatDefault("DurabilityLossChance.Damage", 0.5f); if (rate_values[RATE_DURABILITY_LOSS_DAMAGE] < 0.0f) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "DurabilityLossChance.Damage (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_DAMAGE]); + TC_LOG_ERROR("server.loading", "DurabilityLossChance.Damage (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_DAMAGE]); rate_values[RATE_DURABILITY_LOSS_DAMAGE] = 0.0f; } rate_values[RATE_DURABILITY_LOSS_ABSORB] = sConfigMgr->GetFloatDefault("DurabilityLossChance.Absorb", 0.5f); if (rate_values[RATE_DURABILITY_LOSS_ABSORB] < 0.0f) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "DurabilityLossChance.Absorb (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_ABSORB]); + TC_LOG_ERROR("server.loading", "DurabilityLossChance.Absorb (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_ABSORB]); rate_values[RATE_DURABILITY_LOSS_ABSORB] = 0.0f; } rate_values[RATE_DURABILITY_LOSS_PARRY] = sConfigMgr->GetFloatDefault("DurabilityLossChance.Parry", 0.05f); if (rate_values[RATE_DURABILITY_LOSS_PARRY] < 0.0f) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "DurabilityLossChance.Parry (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_PARRY]); + TC_LOG_ERROR("server.loading", "DurabilityLossChance.Parry (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_PARRY]); rate_values[RATE_DURABILITY_LOSS_PARRY] = 0.0f; } rate_values[RATE_DURABILITY_LOSS_BLOCK] = sConfigMgr->GetFloatDefault("DurabilityLossChance.Block", 0.05f); if (rate_values[RATE_DURABILITY_LOSS_BLOCK] < 0.0f) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "DurabilityLossChance.Block (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_BLOCK]); + TC_LOG_ERROR("server.loading", "DurabilityLossChance.Block (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_BLOCK]); rate_values[RATE_DURABILITY_LOSS_BLOCK] = 0.0f; } ///- Read other configuration items from the config file @@ -571,7 +582,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_COMPRESSION] = sConfigMgr->GetIntDefault("Compression", 1); if (m_int_configs[CONFIG_COMPRESSION] < 1 || m_int_configs[CONFIG_COMPRESSION] > 9) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "Compression level (%i) must be in range 1..9. Using default compression level (1).", m_int_configs[CONFIG_COMPRESSION]); + TC_LOG_ERROR("server.loading", "Compression level (%i) must be in range 1..9. Using default compression level (1).", m_int_configs[CONFIG_COMPRESSION]); m_int_configs[CONFIG_COMPRESSION] = 1; } m_bool_configs[CONFIG_ADDON_CHANNEL] = sConfigMgr->GetBoolDefault("AddonChannel", true); @@ -594,14 +605,14 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE] = sConfigMgr->GetIntDefault("PlayerSave.Stats.MinLevel", 0); if (m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE] > MAX_LEVEL) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "PlayerSave.Stats.MinLevel (%i) must be in range 0..80. Using default, do not save character stats (0).", m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE]); + TC_LOG_ERROR("server.loading", "PlayerSave.Stats.MinLevel (%i) must be in range 0..80. Using default, do not save character stats (0).", m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE]); m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE] = 0; } m_int_configs[CONFIG_INTERVAL_GRIDCLEAN] = sConfigMgr->GetIntDefault("GridCleanUpDelay", 5 * MINUTE * IN_MILLISECONDS); if (m_int_configs[CONFIG_INTERVAL_GRIDCLEAN] < MIN_GRID_DELAY) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "GridCleanUpDelay (%i) must be greater %u. Use this minimal value.", m_int_configs[CONFIG_INTERVAL_GRIDCLEAN], MIN_GRID_DELAY); + TC_LOG_ERROR("server.loading", "GridCleanUpDelay (%i) must be greater %u. Use this minimal value.", m_int_configs[CONFIG_INTERVAL_GRIDCLEAN], MIN_GRID_DELAY); m_int_configs[CONFIG_INTERVAL_GRIDCLEAN] = MIN_GRID_DELAY; } if (reload) @@ -610,7 +621,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_INTERVAL_MAPUPDATE] = sConfigMgr->GetIntDefault("MapUpdateInterval", 100); if (m_int_configs[CONFIG_INTERVAL_MAPUPDATE] < MIN_MAP_UPDATE_DELAY) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "MapUpdateInterval (%i) must be greater %u. Use this minimal value.", m_int_configs[CONFIG_INTERVAL_MAPUPDATE], MIN_MAP_UPDATE_DELAY); + TC_LOG_ERROR("server.loading", "MapUpdateInterval (%i) must be greater %u. Use this minimal value.", m_int_configs[CONFIG_INTERVAL_MAPUPDATE], MIN_MAP_UPDATE_DELAY); m_int_configs[CONFIG_INTERVAL_MAPUPDATE] = MIN_MAP_UPDATE_DELAY; } if (reload) @@ -622,7 +633,7 @@ void World::LoadConfigSettings(bool reload) { uint32 val = sConfigMgr->GetIntDefault("WorldServerPort", 8085); if (val != m_int_configs[CONFIG_PORT_WORLD]) - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "WorldServerPort option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_PORT_WORLD]); + TC_LOG_ERROR("server.loading", "WorldServerPort option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_PORT_WORLD]); } else m_int_configs[CONFIG_PORT_WORLD] = sConfigMgr->GetIntDefault("WorldServerPort", 8085); @@ -641,7 +652,7 @@ void World::LoadConfigSettings(bool reload) { uint32 val = sConfigMgr->GetIntDefault("GameType", 0); if (val != m_int_configs[CONFIG_GAME_TYPE]) - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "GameType option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_GAME_TYPE]); + TC_LOG_ERROR("server.loading", "GameType option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_GAME_TYPE]); } else m_int_configs[CONFIG_GAME_TYPE] = sConfigMgr->GetIntDefault("GameType", 0); @@ -650,7 +661,7 @@ void World::LoadConfigSettings(bool reload) { uint32 val = sConfigMgr->GetIntDefault("RealmZone", REALM_ZONE_DEVELOPMENT); if (val != m_int_configs[CONFIG_REALM_ZONE]) - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "RealmZone option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_REALM_ZONE]); + TC_LOG_ERROR("server.loading", "RealmZone option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_REALM_ZONE]); } else m_int_configs[CONFIG_REALM_ZONE] = sConfigMgr->GetIntDefault("RealmZone", REALM_ZONE_DEVELOPMENT); @@ -668,21 +679,21 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_MIN_PLAYER_NAME] = sConfigMgr->GetIntDefault ("MinPlayerName", 2); if (m_int_configs[CONFIG_MIN_PLAYER_NAME] < 1 || m_int_configs[CONFIG_MIN_PLAYER_NAME] > MAX_PLAYER_NAME) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "MinPlayerName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_PLAYER_NAME], MAX_PLAYER_NAME); + TC_LOG_ERROR("server.loading", "MinPlayerName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_PLAYER_NAME], MAX_PLAYER_NAME); m_int_configs[CONFIG_MIN_PLAYER_NAME] = 2; } m_int_configs[CONFIG_MIN_CHARTER_NAME] = sConfigMgr->GetIntDefault ("MinCharterName", 2); if (m_int_configs[CONFIG_MIN_CHARTER_NAME] < 1 || m_int_configs[CONFIG_MIN_CHARTER_NAME] > MAX_CHARTER_NAME) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "MinCharterName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_CHARTER_NAME], MAX_CHARTER_NAME); + TC_LOG_ERROR("server.loading", "MinCharterName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_CHARTER_NAME], MAX_CHARTER_NAME); m_int_configs[CONFIG_MIN_CHARTER_NAME] = 2; } m_int_configs[CONFIG_MIN_PET_NAME] = sConfigMgr->GetIntDefault ("MinPetName", 2); if (m_int_configs[CONFIG_MIN_PET_NAME] < 1 || m_int_configs[CONFIG_MIN_PET_NAME] > MAX_PET_NAME) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "MinPetName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_PET_NAME], MAX_PET_NAME); + TC_LOG_ERROR("server.loading", "MinPetName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_PET_NAME], MAX_PET_NAME); m_int_configs[CONFIG_MIN_PET_NAME] = 2; } @@ -693,7 +704,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_CHARACTERS_PER_REALM] = sConfigMgr->GetIntDefault("CharactersPerRealm", 10); if (m_int_configs[CONFIG_CHARACTERS_PER_REALM] < 1 || m_int_configs[CONFIG_CHARACTERS_PER_REALM] > 10) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "CharactersPerRealm (%i) must be in range 1..10. Set to 10.", m_int_configs[CONFIG_CHARACTERS_PER_REALM]); + TC_LOG_ERROR("server.loading", "CharactersPerRealm (%i) must be in range 1..10. Set to 10.", m_int_configs[CONFIG_CHARACTERS_PER_REALM]); m_int_configs[CONFIG_CHARACTERS_PER_REALM] = 10; } @@ -701,14 +712,14 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT] = sConfigMgr->GetIntDefault("CharactersPerAccount", 50); if (m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT] < m_int_configs[CONFIG_CHARACTERS_PER_REALM]) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "CharactersPerAccount (%i) can't be less than CharactersPerRealm (%i).", m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT], m_int_configs[CONFIG_CHARACTERS_PER_REALM]); + TC_LOG_ERROR("server.loading", "CharactersPerAccount (%i) can't be less than CharactersPerRealm (%i).", m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT], m_int_configs[CONFIG_CHARACTERS_PER_REALM]); m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT] = m_int_configs[CONFIG_CHARACTERS_PER_REALM]; } m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM] = sConfigMgr->GetIntDefault("HeroicCharactersPerRealm", 1); if (int32(m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM]) < 0 || m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM] > 10) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "HeroicCharactersPerRealm (%i) must be in range 0..10. Set to 1.", m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM]); + TC_LOG_ERROR("server.loading", "HeroicCharactersPerRealm (%i) must be in range 0..10. Set to 1.", m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM]); m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM] = 1; } @@ -717,7 +728,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_SKIP_CINEMATICS] = sConfigMgr->GetIntDefault("SkipCinematics", 0); if (int32(m_int_configs[CONFIG_SKIP_CINEMATICS]) < 0 || m_int_configs[CONFIG_SKIP_CINEMATICS] > 2) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "SkipCinematics (%i) must be in range 0..2. Set to 0.", m_int_configs[CONFIG_SKIP_CINEMATICS]); + TC_LOG_ERROR("server.loading", "SkipCinematics (%i) must be in range 0..2. Set to 0.", m_int_configs[CONFIG_SKIP_CINEMATICS]); m_int_configs[CONFIG_SKIP_CINEMATICS] = 0; } @@ -725,14 +736,14 @@ void World::LoadConfigSettings(bool reload) { uint32 val = sConfigMgr->GetIntDefault("MaxPlayerLevel", DEFAULT_MAX_LEVEL); if (val != m_int_configs[CONFIG_MAX_PLAYER_LEVEL]) - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "MaxPlayerLevel option can't be changed at config reload, using current value (%u).", m_int_configs[CONFIG_MAX_PLAYER_LEVEL]); + TC_LOG_ERROR("server.loading", "MaxPlayerLevel option can't be changed at config reload, using current value (%u).", m_int_configs[CONFIG_MAX_PLAYER_LEVEL]); } else m_int_configs[CONFIG_MAX_PLAYER_LEVEL] = sConfigMgr->GetIntDefault("MaxPlayerLevel", DEFAULT_MAX_LEVEL); if (m_int_configs[CONFIG_MAX_PLAYER_LEVEL] > MAX_LEVEL) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "MaxPlayerLevel (%i) must be in range 1..%u. Set to %u.", m_int_configs[CONFIG_MAX_PLAYER_LEVEL], MAX_LEVEL, MAX_LEVEL); + TC_LOG_ERROR("server.loading", "MaxPlayerLevel (%i) must be in range 1..%u. Set to %u.", m_int_configs[CONFIG_MAX_PLAYER_LEVEL], MAX_LEVEL, MAX_LEVEL); m_int_configs[CONFIG_MAX_PLAYER_LEVEL] = MAX_LEVEL; } @@ -741,25 +752,25 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_START_PLAYER_LEVEL] = sConfigMgr->GetIntDefault("StartPlayerLevel", 1); if (m_int_configs[CONFIG_START_PLAYER_LEVEL] < 1) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "StartPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to 1.", m_int_configs[CONFIG_START_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]); + TC_LOG_ERROR("server.loading", "StartPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to 1.", m_int_configs[CONFIG_START_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]); m_int_configs[CONFIG_START_PLAYER_LEVEL] = 1; } else if (m_int_configs[CONFIG_START_PLAYER_LEVEL] > m_int_configs[CONFIG_MAX_PLAYER_LEVEL]) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "StartPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to %u.", m_int_configs[CONFIG_START_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]); + TC_LOG_ERROR("server.loading", "StartPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to %u.", m_int_configs[CONFIG_START_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]); m_int_configs[CONFIG_START_PLAYER_LEVEL] = m_int_configs[CONFIG_MAX_PLAYER_LEVEL]; } m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] = sConfigMgr->GetIntDefault("StartHeroicPlayerLevel", 55); if (m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] < 1) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "StartHeroicPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to 55.", + TC_LOG_ERROR("server.loading", "StartHeroicPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to 55.", m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]); m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] = 55; } else if (m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] > m_int_configs[CONFIG_MAX_PLAYER_LEVEL]) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "StartHeroicPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to %u.", + TC_LOG_ERROR("server.loading", "StartHeroicPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to %u.", m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]); m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] = m_int_configs[CONFIG_MAX_PLAYER_LEVEL]; } @@ -767,12 +778,12 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_START_PLAYER_MONEY] = sConfigMgr->GetIntDefault("StartPlayerMoney", 0); if (int32(m_int_configs[CONFIG_START_PLAYER_MONEY]) < 0) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "StartPlayerMoney (%i) must be in range 0..%u. Set to %u.", m_int_configs[CONFIG_START_PLAYER_MONEY], MAX_MONEY_AMOUNT, 0); + TC_LOG_ERROR("server.loading", "StartPlayerMoney (%i) must be in range 0..%u. Set to %u.", m_int_configs[CONFIG_START_PLAYER_MONEY], MAX_MONEY_AMOUNT, 0); m_int_configs[CONFIG_START_PLAYER_MONEY] = 0; } else if (m_int_configs[CONFIG_START_PLAYER_MONEY] > MAX_MONEY_AMOUNT) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "StartPlayerMoney (%i) must be in range 0..%u. Set to %u.", + TC_LOG_ERROR("server.loading", "StartPlayerMoney (%i) must be in range 0..%u. Set to %u.", m_int_configs[CONFIG_START_PLAYER_MONEY], MAX_MONEY_AMOUNT, MAX_MONEY_AMOUNT); m_int_configs[CONFIG_START_PLAYER_MONEY] = MAX_MONEY_AMOUNT; } @@ -780,20 +791,20 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_MAX_HONOR_POINTS] = sConfigMgr->GetIntDefault("MaxHonorPoints", 75000); if (int32(m_int_configs[CONFIG_MAX_HONOR_POINTS]) < 0) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "MaxHonorPoints (%i) can't be negative. Set to 0.", m_int_configs[CONFIG_MAX_HONOR_POINTS]); + TC_LOG_ERROR("server.loading", "MaxHonorPoints (%i) can't be negative. Set to 0.", m_int_configs[CONFIG_MAX_HONOR_POINTS]); m_int_configs[CONFIG_MAX_HONOR_POINTS] = 0; } m_int_configs[CONFIG_START_HONOR_POINTS] = sConfigMgr->GetIntDefault("StartHonorPoints", 0); if (int32(m_int_configs[CONFIG_START_HONOR_POINTS]) < 0) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "StartHonorPoints (%i) must be in range 0..MaxHonorPoints(%u). Set to %u.", + TC_LOG_ERROR("server.loading", "StartHonorPoints (%i) must be in range 0..MaxHonorPoints(%u). Set to %u.", m_int_configs[CONFIG_START_HONOR_POINTS], m_int_configs[CONFIG_MAX_HONOR_POINTS], 0); m_int_configs[CONFIG_START_HONOR_POINTS] = 0; } else if (m_int_configs[CONFIG_START_HONOR_POINTS] > m_int_configs[CONFIG_MAX_HONOR_POINTS]) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "StartHonorPoints (%i) must be in range 0..MaxHonorPoints(%u). Set to %u.", + TC_LOG_ERROR("server.loading", "StartHonorPoints (%i) must be in range 0..MaxHonorPoints(%u). Set to %u.", m_int_configs[CONFIG_START_HONOR_POINTS], m_int_configs[CONFIG_MAX_HONOR_POINTS], m_int_configs[CONFIG_MAX_HONOR_POINTS]); m_int_configs[CONFIG_START_HONOR_POINTS] = m_int_configs[CONFIG_MAX_HONOR_POINTS]; } @@ -801,20 +812,20 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_MAX_ARENA_POINTS] = sConfigMgr->GetIntDefault("MaxArenaPoints", 10000); if (int32(m_int_configs[CONFIG_MAX_ARENA_POINTS]) < 0) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "MaxArenaPoints (%i) can't be negative. Set to 0.", m_int_configs[CONFIG_MAX_ARENA_POINTS]); + TC_LOG_ERROR("server.loading", "MaxArenaPoints (%i) can't be negative. Set to 0.", m_int_configs[CONFIG_MAX_ARENA_POINTS]); m_int_configs[CONFIG_MAX_ARENA_POINTS] = 0; } m_int_configs[CONFIG_START_ARENA_POINTS] = sConfigMgr->GetIntDefault("StartArenaPoints", 0); if (int32(m_int_configs[CONFIG_START_ARENA_POINTS]) < 0) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.", + TC_LOG_ERROR("server.loading", "StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.", m_int_configs[CONFIG_START_ARENA_POINTS], m_int_configs[CONFIG_MAX_ARENA_POINTS], 0); m_int_configs[CONFIG_START_ARENA_POINTS] = 0; } else if (m_int_configs[CONFIG_START_ARENA_POINTS] > m_int_configs[CONFIG_MAX_ARENA_POINTS]) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.", + TC_LOG_ERROR("server.loading", "StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.", m_int_configs[CONFIG_START_ARENA_POINTS], m_int_configs[CONFIG_MAX_ARENA_POINTS], m_int_configs[CONFIG_MAX_ARENA_POINTS]); m_int_configs[CONFIG_START_ARENA_POINTS] = m_int_configs[CONFIG_MAX_ARENA_POINTS]; } @@ -822,7 +833,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL] = sConfigMgr->GetIntDefault("RecruitAFriend.MaxLevel", 60); if (m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL] > m_int_configs[CONFIG_MAX_PLAYER_LEVEL]) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "RecruitAFriend.MaxLevel (%i) must be in the range 0..MaxLevel(%u). Set to %u.", + TC_LOG_ERROR("server.loading", "RecruitAFriend.MaxLevel (%i) must be in the range 0..MaxLevel(%u). Set to %u.", m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], 60); m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL] = 60; } @@ -842,7 +853,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_MIN_PETITION_SIGNS] = sConfigMgr->GetIntDefault("MinPetitionSigns", 9); if (m_int_configs[CONFIG_MIN_PETITION_SIGNS] > 9) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "MinPetitionSigns (%i) must be in range 0..9. Set to 9.", m_int_configs[CONFIG_MIN_PETITION_SIGNS]); + TC_LOG_ERROR("server.loading", "MinPetitionSigns (%i) must be in range 0..9. Set to 9.", m_int_configs[CONFIG_MIN_PETITION_SIGNS]); m_int_configs[CONFIG_MIN_PETITION_SIGNS] = 9; } @@ -856,13 +867,13 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_START_GM_LEVEL] = sConfigMgr->GetIntDefault("GM.StartLevel", 1); if (m_int_configs[CONFIG_START_GM_LEVEL] < m_int_configs[CONFIG_START_PLAYER_LEVEL]) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "GM.StartLevel (%i) must be in range StartPlayerLevel(%u)..%u. Set to %u.", + TC_LOG_ERROR("server.loading", "GM.StartLevel (%i) must be in range StartPlayerLevel(%u)..%u. Set to %u.", m_int_configs[CONFIG_START_GM_LEVEL], m_int_configs[CONFIG_START_PLAYER_LEVEL], MAX_LEVEL, m_int_configs[CONFIG_START_PLAYER_LEVEL]); m_int_configs[CONFIG_START_GM_LEVEL] = m_int_configs[CONFIG_START_PLAYER_LEVEL]; } else if (m_int_configs[CONFIG_START_GM_LEVEL] > MAX_LEVEL) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "GM.StartLevel (%i) must be in range 1..%u. Set to %u.", m_int_configs[CONFIG_START_GM_LEVEL], MAX_LEVEL, MAX_LEVEL); + TC_LOG_ERROR("server.loading", "GM.StartLevel (%i) must be in range 1..%u. Set to %u.", m_int_configs[CONFIG_START_GM_LEVEL], MAX_LEVEL, MAX_LEVEL); m_int_configs[CONFIG_START_GM_LEVEL] = MAX_LEVEL; } m_bool_configs[CONFIG_ALLOW_GM_GROUP] = sConfigMgr->GetBoolDefault("GM.AllowInvite", false); @@ -876,7 +887,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_UPTIME_UPDATE] = sConfigMgr->GetIntDefault("UpdateUptimeInterval", 10); if (int32(m_int_configs[CONFIG_UPTIME_UPDATE]) <= 0) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "UpdateUptimeInterval (%i) must be > 0, set to default 10.", m_int_configs[CONFIG_UPTIME_UPDATE]); + TC_LOG_ERROR("server.loading", "UpdateUptimeInterval (%i) must be > 0, set to default 10.", m_int_configs[CONFIG_UPTIME_UPDATE]); m_int_configs[CONFIG_UPTIME_UPDATE] = 10; } if (reload) @@ -889,7 +900,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_LOGDB_CLEARINTERVAL] = sConfigMgr->GetIntDefault("LogDB.Opt.ClearInterval", 10); if (int32(m_int_configs[CONFIG_LOGDB_CLEARINTERVAL]) <= 0) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "LogDB.Opt.ClearInterval (%i) must be > 0, set to default 10.", m_int_configs[CONFIG_LOGDB_CLEARINTERVAL]); + TC_LOG_ERROR("server.loading", "LogDB.Opt.ClearInterval (%i) must be > 0, set to default 10.", m_int_configs[CONFIG_LOGDB_CLEARINTERVAL]); m_int_configs[CONFIG_LOGDB_CLEARINTERVAL] = 10; } if (reload) @@ -898,7 +909,7 @@ void World::LoadConfigSettings(bool reload) m_timers[WUPDATE_CLEANDB].Reset(); } m_int_configs[CONFIG_LOGDB_CLEARTIME] = sConfigMgr->GetIntDefault("LogDB.Opt.ClearTime", 1209600); // 14 days default - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Will clear `logs` table of entries older than %i seconds every %u minutes.", + TC_LOG_INFO("server.loading", "Will clear `logs` table of entries older than %i seconds every %u minutes.", m_int_configs[CONFIG_LOGDB_CLEARTIME], m_int_configs[CONFIG_LOGDB_CLEARINTERVAL]); m_int_configs[CONFIG_SKILL_CHANCE_ORANGE] = sConfigMgr->GetIntDefault("SkillChance.Orange", 100); @@ -923,7 +934,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_MAX_OVERSPEED_PINGS] = sConfigMgr->GetIntDefault("MaxOverspeedPings", 2); if (m_int_configs[CONFIG_MAX_OVERSPEED_PINGS] != 0 && m_int_configs[CONFIG_MAX_OVERSPEED_PINGS] < 2) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "MaxOverspeedPings (%i) must be in range 2..infinity (or 0 to disable check). Set to 2.", m_int_configs[CONFIG_MAX_OVERSPEED_PINGS]); + TC_LOG_ERROR("server.loading", "MaxOverspeedPings (%i) must be in range 2..infinity (or 0 to disable check). Set to 2.", m_int_configs[CONFIG_MAX_OVERSPEED_PINGS]); m_int_configs[CONFIG_MAX_OVERSPEED_PINGS] = 2; } @@ -938,7 +949,7 @@ void World::LoadConfigSettings(bool reload) { uint32 val = sConfigMgr->GetIntDefault("Expansion", 1); if (val != m_int_configs[CONFIG_EXPANSION]) - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "Expansion option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_EXPANSION]); + TC_LOG_ERROR("server.loading", "Expansion option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_EXPANSION]); } else m_int_configs[CONFIG_EXPANSION] = sConfigMgr->GetIntDefault("Expansion", 1); @@ -970,14 +981,14 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR] = sConfigMgr->GetIntDefault("Battleground.Random.ResetHour", 6); if (m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR] > 23) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "Battleground.Random.ResetHour (%i) can't be load. Set to 6.", m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR]); + TC_LOG_ERROR("server.loading", "Battleground.Random.ResetHour (%i) can't be load. Set to 6.", m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR]); m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR] = 6; } m_int_configs[CONFIG_GUILD_RESET_HOUR] = sConfigMgr->GetIntDefault("Guild.ResetHour", 6); if (m_int_configs[CONFIG_GUILD_RESET_HOUR] > 23) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Guild.ResetHour (%i) can't be load. Set to 6.", m_int_configs[CONFIG_GUILD_RESET_HOUR]); + TC_LOG_ERROR("misc", "Guild.ResetHour (%i) can't be load. Set to 6.", m_int_configs[CONFIG_GUILD_RESET_HOUR]); m_int_configs[CONFIG_GUILD_RESET_HOUR] = 6; } @@ -1042,10 +1053,10 @@ void World::LoadConfigSettings(bool reload) if (clientCacheId > 0) { m_int_configs[CONFIG_CLIENTCACHE_VERSION] = clientCacheId; - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Client cache version set to: %u", clientCacheId); + TC_LOG_INFO("server.loading", "Client cache version set to: %u", clientCacheId); } else - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "ClientCacheVersion can't be negative %d, ignored.", clientCacheId); + TC_LOG_ERROR("server.loading", "ClientCacheVersion can't be negative %d, ignored.", clientCacheId); } m_int_configs[CONFIG_GUILD_EVENT_LOG_COUNT] = sConfigMgr->GetIntDefault("Guild.EventLogRecordsCount", GUILD_EVENTLOG_MAX_RECORDS); @@ -1059,12 +1070,12 @@ void World::LoadConfigSettings(bool reload) m_MaxVisibleDistanceOnContinents = sConfigMgr->GetFloatDefault("Visibility.Distance.Continents", DEFAULT_VISIBILITY_DISTANCE); if (m_MaxVisibleDistanceOnContinents < 45*sWorld->getRate(RATE_CREATURE_AGGRO)) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "Visibility.Distance.Continents can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO)); + TC_LOG_ERROR("server.loading", "Visibility.Distance.Continents can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO)); m_MaxVisibleDistanceOnContinents = 45*sWorld->getRate(RATE_CREATURE_AGGRO); } else if (m_MaxVisibleDistanceOnContinents > MAX_VISIBILITY_DISTANCE) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "Visibility.Distance.Continents can't be greater %f", MAX_VISIBILITY_DISTANCE); + TC_LOG_ERROR("server.loading", "Visibility.Distance.Continents can't be greater %f", MAX_VISIBILITY_DISTANCE); m_MaxVisibleDistanceOnContinents = MAX_VISIBILITY_DISTANCE; } @@ -1072,12 +1083,12 @@ void World::LoadConfigSettings(bool reload) m_MaxVisibleDistanceInInstances = sConfigMgr->GetFloatDefault("Visibility.Distance.Instances", DEFAULT_VISIBILITY_INSTANCE); if (m_MaxVisibleDistanceInInstances < 45*sWorld->getRate(RATE_CREATURE_AGGRO)) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "Visibility.Distance.Instances can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO)); + TC_LOG_ERROR("server.loading", "Visibility.Distance.Instances can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO)); m_MaxVisibleDistanceInInstances = 45*sWorld->getRate(RATE_CREATURE_AGGRO); } else if (m_MaxVisibleDistanceInInstances > MAX_VISIBILITY_DISTANCE) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "Visibility.Distance.Instances can't be greater %f", MAX_VISIBILITY_DISTANCE); + TC_LOG_ERROR("server.loading", "Visibility.Distance.Instances can't be greater %f", MAX_VISIBILITY_DISTANCE); m_MaxVisibleDistanceInInstances = MAX_VISIBILITY_DISTANCE; } @@ -1085,12 +1096,12 @@ void World::LoadConfigSettings(bool reload) m_MaxVisibleDistanceInBGArenas = sConfigMgr->GetFloatDefault("Visibility.Distance.BGArenas", DEFAULT_VISIBILITY_BGARENAS); if (m_MaxVisibleDistanceInBGArenas < 45*sWorld->getRate(RATE_CREATURE_AGGRO)) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "Visibility.Distance.BGArenas can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO)); + TC_LOG_ERROR("server.loading", "Visibility.Distance.BGArenas can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO)); m_MaxVisibleDistanceInBGArenas = 45*sWorld->getRate(RATE_CREATURE_AGGRO); } else if (m_MaxVisibleDistanceInBGArenas > MAX_VISIBILITY_DISTANCE) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "Visibility.Distance.BGArenas can't be greater %f", MAX_VISIBILITY_DISTANCE); + TC_LOG_ERROR("server.loading", "Visibility.Distance.BGArenas can't be greater %f", MAX_VISIBILITY_DISTANCE); m_MaxVisibleDistanceInBGArenas = MAX_VISIBILITY_DISTANCE; } @@ -1121,16 +1132,16 @@ void World::LoadConfigSettings(bool reload) if (reload) { if (dataPath != m_dataPath) - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "DataDir option can't be changed at worldserver.conf reload, using current value (%s).", m_dataPath.c_str()); + TC_LOG_ERROR("server.loading", "DataDir option can't be changed at worldserver.conf reload, using current value (%s).", m_dataPath.c_str()); } else { m_dataPath = dataPath; - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Using DataDir %s", m_dataPath.c_str()); + TC_LOG_INFO("server.loading", "Using DataDir %s", m_dataPath.c_str()); } m_bool_configs[CONFIG_ENABLE_MMAPS] = sConfigMgr->GetBoolDefault("mmap.enablePathFinding", false); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "WORLD: MMap data directory is: %smmaps", m_dataPath.c_str()); + TC_LOG_INFO("server.loading", "WORLD: MMap data directory is: %smmaps", m_dataPath.c_str()); m_bool_configs[CONFIG_VMAP_INDOOR_CHECK] = sConfigMgr->GetBoolDefault("vmap.enableIndoorCheck", 0); bool enableIndoor = sConfigMgr->GetBoolDefault("vmap.enableIndoorCheck", true); @@ -1138,17 +1149,17 @@ void World::LoadConfigSettings(bool reload) bool enableHeight = sConfigMgr->GetBoolDefault("vmap.enableHeight", true); if (!enableHeight) - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "VMap height checking disabled! Creatures movements and other various things WILL be broken! Expect no support."); + TC_LOG_ERROR("server.loading", "VMap height checking disabled! Creatures movements and other various things WILL be broken! Expect no support."); VMAP::VMapFactory::createOrGetVMapManager()->setEnableLineOfSightCalc(enableLOS); VMAP::VMapFactory::createOrGetVMapManager()->setEnableHeightCalc(enableHeight); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "VMap support included. LineOfSight: %i, getHeight: %i, indoorCheck: %i", enableLOS, enableHeight, enableIndoor); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "VMap data directory is: %svmaps", m_dataPath.c_str()); + TC_LOG_INFO("server.loading", "VMap support included. LineOfSight: %i, getHeight: %i, indoorCheck: %i", enableLOS, enableHeight, enableIndoor); + TC_LOG_INFO("server.loading", "VMap data directory is: %svmaps", m_dataPath.c_str()); m_int_configs[CONFIG_MAX_WHO] = sConfigMgr->GetIntDefault("MaxWhoListReturns", 49); m_bool_configs[CONFIG_START_ALL_SPELLS] = sConfigMgr->GetBoolDefault("PlayerStart.AllSpells", false); if (m_bool_configs[CONFIG_START_ALL_SPELLS]) - TC_LOG_WARN(LOG_FILTER_SERVER_LOADING, "PlayerStart.AllSpells enabled - may not function as intended!"); + TC_LOG_WARN("server.loading", "PlayerStart.AllSpells enabled - may not function as intended!"); m_int_configs[CONFIG_HONOR_AFTER_DUEL] = sConfigMgr->GetIntDefault("HonorPointsAfterDuel", 0); m_bool_configs[CONFIG_START_ALL_EXPLORED] = sConfigMgr->GetBoolDefault("PlayerStart.MapsExplored", false); m_bool_configs[CONFIG_START_ALL_REP] = sConfigMgr->GetBoolDefault("PlayerStart.AllReputation", false); @@ -1291,7 +1302,7 @@ void World::SetInitialWorldSettings() !MapManager::ExistMapAndVMap(530, 10349.6f, -6357.29f) || !MapManager::ExistMapAndVMap(530, -3961.64f, -13931.2f)))) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "Correct *.map files not found in path '%smaps' or *.vmtree/*.vmtile files in '%svmaps'. Please place *.map/*.vmtree/*.vmtile files in appropriate directories or correct the DataDir value in the worldserver.conf file.", m_dataPath.c_str(), m_dataPath.c_str()); + TC_LOG_ERROR("server.loading", "Correct *.map files not found in path '%smaps' or *.vmtree/*.vmtile files in '%svmaps'. Please place *.map/*.vmtree/*.vmtile files in appropriate directories or correct the DataDir value in the worldserver.conf file.", m_dataPath.c_str(), m_dataPath.c_str()); exit(1); } @@ -1303,7 +1314,7 @@ void World::SetInitialWorldSettings() ///- Loading strings. Getting no records means core load has to be canceled because no error message can be output. - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Trinity strings..."); + TC_LOG_INFO("server.loading", "Loading Trinity strings..."); if (!sObjectMgr->LoadTrinityStrings()) exit(1); // Error message displayed in function already @@ -1322,36 +1333,36 @@ void World::SetInitialWorldSettings() CharacterDatabase.Execute(stmt); ///- Load the DBC files - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Initialize data stores..."); + TC_LOG_INFO("server.loading", "Initialize data stores..."); LoadDBCStores(m_dataPath); DetectDBCLang(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading SpellInfo store..."); + TC_LOG_INFO("server.loading", "Loading SpellInfo store..."); sSpellMgr->LoadSpellInfoStore(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading SpellInfo corrections..."); + TC_LOG_INFO("server.loading", "Loading SpellInfo corrections..."); sSpellMgr->LoadSpellInfoCorrections(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading SkillLineAbilityMultiMap Data..."); + TC_LOG_INFO("server.loading", "Loading SkillLineAbilityMultiMap Data..."); sSpellMgr->LoadSkillLineAbilityMap(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading SpellInfo custom attributes..."); + TC_LOG_INFO("server.loading", "Loading SpellInfo custom attributes..."); sSpellMgr->LoadSpellInfoCustomAttributes(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading GameObject models..."); + TC_LOG_INFO("server.loading", "Loading GameObject models..."); LoadGameObjectModelList(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Script Names..."); + TC_LOG_INFO("server.loading", "Loading Script Names..."); sObjectMgr->LoadScriptNames(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Instance Template..."); + TC_LOG_INFO("server.loading", "Loading Instance Template..."); sObjectMgr->LoadInstanceTemplate(); // Must be called before `creature_respawn`/`gameobject_respawn` tables - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading instances..."); + TC_LOG_INFO("server.loading", "Loading instances..."); sInstanceSaveMgr->LoadInstances(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Localization strings..."); + TC_LOG_INFO("server.loading", "Loading Localization strings..."); uint32 oldMSTime = getMSTime(); sObjectMgr->LoadCreatureLocales(); sObjectMgr->LoadGameObjectLocales(); @@ -1364,324 +1375,324 @@ void World::SetInitialWorldSettings() sObjectMgr->LoadPointOfInterestLocales(); sObjectMgr->SetDBCLocaleIndex(GetDefaultDbcLocale()); // Get once for all the locale index of DBC language (console/broadcasts) - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Localization strings loaded in %u ms", GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Localization strings loaded in %u ms", GetMSTimeDiffToNow(oldMSTime)); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Account Roles and Permissions..."); + TC_LOG_INFO("server.loading", "Loading Account Roles and Permissions..."); sAccountMgr->LoadRBAC(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Page Texts..."); + TC_LOG_INFO("server.loading", "Loading Page Texts..."); sObjectMgr->LoadPageTexts(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Game Object Templates..."); // must be after LoadPageTexts + TC_LOG_INFO("server.loading", "Loading Game Object Templates..."); // must be after LoadPageTexts sObjectMgr->LoadGameObjectTemplate(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Transport templates..."); + TC_LOG_INFO("server.loading", "Loading Transport templates..."); sTransportMgr->LoadTransportTemplates(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Spell Rank Data..."); + TC_LOG_INFO("server.loading", "Loading Spell Rank Data..."); sSpellMgr->LoadSpellRanks(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Spell Required Data..."); + TC_LOG_INFO("server.loading", "Loading Spell Required Data..."); sSpellMgr->LoadSpellRequired(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Spell Group types..."); + TC_LOG_INFO("server.loading", "Loading Spell Group types..."); sSpellMgr->LoadSpellGroups(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Spell Learn Skills..."); + TC_LOG_INFO("server.loading", "Loading Spell Learn Skills..."); sSpellMgr->LoadSpellLearnSkills(); // must be after LoadSpellRanks - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Spell Learn Spells..."); + TC_LOG_INFO("server.loading", "Loading Spell Learn Spells..."); sSpellMgr->LoadSpellLearnSpells(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Spell Proc Event conditions..."); + TC_LOG_INFO("server.loading", "Loading Spell Proc Event conditions..."); sSpellMgr->LoadSpellProcEvents(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Spell Proc conditions and data..."); + TC_LOG_INFO("server.loading", "Loading Spell Proc conditions and data..."); sSpellMgr->LoadSpellProcs(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Spell Bonus Data..."); + TC_LOG_INFO("server.loading", "Loading Spell Bonus Data..."); sSpellMgr->LoadSpellBonusess(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Aggro Spells Definitions..."); + TC_LOG_INFO("server.loading", "Loading Aggro Spells Definitions..."); sSpellMgr->LoadSpellThreats(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Spell Group Stack Rules..."); + TC_LOG_INFO("server.loading", "Loading Spell Group Stack Rules..."); sSpellMgr->LoadSpellGroupStackRules(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading NPC Texts..."); + TC_LOG_INFO("server.loading", "Loading NPC Texts..."); sObjectMgr->LoadGossipText(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Enchant Spells Proc datas..."); + TC_LOG_INFO("server.loading", "Loading Enchant Spells Proc datas..."); sSpellMgr->LoadSpellEnchantProcData(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Item Random Enchantments Table..."); + TC_LOG_INFO("server.loading", "Loading Item Random Enchantments Table..."); LoadRandomEnchantmentsTable(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Disables"); // must be before loading quests and items + TC_LOG_INFO("server.loading", "Loading Disables"); // must be before loading quests and items DisableMgr::LoadDisables(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Items..."); // must be after LoadRandomEnchantmentsTable and LoadPageTexts + TC_LOG_INFO("server.loading", "Loading Items..."); // must be after LoadRandomEnchantmentsTable and LoadPageTexts sObjectMgr->LoadItemTemplates(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Item set names..."); // must be after LoadItemPrototypes + TC_LOG_INFO("server.loading", "Loading Item set names..."); // must be after LoadItemPrototypes sObjectMgr->LoadItemSetNames(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Creature Model Based Info Data..."); + TC_LOG_INFO("server.loading", "Loading Creature Model Based Info Data..."); sObjectMgr->LoadCreatureModelInfo(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Creature templates..."); + TC_LOG_INFO("server.loading", "Loading Creature templates..."); sObjectMgr->LoadCreatureTemplates(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Equipment templates..."); // must be after LoadCreatureTemplates + TC_LOG_INFO("server.loading", "Loading Equipment templates..."); // must be after LoadCreatureTemplates sObjectMgr->LoadEquipmentTemplates(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Creature template addons..."); + TC_LOG_INFO("server.loading", "Loading Creature template addons..."); sObjectMgr->LoadCreatureTemplateAddons(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Reputation Reward Rates..."); + TC_LOG_INFO("server.loading", "Loading Reputation Reward Rates..."); sObjectMgr->LoadReputationRewardRate(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Creature Reputation OnKill Data..."); + TC_LOG_INFO("server.loading", "Loading Creature Reputation OnKill Data..."); sObjectMgr->LoadReputationOnKill(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Reputation Spillover Data..."); + TC_LOG_INFO("server.loading", "Loading Reputation Spillover Data..."); sObjectMgr->LoadReputationSpilloverTemplate(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Points Of Interest Data..."); + TC_LOG_INFO("server.loading", "Loading Points Of Interest Data..."); sObjectMgr->LoadPointsOfInterest(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Creature Base Stats..."); + TC_LOG_INFO("server.loading", "Loading Creature Base Stats..."); sObjectMgr->LoadCreatureClassLevelStats(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Creature Data..."); + TC_LOG_INFO("server.loading", "Loading Creature Data..."); sObjectMgr->LoadCreatures(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Temporary Summon Data..."); + TC_LOG_INFO("server.loading", "Loading Temporary Summon Data..."); sObjectMgr->LoadTempSummons(); // must be after LoadCreatureTemplates() and LoadGameObjectTemplates() - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading pet levelup spells..."); + TC_LOG_INFO("server.loading", "Loading pet levelup spells..."); sSpellMgr->LoadPetLevelupSpellMap(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading pet default spells additional to levelup spells..."); + TC_LOG_INFO("server.loading", "Loading pet default spells additional to levelup spells..."); sSpellMgr->LoadPetDefaultSpells(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Creature Addon Data..."); + TC_LOG_INFO("server.loading", "Loading Creature Addon Data..."); sObjectMgr->LoadCreatureAddons(); // must be after LoadCreatureTemplates() and LoadCreatures() - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Gameobject Data..."); + TC_LOG_INFO("server.loading", "Loading Gameobject Data..."); sObjectMgr->LoadGameobjects(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Creature Linked Respawn..."); + TC_LOG_INFO("server.loading", "Loading Creature Linked Respawn..."); sObjectMgr->LoadLinkedRespawn(); // must be after LoadCreatures(), LoadGameObjects() - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Weather Data..."); + TC_LOG_INFO("server.loading", "Loading Weather Data..."); WeatherMgr::LoadWeatherData(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Quests..."); + TC_LOG_INFO("server.loading", "Loading Quests..."); sObjectMgr->LoadQuests(); // must be loaded after DBCs, creature_template, item_template, gameobject tables - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Checking Quest Disables"); + TC_LOG_INFO("server.loading", "Checking Quest Disables"); DisableMgr::CheckQuestDisables(); // must be after loading quests - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Quest POI"); + TC_LOG_INFO("server.loading", "Loading Quest POI"); sObjectMgr->LoadQuestPOI(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Quests Starters and Enders..."); + TC_LOG_INFO("server.loading", "Loading Quests Starters and Enders..."); sObjectMgr->LoadQuestStartersAndEnders(); // must be after quest load - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Objects Pooling Data..."); + TC_LOG_INFO("server.loading", "Loading Objects Pooling Data..."); sPoolMgr->LoadFromDB(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Game Event Data..."); // must be after loading pools fully + TC_LOG_INFO("server.loading", "Loading Game Event Data..."); // must be after loading pools fully sGameEventMgr->LoadFromDB(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading UNIT_NPC_FLAG_SPELLCLICK Data..."); // must be after LoadQuests + TC_LOG_INFO("server.loading", "Loading UNIT_NPC_FLAG_SPELLCLICK Data..."); // must be after LoadQuests sObjectMgr->LoadNPCSpellClickSpells(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Vehicle Template Accessories..."); + TC_LOG_INFO("server.loading", "Loading Vehicle Template Accessories..."); sObjectMgr->LoadVehicleTemplateAccessories(); // must be after LoadCreatureTemplates() and LoadNPCSpellClickSpells() - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Vehicle Accessories..."); + TC_LOG_INFO("server.loading", "Loading Vehicle Accessories..."); sObjectMgr->LoadVehicleAccessories(); // must be after LoadCreatureTemplates() and LoadNPCSpellClickSpells() - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading SpellArea Data..."); // must be after quest load + TC_LOG_INFO("server.loading", "Loading SpellArea Data..."); // must be after quest load sSpellMgr->LoadSpellAreas(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading AreaTrigger definitions..."); + TC_LOG_INFO("server.loading", "Loading AreaTrigger definitions..."); sObjectMgr->LoadAreaTriggerTeleports(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Access Requirements..."); + TC_LOG_INFO("server.loading", "Loading Access Requirements..."); sObjectMgr->LoadAccessRequirements(); // must be after item template load - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Quest Area Triggers..."); + TC_LOG_INFO("server.loading", "Loading Quest Area Triggers..."); sObjectMgr->LoadQuestAreaTriggers(); // must be after LoadQuests - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Tavern Area Triggers..."); + TC_LOG_INFO("server.loading", "Loading Tavern Area Triggers..."); sObjectMgr->LoadTavernAreaTriggers(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading AreaTrigger script names..."); + TC_LOG_INFO("server.loading", "Loading AreaTrigger script names..."); sObjectMgr->LoadAreaTriggerScripts(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading LFG entrance positions..."); // Must be after areatriggers + TC_LOG_INFO("server.loading", "Loading LFG entrance positions..."); // Must be after areatriggers sLFGMgr->LoadLFGDungeons(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Dungeon boss data..."); + TC_LOG_INFO("server.loading", "Loading Dungeon boss data..."); sObjectMgr->LoadInstanceEncounters(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading LFG rewards..."); + TC_LOG_INFO("server.loading", "Loading LFG rewards..."); sLFGMgr->LoadRewards(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Graveyard-zone links..."); + TC_LOG_INFO("server.loading", "Loading Graveyard-zone links..."); sObjectMgr->LoadGraveyardZones(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading spell pet auras..."); + TC_LOG_INFO("server.loading", "Loading spell pet auras..."); sSpellMgr->LoadSpellPetAuras(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Spell target coordinates..."); + TC_LOG_INFO("server.loading", "Loading Spell target coordinates..."); sSpellMgr->LoadSpellTargetPositions(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading enchant custom attributes..."); + TC_LOG_INFO("server.loading", "Loading enchant custom attributes..."); sSpellMgr->LoadEnchantCustomAttr(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading linked spells..."); + TC_LOG_INFO("server.loading", "Loading linked spells..."); sSpellMgr->LoadSpellLinked(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Player Create Data..."); + TC_LOG_INFO("server.loading", "Loading Player Create Data..."); sObjectMgr->LoadPlayerInfo(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Exploration BaseXP Data..."); + TC_LOG_INFO("server.loading", "Loading Exploration BaseXP Data..."); sObjectMgr->LoadExplorationBaseXP(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Pet Name Parts..."); + TC_LOG_INFO("server.loading", "Loading Pet Name Parts..."); sObjectMgr->LoadPetNames(); CharacterDatabaseCleaner::CleanDatabase(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading the max pet number..."); + TC_LOG_INFO("server.loading", "Loading the max pet number..."); sObjectMgr->LoadPetNumber(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading pet level stats..."); + TC_LOG_INFO("server.loading", "Loading pet level stats..."); sObjectMgr->LoadPetLevelInfo(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Player Corpses..."); + TC_LOG_INFO("server.loading", "Loading Player Corpses..."); sObjectMgr->LoadCorpses(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Player level dependent mail rewards..."); + TC_LOG_INFO("server.loading", "Loading Player level dependent mail rewards..."); sObjectMgr->LoadMailLevelRewards(); // Loot tables LoadLootTables(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Skill Discovery Table..."); + TC_LOG_INFO("server.loading", "Loading Skill Discovery Table..."); LoadSkillDiscoveryTable(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Skill Extra Item Table..."); + TC_LOG_INFO("server.loading", "Loading Skill Extra Item Table..."); LoadSkillExtraItemTable(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Skill Fishing base level requirements..."); + TC_LOG_INFO("server.loading", "Loading Skill Fishing base level requirements..."); sObjectMgr->LoadFishingBaseSkillLevel(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Achievements..."); + TC_LOG_INFO("server.loading", "Loading Achievements..."); sAchievementMgr->LoadAchievementReferenceList(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Achievement Criteria Lists..."); + TC_LOG_INFO("server.loading", "Loading Achievement Criteria Lists..."); sAchievementMgr->LoadAchievementCriteriaList(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Achievement Criteria Data..."); + TC_LOG_INFO("server.loading", "Loading Achievement Criteria Data..."); sAchievementMgr->LoadAchievementCriteriaData(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Achievement Rewards..."); + TC_LOG_INFO("server.loading", "Loading Achievement Rewards..."); sAchievementMgr->LoadRewards(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Achievement Reward Locales..."); + TC_LOG_INFO("server.loading", "Loading Achievement Reward Locales..."); sAchievementMgr->LoadRewardLocales(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Completed Achievements..."); + TC_LOG_INFO("server.loading", "Loading Completed Achievements..."); sAchievementMgr->LoadCompletedAchievements(); // Delete expired auctions before loading - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Deleting expired auctions..."); + TC_LOG_INFO("server.loading", "Deleting expired auctions..."); sAuctionMgr->DeleteExpiredAuctionsAtStartup(); ///- Load dynamic data tables from the database - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Item Auctions..."); + TC_LOG_INFO("server.loading", "Loading Item Auctions..."); sAuctionMgr->LoadAuctionItems(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Auctions..."); + TC_LOG_INFO("server.loading", "Loading Auctions..."); sAuctionMgr->LoadAuctions(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Guilds..."); + TC_LOG_INFO("server.loading", "Loading Guilds..."); sGuildMgr->LoadGuilds(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading ArenaTeams..."); + TC_LOG_INFO("server.loading", "Loading ArenaTeams..."); sArenaTeamMgr->LoadArenaTeams(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Groups..."); + TC_LOG_INFO("server.loading", "Loading Groups..."); sGroupMgr->LoadGroups(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading ReservedNames..."); + TC_LOG_INFO("server.loading", "Loading ReservedNames..."); sObjectMgr->LoadReservedPlayersNames(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading GameObjects for quests..."); + TC_LOG_INFO("server.loading", "Loading GameObjects for quests..."); sObjectMgr->LoadGameObjectForQuests(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading BattleMasters..."); + TC_LOG_INFO("server.loading", "Loading BattleMasters..."); sBattlegroundMgr->LoadBattleMastersEntry(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading GameTeleports..."); + TC_LOG_INFO("server.loading", "Loading GameTeleports..."); sObjectMgr->LoadGameTele(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Gossip menu..."); + TC_LOG_INFO("server.loading", "Loading Gossip menu..."); sObjectMgr->LoadGossipMenu(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Gossip menu options..."); + TC_LOG_INFO("server.loading", "Loading Gossip menu options..."); sObjectMgr->LoadGossipMenuItems(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Vendors..."); + TC_LOG_INFO("server.loading", "Loading Vendors..."); sObjectMgr->LoadVendors(); // must be after load CreatureTemplate and ItemTemplate - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Trainers..."); + TC_LOG_INFO("server.loading", "Loading Trainers..."); sObjectMgr->LoadTrainerSpell(); // must be after load CreatureTemplate - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Waypoints..."); + TC_LOG_INFO("server.loading", "Loading Waypoints..."); sWaypointMgr->Load(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading SmartAI Waypoints..."); + TC_LOG_INFO("server.loading", "Loading SmartAI Waypoints..."); sSmartWaypointMgr->LoadFromDB(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Creature Formations..."); + TC_LOG_INFO("server.loading", "Loading Creature Formations..."); sFormationMgr->LoadCreatureFormations(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading World States..."); // must be loaded before battleground, outdoor PvP and conditions + TC_LOG_INFO("server.loading", "Loading World States..."); // must be loaded before battleground, outdoor PvP and conditions LoadWorldStates(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Conditions..."); + TC_LOG_INFO("server.loading", "Loading Conditions..."); sConditionMgr->LoadConditions(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading faction change achievement pairs..."); + TC_LOG_INFO("server.loading", "Loading faction change achievement pairs..."); sObjectMgr->LoadFactionChangeAchievements(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading faction change spell pairs..."); + TC_LOG_INFO("server.loading", "Loading faction change spell pairs..."); sObjectMgr->LoadFactionChangeSpells(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading faction change item pairs..."); + TC_LOG_INFO("server.loading", "Loading faction change item pairs..."); sObjectMgr->LoadFactionChangeItems(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading faction change reputation pairs..."); + TC_LOG_INFO("server.loading", "Loading faction change reputation pairs..."); sObjectMgr->LoadFactionChangeReputations(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading faction change title pairs..."); + TC_LOG_INFO("server.loading", "Loading faction change title pairs..."); sObjectMgr->LoadFactionChangeTitles(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading GM tickets..."); + TC_LOG_INFO("server.loading", "Loading GM tickets..."); sTicketMgr->LoadTickets(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading GM surveys..."); + TC_LOG_INFO("server.loading", "Loading GM surveys..."); sTicketMgr->LoadSurveys(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading client addons..."); + TC_LOG_INFO("server.loading", "Loading client addons..."); AddonMgr::LoadFromDB(); ///- Handle outdated emails (delete/return) - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Returning old mails..."); + TC_LOG_INFO("server.loading", "Returning old mails..."); sObjectMgr->ReturnOrDeleteOldMails(false); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Autobroadcasts..."); + TC_LOG_INFO("server.loading", "Loading Autobroadcasts..."); LoadAutobroadcasts(); ///- Load and initialize scripts @@ -1689,39 +1700,33 @@ void World::SetInitialWorldSettings() sObjectMgr->LoadEventScripts(); // must be after load Creature/Gameobject(Template/Data) sObjectMgr->LoadWaypointScripts(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Scripts text locales..."); // must be after Load*Scripts calls + TC_LOG_INFO("server.loading", "Loading Scripts text locales..."); // must be after Load*Scripts calls sObjectMgr->LoadDbScriptStrings(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading CreatureEventAI Texts..."); - sEventAIMgr->LoadCreatureEventAI_Texts(); - - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading CreatureEventAI Scripts..."); - sEventAIMgr->LoadCreatureEventAI_Scripts(); - - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading spell script names..."); + TC_LOG_INFO("server.loading", "Loading spell script names..."); sObjectMgr->LoadSpellScriptNames(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Creature Texts..."); + TC_LOG_INFO("server.loading", "Loading Creature Texts..."); sCreatureTextMgr->LoadCreatureTexts(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Creature Text Locales..."); + TC_LOG_INFO("server.loading", "Loading Creature Text Locales..."); sCreatureTextMgr->LoadCreatureTextLocales(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Initializing Scripts..."); + TC_LOG_INFO("server.loading", "Initializing Scripts..."); sScriptMgr->Initialize(); sScriptMgr->OnConfigLoad(false); // must be done after the ScriptMgr has been properly initialized - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Validating spell scripts..."); + TC_LOG_INFO("server.loading", "Validating spell scripts..."); sObjectMgr->ValidateSpellScripts(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading SmartAI scripts..."); + TC_LOG_INFO("server.loading", "Loading SmartAI scripts..."); sSmartScriptMgr->LoadSmartAIFromDB(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Calendar data..."); + TC_LOG_INFO("server.loading", "Loading Calendar data..."); sCalendarMgr->LoadFromDB(); ///- Initialize game time and timers - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Initialize game time and timers"); + TC_LOG_INFO("server.loading", "Initialize game time and timers"); m_gameTime = time(NULL); m_startTime = m_gameTime; @@ -1750,16 +1755,16 @@ void World::SetInitialWorldSettings() mail_timer = ((((localTm.tm_hour + 20) % 24)* HOUR * IN_MILLISECONDS) / m_timers[WUPDATE_AUCTIONS].GetInterval()); //1440 mail_timer_expires = ((DAY * IN_MILLISECONDS) / (m_timers[WUPDATE_AUCTIONS].GetInterval())); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Mail timer set to: " UI64FMTD ", mail return is called every " UI64FMTD " minutes", uint64(mail_timer), uint64(mail_timer_expires)); + TC_LOG_INFO("server.loading", "Mail timer set to: " UI64FMTD ", mail return is called every " UI64FMTD " minutes", uint64(mail_timer), uint64(mail_timer_expires)); ///- Initilize static helper structures AIRegistry::Initialize(); ///- Initialize MapManager - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Starting Map System"); + TC_LOG_INFO("server.loading", "Starting Map System"); sMapMgr->Initialize(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Starting Game Event system..."); + TC_LOG_INFO("server.loading", "Starting Game Event system..."); uint32 nextGameEvent = sGameEventMgr->StartSystem(); m_timers[WUPDATE_EVENTS].SetInterval(nextGameEvent); //depend on next event @@ -1769,57 +1774,57 @@ void World::SetInitialWorldSettings() // Delete all custom channels which haven't been used for PreserveCustomChannelDuration days. Channel::CleanOldChannelsInDB(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Starting Arena Season..."); + TC_LOG_INFO("server.loading", "Starting Arena Season..."); sGameEventMgr->StartArenaSeason(); sTicketMgr->Initialize(); ///- Initialize Battlegrounds - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Starting Battleground System"); + TC_LOG_INFO("server.loading", "Starting Battleground System"); sBattlegroundMgr->CreateInitialBattlegrounds(); sBattlegroundMgr->InitAutomaticArenaPointDistribution(); ///- Initialize outdoor pvp - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Starting Outdoor PvP System"); + TC_LOG_INFO("server.loading", "Starting Outdoor PvP System"); sOutdoorPvPMgr->InitOutdoorPvP(); ///- Initialize Battlefield - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Starting Battlefield System"); + TC_LOG_INFO("server.loading", "Starting Battlefield System"); sBattlefieldMgr->InitBattlefield(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Transports..."); + TC_LOG_INFO("server.loading", "Loading Transports..."); sTransportMgr->SpawnContinentTransports(); ///- Initialize Warden - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Warden Checks..."); + TC_LOG_INFO("server.loading", "Loading Warden Checks..."); sWardenCheckMgr->LoadWardenChecks(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading Warden Action Overrides..."); + TC_LOG_INFO("server.loading", "Loading Warden Action Overrides..."); sWardenCheckMgr->LoadWardenOverrides(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Deleting expired bans..."); + TC_LOG_INFO("server.loading", "Deleting expired bans..."); LoginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate <= UNIX_TIMESTAMP() AND unbandate<>bandate"); // One-time query - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Calculate next daily quest reset time..."); + TC_LOG_INFO("server.loading", "Calculate next daily quest reset time..."); InitDailyQuestResetTime(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Calculate next weekly quest reset time..."); + TC_LOG_INFO("server.loading", "Calculate next weekly quest reset time..."); InitWeeklyQuestResetTime(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Calculate next monthly quest reset time..."); + TC_LOG_INFO("server.loading", "Calculate next monthly quest reset time..."); InitMonthlyQuestResetTime(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Calculate random battleground reset time..."); + TC_LOG_INFO("server.loading", "Calculate random battleground reset time..."); InitRandomBGResetTime(); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Calculate guild limitation(s) reset time..."); + TC_LOG_INFO("server.loading", "Calculate guild limitation(s) reset time..."); InitGuildResetTime(); LoadCharacterNameData(); uint32 startupDuration = GetMSTimeDiffToNow(startupBegin); - TC_LOG_INFO(LOG_FILTER_WORLDSERVER, "World initialized in %u minutes %u seconds", (startupDuration / 60000), ((startupDuration % 60000) / 1000)); + TC_LOG_INFO("server.worldserver", "World initialized in %u minutes %u seconds", (startupDuration / 60000), ((startupDuration % 60000) / 1000)); if (uint32 realmId = sConfigMgr->GetIntDefault("RealmID", 0)) // 0 reserved for auth sLog->SetRealmId(realmId); @@ -1831,7 +1836,7 @@ void World::DetectDBCLang() if (m_lang_confid != 255 && m_lang_confid >= TOTAL_LOCALES) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "Incorrect DBC.Locale! Must be >= 0 and < %d (set to 0)", TOTAL_LOCALES); + TC_LOG_ERROR("server.loading", "Incorrect DBC.Locale! Must be >= 0 and < %d (set to 0)", TOTAL_LOCALES); m_lang_confid = LOCALE_enUS; } @@ -1859,13 +1864,13 @@ void World::DetectDBCLang() if (default_locale >= TOTAL_LOCALES) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "Unable to determine your DBC Locale! (corrupt DBC?)"); + TC_LOG_ERROR("server.loading", "Unable to determine your DBC Locale! (corrupt DBC?)"); exit(1); } m_defaultDbcLocale = LocaleConstant(default_locale); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Using %s DBC Locale as default. All available DBC locales: %s", localeNames[m_defaultDbcLocale], availableLocalsStr.empty() ? "<none>" : availableLocalsStr.c_str()); + TC_LOG_INFO("server.loading", "Using %s DBC Locale as default. All available DBC locales: %s", localeNames[m_defaultDbcLocale], availableLocalsStr.empty() ? "<none>" : availableLocalsStr.c_str()); } void World::RecordTimeDiff(const char *text, ...) @@ -1888,7 +1893,7 @@ void World::RecordTimeDiff(const char *text, ...) va_start(ap, text); vsnprintf(str, 256, text, ap); va_end(ap); - TC_LOG_INFO(LOG_FILTER_GENERAL, "Difftime %s: %u.", str, diff); + TC_LOG_INFO("misc", "Difftime %s: %u.", str, diff); } m_currentTime = thisTime; @@ -1908,7 +1913,7 @@ void World::LoadAutobroadcasts() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 autobroadcasts definitions. DB table `autobroadcast` is empty for this realm!"); + TC_LOG_INFO("server.loading", ">> Loaded 0 autobroadcasts definitions. DB table `autobroadcast` is empty for this realm!"); return; } @@ -1925,7 +1930,7 @@ void World::LoadAutobroadcasts() ++count; } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u autobroadcast definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u autobroadcast definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } /// Update the World ! @@ -1937,7 +1942,7 @@ void World::Update(uint32 diff) { if (m_updateTimeSum > m_int_configs[CONFIG_INTERVAL_LOG_UPDATE]) { - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "Update time diff: %u. Players online: %u.", m_updateTimeSum / m_updateTimeCount, GetActiveSessionCount()); + TC_LOG_DEBUG("misc", "Update time diff: %u. Players online: %u.", m_updateTimeSum / m_updateTimeCount, GetActiveSessionCount()); m_updateTimeSum = m_updateTime; m_updateTimeCount = 1; } @@ -2102,7 +2107,7 @@ void World::Update(uint32 diff) if (m_timers[WUPDATE_PINGDB].Passed()) { m_timers[WUPDATE_PINGDB].Reset(); - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "Ping MySQL to keep connection alive"); + TC_LOG_DEBUG("misc", "Ping MySQL to keep connection alive"); CharacterDatabase.KeepAlive(); LoginDatabase.KeepAlive(); WorldDatabase.KeepAlive(); @@ -2589,7 +2594,7 @@ void World::ShutdownMsg(bool show, Player* player) ServerMessageType msgid = (m_ShutdownMask & SHUTDOWN_MASK_RESTART) ? SERVER_MSG_RESTART_TIME : SERVER_MSG_SHUTDOWN_TIME; SendServerMessage(msgid, str.c_str(), player); - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "Server is %s in %s", (m_ShutdownMask & SHUTDOWN_MASK_RESTART ? "restart" : "shuttingdown"), str.c_str()); + TC_LOG_DEBUG("misc", "Server is %s in %s", (m_ShutdownMask & SHUTDOWN_MASK_RESTART ? "restart" : "shuttingdown"), str.c_str()); } } @@ -2607,7 +2612,7 @@ void World::ShutdownCancel() m_ExitCode = SHUTDOWN_EXIT_CODE; // to default value SendServerMessage(msgid); - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "Server %s cancelled.", (m_ShutdownMask & SHUTDOWN_MASK_RESTART ? "restart" : "shuttingdown")); + TC_LOG_DEBUG("misc", "Server %s cancelled.", (m_ShutdownMask & SHUTDOWN_MASK_RESTART ? "restart" : "shuttingdown")); sScriptMgr->OnShutdownCancel(); } @@ -2663,7 +2668,7 @@ void World::ProcessCliCommands() CliCommandHolder* command = NULL; while (cliCmdQueue.next(command)) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "CLI command under processing..."); + TC_LOG_INFO("misc", "CLI command under processing..."); zprint = command->m_print; callbackArg = command->m_callbackArg; CliHandler handler(callbackArg, zprint); @@ -2728,7 +2733,7 @@ void World::SendAutoBroadcast() sWorld->SendGlobalMessage(&data); } - TC_LOG_DEBUG(LOG_FILTER_GENERAL, "AutoBroadcast: '%s'", msg.c_str()); + TC_LOG_DEBUG("misc", "AutoBroadcast: '%s'", msg.c_str()); } void World::UpdateRealmCharCount(uint32 accountId) @@ -2867,7 +2872,7 @@ void World::InitGuildResetTime() void World::ResetDailyQuests() { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Daily quests reset for all characters."); + TC_LOG_INFO("misc", "Daily quests reset for all characters."); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_QUEST_STATUS_DAILY); CharacterDatabase.Execute(stmt); @@ -2901,7 +2906,7 @@ void World::SetPlayerSecurityLimit(AccountTypes _sec) void World::ResetWeeklyQuests() { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Weekly quests reset for all characters."); + TC_LOG_INFO("misc", "Weekly quests reset for all characters."); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_QUEST_STATUS_WEEKLY); CharacterDatabase.Execute(stmt); @@ -2919,7 +2924,7 @@ void World::ResetWeeklyQuests() void World::ResetMonthlyQuests() { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Monthly quests reset for all characters."); + TC_LOG_INFO("misc", "Monthly quests reset for all characters."); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_QUEST_STATUS_MONTHLY); CharacterDatabase.Execute(stmt); @@ -2974,7 +2979,7 @@ void World::ResetEventSeasonalQuests(uint16 event_id) void World::ResetRandomBG() { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Random BG status reset for all characters."); + TC_LOG_INFO("misc", "Random BG status reset for all characters."); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_BATTLEGROUND_RANDOM); CharacterDatabase.Execute(stmt); @@ -2989,7 +2994,7 @@ void World::ResetRandomBG() void World::ResetGuildCap() { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Guild Daily Cap reset."); + TC_LOG_INFO("misc", "Guild Daily Cap reset."); m_NextGuildReset = time_t(m_NextGuildReset + DAY); sWorld->setWorldState(WS_GUILD_DAILY_RESET_TIME, uint64(m_NextGuildReset)); @@ -3018,16 +3023,6 @@ void World::LoadDBVersion() m_DBVersion = "Unknown world database."; } -void World::ProcessStartEvent() -{ - isEventKillStart = true; -} - -void World::ProcessStopEvent() -{ - isEventKillStart = false; -} - void World::UpdateAreaDependentAuras() { SessionMap::const_iterator itr; @@ -3047,7 +3042,7 @@ void World::LoadWorldStates() if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 world states. DB table `worldstates` is empty!"); + TC_LOG_INFO("server.loading", ">> Loaded 0 world states. DB table `worldstates` is empty!"); return; } @@ -3062,7 +3057,7 @@ void World::LoadWorldStates() } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u world states in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u world states in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -3140,12 +3135,12 @@ void World::ProcessQueryCallbacks() void World::LoadCharacterNameData() { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loading character name data"); + TC_LOG_INFO("server.loading", "Loading character name data"); QueryResult result = CharacterDatabase.Query("SELECT guid, name, race, gender, class, level FROM characters WHERE deleteDate IS NULL"); if (!result) { - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "No character name data loaded, empty query"); + TC_LOG_INFO("server.loading", "No character name data loaded, empty query"); return; } @@ -3159,7 +3154,7 @@ void World::LoadCharacterNameData() ++count; } while (result->NextRow()); - TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, "Loaded name data for %u characters", count); + TC_LOG_INFO("server.loading", "Loaded name data for %u characters", count); } void World::AddCharacterNameData(uint32 guid, std::string const& name, uint8 gender, uint8 race, uint8 playerClass, uint8 level) @@ -3208,7 +3203,7 @@ CharacterNameData const* World::GetCharacterNameData(uint32 guid) const void World::ReloadRBAC() { // Passive reload, we mark the data as invalidated and next time a permission is checked it will be reloaded - TC_LOG_INFO(LOG_FILTER_RBAC, "World::ReloadRBAC()"); + TC_LOG_INFO("rbac", "World::ReloadRBAC()"); for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr) if (WorldSession* session = itr->second) session->InvalidateRBACData(); diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index 9435fa8aa94..9422566b707 100644 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -731,12 +731,6 @@ class World void UpdateAreaDependentAuras(); - void ProcessStartEvent(); - void ProcessStopEvent(); - bool GetEventKill() const { return isEventKillStart; } - - bool isEventKillStart; - CharacterNameData const* GetCharacterNameData(uint32 guid) const; void AddCharacterNameData(uint32 guid, std::string const& name, uint8 gender, uint8 race, uint8 playerClass, uint8 level); void UpdateCharacterNameData(uint32 guid, std::string const& name, uint8 gender = GENDER_NONE, uint8 race = RACE_NONE); diff --git a/src/server/scripts/CMakeLists.txt b/src/server/scripts/CMakeLists.txt index 5be634d2060..20e4c4c7fdd 100644 --- a/src/server/scripts/CMakeLists.txt +++ b/src/server/scripts/CMakeLists.txt @@ -73,7 +73,6 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/server/game/Addons ${CMAKE_SOURCE_DIR}/src/server/game/AI ${CMAKE_SOURCE_DIR}/src/server/game/AI/CoreAI - ${CMAKE_SOURCE_DIR}/src/server/game/AI/EventAI ${CMAKE_SOURCE_DIR}/src/server/game/AI/ScriptedAI ${CMAKE_SOURCE_DIR}/src/server/game/AI/SmartScripts ${CMAKE_SOURCE_DIR}/src/server/game/AuctionHouse diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp index 45ab88e9688..6e9dbea8b21 100644 --- a/src/server/scripts/Commands/cs_account.cpp +++ b/src/server/scripts/Commands/cs_account.cpp @@ -133,7 +133,7 @@ public: handler->PSendSysMessage(LANG_ACCOUNT_CREATED, accountName); if (handler->GetSession()) { - TC_LOG_INFO(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Character:[%s] (GUID: %u) created Account %s (Email: '%s')", + TC_LOG_INFO("entities.player.character", "Account: %d (IP: %s) Character:[%s] (GUID: %u) created Account %s (Email: '%s')", handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(), handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUIDLow(), accountName, email.c_str()); @@ -298,7 +298,7 @@ public: else { handler->PSendSysMessage("[IP2NATION] Table empty"); - TC_LOG_DEBUG(LOG_FILTER_AUTHSERVER, "[IP2NATION] Table empty"); + TC_LOG_DEBUG("server.authserver", "[IP2NATION] Table empty"); } } else if (param == "off") @@ -378,7 +378,7 @@ public: { handler->SendSysMessage(LANG_COMMAND_WRONGEMAIL); handler->SetSentErrorMessage(true); - TC_LOG_INFO(LOG_FILTER_CHARACTER, "Account: %u (IP: %s) Character:[%s] (GUID: %u) Tried to change email, but the provided email [%s] is not equal to registration email [%s].", + TC_LOG_INFO("entities.player.character", "Account: %u (IP: %s) Character:[%s] (GUID: %u) Tried to change email, but the provided email [%s] is not equal to registration email [%s].", handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(), handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUIDLow(), email, oldEmail); @@ -389,7 +389,7 @@ public: { handler->SendSysMessage(LANG_COMMAND_WRONGOLDPASSWORD); handler->SetSentErrorMessage(true); - TC_LOG_INFO(LOG_FILTER_CHARACTER, "Account: %u (IP: %s) Character:[%s] (GUID: %u) Tried to change email, but the provided password is wrong.", + TC_LOG_INFO("entities.player.character", "Account: %u (IP: %s) Character:[%s] (GUID: %u) Tried to change email, but the provided password is wrong.", handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(), handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUIDLow()); return false; @@ -406,7 +406,7 @@ public: { handler->SendSysMessage(LANG_NEW_EMAILS_NOT_MATCH); handler->SetSentErrorMessage(true); - TC_LOG_INFO(LOG_FILTER_CHARACTER, "Account: %u (IP: %s) Character:[%s] (GUID: %u) Tried to change email, but the provided password is wrong.", + TC_LOG_INFO("entities.player.character", "Account: %u (IP: %s) Character:[%s] (GUID: %u) Tried to change email, but the provided password is wrong.", handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(), handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUIDLow()); return false; @@ -418,7 +418,7 @@ public: { case AOR_OK: handler->SendSysMessage(LANG_COMMAND_EMAIL); - TC_LOG_INFO(LOG_FILTER_CHARACTER, "Account: %u (IP: %s) Character:[%s] (GUID: %u) Changed Email from [%s] to [%s].", + TC_LOG_INFO("entities.player.character", "Account: %u (IP: %s) Character:[%s] (GUID: %u) Changed Email from [%s] to [%s].", handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(), handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUIDLow(), oldEmail, email); @@ -470,7 +470,7 @@ public: { handler->SendSysMessage(LANG_COMMAND_WRONGOLDPASSWORD); handler->SetSentErrorMessage(true); - TC_LOG_INFO(LOG_FILTER_CHARACTER, "Account: %u (IP: %s) Character:[%s] (GUID: %u) Tried to change password, but the provided old password is wrong.", + TC_LOG_INFO("entities.player.character", "Account: %u (IP: %s) Character:[%s] (GUID: %u) Tried to change password, but the provided old password is wrong.", handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(), handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUIDLow()); return false; @@ -482,7 +482,7 @@ public: { handler->SendSysMessage(LANG_COMMAND_WRONGEMAIL); handler->SetSentErrorMessage(true); - TC_LOG_INFO(LOG_FILTER_CHARACTER, "Account: %u (IP: %s) Character:[%s] (GUID: %u) Tried to change password, but the entered email [%s] is wrong.", + TC_LOG_INFO("entities.player.character", "Account: %u (IP: %s) Character:[%s] (GUID: %u) Tried to change password, but the entered email [%s] is wrong.", handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(), handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUIDLow(), emailConfirmation); @@ -503,7 +503,7 @@ public: { case AOR_OK: handler->SendSysMessage(LANG_COMMAND_PASSWORD); - TC_LOG_INFO(LOG_FILTER_CHARACTER, "Account: %u (IP: %s) Character:[%s] (GUID: %u) Changed Password.", + TC_LOG_INFO("entities.player.character", "Account: %u (IP: %s) Character:[%s] (GUID: %u) Changed Password.", handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(), handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUIDLow()); break; @@ -845,7 +845,7 @@ public: { case AOR_OK: handler->SendSysMessage(LANG_COMMAND_EMAIL); - TC_LOG_INFO(LOG_FILTER_CHARACTER, "ChangeEmail: Account %s [Id: %u] had it's email changed to %s.", + TC_LOG_INFO("entities.player.character", "ChangeEmail: Account %s [Id: %u] had it's email changed to %s.", accountName.c_str(), targetAccountId, email); break; case AOR_NAME_NOT_EXIST: @@ -921,7 +921,7 @@ public: { case AOR_OK: handler->SendSysMessage(LANG_COMMAND_EMAIL); - TC_LOG_INFO(LOG_FILTER_CHARACTER, "ChangeRegEmail: Account %s [Id: %u] had it's Registration Email changed to %s.", + TC_LOG_INFO("entities.player.character", "ChangeRegEmail: Account %s [Id: %u] had it's Registration Email changed to %s.", accountName.c_str(), targetAccountId, email); break; case AOR_NAME_NOT_EXIST: diff --git a/src/server/scripts/Commands/cs_arena.cpp b/src/server/scripts/Commands/cs_arena.cpp index 57eb87d0ef8..42cfa50bc05 100644 --- a/src/server/scripts/Commands/cs_arena.cpp +++ b/src/server/scripts/Commands/cs_arena.cpp @@ -143,10 +143,10 @@ public: std::string name = arena->GetName(); arena->Disband(); if (handler->GetSession()) - TC_LOG_DEBUG(LOG_FILTER_ARENAS, "GameMaster: %s [GUID: %u] disbanded arena team type: %u [Id: %u].", + TC_LOG_DEBUG("bg.arena", "GameMaster: %s [GUID: %u] disbanded arena team type: %u [Id: %u].", handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUIDLow(), arena->GetType(), teamId); else - TC_LOG_DEBUG(LOG_FILTER_ARENAS, "Console: disbanded arena team type: %u [Id: %u].", arena->GetType(), teamId); + TC_LOG_DEBUG("bg.arena", "Console: disbanded arena team type: %u [Id: %u].", arena->GetType(), teamId); delete(arena); @@ -208,10 +208,10 @@ public: handler->PSendSysMessage(LANG_ARENA_RENAME, arena->GetId(), oldArenaStr, newArenaStr); if (handler->GetSession()) - TC_LOG_DEBUG(LOG_FILTER_ARENAS, "GameMaster: %s [GUID: %u] rename arena team \"%s\"[Id: %u] to \"%s\"", + TC_LOG_DEBUG("bg.arena", "GameMaster: %s [GUID: %u] rename arena team \"%s\"[Id: %u] to \"%s\"", handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUIDLow(), oldArenaStr, arena->GetId(), newArenaStr); else - TC_LOG_DEBUG(LOG_FILTER_ARENAS, "Console: rename arena team \"%s\"[Id: %u] to \"%s\"", oldArenaStr, arena->GetId(), newArenaStr); + TC_LOG_DEBUG("bg.arena", "Console: rename arena team \"%s\"[Id: %u] to \"%s\"", oldArenaStr, arena->GetId(), newArenaStr); return true; } @@ -284,10 +284,10 @@ public: handler->PSendSysMessage(LANG_ARENA_CAPTAIN, arena->GetName().c_str(), arena->GetId(), oldCaptainNameData->m_name.c_str(), target->GetName().c_str()); if (handler->GetSession()) - TC_LOG_DEBUG(LOG_FILTER_ARENAS, "GameMaster: %s [GUID: %u] promoted player: %s [GUID: %u] to leader of arena team \"%s\"[Id: %u]", + TC_LOG_DEBUG("bg.arena", "GameMaster: %s [GUID: %u] promoted player: %s [GUID: %u] to leader of arena team \"%s\"[Id: %u]", handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUIDLow(), target->GetName().c_str(), target->GetGUIDLow(), arena->GetName().c_str(), arena->GetId()); else - TC_LOG_DEBUG(LOG_FILTER_ARENAS, "Console: promoted player: %s [GUID: %u] to leader of arena team \"%s\"[Id: %u]", + TC_LOG_DEBUG("bg.arena", "Console: promoted player: %s [GUID: %u] to leader of arena team \"%s\"[Id: %u]", target->GetName().c_str(), target->GetGUIDLow(), arena->GetName().c_str(), arena->GetId()); return true; diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index f33e583522e..d84cf140ac1 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -413,11 +413,11 @@ public: } else { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Sending opcode that has unknown type '%s'", type.c_str()); + TC_LOG_ERROR("misc", "Sending opcode that has unknown type '%s'", type.c_str()); break; } } - TC_LOG_DEBUG(LOG_FILTER_NETWORKIO, "Sending opcode %u", data.GetOpcode()); + TC_LOG_DEBUG("network", "Sending opcode %u", data.GetOpcode()); data.hexlike(); player->GetSession()->SendPacket(&data); handler->PSendSysMessage(LANG_COMMAND_OPCODESENT, data.GetOpcode(), unit->GetName().c_str()); @@ -923,7 +923,7 @@ public: if (!ve) return false; - Creature* v = new Creature; + Creature* v = new Creature(); Map* map = handler->GetSession()->GetPlayer()->GetMap(); @@ -1360,7 +1360,7 @@ public: { Player* player = handler->GetSession()->GetPlayer(); - TC_LOG_INFO(LOG_FILTER_SQL_DEV, "(@PATH, XX, %.3f, %.3f, %.5f, 0, 0, 0, 100, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ()); + TC_LOG_INFO("sql.dev", "(@PATH, XX, %.3f, %.3f, %.5f, 0, 0, 0, 100, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ()); handler->PSendSysMessage("Waypoint SQL written to SQL Developer log"); return true; diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp index cdc67b884ca..6bb927fec5e 100644 --- a/src/server/scripts/Commands/cs_gobject.cpp +++ b/src/server/scripts/Commands/cs_gobject.cpp @@ -136,7 +136,7 @@ public: if (objectInfo->displayId && !sGameObjectDisplayInfoStore.LookupEntry(objectInfo->displayId)) { // report to DB errors log as in loading case - TC_LOG_ERROR(LOG_FILTER_SQL, "Gameobject (Entry %u GoType: %u) have invalid displayId (%u), not spawned.", objectId, objectInfo->type, objectInfo->displayId); + TC_LOG_ERROR("sql.sql", "Gameobject (Entry %u GoType: %u) have invalid displayId (%u), not spawned.", objectId, objectInfo->type, objectInfo->displayId); handler->PSendSysMessage(LANG_GAMEOBJECT_HAVE_INVALID_DATA, objectId); handler->SetSentErrorMessage(true); return false; diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index 2a52ffc8f22..06a97d91250 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -1110,7 +1110,7 @@ public: if (!playerTarget) playerTarget = player; - TC_LOG_DEBUG(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_ADDITEM), itemId, count); + TC_LOG_DEBUG("misc", handler->GetTrinityString(LANG_ADDITEM), itemId, count); ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemId); if (!itemTemplate) @@ -1189,7 +1189,7 @@ public: if (!playerTarget) playerTarget = player; - TC_LOG_DEBUG(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_ADDITEMSET), itemSetId); + TC_LOG_DEBUG("misc", handler->GetTrinityString(LANG_ADDITEMSET), itemSetId); bool found = false; ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore(); diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp index 81a440ad42c..4aa7c19fea6 100644 --- a/src/server/scripts/Commands/cs_modify.cpp +++ b/src/server/scripts/Commands/cs_modify.cpp @@ -203,7 +203,7 @@ public: target->SetMaxPower(POWER_ENERGY, energym); target->SetPower(POWER_ENERGY, energy); - TC_LOG_DEBUG(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_CURRENT_ENERGY), target->GetMaxPower(POWER_ENERGY)); + TC_LOG_DEBUG("misc", handler->GetTrinityString(LANG_CURRENT_ENERGY), target->GetMaxPower(POWER_ENERGY)); return true; } @@ -1009,7 +1009,7 @@ public: { int32 newmoney = int32(targetMoney) + moneyToAdd; - TC_LOG_DEBUG(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_CURRENT_MONEY), targetMoney, moneyToAdd, newmoney); + TC_LOG_DEBUG("misc", handler->GetTrinityString(LANG_CURRENT_MONEY), targetMoney, moneyToAdd, newmoney); if (newmoney <= 0) { handler->PSendSysMessage(LANG_YOU_TAKE_ALL_MONEY, handler->GetNameLink(target).c_str()); @@ -1044,7 +1044,7 @@ public: target->ModifyMoney(moneyToAdd); } - TC_LOG_DEBUG(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_NEW_MONEY), targetMoney, moneyToAdd, target->GetMoney()); + TC_LOG_DEBUG("misc", handler->GetTrinityString(LANG_NEW_MONEY), targetMoney, moneyToAdd, target->GetMoney()); return true; } diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index a1b23fd5935..b472ba48a5c 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -965,7 +965,7 @@ public: if (dontdel_str) { - //TC_LOG_ERROR(LOG_FILTER_GENERAL, "DEBUG: All 3 params are set"); + //TC_LOG_ERROR("misc", "DEBUG: All 3 params are set"); // All 3 params are set // GUID @@ -973,7 +973,7 @@ public: // doNotDEL if (stricmp(dontdel_str, "NODEL") == 0) { - //TC_LOG_ERROR(LOG_FILTER_GENERAL, "DEBUG: doNotDelete = true;"); + //TC_LOG_ERROR("misc", "DEBUG: doNotDelete = true;"); doNotDelete = true; } } @@ -982,10 +982,10 @@ public: // Only 2 params - but maybe NODEL is set if (type_str) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "DEBUG: Only 2 params "); + TC_LOG_ERROR("misc", "DEBUG: Only 2 params "); if (stricmp(type_str, "NODEL") == 0) { - //TC_LOG_ERROR(LOG_FILTER_GENERAL, "DEBUG: type_str, NODEL "); + //TC_LOG_ERROR("misc", "DEBUG: type_str, NODEL "); doNotDelete = true; type_str = NULL; } diff --git a/src/server/scripts/Commands/cs_pet.cpp b/src/server/scripts/Commands/cs_pet.cpp index 963537f0320..9a61250d193 100644 --- a/src/server/scripts/Commands/cs_pet.cpp +++ b/src/server/scripts/Commands/cs_pet.cpp @@ -90,7 +90,7 @@ public: if (!pet->InitStatsForLevel(creatureTarget->getLevel())) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "InitStatsForLevel() in EffectTameCreature failed! Pet deleted."); + TC_LOG_ERROR("misc", "InitStatsForLevel() in EffectTameCreature failed! Pet deleted."); handler->PSendSysMessage("Error 2"); delete pet; return false; diff --git a/src/server/scripts/Commands/cs_quest.cpp b/src/server/scripts/Commands/cs_quest.cpp index 84adeb3417c..83e65d2f01f 100644 --- a/src/server/scripts/Commands/cs_quest.cpp +++ b/src/server/scripts/Commands/cs_quest.cpp @@ -92,7 +92,7 @@ public: // ok, normal (creature/GO starting) quest if (player->CanAddQuest(quest, true)) { - player->AddQuest(quest, NULL); + player->AddQuestAndCheckCompletion(quest, NULL); if (player->CanCompleteQuest(entry)) player->CompleteQuest(entry); diff --git a/src/server/scripts/Commands/cs_reload.cpp b/src/server/scripts/Commands/cs_reload.cpp index fe0f3ee6ce3..59477c6684f 100644 --- a/src/server/scripts/Commands/cs_reload.cpp +++ b/src/server/scripts/Commands/cs_reload.cpp @@ -26,7 +26,6 @@ EndScriptData */ #include "AchievementMgr.h" #include "AuctionHouseMgr.h" #include "Chat.h" -#include "CreatureEventAIMgr.h" #include "CreatureTextMgr.h" #include "DisableMgr.h" #include "Language.h" @@ -53,7 +52,6 @@ public: { { "achievement", rbac::RBAC_PERM_COMMAND_RELOAD_ALL_ACHIEVEMENT, true, &HandleReloadAllAchievementCommand, "", NULL }, { "area", rbac::RBAC_PERM_COMMAND_RELOAD_ALL_AREA, true, &HandleReloadAllAreaCommand, "", NULL }, - { "eventai", rbac::RBAC_PERM_COMMAND_RELOAD_ALL_EVENTAI, true, &HandleReloadAllEventAICommand, "", NULL }, { "gossips", rbac::RBAC_PERM_COMMAND_RELOAD_ALL_GOSSIP, true, &HandleReloadAllGossipsCommand, "", NULL }, { "item", rbac::RBAC_PERM_COMMAND_RELOAD_ALL_ITEM, true, &HandleReloadAllItemCommand, "", NULL }, { "locales", rbac::RBAC_PERM_COMMAND_RELOAD_ALL_LOCALES, true, &HandleReloadAllLocalesCommand, "", NULL }, @@ -80,8 +78,6 @@ public: { "conditions", rbac::RBAC_PERM_COMMAND_RELOAD_CONDITIONS, true, &HandleReloadConditions, "", NULL }, { "config", rbac::RBAC_PERM_COMMAND_RELOAD_CONFIG, true, &HandleReloadConfigCommand, "", NULL }, { "creature_text", rbac::RBAC_PERM_COMMAND_RELOAD_CREATURE_TEXT, true, &HandleReloadCreatureText, "", NULL }, - { "creature_ai_scripts", rbac::RBAC_PERM_COMMAND_RELOAD_CREATURE_AI_SCRIPTS, true, &HandleReloadEventAIScriptsCommand, "", NULL }, - { "creature_ai_texts", rbac::RBAC_PERM_COMMAND_RELOAD_CREATURE_AI_TEXTS, true, &HandleReloadEventAITextsCommand, "", NULL }, { "creature_questender", rbac::RBAC_PERM_COMMAND_RELOAD_CREATURE_QUESTENDER, true, &HandleReloadCreatureQuestEnderCommand, "", NULL }, { "creature_linked_respawn", rbac::RBAC_PERM_COMMAND_RELOAD_CREATURE_LINKED_RESPAWN, true, &HandleReloadLinkedRespawnCommand, "", NULL }, { "creature_loot_template", rbac::RBAC_PERM_COMMAND_RELOAD_CREATURE_LOOT_TEMPLATE, true, &HandleReloadLootTemplatesCreatureCommand, "", NULL }, @@ -182,7 +178,6 @@ public: HandleReloadAllAchievementCommand(handler, ""); HandleReloadAllAreaCommand(handler, ""); - HandleReloadAllEventAICommand(handler, ""); HandleReloadAllLootCommand(handler, ""); HandleReloadAllNpcCommand(handler, ""); HandleReloadAllQuestCommand(handler, ""); @@ -225,7 +220,7 @@ public: static bool HandleReloadAllLootCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Loot Tables..."); + TC_LOG_INFO("misc", "Re-Loading Loot Tables..."); LoadLootTables(); handler->SendGlobalGMSysMessage("DB tables `*_loot_template` reloaded."); sConditionMgr->LoadConditions(true); @@ -248,7 +243,7 @@ public: HandleReloadQuestPOICommand(handler, "a"); HandleReloadQuestTemplateCommand(handler, "a"); - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Quests Relations..."); + TC_LOG_INFO("misc", "Re-Loading Quests Relations..."); sObjectMgr->LoadQuestStartersAndEnders(); handler->SendGlobalGMSysMessage("DB tables `*_queststarter` and `*_questender` reloaded."); return true; @@ -263,7 +258,7 @@ public: return false; } - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Scripts..."); + TC_LOG_INFO("misc", "Re-Loading Scripts..."); HandleReloadEventScriptsCommand(handler, "a"); HandleReloadSpellScriptsCommand(handler, "a"); handler->SendGlobalGMSysMessage("DB tables `*_scripts` reloaded."); @@ -273,13 +268,6 @@ public: return true; } - static bool HandleReloadAllEventAICommand(ChatHandler* handler, const char* /*args*/) - { - HandleReloadEventAITextsCommand(handler, "a"); - HandleReloadEventAIScriptsCommand(handler, "a"); - return true; - } - static bool HandleReloadAllSpellCommand(ChatHandler* handler, const char* /*args*/) { HandleReloadSkillDiscoveryTemplateCommand(handler, "a"); @@ -332,7 +320,7 @@ public: static bool HandleReloadConfigCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading config settings..."); + TC_LOG_INFO("misc", "Re-Loading config settings..."); sWorld->LoadConfigSettings(true); sMapMgr->InitializeVisibilityDistanceInfo(); handler->SendGlobalGMSysMessage("World config settings reloaded."); @@ -341,7 +329,7 @@ public: static bool HandleReloadAccessRequirementCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Access Requirement definitions..."); + TC_LOG_INFO("misc", "Re-Loading Access Requirement definitions..."); sObjectMgr->LoadAccessRequirements(); handler->SendGlobalGMSysMessage("DB table `access_requirement` reloaded."); return true; @@ -349,7 +337,7 @@ public: static bool HandleReloadAchievementCriteriaDataCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Additional Achievement Criteria Data..."); + TC_LOG_INFO("misc", "Re-Loading Additional Achievement Criteria Data..."); sAchievementMgr->LoadAchievementCriteriaData(); handler->SendGlobalGMSysMessage("DB table `achievement_criteria_data` reloaded."); return true; @@ -357,7 +345,7 @@ public: static bool HandleReloadAchievementRewardCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Achievement Reward Data..."); + TC_LOG_INFO("misc", "Re-Loading Achievement Reward Data..."); sAchievementMgr->LoadRewards(); handler->SendGlobalGMSysMessage("DB table `achievement_reward` reloaded."); return true; @@ -365,7 +353,7 @@ public: static bool HandleReloadAreaTriggerTavernCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Tavern Area Triggers..."); + TC_LOG_INFO("misc", "Re-Loading Tavern Area Triggers..."); sObjectMgr->LoadTavernAreaTriggers(); handler->SendGlobalGMSysMessage("DB table `areatrigger_tavern` reloaded."); return true; @@ -373,7 +361,7 @@ public: static bool HandleReloadAreaTriggerTeleportCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading AreaTrigger teleport definitions..."); + TC_LOG_INFO("misc", "Re-Loading AreaTrigger teleport definitions..."); sObjectMgr->LoadAreaTriggerTeleports(); handler->SendGlobalGMSysMessage("DB table `areatrigger_teleport` reloaded."); return true; @@ -381,7 +369,7 @@ public: static bool HandleReloadAutobroadcastCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Autobroadcasts..."); + TC_LOG_INFO("misc", "Re-Loading Autobroadcasts..."); sWorld->LoadAutobroadcasts(); handler->SendGlobalGMSysMessage("DB table `autobroadcast` reloaded."); return true; @@ -396,7 +384,7 @@ public: static bool HandleReloadOnKillReputationCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading creature award reputation definitions..."); + TC_LOG_INFO("misc", "Re-Loading creature award reputation definitions..."); sObjectMgr->LoadReputationOnKill(); handler->SendGlobalGMSysMessage("DB table `creature_onkill_reputation` reloaded."); return true; @@ -404,7 +392,7 @@ public: static bool HandleReloadCreatureSummonGroupsCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Reloading creature summon groups..."); + TC_LOG_INFO("misc", "Reloading creature summon groups..."); sObjectMgr->LoadTempSummons(); handler->SendGlobalGMSysMessage("DB table `creature_summon_groups` reloaded."); return true; @@ -438,7 +426,7 @@ public: continue; } - TC_LOG_INFO(LOG_FILTER_GENERAL, "Reloading creature template entry %u", entry); + TC_LOG_INFO("misc", "Reloading creature template entry %u", entry); Field* fields = result->Fetch(); @@ -534,7 +522,7 @@ public: static bool HandleReloadCreatureQuestStarterCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Loading Quests Relations... (`creature_queststarter`)"); + TC_LOG_INFO("misc", "Loading Quests Relations... (`creature_queststarter`)"); sObjectMgr->LoadCreatureQuestStarters(); handler->SendGlobalGMSysMessage("DB table `creature_queststarter` reloaded."); return true; @@ -542,7 +530,7 @@ public: static bool HandleReloadLinkedRespawnCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Loading Linked Respawns... (`creature_linked_respawn`)"); + TC_LOG_INFO("misc", "Loading Linked Respawns... (`creature_linked_respawn`)"); sObjectMgr->LoadLinkedRespawn(); handler->SendGlobalGMSysMessage("DB table `creature_linked_respawn` (creature linked respawns) reloaded."); return true; @@ -550,7 +538,7 @@ public: static bool HandleReloadCreatureQuestEnderCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Loading Quests Relations... (`creature_questender`)"); + TC_LOG_INFO("misc", "Loading Quests Relations... (`creature_questender`)"); sObjectMgr->LoadCreatureQuestEnders(); handler->SendGlobalGMSysMessage("DB table `creature_questender` reloaded."); return true; @@ -558,7 +546,7 @@ public: static bool HandleReloadGossipMenuCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading `gossip_menu` Table!"); + TC_LOG_INFO("misc", "Re-Loading `gossip_menu` Table!"); sObjectMgr->LoadGossipMenu(); handler->SendGlobalGMSysMessage("DB table `gossip_menu` reloaded."); sConditionMgr->LoadConditions(true); @@ -567,7 +555,7 @@ public: static bool HandleReloadGossipMenuOptionCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading `gossip_menu_option` Table!"); + TC_LOG_INFO("misc", "Re-Loading `gossip_menu_option` Table!"); sObjectMgr->LoadGossipMenuItems(); handler->SendGlobalGMSysMessage("DB table `gossip_menu_option` reloaded."); sConditionMgr->LoadConditions(true); @@ -576,7 +564,7 @@ public: static bool HandleReloadGOQuestStarterCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Loading Quests Relations... (`gameobject_queststarter`)"); + TC_LOG_INFO("misc", "Loading Quests Relations... (`gameobject_queststarter`)"); sObjectMgr->LoadGameobjectQuestStarters(); handler->SendGlobalGMSysMessage("DB table `gameobject_queststarter` reloaded."); return true; @@ -584,7 +572,7 @@ public: static bool HandleReloadGOQuestEnderCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Loading Quests Relations... (`gameobject_questender`)"); + TC_LOG_INFO("misc", "Loading Quests Relations... (`gameobject_questender`)"); sObjectMgr->LoadGameobjectQuestEnders(); handler->SendGlobalGMSysMessage("DB table `gameobject_questender` reloaded."); return true; @@ -592,7 +580,7 @@ public: static bool HandleReloadQuestAreaTriggersCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Quest Area Triggers..."); + TC_LOG_INFO("misc", "Re-Loading Quest Area Triggers..."); sObjectMgr->LoadQuestAreaTriggers(); handler->SendGlobalGMSysMessage("DB table `areatrigger_involvedrelation` (quest area triggers) reloaded."); return true; @@ -600,12 +588,12 @@ public: static bool HandleReloadQuestTemplateCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Quest Templates..."); + TC_LOG_INFO("misc", "Re-Loading Quest Templates..."); sObjectMgr->LoadQuests(); handler->SendGlobalGMSysMessage("DB table `quest_template` (quest definitions) reloaded."); /// dependent also from `gameobject` but this table not reloaded anyway - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading GameObjects for quests..."); + TC_LOG_INFO("misc", "Re-Loading GameObjects for quests..."); sObjectMgr->LoadGameObjectForQuests(); handler->SendGlobalGMSysMessage("Data GameObjects for quests reloaded."); return true; @@ -613,7 +601,7 @@ public: static bool HandleReloadLootTemplatesCreatureCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`creature_loot_template`)"); + TC_LOG_INFO("misc", "Re-Loading Loot Tables... (`creature_loot_template`)"); LoadLootTemplates_Creature(); LootTemplates_Creature.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `creature_loot_template` reloaded."); @@ -623,7 +611,7 @@ public: static bool HandleReloadLootTemplatesDisenchantCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`disenchant_loot_template`)"); + TC_LOG_INFO("misc", "Re-Loading Loot Tables... (`disenchant_loot_template`)"); LoadLootTemplates_Disenchant(); LootTemplates_Disenchant.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `disenchant_loot_template` reloaded."); @@ -633,7 +621,7 @@ public: static bool HandleReloadLootTemplatesFishingCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`fishing_loot_template`)"); + TC_LOG_INFO("misc", "Re-Loading Loot Tables... (`fishing_loot_template`)"); LoadLootTemplates_Fishing(); LootTemplates_Fishing.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `fishing_loot_template` reloaded."); @@ -643,7 +631,7 @@ public: static bool HandleReloadLootTemplatesGameobjectCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`gameobject_loot_template`)"); + TC_LOG_INFO("misc", "Re-Loading Loot Tables... (`gameobject_loot_template`)"); LoadLootTemplates_Gameobject(); LootTemplates_Gameobject.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `gameobject_loot_template` reloaded."); @@ -653,7 +641,7 @@ public: static bool HandleReloadLootTemplatesItemCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`item_loot_template`)"); + TC_LOG_INFO("misc", "Re-Loading Loot Tables... (`item_loot_template`)"); LoadLootTemplates_Item(); LootTemplates_Item.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `item_loot_template` reloaded."); @@ -663,7 +651,7 @@ public: static bool HandleReloadLootTemplatesMillingCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`milling_loot_template`)"); + TC_LOG_INFO("misc", "Re-Loading Loot Tables... (`milling_loot_template`)"); LoadLootTemplates_Milling(); LootTemplates_Milling.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `milling_loot_template` reloaded."); @@ -673,7 +661,7 @@ public: static bool HandleReloadLootTemplatesPickpocketingCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`pickpocketing_loot_template`)"); + TC_LOG_INFO("misc", "Re-Loading Loot Tables... (`pickpocketing_loot_template`)"); LoadLootTemplates_Pickpocketing(); LootTemplates_Pickpocketing.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `pickpocketing_loot_template` reloaded."); @@ -683,7 +671,7 @@ public: static bool HandleReloadLootTemplatesProspectingCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`prospecting_loot_template`)"); + TC_LOG_INFO("misc", "Re-Loading Loot Tables... (`prospecting_loot_template`)"); LoadLootTemplates_Prospecting(); LootTemplates_Prospecting.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `prospecting_loot_template` reloaded."); @@ -693,7 +681,7 @@ public: static bool HandleReloadLootTemplatesMailCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`mail_loot_template`)"); + TC_LOG_INFO("misc", "Re-Loading Loot Tables... (`mail_loot_template`)"); LoadLootTemplates_Mail(); LootTemplates_Mail.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `mail_loot_template` reloaded."); @@ -703,7 +691,7 @@ public: static bool HandleReloadLootTemplatesReferenceCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`reference_loot_template`)"); + TC_LOG_INFO("misc", "Re-Loading Loot Tables... (`reference_loot_template`)"); LoadLootTemplates_Reference(); handler->SendGlobalGMSysMessage("DB table `reference_loot_template` reloaded."); sConditionMgr->LoadConditions(true); @@ -712,7 +700,7 @@ public: static bool HandleReloadLootTemplatesSkinningCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`skinning_loot_template`)"); + TC_LOG_INFO("misc", "Re-Loading Loot Tables... (`skinning_loot_template`)"); LoadLootTemplates_Skinning(); LootTemplates_Skinning.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `skinning_loot_template` reloaded."); @@ -722,7 +710,7 @@ public: static bool HandleReloadLootTemplatesSpellCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`spell_loot_template`)"); + TC_LOG_INFO("misc", "Re-Loading Loot Tables... (`spell_loot_template`)"); LoadLootTemplates_Spell(); LootTemplates_Spell.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `spell_loot_template` reloaded."); @@ -732,7 +720,7 @@ public: static bool HandleReloadTrinityStringCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading trinity_string Table!"); + TC_LOG_INFO("misc", "Re-Loading trinity_string Table!"); sObjectMgr->LoadTrinityStrings(); handler->SendGlobalGMSysMessage("DB table `trinity_string` reloaded."); return true; @@ -747,7 +735,7 @@ public: return false; } - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading warden_action Table!"); + TC_LOG_INFO("misc", "Re-Loading warden_action Table!"); sWardenCheckMgr->LoadWardenOverrides(); handler->SendGlobalGMSysMessage("DB table `warden_action` reloaded."); return true; @@ -755,7 +743,7 @@ public: static bool HandleReloadNpcTrainerCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading `npc_trainer` Table!"); + TC_LOG_INFO("misc", "Re-Loading `npc_trainer` Table!"); sObjectMgr->LoadTrainerSpell(); handler->SendGlobalGMSysMessage("DB table `npc_trainer` reloaded."); return true; @@ -763,7 +751,7 @@ public: static bool HandleReloadNpcVendorCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading `npc_vendor` Table!"); + TC_LOG_INFO("misc", "Re-Loading `npc_vendor` Table!"); sObjectMgr->LoadVendors(); handler->SendGlobalGMSysMessage("DB table `npc_vendor` reloaded."); return true; @@ -771,7 +759,7 @@ public: static bool HandleReloadPointsOfInterestCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading `points_of_interest` Table!"); + TC_LOG_INFO("misc", "Re-Loading `points_of_interest` Table!"); sObjectMgr->LoadPointsOfInterest(); handler->SendGlobalGMSysMessage("DB table `points_of_interest` reloaded."); return true; @@ -779,7 +767,7 @@ public: static bool HandleReloadQuestPOICommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Quest POI ..." ); + TC_LOG_INFO("misc", "Re-Loading Quest POI ..." ); sObjectMgr->LoadQuestPOI(); handler->SendGlobalGMSysMessage("DB Table `quest_poi` and `quest_poi_points` reloaded."); return true; @@ -787,7 +775,7 @@ public: static bool HandleReloadSpellClickSpellsCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading `npc_spellclick_spells` Table!"); + TC_LOG_INFO("misc", "Re-Loading `npc_spellclick_spells` Table!"); sObjectMgr->LoadNPCSpellClickSpells(); handler->SendGlobalGMSysMessage("DB table `npc_spellclick_spells` reloaded."); return true; @@ -795,7 +783,7 @@ public: static bool HandleReloadReservedNameCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Loading ReservedNames... (`reserved_name`)"); + TC_LOG_INFO("misc", "Loading ReservedNames... (`reserved_name`)"); sObjectMgr->LoadReservedPlayersNames(); handler->SendGlobalGMSysMessage("DB table `reserved_name` (player reserved names) reloaded."); return true; @@ -803,7 +791,7 @@ public: static bool HandleReloadReputationRewardRateCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading `reputation_reward_rate` Table!" ); + TC_LOG_INFO("misc", "Re-Loading `reputation_reward_rate` Table!" ); sObjectMgr->LoadReputationRewardRate(); handler->SendGlobalSysMessage("DB table `reputation_reward_rate` reloaded."); return true; @@ -811,7 +799,7 @@ public: static bool HandleReloadReputationSpilloverTemplateCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading `reputation_spillover_template` Table!" ); + TC_LOG_INFO("misc", "Re-Loading `reputation_spillover_template` Table!" ); sObjectMgr->LoadReputationSpilloverTemplate(); handler->SendGlobalSysMessage("DB table `reputation_spillover_template` reloaded."); return true; @@ -819,7 +807,7 @@ public: static bool HandleReloadSkillDiscoveryTemplateCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Skill Discovery Table..."); + TC_LOG_INFO("misc", "Re-Loading Skill Discovery Table..."); LoadSkillDiscoveryTable(); handler->SendGlobalGMSysMessage("DB table `skill_discovery_template` (recipes discovered at crafting) reloaded."); return true; @@ -827,7 +815,7 @@ public: static bool HandleReloadSkillExtraItemTemplateCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Skill Extra Item Table..."); + TC_LOG_INFO("misc", "Re-Loading Skill Extra Item Table..."); LoadSkillExtraItemTable(); handler->SendGlobalGMSysMessage("DB table `skill_extra_item_template` (extra item creation when crafting) reloaded."); return true; @@ -835,7 +823,7 @@ public: static bool HandleReloadSkillFishingBaseLevelCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Skill Fishing base level requirements..."); + TC_LOG_INFO("misc", "Re-Loading Skill Fishing base level requirements..."); sObjectMgr->LoadFishingBaseSkillLevel(); handler->SendGlobalGMSysMessage("DB table `skill_fishing_base_level` (fishing base level for zone/subzone) reloaded."); return true; @@ -843,7 +831,7 @@ public: static bool HandleReloadSpellAreaCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading SpellArea Data..."); + TC_LOG_INFO("misc", "Re-Loading SpellArea Data..."); sSpellMgr->LoadSpellAreas(); handler->SendGlobalGMSysMessage("DB table `spell_area` (spell dependences from area/quest/auras state) reloaded."); return true; @@ -851,7 +839,7 @@ public: static bool HandleReloadSpellRequiredCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Spell Required Data... "); + TC_LOG_INFO("misc", "Re-Loading Spell Required Data... "); sSpellMgr->LoadSpellRequired(); handler->SendGlobalGMSysMessage("DB table `spell_required` reloaded."); return true; @@ -859,7 +847,7 @@ public: static bool HandleReloadSpellGroupsCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Spell Groups..."); + TC_LOG_INFO("misc", "Re-Loading Spell Groups..."); sSpellMgr->LoadSpellGroups(); handler->SendGlobalGMSysMessage("DB table `spell_group` (spell groups) reloaded."); return true; @@ -867,7 +855,7 @@ public: static bool HandleReloadSpellLearnSpellCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Spell Learn Spells..."); + TC_LOG_INFO("misc", "Re-Loading Spell Learn Spells..."); sSpellMgr->LoadSpellLearnSpells(); handler->SendGlobalGMSysMessage("DB table `spell_learn_spell` reloaded."); return true; @@ -875,7 +863,7 @@ public: static bool HandleReloadSpellLinkedSpellCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Spell Linked Spells..."); + TC_LOG_INFO("misc", "Re-Loading Spell Linked Spells..."); sSpellMgr->LoadSpellLinked(); handler->SendGlobalGMSysMessage("DB table `spell_linked_spell` reloaded."); return true; @@ -883,7 +871,7 @@ public: static bool HandleReloadSpellProcEventCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Spell Proc Event conditions..."); + TC_LOG_INFO("misc", "Re-Loading Spell Proc Event conditions..."); sSpellMgr->LoadSpellProcEvents(); handler->SendGlobalGMSysMessage("DB table `spell_proc_event` (spell proc trigger requirements) reloaded."); return true; @@ -891,7 +879,7 @@ public: static bool HandleReloadSpellProcsCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Spell Proc conditions and data..."); + TC_LOG_INFO("misc", "Re-Loading Spell Proc conditions and data..."); sSpellMgr->LoadSpellProcs(); handler->SendGlobalGMSysMessage("DB table `spell_proc` (spell proc conditions and data) reloaded."); return true; @@ -899,7 +887,7 @@ public: static bool HandleReloadSpellBonusesCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Spell Bonus Data..."); + TC_LOG_INFO("misc", "Re-Loading Spell Bonus Data..."); sSpellMgr->LoadSpellBonusess(); handler->SendGlobalGMSysMessage("DB table `spell_bonus_data` (spell damage/healing coefficients) reloaded."); return true; @@ -907,7 +895,7 @@ public: static bool HandleReloadSpellTargetPositionCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Spell target coordinates..."); + TC_LOG_INFO("misc", "Re-Loading Spell target coordinates..."); sSpellMgr->LoadSpellTargetPositions(); handler->SendGlobalGMSysMessage("DB table `spell_target_position` (destination coordinates for spell targets) reloaded."); return true; @@ -915,7 +903,7 @@ public: static bool HandleReloadSpellThreatsCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Aggro Spells Definitions..."); + TC_LOG_INFO("misc", "Re-Loading Aggro Spells Definitions..."); sSpellMgr->LoadSpellThreats(); handler->SendGlobalGMSysMessage("DB table `spell_threat` (spell aggro definitions) reloaded."); return true; @@ -923,7 +911,7 @@ public: static bool HandleReloadSpellGroupStackRulesCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Spell Group Stack Rules..."); + TC_LOG_INFO("misc", "Re-Loading Spell Group Stack Rules..."); sSpellMgr->LoadSpellGroupStackRules(); handler->SendGlobalGMSysMessage("DB table `spell_group_stack_rules` (spell stacking definitions) reloaded."); return true; @@ -931,7 +919,7 @@ public: static bool HandleReloadSpellPetAurasCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Spell pet auras..."); + TC_LOG_INFO("misc", "Re-Loading Spell pet auras..."); sSpellMgr->LoadSpellPetAuras(); handler->SendGlobalGMSysMessage("DB table `spell_pet_auras` reloaded."); return true; @@ -939,7 +927,7 @@ public: static bool HandleReloadPageTextsCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Page Texts..."); + TC_LOG_INFO("misc", "Re-Loading Page Texts..."); sObjectMgr->LoadPageTexts(); handler->SendGlobalGMSysMessage("DB table `page_texts` reloaded."); return true; @@ -947,7 +935,7 @@ public: static bool HandleReloadItemEnchantementsCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Item Random Enchantments Table..."); + TC_LOG_INFO("misc", "Re-Loading Item Random Enchantments Table..."); LoadRandomEnchantmentsTable(); handler->SendGlobalGMSysMessage("DB table `item_enchantment_template` reloaded."); return true; @@ -955,7 +943,7 @@ public: static bool HandleReloadItemSetNamesCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Item set names..."); + TC_LOG_INFO("misc", "Re-Loading Item set names..."); sObjectMgr->LoadItemSetNames(); handler->SendGlobalGMSysMessage("DB table `item_set_names` reloaded."); return true; @@ -971,7 +959,7 @@ public: } if (*args != 'a') - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Scripts from `event_scripts`..."); + TC_LOG_INFO("misc", "Re-Loading Scripts from `event_scripts`..."); sObjectMgr->LoadEventScripts(); @@ -991,7 +979,7 @@ public: } if (*args != 'a') - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Scripts from `waypoint_scripts`..."); + TC_LOG_INFO("misc", "Re-Loading Scripts from `waypoint_scripts`..."); sObjectMgr->LoadWaypointScripts(); @@ -1004,7 +992,7 @@ public: static bool HandleReloadWpCommand(ChatHandler* handler, const char* args) { if (*args != 'a') - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Waypoints data from 'waypoints_data'"); + TC_LOG_INFO("misc", "Re-Loading Waypoints data from 'waypoints_data'"); sWaypointMgr->Load(); @@ -1014,23 +1002,6 @@ public: return true; } - static bool HandleReloadEventAITextsCommand(ChatHandler* handler, const char* /*args*/) - { - - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Texts from `creature_ai_texts`..."); - sEventAIMgr->LoadCreatureEventAI_Texts(); - handler->SendGlobalGMSysMessage("DB table `creature_ai_texts` reloaded."); - return true; - } - - static bool HandleReloadEventAIScriptsCommand(ChatHandler* handler, const char* /*args*/) - { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Scripts from `creature_ai_scripts`..."); - sEventAIMgr->LoadCreatureEventAI_Scripts(); - handler->SendGlobalGMSysMessage("DB table `creature_ai_scripts` reloaded."); - return true; - } - static bool HandleReloadSpellScriptsCommand(ChatHandler* handler, const char* args) { if (sScriptMgr->IsScriptScheduled()) @@ -1041,7 +1012,7 @@ public: } if (*args != 'a') - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Scripts from `spell_scripts`..."); + TC_LOG_INFO("misc", "Re-Loading Scripts from `spell_scripts`..."); sObjectMgr->LoadSpellScripts(); @@ -1053,7 +1024,7 @@ public: static bool HandleReloadDbScriptStringCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Script strings from `db_script_string`..."); + TC_LOG_INFO("misc", "Re-Loading Script strings from `db_script_string`..."); sObjectMgr->LoadDbScriptStrings(); handler->SendGlobalGMSysMessage("DB table `db_script_string` reloaded."); return true; @@ -1061,7 +1032,7 @@ public: static bool HandleReloadGameGraveyardZoneCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Graveyard-zone links..."); + TC_LOG_INFO("misc", "Re-Loading Graveyard-zone links..."); sObjectMgr->LoadGraveyardZones(); @@ -1072,7 +1043,7 @@ public: static bool HandleReloadGameTeleCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Game Tele coordinates..."); + TC_LOG_INFO("misc", "Re-Loading Game Tele coordinates..."); sObjectMgr->LoadGameTele(); @@ -1083,9 +1054,9 @@ public: static bool HandleReloadDisablesCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading disables table..."); + TC_LOG_INFO("misc", "Re-Loading disables table..."); DisableMgr::LoadDisables(); - TC_LOG_INFO(LOG_FILTER_GENERAL, "Checking quest disables..."); + TC_LOG_INFO("misc", "Checking quest disables..."); DisableMgr::CheckQuestDisables(); handler->SendGlobalGMSysMessage("DB table `disables` reloaded."); return true; @@ -1093,7 +1064,7 @@ public: static bool HandleReloadLocalesAchievementRewardCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Locales Achievement Reward Data..."); + TC_LOG_INFO("misc", "Re-Loading Locales Achievement Reward Data..."); sAchievementMgr->LoadRewardLocales(); handler->SendGlobalGMSysMessage("DB table `locales_achievement_reward` reloaded."); return true; @@ -1101,7 +1072,7 @@ public: static bool HandleReloadLfgRewardsCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading lfg dungeon rewards..."); + TC_LOG_INFO("misc", "Re-Loading lfg dungeon rewards..."); sLFGMgr->LoadRewards(); handler->SendGlobalGMSysMessage("DB table `lfg_dungeon_rewards` reloaded."); return true; @@ -1109,7 +1080,7 @@ public: static bool HandleReloadLocalesCreatureCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Locales Creature ..."); + TC_LOG_INFO("misc", "Re-Loading Locales Creature ..."); sObjectMgr->LoadCreatureLocales(); handler->SendGlobalGMSysMessage("DB table `locales_creature` reloaded."); return true; @@ -1117,7 +1088,7 @@ public: static bool HandleReloadLocalesCreatureTextCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Locales Creature Texts..."); + TC_LOG_INFO("misc", "Re-Loading Locales Creature Texts..."); sCreatureTextMgr->LoadCreatureTextLocales(); handler->SendGlobalGMSysMessage("DB table `locales_creature_text` reloaded."); return true; @@ -1125,7 +1096,7 @@ public: static bool HandleReloadLocalesGameobjectCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Locales Gameobject ... "); + TC_LOG_INFO("misc", "Re-Loading Locales Gameobject ... "); sObjectMgr->LoadGameObjectLocales(); handler->SendGlobalGMSysMessage("DB table `locales_gameobject` reloaded."); return true; @@ -1133,7 +1104,7 @@ public: static bool HandleReloadLocalesGossipMenuOptionCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Locales Gossip Menu Option ... "); + TC_LOG_INFO("misc", "Re-Loading Locales Gossip Menu Option ... "); sObjectMgr->LoadGossipMenuItemsLocales(); handler->SendGlobalGMSysMessage("DB table `locales_gossip_menu_option` reloaded."); return true; @@ -1141,7 +1112,7 @@ public: static bool HandleReloadLocalesItemCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Locales Item ... "); + TC_LOG_INFO("misc", "Re-Loading Locales Item ... "); sObjectMgr->LoadItemLocales(); handler->SendGlobalGMSysMessage("DB table `locales_item` reloaded."); return true; @@ -1149,7 +1120,7 @@ public: static bool HandleReloadLocalesItemSetNameCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Locales Item set name... "); + TC_LOG_INFO("misc", "Re-Loading Locales Item set name... "); sObjectMgr->LoadItemSetNameLocales(); handler->SendGlobalGMSysMessage("DB table `locales_item_set_name` reloaded."); return true; @@ -1157,7 +1128,7 @@ public: static bool HandleReloadLocalesNpcTextCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Locales NPC Text ... "); + TC_LOG_INFO("misc", "Re-Loading Locales NPC Text ... "); sObjectMgr->LoadNpcTextLocales(); handler->SendGlobalGMSysMessage("DB table `locales_npc_text` reloaded."); return true; @@ -1165,7 +1136,7 @@ public: static bool HandleReloadLocalesPageTextCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Locales Page Text ... "); + TC_LOG_INFO("misc", "Re-Loading Locales Page Text ... "); sObjectMgr->LoadPageTextLocales(); handler->SendGlobalGMSysMessage("DB table `locales_page_text` reloaded."); return true; @@ -1173,7 +1144,7 @@ public: static bool HandleReloadLocalesPointsOfInterestCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Locales Points Of Interest ... "); + TC_LOG_INFO("misc", "Re-Loading Locales Points Of Interest ... "); sObjectMgr->LoadPointOfInterestLocales(); handler->SendGlobalGMSysMessage("DB table `locales_points_of_interest` reloaded."); return true; @@ -1181,7 +1152,7 @@ public: static bool HandleReloadLocalesQuestCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Locales Quest ... "); + TC_LOG_INFO("misc", "Re-Loading Locales Quest ... "); sObjectMgr->LoadQuestLocales(); handler->SendGlobalGMSysMessage("DB table `locales_quest` reloaded."); return true; @@ -1189,7 +1160,7 @@ public: static bool HandleReloadMailLevelRewardCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Player level dependent mail rewards..."); + TC_LOG_INFO("misc", "Re-Loading Player level dependent mail rewards..."); sObjectMgr->LoadMailLevelRewards(); handler->SendGlobalGMSysMessage("DB table `mail_level_reward` reloaded."); return true; @@ -1198,7 +1169,7 @@ public: static bool HandleReloadAuctionsCommand(ChatHandler* handler, const char* /*args*/) { ///- Reload dynamic data tables from the database - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Auctions..."); + TC_LOG_INFO("misc", "Re-Loading Auctions..."); sAuctionMgr->LoadAuctionItems(); sAuctionMgr->LoadAuctions(); handler->SendGlobalGMSysMessage("Auctions reloaded."); @@ -1207,7 +1178,7 @@ public: static bool HandleReloadConditions(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Conditions..."); + TC_LOG_INFO("misc", "Re-Loading Conditions..."); sConditionMgr->LoadConditions(true); handler->SendGlobalGMSysMessage("Conditions reloaded."); return true; @@ -1215,7 +1186,7 @@ public: static bool HandleReloadCreatureText(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Creature Texts..."); + TC_LOG_INFO("misc", "Re-Loading Creature Texts..."); sCreatureTextMgr->LoadCreatureTexts(); handler->SendGlobalGMSysMessage("Creature Texts reloaded."); return true; @@ -1223,7 +1194,7 @@ public: static bool HandleReloadSmartScripts(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Re-Loading Smart Scripts..."); + TC_LOG_INFO("misc", "Re-Loading Smart Scripts..."); sSmartScriptMgr->LoadSmartAIFromDB(); handler->SendGlobalGMSysMessage("Smart Scripts reloaded."); return true; @@ -1231,7 +1202,7 @@ public: static bool HandleReloadVehicleAccessoryCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Reloading vehicle_accessory table..."); + TC_LOG_INFO("misc", "Reloading vehicle_accessory table..."); sObjectMgr->LoadVehicleAccessories(); handler->SendGlobalGMSysMessage("Vehicle accessories reloaded."); return true; @@ -1239,7 +1210,7 @@ public: static bool HandleReloadVehicleTemplateAccessoryCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Reloading vehicle_template_accessory table..."); + TC_LOG_INFO("misc", "Reloading vehicle_template_accessory table..."); sObjectMgr->LoadVehicleTemplateAccessories(); handler->SendGlobalGMSysMessage("Vehicle template accessories reloaded."); return true; @@ -1247,7 +1218,7 @@ public: static bool HandleReloadRBACCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Reloading RBAC tables..."); + TC_LOG_INFO("misc", "Reloading RBAC tables..."); sAccountMgr->LoadRBAC(); sWorld->ReloadRBAC(); handler->SendGlobalGMSysMessage("RBAC data reloaded."); diff --git a/src/server/scripts/Commands/cs_reset.cpp b/src/server/scripts/Commands/cs_reset.cpp index 891445df976..2b27fcf56fd 100644 --- a/src/server/scripts/Commands/cs_reset.cpp +++ b/src/server/scripts/Commands/cs_reset.cpp @@ -92,7 +92,7 @@ public: ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(player->getClass()); if (!classEntry) { - TC_LOG_ERROR(LOG_FILTER_GENERAL, "Class %u not found in DBC (Wrong DBC files?)", player->getClass()); + TC_LOG_ERROR("misc", "Class %u not found in DBC (Wrong DBC files?)", player->getClass()); return false; } diff --git a/src/server/scripts/Commands/cs_wp.cpp b/src/server/scripts/Commands/cs_wp.cpp index dc731985588..daa760c9c56 100644 --- a/src/server/scripts/Commands/cs_wp.cpp +++ b/src/server/scripts/Commands/cs_wp.cpp @@ -689,7 +689,7 @@ public: wpCreature->AddObjectToRemoveList(); } // re-create - Creature* wpCreature2 = new Creature; + Creature* wpCreature2 = new Creature(); if (!wpCreature2->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), VISUAL_WAYPOINT, 0, 0, chr->GetPositionX(), chr->GetPositionY(), chr->GetPositionZ(), chr->GetOrientation())) { handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, VISUAL_WAYPOINT); @@ -913,7 +913,7 @@ public: Map* map = chr->GetMap(); float o = chr->GetOrientation(); - Creature* wpCreature = new Creature; + Creature* wpCreature = new Creature(); if (!wpCreature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, 0, 0, x, y, z, o)) { handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id); @@ -977,7 +977,7 @@ public: float o = chr->GetOrientation(); Map* map = chr->GetMap(); - Creature* creature = new Creature; + Creature* creature = new Creature(); if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, 0, 0, x, y, z, o)) { handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id); @@ -1026,7 +1026,7 @@ public: Player* chr = handler->GetSession()->GetPlayer(); Map* map = chr->GetMap(); - Creature* creature = new Creature; + Creature* creature = new Creature(); if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, 0, 0, x, y, z, o)) { handler->PSendSysMessage(LANG_WAYPOINT_NOTCREATED, id); diff --git a/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp index 6dbcdffca72..2b1b04cb654 100644 --- a/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp +++ b/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp @@ -60,6 +60,7 @@ public: { waterBoltTimer = 3 * IN_MILLISECONDS; resetTimer = 5 * IN_MILLISECONDS; + balindaGUID = 0; } void UpdateAI(uint32 diff) OVERRIDE diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp index 1f393205bc1..ee8f22ca66c 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp @@ -211,7 +211,7 @@ public: { instance->UpdateEncounterState(ENCOUNTER_CREDIT_KILL_CREATURE, NPC_GRIMSTONE, me); instance->SetData(TYPE_RING_OF_LAW, DONE); - TC_LOG_DEBUG(LOG_FILTER_TSCR, "npc_grimstone: event reached end and set complete."); + TC_LOG_DEBUG("scripts", "npc_grimstone: event reached end and set complete."); } break; } diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp index fbec94887b2..f1ccf35e490 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp @@ -214,7 +214,7 @@ public: void SetData64(uint32 type, uint64 data) OVERRIDE { - TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance Blackrock Depths: SetData64 update (Type: %u Data " UI64FMTD ")", type, data); + TC_LOG_DEBUG("scripts", "Instance Blackrock Depths: SetData64 update (Type: %u Data " UI64FMTD ")", type, data); switch (type) { @@ -230,7 +230,7 @@ public: void SetData(uint32 type, uint32 data) OVERRIDE { - TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance Blackrock Depths: SetData update (Type: %u Data %u)", type, data); + TC_LOG_DEBUG("scripts", "Instance Blackrock Depths: SetData update (Type: %u Data %u)", type, data); switch (type) { diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp index 275b3802764..ff839e3cacb 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp @@ -171,6 +171,7 @@ public: _Reset(); gythEvent = false; victorGUID = 0; + portcullisGUID = 0; } void EnterCombat(Unit* /*who*/) OVERRIDE diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp index 9b250cc169a..a1bbad7ee1c 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp @@ -73,6 +73,8 @@ public: go_blackrockaltar = 0; go_portcullis_active = 0; go_portcullis_tobossrooms = 0; + memset(go_roomrunes, 0, sizeof(go_roomrunes)); + memset(go_emberseerrunes, 0, sizeof(go_emberseerrunes)); } void OnCreatureCreate(Creature* creature) OVERRIDE @@ -270,7 +272,7 @@ public: return true; } - void ProcessEvent(WorldObject* /*gameObject*/, uint32 eventId) OVERRIDE + void ProcessEvent(WorldObject* /*obj*/, uint32 eventId) OVERRIDE { switch (eventId) { @@ -313,102 +315,71 @@ public: { case DATA_HIGHLORD_OMOKK: return HighlordOmokk; - break; case DATA_SHADOW_HUNTER_VOSHGAJIN: return ShadowHunterVoshgajin; - break; case DATA_WARMASTER_VOONE: return WarMasterVoone; - break; case DATA_MOTHER_SMOLDERWEB: return MotherSmolderweb; - break; case DATA_UROK_DOOMHOWL: return UrokDoomhowl; - break; case DATA_QUARTERMASTER_ZIGRIS: return QuartermasterZigris; - break; case DATA_GIZRUL_THE_SLAVENER: return GizrultheSlavener; - break; case DATA_HALYCON: return Halycon; - break; case DATA_OVERLORD_WYRMTHALAK: return OverlordWyrmthalak; - break; case DATA_PYROGAURD_EMBERSEER: return PyroguardEmberseer; - break; case DATA_WARCHIEF_REND_BLACKHAND: return WarchiefRendBlackhand; - break; case DATA_GYTH: return Gyth; - break; case DATA_THE_BEAST: return TheBeast; - break; case DATA_GENERAL_DRAKKISATH: return GeneralDrakkisath; - break; case GO_EMBERSEER_IN: return go_emberseerin; - break; case GO_DOORS: return go_doors; - break; case GO_EMBERSEER_OUT: return go_emberseerout; - break; case GO_HALL_RUNE_1: return go_roomrunes[0]; - break; case GO_HALL_RUNE_2: return go_roomrunes[1]; - break; case GO_HALL_RUNE_3: return go_roomrunes[2]; - break; case GO_HALL_RUNE_4: return go_roomrunes[3]; - break; case GO_HALL_RUNE_5: return go_roomrunes[4]; - break; case GO_HALL_RUNE_6: return go_roomrunes[5]; - break; case GO_HALL_RUNE_7: return go_roomrunes[6]; - break; case GO_EMBERSEER_RUNE_1: return go_emberseerrunes[0]; - break; case GO_EMBERSEER_RUNE_2: return go_emberseerrunes[1]; - break; case GO_EMBERSEER_RUNE_3: return go_emberseerrunes[2]; - break; case GO_EMBERSEER_RUNE_4: return go_emberseerrunes[3]; - break; case GO_EMBERSEER_RUNE_5: return go_emberseerrunes[4]; - break; case GO_EMBERSEER_RUNE_6: return go_emberseerrunes[5]; - break; case GO_EMBERSEER_RUNE_7: return go_emberseerrunes[6]; - break; case GO_PORTCULLIS_ACTIVE: return go_portcullis_active; - break; case GO_PORTCULLIS_TOBOSSROOMS: return go_portcullis_tobossrooms; + default: break; } return 0; @@ -577,8 +548,6 @@ public: protected: EventMap Events; - uint32 encounter[EncounterCount]; - std::string m_strInstData; uint64 HighlordOmokk; uint64 ShadowHunterVoshgajin; uint64 WarMasterVoone; diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp index f3a788918f2..4e0c79509fc 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp @@ -264,7 +264,6 @@ public: if (Unit* player = me->SelectNearestPlayer(60.0f)) { me->SetInFront(player); - me->SendMovementFlagUpdate(); Talk(SAY_SUCCESS); if (GameObject* portcullis1 = me->FindNearestGameObject(GO_PORTCULLIS_ACTIVE, 65.0f)) portcullis1->SetGoState(GO_STATE_ACTIVE); diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp index 622c34d3358..0c85e89ec4a 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp @@ -63,6 +63,7 @@ public: { // Razorgore EggCount = 0; + EggEvent = 0; RazorgoreTheUntamedGUID = 0; RazorgoreDoorGUID = 0; EggList.clear(); diff --git a/src/server/scripts/EasternKingdoms/CMakeLists.txt b/src/server/scripts/EasternKingdoms/CMakeLists.txt index a0377cea0fd..8622949b3fe 100644 --- a/src/server/scripts/EasternKingdoms/CMakeLists.txt +++ b/src/server/scripts/EasternKingdoms/CMakeLists.txt @@ -172,7 +172,6 @@ set(scripts_STAT_SRCS EasternKingdoms/ScarletMonastery/boss_herod.cpp EasternKingdoms/ScarletMonastery/boss_scorn.cpp EasternKingdoms/zone_undercity.cpp - EasternKingdoms/zone_silvermoon_city.cpp EasternKingdoms/zone_loch_modan.cpp EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp diff --git a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp index beff85b730f..504b3bc6e97 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp @@ -1237,7 +1237,7 @@ public: } } - TC_LOG_ERROR(LOG_FILTER_TSCR, "boss_romuloAI: DamageTaken reach end of code, that should not happen."); + TC_LOG_ERROR("scripts", "boss_romuloAI: DamageTaken reach end of code, that should not happen."); } void EnterCombat(Unit* /*who*/) OVERRIDE @@ -1483,7 +1483,7 @@ void boss_julianne::boss_julianneAI::DamageTaken(Unit* /*done_by*/, uint32 &dama if (Phase == PHASE_ROMULO) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "boss_julianneAI: cannot take damage in PHASE_ROMULO, why was i here?"); + TC_LOG_ERROR("scripts", "boss_julianneAI: cannot take damage in PHASE_ROMULO, why was i here?"); damage = 0; return; } @@ -1517,7 +1517,7 @@ void boss_julianne::boss_julianneAI::DamageTaken(Unit* /*done_by*/, uint32 &dama return; } } - TC_LOG_ERROR(LOG_FILTER_TSCR, "boss_julianneAI: DamageTaken reach end of code, that should not happen."); + TC_LOG_ERROR("scripts", "boss_julianneAI: DamageTaken reach end of code, that should not happen."); } void AddSC_bosses_opera() diff --git a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp index 6997b7123bc..91127f2db0d 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp @@ -247,7 +247,7 @@ public: void PrepareEncounter() { - TC_LOG_DEBUG(LOG_FILTER_TSCR, "Barnes Opera Event - Introduction complete - preparing encounter %d", m_uiEventId); + TC_LOG_DEBUG("scripts", "Barnes Opera Event - Introduction complete - preparing encounter %d", m_uiEventId); uint8 index = 0; uint8 count = 0; @@ -361,17 +361,17 @@ public: case GOSSIP_ACTION_INFO_DEF+3: player->CLOSE_GOSSIP_MENU(); pBarnesAI->m_uiEventId = EVENT_OZ; - TC_LOG_INFO(LOG_FILTER_TSCR, "player (GUID " UI64FMTD ") manually set Opera event to EVENT_OZ", player->GetGUID()); + TC_LOG_INFO("scripts", "player (GUID " UI64FMTD ") manually set Opera event to EVENT_OZ", player->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+4: player->CLOSE_GOSSIP_MENU(); pBarnesAI->m_uiEventId = EVENT_HOOD; - TC_LOG_INFO(LOG_FILTER_TSCR, "player (GUID " UI64FMTD ") manually set Opera event to EVENT_HOOD", player->GetGUID()); + TC_LOG_INFO("scripts", "player (GUID " UI64FMTD ") manually set Opera event to EVENT_HOOD", player->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+5: player->CLOSE_GOSSIP_MENU(); pBarnesAI->m_uiEventId = EVENT_RAJ; - TC_LOG_INFO(LOG_FILTER_TSCR, "player (GUID " UI64FMTD ") manually set Opera event to EVENT_RAJ", player->GetGUID()); + TC_LOG_INFO("scripts", "player (GUID " UI64FMTD ") manually set Opera event to EVENT_RAJ", player->GetGUID()); break; } @@ -614,7 +614,8 @@ public: } return 50000; case 15: - arca->DealDamage(arca, arca->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + if (arca) + arca->DealDamage(arca, arca->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); return 5000; default : return 9999999; } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.h b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.h index d50aac36bca..f47d2aa46fb 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.h +++ b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.h @@ -62,5 +62,5 @@ enum OperaEvents EVENT_RAJ = 3 }; -#define ERROR_INST_DATA(a) TC_LOG_ERROR(LOG_FILTER_TSCR, "Instance Data for Karazhan not set properly. Encounter for Creature Entry %u may not work properly.", a->GetEntry()); +#define ERROR_INST_DATA(a) TC_LOG_ERROR("scripts", "Instance Data for Karazhan not set properly. Encounter for Creature Entry %u may not work properly.", a->GetEntry()); #endif diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp index c31eb1bea11..849713d72bf 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp @@ -84,7 +84,7 @@ public: { instance->SetData64(DATA_FEL_CRYSTAL, i); uint64 guid = instance->GetData64(DATA_FEL_CRYSTAL); - TC_LOG_DEBUG(LOG_FILTER_TSCR, "Selin: Adding Fel Crystal " UI64FMTD " to list", guid); + TC_LOG_DEBUG("scripts", "Selin: Adding Fel Crystal " UI64FMTD " to list", guid); Crystals.push_back(guid); } } @@ -125,7 +125,7 @@ public: // Set Inst data for encounter instance->SetData(DATA_SELIN_EVENT, NOT_STARTED); - } else TC_LOG_ERROR(LOG_FILTER_TSCR, ERROR_INST_DATA); + } else TC_LOG_ERROR("scripts", ERROR_INST_DATA); DrainLifeTimer = urand(3000, 7000); DrainManaTimer = DrainLifeTimer + 5000; @@ -225,7 +225,7 @@ public: else { // Make an error message in case something weird happened here - TC_LOG_ERROR(LOG_FILTER_TSCR, "Selin Fireheart unable to drain crystal as the crystal is either dead or despawned"); + TC_LOG_ERROR("scripts", "Selin Fireheart unable to drain crystal as the crystal is either dead or despawned"); DrainingCrystal = false; } } @@ -361,7 +361,7 @@ public: } } } - } else TC_LOG_ERROR(LOG_FILTER_TSCR, ERROR_INST_DATA); + } else TC_LOG_ERROR("scripts", ERROR_INST_DATA); } }; }; diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp index f7abb46b9b7..41261549e38 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp @@ -291,7 +291,7 @@ public: case DATA_FEL_CRYSTAL: if (FelCrystals.size() < felCristalIndex) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "Magisters Terrace: No Fel Crystals loaded in Inst Data"); + TC_LOG_ERROR("scripts", "Magisters Terrace: No Fel Crystals loaded in Inst Data"); return 0; } diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp index 65577d9e770..4dc62cc431d 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp @@ -180,7 +180,7 @@ public: anchorGUID = anchor->GetGUID(); } else - TC_LOG_ERROR(LOG_FILTER_TSCR, "npc_unworthy_initiateAI: unable to find anchor!"); + TC_LOG_ERROR("scripts", "npc_unworthy_initiateAI: unable to find anchor!"); float dist = 99.0f; GameObject* prison = NULL; @@ -200,7 +200,7 @@ public: if (prison) prison->ResetDoorOrButton(); else - TC_LOG_ERROR(LOG_FILTER_TSCR, "npc_unworthy_initiateAI: unable to find prison!"); + TC_LOG_ERROR("scripts", "npc_unworthy_initiateAI: unable to find prison!"); } break; case PHASE_TO_EQUIP: @@ -211,7 +211,7 @@ public: else { me->GetMotionMaster()->MovePoint(1, anchorX, anchorY, me->GetPositionZ()); - //TC_LOG_DEBUG(LOG_FILTER_TSCR, "npc_unworthy_initiateAI: move to %f %f %f", anchorX, anchorY, me->GetPositionZ()); + //TC_LOG_DEBUG("scripts", "npc_unworthy_initiateAI: move to %f %f %f", anchorX, anchorY, me->GetPositionZ()); phase = PHASE_EQUIPING; wait_timer = 0; } diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp index 463e88b670b..0810d5ca2b8 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp @@ -807,6 +807,7 @@ public: me->GetPosition(x, y, z); //this visual aura some under ground me->SetPosition(x, y, z + 0.35f, 0.0f); Despawn(); + debuffGUID = 0; Creature* debuff = DoSpawnCreature(HELPER, 0, 0, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 14500); if (debuff) { diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp index 451fd46938d..f93f0a94414 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp @@ -69,7 +69,7 @@ public: DoCast(me, SPELL_ICEARMOR, true); } - void EnterCombat(Unit* /*who*/)OVERRIDE { } + void EnterCombat(Unit* /*who*/) OVERRIDE { } void UpdateAI(uint32 diff) OVERRIDE { diff --git a/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp index 85eabe70cfa..732cdd0d4f4 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp @@ -107,7 +107,7 @@ class instance_stratholme : public InstanceMapScript return true; } - TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance Stratholme: Cannot open slaugther square yet."); + TC_LOG_DEBUG("scripts", "Instance Stratholme: Cannot open slaugther square yet."); return false; } @@ -225,7 +225,7 @@ class instance_stratholme : public InstanceMapScript break; EncounterState[0] = data; events.ScheduleEvent(EVENT_BARON_RUN, 2700000); - TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance Stratholme: Baron run in progress."); + TC_LOG_DEBUG("scripts", "Instance Stratholme: Baron run in progress."); break; case FAIL: DoRemoveAurasDueToSpellOnPlayers(SPELL_BARON_ULTIMATUM); @@ -289,10 +289,10 @@ class instance_stratholme : public InstanceMapScript //UpdateGoState(ziggurat4GUID, 0, true); if (Creature* pBaron = instance->GetCreature(baronGUID)) pBaron->SummonCreature(NPC_RAMSTEIN, 4032.84f, -3390.24f, 119.73f, 4.71f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 1800000); - TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance Stratholme: Ramstein spawned."); + TC_LOG_DEBUG("scripts", "Instance Stratholme: Ramstein spawned."); } else - TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance Stratholme: %u Abomnation left to kill.", count); + TC_LOG_DEBUG("scripts", "Instance Stratholme: %u Abomnation left to kill.", count); } if (data == NOT_STARTED) @@ -301,7 +301,7 @@ class instance_stratholme : public InstanceMapScript if (data == DONE) { events.ScheduleEvent(EVENT_SLAUGHTER_SQUARE, 60000); - TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance Stratholme: Slaugther event will continue in 1 minute."); + TC_LOG_DEBUG("scripts", "Instance Stratholme: Slaugther event will continue in 1 minute."); } EncounterState[4] = data; break; @@ -437,7 +437,7 @@ class instance_stratholme : public InstanceMapScript case EVENT_BARON_RUN: if (GetData(TYPE_BARON_RUN) != DONE) SetData(TYPE_BARON_RUN, FAIL); - TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance Stratholme: Baron run event reached end. Event has state %u.", GetData(TYPE_BARON_RUN)); + TC_LOG_DEBUG("scripts", "Instance Stratholme: Baron run event reached end. Event has state %u.", GetData(TYPE_BARON_RUN)); break; case EVENT_SLAUGHTER_SQUARE: if (Creature* baron = instance->GetCreature(baronGUID)) @@ -447,7 +447,7 @@ class instance_stratholme : public InstanceMapScript HandleGameObject(ziggurat4GUID, true); HandleGameObject(ziggurat5GUID, true); - TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance Stratholme: Black guard sentries spawned. Opening gates to baron."); + TC_LOG_DEBUG("scripts", "Instance Stratholme: Black guard sentries spawned. Opening gates to baron."); } break; default: diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp index 4460fb99f2b..3fd346d6816 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp @@ -44,7 +44,7 @@ enum Quotes YELL_MADR_INTRO = 1, YELL_MADR_ICE_BLOCK = 2, YELL_MADR_TRAP = 3, - YELL_MADR_DEATH = 4, + YELL_MADR_DEATH = 4 }; enum Spells @@ -61,18 +61,11 @@ enum Spells SPELL_INTRO_ENCAPSULATE_CHANELLING = 45661 }; -#define FELMYST 25038 - class boss_brutallus : public CreatureScript { public: boss_brutallus() : CreatureScript("boss_brutallus") { } - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new boss_brutallusAI(creature); - } - struct boss_brutallusAI : public ScriptedAI { boss_brutallusAI(Creature* creature) : ScriptedAI(creature) @@ -112,16 +105,14 @@ public: DoCast(me, SPELL_DUAL_WIELD, true); - if (instance) - instance->SetData(DATA_BRUTALLUS_EVENT, NOT_STARTED); + instance->SetBossState(DATA_BRUTALLUS, NOT_STARTED); } void EnterCombat(Unit* /*who*/) OVERRIDE { Talk(YELL_AGGRO); - if (instance) - instance->SetData(DATA_BRUTALLUS_EVENT, IN_PROGRESS); + instance->SetBossState(DATA_BRUTALLUS, IN_PROGRESS); } void KilledUnit(Unit* /*victim*/) OVERRIDE @@ -133,13 +124,10 @@ public: { Talk(YELL_DEATH); - if (instance) - { - instance->SetData(DATA_BRUTALLUS_EVENT, DONE); - float x, y, z; - me->GetPosition(x, y, z); - me->SummonCreature(FELMYST, x, y, z+30, me->GetOrientation(), TEMPSUMMON_MANUAL_DESPAWN, 0); - } + instance->SetBossState(DATA_BRUTALLUS, DONE); + float x, y, z; + me->GetPosition(x, y, z); + me->SummonCreature(NPC_FELMYST, x, y, z + 30, me->GetOrientation(), TEMPSUMMON_MANUAL_DESPAWN, 0); } void EnterEvadeMode() OVERRIDE @@ -152,8 +140,8 @@ public: { if (!Intro || IsIntro) return; - Creature* Madrigosa = Unit::GetCreature(*me, instance ? instance->GetData64(DATA_MADRIGOSA) : 0); - if (Madrigosa) + + if (Creature* Madrigosa = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MADRIGOSA))) { Madrigosa->Respawn(); Madrigosa->setActive(true); @@ -166,8 +154,8 @@ public: } else { - //Madrigosa not found, end intro - TC_LOG_ERROR(LOG_FILTER_TSCR, "Madrigosa was not found"); + // Madrigosa not found, end intro + TC_LOG_ERROR("scripts", "Madrigosa was not found"); EndIntro(); } } @@ -188,7 +176,7 @@ public: void DoIntro() { - Creature* Madrigosa = Unit::GetCreature(*me, instance ? instance->GetData64(DATA_MADRIGOSA) : 0); + Creature* Madrigosa = ObjectAccessor::GetCreature(*me, instance ? instance->GetData64(DATA_MADRIGOSA) : 0); if (!Madrigosa) return; @@ -265,15 +253,16 @@ public: } void MoveInLineOfSight(Unit* who) OVERRIDE - { if (!me->IsValidAttackTarget(who)) return; - if (instance && Intro) - instance->SetData(DATA_BRUTALLUS_EVENT, SPECIAL); + + if (Intro) + instance->SetBossState(DATA_BRUTALLUS, SPECIAL); if (Intro && !IsIntro) StartIntro(); + if (!Intro) ScriptedAI::MoveInLineOfSight(who); } @@ -290,15 +279,19 @@ public: { if (IntroFrostBoltTimer <= diff) { - if (Creature* Madrigosa = Unit::GetCreature(*me, instance ? instance->GetData64(DATA_MADRIGOSA) : 0)) + if (Creature* Madrigosa = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MADRIGOSA))) { Madrigosa->CastSpell(me, SPELL_INTRO_FROSTBOLT, true); IntroFrostBoltTimer = 2000; } - } else IntroFrostBoltTimer -= diff; + } + else + IntroFrostBoltTimer -= diff; } + if (!UpdateVictim()) return; + DoMeleeAttackIfReady(); } @@ -341,6 +334,11 @@ public: DoMeleeAttackIfReady(); } }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return GetSunwellPlateauAI<boss_brutallusAI>(creature); + } }; void AddSC_boss_brutallus() diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp index 692f9ae5440..e68d834b20d 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp @@ -15,12 +15,6 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* ScriptData -SDName: Boss_Eredar_Twins -SD%Complete: 100 -SDComment: -EndScriptData */ - #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "sunwell_plateau.h" @@ -48,35 +42,35 @@ enum Quotes YELL_ALY_DEAD = 6, YELL_SISTER_SACROLASH_DEAD = 7, YELL_CANFLAGRATION = 8, - YELL_BERSERK = 9, + YELL_BERSERK = 9 }; enum Spells { //Lady Sacrolash spells - SPELL_DARK_TOUCHED = 45347, - SPELL_SHADOW_BLADES = 45248, //10 secs - SPELL_DARK_STRIKE = 45271, - SPELL_SHADOW_NOVA = 45329, //30-35 secs - SPELL_CONFOUNDING_BLOW = 45256, //25 secs + SPELL_DARK_TOUCHED = 45347, + SPELL_SHADOW_BLADES = 45248, //10 secs + SPELL_DARK_STRIKE = 45271, + SPELL_SHADOW_NOVA = 45329, //30-35 secs + SPELL_CONFOUNDING_BLOW = 45256, //25 secs //Shadow Image spells - SPELL_SHADOW_FURY = 45270, - SPELL_IMAGE_VISUAL = 45263, + SPELL_SHADOW_FURY = 45270, + SPELL_IMAGE_VISUAL = 45263, //Misc spells - SPELL_ENRAGE = 46587, - SPELL_EMPOWER = 45366, - SPELL_DARK_FLAME = 45345, + SPELL_ENRAGE = 46587, + SPELL_EMPOWER = 45366, + SPELL_DARK_FLAME = 45345, //Grand Warlock Alythess spells - SPELL_PYROGENICS = 45230, //15secs - SPELL_FLAME_TOUCHED = 45348, - SPELL_CONFLAGRATION = 45342, //30-35 secs - SPELL_BLAZE = 45235, //on main target every 3 secs - SPELL_FLAME_SEAR = 46771, - SPELL_BLAZE_SUMMON = 45236, //187366 GO - SPELL_BLAZE_BURN = 45246 + SPELL_PYROGENICS = 45230, //15secs + SPELL_FLAME_TOUCHED = 45348, + SPELL_CONFLAGRATION = 45342, //30-35 secs + SPELL_BLAZE = 45235, //on main target every 3 secs + SPELL_FLAME_SEAR = 46771, + SPELL_BLAZE_SUMMON = 45236, //187366 GO + SPELL_BLAZE_BURN = 45246 }; class boss_sacrolash : public CreatureScript @@ -84,11 +78,6 @@ class boss_sacrolash : public CreatureScript public: boss_sacrolash() : CreatureScript("boss_sacrolash") { } - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new boss_sacrolashAI(creature); - }; - struct boss_sacrolashAI : public ScriptedAI { boss_sacrolashAI(Creature* creature) : ScriptedAI(creature) @@ -112,15 +101,12 @@ public: { Enraged = false; - if (instance) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ALYTHESS))) { - if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_ALYTHESS))) - { - if (temp->isDead()) - temp->Respawn(); - else if (temp->GetVictim()) - me->getThreatManager().addThreat(temp->GetVictim(), 0.0f); - } + if (temp->isDead()) + temp->Respawn(); + else if (temp->GetVictim()) + me->getThreatManager().addThreat(temp->GetVictim(), 0.0f); } if (!me->IsInCombat()) @@ -131,27 +117,21 @@ public: ShadowimageTimer = 20000; ConflagrationTimer = 30000; EnrageTimer = 360000; - SisterDeath = false; } - if (instance) - instance->SetData(DATA_EREDAR_TWINS_EVENT, NOT_STARTED); + instance->SetBossState(DATA_EREDAR_TWINS, NOT_STARTED); } void EnterCombat(Unit* who) OVERRIDE { DoZoneInCombat(); - if (instance) - { - Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_ALYTHESS)); - if (temp && temp->IsAlive() && !temp->GetVictim()) - temp->AI()->AttackStart(who); - } + Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ALYTHESS)); + if (temp && temp->IsAlive() && !temp->GetVictim()) + temp->AI()->AttackStart(who); - if (instance) - instance->SetData(DATA_EREDAR_TWINS_EVENT, IN_PROGRESS); + instance->SetBossState(DATA_EREDAR_TWINS, IN_PROGRESS); } void KilledUnit(Unit* /*victim*/) OVERRIDE @@ -167,8 +147,7 @@ public: { Talk(YELL_SAC_DEAD); - if (instance) - instance->SetData(DATA_EREDAR_TWINS_EVENT, DONE); + instance->SetBossState(DATA_EREDAR_TWINS, DONE); } else me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); @@ -178,15 +157,15 @@ public: { switch (spell->Id) { - case SPELL_SHADOW_BLADES: - case SPELL_SHADOW_NOVA: - case SPELL_CONFOUNDING_BLOW: - case SPELL_SHADOW_FURY: - HandleTouchedSpells(target, SPELL_DARK_TOUCHED); - break; - case SPELL_CONFLAGRATION: - HandleTouchedSpells(target, SPELL_FLAME_TOUCHED); - break; + case SPELL_SHADOW_BLADES: + case SPELL_SHADOW_NOVA: + case SPELL_CONFOUNDING_BLOW: + case SPELL_SHADOW_FURY: + HandleTouchedSpells(target, SPELL_DARK_TOUCHED); + break; + case SPELL_CONFLAGRATION: + HandleTouchedSpells(target, SPELL_FLAME_TOUCHED); + break; } } @@ -194,26 +173,26 @@ public: { switch (TouchedType) { - case SPELL_FLAME_TOUCHED: - if (!target->HasAura(SPELL_DARK_FLAME)) - { - if (target->HasAura(SPELL_DARK_TOUCHED)) + case SPELL_FLAME_TOUCHED: + if (!target->HasAura(SPELL_DARK_FLAME)) { - target->RemoveAurasDueToSpell(SPELL_DARK_TOUCHED); - target->CastSpell(target, SPELL_DARK_FLAME, true); - } else target->CastSpell(target, SPELL_FLAME_TOUCHED, true); - } - break; - case SPELL_DARK_TOUCHED: - if (!target->HasAura(SPELL_DARK_FLAME)) - { - if (target->HasAura(SPELL_FLAME_TOUCHED)) + if (target->HasAura(SPELL_DARK_TOUCHED)) + { + target->RemoveAurasDueToSpell(SPELL_DARK_TOUCHED); + target->CastSpell(target, SPELL_DARK_FLAME, true); + } else target->CastSpell(target, SPELL_FLAME_TOUCHED, true); + } + break; + case SPELL_DARK_TOUCHED: + if (!target->HasAura(SPELL_DARK_FLAME)) { - target->RemoveAurasDueToSpell(SPELL_FLAME_TOUCHED); - target->CastSpell(target, SPELL_DARK_FLAME, true); - } else target->CastSpell(target, SPELL_DARK_TOUCHED, true); - } - break; + if (target->HasAura(SPELL_FLAME_TOUCHED)) + { + target->RemoveAurasDueToSpell(SPELL_FLAME_TOUCHED); + target->CastSpell(target, SPELL_DARK_FLAME, true); + } else target->CastSpell(target, SPELL_DARK_TOUCHED, true); + } + break; } } @@ -221,17 +200,13 @@ public: { if (!SisterDeath) { - if (instance) + Unit* Temp = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_ALYTHESS)); + if (Temp && Temp->isDead()) { - Unit* Temp = NULL; - Temp = Unit::GetUnit(*me, instance->GetData64(DATA_ALYTHESS)); - if (Temp && Temp->isDead()) - { - Talk(YELL_SISTER_ALYTHESS_DEAD); - DoCast(me, SPELL_EMPOWER); - me->InterruptSpell(CURRENT_GENERIC_SPELL); - SisterDeath = true; - } + Talk(YELL_SISTER_ALYTHESS_DEAD); + DoCast(me, SPELL_EMPOWER); + me->InterruptSpell(CURRENT_GENERIC_SPELL); + SisterDeath = true; } } @@ -245,9 +220,7 @@ public: if (!me->IsNonMeleeSpellCasted(false)) { me->InterruptSpell(CURRENT_GENERIC_SPELL); - Unit* target = NULL; - target = SelectTarget(SELECT_TARGET_RANDOM, 0); - if (target) + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(target, SPELL_CONFLAGRATION); ConflagrationTimer = 30000+(rand()%5000); } @@ -259,8 +232,7 @@ public: { if (!me->IsNonMeleeSpellCasted(false)) { - Unit* target = NULL; - target = SelectTarget(SELECT_TARGET_RANDOM, 0); + Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0); if (target) DoCast(target, SPELL_SHADOW_NOVA); @@ -279,9 +251,7 @@ public: { if (!me->IsNonMeleeSpellCasted(false)) { - Unit* target = NULL; - target = SelectTarget(SELECT_TARGET_RANDOM, 0); - if (target) + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(target, SPELL_CONFOUNDING_BLOW); ConfoundingblowTimer = 20000 + (rand()%5000); } @@ -297,7 +267,7 @@ public: temp = DoSpawnCreature(NPC_SHADOW_IMAGE, 0, 0, 0, 0, TEMPSUMMON_CORPSE_DESPAWN, 10000); if (temp && target) { - temp->AddThreat(target, 1000000);//don't change target(healers) + temp->AddThreat(target, 1000000); //don't change target(healers) temp->AI()->AttackStart(target); } } @@ -333,6 +303,11 @@ public: } } }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return GetSunwellPlateauAI<boss_sacrolashAI>(creature); + }; }; class boss_alythess : public CreatureScript @@ -340,11 +315,6 @@ class boss_alythess : public CreatureScript public: boss_alythess() : CreatureScript("boss_alythess") { } - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new boss_alythessAI(creature); - }; - struct boss_alythessAI : public ScriptedAI { boss_alythessAI(Creature* creature) : ScriptedAI(creature) @@ -374,15 +344,12 @@ public: { Enraged = false; - if (instance) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SACROLASH))) { - if (Creature* temp = Unit::GetCreature((*me), instance->GetData64(DATA_SACROLASH))) - { - if (temp->isDead()) - temp->Respawn(); - else if (temp->GetVictim()) - me->getThreatManager().addThreat(temp->GetVictim(), 0.0f); - } + if (temp->isDead()) + temp->Respawn(); + else if (temp->GetVictim()) + me->getThreatManager().addThreat(temp->GetVictim(), 0.0f); } if (!me->IsInCombat()) @@ -398,23 +365,18 @@ public: SisterDeath = false; } - if (instance) - instance->SetData(DATA_EREDAR_TWINS_EVENT, NOT_STARTED); + instance->SetBossState(DATA_EREDAR_TWINS, NOT_STARTED); } void EnterCombat(Unit* who) OVERRIDE { DoZoneInCombat(); - if (instance) - { - Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_SACROLASH)); - if (temp && temp->IsAlive() && !temp->GetVictim()) - temp->AI()->AttackStart(who); - } + Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SACROLASH)); + if (temp && temp->IsAlive() && !temp->GetVictim()) + temp->AI()->AttackStart(who); - if (instance) - instance->SetData(DATA_EREDAR_TWINS_EVENT, IN_PROGRESS); + instance->SetBossState(DATA_EREDAR_TWINS, IN_PROGRESS); } void AttackStart(Unit* who) OVERRIDE @@ -424,7 +386,6 @@ public: } void MoveInLineOfSight(Unit* who) OVERRIDE - { if (!who || me->GetVictim()) return; @@ -441,17 +402,13 @@ public: } } else if (IntroStepCounter == 10 && me->IsWithinLOSInMap(who)&& me->IsWithinDistInMap(who, 30)) - { IntroStepCounter = 0; - } } void KilledUnit(Unit* /*victim*/) OVERRIDE { if (rand()%4 == 0) - { Talk(YELL_ALY_KILL); - } } void JustDied(Unit* /*killer*/) OVERRIDE @@ -459,9 +416,7 @@ public: if (SisterDeath) { Talk(YELL_ALY_DEAD); - - if (instance) - instance->SetData(DATA_EREDAR_TWINS_EVENT, DONE); + instance->SetBossState(DATA_EREDAR_TWINS, DONE); } else me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); @@ -471,16 +426,16 @@ public: { switch (spell->Id) { - case SPELL_BLAZE: - target->CastSpell(target, SPELL_BLAZE_SUMMON, true); - break; - case SPELL_CONFLAGRATION: - case SPELL_FLAME_SEAR: - HandleTouchedSpells(target, SPELL_FLAME_TOUCHED); - break; - case SPELL_SHADOW_NOVA: - HandleTouchedSpells(target, SPELL_DARK_TOUCHED); - break; + case SPELL_BLAZE: + target->CastSpell(target, SPELL_BLAZE_SUMMON, true); + break; + case SPELL_CONFLAGRATION: + case SPELL_FLAME_SEAR: + HandleTouchedSpells(target, SPELL_FLAME_TOUCHED); + break; + case SPELL_SHADOW_NOVA: + HandleTouchedSpells(target, SPELL_DARK_TOUCHED); + break; } } @@ -488,58 +443,68 @@ public: { switch (TouchedType) { - case SPELL_FLAME_TOUCHED: - if (!target->HasAura(SPELL_DARK_FLAME)) - { - if (target->HasAura(SPELL_DARK_TOUCHED)) - { - target->RemoveAurasDueToSpell(SPELL_DARK_TOUCHED); - target->CastSpell(target, SPELL_DARK_FLAME, true); - }else + case SPELL_FLAME_TOUCHED: + if (!target->HasAura(SPELL_DARK_FLAME)) { - target->CastSpell(target, SPELL_FLAME_TOUCHED, true); + if (target->HasAura(SPELL_DARK_TOUCHED)) + { + target->RemoveAurasDueToSpell(SPELL_DARK_TOUCHED); + target->CastSpell(target, SPELL_DARK_FLAME, true); + } + else + target->CastSpell(target, SPELL_FLAME_TOUCHED, true); } - } - break; - case SPELL_DARK_TOUCHED: - if (!target->HasAura(SPELL_DARK_FLAME)) - { - if (target->HasAura(SPELL_FLAME_TOUCHED)) + break; + case SPELL_DARK_TOUCHED: + if (!target->HasAura(SPELL_DARK_FLAME)) { - target->RemoveAurasDueToSpell(SPELL_FLAME_TOUCHED); - target->CastSpell(target, SPELL_DARK_FLAME, true); - } else target->CastSpell(target, SPELL_DARK_TOUCHED, true); - } - break; + if (target->HasAura(SPELL_FLAME_TOUCHED)) + { + target->RemoveAurasDueToSpell(SPELL_FLAME_TOUCHED); + target->CastSpell(target, SPELL_DARK_FLAME, true); + } + else + target->CastSpell(target, SPELL_DARK_TOUCHED, true); + } + break; } } uint32 IntroStep(uint32 step) { - Creature* Sacrolash = Unit::GetCreature(*me, instance ? instance->GetData64(DATA_SACROLASH) : 0); + Creature* Sacrolash = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SACROLASH)); switch (step) { - case 0: return 0; - case 1: - if (Sacrolash) - Sacrolash->AI()->Talk(YELL_INTRO_SAC_1); - return 1000; - case 2: Talk(YELL_INTRO_ALY_2); return 1000; - case 3: - if (Sacrolash) - Sacrolash->AI()->Talk(YELL_INTRO_SAC_3); - return 2000; - case 4: Talk(YELL_INTRO_ALY_4); return 1000; - case 5: - if (Sacrolash) - Sacrolash->AI()->Talk(YELL_INTRO_SAC_5); - return 2000; - case 6: Talk(YELL_INTRO_ALY_6); return 1000; - case 7: - if (Sacrolash) - Sacrolash->AI()->Talk(YELL_INTRO_SAC_7); - return 3000; - case 8: Talk(YELL_INTRO_ALY_8); return 900000; + case 0: + return 0; + case 1: + if (Sacrolash) + Sacrolash->AI()->Talk(YELL_INTRO_SAC_1); + return 1000; + case 2: + Talk(YELL_INTRO_ALY_2); + return 1000; + case 3: + if (Sacrolash) + Sacrolash->AI()->Talk(YELL_INTRO_SAC_3); + return 2000; + case 4: + Talk(YELL_INTRO_ALY_4); + return 1000; + case 5: + if (Sacrolash) + Sacrolash->AI()->Talk(YELL_INTRO_SAC_5); + return 2000; + case 6: + Talk(YELL_INTRO_ALY_6); + return 1000; + case 7: + if (Sacrolash) + Sacrolash->AI()->Talk(YELL_INTRO_SAC_7); + return 3000; + case 8: + Talk(YELL_INTRO_ALY_8); + return 900000; } return 10000; } @@ -556,30 +521,23 @@ public: if (!SisterDeath) { - if (instance) + Unit* Temp = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_SACROLASH)); + if (Temp && Temp->isDead()) { - Unit* Temp = NULL; - Temp = Unit::GetUnit(*me, instance->GetData64(DATA_SACROLASH)); - if (Temp && Temp->isDead()) - { - Talk(YELL_SISTER_SACROLASH_DEAD); - DoCast(me, SPELL_EMPOWER); - me->InterruptSpell(CURRENT_GENERIC_SPELL); - SisterDeath = true; - } + Talk(YELL_SISTER_SACROLASH_DEAD); + DoCast(me, SPELL_EMPOWER); + me->InterruptSpell(CURRENT_GENERIC_SPELL); + SisterDeath = true; } } if (!me->GetVictim()) { - if (instance) + Creature* sisiter = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SACROLASH)); + if (sisiter && !sisiter->isDead() && sisiter->GetVictim()) { - Creature* sisiter = Unit::GetCreature((*me), instance->GetData64(DATA_SACROLASH)); - if (sisiter && !sisiter->isDead() && sisiter->GetVictim()) - { - me->AddThreat(sisiter->GetVictim(), 0.0f); - DoStartNoMovement(sisiter->GetVictim()); - me->Attack(sisiter->GetVictim(), false); - } + me->AddThreat(sisiter->GetVictim(), 0.0f); + DoStartNoMovement(sisiter->GetVictim()); + me->Attack(sisiter->GetVictim(), false); } } @@ -592,9 +550,7 @@ public: { if (!me->IsNonMeleeSpellCasted(false)) { - Unit* target = NULL; - target = SelectTarget(SELECT_TARGET_RANDOM, 0); - if (target) + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(target, SPELL_SHADOW_NOVA); ShadownovaTimer= 30000+(rand()%5000); } @@ -607,8 +563,7 @@ public: if (!me->IsNonMeleeSpellCasted(false)) { me->InterruptSpell(CURRENT_GENERIC_SPELL); - Unit* target = NULL; - target = SelectTarget(SELECT_TARGET_RANDOM, 0); + Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0); if (target) DoCast(target, SPELL_CONFLAGRATION); ConflagrationTimer = 30000+(rand()%5000); @@ -661,6 +616,11 @@ public: } else EnrageTimer -= diff; } }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return GetSunwellPlateauAI<boss_alythessAI>(creature); + }; }; class npc_shadow_image : public CreatureScript @@ -689,23 +649,23 @@ public: KillTimer = 15000; } - void EnterCombat(Unit* /*who*/)OVERRIDE { } + void EnterCombat(Unit* /*who*/) OVERRIDE { } void SpellHitTarget(Unit* target, const SpellInfo* spell) OVERRIDE { switch (spell->Id) { - case SPELL_SHADOW_FURY: - case SPELL_DARK_STRIKE: - if (!target->HasAura(SPELL_DARK_FLAME)) - { - if (target->HasAura(SPELL_FLAME_TOUCHED)) + case SPELL_SHADOW_FURY: + case SPELL_DARK_STRIKE: + if (!target->HasAura(SPELL_DARK_FLAME)) { - target->RemoveAurasDueToSpell(SPELL_FLAME_TOUCHED); - target->CastSpell(target, SPELL_DARK_FLAME, true); - } else target->CastSpell(target, SPELL_DARK_TOUCHED, true); - } - break; + if (target->HasAura(SPELL_FLAME_TOUCHED)) + { + target->RemoveAurasDueToSpell(SPELL_FLAME_TOUCHED); + target->CastSpell(target, SPELL_DARK_FLAME, true); + } else target->CastSpell(target, SPELL_DARK_TOUCHED, true); + } + break; } } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp index 561ba361f26..80b4b98b0a4 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp @@ -81,14 +81,14 @@ enum Spells //Other SPELL_BERSERK = 45078, SPELL_CLOUD_VISUAL = 45212, - SPELL_CLOUD_SUMMON = 45884, + SPELL_CLOUD_SUMMON = 45884 }; enum PhaseFelmyst { PHASE_NONE, PHASE_GROUND, - PHASE_FLIGHT, + PHASE_FLIGHT }; enum EventFelmyst @@ -104,7 +104,7 @@ enum EventFelmyst EVENT_FLIGHT_SEQUENCE, EVENT_SUMMON_DEAD, - EVENT_SUMMON_FOG, + EVENT_SUMMON_FOG }; class boss_felmyst : public CreatureScript @@ -112,11 +112,6 @@ class boss_felmyst : public CreatureScript public: boss_felmyst() : CreatureScript("boss_felmyst") { } - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new boss_felmystAI(creature); - } - struct boss_felmystAI : public ScriptedAI { boss_felmystAI(Creature* creature) : ScriptedAI(creature) @@ -148,8 +143,7 @@ public: DespawnSummons(NPC_VAPOR_TRAIL); me->setActive(false); - if (instance) - instance->SetData(DATA_FELMYST_EVENT, NOT_STARTED); + instance->SetBossState(DATA_FELMYST, NOT_STARTED); } void EnterCombat(Unit* /*who*/) OVERRIDE @@ -162,8 +156,7 @@ public: DoCast(me, AURA_NOXIOUS_FUMES, true); EnterPhase(PHASE_GROUND); - if (instance) - instance->SetData(DATA_FELMYST_EVENT, IN_PROGRESS); + instance->SetBossState(DATA_FELMYST, IN_PROGRESS); } void AttackStart(Unit* who) OVERRIDE @@ -173,7 +166,6 @@ public: } void MoveInLineOfSight(Unit* who) OVERRIDE - { if (phase != PHASE_FLIGHT) ScriptedAI::MoveInLineOfSight(who); @@ -193,8 +185,7 @@ public: { Talk(YELL_DEATH); - if (instance) - instance->SetData(DATA_FELMYST_EVENT, DONE); + instance->SetBossState(DATA_FELMYST, DONE); } void SpellHit(Unit* caster, const SpellInfo* spell) OVERRIDE @@ -246,26 +237,26 @@ public: { switch (NextPhase) { - case PHASE_GROUND: - me->CastStop(SPELL_FOG_BREATH); - me->RemoveAurasDueToSpell(SPELL_FOG_BREATH); - me->StopMoving(); - me->SetSpeed(MOVE_RUN, 2.0f); - - events.ScheduleEvent(EVENT_CLEAVE, urand(5000, 10000)); - events.ScheduleEvent(EVENT_CORROSION, urand(10000, 20000)); - events.ScheduleEvent(EVENT_GAS_NOVA, urand(15000, 20000)); - events.ScheduleEvent(EVENT_ENCAPSULATE, urand(20000, 25000)); - events.ScheduleEvent(EVENT_FLIGHT, 60000); - break; - case PHASE_FLIGHT: - me->SetDisableGravity(true); - events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 1000); - uiFlightCount = 0; - uiBreathCount = 0; - break; - default: - break; + case PHASE_GROUND: + me->CastStop(SPELL_FOG_BREATH); + me->RemoveAurasDueToSpell(SPELL_FOG_BREATH); + me->StopMoving(); + me->SetSpeed(MOVE_RUN, 2.0f); + + events.ScheduleEvent(EVENT_CLEAVE, urand(5000, 10000)); + events.ScheduleEvent(EVENT_CORROSION, urand(10000, 20000)); + events.ScheduleEvent(EVENT_GAS_NOVA, urand(15000, 20000)); + events.ScheduleEvent(EVENT_ENCAPSULATE, urand(20000, 25000)); + events.ScheduleEvent(EVENT_FLIGHT, 60000); + break; + case PHASE_FLIGHT: + me->SetDisableGravity(true); + events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 1000); + uiFlightCount = 0; + uiBreathCount = 0; + break; + default: + break; } phase = NextPhase; } @@ -274,133 +265,130 @@ public: { switch (uiFlightCount) { - case 0: - //me->AttackStop(); - me->GetMotionMaster()->Clear(false); - me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); - me->StopMoving(); - Talk(YELL_TAKEOFF); - events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 2000); - break; - case 1: - me->GetMotionMaster()->MovePoint(0, me->GetPositionX()+1, me->GetPositionY(), me->GetPositionZ()+10); - break; - case 2: - { - Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true); - if (!target) - target = Unit::GetUnit(*me, instance ? instance->GetData64(DATA_PLAYER_GUID) : 0); - - if (!target) + case 0: + //me->AttackStop(); + me->GetMotionMaster()->Clear(false); + me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); + me->StopMoving(); + Talk(YELL_TAKEOFF); + events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 2000); + break; + case 1: + me->GetMotionMaster()->MovePoint(0, me->GetPositionX()+1, me->GetPositionY(), me->GetPositionZ()+10); + break; + case 2: { - EnterEvadeMode(); - return; + Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true); + if (!target) + target = Unit::GetUnit(*me, instance->GetData64(DATA_PLAYER_GUID)); + + if (!target) + { + EnterEvadeMode(); + return; + } + + if (Creature* Vapor = me->SummonCreature(NPC_VAPOR, target->GetPositionX()-5+rand()%10, target->GetPositionY()-5+rand()%10, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 9000)) + { + Vapor->AI()->AttackStart(target); + me->InterruptNonMeleeSpells(false); + DoCast(Vapor, SPELL_VAPOR_CHANNEL, false); // core bug + Vapor->CastSpell(Vapor, SPELL_VAPOR_TRIGGER, true); + } + + events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 10000); + break; } - - Creature* Vapor = me->SummonCreature(NPC_VAPOR, target->GetPositionX()-5+rand()%10, target->GetPositionY()-5+rand()%10, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 9000); - if (Vapor) + case 3: { - Vapor->AI()->AttackStart(target); - me->InterruptNonMeleeSpells(false); - DoCast(Vapor, SPELL_VAPOR_CHANNEL, false); // core bug - Vapor->CastSpell(Vapor, SPELL_VAPOR_TRIGGER, true); + DespawnSummons(NPC_VAPOR_TRAIL); + //DoCast(me, SPELL_VAPOR_SELECT); need core support + + Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true); + if (!target) + target = Unit::GetUnit(*me, instance->GetData64(DATA_PLAYER_GUID)); + + if (!target) + { + EnterEvadeMode(); + return; + } + + //target->CastSpell(target, SPELL_VAPOR_SUMMON, true); need core support + if (Creature* pVapor = me->SummonCreature(NPC_VAPOR, target->GetPositionX()-5+rand()%10, target->GetPositionY()-5+rand()%10, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 9000)) + { + if (pVapor->AI()) + pVapor->AI()->AttackStart(target); + me->InterruptNonMeleeSpells(false); + DoCast(pVapor, SPELL_VAPOR_CHANNEL, false); // core bug + pVapor->CastSpell(pVapor, SPELL_VAPOR_TRIGGER, true); + } + + events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 10000); + break; } - - events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 10000); - break; - } - case 3: - { - DespawnSummons(NPC_VAPOR_TRAIL); - //DoCast(me, SPELL_VAPOR_SELECT); need core support - - Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true); - if (!target) - target = Unit::GetUnit(*me, instance ? instance->GetData64(DATA_PLAYER_GUID) : 0); - - if (!target) + case 4: + DespawnSummons(NPC_VAPOR_TRAIL); + events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 1); + break; + case 5: { - EnterEvadeMode(); - return; + Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true); + if (!target) + target = Unit::GetUnit(*me, instance->GetData64(DATA_PLAYER_GUID)); + + if (!target) + { + EnterEvadeMode(); + return; + } + + breathX = target->GetPositionX(); + breathY = target->GetPositionY(); + float x, y, z; + target->GetContactPoint(me, x, y, z, 70); + me->GetMotionMaster()->MovePoint(0, x, y, z+10); + break; } - - //target->CastSpell(target, SPELL_VAPOR_SUMMON, true); need core support - Creature* pVapor = me->SummonCreature(NPC_VAPOR, target->GetPositionX()-5+rand()%10, target->GetPositionY()-5+rand()%10, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 9000); - if (pVapor) + case 6: + me->SetFacingTo(me->GetAngle(breathX, breathY)); + //DoTextEmote("takes a deep breath.", NULL); + events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 10000); + break; + case 7: { - if (pVapor->AI()) - pVapor->AI()->AttackStart(target); - me->InterruptNonMeleeSpells(false); - DoCast(pVapor, SPELL_VAPOR_CHANNEL, false); // core bug - pVapor->CastSpell(pVapor, SPELL_VAPOR_TRIGGER, true); + DoCast(me, SPELL_FOG_BREATH, true); + float x, y, z; + me->GetPosition(x, y, z); + x = 2 * breathX - x; + y = 2 * breathY - y; + me->GetMotionMaster()->MovePoint(0, x, y, z); + events.ScheduleEvent(EVENT_SUMMON_FOG, 1); + break; } - - events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 10000); - break; - } - case 4: - DespawnSummons(NPC_VAPOR_TRAIL); - events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 1); - break; - case 5: - { - Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true); - if (!target) - target = Unit::GetUnit(*me, instance ? instance->GetData64(DATA_PLAYER_GUID) : 0); - - if (!target) - { - EnterEvadeMode(); - return; - } - - breathX = target->GetPositionX(); - breathY = target->GetPositionY(); - float x, y, z; - target->GetContactPoint(me, x, y, z, 70); - me->GetMotionMaster()->MovePoint(0, x, y, z+10); - break; - } - case 6: - me->SetOrientation(me->GetAngle(breathX, breathY)); - me->StopMoving(); - //DoTextEmote("takes a deep breath.", NULL); - events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 10000); - break; - case 7: - { - DoCast(me, SPELL_FOG_BREATH, true); - float x, y, z; - me->GetPosition(x, y, z); - x = 2 * breathX - x; - y = 2 * breathY - y; - me->GetMotionMaster()->MovePoint(0, x, y, z); - events.ScheduleEvent(EVENT_SUMMON_FOG, 1); - break; - } - case 8: - me->CastStop(SPELL_FOG_BREATH); - me->RemoveAurasDueToSpell(SPELL_FOG_BREATH); - ++uiBreathCount; - events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 1); - if (uiBreathCount < 3) - uiFlightCount = 4; - break; - case 9: - if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO)) - DoStartMovement(target); - else - { - EnterEvadeMode(); - return; - } - break; - case 10: - me->SetDisableGravity(false); - me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); - EnterPhase(PHASE_GROUND); - AttackStart(SelectTarget(SELECT_TARGET_TOPAGGRO)); - break; + case 8: + me->CastStop(SPELL_FOG_BREATH); + me->RemoveAurasDueToSpell(SPELL_FOG_BREATH); + ++uiBreathCount; + events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 1); + if (uiBreathCount < 3) + uiFlightCount = 4; + break; + case 9: + if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO)) + DoStartMovement(target); + else + { + EnterEvadeMode(); + return; + } + break; + case 10: + me->SetDisableGravity(false); + me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); + EnterPhase(PHASE_GROUND); + AttackStart(SelectTarget(SELECT_TARGET_TOPAGGRO)); + break; } ++uiFlightCount; } @@ -512,6 +500,11 @@ public: } } }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return GetSunwellPlateauAI<boss_felmystAI>(creature); + } }; class npc_felmyst_vapor : public CreatureScript @@ -531,12 +524,14 @@ public: me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetSpeed(MOVE_RUN, 0.8f); } + void Reset() OVERRIDE { } void EnterCombat(Unit* /*who*/) OVERRIDE { DoZoneInCombat(); //DoCast(me, SPELL_VAPOR_FORCE, true); core bug } + void UpdateAI(uint32 /*diff*/) OVERRIDE { if (!me->GetVictim()) @@ -565,6 +560,7 @@ public: me->SetTarget(me->GetGUID()); me->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, 0.01f); // core bug } + void Reset() OVERRIDE { } void EnterCombat(Unit* /*who*/) OVERRIDE { } void AttackStart(Unit* /*who*/) OVERRIDE { } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp index 2895e85de71..2a2574ea256 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp @@ -44,7 +44,7 @@ enum Yells SAY_GOOD_AGGRO = 0, SAY_GOOD_NEAR_DEATH = 1, - SAY_GOOD_NEAR_DEATH2 = 2, + SAY_GOOD_NEAR_DEATH2 = 2 }; enum Spells @@ -76,20 +76,20 @@ enum Spells enum SWPActions { DO_ENRAGE = 1, - DO_BANISH = 2, + DO_BANISH = 2 }; #define GO_FAILED "You are unable to use this currently." #define EMOTE_UNABLE_TO_FIND "is unable to find Kalecgos" -#define FLY_X 1679 -#define FLY_Y 900 -#define FLY_Z 82 +#define FLY_X 1679 +#define FLY_Y 900 +#define FLY_Z 82 -#define CENTER_X 1705 -#define CENTER_Y 930 -#define RADIUS 30 +#define CENTER_X 1705 +#define CENTER_Y 930 +#define RADIUS 30 #define DRAGON_REALM_Z 53.079f #define DEMON_REALM_Z -74.558f @@ -103,11 +103,6 @@ class boss_kalecgos : public CreatureScript public: boss_kalecgos() : CreatureScript("boss_kalecgos") { } - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new boss_kalecgosAI(creature); - } - struct boss_kalecgosAI : public ScriptedAI { boss_kalecgosAI(Creature* creature) : ScriptedAI(creature) @@ -141,13 +136,10 @@ public: void Reset() OVERRIDE { - if (instance) - { - SathGUID = instance->GetData64(DATA_SATHROVARR); - instance->SetData(DATA_KALECGOS_EVENT, NOT_STARTED); - } + SathGUID = instance->GetData64(DATA_SATHROVARR); + instance->SetBossState(DATA_KALECGOS, NOT_STARTED); - if (Creature* Sath = Unit::GetCreature(*me, SathGUID)) + if (Creature* Sath = ObjectAccessor::GetCreature(*me, SathGUID)) Sath->AI()->EnterEvadeMode(); me->setFaction(14); @@ -158,7 +150,7 @@ public: me->SetVisible(true); me->SetStandState(UNIT_STAND_STATE_SLEEP); } - me->SetFullHealth();//dunno why it does not resets health at evade.. + me->SetFullHealth(); //dunno why it does not resets health at evade.. ArcaneBuffetTimer = 8000; FrostBreathTimer = 15000; WildMagicTimer = 10000; @@ -234,6 +226,7 @@ public: } else ResetTimer -= diff; return; } + if (!UpdateVictim()) return; @@ -246,13 +239,13 @@ public: } if (HealthBelowPct(10) && !isEnraged) { - if (Creature* Sath = Unit::GetCreature(*me, SathGUID)) + if (Creature* Sath = ObjectAccessor::GetCreature(*me, SathGUID)) Sath->AI()->DoAction(DO_ENRAGE); DoAction(DO_ENRAGE); } if (!isBanished && HealthBelowPct(1)) { - if (Creature* Sath = Unit::GetCreature(*me, SathGUID)) + if (Creature* Sath = ObjectAccessor::GetCreature(*me, SathGUID)) { if (Sath->HasAura(SPELL_BANISH)) { @@ -264,7 +257,7 @@ public: } else { - TC_LOG_ERROR(LOG_FILTER_TSCR, "Didn't find Shathrowar. Kalecgos event reseted."); + TC_LOG_ERROR("scripts", "Didn't find Shathrowar. Kalecgos event reseted."); EnterEvadeMode(); return; } @@ -317,6 +310,7 @@ public: SpectralBlastTimer = 1000; return; } + std::list<Unit*>::const_iterator i = targetList.begin(); advance(i, rand()%targetList.size()); if ((*i)) @@ -331,7 +325,6 @@ public: } void MoveInLineOfSight(Unit* who) OVERRIDE - { if (bJustReset)//boss is invisible, don't attack return; @@ -356,8 +349,7 @@ public: Talk(SAY_EVIL_AGGRO); DoZoneInCombat(); - if (instance) - instance->SetData(DATA_KALECGOS_EVENT, IN_PROGRESS); + instance->SetBossState(DATA_KALECGOS, IN_PROGRESS); } void KilledUnit(Unit* /*victim*/) OVERRIDE @@ -396,21 +388,21 @@ public: { switch (TalkSequence) { - case 1: - me->setFaction(35); - TalkTimer = 1000; - break; - case 2: - Talk(SAY_GOOD_PLRWIN); - TalkTimer = 10000; - break; - case 3: - me->SetDisableGravity(true); - me->GetMotionMaster()->MovePoint(0, FLY_X, FLY_Y, FLY_Z); - TalkTimer = 600000; - break; - default: - break; + case 1: + me->setFaction(35); + TalkTimer = 1000; + break; + case 2: + Talk(SAY_GOOD_PLRWIN); + TalkTimer = 10000; + break; + case 3: + me->SetDisableGravity(true); + me->GetMotionMaster()->MovePoint(0, FLY_X, FLY_Y, FLY_Z); + TalkTimer = 600000; + break; + default: + break; } } @@ -418,23 +410,28 @@ public: { switch (TalkSequence) { - case 1: - Talk(SAY_EVIL_ENRAGE); - TalkTimer = 3000; - break; - case 2: - me->SetDisableGravity(true); - me->GetMotionMaster()->MovePoint(0, FLY_X, FLY_Y, FLY_Z); - TalkTimer = 15000; - break; - case 3: - EnterEvadeMode(); - break; - default: - break; + case 1: + Talk(SAY_EVIL_ENRAGE); + TalkTimer = 3000; + break; + case 2: + me->SetDisableGravity(true); + me->GetMotionMaster()->MovePoint(0, FLY_X, FLY_Y, FLY_Z); + TalkTimer = 15000; + break; + case 3: + EnterEvadeMode(); + break; + default: + break; } } }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return GetSunwellPlateauAI<boss_kalecgosAI>(creature); + } }; class boss_kalec : public CreatureScript @@ -490,6 +487,7 @@ public: { if (!me->HasAura(AURA_SPECTRAL_INVISIBILITY)) me->CastSpell(me, AURA_SPECTRAL_INVISIBILITY, true); + if (!UpdateVictim()) return; @@ -497,26 +495,26 @@ public: { switch (YellSequence) { - case 0: - Talk(SAY_GOOD_AGGRO); - ++YellSequence; - break; - case 1: - if (HealthBelowPct(50)) - { - Talk(SAY_GOOD_NEAR_DEATH); + case 0: + Talk(SAY_GOOD_AGGRO); ++YellSequence; - } - break; - case 2: - if (HealthBelowPct(10)) - { - Talk(SAY_GOOD_NEAR_DEATH2); - ++YellSequence; - } - break; - default: - break; + break; + case 1: + if (HealthBelowPct(50)) + { + Talk(SAY_GOOD_NEAR_DEATH); + ++YellSequence; + } + break; + case 2: + if (HealthBelowPct(10)) + { + Talk(SAY_GOOD_NEAR_DEATH2); + ++YellSequence; + } + break; + default: + break; } YellTimer = 5000; } @@ -610,11 +608,11 @@ public: if (instance) { KalecgosGUID = instance->GetData64(DATA_KALECGOS_DRAGON); - instance->SetData(DATA_KALECGOS_EVENT, NOT_STARTED); + instance->SetBossState(DATA_KALECGOS, NOT_STARTED); } if (KalecGUID) { - if (Creature* Kalec = Unit::GetCreature(*me, KalecGUID)) + if (Creature* Kalec = ObjectAccessor::GetCreature(*me, KalecGUID)) Kalec->setDeathState(JUST_DIED); KalecGUID = 0; } @@ -654,7 +652,7 @@ public: if (target->GetGUID() == KalecGUID) { TeleportAllPlayersBack(); - if (Creature* Kalecgos = Unit::GetCreature(*me, KalecgosGUID)) + if (Creature* Kalecgos = ObjectAccessor::GetCreature(*me, KalecgosGUID)) { CAST_AI(boss_kalecgos::boss_kalecgosAI, Kalecgos->AI())->TalkTimer = 1; CAST_AI(boss_kalecgos::boss_kalecgosAI, Kalecgos->AI())->isFriendly = false; @@ -670,14 +668,14 @@ public: Talk(SAY_SATH_DEATH); me->SetPosition(me->GetPositionX(), me->GetPositionY(), DRAGON_REALM_Z, me->GetOrientation()); TeleportAllPlayersBack(); - if (Creature* Kalecgos = Unit::GetCreature(*me, KalecgosGUID)) + if (Creature* Kalecgos = ObjectAccessor::GetCreature(*me, KalecgosGUID)) { CAST_AI(boss_kalecgos::boss_kalecgosAI, Kalecgos->AI())->TalkTimer = 1; CAST_AI(boss_kalecgos::boss_kalecgosAI, Kalecgos->AI())->isFriendly = true; } if (instance) - instance->SetData(DATA_KALECGOS_EVENT, DONE); + instance->SetBossState(DATA_KALECGOS, DONE); } void TeleportAllPlayersBack() @@ -716,27 +714,28 @@ public: { if (!me->HasAura(AURA_SPECTRAL_INVISIBILITY)) me->CastSpell(me, AURA_SPECTRAL_INVISIBILITY, true); + if (!UpdateVictim()) return; if (CheckTimer <= diff) { - Creature* Kalec = Unit::GetCreature(*me, KalecGUID); + Creature* Kalec = ObjectAccessor::GetCreature(*me, KalecGUID); if (!Kalec || !Kalec->IsAlive()) { - if (Creature* Kalecgos = Unit::GetCreature(*me, KalecgosGUID)) + if (Creature* Kalecgos = ObjectAccessor::GetCreature(*me, KalecgosGUID)) Kalecgos->AI()->EnterEvadeMode(); return; } if (HealthBelowPct(10) && !isEnraged) { - if (Creature* Kalecgos = Unit::GetCreature(*me, KalecgosGUID)) + if (Creature* Kalecgos = ObjectAccessor::GetCreature(*me, KalecgosGUID)) Kalecgos->AI()->DoAction(DO_ENRAGE); DoAction(DO_ENRAGE); } - Creature* Kalecgos = Unit::GetCreature(*me, KalecgosGUID); + Creature* Kalecgos = ObjectAccessor::GetCreature(*me, KalecgosGUID); if (Kalecgos && !Kalecgos->IsInCombat()) { me->AI()->EnterEvadeMode(); @@ -778,7 +777,8 @@ public: if (ShadowBoltTimer <= diff) { - if (!(rand()%5))Talk(SAY_SATH_SPELL1); + if (!(rand()%5)) + Talk(SAY_SATH_SPELL1); DoCast(me, SPELL_SHADOW_BOLT); ShadowBoltTimer = 7000+(rand()%3000); } else ShadowBoltTimer -= diff; diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp index 2730d308828..b3982200a10 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp @@ -60,7 +60,7 @@ enum Yells SAY_ANVEENA_IMPRISONED = 0, SAY_ANVEENA_LOST = 1, SAY_ANVEENA_KALEC = 2, - SAY_ANVEENA_GOODBYE = 3, + SAY_ANVEENA_GOODBYE = 3 }; /*** Spells used during the encounter ***/ @@ -156,7 +156,7 @@ enum Phase PHASE_NORMAL = 2, // Kil'Jaeden emerges from the sunwell PHASE_DARKNESS = 3, // At 85%, he gains few abilities; Kalecgos joins the fight PHASE_ARMAGEDDON = 4, // At 55%, he gains even more abilities - PHASE_SACRIFICE = 5, // At 25%, Anveena sacrifices herself into the Sunwell; at this point he becomes enraged and has *significally* shorter cooldowns. + PHASE_SACRIFICE = 5 // At 25%, Anveena sacrifices herself into the Sunwell; at this point he becomes enraged and has *significally* shorter cooldowns. }; //Timers @@ -185,7 +185,7 @@ Position DeceiverLocations[3]= { {1682.045f, 631.299f, 5.936f, 0.0f}, {1684.099f, 618.848f, 0.589f, 0.0f}, - {1694.170f, 612.272f, 1.416f, 0.0f}, + {1694.170f, 612.272f, 1.416f, 0.0f} }; // Locations, where Shield Orbs will spawn @@ -225,7 +225,7 @@ static Speech Speeches[]= {SAY_KJ_PHASE5, DATA_KILJAEDEN, 5500}, // use in End sequence? - {SAY_KALECGOS_GOODBYE, DATA_KALECGOS_KJ, 12000}, + {SAY_KALECGOS_GOODBYE, DATA_KALECGOS_KJ, 12000} }; //AI for Kalecgos @@ -271,13 +271,13 @@ public: switch (index) { case 0: - return instance->instance->GetGameObject(instance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_1)); + return ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_1)); case 1: - return instance->instance->GetGameObject(instance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_2)); + return ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_2)); case 2: - return instance->instance->GetGameObject(instance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_3)); + return ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_3)); case 3: - return instance->instance->GetGameObject(instance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_4)); + return ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_4)); } return NULL; @@ -368,11 +368,11 @@ public: if (go->GetUInt32Value(GAMEOBJECT_FACTION) == 35) { InstanceScript* instance = go->GetInstanceScript(); - player->SummonCreature(CREATURE_POWER_OF_THE_BLUE_DRAGONFLIGHT, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 121000); + player->SummonCreature(NPC_POWER_OF_THE_BLUE_DRAGONFLIGHT, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 121000); player->CastSpell(player, SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT, false); go->SetUInt32Value(GAMEOBJECT_FACTION, 0); - if (Creature* pKalec = Unit::GetCreature(*player, instance->GetData64(DATA_KALECGOS_KJ))) + if (Creature* pKalec = ObjectAccessor::GetCreature(*player, instance->GetData64(DATA_KALECGOS_KJ))) CAST_AI(boss_kalecgos_kj::boss_kalecgos_kjAI, pKalec->AI())->SetRingOfBlueFlames(); go->Refresh(); @@ -425,7 +425,7 @@ public: phase = PHASE_DECEIVERS; if (instance) - if (Creature* pKalecKJ = Unit::GetCreature((*me), instance->GetData64(DATA_KALECGOS_KJ))) + if (Creature* pKalecKJ = ObjectAccessor::GetCreature((*me), instance->GetData64(DATA_KALECGOS_KJ))) CAST_AI(boss_kalecgos_kj::boss_kalecgos_kjAI, pKalecKJ->AI())->ResetOrbs(); deceiverDeathCount = 0; bSummonedDeceivers = false; @@ -438,15 +438,15 @@ public: { switch (summoned->GetEntry()) { - case CREATURE_HAND_OF_THE_DECEIVER: + case NPC_HAND_OF_THE_DECEIVER: summoned->CastSpell(summoned, SPELL_SHADOW_CHANNELING, false); break; - case CREATURE_ANVEENA: + case NPC_ANVEENA: summoned->SetDisableGravity(true); summoned->CastSpell(summoned, SPELL_ANVEENA_PRISON, true); summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); break; - case CREATURE_KILJAEDEN: + case NPC_KILJAEDEN: summoned->CastSpell(summoned, SPELL_REBIRTH, false); summoned->AddThreat(me->GetVictim(), 1.0f); break; @@ -458,7 +458,7 @@ public: { if (uiRandomSayTimer < diff) { - if (instance && instance->GetData(DATA_MURU_EVENT) != DONE && instance->GetData(DATA_KILJAEDEN_EVENT) == NOT_STARTED) + if (instance && instance->GetBossState(DATA_MURU) != DONE && instance->GetBossState(DATA_KILJAEDEN) == NOT_STARTED) Talk(SAY_KJ_OFFCOMBAT); uiRandomSayTimer = 30000; } else uiRandomSayTimer -= diff; @@ -466,9 +466,9 @@ public: if (!bSummonedDeceivers) { for (uint8 i = 0; i < 3; ++i) - me->SummonCreature(CREATURE_HAND_OF_THE_DECEIVER, DeceiverLocations[i], TEMPSUMMON_DEAD_DESPAWN, 0); + me->SummonCreature(NPC_HAND_OF_THE_DECEIVER, DeceiverLocations[i], TEMPSUMMON_DEAD_DESPAWN, 0); - DoSpawnCreature(CREATURE_ANVEENA, 0, 0, 40, 0, TEMPSUMMON_DEAD_DESPAWN, 0); + DoSpawnCreature(NPC_ANVEENA, 0, 0, 40, 0, TEMPSUMMON_DEAD_DESPAWN, 0); DoCast(me, SPELL_ANVEENA_ENERGY_DRAIN); bSummonedDeceivers = true; } @@ -477,7 +477,7 @@ public: { me->RemoveAurasDueToSpell(SPELL_ANVEENA_ENERGY_DRAIN); phase = PHASE_NORMAL; - DoSpawnCreature(CREATURE_KILJAEDEN, 0, 0, 0, 0, TEMPSUMMON_MANUAL_DESPAWN, 0); + DoSpawnCreature(NPC_KILJAEDEN, 0, 0, 0, 0, TEMPSUMMON_MANUAL_DESPAWN, 0); } } }; @@ -489,11 +489,6 @@ class boss_kiljaeden : public CreatureScript public: boss_kiljaeden() : CreatureScript("boss_kiljaeden") { } - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new boss_kiljaedenAI(creature); - } - struct boss_kiljaedenAI : public ScriptedAI { boss_kiljaedenAI(Creature* creature) : ScriptedAI(creature), summons(me) @@ -559,11 +554,9 @@ public: OrbActivated = false; SpeechBegins = true; - if (instance) - { - if (Creature* pKalec = Unit::GetCreature(*me, instance->GetData64(DATA_KALECGOS_KJ))) - pKalec->RemoveDynObject(SPELL_RING_OF_BLUE_FLAMES); - } + if (Creature* pKalec = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KALECGOS_KJ))) + pKalec->RemoveDynObject(SPELL_RING_OF_BLUE_FLAMES); + me->SetFloatValue(UNIT_FIELD_COMBATREACH, 12); ChangeTimers(false, 0); summons.DespawnAll(); @@ -590,7 +583,7 @@ public: void JustSummoned(Creature* summoned) OVERRIDE { - if (summoned->GetEntry() == CREATURE_ARMAGEDDON_TARGET) + if (summoned->GetEntry() == NPC_ARMAGEDDON_TARGET) { summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); @@ -607,9 +600,7 @@ public: { Talk(SAY_KJ_DEATH); summons.DespawnAll(); - - if (instance) - instance->SetData(DATA_KILJAEDEN_EVENT, DONE); + instance->SetBossState(DATA_KILJAEDEN, DONE); } void KilledUnit(Unit* /*victim*/) OVERRIDE @@ -624,11 +615,8 @@ public: summons.DespawnAll(); // Reset the controller - if (instance) - { - if (Creature* pControl = Unit::GetCreature(*me, instance->GetData64(DATA_KILJAEDEN_CONTROLLER))) - CAST_AI(npc_kiljaeden_controller::npc_kiljaeden_controllerAI, pControl->AI())->Reset(); - } + if (Creature* pControl = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KILJAEDEN_CONTROLLER))) + CAST_AI(npc_kiljaeden_controller::npc_kiljaeden_controllerAI, pControl->AI())->Reset(); } void EnterCombat(Unit* /*who*/) OVERRIDE @@ -657,7 +645,7 @@ public: { float x, y, z; target->GetPosition(x, y, z); - if (Creature* pSinisterReflection = me->SummonCreature(CREATURE_SINISTER_REFLECTION, x, y, z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0)) + if (Creature* pSinisterReflection = me->SummonCreature(NPC_SINISTER_REFLECTION, x, y, z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0)) { pSinisterReflection->SetDisplayId(target->GetDisplayId()); pSinisterReflection->AI()->AttackStart(target); @@ -709,15 +697,12 @@ public: if (Speeches[speechCount].timer < SpeechTimer) { SpeechTimer = 0; - if (instance) - { - if (Creature* speechCreature = Unit::GetCreature(*me, instance->GetData64(Speeches[speechCount].creature))) - speechCreature->AI()->Talk(Speeches[speechCount].textid); - if (speechCount == 12) - if (Creature* pAnveena = Unit::GetCreature(*me, instance->GetData64(DATA_ANVEENA))) - pAnveena->CastSpell(me, SPELL_SACRIFICE_OF_ANVEENA, false); - // ChangeTimers(true, 10000); // Kil should do an emote while screaming without attacking for 10 seconds - } + if (Creature* speechCreature = ObjectAccessor::GetCreature(*me, instance->GetData64(Speeches[speechCount].creature))) + speechCreature->AI()->Talk(Speeches[speechCount].textid); + if (speechCount == 12) + if (Creature* pAnveena = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ANVEENA))) + pAnveena->CastSpell(me, SPELL_SACRIFICE_OF_ANVEENA, false); + // ChangeTimers(true, 10000); // Kil should do an emote while screaming without attacking for 10 seconds if (speechCount == speechPhaseEnd) TimerIsDeactivated[TIMER_SPEECH]=true; speechCount++; @@ -748,7 +733,7 @@ public: if (pRandomPlayer) DoCast(pRandomPlayer, SPELL_LEGION_LIGHTNING, false); else - TC_LOG_ERROR(LOG_FILTER_TSCR, "try to cast SPELL_LEGION_LIGHTNING on invalid target"); + TC_LOG_ERROR("scripts", "try to cast SPELL_LEGION_LIGHTNING on invalid target"); Timer[TIMER_LEGION_LIGHTNING] = (Phase == PHASE_SACRIFICE) ? 18000 : 30000; // 18 seconds in PHASE_SACRIFICE Timer[TIMER_SOUL_FLAY] = 2500; @@ -769,7 +754,7 @@ public: float sx, sy; sx = ShieldOrbLocations[0][0] + std::sin(ShieldOrbLocations[i][0]); sy = ShieldOrbLocations[0][1] + std::sin(ShieldOrbLocations[i][1]); - me->SummonCreature(CREATURE_SHIELD_ORB, sx, sy, SHIELD_ORB_Z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45000); + me->SummonCreature(NPC_SHIELD_ORB, sx, sy, SHIELD_ORB_Z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45000); } Timer[TIMER_SUMMON_SHILEDORB] = urand(30000, 60000); // 30-60seconds cooldown Timer[TIMER_SOUL_FLAY] = 2000; @@ -814,19 +799,18 @@ public: } break; case TIMER_ORBS_EMPOWER: //Phase 3 - if (instance) - if (Creature* pKalec = Unit::GetCreature(*me, instance->GetData64(DATA_KALECGOS_KJ))) + if (Creature* pKalec = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KALECGOS_KJ))) + { + switch (Phase) { - switch (Phase) - { case PHASE_SACRIFICE: CAST_AI(boss_kalecgos_kj::boss_kalecgos_kjAI, pKalec->AI())->EmpowerOrb(true); break; default: CAST_AI(boss_kalecgos_kj::boss_kalecgos_kjAI, pKalec->AI())->EmpowerOrb(false); break; - } } + } OrbActivated = true; TimerIsDeactivated[TIMER_ORBS_EMPOWER] = true; break; @@ -841,7 +825,7 @@ public: { float x, y, z; target->GetPosition(x, y, z); - me->SummonCreature(CREATURE_ARMAGEDDON_TARGET, x, y, z, 0, TEMPSUMMON_TIMED_DESPAWN, 15000); + me->SummonCreature(NPC_ARMAGEDDON_TARGET, x, y, z, 0, TEMPSUMMON_TIMED_DESPAWN, 15000); } Timer[TIMER_ARMAGEDDON] = 2000; // No, I'm not kidding break; @@ -893,6 +877,11 @@ public: } } }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return GetSunwellPlateauAI<boss_kiljaedenAI>(creature); + } }; //AI for Hand of the Deceiver @@ -901,11 +890,6 @@ class npc_hand_of_the_deceiver : public CreatureScript public: npc_hand_of_the_deceiver() : CreatureScript("npc_hand_of_the_deceiver") { } - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_hand_of_the_deceiverAI(creature); - } - struct npc_hand_of_the_deceiverAI : public ScriptedAI { npc_hand_of_the_deceiverAI(Creature* creature) : ScriptedAI(creature) @@ -923,8 +907,7 @@ public: /// @todo Timers! ShadowBoltVolleyTimer = urand(8000, 14000); // So they don't all cast it in the same moment. FelfirePortalTimer = 20000; - if (instance) - instance->SetData(DATA_KILJAEDEN_EVENT, NOT_STARTED); + instance->SetBossState(DATA_KILJAEDEN, NOT_STARTED); } void JustSummoned(Creature* summoned) OVERRIDE @@ -935,12 +918,10 @@ public: void EnterCombat(Unit* who) OVERRIDE { - if (instance) - { - instance->SetData(DATA_KILJAEDEN_EVENT, IN_PROGRESS); - if (Creature* pControl = Unit::GetCreature(*me, instance->GetData64(DATA_KILJAEDEN_CONTROLLER))) - pControl->AddThreat(who, 1.0f); - } + instance->SetBossState(DATA_KILJAEDEN, IN_PROGRESS); + if (Creature* pControl = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KILJAEDEN_CONTROLLER))) + pControl->AddThreat(who, 1.0f); + me->InterruptNonMeleeSpells(true); } @@ -949,7 +930,7 @@ public: if (!instance) return; - if (Creature* pControl = Unit::GetCreature(*me, instance->GetData64(DATA_KILJAEDEN_CONTROLLER))) + if (Creature* pControl = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KILJAEDEN_CONTROLLER))) ++(CAST_AI(npc_kiljaeden_controller::npc_kiljaeden_controllerAI, pControl->AI())->deceiverDeathCount); } @@ -977,7 +958,7 @@ public: // Felfire Portal - Creatres a portal, that spawns Volatile Felfire Fiends, which do suicide bombing. if (FelfirePortalTimer <= diff) { - if (Creature* pPortal = DoSpawnCreature(CREATURE_FELFIRE_PORTAL, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN, 20000)) + if (Creature* pPortal = DoSpawnCreature(NPC_FELFIRE_PORTAL, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN, 20000)) { ThreatContainer::StorageType const &threatlist = me->getThreatManager().getThreatList(); for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) @@ -993,6 +974,11 @@ public: DoMeleeAttackIfReady(); } }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return GetSunwellPlateauAI<npc_hand_of_the_deceiverAI>(creature); + } }; //AI for Felfire Portal @@ -1034,7 +1020,7 @@ public: if (uiSpawnFiendTimer <= diff) { - if (Creature* pFiend = DoSpawnCreature(CREATURE_VOLATILE_FELFIRE_FIEND, 0, 0, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 20000)) + if (Creature* pFiend = DoSpawnCreature(NPC_VOLATILE_FELFIRE_FIEND, 0, 0, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 20000)) pFiend->AddThreat(SelectTarget(SELECT_TARGET_RANDOM, 0), 100000.0f); uiSpawnFiendTimer = urand(4000, 8000); } else uiSpawnFiendTimer -= diff; @@ -1406,7 +1392,7 @@ public: DoMeleeAttackIfReady(); break; } - TC_LOG_DEBUG(LOG_FILTER_TSCR, "Sinister-Timer"); + TC_LOG_DEBUG("scripts", "Sinister-Timer"); for (uint8 i = 0; i < 3; ++i) uiTimer[i] -= diff; } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp index e36310f85b1..8da162bae14 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp @@ -30,55 +30,56 @@ SDComment: all sounds, black hole effect triggers to often (46228) // Muru & Entropius's spells enum Spells { - SPELL_ENRAGE = 26662, + SPELL_ENRAGE = 26662, // Muru's spells SPELL_NEGATIVE_ENERGY = 46009, //(this trigger 46008) - SPELL_DARKNESS = 45999, - SPELL_OPEN_ALL_PORTALS = 46177, + SPELL_DARKNESS = 45999, + SPELL_OPEN_ALL_PORTALS = 46177, SPELL_OPEN_PORTAL = 45977, - SPELL_OPEN_PORTAL_2 = 45976, - SPELL_SUMMON_BERSERKER = 46037, - SPELL_SUMNON_FURY_MAGE = 46038, - SPELL_SUMMON_VOID_SENTINEL = 45988, - SPELL_SUMMON_ENTROPIUS = 46217, + SPELL_OPEN_PORTAL_2 = 45976, + SPELL_SUMMON_BERSERKER = 46037, + SPELL_SUMNON_FURY_MAGE = 46038, + SPELL_SUMMON_VOID_SENTINEL = 45988, + SPELL_SUMMON_ENTROPIUS = 46217, // Entropius's spells - SPELL_DARKNESS_E = 46269, - SPELL_BLACKHOLE = 46282, - SPELL_NEGATIVE_ENERGY_E = 46284, + SPELL_DARKNESS_E = 46269, + SPELL_BLACKHOLE = 46282, + SPELL_NEGATIVE_ENERGY_E = 46284, SPELL_ENTROPIUS_SPAWN = 46223, // Shadowsword Berserker's spells - SPELL_FLURRY = 46160, - SPELL_DUAL_WIELD = 29651, + SPELL_FLURRY = 46160, + SPELL_DUAL_WIELD = 29651, // Shadowsword Fury Mage's spells - SPELL_FEL_FIREBALL = 46101, - SPELL_SPELL_FURY = 46102, + SPELL_FEL_FIREBALL = 46101, + SPELL_SPELL_FURY = 46102, // Void Sentinel's spells - SPELL_SHADOW_PULSE = 46087, - SPELL_VOID_BLAST = 46161, + SPELL_SHADOW_PULSE = 46087, + SPELL_VOID_BLAST = 46161, // Void Spawn's spells - SPELL_SHADOW_BOLT_VOLLEY = 46082, + SPELL_SHADOW_BOLT_VOLLEY = 46082, //Dark Fiend Spells - SPELL_DARKFIEND_AOE = 45944, - SPELL_DARKFIEND_VISUAL = 45936, - SPELL_DARKFIEND_SKIN = 45934, + SPELL_DARKFIEND_AOE = 45944, + SPELL_DARKFIEND_VISUAL = 45936, + SPELL_DARKFIEND_SKIN = 45934, //Black Hole Spells SPELL_BLACKHOLE_SPAWN = 46242, - SPELL_BLACKHOLE_GROW = 46228 + SPELL_BLACKHOLE_GROW = 46228 }; -enum BossTimers{ - TIMER_DARKNESS = 0, - TIMER_HUMANOIDES = 1, - TIMER_PHASE = 2, - TIMER_SENTINEL = 3 +enum BossTimers +{ + TIMER_DARKNESS = 0, + TIMER_HUMANOIDES = 1, + TIMER_PHASE = 2, + TIMER_SENTINEL = 3 }; float DarkFiends[8][4] = @@ -88,32 +89,28 @@ float DarkFiends[8][4] = {1801.98f, 633.62f, 69.74f, 5.71f}, {1830.88f, 629.99f, 69.73f, 3.52f}, {1800.38f, 621.41f, 69.74f, 0.22f}, - {1808.3f, 612.45f, 69.73f, 1.02f}, - {1823.9f, 639.69f, 69.74f, 4.12f}, + {1808.3f, 612.45f, 69.73f, 1.02f}, + {1823.9f, 639.69f, 69.74f, 4.12f}, {1811.85f, 640.46f, 69.73f, 4.97f} }; float Humanoides[6][5] = { - {CREATURE_FURY_MAGE, 1780.16f, 666.83f, 71.19f, 5.21f}, - {CREATURE_FURY_MAGE, 1847.93f, 600.30f, 71.30f, 2.57f}, - {CREATURE_BERSERKER, 1779.97f, 660.64f, 71.19f, 5.28f}, - {CREATURE_BERSERKER, 1786.2f, 661.01f, 71.19f, 4.51f}, - {CREATURE_BERSERKER, 1845.17f, 602.63f, 71.28f, 2.43f}, - {CREATURE_BERSERKER, 1842.91f, 599.93f, 71.23f, 2.44f} + {NPC_FURY_MAGE, 1780.16f, 666.83f, 71.19f, 5.21f}, + {NPC_FURY_MAGE, 1847.93f, 600.30f, 71.30f, 2.57f}, + {NPC_BERSERKER, 1779.97f, 660.64f, 71.19f, 5.28f}, + {NPC_BERSERKER, 1786.2f, 661.01f, 71.19f, 4.51f}, + {NPC_BERSERKER, 1845.17f, 602.63f, 71.28f, 2.43f}, + {NPC_BERSERKER, 1842.91f, 599.93f, 71.23f, 2.44f} }; uint32 EnrageTimer = 600000; + class boss_entropius : public CreatureScript { public: boss_entropius() : CreatureScript("boss_entropius") { } - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new boss_entropiusAI(creature); - } - struct boss_entropiusAI : public ScriptedAI { boss_entropiusAI(Creature* creature) : ScriptedAI(creature), Summons(me) @@ -133,8 +130,7 @@ public: Summons.DespawnAll(); - if (instance) - instance->SetData(DATA_MURU_EVENT, NOT_STARTED); + instance->SetBossState(DATA_MURU, NOT_STARTED); } void EnterCombat(Unit* /*who*/) OVERRIDE @@ -142,22 +138,21 @@ public: DoCastAOE(SPELL_NEGATIVE_ENERGY_E, true); DoCast(me, SPELL_ENTROPIUS_SPAWN, false); - if (instance) - instance->SetData(DATA_MURU_EVENT, IN_PROGRESS); + instance->SetBossState(DATA_MURU, IN_PROGRESS); } void JustSummoned(Creature* summoned) OVERRIDE { switch (summoned->GetEntry()) { - case CREATURE_DARK_FIENDS: + case NPC_DARK_FIENDS: summoned->CastSpell(summoned, SPELL_DARKFIEND_VISUAL, false); break; - case CREATURE_DARKNESS: + case NPC_DARKNESS: summoned->AddUnitState(UNIT_STATE_STUNNED); float x, y, z, o; summoned->GetHomePosition(x, y, z, o); - me->SummonCreature(CREATURE_DARK_FIENDS, x, y, z, o, TEMPSUMMON_CORPSE_DESPAWN, 0); + me->SummonCreature(NPC_DARK_FIENDS, x, y, z, o, TEMPSUMMON_CORPSE_DESPAWN, 0); break; } summoned->AI()->AttackStart(SelectTarget(SELECT_TARGET_RANDOM, 0, 50, true)); @@ -167,9 +162,7 @@ public: void JustDied(Unit* /*killer*/) OVERRIDE { Summons.DespawnAll(); - - if (instance) - instance->SetData(DATA_MURU_EVENT, DONE); + instance->SetBossState(DATA_MURU, DONE); } void UpdateAI(uint32 diff) OVERRIDE @@ -201,6 +194,11 @@ public: DoMeleeAttackIfReady(); } }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return GetSunwellPlateauAI<boss_entropiusAI>(creature); + } }; class boss_muru : public CreatureScript @@ -208,11 +206,6 @@ class boss_muru : public CreatureScript public: boss_muru() : CreatureScript("boss_muru") { } - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new boss_muruAI(creature); - } - struct boss_muruAI : public ScriptedAI { boss_muruAI(Creature* creature) : ScriptedAI(creature), Summons(creature) @@ -244,17 +237,13 @@ public: me->SetVisible(true); Summons.DespawnAll(); - - if (instance) - instance->SetData(DATA_MURU_EVENT, NOT_STARTED); + instance->SetBossState(DATA_MURU, NOT_STARTED); } void EnterCombat(Unit* /*who*/) OVERRIDE { DoCastAOE(SPELL_NEGATIVE_ENERGY, false); - - if (instance) - instance->SetData(DATA_MURU_EVENT, IN_PROGRESS); + instance->SetBossState(DATA_MURU, IN_PROGRESS); } void DamageTaken(Unit* /*done_by*/, uint32 &damage) OVERRIDE @@ -275,10 +264,10 @@ public: { switch (summoned->GetEntry()) { - case BOSS_ENTROPIUS: + case NPC_ENTROPIUS: me->SetVisible(false); break; - case CREATURE_DARK_FIENDS: + case NPC_DARK_FIENDS: summoned->CastSpell(summoned, SPELL_DARKFIEND_VISUAL, false); break; } @@ -295,9 +284,7 @@ public: { if (Timer[TIMER_PHASE] <= diff) { - if (!instance) - return; - switch (instance->GetData(DATA_MURU_EVENT)) + switch (instance->GetBossState(DATA_MURU)) { case NOT_STARTED: Reset(); @@ -306,6 +293,8 @@ public: Phase = 4; me->DisappearAndDie(); break; + default: + break; } Timer[TIMER_PHASE] = 3000; } else Timer[TIMER_PHASE] -= diff; @@ -334,7 +323,7 @@ public: { DarkFiend = false; for (uint8 j = 0; j < 8; ++j) - me->SummonCreature(CREATURE_DARK_FIENDS, DarkFiends[j][0], DarkFiends[j][1], DarkFiends[j][2], DarkFiends[j][3], TEMPSUMMON_CORPSE_DESPAWN, 0); + me->SummonCreature(NPC_DARK_FIENDS, DarkFiends[j][0], DarkFiends[j][1], DarkFiends[j][2], DarkFiends[j][3], TEMPSUMMON_CORPSE_DESPAWN, 0); Timer[TIMER_DARKNESS] = 42000; } break; @@ -358,14 +347,21 @@ public: } } - //Timer + // Timer for (uint8 i = 0; i < 4; ++i) { - if (i != TIMER_PHASE)Timer[i] -= diff; - else if (Phase == 2) Timer[i] -= diff; + if (i != TIMER_PHASE) + Timer[i] -= diff; + else if (Phase == 2) + Timer[i] -= diff; } } }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return GetSunwellPlateauAI<boss_muruAI>(creature); + } }; class npc_muru_portal : public CreatureScript @@ -438,7 +434,7 @@ public: { if (!SummonSentinel) { - if (InAction && instance && instance->GetData(DATA_MURU_EVENT) == NOT_STARTED) + if (InAction && instance && instance->GetBossState(DATA_MURU) == NOT_STARTED) Reset(); return; } @@ -525,7 +521,7 @@ public: struct npc_void_sentinelAI : public ScriptedAI { - npc_void_sentinelAI(Creature* creature) : ScriptedAI(creature){ } + npc_void_sentinelAI(Creature* creature) : ScriptedAI(creature) { } uint32 PulseTimer; uint32 VoidBlastTimer; @@ -543,7 +539,7 @@ public: void JustDied(Unit* /*killer*/) OVERRIDE { for (uint8 i = 0; i < 8; ++i) - me->SummonCreature(CREATURE_VOID_SPAWN, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), float(rand()%6), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 180000); + me->SummonCreature(NPC_VOID_SPAWN, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), float(rand()%6), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 180000); } void UpdateAI(uint32 diff) OVERRIDE diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp index 8a7944464a1..4bc42921402 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp @@ -1,6 +1,5 @@ /* * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> - * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -16,19 +15,10 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* ScriptData -SDName: Instance_Sunwell_Plateau -SD%Complete: 25 -SDComment: VERIFY SCRIPT -SDCategory: Sunwell_Plateau -EndScriptData */ - #include "ScriptMgr.h" #include "InstanceScript.h" -#include "sunwell_plateau.h" #include "Player.h" - -#define MAX_ENCOUNTER 6 +#include "sunwell_plateau.h" /* Sunwell Plateau: 0 - Kalecgos and Sathrovarr @@ -39,268 +29,256 @@ EndScriptData */ 5 - Kil'Jaeden */ -class instance_sunwell_plateau : public InstanceMapScript +DoorData const doorData[] = { -public: - instance_sunwell_plateau() : InstanceMapScript("instance_sunwell_plateau", 580) { } - - InstanceScript* GetInstanceScript(InstanceMap* map) const OVERRIDE - { - return new instance_sunwell_plateau_InstanceMapScript(map); - } - - struct instance_sunwell_plateau_InstanceMapScript : public InstanceScript - { - instance_sunwell_plateau_InstanceMapScript(Map* map) : InstanceScript(map) { } - - uint32 m_auiEncounter[MAX_ENCOUNTER]; - - /** Creatures **/ - uint64 Kalecgos_Dragon; - uint64 Kalecgos_Human; - uint64 Sathrovarr; - uint64 Brutallus; - uint64 Madrigosa; - uint64 Felmyst; - uint64 Alythess; - uint64 Sacrolash; - uint64 Muru; - uint64 KilJaeden; - uint64 KilJaedenController; - uint64 Anveena; - uint64 KalecgosKJ; - uint32 SpectralPlayers; - - /** GameObjects **/ - uint64 ForceField; // Kalecgos Encounter - uint64 KalecgosWall[2]; - uint64 FireBarrier; // Felmysts Encounter - uint64 MurusGate[2]; // Murus Encounter + { GO_FIRE_BARRIER, DATA_FELMYST, DOOR_TYPE_PASSAGE, BOUNDARY_NONE }, + { GO_MURUS_GATE_1, DATA_MURU, DOOR_TYPE_ROOM, BOUNDARY_NONE }, + { GO_MURUS_GATE_2, DATA_MURU, DOOR_TYPE_PASSAGE, BOUNDARY_NONE }, + { GO_BOSS_COLLISION_1, DATA_KALECGOS, DOOR_TYPE_ROOM, BOUNDARY_NONE }, + { GO_BOSS_COLLISION_2, DATA_KALECGOS, DOOR_TYPE_ROOM, BOUNDARY_NONE }, + { GO_FORCE_FIELD, DATA_KALECGOS, DOOR_TYPE_ROOM, BOUNDARY_NONE }, + { 0, 0, DOOR_TYPE_ROOM, BOUNDARY_NONE } // END +}; - /*** Misc ***/ - uint32 SpectralRealmTimer; - std::vector<uint64> SpectralRealmList; +class instance_sunwell_plateau : public InstanceMapScript +{ + public: + instance_sunwell_plateau() : InstanceMapScript(SunwellPlateauScriptName, 580) { } - void Initialize() OVERRIDE + struct instance_sunwell_plateau_InstanceMapScript : public InstanceScript { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - - /*** Creatures ***/ - Kalecgos_Dragon = 0; - Kalecgos_Human = 0; - Sathrovarr = 0; - Brutallus = 0; - Madrigosa = 0; - Felmyst = 0; - Alythess = 0; - Sacrolash = 0; - Muru = 0; - KilJaeden = 0; - KilJaedenController = 0; - Anveena = 0; - KalecgosKJ = 0; - SpectralPlayers = 0; + instance_sunwell_plateau_InstanceMapScript(Map* map) : InstanceScript(map) + { + SetBossNumber(EncounterCount); + LoadDoorData(doorData); - /*** GameObjects ***/ - ForceField = 0; - FireBarrier = 0; - MurusGate[0] = 0; - MurusGate[1] = 0; - KalecgosWall[0] = 0; - KalecgosWall[1] = 0; + KalecgosDragonGUID = 0; + KalecgosHumanGUID = 0; + SathrovarrGUID = 0; + BrutallusGUID = 0; + MadrigosaGUID = 0; + FelmystGUID = 0; + AlythessGUID = 0; + SacrolashGUID = 0; + MuruGUID = 0; + KilJaedenGUID = 0; + KilJaedenControllerGUID = 0; + AnveenaGUID = 0; + KalecgosKjGUID = 0; + SpectralPlayers = 0; - /*** Misc ***/ - SpectralRealmTimer = 5000; - } + SpectralRealmTimer = 5000; + } - bool IsEncounterInProgress() const OVERRIDE - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - return true; + Player const* GetPlayerInMap() const + { + Map::PlayerList const& players = instance->GetPlayers(); - return false; - } + if (!players.isEmpty()) + { + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + Player* player = itr->GetSource(); + if (player && !player->HasAura(45839, 0)) + return player; + } + } + else + TC_LOG_DEBUG("scripts", "Instance Sunwell Plateau: GetPlayerInMap, but PlayerList is empty!"); - Player const* GetPlayerInMap() const - { - Map::PlayerList const& players = instance->GetPlayers(); + return NULL; + } - if (!players.isEmpty()) + void OnCreatureCreate(Creature* creature) OVERRIDE { - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + switch (creature->GetEntry()) { - Player* player = itr->GetSource(); - if (player && !player->HasAura(45839, 0)) - return player; + case NPC_KALECGOS: + KalecgosDragonGUID = creature->GetGUID(); + break; + case NPC_KALEC: + KalecgosHumanGUID = creature->GetGUID(); + break; + case NPC_SATHROVARR: + SathrovarrGUID = creature->GetGUID(); + break; + case NPC_BRUTALLUS: + BrutallusGUID = creature->GetGUID(); + break; + case NPC_MADRIGOSA: + MadrigosaGUID = creature->GetGUID(); + break; + case NPC_FELMYST: + FelmystGUID = creature->GetGUID(); + break; + case NPC_GRAND_WARLOCK_ALYTHESS: + AlythessGUID = creature->GetGUID(); + break; + case NPC_LADY_SACROLASH: + SacrolashGUID = creature->GetGUID(); + break; + case NPC_MURU: + MuruGUID = creature->GetGUID(); + break; + case NPC_KILJAEDEN: + KilJaedenGUID = creature->GetGUID(); + break; + case NPC_KILJAEDEN_CONTROLLER: + KilJaedenControllerGUID = creature->GetGUID(); + break; + case NPC_ANVEENA: + AnveenaGUID = creature->GetGUID(); + break; + case NPC_KALECGOS_KJ: + KalecgosKjGUID = creature->GetGUID(); + break; + default: + break; } } - else - TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance Sunwell Plateau: GetPlayerInMap, but PlayerList is empty!"); - - return NULL; - } - void OnCreatureCreate(Creature* creature) OVERRIDE - { - switch (creature->GetEntry()) + void OnGameObjectCreate(GameObject* go) OVERRIDE { - case 24850: Kalecgos_Dragon = creature->GetGUID(); break; - case 24891: Kalecgos_Human = creature->GetGUID(); break; - case 24892: Sathrovarr = creature->GetGUID(); break; - case 24882: Brutallus = creature->GetGUID(); break; - case 24895: Madrigosa = creature->GetGUID(); break; - case 25038: Felmyst = creature->GetGUID(); break; - case 25166: Alythess = creature->GetGUID(); break; - case 25165: Sacrolash = creature->GetGUID(); break; - case 25741: Muru = creature->GetGUID(); break; - case 25315: KilJaeden = creature->GetGUID(); break; - case 25608: KilJaedenController = creature->GetGUID(); break; - case 26046: Anveena = creature->GetGUID(); break; - case 25319: KalecgosKJ = creature->GetGUID(); break; + switch (go->GetEntry()) + { + case GO_FORCE_FIELD: + case GO_BOSS_COLLISION_1: + case GO_BOSS_COLLISION_2: + case GO_FIRE_BARRIER: + case GO_MURUS_GATE_1: + case GO_MURUS_GATE_2: + AddDoor(go, true); + break; + default: + break; + } } - } - void OnGameObjectCreate(GameObject* go) OVERRIDE - { - switch (go->GetEntry()) + void OnGameObjectRemove(GameObject* go) OVERRIDE { - case 188421: ForceField = go->GetGUID(); break; - case 188523: KalecgosWall[0] = go->GetGUID(); break; - case 188524: KalecgosWall[0] = go->GetGUID(); break; - case 188075: - if (m_auiEncounter[2] == DONE) - HandleGameObject(0, true, go); - FireBarrier = go->GetGUID(); - break; - case 187990: MurusGate[0] = go->GetGUID(); break; - case 188118: - if (m_auiEncounter[4] == DONE) - HandleGameObject(0, true, go); - MurusGate[1]= go->GetGUID(); - break; + switch (go->GetEntry()) + { + case GO_FIRE_BARRIER: + case GO_MURUS_GATE_1: + case GO_MURUS_GATE_2: + case GO_BOSS_COLLISION_1: + case GO_BOSS_COLLISION_2: + case GO_FORCE_FIELD: + AddDoor(go, false); + break; + default: + break; + } } - } - uint32 GetData(uint32 id) const OVERRIDE - { - switch (id) + uint64 GetData64(uint32 id) const OVERRIDE { - case DATA_KALECGOS_EVENT: return m_auiEncounter[0]; - case DATA_BRUTALLUS_EVENT: return m_auiEncounter[1]; - case DATA_FELMYST_EVENT: return m_auiEncounter[2]; - case DATA_EREDAR_TWINS_EVENT: return m_auiEncounter[3]; - case DATA_MURU_EVENT: return m_auiEncounter[4]; - case DATA_KILJAEDEN_EVENT: return m_auiEncounter[5]; + switch (id) + { + case DATA_KALECGOS_DRAGON: + return KalecgosDragonGUID; + case DATA_KALECGOS_HUMAN: + return KalecgosHumanGUID; + case DATA_SATHROVARR: + return SathrovarrGUID; + case DATA_BRUTALLUS: + return BrutallusGUID; + case DATA_MADRIGOSA: + return MadrigosaGUID; + case DATA_FELMYST: + return FelmystGUID; + case DATA_ALYTHESS: + return AlythessGUID; + case DATA_SACROLASH: + return SacrolashGUID; + case DATA_MURU: + return MuruGUID; + case DATA_KILJAEDEN: + return KilJaedenGUID; + case DATA_KILJAEDEN_CONTROLLER: + return KilJaedenControllerGUID; + case DATA_ANVEENA: + return AnveenaGUID; + case DATA_KALECGOS_KJ: + return KalecgosKjGUID; + case DATA_PLAYER_GUID: + { + Player const* target = GetPlayerInMap(); + return target ? target->GetGUID() : 0; + } + default: + break; + } + return 0; } - return 0; - } - uint64 GetData64(uint32 id) const OVERRIDE - { - switch (id) + std::string GetSaveData() OVERRIDE { - case DATA_KALECGOS_DRAGON: return Kalecgos_Dragon; - case DATA_KALECGOS_HUMAN: return Kalecgos_Human; - case DATA_SATHROVARR: return Sathrovarr; - case DATA_GO_FORCEFIELD: return ForceField; - case DATA_BRUTALLUS: return Brutallus; - case DATA_MADRIGOSA: return Madrigosa; - case DATA_FELMYST: return Felmyst; - case DATA_ALYTHESS: return Alythess; - case DATA_SACROLASH: return Sacrolash; - case DATA_MURU: return Muru; - case DATA_KILJAEDEN: return KilJaeden; - case DATA_KILJAEDEN_CONTROLLER: return KilJaedenController; - case DATA_ANVEENA: return Anveena; - case DATA_KALECGOS_KJ: return KalecgosKJ; - case DATA_PLAYER_GUID: - Player const* target = GetPlayerInMap(); - return target ? target->GetGUID() : 0; + OUT_SAVE_INST_DATA; + + std::ostringstream saveStream; + saveStream << "S P " << GetBossSaveData(); + + OUT_SAVE_INST_DATA_COMPLETE; + return saveStream.str(); } - return 0; - } - void SetData(uint32 id, uint32 data) OVERRIDE - { - switch (id) + void Load(char const* str) OVERRIDE { - case DATA_KALECGOS_EVENT: - { - if (data == NOT_STARTED || data == DONE) - { - HandleGameObject(ForceField, true); - HandleGameObject(KalecgosWall[0], true); - HandleGameObject(KalecgosWall[1], true); - } - else if (data == IN_PROGRESS) - { - HandleGameObject(ForceField, false); - HandleGameObject(KalecgosWall[0], false); - HandleGameObject(KalecgosWall[1], false); - } - m_auiEncounter[0] = data; - } - break; - case DATA_BRUTALLUS_EVENT: m_auiEncounter[1] = data; break; - case DATA_FELMYST_EVENT: - if (data == DONE) - HandleGameObject(FireBarrier, true); - m_auiEncounter[2] = data; break; - case DATA_EREDAR_TWINS_EVENT: m_auiEncounter[3] = data; break; - case DATA_MURU_EVENT: - switch (data) + if (!str) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(str); + + char dataHead1, dataHead2; + + std::istringstream loadStream(str); + loadStream >> dataHead1 >> dataHead2; + + if (dataHead1 == 'S' && dataHead2 == 'P') + { + for (uint32 i = 0; i < EncounterCount; ++i) { - case DONE: - HandleGameObject(MurusGate[0], true); - HandleGameObject(MurusGate[1], true); - break; - case IN_PROGRESS: - HandleGameObject(MurusGate[0], false); - HandleGameObject(MurusGate[1], false); - break; - case NOT_STARTED: - HandleGameObject(MurusGate[0], true); - HandleGameObject(MurusGate[1], false); - break; + uint32 tmpState; + loadStream >> tmpState; + if (tmpState == IN_PROGRESS || tmpState > SPECIAL) + tmpState = NOT_STARTED; + SetBossState(i, EncounterState(tmpState)); } - m_auiEncounter[4] = data; break; - case DATA_KILJAEDEN_EVENT: m_auiEncounter[5] = data; break; - } + } + else + OUT_LOAD_INST_DATA_FAIL; - if (data == DONE) - SaveToDB(); - } + OUT_LOAD_INST_DATA_COMPLETE; + } - std::string GetSaveData() OVERRIDE - { - OUT_SAVE_INST_DATA; - std::ostringstream stream; - stream << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' ' << m_auiEncounter[3] << ' ' - << m_auiEncounter[4] << ' ' << m_auiEncounter[5]; + protected: + uint64 KalecgosDragonGUID; + uint64 KalecgosHumanGUID; + uint64 SathrovarrGUID; + uint64 BrutallusGUID; + uint64 MadrigosaGUID; + uint64 FelmystGUID; + uint64 AlythessGUID; + uint64 SacrolashGUID; + uint64 MuruGUID; + uint64 KilJaedenGUID; + uint64 KilJaedenControllerGUID; + uint64 AnveenaGUID; + uint64 KalecgosKjGUID; + uint32 SpectralPlayers; - OUT_SAVE_INST_DATA_COMPLETE; - return stream.str(); - } + uint32 SpectralRealmTimer; + std::vector<uint64> SpectralRealmList; + }; - void Load(char const* in) OVERRIDE + InstanceScript* GetInstanceScript(InstanceMap* map) const OVERRIDE { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } - - OUT_LOAD_INST_DATA(in); - std::istringstream stream(in); - stream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3] - >> m_auiEncounter[4] >> m_auiEncounter[5]; - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) // Do not load an encounter as "In Progress" - reset it instead. - m_auiEncounter[i] = NOT_STARTED; - OUT_LOAD_INST_DATA_COMPLETE; + return new instance_sunwell_plateau_InstanceMapScript(map); } - }; }; void AddSC_instance_sunwell_plateau() diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.h b/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.h index 343720dbdb1..d2025a7b2b9 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.h +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.h @@ -1,6 +1,5 @@ /* * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> - * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -16,94 +15,105 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef DEF_SUNWELLPLATEAU_H -#define DEF_SUNWELLPLATEAU_H +#ifndef SUNWELL_PLATEAU_H +#define SUNWELL_PLATEAU_H -/*** Encounters ***/ -enum Data -{ - DATA_KALECGOS_EVENT, - DATA_BRUTALLUS_EVENT, - DATA_FELMYST_EVENT, - DATA_EREDAR_TWINS_EVENT, - DATA_MURU_EVENT, - DATA_KILJAEDEN_EVENT, -}; +#define SunwellPlateauScriptName "instance_sunwell_plateau" + +uint32 const EncounterCount = 6; -enum Data64 +enum DataTypes { - /*** Creatures ***/ + // Encounter States/Boss GUIDs + DATA_KALECGOS = 0, + DATA_BRUTALLUS = 1, + DATA_FELMYST = 2, + DATA_EREDAR_TWINS = 3, + DATA_MURU = 4, + DATA_KILJAEDEN = 5, + DATA_KALECGOS_DRAGON, DATA_KALECGOS_HUMAN, DATA_SATHROVARR, - DATA_BRUTALLUS, DATA_MADRIGOSA, - DATA_FELMYST, DATA_ALYTHESS, DATA_SACROLASH, - DATA_MURU, - DATA_KILJAEDEN, DATA_KILJAEDEN_CONTROLLER, DATA_ANVEENA, DATA_KALECGOS_KJ, - /*** GameObjects ***/ - DATA_GO_FORCEFIELD, + // GameObject GUIDs DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_1, DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_2, DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_3, DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_4, - /*** Misc ***/ - DATA_PLAYER_GUID, + // Misc + DATA_PLAYER_GUID }; -enum Creatures +enum CreatureIds { - BOSS_MURU = 25741, - BOSS_ENTROPIUS = 25840, - NPC_KALECGOS = 24850, - NPC_KALEC = 24891, - NPC_SATHROVARR = 24892, + NPC_MURU = 25741, + NPC_ENTROPIUS = 25840, + NPC_KALECGOS = 24850, + NPC_KALEC = 24891, + NPC_SATHROVARR = 24892, + NPC_BRUTALLUS = 24882, + NPC_MADRIGOSA = 24895, + NPC_FELMYST = 25038, - NPC_DEAD = 25268, - NPC_FLIGHT_LEFT = 25357, - NPC_FLIGHT_RIGHT = 25358, - NPC_DEATH_CLOUD = 25703, - NPC_VAPOR = 25265, - NPC_VAPOR_TRAIL = 25267, + NPC_DEAD = 25268, + NPC_FLIGHT_LEFT = 25357, + NPC_FLIGHT_RIGHT = 25358, + NPC_DEATH_CLOUD = 25703, + NPC_VAPOR = 25265, + NPC_VAPOR_TRAIL = 25267, - NPC_GRAND_WARLOCK_ALYTHESS = 25166, - NPC_SHADOW_IMAGE = 25214, - NPC_LADY_SACROLASH = 25165, + NPC_GRAND_WARLOCK_ALYTHESS = 25166, + NPC_SHADOW_IMAGE = 25214, + NPC_LADY_SACROLASH = 25165, - CREATURE_ANVEENA = 26046, // Embodiment of the Sunwell - CREATURE_KALECGOS = 25319, // Helps the raid throughout the fight - CREATURE_PROPHET = 26246, // Outro - CREATURE_KILJAEDEN = 25315, // Give it to 'em KJ! - CREATURE_HAND_OF_THE_DECEIVER = 25588, // Adds found before KJ emerges - CREATURE_FELFIRE_PORTAL = 25603, // Portal spawned be Hand of the Deceivers - CREATURE_VOLATILE_FELFIRE_FIEND = 25598, // Fiends spawned by the above portal - CREATURE_ARMAGEDDON_TARGET = 25735, // This mob casts meteor on itself.. I think - CREATURE_SHIELD_ORB = 25502, // Shield orbs circle the room raining shadow bolts on raid - CREATURE_THE_CORE_OF_ENTROPIUS = 26262, // Used in the ending cinematic? - CREATURE_POWER_OF_THE_BLUE_DRAGONFLIGHT = 25653, // NPC that players possess when using the Orb of the Blue Dragonflight - CREATURE_SPIKE_TARGET1 = 30598, // Should summon these under Shadow Spike Channel on targets place - CREATURE_SPIKE_TARGET2 = 30614, - CREATURE_SINISTER_REFLECTION = 25708, // Sinister Relection spawnd on Phase swichtes + NPC_ANVEENA = 26046, // Embodiment of the Sunwell + NPC_KALECGOS_KJ = 25319, // Helps the raid throughout the fight + NPC_PROPHET = 26246, // Outro + NPC_KILJAEDEN = 25315, // Give it to 'em KJ! + NPC_KILJAEDEN_CONTROLLER = 25608, + NPC_HAND_OF_THE_DECEIVER = 25588, // Adds found before KJ emerges + NPC_FELFIRE_PORTAL = 25603, // Portal spawned be Hand of the Deceivers + NPC_VOLATILE_FELFIRE_FIEND = 25598, // Fiends spawned by the above portal + NPC_ARMAGEDDON_TARGET = 25735, // This mob casts meteor on itself.. I think + NPC_SHIELD_ORB = 25502, // Shield orbs circle the room raining shadow bolts on raid + NPC_THE_CORE_OF_ENTROPIUS = 26262, // Used in the ending cinematic? + NPC_POWER_OF_THE_BLUE_DRAGONFLIGHT = 25653, // NPC that players possess when using the Orb of the Blue Dragonflight + NPC_SPIKE_TARGET1 = 30598, // Should summon these under Shadow Spike Channel on targets place + NPC_SPIKE_TARGET2 = 30614, + NPC_SINISTER_REFLECTION = 25708, // Sinister Relection spawnd on Phase swichtes - CREATURE_DARKNESS = 25879, - CREATURE_DARK_FIENDS = 25744, - CREATURE_BERSERKER = 25798, - CREATURE_FURY_MAGE = 25799, - CREATURE_VOID_SENTINEL = 25772, - CREATURE_VOID_SPAWN = 25824, - CREATURE_BLACK_HOLE = 25855, + NPC_DARKNESS = 25879, + NPC_DARK_FIENDS = 25744, + NPC_BERSERKER = 25798, + NPC_FURY_MAGE = 25799, + NPC_VOID_SENTINEL = 25772, + NPC_VOID_SPAWN = 25824, + NPC_BLACK_HOLE = 25855 }; -enum GameObjects +enum GameObjectIds { - GAMEOBJECT_ORB_OF_THE_BLUE_DRAGONFLIGHT = 188415, + GO_ORB_OF_THE_BLUE_DRAGONFLIGHT = 188415, + GO_FORCE_FIELD = 188421, + GO_BOSS_COLLISION_1 = 188523, + GO_BOSS_COLLISION_2 = 188524, + GO_FIRE_BARRIER = 188075, + GO_MURUS_GATE_1 = 187990, + GO_MURUS_GATE_2 = 188118 }; -#endif +template<class AI> +AI* GetSunwellPlateauAI(Creature* creature) +{ + return GetInstanceAI<AI>(creature, SunwellPlateauScriptName); +} + +#endif // SUNWELL_PLATEAU_H diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp index 72b71bb045d..526daaffee1 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp @@ -261,11 +261,14 @@ class boss_akilzon : public CreatureScript DoCast(target, SPELL_ELECTRICAL_STORM, false); // storm cyclon + visual float x, y, z; target->GetPosition(x, y, z); + /// @todo: fix it in correct way, that causes player to can fly until logout + /* if (target) { target->SetDisableGravity(true); target->MonsterMoveWithSpeed(x, y, me->GetPositionZ()+15, 0); } + */ Unit* Cloud = me->SummonTrigger(x, y, me->GetPositionZ()+16, 0, 15000); if (Cloud) diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp index 8ed866d7f08..e429f27aa48 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp @@ -252,7 +252,7 @@ class boss_janalai : public CreatureScript cell.Visit(pair, cSearcher, *me->GetMap(), *me, me->GetGridActivationRange()); } - //TC_LOG_ERROR(LOG_FILTER_TSCR, "Eggs %d at middle", templist.size()); + //TC_LOG_ERROR("scripts", "Eggs %d at middle", templist.size()); if (templist.empty()) return false; @@ -539,7 +539,7 @@ class npc_janalai_hatcher : public CreatureScript cell.Visit(pair, cSearcher, *(me->GetMap()), *me, me->GetGridActivationRange()); } - //TC_LOG_ERROR(LOG_FILTER_TSCR, "Eggs %d at %d", templist.size(), side); + //TC_LOG_ERROR("scripts", "Eggs %d at %d", templist.size(), side); for (std::list<Creature*>::const_iterator i = templist.begin(); i != templist.end() && num > 0; ++i) if ((*i)->GetDisplayId() != 11686) diff --git a/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp index 4d567dbca32..854679339c3 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp @@ -218,17 +218,17 @@ class instance_zulaman : public InstanceMapScript return; std::istringstream ss(load); - //TC_LOG_ERROR(LOG_FILTER_TSCR, "Zul'aman loaded, %s.", ss.str().c_str()); + //TC_LOG_ERROR("scripts", "Zul'aman loaded, %s.", ss.str().c_str()); char dataHead; // S uint16 data1, data2, data3; ss >> dataHead >> data1 >> data2 >> data3; - //TC_LOG_ERROR(LOG_FILTER_TSCR, "Zul'aman loaded, %d %d %d.", data1, data2, data3); + //TC_LOG_ERROR("scripts", "Zul'aman loaded, %d %d %d.", data1, data2, data3); if (dataHead == 'S') { BossKilled = data1; ChestLooted = data2; QuestMinute = data3; - } else TC_LOG_ERROR(LOG_FILTER_TSCR, "Zul'aman: corrupted save data."); + } else TC_LOG_ERROR("scripts", "Zul'aman: corrupted save data."); } void SetData(uint32 type, uint32 data) OVERRIDE diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp index 886e000c093..4a37f3cf597 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp @@ -258,7 +258,7 @@ class npc_shade_of_jindo : public CreatureScript DoCast(me, SPELL_INVISIBLE, true); } - void EnterCombat(Unit* /*who*/)OVERRIDE { } + void EnterCombat(Unit* /*who*/) OVERRIDE { } void UpdateAI(uint32 diff) OVERRIDE { diff --git a/src/server/scripts/EasternKingdoms/zone_eversong_woods.cpp b/src/server/scripts/EasternKingdoms/zone_eversong_woods.cpp index aa41ee7adbb..6bc9aab3d6f 100644 --- a/src/server/scripts/EasternKingdoms/zone_eversong_woods.cpp +++ b/src/server/scripts/EasternKingdoms/zone_eversong_woods.cpp @@ -18,8 +18,8 @@ /* ScriptData SDName: Eversong_Woods -SD%Complete: 100 -SDComment: Quest support: 8488, 8490 +SD%Complete: 95 +SDComment: Quest support: 8487, 8488, 8490 SDCategory: Eversong Woods EndScriptData */ @@ -37,11 +37,29 @@ EndContentData */ enum UnexpectedResults { // Quest + QUEST_CORRUPTED_SOIL = 8487, QUEST_UNEXPECTED_RESULT = 8488, // Creatures - NPC_GHARZUL = 15958, - NPC_ANGERSHADE = 15656 + NPC_GHARZUL = 15958, // Quest 8488 + NPC_ANGERSHADE = 15656, // Quest 8488 + + // Factions + FACTION_NORMAL = 1604, // Quest 8488 + FACTION_COMBAT = 232, // Quest 8488 + + // Spells + SPELL_TEST_SOIL = 29535, // Quest 8487 + SPELL_FIREBALL = 20811, // Quest 8488 + + // Text + SAY_TEST_SOIL = 0, // Quest 8487 + + // Events + EVENT_TALK = 1, // Quest 8487 + EVENT_ADD_QUEST_GIVER_FLAG = 2, // Quest 8487 + EVENT_SUMMON = 3, // Quest 8488 + EVENT_FIREBALL = 4 // Quest 8488 }; class npc_apprentice_mirveda : public CreatureScript @@ -49,47 +67,57 @@ class npc_apprentice_mirveda : public CreatureScript public: npc_apprentice_mirveda() : CreatureScript("npc_apprentice_mirveda") { } - bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) OVERRIDE - { - if (quest->GetQuestId() == QUEST_UNEXPECTED_RESULT) - { - CAST_AI(npc_apprentice_mirveda::npc_apprentice_mirvedaAI, creature->AI())->Summon = true; - CAST_AI(npc_apprentice_mirveda::npc_apprentice_mirvedaAI, creature->AI())->PlayerGUID = player->GetGUID(); - } - return true; - } - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_apprentice_mirvedaAI(creature); - } - struct npc_apprentice_mirvedaAI : public ScriptedAI { npc_apprentice_mirvedaAI(Creature* creature) : ScriptedAI(creature), Summons(me) { } uint32 KillCount; uint64 PlayerGUID; - bool Summon; SummonList Summons; + EventMap events; void Reset() OVERRIDE { + SetCombatMovement(false); KillCount = 0; PlayerGUID = 0; Summons.DespawnAll(); - Summon = false; } - void EnterCombat(Unit* /*who*/)OVERRIDE { } + void sQuestReward(Player* /*player*/, Quest const* quest, uint32 /*opt*/) OVERRIDE + { + if (quest->GetQuestId() == QUEST_CORRUPTED_SOIL) + { + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); + events.ScheduleEvent(EVENT_TALK, 2000); + } + } + + void sQuestAccept(Player* player, Quest const* quest) OVERRIDE + { + if (quest->GetQuestId() == QUEST_UNEXPECTED_RESULT) + { + me->setFaction(FACTION_COMBAT); + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); + events.ScheduleEvent(EVENT_SUMMON, 1000); + PlayerGUID = player->GetGUID(); + } + } + + void EnterCombat(Unit* /*who*/) OVERRIDE + { + events.ScheduleEvent(EVENT_FIREBALL, 1000); + } void JustSummoned(Creature* summoned) OVERRIDE { - summoned->AI()->AttackStart(me); + // This is the best I can do because AttackStart does nothing + summoned->GetMotionMaster()->MovePoint(1, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()); + // summoned->AI()->AttackStart(me); Summons.Summon(summoned); } - void SummonedCreatureDespawn(Creature* summoned) OVERRIDE + void SummonedCreatureDies(Creature* summoned, Unit* /*who*/) OVERRIDE { Summons.Despawn(summoned); ++KillCount; @@ -97,26 +125,60 @@ public: void JustDied(Unit* /*killer*/) OVERRIDE { + me->setFaction(FACTION_NORMAL); + if (PlayerGUID) if (Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID)) player->FailQuest(QUEST_UNEXPECTED_RESULT); } - void UpdateAI(uint32 /*diff*/) OVERRIDE + void UpdateAI(uint32 diff) OVERRIDE { if (KillCount >= 3 && PlayerGUID) if (Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID)) - player->CompleteQuest(QUEST_UNEXPECTED_RESULT); + if (player->GetQuestStatus(QUEST_UNEXPECTED_RESULT) == QUEST_STATUS_INCOMPLETE) + { + player->CompleteQuest(QUEST_UNEXPECTED_RESULT); + me->setFaction(FACTION_NORMAL); + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); + } + + events.Update(diff); - if (Summon) + while (uint32 eventId = events.ExecuteEvent()) { - me->SummonCreature(NPC_GHARZUL, 8745, -7134.32f, 35.22f, 0, TEMPSUMMON_CORPSE_DESPAWN, 4000); - me->SummonCreature(NPC_ANGERSHADE, 8745, -7134.32f, 35.22f, 0, TEMPSUMMON_CORPSE_DESPAWN, 4000); - me->SummonCreature(NPC_ANGERSHADE, 8745, -7134.32f, 35.22f, 0, TEMPSUMMON_CORPSE_DESPAWN, 4000); - Summon = false; + switch (eventId) + { + case EVENT_TALK: + Talk(SAY_TEST_SOIL); + events.ScheduleEvent(EVENT_ADD_QUEST_GIVER_FLAG, 7000); + break; + case EVENT_ADD_QUEST_GIVER_FLAG: + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); + break; + case EVENT_SUMMON: + me->SummonCreature(NPC_GHARZUL, 8749.505f, -7132.595f, 35.31983f, 3.816502f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 180000); + me->SummonCreature(NPC_ANGERSHADE, 8755.38f, -7131.521f, 35.30957f, 3.816502f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 180000); + me->SummonCreature(NPC_ANGERSHADE, 8753.199f, -7125.975f, 35.31986f, 3.816502f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 180000); + break; + case EVENT_FIREBALL: + if (!UpdateVictim()) + continue; + DoCastVictim(SPELL_FIREBALL, true); // Not casting in combat + events.ScheduleEvent(EVENT_FIREBALL, 3000); + break; + default: + break; + } } + DoMeleeAttackIfReady(); } }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return new npc_apprentice_mirvedaAI(creature); + } }; /*###### diff --git a/src/server/scripts/EasternKingdoms/zone_ghostlands.cpp b/src/server/scripts/EasternKingdoms/zone_ghostlands.cpp index 1b181581f5e..cf7ea882135 100644 --- a/src/server/scripts/EasternKingdoms/zone_ghostlands.cpp +++ b/src/server/scripts/EasternKingdoms/zone_ghostlands.cpp @@ -161,7 +161,7 @@ public: break; case 11: Talk(SAY_PROGRESS2, player->GetGUID()); - me->SetOrientation(4.762841f); + me->SetFacingTo(4.762841f); break; case 18: { @@ -186,11 +186,11 @@ public: player->GroupEventHappens(QUEST_ESCAPE_FROM_THE_CATACOMBS, me); break; case 32: - me->SetOrientation(2.978281f); + me->SetFacingTo(2.978281f); Talk(SAY_END1, player->GetGUID()); break; case 33: - me->SetOrientation(5.858011f); + me->SetFacingTo(5.858011f); Talk(SAY_END2, player->GetGUID()); Creature* CaptainHelios = me->FindNearestCreature(NPC_CAPTAIN_HELIOS, 50); if (CaptainHelios) diff --git a/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp b/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp index ebec0170d23..257e3c21688 100644 --- a/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp +++ b/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp @@ -41,9 +41,9 @@ enum OOX { SAY_OOX_START = 0, SAY_OOX_AGGRO = 1, - SAY_OOX_AMBUSH = 3, - SAY_OOX_AMBUSH_REPLY = 4, - SAY_OOX_END = 5, + SAY_OOX_AMBUSH = 2, + SAY_OOX_AMBUSH_REPLY = 3, + SAY_OOX_END = 4, QUEST_RESQUE_OOX_09 = 836, diff --git a/src/server/scripts/EasternKingdoms/zone_silvermoon_city.cpp b/src/server/scripts/EasternKingdoms/zone_silvermoon_city.cpp deleted file mode 100644 index 36abdead399..00000000000 --- a/src/server/scripts/EasternKingdoms/zone_silvermoon_city.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> - * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -/* ScriptData -SDName: Silvermoon_City -SD%Complete: 100 -SDComment: Quest support: 9685 -SDCategory: Silvermoon City -EndScriptData */ - -/* ContentData -npc_blood_knight_stillblade -EndContentData */ - -#include "ScriptMgr.h" -#include "ScriptedCreature.h" -#include "Player.h" -#include "SpellInfo.h" - -/*####### -# npc_blood_knight_stillblade -#######*/ -enum StillbladeData -{ - SAY_HEAL = 0, - - QUEST_REDEEMING_THE_DEAD = 9685, - SPELL_SHIMMERING_VESSEL = 31225, - SPELL_REVIVE_SELF = 32343, -}; - -class npc_blood_knight_stillblade : public CreatureScript -{ -public: - npc_blood_knight_stillblade() : CreatureScript("npc_blood_knight_stillblade") { } - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_blood_knight_stillbladeAI(creature); - } - - struct npc_blood_knight_stillbladeAI : public ScriptedAI - { - npc_blood_knight_stillbladeAI(Creature* creature) : ScriptedAI(creature) { } - - uint32 lifeTimer; - bool spellHit; - - void Reset() OVERRIDE - { - lifeTimer = 120000; - me->SetStandState(UNIT_STAND_STATE_DEAD); - me->SetUInt32Value(UNIT_FIELD_BYTES_1, 7); // lay down - spellHit = false; - } - - void EnterCombat(Unit* /*who*/) OVERRIDE - { - } - - void MoveInLineOfSight(Unit* /*who*/) OVERRIDE - - { - } - - void UpdateAI(uint32 diff) OVERRIDE - { - if (me->IsStandState()) - { - if (lifeTimer <= diff) - me->AI()->EnterEvadeMode(); - else - lifeTimer -= diff; - } - } - - void SpellHit(Unit* caster, const SpellInfo* Spellkind) OVERRIDE - { - if (Spellkind->Id != SPELL_SHIMMERING_VESSEL || spellHit) - return; - - Player* player = caster->ToPlayer(); - if (!player || !player->IsActiveQuest(QUEST_REDEEMING_THE_DEAD)) - return; - - player->AreaExploredOrEventHappens(QUEST_REDEEMING_THE_DEAD); - DoCast(me, SPELL_REVIVE_SELF); - me->SetStandState(UNIT_STAND_STATE_STAND); - me->SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0); - //me->RemoveAllAuras(); - Talk(SAY_HEAL); - spellHit = true; - } - }; -}; - -void AddSC_silvermoon_city() -{ - new npc_blood_knight_stillblade(); -} diff --git a/src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp b/src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp index 48afdb6754f..757f2bcff2c 100644 --- a/src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp +++ b/src/server/scripts/EasternKingdoms/zone_silverpine_forest.cpp @@ -212,7 +212,7 @@ public: } } - void EnterCombat(Unit* /*who*/)OVERRIDE { } + void EnterCombat(Unit* /*who*/) OVERRIDE { } void JustSummoned(Creature* summoned) OVERRIDE { @@ -255,7 +255,7 @@ public: void UpdateAI(uint32 diff) OVERRIDE { - //TC_LOG_INFO(LOG_FILTER_TSCR, "DEBUG: p(%i) k(%i) d(%u) W(%i)", Phase, KillCount, diff, WaitTimer); + //TC_LOG_INFO("scripts", "DEBUG: p(%i) k(%i) d(%u) W(%i)", Phase, KillCount, diff, WaitTimer); if (!QuestInProgress) return; diff --git a/src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp b/src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp index 7077e3d9a31..6b409012cb0 100644 --- a/src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp +++ b/src/server/scripts/EasternKingdoms/zone_western_plaguelands.cpp @@ -189,7 +189,6 @@ public: } void MoveInLineOfSight(Unit* who) OVERRIDE - { if (!who) return; @@ -393,7 +392,7 @@ public: } } - void EnterCombat(Unit* /*who*/)OVERRIDE { } + void EnterCombat(Unit* /*who*/) OVERRIDE { } void JustDied(Unit* /*killer*/) OVERRIDE { diff --git a/src/server/scripts/Examples/example_spell.cpp b/src/server/scripts/Examples/example_spell.cpp index 4652eef3faa..2c76d9a40b0 100644 --- a/src/server/scripts/Examples/example_spell.cpp +++ b/src/server/scripts/Examples/example_spell.cpp @@ -82,19 +82,19 @@ class spell_ex_5581 : public SpellScriptLoader { // this hook is executed before anything about casting the spell is done // after this hook is executed all the machinery starts - TC_LOG_INFO(LOG_FILTER_GENERAL, "Caster just finished preparing the spell (cast bar has expired)"); + TC_LOG_INFO("misc", "Caster just finished preparing the spell (cast bar has expired)"); } void HandleOnCast() { // cast is validated and spell targets are selected at this moment // this is a last place when the spell can be safely interrupted - TC_LOG_INFO(LOG_FILTER_GENERAL, "Spell is about to do take reagents, power, launch missile, do visuals and instant spell effects"); + TC_LOG_INFO("misc", "Spell is about to do take reagents, power, launch missile, do visuals and instant spell effects"); } void HandleAfterCast() { - TC_LOG_INFO(LOG_FILTER_GENERAL, "All immediate Actions for the spell are finished now"); + TC_LOG_INFO("misc", "All immediate Actions for the spell are finished now"); // this is a safe for triggering additional effects for a spell without interfering // with visuals or with other effects of the spell //GetCaster()->CastSpell(target, SPELL_TRIGGERED, true); @@ -112,7 +112,7 @@ class spell_ex_5581 : public SpellScriptLoader void HandleDummyLaunch(SpellEffIndex /*effIndex*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Spell %u with SPELL_EFFECT_DUMMY is just launched!", GetSpellInfo()->Id); + TC_LOG_INFO("misc", "Spell %u with SPELL_EFFECT_DUMMY is just launched!", GetSpellInfo()->Id); } void HandleDummyLaunchTarget(SpellEffIndex /*effIndex*/) @@ -121,17 +121,17 @@ class spell_ex_5581 : public SpellScriptLoader if (Unit* unitTarget = GetHitUnit()) targetGUID = unitTarget->GetGUID(); // we're handling SPELL_EFFECT_DUMMY in effIndex 0 here - TC_LOG_INFO(LOG_FILTER_GENERAL, "Spell %u with SPELL_EFFECT_DUMMY is just launched at it's target: " UI64FMTD "!", GetSpellInfo()->Id, targetGUID); + TC_LOG_INFO("misc", "Spell %u with SPELL_EFFECT_DUMMY is just launched at it's target: " UI64FMTD "!", GetSpellInfo()->Id, targetGUID); } void HandleDummyHit(SpellEffIndex /*effIndex*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Spell %u with SPELL_EFFECT_DUMMY has hit!", GetSpellInfo()->Id); + TC_LOG_INFO("misc", "Spell %u with SPELL_EFFECT_DUMMY has hit!", GetSpellInfo()->Id); } void HandleDummyHitTarget(SpellEffIndex /*effIndex*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "SPELL_EFFECT_DUMMY is hits it's target!"); + TC_LOG_INFO("misc", "SPELL_EFFECT_DUMMY is hits it's target!"); // make caster cast a spell on a unit target of effect if (Unit* target = GetHitUnit()) GetCaster()->CastSpell(target, SPELL_TRIGGERED, true); @@ -139,23 +139,23 @@ class spell_ex_5581 : public SpellScriptLoader void HandleBeforeHit() { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Spell is about to hit target!"); + TC_LOG_INFO("misc", "Spell is about to hit target!"); } void HandleOnHit() { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Spell just hit target!"); + TC_LOG_INFO("misc", "Spell just hit target!"); } void HandleAfterHit() { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Spell just finished hitting target!"); + TC_LOG_INFO("misc", "Spell just finished hitting target!"); } void FilterTargets(std::list<Unit*>& /*targetList*/) { // usually you want this call for Area Target spells - TC_LOG_INFO(LOG_FILTER_GENERAL, "Spell is about to add targets from targetList to final targets!"); + TC_LOG_INFO("misc", "Spell is about to add targets from targetList to final targets!"); } // register functions used in spell script - names of these functions do not matter @@ -230,20 +230,20 @@ class spell_ex_66244 : public SpellScriptLoader void HandleOnEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Aura Effect is about to be applied on target!"); + TC_LOG_INFO("misc", "Aura Effect is about to be applied on target!"); // this hook allows you to prevent execution of AuraEffect handler, or to replace it with your own handler //PreventDefaultAction(); } void HandleOnEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Aura Effect is about to be removed from target!"); + TC_LOG_INFO("misc", "Aura Effect is about to be removed from target!"); // this hook allows you to prevent execution of AuraEffect handler, or to replace it with your own handler //PreventDefaultAction(); } void HandleAfterEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Aura Effect has just been applied on target!"); + TC_LOG_INFO("misc", "Aura Effect has just been applied on target!"); Unit* target = GetTarget(); // cast spell on target on aura apply target->CastSpell(target, SPELL_TRIGGERED, true); @@ -251,7 +251,7 @@ class spell_ex_66244 : public SpellScriptLoader void HandleAfterEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Aura Effect has just been just removed from target!"); + TC_LOG_INFO("misc", "Aura Effect has just been just removed from target!"); Unit* target = GetTarget(); Unit* caster = GetCaster(); // caster may be not avalible (logged out for example) @@ -263,7 +263,7 @@ class spell_ex_66244 : public SpellScriptLoader void HandleEffectPeriodic(AuraEffect const* /*aurEff*/) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Perioidic Aura Effect is does a tick on target!"); + TC_LOG_INFO("misc", "Perioidic Aura Effect is does a tick on target!"); Unit* target = GetTarget(); // aura targets damage self on tick target->DealDamage(target, 100); @@ -271,14 +271,14 @@ class spell_ex_66244 : public SpellScriptLoader void HandleEffectPeriodicUpdate(AuraEffect* aurEff) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Perioidic Aura Effect is now updated!"); + TC_LOG_INFO("misc", "Perioidic Aura Effect is now updated!"); // we're doubling aura amount every tick aurEff->ChangeAmount(aurEff->GetAmount() * 2); } void HandleEffectCalcAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& canBeRecalculated) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Amount of Aura Effect is being calculated now!"); + TC_LOG_INFO("misc", "Amount of Aura Effect is being calculated now!"); // we're setting amount to 100 amount = 100; // amount will be never recalculated due to applying passive aura @@ -287,7 +287,7 @@ class spell_ex_66244 : public SpellScriptLoader void HandleEffectCalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Periodic data of Aura Effect is being calculated now!"); + TC_LOG_INFO("misc", "Periodic data of Aura Effect is being calculated now!"); // we're setting aura to be periodic and tick every 10 seconds isPeriodic = true; amplitude = 2 * IN_MILLISECONDS; @@ -295,7 +295,7 @@ class spell_ex_66244 : public SpellScriptLoader void HandleEffectCalcSpellMod(AuraEffect const* /*aurEff*/, SpellModifier*& spellMod) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "SpellMod data of Aura Effect is being calculated now!"); + TC_LOG_INFO("misc", "SpellMod data of Aura Effect is being calculated now!"); // we don't want spellmod for example if (spellMod) { @@ -368,14 +368,14 @@ class spell_ex_absorb_aura : public SpellScriptLoader void HandleOnEffectAbsorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Our aura is now absorbing damage done to us!"); + TC_LOG_INFO("misc", "Our aura is now absorbing damage done to us!"); // absorb whole damage done to us absorbAmount = dmgInfo.GetDamage(); } void HandleAfterEffectAbsorb(AuraEffect* /*aurEff*/, DamageInfo & /*dmgInfo*/, uint32 & absorbAmount) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Our aura has absorbed %u damage!", absorbAmount); + TC_LOG_INFO("misc", "Our aura has absorbed %u damage!", absorbAmount); } // function registering @@ -404,7 +404,7 @@ class spell_ex_463 : public SpellScriptLoader bool CheckAreaTarget(Unit* target) { - TC_LOG_INFO(LOG_FILTER_GENERAL, "Area aura checks if unit is a valid target for it!"); + TC_LOG_INFO("misc", "Area aura checks if unit is a valid target for it!"); // in our script we allow only players to be affected return target->GetTypeId() == TYPEID_PLAYER; } diff --git a/src/server/scripts/Kalimdor/CMakeLists.txt b/src/server/scripts/Kalimdor/CMakeLists.txt index 17c360a54b2..c02e896a87d 100644 --- a/src/server/scripts/Kalimdor/CMakeLists.txt +++ b/src/server/scripts/Kalimdor/CMakeLists.txt @@ -15,12 +15,15 @@ set(scripts_STAT_SRCS Kalimdor/zone_moonglade.cpp Kalimdor/RazorfenDowns/razorfen_downs.cpp Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp + Kalimdor/RazorfenDowns/boss_tuten_kash.cpp + Kalimdor/RazorfenDowns/boss_mordresh_fire_eye.cpp + Kalimdor/RazorfenDowns/boss_glutton.cpp Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp Kalimdor/RazorfenDowns/razorfen_downs.h - Kalimdor/ZulFarrak/zulfarrak.h Kalimdor/ZulFarrak/zulfarrak.cpp Kalimdor/ZulFarrak/instance_zulfarrak.cpp Kalimdor/ZulFarrak/boss_zum_rah.cpp + Kalimdor/ZulFarrak/zulfarrak.h Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.h Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp index 164de89b017..52f706d5626 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp @@ -186,6 +186,7 @@ public: { npc_towering_infernalAI(Creature* creature) : ScriptedAI(creature) { + AnetheronGUID = 0; instance = creature->GetInstanceScript(); if (instance) AnetheronGUID = instance->GetData64(DATA_ANETHERON); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp index aaf2bb65ba0..dd486df16ed 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp @@ -193,6 +193,7 @@ public: { npc_lesser_doomguardAI(Creature* creature) : hyjal_trashAI(creature) { + AzgalorGUID = 0; instance = creature->GetInstanceScript(); if (instance) AzgalorGUID = instance->GetData64(DATA_AZGALOR); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp index 336bee39da5..f4d3f559585 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp @@ -72,7 +72,7 @@ public: break; case GOSSIP_ACTION_INFO_DEF: ai->Debug = !ai->Debug; - TC_LOG_DEBUG(LOG_FILTER_TSCR, "HyjalAI - Debug mode has been toggled"); + TC_LOG_DEBUG("scripts", "HyjalAI - Debug mode has been toggled"); break; } return true; @@ -149,7 +149,7 @@ public: break; case GOSSIP_ACTION_INFO_DEF: ai->Debug = !ai->Debug; - TC_LOG_DEBUG(LOG_FILTER_TSCR, "HyjalAI - Debug mode has been toggled"); + TC_LOG_DEBUG("scripts", "HyjalAI - Debug mode has been toggled"); break; } return true; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp index fb06a5ccaa5..4a491803cb4 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp @@ -407,7 +407,7 @@ void hyjalAI::Reset() instance->DoUpdateWorldState(WORLD_STATE_ENEMYCOUNT, 0); instance->SetData(DATA_RESET_TRASH_COUNT, 0); } - } else TC_LOG_ERROR(LOG_FILTER_TSCR, ERROR_INST_DATA); + } else TC_LOG_ERROR("scripts", ERROR_INST_DATA); //Visibility DoHide = true; @@ -540,7 +540,7 @@ void hyjalAI::SummonNextWave(const Wave wave[18], uint32 Count, float Base[4][3] if (!instance) { - TC_LOG_ERROR(LOG_FILTER_TSCR, ERROR_INST_DATA); + TC_LOG_ERROR("scripts", ERROR_INST_DATA); return; } InfernalCount = 0;//reset infernal count every new wave @@ -570,7 +570,7 @@ void hyjalAI::SummonNextWave(const Wave wave[18], uint32 Count, float Base[4][3] else { NextWaveTimer = 15000; - TC_LOG_DEBUG(LOG_FILTER_TSCR, "HyjalAI: debug mode is enabled. Next Wave in 15 seconds"); + TC_LOG_DEBUG("scripts", "HyjalAI: debug mode is enabled. Next Wave in 15 seconds"); } } else @@ -614,7 +614,7 @@ uint32 hyjalAI::GetInstanceData(uint32 Event) { if (instance) return instance->GetData(Event); - else TC_LOG_ERROR(LOG_FILTER_TSCR, ERROR_INST_DATA); + else TC_LOG_ERROR("scripts", ERROR_INST_DATA); return 0; } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp index 43d75fad876..9245a0c648f 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp @@ -186,6 +186,7 @@ hyjal_trashAI::hyjal_trashAI(Creature* creature) : npc_escortAI(creature) faction = 0; useFlyPath = false; damageTaken = 0; + memset(DummyTarget, 0, sizeof(DummyTarget)); Reset(); } @@ -430,7 +431,6 @@ public: bool meteor; bool CanMove; - bool WpEnabled; bool go; uint32 spawnTimer; uint32 FlameBuffetTimer; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp index 6bfd04a7614..d54ef0c5168 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp @@ -245,7 +245,7 @@ public: break; } - TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance Hyjal: Instance data updated for event %u (Data=%u)", type, data); + TC_LOG_DEBUG("scripts", "Instance Hyjal: Instance data updated for event %u (Data=%u)", type, data); if (data == DONE) { diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp index e9edbb46537..8250f1ec3c0 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp @@ -86,7 +86,7 @@ public: } } - TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance Old Hillsbrad: GetPlayerInMap, but PlayerList is empty!"); + TC_LOG_DEBUG("scripts", "Instance Old Hillsbrad: GetPlayerInMap, but PlayerList is empty!"); return NULL; } @@ -126,7 +126,7 @@ public: if (!player) { - TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance Old Hillsbrad: SetData (Type: %u Data %u) cannot find any player.", type, data); + TC_LOG_DEBUG("scripts", "Instance Old Hillsbrad: SetData (Type: %u Data %u) cannot find any player.", type, data); return; } @@ -142,7 +142,7 @@ public: ++mBarrelCount; DoUpdateWorldState(WORLD_STATE_OH, mBarrelCount); - TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance Old Hillsbrad: go_barrel_old_hillsbrad count %u", mBarrelCount); + TC_LOG_DEBUG("scripts", "Instance Old Hillsbrad: go_barrel_old_hillsbrad count %u", mBarrelCount); m_auiEncounter[0] = IN_PROGRESS; @@ -163,7 +163,7 @@ public: { ++mThrallEventCount; m_auiEncounter[1] = NOT_STARTED; - TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance Old Hillsbrad: Thrall event failed %u times. Resetting all sub-events.", mThrallEventCount); + TC_LOG_DEBUG("scripts", "Instance Old Hillsbrad: Thrall event failed %u times. Resetting all sub-events.", mThrallEventCount); m_auiEncounter[2] = NOT_STARTED; m_auiEncounter[3] = NOT_STARTED; m_auiEncounter[4] = NOT_STARTED; @@ -176,29 +176,29 @@ public: m_auiEncounter[3] = data; m_auiEncounter[4] = data; m_auiEncounter[5] = data; - TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance Old Hillsbrad: Thrall event failed %u times. Resetting all sub-events.", mThrallEventCount); + TC_LOG_DEBUG("scripts", "Instance Old Hillsbrad: Thrall event failed %u times. Resetting all sub-events.", mThrallEventCount); } } else m_auiEncounter[1] = data; - TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance Old Hillsbrad: Thrall escort event adjusted to data %u.", data); + TC_LOG_DEBUG("scripts", "Instance Old Hillsbrad: Thrall escort event adjusted to data %u.", data); break; } case TYPE_THRALL_PART1: m_auiEncounter[2] = data; - TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance Old Hillsbrad: Thrall event part I adjusted to data %u.", data); + TC_LOG_DEBUG("scripts", "Instance Old Hillsbrad: Thrall event part I adjusted to data %u.", data); break; case TYPE_THRALL_PART2: m_auiEncounter[3] = data; - TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance Old Hillsbrad: Thrall event part II adjusted to data %u.", data); + TC_LOG_DEBUG("scripts", "Instance Old Hillsbrad: Thrall event part II adjusted to data %u.", data); break; case TYPE_THRALL_PART3: m_auiEncounter[4] = data; - TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance Old Hillsbrad: Thrall event part III adjusted to data %u.", data); + TC_LOG_DEBUG("scripts", "Instance Old Hillsbrad: Thrall event part III adjusted to data %u.", data); break; case TYPE_THRALL_PART4: m_auiEncounter[5] = data; - TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance Old Hillsbrad: Thrall event part IV adjusted to data %u.", data); + TC_LOG_DEBUG("scripts", "Instance Old Hillsbrad: Thrall event part IV adjusted to data %u.", data); break; } } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp index 19024172aa0..d0178f4874a 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/instance_the_black_morass.cpp @@ -193,7 +193,7 @@ public: { if (data == IN_PROGRESS) { - TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance The Black Morass: Starting event."); + TC_LOG_DEBUG("scripts", "Instance The Black Morass: Starting event."); InitWorldState(); m_auiEncounter[1] = IN_PROGRESS; ScheduleEventNextPortal(15000); @@ -202,7 +202,7 @@ public: if (data == DONE) { //this may be completed further out in the post-event - TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance The Black Morass: Event completed."); + TC_LOG_DEBUG("scripts", "Instance The Black Morass: Event completed."); Map::PlayerList const& players = instance->GetPlayers(); if (!players.isEmpty()) @@ -267,7 +267,7 @@ public: if (entry == RIFT_BOSS) entry = RandRiftBoss(); - TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance The Black Morass: Summoning rift boss entry %u.", entry); + TC_LOG_DEBUG("scripts", "Instance The Black Morass: Summoning rift boss entry %u.", entry); Position pos; me->GetRandomNearPosition(pos, 10.0f); @@ -278,7 +278,7 @@ public: if (Creature* summon = me->SummonCreature(entry, pos, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000)) return summon; - TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance The Black Morass: What just happened there? No boss, no loot, no fun..."); + TC_LOG_DEBUG("scripts", "Instance The Black Morass: What just happened there? No boss, no loot, no fun..."); return NULL; } @@ -291,7 +291,7 @@ public: if (tmp >= _currentRiftId) ++tmp; - TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance The Black Morass: Creating Time Rift at locationId %i (old locationId was %u).", tmp, _currentRiftId); + TC_LOG_DEBUG("scripts", "Instance The Black Morass: Creating Time Rift at locationId %i (old locationId was %u).", tmp, _currentRiftId); _currentRiftId = tmp; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp index 8cdf5f246d0..cc3cf8192dc 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp @@ -336,7 +336,7 @@ public: uint32 entry = 0; entry = PortalWaves[mWaveId].PortalMob[mRiftWaveCount]; - TC_LOG_DEBUG(LOG_FILTER_TSCR, "npc_time_rift: summoning wave Creature (Wave %u, Entry %u).", mRiftWaveCount, entry); + TC_LOG_DEBUG("scripts", "npc_time_rift: summoning wave Creature (Wave %u, Entry %u).", mRiftWaveCount, entry); ++mRiftWaveCount; @@ -361,7 +361,7 @@ public: if (me->IsNonMeleeSpellCasted(false)) return; - TC_LOG_DEBUG(LOG_FILTER_TSCR, "npc_time_rift: not casting anylonger, i need to die."); + TC_LOG_DEBUG("scripts", "npc_time_rift: not casting anylonger, i need to die."); me->setDeathState(JUST_DIED); if (instance->GetData(TYPE_RIFT) == IN_PROGRESS) diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp index 4a4d7fe4b07..323fd92a8f6 100644 --- a/src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp +++ b/src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp @@ -1,6 +1,5 @@ /* * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> - * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -16,63 +15,57 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* ScriptData -SDName: Boss_Amnennar_the_coldbringer -SD%Complete: 100 -SDComment: -SDCategory: Razorfen Downs -EndScriptData */ - #include "ScriptMgr.h" #include "ScriptedCreature.h" +#include "razorfen_downs.h" -enum AmnennarTheColdbringer +enum Say { SAY_AGGRO = 0, SAY_SUMMON60 = 1, SAY_SUMMON30 = 2, SAY_HP = 3, - SAY_KILL = 4, + SAY_KILL = 4 +}; +enum Spells +{ SPELL_AMNENNARSWRATH = 13009, SPELL_FROSTBOLT = 15530, SPELL_FROST_NOVA = 15531, SPELL_FROST_SPECTRES = 12642 }; +enum Events +{ + EVENT_AMNENNARSWRATH = 1, + EVENT_FROSTBOLT = 2, + EVENT_FROST_NOVA = 3 +}; + class boss_amnennar_the_coldbringer : public CreatureScript { public: boss_amnennar_the_coldbringer() : CreatureScript("boss_amnennar_the_coldbringer") { } - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new boss_amnennar_the_coldbringerAI(creature); - } - - struct boss_amnennar_the_coldbringerAI : public ScriptedAI + struct boss_amnennar_the_coldbringerAI : public BossAI { - boss_amnennar_the_coldbringerAI(Creature* creature) : ScriptedAI(creature) { } - - uint32 AmnenarsWrath_Timer; - uint32 FrostBolt_Timer; - uint32 FrostNova_Timer; - bool Spectrals60; - bool Spectrals30; - bool Hp; + boss_amnennar_the_coldbringerAI(Creature* creature) : BossAI(creature, DATA_AMNENNAR_THE_COLD_BRINGER) { } void Reset() OVERRIDE { - AmnenarsWrath_Timer = 8000; - FrostBolt_Timer = 1000; - FrostNova_Timer = urand(10000, 15000); - Spectrals30 = false; - Spectrals60 = false; - Hp = false; + _Reset(); + hp60Spectrals = false; + hp30Spectrals = false; + hp50 = false; } void EnterCombat(Unit* /*who*/) OVERRIDE { + _EnterCombat(); + events.ScheduleEvent(EVENT_AMNENNARSWRATH, 8000); + events.ScheduleEvent(EVENT_FROSTBOLT, 1000); + events.ScheduleEvent(EVENT_FROST_NOVA, urand(10000, 15000)); Talk(SAY_AGGRO); } @@ -81,55 +74,73 @@ public: Talk(SAY_KILL); } + void JustDied(Unit* /*killer*/) OVERRIDE + { + _JustDied(); + } + void UpdateAI(uint32 diff) OVERRIDE { if (!UpdateVictim()) return; - //AmnenarsWrath_Timer - if (AmnenarsWrath_Timer <= diff) - { - DoCastVictim(SPELL_AMNENNARSWRATH); - AmnenarsWrath_Timer = 12000; - } else AmnenarsWrath_Timer -= diff; + events.Update(diff); - //FrostBolt_Timer - if (FrostBolt_Timer <= diff) - { - DoCastVictim(SPELL_FROSTBOLT); - FrostBolt_Timer = 8000; - } else FrostBolt_Timer -= diff; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - if (FrostNova_Timer <= diff) + while (uint32 eventId = events.ExecuteEvent()) { - DoCast(me, SPELL_FROST_NOVA); - FrostNova_Timer = 15000; - } else FrostNova_Timer -= diff; + switch (eventId) + { + case EVENT_AMNENNARSWRATH: + DoCastVictim(SPELL_AMNENNARSWRATH); + events.ScheduleEvent(EVENT_AMNENNARSWRATH, 12000); + break; + case EVENT_FROSTBOLT: + DoCastVictim(SPELL_FROSTBOLT); + events.ScheduleEvent(EVENT_FROSTBOLT, 8000); + break; + case EVENT_FROST_NOVA: + DoCast(me, SPELL_FROST_NOVA); + events.ScheduleEvent(EVENT_FROST_NOVA, 15000); + break; + } + } - if (!Spectrals60 && HealthBelowPct(60)) + if (!hp60Spectrals && HealthBelowPct(60)) { Talk(SAY_SUMMON60); DoCastVictim(SPELL_FROST_SPECTRES); - Spectrals60 = true; + hp60Spectrals = true; } - if (!Hp && HealthBelowPct(50)) + if (!hp50 && HealthBelowPct(50)) { Talk(SAY_HP); - Hp = true; + hp50 = true; } - if (!Spectrals30 && HealthBelowPct(30)) + if (!hp30Spectrals && HealthBelowPct(30)) { Talk(SAY_SUMMON30); DoCastVictim(SPELL_FROST_SPECTRES); - Spectrals30 = true; + hp30Spectrals = true; } DoMeleeAttackIfReady(); } + + private: + bool hp60Spectrals; + bool hp30Spectrals; + bool hp50; }; + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return new boss_amnennar_the_coldbringerAI(creature); + } }; void AddSC_boss_amnennar_the_coldbringer() diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/boss_glutton.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/boss_glutton.cpp new file mode 100644 index 00000000000..b75fcad64a5 --- /dev/null +++ b/src/server/scripts/Kalimdor/RazorfenDowns/boss_glutton.cpp @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "razorfen_downs.h" + +enum Say +{ + SAY_AGGRO = 0, + SAY_SLAY = 1, + SAY_HP50 = 2, + SAY_HP15 = 3 +}; + +enum Spells +{ + SPELL_DISEASE_CLOUD = 12627, + SPELL_FRENZY = 12795 +}; + +class boss_glutton : public CreatureScript +{ +public: + boss_glutton() : CreatureScript("boss_glutton") { } + + struct boss_gluttonAI : public BossAI + { + boss_gluttonAI(Creature* creature) : BossAI(creature, DATA_GLUTTON) { } + + void Reset() OVERRIDE + { + _Reset(); + hp50 = false; + hp15 = false; + } + + void EnterCombat(Unit* /*who*/) OVERRIDE + { + _EnterCombat(); + Talk(SAY_AGGRO); + } + + void KilledUnit(Unit* /*victim*/) OVERRIDE + { + Talk(SAY_SLAY); + } + + void JustDied(Unit* /*killer*/) OVERRIDE + { + _JustDied(); + } + + void UpdateAI(uint32 /*diff*/) OVERRIDE + { + if (!UpdateVictim()) + return; + + if (!hp50 && HealthBelowPct(50)) + { + Talk(SAY_HP50); + hp50 = true; + } + + if (!hp15 && HealthBelowPct(15)) + { + Talk(SAY_HP15); + DoCast(me, SPELL_FRENZY); + hp15 = true; + } + + DoMeleeAttackIfReady(); + } + + private: + bool hp50; + bool hp15; + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return new boss_gluttonAI(creature); + } +}; + +void AddSC_boss_glutton() +{ + new boss_glutton(); +} diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/boss_mordresh_fire_eye.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/boss_mordresh_fire_eye.cpp new file mode 100644 index 00000000000..1f45de3c4c6 --- /dev/null +++ b/src/server/scripts/Kalimdor/RazorfenDowns/boss_mordresh_fire_eye.cpp @@ -0,0 +1,136 @@ +/* + * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "razorfen_downs.h" + +enum Say +{ + SAY_OOC_1 = 0, + SAY_OOC_2 = 1, + SAY_OOC_3 = 2, + SAY_AGGRO = 3 +}; + +enum Spells +{ + SPELL_FIREBALL = 12466, + SPELL_FIRE_NOVA = 12470 +}; + +enum Events +{ + EVENT_OOC_1 = 1, + EVENT_OOC_2 = 2, + EVENT_OOC_3 = 3, + EVENT_OOC_4 = 4, + EVENT_FIREBALL = 5, + EVENT_FIRE_NOVA = 6 +}; + +class boss_mordresh_fire_eye : public CreatureScript +{ +public: + boss_mordresh_fire_eye() : CreatureScript("boss_mordresh_fire_eye") { } + + struct boss_mordresh_fire_eyeAI : public BossAI + { + boss_mordresh_fire_eyeAI(Creature* creature) : BossAI(creature, DATA_MORDRESH_FIRE_EYE) { } + + void Reset() OVERRIDE + { + _Reset(); + events.ScheduleEvent(EVENT_OOC_1, 10000); + } + + void EnterCombat(Unit* /*who*/) OVERRIDE + { + _EnterCombat(); + events.Reset(); + Talk(SAY_AGGRO); + events.ScheduleEvent(EVENT_FIREBALL, 100); + events.ScheduleEvent(EVENT_FIRE_NOVA, urand(8000, 12000)); + } + + void JustDied(Unit* /*killer*/) OVERRIDE + { + _JustDied(); + } + + void UpdateAI(uint32 diff) OVERRIDE + { + events.Update(diff); + + if (!UpdateVictim()) + { + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_OOC_1: + Talk(SAY_OOC_1); + events.ScheduleEvent(EVENT_OOC_2, 8000); + break; + case EVENT_OOC_2: + Talk(SAY_OOC_2); + events.ScheduleEvent(EVENT_OOC_3, 3000); + break; + case EVENT_OOC_3: + me->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION); + events.ScheduleEvent(EVENT_OOC_4, 6000); + break; + case EVENT_OOC_4: + Talk(SAY_OOC_3); + events.ScheduleEvent(EVENT_OOC_1, 14000); + break; + } + } + return; + } + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_FIREBALL: + DoCastVictim(SPELL_FIREBALL); + events.ScheduleEvent(EVENT_FIREBALL, urand(2400, 3800)); + break; + case EVENT_FIRE_NOVA: + DoCast(me, SPELL_FIRE_NOVA); + events.ScheduleEvent(EVENT_FIRE_NOVA, urand(11000, 16000)); + break; + } + } + DoMeleeAttackIfReady(); + } + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return new boss_mordresh_fire_eyeAI(creature); + } +}; + +void AddSC_boss_mordresh_fire_eye() +{ + new boss_mordresh_fire_eye(); +} diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/boss_tuten_kash.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/boss_tuten_kash.cpp new file mode 100644 index 00000000000..5cf8a2992a3 --- /dev/null +++ b/src/server/scripts/Kalimdor/RazorfenDowns/boss_tuten_kash.cpp @@ -0,0 +1,107 @@ +/* + * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "razorfen_downs.h" + +enum Spells +{ + SPELL_THRASH = 8876, + SPELL_WEB_SPRAY = 12252, + SPELL_VIRULENT_POISON = 12254, + SPELL_CURSE_OF_TUTENKASH = 12255 +}; + +enum Events +{ + EVENT_WEB_SPRAY = 1, + EVENT_CURSE_OF_TUTENKASH = 2 +}; + +class boss_tuten_kash : public CreatureScript +{ +public: + boss_tuten_kash() : CreatureScript("boss_tuten_kash") { } + + struct boss_tuten_kashAI : public BossAI + { + boss_tuten_kashAI(Creature* creature) : BossAI(creature, DATA_TUTEN_KASH) { } + + void Reset() OVERRIDE + { + _Reset(); + if (!me->HasAura(SPELL_THRASH)) + DoCast(me, SPELL_THRASH); + if (!me->HasAura(SPELL_VIRULENT_POISON)) + DoCast(me, SPELL_VIRULENT_POISON); + } + + void EnterCombat(Unit* /*who*/) OVERRIDE + { + _EnterCombat(); + events.ScheduleEvent(EVENT_WEB_SPRAY, urand(3000, 5000)); + events.ScheduleEvent(EVENT_CURSE_OF_TUTENKASH, urand(9000, 14000)); + } + + void JustDied(Unit* /*killer*/) OVERRIDE + { + _JustDied(); + } + + void UpdateAI(uint32 diff) OVERRIDE + { + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_WEB_SPRAY: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, false)) + { + if (!target->HasAura(SPELL_WEB_SPRAY)) + DoCast(target, SPELL_WEB_SPRAY); + } + events.ScheduleEvent(EVENT_WEB_SPRAY, urand(6000, 8000)); + break; + case EVENT_CURSE_OF_TUTENKASH: + DoCast(me, SPELL_CURSE_OF_TUTENKASH); + events.ScheduleEvent(EVENT_CURSE_OF_TUTENKASH, urand(15000, 25000)); + break; + } + } + DoMeleeAttackIfReady(); + } + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return new boss_tuten_kashAI(creature); + } +}; + +void AddSC_boss_tuten_kash() +{ + new boss_tuten_kash(); +} diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp index 091c7e46585..097f340891a 100644 --- a/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp +++ b/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp @@ -16,199 +16,219 @@ */ #include "ScriptMgr.h" +#include "ObjectMgr.h" #include "InstanceScript.h" #include "razorfen_downs.h" #include "Player.h" #include "TemporarySummon.h" -#define MAX_ENCOUNTER 1 +Position const PosSummonTutenkash[15] = +{ + // 7349 Tomb Fiend + { 2487.339f, 805.9111f, 43.08361f, 2.844887f }, + { 2485.405f, 804.1145f, 43.68511f, 3.054326f }, + { 2488.431f, 801.2809f, 42.70374f, 4.29351f }, + { 2489.914f, 804.7949f, 43.25175f, 1.658063f }, + { 2541.246f, 907.0941f, 46.64201f, 2.024582f }, + { 2544.701f, 907.6331f, 46.38007f, 1.605703f }, + { 2541.49f, 911.1756f, 46.26493f, 4.817109f }, + { 2544.693f, 912.8887f, 46.39912f, 2.129302f }, + { 2524.036f, 834.4852f, 48.37031f, 0.8028514f }, + { 2527.017f, 829.9793f, 48.06498f, 0.6981317f }, + // 7351 Tomb Reaver + { 2542.818f, 904.9359f, 46.80911f, 4.642576f }, + { 2543.287f, 911.2448f, 46.32785f, 0.6806784f }, + { 2489.083f, 806.5914f, 43.21102f, 3.682645f }, + { 2486.828f, 802.8737f, 43.19883f, 2.9147f }, + // 7355 Tuten'kash + { 2487.939f, 804.2224f, 43.10735f, 1.692969f } +}; class instance_razorfen_downs : public InstanceMapScript { public: - instance_razorfen_downs() : InstanceMapScript("instance_razorfen_downs", 129) { } - - InstanceScript* GetInstanceScript(InstanceMap* map) const OVERRIDE - { - return new instance_razorfen_downs_InstanceMapScript(map); - } + instance_razorfen_downs() : InstanceMapScript(RFDScriptName, 129) { } struct instance_razorfen_downs_InstanceMapScript : public InstanceScript { instance_razorfen_downs_InstanceMapScript(Map* map) : InstanceScript(map) { + SetBossNumber(EncounterCount); } - uint64 uiGongGUID; - - uint32 m_auiEncounter[MAX_ENCOUNTER]; - - uint16 uiGongWaves; - - std::string str_data; - void Initialize() OVERRIDE { - uiGongGUID = 0; - - uiGongWaves = 0; - - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - } - - std::string GetSaveData() OVERRIDE - { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - - saveStream << "T C " << m_auiEncounter[0] - << ' ' << uiGongWaves; - - str_data = saveStream.str(); - - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; + goGongGUID = 0; + gongWave = 0; + fiendsKilled = 0; + reaversKilled = 0; + summonLowRange = 0; + summonHighRange = 0; + summonCreature = 0; } - void Load(const char* in) OVERRIDE + void OnGameObjectCreate(GameObject* gameObject) OVERRIDE { - if (!in) + switch (gameObject->GetEntry()) { - OUT_LOAD_INST_DATA_FAIL; - return; + case GO_GONG: + goGongGUID = gameObject->GetGUID(); + if (GetBossState(DATA_TUTEN_KASH) == DONE) + gameObject->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + break; + case GO_IDOL_OVEN_FIRE: + case GO_IDOL_CUP_FIRE: + case GO_IDOL_MOUTH_FIRE: + if (GetBossState(DATA_EXTINGUISHING_THE_IDOL) == DONE) + gameObject->Delete(); + break; + default: + break; } - - OUT_LOAD_INST_DATA(in); - - char dataHead1, dataHead2; - uint16 data0, data1; - - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> data0 >> data1; - - if (dataHead1 == 'T' && dataHead2 == 'C') - { - m_auiEncounter[0] = data0; - - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; - - uiGongWaves = data1; - } else OUT_LOAD_INST_DATA_FAIL; - - OUT_LOAD_INST_DATA_COMPLETE; } - void OnGameObjectCreate(GameObject* go) OVERRIDE + bool SetBossState(uint32 type, EncounterState state) OVERRIDE { - switch (go->GetEntry()) + if (!InstanceScript::SetBossState(type, state)) + return false; + + switch (type) { - case GO_GONG: - uiGongGUID = go->GetGUID(); - if (m_auiEncounter[0] == DONE) - go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + case DATA_TUTEN_KASH: + case DATA_MORDRESH_FIRE_EYE: + case DATA_GLUTTON: + case DATA_AMNENNAR_THE_COLD_BRINGER: + case DATA_GONG: + case DATA_WAVE: + case DATA_EXTINGUISHING_THE_IDOL: break; default: break; } + return true; } - void SetData(uint32 uiType, uint32 uiData) OVERRIDE + void SetData(uint32 type, uint32 data) OVERRIDE { - if (uiType == DATA_GONG_WAVES) + if (type == DATA_WAVE) { - uiGongWaves = uiData; - - switch (uiGongWaves) + switch (data) { - case 9: - case 14: - if (GameObject* go = instance->GetGameObject(uiGongGUID)) - go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - break; - case 1: - case 10: - case 16: + case IN_PROGRESS: { - GameObject* go = instance->GetGameObject(uiGongGUID); - - if (!go) - return; - - go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - - uint32 uiCreature = 0; - uint8 uiSummonTimes = 0; + if (GameObject* go = instance->GetGameObject(goGongGUID)) + go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - switch (uiGongWaves) + switch (gongWave) { - case 1: - uiCreature = NPC_TOMB_FIEND; - uiSummonTimes = 7; - break; - case 10: - uiCreature = NPC_TOMB_REAVER; - uiSummonTimes = 3; + case 0: + summonLowRange = 0; + summonHighRange = 10; + summonCreature = NPC_TOMB_FIEND; break; - case 16: - uiCreature = NPC_TUTEN_KASH; + case 1: + summonLowRange = 10; + summonHighRange = 14; + summonCreature = NPC_TOMB_REAVER; break; - default: + case 2: + summonLowRange = 14; + summonHighRange = 15; + summonCreature = NPC_TUTEN_KASH; break; } - if (Creature* creature = go->SummonCreature(uiCreature, 2502.635f, 844.140f, 46.896f, 0.633f)) + if (GameObject* go = instance->GetGameObject(goGongGUID)) { - if (uiGongWaves == 10 || uiGongWaves == 1) + for (uint8 i = summonLowRange; i < summonHighRange; ++i) { - for (uint8 i = 0; i < uiSummonTimes; ++i) - { - if (Creature* summon = go->SummonCreature(uiCreature, 2502.635f + float(irand(-5, 5)), 844.140f + float(irand(-5, 5)), 46.896f, 0.633f)) - summon->GetMotionMaster()->MovePoint(0, 2533.479f + float(irand(-5, 5)), 870.020f + float(irand(-5, 5)), 47.678f); - } + Creature* creature = go->SummonCreature(summonCreature, PosSummonTutenkash[i]); + creature->GetMotionMaster()->MovePoint(0, 2533.479f + float(irand(-5, 5)), 870.020f + float(irand(-5, 5)), 47.678f); } - creature->GetMotionMaster()->MovePoint(0, 2533.479f + float(irand(-5, 5)), 870.020f + float(irand(-5, 5)), 47.678f); } + + ++gongWave; break; } - default: + case NPC_TOMB_FIEND: + if (++fiendsKilled == 10) + { + fiendsKilled = 0; + if (GameObject* go = instance->GetGameObject(goGongGUID)) + go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + } + break; + case NPC_TOMB_REAVER: + if (++reaversKilled == 4) + { + reaversKilled = 0; + if (GameObject* go = instance->GetGameObject(goGongGUID)) + go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + } break; } + } - if (uiType == BOSS_TUTEN_KASH) - { - m_auiEncounter[0] = uiData; + } - if (uiData == DONE) - SaveToDB(); - } + std::string GetSaveData() OVERRIDE + { + OUT_SAVE_INST_DATA; + + std::ostringstream saveStream; + saveStream << "R D " << GetBossSaveData(); + + OUT_SAVE_INST_DATA_COMPLETE; + return saveStream.str(); } - uint32 GetData(uint32 uiType) const OVERRIDE + void Load(const char* str) OVERRIDE { - switch (uiType) + if (!str) { - case DATA_GONG_WAVES: - return uiGongWaves; + OUT_LOAD_INST_DATA_FAIL; + return; } - return 0; - } + OUT_LOAD_INST_DATA(str); - uint64 GetData64(uint32 uiType) const OVERRIDE - { - switch (uiType) + char dataHead1, dataHead2; + + std::istringstream loadStream(str); + loadStream >> dataHead1 >> dataHead2; + + if (dataHead1 == 'R' && dataHead2 == 'D') { - case DATA_GONG: return uiGongGUID; + for (uint32 i = 0; i < EncounterCount; ++i) + { + uint32 tmpState; + loadStream >> tmpState; + if (tmpState == IN_PROGRESS || tmpState > SPECIAL) + tmpState = NOT_STARTED; + SetBossState(i, EncounterState(tmpState)); + } } + else + OUT_LOAD_INST_DATA_FAIL; - return 0; + OUT_LOAD_INST_DATA_COMPLETE; } + + protected: + uint64 goGongGUID; + uint16 gongWave; + uint8 fiendsKilled; + uint8 reaversKilled; + uint8 summonLowRange; + uint8 summonHighRange; + uint32 summonCreature; }; + InstanceScript* GetInstanceScript(InstanceMap* map) const OVERRIDE + { + return new instance_razorfen_downs_InstanceMapScript(map); + } }; void AddSC_instance_razorfen_downs() diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp index 320c9970077..3300f0d811b 100644 --- a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp +++ b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp @@ -32,6 +32,10 @@ EndContentData */ #include "ScriptedGossip.h" #include "razorfen_downs.h" #include "Player.h" +#include "GridNotifiers.h" +#include "GridNotifiersImpl.h" +#include "Cell.h" +#include "CellImpl.h" /*### # npc_henry_stern @@ -101,32 +105,272 @@ public: }; /*###### -## go_gong +## npc_belnistrasz for Quest 3525 "Extinguishing the Idol" ######*/ -class go_gong : public GameObjectScript +Position const PosSummonSpawner[3] = +{ + { 2582.789f, 954.3925f, 52.48214f, 3.787364f }, + { 2569.42f, 956.3801f, 52.27323f, 5.427974f }, + { 2570.62f, 942.3934f, 53.7433f, 0.715585f } +}; + +enum Belnistrasz +{ + EVENT_CHANNEL = 1, + EVENT_IDOL_ROOM_SPAWNER = 2, + EVENT_PROGRESS = 3, + EVENT_COMPLETE = 4, + EVENT_FIREBALL = 5, + EVENT_FROST_NOVA = 6, + + FACTION_ESCORT = 250, + + PATH_ESCORT = 871710, + POINT_REACH_IDOL = 17, + + QUEST_EXTINGUISHING_THE_IDOL = 3525, + + SAY_QUEST_ACCEPTED = 0, + SAY_EVENT_START = 1, + SAY_EVENT_THREE_MIN_LEFT = 2, + SAY_EVENT_TWO_MIN_LEFT = 3, + SAY_EVENT_ONE_MIN_LEFT = 4, + SAY_EVENT_END = 5, + SAY_AGGRO = 6, // Combat + SAY_WATCH_OUT = 7, // 25% chance to target random creature and say on wave spawn + + SPELL_ARCANE_INTELLECT = 13326, + SPELL_FIREBALL = 9053, + SPELL_FROST_NOVA = 11831, + SPELL_IDOL_SHUTDOWN_VISUAL = 12774, // Hits Unit Entry: 8662 + SPELL_IDOM_ROOM_CAMERA_SHAKE = 12816 // Dummy needs scripting +}; + +class npc_belnistrasz : public CreatureScript { public: - go_gong() : GameObjectScript("go_gong") { } + npc_belnistrasz() : CreatureScript("npc_belnistrasz") { } - bool OnGossipHello(Player* /*player*/, GameObject* go) OVERRIDE + struct npc_belnistraszAI : public ScriptedAI { - //basic support, not blizzlike data is missing... - InstanceScript* instance = go->GetInstanceScript(); + npc_belnistraszAI(Creature* creature) : ScriptedAI(creature) + { + instance = creature->GetInstanceScript(); + eventInProgress = false; + } - if (instance) + void Reset() OVERRIDE { - instance->SetData(DATA_GONG_WAVES, instance->GetData(DATA_GONG_WAVES)+1); - return true; + if (!eventInProgress) + { + if (!me->HasAura(SPELL_ARCANE_INTELLECT)) + DoCast(me, SPELL_ARCANE_INTELLECT); + + channeling = false; + eventProgress = 0; + spawnerCount = 0; + me->SetFlag(UNIT_NPC_FLAGS, GOSSIP_OPTION_QUESTGIVER); + } } - return false; + void EnterCombat(Unit* who) OVERRIDE + { + if (channeling) + { + Talk(SAY_WATCH_OUT, who->GetGUID()); + } + else + { + events.ScheduleEvent(EVENT_FIREBALL, 1000); + events.ScheduleEvent(EVENT_FROST_NOVA, urand(8000, 12000)); + if (urand(0, 100) > 40) + Talk(SAY_AGGRO, who->GetGUID()); + } + } + + void JustDied(Unit* /*killer*/) OVERRIDE + { + instance->SetBossState(DATA_EXTINGUISHING_THE_IDOL, DONE); + me->DespawnOrUnsummon(5000); + } + + void sQuestAccept(Player* /*player*/, Quest const* quest) OVERRIDE + { + if (quest->GetQuestId() == QUEST_EXTINGUISHING_THE_IDOL) + { + eventInProgress = true; + Talk(SAY_QUEST_ACCEPTED); + me->RemoveFlag(UNIT_NPC_FLAGS, GOSSIP_OPTION_QUESTGIVER); + me->setFaction(FACTION_ESCORT); + me->GetMotionMaster()->MovePath(PATH_ESCORT, false); + } + } + + void MovementInform(uint32 type, uint32 id) OVERRIDE + { + if (type == WAYPOINT_MOTION_TYPE && id == POINT_REACH_IDOL) + { + channeling = true; + events.ScheduleEvent(EVENT_CHANNEL, 2000); + } + } + + void UpdateAI(uint32 diff) OVERRIDE + { + if (!eventInProgress) + return; + + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_CHANNEL: + Talk(SAY_EVENT_START); + DoCast(me, SPELL_IDOL_SHUTDOWN_VISUAL); + events.ScheduleEvent(EVENT_IDOL_ROOM_SPAWNER, 100); + events.ScheduleEvent(EVENT_PROGRESS, 120000); + break; + case EVENT_IDOL_ROOM_SPAWNER: + if (Creature* creature = me->SummonCreature(NPC_IDOL_ROOM_SPAWNER, PosSummonSpawner[urand(0,2)], TEMPSUMMON_TIMED_DESPAWN, 4000)) + creature->AI()->SetData(0,spawnerCount); + if (++spawnerCount < 8) + events.ScheduleEvent(EVENT_IDOL_ROOM_SPAWNER, 35000); + break; + case EVENT_PROGRESS: + { + switch (eventProgress) + { + case 0: + Talk(SAY_EVENT_THREE_MIN_LEFT); + ++eventProgress; + events.ScheduleEvent(EVENT_PROGRESS, 60000); + break; + case 1: + Talk(SAY_EVENT_TWO_MIN_LEFT); + ++eventProgress; + events.ScheduleEvent(EVENT_PROGRESS, 60000); + break; + case 2: + Talk(SAY_EVENT_ONE_MIN_LEFT); + ++eventProgress; + events.ScheduleEvent(EVENT_PROGRESS, 60000); + break; + case 3: + events.CancelEvent(EVENT_IDOL_ROOM_SPAWNER); + me->InterruptSpell(CURRENT_CHANNELED_SPELL); + Talk(SAY_EVENT_END); + events.ScheduleEvent(EVENT_COMPLETE, 3000); + break; + } + break; + } + case EVENT_COMPLETE: + { + DoCast(me, SPELL_IDOM_ROOM_CAMERA_SHAKE); + me->SummonGameObject(GO_BELNISTRASZS_BRAZIER, 2577.196f, 947.0781f, 53.16757f, 2.356195f, 0, 0, 0.9238796f, 0.3826832f, 3600000); + std::list<WorldObject*> ClusterList; + Trinity::AllWorldObjectsInRange objects(me, 50.0f); + Trinity::WorldObjectListSearcher<Trinity::AllWorldObjectsInRange> searcher(me, ClusterList, objects); + me->VisitNearbyObject(50.0f, searcher); + for (std::list<WorldObject*>::const_iterator itr = ClusterList.begin(); itr != ClusterList.end(); ++itr) + { + if (Player* player = (*itr)->ToPlayer()) + { + if (player->GetQuestStatus(QUEST_EXTINGUISHING_THE_IDOL) == QUEST_STATUS_INCOMPLETE) + player->CompleteQuest(QUEST_EXTINGUISHING_THE_IDOL); + } + else if (GameObject* go = (*itr)->ToGameObject()) + { + if (go->GetEntry() == GO_IDOL_OVEN_FIRE || go->GetEntry() == GO_IDOL_CUP_FIRE || go->GetEntry() == GO_IDOL_MOUTH_FIRE) + go->Delete(); + } + } + instance->SetBossState(DATA_EXTINGUISHING_THE_IDOL, DONE); + me->DespawnOrUnsummon(); + break; + } + case EVENT_FIREBALL: + if (me->HasUnitState(UNIT_STATE_CASTING) || !UpdateVictim()) + return; + DoCastVictim(SPELL_FIREBALL); + events.ScheduleEvent(EVENT_FIREBALL, 8000); + break; + case EVENT_FROST_NOVA: + if (me->HasUnitState(UNIT_STATE_CASTING) || !UpdateVictim()) + return; + DoCast(me, SPELL_FROST_NOVA); + events.ScheduleEvent(EVENT_FROST_NOVA, 15000); + break; + } + } + if (!channeling) + DoMeleeAttackIfReady(); + } + + private: + InstanceScript* instance; + EventMap events; + bool eventInProgress; + bool channeling; + uint8 eventProgress; + uint8 spawnerCount; + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return new npc_belnistraszAI(creature); } +}; + +class npc_idol_room_spawner : public CreatureScript +{ +public: + npc_idol_room_spawner() : CreatureScript("npc_idol_room_spawner") { } + + struct npc_idol_room_spawnerAI : public ScriptedAI + { + npc_idol_room_spawnerAI(Creature* creature) : ScriptedAI(creature) + { + instance = creature->GetInstanceScript(); + } + + void Reset() OVERRIDE { } + void SetData(uint32 /*type*/, uint32 data) OVERRIDE + { + if (!instance) + return; + + if (data < 7) + { + me->SummonCreature(NPC_WITHERED_BATTLE_BOAR, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); + if (data > 0 && me->GetOrientation() < 4.0f) + me->SummonCreature(NPC_WITHERED_BATTLE_BOAR, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); + me->SummonCreature(NPC_DEATHS_HEAD_GEOMANCER, me->GetPositionX() + (cos(me->GetOrientation() - (M_PI/2)) * 2), me->GetPositionY() + (sin(me->GetOrientation() - (M_PI/2)) * 2), me->GetPositionZ(), me->GetOrientation()); + me->SummonCreature(NPC_WITHERED_QUILGUARD, me->GetPositionX() + (cos(me->GetOrientation() + (M_PI/2)) * 2), me->GetPositionY() + (sin(me->GetOrientation() + (M_PI/2)) * 2), me->GetPositionZ(), me->GetOrientation()); + } + else if (data == 7) + me->SummonCreature(NPC_PLAGUEMAW_THE_ROTTING, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); + } + + private: + InstanceScript* instance; + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return new npc_idol_room_spawnerAI(creature); + } }; enum TombCreature { + EVENT_WEB = 7, + SPELL_POISON_PROC = 3616, + SPELL_VIRULENT_POISON_PROC = 12254, SPELL_WEB = 745 }; @@ -135,11 +379,6 @@ class npc_tomb_creature : public CreatureScript public: npc_tomb_creature() : CreatureScript("npc_tomb_creature") { } - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_tomb_creatureAI(creature); - } - struct npc_tomb_creatureAI : public ScriptedAI { npc_tomb_creatureAI(Creature* creature) : ScriptedAI(creature) @@ -147,45 +386,86 @@ public: instance = creature->GetInstanceScript(); } - InstanceScript* instance; + void Reset() OVERRIDE + { + if (!me->HasAura(SPELL_POISON_PROC) && me->GetEntry() == NPC_TOMB_FIEND) + DoCast(me, SPELL_POISON_PROC); - uint32 uiWebTimer; + if (!me->HasAura(SPELL_VIRULENT_POISON_PROC) && me->GetEntry() == NPC_TOMB_REAVER) + DoCast(me, SPELL_VIRULENT_POISON_PROC); + } - void Reset() OVERRIDE + void JustDied(Unit* /*killer*/) OVERRIDE + { + if (instance) + instance->SetData(DATA_WAVE, me->GetEntry()); + } + + void EnterCombat(Unit* /*who*/) OVERRIDE { - uiWebTimer = urand(5000, 8000); + events.ScheduleEvent(EVENT_WEB, urand(5000, 8000)); } - void UpdateAI(uint32 uiDiff) OVERRIDE + void UpdateAI(uint32 diff) OVERRIDE { if (!UpdateVictim()) return; - //from acid - if (me->GetEntry() == NPC_TOMB_REAVER) + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) { - if (uiWebTimer <= uiDiff) + switch (eventId) { - DoCastVictim(SPELL_WEB); - uiWebTimer = urand(7000, 16000); - } else uiWebTimer -= uiDiff; + case EVENT_WEB: + DoCastVictim(SPELL_WEB); + events.ScheduleEvent(EVENT_WEB, urand(7000, 16000)); + break; + } } - DoMeleeAttackIfReady(); } - void JustDied(Unit* /*killer*/) OVERRIDE + private: + InstanceScript* instance; + EventMap events; + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return new npc_tomb_creatureAI(creature); + } +}; + +/*###### +## go_gong +######*/ + +class go_gong : public GameObjectScript +{ +public: + go_gong() : GameObjectScript("go_gong") { } + + bool OnGossipHello(Player* /*player*/, GameObject* go) OVERRIDE + { + InstanceScript* instance = go->GetInstanceScript(); + + if (instance) { - if (instance) - instance->SetData(DATA_GONG_WAVES, instance->GetData(DATA_GONG_WAVES)+1); + go->SendCustomAnim(0); + instance->SetData(DATA_WAVE, IN_PROGRESS); + return true; } - }; + return false; + } }; void AddSC_razorfen_downs() { new npc_henry_stern(); - new go_gong(); + new npc_belnistrasz(); + new npc_idol_room_spawner(); new npc_tomb_creature(); + new go_gong(); } diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.h b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.h index c0f63474f23..9fe5314fda0 100644 --- a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.h +++ b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.h @@ -18,27 +18,56 @@ #ifndef DEF_RAZORFEN_DOWNS_H #define DEF_RAZORFEN_DOWNS_H -enum Data +#define RFDScriptName "instance_razorfen_downs" + +uint32 const EncounterCount = 5; + +enum DataTypes { - BOSS_TUTEN_KASH, - DATA_GONG_WAVES + // Main Bosses + DATA_TUTEN_KASH = 0, + DATA_MORDRESH_FIRE_EYE = 1, + DATA_GLUTTON = 2, + DATA_AMNENNAR_THE_COLD_BRINGER = 3, + // Events + DATA_GONG = 4, + DATA_WAVE = 5, + DATA_EXTINGUISHING_THE_IDOL = 6 }; -enum Data64 +enum CreatureIds { - DATA_GONG + // Used in Tuten Kash summon event + NPC_TOMB_FIEND = 7349, + NPC_TOMB_REAVER = 7351, + NPC_TUTEN_KASH = 7355, + // Used for quest 3525 "Extinguishing the Idol" + NPC_IDOL_ROOM_SPAWNER = 8611, + NPC_WITHERED_BATTLE_BOAR = 7333, + NPC_DEATHS_HEAD_GEOMANCER = 7335, + NPC_WITHERED_QUILGUARD = 7329, + NPC_PLAGUEMAW_THE_ROTTING = 7356 }; enum GameObjectIds { - GO_GONG = 148917 + // Used for Tuten Kash summon event + GO_GONG = 148917, + // Used for quest 3525 "Extinguishing the Idol" + GO_IDOL_OVEN_FIRE = 151951, + GO_IDOL_CUP_FIRE = 151952, + GO_IDOL_MOUTH_FIRE = 151973, + GO_BELNISTRASZS_BRAZIER = 152097 }; -enum CreatureId +template<class AI> +CreatureAI* GetRazorfenDownsAI(Creature* creature) { - NPC_TOMB_FIEND = 7349, - NPC_TOMB_REAVER = 7351, - NPC_TUTEN_KASH = 7355 -}; + if (InstanceMap* instance = creature->GetMap()->ToInstanceMap()) + if (instance->GetInstanceScript()) + if (instance->GetScriptId() == sObjectMgr->GetScriptId(RFDScriptName)) + return new AI(creature); + return NULL; +} #endif diff --git a/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp b/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp index 4bf2ed9d8bf..59a24032d5f 100644 --- a/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp +++ b/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp @@ -65,7 +65,7 @@ public: return player; } } - TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance Razorfen Kraul: GetPlayerInMap, but PlayerList is empty!"); + TC_LOG_DEBUG("scripts", "Instance Razorfen Kraul: GetPlayerInMap, but PlayerList is empty!"); return NULL; } diff --git a/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp b/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp index ee8618eacc9..35fea896a10 100644 --- a/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp +++ b/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp @@ -176,6 +176,7 @@ public: void Reset() OVERRIDE { IsMovementActive = false; + TargetTubberGUID = 0; } void MovementInform(uint32 type, uint32 id) OVERRIDE diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp index 53e09c918ea..8dd009cdb32 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp @@ -308,18 +308,15 @@ public: { if (instance) { - Unit* pKri = Unit::GetUnit(*me, instance->GetData64(DATA_KRI)); - Unit* pVem = Unit::GetUnit(*me, instance->GetData64(DATA_VEM)); - switch (urand(0, 2)) { case 0: - if (pKri) - DoCast(pKri, SPELL_HEAL); + if (Creature* kri = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_KRI))) + DoCast(kri, SPELL_HEAL); break; case 1: - if (pVem) - DoCast(pVem, SPELL_HEAL); + if (Creature* vem = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_VEM))) + DoCast(vem, SPELL_HEAL); break; case 2: DoCast(me, SPELL_HEAL); diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp index f98494c7c82..d2b5b5eaf8c 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp @@ -162,7 +162,7 @@ public: { instance = creature->GetInstanceScript(); if (!instance) - TC_LOG_ERROR(LOG_FILTER_TSCR, "No Instance eye_of_cthunAI"); + TC_LOG_ERROR("scripts", "No Instance eye_of_cthunAI"); SetCombatMovement(false); } @@ -470,7 +470,7 @@ public: instance = creature->GetInstanceScript(); if (!instance) - TC_LOG_ERROR(LOG_FILTER_TSCR, "No Instance eye_of_cthunAI"); + TC_LOG_ERROR("scripts", "No Instance eye_of_cthunAI"); } InstanceScript* instance; @@ -922,6 +922,7 @@ public: { eye_tentacleAI(Creature* creature) : ScriptedAI(creature) { + Portal = 0; if (Creature* pPortal = me->SummonCreature(NPC_SMALL_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN)) { pPortal->SetReactState(REACT_PASSIVE); @@ -999,6 +1000,7 @@ public: { SetCombatMovement(false); + Portal = 0; if (Creature* pPortal = me->SummonCreature(NPC_SMALL_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN)) { pPortal->SetReactState(REACT_PASSIVE); @@ -1109,6 +1111,7 @@ public: { SetCombatMovement(false); + Portal = 0; if (Creature* pPortal = me->SummonCreature(NPC_GIANT_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN)) { pPortal->SetReactState(REACT_PASSIVE); @@ -1228,6 +1231,7 @@ public: { SetCombatMovement(false); + Portal = 0; if (Creature* pPortal = me->SummonCreature(NPC_GIANT_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN)) { pPortal->SetReactState(REACT_PASSIVE); diff --git a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp index a6504955f30..812aa5a139f 100644 --- a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp +++ b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp @@ -458,7 +458,7 @@ public: StartEvent(); } - void EnterCombat(Unit* /*who*/)OVERRIDE { } + void EnterCombat(Unit* /*who*/) OVERRIDE { } void StartEvent() { @@ -555,7 +555,7 @@ public: } } else - TC_LOG_ERROR(LOG_FILTER_TSCR, "SD2 ERROR: FlagList is empty!"); + TC_LOG_ERROR("scripts", "SD2 ERROR: FlagList is empty!"); } void UpdateAI(uint32 diff) OVERRIDE diff --git a/src/server/scripts/Kalimdor/zone_mulgore.cpp b/src/server/scripts/Kalimdor/zone_mulgore.cpp index e043f5e5db3..2cc6f4bfb5b 100644 --- a/src/server/scripts/Kalimdor/zone_mulgore.cpp +++ b/src/server/scripts/Kalimdor/zone_mulgore.cpp @@ -284,7 +284,7 @@ public: amountWP = 49; } - void EnterCombat(Unit* /*who*/)OVERRIDE { } + void EnterCombat(Unit* /*who*/) OVERRIDE { } void MovementInform(uint32 type, uint32 id) OVERRIDE { diff --git a/src/server/scripts/Kalimdor/zone_silithus.cpp b/src/server/scripts/Kalimdor/zone_silithus.cpp index 7e580a29d3b..ef1f6466d3b 100644 --- a/src/server/scripts/Kalimdor/zone_silithus.cpp +++ b/src/server/scripts/Kalimdor/zone_silithus.cpp @@ -19,12 +19,11 @@ /* ScriptData SDName: Silithus SD%Complete: 100 -SDComment: Quest support: 7785, 8304, 8507. +SDComment: Quest support: 8304, 8507. SDCategory: Silithus EndScriptData */ /* ContentData -npc_highlord_demitrian npcs_rutgar_and_frankal quest_a_pawn_on_the_eternal_pawn EndContentData */ @@ -36,79 +35,6 @@ EndContentData */ #include "Player.h" /*### -## npc_highlord_demitrian -###*/ - -#define GOSSIP_DEMITRIAN1 "What do you know of it?" -#define GOSSIP_DEMITRIAN2 "I am listening, Demitrian." -#define GOSSIP_DEMITRIAN3 "Continue, please." -#define GOSSIP_DEMITRIAN4 "A battle?" -#define GOSSIP_DEMITRIAN5 "<Nod>" -#define GOSSIP_DEMITRIAN6 "Caught unaware? How?" -#define GOSSIP_DEMITRIAN7 "So what did Ragnaros do next?" - -class npc_highlord_demitrian : public CreatureScript -{ -public: - npc_highlord_demitrian() : CreatureScript("npc_highlord_demitrian") { } - - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) OVERRIDE - { - player->PlayerTalkClass->ClearMenus(); - switch (action) - { - case GOSSIP_ACTION_INFO_DEF: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DEMITRIAN2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - player->SEND_GOSSIP_MENU(6842, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+1: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DEMITRIAN3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - player->SEND_GOSSIP_MENU(6843, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DEMITRIAN4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - player->SEND_GOSSIP_MENU(6844, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DEMITRIAN5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); - player->SEND_GOSSIP_MENU(6867, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DEMITRIAN6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); - player->SEND_GOSSIP_MENU(6868, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+5: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DEMITRIAN7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); - player->SEND_GOSSIP_MENU(6869, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+6: - player->SEND_GOSSIP_MENU(6870, creature->GetGUID()); - - ItemPosCountVec dest; - uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 19016, 1); - if (msg == EQUIP_ERR_OK) - player->StoreNewItem(dest, 19016, true); - break; - } - return true; - } - - bool OnGossipHello(Player* player, Creature* creature) OVERRIDE - { - if (creature->IsQuestGiver()) - player->PrepareQuestMenu(creature->GetGUID()); - - if (player->GetQuestStatus(7785) == QUEST_STATUS_NONE && - (player->HasItemCount(18563, 1, false) || player->HasItemCount(18564, 1, false))) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DEMITRIAN1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - - player->SEND_GOSSIP_MENU(6812, creature->GetGUID()); - return true; - } - -}; - -/*### ## npcs_rutgar_and_frankal ###*/ @@ -1508,7 +1434,6 @@ void AddSC_silithus() new npc_anachronos_quest_trigger(); new npc_anachronos_the_ancient(); new npc_qiraj_war_spawn(); - new npc_highlord_demitrian(); new npcs_rutgar_and_frankal(); new go_wind_stone(); } diff --git a/src/server/scripts/Kalimdor/zone_stonetalon_mountains.cpp b/src/server/scripts/Kalimdor/zone_stonetalon_mountains.cpp index 24390bbaaa5..891879f2ea6 100644 --- a/src/server/scripts/Kalimdor/zone_stonetalon_mountains.cpp +++ b/src/server/scripts/Kalimdor/zone_stonetalon_mountains.cpp @@ -144,7 +144,7 @@ public: summoned->AI()->AttackStart(me); } - void Reset()OVERRIDE { } + void Reset() OVERRIDE { } }; bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) OVERRIDE diff --git a/src/server/scripts/Kalimdor/zone_tanaris.cpp b/src/server/scripts/Kalimdor/zone_tanaris.cpp index 84fe734eb09..5e27d71ea07 100644 --- a/src/server/scripts/Kalimdor/zone_tanaris.cpp +++ b/src/server/scripts/Kalimdor/zone_tanaris.cpp @@ -500,7 +500,7 @@ public: } } - void Reset()OVERRIDE { } + void Reset() OVERRIDE { } void EnterCombat(Unit* /*who*/) OVERRIDE { diff --git a/src/server/scripts/Northrend/CMakeLists.txt b/src/server/scripts/Northrend/CMakeLists.txt index 3c56361d096..285f8f866cb 100644 --- a/src/server/scripts/Northrend/CMakeLists.txt +++ b/src/server/scripts/Northrend/CMakeLists.txt @@ -45,6 +45,7 @@ set(scripts_STAT_SRCS Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.h Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp + Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.cpp Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.h Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp index 2088ef2fa2e..a212a74df86 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp @@ -37,9 +37,6 @@ enum Enums SAY_SARTHARION_SLAY = 8, WHISPER_LAVA_CHURN = 9, - WHISPER_HATCH_EGGS = 6, - WHISPER_OPEN_PORTAL = 6, // whisper, shared by two dragons - WHISPER_SHADRON_DICIPLE = 7, WHISPER_VESPERON_DICIPLE = 7, @@ -58,70 +55,25 @@ enum Enums SPELL_PYROBUFFET = 56916, // currently used for hard enrage after 15 minutes SPELL_PYROBUFFET_RANGE = 58907, // possibly used when player get too far away from dummy creatures (2x Creature entry 30494) - SPELL_TWILIGHT_SHIFT_ENTER = 57620, // enter phase. Player get this when click GO - SPELL_TWILIGHT_SHIFT = 57874, // Twilight Shift Aura - SPELL_TWILIGHT_SHIFT_REMOVAL = 61187, // leave phase - SPELL_TWILIGHT_SHIFT_REMOVAL_ALL = 61190, // leave phase (probably version to make all leave) - - //Mini bosses common spells - SPELL_TWILIGHT_RESIDUE = 61885, // makes immune to shadow damage, applied when leave phase - - //Miniboses (Vesperon, Shadron, Tenebron) - SPELL_SHADOW_BREATH_H = 59126, // Inflicts 8788 to 10212 Fire damage to enemies in a cone in front of the caster. - SPELL_SHADOW_BREATH = 57570, // Inflicts 6938 to 8062 Fire damage to enemies in a cone in front of the caster. - - SPELL_SHADOW_FISSURE_H = 59127, // Deals 9488 to 13512 Shadow damage to any enemy within the Shadow fissure after 5 sec. - SPELL_SHADOW_FISSURE = 57579, // Deals 6188 to 8812 Shadow damage to any enemy within the Shadow fissure after 5 sec. - //Vesperon //In portal is a disciple, when disciple killed remove Power_of_vesperon, portal open multiple times NPC_ACOLYTE_OF_VESPERON = 31219, // Acolyte of Vesperon SPELL_POWER_OF_VESPERON = 61251, // Vesperon's presence decreases the maximum health of all enemies by 25%. - SPELL_TWILIGHT_TORMENT_VESP = 57948, // (Shadow only) trigger 57935 then 57988 - SPELL_TWILIGHT_TORMENT_VESP_ACO = 58853, // (Fire and Shadow) trigger 58835 then 57988 //Shadron //In portal is a disciple, when disciple killed remove Power_of_vesperon, portal open multiple times NPC_ACOLYTE_OF_SHADRON = 31218, // Acolyte of Shadron SPELL_POWER_OF_SHADRON = 58105, // Shadron's presence increases Fire damage taken by all enemies by 100%. - SPELL_GIFT_OF_TWILIGTH_SHA = 57835, // TARGET_SCRIPT shadron - SPELL_GIFT_OF_TWILIGTH_SAR = 58766, // TARGET_SCRIPT sartharion - SPELL_VOID_BLAST = 57581, // Twilight Fissure - SPELL_VOID_BLAST_H = 59128, //Tenebron //in the portal spawns 6 eggs, if not killed in time (approx. 20s) they will hatch, whelps can cast 60708 SPELL_POWER_OF_TENEBRON = 61248, // Tenebron's presence increases Shadow damage taken by all enemies by 100%. - //Tenebron, dummy spell - SPELL_SUMMON_TWILIGHT_WHELP = 58035, // doesn't work, will spawn NPC_TWILIGHT_WHELP - SPELL_SUMMON_SARTHARION_TWILIGHT_WHELP = 58826, // doesn't work, will spawn NPC_SHARTHARION_TWILIGHT_WHELP - - SPELL_HATCH_EGGS_H = 59189, - SPELL_HATCH_EGGS = 58542, - SPELL_HATCH_EGGS_EFFECT_H = 59190, - SPELL_HATCH_EGGS_EFFECT = 58685, - NPC_TWILIHT_WHELP = 31214, - NPC_TWILIGHT_EGG = 30882, - NPC_SARTHARION_TWILIGHT_EGG = 31204, - - //Whelps - NPC_TWILIGHT_WHELP = 30890, - NPC_SHARTHARION_TWILIGHT_WHELP = 31214, - SPELL_FADE_ARMOR = 60708, // Reduces the armor of an enemy by 1500 for 15s - - //flame tsunami - SPELL_FLAME_TSUNAMI = 57494, // the visual dummy - SPELL_FLAME_TSUNAMI_LEAP = 60241, // SPELL_EFFECT_138 some leap effect, causing caster to move in direction - - SPELL_FLAME_TSUNAMI_DMG_AURA = 57491, // periodic damage, npc has this aura - SPELL_FLAME_TSUNAMI_BUFF = 60430, NPC_FLAME_TSUNAMI = 30616, // for the flame waves - NPC_LAVA_BLAZE = 30643, // adds spawning from flame strike //using these custom points for dragons start and end POINT_ID_INIT = 100, - POINT_ID_LAND = 200, + POINT_ID_LAND = 200 }; enum Misc @@ -129,25 +81,32 @@ enum Misc DATA_CAN_LOOT = 0 }; -struct Waypoint -{ - float m_fX, m_fY, m_fZ; -}; - struct Location { float x, y, z; }; -struct Locations + +static Location FlameRight1Spawn = { 3200.00f, 573.211f, 57.1551f }; +static Location FlameRight1Direction = { 3289.28f, 573.211f, 57.1551f }; +static Location FlameRight2Spawn = { 3200.00f, 532.211f, 57.1551f }; +static Location FlameRight2Direction = { 3289.28f, 532.211f, 57.1551f }; +static Location FlameRight3Spawn = { 3200.00f, 491.211f, 57.1551f }; +static Location FlameRight3Direction = { 3289.28f, 491.211f, 57.1551f }; +static Location FlameLeft1Spawn = { 3289.28f, 511.711f, 57.1551f }; +static Location FlameLeft1Direction = { 3200.00f, 511.711f, 57.1551f }; +static Location FlameLeft2Spawn = { 3289.28f, 552.711f, 57.1551f }; +static Location FlameLeft2Direction = { 3200.00f, 552.711f, 57.1551f }; + +struct Waypoint { - float x, y, z; + float m_fX, m_fY, m_fZ; }; //each dragons special points. First where fly to before connect to connon, second where land point is. Waypoint m_aTene[]= { - {3212.854f, 575.597f, 109.856f}, //init - {3246.425f, 565.367f, 61.249f} //end + {3212.854f, 575.597f, 109.856f}, // init + {3246.425f, 565.367f, 61.249f} // end }; Waypoint m_aShad[]= @@ -162,54 +121,19 @@ Waypoint m_aVesp[]= {3227.268f, 533.238f, 59.995f} }; -#define MAX_WAYPOINT 6 -//points around raid "isle", counter clockwise. should probably be adjusted to be more alike -Waypoint m_aDragonCommon[MAX_WAYPOINT]= +enum SartharionEvents { - {3214.012f, 468.932f, 98.652f}, - {3244.950f, 468.427f, 98.652f}, - {3283.520f, 496.869f, 98.652f}, - {3287.316f, 555.875f, 98.652f}, - {3250.479f, 585.827f, 98.652f}, - {3209.969f, 566.523f, 98.652f} + EVENT_HARD_ENRAGE = 1, + EVENT_FLAME_TSUNAMI = 2, + EVENT_FLAME_BREATH = 3, + EVENT_TAIL_SWEEP = 4, + EVENT_CLEAVE_ATTACK = 5, + EVENT_LAVA_STRIKE = 6, + EVENT_CALL_TENEBRON = 7, + EVENT_CALL_SHADRON = 8, + EVENT_CALL_VESPERON = 9 }; -static Location FlameRight1Spawn = { 3200.00f, 573.211f, 57.1551f }; -static Location FlameRight1Direction = { 3289.28f, 573.211f, 57.1551f }; -static Location FlameRight2Spawn = { 3200.00f, 532.211f, 57.1551f }; -static Location FlameRight2Direction = { 3289.28f, 532.211f, 57.1551f }; -static Location FlameRight3Spawn = { 3200.00f, 491.211f, 57.1551f }; -static Location FlameRight3Direction = { 3289.28f, 491.211f, 57.1551f }; -static Location FlameLeft1Spawn = { 3289.28f, 511.711f, 57.1551f }; -static Location FlameLeft1Direction = { 3200.00f, 511.711f, 57.1551f }; -static Location FlameLeft2Spawn = { 3289.28f, 552.711f, 57.1551f }; -static Location FlameLeft2Direction = { 3200.00f, 552.711f, 57.1551f }; - -static Location AcolyteofShadron = { 3363.92f, 534.703f, 97.2683f }; -static Location AcolyteofShadron2 = { 3246.57f, 551.263f, 58.6164f }; -static Location AcolyteofVesperon = { 3145.68f, 520.71f, 89.7f }; -static Location AcolyteofVesperon2 = { 3246.57f, 551.263f, 58.6164f }; -Locations TwilightEggs[] = -{ - {3219.28f, 669.121f, 88.5549f}, - {3221.55f, 682.852f, 90.5361f}, - {3239.77f, 685.94f, 90.3168f}, - {3250.33f, 669.749f, 88.7637f}, - {3246.6f, 642.365f, 84.8752f}, - {3233.68f, 653.117f, 85.7051f} -}; -Locations TwilightEggsSarth[] = -{ - {3252.73f, 515.762f, 58.5501f}, - {3256.56f, 521.119f, 58.6061f}, - {3255.63f, 527.513f, 58.7568f}, - {3264.90f, 525.865f, 58.6436f}, - {3264.26f, 516.364f, 58.8011f}, - {3257.54f, 502.285f, 58.2077f} -}; - -#define TWILIGHT_ACHIEVEMENTS 1 - /*###### ## Boss Sartharion ######*/ @@ -219,169 +143,71 @@ class boss_sartharion : public CreatureScript public: boss_sartharion() : CreatureScript("boss_sartharion") { } - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new boss_sartharionAI(creature); - } - - struct boss_sartharionAI : public ScriptedAI + struct boss_sartharionAI : public BossAI { - boss_sartharionAI(Creature* creature) : ScriptedAI(creature) - { - instance = creature->GetInstanceScript(); - } - - InstanceScript* instance; - - bool m_bIsBerserk; - bool m_bIsSoftEnraged; - - uint32 m_uiEnrageTimer; - bool m_bIsHardEnraged; - - uint32 m_uiTenebronTimer; - uint32 m_uiShadronTimer; - uint32 m_uiVesperonTimer; - - uint32 m_uiFlameTsunamiTimer; - uint32 m_uiFlameBreathTimer; - uint32 m_uiTailSweepTimer; - uint32 m_uiCleaveTimer; - uint32 m_uiLavaStrikeTimer; - - bool m_bHasCalledTenebron; - bool m_bHasCalledShadron; - bool m_bHasCalledVesperon; - - uint8 drakeCount; + boss_sartharionAI(Creature* creature) : BossAI(creature, DATA_SARTHARION) { } void Reset() OVERRIDE { - m_bIsBerserk = false; - m_bIsSoftEnraged = false; - - m_uiEnrageTimer = 15*MINUTE*IN_MILLISECONDS; - m_bIsHardEnraged = false; - - m_uiTenebronTimer = 30000; - m_uiShadronTimer = 75000; - m_uiVesperonTimer = 120000; - - m_uiFlameTsunamiTimer = 30000; - m_uiFlameBreathTimer = 20000; - m_uiTailSweepTimer = 20000; - m_uiCleaveTimer = 7000; - m_uiLavaStrikeTimer = 5000; - - m_bHasCalledTenebron = false; - m_bHasCalledShadron = false; - m_bHasCalledVesperon = false; + _isBerserk = false; + _isSoftEnraged = false; + _isHardEnraged = false; + drakeCount = 0; if (me->HasAura(SPELL_TWILIGHT_REVENGE)) me->RemoveAurasDueToSpell(SPELL_TWILIGHT_REVENGE); me->SetHomePosition(3246.57f, 551.263f, 58.6164f, 4.66003f); - drakeCount = 0; - - // Drakes respawning system if (instance) { - Creature* pTenebron = Unit::GetCreature(*me, instance->GetData64(DATA_TENEBRON)); - Creature* pShadron = Unit::GetCreature(*me, instance->GetData64(DATA_SHADRON)); - Creature* pVesperon = Unit::GetCreature(*me, instance->GetData64(DATA_VESPERON)); - if (pTenebron) - { - pTenebron->SetHomePosition(3239.07f, 657.235f, 86.8775f, 4.74729f); - if (pTenebron->IsAlive()) - { - if (pTenebron->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - pTenebron->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pTenebron->GetMotionMaster()->MoveTargetedHome(); - }else - { - if (instance->GetData(TYPE_TENEBRON_PREKILLED) == false) - { - pTenebron->Respawn(); - pTenebron->GetMotionMaster()->MoveTargetedHome(); - pTenebron->AI()->SetData(DATA_CAN_LOOT, 0); - } - } - } - if (pShadron) - { - pShadron->SetHomePosition(3363.06f, 525.28f, 98.362f, 4.76475f); - if (pShadron->IsAlive()) - { - if (pShadron->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - pShadron->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pShadron->GetMotionMaster()->MoveTargetedHome(); - }else - { - if (instance->GetData(TYPE_SHADRON_PREKILLED) == false) - { - pShadron->Respawn(); - pShadron->GetMotionMaster()->MoveTargetedHome(); - pShadron->AI()->SetData(DATA_CAN_LOOT, 0); - } - } - } - if (pVesperon) - { - pVesperon->SetHomePosition(3145.68f, 520.71f, 89.7f, 4.64258f); - if (pVesperon->IsAlive()) - { - if (pVesperon->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - pVesperon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pVesperon->GetMotionMaster()->MoveTargetedHome(); - }else - { - if (instance->GetData(TYPE_VESPERON_PREKILLED) == false) - { - pVesperon->Respawn(); - pVesperon->GetMotionMaster()->MoveTargetedHome(); - pVesperon->AI()->SetData(DATA_CAN_LOOT, 0); - } - } - } + DrakeRespawn(); + instance->SetBossState(DATA_PORTAL_OPEN, NOT_STARTED); } } void JustReachedHome() OVERRIDE { - if (instance) - instance->SetData(TYPE_SARTHARION_EVENT, NOT_STARTED); + _Reset(); } void EnterCombat(Unit* /*who*/) OVERRIDE { Talk(SAY_SARTHARION_AGGRO); + _EnterCombat(); DoZoneInCombat(); if (instance) - { - instance->SetData(TYPE_SARTHARION_EVENT, IN_PROGRESS); FetchDragons(); - } + + events.ScheduleEvent(EVENT_LAVA_STRIKE, 5000); + events.ScheduleEvent(EVENT_CLEAVE_ATTACK, 7000); + events.ScheduleEvent(EVENT_FLAME_BREATH, 20000); + events.ScheduleEvent(EVENT_TAIL_SWEEP, 20000); + events.ScheduleEvent(EVENT_FLAME_TSUNAMI, 30000); + events.ScheduleEvent(EVENT_CALL_TENEBRON, 30000); + events.ScheduleEvent(EVENT_CALL_SHADRON, 75000); + events.ScheduleEvent(EVENT_CALL_VESPERON, 120000); } void JustDied(Unit* /*killer*/) OVERRIDE { Talk(SAY_SARTHARION_DEATH); + _JustDied(); if (instance) { - Creature* pTenebron = Unit::GetCreature(*me, instance->GetData64(DATA_TENEBRON)); - Creature* pShadron = Unit::GetCreature(*me, instance->GetData64(DATA_SHADRON)); - Creature* pVesperon = Unit::GetCreature(*me, instance->GetData64(DATA_VESPERON)); - if (pTenebron && pTenebron->IsAlive()) - pTenebron->DisappearAndDie(); - if (pShadron && pShadron->IsAlive()) - pShadron->DisappearAndDie(); - if (pVesperon && pVesperon->IsAlive()) - pVesperon->DisappearAndDie(); - - instance->SetData(TYPE_SARTHARION_EVENT, DONE); + if (Creature* tenebron = Unit::GetCreature(*me, instance->GetData64(DATA_TENEBRON))) + if (tenebron->IsAlive()) + tenebron->DisappearAndDie(); + + if (Creature* shadron = Unit::GetCreature(*me, instance->GetData64(DATA_SHADRON))) + if (shadron->IsAlive()) + shadron->DisappearAndDie(); + + if (Creature* vesperon = Unit::GetCreature(*me, instance->GetData64(DATA_VESPERON))) + if (vesperon->IsAlive()) + vesperon->DisappearAndDie(); } } @@ -402,83 +228,140 @@ public: me->AddLootMode(LOOT_MODE_HARD_MODE_1); // Add 1st Drake loot mode } - uint32 GetData(uint32 type) const OVERRIDE + void DrakeRespawn() // Drakes respawning system { - if (type == TWILIGHT_ACHIEVEMENTS) - return drakeCount; + if (Creature* tenebron = Unit::GetCreature(*me, instance->GetData64(DATA_TENEBRON))) + { + tenebron->SetHomePosition(3239.07f, 657.235f, 86.8775f, 4.74729f); + if (tenebron->IsAlive()) + { + if (tenebron->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + tenebron->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + tenebron->GetMotionMaster()->MoveTargetedHome(); + } + else + { + if (instance->GetBossState(DATA_TENEBRON) != DONE) + { + tenebron->Respawn(); + tenebron->GetMotionMaster()->MoveTargetedHome(); + tenebron->AI()->SetData(DATA_CAN_LOOT, 0); + } + } + } - return 0; + if (Creature* shadron = Unit::GetCreature(*me, instance->GetData64(DATA_SHADRON))) + { + shadron->SetHomePosition(3363.06f, 525.28f, 98.362f, 4.76475f); + if (shadron->IsAlive()) + { + if (shadron->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + shadron->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + shadron->GetMotionMaster()->MoveTargetedHome(); + } + else + { + if (instance->GetBossState(DATA_SHADRON) != DONE) + { + shadron->Respawn(); + shadron->GetMotionMaster()->MoveTargetedHome(); + shadron->AI()->SetData(DATA_CAN_LOOT, 0); + } + } + } + + if (Creature* vesperon = Unit::GetCreature(*me, instance->GetData64(DATA_VESPERON))) + { + vesperon->SetHomePosition(3145.68f, 520.71f, 89.7f, 4.64258f); + if (vesperon->IsAlive()) + { + if (vesperon->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + vesperon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + vesperon->GetMotionMaster()->MoveTargetedHome(); + } + else + { + if (instance->GetBossState(DATA_VESPERON) != DONE) + { + vesperon->Respawn(); + vesperon->GetMotionMaster()->MoveTargetedHome(); + vesperon->AI()->SetData(DATA_CAN_LOOT, 0); + } + } + } } void FetchDragons() { - if (!instance) - return; - me->ResetLootMode(); drakeCount = 0; - Creature* pFetchTene = Unit::GetCreature(*me, instance->GetData64(DATA_TENEBRON)); - Creature* pFetchShad = Unit::GetCreature(*me, instance->GetData64(DATA_SHADRON)); - Creature* pFetchVesp = Unit::GetCreature(*me, instance->GetData64(DATA_VESPERON)); - //if at least one of the dragons are alive and are being called - bool bCanUseWill = false; + bool _canUseWill = false; - if (pFetchTene && pFetchTene->IsAlive() && !pFetchTene->GetVictim()) + if (Creature* fetchTene = Unit::GetCreature(*me, instance->GetData64(DATA_TENEBRON))) { - bCanUseWill = true; - if (!pFetchTene->IsInCombat()) + if (fetchTene->IsAlive() && !fetchTene->GetVictim()) { - DoCast(me, SPELL_POWER_OF_TENEBRON); - AddDrakeLootMode(); - ++drakeCount; - } - pFetchTene->GetMotionMaster()->MovePoint(POINT_ID_INIT, m_aTene[0].m_fX, m_aTene[0].m_fY, m_aTene[0].m_fZ); + _canUseWill = true; + if (!fetchTene->IsInCombat()) + { + DoCast(me, SPELL_POWER_OF_TENEBRON); + AddDrakeLootMode(); + ++drakeCount; + } + fetchTene->GetMotionMaster()->MovePoint(POINT_ID_INIT, m_aTene[0].m_fX, m_aTene[0].m_fY, m_aTene[0].m_fZ); - if (!pFetchTene->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - pFetchTene->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if (!fetchTene->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + fetchTene->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } } - if (pFetchShad && pFetchShad->IsAlive() && !pFetchShad->GetVictim()) + if (Creature* fetchShad = Unit::GetCreature(*me, instance->GetData64(DATA_SHADRON))) { - bCanUseWill = true; - if (!pFetchShad->IsInCombat()) + if (fetchShad->IsAlive() && !fetchShad->GetVictim()) { - DoCast(me, SPELL_POWER_OF_SHADRON); - AddDrakeLootMode(); - ++drakeCount; - } - pFetchShad->GetMotionMaster()->MovePoint(POINT_ID_INIT, m_aShad[0].m_fX, m_aShad[0].m_fY, m_aShad[0].m_fZ); + _canUseWill = true; + if (!fetchShad->IsInCombat()) + { + DoCast(me, SPELL_POWER_OF_SHADRON); + AddDrakeLootMode(); + ++drakeCount; + } + fetchShad->GetMotionMaster()->MovePoint(POINT_ID_INIT, m_aShad[0].m_fX, m_aShad[0].m_fY, m_aShad[0].m_fZ); - if (!pFetchShad->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - pFetchShad->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if (!fetchShad->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + fetchShad->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } } - if (pFetchVesp && pFetchVesp->IsAlive() && !pFetchVesp->GetVictim()) + if (Creature* fetchVesp = Unit::GetCreature(*me, instance->GetData64(DATA_VESPERON))) { - bCanUseWill = true; - if (!pFetchVesp->IsInCombat()) + if (fetchVesp && fetchVesp->IsAlive() && !fetchVesp->GetVictim()) { - DoCast(me, SPELL_POWER_OF_VESPERON); - AddDrakeLootMode(); - ++drakeCount; - } - pFetchVesp->GetMotionMaster()->MovePoint(POINT_ID_INIT, m_aVesp[0].m_fX, m_aVesp[0].m_fY, m_aVesp[0].m_fZ); + _canUseWill = true; + if (!fetchVesp->IsInCombat()) + { + DoCast(me, SPELL_POWER_OF_VESPERON); + AddDrakeLootMode(); + ++drakeCount; + } + fetchVesp->GetMotionMaster()->MovePoint(POINT_ID_INIT, m_aVesp[0].m_fX, m_aVesp[0].m_fY, m_aVesp[0].m_fZ); - if (!pFetchVesp->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - pFetchVesp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if (!fetchVesp->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + fetchVesp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } } - if (bCanUseWill) + if (_canUseWill) DoCast(me, SPELL_WILL_OF_SARTHARION); } - void CallDragon(uint32 uiDataId) + void CallDragon(uint32 dataId) { if (instance) { - if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(uiDataId))) + if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(dataId))) { if (temp->IsAlive() && !temp->GetVictim()) { @@ -487,33 +370,41 @@ public: if (temp->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) temp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - int32 iTextId = 0; + int32 textId = 0; switch (temp->GetEntry()) { case NPC_TENEBRON: - iTextId = SAY_SARTHARION_CALL_TENEBRON; + textId = SAY_SARTHARION_CALL_TENEBRON; temp->AddAura(SPELL_POWER_OF_TENEBRON, temp); temp->GetMotionMaster()->MovePoint(POINT_ID_LAND, m_aTene[1].m_fX, m_aTene[1].m_fY, m_aTene[1].m_fZ); break; case NPC_SHADRON: - iTextId = SAY_SARTHARION_CALL_SHADRON; + textId = SAY_SARTHARION_CALL_SHADRON; temp->AddAura(SPELL_POWER_OF_SHADRON, temp); temp->GetMotionMaster()->MovePoint(POINT_ID_LAND, m_aShad[1].m_fX, m_aShad[1].m_fY, m_aShad[1].m_fZ); break; case NPC_VESPERON: - iTextId = SAY_SARTHARION_CALL_VESPERON; + textId = SAY_SARTHARION_CALL_VESPERON; temp->AddAura(SPELL_POWER_OF_VESPERON, temp); temp->GetMotionMaster()->MovePoint(POINT_ID_LAND, m_aVesp[1].m_fX, m_aVesp[1].m_fY, m_aVesp[1].m_fZ); break; } - Talk(iTextId); + Talk(textId); } } } } + uint32 GetData(uint32 type) const OVERRIDE + { + if (type == TWILIGHT_ACHIEVEMENTS) + return drakeCount; + + return 0; + } + void SendFlameTsunami() { if (Map* map = me->GetMap()) @@ -532,16 +423,16 @@ public: // FIXME: Frequency of the casts reduced to compensate 100% chance of spawning a Lava Blaze add void CastLavaStrikeOnTarget(Unit* target) { - std::list<Creature*> pFireCyclonesList; + std::list<Creature*> fireCyclonesList; Trinity::AllCreaturesOfEntryInRange checker(me, NPC_FIRE_CYCLONE, 200.0f); - Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(me, pFireCyclonesList, checker); + Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(me, fireCyclonesList, checker); me->VisitNearbyObject(200.0f, searcher); - if (pFireCyclonesList.empty()) + if (fireCyclonesList.empty()) return; - std::list<Creature*>::iterator itr = pFireCyclonesList.begin(); - uint32 rnd = rand()%pFireCyclonesList.size(); + std::list<Creature*>::iterator itr = fireCyclonesList.begin(); + uint32 rnd = rand()%fireCyclonesList.size(); for (uint32 i = 0; i < rnd; ++i) ++itr; @@ -549,1224 +440,121 @@ public: (*itr)->CastSpell(target, SPELL_LAVA_STRIKE, true); } - void UpdateAI(uint32 uiDiff) OVERRIDE + void UpdateAI(uint32 diff) OVERRIDE { - //Return since we have no target if (!UpdateVictim()) return; - Unit* pTene = Unit::GetUnit(*me, instance ? instance->GetData64(DATA_TENEBRON) : 0); - Unit* pShad = Unit::GetUnit(*me, instance ? instance->GetData64(DATA_SHADRON) : 0); - Unit* pVesp = Unit::GetUnit(*me, instance ? instance->GetData64(DATA_VESPERON) : 0); - - //spell will target dragons, if they are still alive at 35% - if (!m_bIsBerserk && !HealthAbovePct(35) - && ((pTene && pTene->IsAlive()) || (pShad && pShad->IsAlive()) || (pVesp && pVesp->IsAlive()))) - { - Talk(SAY_SARTHARION_BERSERK); - DoCast(me, SPELL_BERSERK); - m_bIsBerserk = true; - } + events.Update(diff); - //soft enrage - if (!m_bIsSoftEnraged && HealthBelowPct(10)) + while (uint32 eventId = events.ExecuteEvent()) { - // m_bIsSoftEnraged is used while determining Lava Strike cooldown. - m_bIsSoftEnraged = true; - } - - // hard enrage - if (!m_bIsHardEnraged) - { - if (m_uiEnrageTimer <= uiDiff) + switch (eventId) { - DoCast(me, SPELL_PYROBUFFET, true); - m_bIsHardEnraged = true; - } - else - m_uiEnrageTimer -= uiDiff; - } - - // flame tsunami - if (m_uiFlameTsunamiTimer <= uiDiff) - { - SendFlameTsunami(); - switch (urand(0, 1)) - { - case 0: - { - Creature* Right1 = me->SummonCreature(NPC_FLAME_TSUNAMI, FlameRight1Spawn.x, FlameRight1Spawn.y, FlameRight1Spawn.z, 0, TEMPSUMMON_TIMED_DESPAWN, 12000); - Creature* Right2 = me->SummonCreature(NPC_FLAME_TSUNAMI, FlameRight2Spawn.x, FlameRight2Spawn.y, FlameRight2Spawn.z, 0, TEMPSUMMON_TIMED_DESPAWN, 12000); - Creature* Right3 = me->SummonCreature(NPC_FLAME_TSUNAMI, FlameRight3Spawn.x, FlameRight3Spawn.y, FlameRight3Spawn.z, 0, TEMPSUMMON_TIMED_DESPAWN, 12000); - Right1->GetMotionMaster()->MovePoint(0, FlameRight1Direction.x, FlameRight1Direction.y, FlameRight1Direction.z); - Right2->GetMotionMaster()->MovePoint(0, FlameRight2Direction.x, FlameRight2Direction.y, FlameRight2Direction.z); - Right3->GetMotionMaster()->MovePoint(0, FlameRight3Direction.x, FlameRight3Direction.y, FlameRight3Direction.z); + case EVENT_HARD_ENRAGE: + if (!_isHardEnraged) + { + DoCast(me, SPELL_PYROBUFFET, true); + _isHardEnraged = true; + } break; - } - case 1: - { - Creature* Left1 = me->SummonCreature(NPC_FLAME_TSUNAMI, FlameLeft1Spawn.x, FlameLeft1Spawn.y, FlameLeft1Spawn.z, 0, TEMPSUMMON_TIMED_DESPAWN, 12000); - Creature* Left2 = me->SummonCreature(NPC_FLAME_TSUNAMI, FlameLeft2Spawn.x, FlameLeft2Spawn.y, FlameLeft2Spawn.z, 0, TEMPSUMMON_TIMED_DESPAWN, 12000); - Left1->GetMotionMaster()->MovePoint(0, FlameLeft1Direction.x, FlameLeft1Direction.y, FlameLeft1Direction.z); - Left2->GetMotionMaster()->MovePoint(0, FlameLeft2Direction.x, FlameLeft2Direction.y, FlameLeft2Direction.z); + case EVENT_FLAME_TSUNAMI: + SendFlameTsunami(); + switch (urand(0, 1)) + { + case 0: + { + if (Creature* right1 = me->SummonCreature(NPC_FLAME_TSUNAMI, FlameRight1Spawn.x, FlameRight1Spawn.y, FlameRight1Spawn.z, 0, TEMPSUMMON_TIMED_DESPAWN, 12000)) + right1->GetMotionMaster()->MovePoint(0, FlameRight1Direction.x, FlameRight1Direction.y, FlameRight1Direction.z); + if (Creature* right2 = me->SummonCreature(NPC_FLAME_TSUNAMI, FlameRight2Spawn.x, FlameRight2Spawn.y, FlameRight2Spawn.z, 0, TEMPSUMMON_TIMED_DESPAWN, 12000)) + right2->GetMotionMaster()->MovePoint(0, FlameRight2Direction.x, FlameRight2Direction.y, FlameRight2Direction.z); + if (Creature* right3 = me->SummonCreature(NPC_FLAME_TSUNAMI, FlameRight3Spawn.x, FlameRight3Spawn.y, FlameRight3Spawn.z, 0, TEMPSUMMON_TIMED_DESPAWN, 12000)) + right3->GetMotionMaster()->MovePoint(0, FlameRight3Direction.x, FlameRight3Direction.y, FlameRight3Direction.z); + break; + } + case 1: + { + if (Creature* left1 = me->SummonCreature(NPC_FLAME_TSUNAMI, FlameLeft1Spawn.x, FlameLeft1Spawn.y, FlameLeft1Spawn.z, 0, TEMPSUMMON_TIMED_DESPAWN, 12000)) + left1->GetMotionMaster()->MovePoint(0, FlameLeft1Direction.x, FlameLeft1Direction.y, FlameLeft1Direction.z); + if (Creature* left2 = me->SummonCreature(NPC_FLAME_TSUNAMI, FlameLeft2Spawn.x, FlameLeft2Spawn.y, FlameLeft2Spawn.z, 0, TEMPSUMMON_TIMED_DESPAWN, 12000)) + left2->GetMotionMaster()->MovePoint(0, FlameLeft2Direction.x, FlameLeft2Direction.y, FlameLeft2Direction.z); + break; + } + } + events.ScheduleEvent(EVENT_FLAME_TSUNAMI, 30000); break; - } - } - - m_uiFlameTsunamiTimer = 30000; - } - else - m_uiFlameTsunamiTimer -= uiDiff; - - // flame breath - if (m_uiFlameBreathTimer <= uiDiff) - { - Talk(SAY_SARTHARION_BREATH); - DoCastVictim(RAID_MODE(SPELL_FLAME_BREATH, SPELL_FLAME_BREATH_H)); - m_uiFlameBreathTimer = urand(25000, 35000); - } - else - m_uiFlameBreathTimer -= uiDiff; - - // Tail Sweep - if (m_uiTailSweepTimer <= uiDiff) - { - DoCastVictim(RAID_MODE(SPELL_TAIL_LASH, SPELL_TAIL_LASH_H)); - m_uiTailSweepTimer = urand(15000, 20000); - } - else - m_uiTailSweepTimer -= uiDiff; - - // Cleave - if (m_uiCleaveTimer <= uiDiff) - { - DoCastVictim(SPELL_CLEAVE); - m_uiCleaveTimer = urand(7000, 10000); - } - else - m_uiCleaveTimer -= uiDiff; - - // Lavas Strike - if (m_uiLavaStrikeTimer <= uiDiff) - { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - { - CastLavaStrikeOnTarget(target); - - if (urand(0, 5) == 0) - Talk(SAY_SARTHARION_SPECIAL); - } - m_uiLavaStrikeTimer = (m_bIsSoftEnraged ? urand(1400, 2000) : urand(5000, 20000)); - } - else - m_uiLavaStrikeTimer -= uiDiff; - - // call tenebron - if (!m_bHasCalledTenebron && m_uiTenebronTimer <= uiDiff) - { - CallDragon(DATA_TENEBRON); - m_bHasCalledTenebron = true; - } - else - m_uiTenebronTimer -= uiDiff; - - // call shadron - if (!m_bHasCalledShadron && m_uiShadronTimer <= uiDiff) - { - CallDragon(DATA_SHADRON); - m_bHasCalledShadron = true; - } - else - m_uiShadronTimer -= uiDiff; - - // call vesperon - if (!m_bHasCalledVesperon && m_uiVesperonTimer <= uiDiff) - { - CallDragon(DATA_VESPERON); - m_bHasCalledVesperon = true; - } - else - m_uiVesperonTimer -= uiDiff; - - DoMeleeAttackIfReady(); - - EnterEvadeIfOutOfCombatArea(uiDiff); - } - }; - -}; - -enum TeneText -{ - SAY_TENEBRON_AGGRO = 0, - SAY_TENEBRON_SLAY = 1, - SAY_TENEBRON_DEATH = 2, - SAY_TENEBRON_BREATH = 3, - SAY_TENEBRON_RESPOND = 4, - SAY_TENEBRON_SPECIAL = 5 -}; - -enum ShadText -{ - SAY_SHADRON_AGGRO = 0, - SAY_SHADRON_SLAY = 1, - SAY_SHADRON_DEATH = 2, - SAY_SHADRON_BREATH = 3, - SAY_SHADRON_RESPOND = 4, - SAY_SHADRON_SPECIAL = 5 -}; - -enum VespText -{ - SAY_VESPERON_AGGRO = 0, - SAY_VESPERON_SLAY = 1, - SAY_VESPERON_DEATH = 2, - SAY_VESPERON_BREATH = 3, - SAY_VESPERON_RESPOND = 4, - SAY_VESPERON_SPECIAL = 5, -}; - -//to control each dragons common abilities -struct dummy_dragonAI : public ScriptedAI -{ - dummy_dragonAI(Creature* creature) : ScriptedAI(creature) - { - instance = creature->GetInstanceScript(); - } - - InstanceScript* instance; - - uint32 m_uiWaypointId; - uint32 m_uiMoveNextTimer; - int32 m_iPortalRespawnTime; - bool m_bCanMoveFree; - bool m_bCanLoot; - - void Reset() OVERRIDE - { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - - m_uiWaypointId = 0; - m_uiMoveNextTimer = 500; - m_iPortalRespawnTime = 30000; - m_bCanMoveFree = false; - m_bCanLoot = true; - } - - void SetData(uint32 type, uint32 value) OVERRIDE - { - if (type == DATA_CAN_LOOT) - m_bCanLoot = value; - } - - void MovementInform(uint32 uiType, uint32 uiPointId) OVERRIDE - { - if (!instance || uiType != POINT_MOTION_TYPE) - return; - -// debug_log("dummy_dragonAI: %s reached point %u", me->GetName(), uiPointId); - - //if healers messed up the raid and we was already initialized - if (instance->GetData(TYPE_SARTHARION_EVENT) != IN_PROGRESS) - { - EnterEvadeMode(); - return; - } - - //this is end, if we reach this, don't do much - if (uiPointId == POINT_ID_LAND) - { - me->GetMotionMaster()->Clear(); - me->SetInCombatWithZone(); - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0, true)) - { - me->AddThreat(target, 1.0f); - me->Attack(target, true); - me->GetMotionMaster()->MoveChase(target); - } - - m_bCanMoveFree = false; - return; - } - - //get amount of common points - uint32 uiCommonWPCount = sizeof(m_aDragonCommon)/sizeof(Waypoint); - - //increase - m_uiWaypointId = uiPointId+1; - - //if we have reached a point bigger or equal to count, it mean we must reset to point 0 - if (m_uiWaypointId >= uiCommonWPCount) - { - if (!m_bCanMoveFree) - m_bCanMoveFree = true; - - m_uiWaypointId = 0; - } - - m_uiMoveNextTimer = 500; - } - - //used when open portal and spawn mobs in phase - void DoRaidWhisper(int32 iTextId) - { - Map* map = me->GetMap(); - - if (map && map->IsDungeon()) - { - Map::PlayerList const &PlayerList = map->GetPlayers(); - - if (!PlayerList.isEmpty()) - { - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - Talk(iTextId, i->GetSource()->GetGUID()); - } - } - } - - //"opens" the portal and does the "opening" whisper - void OpenPortal() - { - int32 iTextId = 0; - - //there are 4 portal spawn locations, each are expected to be spawned with negative spawntimesecs in database - - //using a grid search here seem to be more efficient than caching all four guids - //in instance script and calculate range to each. - GameObject* pPortal = me->FindNearestGameObject(GO_TWILIGHT_PORTAL, 50.0f); - - switch (me->GetEntry()) - { - case NPC_TENEBRON: - { - iTextId = WHISPER_HATCH_EGGS; - if (instance && !instance->GetData(TYPE_SARTHARION_EVENT) == IN_PROGRESS) - { - for (uint32 i = 0; i < 6; ++i) - me->SummonCreature(NPC_TWILIGHT_EGG, TwilightEggs[i].x, TwilightEggs[i].y, TwilightEggs[i].z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20000); - } - else - { - for (uint32 i = 0; i < 6; ++i) - me->SummonCreature(NPC_SARTHARION_TWILIGHT_EGG, TwilightEggsSarth[i].x, TwilightEggsSarth[i].y, TwilightEggsSarth[i].z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20000); - } - break; - } - case NPC_SHADRON: - { - iTextId = WHISPER_OPEN_PORTAL; - if (instance && !instance->GetData(TYPE_SARTHARION_EVENT) == IN_PROGRESS) - me->SummonCreature(NPC_ACOLYTE_OF_SHADRON, AcolyteofShadron.x, AcolyteofShadron.y, AcolyteofShadron.z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 28000); - else - me->SummonCreature(NPC_ACOLYTE_OF_SHADRON, AcolyteofShadron2.x, AcolyteofShadron2.y, AcolyteofShadron2.z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 28000); - - break; - } - case NPC_VESPERON: - { - iTextId = WHISPER_OPEN_PORTAL; - if (instance && !instance->GetData(TYPE_SARTHARION_EVENT) == IN_PROGRESS) - { - if (Creature* Acolyte = me->SummonCreature(NPC_ACOLYTE_OF_VESPERON, AcolyteofVesperon.x, AcolyteofVesperon.y, AcolyteofVesperon.z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20000)) - { - me->InterruptNonMeleeSpells(true); - Acolyte->InterruptNonMeleeSpells(true); - me->CastSpell(me, 32747, false); - } - } - else - { - if (Creature* Acolyte = me->SummonCreature(NPC_ACOLYTE_OF_VESPERON, AcolyteofVesperon2.x, AcolyteofVesperon2.y, AcolyteofVesperon2.z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20000)) - { - me->InterruptNonMeleeSpells(true); - Acolyte->InterruptNonMeleeSpells(true); - me->CastSpell(me, 32747, false); - } - } - - break; - } - } - - DoRaidWhisper(iTextId); - - //By using SetRespawnTime() we will actually "spawn" the object with our defined time. - //Once time is up, portal will disappear again. - if (pPortal && !pPortal->isSpawned()) - pPortal->SetRespawnTime(m_iPortalRespawnTime); - - //Unclear what are expected to happen if one drake has a portal open already - //Refresh respawnTime so time again are set to 30secs? - } - - void JustDied(Unit* /*killer*/) OVERRIDE - { - if (!m_bCanLoot) - me->SetLootRecipient(NULL); - - int32 iTextId = 0; - uint32 uiSpellId = 0; - - switch (me->GetEntry()) - { - case NPC_TENEBRON: - iTextId = SAY_TENEBRON_DEATH; - uiSpellId = SPELL_POWER_OF_TENEBRON; - if (instance && instance->GetData(TYPE_SARTHARION_EVENT) != IN_PROGRESS) - instance->SetData(TYPE_TENEBRON_PREKILLED, 1); - break; - case NPC_SHADRON: - iTextId = SAY_SHADRON_DEATH; - uiSpellId = SPELL_POWER_OF_SHADRON; - if (instance && instance->GetData(TYPE_SARTHARION_EVENT) != IN_PROGRESS) - instance->SetData(TYPE_SHADRON_PREKILLED, 1); - if (Creature* pAcolyte = me->FindNearestCreature(NPC_ACOLYTE_OF_SHADRON, 100.0f)) - pAcolyte->Kill(pAcolyte); - break; - case NPC_VESPERON: - iTextId = SAY_VESPERON_DEATH; - uiSpellId = SPELL_POWER_OF_VESPERON; - if (instance && instance->GetData(TYPE_SARTHARION_EVENT) != IN_PROGRESS) - instance->SetData(TYPE_VESPERON_PREKILLED, 1); - if (Creature* pAcolyte = me->FindNearestCreature(NPC_ACOLYTE_OF_VESPERON, 100.0f)) - pAcolyte->Kill(pAcolyte); - break; - } - - Talk(iTextId); - - me->RemoveAurasDueToSpell(uiSpellId); - - if (instance) - { - instance->DoRemoveAurasDueToSpellOnPlayers(uiSpellId); - - // not if solo mini-boss fight - if (instance->GetData(TYPE_SARTHARION_EVENT) != IN_PROGRESS) - return; - - // Twilight Revenge to main boss - if (Unit* pSartharion = Unit::GetUnit(*me, instance->GetData64(DATA_SARTHARION))) - if (pSartharion->IsAlive()) - { - pSartharion->RemoveAurasDueToSpell(uiSpellId); - DoCast(pSartharion, SPELL_TWILIGHT_REVENGE, true); - } - } - } - - void UpdateAI(uint32 uiDiff) OVERRIDE - { - if (m_bCanMoveFree && m_uiMoveNextTimer) - { - if (m_uiMoveNextTimer <= uiDiff) - { - if (m_uiWaypointId < MAX_WAYPOINT) - me->GetMotionMaster()->MovePoint(m_uiWaypointId, - m_aDragonCommon[m_uiWaypointId].m_fX, m_aDragonCommon[m_uiWaypointId].m_fY, m_aDragonCommon[m_uiWaypointId].m_fZ); - -// debug_log("dummy_dragonAI: %s moving to point %u", me->GetName(), m_uiWaypointId); - m_uiMoveNextTimer = 0; - } - else - m_uiMoveNextTimer -= uiDiff; - } - } -}; - -/*###### -## Mob Tenebron -######*/ - -class npc_tenebron : public CreatureScript -{ -public: - npc_tenebron() : CreatureScript("npc_tenebron") { } - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_tenebronAI(creature); - } - - struct npc_tenebronAI : public dummy_dragonAI - { - npc_tenebronAI(Creature* creature) : dummy_dragonAI(creature) { } - - uint32 m_uiShadowBreathTimer; - uint32 m_uiShadowFissureTimer; - uint32 m_uiHatchEggTimer; - - bool m_bHasPortalOpen; - - void Reset() OVERRIDE - { - dummy_dragonAI::Reset(); - - m_uiShadowBreathTimer = 20000; - m_uiShadowFissureTimer = 5000; - m_uiHatchEggTimer = 30000; - - m_bHasPortalOpen = false; - } - - void EnterCombat(Unit* /*who*/) OVERRIDE - { - Talk(SAY_TENEBRON_AGGRO); - DoZoneInCombat(); - } - - void KilledUnit(Unit* /*victim*/) OVERRIDE - { - Talk(SAY_TENEBRON_SLAY); - } - - void UpdateAI(uint32 uiDiff) OVERRIDE - { - //if no target, update dummy and return - if (!UpdateVictim()) - { - dummy_dragonAI::UpdateAI(uiDiff); - return; - } - - // shadow fissure - if (m_uiShadowFissureTimer <= uiDiff) - { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, RAID_MODE(SPELL_SHADOW_FISSURE, SPELL_SHADOW_FISSURE)); - - m_uiShadowFissureTimer = urand(15000, 20000); - } - else - m_uiShadowFissureTimer -= uiDiff; - - // Hatch Egg - if (m_uiHatchEggTimer <= uiDiff) - { - OpenPortal(); - m_uiHatchEggTimer = 30000; - } - else - m_uiHatchEggTimer -= uiDiff; - - // shadow breath - if (m_uiShadowBreathTimer <= uiDiff) - { - Talk(SAY_TENEBRON_BREATH); - DoCastVictim(RAID_MODE(SPELL_SHADOW_BREATH, SPELL_SHADOW_BREATH_H)); - m_uiShadowBreathTimer = urand(20000, 25000); - } - else - m_uiShadowBreathTimer -= uiDiff; - - DoMeleeAttackIfReady(); - } - }; - -}; - -/*###### -## Mob Shadron -######*/ - -class npc_shadron : public CreatureScript -{ -public: - npc_shadron() : CreatureScript("npc_shadron") { } - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_shadronAI(creature); - } - - struct npc_shadronAI : public dummy_dragonAI - { - npc_shadronAI(Creature* creature) : dummy_dragonAI(creature) { } - - uint32 m_uiShadowBreathTimer; - uint32 m_uiShadowFissureTimer; - uint32 m_uiAcolyteShadronTimer; - - bool m_bHasPortalOpen; - - void Reset() OVERRIDE - { - dummy_dragonAI::Reset(); - - m_uiShadowBreathTimer = 20000; - m_uiShadowFissureTimer = 5000; - m_uiAcolyteShadronTimer = 60000; - - if (me->HasAura(SPELL_TWILIGHT_TORMENT_VESP)) - me->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP); - - if (me->HasAura(SPELL_GIFT_OF_TWILIGTH_SHA)) - me->RemoveAurasDueToSpell(SPELL_GIFT_OF_TWILIGTH_SHA); - - m_bHasPortalOpen = false; - } - - void EnterCombat(Unit* /*who*/) OVERRIDE - { - Talk(SAY_SHADRON_AGGRO); - DoZoneInCombat(); - } - - void KilledUnit(Unit* /*victim*/) OVERRIDE - { - Talk(SAY_SHADRON_SLAY); - } - - void UpdateAI(uint32 uiDiff) OVERRIDE - { - //if no target, update dummy and return - if (!UpdateVictim()) - { - dummy_dragonAI::UpdateAI(uiDiff); - return; - } - - // shadow fissure - if (m_uiShadowFissureTimer <= uiDiff) - { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, RAID_MODE(SPELL_SHADOW_FISSURE, SPELL_SHADOW_FISSURE_H)); - - m_uiShadowFissureTimer = urand(15000, 20000); - } - else - m_uiShadowFissureTimer -= uiDiff; - - // Portal Event - if (m_uiAcolyteShadronTimer <= uiDiff) - { - if (m_bHasPortalOpen) - m_uiAcolyteShadronTimer = 10000; - else - { - if (me->HasAura(SPELL_GIFT_OF_TWILIGTH_SHA)) - return; - - OpenPortal(); - m_bHasPortalOpen = true; - m_uiAcolyteShadronTimer = urand(60000, 65000); - } - } - else - m_uiAcolyteShadronTimer -= uiDiff; - - // shadow breath - if (m_uiShadowBreathTimer <= uiDiff) - { - Talk(SAY_SHADRON_BREATH); - DoCastVictim(RAID_MODE(SPELL_SHADOW_BREATH, SPELL_SHADOW_BREATH_H)); - m_uiShadowBreathTimer = urand(20000, 25000); - } - else - m_uiShadowBreathTimer -= uiDiff; - - DoMeleeAttackIfReady(); - } - }; - -}; - -/*###### -## Mob Vesperon -######*/ - -class npc_vesperon : public CreatureScript -{ -public: - npc_vesperon() : CreatureScript("npc_vesperon") { } - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_vesperonAI(creature); - } - - struct npc_vesperonAI : public dummy_dragonAI - { - npc_vesperonAI(Creature* creature) : dummy_dragonAI(creature) { } - - uint32 m_uiShadowBreathTimer; - uint32 m_uiShadowFissureTimer; - uint32 m_uiAcolyteVesperonTimer; - - bool m_bHasPortalOpen; - - void Reset() OVERRIDE - { - dummy_dragonAI::Reset(); - - m_uiShadowBreathTimer = 20000; - m_uiShadowFissureTimer = 5000; - m_uiAcolyteVesperonTimer = 60000; - - m_bHasPortalOpen = false; - } - - void EnterCombat(Unit* /*who*/) OVERRIDE - { - Talk(SAY_VESPERON_AGGRO); - DoZoneInCombat(); - } - - void KilledUnit(Unit* /*victim*/) OVERRIDE - { - Talk(SAY_VESPERON_SLAY); - } - - void UpdateAI(uint32 uiDiff) OVERRIDE - { - //if no target, update dummy and return - if (!UpdateVictim()) - { - dummy_dragonAI::UpdateAI(uiDiff); - return; - } - - // shadow fissure - if (m_uiShadowFissureTimer <= uiDiff) - { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, RAID_MODE(SPELL_SHADOW_FISSURE, SPELL_SHADOW_FISSURE_H)); - - m_uiShadowFissureTimer = urand(15000, 20000); - } - else - m_uiShadowFissureTimer -= uiDiff; - - // Portal Event - if (m_uiAcolyteVesperonTimer <= uiDiff) - { - if (m_bHasPortalOpen) - m_uiAcolyteVesperonTimer = 10000; - else - { - OpenPortal(); - DoCastVictim(SPELL_TWILIGHT_TORMENT_VESP); - m_uiAcolyteVesperonTimer = urand(60000, 70000); - } - } - else - m_uiAcolyteVesperonTimer -= uiDiff; - - // shadow breath - if (m_uiShadowBreathTimer <= uiDiff) - { - Talk(SAY_VESPERON_BREATH); - DoCastVictim(RAID_MODE(SPELL_SHADOW_BREATH, SPELL_SHADOW_BREATH_H)); - m_uiShadowBreathTimer = urand(20000, 25000); - } - else - m_uiShadowBreathTimer -= uiDiff; - - DoMeleeAttackIfReady(); - } - }; - -}; - -/*###### -## Mob Acolyte of Shadron -######*/ - -class npc_acolyte_of_shadron : public CreatureScript -{ -public: - npc_acolyte_of_shadron() : CreatureScript("npc_acolyte_of_shadron") { } - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_acolyte_of_shadronAI(creature); - } - - struct npc_acolyte_of_shadronAI : public ScriptedAI - { - npc_acolyte_of_shadronAI(Creature* creature) : ScriptedAI(creature) - { - instance = creature->GetInstanceScript(); - } - - InstanceScript* instance; - uint32 uiDespawnTimer; - - void Reset() OVERRIDE - { - uiDespawnTimer = 28000; - if (instance) - { - Creature* target = NULL; - //if not solo figth, buff main boss, else place debuff on mini-boss. both spells TARGET_SCRIPT - if (instance->GetData(TYPE_SARTHARION_EVENT) == IN_PROGRESS) - { - target = Unit::GetCreature((*me), instance->GetData64(DATA_SARTHARION)); - if (target) - target->AddAura(SPELL_GIFT_OF_TWILIGTH_SAR, target); - } - else - { - target = Unit::GetCreature((*me), instance->GetData64(DATA_SHADRON)); - if (target) - target->AddAura(SPELL_GIFT_OF_TWILIGTH_SHA, target); - } - } - - me->AddAura(SPELL_TWILIGHT_SHIFT_ENTER, me); - } - - void JustDied(Unit* /*killer*/) OVERRIDE - { - if (instance) - { - Creature* Shadron = instance->instance->GetCreature(instance->GetData64(DATA_SHADRON)); - if (Shadron) - { - (CAST_AI(npc_shadron::npc_shadronAI, Shadron->AI()))->m_bHasPortalOpen = false; - } - - Creature* pDebuffTarget = NULL; - Map* map = me->GetMap(); - if (map->IsDungeon()) - { - Map::PlayerList const &PlayerList = map->GetPlayers(); - - if (PlayerList.isEmpty()) - return; - - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - { - if (i->GetSource()->IsAlive() && i->GetSource()->HasAura(SPELL_TWILIGHT_SHIFT, 0) && !i->GetSource()->GetVictim()) + case EVENT_FLAME_BREATH: + Talk(SAY_SARTHARION_BREATH); + DoCastVictim(RAID_MODE(SPELL_FLAME_BREATH, SPELL_FLAME_BREATH_H)); + events.ScheduleEvent(EVENT_FLAME_BREATH, urand(25000, 35000)); + break; + case EVENT_TAIL_SWEEP: + DoCastVictim(RAID_MODE(SPELL_TAIL_LASH, SPELL_TAIL_LASH_H)); + events.ScheduleEvent(EVENT_TAIL_SWEEP, urand(15000, 20000)); + break; + case EVENT_CLEAVE_ATTACK: + DoCastVictim(SPELL_CLEAVE); + events.ScheduleEvent(EVENT_CLEAVE_ATTACK, urand(7000, 10000)); + break; + case EVENT_LAVA_STRIKE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) { - i->GetSource()->CastSpell(i->GetSource(), SPELL_TWILIGHT_SHIFT_REMOVAL_ALL, true); - i->GetSource()->CastSpell(i->GetSource(), SPELL_TWILIGHT_RESIDUE, true); - i->GetSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT); - i->GetSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT_ENTER); + CastLavaStrikeOnTarget(target); + if (urand(0, 5) == 0) + Talk(SAY_SARTHARION_SPECIAL); } - } + events.ScheduleEvent(EVENT_LAVA_STRIKE, (_isSoftEnraged ? urand(1400, 2000) : urand(5000, 20000))); + break; + case EVENT_CALL_TENEBRON: + CallDragon(DATA_TENEBRON); + break; + case EVENT_CALL_SHADRON: + CallDragon(DATA_SHADRON); + break; + case EVENT_CALL_VESPERON: + CallDragon(DATA_VESPERON); + break; + default: + break; } - - //not solo fight, so main boss has deduff - pDebuffTarget = instance->instance->GetCreature(instance->GetData64(DATA_SARTHARION)); - if (pDebuffTarget && pDebuffTarget->IsAlive() && pDebuffTarget->HasAura(SPELL_GIFT_OF_TWILIGTH_SAR)) - pDebuffTarget->RemoveAurasDueToSpell(SPELL_GIFT_OF_TWILIGTH_SAR); - - //event not in progress, then solo fight and must remove debuff mini-boss - pDebuffTarget = instance->instance->GetCreature(instance->GetData64(DATA_SHADRON)); - if (pDebuffTarget && pDebuffTarget->IsAlive() && pDebuffTarget->HasAura(SPELL_GIFT_OF_TWILIGTH_SHA)) - pDebuffTarget->RemoveAurasDueToSpell(SPELL_GIFT_OF_TWILIGTH_SHA); } - } - void UpdateAI(uint32 uiDiff) OVERRIDE - { - if (uiDespawnTimer < uiDiff) + // At 35% spell will target dragons, if they are still alive. + if (!_isBerserk && !HealthAbovePct(35)) { - me->SetVisible(false); - me->Kill(me); - uiDespawnTimer = 28000; - return; - }else uiDespawnTimer -= uiDiff; - - if (!UpdateVictim()) - return; - - DoMeleeAttackIfReady(); - } - }; - -}; - -/*###### -## Mob Acolyte of Vesperon -######*/ - -class npc_acolyte_of_vesperon : public CreatureScript -{ -public: - npc_acolyte_of_vesperon() : CreatureScript("npc_acolyte_of_vesperon") { } - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_acolyte_of_vesperonAI(creature); - } - - struct npc_acolyte_of_vesperonAI : public ScriptedAI - { - npc_acolyte_of_vesperonAI(Creature* creature) : ScriptedAI(creature) - { - instance = creature->GetInstanceScript(); - } - - InstanceScript* instance; - uint32 uiDespawnTimer; - - void Reset() OVERRIDE - { - uiDespawnTimer = 28000; - if (instance) - me->AddAura(SPELL_TWILIGHT_SHIFT_ENTER, me); - DoCast(me, SPELL_TWILIGHT_TORMENT_VESP_ACO); - } - - void JustDied(Unit* /*killer*/) OVERRIDE - { - me->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP_ACO); - - // remove twilight torment on Vesperon - if (instance) - { - Creature* pVesperon = instance->instance->GetCreature(instance->GetData64(DATA_VESPERON)); - if (pVesperon) - (CAST_AI(npc_vesperon::npc_vesperonAI, pVesperon->AI()))->m_bHasPortalOpen = false; - - if (pVesperon && pVesperon->IsAlive() && pVesperon->HasAura(SPELL_TWILIGHT_TORMENT_VESP)) - pVesperon->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP); - - Map* map = me->GetMap(); - if (map->IsDungeon()) + if (instance->GetBossState(DATA_TENEBRON) != DONE || instance->GetBossState(DATA_SHADRON) != DONE || instance->GetBossState(DATA_VESPERON) != DONE) { - Map::PlayerList const &PlayerList = map->GetPlayers(); - - if (PlayerList.isEmpty()) - return; - - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - { - if (i->GetSource()->IsAlive() && i->GetSource()->HasAura(SPELL_TWILIGHT_SHIFT, 0) && !i->GetSource()->GetVictim()) - { - i->GetSource()->CastSpell(i->GetSource(), SPELL_TWILIGHT_SHIFT_REMOVAL_ALL, true); - i->GetSource()->CastSpell(i->GetSource(), SPELL_TWILIGHT_RESIDUE, true); - i->GetSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT); - i->GetSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT_ENTER); - } - if (i->GetSource()->IsAlive() && i->GetSource()->HasAura(SPELL_TWILIGHT_TORMENT_VESP, 0) && !i->GetSource()->GetVictim()) - i->GetSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP); - } + Talk(SAY_SARTHARION_BERSERK); + DoCast(me, SPELL_BERSERK); + _isBerserk = true; } - - instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_TWILIGHT_TORMENT_VESP_ACO); - instance->DoRemoveAurasDueToSpellOnPlayers(57935); - instance->DoRemoveAurasDueToSpellOnPlayers(58835); // Components of spell Twilight Torment } - } - void UpdateAI(uint32 uiDiff) OVERRIDE - { - if (uiDespawnTimer < uiDiff) + // Soft Enrage used while determining Lava Strike cooldown. + if (!_isSoftEnraged && HealthBelowPct(10)) { - me->SetVisible(false); - me->Kill(me); - uiDespawnTimer = 28000; - return; - }else uiDespawnTimer -= uiDiff; - - if (!UpdateVictim()) - return; - - DoMeleeAttackIfReady(); - } - }; - -}; - -/*###### -## Mob Twilight Eggs -######*/ - -class npc_twilight_eggs : public CreatureScript -{ -public: - npc_twilight_eggs() : CreatureScript("npc_twilight_eggs") { } - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_twilight_eggsAI(creature); - } - - struct npc_twilight_eggsAI : public ScriptedAI - { - npc_twilight_eggsAI(Creature* creature) : ScriptedAI(creature) - { - SetCombatMovement(false); - instance = creature->GetInstanceScript(); - } - - uint32 m_uiFadeArmorTimer; - uint32 m_uiHatchEggTimer; - - InstanceScript* instance; - - void Reset() OVERRIDE - { - if (instance) - me->AddAura(SPELL_TWILIGHT_SHIFT_ENTER, me); - m_uiFadeArmorTimer = 1000; - m_uiHatchEggTimer = 20000; - } - - void SpawnWhelps() - { - me->RemoveAllAuras(); - - if (!instance->GetData(TYPE_SARTHARION_EVENT) == IN_PROGRESS) - me->SummonCreature(NPC_TWILIGHT_WHELP, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000); - else - me->SummonCreature(NPC_SHARTHARION_TWILIGHT_WHELP, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000); - me->DealDamage(me, me->GetHealth()); - } - - void JustSummoned(Creature* who) OVERRIDE - { - who->SetInCombatWithZone(); - } - - void UpdateAI(uint32 uiDiff) OVERRIDE - { - if (m_uiHatchEggTimer <= uiDiff) - { - Creature* Tenebron = instance->instance->GetCreature(instance->GetData64(DATA_TENEBRON)); - if (Tenebron) - (CAST_AI(npc_tenebron::npc_tenebronAI, Tenebron->AI()))->m_bHasPortalOpen = false; - SpawnWhelps(); + _isSoftEnraged = true; } - else - m_uiHatchEggTimer -= uiDiff; - } - - void AttackStart(Unit* /*who*/) OVERRIDE { } - void MoveInLineOfSight(Unit* /*who*/) OVERRIDE { } - - }; - -}; - -/*###### -## Mob Flame Tsunami -######*/ -class npc_flame_tsunami : public CreatureScript -{ -public: - npc_flame_tsunami() : CreatureScript("npc_flame_tsunami") { } - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_flame_tsunamiAI(creature); - } - - struct npc_flame_tsunamiAI : public ScriptedAI - { - npc_flame_tsunamiAI(Creature* creature) : ScriptedAI(creature) - { - me->SetDisplayId(11686); - me->AddAura(SPELL_FLAME_TSUNAMI, me); - } - - uint32 Tsunami_Timer; - uint32 TsunamiBuff_timer; - uint32 entry; - - void Reset() OVERRIDE - { - me->SetReactState(REACT_PASSIVE); - Tsunami_Timer = 100; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - TsunamiBuff_timer = 1000; - entry = 0; - } - - void UpdateAI(uint32 diff) OVERRIDE - { - if (Tsunami_Timer <= diff) - { - DoCast(me, SPELL_FLAME_TSUNAMI_DMG_AURA); - Tsunami_Timer = 500; - }else Tsunami_Timer -= diff; - - if (TsunamiBuff_timer <= diff) - { - if (Unit* LavaBlaze = GetClosestCreatureWithEntry(me, NPC_LAVA_BLAZE, 10.0f, true)) - LavaBlaze->CastSpell(LavaBlaze, SPELL_FLAME_TSUNAMI_BUFF, true); - TsunamiBuff_timer = 1000; - }else TsunamiBuff_timer -= diff; - } - }; - -}; - -// Twilight Fissure -class npc_twilight_fissure : public CreatureScript -{ -public: - npc_twilight_fissure() : CreatureScript("npc_twilight_fissure") { } - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_twilight_fissureAI(creature); - } - - struct npc_twilight_fissureAI : public ScriptedAI - { - npc_twilight_fissureAI(Creature* creature) : ScriptedAI(creature) - { - SetCombatMovement(false); - } - uint32 VoidBlast_Timer; + DoMeleeAttackIfReady(); - void Reset() OVERRIDE - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->AddAura( 46265, me ); // Wrong, can't find proper visual - me->AddAura( 69422, me ); - VoidBlast_Timer = 5000; + EnterEvadeIfOutOfCombatArea(diff); } - void UpdateAI(uint32 diff) OVERRIDE - { - if (VoidBlast_Timer <= diff) - { - DoCastAOE(RAID_MODE(SPELL_VOID_BLAST, SPELL_VOID_BLAST_H)); - ////twilight realm - //DoCastVictim(57620, true); - //DoCastVictim(57874, true); - VoidBlast_Timer = 9000; - me->RemoveAllAuras(); - me->Kill(me); - } else VoidBlast_Timer -= diff; - } + private: + bool _isBerserk; + bool _isSoftEnraged; + bool _isHardEnraged; + uint8 drakeCount; }; -}; - -/*###### -## Mob Twilight Whelps -######*/ - -class npc_twilight_whelp : public CreatureScript -{ -public: - npc_twilight_whelp() : CreatureScript("npc_twilight_whelp") { } - CreatureAI* GetAI(Creature* creature) const OVERRIDE { - return new npc_twilight_whelpAI(creature); + return new boss_sartharionAI(creature); } - - struct npc_twilight_whelpAI : public ScriptedAI - { - npc_twilight_whelpAI(Creature* creature) : ScriptedAI(creature) - { - Reset(); - } - - uint32 m_uiFadeArmorTimer; - - void Reset() OVERRIDE - { - me->RemoveAllAuras(); - me->SetInCombatWithZone(); - m_uiFadeArmorTimer = 1000; - } - - void UpdateAI(uint32 uiDiff) OVERRIDE - { - //Return since we have no target - if (!UpdateVictim()) - return; - - // twilight torment - if (m_uiFadeArmorTimer <= uiDiff) - { - DoCastVictim(SPELL_FADE_ARMOR); - m_uiFadeArmorTimer = urand(5000, 10000); - } - else - m_uiFadeArmorTimer -= uiDiff; - - DoMeleeAttackIfReady(); - } - }; - -}; - -class achievement_twilight_assist : public AchievementCriteriaScript -{ - public: - achievement_twilight_assist() : AchievementCriteriaScript("achievement_twilight_assist") - { - } - - bool OnCheck(Player* /*player*/, Unit* target) OVERRIDE - { - if (!target) - return false; - - if (Creature* Sartharion = target->ToCreature()) - if (Sartharion->AI()->GetData(TWILIGHT_ACHIEVEMENTS) >= 1) - return true; - - return false; - } -}; - -class achievement_twilight_duo : public AchievementCriteriaScript -{ - public: - achievement_twilight_duo() : AchievementCriteriaScript("achievement_twilight_duo") - { - } - - bool OnCheck(Player* /*player*/, Unit* target) OVERRIDE - { - if (!target) - return false; - - if (Creature* Sartharion = target->ToCreature()) - if (Sartharion->AI()->GetData(TWILIGHT_ACHIEVEMENTS) >= 2) - return true; - - return false; - } -}; - -class achievement_twilight_zone : public AchievementCriteriaScript -{ - public: - achievement_twilight_zone() : AchievementCriteriaScript("achievement_twilight_zone") - { - } - - bool OnCheck(Player* /*player*/, Unit* target) OVERRIDE - { - if (!target) - return false; - - if (Creature* Sartharion = target->ToCreature()) - if (Sartharion->AI()->GetData(TWILIGHT_ACHIEVEMENTS) == 3) - return true; - - return false; - } }; void AddSC_boss_sartharion() { new boss_sartharion(); - new npc_vesperon(); - new npc_shadron(); - new npc_tenebron(); - new npc_acolyte_of_shadron(); - new npc_acolyte_of_vesperon(); - new npc_twilight_eggs(); - new npc_flame_tsunami(); - new npc_twilight_fissure(); - new npc_twilight_whelp(); - new achievement_twilight_assist(); - new achievement_twilight_duo(); - new achievement_twilight_zone(); } diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp index ace2258ac9f..ad1346e7f37 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp @@ -19,8 +19,6 @@ #include "InstanceScript.h" #include "obsidian_sanctum.h" -#define MAX_ENCOUNTER 1 - /* Obsidian Sanctum encounters: 0 - Sartharion */ @@ -28,48 +26,18 @@ class instance_obsidian_sanctum : public InstanceMapScript { public: - instance_obsidian_sanctum() : InstanceMapScript("instance_obsidian_sanctum", 615) { } - - InstanceScript* GetInstanceScript(InstanceMap* map) const OVERRIDE - { - return new instance_obsidian_sanctum_InstanceMapScript(map); - } + instance_obsidian_sanctum() : InstanceMapScript(OSScriptName, 615) { } struct instance_obsidian_sanctum_InstanceMapScript : public InstanceScript { instance_obsidian_sanctum_InstanceMapScript(Map* map) : InstanceScript(map) { } - uint32 m_auiEncounter[MAX_ENCOUNTER]; - uint64 m_uiSartharionGUID; - uint64 m_uiTenebronGUID; - uint64 m_uiShadronGUID; - uint64 m_uiVesperonGUID; - - bool m_bTenebronKilled; - bool m_bShadronKilled; - bool m_bVesperonKilled; - void Initialize() OVERRIDE { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - - m_uiSartharionGUID = 0; - m_uiTenebronGUID = 0; - m_uiShadronGUID = 0; - m_uiVesperonGUID = 0; - - m_bTenebronKilled = false; - m_bShadronKilled = false; - m_bVesperonKilled = false; - } - - bool IsEncounterInProgress() const OVERRIDE - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - return true; - - return false; + sartharionGUID = 0; + tenebronGUID = 0; + shadronGUID = 0; + vesperonGUID = 0; } void OnCreatureCreate(Creature* creature) OVERRIDE @@ -77,68 +45,113 @@ public: switch (creature->GetEntry()) { case NPC_SARTHARION: - m_uiSartharionGUID = creature->GetGUID(); + sartharionGUID = creature->GetGUID(); break; - //three dragons below set to active state once created. - //we must expect bigger raid to encounter main boss, and then three dragons must be active due to grid differences + // Three dragons below set to active state once created. + // We must expect bigger raid to encounter main boss, and then three dragons must be active due to grid differences case NPC_TENEBRON: - m_uiTenebronGUID = creature->GetGUID(); + tenebronGUID = creature->GetGUID(); creature->setActive(true); break; case NPC_SHADRON: - m_uiShadronGUID = creature->GetGUID(); + shadronGUID = creature->GetGUID(); creature->setActive(true); break; case NPC_VESPERON: - m_uiVesperonGUID = creature->GetGUID(); + vesperonGUID = creature->GetGUID(); creature->setActive(true); break; } } - void SetData(uint32 uiType, uint32 uiData) OVERRIDE - { - if (uiType == TYPE_SARTHARION_EVENT) - m_auiEncounter[0] = uiData; - else if (uiType == TYPE_TENEBRON_PREKILLED) - m_bTenebronKilled = true; - else if (uiType == TYPE_SHADRON_PREKILLED) - m_bShadronKilled = true; - else if (uiType == TYPE_VESPERON_PREKILLED) - m_bVesperonKilled = true; - } - - uint32 GetData(uint32 uiType) const OVERRIDE + bool SetBossState(uint32 type, EncounterState state) OVERRIDE { - if (uiType == TYPE_SARTHARION_EVENT) - return m_auiEncounter[0]; - else if (uiType == TYPE_TENEBRON_PREKILLED) - return m_bTenebronKilled; - else if (uiType == TYPE_SHADRON_PREKILLED) - return m_bShadronKilled; - else if (uiType == TYPE_VESPERON_PREKILLED) - return m_bVesperonKilled; + if (!InstanceScript::SetBossState(type, state)) + return false; - return 0; + switch (type) + { + case DATA_SARTHARION: + case DATA_TENEBRON: + case DATA_SHADRON: + case DATA_VESPERON: + break; + default: + break; + } + return true; } - uint64 GetData64(uint32 uiData) const OVERRIDE + uint64 GetData64(uint32 Data) const OVERRIDE { - switch (uiData) + switch (Data) { case DATA_SARTHARION: - return m_uiSartharionGUID; + return sartharionGUID; case DATA_TENEBRON: - return m_uiTenebronGUID; + return tenebronGUID; case DATA_SHADRON: - return m_uiShadronGUID; + return shadronGUID; case DATA_VESPERON: - return m_uiVesperonGUID; + return vesperonGUID; } return 0; } + + std::string GetSaveData() OVERRIDE + { + OUT_SAVE_INST_DATA; + + std::ostringstream saveStream; + saveStream << "O S " << GetBossSaveData(); + + OUT_SAVE_INST_DATA_COMPLETE; + return saveStream.str(); + } + + void Load(const char* str) OVERRIDE + { + if (!str) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(str); + + char dataHead1, dataHead2; + + std::istringstream loadStream(str); + loadStream >> dataHead1 >> dataHead2; + + if (dataHead1 == 'O' && dataHead2 == 'S') + { + for (uint32 i = 0; i < EncounterCount; ++i) + { + uint32 tmpState; + loadStream >> tmpState; + if (tmpState == IN_PROGRESS || tmpState > SPECIAL) + tmpState = NOT_STARTED; + SetBossState(i, EncounterState(tmpState)); + } + } + else + OUT_LOAD_INST_DATA_FAIL; + + OUT_LOAD_INST_DATA_COMPLETE; + } + + protected: + uint64 sartharionGUID; + uint64 tenebronGUID; + uint64 shadronGUID; + uint64 vesperonGUID; }; + InstanceScript* GetInstanceScript(InstanceMap* map) const OVERRIDE + { + return new instance_obsidian_sanctum_InstanceMapScript(map); + } }; void AddSC_instance_obsidian_sanctum() diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.cpp new file mode 100644 index 00000000000..5fc4869c4af --- /dev/null +++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.cpp @@ -0,0 +1,1159 @@ +/* + * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "GridNotifiers.h" +#include "GridNotifiersImpl.h" +#include "Cell.h" +#include "CellImpl.h" +#include "obsidian_sanctum.h" + +enum Enums +{ + WHISPER_HATCH_EGGS = 6, + WHISPER_OPEN_PORTAL = 6, // whisper, shared by two dragons + + //Mini bosses common spells + SPELL_TWILIGHT_RESIDUE = 61885, // makes immune to shadow damage, applied when leave phase + + //Miniboses (Vesperon, Shadron, Tenebron) + SPELL_SHADOW_BREATH_H = 59126, // Inflicts 8788 to 10212 Fire damage to enemies in a cone in front of the caster. + SPELL_SHADOW_BREATH = 57570, // Inflicts 6938 to 8062 Fire damage to enemies in a cone in front of the caster. + + SPELL_SHADOW_FISSURE_H = 59127, // Deals 9488 to 13512 Shadow damage to any enemy within the Shadow fissure after 5 sec. + SPELL_SHADOW_FISSURE = 57579, // Deals 6188 to 8812 Shadow damage to any enemy within the Shadow fissure after 5 sec. + + //Vesperon + //In portal is a disciple, when disciple killed remove Power_of_vesperon, portal open multiple times + NPC_ACOLYTE_OF_VESPERON = 31219, // Acolyte of Vesperon + SPELL_POWER_OF_VESPERON = 61251, // Vesperon's presence decreases the maximum health of all enemies by 25%. + SPELL_TWILIGHT_TORMENT_VESP = 57948, // (Shadow only) trigger 57935 then 57988 + SPELL_TWILIGHT_TORMENT_VESP_ACO = 58853, // (Fire and Shadow) trigger 58835 then 57988 + + //Shadron + //In portal is a disciple, when disciple killed remove Power_of_vesperon, portal open multiple times + NPC_ACOLYTE_OF_SHADRON = 31218, // Acolyte of Shadron + SPELL_POWER_OF_SHADRON = 58105, // Shadron's presence increases Fire damage taken by all enemies by 100%. + SPELL_GIFT_OF_TWILIGTH_SHA = 57835, // TARGET_SCRIPT shadron + SPELL_GIFT_OF_TWILIGTH_SAR = 58766, // TARGET_SCRIPT sartharion + SPELL_VOID_BLAST = 57581, // Twilight Fissure + SPELL_VOID_BLAST_H = 59128, + + //Tenebron + //in the portal spawns 6 eggs, if not killed in time (approx. 20s) they will hatch, whelps can cast 60708 + SPELL_POWER_OF_TENEBRON = 61248, // Tenebron's presence increases Shadow damage taken by all enemies by 100%. + //Tenebron, dummy spell + SPELL_SUMMON_TWILIGHT_WHELP = 58035, // doesn't work, will spawn NPC_TWILIGHT_WHELP + SPELL_SUMMON_SARTHARION_TWILIGHT_WHELP = 58826, // doesn't work, will spawn NPC_SHARTHARION_TWILIGHT_WHELP + SPELL_TWILIGHT_REVENGE = 60639, + SPELL_HATCH_EGGS_H = 59189, + SPELL_HATCH_EGGS = 58542, + SPELL_HATCH_EGGS_EFFECT_H = 59190, + SPELL_HATCH_EGGS_EFFECT = 58685, + NPC_TWILIHT_WHELP = 31214, + NPC_TWILIGHT_EGG = 30882, + NPC_SARTHARION_TWILIGHT_EGG = 31204, + + SPELL_TWILIGHT_SHIFT_ENTER = 57620, // enter phase. Player get this when click GO + SPELL_TWILIGHT_SHIFT = 57874, // Twilight Shift Aura + SPELL_TWILIGHT_SHIFT_REMOVAL = 61187, // leave phase + SPELL_TWILIGHT_SHIFT_REMOVAL_ALL = 61190, // leave phase (probably version to make all leave) + + //Whelps + NPC_TWILIGHT_WHELP = 30890, + NPC_SHARTHARION_TWILIGHT_WHELP = 31214, + SPELL_FADE_ARMOR = 60708, // Reduces the armor of an enemy by 1500 for 15s + + //flame tsunami + SPELL_FLAME_TSUNAMI = 57494, // the visual dummy + SPELL_FLAME_TSUNAMI_LEAP = 60241, // SPELL_EFFECT_138 some leap effect, causing caster to move in direction + + SPELL_FLAME_TSUNAMI_DMG_AURA = 57491, // periodic damage, npc has this aura + SPELL_FLAME_TSUNAMI_BUFF = 60430, + NPC_LAVA_BLAZE = 30643, // adds spawning from flame strike + + //using these custom points for dragons start and end + POINT_ID_INIT = 100, + POINT_ID_LAND = 200 +}; + +enum Misc +{ + DATA_CAN_LOOT = 0 +}; + +struct Location +{ + float x, y, z; +}; + +struct Locations +{ + float x, y, z; +}; + +struct Waypoint +{ + float m_fX, m_fY, m_fZ; +}; + +#define MAX_WAYPOINT 6 +//points around raid "isle", counter clockwise. should probably be adjusted to be more alike +Waypoint dragonCommon[MAX_WAYPOINT]= +{ + {3214.012f, 468.932f, 98.652f}, + {3244.950f, 468.427f, 98.652f}, + {3283.520f, 496.869f, 98.652f}, + {3287.316f, 555.875f, 98.652f}, + {3250.479f, 585.827f, 98.652f}, + {3209.969f, 566.523f, 98.652f} +}; + +static Location AcolyteofShadron = { 3363.92f, 534.703f, 97.2683f }; +static Location AcolyteofShadron2 = { 3246.57f, 551.263f, 58.6164f }; +static Location AcolyteofVesperon = { 3145.68f, 520.71f, 89.7f }; +static Location AcolyteofVesperon2 = { 3246.57f, 551.263f, 58.6164f }; + +Locations TwilightEggs[] = +{ + {3219.28f, 669.121f, 88.5549f}, + {3221.55f, 682.852f, 90.5361f}, + {3239.77f, 685.94f, 90.3168f}, + {3250.33f, 669.749f, 88.7637f}, + {3246.6f, 642.365f, 84.8752f}, + {3233.68f, 653.117f, 85.7051f} +}; +Locations TwilightEggsSarth[] = +{ + {3252.73f, 515.762f, 58.5501f}, + {3256.56f, 521.119f, 58.6061f}, + {3255.63f, 527.513f, 58.7568f}, + {3264.90f, 525.865f, 58.6436f}, + {3264.26f, 516.364f, 58.8011f}, + {3257.54f, 502.285f, 58.2077f} +}; + +enum SharedTextIDs +{ + SAY_AGGRO = 0, + SAY_SLAY = 1, + SAY_DEATH = 2, + SAY_BREATH = 3, + SAY_RESPOND = 4, + SAY_SPECIAL = 5 +}; + +enum DummyDragonEvents +{ + EVENT_FREE_MOVEMENT = 1 +}; + +//to control each dragons common abilities +struct dummy_dragonAI : public ScriptedAI +{ + dummy_dragonAI(Creature* creature) : ScriptedAI(creature) + { + instance = creature->GetInstanceScript(); + } + + void Reset() OVERRIDE + { + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + + waypointId = 0; + portalRespawnTime = 30000; + _canMoveFree = false; + _canLoot = true; + } + + void SetData(uint32 type, uint32 value) OVERRIDE + { + if (type == DATA_CAN_LOOT) + _canLoot = value; + } + + void MovementInform(uint32 type, uint32 pointId) OVERRIDE + { + if (!instance || type != POINT_MOTION_TYPE) + return; + + // debug_log("dummy_dragonAI: %s reached point %u", me->GetName(), uiPointId); + + // if healers messed up the raid and we was already initialized + if (instance->GetBossState(DATA_SARTHARION) != IN_PROGRESS) + { + EnterEvadeMode(); + return; + } + + // this is end, if we reach this, don't do much + if (pointId == POINT_ID_LAND) + { + me->GetMotionMaster()->Clear(); + me->SetInCombatWithZone(); + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0, true)) + { + me->AddThreat(target, 1.0f); + me->Attack(target, true); + me->GetMotionMaster()->MoveChase(target); + } + + _canMoveFree = false; + return; + } + + // get amount of common points + uint32 commonWPCount = sizeof(dragonCommon)/sizeof(Waypoint); + + // increase + waypointId = pointId+1; + + // if we have reached a point bigger or equal to count, it mean we must reset to point 0 + if (waypointId >= commonWPCount) + { + if (!_canMoveFree) + _canMoveFree = true; + + waypointId = 0; + } + + events.ScheduleEvent(EVENT_FREE_MOVEMENT, 500); + } + + // used when open portal and spawn mobs in phase + void DoRaidWhisper(int32 iTextId) + { + Map* map = me->GetMap(); + + if (map && map->IsDungeon()) + { + Map::PlayerList const &PlayerList = map->GetPlayers(); + + if (!PlayerList.isEmpty()) + { + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + Talk(iTextId, i->GetSource()->GetGUID()); + } + } + } + + // "opens" the portal and does the "opening" whisper + void OpenPortal() + { + int32 textId = 0; + + // there are 4 portal spawn locations, each are expected to be spawned with negative spawntimesecs in database + + // using a grid search here seem to be more efficient than caching all four guids + // in instance script and calculate range to each. + GameObject* portal = me->FindNearestGameObject(GO_TWILIGHT_PORTAL, 50.0f); + + switch (me->GetEntry()) + { + case NPC_TENEBRON: + { + textId = WHISPER_HATCH_EGGS; + if (instance && !instance->GetBossState(DATA_SARTHARION) == IN_PROGRESS) + { + for (uint32 i = 0; i < 6; ++i) + me->SummonCreature(NPC_TWILIGHT_EGG, TwilightEggs[i].x, TwilightEggs[i].y, TwilightEggs[i].z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20000); + } + else + { + for (uint32 i = 0; i < 6; ++i) + me->SummonCreature(NPC_SARTHARION_TWILIGHT_EGG, TwilightEggsSarth[i].x, TwilightEggsSarth[i].y, TwilightEggsSarth[i].z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20000); + } + break; + } + case NPC_SHADRON: + { + textId = WHISPER_OPEN_PORTAL; + if (instance && !instance->GetBossState(DATA_SARTHARION) == IN_PROGRESS) + me->SummonCreature(NPC_ACOLYTE_OF_SHADRON, AcolyteofShadron.x, AcolyteofShadron.y, AcolyteofShadron.z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 28000); + else + me->SummonCreature(NPC_ACOLYTE_OF_SHADRON, AcolyteofShadron2.x, AcolyteofShadron2.y, AcolyteofShadron2.z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 28000); + + break; + } + case NPC_VESPERON: + { + textId = WHISPER_OPEN_PORTAL; + if (instance && !instance->GetBossState(DATA_SARTHARION) == IN_PROGRESS) + { + if (Creature* acolyte = me->SummonCreature(NPC_ACOLYTE_OF_VESPERON, AcolyteofVesperon.x, AcolyteofVesperon.y, AcolyteofVesperon.z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20000)) + { + me->InterruptNonMeleeSpells(true); + acolyte->InterruptNonMeleeSpells(true); + me->CastSpell(me, 32747, false); + } + } + else + { + if (Creature* acolyte = me->SummonCreature(NPC_ACOLYTE_OF_VESPERON, AcolyteofVesperon2.x, AcolyteofVesperon2.y, AcolyteofVesperon2.z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20000)) + { + me->InterruptNonMeleeSpells(true); + acolyte->InterruptNonMeleeSpells(true); + me->CastSpell(me, 32747, false); + } + } + + break; + } + } + + DoRaidWhisper(textId); + + // By using SetRespawnTime() we will actually "spawn" the object with our defined time. + // Once time is up, portal will disappear again. + if (portal && !portal->isSpawned()) + portal->SetRespawnTime(portalRespawnTime); + + // Unclear what are expected to happen if one drake has a portal open already + // Refresh respawnTime so time again are set to 30secs? + } + + void JustDied(Unit* /*killer*/) OVERRIDE + { + if (!_canLoot) + me->SetLootRecipient(NULL); + + uint32 spellId = 0; + + switch (me->GetEntry()) + { + case NPC_TENEBRON: + spellId = SPELL_POWER_OF_TENEBRON; + if (instance && instance->GetBossState(DATA_SARTHARION) != IN_PROGRESS) + instance->SetBossState(DATA_TENEBRON, DONE); + break; + case NPC_SHADRON: + spellId = SPELL_POWER_OF_SHADRON; + if (instance && instance->GetBossState(DATA_SARTHARION) != IN_PROGRESS) + instance->SetBossState(DATA_SHADRON, DONE); + if (Creature* acolyte = me->FindNearestCreature(NPC_ACOLYTE_OF_SHADRON, 100.0f)) + acolyte->Kill(acolyte); + break; + case NPC_VESPERON: + spellId = SPELL_POWER_OF_VESPERON; + if (instance && instance->GetBossState(DATA_SARTHARION) != IN_PROGRESS) + instance->SetBossState(DATA_VESPERON, DONE); + if (Creature* acolyte = me->FindNearestCreature(NPC_ACOLYTE_OF_VESPERON, 100.0f)) + acolyte->Kill(acolyte); + break; + } + + Talk(SAY_DEATH); + me->RemoveAurasDueToSpell(spellId); + + if (instance) + { + instance->DoRemoveAurasDueToSpellOnPlayers(spellId); + + // not if solo mini-boss fight + if (instance->GetBossState(DATA_SARTHARION) != IN_PROGRESS) + return; + + // Twilight Revenge to main boss + if (Unit* sartharion = Unit::GetUnit(*me, instance->GetData64(DATA_SARTHARION))) + if (sartharion->IsAlive()) + { + sartharion->RemoveAurasDueToSpell(spellId); + DoCast(sartharion, SPELL_TWILIGHT_REVENGE, true); + } + } + } + + void UpdateAI(uint32 diff) OVERRIDE + { + events.Update(diff); + + if (events.ExecuteEvent() == EVENT_FREE_MOVEMENT) + { + if (_canMoveFree && waypointId < MAX_WAYPOINT) + me->GetMotionMaster()->MovePoint(waypointId, dragonCommon[waypointId].m_fX, dragonCommon[waypointId].m_fY, dragonCommon[waypointId].m_fZ); + } + } + + private: + InstanceScript* instance; + EventMap events; + uint32 waypointId; + int32 portalRespawnTime; + bool _canMoveFree; + bool _canLoot; +}; + +/*###### +## Tenebron +######*/ + +enum TenebronEvents +{ + EVENT_SHADOW_FISSURE_TENEBRON = 2, + EVENT_HATCH_EGGS = 3, + EVENT_SHADOW_BREATH_TENEBRON = 4 +}; + +class npc_tenebron : public CreatureScript +{ +public: + npc_tenebron() : CreatureScript("npc_tenebron") { } + + struct npc_tenebronAI : public dummy_dragonAI + { + npc_tenebronAI(Creature* creature) : dummy_dragonAI(creature) { } + + void Reset() OVERRIDE + { + dummy_dragonAI::Reset(); + } + + void EnterCombat(Unit* /*who*/) OVERRIDE + { + Talk(SAY_AGGRO); + DoZoneInCombat(); + events.ScheduleEvent(EVENT_SHADOW_FISSURE_TENEBRON, 5000); + events.ScheduleEvent(EVENT_HATCH_EGGS, 30000); + events.ScheduleEvent(EVENT_SHADOW_BREATH_TENEBRON, 20000); + } + + void KilledUnit(Unit* /*victim*/) OVERRIDE + { + Talk(SAY_SLAY); + } + + void UpdateAI(uint32 diff) OVERRIDE + { + //if no target, update dummy and return + if (!UpdateVictim()) + { + dummy_dragonAI::UpdateAI(diff); + return; + } + + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_SHADOW_FISSURE_TENEBRON: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + DoCast(target, RAID_MODE(SPELL_SHADOW_FISSURE, SPELL_SHADOW_FISSURE)); + events.ScheduleEvent(EVENT_SHADOW_FISSURE_TENEBRON, urand(15000, 20000)); + break; + case EVENT_HATCH_EGGS: + OpenPortal(); + events.ScheduleEvent(EVENT_HATCH_EGGS, 30000); + break; + case EVENT_SHADOW_BREATH_TENEBRON: + Talk(SAY_BREATH); + DoCastVictim(RAID_MODE(SPELL_SHADOW_BREATH, SPELL_SHADOW_BREATH_H)); + events.ScheduleEvent(EVENT_SHADOW_BREATH_TENEBRON, urand(20000, 25000)); + break; + } + } + DoMeleeAttackIfReady(); + } + + private: + EventMap events; + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return new npc_tenebronAI(creature); + } +}; + +/*###### +## Shadron +######*/ + +enum ShadronEvents +{ + EVENT_SHADOW_FISSURE_SHADRON = 5, + EVENT_ACOLYTE_SHADRON = 6, + EVENT_SHADOW_BREATH_SHADRON = 7 +}; + +class npc_shadron : public CreatureScript +{ +public: + npc_shadron() : CreatureScript("npc_shadron") { } + + struct npc_shadronAI : public dummy_dragonAI + { + npc_shadronAI(Creature* creature) : dummy_dragonAI(creature) + { + instance = creature->GetInstanceScript(); + } + + void Reset() OVERRIDE + { + dummy_dragonAI::Reset(); + + if (me->HasAura(SPELL_TWILIGHT_TORMENT_VESP)) + me->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP); + + if (me->HasAura(SPELL_GIFT_OF_TWILIGTH_SHA)) + me->RemoveAurasDueToSpell(SPELL_GIFT_OF_TWILIGTH_SHA); + + if (instance) + instance->SetBossState(DATA_PORTAL_OPEN, NOT_STARTED); + } + + void EnterCombat(Unit* /*who*/) OVERRIDE + { + Talk(SAY_AGGRO); + DoZoneInCombat(); + events.ScheduleEvent(EVENT_SHADOW_FISSURE_SHADRON, 5000); + events.ScheduleEvent(EVENT_ACOLYTE_SHADRON, 60000); + events.ScheduleEvent(EVENT_SHADOW_BREATH_SHADRON, 20000); + } + + void KilledUnit(Unit* /*victim*/) OVERRIDE + { + Talk(SAY_SLAY); + } + + void UpdateAI(uint32 diff) OVERRIDE + { + //if no target, update dummy and return + if (!UpdateVictim()) + { + dummy_dragonAI::UpdateAI(diff); + return; + } + + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_SHADOW_FISSURE_SHADRON: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + DoCast(target, RAID_MODE(SPELL_SHADOW_FISSURE, SPELL_SHADOW_FISSURE_H)); + events.ScheduleEvent(EVENT_SHADOW_FISSURE_SHADRON, urand(15000, 20000)); + break; + case EVENT_ACOLYTE_SHADRON: + if (instance->GetBossState(DATA_PORTAL_OPEN) == NOT_STARTED) + events.ScheduleEvent(EVENT_ACOLYTE_SHADRON, 10000); + else + { + if (me->HasAura(SPELL_GIFT_OF_TWILIGTH_SHA)) + return; + + OpenPortal(); + + if (instance) + instance->SetBossState(DATA_PORTAL_OPEN, IN_PROGRESS); + + events.ScheduleEvent(EVENT_ACOLYTE_SHADRON, urand(60000, 65000)); + } + break; + case EVENT_SHADOW_BREATH_SHADRON: + Talk(SAY_BREATH); + DoCastVictim(RAID_MODE(SPELL_SHADOW_BREATH, SPELL_SHADOW_BREATH_H)); + events.ScheduleEvent(EVENT_SHADOW_BREATH_SHADRON, urand(20000, 25000)); + break; + } + } + DoMeleeAttackIfReady(); + } + + private: + InstanceScript* instance; + EventMap events; + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return new npc_shadronAI(creature); + } +}; + +/*###### +## Vesperon +######*/ + +enum VesperonEvents +{ + EVENT_SHADOW_FISSURE_VESPERON = 8, + EVENT_ACOLYTE_VESPERON = 9, + EVENT_SHADOW_BREATH_VESPERON = 10 +}; + +class npc_vesperon : public CreatureScript +{ +public: + npc_vesperon() : CreatureScript("npc_vesperon") { } + + struct npc_vesperonAI : public dummy_dragonAI + { + npc_vesperonAI(Creature* creature) : dummy_dragonAI(creature) + { + instance = creature->GetInstanceScript(); + } + + void Reset() OVERRIDE + { + dummy_dragonAI::Reset(); + } + + void EnterCombat(Unit* /*who*/) OVERRIDE + { + Talk(SAY_AGGRO); + DoZoneInCombat(); + events.ScheduleEvent(EVENT_SHADOW_FISSURE_VESPERON, 5000); + events.ScheduleEvent(EVENT_ACOLYTE_VESPERON, 60000); + events.ScheduleEvent(EVENT_SHADOW_BREATH_VESPERON, 20000); + } + + void KilledUnit(Unit* /*victim*/) OVERRIDE + { + Talk(SAY_SLAY); + } + + void UpdateAI(uint32 diff) OVERRIDE + { + //if no target, update dummy and return + if (!UpdateVictim()) + { + dummy_dragonAI::UpdateAI(diff); + return; + } + + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_SHADOW_FISSURE_VESPERON: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + DoCast(target, RAID_MODE(SPELL_SHADOW_FISSURE, SPELL_SHADOW_FISSURE_H)); + events.ScheduleEvent(EVENT_SHADOW_FISSURE_VESPERON, urand(15000, 20000)); + break; + case EVENT_ACOLYTE_VESPERON: + if (instance->GetBossState(DATA_PORTAL_OPEN) == IN_PROGRESS) + events.ScheduleEvent(EVENT_ACOLYTE_VESPERON, 10000); + else + { + OpenPortal(); + DoCastVictim(SPELL_TWILIGHT_TORMENT_VESP); + events.ScheduleEvent(EVENT_ACOLYTE_VESPERON, urand(60000, 70000)); + } + break; + case EVENT_SHADOW_BREATH_VESPERON: + Talk(SAY_BREATH); + DoCastVictim(RAID_MODE(SPELL_SHADOW_BREATH, SPELL_SHADOW_BREATH_H)); + events.ScheduleEvent(EVENT_SHADOW_BREATH_VESPERON, urand(20000, 25000)); + break; + } + } + DoMeleeAttackIfReady(); + } + + private: + InstanceScript* instance; + EventMap events; + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return new npc_vesperonAI(creature); + } +}; + +/*###### +## Acolyte of Shadron +######*/ + +class npc_acolyte_of_shadron : public CreatureScript +{ +public: + npc_acolyte_of_shadron() : CreatureScript("npc_acolyte_of_shadron") { } + + struct npc_acolyte_of_shadronAI : public ScriptedAI + { + npc_acolyte_of_shadronAI(Creature* creature) : ScriptedAI(creature) + { + instance = creature->GetInstanceScript(); + } + + void Reset() OVERRIDE + { + // Despawn the NPC automatically after 28 seconds + me->DespawnOrUnsummon(28000); + + if (instance) + { + //if not solo fight, buff main boss, else place debuff on mini-boss. both spells TARGET_SCRIPT + if (instance->GetBossState(DATA_SARTHARION) == IN_PROGRESS) + { + if (Creature* sartharion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SARTHARION))) + sartharion->AddAura(SPELL_GIFT_OF_TWILIGTH_SAR, sartharion); + } + else + { + if (Creature* shadron = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SHADRON))) + shadron->AddAura(SPELL_GIFT_OF_TWILIGTH_SHA, shadron); + } + } + + me->AddAura(SPELL_TWILIGHT_SHIFT_ENTER, me); + } + + void JustDied(Unit* /*killer*/) OVERRIDE + { + if (instance) + { + if (ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SHADRON))) + instance->SetBossState(DATA_PORTAL_OPEN, NOT_STARTED); + + Map* map = me->GetMap(); + if (map->IsDungeon()) + { + Map::PlayerList const &PlayerList = map->GetPlayers(); + + if (PlayerList.isEmpty()) + return; + + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + { + if (i->GetSource()->IsAlive() && i->GetSource()->HasAura(SPELL_TWILIGHT_SHIFT, 0) && !i->GetSource()->GetVictim()) + { + i->GetSource()->CastSpell(i->GetSource(), SPELL_TWILIGHT_SHIFT_REMOVAL_ALL, true); + i->GetSource()->CastSpell(i->GetSource(), SPELL_TWILIGHT_RESIDUE, true); + i->GetSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT); + i->GetSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT_ENTER); + } + } + } + + // not solo fight, so main boss has debuff + if (Creature* debuffTarget = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SARTHARION))) + if (debuffTarget->IsAlive() && debuffTarget->HasAura(SPELL_GIFT_OF_TWILIGTH_SAR)) + debuffTarget->RemoveAurasDueToSpell(SPELL_GIFT_OF_TWILIGTH_SAR); + + // event not in progress, then solo fight and must remove debuff mini-boss + if (Creature* debuffTarget = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SHADRON))) + if (debuffTarget->IsAlive() && debuffTarget->HasAura(SPELL_GIFT_OF_TWILIGTH_SHA)) + debuffTarget->RemoveAurasDueToSpell(SPELL_GIFT_OF_TWILIGTH_SHA); + } + } + + void UpdateAI(uint32 /*diff*/) OVERRIDE + { + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + + private: + InstanceScript* instance; + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return new npc_acolyte_of_shadronAI(creature); + } +}; + +/*###### +## Acolyte of Vesperon +######*/ + +class npc_acolyte_of_vesperon : public CreatureScript +{ +public: + npc_acolyte_of_vesperon() : CreatureScript("npc_acolyte_of_vesperon") { } + + struct npc_acolyte_of_vesperonAI : public ScriptedAI + { + npc_acolyte_of_vesperonAI(Creature* creature) : ScriptedAI(creature) + { + instance = creature->GetInstanceScript(); + } + + void Reset() OVERRIDE + { + // Despawn the NPC automatically after 28 seconds + me->DespawnOrUnsummon(28000); + + if (instance) + me->AddAura(SPELL_TWILIGHT_SHIFT_ENTER, me); + + DoCast(me, SPELL_TWILIGHT_TORMENT_VESP_ACO); + } + + void JustDied(Unit* /*killer*/) OVERRIDE + { + me->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP_ACO); + + // remove twilight torment on Vesperon + if (instance) + { + if (Creature* vesperon = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_VESPERON))) + { + instance->SetBossState(DATA_PORTAL_OPEN, NOT_STARTED); + + if (vesperon->IsAlive() && vesperon->HasAura(SPELL_TWILIGHT_TORMENT_VESP)) + vesperon->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP); + } + + Map* map = me->GetMap(); + if (map->IsDungeon()) + { + Map::PlayerList const &PlayerList = map->GetPlayers(); + + if (PlayerList.isEmpty()) + return; + + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + { + if (i->GetSource()->IsAlive() && i->GetSource()->HasAura(SPELL_TWILIGHT_SHIFT, 0) && !i->GetSource()->GetVictim()) + { + i->GetSource()->CastSpell(i->GetSource(), SPELL_TWILIGHT_SHIFT_REMOVAL_ALL, true); + i->GetSource()->CastSpell(i->GetSource(), SPELL_TWILIGHT_RESIDUE, true); + i->GetSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT); + i->GetSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT_ENTER); + } + if (i->GetSource()->IsAlive() && i->GetSource()->HasAura(SPELL_TWILIGHT_TORMENT_VESP, 0) && !i->GetSource()->GetVictim()) + i->GetSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP); + } + } + + instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_TWILIGHT_TORMENT_VESP_ACO); + instance->DoRemoveAurasDueToSpellOnPlayers(57935); + instance->DoRemoveAurasDueToSpellOnPlayers(58835); // Components of spell Twilight Torment + } + } + + void UpdateAI(uint32 /*diff*/) OVERRIDE + { + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + + private: + InstanceScript* instance; + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return new npc_acolyte_of_vesperonAI(creature); + } +}; + +/*###### +## Twilight Eggs +######*/ + +enum TwilightEggs +{ + EVENT_TWILIGHT_EGGS = 11 +}; + +class npc_twilight_eggs : public CreatureScript +{ +public: + npc_twilight_eggs() : CreatureScript("npc_twilight_eggs") { } + + struct npc_twilight_eggsAI : public ScriptedAI + { + npc_twilight_eggsAI(Creature* creature) : ScriptedAI(creature) + { + SetCombatMovement(false); + instance = creature->GetInstanceScript(); + } + + void Reset() OVERRIDE + { + if (instance) + me->AddAura(SPELL_TWILIGHT_SHIFT_ENTER, me); + + events.ScheduleEvent(EVENT_TWILIGHT_EGGS, 20000); + } + + void SpawnWhelps() + { + me->RemoveAllAuras(); + + if (!instance->GetBossState(DATA_SARTHARION) == IN_PROGRESS) + me->SummonCreature(NPC_TWILIGHT_WHELP, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000); + else + me->SummonCreature(NPC_SHARTHARION_TWILIGHT_WHELP, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000); + me->DealDamage(me, me->GetHealth()); + } + + void JustSummoned(Creature* who) OVERRIDE + { + who->SetInCombatWithZone(); + } + + void UpdateAI(uint32 diff) OVERRIDE + { + events.Update(diff); + + if (events.ExecuteEvent() == EVENT_TWILIGHT_EGGS) + { + if (ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_TENEBRON))) + instance->SetBossState(DATA_PORTAL_OPEN, NOT_STARTED); + + SpawnWhelps(); + } + } + + private: + InstanceScript* instance; + EventMap events; + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return new npc_twilight_eggsAI(creature); + } +}; + +/*###### +## Flame Tsunami +######*/ + +enum FlameTsunami +{ + EVENT_TSUNAMI_TIMER = 12, + EVENT_TSUNAMI_BUFF = 13 +}; + +class npc_flame_tsunami : public CreatureScript +{ +public: + npc_flame_tsunami() : CreatureScript("npc_flame_tsunami") { } + + struct npc_flame_tsunamiAI : public ScriptedAI + { + npc_flame_tsunamiAI(Creature* creature) : ScriptedAI(creature) + { + me->SetDisplayId(11686); + me->AddAura(SPELL_FLAME_TSUNAMI, me); + } + + void Reset() OVERRIDE + { + me->SetReactState(REACT_PASSIVE); + events.ScheduleEvent(EVENT_TSUNAMI_TIMER, 100); + events.ScheduleEvent(EVENT_TSUNAMI_BUFF, 1000); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + } + + void UpdateAI(uint32 diff) OVERRIDE + { + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_TSUNAMI_TIMER: + DoCast(me, SPELL_FLAME_TSUNAMI_DMG_AURA); + events.ScheduleEvent(EVENT_TSUNAMI_TIMER, 500); + break; + case EVENT_TSUNAMI_BUFF: + if (Unit* lavaBlaze = GetClosestCreatureWithEntry(me, NPC_LAVA_BLAZE, 10.0f, true)) + lavaBlaze->CastSpell(lavaBlaze, SPELL_FLAME_TSUNAMI_BUFF, true); + events.ScheduleEvent(EVENT_TSUNAMI_BUFF, 1000); + break; + } + } + } + + private: + EventMap events; + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return new npc_flame_tsunamiAI(creature); + } +}; + +/*###### +## Twilight Fissure +######*/ + +enum TwilightFissure +{ + EVENT_VOID_BLAST = 14 +}; + +class npc_twilight_fissure : public CreatureScript +{ +public: + npc_twilight_fissure() : CreatureScript("npc_twilight_fissure") { } + + struct npc_twilight_fissureAI : public ScriptedAI + { + npc_twilight_fissureAI(Creature* creature) : ScriptedAI(creature) + { + SetCombatMovement(false); + } + + void Reset() OVERRIDE + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + me->AddAura(46265, me); // Wrong, can't find proper visual + me->AddAura(69422, me); + events.ScheduleEvent(EVENT_VOID_BLAST, 5000); + } + + void UpdateAI(uint32 diff) OVERRIDE + { + events.Update(diff); + + if (events.ExecuteEvent() == EVENT_VOID_BLAST) + { + DoCastAOE(RAID_MODE(SPELL_VOID_BLAST, SPELL_VOID_BLAST_H)); + ////twilight realm + //DoCastVictim(57620, true); + //DoCastVictim(57874, true); + me->RemoveAllAuras(); + me->Kill(me); + } + } + + private: + EventMap events; + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return new npc_twilight_fissureAI(creature); + } +}; + +/*###### +## Twilight Whelps +######*/ + +enum TwilightWhelps +{ + EVENT_FADE_ARMOR = 15 +}; + +class npc_twilight_whelp : public CreatureScript +{ +public: + npc_twilight_whelp() : CreatureScript("npc_twilight_whelp") { } + + struct npc_twilight_whelpAI : public ScriptedAI + { + npc_twilight_whelpAI(Creature* creature) : ScriptedAI(creature) + { + Reset(); + } + + void Reset() OVERRIDE + { + me->RemoveAllAuras(); + me->SetInCombatWithZone(); + events.ScheduleEvent(EVENT_FADE_ARMOR, 1000); + } + + void UpdateAI(uint32 diff) OVERRIDE + { + if (!UpdateVictim()) + return; + + // twilight torment + events.Update(diff); + + if (events.ExecuteEvent() == EVENT_FADE_ARMOR) + { + DoCastVictim(SPELL_FADE_ARMOR); + events.ScheduleEvent(EVENT_FADE_ARMOR, urand(5000, 10000)); + } + + DoMeleeAttackIfReady(); + } + + private: + EventMap events; + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return new npc_twilight_whelpAI(creature); + } +}; + +class achievement_twilight_assist : public AchievementCriteriaScript +{ + public: + achievement_twilight_assist() : AchievementCriteriaScript("achievement_twilight_assist") { } + + bool OnCheck(Player* /*player*/, Unit* target) OVERRIDE + { + return target && target->GetAI()->GetData(TWILIGHT_ACHIEVEMENTS) >= 1; + } +}; + +class achievement_twilight_duo : public AchievementCriteriaScript +{ + public: + achievement_twilight_duo() : AchievementCriteriaScript("achievement_twilight_duo") { } + + bool OnCheck(Player* /*player*/, Unit* target) OVERRIDE + { + return target && target->GetAI()->GetData(TWILIGHT_ACHIEVEMENTS) >= 2; + } +}; + +class achievement_twilight_zone : public AchievementCriteriaScript +{ + public: + achievement_twilight_zone() : AchievementCriteriaScript("achievement_twilight_zone") { } + + bool OnCheck(Player* /*player*/, Unit* target) OVERRIDE + { + return target && target->GetAI()->GetData(TWILIGHT_ACHIEVEMENTS) == 3; + } +}; + +void AddSC_obsidian_sanctum() +{ + new npc_vesperon(); + new npc_shadron(); + new npc_tenebron(); + new npc_acolyte_of_shadron(); + new npc_acolyte_of_vesperon(); + new npc_twilight_eggs(); + new npc_flame_tsunami(); + new npc_twilight_fissure(); + new npc_twilight_whelp(); + new achievement_twilight_assist(); + new achievement_twilight_duo(); + new achievement_twilight_zone(); +} + diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.h b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.h index 7d2403be469..8cfb3931372 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.h +++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.h @@ -18,17 +18,18 @@ #ifndef DEF_OBSIDIAN_SANCTUM_H #define DEF_OBSIDIAN_SANCTUM_H +#define OSScriptName "instance_obsidian_sanctum" + +uint32 const EncounterCount = 5; + enum DataTypes { - TYPE_SARTHARION_EVENT = 1, - TYPE_TENEBRON_PREKILLED = 2, - TYPE_SHADRON_PREKILLED = 3, - TYPE_VESPERON_PREKILLED = 4, - - DATA_SARTHARION = 10, - DATA_TENEBRON = 11, - DATA_SHADRON = 12, - DATA_VESPERON = 13 + DATA_SARTHARION = 0, + DATA_TENEBRON = 1, + DATA_SHADRON = 2, + DATA_VESPERON = 3, + DATA_PORTAL_OPEN = 4, + TWILIGHT_ACHIEVEMENTS = 5 }; enum CreaturesIds diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp index 8f6b951d524..3fdfc0c8ae3 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp @@ -310,8 +310,6 @@ class npc_snobold_vassal : public CreatureScript _targetGUID = 0; _targetDied = false; - if (_instance) - _bossGUID = _instance->GetData64(NPC_GORMOK); //Workaround for Snobold me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); } @@ -450,7 +448,6 @@ class npc_snobold_vassal : public CreatureScript private: EventMap _events; InstanceScript* _instance; - uint64 _bossGUID; uint64 _targetGUID; bool _targetDied; }; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp index 9e401c4f962..a72d3917004 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp @@ -366,7 +366,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript if (type < MAX_ENCOUNTERS) { - TC_LOG_INFO(LOG_FILTER_TSCR, "[ToCr] BossState(type %u) %u = state %u;", type, GetBossState(type), state); + TC_LOG_INFO("scripts", "[ToCr] BossState(type %u) %u = state %u;", type, GetBossState(type), state); if (state == FAIL) { if (instance->IsHeroic()) diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp index ae57732e9e2..b1339b13119 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp @@ -43,12 +43,21 @@ class instance_forge_of_souls : public InstanceMapScript teamInInstance = 0; } + void OnPlayerEnter(Player* player) OVERRIDE + { + if (!teamInInstance) + teamInInstance = player->GetTeam(); + } + void OnCreatureCreate(Creature* creature) OVERRIDE { - Map::PlayerList const &players = instance->GetPlayers(); - if (!players.isEmpty()) - if (Player* player = players.begin()->GetSource()) - teamInInstance = player->GetTeam(); + if (!teamInInstance) + { + Map::PlayerList const& players = instance->GetPlayers(); + if (!players.isEmpty()) + if (Player* player = players.begin()->GetSource()) + teamInInstance = player->GetTeam(); + } switch (creature->GetEntry()) { diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp index 1b82de35f54..96b772df5a9 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp @@ -1089,9 +1089,9 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript break; case EVENT_ESCAPE_27: if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) - me->SummonGameObject(GO_CAPTAIN_CHEST_1, ChestPos.GetPositionX(), ChestPos.GetPositionY(), ChestPos.GetPositionZ(), ChestPos.GetOrientation(), 0, 0, 0, 0, 720000); + me->SummonGameObject(IsHeroic() ? GO_CAPTAIN_CHEST_ALLIANCE_HEROIC : GO_CAPTAIN_CHEST_ALLIANCE_NORMAL, ChestPos.GetPositionX(), ChestPos.GetPositionY(), ChestPos.GetPositionZ(), ChestPos.GetOrientation(), 0, 0, 0, 0, 720000); else - me->SummonGameObject(GO_CAPTAIN_CHEST_3, ChestPos.GetPositionX(), ChestPos.GetPositionY(), ChestPos.GetPositionZ(), ChestPos.GetOrientation(), 0, 0, 0, 0, 720000); + me->SummonGameObject(IsHeroic() ? GO_CAPTAIN_CHEST_HORDE_HEROIC : GO_CAPTAIN_CHEST_HORDE_NORMAL, ChestPos.GetPositionX(), ChestPos.GetPositionY(), ChestPos.GetPositionZ(), ChestPos.GetOrientation(), 0, 0, 0, 0, 720000); me->SummonGameObject(GO_PORTAL, FinalPortalPos.GetPositionX(), FinalPortalPos.GetPositionY(), FinalPortalPos.GetPositionZ(), FinalPortalPos.GetOrientation(), 0, 0, 0, 0, 720000); if (Creature* lichking = ObjectAccessor::GetCreature(*me, _lichkingGUID)) lichking->DespawnOrUnsummon(1); @@ -1121,6 +1121,7 @@ enum TrashSpells SPELL_FROSTBOLT = 72166, SPELL_CHAINS_OF_ICE = 72121, SPELL_HALLUCINATION = 72342, + AURA_HALLUCINATION = 72343, // Phantom Hallucination (same as phantom mage + HALLUCINATION_2 when dies) SPELL_HALLUCINATION_2 = 72344, @@ -1180,13 +1181,11 @@ enum TrashEvents struct npc_gauntlet_trash : public ScriptedAI { - npc_gauntlet_trash(Creature* creature) : ScriptedAI(creature), - _instance(creature->GetInstanceScript()) - { - } + npc_gauntlet_trash(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { } void Reset() OVERRIDE { + InternalWaveId = 0; me->CastSpell(me, SPELL_WELL_OF_SOULS, true); _events.Reset(); } @@ -1226,9 +1225,7 @@ public: struct npc_ghostly_priestAI : public npc_gauntlet_trash { - npc_ghostly_priestAI(Creature* creature) : npc_gauntlet_trash(creature) - { - } + npc_ghostly_priestAI(Creature* creature) : npc_gauntlet_trash(creature) { } void EnterCombat(Unit* /*who*/) OVERRIDE { @@ -1297,8 +1294,12 @@ public: struct npc_phantom_mageAI : public npc_gauntlet_trash { - npc_phantom_mageAI(Creature* creature) : npc_gauntlet_trash(creature) + npc_phantom_mageAI(Creature* creature) : npc_gauntlet_trash(creature) { } + + void EnterEvadeMode() OVERRIDE { + if (!me->HasAura(AURA_HALLUCINATION)) + npc_gauntlet_trash::EnterEvadeMode(); } void EnterCombat(Unit* /*who*/) OVERRIDE @@ -1342,6 +1343,8 @@ public: _events.ScheduleEvent(EVENT_CHAINS_OF_ICE, 15000); break; case EVENT_HALLUCINATION: + // removing any dots on mage or else the invisibility spell will break duration + me->RemoveAllAuras(); DoCast(SPELL_HALLUCINATION); break; } @@ -1365,6 +1368,19 @@ public: { npc_phantom_hallucinationAI(Creature* creature) : npc_phantom_mage::npc_phantom_mageAI(creature) { } + void Reset() OVERRIDE + { + if (Unit* unit = me->SelectNearestTarget()) + AttackStart(unit); + DoZoneInCombat(); + } + + void EnterEvadeMode() OVERRIDE + { + if (!me->GetOwner()->HasAura(AURA_HALLUCINATION)) + npc_phantom_mage::npc_phantom_mageAI::EnterEvadeMode(); + } + void JustDied(Unit* /*killer*/) OVERRIDE { DoCast(SPELL_HALLUCINATION_2); @@ -1384,9 +1400,7 @@ public: struct npc_shadowy_mercenaryAI : public npc_gauntlet_trash { - npc_shadowy_mercenaryAI(Creature* creature) : npc_gauntlet_trash(creature) - { - } + npc_shadowy_mercenaryAI(Creature* creature) : npc_gauntlet_trash(creature) { } void EnterCombat(Unit* /*who*/) OVERRIDE { @@ -1444,9 +1458,7 @@ public: struct npc_spectral_footmanAI : public npc_gauntlet_trash { - npc_spectral_footmanAI(Creature* creature) : npc_gauntlet_trash(creature) - { - } + npc_spectral_footmanAI(Creature* creature) : npc_gauntlet_trash(creature) { } void EnterCombat(Unit* /*who*/) OVERRIDE { @@ -1498,9 +1510,7 @@ public: struct npc_tortured_riflemanAI : public npc_gauntlet_trash { - npc_tortured_riflemanAI(Creature* creature) : npc_gauntlet_trash(creature) - { - } + npc_tortured_riflemanAI(Creature* creature) : npc_gauntlet_trash(creature) { } void EnterCombat(Unit* /*who*/) OVERRIDE { diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h index d8d4f2d5524..9c40cb70141 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h @@ -95,10 +95,10 @@ enum GameObjects GO_ORGRIM_HAMMER = 201599, GO_PORTAL = 202079, - GO_CAPTAIN_CHEST_1 = 202212, //3145 - GO_CAPTAIN_CHEST_2 = 201710, //30357 - GO_CAPTAIN_CHEST_3 = 202337, //3246 - GO_CAPTAIN_CHEST_4 = 202336, //3333 + GO_CAPTAIN_CHEST_HORDE_NORMAL = 202212, //3145 + GO_CAPTAIN_CHEST_ALLIANCE_NORMAL = 201710, //30357 + GO_CAPTAIN_CHEST_HORDE_HEROIC = 202337, //3246 + GO_CAPTAIN_CHEST_ALLIANCE_HEROIC = 202336, //3333 }; enum HorWorldStates diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp index 0599596fc0a..955f4fb1568 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp @@ -110,10 +110,13 @@ public: void OnCreatureCreate(Creature* creature) OVERRIDE { - Map::PlayerList const& players = instance->GetPlayers(); - if (!players.isEmpty()) - if (Player* player = players.begin()->GetSource()) - _teamInInstance = player->GetTeam(); + if (!_teamInInstance) + { + Map::PlayerList const& players = instance->GetPlayers(); + if (!players.isEmpty()) + if (Player* player = players.begin()->GetSource()) + _teamInInstance = player->GetTeam(); + } switch (creature->GetEntry()) { @@ -184,7 +187,7 @@ public: case GO_ARTHAS_DOOR: _arthasDoorGUID = go->GetGUID(); go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_INTERACT_COND); - if (GetBossState(DATA_FROSWORN_EVENT) == DONE) + if (GetData(DATA_FROSWORN_EVENT) == DONE) HandleGameObject(0, true, go); else HandleGameObject(0, false, go); @@ -511,13 +514,13 @@ public: OUT_SAVE_INST_DATA; std::ostringstream saveStream; - saveStream << "H R " << GetBossSaveData() << _introEvent << ' ' << _frostwornGeneral << _escapeevent; + saveStream << "H R " << GetBossSaveData() << _introEvent << ' ' << _frostwornGeneral << ' ' << _escapeevent; OUT_SAVE_INST_DATA_COMPLETE; return saveStream.str(); } - void Load(char const* in) OVERRIDE OVERRIDE + void Load(char const* in) OVERRIDE { if (!in) { diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp index 20b7d39815f..4a9a41f6f8e 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp @@ -187,7 +187,7 @@ class boss_garfrost : public CreatureScript switch (eventId) { case EVENT_THROW_SARONITE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true)) { Talk(SAY_THROW_SARONITE, target->GetGUID()); DoCast(target, SPELL_THROW_SARONITE); @@ -199,7 +199,7 @@ class boss_garfrost : public CreatureScript events.ScheduleEvent(EVENT_CHILLING_WAVE, 40000, 0, PHASE_TWO); break; case EVENT_DEEP_FREEZE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true)) { Talk(SAY_CAST_DEEP_FREEZE, target->GetGUID()); DoCast(target, SPELL_DEEP_FREEZE); diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp index d8a4dd01f90..48cc6f89a13 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp @@ -385,32 +385,25 @@ class boss_rimefang : public CreatureScript class player_overlord_brandAI : public PlayerAI { public: - player_overlord_brandAI(Player* player) : PlayerAI(player), _tyrannus(0) - { - } - - void SetGUID(uint64 guid, int32 /*type*/) OVERRIDE - { - _tyrannus = guid; - } + player_overlord_brandAI(Player* player, uint64 casterGUID) : PlayerAI(player), _tyrannusGUID(casterGUID) { } void DamageDealt(Unit* /*victim*/, uint32& damage, DamageEffectType /*damageType*/) OVERRIDE { - if (Creature* tyrannus = ObjectAccessor::GetCreature(*me, _tyrannus)) - if (tyrannus->GetVictim()) - me->CastCustomSpell(SPELL_OVERLORD_BRAND_DAMAGE, SPELLVALUE_BASE_POINT0, damage, tyrannus->GetVictim(), true, NULL, NULL, tyrannus->GetGUID()); + if (Creature* tyrannus = ObjectAccessor::GetCreature(*me, _tyrannusGUID)) + if (Unit* victim = tyrannus->GetVictim()) + me->CastCustomSpell(SPELL_OVERLORD_BRAND_DAMAGE, SPELLVALUE_BASE_POINT0, damage, victim, true, NULL, NULL, tyrannus->GetGUID()); } void HealDone(Unit* /*target*/, uint32& addHealth) OVERRIDE { - if (Creature* tyrannus = ObjectAccessor::GetCreature(*me, _tyrannus)) - me->CastCustomSpell(SPELL_OVERLORD_BRAND_HEAL, SPELLVALUE_BASE_POINT0, int32(addHealth*5.5f), tyrannus, true, NULL, NULL, tyrannus->GetGUID()); + if (Creature* tyrannus = ObjectAccessor::GetCreature(*me, _tyrannusGUID)) + me->CastCustomSpell(SPELL_OVERLORD_BRAND_HEAL, SPELLVALUE_BASE_POINT0, int32(addHealth * 5.5f), tyrannus, true, NULL, NULL, tyrannus->GetGUID()); } void UpdateAI(uint32 /*diff*/) OVERRIDE { } private: - uint64 _tyrannus; + uint64 _tyrannusGUID; }; class spell_tyrannus_overlord_brand : public SpellScriptLoader @@ -434,8 +427,8 @@ class spell_tyrannus_overlord_brand : public SpellScriptLoader oldAI = GetTarget()->GetAI(); oldAIState = GetTarget()->IsAIEnabled; - GetTarget()->SetAI(new player_overlord_brandAI(GetTarget()->ToPlayer())); - GetTarget()->GetAI()->SetGUID(GetCasterGUID()); + GetTarget()->SetAI(new player_overlord_brandAI(GetTarget()->ToPlayer(), GetCasterGUID())); + GetTarget()->IsAIEnabled = true; } void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp index 7aa8b123f98..d61fc69a0ae 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp @@ -63,7 +63,7 @@ class instance_pit_of_saron : public InstanceMapScript { if (!_teamInInstance) { - Map::PlayerList const &players = instance->GetPlayers(); + Map::PlayerList const& players = instance->GetPlayers(); if (!players.isEmpty()) if (Player* player = players.begin()->GetSource()) _teamInInstance = player->GetTeam(); diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp index a5c35650032..f76c46d96ff 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp @@ -200,7 +200,7 @@ class boss_gothik : public CreatureScript if (LiveTriggerGUID.size() < POS_LIVE || DeadTriggerGUID.size() < POS_DEAD) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "Script Gothik: cannot summon triggers!"); + TC_LOG_ERROR("scripts", "Script Gothik: cannot summon triggers!"); EnterEvadeMode(); return; } @@ -514,6 +514,7 @@ class npc_gothik_minion : public CreatureScript npc_gothik_minionAI(Creature* creature) : CombatAI(creature) { liveSide = IN_LIVE_SIDE(me); + gateClose = false; } bool liveSide; diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp index a1511fb3dd8..4777b451e4e 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp @@ -165,7 +165,7 @@ public: unit->SetControlled(true, UNIT_STATE_ROOT); } - void ProcessEvent(WorldObject* /*obj*/, uint32 eventId) + void ProcessEvent(WorldObject* /*obj*/, uint32 eventId) OVERRIDE { if (eventId == EVENT_FOCUSING_IRIS) { diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp index 25091a457f2..d22a0bcc79f 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp @@ -52,141 +52,141 @@ enum DrakosEvents class boss_drakos : public CreatureScript { -public: - boss_drakos() : CreatureScript("boss_drakos") { } + public: + boss_drakos() : CreatureScript("boss_drakos") { } - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new boss_drakosAI(creature); - } - - struct boss_drakosAI : public BossAI - { - boss_drakosAI(Creature* creature) : BossAI(creature, DATA_DRAKOS_EVENT) { } - - void Reset() OVERRIDE + struct boss_drakosAI : public BossAI { - _Reset(); + boss_drakosAI(Creature* creature) : BossAI(creature, DATA_DRAKOS) { } - events.ScheduleEvent(EVENT_MAGIC_PULL, 15000); - events.ScheduleEvent(EVENT_STOMP, 17000); - events.ScheduleEvent(EVENT_BOMB_SUMMON, 2000); + void Reset() OVERRIDE + { + _Reset(); - postPull = false; - } + events.ScheduleEvent(EVENT_MAGIC_PULL, 15000); + events.ScheduleEvent(EVENT_STOMP, 17000); + events.ScheduleEvent(EVENT_BOMB_SUMMON, 2000); - void EnterCombat(Unit* /*who*/) OVERRIDE - { - _EnterCombat(); - Talk(SAY_AGGRO); - } + postPull = false; + } - void UpdateAI(uint32 diff) OVERRIDE - { - //Return since we have no target - if (!UpdateVictim()) - return; + void EnterCombat(Unit* /*who*/) OVERRIDE + { + _EnterCombat(); + Talk(SAY_AGGRO); + } - events.Update(diff); + void UpdateAI(uint32 diff) OVERRIDE + { + if (!UpdateVictim()) + return; - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); - while (uint32 eventId = events.ExecuteEvent()) - { - switch (eventId) - { - case EVENT_BOMB_SUMMON: - { - Position pPosition; - me->GetPosition(&pPosition); + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - for (uint8 i = 0; i <= (postPull ? 3 : 0); i++) + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_BOMB_SUMMON: { - me->GetRandomNearPosition(pPosition, float(urand(0, 10))); - me->SummonCreature(NPC_UNSTABLE_SPHERE, pPosition); + Position position; + me->GetPosition(&position); + + for (uint8 i = 0; i <= (postPull ? 3 : 0); i++) + { + me->GetRandomNearPosition(position, frand(0.0f, 10.0f)); + me->SummonCreature(NPC_UNSTABLE_SPHERE, position); + } } - } - events.ScheduleEvent(EVENT_BOMB_SUMMON, 2000); - break; - case EVENT_MAGIC_PULL: - DoCast(SPELL_MAGIC_PULL); - postPull = true; - events.ScheduleEvent(EVENT_MAGIC_PULL, 15000); - break; - case EVENT_STOMP: - Talk(SAY_STOMP); - DoCast(SPELL_THUNDERING_STOMP); - events.ScheduleEvent(EVENT_STOMP, 17000); - break; + events.ScheduleEvent(EVENT_BOMB_SUMMON, 2000); + break; + case EVENT_MAGIC_PULL: + DoCast(SPELL_MAGIC_PULL); + postPull = true; + events.ScheduleEvent(EVENT_MAGIC_PULL, 15000); + break; + case EVENT_STOMP: + Talk(SAY_STOMP); + DoCast(SPELL_THUNDERING_STOMP); + events.ScheduleEvent(EVENT_STOMP, 17000); + break; + default: + break; + } } + + DoMeleeAttackIfReady(); } - DoMeleeAttackIfReady(); - } + void JustDied(Unit* /*killer*/) OVERRIDE + { + _JustDied(); - void JustDied(Unit* /*killer*/) OVERRIDE - { - _JustDied(); + Talk(SAY_DEATH); - Talk(SAY_DEATH); + // start achievement timer (kill Eregos within 20 min) + instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); + } - // start achievement timer (kill Eregos within 20 min) - instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); - } + void KilledUnit(Unit* /*victim*/) OVERRIDE + { + Talk(SAY_KILL); + } + + private: + bool postPull; + }; - void KilledUnit(Unit* /*victim*/) OVERRIDE + CreatureAI* GetAI(Creature* creature) const OVERRIDE { - Talk(SAY_KILL); + return GetOculusAI<boss_drakosAI>(creature); } - private: - bool postPull; - }; }; class npc_unstable_sphere : public CreatureScript { -public: - npc_unstable_sphere() : CreatureScript("npc_unstable_sphere") { } + public: + npc_unstable_sphere() : CreatureScript("npc_unstable_sphere") { } - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_unstable_sphereAI(creature); - } + struct npc_unstable_sphereAI : public ScriptedAI + { + npc_unstable_sphereAI(Creature* creature) : ScriptedAI(creature) { } - struct npc_unstable_sphereAI : public ScriptedAI - { - npc_unstable_sphereAI(Creature* creature) : ScriptedAI(creature) { } + void Reset() OVERRIDE + { + me->SetReactState(REACT_PASSIVE); + me->GetMotionMaster()->MoveRandom(40.0f); - void Reset() OVERRIDE - { - me->SetReactState(REACT_PASSIVE); - me->GetMotionMaster()->MoveRandom(40.0f); + me->AddAura(SPELL_UNSTABLE_SPHERE_PASSIVE, me); + me->AddAura(SPELL_UNSTABLE_SPHERE_TIMER, me); - me->AddAura(SPELL_UNSTABLE_SPHERE_PASSIVE, me); - me->AddAura(SPELL_UNSTABLE_SPHERE_TIMER, me); + pulseTimer = 3000; - pulseTimer = 3000; - deathTimer = 19000; - } + me->DespawnOrUnsummon(19000); + } - void UpdateAI(uint32 diff) OVERRIDE - { - if (pulseTimer <= diff) + void UpdateAI(uint32 diff) OVERRIDE { - DoCast(SPELL_UNSTABLE_SPHERE_PULSE); - pulseTimer = 3*IN_MILLISECONDS; - } else pulseTimer -= diff; + if (pulseTimer <= diff) + { + DoCast(SPELL_UNSTABLE_SPHERE_PULSE); + pulseTimer = 3 * IN_MILLISECONDS; + } + else + pulseTimer -= diff; + } - if (deathTimer <= diff) - me->DisappearAndDie(); - else deathTimer -= diff; - } - private: - uint32 pulseTimer; - uint32 deathTimer; - }; + private: + uint32 pulseTimer; + }; + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return new npc_unstable_sphereAI(creature); + } }; void AddSC_boss_drakos() diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp index abf0d6537c3..ca6f580633c 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp @@ -21,8 +21,8 @@ #include "SpellAuraEffects.h" #include "oculus.h" -//Types of drake mounts: Ruby(Tank), Amber(DPS), Emerald(Healer) -//Two Repeating phases +// Types of drake mounts: Ruby (Tank), Amber (DPS), Emerald (Healer) +// Two Repeating phases enum Events { @@ -61,8 +61,8 @@ enum Npcs enum Phases { - PHASE_NORMAL = 1, - PHASE_FIRST_PLANAR = 2, + PHASE_NORMAL = 1, + PHASE_FIRST_PLANAR = 2, PHASE_SECOND_PLANAR = 3 }; @@ -80,172 +80,174 @@ enum EregosData class boss_eregos : public CreatureScript { -public: - boss_eregos() : CreatureScript("boss_eregos") { } - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new boss_eregosAI(creature); - } - - struct boss_eregosAI : public BossAI - { - boss_eregosAI(Creature* creature) : BossAI(creature, DATA_EREGOS_EVENT) { } + public: + boss_eregos() : CreatureScript("boss_eregos") { } - void Reset() OVERRIDE + struct boss_eregosAI : public BossAI { - _Reset(); - _phase = PHASE_NORMAL; - - _rubyVoid = true; - _emeraldVoid = true; - _amberVoid = true; + boss_eregosAI(Creature* creature) : BossAI(creature, DATA_EREGOS) { } - DoAction(ACTION_SET_NORMAL_EVENTS); - } + void Reset() OVERRIDE + { + _Reset(); + _phase = PHASE_NORMAL; - void KilledUnit(Unit* /*victim*/) OVERRIDE - { - Talk(SAY_KILL); - } + _rubyVoid = true; + _emeraldVoid = true; + _amberVoid = true; - void EnterCombat(Unit* /*who*/) OVERRIDE - { - _EnterCombat(); - - Talk(SAY_AGGRO); - /* Checks for present drakes vehicles from each type and deactivate achievement that corresponds to each found - The checks are so big in case some party try weird things like pulling boss down or hiding out of check range, the only thing player need is to get the boss kill credit after the check /even if he or his drake die/ - Drakes mechanic would despawn all after unmount and also drakes should be auto mounted after item use, item use after Eregos is engaged leads to his despawn - based on retail data. */ - if (me->FindNearestCreature(NPC_RUBY_DRAKE_VEHICLE, 500.0f, true)) - _rubyVoid = false; - if (me->FindNearestCreature(NPC_EMERALD_DRAKE_VEHICLE, 500.0f, true)) - _emeraldVoid = false; - if (me->FindNearestCreature(NPC_AMBER_DRAKE_VEHICLE, 500.0f, true)) - _amberVoid = false; - } + DoAction(ACTION_SET_NORMAL_EVENTS); + } - uint32 GetData(uint32 type) const OVERRIDE - { - switch (type) - { - case DATA_RUBY_VOID: - return _rubyVoid; - case DATA_EMERALD_VOID: - return _emeraldVoid; - case DATA_AMBER_VOID: - return _amberVoid; - default: - break; + void KilledUnit(Unit* /*victim*/) OVERRIDE + { + Talk(SAY_KILL); } - return 0; - } - void DoAction(int32 action) OVERRIDE - { - if (action != ACTION_SET_NORMAL_EVENTS) - return; + void EnterCombat(Unit* /*who*/) OVERRIDE + { + _EnterCombat(); + + Talk(SAY_AGGRO); + /* Checks for present drakes vehicles from each type and deactivate achievement that corresponds to each found + The checks are so big in case some party try weird things like pulling boss down or hiding out of check range, the only thing player need is to get the boss kill credit after the check /even if he or his drake die/ + Drakes mechanic would despawn all after unmount and also drakes should be auto mounted after item use, item use after Eregos is engaged leads to his despawn - based on retail data. */ + if (me->FindNearestCreature(NPC_RUBY_DRAKE_VEHICLE, 500.0f, true)) + _rubyVoid = false; + if (me->FindNearestCreature(NPC_EMERALD_DRAKE_VEHICLE, 500.0f, true)) + _emeraldVoid = false; + if (me->FindNearestCreature(NPC_AMBER_DRAKE_VEHICLE, 500.0f, true)) + _amberVoid = false; + } - events.ScheduleEvent(EVENT_ARCANE_BARRAGE, urand(3, 10) * IN_MILLISECONDS, 0, PHASE_NORMAL); - events.ScheduleEvent(EVENT_ARCANE_VOLLEY, urand(10, 25) * IN_MILLISECONDS, 0, PHASE_NORMAL); - events.ScheduleEvent(EVENT_ENRAGED_ASSAULT, urand(35, 50) * IN_MILLISECONDS, 0, PHASE_NORMAL); - events.ScheduleEvent(EVENT_SUMMON_LEY_WHELP, urand(15, 30) * IN_MILLISECONDS, 0, PHASE_NORMAL); - } + uint32 GetData(uint32 type) const OVERRIDE + { + switch (type) + { + case DATA_RUBY_VOID: + return _rubyVoid; + case DATA_EMERALD_VOID: + return _emeraldVoid; + case DATA_AMBER_VOID: + return _amberVoid; + default: + break; + } + return 0; + } - void JustSummoned(Creature* summon) OVERRIDE - { - BossAI::JustSummoned(summon); + void DoAction(int32 action) OVERRIDE + { + if (action != ACTION_SET_NORMAL_EVENTS) + return; + + events.SetPhase(PHASE_NORMAL); + events.ScheduleEvent(EVENT_ARCANE_BARRAGE, urand(3, 10) * IN_MILLISECONDS, 0, PHASE_NORMAL); + events.ScheduleEvent(EVENT_ARCANE_VOLLEY, urand(10, 25) * IN_MILLISECONDS, 0, PHASE_NORMAL); + events.ScheduleEvent(EVENT_ENRAGED_ASSAULT, urand(35, 50) * IN_MILLISECONDS, 0, PHASE_NORMAL); + events.ScheduleEvent(EVENT_SUMMON_LEY_WHELP, urand(15, 30) * IN_MILLISECONDS, 0, PHASE_NORMAL); + } - if (summon->GetEntry() != NPC_PLANAR_ANOMALY) - return; + void JustSummoned(Creature* summon) OVERRIDE + { + BossAI::JustSummoned(summon); - summon->CombatStop(true); - summon->SetReactState(REACT_PASSIVE); - summon->GetMotionMaster()->MoveRandom(100.0f); - } + if (summon->GetEntry() != NPC_PLANAR_ANOMALY) + return; - void SummonedCreatureDespawn(Creature* summon) OVERRIDE - { - if (summon->GetEntry() != NPC_PLANAR_ANOMALY) - return; + summon->CombatStop(true); + summon->SetReactState(REACT_PASSIVE); + summon->GetMotionMaster()->MoveRandom(100.0f); + } - // TO-DO: See why the spell is not casted - summon->CastSpell(summon, SPELL_PLANAR_BLAST, true); - } + void SummonedCreatureDespawn(Creature* summon) OVERRIDE + { + if (summon->GetEntry() != NPC_PLANAR_ANOMALY) + return; - void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/) OVERRIDE - { - if (!me->GetMap()->IsHeroic()) - return; + /// @todo: See why the spell is not casted + summon->CastSpell(summon, SPELL_PLANAR_BLAST, true); + } - if ( (me->GetHealthPct() < 60.0f && me->GetHealthPct() > 20.0f && _phase < PHASE_FIRST_PLANAR) - || (me->GetHealthPct() < 20.0f && _phase < PHASE_SECOND_PLANAR) ) + void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/) OVERRIDE { - events.Reset(); - _phase = (me->GetHealthPct() < 60.0f && me->GetHealthPct() > 20.0f) ? PHASE_FIRST_PLANAR : PHASE_SECOND_PLANAR; + if (!IsHeroic()) + return; - Talk(SAY_SHIELD); - DoCast(SPELL_PLANAR_SHIFT); + if ( (me->GetHealthPct() < 60.0f && me->GetHealthPct() > 20.0f && _phase < PHASE_FIRST_PLANAR) + || (me->GetHealthPct() < 20.0f && _phase < PHASE_SECOND_PLANAR) ) + { + events.Reset(); + _phase = (me->GetHealthPct() < 60.0f && me->GetHealthPct() > 20.0f) ? PHASE_FIRST_PLANAR : PHASE_SECOND_PLANAR; - // not sure about the amount, and if we should despawn previous spawns (dragon trashs) - summons.DespawnAll(); - for (uint8 i = 0; i < 6; i++) - DoCast(SPELL_PLANAR_ANOMALIES); + Talk(SAY_SHIELD); + DoCast(SPELL_PLANAR_SHIFT); + + // not sure about the amount, and if we should despawn previous spawns (dragon trashs) + summons.DespawnAll(); + for (uint8 i = 0; i < 6; i++) + DoCast(SPELL_PLANAR_ANOMALIES); + } } - } - void UpdateAI(uint32 diff) OVERRIDE - { - //Return since we have no target - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) OVERRIDE + { + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - while (uint32 eventId = events.ExecuteEvent()) - { - switch (eventId) + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_ARCANE_BARRAGE: - DoCastVictim(SPELL_ARCANE_BARRAGE); - events.ScheduleEvent(EVENT_ARCANE_BARRAGE, urand(3, 10) * IN_MILLISECONDS, 0, PHASE_NORMAL); - break; - case EVENT_ARCANE_VOLLEY: - DoCastAOE(SPELL_ARCANE_VOLLEY); - events.ScheduleEvent(EVENT_ARCANE_VOLLEY, urand(10, 25) * IN_MILLISECONDS, 0, PHASE_NORMAL); - break; - case EVENT_ENRAGED_ASSAULT: - Talk(SAY_ENRAGE); - DoCast(SPELL_ENRAGED_ASSAULT); - events.ScheduleEvent(EVENT_ENRAGED_ASSAULT, urand(35, 50) * IN_MILLISECONDS, 0, PHASE_NORMAL); - break; - case EVENT_SUMMON_LEY_WHELP: - for (uint8 i = 0; i < 3; i++) - DoCast(SPELL_SUMMON_LEY_WHELP); - events.ScheduleEvent(EVENT_SUMMON_LEY_WHELP, urand(15, 30) * IN_MILLISECONDS, 0, PHASE_NORMAL); - break; + switch (eventId) + { + case EVENT_ARCANE_BARRAGE: + DoCastVictim(SPELL_ARCANE_BARRAGE); + events.ScheduleEvent(EVENT_ARCANE_BARRAGE, urand(3, 10) * IN_MILLISECONDS, 0, PHASE_NORMAL); + break; + case EVENT_ARCANE_VOLLEY: + DoCastAOE(SPELL_ARCANE_VOLLEY); + events.ScheduleEvent(EVENT_ARCANE_VOLLEY, urand(10, 25) * IN_MILLISECONDS, 0, PHASE_NORMAL); + break; + case EVENT_ENRAGED_ASSAULT: + Talk(SAY_ENRAGE); + DoCast(SPELL_ENRAGED_ASSAULT); + events.ScheduleEvent(EVENT_ENRAGED_ASSAULT, urand(35, 50) * IN_MILLISECONDS, 0, PHASE_NORMAL); + break; + case EVENT_SUMMON_LEY_WHELP: + for (uint8 i = 0; i < 3; i++) + DoCast(SPELL_SUMMON_LEY_WHELP); + events.ScheduleEvent(EVENT_SUMMON_LEY_WHELP, urand(15, 30) * IN_MILLISECONDS, 0, PHASE_NORMAL); + break; + default: + break; + } } + + DoMeleeAttackIfReady(); } - DoMeleeAttackIfReady(); - } + void JustDied(Unit* /*killer*/) OVERRIDE + { + Talk(SAY_DEATH); - void JustDied(Unit* /*killer*/) OVERRIDE - { - Talk(SAY_DEATH); + _JustDied(); + } - _JustDied(); - } + private: + uint8 _phase; + bool _rubyVoid; + bool _emeraldVoid; + bool _amberVoid; + }; - private: - uint8 _phase; - bool _rubyVoid; - bool _emeraldVoid; - bool _amberVoid; - }; + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return new boss_eregosAI(creature); + } }; class spell_eregos_planar_shift : public SpellScriptLoader @@ -259,9 +261,8 @@ class spell_eregos_planar_shift : public SpellScriptLoader void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - if (Unit* caster = GetCaster()) - if (Creature* creatureCaster = caster->ToCreature()) - creatureCaster->AI()->DoAction(ACTION_SET_NORMAL_EVENTS); + if (Creature* creature = GetTarget()->ToCreature()) + creature->AI()->DoAction(ACTION_SET_NORMAL_EVENTS); } void Register() OVERRIDE diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp index 678748b1f01..f7c558879d1 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp @@ -29,7 +29,6 @@ EndScriptData */ enum Spells { - SPELL_ARCANE_SHIELD = 53813, //Dummy --> Channeled, shields the caster from damage. SPELL_EMPOWERED_ARCANE_EXPLOSION = 51110, SPELL_EMPOWERED_ARCANE_EXPLOSION_2 = 59377, @@ -89,274 +88,242 @@ static uint32 TeleportSpells[]= class boss_urom : public CreatureScript { -public: - boss_urom() : CreatureScript("boss_urom") { } - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new boss_uromAI(creature); - } - - struct boss_uromAI : public BossAI - { - boss_uromAI(Creature* creature) : BossAI(creature, DATA_UROM_EVENT) { } + public: + boss_urom() : CreatureScript("boss_urom") { } - void Reset() OVERRIDE + struct boss_uromAI : public BossAI { - me->CastSpell(me, SPELL_EVOCATE); - - _Reset(); - - if (instance->GetData(DATA_UROM_PLATAFORM) == 0) + boss_uromAI(Creature* creature) : BossAI(creature, DATA_UROM) { - for (uint8 i = 0; i < 3; i++) - group[i] = 0; - } + platform = 0; - x = 0.0f; - y = 0.0f; - canCast = false; - canGoBack = false; + for (uint8 i = 0; i < 3; ++i) + group[i] = i; - me->GetMotionMaster()->MoveIdle(); - - teleportTimer = urand(30000, 35000); - arcaneExplosionTimer = 9000; - castArcaneExplosionTimer = 2000; - frostBombTimer = urand(5000, 8000); - timeBombTimer = urand(20000, 25000); - } + std::random_shuffle(group, group + 3); + } - void EnterCombat(Unit* /*who*/) OVERRIDE - { - _EnterCombat(); + void Reset() OVERRIDE + { + me->CastSpell(me, SPELL_EVOCATE); - SetGroups(); - SummonGroups(); - CastTeleport(); + _Reset(); - if (instance->GetData(DATA_UROM_PLATAFORM) != 3) - instance->SetData(DATA_UROM_PLATAFORM, instance->GetData(DATA_UROM_PLATAFORM)+1); - } + x = 0.0f; + y = 0.0f; + canCast = false; + canGoBack = false; - void AttackStart(Unit* who) OVERRIDE - { - if (!who) - return; + me->GetMotionMaster()->MoveIdle(); - if (me->GetPositionZ() > 518.63f) - DoStartNoMovement(who); + teleportTimer = urand(30000, 35000); + arcaneExplosionTimer = 9000; + castArcaneExplosionTimer = 2000; + frostBombTimer = urand(5000, 8000); + timeBombTimer = urand(20000, 25000); + } - if (me->GetPositionZ() < 518.63f) + void EnterCombat(Unit* /*who*/) OVERRIDE { - if (me->Attack(who, true)) - { - Talk(SAY_AGGRO); - - me->SetInCombatWith(who); - who->SetInCombatWith(me); + _EnterCombat(); - me->GetMotionMaster()->MoveChase(who, 0, 0); - } + StartAttack(); } - } - - void SetGroups() - { - if (!instance || instance->GetData(DATA_UROM_PLATAFORM) != 0) - return; - while (group[0] == group[1] || group[0] == group[2] || group[1] == group[2]) + void AttackStart(Unit* who) OVERRIDE { - for (uint8 i = 0; i < 3; i++) - group[i] = urand(0, 2); - } - } + if (!who) + return; - void SetPosition(uint8 i) - { - switch (i) - { - case 0: - x = me->GetPositionX() + 4; - y = me->GetPositionY() - 4; - break; - case 1: - x = me->GetPositionX() + 4; - y = me->GetPositionY() + 4; - break; - case 2: - x = me->GetPositionX() - 4; - y = me->GetPositionY() + 4; - break; - case 3: - x = me->GetPositionX() - 4; - y = me->GetPositionY() - 4; - break; - default: - break; + if (me->GetPositionZ() > 518.63f) + DoStartNoMovement(who); + else + BossAI::AttackStart(who); } - } - void SummonGroups() - { - if (!instance || instance->GetData(DATA_UROM_PLATAFORM) > 2) - return; - - for (uint8 i = 0; i < 4; i++) + void SetPosition(uint8 i) { - SetPosition(i); - me->SummonCreature(Group[group[instance->GetData(DATA_UROM_PLATAFORM)]].entry[i], x, y, me->GetPositionZ(), me->GetOrientation()); - - // teleport to next platform and spawn adds - switch (instance->GetData(DATA_UROM_PLATAFORM)) + switch (i) { + case 0: + x = me->GetPositionX() + 4; + y = me->GetPositionY() - 4; + break; case 1: - Talk(SAY_SUMMON_1); + x = me->GetPositionX() + 4; + y = me->GetPositionY() + 4; break; case 2: - Talk(SAY_SUMMON_2); + x = me->GetPositionX() - 4; + y = me->GetPositionY() + 4; break; case 3: - Talk(SAY_SUMMON_3); + x = me->GetPositionX() - 4; + y = me->GetPositionY() - 4; break; default: break; } } - } - void CastTeleport() - { - if (!instance || instance->GetData(DATA_UROM_PLATAFORM) > 2) - return; - - Talk(instance->GetData(DATA_UROM_PLATAFORM) < 5 ? instance->GetData(DATA_UROM_PLATAFORM) : 0); - DoCast(TeleportSpells[instance->GetData(DATA_UROM_PLATAFORM)]); - } - - void KilledUnit(Unit* /*victim*/) OVERRIDE - { - Talk(SAY_PLAYER_KILL); - } - - void UpdateAI(uint32 uiDiff) OVERRIDE - { - if (!UpdateVictim()) - return; + void StartAttack() + { + if (platform > 2) + { + Talk(SAY_AGGRO); + return; + } - if (!instance || instance->GetData(DATA_UROM_PLATAFORM) < 2) - return; + // summon guards and jump to next platform + for (uint8 i = 0; i < 4; ++i) + { + SetPosition(i); + me->SummonCreature(Group[group[platform]].entry[i], x, y, me->GetPositionZ(), me->GetOrientation()); + } - if (teleportTimer <= uiDiff) - { - me->InterruptNonMeleeSpells(false); - me->GetMotionMaster()->MoveIdle(); - DoCast(SPELL_TELEPORT); - teleportTimer = urand(30000, 35000); + Talk(platform); + DoCast(TeleportSpells[platform]); - } else teleportTimer -= uiDiff; + ++platform; + } - if (canCast && !me->FindCurrentSpellBySpellId(SPELL_EMPOWERED_ARCANE_EXPLOSION)) + void KilledUnit(Unit* who) OVERRIDE { - if (castArcaneExplosionTimer <= uiDiff) - { - canCast = false; - canGoBack = true; - DoCastAOE(SPELL_EMPOWERED_ARCANE_EXPLOSION); - castArcaneExplosionTimer = 2000; - }else castArcaneExplosionTimer -= uiDiff; + if (who->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_PLAYER_KILL); } - if (canGoBack) + void UpdateAI(uint32 diff) OVERRIDE { - if (arcaneExplosionTimer <= uiDiff) - { - Position pPos; - me->GetVictim()->GetPosition(&pPos); + if (!UpdateVictim()) + return; - me->NearTeleportTo(pPos.GetPositionX(), pPos.GetPositionY(), pPos.GetPositionZ(), pPos.GetOrientation()); - me->GetMotionMaster()->MoveChase(me->GetVictim(), 0, 0); - me->SetWalk(true); + if (platform < 3) + return; - Talk(EMOTE_ARCANE_EXPLOSION); - Talk(SAY_ARCANE_EXPLOSION); + events.Update(diff); - canCast = false; - canGoBack = false; - arcaneExplosionTimer = 9000; - } else arcaneExplosionTimer -= uiDiff; - } + if (teleportTimer <= diff) + { + me->InterruptNonMeleeSpells(false); + me->GetMotionMaster()->MoveIdle(); + DoCast(SPELL_TELEPORT); + teleportTimer = urand(30000, 35000); + } + else + teleportTimer -= diff; - if (!me->IsNonMeleeSpellCasted(false, true, true)) - { - if (frostBombTimer <= uiDiff) + if (canCast && !me->FindCurrentSpellBySpellId(SPELL_EMPOWERED_ARCANE_EXPLOSION)) { - DoCastVictim(SPELL_FROSTBOMB); - frostBombTimer = urand(5000, 8000); - } else frostBombTimer -= uiDiff; + if (castArcaneExplosionTimer <= diff) + { + canCast = false; + canGoBack = true; + DoCastAOE(SPELL_EMPOWERED_ARCANE_EXPLOSION); + castArcaneExplosionTimer = 2000; + } + else + castArcaneExplosionTimer -= diff; + } - if (timeBombTimer <= uiDiff) + if (canGoBack) { - if (Unit* unit = SelectTarget(SELECT_TARGET_RANDOM)) - DoCast(unit, SPELL_TIME_BOMB); + if (arcaneExplosionTimer <= diff) + { + Position pos; + me->GetVictim()->GetPosition(&pos); + + me->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()); + me->GetMotionMaster()->MoveChase(me->GetVictim()); + me->SetWalk(true); + + Talk(EMOTE_ARCANE_EXPLOSION); + Talk(SAY_ARCANE_EXPLOSION); + + canCast = false; + canGoBack = false; + arcaneExplosionTimer = 9000; + } + else + arcaneExplosionTimer -= diff; + } - timeBombTimer = urand(20000, 25000); - } else timeBombTimer -= uiDiff; - } + if (!me->IsNonMeleeSpellCasted(false, true, true)) + { + if (frostBombTimer <= diff) + { + DoCastVictim(SPELL_FROSTBOMB); + frostBombTimer = urand(5000, 8000); + } + else + frostBombTimer -= diff; + + if (timeBombTimer <= diff) + { + if (Unit* unit = SelectTarget(SELECT_TARGET_RANDOM)) + DoCast(unit, SPELL_TIME_BOMB); + + timeBombTimer = urand(20000, 25000); + } + else + timeBombTimer -= diff; + } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - void JustDied(Unit* /*killer*/) OVERRIDE - { - _JustDied(); - Talk(SAY_DEATH); - DoCast(me, SPELL_DEATH_SPELL, true); // we cast the spell as triggered or the summon effect does not occur - } + void JustDied(Unit* /*killer*/) OVERRIDE + { + _JustDied(); + Talk(SAY_DEATH); + DoCast(me, SPELL_DEATH_SPELL, true); // we cast the spell as triggered or the summon effect does not occur + } - void LeaveCombat() - { - me->RemoveAllAuras(); - me->CombatStop(false); - me->DeleteThreatList(); - } + void LeaveCombat() + { + me->RemoveAllAuras(); + me->CombatStop(false); + me->DeleteThreatList(); + } - void SpellHit(Unit* /*pCaster*/, const SpellInfo* pSpell) OVERRIDE - { - switch (pSpell->Id) + void SpellHit(Unit* /*caster*/, SpellInfo const* spellInfo) OVERRIDE { - case SPELL_SUMMON_MENAGERIE: - me->SetHomePosition(968.66f, 1042.53f, 527.32f, 0.077f); - LeaveCombat(); - me->CastSpell(me, SPELL_EVOCATE); - break; - case SPELL_SUMMON_MENAGERIE_2: - me->SetHomePosition(1164.02f, 1170.85f, 527.321f, 3.66f); - LeaveCombat(); - me->CastSpell(me, SPELL_EVOCATE); - break; - case SPELL_SUMMON_MENAGERIE_3: - me->SetHomePosition(1118.31f, 1080.377f, 508.361f, 4.25f); - LeaveCombat(); - me->CastSpell(me, SPELL_EVOCATE); - break; - case SPELL_TELEPORT: - //! Unconfirmed, previous below - me->SetDisableGravity(true); - //me->AddUnitMovementFlag(MOVEMENTFLAG_CAN_FLY); // with out it the npc will fall down while is casting - canCast = true; - break; - default: - break; + switch (spellInfo->Id) + { + case SPELL_SUMMON_MENAGERIE: + me->SetHomePosition(968.66f, 1042.53f, 527.32f, 0.077f); + LeaveCombat(); + me->CastSpell(me, SPELL_EVOCATE); + break; + case SPELL_SUMMON_MENAGERIE_2: + me->SetHomePosition(1164.02f, 1170.85f, 527.321f, 3.66f); + LeaveCombat(); + me->CastSpell(me, SPELL_EVOCATE); + break; + case SPELL_SUMMON_MENAGERIE_3: + me->SetHomePosition(1118.31f, 1080.377f, 508.361f, 4.25f); + LeaveCombat(); + me->CastSpell(me, SPELL_EVOCATE); + break; + case SPELL_TELEPORT: + //! Unconfirmed, previous below + me->SetDisableGravity(true); + //me->AddUnitMovementFlag(MOVEMENTFLAG_CAN_FLY); // with out it the npc will fall down while is casting + canCast = true; + break; + default: + break; + } } - } + private: float x, y; bool canCast; bool canGoBack; + uint8 platform; + uint8 group[3]; uint32 teleportTimer; @@ -364,7 +331,12 @@ public: uint32 castArcaneExplosionTimer; uint32 frostBombTimer; uint32 timeBombTimer; - }; + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return GetOculusAI<boss_uromAI>(creature); + } }; void AddSC_boss_urom() diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp index bc72c808a6f..385f80ae37d 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp @@ -54,105 +54,111 @@ enum Events class boss_varos : public CreatureScript { -public: - boss_varos() : CreatureScript("boss_varos") { } - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new boss_varosAI(creature); - } + public: + boss_varos() : CreatureScript("boss_varos") { } - struct boss_varosAI : public BossAI - { - boss_varosAI(Creature* creature) : BossAI(creature, DATA_VAROS_EVENT) + struct boss_varosAI : public BossAI { - if (instance->GetBossState(DATA_DRAKOS_EVENT) != DONE) - DoCast(me, SPELL_CENTRIFUGE_SHIELD); - } + boss_varosAI(Creature* creature) : BossAI(creature, DATA_VAROS) { } - void Reset() OVERRIDE - { - _Reset(); + void InitializeAI() OVERRIDE + { + BossAI::InitializeAI(); + if (instance->GetBossState(DATA_DRAKOS) != DONE) + DoCast(me, SPELL_CENTRIFUGE_SHIELD); + } - events.ScheduleEvent(EVENT_AMPLIFY_MAGIC, urand(20, 25) * IN_MILLISECONDS); - events.ScheduleEvent(EVENT_ENERGIZE_CORES_VISUAL, 5000); - // not sure if this is handled by a timer or hp percentage - events.ScheduleEvent(EVENT_CALL_AZURE, urand(15, 30) * IN_MILLISECONDS); + void Reset() OVERRIDE + { + _Reset(); - firstCoreEnergize = false; - coreEnergizeOrientation = 0.0f; - } + events.ScheduleEvent(EVENT_AMPLIFY_MAGIC, urand(20, 25) * IN_MILLISECONDS); + events.ScheduleEvent(EVENT_ENERGIZE_CORES_VISUAL, 5000); + // not sure if this is handled by a timer or hp percentage + events.ScheduleEvent(EVENT_CALL_AZURE, urand(15, 30) * IN_MILLISECONDS); - void EnterCombat(Unit* /*who*/) OVERRIDE - { - _EnterCombat(); + firstCoreEnergize = false; + coreEnergizeOrientation = 0.0f; + } - Talk(SAY_AGGRO); - } + void EnterCombat(Unit* /*who*/) OVERRIDE + { + _EnterCombat(); - float GetCoreEnergizeOrientation() - { - return coreEnergizeOrientation; - } + Talk(SAY_AGGRO); + } - void UpdateAI(uint32 diff) OVERRIDE - { - //Return since we have no target - if (!UpdateVictim()) - return; + float GetCoreEnergizeOrientation() + { + return coreEnergizeOrientation; + } - events.Update(diff); + void UpdateAI(uint32 diff) OVERRIDE + { + if (!UpdateVictim()) + return; - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + events.Update(diff); - while (uint32 eventId = events.ExecuteEvent()) - { - switch (eventId) + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_ENERGIZE_CORES: - DoCast(me, SPELL_ENERGIZE_CORES); - events.CancelEvent(EVENT_ENERGIZE_CORES); - break; - case EVENT_ENERGIZE_CORES_VISUAL: - if (!firstCoreEnergize) - { - coreEnergizeOrientation = me->GetOrientation(); - firstCoreEnergize = true; - } else - coreEnergizeOrientation = Position::NormalizeOrientation(coreEnergizeOrientation - 2.0f); - - DoCast(me, SPELL_ENERGIZE_CORES_VISUAL); - events.ScheduleEvent(EVENT_ENERGIZE_CORES_VISUAL, 5000); - events.ScheduleEvent(EVENT_ENERGIZE_CORES, 4000); - break; - case EVENT_CALL_AZURE: - // not sure how blizz handles this, i cant see any pattern between the differnt spells - DoCast(me, SPELL_CALL_AZURE_RING_CAPTAIN); - Talk(SAY_AZURE); - Talk(SAY_AZURE_EMOTE); - events.ScheduleEvent(EVENT_CALL_AZURE, urand(20, 25) * IN_MILLISECONDS); - break; - case EVENT_AMPLIFY_MAGIC: - DoCastVictim(SPELL_CALL_AMPLIFY_MAGIC); - events.ScheduleEvent(EVENT_AMPLIFY_MAGIC, urand(17, 20) * IN_MILLISECONDS); - break; + switch (eventId) + { + case EVENT_ENERGIZE_CORES: + DoCast(me, SPELL_ENERGIZE_CORES); + events.CancelEvent(EVENT_ENERGIZE_CORES); + break; + case EVENT_ENERGIZE_CORES_VISUAL: + if (!firstCoreEnergize) + { + coreEnergizeOrientation = me->GetOrientation(); + firstCoreEnergize = true; + } + else + coreEnergizeOrientation = Position::NormalizeOrientation(coreEnergizeOrientation - 2.0f); + + DoCast(me, SPELL_ENERGIZE_CORES_VISUAL); + events.ScheduleEvent(EVENT_ENERGIZE_CORES_VISUAL, 5000); + events.ScheduleEvent(EVENT_ENERGIZE_CORES, 4000); + break; + case EVENT_CALL_AZURE: + // not sure how blizz handles this, i cant see any pattern between the differnt spells + DoCast(me, SPELL_CALL_AZURE_RING_CAPTAIN); + Talk(SAY_AZURE); + Talk(SAY_AZURE_EMOTE); + events.ScheduleEvent(EVENT_CALL_AZURE, urand(20, 25) * IN_MILLISECONDS); + break; + case EVENT_AMPLIFY_MAGIC: + DoCastVictim(SPELL_CALL_AMPLIFY_MAGIC); + events.ScheduleEvent(EVENT_AMPLIFY_MAGIC, urand(17, 20) * IN_MILLISECONDS); + break; + default: + break; + } } + + DoMeleeAttackIfReady(); } - DoMeleeAttackIfReady(); - } + void JustDied(Unit* /*killer*/) OVERRIDE + { + _JustDied(); + Talk(SAY_DEATH); + DoCast(me, SPELL_DEATH_SPELL, true); // we cast the spell as triggered or the summon effect does not occur + } - void JustDied(Unit* /*killer*/) OVERRIDE + private: + bool firstCoreEnergize; + float coreEnergizeOrientation; + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE { - _JustDied(); - Talk(SAY_DEATH); - DoCast(me, SPELL_DEATH_SPELL, true); // we cast the spell as triggered or the summon effect does not occur + return GetOculusAI<boss_varosAI>(creature); } - private: - bool firstCoreEnergize; - float coreEnergizeOrientation; - }; }; class npc_azure_ring_captain : public CreatureScript @@ -259,7 +265,6 @@ class spell_varos_centrifuge_shield : public SpellScriptLoader if (Unit* caster = GetCaster()) { // flags taken from sniffs - // UNIT_FLAG_UNK_9 -> means passive but it is not yet implemented in core if (caster->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15|UNIT_FLAG_IMMUNE_TO_NPC|UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_UNK_6)) { caster->ToCreature()->SetReactState(REACT_PASSIVE); diff --git a/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp index 70424119a0a..b108378910e 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp @@ -18,354 +18,336 @@ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "InstanceScript.h" +#include "WorldPacket.h" #include "oculus.h" -#include "Player.h" -#define MAX_ENCOUNTER 4 +DoorData const doorData[] = +{ + { GO_DRAGON_CAGE_DOOR, DATA_DRAKOS, DOOR_TYPE_PASSAGE, BOUNDARY_NONE }, + { 0, 0, DOOR_TYPE_ROOM, BOUNDARY_NONE } +}; -/* The Occulus encounters: -0 - Drakos the Interrogator -1 - Varos Cloudstrider -2 - Mage-Lord Urom -3 - Ley-Guardian Eregos */ +Position const VerdisaMove = { 949.188f, 1032.91f, 359.967f, 1.093027f }; +Position const BelgaristraszMove = { 941.453f, 1044.1f, 359.967f, 0.1984709f }; +Position const EternosMove = { 943.202f, 1059.35f, 359.967f, 5.757278f }; class instance_oculus : public InstanceMapScript { -public: - instance_oculus() : InstanceMapScript("instance_oculus", 578) { } - - InstanceScript* GetInstanceScript(InstanceMap* map) const OVERRIDE - { - return new instance_oculus_InstanceMapScript(map); - } - - struct instance_oculus_InstanceMapScript : public InstanceScript - { - instance_oculus_InstanceMapScript(Map* map) : InstanceScript(map) { } + public: + instance_oculus() : InstanceMapScript(OculusScriptName, 578) { } - void Initialize() OVERRIDE + struct instance_oculus_InstanceMapScript : public InstanceScript { - SetBossNumber(MAX_ENCOUNTER); - - drakosGUID = 0; - varosGUID = 0; - uromGUID = 0; - eregosGUID = 0; - - platformUrom = 0; - centrifugueConstructCounter = 0; - - eregosCacheGUID = 0; - - gwhelpList.clear(); - gameObjectList.clear(); + instance_oculus_InstanceMapScript(Map* map) : InstanceScript(map) + { + SetBossNumber(EncounterCount); + LoadDoorData(doorData); - belgaristraszGUID = 0; - eternosGUID = 0; - verdisaGUID = 0; -} + DrakosGUID = 0; + VarosGUID = 0; + UromGUID = 0; + EregosGUID = 0; - void OnUnitDeath(Unit* unit) OVERRIDE - { - Creature* creature = unit->ToCreature(); - if (!creature) - return; + CentrifugueConstructCounter = 0; - if (creature->GetEntry() != NPC_CENTRIFUGE_CONSTRUCT) - return; + EregosCacheGUID = 0; - DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, --centrifugueConstructCounter); + GreaterWhelpList.clear(); - if (!centrifugueConstructCounter) - if (Creature* varos = instance->GetCreature(varosGUID)) - varos->RemoveAllAuras(); - } + BelgaristraszGUID = 0; + EternosGUID = 0; + VerdisaGUID = 0; + } - void OnPlayerEnter(Player* player) OVERRIDE - { - if (GetBossState(DATA_DRAKOS_EVENT) == DONE && GetBossState(DATA_VAROS_EVENT) != DONE) + void OnCreatureCreate(Creature* creature) OVERRIDE { - player->SendUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 1); - player->SendUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, centrifugueConstructCounter); - } else + switch (creature->GetEntry()) + { + case NPC_DRAKOS: + DrakosGUID = creature->GetGUID(); + break; + case NPC_VAROS: + VarosGUID = creature->GetGUID(); + if (GetBossState(DATA_DRAKOS) == DONE) + creature->SetPhaseMask(1, true); + break; + case NPC_UROM: + UromGUID = creature->GetGUID(); + if (GetBossState(DATA_VAROS) == DONE) + creature->SetPhaseMask(1, true); + break; + case NPC_EREGOS: + EregosGUID = creature->GetGUID(); + if (GetBossState(DATA_UROM) == DONE) + creature->SetPhaseMask(1, true); + break; + case NPC_CENTRIFUGE_CONSTRUCT: + if (creature->IsAlive()) + DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, ++CentrifugueConstructCounter); + break; + case NPC_BELGARISTRASZ: + BelgaristraszGUID = creature->GetGUID(); + if (GetBossState(DATA_DRAKOS) == DONE) + { + creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + creature->Relocate(BelgaristraszMove); + } + break; + case NPC_ETERNOS: + EternosGUID = creature->GetGUID(); + if (GetBossState(DATA_DRAKOS) == DONE) + { + creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + creature->Relocate(EternosMove); + } + break; + case NPC_VERDISA: + VerdisaGUID = creature->GetGUID(); + if (GetBossState(DATA_DRAKOS) == DONE) + { + creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + creature->Relocate(VerdisaMove); + } + break; + case NPC_GREATER_WHELP: + if (GetBossState(DATA_UROM) == DONE) + { + creature->SetPhaseMask(1, true); + GreaterWhelpList.push_back(creature->GetGUID()); + } + break; + default: + break; + } + } + + void OnGameObjectCreate(GameObject* go) OVERRIDE { - player->SendUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 0); - player->SendUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, 0); + switch (go->GetEntry()) + { + case GO_DRAGON_CAGE_DOOR: + AddDoor(go, true); + break; + case GO_EREGOS_CACHE_N: + case GO_EREGOS_CACHE_H: + EregosCacheGUID = go->GetGUID(); + break; + default: + break; + } } - } - void ProcessEvent(WorldObject* /*unit*/, uint32 eventId) - { - if (eventId != EVENT_CALL_DRAGON) - return; + void OnGameObjectRemove(GameObject* go) OVERRIDE + { + switch (go->GetEntry()) + { + case GO_DRAGON_CAGE_DOOR: + AddDoor(go, false); + break; + default: + break; + } + } - Creature* varos = instance->GetCreature(varosGUID); + void OnUnitDeath(Unit* unit) OVERRIDE + { + Creature* creature = unit->ToCreature(); + if (!creature) + return; - if (!varos) - return; + if (creature->GetEntry() == NPC_CENTRIFUGE_CONSTRUCT) + { + DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, --CentrifugueConstructCounter); - if (Creature* drake = varos->SummonCreature(NPC_AZURE_RING_GUARDIAN, varos->GetPositionX(), varos->GetPositionY(), varos->GetPositionZ()+40)) - drake->AI()->DoAction(ACTION_CALL_DRAGON_EVENT); - } + if (!CentrifugueConstructCounter) + if (Creature* varos = instance->GetCreature(VarosGUID)) + varos->RemoveAllAuras(); + } + } - void OnCreatureCreate(Creature* creature) OVERRIDE - { - switch (creature->GetEntry()) + void FillInitialWorldStates(WorldPacket& data) OVERRIDE { - case NPC_DRAKOS: - drakosGUID = creature->GetGUID(); - break; - case NPC_VAROS: - varosGUID = creature->GetGUID(); - if (GetBossState(DATA_DRAKOS_EVENT) == DONE) - creature->SetPhaseMask(1, true); - break; - case NPC_UROM: - uromGUID = creature->GetGUID(); - if (GetBossState(DATA_VAROS_EVENT) == DONE) - creature->SetPhaseMask(1, true); - break; - case NPC_EREGOS: - eregosGUID = creature->GetGUID(); - if (GetBossState(DATA_UROM_EVENT) == DONE) - creature->SetPhaseMask(1, true); - break; - case NPC_CENTRIFUGE_CONSTRUCT: - if (creature->IsAlive()) - DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, ++centrifugueConstructCounter); - break; - case NPC_BELGARISTRASZ: - belgaristraszGUID = creature->GetGUID(); - if (GetBossState(DATA_DRAKOS_EVENT) == DONE) - { - creature->SetWalk(true), - creature->GetMotionMaster()->MovePoint(0, 941.453f, 1044.1f, 359.967f), - creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - } - break; - case NPC_ETERNOS: - eternosGUID = creature->GetGUID(); - if (GetBossState(DATA_DRAKOS_EVENT) == DONE) - { - creature->SetWalk(true), - creature->GetMotionMaster()->MovePoint(0, 943.202f, 1059.35f, 359.967f), - creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - } - break; - case NPC_VERDISA: - verdisaGUID = creature->GetGUID(); - if (GetBossState(DATA_DRAKOS_EVENT) == DONE) - { - creature->SetWalk(true), - creature->GetMotionMaster()->MovePoint(0, 949.188f, 1032.91f, 359.967f), - creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - } - break; - case NPC_GREATER_WHELP: - if (GetBossState(DATA_UROM_EVENT) == DONE) - { - creature->SetPhaseMask(1, true); - gwhelpList.push_back(creature->GetGUID()); - } - break; + if (GetBossState(DATA_DRAKOS) == DONE && GetBossState(DATA_VAROS) != DONE) + { + data << uint32(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW) << uint32(1); + data << uint32(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT) << uint32(CentrifugueConstructCounter); + } + else + { + data << uint32(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW) << uint32(0); + data << uint32(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT) << uint32(0); + } } - } - void OnGameObjectCreate(GameObject* go) OVERRIDE - { - switch (go->GetEntry()) + void ProcessEvent(WorldObject* /*unit*/, uint32 eventId) OVERRIDE { - case GO_DRAGON_CAGE_DOOR: - if (GetBossState(DATA_DRAKOS_EVENT) == DONE) - go->SetGoState(GO_STATE_ACTIVE); - else - go->SetGoState(GO_STATE_READY); - gameObjectList.push_back(go->GetGUID()); - break; - case GO_EREGOS_CACHE_N: - case GO_EREGOS_CACHE_H: - eregosCacheGUID = go->GetGUID(); - break; - default: - break; - } - } + if (eventId != EVENT_CALL_DRAGON) + return; - bool SetBossState(uint32 type, EncounterState state) OVERRIDE - { - if (!InstanceScript::SetBossState(type, state)) - return false; + if (Creature* varos = instance->GetCreature(VarosGUID)) + if (Creature* drake = varos->SummonCreature(NPC_AZURE_RING_GUARDIAN, varos->GetPositionX(), varos->GetPositionY(), varos->GetPositionZ() + 40)) + drake->AI()->DoAction(ACTION_CALL_DRAGON_EVENT); + } - switch (type) + bool SetBossState(uint32 type, EncounterState state) OVERRIDE { - case DATA_DRAKOS_EVENT: - if (state == DONE) - { - DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 1); - DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, centrifugueConstructCounter); - OpenCageDoors(); - FreeDragons(); - if (Creature* varos = instance->GetCreature(varosGUID)) - varos->SetPhaseMask(1, true); - } - break; - case DATA_VAROS_EVENT: - if (state == DONE) - DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 0); - if (Creature* urom = instance->GetCreature(uromGUID)) - urom->SetPhaseMask(1, true); - break; - case DATA_UROM_EVENT: - if (state == DONE) - { - if (Creature* eregos = instance->GetCreature(eregosGUID)) + if (!InstanceScript::SetBossState(type, state)) + return false; + + switch (type) + { + case DATA_DRAKOS: + if (state == DONE) { - eregos->SetPhaseMask(1, true); - GreaterWhelps(); + DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 1); + DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, CentrifugueConstructCounter); + FreeDragons(); + if (Creature* varos = instance->GetCreature(VarosGUID)) + varos->SetPhaseMask(1, true); } - } - break; - case DATA_EREGOS_EVENT: - if (state == DONE) - DoRespawnGameObject(eregosCacheGUID, 7*DAY); - break; - } - - return true; - } + break; + case DATA_VAROS: + if (state == DONE) + DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 0); + if (Creature* urom = instance->GetCreature(UromGUID)) + urom->SetPhaseMask(1, true); + break; + case DATA_UROM: + if (state == DONE) + { + if (Creature* eregos = instance->GetCreature(EregosGUID)) + { + eregos->SetPhaseMask(1, true); + GreaterWhelps(); + } + } + break; + case DATA_EREGOS: + if (state == DONE) + { + if (GameObject* cache = instance->GetGameObject(EregosCacheGUID)) + { + cache->SetRespawnTime(cache->GetRespawnDelay()); + cache->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + } + } + break; + } - void SetData(uint32 type, uint32 data) OVERRIDE - { - switch (type) - { - case DATA_UROM_PLATAFORM: - platformUrom = data; - break; + return true; } - } - uint32 GetData(uint32 type) const OVERRIDE - { - switch (type) + uint64 GetData64(uint32 type) const OVERRIDE { - case DATA_UROM_PLATAFORM: return platformUrom; - // used by condition system - case DATA_UROM_EVENT: return GetBossState(DATA_UROM_EVENT); - } + switch (type) + { + case DATA_DRAKOS: + return DrakosGUID; + case DATA_VAROS: + return VarosGUID; + case DATA_UROM: + return UromGUID; + case DATA_EREGOS: + return EregosGUID; + default: + break; + } - return 0; - } + return 0; + } - uint64 GetData64(uint32 identifier) const OVERRIDE - { - switch (identifier) + void FreeDragons() { - case DATA_DRAKOS: return drakosGUID; - case DATA_VAROS: return varosGUID; - case DATA_UROM: return uromGUID; - case DATA_EREGOS: return eregosGUID; - } + if (Creature* belgaristrasz = instance->GetCreature(BelgaristraszGUID)) + { + belgaristrasz->SetWalk(true); + belgaristrasz->GetMotionMaster()->MovePoint(POINT_MOVE_OUT, BelgaristraszMove); + } - return 0; - } + if (Creature* eternos = instance->GetCreature(EternosGUID)) + { + eternos->SetWalk(true); + eternos->GetMotionMaster()->MovePoint(POINT_MOVE_OUT, EternosMove); + } - void OpenCageDoors() - { - if (gameObjectList.empty()) - return; + if (Creature* verdisa = instance->GetCreature(VerdisaGUID)) + { + verdisa->SetWalk(true); + verdisa->GetMotionMaster()->MovePoint(POINT_MOVE_OUT, VerdisaMove); + } + } - for (std::list<uint64>::const_iterator itr = gameObjectList.begin(); itr != gameObjectList.end(); ++itr) + void GreaterWhelps() { - if (GameObject* go = instance->GetGameObject(*itr)) - go->SetGoState(GO_STATE_ACTIVE); + for (std::list<uint64>::const_iterator itr = GreaterWhelpList.begin(); itr != GreaterWhelpList.end(); ++itr) + if (Creature* gwhelp = instance->GetCreature(*itr)) + gwhelp->SetPhaseMask(1, true); } - } - - void FreeDragons() - { - if (Creature* belgaristrasz = instance->GetCreature(belgaristraszGUID)) - belgaristrasz->SetWalk(true), - belgaristrasz->GetMotionMaster()->MovePoint(0, 941.453f, 1044.1f, 359.967f); - if (Creature* eternos = instance->GetCreature(eternosGUID)) - eternos->SetWalk(true), - eternos->GetMotionMaster()->MovePoint(0, 943.202f, 1059.35f, 359.967f); - if (Creature* verdisa = instance->GetCreature(verdisaGUID)) - verdisa->SetWalk(true), - verdisa->GetMotionMaster()->MovePoint(0, 949.188f, 1032.91f, 359.967f); - } - void GreaterWhelps() - { - if (gwhelpList.empty()) - return; - - for (std::list<uint64>::const_iterator itr = gwhelpList.begin(); itr != gwhelpList.end(); ++itr) - if (Creature* gwhelp = instance->GetCreature(*itr)) - gwhelp->SetPhaseMask(1, true); - } - - std::string GetSaveData() OVERRIDE - { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << "T O " << GetBossSaveData(); + std::string GetSaveData() OVERRIDE + { + OUT_SAVE_INST_DATA; - str_data = saveStream.str(); + std::ostringstream saveStream; + saveStream << "T O " << GetBossSaveData(); - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; - } + OUT_SAVE_INST_DATA_COMPLETE; + return saveStream.str(); + } - void Load(const char* in) OVERRIDE - { - if (!in) + void Load(char const* str) OVERRIDE { - OUT_LOAD_INST_DATA_FAIL; - return; - } + if (!str) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - OUT_LOAD_INST_DATA(in); + OUT_LOAD_INST_DATA(str); - char dataHead1, dataHead2; + char dataHead1, dataHead2; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2; + std::istringstream loadStream(str); + loadStream >> dataHead1 >> dataHead2; - if (dataHead1 == 'T' && dataHead2 == 'O') - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (dataHead1 == 'T' && dataHead2 == 'O') { - uint32 tmpState; - loadStream >> tmpState; - if (tmpState == IN_PROGRESS || tmpState > SPECIAL) - tmpState = NOT_STARTED; - SetBossState(i, EncounterState(tmpState)); + for (uint32 i = 0; i < EncounterCount; ++i) + { + uint32 tmpState; + loadStream >> tmpState; + if (tmpState == IN_PROGRESS || tmpState > SPECIAL) + tmpState = NOT_STARTED; + SetBossState(i, EncounterState(tmpState)); + } } - } else OUT_LOAD_INST_DATA_FAIL; + else + OUT_LOAD_INST_DATA_FAIL; - OUT_LOAD_INST_DATA_COMPLETE; - } - private: - uint64 drakosGUID; - uint64 varosGUID; - uint64 uromGUID; - uint64 eregosGUID; + OUT_LOAD_INST_DATA_COMPLETE; + } - uint64 belgaristraszGUID; - uint64 eternosGUID; - uint64 verdisaGUID; + protected: + uint64 DrakosGUID; + uint64 VarosGUID; + uint64 UromGUID; + uint64 EregosGUID; - uint8 platformUrom; - uint8 centrifugueConstructCounter; + uint64 BelgaristraszGUID; + uint64 EternosGUID; + uint64 VerdisaGUID; - uint64 eregosCacheGUID; + uint8 CentrifugueConstructCounter; - std::string str_data; + uint64 EregosCacheGUID; - std::list<uint64> gameObjectList; - std::list<uint64> gwhelpList; - }; + std::list<uint64> GreaterWhelpList; + }; + + InstanceScript* GetInstanceScript(InstanceMap* map) const OVERRIDE + { + return new instance_oculus_InstanceMapScript(map); + } }; void AddSC_instance_oculus() diff --git a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp index fd15cd19b37..1230868c020 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp @@ -20,77 +20,73 @@ #include "ScriptedGossip.h" #include "SpellScript.h" #include "SpellAuraEffects.h" -#include "Vehicle.h" #include "CombatAI.h" -#include "oculus.h" #include "Player.h" - -#define GOSSIP_ITEM_DRAKES "So where do we go from here?" -#define GOSSIP_ITEM_BELGARISTRASZ1 "I want to fly on the wings of the Red Flight" -#define GOSSIP_ITEM_BELGARISTRASZ2 "What abilities do Ruby Drakes have?" -#define GOSSIP_ITEM_VERDISA1 "I want to fly on the wings of the Green Flight" -#define GOSSIP_ITEM_VERDISA2 "What abilities do Emerald Drakes have?" -#define GOSSIP_ITEM_ETERNOS1 "I want to fly on the wings of the Bronze Flight" -#define GOSSIP_ITEM_ETERNOS2 "What abilities do Amber Drakes have?" - -#define HAS_ESSENCE(a) ((a)->HasItemCount(ITEM_EMERALD_ESSENCE) || (a)->HasItemCount(ITEM_AMBER_ESSENCE) || (a)->HasItemCount(ITEM_RUBY_ESSENCE)) +#include "Vehicle.h" +#include "oculus.h" enum GossipNPCs { - GOSSIP_TEXTID_DRAKES = 13267, - GOSSIP_TEXTID_BELGARISTRASZ1 = 12916, - GOSSIP_TEXTID_BELGARISTRASZ2 = 13466, - GOSSIP_TEXTID_BELGARISTRASZ3 = 13254, - GOSSIP_TEXTID_VERDISA1 = 1, - GOSSIP_TEXTID_VERDISA2 = 1, - GOSSIP_TEXTID_VERDISA3 = 1, - GOSSIP_TEXTID_ETERNOS1 = 1, - GOSSIP_TEXTID_ETERNOS2 = 1, - GOSSIP_TEXTID_ETERNOS3 = 13256, - - ITEM_EMERALD_ESSENCE = 37815, - ITEM_AMBER_ESSENCE = 37859, - ITEM_RUBY_ESSENCE = 37860, - - SPELL_SHOCK_CHARGE = 49836 + GOSSIP_MENU_VERDISA = 9573, + GOSSIP_MENU_ETERNOS = 9574, + GOSSIP_MENU_BELGARISTRASZ = 9575, + + ITEM_EMERALD_ESSENCE = 37815, + ITEM_AMBER_ESSENCE = 37859, + ITEM_RUBY_ESSENCE = 37860 }; enum Drakes { -/*Ruby Drake, -(npc 27756) (item 37860) -(summoned by spell Ruby Essence = 37860 ---> Call Amber Drake == 49462 ---> Summon 27756) -*/ - SPELL_RIDE_RUBY_DRAKE_QUE = 49463, //Apply Aura: Periodic Trigger, Interval: 3 seconds ---> 49464 - SPELL_RUBY_DRAKE_SADDLE = 49464, //Allows you to ride on the back of an Amber Drake. ---> Dummy - SPELL_RUBY_SEARING_WRATH = 50232, //(60 yds) - Instant - Breathes a stream of fire at an enemy dragon, dealing 6800 to 9200 Fire damage and then jumping to additional dragons within 30 yards. Each jump increases the damage by 50%. Affects up to 5 total targets - SPELL_RUBY_EVASIVE_AURA = 50248, //Instant - Allows the Ruby Drake to generate Evasive Charges when hit by hostile attacks and spells. - SPELL_RUBY_EVASIVE_MANEUVERS = 50240, //Instant - 5 sec. cooldown - Allows your drake to dodge all incoming attacks and spells. Requires Evasive Charges to use. Each attack or spell dodged while this ability is active burns one Evasive Charge. Lasts 30 sec. or until all charges are exhausted. - //you do not have acces to until you kill Mage-Lord Urom - SPELL_RUBY_MARTYR = 50253, //Instant - 10 sec. cooldown - Redirect all harmful spells cast at friendly drakes to yourself for 10 sec. - -/*Amber Drake, -(npc 27755) (item 37859) -(summoned by spell Amber Essence = 37859 ---> Call Amber Drake == 49461 ---> Summon 27755) -*/ - - SPELL_RIDE_AMBER_DRAKE_QUE = 49459, //Apply Aura: Periodic Trigger, Interval: 3 seconds ---> 49460 - SPELL_AMBER_DRAKE_SADDLE = 49460, //Allows you to ride on the back of an Amber Drake. ---> Dummy - SPELL_AMBER_SHOCK_LANCE = 49840, //(60 yds) - Instant - Deals 4822 to 5602 Arcane damage and detonates all Shock Charges on an enemy dragon. Damage is increased by 6525 for each detonated. - // SPELL_AMBER_STOP_TIME //Instant - 1 min cooldown - Halts the passage of time, freezing all enemy dragons in place for 10 sec. This attack applies 5 Shock Charges to each affected target. - //you do not have access to until you kill the Mage-Lord Urom. - SPELL_AMBER_TEMPORAL_RIFT = 49592, //(60 yds) - Channeled - Channels a temporal rift on an enemy dragon for 10 sec. While trapped in the rift, all damage done to the target is increased by 100%. In addition, for every 15, 000 damage done to a target affected by Temporal Rift, 1 Shock Charge is generated. - -/*Emerald Drake, -(npc 27692) (item 37815), - (summoned by spell Emerald Essence = 37815 ---> Call Emerald Drake == 49345 ---> Summon 27692) -*/ - SPELL_RIDE_EMERALD_DRAKE_QUE = 49427, //Apply Aura: Periodic Trigger, Interval: 3 seconds ---> 49346 - SPELL_EMERALD_DRAKE_SADDLE = 49346, //Allows you to ride on the back of an Amber Drake. ---> Dummy - SPELL_EMERALD_LEECHING_POISON = 50328, //(60 yds) - Instant - Poisons the enemy dragon, leeching 1300 to the caster every 2 sec. for 12 sec. Stacks up to 3 times. - SPELL_EMERALD_TOUCH_THE_NIGHTMARE = 50341, //(60 yds) - Instant - Consumes 30% of the caster's max health to inflict 25, 000 nature damage to an enemy dragon and reduce the damage it deals by 25% for 30 sec. +/* + * Ruby Drake (27756) + * (summoned by spell Ruby Essence (37860) --> Call Amber Drake (49462) --> Summon 27756) + */ + SPELL_RIDE_RUBY_DRAKE_QUE = 49463, // Apply Aura: Periodic Trigger, Interval: 3 seconds --> 49464 + SPELL_RUBY_DRAKE_SADDLE = 49464, // Allows you to ride on the back of an Amber Drake. --> Dummy + SPELL_RUBY_SEARING_WRATH = 50232, // (60 yds) - Instant - Breathes a stream of fire at an enemy dragon, dealing 6800 to 9200 Fire damage and then jumping to additional dragons within 30 yards. Each jump increases the damage by 50%. Affects up to 5 total targets + SPELL_RUBY_EVASIVE_AURA = 50248, // Instant - Allows the Ruby Drake to generate Evasive Charges when hit by hostile attacks and spells. + SPELL_RUBY_EVASIVE_CHARGES = 50241, + SPELL_RUBY_EVASIVE_MANEUVERS = 50240, // Instant - 5 sec. cooldown - Allows your drake to dodge all incoming attacks and spells. Requires Evasive Charges to use. Each attack or spell dodged while this ability is active burns one Evasive Charge. Lasts 30 sec. or until all charges are exhausted. + // you do not have acces to until you kill Mage-Lord Urom + SPELL_RUBY_MARTYR = 50253, // Instant - 10 sec. cooldown - Redirect all harmful spells cast at friendly drakes to yourself for 10 sec. + +/* + * Amber Drake (27755) + * (summoned by spell Amber Essence (37859) --> Call Amber Drake (49461) --> Summon 27755) + */ + SPELL_RIDE_AMBER_DRAKE_QUE = 49459, // Apply Aura: Periodic Trigger, Interval: 3 seconds --> 49460 + SPELL_AMBER_DRAKE_SADDLE = 49460, // Allows you to ride on the back of an Amber Drake. --> Dummy + SPELL_AMBER_SHOCK_CHARGE = 49836, + SPELL_AMBER_SHOCK_LANCE = 49840, // (60 yds) - Instant - Deals 4822 to 5602 Arcane damage and detonates all Shock Charges on an enemy dragon. Damage is increased by 6525 for each detonated. + SPELL_AMBER_STOP_TIME = 49838, // Instant - 1 min cooldown - Halts the passage of time, freezing all enemy dragons in place for 10 sec. This attack applies 5 Shock Charges to each affected target. + // you do not have access to until you kill the Mage-Lord Urom. + SPELL_AMBER_TEMPORAL_RIFT = 49592, // (60 yds) - Channeled - Channels a temporal rift on an enemy dragon for 10 sec. While trapped in the rift, all damage done to the target is increased by 100%. In addition, for every 15, 000 damage done to a target affected by Temporal Rift, 1 Shock Charge is generated. + +/* + * Emerald Drake (27692) + * (summoned by spell Emerald Essence (37815) --> Call Emerald Drake (49345) --> Summon 27692) + */ + SPELL_RIDE_EMERALD_DRAKE_QUE = 49427, // Apply Aura: Periodic Trigger, Interval: 3 seconds --> 49346 + SPELL_EMERALD_DRAKE_SADDLE = 49346, // Allows you to ride on the back of an Amber Drake. --> Dummy + SPELL_EMERALD_LEECHING_POISON = 50328, // (60 yds) - Instant - Poisons the enemy dragon, leeching 1300 to the caster every 2 sec. for 12 sec. Stacks up to 3 times. + SPELL_EMERALD_TOUCH_THE_NIGHTMARE = 50341, // (60 yds) - Instant - Consumes 30% of the caster's max health to inflict 25, 000 nature damage to an enemy dragon and reduce the damage it deals by 25% for 30 sec. // you do not have access to until you kill the Mage-Lord Urom - SPELL_EMERALD_DREAM_FUNNEL = 50344, //(60 yds) - Channeled - Transfers 5% of the caster's max health to a friendly drake every second for 10 seconds as long as the caster channels. + SPELL_EMERALD_DREAM_FUNNEL = 50344, // (60 yds) - Channeled - Transfers 5% of the caster's max health to a friendly drake every second for 10 seconds as long as the caster channels. + + // Misc + POINT_LAND = 2, + POINT_TAKE_OFF = 3 +}; + +enum DrakeEvents +{ + EVENT_WELCOME = 1, + EVENT_ABILITIES, + EVENT_SPECIAL_ATTACK, + EVENT_LOW_HEALTH, + EVENT_RESET_LOW_HEALTH, + EVENT_TAKE_OFF }; enum Says @@ -107,420 +103,500 @@ enum Says class npc_verdisa_beglaristrasz_eternos : public CreatureScript { -public: - npc_verdisa_beglaristrasz_eternos() : CreatureScript("npc_verdisa_beglaristrasz_eternos") { } + public: + npc_verdisa_beglaristrasz_eternos() : CreatureScript("npc_verdisa_beglaristrasz_eternos") { } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) OVERRIDE - { - player->PlayerTalkClass->ClearMenus(); - switch (creature->GetEntry()) + struct npc_verdisa_beglaristrasz_eternosAI : public ScriptedAI { - case NPC_VERDISA: //Verdisa + npc_verdisa_beglaristrasz_eternosAI(Creature* creature) : ScriptedAI(creature) { } + + void StoreEssence(Player* player, uint32 itemId) { - switch (action) - { - case GOSSIP_ACTION_INFO_DEF + 1: - if (!HAS_ESSENCE(player)) - { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_VERDISA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_VERDISA2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_VERDISA1, creature->GetGUID()); - } - else - { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_VERDISA2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_VERDISA2, creature->GetGUID()); - } - break; - case GOSSIP_ACTION_INFO_DEF + 2: - { - ItemPosCountVec dest; - uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_EMERALD_ESSENCE, 1); - if (msg == EQUIP_ERR_OK) - player->StoreNewItem(dest, ITEM_EMERALD_ESSENCE, true); - player->CLOSE_GOSSIP_MENU(); - break; - } - case GOSSIP_ACTION_INFO_DEF + 3: - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_VERDISA3, creature->GetGUID()); - break; - } - break; + /// @todo: should be handled by spell, but not found in dbc (49450 and other?) + uint32 count = 1; + ItemPosCountVec dest; + uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, count); + if (msg == EQUIP_ERR_OK) + if (Item* item = player->StoreNewItem(dest, itemId, true)) + player->SendNewItem(item, count, true, true); } - case NPC_BELGARISTRASZ: //Belgaristrasz + + void RemoveEssence(Player* player, uint32 itemId) { - switch (action) - { - case GOSSIP_ACTION_INFO_DEF + 1: - if (!HAS_ESSENCE(player)) - { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BELGARISTRASZ1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BELGARISTRASZ2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_BELGARISTRASZ1, creature->GetGUID()); - } - else - { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BELGARISTRASZ2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_BELGARISTRASZ2, creature->GetGUID()); - } - break; - case GOSSIP_ACTION_INFO_DEF + 2: - { - ItemPosCountVec dest; - uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_RUBY_ESSENCE, 1); - if (msg == EQUIP_ERR_OK) - player->StoreNewItem(dest, ITEM_RUBY_ESSENCE, true); - player->CLOSE_GOSSIP_MENU(); - break; - } - case GOSSIP_ACTION_INFO_DEF + 3: - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_BELGARISTRASZ3, creature->GetGUID()); - break; - } - break; + player->DestroyItemCount(itemId, 1, true, false); } - case NPC_ETERNOS: //Eternos + + void sGossipSelect(Player* player, uint32 menuId, uint32 gossipListId) OVERRIDE { - switch (action) + switch (menuId) { - case GOSSIP_ACTION_INFO_DEF + 1: - if (!HAS_ESSENCE(player)) + case GOSSIP_MENU_VERDISA: + if (gossipListId >= 1 && gossipListId <= 3) { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ETERNOS1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ETERNOS2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ETERNOS1, creature->GetGUID()); + if (gossipListId == 2) + RemoveEssence(player, ITEM_AMBER_ESSENCE); + else if (gossipListId == 3) + RemoveEssence(player, ITEM_RUBY_ESSENCE); + + StoreEssence(player, ITEM_EMERALD_ESSENCE); + break; } - else + return; + case GOSSIP_MENU_ETERNOS: + if (gossipListId >= 1 && gossipListId <= 3) { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ETERNOS2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ETERNOS2, creature->GetGUID()); + if (gossipListId == 2) + RemoveEssence(player, ITEM_EMERALD_ESSENCE); + else if (gossipListId == 3) + RemoveEssence(player, ITEM_RUBY_ESSENCE); + + StoreEssence(player, ITEM_AMBER_ESSENCE); + break; } - break; - case GOSSIP_ACTION_INFO_DEF + 2: - { - ItemPosCountVec dest; - uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_AMBER_ESSENCE, 1); - if (msg == EQUIP_ERR_OK) - player->StoreNewItem(dest, ITEM_AMBER_ESSENCE, true); - player->CLOSE_GOSSIP_MENU(); - break; - } - case GOSSIP_ACTION_INFO_DEF + 3: - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ETERNOS3, creature->GetGUID()); - break; + return; + case GOSSIP_MENU_BELGARISTRASZ: + if (gossipListId <= 2) + { + if (gossipListId == 1) + RemoveEssence(player, ITEM_AMBER_ESSENCE); + else if (gossipListId == 2) + RemoveEssence(player, ITEM_EMERALD_ESSENCE); + + StoreEssence(player, ITEM_RUBY_ESSENCE); + break; + } + return; + default: + return; } - break; + player->PlayerTalkClass->SendCloseGossip(); } - } - - return true; - } - bool OnGossipHello(Player* player, Creature* creature) OVERRIDE - { - if (creature->IsQuestGiver()) - player->PrepareQuestMenu(creature->GetGUID()); - - if (InstanceScript* instance = creature->GetInstanceScript()) - { - if (instance->GetBossState(DATA_DRAKOS_EVENT) == DONE) + void MovementInform(uint32 /*type*/, uint32 id) OVERRIDE { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_DRAKES, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_DRAKES, creature->GetGUID()); - } - } + if (id != POINT_MOVE_OUT) + return; - return true; - } + // When Belgaristraz finish his moving say grateful text + if (me->GetEntry() == NPC_BELGARISTRASZ) + Talk(SAY_BELGARISTRASZ); - struct npc_verdisa_beglaristrasz_eternosAI : public ScriptedAI - { - npc_verdisa_beglaristrasz_eternosAI(Creature* creature) : ScriptedAI(creature) { } + // The gossip flag should activate when Drakos die and not from DB + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + } + }; - void MovementInform(uint32 /*type*/, uint32 id) OVERRIDE + CreatureAI* GetAI(Creature* creature) const OVERRIDE { - if (id) - return; - - // When Belgaristraz finish his moving say grateful text - if (me->GetEntry() == NPC_BELGARISTRASZ) - Talk(SAY_BELGARISTRASZ); - - // The gossip flag should activate when Drakos die and not from DB - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + return GetOculusAI<npc_verdisa_beglaristrasz_eternosAI>(creature); } - }; - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_verdisa_beglaristrasz_eternosAI(creature); - } }; class npc_image_belgaristrasz : public CreatureScript { -public: - npc_image_belgaristrasz() : CreatureScript("npc_image_belgaristrasz") { } - - struct npc_image_belgaristraszAI : public ScriptedAI - { - npc_image_belgaristraszAI(Creature* creature) : ScriptedAI(creature) { } + public: + npc_image_belgaristrasz() : CreatureScript("npc_image_belgaristrasz") { } - void IsSummonedBy(Unit* summoner) OVERRIDE + struct npc_image_belgaristraszAI : public ScriptedAI { - if (summoner->GetEntry() == NPC_VAROS) - { - Talk(SAY_VAROS); - me->DespawnOrUnsummon(60000); - } - if (summoner->GetEntry() == NPC_UROM) + npc_image_belgaristraszAI(Creature* creature) : ScriptedAI(creature) { } + + void IsSummonedBy(Unit* summoner) OVERRIDE { - Talk(SAY_UROM); - me->DespawnOrUnsummon(60000); + if (summoner->GetEntry() == NPC_VAROS) + { + Talk(SAY_VAROS); + me->DespawnOrUnsummon(60000); + } + + if (summoner->GetEntry() == NPC_UROM) + { + Talk(SAY_UROM); + me->DespawnOrUnsummon(60000); + } } - } - }; + }; - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_image_belgaristraszAI(creature); - } + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return GetOculusAI<npc_image_belgaristraszAI>(creature); + } }; class npc_ruby_emerald_amber_drake : public CreatureScript { -public: - npc_ruby_emerald_amber_drake() : CreatureScript("npc_ruby_emerald_amber_drake") { } + public: + npc_ruby_emerald_amber_drake() : CreatureScript("npc_ruby_emerald_amber_drake") { } - struct npc_ruby_emerald_amber_drakeAI : public VehicleAI - { - npc_ruby_emerald_amber_drakeAI(Creature* creature) : VehicleAI(creature) + struct npc_ruby_emerald_amber_drakeAI : public VehicleAI { - instance = creature->GetInstanceScript(); - } - - InstanceScript* instance; + npc_ruby_emerald_amber_drakeAI(Creature* creature) : VehicleAI(creature) + { + _instance = creature->GetInstanceScript(); + } - uint64 summonerGUID; - uint32 WelcomeTimer; - uint32 WelcomeSequelTimer; - uint32 SpecialTimer; - uint32 WarningTimer; - uint32 TakeOffTimer; + void Reset() OVERRIDE + { + _events.Reset(); + _healthWarning = true; + } - bool WelcomeOff; - bool WelcomeSequelOff; - bool SpecialOff; - bool HealthWarningOff; - bool DisableTakeOff; + void IsSummonedBy(Unit* summoner) OVERRIDE + { + if (_instance->GetBossState(DATA_EREGOS) == IN_PROGRESS) + if (Creature* eregos = me->FindNearestCreature(NPC_EREGOS, 450.0f, true)) + eregos->DespawnOrUnsummon(); // On retail this kills abusive call of drake during engaged Eregos - void Reset() OVERRIDE - { - summonerGUID = 0; - WelcomeTimer = 4500; - WelcomeSequelTimer = 4500; - SpecialTimer = 10000; - WarningTimer = 25000; - TakeOffTimer = 3500; - - WelcomeOff = false; - WelcomeSequelOff = false; - SpecialOff = false; - HealthWarningOff = false; - DisableTakeOff = false; - } + me->SetFacingToObject(summoner); - void IsSummonedBy(Unit* summoner) OVERRIDE - { - if (instance->GetBossState(DATA_EREGOS_EVENT) == IN_PROGRESS) - if (Creature* eregos = me->FindNearestCreature(NPC_EREGOS, 450.0f, true)) + switch (me->GetEntry()) { - eregos->DespawnOrUnsummon(); // On retail this kills abusive call of drake during engaged Eregos + case NPC_RUBY_DRAKE_VEHICLE: + me->CastSpell(summoner, SPELL_RIDE_RUBY_DRAKE_QUE); + break; + case NPC_EMERALD_DRAKE_VEHICLE: + me->CastSpell(summoner, SPELL_RIDE_EMERALD_DRAKE_QUE); + break; + case NPC_AMBER_DRAKE_VEHICLE: + me->CastSpell(summoner, SPELL_RIDE_AMBER_DRAKE_QUE); + break; + default: + return; } - summonerGUID = summoner->GetGUID(); - me->SetFacingToObject(summoner); - // TO DO: Drake Ques should be casted from vehicle to player, however the way core handle triggered spells from auras break it no matter the conditions. So this change the caster and give the same result until someone fix triggered spells from auras that involve implicit targets or make exception for this case. - if (me->GetEntry() == NPC_RUBY_DRAKE_VEHICLE) - summoner->CastSpell(summoner, SPELL_RIDE_RUBY_DRAKE_QUE); - if (me->GetEntry() == NPC_EMERALD_DRAKE_VEHICLE) - summoner->CastSpell(summoner, SPELL_RIDE_EMERALD_DRAKE_QUE); - if (me->GetEntry() == NPC_AMBER_DRAKE_VEHICLE) - summoner->CastSpell(summoner, SPELL_RIDE_AMBER_DRAKE_QUE); - Position pos; - summoner->GetPosition(&pos); - me->GetMotionMaster()->MovePoint(0, pos); - } - void MovementInform(uint32 type, uint32 id) OVERRIDE - { - if (type == POINT_MOTION_TYPE && id == 0) - me->SetDisableGravity(false); // Needed this for proper animation after spawn, the summon in air fall to ground bug leave no other option for now, if this isn't used the drake will only walk on move. - } + Position pos; + summoner->GetPosition(&pos); + me->GetMotionMaster()->MovePoint(POINT_LAND, pos); + } - void UpdateAI(uint32 diff) OVERRIDE - { - if (!(instance->GetBossState(DATA_VAROS_EVENT) == DONE)) + void MovementInform(uint32 type, uint32 id) OVERRIDE { - if (me->HasAuraType(SPELL_AURA_CONTROL_VEHICLE)) - { - if (!(WelcomeOff)) - { - if (WelcomeTimer <= diff) - { - Talk(WHISPER_DRAKES_WELCOME, me->GetCreatorGUID()); - WelcomeOff = true; - WelcomeSequelOff = true; - } - else WelcomeTimer -= diff; - } - } + if (type == POINT_MOTION_TYPE && id == POINT_LAND) + me->SetDisableGravity(false); // Needed this for proper animation after spawn, the summon in air fall to ground bug leave no other option for now, if this isn't used the drake will only walk on move. } - if (me->HasAuraType(SPELL_AURA_CONTROL_VEHICLE)) + + void PassengerBoarded(Unit* passenger, int8 /*seatId*/, bool apply) OVERRIDE { - if (WelcomeSequelOff) + if (passenger->GetTypeId() != TYPEID_PLAYER) + return; + + if (apply) { - if (WelcomeSequelTimer <= diff) - { - Talk(WHISPER_DRAKES_ABILITIES, me->GetCreatorGUID()); - WelcomeSequelOff = false; - } - else WelcomeSequelTimer -= diff; - } + if (_instance->GetBossState(DATA_VAROS) != DONE) + _events.ScheduleEvent(EVENT_WELCOME, 10 * IN_MILLISECONDS); - if (instance->GetBossState(DATA_UROM_EVENT) == DONE) + else if (_instance->GetBossState(DATA_UROM) == DONE) + _events.ScheduleEvent(EVENT_SPECIAL_ATTACK, 10 * IN_MILLISECONDS); + } + else { - if (!(SpecialOff)) - { - if (SpecialTimer <= diff) - { - Talk(WHISPER_DRAKES_SPECIAL, me->GetCreatorGUID()); - SpecialOff = true; - } - else SpecialTimer -= diff; - } + _events.Reset(); + _events.ScheduleEvent(EVENT_TAKE_OFF, 2 * IN_MILLISECONDS); } + } - if (!(HealthWarningOff)) + void UpdateAI(uint32 diff) OVERRIDE + { + if (_healthWarning) { if (me->GetHealthPct() <= 40.0f) - { - Talk(WHISPER_DRAKES_LOWHEALTH, me->GetCreatorGUID()); - HealthWarningOff = true; - } + _events.ScheduleEvent(EVENT_LOW_HEALTH, 0); } - if (HealthWarningOff) + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) { - if (WarningTimer <= diff) + switch (eventId) { - HealthWarningOff = false; - WarningTimer = 25000; + case EVENT_WELCOME: + Talk(WHISPER_DRAKES_WELCOME, me->GetCreatorGUID()); + _events.ScheduleEvent(EVENT_ABILITIES, 5 * IN_MILLISECONDS); + break; + case EVENT_ABILITIES: + Talk(WHISPER_DRAKES_ABILITIES, me->GetCreatorGUID()); + break; + case EVENT_SPECIAL_ATTACK: + Talk(WHISPER_DRAKES_SPECIAL, me->GetCreatorGUID()); + break; + case EVENT_LOW_HEALTH: + Talk(WHISPER_DRAKES_LOWHEALTH, me->GetCreatorGUID()); + _healthWarning = false; + _events.ScheduleEvent(EVENT_RESET_LOW_HEALTH, 25000); + break; + case EVENT_RESET_LOW_HEALTH: + _healthWarning = true; + break; + case EVENT_TAKE_OFF: + { + me->DespawnOrUnsummon(2050); + me->SetOrientation(2.5f); + me->SetSpeed(MOVE_FLIGHT, 1.0f, true); + Talk(SAY_DRAKES_TAKEOFF); + Position pos; + me->GetPosition(&pos); + Position offset = { 10.0f, 10.0f, 12.0f, 0.0f }; + pos.RelocateOffset(offset); + me->SetDisableGravity(true); + me->GetMotionMaster()->MovePoint(POINT_TAKE_OFF, pos); + break; + } + default: + break; } - else WarningTimer -= diff; } + }; + + private: + InstanceScript* _instance; + EventMap _events; + bool _healthWarning; + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return GetOculusAI<npc_ruby_emerald_amber_drakeAI>(creature); + } +}; + +// 49345 - Call Emerald Drake +// 49461 - Call Amber Drake +// 49462 - Call Ruby Drake +class spell_oculus_call_ruby_emerald_amber_drake : public SpellScriptLoader +{ + public: + spell_oculus_call_ruby_emerald_amber_drake() : SpellScriptLoader("spell_oculus_call_ruby_emerald_amber_drake") { } + + class spell_oculus_call_ruby_emerald_amber_drake_SpellScript : public SpellScript + { + PrepareSpellScript(spell_oculus_call_ruby_emerald_amber_drake_SpellScript); + + void ChangeSummonPos(SpellEffIndex /*effIndex*/) + { + // Adjust effect summon position + WorldLocation summonPos = *GetExplTargetDest(); + Position offset = { 0.0f, 0.0f, 12.0f, 0.0f }; + summonPos.RelocateOffset(offset); + SetExplTargetDest(summonPos); + GetHitDest()->RelocateOffset(offset); } - if (!(me->HasAuraType(SPELL_AURA_CONTROL_VEHICLE))) + void ModDestHeight(SpellEffIndex /*effIndex*/) { - if (!(DisableTakeOff)) - { - if (TakeOffTimer <= diff) - { - me->DespawnOrUnsummon(2050); - me->SetOrientation(2.5f); - me->SetSpeed(MOVE_FLIGHT, 1.0f, true); - Talk(SAY_DRAKES_TAKEOFF); - Position pos; - me->GetPosition(&pos); - pos.m_positionX += 10.0f; - pos.m_positionY += 10.0f; - pos.m_positionZ += 12.0f; - me->GetMotionMaster()->MovePoint(1, pos); - DisableTakeOff = true; - } - else TakeOffTimer -= diff; - } + // Used to cast visual effect at proper position + Position offset = { 0.0f, 0.0f, 12.0f, 0.0f }; + const_cast<WorldLocation*>(GetExplTargetDest())->RelocateOffset(offset); + } + + void Register() OVERRIDE + { + OnEffectHit += SpellEffectFn(spell_oculus_call_ruby_emerald_amber_drake_SpellScript::ChangeSummonPos, EFFECT_0, SPELL_EFFECT_SUMMON); + OnEffectLaunch += SpellEffectFn(spell_oculus_call_ruby_emerald_amber_drake_SpellScript::ModDestHeight, EFFECT_0, SPELL_EFFECT_SUMMON); } }; - }; - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_ruby_emerald_amber_drakeAI(creature); - } + SpellScript* GetSpellScript() const OVERRIDE + { + return new spell_oculus_call_ruby_emerald_amber_drake_SpellScript(); + } }; -class spell_gen_stop_time : public SpellScriptLoader +// 49427 - Ride Emerald Drake Que +// 49459 - Ride Amber Drake Que +// 49463 - Ride Ruby Drake Que +class spell_oculus_ride_ruby_emerald_amber_drake_que : public SpellScriptLoader { -public: - spell_gen_stop_time() : SpellScriptLoader("spell_gen_stop_time") { } + public: + spell_oculus_ride_ruby_emerald_amber_drake_que() : SpellScriptLoader("spell_oculus_ride_ruby_emerald_amber_drake_que") { } - class spell_gen_stop_time_AuraScript : public AuraScript - { - PrepareAuraScript(spell_gen_stop_time_AuraScript); + class spell_oculus_ride_ruby_emerald_amber_drake_que_AuraScript : public AuraScript + { + PrepareAuraScript(spell_oculus_ride_ruby_emerald_amber_drake_que_AuraScript); + + void HandlePeriodic(AuraEffect const* aurEff) + { + // caster of the triggered spell is wrong for an unknown reason, handle it here correctly + PreventDefaultAction(); + if (Unit* caster = GetCaster()) + GetTarget()->CastSpell(caster, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true); + } - void Apply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void Register() OVERRIDE + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_oculus_ride_ruby_emerald_amber_drake_que_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } + }; + + AuraScript* GetAuraScript() const OVERRIDE { - Unit* caster = GetCaster(); - if (!caster) - return; - Unit* target = GetTarget(); - for (uint32 i = 0; i < 5; ++i) - caster->CastSpell(target, SPELL_SHOCK_CHARGE, false); + return new spell_oculus_ride_ruby_emerald_amber_drake_que_AuraScript(); } +}; + +// 50240 - Evasive Maneuvers +class spell_oculus_evasive_maneuvers : public SpellScriptLoader +{ + public: + spell_oculus_evasive_maneuvers() : SpellScriptLoader("spell_oculus_evasive_maneuvers") { } - void Register() OVERRIDE + class spell_oculus_evasive_maneuvers_AuraScript : public AuraScript { - AfterEffectApply += AuraEffectApplyFn(spell_gen_stop_time_AuraScript::Apply, EFFECT_0, SPELL_AURA_MOD_STUN, AURA_EFFECT_HANDLE_REAL); - } - }; + PrepareAuraScript(spell_oculus_evasive_maneuvers_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE + { + if (!sSpellMgr->GetSpellInfo(SPELL_RUBY_EVASIVE_CHARGES)) + return false; + return true; + } - AuraScript* GetAuraScript() const OVERRIDE - { - return new spell_gen_stop_time_AuraScript(); - } + void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& /*eventInfo*/) + { + PreventDefaultAction(); + GetTarget()->RemoveAuraFromStack(SPELL_RUBY_EVASIVE_CHARGES); + if (!GetTarget()->HasAura(SPELL_RUBY_EVASIVE_CHARGES)) + Remove(); + } + + void Register() OVERRIDE + { + OnEffectProc += AuraEffectProcFn(spell_oculus_evasive_maneuvers_AuraScript::HandleProc, EFFECT_2, SPELL_AURA_PROC_TRIGGER_SPELL); + } + }; + + AuraScript* GetAuraScript() const OVERRIDE + { + return new spell_oculus_evasive_maneuvers_AuraScript(); + } }; -class spell_call_ruby_emerald_amber_drake : public SpellScriptLoader +// 49840 - Shock Lance +class spell_oculus_shock_lance : public SpellScriptLoader { -public: - spell_call_ruby_emerald_amber_drake() : SpellScriptLoader("spell_call_ruby_emerald_amber_drake") { } + public: + spell_oculus_shock_lance() : SpellScriptLoader("spell_oculus_shock_lance") { } + + class spell_oculus_shock_lance_SpellScript : public SpellScript + { + PrepareSpellScript(spell_oculus_shock_lance_SpellScript); + + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE + { + if (!sSpellMgr->GetSpellInfo(SPELL_AMBER_SHOCK_CHARGE)) + return false; + return true; + } - class spell_call_ruby_emerald_amber_drake_SpellScript : public SpellScript - { - PrepareSpellScript(spell_call_ruby_emerald_amber_drake_SpellScript); + void CalcDamage() + { + int32 damage = GetHitDamage(); + if (Unit* target = GetHitUnit()) + if (AuraEffect const* shockCharges = target->GetAuraEffect(SPELL_AMBER_SHOCK_CHARGE, EFFECT_0, GetCaster()->GetGUID())) + { + damage += shockCharges->GetAmount(); + shockCharges->GetBase()->Remove(); + } + + SetHitDamage(damage); + } + + void Register() OVERRIDE + { + OnHit += SpellHitFn(spell_oculus_shock_lance_SpellScript::CalcDamage); + } + }; - void ChangeSummonPos(SpellEffIndex /*effIndex*/) + SpellScript* GetSpellScript() const OVERRIDE { - // Adjust effect summon position - WorldLocation summonPos = *GetExplTargetDest(); - Position offset = {0.0f, 0.0f, 12.0f, 0.0f}; - summonPos.RelocateOffset(offset); - SetExplTargetDest(summonPos); - GetHitDest()->RelocateOffset(offset); + return new spell_oculus_shock_lance_SpellScript(); } +}; + +// 49838 - Stop Time +class spell_oculus_stop_time : public SpellScriptLoader +{ + public: + spell_oculus_stop_time() : SpellScriptLoader("spell_oculus_stop_time") { } - void ModDestHeight(SpellEffIndex /*effIndex*/) + class spell_oculus_stop_time_AuraScript : public AuraScript { - // Used to cast visual effect at proper position - Position offset = {0.0f, 0.0f, 12.0f, 0.0f}; - const_cast<WorldLocation*>(GetExplTargetDest())->RelocateOffset(offset); - } + PrepareAuraScript(spell_oculus_stop_time_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE + { + if (!sSpellMgr->GetSpellInfo(SPELL_AMBER_SHOCK_CHARGE)) + return false; + return true; + } + + void Apply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + Unit* caster = GetCaster(); + if (!caster) + return; + + Unit* target = GetTarget(); + for (uint32 i = 0; i < 5; ++i) + caster->CastSpell(target, SPELL_AMBER_SHOCK_CHARGE, true); + } + + void Register() OVERRIDE + { + AfterEffectApply += AuraEffectApplyFn(spell_oculus_stop_time_AuraScript::Apply, EFFECT_0, SPELL_AURA_MOD_STUN, AURA_EFFECT_HANDLE_REAL); + } + }; - void Register() OVERRIDE + AuraScript* GetAuraScript() const OVERRIDE { - OnEffectHit += SpellEffectFn(spell_call_ruby_emerald_amber_drake_SpellScript::ChangeSummonPos, EFFECT_0, SPELL_EFFECT_SUMMON); - OnEffectLaunch += SpellEffectFn(spell_call_ruby_emerald_amber_drake_SpellScript::ModDestHeight, EFFECT_0, SPELL_EFFECT_SUMMON); + return new spell_oculus_stop_time_AuraScript(); } - }; - - SpellScript* GetSpellScript() const OVERRIDE - { - return new spell_call_ruby_emerald_amber_drake_SpellScript(); - } }; +// 49592 - Temporal Rift +class spell_oculus_temporal_rift : public SpellScriptLoader +{ + public: + spell_oculus_temporal_rift() : SpellScriptLoader("spell_oculus_temporal_rift") { } + + class spell_oculus_temporal_rift_AuraScript : public AuraScript + { + PrepareAuraScript(spell_oculus_temporal_rift_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE + { + if (!sSpellMgr->GetSpellInfo(SPELL_AMBER_SHOCK_CHARGE)) + return false; + return true; + } + + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + int32 amount = aurEff->GetAmount() + eventInfo.GetDamageInfo()->GetDamage(); + + if (amount >= 15000) + { + if (Unit* caster = GetCaster()) + caster->CastSpell(GetTarget(), SPELL_AMBER_SHOCK_CHARGE, true); + amount -= 15000; + } + + const_cast<AuraEffect*>(aurEff)->SetAmount(amount); + } + + void Register() OVERRIDE + { + OnEffectProc += AuraEffectProcFn(spell_oculus_temporal_rift_AuraScript::HandleProc, EFFECT_2, SPELL_AURA_DUMMY); + } + }; + + AuraScript* GetAuraScript() const OVERRIDE + { + return new spell_oculus_temporal_rift_AuraScript(); + } +}; +// 50341 - Touch the Nightmare class spell_oculus_touch_the_nightmare : public SpellScriptLoader { public: @@ -547,7 +623,8 @@ class spell_oculus_touch_the_nightmare : public SpellScriptLoader } }; -class spell_oculus_dream_funnel: public SpellScriptLoader +// 50344 - Dream Funnel +class spell_oculus_dream_funnel : public SpellScriptLoader { public: spell_oculus_dream_funnel() : SpellScriptLoader("spell_oculus_dream_funnel") { } @@ -582,8 +659,12 @@ void AddSC_oculus() new npc_verdisa_beglaristrasz_eternos(); new npc_image_belgaristrasz(); new npc_ruby_emerald_amber_drake(); - new spell_gen_stop_time(); - new spell_call_ruby_emerald_amber_drake(); + new spell_oculus_call_ruby_emerald_amber_drake(); + new spell_oculus_ride_ruby_emerald_amber_drake_que(); + new spell_oculus_evasive_maneuvers(); + new spell_oculus_shock_lance(); + new spell_oculus_stop_time(); + new spell_oculus_temporal_rift(); new spell_oculus_touch_the_nightmare(); new spell_oculus_dream_funnel(); } diff --git a/src/server/scripts/Northrend/Nexus/Oculus/oculus.h b/src/server/scripts/Northrend/Nexus/Oculus/oculus.h index 2dd5df3bc3b..6f34cfbf6e5 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/oculus.h +++ b/src/server/scripts/Northrend/Nexus/Oculus/oculus.h @@ -15,59 +15,55 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef DEF_OCULUS_H -#define DEF_OCULUS_H +#ifndef OCULUS_H_ +#define OCULUS_H_ -enum Data -{ - DATA_DRAKOS_EVENT, - DATA_VAROS_EVENT, - DATA_UROM_EVENT, - DATA_EREGOS_EVENT, - DATA_UROM_PLATAFORM -}; +#define OculusScriptName "instance_oculus" + +uint32 const EncounterCount = 4; -enum Data64 +enum DataTypes { - DATA_DRAKOS, - DATA_VAROS, - DATA_UROM, - DATA_EREGOS + // Encounter States/Boss GUIDs + DATA_DRAKOS = 0, + DATA_VAROS = 1, + DATA_UROM = 2, + DATA_EREGOS = 3 }; -enum Bosses_NPCs +enum CreatureIds { NPC_DRAKOS = 27654, NPC_VAROS = 27447, NPC_UROM = 27655, NPC_EREGOS = 27656, - NPC_AZURE_RING_GUARDIAN = 28236, - NPC_CENTRIFUGE_CONSTRUCT = 27641, - NPC_RUBY_DRAKE_VEHICLE = 27756, - NPC_EMERALD_DRAKE_VEHICLE = 27692, - NPC_AMBER_DRAKE_VEHICLE = 27755, - NPC_VERDISA = 27657, - NPC_BELGARISTRASZ = 27658, - NPC_ETERNOS = 27659, - NPC_GREATER_WHELP = 28276 + NPC_AZURE_RING_GUARDIAN = 28236, + NPC_CENTRIFUGE_CONSTRUCT = 27641, + NPC_RUBY_DRAKE_VEHICLE = 27756, + NPC_EMERALD_DRAKE_VEHICLE = 27692, + NPC_AMBER_DRAKE_VEHICLE = 27755, + NPC_VERDISA = 27657, + NPC_BELGARISTRASZ = 27658, + NPC_ETERNOS = 27659, + NPC_GREATER_WHELP = 28276 }; -enum GameObjects +enum GameObjectIds { - GO_DRAGON_CAGE_DOOR = 193995, - GO_EREGOS_CACHE_N = 191349, - GO_EREGOS_CACHE_H = 193603 + GO_DRAGON_CAGE_DOOR = 193995, + GO_EREGOS_CACHE_N = 191349, + GO_EREGOS_CACHE_H = 193603 }; enum SpellEvents { - EVENT_CALL_DRAGON = 12229 + EVENT_CALL_DRAGON = 12229 }; enum CreatureActions { - ACTION_CALL_DRAGON_EVENT = 1 + ACTION_CALL_DRAGON_EVENT = 1 }; enum OculusWorldStates @@ -78,7 +74,19 @@ enum OculusWorldStates enum OculusSpells { - SPELL_CENTRIFUGE_SHIELD = 50053, - SPELL_DEATH_SPELL = 50415 + SPELL_CENTRIFUGE_SHIELD = 50053, + SPELL_DEATH_SPELL = 50415 }; -#endif + +enum Misc +{ + POINT_MOVE_OUT = 1 +}; + +template<class AI> +AI* GetOculusAI(Creature* creature) +{ + return GetInstanceAI<AI>(creature, OculusScriptName); +} + +#endif // OCULUS_H_ diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp index b70bda76d76..77c19422da0 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp @@ -58,19 +58,14 @@ enum Creatures NPC_STASIS_CONTROLLER = 26688 }; -struct Locations +Position const moveLocs[] = { - float x, y, z; -}; - -struct Locations moveLocs[]= -{ - {261.6f, -449.3f, 109.5f}, - {263.3f, -454.0f, 109.5f}, - {291.5f, -450.4f, 109.5f}, - {291.5f, -454.0f, 109.5f}, - {310.0f, -453.4f, 109.5f}, - {238.6f, -460.7f, 109.5f} + { 261.6f, -449.3f, 109.5f, 0.0f }, + { 263.3f, -454.0f, 109.5f, 0.0f }, + { 291.5f, -450.4f, 109.5f, 0.0f }, + { 291.5f, -454.0f, 109.5f, 0.0f }, + { 310.0f, -453.4f, 109.5f, 0.0f }, + { 238.6f, -460.7f, 109.5f, 0.0f } }; enum Phase @@ -83,21 +78,20 @@ enum Phase PHASE_NONE }; +enum Misc +{ + ACTION_NEXT_PHASE, +}; + class boss_palehoof : public CreatureScript { public: boss_palehoof() : CreatureScript("boss_palehoof") { } - CreatureAI* GetAI(Creature* creature) const OVERRIDE + struct boss_palehoofAI : public BossAI { - return new boss_palehoofAI(creature); - } - - struct boss_palehoofAI : public ScriptedAI - { - boss_palehoofAI(Creature* creature) : ScriptedAI(creature) + boss_palehoofAI(Creature* creature) : BossAI(creature, DATA_GORTOK_PALEHOOF) { - instance = creature->GetInstanceScript(); } uint32 uiArcingSmashTimer; @@ -108,10 +102,10 @@ public: uint8 AddCount; Phase Sequence[4]; - InstanceScript* instance; - void Reset() OVERRIDE { + _Reset(); + /// There is a good reason to store them like this, we are going to shuffle the order. for (uint32 i = PHASE_FRENZIED_WORGEN; i < PHASE_GORTOK_PALEHOOF; ++i) Sequence[i] = Phase(i); @@ -129,32 +123,15 @@ public: currentPhase = PHASE_NONE; - if (instance) - { - instance->SetData(DATA_GORTOK_PALEHOOF_EVENT, NOT_STARTED); - - Creature* temp = Unit::GetCreature((*me), instance->GetData64(DATA_NPC_FRENZIED_WORGEN)); - if (temp && !temp->IsAlive()) - temp->Respawn(); + for (uint8 i = DATA_FRENZIED_WORGEN; i <= DATA_FEROCIOUS_RHINO; ++i) + if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetData64(i))) + if (!temp->IsAlive()) + temp->Respawn(); - temp = Unit::GetCreature((*me), instance->GetData64(DATA_NPC_FEROCIOUS_RHINO)); - if (temp && !temp->IsAlive()) - temp->Respawn(); - - temp = Unit::GetCreature((*me), instance->GetData64(DATA_NPC_MASSIVE_JORMUNGAR)); - if (temp && !temp->IsAlive()) - temp->Respawn(); - - temp = Unit::GetCreature((*me), instance->GetData64(DATA_NPC_RAVENOUS_FURBOLG)); - if (temp && !temp->IsAlive()) - temp->Respawn(); - - GameObject* go = instance->instance->GetGameObject(instance->GetData64(DATA_GORTOK_PALEHOOF_SPHERE)); - if (go) - { - go->SetGoState(GO_STATE_READY); - go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - } + if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_GORTOK_PALEHOOF_SPHERE))) + { + go->SetGoState(GO_STATE_READY); + go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); } } @@ -185,14 +162,9 @@ public: if (currentPhase != PHASE_GORTOK_PALEHOOF) return; - //Return since we have no target if (!UpdateVictim()) return; - Creature* temp = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_NPC_ORB) : 0); - if (temp && temp->IsAlive()) - temp->DisappearAndDie(); - if (uiArcingSmashTimer <= diff) { DoCast(me, SPELL_ARCING_SMASH); @@ -217,12 +189,8 @@ public: void JustDied(Unit* /*killer*/) OVERRIDE { - //Talk(SAY_DEATH); - if (instance) - instance->SetData(DATA_GORTOK_PALEHOOF_EVENT, DONE); - Creature* temp = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_NPC_ORB) : 0); - if (temp && temp->IsAlive()) - temp->DisappearAndDie(); + _JustDied(); + //Talk(SAY_DEATH); } void KilledUnit(Unit* /*victim*/) OVERRIDE @@ -230,28 +198,30 @@ public: Talk(SAY_SLAY); } - void NextPhase() + void DoAction(int32 actionId) OVERRIDE { + if (actionId != ACTION_NEXT_PHASE) + return; + if (currentPhase == PHASE_NONE) { - if (instance) - instance->SetData(DATA_GORTOK_PALEHOOF_EVENT, IN_PROGRESS); + instance->SetBossState(DATA_GORTOK_PALEHOOF, IN_PROGRESS); - me->SummonCreature(NPC_STASIS_CONTROLLER, moveLocs[5].x, moveLocs[5].y, moveLocs[5].z, 0, TEMPSUMMON_CORPSE_DESPAWN); + if (Creature* orb = me->SummonCreature(NPC_STASIS_CONTROLLER, moveLocs[5], TEMPSUMMON_CORPSE_DESPAWN)) + orb->CastSpell(me, SPELL_ORB_VISUAL, true); } + Phase move = PHASE_NONE; if (AddCount >= DUNGEON_MODE(2, 4)) move = PHASE_GORTOK_PALEHOOF; else move = Sequence[AddCount++]; - //send orb to summon spot - Creature* pOrb = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_NPC_ORB) : 0); - if (pOrb && pOrb->IsAlive()) - { - if (currentPhase == PHASE_NONE) - pOrb->CastSpell(me, SPELL_ORB_VISUAL, true); - pOrb->GetMotionMaster()->MovePoint(move, moveLocs[move].x, moveLocs[move].y, moveLocs[move].z); - } + + // send orb to summon spot + if (Creature* orb = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GORTOK_ORB))) + if (orb->IsAlive()) + orb->GetMotionMaster()->MovePoint(move, moveLocs[move]); + currentPhase = move; } @@ -263,6 +233,10 @@ public: } }; + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return GetUtgardePinnacleAI<boss_palehoofAI>(creature); + } }; //ravenous furbolg's spells @@ -305,13 +279,12 @@ public: me->GetMotionMaster()->MoveTargetedHome(); - if (instance) - if (instance->GetData(DATA_GORTOK_PALEHOOF_EVENT) == IN_PROGRESS) - { - Creature* pPalehoof = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_GORTOK_PALEHOOF) : 0); - if (pPalehoof && pPalehoof->IsAlive()) - CAST_AI(boss_palehoof::boss_palehoofAI, pPalehoof->AI())->Reset(); - } + if (instance->GetBossState(DATA_GORTOK_PALEHOOF) == IN_PROGRESS) + { + Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GORTOK_PALEHOOF)); + if (palehoof && palehoof->IsAlive()) + palehoof->AI()->Reset(); + } } void UpdateAI(uint32 diff) OVERRIDE @@ -360,12 +333,8 @@ public: void JustDied(Unit* /*killer*/) OVERRIDE { - if (instance) - { - Creature* pPalehoof = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_GORTOK_PALEHOOF) : 0); - if (pPalehoof) - CAST_AI(boss_palehoof::boss_palehoofAI, pPalehoof->AI())->NextPhase(); - } + if (Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GORTOK_PALEHOOF))) + palehoof->AI()->DoAction(ACTION_NEXT_PHASE); } void JustReachedHome() OVERRIDE @@ -418,13 +387,12 @@ public: me->GetMotionMaster()->MoveTargetedHome(); - if (instance) - if (instance->GetData(DATA_GORTOK_PALEHOOF_EVENT) == IN_PROGRESS) - { - Creature* pPalehoof = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_GORTOK_PALEHOOF) : 0); - if (pPalehoof && pPalehoof->IsAlive()) - CAST_AI(boss_palehoof::boss_palehoofAI, pPalehoof->AI())->Reset(); - } + if (instance->GetBossState(DATA_GORTOK_PALEHOOF) == IN_PROGRESS) + { + Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GORTOK_PALEHOOF)); + if (palehoof && palehoof->IsAlive()) + palehoof->AI()->Reset(); + } } void UpdateAI(uint32 diff) OVERRIDE @@ -470,17 +438,13 @@ public: DoStartMovement(who); } if (instance) - instance->SetData(DATA_GORTOK_PALEHOOF_EVENT, IN_PROGRESS); + instance->SetBossState(DATA_GORTOK_PALEHOOF, IN_PROGRESS); } void JustDied(Unit* /*killer*/) OVERRIDE { - if (instance) - { - Creature* pPalehoof = Unit::GetCreature((*me), instance->GetData64(DATA_GORTOK_PALEHOOF)); - if (pPalehoof) - CAST_AI(boss_palehoof::boss_palehoofAI, pPalehoof->AI())->NextPhase(); - } + if (Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GORTOK_PALEHOOF))) + palehoof->AI()->DoAction(ACTION_NEXT_PHASE); } void JustReachedHome() OVERRIDE @@ -534,13 +498,12 @@ public: me->GetMotionMaster()->MoveTargetedHome(); - if (instance) - if (instance->GetData(DATA_GORTOK_PALEHOOF_EVENT) == IN_PROGRESS) - { - Creature* pPalehoof = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_GORTOK_PALEHOOF) : 0); - if (pPalehoof && pPalehoof->IsAlive()) - CAST_AI(boss_palehoof::boss_palehoofAI, pPalehoof->AI())->Reset(); - } + if (instance->GetBossState(DATA_GORTOK_PALEHOOF) == IN_PROGRESS) + { + Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GORTOK_PALEHOOF)); + if (palehoof && palehoof->IsAlive()) + palehoof->AI()->Reset(); + } } void UpdateAI(uint32 diff) OVERRIDE @@ -590,12 +553,8 @@ public: void JustDied(Unit* /*killer*/) OVERRIDE { - if (instance) - { - Creature* pPalehoof = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_GORTOK_PALEHOOF) : 0); - if (pPalehoof) - CAST_AI(boss_palehoof::boss_palehoofAI, pPalehoof->AI())->NextPhase(); - } + if (Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GORTOK_PALEHOOF))) + palehoof->AI()->DoAction(ACTION_NEXT_PHASE); } void JustReachedHome() OVERRIDE @@ -654,13 +613,12 @@ public: me->GetMotionMaster()->MoveTargetedHome(); - if (instance) - if (instance->GetData(DATA_GORTOK_PALEHOOF_EVENT) == IN_PROGRESS) - { - Creature* pPalehoof = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_GORTOK_PALEHOOF) : 0); - if (pPalehoof && pPalehoof->IsAlive()) - CAST_AI(boss_palehoof::boss_palehoofAI, pPalehoof->AI())->Reset(); - } + if (instance->GetBossState(DATA_GORTOK_PALEHOOF) == IN_PROGRESS) + { + Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GORTOK_PALEHOOF)); + if (palehoof && palehoof->IsAlive()) + palehoof->AI()->Reset(); + } } void UpdateAI(uint32 diff) OVERRIDE @@ -711,12 +669,8 @@ public: void JustDied(Unit* /*killer*/) OVERRIDE { - if (instance) - { - Creature* pPalehoof = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_GORTOK_PALEHOOF) : 0); - if (pPalehoof) - CAST_AI(boss_palehoof::boss_palehoofAI, pPalehoof->AI())->NextPhase(); - } + if (Creature* palehoof = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_GORTOK_PALEHOOF))) + palehoof->AI()->DoAction(ACTION_NEXT_PHASE); } void JustReachedHome() OVERRIDE @@ -767,52 +721,76 @@ public: if (SummonTimer <= diff) { - if (currentPhase<5&¤tPhase >= 0) + uint8 nextBossId = 0; + switch (currentPhase) { - Creature* pNext = NULL; - switch (currentPhase) - { - case PHASE_FRENZIED_WORGEN: pNext = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_NPC_FRENZIED_WORGEN) : 0); break; - case PHASE_RAVENOUS_FURLBORG: pNext = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_NPC_RAVENOUS_FURBOLG) : 0); break; - case PHASE_MASSIVE_JORMUNGAR: pNext = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_NPC_MASSIVE_JORMUNGAR) : 0); break; - case PHASE_FEROCIOUS_RHINO: pNext = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_NPC_FEROCIOUS_RHINO) : 0); break; - case PHASE_GORTOK_PALEHOOF: pNext = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_GORTOK_PALEHOOF) : 0); break; - default: break; - } - - if (pNext) - { - pNext->RemoveAurasDueToSpell(SPELL_FREEZE); - pNext->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_IMMUNE_TO_PC); - pNext->SetStandState(UNIT_STAND_STATE_STAND); - pNext->SetInCombatWithZone(); - pNext->Attack(pNext->SelectNearestTarget(100), true); - - } - currentPhase = PHASE_NONE; + case PHASE_FRENZIED_WORGEN: + nextBossId = DATA_FRENZIED_WORGEN; + break; + case PHASE_RAVENOUS_FURLBORG: + nextBossId = DATA_RAVENOUS_FURBOLG; + break; + case PHASE_MASSIVE_JORMUNGAR: + nextBossId = DATA_MASSIVE_JORMUNGAR; + break; + case PHASE_FEROCIOUS_RHINO: + nextBossId = DATA_FEROCIOUS_RHINO; + break; + case PHASE_GORTOK_PALEHOOF: + nextBossId = DATA_GORTOK_PALEHOOF; + break; + default: + return; } - } else SummonTimer -= diff; + + if (Creature* nextBoss = ObjectAccessor::GetCreature(*me, instance->GetData64(nextBossId))) + { + nextBoss->RemoveAurasDueToSpell(SPELL_FREEZE); + nextBoss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_IMMUNE_TO_PC); + nextBoss->SetStandState(UNIT_STAND_STATE_STAND); + nextBoss->SetInCombatWithZone(); + nextBoss->Attack(nextBoss->SelectNearestTarget(100), true); + } + currentPhase = PHASE_NONE; + + if (nextBossId == DATA_GORTOK_PALEHOOF) + me->DespawnOrUnsummon(); + } + else + SummonTimer -= diff; } void MovementInform(uint32 type, uint32 id) OVERRIDE { if (type != POINT_MOTION_TYPE) return; - if (id > 4) - return; - Creature* pNext = NULL; + + uint8 nextBossId = 0; switch (id) { - case PHASE_FRENZIED_WORGEN: pNext = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_NPC_FRENZIED_WORGEN) : 0); break; - case PHASE_RAVENOUS_FURLBORG: pNext = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_NPC_RAVENOUS_FURBOLG) : 0); break; - case PHASE_MASSIVE_JORMUNGAR: pNext = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_NPC_MASSIVE_JORMUNGAR) : 0); break; - case PHASE_FEROCIOUS_RHINO: pNext = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_NPC_FEROCIOUS_RHINO) : 0); break; - case PHASE_GORTOK_PALEHOOF: pNext = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_GORTOK_PALEHOOF) : 0); break; - default: break; + case PHASE_FRENZIED_WORGEN: + nextBossId = DATA_FRENZIED_WORGEN; + break; + case PHASE_RAVENOUS_FURLBORG: + nextBossId = DATA_RAVENOUS_FURBOLG; + break; + case PHASE_MASSIVE_JORMUNGAR: + nextBossId = DATA_MASSIVE_JORMUNGAR; + break; + case PHASE_FEROCIOUS_RHINO: + nextBossId = DATA_FEROCIOUS_RHINO; + break; + case PHASE_GORTOK_PALEHOOF: + nextBossId = DATA_GORTOK_PALEHOOF; + break; + default: + return; } - if (pNext) - DoCast(pNext, SPELL_ORB_CHANNEL, false); - currentPhase = (Phase)id; + + if (Creature* nextBoss = ObjectAccessor::GetCreature(*me, instance->GetData64(nextBossId))) + DoCast(nextBoss, SPELL_ORB_CHANNEL, false); + + currentPhase = Phase(id); SummonTimer = 5000; } }; @@ -821,23 +799,25 @@ public: class go_palehoof_sphere : public GameObjectScript { -public: - go_palehoof_sphere() : GameObjectScript("go_palehoof_sphere") { } - - bool OnGossipHello(Player* /*player*/, GameObject* go) OVERRIDE - { - InstanceScript* instance = go->GetInstanceScript(); + public: + go_palehoof_sphere() : GameObjectScript("go_palehoof_sphere") { } - Creature* pPalehoof = Unit::GetCreature(*go, instance ? instance->GetData64(DATA_GORTOK_PALEHOOF) : 0); - if (pPalehoof && pPalehoof->IsAlive()) + bool OnGossipHello(Player* /*player*/, GameObject* go) OVERRIDE { - go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - go->SetGoState(GO_STATE_ACTIVE); + InstanceScript* instance = go->GetInstanceScript(); + if (!instance) + return false; + + Creature* palehoof = ObjectAccessor::GetCreature(*go, instance->GetData64(DATA_GORTOK_PALEHOOF)); + if (palehoof && palehoof->IsAlive()) + { + go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + go->SetGoState(GO_STATE_ACTIVE); - CAST_AI(boss_palehoof::boss_palehoofAI, pPalehoof->AI())->NextPhase(); + palehoof->AI()->DoAction(ACTION_NEXT_PHASE); + } + return true; } - return true; - } }; diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp index 08670af939a..01fcd9a665d 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp @@ -210,7 +210,7 @@ public: me->SummonCreature(NPC_GRAUF, Location[0].GetPositionX(), Location[0].GetPositionY(), Location[0].GetPositionZ(), 3.0f); if (instance) { - instance->SetData(DATA_SKADI_THE_RUTHLESS_EVENT, NOT_STARTED); + instance->SetBossState(DATA_SKADI_THE_RUTHLESS, NOT_STARTED); instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); } } @@ -237,7 +237,7 @@ public: me->SetInCombatWithZone(); if (instance) { - instance->SetData(DATA_SKADI_THE_RUTHLESS_EVENT, IN_PROGRESS); + instance->SetBossState(DATA_SKADI_THE_RUTHLESS, IN_PROGRESS); instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); me->GetMotionMaster()->MoveJump(Location[0].GetPositionX(), Location[0].GetPositionY(), Location[0].GetPositionZ(), 5.0f, 10.0f); me->SetWalk(false); @@ -412,7 +412,7 @@ public: Talk(SAY_DEATH); Summons.DespawnAll(); if (instance) - instance->SetData(DATA_SKADI_THE_RUTHLESS_EVENT, DONE); + instance->SetBossState(DATA_SKADI_THE_RUTHLESS, DONE); } void KilledUnit(Unit* /*victim*/) OVERRIDE diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp index 818631788b6..f7e8d9ea7d6 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp @@ -74,7 +74,6 @@ enum Yells enum Creatures { NPC_ARTHAS = 29280, // Image of Arthas - NPC_SVALA_SORROWGRAVE = 26668, // Svala after transformation NPC_RITUAL_CHANNELER = 27281, NPC_SPECTATOR = 26667, NPC_RITUAL_TARGET = 27327, @@ -82,258 +81,238 @@ enum Creatures NPC_SCOURGE_HULK = 26555 }; -enum GameObjects +enum Phases { - GO_UTGARDE_MIRROR = 191745 -}; - -enum SvalaPhase -{ - IDLE, + IDLE = 1, INTRO, NORMAL, SACRIFICING, SVALADEAD }; +enum Events +{ + //INTRO + EVENT_INTRO_SVALA_TALK_0 = 1, + EVENT_INTRO_ARTHAS_TALK_0, + EVENT_INTRO_TRANSFORM_0, + EVENT_INTRO_TRANSFORM_1, + EVENT_INTRO_TRANSFORM_2, + EVENT_INTRO_SVALA_TALK_1, + EVENT_INTRO_ARTHAS_TALK_1, + EVENT_INTRO_SVALA_TALK_2, + EVENT_INTRO_RELOCATE_SVALA, + EVENT_INTRO_DESPAWN_ARTHAS, + + //NORMAL + EVENT_SINISTER_STRIKE, + EVENT_CALL_FLAMES, + EVENT_RITUAL_PREPARATION, + + //SACRIFICING + EVENT_SPAWN_RITUAL_CHANNELERS, + EVENT_RITUAL_STRIKE, + EVENT_RITUAL_DISARM +}; + enum Misc { DATA_INCREDIBLE_HULK = 2043 }; -static const float spectatorWP[2][3] = +Position const spectatorWP[2] = { - {296.95f, -312.76f, 86.36f}, - {297.69f, -275.81f, 86.36f} + {296.95f, -312.76f, 86.36f, 0.0f }, + {297.69f, -275.81f, 86.36f, 0.0f } }; -static Position ArthasPos = { 295.81f, -366.16f, 92.57f, 1.58f }; +Position const ArthasPos = { 295.81f, -366.16f, 92.57f, 1.58f }; class boss_svala : public CreatureScript { -public: - boss_svala() : CreatureScript("boss_svala") { } - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new boss_svalaAI(creature); - } - - struct boss_svalaAI : public ScriptedAI - { - boss_svalaAI(Creature* creature) : ScriptedAI(creature), summons(creature) - { - instance = creature->GetInstanceScript(); - Phase = IDLE; - - me->ApplySpellImmune(0, IMMUNITY_ID, SPELL_RITUAL_STRIKE_EFF_1, true); - me->ApplySpellImmune(0, IMMUNITY_ID, SPELL_RITUAL_STRIKE_EFF_2, true); - } - - InstanceScript* instance; - SummonList summons; - SvalaPhase Phase; - - Position pos; - float x, y, z; - - uint32 introTimer; - uint8 introPhase; - uint8 sacrePhase; - - TempSummon* arthas; - uint64 arthasGUID; - - uint32 sinsterStrikeTimer; - uint32 callFlamesTimer; - uint32 sacrificeTimer; - - bool sacrificed; + public: + boss_svala() : CreatureScript("boss_svala") { } - void Reset() OVERRIDE + struct boss_svalaAI : public BossAI { - sacrificed = false; - SetCombatMovement(true); + boss_svalaAI(Creature* creature) : BossAI(creature, DATA_SVALA_SORROWGRAVE) + { + _introCompleted = false; + } - summons.DespawnAll(); - me->RemoveAllAuras(); + void Reset() OVERRIDE + { + _Reset(); + _sacrificed = false; + SetCombatMovement(true); - if (Phase > NORMAL) - Phase = NORMAL; + if (_introCompleted) + events.SetPhase(NORMAL); + else + events.SetPhase(IDLE); - me->SetDisableGravity(Phase == NORMAL); + me->SetDisableGravity(events.IsInPhase(NORMAL)); - introTimer = 1 * IN_MILLISECONDS; - introPhase = 0; - arthasGUID = 0; + _arthasGUID = 0; - if (instance) - { - instance->SetData(DATA_SVALA_SORROWGRAVE_EVENT, NOT_STARTED); instance->SetData64(DATA_SACRIFICED_PLAYER, 0); } - } - void EnterCombat(Unit* /*who*/) OVERRIDE - { - Talk(SAY_AGGRO); - - sinsterStrikeTimer = 7 * IN_MILLISECONDS; - callFlamesTimer = urand(10 * IN_MILLISECONDS, 20 * IN_MILLISECONDS); - - if (instance) - instance->SetData(DATA_SVALA_SORROWGRAVE_EVENT, IN_PROGRESS); - } + void EnterCombat(Unit* /*who*/) OVERRIDE + { + _EnterCombat(); + Talk(SAY_AGGRO); + } - void JustSummoned(Creature* summon) OVERRIDE - { - if (summon->GetEntry() == NPC_RITUAL_CHANNELER) - summon->CastSpell(summon, SPELL_SUMMONED_VIS, true); + void JustSummoned(Creature* summon) OVERRIDE + { + if (summon->GetEntry() == NPC_RITUAL_CHANNELER) + summon->CastSpell(summon, SPELL_SUMMONED_VIS, true); + summons.Summon(summon); + } - summons.Summon(summon); - } + void MoveInLineOfSight(Unit* who) OVERRIDE + { + if (!who) + return; - void SummonedCreatureDespawn(Creature* summon) OVERRIDE - { - summons.Despawn(summon); - } + if (events.IsInPhase(IDLE) && me->IsValidAttackTarget(who) && me->IsWithinDistInMap(who, 40)) + { + events.SetPhase(INTRO); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - void MoveInLineOfSight(Unit* who) OVERRIDE + if (GameObject* mirror = ObjectAccessor::GetGameObject(*me, DATA_UTGARDE_MIRROR)) + mirror->SetGoState(GO_STATE_READY); - { - if (!who) - return; + if (Creature* arthas = me->SummonCreature(NPC_ARTHAS, ArthasPos, TEMPSUMMON_MANUAL_DESPAWN)) + { + arthas->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + _arthasGUID = arthas->GetGUID(); + } + events.ScheduleEvent(EVENT_INTRO_SVALA_TALK_0, 1 * IN_MILLISECONDS, 0, INTRO); + } + } - if (Phase == IDLE && me->IsValidAttackTarget(who) && me->IsWithinDistInMap(who, 40)) + void KilledUnit(Unit* who) OVERRIDE { - Phase = INTRO; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if (who->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_SLAY); + } - if (GameObject* mirror = GetClosestGameObjectWithEntry(me, GO_UTGARDE_MIRROR, 100.0f)) - mirror->SetGoState(GO_STATE_READY); + void JustDied(Unit* /*killer*/) OVERRIDE + { + if (events.IsInPhase(SACRIFICING)) + SetEquipmentSlots(false, EQUIP_UNEQUIP, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); + me->HandleEmoteCommand(EMOTE_ONESHOT_FLYDEATH); + _JustDied(); + Talk(SAY_DEATH); + } - if (Creature* arthas = me->SummonCreature(NPC_ARTHAS, ArthasPos, TEMPSUMMON_MANUAL_DESPAWN)) + void SpellHitTarget(Unit* /*target*/, SpellInfo const* spellInfo) OVERRIDE + { + if (spellInfo->Id == SPELL_RITUAL_STRIKE_EFF_1 && !events.IsInPhase(NORMAL) && !events.IsInPhase(SVALADEAD)) { - arthas->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - arthasGUID = arthas->GetGUID(); + events.SetPhase(NORMAL); + events.ScheduleEvent(EVENT_SINISTER_STRIKE, 7 * IN_MILLISECONDS, 0, NORMAL); + events.ScheduleEvent(EVENT_CALL_FLAMES, urand(10 * IN_MILLISECONDS, 20 * IN_MILLISECONDS), 0, NORMAL); + SetCombatMovement(true); + + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 300.0f, true)) + me->GetMotionMaster()->MoveChase(target); } } - } - - void KilledUnit(Unit* victim) OVERRIDE - { - if (victim != me) - Talk(SAY_SLAY); - } - - void JustDied(Unit* /*killer*/) OVERRIDE - { - if (Phase == SACRIFICING) - SetEquipmentSlots(false, EQUIP_UNEQUIP, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE); - - me->HandleEmoteCommand(EMOTE_ONESHOT_FLYDEATH); - - summons.DespawnAll(); - - if (instance) - instance->SetData(DATA_SVALA_SORROWGRAVE_EVENT, DONE); - - Talk(SAY_DEATH); - } - void SpellHitTarget(Unit* /*target*/, const SpellInfo* spell) OVERRIDE - { - if (spell->Id == SPELL_RITUAL_STRIKE_EFF_1 && Phase != NORMAL && Phase != SVALADEAD) + void UpdateAI(uint32 diff) OVERRIDE { - Phase = NORMAL; - SetCombatMovement(true); + if (events.IsInPhase(IDLE)) + return; - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 300.0f, true)) - me->GetMotionMaster()->MoveChase(target); - } - } + if (events.IsInPhase(NORMAL) && !UpdateVictim()) + return; - void UpdateAI(uint32 diff) OVERRIDE - { - if (Phase == IDLE) - return; + events.Update(diff); - if (Phase == INTRO) - { - if (introTimer <= diff) + if (!_sacrificed && HealthBelowPct(50)) { - Creature* arthas = Unit::GetCreature(*me, arthasGUID); - if (!arthas) - return; + _sacrificed = true; + events.SetPhase(SACRIFICING); + events.ScheduleEvent(EVENT_RITUAL_PREPARATION, 0, 0, SACRIFICING); + } + + if (events.IsInPhase(NORMAL)) + DoMeleeAttackIfReady(); - switch (introPhase) + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) { - case 0: + case EVENT_INTRO_SVALA_TALK_0: Talk(SAY_SVALA_INTRO_0); - ++introPhase; - introTimer = 8100; + events.ScheduleEvent(EVENT_INTRO_ARTHAS_TALK_0, 8.1 * IN_MILLISECONDS, 0, INTRO); break; - case 1: - arthas->AI()->Talk(SAY_DIALOG_OF_ARTHAS_1); - ++introPhase; - introTimer = 10000; + case EVENT_INTRO_ARTHAS_TALK_0: + if (Creature* arthas = ObjectAccessor::GetCreature(*me, _arthasGUID)) + arthas->AI()->Talk(SAY_DIALOG_OF_ARTHAS_1); + events.ScheduleEvent(EVENT_INTRO_TRANSFORM_0, 10 * IN_MILLISECONDS, 0, INTRO); break; - case 2: - arthas->CastSpell(me, SPELL_TRANSFORMING_CHANNEL, false); + case EVENT_INTRO_TRANSFORM_0: + { + if (Creature* arthas = ObjectAccessor::GetCreature(*me, _arthasGUID)) + arthas->CastSpell(me, SPELL_TRANSFORMING_CHANNEL, false); + Position pos; pos.Relocate(me); pos.m_positionZ += 8.0f; me->GetMotionMaster()->MoveTakeoff(0, pos); // spectators flee event - if (instance) + std::list<Creature*> lspectatorList; + GetCreatureListWithEntryInGrid(lspectatorList, me, NPC_SPECTATOR, 100.0f); + for (std::list<Creature*>::iterator itr = lspectatorList.begin(); itr != lspectatorList.end(); ++itr) { - std::list<Creature*> lspectatorList; - GetCreatureListWithEntryInGrid(lspectatorList, me, NPC_SPECTATOR, 100.0f); - for (std::list<Creature*>::iterator itr = lspectatorList.begin(); itr != lspectatorList.end(); ++itr) + if ((*itr)->IsAlive()) { - if ((*itr)->IsAlive()) - { - (*itr)->SetStandState(UNIT_STAND_STATE_STAND); - (*itr)->SetWalk(false); - (*itr)->GetMotionMaster()->MovePoint(1, spectatorWP[0][0], spectatorWP[0][1], spectatorWP[0][2]); - } + (*itr)->SetStandState(UNIT_STAND_STATE_STAND); + (*itr)->SetWalk(false); + (*itr)->GetMotionMaster()->MovePoint(1, spectatorWP[0]); } } - ++introPhase; - introTimer = 4200; + events.ScheduleEvent(EVENT_INTRO_TRANSFORM_1, 4.2 * IN_MILLISECONDS, 0, INTRO); break; - case 3: + } + case EVENT_INTRO_TRANSFORM_1: me->CastSpell(me, SPELL_SVALA_TRANSFORMING1, false); - ++introPhase; - introTimer = 6200; + events.ScheduleEvent(EVENT_INTRO_TRANSFORM_2, 6.2 * IN_MILLISECONDS, 0, INTRO); break; - case 4: + case EVENT_INTRO_TRANSFORM_2: me->CastSpell(me, SPELL_SVALA_TRANSFORMING2, false); - arthas->InterruptNonMeleeSpells(true); + if (Creature* arthas = ObjectAccessor::GetCreature(*me, _arthasGUID)) + { + arthas->InterruptNonMeleeSpells(true); + me->SetFacingToObject(arthas); + } me->RemoveAllAuras(); me->UpdateEntry(NPC_SVALA_SORROWGRAVE); - me->SetFacingToObject(arthas); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - ++introPhase; - introTimer = 3200; + events.ScheduleEvent(EVENT_INTRO_SVALA_TALK_1, 10 * IN_MILLISECONDS, 0, INTRO); break; - case 5: + case EVENT_INTRO_SVALA_TALK_1: Talk(SAY_SVALA_INTRO_1); - ++introPhase; - introTimer = 10000; + events.ScheduleEvent(EVENT_INTRO_ARTHAS_TALK_1, 3.2 * IN_MILLISECONDS, 0, INTRO); break; - case 6: - arthas->AI()->Talk(SAY_DIALOG_OF_ARTHAS_2); - ++introPhase; - introTimer = 7200; + case EVENT_INTRO_ARTHAS_TALK_1: + if (Creature* arthas = ObjectAccessor::GetCreature(*me, _arthasGUID)) + arthas->AI()->Talk(SAY_DIALOG_OF_ARTHAS_2); + events.ScheduleEvent(EVENT_INTRO_SVALA_TALK_2, 7.2 * IN_MILLISECONDS, 0, INTRO); break; - case 7: + case EVENT_INTRO_SVALA_TALK_2: Talk(SAY_SVALA_INTRO_2); me->SetFacingTo(1.58f); - arthas->SetVisible(false); - ++introPhase; - introTimer = 13800; + if (Creature* arthas = ObjectAccessor::GetCreature(*me, _arthasGUID)) + arthas->SetVisible(false); + events.ScheduleEvent(EVENT_INTRO_RELOCATE_SVALA, 13.8 * IN_MILLISECONDS, 0, INTRO); break; - case 8: + case EVENT_INTRO_RELOCATE_SVALA: + { + Position pos; pos.Relocate(me); pos.m_positionX = me->GetHomePosition().GetPositionX(); pos.m_positionY = me->GetHomePosition().GetPositionY(); @@ -341,210 +320,165 @@ public: me->GetMotionMaster()->MoveLand(0, pos); me->SetDisableGravity(false, true); me->SetHover(true); - ++introPhase; - introTimer = 3000; + events.ScheduleEvent(EVENT_INTRO_DESPAWN_ARTHAS, 3 * IN_MILLISECONDS, 0, INTRO); break; - case 9: - if (GameObject* mirror = GetClosestGameObjectWithEntry(me, GO_UTGARDE_MIRROR, 100.0f)) + } + case EVENT_INTRO_DESPAWN_ARTHAS: + if (GameObject* mirror = ObjectAccessor::GetGameObject(*me, DATA_UTGARDE_MIRROR)) mirror->SetGoState(GO_STATE_ACTIVE); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - arthas->DespawnOrUnsummon(); - arthasGUID = 0; - Phase = NORMAL; + if (Creature* arthas = ObjectAccessor::GetCreature(*me, _arthasGUID)) + arthas->DespawnOrUnsummon(); + _arthasGUID = 0; + events.SetPhase(NORMAL); + _introCompleted = true; + events.ScheduleEvent(EVENT_SINISTER_STRIKE, 7 * IN_MILLISECONDS, 0, NORMAL); + events.ScheduleEvent(EVENT_CALL_FLAMES, urand(10 * IN_MILLISECONDS, 20 * IN_MILLISECONDS), 0, NORMAL); break; - } - } - else - introTimer -= diff; - - return; - } - - if (Phase == NORMAL) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (sinsterStrikeTimer <= diff) - { - DoCastVictim(SPELL_SINSTER_STRIKE); - sinsterStrikeTimer = urand(5 * IN_MILLISECONDS, 9 * IN_MILLISECONDS); - } - else - sinsterStrikeTimer -= diff; - - if (callFlamesTimer <= diff) - { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) - { - DoCast(target, SPELL_CALL_FLAMES); - callFlamesTimer = urand(10 * IN_MILLISECONDS, 20 * IN_MILLISECONDS); - } - } - else callFlamesTimer -= diff; - - if (!sacrificed) - { - if (HealthBelowPct(50)) - { - if (Unit* sacrificeTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 80.0f, true)) - { - if (instance) - instance->SetData64(DATA_SACRIFICED_PLAYER, sacrificeTarget->GetGUID()); - - Talk(SAY_SACRIFICE_PLAYER); - - DoCast(sacrificeTarget, SPELL_RITUAL_PREPARATION); - - SetCombatMovement(false); - - Phase = SACRIFICING; - sacrePhase = 0; - sacrificeTimer = 1 * IN_MILLISECONDS; - - DoCast(me, SPELL_RITUAL_OF_THE_SWORD); - sacrificed = true; - } - } - } - - DoMeleeAttackIfReady(); - } - else //SACRIFICING - { - if (sacrificeTimer <= diff) - { - switch (sacrePhase) - { - case 0: - // spawn ritual channelers - if (instance) + case EVENT_SINISTER_STRIKE: + DoCastVictim(SPELL_SINSTER_STRIKE); + events.ScheduleEvent(EVENT_SINISTER_STRIKE, urand(5 * IN_MILLISECONDS, 9 * IN_MILLISECONDS), 0, NORMAL); + break; + case EVENT_CALL_FLAMES: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) + DoCast(target, SPELL_CALL_FLAMES); + events.ScheduleEvent(EVENT_CALL_FLAMES, urand(10 * IN_MILLISECONDS, 20 * IN_MILLISECONDS), 0, NORMAL); + break; + case EVENT_RITUAL_PREPARATION: + if (Unit* sacrificeTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 80.0f, true)) { - DoCast(me, SPELL_RITUAL_CHANNELER_1, true); - DoCast(me, SPELL_RITUAL_CHANNELER_2, true); - DoCast(me, SPELL_RITUAL_CHANNELER_3, true); + instance->SetData64(DATA_SACRIFICED_PLAYER, sacrificeTarget->GetGUID()); + Talk(SAY_SACRIFICE_PLAYER); + DoCast(sacrificeTarget, SPELL_RITUAL_PREPARATION); + SetCombatMovement(false); + DoCast(me, SPELL_RITUAL_OF_THE_SWORD); } - ++sacrePhase; - sacrificeTimer = 2 * IN_MILLISECONDS; + events.ScheduleEvent(EVENT_SPAWN_RITUAL_CHANNELERS, 1 * IN_MILLISECONDS, 0, SACRIFICING); break; - case 1: + case EVENT_SPAWN_RITUAL_CHANNELERS: + DoCast(me, SPELL_RITUAL_CHANNELER_1, true); + DoCast(me, SPELL_RITUAL_CHANNELER_2, true); + DoCast(me, SPELL_RITUAL_CHANNELER_3, true); + events.ScheduleEvent(EVENT_RITUAL_STRIKE, 2 * IN_MILLISECONDS, 0, SACRIFICING); + break; + case EVENT_RITUAL_STRIKE: me->StopMoving(); me->GetMotionMaster()->MoveIdle(); me->InterruptNonMeleeSpells(true); DoCast(me, SPELL_RITUAL_STRIKE_TRIGGER, true); - ++sacrePhase; - sacrificeTimer = 200; + events.ScheduleEvent(EVENT_RITUAL_DISARM, 200, 0, SACRIFICING); break; - case 2: + case EVENT_RITUAL_DISARM: DoCast(me, SPELL_RITUAL_DISARM); - ++sacrePhase; break; - case 3: + default: break; } } - else sacrificeTimer -= diff; } - } - }; + private: + uint64 _arthasGUID; + bool _sacrificed; + bool _introCompleted; + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return GetUtgardePinnacleAI<boss_svalaAI>(creature); + } }; class npc_ritual_channeler : public CreatureScript { -public: - npc_ritual_channeler() : CreatureScript("npc_ritual_channeler") { } - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_ritual_channelerAI(creature); - } + public: + npc_ritual_channeler() : CreatureScript("npc_ritual_channeler") { } - struct npc_ritual_channelerAI : public ScriptedAI - { - npc_ritual_channelerAI(Creature* creature) :ScriptedAI(creature) + struct npc_ritual_channelerAI : public ScriptedAI { - instance = creature->GetInstanceScript(); + npc_ritual_channelerAI(Creature* creature) : ScriptedAI(creature) + { + instance = creature->GetInstanceScript(); - SetCombatMovement(false); - } + SetCombatMovement(false); + } - InstanceScript* instance; - uint32 paralyzeTimer; + InstanceScript* instance; + uint32 paralyzeTimer; + + void Reset() OVERRIDE + { + paralyzeTimer = 1600; - void Reset() OVERRIDE - { - paralyzeTimer = 1600; - if (instance) if (IsHeroic()) DoCast(me, SPELL_SHADOWS_IN_THE_DARK); - } - - void UpdateAI(uint32 diff) OVERRIDE - { - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + } - if (paralyzeTimer <= diff) + void UpdateAI(uint32 diff) OVERRIDE { - if (instance) - if (Unit* victim = me->GetUnit(*me, instance->GetData64(DATA_SACRIFICED_PLAYER))) + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + if (paralyzeTimer <= diff) + { + if (Unit* victim = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_SACRIFICED_PLAYER))) DoCast(victim, SPELL_PARALYZE, false); - paralyzeTimer = 200; + paralyzeTimer = 200; + } + else + paralyzeTimer -= diff; } - else - paralyzeTimer -= diff; + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return GetUtgardePinnacleAI<npc_ritual_channelerAI>(creature); } - }; }; class npc_spectator : public CreatureScript { -public: - npc_spectator() : CreatureScript("npc_spectator") { } - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_spectatorAI(creature); - } + public: + npc_spectator() : CreatureScript("npc_spectator") { } - struct npc_spectatorAI : public ScriptedAI - { - npc_spectatorAI(Creature* creature) : ScriptedAI(creature) { } + struct npc_spectatorAI : public ScriptedAI + { + npc_spectatorAI(Creature* creature) : ScriptedAI(creature) { } - void Reset() OVERRIDE { } + void Reset() OVERRIDE { } - void MovementInform(uint32 motionType, uint32 pointId) OVERRIDE - { - if (motionType == POINT_MOTION_TYPE) + void MovementInform(uint32 motionType, uint32 pointId) OVERRIDE { - if (pointId == 1) - me->GetMotionMaster()->MovePoint(2, spectatorWP[1][0], spectatorWP[1][1], spectatorWP[1][2]); - else if (pointId == 2) - me->DespawnOrUnsummon(1000); + if (motionType == POINT_MOTION_TYPE) + { + if (pointId == 1) + me->GetMotionMaster()->MovePoint(2, spectatorWP[1]); + else if (pointId == 2) + me->DespawnOrUnsummon(1000); + } } + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return GetUtgardePinnacleAI<npc_spectatorAI>(creature); } - }; }; class RitualTargetCheck { public: - explicit RitualTargetCheck(Unit* _caster) : caster(_caster) { } + explicit RitualTargetCheck() { } - bool operator() (WorldObject* unit) const + bool operator() (WorldObject* obj) const { - if (InstanceScript* instance = caster->GetInstanceScript()) - if (instance->GetData64(DATA_SACRIFICED_PLAYER) == unit->GetGUID()) + if (InstanceScript* instance = obj->GetInstanceScript()) + if (instance->GetData64(DATA_SACRIFICED_PLAYER) == obj->GetGUID()) return false; return true; } - - private: - Unit* caster; }; class spell_paralyze_pinnacle : public SpellScriptLoader @@ -558,7 +492,7 @@ class spell_paralyze_pinnacle : public SpellScriptLoader void FilterTargets(std::list<WorldObject*>& unitList) { - unitList.remove_if(RitualTargetCheck(GetCaster())); + unitList.remove_if(RitualTargetCheck()); } void Register() OVERRIDE @@ -635,7 +569,7 @@ class npc_scourge_hulk : public CreatureScript CreatureAI* GetAI(Creature* creature) const OVERRIDE { - return new npc_scourge_hulkAI(creature); + return GetUtgardePinnacleAI<npc_scourge_hulkAI>(creature); } }; diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp index f592a4b2bb2..f4c306c726a 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp @@ -103,16 +103,10 @@ class boss_ymiron : public CreatureScript public: boss_ymiron() : CreatureScript("boss_ymiron") { } - CreatureAI* GetAI(Creature* creature) const OVERRIDE + struct boss_ymironAI : public BossAI { - return new boss_ymironAI(creature); - } - - struct boss_ymironAI : public ScriptedAI - { - boss_ymironAI(Creature* creature) : ScriptedAI(creature) + boss_ymironAI(Creature* creature) : BossAI(creature, DATA_KING_YMIRON) { - instance = creature->GetInstanceScript(); for (int i = 0; i < 4; ++i) m_uiActiveOrder[i] = i; for (int i = 0; i < 3; ++i) @@ -122,9 +116,6 @@ public: m_uiActiveOrder[i] = m_uiActiveOrder[r]; m_uiActiveOrder[r] = temp; } - - m_uiActivedCreatureGUID = 0; - m_uiOrbGUID = 0; } bool m_bIsWalking; @@ -155,10 +146,9 @@ public: uint64 m_uiActivedCreatureGUID; uint64 m_uiOrbGUID; - InstanceScript* instance; - void Reset() OVERRIDE { + _Reset(); m_bIsWalking = false; m_bIsPause = false; m_bIsActiveWithBJORN = false; @@ -182,19 +172,14 @@ public: m_uiHealthAmountModifier = 1; m_uiHealthAmountMultipler = DUNGEON_MODE(20, 25); - DespawnBoatGhosts(m_uiActivedCreatureGUID); - DespawnBoatGhosts(m_uiOrbGUID); - - if (instance) - instance->SetData(DATA_KING_YMIRON_EVENT, NOT_STARTED); + m_uiActivedCreatureGUID = 0; + m_uiOrbGUID = 0; } void EnterCombat(Unit* /*who*/) OVERRIDE { + _EnterCombat(); Talk(SAY_AGGRO); - - if (instance) - instance->SetData(DATA_KING_YMIRON_EVENT, IN_PROGRESS); } void SpellHitTarget(Unit* who, SpellInfo const* spell) OVERRIDE @@ -371,21 +356,17 @@ public: void JustDied(Unit* /*killer*/) OVERRIDE { + _JustDied(); Talk(SAY_DEATH); - - DespawnBoatGhosts(m_uiActivedCreatureGUID); - DespawnBoatGhosts(m_uiOrbGUID); - - if (instance) - instance->SetData(DATA_KING_YMIRON_EVENT, DONE); } - void KilledUnit(Unit* /*victim*/) OVERRIDE + void KilledUnit(Unit* who) OVERRIDE { - Talk(SAY_SLAY); + if (who->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_SLAY); } - void DespawnBoatGhosts(uint64 m_uiCreatureGUID) + void DespawnBoatGhosts(uint64& m_uiCreatureGUID) { if (m_uiCreatureGUID) if (Creature* temp = Unit::GetCreature(*me, m_uiCreatureGUID)) @@ -395,14 +376,16 @@ public: } }; + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return GetUtgardePinnacleAI<boss_ymironAI>(creature); + } }; class achievement_kings_bane : public AchievementCriteriaScript { public: - achievement_kings_bane() : AchievementCriteriaScript("achievement_kings_bane") - { - } + achievement_kings_bane() : AchievementCriteriaScript("achievement_kings_bane") { } bool OnCheck(Player* /*player*/, Unit* target) OVERRIDE { diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_utgarde_pinnacle.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_utgarde_pinnacle.cpp index 4959b3a6b58..46fabe41086 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_utgarde_pinnacle.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_utgarde_pinnacle.cpp @@ -19,246 +19,235 @@ #include "InstanceScript.h" #include "utgarde_pinnacle.h" -#define MAX_ENCOUNTER 4 - -/* Utgarde Pinnacle encounters: -0 - Svala Sorrowgrave -1 - Gortok Palehoof -2 - Skadi the Ruthless -3 - King Ymiron -*/ - -enum GameObjects +DoorData const doorData[] = { - ENTRY_SKADI_THE_RUTHLESS_DOOR = 192173, - ENTRY_KING_YMIRON_DOOR = 192174, - ENTRY_GORK_PALEHOOF_SPHERE = 188593 + { GO_SKADI_THE_RUTHLESS_DOOR, DATA_SKADI_THE_RUTHLESS, DOOR_TYPE_PASSAGE, BOUNDARY_W }, + { GO_KING_YMIRON_DOOR, DATA_KING_YMIRON, DOOR_TYPE_PASSAGE, BOUNDARY_N }, + { 0, 0, DOOR_TYPE_ROOM, BOUNDARY_NONE } // END }; class instance_utgarde_pinnacle : public InstanceMapScript { -public: - instance_utgarde_pinnacle() : InstanceMapScript("instance_utgarde_pinnacle", 575) { } - - InstanceScript* GetInstanceScript(InstanceMap* map) const OVERRIDE - { - return new instance_pinnacle(map); - } - - struct instance_pinnacle : public InstanceScript - { - instance_pinnacle(Map* map) : InstanceScript(map) { } - - uint64 uiSvalaSorrowgrave; - uint64 uiGortokPalehoof; - uint64 uiSkadiTheRuthless; - uint64 uiKingYmiron; - - uint64 uiSkadiTheRuthlessDoor; - uint64 uiKingYmironDoor; - uint64 uiGortokPalehoofSphere; + public: + instance_utgarde_pinnacle() : InstanceMapScript(UPScriptName, 575) { } - uint64 uiFrenziedWorgen; - uint64 uiRavenousFurbolg; - uint64 uiFerociousRhino; - uint64 uiMassiveJormungar; - uint64 uiPalehoofOrb; - - uint64 uiSvala; - uint64 uiSacrificedPlayer; - - uint32 m_auiEncounter[MAX_ENCOUNTER]; - - std::string str_data; - - void Initialize() OVERRIDE + struct instance_utgarde_pinnacle_InstanceMapScript : public InstanceScript { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - m_auiEncounter[i] = NOT_STARTED; - - uiSvalaSorrowgrave = 0; - uiGortokPalehoof = 0; - uiSkadiTheRuthless = 0; - uiKingYmiron = 0; - - uiSkadiTheRuthlessDoor = 0; - uiKingYmironDoor = 0; - uiGortokPalehoofSphere = 0; + instance_utgarde_pinnacle_InstanceMapScript(Map* map) : InstanceScript(map) + { + SetBossNumber(EncounterCount); + LoadDoorData(doorData); - uiFrenziedWorgen = 0; - uiRavenousFurbolg = 0; - uiFerociousRhino = 0; - uiMassiveJormungar = 0; - uiPalehoofOrb = 0; + SvalaSorrowgraveGUID = 0; + GortokPalehoofGUID = 0; + SkadiTheRuthlessGUID = 0; + KingYmironGUID = 0; - uiSvala = 0; - uiSacrificedPlayer = 0; - } + UtgardeMirrorGUID = 0; + GortokPalehoofSphereGUID = 0; - bool IsEncounterInProgress() const OVERRIDE - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - return true; + FrenziedWorgenGUID = 0; + RavenousFurbolgGUID = 0; + FerociousRhinoGUID = 0; + MassiveJormungarGUID = 0; + PalehoofOrbGUID = 0; - return false; - } + SvalaGUID = 0; + SacrificedPlayerGUID = 0; + } - void OnCreatureCreate(Creature* creature) OVERRIDE - { - switch (creature->GetEntry()) + void OnCreatureCreate(Creature* creature) OVERRIDE { - case BOSS_SVALA_SORROWGRAVE: uiSvalaSorrowgrave = creature->GetGUID(); break; - case BOSS_GORTOK_PALEHOOF: uiGortokPalehoof = creature->GetGUID(); break; - case BOSS_SKADI_RUTHLESS: uiSkadiTheRuthless = creature->GetGUID(); break; - case BOSS_KING_YMIRON: uiKingYmiron = creature->GetGUID(); break; - case NPC_FRENZIED_WORGEN: uiFrenziedWorgen = creature->GetGUID(); break; - case NPC_RAVENOUS_FURBOLG: uiRavenousFurbolg = creature->GetGUID(); break; - case NPC_MASSIVE_JORMUNGAR: uiMassiveJormungar = creature->GetGUID(); break; - case NPC_FEROCIOUS_RHINO: uiFerociousRhino = creature->GetGUID(); break; - case NPC_SVALA: uiSvala = creature->GetGUID(); break; - case NPC_PALEHOOF_ORB: uiPalehoofOrb = creature->GetGUID(); break; + switch (creature->GetEntry()) + { + case NPC_SVALA_SORROWGRAVE: + SvalaSorrowgraveGUID = creature->GetGUID(); + break; + case NPC_GORTOK_PALEHOOF: + GortokPalehoofGUID = creature->GetGUID(); + break; + case NPC_SKADI_THE_RUTHLESS: + SkadiTheRuthlessGUID = creature->GetGUID(); + break; + case NPC_KING_YMIRON: + KingYmironGUID = creature->GetGUID(); + break; + case NPC_FRENZIED_WORGEN: + FrenziedWorgenGUID = creature->GetGUID(); + break; + case NPC_RAVENOUS_FURBOLG: + RavenousFurbolgGUID = creature->GetGUID(); + break; + case NPC_MASSIVE_JORMUNGAR: + MassiveJormungarGUID = creature->GetGUID(); + break; + case NPC_FEROCIOUS_RHINO: + FerociousRhinoGUID = creature->GetGUID(); + break; + case NPC_SVALA: + SvalaGUID = creature->GetGUID(); + break; + case NPC_PALEHOOF_ORB: + PalehoofOrbGUID = creature->GetGUID(); + break; + default: + break; + } } - } - void OnGameObjectCreate(GameObject* go) OVERRIDE - { - switch (go->GetEntry()) + void OnGameObjectCreate(GameObject* go) OVERRIDE { - case ENTRY_SKADI_THE_RUTHLESS_DOOR: - uiSkadiTheRuthlessDoor = go->GetGUID(); - if (m_auiEncounter[2] == DONE) HandleGameObject(0, true, go); - break; - case ENTRY_KING_YMIRON_DOOR: - uiKingYmironDoor = go->GetGUID(); - if (m_auiEncounter[3] == DONE) HandleGameObject(0, true, go); - break; - case ENTRY_GORK_PALEHOOF_SPHERE: - uiGortokPalehoofSphere = go->GetGUID(); - if (m_auiEncounter[1] == DONE) - { - HandleGameObject(0, true, go); - go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - } - break; + switch (go->GetEntry()) + { + case GO_UTGARDE_MIRROR: + UtgardeMirrorGUID = go->GetGUID(); + break; + case GO_GORTOK_PALEHOOF_SPHERE: + GortokPalehoofSphereGUID = go->GetGUID(); + if (GetBossState(DATA_GORTOK_PALEHOOF) == DONE) + { + HandleGameObject(0, true, go); + go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + } + break; + case GO_SKADI_THE_RUTHLESS_DOOR: + case GO_KING_YMIRON_DOOR: + AddDoor(go, true); + break; + default: + break; + } } - } - void SetData(uint32 type, uint32 data) OVERRIDE - { - switch (type) + void OnGameObjectRemove(GameObject* go) OVERRIDE { - case DATA_SVALA_SORROWGRAVE_EVENT: - m_auiEncounter[0] = data; - break; - case DATA_GORTOK_PALEHOOF_EVENT: - m_auiEncounter[1] = data; - break; - case DATA_SKADI_THE_RUTHLESS_EVENT: - if (data == DONE) - HandleGameObject(uiSkadiTheRuthlessDoor, true); - m_auiEncounter[2] = data; - break; - case DATA_KING_YMIRON_EVENT: - if (data == DONE) - HandleGameObject(uiKingYmironDoor, true); - m_auiEncounter[3] = data; - break; + switch (go->GetEntry()) + { + case GO_SKADI_THE_RUTHLESS_DOOR: + case GO_KING_YMIRON_DOOR: + AddDoor(go, false); + break; + default: + break; + } } - if (data == DONE) - SaveToDB(); - } - - void SetData64(uint32 type, uint64 data) OVERRIDE - { - switch (type) + void SetData64(uint32 type, uint64 data) OVERRIDE { - case DATA_SACRIFICED_PLAYER: - uiSacrificedPlayer = data; - break; + switch (type) + { + case DATA_SACRIFICED_PLAYER: + SacrificedPlayerGUID = data; + break; + default: + break; + } } - } - uint32 GetData(uint32 type) const OVERRIDE - { - switch (type) + uint64 GetData64(uint32 type) const OVERRIDE { - case DATA_SVALA_SORROWGRAVE_EVENT: return m_auiEncounter[0]; - case DATA_GORTOK_PALEHOOF_EVENT: return m_auiEncounter[1]; - case DATA_SKADI_THE_RUTHLESS_EVENT: return m_auiEncounter[2]; - case DATA_KING_YMIRON_EVENT: return m_auiEncounter[3]; + switch (type) + { + case DATA_SVALA_SORROWGRAVE: + return SvalaSorrowgraveGUID; + case DATA_GORTOK_PALEHOOF: + return GortokPalehoofGUID; + case DATA_SKADI_THE_RUTHLESS: + return SkadiTheRuthlessGUID; + case DATA_KING_YMIRON: + return KingYmironGUID; + case DATA_FRENZIED_WORGEN: + return FrenziedWorgenGUID; + case DATA_RAVENOUS_FURBOLG: + return RavenousFurbolgGUID; + case DATA_MASSIVE_JORMUNGAR: + return MassiveJormungarGUID; + case DATA_FEROCIOUS_RHINO: + return FerociousRhinoGUID; + case DATA_GORTOK_ORB: + return PalehoofOrbGUID; + case DATA_GORTOK_PALEHOOF_SPHERE: + return GortokPalehoofSphereGUID; + case DATA_UTGARDE_MIRROR: + return UtgardeMirrorGUID; + case DATA_SVALA: + return SvalaGUID; + case DATA_SACRIFICED_PLAYER: + return SacrificedPlayerGUID; + default: + break; + } + + return 0; } - return 0; - } - uint64 GetData64(uint32 identifier) const OVERRIDE - { - switch (identifier) + std::string GetSaveData() OVERRIDE { - case DATA_SVALA_SORROWGRAVE: return uiSvalaSorrowgrave; - case DATA_GORTOK_PALEHOOF: return uiGortokPalehoof; - case DATA_SKADI_THE_RUTHLESS: return uiSkadiTheRuthless; - case DATA_KING_YMIRON: return uiKingYmiron; - case DATA_NPC_FRENZIED_WORGEN: return uiFrenziedWorgen; - case DATA_NPC_RAVENOUS_FURBOLG: return uiRavenousFurbolg; - case DATA_NPC_MASSIVE_JORMUNGAR: return uiMassiveJormungar; - case DATA_NPC_FEROCIOUS_RHINO: return uiFerociousRhino; - case DATA_NPC_ORB: return uiPalehoofOrb; - case DATA_SVALA: return uiSvala; - case DATA_GORTOK_PALEHOOF_SPHERE: return uiGortokPalehoofSphere; - case DATA_SACRIFICED_PLAYER: return uiSacrificedPlayer; + OUT_SAVE_INST_DATA; + + std::ostringstream saveStream; + saveStream << "U P " << GetBossSaveData(); + + OUT_SAVE_INST_DATA_COMPLETE; + return saveStream.str(); } - return 0; - } + void Load(char const* str) OVERRIDE + { + if (!str) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - std::string GetSaveData() OVERRIDE - { - OUT_SAVE_INST_DATA; + OUT_LOAD_INST_DATA(str); - std::ostringstream saveStream; - saveStream << "U P " << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' - << m_auiEncounter[2] << ' ' << m_auiEncounter[3]; + char dataHead1, dataHead2; - str_data = saveStream.str(); + std::istringstream loadStream(str); + loadStream >> dataHead1 >> dataHead2; - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; - } + if (dataHead1 == 'U' && dataHead2 == 'P') + { + for (uint32 i = 0; i < EncounterCount; ++i) + { + uint32 tmpState; + loadStream >> tmpState; + if (tmpState == IN_PROGRESS || tmpState > SPECIAL) + tmpState = NOT_STARTED; + SetBossState(i, EncounterState(tmpState)); + } + } + else + OUT_LOAD_INST_DATA_FAIL; - void Load(const char* in) OVERRIDE - { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; + OUT_LOAD_INST_DATA_COMPLETE; } - OUT_LOAD_INST_DATA(in); + protected: + uint64 SvalaSorrowgraveGUID; + uint64 GortokPalehoofGUID; + uint64 SkadiTheRuthlessGUID; + uint64 KingYmironGUID; - char dataHead1, dataHead2; - uint16 data0, data1, data2, data3; + uint64 UtgardeMirrorGUID; + uint64 GortokPalehoofSphereGUID; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3; + uint64 FrenziedWorgenGUID; + uint64 RavenousFurbolgGUID; + uint64 FerociousRhinoGUID; + uint64 MassiveJormungarGUID; - if (dataHead1 == 'U' && dataHead2 == 'P') - { - m_auiEncounter[0] = data0; - m_auiEncounter[1] = data1; - m_auiEncounter[2] = data2; - m_auiEncounter[3] = data3; + uint64 PalehoofOrbGUID; - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; + uint64 SvalaGUID; + uint64 SacrificedPlayerGUID; + }; - } else OUT_LOAD_INST_DATA_FAIL; - - OUT_LOAD_INST_DATA_COMPLETE; + InstanceScript* GetInstanceScript(InstanceMap* map) const OVERRIDE + { + return new instance_utgarde_pinnacle_InstanceMapScript(map); } - }; }; void AddSC_instance_utgarde_pinnacle() diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/utgarde_pinnacle.h b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/utgarde_pinnacle.h index 6166b7c4891..ddf1d1e512a 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/utgarde_pinnacle.h +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/utgarde_pinnacle.h @@ -15,46 +15,64 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef DEF_PINNACLE_H -#define DEF_PINNACLE_H +#ifndef UTGARDE_PINNACLE_H_ +#define UTGARDE_PINNACLE_H_ -enum Data +#define UPScriptName "instance_utgarde_pinnacle" + +uint32 const EncounterCount = 4; + +enum DataTypes { - DATA_SVALA_SORROWGRAVE_EVENT, - DATA_GORTOK_PALEHOOF_EVENT, - DATA_SKADI_THE_RUTHLESS_EVENT, - DATA_KING_YMIRON_EVENT + // Encounter States/Boss GUIDs + DATA_SVALA_SORROWGRAVE = 0, + DATA_GORTOK_PALEHOOF = 1, + DATA_SKADI_THE_RUTHLESS = 2, + DATA_KING_YMIRON = 3, + + // Additional Data + DATA_UTGARDE_MIRROR = 4, + DATA_SVALA = 5, + DATA_SACRIFICED_PLAYER = 6, + + DATA_FRENZIED_WORGEN = 7, + DATA_RAVENOUS_FURBOLG = 8, + DATA_MASSIVE_JORMUNGAR = 9, + DATA_FEROCIOUS_RHINO = 10, + DATA_GORTOK_ORB = 11, + DATA_GORTOK_PALEHOOF_SPHERE = 12 }; -enum Data64 +enum CreatureIds { - DATA_SVALA, - DATA_SVALA_SORROWGRAVE, - DATA_GORTOK_PALEHOOF, - DATA_SKADI_THE_RUTHLESS, - DATA_NPC_GRAUF, - DATA_KING_YMIRON, - DATA_NPC_FRENZIED_WORGEN, - DATA_NPC_RAVENOUS_FURBOLG, - DATA_NPC_MASSIVE_JORMUNGAR, - DATA_NPC_FEROCIOUS_RHINO, - DATA_NPC_ORB, - DATA_GORTOK_PALEHOOF_SPHERE, - DATA_SACRIFICED_PLAYER + NPC_SVALA_SORROWGRAVE = 26668, + NPC_GORTOK_PALEHOOF = 26687, + NPC_SKADI_THE_RUTHLESS = 26693, + NPC_KING_YMIRON = 26861, + + // Svala + NPC_SVALA = 29281, + + // Gortok Palehoof + NPC_FRENZIED_WORGEN = 26683, + NPC_RAVENOUS_FURBOLG = 26684, + NPC_MASSIVE_JORMUNGAR = 26685, + NPC_FEROCIOUS_RHINO = 26686, + NPC_PALEHOOF_ORB = 26688 }; -enum CreatureID +enum GameObjectIds { - BOSS_SVALA_SORROWGRAVE = 26668, - BOSS_GORTOK_PALEHOOF = 26687, - BOSS_SKADI_RUTHLESS = 26693, - BOSS_KING_YMIRON = 26861, - NPC_FRENZIED_WORGEN = 26683, - NPC_RAVENOUS_FURBOLG = 26684, - NPC_MASSIVE_JORMUNGAR = 26685, - NPC_FEROCIOUS_RHINO = 26686, - NPC_SVALA = 29281, - NPC_PALEHOOF_ORB = 26688 + GO_GORTOK_PALEHOOF_SPHERE = 188593, + GO_UTGARDE_MIRROR = 191745, + GO_SKADI_THE_RUTHLESS_DOOR = 192173, + GO_KING_YMIRON_DOOR = 192174 }; -#endif +template<class AI> +AI* GetUtgardePinnacleAI(Creature* creature) +{ + return GetInstanceAI<AI>(creature, UPScriptName); +} + +#endif // UTGARDE_PINNACLE_H_ diff --git a/src/server/scripts/Northrend/zone_dalaran.cpp b/src/server/scripts/Northrend/zone_dalaran.cpp index 11f353b1cc2..083b4f879ee 100644 --- a/src/server/scripts/Northrend/zone_dalaran.cpp +++ b/src/server/scripts/Northrend/zone_dalaran.cpp @@ -64,11 +64,11 @@ public: creature->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, true); } - void Reset()OVERRIDE { } + void Reset() OVERRIDE { } - void EnterCombat(Unit* /*who*/)OVERRIDE { } + void EnterCombat(Unit* /*who*/) OVERRIDE { } - void AttackStart(Unit* /*who*/)OVERRIDE { } + void AttackStart(Unit* /*who*/) OVERRIDE { } void MoveInLineOfSight(Unit* who) OVERRIDE @@ -118,7 +118,7 @@ public: return; } - void UpdateAI(uint32 /*diff*/)OVERRIDE { } + void UpdateAI(uint32 /*diff*/) OVERRIDE { } }; CreatureAI* GetAI(Creature* creature) const OVERRIDE diff --git a/src/server/scripts/Northrend/zone_dragonblight.cpp b/src/server/scripts/Northrend/zone_dragonblight.cpp index 0357ea075f4..2c311e20a79 100644 --- a/src/server/scripts/Northrend/zone_dragonblight.cpp +++ b/src/server/scripts/Northrend/zone_dragonblight.cpp @@ -37,6 +37,331 @@ EndContentData */ #include "CombatAI.h" #include "Player.h" +/*##### +# npc_commander_eligor_dawnbringer +#####*/ + +enum CommanderEligorDawnbringer +{ + MODEL_IMAGE_OF_KELTHUZAD = 24787, // Image of Kel'Thuzad + MODEL_IMAGE_OF_SAPPHIRON = 24788, // Image of Sapphiron + MODEL_IMAGE_OF_RAZUVIOUS = 24799, // Image of Razuvious + MODEL_IMAGE_OF_GOTHIK = 24804, // Image of Gothik + MODEL_IMAGE_OF_THANE = 24802, // Image of Thane Korth'azz + MODEL_IMAGE_OF_BLAUMEUX = 24794, // Image of Lady Blaumeux + MODEL_IMAGE_OF_ZELIEK = 24800, // Image of Sir Zeliek + MODEL_IMAGE_OF_PATCHWERK = 24798, // Image of Patchwerk + MODEL_IMAGE_OF_GROBBULUS = 24792, // Image of Grobbulus + MODEL_IMAGE_OF_THADDIUS = 24801, // Image of Thaddius + MODEL_IMAGE_OF_GLUTH = 24803, // Image of Gluth + MODEL_IMAGE_OF_ANUBREKHAN = 24789, // Image of Anub'rekhan + MODEL_IMAGE_OF_FAERLINA = 24790, // Image of Faerlina + MODEL_IMAGE_OF_MAEXXNA = 24796, // Image of Maexxna + MODEL_IMAGE_OF_NOTH = 24797, // Image of Noth + MODEL_IMAGE_OF_HEIGAN = 24793, // Image of Heigan + MODEL_IMAGE_OF_LOATHEB = 24795, // Image of Loatheb + + NPC_IMAGE_OF_KELTHUZAD = 27766, // Image of Kel'Thuzad + NPC_IMAGE_OF_SAPPHIRON = 27767, // Image of Sapphiron + NPC_IMAGE_OF_RAZUVIOUS = 27768, // Image of Razuvious + NPC_IMAGE_OF_GOTHIK = 27769, // Image of Gothik + NPC_IMAGE_OF_THANE = 27770, // Image of Thane Korth'azz + NPC_IMAGE_OF_BLAUMEUX = 27771, // Image of Lady Blaumeux + NPC_IMAGE_OF_ZELIEK = 27772, // Image of Sir Zeliek + NPC_IMAGE_OF_PATCHWERK = 27773, // Image of Patchwerk + NPC_IMAGE_OF_GROBBULUS = 27774, // Image of Grobbulus + NPC_IMAGE_OF_THADDIUS = 27775, // Image of Thaddius + NPC_IMAGE_OF_GLUTH = 27782, // Image of Gluth + NPC_IMAGE_OF_ANUBREKHAN = 27776, // Image of Anub'rekhan + NPC_IMAGE_OF_FAERLINA = 27777, // Image of Faerlina + NPC_IMAGE_OF_MAEXXNA = 27778, // Image of Maexxna + NPC_IMAGE_OF_NOTH = 27779, // Image of Noth + NPC_IMAGE_OF_HEIGAN = 27780, // Image of Heigan + NPC_IMAGE_OF_LOATHEB = 27781, // Image of Loatheb + + NPC_INFANTRYMAN = 27160, // Add in case I randomize the spawning + NPC_SENTINAL = 27162, + NPC_BATTLE_MAGE = 27164, + + // Five platforms to choose from + SAY_PINNACLE = 0, + SAY_DEATH_KNIGHT_WING = 1, + SAY_ABOMINATION_WING = 2, + SAY_SPIDER_WING = 3, + SAY_PLAGUE_WING = 4, + // Used in all talks + SAY_TALK_COMPLETE = 5, + // Pinnacle of Naxxramas + SAY_SAPPHIRON = 6, + SAY_KELTHUZAD_1 = 7, + SAY_KELTHUZAD_2 = 8, + SAY_KELTHUZAD_3 = 9, + // Death knight wing of Naxxramas + SAY_RAZUVIOUS = 10, + SAY_GOTHIK = 11, + SAY_DEATH_KNIGHTS_1 = 12, + SAY_DEATH_KNIGHTS_2 = 13, + SAY_DEATH_KNIGHTS_3 = 14, + SAY_DEATH_KNIGHTS_4 = 15, + // Blighted abomination wing of Naxxramas + SAY_PATCHWERK = 16, + SAY_GROBBULUS = 17, + SAY_GLUTH = 18, + SAY_THADDIUS = 19, + // Accursed spider wing of Naxxramas + SAY_ANUBREKHAN = 20, + SAY_FAERLINA = 21, + SAY_MAEXXNA = 22, + // Dread plague wing of Naxxramas + SAY_NOTH = 23, + SAY_HEIGAN_1 = 24, + SAY_HEIGAN_2 = 25, + SAY_LOATHEB = 26, + + SPELL_HEROIC_IMAGE_CHANNEL = 49519, + + EVENT_START_RANDOM = 1, + EVENT_MOVE_TO_POINT = 2, + EVENT_TALK_COMPLETE = 3, + EVENT_GET_TARGETS = 4, + EVENT_KELTHUZAD_2 = 5, + EVENT_KELTHUZAD_3 = 6, + EVENT_DEATH_KNIGHTS_2 = 7, + EVENT_DEATH_KNIGHTS_3 = 8, + EVENT_DEATH_KNIGHTS_4 = 9, + EVENT_HEIGAN_2 = 10 +}; + +uint32 const AudienceMobs[3] = { NPC_INFANTRYMAN, NPC_SENTINAL, NPC_BATTLE_MAGE }; + +Position const PosTalkLocations[6] = +{ + { 3805.453f, -682.9075f, 222.2917f, 2.793398f }, // Pinnacle of Naxxramas + { 3807.508f, -691.0882f, 221.9688f, 2.094395f }, // Death knight wing of Naxxramas + { 3797.228f, -690.3555f, 222.5019f, 1.134464f }, // Blighted abomination wing of Naxxramas + { 3804.038f, -672.3098f, 222.5019f, 4.578917f }, // Accursed spider wing of Naxxramas + { 3815.097f, -680.2596f, 221.9777f, 2.86234f }, // Dread plague wing of Naxxramas + { 3798.05f, -680.611f, 222.9825f, 6.038839f }, // Home +}; + +class npc_commander_eligor_dawnbringer : public CreatureScript +{ + public: npc_commander_eligor_dawnbringer() : CreatureScript("npc_commander_eligor_dawnbringer") {} + + struct npc_commander_eligor_dawnbringerAI : public ScriptedAI + { + npc_commander_eligor_dawnbringerAI(Creature* creature) : ScriptedAI(creature) { } + + void Reset() OVERRIDE + { + talkWing = 0; + memset(audienceList, 0, sizeof(audienceList)); + memset(imageList, 0, sizeof(imageList)); + _events.ScheduleEvent(EVENT_GET_TARGETS, 5000); + _events.ScheduleEvent(EVENT_START_RANDOM, 20000); + } + + void MovementInform(uint32 type, uint32 id) OVERRIDE + { + if (type == POINT_MOTION_TYPE) + { + if (id == 1) + { + me->SetFacingTo(PosTalkLocations[talkWing].m_orientation); + TurnAudience(); + + switch (talkWing) + { + case 0: // Pinnacle of Naxxramas + { + switch (urand (0, 1)) + { + case 0: ChangeImage(NPC_IMAGE_OF_KELTHUZAD, MODEL_IMAGE_OF_KELTHUZAD, SAY_KELTHUZAD_1); + _events.ScheduleEvent(EVENT_KELTHUZAD_2, 8000); break; + case 1: ChangeImage(NPC_IMAGE_OF_SAPPHIRON, MODEL_IMAGE_OF_SAPPHIRON, SAY_SAPPHIRON); break; + } + } + break; + case 1: // Death knight wing of Naxxramas + { + switch (urand (0, 2)) + { + case 0: ChangeImage(NPC_IMAGE_OF_RAZUVIOUS, MODEL_IMAGE_OF_RAZUVIOUS, SAY_RAZUVIOUS); break; + case 1: ChangeImage(NPC_IMAGE_OF_GOTHIK, MODEL_IMAGE_OF_GOTHIK, SAY_GOTHIK); break; + case 2: ChangeImage(NPC_IMAGE_OF_THANE, MODEL_IMAGE_OF_THANE, SAY_DEATH_KNIGHTS_1); + _events.ScheduleEvent(EVENT_DEATH_KNIGHTS_2, 10000); break; + } + } + break; + case 2: // Blighted abomination wing of Naxxramas + { + switch (urand (0, 3)) + { + case 0: ChangeImage(NPC_IMAGE_OF_PATCHWERK, MODEL_IMAGE_OF_PATCHWERK, SAY_PATCHWERK); break; + case 1: ChangeImage(NPC_IMAGE_OF_GROBBULUS, MODEL_IMAGE_OF_GROBBULUS, SAY_GROBBULUS); break; + case 2: ChangeImage(NPC_IMAGE_OF_THADDIUS, MODEL_IMAGE_OF_THADDIUS, SAY_THADDIUS); break; + case 3: ChangeImage(NPC_IMAGE_OF_GLUTH, MODEL_IMAGE_OF_GLUTH, SAY_GLUTH); break; + } + } + break; + case 3: // Accursed spider wing of Naxxramas + { + switch (urand (0, 2)) + { + case 0: ChangeImage(NPC_IMAGE_OF_ANUBREKHAN, MODEL_IMAGE_OF_ANUBREKHAN, SAY_ANUBREKHAN); break; + case 1: ChangeImage(NPC_IMAGE_OF_FAERLINA, MODEL_IMAGE_OF_FAERLINA, SAY_FAERLINA); break; + case 2: ChangeImage(NPC_IMAGE_OF_MAEXXNA, MODEL_IMAGE_OF_MAEXXNA, SAY_MAEXXNA); break; + } + } + break; + case 4: // Dread plague wing of Naxxramas + { + switch (urand (0, 2)) + { + case 0: ChangeImage(NPC_IMAGE_OF_NOTH, MODEL_IMAGE_OF_NOTH, SAY_NOTH); break; + case 1: ChangeImage(NPC_IMAGE_OF_HEIGAN, MODEL_IMAGE_OF_HEIGAN, SAY_HEIGAN_1); + _events.ScheduleEvent(EVENT_HEIGAN_2, 8000); break; + case 2: ChangeImage(NPC_IMAGE_OF_LOATHEB, MODEL_IMAGE_OF_LOATHEB, SAY_LOATHEB); break; + } + } + break; + case 5: // Home + _events.ScheduleEvent(EVENT_START_RANDOM, 30000); + break; + } + } + } + } + + void StoreTargets() + { + uint8 creaturecount; + + creaturecount = 0; + + for (uint8 ii = 0; ii < 3; ++ii) + { + std::list<Creature*> creatureList; + GetCreatureListWithEntryInGrid(creatureList, me, AudienceMobs[ii], 15.0f); + for (std::list<Creature*>::iterator itr = creatureList.begin(); itr != creatureList.end(); ++itr) + { + if (Creature* creatureList = *itr) + { + audienceList[creaturecount] = creatureList->GetGUID(); + ++creaturecount; + } + } + } + + if (Creature* creature = me->FindNearestCreature(NPC_IMAGE_OF_KELTHUZAD, 20.0f, true)) + imageList[0] = creature->GetGUID(); + if (Creature* creature = me->FindNearestCreature(NPC_IMAGE_OF_RAZUVIOUS, 20.0f, true)) + imageList[1] = creature->GetGUID(); + if (Creature* creature = me->FindNearestCreature(NPC_IMAGE_OF_PATCHWERK, 20.0f, true)) + imageList[2] = creature->GetGUID(); + if (Creature* creature = me->FindNearestCreature(NPC_IMAGE_OF_ANUBREKHAN, 20.0f, true)) + imageList[3] = creature->GetGUID(); + if (Creature* creature = me->FindNearestCreature(NPC_IMAGE_OF_NOTH, 20.0f, true)) + imageList[4] = creature->GetGUID(); + } + + void ChangeImage(uint32 entry, uint32 model, uint8 text) + { + if (Creature* creature = ObjectAccessor::GetCreature(*me, imageList[talkWing])) + { + Talk(text); + creature->SetEntry(entry); + creature->SetDisplayId(model); + creature->CastSpell(creature, SPELL_HEROIC_IMAGE_CHANNEL); + _events.ScheduleEvent(EVENT_TALK_COMPLETE, 40000); + } + } + + void TurnAudience() + { + for (uint8 i = 0; i < 10; ++i) + { + if (Creature* creature = ObjectAccessor::GetCreature(*me, audienceList[i])) + creature->SetFacingToObject(me); + } + } + + void UpdateAI(uint32 diff) OVERRIDE + { + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_START_RANDOM: + talkWing = urand (0, 4); + Talk(talkWing); + _events.ScheduleEvent(EVENT_MOVE_TO_POINT, 8000); + break; + case EVENT_MOVE_TO_POINT: + me->SetWalk(true); + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MovePoint(1, PosTalkLocations[talkWing].m_positionX, PosTalkLocations[talkWing].m_positionY, PosTalkLocations[talkWing].m_positionZ); + break; + case EVENT_TALK_COMPLETE: + talkWing = 5; + Talk(talkWing); + _events.ScheduleEvent(EVENT_MOVE_TO_POINT, 5000); + break; + case EVENT_GET_TARGETS: + StoreTargets(); + break; + case EVENT_KELTHUZAD_2: + Talk(SAY_KELTHUZAD_2); + _events.ScheduleEvent(EVENT_KELTHUZAD_3, 8000); + break; + case EVENT_KELTHUZAD_3: + Talk(SAY_KELTHUZAD_3); + break; + case EVENT_DEATH_KNIGHTS_2: + Talk(SAY_DEATH_KNIGHTS_2); + if (Creature* creature = ObjectAccessor::GetCreature(*me, imageList[talkWing])) + { + creature->SetEntry(NPC_IMAGE_OF_BLAUMEUX); + creature->SetDisplayId(MODEL_IMAGE_OF_BLAUMEUX); + } + _events.ScheduleEvent(EVENT_DEATH_KNIGHTS_3, 10000); + break; + case EVENT_DEATH_KNIGHTS_3: + Talk(SAY_DEATH_KNIGHTS_3); + if (Creature* creature = ObjectAccessor::GetCreature(*me, imageList[talkWing])) + { + creature->SetEntry(NPC_IMAGE_OF_ZELIEK); + creature->SetDisplayId(MODEL_IMAGE_OF_ZELIEK); + } + _events.ScheduleEvent(EVENT_DEATH_KNIGHTS_4, 10000); + break; + case EVENT_DEATH_KNIGHTS_4: + Talk(SAY_DEATH_KNIGHTS_4); + break; + case EVENT_HEIGAN_2: + Talk(SAY_HEIGAN_2); + break; + default: + break; + } + } + DoMeleeAttackIfReady(); + } + private: + EventMap _events; + uint64 audienceList[10]; + uint64 imageList[5]; + uint8 talkWing; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new npc_commander_eligor_dawnbringerAI(creature); + } +}; + enum AlexstraszaWrGate { // Quest @@ -303,10 +628,112 @@ class npc_wyrmrest_defender : public CreatureScript } }; +/*##### +# npc_torturer_lecraft +#####*/ + +enum TorturerLeCraft +{ + SPELL_HEMORRHAGE = 30478, + SPELL_KIDNEY_SHOT = 30621, + SPELL_HIGH_EXECUTORS_BRANDING_IRON = 48603, + NPC_TORTURER_LECRAFT = 27394, + EVENT_HEMORRHAGE = 1, + EVENT_KIDNEY_SHOT = 2, + SAY_AGGRO = 0 +}; + +class npc_torturer_lecraft : public CreatureScript +{ + public: npc_torturer_lecraft() : CreatureScript("npc_torturer_lecraft") {} + + struct npc_torturer_lecraftAI : public ScriptedAI + { + npc_torturer_lecraftAI(Creature* creature) : ScriptedAI(creature) { } + + void Reset() OVERRIDE + { + _textCounter = 1; + _playerGUID = 0; + } + + void EnterCombat(Unit* who) OVERRIDE + { + _events.ScheduleEvent(EVENT_HEMORRHAGE, urand(5000, 8000)); + _events.ScheduleEvent(EVENT_KIDNEY_SHOT, urand(12000, 15000)); + + if (Player* player = who->ToPlayer()) + Talk (SAY_AGGRO, player->GetGUID()); + } + + void SpellHit(Unit* caster, const SpellInfo* spell) OVERRIDE + { + if (spell->Id != SPELL_HIGH_EXECUTORS_BRANDING_IRON) + return; + + if (Player* player = caster->ToPlayer()) + { + if (_textCounter == 1) + _playerGUID = player->GetGUID(); + + if (_playerGUID != player->GetGUID()) + return; + + Talk(_textCounter, player->GetGUID()); + + if (_textCounter == 5) + player->KilledMonsterCredit(NPC_TORTURER_LECRAFT, 0); + + ++_textCounter; + + if (_textCounter == 13) + _textCounter = 6; + } + } + + void UpdateAI(uint32 diff) OVERRIDE + { + if (!UpdateVictim()) + return; + + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_HEMORRHAGE: + DoCastVictim(SPELL_HEMORRHAGE); + _events.ScheduleEvent(EVENT_HEMORRHAGE, urand(12000, 168000)); + break; + case EVENT_KIDNEY_SHOT: + DoCastVictim(SPELL_KIDNEY_SHOT); + _events.ScheduleEvent(EVENT_KIDNEY_SHOT, urand(20000, 26000)); + break; + default: + break; + } + } + DoMeleeAttackIfReady(); + } + private: + EventMap _events; + uint8 _textCounter; + uint64 _playerGUID; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new npc_torturer_lecraftAI(creature); + } +}; + void AddSC_dragonblight() { - new npc_alexstrasza_wr_gate; - new spell_q12096_q12092_dummy; - new spell_q12096_q12092_bark; - new npc_wyrmrest_defender; + new npc_commander_eligor_dawnbringer(); + new npc_alexstrasza_wr_gate(); + new spell_q12096_q12092_dummy(); + new spell_q12096_q12092_bark(); + new npc_wyrmrest_defender(); + new npc_torturer_lecraft(); } diff --git a/src/server/scripts/Northrend/zone_grizzly_hills.cpp b/src/server/scripts/Northrend/zone_grizzly_hills.cpp index 6bf791417ab..6587f0536b3 100644 --- a/src/server/scripts/Northrend/zone_grizzly_hills.cpp +++ b/src/server/scripts/Northrend/zone_grizzly_hills.cpp @@ -20,7 +20,9 @@ #include "ScriptedCreature.h" #include "ScriptedEscortAI.h" #include "Player.h" +#include "Spell.h" #include "SpellInfo.h" +#include "SpellScript.h" #include "CreatureTextMgr.h" /*###### @@ -508,87 +510,6 @@ public: } }; -/*Lightning Sentry - if you kill it when you have your Minion with you, you will get a quest credit*/ -enum Sentry -{ - //Creature - NPC_LIGHTNING_SENTRY = 26407, - NPC_WAR_GOLEM = 27017, - // Quest - QUEST_OR_MAYBE_WE_DONT_A = 12138, - QUEST_OR_MAYBE_WE_DONT_H = 12198, - // Spell - SPELL_CHARGED_SENTRY_TOTEM = 52703, - SPELL_WAR_GOLEM_CHARGE_CREDIT = 47797, -}; - -enum SentryEvents -{ - EVENT_SENTRY = 1 -}; - -class npc_lightning_sentry : public CreatureScript -{ -public: - npc_lightning_sentry() : CreatureScript("npc_lightning_sentry") { } - - struct npc_lightning_sentryAI : public ScriptedAI - { - npc_lightning_sentryAI(Creature* creature) : ScriptedAI(creature) { } - - void Reset() OVERRIDE - { - _events.ScheduleEvent(EVENT_SENTRY, urand(10000, 12000)); - } - - void UpdateAI(uint32 diff) OVERRIDE - { - if (!UpdateVictim()) - return; - - _events.Update(diff); - - while (uint32 eventId = _events.ExecuteEvent()) - { - switch (eventId) - { - case EVENT_SENTRY: - DoCast(SPELL_CHARGED_SENTRY_TOTEM); - _events.ScheduleEvent(EVENT_SENTRY, urand(10000, 12000)); - break; - default: - break; - } - } - - if (!UpdateVictim()) - return; - - DoMeleeAttackIfReady(); - } - - void JustDied(Unit* killer) OVERRIDE - { - if (killer->ToPlayer() && killer->ToPlayer()->GetTypeId() == TYPEID_PLAYER) - { - if (me->FindNearestCreature(NPC_WAR_GOLEM, 10.0f, true)) - { - if (killer->ToPlayer()->GetQuestStatus(QUEST_OR_MAYBE_WE_DONT_A) == QUEST_STATUS_INCOMPLETE || - killer->ToPlayer()->GetQuestStatus(QUEST_OR_MAYBE_WE_DONT_H) == QUEST_STATUS_INCOMPLETE) - DoCast(killer, SPELL_WAR_GOLEM_CHARGE_CREDIT); - } - } - } - private: - EventMap _events; - }; - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_lightning_sentryAI(creature); - } -}; - /*Venture co. Straggler - when you cast Smoke Bomb, he will yell and run away*/ enum SmokeEmOut { @@ -830,6 +751,43 @@ public: } }; +enum ShredderDelivery +{ + NPC_BROKEN_DOWN_SHREDDER = 27354 +}; + +class spell_shredder_delivery : public SpellScriptLoader +{ + public: + spell_shredder_delivery() : SpellScriptLoader("spell_shredder_delivery") { } + + class spell_shredder_delivery_SpellScript : public SpellScript + { + PrepareSpellScript(spell_shredder_delivery_SpellScript); + + bool Load() OVERRIDE + { + return GetCaster()->GetTypeId() == TYPEID_UNIT; + } + + void HandleScript(SpellEffIndex /*effIndex*/) + { + if (GetCaster()->ToCreature()->GetEntry() == NPC_BROKEN_DOWN_SHREDDER) + GetCaster()->ToCreature()->DespawnOrUnsummon(); + } + + void Register() OVERRIDE + { + OnEffectHitTarget += SpellEffectFn(spell_shredder_delivery_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const OVERRIDE + { + return new spell_shredder_delivery_SpellScript(); + } +}; + void AddSC_grizzly_hills() { new npc_emily(); @@ -838,7 +796,7 @@ void AddSC_grizzly_hills() new npc_tallhorn_stag(); new npc_amberpine_woodsman(); new npc_wounded_skirmisher(); - new npc_lightning_sentry(); new npc_venture_co_straggler(); new npc_lake_frog(); + new spell_shredder_delivery(); } diff --git a/src/server/scripts/Northrend/zone_howling_fjord.cpp b/src/server/scripts/Northrend/zone_howling_fjord.cpp index 671628e4cbc..fd5b0a5ca1c 100644 --- a/src/server/scripts/Northrend/zone_howling_fjord.cpp +++ b/src/server/scripts/Northrend/zone_howling_fjord.cpp @@ -32,6 +32,8 @@ EndContentData */ #include "ScriptedGossip.h" #include "ScriptedEscortAI.h" #include "Player.h" +#include "SpellInfo.h" +#include "SpellScript.h" /*###### ## npc_apothecary_hanes @@ -43,7 +45,8 @@ enum Entries FACTION_ESCORTEE_H = 775, NPC_HANES_FIRE_TRIGGER = 23968, QUEST_TRAIL_OF_FIRE = 11241, - SPELL_COSMETIC_LOW_POLY_FIRE = 56274 + SPELL_COSMETIC_LOW_POLY_FIRE = 56274, + SPELL_HEALING_POTION = 17534 }; class npc_apothecary_hanes : public CreatureScript @@ -92,7 +95,7 @@ public: { if (PotTimer <= diff) { - DoCast(me, 17534, true); + DoCast(me, SPELL_HEALING_POTION, true); PotTimer = 10000; } else PotTimer -= diff; } @@ -380,10 +383,107 @@ public: } }; +enum MindlessAbomination +{ + EVENT_CHECK_CHARMED = 1 +}; + +class npc_mindless_abomination : public CreatureScript +{ +public: + npc_mindless_abomination() : CreatureScript("npc_mindless_abomination") { } + + struct npc_mindless_abominationAI : public ScriptedAI + { + npc_mindless_abominationAI(Creature* creature) : ScriptedAI(creature) { } + + void Reset() OVERRIDE + { + events.ScheduleEvent(EVENT_CHECK_CHARMED, 1000); + } + + void UpdateAI(uint32 diff) OVERRIDE + { + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_CHECK_CHARMED: + if (!me->IsCharmedOwnedByPlayerOrPlayer()) + me->DespawnOrUnsummon(); + else + events.ScheduleEvent(EVENT_CHECK_CHARMED, 1000); + break; + } + } + } + + private: + EventMap events; + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return new npc_mindless_abominationAI(creature); + } +}; + +class spell_mindless_abomination_explosion_fx_master : public SpellScriptLoader +{ + enum Spells + { + SPELL_RANDOM_CIRCUMFERENCE_POINT_POISON = 42266, + SPELL_COSMETIC_BLOOD_EXPLOSION_GREEN_LARGE = 43401 + }; + + public: + spell_mindless_abomination_explosion_fx_master() : SpellScriptLoader("spell_mindless_abomination_explosion_fx_master") { } + + class spell_mindless_abomination_explosion_fx_master_SpellScript : public SpellScript + { + PrepareSpellScript(spell_mindless_abomination_explosion_fx_master_SpellScript); + + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE + { + if (!sSpellMgr->GetSpellInfo(SPELL_RANDOM_CIRCUMFERENCE_POINT_POISON) || !sSpellMgr->GetSpellInfo(SPELL_COSMETIC_BLOOD_EXPLOSION_GREEN_LARGE)) + return false; + return true; + } + + void HandleScript(SpellEffIndex /*eff*/) + { + Creature* caster = GetCaster()->ToCreature(); + if (!caster) + return; + + caster->AI()->DoCast(caster, SPELL_COSMETIC_BLOOD_EXPLOSION_GREEN_LARGE); + + for (uint8 i = 0; i < 10; ++i) + caster->AI()->DoCast(caster, SPELL_RANDOM_CIRCUMFERENCE_POINT_POISON); + + caster->DespawnOrUnsummon(4000); + } + + void Register() OVERRIDE + { + OnEffectHitTarget += SpellEffectFn(spell_mindless_abomination_explosion_fx_master_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const OVERRIDE + { + return new spell_mindless_abomination_explosion_fx_master_SpellScript(); + } +}; + void AddSC_howling_fjord() { - new npc_apothecary_hanes; - new npc_plaguehound_tracker; - new npc_razael_and_lyana; - new npc_daegarn; + new npc_apothecary_hanes(); + new npc_plaguehound_tracker(); + new npc_razael_and_lyana(); + new npc_daegarn(); + new npc_mindless_abomination(); + new spell_mindless_abomination_explosion_fx_master(); } diff --git a/src/server/scripts/Northrend/zone_icecrown.cpp b/src/server/scripts/Northrend/zone_icecrown.cpp index d952321c749..5c65be982e0 100644 --- a/src/server/scripts/Northrend/zone_icecrown.cpp +++ b/src/server/scripts/Northrend/zone_icecrown.cpp @@ -25,91 +25,6 @@ #include "CombatAI.h" /*###### -## npc_arete -######*/ - -#define GOSSIP_ARETE_ITEM1 "Lord-Commander, I would hear your tale." -#define GOSSIP_ARETE_ITEM2 "<You nod slightly but do not complete the motion as the Lord-Commander narrows his eyes before he continues.>" -#define GOSSIP_ARETE_ITEM3 "I thought that they now called themselves the Scarlet Onslaught?" -#define GOSSIP_ARETE_ITEM4 "Where did the grand admiral go?" -#define GOSSIP_ARETE_ITEM5 "That's fine. When do I start?" -#define GOSSIP_ARETE_ITEM6 "Let's finish this!" -#define GOSSIP_ARETE_ITEM7 "That's quite a tale, Lord-Commander." - -enum Arete -{ - GOSSIP_TEXTID_ARETE1 = 13525, - GOSSIP_TEXTID_ARETE2 = 13526, - GOSSIP_TEXTID_ARETE3 = 13527, - GOSSIP_TEXTID_ARETE4 = 13528, - GOSSIP_TEXTID_ARETE5 = 13529, - GOSSIP_TEXTID_ARETE6 = 13530, - GOSSIP_TEXTID_ARETE7 = 13531, - - QUEST_THE_STORY_THUS_FAR = 12807 -}; - -class npc_arete : public CreatureScript -{ -public: - npc_arete() : CreatureScript("npc_arete") { } - - bool OnGossipHello(Player* player, Creature* creature) OVERRIDE - { - if (creature->IsQuestGiver()) - player->PrepareQuestMenu(creature->GetGUID()); - - if (player->GetQuestStatus(QUEST_THE_STORY_THUS_FAR) == QUEST_STATUS_INCOMPLETE) - { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ARETE_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ARETE1, creature->GetGUID()); - return true; - } - - player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); - return true; - } - - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) OVERRIDE - { - player->PlayerTalkClass->ClearMenus(); - switch (action) - { - case GOSSIP_ACTION_INFO_DEF+1: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ARETE_ITEM2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ARETE2, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ARETE_ITEM3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ARETE3, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ARETE_ITEM4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ARETE4, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ARETE_ITEM5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ARETE5, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+5: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ARETE_ITEM6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ARETE6, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+6: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ARETE_ITEM7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7); - player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ARETE7, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+7: - player->CLOSE_GOSSIP_MENU(); - player->AreaExploredOrEventHappens(QUEST_THE_STORY_THUS_FAR); - break; - } - - return true; - } -}; - -/*###### ## npc_squire_david ######*/ @@ -483,7 +398,7 @@ class npc_tournament_training_dummy : public CreatureScript me->SetControlled(true, UNIT_STATE_STUNNED); } - void MoveInLineOfSight(Unit* /*who*/)OVERRIDE { } + void MoveInLineOfSight(Unit* /*who*/) OVERRIDE { } }; @@ -1149,7 +1064,6 @@ class npc_morbidus : public CreatureScript void AddSC_icecrown() { - new npc_arete; new npc_squire_david; new npc_argent_valiant; new npc_guardian_pavilion; diff --git a/src/server/scripts/Northrend/zone_sholazar_basin.cpp b/src/server/scripts/Northrend/zone_sholazar_basin.cpp index 77b85037a01..a0b6524bd89 100644 --- a/src/server/scripts/Northrend/zone_sholazar_basin.cpp +++ b/src/server/scripts/Northrend/zone_sholazar_basin.cpp @@ -1082,6 +1082,57 @@ public: } }; +/*###### +## Quest Dreadsaber Mastery: Stalking the Prey (12550) +######*/ + +enum ShangoTracks +{ + SPELL_CORRECT_TRACKS = 52160, + SPELL_INCORRECT_TRACKS = 52163, + SAY_CORRECT_TRACKS = 28634, + SAY_INCORRECT_TRACKS = 28635 +}; + +class spell_shango_tracks : public SpellScriptLoader +{ +public: + spell_shango_tracks() : SpellScriptLoader("spell_shango_tracks") { } + + class spell_shango_tracks_SpellScript : public SpellScript + { + PrepareSpellScript(spell_shango_tracks_SpellScript); + + void HandleScript(SpellEffIndex /*effIndex*/) + { + if (Player* player = GetHitUnit()->ToPlayer()) + { + switch (GetSpellInfo()->Id) + { + case SPELL_CORRECT_TRACKS: + player->MonsterSay(sObjectMgr->GetTrinityStringForDBCLocale(SAY_CORRECT_TRACKS), LANG_UNIVERSAL, player->GetGUID()); + break; + case SPELL_INCORRECT_TRACKS: + player->MonsterSay(sObjectMgr->GetTrinityStringForDBCLocale(SAY_INCORRECT_TRACKS), LANG_UNIVERSAL, player->GetGUID()); + break; + default: + break; + } + } + } + + void Register() OVERRIDE + { + OnEffectHitTarget += SpellEffectFn(spell_shango_tracks_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const OVERRIDE + { + return new spell_shango_tracks_SpellScript(); + } +}; + void AddSC_sholazar_basin() { new npc_injured_rainspeaker_oracle(); @@ -1095,4 +1146,5 @@ void AddSC_sholazar_basin() new spell_q12589_shoot_rjr(); new npc_haiphoon(); new npc_vics_flying_machine(); + new spell_shango_tracks(); } diff --git a/src/server/scripts/Northrend/zone_storm_peaks.cpp b/src/server/scripts/Northrend/zone_storm_peaks.cpp index 83d49045eff..c09c817a2bf 100644 --- a/src/server/scripts/Northrend/zone_storm_peaks.cpp +++ b/src/server/scripts/Northrend/zone_storm_peaks.cpp @@ -163,7 +163,8 @@ public: ## npc_brunnhildar_prisoner ######*/ -enum BrunnhildarPrisoner { +enum BrunnhildarPrisoner +{ SPELL_ICE_PRISON = 54894, SPELL_ICE_LANCE = 55046, SPELL_FREE_PRISONER = 55048, @@ -413,6 +414,180 @@ class npc_hyldsmeet_protodrake : public CreatureScript } }; + +/*##### +# npc_brann_bronzebeard for Quest 13285 "Forging the Keystone" +#####*/ + +enum BrannBronzebeard +{ + NPC_BRANN_BRONZEBEARD = 31810, + NPC_A_DISTANT_VOICE = 31814, + OBJECT_TOL_SIGNAL_1 = 193590, + OBJECT_TOL_SIGNAL_2 = 193591, + OBJECT_TOL_SIGNAL_3 = 193592, + OBJECT_TOL_SIGNAL_4 = 193593, + OBJECT_TOL_SIGNAL_5 = 193594, + SPELL_RESURRECTION = 58854, + SAY_BRANN_1 = 0, + SAY_BRANN_2 = 1, + SAY_BRANN_3 = 2, + SAY_VOICE_1 = 0, + SAY_VOICE_2 = 1, + SAY_VOICE_3 = 2, + SAY_VOICE_4 = 3, + SAY_VOICE_5 = 4, + + EVENT_SCRIPT_1 = 1, + EVENT_SCRIPT_2 = 2, + EVENT_SCRIPT_3 = 3, + EVENT_SCRIPT_4 = 4, + EVENT_SCRIPT_5 = 5, + EVENT_SCRIPT_6 = 6, + EVENT_SCRIPT_7 = 7, + EVENT_SCRIPT_8 = 8, + EVENT_SCRIPT_9 = 9, + EVENT_SCRIPT_10 = 10, + EVENT_SCRIPT_11 = 11, + EVENT_SCRIPT_12 = 12, + EVENT_SCRIPT_13 = 13 +}; + +class npc_brann_bronzebeard_keystone : public CreatureScript +{ +public: + npc_brann_bronzebeard_keystone() : CreatureScript("npc_brann_bronzebeard_keystone") { } + + struct npc_brann_bronzebeard_keystoneAI : public ScriptedAI + { + npc_brann_bronzebeard_keystoneAI(Creature* creature) : ScriptedAI(creature) { } + + void Reset() OVERRIDE + { + memset(&objectGUID, 0, sizeof(objectGUID)); + playerGUID = 0; + voiceGUID = 0; + objectCounter = 0; + } + + void sGossipSelect(Player* player, uint32 /*sender*/, uint32 /*action*/) OVERRIDE + { + player->CLOSE_GOSSIP_MENU(); + playerGUID = player->GetGUID(); + events.ScheduleEvent(EVENT_SCRIPT_1, 100); + } + + void UpdateAI(uint32 diff) OVERRIDE + { + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_SCRIPT_1: + Talk(SAY_BRANN_1, playerGUID); + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER); + if (Creature* voice = me->SummonCreature(NPC_A_DISTANT_VOICE, 7863.43f, -1396.585f, 1538.076f, 2.949606f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 49000)) + voiceGUID = voice->GetGUID(); + events.ScheduleEvent(EVENT_SCRIPT_2, 4000); + break; + case EVENT_SCRIPT_2: + me->SetWalk(true); + me->GetMotionMaster()->MovePoint(0, 7861.488f, -1396.376f, 1534.059f, false); + events.ScheduleEvent(EVENT_SCRIPT_3, 6000); + break; + case EVENT_SCRIPT_3: + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_WORK_MINING); + events.ScheduleEvent(EVENT_SCRIPT_4, 6000); + break; + case EVENT_SCRIPT_4: + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); + if (Creature* voice = ObjectAccessor::GetCreature(*me, voiceGUID)) + { + voice->AI()->DoCast(voice, SPELL_RESURRECTION); + voice->AI()->Talk(SAY_VOICE_1, playerGUID); + } + if (GameObject* go = me->SummonGameObject(OBJECT_TOL_SIGNAL_1, 7860.273f, -1383.622f, 1538.302f, -1.658062f, 0, 0, -0.737277f, 0.6755905f, 0)) + objectGUID[objectCounter++] = go->GetGUID(); + events.ScheduleEvent(EVENT_SCRIPT_5, 6000); + break; + case EVENT_SCRIPT_5: + if (Creature* voice = ObjectAccessor::GetCreature(*me, voiceGUID)) + voice->AI()->Talk(SAY_VOICE_2, playerGUID); + if (GameObject* go = me->SummonGameObject(OBJECT_TOL_SIGNAL_2, 7875.67f, -1387.266f, 1538.323f, -2.373644f, 0, 0, -0.9271832f, 0.3746083f, 0)) + objectGUID[objectCounter++] = go->GetGUID(); + events.ScheduleEvent(EVENT_SCRIPT_6, 6000); + break; + case EVENT_SCRIPT_6: + if (Creature* voice = ObjectAccessor::GetCreature(*me, voiceGUID)) + voice->AI()->Talk(SAY_VOICE_3, playerGUID); + if (GameObject* go = me->SummonGameObject(OBJECT_TOL_SIGNAL_3, 7879.212f, -1401.175f, 1538.279f, 2.967041f, 0, 0, 0.9961939f, 0.08716504f, 0)) + objectGUID[objectCounter++] = go->GetGUID(); + events.ScheduleEvent(EVENT_SCRIPT_7, 6000); + break; + case EVENT_SCRIPT_7: + if (Creature* voice = ObjectAccessor::GetCreature(*me, voiceGUID)) + voice->AI()->Talk(SAY_VOICE_4, playerGUID); + if (GameObject* go = me->SummonGameObject(OBJECT_TOL_SIGNAL_4, 7868.944f, -1411.18f, 1538.213f, 2.111848f, 0, 0, 0.8703556f, 0.4924237f, 0)) + objectGUID[objectCounter++] = go->GetGUID(); + events.ScheduleEvent(EVENT_SCRIPT_8, 6000); + break; + case EVENT_SCRIPT_8: + if (Creature* voice = ObjectAccessor::GetCreature(*me, voiceGUID)) + voice->AI()->Talk(SAY_VOICE_5, playerGUID); + if (GameObject* go = me->SummonGameObject(OBJECT_TOL_SIGNAL_5, 7855.11f, -1406.839f, 1538.42f, 1.151916f, 0, 0, 0.5446386f, 0.8386708f, 0)) + objectGUID[objectCounter] = go->GetGUID(); + events.ScheduleEvent(EVENT_SCRIPT_9, 6000); + break; + case EVENT_SCRIPT_9: + if (Creature* voice = ObjectAccessor::GetCreature(*me, voiceGUID)) + voice->AI()->DoCast(voice, SPELL_RESURRECTION); + events.ScheduleEvent(EVENT_SCRIPT_10, 6000); + break; + case EVENT_SCRIPT_10: + Talk(SAY_BRANN_2, playerGUID); + if (Player* player = ObjectAccessor::GetPlayer(*me, playerGUID)) + player->KilledMonsterCredit(me->GetEntry()); + events.ScheduleEvent(EVENT_SCRIPT_11, 6000); + break; + case EVENT_SCRIPT_11: + me->SetFacingTo(2.932153f); + Talk(SAY_BRANN_3, playerGUID); + + for (uint8 i = 0; i < 5; ++i) + if (GameObject* go = ObjectAccessor::GetGameObject(*me, objectGUID[i])) + go->Delete(); + + events.ScheduleEvent(EVENT_SCRIPT_12, 6000); + break; + case EVENT_SCRIPT_12: + me->GetMotionMaster()->Clear(); + me->SetWalk(false); + me->GetMotionMaster()->MovePoint(0, 7799.908f, -1413.561f, 1534.829f, false); + events.ScheduleEvent(EVENT_SCRIPT_13, 10000); + break; + case EVENT_SCRIPT_13: + me->DisappearAndDie(); + break; + } + } + } + + private: + EventMap events; + uint64 playerGUID; + uint64 objectGUID[5]; + uint64 voiceGUID; + uint8 objectCounter; + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return new npc_brann_bronzebeard_keystoneAI(creature); + } +}; + enum CloseRift { SPELL_DESPAWN_RIFT = 61665 @@ -460,6 +635,91 @@ class spell_close_rift : public SpellScriptLoader } }; +/*##### +# Krolmir, Hammer of Storms +#####*/ + +enum JokkumScriptcast +{ + SPELL_JOKKUM_KILL_CREDIT = 56545, + SPELL_JOKKUM_SUMMON = 56541, + NPC_KINGJOKKUM = 30331, + SAY_HOLD_ON = 0, + PATH_JOKKUM = 2072200 +}; + +class spell_jokkum_scriptcast : public SpellScriptLoader +{ + public: spell_jokkum_scriptcast() : SpellScriptLoader("spell_jokkum_scriptcast") { } + + class spell_jokkum_scriptcast_AuraScript : public AuraScript + { + PrepareAuraScript(spell_jokkum_scriptcast_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE + { + if (!sSpellMgr->GetSpellInfo(SPELL_JOKKUM_SUMMON)) + return false; + return true; + } + + void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + Unit* target = GetTarget(); + target->CastSpell(target, SPELL_JOKKUM_SUMMON, true); + } + + void Register() OVERRIDE + { + OnEffectApply += AuraEffectApplyFn(spell_jokkum_scriptcast_AuraScript::OnApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + }; + + AuraScript* GetAuraScript() const OVERRIDE + { + return new spell_jokkum_scriptcast_AuraScript(); + } +}; + +class npc_king_jokkum_vehicle : public CreatureScript +{ + public: + npc_king_jokkum_vehicle() : CreatureScript("npc_king_jokkum_vehicle") { } + + struct npc_king_jokkum_vehicleAI : public VehicleAI + { + npc_king_jokkum_vehicleAI(Creature* creature) : VehicleAI(creature) { } + + void OnCharmed(bool /*apply*/) OVERRIDE { } + + void PassengerBoarded(Unit* who, int8 /*seat*/, bool apply) OVERRIDE + { + if (apply) + { + Talk(SAY_HOLD_ON, who->GetGUID()); + me->CastSpell(who, SPELL_JOKKUM_KILL_CREDIT, true); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); + me->GetMotionMaster()->MovePath(PATH_JOKKUM, false); + } + } + + void MovementInform(uint32 type, uint32 id) OVERRIDE + { + if (type != WAYPOINT_MOTION_TYPE) + return; + + // PointId in WaypointMovementGenerator doesn't match with PointId in DB + if (id == 19) + me->GetVehicleKit()->RemoveAllPassengers(); + } + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return new npc_king_jokkum_vehicleAI(creature); + } +}; + void AddSC_storm_peaks() { new npc_injured_goblin(); @@ -468,5 +728,8 @@ void AddSC_storm_peaks() new npc_freed_protodrake(); new npc_icefang(); new npc_hyldsmeet_protodrake(); + new npc_brann_bronzebeard_keystone(); new spell_close_rift(); + new spell_jokkum_scriptcast(); + new npc_king_jokkum_vehicle(); } diff --git a/src/server/scripts/Northrend/zone_zuldrak.cpp b/src/server/scripts/Northrend/zone_zuldrak.cpp index 66415448d32..1137c86f287 100644 --- a/src/server/scripts/Northrend/zone_zuldrak.cpp +++ b/src/server/scripts/Northrend/zone_zuldrak.cpp @@ -57,16 +57,15 @@ public: float x, y, z; me->GetClosePoint(x, y, z, me->GetObjectSize() / 3, 0.1f); - if (Unit* summon = me->SummonCreature(NPC_RAGECLAW, x, y, z, 0, TEMPSUMMON_DEAD_DESPAWN, 1000)) + if (Creature* summon = me->SummonCreature(NPC_RAGECLAW, x, y, z, 0, TEMPSUMMON_DEAD_DESPAWN, 1000)) { _rageclawGUID = summon->GetGUID(); - LockRageclaw(); + LockRageclaw(summon); } } - void LockRageclaw() + void LockRageclaw(Creature* rageclaw) { - Unit* rageclaw = Unit::GetCreature(*me, _rageclawGUID); // pointer check not needed me->SetInFront(rageclaw); rageclaw->SetInFront(me); @@ -75,12 +74,11 @@ public: DoCast(rageclaw, SPELL_RIGHT_CHAIN, true); } - void UnlockRageclaw(Unit* who) + void UnlockRageclaw(Unit* who, Creature* rageclaw) { if (!who) return; - Creature* rageclaw = Unit::GetCreature(*me, _rageclawGUID); // pointer check not needed DoCast(rageclaw, SPELL_FREE_RAGECLAW, true); @@ -95,7 +93,7 @@ public: { if (Creature* rageclaw = Unit::GetCreature(*me, _rageclawGUID)) { - UnlockRageclaw(caster); + UnlockRageclaw(caster, rageclaw); caster->ToPlayer()->KilledMonster(rageclaw->GetCreatureTemplate(), _rageclawGUID); me->DespawnOrUnsummon(); } @@ -141,8 +139,7 @@ public: DoCast(me, SPELL_KNEEL, true); // Little Hack for kneel - Thanks Illy :P } - void MoveInLineOfSight(Unit* /*who*/)OVERRIDE { } - + void MoveInLineOfSight(Unit* /*who*/) OVERRIDE { } void SpellHit(Unit* /*caster*/, const SpellInfo* spell) OVERRIDE { @@ -166,982 +163,6 @@ public: } }; -/*#### -## npc_gurgthock -####*/ - -enum Gurgthock -{ - QUEST_AMPHITHEATER_ANGUISH_TUSKARRMAGEDDON = 12935, - QUEST_AMPHITHEATER_ANGUISH_KORRAK_BLOODRAGER = 12936, - QUEST_AMPHITHEATER_ANGUISH_YGGDRAS_2 = 12954, - QUEST_AMPHITHEATER_ANGUISH_YGGDRAS_1 = 12932, - QUEST_AMPHITHEATER_ANGUISH_MAGNATAUR = 12933, - QUEST_AMPHITHEATER_ANGUISH_FROM_BEYOND = 12934, - - NPC_ORINOKO_TUSKBREAKER = 30020, - NPC_KORRAK_BLOODRAGER = 30023, - NPC_YGGDRAS = 30014, - NPC_STINKBEARD = 30017, - NPC_AZ_BARIN = 30026, // air - NPC_DUKE_SINGEN = 30019, // fire - NPC_ERATHIUS = 30025, // earth - NPC_GARGORAL = 30024, // water - NPC_FIEND_WATER = 30044, - NPC_FIEND_AIR = 30045, - NPC_FIEND_FIRE = 30042, - NPC_FIEND_EARTH = 30043, - - SAY_QUEST_ACCEPT_TUSKARRMAGEDON = 0, - SAY_QUEST_ACCEPT_KORRAK_1 = 1, - SAY_QUEST_ACCEPT_KORRAK_2 = 2, - SAY_QUEST_ACCEPT_MAGNATAUR = 3, - EMOTE_YGGDRAS_SPAWN = 4, - SAY_STINKBEARD_SPAWN = 5, - SAY_GURGTHOCK_ELEMENTAL_SPAWN = 6, - SAY_GURGTHOCK_7 = 7, - SAY_QUEST_AMPHITHEATER_ANGUISH_YGGDRAS = 8, - SAY_GURGTHOCK_9 = 9, - - SAY_CALL_FOR_HELP = 0, - SAY_RECRUIT = 0, - - SPELL_CRASHING_WAVE = 55909, // water - SPELL_SHOCKWAVE = 55918, // earth - SPELL_BLAST_OF_AIR = 55912, // air - SPELL_MAGMA_WAVE = 55916, // fire - - SPELL_ORB_OF_WATER = 55888, // fiend of water spell - SPELL_ORB_OF_STORMS = 55882, // fiend of air spell - SPELL_BOULDER = 55886, // fiend of earth spell - SPELL_ORB_OF_FLAME = 55872, // fiend of fire spell -}; - -struct BossAndAdd -{ - uint32 uiBoss; - uint32 uiAdd; - uint32 uiSpell; - uint32 uiAddSpell; -}; - -static BossAndAdd Boss[]= -{ - {NPC_GARGORAL, NPC_FIEND_WATER, SPELL_CRASHING_WAVE, SPELL_ORB_OF_WATER}, - {NPC_AZ_BARIN, NPC_FIEND_AIR, SPELL_BLAST_OF_AIR, SPELL_ORB_OF_STORMS}, - {NPC_DUKE_SINGEN, NPC_FIEND_FIRE, SPELL_MAGMA_WAVE, SPELL_ORB_OF_FLAME}, - {NPC_ERATHIUS, NPC_FIEND_EARTH, SPELL_SHOCKWAVE, SPELL_BOULDER}, -}; - -const Position SpawnPosition[] = -{ - {5754.692f, -2939.46f, 286.276123f, 5.156380f}, // stinkbeard || orinoko || korrak - {5762.054199f, -2954.385010f, 273.826955f, 5.108289f}, //yggdras - {5776.855f, -2989.77979f, 272.96814f, 5.194f} // elementals -}; - -const Position AddSpawnPosition[] = -{ - {5722.487f, -3010.75f, 312.751648f, 0.478f}, // caster location - {5724.983f, -2969.89551f, 286.359619f, 0.478f}, - {5733.76025f, -3000.34644f, 286.359619f, 0.478f}, - {5739.8125f, -2981.524f, 290.7671f, 0.478f}, // caster location - {5742.101f, -2950.75586f, 286.2643f, 5.21f}, - {5743.305f, -3011.29736f, 290.7671f, 0.478f}, // caster location - {5744.417f, -3025.528f, 286.35965f, 0.478f}, - {5763.189f, -3029.67529f, 290.7671f, 0.478f}, - {5769.401f, -2935.121f, 286.335754f, 5.21f}, - {5793.061f, -2934.593f, 286.359619f, 3.53f}, - {5797.32129f, -2955.26855f, 290.7671f, 3.53f}, // caster location - {5813.94531f, -2956.74683f, 286.359619f, 3.53f}, - {5816.85547f, -2974.476f, 290.7671f, 3.53f}, // caster location - {5820.30859f, -3002.83716f, 290.7671f, 3.53f}, // caster location - {5828.50244f, -2981.737f, 286.359619f, 3.53f}, - {5828.899f, -2960.15479f, 312.751648f, 3.53f}, // caster location -}; - -class npc_gurgthock : public CreatureScript -{ -public: - npc_gurgthock() : CreatureScript("npc_gurgthock") { } - - struct npc_gurgthockAI : public ScriptedAI - { - npc_gurgthockAI(Creature* creature) : ScriptedAI(creature) { } - - void Reset() OVERRIDE - { - _summonGUID = 0; - _playerGUID = 0; - - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - uiTimer = 0; - uiPhase = 0; - uiQuest = 0; - uiRemoveFlagTimer = 5000; - - _bossRandom = 0; - - _removeFlag = false; - } - - void SetGUID(uint64 guid, int32 /*id*/) OVERRIDE - { - _playerGUID = guid; - } - - void SetData(uint32 type, uint32 data) OVERRIDE - { - _removeFlag = true; - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - - switch (type) - { - case 1: - switch (data) - { - case QUEST_AMPHITHEATER_ANGUISH_TUSKARRMAGEDDON: - Talk(SAY_QUEST_ACCEPT_TUSKARRMAGEDON); - uiPhase = 1; - uiTimer = 4000; - break; - case QUEST_AMPHITHEATER_ANGUISH_KORRAK_BLOODRAGER: - Talk(SAY_QUEST_ACCEPT_KORRAK_1); - uiPhase = 3; - uiTimer = 3000; - break; - case QUEST_AMPHITHEATER_ANGUISH_YGGDRAS_2: - case QUEST_AMPHITHEATER_ANGUISH_YGGDRAS_1: - uiPhase = 6; - uiTimer = 3000; - break; - case QUEST_AMPHITHEATER_ANGUISH_MAGNATAUR: - uiTimer = 5000; - uiPhase = 7; - break; - case QUEST_AMPHITHEATER_ANGUISH_FROM_BEYOND: - uiTimer = 2000; - uiPhase = 12; - break; - } - break; - } - } - - void UpdateAI(uint32 diff) OVERRIDE - { - ScriptedAI::UpdateAI(diff); - - if (_removeFlag) - { - if (uiRemoveFlagTimer <= diff) - { - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - _removeFlag = false; - - uiRemoveFlagTimer = 10000; - } else uiRemoveFlagTimer -= diff; - } - - if (uiPhase) - { - if (uiTimer <= diff) - { - switch (uiPhase) - { - case 1: - if (Creature* summon = me->SummonCreature(NPC_ORINOKO_TUSKBREAKER, SpawnPosition[0], TEMPSUMMON_CORPSE_DESPAWN, 1000)) - _summonGUID = summon->GetGUID(); - uiPhase = 2; - uiTimer = 4000; - break; - case 2: - if (Creature* summon = Unit::GetCreature(*me, _summonGUID)) - summon->GetMotionMaster()->MoveJump(5776.319824f, -2981.005371f, 273.100037f, 10.0f, 20.0f); - uiPhase = 0; - _summonGUID = 0; - break; - case 3: - Talk(SAY_QUEST_ACCEPT_KORRAK_2); - uiTimer = 3000; - uiPhase = 4; - break; - case 4: - if (Creature* summon = me->SummonCreature(NPC_KORRAK_BLOODRAGER, SpawnPosition[0], TEMPSUMMON_CORPSE_DESPAWN, 1000)) - _summonGUID = summon->GetGUID(); - uiTimer = 3000; - uiPhase = 0; - break; - case 6: - Talk(SAY_GURGTHOCK_7, _playerGUID); - uiTimer = 5000; - uiPhase = 9; - break; - case 7: - Talk(SAY_GURGTHOCK_9, _playerGUID); - uiTimer = 3000; - uiPhase = 8; - break; - case 8: - Talk(SAY_QUEST_ACCEPT_MAGNATAUR); - uiTimer = 5000; - uiPhase = 11; - break; - case 9: - Talk(SAY_QUEST_AMPHITHEATER_ANGUISH_YGGDRAS, _playerGUID); - uiTimer = 10000; - uiPhase = 10; - break; - case 10: - me->SummonCreature(NPC_YGGDRAS, SpawnPosition[1], TEMPSUMMON_CORPSE_DESPAWN, 1000); - Talk(EMOTE_YGGDRAS_SPAWN); - uiPhase = 0; - break; - case 11: - if (Creature* creature = me->SummonCreature(NPC_STINKBEARD, SpawnPosition[0], TEMPSUMMON_CORPSE_DESPAWN, 1000)) - creature->AI()->Talk(SAY_STINKBEARD_SPAWN); - uiPhase = 0; - break; - case 12: - Talk(SAY_GURGTHOCK_9, _playerGUID); - uiTimer = 5000; - uiPhase = 13; - break; - case 13: - Talk(SAY_GURGTHOCK_ELEMENTAL_SPAWN); - uiTimer = 3000; - uiPhase = 14; - break; - case 14: - _bossRandom = urand(0, 3); - if (Creature* creature = me->SummonCreature(Boss[_bossRandom].uiBoss, SpawnPosition[2], TEMPSUMMON_CORPSE_DESPAWN, 1000)) - creature->AI()->SetData(1, _bossRandom); - uiPhase = 0; - break; - } - } - else - uiTimer -= diff; - } - } - - private: - bool _removeFlag; - uint8 _bossRandom; - uint64 _summonGUID; - uint64 _playerGUID; - - uint32 uiTimer; - uint32 uiPhase; - uint32 uiRemoveFlagTimer; - uint32 uiQuest; - - }; - - bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) OVERRIDE - { - switch (quest->GetQuestId()) - { - case QUEST_AMPHITHEATER_ANGUISH_TUSKARRMAGEDDON: - creature->AI()->SetData(1, quest->GetQuestId()); - break; - case QUEST_AMPHITHEATER_ANGUISH_KORRAK_BLOODRAGER: - creature->AI()->SetData(1, quest->GetQuestId()); - break; - case QUEST_AMPHITHEATER_ANGUISH_YGGDRAS_2: - case QUEST_AMPHITHEATER_ANGUISH_YGGDRAS_1: - creature->AI()->SetData(1, quest->GetQuestId()); - break; - case QUEST_AMPHITHEATER_ANGUISH_MAGNATAUR: - creature->AI()->SetData(1, quest->GetQuestId()); - break; - case QUEST_AMPHITHEATER_ANGUISH_FROM_BEYOND: - creature->AI()->SetData(1, quest->GetQuestId()); - break; - } - - creature->AI()->SetGUID(player->GetGUID()); - - return false; - } - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_gurgthockAI(creature); - } -}; - -/*#### -## npc_orinoko_tuskbreaker -####*/ - -enum OrinokoTuskbreaker -{ - NPC_WHISKER = 30113, - NPC_HUNGRY_PENGUIN = 30110, - - SPELL_BATTLE_SHOUT = 32064, - SPELL_FISHY_SCENT = 55937, - SPELL_IMPALE = 55929, - SPELL_SUMMON_WHISKER = 55946 -}; - -class npc_orinoko_tuskbreaker : public CreatureScript -{ -public: - npc_orinoko_tuskbreaker() : CreatureScript("npc_orinoko_tuskbreaker") { } - - struct npc_orinoko_tuskbreakerAI : public ScriptedAI - { - npc_orinoko_tuskbreakerAI(Creature* creature) : ScriptedAI(creature) - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); - me->SetReactState(REACT_PASSIVE); - } - - void Reset() OVERRIDE - { - _summoned = false; - _battleShout = false; - _fishyScent = false; - uiBattleShoutTimer = 0; - uiFishyScentTimer = 20000; - _whiskerGUID = 0; - _affectedGUID = 0; - } - - void EnterEvadeMode() OVERRIDE - { - if (Creature* whisker = me->GetCreature(*me, _whiskerGUID)) - whisker->RemoveFromWorld(); - } - - void MovementInform(uint32 type, uint32 /*pointId*/) OVERRIDE - { - if (type != EFFECT_MOTION_TYPE) - return; - - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); - me->SetReactState(REACT_AGGRESSIVE); - me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); - uiBattleShoutTimer = 7000; - } - - void EnterCombat(Unit* who) OVERRIDE - { - DoCast(who, SPELL_IMPALE); - } - - void UpdateAI(uint32 diff) OVERRIDE - { - if (!UpdateVictim()) - return; - - if (!_battleShout && uiBattleShoutTimer <= diff) - { - DoCast(me, SPELL_BATTLE_SHOUT); - _battleShout = true; - } else uiBattleShoutTimer -= diff; - - if (uiFishyScentTimer <= diff) - { - if (Unit* affected = SelectTarget(SELECT_TARGET_RANDOM, 0)) - { - DoCast(affected, SPELL_FISHY_SCENT); - _affectedGUID = affected->GetGUID(); - } - uiFishyScentTimer = 20000; - } else uiFishyScentTimer -= diff; - - if (!_summoned && !HealthAbovePct(50)) - { - Talk(SAY_CALL_FOR_HELP); - //DoCastVictim(SPELL_SUMMON_WHISKER); petai is not working correctly??? - - if (Creature* whisker = me->SummonCreature(NPC_WHISKER, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0)) - _whiskerGUID = whisker->GetGUID(); - _summoned = true; - } - - DoMeleeAttackIfReady(); - } - - void JustSummoned(Creature* summon) OVERRIDE - { - switch (summon->GetEntry()) - { - case NPC_WHISKER: - summon->AI()->AttackStart(me->GetVictim()); - break; - case NPC_HUNGRY_PENGUIN: - if (Unit* affected = Unit::GetUnit(*me, _affectedGUID)) - { - if (affected->IsAlive()) - summon->AI()->AttackStart(affected); - } - break; - } - } - - void JustDied(Unit* killer) OVERRIDE - { - if (_whiskerGUID) - if (Creature* whisker = me->GetCreature(*me, _whiskerGUID)) - whisker->RemoveFromWorld(); - - if (killer->GetTypeId() == TYPEID_PLAYER) - killer->GetCharmerOrOwnerPlayerOrPlayerItself()->GroupEventHappens(QUEST_AMPHITHEATER_ANGUISH_TUSKARRMAGEDDON, killer); - - } - - private: - bool _summoned; - bool _battleShout; - bool _fishyScent; - uint32 uiBattleShoutTimer; - uint32 uiFishyScentTimer; - uint64 _affectedGUID; - uint64 _whiskerGUID; - }; - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_orinoko_tuskbreakerAI(creature); - } -}; - -/*#### -## npc_korrak_bloodrager -####*/ - -enum KorrakBloodrager -{ - SPELL_GROW = 55948, - SPELL_CHARGE = 24193, - SPELL_UPPERCUT = 30471, - SPELL_ENRAGE = 42745 -}; - -class npc_korrak_bloodrager : public CreatureScript -{ -public: - npc_korrak_bloodrager() : CreatureScript("npc_korrak_bloodrager") { } - - struct npc_korrak_bloodragerAI : public npc_escortAI - { - npc_korrak_bloodragerAI(Creature* creature) : npc_escortAI(creature) - { - Start(true, true, 0, NULL); - SetDespawnAtEnd(false); - } - - void Reset() OVERRIDE - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); - me->SetReactState(REACT_PASSIVE); - _enrage = false; - _chargeTimer = 15000; - _uppercutTimer = 12000; - - } - - void WaypointReached(uint32 waypointId) OVERRIDE - { - switch (waypointId) - { - case 6: - me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); - me->SetReactState(REACT_AGGRESSIVE); - break; - } - } - - void EnterCombat(Unit* /*who*/) OVERRIDE - { - DoCast(me, SPELL_GROW); - } - - void UpdateAI(uint32 diff) OVERRIDE - { - npc_escortAI::UpdateAI(diff); - - if (!UpdateVictim()) - return; - - if (_uppercutTimer <= diff) - { - if (Unit* target = SelectTarget(SELECT_TARGET_NEAREST, 0)) - DoCast(target, SPELL_UPPERCUT); - _uppercutTimer = 12000; - } else _uppercutTimer -= diff; - - if (_chargeTimer <= diff) - { - if (Unit* target = SelectTarget(SELECT_TARGET_FARTHEST, 0)) - DoCast(target, SPELL_CHARGE); - _chargeTimer = 15000; - } else _chargeTimer -= diff; - - if (!_enrage && !HealthAbovePct(20)) - { - DoCast(me, SPELL_ENRAGE); - _enrage = true; - } - DoMeleeAttackIfReady(); - } - - void JustDied(Unit* killer) OVERRIDE - { - if (Player* player = killer->GetCharmerOrOwnerPlayerOrPlayerItself()) - player->GroupEventHappens(QUEST_AMPHITHEATER_ANGUISH_KORRAK_BLOODRAGER, killer); - } - private: - bool _enrage; - uint32 _chargeTimer; - uint32 _uppercutTimer; - }; - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_korrak_bloodragerAI(creature); - } -}; - -/*#### -## npc_yggdras -####*/ - -enum Yggdras -{ - SPELL_CLEAVE = 40504, - SPELL_CORRODE_FLESH = 57076, - SPELL_JORMUNGAR_SPAWN = 55859 -}; - -class npc_yggdras : public CreatureScript -{ -public: - npc_yggdras() : CreatureScript("npc_yggdras") { } - - struct npc_yggdrasAI : public ScriptedAI - { - npc_yggdrasAI(Creature* creature) : ScriptedAI(creature) { } - - void Reset() OVERRIDE - { - _cleaveTimer = 9000; - _corrodeFleshTimer = 6000; - } - - void UpdateAI(uint32 diff) OVERRIDE - { - if (!UpdateVictim()) - return; - - if (me->GetVictim()->GetPositionZ() >= 286.276f) - { - std::list<HostileReference*> t_list = me->getThreatManager().getThreatList(); - for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) - { - if (Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid())) - { - if (unit->GetPositionZ() <= 286.276f) - { - me->getThreatManager().resetAllAggro(); - me->AddThreat(unit, 5.0f); - break; - } - EnterEvadeMode(); - } - } - } - - if (_cleaveTimer <= diff) - { - DoCastVictim(SPELL_CLEAVE); - _cleaveTimer = 9000; - } else _cleaveTimer -= diff; - - if (_corrodeFleshTimer <= diff) - { - DoCastVictim(SPELL_CORRODE_FLESH); - _corrodeFleshTimer = 6000; - } else _corrodeFleshTimer -= diff; - - DoMeleeAttackIfReady(); - } - - void JustDied(Unit* killer) OVERRIDE - { - if (Unit* summoner = me->ToTempSummon()->GetSummoner()) - { - std::string sText = (std::string(killer->GetName()) + " has defeated Yg.. Yggg-really big worm!"); - summoner->MonsterYell(sText.c_str(), LANG_UNIVERSAL, 0); - } - - if (Player* player = killer->GetCharmerOrOwnerPlayerOrPlayerItself()) - { - player->GroupEventHappens(QUEST_AMPHITHEATER_ANGUISH_YGGDRAS_1, killer); - player->GroupEventHappens(QUEST_AMPHITHEATER_ANGUISH_YGGDRAS_2, killer); - } - - for (uint8 i = 0; i < 3; ++i) - DoCast(killer, SPELL_JORMUNGAR_SPAWN, true); - } - private: - uint32 _cleaveTimer; - uint32 _corrodeFleshTimer; - }; - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_yggdrasAI(creature); - } -}; - -/*#### -## npc_stinkbeard -####*/ - -enum Stinkbeard -{ - SPELL_ENRAGE_STINKBEARD = 50420, - SPELL_KNOCK_AWAY = 31389, - SPELL_STINKY_BEARD = 55867, - SPELL_THUNDERBLADE = 55866, - SPELL_THUNDERCLAP = 15588 -}; - -class npc_stinkbeard : public CreatureScript -{ -public: - npc_stinkbeard() : CreatureScript("npc_stinkbeard") { } - - struct npc_stinkbeardAI : public npc_escortAI - { - npc_stinkbeardAI(Creature* creature) : npc_escortAI(creature) - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); - me->SetReactState(REACT_PASSIVE); - Start(true, true, 0, NULL); - SetDespawnAtEnd(false); - } - - void Reset() OVERRIDE - { - me->AddAura(SPELL_THUNDERBLADE, me); - uiKnockAwayTimer = 10000; - uiStinkyBeardTimer = 15000; - _enrage = false; - _thunderClap = false; - } - - void WaypointReached(uint32 waypointId) OVERRIDE - { - switch (waypointId) - { - case 7: - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); - me->SetReactState(REACT_AGGRESSIVE); - me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); - break; - } - } - - void UpdateAI(uint32 uiDiff) OVERRIDE - { - npc_escortAI::UpdateAI(uiDiff); - - if (!UpdateVictim()) - return; - - if (Unit* victim = me->GetVictim()) - { - if (victim->GetPositionZ() >= 286.276f) - { - std::list<HostileReference*> t_list = me->getThreatManager().getThreatList(); - for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) - { - if (Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid())) - { - if (unit->GetPositionZ() <= 286.276f) - { - me->getThreatManager().resetAllAggro(); - me->AddThreat(unit, 5.0f); - break; - } - EnterEvadeMode(); - } - } - } - } - - if (_thunderClap && !HealthAbovePct(10)) - { - DoCastAOE(SPELL_THUNDERCLAP); - _thunderClap = true; - } - - if (uiKnockAwayTimer <= uiDiff) - { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - { - if (target && target->IsAlive()) - DoCast(target, SPELL_KNOCK_AWAY); - } - uiKnockAwayTimer = 10000; - } else uiKnockAwayTimer -= uiDiff; - - if (uiStinkyBeardTimer <= uiDiff) - { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - { - if (target && target->IsAlive()) - DoCast(target, SPELL_STINKY_BEARD); - } - uiStinkyBeardTimer = 15000; - } else uiStinkyBeardTimer -= uiDiff; - - if (!_enrage && !HealthAbovePct(20)) - { - DoCast(me, SPELL_ENRAGE_STINKBEARD); - _enrage = true; - } - DoMeleeAttackIfReady(); - } - - void JustDied(Unit* killer) OVERRIDE - { - if (Player* player = killer->GetCharmerOrOwnerPlayerOrPlayerItself()) - player->GetCharmerOrOwnerPlayerOrPlayerItself()->GroupEventHappens(QUEST_AMPHITHEATER_ANGUISH_MAGNATAUR, killer); - - std::string sText = ("And with AUTHORITY, " + std::string(killer->GetName()) + " dominates the magnataur lord! Stinkbeard's clan is gonna miss him back home in the Dragonblight!"); - me->MonsterYell(sText.c_str(), LANG_UNIVERSAL, 0); - } - private: - bool _enrage; - bool _thunderClap; - uint32 uiKnockAwayTimer; - uint32 uiStinkyBeardTimer; - }; - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_stinkbeardAI(creature); - } -}; - -/*#### -## npc_elemental_lord -####*/ - -class npc_elemental_lord : public CreatureScript -{ -public: - npc_elemental_lord() : CreatureScript("npc_elemental_lord") { } - - struct npc_elemental_lordAI : public ScriptedAI - { - npc_elemental_lordAI(Creature* creature) : ScriptedAI(creature) { } - - std::list<uint64> SummonList; - - uint32 uiElementalSpellTimer; - - uint8 uiBossRandom; - uint32 uiSpellInfo; - - bool bAddAttack; - - void Reset() OVERRIDE - { - uiBossRandom = 0; - uiSpellInfo = 0; - uiElementalSpellTimer = urand(5000, 8000); - - bAddAttack = false; - } - - void SetData(uint32 uiData, uint32 uiValue) OVERRIDE - { - if (uiData == 1) - { - uiBossRandom = uiValue; - SummonAdds(); - } - } - - void SummonAdds() - { - if (!Boss[uiBossRandom].uiAdd) - return; - - SummonList.clear(); - - for (uint8 uiI = 0; uiI < 16; uiI++) - { - if (Creature* summon = me->SummonCreature(Boss[uiBossRandom].uiAdd, AddSpawnPosition[uiI])) - { - summon->AI()->SetData(1, uiBossRandom); - SummonList.push_back(summon->GetGUID()); - } - } - - } - - void EnterCombat(Unit* unit) OVERRIDE - { - if (!SummonList.empty()) - for (std::list<uint64>::const_iterator itr = SummonList.begin(); itr != SummonList.end(); ++itr) - { - if (Creature* temp = Unit::GetCreature(*me, *itr)) - { - temp->m_CombatDistance = 100.0f; // ugly hack? we are not in a instance sorry. :( - temp->AI()->AttackStart(unit); - } - } - } - - void UpdateAI(uint32 uiDiff) OVERRIDE - { - if (!UpdateVictim()) - return; - - if (me->GetVictim()->GetPositionZ() >= 286.276f) - { - std::list<HostileReference*> t_list = me->getThreatManager().getThreatList(); - for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) - { - if (Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid())) - { - if (unit->GetPositionZ() <= 286.276f) - { - me->getThreatManager().resetAllAggro(); - me->AddThreat(unit, 5.0f); - break; - } - EnterEvadeMode(); - } - } - } - - if (uiElementalSpellTimer <= uiDiff) - { - DoCastVictim(Boss[uiBossRandom].uiSpell); - - uiElementalSpellTimer = urand(5000, 8000); - } else uiElementalSpellTimer -= uiDiff; - - if (!bAddAttack && !HealthAbovePct(20)) - { - if (!SummonList.empty()) - for (std::list<uint64>::const_iterator itr = SummonList.begin(); itr != SummonList.end(); ++itr) - { - if (Creature* temp = Unit::GetCreature(*me, *itr)) - { - if (temp->GetPositionZ() >= 287.00f) - continue; - - if (temp->GetVictim()) - temp->GetMotionMaster()->MoveChase(temp->GetVictim()); - } - } - - bAddAttack = true; - } - - DoMeleeAttackIfReady(); - } - - void JustDied(Unit* killer) OVERRIDE - { - if (!SummonList.empty()) - for (std::list<uint64>::const_iterator itr = SummonList.begin(); itr != SummonList.end(); ++itr) - if (Creature* temp = Unit::GetCreature(*me, *itr)) - temp->DespawnOrUnsummon(); - - if (Player* player = killer->GetCharmerOrOwnerPlayerOrPlayerItself()) - player->GetCharmerOrOwnerPlayerOrPlayerItself()->GroupEventHappens(QUEST_AMPHITHEATER_ANGUISH_FROM_BEYOND, killer); - - std::string sText = (std::string(killer->GetName()) + " is victorious once more!"); - - if (Unit* summoner = me->ToTempSummon()->GetSummoner()) - summoner->MonsterYell(sText.c_str(), LANG_UNIVERSAL, 0); - } - }; - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_elemental_lordAI(creature); - } -}; - -/*#### -## npc_fiend_elemental -####*/ - -class npc_fiend_elemental : public CreatureScript -{ -public: - npc_fiend_elemental() : CreatureScript("npc_fiend_elemental") { } - - struct npc_fiend_elementalAI : public ScriptedAI - { - npc_fiend_elementalAI(Creature* creature) : ScriptedAI(creature) { } - - void Reset() OVERRIDE - { - if (me->GetPositionZ() >= 287.0f) - me->GetMotionMaster()->MoveIdle(); - - _spell = 0; - _missleTimer = urand(2000, 7000); - } - - void AttackStart(Unit* who) OVERRIDE - { - if (!who) - return; - - AttackStartNoMove(who); - } - - void SetData(uint32 Data, uint32 Value) OVERRIDE - { - if (Data == 1) - _spell = Boss[Value].uiAddSpell; - - } - - void UpdateAI(uint32 diff) OVERRIDE - { - if (!UpdateVictim()) - return; - - if (me->GetPositionZ() >= 287.0f) - { - if (_missleTimer <= diff) - { - if (_spell) // Sometimes it is 0, why? - DoCast(me, _spell); // this spell (what spell) is not supported ... YET! - _missleTimer = urand(2000, 7000); - } else _missleTimer -= diff; - } - - DoMeleeAttackIfReady(); - } - - private: - uint32 _missleTimer; - uint32 _spell; - }; - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_fiend_elementalAI(creature); - } -}; /*#### ## npc_released_offspring_harkoa @@ -1184,7 +205,8 @@ public: enum CrusadeRecruit { SPELL_QUEST_CREDIT = 50633, - QUEST_TROLL_PATROL_INTESTINAL_FORTITUDE = 12509 + QUEST_TROLL_PATROL_INTESTINAL_FORTITUDE = 12509, + SAY_RECRUIT = 0 }; enum CrusadeRecruitEvents @@ -1435,6 +457,8 @@ public: void Reset() OVERRIDE { + _playerGUID = 0; + _getingredienttry = 0; _events.ScheduleEvent(EVENT_TURN_TO_POT, urand(15000, 26000)); } @@ -1867,15 +891,8 @@ void AddSC_zuldrak() { new npc_drakuru_shackles(); new npc_captured_rageclaw(); - new npc_gurgthock(); - new npc_orinoko_tuskbreaker(); - new npc_korrak_bloodrager(); - new npc_yggdras(); - new npc_stinkbeard(); new npc_released_offspring_harkoa(); new npc_crusade_recruit(); - new npc_elemental_lord(); - new npc_fiend_elemental(); new go_scourge_enclosure(); new npc_alchemist_finklestein(); new go_finklesteins_cauldron(); diff --git a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp index 4f7ac113547..783e7b9f09b 100644 --- a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp +++ b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp @@ -68,6 +68,7 @@ public: void Reset() OVERRIDE { + myClass = CLASS_NONE; Class_Timer = 1000; } diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp index 718ac1667b8..3f90118ec8b 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp @@ -765,7 +765,7 @@ public: { EnterEvadeMode(); me->MonsterTextEmote(EMOTE_UNABLE_TO_SUMMON, 0); - TC_LOG_ERROR(LOG_FILTER_TSCR, "SD2 ERROR: Unable to summon Maiev Shadowsong (entry: 23197). Check your database to see if you have the proper SQL for Maiev Shadowsong (entry: 23197)"); + TC_LOG_ERROR("scripts", "SD2 ERROR: Unable to summon Maiev Shadowsong (entry: 23197). Check your database to see if you have the proper SQL for Maiev Shadowsong (entry: 23197)"); } } @@ -1990,7 +1990,7 @@ public: me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } - void EnterCombat(Unit* /*who*/)OVERRIDE { } + void EnterCombat(Unit* /*who*/) OVERRIDE { } void MoveInLineOfSight(Unit* who) OVERRIDE diff --git a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp index cf552abe042..057bb725c32 100644 --- a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp +++ b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp @@ -161,7 +161,7 @@ public: Council[1] = instance->GetData64(DATA_VERAS_DARKSHADOW); Council[2] = instance->GetData64(DATA_LADY_MALANDE); Council[3] = instance->GetData64(DATA_HIGH_NETHERMANCER_ZEREVOR); - } else TC_LOG_ERROR(LOG_FILTER_TSCR, ERROR_INST_DATA); + } else TC_LOG_ERROR("scripts", ERROR_INST_DATA); } void EnterCombat(Unit* /*who*/) OVERRIDE { } @@ -408,7 +408,7 @@ struct boss_illidari_councilAI : public ScriptedAI } else { - TC_LOG_ERROR(LOG_FILTER_TSCR, ERROR_INST_DATA); + TC_LOG_ERROR("scripts", ERROR_INST_DATA); EnterEvadeMode(); return; } @@ -456,7 +456,7 @@ struct boss_illidari_councilAI : public ScriptedAI { if (!instance) { - TC_LOG_ERROR(LOG_FILTER_TSCR, ERROR_INST_DATA); + TC_LOG_ERROR("scripts", ERROR_INST_DATA); return; } diff --git a/src/server/scripts/Outland/CMakeLists.txt b/src/server/scripts/Outland/CMakeLists.txt index 84cbbc3c30c..ab10ee2dfe4 100644 --- a/src/server/scripts/Outland/CMakeLists.txt +++ b/src/server/scripts/Outland/CMakeLists.txt @@ -43,9 +43,13 @@ set(scripts_STAT_SRCS Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp Outland/CoilfangReservoir/TheSlavePens/instance_the_slave_pens.cpp + Outland/CoilfangReservoir/TheSlavePens/the_slave_pens.h + Outland/CoilfangReservoir/TheSlavePens/boss_mennu_the_betrayer.cpp + Outland/CoilfangReservoir/TheSlavePens/boss_rokmar_the_crackler.cpp + Outland/CoilfangReservoir/TheSlavePens/boss_quagmirran.cpp + Outland/CoilfangReservoir/TheUnderbog/instance_the_underbog.cpp Outland/CoilfangReservoir/TheUnderbog/boss_hungarfen.cpp Outland/CoilfangReservoir/TheUnderbog/boss_the_black_stalker.cpp - Outland/CoilfangReservoir/TheUnderbog/instance_the_underbog.cpp Outland/zone_shattrath_city.cpp Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp Outland/TempestKeep/Mechanar/boss_pathaleon_the_calculator.cpp @@ -68,6 +72,9 @@ set(scripts_STAT_SRCS Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp Outland/TempestKeep/botanica/boss_warp_splinter.cpp Outland/TempestKeep/botanica/boss_laj.cpp + Outland/TempestKeep/arcatraz/boss_zereketh_the_unbound.cpp + Outland/TempestKeep/arcatraz/boss_dalliah_the_doomsayer.cpp + Outland/TempestKeep/arcatraz/boss_wrath_scryer_soccothrates.cpp Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp Outland/TempestKeep/arcatraz/instance_arcatraz.cpp Outland/TempestKeep/arcatraz/arcatraz.h diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp index 88ba950554a..784b7c59736 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp @@ -137,7 +137,7 @@ class instance_steam_vault : public InstanceMapScript if (GetBossState(DATA_MEKGINEER_STEAMRIGGER) == SPECIAL) HandleGameObject(MainChambersDoorGUID, true); - TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance Steamvault: Access panel used."); + TC_LOG_DEBUG("scripts", "Instance Steamvault: Access panel used."); } break; case DATA_MEKGINEER_STEAMRIGGER: @@ -146,7 +146,7 @@ class instance_steam_vault : public InstanceMapScript if (GetBossState(DATA_HYDROMANCER_THESPIA) == SPECIAL) HandleGameObject(MainChambersDoorGUID, true); - TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance Steamvault: Access panel used."); + TC_LOG_DEBUG("scripts", "Instance Steamvault: Access panel used."); } break; default: diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_mennu_the_betrayer.cpp b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_mennu_the_betrayer.cpp new file mode 100644 index 00000000000..ba59aa3b463 --- /dev/null +++ b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_mennu_the_betrayer.cpp @@ -0,0 +1,141 @@ +/* + * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +/* ScriptData +SDName: boss_mennu_the_betrayer +SD%Complete: 95% +SDComment: +SDCategory: Coilfang Reservoir, The Slave Pens +EndScriptData */ + +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "the_slave_pens.h" + +enum Say +{ + SAY_AGGRO = 0, + SAY_SLAY = 1, + SAY_DEATH = 2 +}; + +enum Spells +{ + SPELL_TAINTED_STONESKIN_TOTEM = 31985, // every 30 sec if health below 100% + SPELL_TAINTED_EARTHGRAB_TOTEM = 31981, // ? + SPELL_CORRUPTED_NOVA_TOTEM = 31991, // ? + SPELL_MENNUS_HEALING_WARD = 34980, // every 14 - 25 sec + SPELL_LIGHTNING_BOLT = 35010 // every 14 - 19 sec +}; + +enum Events +{ + EVENT_TAINTED_STONESKIN_TOTEM = 1, + EVENT_TAINTED_EARTHGRAB_TOTEM = 2, + EVENT_CORRUPTED_NOVA_TOTEM = 3, + EVENT_MENNUS_HEALING_WARD = 4, + EVENT_LIGHTNING_BOLT = 5 +}; + +class boss_mennu_the_betrayer : public CreatureScript +{ + public: + boss_mennu_the_betrayer() : CreatureScript("boss_mennu_the_betrayer") { } + + struct boss_mennu_the_betrayerAI : public BossAI + { + boss_mennu_the_betrayerAI(Creature* creature) : BossAI(creature, DATA_MENNU_THE_BETRAYER) { } + + void Reset() OVERRIDE + { + _Reset(); + } + + void JustDied(Unit* /*killer*/) OVERRIDE + { + _JustDied(); + Talk(SAY_DEATH); + } + + void EnterCombat(Unit* /*who*/) OVERRIDE + { + _EnterCombat(); + events.ScheduleEvent(EVENT_TAINTED_STONESKIN_TOTEM, 30000); + events.ScheduleEvent(EVENT_TAINTED_EARTHGRAB_TOTEM, 20000); + events.ScheduleEvent(EVENT_CORRUPTED_NOVA_TOTEM, 60000); + events.ScheduleEvent(EVENT_MENNUS_HEALING_WARD, urand(14000, 25000)); + events.ScheduleEvent(EVENT_LIGHTNING_BOLT, urand(14000, 19000)); + Talk(SAY_AGGRO); + } + + void KilledUnit(Unit* /*victim*/) OVERRIDE + { + Talk(SAY_SLAY); + } + + void UpdateAI(uint32 diff) OVERRIDE + { + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_TAINTED_STONESKIN_TOTEM: + if (HealthBelowPct(100)) + DoCast(me, SPELL_TAINTED_STONESKIN_TOTEM); + events.ScheduleEvent(EVENT_TAINTED_STONESKIN_TOTEM, 30000); + break; + case EVENT_TAINTED_EARTHGRAB_TOTEM: + DoCast(me, SPELL_TAINTED_EARTHGRAB_TOTEM); + break; + case EVENT_CORRUPTED_NOVA_TOTEM: + DoCast(me, SPELL_CORRUPTED_NOVA_TOTEM); + break; + case EVENT_MENNUS_HEALING_WARD: + DoCast(me, SPELL_MENNUS_HEALING_WARD); + events.ScheduleEvent(EVENT_MENNUS_HEALING_WARD, urand(14000, 25000)); + break; + case EVENT_LIGHTNING_BOLT: + DoCastVictim(SPELL_LIGHTNING_BOLT, true); + events.ScheduleEvent(EVENT_LIGHTNING_BOLT, urand(14000, 25000)); + break; + default: + break; + } + } + + DoMeleeAttackIfReady(); + } + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return new boss_mennu_the_betrayerAI(creature); + } +}; + +void AddSC_boss_mennu_the_betrayer() +{ + new boss_mennu_the_betrayer(); +} diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_quagmirran.cpp b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_quagmirran.cpp new file mode 100644 index 00000000000..6cef7291542 --- /dev/null +++ b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_quagmirran.cpp @@ -0,0 +1,124 @@ +/* + * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +/* ScriptData +SDName: boss_quagmirran +SD%Complete: 100% +SDComment: +SDCategory: Coilfang Reservoir, The Slave Pens +EndScriptData */ + +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "the_slave_pens.h" + +enum Spells +{ + SPELL_ACID_SPRAY = 38153, + SPELL_CLEAVE = 40504, + SPELL_UPPERCUT = 32055, + SPELL_POISON_BOLT_VOLLEY = 34780 // 39340 +}; + +enum Events +{ + EVENT_ACID_SPRAY = 1, + EVENT_CLEAVE = 2, + EVENT_UPPERCUT = 3, + EVENT_POISON_BOLT_VOLLEY = 4 +}; + +class boss_quagmirran : public CreatureScript +{ + public: + boss_quagmirran() : CreatureScript("boss_quagmirran") { } + + struct boss_quagmirranAI : public BossAI + { + boss_quagmirranAI(Creature* creature) : BossAI(creature, DATA_QUAGMIRRAN) { } + + void Reset() OVERRIDE + { + _Reset(); + } + + void JustDied(Unit* /*killer*/) OVERRIDE + { + _JustDied(); + } + + void EnterCombat(Unit* /*who*/) OVERRIDE + { + _EnterCombat(); + events.ScheduleEvent(EVENT_ACID_SPRAY, 25000); + events.ScheduleEvent(EVENT_CLEAVE, 9000); + events.ScheduleEvent(EVENT_UPPERCUT, 20000); + events.ScheduleEvent(EVENT_POISON_BOLT_VOLLEY, 31000); + } + + void KilledUnit(Unit* /*victim*/) OVERRIDE { } + + void UpdateAI(uint32 diff) OVERRIDE + { + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_ACID_SPRAY: + DoCastAOE(SPELL_ACID_SPRAY); + events.ScheduleEvent(EVENT_ACID_SPRAY, urand(20000, 25000)); + break; + case EVENT_CLEAVE: + DoCastVictim(SPELL_CLEAVE, true); + events.ScheduleEvent(EVENT_CLEAVE, urand(18000, 34000)); + break; + case EVENT_UPPERCUT: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 10.0f, true)) + DoCast(target, SPELL_UPPERCUT); + events.ScheduleEvent(EVENT_UPPERCUT, 22000); + break; + case EVENT_POISON_BOLT_VOLLEY: + DoCast(me, SPELL_POISON_BOLT_VOLLEY); + events.ScheduleEvent(EVENT_POISON_BOLT_VOLLEY, 24000); + break; + default: + break; + } + } + + DoMeleeAttackIfReady(); + } + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return new boss_quagmirranAI(creature); + } +}; + +void AddSC_boss_quagmirran() +{ + new boss_quagmirran(); +} diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_rokmar_the_crackler.cpp b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_rokmar_the_crackler.cpp new file mode 100644 index 00000000000..a025df5c3ae --- /dev/null +++ b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_rokmar_the_crackler.cpp @@ -0,0 +1,127 @@ +/* + * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +/* ScriptData +SDName: boss_rokmar_the_crackler +SD%Complete: 100% +SDComment: +SDCategory: Coilfang Reservoir, The Slave Pens +EndScriptData */ + +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "the_slave_pens.h" + +enum Spells +{ + SPELL_GRIEVOUS_WOUND = 31956, + SPELL_ENSNARING_MOSS = 31948, + SPELL_WATER_SPIT = 35008, + SPELL_FRENZY = 34970 +}; + +enum Events +{ + EVENT_GRIEVOUS_WOUND = 1, + EVENT_ENSNARING_MOSS = 2, + EVENT_WATER_SPIT = 3 +}; + +class boss_rokmar_the_crackler : public CreatureScript +{ + public: + boss_rokmar_the_crackler() : CreatureScript("boss_rokmar_the_crackler") { } + + struct boss_rokmar_the_cracklerAI : public BossAI + { + boss_rokmar_the_cracklerAI(Creature* creature) : BossAI(creature, DATA_MENNU_THE_BETRAYER) { } + + void Reset() OVERRIDE + { + _Reset(); + rokmarFrenzy = false; + } + + void JustDied(Unit* /*killer*/) OVERRIDE + { + _JustDied(); + } + + void EnterCombat(Unit* /*who*/) OVERRIDE + { + _EnterCombat(); + events.ScheduleEvent(EVENT_GRIEVOUS_WOUND, 10000); + events.ScheduleEvent(EVENT_ENSNARING_MOSS, 20000); + events.ScheduleEvent(EVENT_WATER_SPIT, 14000); + } + + void KilledUnit(Unit* /*victim*/) OVERRIDE { } + + void UpdateAI(uint32 diff) OVERRIDE + { + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_GRIEVOUS_WOUND: + DoCastVictim(SPELL_GRIEVOUS_WOUND, true); + events.ScheduleEvent(EVENT_GRIEVOUS_WOUND, urand(20000, 30000)); + break; + case EVENT_ENSNARING_MOSS: + DoCastAOE(SPELL_ENSNARING_MOSS); + events.ScheduleEvent(EVENT_ENSNARING_MOSS, urand(20000, 30000)); + break; + case EVENT_WATER_SPIT: + DoCastAOE(SPELL_WATER_SPIT); + events.ScheduleEvent(EVENT_WATER_SPIT, urand(14000, 18000)); + break; + default: + break; + } + } + + if (HealthBelowPct(10) && !rokmarFrenzy) + { + DoCast(me, SPELL_FRENZY); + rokmarFrenzy = true; + } + + DoMeleeAttackIfReady(); + } + + private: + bool rokmarFrenzy; + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return new boss_rokmar_the_cracklerAI(creature); + } +}; + +void AddSC_boss_rokmar_the_crackler() +{ + new boss_rokmar_the_crackler(); +} diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/instance_the_slave_pens.cpp b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/instance_the_slave_pens.cpp index cd11e2e1bf1..1c31bee7d4f 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/instance_the_slave_pens.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/instance_the_slave_pens.cpp @@ -24,11 +24,12 @@ gets instead the deserter debuff. #include "ScriptMgr.h" #include "InstanceScript.h" +#include "the_slave_pens.h" class instance_the_slave_pens : public InstanceMapScript { public: - instance_the_slave_pens() : InstanceMapScript("instance_the_slave_pens", 547) { } + instance_the_slave_pens() : InstanceMapScript(SPScriptName, 547) { } InstanceScript* GetInstanceScript(InstanceMap* map) const OVERRIDE { diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/the_slave_pens.h b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/the_slave_pens.h new file mode 100644 index 00000000000..624ead7ef08 --- /dev/null +++ b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/the_slave_pens.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef SLAVE_PENS_H +#define SLAVE_PENS_H + +uint32 const EncounterCount = 3; + +#define SPScriptName "instance_the_slave_pens" + +enum DataTypes +{ + DATA_MENNU_THE_BETRAYER = 1, + DATA_ROKMAR_THE_CRACKLER = 2, + DATA_QUAGMIRRAN = 3 +}; + +#endif // SLAVE_PENS_H diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp index f109dcf22ba..2f9e882d176 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp @@ -374,7 +374,7 @@ class boss_kaelthas : public CreatureScript if (!m_auiAdvisorGuid[0] || !m_auiAdvisorGuid[1] || !m_auiAdvisorGuid[2] || !m_auiAdvisorGuid[3]) { - TC_LOG_ERROR(LOG_FILTER_TSCR, "Kael'Thas One or more advisors missing, Skipping Phases 1-3"); + TC_LOG_ERROR("scripts", "Kael'Thas One or more advisors missing, Skipping Phases 1-3"); Talk(SAY_PHASE4_INTRO2); @@ -702,7 +702,7 @@ class boss_kaelthas : public CreatureScript Advisor = Unit::GetCreature(*me, m_auiAdvisorGuid[i]); if (!Advisor) - TC_LOG_ERROR(LOG_FILTER_TSCR, "SD2: Kael'Thas Advisor %u does not exist. Possibly despawned? Incorrectly Killed?", i); + TC_LOG_ERROR("scripts", "SD2: Kael'Thas Advisor %u does not exist. Possibly despawned? Incorrectly Killed?", i); else CAST_AI(advisorbase_ai, Advisor->AI())->Revive(target); } @@ -795,7 +795,7 @@ class boss_kaelthas : public CreatureScript if (me->getThreatManager().getThreatList().size() >= 2) for (uint32 i = 0; i < 3; ++i) { - TC_LOG_DEBUG(LOG_FILTER_TSCR, "Kael'Thas mind control not supported."); + TC_LOG_DEBUG("scripts", "Kael'Thas mind control not supported."); //DoCast(unit, SPELL_MIND_CONTROL); } diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp index 9c60c16d0af..c293a995467 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp @@ -16,7 +16,6 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ - #include "ScriptMgr.h" #include "InstanceScript.h" #include "mechanar.h" @@ -26,7 +25,7 @@ static DoorData const doorData[] = { GO_DOOR_MOARG_1, DATA_GATEWATCHER_IRON_HAND, DOOR_TYPE_PASSAGE, BOUNDARY_NONE }, { GO_DOOR_MOARG_2, DATA_GATEWATCHER_GYROKILL, DOOR_TYPE_PASSAGE, BOUNDARY_NONE }, { GO_DOOR_NETHERMANCER, DATA_NETHERMANCER_SEPRETHREA, DOOR_TYPE_ROOM, BOUNDARY_NONE }, - {0, 0, DOOR_TYPE_ROOM, BOUNDARY_NONE } + { 0, 0, DOOR_TYPE_ROOM, BOUNDARY_NONE } }; class instance_mechanar : public InstanceMapScript @@ -42,7 +41,6 @@ class instance_mechanar : public InstanceMapScript LoadDoorData(doorData); } - void OnGameObjectCreate(GameObject* gameObject) { switch (gameObject->GetEntry()) diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp index 9206636893c..ff3145c5c78 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp @@ -69,11 +69,8 @@ enum MillhouseSpells class npc_millhouse_manastorm : public CreatureScript { public: + npc_millhouse_manastorm() : CreatureScript("npc_millhouse_manastorm") { } - npc_millhouse_manastorm() - : CreatureScript("npc_millhouse_manastorm") - { - } struct npc_millhouse_manastormAI : public ScriptedAI { npc_millhouse_manastormAI(Creature* creature) : ScriptedAI(creature) @@ -101,14 +98,11 @@ class npc_millhouse_manastorm : public CreatureScript Pyroblast_Timer = 1000; Fireball_Timer = 2500; - if (instance) - { - if (instance->GetData(TYPE_WARDEN_2) == DONE) - Init = true; + if (instance->GetData(DATA_WARDEN_2) == DONE) + Init = true; - if (instance->GetData(TYPE_HARBINGERSKYRISS) == DONE) - Talk(SAY_COMPLETE); - } + if (instance->GetBossState(DATA_HARBINGER_SKYRISS) == DONE) + Talk(SAY_COMPLETE); } void AttackStart(Unit* who) OVERRIDE @@ -122,7 +116,7 @@ class npc_millhouse_manastorm : public CreatureScript } } - void EnterCombat(Unit* /*who*/)OVERRIDE { } + void EnterCombat(Unit* /*who*/) OVERRIDE { } void KilledUnit(Unit* /*victim*/) OVERRIDE { @@ -134,7 +128,7 @@ class npc_millhouse_manastorm : public CreatureScript Talk(SAY_DEATH); /*for questId 10886 (heroic mode only) - if (instance && instance->GetData(TYPE_HARBINGERSKYRISS) != DONE) + if (instance->GetBossState(DATA_HARBINGER_SKYRISS) != DONE) ->FailQuest();*/ } @@ -176,8 +170,7 @@ class npc_millhouse_manastorm : public CreatureScript EventProgress_Timer = 6000; break; case 7: - if (instance) - instance->SetData(TYPE_WARDEN_2, DONE); + instance->SetData(DATA_WARDEN_2, DONE); Init = true; break; } @@ -223,7 +216,7 @@ class npc_millhouse_manastorm : public CreatureScript CreatureAI* GetAI(Creature* creature) const OVERRIDE { - return new npc_millhouse_manastormAI(creature); + return GetArcatrazAI<npc_millhouse_manastormAI>(creature); } }; /*##### @@ -273,10 +266,7 @@ enum WardenSpells class npc_warden_mellichar : public CreatureScript { public: - - npc_warden_mellichar() : CreatureScript("npc_warden_mellichar") - { - } + npc_warden_mellichar() : CreatureScript("npc_warden_mellichar") { } struct npc_warden_mellicharAI : public ScriptedAI { @@ -304,14 +294,12 @@ class npc_warden_mellichar : public CreatureScript me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); DoCast(me, SPELL_TARGET_OMEGA); - if (instance) - instance->SetData(TYPE_HARBINGERSKYRISS, NOT_STARTED); + instance->SetBossState(DATA_HARBINGER_SKYRISS, NOT_STARTED); } void AttackStart(Unit* /*who*/) OVERRIDE { } void MoveInLineOfSight(Unit* who) OVERRIDE - { if (IsRunning) return; @@ -334,69 +322,60 @@ class npc_warden_mellichar : public CreatureScript Talk(YELL_INTRO1); DoCast(me, SPELL_BUBBLE_VISUAL); - if (instance) - { - instance->SetData(TYPE_HARBINGERSKYRISS, IN_PROGRESS); - instance->HandleGameObject(instance->GetData64(DATA_SPHERE_SHIELD), false); - IsRunning = true; - } + instance->SetBossState(DATA_HARBINGER_SKYRISS, IN_PROGRESS); + instance->HandleGameObject(instance->GetData64(DATA_WARDENS_SHIELD), false); + IsRunning = true; } bool CanProgress() { - if (instance) - { - if (Phase == 7 && instance->GetData(TYPE_WARDEN_4) == DONE) - return true; - if (Phase == 6 && instance->GetData(TYPE_WARDEN_3) == DONE) - return true; - if (Phase == 5 && instance->GetData(TYPE_WARDEN_2) == DONE) - return true; - if (Phase == 4) - return true; - if (Phase == 3 && instance->GetData(TYPE_WARDEN_1) == DONE) - return true; - if (Phase == 2 && instance->GetData(TYPE_HARBINGERSKYRISS) == IN_PROGRESS) - return true; - if (Phase == 1 && instance->GetData(TYPE_HARBINGERSKYRISS) == IN_PROGRESS) - return true; - return false; - } + if (Phase == 7 && instance->GetData(DATA_WARDEN_4) == DONE) + return true; + if (Phase == 6 && instance->GetData(DATA_WARDEN_3) == DONE) + return true; + if (Phase == 5 && instance->GetData(DATA_WARDEN_2) == DONE) + return true; + if (Phase == 4) + return true; + if (Phase == 3 && instance->GetData(DATA_WARDEN_1) == DONE) + return true; + if (Phase == 2 && instance->GetBossState(DATA_HARBINGER_SKYRISS) == IN_PROGRESS) + return true; + if (Phase == 1 && instance->GetBossState(DATA_HARBINGER_SKYRISS) == IN_PROGRESS) + return true; + return false; } void DoPrepareForPhase() { - if (instance) - { - me->InterruptNonMeleeSpells(true); - me->RemoveAurasByType(SPELL_AURA_DUMMY); + me->InterruptNonMeleeSpells(true); + me->RemoveAurasByType(SPELL_AURA_DUMMY); - switch (Phase) - { + switch (Phase) + { case 2: DoCast(me, SPELL_TARGET_ALPHA); - instance->SetData(TYPE_WARDEN_1, IN_PROGRESS); - instance->HandleGameObject(instance->GetData64(DATA_SPHERE_SHIELD), false); + instance->SetData(DATA_WARDEN_1, IN_PROGRESS); + instance->HandleGameObject(instance->GetData64(DATA_WARDENS_SHIELD), false); break; case 3: DoCast(me, SPELL_TARGET_BETA); - instance->SetData(TYPE_WARDEN_2, IN_PROGRESS); + instance->SetData(DATA_WARDEN_2, IN_PROGRESS); break; case 5: DoCast(me, SPELL_TARGET_DELTA); - instance->SetData(TYPE_WARDEN_3, IN_PROGRESS); + instance->SetData(DATA_WARDEN_3, IN_PROGRESS); break; case 6: DoCast(me, SPELL_TARGET_GAMMA); - instance->SetData(TYPE_WARDEN_4, IN_PROGRESS); + instance->SetData(DATA_WARDEN_4, IN_PROGRESS); break; case 7: - instance->SetData(TYPE_WARDEN_5, IN_PROGRESS); + instance->SetData(DATA_WARDEN_5, IN_PROGRESS); break; - } - CanSpawn = true; } + CanSpawn = true; } void UpdateAI(uint32 diff) OVERRIDE @@ -406,13 +385,10 @@ class npc_warden_mellichar : public CreatureScript if (EventProgress_Timer <= diff) { - if (instance) + if (instance->GetBossState(DATA_HARBINGER_SKYRISS) == FAIL) { - if (instance->GetData(TYPE_HARBINGERSKYRISS) == FAIL) - { - Reset(); - return; - } + Reset(); + return; } if (CanSpawn) @@ -517,7 +493,7 @@ class npc_warden_mellichar : public CreatureScript CreatureAI* GetAI(Creature* creature) const OVERRIDE { - return new npc_warden_mellicharAI(creature); + return GetArcatrazAI<npc_warden_mellicharAI>(creature); } }; diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.h b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.h index 37839d4794d..1ebfad4dfeb 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.h +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.h @@ -1,6 +1,5 @@ /* * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> - * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -16,23 +15,56 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef ARCATRAZ_H_ -#define ARCATRAZ_H_ +#ifndef ARCATRAZ_H +#define ARCATRAZ_H + +#define ArcatrazScriptName "instance_arcatraz" + +uint32 const EncounterCount = 4; enum DataTypes { - TYPE_ZEREKETH = 1, - TYPE_DALLIAH = 2, - TYPE_SOCCOTHRATES = 3, - TYPE_HARBINGERSKYRISS = 4, - TYPE_WARDEN_1 = 5, - TYPE_WARDEN_2 = 6, - TYPE_WARDEN_3 = 7, - TYPE_WARDEN_4 = 8, - TYPE_WARDEN_5 = 9, - DATA_MELLICHAR = 10, - TYPE_SHIELD_OPEN = 11, - DATA_SPHERE_SHIELD = 12 + // Encounter States/Boss GUIDs + DATA_ZEREKETH = 0, + DATA_DALLIAH = 1, + DATA_SOCCOTHRATES = 2, + DATA_HARBINGER_SKYRISS = 3, + + // Additional Data + DATA_CONVERSATION = 4, + DATA_WARDEN_1 = 5, // used by EventAI + DATA_WARDEN_2 = 6, // used by EventAI + DATA_WARDEN_3 = 7, // used by EventAI + DATA_WARDEN_4 = 8, // used by EventAI + DATA_WARDEN_5 = 9, // used by EventAI + DATA_MELLICHAR = 10, + DATA_WARDENS_SHIELD = 11 +}; + +enum CreatureIds +{ + NPC_DALLIAH = 20885, + NPC_SOCCOTHRATES = 20886, + NPC_MELLICHAR = 20904, // skyriss will kill this unit + NPC_ALPHA_POD_TARGET = 21436 }; -#endif // ARCATRAZ_H_ +enum GameObjectIds +{ + GO_CONTAINMENT_CORE_SECURITY_FIELD_ALPHA = 184318, // door opened when Wrath-Scryer Soccothrates dies + GO_CONTAINMENT_CORE_SECURITY_FIELD_BETA = 184319, // door opened when Dalliah the Doomsayer dies + GO_STASIS_POD_ALPHA = 183961, // pod first boss wave + GO_STASIS_POD_BETA = 183963, // pod second boss wave + GO_STASIS_POD_DELTA = 183964, // pod third boss wave + GO_STASIS_POD_GAMMA = 183962, // pod fourth boss wave + GO_STASIS_POD_OMEGA = 183965, // pod fifth boss wave + GO_WARDENS_SHIELD = 184802 // shield 'protecting' mellichar +}; + +template<class AI> +AI* GetArcatrazAI(Creature* creature) +{ + return GetInstanceAI<AI>(creature, ArcatrazScriptName); +} + +#endif // ARCATRAZ_H diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_dalliah_the_doomsayer.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_dalliah_the_doomsayer.cpp new file mode 100644 index 00000000000..36377b4d715 --- /dev/null +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_dalliah_the_doomsayer.cpp @@ -0,0 +1,194 @@ +/* + * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "arcatraz.h" + +enum Say +{ + // Dalliah the Doomsayer + SAY_AGGRO = 1, + SAY_SLAY = 2, + SAY_WHIRLWIND = 3, + SAY_HEAL = 4, + SAY_DEATH = 5, + SAY_SOCCOTHRATES_DEATH = 7, + + // Wrath-Scryer Soccothrates + SAY_AGGRO_DALLIAH_FIRST = 0, + SAY_DALLIAH_25_PERCENT = 5 +}; + +enum Spells +{ + SPELL_GIFT_OF_THE_DOOMSAYER = 36173, + SPELL_WHIRLWIND = 36142, + SPELL_HEAL = 36144, + SPELL_SHADOW_WAVE = 39016 // Heroic only +}; + +enum Events +{ + EVENT_GIFT_OF_THE_DOOMSAYER = 1, + EVENT_WHIRLWIND = 2, + EVENT_HEAL = 3, + EVENT_SHADOW_WAVE = 4, // Heroic only + EVENT_ME_FIRST = 5, + EVENT_SOCCOTHRATES_DEATH = 6 +}; + +class boss_dalliah_the_doomsayer : public CreatureScript +{ + public: + boss_dalliah_the_doomsayer() : CreatureScript("boss_dalliah_the_doomsayer") { } + + struct boss_dalliah_the_doomsayerAI : public BossAI + { + boss_dalliah_the_doomsayerAI(Creature* creature) : BossAI(creature, DATA_DALLIAH) { } + + void Reset() OVERRIDE + { + _Reset(); + soccothratesDeath = false; + } + + void JustDied(Unit* /*killer*/) OVERRIDE + { + _JustDied(); + Talk(SAY_DEATH); + + if (Creature* soccothrates = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SOCCOTHRATES))) + if (soccothrates->IsAlive() && !soccothrates->IsInCombat()) + soccothrates->AI()->SetData(1, 1); + } + + void EnterCombat(Unit* /*who*/) OVERRIDE + { + _EnterCombat(); + events.ScheduleEvent(EVENT_GIFT_OF_THE_DOOMSAYER, urand(1000, 4000)); + events.ScheduleEvent(EVENT_WHIRLWIND, urand(7000, 9000)); + if (IsHeroic()) + events.ScheduleEvent(EVENT_SHADOW_WAVE, urand(11000, 16000)); + events.ScheduleEvent(EVENT_ME_FIRST, 6000); + Talk(SAY_AGGRO); + } + + void KilledUnit(Unit* /*victim*/) OVERRIDE + { + Talk(SAY_SLAY); + } + + void SetData(uint32 /*type*/, uint32 data) OVERRIDE + { + switch (data) + { + case 1: + events.ScheduleEvent(EVENT_SOCCOTHRATES_DEATH, 6000); + soccothratesDeath = true; + break; + default: + break; + } + } + + void UpdateAI(uint32 diff) OVERRIDE + { + if (!UpdateVictim()) + { + if (soccothratesDeath) + { + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_SOCCOTHRATES_DEATH: + Talk(SAY_SOCCOTHRATES_DEATH); + break; + default: + break; + } + } + } + + return; + } + + events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_GIFT_OF_THE_DOOMSAYER: + DoCastVictim(SPELL_GIFT_OF_THE_DOOMSAYER, true); + events.ScheduleEvent(EVENT_GIFT_OF_THE_DOOMSAYER, urand(16000, 21000)); + break; + case EVENT_WHIRLWIND: + DoCast(me, SPELL_WHIRLWIND); + Talk(SAY_WHIRLWIND); + events.ScheduleEvent(EVENT_WHIRLWIND, urand(19000, 21000)); + events.ScheduleEvent(EVENT_HEAL, 6000); + break; + case EVENT_HEAL: + DoCast(me, SPELL_HEAL); + Talk(SAY_HEAL); + break; + case EVENT_SHADOW_WAVE: + DoCastVictim(SPELL_SHADOW_WAVE, true); + events.ScheduleEvent(EVENT_SHADOW_WAVE, urand(11000, 16000)); + break; + case EVENT_ME_FIRST: + if (Creature* soccothrates = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SOCCOTHRATES))) + if (soccothrates->IsAlive() && !soccothrates->IsInCombat()) + soccothrates->AI()->Talk(SAY_AGGRO_DALLIAH_FIRST); + break; + default: + break; + } + } + + if (HealthBelowPct(25) && !soccothratesTaunt) + { + if (Creature* soccothrates = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SOCCOTHRATES))) + soccothrates->AI()->Talk(SAY_DALLIAH_25_PERCENT); + soccothratesTaunt = true; + } + + DoMeleeAttackIfReady(); + } + + private: + bool soccothratesTaunt; + bool soccothratesDeath; + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return GetArcatrazAI<boss_dalliah_the_doomsayerAI>(creature); + } +}; + +void AddSC_boss_dalliah_the_doomsayer() +{ + new boss_dalliah_the_doomsayer(); +} diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp index eda90d3b734..48d955acbc3 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp @@ -61,21 +61,15 @@ enum Spells class boss_harbinger_skyriss : public CreatureScript { public: + boss_harbinger_skyriss() : CreatureScript("boss_harbinger_skyriss") { } - boss_harbinger_skyriss() - : CreatureScript("boss_harbinger_skyriss") + struct boss_harbinger_skyrissAI : public BossAI { - } - struct boss_harbinger_skyrissAI : public ScriptedAI - { - boss_harbinger_skyrissAI(Creature* creature) : ScriptedAI(creature) + boss_harbinger_skyrissAI(Creature* creature) : BossAI(creature, DATA_HARBINGER_SKYRISS) { - instance = creature->GetInstanceScript(); Intro = false; } - InstanceScript* instance; - bool Intro; bool IsImage33; bool IsImage66; @@ -104,7 +98,6 @@ class boss_harbinger_skyriss : public CreatureScript } void MoveInLineOfSight(Unit* who) OVERRIDE - { if (!Intro) return; @@ -117,8 +110,7 @@ class boss_harbinger_skyriss : public CreatureScript void JustDied(Unit* /*killer*/) OVERRIDE { Talk(SAY_DEATH); - if (instance) - instance->SetData(TYPE_HARBINGERSKYRISS, DONE); + _JustDied(); } void JustSummoned(Creature* summon) OVERRIDE @@ -137,7 +129,7 @@ class boss_harbinger_skyriss : public CreatureScript void KilledUnit(Unit* victim) OVERRIDE { //won't yell killing pet/other unit - if (victim->GetEntry() == 21436) + if (victim->GetEntry() == NPC_ALPHA_POD_TARGET) return; Talk(SAY_KILL); @@ -160,27 +152,24 @@ class boss_harbinger_skyriss : public CreatureScript { if (!Intro) { - if (!instance) - return; - if (Intro_Timer <= diff) { switch (Intro_Phase) { case 1: Talk(SAY_INTRO); - instance->HandleGameObject(instance->GetData64(DATA_SPHERE_SHIELD), true); + instance->HandleGameObject(instance->GetData64(DATA_WARDENS_SHIELD), true); ++Intro_Phase; Intro_Timer = 25000; break; case 2: Talk(SAY_AGGRO); - if (Unit* mellic = Unit::GetUnit(*me, instance->GetData64(DATA_MELLICHAR))) + if (Unit* mellic = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_MELLICHAR))) { //should have a better way to do this. possibly spell exist. mellic->setDeathState(JUST_DIED); mellic->SetHealth(0); - instance->SetData(TYPE_SHIELD_OPEN, IN_PROGRESS); + instance->HandleGameObject(instance->GetData64(DATA_WARDENS_SHIELD), false); } ++Intro_Phase; Intro_Timer = 3000; @@ -275,18 +264,15 @@ class boss_harbinger_skyriss : public CreatureScript CreatureAI* GetAI(Creature* creature) const OVERRIDE { - return new boss_harbinger_skyrissAI(creature); + return GetArcatrazAI<boss_harbinger_skyrissAI>(creature); } }; class boss_harbinger_skyriss_illusion : public CreatureScript { public: + boss_harbinger_skyriss_illusion() : CreatureScript("boss_harbinger_skyriss_illusion") { } - boss_harbinger_skyriss_illusion() - : CreatureScript("boss_harbinger_skyriss_illusion") - { - } struct boss_harbinger_skyriss_illusionAI : public ScriptedAI { boss_harbinger_skyriss_illusionAI(Creature* creature) : ScriptedAI(creature) { } diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_wrath_scryer_soccothrates.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_wrath_scryer_soccothrates.cpp new file mode 100644 index 00000000000..2d9bfc92583 --- /dev/null +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_wrath_scryer_soccothrates.cpp @@ -0,0 +1,283 @@ +/* + * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +/* ScriptData +SDName: boss_wrath_scryer_soccothrates +SD%Complete: 95% +SDComment: charge left to script +SDCategory: Tempest Keep, The Arcatraz +EndScriptData */ + +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "arcatraz.h" + +enum Say +{ + // Wrath-Scryer Soccothrates + SAY_AGGRO = 1, + SAY_SLAY = 2, + SAY_KNOCK_AWAY = 3, + SAY_DEATH = 4, + SAY_DALLIAH_DEATH = 6, + SAY_SOCCOTHRATES_CONVO_1 = 7, + SAY_SOCCOTHRATES_CONVO_2 = 8, + SAY_SOCCOTHRATES_CONVO_3 = 9, + SAY_SOCCOTHRATES_CONVO_4 = 10, + + // Dalliah the Doomsayer + SAY_AGGRO_SOCCOTHRATES_FIRST = 0, + SAY_SOCCOTHRATES_25_PERCENT = 6, + SAY_DALLIAH_CONVO_1 = 8, + SAY_DALLIAH_CONVO_2 = 9, + SAY_DALLIAH_CONVO_3 = 10 +}; + +enum Spells +{ + SPELL_FEL_IMMOLATION = 36051, + SPELL_FELFIRE_SHOCK = 35759, + SPELL_KNOCK_AWAY = 36512, + SPELL_FELFIRE_LINE_UP = 35770, + SPELL_CHARGE_TARGETING = 36038, + SPELL_CHARGE = 35754 +}; + +enum Events +{ + EVENT_FELFIRE_SHOCK = 1, + EVENT_KNOCK_AWAY = 2, + + EVENT_PREFIGHT_1 = 3, + EVENT_PREFIGHT_2 = 4, + EVENT_PREFIGHT_3 = 5, + EVENT_PREFIGHT_4 = 6, + EVENT_PREFIGHT_5 = 7, + EVENT_PREFIGHT_6 = 8, + EVENT_PREFIGHT_7 = 9, + EVENT_PREFIGHT_8 = 10, + EVENT_PREFIGHT_9 = 11, + EVENT_ME_FIRST = 12, + EVENT_DALLIAH_DEATH = 13 +}; + +class boss_wrath_scryer_soccothrates : public CreatureScript +{ + public: + boss_wrath_scryer_soccothrates() : CreatureScript("boss_wrath_scryer_soccothrates") { } + + struct boss_wrath_scryer_soccothratesAI : public BossAI + { + boss_wrath_scryer_soccothratesAI(Creature* creature) : BossAI(creature, DATA_SOCCOTHRATES) { } + + void Reset() OVERRIDE + { + _Reset(); + preFight = false; + dalliahTaunt = false; + dalliahDeath = false; + DoCast(me, SPELL_FEL_IMMOLATION); + } + + void JustDied(Unit* /*killer*/) OVERRIDE + { + _JustDied(); + Talk(SAY_DEATH); + + if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DALLIAH))) + if (dalliah->IsAlive() && !dalliah->IsInCombat()) + dalliah->AI()->SetData(1, 1); + } + + void EnterCombat(Unit* /*who*/) OVERRIDE + { + _EnterCombat(); + events.ScheduleEvent(EVENT_FELFIRE_SHOCK, urand(12000, 14000)); + events.ScheduleEvent(EVENT_KNOCK_AWAY, urand(11000, 12000)); + events.ScheduleEvent(EVENT_ME_FIRST, 6000); + Talk(SAY_AGGRO); + preFight = false; + } + + void KilledUnit(Unit* /*victim*/) OVERRIDE + { + Talk(SAY_SLAY); + } + + void MoveInLineOfSight(Unit* who) OVERRIDE + { + if (instance->GetData(DATA_CONVERSATION) == NOT_STARTED && who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 70.0f)) + { + Talk(SAY_SOCCOTHRATES_CONVO_1); + instance->SetData(DATA_CONVERSATION, DONE); + + preFight = true; + events.ScheduleEvent(EVENT_PREFIGHT_1, 2000); + } + } + + void SetData(uint32 /*type*/, uint32 data) OVERRIDE + { + switch (data) + { + case 1: + events.ScheduleEvent(EVENT_DALLIAH_DEATH, 6000); + dalliahDeath = true; + break; + default: + break; + } + } + + void UpdateAI(uint32 diff) OVERRIDE + { + if (!UpdateVictim()) + { + if (preFight) + { + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_PREFIGHT_1: + if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DALLIAH))) + dalliah->AI()->Talk(SAY_DALLIAH_CONVO_1); + events.ScheduleEvent(EVENT_PREFIGHT_2, 3000); + break; + case EVENT_PREFIGHT_2: + Talk(SAY_SOCCOTHRATES_CONVO_2); + events.ScheduleEvent(EVENT_PREFIGHT_3, 3000); + break; + case EVENT_PREFIGHT_3: + if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DALLIAH))) + dalliah->AI()->Talk(SAY_DALLIAH_CONVO_2); + events.ScheduleEvent(EVENT_PREFIGHT_4, 6000); + break; + case EVENT_PREFIGHT_4: + Talk(SAY_SOCCOTHRATES_CONVO_3); + events.ScheduleEvent(EVENT_PREFIGHT_5, 2000); + break; + case EVENT_PREFIGHT_5: + if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DALLIAH))) + dalliah->AI()->Talk(SAY_DALLIAH_CONVO_3); + events.ScheduleEvent(EVENT_PREFIGHT_6, 3000); + break; + case EVENT_PREFIGHT_6: + Talk(SAY_SOCCOTHRATES_CONVO_4); + events.ScheduleEvent(EVENT_PREFIGHT_7, 2000); + break; + case EVENT_PREFIGHT_7: + if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DALLIAH))) + dalliah->GetMotionMaster()->MovePoint(0, 118.6048f, 96.84852f, 22.44115f); + events.ScheduleEvent(EVENT_PREFIGHT_8, 4000); + break; + case EVENT_PREFIGHT_8: + me->GetMotionMaster()->MovePoint(0, 122.1035f, 192.7203f, 22.44115f); + events.ScheduleEvent(EVENT_PREFIGHT_9, 4000); + break; + case EVENT_PREFIGHT_9: + if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DALLIAH))) + { + dalliah->SetFacingToObject(me); + me->SetFacingToObject(dalliah); + dalliah->SetHomePosition(dalliah->GetPositionX(), dalliah->GetPositionY(), dalliah->GetPositionZ(), 1.51737f); + me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 4.725722f); + preFight = false; + } + break; + default: + break; + } + } + } + + if (dalliahDeath) + { + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_DALLIAH_DEATH: + Talk(SAY_DALLIAH_DEATH); + break; + default: + break; + } + } + } + + return; + } + + events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_FELFIRE_SHOCK: + DoCastVictim(SPELL_FELFIRE_SHOCK, true); + events.ScheduleEvent(EVENT_FELFIRE_SHOCK, urand(12000, 14000)); + break; + case EVENT_KNOCK_AWAY: + DoCast(me, SPELL_KNOCK_AWAY); + Talk(SAY_KNOCK_AWAY); + events.ScheduleEvent(EVENT_KNOCK_AWAY, urand(11000, 12000)); + break; + case EVENT_ME_FIRST: + if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DALLIAH))) + if (dalliah->IsAlive() && !dalliah->IsInCombat()) + dalliah->AI()->Talk(SAY_AGGRO_SOCCOTHRATES_FIRST); + break; + default: + break; + } + } + + if (HealthBelowPct(25) && !dalliahTaunt) + { + if (Creature* dalliah = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DALLIAH))) + dalliah->AI()->Talk(SAY_SOCCOTHRATES_25_PERCENT); + dalliahTaunt = true; + } + + DoMeleeAttackIfReady(); + } + + private: + bool preFight; + bool dalliahTaunt; + bool dalliahDeath; + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return GetArcatrazAI<boss_wrath_scryer_soccothratesAI>(creature); + } +}; + +void AddSC_boss_wrath_scryer_soccothrates() +{ + new boss_wrath_scryer_soccothrates(); +} diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_zereketh_the_unbound.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_zereketh_the_unbound.cpp new file mode 100644 index 00000000000..7659f191ff7 --- /dev/null +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_zereketh_the_unbound.cpp @@ -0,0 +1,125 @@ +/* + * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "arcatraz.h" + +enum Say +{ + SAY_AGGRO = 0, + SAY_SLAY = 1, + SAY_SHADOW_NOVA = 2, + SAY_DEATH = 3 +}; + +enum Spells +{ + SPELL_VOID_ZONE = 36119, + SPELL_SHADOW_NOVA = 36127, + SPELL_SEED_OF_CORRUPTION = 36123 +}; + +enum Events +{ + EVENT_VOID_ZONE = 1, + EVENT_SHADOW_NOVA = 2, + EVENT_SEED_OF_CORRUPTION = 3 +}; + +class boss_zereketh_the_unbound : public CreatureScript +{ + public: + boss_zereketh_the_unbound() : CreatureScript("boss_zereketh_the_unbound") { } + + struct boss_zereketh_the_unboundAI : public BossAI + { + boss_zereketh_the_unboundAI(Creature* creature) : BossAI(creature, DATA_ZEREKETH) { } + + void Reset() OVERRIDE + { + _Reset(); + } + + void JustDied(Unit* /*killer*/) OVERRIDE + { + _JustDied(); + Talk(SAY_DEATH); + } + + void EnterCombat(Unit* /*who*/) OVERRIDE + { + _EnterCombat(); + events.ScheduleEvent(EVENT_VOID_ZONE, urand (6000, 10000)); + events.ScheduleEvent(EVENT_SHADOW_NOVA, urand (6000, 10000)); + events.ScheduleEvent(EVENT_SEED_OF_CORRUPTION, urand(12000, 20000)); + Talk(SAY_AGGRO); + } + + void KilledUnit(Unit* /*victim*/) OVERRIDE + { + Talk(SAY_SLAY); + } + + void UpdateAI(uint32 diff) OVERRIDE + { + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_VOID_ZONE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true)) + DoCast(target, SPELL_VOID_ZONE); + events.ScheduleEvent(EVENT_VOID_ZONE, urand (6000, 10000)); + break; + case EVENT_SHADOW_NOVA: + DoCastVictim(SPELL_SHADOW_NOVA, true); + Talk(SAY_SHADOW_NOVA); + events.ScheduleEvent(EVENT_SHADOW_NOVA, urand (6000, 10000)); + break; + case EVENT_SEED_OF_CORRUPTION: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true)) + DoCast(target, SPELL_SEED_OF_CORRUPTION); + events.ScheduleEvent(EVENT_SEED_OF_CORRUPTION, urand(12000, 20000)); + break; + default: + break; + } + } + + DoMeleeAttackIfReady(); + } + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return new boss_zereketh_the_unboundAI(creature); + } +}; + +void AddSC_boss_zereketh_the_unbound() +{ + new boss_zereketh_the_unbound(); +} diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp index e836c5c4bf9..cb7cd3828e2 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp @@ -1,6 +1,5 @@ /* * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/> - * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -16,217 +15,120 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* ScriptData -SDName: Instance_Arcatraz -SD%Complete: 80 -SDComment: Mainly Harbringer Skyriss event -SDCategory: Tempest Keep, The Arcatraz -EndScriptData */ - #include "ScriptMgr.h" #include "InstanceScript.h" #include "arcatraz.h" -#define MAX_ENCOUNTER 9 - -enum Units +DoorData const doorData[] = { - CONTAINMENT_CORE_SECURITY_FIELD_ALPHA = 184318, //door opened when Wrath-Scryer Soccothrates dies - CONTAINMENT_CORE_SECURITY_FIELD_BETA = 184319, //door opened when Dalliah the Doomsayer dies - POD_ALPHA = 183961, //pod first boss wave - POD_BETA = 183963, //pod second boss wave - POD_DELTA = 183964, //pod third boss wave - POD_GAMMA = 183962, //pod fourth boss wave - POD_OMEGA = 183965, //pod fifth boss wave - WARDENS_SHIELD = 184802, // warden shield - SEAL_SPHERE = 184802, //shield 'protecting' mellichar - - MELLICHAR = 20904, //skyriss will kill this unit + { GO_CONTAINMENT_CORE_SECURITY_FIELD_ALPHA, DATA_SOCCOTHRATES, DOOR_TYPE_PASSAGE, BOUNDARY_NONE }, + { GO_CONTAINMENT_CORE_SECURITY_FIELD_BETA, DATA_DALLIAH, DOOR_TYPE_PASSAGE, BOUNDARY_NONE }, + { 0, 0, DOOR_TYPE_ROOM, BOUNDARY_NONE } // END }; -/* Arcatraz encounters: -1 - Zereketh the Unbound event -2 - Dalliah the Doomsayer event -3 - Wrath-Scryer Soccothrates event -4 - Harbinger Skyriss event, 5 sub-events -*/ - class instance_arcatraz : public InstanceMapScript { public: - instance_arcatraz() - : InstanceMapScript("instance_arcatraz", 552) - { - } + instance_arcatraz() : InstanceMapScript(ArcatrazScriptName, 552) { } + struct instance_arcatraz_InstanceMapScript : public InstanceScript { - instance_arcatraz_InstanceMapScript(Map* map) : InstanceScript(map) { } - - uint32 m_auiEncounter[MAX_ENCOUNTER]; + instance_arcatraz_InstanceMapScript(Map* map) : InstanceScript(map) + { + SetBossNumber(EncounterCount); + LoadDoorData(doorData); - uint64 Containment_Core_Security_Field_AlphaGUID; - uint64 Containment_Core_Security_Field_BetaGUID; - uint64 Pod_AlphaGUID; - uint64 Pod_GammaGUID; - uint64 Pod_BetaGUID; - uint64 Pod_DeltaGUID; - uint64 Pod_OmegaGUID; - uint64 Wardens_ShieldGUID; - uint64 GoSphereGUID; - uint64 MellicharGUID; + DalliahGUID = 0; + SoccothratesGUID = 0; + MellicharGUID = 0; + WardensShieldGUID = 0; - void Initialize() OVERRIDE - { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + ConversationState = NOT_STARTED; - Containment_Core_Security_Field_AlphaGUID = 0; - Containment_Core_Security_Field_BetaGUID = 0; - Pod_AlphaGUID = 0; - Pod_GammaGUID = 0; - Pod_BetaGUID = 0; - Pod_DeltaGUID = 0; - Pod_OmegaGUID = 0; - Wardens_ShieldGUID = 0; - GoSphereGUID = 0; - MellicharGUID = 0; + memset(StasisPodGUIDs, 0, 5 * sizeof(uint64)); + memset(StasisPodStates, NOT_STARTED, 5 * sizeof(uint8)); } - bool IsEncounterInProgress() const OVERRIDE + void OnCreatureCreate(Creature* creature) OVERRIDE { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - return true; - - return false; + switch (creature->GetEntry()) + { + case NPC_DALLIAH: + DalliahGUID = creature->GetGUID(); + break; + case NPC_SOCCOTHRATES: + SoccothratesGUID = creature->GetGUID(); + break; + case NPC_MELLICHAR: + MellicharGUID = creature->GetGUID(); + break; + default: + break; + } } void OnGameObjectCreate(GameObject* go) OVERRIDE { switch (go->GetEntry()) { - case CONTAINMENT_CORE_SECURITY_FIELD_ALPHA: - Containment_Core_Security_Field_AlphaGUID = go->GetGUID(); - break; - - case CONTAINMENT_CORE_SECURITY_FIELD_BETA: - Containment_Core_Security_Field_BetaGUID = go->GetGUID(); - break; - - case POD_ALPHA: - Pod_AlphaGUID = go->GetGUID(); - break; - - case POD_GAMMA: - Pod_GammaGUID = go->GetGUID(); - break; - - case POD_BETA: - Pod_BetaGUID = go->GetGUID(); - break; - - case POD_DELTA: - Pod_DeltaGUID = go->GetGUID(); - break; - - case POD_OMEGA: - Pod_OmegaGUID = go->GetGUID(); - break; - - case SEAL_SPHERE: - GoSphereGUID = go->GetGUID(); - break; - - /*case WARDENS_SHIELD: - Wardens_ShieldGUID = go->GetGUID(); - break;*/ + case GO_CONTAINMENT_CORE_SECURITY_FIELD_ALPHA: + case GO_CONTAINMENT_CORE_SECURITY_FIELD_BETA: + AddDoor(go, true); + break; + case GO_STASIS_POD_ALPHA: + StasisPodGUIDs[0] = go->GetGUID(); + break; + case GO_STASIS_POD_BETA: + StasisPodGUIDs[1] = go->GetGUID(); + break; + case GO_STASIS_POD_DELTA: + StasisPodGUIDs[2] = go->GetGUID(); + break; + case GO_STASIS_POD_GAMMA: + StasisPodGUIDs[3] = go->GetGUID(); + break; + case GO_STASIS_POD_OMEGA: + StasisPodGUIDs[4] = go->GetGUID(); + break; + case GO_WARDENS_SHIELD: + WardensShieldGUID = go->GetGUID(); + break; + default: + break; } } - void OnCreatureCreate(Creature* creature) OVERRIDE + void OnGameObjectRemove(GameObject* go) OVERRIDE { - if (creature->GetEntry() == MELLICHAR) - MellicharGUID = creature->GetGUID(); + switch (go->GetEntry()) + { + case GO_CONTAINMENT_CORE_SECURITY_FIELD_ALPHA: + case GO_CONTAINMENT_CORE_SECURITY_FIELD_BETA: + AddDoor(go, false); + break; + default: + break; + } } void SetData(uint32 type, uint32 data) OVERRIDE { switch (type) { - case TYPE_ZEREKETH: - m_auiEncounter[0] = data; - break; - case TYPE_DALLIAH: - if (data == DONE) - { - if (GameObject* go = instance->GetGameObject(Containment_Core_Security_Field_BetaGUID)) - go->UseDoorOrButton(); - } - m_auiEncounter[1] = data; - break; - case TYPE_SOCCOTHRATES: - if (data == DONE) - { - if (GameObject* go = instance->GetGameObject(Containment_Core_Security_Field_AlphaGUID)) - go->UseDoorOrButton(); - } - m_auiEncounter[2] = data; - break; - case TYPE_HARBINGERSKYRISS: - if (data == NOT_STARTED || data == FAIL) - { - m_auiEncounter[4] = NOT_STARTED; - m_auiEncounter[5] = NOT_STARTED; - m_auiEncounter[6] = NOT_STARTED; - m_auiEncounter[7] = NOT_STARTED; - m_auiEncounter[8] = NOT_STARTED; - } - m_auiEncounter[3] = data; - break; - case TYPE_WARDEN_1: - if (data == IN_PROGRESS) - if (GameObject* go = instance->GetGameObject(Pod_AlphaGUID)) - go->UseDoorOrButton(); - m_auiEncounter[4] = data; - break; - case TYPE_WARDEN_2: - if (data == IN_PROGRESS) - { - if (GameObject* go = instance->GetGameObject(Pod_BetaGUID)) - go->UseDoorOrButton(); - } - m_auiEncounter[5] = data; - break; - case TYPE_WARDEN_3: - if (data == IN_PROGRESS) - { - if (GameObject* go = instance->GetGameObject(Pod_DeltaGUID)) - go->UseDoorOrButton(); - } - m_auiEncounter[6] = data; - break; - case TYPE_WARDEN_4: - if (data == IN_PROGRESS) - { - if (GameObject* go = instance->GetGameObject(Pod_GammaGUID)) - go->UseDoorOrButton(); - } - m_auiEncounter[7] = data; - break; - case TYPE_WARDEN_5: - if (data == IN_PROGRESS) - { - if (GameObject* go = instance->GetGameObject(Pod_OmegaGUID)) - go->UseDoorOrButton(); - } - m_auiEncounter[8] = data; - break; - case TYPE_SHIELD_OPEN: - if (data == IN_PROGRESS) - { - if (GameObject* go = instance->GetGameObject(Wardens_ShieldGUID)) - go->UseDoorOrButton(); - } - break; + case DATA_WARDEN_1: + case DATA_WARDEN_2: + case DATA_WARDEN_3: + case DATA_WARDEN_4: + case DATA_WARDEN_5: + if (data == IN_PROGRESS) + HandleGameObject(StasisPodGUIDs[type - DATA_WARDEN_1], true); + StasisPodStates[type - DATA_WARDEN_1] = uint8(data); + break; + case DATA_CONVERSATION: + ConversationState = uint8(data); + break; + default: + break; } } @@ -234,12 +136,16 @@ class instance_arcatraz : public InstanceMapScript { switch (type) { - case TYPE_HARBINGERSKYRISS: return m_auiEncounter[3]; - case TYPE_WARDEN_1: return m_auiEncounter[4]; - case TYPE_WARDEN_2: return m_auiEncounter[5]; - case TYPE_WARDEN_3: return m_auiEncounter[6]; - case TYPE_WARDEN_4: return m_auiEncounter[7]; - case TYPE_WARDEN_5: return m_auiEncounter[8]; + case DATA_WARDEN_1: + case DATA_WARDEN_2: + case DATA_WARDEN_3: + case DATA_WARDEN_4: + case DATA_WARDEN_5: + return StasisPodStates[type - DATA_WARDEN_1]; + case DATA_CONVERSATION: + return ConversationState; + default: + break; } return 0; } @@ -248,11 +154,95 @@ class instance_arcatraz : public InstanceMapScript { switch (data) { - case DATA_MELLICHAR: return MellicharGUID; - case DATA_SPHERE_SHIELD: return GoSphereGUID; + case DATA_DALLIAH: + return DalliahGUID; + case DATA_SOCCOTHRATES: + return SoccothratesGUID; + case DATA_MELLICHAR: + return MellicharGUID; + case DATA_WARDENS_SHIELD: + return WardensShieldGUID; + default: + break; } return 0; } + + bool SetBossState(uint32 type, EncounterState state) OVERRIDE + { + if (!InstanceScript::SetBossState(type, state)) + return false; + + switch (type) + { + case DATA_HARBINGER_SKYRISS: + if (state == NOT_STARTED || state == FAIL) + { + SetData(DATA_WARDEN_1, NOT_STARTED); + SetData(DATA_WARDEN_2, NOT_STARTED); + SetData(DATA_WARDEN_3, NOT_STARTED); + SetData(DATA_WARDEN_4, NOT_STARTED); + SetData(DATA_WARDEN_5, NOT_STARTED); + } + break; + default: + break; + } + return true; + } + + std::string GetSaveData() OVERRIDE + { + OUT_SAVE_INST_DATA; + + std::ostringstream saveStream; + saveStream << "A Z " << GetBossSaveData(); + + OUT_SAVE_INST_DATA_COMPLETE; + return saveStream.str(); + } + + void Load(char const* str) OVERRIDE + { + if (!str) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(str); + + char dataHead1, dataHead2; + + std::istringstream loadStream(str); + loadStream >> dataHead1 >> dataHead2; + + if (dataHead1 == 'A' && dataHead2 == 'Z') + { + for (uint32 i = 0; i < EncounterCount; ++i) + { + uint32 tmpState; + loadStream >> tmpState; + if (tmpState == IN_PROGRESS || tmpState > SPECIAL) + tmpState = NOT_STARTED; + SetBossState(i, EncounterState(tmpState)); + } + } + else + OUT_LOAD_INST_DATA_FAIL; + + OUT_LOAD_INST_DATA_COMPLETE; + } + + protected: + uint64 DalliahGUID; + uint64 SoccothratesGUID; + uint64 StasisPodGUIDs[5]; + uint64 MellicharGUID; + uint64 WardensShieldGUID; + + uint8 ConversationState; + uint8 StasisPodStates[5]; }; InstanceScript* GetInstanceScript(InstanceMap* map) const OVERRIDE @@ -263,6 +253,6 @@ class instance_arcatraz : public InstanceMapScript void AddSC_instance_arcatraz() { - new instance_arcatraz; + new instance_arcatraz(); } diff --git a/src/server/scripts/Outland/zone_blades_edge_mountains.cpp b/src/server/scripts/Outland/zone_blades_edge_mountains.cpp index a005153a4fc..acc3317d7bd 100644 --- a/src/server/scripts/Outland/zone_blades_edge_mountains.cpp +++ b/src/server/scripts/Outland/zone_blades_edge_mountains.cpp @@ -19,7 +19,7 @@ /* ScriptData SDName: Blades_Edge_Mountains SD%Complete: 90 -SDComment: Quest support: 10503, 10504, 10556, 10609, 10682, 10821, 10980. Ogri'la->Skettis Flight. (npc_daranelle needs bit more work before consider complete) +SDComment: Quest support: 10503, 10504, 10556, 10594, 10609, 10682, 10821, 10980. Ogri'la->Skettis Flight. (npc_daranelle needs bit more work before consider complete) SDCategory: Blade's Edge Mountains EndScriptData */ @@ -40,6 +40,10 @@ EndContentData */ #include "GridNotifiersImpl.h" #include "Cell.h" #include "CellImpl.h" +#include "SpellInfo.h" +#include "SpellScript.h" +#include "SpellAuras.h" +#include "SpellAuraEffects.h" //Support for quest: You're Fired! (10821) bool obelisk_one, obelisk_two, obelisk_three, obelisk_four, obelisk_five; @@ -51,37 +55,6 @@ bool obelisk_one, obelisk_two, obelisk_three, obelisk_four, obelisk_five; #define LEGION_OBELISK_FIVE 185198 /*###### -## npc_bladespire_ogre -######*/ - -/// @todo add support for quest 10512 + Creature abilities -class npc_bladespire_ogre : public CreatureScript -{ -public: - npc_bladespire_ogre() : CreatureScript("npc_bladespire_ogre") { } - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_bladespire_ogreAI(creature); - } - - struct npc_bladespire_ogreAI : public ScriptedAI - { - npc_bladespire_ogreAI(Creature* creature) : ScriptedAI(creature) { } - - void Reset() OVERRIDE { } - - void UpdateAI(uint32 /*uiDiff*/) OVERRIDE - { - if (!UpdateVictim()) - return; - - DoMeleeAttackIfReady(); - } - }; -}; - -/*###### ## npc_nether_drake ######*/ @@ -1143,9 +1116,101 @@ class go_apexis_relic : public GameObjectScript } }; +/*###### +## npc_oscillating_frequency_scanner_master_bunny used for quest 10594 "Gauging the Resonant Frequency" +######*/ + +enum ScannerMasterBunny +{ + NPC_OSCILLATING_FREQUENCY_SCANNER_TOP_BUNNY = 21759, + SPELL_OSCILLATION_FIELD = 37408, + QUEST_GAUGING_THE_RESONANT_FREQUENCY = 10594 +}; + +class npc_oscillating_frequency_scanner_master_bunny : public CreatureScript +{ +public: + npc_oscillating_frequency_scanner_master_bunny() : CreatureScript("npc_oscillating_frequency_scanner_master_bunny") { } + + struct npc_oscillating_frequency_scanner_master_bunnyAI : public ScriptedAI + { + npc_oscillating_frequency_scanner_master_bunnyAI(Creature* creature) : ScriptedAI(creature) { } + + void Reset() OVERRIDE + { + if (GetClosestCreatureWithEntry(me, NPC_OSCILLATING_FREQUENCY_SCANNER_TOP_BUNNY, 25.0f)) + me->DespawnOrUnsummon(); + else + { + // Spell 37392 does not exist in dbc, manually spawning + me->SummonCreature(21759, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ() + 0.5f, me->GetOrientation(), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 50000); + me->SummonGameObject(184926, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation(), 0, 0, 0, 0, 50000); + me->DespawnOrUnsummon(50000); + } + + timer = 500; + } + + void IsSummonedBy(Unit* summoner) OVERRIDE + { + if (summoner->isType(TYPEMASK_PLAYER)) + playerGuid = summoner->GetGUID(); + } + + void UpdateAI(uint32 diff) OVERRIDE + { + if (timer <= diff) + { + if (Player* player = ObjectAccessor::GetPlayer(*me, playerGuid)) + DoCast(player, SPELL_OSCILLATION_FIELD); + + timer = 3000; + } + else + timer -= diff; + } + + private: + uint64 playerGuid; + uint32 timer; + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return new npc_oscillating_frequency_scanner_master_bunnyAI(creature); + } +}; + +class spell_oscillating_field : public SpellScriptLoader +{ + public: + spell_oscillating_field() : SpellScriptLoader("spell_oscillating_field") { } + + class spell_oscillating_field_SpellScript : public SpellScript + { + PrepareSpellScript(spell_oscillating_field_SpellScript); + + void HandleEffect(SpellEffIndex /*effIndex*/) + { + if (Player* player = GetHitPlayer()) + if (player->GetAuraCount(SPELL_OSCILLATION_FIELD) == 5 && player->GetQuestStatus(QUEST_GAUGING_THE_RESONANT_FREQUENCY) == QUEST_STATUS_INCOMPLETE) + player->CompleteQuest(QUEST_GAUGING_THE_RESONANT_FREQUENCY); + } + + void Register() OVERRIDE + { + OnEffectHitTarget += SpellEffectFn(spell_oscillating_field_SpellScript::HandleEffect, EFFECT_0, SPELL_EFFECT_APPLY_AURA); + } + }; + + SpellScript* GetSpellScript() const OVERRIDE + { + return new spell_oscillating_field_SpellScript(); + } +}; + void AddSC_blades_edge_mountains() { - new npc_bladespire_ogre(); new npc_nether_drake(); new npc_daranelle(); new npc_overseer_nuaar(); @@ -1157,4 +1222,6 @@ void AddSC_blades_edge_mountains() new npc_simon_bunny(); new go_simon_cluster(); new go_apexis_relic(); + new npc_oscillating_frequency_scanner_master_bunny(); + new spell_oscillating_field(); } diff --git a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp index ed7d90cf808..0aad4973000 100644 --- a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp +++ b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp @@ -160,7 +160,7 @@ public: if (creature->GetOwner() && creature->GetOwner()->GetTypeId() == TYPEID_PLAYER) Start(false, false, creature->GetOwner()->GetGUID()); else - TC_LOG_ERROR(LOG_FILTER_TSCR, "TRINITY: npc_ancestral_wolf can not obtain owner or owner is not a player."); + TC_LOG_ERROR("scripts", "TRINITY: npc_ancestral_wolf can not obtain owner or owner is not a player."); creature->SetSpeed(MOVE_WALK, 1.5f); Reset(); diff --git a/src/server/scripts/Outland/zone_netherstorm.cpp b/src/server/scripts/Outland/zone_netherstorm.cpp index e69b6b017a4..e1b95aea972 100644 --- a/src/server/scripts/Outland/zone_netherstorm.cpp +++ b/src/server/scripts/Outland/zone_netherstorm.cpp @@ -400,7 +400,7 @@ public: struct npc_commander_dawnforgeAI : public ScriptedAI { - npc_commander_dawnforgeAI(Creature* creature) : ScriptedAI(creature) { Reset(); } + npc_commander_dawnforgeAI(Creature* creature) : ScriptedAI(creature) { } uint64 PlayerGUID; uint64 ardonisGUID; @@ -411,9 +411,6 @@ public: uint32 Phase_Timer; bool isEvent; - float angle_dawnforge; - float angle_ardonis; - void Reset() OVERRIDE { PlayerGUID = 0; @@ -438,21 +435,15 @@ public: { Creature* ardonis = ObjectAccessor::GetCreature(*me, ardonisGUID); Creature* pathaleon = ObjectAccessor::GetCreature(*me, pathaleonGUID); - Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID); - if (!ardonis || !pathaleon || !player) + if (!ardonis || !pathaleon) return; - //Calculate the angle to Pathaleon - angle_dawnforge = me->GetAngle(pathaleon->GetPositionX(), pathaleon->GetPositionY()); - angle_ardonis = ardonis->GetAngle(pathaleon->GetPositionX(), pathaleon->GetPositionY()); + // Turn Dawnforge + me->SetFacingToObject(pathaleon); - //Turn Dawnforge and update - me->SetOrientation(angle_dawnforge); - me->SendUpdateToPlayer(player); - //Turn Ardonis and update - ardonis->SetOrientation(angle_ardonis); - ardonis->SendUpdateToPlayer(player); + // Turn Ardonis + ardonis->SetFacingToObject(pathaleon); //Set them to kneel me->SetStandState(UNIT_STAND_STATE_KNEEL); @@ -464,20 +455,11 @@ public: { if (Unit* ardonis = ObjectAccessor::GetUnit(*me, ardonisGUID)) { - Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID); - - if (!player) - return; - - angle_dawnforge = me->GetAngle(ardonis->GetPositionX(), ardonis->GetPositionY()); - angle_ardonis = ardonis->GetAngle(me->GetPositionX(), me->GetPositionY()); + // Turn Dawnforge + me->SetFacingToObject(ardonis); - //Turn Dawnforge and update - me->SetOrientation(angle_dawnforge); - me->SendUpdateToPlayer(player); - //Turn Ardonis and update - ardonis->SetOrientation(angle_ardonis); - ardonis->SendUpdateToPlayer(player); + // Turn Ardonis + ardonis->SetFacingToObject(me); //Set state me->SetStandState(UNIT_STAND_STATE_STAND); @@ -502,7 +484,7 @@ public: return true; } - TC_LOG_DEBUG(LOG_FILTER_TSCR, "npc_commander_dawnforge event already in progress, need to wait."); + TC_LOG_DEBUG("scripts", "npc_commander_dawnforge event already in progress, need to wait."); return false; } diff --git a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp index db25f9f6158..c8a2dfe03cd 100644 --- a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp +++ b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp @@ -19,7 +19,7 @@ /* ScriptData SDName: Shadowmoon_Valley SD%Complete: 100 -SDComment: Quest support: 10519, 10583, 10601, 10804, 10854, 10458, 10481, 10480, 11082, 10781, 10451. Vendor Drake Dealer Hurlunk. +SDComment: Quest support: 10519, 10583, 10601, 10804, 10854, 10458, 10481, 10480, 10781, 10451. Vendor Drake Dealer Hurlunk. SDCategory: Shadowmoon Valley EndScriptData */ @@ -28,7 +28,6 @@ npc_mature_netherwing_drake npc_enslaved_netherwing_drake npc_drake_dealer_hurlunk npcs_flanis_swiftwing_and_kagrosh -npc_murkblood_overseer npc_karynaku npc_oronok_tornheart npc_overlord_morghor @@ -493,74 +492,6 @@ public: }; /*###### -## npc_murkblood_overseer -######*/ - -#define QUEST_11082 11082 - -#define GOSSIP_HMO "I am here for you, overseer." -#define GOSSIP_SMO1 "How dare you question an overseer of the Dragonmaw!" -#define GOSSIP_SMO2 "Who speaks of me? What are you talking about, broken?" -#define GOSSIP_SMO3 "Continue please." -#define GOSSIP_SMO4 "Who are these bidders?" -#define GOSSIP_SMO5 "Well... yes." - -class npc_murkblood_overseer : public CreatureScript -{ -public: - npc_murkblood_overseer() : CreatureScript("npc_murkblood_overseer") { } - - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) OVERRIDE - { - player->PlayerTalkClass->ClearMenus(); - switch (action) - { - case GOSSIP_ACTION_INFO_DEF+1: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SMO1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - //correct id not known - player->SEND_GOSSIP_MENU(10940, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SMO2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - //correct id not known - player->SEND_GOSSIP_MENU(10940, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SMO3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); - //correct id not known - player->SEND_GOSSIP_MENU(10940, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SMO4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); - //correct id not known - player->SEND_GOSSIP_MENU(10940, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+5: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SMO5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); - //correct id not known - player->SEND_GOSSIP_MENU(10940, creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+6: - //correct id not known - player->SEND_GOSSIP_MENU(10940, creature->GetGUID()); - creature->CastSpell(player, 41121, false); - player->AreaExploredOrEventHappens(QUEST_11082); - break; - } - return true; - } - - bool OnGossipHello(Player* player, Creature* creature) OVERRIDE - { - if (player->GetQuestStatus(QUEST_11082) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM(0, GOSSIP_HMO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - - player->SEND_GOSSIP_MENU(10940, creature->GetGUID()); - return true; - } -}; - -/*###### ## npc_oronok ######*/ @@ -1286,7 +1217,7 @@ public: me->SetTarget(0); } - void EnterCombat(Unit* /*who*/)OVERRIDE { } + void EnterCombat(Unit* /*who*/) OVERRIDE { } void HandleAnimation() { @@ -1818,7 +1749,7 @@ public: void Reset() OVERRIDE { } - void EnterCombat(Unit* /*who*/)OVERRIDE { } + void EnterCombat(Unit* /*who*/) OVERRIDE { } void JustDied(Unit* /*killer*/) OVERRIDE { @@ -2011,7 +1942,6 @@ void AddSC_shadowmoon_valley() new npc_dragonmaw_peon(); new npc_drake_dealer_hurlunk(); new npcs_flanis_swiftwing_and_kagrosh(); - new npc_murkblood_overseer(); new npc_karynaku(); new npc_oronok_tornheart(); new npc_overlord_morghor(); diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp index 299773a5d0f..6e88fb76c7e 100644 --- a/src/server/scripts/Spells/spell_rogue.cpp +++ b/src/server/scripts/Spells/spell_rogue.cpp @@ -213,7 +213,7 @@ class spell_rog_deadly_poison : public SpellScriptLoader SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(enchant->spellid[s]); if (!spellInfo) { - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Player::CastItemCombatSpell Enchant %i, player (Name: %s, GUID: %u) cast unknown spell %i", enchant->ID, player->GetName().c_str(), player->GetGUIDLow(), enchant->spellid[s]); + TC_LOG_ERROR("spells", "Player::CastItemCombatSpell Enchant %i, player (Name: %s, GUID: %u) cast unknown spell %i", enchant->ID, player->GetName().c_str(), player->GetGUIDLow(), enchant->spellid[s]); continue; } diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index 6aea2d7ad34..45518fcfef1 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -162,7 +162,7 @@ class spell_warl_create_healthstone : public SpellScriptLoader rank = 2; break; default: - TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Unknown rank of Improved Healthstone id: %d", aurEff->GetId()); + TC_LOG_ERROR("spells", "Unknown rank of Improved Healthstone id: %d", aurEff->GetId()); break; } } diff --git a/src/server/scripts/World/areatrigger_scripts.cpp b/src/server/scripts/World/areatrigger_scripts.cpp index 3ab9a1511af..2f8d5fa2ce4 100644 --- a/src/server/scripts/World/areatrigger_scripts.cpp +++ b/src/server/scripts/World/areatrigger_scripts.cpp @@ -210,7 +210,11 @@ class AreaTrigger_at_last_rites : public AreaTriggerScript pPosition = WorldLocation(571, 3802.38f, 3585.95f, 49.5765f, 0.0f); break; case 5340: - pPosition = WorldLocation(571, 3687.91f, 3577.28f, 473.342f, 0.0f); + if (player->GetQuestStatus(QUEST_LAST_RITES) == QUEST_STATUS_INCOMPLETE || + player->GetQuestStatus(QUEST_LAST_RITES) == QUEST_STATUS_COMPLETE) + pPosition = WorldLocation(571, 3687.91f, 3577.28f, 473.342f); + else + pPosition = WorldLocation(571, 3739.38f, 3567.09f, 341.58f); break; default: return false; diff --git a/src/server/scripts/World/chat_log.cpp b/src/server/scripts/World/chat_log.cpp index 16550dc69ea..11fbeeca852 100644 --- a/src/server/scripts/World/chat_log.cpp +++ b/src/server/scripts/World/chat_log.cpp @@ -31,25 +31,25 @@ public: { case CHAT_MSG_ADDON: if (sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON)) - TC_LOG_DEBUG(LOG_FILTER_PLAYER_CHATLOG, "[ADDON] Player %s sends: %s", + TC_LOG_DEBUG("chat.log", "[ADDON] Player %s sends: %s", player->GetName().c_str(), msg.c_str()); break; case CHAT_MSG_SAY: if (sWorld->getBoolConfig(CONFIG_CHATLOG_PUBLIC)) - TC_LOG_DEBUG(LOG_FILTER_PLAYER_CHATLOG, "[SAY] Player %s says (language %u): %s", + TC_LOG_DEBUG("chat.log", "[SAY] Player %s says (language %u): %s", player->GetName().c_str(), lang, msg.c_str()); break; case CHAT_MSG_EMOTE: if (sWorld->getBoolConfig(CONFIG_CHATLOG_PUBLIC)) - TC_LOG_DEBUG(LOG_FILTER_PLAYER_CHATLOG, "[TEXTEMOTE] Player %s emotes: %s", + TC_LOG_DEBUG("chat.log", "[TEXTEMOTE] Player %s emotes: %s", player->GetName().c_str(), msg.c_str()); break; case CHAT_MSG_YELL: if (sWorld->getBoolConfig(CONFIG_CHATLOG_PUBLIC)) - TC_LOG_DEBUG(LOG_FILTER_PLAYER_CHATLOG, "[YELL] Player %s yells (language %u): %s", + TC_LOG_DEBUG("chat.log", "[YELL] Player %s yells (language %u): %s", player->GetName().c_str(), lang, msg.c_str()); break; } @@ -58,10 +58,10 @@ public: void OnChat(Player* player, uint32 /*type*/, uint32 lang, std::string& msg, Player* receiver) { if (lang != LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_WHISPER)) - TC_LOG_DEBUG(LOG_FILTER_PLAYER_CHATLOG, "[WHISPER] Player %s tells %s: %s", + TC_LOG_DEBUG("chat.log", "[WHISPER] Player %s tells %s: %s", player->GetName().c_str(), receiver ? receiver->GetName().c_str() : "<unknown>", msg.c_str()); else if (lang == LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON)) - TC_LOG_DEBUG(LOG_FILTER_PLAYER_CHATLOG, "[ADDON] Player %s tells %s: %s", + TC_LOG_DEBUG("chat.log", "[ADDON] Player %s tells %s: %s", player->GetName().c_str(), receiver ? receiver->GetName().c_str() : "<unknown>", msg.c_str()); } @@ -73,52 +73,52 @@ public: { case CHAT_MSG_PARTY: if (lang != LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_PARTY)) - TC_LOG_DEBUG(LOG_FILTER_PLAYER_CHATLOG, "[PARTY] Player %s tells group with leader %s: %s", + TC_LOG_DEBUG("chat.log", "[PARTY] Player %s tells group with leader %s: %s", player->GetName().c_str(), group ? group->GetLeaderName() : "<unknown>", msg.c_str()); else if (lang == LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON)) - TC_LOG_DEBUG(LOG_FILTER_PLAYER_CHATLOG, "[ADDON] Player %s tells group with leader %s: %s", + TC_LOG_DEBUG("chat.log", "[ADDON] Player %s tells group with leader %s: %s", player->GetName().c_str(), group ? group->GetLeaderName() : "<unknown>", msg.c_str()); break; case CHAT_MSG_PARTY_LEADER: if (sWorld->getBoolConfig(CONFIG_CHATLOG_PARTY)) - TC_LOG_DEBUG(LOG_FILTER_PLAYER_CHATLOG, "[PARTY] Leader %s tells group: %s", + TC_LOG_DEBUG("chat.log", "[PARTY] Leader %s tells group: %s", player->GetName().c_str(), msg.c_str()); break; case CHAT_MSG_RAID: if (lang != LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_RAID)) - TC_LOG_DEBUG(LOG_FILTER_PLAYER_CHATLOG, "[RAID] Player %s tells raid with leader %s: %s", + TC_LOG_DEBUG("chat.log", "[RAID] Player %s tells raid with leader %s: %s", player->GetName().c_str(), group ? group->GetLeaderName() : "<unknown>", msg.c_str()); else if (lang == LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON)) - TC_LOG_DEBUG(LOG_FILTER_PLAYER_CHATLOG, "[ADDON] Player %s tells raid with leader %s: %s", + TC_LOG_DEBUG("chat.log", "[ADDON] Player %s tells raid with leader %s: %s", player->GetName().c_str(), group ? group->GetLeaderName() : "<unknown>", msg.c_str()); break; case CHAT_MSG_RAID_LEADER: if (sWorld->getBoolConfig(CONFIG_CHATLOG_RAID)) - TC_LOG_DEBUG(LOG_FILTER_PLAYER_CHATLOG, "[RAID] Leader player %s tells raid: %s", + TC_LOG_DEBUG("chat.log", "[RAID] Leader player %s tells raid: %s", player->GetName().c_str(), msg.c_str()); break; case CHAT_MSG_RAID_WARNING: if (sWorld->getBoolConfig(CONFIG_CHATLOG_RAID)) - TC_LOG_DEBUG(LOG_FILTER_PLAYER_CHATLOG, "[RAID] Leader player %s warns raid with: %s", + TC_LOG_DEBUG("chat.log", "[RAID] Leader player %s warns raid with: %s", player->GetName().c_str(), msg.c_str()); break; case CHAT_MSG_BATTLEGROUND: if (lang != LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_BGROUND)) - TC_LOG_DEBUG(LOG_FILTER_PLAYER_CHATLOG, "[BATTLEGROUND] Player %s tells battleground with leader %s: %s", + TC_LOG_DEBUG("chat.log", "[BATTLEGROUND] Player %s tells battleground with leader %s: %s", player->GetName().c_str(), group ? group->GetLeaderName() : "<unknown>", msg.c_str()); else if (lang == LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON)) - TC_LOG_DEBUG(LOG_FILTER_PLAYER_CHATLOG, "[ADDON] Player %s tells battleground with leader %s: %s", + TC_LOG_DEBUG("chat.log", "[ADDON] Player %s tells battleground with leader %s: %s", player->GetName().c_str(), group ? group->GetLeaderName() : "<unknown>", msg.c_str()); break; case CHAT_MSG_BATTLEGROUND_LEADER: if (sWorld->getBoolConfig(CONFIG_CHATLOG_BGROUND)) - TC_LOG_DEBUG(LOG_FILTER_PLAYER_CHATLOG, "[BATTLEGROUND] Leader player %s tells battleground: %s", + TC_LOG_DEBUG("chat.log", "[BATTLEGROUND] Leader player %s tells battleground: %s", player->GetName().c_str(), msg.c_str()); break; } @@ -130,16 +130,16 @@ public: { case CHAT_MSG_GUILD: if (lang != LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_GUILD)) - TC_LOG_DEBUG(LOG_FILTER_PLAYER_CHATLOG, "[GUILD] Player %s tells guild %s: %s", + TC_LOG_DEBUG("chat.log", "[GUILD] Player %s tells guild %s: %s", player->GetName().c_str(), guild ? guild->GetName().c_str() : "<unknown>", msg.c_str()); else if (lang == LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON)) - TC_LOG_DEBUG(LOG_FILTER_PLAYER_CHATLOG, "[ADDON] Player %s sends to guild %s: %s", + TC_LOG_DEBUG("chat.log", "[ADDON] Player %s sends to guild %s: %s", player->GetName().c_str(), guild ? guild->GetName().c_str() : "<unknown>", msg.c_str()); break; case CHAT_MSG_OFFICER: if (sWorld->getBoolConfig(CONFIG_CHATLOG_GUILD)) - TC_LOG_DEBUG(LOG_FILTER_PLAYER_CHATLOG, "[OFFICER] Player %s tells guild %s officers: %s", + TC_LOG_DEBUG("chat.log", "[OFFICER] Player %s tells guild %s officers: %s", player->GetName().c_str(), guild ? guild->GetName().c_str() : "<unknown>", msg.c_str()); break; } @@ -154,10 +154,10 @@ public: channel->HasFlag(CHANNEL_FLAG_LFG)); if (sWorld->getBoolConfig(CONFIG_CHATLOG_SYSCHAN) && isSystem) - TC_LOG_DEBUG(LOG_FILTER_PLAYER_CHATLOG, "[SYSCHAN] Player %s tells channel %s: %s", + TC_LOG_DEBUG("chat.log", "[SYSCHAN] Player %s tells channel %s: %s", player->GetName().c_str(), channel->GetName().c_str(), msg.c_str()); else if (sWorld->getBoolConfig(CONFIG_CHATLOG_CHANNEL)) - TC_LOG_DEBUG(LOG_FILTER_PLAYER_CHATLOG, "[CHANNEL] Player %s tells channel %s: %s", + TC_LOG_DEBUG("chat.log", "[CHANNEL] Player %s tells channel %s: %s", player->GetName().c_str(), channel ? channel->GetName().c_str() : "<unknown>", msg.c_str()); } }; diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp index 84ef56eb413..3a0c5b0dfd2 100644 --- a/src/server/scripts/World/go_scripts.cpp +++ b/src/server/scripts/World/go_scripts.cpp @@ -268,7 +268,7 @@ public: if (Spell) creature->CastSpell(player, Spell, false); else - TC_LOG_ERROR(LOG_FILTER_TSCR, "go_ethereum_prison summoned Creature (entry %u) but faction (%u) are not expected by script.", creature->GetEntry(), creature->getFaction()); + TC_LOG_ERROR("scripts", "go_ethereum_prison summoned Creature (entry %u) but faction (%u) are not expected by script.", creature->GetEntry(), creature->getFaction()); } } } diff --git a/src/server/scripts/World/npc_professions.cpp b/src/server/scripts/World/npc_professions.cpp index fb36dbefa1f..8d0f917eb2f 100644 --- a/src/server/scripts/World/npc_professions.cpp +++ b/src/server/scripts/World/npc_professions.cpp @@ -247,7 +247,7 @@ bool EquippedOk(Player* player, uint32 spellId) if (item && item->GetTemplate()->RequiredSpell == reqSpell) { //player has item equipped that require specialty. Not allow to unlearn, player has to unequip first - TC_LOG_DEBUG(LOG_FILTER_TSCR, "player attempt to unlearn spell %u, but item %u is equipped.", reqSpell, item->GetEntry()); + TC_LOG_DEBUG("scripts", "player attempt to unlearn spell %u, but item %u is equipped.", reqSpell, item->GetEntry()); return false; } } diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index f2bc4debff5..d7d18d5d36a 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -140,14 +140,14 @@ public: } if (!SpawnAssoc) - TC_LOG_ERROR(LOG_FILTER_SQL, "TCSR: Creature template entry %u has ScriptName npc_air_force_bots, but it's not handled by that script", creature->GetEntry()); + TC_LOG_ERROR("sql.sql", "TCSR: Creature template entry %u has ScriptName npc_air_force_bots, but it's not handled by that script", creature->GetEntry()); else { CreatureTemplate const* spawnedTemplate = sObjectMgr->GetCreatureTemplate(SpawnAssoc->spawnedCreatureEntry); if (!spawnedTemplate) { - TC_LOG_ERROR(LOG_FILTER_SQL, "TCSR: Creature template entry %u does not exist in DB, which is required by npc_air_force_bots", SpawnAssoc->spawnedCreatureEntry); + TC_LOG_ERROR("sql.sql", "TCSR: Creature template entry %u does not exist in DB, which is required by npc_air_force_bots", SpawnAssoc->spawnedCreatureEntry); SpawnAssoc = NULL; return; } @@ -167,7 +167,7 @@ public: SpawnedGUID = summoned->GetGUID(); else { - TC_LOG_ERROR(LOG_FILTER_SQL, "TCSR: npc_air_force_bots: wasn't able to spawn Creature %u", SpawnAssoc->spawnedCreatureEntry); + TC_LOG_ERROR("sql.sql", "TCSR: npc_air_force_bots: wasn't able to spawn Creature %u", SpawnAssoc->spawnedCreatureEntry); SpawnAssoc = NULL; } @@ -461,7 +461,7 @@ public: } } - void EnterCombat(Unit* /*who*/)OVERRIDE { } + void EnterCombat(Unit* /*who*/) OVERRIDE { } void ReceiveEmote(Player* player, uint32 emote) OVERRIDE { @@ -759,7 +759,7 @@ public: } } - void EnterCombat(Unit* /*who*/)OVERRIDE { } + void EnterCombat(Unit* /*who*/) OVERRIDE { } void SpellHit(Unit* caster, SpellInfo const* spell) OVERRIDE { @@ -854,7 +854,7 @@ void npc_doctor::npc_doctorAI::UpdateAI(uint32 diff) patientEntry = HordeSoldierId[rand() % 3]; break; default: - TC_LOG_ERROR(LOG_FILTER_TSCR, "Invalid entry for Triage doctor. Please check your database"); + TC_LOG_ERROR("scripts", "Invalid entry for Triage doctor. Please check your database"); return; } diff --git a/src/server/shared/Configuration/Config.cpp b/src/server/shared/Configuration/Config.cpp index 47d59a57100..055c33b40ee 100644 --- a/src/server/shared/Configuration/Config.cpp +++ b/src/server/shared/Configuration/Config.cpp @@ -117,3 +117,35 @@ std::string const& ConfigMgr::GetFilename() GuardType guard(_configLock); return _filename; } + +std::list<std::string> ConfigMgr::GetKeysByString(std::string const& name) +{ + GuardType guard(_configLock); + + std::list<std::string> keys; + if (_config.get() == 0) + return keys; + + ACE_TString section_name; + ACE_Configuration_Section_Key section_key; + const ACE_Configuration_Section_Key &root_key = _config->root_section(); + + int i = 0; + while (_config->enumerate_sections(root_key, i++, section_name) == 0) + { + _config->open_section(root_key, section_name.c_str(), 0, section_key); + + ACE_TString key_name; + ACE_Configuration::VALUETYPE type; + int j = 0; + while (_config->enumerate_values(section_key, j++, key_name, type) == 0) + { + std::string temp = key_name.c_str(); + + if (!temp.find(name)) + keys.push_back(temp); + } + } + + return keys; +} diff --git a/src/server/shared/Configuration/Config.h b/src/server/shared/Configuration/Config.h index d633e37f0c4..49f5c5e07fb 100644 --- a/src/server/shared/Configuration/Config.h +++ b/src/server/shared/Configuration/Config.h @@ -20,7 +20,7 @@ #define CONFIG_H #include <string> -#include <map> +#include <list> #include <ace/Singleton.h> #include <ace/Configuration_Import_Export.h> #include <ace/Thread_Mutex.h> @@ -56,6 +56,7 @@ public: float GetFloatDefault(const char* name, float def); std::string const& GetFilename(); + std::list<std::string> GetKeysByString(std::string const& name); private: bool GetValueHelper(const char* name, ACE_TString &result); diff --git a/src/server/shared/Cryptography/HMACSHA1.cpp b/src/server/shared/Cryptography/HMACSHA1.cpp index c6c49f14a8e..2585fa64ea1 100644 --- a/src/server/shared/Cryptography/HMACSHA1.cpp +++ b/src/server/shared/Cryptography/HMACSHA1.cpp @@ -24,6 +24,7 @@ HmacHash::HmacHash(uint32 len, uint8 *seed) { HMAC_CTX_init(&m_ctx); HMAC_Init_ex(&m_ctx, seed, len, EVP_sha1(), NULL); + memset(m_digest, 0, sizeof(m_digest)); } HmacHash::~HmacHash() diff --git a/src/server/shared/DataStores/DBCFileLoader.cpp b/src/server/shared/DataStores/DBCFileLoader.cpp index 0aa94f1d14a..3c02d5f533d 100644 --- a/src/server/shared/DataStores/DBCFileLoader.cpp +++ b/src/server/shared/DataStores/DBCFileLoader.cpp @@ -23,7 +23,7 @@ #include "DBCFileLoader.h" #include "Errors.h" -DBCFileLoader::DBCFileLoader() : fieldsOffset(NULL), data(NULL), stringTable(NULL) { } +DBCFileLoader::DBCFileLoader() : recordSize(0), recordCount(0), fieldCount(0), stringSize(0), fieldsOffset(NULL), data(NULL), stringTable(NULL) { } bool DBCFileLoader::Load(const char* filename, const char* fmt) { diff --git a/src/server/shared/DataStores/DBCStore.h b/src/server/shared/DataStores/DBCStore.h index fdbf0f2bb01..ad13b2a02af 100644 --- a/src/server/shared/DataStores/DBCStore.h +++ b/src/server/shared/DataStores/DBCStore.h @@ -120,7 +120,7 @@ class DBCStorage // Check if sql index pos is valid if (int32(result->GetFieldCount() - 1) < sql->sqlIndexPos) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "Invalid index pos for dbc:'%s'", sql->sqlTableName.c_str()); + TC_LOG_ERROR("server.loading", "Invalid index pos for dbc:'%s'", sql->sqlTableName.c_str()); return false; } } @@ -151,7 +151,7 @@ class DBCStorage uint32 id = fields[sql->sqlIndexPos].GetUInt32(); if (indexTable.asT[id]) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "Index %d already exists in dbc:'%s'", id, sql->sqlTableName.c_str()); + TC_LOG_ERROR("server.loading", "Index %d already exists in dbc:'%s'", id, sql->sqlTableName.c_str()); return false; } @@ -208,7 +208,7 @@ class DBCStorage offset += 1; break; case FT_STRING: - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "Unsupported data type in table '%s' at char %d", sql->sqlTableName.c_str(), columnNumber); + TC_LOG_ERROR("server.loading", "Unsupported data type in table '%s' at char %d", sql->sqlTableName.c_str(), columnNumber); return false; case FT_SORT: break; @@ -221,14 +221,14 @@ class DBCStorage } else { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "Incorrect sql format string '%s' at char %d", sql->sqlTableName.c_str(), columnNumber); + TC_LOG_ERROR("server.loading", "Incorrect sql format string '%s' at char %d", sql->sqlTableName.c_str(), columnNumber); return false; } } if (sqlColumnNumber != (result->GetFieldCount() - 1)) { - TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, "SQL and DBC format strings are not matching for table: '%s'", sql->sqlTableName.c_str()); + TC_LOG_ERROR("server.loading", "SQL and DBC format strings are not matching for table: '%s'", sql->sqlTableName.c_str()); return false; } diff --git a/src/server/shared/Database/DatabaseWorkerPool.h b/src/server/shared/Database/DatabaseWorkerPool.h index e209beef8b6..33075accc04 100644 --- a/src/server/shared/Database/DatabaseWorkerPool.h +++ b/src/server/shared/Database/DatabaseWorkerPool.h @@ -68,7 +68,7 @@ class DatabaseWorkerPool bool res = true; _connectionInfo = MySQLConnectionInfo(infoString); - TC_LOG_INFO(LOG_FILTER_SQL_DRIVER, "Opening DatabasePool '%s'. Asynchronous connections: %u, synchronous connections: %u.", + TC_LOG_INFO("sql.driver", "Opening DatabasePool '%s'. Asynchronous connections: %u, synchronous connections: %u.", GetDatabaseName(), async_threads, synch_threads); //! Open asynchronous connections (delayed operations) @@ -94,17 +94,17 @@ class DatabaseWorkerPool } if (res) - TC_LOG_INFO(LOG_FILTER_SQL_DRIVER, "DatabasePool '%s' opened successfully. %u total connections running.", GetDatabaseName(), + TC_LOG_INFO("sql.driver", "DatabasePool '%s' opened successfully. %u total connections running.", GetDatabaseName(), (_connectionCount[IDX_SYNCH] + _connectionCount[IDX_ASYNC])); else - TC_LOG_ERROR(LOG_FILTER_SQL_DRIVER, "DatabasePool %s NOT opened. There were errors opening the MySQL connections. Check your SQLDriverLogFile " + TC_LOG_ERROR("sql.driver", "DatabasePool %s NOT opened. There were errors opening the MySQL connections. Check your SQLDriverLogFile " "for specific errors.", GetDatabaseName()); return res; } void Close() { - TC_LOG_INFO(LOG_FILTER_SQL_DRIVER, "Closing down DatabasePool '%s'.", GetDatabaseName()); + TC_LOG_INFO("sql.driver", "Closing down DatabasePool '%s'.", GetDatabaseName()); //! Shuts down delaythreads for this connection pool by underlying deactivate(). //! The next dequeue attempt in the worker thread tasks will result in an error, @@ -120,7 +120,7 @@ class DatabaseWorkerPool t->Close(); //! Closes the actualy MySQL connection. } - TC_LOG_INFO(LOG_FILTER_SQL_DRIVER, "Asynchronous connections on DatabasePool '%s' terminated. Proceeding with synchronous connections.", + TC_LOG_INFO("sql.driver", "Asynchronous connections on DatabasePool '%s' terminated. Proceeding with synchronous connections.", GetDatabaseName()); //! Shut down the synchronous connections @@ -133,7 +133,7 @@ class DatabaseWorkerPool //! Deletes the ACE_Activation_Queue object and its underlying ACE_Message_Queue delete _queue; - TC_LOG_INFO(LOG_FILTER_SQL_DRIVER, "All connections on DatabasePool '%s' closed.", GetDatabaseName()); + TC_LOG_INFO("sql.driver", "All connections on DatabasePool '%s' closed.", GetDatabaseName()); } /** @@ -366,10 +366,10 @@ class DatabaseWorkerPool switch (transaction->GetSize()) { case 0: - TC_LOG_DEBUG(LOG_FILTER_SQL_DRIVER, "Transaction contains 0 queries. Not executing."); + TC_LOG_DEBUG("sql.driver", "Transaction contains 0 queries. Not executing."); return; case 1: - TC_LOG_DEBUG(LOG_FILTER_SQL_DRIVER, "Warning: Transaction only holds 1 query, consider removing Transaction context in code."); + TC_LOG_DEBUG("sql.driver", "Warning: Transaction only holds 1 query, consider removing Transaction context in code."); break; default: break; diff --git a/src/server/shared/Database/Field.h b/src/server/shared/Database/Field.h index 7584d3331fa..5460f5cc4f6 100644 --- a/src/server/shared/Database/Field.h +++ b/src/server/shared/Database/Field.h @@ -43,7 +43,7 @@ class Field #ifdef TRINITY_DEBUG if (!IsType(MYSQL_TYPE_TINY)) { - TC_LOG_WARN(LOG_FILTER_SQL, "Warning: GetUInt8() on non-tinyint field. Using type: %s.", FieldTypeToString(data.type)); + TC_LOG_WARN("sql.sql", "Warning: GetUInt8() on non-tinyint field. Using type: %s.", FieldTypeToString(data.type)); return 0; } #endif @@ -61,7 +61,7 @@ class Field #ifdef TRINITY_DEBUG if (!IsType(MYSQL_TYPE_TINY)) { - TC_LOG_WARN(LOG_FILTER_SQL, "Warning: GetInt8() on non-tinyint field. Using type: %s.", FieldTypeToString(data.type)); + TC_LOG_WARN("sql.sql", "Warning: GetInt8() on non-tinyint field. Using type: %s.", FieldTypeToString(data.type)); return 0; } #endif @@ -79,7 +79,7 @@ class Field #ifdef TRINITY_DEBUG if (!IsType(MYSQL_TYPE_SHORT) && !IsType(MYSQL_TYPE_YEAR)) { - TC_LOG_WARN(LOG_FILTER_SQL, "Warning: GetUInt16() on non-smallint field. Using type: %s.", FieldTypeToString(data.type)); + TC_LOG_WARN("sql.sql", "Warning: GetUInt16() on non-smallint field. Using type: %s.", FieldTypeToString(data.type)); return 0; } #endif @@ -97,7 +97,7 @@ class Field #ifdef TRINITY_DEBUG if (!IsType(MYSQL_TYPE_SHORT) && !IsType(MYSQL_TYPE_YEAR)) { - TC_LOG_WARN(LOG_FILTER_SQL, "Warning: GetInt16() on non-smallint field. Using type: %s.", FieldTypeToString(data.type)); + TC_LOG_WARN("sql.sql", "Warning: GetInt16() on non-smallint field. Using type: %s.", FieldTypeToString(data.type)); return 0; } #endif @@ -115,7 +115,7 @@ class Field #ifdef TRINITY_DEBUG if (!IsType(MYSQL_TYPE_INT24) && !IsType(MYSQL_TYPE_LONG)) { - TC_LOG_WARN(LOG_FILTER_SQL, "Warning: GetUInt32() on non-(medium)int field. Using type: %s.", FieldTypeToString(data.type)); + TC_LOG_WARN("sql.sql", "Warning: GetUInt32() on non-(medium)int field. Using type: %s.", FieldTypeToString(data.type)); return 0; } #endif @@ -133,7 +133,7 @@ class Field #ifdef TRINITY_DEBUG if (!IsType(MYSQL_TYPE_INT24) && !IsType(MYSQL_TYPE_LONG)) { - TC_LOG_WARN(LOG_FILTER_SQL, "Warning: GetInt32() on non-(medium)int field. Using type: %s.", FieldTypeToString(data.type)); + TC_LOG_WARN("sql.sql", "Warning: GetInt32() on non-(medium)int field. Using type: %s.", FieldTypeToString(data.type)); return 0; } #endif @@ -151,7 +151,7 @@ class Field #ifdef TRINITY_DEBUG if (!IsType(MYSQL_TYPE_LONGLONG) && !IsType(MYSQL_TYPE_BIT)) { - TC_LOG_WARN(LOG_FILTER_SQL, "Warning: GetUInt64() on non-bigint field. Using type: %s.", FieldTypeToString(data.type)); + TC_LOG_WARN("sql.sql", "Warning: GetUInt64() on non-bigint field. Using type: %s.", FieldTypeToString(data.type)); return 0; } #endif @@ -169,7 +169,7 @@ class Field #ifdef TRINITY_DEBUG if (!IsType(MYSQL_TYPE_LONGLONG) && !IsType(MYSQL_TYPE_BIT)) { - TC_LOG_WARN(LOG_FILTER_SQL, "Warning: GetInt64() on non-bigint field. Using type: %s.", FieldTypeToString(data.type)); + TC_LOG_WARN("sql.sql", "Warning: GetInt64() on non-bigint field. Using type: %s.", FieldTypeToString(data.type)); return 0; } #endif @@ -187,7 +187,7 @@ class Field #ifdef TRINITY_DEBUG if (!IsType(MYSQL_TYPE_FLOAT)) { - TC_LOG_WARN(LOG_FILTER_SQL, "Warning: GetFloat() on non-float field. Using type: %s.", FieldTypeToString(data.type)); + TC_LOG_WARN("sql.sql", "Warning: GetFloat() on non-float field. Using type: %s.", FieldTypeToString(data.type)); return 0.0f; } #endif @@ -205,7 +205,7 @@ class Field #ifdef TRINITY_DEBUG if (!IsType(MYSQL_TYPE_DOUBLE)) { - TC_LOG_WARN(LOG_FILTER_SQL, "Warning: GetDouble() on non-double field. Using type: %s.", FieldTypeToString(data.type)); + TC_LOG_WARN("sql.sql", "Warning: GetDouble() on non-double field. Using type: %s.", FieldTypeToString(data.type)); return 0.0f; } #endif @@ -223,7 +223,7 @@ class Field #ifdef TRINITY_DEBUG if (IsNumeric()) { - TC_LOG_WARN(LOG_FILTER_SQL, "Error: GetCString() on numeric field. Using type: %s.", FieldTypeToString(data.type)); + TC_LOG_WARN("sql.sql", "Error: GetCString() on numeric field. Using type: %s.", FieldTypeToString(data.type)); return NULL; } #endif @@ -327,7 +327,7 @@ class Field MYSQL_TYPE_SET: */ default: - TC_LOG_WARN(LOG_FILTER_SQL, "SQL::SizeForType(): invalid field type %u", uint32(field->type)); + TC_LOG_WARN("sql.sql", "SQL::SizeForType(): invalid field type %u", uint32(field->type)); return 0; } } diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp index fdb71dd8d1a..da99d6c3537 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp +++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp @@ -178,8 +178,8 @@ void CharacterDatabaseConnection::DoPrepareStatements() PrepareStatement(CHAR_INS_GUILD_MEMBER, "INSERT INTO guild_member (guildid, guid, rank, pnote, offnote) VALUES (?, ?, ?, ?, ?)", CONNECTION_ASYNC); PrepareStatement(CHAR_DEL_GUILD_MEMBER, "DELETE FROM guild_member WHERE guid = ?", CONNECTION_ASYNC); // 0: uint32 PrepareStatement(CHAR_DEL_GUILD_MEMBERS, "DELETE FROM guild_member WHERE guildid = ?", CONNECTION_ASYNC); // 0: uint32 - // 0: uint32, 1: uint8, 3: string, 4: uint32 - PrepareStatement(CHAR_INS_GUILD_RANK, "INSERT INTO guild_rank (guildid, rid, rname, rights) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC); + // 0: uint32, 1: uint8, 3: string, 4: uint32, 5: uint32 + PrepareStatement(CHAR_INS_GUILD_RANK, "INSERT INTO guild_rank (guildid, rid, rname, rights, BankMoneyPerDay) VALUES (?, ?, ?, ?, ?)", CONNECTION_ASYNC); PrepareStatement(CHAR_DEL_GUILD_RANKS, "DELETE FROM guild_rank WHERE guildid = ?", CONNECTION_ASYNC); // 0: uint32 PrepareStatement(CHAR_DEL_GUILD_LOWEST_RANK, "DELETE FROM guild_rank WHERE guildid = ? AND rid >= ?", CONNECTION_ASYNC); // 0: uint32, 1: uint8 PrepareStatement(CHAR_INS_GUILD_BANK_TAB, "INSERT INTO guild_bank_tab (guildid, TabId) VALUES (?, ?)", CONNECTION_ASYNC); // 0: uint32, 1: uint8 @@ -353,16 +353,16 @@ void CharacterDatabaseConnection::DoPrepareStatements() // Player saving PrepareStatement(CHAR_INS_CHARACTER, "INSERT INTO characters (guid, account, name, race, class, gender, level, xp, money, playerBytes, playerBytes2, playerFlags, " - "map, instance_id, instance_mode_mask, position_x, position_y, position_z, orientation, " + "map, instance_id, instance_mode_mask, position_x, position_y, position_z, orientation, trans_x, trans_y, trans_z, trans_o, transguid, " "taximask, cinematic, " "totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, resettalents_time, " "extra_flags, stable_slots, at_login, zone, " "death_expire_time, taxi_path, arenaPoints, totalHonorPoints, todayHonorPoints, yesterdayHonorPoints, totalKills, " "todayKills, yesterdayKills, chosenTitle, knownCurrencies, watchedFaction, drunk, health, power1, power2, power3, " "power4, power5, power6, power7, latency, speccount, activespec, exploredZones, equipmentCache, ammoId, knownTitles, actionBars, grantableLevels) VALUES " - "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", CONNECTION_ASYNC); + "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", CONNECTION_ASYNC); PrepareStatement(CHAR_UPD_CHARACTER, "UPDATE characters SET name=?,race=?,class=?,gender=?,level=?,xp=?,money=?,playerBytes=?,playerBytes2=?,playerFlags=?," - "map=?,instance_id=?,instance_mode_mask=?,position_x=?,position_y=?,position_z=?,orientation=?,taximask=?,cinematic=?,totaltime=?,leveltime=?,rest_bonus=?," + "map=?,instance_id=?,instance_mode_mask=?,position_x=?,position_y=?,position_z=?,orientation=?,trans_x=?,trans_y=?,trans_z=?,trans_o=?,transguid=?,taximask=?,cinematic=?,totaltime=?,leveltime=?,rest_bonus=?," "logout_time=?,is_logout_resting=?,resettalents_cost=?,resettalents_time=?,extra_flags=?,stable_slots=?,at_login=?,zone=?,death_expire_time=?,taxi_path=?," "arenaPoints=?,totalHonorPoints=?,todayHonorPoints=?,yesterdayHonorPoints=?,totalKills=?,todayKills=?,yesterdayKills=?,chosenTitle=?,knownCurrencies=?," "watchedFaction=?,drunk=?,health=?,power1=?,power2=?,power3=?,power4=?,power5=?,power6=?,power7=?,latency=?,speccount=?,activespec=?,exploredZones=?," diff --git a/src/server/shared/Database/Implementation/LoginDatabase.cpp b/src/server/shared/Database/Implementation/LoginDatabase.cpp index cfb5eecc5f1..f6754629e38 100644 --- a/src/server/shared/Database/Implementation/LoginDatabase.cpp +++ b/src/server/shared/Database/Implementation/LoginDatabase.cpp @@ -36,7 +36,7 @@ void LoginDatabaseConnection::DoPrepareStatements() PrepareStatement(LOGIN_DEL_ACCOUNT_BANNED, "DELETE FROM account_banned WHERE id = ?", CONNECTION_ASYNC); PrepareStatement(LOGIN_SEL_SESSIONKEY, "SELECT a.sessionkey, a.id, aa.gmlevel FROM account a LEFT JOIN account_access aa ON (a.id = aa.id) WHERE username = ?", CONNECTION_SYNCH); PrepareStatement(LOGIN_UPD_VS, "UPDATE account SET v = ?, s = ? WHERE username = ?", CONNECTION_ASYNC); - PrepareStatement(LOGIN_UPD_LOGONPROOF, "UPDATE account SET sessionkey = ?, last_ip = ?, last_login = NOW(), locale = ?, failed_logins = 0, os = ? WHERE username = ?", CONNECTION_ASYNC); + PrepareStatement(LOGIN_UPD_LOGONPROOF, "UPDATE account SET sessionkey = ?, last_ip = ?, last_login = NOW(), locale = ?, failed_logins = 0, os = ? WHERE username = ?", CONNECTION_SYNCH); PrepareStatement(LOGIN_SEL_LOGONCHALLENGE, "SELECT a.sha_pass_hash, a.id, a.locked, a.lock_country, a.last_ip, aa.gmlevel, a.v, a.s, a.token_key FROM account a LEFT JOIN account_access aa ON (a.id = aa.id) WHERE a.username = ?", CONNECTION_SYNCH); PrepareStatement(LOGIN_SEL_LOGON_COUNTRY, "SELECT country FROM ip2nation WHERE ip < ? ORDER BY ip DESC LIMIT 0,1", CONNECTION_SYNCH); PrepareStatement(LOGIN_UPD_FAILEDLOGINS, "UPDATE account SET failed_logins = failed_logins + 1 WHERE username = ?", CONNECTION_ASYNC); diff --git a/src/server/shared/Database/MySQLConnection.cpp b/src/server/shared/Database/MySQLConnection.cpp index 25ffbc18614..f569b8352d3 100644 --- a/src/server/shared/Database/MySQLConnection.cpp +++ b/src/server/shared/Database/MySQLConnection.cpp @@ -76,7 +76,7 @@ bool MySQLConnection::Open() mysqlInit = mysql_init(NULL); if (!mysqlInit) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Could not initialize Mysql connection to database `%s`", m_connectionInfo.database.c_str()); + TC_LOG_ERROR("sql.sql", "Could not initialize Mysql connection to database `%s`", m_connectionInfo.database.c_str()); return false; } @@ -122,14 +122,14 @@ bool MySQLConnection::Open() { if (!m_reconnecting) { - TC_LOG_INFO(LOG_FILTER_SQL, "MySQL client library: %s", mysql_get_client_info()); - TC_LOG_INFO(LOG_FILTER_SQL, "MySQL server ver: %s ", mysql_get_server_info(m_Mysql)); + TC_LOG_INFO("sql.sql", "MySQL client library: %s", mysql_get_client_info()); + TC_LOG_INFO("sql.sql", "MySQL server ver: %s ", mysql_get_server_info(m_Mysql)); // MySQL version above 5.1 IS required in both client and server and there is no known issue with different versions above 5.1 // if (mysql_get_server_version(m_Mysql) != mysql_get_client_version()) - // TC_LOG_INFO(LOG_FILTER_SQL, "[WARNING] MySQL client/server version mismatch; may conflict with behaviour of prepared statements."); + // TC_LOG_INFO("sql.sql", "[WARNING] MySQL client/server version mismatch; may conflict with behaviour of prepared statements."); } - TC_LOG_INFO(LOG_FILTER_SQL, "Connected to MySQL database at %s", m_connectionInfo.host.c_str()); + TC_LOG_INFO("sql.sql", "Connected to MySQL database at %s", m_connectionInfo.host.c_str()); mysql_autocommit(m_Mysql, 1); // set connection properties to UTF8 to properly handle locales for different @@ -139,7 +139,7 @@ bool MySQLConnection::Open() } else { - TC_LOG_ERROR(LOG_FILTER_SQL, "Could not connect to MySQL database at %s: %s\n", m_connectionInfo.host.c_str(), mysql_error(mysqlInit)); + TC_LOG_ERROR("sql.sql", "Could not connect to MySQL database at %s: %s\n", m_connectionInfo.host.c_str(), mysql_error(mysqlInit)); mysql_close(mysqlInit); return false; } @@ -163,8 +163,8 @@ bool MySQLConnection::Execute(const char* sql) { uint32 lErrno = mysql_errno(m_Mysql); - TC_LOG_INFO(LOG_FILTER_SQL, "SQL: %s", sql); - TC_LOG_ERROR(LOG_FILTER_SQL, "[%u] %s", lErrno, mysql_error(m_Mysql)); + TC_LOG_INFO("sql.sql", "SQL: %s", sql); + TC_LOG_ERROR("sql.sql", "[%u] %s", lErrno, mysql_error(m_Mysql)); if (_HandleMySQLErrno(lErrno)) // If it returns true, an error was handled successfully (i.e. reconnection) return Execute(sql); // Try again @@ -172,7 +172,7 @@ bool MySQLConnection::Execute(const char* sql) return false; } else - TC_LOG_DEBUG(LOG_FILTER_SQL, "[%u ms] SQL: %s", getMSTimeDiff(_s, getMSTime()), sql); + TC_LOG_DEBUG("sql.sql", "[%u ms] SQL: %s", getMSTimeDiff(_s, getMSTime()), sql); } return true; @@ -200,7 +200,7 @@ bool MySQLConnection::Execute(PreparedStatement* stmt) if (mysql_stmt_bind_param(msql_STMT, msql_BIND)) { uint32 lErrno = mysql_errno(m_Mysql); - TC_LOG_ERROR(LOG_FILTER_SQL, "SQL(p): %s\n [ERROR]: [%u] %s", m_mStmt->getQueryString(m_queries[index].first).c_str(), lErrno, mysql_stmt_error(msql_STMT)); + TC_LOG_ERROR("sql.sql", "SQL(p): %s\n [ERROR]: [%u] %s", m_mStmt->getQueryString(m_queries[index].first).c_str(), lErrno, mysql_stmt_error(msql_STMT)); if (_HandleMySQLErrno(lErrno)) // If it returns true, an error was handled successfully (i.e. reconnection) return Execute(stmt); // Try again @@ -212,7 +212,7 @@ bool MySQLConnection::Execute(PreparedStatement* stmt) if (mysql_stmt_execute(msql_STMT)) { uint32 lErrno = mysql_errno(m_Mysql); - TC_LOG_ERROR(LOG_FILTER_SQL, "SQL(p): %s\n [ERROR]: [%u] %s", m_mStmt->getQueryString(m_queries[index].first).c_str(), lErrno, mysql_stmt_error(msql_STMT)); + TC_LOG_ERROR("sql.sql", "SQL(p): %s\n [ERROR]: [%u] %s", m_mStmt->getQueryString(m_queries[index].first).c_str(), lErrno, mysql_stmt_error(msql_STMT)); if (_HandleMySQLErrno(lErrno)) // If it returns true, an error was handled successfully (i.e. reconnection) return Execute(stmt); // Try again @@ -221,7 +221,7 @@ bool MySQLConnection::Execute(PreparedStatement* stmt) return false; } - TC_LOG_DEBUG(LOG_FILTER_SQL, "[%u ms] SQL(p): %s", getMSTimeDiff(_s, getMSTime()), m_mStmt->getQueryString(m_queries[index].first).c_str()); + TC_LOG_DEBUG("sql.sql", "[%u ms] SQL(p): %s", getMSTimeDiff(_s, getMSTime()), m_mStmt->getQueryString(m_queries[index].first).c_str()); m_mStmt->ClearParameters(); return true; @@ -250,7 +250,7 @@ bool MySQLConnection::_Query(PreparedStatement* stmt, MYSQL_RES **pResult, uint6 if (mysql_stmt_bind_param(msql_STMT, msql_BIND)) { uint32 lErrno = mysql_errno(m_Mysql); - TC_LOG_ERROR(LOG_FILTER_SQL, "SQL(p): %s\n [ERROR]: [%u] %s", m_mStmt->getQueryString(m_queries[index].first).c_str(), lErrno, mysql_stmt_error(msql_STMT)); + TC_LOG_ERROR("sql.sql", "SQL(p): %s\n [ERROR]: [%u] %s", m_mStmt->getQueryString(m_queries[index].first).c_str(), lErrno, mysql_stmt_error(msql_STMT)); if (_HandleMySQLErrno(lErrno)) // If it returns true, an error was handled successfully (i.e. reconnection) return _Query(stmt, pResult, pRowCount, pFieldCount); // Try again @@ -262,7 +262,7 @@ bool MySQLConnection::_Query(PreparedStatement* stmt, MYSQL_RES **pResult, uint6 if (mysql_stmt_execute(msql_STMT)) { uint32 lErrno = mysql_errno(m_Mysql); - TC_LOG_ERROR(LOG_FILTER_SQL, "SQL(p): %s\n [ERROR]: [%u] %s", + TC_LOG_ERROR("sql.sql", "SQL(p): %s\n [ERROR]: [%u] %s", m_mStmt->getQueryString(m_queries[index].first).c_str(), lErrno, mysql_stmt_error(msql_STMT)); if (_HandleMySQLErrno(lErrno)) // If it returns true, an error was handled successfully (i.e. reconnection) @@ -272,7 +272,7 @@ bool MySQLConnection::_Query(PreparedStatement* stmt, MYSQL_RES **pResult, uint6 return false; } - TC_LOG_DEBUG(LOG_FILTER_SQL, "[%u ms] SQL(p): %s", getMSTimeDiff(_s, getMSTime()), m_mStmt->getQueryString(m_queries[index].first).c_str()); + TC_LOG_DEBUG("sql.sql", "[%u ms] SQL(p): %s", getMSTimeDiff(_s, getMSTime()), m_mStmt->getQueryString(m_queries[index].first).c_str()); m_mStmt->ClearParameters(); @@ -312,8 +312,8 @@ bool MySQLConnection::_Query(const char *sql, MYSQL_RES **pResult, MYSQL_FIELD * if (mysql_query(m_Mysql, sql)) { uint32 lErrno = mysql_errno(m_Mysql); - TC_LOG_INFO(LOG_FILTER_SQL, "SQL: %s", sql); - TC_LOG_ERROR(LOG_FILTER_SQL, "[%u] %s", lErrno, mysql_error(m_Mysql)); + TC_LOG_INFO("sql.sql", "SQL: %s", sql); + TC_LOG_ERROR("sql.sql", "[%u] %s", lErrno, mysql_error(m_Mysql)); if (_HandleMySQLErrno(lErrno)) // If it returns true, an error was handled successfully (i.e. reconnection) return _Query(sql, pResult, pFields, pRowCount, pFieldCount); // We try again @@ -321,7 +321,7 @@ bool MySQLConnection::_Query(const char *sql, MYSQL_RES **pResult, MYSQL_FIELD * return false; } else - TC_LOG_DEBUG(LOG_FILTER_SQL, "[%u ms] SQL: %s", getMSTimeDiff(_s, getMSTime()), sql); + TC_LOG_DEBUG("sql.sql", "[%u ms] SQL: %s", getMSTimeDiff(_s, getMSTime()), sql); *pResult = mysql_store_result(m_Mysql); *pRowCount = mysql_affected_rows(m_Mysql); @@ -377,7 +377,7 @@ bool MySQLConnection::ExecuteTransaction(SQLTransaction& transaction) ASSERT(stmt); if (!Execute(stmt)) { - TC_LOG_WARN(LOG_FILTER_SQL, "Transaction aborted. %u queries not executed.", (uint32)queries.size()); + TC_LOG_WARN("sql.sql", "Transaction aborted. %u queries not executed.", (uint32)queries.size()); RollbackTransaction(); return false; } @@ -389,7 +389,7 @@ bool MySQLConnection::ExecuteTransaction(SQLTransaction& transaction) ASSERT(sql); if (!Execute(sql)) { - TC_LOG_WARN(LOG_FILTER_SQL, "Transaction aborted. %u queries not executed.", (uint32)queries.size()); + TC_LOG_WARN("sql.sql", "Transaction aborted. %u queries not executed.", (uint32)queries.size()); RollbackTransaction(); return false; } @@ -412,7 +412,7 @@ MySQLPreparedStatement* MySQLConnection::GetPreparedStatement(uint32 index) ASSERT(index < m_stmts.size()); MySQLPreparedStatement* ret = m_stmts[index]; if (!ret) - TC_LOG_ERROR(LOG_FILTER_SQL, "Could not fetch prepared statement %u on database `%s`, connection type: %s.", + TC_LOG_ERROR("sql.sql", "Could not fetch prepared statement %u on database `%s`, connection type: %s.", index, m_connectionInfo.database.c_str(), (m_connectionFlags & CONNECTION_ASYNC) ? "asynchronous" : "synchronous"); return ret; @@ -438,16 +438,16 @@ void MySQLConnection::PrepareStatement(uint32 index, const char* sql, Connection MYSQL_STMT* stmt = mysql_stmt_init(m_Mysql); if (!stmt) { - TC_LOG_ERROR(LOG_FILTER_SQL, "In mysql_stmt_init() id: %u, sql: \"%s\"", index, sql); - TC_LOG_ERROR(LOG_FILTER_SQL, "%s", mysql_error(m_Mysql)); + TC_LOG_ERROR("sql.sql", "In mysql_stmt_init() id: %u, sql: \"%s\"", index, sql); + TC_LOG_ERROR("sql.sql", "%s", mysql_error(m_Mysql)); m_prepareError = true; } else { if (mysql_stmt_prepare(stmt, sql, static_cast<unsigned long>(strlen(sql)))) { - TC_LOG_ERROR(LOG_FILTER_SQL, "In mysql_stmt_prepare() id: %u, sql: \"%s\"", index, sql); - TC_LOG_ERROR(LOG_FILTER_SQL, "%s", mysql_stmt_error(stmt)); + TC_LOG_ERROR("sql.sql", "In mysql_stmt_prepare() id: %u, sql: \"%s\"", index, sql); + TC_LOG_ERROR("sql.sql", "%s", mysql_stmt_error(stmt)); mysql_stmt_close(stmt); m_prepareError = true; } @@ -489,9 +489,9 @@ bool MySQLConnection::_HandleMySQLErrno(uint32 errNo) mysql_close(GetHandle()); if (this->Open()) // Don't remove 'this' pointer unless you want to skip loading all prepared statements.... { - TC_LOG_INFO(LOG_FILTER_SQL, "Connection to the MySQL server is active."); + TC_LOG_INFO("sql.sql", "Connection to the MySQL server is active."); if (oldThreadId != mysql_thread_id(GetHandle())) - TC_LOG_INFO(LOG_FILTER_SQL, "Successfully reconnected to %s @%s:%s (%s).", + TC_LOG_INFO("sql.sql", "Successfully reconnected to %s @%s:%s (%s).", m_connectionInfo.database.c_str(), m_connectionInfo.host.c_str(), m_connectionInfo.port_or_socket.c_str(), (m_connectionFlags & CONNECTION_ASYNC) ? "asynchronous" : "synchronous"); @@ -514,17 +514,17 @@ bool MySQLConnection::_HandleMySQLErrno(uint32 errNo) // Outdated table or database structure - terminate core case ER_BAD_FIELD_ERROR: case ER_NO_SUCH_TABLE: - TC_LOG_ERROR(LOG_FILTER_SQL, "Your database structure is not up to date. Please make sure you've executed all queries in the sql/updates folders."); + TC_LOG_ERROR("sql.sql", "Your database structure is not up to date. Please make sure you've executed all queries in the sql/updates folders."); ACE_OS::sleep(10); std::abort(); return false; case ER_PARSE_ERROR: - TC_LOG_ERROR(LOG_FILTER_SQL, "Error while parsing SQL. Core fix required."); + TC_LOG_ERROR("sql.sql", "Error while parsing SQL. Core fix required."); ACE_OS::sleep(10); std::abort(); return false; default: - TC_LOG_ERROR(LOG_FILTER_SQL, "Unhandled MySQL errno %u. Unexpected behaviour possible.", errNo); + TC_LOG_ERROR("sql.sql", "Unhandled MySQL errno %u. Unexpected behaviour possible.", errNo); return false; } } diff --git a/src/server/shared/Database/MySQLThreading.h b/src/server/shared/Database/MySQLThreading.h index 4fe928dcc22..38c0d349a1c 100644 --- a/src/server/shared/Database/MySQLThreading.h +++ b/src/server/shared/Database/MySQLThreading.h @@ -33,7 +33,7 @@ class MySQL static void Thread_Init() { mysql_thread_init(); - TC_LOG_WARN(LOG_FILTER_SQL, "Core thread with ID [" UI64FMTD "] initializing MySQL thread.", + TC_LOG_WARN("sql.sql", "Core thread with ID [" UI64FMTD "] initializing MySQL thread.", (uint64)ACE_Based::Thread::currentId()); } @@ -44,7 +44,7 @@ class MySQL static void Thread_End() { mysql_thread_end(); - TC_LOG_WARN(LOG_FILTER_SQL, "Core thread with ID [" UI64FMTD "] shutting down MySQL thread.", + TC_LOG_WARN("sql.sql", "Core thread with ID [" UI64FMTD "] shutting down MySQL thread.", (uint64)ACE_Based::Thread::currentId()); } diff --git a/src/server/shared/Database/PreparedStatement.cpp b/src/server/shared/Database/PreparedStatement.cpp index 84f1e1b6fd1..30089cfb197 100644 --- a/src/server/shared/Database/PreparedStatement.cpp +++ b/src/server/shared/Database/PreparedStatement.cpp @@ -77,7 +77,7 @@ void PreparedStatement::BindParameters() } #ifdef _DEBUG if (i < m_stmt->m_paramCount) - TC_LOG_WARN(LOG_FILTER_SQL, "[WARNING]: BindParameters() for statement %u did not bind all allocated parameters", m_index); + TC_LOG_WARN("sql.sql", "[WARNING]: BindParameters() for statement %u did not bind all allocated parameters", m_index); #endif } @@ -240,7 +240,7 @@ void MySQLPreparedStatement::ClearParameters() static bool ParamenterIndexAssertFail(uint32 stmtIndex, uint8 index, uint32 paramCount) { - TC_LOG_ERROR(LOG_FILTER_SQL_DRIVER, "Attempted to bind parameter %u%s on a PreparedStatement %u (statement has only %u parameters)", uint32(index) + 1, (index == 1 ? "st" : (index == 2 ? "nd" : (index == 3 ? "rd" : "nd"))), stmtIndex, paramCount); + TC_LOG_ERROR("sql.driver", "Attempted to bind parameter %u%s on a PreparedStatement %u (statement has only %u parameters)", uint32(index) + 1, (index == 1 ? "st" : (index == 2 ? "nd" : (index == 3 ? "rd" : "nd"))), stmtIndex, paramCount); return false; } @@ -250,7 +250,7 @@ bool MySQLPreparedStatement::CheckValidIndex(uint8 index) ASSERT(index < m_paramCount || ParamenterIndexAssertFail(m_stmt->m_index, index, m_paramCount)); if (m_paramsSet[index]) - TC_LOG_WARN(LOG_FILTER_SQL, "[WARNING] Prepared Statement (id: %u) trying to bind value on already bound index (%u).", m_stmt->m_index, index); + TC_LOG_WARN("sql.sql", "[WARNING] Prepared Statement (id: %u) trying to bind value on already bound index (%u).", m_stmt->m_index, index); return true; } diff --git a/src/server/shared/Database/QueryHolder.cpp b/src/server/shared/Database/QueryHolder.cpp index 0a7c19af6d0..77980c4f66e 100644 --- a/src/server/shared/Database/QueryHolder.cpp +++ b/src/server/shared/Database/QueryHolder.cpp @@ -24,7 +24,7 @@ bool SQLQueryHolder::SetQuery(size_t index, const char *sql) { if (m_queries.size() <= index) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Query index (%u) out of range (size: %u) for query: %s", uint32(index), (uint32)m_queries.size(), sql); + TC_LOG_ERROR("sql.sql", "Query index (%u) out of range (size: %u) for query: %s", uint32(index), (uint32)m_queries.size(), sql); return false; } @@ -44,7 +44,7 @@ bool SQLQueryHolder::SetPQuery(size_t index, const char *format, ...) { if (!format) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Query (index: %u) is empty.", uint32(index)); + TC_LOG_ERROR("sql.sql", "Query (index: %u) is empty.", uint32(index)); return false; } @@ -56,7 +56,7 @@ bool SQLQueryHolder::SetPQuery(size_t index, const char *format, ...) if (res == -1) { - TC_LOG_ERROR(LOG_FILTER_SQL, "SQL Query truncated (and not execute) for format: %s", format); + TC_LOG_ERROR("sql.sql", "SQL Query truncated (and not execute) for format: %s", format); return false; } @@ -67,7 +67,7 @@ bool SQLQueryHolder::SetPreparedQuery(size_t index, PreparedStatement* stmt) { if (m_queries.size() <= index) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Query index (%u) out of range (size: %u) for prepared statement", uint32(index), (uint32)m_queries.size()); + TC_LOG_ERROR("sql.sql", "Query index (%u) out of range (size: %u) for prepared statement", uint32(index), (uint32)m_queries.size()); return false; } @@ -169,6 +169,9 @@ void SQLQueryHolder::SetSize(size_t size) bool SQLQueryHolderTask::Execute() { + //the result can't be ready as we are processing it right now + ASSERT(!m_result.ready()); + if (!m_holder) return false; diff --git a/src/server/shared/Database/QueryResult.cpp b/src/server/shared/Database/QueryResult.cpp index 9413e28a0c0..be81570318a 100644 --- a/src/server/shared/Database/QueryResult.cpp +++ b/src/server/shared/Database/QueryResult.cpp @@ -59,7 +59,7 @@ m_length(NULL) //- This is where we store the (entire) resultset if (mysql_stmt_store_result(m_stmt)) { - TC_LOG_WARN(LOG_FILTER_SQL, "%s:mysql_stmt_store_result, cannot bind result from MySQL server. Error: %s", __FUNCTION__, mysql_stmt_error(m_stmt)); + TC_LOG_WARN("sql.sql", "%s:mysql_stmt_store_result, cannot bind result from MySQL server. Error: %s", __FUNCTION__, mysql_stmt_error(m_stmt)); delete[] m_rBind; delete[] m_isNull; delete[] m_length; @@ -89,7 +89,7 @@ m_length(NULL) //- This is where we bind the bind the buffer to the statement if (mysql_stmt_bind_result(m_stmt, m_rBind)) { - TC_LOG_WARN(LOG_FILTER_SQL, "%s:mysql_stmt_bind_result, cannot bind result from MySQL server. Error: %s", __FUNCTION__, mysql_stmt_error(m_stmt)); + TC_LOG_WARN("sql.sql", "%s:mysql_stmt_bind_result, cannot bind result from MySQL server. Error: %s", __FUNCTION__, mysql_stmt_error(m_stmt)); delete[] m_rBind; delete[] m_isNull; delete[] m_length; diff --git a/src/server/shared/Logging/Appender.cpp b/src/server/shared/Logging/Appender.cpp index 89fe8d39a1d..06aa6159014 100644 --- a/src/server/shared/Logging/Appender.cpp +++ b/src/server/shared/Logging/Appender.cpp @@ -74,7 +74,7 @@ void Appender::write(LogMessage& message) message.prefix.clear(); if (flags & APPENDER_FLAGS_PREFIX_TIMESTAMP) - message.prefix.append(message.getTimeStr().c_str()); + message.prefix.append(message.getTimeStr()); if (flags & APPENDER_FLAGS_PREFIX_LOGLEVEL) { @@ -91,9 +91,9 @@ void Appender::write(LogMessage& message) if (!message.prefix.empty()) message.prefix.push_back(' '); - char text[MAX_QUERY_LEN]; - snprintf(text, MAX_QUERY_LEN, "[%s]", Appender::getLogFilterTypeString(message.type)); - message.prefix.append(text); + message.prefix.push_back('['); + message.prefix.append(message.type); + message.prefix.push_back(']'); } if (!message.prefix.empty()) @@ -122,104 +122,3 @@ const char* Appender::getLogLevelString(LogLevel level) return "DISABLED"; } } - -char const* Appender::getLogFilterTypeString(LogFilterType type) -{ - switch (type) - { - case LOG_FILTER_GENERAL: - return "GENERAL"; - case LOG_FILTER_UNITS: - return "UNITS"; - case LOG_FILTER_PETS: - return "PETS"; - case LOG_FILTER_VEHICLES: - return "VEHICLES"; - case LOG_FILTER_TSCR: - return "TSCR"; - case LOG_FILTER_DATABASE_AI: - return "DATABASE_AI"; - case LOG_FILTER_MAPSCRIPTS: - return "MAPSCRIPTS"; - case LOG_FILTER_NETWORKIO: - return "NETWORKIO"; - case LOG_FILTER_SPELLS_AURAS: - return "SPELLS_AURAS"; - case LOG_FILTER_ACHIEVEMENTSYS: - return "ACHIEVEMENTSYS"; - case LOG_FILTER_CONDITIONSYS: - return "CONDITIONSYS"; - case LOG_FILTER_POOLSYS: - return "POOLSYS"; - case LOG_FILTER_AUCTIONHOUSE: - return "AUCTIONHOUSE"; - case LOG_FILTER_BATTLEGROUND: - return "BATTLEGROUND"; - case LOG_FILTER_OUTDOORPVP: - return "OUTDOORPVP"; - case LOG_FILTER_CHATSYS: - return "CHATSYS"; - case LOG_FILTER_LFG: - return "LFG"; - case LOG_FILTER_MAPS: - return "MAPS"; - case LOG_FILTER_PLAYER: - return "PLAYER"; - case LOG_FILTER_PLAYER_LOADING: - return "PLAYER LOADING"; - case LOG_FILTER_PLAYER_ITEMS: - return "PLAYER ITEMS"; - case LOG_FILTER_PLAYER_SKILLS: - return "PLAYER SKILLS"; - case LOG_FILTER_PLAYER_CHATLOG: - return "PLAYER CHATLOG"; - case LOG_FILTER_LOOT: - return "LOOT"; - case LOG_FILTER_GUILD: - return "GUILD"; - case LOG_FILTER_TRANSPORTS: - return "TRANSPORTS"; - case LOG_FILTER_SQL: - return "SQL"; - case LOG_FILTER_GMCOMMAND: - return "GMCOMMAND"; - case LOG_FILTER_REMOTECOMMAND: - return "REMOTECOMMAND"; - case LOG_FILTER_WARDEN: - return "WARDEN"; - case LOG_FILTER_AUTHSERVER: - return "AUTHSERVER"; - case LOG_FILTER_WORLDSERVER: - return "WORLDSERVER"; - case LOG_FILTER_GAMEEVENTS: - return "GAMEEVENTS"; - case LOG_FILTER_CALENDAR: - return "CALENDAR"; - case LOG_FILTER_CHARACTER: - return "CHARACTER"; - case LOG_FILTER_ARENAS: - return "ARENAS"; - case LOG_FILTER_SQL_DRIVER: - return "SQL DRIVER"; - case LOG_FILTER_SQL_DEV: - return "SQL DEV"; - case LOG_FILTER_PLAYER_DUMP: - return "PLAYER DUMP"; - case LOG_FILTER_BATTLEFIELD: - return "BATTLEFIELD"; - case LOG_FILTER_SERVER_LOADING: - return "SERVER LOADING"; - case LOG_FILTER_OPCODES: - return "OPCODE"; - case LOG_FILTER_SOAP: - return "SOAP"; - case LOG_FILTER_RBAC: - return "RBAC"; - case LOG_FILTER_CHEAT: - return "CHEAT"; - default: - break; - } - - return "???"; -} diff --git a/src/server/shared/Logging/Appender.h b/src/server/shared/Logging/Appender.h index 14fe52f0837..437c301ea6b 100644 --- a/src/server/shared/Logging/Appender.h +++ b/src/server/shared/Logging/Appender.h @@ -24,57 +24,6 @@ #include <string> -enum LogFilterType -{ - LOG_FILTER_GENERAL = 0, // This one should only be used inside Log.cpp - LOG_FILTER_UNITS = 1, // Anything related to units that doesn't fit in other categories. ie. creature formations - LOG_FILTER_PETS = 2, - LOG_FILTER_VEHICLES = 3, - LOG_FILTER_TSCR = 4, // C++ AI, instance scripts, etc. - LOG_FILTER_DATABASE_AI = 5, // SmartAI, EventAI, Creature* * AI - LOG_FILTER_MAPSCRIPTS = 6, - LOG_FILTER_NETWORKIO = 7, - LOG_FILTER_SPELLS_AURAS = 8, - LOG_FILTER_ACHIEVEMENTSYS = 9, - LOG_FILTER_CONDITIONSYS = 10, - LOG_FILTER_POOLSYS = 11, - LOG_FILTER_AUCTIONHOUSE = 12, - LOG_FILTER_BATTLEGROUND = 13, - LOG_FILTER_OUTDOORPVP = 14, - LOG_FILTER_CHATSYS = 15, - LOG_FILTER_LFG = 16, - LOG_FILTER_MAPS = 17, - LOG_FILTER_PLAYER = 18, // Any player log that does not fit in other player filters - LOG_FILTER_PLAYER_LOADING = 19, // Debug output from Player::_Load functions - LOG_FILTER_PLAYER_ITEMS = 20, - LOG_FILTER_PLAYER_SKILLS = 21, - LOG_FILTER_PLAYER_CHATLOG = 22, - LOG_FILTER_LOOT = 23, - LOG_FILTER_GUILD = 24, - LOG_FILTER_TRANSPORTS = 25, - LOG_FILTER_SQL = 26, - LOG_FILTER_GMCOMMAND = 27, - LOG_FILTER_REMOTECOMMAND = 28, - LOG_FILTER_WARDEN = 29, - LOG_FILTER_AUTHSERVER = 30, - LOG_FILTER_WORLDSERVER = 31, - LOG_FILTER_GAMEEVENTS = 32, - LOG_FILTER_CALENDAR = 33, - LOG_FILTER_CHARACTER = 34, - LOG_FILTER_ARENAS = 35, - LOG_FILTER_SQL_DRIVER = 36, - LOG_FILTER_SQL_DEV = 37, - LOG_FILTER_PLAYER_DUMP = 38, - LOG_FILTER_BATTLEFIELD = 39, - LOG_FILTER_SERVER_LOADING = 40, - LOG_FILTER_OPCODES = 41, - LOG_FILTER_SOAP = 42, - LOG_FILTER_RBAC = 43, - LOG_FILTER_CHEAT = 44 -}; - -const uint8 MaxLogFilter = 45; - // Values assigned have their equivalent in enum ACE_Log_Priority enum LogLevel { @@ -109,7 +58,7 @@ enum AppenderFlags struct LogMessage { - LogMessage(LogLevel _level, LogFilterType _type, std::string _text) + LogMessage(LogLevel _level, std::string const& _type, std::string const& _text) : level(_level), type(_type), text(_text), mtime(time(NULL)) { } @@ -117,7 +66,7 @@ struct LogMessage std::string getTimeStr(); LogLevel level; - LogFilterType type; + std::string type; std::string text; std::string prefix; std::string param1; @@ -126,7 +75,7 @@ struct LogMessage ///@ Returns size of the log message content in bytes uint32 Size() const { - return prefix.size() + text.size(); + return static_cast<uint32>(prefix.size() + text.size()); } }; @@ -145,7 +94,6 @@ class Appender void setLogLevel(LogLevel); void write(LogMessage& message); static const char* getLogLevelString(LogLevel level); - static const char* getLogFilterTypeString(LogFilterType type); private: virtual void _write(LogMessage const& /*message*/) = 0; diff --git a/src/server/shared/Logging/AppenderConsole.cpp b/src/server/shared/Logging/AppenderConsole.cpp index a1212bd135b..78350029205 100644 --- a/src/server/shared/Logging/AppenderConsole.cpp +++ b/src/server/shared/Logging/AppenderConsole.cpp @@ -59,7 +59,7 @@ void AppenderConsole::InitColors(std::string const& str) void AppenderConsole::SetColor(bool stdout_stream, ColorTypes color) { - #if PLATFORM == PLATFORM_WINDOWS +#if PLATFORM == PLATFORM_WINDOWS static WORD WinColorFG[MaxColors] = { 0, // BLACK @@ -87,7 +87,7 @@ void AppenderConsole::SetColor(bool stdout_stream, ColorTypes color) HANDLE hConsole = GetStdHandle(stdout_stream ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE); SetConsoleTextAttribute(hConsole, WinColorFG[color]); - #else +#else enum ANSITextAttr { TA_NORMAL = 0, @@ -156,7 +156,7 @@ void AppenderConsole::ResetColor(bool stdout_stream) void AppenderConsole::_write(LogMessage const& message) { - bool stdout_stream = message.level == LOG_LEVEL_ERROR || message.level == LOG_LEVEL_FATAL; + bool stdout_stream = !(message.level == LOG_LEVEL_ERROR || message.level == LOG_LEVEL_FATAL); if (_colored) { diff --git a/src/server/shared/Logging/AppenderDB.cpp b/src/server/shared/Logging/AppenderDB.cpp index 8b237277d79..204592720dc 100644 --- a/src/server/shared/Logging/AppenderDB.cpp +++ b/src/server/shared/Logging/AppenderDB.cpp @@ -25,25 +25,17 @@ AppenderDB::~AppenderDB() { } void AppenderDB::_write(LogMessage const& message) { - if (!enabled) + // Avoid infinite loop, PExecute triggers Logging with "sql.sql" type + if (!enabled || !message.type.find("sql")) return; - switch (message.type) - { - case LOG_FILTER_SQL: - case LOG_FILTER_SQL_DRIVER: - case LOG_FILTER_SQL_DEV: - break; // Avoid infinite loop, PExecute triggers Logging with LOG_FILTER_SQL type - default: - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_LOG); - stmt->setUInt64(0, message.mtime); - stmt->setUInt32(1, realmId); - stmt->setUInt8(2, uint8(message.type)); - stmt->setUInt8(3, uint8(message.level)); - stmt->setString(4, message.text); - LoginDatabase.Execute(stmt); - break; - } + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_LOG); + stmt->setUInt64(0, message.mtime); + stmt->setUInt32(1, realmId); + stmt->setString(2, message.type); + stmt->setUInt8(3, uint8(message.level)); + stmt->setString(4, message.text); + LoginDatabase.Execute(stmt); } void AppenderDB::setRealmId(uint32 _realmId) diff --git a/src/server/shared/Logging/AppenderFile.cpp b/src/server/shared/Logging/AppenderFile.cpp index 54458346bb9..d5410112b97 100644 --- a/src/server/shared/Logging/AppenderFile.cpp +++ b/src/server/shared/Logging/AppenderFile.cpp @@ -16,7 +16,10 @@ */ #include "AppenderFile.h" -#include "Common.h" + +#if PLATFORM == PLATFORM_WINDOWS +# include <Windows.h> +#endif AppenderFile::AppenderFile(uint8 id, std::string const& name, LogLevel level, const char* _filename, const char* _logDir, const char* _mode, AppenderFlags _flags, uint64 fileSize): Appender(id, name, APPENDER_FILE, level, _flags), @@ -28,7 +31,7 @@ AppenderFile::AppenderFile(uint8 id, std::string const& name, LogLevel level, co fileSize(0) { dynamicName = std::string::npos != filename.find("%s"); - backup = _flags & APPENDER_FLAGS_MAKE_FILE_BACKUP; + backup = (_flags & APPENDER_FLAGS_MAKE_FILE_BACKUP) != 0; logfile = !dynamicName ? OpenFile(_filename, _mode, mode == "w" && backup) : NULL; } diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index e6400176155..08200af3c19 100644 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -57,13 +57,6 @@ std::string GetConfigStringDefault(std::string base, const char* name, const cha return sConfigMgr->GetStringDefault(base.c_str(), value); } -// Returns default logger if the requested logger is not found -Logger* Log::GetLoggerByType(LogFilterType filterType) -{ - LoggerMap::iterator it = loggers.find(static_cast<uint8>(filterType)); - return it == loggers.end() ? &loggers[0] : &it->second; -} - Appender* Log::GetAppenderByName(std::string const& name) { AppenderMap::iterator it = appenders.begin(); @@ -73,38 +66,40 @@ Appender* Log::GetAppenderByName(std::string const& name) return it == appenders.end() ? NULL : it->second; } -void Log::CreateAppenderFromConfig(const char* name) +void Log::CreateAppenderFromConfig(std::string const& appenderName) { - if (!name || *name == '\0') + if (appenderName.empty()) return; // Format=type, level, flags, optional1, optional2 // if type = File. optional1 = file and option2 = mode // if type = Console. optional1 = Color - std::string options = "Appender."; - options.append(name); - options = sConfigMgr->GetStringDefault(options.c_str(), ""); + std::string options = sConfigMgr->GetStringDefault(appenderName.c_str(), ""); + Tokenizer tokens(options, ','); Tokenizer::const_iterator iter = tokens.begin(); - uint8 size = tokens.size(); + + size_t size = tokens.size(); + std::string name = appenderName.substr(9); if (size < 2) { - fprintf(stderr, "Log::CreateAppenderFromConfig: Wrong configuration for appender %s. Config line: %s\n", name, options.c_str()); + fprintf(stderr, "Log::CreateAppenderFromConfig: Wrong configuration for appender %s. Config line: %s\n", name.c_str(), options.c_str()); return; } AppenderFlags flags = APPENDER_FLAGS_NONE; - AppenderType type = AppenderType(atoi(*iter)); - LogLevel level = LogLevel(atoi(*(++iter))); + AppenderType type = AppenderType(atoi(*iter++)); + LogLevel level = LogLevel(atoi(*iter++)); + if (level > LOG_LEVEL_FATAL) { - fprintf(stderr, "Log::CreateAppenderFromConfig: Wrong Log Level %d for appender %s\n", level, name); + fprintf(stderr, "Log::CreateAppenderFromConfig: Wrong Log Level %d for appender %s\n", level, name.c_str()); return; } if (size > 2) - flags = AppenderFlags(atoi(*(++iter))); + flags = AppenderFlags(atoi(*iter++)); switch (type) { @@ -113,8 +108,8 @@ void Log::CreateAppenderFromConfig(const char* name) AppenderConsole* appender = new AppenderConsole(NextAppenderId(), name, level, flags); appenders[appender->getId()] = appender; if (size > 3) - appender->InitColors(*(++iter)); - //fprintf(stdout, "Log::CreateAppenderFromConfig: Created Appender %s (%u), Type CONSOLE, Mask %u\n", appender->getName().c_str(), appender->getId(), appender->getLogLevel()); // DEBUG - RemoveMe + appender->InitColors(*iter++); + //fprintf(stdout, "Log::CreateAppenderFromConfig: Created Appender %s (%u), Type CONSOLE, Mask %u\n", appender->getName().c_str(), appender->getId(), appender->getLogLevel()); break; } case APPENDER_FILE: @@ -124,14 +119,14 @@ void Log::CreateAppenderFromConfig(const char* name) if (size < 4) { - fprintf(stderr, "Log::CreateAppenderFromConfig: Missing file name for appender %s\n", name); + fprintf(stderr, "Log::CreateAppenderFromConfig: Missing file name for appender %s\n", name.c_str()); return; } - filename = *(++iter); + filename = *iter++; if (size > 4) - mode = *(++iter); + mode = *iter++; if (flags & APPENDER_FLAGS_USE_TIMESTAMP) { @@ -144,11 +139,11 @@ void Log::CreateAppenderFromConfig(const char* name) uint64 maxFileSize = 0; if (size > 5) - maxFileSize = atoi(*(++iter)); + maxFileSize = atoi(*iter++); uint8 id = NextAppenderId(); appenders[id] = new AppenderFile(id, name, level, filename.c_str(), m_logsDir.c_str(), mode.c_str(), flags, maxFileSize); - //fprintf(stdout, "Log::CreateAppenderFromConfig: Created Appender %s (%u), Type FILE, Mask %u, File %s, Mode %s\n", name, id, level, filename.c_str(), mode.c_str()); // DEBUG - RemoveMe + //fprintf(stdout, "Log::CreateAppenderFromConfig: Created Appender %s (%u), Type FILE, Mask %u, File %s, Mode %s\n", name.c_str(), id, level, filename.c_str(), mode.c_str()); break; } case APPENDER_DB: @@ -158,64 +153,54 @@ void Log::CreateAppenderFromConfig(const char* name) break; } default: - fprintf(stderr, "Log::CreateAppenderFromConfig: Unknown type %d for appender %s\n", type, name); + fprintf(stderr, "Log::CreateAppenderFromConfig: Unknown type %d for appender %s\n", type, name.c_str()); break; } } -void Log::CreateLoggerFromConfig(const char* name) +void Log::CreateLoggerFromConfig(std::string const& appenderName) { - if (!name || *name == '\0') + if (appenderName.empty()) return; LogLevel level = LOG_LEVEL_DISABLED; uint8 type = uint8(-1); - std::string options = "Logger."; - options.append(name); - options = sConfigMgr->GetStringDefault(options.c_str(), ""); + std::string options = sConfigMgr->GetStringDefault(appenderName.c_str(), ""); + std::string name = appenderName.substr(7); if (options.empty()) { - fprintf(stderr, "Log::CreateLoggerFromConfig: Missing config option Logger.%s\n", name); + fprintf(stderr, "Log::CreateLoggerFromConfig: Missing config option Logger.%s\n", name.c_str()); return; } Tokenizer tokens(options, ','); Tokenizer::const_iterator iter = tokens.begin(); - if (tokens.size() != 3) - { - fprintf(stderr, "Log::CreateLoggerFromConfig: Wrong config option Logger.%s=%s\n", name, options.c_str()); - return; - } - - type = uint8(atoi(*iter)); - if (type > MaxLogFilter) + if (tokens.size() != 2) { - fprintf(stderr, "Log::CreateLoggerFromConfig: Wrong type %u for logger %s\n", type, name); + fprintf(stderr, "Log::CreateLoggerFromConfig: Wrong config option Logger.%s=%s\n", name.c_str(), options.c_str()); return; } - Logger& logger = loggers[type]; + Logger& logger = loggers[name]; if (!logger.getName().empty()) { - fprintf(stderr, "Error while configuring Logger %s. Already defined\n", name); + fprintf(stderr, "Error while configuring Logger %s. Already defined\n", name.c_str()); return; } - ++iter; - level = LogLevel(atoi(*iter)); + level = LogLevel(atoi(*iter++)); if (level > LOG_LEVEL_FATAL) { - fprintf(stderr, "Log::CreateLoggerFromConfig: Wrong Log Level %u for logger %s\n", type, name); + fprintf(stderr, "Log::CreateLoggerFromConfig: Wrong Log Level %u for logger %s\n", type, name.c_str()); return; } - logger.Create(name, LogFilterType(type), level); - //fprintf(stdout, "Log::CreateLoggerFromConfig: Created Logger %s, Type %u, mask %u\n", name, LogFilterType(type), level); // DEBUG - RemoveMe + logger.Create(name, level); + //fprintf(stdout, "Log::CreateLoggerFromConfig: Created Logger %s, Level %u\n", name.c_str(), level); - ++iter; std::istringstream ss(*iter); std::string str; @@ -225,47 +210,57 @@ void Log::CreateLoggerFromConfig(const char* name) if (Appender* appender = GetAppenderByName(str)) { logger.addAppender(appender->getId(), appender); - //fprintf(stdout, "Log::CreateLoggerFromConfig: Added Appender %s to Logger %s\n", appender->getName().c_str(), name); // DEBUG - RemoveMe + //fprintf(stdout, "Log::CreateLoggerFromConfig: Added Appender %s to Logger %s\n", appender->getName().c_str(), name.c_str()); } else - fprintf(stderr, "Error while configuring Appender %s in Logger %s. Appender does not exist", str.c_str(), name); + fprintf(stderr, "Error while configuring Appender %s in Logger %s. Appender does not exist", str.c_str(), name.c_str()); ss >> str; } } void Log::ReadAppendersFromConfig() { - std::istringstream ss(sConfigMgr->GetStringDefault("Appenders", "")); - std::string name; + std::list<std::string> keys = sConfigMgr->GetKeysByString("Appender."); - do + while (!keys.empty()) { - ss >> name; - CreateAppenderFromConfig(name.c_str()); - name = ""; + CreateAppenderFromConfig(keys.front()); + keys.pop_front(); } - while (ss); } void Log::ReadLoggersFromConfig() { - std::istringstream ss(sConfigMgr->GetStringDefault("Loggers", "")); - std::string name; + std::list<std::string> keys = sConfigMgr->GetKeysByString("Logger."); - do + while (!keys.empty()) { - ss >> name; - CreateLoggerFromConfig(name.c_str()); - name = ""; + CreateLoggerFromConfig(keys.front()); + keys.pop_front(); } - while (ss); - // root logger must exist. Marking as disabled as its not configured - if (loggers.find(LOG_FILTER_GENERAL) == loggers.end()) - loggers[LOG_FILTER_GENERAL].Create("root", LOG_FILTER_GENERAL, LOG_LEVEL_DISABLED); + // Bad config configuration, creating default config + if (loggers.find(LOGGER_ROOT) == loggers.end()) + { + fprintf(stderr, "Wrong Loggers configuration. Review your Logger config section.\n" + "Creating default loggers [root (Error), server (Info)] to console\n"); + + Close(); // Clean any Logger or Appender created + + AppenderConsole* appender = new AppenderConsole(NextAppenderId(), "Console", LOG_LEVEL_DEBUG, APPENDER_FLAGS_NONE); + appenders[appender->getId()] = appender; + + Logger& logger = loggers[LOGGER_ROOT]; + logger.Create(LOGGER_ROOT, LOG_LEVEL_ERROR); + logger.addAppender(appender->getId(), appender); + + logger = loggers["server"]; + logger.Create("server", LOG_LEVEL_ERROR); + logger.addAppender(appender->getId(), appender); + } } -void Log::vlog(LogFilterType filter, LogLevel level, char const* str, va_list argptr) +void Log::vlog(std::string const& filter, LogLevel level, char const* str, va_list argptr) { char text[MAX_QUERY_LEN]; vsnprintf(text, MAX_QUERY_LEN, str, argptr); @@ -274,14 +269,8 @@ void Log::vlog(LogFilterType filter, LogLevel level, char const* str, va_list ar void Log::write(LogMessage* msg) { - if (loggers.empty()) - { - delete msg; - return; - } - + Logger const* logger = GetLoggerByType(msg->type); msg->text.append("\n"); - Logger* logger = GetLoggerByType(msg->type); if (worker) worker->enqueue(new LogOperation(logger, msg)); @@ -333,79 +322,20 @@ bool Log::SetLogLevel(std::string const& name, const char* newLevelc, bool isLog appender->setLogLevel(newLevel); } - return true; -} - -void Log::outTrace(LogFilterType filter, const char * str, ...) -{ - va_list ap; - va_start(ap, str); - - vlog(filter, LOG_LEVEL_TRACE, str, ap); - - va_end(ap); -} - -void Log::outDebug(LogFilterType filter, const char * str, ...) -{ - va_list ap; - va_start(ap, str); - - vlog(filter, LOG_LEVEL_DEBUG, str, ap); - va_end(ap); -} - -void Log::outInfo(LogFilterType filter, const char * str, ...) -{ - va_list ap; - va_start(ap, str); - - vlog(filter, LOG_LEVEL_INFO, str, ap); - - va_end(ap); -} - -void Log::outWarn(LogFilterType filter, const char * str, ...) -{ - va_list ap; - va_start(ap, str); - - vlog(filter, LOG_LEVEL_WARN, str, ap); - - va_end(ap); -} - -void Log::outError(LogFilterType filter, const char * str, ...) -{ - va_list ap; - va_start(ap, str); - - vlog(filter, LOG_LEVEL_ERROR, str, ap); - - va_end(ap); -} - -void Log::outFatal(LogFilterType filter, const char * str, ...) -{ - va_list ap; - va_start(ap, str); - - vlog(filter, LOG_LEVEL_FATAL, str, ap); - - va_end(ap); + return true; } void Log::outCharDump(char const* str, uint32 accountId, uint32 guid, char const* name) { - if (!str || !ShouldLog(LOG_FILTER_PLAYER_DUMP, LOG_LEVEL_INFO)) + if (!str || !ShouldLog("entities.player.dump", LOG_LEVEL_INFO)) return; std::ostringstream ss; ss << "== START DUMP == (account: " << accountId << " guid: " << guid << " name: " << name << ")\n" << str << "\n== END DUMP ==\n"; - LogMessage* msg = new LogMessage(LOG_LEVEL_INFO, LOG_FILTER_PLAYER_DUMP, ss.str()); + LogMessage* msg = new LogMessage(LOG_LEVEL_INFO, "entities.player.dump", ss.str()); std::ostringstream param; param << guid << '_' << name; @@ -416,7 +346,7 @@ void Log::outCharDump(char const* str, uint32 accountId, uint32 guid, char const void Log::outCommand(uint32 account, const char * str, ...) { - if (!str || !ShouldLog(LOG_FILTER_GMCOMMAND, LOG_LEVEL_INFO)) + if (!str || !ShouldLog("commands.gm", LOG_LEVEL_INFO)) return; va_list ap; @@ -425,7 +355,7 @@ void Log::outCommand(uint32 account, const char * str, ...) vsnprintf(text, MAX_QUERY_LEN, str, ap); va_end(ap); - LogMessage* msg = new LogMessage(LOG_LEVEL_INFO, LOG_FILTER_GMCOMMAND, text); + LogMessage* msg = new LogMessage(LOG_LEVEL_INFO, "commands.gm", text); std::ostringstream ss; ss << account; @@ -446,6 +376,7 @@ void Log::Close() delete worker; worker = NULL; loggers.clear(); + cachedLoggers.clear(); for (AppenderMap::iterator it = appenders.begin(); it != appenders.end(); ++it) { delete it->second; @@ -466,6 +397,7 @@ void Log::LoadFromConfig() if (!m_logsDir.empty()) if ((m_logsDir.at(m_logsDir.length() - 1) != '/') && (m_logsDir.at(m_logsDir.length() - 1) != '\\')) m_logsDir.push_back('/'); + ReadAppendersFromConfig(); ReadLoggersFromConfig(); } diff --git a/src/server/shared/Logging/Log.h b/src/server/shared/Logging/Log.h index e35e4f3ab7f..0eb54546aab 100644 --- a/src/server/shared/Logging/Log.h +++ b/src/server/shared/Logging/Log.h @@ -21,18 +21,21 @@ #include "Define.h" #include "Appender.h" -#include "LogWorker.h" #include "Logger.h" +#include "LogWorker.h" #include "Dynamic/UnorderedMap.h" #include <string> #include <ace/Singleton.h> +#define LOGGER_ROOT "root" + class Log { friend class ACE_Singleton<Log, ACE_Thread_Mutex>; - typedef UNORDERED_MAP<uint8, Logger> LoggerMap; + typedef UNORDERED_MAP<std::string, Logger> LoggerMap; + typedef UNORDERED_MAP<std::string, Logger const*> CachedLoggerContainer; private: Log(); @@ -41,36 +44,32 @@ class Log public: void LoadFromConfig(); void Close(); - bool ShouldLog(LogFilterType type, LogLevel level) const; + bool ShouldLog(std::string const& type, LogLevel level); bool SetLogLevel(std::string const& name, char const* level, bool isLogger = true); - void outTrace(LogFilterType f, char const* str, ...) ATTR_PRINTF(3, 4); - void outDebug(LogFilterType f, char const* str, ...) ATTR_PRINTF(3, 4); - void outInfo(LogFilterType f, char const* str, ...) ATTR_PRINTF(3, 4); - void outWarn(LogFilterType f, char const* str, ...) ATTR_PRINTF(3, 4); - void outError(LogFilterType f, char const* str, ...) ATTR_PRINTF(3, 4); - void outFatal(LogFilterType f, char const* str, ...) ATTR_PRINTF(3, 4); + void outMessage(std::string const& f, LogLevel level, char const* str, ...) ATTR_PRINTF(4, 5); void outCommand(uint32 account, const char * str, ...) ATTR_PRINTF(3, 4); void outCharDump(char const* str, uint32 account_id, uint32 guid, char const* name); - static std::string GetTimestampStr(); void SetRealmId(uint32 id); private: - void vlog(LogFilterType f, LogLevel level, char const* str, va_list argptr); + static std::string GetTimestampStr(); + void vlog(std::string const& f, LogLevel level, char const* str, va_list argptr); void write(LogMessage* msg); - Logger* GetLoggerByType(LogFilterType filter); + Logger const* GetLoggerByType(std::string const& type); Appender* GetAppenderByName(std::string const& name); uint8 NextAppenderId(); - void CreateAppenderFromConfig(const char* name); - void CreateLoggerFromConfig(const char* name); + void CreateAppenderFromConfig(std::string const& name); + void CreateLoggerFromConfig(std::string const& name); void ReadAppendersFromConfig(); void ReadLoggersFromConfig(); AppenderMap appenders; LoggerMap loggers; + CachedLoggerContainer cachedLoggers; uint8 AppenderId; std::string m_logsDir; @@ -79,56 +78,94 @@ class Log LogWorker* worker; }; -inline bool Log::ShouldLog(LogFilterType type, LogLevel level) const +inline Logger const* Log::GetLoggerByType(std::string const& originalType) { - LoggerMap::const_iterator it = loggers.find(uint8(type)); - if (it != loggers.end()) + // Check if already cached + CachedLoggerContainer::const_iterator itCached = cachedLoggers.find(originalType); + if (itCached != cachedLoggers.end()) + return itCached->second; + + Logger const* logger = NULL; + std::string type(originalType); + + do { - LogLevel logLevel = it->second.getLogLevel(); - return logLevel != LOG_LEVEL_DISABLED && logLevel <= level; + // Search for the logger "type.subtype" + LoggerMap::const_iterator it = loggers.find(type); + if (it == loggers.end()) + { + // Search for the logger "type", if our logger contains '.', otherwise search for LOGGER_ROOT + size_t found = type.find_last_of("."); + type = found != std::string::npos ? type.substr(0, found) : LOGGER_ROOT; + } + else + logger = &(it->second); } + while (!logger); + + cachedLoggers[type] = logger; + return logger; +} - if (type != LOG_FILTER_GENERAL) - return ShouldLog(LOG_FILTER_GENERAL, level); - else +inline bool Log::ShouldLog(std::string const& type, LogLevel level) +{ + // TODO: Use cache to store "Type.sub1.sub2": "Type" equivalence, should + // Speed up in cases where requesting "Type.sub1.sub2" but only configured + // Logger "Type" + + Logger const* logger = GetLoggerByType(type); + if (!logger) return false; + + LogLevel logLevel = logger->getLogLevel(); + return logLevel != LOG_LEVEL_DISABLED && logLevel <= level; +} + +inline void Log::outMessage(std::string const& filter, LogLevel level, const char * str, ...) +{ + va_list ap; + va_start(ap, str); + + vlog(filter, level, str, ap); + + va_end(ap); } #define sLog ACE_Singleton<Log, ACE_Thread_Mutex>::instance() -#if COMPILER != COMPILER_MICROSOFT -#define TC_LOG_MESSAGE_BODY(level__, call__, filterType__, ...) \ - do { \ - if (sLog->ShouldLog(filterType__, level__)) \ - sLog->call__(filterType__, __VA_ARGS__); \ +#if PLATFORM != PLATFORM_WINDOWS +#define TC_LOG_MESSAGE_BODY(filterType__, level__, ...) \ + do { \ + if (sLog->ShouldLog(filterType__, level__)) \ + sLog->outMessage(filterType__, level__, __VA_ARGS__); \ } while (0) #else -#define TC_LOG_MESSAGE_BODY(level__, call__, filterType__, ...) \ - __pragma(warning(push)) \ - __pragma(warning(disable:4127)) \ - do { \ - if (sLog->ShouldLog(filterType__, level__)) \ - sLog->call__(filterType__, __VA_ARGS__); \ - } while (0) \ +#define TC_LOG_MESSAGE_BODY(filterType__, level__, ...) \ + __pragma(warning(push)) \ + __pragma(warning(disable:4127)) \ + do { \ + if (sLog->ShouldLog(filterType__, level__)) \ + sLog->outMessage(filterType__, level__, __VA_ARGS__); \ + } while (0) \ __pragma(warning(pop)) #endif #define TC_LOG_TRACE(filterType__, ...) \ - TC_LOG_MESSAGE_BODY(LOG_LEVEL_TRACE, outTrace, filterType__, __VA_ARGS__) + TC_LOG_MESSAGE_BODY(filterType__, LOG_LEVEL_TRACE, __VA_ARGS__) #define TC_LOG_DEBUG(filterType__, ...) \ - TC_LOG_MESSAGE_BODY(LOG_LEVEL_DEBUG, outDebug, filterType__, __VA_ARGS__) + TC_LOG_MESSAGE_BODY(filterType__, LOG_LEVEL_DEBUG, __VA_ARGS__) #define TC_LOG_INFO(filterType__, ...) \ - TC_LOG_MESSAGE_BODY(LOG_LEVEL_INFO, outInfo, filterType__, __VA_ARGS__) + TC_LOG_MESSAGE_BODY(filterType__, LOG_LEVEL_INFO, __VA_ARGS__) #define TC_LOG_WARN(filterType__, ...) \ - TC_LOG_MESSAGE_BODY(LOG_LEVEL_WARN, outWarn, filterType__, __VA_ARGS__) + TC_LOG_MESSAGE_BODY(filterType__, LOG_LEVEL_WARN, __VA_ARGS__) #define TC_LOG_ERROR(filterType__, ...) \ - TC_LOG_MESSAGE_BODY(LOG_LEVEL_ERROR, outError, filterType__, __VA_ARGS__) + TC_LOG_MESSAGE_BODY(filterType__, LOG_LEVEL_ERROR, __VA_ARGS__) #define TC_LOG_FATAL(filterType__, ...) \ - TC_LOG_MESSAGE_BODY(LOG_LEVEL_FATAL, outFatal, filterType__, __VA_ARGS__) + TC_LOG_MESSAGE_BODY(filterType__, LOG_LEVEL_FATAL, __VA_ARGS__) #endif diff --git a/src/server/shared/Logging/LogOperation.h b/src/server/shared/Logging/LogOperation.h index 40017cb87f4..237f50de4ad 100644 --- a/src/server/shared/Logging/LogOperation.h +++ b/src/server/shared/Logging/LogOperation.h @@ -24,7 +24,7 @@ struct LogMessage; class LogOperation { public: - LogOperation(Logger* _logger, LogMessage* _msg) + LogOperation(Logger const* _logger, LogMessage* _msg) : logger(_logger), msg(_msg) { } @@ -33,8 +33,8 @@ class LogOperation int call(); protected: - Logger *logger; - LogMessage *msg; + Logger const* logger; + LogMessage* msg; }; #endif diff --git a/src/server/shared/Logging/Logger.cpp b/src/server/shared/Logging/Logger.cpp index 5cb0d0966f4..6fff993e2ae 100644 --- a/src/server/shared/Logging/Logger.cpp +++ b/src/server/shared/Logging/Logger.cpp @@ -17,32 +17,19 @@ #include "Logger.h" -Logger::Logger(): name(""), type(LOG_FILTER_GENERAL), level(LOG_LEVEL_DISABLED) { } +Logger::Logger(): name(""), level(LOG_LEVEL_DISABLED) { } -void Logger::Create(std::string const& _name, LogFilterType _type, LogLevel _level) +void Logger::Create(std::string const& _name, LogLevel _level) { name = _name; - type = _type; level = _level; } -Logger::~Logger() -{ - for (AppenderMap::iterator it = appenders.begin(); it != appenders.end(); ++it) - it->second = NULL; - appenders.clear(); -} - std::string const& Logger::getName() const { return name; } -LogFilterType Logger::getType() const -{ - return type; -} - LogLevel Logger::getLogLevel() const { return level; @@ -55,12 +42,7 @@ void Logger::addAppender(uint8 id, Appender* appender) void Logger::delAppender(uint8 id) { - AppenderMap::iterator it = appenders.find(id); - if (it != appenders.end()) - { - it->second = NULL; - appenders.erase(it); - } + appenders.erase(id); } void Logger::setLogLevel(LogLevel _level) @@ -68,15 +50,15 @@ void Logger::setLogLevel(LogLevel _level) level = _level; } -void Logger::write(LogMessage& message) +void Logger::write(LogMessage& message) const { if (!level || level > message.level || message.text.empty()) { - //fprintf(stderr, "Logger::write: Logger %s, Level %u. Msg %s Level %u WRONG LEVEL MASK OR EMPTY MSG\n", getName().c_str(), messge.level, message.text.c_str(), .message.level); // DEBUG - RemoveMe + //fprintf(stderr, "Logger::write: Logger %s, Level %u. Msg %s Level %u WRONG LEVEL MASK OR EMPTY MSG\n", getName().c_str(), getLogLevel(), message.text.c_str(), message.level); return; } - for (AppenderMap::iterator it = appenders.begin(); it != appenders.end(); ++it) + for (AppenderMap::const_iterator it = appenders.begin(); it != appenders.end(); ++it) if (it->second) it->second->write(message); } diff --git a/src/server/shared/Logging/Logger.h b/src/server/shared/Logging/Logger.h index 46436a8022e..24727ce1016 100644 --- a/src/server/shared/Logging/Logger.h +++ b/src/server/shared/Logging/Logger.h @@ -24,21 +24,18 @@ class Logger { public: Logger(); - ~Logger(); - void Create(std::string const& name, LogFilterType type, LogLevel level); + void Create(std::string const& name, LogLevel level); void addAppender(uint8 type, Appender *); void delAppender(uint8 type); std::string const& getName() const; - LogFilterType getType() const; LogLevel getLogLevel() const; void setLogLevel(LogLevel level); - void write(LogMessage& message); + void write(LogMessage& message) const; private: std::string name; - LogFilterType type; LogLevel level; AppenderMap appenders; }; diff --git a/src/server/shared/Packets/ByteBuffer.cpp b/src/server/shared/Packets/ByteBuffer.cpp index 43d147727f6..8fba0fc23a4 100644 --- a/src/server/shared/Packets/ByteBuffer.cpp +++ b/src/server/shared/Packets/ByteBuffer.cpp @@ -52,7 +52,7 @@ ByteBufferSourceException::ByteBufferSourceException(size_t pos, size_t size, void ByteBuffer::print_storage() const { - if (!sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE)) // optimize disabled trace output + if (!sLog->ShouldLog("network", LOG_LEVEL_TRACE)) // optimize disabled trace output return; std::ostringstream o; @@ -61,12 +61,12 @@ void ByteBuffer::print_storage() const o << read<uint8>(i) << " - "; o << " "; - TC_LOG_TRACE(LOG_FILTER_NETWORKIO, "%s", o.str().c_str()); + TC_LOG_TRACE("network", "%s", o.str().c_str()); } void ByteBuffer::textlike() const { - if (!sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE)) // optimize disabled trace output + if (!sLog->ShouldLog("network", LOG_LEVEL_TRACE)) // optimize disabled trace output return; std::ostringstream o; @@ -78,12 +78,12 @@ void ByteBuffer::textlike() const o << buf; } o << " "; - TC_LOG_TRACE(LOG_FILTER_NETWORKIO, "%s", o.str().c_str()); + TC_LOG_TRACE("network", "%s", o.str().c_str()); } void ByteBuffer::hexlike() const { - if (!sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE)) // optimize disabled trace output + if (!sLog->ShouldLog("network", LOG_LEVEL_TRACE)) // optimize disabled trace output return; uint32 j = 1, k = 1; @@ -110,5 +110,5 @@ void ByteBuffer::hexlike() const o << buf; } o << " "; - TC_LOG_TRACE(LOG_FILTER_NETWORKIO, "%s", o.str().c_str()); + TC_LOG_TRACE("network", "%s", o.str().c_str()); } diff --git a/src/server/shared/Utilities/EventProcessor.h b/src/server/shared/Utilities/EventProcessor.h index 8abf0f09dfe..f341019395d 100644 --- a/src/server/shared/Utilities/EventProcessor.h +++ b/src/server/shared/Utilities/EventProcessor.h @@ -28,7 +28,12 @@ class BasicEvent { public: - BasicEvent() { to_Abort = false; } + BasicEvent() + { + to_Abort = false; + m_addTime = 0; + m_execTime = 0; + } virtual ~BasicEvent() { } // override destructor to perform some actions on event removal // this method executes when the event is triggered diff --git a/src/server/shared/Utilities/ServiceWin32.cpp b/src/server/shared/Utilities/ServiceWin32.cpp index 6ae7d387ccc..c50aca87c09 100644 --- a/src/server/shared/Utilities/ServiceWin32.cpp +++ b/src/server/shared/Utilities/ServiceWin32.cpp @@ -255,7 +255,7 @@ bool WinServiceRun() if (!StartServiceCtrlDispatcher(serviceTable)) { - TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "StartService Failed. Error [%u]", ::GetLastError()); + TC_LOG_ERROR("server.worldserver", "StartService Failed. Error [%u]", ::GetLastError()); return false; } return true; diff --git a/src/server/worldserver/CMakeLists.txt b/src/server/worldserver/CMakeLists.txt index e48197aeb2c..99ea60ba76f 100644 --- a/src/server/worldserver/CMakeLists.txt +++ b/src/server/worldserver/CMakeLists.txt @@ -70,7 +70,6 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/server/game/Addons ${CMAKE_SOURCE_DIR}/src/server/game/AI ${CMAKE_SOURCE_DIR}/src/server/game/AI/CoreAI - ${CMAKE_SOURCE_DIR}/src/server/game/AI/EventAI ${CMAKE_SOURCE_DIR}/src/server/game/AI/ScriptedAI ${CMAKE_SOURCE_DIR}/src/server/game/AI/SmartScripts ${CMAKE_SOURCE_DIR}/src/server/game/AuctionHouse diff --git a/src/server/worldserver/CommandLine/CliRunnable.cpp b/src/server/worldserver/CommandLine/CliRunnable.cpp index 1ebb58eef1a..218fe052cb3 100644 --- a/src/server/worldserver/CommandLine/CliRunnable.cpp +++ b/src/server/worldserver/CommandLine/CliRunnable.cpp @@ -134,7 +134,7 @@ int kb_hit_return() void CliRunnable::run() { ///- Display the list of available CLI functions then beep - //TC_LOG_INFO(LOG_FILTER_WORLDSERVER, ""); + //TC_LOG_INFO("server.worldserver", ""); #if PLATFORM != PLATFORM_WINDOWS rl_attempted_completion_function = cli_completion; rl_event_hook = cli_hook_func; diff --git a/src/server/worldserver/Main.cpp b/src/server/worldserver/Main.cpp index 61aaf5f2ee9..a5f07c036c2 100644 --- a/src/server/worldserver/Main.cpp +++ b/src/server/worldserver/Main.cpp @@ -132,10 +132,10 @@ extern int main(int argc, char** argv) return 1; } - TC_LOG_INFO(LOG_FILTER_WORLDSERVER, "Using configuration file %s.", cfg_file); + TC_LOG_INFO("server.worldserver", "Using configuration file %s.", cfg_file); - TC_LOG_INFO(LOG_FILTER_WORLDSERVER, "Using SSL version: %s (library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION)); - TC_LOG_INFO(LOG_FILTER_WORLDSERVER, "Using ACE version: %s", ACE_VERSION); + TC_LOG_INFO("server.worldserver", "Using SSL version: %s (library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION)); + TC_LOG_INFO("server.worldserver", "Using ACE version: %s", ACE_VERSION); ///- and run the 'Master' /// @todo Why do we need this 'Master'? Can't all of this be in the Main as for Realmd? diff --git a/src/server/worldserver/Master.cpp b/src/server/worldserver/Master.cpp index d9b97cfd3f5..3fcd4c28f0f 100644 --- a/src/server/worldserver/Master.cpp +++ b/src/server/worldserver/Master.cpp @@ -86,7 +86,12 @@ private: uint32 _lastChange; uint32 _delaytime; public: - FreezeDetectorRunnable() { _delaytime = 0; } + FreezeDetectorRunnable() + { + _loops = 0; + _lastChange = 0; + _delaytime = 0; + } void SetDelayTime(uint32 t) { _delaytime = t; } @@ -95,7 +100,7 @@ public: if (!_delaytime) return; - TC_LOG_INFO(LOG_FILTER_WORLDSERVER, "Starting up anti-freeze thread (%u seconds max stuck time)...", _delaytime/1000); + TC_LOG_INFO("server.worldserver", "Starting up anti-freeze thread (%u seconds max stuck time)...", _delaytime/1000); _loops = 0; _lastChange = 0; while (!World::IsStopped()) @@ -112,11 +117,11 @@ public: // possible freeze else if (getMSTimeDiff(_lastChange, curtime) > _delaytime) { - TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "World Thread hangs, kicking out server!"); + TC_LOG_ERROR("server.worldserver", "World Thread hangs, kicking out server!"); ASSERT(false); } } - TC_LOG_INFO(LOG_FILTER_WORLDSERVER, "Anti-freeze thread exiting without problems."); + TC_LOG_INFO("server.worldserver", "Anti-freeze thread exiting without problems."); } }; @@ -127,28 +132,28 @@ int Master::Run() BigNumber seed1; seed1.SetRand(16 * 8); - TC_LOG_INFO(LOG_FILTER_WORLDSERVER, "%s (worldserver-daemon)", _FULLVERSION); - TC_LOG_INFO(LOG_FILTER_WORLDSERVER, "<Ctrl-C> to stop.\n"); + TC_LOG_INFO("server.worldserver", "%s (worldserver-daemon)", _FULLVERSION); + TC_LOG_INFO("server.worldserver", "<Ctrl-C> to stop.\n"); - TC_LOG_INFO(LOG_FILTER_WORLDSERVER, " ______ __"); - TC_LOG_INFO(LOG_FILTER_WORLDSERVER, "/\\__ _\\ __ __/\\ \\__"); - TC_LOG_INFO(LOG_FILTER_WORLDSERVER, "\\/_/\\ \\/ _ __ /\\_\\ ___ /\\_\\ \\, _\\ __ __"); - TC_LOG_INFO(LOG_FILTER_WORLDSERVER, " \\ \\ \\/\\`'__\\/\\ \\ /' _ `\\/\\ \\ \\ \\/ /\\ \\/\\ \\"); - TC_LOG_INFO(LOG_FILTER_WORLDSERVER, " \\ \\ \\ \\ \\/ \\ \\ \\/\\ \\/\\ \\ \\ \\ \\ \\_\\ \\ \\_\\ \\"); - TC_LOG_INFO(LOG_FILTER_WORLDSERVER, " \\ \\_\\ \\_\\ \\ \\_\\ \\_\\ \\_\\ \\_\\ \\__\\\\/`____ \\"); - TC_LOG_INFO(LOG_FILTER_WORLDSERVER, " \\/_/\\/_/ \\/_/\\/_/\\/_/\\/_/\\/__/ `/___/> \\"); - TC_LOG_INFO(LOG_FILTER_WORLDSERVER, " C O R E /\\___/"); - TC_LOG_INFO(LOG_FILTER_WORLDSERVER, "http://TrinityCore.org \\/__/\n"); + TC_LOG_INFO("server.worldserver", " ______ __"); + TC_LOG_INFO("server.worldserver", "/\\__ _\\ __ __/\\ \\__"); + TC_LOG_INFO("server.worldserver", "\\/_/\\ \\/ _ __ /\\_\\ ___ /\\_\\ \\, _\\ __ __"); + TC_LOG_INFO("server.worldserver", " \\ \\ \\/\\`'__\\/\\ \\ /' _ `\\/\\ \\ \\ \\/ /\\ \\/\\ \\"); + TC_LOG_INFO("server.worldserver", " \\ \\ \\ \\ \\/ \\ \\ \\/\\ \\/\\ \\ \\ \\ \\ \\_\\ \\ \\_\\ \\"); + TC_LOG_INFO("server.worldserver", " \\ \\_\\ \\_\\ \\ \\_\\ \\_\\ \\_\\ \\_\\ \\__\\\\/`____ \\"); + TC_LOG_INFO("server.worldserver", " \\/_/\\/_/ \\/_/\\/_/\\/_/\\/_/\\/__/ `/___/> \\"); + TC_LOG_INFO("server.worldserver", " C O R E /\\___/"); + TC_LOG_INFO("server.worldserver", "http://TrinityCore.org \\/__/\n"); /// worldserver PID file creation std::string pidFile = sConfigMgr->GetStringDefault("PidFile", ""); if (!pidFile.empty()) { if (uint32 pid = CreatePIDFile(pidFile)) - TC_LOG_INFO(LOG_FILTER_WORLDSERVER, "Daemon PID: %u\n", pid); + TC_LOG_INFO("server.worldserver", "Daemon PID: %u\n", pid); else { - TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Cannot create PID file %s.\n", pidFile.c_str()); + TC_LOG_ERROR("server.worldserver", "Cannot create PID file %s.\n", pidFile.c_str()); return 1; } } @@ -213,20 +218,20 @@ int Master::Run() ULONG_PTR currentAffinity = affinity & appAff; // remove non accessible processors if (!currentAffinity) - TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Processors marked in UseProcessors bitmask (hex) %x are not accessible for the worldserver. Accessible processors bitmask (hex): %x", affinity, appAff); + TC_LOG_ERROR("server.worldserver", "Processors marked in UseProcessors bitmask (hex) %x are not accessible for the worldserver. Accessible processors bitmask (hex): %x", affinity, appAff); else if (SetProcessAffinityMask(hProcess, currentAffinity)) - TC_LOG_INFO(LOG_FILTER_WORLDSERVER, "Using processors (bitmask, hex): %x", currentAffinity); + TC_LOG_INFO("server.worldserver", "Using processors (bitmask, hex): %x", currentAffinity); else - TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Can't set used processors (hex): %x", currentAffinity); + TC_LOG_ERROR("server.worldserver", "Can't set used processors (hex): %x", currentAffinity); } } if (highPriority) { if (SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS)) - TC_LOG_INFO(LOG_FILTER_WORLDSERVER, "worldserver process priority class set to HIGH"); + TC_LOG_INFO("server.worldserver", "worldserver process priority class set to HIGH"); else - TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Can't set worldserver process priority class."); + TC_LOG_ERROR("server.worldserver", "Can't set worldserver process priority class."); } } #elif __linux__ // Linux @@ -241,21 +246,21 @@ int Master::Run() CPU_SET(i, &mask); if (sched_setaffinity(0, sizeof(mask), &mask)) - TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Can't set used processors (hex): %x, error: %s", affinity, strerror(errno)); + TC_LOG_ERROR("server.worldserver", "Can't set used processors (hex): %x, error: %s", affinity, strerror(errno)); else { CPU_ZERO(&mask); sched_getaffinity(0, sizeof(mask), &mask); - TC_LOG_INFO(LOG_FILTER_WORLDSERVER, "Using processors (bitmask, hex): %x", *(uint32*)(&mask)); + TC_LOG_INFO("server.worldserver", "Using processors (bitmask, hex): %x", *(uint32*)(&mask)); } } if (highPriority) { if (setpriority(PRIO_PROCESS, 0, PROCESS_HIGH_PRIORITY)) - TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Can't set worldserver process priority class, error: %s", strerror(errno)); + TC_LOG_ERROR("server.worldserver", "Can't set worldserver process priority class, error: %s", strerror(errno)); else - TC_LOG_INFO(LOG_FILTER_WORLDSERVER, "worldserver process priority class set to %i", getpriority(PRIO_PROCESS, 0)); + TC_LOG_INFO("server.worldserver", "worldserver process priority class set to %i", getpriority(PRIO_PROCESS, 0)); } #endif @@ -285,7 +290,7 @@ int Master::Run() if (sWorldSocketMgr->StartNetwork(worldPort, bindIp.c_str()) == -1) { - TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Failed to start network"); + TC_LOG_ERROR("server.worldserver", "Failed to start network"); World::StopNow(ERROR_EXIT_CODE); // go down and shutdown the server } @@ -293,7 +298,7 @@ int Master::Run() // set server online (allow connecting now) LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = flag & ~%u, population = 0 WHERE id = '%u'", REALM_FLAG_INVALID, realmID); - TC_LOG_INFO(LOG_FILTER_WORLDSERVER, "%s (worldserver-daemon) ready...", _FULLVERSION); + TC_LOG_INFO("server.worldserver", "%s (worldserver-daemon) ready...", _FULLVERSION); // when the main thread closes the singletons get unloaded // since worldrunnable uses them, it will crash if unloaded after master @@ -315,7 +320,7 @@ int Master::Run() _StopDB(); - TC_LOG_INFO(LOG_FILTER_WORLDSERVER, "Halting process..."); + TC_LOG_INFO("server.worldserver", "Halting process..."); if (cliThread) { @@ -387,14 +392,14 @@ bool Master::_StartDB() dbString = sConfigMgr->GetStringDefault("WorldDatabaseInfo", ""); if (dbString.empty()) { - TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "World database not specified in configuration file"); + TC_LOG_ERROR("server.worldserver", "World database not specified in configuration file"); return false; } asyncThreads = uint8(sConfigMgr->GetIntDefault("WorldDatabase.WorkerThreads", 1)); if (asyncThreads < 1 || asyncThreads > 32) { - TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "World database: invalid number of worker threads specified. " + TC_LOG_ERROR("server.worldserver", "World database: invalid number of worker threads specified. " "Please pick a value between 1 and 32."); return false; } @@ -403,7 +408,7 @@ bool Master::_StartDB() ///- Initialize the world database if (!WorldDatabase.Open(dbString, asyncThreads, synchThreads)) { - TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Cannot connect to world database %s", dbString.c_str()); + TC_LOG_ERROR("server.worldserver", "Cannot connect to world database %s", dbString.c_str()); return false; } @@ -411,14 +416,14 @@ bool Master::_StartDB() dbString = sConfigMgr->GetStringDefault("CharacterDatabaseInfo", ""); if (dbString.empty()) { - TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Character database not specified in configuration file"); + TC_LOG_ERROR("server.worldserver", "Character database not specified in configuration file"); return false; } asyncThreads = uint8(sConfigMgr->GetIntDefault("CharacterDatabase.WorkerThreads", 1)); if (asyncThreads < 1 || asyncThreads > 32) { - TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Character database: invalid number of worker threads specified. " + TC_LOG_ERROR("server.worldserver", "Character database: invalid number of worker threads specified. " "Please pick a value between 1 and 32."); return false; } @@ -428,7 +433,7 @@ bool Master::_StartDB() ///- Initialize the Character database if (!CharacterDatabase.Open(dbString, asyncThreads, synchThreads)) { - TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Cannot connect to Character database %s", dbString.c_str()); + TC_LOG_ERROR("server.worldserver", "Cannot connect to Character database %s", dbString.c_str()); return false; } @@ -436,14 +441,14 @@ bool Master::_StartDB() dbString = sConfigMgr->GetStringDefault("LoginDatabaseInfo", ""); if (dbString.empty()) { - TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Login database not specified in configuration file"); + TC_LOG_ERROR("server.worldserver", "Login database not specified in configuration file"); return false; } asyncThreads = uint8(sConfigMgr->GetIntDefault("LoginDatabase.WorkerThreads", 1)); if (asyncThreads < 1 || asyncThreads > 32) { - TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Login database: invalid number of worker threads specified. " + TC_LOG_ERROR("server.worldserver", "Login database: invalid number of worker threads specified. " "Please pick a value between 1 and 32."); return false; } @@ -452,7 +457,7 @@ bool Master::_StartDB() ///- Initialise the login database if (!LoginDatabase.Open(dbString, asyncThreads, synchThreads)) { - TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Cannot connect to login database %s", dbString.c_str()); + TC_LOG_ERROR("server.worldserver", "Cannot connect to login database %s", dbString.c_str()); return false; } @@ -460,10 +465,10 @@ bool Master::_StartDB() realmID = sConfigMgr->GetIntDefault("RealmID", 0); if (!realmID) { - TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Realm ID not defined in configuration file"); + TC_LOG_ERROR("server.worldserver", "Realm ID not defined in configuration file"); return false; } - TC_LOG_INFO(LOG_FILTER_WORLDSERVER, "Realm running as realm ID %d", realmID); + TC_LOG_INFO("server.worldserver", "Realm running as realm ID %d", realmID); ///- Clean the database before starting ClearOnlineAccounts(); @@ -473,7 +478,7 @@ bool Master::_StartDB() sWorld->LoadDBVersion(); - TC_LOG_INFO(LOG_FILTER_WORLDSERVER, "Using World DB: %s", sWorld->GetDBVersion()); + TC_LOG_INFO("server.worldserver", "Using World DB: %s", sWorld->GetDBVersion()); return true; } diff --git a/src/server/worldserver/RemoteAccess/RARunnable.cpp b/src/server/worldserver/RemoteAccess/RARunnable.cpp index 1493df7aa2f..424c3b9a5a6 100644 --- a/src/server/worldserver/RemoteAccess/RARunnable.cpp +++ b/src/server/worldserver/RemoteAccess/RARunnable.cpp @@ -67,11 +67,11 @@ void RARunnable::run() if (acceptor.open(listenAddress, m_Reactor) == -1) { - TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Trinity RA can not bind to port %d on %s", raPort, stringIp.c_str()); + TC_LOG_ERROR("server.worldserver", "Trinity RA can not bind to port %d on %s", raPort, stringIp.c_str()); return; } - TC_LOG_INFO(LOG_FILTER_WORLDSERVER, "Starting Trinity RA on port %d on %s", raPort, stringIp.c_str()); + TC_LOG_INFO("server.worldserver", "Starting Trinity RA on port %d on %s", raPort, stringIp.c_str()); while (!World::IsStopped()) { @@ -80,5 +80,5 @@ void RARunnable::run() break; } - TC_LOG_DEBUG(LOG_FILTER_WORLDSERVER, "Trinity RA thread exiting"); + TC_LOG_DEBUG("server.worldserver", "Trinity RA thread exiting"); } diff --git a/src/server/worldserver/RemoteAccess/RASocket.cpp b/src/server/worldserver/RemoteAccess/RASocket.cpp index a4d402286ed..195b2992244 100644 --- a/src/server/worldserver/RemoteAccess/RASocket.cpp +++ b/src/server/worldserver/RemoteAccess/RASocket.cpp @@ -42,18 +42,18 @@ int RASocket::open(void *) if (peer().get_remote_addr(remoteAddress) == -1) { - TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "RASocket::open: peer().get_remote_addr error is %s", ACE_OS::strerror(errno)); + TC_LOG_ERROR("server.worldserver", "RASocket::open: peer().get_remote_addr error is %s", ACE_OS::strerror(errno)); return -1; } - TC_LOG_INFO(LOG_FILTER_REMOTECOMMAND, "Incoming connection from %s", remoteAddress.get_host_addr()); + TC_LOG_INFO("commands.ra", "Incoming connection from %s", remoteAddress.get_host_addr()); return activate(); } int RASocket::handle_close(ACE_HANDLE /*handle*/, ACE_Reactor_Mask /*mask*/) { - TC_LOG_INFO(LOG_FILTER_REMOTECOMMAND, "Closing connection"); + TC_LOG_INFO("commands.ra", "Closing connection"); peer().close_reader(); wait(); // While the above wait() will wait for the ::svc() to finish, it will not wait for the async event @@ -129,7 +129,7 @@ int RASocket::recv_line(std::string& out_line) if (recv_line(message_block) == -1) { - TC_LOG_DEBUG(LOG_FILTER_REMOTECOMMAND, "Recv error %s", ACE_OS::strerror(errno)); + TC_LOG_DEBUG("commands.ra", "Recv error %s", ACE_OS::strerror(errno)); return -1; } @@ -143,7 +143,7 @@ int RASocket::process_command(const std::string& command) if (command.length() == 0) return 0; - TC_LOG_INFO(LOG_FILTER_REMOTECOMMAND, "Received command: %s", command.c_str()); + TC_LOG_INFO("commands.ra", "Received command: %s", command.c_str()); // handle quit, exit and logout commands to terminate connection if (command == "quit" || command == "exit" || command == "logout") { @@ -192,7 +192,7 @@ int RASocket::check_access_level(const std::string& user) if (!result) { - TC_LOG_INFO(LOG_FILTER_REMOTECOMMAND, "User %s does not exist in database", user.c_str()); + TC_LOG_INFO("commands.ra", "User %s does not exist in database", user.c_str()); return -1; } @@ -200,12 +200,12 @@ int RASocket::check_access_level(const std::string& user) if (fields[1].GetUInt8() < _minLevel) { - TC_LOG_INFO(LOG_FILTER_REMOTECOMMAND, "User %s has no privilege to login", user.c_str()); + TC_LOG_INFO("commands.ra", "User %s has no privilege to login", user.c_str()); return -1; } else if (fields[2].GetInt32() != -1) { - TC_LOG_INFO(LOG_FILTER_REMOTECOMMAND, "User %s has to be assigned on all realms (with RealmID = '-1')", user.c_str()); + TC_LOG_INFO("commands.ra", "User %s has to be assigned on all realms (with RealmID = '-1')", user.c_str()); return -1; } @@ -231,7 +231,7 @@ int RASocket::check_password(const std::string& user, const std::string& pass) if (!result) { - TC_LOG_INFO(LOG_FILTER_REMOTECOMMAND, "Wrong password for user: %s", user.c_str()); + TC_LOG_INFO("commands.ra", "Wrong password for user: %s", user.c_str()); return -1; } @@ -254,7 +254,7 @@ int RASocket::authenticate() if (recv_line(pass) == -1) return -1; - TC_LOG_INFO(LOG_FILTER_REMOTECOMMAND, "Login attempt for user: %s", user.c_str()); + TC_LOG_INFO("commands.ra", "Login attempt for user: %s", user.c_str()); if (check_access_level(user) == -1) return -1; @@ -262,7 +262,7 @@ int RASocket::authenticate() if (check_password(user, pass) == -1) return -1; - TC_LOG_INFO(LOG_FILTER_REMOTECOMMAND, "User login: %s", user.c_str()); + TC_LOG_INFO("commands.ra", "User login: %s", user.c_str()); return 0; } @@ -296,7 +296,7 @@ int RASocket::subnegotiate() if (n >= 1024) { - TC_LOG_DEBUG(LOG_FILTER_REMOTECOMMAND, "RASocket::subnegotiate: allocated buffer 1024 bytes was too small for negotiation packet, size: %u", uint32(n)); + TC_LOG_DEBUG("commands.ra", "RASocket::subnegotiate: allocated buffer 1024 bytes was too small for negotiation packet, size: %u", uint32(n)); return -1; } @@ -330,7 +330,7 @@ int RASocket::subnegotiate() uint8 param = buf[++i]; ss << uint32(param); - TC_LOG_DEBUG(LOG_FILTER_REMOTECOMMAND, ss.str().c_str()); + TC_LOG_DEBUG("commands.ra", ss.str().c_str()); } ++i; } @@ -396,7 +396,7 @@ void RASocket::zprint(void* callbackArg, const char * szText) ACE_Time_Value tv = ACE_Time_Value::zero; if (socket->putq(mb, &tv) == -1) { - TC_LOG_DEBUG(LOG_FILTER_REMOTECOMMAND, "Failed to enqueue message, queue is full or closed. Error is %s", ACE_OS::strerror(errno)); + TC_LOG_DEBUG("commands.ra", "Failed to enqueue message, queue is full or closed. Error is %s", ACE_OS::strerror(errno)); mb->release(); } } @@ -416,7 +416,7 @@ void RASocket::commandFinished(void* callbackArg, bool /*success*/) // hence we don't put timeout, because it shouldn't increase queue size and shouldn't block if (socket->putq(mb->duplicate()) == -1) // getting here is bad, command can't be marked as complete - TC_LOG_DEBUG(LOG_FILTER_REMOTECOMMAND, "Failed to enqueue command end message. Error is %s", ACE_OS::strerror(errno)); + TC_LOG_DEBUG("commands.ra", "Failed to enqueue command end message. Error is %s", ACE_OS::strerror(errno)); mb->release(); diff --git a/src/server/worldserver/TCSoap/TCSoap.cpp b/src/server/worldserver/TCSoap/TCSoap.cpp index e10968bcbee..c76298b0de9 100644 --- a/src/server/worldserver/TCSoap/TCSoap.cpp +++ b/src/server/worldserver/TCSoap/TCSoap.cpp @@ -35,18 +35,18 @@ void TCSoapRunnable::run() soap.send_timeout = 5; if (!soap_valid_socket(soap_bind(&soap, _host.c_str(), _port, 100))) { - TC_LOG_ERROR(LOG_FILTER_SOAP, "Couldn't bind to %s:%d", _host.c_str(), _port); + TC_LOG_ERROR("network.soap", "Couldn't bind to %s:%d", _host.c_str(), _port); exit(-1); } - TC_LOG_INFO(LOG_FILTER_SOAP, "Bound to http://%s:%d", _host.c_str(), _port); + TC_LOG_INFO("network.soap", "Bound to http://%s:%d", _host.c_str(), _port); while (!World::IsStopped()) { if (!soap_valid_socket(soap_accept(&soap))) continue; // ran into an accept timeout - TC_LOG_DEBUG(LOG_FILTER_SOAP, "Accepted connection from IP=%d.%d.%d.%d", (int)(soap.ip>>24)&0xFF, (int)(soap.ip>>16)&0xFF, (int)(soap.ip>>8)&0xFF, (int)soap.ip&0xFF); + TC_LOG_DEBUG("network.soap", "Accepted connection from IP=%d.%d.%d.%d", (int)(soap.ip>>24)&0xFF, (int)(soap.ip>>16)&0xFF, (int)(soap.ip>>8)&0xFF, (int)soap.ip&0xFF); struct soap* thread_soap = soap_copy(&soap);// make a safe copy ACE_Message_Block* mb = new ACE_Message_Block(sizeof(struct soap*)); @@ -81,33 +81,33 @@ int ns1__executeCommand(soap* soap, char* command, char** result) // security check if (!soap->userid || !soap->passwd) { - TC_LOG_INFO(LOG_FILTER_SOAP, "Client didn't provide login information"); + TC_LOG_INFO("network.soap", "Client didn't provide login information"); return 401; } uint32 accountId = AccountMgr::GetId(soap->userid); if (!accountId) { - TC_LOG_INFO(LOG_FILTER_SOAP, "Client used invalid username '%s'", soap->userid); + TC_LOG_INFO("network.soap", "Client used invalid username '%s'", soap->userid); return 401; } if (!AccountMgr::CheckPassword(accountId, soap->passwd)) { - TC_LOG_INFO(LOG_FILTER_SOAP, "Invalid password for account '%s'", soap->userid); + TC_LOG_INFO("network.soap", "Invalid password for account '%s'", soap->userid); return 401; } if (AccountMgr::GetSecurity(accountId) < SEC_ADMINISTRATOR) { - TC_LOG_INFO(LOG_FILTER_SOAP, "%s's gmlevel is too low", soap->userid); + TC_LOG_INFO("network.soap", "%s's gmlevel is too low", soap->userid); return 403; } if (!command || !*command) return soap_sender_fault(soap, "Command can not be empty", "The supplied command was an empty string"); - TC_LOG_INFO(LOG_FILTER_SOAP, "Received command '%s'", command); + TC_LOG_INFO("network.soap", "Received command '%s'", command); SOAPCommand connection; // commands are executed in the world thread. We have to wait for them to be completed @@ -121,7 +121,7 @@ int ns1__executeCommand(soap* soap, char* command, char** result) int acc = connection.pendingCommands.acquire(); if (acc) - TC_LOG_ERROR(LOG_FILTER_SOAP, "Error while acquiring lock, acc = %i, errno = %u", acc, errno); + TC_LOG_ERROR("network.soap", "Error while acquiring lock, acc = %i, errno = %u", acc, errno); // alright, command finished diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 23db3330943..4e594fc88c0 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -2703,79 +2703,13 @@ UI.ShowQuestLevelsInDialogs = 0 Appender.Console=1,3,0 Appender.Server=2,2,0,Server.log,w -Appender.GM=2,2,0,GM.log +Appender.GM=2,2,15,gm/gm_%s.log Appender.DBErrors=2,2,0,DBErrors.log -Appender.Char=2,2,0,Char.log,w -Appender.RA=2,2,0,RA.log -Appender.Warden=2,4,0,Warden.log -Appender.Chat=2,2,0,Chat.log -Appender.CharDump=2,2,0,%s.log -Appender.Arenas=2,2,0,Arena.log -Appender.SQLDev=2,2,0,SQLDev.log -Appender.SQLDriver=2,2,0,SQLDriver.log - -# Appenders -# Description: List of Appenders to read from config -# (Using spaces as separator). -# Default: "Console Server GM DBErrors Char RA Warden Chat" - -Appenders=Console Server GM DBErrors Char RA Warden Chat # Logger config values: Given a logger "name" # Logger.name # Description: Defines 'What to log' -# Format: Type,LogLevel,AppenderList -# Type -# 0 - Default. Each type that has no config will -# rely on this one. Core will create this logger -# (disabled) if it's not configured -# 1 - Units that doesn't fit in other categories -# 2 - Pets -# 3 - Vehicles -# 4 - C++ AI, instance scripts, etc. -# 5 - DB AI, such as SAI, EAI, CreatureAI -# 6 - DB map scripts -# 7 - Network input/output, -# such as packet handlers and netcode logs -# 8 - Spellsystem and aurasystem -# 9 - Achievement system -# 10 - Condition system -# 11 - Pool system -# 12 - Auction house -# 13 - Arena's and battlegrounds -# 14 - Outdoor PVP -# 15 - Chat system -# 16 - LFG system -# 17 - Maps, instances (not scripts), -# grids, cells, visibility, etc. -# 18 - Player that doesn't fit in other categories. -# 19 - Player loading from DB -# (Player::_LoadXXX functions) -# 20 - Items -# 21 - Player skills (do not confuse with spells) -# 22 - Player chat logs -# 23 - loot -# 24 - guilds -# 25 - transports -# 26 - SQL. DB errors -# 27 - GM Commands -# 28 - Remote Access Commands -# 29 - Warden -# 30 - Authserver -# 31 - Worldserver -# 32 - Game Events -# 33 - Calendar -# 34 - Character (Exclusive to log login, logout, create, rename) -# 35 - Arenas -# 36 - SQL Driver -# 37 - SQL Dev -# 38 - Player Dump -# 39 - Battlefield -# 40 - Server Loading -# 41 - Opcodes (just id and name sent / received) -# 42 - SOAP -# 43 - RBAC (Role Based Access Control) -# 44 - Cheat (used to log cheat attempts) +# Format: LogLevel,AppenderList # # LogLevel # 0 - (Disabled) @@ -2790,28 +2724,52 @@ Appenders=Console Server GM DBErrors Char RA Warden Chat # (Using spaces as separator). # -Logger.Root=0,5,Console Server -Logger.Chat=22,2,Chat -Logger.DBErrors=26,5,Console Server DBErrors -Logger.GM=27,3,Console Server GM -Logger.RA=28,3,RA -Logger.Warden=29,4,Warden -Logger.WorldServer=31,3,Console Server -Logger.Character=34,3,Char -Logger.Arenas=35,3,Arenas -Logger.SQLDriver=36,5,SQLDriver -Logger.SQLDev=37,3,SQLDev -Logger.CharDump=38,3,CharDump -Logger.Load=40,3,Console Server -Logger.Opcodes=41,6,Console Server - -# -# Loggers -# Description: List of Loggers to read from config -# (Using spaces as separator). -# Default: "Root Chat DBErrors GM RA Warden Character Load" - -Loggers=Root Chat DBErrors GM RA Warden Character Load WorldServer Opcodes +Logger.root=5,Console Server +Logger.server=3,Console Server +Logger.commands.gm=3,Console GM +Logger.sql.sql=5,Console DBErrors + +#Logger.achievement=3,Console Server +#Logger.auctionHouse=3,Console Server +#Logger.bg.arena=3,Console Server +#Logger.bg.battlefield=3,Console Server +#Logger.bg.battleground=3,Console Server +#Logger.chat.log=3,Console Server +#Logger.calendar=3,Console Server +#Logger.chat.system=3,Console Server +#Logger.cheat=3,Console Server +#Logger.commands.ra=3,Console Server +#Logger.condition=3,Console Server +#Logger.entities.pet=3,Console Server +#Logger.entities.player.character=3,Console Server +#Logger.entities.player.dump=3,Console Server +#Logger.entities.player=3,Console Server +#Logger.entities.player.items=3,Console Server +#Logger.entities.player.loading=3,Console Server +#Logger.entities.player.skills=3,Console Server +#Logger.entities.transport=3,Console Server +#Logger.entities.unit=3,Console Server +#Logger.entities.vehicle=3,Console Server +#Logger.gameevent=3,Console Server +#Logger.guild=3,Console Server +#Logger.lfg=3,Console Server +#Logger.loot=3,Console Server +#Logger.maps.script=3,Console Server +#Logger.maps=3,Console Server +#Logger.misc=3,Console Server +#Logger.network=3,Console Server +#Logger.network.opcode=3,Console Server +#Logger.network.soap=3,Console Server +#Logger.outdoorpvp=3,Console Server +#Logger.pool=3,Console Server +#Logger.rbac=3,Console Server +#Logger.scripts=3,Console Server +#Logger.scripts.ai=3,Console Server +#Logger.server.authserver=3,Console Server +#Logger.spells=3,Console Server +#Logger.sql.dev=3,Console Server +#Logger.sql.driver=3,Console Server +#Logger.warden=3,Console Server # # Log.Async.Enable @@ -2832,7 +2790,7 @@ Log.Async.Enable = 0 # PacketSpoof.Policy # Description: Determines the course of action when packet spoofing is detected. # Default: 1 - Log + kick -# 0 - Log only (LOG_FILTER_NETWORKIO) +# 0 - Log only ("network") # 2 - Log + kick + ban PacketSpoof.Policy = 1 diff --git a/src/tools/map_extractor/System.cpp b/src/tools/map_extractor/System.cpp index 43b4b57c179..3dd311c2da5 100644 --- a/src/tools/map_extractor/System.cpp +++ b/src/tools/map_extractor/System.cpp @@ -107,6 +107,12 @@ static const char* const langs[] = {"enGB", "enUS", "deDE", "esES", "frFR", "koK void CreateDir( const std::string& Path ) { + if(chdir(Path.c_str()) == 0) + { + chdir("../"); + return; + } + int ret; #ifdef _WIN32 ret = _mkdir( Path.c_str()); @@ -1046,6 +1052,9 @@ void ExtractDBCFiles(int locale, bool basicLocale) { string filename = path; filename += (iter->c_str() + strlen("DBFilesClient\\")); + + if(FileExists(filename.c_str())) + continue; if (ExtractFile(iter->c_str(), filename)) ++count; |