mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 22:37:02 +00:00
Over 100 camangos Cata commits applied (to c12950)
Over 100 camangos Cata commits applied. up to and inclusing c12950.
This commit is contained in:
parent
b4ec0440aa
commit
eef77eadb9
117 changed files with 4314 additions and 3547 deletions
|
|
@ -74,7 +74,6 @@
|
|||
#include "CharacterDatabaseCleaner.h"
|
||||
#include "CreatureLinkingMgr.h"
|
||||
#include "Calendar.h"
|
||||
#include "PhaseMgr.h"
|
||||
#include "Weather.h"
|
||||
#include "LFGMgr.h"
|
||||
#ifdef ENABLE_ELUNA
|
||||
|
|
@ -87,6 +86,8 @@
|
|||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#include <mutex>
|
||||
|
||||
INSTANTIATE_SINGLETON_1(World);
|
||||
|
||||
extern void LoadGameObjectModelList();
|
||||
|
|
@ -140,28 +141,22 @@ World::World()
|
|||
/// World destructor
|
||||
World::~World()
|
||||
{
|
||||
// it is assumed that no other thread is accessing this data when the destructor is called. therefore, no locks are necessary
|
||||
|
||||
///- Empty the kicked session set
|
||||
while (!m_sessions.empty())
|
||||
{
|
||||
// not remove from queue, prevent loading new sessions
|
||||
delete m_sessions.begin()->second;
|
||||
m_sessions.erase(m_sessions.begin());
|
||||
}
|
||||
std::for_each(m_sessions.begin(), m_sessions.end(), [](const SessionMap::value_type &p) { delete p.second; });
|
||||
m_sessions.clear();
|
||||
|
||||
///- Empty the WeatherMap
|
||||
for (WeatherMap::const_iterator itr = m_weathers.begin(); itr != m_weathers.end(); ++itr)
|
||||
delete itr->second;
|
||||
std::for_each(m_cliCommandQueue.begin(), m_cliCommandQueue.end(), [](const CliCommandHolder *p) { delete p; });
|
||||
m_cliCommandQueue.clear();
|
||||
|
||||
m_weathers.clear();
|
||||
|
||||
CliCommandHolder* command = NULL;
|
||||
while (cliCmdQueue.next(command))
|
||||
{ delete command; }
|
||||
std::for_each(m_sessionAddQueue.begin(), m_sessionAddQueue.end(), [](const WorldSession *s) { delete s; });
|
||||
m_sessionAddQueue.clear();
|
||||
|
||||
VMAP::VMapFactory::clear();
|
||||
MMAP::MMapFactory::clear();
|
||||
|
||||
// TODO free addSessQueue
|
||||
delete m_configForceLoadMapIds;
|
||||
}
|
||||
|
||||
/// Cleanups before world stop
|
||||
|
|
@ -225,7 +220,9 @@ bool World::RemoveSession(uint32 id)
|
|||
|
||||
void World::AddSession(WorldSession* s)
|
||||
{
|
||||
addSessQueue.add(s);
|
||||
std::lock_guard<std::mutex> guard(m_sessionAddQueueLock);
|
||||
|
||||
m_sessionAddQueue.push_back(s);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -1803,10 +1800,12 @@ void World::SendWorldText(int32 string_id, ...)
|
|||
MaNGOS::LocalizedPacketListDo<MaNGOS::WorldWorldTextBuilder> wt_do(wt_builder);
|
||||
for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
|
||||
{
|
||||
if (!itr->second || !itr->second->GetPlayer() || !itr->second->GetPlayer()->IsInWorld())
|
||||
continue;
|
||||
|
||||
wt_do(itr->second->GetPlayer());
|
||||
if (WorldSession* session = itr->second)
|
||||
{
|
||||
Player* player = session->GetPlayer();
|
||||
if (player && player->IsInWorld())
|
||||
wt_do(player);
|
||||
}
|
||||
}
|
||||
|
||||
va_end(ap);
|
||||
|
|
@ -1817,11 +1816,11 @@ void World::SendGlobalMessage(WorldPacket* packet)
|
|||
{
|
||||
for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
|
||||
{
|
||||
if (itr->second &&
|
||||
itr->second->GetPlayer() &&
|
||||
itr->second->GetPlayer()->IsInWorld())
|
||||
if (WorldSession* session = itr->second)
|
||||
{
|
||||
itr->second->SendPacket(packet);
|
||||
Player* player = session->GetPlayer();
|
||||
if (player && player->IsInWorld())
|
||||
session->SendPacket(packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1847,13 +1846,11 @@ void World::SendZoneUnderAttackMessage(uint32 zoneId, Team team)
|
|||
|
||||
for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
|
||||
{
|
||||
if (itr->second &&
|
||||
itr->second->GetPlayer() &&
|
||||
itr->second->GetPlayer()->IsInWorld() &&
|
||||
itr->second->GetPlayer()->GetTeam() == team &&
|
||||
!itr->second->GetPlayer()->GetMap()->Instanceable())
|
||||
if (WorldSession* session = itr->second)
|
||||
{
|
||||
itr->second->SendPacket(&data);
|
||||
Player* player = session->GetPlayer();
|
||||
if (player && player->IsInWorld() && player->GetTeam() == team && !player->GetMap()->Instanceable())
|
||||
itr->second->SendPacket(&data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1863,19 +1860,20 @@ void World::SendDefenseMessage(uint32 zoneId, int32 textId)
|
|||
{
|
||||
for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
|
||||
{
|
||||
if (itr->second &&
|
||||
itr->second->GetPlayer() &&
|
||||
itr->second->GetPlayer()->IsInWorld() &&
|
||||
!itr->second->GetPlayer()->GetMap()->Instanceable())
|
||||
if (WorldSession* session = itr->second)
|
||||
{
|
||||
char const* message = itr->second->GetMangosString(textId);
|
||||
uint32 messageLength = strlen(message) + 1;
|
||||
Player* player = session->GetPlayer();
|
||||
if (player && player->IsInWorld() && !player->GetMap()->Instanceable())
|
||||
{
|
||||
char const* message = session->GetMangosString(textId);
|
||||
uint32 messageLength = strlen(message) + 1;
|
||||
|
||||
WorldPacket data(SMSG_DEFENSE_MESSAGE, 4 + 4 + messageLength);
|
||||
data << uint32(zoneId);
|
||||
data << uint32(messageLength);
|
||||
data << message;
|
||||
itr->second->SendPacket(&data);
|
||||
WorldPacket data(SMSG_DEFENSE_MESSAGE, 4 + 4 + messageLength);
|
||||
data << uint32(zoneId);
|
||||
data << uint32(messageLength);
|
||||
data << message;
|
||||
session->SendPacket(&data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1895,12 +1893,13 @@ void World::KickAllLess(AccountTypes sec)
|
|||
{
|
||||
// session not removed at kick and will removed in next update tick
|
||||
for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
|
||||
if (itr->second->GetSecurity() < sec)
|
||||
itr->second->KickPlayer();
|
||||
if (WorldSession* session = itr->second)
|
||||
if (session->GetSecurity() < sec)
|
||||
session->KickPlayer();
|
||||
}
|
||||
|
||||
/// Ban an account or ban an IP address, duration_secs if it is positive used, otherwise permban
|
||||
BanReturn World::BanAccount(BanMode mode, std::string nameOrIP, uint32 duration_secs, std::string reason, std::string author)
|
||||
BanReturn World::BanAccount(BanMode mode, std::string nameOrIP, uint32 duration_secs, std::string reason, const std::string& author)
|
||||
{
|
||||
LoginDatabase.escape_string(nameOrIP);
|
||||
LoginDatabase.escape_string(reason);
|
||||
|
|
@ -2087,12 +2086,16 @@ void World::ShutdownCancel()
|
|||
#endif /* ENABLE_ELUNA */
|
||||
}
|
||||
|
||||
void World::UpdateSessions(uint32 diff)
|
||||
void World::UpdateSessions(uint32 /*diff*/)
|
||||
{
|
||||
///- Add new sessions
|
||||
WorldSession* sess;
|
||||
while (addSessQueue.next(sess))
|
||||
{ AddSession_(sess); }
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(m_sessionAddQueueLock);
|
||||
|
||||
std::for_each(m_sessionAddQueue.begin(), m_sessionAddQueue.end(), [&](WorldSession *session) { AddSession_(session); });
|
||||
|
||||
m_sessionAddQueue.clear();
|
||||
}
|
||||
|
||||
///- Then send an update signal to remaining ones
|
||||
for (SessionMap::iterator itr = m_sessions.begin(), next; itr != m_sessions.end(); itr = next)
|
||||
|
|
@ -2115,19 +2118,21 @@ void World::UpdateSessions(uint32 diff)
|
|||
// This handles the issued and queued CLI/RA commands
|
||||
void World::ProcessCliCommands()
|
||||
{
|
||||
CliCommandHolder::Print* zprint = NULL;
|
||||
void* callbackArg = NULL;
|
||||
CliCommandHolder* command;
|
||||
while (cliCmdQueue.next(command))
|
||||
std::lock_guard<std::mutex> guard(m_cliCommandQueueLock);
|
||||
|
||||
while (!m_cliCommandQueue.empty())
|
||||
{
|
||||
CliCommandHolder* command = m_cliCommandQueue.front();
|
||||
m_cliCommandQueue.pop_front();
|
||||
|
||||
DEBUG_LOG("CLI command under processing...");
|
||||
zprint = command->m_print;
|
||||
callbackArg = command->m_callbackArg;
|
||||
CliCommandHolder::Print* zprint = command->m_print;
|
||||
void* callbackArg = command->m_callbackArg;
|
||||
CliHandler handler(command->m_cliAccountId, command->m_cliAccessLevel, callbackArg, zprint);
|
||||
handler.ParseCommands(command->m_command);
|
||||
|
||||
if (command->m_commandFinished)
|
||||
{ command->m_commandFinished(callbackArg, !handler.HasSentErrorMessage()); }
|
||||
command->m_commandFinished(callbackArg, !handler.HasSentErrorMessage());
|
||||
|
||||
delete command;
|
||||
}
|
||||
|
|
@ -2685,12 +2690,9 @@ bool World::configNoReload(bool reload, eConfigBoolValues index, char const* fie
|
|||
return false;
|
||||
}
|
||||
|
||||
void World::UpdatePhaseDefinitions()
|
||||
void World::InvalidatePlayerDataToAllClient(ObjectGuid guid)
|
||||
{
|
||||
SessionMap::const_iterator itr;
|
||||
for (itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
|
||||
{
|
||||
if (itr->second && itr->second->GetPlayer() && itr->second->GetPlayer()->IsInWorld())
|
||||
itr->second->GetPlayer()->GetPhaseMgr()->NotifyStoresReloaded();
|
||||
}
|
||||
WorldPacket data(SMSG_INVALIDATE_PLAYER, 8);
|
||||
data << guid;
|
||||
SendGlobalMessage(&data);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue