TrinityCore
Loading...
Searching...
No Matches
World.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
22#include "World.h"
23#include "AccountMgr.h"
24#include "AchievementMgr.h"
25#include "AddonMgr.h"
26#include "ArenaTeamMgr.h"
27#include "AuctionHouseBot.h"
28#include "AuctionHouseMgr.h"
29#include "BattlefieldMgr.h"
30#include "BattlegroundMgr.h"
31#include "CalendarMgr.h"
32#include "ChannelMgr.h"
33#include "CharacterCache.h"
35#include "Chat.h"
36#include "ChatCommand.h"
37#include "ChatPackets.h"
38#include "Config.h"
39#include "CreatureAIRegistry.h"
40#include "CreatureGroups.h"
41#include "CreatureTextMgr.h"
42#include "DatabaseEnv.h"
43#include "DisableMgr.h"
44#include "GameEventMgr.h"
45#include "GameObjectModel.h"
46#include "GameTime.h"
47#include "GitRevision.h"
48#include "GridNotifiersImpl.h"
49#include "GroupMgr.h"
50#include "GuildMgr.h"
51#include "InstanceSaveMgr.h"
52#include "IPLocation.h"
53#include "Language.h"
54#include "LFGMgr.h"
55#include "Log.h"
56#include "LootItemStorage.h"
57#include "LootMgr.h"
58#include "M2Stores.h"
59#include "MapManager.h"
60#include "Memory.h"
61#include "Metric.h"
62#include "MMapFactory.h"
63#include "ObjectAccessor.h"
64#include "ObjectMgr.h"
65#include "OutdoorPvPMgr.h"
66#include "PetitionMgr.h"
67#include "Player.h"
68#include "PlayerDump.h"
69#include "PoolMgr.h"
70#include "QueryCallback.h"
71#include "QuestPools.h"
72#include "Realm.h"
73#include "ScriptMgr.h"
74#include "ScriptReloadMgr.h"
75#include "SkillDiscovery.h"
76#include "SkillExtraItems.h"
77#include "SmartScriptMgr.h"
78#include "SpellMgr.h"
79#include "TicketMgr.h"
80#include "TransportMgr.h"
81#include "Unit.h"
82#include "UpdateTime.h"
83#include "VMapFactory.h"
84#include "VMapManager2.h"
85#include "WardenCheckMgr.h"
86#include "WaypointManager.h"
87#include "WeatherMgr.h"
88#include "WhoListStorage.h"
89#include "WorldSession.h"
90
91#include <boost/asio/ip/address.hpp>
92
93TC_GAME_API std::atomic<bool> World::m_stopEvent(false);
95
96TC_GAME_API std::atomic<uint32> World::m_worldLoopCounter(0);
97
102
107
110{
111 m_playerLimit = 0;
113 m_allowMovement = true;
114 m_ShutdownMask = 0;
115 m_ShutdownTimer = 0;
116
119 m_PlayerCount = 0;
127
130
131 mail_timer = 0;
133
134 m_isClosed = false;
135
136 m_CleaningFlags = 0;
137
138 memset(rate_values, 0, sizeof(rate_values));
139 memset(m_int_configs, 0, sizeof(m_int_configs));
140 memset(m_bool_configs, 0, sizeof(m_bool_configs));
141 memset(m_float_configs, 0, sizeof(m_float_configs));
142
143 _guidWarn = false;
144 _guidAlert = false;
145 _warnDiff = 0;
147}
148
151{
153 while (!m_sessions.empty())
154 {
155 // not remove from queue, prevent loading new sessions
156 delete m_sessions.begin()->second;
157 m_sessions.erase(m_sessions.begin());
158 }
159
160 CliCommandHolder* command = nullptr;
161 while (cliCmdQueue.next(command))
162 delete command;
163
166
168}
169
171{
172 static World instance;
173 return &instance;
174}
175
178{
180 SessionMap::const_iterator itr;
181 for (itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
182 {
183 if (!itr->second)
184 continue;
185
186 Player* player = itr->second->GetPlayer();
187 if (!player)
188 continue;
189
190 if (player->IsInWorld() && player->GetZoneId() == zone)
191 return player;
192 }
193 return nullptr;
194}
195
196bool World::IsClosed() const
197{
198 return m_isClosed;
199}
200
201void World::SetClosed(bool val)
202{
203 m_isClosed = val;
204
205 // Invert the value, for simplicity for scripters.
206 sScriptMgr->OnOpenStateChange(!val);
207}
208
210{
212 stmt->setInt32(0, int32(realm.Id.Realm));
213 PreparedQueryResult result = LoginDatabase.Query(stmt);
214
215 if (result)
216 SetPlayerSecurityLimit(AccountTypes(result->Fetch()->GetUInt8()));
217}
218
220{
221 AccountTypes sec = _sec < SEC_CONSOLE ? _sec : SEC_PLAYER;
222 bool update = sec > m_allowedSecurityLevel;
224 if (update)
226}
227
228void World::SetMotd(std::string motd)
229{
231 sScriptMgr->OnMotdChange(motd);
232
233 _motd.clear();
234
235 std::vector<std::string_view> tokens = Trinity::Tokenize(motd, '@', true);
236
237 _motd.reserve(tokens.size());
238
239 for (std::string_view const& token : tokens)
240 _motd.emplace_back(token);
241}
242
243std::vector<std::string> const& World::GetMotd() const
244{
245 return _motd;
246}
247
249{
250 // Lock this only to prevent multiple maps triggering at the same time
251 std::lock_guard<std::mutex> lock(_guidAlertLock);
252
253 time_t gameTime = GameTime::GetGameTime();
254 time_t today = (gameTime / DAY) * DAY;
255
256 // Check if our window to restart today has passed. 5 mins until quiet time
257 while (gameTime >= GetLocalHourTimestamp(today, getIntConfig(CONFIG_RESPAWN_RESTARTQUIETTIME)) - 1810)
258 today += DAY;
259
260 // Schedule restart for 30 minutes before quiet time, or as long as we have
262
263 _guidWarn = true;
265}
266
268{
269 // Lock this only to prevent multiple maps triggering at the same time
270 std::lock_guard<std::mutex> lock(_guidAlertLock);
271
273 _guidAlert = true;
274 _guidWarn = false;
275}
276
285
293
300
303{
304 SessionMap::const_iterator itr = m_sessions.find(id);
305
306 if (itr != m_sessions.end())
307 return itr->second; // also can return nullptr for kicked session
308 else
309 return nullptr;
310}
311
314{
316 SessionMap::const_iterator itr = m_sessions.find(id);
317
318 if (itr != m_sessions.end() && itr->second)
319 {
320 if (itr->second->PlayerLoading())
321 return false;
322
323 itr->second->KickPlayer("World::RemoveSession");
324 }
325
326 return true;
327}
328
333
335{
336 ASSERT(s);
337
338 //NOTE - Still there is race condition in WorldSession* being used in the Sockets
339
342 if (!RemoveSession(s->GetAccountId()))
343 {
344 s->KickPlayer("World::AddSession_ Couldn't remove the other session while on loading screen");
345 delete s; // session not added yet in session list, so not listed in queue
346 return;
347 }
348
349 // decrease session counts only at not reconnection case
350 bool decrease_session = true;
351
352 // if session already exist, prepare to it deleting at next world update
353 // NOTE - KickPlayer() should be called on "old" in RemoveSession()
354 {
355 SessionMap::const_iterator old = m_sessions.find(s->GetAccountId());
356
357 if (old != m_sessions.end())
358 {
359 // prevent decrease sessions count if session queued
360 if (RemoveQueuedPlayer(old->second))
361 decrease_session = false;
362 // not remove replaced session form queue if listed
363 delete old->second;
364 }
365 }
366
367 m_sessions[s->GetAccountId()] = s;
368
370 uint32 pLimit = GetPlayerAmountLimit();
371 uint32 QueueSize = GetQueuedSessionCount(); //number of players in the queue
372
373 //so we don't count the user trying to
374 //login as a session and queue the socket that we are using
375 if (decrease_session)
376 --Sessions;
377
378 if (pLimit > 0 && Sessions >= pLimit && !s->HasPermission(rbac::RBAC_PERM_SKIP_QUEUE) && !HasRecentlyDisconnected(s))
379 {
382 TC_LOG_INFO("misc", "PlayerQueue: Account id {} is in Queue Position ({}).", s->GetAccountId(), ++QueueSize);
383 return;
384 }
385
387
389
390 // Updates the population
391 if (pLimit > 0)
392 {
393 float popu = (float)GetActiveSessionCount(); // updated number of users on the server
394 popu /= pLimit;
395 popu *= 2;
396 TC_LOG_INFO("misc", "Server Population ({}).", popu);
397 }
398}
399
401{
402 if (!session)
403 return false;
404
406 {
407 for (DisconnectMap::iterator i = m_disconnects.begin(); i != m_disconnects.end();)
408 {
409 if (difftime(i->second, GameTime::GetGameTime()) < tolerance)
410 {
411 if (i->first == session->GetAccountId())
412 return true;
413 ++i;
414 }
415 else
416 m_disconnects.erase(i++);
417 }
418 }
419 return false;
420 }
421
423{
424 uint32 position = 1;
425
426 for (Queue::const_iterator iter = m_QueuedPlayer.begin(); iter != m_QueuedPlayer.end(); ++iter, ++position)
427 if ((*iter) == sess)
428 return position;
429
430 return 0;
431}
432
434{
435 sess->SetInQueue(true);
436 m_QueuedPlayer.push_back(sess);
437
438 // The 1st SMSG_AUTH_RESPONSE needs to contain other info too.
439 sess->SendAuthResponse(AUTH_WAIT_QUEUE, false, GetQueuePos(sess));
440}
441
443{
444 // sessions count including queued to remove (if removed_session set)
445 uint32 sessions = GetActiveSessionCount();
446
447 uint32 position = 1;
448 Queue::iterator iter = m_QueuedPlayer.begin();
449
450 // search to remove and count skipped positions
451 bool found = false;
452
453 for (; iter != m_QueuedPlayer.end(); ++iter, ++position)
454 {
455 if (*iter == sess)
456 {
457 sess->SetInQueue(false);
458 sess->ResetTimeOutTime(false);
459 iter = m_QueuedPlayer.erase(iter);
460 found = true; // removing queued session
461 break;
462 }
463 }
464
465 // iter point to next socked after removed or end()
466 // position store position of removed socket and then new position next socket after removed
467
468 // if session not queued then we need decrease sessions count
469 if (!found && sessions)
470 --sessions;
471
472 // accept first in queue
473 if ((!m_playerLimit || sessions < m_playerLimit) && !m_QueuedPlayer.empty())
474 {
475 WorldSession* pop_sess = m_QueuedPlayer.front();
476 pop_sess->InitializeSession();
477 m_QueuedPlayer.pop_front();
478
479 // update iter to point first queued socket or end() if queue is empty now
480 iter = m_QueuedPlayer.begin();
481 position = 1;
482 }
483
484 // update position from iter to end()
485 // iter point to first not updated socket, position store new position
486 for (; iter != m_QueuedPlayer.end(); ++iter, ++position)
487 (*iter)->SendAuthWaitQueue(position);
488
489 return found;
490}
491
494{
495 if (reload)
496 {
497 std::vector<std::string> configErrors;
498 if (!sConfigMgr->Reload(configErrors))
499 {
500 for (std::string const& configError : configErrors)
501 TC_LOG_ERROR("misc", "World settings reload fail: {}.", configError);
502
503 return;
504 }
505 sLog->LoadFromConfig();
506 sMetric->LoadFromConfigs();
507 }
508
510 SetPlayerAmountLimit(sConfigMgr->GetIntDefault("PlayerLimit", 100));
511 SetMotd(sConfigMgr->GetStringDefault("Motd", "Welcome to a Trinity Core Server."));
512
514 m_bool_configs[CONFIG_ALLOW_TICKETS] = sConfigMgr->GetBoolDefault("AllowTickets", true);
515 m_bool_configs[CONFIG_DELETE_CHARACTER_TICKET_TRACE] = sConfigMgr->GetBoolDefault("DeletedCharacterTicketTrace", false);
516
518 SetNewCharString(sConfigMgr->GetStringDefault("PlayerStart.String", ""));
519
521 m_int_configs[CONFIG_ENABLE_SINFO_LOGIN] = sConfigMgr->GetIntDefault("Server.LoginInfo", 0);
522
524 rate_values[RATE_HEALTH] = sConfigMgr->GetFloatDefault("Rate.Health", 1.0f);
525 if (rate_values[RATE_HEALTH] < 0)
526 {
527 TC_LOG_ERROR("server.loading", "Rate.Health ({}) must be > 0. Using 1 instead.", rate_values[RATE_HEALTH]);
529 }
530 rate_values[RATE_POWER_MANA] = sConfigMgr->GetFloatDefault("Rate.Mana", 1.0f);
532 {
533 TC_LOG_ERROR("server.loading", "Rate.Mana ({}) must be > 0. Using 1 instead.", rate_values[RATE_POWER_MANA]);
535 }
536 rate_values[RATE_POWER_RAGE_INCOME] = sConfigMgr->GetFloatDefault("Rate.Rage.Income", 1.0f);
537 rate_values[RATE_POWER_RAGE_LOSS] = sConfigMgr->GetFloatDefault("Rate.Rage.Loss", 1.0f);
539 {
540 TC_LOG_ERROR("server.loading", "Rate.Rage.Loss ({}) must be > 0. Using 1 instead.", rate_values[RATE_POWER_RAGE_LOSS]);
542 }
543 rate_values[RATE_POWER_RUNICPOWER_INCOME] = sConfigMgr->GetFloatDefault("Rate.RunicPower.Income", 1.0f);
544 rate_values[RATE_POWER_RUNICPOWER_LOSS] = sConfigMgr->GetFloatDefault("Rate.RunicPower.Loss", 1.0f);
546 {
547 TC_LOG_ERROR("server.loading", "Rate.RunicPower.Loss ({}) must be > 0. Using 1 instead.", rate_values[RATE_POWER_RUNICPOWER_LOSS]);
549 }
550 rate_values[RATE_POWER_FOCUS] = sConfigMgr->GetFloatDefault("Rate.Focus", 1.0f);
551 rate_values[RATE_POWER_ENERGY] = sConfigMgr->GetFloatDefault("Rate.Energy", 1.0f);
552
553 rate_values[RATE_SKILL_DISCOVERY] = sConfigMgr->GetFloatDefault("Rate.Skill.Discovery", 1.0f);
554
555 rate_values[RATE_DROP_ITEM_POOR] = sConfigMgr->GetFloatDefault("Rate.Drop.Item.Poor", 1.0f);
556 rate_values[RATE_DROP_ITEM_NORMAL] = sConfigMgr->GetFloatDefault("Rate.Drop.Item.Normal", 1.0f);
557 rate_values[RATE_DROP_ITEM_UNCOMMON] = sConfigMgr->GetFloatDefault("Rate.Drop.Item.Uncommon", 1.0f);
558 rate_values[RATE_DROP_ITEM_RARE] = sConfigMgr->GetFloatDefault("Rate.Drop.Item.Rare", 1.0f);
559 rate_values[RATE_DROP_ITEM_EPIC] = sConfigMgr->GetFloatDefault("Rate.Drop.Item.Epic", 1.0f);
560 rate_values[RATE_DROP_ITEM_LEGENDARY] = sConfigMgr->GetFloatDefault("Rate.Drop.Item.Legendary", 1.0f);
561 rate_values[RATE_DROP_ITEM_ARTIFACT] = sConfigMgr->GetFloatDefault("Rate.Drop.Item.Artifact", 1.0f);
562 rate_values[RATE_DROP_ITEM_REFERENCED] = sConfigMgr->GetFloatDefault("Rate.Drop.Item.Referenced", 1.0f);
563 rate_values[RATE_DROP_ITEM_REFERENCED_AMOUNT] = sConfigMgr->GetFloatDefault("Rate.Drop.Item.ReferencedAmount", 1.0f);
564 rate_values[RATE_DROP_MONEY] = sConfigMgr->GetFloatDefault("Rate.Drop.Money", 1.0f);
565 rate_values[RATE_XP_KILL] = sConfigMgr->GetFloatDefault("Rate.XP.Kill", 1.0f);
566 rate_values[RATE_XP_BG_KILL] = sConfigMgr->GetFloatDefault("Rate.XP.BattlegroundKill", 1.0f);
567 rate_values[RATE_XP_QUEST] = sConfigMgr->GetFloatDefault("Rate.XP.Quest", 1.0f);
568 rate_values[RATE_XP_EXPLORE] = sConfigMgr->GetFloatDefault("Rate.XP.Explore", 1.0f);
569
570 m_int_configs[CONFIG_XP_BOOST_DAYMASK] = sConfigMgr->GetIntDefault("XP.Boost.Daymask", 0);
571 rate_values[RATE_XP_BOOST] = sConfigMgr->GetFloatDefault("XP.Boost.Rate", 2.0f);
572
573 rate_values[RATE_REPAIRCOST] = sConfigMgr->GetFloatDefault("Rate.RepairCost", 1.0f);
574 if (rate_values[RATE_REPAIRCOST] < 0.0f)
575 {
576 TC_LOG_ERROR("server.loading", "Rate.RepairCost ({}) must be >=0. Using 0.0 instead.", rate_values[RATE_REPAIRCOST]);
578 }
579 rate_values[RATE_REPUTATION_GAIN] = sConfigMgr->GetFloatDefault("Rate.Reputation.Gain", 1.0f);
580 rate_values[RATE_REPUTATION_LOWLEVEL_KILL] = sConfigMgr->GetFloatDefault("Rate.Reputation.LowLevel.Kill", 1.0f);
581 rate_values[RATE_REPUTATION_LOWLEVEL_QUEST] = sConfigMgr->GetFloatDefault("Rate.Reputation.LowLevel.Quest", 1.0f);
582 rate_values[RATE_REPUTATION_RECRUIT_A_FRIEND_BONUS] = sConfigMgr->GetFloatDefault("Rate.Reputation.RecruitAFriendBonus", 0.1f);
583 rate_values[RATE_CREATURE_NORMAL_DAMAGE] = sConfigMgr->GetFloatDefault("Rate.Creature.Normal.Damage", 1.0f);
584 rate_values[RATE_CREATURE_ELITE_ELITE_DAMAGE] = sConfigMgr->GetFloatDefault("Rate.Creature.Elite.Elite.Damage", 1.0f);
585 rate_values[RATE_CREATURE_ELITE_RAREELITE_DAMAGE] = sConfigMgr->GetFloatDefault("Rate.Creature.Elite.RAREELITE.Damage", 1.0f);
586 rate_values[RATE_CREATURE_ELITE_WORLDBOSS_DAMAGE] = sConfigMgr->GetFloatDefault("Rate.Creature.Elite.WORLDBOSS.Damage", 1.0f);
587 rate_values[RATE_CREATURE_ELITE_RARE_DAMAGE] = sConfigMgr->GetFloatDefault("Rate.Creature.Elite.RARE.Damage", 1.0f);
588 rate_values[RATE_CREATURE_NORMAL_HP] = sConfigMgr->GetFloatDefault("Rate.Creature.Normal.HP", 1.0f);
589 rate_values[RATE_CREATURE_ELITE_ELITE_HP] = sConfigMgr->GetFloatDefault("Rate.Creature.Elite.Elite.HP", 1.0f);
590 rate_values[RATE_CREATURE_ELITE_RAREELITE_HP] = sConfigMgr->GetFloatDefault("Rate.Creature.Elite.RAREELITE.HP", 1.0f);
591 rate_values[RATE_CREATURE_ELITE_WORLDBOSS_HP] = sConfigMgr->GetFloatDefault("Rate.Creature.Elite.WORLDBOSS.HP", 1.0f);
592 rate_values[RATE_CREATURE_ELITE_RARE_HP] = sConfigMgr->GetFloatDefault("Rate.Creature.Elite.RARE.HP", 1.0f);
593 rate_values[RATE_CREATURE_NORMAL_SPELLDAMAGE] = sConfigMgr->GetFloatDefault("Rate.Creature.Normal.SpellDamage", 1.0f);
594 rate_values[RATE_CREATURE_ELITE_ELITE_SPELLDAMAGE] = sConfigMgr->GetFloatDefault("Rate.Creature.Elite.Elite.SpellDamage", 1.0f);
595 rate_values[RATE_CREATURE_ELITE_RAREELITE_SPELLDAMAGE] = sConfigMgr->GetFloatDefault("Rate.Creature.Elite.RAREELITE.SpellDamage", 1.0f);
596 rate_values[RATE_CREATURE_ELITE_WORLDBOSS_SPELLDAMAGE] = sConfigMgr->GetFloatDefault("Rate.Creature.Elite.WORLDBOSS.SpellDamage", 1.0f);
597 rate_values[RATE_CREATURE_ELITE_RARE_SPELLDAMAGE] = sConfigMgr->GetFloatDefault("Rate.Creature.Elite.RARE.SpellDamage", 1.0f);
598 rate_values[RATE_CREATURE_AGGRO] = sConfigMgr->GetFloatDefault("Rate.Creature.Aggro", 1.0f);
599 rate_values[RATE_REST_INGAME] = sConfigMgr->GetFloatDefault("Rate.Rest.InGame", 1.0f);
600 rate_values[RATE_REST_OFFLINE_IN_TAVERN_OR_CITY] = sConfigMgr->GetFloatDefault("Rate.Rest.Offline.InTavernOrCity", 1.0f);
601 rate_values[RATE_REST_OFFLINE_IN_WILDERNESS] = sConfigMgr->GetFloatDefault("Rate.Rest.Offline.InWilderness", 1.0f);
602 rate_values[RATE_DAMAGE_FALL] = sConfigMgr->GetFloatDefault("Rate.Damage.Fall", 1.0f);
603 rate_values[RATE_AUCTION_TIME] = sConfigMgr->GetFloatDefault("Rate.Auction.Time", 1.0f);
604 rate_values[RATE_AUCTION_DEPOSIT] = sConfigMgr->GetFloatDefault("Rate.Auction.Deposit", 1.0f);
605 rate_values[RATE_AUCTION_CUT] = sConfigMgr->GetFloatDefault("Rate.Auction.Cut", 1.0f);
606 rate_values[RATE_HONOR] = sConfigMgr->GetFloatDefault("Rate.Honor", 1.0f);
607 rate_values[RATE_ARENA_POINTS] = sConfigMgr->GetFloatDefault("Rate.ArenaPoints", 1.0f);
608 rate_values[RATE_INSTANCE_RESET_TIME] = sConfigMgr->GetFloatDefault("Rate.InstanceResetTime", 1.0f);
609 rate_values[RATE_TALENT] = sConfigMgr->GetFloatDefault("Rate.Talent", 1.0f);
610 if (rate_values[RATE_TALENT] < 0.0f)
611 {
612 TC_LOG_ERROR("server.loading", "Rate.Talent ({}) must be > 0. Using 1 instead.", rate_values[RATE_TALENT]);
613 rate_values[RATE_TALENT] = 1.0f;
614 }
615 rate_values[RATE_MOVESPEED] = sConfigMgr->GetFloatDefault("Rate.MoveSpeed", 1.0f);
617 {
618 TC_LOG_ERROR("server.loading", "Rate.MoveSpeed ({}) must be > 0. Using 1 instead.", rate_values[RATE_MOVESPEED]);
620 }
622 rate_values[RATE_CORPSE_DECAY_LOOTED] = sConfigMgr->GetFloatDefault("Rate.Corpse.Decay.Looted", 0.5f);
623
624 rate_values[RATE_DURABILITY_LOSS_ON_DEATH] = sConfigMgr->GetFloatDefault("DurabilityLoss.OnDeath", 10.0f);
626 {
627 TC_LOG_ERROR("server.loading", "DurabilityLoss.OnDeath ({}) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_ON_DEATH]);
629 }
631 {
632 TC_LOG_ERROR("server.loading", "DurabilityLoss.OnDeath ({}) must be <= 100. Using 100.0 instead.", rate_values[RATE_DURABILITY_LOSS_ON_DEATH]);
634 }
636
637 rate_values[RATE_DURABILITY_LOSS_DAMAGE] = sConfigMgr->GetFloatDefault("DurabilityLossChance.Damage", 0.5f);
639 {
640 TC_LOG_ERROR("server.loading", "DurabilityLossChance.Damage ({}) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_DAMAGE]);
642 }
643 rate_values[RATE_DURABILITY_LOSS_ABSORB] = sConfigMgr->GetFloatDefault("DurabilityLossChance.Absorb", 0.5f);
645 {
646 TC_LOG_ERROR("server.loading", "DurabilityLossChance.Absorb ({}) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_ABSORB]);
648 }
649 rate_values[RATE_DURABILITY_LOSS_PARRY] = sConfigMgr->GetFloatDefault("DurabilityLossChance.Parry", 0.05f);
651 {
652 TC_LOG_ERROR("server.loading", "DurabilityLossChance.Parry ({}) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_PARRY]);
654 }
655 rate_values[RATE_DURABILITY_LOSS_BLOCK] = sConfigMgr->GetFloatDefault("DurabilityLossChance.Block", 0.05f);
657 {
658 TC_LOG_ERROR("server.loading", "DurabilityLossChance.Block ({}) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_BLOCK]);
660 }
661 rate_values[RATE_MONEY_QUEST] = sConfigMgr->GetFloatDefault("Rate.Quest.Money.Reward", 1.0f);
662 if (rate_values[RATE_MONEY_QUEST] < 0.0f)
663 {
664 TC_LOG_ERROR("server.loading", "Rate.Quest.Money.Reward ({}) must be >=0. Using 0 instead.", rate_values[RATE_MONEY_QUEST]);
666 }
667 rate_values[RATE_MONEY_MAX_LEVEL_QUEST] = sConfigMgr->GetFloatDefault("Rate.Quest.Money.Max.Level.Reward", 1.0f);
669 {
670 TC_LOG_ERROR("server.loading", "Rate.Quest.Money.Max.Level.Reward ({}) must be >=0. Using 0 instead.", rate_values[RATE_MONEY_MAX_LEVEL_QUEST]);
672 }
674
675 m_bool_configs[CONFIG_DURABILITY_LOSS_IN_PVP] = sConfigMgr->GetBoolDefault("DurabilityLoss.InPvP", false);
676
677 m_int_configs[CONFIG_COMPRESSION] = sConfigMgr->GetIntDefault("Compression", 1);
679 {
680 TC_LOG_ERROR("server.loading", "Compression level ({}) must be in range 1..9. Using default compression level (1).", m_int_configs[CONFIG_COMPRESSION]);
682 }
683 m_bool_configs[CONFIG_ADDON_CHANNEL] = sConfigMgr->GetBoolDefault("AddonChannel", true);
684 m_bool_configs[CONFIG_CLEAN_CHARACTER_DB] = sConfigMgr->GetBoolDefault("CleanCharacterDB", false);
685 m_int_configs[CONFIG_PERSISTENT_CHARACTER_CLEAN_FLAGS] = sConfigMgr->GetIntDefault("PersistentCharacterCleanFlags", 0);
686 m_int_configs[CONFIG_AUCTION_GETALL_DELAY] = sConfigMgr->GetIntDefault("Auction.GetAllScanDelay", 900);
687 m_int_configs[CONFIG_AUCTION_SEARCH_DELAY] = sConfigMgr->GetIntDefault("Auction.SearchDelay", 300);
689 {
690 TC_LOG_ERROR("server.loading", "Auction.SearchDelay ({}) must be between 100 and 10000. Using default of 300ms", m_int_configs[CONFIG_AUCTION_SEARCH_DELAY]);
692 }
693 m_int_configs[CONFIG_CHAT_CHANNEL_LEVEL_REQ] = sConfigMgr->GetIntDefault("ChatLevelReq.Channel", 1);
694 m_int_configs[CONFIG_CHAT_WHISPER_LEVEL_REQ] = sConfigMgr->GetIntDefault("ChatLevelReq.Whisper", 1);
695 m_int_configs[CONFIG_CHAT_EMOTE_LEVEL_REQ] = sConfigMgr->GetIntDefault("ChatLevelReq.Emote", 1);
696 m_int_configs[CONFIG_CHAT_SAY_LEVEL_REQ] = sConfigMgr->GetIntDefault("ChatLevelReq.Say", 1);
697 m_int_configs[CONFIG_CHAT_YELL_LEVEL_REQ] = sConfigMgr->GetIntDefault("ChatLevelReq.Yell", 1);
698 m_int_configs[CONFIG_PARTY_LEVEL_REQ] = sConfigMgr->GetIntDefault("PartyLevelReq", 1);
699 m_int_configs[CONFIG_TRADE_LEVEL_REQ] = sConfigMgr->GetIntDefault("LevelReq.Trade", 1);
700 m_int_configs[CONFIG_TICKET_LEVEL_REQ] = sConfigMgr->GetIntDefault("LevelReq.Ticket", 1);
701 m_int_configs[CONFIG_AUCTION_LEVEL_REQ] = sConfigMgr->GetIntDefault("LevelReq.Auction", 1);
702 m_int_configs[CONFIG_MAIL_LEVEL_REQ] = sConfigMgr->GetIntDefault("LevelReq.Mail", 1);
703 m_bool_configs[CONFIG_PRESERVE_CUSTOM_CHANNELS] = sConfigMgr->GetBoolDefault("PreserveCustomChannels", false);
704 m_int_configs[CONFIG_PRESERVE_CUSTOM_CHANNEL_DURATION] = sConfigMgr->GetIntDefault("PreserveCustomChannelDuration", 14);
705 m_int_configs[CONFIG_PRESERVE_CUSTOM_CHANNEL_INTERVAL] = sConfigMgr->GetIntDefault("PreserveCustomChannelInterval", 5);
706 m_bool_configs[CONFIG_GRID_UNLOAD] = sConfigMgr->GetBoolDefault("GridUnload", true);
707 m_bool_configs[CONFIG_BASEMAP_LOAD_GRIDS] = sConfigMgr->GetBoolDefault("BaseMapLoadAllGrids", false);
709 {
710 TC_LOG_ERROR("server.loading", "BaseMapLoadAllGrids enabled, but GridUnload also enabled. GridUnload must be disabled to enable base map pre-loading. Base map pre-loading disabled");
712 }
713 m_bool_configs[CONFIG_INSTANCEMAP_LOAD_GRIDS] = sConfigMgr->GetBoolDefault("InstanceMapLoadAllGrids", false);
715 {
716 TC_LOG_ERROR("server.loading", "InstanceMapLoadAllGrids enabled, but GridUnload also enabled. GridUnload must be disabled to enable instance map pre-loading. Instance map pre-loading disabled");
718 }
719 m_int_configs[CONFIG_INTERVAL_SAVE] = sConfigMgr->GetIntDefault("PlayerSaveInterval", 15 * MINUTE * IN_MILLISECONDS);
720 m_int_configs[CONFIG_INTERVAL_DISCONNECT_TOLERANCE] = sConfigMgr->GetIntDefault("DisconnectToleranceInterval", 0);
721 m_bool_configs[CONFIG_STATS_SAVE_ONLY_ON_LOGOUT] = sConfigMgr->GetBoolDefault("PlayerSave.Stats.SaveOnlyOnLogout", true);
722
723 m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE] = sConfigMgr->GetIntDefault("PlayerSave.Stats.MinLevel", 0);
725 {
726 TC_LOG_ERROR("server.loading", "PlayerSave.Stats.MinLevel ({}) must be in range 0..80. Using default, do not save character stats (0).", m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE]);
728 }
729
730 m_int_configs[CONFIG_INTERVAL_GRIDCLEAN] = sConfigMgr->GetIntDefault("GridCleanUpDelay", 5 * MINUTE * IN_MILLISECONDS);
732 {
733 TC_LOG_ERROR("server.loading", "GridCleanUpDelay ({}) must be greater {}. Use this minimal value.", m_int_configs[CONFIG_INTERVAL_GRIDCLEAN], MIN_GRID_DELAY);
735 }
736 if (reload)
737 sMapMgr->SetGridCleanUpDelay(m_int_configs[CONFIG_INTERVAL_GRIDCLEAN]);
738
739 m_int_configs[CONFIG_INTERVAL_MAPUPDATE] = sConfigMgr->GetIntDefault("MapUpdateInterval", 10);
741 {
742 TC_LOG_ERROR("server.loading", "MapUpdateInterval ({}) must be greater {}. Use this minimal value.", m_int_configs[CONFIG_INTERVAL_MAPUPDATE], MIN_MAP_UPDATE_DELAY);
744 }
745 if (reload)
746 sMapMgr->SetMapUpdateInterval(m_int_configs[CONFIG_INTERVAL_MAPUPDATE]);
747
748 m_int_configs[CONFIG_INTERVAL_CHANGEWEATHER] = sConfigMgr->GetIntDefault("ChangeWeatherInterval", 10 * MINUTE * IN_MILLISECONDS);
749
750 if (reload)
751 {
752 uint32 val = sConfigMgr->GetIntDefault("WorldServerPort", 8085);
754 TC_LOG_ERROR("server.loading", "WorldServerPort option can't be changed at worldserver.conf reload, using current value ({}).", m_int_configs[CONFIG_PORT_WORLD]);
755 }
756 else
757 m_int_configs[CONFIG_PORT_WORLD] = sConfigMgr->GetIntDefault("WorldServerPort", 8085);
758
759 // Config values are in "milliseconds" but we handle SocketTimeOut only as "seconds" so divide by 1000
760 m_int_configs[CONFIG_SOCKET_TIMEOUTTIME] = sConfigMgr->GetIntDefault("SocketTimeOutTime", 900000) / 1000;
761 m_int_configs[CONFIG_SOCKET_TIMEOUTTIME_ACTIVE] = sConfigMgr->GetIntDefault("SocketTimeOutTimeActive", 60000) / 1000;
762
763 m_int_configs[CONFIG_SESSION_ADD_DELAY] = sConfigMgr->GetIntDefault("SessionAddDelay", 10000);
764
765 m_float_configs[CONFIG_GROUP_XP_DISTANCE] = sConfigMgr->GetFloatDefault("MaxGroupXPDistance", 74.0f);
766 m_float_configs[CONFIG_MAX_RECRUIT_A_FRIEND_DISTANCE] = sConfigMgr->GetFloatDefault("MaxRecruitAFriendBonusDistance", 100.0f);
767
768 m_int_configs[CONFIG_MIN_QUEST_SCALED_XP_RATIO] = sConfigMgr->GetIntDefault("MinQuestScaledXPRatio", 0);
770 {
771 TC_LOG_ERROR("server.loading", "MinQuestScaledXPRatio ({}) must be in range 0..100. Set to 0.", m_int_configs[CONFIG_MIN_QUEST_SCALED_XP_RATIO]);
773 }
774
775 m_int_configs[CONFIG_MIN_CREATURE_SCALED_XP_RATIO] = sConfigMgr->GetIntDefault("MinCreatureScaledXPRatio", 0);
777 {
778 TC_LOG_ERROR("server.loading", "MinCreatureScaledXPRatio ({}) must be in range 0..100. Set to 0.", m_int_configs[CONFIG_MIN_CREATURE_SCALED_XP_RATIO]);
780 }
781
782 m_int_configs[CONFIG_MIN_DISCOVERED_SCALED_XP_RATIO] = sConfigMgr->GetIntDefault("MinDiscoveredScaledXPRatio", 0);
784 {
785 TC_LOG_ERROR("server.loading", "MinDiscoveredScaledXPRatio ({}) must be in range 0..100. Set to 0.", m_int_configs[CONFIG_MIN_DISCOVERED_SCALED_XP_RATIO]);
787 }
788
790 m_float_configs[CONFIG_SIGHT_MONSTER] = sConfigMgr->GetFloatDefault("MonsterSight", 50.0f);
791
792 m_bool_configs[CONFIG_REGEN_HP_CANNOT_REACH_TARGET_IN_RAID] = sConfigMgr->GetBoolDefault("Creature.RegenHPCannotReachTargetInRaid", true);
793
794 if (reload)
795 {
796 uint32 val = sConfigMgr->GetIntDefault("GameType", 0);
798 TC_LOG_ERROR("server.loading", "GameType option can't be changed at worldserver.conf reload, using current value ({}).", m_int_configs[CONFIG_GAME_TYPE]);
799 }
800 else
801 m_int_configs[CONFIG_GAME_TYPE] = sConfigMgr->GetIntDefault("GameType", 0);
802
803 if (reload)
804 {
805 uint32 val = sConfigMgr->GetIntDefault("RealmZone", REALM_ZONE_DEVELOPMENT);
807 TC_LOG_ERROR("server.loading", "RealmZone option can't be changed at worldserver.conf reload, using current value ({}).", m_int_configs[CONFIG_REALM_ZONE]);
808 }
809 else
811
812 m_bool_configs[CONFIG_ALLOW_TWO_SIDE_INTERACTION_CALENDAR]= sConfigMgr->GetBoolDefault("AllowTwoSide.Interaction.Calendar", false);
813 m_bool_configs[CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL] = sConfigMgr->GetBoolDefault("AllowTwoSide.Interaction.Channel", false);
814 m_bool_configs[CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP] = sConfigMgr->GetBoolDefault("AllowTwoSide.Interaction.Group", false);
815 m_bool_configs[CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD] = sConfigMgr->GetBoolDefault("AllowTwoSide.Interaction.Guild", false);
816 m_bool_configs[CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION] = sConfigMgr->GetBoolDefault("AllowTwoSide.Interaction.Auction", false);
817 m_bool_configs[CONFIG_ALLOW_TWO_SIDE_TRADE] = sConfigMgr->GetBoolDefault("AllowTwoSide.Trade", false);
818 m_int_configs[CONFIG_STRICT_PLAYER_NAMES] = sConfigMgr->GetIntDefault ("StrictPlayerNames", 0);
819 m_int_configs[CONFIG_STRICT_CHARTER_NAMES] = sConfigMgr->GetIntDefault ("StrictCharterNames", 0);
820 m_int_configs[CONFIG_STRICT_PET_NAMES] = sConfigMgr->GetIntDefault ("StrictPetNames", 0);
821
822 m_int_configs[CONFIG_MIN_PLAYER_NAME] = sConfigMgr->GetIntDefault ("MinPlayerName", 2);
824 {
825 TC_LOG_ERROR("server.loading", "MinPlayerName ({}) must be in range 1..{}. Set to 2.", m_int_configs[CONFIG_MIN_PLAYER_NAME], MAX_PLAYER_NAME);
827 }
828
829 m_int_configs[CONFIG_MIN_CHARTER_NAME] = sConfigMgr->GetIntDefault ("MinCharterName", 2);
831 {
832 TC_LOG_ERROR("server.loading", "MinCharterName ({}) must be in range 1..{}. Set to 2.", m_int_configs[CONFIG_MIN_CHARTER_NAME], MAX_CHARTER_NAME);
834 }
835
836 m_int_configs[CONFIG_MIN_PET_NAME] = sConfigMgr->GetIntDefault ("MinPetName", 2);
838 {
839 TC_LOG_ERROR("server.loading", "MinPetName ({}) must be in range 1..{}. Set to 2.", m_int_configs[CONFIG_MIN_PET_NAME], MAX_PET_NAME);
841 }
842
843 m_int_configs[CONFIG_CHARTER_COST_GUILD] = sConfigMgr->GetIntDefault("Guild.CharterCost", 1000);
844 m_int_configs[CONFIG_CHARTER_COST_ARENA_2v2] = sConfigMgr->GetIntDefault("ArenaTeam.CharterCost.2v2", 800000);
845 m_int_configs[CONFIG_CHARTER_COST_ARENA_3v3] = sConfigMgr->GetIntDefault("ArenaTeam.CharterCost.3v3", 1200000);
846 m_int_configs[CONFIG_CHARTER_COST_ARENA_5v5] = sConfigMgr->GetIntDefault("ArenaTeam.CharterCost.5v5", 2000000);
847
848 m_int_configs[CONFIG_CHARACTER_CREATING_DISABLED] = sConfigMgr->GetIntDefault("CharacterCreating.Disabled", 0);
849 m_int_configs[CONFIG_CHARACTER_CREATING_DISABLED_RACEMASK] = sConfigMgr->GetIntDefault("CharacterCreating.Disabled.RaceMask", 0);
850 m_int_configs[CONFIG_CHARACTER_CREATING_DISABLED_CLASSMASK] = sConfigMgr->GetIntDefault("CharacterCreating.Disabled.ClassMask", 0);
851
852 m_int_configs[CONFIG_CHARACTERS_PER_REALM] = sConfigMgr->GetIntDefault("CharactersPerRealm", MAX_CHARACTERS_PER_REALM);
854 {
855 TC_LOG_ERROR("server.loading", "CharactersPerRealm ({}) must be in range 1..{}. Set to {}.", m_int_configs[CONFIG_CHARACTERS_PER_REALM], MAX_CHARACTERS_PER_REALM, MAX_CHARACTERS_PER_REALM);
857 }
858
859 // must be after CONFIG_CHARACTERS_PER_REALM
860 m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT] = sConfigMgr->GetIntDefault("CharactersPerAccount", 50);
862 {
863 TC_LOG_ERROR("server.loading", "CharactersPerAccount ({}) can't be less than CharactersPerRealm ({}).", m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT], m_int_configs[CONFIG_CHARACTERS_PER_REALM]);
865 }
866
867 m_int_configs[CONFIG_DEATH_KNIGHTS_PER_REALM] = sConfigMgr->GetIntDefault("DeathKnightsPerRealm", 1);
869 {
870 TC_LOG_ERROR("server.loading", "DeathKnightsPerRealm ({}) must be in range 0..10. Set to 1.", m_int_configs[CONFIG_DEATH_KNIGHTS_PER_REALM]);
872 }
873
874 m_int_configs[CONFIG_CHARACTER_CREATING_MIN_LEVEL_FOR_DEATH_KNIGHT] = sConfigMgr->GetIntDefault("CharacterCreating.MinLevelForDeathKnight", 55);
875
876 m_int_configs[CONFIG_SKIP_CINEMATICS] = sConfigMgr->GetIntDefault("SkipCinematics", 0);
878 {
879 TC_LOG_ERROR("server.loading", "SkipCinematics ({}) must be in range 0..2. Set to 0.", m_int_configs[CONFIG_SKIP_CINEMATICS]);
881 }
882
883 if (reload)
884 {
885 uint32 val = sConfigMgr->GetIntDefault("MaxPlayerLevel", DEFAULT_MAX_LEVEL);
887 TC_LOG_ERROR("server.loading", "MaxPlayerLevel option can't be changed at config reload, using current value ({}).", m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
888 }
889 else
890 m_int_configs[CONFIG_MAX_PLAYER_LEVEL] = sConfigMgr->GetIntDefault("MaxPlayerLevel", DEFAULT_MAX_LEVEL);
891
893 {
894 TC_LOG_ERROR("server.loading", "MaxPlayerLevel ({}) must be in range 1..{}. Set to {}.", m_int_configs[CONFIG_MAX_PLAYER_LEVEL], MAX_LEVEL, MAX_LEVEL);
896 }
897
898 m_int_configs[CONFIG_MIN_DUALSPEC_LEVEL] = sConfigMgr->GetIntDefault("MinDualSpecLevel", 40);
899
900 m_int_configs[CONFIG_START_PLAYER_LEVEL] = sConfigMgr->GetIntDefault("StartPlayerLevel", 1);
902 {
903 TC_LOG_ERROR("server.loading", "StartPlayerLevel ({}) must be in range 1..MaxPlayerLevel({}). Set to 1.", m_int_configs[CONFIG_START_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
905 }
907 {
908 TC_LOG_ERROR("server.loading", "StartPlayerLevel ({}) must be in range 1..MaxPlayerLevel({}). Set to {}.", m_int_configs[CONFIG_START_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
910 }
911
912 m_int_configs[CONFIG_START_DEATH_KNIGHT_PLAYER_LEVEL] = sConfigMgr->GetIntDefault("StartDeathKnightPlayerLevel", 55);
914 {
915 TC_LOG_ERROR("server.loading", "StartDeathKnightPlayerLevel ({}) must be in range 1..MaxPlayerLevel({}). Set to 55.",
918 }
920 {
921 TC_LOG_ERROR("server.loading", "StartDeathKnightPlayerLevel ({}) must be in range 1..MaxPlayerLevel({}). Set to {}.",
924 }
925
926 m_int_configs[CONFIG_START_PLAYER_MONEY] = sConfigMgr->GetIntDefault("StartPlayerMoney", 0);
928 {
929 TC_LOG_ERROR("server.loading", "StartPlayerMoney ({}) must be in range 0..{}. Set to {}.", m_int_configs[CONFIG_START_PLAYER_MONEY], MAX_MONEY_AMOUNT, 0);
931 }
933 {
934 TC_LOG_ERROR("server.loading", "StartPlayerMoney ({}) must be in range 0..{}. Set to {}.",
937 }
938
939 m_int_configs[CONFIG_START_DEATH_KNIGHT_PLAYER_MONEY] = sConfigMgr->GetIntDefault("StartDeathKnightPlayerMoney", 2000);
941 {
942 TC_LOG_ERROR("server.loading", "StartDeathKnightPlayerMoney ({}) must be in range 0..{}. Set to {}.", m_int_configs[CONFIG_START_DEATH_KNIGHT_PLAYER_MONEY], MAX_MONEY_AMOUNT, 2000);
944 }
946 {
947 TC_LOG_ERROR("server.loading", "StartDeathKnightPlayerMoney ({}) must be in range 0..{}. Set to {}.",
950 }
951
952 m_int_configs[CONFIG_MAX_HONOR_POINTS] = sConfigMgr->GetIntDefault("MaxHonorPoints", 75000);
954 {
955 TC_LOG_ERROR("server.loading", "MaxHonorPoints ({}) can't be negative. Set to 0.", m_int_configs[CONFIG_MAX_HONOR_POINTS]);
957 }
958
959 m_int_configs[CONFIG_START_HONOR_POINTS] = sConfigMgr->GetIntDefault("StartHonorPoints", 0);
961 {
962 TC_LOG_ERROR("server.loading", "StartHonorPoints ({}) must be in range 0..MaxHonorPoints({}). Set to {}.",
965 }
967 {
968 TC_LOG_ERROR("server.loading", "StartHonorPoints ({}) must be in range 0..MaxHonorPoints({}). Set to {}.",
971 }
972
973 m_int_configs[CONFIG_MAX_ARENA_POINTS] = sConfigMgr->GetIntDefault("MaxArenaPoints", 10000);
975 {
976 TC_LOG_ERROR("server.loading", "MaxArenaPoints ({}) can't be negative. Set to 0.", m_int_configs[CONFIG_MAX_ARENA_POINTS]);
978 }
979
980 m_int_configs[CONFIG_START_ARENA_POINTS] = sConfigMgr->GetIntDefault("StartArenaPoints", 0);
982 {
983 TC_LOG_ERROR("server.loading", "StartArenaPoints ({}) must be in range 0..MaxArenaPoints({}). Set to {}.",
986 }
988 {
989 TC_LOG_ERROR("server.loading", "StartArenaPoints ({}) must be in range 0..MaxArenaPoints({}). Set to {}.",
992 }
993
994 m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL] = sConfigMgr->GetIntDefault("RecruitAFriend.MaxLevel", 60);
996 {
997 TC_LOG_ERROR("server.loading", "RecruitAFriend.MaxLevel ({}) must be in the range 0..MaxLevel({}). Set to {}.",
1000 }
1001
1002 m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL_DIFFERENCE] = sConfigMgr->GetIntDefault("RecruitAFriend.MaxDifference", 4);
1003 m_bool_configs[CONFIG_ALL_TAXI_PATHS] = sConfigMgr->GetBoolDefault("AllFlightPaths", false);
1004 m_bool_configs[CONFIG_INSTANT_TAXI] = sConfigMgr->GetBoolDefault("InstantFlightPaths", false);
1005
1006 m_bool_configs[CONFIG_INSTANCE_IGNORE_LEVEL] = sConfigMgr->GetBoolDefault("Instance.IgnoreLevel", false);
1007 m_bool_configs[CONFIG_INSTANCE_IGNORE_RAID] = sConfigMgr->GetBoolDefault("Instance.IgnoreRaid", false);
1008
1009 m_bool_configs[CONFIG_CAST_UNSTUCK] = sConfigMgr->GetBoolDefault("CastUnstuck", true);
1010 m_int_configs[CONFIG_INSTANCE_RESET_TIME_HOUR] = sConfigMgr->GetIntDefault("Instance.ResetTimeHour", 4);
1011 m_int_configs[CONFIG_INSTANCE_UNLOAD_DELAY] = sConfigMgr->GetIntDefault("Instance.UnloadDelay", 30 * MINUTE * IN_MILLISECONDS);
1012
1013 m_int_configs[CONFIG_DAILY_QUEST_RESET_TIME_HOUR] = sConfigMgr->GetIntDefault("Quests.DailyResetTime", 3);
1015 {
1016 TC_LOG_ERROR("server.loading", "Quests.DailyResetTime ({}) must be in range 0..23. Set to 3.", m_int_configs[CONFIG_DAILY_QUEST_RESET_TIME_HOUR]);
1018 }
1019
1020 m_int_configs[CONFIG_WEEKLY_QUEST_RESET_TIME_WDAY] = sConfigMgr->GetIntDefault("Quests.WeeklyResetWDay", 3);
1022 {
1023 TC_LOG_ERROR("server.loading", "Quests.WeeklyResetDay ({}) must be in range 0..6. Set to 3 (Wednesday).", m_int_configs[CONFIG_WEEKLY_QUEST_RESET_TIME_WDAY]);
1025 }
1026
1027 m_int_configs[CONFIG_MAX_PRIMARY_TRADE_SKILL] = sConfigMgr->GetIntDefault("MaxPrimaryTradeSkill", 2);
1028 m_int_configs[CONFIG_MIN_PETITION_SIGNS] = sConfigMgr->GetIntDefault("MinPetitionSigns", 9);
1030 {
1031 TC_LOG_ERROR("server.loading", "MinPetitionSigns ({}) must be in range 0..9. Set to 9.", m_int_configs[CONFIG_MIN_PETITION_SIGNS]);
1033 }
1034
1035 m_int_configs[CONFIG_GM_LOGIN_STATE] = sConfigMgr->GetIntDefault("GM.LoginState", 2);
1036 m_int_configs[CONFIG_GM_VISIBLE_STATE] = sConfigMgr->GetIntDefault("GM.Visible", 2);
1037 m_int_configs[CONFIG_GM_CHAT] = sConfigMgr->GetIntDefault("GM.Chat", 2);
1038 m_int_configs[CONFIG_GM_WHISPERING_TO] = sConfigMgr->GetIntDefault("GM.WhisperingTo", 2);
1039 m_int_configs[CONFIG_GM_FREEZE_DURATION] = sConfigMgr->GetIntDefault("GM.FreezeAuraDuration", 0);
1040
1041 m_int_configs[CONFIG_GM_LEVEL_IN_GM_LIST] = sConfigMgr->GetIntDefault("GM.InGMList.Level", SEC_ADMINISTRATOR);
1042 m_int_configs[CONFIG_GM_LEVEL_IN_WHO_LIST] = sConfigMgr->GetIntDefault("GM.InWhoList.Level", SEC_ADMINISTRATOR);
1043 m_int_configs[CONFIG_START_GM_LEVEL] = sConfigMgr->GetIntDefault("GM.StartLevel", 1);
1045 {
1046 TC_LOG_ERROR("server.loading", "GM.StartLevel ({}) must be in range StartPlayerLevel({})..{}. Set to {}.",
1049 }
1051 {
1052 TC_LOG_ERROR("server.loading", "GM.StartLevel ({}) must be in range 1..{}. Set to {}.", m_int_configs[CONFIG_START_GM_LEVEL], MAX_LEVEL, MAX_LEVEL);
1054 }
1055 m_bool_configs[CONFIG_ALLOW_GM_GROUP] = sConfigMgr->GetBoolDefault("GM.AllowInvite", false);
1056 m_bool_configs[CONFIG_GM_LOWER_SECURITY] = sConfigMgr->GetBoolDefault("GM.LowerSecurity", false);
1057 m_float_configs[CONFIG_CHANCE_OF_GM_SURVEY] = sConfigMgr->GetFloatDefault("GM.TicketSystem.ChanceOfGMSurvey", 50.0f);
1058 m_int_configs[CONFIG_FORCE_SHUTDOWN_THRESHOLD] = sConfigMgr->GetIntDefault("GM.ForceShutdownThreshold", 30);
1059
1060 m_int_configs[CONFIG_GROUP_VISIBILITY] = sConfigMgr->GetIntDefault("Visibility.GroupMode", 1);
1061
1062 m_int_configs[CONFIG_MAIL_DELIVERY_DELAY] = sConfigMgr->GetIntDefault("MailDeliveryDelay", HOUR);
1063 m_int_configs[CONFIG_CLEAN_OLD_MAIL_TIME] = sConfigMgr->GetIntDefault("CleanOldMailTime", 4);
1065 {
1066 TC_LOG_ERROR("server.loading", "CleanOldMailTime ({}) must be an hour, between 0 and 23. Set to 4.", m_int_configs[CONFIG_CLEAN_OLD_MAIL_TIME]);
1068 }
1069
1070 m_int_configs[CONFIG_UPTIME_UPDATE] = sConfigMgr->GetIntDefault("UpdateUptimeInterval", 10);
1072 {
1073 TC_LOG_ERROR("server.loading", "UpdateUptimeInterval ({}) must be > 0, set to default 10.", m_int_configs[CONFIG_UPTIME_UPDATE]);
1075 }
1076 if (reload)
1077 {
1080 }
1081
1082 // log db cleanup interval
1083 m_int_configs[CONFIG_LOGDB_CLEARINTERVAL] = sConfigMgr->GetIntDefault("LogDB.Opt.ClearInterval", 10);
1085 {
1086 TC_LOG_ERROR("server.loading", "LogDB.Opt.ClearInterval ({}) must be > 0, set to default 10.", m_int_configs[CONFIG_LOGDB_CLEARINTERVAL]);
1088 }
1089 if (reload)
1090 {
1093 }
1094 m_int_configs[CONFIG_LOGDB_CLEARTIME] = sConfigMgr->GetIntDefault("LogDB.Opt.ClearTime", 1209600); // 14 days default
1095 TC_LOG_INFO("server.loading", "Will clear `logs` table of entries older than {} seconds every {} minutes.",
1097
1098 m_int_configs[CONFIG_SKILL_CHANCE_ORANGE] = sConfigMgr->GetIntDefault("SkillChance.Orange", 100);
1099 m_int_configs[CONFIG_SKILL_CHANCE_YELLOW] = sConfigMgr->GetIntDefault("SkillChance.Yellow", 75);
1100 m_int_configs[CONFIG_SKILL_CHANCE_GREEN] = sConfigMgr->GetIntDefault("SkillChance.Green", 25);
1101 m_int_configs[CONFIG_SKILL_CHANCE_GREY] = sConfigMgr->GetIntDefault("SkillChance.Grey", 0);
1102
1103 m_int_configs[CONFIG_SKILL_CHANCE_MINING_STEPS] = sConfigMgr->GetIntDefault("SkillChance.MiningSteps", 75);
1104 m_int_configs[CONFIG_SKILL_CHANCE_SKINNING_STEPS] = sConfigMgr->GetIntDefault("SkillChance.SkinningSteps", 75);
1105
1106 m_bool_configs[CONFIG_SKILL_PROSPECTING] = sConfigMgr->GetBoolDefault("SkillChance.Prospecting", false);
1107 m_bool_configs[CONFIG_SKILL_MILLING] = sConfigMgr->GetBoolDefault("SkillChance.Milling", false);
1108
1109 m_int_configs[CONFIG_SKILL_GAIN_CRAFTING] = sConfigMgr->GetIntDefault("SkillGain.Crafting", 1);
1110
1111 m_int_configs[CONFIG_SKILL_GAIN_DEFENSE] = sConfigMgr->GetIntDefault("SkillGain.Defense", 1);
1112
1113 m_int_configs[CONFIG_SKILL_GAIN_GATHERING] = sConfigMgr->GetIntDefault("SkillGain.Gathering", 1);
1114
1115 m_int_configs[CONFIG_SKILL_GAIN_WEAPON] = sConfigMgr->GetIntDefault("SkillGain.Weapon", 1);
1116
1117 m_int_configs[CONFIG_MAX_OVERSPEED_PINGS] = sConfigMgr->GetIntDefault("MaxOverspeedPings", 2);
1119 {
1120 TC_LOG_ERROR("server.loading", "MaxOverspeedPings ({}) must be in range 2..infinity (or 0 to disable check). Set to 2.", m_int_configs[CONFIG_MAX_OVERSPEED_PINGS]);
1122 }
1123
1124 m_bool_configs[CONFIG_WEATHER] = sConfigMgr->GetBoolDefault("ActivateWeather", true);
1125
1126 m_int_configs[CONFIG_DISABLE_BREATHING] = sConfigMgr->GetIntDefault("DisableWaterBreath", SEC_CONSOLE);
1127
1128 m_bool_configs[CONFIG_ALWAYS_MAX_SKILL_FOR_LEVEL] = sConfigMgr->GetBoolDefault("AlwaysMaxSkillForLevel", false);
1129
1130 if (reload)
1131 {
1132 uint32 val = sConfigMgr->GetIntDefault("Expansion", 2);
1133 if (val != m_int_configs[CONFIG_EXPANSION])
1134 TC_LOG_ERROR("server.loading", "Expansion option can't be changed at worldserver.conf reload, using current value ({}).", m_int_configs[CONFIG_EXPANSION]);
1135 }
1136 else
1137 m_int_configs[CONFIG_EXPANSION] = sConfigMgr->GetIntDefault("Expansion", 2);
1138
1139 m_int_configs[CONFIG_CHATFLOOD_MESSAGE_COUNT] = sConfigMgr->GetIntDefault("ChatFlood.MessageCount", 10);
1140 m_int_configs[CONFIG_CHATFLOOD_MESSAGE_DELAY] = sConfigMgr->GetIntDefault("ChatFlood.MessageDelay", 1);
1141 m_int_configs[CONFIG_CHATFLOOD_ADDON_MESSAGE_COUNT] = sConfigMgr->GetIntDefault("ChatFlood.AddonMessageCount", 100);
1142 m_int_configs[CONFIG_CHATFLOOD_ADDON_MESSAGE_DELAY] = sConfigMgr->GetIntDefault("ChatFlood.AddonMessageDelay", 1);
1143 m_int_configs[CONFIG_CHATFLOOD_MUTE_TIME] = sConfigMgr->GetIntDefault("ChatFlood.MuteTime", 10);
1144
1145 m_bool_configs[CONFIG_EVENT_ANNOUNCE] = sConfigMgr->GetBoolDefault("Event.Announce", false);
1146
1147 m_float_configs[CONFIG_CREATURE_FAMILY_FLEE_ASSISTANCE_RADIUS] = sConfigMgr->GetFloatDefault("CreatureFamilyFleeAssistanceRadius", 30.0f);
1148 m_float_configs[CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS] = sConfigMgr->GetFloatDefault("CreatureFamilyAssistanceRadius", 10.0f);
1149 m_int_configs[CONFIG_CREATURE_FAMILY_ASSISTANCE_DELAY] = sConfigMgr->GetIntDefault("CreatureFamilyAssistanceDelay", 1500);
1150 m_int_configs[CONFIG_CREATURE_FAMILY_FLEE_DELAY] = sConfigMgr->GetIntDefault("CreatureFamilyFleeDelay", 7000);
1151
1152 m_int_configs[CONFIG_WORLD_BOSS_LEVEL_DIFF] = sConfigMgr->GetIntDefault("WorldBossLevelDiff", 3);
1153
1154 m_bool_configs[CONFIG_QUEST_ENABLE_QUEST_TRACKER] = sConfigMgr->GetBoolDefault("Quests.EnableQuestTracker", false);
1155
1156 // note: disable value (-1) will assigned as 0xFFFFFFF, to prevent overflow at calculations limit it to max possible player level MAX_LEVEL(100)
1157 m_int_configs[CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF] = sConfigMgr->GetIntDefault("Quests.LowLevelHideDiff", 4);
1160 m_int_configs[CONFIG_QUEST_HIGH_LEVEL_HIDE_DIFF] = sConfigMgr->GetIntDefault("Quests.HighLevelHideDiff", 7);
1163 m_bool_configs[CONFIG_QUEST_IGNORE_RAID] = sConfigMgr->GetBoolDefault("Quests.IgnoreRaid", false);
1164 m_bool_configs[CONFIG_QUEST_IGNORE_AUTO_ACCEPT] = sConfigMgr->GetBoolDefault("Quests.IgnoreAutoAccept", false);
1165 m_bool_configs[CONFIG_QUEST_IGNORE_AUTO_COMPLETE] = sConfigMgr->GetBoolDefault("Quests.IgnoreAutoComplete", false);
1166
1167 m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR] = sConfigMgr->GetIntDefault("Battleground.Random.ResetHour", 6);
1169 {
1170 TC_LOG_ERROR("server.loading", "Battleground.Random.ResetHour ({}) can't be load. Set to 6.", m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR]);
1172 }
1173
1174 m_int_configs[CONFIG_CALENDAR_DELETE_OLD_EVENTS_HOUR] = sConfigMgr->GetIntDefault("Calendar.DeleteOldEventsHour", 6);
1176 {
1177 TC_LOG_ERROR("misc", "Calendar.DeleteOldEventsHour ({}) can't be load. Set to 6.", m_int_configs[CONFIG_CALENDAR_DELETE_OLD_EVENTS_HOUR]);
1179 }
1180
1181 m_int_configs[CONFIG_GUILD_RESET_HOUR] = sConfigMgr->GetIntDefault("Guild.ResetHour", 6);
1183 {
1184 TC_LOG_ERROR("misc", "Guild.ResetHour ({}) can't be load. Set to 6.", m_int_configs[CONFIG_GUILD_RESET_HOUR]);
1186 }
1187
1188 m_bool_configs[CONFIG_DETECT_POS_COLLISION] = sConfigMgr->GetBoolDefault("DetectPosCollision", true);
1189
1190 m_bool_configs[CONFIG_RESTRICTED_LFG_CHANNEL] = sConfigMgr->GetBoolDefault("Channel.RestrictedLfg", true);
1191 m_int_configs[CONFIG_TALENTS_INSPECTING] = sConfigMgr->GetIntDefault("TalentsInspecting", 1);
1192 m_bool_configs[CONFIG_CHAT_FAKE_MESSAGE_PREVENTING] = sConfigMgr->GetBoolDefault("ChatFakeMessagePreventing", false);
1193 m_int_configs[CONFIG_CHAT_STRICT_LINK_CHECKING_SEVERITY] = sConfigMgr->GetIntDefault("ChatStrictLinkChecking.Severity", 0);
1194 m_int_configs[CONFIG_CHAT_STRICT_LINK_CHECKING_KICK] = sConfigMgr->GetIntDefault("ChatStrictLinkChecking.Kick", 0);
1195
1196 m_int_configs[CONFIG_CORPSE_DECAY_NORMAL] = sConfigMgr->GetIntDefault("Corpse.Decay.NORMAL", 60);
1197 m_int_configs[CONFIG_CORPSE_DECAY_RARE] = sConfigMgr->GetIntDefault("Corpse.Decay.RARE", 300);
1198 m_int_configs[CONFIG_CORPSE_DECAY_ELITE] = sConfigMgr->GetIntDefault("Corpse.Decay.ELITE", 300);
1199 m_int_configs[CONFIG_CORPSE_DECAY_RAREELITE] = sConfigMgr->GetIntDefault("Corpse.Decay.RAREELITE", 300);
1200 m_int_configs[CONFIG_CORPSE_DECAY_WORLDBOSS] = sConfigMgr->GetIntDefault("Corpse.Decay.WORLDBOSS", 3600);
1201
1202 m_int_configs[CONFIG_DEATH_SICKNESS_LEVEL] = sConfigMgr->GetIntDefault ("Death.SicknessLevel", 11);
1203 m_bool_configs[CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP] = sConfigMgr->GetBoolDefault("Death.CorpseReclaimDelay.PvP", true);
1204 m_bool_configs[CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE] = sConfigMgr->GetBoolDefault("Death.CorpseReclaimDelay.PvE", true);
1205 m_bool_configs[CONFIG_DEATH_BONES_WORLD] = sConfigMgr->GetBoolDefault("Death.Bones.World", true);
1206 m_bool_configs[CONFIG_DEATH_BONES_BG_OR_ARENA] = sConfigMgr->GetBoolDefault("Death.Bones.BattlegroundOrArena", true);
1207
1208 m_bool_configs[CONFIG_DIE_COMMAND_MODE] = sConfigMgr->GetBoolDefault("Die.Command.Mode", true);
1209
1210 m_float_configs[CONFIG_THREAT_RADIUS] = sConfigMgr->GetFloatDefault("ThreatRadius", 60.0f);
1211
1212 // always use declined names in the russian client
1214 (m_int_configs[CONFIG_REALM_ZONE] == REALM_ZONE_RUSSIAN) ? true : sConfigMgr->GetBoolDefault("DeclinedNames", false);
1215
1216 m_float_configs[CONFIG_LISTEN_RANGE_SAY] = sConfigMgr->GetFloatDefault("ListenRange.Say", 25.0f);
1217 m_float_configs[CONFIG_LISTEN_RANGE_TEXTEMOTE] = sConfigMgr->GetFloatDefault("ListenRange.TextEmote", 25.0f);
1218 m_float_configs[CONFIG_LISTEN_RANGE_YELL] = sConfigMgr->GetFloatDefault("ListenRange.Yell", 300.0f);
1219
1220 m_bool_configs[CONFIG_BATTLEGROUND_CAST_DESERTER] = sConfigMgr->GetBoolDefault("Battleground.CastDeserter", true);
1221 m_bool_configs[CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE] = sConfigMgr->GetBoolDefault("Battleground.QueueAnnouncer.Enable", false);
1222 m_bool_configs[CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY] = sConfigMgr->GetBoolDefault("Battleground.QueueAnnouncer.PlayerOnly", false);
1223 m_bool_configs[CONFIG_BATTLEGROUND_STORE_STATISTICS_ENABLE] = sConfigMgr->GetBoolDefault("Battleground.StoreStatistics.Enable", false);
1224 m_bool_configs[CONFIG_BATTLEGROUND_TRACK_DESERTERS] = sConfigMgr->GetBoolDefault("Battleground.TrackDeserters.Enable", false);
1225 m_int_configs[CONFIG_BATTLEGROUND_REPORT_AFK] = sConfigMgr->GetIntDefault("Battleground.ReportAFK", 3);
1227 {
1228 TC_LOG_ERROR("server.loading", "Battleground.ReportAFK ({}) must be >0. Using 3 instead.", m_int_configs[CONFIG_BATTLEGROUND_REPORT_AFK]);
1230 }
1232 {
1233 TC_LOG_ERROR("server.loading", "Battleground.ReportAFK ({}) must be <10. Using 3 instead.", m_int_configs[CONFIG_BATTLEGROUND_REPORT_AFK]);
1235 }
1236 m_int_configs[CONFIG_BATTLEGROUND_INVITATION_TYPE] = sConfigMgr->GetIntDefault ("Battleground.InvitationType", 0);
1237 m_int_configs[CONFIG_BATTLEGROUND_PREMATURE_FINISH_TIMER] = sConfigMgr->GetIntDefault ("Battleground.PrematureFinishTimer", 5 * MINUTE * IN_MILLISECONDS);
1238 m_int_configs[CONFIG_BATTLEGROUND_PREMADE_GROUP_WAIT_FOR_MATCH] = sConfigMgr->GetIntDefault ("Battleground.PremadeGroupWaitForMatch", 30 * MINUTE * IN_MILLISECONDS);
1239 m_bool_configs[CONFIG_BG_XP_FOR_KILL] = sConfigMgr->GetBoolDefault("Battleground.GiveXPForKills", false);
1240 m_int_configs[CONFIG_ARENA_MAX_RATING_DIFFERENCE] = sConfigMgr->GetIntDefault ("Arena.MaxRatingDifference", 150);
1241 m_int_configs[CONFIG_ARENA_RATING_DISCARD_TIMER] = sConfigMgr->GetIntDefault ("Arena.RatingDiscardTimer", 10 * MINUTE * IN_MILLISECONDS);
1242 m_int_configs[CONFIG_ARENA_PREV_OPPONENTS_DISCARD_TIMER] = sConfigMgr->GetIntDefault ("Arena.PreviousOpponentsDiscardTimer", 2 * MINUTE * IN_MILLISECONDS);
1243 m_int_configs[CONFIG_ARENA_RATED_UPDATE_TIMER] = sConfigMgr->GetIntDefault ("Arena.RatedUpdateTimer", 5 * IN_MILLISECONDS);
1244 m_bool_configs[CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS] = sConfigMgr->GetBoolDefault("Arena.AutoDistributePoints", false);
1245 m_int_configs[CONFIG_ARENA_AUTO_DISTRIBUTE_INTERVAL_DAYS] = sConfigMgr->GetIntDefault ("Arena.AutoDistributeInterval", 7);
1246 m_bool_configs[CONFIG_ARENA_QUEUE_ANNOUNCER_ENABLE] = sConfigMgr->GetBoolDefault("Arena.QueueAnnouncer.Enable", false);
1247 m_int_configs[CONFIG_ARENA_SEASON_ID] = sConfigMgr->GetIntDefault ("Arena.ArenaSeason.ID", 1);
1248 m_int_configs[CONFIG_ARENA_START_RATING] = sConfigMgr->GetIntDefault ("Arena.ArenaStartRating", 0);
1249 m_int_configs[CONFIG_ARENA_START_PERSONAL_RATING] = sConfigMgr->GetIntDefault ("Arena.ArenaStartPersonalRating", 1000);
1250 m_int_configs[CONFIG_ARENA_START_MATCHMAKER_RATING] = sConfigMgr->GetIntDefault ("Arena.ArenaStartMatchmakerRating", 1500);
1251 m_bool_configs[CONFIG_ARENA_SEASON_IN_PROGRESS] = sConfigMgr->GetBoolDefault("Arena.ArenaSeason.InProgress", true);
1252 m_bool_configs[CONFIG_ARENA_LOG_EXTENDED_INFO] = sConfigMgr->GetBoolDefault("ArenaLog.ExtendedInfo", false);
1253 m_float_configs[CONFIG_ARENA_WIN_RATING_MODIFIER_1] = sConfigMgr->GetFloatDefault("Arena.ArenaWinRatingModifier1", 48.0f);
1254 m_float_configs[CONFIG_ARENA_WIN_RATING_MODIFIER_2] = sConfigMgr->GetFloatDefault("Arena.ArenaWinRatingModifier2", 24.0f);
1255 m_float_configs[CONFIG_ARENA_LOSE_RATING_MODIFIER] = sConfigMgr->GetFloatDefault("Arena.ArenaLoseRatingModifier", 24.0f);
1256 m_float_configs[CONFIG_ARENA_MATCHMAKER_RATING_MODIFIER] = sConfigMgr->GetFloatDefault("Arena.ArenaMatchmakerRatingModifier", 24.0f);
1257
1258 m_bool_configs[CONFIG_OFFHAND_CHECK_AT_SPELL_UNLEARN] = sConfigMgr->GetBoolDefault("OffhandCheckAtSpellUnlearn", true);
1259
1260 m_int_configs[CONFIG_CREATURE_PICKPOCKET_REFILL] = sConfigMgr->GetIntDefault("Creature.PickPocketRefillDelay", 10 * MINUTE);
1261 m_int_configs[CONFIG_CREATURE_STOP_FOR_PLAYER] = sConfigMgr->GetIntDefault("Creature.MovingStopTimeForPlayer", 3 * MINUTE * IN_MILLISECONDS);
1262
1263 if (int32 clientCacheId = sConfigMgr->GetIntDefault("ClientCacheVersion", 0))
1264 {
1265 // overwrite DB/old value
1266 if (clientCacheId > 0)
1268 else
1269 TC_LOG_ERROR("server.loading", "ClientCacheVersion can't be negative {}, ignored.", clientCacheId);
1270 }
1271 TC_LOG_INFO("server.loading", "Client cache version set to: {}", m_int_configs[CONFIG_CLIENTCACHE_VERSION]);
1272
1273 m_int_configs[CONFIG_GUILD_EVENT_LOG_COUNT] = sConfigMgr->GetIntDefault("Guild.EventLogRecordsCount", GUILD_EVENTLOG_MAX_RECORDS);
1276 m_int_configs[CONFIG_GUILD_BANK_EVENT_LOG_COUNT] = sConfigMgr->GetIntDefault("Guild.BankEventLogRecordsCount", GUILD_BANKLOG_MAX_RECORDS);
1279
1280 // visibility on continents
1281 m_MaxVisibleDistanceOnContinents = sConfigMgr->GetFloatDefault("Visibility.Distance.Continents", DEFAULT_VISIBILITY_DISTANCE);
1282 if (m_MaxVisibleDistanceOnContinents < 45*sWorld->getRate(RATE_CREATURE_AGGRO))
1283 {
1284 TC_LOG_ERROR("server.loading", "Visibility.Distance.Continents can't be less max aggro radius {}", 45*sWorld->getRate(RATE_CREATURE_AGGRO));
1286 }
1288 {
1289 TC_LOG_ERROR("server.loading", "Visibility.Distance.Continents can't be greater {}", MAX_VISIBILITY_DISTANCE);
1291 }
1292
1293 // visibility in instances
1294 m_MaxVisibleDistanceInInstances = sConfigMgr->GetFloatDefault("Visibility.Distance.Instances", DEFAULT_VISIBILITY_INSTANCE);
1295 if (m_MaxVisibleDistanceInInstances < 45*sWorld->getRate(RATE_CREATURE_AGGRO))
1296 {
1297 TC_LOG_ERROR("server.loading", "Visibility.Distance.Instances can't be less max aggro radius {}", 45*sWorld->getRate(RATE_CREATURE_AGGRO));
1299 }
1301 {
1302 TC_LOG_ERROR("server.loading", "Visibility.Distance.Instances can't be greater {}", MAX_VISIBILITY_DISTANCE);
1304 }
1305
1306 // visibility in BG
1307 m_MaxVisibleDistanceInBG = sConfigMgr->GetFloatDefault("Visibility.Distance.BG", DEFAULT_VISIBILITY_BGARENAS);
1308 if (m_MaxVisibleDistanceInBG < 45*sWorld->getRate(RATE_CREATURE_AGGRO))
1309 {
1310 TC_LOG_ERROR("server.loading", "Visibility.Distance.BG can't be less max aggro radius {}", 45*sWorld->getRate(RATE_CREATURE_AGGRO));
1312 }
1314 {
1315 TC_LOG_ERROR("server.loading", "Visibility.Distance.BG can't be greater {}", MAX_VISIBILITY_DISTANCE);
1317 }
1318
1319 // Visibility in Arenas
1320 m_MaxVisibleDistanceInArenas = sConfigMgr->GetFloatDefault("Visibility.Distance.Arenas", DEFAULT_VISIBILITY_BGARENAS);
1321 if (m_MaxVisibleDistanceInArenas < 45*sWorld->getRate(RATE_CREATURE_AGGRO))
1322 {
1323 TC_LOG_ERROR("server.loading", "Visibility.Distance.Arenas can't be less max aggro radius {}", 45*sWorld->getRate(RATE_CREATURE_AGGRO));
1325 }
1327 {
1328 TC_LOG_ERROR("server.loading", "Visibility.Distance.Arenas can't be greater {}", MAX_VISIBILITY_DISTANCE);
1330 }
1331
1332 m_visibility_notify_periodOnContinents = sConfigMgr->GetIntDefault("Visibility.Notify.Period.OnContinents", DEFAULT_VISIBILITY_NOTIFY_PERIOD);
1333 m_visibility_notify_periodInInstances = sConfigMgr->GetIntDefault("Visibility.Notify.Period.InInstances", DEFAULT_VISIBILITY_NOTIFY_PERIOD);
1334 m_visibility_notify_periodInBG = sConfigMgr->GetIntDefault("Visibility.Notify.Period.InBG", DEFAULT_VISIBILITY_NOTIFY_PERIOD);
1335 m_visibility_notify_periodInArenas = sConfigMgr->GetIntDefault("Visibility.Notify.Period.InArenas", DEFAULT_VISIBILITY_NOTIFY_PERIOD);
1336
1338 m_int_configs[CONFIG_CHARDELETE_METHOD] = sConfigMgr->GetIntDefault("CharDelete.Method", 0);
1339 m_int_configs[CONFIG_CHARDELETE_MIN_LEVEL] = sConfigMgr->GetIntDefault("CharDelete.MinLevel", 0);
1340 m_int_configs[CONFIG_CHARDELETE_DEATH_KNIGHT_MIN_LEVEL] = sConfigMgr->GetIntDefault("CharDelete.DeathKnight.MinLevel", 0);
1341 m_int_configs[CONFIG_CHARDELETE_KEEP_DAYS] = sConfigMgr->GetIntDefault("CharDelete.KeepDays", 30);
1342
1343 // No aggro from gray mobs
1344 m_int_configs[CONFIG_NO_GRAY_AGGRO_ABOVE] = sConfigMgr->GetIntDefault("NoGrayAggro.Above", 0);
1345 m_int_configs[CONFIG_NO_GRAY_AGGRO_BELOW] = sConfigMgr->GetIntDefault("NoGrayAggro.Below", 0);
1347 {
1348 TC_LOG_ERROR("server.loading", "NoGrayAggro.Above ({}) must be in range 0..{}. Set to {}.", m_int_configs[CONFIG_NO_GRAY_AGGRO_ABOVE], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
1350 }
1352 {
1353 TC_LOG_ERROR("server.loading", "NoGrayAggro.Below ({}) must be in range 0..{}. Set to {}.", m_int_configs[CONFIG_NO_GRAY_AGGRO_BELOW], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
1355 }
1357 {
1358 TC_LOG_ERROR("server.loading", "NoGrayAggro.Below ({}) cannot be greater than NoGrayAggro.Above ({}). Set to {}.", m_int_configs[CONFIG_NO_GRAY_AGGRO_BELOW], m_int_configs[CONFIG_NO_GRAY_AGGRO_ABOVE], m_int_configs[CONFIG_NO_GRAY_AGGRO_ABOVE]);
1360 }
1361
1362 // Respawn Settings
1363 m_int_configs[CONFIG_RESPAWN_MINCHECKINTERVALMS] = sConfigMgr->GetIntDefault("Respawn.MinCheckIntervalMS", 5000);
1364 m_int_configs[CONFIG_RESPAWN_DYNAMICMODE] = sConfigMgr->GetIntDefault("Respawn.DynamicMode", 0);
1366 {
1367 TC_LOG_ERROR("server.loading", "Invalid value for Respawn.DynamicMode ({}). Set to 0.", m_int_configs[CONFIG_RESPAWN_DYNAMICMODE]);
1369 }
1370 m_bool_configs[CONFIG_RESPAWN_DYNAMIC_ESCORTNPC] = sConfigMgr->GetBoolDefault("Respawn.DynamicEscortNPC", false);
1371 m_int_configs[CONFIG_RESPAWN_GUIDWARNLEVEL] = sConfigMgr->GetIntDefault("Respawn.GuidWarnLevel", 12000000);
1373 {
1374 TC_LOG_ERROR("server.loading", "Respawn.GuidWarnLevel ({}) cannot be greater than maximum GUID (16777215). Set to 12000000.", m_int_configs[CONFIG_RESPAWN_GUIDWARNLEVEL]);
1376 }
1377 m_int_configs[CONFIG_RESPAWN_GUIDALERTLEVEL] = sConfigMgr->GetIntDefault("Respawn.GuidAlertLevel", 16000000);
1379 {
1380 TC_LOG_ERROR("server.loading", "Respawn.GuidWarnLevel ({}) cannot be greater than maximum GUID (16777215). Set to 16000000.", m_int_configs[CONFIG_RESPAWN_GUIDALERTLEVEL]);
1382 }
1383 m_int_configs[CONFIG_RESPAWN_RESTARTQUIETTIME] = sConfigMgr->GetIntDefault("Respawn.RestartQuietTime", 3);
1385 {
1386 TC_LOG_ERROR("server.loading", "Respawn.RestartQuietTime ({}) must be an hour, between 0 and 23. Set to 3.", m_int_configs[CONFIG_RESPAWN_RESTARTQUIETTIME]);
1388 }
1389 m_float_configs[CONFIG_RESPAWN_DYNAMICRATE_CREATURE] = sConfigMgr->GetFloatDefault("Respawn.DynamicRateCreature", 10.0f);
1391 {
1392 TC_LOG_ERROR("server.loading", "Respawn.DynamicRateCreature ({}) must be positive. Set to 10.", m_float_configs[CONFIG_RESPAWN_DYNAMICRATE_CREATURE]);
1394 }
1395 m_int_configs[CONFIG_RESPAWN_DYNAMICMINIMUM_CREATURE] = sConfigMgr->GetIntDefault("Respawn.DynamicMinimumCreature", 10);
1396 m_float_configs[CONFIG_RESPAWN_DYNAMICRATE_GAMEOBJECT] = sConfigMgr->GetFloatDefault("Respawn.DynamicRateGameObject", 10.0f);
1398 {
1399 TC_LOG_ERROR("server.loading", "Respawn.DynamicRateGameObject ({}) must be positive. Set to 10.", m_float_configs[CONFIG_RESPAWN_DYNAMICRATE_GAMEOBJECT]);
1401 }
1402 m_int_configs[CONFIG_RESPAWN_DYNAMICMINIMUM_GAMEOBJECT] = sConfigMgr->GetIntDefault("Respawn.DynamicMinimumGameObject", 10);
1403 _guidWarningMsg = sConfigMgr->GetStringDefault("Respawn.WarningMessage", "There will be an unscheduled server restart at 03:00. The server will be available again shortly after.");
1404 _alertRestartReason = sConfigMgr->GetStringDefault("Respawn.AlertRestartReason", "Urgent Maintenance");
1405 m_int_configs[CONFIG_RESPAWN_GUIDWARNING_FREQUENCY] = sConfigMgr->GetIntDefault("Respawn.WarningFrequency", 1800);
1407 std::string dataPath = sConfigMgr->GetStringDefault("DataDir", "./");
1408 if (dataPath.empty() || (dataPath.at(dataPath.length()-1) != '/' && dataPath.at(dataPath.length()-1) != '\\'))
1409 dataPath.push_back('/');
1410
1411#if TRINITY_PLATFORM == TRINITY_PLATFORM_UNIX || TRINITY_PLATFORM == TRINITY_PLATFORM_APPLE
1412 if (dataPath[0] == '~')
1413 {
1414 char const* home = getenv("HOME");
1415 if (home)
1416 dataPath.replace(0, 1, home);
1417 }
1418#endif
1419
1420 if (reload)
1421 {
1422 if (dataPath != m_dataPath)
1423 TC_LOG_ERROR("server.loading", "DataDir option can't be changed at worldserver.conf reload, using current value ({}).", m_dataPath);
1424 }
1425 else
1426 {
1427 m_dataPath = dataPath;
1428 TC_LOG_INFO("server.loading", "Using DataDir {}", m_dataPath);
1429 }
1430
1431 m_bool_configs[CONFIG_ENABLE_MMAPS] = sConfigMgr->GetBoolDefault("mmap.enablePathFinding", true);
1432 TC_LOG_INFO("server.loading", "WORLD: MMap data directory is: {}mmaps", m_dataPath);
1433
1434 m_bool_configs[CONFIG_VMAP_INDOOR_CHECK] = sConfigMgr->GetBoolDefault("vmap.enableIndoorCheck", false);
1435 bool enableIndoor = sConfigMgr->GetBoolDefault("vmap.enableIndoorCheck", true);
1436 bool enableLOS = sConfigMgr->GetBoolDefault("vmap.enableLOS", true);
1437 bool enableHeight = sConfigMgr->GetBoolDefault("vmap.enableHeight", true);
1438
1439 if (!enableHeight)
1440 TC_LOG_ERROR("server.loading", "VMap height checking disabled! Creatures movements and other various things WILL be broken! Expect no support.");
1441
1444 TC_LOG_INFO("server.loading", "VMap support included. LineOfSight: {}, getHeight: {}, indoorCheck: {}", enableLOS, enableHeight, enableIndoor);
1445 TC_LOG_INFO("server.loading", "VMap data directory is: {}vmaps", m_dataPath);
1446
1447 m_int_configs[CONFIG_MAX_WHO] = sConfigMgr->GetIntDefault("MaxWhoListReturns", 49);
1448 m_int_configs[CONFIG_WHO_LIST_UPDATE_INTERVAL] = sConfigMgr->GetIntDefault("WhoList.Update.Interval", 5);
1450 {
1451 TC_LOG_ERROR("server.loading", "WhoList.Update.Interval ({}) must be > 0, set to default 5 seconds.", m_int_configs[CONFIG_WHO_LIST_UPDATE_INTERVAL]);
1453 }
1454 if (reload)
1455 {
1458 }
1459
1460 m_bool_configs[CONFIG_START_ALL_SPELLS] = sConfigMgr->GetBoolDefault("PlayerStart.AllSpells", false);
1461 m_int_configs[CONFIG_HONOR_AFTER_DUEL] = sConfigMgr->GetIntDefault("HonorPointsAfterDuel", 0);
1462 m_bool_configs[CONFIG_RESET_DUEL_COOLDOWNS] = sConfigMgr->GetBoolDefault("ResetDuelCooldowns", false);
1463 m_bool_configs[CONFIG_RESET_DUEL_HEALTH_MANA] = sConfigMgr->GetBoolDefault("ResetDuelHealthMana", false);
1464 m_bool_configs[CONFIG_START_ALL_EXPLORED] = sConfigMgr->GetBoolDefault("PlayerStart.MapsExplored", false);
1465 m_bool_configs[CONFIG_START_ALL_REP] = sConfigMgr->GetBoolDefault("PlayerStart.AllReputation", false);
1466 m_bool_configs[CONFIG_ALWAYS_MAXSKILL] = sConfigMgr->GetBoolDefault("AlwaysMaxWeaponSkill", false);
1467 m_bool_configs[CONFIG_PVP_TOKEN_ENABLE] = sConfigMgr->GetBoolDefault("PvPToken.Enable", false);
1468 m_int_configs[CONFIG_PVP_TOKEN_MAP_TYPE] = sConfigMgr->GetIntDefault("PvPToken.MapAllowType", 4);
1469 m_int_configs[CONFIG_PVP_TOKEN_ID] = sConfigMgr->GetIntDefault("PvPToken.ItemID", 29434);
1470 m_int_configs[CONFIG_PVP_TOKEN_COUNT] = sConfigMgr->GetIntDefault("PvPToken.ItemCount", 1);
1473
1474 m_bool_configs[CONFIG_ALLOW_TRACK_BOTH_RESOURCES] = sConfigMgr->GetBoolDefault("AllowTrackBothResources", false);
1475 m_bool_configs[CONFIG_NO_RESET_TALENT_COST] = sConfigMgr->GetBoolDefault("NoResetTalentsCost", false);
1476 m_bool_configs[CONFIG_SHOW_KICK_IN_WORLD] = sConfigMgr->GetBoolDefault("ShowKickInWorld", false);
1477 m_bool_configs[CONFIG_SHOW_MUTE_IN_WORLD] = sConfigMgr->GetBoolDefault("ShowMuteInWorld", false);
1478 m_bool_configs[CONFIG_SHOW_BAN_IN_WORLD] = sConfigMgr->GetBoolDefault("ShowBanInWorld", false);
1479 m_int_configs[CONFIG_NUMTHREADS] = sConfigMgr->GetIntDefault("MapUpdate.Threads", 1);
1480 m_int_configs[CONFIG_MAX_RESULTS_LOOKUP_COMMANDS] = sConfigMgr->GetIntDefault("Command.LookupMaxResults", 0);
1481
1482 // Warden
1483 m_bool_configs[CONFIG_WARDEN_ENABLED] = sConfigMgr->GetBoolDefault("Warden.Enabled", false);
1484 m_int_configs[CONFIG_WARDEN_NUM_INJECT_CHECKS] = sConfigMgr->GetIntDefault("Warden.NumInjectionChecks", 9);
1485 m_int_configs[CONFIG_WARDEN_NUM_LUA_CHECKS] = sConfigMgr->GetIntDefault("Warden.NumLuaSandboxChecks", 1);
1486 m_int_configs[CONFIG_WARDEN_NUM_CLIENT_MOD_CHECKS] = sConfigMgr->GetIntDefault("Warden.NumClientModChecks", 1);
1487 m_int_configs[CONFIG_WARDEN_CLIENT_BAN_DURATION] = sConfigMgr->GetIntDefault("Warden.BanDuration", 86400);
1488 m_int_configs[CONFIG_WARDEN_CLIENT_CHECK_HOLDOFF] = sConfigMgr->GetIntDefault("Warden.ClientCheckHoldOff", 30);
1489 m_int_configs[CONFIG_WARDEN_CLIENT_FAIL_ACTION] = sConfigMgr->GetIntDefault("Warden.ClientCheckFailAction", 0);
1490 m_int_configs[CONFIG_WARDEN_CLIENT_RESPONSE_DELAY] = sConfigMgr->GetIntDefault("Warden.ClientResponseDelay", 600);
1491
1492 // Dungeon finder
1493 m_int_configs[CONFIG_LFG_OPTIONSMASK] = sConfigMgr->GetIntDefault("DungeonFinder.OptionsMask", 1);
1494
1495 // DBC_ItemAttributes
1496 m_bool_configs[CONFIG_DBC_ENFORCE_ITEM_ATTRIBUTES] = sConfigMgr->GetBoolDefault("DBC.EnforceItemAttributes", true);
1497
1498 // Accountpassword Secruity
1499 m_int_configs[CONFIG_ACC_PASSCHANGESEC] = sConfigMgr->GetIntDefault("Account.PasswordChangeSecurity", 0);
1500
1501 // Random Battleground Rewards
1502 m_int_configs[CONFIG_BG_REWARD_WINNER_HONOR_FIRST] = sConfigMgr->GetIntDefault("Battleground.RewardWinnerHonorFirst", 30);
1503 m_int_configs[CONFIG_BG_REWARD_WINNER_ARENA_FIRST] = sConfigMgr->GetIntDefault("Battleground.RewardWinnerArenaFirst", 25);
1504 m_int_configs[CONFIG_BG_REWARD_WINNER_HONOR_LAST] = sConfigMgr->GetIntDefault("Battleground.RewardWinnerHonorLast", 15);
1505 m_int_configs[CONFIG_BG_REWARD_WINNER_ARENA_LAST] = sConfigMgr->GetIntDefault("Battleground.RewardWinnerArenaLast", 0);
1506 m_int_configs[CONFIG_BG_REWARD_LOSER_HONOR_FIRST] = sConfigMgr->GetIntDefault("Battleground.RewardLoserHonorFirst", 5);
1507 m_int_configs[CONFIG_BG_REWARD_LOSER_HONOR_LAST] = sConfigMgr->GetIntDefault("Battleground.RewardLoserHonorLast", 5);
1508
1509 // Max instances per hour
1510 m_int_configs[CONFIG_MAX_INSTANCES_PER_HOUR] = sConfigMgr->GetIntDefault("AccountInstancesPerHour", 5);
1511
1512 // Anounce reset of instance to whole party
1513 m_bool_configs[CONFIG_INSTANCES_RESET_ANNOUNCE] = sConfigMgr->GetBoolDefault("InstancesResetAnnounce", false);
1514
1515 // AutoBroadcast
1516 m_bool_configs[CONFIG_AUTOBROADCAST] = sConfigMgr->GetBoolDefault("AutoBroadcast.On", false);
1517 m_int_configs[CONFIG_AUTOBROADCAST_CENTER] = sConfigMgr->GetIntDefault("AutoBroadcast.Center", 0);
1518 m_int_configs[CONFIG_AUTOBROADCAST_INTERVAL] = sConfigMgr->GetIntDefault("AutoBroadcast.Timer", 60000);
1519 if (reload)
1520 {
1523 }
1524
1525 // MySQL ping time interval
1526 m_int_configs[CONFIG_DB_PING_INTERVAL] = sConfigMgr->GetIntDefault("MaxPingTime", 30);
1527
1528 // misc
1529 m_bool_configs[CONFIG_PDUMP_NO_PATHS] = sConfigMgr->GetBoolDefault("PlayerDump.DisallowPaths", true);
1530 m_bool_configs[CONFIG_PDUMP_NO_OVERWRITE] = sConfigMgr->GetBoolDefault("PlayerDump.DisallowOverwrite", true);
1531
1532 // Wintergrasp battlefield
1533 m_bool_configs[CONFIG_WINTERGRASP_ENABLE] = sConfigMgr->GetBoolDefault("Wintergrasp.Enable", false);
1534 m_int_configs[CONFIG_WINTERGRASP_PLR_MAX] = sConfigMgr->GetIntDefault("Wintergrasp.PlayerMax", 100);
1535 m_int_configs[CONFIG_WINTERGRASP_PLR_MIN] = sConfigMgr->GetIntDefault("Wintergrasp.PlayerMin", 0);
1536 m_int_configs[CONFIG_WINTERGRASP_PLR_MIN_LVL] = sConfigMgr->GetIntDefault("Wintergrasp.PlayerMinLvl", 77);
1537 m_int_configs[CONFIG_WINTERGRASP_BATTLETIME] = sConfigMgr->GetIntDefault("Wintergrasp.BattleTimer", 30);
1538 m_int_configs[CONFIG_WINTERGRASP_NOBATTLETIME] = sConfigMgr->GetIntDefault("Wintergrasp.NoBattleTimer", 150);
1539 m_int_configs[CONFIG_WINTERGRASP_RESTART_AFTER_CRASH] = sConfigMgr->GetIntDefault("Wintergrasp.CrashRestartTimer", 10);
1540
1541 // Stats limits
1542 m_bool_configs[CONFIG_STATS_LIMITS_ENABLE] = sConfigMgr->GetBoolDefault("Stats.Limits.Enable", false);
1543 m_float_configs[CONFIG_STATS_LIMITS_DODGE] = sConfigMgr->GetFloatDefault("Stats.Limits.Dodge", 95.0f);
1544 m_float_configs[CONFIG_STATS_LIMITS_PARRY] = sConfigMgr->GetFloatDefault("Stats.Limits.Parry", 95.0f);
1545 m_float_configs[CONFIG_STATS_LIMITS_BLOCK] = sConfigMgr->GetFloatDefault("Stats.Limits.Block", 95.0f);
1546 m_float_configs[CONFIG_STATS_LIMITS_CRIT] = sConfigMgr->GetFloatDefault("Stats.Limits.Crit", 95.0f);
1547
1548 //packet spoof punishment
1550 m_int_configs[CONFIG_PACKET_SPOOF_BANMODE] = sConfigMgr->GetIntDefault("PacketSpoof.BanMode", (uint32)BAN_ACCOUNT);
1553
1554 m_int_configs[CONFIG_PACKET_SPOOF_BANDURATION] = sConfigMgr->GetIntDefault("PacketSpoof.BanDuration", 86400);
1555
1556 m_int_configs[CONFIG_BIRTHDAY_TIME] = sConfigMgr->GetIntDefault("BirthdayTime", 1222964635);
1557
1558 m_bool_configs[CONFIG_IP_BASED_ACTION_LOGGING] = sConfigMgr->GetBoolDefault("Allow.IP.Based.Action.Logging", false);
1559
1560 // AHBot
1561 m_int_configs[CONFIG_AHBOT_UPDATE_INTERVAL] = sConfigMgr->GetIntDefault("AuctionHouseBot.Update.Interval", 20);
1562
1563 m_bool_configs[CONFIG_CALCULATE_CREATURE_ZONE_AREA_DATA] = sConfigMgr->GetBoolDefault("Calculate.Creature.Zone.Area.Data", false);
1564 m_bool_configs[CONFIG_CALCULATE_GAMEOBJECT_ZONE_AREA_DATA] = sConfigMgr->GetBoolDefault("Calculate.Gameoject.Zone.Area.Data", false);
1565
1566 // HotSwap
1567 m_bool_configs[CONFIG_HOTSWAP_ENABLED] = sConfigMgr->GetBoolDefault("HotSwap.Enabled", true);
1568 m_bool_configs[CONFIG_HOTSWAP_RECOMPILER_ENABLED] = sConfigMgr->GetBoolDefault("HotSwap.EnableReCompiler", true);
1569 m_bool_configs[CONFIG_HOTSWAP_EARLY_TERMINATION_ENABLED] = sConfigMgr->GetBoolDefault("HotSwap.EnableEarlyTermination", true);
1570 m_bool_configs[CONFIG_HOTSWAP_BUILD_FILE_RECREATION_ENABLED] = sConfigMgr->GetBoolDefault("HotSwap.EnableBuildFileRecreation", true);
1571 m_bool_configs[CONFIG_HOTSWAP_INSTALL_ENABLED] = sConfigMgr->GetBoolDefault("HotSwap.EnableInstall", true);
1572 m_bool_configs[CONFIG_HOTSWAP_PREFIX_CORRECTION_ENABLED] = sConfigMgr->GetBoolDefault("HotSwap.EnablePrefixCorrection", true);
1573
1574 // prevent character rename on character customization
1575 m_bool_configs[CONFIG_PREVENT_RENAME_CUSTOMIZATION] = sConfigMgr->GetBoolDefault("PreventRenameCharacterOnCustomization", false);
1576
1577 // Allow 5-man parties to use raid warnings
1578 m_bool_configs[CONFIG_CHAT_PARTY_RAID_WARNINGS] = sConfigMgr->GetBoolDefault("PartyRaidWarnings", false);
1579
1580 // Allow to cache data queries
1581 m_bool_configs[CONFIG_CACHE_DATA_QUERIES] = sConfigMgr->GetBoolDefault("CacheDataQueries", true);
1582
1583 // Whether to use LoS from game objects
1584 m_bool_configs[CONFIG_CHECK_GOBJECT_LOS] = sConfigMgr->GetBoolDefault("CheckGameObjectLoS", true);
1585
1586 // Anti movement cheat measure. Time each client have to acknowledge a movement change until they are kicked
1587 m_int_configs[CONFIG_PENDING_MOVE_CHANGES_TIMEOUT] = sConfigMgr->GetIntDefault("AntiCheat.PendingMoveChangesTimeoutTime", 0);
1588
1589 // Specifies if IP addresses can be logged to the database
1590 m_bool_configs[CONFIG_ALLOW_LOGGING_IP_ADDRESSES_IN_DATABASE] = sConfigMgr->GetBoolDefault("AllowLoggingIPAddressesInDatabase", true, true);
1591
1592 // call ScriptMgr if we're reloading the configuration
1593 if (reload)
1594 sScriptMgr->OnConfigLoad(reload);
1595}
1596
1599{
1600 if (uint32 realmId = sConfigMgr->GetIntDefault("RealmID", 0)) // 0 reserved for auth
1601 sLog->SetRealmId(realmId);
1602
1604 uint32 startupBegin = getMSTime();
1605
1607 srand((unsigned int)GameTime::GetGameTime());
1608
1610 dtAllocSetCustom(dtCustomAlloc, dtCustomFree);
1611
1616
1619
1622
1624 sObjectMgr->SetHighestGuids();
1625
1627 if (!MapManager::ExistMapAndVMap(0, -6240.32f, 331.033f)
1628 || !MapManager::ExistMapAndVMap(0, -8949.95f, -132.493f)
1629 || !MapManager::ExistMapAndVMap(1, -618.518f, -4251.67f)
1630 || !MapManager::ExistMapAndVMap(0, 1676.35f, 1677.45f)
1631 || !MapManager::ExistMapAndVMap(1, 10311.3f, 832.463f)
1632 || !MapManager::ExistMapAndVMap(1, -2917.58f, -257.98f)
1634 !MapManager::ExistMapAndVMap(530, 10349.6f, -6357.29f) ||
1635 !MapManager::ExistMapAndVMap(530, -3961.64f, -13931.2f))))
1636 {
1637 TC_LOG_FATAL("server.loading", "Unable to load critical files - server shutting down !!!");
1638 exit(1);
1639 }
1640
1642 sPoolMgr->Initialize();
1643
1645 sGameEventMgr->Initialize();
1646
1648
1649 TC_LOG_INFO("server.loading", "Loading Trinity strings...");
1650 if (!sObjectMgr->LoadTrinityStrings())
1651 exit(1); // Error message displayed in function already
1652
1654 //No SQL injection as values are treated as integers
1655
1656 // not send custom type REALM_FFA_PVP to realm list
1659
1660 LoginDatabase.PExecute("UPDATE realmlist SET icon = {}, timezone = {} WHERE id = '{}'", server_type, realm_zone, realm.Id.Realm); // One-time query
1661
1663 TC_LOG_INFO("server.loading", "Initialize data stores...");
1665 DetectDBCLang();
1666
1667 // Load cinematic cameras
1669
1670 // Load IP Location Database
1671 sIPLocation->Load();
1672
1673 std::vector<uint32> mapIds;
1674 for (uint32 mapId = 0; mapId < sMapStore.GetNumRows(); mapId++)
1675 if (sMapStore.LookupEntry(mapId))
1676 mapIds.push_back(mapId);
1677
1678 vmmgr2->InitializeThreadUnsafe(mapIds);
1679
1681 mmmgr->InitializeThreadUnsafe(mapIds);
1682
1683 TC_LOG_INFO("server.loading", "Initializing PlayerDump tables...");
1685
1688
1689 TC_LOG_INFO("server.loading", "Loading SpellInfo store...");
1690 sSpellMgr->LoadSpellInfoStore();
1691
1692 TC_LOG_INFO("server.loading", "Loading SpellInfo corrections...");
1693 sSpellMgr->LoadSpellInfoCorrections();
1694
1695 TC_LOG_INFO("server.loading", "Loading SkillLineAbilityMultiMap Data...");
1696 sSpellMgr->LoadSkillLineAbilityMap();
1697
1698 TC_LOG_INFO("server.loading", "Loading SpellInfo custom attributes...");
1699 sSpellMgr->LoadSpellInfoCustomAttributes();
1700
1701 TC_LOG_INFO("server.loading", "Loading SpellInfo diminishing infos...");
1702 sSpellMgr->LoadSpellInfoDiminishing();
1703
1704 TC_LOG_INFO("server.loading", "Loading SpellInfo immunity infos...");
1705 sSpellMgr->LoadSpellInfoImmunities();
1706
1707 TC_LOG_INFO("server.loading", "Loading Player Totem models...");
1708 sObjectMgr->LoadPlayerTotemModels();
1709
1710 TC_LOG_INFO("server.loading", "Loading GameObject models...");
1712
1713 TC_LOG_INFO("server.loading", "Loading Script Names...");
1714 sObjectMgr->LoadScriptNames();
1715
1716 TC_LOG_INFO("server.loading", "Loading Instance Template...");
1717 sObjectMgr->LoadInstanceTemplate();
1718
1719 // Must be called before `respawn` data
1720 TC_LOG_INFO("server.loading", "Loading instances...");
1721 sInstanceSaveMgr->LoadInstances();
1722
1723 // Load before guilds and arena teams
1724 TC_LOG_INFO("server.loading", "Loading character cache store...");
1725 sCharacterCache->LoadCharacterCacheStorage();
1726
1727 TC_LOG_INFO("server.loading", "Loading Broadcast texts...");
1728 sObjectMgr->LoadBroadcastTexts();
1729 sObjectMgr->LoadBroadcastTextLocales();
1730
1731 TC_LOG_INFO("server.loading", "Loading Localization strings...");
1732 uint32 oldMSTime = getMSTime();
1733 sObjectMgr->LoadCreatureLocales();
1734 sObjectMgr->LoadGameObjectLocales();
1735 sObjectMgr->LoadItemLocales();
1736 sObjectMgr->LoadItemSetNameLocales();
1737 sObjectMgr->LoadQuestLocales();
1738 sObjectMgr->LoadQuestOfferRewardLocale();
1739 sObjectMgr->LoadQuestRequestItemsLocale();
1740 sObjectMgr->LoadNpcTextLocales();
1741 sObjectMgr->LoadPageTextLocales();
1742 sObjectMgr->LoadGossipMenuItemsLocales();
1743 sObjectMgr->LoadPointOfInterestLocales();
1744 sObjectMgr->LoadQuestGreetingLocales();
1745
1746 sObjectMgr->SetDBCLocaleIndex(GetDefaultDbcLocale()); // Get once for all the locale index of DBC language (console/broadcasts)
1747 TC_LOG_INFO("server.loading", ">> Localization strings loaded in {} ms", GetMSTimeDiffToNow(oldMSTime));
1748
1749 TC_LOG_INFO("server.loading", "Loading Account Roles and Permissions...");
1750 sAccountMgr->LoadRBAC();
1751
1752 TC_LOG_INFO("server.loading", "Loading Page Texts...");
1753 sObjectMgr->LoadPageTexts();
1754
1755 TC_LOG_INFO("server.loading", "Loading Game Object Templates..."); // must be after LoadPageTexts
1756 sObjectMgr->LoadGameObjectTemplate();
1757
1758 TC_LOG_INFO("server.loading", "Loading Game Object template addons...");
1759 sObjectMgr->LoadGameObjectTemplateAddons();
1760
1761 TC_LOG_INFO("server.loading", "Loading Transport templates...");
1762 sTransportMgr->LoadTransportTemplates();
1763
1764 TC_LOG_INFO("server.loading", "Loading Transport animations and rotations...");
1765 sTransportMgr->LoadTransportAnimationAndRotation();
1766
1767 TC_LOG_INFO("server.loading", "Loading Spell Rank Data...");
1768 sSpellMgr->LoadSpellRanks();
1769
1770 TC_LOG_INFO("server.loading", "Loading Spell Required Data...");
1771 sSpellMgr->LoadSpellRequired();
1772
1773 TC_LOG_INFO("server.loading", "Loading Spell Group types...");
1774 sSpellMgr->LoadSpellGroups();
1775
1776 TC_LOG_INFO("server.loading", "Loading Spell Learn Skills...");
1777 sSpellMgr->LoadSpellLearnSkills(); // must be after LoadSpellRanks
1778
1779 TC_LOG_INFO("server.loading", "Loading SpellInfo SpellSpecific and AuraState...");
1780 sSpellMgr->LoadSpellInfoSpellSpecificAndAuraState(); // must be after LoadSpellRanks
1781
1782 TC_LOG_INFO("server.loading", "Loading Spell Learn Spells...");
1783 sSpellMgr->LoadSpellLearnSpells();
1784
1785 TC_LOG_INFO("server.loading", "Loading Spell Proc conditions and data...");
1786 sSpellMgr->LoadSpellProcs();
1787
1788 TC_LOG_INFO("server.loading", "Loading Spell Bonus Data...");
1789 sSpellMgr->LoadSpellBonuses();
1790
1791 TC_LOG_INFO("server.loading", "Loading Aggro Spells Definitions...");
1792 sSpellMgr->LoadSpellThreats();
1793
1794 TC_LOG_INFO("server.loading", "Loading Spell Group Stack Rules...");
1795 sSpellMgr->LoadSpellGroupStackRules();
1796
1797 TC_LOG_INFO("server.loading", "Loading NPC Texts...");
1798 sObjectMgr->LoadGossipText();
1799
1800 TC_LOG_INFO("server.loading", "Loading Enchant Spells Proc datas...");
1801 sSpellMgr->LoadSpellEnchantProcData();
1802
1803 TC_LOG_INFO("server.loading", "Loading Item Random Enchantments Table...");
1805
1806 TC_LOG_INFO("server.loading", "Loading Disables"); // must be before loading quests and items
1808
1809 TC_LOG_INFO("server.loading", "Loading Items..."); // must be after LoadRandomEnchantmentsTable and LoadPageTexts
1810 sObjectMgr->LoadItemTemplates();
1811
1812 TC_LOG_INFO("server.loading", "Loading Item set names..."); // must be after LoadItemPrototypes
1813 sObjectMgr->LoadItemSetNames();
1814
1815 TC_LOG_INFO("server.loading", "Loading Creature Model Based Info Data...");
1816 sObjectMgr->LoadCreatureModelInfo();
1817
1818 TC_LOG_INFO("server.loading", "Loading Creature templates...");
1819 sObjectMgr->LoadCreatureTemplates();
1820
1821 TC_LOG_INFO("server.loading", "Loading Equipment templates..."); // must be after LoadCreatureTemplates
1822 sObjectMgr->LoadEquipmentTemplates();
1823
1824 TC_LOG_INFO("server.loading", "Loading Creature template addons...");
1825 sObjectMgr->LoadCreatureTemplateAddons();
1826
1827 TC_LOG_INFO("server.loading", "Loading Reputation Reward Rates...");
1828 sObjectMgr->LoadReputationRewardRate();
1829
1830 TC_LOG_INFO("server.loading", "Loading Creature Reputation OnKill Data...");
1831 sObjectMgr->LoadReputationOnKill();
1832
1833 TC_LOG_INFO("server.loading", "Loading Reputation Spillover Data...");
1834 sObjectMgr->LoadReputationSpilloverTemplate();
1835
1836 TC_LOG_INFO("server.loading", "Loading Points Of Interest Data...");
1837 sObjectMgr->LoadPointsOfInterest();
1838
1839 TC_LOG_INFO("server.loading", "Loading Creature Base Stats...");
1840 sObjectMgr->LoadCreatureClassLevelStats();
1841
1842 TC_LOG_INFO("server.loading", "Loading Spawn Group Templates...");
1843 sObjectMgr->LoadSpawnGroupTemplates();
1844
1845 TC_LOG_INFO("server.loading", "Loading Creature Data...");
1846 sObjectMgr->LoadCreatures();
1847
1848 TC_LOG_INFO("server.loading", "Loading Temporary Summon Data...");
1849 sObjectMgr->LoadTempSummons(); // must be after LoadCreatureTemplates() and LoadGameObjectTemplates()
1850
1851 TC_LOG_INFO("server.loading", "Loading pet levelup spells...");
1852 sSpellMgr->LoadPetLevelupSpellMap();
1853
1854 TC_LOG_INFO("server.loading", "Loading pet default spells additional to levelup spells...");
1855 sSpellMgr->LoadPetDefaultSpells();
1856
1857 TC_LOG_INFO("server.loading", "Loading Creature Addon Data...");
1858 sObjectMgr->LoadCreatureAddons(); // must be after LoadCreatureTemplates() and LoadCreatures()
1859
1860 TC_LOG_INFO("server.loading", "Loading Creature Movement Overrides...");
1861 sObjectMgr->LoadCreatureMovementOverrides(); // must be after LoadCreatures()
1862
1863 TC_LOG_INFO("server.loading", "Loading Gameobject Data...");
1864 sObjectMgr->LoadGameObjects();
1865
1866 TC_LOG_INFO("server.loading", "Loading Spawn Group Data...");
1867 sObjectMgr->LoadSpawnGroups();
1868
1869 TC_LOG_INFO("server.loading", "Loading instance spawn groups...");
1870 sObjectMgr->LoadInstanceSpawnGroups();
1871
1872 TC_LOG_INFO("server.loading", "Loading GameObject Addon Data...");
1873 sObjectMgr->LoadGameObjectAddons(); // must be after LoadGameObjects()
1874
1875 TC_LOG_INFO("server.loading", "Loading GameObject faction and flags overrides...");
1876 sObjectMgr->LoadGameObjectOverrides(); // must be after LoadGameObjects()
1877
1878 TC_LOG_INFO("server.loading", "Loading GameObject Quest Items...");
1879 sObjectMgr->LoadGameObjectQuestItems();
1880
1881 TC_LOG_INFO("server.loading", "Loading Creature Quest Items...");
1882 sObjectMgr->LoadCreatureQuestItems();
1883
1884 TC_LOG_INFO("server.loading", "Loading Creature Linked Respawn...");
1885 sObjectMgr->LoadLinkedRespawn(); // must be after LoadCreatures(), LoadGameObjects()
1886
1887 TC_LOG_INFO("server.loading", "Loading Weather Data...");
1889
1890 TC_LOG_INFO("server.loading", "Loading Quests...");
1891 sObjectMgr->LoadQuests(); // must be loaded after DBCs, creature_template, item_template, gameobject tables
1892
1893 TC_LOG_INFO("server.loading", "Checking Quest Disables");
1894 DisableMgr::CheckQuestDisables(); // must be after loading quests
1895
1896 TC_LOG_INFO("server.loading", "Loading Quest POI");
1897 sObjectMgr->LoadQuestPOI();
1898
1899 TC_LOG_INFO("server.loading", "Loading Quests Starters and Enders...");
1900 sObjectMgr->LoadQuestStartersAndEnders(); // must be after quest load
1901
1902 TC_LOG_INFO("server.loading", "Loading Quests Greetings...");
1903 sObjectMgr->LoadQuestGreetings(); // must be loaded after creature_template, gameobject_template tables
1904
1905 TC_LOG_INFO("server.loading", "Loading Objects Pooling Data...");
1906 sPoolMgr->LoadFromDB();
1907 TC_LOG_INFO("server.loading", "Loading Quest Pooling Data...");
1908 sQuestPoolMgr->LoadFromDB(); // must be after quest templates
1909
1910 TC_LOG_INFO("server.loading", "Loading Game Event Data..."); // must be after loading pools fully
1911 sGameEventMgr->LoadHolidayDates(); // Must be after loading DBC
1912 sGameEventMgr->LoadFromDB(); // Must be after loading holiday dates
1913
1914 TC_LOG_INFO("server.loading", "Loading UNIT_NPC_FLAG_SPELLCLICK Data..."); // must be after LoadQuests
1915 sObjectMgr->LoadNPCSpellClickSpells();
1916
1917 TC_LOG_INFO("server.loading", "Loading Vehicle Templates...");
1918 sObjectMgr->LoadVehicleTemplate(); // must be after LoadCreatureTemplates()
1919
1920 TC_LOG_INFO("server.loading", "Loading Vehicle Template Accessories...");
1921 sObjectMgr->LoadVehicleTemplateAccessories(); // must be after LoadCreatureTemplates() and LoadNPCSpellClickSpells()
1922
1923 TC_LOG_INFO("server.loading", "Loading Vehicle Accessories...");
1924 sObjectMgr->LoadVehicleAccessories(); // must be after LoadCreatureTemplates() and LoadNPCSpellClickSpells()
1925
1926 TC_LOG_INFO("server.loading", "Loading Vehicle Seat Addon Data...");
1927 sObjectMgr->LoadVehicleSeatAddon(); // must be after loading DBC
1928
1929 TC_LOG_INFO("server.loading", "Loading SpellArea Data..."); // must be after quest load
1930 sSpellMgr->LoadSpellAreas();
1931
1932 TC_LOG_INFO("server.loading", "Loading Area Trigger Teleports definitions...");
1933 sObjectMgr->LoadAreaTriggerTeleports();
1934
1935 TC_LOG_INFO("server.loading", "Loading Access Requirements...");
1936 sObjectMgr->LoadAccessRequirements(); // must be after item template load
1937
1938 TC_LOG_INFO("server.loading", "Loading Quest Area Triggers...");
1939 sObjectMgr->LoadQuestAreaTriggers(); // must be after LoadQuests
1940
1941 TC_LOG_INFO("server.loading", "Loading Tavern Area Triggers...");
1942 sObjectMgr->LoadTavernAreaTriggers();
1943
1944 TC_LOG_INFO("server.loading", "Loading AreaTrigger script names...");
1945 sObjectMgr->LoadAreaTriggerScripts();
1946
1947 TC_LOG_INFO("server.loading", "Loading LFG entrance positions..."); // Must be after areatriggers
1948 sLFGMgr->LoadLFGDungeons();
1949
1950 TC_LOG_INFO("server.loading", "Loading Dungeon boss data...");
1951 sObjectMgr->LoadInstanceEncounters();
1952
1953 TC_LOG_INFO("server.loading", "Loading LFG rewards...");
1954 sLFGMgr->LoadRewards();
1955
1956 TC_LOG_INFO("server.loading", "Loading Graveyard-zone links...");
1957 sObjectMgr->LoadGraveyardZones();
1958
1959 TC_LOG_INFO("server.loading", "Loading spell pet auras...");
1960 sSpellMgr->LoadSpellPetAuras();
1961
1962 TC_LOG_INFO("server.loading", "Loading Spell target coordinates...");
1963 sSpellMgr->LoadSpellTargetPositions();
1964
1965 TC_LOG_INFO("server.loading", "Loading enchant custom attributes...");
1966 sSpellMgr->LoadEnchantCustomAttr();
1967
1968 TC_LOG_INFO("server.loading", "Loading linked spells...");
1969 sSpellMgr->LoadSpellLinked();
1970
1971 TC_LOG_INFO("server.loading", "Loading Player Create Data...");
1972 sObjectMgr->LoadPlayerInfo();
1973
1974 TC_LOG_INFO("server.loading", "Loading Exploration BaseXP Data...");
1975 sObjectMgr->LoadExplorationBaseXP();
1976
1977 TC_LOG_INFO("server.loading", "Loading Pet Name Parts...");
1978 sObjectMgr->LoadPetNames();
1979
1981
1982 TC_LOG_INFO("server.loading", "Loading the max pet number...");
1983 sObjectMgr->LoadPetNumber();
1984
1985 TC_LOG_INFO("server.loading", "Loading pet level stats...");
1986 sObjectMgr->LoadPetLevelInfo();
1987
1988 TC_LOG_INFO("server.loading", "Loading Player level dependent mail rewards...");
1989 sObjectMgr->LoadMailLevelRewards();
1990
1991 // Loot tables
1993
1994 TC_LOG_INFO("server.loading", "Loading Skill Discovery Table...");
1996
1997 TC_LOG_INFO("server.loading", "Loading Skill Extra Item Table...");
1999
2000 TC_LOG_INFO("server.loading", "Loading Skill Perfection Data Table...");
2002
2003 TC_LOG_INFO("server.loading", "Loading Skill Fishing base level requirements...");
2004 sObjectMgr->LoadFishingBaseSkillLevel();
2005
2006 TC_LOG_INFO("server.loading", "Loading Achievements...");
2007 sAchievementMgr->LoadAchievementReferenceList();
2008 TC_LOG_INFO("server.loading", "Loading Achievement Criteria Lists...");
2009 sAchievementMgr->LoadAchievementCriteriaList();
2010 TC_LOG_INFO("server.loading", "Loading Achievement Criteria Data...");
2011 sAchievementMgr->LoadAchievementCriteriaData();
2012 TC_LOG_INFO("server.loading", "Loading Achievement Rewards...");
2013 sAchievementMgr->LoadRewards();
2014 TC_LOG_INFO("server.loading", "Loading Achievement Reward Locales...");
2015 sAchievementMgr->LoadRewardLocales();
2016 TC_LOG_INFO("server.loading", "Loading Completed Achievements...");
2017 sAchievementMgr->LoadCompletedAchievements();
2018
2020 TC_LOG_INFO("server.loading", "Loading Item Auctions...");
2021 sAuctionMgr->LoadAuctionItems();
2022
2023 TC_LOG_INFO("server.loading", "Loading Auctions...");
2024 sAuctionMgr->LoadAuctions();
2025
2026 TC_LOG_INFO("server.loading", "Loading Guilds...");
2027 sGuildMgr->LoadGuilds();
2028
2029 TC_LOG_INFO("server.loading", "Loading ArenaTeams...");
2030 sArenaTeamMgr->LoadArenaTeams();
2031
2032 TC_LOG_INFO("server.loading", "Loading Groups...");
2033 sGroupMgr->LoadGroups();
2034
2035 TC_LOG_INFO("server.loading", "Loading ReservedNames...");
2036 sObjectMgr->LoadReservedPlayersNames();
2037
2038 TC_LOG_INFO("server.loading", "Loading GameObjects for quests...");
2039 sObjectMgr->LoadGameObjectForQuests();
2040
2041 TC_LOG_INFO("server.loading", "Loading BattleMasters...");
2042 sBattlegroundMgr->LoadBattleMastersEntry(); // must be after load CreatureTemplate
2043
2044 TC_LOG_INFO("server.loading", "Loading GameTeleports...");
2045 sObjectMgr->LoadGameTele();
2046
2047 TC_LOG_INFO("server.loading", "Loading Trainers..."); // must be after LoadCreatureTemplates
2048 sObjectMgr->LoadTrainers();
2049
2050 TC_LOG_INFO("server.loading", "Loading Creature default trainers...");
2051 sObjectMgr->LoadCreatureDefaultTrainers();
2052
2053 TC_LOG_INFO("server.loading", "Loading Gossip menu...");
2054 sObjectMgr->LoadGossipMenu();
2055
2056 TC_LOG_INFO("server.loading", "Loading Gossip menu options...");
2057 sObjectMgr->LoadGossipMenuItems(); // must be after LoadTrainers
2058
2059 TC_LOG_INFO("server.loading", "Loading Vendors...");
2060 sObjectMgr->LoadVendors(); // must be after load CreatureTemplate and ItemTemplate
2061
2062 TC_LOG_INFO("server.loading", "Loading Waypoints...");
2063 sWaypointMgr->Load();
2064
2065 TC_LOG_INFO("server.loading", "Loading Creature Formations...");
2066 sFormationMgr->LoadCreatureFormations();
2067
2068 TC_LOG_INFO("server.loading", "Loading World States..."); // must be loaded before battleground, outdoor PvP and conditions
2070
2071 TC_LOG_INFO("server.loading", "Loading Conditions...");
2072 sConditionMgr->LoadConditions();
2073
2074 TC_LOG_INFO("server.loading", "Loading faction change achievement pairs...");
2075 sObjectMgr->LoadFactionChangeAchievements();
2076
2077 TC_LOG_INFO("server.loading", "Loading faction change spell pairs...");
2078 sObjectMgr->LoadFactionChangeSpells();
2079
2080 TC_LOG_INFO("server.loading", "Loading faction change quest pairs...");
2081 sObjectMgr->LoadFactionChangeQuests();
2082
2083 TC_LOG_INFO("server.loading", "Loading faction change item pairs...");
2084 sObjectMgr->LoadFactionChangeItems();
2085
2086 TC_LOG_INFO("server.loading", "Loading faction change reputation pairs...");
2087 sObjectMgr->LoadFactionChangeReputations();
2088
2089 TC_LOG_INFO("server.loading", "Loading faction change title pairs...");
2090 sObjectMgr->LoadFactionChangeTitles();
2091
2092 TC_LOG_INFO("server.loading", "Loading GM tickets...");
2093 sTicketMgr->LoadTickets();
2094
2095 TC_LOG_INFO("server.loading", "Loading GM surveys...");
2096 sTicketMgr->LoadSurveys();
2097
2098 TC_LOG_INFO("server.loading", "Loading client addons...");
2100
2102 TC_LOG_INFO("server.loading", "Returning old mails...");
2103 sObjectMgr->ReturnOrDeleteOldMails(false);
2104
2105 TC_LOG_INFO("server.loading", "Loading Autobroadcasts...");
2107
2109 sObjectMgr->LoadEventScripts(); // must be after load Creature/Gameobject(Template/Data)
2110 sObjectMgr->LoadWaypointScripts();
2111
2112 TC_LOG_INFO("server.loading", "Loading spell script names...");
2113 sObjectMgr->LoadSpellScriptNames();
2114
2115 TC_LOG_INFO("server.loading", "Loading Creature Texts...");
2116 sCreatureTextMgr->LoadCreatureTexts();
2117
2118 TC_LOG_INFO("server.loading", "Loading Creature Text Locales...");
2119 sCreatureTextMgr->LoadCreatureTextLocales();
2120
2121 TC_LOG_INFO("server.loading", "Initializing Scripts...");
2122 sScriptMgr->Initialize();
2123 sScriptMgr->OnConfigLoad(false); // must be done after the ScriptMgr has been properly initialized
2124
2125 TC_LOG_INFO("server.loading", "Validating spell scripts...");
2126 sObjectMgr->ValidateSpellScripts();
2127
2128 TC_LOG_INFO("server.loading", "Loading SmartAI scripts...");
2129 sSmartScriptMgr->LoadSmartAIFromDB();
2130
2131 TC_LOG_INFO("server.loading", "Loading Calendar data...");
2132 sCalendarMgr->LoadFromDB();
2133
2134 TC_LOG_INFO("server.loading", "Loading Petitions...");
2135 sPetitionMgr->LoadPetitions();
2136
2137 TC_LOG_INFO("server.loading", "Loading Signatures...");
2138 sPetitionMgr->LoadSignatures();
2139
2140 TC_LOG_INFO("server.loading", "Loading Item loot...");
2141 sLootItemStorage->LoadStorageFromDB();
2142
2143 TC_LOG_INFO("server.loading", "Initialize query data...");
2144 sObjectMgr->InitializeQueriesData(QUERY_DATA_ALL);
2145
2146 TC_LOG_INFO("server.loading", "Initialize commands...");
2148
2150 TC_LOG_INFO("server.loading", "Initialize game time and timers");
2152
2153 LoginDatabase.PExecute("INSERT INTO uptime (realmid, starttime, uptime, revision) VALUES({}, {}, 0, '{}')",
2155
2159 //Update "uptime" table based on configuration entry in minutes.
2161 //erase corpses every 20 minutes
2163 // clean logs table every 14 days by default
2165 m_timers[WUPDATE_DELETECHARS].SetInterval(DAY*IN_MILLISECONDS); // check for chars to delete every day
2166
2167 // for AhBot
2169
2171
2173
2175
2177
2178 //to set mailtimer to return mails every day between 4 and 5 am
2179 //mailtimer is increased when updating auctions
2180 //one second is 1000 -(tested on win system)
2182 tm localTm;
2183 time_t gameTime = GameTime::GetGameTime();
2184 localtime_r(&gameTime, &localTm);
2185 uint8 CleanOldMailsTime = getIntConfig(CONFIG_CLEAN_OLD_MAIL_TIME);
2186 mail_timer = ((((localTm.tm_hour + (24 - CleanOldMailsTime)) % 24)* HOUR * IN_MILLISECONDS) / m_timers[WUPDATE_AUCTIONS].GetInterval());
2187 //1440
2189 TC_LOG_INFO("server.loading", "Mail timer set to: {}, mail return is called every {} minutes", uint64(mail_timer), uint64(mail_timer_expires));
2190
2192 TC_LOG_INFO("server.loading", "Starting Map System");
2193 sMapMgr->Initialize();
2194
2195 TC_LOG_INFO("server.loading", "Starting Game Event system...");
2196 uint32 nextGameEvent = sGameEventMgr->StartSystem();
2197 m_timers[WUPDATE_EVENTS].SetInterval(nextGameEvent); //depend on next event
2198
2199 // Delete all characters which have been deleted X days before
2201
2202 TC_LOG_INFO("server.loading", "Initialize AuctionHouseBot...");
2203 sAuctionBot->Initialize();
2204
2205 TC_LOG_INFO("server.loading", "Initializing chat channels...");
2207
2208 TC_LOG_INFO("server.loading", "Initializing Opcodes...");
2210
2211 TC_LOG_INFO("server.loading", "Starting Arena Season...");
2212 sGameEventMgr->StartArenaSeason();
2213
2214 sTicketMgr->Initialize();
2215
2217 TC_LOG_INFO("server.loading", "Starting Battleground System");
2218 sBattlegroundMgr->LoadBattlegroundTemplates();
2219 sBattlegroundMgr->InitAutomaticArenaPointDistribution();
2220
2222 TC_LOG_INFO("server.loading", "Starting Outdoor PvP System");
2223 sOutdoorPvPMgr->InitOutdoorPvP();
2224
2226 TC_LOG_INFO("server.loading", "Starting Battlefield System");
2227 sBattlefieldMgr->InitBattlefield();
2228
2229 TC_LOG_INFO("server.loading", "Loading Transports...");
2230 sTransportMgr->SpawnContinentTransports();
2231
2233 TC_LOG_INFO("server.loading", "Loading Warden Checks...");
2234 sWardenCheckMgr->LoadWardenChecks();
2235
2236 TC_LOG_INFO("server.loading", "Loading Warden Action Overrides...");
2237 sWardenCheckMgr->LoadWardenOverrides();
2238
2239 TC_LOG_INFO("server.loading", "Deleting expired bans...");
2240 LoginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate <= UNIX_TIMESTAMP() AND unbandate<>bandate"); // One-time query
2241
2242 TC_LOG_INFO("server.loading", "Initializing quest reset times...");
2245
2246 TC_LOG_INFO("server.loading", "Calculate random battleground reset time...");
2248
2249 TC_LOG_INFO("server.loading", "Calculate deletion of old calendar events time...");
2251
2252 TC_LOG_INFO("server.loading", "Calculate guild limitation(s) reset time...");
2254
2255 // Preload all cells, if required for the base maps
2256 if (sWorld->getBoolConfig(CONFIG_BASEMAP_LOAD_GRIDS))
2257 {
2258 sMapMgr->DoForAllMaps([](Map* map)
2259 {
2260 if (!map->Instanceable())
2261 {
2262 TC_LOG_INFO("server.loading", "Pre-loading base map data for map {}", map->GetId());
2263 map->LoadAllCells();
2264 }
2265 });
2266 }
2267
2268 uint32 startupDuration = GetMSTimeDiffToNow(startupBegin);
2269
2270 TC_LOG_INFO("server.worldserver", "World initialized in {} minutes {} seconds", (startupDuration / 60000), ((startupDuration % 60000) / 1000));
2271
2272 TC_METRIC_EVENT("events", "World initialized", "World initialized in " + std::to_string(startupDuration / 60000) + " minutes " + std::to_string((startupDuration % 60000) / 1000) + " seconds");
2273}
2274
2276{
2277 uint8 m_lang_confid = sConfigMgr->GetIntDefault("DBC.Locale", 255);
2278
2279 if (m_lang_confid != 255 && m_lang_confid >= TOTAL_LOCALES)
2280 {
2281 TC_LOG_ERROR("server.loading", "Incorrect DBC.Locale! Must be >= 0 and < {} (set to 0)", TOTAL_LOCALES);
2282 m_lang_confid = LOCALE_enUS;
2283 }
2284
2285 ChrRacesEntry const* race = sChrRacesStore.AssertEntry(1);
2286
2287 std::string availableLocalsStr;
2288
2289 uint8 default_locale = TOTAL_LOCALES;
2290 for (uint8 i = LOCALE_enUS; i < TOTAL_LOCALES; ++i)
2291 {
2292 if (race->Name[i][0] != '\0') // check by race names
2293 {
2294 // Mark the first found locale as default locale
2295 if (default_locale == TOTAL_LOCALES)
2296 default_locale = i;
2297
2298 m_availableDbcLocaleMask |= (1 << i);
2299 availableLocalsStr += localeNames[i];
2300 availableLocalsStr += " ";
2301 }
2302 }
2303
2304 if (m_availableDbcLocaleMask == 0)
2305 {
2306 TC_LOG_ERROR("server.loading", "Unable to determine your DBC Locale! (corrupt DBC?)");
2307 exit(1);
2308 }
2309
2310 if (default_locale != m_lang_confid && m_lang_confid < TOTAL_LOCALES &&
2311 (m_availableDbcLocaleMask & (1 << m_lang_confid)))
2312 {
2313 default_locale = m_lang_confid;
2314 }
2315
2316 m_defaultDbcLocale = LocaleConstant(default_locale);
2317
2318 TC_LOG_INFO("server.loading", "Using {} DBC Locale as default. All available DBC locales: {}", localeNames[m_defaultDbcLocale], availableLocalsStr.empty() ? "<none>" : availableLocalsStr);
2319}
2320
2322{
2323 uint32 oldMSTime = getMSTime();
2324
2325 m_Autobroadcasts.clear();
2327
2328 uint32 realmId = sConfigMgr->GetIntDefault("RealmID", 0);
2330 stmt->setInt32(0, realmId);
2331 PreparedQueryResult result = LoginDatabase.Query(stmt);
2332
2333 if (!result)
2334 {
2335 TC_LOG_INFO("server.loading", ">> Loaded 0 autobroadcasts definitions. DB table `autobroadcast` is empty for this realm!");
2336 return;
2337 }
2338
2339 uint32 count = 0;
2340
2341 do
2342 {
2343 Field* fields = result->Fetch();
2344 uint8 id = fields[0].GetUInt8();
2345
2346 m_Autobroadcasts[id] = fields[2].GetString();
2347 m_AutobroadcastsWeights[id] = fields[1].GetUInt8();
2348
2349 ++count;
2350 } while (result->NextRow());
2351
2352 TC_LOG_INFO("server.loading", ">> Loaded {} autobroadcast definitions in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
2353}
2354
2357{
2358 TC_METRIC_TIMER("world_update_time_total");
2361 time_t currentGameTime = GameTime::GetGameTime();
2362
2364
2366 for (int i = 0; i < WUPDATE_COUNT; ++i)
2367 {
2368 if (m_timers[i].GetCurrent() >= 0)
2369 m_timers[i].Update(diff);
2370 else
2371 m_timers[i].SetCurrent(0);
2372 }
2373
2375 if (m_timers[WUPDATE_WHO_LIST].Passed())
2376 {
2377 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Update who list"));
2379 sWhoListStorageMgr->Update();
2380 }
2381
2382 if (IsStopped() || m_timers[WUPDATE_CHANNEL_SAVE].Passed())
2383 {
2385
2386 if (sWorld->getBoolConfig(CONFIG_PRESERVE_CUSTOM_CHANNELS))
2387 {
2388 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Save custom channels"));
2390 mgr1->SaveToDB();
2392 if (mgr1 != mgr2)
2393 mgr2->SaveToDB();
2394 }
2395 }
2396
2397 {
2398 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Check quest reset times"));
2400 }
2401
2402 if (currentGameTime > m_NextRandomBGReset)
2403 {
2404 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Reset random BG"));
2405 ResetRandomBG();
2406 }
2407
2408 if (currentGameTime > m_NextCalendarOldEventsDeletionTime)
2409 {
2410 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Delete old calendar events"));
2412 }
2413
2414 if (currentGameTime > m_NextGuildReset)
2415 {
2416 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Reset guild cap"));
2417 ResetGuildCap();
2418 }
2419
2421 if (m_timers[WUPDATE_AUCTIONS].Passed())
2422 {
2423 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Update expired auctions"));
2425
2427 //(tested... works on win)
2429 {
2430 mail_timer = 0;
2431 sObjectMgr->ReturnOrDeleteOldMails(true);
2432 }
2433
2435 sAuctionMgr->Update();
2436 }
2437
2438 if (m_timers[WUPDATE_AUCTIONS_PENDING].Passed())
2439 {
2440 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Update pending auctions"));
2442
2443 sAuctionMgr->UpdatePendingAuctions();
2444 }
2445
2447 if (m_timers[WUPDATE_AHBOT].Passed())
2448 {
2449 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Update AHBot"));
2450 sAuctionBot->Update();
2452 }
2453
2455 if (m_timers[WUPDATE_CHECK_FILECHANGES].Passed())
2456 {
2457 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Update HotSwap"));
2458 sScriptReloadMgr->Update();
2460 }
2461
2462 {
2464 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Update sessions"));
2465 UpdateSessions(diff);
2466 }
2467
2469 if (m_timers[WUPDATE_UPTIME].Passed())
2470 {
2471 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Update uptime"));
2472 uint32 tmpDiff = GameTime::GetUptime();
2473 uint32 maxOnlinePlayers = GetMaxPlayerCount();
2474
2476
2478
2479 stmt->setUInt32(0, tmpDiff);
2480 stmt->setUInt16(1, uint16(maxOnlinePlayers));
2481 stmt->setUInt32(2, realm.Id.Realm);
2483
2484 LoginDatabase.Execute(stmt);
2485 }
2486
2488 if (sWorld->getIntConfig(CONFIG_LOGDB_CLEARTIME) > 0) // if not enabled, ignore the timer
2489 {
2490 if (m_timers[WUPDATE_CLEANDB].Passed())
2491 {
2492 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Clean logs table"));
2494
2496
2497 stmt->setUInt32(0, sWorld->getIntConfig(CONFIG_LOGDB_CLEARTIME));
2498 stmt->setUInt32(1, uint32(time(0)));
2499 stmt->setUInt32(2, realm.Id.Realm);
2500
2501 LoginDatabase.Execute(stmt);
2502 }
2503 }
2504
2507 {
2508 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Update maps"));
2509 sMapMgr->Update(diff);
2510 }
2511
2512 if (sWorld->getBoolConfig(CONFIG_AUTOBROADCAST))
2513 {
2514 if (m_timers[WUPDATE_AUTOBROADCAST].Passed())
2515 {
2516 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Send autobroadcast"));
2519 }
2520 }
2521
2522 {
2523 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Update battlegrounds"));
2524 sBattlegroundMgr->Update(diff);
2525 }
2526
2527 {
2528 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Update outdoor pvp"));
2529 sOutdoorPvPMgr->Update(diff);
2530 }
2531
2532 {
2533 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Update battlefields"));
2534 sBattlefieldMgr->Update(diff);
2535 }
2536
2538 if (m_timers[WUPDATE_DELETECHARS].Passed())
2539 {
2540 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Delete old characters"));
2543 }
2544
2545 {
2546 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Update groups"));
2547 sGroupMgr->Update(diff);
2548 }
2549
2550 {
2551 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Update LFG"));
2552 sLFGMgr->Update(diff);
2553 }
2554
2555 {
2556 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Process query callbacks"));
2557 // execute callbacks from sql queries that were queued recently
2559 }
2560
2562 if (m_timers[WUPDATE_CORPSES].Passed())
2563 {
2564 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Remove old corpses"));
2566 sMapMgr->DoForAllMaps([](Map* map)
2567 {
2568 map->RemoveOldCorpses();
2569 });
2570 }
2571
2573 if (m_timers[WUPDATE_EVENTS].Passed())
2574 {
2575 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Update game events"));
2576 m_timers[WUPDATE_EVENTS].Reset(); // to give time for Update() to be processed
2577 uint32 nextGameEvent = sGameEventMgr->Update();
2578 m_timers[WUPDATE_EVENTS].SetInterval(nextGameEvent);
2580 }
2581
2583 if (m_timers[WUPDATE_PINGDB].Passed())
2584 {
2585 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Ping MySQL"));
2587 TC_LOG_DEBUG("sql.driver", "Ping MySQL to keep connection alive");
2588 CharacterDatabase.KeepAlive();
2589 LoginDatabase.KeepAlive();
2590 WorldDatabase.KeepAlive();
2591 }
2592
2593 {
2594 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Update instance reset times"));
2595 // update the instance reset times
2596 sInstanceSaveMgr->Update();
2597 }
2598
2599 // Check for shutdown warning
2600 if (_guidWarn && !_guidAlert)
2601 {
2602 _warnDiff += diff;
2607 }
2608
2609 {
2610 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Process cli commands"));
2611 // And last, but not least handle the issued cli commands
2613 }
2614
2615 {
2616 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Update world scripts"));
2617 sScriptMgr->OnWorldUpdate(diff);
2618 }
2619
2620 {
2621 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Update metrics"));
2622 // Stats logger update
2623 sMetric->Update();
2624 TC_METRIC_VALUE("update_time_diff", diff);
2625 }
2626}
2627
2629{
2630 m_timers[WUPDATE_EVENTS].Reset(); // to give time for Update() to be processed
2631 uint32 nextGameEvent = sGameEventMgr->Update();
2632 m_timers[WUPDATE_EVENTS].SetInterval(nextGameEvent);
2634}
2635
2638{
2639 SessionMap::const_iterator itr;
2640 for (itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
2641 {
2642 if (itr->second &&
2643 itr->second->GetPlayer() &&
2644 itr->second->GetPlayer()->IsInWorld() &&
2645 itr->second != self &&
2646 (team == 0 || itr->second->GetPlayer()->GetTeam() == team))
2647 {
2648 itr->second->SendPacket(packet);
2649 }
2650 }
2651}
2652
2655{
2656 for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
2657 {
2658 // check if session and can receive global GM Messages and its not self
2659 WorldSession* session = itr->second;
2660 if (!session || session == self || !session->HasPermission(rbac::RBAC_PERM_RECEIVE_GLOBAL_GM_TEXTMESSAGE))
2661 continue;
2662
2663 // Player should be in world
2664 Player* player = session->GetPlayer();
2665 if (!player || !player->IsInWorld())
2666 continue;
2667
2668 // Send only to same team, if team is given
2669 if (!team || player->GetTeam() == team)
2670 session->SendPacket(packet);
2671 }
2672}
2673
2674namespace Trinity
2675{
2677 {
2678 public:
2679 typedef std::vector<WorldPacket*> WorldPacketList;
2680 explicit WorldWorldTextBuilder(uint32 textId, va_list* args = nullptr) : i_textId(textId), i_args(args) { }
2682 {
2683 char const* text = sObjectMgr->GetTrinityString(i_textId, loc_idx);
2684
2685 if (i_args)
2686 {
2687 // we need copy va_list before use or original va_list will corrupted
2688 va_list ap;
2689 va_copy(ap, *i_args);
2690
2691 char str[2048];
2692 vsnprintf(str, 2048, text, ap);
2693 va_end(ap);
2694
2695 do_helper(data_list, &str[0]);
2696 }
2697 else
2698 do_helper(data_list, (char*)text);
2699 }
2700 private:
2701 char* lineFromMessage(char*& pos) { char* start = strtok(pos, "\n"); pos = nullptr; return start; }
2702 void do_helper(WorldPacketList& data_list, char* text)
2703 {
2704 char* pos = text;
2705 while (char* line = lineFromMessage(pos))
2706 {
2707 WorldPacket* data = new WorldPacket();
2708 ChatHandler::BuildChatPacket(*data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, nullptr, nullptr, line);
2709 data_list.push_back(data);
2710 }
2711 }
2712
2714 va_list* i_args;
2715 };
2716} // namespace Trinity
2717
2719void World::SendWorldText(uint32 string_id, ...)
2720{
2721 va_list ap;
2722 va_start(ap, string_id);
2723
2724 Trinity::WorldWorldTextBuilder wt_builder(string_id, &ap);
2726 for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
2727 {
2728 if (!itr->second || !itr->second->GetPlayer() || !itr->second->GetPlayer()->IsInWorld())
2729 continue;
2730
2731 wt_do(itr->second->GetPlayer());
2732 }
2733
2734 va_end(ap);
2735}
2736
2738void World::SendGMText(uint32 string_id, ...)
2739{
2740 va_list ap;
2741 va_start(ap, string_id);
2742
2743 Trinity::WorldWorldTextBuilder wt_builder(string_id, &ap);
2745 for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
2746 {
2747 // Session should have permissions to receive global gm messages
2748 WorldSession* session = itr->second;
2750 continue;
2751
2752 // Player should be in world
2753 Player* player = session->GetPlayer();
2754 if (!player || !player->IsInWorld())
2755 continue;
2756
2757 wt_do(player);
2758 }
2759
2760 va_end(ap);
2761}
2762
2764void World::SendGlobalText(char const* text, WorldSession* self)
2765{
2766 WorldPacket data;
2767
2768 // need copy to prevent corruption by strtok call in LineFromMessage original string
2769 char* buf = strdup(text);
2770 char* pos = buf;
2771
2772 while (char* line = ChatHandler::LineFromMessage(pos))
2773 {
2774 ChatHandler::BuildChatPacket(data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, nullptr, nullptr, line);
2775 SendGlobalMessage(&data, self);
2776 }
2777
2778 free(buf);
2779}
2780
2783{
2784 m_QueuedPlayer.clear(); // prevent send queue update packet and login queued sessions
2785
2786 // session not removed at kick and will removed in next update tick
2787 for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
2788 itr->second->KickPlayer("World::KickAll");
2789}
2790
2793{
2794 // session not removed at kick and will removed in next update tick
2795 for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
2796 if (itr->second->GetSecurity() < sec)
2797 itr->second->KickPlayer("World::KickAllLess");
2798}
2799
2801BanReturn World::BanAccount(BanMode mode, std::string const& nameOrIP, std::string const& duration, std::string const& reason, std::string const& author)
2802{
2803 uint32 duration_secs = TimeStringToSecs(duration);
2804 return BanAccount(mode, nameOrIP, duration_secs, reason, author);
2805}
2806
2808BanReturn World::BanAccount(BanMode mode, std::string const& nameOrIP, uint32 duration_secs, std::string const& reason, std::string const& author)
2809{
2810 PreparedQueryResult resultAccounts = PreparedQueryResult(nullptr); //used for kicking
2811
2812 // Prevent banning an already banned account
2813 if (mode == BAN_ACCOUNT && AccountMgr::IsBannedAccount(nameOrIP))
2814 return BAN_EXISTS;
2815
2817 switch (mode)
2818 {
2819 case BAN_IP:
2820 {
2821 // No SQL injection with prepared statements
2823 stmt->setString(0, nameOrIP);
2824 resultAccounts = LoginDatabase.Query(stmt);
2825 stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_IP_BANNED);
2826 stmt->setString(0, nameOrIP);
2827 stmt->setUInt32(1, duration_secs);
2828 stmt->setString(2, author);
2829 stmt->setString(3, reason);
2830 LoginDatabase.Execute(stmt);
2831 break;
2832 }
2833 case BAN_ACCOUNT:
2834 {
2835 // No SQL injection with prepared statements
2837 stmt->setString(0, nameOrIP);
2838 resultAccounts = LoginDatabase.Query(stmt);
2839 break;
2840 }
2841 case BAN_CHARACTER:
2842 {
2843 // No SQL injection with prepared statements
2845 stmt->setString(0, nameOrIP);
2846 resultAccounts = CharacterDatabase.Query(stmt);
2847 break;
2848 }
2849 default:
2850 return BAN_SYNTAX_ERROR;
2851 }
2852
2853 if (!resultAccounts)
2854 {
2855 if (mode == BAN_IP)
2856 return BAN_SUCCESS; // ip correctly banned but nobody affected (yet)
2857 else
2858 return BAN_NOTFOUND; // Nobody to ban
2859 }
2860
2862 LoginDatabaseTransaction trans = LoginDatabase.BeginTransaction();
2863 do
2864 {
2865 Field* fieldsAccount = resultAccounts->Fetch();
2866 uint32 account = fieldsAccount[0].GetUInt32();
2867
2868 if (mode != BAN_IP)
2869 {
2870 // make sure there is only one active ban
2872 stmt->setUInt32(0, account);
2873 trans->Append(stmt);
2874 // No SQL injection with prepared statements
2875 stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_ACCOUNT_BANNED);
2876 stmt->setUInt32(0, account);
2877 stmt->setUInt32(1, duration_secs);
2878 stmt->setString(2, author);
2879 stmt->setString(3, reason);
2880 trans->Append(stmt);
2881 }
2882
2883 if (WorldSession* sess = FindSession(account))
2884 if (std::string(sess->GetPlayerName()) != author)
2885 sess->KickPlayer("World::BanAccount Banning account");
2886 } while (resultAccounts->NextRow());
2887
2888 LoginDatabase.CommitTransaction(trans);
2889
2890 return BAN_SUCCESS;
2891}
2892
2894bool World::RemoveBanAccount(BanMode mode, std::string const& nameOrIP)
2895{
2896 LoginDatabasePreparedStatement* stmt = nullptr;
2897 if (mode == BAN_IP)
2898 {
2899 stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_IP_NOT_BANNED);
2900 stmt->setString(0, nameOrIP);
2901 LoginDatabase.Execute(stmt);
2902 }
2903 else
2904 {
2905 uint32 account = 0;
2906 if (mode == BAN_ACCOUNT)
2907 account = AccountMgr::GetId(nameOrIP);
2908 else if (mode == BAN_CHARACTER)
2909 account = sCharacterCache->GetCharacterAccountIdByName(nameOrIP);
2910
2911 if (!account)
2912 return false;
2913
2914 //NO SQL injection as account is uint32
2915 stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_ACCOUNT_NOT_BANNED);
2916 stmt->setUInt32(0, account);
2917 LoginDatabase.Execute(stmt);
2918 }
2919 return true;
2920}
2921
2923BanReturn World::BanCharacter(std::string const& name, std::string const& duration, std::string const& reason, std::string const& author)
2924{
2926 ObjectGuid::LowType guid = 0;
2927
2928 uint32 duration_secs = TimeStringToSecs(duration);
2929
2931 if (!banned)
2932 {
2933 ObjectGuid fullGuid = sCharacterCache->GetCharacterGuidByName(name);
2934 if (fullGuid.IsEmpty())
2935 return BAN_NOTFOUND; // Nobody to ban
2936
2937 guid = fullGuid.GetCounter();
2938 }
2939 else
2940 guid = banned->GetGUID().GetCounter();
2941 //Use transaction in order to ensure the order of the queries
2942 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
2943 // make sure there is only one active ban
2945 stmt->setUInt32(0, guid);
2946 trans->Append(stmt);
2947
2948 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_BAN);
2949 stmt->setUInt32(0, guid);
2950 stmt->setUInt32(1, duration_secs);
2951 stmt->setString(2, author);
2952 stmt->setString(3, reason);
2953 trans->Append(stmt);
2954 CharacterDatabase.CommitTransaction(trans);
2955
2956 if (banned)
2957 banned->GetSession()->KickPlayer("World::BanCharacter Banning character");
2958
2959 return BAN_SUCCESS;
2960}
2961
2963bool World::RemoveBanCharacter(std::string const& name)
2964{
2966 ObjectGuid::LowType guid = 0;
2967
2969 if (!banned)
2970 {
2971 ObjectGuid fullGuid = sCharacterCache->GetCharacterGuidByName(name);
2972 if (fullGuid.IsEmpty())
2973 return false;
2974
2975 guid = fullGuid.GetCounter();
2976 }
2977 else
2978 guid = banned->GetGUID().GetCounter();
2979
2980 if (!guid)
2981 return false;
2982
2984 stmt->setUInt32(0, guid);
2985 CharacterDatabase.Execute(stmt);
2986 return true;
2987}
2988
2991{
2993 time_t lastGameTime = GameTime::GetGameTime();
2995
2996 uint32 elapsed = uint32(GameTime::GetGameTime() - lastGameTime);
2997
2999 if (!IsStopped() && m_ShutdownTimer > 0 && elapsed > 0)
3000 {
3002 if (m_ShutdownTimer <= elapsed)
3003 {
3005 m_stopEvent = true; // exist code already set
3006 else
3007 m_ShutdownTimer = 1; // minimum timer value to wait idle state
3008 }
3010 else
3011 {
3012 m_ShutdownTimer -= elapsed;
3013
3014 ShutdownMsg();
3015 }
3016 }
3017}
3018
3020void World::ShutdownServ(uint32 time, uint32 options, uint8 exitcode, const std::string& reason)
3021{
3022 // ignore if server shutdown at next tick
3023 if (IsStopped())
3024 return;
3025
3026 m_ShutdownMask = options;
3027 m_ExitCode = exitcode;
3028
3030 if (time == 0)
3031 m_ShutdownTimer = 1;
3033 else
3034 {
3035 m_ShutdownTimer = time;
3036 ShutdownMsg(true, nullptr, reason);
3037 }
3038
3039 sScriptMgr->OnShutdownInitiate(ShutdownExitCode(exitcode), ShutdownMask(options));
3040}
3041
3043void World::ShutdownMsg(bool show, Player* player, const std::string& reason)
3044{
3045 // not show messages for idle shutdown mode
3047 return;
3048
3050 if (show ||
3051 (m_ShutdownTimer < 5* MINUTE && (m_ShutdownTimer % 15) == 0) || // < 5 min; every 15 sec
3052 (m_ShutdownTimer < 15 * MINUTE && (m_ShutdownTimer % MINUTE) == 0) || // < 15 min ; every 1 min
3053 (m_ShutdownTimer < 30 * MINUTE && (m_ShutdownTimer % (5 * MINUTE)) == 0) || // < 30 min ; every 5 min
3054 (m_ShutdownTimer < 12 * HOUR && (m_ShutdownTimer % HOUR) == 0) || // < 12 h ; every 1 h
3055 (m_ShutdownTimer > 12 * HOUR && (m_ShutdownTimer % (12 * HOUR)) == 0)) // > 12 h ; every 12 h
3056 {
3058 if (!reason.empty())
3059 str += " - " + reason;
3060
3062
3063 SendServerMessage(msgid, str, player);
3064 TC_LOG_DEBUG("misc", "Server is {} in {}", (m_ShutdownMask & SHUTDOWN_MASK_RESTART ? "restart" : "shuttingdown"), str);
3065 }
3066}
3067
3070{
3071 // nothing cancel or too late
3073 return 0;
3074
3076
3077 uint32 oldTimer = m_ShutdownTimer;
3078 m_ShutdownMask = 0;
3079 m_ShutdownTimer = 0;
3080 m_ExitCode = SHUTDOWN_EXIT_CODE; // to default value
3081 SendServerMessage(msgid);
3082
3083 TC_LOG_DEBUG("misc", "Server {} cancelled.", (m_ShutdownMask & SHUTDOWN_MASK_RESTART ? "restart" : "shutdown"));
3084
3085 sScriptMgr->OnShutdownCancel();
3086 return oldTimer;
3087}
3088
3090void World::SendServerMessage(ServerMessageType messageID, std::string stringParam /*= ""*/, Player* player /*= nullptr*/)
3091{
3092 WorldPackets::Chat::ChatServerMessage chatServerMessage;
3093 chatServerMessage.MessageID = int32(messageID);
3094 if (messageID <= SERVER_MSG_STRING)
3095 chatServerMessage.StringParam = stringParam;
3096
3097 if (player)
3098 player->SendDirectMessage(chatServerMessage.Write());
3099 else
3100 SendGlobalMessage(chatServerMessage.Write());
3101}
3102
3104{
3105 {
3106 TC_METRIC_DETAILED_NO_THRESHOLD_TIMER("world_update_time",
3107 TC_METRIC_TAG("type", "Add sessions"),
3108 TC_METRIC_TAG("parent_type", "Update sessions"));
3110 WorldSession* sess = nullptr;
3111 while (addSessQueue.next(sess))
3112 AddSession_(sess);
3113 }
3114
3116 for (SessionMap::iterator itr = m_sessions.begin(), next; itr != m_sessions.end(); itr = next)
3117 {
3118 next = itr;
3119 ++next;
3120
3122 WorldSession* pSession = itr->second;
3123 WorldSessionFilter updater(pSession);
3124
3125 [[maybe_unused]] uint32 currentSessionId = itr->first;
3126 TC_METRIC_DETAILED_TIMER("world_update_sessions_time", TC_METRIC_TAG("account_id", std::to_string(currentSessionId)));
3127
3128 if (!pSession->Update(diff, updater)) // As interval = 0
3129 {
3130 if (!RemoveQueuedPlayer(itr->second) && itr->second && getIntConfig(CONFIG_INTERVAL_DISCONNECT_TOLERANCE))
3131 m_disconnects[itr->second->GetAccountId()] = GameTime::GetGameTime();
3132 RemoveQueuedPlayer(pSession);
3133 m_sessions.erase(itr);
3134 delete pSession;
3135
3136 }
3137 }
3138}
3139
3140// This handles the issued and queued CLI commands
3142{
3143 CliCommandHolder::Print zprint = nullptr;
3144 void* callbackArg = nullptr;
3145 CliCommandHolder* command = nullptr;
3146 while (cliCmdQueue.next(command))
3147 {
3148 TC_LOG_INFO("misc", "CLI command under processing...");
3149 zprint = command->m_print;
3150 callbackArg = command->m_callbackArg;
3151 CliHandler handler(callbackArg, zprint);
3152 handler.ParseCommands(command->m_command);
3153 if (command->m_commandFinished)
3154 command->m_commandFinished(callbackArg, !handler.HasSentErrorMessage());
3155 delete command;
3156 }
3157}
3158
3160{
3161 if (m_Autobroadcasts.empty())
3162 return;
3163
3164 uint32 weight = 0;
3165 AutobroadcastsWeightMap selectionWeights;
3166 std::string msg;
3167
3168 for (AutobroadcastsWeightMap::const_iterator it = m_AutobroadcastsWeights.begin(); it != m_AutobroadcastsWeights.end(); ++it)
3169 {
3170 if (it->second)
3171 {
3172 weight += it->second;
3173 selectionWeights[it->first] = it->second;
3174 }
3175 }
3176
3177 if (weight)
3178 {
3179 uint32 selectedWeight = urand(0, weight - 1);
3180 weight = 0;
3181 for (AutobroadcastsWeightMap::const_iterator it = selectionWeights.begin(); it != selectionWeights.end(); ++it)
3182 {
3183 weight += it->second;
3184 if (selectedWeight < weight)
3185 {
3186 msg = m_Autobroadcasts[it->first];
3187 break;
3188 }
3189 }
3190 }
3191 else
3192 msg = m_Autobroadcasts[urand(0, m_Autobroadcasts.size())];
3193
3194 uint32 abcenter = sWorld->getIntConfig(CONFIG_AUTOBROADCAST_CENTER);
3195
3196 if (abcenter == 0)
3197 sWorld->SendWorldText(LANG_AUTO_BROADCAST, msg.c_str());
3198 else if (abcenter == 1)
3199 {
3200 WorldPacket data(SMSG_NOTIFICATION, (msg.size()+1));
3201 data << msg;
3202 sWorld->SendGlobalMessage(&data);
3203 }
3204 else if (abcenter == 2)
3205 {
3206 sWorld->SendWorldText(LANG_AUTO_BROADCAST, msg.c_str());
3207
3208 WorldPacket data(SMSG_NOTIFICATION, (msg.size()+1));
3209 data << msg;
3210 sWorld->SendGlobalMessage(&data);
3211 }
3212
3213 TC_LOG_DEBUG("misc", "AutoBroadcast: '{}'", msg);
3214}
3215
3217{
3219 stmt->setUInt32(0, accountId);
3220 _queryProcessor.AddCallback(CharacterDatabase.AsyncQuery(stmt).WithPreparedCallback(std::bind(&World::_UpdateRealmCharCount, this, std::placeholders::_1)));
3221}
3222
3224{
3225 if (resultCharCount)
3226 {
3227 Field* fields = resultCharCount->Fetch();
3228 uint32 accountId = fields[0].GetUInt32();
3229 uint8 charCount = uint8(fields[1].GetUInt64());
3230
3231 LoginDatabaseTransaction trans = LoginDatabase.BeginTransaction();
3232
3234 stmt->setUInt8(0, charCount);
3235 stmt->setUInt32(1, accountId);
3236 stmt->setUInt32(2, realm.Id.Realm);
3237 trans->Append(stmt);
3238
3239 LoginDatabase.CommitTransaction(trans);
3240 }
3241}
3242
3249
3250static time_t GetNextDailyResetTime(time_t t)
3251{
3252 return GetLocalHourTimestamp(t, sWorld->getIntConfig(CONFIG_DAILY_QUEST_RESET_TIME_HOUR), true);
3253}
3254
3256{
3257 // reset all saved quest status
3259 CharacterDatabase.Execute(stmt);
3260 // reset all quest status in memory
3261 for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
3262 if (Player* player = itr->second->GetPlayer())
3263 player->ResetDailyQuestStatus();
3264
3265 // reselect pools
3266 sQuestPoolMgr->ChangeDailyQuests();
3267
3268 // store next reset time
3269 time_t now = GameTime::GetGameTime();
3270 time_t next = GetNextDailyResetTime(now);
3271 ASSERT(now < next);
3272
3273 m_NextDailyQuestReset = next;
3274 sWorld->setWorldState(WS_DAILY_QUEST_RESET_TIME, uint64(next));
3275
3276 TC_LOG_INFO("misc", "Daily quests for all characters have been reset.");
3277}
3278
3279static time_t GetNextWeeklyResetTime(time_t t)
3280{
3281 t = GetNextDailyResetTime(t);
3282 tm time = TimeBreakdown(t);
3283 int wday = time.tm_wday;
3284 int target = sWorld->getIntConfig(CONFIG_WEEKLY_QUEST_RESET_TIME_WDAY);
3285 if (target < wday)
3286 wday -= 7;
3287 t += (DAY * (target - wday));
3288 return t;
3289}
3290
3292{
3293 // reset all saved quest status
3295 CharacterDatabase.Execute(stmt);
3296 // reset all quest status in memory
3297 for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
3298 if (Player* player = itr->second->GetPlayer())
3299 player->ResetWeeklyQuestStatus();
3300
3301 // reselect pools
3302 sQuestPoolMgr->ChangeWeeklyQuests();
3303
3304 // store next reset time
3305 time_t now = GameTime::GetGameTime();
3306 time_t next = GetNextWeeklyResetTime(now);
3307 ASSERT(now < next);
3308
3310 sWorld->setWorldState(WS_WEEKLY_QUEST_RESET_TIME, uint64(next));
3311
3312 TC_LOG_INFO("misc", "Weekly quests for all characters have been reset.");
3313}
3314
3315static time_t GetNextMonthlyResetTime(time_t t)
3316{
3317 t = GetNextDailyResetTime(t);
3318 tm time = TimeBreakdown(t);
3319 if (time.tm_mday == 1)
3320 return t;
3321
3322 time.tm_mday = 1;
3323 time.tm_mon += 1;
3324 return mktime(&time);
3325}
3326
3328{
3329 // reset all saved quest status
3331 CharacterDatabase.Execute(stmt);
3332 // reset all quest status in memory
3333 for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
3334 if (Player* player = itr->second->GetPlayer())
3335 player->ResetMonthlyQuestStatus();
3336
3337 // reselect pools
3338 sQuestPoolMgr->ChangeMonthlyQuests();
3339
3340 // store next reset time
3341 time_t now = GameTime::GetGameTime();
3342 time_t next = GetNextMonthlyResetTime(now);
3343 ASSERT(now < next);
3344
3346 sWorld->setWorldState(WS_MONTHLY_QUEST_RESET_TIME, uint64(next));
3347
3348 TC_LOG_INFO("misc", "Monthly quests for all characters have been reset.");
3349}
3350
3352{
3353 time_t const now = GameTime::GetGameTime();
3354 if (m_NextDailyQuestReset <= now)
3356 if (m_NextWeeklyQuestReset <= now)
3358 if (m_NextMonthlyQuestReset <= now)
3360}
3361
3363{
3364 time_t bgtime = uint64(sWorld->getWorldState(WS_BG_DAILY_RESET_TIME));
3365 if (!bgtime)
3366 m_NextRandomBGReset = GameTime::GetGameTime(); // game time not yet init
3367
3368 // generate time by config
3369 time_t curTime = GameTime::GetGameTime();
3370 tm localTm;
3371 localtime_r(&curTime, &localTm);
3372 localTm.tm_hour = getIntConfig(CONFIG_RANDOM_BG_RESET_HOUR);
3373 localTm.tm_min = 0;
3374 localTm.tm_sec = 0;
3375
3376 // current day reset time
3377 time_t nextDayResetTime = mktime(&localTm);
3378
3379 // next reset time before current moment
3380 if (curTime >= nextDayResetTime)
3381 nextDayResetTime += DAY;
3382
3383 // normalize reset time
3384 m_NextRandomBGReset = bgtime < curTime ? nextDayResetTime - DAY : nextDayResetTime;
3385
3386 if (!bgtime)
3388}
3389
3391{
3392 time_t now = GameTime::GetGameTime();
3394 time_t currentDeletionTime = getWorldState(WS_DAILY_CALENDAR_DELETION_OLD_EVENTS_TIME);
3395
3396 // If the reset time saved in the worldstate is before now it means the server was offline when the reset was supposed to occur.
3397 // In this case we set the reset time in the past and next world update will do the reset and schedule next one in the future.
3398 if (currentDeletionTime < now)
3399 m_NextCalendarOldEventsDeletionTime = nextDeletionTime - DAY;
3400 else
3401 m_NextCalendarOldEventsDeletionTime = nextDeletionTime;
3402
3403 if (!currentDeletionTime)
3405}
3406
3408{
3410 if (!gtime)
3411 m_NextGuildReset = GameTime::GetGameTime(); // game time not yet init
3412
3413 // generate time by config
3414 time_t curTime = GameTime::GetGameTime();
3415 tm localTm;
3416 localtime_r(&curTime, &localTm);
3417 localTm.tm_hour = getIntConfig(CONFIG_GUILD_RESET_HOUR);
3418 localTm.tm_min = 0;
3419 localTm.tm_sec = 0;
3420
3421 // current day reset time
3422 time_t nextDayResetTime = mktime(&localTm);
3423
3424 // next reset time before current moment
3425 if (curTime >= nextDayResetTime)
3426 nextDayResetTime += DAY;
3427
3428 // normalize reset time
3429 m_NextGuildReset = gtime < curTime ? nextDayResetTime - DAY : nextDayResetTime;
3430
3431 if (!gtime)
3433}
3434
3435void World::ResetEventSeasonalQuests(uint16 event_id, time_t eventStartTime)
3436{
3437 TC_LOG_INFO("misc", "Seasonal quests reset for all characters.");
3438
3440 stmt->setUInt16(0, event_id);
3441 stmt->setInt64(1, eventStartTime);
3442 CharacterDatabase.Execute(stmt);
3443
3444 for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
3445 if (itr->second->GetPlayer())
3446 itr->second->GetPlayer()->ResetSeasonalQuestStatus(event_id, eventStartTime);
3447}
3448
3450{
3451 TC_LOG_INFO("misc", "Random BG status reset for all characters.");
3452
3454 CharacterDatabase.Execute(stmt);
3455
3456 for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
3457 if (itr->second->GetPlayer())
3458 itr->second->GetPlayer()->SetRandomWinner(false);
3459
3462}
3463
3465{
3466 TC_LOG_INFO("misc", "Calendar deletion of old events.");
3467
3470 sCalendarMgr->DeleteOldEvents();
3471}
3472
3474{
3475 TC_LOG_INFO("misc", "Guild Daily Cap reset.");
3476
3479 sGuildMgr->ResetTimes();
3480}
3481
3487
3489{
3490 QueryResult result = WorldDatabase.Query("SELECT db_version, cache_id FROM version LIMIT 1");
3491 if (result)
3492 {
3493 Field* fields = result->Fetch();
3494
3495 m_DBVersion = fields[0].GetString();
3496 // will be overwrite by config values if different and non-0
3498 }
3499
3500 if (m_DBVersion.empty())
3501 m_DBVersion = "Unknown world database.";
3502}
3503
3505{
3506 SessionMap::const_iterator itr;
3507 for (itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
3508 if (itr->second && itr->second->GetPlayer() && itr->second->GetPlayer()->IsInWorld())
3509 {
3510 itr->second->GetPlayer()->UpdateAreaDependentAuras(itr->second->GetPlayer()->GetAreaId());
3511 itr->second->GetPlayer()->UpdateZoneDependentAuras(itr->second->GetPlayer()->GetZoneId());
3512 }
3513}
3514
3516{
3517 uint32 oldMSTime = getMSTime();
3518
3519 QueryResult result = CharacterDatabase.Query("SELECT entry, value FROM worldstates");
3520
3521 if (!result)
3522 {
3523 TC_LOG_INFO("server.loading", ">> Loaded 0 world states. DB table `worldstates` is empty!");
3524
3525 return;
3526 }
3527
3528 uint32 count = 0;
3529
3530 do
3531 {
3532 Field* fields = result->Fetch();
3533 m_worldstates[fields[0].GetUInt32()] = fields[1].GetUInt32();
3534 ++count;
3535 }
3536 while (result->NextRow());
3537
3538 TC_LOG_INFO("server.loading", ">> Loaded {} world states in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
3539
3540}
3541
3546
3551
3552// Setting a worldstate will save it to DB
3554{
3555 WorldStatesMap::const_iterator it = m_worldstates.find(index);
3556 if (it != m_worldstates.end())
3557 {
3558 if (it->second == value)
3559 return;
3560
3562
3563 stmt->setUInt32(0, uint32(value));
3564 stmt->setUInt32(1, index);
3565
3566 CharacterDatabase.Execute(stmt);
3567 }
3568 else
3569 {
3571
3572 stmt->setUInt32(0, index);
3573 stmt->setUInt32(1, uint32(value));
3574
3575 CharacterDatabase.Execute(stmt);
3576 }
3577 m_worldstates[index] = value;
3578}
3579
3581{
3582 WorldStatesMap::const_iterator it = m_worldstates.find(index);
3583 return it != m_worldstates.end() ? it->second : 0;
3584}
3585
3590
3592{
3593 // Passive reload, we mark the data as invalidated and next time a permission is checked it will be reloaded
3594 TC_LOG_INFO("rbac", "World::ReloadRBAC()");
3595 for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
3596 if (WorldSession* session = itr->second)
3597 session->InvalidateRBACData();
3598}
3599
3604
3606
3607CliCommandHolder::CliCommandHolder(void* callbackArg, char const* command, Print zprint, CommandFinished commandFinished)
3608 : m_callbackArg(callbackArg), m_command(strdup(command)), m_print(zprint), m_commandFinished(commandFinished)
3609{
3610}
3611
#define sAccountMgr
Definition AccountMgr.h:96
#define sAchievementMgr
#define sArenaTeamMgr
#define sAuctionBot
#define sAuctionMgr
#define sBattlefieldMgr
#define sBattlegroundMgr
#define sCalendarMgr
#define sCharacterCache
@ CHAR_DEL_RESET_CHARACTER_QUESTSTATUS_MONTHLY
@ CHAR_INS_CHARACTER_BAN
@ CHAR_UPD_CHARACTER_BAN
@ CHAR_SEL_ACCOUNT_BY_NAME
@ CHAR_SEL_CHARACTER_COUNT
@ CHAR_DEL_RESET_CHARACTER_QUESTSTATUS_SEASONAL_BY_EVENT
@ CHAR_DEL_RESET_CHARACTER_QUESTSTATUS_DAILY
@ CHAR_DEL_BATTLEGROUND_RANDOM_ALL
@ CHAR_INS_WORLDSTATE
@ CHAR_DEL_RESET_CHARACTER_QUESTSTATUS_WEEKLY
@ CHAR_UPD_WORLDSTATE
char const * localeNames[TOTAL_LOCALES]
Definition Common.cpp:20
LocaleConstant
Definition Common.h:48
@ TOTAL_LOCALES
Definition Common.h:59
@ LOCALE_enUS
Definition Common.h:49
@ IN_MILLISECONDS
Definition Common.h:35
@ MINUTE
Definition Common.h:29
@ HOUR
Definition Common.h:30
@ DAY
Definition Common.h:31
AccountTypes
Definition Common.h:39
@ SEC_PLAYER
Definition Common.h:40
@ SEC_ADMINISTRATOR
Definition Common.h:43
@ SEC_CONSOLE
Definition Common.h:44
#define sConditionMgr
#define sConfigMgr
Definition Config.h:60
#define sFormationMgr
#define sCreatureTextMgr
@ DEFAULT_MAX_LEVEL
Definition DBCEnums.h:45
@ MAX_LEVEL
Definition DBCEnums.h:49
uint32 GetLiquidFlags(uint32 liquidType)
DBCStorage< ChrRacesEntry > sChrRacesStore(ChrRacesEntryfmt)
DBCStorage< MapEntry > sMapStore(MapEntryfmt)
void LoadDBCStores(const std::string &dataPath)
SQLTransaction< CharacterDatabaseConnection > CharacterDatabaseTransaction
SQLTransaction< LoginDatabaseConnection > LoginDatabaseTransaction
std::shared_ptr< ResultSet > QueryResult
std::shared_ptr< PreparedResultSet > PreparedQueryResult
DatabaseWorkerPool< LoginDatabaseConnection > LoginDatabase
Accessor to the realm/login database.
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
DatabaseWorkerPool< WorldDatabaseConnection > WorldDatabase
Accessor to the world database.
#define TC_GAME_API
Definition Define.h:114
uint8_t uint8
Definition Define.h:135
int32_t int32
Definition Define.h:129
uint64_t uint64
Definition Define.h:132
uint16_t uint16
Definition Define.h:134
uint32_t uint32
Definition Define.h:133
#define ASSERT_NOTNULL(pointer)
Definition Errors.h:84
#define ASSERT
Definition Errors.h:68
#define sGameEventMgr
void LoadGameObjectModelList(std::string const &dataPath)
#define MIN_GRID_DELAY
Definition GridDefines.h:43
#define MIN_MAP_UPDATE_DELAY
Definition GridDefines.h:44
#define sGroupMgr
Definition GroupMgr.h:58
#define sGuildMgr
Definition GuildMgr.h:59
#define sIPLocation
Definition IPLocation.h:48
#define sInstanceSaveMgr
void LoadRandomEnchantmentsTable()
#define sLFGMgr
Definition LFGMgr.h:492
@ LANG_AUTO_BROADCAST
Definition Language.h:1217
#define TC_LOG_DEBUG(filterType__,...)
Definition Log.h:156
#define TC_LOG_ERROR(filterType__,...)
Definition Log.h:165
#define sLog
Definition Log.h:130
#define TC_LOG_INFO(filterType__,...)
Definition Log.h:159
#define TC_LOG_FATAL(filterType__,...)
Definition Log.h:168
@ LOGIN_INS_ACCOUNT_BANNED
@ LOGIN_SEL_ACCOUNT_BY_IP
@ LOGIN_UPD_UPTIME_PLAYERS
@ LOGIN_DEL_IP_NOT_BANNED
@ LOGIN_REP_REALM_CHARACTERS
@ LOGIN_INS_IP_BANNED
@ LOGIN_SEL_REALMLIST_SECURITY_LEVEL
@ LOGIN_UPD_ACCOUNT_NOT_BANNED
@ LOGIN_SEL_AUTOBROADCAST
@ LOGIN_SEL_ACCOUNT_ID_BY_NAME
@ LOGIN_DEL_OLD_LOGS
#define sLootItemStorage
void LoadLootTables()
Definition LootMgr.cpp:1149
void LoadM2Cameras(std::string const &dataPath)
Definition M2Stores.cpp:174
#define sMapMgr
Definition MapManager.h:211
void dtCustomFree(void *ptr)
Definition Memory.h:29
void * dtCustomAlloc(size_t size, dtAllocHint)
Definition Memory.h:24
#define TC_METRIC_DETAILED_TIMER(category,...)
Definition Metric.h:230
#define sMetric
Definition Metric.h:138
#define TC_METRIC_VALUE(category, value,...)
Definition Metric.h:203
#define TC_METRIC_EVENT(category, title, description)
Definition Metric.h:195
#define TC_METRIC_TAG(name, value)
Definition Metric.h:169
#define TC_METRIC_DETAILED_NO_THRESHOLD_TIMER(category,...)
Definition Metric.h:231
#define TC_METRIC_TIMER(category,...)
Definition Metric.h:212
#define DEFAULT_VISIBILITY_NOTIFY_PERIOD
Definition NGrid.h:29
#define MAX_VISIBILITY_DISTANCE
#define DEFAULT_VISIBILITY_DISTANCE
#define DEFAULT_VISIBILITY_BGARENAS
#define DEFAULT_VISIBILITY_INSTANCE
#define MAX_PLAYER_NAME
Definition ObjectMgr.h:876
#define MAX_CHARTER_NAME
Definition ObjectMgr.h:879
@ QUERY_DATA_ALL
Definition ObjectMgr.h:924
#define sObjectMgr
Definition ObjectMgr.h:1721
#define MAX_PET_NAME
Definition ObjectMgr.h:878
#define sOutdoorPvPMgr
#define sPetitionMgr
Definition PetitionMgr.h:86
uint32 const MAX_MONEY_AMOUNT
Definition Player.cpp:119
#define sPoolMgr
Definition PoolMgr.h:148
#define sQuestPoolMgr
Definition QuestPools.h:63
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:42
@ REALM_TYPE_FFA_PVP
Definition Realm.h:60
@ REALM_TYPE_RPPVP
Definition Realm.h:56
@ REALM_TYPE_PVP
Definition Realm.h:53
#define sScriptMgr
Definition ScriptMgr.h:1168
#define sScriptReloadMgr
@ LANG_UNIVERSAL
@ AUTH_WAIT_QUEUE
BanReturn
Ban function return codes.
@ BAN_EXISTS
@ BAN_SYNTAX_ERROR
@ BAN_NOTFOUND
@ BAN_SUCCESS
@ ALLIANCE
@ HORDE
@ CHAT_MSG_SYSTEM
@ GUILD_BANKLOG_MAX_RECORDS
@ GUILD_EVENTLOG_MAX_RECORDS
@ WS_GUILD_DAILY_RESET_TIME
@ WS_WEEKLY_QUEST_RESET_TIME
@ WS_BG_DAILY_RESET_TIME
@ WS_MONTHLY_QUEST_RESET_TIME
@ WS_DAILY_CALENDAR_DELETION_OLD_EVENTS_TIME
@ WS_DAILY_QUEST_RESET_TIME
BanMode
Ban function modes.
@ BAN_ACCOUNT
@ BAN_IP
@ BAN_CHARACTER
void LoadSkillDiscoveryTable()
void LoadSkillPerfectItemTable()
void LoadSkillExtraItemTable()
#define sSmartScriptMgr
#define sSpellMgr
Definition SpellMgr.h:738
#define sTicketMgr
Definition TicketMgr.h:248
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition Timer.h:57
uint32 getMSTime()
Definition Timer.h:33
#define sTransportMgr
#define MAX_MOVE_TYPE
float baseMoveSpeed[MAX_MOVE_TYPE]
Definition Unit.cpp:87
float playerBaseMoveSpeed[MAX_MOVE_TYPE]
Definition Unit.cpp:100
WorldUpdateTime sWorldUpdateTime
time_t GetLocalHourTimestamp(time_t time, uint8 hour, bool onlyAfterTime)
Definition Util.cpp:100
tm TimeBreakdown(time_t time)
Definition Util.cpp:93
std::string secsToTimeString(uint64 timeInSecs, TimeFormat timeFormat, bool hoursOnly)
Definition Util.cpp:115
uint32 TimeStringToSecs(std::string const &timestring)
Definition Util.cpp:258
#define sWardenCheckMgr
#define sWaypointMgr
#define sWhoListStorageMgr
static time_t GetNextDailyResetTime(time_t t)
Definition World.cpp:3250
static time_t GetNextWeeklyResetTime(time_t t)
Definition World.cpp:3279
static time_t GetNextMonthlyResetTime(time_t t)
Definition World.cpp:3315
static bool IsBannedAccount(std::string const &name)
static uint32 GetId(std::string_view username)
static void LoadFromDB()
static ChannelMgr * forTeam(uint32 team)
void SaveToDB()
bool HasSentErrorMessage() const
Definition Chat.h:133
static char * LineFromMessage(char *&pos)
Definition Chat.h:60
static size_t BuildChatPacket(WorldPacket &data, ChatMsg chatType, Language language, ObjectGuid senderGUID, ObjectGuid receiverGUID, std::string_view message, uint8 chatTag, std::string const &senderName="", std::string const &receiverName="", uint32 achievementId=0, bool gmMessage=false, std::string const &channelName="")
Definition Chat.cpp:193
bool ParseCommands(std::string_view str) override
Definition Chat.cpp:718
Class used to access individual fields of database query result.
Definition Field.h:92
uint8 GetUInt8() const
Definition Field.cpp:29
std::string GetString() const
Definition Field.cpp:125
uint32 GetUInt32() const
Definition Field.cpp:61
void add(const T &item)
Adds an item to the queue.
Definition LockedQueue.h:50
bool next(T &result)
Gets the next result in the queue, if any.
Definition LockedQueue.h:68
static MMapManager * createOrGetMMapManager()
static void clear()
void InitializeThreadUnsafe(const std::vector< uint32 > &mapIds)
static bool ExistMapAndVMap(uint32 mapid, float x, float y)
Definition Map.h:281
void RemoveOldCorpses()
Definition Map.cpp:4685
bool Instanceable() const
Definition Map.cpp:4226
LowType GetCounter() const
Definition ObjectGuid.h:156
bool IsEmpty() const
Definition ObjectGuid.h:172
uint32 LowType
Definition ObjectGuid.h:142
bool IsInWorld() const
Definition Object.h:73
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:78
void Initialize()
Correspondence between opcodes and their names.
Definition Opcodes.cpp:123
static void InitializeTables()
uint32 GetTeam() const
Definition Player.h:1832
static void DeleteOldCharacters()
Definition Player.cpp:4252
void SendDirectMessage(WorldPacket const *data) const
Definition Player.cpp:6161
WorldSession * GetSession() const
Definition Player.h:1719
void setUInt16(uint8 index, uint16 value)
void setUInt32(uint8 index, uint32 value)
void setInt64(uint8 index, int64 value)
void setInt32(uint8 index, int32 value)
void setUInt8(uint8 index, uint8 value)
void setString(uint8 index, std::string const &value)
std::vector< WorldPacket * > WorldPacketList
Definition World.cpp:2679
void do_helper(WorldPacketList &data_list, char *text)
Definition World.cpp:2702
char * lineFromMessage(char *&pos)
Definition World.cpp:2701
WorldWorldTextBuilder(uint32 textId, va_list *args=nullptr)
Definition World.cpp:2680
void operator()(WorldPacketList &data_list, LocaleConstant loc_idx)
Definition World.cpp:2681
void UpdateWithDiff(uint32 diff)
void setEnableLineOfSightCalc(bool pVal)
void setEnableHeightCalc(bool pVal)
static VMapManager2 * createOrGetVMapManager()
static void clear()
void InitializeThreadUnsafe(const std::vector< uint32 > &mapIds)
IsVMAPDisabledForFn IsVMAPDisabledForPtr
GetLiquidFlagsFn GetLiquidFlagsPtr
uint32 GetZoneId() const
Definition Object.h:373
WorldPacket const * Write() override
Player session in the World.
bool Update(uint32 diff, PacketFilter &updater)
Update the WorldSession (triggered by World update)
void SendPacket(WorldPacket const *packet)
Send a packet to the client.
void KickPlayer(std::string const &reason)
Kick a player out of the World.
Player * GetPlayer() const
void SetInQueue(bool state)
Session in auth.queue currently.
bool HasPermission(uint32 permissionId)
uint32 GetAccountId() const
void ResetTimeOutTime(bool onlyActive)
void InitializeSession()
void SendAuthResponse(uint8 code, bool shortForm, uint32 queuePos=0)
The World.
Definition World.h:569
time_t m_NextWeeklyQuestReset
Definition World.h:855
uint32 ShutdownCancel()
Cancel a planned server shutdown.
Definition World.cpp:3069
bool RemoveBanCharacter(std::string const &name)
Remove a ban from a character.
Definition World.cpp:2963
void UpdateSessions(uint32 diff)
Definition World.cpp:3103
uint32 getIntConfig(WorldIntConfigs index) const
Get a server configuration element (see #WorldConfigs)
Definition World.h:718
LocaleConstant m_defaultDbcLocale
Definition World.h:832
static int32 m_visibility_notify_periodInBG
Definition World.h:847
static uint8 m_ExitCode
Definition World.h:802
SessionMap m_sessions
Definition World.h:814
uint32 m_int_configs[INT_CONFIG_VALUE_COUNT]
Definition World.h:825
bool RemoveBanAccount(BanMode mode, std::string const &nameOrIP)
Remove a ban from an account or IP address.
Definition World.cpp:2894
static int32 m_visibility_notify_periodInInstances
Definition World.h:846
static std::atomic< uint32 > m_worldLoopCounter
Definition World.h:573
void AddSession_(WorldSession *s)
Definition World.cpp:334
float m_float_configs[FLOAT_CONFIG_VALUE_COUNT]
Definition World.h:827
AccountTypes m_allowedSecurityLevel
Definition World.h:831
void LoadConfigSettings(bool reload=false)
Initialize config values.
Definition World.cpp:493
void _UpdateGameTime()
Update the game time.
Definition World.cpp:2990
static std::atomic< bool > m_stopEvent
Definition World.h:801
std::string m_dataPath
Definition World.h:837
float rate_values[MAX_RATES]
Definition World.h:824
void KickAllLess(AccountTypes sec)
Kick (and save) all players with security level less sec
Definition World.cpp:2792
void SetMotd(std::string motd)
Set a new Message of the Day.
Definition World.cpp:228
bool IsPvPRealm() const
Are we on a "Player versus Player" server?
Definition World.cpp:3542
void SetNewCharString(std::string const &str)
Set the string for new characters (first login)
Definition World.h:635
LockedQueue< WorldSession * > addSessQueue
Definition World.h:866
static float m_MaxVisibleDistanceInArenas
Definition World.h:843
static float m_MaxVisibleDistanceInBG
Definition World.h:842
QueryCallbackProcessor _queryProcessor
Definition World.h:882
bool m_bool_configs[BOOL_CONFIG_VALUE_COUNT]
Definition World.h:826
Queue m_QueuedPlayer
Definition World.h:862
void UpdateRealmCharCount(uint32 accid)
Definition World.cpp:3216
void CheckQuestResetTimes()
Definition World.cpp:3351
void LoadDBAllowedSecurityLevel()
Definition World.cpp:209
std::mutex _guidAlertLock
Definition World.h:887
void LoadDBVersion()
Definition World.cpp:3488
bool HasRecentlyDisconnected(WorldSession *)
Definition World.cpp:400
void AddQueuedPlayer(WorldSession *)
Definition World.cpp:433
uint32 GetQueuedSessionCount() const
Definition World.h:584
void UpdateMaxSessionCounters()
Get the number of current active sessions.
Definition World.cpp:3482
uint32 m_CleaningFlags
Definition World.h:806
uint32 m_maxActiveSessionCount
Definition World.h:817
void SetInitialWorldSettings()
Initialize the World.
Definition World.cpp:1598
void ResetMonthlyQuests()
Definition World.cpp:3327
time_t m_NextDailyQuestReset
Definition World.h:854
void InitCalendarOldEventsDeletionTime()
Definition World.cpp:3390
uint32 m_PlayerCount
Definition World.h:819
void DoGuidAlertRestart()
Definition World.cpp:286
time_t _warnShutdownTime
Definition World.h:892
void TriggerGuidAlert()
Definition World.cpp:267
bool IsFFAPvPRealm() const
Definition World.cpp:3547
void ResetGuildCap()
Definition World.cpp:3473
bool RemoveSession(uint32 id)
Remove a given session.
Definition World.cpp:313
time_t m_NextRandomBGReset
Definition World.h:857
Player * FindPlayerInZone(uint32 zone)
Find a player in a specified zone.
Definition World.cpp:177
void SendGlobalGMMessage(WorldPacket const *packet, WorldSession *self=nullptr, uint32 team=0)
Send a packet to all GMs (except self if mentioned)
Definition World.cpp:2654
BanReturn BanCharacter(std::string const &name, std::string const &duration, std::string const &reason, std::string const &author)
Ban an account or ban an IP address, duration will be parsed using TimeStringToSecs if it is positive...
Definition World.cpp:2923
void DetectDBCLang()
Definition World.cpp:2275
void TriggerGuidWarning()
Definition World.cpp:248
float getRate(Rates rate) const
Get a server rate (see Rates)
Definition World.h:682
void SendGMText(uint32 string_id,...)
Send a System Message to all GMs (except self if mentioned)
Definition World.cpp:2738
void ShutdownMsg(bool show=false, Player *player=nullptr, const std::string &reason=std::string())
Display a shutdown message to the user(s)
Definition World.cpp:3043
void InitGuildResetTime()
Definition World.cpp:3407
std::string m_DBVersion
Definition World.h:869
BanReturn BanAccount(BanMode mode, std::string const &nameOrIP, std::string const &duration, std::string const &reason, std::string const &author)
Ban an account or ban an IP address, duration will be parsed using TimeStringToSecs if it is positive...
Definition World.cpp:2801
AutobroadcastsMap m_Autobroadcasts
Definition World.h:872
time_t mail_timer_expires
Definition World.h:812
void InitRandomBGResetTime()
Definition World.cpp:3362
std::vector< std::string > const & GetMotd() const
Get the current Message of the Day.
Definition World.cpp:243
~World()
World destructor.
Definition World.cpp:150
void setWorldState(uint32 index, uint64 value)
Definition World.cpp:3553
void ResetWeeklyQuests()
Definition World.cpp:3291
void _UpdateRealmCharCount(PreparedQueryResult resultCharCount)
Definition World.cpp:3223
uint32 GetActiveSessionCount() const
Definition World.h:583
DisconnectMap m_disconnects
Definition World.h:816
time_t m_NextCalendarOldEventsDeletionTime
Definition World.h:858
void ReloadRBAC()
Definition World.cpp:3591
uint32 m_availableDbcLocaleMask
Definition World.h:833
void LoadWorldStates()
Definition World.cpp:3515
time_t mail_timer
Definition World.h:811
std::string _guidWarningMsg
Definition World.h:884
void ResetRandomBG()
Definition World.cpp:3449
uint32 m_ShutdownMask
Definition World.h:804
void ResetEventSeasonalQuests(uint16 event_id, time_t eventStartTime)
Definition World.cpp:3435
time_t m_NextGuildReset
Definition World.h:859
void SetPlayerSecurityLimit(AccountTypes sec)
Definition World.cpp:219
bool IsClosed() const
Deny clients?
Definition World.cpp:196
uint32 m_ShutdownTimer
Definition World.h:803
static int32 m_visibility_notify_periodInArenas
Definition World.h:848
void KickAll()
Kick (and save) all players.
Definition World.cpp:2782
uint32 GetPlayerAmountLimit() const
Definition World.h:614
void SendGuidWarning()
Definition World.cpp:294
void AddSession(WorldSession *s)
Definition World.cpp:329
std::string _alertRestartReason
Definition World.h:885
void ForceGameEventUpdate()
Definition World.cpp:2628
void ResetDailyQuests()
Definition World.cpp:3255
void CalendarDeleteOldEvents()
Definition World.cpp:3464
void SendGlobalMessage(WorldPacket const *packet, WorldSession *self=nullptr, uint32 team=0)
Send a packet to all players (except self if mentioned)
Definition World.cpp:2637
void ProcessQueryCallbacks()
Definition World.cpp:3586
uint64 getWorldState(uint32 index) const
Definition World.cpp:3580
void RemoveOldCorpses()
Definition World.cpp:3600
static World * instance()
Definition World.cpp:170
uint32 m_MaxPlayerCount
Definition World.h:820
WorldStatesMap m_worldstates
Definition World.h:829
LocaleConstant GetDefaultDbcLocale() const
Definition World.h:639
static float m_MaxVisibleDistanceOnContinents
Definition World.h:840
uint32 GetActiveAndQueuedSessionCount() const
Definition World.h:582
static float m_MaxVisibleDistanceInInstances
Definition World.h:841
WorldSession * FindSession(uint32 id) const
Find a session by its id.
Definition World.cpp:302
int32 GetQueuePos(WorldSession *)
Definition World.cpp:422
bool RemoveQueuedPlayer(WorldSession *session)
Definition World.cpp:442
void UpdateAreaDependentAuras()
Definition World.cpp:3504
void InitQuestResetTimes()
Definition World.cpp:3243
bool _guidWarn
Definition World.h:889
bool m_isClosed
Definition World.h:808
uint32 GetMaxPlayerCount() const
Definition World.h:590
void SendServerMessage(ServerMessageType messageID, std::string stringParam="", Player *player=nullptr)
Send a server message to the user(s)
Definition World.cpp:3090
IntervalTimer m_timers[WUPDATE_COUNT]
Definition World.h:810
bool _guidAlert
Definition World.h:890
void SendGlobalText(char const *text, WorldSession *self)
DEPRECATED, only for debug purpose. Send a System Message to all players (except self if mentioned)
Definition World.cpp:2764
static bool IsStopped()
Definition World.h:674
time_t m_NextMonthlyQuestReset
Definition World.h:856
std::vector< std::string > _motd
Definition World.h:836
uint32 m_maxQueuedSessionCount
Definition World.h:818
static int32 m_visibility_notify_periodOnContinents
Definition World.h:845
void SendAutoBroadcast()
Definition World.cpp:3159
void Update(uint32 diff)
Update the World !
Definition World.cpp:2356
uint32 m_playerLimit
Definition World.h:830
void LoadAutobroadcasts()
Definition World.cpp:2321
std::map< uint8, uint8 > AutobroadcastsWeightMap
Definition World.h:874
void SetPlayerAmountLimit(uint32 limit)
Active session server limit.
Definition World.h:613
bool m_allowMovement
Definition World.h:835
AutobroadcastsWeightMap m_AutobroadcastsWeights
Definition World.h:875
void SendWorldText(uint32 string_id,...)
Send a System Message to all players (except self if mentioned)
Definition World.cpp:2719
void DoGuidWarningRestart()
Definition World.cpp:277
void ProcessCliCommands()
Definition World.cpp:3141
void SetClosed(bool val)
Close world.
Definition World.cpp:201
uint32 _warnDiff
Definition World.h:891
LockedQueue< CliCommandHolder * > cliCmdQueue
Definition World.h:851
World()
World constructor.
Definition World.cpp:109
void ShutdownServ(uint32 time, uint32 options, uint8 exitcode, const std::string &reason=std::string())
Shutdown the server.
Definition World.cpp:3020
void commandFinished(void *, bool)
uint32 constexpr MAX_CHARACTERS_PER_REALM
OpcodeTable opcodeTable
Definition Opcodes.cpp:51
@ SMSG_NOTIFICATION
Definition Opcodes.h:488
#define sWorld
Definition World.h:900
ServerMessageType
Definition World.h:46
void LoadWeatherData()
TC_GAME_API Realm realm
Definition World.cpp:3605
ShutdownExitCode
Definition World.h:62
ShutdownMask
Definition World.h:55
@ SERVER_MSG_SHUTDOWN_TIME
Definition World.h:47
@ SERVER_MSG_STRING
Definition World.h:49
@ SERVER_MSG_SHUTDOWN_CANCELLED
Definition World.h:50
@ SERVER_MSG_RESTART_CANCELLED
Definition World.h:51
@ SERVER_MSG_RESTART_TIME
Definition World.h:48
@ REALM_ZONE_RUSSIAN
Definition World.h:506
@ REALM_ZONE_DEVELOPMENT
Definition World.h:495
@ CONFIG_AUTOBROADCAST_CENTER
Definition World.h:348
@ CONFIG_ARENA_START_MATCHMAKER_RATING
Definition World.h:325
@ CONFIG_RESPAWN_RESTARTQUIETTIME
Definition World.h:398
@ CONFIG_ARENA_SEASON_ID
Definition World.h:322
@ CONFIG_CORPSE_DECAY_ELITE
Definition World.h:307
@ CONFIG_MAX_INSTANCES_PER_HOUR
Definition World.h:356
@ CONFIG_GUILD_EVENT_LOG_COUNT
Definition World.h:338
@ CONFIG_ARENA_START_RATING
Definition World.h:323
@ CONFIG_SOCKET_TIMEOUTTIME
Definition World.h:218
@ CONFIG_MAX_OVERSPEED_PINGS
Definition World.h:281
@ CONFIG_WARDEN_NUM_LUA_CHECKS
Definition World.h:363
@ CONFIG_NO_GRAY_AGGRO_BELOW
Definition World.h:390
@ CONFIG_CHARDELETE_METHOD
Definition World.h:345
@ CONFIG_SESSION_ADD_DELAY
Definition World.h:219
@ CONFIG_MIN_CREATURE_SCALED_XP_RATIO
Definition World.h:255
@ CONFIG_CHARACTER_CREATING_DISABLED_CLASSMASK
Definition World.h:230
@ CONFIG_WARDEN_CLIENT_BAN_DURATION
Definition World.h:361
@ CONFIG_CLIENTCACHE_VERSION
Definition World.h:337
@ CONFIG_DAILY_QUEST_RESET_TIME_HOUR
Definition World.h:250
@ CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF
Definition World.h:291
@ CONFIG_CREATURE_PICKPOCKET_REFILL
Definition World.h:382
@ CONFIG_SKILL_CHANCE_ORANGE
Definition World.h:271
@ CONFIG_GM_CHAT
Definition World.h:260
@ CONFIG_AUCTION_GETALL_DELAY
Definition World.h:391
@ CONFIG_RESPAWN_DYNAMICMODE
Definition World.h:395
@ CONFIG_CHATFLOOD_MUTE_TIME
Definition World.h:287
@ CONFIG_STRICT_PET_NAMES
Definition World.h:224
@ CONFIG_CHARACTER_CREATING_DISABLED
Definition World.h:228
@ CONFIG_MIN_PET_NAME
Definition World.h:227
@ CONFIG_LOGDB_CLEARTIME
Definition World.h:336
@ CONFIG_QUEST_HIGH_LEVEL_HIDE_DIFF
Definition World.h:292
@ CONFIG_CHARACTER_CREATING_DISABLED_RACEMASK
Definition World.h:229
@ CONFIG_INTERVAL_CHANGEWEATHER
Definition World.h:215
@ CONFIG_PRESERVE_CUSTOM_CHANNEL_INTERVAL
Definition World.h:353
@ CONFIG_PRESERVE_CUSTOM_CHANNEL_DURATION
Definition World.h:352
@ CONFIG_GM_WHISPERING_TO
Definition World.h:261
@ CONFIG_SKILL_CHANCE_SKINNING_STEPS
Definition World.h:276
@ CONFIG_SKILL_CHANCE_YELLOW
Definition World.h:272
@ CONFIG_RESPAWN_GUIDWARNING_FREQUENCY
Definition World.h:401
@ CONFIG_AUTOBROADCAST_INTERVAL
Definition World.h:349
@ CONFIG_MAX_HONOR_POINTS
Definition World.h:242
@ CONFIG_DEATH_KNIGHTS_PER_REALM
Definition World.h:233
@ CONFIG_PVP_TOKEN_MAP_TYPE
Definition World.h:329
@ CONFIG_ENABLE_SINFO_LOGIN
Definition World.h:332
@ CONFIG_CHARTER_COST_GUILD
Definition World.h:385
@ CONFIG_CHARDELETE_MIN_LEVEL
Definition World.h:346
@ CONFIG_FORCE_SHUTDOWN_THRESHOLD
Definition World.h:266
@ CONFIG_MAX_ARENA_POINTS
Definition World.h:244
@ CONFIG_ARENA_MAX_RATING_DIFFERENCE
Definition World.h:317
@ CONFIG_BG_REWARD_LOSER_HONOR_LAST
Definition World.h:380
@ CONFIG_WHO_LIST_UPDATE_INTERVAL
Definition World.h:327
@ CONFIG_GAME_TYPE
Definition World.h:220
@ CONFIG_ARENA_RATED_UPDATE_TIMER
Definition World.h:320
@ CONFIG_START_GM_LEVEL
Definition World.h:265
@ CONFIG_MAIL_LEVEL_REQ
Definition World.h:304
@ CONFIG_SKILL_GAIN_DEFENSE
Definition World.h:278
@ CONFIG_MIN_PETITION_SIGNS
Definition World.h:253
@ CONFIG_BIRTHDAY_TIME
Definition World.h:381
@ CONFIG_WARDEN_CLIENT_CHECK_HOLDOFF
Definition World.h:359
@ CONFIG_RESPAWN_DYNAMICMINIMUM_CREATURE
Definition World.h:399
@ CONFIG_PARTY_LEVEL_REQ
Definition World.h:300
@ CONFIG_MIN_LEVEL_STAT_SAVE
Definition World.h:340
@ CONFIG_BATTLEGROUND_INVITATION_TYPE
Definition World.h:313
@ CONFIG_START_DEATH_KNIGHT_PLAYER_LEVEL
Definition World.h:239
@ CONFIG_MAX_PLAYER_LEVEL
Definition World.h:236
@ CONFIG_START_ARENA_POINTS
Definition World.h:245
@ CONFIG_MIN_CHARTER_NAME
Definition World.h:226
@ CONFIG_CHAT_CHANNEL_LEVEL_REQ
Definition World.h:295
@ CONFIG_BG_REWARD_WINNER_ARENA_FIRST
Definition World.h:376
@ CONFIG_CHARACTERS_PER_ACCOUNT
Definition World.h:231
@ CONFIG_DEATH_SICKNESS_LEVEL
Definition World.h:310
@ CONFIG_CHARTER_COST_ARENA_5v5
Definition World.h:388
@ CONFIG_INSTANCE_RESET_TIME_HOUR
Definition World.h:248
@ CONFIG_WINTERGRASP_PLR_MIN_LVL
Definition World.h:367
@ CONFIG_PVP_TOKEN_ID
Definition World.h:330
@ CONFIG_GUILD_RESET_HOUR
Definition World.h:343
@ CONFIG_SKILL_GAIN_WEAPON
Definition World.h:280
@ CONFIG_MAIL_DELIVERY_DELAY
Definition World.h:268
@ CONFIG_WINTERGRASP_BATTLETIME
Definition World.h:368
@ CONFIG_PENDING_MOVE_CHANGES_TIMEOUT
Definition World.h:403
@ CONFIG_GM_FREEZE_DURATION
Definition World.h:262
@ CONFIG_WINTERGRASP_NOBATTLETIME
Definition World.h:369
@ CONFIG_PVP_TOKEN_COUNT
Definition World.h:331
@ CONFIG_PACKET_SPOOF_BANDURATION
Definition World.h:373
@ CONFIG_WARDEN_NUM_CLIENT_MOD_CHECKS
Definition World.h:364
@ CONFIG_SKILL_CHANCE_MINING_STEPS
Definition World.h:275
@ CONFIG_ARENA_AUTO_DISTRIBUTE_INTERVAL_DAYS
Definition World.h:321
@ CONFIG_START_PLAYER_MONEY
Definition World.h:240
@ CONFIG_GUILD_BANK_EVENT_LOG_COUNT
Definition World.h:339
@ CONFIG_TRADE_LEVEL_REQ
Definition World.h:301
@ CONFIG_AHBOT_UPDATE_INTERVAL
Definition World.h:384
@ CONFIG_BG_REWARD_WINNER_ARENA_LAST
Definition World.h:378
@ CONFIG_BATTLEGROUND_PREMADE_GROUP_WAIT_FOR_MATCH
Definition World.h:315
@ CONFIG_START_DEATH_KNIGHT_PLAYER_MONEY
Definition World.h:241
@ CONFIG_CORPSE_DECAY_NORMAL
Definition World.h:305
@ CONFIG_WINTERGRASP_RESTART_AFTER_CRASH
Definition World.h:370
@ CONFIG_SOCKET_TIMEOUTTIME_ACTIVE
Definition World.h:402
@ CONFIG_START_PLAYER_LEVEL
Definition World.h:238
@ CONFIG_RESPAWN_GUIDALERTLEVEL
Definition World.h:397
@ CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL
Definition World.h:246
@ CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL_DIFFERENCE
Definition World.h:247
@ CONFIG_CLEAN_OLD_MAIL_TIME
Definition World.h:269
@ CONFIG_INTERVAL_GRIDCLEAN
Definition World.h:213
@ CONFIG_BG_REWARD_WINNER_HONOR_FIRST
Definition World.h:375
@ CONFIG_ARENA_START_PERSONAL_RATING
Definition World.h:324
@ CONFIG_COMPRESSION
Definition World.h:211
@ CONFIG_STRICT_CHARTER_NAMES
Definition World.h:223
@ CONFIG_INTERVAL_SAVE
Definition World.h:212
@ CONFIG_BG_REWARD_LOSER_HONOR_FIRST
Definition World.h:379
@ CONFIG_CORPSE_DECAY_WORLDBOSS
Definition World.h:309
@ CONFIG_TICKET_LEVEL_REQ
Definition World.h:302
@ CONFIG_PACKET_SPOOF_POLICY
Definition World.h:371
@ CONFIG_CHATFLOOD_ADDON_MESSAGE_COUNT
Definition World.h:285
@ CONFIG_CHAT_YELL_LEVEL_REQ
Definition World.h:299
@ CONFIG_WARDEN_NUM_INJECT_CHECKS
Definition World.h:362
@ CONFIG_LFG_OPTIONSMASK
Definition World.h:355
@ CONFIG_GM_LOGIN_STATE
Definition World.h:257
@ CONFIG_ARENA_PREV_OPPONENTS_DISCARD_TIMER
Definition World.h:319
@ CONFIG_AUCTION_LEVEL_REQ
Definition World.h:303
@ CONFIG_REALM_ZONE
Definition World.h:221
@ CONFIG_CHAT_STRICT_LINK_CHECKING_KICK
Definition World.h:294
@ CONFIG_GM_LEVEL_IN_GM_LIST
Definition World.h:263
@ CONFIG_ARENA_RATING_DISCARD_TIMER
Definition World.h:318
@ CONFIG_CALENDAR_DELETE_OLD_EVENTS_HOUR
Definition World.h:342
@ CONFIG_GM_VISIBLE_STATE
Definition World.h:258
@ CONFIG_NO_GRAY_AGGRO_ABOVE
Definition World.h:389
@ CONFIG_GROUP_VISIBILITY
Definition World.h:267
@ CONFIG_CREATURE_FAMILY_FLEE_DELAY
Definition World.h:289
@ CONFIG_PACKET_SPOOF_BANMODE
Definition World.h:372
@ CONFIG_XP_BOOST_DAYMASK
Definition World.h:357
@ CONFIG_MIN_DISCOVERED_SCALED_XP_RATIO
Definition World.h:256
@ CONFIG_MAX_WHO
Definition World.h:326
@ CONFIG_CHARACTER_CREATING_MIN_LEVEL_FOR_DEATH_KNIGHT
Definition World.h:234
@ CONFIG_CHARDELETE_KEEP_DAYS
Definition World.h:344
@ CONFIG_MAX_RESULTS_LOOKUP_COMMANDS
Definition World.h:350
@ CONFIG_START_HONOR_POINTS
Definition World.h:243
@ CONFIG_CREATURE_STOP_FOR_PLAYER
Definition World.h:383
@ CONFIG_INTERVAL_DISCONNECT_TOLERANCE
Definition World.h:216
@ CONFIG_CHAT_WHISPER_LEVEL_REQ
Definition World.h:296
@ CONFIG_SKILL_GAIN_GATHERING
Definition World.h:279
@ CONFIG_CHARTER_COST_ARENA_2v2
Definition World.h:386
@ CONFIG_CHATFLOOD_MESSAGE_DELAY
Definition World.h:284
@ CONFIG_CHARDELETE_DEATH_KNIGHT_MIN_LEVEL
Definition World.h:347
@ CONFIG_DISABLE_BREATHING
Definition World.h:312
@ CONFIG_ACC_PASSCHANGESEC
Definition World.h:374
@ CONFIG_STRICT_PLAYER_NAMES
Definition World.h:222
@ CONFIG_LOGDB_CLEARINTERVAL
Definition World.h:335
@ CONFIG_BATTLEGROUND_REPORT_AFK
Definition World.h:316
@ CONFIG_MIN_QUEST_SCALED_XP_RATIO
Definition World.h:254
@ CONFIG_INSTANCE_UNLOAD_DELAY
Definition World.h:249
@ CONFIG_GM_LEVEL_IN_WHO_LIST
Definition World.h:264
@ CONFIG_BATTLEGROUND_PREMATURE_FINISH_TIMER
Definition World.h:314
@ CONFIG_HONOR_AFTER_DUEL
Definition World.h:328
@ CONFIG_WEEKLY_QUEST_RESET_TIME_WDAY
Definition World.h:251
@ CONFIG_PERSISTENT_CHARACTER_CLEAN_FLAGS
Definition World.h:354
@ CONFIG_EXPANSION
Definition World.h:282
@ CONFIG_CORPSE_DECAY_RARE
Definition World.h:306
@ CONFIG_CHAT_STRICT_LINK_CHECKING_SEVERITY
Definition World.h:293
@ CONFIG_RESPAWN_GUIDWARNLEVEL
Definition World.h:396
@ CONFIG_UPTIME_UPDATE
Definition World.h:270
@ CONFIG_WARDEN_CLIENT_RESPONSE_DELAY
Definition World.h:358
@ CONFIG_TALENTS_INSPECTING
Definition World.h:393
@ CONFIG_WINTERGRASP_PLR_MAX
Definition World.h:365
@ CONFIG_CHAT_EMOTE_LEVEL_REQ
Definition World.h:297
@ CONFIG_AUCTION_SEARCH_DELAY
Definition World.h:392
@ CONFIG_PORT_WORLD
Definition World.h:217
@ CONFIG_MIN_DUALSPEC_LEVEL
Definition World.h:237
@ CONFIG_SKILL_GAIN_CRAFTING
Definition World.h:277
@ CONFIG_RANDOM_BG_RESET_HOUR
Definition World.h:341
@ CONFIG_DB_PING_INTERVAL
Definition World.h:351
@ CONFIG_WORLD_BOSS_LEVEL_DIFF
Definition World.h:290
@ CONFIG_CORPSE_DECAY_RAREELITE
Definition World.h:308
@ CONFIG_CHATFLOOD_MESSAGE_COUNT
Definition World.h:283
@ CONFIG_WARDEN_CLIENT_FAIL_ACTION
Definition World.h:360
@ CONFIG_RESPAWN_DYNAMICMINIMUM_GAMEOBJECT
Definition World.h:400
@ CONFIG_CHARTER_COST_ARENA_3v3
Definition World.h:387
@ CONFIG_MIN_PLAYER_NAME
Definition World.h:225
@ CONFIG_CHATFLOOD_ADDON_MESSAGE_DELAY
Definition World.h:286
@ CONFIG_SKILL_CHANCE_GREY
Definition World.h:274
@ CONFIG_INTERVAL_MAPUPDATE
Definition World.h:214
@ CONFIG_NUMTHREADS
Definition World.h:334
@ CONFIG_CREATURE_FAMILY_ASSISTANCE_DELAY
Definition World.h:288
@ CONFIG_MAX_PRIMARY_TRADE_SKILL
Definition World.h:252
@ CONFIG_SKIP_CINEMATICS
Definition World.h:235
@ CONFIG_SKILL_CHANCE_GREEN
Definition World.h:273
@ CONFIG_CHAT_SAY_LEVEL_REQ
Definition World.h:298
@ CONFIG_WINTERGRASP_PLR_MIN
Definition World.h:366
@ CONFIG_BG_REWARD_WINNER_HONOR_LAST
Definition World.h:377
@ CONFIG_CHARACTERS_PER_REALM
Definition World.h:232
@ CONFIG_RESPAWN_MINCHECKINTERVALMS
Definition World.h:394
@ WUPDATE_DELETECHARS
Definition World.h:79
@ WUPDATE_COUNT
Definition World.h:85
@ WUPDATE_CLEANDB
Definition World.h:76
@ WUPDATE_CORPSES
Definition World.h:74
@ WUPDATE_PINGDB
Definition World.h:81
@ WUPDATE_CHANNEL_SAVE
Definition World.h:84
@ WUPDATE_AUCTIONS_PENDING
Definition World.h:72
@ WUPDATE_AUTOBROADCAST
Definition World.h:77
@ WUPDATE_WHO_LIST
Definition World.h:83
@ WUPDATE_CHECK_FILECHANGES
Definition World.h:82
@ WUPDATE_UPTIME
Definition World.h:73
@ WUPDATE_EVENTS
Definition World.h:75
@ WUPDATE_AUCTIONS
Definition World.h:71
@ WUPDATE_AHBOT
Definition World.h:80
@ RATE_CREATURE_NORMAL_SPELLDAMAGE
Definition World.h:448
@ RATE_CREATURE_NORMAL_HP
Definition World.h:438
@ RATE_DAMAGE_FALL
Definition World.h:457
@ RATE_DROP_ITEM_REFERENCED_AMOUNT
Definition World.h:427
@ RATE_CREATURE_NORMAL_DAMAGE
Definition World.h:443
@ RATE_POWER_RAGE_INCOME
Definition World.h:412
@ RATE_CREATURE_ELITE_RARE_DAMAGE
Definition World.h:447
@ RATE_CREATURE_AGGRO
Definition World.h:453
@ RATE_POWER_RAGE_LOSS
Definition World.h:413
@ RATE_REPUTATION_LOWLEVEL_QUEST
Definition World.h:436
@ RATE_ARENA_POINTS
Definition World.h:462
@ RATE_DURABILITY_LOSS_BLOCK
Definition World.h:470
@ RATE_DROP_ITEM_RARE
Definition World.h:422
@ RATE_CREATURE_ELITE_ELITE_SPELLDAMAGE
Definition World.h:449
@ RATE_REPUTATION_LOWLEVEL_KILL
Definition World.h:435
@ RATE_XP_KILL
Definition World.h:429
@ RATE_POWER_RUNICPOWER_INCOME
Definition World.h:414
@ RATE_INSTANCE_RESET_TIME
Definition World.h:465
@ RATE_REST_OFFLINE_IN_WILDERNESS
Definition World.h:456
@ RATE_POWER_RUNICPOWER_LOSS
Definition World.h:415
@ RATE_CREATURE_ELITE_WORLDBOSS_DAMAGE
Definition World.h:446
@ RATE_POWER_ENERGY
Definition World.h:417
@ RATE_TALENT
Definition World.h:463
@ RATE_MONEY_MAX_LEVEL_QUEST
Definition World.h:474
@ RATE_CREATURE_ELITE_RAREELITE_DAMAGE
Definition World.h:445
@ RATE_POWER_MANA
Definition World.h:411
@ RATE_CREATURE_ELITE_WORLDBOSS_HP
Definition World.h:441
@ RATE_DROP_ITEM_LEGENDARY
Definition World.h:424
@ RATE_DURABILITY_LOSS_PARRY
Definition World.h:468
@ RATE_DROP_ITEM_POOR
Definition World.h:419
@ RATE_REST_OFFLINE_IN_TAVERN_OR_CITY
Definition World.h:455
@ RATE_AUCTION_DEPOSIT
Definition World.h:459
@ RATE_DROP_ITEM_UNCOMMON
Definition World.h:421
@ RATE_DROP_ITEM_REFERENCED
Definition World.h:426
@ RATE_CREATURE_ELITE_RAREELITE_SPELLDAMAGE
Definition World.h:450
@ RATE_REPUTATION_RECRUIT_A_FRIEND_BONUS
Definition World.h:437
@ RATE_REPAIRCOST
Definition World.h:433
@ RATE_DROP_MONEY
Definition World.h:428
@ RATE_DURABILITY_LOSS_DAMAGE
Definition World.h:467
@ RATE_MONEY_QUEST
Definition World.h:473
@ RATE_AUCTION_CUT
Definition World.h:460
@ RATE_HEALTH
Definition World.h:410
@ RATE_MOVESPEED
Definition World.h:471
@ RATE_DURABILITY_LOSS_ON_DEATH
Definition World.h:466
@ RATE_CREATURE_ELITE_ELITE_DAMAGE
Definition World.h:444
@ RATE_XP_QUEST
Definition World.h:431
@ RATE_XP_BOOST
Definition World.h:472
@ RATE_CREATURE_ELITE_WORLDBOSS_SPELLDAMAGE
Definition World.h:451
@ RATE_DROP_ITEM_EPIC
Definition World.h:423
@ RATE_SKILL_DISCOVERY
Definition World.h:418
@ RATE_DROP_ITEM_ARTIFACT
Definition World.h:425
@ RATE_CREATURE_ELITE_RARE_SPELLDAMAGE
Definition World.h:452
@ RATE_CREATURE_ELITE_ELITE_HP
Definition World.h:439
@ RATE_XP_EXPLORE
Definition World.h:432
@ RATE_CREATURE_ELITE_RARE_HP
Definition World.h:442
@ RATE_REPUTATION_GAIN
Definition World.h:434
@ RATE_REST_INGAME
Definition World.h:454
@ RATE_POWER_FOCUS
Definition World.h:416
@ RATE_XP_BG_KILL
Definition World.h:430
@ RATE_HONOR
Definition World.h:461
@ RATE_CORPSE_DECAY_LOOTED
Definition World.h:464
@ RATE_DURABILITY_LOSS_ABSORB
Definition World.h:469
@ RATE_AUCTION_TIME
Definition World.h:458
@ RATE_CREATURE_ELITE_RAREELITE_HP
Definition World.h:440
@ RATE_DROP_ITEM_NORMAL
Definition World.h:420
@ CONFIG_STATS_LIMITS_DODGE
Definition World.h:196
@ CONFIG_RESPAWN_DYNAMICRATE_CREATURE
Definition World.h:204
@ CONFIG_SIGHT_MONSTER
Definition World.h:188
@ CONFIG_ARENA_WIN_RATING_MODIFIER_1
Definition World.h:200
@ CONFIG_GROUP_XP_DISTANCE
Definition World.h:186
@ CONFIG_LISTEN_RANGE_YELL
Definition World.h:191
@ CONFIG_STATS_LIMITS_PARRY
Definition World.h:197
@ CONFIG_CREATURE_FAMILY_FLEE_ASSISTANCE_RADIUS
Definition World.h:192
@ CONFIG_ARENA_WIN_RATING_MODIFIER_2
Definition World.h:201
@ CONFIG_ARENA_LOSE_RATING_MODIFIER
Definition World.h:202
@ CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS
Definition World.h:193
@ CONFIG_LISTEN_RANGE_SAY
Definition World.h:189
@ CONFIG_THREAT_RADIUS
Definition World.h:194
@ CONFIG_MAX_RECRUIT_A_FRIEND_DISTANCE
Definition World.h:187
@ CONFIG_ARENA_MATCHMAKER_RATING_MODIFIER
Definition World.h:203
@ CONFIG_RESPAWN_DYNAMICRATE_GAMEOBJECT
Definition World.h:205
@ CONFIG_CHANCE_OF_GM_SURVEY
Definition World.h:195
@ CONFIG_STATS_LIMITS_CRIT
Definition World.h:199
@ CONFIG_LISTEN_RANGE_TEXTEMOTE
Definition World.h:190
@ CONFIG_STATS_LIMITS_BLOCK
Definition World.h:198
@ CONFIG_ALLOW_TWO_SIDE_INTERACTION_CALENDAR
Definition World.h:96
@ CONFIG_SHOW_KICK_IN_WORLD
Definition World.h:142
@ CONFIG_QUEST_IGNORE_AUTO_COMPLETE
Definition World.h:153
@ CONFIG_BG_XP_FOR_KILL
Definition World.h:129
@ CONFIG_AUTOBROADCAST
Definition World.h:145
@ CONFIG_CHECK_GOBJECT_LOS
Definition World.h:177
@ CONFIG_INSTANCEMAP_LOAD_GRIDS
Definition World.h:168
@ CONFIG_WEATHER
Definition World.h:111
@ CONFIG_ALL_TAXI_PATHS
Definition World.h:102
@ CONFIG_GM_LOWER_SECURITY
Definition World.h:108
@ CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS
Definition World.h:130
@ CONFIG_SKILL_MILLING
Definition World.h:110
@ CONFIG_PDUMP_NO_OVERWRITE
Definition World.h:151
@ CONFIG_GRID_UNLOAD
Definition World.h:94
@ CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP
Definition World.h:118
@ CONFIG_START_ALL_SPELLS
Definition World.h:136
@ CONFIG_ALLOW_LOGGING_IP_ADDRESSES_IN_DATABASE
Definition World.h:180
@ CONFIG_SHOW_MUTE_IN_WORLD
Definition World.h:143
@ CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION
Definition World.h:100
@ CONFIG_CHAT_PARTY_RAID_WARNINGS
Definition World.h:114
@ CONFIG_ALLOW_GM_GROUP
Definition World.h:107
@ CONFIG_DECLINED_NAMES_USED
Definition World.h:123
@ CONFIG_EVENT_ANNOUNCE
Definition World.h:158
@ CONFIG_ARENA_LOG_EXTENDED_INFO
Definition World.h:133
@ CONFIG_CALCULATE_GAMEOBJECT_ZONE_AREA_DATA
Definition World.h:164
@ CONFIG_STATS_LIMITS_ENABLE
Definition World.h:159
@ CONFIG_HOTSWAP_INSTALL_ENABLED
Definition World.h:173
@ CONFIG_QUEST_IGNORE_RAID
Definition World.h:113
@ CONFIG_SHOW_BAN_IN_WORLD
Definition World.h:144
@ CONFIG_HOTSWAP_EARLY_TERMINATION_ENABLED
Definition World.h:171
@ CONFIG_HOTSWAP_ENABLED
Definition World.h:169
@ CONFIG_CLEAN_CHARACTER_DB
Definition World.h:93
@ CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY
Definition World.h:126
@ CONFIG_CHAT_FAKE_MESSAGE_PREVENTING
Definition World.h:117
@ CONFIG_ALLOW_TWO_SIDE_TRADE
Definition World.h:101
@ CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE
Definition World.h:119
@ CONFIG_SKILL_PROSPECTING
Definition World.h:109
@ CONFIG_IP_BASED_ACTION_LOGGING
Definition World.h:161
@ CONFIG_ADDON_CHANNEL
Definition World.h:92
@ CONFIG_START_ALL_REP
Definition World.h:138
@ CONFIG_PVP_TOKEN_ENABLE
Definition World.h:140
@ CONFIG_ARENA_SEASON_IN_PROGRESS
Definition World.h:132
@ CONFIG_DETECT_POS_COLLISION
Definition World.h:115
@ CONFIG_DEATH_BONES_BG_OR_ARENA
Definition World.h:121
@ CONFIG_BASEMAP_LOAD_GRIDS
Definition World.h:167
@ CONFIG_HOTSWAP_PREFIX_CORRECTION_ENABLED
Definition World.h:174
@ CONFIG_BATTLEGROUND_STORE_STATISTICS_ENABLE
Definition World.h:127
@ CONFIG_INSTANCE_IGNORE_RAID
Definition World.h:105
@ CONFIG_RESET_DUEL_HEALTH_MANA
Definition World.h:166
@ CONFIG_BATTLEGROUND_CAST_DESERTER
Definition World.h:124
@ CONFIG_HOTSWAP_BUILD_FILE_RECREATION_ENABLED
Definition World.h:172
@ CONFIG_STATS_SAVE_ONLY_ON_LOGOUT
Definition World.h:95
@ CONFIG_INSTANT_TAXI
Definition World.h:103
@ CONFIG_ARENA_QUEUE_ANNOUNCER_ENABLE
Definition World.h:131
@ CONFIG_RESTRICTED_LFG_CHANNEL
Definition World.h:116
@ CONFIG_NO_RESET_TALENT_COST
Definition World.h:141
@ CONFIG_CALCULATE_CREATURE_ZONE_AREA_DATA
Definition World.h:163
@ CONFIG_HOTSWAP_RECOMPILER_ENABLED
Definition World.h:170
@ CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL
Definition World.h:97
@ CONFIG_PRESERVE_CUSTOM_CHANNELS
Definition World.h:149
@ CONFIG_ENABLE_MMAPS
Definition World.h:156
@ CONFIG_OFFHAND_CHECK_AT_SPELL_UNLEARN
Definition World.h:134
@ CONFIG_CAST_UNSTUCK
Definition World.h:106
@ CONFIG_RESET_DUEL_COOLDOWNS
Definition World.h:165
@ CONFIG_DURABILITY_LOSS_IN_PVP
Definition World.h:91
@ CONFIG_INSTANCES_RESET_ANNOUNCE
Definition World.h:160
@ CONFIG_WINTERGRASP_ENABLE
Definition World.h:157
@ CONFIG_BATTLEGROUND_TRACK_DESERTERS
Definition World.h:128
@ CONFIG_QUEST_IGNORE_AUTO_ACCEPT
Definition World.h:152
@ CONFIG_PREVENT_RENAME_CUSTOMIZATION
Definition World.h:175
@ CONFIG_DIE_COMMAND_MODE
Definition World.h:122
@ CONFIG_VMAP_INDOOR_CHECK
Definition World.h:135
@ CONFIG_WARDEN_ENABLED
Definition World.h:155
@ CONFIG_CACHE_DATA_QUERIES
Definition World.h:176
@ CONFIG_PDUMP_NO_PATHS
Definition World.h:150
@ CONFIG_ALWAYS_MAX_SKILL_FOR_LEVEL
Definition World.h:112
@ CONFIG_RESPAWN_DYNAMIC_ESCORTNPC
Definition World.h:178
@ CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP
Definition World.h:98
@ CONFIG_DELETE_CHARACTER_TICKET_TRACE
Definition World.h:147
@ CONFIG_DEATH_BONES_WORLD
Definition World.h:120
@ CONFIG_QUEST_ENABLE_QUEST_TRACKER
Definition World.h:154
@ CONFIG_REGEN_HP_CANNOT_REACH_TARGET_IN_RAID
Definition World.h:179
@ CONFIG_ALWAYS_MAXSKILL
Definition World.h:139
@ CONFIG_DBC_ENFORCE_ITEM_ATTRIBUTES
Definition World.h:148
@ CONFIG_ALLOW_TICKETS
Definition World.h:146
@ CONFIG_START_ALL_EXPLORED
Definition World.h:137
@ CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD
Definition World.h:99
@ CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE
Definition World.h:125
@ CONFIG_INSTANCE_IGNORE_LEVEL
Definition World.h:104
@ CONFIG_ALLOW_TRACK_BOTH_RESOURCES
Definition World.h:162
@ RESTART_EXIT_CODE
Definition World.h:65
@ SHUTDOWN_EXIT_CODE
Definition World.h:63
@ SHUTDOWN_MASK_RESTART
Definition World.h:56
@ SHUTDOWN_MASK_IDLE
Definition World.h:57
void LoadFromDB()
Definition AddonMgr.cpp:40
void CheckQuestDisables()
bool IsVMAPDisabledFor(uint32 entry, uint8 flags)
void LoadDisables()
void UpdateGameTimers()
Definition GameTime.cpp:77
time_t GetGameTime()
Definition GameTime.cpp:42
time_t GetStartTime()
Definition GameTime.cpp:37
uint32 GetUptime()
Uptime (in secs)
Definition GameTime.cpp:62
TC_COMMON_API char const * GetFullVersion()
TC_GAME_API Player * FindConnectedPlayerByName(std::string_view name)
TC_GAME_API void LoadCommandMap()
TC_COMMON_API std::vector< std::string_view > Tokenize(std::string_view str, char sep, bool keepEmpty)
Definition Util.cpp:56
@ RBAC_PERM_SKIP_QUEUE
Definition RBAC.h:55
@ RBAC_PERM_RECEIVE_GLOBAL_GM_TEXTMESSAGE
Definition RBAC.h:97
char const * Name[16]
Storage class for commands issued for delayed execution.
Definition World.h:536
CommandFinished m_commandFinished
Definition World.h:543
void * m_callbackArg
Definition World.h:540
CliCommandHolder(void *callbackArg, char const *command, Print zprint, CommandFinished commandFinished)
Definition World.cpp:3607
Print m_print
Definition World.h:542
void(*)(void *, std::string_view) Print
Definition World.h:537
char * m_command
Definition World.h:541
void(*)(void *, bool success) CommandFinished
Definition World.h:538
void SetInterval(time_t interval)
Definition Timer.h:94
time_t GetInterval() const
Definition Timer.h:99
void Update(time_t diff)
Definition Timer.h:71
void SetCurrent(time_t current)
Definition Timer.h:89
void Reset()
Definition Timer.h:83
uint32 Realm
Definition Realm.h:44
Definition Realm.h:66
RealmHandle Id
Definition Realm.h:67