|
|
|
@@ -146,9 +146,11 @@ Player* World::FindPlayerInZone(uint32 zone)
|
|
|
|
|
{
|
|
|
|
|
if (!itr->second)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
Player *player = itr->second->GetPlayer();
|
|
|
|
|
if (!player)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (player->IsInWorld() && player->GetZoneId() == zone)
|
|
|
|
|
{
|
|
|
|
|
// Used by the weather system. We return the player to broadcast the change weather message to him and all players in the zone.
|
|
|
|
@@ -298,7 +300,8 @@ World::AddSession_ (WorldSession* s)
|
|
|
|
|
|
|
|
|
|
bool World::HasRecentlyDisconnected(WorldSession* session)
|
|
|
|
|
{
|
|
|
|
|
if (!session) return false;
|
|
|
|
|
if (!session)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if (uint32 tolerance = getIntConfig(CONFIG_INTERVAL_DISCONNECT_TOLERANCE))
|
|
|
|
|
{
|
|
|
|
@@ -343,8 +346,6 @@ void World::AddQueuedPlayer(WorldSession* sess)
|
|
|
|
|
packet << uint32(GetQueuePos(sess)); // Queue position
|
|
|
|
|
packet << uint8(0); // Unk 3.3.0
|
|
|
|
|
sess->SendPacket(&packet);
|
|
|
|
|
|
|
|
|
|
//sess->SendAuthWaitQue (GetQueuePos (sess));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool World::RemoveQueuedPlayer(WorldSession* sess)
|
|
|
|
@@ -1684,6 +1685,7 @@ void World::SetInitialWorldSettings()
|
|
|
|
|
//to set mailtimer to return mails every day between 4 and 5 am
|
|
|
|
|
//mailtimer is increased when updating auctions
|
|
|
|
|
//one second is 1000 -(tested on win system)
|
|
|
|
|
//TODO: Get rid of magic numbers
|
|
|
|
|
mail_timer = ((((localtime(&m_gameTime)->tm_hour + 20) % 24)* HOUR * IN_MILLISECONDS) / m_timers[WUPDATE_AUCTIONS].GetInterval());
|
|
|
|
|
//1440
|
|
|
|
|
mail_timer_expires = ((DAY * IN_MILLISECONDS) / (m_timers[WUPDATE_AUCTIONS].GetInterval()));
|
|
|
|
@@ -1848,7 +1850,6 @@ void World::LoadAutobroadcasts()
|
|
|
|
|
bar.step();
|
|
|
|
|
|
|
|
|
|
Field *fields = result->Fetch();
|
|
|
|
|
|
|
|
|
|
std::string message = fields[0].GetString();
|
|
|
|
|
|
|
|
|
|
m_Autobroadcasts.push_back(message);
|
|
|
|
@@ -1882,10 +1883,12 @@ void World::Update(uint32 diff)
|
|
|
|
|
|
|
|
|
|
///- Update the different timers
|
|
|
|
|
for (int i = 0; i < WUPDATE_COUNT; ++i)
|
|
|
|
|
{
|
|
|
|
|
if (m_timers[i].GetCurrent() >= 0)
|
|
|
|
|
m_timers[i].Update(diff);
|
|
|
|
|
else
|
|
|
|
|
m_timers[i].SetCurrent(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///- Update the game time and check for shutdown time
|
|
|
|
|
_UpdateGameTime();
|
|
|
|
@@ -1947,9 +1950,6 @@ void World::Update(uint32 diff)
|
|
|
|
|
{
|
|
|
|
|
if (m_timers[WUPDATE_CLEANDB].Passed())
|
|
|
|
|
{
|
|
|
|
|
//uint32 tmpDiff = (m_gameTime - m_startTime);
|
|
|
|
|
//uint32 maxClientsNum = sWorld.GetMaxActiveSessionCount();
|
|
|
|
|
|
|
|
|
|
m_timers[WUPDATE_CLEANDB].Reset();
|
|
|
|
|
LoginDatabase.PExecute("DELETE FROM logs WHERE (time + %u) < "UI64FMTD";",
|
|
|
|
|
sWorld.getIntConfig(CONFIG_LOGDB_CLEARTIME), uint64(time(0)));
|
|
|
|
@@ -1993,7 +1993,6 @@ void World::Update(uint32 diff)
|
|
|
|
|
if (m_timers[WUPDATE_CORPSES].Passed())
|
|
|
|
|
{
|
|
|
|
|
m_timers[WUPDATE_CORPSES].Reset();
|
|
|
|
|
|
|
|
|
|
sObjectAccessor.RemoveOldCorpses();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -2156,7 +2155,7 @@ void World::SendGMText(int32 string_id, ...)
|
|
|
|
|
va_end(ap);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// DEPRICATED, only for debug purpose. Send a System Message to all players (except self if mentioned)
|
|
|
|
|
/// DEPRECATED, only for debug purpose. Send a System Message to all players (except self if mentioned)
|
|
|
|
|
void World::SendGlobalText(const char* text, WorldSession *self)
|
|
|
|
|
{
|
|
|
|
|
WorldPacket data;
|
|
|
|
@@ -2274,8 +2273,7 @@ BanReturn World::BanAccount(BanMode mode, std::string nameOrIP, std::string dura
|
|
|
|
|
if (WorldSession* sess = FindSession(account))
|
|
|
|
|
if (std::string(sess->GetPlayerName()) != author)
|
|
|
|
|
sess->KickPlayer();
|
|
|
|
|
}
|
|
|
|
|
while (resultAccounts->NextRow());
|
|
|
|
|
} while (resultAccounts->NextRow());
|
|
|
|
|
|
|
|
|
|
return BAN_SUCCESS;
|
|
|
|
|
}
|
|
|
|
@@ -2438,16 +2436,11 @@ void World::ShutdownMsg(bool show, Player* player)
|
|
|
|
|
///- Display a message every 12 hours, hours, 5 minutes, minute, 5 seconds and finally seconds
|
|
|
|
|
if (show ||
|
|
|
|
|
(m_ShutdownTimer < 10) ||
|
|
|
|
|
// < 30 sec; every 5 sec
|
|
|
|
|
(m_ShutdownTimer<30 && (m_ShutdownTimer % 5) == 0) ||
|
|
|
|
|
// < 5 min ; every 1 min
|
|
|
|
|
(m_ShutdownTimer<5*MINUTE && (m_ShutdownTimer % MINUTE) == 0) ||
|
|
|
|
|
// < 30 min ; every 5 min
|
|
|
|
|
(m_ShutdownTimer<30*MINUTE && (m_ShutdownTimer % (5*MINUTE)) == 0) ||
|
|
|
|
|
// < 12 h ; every 1 h
|
|
|
|
|
(m_ShutdownTimer<12*HOUR && (m_ShutdownTimer % HOUR) == 0) ||
|
|
|
|
|
// > 12 h ; every 12 h
|
|
|
|
|
(m_ShutdownTimer>12*HOUR && (m_ShutdownTimer % (12*HOUR)) == 0))
|
|
|
|
|
(m_ShutdownTimer < 30 && (m_ShutdownTimer % 5) == 0) || // < 30 sec; every 5 sec
|
|
|
|
|
(m_ShutdownTimer < 5 * MINUTE && (m_ShutdownTimer % MINUTE) == 0) || // < 5 min ; every 1 min
|
|
|
|
|
(m_ShutdownTimer < 30 * MINUTE && (m_ShutdownTimer % (5 * MINUTE)) == 0) || // < 30 min ; every 5 min
|
|
|
|
|
(m_ShutdownTimer < 12 * HOUR && (m_ShutdownTimer % HOUR) == 0) || // < 12 h ; every 1 h
|
|
|
|
|
(m_ShutdownTimer > 12 * HOUR && (m_ShutdownTimer % (12 * HOUR)) == 0)) // > 12 h ; every 12 h
|
|
|
|
|
{
|
|
|
|
|
std::string str = secsToTimeString(m_ShutdownTimer);
|
|
|
|
|
|
|
|
|
@@ -2546,13 +2539,13 @@ void World::SendAutoBroadcast()
|
|
|
|
|
msg = *itr;
|
|
|
|
|
|
|
|
|
|
uint32 abcenter = sWorld.getIntConfig(CONFIG_AUTOBROADCAST_CENTER);
|
|
|
|
|
|
|
|
|
|
if (abcenter == 0)
|
|
|
|
|
{
|
|
|
|
|
sWorld.SendWorldText(LANG_AUTO_BROADCAST, msg.c_str());
|
|
|
|
|
|
|
|
|
|
sLog.outString("AutoBroadcast: '%s'",msg.c_str());
|
|
|
|
|
}
|
|
|
|
|
if (abcenter == 1)
|
|
|
|
|
else if (abcenter == 1)
|
|
|
|
|
{
|
|
|
|
|
WorldPacket data(SMSG_NOTIFICATION, (msg.size()+1));
|
|
|
|
|
data << msg;
|
|
|
|
@@ -2560,7 +2553,7 @@ void World::SendAutoBroadcast()
|
|
|
|
|
|
|
|
|
|
sLog.outString("AutoBroadcast: '%s'",msg.c_str());
|
|
|
|
|
}
|
|
|
|
|
if (abcenter == 2)
|
|
|
|
|
else if (abcenter == 2)
|
|
|
|
|
{
|
|
|
|
|
sWorld.SendWorldText(LANG_AUTO_BROADCAST, msg.c_str());
|
|
|
|
|
|
|
|
|
@@ -2575,9 +2568,7 @@ void World::SendAutoBroadcast()
|
|
|
|
|
void World::UpdateRealmCharCount(uint32 accountId)
|
|
|
|
|
{
|
|
|
|
|
m_realmCharCallback.SetParam(accountId);
|
|
|
|
|
m_realmCharCallback.SetFutureResult(
|
|
|
|
|
CharacterDatabase.AsyncPQuery("SELECT COUNT(guid) FROM characters WHERE account = '%u'", accountId)
|
|
|
|
|
);
|
|
|
|
|
m_realmCharCallback.SetFutureResult(CharacterDatabase.AsyncPQuery("SELECT COUNT(guid) FROM characters WHERE account = '%u'", accountId));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void World::_UpdateRealmCharCount(QueryResult resultCharCount, uint32 accountId)
|
|
|
|
@@ -2607,7 +2598,6 @@ void World::InitDailyQuestResetTime()
|
|
|
|
|
if (result)
|
|
|
|
|
{
|
|
|
|
|
Field *fields = result->Fetch();
|
|
|
|
|
|
|
|
|
|
mostRecentQuestTime = (time_t)fields[0].GetUInt64();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@@ -2630,12 +2620,9 @@ void World::InitDailyQuestResetTime()
|
|
|
|
|
// need reset (if we have quest time before last reset time (not processed by some reason)
|
|
|
|
|
if (mostRecentQuestTime && mostRecentQuestTime <= resetTime)
|
|
|
|
|
m_NextDailyQuestReset = mostRecentQuestTime;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// plan next reset time
|
|
|
|
|
else // plan next reset time
|
|
|
|
|
m_NextDailyQuestReset = (curTime >= curDayResetTime) ? curDayResetTime + DAY : curDayResetTime;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void World::InitRandomBGResetTime()
|
|
|
|
|
{
|
|
|
|
@@ -2727,11 +2714,9 @@ void World::UpdateMaxSessionCounters()
|
|
|
|
|
void World::LoadDBVersion()
|
|
|
|
|
{
|
|
|
|
|
QueryResult result = WorldDatabase.Query("SELECT db_version, script_version, cache_id FROM version LIMIT 1");
|
|
|
|
|
//QueryResult* result = WorldDatabase.Query("SELECT version, creature_ai_version, cache_id FROM db_version LIMIT 1");
|
|
|
|
|
if (result)
|
|
|
|
|
{
|
|
|
|
|
Field* fields = result->Fetch();
|
|
|
|
|
|
|
|
|
|
m_DBVersion = fields[0].GetString();
|
|
|
|
|
m_CreatureEventAIVersion = fields[1].GetString();
|
|
|
|
|
|
|
|
|
@@ -2789,8 +2774,7 @@ void World::LoadWorldStates()
|
|
|
|
|
m_worldstates[fields[0].GetUInt32()] = fields[1].GetUInt64();
|
|
|
|
|
bar.step();
|
|
|
|
|
++counter;
|
|
|
|
|
}
|
|
|
|
|
while (result->NextRow());
|
|
|
|
|
} while (result->NextRow());
|
|
|
|
|
|
|
|
|
|
sLog.outString();
|
|
|
|
|
sLog.outString(">> Loaded %u world states.", counter);
|
|
|
|
@@ -2817,7 +2801,6 @@ void World::ProcessQueryCallbacks()
|
|
|
|
|
{
|
|
|
|
|
QueryResult result;
|
|
|
|
|
|
|
|
|
|
//-UpdateRealmCharCount
|
|
|
|
|
if (m_realmCharCallback.IsReady())
|
|
|
|
|
{
|
|
|
|
|
uint32 param = m_realmCharCallback.GetParam();
|
|
|
|
|