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 TrinityCore 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_bool_configs[CONFIG_EXTENDED_ACCOUNT_NAME_LENGTH_LIMIT] = sConfigMgr->GetBoolDefault("ExtendedAccountNameLengthLimit", false);
819 m_int_configs[CONFIG_STRICT_PLAYER_NAMES] = sConfigMgr->GetIntDefault ("StrictPlayerNames", 0);
820 m_int_configs[CONFIG_STRICT_CHARTER_NAMES] = sConfigMgr->GetIntDefault ("StrictCharterNames", 0);
821 m_int_configs[CONFIG_STRICT_PET_NAMES] = sConfigMgr->GetIntDefault ("StrictPetNames", 0);
822
823 m_int_configs[CONFIG_MIN_PLAYER_NAME] = sConfigMgr->GetIntDefault ("MinPlayerName", 2);
825 {
826 TC_LOG_ERROR("server.loading", "MinPlayerName ({}) must be in range 1..{}. Set to 2.", m_int_configs[CONFIG_MIN_PLAYER_NAME], MAX_PLAYER_NAME);
828 }
829
830 m_int_configs[CONFIG_MIN_CHARTER_NAME] = sConfigMgr->GetIntDefault ("MinCharterName", 2);
832 {
833 TC_LOG_ERROR("server.loading", "MinCharterName ({}) must be in range 1..{}. Set to 2.", m_int_configs[CONFIG_MIN_CHARTER_NAME], MAX_CHARTER_NAME);
835 }
836
837 m_int_configs[CONFIG_MIN_PET_NAME] = sConfigMgr->GetIntDefault ("MinPetName", 2);
839 {
840 TC_LOG_ERROR("server.loading", "MinPetName ({}) must be in range 1..{}. Set to 2.", m_int_configs[CONFIG_MIN_PET_NAME], MAX_PET_NAME);
842 }
843
844 m_int_configs[CONFIG_CHARTER_COST_GUILD] = sConfigMgr->GetIntDefault("Guild.CharterCost", 1000);
845 m_int_configs[CONFIG_CHARTER_COST_ARENA_2v2] = sConfigMgr->GetIntDefault("ArenaTeam.CharterCost.2v2", 800000);
846 m_int_configs[CONFIG_CHARTER_COST_ARENA_3v3] = sConfigMgr->GetIntDefault("ArenaTeam.CharterCost.3v3", 1200000);
847 m_int_configs[CONFIG_CHARTER_COST_ARENA_5v5] = sConfigMgr->GetIntDefault("ArenaTeam.CharterCost.5v5", 2000000);
848
849 m_int_configs[CONFIG_CHARACTER_CREATING_DISABLED] = sConfigMgr->GetIntDefault("CharacterCreating.Disabled", 0);
850 m_int_configs[CONFIG_CHARACTER_CREATING_DISABLED_RACEMASK] = sConfigMgr->GetIntDefault("CharacterCreating.Disabled.RaceMask", 0);
851 m_int_configs[CONFIG_CHARACTER_CREATING_DISABLED_CLASSMASK] = sConfigMgr->GetIntDefault("CharacterCreating.Disabled.ClassMask", 0);
852
853 m_int_configs[CONFIG_CHARACTERS_PER_REALM] = sConfigMgr->GetIntDefault("CharactersPerRealm", MAX_CHARACTERS_PER_REALM);
855 {
856 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);
858 }
859
860 // must be after CONFIG_CHARACTERS_PER_REALM
861 m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT] = sConfigMgr->GetIntDefault("CharactersPerAccount", 50);
863 {
864 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]);
866 }
867
868 m_int_configs[CONFIG_DEATH_KNIGHTS_PER_REALM] = sConfigMgr->GetIntDefault("DeathKnightsPerRealm", 1);
870 {
871 TC_LOG_ERROR("server.loading", "DeathKnightsPerRealm ({}) must be in range 0..10. Set to 1.", m_int_configs[CONFIG_DEATH_KNIGHTS_PER_REALM]);
873 }
874
875 m_int_configs[CONFIG_CHARACTER_CREATING_MIN_LEVEL_FOR_DEATH_KNIGHT] = sConfigMgr->GetIntDefault("CharacterCreating.MinLevelForDeathKnight", 55);
876
877 m_int_configs[CONFIG_SKIP_CINEMATICS] = sConfigMgr->GetIntDefault("SkipCinematics", 0);
879 {
880 TC_LOG_ERROR("server.loading", "SkipCinematics ({}) must be in range 0..2. Set to 0.", m_int_configs[CONFIG_SKIP_CINEMATICS]);
882 }
883
884 if (reload)
885 {
886 uint32 val = sConfigMgr->GetIntDefault("MaxPlayerLevel", DEFAULT_MAX_LEVEL);
888 TC_LOG_ERROR("server.loading", "MaxPlayerLevel option can't be changed at config reload, using current value ({}).", m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
889 }
890 else
891 m_int_configs[CONFIG_MAX_PLAYER_LEVEL] = sConfigMgr->GetIntDefault("MaxPlayerLevel", DEFAULT_MAX_LEVEL);
892
894 {
895 TC_LOG_ERROR("server.loading", "MaxPlayerLevel ({}) must be in range 1..{}. Set to {}.", m_int_configs[CONFIG_MAX_PLAYER_LEVEL], MAX_LEVEL, MAX_LEVEL);
897 }
898
899 m_int_configs[CONFIG_MIN_DUALSPEC_LEVEL] = sConfigMgr->GetIntDefault("MinDualSpecLevel", 40);
900
901 m_int_configs[CONFIG_START_PLAYER_LEVEL] = sConfigMgr->GetIntDefault("StartPlayerLevel", 1);
903 {
904 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]);
906 }
908 {
909 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]);
911 }
912
913 m_int_configs[CONFIG_START_DEATH_KNIGHT_PLAYER_LEVEL] = sConfigMgr->GetIntDefault("StartDeathKnightPlayerLevel", 55);
915 {
916 TC_LOG_ERROR("server.loading", "StartDeathKnightPlayerLevel ({}) must be in range 1..MaxPlayerLevel({}). Set to 55.",
919 }
921 {
922 TC_LOG_ERROR("server.loading", "StartDeathKnightPlayerLevel ({}) must be in range 1..MaxPlayerLevel({}). Set to {}.",
925 }
926
927 m_int_configs[CONFIG_START_PLAYER_MONEY] = sConfigMgr->GetIntDefault("StartPlayerMoney", 0);
929 {
930 TC_LOG_ERROR("server.loading", "StartPlayerMoney ({}) must be in range 0..{}. Set to {}.", m_int_configs[CONFIG_START_PLAYER_MONEY], MAX_MONEY_AMOUNT, 0);
932 }
934 {
935 TC_LOG_ERROR("server.loading", "StartPlayerMoney ({}) must be in range 0..{}. Set to {}.",
938 }
939
940 m_int_configs[CONFIG_START_DEATH_KNIGHT_PLAYER_MONEY] = sConfigMgr->GetIntDefault("StartDeathKnightPlayerMoney", 2000);
942 {
943 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);
945 }
947 {
948 TC_LOG_ERROR("server.loading", "StartDeathKnightPlayerMoney ({}) must be in range 0..{}. Set to {}.",
951 }
952
953 m_int_configs[CONFIG_MAX_HONOR_POINTS] = sConfigMgr->GetIntDefault("MaxHonorPoints", 75000);
955 {
956 TC_LOG_ERROR("server.loading", "MaxHonorPoints ({}) can't be negative. Set to 0.", m_int_configs[CONFIG_MAX_HONOR_POINTS]);
958 }
959
960 m_int_configs[CONFIG_START_HONOR_POINTS] = sConfigMgr->GetIntDefault("StartHonorPoints", 0);
962 {
963 TC_LOG_ERROR("server.loading", "StartHonorPoints ({}) must be in range 0..MaxHonorPoints({}). Set to {}.",
966 }
968 {
969 TC_LOG_ERROR("server.loading", "StartHonorPoints ({}) must be in range 0..MaxHonorPoints({}). Set to {}.",
972 }
973
974 m_int_configs[CONFIG_MAX_ARENA_POINTS] = sConfigMgr->GetIntDefault("MaxArenaPoints", 10000);
976 {
977 TC_LOG_ERROR("server.loading", "MaxArenaPoints ({}) can't be negative. Set to 0.", m_int_configs[CONFIG_MAX_ARENA_POINTS]);
979 }
980
981 m_int_configs[CONFIG_START_ARENA_POINTS] = sConfigMgr->GetIntDefault("StartArenaPoints", 0);
983 {
984 TC_LOG_ERROR("server.loading", "StartArenaPoints ({}) must be in range 0..MaxArenaPoints({}). Set to {}.",
987 }
989 {
990 TC_LOG_ERROR("server.loading", "StartArenaPoints ({}) must be in range 0..MaxArenaPoints({}). Set to {}.",
993 }
994
995 m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL] = sConfigMgr->GetIntDefault("RecruitAFriend.MaxLevel", 60);
997 {
998 TC_LOG_ERROR("server.loading", "RecruitAFriend.MaxLevel ({}) must be in the range 0..MaxLevel({}). Set to {}.",
1001 }
1002
1003 m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL_DIFFERENCE] = sConfigMgr->GetIntDefault("RecruitAFriend.MaxDifference", 4);
1004 m_bool_configs[CONFIG_ALL_TAXI_PATHS] = sConfigMgr->GetBoolDefault("AllFlightPaths", false);
1005 m_bool_configs[CONFIG_INSTANT_TAXI] = sConfigMgr->GetBoolDefault("InstantFlightPaths", false);
1006
1007 m_bool_configs[CONFIG_INSTANCE_IGNORE_LEVEL] = sConfigMgr->GetBoolDefault("Instance.IgnoreLevel", false);
1008 m_bool_configs[CONFIG_INSTANCE_IGNORE_RAID] = sConfigMgr->GetBoolDefault("Instance.IgnoreRaid", false);
1009
1010 m_bool_configs[CONFIG_CAST_UNSTUCK] = sConfigMgr->GetBoolDefault("CastUnstuck", true);
1011 m_int_configs[CONFIG_INSTANCE_RESET_TIME_HOUR] = sConfigMgr->GetIntDefault("Instance.ResetTimeHour", 4);
1012 m_int_configs[CONFIG_INSTANCE_UNLOAD_DELAY] = sConfigMgr->GetIntDefault("Instance.UnloadDelay", 30 * MINUTE * IN_MILLISECONDS);
1013
1014 m_int_configs[CONFIG_DAILY_QUEST_RESET_TIME_HOUR] = sConfigMgr->GetIntDefault("Quests.DailyResetTime", 3);
1016 {
1017 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]);
1019 }
1020
1021 m_int_configs[CONFIG_WEEKLY_QUEST_RESET_TIME_WDAY] = sConfigMgr->GetIntDefault("Quests.WeeklyResetWDay", 3);
1023 {
1024 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]);
1026 }
1027
1028 m_int_configs[CONFIG_MAX_PRIMARY_TRADE_SKILL] = sConfigMgr->GetIntDefault("MaxPrimaryTradeSkill", 2);
1029 m_int_configs[CONFIG_MIN_PETITION_SIGNS] = sConfigMgr->GetIntDefault("MinPetitionSigns", 9);
1031 {
1032 TC_LOG_ERROR("server.loading", "MinPetitionSigns ({}) must be in range 0..9. Set to 9.", m_int_configs[CONFIG_MIN_PETITION_SIGNS]);
1034 }
1035
1036 m_int_configs[CONFIG_GM_LOGIN_STATE] = sConfigMgr->GetIntDefault("GM.LoginState", 2);
1037 m_int_configs[CONFIG_GM_VISIBLE_STATE] = sConfigMgr->GetIntDefault("GM.Visible", 2);
1038 m_int_configs[CONFIG_GM_CHAT] = sConfigMgr->GetIntDefault("GM.Chat", 2);
1039 m_int_configs[CONFIG_GM_WHISPERING_TO] = sConfigMgr->GetIntDefault("GM.WhisperingTo", 2);
1040 m_int_configs[CONFIG_GM_FREEZE_DURATION] = sConfigMgr->GetIntDefault("GM.FreezeAuraDuration", 0);
1041
1042 m_int_configs[CONFIG_GM_LEVEL_IN_GM_LIST] = sConfigMgr->GetIntDefault("GM.InGMList.Level", SEC_ADMINISTRATOR);
1043 m_int_configs[CONFIG_GM_LEVEL_IN_WHO_LIST] = sConfigMgr->GetIntDefault("GM.InWhoList.Level", SEC_ADMINISTRATOR);
1044 m_int_configs[CONFIG_START_GM_LEVEL] = sConfigMgr->GetIntDefault("GM.StartLevel", 1);
1046 {
1047 TC_LOG_ERROR("server.loading", "GM.StartLevel ({}) must be in range StartPlayerLevel({})..{}. Set to {}.",
1050 }
1052 {
1053 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);
1055 }
1056 m_bool_configs[CONFIG_ALLOW_GM_GROUP] = sConfigMgr->GetBoolDefault("GM.AllowInvite", false);
1057 m_bool_configs[CONFIG_GM_LOWER_SECURITY] = sConfigMgr->GetBoolDefault("GM.LowerSecurity", false);
1058 m_float_configs[CONFIG_CHANCE_OF_GM_SURVEY] = sConfigMgr->GetFloatDefault("GM.TicketSystem.ChanceOfGMSurvey", 50.0f);
1059 m_int_configs[CONFIG_FORCE_SHUTDOWN_THRESHOLD] = sConfigMgr->GetIntDefault("GM.ForceShutdownThreshold", 30);
1060
1061 m_int_configs[CONFIG_GROUP_VISIBILITY] = sConfigMgr->GetIntDefault("Visibility.GroupMode", 1);
1062
1063 m_int_configs[CONFIG_MAIL_DELIVERY_DELAY] = sConfigMgr->GetIntDefault("MailDeliveryDelay", HOUR);
1064 m_int_configs[CONFIG_CLEAN_OLD_MAIL_TIME] = sConfigMgr->GetIntDefault("CleanOldMailTime", 4);
1066 {
1067 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]);
1069 }
1070
1071 m_int_configs[CONFIG_UPTIME_UPDATE] = sConfigMgr->GetIntDefault("UpdateUptimeInterval", 10);
1073 {
1074 TC_LOG_ERROR("server.loading", "UpdateUptimeInterval ({}) must be > 0, set to default 10.", m_int_configs[CONFIG_UPTIME_UPDATE]);
1076 }
1077 if (reload)
1078 {
1081 }
1082
1083 // log db cleanup interval
1084 m_int_configs[CONFIG_LOGDB_CLEARINTERVAL] = sConfigMgr->GetIntDefault("LogDB.Opt.ClearInterval", 10);
1086 {
1087 TC_LOG_ERROR("server.loading", "LogDB.Opt.ClearInterval ({}) must be > 0, set to default 10.", m_int_configs[CONFIG_LOGDB_CLEARINTERVAL]);
1089 }
1090 if (reload)
1091 {
1094 }
1095 m_int_configs[CONFIG_LOGDB_CLEARTIME] = sConfigMgr->GetIntDefault("LogDB.Opt.ClearTime", 1209600); // 14 days default
1096 TC_LOG_INFO("server.loading", "Will clear `logs` table of entries older than {} seconds every {} minutes.",
1098
1099 m_int_configs[CONFIG_SKILL_CHANCE_ORANGE] = sConfigMgr->GetIntDefault("SkillChance.Orange", 100);
1100 m_int_configs[CONFIG_SKILL_CHANCE_YELLOW] = sConfigMgr->GetIntDefault("SkillChance.Yellow", 75);
1101 m_int_configs[CONFIG_SKILL_CHANCE_GREEN] = sConfigMgr->GetIntDefault("SkillChance.Green", 25);
1102 m_int_configs[CONFIG_SKILL_CHANCE_GREY] = sConfigMgr->GetIntDefault("SkillChance.Grey", 0);
1103
1104 m_int_configs[CONFIG_SKILL_CHANCE_MINING_STEPS] = sConfigMgr->GetIntDefault("SkillChance.MiningSteps", 75);
1105 m_int_configs[CONFIG_SKILL_CHANCE_SKINNING_STEPS] = sConfigMgr->GetIntDefault("SkillChance.SkinningSteps", 75);
1106
1107 m_bool_configs[CONFIG_SKILL_PROSPECTING] = sConfigMgr->GetBoolDefault("SkillChance.Prospecting", false);
1108 m_bool_configs[CONFIG_SKILL_MILLING] = sConfigMgr->GetBoolDefault("SkillChance.Milling", false);
1109
1110 m_int_configs[CONFIG_SKILL_GAIN_CRAFTING] = sConfigMgr->GetIntDefault("SkillGain.Crafting", 1);
1111
1112 m_int_configs[CONFIG_SKILL_GAIN_DEFENSE] = sConfigMgr->GetIntDefault("SkillGain.Defense", 1);
1113
1114 m_int_configs[CONFIG_SKILL_GAIN_GATHERING] = sConfigMgr->GetIntDefault("SkillGain.Gathering", 1);
1115
1116 m_int_configs[CONFIG_SKILL_GAIN_WEAPON] = sConfigMgr->GetIntDefault("SkillGain.Weapon", 1);
1117
1118 m_int_configs[CONFIG_MAX_OVERSPEED_PINGS] = sConfigMgr->GetIntDefault("MaxOverspeedPings", 2);
1120 {
1121 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]);
1123 }
1124
1125 m_bool_configs[CONFIG_WEATHER] = sConfigMgr->GetBoolDefault("ActivateWeather", true);
1126
1127 m_int_configs[CONFIG_DISABLE_BREATHING] = sConfigMgr->GetIntDefault("DisableWaterBreath", SEC_CONSOLE);
1128
1129 m_bool_configs[CONFIG_ALWAYS_MAX_SKILL_FOR_LEVEL] = sConfigMgr->GetBoolDefault("AlwaysMaxSkillForLevel", false);
1130
1131 if (reload)
1132 {
1133 uint32 val = sConfigMgr->GetIntDefault("Expansion", 2);
1134 if (val != m_int_configs[CONFIG_EXPANSION])
1135 TC_LOG_ERROR("server.loading", "Expansion option can't be changed at worldserver.conf reload, using current value ({}).", m_int_configs[CONFIG_EXPANSION]);
1136 }
1137 else
1138 m_int_configs[CONFIG_EXPANSION] = sConfigMgr->GetIntDefault("Expansion", 2);
1139
1140 m_int_configs[CONFIG_CHATFLOOD_MESSAGE_COUNT] = sConfigMgr->GetIntDefault("ChatFlood.MessageCount", 10);
1141 m_int_configs[CONFIG_CHATFLOOD_MESSAGE_DELAY] = sConfigMgr->GetIntDefault("ChatFlood.MessageDelay", 1);
1142 m_int_configs[CONFIG_CHATFLOOD_ADDON_MESSAGE_COUNT] = sConfigMgr->GetIntDefault("ChatFlood.AddonMessageCount", 100);
1143 m_int_configs[CONFIG_CHATFLOOD_ADDON_MESSAGE_DELAY] = sConfigMgr->GetIntDefault("ChatFlood.AddonMessageDelay", 1);
1144 m_int_configs[CONFIG_CHATFLOOD_MUTE_TIME] = sConfigMgr->GetIntDefault("ChatFlood.MuteTime", 10);
1145
1146 m_bool_configs[CONFIG_EVENT_ANNOUNCE] = sConfigMgr->GetBoolDefault("Event.Announce", false);
1147
1148 m_float_configs[CONFIG_CREATURE_FAMILY_FLEE_ASSISTANCE_RADIUS] = sConfigMgr->GetFloatDefault("CreatureFamilyFleeAssistanceRadius", 30.0f);
1149 m_float_configs[CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS] = sConfigMgr->GetFloatDefault("CreatureFamilyAssistanceRadius", 10.0f);
1150 m_int_configs[CONFIG_CREATURE_FAMILY_ASSISTANCE_DELAY] = sConfigMgr->GetIntDefault("CreatureFamilyAssistanceDelay", 1500);
1151 m_int_configs[CONFIG_CREATURE_FAMILY_FLEE_DELAY] = sConfigMgr->GetIntDefault("CreatureFamilyFleeDelay", 7000);
1152
1153 m_int_configs[CONFIG_WORLD_BOSS_LEVEL_DIFF] = sConfigMgr->GetIntDefault("WorldBossLevelDiff", 3);
1154
1155 m_bool_configs[CONFIG_QUEST_ENABLE_QUEST_TRACKER] = sConfigMgr->GetBoolDefault("Quests.EnableQuestTracker", false);
1156
1157 // note: disable value (-1) will assigned as 0xFFFFFFF, to prevent overflow at calculations limit it to max possible player level MAX_LEVEL(100)
1158 m_int_configs[CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF] = sConfigMgr->GetIntDefault("Quests.LowLevelHideDiff", 4);
1161 m_int_configs[CONFIG_QUEST_HIGH_LEVEL_HIDE_DIFF] = sConfigMgr->GetIntDefault("Quests.HighLevelHideDiff", 7);
1164 m_bool_configs[CONFIG_QUEST_IGNORE_RAID] = sConfigMgr->GetBoolDefault("Quests.IgnoreRaid", false);
1165 m_bool_configs[CONFIG_QUEST_IGNORE_AUTO_ACCEPT] = sConfigMgr->GetBoolDefault("Quests.IgnoreAutoAccept", false);
1166 m_bool_configs[CONFIG_QUEST_IGNORE_AUTO_COMPLETE] = sConfigMgr->GetBoolDefault("Quests.IgnoreAutoComplete", false);
1167
1168 m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR] = sConfigMgr->GetIntDefault("Battleground.Random.ResetHour", 6);
1170 {
1171 TC_LOG_ERROR("server.loading", "Battleground.Random.ResetHour ({}) can't be load. Set to 6.", m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR]);
1173 }
1174
1175 m_int_configs[CONFIG_CALENDAR_DELETE_OLD_EVENTS_HOUR] = sConfigMgr->GetIntDefault("Calendar.DeleteOldEventsHour", 6);
1177 {
1178 TC_LOG_ERROR("misc", "Calendar.DeleteOldEventsHour ({}) can't be load. Set to 6.", m_int_configs[CONFIG_CALENDAR_DELETE_OLD_EVENTS_HOUR]);
1180 }
1181
1182 m_int_configs[CONFIG_GUILD_RESET_HOUR] = sConfigMgr->GetIntDefault("Guild.ResetHour", 6);
1184 {
1185 TC_LOG_ERROR("misc", "Guild.ResetHour ({}) can't be load. Set to 6.", m_int_configs[CONFIG_GUILD_RESET_HOUR]);
1187 }
1188
1189 m_bool_configs[CONFIG_DETECT_POS_COLLISION] = sConfigMgr->GetBoolDefault("DetectPosCollision", true);
1190
1191 m_bool_configs[CONFIG_RESTRICTED_LFG_CHANNEL] = sConfigMgr->GetBoolDefault("Channel.RestrictedLfg", true);
1192 m_int_configs[CONFIG_TALENTS_INSPECTING] = sConfigMgr->GetIntDefault("TalentsInspecting", 1);
1193 m_bool_configs[CONFIG_CHAT_FAKE_MESSAGE_PREVENTING] = sConfigMgr->GetBoolDefault("ChatFakeMessagePreventing", false);
1194 m_int_configs[CONFIG_CHAT_STRICT_LINK_CHECKING_SEVERITY] = sConfigMgr->GetIntDefault("ChatStrictLinkChecking.Severity", 0);
1195 m_int_configs[CONFIG_CHAT_STRICT_LINK_CHECKING_KICK] = sConfigMgr->GetIntDefault("ChatStrictLinkChecking.Kick", 0);
1196
1197 m_int_configs[CONFIG_CORPSE_DECAY_NORMAL] = sConfigMgr->GetIntDefault("Corpse.Decay.NORMAL", 60);
1198 m_int_configs[CONFIG_CORPSE_DECAY_RARE] = sConfigMgr->GetIntDefault("Corpse.Decay.RARE", 300);
1199 m_int_configs[CONFIG_CORPSE_DECAY_ELITE] = sConfigMgr->GetIntDefault("Corpse.Decay.ELITE", 300);
1200 m_int_configs[CONFIG_CORPSE_DECAY_RAREELITE] = sConfigMgr->GetIntDefault("Corpse.Decay.RAREELITE", 300);
1201 m_int_configs[CONFIG_CORPSE_DECAY_WORLDBOSS] = sConfigMgr->GetIntDefault("Corpse.Decay.WORLDBOSS", 3600);
1202
1203 m_int_configs[CONFIG_DEATH_SICKNESS_LEVEL] = sConfigMgr->GetIntDefault ("Death.SicknessLevel", 11);
1204 m_bool_configs[CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP] = sConfigMgr->GetBoolDefault("Death.CorpseReclaimDelay.PvP", true);
1205 m_bool_configs[CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE] = sConfigMgr->GetBoolDefault("Death.CorpseReclaimDelay.PvE", true);
1206 m_bool_configs[CONFIG_DEATH_BONES_WORLD] = sConfigMgr->GetBoolDefault("Death.Bones.World", true);
1207 m_bool_configs[CONFIG_DEATH_BONES_BG_OR_ARENA] = sConfigMgr->GetBoolDefault("Death.Bones.BattlegroundOrArena", true);
1208
1209 m_bool_configs[CONFIG_DIE_COMMAND_MODE] = sConfigMgr->GetBoolDefault("Die.Command.Mode", true);
1210
1211 m_float_configs[CONFIG_THREAT_RADIUS] = sConfigMgr->GetFloatDefault("ThreatRadius", 60.0f);
1212
1213 // always use declined names in the russian client
1215 (m_int_configs[CONFIG_REALM_ZONE] == REALM_ZONE_RUSSIAN) ? true : sConfigMgr->GetBoolDefault("DeclinedNames", false);
1216
1217 m_float_configs[CONFIG_LISTEN_RANGE_SAY] = sConfigMgr->GetFloatDefault("ListenRange.Say", 25.0f);
1218 m_float_configs[CONFIG_LISTEN_RANGE_TEXTEMOTE] = sConfigMgr->GetFloatDefault("ListenRange.TextEmote", 25.0f);
1219 m_float_configs[CONFIG_LISTEN_RANGE_YELL] = sConfigMgr->GetFloatDefault("ListenRange.Yell", 300.0f);
1220
1221 m_bool_configs[CONFIG_BATTLEGROUND_CAST_DESERTER] = sConfigMgr->GetBoolDefault("Battleground.CastDeserter", true);
1222 m_bool_configs[CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE] = sConfigMgr->GetBoolDefault("Battleground.QueueAnnouncer.Enable", false);
1223 m_bool_configs[CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY] = sConfigMgr->GetBoolDefault("Battleground.QueueAnnouncer.PlayerOnly", false);
1224 m_bool_configs[CONFIG_BATTLEGROUND_STORE_STATISTICS_ENABLE] = sConfigMgr->GetBoolDefault("Battleground.StoreStatistics.Enable", false);
1225 m_bool_configs[CONFIG_BATTLEGROUND_TRACK_DESERTERS] = sConfigMgr->GetBoolDefault("Battleground.TrackDeserters.Enable", false);
1226 m_int_configs[CONFIG_BATTLEGROUND_REPORT_AFK] = sConfigMgr->GetIntDefault("Battleground.ReportAFK", 3);
1228 {
1229 TC_LOG_ERROR("server.loading", "Battleground.ReportAFK ({}) must be >0. Using 3 instead.", m_int_configs[CONFIG_BATTLEGROUND_REPORT_AFK]);
1231 }
1233 {
1234 TC_LOG_ERROR("server.loading", "Battleground.ReportAFK ({}) must be <10. Using 3 instead.", m_int_configs[CONFIG_BATTLEGROUND_REPORT_AFK]);
1236 }
1237 m_int_configs[CONFIG_BATTLEGROUND_INVITATION_TYPE] = sConfigMgr->GetIntDefault ("Battleground.InvitationType", 0);
1238 m_int_configs[CONFIG_BATTLEGROUND_PREMATURE_FINISH_TIMER] = sConfigMgr->GetIntDefault ("Battleground.PrematureFinishTimer", 5 * MINUTE * IN_MILLISECONDS);
1239 m_int_configs[CONFIG_BATTLEGROUND_PREMADE_GROUP_WAIT_FOR_MATCH] = sConfigMgr->GetIntDefault ("Battleground.PremadeGroupWaitForMatch", 30 * MINUTE * IN_MILLISECONDS);
1240 m_bool_configs[CONFIG_BG_XP_FOR_KILL] = sConfigMgr->GetBoolDefault("Battleground.GiveXPForKills", false);
1241 m_int_configs[CONFIG_ARENA_MAX_RATING_DIFFERENCE] = sConfigMgr->GetIntDefault ("Arena.MaxRatingDifference", 150);
1242 m_int_configs[CONFIG_ARENA_RATING_DISCARD_TIMER] = sConfigMgr->GetIntDefault ("Arena.RatingDiscardTimer", 10 * MINUTE * IN_MILLISECONDS);
1243 m_int_configs[CONFIG_ARENA_PREV_OPPONENTS_DISCARD_TIMER] = sConfigMgr->GetIntDefault ("Arena.PreviousOpponentsDiscardTimer", 2 * MINUTE * IN_MILLISECONDS);
1244 m_int_configs[CONFIG_ARENA_RATED_UPDATE_TIMER] = sConfigMgr->GetIntDefault ("Arena.RatedUpdateTimer", 5 * IN_MILLISECONDS);
1245 m_bool_configs[CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS] = sConfigMgr->GetBoolDefault("Arena.AutoDistributePoints", false);
1246 m_int_configs[CONFIG_ARENA_AUTO_DISTRIBUTE_INTERVAL_DAYS] = sConfigMgr->GetIntDefault ("Arena.AutoDistributeInterval", 7);
1247 m_bool_configs[CONFIG_ARENA_QUEUE_ANNOUNCER_ENABLE] = sConfigMgr->GetBoolDefault("Arena.QueueAnnouncer.Enable", false);
1248 m_int_configs[CONFIG_ARENA_SEASON_ID] = sConfigMgr->GetIntDefault ("Arena.ArenaSeason.ID", 1);
1249 m_int_configs[CONFIG_ARENA_START_RATING] = sConfigMgr->GetIntDefault ("Arena.ArenaStartRating", 0);
1250 m_int_configs[CONFIG_ARENA_START_PERSONAL_RATING] = sConfigMgr->GetIntDefault ("Arena.ArenaStartPersonalRating", 0);
1251 m_int_configs[CONFIG_ARENA_START_MATCHMAKER_RATING] = sConfigMgr->GetIntDefault ("Arena.ArenaStartMatchmakerRating", 1500);
1252 m_bool_configs[CONFIG_ARENA_SEASON_IN_PROGRESS] = sConfigMgr->GetBoolDefault("Arena.ArenaSeason.InProgress", true);
1253 m_bool_configs[CONFIG_ARENA_LOG_EXTENDED_INFO] = sConfigMgr->GetBoolDefault("ArenaLog.ExtendedInfo", false);
1254 m_float_configs[CONFIG_ARENA_WIN_RATING_MODIFIER_1] = sConfigMgr->GetFloatDefault("Arena.ArenaWinRatingModifier1", 48.0f);
1255 m_float_configs[CONFIG_ARENA_WIN_RATING_MODIFIER_2] = sConfigMgr->GetFloatDefault("Arena.ArenaWinRatingModifier2", 24.0f);
1256 m_float_configs[CONFIG_ARENA_LOSE_RATING_MODIFIER] = sConfigMgr->GetFloatDefault("Arena.ArenaLoseRatingModifier", 24.0f);
1257 m_float_configs[CONFIG_ARENA_MATCHMAKER_RATING_MODIFIER] = sConfigMgr->GetFloatDefault("Arena.ArenaMatchmakerRatingModifier", 24.0f);
1258
1259 m_bool_configs[CONFIG_OFFHAND_CHECK_AT_SPELL_UNLEARN] = sConfigMgr->GetBoolDefault("OffhandCheckAtSpellUnlearn", true);
1260
1261 m_int_configs[CONFIG_CREATURE_PICKPOCKET_REFILL] = sConfigMgr->GetIntDefault("Creature.PickPocketRefillDelay", 10 * MINUTE);
1262 m_int_configs[CONFIG_CREATURE_STOP_FOR_PLAYER] = sConfigMgr->GetIntDefault("Creature.MovingStopTimeForPlayer", 3 * MINUTE * IN_MILLISECONDS);
1263
1264 if (int32 clientCacheId = sConfigMgr->GetIntDefault("ClientCacheVersion", 0))
1265 {
1266 // overwrite DB/old value
1267 if (clientCacheId > 0)
1269 else
1270 TC_LOG_ERROR("server.loading", "ClientCacheVersion can't be negative {}, ignored.", clientCacheId);
1271 }
1272 TC_LOG_INFO("server.loading", "Client cache version set to: {}", m_int_configs[CONFIG_CLIENTCACHE_VERSION]);
1273
1274 m_int_configs[CONFIG_GUILD_EVENT_LOG_COUNT] = sConfigMgr->GetIntDefault("Guild.EventLogRecordsCount", GUILD_EVENTLOG_MAX_RECORDS);
1277 m_int_configs[CONFIG_GUILD_BANK_EVENT_LOG_COUNT] = sConfigMgr->GetIntDefault("Guild.BankEventLogRecordsCount", GUILD_BANKLOG_MAX_RECORDS);
1280
1281 // visibility on continents
1282 m_MaxVisibleDistanceOnContinents = sConfigMgr->GetFloatDefault("Visibility.Distance.Continents", DEFAULT_VISIBILITY_DISTANCE);
1283 if (m_MaxVisibleDistanceOnContinents < 45*sWorld->getRate(RATE_CREATURE_AGGRO))
1284 {
1285 TC_LOG_ERROR("server.loading", "Visibility.Distance.Continents can't be less max aggro radius {}", 45*sWorld->getRate(RATE_CREATURE_AGGRO));
1287 }
1289 {
1290 TC_LOG_ERROR("server.loading", "Visibility.Distance.Continents can't be greater {}", MAX_VISIBILITY_DISTANCE);
1292 }
1293
1294 // visibility in instances
1295 m_MaxVisibleDistanceInInstances = sConfigMgr->GetFloatDefault("Visibility.Distance.Instances", DEFAULT_VISIBILITY_INSTANCE);
1296 if (m_MaxVisibleDistanceInInstances < 45*sWorld->getRate(RATE_CREATURE_AGGRO))
1297 {
1298 TC_LOG_ERROR("server.loading", "Visibility.Distance.Instances can't be less max aggro radius {}", 45*sWorld->getRate(RATE_CREATURE_AGGRO));
1300 }
1302 {
1303 TC_LOG_ERROR("server.loading", "Visibility.Distance.Instances can't be greater {}", MAX_VISIBILITY_DISTANCE);
1305 }
1306
1307 // visibility in BG
1308 m_MaxVisibleDistanceInBG = sConfigMgr->GetFloatDefault("Visibility.Distance.BG", DEFAULT_VISIBILITY_BGARENAS);
1309 if (m_MaxVisibleDistanceInBG < 45*sWorld->getRate(RATE_CREATURE_AGGRO))
1310 {
1311 TC_LOG_ERROR("server.loading", "Visibility.Distance.BG can't be less max aggro radius {}", 45*sWorld->getRate(RATE_CREATURE_AGGRO));
1313 }
1315 {
1316 TC_LOG_ERROR("server.loading", "Visibility.Distance.BG can't be greater {}", MAX_VISIBILITY_DISTANCE);
1318 }
1319
1320 // Visibility in Arenas
1321 m_MaxVisibleDistanceInArenas = sConfigMgr->GetFloatDefault("Visibility.Distance.Arenas", DEFAULT_VISIBILITY_BGARENAS);
1322 if (m_MaxVisibleDistanceInArenas < 45*sWorld->getRate(RATE_CREATURE_AGGRO))
1323 {
1324 TC_LOG_ERROR("server.loading", "Visibility.Distance.Arenas can't be less max aggro radius {}", 45*sWorld->getRate(RATE_CREATURE_AGGRO));
1326 }
1328 {
1329 TC_LOG_ERROR("server.loading", "Visibility.Distance.Arenas can't be greater {}", MAX_VISIBILITY_DISTANCE);
1331 }
1332
1333 m_visibility_notify_periodOnContinents = sConfigMgr->GetIntDefault("Visibility.Notify.Period.OnContinents", DEFAULT_VISIBILITY_NOTIFY_PERIOD);
1334 m_visibility_notify_periodInInstances = sConfigMgr->GetIntDefault("Visibility.Notify.Period.InInstances", DEFAULT_VISIBILITY_NOTIFY_PERIOD);
1335 m_visibility_notify_periodInBG = sConfigMgr->GetIntDefault("Visibility.Notify.Period.InBG", DEFAULT_VISIBILITY_NOTIFY_PERIOD);
1336 m_visibility_notify_periodInArenas = sConfigMgr->GetIntDefault("Visibility.Notify.Period.InArenas", DEFAULT_VISIBILITY_NOTIFY_PERIOD);
1337
1339 m_int_configs[CONFIG_CHARDELETE_METHOD] = sConfigMgr->GetIntDefault("CharDelete.Method", 0);
1340 m_int_configs[CONFIG_CHARDELETE_MIN_LEVEL] = sConfigMgr->GetIntDefault("CharDelete.MinLevel", 0);
1341 m_int_configs[CONFIG_CHARDELETE_DEATH_KNIGHT_MIN_LEVEL] = sConfigMgr->GetIntDefault("CharDelete.DeathKnight.MinLevel", 0);
1342 m_int_configs[CONFIG_CHARDELETE_KEEP_DAYS] = sConfigMgr->GetIntDefault("CharDelete.KeepDays", 30);
1343
1344 // No aggro from gray mobs
1345 m_int_configs[CONFIG_NO_GRAY_AGGRO_ABOVE] = sConfigMgr->GetIntDefault("NoGrayAggro.Above", 0);
1346 m_int_configs[CONFIG_NO_GRAY_AGGRO_BELOW] = sConfigMgr->GetIntDefault("NoGrayAggro.Below", 0);
1348 {
1349 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]);
1351 }
1353 {
1354 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]);
1356 }
1358 {
1359 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]);
1361 }
1362
1363 // Respawn Settings
1364 m_int_configs[CONFIG_RESPAWN_MINCHECKINTERVALMS] = sConfigMgr->GetIntDefault("Respawn.MinCheckIntervalMS", 5000);
1365 m_int_configs[CONFIG_RESPAWN_DYNAMICMODE] = sConfigMgr->GetIntDefault("Respawn.DynamicMode", 0);
1367 {
1368 TC_LOG_ERROR("server.loading", "Invalid value for Respawn.DynamicMode ({}). Set to 0.", m_int_configs[CONFIG_RESPAWN_DYNAMICMODE]);
1370 }
1371 m_bool_configs[CONFIG_RESPAWN_DYNAMIC_ESCORTNPC] = sConfigMgr->GetBoolDefault("Respawn.DynamicEscortNPC", false);
1372 m_int_configs[CONFIG_RESPAWN_GUIDWARNLEVEL] = sConfigMgr->GetIntDefault("Respawn.GuidWarnLevel", 12000000);
1374 {
1375 TC_LOG_ERROR("server.loading", "Respawn.GuidWarnLevel ({}) cannot be greater than maximum GUID (16777215). Set to 12000000.", m_int_configs[CONFIG_RESPAWN_GUIDWARNLEVEL]);
1377 }
1378 m_int_configs[CONFIG_RESPAWN_GUIDALERTLEVEL] = sConfigMgr->GetIntDefault("Respawn.GuidAlertLevel", 16000000);
1380 {
1381 TC_LOG_ERROR("server.loading", "Respawn.GuidWarnLevel ({}) cannot be greater than maximum GUID (16777215). Set to 16000000.", m_int_configs[CONFIG_RESPAWN_GUIDALERTLEVEL]);
1383 }
1384 m_int_configs[CONFIG_RESPAWN_RESTARTQUIETTIME] = sConfigMgr->GetIntDefault("Respawn.RestartQuietTime", 3);
1386 {
1387 TC_LOG_ERROR("server.loading", "Respawn.RestartQuietTime ({}) must be an hour, between 0 and 23. Set to 3.", m_int_configs[CONFIG_RESPAWN_RESTARTQUIETTIME]);
1389 }
1390 m_float_configs[CONFIG_RESPAWN_DYNAMICRATE_CREATURE] = sConfigMgr->GetFloatDefault("Respawn.DynamicRateCreature", 10.0f);
1392 {
1393 TC_LOG_ERROR("server.loading", "Respawn.DynamicRateCreature ({}) must be positive. Set to 10.", m_float_configs[CONFIG_RESPAWN_DYNAMICRATE_CREATURE]);
1395 }
1396 m_int_configs[CONFIG_RESPAWN_DYNAMICMINIMUM_CREATURE] = sConfigMgr->GetIntDefault("Respawn.DynamicMinimumCreature", 10);
1397 m_float_configs[CONFIG_RESPAWN_DYNAMICRATE_GAMEOBJECT] = sConfigMgr->GetFloatDefault("Respawn.DynamicRateGameObject", 10.0f);
1399 {
1400 TC_LOG_ERROR("server.loading", "Respawn.DynamicRateGameObject ({}) must be positive. Set to 10.", m_float_configs[CONFIG_RESPAWN_DYNAMICRATE_GAMEOBJECT]);
1402 }
1403 m_int_configs[CONFIG_RESPAWN_DYNAMICMINIMUM_GAMEOBJECT] = sConfigMgr->GetIntDefault("Respawn.DynamicMinimumGameObject", 10);
1404 _guidWarningMsg = sConfigMgr->GetStringDefault("Respawn.WarningMessage", "There will be an unscheduled server restart at 03:00. The server will be available again shortly after.");
1405 _alertRestartReason = sConfigMgr->GetStringDefault("Respawn.AlertRestartReason", "Urgent Maintenance");
1406 m_int_configs[CONFIG_RESPAWN_GUIDWARNING_FREQUENCY] = sConfigMgr->GetIntDefault("Respawn.WarningFrequency", 1800);
1408 std::string dataPath = sConfigMgr->GetStringDefault("DataDir", "./");
1409 if (dataPath.empty() || (dataPath.at(dataPath.length()-1) != '/' && dataPath.at(dataPath.length()-1) != '\\'))
1410 dataPath.push_back('/');
1411
1412#if TRINITY_PLATFORM == TRINITY_PLATFORM_UNIX || TRINITY_PLATFORM == TRINITY_PLATFORM_APPLE
1413 if (dataPath[0] == '~')
1414 {
1415 char const* home = getenv("HOME");
1416 if (home)
1417 dataPath.replace(0, 1, home);
1418 }
1419#endif
1420
1421 if (reload)
1422 {
1423 if (dataPath != m_dataPath)
1424 TC_LOG_ERROR("server.loading", "DataDir option can't be changed at worldserver.conf reload, using current value ({}).", m_dataPath);
1425 }
1426 else
1427 {
1428 m_dataPath = dataPath;
1429 TC_LOG_INFO("server.loading", "Using DataDir {}", m_dataPath);
1430 }
1431
1432 m_bool_configs[CONFIG_ENABLE_MMAPS] = sConfigMgr->GetBoolDefault("mmap.enablePathFinding", true);
1433 TC_LOG_INFO("server.loading", "WORLD: MMap data directory is: {}mmaps", m_dataPath);
1434
1435 m_bool_configs[CONFIG_VMAP_INDOOR_CHECK] = sConfigMgr->GetBoolDefault("vmap.enableIndoorCheck", false);
1436 bool enableIndoor = sConfigMgr->GetBoolDefault("vmap.enableIndoorCheck", true);
1437 bool enableLOS = sConfigMgr->GetBoolDefault("vmap.enableLOS", true);
1438 bool enableHeight = sConfigMgr->GetBoolDefault("vmap.enableHeight", true);
1439
1440 if (!enableHeight)
1441 TC_LOG_ERROR("server.loading", "VMap height checking disabled! Creatures movements and other various things WILL be broken! Expect no support.");
1442
1445 TC_LOG_INFO("server.loading", "VMap support included. LineOfSight: {}, getHeight: {}, indoorCheck: {}", enableLOS, enableHeight, enableIndoor);
1446 TC_LOG_INFO("server.loading", "VMap data directory is: {}vmaps", m_dataPath);
1447
1448 m_int_configs[CONFIG_MAX_WHO] = sConfigMgr->GetIntDefault("MaxWhoListReturns", 49);
1449 m_int_configs[CONFIG_WHO_LIST_UPDATE_INTERVAL] = sConfigMgr->GetIntDefault("WhoList.Update.Interval", 5);
1451 {
1452 TC_LOG_ERROR("server.loading", "WhoList.Update.Interval ({}) must be > 0, set to default 5 seconds.", m_int_configs[CONFIG_WHO_LIST_UPDATE_INTERVAL]);
1454 }
1455 if (reload)
1456 {
1459 }
1460
1461 m_bool_configs[CONFIG_START_ALL_SPELLS] = sConfigMgr->GetBoolDefault("PlayerStart.AllSpells", false);
1462 m_int_configs[CONFIG_HONOR_AFTER_DUEL] = sConfigMgr->GetIntDefault("HonorPointsAfterDuel", 0);
1463 m_bool_configs[CONFIG_RESET_DUEL_COOLDOWNS] = sConfigMgr->GetBoolDefault("ResetDuelCooldowns", false);
1464 m_bool_configs[CONFIG_RESET_DUEL_HEALTH_MANA] = sConfigMgr->GetBoolDefault("ResetDuelHealthMana", false);
1465 m_bool_configs[CONFIG_START_ALL_EXPLORED] = sConfigMgr->GetBoolDefault("PlayerStart.MapsExplored", false);
1466 m_bool_configs[CONFIG_START_ALL_REP] = sConfigMgr->GetBoolDefault("PlayerStart.AllReputation", false);
1467 m_bool_configs[CONFIG_ALWAYS_MAXSKILL] = sConfigMgr->GetBoolDefault("AlwaysMaxWeaponSkill", false);
1468 m_bool_configs[CONFIG_PVP_TOKEN_ENABLE] = sConfigMgr->GetBoolDefault("PvPToken.Enable", false);
1469 m_int_configs[CONFIG_PVP_TOKEN_MAP_TYPE] = sConfigMgr->GetIntDefault("PvPToken.MapAllowType", 4);
1470 m_int_configs[CONFIG_PVP_TOKEN_ID] = sConfigMgr->GetIntDefault("PvPToken.ItemID", 29434);
1471 m_int_configs[CONFIG_PVP_TOKEN_COUNT] = sConfigMgr->GetIntDefault("PvPToken.ItemCount", 1);
1474
1475 m_bool_configs[CONFIG_ALLOW_TRACK_BOTH_RESOURCES] = sConfigMgr->GetBoolDefault("AllowTrackBothResources", false);
1476 m_bool_configs[CONFIG_NO_RESET_TALENT_COST] = sConfigMgr->GetBoolDefault("NoResetTalentsCost", false);
1477 m_bool_configs[CONFIG_SHOW_KICK_IN_WORLD] = sConfigMgr->GetBoolDefault("ShowKickInWorld", false);
1478 m_bool_configs[CONFIG_SHOW_MUTE_IN_WORLD] = sConfigMgr->GetBoolDefault("ShowMuteInWorld", false);
1479 m_bool_configs[CONFIG_SHOW_BAN_IN_WORLD] = sConfigMgr->GetBoolDefault("ShowBanInWorld", false);
1480 m_int_configs[CONFIG_NUMTHREADS] = sConfigMgr->GetIntDefault("MapUpdate.Threads", 1);
1481 m_int_configs[CONFIG_MAX_RESULTS_LOOKUP_COMMANDS] = sConfigMgr->GetIntDefault("Command.LookupMaxResults", 0);
1482
1483 // Warden
1484 m_bool_configs[CONFIG_WARDEN_ENABLED] = sConfigMgr->GetBoolDefault("Warden.Enabled", false);
1485 m_int_configs[CONFIG_WARDEN_NUM_INJECT_CHECKS] = sConfigMgr->GetIntDefault("Warden.NumInjectionChecks", 9);
1486 m_int_configs[CONFIG_WARDEN_NUM_LUA_CHECKS] = sConfigMgr->GetIntDefault("Warden.NumLuaSandboxChecks", 1);
1487 m_int_configs[CONFIG_WARDEN_NUM_CLIENT_MOD_CHECKS] = sConfigMgr->GetIntDefault("Warden.NumClientModChecks", 1);
1488 m_int_configs[CONFIG_WARDEN_CLIENT_BAN_DURATION] = sConfigMgr->GetIntDefault("Warden.BanDuration", 86400);
1489 m_int_configs[CONFIG_WARDEN_CLIENT_CHECK_HOLDOFF] = sConfigMgr->GetIntDefault("Warden.ClientCheckHoldOff", 30);
1490 m_int_configs[CONFIG_WARDEN_CLIENT_FAIL_ACTION] = sConfigMgr->GetIntDefault("Warden.ClientCheckFailAction", 0);
1491 m_int_configs[CONFIG_WARDEN_CLIENT_RESPONSE_DELAY] = sConfigMgr->GetIntDefault("Warden.ClientResponseDelay", 600);
1492
1493 // Dungeon finder
1494 m_int_configs[CONFIG_LFG_OPTIONSMASK] = sConfigMgr->GetIntDefault("DungeonFinder.OptionsMask", 1);
1495
1496 // DBC_ItemAttributes
1497 m_bool_configs[CONFIG_DBC_ENFORCE_ITEM_ATTRIBUTES] = sConfigMgr->GetBoolDefault("DBC.EnforceItemAttributes", true);
1498
1499 // Accountpassword Secruity
1500 m_int_configs[CONFIG_ACC_PASSCHANGESEC] = sConfigMgr->GetIntDefault("Account.PasswordChangeSecurity", 0);
1501
1502 // Random Battleground Rewards
1503 m_int_configs[CONFIG_BG_REWARD_WINNER_HONOR_FIRST] = sConfigMgr->GetIntDefault("Battleground.RewardWinnerHonorFirst", 30);
1504 m_int_configs[CONFIG_BG_REWARD_WINNER_ARENA_FIRST] = sConfigMgr->GetIntDefault("Battleground.RewardWinnerArenaFirst", 25);
1505 m_int_configs[CONFIG_BG_REWARD_WINNER_HONOR_LAST] = sConfigMgr->GetIntDefault("Battleground.RewardWinnerHonorLast", 15);
1506 m_int_configs[CONFIG_BG_REWARD_WINNER_ARENA_LAST] = sConfigMgr->GetIntDefault("Battleground.RewardWinnerArenaLast", 0);
1507 m_int_configs[CONFIG_BG_REWARD_LOSER_HONOR_FIRST] = sConfigMgr->GetIntDefault("Battleground.RewardLoserHonorFirst", 5);
1508 m_int_configs[CONFIG_BG_REWARD_LOSER_HONOR_LAST] = sConfigMgr->GetIntDefault("Battleground.RewardLoserHonorLast", 5);
1509
1510 // Max instances per hour
1511 m_int_configs[CONFIG_MAX_INSTANCES_PER_HOUR] = sConfigMgr->GetIntDefault("AccountInstancesPerHour", 5);
1512
1513 // Anounce reset of instance to whole party
1514 m_bool_configs[CONFIG_INSTANCES_RESET_ANNOUNCE] = sConfigMgr->GetBoolDefault("InstancesResetAnnounce", false);
1515
1516 // AutoBroadcast
1517 m_bool_configs[CONFIG_AUTOBROADCAST] = sConfigMgr->GetBoolDefault("AutoBroadcast.On", false);
1518 m_int_configs[CONFIG_AUTOBROADCAST_CENTER] = sConfigMgr->GetIntDefault("AutoBroadcast.Center", 0);
1519 m_int_configs[CONFIG_AUTOBROADCAST_INTERVAL] = sConfigMgr->GetIntDefault("AutoBroadcast.Timer", 60000);
1520 if (reload)
1521 {
1524 }
1525
1526 // MySQL ping time interval
1527 m_int_configs[CONFIG_DB_PING_INTERVAL] = sConfigMgr->GetIntDefault("MaxPingTime", 30);
1528
1529 // misc
1530 m_bool_configs[CONFIG_PDUMP_NO_PATHS] = sConfigMgr->GetBoolDefault("PlayerDump.DisallowPaths", true);
1531 m_bool_configs[CONFIG_PDUMP_NO_OVERWRITE] = sConfigMgr->GetBoolDefault("PlayerDump.DisallowOverwrite", true);
1532
1533 // Wintergrasp battlefield
1534 m_bool_configs[CONFIG_WINTERGRASP_ENABLE] = sConfigMgr->GetBoolDefault("Wintergrasp.Enable", false);
1535 m_int_configs[CONFIG_WINTERGRASP_PLR_MAX] = sConfigMgr->GetIntDefault("Wintergrasp.PlayerMax", 100);
1536 m_int_configs[CONFIG_WINTERGRASP_PLR_MIN] = sConfigMgr->GetIntDefault("Wintergrasp.PlayerMin", 0);
1537 m_int_configs[CONFIG_WINTERGRASP_PLR_MIN_LVL] = sConfigMgr->GetIntDefault("Wintergrasp.PlayerMinLvl", 77);
1538 m_int_configs[CONFIG_WINTERGRASP_BATTLETIME] = sConfigMgr->GetIntDefault("Wintergrasp.BattleTimer", 30);
1539 m_int_configs[CONFIG_WINTERGRASP_NOBATTLETIME] = sConfigMgr->GetIntDefault("Wintergrasp.NoBattleTimer", 150);
1540 m_int_configs[CONFIG_WINTERGRASP_RESTART_AFTER_CRASH] = sConfigMgr->GetIntDefault("Wintergrasp.CrashRestartTimer", 10);
1541
1542 // Stats limits
1543 m_bool_configs[CONFIG_STATS_LIMITS_ENABLE] = sConfigMgr->GetBoolDefault("Stats.Limits.Enable", false);
1544 m_float_configs[CONFIG_STATS_LIMITS_DODGE] = sConfigMgr->GetFloatDefault("Stats.Limits.Dodge", 95.0f);
1545 m_float_configs[CONFIG_STATS_LIMITS_PARRY] = sConfigMgr->GetFloatDefault("Stats.Limits.Parry", 95.0f);
1546 m_float_configs[CONFIG_STATS_LIMITS_BLOCK] = sConfigMgr->GetFloatDefault("Stats.Limits.Block", 95.0f);
1547 m_float_configs[CONFIG_STATS_LIMITS_CRIT] = sConfigMgr->GetFloatDefault("Stats.Limits.Crit", 95.0f);
1548
1549 //packet spoof punishment
1551 m_int_configs[CONFIG_PACKET_SPOOF_BANMODE] = sConfigMgr->GetIntDefault("PacketSpoof.BanMode", (uint32)BAN_ACCOUNT);
1554
1555 m_int_configs[CONFIG_PACKET_SPOOF_BANDURATION] = sConfigMgr->GetIntDefault("PacketSpoof.BanDuration", 86400);
1556
1557 m_int_configs[CONFIG_BIRTHDAY_TIME] = sConfigMgr->GetIntDefault("BirthdayTime", 1222964635);
1558
1559 m_bool_configs[CONFIG_IP_BASED_ACTION_LOGGING] = sConfigMgr->GetBoolDefault("Allow.IP.Based.Action.Logging", false);
1560
1561 // AHBot
1562 m_int_configs[CONFIG_AHBOT_UPDATE_INTERVAL] = sConfigMgr->GetIntDefault("AuctionHouseBot.Update.Interval", 20);
1563
1564 m_bool_configs[CONFIG_CALCULATE_CREATURE_ZONE_AREA_DATA] = sConfigMgr->GetBoolDefault("Calculate.Creature.Zone.Area.Data", false);
1565 m_bool_configs[CONFIG_CALCULATE_GAMEOBJECT_ZONE_AREA_DATA] = sConfigMgr->GetBoolDefault("Calculate.Gameoject.Zone.Area.Data", false);
1566
1567 // HotSwap
1568 m_bool_configs[CONFIG_HOTSWAP_ENABLED] = sConfigMgr->GetBoolDefault("HotSwap.Enabled", true);
1569 m_bool_configs[CONFIG_HOTSWAP_RECOMPILER_ENABLED] = sConfigMgr->GetBoolDefault("HotSwap.EnableReCompiler", true);
1570 m_bool_configs[CONFIG_HOTSWAP_EARLY_TERMINATION_ENABLED] = sConfigMgr->GetBoolDefault("HotSwap.EnableEarlyTermination", true);
1571 m_bool_configs[CONFIG_HOTSWAP_BUILD_FILE_RECREATION_ENABLED] = sConfigMgr->GetBoolDefault("HotSwap.EnableBuildFileRecreation", true);
1572 m_bool_configs[CONFIG_HOTSWAP_INSTALL_ENABLED] = sConfigMgr->GetBoolDefault("HotSwap.EnableInstall", true);
1573 m_bool_configs[CONFIG_HOTSWAP_PREFIX_CORRECTION_ENABLED] = sConfigMgr->GetBoolDefault("HotSwap.EnablePrefixCorrection", true);
1574
1575 // prevent character rename on character customization
1576 m_bool_configs[CONFIG_PREVENT_RENAME_CUSTOMIZATION] = sConfigMgr->GetBoolDefault("PreventRenameCharacterOnCustomization", false);
1577
1578 // Allow 5-man parties to use raid warnings
1579 m_bool_configs[CONFIG_CHAT_PARTY_RAID_WARNINGS] = sConfigMgr->GetBoolDefault("PartyRaidWarnings", false);
1580
1581 // Allow to cache data queries
1582 m_bool_configs[CONFIG_CACHE_DATA_QUERIES] = sConfigMgr->GetBoolDefault("CacheDataQueries", true);
1583
1584 // Whether to use LoS from game objects
1585 m_bool_configs[CONFIG_CHECK_GOBJECT_LOS] = sConfigMgr->GetBoolDefault("CheckGameObjectLoS", true);
1586
1587 // Anti movement cheat measure. Time each client have to acknowledge a movement change until they are kicked
1588 m_int_configs[CONFIG_PENDING_MOVE_CHANGES_TIMEOUT] = sConfigMgr->GetIntDefault("AntiCheat.PendingMoveChangesTimeoutTime", 0);
1589
1590 // Specifies if IP addresses can be logged to the database
1591 m_bool_configs[CONFIG_ALLOW_LOGGING_IP_ADDRESSES_IN_DATABASE] = sConfigMgr->GetBoolDefault("AllowLoggingIPAddressesInDatabase", true, true);
1592
1593 // call ScriptMgr if we're reloading the configuration
1594 if (reload)
1595 sScriptMgr->OnConfigLoad(reload);
1596}
1597
1600{
1601 if (uint32 realmId = sConfigMgr->GetIntDefault("RealmID", 0)) // 0 reserved for auth
1602 sLog->SetRealmId(realmId);
1603
1605 uint32 startupBegin = getMSTime();
1606
1608 srand((unsigned int)GameTime::GetGameTime());
1609
1611 dtAllocSetCustom(dtCustomAlloc, dtCustomFree);
1612
1617
1620
1623
1625 sObjectMgr->SetHighestGuids();
1626
1628 if (!MapManager::ExistMapAndVMap(0, -6240.32f, 331.033f)
1629 || !MapManager::ExistMapAndVMap(0, -8949.95f, -132.493f)
1630 || !MapManager::ExistMapAndVMap(1, -618.518f, -4251.67f)
1631 || !MapManager::ExistMapAndVMap(0, 1676.35f, 1677.45f)
1632 || !MapManager::ExistMapAndVMap(1, 10311.3f, 832.463f)
1633 || !MapManager::ExistMapAndVMap(1, -2917.58f, -257.98f)
1635 !MapManager::ExistMapAndVMap(530, 10349.6f, -6357.29f) ||
1636 !MapManager::ExistMapAndVMap(530, -3961.64f, -13931.2f))))
1637 {
1638 TC_LOG_FATAL("server.loading", "Unable to load critical files - server shutting down !!!");
1639 exit(1);
1640 }
1641
1643 sPoolMgr->Initialize();
1644
1646 sGameEventMgr->Initialize();
1647
1649
1650 TC_LOG_INFO("server.loading", "Loading Trinity strings...");
1651 if (!sObjectMgr->LoadTrinityStrings())
1652 exit(1); // Error message displayed in function already
1653
1655 //No SQL injection as values are treated as integers
1656
1657 // not send custom type REALM_FFA_PVP to realm list
1660
1661 LoginDatabase.PExecute("UPDATE realmlist SET icon = {}, timezone = {} WHERE id = '{}'", server_type, realm_zone, realm.Id.Realm); // One-time query
1662
1664 TC_LOG_INFO("server.loading", "Initialize data stores...");
1666 DetectDBCLang();
1667
1668 // Load cinematic cameras
1670
1671 // Load IP Location Database
1672 sIPLocation->Load();
1673
1674 std::vector<uint32> mapIds;
1675 for (uint32 mapId = 0; mapId < sMapStore.GetNumRows(); mapId++)
1676 if (sMapStore.LookupEntry(mapId))
1677 mapIds.push_back(mapId);
1678
1679 vmmgr2->InitializeThreadUnsafe(mapIds);
1680
1682 mmmgr->InitializeThreadUnsafe(mapIds);
1683
1684 TC_LOG_INFO("server.loading", "Initializing PlayerDump tables...");
1686
1689
1690 TC_LOG_INFO("server.loading", "Loading SpellInfo store...");
1691 sSpellMgr->LoadSpellInfoStore();
1692
1693 TC_LOG_INFO("server.loading", "Loading SpellInfo corrections...");
1694 sSpellMgr->LoadSpellInfoCorrections();
1695
1696 TC_LOG_INFO("server.loading", "Loading SkillLineAbilityMultiMap Data...");
1697 sSpellMgr->LoadSkillLineAbilityMap();
1698
1699 TC_LOG_INFO("server.loading", "Loading SpellInfo custom attributes...");
1700 sSpellMgr->LoadSpellInfoCustomAttributes();
1701
1702 TC_LOG_INFO("server.loading", "Loading SpellInfo diminishing infos...");
1703 sSpellMgr->LoadSpellInfoDiminishing();
1704
1705 TC_LOG_INFO("server.loading", "Loading SpellInfo immunity infos...");
1706 sSpellMgr->LoadSpellInfoImmunities();
1707
1708 TC_LOG_INFO("server.loading", "Loading Player Totem models...");
1709 sObjectMgr->LoadPlayerTotemModels();
1710
1711 TC_LOG_INFO("server.loading", "Loading GameObject models...");
1713
1714 TC_LOG_INFO("server.loading", "Loading Script Names...");
1715 sObjectMgr->LoadScriptNames();
1716
1717 TC_LOG_INFO("server.loading", "Loading Instance Template...");
1718 sObjectMgr->LoadInstanceTemplate();
1719
1720 // Must be called before `respawn` data
1721 TC_LOG_INFO("server.loading", "Loading instances...");
1722 sInstanceSaveMgr->LoadInstances();
1723
1724 // Load before guilds and arena teams
1725 TC_LOG_INFO("server.loading", "Loading character cache store...");
1726 sCharacterCache->LoadCharacterCacheStorage();
1727
1728 TC_LOG_INFO("server.loading", "Loading Broadcast texts...");
1729 sObjectMgr->LoadBroadcastTexts();
1730 sObjectMgr->LoadBroadcastTextLocales();
1731
1732 TC_LOG_INFO("server.loading", "Loading Localization strings...");
1733 uint32 oldMSTime = getMSTime();
1734 sObjectMgr->LoadCreatureLocales();
1735 sObjectMgr->LoadGameObjectLocales();
1736 sObjectMgr->LoadItemLocales();
1737 sObjectMgr->LoadItemSetNameLocales();
1738 sObjectMgr->LoadQuestLocales();
1739 sObjectMgr->LoadQuestOfferRewardLocale();
1740 sObjectMgr->LoadQuestRequestItemsLocale();
1741 sObjectMgr->LoadNpcTextLocales();
1742 sObjectMgr->LoadPageTextLocales();
1743 sObjectMgr->LoadGossipMenuItemsLocales();
1744 sObjectMgr->LoadPointOfInterestLocales();
1745 sObjectMgr->LoadQuestGreetingLocales();
1746
1747 sObjectMgr->SetDBCLocaleIndex(GetDefaultDbcLocale()); // Get once for all the locale index of DBC language (console/broadcasts)
1748 TC_LOG_INFO("server.loading", ">> Localization strings loaded in {} ms", GetMSTimeDiffToNow(oldMSTime));
1749
1750 TC_LOG_INFO("server.loading", "Loading Account Roles and Permissions...");
1751 sAccountMgr->LoadRBAC();
1752
1753 TC_LOG_INFO("server.loading", "Loading Page Texts...");
1754 sObjectMgr->LoadPageTexts();
1755
1756 TC_LOG_INFO("server.loading", "Loading Game Object Templates..."); // must be after LoadPageTexts
1757 sObjectMgr->LoadGameObjectTemplate();
1758
1759 TC_LOG_INFO("server.loading", "Loading Game Object template addons...");
1760 sObjectMgr->LoadGameObjectTemplateAddons();
1761
1762 TC_LOG_INFO("server.loading", "Loading Transport templates...");
1763 sTransportMgr->LoadTransportTemplates();
1764
1765 TC_LOG_INFO("server.loading", "Loading Transport animations and rotations...");
1766 sTransportMgr->LoadTransportAnimationAndRotation();
1767
1768 TC_LOG_INFO("server.loading", "Loading Spell Rank Data...");
1769 sSpellMgr->LoadSpellRanks();
1770
1771 TC_LOG_INFO("server.loading", "Loading Spell Required Data...");
1772 sSpellMgr->LoadSpellRequired();
1773
1774 TC_LOG_INFO("server.loading", "Loading Spell Group types...");
1775 sSpellMgr->LoadSpellGroups();
1776
1777 TC_LOG_INFO("server.loading", "Loading Spell Learn Skills...");
1778 sSpellMgr->LoadSpellLearnSkills(); // must be after LoadSpellRanks
1779
1780 TC_LOG_INFO("server.loading", "Loading SpellInfo SpellSpecific and AuraState...");
1781 sSpellMgr->LoadSpellInfoSpellSpecificAndAuraState(); // must be after LoadSpellRanks
1782
1783 TC_LOG_INFO("server.loading", "Loading Spell Learn Spells...");
1784 sSpellMgr->LoadSpellLearnSpells();
1785
1786 TC_LOG_INFO("server.loading", "Loading Spell Proc conditions and data...");
1787 sSpellMgr->LoadSpellProcs();
1788
1789 TC_LOG_INFO("server.loading", "Loading Spell Bonus Data...");
1790 sSpellMgr->LoadSpellBonuses();
1791
1792 TC_LOG_INFO("server.loading", "Loading Aggro Spells Definitions...");
1793 sSpellMgr->LoadSpellThreats();
1794
1795 TC_LOG_INFO("server.loading", "Loading Spell Group Stack Rules...");
1796 sSpellMgr->LoadSpellGroupStackRules();
1797
1798 TC_LOG_INFO("server.loading", "Loading NPC Texts...");
1799 sObjectMgr->LoadGossipText();
1800
1801 TC_LOG_INFO("server.loading", "Loading Enchant Spells Proc datas...");
1802 sSpellMgr->LoadSpellEnchantProcData();
1803
1804 TC_LOG_INFO("server.loading", "Loading Item Random Enchantments Table...");
1806
1807 TC_LOG_INFO("server.loading", "Loading Disables"); // must be before loading quests and items
1809
1810 TC_LOG_INFO("server.loading", "Loading Items..."); // must be after LoadRandomEnchantmentsTable and LoadPageTexts
1811 sObjectMgr->LoadItemTemplates();
1812
1813 TC_LOG_INFO("server.loading", "Loading Item set names..."); // must be after LoadItemPrototypes
1814 sObjectMgr->LoadItemSetNames();
1815
1816 TC_LOG_INFO("server.loading", "Loading Creature Model Based Info Data...");
1817 sObjectMgr->LoadCreatureModelInfo();
1818
1819 TC_LOG_INFO("server.loading", "Loading Creature templates...");
1820 sObjectMgr->LoadCreatureTemplates();
1821
1822 TC_LOG_INFO("server.loading", "Loading Equipment templates..."); // must be after LoadCreatureTemplates
1823 sObjectMgr->LoadEquipmentTemplates();
1824
1825 TC_LOG_INFO("server.loading", "Loading Creature template addons...");
1826 sObjectMgr->LoadCreatureTemplateAddons();
1827
1828 TC_LOG_INFO("server.loading", "Loading Reputation Reward Rates...");
1829 sObjectMgr->LoadReputationRewardRate();
1830
1831 TC_LOG_INFO("server.loading", "Loading Creature Reputation OnKill Data...");
1832 sObjectMgr->LoadReputationOnKill();
1833
1834 TC_LOG_INFO("server.loading", "Loading Reputation Spillover Data...");
1835 sObjectMgr->LoadReputationSpilloverTemplate();
1836
1837 TC_LOG_INFO("server.loading", "Loading Points Of Interest Data...");
1838 sObjectMgr->LoadPointsOfInterest();
1839
1840 TC_LOG_INFO("server.loading", "Loading Creature Base Stats...");
1841 sObjectMgr->LoadCreatureClassLevelStats();
1842
1843 TC_LOG_INFO("server.loading", "Loading Spawn Group Templates...");
1844 sObjectMgr->LoadSpawnGroupTemplates();
1845
1846 TC_LOG_INFO("server.loading", "Loading Creature Data...");
1847 sObjectMgr->LoadCreatures();
1848
1849 TC_LOG_INFO("server.loading", "Loading Temporary Summon Data...");
1850 sObjectMgr->LoadTempSummons(); // must be after LoadCreatureTemplates() and LoadGameObjectTemplates()
1851
1852 TC_LOG_INFO("server.loading", "Loading pet levelup spells...");
1853 sSpellMgr->LoadPetLevelupSpellMap();
1854
1855 TC_LOG_INFO("server.loading", "Loading pet default spells additional to levelup spells...");
1856 sSpellMgr->LoadPetDefaultSpells();
1857
1858 TC_LOG_INFO("server.loading", "Loading Creature Addon Data...");
1859 sObjectMgr->LoadCreatureAddons(); // must be after LoadCreatureTemplates() and LoadCreatures()
1860
1861 TC_LOG_INFO("server.loading", "Loading Creature Movement Overrides...");
1862 sObjectMgr->LoadCreatureMovementOverrides(); // must be after LoadCreatures()
1863
1864 TC_LOG_INFO("server.loading", "Loading Gameobject Data...");
1865 sObjectMgr->LoadGameObjects();
1866
1867 TC_LOG_INFO("server.loading", "Loading Spawn Group Data...");
1868 sObjectMgr->LoadSpawnGroups();
1869
1870 TC_LOG_INFO("server.loading", "Loading instance spawn groups...");
1871 sObjectMgr->LoadInstanceSpawnGroups();
1872
1873 TC_LOG_INFO("server.loading", "Loading GameObject Addon Data...");
1874 sObjectMgr->LoadGameObjectAddons(); // must be after LoadGameObjects()
1875
1876 TC_LOG_INFO("server.loading", "Loading GameObject faction and flags overrides...");
1877 sObjectMgr->LoadGameObjectOverrides(); // must be after LoadGameObjects()
1878
1879 TC_LOG_INFO("server.loading", "Loading GameObject Quest Items...");
1880 sObjectMgr->LoadGameObjectQuestItems();
1881
1882 TC_LOG_INFO("server.loading", "Loading Creature Quest Items...");
1883 sObjectMgr->LoadCreatureQuestItems();
1884
1885 TC_LOG_INFO("server.loading", "Loading Creature Linked Respawn...");
1886 sObjectMgr->LoadLinkedRespawn(); // must be after LoadCreatures(), LoadGameObjects()
1887
1888 TC_LOG_INFO("server.loading", "Loading Weather Data...");
1890
1891 TC_LOG_INFO("server.loading", "Loading Quests...");
1892 sObjectMgr->LoadQuests(); // must be loaded after DBCs, creature_template, item_template, gameobject tables
1893
1894 TC_LOG_INFO("server.loading", "Checking Quest Disables");
1895 DisableMgr::CheckQuestDisables(); // must be after loading quests
1896
1897 TC_LOG_INFO("server.loading", "Loading Quest POI");
1898 sObjectMgr->LoadQuestPOI();
1899
1900 TC_LOG_INFO("server.loading", "Loading Quests Starters and Enders...");
1901 sObjectMgr->LoadQuestStartersAndEnders(); // must be after quest load
1902
1903 TC_LOG_INFO("server.loading", "Loading Quests Greetings...");
1904 sObjectMgr->LoadQuestGreetings(); // must be loaded after creature_template, gameobject_template tables
1905
1906 TC_LOG_INFO("server.loading", "Loading Objects Pooling Data...");
1907 sPoolMgr->LoadFromDB();
1908 TC_LOG_INFO("server.loading", "Loading Quest Pooling Data...");
1909 sQuestPoolMgr->LoadFromDB(); // must be after quest templates
1910
1911 TC_LOG_INFO("server.loading", "Loading Game Event Data..."); // must be after loading pools fully
1912 sGameEventMgr->LoadHolidayDates(); // Must be after loading DBC
1913 sGameEventMgr->LoadFromDB(); // Must be after loading holiday dates
1914
1915 TC_LOG_INFO("server.loading", "Loading UNIT_NPC_FLAG_SPELLCLICK Data..."); // must be after LoadQuests
1916 sObjectMgr->LoadNPCSpellClickSpells();
1917
1918 TC_LOG_INFO("server.loading", "Loading Vehicle Templates...");
1919 sObjectMgr->LoadVehicleTemplate(); // must be after LoadCreatureTemplates()
1920
1921 TC_LOG_INFO("server.loading", "Loading Vehicle Template Accessories...");
1922 sObjectMgr->LoadVehicleTemplateAccessories(); // must be after LoadCreatureTemplates() and LoadNPCSpellClickSpells()
1923
1924 TC_LOG_INFO("server.loading", "Loading Vehicle Accessories...");
1925 sObjectMgr->LoadVehicleAccessories(); // must be after LoadCreatureTemplates() and LoadNPCSpellClickSpells()
1926
1927 TC_LOG_INFO("server.loading", "Loading Vehicle Seat Addon Data...");
1928 sObjectMgr->LoadVehicleSeatAddon(); // must be after loading DBC
1929
1930 TC_LOG_INFO("server.loading", "Loading SpellArea Data..."); // must be after quest load
1931 sSpellMgr->LoadSpellAreas();
1932
1933 TC_LOG_INFO("server.loading", "Loading Area Trigger Teleports definitions...");
1934 sObjectMgr->LoadAreaTriggerTeleports();
1935
1936 TC_LOG_INFO("server.loading", "Loading Access Requirements...");
1937 sObjectMgr->LoadAccessRequirements(); // must be after item template load
1938
1939 TC_LOG_INFO("server.loading", "Loading Quest Area Triggers...");
1940 sObjectMgr->LoadQuestAreaTriggers(); // must be after LoadQuests
1941
1942 TC_LOG_INFO("server.loading", "Loading Tavern Area Triggers...");
1943 sObjectMgr->LoadTavernAreaTriggers();
1944
1945 TC_LOG_INFO("server.loading", "Loading AreaTrigger script names...");
1946 sObjectMgr->LoadAreaTriggerScripts();
1947
1948 TC_LOG_INFO("server.loading", "Loading LFG entrance positions..."); // Must be after areatriggers
1949 sLFGMgr->LoadLFGDungeons();
1950
1951 TC_LOG_INFO("server.loading", "Loading Dungeon boss data...");
1952 sObjectMgr->LoadInstanceEncounters();
1953
1954 TC_LOG_INFO("server.loading", "Loading LFG rewards...");
1955 sLFGMgr->LoadRewards();
1956
1957 TC_LOG_INFO("server.loading", "Loading Graveyard-zone links...");
1958 sObjectMgr->LoadGraveyardZones();
1959
1960 TC_LOG_INFO("server.loading", "Loading spell pet auras...");
1961 sSpellMgr->LoadSpellPetAuras();
1962
1963 TC_LOG_INFO("server.loading", "Loading Spell target coordinates...");
1964 sSpellMgr->LoadSpellTargetPositions();
1965
1966 TC_LOG_INFO("server.loading", "Loading enchant custom attributes...");
1967 sSpellMgr->LoadEnchantCustomAttr();
1968
1969 TC_LOG_INFO("server.loading", "Loading linked spells...");
1970 sSpellMgr->LoadSpellLinked();
1971
1972 TC_LOG_INFO("server.loading", "Loading Player Create Data...");
1973 sObjectMgr->LoadPlayerInfo();
1974
1975 TC_LOG_INFO("server.loading", "Loading Exploration BaseXP Data...");
1976 sObjectMgr->LoadExplorationBaseXP();
1977
1978 TC_LOG_INFO("server.loading", "Loading Pet Name Parts...");
1979 sObjectMgr->LoadPetNames();
1980
1982
1983 TC_LOG_INFO("server.loading", "Loading the max pet number...");
1984 sObjectMgr->LoadPetNumber();
1985
1986 TC_LOG_INFO("server.loading", "Loading pet level stats...");
1987 sObjectMgr->LoadPetLevelInfo();
1988
1989 TC_LOG_INFO("server.loading", "Loading Player level dependent mail rewards...");
1990 sObjectMgr->LoadMailLevelRewards();
1991
1992 // Loot tables
1994
1995 TC_LOG_INFO("server.loading", "Loading Skill Discovery Table...");
1997
1998 TC_LOG_INFO("server.loading", "Loading Skill Extra Item Table...");
2000
2001 TC_LOG_INFO("server.loading", "Loading Skill Perfection Data Table...");
2003
2004 TC_LOG_INFO("server.loading", "Loading Skill Fishing base level requirements...");
2005 sObjectMgr->LoadFishingBaseSkillLevel();
2006
2007 TC_LOG_INFO("server.loading", "Loading Achievements...");
2008 sAchievementMgr->LoadAchievementReferenceList();
2009 TC_LOG_INFO("server.loading", "Loading Achievement Criteria Lists...");
2010 sAchievementMgr->LoadAchievementCriteriaList();
2011 TC_LOG_INFO("server.loading", "Loading Achievement Criteria Data...");
2012 sAchievementMgr->LoadAchievementCriteriaData();
2013 TC_LOG_INFO("server.loading", "Loading Achievement Rewards...");
2014 sAchievementMgr->LoadRewards();
2015 TC_LOG_INFO("server.loading", "Loading Achievement Reward Locales...");
2016 sAchievementMgr->LoadRewardLocales();
2017 TC_LOG_INFO("server.loading", "Loading Completed Achievements...");
2018 sAchievementMgr->LoadCompletedAchievements();
2019
2021 TC_LOG_INFO("server.loading", "Loading Item Auctions...");
2022 sAuctionMgr->LoadAuctionItems();
2023
2024 TC_LOG_INFO("server.loading", "Loading Auctions...");
2025 sAuctionMgr->LoadAuctions();
2026
2027 TC_LOG_INFO("server.loading", "Loading Guilds...");
2028 sGuildMgr->LoadGuilds();
2029
2030 TC_LOG_INFO("server.loading", "Loading ArenaTeams...");
2031 sArenaTeamMgr->LoadArenaTeams();
2032
2033 TC_LOG_INFO("server.loading", "Loading Groups...");
2034 sGroupMgr->LoadGroups();
2035
2036 TC_LOG_INFO("server.loading", "Loading ReservedNames...");
2037 sObjectMgr->LoadReservedPlayersNames();
2038
2039 TC_LOG_INFO("server.loading", "Loading GameObjects for quests...");
2040 sObjectMgr->LoadGameObjectForQuests();
2041
2042 TC_LOG_INFO("server.loading", "Loading BattleMasters...");
2043 sBattlegroundMgr->LoadBattleMastersEntry(); // must be after load CreatureTemplate
2044
2045 TC_LOG_INFO("server.loading", "Loading GameTeleports...");
2046 sObjectMgr->LoadGameTele();
2047
2048 TC_LOG_INFO("server.loading", "Loading Trainers..."); // must be after LoadCreatureTemplates
2049 sObjectMgr->LoadTrainers();
2050
2051 TC_LOG_INFO("server.loading", "Loading Creature default trainers...");
2052 sObjectMgr->LoadCreatureDefaultTrainers();
2053
2054 TC_LOG_INFO("server.loading", "Loading Gossip menu...");
2055 sObjectMgr->LoadGossipMenu();
2056
2057 TC_LOG_INFO("server.loading", "Loading Gossip menu options...");
2058 sObjectMgr->LoadGossipMenuItems(); // must be after LoadTrainers
2059
2060 TC_LOG_INFO("server.loading", "Loading Vendors...");
2061 sObjectMgr->LoadVendors(); // must be after load CreatureTemplate and ItemTemplate
2062
2063 TC_LOG_INFO("server.loading", "Loading Waypoints...");
2064 sWaypointMgr->Load();
2065
2066 TC_LOG_INFO("server.loading", "Loading Creature Formations...");
2067 sFormationMgr->LoadCreatureFormations();
2068
2069 TC_LOG_INFO("server.loading", "Loading World States..."); // must be loaded before battleground, outdoor PvP and conditions
2071
2072 TC_LOG_INFO("server.loading", "Loading Conditions...");
2073 sConditionMgr->LoadConditions();
2074
2075 TC_LOG_INFO("server.loading", "Loading faction change achievement pairs...");
2076 sObjectMgr->LoadFactionChangeAchievements();
2077
2078 TC_LOG_INFO("server.loading", "Loading faction change spell pairs...");
2079 sObjectMgr->LoadFactionChangeSpells();
2080
2081 TC_LOG_INFO("server.loading", "Loading faction change quest pairs...");
2082 sObjectMgr->LoadFactionChangeQuests();
2083
2084 TC_LOG_INFO("server.loading", "Loading faction change item pairs...");
2085 sObjectMgr->LoadFactionChangeItems();
2086
2087 TC_LOG_INFO("server.loading", "Loading faction change reputation pairs...");
2088 sObjectMgr->LoadFactionChangeReputations();
2089
2090 TC_LOG_INFO("server.loading", "Loading faction change title pairs...");
2091 sObjectMgr->LoadFactionChangeTitles();
2092
2093 TC_LOG_INFO("server.loading", "Loading GM tickets...");
2094 sTicketMgr->LoadTickets();
2095
2096 TC_LOG_INFO("server.loading", "Loading GM surveys...");
2097 sTicketMgr->LoadSurveys();
2098
2099 TC_LOG_INFO("server.loading", "Loading client addons...");
2101
2103 TC_LOG_INFO("server.loading", "Returning old mails...");
2104 sObjectMgr->ReturnOrDeleteOldMails(false);
2105
2106 TC_LOG_INFO("server.loading", "Loading Autobroadcasts...");
2108
2110 sObjectMgr->LoadEventScripts(); // must be after load Creature/Gameobject(Template/Data)
2111 sObjectMgr->LoadWaypointScripts();
2112
2113 TC_LOG_INFO("server.loading", "Loading spell script names...");
2114 sObjectMgr->LoadSpellScriptNames();
2115
2116 TC_LOG_INFO("server.loading", "Loading Creature Texts...");
2117 sCreatureTextMgr->LoadCreatureTexts();
2118
2119 TC_LOG_INFO("server.loading", "Loading Creature Text Locales...");
2120 sCreatureTextMgr->LoadCreatureTextLocales();
2121
2122 TC_LOG_INFO("server.loading", "Initializing Scripts...");
2123 sScriptMgr->Initialize();
2124 sScriptMgr->OnConfigLoad(false); // must be done after the ScriptMgr has been properly initialized
2125
2126 TC_LOG_INFO("server.loading", "Validating spell scripts...");
2127 sObjectMgr->ValidateSpellScripts();
2128
2129 TC_LOG_INFO("server.loading", "Loading SmartAI scripts...");
2130 sSmartScriptMgr->LoadSmartAIFromDB();
2131
2132 TC_LOG_INFO("server.loading", "Loading Calendar data...");
2133 sCalendarMgr->LoadFromDB();
2134
2135 TC_LOG_INFO("server.loading", "Loading Petitions...");
2136 sPetitionMgr->LoadPetitions();
2137
2138 TC_LOG_INFO("server.loading", "Loading Signatures...");
2139 sPetitionMgr->LoadSignatures();
2140
2141 TC_LOG_INFO("server.loading", "Loading Item loot...");
2142 sLootItemStorage->LoadStorageFromDB();
2143
2144 TC_LOG_INFO("server.loading", "Initialize query data...");
2145 sObjectMgr->InitializeQueriesData(QUERY_DATA_ALL);
2146
2147 TC_LOG_INFO("server.loading", "Initialize commands...");
2149
2151 TC_LOG_INFO("server.loading", "Initialize game time and timers");
2153
2154 LoginDatabase.PExecute("INSERT INTO uptime (realmid, starttime, uptime, revision) VALUES({}, {}, 0, '{}')",
2156
2160 //Update "uptime" table based on configuration entry in minutes.
2162 //erase corpses every 20 minutes
2164 // clean logs table every 14 days by default
2166 m_timers[WUPDATE_DELETECHARS].SetInterval(DAY*IN_MILLISECONDS); // check for chars to delete every day
2167
2168 // for AhBot
2170
2172
2174
2176
2178
2179 //to set mailtimer to return mails every day between 4 and 5 am
2180 //mailtimer is increased when updating auctions
2181 //one second is 1000 -(tested on win system)
2183 tm localTm;
2184 time_t gameTime = GameTime::GetGameTime();
2185 localtime_r(&gameTime, &localTm);
2186 uint8 CleanOldMailsTime = getIntConfig(CONFIG_CLEAN_OLD_MAIL_TIME);
2187 mail_timer = ((((localTm.tm_hour + (24 - CleanOldMailsTime)) % 24)* HOUR * IN_MILLISECONDS) / m_timers[WUPDATE_AUCTIONS].GetInterval());
2188 //1440
2190 TC_LOG_INFO("server.loading", "Mail timer set to: {}, mail return is called every {} minutes", uint64(mail_timer), uint64(mail_timer_expires));
2191
2193 TC_LOG_INFO("server.loading", "Starting Map System");
2194 sMapMgr->Initialize();
2195
2196 TC_LOG_INFO("server.loading", "Starting Game Event system...");
2197 uint32 nextGameEvent = sGameEventMgr->StartSystem();
2198 m_timers[WUPDATE_EVENTS].SetInterval(nextGameEvent); //depend on next event
2199
2200 // Delete all characters which have been deleted X days before
2202
2203 TC_LOG_INFO("server.loading", "Initialize AuctionHouseBot...");
2204 sAuctionBot->Initialize();
2205
2206 TC_LOG_INFO("server.loading", "Initializing chat channels...");
2208
2209 TC_LOG_INFO("server.loading", "Initializing Opcodes...");
2211
2212 TC_LOG_INFO("server.loading", "Starting Arena Season...");
2213 sGameEventMgr->StartArenaSeason();
2214
2215 sTicketMgr->Initialize();
2216
2218 TC_LOG_INFO("server.loading", "Starting Battleground System");
2219 sBattlegroundMgr->LoadBattlegroundTemplates();
2220 sBattlegroundMgr->InitAutomaticArenaPointDistribution();
2221
2223 TC_LOG_INFO("server.loading", "Starting Outdoor PvP System");
2224 sOutdoorPvPMgr->InitOutdoorPvP();
2225
2227 TC_LOG_INFO("server.loading", "Starting Battlefield System");
2228 sBattlefieldMgr->InitBattlefield();
2229
2230 TC_LOG_INFO("server.loading", "Loading Transports...");
2231 sTransportMgr->SpawnContinentTransports();
2232
2234 TC_LOG_INFO("server.loading", "Loading Warden Checks...");
2235 sWardenCheckMgr->LoadWardenChecks();
2236
2237 TC_LOG_INFO("server.loading", "Loading Warden Action Overrides...");
2238 sWardenCheckMgr->LoadWardenOverrides();
2239
2240 TC_LOG_INFO("server.loading", "Deleting expired bans...");
2241 LoginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate <= UNIX_TIMESTAMP() AND unbandate<>bandate"); // One-time query
2242
2243 TC_LOG_INFO("server.loading", "Initializing quest reset times...");
2246
2247 TC_LOG_INFO("server.loading", "Calculate random battleground reset time...");
2249
2250 TC_LOG_INFO("server.loading", "Calculate deletion of old calendar events time...");
2252
2253 TC_LOG_INFO("server.loading", "Calculate guild limitation(s) reset time...");
2255
2256 // Preload all cells, if required for the base maps
2257 if (sWorld->getBoolConfig(CONFIG_BASEMAP_LOAD_GRIDS))
2258 {
2259 sMapMgr->DoForAllMaps([](Map* map)
2260 {
2261 if (!map->Instanceable())
2262 {
2263 TC_LOG_INFO("server.loading", "Pre-loading base map data for map {}", map->GetId());
2264 map->LoadAllCells();
2265 }
2266 });
2267 }
2268
2269 uint32 startupDuration = GetMSTimeDiffToNow(startupBegin);
2270
2271 TC_LOG_INFO("server.worldserver", "World initialized in {} minutes {} seconds", (startupDuration / 60000), ((startupDuration % 60000) / 1000));
2272
2273 TC_METRIC_EVENT("events", "World initialized", "World initialized in " + std::to_string(startupDuration / 60000) + " minutes " + std::to_string((startupDuration % 60000) / 1000) + " seconds");
2274}
2275
2277{
2278 uint8 m_lang_confid = sConfigMgr->GetIntDefault("DBC.Locale", 255);
2279
2280 if (m_lang_confid != 255 && m_lang_confid >= TOTAL_LOCALES)
2281 {
2282 TC_LOG_ERROR("server.loading", "Incorrect DBC.Locale! Must be >= 0 and < {} (set to 0)", TOTAL_LOCALES);
2283 m_lang_confid = LOCALE_enUS;
2284 }
2285
2286 ChrRacesEntry const* race = sChrRacesStore.AssertEntry(1);
2287
2288 std::string availableLocalsStr;
2289
2290 uint8 default_locale = TOTAL_LOCALES;
2291 for (uint8 i = LOCALE_enUS; i < TOTAL_LOCALES; ++i)
2292 {
2293 if (race->Name[i][0] != '\0') // check by race names
2294 {
2295 // Mark the first found locale as default locale
2296 if (default_locale == TOTAL_LOCALES)
2297 default_locale = i;
2298
2299 m_availableDbcLocaleMask |= (1 << i);
2300 availableLocalsStr += localeNames[i];
2301 availableLocalsStr += " ";
2302 }
2303 }
2304
2305 if (m_availableDbcLocaleMask == 0)
2306 {
2307 TC_LOG_ERROR("server.loading", "Unable to determine your DBC Locale! (corrupt DBC?)");
2308 exit(1);
2309 }
2310
2311 if (default_locale != m_lang_confid && m_lang_confid < TOTAL_LOCALES &&
2312 (m_availableDbcLocaleMask & (1 << m_lang_confid)))
2313 {
2314 default_locale = m_lang_confid;
2315 }
2316
2317 m_defaultDbcLocale = LocaleConstant(default_locale);
2318
2319 TC_LOG_INFO("server.loading", "Using {} DBC Locale as default. All available DBC locales: {}", localeNames[m_defaultDbcLocale], availableLocalsStr.empty() ? "<none>" : availableLocalsStr);
2320}
2321
2323{
2324 uint32 oldMSTime = getMSTime();
2325
2326 m_Autobroadcasts.clear();
2328
2329 uint32 realmId = sConfigMgr->GetIntDefault("RealmID", 0);
2331 stmt->setInt32(0, realmId);
2332 PreparedQueryResult result = LoginDatabase.Query(stmt);
2333
2334 if (!result)
2335 {
2336 TC_LOG_INFO("server.loading", ">> Loaded 0 autobroadcasts definitions. DB table `autobroadcast` is empty for this realm!");
2337 return;
2338 }
2339
2340 uint32 count = 0;
2341
2342 do
2343 {
2344 Field* fields = result->Fetch();
2345 uint8 id = fields[0].GetUInt8();
2346
2347 m_Autobroadcasts[id] = fields[2].GetString();
2348 m_AutobroadcastsWeights[id] = fields[1].GetUInt8();
2349
2350 ++count;
2351 } while (result->NextRow());
2352
2353 TC_LOG_INFO("server.loading", ">> Loaded {} autobroadcast definitions in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
2354}
2355
2358{
2359 TC_METRIC_TIMER("world_update_time_total");
2362 time_t currentGameTime = GameTime::GetGameTime();
2363
2365
2367 for (int i = 0; i < WUPDATE_COUNT; ++i)
2368 {
2369 if (m_timers[i].GetCurrent() >= 0)
2370 m_timers[i].Update(diff);
2371 else
2372 m_timers[i].SetCurrent(0);
2373 }
2374
2376 if (m_timers[WUPDATE_WHO_LIST].Passed())
2377 {
2378 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Update who list"));
2380 sWhoListStorageMgr->Update();
2381 }
2382
2383 if (IsStopped() || m_timers[WUPDATE_CHANNEL_SAVE].Passed())
2384 {
2386
2387 if (sWorld->getBoolConfig(CONFIG_PRESERVE_CUSTOM_CHANNELS))
2388 {
2389 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Save custom channels"));
2391 mgr1->SaveToDB();
2393 if (mgr1 != mgr2)
2394 mgr2->SaveToDB();
2395 }
2396 }
2397
2398 {
2399 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Check quest reset times"));
2401 }
2402
2403 if (currentGameTime > m_NextRandomBGReset)
2404 {
2405 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Reset random BG"));
2406 ResetRandomBG();
2407 }
2408
2409 if (currentGameTime > m_NextCalendarOldEventsDeletionTime)
2410 {
2411 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Delete old calendar events"));
2413 }
2414
2415 if (currentGameTime > m_NextGuildReset)
2416 {
2417 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Reset guild cap"));
2418 ResetGuildCap();
2419 }
2420
2422 if (m_timers[WUPDATE_AUCTIONS].Passed())
2423 {
2424 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Update expired auctions"));
2426
2428 //(tested... works on win)
2430 {
2431 mail_timer = 0;
2432 sObjectMgr->ReturnOrDeleteOldMails(true);
2433 }
2434
2436 sAuctionMgr->Update();
2437 }
2438
2439 if (m_timers[WUPDATE_AUCTIONS_PENDING].Passed())
2440 {
2441 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Update pending auctions"));
2443
2444 sAuctionMgr->UpdatePendingAuctions();
2445 }
2446
2448 if (m_timers[WUPDATE_AHBOT].Passed())
2449 {
2450 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Update AHBot"));
2451 sAuctionBot->Update();
2453 }
2454
2456 if (m_timers[WUPDATE_CHECK_FILECHANGES].Passed())
2457 {
2458 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Update HotSwap"));
2459 sScriptReloadMgr->Update();
2461 }
2462
2463 {
2465 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Update sessions"));
2466 UpdateSessions(diff);
2467 }
2468
2470 if (m_timers[WUPDATE_UPTIME].Passed())
2471 {
2472 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Update uptime"));
2473 uint32 tmpDiff = GameTime::GetUptime();
2474 uint32 maxOnlinePlayers = GetMaxPlayerCount();
2475
2477
2479
2480 stmt->setUInt32(0, tmpDiff);
2481 stmt->setUInt16(1, uint16(maxOnlinePlayers));
2482 stmt->setUInt32(2, realm.Id.Realm);
2484
2485 LoginDatabase.Execute(stmt);
2486 }
2487
2489 if (sWorld->getIntConfig(CONFIG_LOGDB_CLEARTIME) > 0) // if not enabled, ignore the timer
2490 {
2491 if (m_timers[WUPDATE_CLEANDB].Passed())
2492 {
2493 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Clean logs table"));
2495
2497
2498 stmt->setUInt32(0, sWorld->getIntConfig(CONFIG_LOGDB_CLEARTIME));
2499 stmt->setUInt32(1, uint32(time(0)));
2500 stmt->setUInt32(2, realm.Id.Realm);
2501
2502 LoginDatabase.Execute(stmt);
2503 }
2504 }
2505
2508 {
2509 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Update maps"));
2510 sMapMgr->Update(diff);
2511 }
2512
2513 if (sWorld->getBoolConfig(CONFIG_AUTOBROADCAST))
2514 {
2515 if (m_timers[WUPDATE_AUTOBROADCAST].Passed())
2516 {
2517 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Send autobroadcast"));
2520 }
2521 }
2522
2523 {
2524 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Update battlegrounds"));
2525 sBattlegroundMgr->Update(diff);
2526 }
2527
2528 {
2529 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Update outdoor pvp"));
2530 sOutdoorPvPMgr->Update(diff);
2531 }
2532
2533 {
2534 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Update battlefields"));
2535 sBattlefieldMgr->Update(diff);
2536 }
2537
2539 if (m_timers[WUPDATE_DELETECHARS].Passed())
2540 {
2541 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Delete old characters"));
2544 }
2545
2546 {
2547 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Update groups"));
2548 sGroupMgr->Update(diff);
2549 }
2550
2551 {
2552 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Update LFG"));
2553 sLFGMgr->Update(diff);
2554 }
2555
2556 {
2557 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Process query callbacks"));
2558 // execute callbacks from sql queries that were queued recently
2560 }
2561
2563 if (m_timers[WUPDATE_CORPSES].Passed())
2564 {
2565 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Remove old corpses"));
2567 sMapMgr->DoForAllMaps([](Map* map)
2568 {
2569 map->RemoveOldCorpses();
2570 });
2571 }
2572
2574 if (m_timers[WUPDATE_EVENTS].Passed())
2575 {
2576 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Update game events"));
2577 m_timers[WUPDATE_EVENTS].Reset(); // to give time for Update() to be processed
2578 uint32 nextGameEvent = sGameEventMgr->Update();
2579 m_timers[WUPDATE_EVENTS].SetInterval(nextGameEvent);
2581 }
2582
2584 if (m_timers[WUPDATE_PINGDB].Passed())
2585 {
2586 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Ping MySQL"));
2588 TC_LOG_DEBUG("sql.driver", "Ping MySQL to keep connection alive");
2589 CharacterDatabase.KeepAlive();
2590 LoginDatabase.KeepAlive();
2591 WorldDatabase.KeepAlive();
2592 }
2593
2594 {
2595 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Update instance reset times"));
2596 // update the instance reset times
2597 sInstanceSaveMgr->Update();
2598 }
2599
2600 // Check for shutdown warning
2601 if (_guidWarn && !_guidAlert)
2602 {
2603 _warnDiff += diff;
2608 }
2609
2610 {
2611 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Process cli commands"));
2612 // And last, but not least handle the issued cli commands
2614 }
2615
2616 {
2617 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Update world scripts"));
2618 sScriptMgr->OnWorldUpdate(diff);
2619 }
2620
2621 {
2622 TC_METRIC_TIMER("world_update_time", TC_METRIC_TAG("type", "Update metrics"));
2623 // Stats logger update
2624 sMetric->Update();
2625 TC_METRIC_VALUE("update_time_diff", diff);
2626 }
2627}
2628
2630{
2631 m_timers[WUPDATE_EVENTS].Reset(); // to give time for Update() to be processed
2632 uint32 nextGameEvent = sGameEventMgr->Update();
2633 m_timers[WUPDATE_EVENTS].SetInterval(nextGameEvent);
2635}
2636
2639{
2640 SessionMap::const_iterator itr;
2641 for (itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
2642 {
2643 if (itr->second &&
2644 itr->second->GetPlayer() &&
2645 itr->second->GetPlayer()->IsInWorld() &&
2646 itr->second != self &&
2647 (team == 0 || itr->second->GetPlayer()->GetTeam() == team))
2648 {
2649 itr->second->SendPacket(packet);
2650 }
2651 }
2652}
2653
2656{
2657 for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
2658 {
2659 // check if session and can receive global GM Messages and its not self
2660 WorldSession* session = itr->second;
2661 if (!session || session == self || !session->HasPermission(rbac::RBAC_PERM_RECEIVE_GLOBAL_GM_TEXTMESSAGE))
2662 continue;
2663
2664 // Player should be in world
2665 Player* player = session->GetPlayer();
2666 if (!player || !player->IsInWorld())
2667 continue;
2668
2669 // Send only to same team, if team is given
2670 if (!team || player->GetTeam() == team)
2671 session->SendPacket(packet);
2672 }
2673}
2674
2675namespace Trinity
2676{
2678 {
2679 public:
2680 typedef std::vector<WorldPacket*> WorldPacketList;
2681 static size_t const BufferSize = 2048;
2682
2683 explicit WorldWorldTextBuilder(uint32 textId, va_list* args = nullptr) : i_textId(textId), i_args(args) { }
2684
2686 {
2687 char const* text = sObjectMgr->GetTrinityString(i_textId, locale);
2688
2689 char strBuffer[BufferSize];
2690 if (i_args)
2691 {
2692 // we need copy va_list before use or original va_list will corrupted
2693 va_list ap;
2694 va_copy(ap, *i_args);
2695 vsnprintf(strBuffer, BufferSize, text, ap);
2696 va_end(ap);
2697 }
2698 else
2699 {
2700 std::strncpy(strBuffer, text, BufferSize);
2701 strBuffer[BufferSize - 1] = '\0';
2702 }
2703
2704 do_helper(dataList, strBuffer);
2705 }
2706
2707 private:
2708 void do_helper(WorldPacketList& dataList, char* text)
2709 {
2710 while (char* line = ChatHandler::LineFromMessage(text))
2711 {
2713 packet.Initialize(CHAT_MSG_SYSTEM, LANG_UNIVERSAL, nullptr, nullptr, line);
2714 packet.Write();
2715 dataList.push_back(new WorldPacket(packet.Move()));
2716 }
2717 }
2718
2720 va_list* i_args;
2721 };
2722} // namespace Trinity
2723
2725void World::SendWorldText(uint32 string_id, ...)
2726{
2727 va_list ap;
2728 va_start(ap, string_id);
2729
2730 Trinity::WorldWorldTextBuilder wt_builder(string_id, &ap);
2732 for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
2733 {
2734 if (!itr->second || !itr->second->GetPlayer() || !itr->second->GetPlayer()->IsInWorld())
2735 continue;
2736
2737 wt_do(itr->second->GetPlayer());
2738 }
2739
2740 va_end(ap);
2741}
2742
2744void World::SendGMText(uint32 string_id, ...)
2745{
2746 va_list ap;
2747 va_start(ap, string_id);
2748
2749 Trinity::WorldWorldTextBuilder wt_builder(string_id, &ap);
2751 for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
2752 {
2753 // Session should have permissions to receive global gm messages
2754 WorldSession* session = itr->second;
2756 continue;
2757
2758 // Player should be in world
2759 Player* player = session->GetPlayer();
2760 if (!player || !player->IsInWorld())
2761 continue;
2762
2763 wt_do(player);
2764 }
2765
2766 va_end(ap);
2767}
2768
2770void World::SendGlobalText(char const* text, WorldSession* self)
2771{
2772 // need copy to prevent corruption by strtok call in LineFromMessage original string
2773 char* buf = strdup(text);
2774 char* pos = buf;
2775
2776 while (char* line = ChatHandler::LineFromMessage(pos))
2777 {
2779 packet.Initialize(CHAT_MSG_SYSTEM, LANG_UNIVERSAL, nullptr, nullptr, line);
2780 SendGlobalMessage(packet.Write(), self);
2781 }
2782
2783 free(buf);
2784}
2785
2788{
2789 m_QueuedPlayer.clear(); // prevent send queue update packet and login queued sessions
2790
2791 // session not removed at kick and will removed in next update tick
2792 for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
2793 itr->second->KickPlayer("World::KickAll");
2794}
2795
2798{
2799 // session not removed at kick and will removed in next update tick
2800 for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
2801 if (itr->second->GetSecurity() < sec)
2802 itr->second->KickPlayer("World::KickAllLess");
2803}
2804
2806BanReturn World::BanAccount(BanMode mode, std::string const& nameOrIP, std::string const& duration, std::string const& reason, std::string const& author)
2807{
2808 uint32 duration_secs = TimeStringToSecs(duration);
2809 return BanAccount(mode, nameOrIP, duration_secs, reason, author);
2810}
2811
2813BanReturn World::BanAccount(BanMode mode, std::string const& nameOrIP, uint32 duration_secs, std::string const& reason, std::string const& author)
2814{
2815 PreparedQueryResult resultAccounts = PreparedQueryResult(nullptr); //used for kicking
2816
2817 // Prevent banning an already banned account
2818 if (mode == BAN_ACCOUNT && AccountMgr::IsBannedAccount(nameOrIP))
2819 return BAN_EXISTS;
2820
2822 switch (mode)
2823 {
2824 case BAN_IP:
2825 {
2826 // No SQL injection with prepared statements
2828 stmt->setString(0, nameOrIP);
2829 resultAccounts = LoginDatabase.Query(stmt);
2830 stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_IP_BANNED);
2831 stmt->setString(0, nameOrIP);
2832 stmt->setUInt32(1, duration_secs);
2833 stmt->setString(2, author);
2834 stmt->setString(3, reason);
2835 LoginDatabase.Execute(stmt);
2836 break;
2837 }
2838 case BAN_ACCOUNT:
2839 {
2840 // No SQL injection with prepared statements
2842 stmt->setString(0, nameOrIP);
2843 resultAccounts = LoginDatabase.Query(stmt);
2844 break;
2845 }
2846 case BAN_CHARACTER:
2847 {
2848 // No SQL injection with prepared statements
2850 stmt->setString(0, nameOrIP);
2851 resultAccounts = CharacterDatabase.Query(stmt);
2852 break;
2853 }
2854 default:
2855 return BAN_SYNTAX_ERROR;
2856 }
2857
2858 if (!resultAccounts)
2859 {
2860 if (mode == BAN_IP)
2861 return BAN_SUCCESS; // ip correctly banned but nobody affected (yet)
2862 else
2863 return BAN_NOTFOUND; // Nobody to ban
2864 }
2865
2867 LoginDatabaseTransaction trans = LoginDatabase.BeginTransaction();
2868 do
2869 {
2870 Field* fieldsAccount = resultAccounts->Fetch();
2871 uint32 account = fieldsAccount[0].GetUInt32();
2872
2873 if (mode != BAN_IP)
2874 {
2875 // make sure there is only one active ban
2877 stmt->setUInt32(0, account);
2878 trans->Append(stmt);
2879 // No SQL injection with prepared statements
2880 stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_ACCOUNT_BANNED);
2881 stmt->setUInt32(0, account);
2882 stmt->setUInt32(1, duration_secs);
2883 stmt->setString(2, author);
2884 stmt->setString(3, reason);
2885 trans->Append(stmt);
2886 }
2887
2888 if (WorldSession* sess = FindSession(account))
2889 if (std::string(sess->GetPlayerName()) != author)
2890 sess->KickPlayer("World::BanAccount Banning account");
2891 } while (resultAccounts->NextRow());
2892
2893 LoginDatabase.CommitTransaction(trans);
2894
2895 return BAN_SUCCESS;
2896}
2897
2899bool World::RemoveBanAccount(BanMode mode, std::string const& nameOrIP)
2900{
2901 LoginDatabasePreparedStatement* stmt = nullptr;
2902 if (mode == BAN_IP)
2903 {
2904 stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_IP_NOT_BANNED);
2905 stmt->setString(0, nameOrIP);
2906 LoginDatabase.Execute(stmt);
2907 }
2908 else
2909 {
2910 uint32 account = 0;
2911 if (mode == BAN_ACCOUNT)
2912 account = AccountMgr::GetId(nameOrIP);
2913 else if (mode == BAN_CHARACTER)
2914 account = sCharacterCache->GetCharacterAccountIdByName(nameOrIP);
2915
2916 if (!account)
2917 return false;
2918
2919 //NO SQL injection as account is uint32
2920 stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_ACCOUNT_NOT_BANNED);
2921 stmt->setUInt32(0, account);
2922 LoginDatabase.Execute(stmt);
2923 }
2924 return true;
2925}
2926
2928BanReturn World::BanCharacter(std::string const& name, std::string const& duration, std::string const& reason, std::string const& author)
2929{
2931 ObjectGuid::LowType guid = 0;
2932
2933 uint32 duration_secs = TimeStringToSecs(duration);
2934
2936 if (!banned)
2937 {
2938 ObjectGuid fullGuid = sCharacterCache->GetCharacterGuidByName(name);
2939 if (fullGuid.IsEmpty())
2940 return BAN_NOTFOUND; // Nobody to ban
2941
2942 guid = fullGuid.GetCounter();
2943 }
2944 else
2945 guid = banned->GetGUID().GetCounter();
2946 //Use transaction in order to ensure the order of the queries
2947 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
2948 // make sure there is only one active ban
2950 stmt->setUInt32(0, guid);
2951 trans->Append(stmt);
2952
2953 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_BAN);
2954 stmt->setUInt32(0, guid);
2955 stmt->setUInt32(1, duration_secs);
2956 stmt->setString(2, author);
2957 stmt->setString(3, reason);
2958 trans->Append(stmt);
2959 CharacterDatabase.CommitTransaction(trans);
2960
2961 if (banned)
2962 banned->GetSession()->KickPlayer("World::BanCharacter Banning character");
2963
2964 return BAN_SUCCESS;
2965}
2966
2968bool World::RemoveBanCharacter(std::string const& name)
2969{
2971 ObjectGuid::LowType guid = 0;
2972
2974 if (!banned)
2975 {
2976 ObjectGuid fullGuid = sCharacterCache->GetCharacterGuidByName(name);
2977 if (fullGuid.IsEmpty())
2978 return false;
2979
2980 guid = fullGuid.GetCounter();
2981 }
2982 else
2983 guid = banned->GetGUID().GetCounter();
2984
2985 if (!guid)
2986 return false;
2987
2989 stmt->setUInt32(0, guid);
2990 CharacterDatabase.Execute(stmt);
2991 return true;
2992}
2993
2996{
2998 time_t lastGameTime = GameTime::GetGameTime();
3000
3001 uint32 elapsed = uint32(GameTime::GetGameTime() - lastGameTime);
3002
3004 if (!IsStopped() && m_ShutdownTimer > 0 && elapsed > 0)
3005 {
3007 if (m_ShutdownTimer <= elapsed)
3008 {
3010 m_stopEvent = true; // exist code already set
3011 else
3012 m_ShutdownTimer = 1; // minimum timer value to wait idle state
3013 }
3015 else
3016 {
3017 m_ShutdownTimer -= elapsed;
3018
3019 ShutdownMsg();
3020 }
3021 }
3022}
3023
3025void World::ShutdownServ(uint32 time, uint32 options, uint8 exitcode, const std::string& reason)
3026{
3027 // ignore if server shutdown at next tick
3028 if (IsStopped())
3029 return;
3030
3031 m_ShutdownMask = options;
3032 m_ExitCode = exitcode;
3033
3035 if (time == 0)
3036 m_ShutdownTimer = 1;
3038 else
3039 {
3040 m_ShutdownTimer = time;
3041 ShutdownMsg(true, nullptr, reason);
3042 }
3043
3044 sScriptMgr->OnShutdownInitiate(ShutdownExitCode(exitcode), ShutdownMask(options));
3045}
3046
3048void World::ShutdownMsg(bool show, Player* player, const std::string& reason)
3049{
3050 // not show messages for idle shutdown mode
3052 return;
3053
3055 if (show ||
3056 (m_ShutdownTimer < 5* MINUTE && (m_ShutdownTimer % 15) == 0) || // < 5 min; every 15 sec
3057 (m_ShutdownTimer < 15 * MINUTE && (m_ShutdownTimer % MINUTE) == 0) || // < 15 min ; every 1 min
3058 (m_ShutdownTimer < 30 * MINUTE && (m_ShutdownTimer % (5 * MINUTE)) == 0) || // < 30 min ; every 5 min
3059 (m_ShutdownTimer < 12 * HOUR && (m_ShutdownTimer % HOUR) == 0) || // < 12 h ; every 1 h
3060 (m_ShutdownTimer > 12 * HOUR && (m_ShutdownTimer % (12 * HOUR)) == 0)) // > 12 h ; every 12 h
3061 {
3063 if (!reason.empty())
3064 str += " - " + reason;
3065
3067
3068 SendServerMessage(msgid, str, player);
3069 TC_LOG_DEBUG("misc", "Server is {} in {}", (m_ShutdownMask & SHUTDOWN_MASK_RESTART ? "restart" : "shuttingdown"), str);
3070 }
3071}
3072
3075{
3076 // nothing cancel or too late
3078 return 0;
3079
3081
3082 uint32 oldTimer = m_ShutdownTimer;
3083 m_ShutdownMask = 0;
3084 m_ShutdownTimer = 0;
3085 m_ExitCode = SHUTDOWN_EXIT_CODE; // to default value
3086 SendServerMessage(msgid);
3087
3088 TC_LOG_DEBUG("misc", "Server {} cancelled.", (m_ShutdownMask & SHUTDOWN_MASK_RESTART ? "restart" : "shutdown"));
3089
3090 sScriptMgr->OnShutdownCancel();
3091 return oldTimer;
3092}
3093
3095void World::SendServerMessage(ServerMessageType messageID, std::string stringParam /*= ""*/, Player* player /*= nullptr*/)
3096{
3097 WorldPackets::Chat::ChatServerMessage chatServerMessage;
3098 chatServerMessage.MessageID = int32(messageID);
3099 if (messageID <= SERVER_MSG_STRING)
3100 chatServerMessage.StringParam = stringParam;
3101
3102 if (player)
3103 player->SendDirectMessage(chatServerMessage.Write());
3104 else
3105 SendGlobalMessage(chatServerMessage.Write());
3106}
3107
3109{
3110 {
3111 TC_METRIC_DETAILED_NO_THRESHOLD_TIMER("world_update_time",
3112 TC_METRIC_TAG("type", "Add sessions"),
3113 TC_METRIC_TAG("parent_type", "Update sessions"));
3115 WorldSession* sess = nullptr;
3116 while (addSessQueue.next(sess))
3117 AddSession_(sess);
3118 }
3119
3121 for (SessionMap::iterator itr = m_sessions.begin(), next; itr != m_sessions.end(); itr = next)
3122 {
3123 next = itr;
3124 ++next;
3125
3127 WorldSession* pSession = itr->second;
3128 WorldSessionFilter updater(pSession);
3129
3130 [[maybe_unused]] uint32 currentSessionId = itr->first;
3131 TC_METRIC_DETAILED_TIMER("world_update_sessions_time", TC_METRIC_TAG("account_id", std::to_string(currentSessionId)));
3132
3133 if (!pSession->Update(diff, updater)) // As interval = 0
3134 {
3135 if (!RemoveQueuedPlayer(itr->second) && itr->second && getIntConfig(CONFIG_INTERVAL_DISCONNECT_TOLERANCE))
3136 m_disconnects[itr->second->GetAccountId()] = GameTime::GetGameTime();
3137 RemoveQueuedPlayer(pSession);
3138 m_sessions.erase(itr);
3139 delete pSession;
3140
3141 }
3142 }
3143}
3144
3145// This handles the issued and queued CLI commands
3147{
3148 CliCommandHolder::Print zprint = nullptr;
3149 void* callbackArg = nullptr;
3150 CliCommandHolder* command = nullptr;
3151 while (cliCmdQueue.next(command))
3152 {
3153 TC_LOG_INFO("misc", "CLI command under processing...");
3154 zprint = command->m_print;
3155 callbackArg = command->m_callbackArg;
3156 CliHandler handler(callbackArg, zprint);
3157 handler.ParseCommands(command->m_command);
3158 if (command->m_commandFinished)
3159 command->m_commandFinished(callbackArg, !handler.HasSentErrorMessage());
3160 delete command;
3161 }
3162}
3163
3165{
3166 if (m_Autobroadcasts.empty())
3167 return;
3168
3169 uint32 weight = 0;
3170 AutobroadcastsWeightMap selectionWeights;
3171 std::string msg;
3172
3173 for (AutobroadcastsWeightMap::const_iterator it = m_AutobroadcastsWeights.begin(); it != m_AutobroadcastsWeights.end(); ++it)
3174 {
3175 if (it->second)
3176 {
3177 weight += it->second;
3178 selectionWeights[it->first] = it->second;
3179 }
3180 }
3181
3182 if (weight)
3183 {
3184 uint32 selectedWeight = urand(0, weight - 1);
3185 weight = 0;
3186 for (AutobroadcastsWeightMap::const_iterator it = selectionWeights.begin(); it != selectionWeights.end(); ++it)
3187 {
3188 weight += it->second;
3189 if (selectedWeight < weight)
3190 {
3191 msg = m_Autobroadcasts[it->first];
3192 break;
3193 }
3194 }
3195 }
3196 else
3197 msg = m_Autobroadcasts[urand(0, m_Autobroadcasts.size())];
3198
3199 uint32 abcenter = sWorld->getIntConfig(CONFIG_AUTOBROADCAST_CENTER);
3200
3201 if (abcenter == 0)
3202 sWorld->SendWorldText(LANG_AUTO_BROADCAST, msg.c_str());
3203 else if (abcenter == 1)
3204 {
3205 WorldPacket data(SMSG_NOTIFICATION, (msg.size()+1));
3206 data << msg;
3207 sWorld->SendGlobalMessage(&data);
3208 }
3209 else if (abcenter == 2)
3210 {
3211 sWorld->SendWorldText(LANG_AUTO_BROADCAST, msg.c_str());
3212
3213 WorldPacket data(SMSG_NOTIFICATION, (msg.size()+1));
3214 data << msg;
3215 sWorld->SendGlobalMessage(&data);
3216 }
3217
3218 TC_LOG_DEBUG("misc", "AutoBroadcast: '{}'", msg);
3219}
3220
3222{
3224 stmt->setUInt32(0, accountId);
3225 _queryProcessor.AddCallback(CharacterDatabase.AsyncQuery(stmt).WithPreparedCallback(std::bind(&World::_UpdateRealmCharCount, this, std::placeholders::_1)));
3226}
3227
3229{
3230 if (resultCharCount)
3231 {
3232 Field* fields = resultCharCount->Fetch();
3233 uint32 accountId = fields[0].GetUInt32();
3234 uint8 charCount = uint8(fields[1].GetUInt64());
3235
3236 LoginDatabaseTransaction trans = LoginDatabase.BeginTransaction();
3237
3239 stmt->setUInt8(0, charCount);
3240 stmt->setUInt32(1, accountId);
3241 stmt->setUInt32(2, realm.Id.Realm);
3242 trans->Append(stmt);
3243
3244 LoginDatabase.CommitTransaction(trans);
3245 }
3246}
3247
3254
3255static time_t GetNextDailyResetTime(time_t t)
3256{
3257 return GetLocalHourTimestamp(t, sWorld->getIntConfig(CONFIG_DAILY_QUEST_RESET_TIME_HOUR), true);
3258}
3259
3261{
3262 // reset all saved quest status
3264 CharacterDatabase.Execute(stmt);
3265 // reset all quest status in memory
3266 for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
3267 if (Player* player = itr->second->GetPlayer())
3268 player->ResetDailyQuestStatus();
3269
3270 // reselect pools
3271 sQuestPoolMgr->ChangeDailyQuests();
3272
3273 // store next reset time
3274 time_t now = GameTime::GetGameTime();
3275 time_t next = GetNextDailyResetTime(now);
3276 ASSERT(now < next);
3277
3278 m_NextDailyQuestReset = next;
3279 sWorld->setWorldState(WS_DAILY_QUEST_RESET_TIME, uint64(next));
3280
3281 TC_LOG_INFO("misc", "Daily quests for all characters have been reset.");
3282}
3283
3284static time_t GetNextWeeklyResetTime(time_t t)
3285{
3286 t = GetNextDailyResetTime(t);
3287 tm time = TimeBreakdown(t);
3288 int wday = time.tm_wday;
3289 int target = sWorld->getIntConfig(CONFIG_WEEKLY_QUEST_RESET_TIME_WDAY);
3290 if (target < wday)
3291 wday -= 7;
3292 t += (DAY * (target - wday));
3293 return t;
3294}
3295
3297{
3298 // reset all saved quest status
3300 CharacterDatabase.Execute(stmt);
3301 // reset all quest status in memory
3302 for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
3303 if (Player* player = itr->second->GetPlayer())
3304 player->ResetWeeklyQuestStatus();
3305
3306 // reselect pools
3307 sQuestPoolMgr->ChangeWeeklyQuests();
3308
3309 // store next reset time
3310 time_t now = GameTime::GetGameTime();
3311 time_t next = GetNextWeeklyResetTime(now);
3312 ASSERT(now < next);
3313
3315 sWorld->setWorldState(WS_WEEKLY_QUEST_RESET_TIME, uint64(next));
3316
3317 TC_LOG_INFO("misc", "Weekly quests for all characters have been reset.");
3318}
3319
3320static time_t GetNextMonthlyResetTime(time_t t)
3321{
3322 t = GetNextDailyResetTime(t);
3323 tm time = TimeBreakdown(t);
3324 if (time.tm_mday == 1)
3325 return t;
3326
3327 time.tm_mday = 1;
3328 time.tm_mon += 1;
3329 return mktime(&time);
3330}
3331
3333{
3334 // reset all saved quest status
3336 CharacterDatabase.Execute(stmt);
3337 // reset all quest status in memory
3338 for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
3339 if (Player* player = itr->second->GetPlayer())
3340 player->ResetMonthlyQuestStatus();
3341
3342 // reselect pools
3343 sQuestPoolMgr->ChangeMonthlyQuests();
3344
3345 // store next reset time
3346 time_t now = GameTime::GetGameTime();
3347 time_t next = GetNextMonthlyResetTime(now);
3348 ASSERT(now < next);
3349
3351 sWorld->setWorldState(WS_MONTHLY_QUEST_RESET_TIME, uint64(next));
3352
3353 TC_LOG_INFO("misc", "Monthly quests for all characters have been reset.");
3354}
3355
3357{
3358 time_t const now = GameTime::GetGameTime();
3359 if (m_NextDailyQuestReset <= now)
3361 if (m_NextWeeklyQuestReset <= now)
3363 if (m_NextMonthlyQuestReset <= now)
3365}
3366
3368{
3369 time_t bgtime = uint64(sWorld->getWorldState(WS_BG_DAILY_RESET_TIME));
3370 if (!bgtime)
3371 m_NextRandomBGReset = GameTime::GetGameTime(); // game time not yet init
3372
3373 // generate time by config
3374 time_t curTime = GameTime::GetGameTime();
3375 tm localTm;
3376 localtime_r(&curTime, &localTm);
3377 localTm.tm_hour = getIntConfig(CONFIG_RANDOM_BG_RESET_HOUR);
3378 localTm.tm_min = 0;
3379 localTm.tm_sec = 0;
3380
3381 // current day reset time
3382 time_t nextDayResetTime = mktime(&localTm);
3383
3384 // next reset time before current moment
3385 if (curTime >= nextDayResetTime)
3386 nextDayResetTime += DAY;
3387
3388 // normalize reset time
3389 m_NextRandomBGReset = bgtime < curTime ? nextDayResetTime - DAY : nextDayResetTime;
3390
3391 if (!bgtime)
3393}
3394
3396{
3397 time_t now = GameTime::GetGameTime();
3399 time_t currentDeletionTime = getWorldState(WS_DAILY_CALENDAR_DELETION_OLD_EVENTS_TIME);
3400
3401 // If the reset time saved in the worldstate is before now it means the server was offline when the reset was supposed to occur.
3402 // 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.
3403 if (currentDeletionTime < now)
3404 m_NextCalendarOldEventsDeletionTime = nextDeletionTime - DAY;
3405 else
3406 m_NextCalendarOldEventsDeletionTime = nextDeletionTime;
3407
3408 if (!currentDeletionTime)
3410}
3411
3413{
3415 if (!gtime)
3416 m_NextGuildReset = GameTime::GetGameTime(); // game time not yet init
3417
3418 // generate time by config
3419 time_t curTime = GameTime::GetGameTime();
3420 tm localTm;
3421 localtime_r(&curTime, &localTm);
3422 localTm.tm_hour = getIntConfig(CONFIG_GUILD_RESET_HOUR);
3423 localTm.tm_min = 0;
3424 localTm.tm_sec = 0;
3425
3426 // current day reset time
3427 time_t nextDayResetTime = mktime(&localTm);
3428
3429 // next reset time before current moment
3430 if (curTime >= nextDayResetTime)
3431 nextDayResetTime += DAY;
3432
3433 // normalize reset time
3434 m_NextGuildReset = gtime < curTime ? nextDayResetTime - DAY : nextDayResetTime;
3435
3436 if (!gtime)
3438}
3439
3440void World::ResetEventSeasonalQuests(uint16 event_id, time_t eventStartTime)
3441{
3442 TC_LOG_INFO("misc", "Seasonal quests reset for all characters.");
3443
3445 stmt->setUInt16(0, event_id);
3446 stmt->setInt64(1, eventStartTime);
3447 CharacterDatabase.Execute(stmt);
3448
3449 for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
3450 if (itr->second->GetPlayer())
3451 itr->second->GetPlayer()->ResetSeasonalQuestStatus(event_id, eventStartTime);
3452}
3453
3455{
3456 TC_LOG_INFO("misc", "Random BG status reset for all characters.");
3457
3459 CharacterDatabase.Execute(stmt);
3460
3461 for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
3462 if (itr->second->GetPlayer())
3463 itr->second->GetPlayer()->SetRandomWinner(false);
3464
3467}
3468
3470{
3471 TC_LOG_INFO("misc", "Calendar deletion of old events.");
3472
3475 sCalendarMgr->DeleteOldEvents();
3476}
3477
3479{
3480 TC_LOG_INFO("misc", "Guild Daily Cap reset.");
3481
3484 sGuildMgr->ResetTimes();
3485}
3486
3492
3494{
3495 QueryResult result = WorldDatabase.Query("SELECT db_version, cache_id FROM version LIMIT 1");
3496 if (result)
3497 {
3498 Field* fields = result->Fetch();
3499
3500 m_DBVersion = fields[0].GetString();
3501 // will be overwrite by config values if different and non-0
3503 }
3504
3505 if (m_DBVersion.empty())
3506 m_DBVersion = "Unknown world database.";
3507}
3508
3510{
3511 SessionMap::const_iterator itr;
3512 for (itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
3513 if (itr->second && itr->second->GetPlayer() && itr->second->GetPlayer()->IsInWorld())
3514 {
3515 itr->second->GetPlayer()->UpdateAreaDependentAuras(itr->second->GetPlayer()->GetAreaId());
3516 itr->second->GetPlayer()->UpdateZoneDependentAuras(itr->second->GetPlayer()->GetZoneId());
3517 }
3518}
3519
3521{
3522 uint32 oldMSTime = getMSTime();
3523
3524 QueryResult result = CharacterDatabase.Query("SELECT entry, value FROM worldstates");
3525
3526 if (!result)
3527 {
3528 TC_LOG_INFO("server.loading", ">> Loaded 0 world states. DB table `worldstates` is empty!");
3529
3530 return;
3531 }
3532
3533 uint32 count = 0;
3534
3535 do
3536 {
3537 Field* fields = result->Fetch();
3538 m_worldstates[fields[0].GetUInt32()] = fields[1].GetUInt32();
3539 ++count;
3540 }
3541 while (result->NextRow());
3542
3543 TC_LOG_INFO("server.loading", ">> Loaded {} world states in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
3544
3545}
3546
3551
3556
3557// Setting a worldstate will save it to DB
3559{
3560 WorldStatesMap::const_iterator it = m_worldstates.find(index);
3561 if (it != m_worldstates.end())
3562 {
3563 if (it->second == value)
3564 return;
3565
3567
3568 stmt->setUInt32(0, uint32(value));
3569 stmt->setUInt32(1, index);
3570
3571 CharacterDatabase.Execute(stmt);
3572 }
3573 else
3574 {
3576
3577 stmt->setUInt32(0, index);
3578 stmt->setUInt32(1, uint32(value));
3579
3580 CharacterDatabase.Execute(stmt);
3581 }
3582 m_worldstates[index] = value;
3583}
3584
3586{
3587 WorldStatesMap::const_iterator it = m_worldstates.find(index);
3588 return it != m_worldstates.end() ? it->second : 0;
3589}
3590
3595
3597{
3598 // Passive reload, we mark the data as invalidated and next time a permission is checked it will be reloaded
3599 TC_LOG_INFO("rbac", "World::ReloadRBAC()");
3600 for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
3601 if (WorldSession* session = itr->second)
3602 session->InvalidateRBACData();
3603}
3604
3609
3611
3612CliCommandHolder::CliCommandHolder(void* callbackArg, char const* command, Print zprint, CommandFinished commandFinished)
3613 : m_callbackArg(callbackArg), m_command(strdup(command)), m_print(zprint), m_commandFinished(commandFinished)
3614{
3615}
3616
#define sAccountMgr
Definition AccountMgr.h:97
#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:870
#define MAX_CHARTER_NAME
Definition ObjectMgr.h:873
@ QUERY_DATA_ALL
Definition ObjectMgr.h:918
#define sObjectMgr
Definition ObjectMgr.h:1721
#define MAX_PET_NAME
Definition ObjectMgr.h:872
#define sOutdoorPvPMgr
#define sPetitionMgr
Definition PetitionMgr.h:86
uint32 const MAX_MONEY_AMOUNT
Definition Player.cpp:125
#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:250
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:88
float playerBaseMoveSpeed[MAX_MOVE_TYPE]
Definition Unit.cpp:101
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:3255
static time_t GetNextWeeklyResetTime(time_t t)
Definition World.cpp:3284
static time_t GetNextMonthlyResetTime(time_t t)
Definition World.cpp:3320
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:125
static char * LineFromMessage(char *&pos)
Definition Chat.h:52
bool ParseCommands(std::string_view str) override
Definition Chat.cpp:610
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:302
void RemoveOldCorpses()
Definition Map.cpp:4684
bool Instanceable() const
Definition Map.cpp:4221
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:1818
static void DeleteOldCharacters()
Definition Player.cpp:4280
void SendDirectMessage(WorldPacket const *data) const
Definition Player.cpp:6163
WorldSession * GetSession() const
Definition Player.h:1705
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:2680
void do_helper(WorldPacketList &dataList, char *text)
Definition World.cpp:2708
static size_t const BufferSize
Definition World.cpp:2681
WorldWorldTextBuilder(uint32 textId, va_list *args=nullptr)
Definition World.cpp:2683
void operator()(WorldPacketList &dataList, LocaleConstant locale)
Definition World.cpp:2685
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:375
WorldPacket const * Write() override
void Initialize(ChatMsg chatType, Language language, WorldObject const *sender, WorldObject const *receiver, std::string_view message, uint32 achievementId=0, std::string_view channelName="", LocaleConstant locale=DEFAULT_LOCALE, std::string_view addonPrefix="")
WorldPacket const * Write() override
WorldPacket && Move()
Definition Packet.h:53
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:570
time_t m_NextWeeklyQuestReset
Definition World.h:856
uint32 ShutdownCancel()
Cancel a planned server shutdown.
Definition World.cpp:3074
bool RemoveBanCharacter(std::string const &name)
Remove a ban from a character.
Definition World.cpp:2968
void UpdateSessions(uint32 diff)
Definition World.cpp:3108
uint32 getIntConfig(WorldIntConfigs index) const
Get a server configuration element (see #WorldConfigs)
Definition World.h:719
LocaleConstant m_defaultDbcLocale
Definition World.h:833
static int32 m_visibility_notify_periodInBG
Definition World.h:848
static uint8 m_ExitCode
Definition World.h:803
SessionMap m_sessions
Definition World.h:815
uint32 m_int_configs[INT_CONFIG_VALUE_COUNT]
Definition World.h:826
bool RemoveBanAccount(BanMode mode, std::string const &nameOrIP)
Remove a ban from an account or IP address.
Definition World.cpp:2899
static int32 m_visibility_notify_periodInInstances
Definition World.h:847
static std::atomic< uint32 > m_worldLoopCounter
Definition World.h:574
void AddSession_(WorldSession *s)
Definition World.cpp:334
float m_float_configs[FLOAT_CONFIG_VALUE_COUNT]
Definition World.h:828
AccountTypes m_allowedSecurityLevel
Definition World.h:832
void LoadConfigSettings(bool reload=false)
Initialize config values.
Definition World.cpp:493
void _UpdateGameTime()
Update the game time.
Definition World.cpp:2995
static std::atomic< bool > m_stopEvent
Definition World.h:802
std::string m_dataPath
Definition World.h:838
float rate_values[MAX_RATES]
Definition World.h:825
void KickAllLess(AccountTypes sec)
Kick (and save) all players with security level less sec
Definition World.cpp:2797
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:3547
void SetNewCharString(std::string const &str)
Set the string for new characters (first login)
Definition World.h:636
LockedQueue< WorldSession * > addSessQueue
Definition World.h:867
static float m_MaxVisibleDistanceInArenas
Definition World.h:844
static float m_MaxVisibleDistanceInBG
Definition World.h:843
QueryCallbackProcessor _queryProcessor
Definition World.h:883
bool m_bool_configs[BOOL_CONFIG_VALUE_COUNT]
Definition World.h:827
Queue m_QueuedPlayer
Definition World.h:863
void UpdateRealmCharCount(uint32 accid)
Definition World.cpp:3221
void CheckQuestResetTimes()
Definition World.cpp:3356
void LoadDBAllowedSecurityLevel()
Definition World.cpp:209
std::mutex _guidAlertLock
Definition World.h:888
void LoadDBVersion()
Definition World.cpp:3493
bool HasRecentlyDisconnected(WorldSession *)
Definition World.cpp:400
void AddQueuedPlayer(WorldSession *)
Definition World.cpp:433
uint32 GetQueuedSessionCount() const
Definition World.h:585
void UpdateMaxSessionCounters()
Get the number of current active sessions.
Definition World.cpp:3487
uint32 m_CleaningFlags
Definition World.h:807
uint32 m_maxActiveSessionCount
Definition World.h:818
void SetInitialWorldSettings()
Initialize the World.
Definition World.cpp:1599
void ResetMonthlyQuests()
Definition World.cpp:3332
time_t m_NextDailyQuestReset
Definition World.h:855
void InitCalendarOldEventsDeletionTime()
Definition World.cpp:3395
uint32 m_PlayerCount
Definition World.h:820
void DoGuidAlertRestart()
Definition World.cpp:286
time_t _warnShutdownTime
Definition World.h:893
void TriggerGuidAlert()
Definition World.cpp:267
bool IsFFAPvPRealm() const
Definition World.cpp:3552
void ResetGuildCap()
Definition World.cpp:3478
bool RemoveSession(uint32 id)
Remove a given session.
Definition World.cpp:313
time_t m_NextRandomBGReset
Definition World.h:858
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:2655
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:2928
void DetectDBCLang()
Definition World.cpp:2276
void TriggerGuidWarning()
Definition World.cpp:248
float getRate(Rates rate) const
Get a server rate (see Rates)
Definition World.h:683
void SendGMText(uint32 string_id,...)
Send a System Message to all GMs (except self if mentioned)
Definition World.cpp:2744
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:3048
void InitGuildResetTime()
Definition World.cpp:3412
std::string m_DBVersion
Definition World.h:870
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:2806
AutobroadcastsMap m_Autobroadcasts
Definition World.h:873
time_t mail_timer_expires
Definition World.h:813
void InitRandomBGResetTime()
Definition World.cpp:3367
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:3558
void ResetWeeklyQuests()
Definition World.cpp:3296
void _UpdateRealmCharCount(PreparedQueryResult resultCharCount)
Definition World.cpp:3228
uint32 GetActiveSessionCount() const
Definition World.h:584
DisconnectMap m_disconnects
Definition World.h:817
time_t m_NextCalendarOldEventsDeletionTime
Definition World.h:859
void ReloadRBAC()
Definition World.cpp:3596
uint32 m_availableDbcLocaleMask
Definition World.h:834
void LoadWorldStates()
Definition World.cpp:3520
time_t mail_timer
Definition World.h:812
std::string _guidWarningMsg
Definition World.h:885
void ResetRandomBG()
Definition World.cpp:3454
uint32 m_ShutdownMask
Definition World.h:805
void ResetEventSeasonalQuests(uint16 event_id, time_t eventStartTime)
Definition World.cpp:3440
time_t m_NextGuildReset
Definition World.h:860
void SetPlayerSecurityLimit(AccountTypes sec)
Definition World.cpp:219
bool IsClosed() const
Deny clients?
Definition World.cpp:196
uint32 m_ShutdownTimer
Definition World.h:804
static int32 m_visibility_notify_periodInArenas
Definition World.h:849
void KickAll()
Kick (and save) all players.
Definition World.cpp:2787
uint32 GetPlayerAmountLimit() const
Definition World.h:615
void SendGuidWarning()
Definition World.cpp:294
void AddSession(WorldSession *s)
Definition World.cpp:329
std::string _alertRestartReason
Definition World.h:886
void ForceGameEventUpdate()
Definition World.cpp:2629
void ResetDailyQuests()
Definition World.cpp:3260
void CalendarDeleteOldEvents()
Definition World.cpp:3469
void SendGlobalMessage(WorldPacket const *packet, WorldSession *self=nullptr, uint32 team=0)
Send a packet to all players (except self if mentioned)
Definition World.cpp:2638
void ProcessQueryCallbacks()
Definition World.cpp:3591
uint64 getWorldState(uint32 index) const
Definition World.cpp:3585
void RemoveOldCorpses()
Definition World.cpp:3605
static World * instance()
Definition World.cpp:170
uint32 m_MaxPlayerCount
Definition World.h:821
WorldStatesMap m_worldstates
Definition World.h:830
LocaleConstant GetDefaultDbcLocale() const
Definition World.h:640
static float m_MaxVisibleDistanceOnContinents
Definition World.h:841
uint32 GetActiveAndQueuedSessionCount() const
Definition World.h:583
static float m_MaxVisibleDistanceInInstances
Definition World.h:842
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:3509
void InitQuestResetTimes()
Definition World.cpp:3248
bool _guidWarn
Definition World.h:890
bool m_isClosed
Definition World.h:809
uint32 GetMaxPlayerCount() const
Definition World.h:591
void SendServerMessage(ServerMessageType messageID, std::string stringParam="", Player *player=nullptr)
Send a server message to the user(s)
Definition World.cpp:3095
IntervalTimer m_timers[WUPDATE_COUNT]
Definition World.h:811
bool _guidAlert
Definition World.h:891
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:2770
static bool IsStopped()
Definition World.h:675
time_t m_NextMonthlyQuestReset
Definition World.h:857
std::vector< std::string > _motd
Definition World.h:837
uint32 m_maxQueuedSessionCount
Definition World.h:819
static int32 m_visibility_notify_periodOnContinents
Definition World.h:846
void SendAutoBroadcast()
Definition World.cpp:3164
void Update(uint32 diff)
Update the World !
Definition World.cpp:2357
uint32 m_playerLimit
Definition World.h:831
void LoadAutobroadcasts()
Definition World.cpp:2322
std::map< uint8, uint8 > AutobroadcastsWeightMap
Definition World.h:875
void SetPlayerAmountLimit(uint32 limit)
Active session server limit.
Definition World.h:614
bool m_allowMovement
Definition World.h:836
AutobroadcastsWeightMap m_AutobroadcastsWeights
Definition World.h:876
void SendWorldText(uint32 string_id,...)
Send a System Message to all players (except self if mentioned)
Definition World.cpp:2725
void DoGuidWarningRestart()
Definition World.cpp:277
void ProcessCliCommands()
Definition World.cpp:3146
void SetClosed(bool val)
Close world.
Definition World.cpp:201
uint32 _warnDiff
Definition World.h:892
LockedQueue< CliCommandHolder * > cliCmdQueue
Definition World.h:852
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:3025
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:901
ServerMessageType
Definition World.h:46
void LoadWeatherData()
TC_GAME_API Realm realm
Definition World.cpp:3610
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:507
@ REALM_ZONE_DEVELOPMENT
Definition World.h:496
@ CONFIG_AUTOBROADCAST_CENTER
Definition World.h:349
@ CONFIG_ARENA_START_MATCHMAKER_RATING
Definition World.h:326
@ CONFIG_RESPAWN_RESTARTQUIETTIME
Definition World.h:399
@ CONFIG_ARENA_SEASON_ID
Definition World.h:323
@ CONFIG_CORPSE_DECAY_ELITE
Definition World.h:308
@ CONFIG_MAX_INSTANCES_PER_HOUR
Definition World.h:357
@ CONFIG_GUILD_EVENT_LOG_COUNT
Definition World.h:339
@ CONFIG_ARENA_START_RATING
Definition World.h:324
@ CONFIG_SOCKET_TIMEOUTTIME
Definition World.h:219
@ CONFIG_MAX_OVERSPEED_PINGS
Definition World.h:282
@ CONFIG_WARDEN_NUM_LUA_CHECKS
Definition World.h:364
@ CONFIG_NO_GRAY_AGGRO_BELOW
Definition World.h:391
@ CONFIG_CHARDELETE_METHOD
Definition World.h:346
@ CONFIG_SESSION_ADD_DELAY
Definition World.h:220
@ CONFIG_MIN_CREATURE_SCALED_XP_RATIO
Definition World.h:256
@ CONFIG_CHARACTER_CREATING_DISABLED_CLASSMASK
Definition World.h:231
@ CONFIG_WARDEN_CLIENT_BAN_DURATION
Definition World.h:362
@ CONFIG_CLIENTCACHE_VERSION
Definition World.h:338
@ CONFIG_DAILY_QUEST_RESET_TIME_HOUR
Definition World.h:251
@ CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF
Definition World.h:292
@ CONFIG_CREATURE_PICKPOCKET_REFILL
Definition World.h:383
@ CONFIG_SKILL_CHANCE_ORANGE
Definition World.h:272
@ CONFIG_GM_CHAT
Definition World.h:261
@ CONFIG_AUCTION_GETALL_DELAY
Definition World.h:392
@ CONFIG_RESPAWN_DYNAMICMODE
Definition World.h:396
@ CONFIG_CHATFLOOD_MUTE_TIME
Definition World.h:288
@ CONFIG_STRICT_PET_NAMES
Definition World.h:225
@ CONFIG_CHARACTER_CREATING_DISABLED
Definition World.h:229
@ CONFIG_MIN_PET_NAME
Definition World.h:228
@ CONFIG_LOGDB_CLEARTIME
Definition World.h:337
@ CONFIG_QUEST_HIGH_LEVEL_HIDE_DIFF
Definition World.h:293
@ CONFIG_CHARACTER_CREATING_DISABLED_RACEMASK
Definition World.h:230
@ CONFIG_INTERVAL_CHANGEWEATHER
Definition World.h:216
@ CONFIG_PRESERVE_CUSTOM_CHANNEL_INTERVAL
Definition World.h:354
@ CONFIG_PRESERVE_CUSTOM_CHANNEL_DURATION
Definition World.h:353
@ CONFIG_GM_WHISPERING_TO
Definition World.h:262
@ CONFIG_SKILL_CHANCE_SKINNING_STEPS
Definition World.h:277
@ CONFIG_SKILL_CHANCE_YELLOW
Definition World.h:273
@ CONFIG_RESPAWN_GUIDWARNING_FREQUENCY
Definition World.h:402
@ CONFIG_AUTOBROADCAST_INTERVAL
Definition World.h:350
@ CONFIG_MAX_HONOR_POINTS
Definition World.h:243
@ CONFIG_DEATH_KNIGHTS_PER_REALM
Definition World.h:234
@ CONFIG_PVP_TOKEN_MAP_TYPE
Definition World.h:330
@ CONFIG_ENABLE_SINFO_LOGIN
Definition World.h:333
@ CONFIG_CHARTER_COST_GUILD
Definition World.h:386
@ CONFIG_CHARDELETE_MIN_LEVEL
Definition World.h:347
@ CONFIG_FORCE_SHUTDOWN_THRESHOLD
Definition World.h:267
@ CONFIG_MAX_ARENA_POINTS
Definition World.h:245
@ CONFIG_ARENA_MAX_RATING_DIFFERENCE
Definition World.h:318
@ CONFIG_BG_REWARD_LOSER_HONOR_LAST
Definition World.h:381
@ CONFIG_WHO_LIST_UPDATE_INTERVAL
Definition World.h:328
@ CONFIG_GAME_TYPE
Definition World.h:221
@ CONFIG_ARENA_RATED_UPDATE_TIMER
Definition World.h:321
@ CONFIG_START_GM_LEVEL
Definition World.h:266
@ CONFIG_MAIL_LEVEL_REQ
Definition World.h:305
@ CONFIG_SKILL_GAIN_DEFENSE
Definition World.h:279
@ CONFIG_MIN_PETITION_SIGNS
Definition World.h:254
@ CONFIG_BIRTHDAY_TIME
Definition World.h:382
@ CONFIG_WARDEN_CLIENT_CHECK_HOLDOFF
Definition World.h:360
@ CONFIG_RESPAWN_DYNAMICMINIMUM_CREATURE
Definition World.h:400
@ CONFIG_PARTY_LEVEL_REQ
Definition World.h:301
@ CONFIG_MIN_LEVEL_STAT_SAVE
Definition World.h:341
@ CONFIG_BATTLEGROUND_INVITATION_TYPE
Definition World.h:314
@ CONFIG_START_DEATH_KNIGHT_PLAYER_LEVEL
Definition World.h:240
@ CONFIG_MAX_PLAYER_LEVEL
Definition World.h:237
@ CONFIG_START_ARENA_POINTS
Definition World.h:246
@ CONFIG_MIN_CHARTER_NAME
Definition World.h:227
@ CONFIG_CHAT_CHANNEL_LEVEL_REQ
Definition World.h:296
@ CONFIG_BG_REWARD_WINNER_ARENA_FIRST
Definition World.h:377
@ CONFIG_CHARACTERS_PER_ACCOUNT
Definition World.h:232
@ CONFIG_DEATH_SICKNESS_LEVEL
Definition World.h:311
@ CONFIG_CHARTER_COST_ARENA_5v5
Definition World.h:389
@ CONFIG_INSTANCE_RESET_TIME_HOUR
Definition World.h:249
@ CONFIG_WINTERGRASP_PLR_MIN_LVL
Definition World.h:368
@ CONFIG_PVP_TOKEN_ID
Definition World.h:331
@ CONFIG_GUILD_RESET_HOUR
Definition World.h:344
@ CONFIG_SKILL_GAIN_WEAPON
Definition World.h:281
@ CONFIG_MAIL_DELIVERY_DELAY
Definition World.h:269
@ CONFIG_WINTERGRASP_BATTLETIME
Definition World.h:369
@ CONFIG_PENDING_MOVE_CHANGES_TIMEOUT
Definition World.h:404
@ CONFIG_GM_FREEZE_DURATION
Definition World.h:263
@ CONFIG_WINTERGRASP_NOBATTLETIME
Definition World.h:370
@ CONFIG_PVP_TOKEN_COUNT
Definition World.h:332
@ CONFIG_PACKET_SPOOF_BANDURATION
Definition World.h:374
@ CONFIG_WARDEN_NUM_CLIENT_MOD_CHECKS
Definition World.h:365
@ CONFIG_SKILL_CHANCE_MINING_STEPS
Definition World.h:276
@ CONFIG_ARENA_AUTO_DISTRIBUTE_INTERVAL_DAYS
Definition World.h:322
@ CONFIG_START_PLAYER_MONEY
Definition World.h:241
@ CONFIG_GUILD_BANK_EVENT_LOG_COUNT
Definition World.h:340
@ CONFIG_TRADE_LEVEL_REQ
Definition World.h:302
@ CONFIG_AHBOT_UPDATE_INTERVAL
Definition World.h:385
@ CONFIG_BG_REWARD_WINNER_ARENA_LAST
Definition World.h:379
@ CONFIG_BATTLEGROUND_PREMADE_GROUP_WAIT_FOR_MATCH
Definition World.h:316
@ CONFIG_START_DEATH_KNIGHT_PLAYER_MONEY
Definition World.h:242
@ CONFIG_CORPSE_DECAY_NORMAL
Definition World.h:306
@ CONFIG_WINTERGRASP_RESTART_AFTER_CRASH
Definition World.h:371
@ CONFIG_SOCKET_TIMEOUTTIME_ACTIVE
Definition World.h:403
@ CONFIG_START_PLAYER_LEVEL
Definition World.h:239
@ CONFIG_RESPAWN_GUIDALERTLEVEL
Definition World.h:398
@ CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL
Definition World.h:247
@ CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL_DIFFERENCE
Definition World.h:248
@ CONFIG_CLEAN_OLD_MAIL_TIME
Definition World.h:270
@ CONFIG_INTERVAL_GRIDCLEAN
Definition World.h:214
@ CONFIG_BG_REWARD_WINNER_HONOR_FIRST
Definition World.h:376
@ CONFIG_ARENA_START_PERSONAL_RATING
Definition World.h:325
@ CONFIG_COMPRESSION
Definition World.h:212
@ CONFIG_STRICT_CHARTER_NAMES
Definition World.h:224
@ CONFIG_INTERVAL_SAVE
Definition World.h:213
@ CONFIG_BG_REWARD_LOSER_HONOR_FIRST
Definition World.h:380
@ CONFIG_CORPSE_DECAY_WORLDBOSS
Definition World.h:310
@ CONFIG_TICKET_LEVEL_REQ
Definition World.h:303
@ CONFIG_PACKET_SPOOF_POLICY
Definition World.h:372
@ CONFIG_CHATFLOOD_ADDON_MESSAGE_COUNT
Definition World.h:286
@ CONFIG_CHAT_YELL_LEVEL_REQ
Definition World.h:300
@ CONFIG_WARDEN_NUM_INJECT_CHECKS
Definition World.h:363
@ CONFIG_LFG_OPTIONSMASK
Definition World.h:356
@ CONFIG_GM_LOGIN_STATE
Definition World.h:258
@ CONFIG_ARENA_PREV_OPPONENTS_DISCARD_TIMER
Definition World.h:320
@ CONFIG_AUCTION_LEVEL_REQ
Definition World.h:304
@ CONFIG_REALM_ZONE
Definition World.h:222
@ CONFIG_CHAT_STRICT_LINK_CHECKING_KICK
Definition World.h:295
@ CONFIG_GM_LEVEL_IN_GM_LIST
Definition World.h:264
@ CONFIG_ARENA_RATING_DISCARD_TIMER
Definition World.h:319
@ CONFIG_CALENDAR_DELETE_OLD_EVENTS_HOUR
Definition World.h:343
@ CONFIG_GM_VISIBLE_STATE
Definition World.h:259
@ CONFIG_NO_GRAY_AGGRO_ABOVE
Definition World.h:390
@ CONFIG_GROUP_VISIBILITY
Definition World.h:268
@ CONFIG_CREATURE_FAMILY_FLEE_DELAY
Definition World.h:290
@ CONFIG_PACKET_SPOOF_BANMODE
Definition World.h:373
@ CONFIG_XP_BOOST_DAYMASK
Definition World.h:358
@ CONFIG_MIN_DISCOVERED_SCALED_XP_RATIO
Definition World.h:257
@ CONFIG_MAX_WHO
Definition World.h:327
@ CONFIG_CHARACTER_CREATING_MIN_LEVEL_FOR_DEATH_KNIGHT
Definition World.h:235
@ CONFIG_CHARDELETE_KEEP_DAYS
Definition World.h:345
@ CONFIG_MAX_RESULTS_LOOKUP_COMMANDS
Definition World.h:351
@ CONFIG_START_HONOR_POINTS
Definition World.h:244
@ CONFIG_CREATURE_STOP_FOR_PLAYER
Definition World.h:384
@ CONFIG_INTERVAL_DISCONNECT_TOLERANCE
Definition World.h:217
@ CONFIG_CHAT_WHISPER_LEVEL_REQ
Definition World.h:297
@ CONFIG_SKILL_GAIN_GATHERING
Definition World.h:280
@ CONFIG_CHARTER_COST_ARENA_2v2
Definition World.h:387
@ CONFIG_CHATFLOOD_MESSAGE_DELAY
Definition World.h:285
@ CONFIG_CHARDELETE_DEATH_KNIGHT_MIN_LEVEL
Definition World.h:348
@ CONFIG_DISABLE_BREATHING
Definition World.h:313
@ CONFIG_ACC_PASSCHANGESEC
Definition World.h:375
@ CONFIG_STRICT_PLAYER_NAMES
Definition World.h:223
@ CONFIG_LOGDB_CLEARINTERVAL
Definition World.h:336
@ CONFIG_BATTLEGROUND_REPORT_AFK
Definition World.h:317
@ CONFIG_MIN_QUEST_SCALED_XP_RATIO
Definition World.h:255
@ CONFIG_INSTANCE_UNLOAD_DELAY
Definition World.h:250
@ CONFIG_GM_LEVEL_IN_WHO_LIST
Definition World.h:265
@ CONFIG_BATTLEGROUND_PREMATURE_FINISH_TIMER
Definition World.h:315
@ CONFIG_HONOR_AFTER_DUEL
Definition World.h:329
@ CONFIG_WEEKLY_QUEST_RESET_TIME_WDAY
Definition World.h:252
@ CONFIG_PERSISTENT_CHARACTER_CLEAN_FLAGS
Definition World.h:355
@ CONFIG_EXPANSION
Definition World.h:283
@ CONFIG_CORPSE_DECAY_RARE
Definition World.h:307
@ CONFIG_CHAT_STRICT_LINK_CHECKING_SEVERITY
Definition World.h:294
@ CONFIG_RESPAWN_GUIDWARNLEVEL
Definition World.h:397
@ CONFIG_UPTIME_UPDATE
Definition World.h:271
@ CONFIG_WARDEN_CLIENT_RESPONSE_DELAY
Definition World.h:359
@ CONFIG_TALENTS_INSPECTING
Definition World.h:394
@ CONFIG_WINTERGRASP_PLR_MAX
Definition World.h:366
@ CONFIG_CHAT_EMOTE_LEVEL_REQ
Definition World.h:298
@ CONFIG_AUCTION_SEARCH_DELAY
Definition World.h:393
@ CONFIG_PORT_WORLD
Definition World.h:218
@ CONFIG_MIN_DUALSPEC_LEVEL
Definition World.h:238
@ CONFIG_SKILL_GAIN_CRAFTING
Definition World.h:278
@ CONFIG_RANDOM_BG_RESET_HOUR
Definition World.h:342
@ CONFIG_DB_PING_INTERVAL
Definition World.h:352
@ CONFIG_WORLD_BOSS_LEVEL_DIFF
Definition World.h:291
@ CONFIG_CORPSE_DECAY_RAREELITE
Definition World.h:309
@ CONFIG_CHATFLOOD_MESSAGE_COUNT
Definition World.h:284
@ CONFIG_WARDEN_CLIENT_FAIL_ACTION
Definition World.h:361
@ CONFIG_RESPAWN_DYNAMICMINIMUM_GAMEOBJECT
Definition World.h:401
@ CONFIG_CHARTER_COST_ARENA_3v3
Definition World.h:388
@ CONFIG_MIN_PLAYER_NAME
Definition World.h:226
@ CONFIG_CHATFLOOD_ADDON_MESSAGE_DELAY
Definition World.h:287
@ CONFIG_SKILL_CHANCE_GREY
Definition World.h:275
@ CONFIG_INTERVAL_MAPUPDATE
Definition World.h:215
@ CONFIG_NUMTHREADS
Definition World.h:335
@ CONFIG_CREATURE_FAMILY_ASSISTANCE_DELAY
Definition World.h:289
@ CONFIG_MAX_PRIMARY_TRADE_SKILL
Definition World.h:253
@ CONFIG_SKIP_CINEMATICS
Definition World.h:236
@ CONFIG_SKILL_CHANCE_GREEN
Definition World.h:274
@ CONFIG_CHAT_SAY_LEVEL_REQ
Definition World.h:299
@ CONFIG_WINTERGRASP_PLR_MIN
Definition World.h:367
@ CONFIG_BG_REWARD_WINNER_HONOR_LAST
Definition World.h:378
@ CONFIG_CHARACTERS_PER_REALM
Definition World.h:233
@ CONFIG_RESPAWN_MINCHECKINTERVALMS
Definition World.h:395
@ 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:449
@ RATE_CREATURE_NORMAL_HP
Definition World.h:439
@ RATE_DAMAGE_FALL
Definition World.h:458
@ RATE_DROP_ITEM_REFERENCED_AMOUNT
Definition World.h:428
@ RATE_CREATURE_NORMAL_DAMAGE
Definition World.h:444
@ RATE_POWER_RAGE_INCOME
Definition World.h:413
@ RATE_CREATURE_ELITE_RARE_DAMAGE
Definition World.h:448
@ RATE_CREATURE_AGGRO
Definition World.h:454
@ RATE_POWER_RAGE_LOSS
Definition World.h:414
@ RATE_REPUTATION_LOWLEVEL_QUEST
Definition World.h:437
@ RATE_ARENA_POINTS
Definition World.h:463
@ RATE_DURABILITY_LOSS_BLOCK
Definition World.h:471
@ RATE_DROP_ITEM_RARE
Definition World.h:423
@ RATE_CREATURE_ELITE_ELITE_SPELLDAMAGE
Definition World.h:450
@ RATE_REPUTATION_LOWLEVEL_KILL
Definition World.h:436
@ RATE_XP_KILL
Definition World.h:430
@ RATE_POWER_RUNICPOWER_INCOME
Definition World.h:415
@ RATE_INSTANCE_RESET_TIME
Definition World.h:466
@ RATE_REST_OFFLINE_IN_WILDERNESS
Definition World.h:457
@ RATE_POWER_RUNICPOWER_LOSS
Definition World.h:416
@ RATE_CREATURE_ELITE_WORLDBOSS_DAMAGE
Definition World.h:447
@ RATE_POWER_ENERGY
Definition World.h:418
@ RATE_TALENT
Definition World.h:464
@ RATE_MONEY_MAX_LEVEL_QUEST
Definition World.h:475
@ RATE_CREATURE_ELITE_RAREELITE_DAMAGE
Definition World.h:446
@ RATE_POWER_MANA
Definition World.h:412
@ RATE_CREATURE_ELITE_WORLDBOSS_HP
Definition World.h:442
@ RATE_DROP_ITEM_LEGENDARY
Definition World.h:425
@ RATE_DURABILITY_LOSS_PARRY
Definition World.h:469
@ RATE_DROP_ITEM_POOR
Definition World.h:420
@ RATE_REST_OFFLINE_IN_TAVERN_OR_CITY
Definition World.h:456
@ RATE_AUCTION_DEPOSIT
Definition World.h:460
@ RATE_DROP_ITEM_UNCOMMON
Definition World.h:422
@ RATE_DROP_ITEM_REFERENCED
Definition World.h:427
@ RATE_CREATURE_ELITE_RAREELITE_SPELLDAMAGE
Definition World.h:451
@ RATE_REPUTATION_RECRUIT_A_FRIEND_BONUS
Definition World.h:438
@ RATE_REPAIRCOST
Definition World.h:434
@ RATE_DROP_MONEY
Definition World.h:429
@ RATE_DURABILITY_LOSS_DAMAGE
Definition World.h:468
@ RATE_MONEY_QUEST
Definition World.h:474
@ RATE_AUCTION_CUT
Definition World.h:461
@ RATE_HEALTH
Definition World.h:411
@ RATE_MOVESPEED
Definition World.h:472
@ RATE_DURABILITY_LOSS_ON_DEATH
Definition World.h:467
@ RATE_CREATURE_ELITE_ELITE_DAMAGE
Definition World.h:445
@ RATE_XP_QUEST
Definition World.h:432
@ RATE_XP_BOOST
Definition World.h:473
@ RATE_CREATURE_ELITE_WORLDBOSS_SPELLDAMAGE
Definition World.h:452
@ RATE_DROP_ITEM_EPIC
Definition World.h:424
@ RATE_SKILL_DISCOVERY
Definition World.h:419
@ RATE_DROP_ITEM_ARTIFACT
Definition World.h:426
@ RATE_CREATURE_ELITE_RARE_SPELLDAMAGE
Definition World.h:453
@ RATE_CREATURE_ELITE_ELITE_HP
Definition World.h:440
@ RATE_XP_EXPLORE
Definition World.h:433
@ RATE_CREATURE_ELITE_RARE_HP
Definition World.h:443
@ RATE_REPUTATION_GAIN
Definition World.h:435
@ RATE_REST_INGAME
Definition World.h:455
@ RATE_POWER_FOCUS
Definition World.h:417
@ RATE_XP_BG_KILL
Definition World.h:431
@ RATE_HONOR
Definition World.h:462
@ RATE_CORPSE_DECAY_LOOTED
Definition World.h:465
@ RATE_DURABILITY_LOSS_ABSORB
Definition World.h:470
@ RATE_AUCTION_TIME
Definition World.h:459
@ RATE_CREATURE_ELITE_RAREELITE_HP
Definition World.h:441
@ RATE_DROP_ITEM_NORMAL
Definition World.h:421
@ CONFIG_STATS_LIMITS_DODGE
Definition World.h:197
@ CONFIG_RESPAWN_DYNAMICRATE_CREATURE
Definition World.h:205
@ CONFIG_SIGHT_MONSTER
Definition World.h:189
@ CONFIG_ARENA_WIN_RATING_MODIFIER_1
Definition World.h:201
@ CONFIG_GROUP_XP_DISTANCE
Definition World.h:187
@ CONFIG_LISTEN_RANGE_YELL
Definition World.h:192
@ CONFIG_STATS_LIMITS_PARRY
Definition World.h:198
@ CONFIG_CREATURE_FAMILY_FLEE_ASSISTANCE_RADIUS
Definition World.h:193
@ CONFIG_ARENA_WIN_RATING_MODIFIER_2
Definition World.h:202
@ CONFIG_ARENA_LOSE_RATING_MODIFIER
Definition World.h:203
@ CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS
Definition World.h:194
@ CONFIG_LISTEN_RANGE_SAY
Definition World.h:190
@ CONFIG_THREAT_RADIUS
Definition World.h:195
@ CONFIG_MAX_RECRUIT_A_FRIEND_DISTANCE
Definition World.h:188
@ CONFIG_ARENA_MATCHMAKER_RATING_MODIFIER
Definition World.h:204
@ CONFIG_RESPAWN_DYNAMICRATE_GAMEOBJECT
Definition World.h:206
@ CONFIG_CHANCE_OF_GM_SURVEY
Definition World.h:196
@ CONFIG_STATS_LIMITS_CRIT
Definition World.h:200
@ CONFIG_LISTEN_RANGE_TEXTEMOTE
Definition World.h:191
@ CONFIG_STATS_LIMITS_BLOCK
Definition World.h:199
@ 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_EXTENDED_ACCOUNT_NAME_LENGTH_LIMIT
Definition World.h:181
@ 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:537
CommandFinished m_commandFinished
Definition World.h:544
void * m_callbackArg
Definition World.h:541
CliCommandHolder(void *callbackArg, char const *command, Print zprint, CommandFinished commandFinished)
Definition World.cpp:3612
Print m_print
Definition World.h:543
void(*)(void *, std::string_view) Print
Definition World.h:538
char * m_command
Definition World.h:542
void(*)(void *, bool success) CommandFinished
Definition World.h:539
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