Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
World.cpp
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
9
10#include "AccountMgr.h"
11#include "AchievementMgr.h"
12#include "AddonMgr.h"
13#include "ArenaTeamMgr.h"
14#include "AuctionHouseMgr.h"
15#include "BattlefieldMgr.h"
16#include "BattlegroundMgr.h"
17#include "BattlePetMgr.h"
18#include "BattlePetSpawnMgr.h"
19#include "BlackMarketMgr.h"
20#include "CalendarMgr.h"
21#include "CellImpl.h"
22#include "Channel.h"
24#include "Chat.h"
25#include "CinematicPathMgr.h"
26#include "Common.h"
27#include "ConditionMgr.h"
28#include "Config.h"
29#include "CreatureAIRegistry.h"
30#include "CreatureGroups.h"
31#include "CreatureTextMgr.h"
32#include "DatabaseEnv.h"
33#include "DB2Stores.h"
34#include "DBCStores.h"
35#include "DisableMgr.h"
36#include "GameEventMgr.h"
37#include "GridNotifiersImpl.h"
38#include "GroupMgr.h"
39#include "GuildFinderMgr.h"
40#include "GuildMgr.h"
41#include "InstanceSaveMgr.h"
42#include "ItemEnchantmentMgr.h"
43#include "Language.h"
45#include "LFGMgr.h"
46#ifdef ELUNA
47void StartEluna(bool restart);
48#endif
49#include "Log.h"
50#include "LootMgr.h"
51#include "MapManager.h"
52#include "Memory.h"
53#include "MMapFactory.h"
54#include "ObjectMgr.h"
55#include "Opcodes.h"
56#include "OutdoorPvPMgr.h"
57#include "Platform/TimeUtils.h"
58#include "Player.h"
59#include "PoolMgr.h"
60#include "RuntimeMetrics.h"
61#include "ScriptMgr.h"
62#include "ScriptMgr.h"
63#include "SkillDiscovery.h"
64#include "SkillExtraItems.h"
65#include "SmartAI.h"
66#include "SpellMgr.h"
67#include "SystemConfig.h"
68#include "TemporarySummon.h"
69#include "TicketMgr.h"
70#include "Transport.h"
71#include "TransportMgr.h"
72#include "Util.h"
73#include "Vehicle.h"
74#include "VMapFactory.h"
75#include "Warden.h"
76#include "WardenCheckMgr.h"
78#include "WeatherMgr.h"
79#include "World.h"
80#include "WorldPacket.h"
81#include "WorldSession.h"
82
83std::atomic<bool> World::m_stopEvent = false;
85std::atomic<uint32> World::m_worldLoopCounter = 0;
86
90
94
123
126{
128 while (!m_sessions.empty())
129 {
130 // not remove from queue, prevent loading new sessions
131 delete m_sessions.begin()->second;
132 m_sessions.erase(m_sessions.begin());
133 }
134
135 CliCommandHolder* command = NULL;
136 while (cliCmdQueue.next(command))
137 delete command;
138
141
143}
144
147{
149 SessionMap::const_iterator itr;
150 for (itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
151 {
152 if (!itr->second)
153 continue;
154
155 Player* player = itr->second->GetPlayer();
156 if (!player)
157 continue;
158
159 if (player->IsInWorld() && player->GetZoneId() == zone)
160 {
161 // Used by the weather system. We return the player to broadcast the change weather message to him and all players in the zone.
162 return player;
163 }
164 }
165 return NULL;
166}
167
168bool World::IsClosed() const
169{
170 return m_isClosed;
171}
172
173void World::SetClosed(bool val)
174{
175 m_isClosed = val;
176
177 // Invert the value, for simplicity for scripters.
178 sScriptMgr->OnOpenStateChange(!val);
179}
180
181void World::SetMotd(const std::string& motd)
182{
183 m_motd = motd;
184
185 sScriptMgr->OnMotdChange(m_motd);
186}
187
188const char* World::GetMotd() const
189{
190 return m_motd.c_str();
191}
192
195{
196 SessionMap::const_iterator itr = m_sessions.find(id);
197
198 if (itr != m_sessions.end())
199 return itr->second; // also can return NULL for kicked session
200 else
201 return NULL;
202}
203
206{
208 SessionMap::const_iterator itr = m_sessions.find(id);
209
210 if (itr != m_sessions.end() && itr->second)
211 {
212 if (itr->second->PlayerLoading())
213 return false;
214
215 itr->second->KickPlayer();
216 }
217
218 return true;
219}
220
222{
223 addSessQueue.add(s);
224}
225
227{
228 ASSERT(s);
229
230 //NOTE - Still there is race condition in WorldSession* being used in the Sockets
231
234 if (!RemoveSession(s->GetAccountId()))
235 {
236 s->KickPlayer();
237 delete s; // session not added yet in session list, so not listed in queue
238 return;
239 }
240
241 // decrease session counts only at not reconnection case
242 bool decrease_session = true;
243
244 // if session already exist, prepare to it deleting at next world update
245 // NOTE - KickPlayer() should be called on "old" in RemoveSession()
246 {
247 SessionMap::const_iterator old = m_sessions.find(s->GetAccountId());
248
249 if (old != m_sessions.end())
250 {
251 // prevent decrease sessions count if session queued
252 if (RemoveQueuedPlayer(old->second))
253 decrease_session = false;
254 // not remove replaced session form queue if listed
255 delete old->second;
256 }
257 }
258
259 m_sessions[s->GetAccountId()] = s;
260
262 uint32 pLimit = GetPlayerAmountLimit();
263 uint32 QueueSize = GetQueuedSessionCount(); //number of players in the queue
264
265 //so we don't count the user trying to
266 //login as a session and queue the socket that we are using
267 if (decrease_session)
268 --Sessions;
269
270 if (pLimit > 0 && Sessions >= pLimit && !s->HasPermission(rbac::RBAC_PERM_SKIP_QUEUE) && !HasRecentlyDisconnected(s))
271 {
274 SF_LOG_INFO("misc", "PlayerQueue: Account id %u is in Queue Position (%u).", s->GetAccountId(), ++QueueSize);
275 return;
276 }
277
280 s->SendAddonsInfo();
282 if (s->HasBoost())
286
288
289 // Updates the population
290 if (pLimit > 0)
291 {
292 float popu = (float)GetActiveSessionCount(); // updated number of users on the server
293 popu /= pLimit;
294 popu *= 2;
295 SF_LOG_INFO("misc", "Server Population (%f).", popu);
296 }
297}
298
300{
301 if (!session)
302 return false;
303
305 {
306 for (DisconnectMap::iterator i = m_disconnects.begin(); i != m_disconnects.end();)
307 {
308 if (difftime(i->second, time(NULL)) < tolerance)
309 {
310 if (i->first == session->GetAccountId())
311 return true;
312 ++i;
313 }
314 else
315 m_disconnects.erase(i++);
316 }
317 }
318 return false;
319}
320
322{
323 uint32 position = 1;
324
325 for (Queue::const_iterator iter = m_QueuedPlayer.begin(); iter != m_QueuedPlayer.end(); ++iter, ++position)
326 if ((*iter) == sess)
327 return position;
328
329 return 0;
330}
331
333{
334 sess->SetInQueue(true);
335 m_QueuedPlayer.push_back(sess);
336
337 // The 1st SMSG_AUTH_RESPONSE needs to contain other info too.
339}
340
342{
343 // sessions count including queued to remove (if removed_session set)
344 uint32 sessions = GetActiveSessionCount();
345
346 uint32 position = 1;
347 Queue::iterator iter = m_QueuedPlayer.begin();
348
349 // search to remove and count skipped positions
350 bool found = false;
351
352 for (; iter != m_QueuedPlayer.end(); ++iter, ++position)
353 {
354 if (*iter == sess)
355 {
356 sess->SetInQueue(false);
357 sess->ResetTimeOutTime();
358 iter = m_QueuedPlayer.erase(iter);
359 found = true; // removing queued session
360 break;
361 }
362 }
363
364 // iter point to next socked after removed or end()
365 // position store position of removed socket and then new position next socket after removed
366
367 // if session not queued then we need decrease sessions count
368 if (!found && sessions)
369 --sessions;
370
371 // accept first in queue
372 if ((!m_playerLimit || sessions < m_playerLimit) && !m_QueuedPlayer.empty())
373 {
374 WorldSession* pop_sess = m_QueuedPlayer.front();
375 pop_sess->SetInQueue(false);
376 pop_sess->ResetTimeOutTime();
377 pop_sess->SendAuthWaitQue(0);
379 pop_sess->SendAddonsInfo();
380
383 pop_sess->SendTutorialsData();
384 pop_sess->SendTimezoneInformation();
385
386 m_QueuedPlayer.pop_front();
387
388 // update iter to point first queued socket or end() if queue is empty now
389 iter = m_QueuedPlayer.begin();
390 position = 1;
391 }
392
393 // update position from iter to end()
394 // iter point to first not updated socket, position store new position
395 for (; iter != m_QueuedPlayer.end(); ++iter, ++position)
396 (*iter)->SendAuthWaitQue(position);
397
398 return found;
399}
400
403{
404 if (reload)
405 {
406 if (!sConfigMgr->Reload())
407 {
408 SF_LOG_ERROR("misc", "World settings reload fail: can't read settings from %s.", sConfigMgr->GetFilename().c_str());
409 return;
410 }
411 sLog->LoadFromConfig();
412 }
413
414 m_defaultDbcLocale = LocaleConstant(sConfigMgr->GetIntDefault("DBC.Locale", 0));
415
417 {
418 SF_LOG_ERROR("server.loading", "Incorrect DBC.Locale! Must be >= 0 and < %d (set to 0)", TOTAL_LOCALES);
420 }
421
422 SF_LOG_INFO("server.loading", "Using %s DBC Locale", localeNames[m_defaultDbcLocale]);
423
425 SetPlayerAmountLimit(sConfigMgr->GetIntDefault("PlayerLimit", 100));
426 SetMotd(sConfigMgr->GetStringDefault("Motd", "Welcome to a Skyfire Core Server."));
427
429 SetBoolConfig(WorldBoolConfigs::CONFIG_TICKETS_FEEDBACK_SYSTEM_ENABLED, sConfigMgr->GetBoolDefault("TicketSystem.FeedBackTickets", true));
430 SetBoolConfig(WorldBoolConfigs::CONFIG_TICKETS_GM_ENABLED, sConfigMgr->GetBoolDefault("TicketSystem.GMTickets", true));
431 if (reload)
432 {
435 }
436
438 SetNewCharString(sConfigMgr->GetStringDefault("PlayerStart.String", ""));
439
441 setIntConfig(WorldIntConfigs::CONFIG_ENABLE_SINFO_LOGIN, sConfigMgr->GetIntDefault("Server.LoginInfo", 0));
442
444 setRate(Rates::RATE_HEALTH, sConfigMgr->GetFloatDefault("Rate.Health", 1));
446 {
447 SF_LOG_ERROR("server.loading", "Rate.Health (%f) must be > 0. Using 1 instead.", getRate(Rates::RATE_HEALTH));
449 }
450 setRate(Rates::RATE_POWER_MANA, sConfigMgr->GetFloatDefault("Rate.Mana", 1));
452 {
453 SF_LOG_ERROR("server.loading", "Rate.Mana (%f) must be > 0. Using 1 instead.", getRate(Rates::RATE_POWER_MANA));
455 }
456 setRate(Rates::RATE_POWER_RAGE_INCOME, sConfigMgr->GetFloatDefault("Rate.Rage.Income", 1));
457 setRate(Rates::RATE_POWER_RAGE_LOSS, sConfigMgr->GetFloatDefault("Rate.Rage.Loss", 1));
459 {
460 SF_LOG_ERROR("server.loading", "Rate.Rage.Loss (%f) must be > 0. Using 1 instead.", getRate(Rates::RATE_POWER_RAGE_LOSS));
462 }
463 setRate(Rates::RATE_POWER_RUNICPOWER_INCOME, sConfigMgr->GetFloatDefault("Rate.RunicPower.Income", 1));
464 setRate(Rates::RATE_POWER_RUNICPOWER_LOSS, sConfigMgr->GetFloatDefault("Rate.RunicPower.Loss", 1));
466 {
467 SF_LOG_ERROR("server.loading", "Rate.RunicPower.Loss (%f) must be > 0. Using 1 instead.", getRate(Rates::RATE_POWER_RUNICPOWER_LOSS));
469 }
470 setRate(Rates::RATE_POWER_DEMONICFURY_LOSS, sConfigMgr->GetFloatDefault("Rate.DemonicFury.Loss", 1));
472 {
473 SF_LOG_ERROR("server.loading", "Rate.DemonicFury.Loss (%f) must be > 0. Using 1 instead.", getRate(Rates::RATE_POWER_DEMONICFURY_LOSS));
475 }
476 setRate(Rates::RATE_POWER_FOCUS, sConfigMgr->GetFloatDefault("Rate.Focus", 1.0f));
477 setRate(Rates::RATE_POWER_ENERGY, sConfigMgr->GetFloatDefault("Rate.Energy", 1.0f));
478 setRate(Rates::RATE_POWER_CHI, sConfigMgr->GetFloatDefault("Rate.Chi", 1.0f));
479
480 setRate(Rates::RATE_SKILL_DISCOVERY, sConfigMgr->GetFloatDefault("Rate.Skill.Discovery", 1.0f));
481
482 setRate(Rates::RATE_DROP_ITEM_POOR, sConfigMgr->GetFloatDefault("Rate.Drop.Item.Poor", 1.0f));
483 setRate(Rates::RATE_DROP_ITEM_NORMAL, sConfigMgr->GetFloatDefault("Rate.Drop.Item.Normal", 1.0f));
484 setRate(Rates::RATE_DROP_ITEM_UNCOMMON, sConfigMgr->GetFloatDefault("Rate.Drop.Item.Uncommon", 1.0f));
485 setRate(Rates::RATE_DROP_ITEM_RARE, sConfigMgr->GetFloatDefault("Rate.Drop.Item.Rare", 1.0f));
486 setRate(Rates::RATE_DROP_ITEM_EPIC, sConfigMgr->GetFloatDefault("Rate.Drop.Item.Epic", 1.0f));
487 setRate(Rates::RATE_DROP_ITEM_LEGENDARY, sConfigMgr->GetFloatDefault("Rate.Drop.Item.Legendary", 1.0f));
488 setRate(Rates::RATE_DROP_ITEM_ARTIFACT, sConfigMgr->GetFloatDefault("Rate.Drop.Item.Artifact", 1.0f));
489 setRate(Rates::RATE_DROP_ITEM_REFERENCED, sConfigMgr->GetFloatDefault("Rate.Drop.Item.Referenced", 1.0f));
490 setRate(Rates::RATE_DROP_ITEM_REFERENCED_AMOUNT, sConfigMgr->GetFloatDefault("Rate.Drop.Item.ReferencedAmount", 1.0f));
491 setRate(Rates::RATE_DROP_MONEY, sConfigMgr->GetFloatDefault("Rate.Drop.Money", 1.0f));
492 setRate(Rates::RATE_XP_KILL, sConfigMgr->GetFloatDefault("Rate.XP.Kill", 1.0f));
493 setRate(Rates::RATE_XP_QUEST, sConfigMgr->GetFloatDefault("Rate.XP.Quest", 1.0f));
494 setRate(Rates::RATE_XP_EXPLORE, sConfigMgr->GetFloatDefault("Rate.XP.Explore", 1.0f));
495 setRate(Rates::RATE_REPAIRCOST, sConfigMgr->GetFloatDefault("Rate.RepairCost", 1.0f));
497 {
498 SF_LOG_ERROR("server.loading", "Rate.RepairCost (%f) must be >=0. Using 0.0 instead.", getRate(Rates::RATE_REPAIRCOST));
500 }
501 setRate(Rates::RATE_REPUTATION_GAIN, sConfigMgr->GetFloatDefault("Rate.Reputation.Gain", 1.0f));
502 setRate(Rates::RATE_REPUTATION_LFG_BONUS, sConfigMgr->GetFloatDefault("Rate.Reputation.LFGBonus", 1.0f));
503 setRate(Rates::RATE_REPUTATION_LOWLEVEL_KILL, sConfigMgr->GetFloatDefault("Rate.Reputation.LowLevel.Kill", 1.0f));
504 setRate(Rates::RATE_REPUTATION_LOWLEVEL_QUEST, sConfigMgr->GetFloatDefault("Rate.Reputation.LowLevel.Quest", 1.0f));
505 setRate(Rates::RATE_REPUTATION_RECRUIT_A_FRIEND_BONUS, sConfigMgr->GetFloatDefault("Rate.Reputation.RecruitAFriendBonus", 0.1f));
506 setRate(Rates::RATE_CREATURE_NORMAL_DAMAGE, sConfigMgr->GetFloatDefault("Rate.Creature.Normal.Damage", 1.0f));
507 setRate(Rates::RATE_CREATURE_ELITE_ELITE_DAMAGE, sConfigMgr->GetFloatDefault("Rate.Creature.Elite.Elite.Damage", 1.0f));
508 setRate(Rates::RATE_CREATURE_ELITE_RAREELITE_DAMAGE, sConfigMgr->GetFloatDefault("Rate.Creature.Elite.RAREELITE.Damage", 1.0f));
509 setRate(Rates::RATE_CREATURE_ELITE_WORLDBOSS_DAMAGE, sConfigMgr->GetFloatDefault("Rate.Creature.Elite.WORLDBOSS.Damage", 1.0f));
510 setRate(Rates::RATE_CREATURE_ELITE_RARE_DAMAGE, sConfigMgr->GetFloatDefault("Rate.Creature.Elite.RARE.Damage", 1.0f));
511 setRate(Rates::RATE_CREATURE_NORMAL_HP, sConfigMgr->GetFloatDefault("Rate.Creature.Normal.HP", 1.0f));
512 setRate(Rates::RATE_CREATURE_ELITE_ELITE_HP, sConfigMgr->GetFloatDefault("Rate.Creature.Elite.Elite.HP", 1.0f));
513 setRate(Rates::RATE_CREATURE_ELITE_RAREELITE_HP, sConfigMgr->GetFloatDefault("Rate.Creature.Elite.RAREELITE.HP", 1.0f));
514 setRate(Rates::RATE_CREATURE_ELITE_WORLDBOSS_HP, sConfigMgr->GetFloatDefault("Rate.Creature.Elite.WORLDBOSS.HP", 1.0f));
515 setRate(Rates::RATE_CREATURE_ELITE_RARE_HP, sConfigMgr->GetFloatDefault("Rate.Creature.Elite.RARE.HP", 1.0f));
516 setRate(Rates::RATE_CREATURE_NORMAL_SPELLDAMAGE, sConfigMgr->GetFloatDefault("Rate.Creature.Normal.SpellDamage", 1.0f));
517 setRate(Rates::RATE_CREATURE_ELITE_ELITE_SPELLDAMAGE, sConfigMgr->GetFloatDefault("Rate.Creature.Elite.Elite.SpellDamage", 1.0f));
518 setRate(Rates::RATE_CREATURE_ELITE_RAREELITE_SPELLDAMAGE, sConfigMgr->GetFloatDefault("Rate.Creature.Elite.RAREELITE.SpellDamage", 1.0f));
519 setRate(Rates::RATE_CREATURE_ELITE_WORLDBOSS_SPELLDAMAGE, sConfigMgr->GetFloatDefault("Rate.Creature.Elite.WORLDBOSS.SpellDamage", 1.0f));
520 setRate(Rates::RATE_CREATURE_ELITE_RARE_SPELLDAMAGE, sConfigMgr->GetFloatDefault("Rate.Creature.Elite.RARE.SpellDamage", 1.0f));
521 setRate(Rates::RATE_CREATURE_AGGRO, sConfigMgr->GetFloatDefault("Rate.Creature.Aggro", 1.0f));
522 setRate(Rates::RATE_REST_INGAME, sConfigMgr->GetFloatDefault("Rate.Rest.InGame", 1.0f));
523 setRate(Rates::RATE_REST_OFFLINE_IN_TAVERN_OR_CITY, sConfigMgr->GetFloatDefault("Rate.Rest.Offline.InTavernOrCity", 1.0f));
524 setRate(Rates::RATE_REST_OFFLINE_IN_WILDERNESS, sConfigMgr->GetFloatDefault("Rate.Rest.Offline.InWilderness", 1.0f));
525 setRate(Rates::RATE_DAMAGE_FALL, sConfigMgr->GetFloatDefault("Rate.Damage.Fall", 1.0f));
526 setRate(Rates::RATE_AUCTION_TIME, sConfigMgr->GetFloatDefault("Rate.Auction.Time", 1.0f));
527 setRate(Rates::RATE_AUCTION_DEPOSIT, sConfigMgr->GetFloatDefault("Rate.Auction.Deposit", 1.0f));
528 setRate(Rates::RATE_AUCTION_CUT, sConfigMgr->GetFloatDefault("Rate.Auction.Cut", 1.0f));
529 setRate(Rates::RATE_HONOR, sConfigMgr->GetFloatDefault("Rate.Honor", 1.0f));
530 setRate(Rates::RATE_INSTANCE_RESET_TIME, sConfigMgr->GetFloatDefault("Rate.InstanceResetTime", 1.0f));
531 setRate(Rates::RATE_MOVESPEED, sConfigMgr->GetFloatDefault("Rate.MoveSpeed", 1.0f));
533 {
534 SF_LOG_ERROR("server.loading", "Rate.MoveSpeed (%f) must be > 0. Using 1 instead.", getRate(Rates::RATE_MOVESPEED));
536 }
538
539 setRate(Rates::RATE_CORPSE_DECAY_LOOTED, sConfigMgr->GetFloatDefault("Rate.Corpse.Decay.Looted", 0.5f));
540
541 setRate(Rates::RATE_TARGET_POS_RECALCULATION_RANGE, sConfigMgr->GetFloatDefault("TargetPosRecalculateRange", 1.5f));
543 {
544 SF_LOG_ERROR("server.loading", "TargetPosRecalculateRange (%f) must be >= %f. Using %f instead.", getRate(Rates::RATE_TARGET_POS_RECALCULATION_RANGE), CONTACT_DISTANCE, CONTACT_DISTANCE);
546 }
548 {
549 SF_LOG_ERROR("server.loading", "TargetPosRecalculateRange (%f) must be <= %f. Using %f instead.",
552 }
553
554 setRate(Rates::RATE_DURABILITY_LOSS_ON_DEATH, sConfigMgr->GetFloatDefault("DurabilityLoss.OnDeath", 10.0f));
556 {
557 SF_LOG_ERROR("server.loading", "DurabilityLoss.OnDeath (%f) must be >=0. Using 0.0 instead.", getRate(Rates::RATE_DURABILITY_LOSS_ON_DEATH));
559 }
561 {
562 SF_LOG_ERROR("server.loading", "DurabilityLoss.OnDeath (%f) must be <= 100. Using 100.0 instead.", getRate(Rates::RATE_DURABILITY_LOSS_ON_DEATH));
564 }
566
567 setRate(Rates::RATE_DURABILITY_LOSS_DAMAGE, sConfigMgr->GetFloatDefault("DurabilityLossChance.Damage", 0.5f));
569 {
570 SF_LOG_ERROR("server.loading", "DurabilityLossChance.Damage (%f) must be >=0. Using 0.0 instead.", getRate(Rates::RATE_DURABILITY_LOSS_DAMAGE));
572 }
573 setRate(Rates::RATE_DURABILITY_LOSS_ABSORB, sConfigMgr->GetFloatDefault("DurabilityLossChance.Absorb", 0.5f));
575 {
576 SF_LOG_ERROR("server.loading", "DurabilityLossChance.Absorb (%f) must be >=0. Using 0.0 instead.", getRate(Rates::RATE_DURABILITY_LOSS_ABSORB));
578 }
579 setRate(Rates::RATE_DURABILITY_LOSS_PARRY, sConfigMgr->GetFloatDefault("DurabilityLossChance.Parry", 0.05f));
581 {
582 SF_LOG_ERROR("server.loading", "DurabilityLossChance.Parry (%f) must be >=0. Using 0.0 instead.", getRate(Rates::RATE_DURABILITY_LOSS_PARRY));
584 }
585 setRate(Rates::RATE_DURABILITY_LOSS_BLOCK, sConfigMgr->GetFloatDefault("DurabilityLossChance.Block", 0.05f));
587 {
588 SF_LOG_ERROR("server.loading", "DurabilityLossChance.Block (%f) must be >=0. Using 0.0 instead.", getRate(Rates::RATE_DURABILITY_LOSS_BLOCK));
590 }
592
593 SetBoolConfig(WorldBoolConfigs::CONFIG_DURABILITY_LOSS_IN_PVP, sConfigMgr->GetBoolDefault("DurabilityLoss.InPvP", false));
594
595 setIntConfig(WorldIntConfigs::CONFIG_COMPRESSION, sConfigMgr->GetIntDefault("Compression", 1));
597 {
598 SF_LOG_ERROR("server.loading", "Compression level (%i) must be in range 1..9. Using default compression level (1).", getIntConfig(WorldIntConfigs::CONFIG_COMPRESSION));
600 }
601 SetBoolConfig(WorldBoolConfigs::CONFIG_ADDON_CHANNEL, sConfigMgr->GetBoolDefault("AddonChannel", true));
602 SetBoolConfig(WorldBoolConfigs::CONFIG_CLEAN_CHARACTER_DB, sConfigMgr->GetBoolDefault("CleanCharacterDB", false));
603 setIntConfig(WorldIntConfigs::CONFIG_PERSISTENT_CHARACTER_CLEAN_FLAGS, sConfigMgr->GetIntDefault("PersistentCharacterCleanFlags", 0));
604 setIntConfig(WorldIntConfigs::CONFIG_CHAT_CHANNEL_LEVEL_REQ, sConfigMgr->GetIntDefault("ChatLevelReq.Channel", 1));
605 setIntConfig(WorldIntConfigs::CONFIG_CHAT_WHISPER_LEVEL_REQ, sConfigMgr->GetIntDefault("ChatLevelReq.Whisper", 1));
606 SetBoolConfig(WorldBoolConfigs::CONFIG_CHAT_GM_WHISPER_FILTER_BYPASS, sConfigMgr->GetBoolDefault("Chat.GMWhisperFilterBypass", true));
607 setIntConfig(WorldIntConfigs::CONFIG_CHAT_SAY_LEVEL_REQ, sConfigMgr->GetIntDefault("ChatLevelReq.Say", 1));
608 setIntConfig(WorldIntConfigs::CONFIG_TRADE_LEVEL_REQ, sConfigMgr->GetIntDefault("LevelReq.Trade", 1));
609 setIntConfig(WorldIntConfigs::CONFIG_TICKET_LEVEL_REQ, sConfigMgr->GetIntDefault("LevelReq.Ticket", 1));
610 setIntConfig(WorldIntConfigs::CONFIG_AUCTION_LEVEL_REQ, sConfigMgr->GetIntDefault("LevelReq.Auction", 1));
611 setIntConfig(WorldIntConfigs::CONFIG_MAIL_LEVEL_REQ, sConfigMgr->GetIntDefault("LevelReq.Mail", 1));
612 SetBoolConfig(WorldBoolConfigs::CONFIG_PRESERVE_CUSTOM_CHANNELS, sConfigMgr->GetBoolDefault("PreserveCustomChannels", false));
613 setIntConfig(WorldIntConfigs::CONFIG_PRESERVE_CUSTOM_CHANNEL_DURATION, sConfigMgr->GetIntDefault("PreserveCustomChannelDuration", 14));
614 SetBoolConfig(WorldBoolConfigs::CONFIG_GRID_UNLOAD, sConfigMgr->GetBoolDefault("GridUnload", true));
615 setIntConfig(WorldIntConfigs::CONFIG_INTERVAL_SAVE, sConfigMgr->GetIntDefault("PlayerSaveInterval", 15 * MINUTE * IN_MILLISECONDS));
616 setIntConfig(WorldIntConfigs::CONFIG_INTERVAL_DISCONNECT_TOLERANCE, sConfigMgr->GetIntDefault("DisconnectToleranceInterval", 0));
617 SetBoolConfig(WorldBoolConfigs::CONFIG_STATS_SAVE_ONLY_ON_LOGOUT, sConfigMgr->GetBoolDefault("PlayerSave.Stats.SaveOnlyOnLogout", true));
618
619 setIntConfig(WorldIntConfigs::CONFIG_MIN_LEVEL_STAT_SAVE, sConfigMgr->GetIntDefault("PlayerSave.Stats.MinLevel", 0));
621 {
622 SF_LOG_ERROR("server.loading", "PlayerSave.Stats.MinLevel (%i) must be in range 0..80. Using default, do not save character stats (0).", getIntConfig(WorldIntConfigs::CONFIG_MIN_LEVEL_STAT_SAVE));
624 }
625
628 {
629 SF_LOG_ERROR("server.loading", "GridCleanUpDelay (%i) must be greater %u. Use this minimal value.", getIntConfig(WorldIntConfigs::CONFIG_INTERVAL_GRIDCLEAN), MIN_GRID_DELAY);
631 }
632 if (reload)
634
635 setIntConfig(WorldIntConfigs::CONFIG_INTERVAL_MAPUPDATE, sConfigMgr->GetIntDefault("MapUpdateInterval", 100));
637 {
638 SF_LOG_ERROR("server.loading", "MapUpdateInterval (%i) must be greater %u. Use this minimal value.", getIntConfig(WorldIntConfigs::CONFIG_INTERVAL_MAPUPDATE), MIN_MAP_UPDATE_DELAY);
640 }
641 if (reload)
643
644 setIntConfig(WorldIntConfigs::CONFIG_INTERVAL_CHANGEWEATHER, sConfigMgr->GetIntDefault("ChangeWeatherInterval", 10 * MINUTE * IN_MILLISECONDS));
645
646 if (reload)
647 {
648 uint32 val = sConfigMgr->GetIntDefault("WorldServerPort", 8085);
650 SF_LOG_ERROR("server.loading", "WorldServerPort option can't be changed at worldserver.conf reload, using current value (%u).", getIntConfig(WorldIntConfigs::CONFIG_PORT_WORLD));
651 }
652 else
653 setIntConfig(WorldIntConfigs::CONFIG_PORT_WORLD, sConfigMgr->GetIntDefault("WorldServerPort", 8085));
654
655 setIntConfig(WorldIntConfigs::CONFIG_SOCKET_TIMEOUTTIME, sConfigMgr->GetIntDefault("SocketTimeOutTime", 900000));
656 setIntConfig(WorldIntConfigs::CONFIG_SESSION_ADD_DELAY, sConfigMgr->GetIntDefault("SessionAddDelay", 10000));
657
658 SetFloatConfig(WorldFloatConfigs::CONFIG_GROUP_XP_DISTANCE, sConfigMgr->GetFloatDefault("MaxGroupXPDistance", 74.0f));
659 SetFloatConfig(WorldFloatConfigs::CONFIG_MAX_RECRUIT_A_FRIEND_DISTANCE, sConfigMgr->GetFloatDefault("MaxRecruitAFriendBonusDistance", 100.0f));
660 SetFloatConfig(WorldFloatConfigs::CONFIG_LOOT_AOE_RADIUS, sConfigMgr->GetFloatDefault("Loot.AoERadius", 30.0f));
661
663 SetFloatConfig(WorldFloatConfigs::CONFIG_SIGHT_MONSTER, sConfigMgr->GetFloatDefault("MonsterSight", 50));
664 SetFloatConfig(WorldFloatConfigs::CONFIG_SIGHT_GUARDER, sConfigMgr->GetFloatDefault("GuarderSight", 50));
665
666 if (reload)
667 {
668 uint32 val = sConfigMgr->GetIntDefault("GameType", 0);
670 SF_LOG_ERROR("server.loading", "GameType option can't be changed at worldserver.conf reload, using current value (%u).", getIntConfig(WorldIntConfigs::CONFIG_GAME_TYPE));
671 }
672 else
673 setIntConfig(WorldIntConfigs::CONFIG_GAME_TYPE, sConfigMgr->GetIntDefault("GameType", 0));
674
675 if (reload)
676 {
677 uint32 val = sConfigMgr->GetIntDefault("RealmZone", REALM_ZONE_DEVELOPMENT);
679 SF_LOG_ERROR("server.loading", "RealmZone option can't be changed at worldserver.conf reload, using current value (%u).", getIntConfig(WorldIntConfigs::CONFIG_REALM_ZONE));
680 }
681 else
683
684 SetBoolConfig(WorldBoolConfigs::CONFIG_ALLOW_TWO_SIDE_INTERACTION_CALENDAR, sConfigMgr->GetBoolDefault("AllowTwoSide.Interaction.Calendar", false));
685 SetBoolConfig(WorldBoolConfigs::CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL, sConfigMgr->GetBoolDefault("AllowTwoSide.Interaction.Channel", false));
686 SetBoolConfig(WorldBoolConfigs::CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP, sConfigMgr->GetBoolDefault("AllowTwoSide.Interaction.Group", false));
687 SetBoolConfig(WorldBoolConfigs::CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD, sConfigMgr->GetBoolDefault("AllowTwoSide.Interaction.Guild", false));
688 SetBoolConfig(WorldBoolConfigs::CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION, sConfigMgr->GetBoolDefault("AllowTwoSide.Interaction.Auction", false));
689 SetBoolConfig(WorldBoolConfigs::CONFIG_ALLOW_TWO_SIDE_TRADE, sConfigMgr->GetBoolDefault("AllowTwoSide.Trade", false));
690 setIntConfig(WorldIntConfigs::CONFIG_STRICT_PLAYER_NAMES, sConfigMgr->GetIntDefault("StrictPlayerNames", 0));
691 setIntConfig(WorldIntConfigs::CONFIG_STRICT_CHARTER_NAMES, sConfigMgr->GetIntDefault("StrictCharterNames", 0));
692 setIntConfig(WorldIntConfigs::CONFIG_STRICT_PET_NAMES, sConfigMgr->GetIntDefault("StrictPetNames", 0));
693
694 setIntConfig(WorldIntConfigs::CONFIG_MIN_PLAYER_NAME, sConfigMgr->GetIntDefault("MinPlayerName", 2));
696 {
697 SF_LOG_ERROR("server.loading", "MinPlayerName (%i) must be in range 1..%u. Set to 2.", getIntConfig(WorldIntConfigs::CONFIG_MIN_PLAYER_NAME), MAX_PLAYER_NAME);
699 }
700
701 setIntConfig(WorldIntConfigs::CONFIG_MIN_CHARTER_NAME, sConfigMgr->GetIntDefault("MinCharterName", 2));
703 {
704 SF_LOG_ERROR("server.loading", "MinCharterName (%i) must be in range 1..%u. Set to 2.", getIntConfig(WorldIntConfigs::CONFIG_MIN_CHARTER_NAME), MAX_CHARTER_NAME);
706 }
707
708 setIntConfig(WorldIntConfigs::CONFIG_MIN_PET_NAME, sConfigMgr->GetIntDefault("MinPetName", 2));
710 {
711 SF_LOG_ERROR("server.loading", "MinPetName (%i) must be in range 1..%u. Set to 2.", getIntConfig(WorldIntConfigs::CONFIG_MIN_PET_NAME), MAX_PET_NAME);
713 }
714
715 setIntConfig(WorldIntConfigs::CONFIG_CHARACTER_CREATING_DISABLED, sConfigMgr->GetIntDefault("CharacterCreating.Disabled", 0));
716 setIntConfig(WorldIntConfigs::CONFIG_CHARACTER_CREATING_DISABLED_RACEMASK, sConfigMgr->GetIntDefault("CharacterCreating.Disabled.RaceMask", 0));
717 setIntConfig(WorldIntConfigs::CONFIG_CHARACTER_CREATING_DISABLED_CLASSMASK, sConfigMgr->GetIntDefault("CharacterCreating.Disabled.ClassMask", 0));
718
719 setIntConfig(WorldIntConfigs::CONFIG_CHARACTERS_PER_REALM, sConfigMgr->GetIntDefault("CharactersPerRealm", 11));
721 {
722 SF_LOG_ERROR("server.loading", "CharactersPerRealm (%i) must be in range 1..11. Set to 11.", getIntConfig(WorldIntConfigs::CONFIG_CHARACTERS_PER_REALM));
724 }
725
726 // must be after CONFIG_CHARACTERS_PER_REALM
727 setIntConfig(WorldIntConfigs::CONFIG_CHARACTERS_PER_ACCOUNT, sConfigMgr->GetIntDefault("CharactersPerAccount", 50));
729 {
730 SF_LOG_ERROR("server.loading", "CharactersPerAccount (%i) can't be less than CharactersPerRealm (%i).", getIntConfig(WorldIntConfigs::CONFIG_CHARACTERS_PER_ACCOUNT), getIntConfig(WorldIntConfigs::CONFIG_CHARACTERS_PER_REALM));
732 }
733
734 setIntConfig(WorldIntConfigs::CONFIG_HEROIC_CHARACTERS_PER_REALM, sConfigMgr->GetIntDefault("HeroicCharactersPerRealm", 1));
736 {
737 SF_LOG_ERROR("server.loading", "HeroicCharactersPerRealm (%i) must be in range 0..10. Set to 1.", getIntConfig(WorldIntConfigs::CONFIG_HEROIC_CHARACTERS_PER_REALM));
739 }
740
741 setIntConfig(WorldIntConfigs::CONFIG_CHARACTER_CREATING_MIN_LEVEL_FOR_HEROIC_CHARACTER, sConfigMgr->GetIntDefault("CharacterCreating.MinLevelForHeroicCharacter", 55));
742
743 setIntConfig(WorldIntConfigs::CONFIG_SKIP_CINEMATICS, sConfigMgr->GetIntDefault("SkipCinematics", 0));
745 {
746 SF_LOG_ERROR("server.loading", "SkipCinematics (%i) must be in range 0..2. Set to 0.", getIntConfig(WorldIntConfigs::CONFIG_SKIP_CINEMATICS));
748 }
749
750 if (reload)
751 {
752 uint32 val = sConfigMgr->GetIntDefault("MaxPlayerLevel", DEFAULT_MAX_LEVEL);
754 SF_LOG_ERROR("server.loading", "MaxPlayerLevel option can't be changed at config reload, using current value (%u).", getIntConfig(WorldIntConfigs::CONFIG_MAX_PLAYER_LEVEL));
755 }
756 else
758
760 {
761 SF_LOG_ERROR("server.loading", "MaxPlayerLevel (%i) must be in range 1..%u. Set to %u.", getIntConfig(WorldIntConfigs::CONFIG_MAX_PLAYER_LEVEL), MAX_LEVEL, MAX_LEVEL);
763 }
764
765 setIntConfig(WorldIntConfigs::CONFIG_MIN_DUALSPEC_LEVEL, sConfigMgr->GetIntDefault("MinDualSpecLevel", 30));
766
767 setIntConfig(WorldIntConfigs::CONFIG_START_PLAYER_LEVEL, sConfigMgr->GetIntDefault("StartPlayerLevel", 1));
769 {
770 SF_LOG_ERROR("server.loading", "StartPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to 1.", getIntConfig(WorldIntConfigs::CONFIG_START_PLAYER_LEVEL), getIntConfig(WorldIntConfigs::CONFIG_MAX_PLAYER_LEVEL));
772 }
774 {
777 }
778
779 setIntConfig(WorldIntConfigs::CONFIG_START_HEROIC_PLAYER_LEVEL, sConfigMgr->GetIntDefault("StartHeroicPlayerLevel", 55));
781 {
782 SF_LOG_ERROR("server.loading", "StartHeroicPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to 55.",
785 }
787 {
788 SF_LOG_ERROR("server.loading", "StartHeroicPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to %u.",
791 }
792
793 setIntConfig(WorldIntConfigs::CONFIG_START_PETBAR_LEVEL, sConfigMgr->GetIntDefault("StartPetbarLevel", 10));
794
795 setIntConfig(WorldIntConfigs::CONFIG_START_PLAYER_MONEY, sConfigMgr->GetIntDefault("StartPlayerMoney", 0));
797 {
798 SF_LOG_ERROR("server.loading", "StartPlayerMoney (%i) must be in range 0.." UI64FMTD ". Set to %u.", getIntConfig(WorldIntConfigs::CONFIG_START_PLAYER_MONEY), uint64(MAX_MONEY_AMOUNT), 0);
800 }
801 else if (getIntConfig(WorldIntConfigs::CONFIG_START_PLAYER_MONEY) > 0x7FFFFFFF - 1) // TODO: (See MAX_MONEY_AMOUNT)
802 {
803 SF_LOG_ERROR("server.loading", "StartPlayerMoney (%i) must be in range 0..%u. Set to %u.",
804 getIntConfig(WorldIntConfigs::CONFIG_START_PLAYER_MONEY), 0x7FFFFFFF - 1, 0x7FFFFFFF - 1);
806 }
807
808 setIntConfig(WorldIntConfigs::CONFIG_CURRENCY_RESET_HOUR, sConfigMgr->GetIntDefault("Currency.ResetHour", 3));
810 {
811 SF_LOG_ERROR("server.loading", "Currency.ResetHour (%i) can't be load. Set to 6.", getIntConfig(WorldIntConfigs::CONFIG_CURRENCY_RESET_HOUR));
813 }
814 setIntConfig(WorldIntConfigs::CONFIG_CURRENCY_RESET_DAY, sConfigMgr->GetIntDefault("Currency.ResetWeekDay", 3));
816 {
817 SF_LOG_ERROR("server.loading", "Currency.ResetWeekDay (%i) can't be load. Set to 3.", getIntConfig(WorldIntConfigs::CONFIG_CURRENCY_RESET_DAY));
819 }
820 setIntConfig(WorldIntConfigs::CONFIG_CURRENCY_RESET_INTERVAL, sConfigMgr->GetIntDefault("Currency.ResetInterval", 7));
822 {
823 SF_LOG_ERROR("server.loading", "Currency.ResetInterval (%i) must be > 0, set to default 7.", getIntConfig(WorldIntConfigs::CONFIG_CURRENCY_RESET_INTERVAL));
825 }
826
827 setIntConfig(WorldIntConfigs::CONFIG_CURRENCY_START_HONOR_POINTS, sConfigMgr->GetIntDefault("Currency.StartHonorPoints", 0));
829 {
830 SF_LOG_ERROR("server.loading", "Currency.StartHonorPoints (%i) must be >= 0, set to default 0.", getIntConfig(WorldIntConfigs::CONFIG_CURRENCY_START_HONOR_POINTS));
832 }
833 setIntConfig(WorldIntConfigs::CONFIG_CURRENCY_MAX_HONOR_POINTS, sConfigMgr->GetIntDefault("Currency.MaxHonorPoints", 4000));
835 {
836 SF_LOG_ERROR("server.loading", "Currency.MaxHonorPoints (%i) can't be negative. Set to default 4000.", getIntConfig(WorldIntConfigs::CONFIG_CURRENCY_MAX_HONOR_POINTS));
838 }
839 //...
840 //setIntConfig(WorldIntConfigs::CONFIG_CURRENCY_MAX_HONOR_POINTS] *= 100; //precision mod
841
842 setIntConfig(WorldIntConfigs::CONFIG_CURRENCY_START_JUSTICE_POINTS, sConfigMgr->GetIntDefault("Currency.StartJusticePoints", 0));
844 {
845 SF_LOG_ERROR("server.loading", "Currency.StartJusticePoints (%i) must be >= 0, set to default 0.", getIntConfig(WorldIntConfigs::CONFIG_CURRENCY_START_JUSTICE_POINTS));
847 }
848 setIntConfig(WorldIntConfigs::CONFIG_CURRENCY_MAX_JUSTICE_POINTS, sConfigMgr->GetIntDefault("Currency.MaxJusticePoints", 4000));
850 {
851 SF_LOG_ERROR("server.loading", "Currency.MaxJusticePoints (%i) can't be negative. Set to default 4000.", getIntConfig(WorldIntConfigs::CONFIG_CURRENCY_MAX_JUSTICE_POINTS));
853 }
854 //...
855 //setIntConfig(WorldIntConfigs::CONFIG_CURRENCY_MAX_JUSTICE_POINTS] *= 100; //precision mod
856
857 setIntConfig(WorldIntConfigs::CONFIG_CURRENCY_START_CONQUEST_POINTS, sConfigMgr->GetIntDefault("Currency.StartConquestPoints", 0));
859 {
860 SF_LOG_ERROR("server.loading", "Currency.StartConquestPoints (%i) must be >= 0, set to default 0.", getIntConfig(WorldIntConfigs::CONFIG_CURRENCY_START_CONQUEST_POINTS));
862 }
863
864 setIntConfig(WorldIntConfigs::CONFIG_CURRENCY_CONQUEST_POINTS_ARENA_REWARD, sConfigMgr->GetIntDefault("Currency.ConquestPointsArenaReward", 180));
866 {
867 SF_LOG_ERROR("server.loading", "Currency.ConquestPointsArenaReward (%i) must be > 0, set to default 180.", getIntConfig(WorldIntConfigs::CONFIG_CURRENCY_CONQUEST_POINTS_ARENA_REWARD));
869 }
870 //[WorldIntConfigs::CONFIG_CURRENCY_CONQUEST_POINTS_ARENA_REWARD] *= 100; //precision mod
871
874 {
875 SF_LOG_ERROR("server.loading", "RecruitAFriend.MaxLevel (%i) must be in the range 0..MaxLevel(%u). Set to %u.",
878 }
879
881 SetBoolConfig(WorldBoolConfigs::CONFIG_ALL_TAXI_PATHS, sConfigMgr->GetBoolDefault("AllFlightPaths", false));
882 SetBoolConfig(WorldBoolConfigs::CONFIG_INSTANT_TAXI, sConfigMgr->GetBoolDefault("InstantFlightPaths", false));
883
884 SetBoolConfig(WorldBoolConfigs::CONFIG_INSTANCE_IGNORE_LEVEL, sConfigMgr->GetBoolDefault("Instance.IgnoreLevel", false));
885 SetBoolConfig(WorldBoolConfigs::CONFIG_INSTANCE_IGNORE_RAID, sConfigMgr->GetBoolDefault("Instance.IgnoreRaid", false));
886
887 SetBoolConfig(WorldBoolConfigs::CONFIG_CAST_UNSTUCK, sConfigMgr->GetBoolDefault("CastUnstuck", true));
888 setIntConfig(WorldIntConfigs::CONFIG_INSTANCE_RESET_TIME_HOUR, sConfigMgr->GetIntDefault("Instance.ResetTimeHour", 4));
889 setIntConfig(WorldIntConfigs::CONFIG_INSTANCE_UNLOAD_DELAY, sConfigMgr->GetIntDefault("Instance.UnloadDelay", 30 * MINUTE * IN_MILLISECONDS));
890
891 setIntConfig(WorldIntConfigs::CONFIG_MAX_PRIMARY_TRADE_SKILL, sConfigMgr->GetIntDefault("MaxPrimaryTradeSkill", 2));
892 setIntConfig(WorldIntConfigs::CONFIG_MIN_PETITION_SIGNS, sConfigMgr->GetIntDefault("MinPetitionSigns", 9));
894 {
895 SF_LOG_ERROR("server.loading", "MinPetitionSigns (%i) must be in range 0..9. Set to 9.", getIntConfig(WorldIntConfigs::CONFIG_MIN_PETITION_SIGNS));
897 }
898
899 setIntConfig(WorldIntConfigs::CONFIG_GM_LOGIN_STATE, sConfigMgr->GetIntDefault("GM.LoginState", 2));
900 setIntConfig(WorldIntConfigs::CONFIG_GM_VISIBLE_STATE, sConfigMgr->GetIntDefault("GM.Visible", 2));
901 setIntConfig(WorldIntConfigs::CONFIG_GM_CHAT, sConfigMgr->GetIntDefault("GM.Chat", 2));
902 setIntConfig(WorldIntConfigs::CONFIG_GM_WHISPERING_TO, sConfigMgr->GetIntDefault("GM.WhisperingTo", 2));
903
906 setIntConfig(WorldIntConfigs::CONFIG_START_GM_LEVEL, sConfigMgr->GetIntDefault("GM.StartLevel", 1));
908 {
909 SF_LOG_ERROR("server.loading", "GM.StartLevel (%i) must be in range StartPlayerLevel(%u)..%u. Set to %u.",
912 }
914 {
915 SF_LOG_ERROR("server.loading", "GM.StartLevel (%i) must be in range 1..%u. Set to %u.", getIntConfig(WorldIntConfigs::CONFIG_START_GM_LEVEL), MAX_LEVEL, MAX_LEVEL);
917 }
918 SetBoolConfig(WorldBoolConfigs::CONFIG_ALLOW_GM_GROUP, sConfigMgr->GetBoolDefault("GM.AllowInvite", false));
919 SetBoolConfig(WorldBoolConfigs::CONFIG_GM_LOWER_SECURITY, sConfigMgr->GetBoolDefault("GM.LowerSecurity", false));
920 SetFloatConfig(WorldFloatConfigs::CONFIG_CHANCE_OF_GM_SURVEY, sConfigMgr->GetFloatDefault("GM.TicketSystem.ChanceOfGMSurvey", 50.0f));
921
922 setIntConfig(WorldIntConfigs::CONFIG_GROUP_VISIBILITY, sConfigMgr->GetIntDefault("Visibility.GroupMode", 1));
923
924 setIntConfig(WorldIntConfigs::CONFIG_MAIL_DELIVERY_DELAY, sConfigMgr->GetIntDefault("MailDeliveryDelay", HOUR));
925
926 setIntConfig(WorldIntConfigs::CONFIG_UPTIME_UPDATE, sConfigMgr->GetIntDefault("UpdateUptimeInterval", 10));
928 {
929 SF_LOG_ERROR("server.loading", "UpdateUptimeInterval (%i) must be > 0, set to default 10.", getIntConfig(WorldIntConfigs::CONFIG_UPTIME_UPDATE));
931 }
932 if (reload)
933 {
935 m_timers[WUPDATE_UPTIME].Reset();
936 }
937
938 // log db cleanup interval
939 setIntConfig(WorldIntConfigs::CONFIG_LOGDB_CLEARINTERVAL, sConfigMgr->GetIntDefault("LogDB.Opt.ClearInterval", 10));
941 {
942 SF_LOG_ERROR("server.loading", "LogDB.Opt.ClearInterval (%i) must be > 0, set to default 10.", getIntConfig(WorldIntConfigs::CONFIG_LOGDB_CLEARINTERVAL));
944 }
945 if (reload)
946 {
948 m_timers[WUPDATE_CLEANDB].Reset();
949 }
950 setIntConfig(WorldIntConfigs::CONFIG_LOGDB_CLEARTIME, sConfigMgr->GetIntDefault("LogDB.Opt.ClearTime", 1209600)); // 14 days default
951 SF_LOG_INFO("server.loading", "Will clear `logs` table of entries older than %i seconds every %u minutes.",
953
954 setIntConfig(WorldIntConfigs::CONFIG_SKILL_CHANCE_ORANGE, sConfigMgr->GetIntDefault("SkillChance.Orange", 100));
955 setIntConfig(WorldIntConfigs::CONFIG_SKILL_CHANCE_YELLOW, sConfigMgr->GetIntDefault("SkillChance.Yellow", 75));
956 setIntConfig(WorldIntConfigs::CONFIG_SKILL_CHANCE_GREEN, sConfigMgr->GetIntDefault("SkillChance.Green", 25));
957 setIntConfig(WorldIntConfigs::CONFIG_SKILL_CHANCE_GREY, sConfigMgr->GetIntDefault("SkillChance.Grey", 0));
958
959 setIntConfig(WorldIntConfigs::CONFIG_SKILL_CHANCE_MINING_STEPS, sConfigMgr->GetIntDefault("SkillChance.MiningSteps", 75));
960 setIntConfig(WorldIntConfigs::CONFIG_SKILL_CHANCE_SKINNING_STEPS, sConfigMgr->GetIntDefault("SkillChance.SkinningSteps", 75));
961
962 SetBoolConfig(WorldBoolConfigs::CONFIG_SKILL_PROSPECTING, sConfigMgr->GetBoolDefault("SkillChance.Prospecting", false));
963 SetBoolConfig(WorldBoolConfigs::CONFIG_SKILL_MILLING, sConfigMgr->GetBoolDefault("SkillChance.Milling", false));
964
965 setIntConfig(WorldIntConfigs::CONFIG_SKILL_GAIN_CRAFTING, sConfigMgr->GetIntDefault("SkillGain.Crafting", 1));
966
967 setIntConfig(WorldIntConfigs::CONFIG_SKILL_GAIN_GATHERING, sConfigMgr->GetIntDefault("SkillGain.Gathering", 1));
968
969 setIntConfig(WorldIntConfigs::CONFIG_MAX_OVERSPEED_PINGS, sConfigMgr->GetIntDefault("MaxOverspeedPings", 2));
970
972 {
973 SF_LOG_ERROR("server.loading", "MaxOverspeedPings (%i) must be in range 2..infinity (or 0 to disable check). Set to 2.", getIntConfig(WorldIntConfigs::CONFIG_MAX_OVERSPEED_PINGS));
975 }
976
977 SetBoolConfig(WorldBoolConfigs::CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY, sConfigMgr->GetBoolDefault("SaveRespawnTimeImmediately", true));
978 SetBoolConfig(WorldBoolConfigs::CONFIG_WEATHER, sConfigMgr->GetBoolDefault("ActivateWeather", true));
979
981
982 if (reload)
983 {
984 uint32 val = sConfigMgr->GetIntDefault("Expansion", 1);
986 SF_LOG_ERROR("server.loading", "Expansion option can't be changed at worldserver.conf reload, using current value (%u).", getIntConfig(WorldIntConfigs::CONFIG_EXPANSION));
987 }
988 else
989 setIntConfig(WorldIntConfigs::CONFIG_EXPANSION, sConfigMgr->GetIntDefault("Expansion", 1));
990
991 setIntConfig(WorldIntConfigs::CONFIG_CHATFLOOD_MESSAGE_COUNT, sConfigMgr->GetIntDefault("ChatFlood.MessageCount", 10));
992 setIntConfig(WorldIntConfigs::CONFIG_CHATFLOOD_MESSAGE_DELAY, sConfigMgr->GetIntDefault("ChatFlood.MessageDelay", 1));
993 setIntConfig(WorldIntConfigs::CONFIG_CHATFLOOD_MUTE_TIME, sConfigMgr->GetIntDefault("ChatFlood.MuteTime", 10));
994
995 SetBoolConfig(WorldBoolConfigs::CONFIG_EVENT_ANNOUNCE, sConfigMgr->GetIntDefault("Event.Announce", false));
996
997 SetFloatConfig(WorldFloatConfigs::CONFIG_CREATURE_FAMILY_FLEE_ASSISTANCE_RADIUS, sConfigMgr->GetFloatDefault("CreatureFamilyFleeAssistanceRadius", 30.0f));
998 SetFloatConfig(WorldFloatConfigs::CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS, sConfigMgr->GetFloatDefault("CreatureFamilyAssistanceRadius", 10.0f));
999 setIntConfig(WorldIntConfigs::CONFIG_CREATURE_FAMILY_ASSISTANCE_DELAY, sConfigMgr->GetIntDefault("CreatureFamilyAssistanceDelay", 1500));
1000 setIntConfig(WorldIntConfigs::CONFIG_CREATURE_FAMILY_FLEE_DELAY, sConfigMgr->GetIntDefault("CreatureFamilyFleeDelay", 7000));
1001
1002 setIntConfig(WorldIntConfigs::CONFIG_WORLD_BOSS_LEVEL_DIFF, sConfigMgr->GetIntDefault("WorldBossLevelDiff", 3));
1003
1004 // note: disable value (-1) will assigned as 0xFFFFFFF, to prevent overflow at calculations limit it to max possible player level MAX_LEVEL(100)
1005 setIntConfig(WorldIntConfigs::CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF, sConfigMgr->GetIntDefault("Quests.LowLevelHideDiff", 4));
1008 setIntConfig(WorldIntConfigs::CONFIG_QUEST_HIGH_LEVEL_HIDE_DIFF, sConfigMgr->GetIntDefault("Quests.HighLevelHideDiff", 7));
1011 SetBoolConfig(WorldBoolConfigs::CONFIG_QUEST_IGNORE_RAID, sConfigMgr->GetBoolDefault("Quests.IgnoreRaid", false));
1012 SetBoolConfig(WorldBoolConfigs::CONFIG_QUEST_IGNORE_AUTO_ACCEPT, sConfigMgr->GetBoolDefault("Quests.IgnoreAutoAccept", false));
1013 SetBoolConfig(WorldBoolConfigs::CONFIG_QUEST_IGNORE_AUTO_COMPLETE, sConfigMgr->GetBoolDefault("Quests.IgnoreAutoComplete", false));
1014
1015 setIntConfig(WorldIntConfigs::CONFIG_RANDOM_BG_RESET_HOUR, sConfigMgr->GetIntDefault("Battleground.Random.ResetHour", 6));
1017 {
1018 SF_LOG_ERROR("server.loading", "Battleground.Random.ResetHour (%i) can't be load. Set to 6.", getIntConfig(WorldIntConfigs::CONFIG_RANDOM_BG_RESET_HOUR));
1020 }
1021
1022 setIntConfig(WorldIntConfigs::CONFIG_GUILD_RESET_HOUR, sConfigMgr->GetIntDefault("Guild.ResetHour", 6));
1024 {
1025 SF_LOG_ERROR("misc", "Guild.ResetHour (%i) can't be load. Set to 6.", getIntConfig(WorldIntConfigs::CONFIG_GUILD_RESET_HOUR));
1027 }
1028
1029 SetBoolConfig(WorldBoolConfigs::CONFIG_DETECT_POS_COLLISION, sConfigMgr->GetBoolDefault("DetectPosCollision", true));
1030
1031 SetBoolConfig(WorldBoolConfigs::CONFIG_RESTRICTED_LFG_CHANNEL, sConfigMgr->GetBoolDefault("Channel.RestrictedLfg", true));
1032 SetBoolConfig(WorldBoolConfigs::CONFIG_TALENTS_INSPECTING, sConfigMgr->GetBoolDefault("TalentsInspecting", true));
1033 SetBoolConfig(WorldBoolConfigs::CONFIG_CHAT_FAKE_MESSAGE_PREVENTING, sConfigMgr->GetBoolDefault("ChatFakeMessagePreventing", false));
1034 setIntConfig(WorldIntConfigs::CONFIG_CHAT_STRICT_LINK_CHECKING_SEVERITY, sConfigMgr->GetIntDefault("ChatStrictLinkChecking.Severity", 0));
1035 setIntConfig(WorldIntConfigs::CONFIG_CHAT_STRICT_LINK_CHECKING_KICK, sConfigMgr->GetIntDefault("ChatStrictLinkChecking.Kick", 0));
1036
1037 setIntConfig(WorldIntConfigs::CONFIG_CORPSE_DECAY_NORMAL, sConfigMgr->GetIntDefault("Corpse.Decay.NORMAL", 60));
1038 setIntConfig(WorldIntConfigs::CONFIG_CORPSE_DECAY_RARE, sConfigMgr->GetIntDefault("Corpse.Decay.RARE", 300));
1039 setIntConfig(WorldIntConfigs::CONFIG_CORPSE_DECAY_ELITE, sConfigMgr->GetIntDefault("Corpse.Decay.ELITE", 300));
1040 setIntConfig(WorldIntConfigs::CONFIG_CORPSE_DECAY_RAREELITE, sConfigMgr->GetIntDefault("Corpse.Decay.RAREELITE", 300));
1041 setIntConfig(WorldIntConfigs::CONFIG_CORPSE_DECAY_WORLDBOSS, sConfigMgr->GetIntDefault("Corpse.Decay.WORLDBOSS", 3600));
1042
1043 setIntConfig(WorldIntConfigs::CONFIG_DEATH_SICKNESS_LEVEL, sConfigMgr->GetIntDefault("Death.SicknessLevel", 11));
1044 SetBoolConfig(WorldBoolConfigs::CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP, sConfigMgr->GetBoolDefault("Death.CorpseReclaimDelay.PvP", true));
1045 SetBoolConfig(WorldBoolConfigs::CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE, sConfigMgr->GetBoolDefault("Death.CorpseReclaimDelay.PvE", true));
1046 SetBoolConfig(WorldBoolConfigs::CONFIG_DEATH_BONES_WORLD, sConfigMgr->GetBoolDefault("Death.Bones.World", true));
1047 SetBoolConfig(WorldBoolConfigs::CONFIG_DEATH_BONES_BG_OR_ARENA, sConfigMgr->GetBoolDefault("Death.Bones.BattlegroundOrArena", true));
1048
1049 SetBoolConfig(WorldBoolConfigs::CONFIG_DIE_COMMAND_MODE, sConfigMgr->GetBoolDefault("Die.Command.Mode", true));
1050
1051 SetFloatConfig(WorldFloatConfigs::CONFIG_THREAT_RADIUS, sConfigMgr->GetFloatDefault("ThreatRadius", 60.0f));
1052
1053 // always use declined names in the russian client
1055
1056 (getIntConfig(WorldIntConfigs::CONFIG_REALM_ZONE) == REALM_ZONE_RUSSIAN) ? true : sConfigMgr->GetBoolDefault("DeclinedNames", false));
1057
1058 SetFloatConfig(WorldFloatConfigs::CONFIG_LISTEN_RANGE_SAY, sConfigMgr->GetFloatDefault("ListenRange.Say", 25.0f));
1059 SetFloatConfig(WorldFloatConfigs::CONFIG_LISTEN_RANGE_TEXTEMOTE, sConfigMgr->GetFloatDefault("ListenRange.TextEmote", 25.0f));
1060 SetFloatConfig(WorldFloatConfigs::CONFIG_LISTEN_RANGE_YELL, sConfigMgr->GetFloatDefault("ListenRange.Yell", 300.0f));
1061
1062 SetBoolConfig(WorldBoolConfigs::CONFIG_BATTLEGROUND_CAST_DESERTER, sConfigMgr->GetBoolDefault("Battleground.CastDeserter", true));
1063 SetBoolConfig(WorldBoolConfigs::CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE, sConfigMgr->GetBoolDefault("Battleground.QueueAnnouncer.Enable", false));
1064 SetBoolConfig(WorldBoolConfigs::CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY, sConfigMgr->GetBoolDefault("Battleground.QueueAnnouncer.PlayerOnly", false));
1065 setIntConfig(WorldIntConfigs::CONFIG_BATTLEGROUND_INVITATION_TYPE, sConfigMgr->GetIntDefault("Battleground.InvitationType", 0));
1066 setIntConfig(WorldIntConfigs::CONFIG_BATTLEGROUND_PREMATURE_FINISH_TIMER, sConfigMgr->GetIntDefault("Battleground.PrematureFinishTimer", 5 * MINUTE * IN_MILLISECONDS));
1067 setIntConfig(WorldIntConfigs::CONFIG_BATTLEGROUND_PREMADE_GROUP_WAIT_FOR_MATCH, sConfigMgr->GetIntDefault("Battleground.PremadeGroupWaitForMatch", 30 * MINUTE * IN_MILLISECONDS));
1068 SetBoolConfig(WorldBoolConfigs::CONFIG_BG_XP_FOR_KILL, sConfigMgr->GetBoolDefault("Battleground.GiveXPForKills", false));
1069 setIntConfig(WorldIntConfigs::CONFIG_ARENA_MAX_RATING_DIFFERENCE, sConfigMgr->GetIntDefault("Arena.MaxRatingDifference", 150));
1070 setIntConfig(WorldIntConfigs::CONFIG_ARENA_RATING_DISCARD_TIMER, sConfigMgr->GetIntDefault("Arena.RatingDiscardTimer", 10 * MINUTE * IN_MILLISECONDS));
1071 setIntConfig(WorldIntConfigs::CONFIG_ARENA_RATED_UPDATE_TIMER, sConfigMgr->GetIntDefault("Arena.RatedUpdateTimer", 5 * IN_MILLISECONDS));
1072 SetBoolConfig(WorldBoolConfigs::CONFIG_ARENA_QUEUE_ANNOUNCER_ENABLE, sConfigMgr->GetBoolDefault("Arena.QueueAnnouncer.Enable", false));
1073 SetBoolConfig(WorldBoolConfigs::CONFIG_ARENA_QUEUE_ANNOUNCER_PLAYERONLY, sConfigMgr->GetBoolDefault("Arena.QueueAnnouncer.PlayerOnly", false));
1074 setIntConfig(WorldIntConfigs::CONFIG_ARENA_SEASON_ID, sConfigMgr->GetIntDefault("Arena.ArenaSeason.ID", 1));
1075 setIntConfig(WorldIntConfigs::CONFIG_ARENA_START_RATING, sConfigMgr->GetIntDefault("Arena.ArenaStartRating", 0));
1076 setIntConfig(WorldIntConfigs::CONFIG_ARENA_START_PERSONAL_RATING, sConfigMgr->GetIntDefault("Arena.ArenaStartPersonalRating", 1000));
1077 setIntConfig(WorldIntConfigs::CONFIG_ARENA_START_MATCHMAKER_RATING, sConfigMgr->GetIntDefault("Arena.ArenaStartMatchmakerRating", 1500));
1078 SetBoolConfig(WorldBoolConfigs::CONFIG_ARENA_SEASON_IN_PROGRESS, sConfigMgr->GetBoolDefault("Arena.ArenaSeason.InProgress", true));
1079 SetBoolConfig(WorldBoolConfigs::CONFIG_ARENA_LOG_EXTENDED_INFO, sConfigMgr->GetBoolDefault("ArenaLog.ExtendedInfo", false));
1080
1081 SetBoolConfig(WorldBoolConfigs::CONFIG_OFFHAND_CHECK_AT_SPELL_UNLEARN, sConfigMgr->GetBoolDefault("OffhandCheckAtSpellUnlearn", true));
1082
1083 if (int32 clientCacheId = sConfigMgr->GetIntDefault("ClientCacheVersion", 0))
1084 {
1085 // overwrite DB/old value
1086 if (clientCacheId > 0)
1087 {
1089 SF_LOG_INFO("server.loading", "Client cache version set to: %u", clientCacheId);
1090 }
1091 else
1092 SF_LOG_ERROR("server.loading", "ClientCacheVersion can't be negative %d, ignored.", clientCacheId);
1093 }
1094
1104
1105 // battle pet
1106 setIntConfig(WorldIntConfigs::CONFIG_BATTLE_PET_LOADOUT_UNLOCK_COUNT, sConfigMgr->GetIntDefault("BattlePet.LoadoutUnlockCount", 1));
1108 {
1109 SF_LOG_ERROR("server.loading", "BattlePet.LoadoutUnlockCount (%i) can't be loaded. Set to 1.", getIntConfig(WorldIntConfigs::CONFIG_BATTLE_PET_LOADOUT_UNLOCK_COUNT));
1111 }
1112
1113 setIntConfig(WorldIntConfigs::CONFIG_BATTLE_PET_INITIAL_LEVEL, sConfigMgr->GetIntDefault("BattlePet.InitialLevel", 1));
1115 {
1116 SF_LOG_ERROR("server.loading", "BattlePet.InitialLevel (%i) can't be loaded. Set to 1.", getIntConfig(WorldIntConfigs::CONFIG_BATTLE_PET_INITIAL_LEVEL));
1118 }
1119
1120 setIntConfig(WorldIntConfigs::CONFIG_BATTLE_PET_WILD_SPAWN_MIN_COUNT, sConfigMgr->GetIntDefault("BattlePet.WildSpawnMinCount", 5));
1122 {
1123 SF_LOG_ERROR("server.loading", "BattlePet.WildSpawnMinCount (%i) can't be loaded. Set to 5.", getIntConfig(WorldIntConfigs::CONFIG_BATTLE_PET_WILD_SPAWN_MIN_COUNT));
1125 }
1126
1127 // blackmarket
1128 SetBoolConfig(WorldBoolConfigs::CONFIG_BLACK_MARKET_OPEN, sConfigMgr->GetBoolDefault("BlackMarket.Open", false));
1129 setIntConfig(WorldIntConfigs::CONFIG_BLACK_MARKET_MAX_AUCTIONS, sConfigMgr->GetIntDefault("BlackMarket.MaxAuctions", 12));
1130 // LOGIC ?
1131 //if (setIntConfig(WorldIntConfigs::CONFIG_BLACK_MARKET_MAX_AUCTIONS] > WorldIntConfigs::CONFIG_BLACK_MARKET_MAX_AUCTIONS)
1132 // setIntConfig(WorldIntConfigs::CONFIG_BLACK_MARKET_MAX_AUCTIONS] = WorldIntConfigs::CONFIG_BLACK_MARKET_MAX_AUCTIONS;
1133
1134 setIntConfig(WorldIntConfigs::CONFIG_BLACK_MARKET_AUCTION_DELAY, sConfigMgr->GetIntDefault("BlackMarket.AuctionDelay", 12));
1135 // LOGIC ?
1136 //if (m_int_configs(WorldIntConfigs::CONFIG_BLACK_MARKET_AUCTION_DELAY) > (WorldIntConfigs::CONFIG_BLACK_MARKET_AUCTION_DELAY)
1137 // setIntConfig(WorldIntConfigs::CONFIG_BLACK_MARKET_AUCTION_DELAY] = WorldIntConfigs::CONFIG_BLACK_MARKET_AUCTION_DELAY;
1138
1139 setIntConfig(WorldIntConfigs::CONFIG_BLACK_MARKET_AUCTION_DELAY_MOD, sConfigMgr->GetIntDefault("BlackMarket.AuctionDelayMod", 12));
1140
1141 // LOGIC ?
1142 //if (m_int_configs(WorldIntConfigs::CONFIG_BLACK_MARKET_AUCTION_DELAY_MOD) > WorldIntConfigs::CONFIG_BLACK_MARKET_AUCTION_DELAY_MOD)
1143 // setIntConfig(WorldIntConfigs::CONFIG_BLACK_MARKET_AUCTION_DELAY_MOD] = WorldIntConfigs::CONFIG_BLACK_MARKET_AUCTION_DELAY_MOD;
1144
1145 // character boost
1146 SetBoolConfig(WorldBoolConfigs::CONFIG_BOOST_NEW_ACCOUNT, sConfigMgr->GetBoolDefault("Boost.NewAccounts", false));
1147 setIntConfig(WorldIntConfigs::CONFIG_BOOST_START_MONEY, sConfigMgr->GetIntDefault("Boost.StartMoney", 1500000));
1148 setIntConfig(WorldIntConfigs::CONFIG_BOOST_START_LEVEL, sConfigMgr->GetIntDefault("Boost.StartLevel", 90));
1149
1150 //visibility on continents
1151 m_MaxVisibleDistanceOnContinents = sConfigMgr->GetFloatDefault("Visibility.Distance.Continents", DEFAULT_VISIBILITY_DISTANCE);
1153 {
1154 SF_LOG_ERROR("server.loading", "Visibility.Distance.Continents can't be less max aggro radius %f", 45 * sWorld->getRate(Rates::RATE_CREATURE_AGGRO));
1156 }
1158 {
1159 SF_LOG_ERROR("server.loading", "Visibility.Distance.Continents can't be greater %f", MAX_VISIBILITY_DISTANCE);
1161 }
1162
1163 //visibility in instances
1164 m_MaxVisibleDistanceInInstances = sConfigMgr->GetFloatDefault("Visibility.Distance.Instances", DEFAULT_VISIBILITY_INSTANCE);
1166 {
1167 SF_LOG_ERROR("server.loading", "Visibility.Distance.Instances can't be less max aggro radius %f", 45 * sWorld->getRate(Rates::RATE_CREATURE_AGGRO));
1169 }
1171 {
1172 SF_LOG_ERROR("server.loading", "Visibility.Distance.Instances can't be greater %f", MAX_VISIBILITY_DISTANCE);
1174 }
1175
1176 //visibility in BG/Arenas
1177 m_MaxVisibleDistanceInBGArenas = sConfigMgr->GetFloatDefault("Visibility.Distance.BGArenas", DEFAULT_VISIBILITY_BGARENAS);
1179 {
1180 SF_LOG_ERROR("server.loading", "Visibility.Distance.BGArenas can't be less max aggro radius %f", 45 * sWorld->getRate(Rates::RATE_CREATURE_AGGRO));
1182 }
1184 {
1185 SF_LOG_ERROR("server.loading", "Visibility.Distance.BGArenas can't be greater %f", MAX_VISIBILITY_DISTANCE);
1187 }
1188
1189 m_visibility_notify_periodOnContinents = sConfigMgr->GetIntDefault("Visibility.Notify.Period.OnContinents", DEFAULT_VISIBILITY_NOTIFY_PERIOD);
1190 m_visibility_notify_periodInInstances = sConfigMgr->GetIntDefault("Visibility.Notify.Period.InInstances", DEFAULT_VISIBILITY_NOTIFY_PERIOD);
1191 m_visibility_notify_periodInBGArenas = sConfigMgr->GetIntDefault("Visibility.Notify.Period.InBGArenas", DEFAULT_VISIBILITY_NOTIFY_PERIOD);
1192
1194 setIntConfig(WorldIntConfigs::CONFIG_CHARDELETE_METHOD, sConfigMgr->GetIntDefault("CharDelete.Method", 0));
1195 setIntConfig(WorldIntConfigs::CONFIG_CHARDELETE_MIN_LEVEL, sConfigMgr->GetIntDefault("CharDelete.MinLevel", 0));
1196 setIntConfig(WorldIntConfigs::CONFIG_CHARDELETE_HEROIC_MIN_LEVEL, sConfigMgr->GetIntDefault("CharDelete.Heroic.MinLevel", 0));
1197 setIntConfig(WorldIntConfigs::CONFIG_CHARDELETE_KEEP_DAYS, sConfigMgr->GetIntDefault("CharDelete.KeepDays", 30));
1198
1200 std::string dataPath = sConfigMgr->GetStringDefault("DataDir", "./");
1201 if (dataPath.empty() || (dataPath.at(dataPath.length() - 1) != '/' && dataPath.at(dataPath.length() - 1) != '\\'))
1202 dataPath.push_back('/');
1203
1204#if PLATFORM == PLATFORM_UNIX || PLATFORM == PLATFORM_APPLE
1205 if (dataPath[0] == '~')
1206 {
1207 const char* home = getenv("HOME");
1208 if (home)
1209 dataPath.replace(0, 1, home);
1210 }
1211#endif
1212
1213 if (reload)
1214 {
1215 if (dataPath != m_dataPath)
1216 SF_LOG_ERROR("server.loading", "DataDir option can't be changed at worldserver.conf reload, using current value (%s).", m_dataPath.c_str());
1217 }
1218 else
1219 {
1220 m_dataPath = dataPath;
1221 SF_LOG_INFO("server.loading", "Using DataDir %s", m_dataPath.c_str());
1222 }
1223
1224 SetBoolConfig(WorldBoolConfigs::CONFIG_ENABLE_MMAPS, sConfigMgr->GetBoolDefault("mmap.enablePathFinding", false));
1225 SF_LOG_INFO("server.loading", "WORLD: MMap data directory is: %smmaps", m_dataPath.c_str());
1226
1227 SetBoolConfig(WorldBoolConfigs::CONFIG_VMAP_INDOOR_CHECK, sConfigMgr->GetBoolDefault("vmap.enableIndoorCheck", 0));
1228 bool enableIndoor = sConfigMgr->GetBoolDefault("vmap.enableIndoorCheck", true);
1229 bool enableLOS = sConfigMgr->GetBoolDefault("vmap.enableLOS", true);
1230 bool enableHeight = sConfigMgr->GetBoolDefault("vmap.enableHeight", true);
1231
1232 if (!enableHeight)
1233 SF_LOG_ERROR("server.loading", "VMap height checking disabled! Creatures movements and other various things WILL be broken! Expect no support.");
1234
1237 SF_LOG_INFO("server.loading", "VMap support included. LineOfSight: %i, getHeight: %i, indoorCheck: %i", enableLOS, enableHeight, enableIndoor);
1238 SF_LOG_INFO("server.loading", "VMap data directory is: %svmaps", m_dataPath.c_str());
1239
1240 setIntConfig(WorldIntConfigs::CONFIG_MAX_WHO, sConfigMgr->GetIntDefault("MaxWhoListReturns", 49));
1241 SetBoolConfig(WorldBoolConfigs::CONFIG_START_ALL_SPELLS, sConfigMgr->GetBoolDefault("PlayerStart.AllSpells", false));
1243 SF_LOG_WARN("server.loading", "PlayerStart.AllSpells enabled - may not function as intended!");
1244 setIntConfig(WorldIntConfigs::CONFIG_HONOR_AFTER_DUEL, sConfigMgr->GetIntDefault("HonorPointsAfterDuel", 0));
1245 SetBoolConfig(WorldBoolConfigs::CONFIG_START_ALL_EXPLORED, sConfigMgr->GetBoolDefault("PlayerStart.MapsExplored", false));
1246 SetBoolConfig(WorldBoolConfigs::CONFIG_START_ALL_REP, sConfigMgr->GetBoolDefault("PlayerStart.AllReputation", false));
1247 SetBoolConfig(WorldBoolConfigs::CONFIG_ALWAYS_MAXSKILL, sConfigMgr->GetBoolDefault("AlwaysMaxWeaponSkill", false));
1248 SetBoolConfig(WorldBoolConfigs::CONFIG_PVP_TOKEN_ENABLE, sConfigMgr->GetBoolDefault("PvPToken.Enable", false));
1249 setIntConfig(WorldIntConfigs::CONFIG_PVP_TOKEN_MAP_TYPE, sConfigMgr->GetIntDefault("PvPToken.MapAllowType", 4));
1250 setIntConfig(WorldIntConfigs::CONFIG_PVP_TOKEN_ID, sConfigMgr->GetIntDefault("PvPToken.ItemID", 29434));
1251 setIntConfig(WorldIntConfigs::CONFIG_PVP_TOKEN_COUNT, sConfigMgr->GetIntDefault("PvPToken.ItemCount", 1));
1254
1255 SetBoolConfig(WorldBoolConfigs::CONFIG_NO_RESET_TALENT_COST, sConfigMgr->GetBoolDefault("NoResetTalentsCost", false));
1256 SetBoolConfig(WorldBoolConfigs::CONFIG_SHOW_KICK_IN_WORLD, sConfigMgr->GetBoolDefault("ShowKickInWorld", false));
1257 setIntConfig(WorldIntConfigs::CONFIG_INTERVAL_LOG_UPDATE, sConfigMgr->GetIntDefault("RecordUpdateTimeDiffInterval", 60000));
1258 setIntConfig(WorldIntConfigs::CONFIG_MIN_LOG_UPDATE, sConfigMgr->GetIntDefault("MinRecordUpdateTimeDiff", 100));
1259 setIntConfig(WorldIntConfigs::CONFIG_NUMTHREADS, sConfigMgr->GetIntDefault("MapUpdate.Threads", 1));
1260 setIntConfig(WorldIntConfigs::CONFIG_MAX_RESULTS_LOOKUP_COMMANDS, sConfigMgr->GetIntDefault("Command.LookupMaxResults", 0));
1261
1262 // chat logging
1263 SetBoolConfig(WorldBoolConfigs::CONFIG_CHATLOG_CHANNEL, sConfigMgr->GetBoolDefault("ChatLogs.Channel", false));
1264 SetBoolConfig(WorldBoolConfigs::CONFIG_CHATLOG_WHISPER, sConfigMgr->GetBoolDefault("ChatLogs.Whisper", false));
1265 SetBoolConfig(WorldBoolConfigs::CONFIG_CHATLOG_SYSCHAN, sConfigMgr->GetBoolDefault("ChatLogs.SysChan", false));
1266 SetBoolConfig(WorldBoolConfigs::CONFIG_CHATLOG_PARTY, sConfigMgr->GetBoolDefault("ChatLogs.Party", false));
1267 SetBoolConfig(WorldBoolConfigs::CONFIG_CHATLOG_RAID, sConfigMgr->GetBoolDefault("ChatLogs.Raid", false));
1268 SetBoolConfig(WorldBoolConfigs::CONFIG_CHATLOG_GUILD, sConfigMgr->GetBoolDefault("ChatLogs.Guild", false));
1269 SetBoolConfig(WorldBoolConfigs::CONFIG_CHATLOG_PUBLIC, sConfigMgr->GetBoolDefault("ChatLogs.Public", false));
1270 SetBoolConfig(WorldBoolConfigs::CONFIG_CHATLOG_ADDON, sConfigMgr->GetBoolDefault("ChatLogs.Addon", false));
1271 SetBoolConfig(WorldBoolConfigs::CONFIG_CHATLOG_BGROUND, sConfigMgr->GetBoolDefault("ChatLogs.BattleGround", false));
1272
1273 // Warden
1274 SetBoolConfig(WorldBoolConfigs::CONFIG_WARDEN_ENABLED, sConfigMgr->GetBoolDefault("Warden.Enabled", false));
1275 setIntConfig(WorldIntConfigs::CONFIG_WARDEN_NUM_MEM_CHECKS, sConfigMgr->GetIntDefault("Warden.NumMemChecks", 3));
1276 setIntConfig(WorldIntConfigs::CONFIG_WARDEN_NUM_OTHER_CHECKS, sConfigMgr->GetIntDefault("Warden.NumOtherChecks", 7));
1277 setIntConfig(WorldIntConfigs::CONFIG_WARDEN_CLIENT_BAN_DURATION, sConfigMgr->GetIntDefault("Warden.BanDuration", 86400));
1278 setIntConfig(WorldIntConfigs::CONFIG_WARDEN_CLIENT_CHECK_HOLDOFF, sConfigMgr->GetIntDefault("Warden.ClientCheckHoldOff", 30));
1279 setIntConfig(WorldIntConfigs::CONFIG_WARDEN_CLIENT_FAIL_ACTION, sConfigMgr->GetIntDefault("Warden.ClientCheckFailAction", 0));
1280 setIntConfig(WorldIntConfigs::CONFIG_WARDEN_CLIENT_RESPONSE_DELAY, sConfigMgr->GetIntDefault("Warden.ClientResponseDelay", 600));
1281
1282 // Dungeon finder
1283 setIntConfig(WorldIntConfigs::CONFIG_LFG_OPTIONSMASK, sConfigMgr->GetIntDefault("DungeonFinder.OptionsMask", 1));
1284
1285 // DBC_ItemAttributes
1286 SetBoolConfig(WorldBoolConfigs::CONFIG_DBC_ENFORCE_ITEM_ATTRIBUTES, sConfigMgr->GetBoolDefault("DBC.EnforceItemAttributes", true));
1287
1288 // Accountpassword Secruity
1289 setIntConfig(WorldIntConfigs::CONFIG_ACC_PASSCHANGESEC, sConfigMgr->GetIntDefault("Account.PasswordChangeSecurity", 0));
1290
1291 // Rbac Free Permission mode
1292 setIntConfig(WorldIntConfigs::CONFIG_RBAC_FREE_PERMISSION_MODE, sConfigMgr->GetIntDefault("RBAC.FreePermissionMode", 0));
1293
1294 // Random Battleground Rewards
1295 setIntConfig(WorldIntConfigs::CONFIG_BG_REWARD_WINNER_HONOR_FIRST, sConfigMgr->GetIntDefault("Battleground.RewardWinnerHonorFirst", 27000));
1296 setIntConfig(WorldIntConfigs::CONFIG_BG_REWARD_WINNER_CONQUEST_FIRST, sConfigMgr->GetIntDefault("Battleground.RewardWinnerConquestFirst", 10000));
1297 setIntConfig(WorldIntConfigs::CONFIG_BG_REWARD_WINNER_HONOR_LAST, sConfigMgr->GetIntDefault("Battleground.RewardWinnerHonorLast", 13500));
1298 setIntConfig(WorldIntConfigs::CONFIG_BG_REWARD_WINNER_CONQUEST_LAST, sConfigMgr->GetIntDefault("Battleground.RewardWinnerConquestLast", 5000));
1299 setIntConfig(WorldIntConfigs::CONFIG_BG_REWARD_LOSER_HONOR_FIRST, sConfigMgr->GetIntDefault("Battleground.RewardLoserHonorFirst", 4500));
1300 setIntConfig(WorldIntConfigs::CONFIG_BG_REWARD_LOSER_HONOR_LAST, sConfigMgr->GetIntDefault("Battleground.RewardLoserHonorLast", 3500));
1301
1302 // Max instances per hour
1303 setIntConfig(WorldIntConfigs::CONFIG_MAX_INSTANCES_PER_HOUR, sConfigMgr->GetIntDefault("AccountInstancesPerHour", 5));
1304
1305 // Anounce reset of instance to whole party
1306 SetBoolConfig(WorldBoolConfigs::CONFIG_INSTANCES_RESET_ANNOUNCE, sConfigMgr->GetBoolDefault("InstancesResetAnnounce", false));
1307
1308 // AutoBroadcast
1309 SetBoolConfig(WorldBoolConfigs::CONFIG_AUTOBROADCAST, sConfigMgr->GetBoolDefault("AutoBroadcast.On", false));
1310 setIntConfig(WorldIntConfigs::CONFIG_AUTOBROADCAST_CENTER, sConfigMgr->GetIntDefault("AutoBroadcast.Center", 0));
1311 setIntConfig(WorldIntConfigs::CONFIG_AUTOBROADCAST_INTERVAL, sConfigMgr->GetIntDefault("AutoBroadcast.Timer", 60000));
1312 if (reload)
1313 {
1316 }
1317
1318 // MySQL ping time interval
1319 setIntConfig(WorldIntConfigs::CONFIG_DB_PING_INTERVAL, sConfigMgr->GetIntDefault("MaxPingTime", 30));
1320
1321 // Guild save interval
1322 SetBoolConfig(WorldBoolConfigs::CONFIG_GUILD_LEVELING_ENABLED, sConfigMgr->GetBoolDefault("Guild.LevelingEnabled", true));
1323 setIntConfig(WorldIntConfigs::CONFIG_GUILD_SAVE_INTERVAL, sConfigMgr->GetIntDefault("Guild.SaveInterval", 15));
1324 setIntConfig(WorldIntConfigs::CONFIG_GUILD_MAX_LEVEL, sConfigMgr->GetIntDefault("Guild.MaxLevel", 25));
1325 setIntConfig(WorldIntConfigs::CONFIG_GUILD_UNDELETABLE_LEVEL, sConfigMgr->GetIntDefault("Guild.UndeletableLevel", 4));
1326 setRate(Rates::RATE_XP_GUILD_MODIFIER, sConfigMgr->GetFloatDefault("Guild.XPModifier", 0.25f));
1327 setIntConfig(WorldIntConfigs::CONFIG_GUILD_DAILY_XP_CAP, sConfigMgr->GetIntDefault("Guild.DailyXPCap", 7807500));
1328 setIntConfig(WorldIntConfigs::CONFIG_GUILD_WEEKLY_REP_CAP, sConfigMgr->GetIntDefault("Guild.WeeklyReputationCap", 4375));
1329
1330 // misc
1331 SetBoolConfig(WorldBoolConfigs::CONFIG_PDUMP_NO_PATHS, sConfigMgr->GetBoolDefault("PlayerDump.DisallowPaths", true));
1332 SetBoolConfig(WorldBoolConfigs::CONFIG_PDUMP_NO_OVERWRITE, sConfigMgr->GetBoolDefault("PlayerDump.DisallowOverwrite", true));
1333 SetBoolConfig(WorldBoolConfigs::CONFIG_UI_QUESTLEVELS_IN_DIALOGS, sConfigMgr->GetBoolDefault("UI.ShowQuestLevelsInDialogs", false));
1334#ifdef ELUNA
1335 SetBoolConfig(WorldBoolConfigs::CONFIG_ELUNA_ENABLED, sConfigMgr->GetBoolDefault("Eluna.Enabled", false));
1336#endif
1337
1338 // Wintergrasp battlefield
1339 SetBoolConfig(WorldBoolConfigs::CONFIG_WINTERGRASP_ENABLE, sConfigMgr->GetBoolDefault("Wintergrasp.Enable", false));
1340 setIntConfig(WorldIntConfigs::CONFIG_WINTERGRASP_PLR_MAX, sConfigMgr->GetIntDefault("Wintergrasp.PlayerMax", 100));
1341 setIntConfig(WorldIntConfigs::CONFIG_WINTERGRASP_PLR_MIN, sConfigMgr->GetIntDefault("Wintergrasp.PlayerMin", 0));
1342 setIntConfig(WorldIntConfigs::CONFIG_WINTERGRASP_PLR_MIN_LVL, sConfigMgr->GetIntDefault("Wintergrasp.PlayerMinLvl", 77));
1343 setIntConfig(WorldIntConfigs::CONFIG_WINTERGRASP_BATTLETIME, sConfigMgr->GetIntDefault("Wintergrasp.BattleTimer", 30));
1344 setIntConfig(WorldIntConfigs::CONFIG_WINTERGRASP_NOBATTLETIME, sConfigMgr->GetIntDefault("Wintergrasp.NoBattleTimer", 150));
1345 setIntConfig(WorldIntConfigs::CONFIG_WINTERGRASP_RESTART_AFTER_CRASH, sConfigMgr->GetIntDefault("Wintergrasp.CrashRestartTimer", 10));
1346
1347 // Stats limits
1348 SetBoolConfig(WorldBoolConfigs::CONFIG_STATS_LIMITS_ENABLE, sConfigMgr->GetBoolDefault("Stats.Limits.Enable", false));
1349 SetFloatConfig(WorldFloatConfigs::CONFIG_STATS_LIMITS_DODGE, sConfigMgr->GetFloatDefault("Stats.Limits.Dodge", 95.0f));
1350 SetFloatConfig(WorldFloatConfigs::CONFIG_STATS_LIMITS_PARRY, sConfigMgr->GetFloatDefault("Stats.Limits.Parry", 95.0f));
1351 SetFloatConfig(WorldFloatConfigs::CONFIG_STATS_LIMITS_BLOCK, sConfigMgr->GetFloatDefault("Stats.Limits.Block", 95.0f));
1352 SetFloatConfig(WorldFloatConfigs::CONFIG_STATS_LIMITS_CRIT, sConfigMgr->GetFloatDefault("Stats.Limits.Crit", 95.0f));
1353
1354 //packet spoof punishment
1359
1360 setIntConfig(WorldIntConfigs::CONFIG_PACKET_SPOOF_BANDURATION, sConfigMgr->GetIntDefault("PacketSpoof.BanDuration", 86400));
1361
1362 // call ScriptMgr if we're reloading the configuration
1363 if (reload)
1364 sScriptMgr->OnConfigLoad(reload);
1365}
1366
1367extern void LoadGameObjectModelList(std::string const& dataPath);
1368
1371{
1373 uint32 startupBegin = getMSTime();
1374
1376 srand((unsigned int)time(NULL));
1377
1379 dtAllocSetCustom(dtCustomAlloc, dtCustomFree);
1380
1383
1386
1388 sObjectMgr->SetHighestGuids();
1389
1391 if (!MapManager::ExistMapAndVMap(0, -6240.32f, 331.033f)
1392 || !MapManager::ExistMapAndVMap(0, -8949.95f, -132.493f)
1393 || !MapManager::ExistMapAndVMap(1, -618.518f, -4251.67f)
1394 || !MapManager::ExistMapAndVMap(0, 1676.35f, 1677.45f)
1395 || !MapManager::ExistMapAndVMap(1, 10311.3f, 832.463f)
1396 || !MapManager::ExistMapAndVMap(1, -2917.58f, -257.98f)
1398 !MapManager::ExistMapAndVMap(530, 10349.6f, -6357.29f)
1399 || !MapManager::ExistMapAndVMap(530, -3961.64f, -13931.2f)
1400 || !MapManager::ExistMapAndVMap(648, -8423.81f, 1361.3f)
1401 || !MapManager::ExistMapAndVMap(654, -1451.53f, 1403.35f)
1402 || !MapManager::ExistMapAndVMap(609, 2356.21f, -5662.21f)
1403 || !MapManager::ExistMapAndVMap(860, 1471.67f, 3466.25f))))
1404 {
1405 SF_LOG_ERROR("server.loading", "Correct *.map files not found in path '%smaps' or *.vmtree/*.vmtile files in '%svmaps'. Please place *.map/*.vmtree/*.vmtile files in appropriate directories or correct the DataDir value in the worldserver.conf file.", m_dataPath.c_str(), m_dataPath.c_str());
1406 exit(1);
1407 }
1408
1410 sPoolMgr->Initialize();
1411
1413 sGameEventMgr->Initialize();
1414
1416
1417 SF_LOG_INFO("server.loading", "Loading Skyfire strings...");
1418 if (!sObjectMgr->LoadSkyFireStrings())
1419 exit(1); // Error message displayed in function already
1420
1422 //No SQL injection as values are treated as integers
1423
1424 // not send custom type REALM_FFA_PVP to realm list
1427
1428 for (std::map<uint32, std::string>::const_iterator itr = realmNameStore.begin(); itr != realmNameStore.end(); ++itr)
1429 {
1430 LoginDatabase.PExecute("UPDATE realmlist SET icon = %u, timezone = %u WHERE id = '%d'", server_type, realm_zone, itr->first); // One-time query
1431 }
1432
1434 PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_OLD_CORPSES);
1435 stmt->setUInt32(0, 3 * DAY);
1436 CharacterDatabase.Execute(stmt);
1437
1439 SF_LOG_INFO("server.loading", "Initialize data stores...");
1442
1443 SF_LOG_INFO("server.loading", "Loading SpellInfo store...");
1444 sSpellMgr->LoadSpellInfoStore();
1445
1446 SF_LOG_INFO("server.loading", "Loading SpellInfo corrections...");
1447 sSpellMgr->LoadSpellInfoCorrections();
1448
1449 SF_LOG_INFO("server.loading", "Loading SkillLineAbilityMultiMap Data...");
1450 sSpellMgr->LoadSkillLineAbilityMap();
1451
1452 SF_LOG_INFO("server.loading", "Loading SpellInfo custom attributes...");
1453 sSpellMgr->LoadSpellInfoCustomAttributes();
1454
1455 SF_LOG_INFO("server.loading", "Loading GameObject models...");
1457
1458 SF_LOG_INFO("server.loading", "Loading Script Names...");
1459 sObjectMgr->LoadScriptNames();
1460
1461 SF_LOG_INFO("server.loading", "Loading Instance Template...");
1462 sObjectMgr->LoadInstanceTemplate();
1463
1464 // Must be called before `creature_respawn`/`gameobject_respawn` tables
1465 SF_LOG_INFO("server.loading", "Loading instances...");
1466 sInstanceSaveMgr->LoadInstances();
1467
1468 SF_LOG_INFO("server.loading", "Loading Localization strings...");
1469 uint32 oldMSTime = getMSTime();
1470 sObjectMgr->LoadCreatureLocales();
1471 sObjectMgr->LoadGameObjectLocales();
1472 sObjectMgr->LoadItemLocales();
1473 sObjectMgr->LoadQuestLocales();
1474 sObjectMgr->LoadNpcTextLocales();
1475 sObjectMgr->LoadPageTextLocales();
1476 sObjectMgr->LoadGossipMenuItemsLocales();
1477 sObjectMgr->LoadPointOfInterestLocales();
1478
1479 sObjectMgr->SetDBCLocaleIndex(GetDefaultDbcLocale()); // Get once for all the locale index of DBC language (console/broadcasts)
1480 SF_LOG_INFO("server.loading", ">> Localization strings loaded in %u ms", GetMSTimeDiffToNow(oldMSTime));
1481
1482 SF_LOG_INFO("server.loading", "Loading Account Roles and Permissions...");
1483 sAccountMgr->LoadRBAC();
1484
1485 SF_LOG_INFO("server.loading", "Loading Page Texts...");
1486 sObjectMgr->LoadPageTexts();
1487
1488 SF_LOG_INFO("server.loading", "Loading Game Object Templates..."); // must be after LoadPageTexts
1489 sObjectMgr->LoadGameObjectTemplate();
1490
1491 SF_LOG_INFO("server.loading", "Loading Transport templates...");
1492 sTransportMgr->LoadTransportTemplates();
1493
1494 SF_LOG_INFO("server.loading", "Loading Legacy Local Transport Data...");
1496
1497 SF_LOG_INFO("server.loading", "Loading Spell Rank Data...");
1498 sSpellMgr->LoadSpellRanks();
1499
1500 SF_LOG_INFO("server.loading", "Loading Spell Required Data...");
1501 sSpellMgr->LoadSpellRequired();
1502
1503 SF_LOG_INFO("server.loading", "Loading Spell Group types...");
1504 sSpellMgr->LoadSpellGroups();
1505
1506 SF_LOG_INFO("server.loading", "Loading Spell Learn Skills...");
1507 sSpellMgr->LoadSpellLearnSkills(); // must be after LoadSpellRanks
1508
1509 SF_LOG_INFO("server.loading", "Loading Spell Learn Spells...");
1510 sSpellMgr->LoadSpellLearnSpells();
1511
1512 SF_LOG_INFO("server.loading", "Loading Spell Proc Event conditions...");
1513 sSpellMgr->LoadSpellProcEvents();
1514
1515 SF_LOG_INFO("server.loading", "Loading Spell Proc conditions and data...");
1516 sSpellMgr->LoadSpellProcs();
1517
1518 SF_LOG_INFO("server.loading", "Loading Spell Bonus Data...");
1519 sSpellMgr->LoadSpellBonusess();
1520
1521 SF_LOG_INFO("server.loading", "Loading Aggro Spells Definitions...");
1522 sSpellMgr->LoadSpellThreats();
1523
1524 SF_LOG_INFO("server.loading", "Loading Spell Group Stack Rules...");
1525 sSpellMgr->LoadSpellGroupStackRules();
1526
1527 SF_LOG_INFO("server.loading", "Loading NPC Texts...");
1528 sObjectMgr->LoadGossipText();
1529
1530 SF_LOG_INFO("server.loading", "Loading Enchant Spells Proc datas...");
1531 sSpellMgr->LoadSpellEnchantProcData();
1532
1533 SF_LOG_INFO("server.loading", "Loading Item Random Enchantments Table...");
1535
1536 SF_LOG_INFO("server.loading", "Loading Disables"); // must be before loading quests and items
1538
1539 SF_LOG_INFO("server.loading", "Loading Items..."); // must be after LoadRandomEnchantmentsTable and LoadPageTexts
1540 sObjectMgr->LoadItemTemplates();
1541
1542 SF_LOG_INFO("server.loading", "Loading Item set names..."); // must be after LoadItemPrototypes
1543 sObjectMgr->LoadItemTemplateAddon();
1544
1545 SF_LOG_INFO("misc", "Loading Item Scripts..."); // must be after LoadItemPrototypes
1546 sObjectMgr->LoadItemScriptNames();
1547
1548 SF_LOG_INFO("server.loading", "Loading Creature Model Based Info Data...");
1549 sObjectMgr->LoadCreatureModelInfo();
1550
1551 SF_LOG_INFO("server.loading", "Loading Creature templates...");
1552 sObjectMgr->LoadCreatureTemplates();
1553
1554 SF_LOG_INFO("server.loading", "Loading Equipment templates..."); // must be after LoadCreatureTemplates
1555 sObjectMgr->LoadEquipmentTemplates();
1556
1557 SF_LOG_INFO("server.loading", "Loading Creature template addons...");
1558 sObjectMgr->LoadCreatureTemplateAddons();
1559
1560 SF_LOG_INFO("server.loading", "Loading Reputation Reward Rates...");
1561 sObjectMgr->LoadReputationRewardRate();
1562
1563 SF_LOG_INFO("server.loading", "Loading Creature Reputation OnKill Data...");
1564 sObjectMgr->LoadReputationOnKill();
1565
1566 SF_LOG_INFO("server.loading", "Loading Reputation Spillover Data...");
1567 sObjectMgr->LoadReputationSpilloverTemplate();
1568
1569 SF_LOG_INFO("server.loading", "Loading Points Of Interest Data...");
1570 sObjectMgr->LoadPointsOfInterest();
1571
1572 SF_LOG_INFO("server.loading", "Loading Creature Base Stats...");
1573 sObjectMgr->LoadCreatureClassLevelStats();
1574
1575 SF_LOG_INFO("server.loading", "Loading Creature Data...");
1576 sObjectMgr->LoadCreatures();
1577
1578 SF_LOG_INFO("server.loading", "Loading Temporary Summon Data...");
1579 sObjectMgr->LoadTempSummons(); // must be after LoadCreatureTemplates() and LoadGameObjectTemplates()
1580
1581 SF_LOG_INFO("server.loading", "Loading pet levelup spells...");
1582 sSpellMgr->LoadPetLevelupSpellMap();
1583
1584 SF_LOG_INFO("server.loading", "Loading pet default spells additional to levelup spells...");
1585 sSpellMgr->LoadPetDefaultSpells();
1586
1587 SF_LOG_INFO("server.loading", "Loading Creature Addon Data...");
1588 sObjectMgr->LoadCreatureAddons(); // must be after LoadCreatureTemplates() and LoadCreatures()
1589
1590 SF_LOG_INFO("server.loading", "Loading Gameobject Data...");
1591 sObjectMgr->LoadGameobjects();
1592
1593 SF_LOG_INFO("server.loading", "Loading Creature Linked Respawn...");
1594 sObjectMgr->LoadLinkedRespawn(); // must be after LoadCreatures(), LoadGameObjects()
1595
1596 SF_LOG_INFO("server.loading", "Loading Weather Data...");
1598
1599 SF_LOG_INFO("server.loading", "Loading SceneTemplate Data..");
1600 sObjectMgr->LoadSceneTemplates();
1601
1602 SF_LOG_INFO("server.loading", "Loading Quests...");
1603 sObjectMgr->LoadQuests(); // must be loaded after DBCs, creature_template, item_template, gameobject tables
1604
1605 SF_LOG_INFO("server.loading", "Checking Quest Disables");
1606 DisableMgr::CheckQuestDisables(); // must be after loading quests
1607
1608 SF_LOG_INFO("server.loading", "Loading Quest Objectives...");
1609 sObjectMgr->LoadQuestObjectives();
1610
1611 SF_LOG_INFO("server.loading", "Loading Quest Objective Locales...");
1612 sObjectMgr->LoadQuestObjectiveLocales();
1613
1614 SF_LOG_INFO("server.loading", "Loading Quest Objective Visual Effects...");
1615 sObjectMgr->LoadQuestObjectiveVisualEffects();
1616
1617 SF_LOG_INFO("server.loading", "Loading Quest POI");
1618 sObjectMgr->LoadQuestPOI();
1619
1620 SF_LOG_INFO("server.loading", "Loading Quests Starters and Enders...");
1621 sObjectMgr->LoadQuestStartersAndEnders(); // must be after quest load
1622
1623 SF_LOG_INFO("server.loading", "Loading Objects Pooling Data...");
1624 sPoolMgr->LoadFromDB();
1625
1626 SF_LOG_INFO("server.loading", "Loading Game Event Data..."); // must be after loading pools fully
1627 sGameEventMgr->LoadFromDB();
1628
1629 SF_LOG_INFO("server.loading", "Loading UNIT_NPC_FLAG_SPELLCLICK Data..."); // must be after LoadQuests
1630 sObjectMgr->LoadNPCSpellClickSpells();
1631
1632 SF_LOG_INFO("server.loading", "Loading Vehicle Template Accessories...");
1633 sObjectMgr->LoadVehicleTemplateAccessories(); // must be after LoadCreatureTemplates() and LoadNPCSpellClickSpells()
1634
1635 SF_LOG_INFO("server.loading", "Loading Vehicle Accessories...");
1636 sObjectMgr->LoadVehicleAccessories(); // must be after LoadCreatureTemplates() and LoadNPCSpellClickSpells()
1637
1638 SF_LOG_INFO("server.loading", "Loading SpellArea Data..."); // must be after quest load
1639 sSpellMgr->LoadSpellAreas();
1640
1641 SF_LOG_INFO("server.loading", "Loading AreaTrigger definitions...");
1642 sObjectMgr->LoadAreaTriggerTeleports();
1643
1644 SF_LOG_INFO("server.loading", "Loading Access Requirements...");
1645 sObjectMgr->LoadAccessRequirements(); // must be after item template load
1646
1647 SF_LOG_INFO("server.loading", "Loading Quest Area Triggers...");
1648 sObjectMgr->LoadQuestAreaTriggers(); // must be after LoadQuests
1649
1650 SF_LOG_INFO("server.loading", "Loading Tavern Area Triggers...");
1651 sObjectMgr->LoadTavernAreaTriggers();
1652
1653 SF_LOG_INFO("server.loading", "Loading AreaTrigger script names...");
1654 sObjectMgr->LoadAreaTriggerScripts();
1655
1656 SF_LOG_INFO("server.loading", "Loading LFG entrance positions..."); // Must be after areatriggers
1657 sLFGMgr->LoadLFGDungeons();
1658
1659 SF_LOG_INFO("server.loading", "Loading Dungeon boss data...");
1660 sObjectMgr->LoadInstanceEncounters();
1661
1662 SF_LOG_INFO("server.loading", "Loading LFG rewards...");
1663 sLFGMgr->LoadRewards();
1664
1665 SF_LOG_INFO("server.loading", "Loading Graveyard-zone links...");
1666 sObjectMgr->LoadGraveyardZones();
1667
1668 SF_LOG_INFO("server.loading", "Loading Graveyard Orientations...");
1669 sObjectMgr->LoadGraveyardOrientations();
1670
1671 SF_LOG_INFO("server.loading", "Loading spell pet auras...");
1672 sSpellMgr->LoadSpellPetAuras();
1673
1674 SF_LOG_INFO("server.loading", "Loading Spell target coordinates...");
1675 sSpellMgr->LoadSpellTargetPositions();
1676
1677 SF_LOG_INFO("server.loading", "Loading enchant custom attributes...");
1678 sSpellMgr->LoadEnchantCustomAttr();
1679
1680 SF_LOG_INFO("server.loading", "Loading linked spells...");
1681 sSpellMgr->LoadSpellLinked();
1682
1683 SF_LOG_INFO("server.loading", "Loading Player Create Data...");
1684 sObjectMgr->LoadPlayerInfo();
1685
1686 SF_LOG_INFO("server.loading", "Loading Exploration BaseXP Data...");
1687 sObjectMgr->LoadExplorationBaseXP();
1688
1689 SF_LOG_INFO("server.loading", "Loading Pet Name Parts...");
1690 sObjectMgr->LoadPetNames();
1691
1693
1694 SF_LOG_INFO("server.loading", "Loading the max pet number...");
1695 sObjectMgr->LoadPetNumber();
1696
1697 SF_LOG_INFO("server.loading", "Loading pet level stats...");
1698 sObjectMgr->LoadPetLevelInfo();
1699
1700 SF_LOG_INFO("server.loading", "Loading Player Corpses...");
1701 sObjectMgr->LoadCorpses();
1702
1703 SF_LOG_INFO("server.loading", "Loading Player level dependent mail rewards...");
1704 sObjectMgr->LoadMailLevelRewards();
1705
1706 // Loot tables
1708
1709 SF_LOG_INFO("server.loading", "Loading Skill Discovery Table...");
1711
1712 SF_LOG_INFO("server.loading", "Loading Skill Extra Item Table...");
1714
1715 SF_LOG_INFO("server.loading", "Loading Skill Fishing base level requirements...");
1716 sObjectMgr->LoadFishingBaseSkillLevel();
1717
1718 SF_LOG_INFO("server.loading", "Loading Achievements...");
1719 sAchievementMgr->LoadAchievementReferenceList();
1720 SF_LOG_INFO("server.loading", "Loading Achievement Criteria Lists...");
1721 sAchievementMgr->LoadAchievementCriteriaList();
1722 SF_LOG_INFO("server.loading", "Loading Achievement Criteria Data...");
1723 sAchievementMgr->LoadAchievementCriteriaData();
1724 SF_LOG_INFO("server.loading", "Loading Achievement Rewards...");
1725 sAchievementMgr->LoadRewards();
1726 SF_LOG_INFO("server.loading", "Loading Achievement Reward Locales...");
1727 sAchievementMgr->LoadRewardLocales();
1728 SF_LOG_INFO("server.loading", "Loading Completed Achievements...");
1729 sAchievementMgr->LoadCompletedAchievements();
1730
1731 // Delete expired auctions before loading
1732 SF_LOG_INFO("server.loading", "Deleting expired auctions...");
1733 sAuctionMgr->DeleteExpiredAuctionsAtStartup();
1734
1736 SF_LOG_INFO("server.loading", "Loading Item Auctions...");
1737 sAuctionMgr->LoadAuctionItems();
1738
1739 SF_LOG_INFO("server.loading", "Loading Auctions...");
1740 sAuctionMgr->LoadAuctions();
1741
1742 SF_LOG_INFO("server.loading", "Loading Guild XP for level...");
1743 sGuildMgr->LoadGuildXpForLevel();
1744
1745 SF_LOG_INFO("server.loading", "Loading Guild rewards...");
1746 sGuildMgr->LoadGuildRewards();
1747
1748 SF_LOG_INFO("server.loading", "Loading Guilds...");
1749 sGuildMgr->LoadGuilds();
1750
1751 sGuildFinderMgr->LoadFromDB();
1752
1753 SF_LOG_INFO("server.loading", "Loading Groups...");
1754 sGroupMgr->LoadGroups();
1755
1756 SF_LOG_INFO("server.loading", "Loading ReservedNames...");
1757 sObjectMgr->LoadReservedPlayersNames();
1758
1759 SF_LOG_INFO("server.loading", "Loading GameObjects for quests...");
1760 sObjectMgr->LoadGameObjectForQuests();
1761
1762 SF_LOG_INFO("server.loading", "Loading BattleMasters...");
1763 sBattlegroundMgr->LoadBattleMastersEntry();
1764
1765 SF_LOG_INFO("server.loading", "Loading GameTeleports...");
1766 sObjectMgr->LoadGameTele();
1767
1768 SF_LOG_INFO("server.loading", "Loading Gossip menu...");
1769 sObjectMgr->LoadGossipMenu();
1770
1771 SF_LOG_INFO("server.loading", "Loading Gossip menu options...");
1772 sObjectMgr->LoadGossipMenuItems();
1773
1774 SF_LOG_INFO("server.loading", "Loading Vendors...");
1775 sObjectMgr->LoadVendors(); // must be after load CreatureTemplate and ItemTemplate
1776
1777 SF_LOG_INFO("server.loading", "Loading Trainers...");
1778 sObjectMgr->LoadTrainerSpell(); // must be after load CreatureTemplate
1779
1780 SF_LOG_INFO("server.loading", "Loading Waypoints...");
1781 sWaypointMgr->Load();
1782
1783 SF_LOG_INFO("server.loading", "Loading SmartAI Waypoints...");
1784 sSmartWaypointMgr->LoadFromDB();
1785
1786 SF_LOG_INFO("server.loading", "Loading Creature Formations...");
1787 sFormationMgr->LoadCreatureFormations();
1788
1789 SF_LOG_INFO("server.loading", "Loading World States..."); // must be loaded before battleground, outdoor PvP and conditions
1791
1792 SF_LOG_INFO("server.loading", "Loading Terrain Phase definitions...");
1793 sObjectMgr->LoadTerrainPhaseInfo();
1794
1795 SF_LOG_INFO("server.loading", "Loading Terrain Swap Default definitions...");
1796 sObjectMgr->LoadTerrainSwapDefaults();
1797
1798 SF_LOG_INFO("server.loading", "Loading Terrain World Map definitions...");
1799 sObjectMgr->LoadTerrainWorldMaps();
1800
1801 SF_LOG_INFO("server.loading", "Loading Phase Area definitions...");
1802 sObjectMgr->LoadAreaPhases();
1803
1804 SF_LOG_INFO("server.loading", "Loading Conditions...");
1805 sConditionMgr->LoadConditions();
1806
1807 SF_LOG_INFO("server.loading", "Loading faction change achievement pairs...");
1808 sObjectMgr->LoadFactionChangeAchievements();
1809
1810 SF_LOG_INFO("server.loading", "Loading faction change spell pairs...");
1811 sObjectMgr->LoadFactionChangeSpells();
1812
1813 SF_LOG_INFO("server.loading", "Loading faction change item pairs...");
1814 sObjectMgr->LoadFactionChangeItems();
1815
1816 SF_LOG_INFO("server.loading", "Loading faction change reputation pairs...");
1817 sObjectMgr->LoadFactionChangeReputations();
1818
1819 SF_LOG_INFO("server.loading", "Loading faction change title pairs...");
1820 sObjectMgr->LoadFactionChangeTitles();
1821
1822 SF_LOG_INFO("server.loading", "Loading GM tickets...");
1823 sTicketMgr->LoadGmTickets();
1824
1825 SF_LOG_INFO("server.loading", "Loading GM surveys...");
1826 sTicketMgr->LoadSurveys();
1827
1828 SF_LOG_INFO("server.loading", "Loading Support bugs tickets...");
1829 sTicketMgr->LoadBugTickets();
1830
1831 SF_LOG_INFO("server.loading", "Loading Support suggest tickets...");
1832 sTicketMgr->LoadSuggestTickets();
1833
1834 SF_LOG_INFO("server.loading", "Loading client addons...");
1836
1838 SF_LOG_INFO("server.loading", "Returning old mails...");
1839 sObjectMgr->ReturnOrDeleteOldMails(false);
1840
1841 SF_LOG_INFO("server.loading", "Loading Autobroadcasts...");
1843
1845 sObjectMgr->LoadSpellScripts(); // must be after load Creature/Gameobject(Template/Data)
1846 sObjectMgr->LoadEventScripts(); // must be after load Creature/Gameobject(Template/Data)
1847 sObjectMgr->LoadWaypointScripts();
1848
1849 SF_LOG_INFO("server.loading", "Loading Scripts text locales..."); // must be after Load*Scripts calls
1850 sObjectMgr->LoadDbScriptStrings();
1851
1852 SF_LOG_INFO("server.loading", "Loading spell script names...");
1853 sObjectMgr->LoadSpellScriptNames();
1854
1855 SF_LOG_INFO("server.loading", "Loading Creature Texts...");
1856 sCreatureTextMgr->LoadCreatureTexts();
1857
1858 SF_LOG_INFO("server.loading", "Loading Creature Text Locales...");
1859 sCreatureTextMgr->LoadCreatureTextLocales();
1860
1861 SF_LOG_INFO("server.loading", "Initializing Scripts...");
1862 sScriptMgr->Initialize();
1863 sScriptMgr->OnConfigLoad(false); // must be done after the ScriptMgr has been properly initialized
1864
1865#ifdef ELUNA
1866 if (GetBoolConfig(WorldBoolConfigs::CONFIG_ELUNA_ENABLED))
1867 StartEluna(false);
1868#endif
1869
1870 SF_LOG_INFO("server.loading", "Validating spell scripts...");
1871 sObjectMgr->ValidateSpellScripts();
1872
1873 SF_LOG_INFO("server.loading", "Loading SmartAI scripts...");
1874 sSmartScriptMgr->LoadSmartAIFromDB();
1875
1876 SF_LOG_INFO("server.loading", "Loading Calendar data...");
1877 sCalendarMgr->LoadFromDB();
1878
1879 SF_LOG_INFO("server.loading", "Loading Research Digsite info...");
1880 sObjectMgr->LoadResearchDigsiteInfo();
1881
1882 SF_LOG_INFO("server.loading", "Loading Archaeology Find info...");
1883 sObjectMgr->LoadArchaeologyFindInfo();
1884
1885 SF_LOG_INFO("server.loading", "Loading Research Project requirements...");
1886 sObjectMgr->LoadResearchProjectRequirements();
1887
1888 SF_LOG_INFO("server.loading", "Loading Battle Pet breed data...");
1889 sObjectMgr->LoadBattlePetBreedData();
1890
1891 SF_LOG_INFO("server.loading", "Loading Battle Pet quality data...");
1892 sObjectMgr->LoadBattlePetQualityData();
1893
1894 SF_LOG_INFO("server.loading", "Loading Battle Pet item to species data...");
1895 sObjectMgr->LoadBattlePetItemToSpeciesData();
1896
1897 SF_LOG_INFO("server.loading", "Loading Battle Pet wild pools...");
1898 sBattlePetSpawnMgr->LoadFromDB();
1899
1900 SF_LOG_INFO("server.loading", "Loading Cinematic path ...");
1901 sCinematicSequenceMgr->Load();
1902
1904 SF_LOG_INFO("server.loading", "Initialize game time and timers");
1905 m_gameTime = time(NULL);
1907
1908 for (std::map<uint32, std::string>::const_iterator itr = realmNameStore.begin(); itr != realmNameStore.end(); ++itr)
1909 {
1910 LoginDatabase.PExecute("INSERT INTO uptime (realmid, starttime, uptime) VALUES(%u, %u, 0 )",
1911 itr->first, uint32(m_startTime), SKYFIRE_VER_PRODUCTVERSION_STR); // One-time query
1912 }
1913
1914 m_timers[WUPDATE_WEATHERS].SetInterval(1 * IN_MILLISECONDS);
1918 //Update "uptime" table based on configuration entry in minutes.
1919 m_timers[WUPDATE_CORPSES].SetInterval(20 * MINUTE * IN_MILLISECONDS);
1920 //erase corpses every 20 minutes
1922 // clean logs table every 14 days by default
1924 m_timers[WUPDATE_DELETECHARS].SetInterval(DAY * IN_MILLISECONDS); // check for chars to delete every day
1925
1927
1929
1930 //to set mailtimer to return mails every day between 4 and 5 am
1931 //mailtimer is increased when updating auctions
1932 //one second is 1000 -(tested on win system)
1934 tm localTm;
1936 mail_timer = ((((localTm.tm_hour + 20) % 24) * HOUR * IN_MILLISECONDS) / m_timers[WUPDATE_AUCTIONS].GetInterval());
1937 //1440
1939 SF_LOG_INFO("server.loading", "Mail timer set to: " UI64FMTD ", mail return is called every " UI64FMTD " minutes", uint64(mail_timer), uint64(mail_timer_expires));
1940
1943
1945 SF_LOG_INFO("server.loading", "Starting Map System");
1946 sMapMgr->Initialize();
1947
1948 SF_LOG_INFO("server.loading", "Starting Game Event system...");
1949 uint32 nextGameEvent = sGameEventMgr->StartSystem();
1950 m_timers[WUPDATE_EVENTS].SetInterval(nextGameEvent); //depend on next event
1951
1952 // Delete all characters which have been deleted X days before
1954
1955 // Delete all custom channels which haven't been used for PreserveCustomChannelDuration days.
1957
1958 SF_LOG_INFO("server.loading", "Starting Arena Season...");
1959 sGameEventMgr->StartArenaSeason();
1960
1961 sTicketMgr->Initialize();
1962
1964 SF_LOG_INFO("server.loading", "Starting Battleground System");
1965 sBattlegroundMgr->CreateInitialBattlegrounds();
1966
1968 SF_LOG_INFO("server.loading", "Starting Outdoor PvP System");
1969 sOutdoorPvPMgr->InitOutdoorPvP();
1970
1972 SF_LOG_INFO("server.loading", "Starting Battlefield System");
1973 sBattlefieldMgr->InitBattlefield();
1974
1975 SF_LOG_INFO("server.loading", "Loading Transports...");
1976 sTransportMgr->SpawnContinentTransports();
1977
1979 SF_LOG_INFO("server.loading", "Loading Warden Checks...");
1980 sWardenCheckMgr->LoadWardenChecks();
1981
1982 SF_LOG_INFO("server.loading", "Loading Warden Action Overrides...");
1983 sWardenCheckMgr->LoadWardenOverrides();
1984
1985 SF_LOG_INFO("server.loading", "Deleting expired bans...");
1986 LoginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate <= UNIX_TIMESTAMP() AND unbandate<>bandate"); // One-time query
1987
1988 SF_LOG_INFO("server.loading", "Calculate next daily quest reset time...");
1990
1991 SF_LOG_INFO("server.loading", "Calculate next weekly quest reset time...");
1993
1994 SF_LOG_INFO("server.loading", "Calculate next monthly quest reset time...");
1996
1997 SF_LOG_INFO("server.loading", "Calculate random battleground reset time...");
1999
2000 SF_LOG_INFO("server.loading", "Calculate guild limitation(s) reset time...");
2002
2003 SF_LOG_INFO("server.loading", "Calculate next currency reset time...");
2005
2007
2008 SF_LOG_INFO("misc", "Initializing Opcodes...");
2009 serverOpcodeTable.InitializeServerTable();
2010 clientOpcodeTable.InitializeClientTable();
2011
2012 SF_LOG_INFO("misc", "Loading hotfix info...");
2013 sObjectMgr->LoadHotfixData();
2014
2015 SF_LOG_INFO("server.loading", "Loading BlackMarket Templates...");
2016 sBlackMarketMgr->LoadBlackMarketTemplates();
2017
2018 uint32 startupDuration = GetMSTimeDiffToNow(startupBegin);
2019
2020 SF_LOG_INFO("server.worldserver", "World initialized in %u minutes %u seconds", (startupDuration / 60000), ((startupDuration % 60000) / 1000));
2021
2022 if (uint32 realmId = sConfigMgr->GetIntDefault("RealmID", 0)) // 0 reserved for auth
2023 sLog->SetRealmId(realmId);
2024}
2025
2026void World::RecordTimeDiff(const char* text, ...)
2027{
2028 if (m_updateTimeCount != 1)
2029 return;
2030 if (!text)
2031 {
2033 return;
2034 }
2035
2036 uint32 thisTime = getMSTime();
2037 uint32 diff = getMSTimeDiff(m_currentTime, thisTime);
2038
2040 {
2041 va_list ap;
2042 char str[256];
2043 va_start(ap, text);
2044 vsnprintf(str, 256, text, ap);
2045 va_end(ap);
2046 SF_LOG_INFO("misc", "Difftime %s: %u.", str, diff);
2047 }
2048
2049 m_currentTime = thisTime;
2050}
2051
2053{
2054 uint32 oldMSTime = getMSTime();
2055
2056 m_Autobroadcasts.clear();
2058
2059 for (std::map<uint32, std::string>::const_iterator itr = realmNameStore.begin(); itr != realmNameStore.end(); ++itr)
2060 {
2061 PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_AUTOBROADCAST);
2062 stmt->setInt32(0, itr->first);
2063 PreparedQueryResult result = LoginDatabase.Query(stmt);
2064
2065 if (!result)
2066 {
2067 SF_LOG_INFO("server.loading", ">> Loaded 0 autobroadcasts definitions. DB table `autobroadcast` is empty for realm %u!", itr->first);
2068 return;
2069 }
2070
2071 uint32 count = 0;
2072
2073 do
2074 {
2075 Field* fields = result->Fetch();
2076 uint8 id = fields[0].GetUInt8();
2077
2078 m_Autobroadcasts[id] = fields[2].GetString();
2079 m_AutobroadcastsWeights[id] = fields[1].GetUInt8();
2080
2081 ++count;
2082 } while (result->NextRow());
2083
2084 SF_LOG_INFO("server.loading", ">> Loaded %u autobroadcast definitions for realm %u in %u ms", count, itr->first, GetMSTimeDiffToNow(oldMSTime));
2085
2086 }
2087}
2088
2091{
2092 m_updateTime = diff;
2094
2096 {
2098 {
2099 SF_LOG_DEBUG("misc", "Update time diff: %u. Players online: %u.", m_updateTimeSum / m_updateTimeCount, GetActiveSessionCount());
2102 }
2103 else
2104 {
2107 }
2108 }
2109
2111 for (int i = 0; i < WUPDATE_COUNT; ++i)
2112 {
2113 if (m_timers[i].GetCurrent() >= 0)
2114 m_timers[i].Update(diff);
2115 else
2116 m_timers[i].SetCurrent(0);
2117 }
2118
2121
2124 {
2127 }
2128
2132
2136
2138 ResetRandomBG();
2139
2141 ResetGuildCap();
2142
2145
2146 sBattlePetSpawnMgr->Update(diff);
2147
2149 if (m_timers[WUPDATE_BLACK_MARKET].Passed())
2150 {
2152
2154 //(tested... works on win)
2156 {
2157 mail_timer = 0;
2158 sObjectMgr->ReturnOrDeleteOldMails(true);
2159 }
2160
2162 sBlackMarketMgr->Update();
2163 }
2164
2166 if (m_timers[WUPDATE_AUCTIONS].Passed())
2167 {
2168 m_timers[WUPDATE_AUCTIONS].Reset();
2169
2171 //(tested... works on win)
2173 {
2174 mail_timer = 0;
2175 sObjectMgr->ReturnOrDeleteOldMails(true);
2176 }
2177
2179 sAuctionMgr->Update();
2180 }
2181
2183 RecordTimeDiff(NULL);
2184 UpdateSessions(diff);
2185 RecordTimeDiff("UpdateSessions");
2186
2188 if (m_timers[WUPDATE_WEATHERS].Passed())
2189 {
2190 m_timers[WUPDATE_WEATHERS].Reset();
2192 }
2193
2195 if (m_timers[WUPDATE_UPTIME].Passed())
2196 {
2197 uint32 tmpDiff = uint32(m_gameTime - m_startTime);
2198 uint32 maxOnlinePlayers = GetMaxPlayerCount();
2199
2200 m_timers[WUPDATE_UPTIME].Reset();
2201
2202 for (std::map<uint32, std::string>::const_iterator itr = realmNameStore.begin(); itr != realmNameStore.end(); ++itr)
2203 {
2204 PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_UPTIME_PLAYERS);
2205
2206 stmt->setUInt32(0, tmpDiff);
2207 stmt->setUInt16(1, uint16(maxOnlinePlayers));
2208 stmt->setUInt32(2, itr->first);
2209 stmt->setUInt32(3, uint32(m_startTime));
2210
2211 LoginDatabase.Execute(stmt);
2212 }
2213 }
2214
2216 if (sWorld->getIntConfig(WorldIntConfigs::CONFIG_LOGDB_CLEARTIME) > 0) // if not enabled, ignore the timer
2217 {
2218 if (m_timers[WUPDATE_CLEANDB].Passed())
2219 {
2220 m_timers[WUPDATE_CLEANDB].Reset();
2221
2222 PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_OLD_LOGS);
2223
2225 stmt->setUInt32(1, uint32(time(0)));
2226
2227 LoginDatabase.Execute(stmt);
2228 }
2229 }
2230
2233 RecordTimeDiff(NULL);
2234 sMapMgr->Update(diff);
2235 RecordTimeDiff("UpdateMapMgr");
2236
2238 {
2239 if (m_timers[WUPDATE_AUTOBROADCAST].Passed())
2240 {
2243 }
2244 }
2245
2246 sBattlegroundMgr->Update(diff);
2247 RecordTimeDiff("UpdateBattlegroundMgr");
2248
2249 sOutdoorPvPMgr->Update(diff);
2250 RecordTimeDiff("UpdateOutdoorPvPMgr");
2251
2252 sBattlefieldMgr->Update(diff);
2253 RecordTimeDiff("BattlefieldMgr");
2254
2256 if (m_timers[WUPDATE_DELETECHARS].Passed())
2257 {
2260 }
2261
2262 sLFGMgr->Update(diff);
2263 RecordTimeDiff("UpdateLFGMgr");
2264
2265 // execute callbacks from sql queries that were queued recently
2267 RecordTimeDiff("ProcessQueryCallbacks");
2268
2270 if (m_timers[WUPDATE_CORPSES].Passed())
2271 {
2272 m_timers[WUPDATE_CORPSES].Reset();
2273 sObjectAccessor->RemoveOldCorpses();
2274 }
2275
2277 if (m_timers[WUPDATE_EVENTS].Passed())
2278 {
2279 m_timers[WUPDATE_EVENTS].Reset(); // to give time for Update() to be processed
2280 uint32 nextGameEvent = sGameEventMgr->Update();
2281 m_timers[WUPDATE_EVENTS].SetInterval(nextGameEvent);
2282 m_timers[WUPDATE_EVENTS].Reset();
2283 }
2284
2286 if (m_timers[WUPDATE_PINGDB].Passed())
2287 {
2288 m_timers[WUPDATE_PINGDB].Reset();
2289 SF_LOG_DEBUG("misc", "Ping MySQL to keep connection alive");
2290 CharacterDatabase.KeepAlive();
2291 LoginDatabase.KeepAlive();
2292 WorldDatabase.KeepAlive();
2293 }
2294
2295 if (m_timers[WUPDATE_GUILDSAVE].Passed())
2296 {
2297 m_timers[WUPDATE_GUILDSAVE].Reset();
2298 sGuildMgr->SaveGuilds();
2299 }
2300
2301 // update the instance reset times
2302 sInstanceSaveMgr->Update();
2303
2304 // And last, but not least handle the issued cli commands
2306
2307 sScriptMgr->OnWorldUpdate(diff);
2308}
2309
2311{
2312 m_timers[WUPDATE_EVENTS].Reset(); // to give time for Update() to be processed
2313 uint32 nextGameEvent = sGameEventMgr->Update();
2314 m_timers[WUPDATE_EVENTS].SetInterval(nextGameEvent);
2315 m_timers[WUPDATE_EVENTS].Reset();
2316}
2317
2320{
2321 SessionMap::const_iterator itr;
2322 for (itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
2323 {
2324 if (itr->second &&
2325 itr->second->GetPlayer() &&
2326 itr->second->GetPlayer()->IsInWorld() &&
2327 itr->second != self &&
2328 (team == 0 || itr->second->GetPlayer()->GetTeam() == team))
2329 {
2330 itr->second->SendPacket(packet);
2331 }
2332 }
2333}
2334
2337{
2338 for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
2339 {
2340 // check if session and can receive global GM Messages and its not self
2341 WorldSession* session = itr->second;
2342 if (!session || session == self || !session->HasPermission(rbac::RBAC_PERM_RECEIVE_GLOBAL_GM_TEXTMESSAGE))
2343 continue;
2344
2345 // Player should be in world
2346 Player* player = session->GetPlayer();
2347 if (!player || !player->IsInWorld())
2348 continue;
2349
2350 // Send only to same team, if team is given
2351 if (!team || player->GetTeam() == team)
2352 session->SendPacket(packet);
2353 }
2354}
2355
2356namespace Skyfire
2357{
2359 {
2360 public:
2361 typedef std::vector<WorldPacket*> WorldPacketList;
2362 explicit WorldWorldTextBuilder(int32 textId, va_list* args = NULL) : i_textId(textId), i_args(args) { }
2364 {
2365 char const* text = sObjectMgr->GetSkyFireString(i_textId, loc_idx);
2366
2367 if (i_args)
2368 {
2369 // we need copy va_list before use or original va_list will corrupted
2370 va_list ap;
2371 va_copy(ap, *i_args);
2372
2373 char str[2048];
2374 vsnprintf(str, 2048, text, ap);
2375 va_end(ap);
2376
2377 do_helper(data_list, &str[0]);
2378 }
2379 else
2380 do_helper(data_list, (char*)text);
2381 }
2382 private:
2383 char* lineFromMessage(char*& pos) { char* start = strtok(pos, "\n"); pos = NULL; return start; }
2384 void do_helper(WorldPacketList& data_list, char* text)
2385 {
2386 char* pos = text;
2387
2388 while (char* line = lineFromMessage(pos))
2389 {
2390 WorldPacket* data = new WorldPacket();
2392 data_list.push_back(data);
2393 }
2394 }
2395
2397 va_list* i_args;
2398 };
2399} // namespace Skyfire
2400
2402void World::SendWorldText(int32 string_id, ...)
2403{
2404 va_list ap;
2405 va_start(ap, string_id);
2406
2407 Skyfire::WorldWorldTextBuilder wt_builder(string_id, &ap);
2409 for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
2410 {
2411 if (!itr->second || !itr->second->GetPlayer() || !itr->second->GetPlayer()->IsInWorld())
2412 continue;
2413
2414 wt_do(itr->second->GetPlayer());
2415 }
2416
2417 va_end(ap);
2418}
2419
2421void World::SendGMText(int32 string_id, ...)
2422{
2423 va_list ap;
2424 va_start(ap, string_id);
2425
2426 Skyfire::WorldWorldTextBuilder wt_builder(string_id, &ap);
2428 for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
2429 {
2430 // Session should have permissions to receive global gm messages
2431 WorldSession* session = itr->second;
2433 continue;
2434
2435 // Player should be in world
2436 Player* player = session->GetPlayer();
2437 if (!player || !player->IsInWorld())
2438 continue;
2439
2440 wt_do(player);
2441 }
2442
2443 va_end(ap);
2444}
2445
2447void World::SendGlobalText(const char* text, WorldSession* self)
2448{
2449 WorldPacket data;
2450
2451 // need copy to prevent corruption by strtok call in LineFromMessage original string
2452 char* buf = strdup(text);
2453 char* pos = buf;
2454
2455 while (char* line = ChatHandler::LineFromMessage(pos))
2456 {
2458 SendGlobalMessage(&data, self);
2459 }
2460
2461 free(buf);
2462}
2463
2466{
2467 SessionMap::const_iterator itr;
2468 for (itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
2469 {
2470 if (itr->second &&
2471 itr->second->GetPlayer() &&
2472 itr->second->GetPlayer()->IsInWorld() &&
2473 itr->second->GetPlayer()->GetZoneId() == zone &&
2474 itr->second != self &&
2475 (team == 0 || itr->second->GetPlayer()->GetTeam() == team))
2476 {
2477 itr->second->SendPacket(packet);
2478 }
2479 }
2480}
2481
2483void World::SendZoneText(uint32 zone, const char* text, WorldSession* self, uint32 team)
2484{
2485 WorldPacket data;
2487 SendZoneMessage(zone, &data, self, team);
2488}
2489
2492{
2493 m_QueuedPlayer.clear(); // prevent send queue update packet and login queued sessions
2494
2495 // session not removed at kick and will removed in next update tick
2496 for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
2497 itr->second->KickPlayer();
2498}
2499
2502{
2503 // session not removed at kick and will removed in next update tick
2504 for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
2505 if (itr->second->GetSecurity() < sec)
2506 itr->second->KickPlayer();
2507}
2508
2510BanReturn World::BanAccount(BanMode mode, std::string const& nameOrIP, std::string const& duration, std::string const& reason, std::string const& author)
2511{
2512 uint32 duration_secs = TimeStringToSecs(duration);
2513 return BanAccount(mode, nameOrIP, duration_secs, reason, author);
2514}
2515
2517BanReturn World::BanAccount(BanMode mode, std::string const& nameOrIP, uint32 duration_secs, std::string const& reason, std::string const& author)
2518{
2519 PreparedQueryResult resultAccounts = PreparedQueryResult(NULL); //used for kicking
2520 PreparedStatement* stmt = NULL;
2521
2523 switch (mode)
2524 {
2525 case BAN_IP:
2526 // No SQL injection with prepared statements
2527 stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BY_IP);
2528 stmt->setString(0, nameOrIP);
2529 resultAccounts = LoginDatabase.Query(stmt);
2530 stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_IP_BANNED);
2531 stmt->setString(0, nameOrIP);
2532 stmt->setUInt32(1, duration_secs);
2533 stmt->setString(2, author);
2534 stmt->setString(3, reason);
2535 LoginDatabase.Execute(stmt);
2536 break;
2537 case BAN_ACCOUNT:
2538 // No SQL injection with prepared statements
2539 stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_ID_BY_NAME);
2540 stmt->setString(0, nameOrIP);
2541 resultAccounts = LoginDatabase.Query(stmt);
2542 break;
2543 case BAN_CHARACTER:
2544 // No SQL injection with prepared statements
2545 stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ACCOUNT_BY_NAME);
2546 stmt->setString(0, nameOrIP);
2547 resultAccounts = CharacterDatabase.Query(stmt);
2548 break;
2549 default:
2550 return BAN_SYNTAX_ERROR;
2551 }
2552
2553 if (!resultAccounts)
2554 {
2555 if (mode == BAN_IP)
2556 return BAN_SUCCESS; // ip correctly banned but nobody affected (yet)
2557 else
2558 return BAN_NOTFOUND; // Nobody to ban
2559 }
2560
2562 SQLTransaction trans = LoginDatabase.BeginTransaction();
2563 do
2564 {
2565 Field* fieldsAccount = resultAccounts->Fetch();
2566 uint32 account = fieldsAccount[0].GetUInt32();
2567
2568 if (mode != BAN_IP)
2569 {
2570 // make sure there is only one active ban
2571 stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_ACCOUNT_NOT_BANNED);
2572 stmt->setUInt32(0, account);
2573 trans->Append(stmt);
2574 // No SQL injection with prepared statements
2575 stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_ACCOUNT_BANNED);
2576 stmt->setUInt32(0, account);
2577 stmt->setUInt32(1, duration_secs);
2578 stmt->setString(2, author);
2579 stmt->setString(3, reason);
2580 trans->Append(stmt);
2581 }
2582
2583 if (WorldSession* sess = FindSession(account))
2584 if (std::string(sess->GetPlayerName()) != author)
2585 sess->KickPlayer();
2586 } while (resultAccounts->NextRow());
2587
2588 LoginDatabase.CommitTransaction(trans);
2589
2590 return BAN_SUCCESS;
2591}
2592
2594bool World::RemoveBanAccount(BanMode mode, std::string const& nameOrIP)
2595{
2596 PreparedStatement* stmt = NULL;
2597 if (mode == BAN_IP)
2598 {
2599 stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_IP_NOT_BANNED);
2600 stmt->setString(0, nameOrIP);
2601 LoginDatabase.Execute(stmt);
2602 }
2603 else
2604 {
2605 uint32 account = 0;
2606 if (mode == BAN_ACCOUNT)
2607 account = AccountMgr::GetId(nameOrIP);
2608 else if (mode == BAN_CHARACTER)
2609 account = sObjectMgr->GetPlayerAccountIdByPlayerName(nameOrIP);
2610
2611 if (!account)
2612 return false;
2613
2614 //NO SQL injection as account is uint32
2615 stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_ACCOUNT_NOT_BANNED);
2616 stmt->setUInt32(0, account);
2617 LoginDatabase.Execute(stmt);
2618 }
2619 return true;
2620}
2621
2623BanReturn World::BanCharacter(std::string const& name, std::string const& duration, std::string const& reason, std::string const& author)
2624{
2625 Player* pBanned = sObjectAccessor->FindPlayerByName(name);
2626 uint32 guid = 0;
2627
2628 uint32 duration_secs = TimeStringToSecs(duration);
2629
2631 if (!pBanned)
2632 {
2633 PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUID_BY_NAME);
2634 stmt->setString(0, name);
2635 PreparedQueryResult resultCharacter = CharacterDatabase.Query(stmt);
2636
2637 if (!resultCharacter)
2638 return BAN_NOTFOUND; // Nobody to ban
2639
2640 guid = (*resultCharacter)[0].GetUInt32();
2641 }
2642 else
2643 guid = pBanned->GetGUIDLow();
2644
2645 // make sure there is only one active ban
2646 PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHARACTER_BAN);
2647 stmt->setUInt32(0, guid);
2648 CharacterDatabase.Execute(stmt);
2649
2650 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_BAN);
2651 stmt->setUInt32(0, guid);
2652 stmt->setUInt32(1, duration_secs);
2653 stmt->setString(2, author);
2654 stmt->setString(3, reason);
2655 CharacterDatabase.Execute(stmt);
2656
2657 if (pBanned)
2658 pBanned->GetSession()->KickPlayer();
2659
2660 return BAN_SUCCESS;
2661}
2662
2664bool World::RemoveBanCharacter(std::string const& name)
2665{
2666 Player* pBanned = sObjectAccessor->FindPlayerByName(name);
2667 uint32 guid = 0;
2668
2670 if (!pBanned)
2671 {
2672 PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUID_BY_NAME);
2673 stmt->setString(0, name);
2674 PreparedQueryResult resultCharacter = CharacterDatabase.Query(stmt);
2675
2676 if (!resultCharacter)
2677 return false;
2678
2679 guid = (*resultCharacter)[0].GetUInt32();
2680 }
2681 else
2682 guid = pBanned->GetGUIDLow();
2683
2684 if (!guid)
2685 return false;
2686
2687 PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHARACTER_BAN);
2688 stmt->setUInt32(0, guid);
2689 CharacterDatabase.Execute(stmt);
2690 return true;
2691}
2692
2695{
2697 time_t thisTime = time(NULL);
2698 uint32 elapsed = uint32(thisTime - m_gameTime);
2699 m_gameTime = thisTime;
2700
2702 if (!IsStopped() && m_ShutdownTimer > 0 && elapsed > 0)
2703 {
2705 if (m_ShutdownTimer <= elapsed)
2706 {
2708 m_stopEvent = true; // exist code already set
2709 else
2710 m_ShutdownTimer = 1; // minimum timer value to wait idle state
2711 }
2713 else
2714 {
2715 m_ShutdownTimer -= elapsed;
2716
2717 ShutdownMsg();
2718 }
2719 }
2720}
2721
2723void World::ShutdownServ(uint32 time, uint32 options, uint8 exitcode)
2724{
2725 // ignore if server shutdown at next tick
2726 if (IsStopped())
2727 return;
2728
2729 m_ShutdownMask = options;
2730 m_ExitCode = exitcode;
2731
2733 if (time == 0)
2734 {
2735 if (!(options & SHUTDOWN_MASK_IDLE) || GetActiveAndQueuedSessionCount() == 0)
2736 m_stopEvent = true; // exist code already set
2737 else
2738 m_ShutdownTimer = 1; //So that the session count is re-evaluated at next world tick
2739 }
2741 else
2742 {
2743 m_ShutdownTimer = time;
2744 ShutdownMsg(true);
2745 }
2746
2747 sScriptMgr->OnShutdownInitiate(ShutdownExitCode(exitcode), ShutdownMask(options));
2748}
2749
2751void World::ShutdownMsg(bool show, Player* player)
2752{
2753 // not show messages for idle shutdown mode
2755 return;
2756
2758 if (show ||
2759 (m_ShutdownTimer < 5 * MINUTE && (m_ShutdownTimer % 15) == 0) || // < 5 min; every 15 sec
2760 (m_ShutdownTimer < 15 * MINUTE && (m_ShutdownTimer % MINUTE) == 0) || // < 15 min ; every 1 min
2761 (m_ShutdownTimer < 30 * MINUTE && (m_ShutdownTimer % (5 * MINUTE)) == 0) || // < 30 min ; every 5 min
2762 (m_ShutdownTimer < 12 * HOUR && (m_ShutdownTimer % HOUR) == 0) || // < 12 h ; every 1 h
2763 (m_ShutdownTimer > 12 * HOUR && (m_ShutdownTimer % (12 * HOUR)) == 0)) // > 12 h ; every 12 h
2764 {
2765 std::string str = secsToTimeString(m_ShutdownTimer);
2766
2768
2769 SendServerMessage(msgid, str.c_str(), player);
2770 SF_LOG_DEBUG("misc", "Server is %s in %s", (m_ShutdownMask & SHUTDOWN_MASK_RESTART ? "restart" : "shuttingdown"), str.c_str());
2771 }
2772}
2773
2776{
2777 // nothing cancel or too later
2779 return;
2780
2782
2783 m_ShutdownMask = 0;
2784 m_ShutdownTimer = 0;
2785 m_ExitCode = SHUTDOWN_EXIT_CODE; // to default value
2786 SendServerMessage(msgid);
2787
2788 SF_LOG_DEBUG("misc", "Server %s cancelled.", (m_ShutdownMask & SHUTDOWN_MASK_RESTART ? "restart" : "shuttingdown"));
2789
2790 sScriptMgr->OnShutdownCancel();
2791}
2792
2794void World::SendServerMessage(ServerMessageType type, const char* text, Player* player)
2795{
2796 WorldPacket data(SMSG_SERVER_MESSAGE, 50); // guess size
2797 data << uint32(type);
2798 if (type <= SERVER_MSG_STRING)
2799 data << text;
2800
2801 if (player)
2802 player->GetSession()->SendPacket(&data);
2803 else
2804 SendGlobalMessage(&data);
2805}
2806
2808{
2810 WorldSession* sess = NULL;
2811 while (addSessQueue.next(sess))
2812 AddSession_(sess);
2813
2815 for (SessionMap::iterator itr = m_sessions.begin(), next; itr != m_sessions.end(); itr = next)
2816 {
2817 next = itr;
2818 ++next;
2819
2821 WorldSession* pSession = itr->second;
2822 WorldSessionFilter updater(pSession);
2823
2824 if (!pSession->Update(diff, updater)) // As interval = 0
2825 {
2827 m_disconnects[itr->second->GetAccountId()] = time(NULL);
2828 RemoveQueuedPlayer(pSession);
2829 m_sessions.erase(itr);
2830 delete pSession;
2831 }
2832 }
2833}
2834
2835// This handles the issued and queued CLI commands
2837{
2838 CliCommandHolder::Print* zprint = NULL;
2839 void* callbackArg = NULL;
2840 CliCommandHolder* command = NULL;
2841 while (cliCmdQueue.next(command))
2842 {
2843 SF_LOG_INFO("misc", "CLI command under processing...");
2844 zprint = command->m_print;
2845 callbackArg = command->m_callbackArg;
2846 CliHandler handler(callbackArg, zprint);
2847 handler.ParseCommands(command->m_command);
2848 if (command->m_commandFinished)
2849 command->m_commandFinished(callbackArg, !handler.HasSentErrorMessage());
2850 delete command;
2851 }
2852}
2853
2855{
2856 if (m_Autobroadcasts.empty())
2857 return;
2858
2859 uint32 weight = 0;
2860 AutobroadcastsWeightMap selectionWeights;
2861 std::string msg;
2862
2863 for (AutobroadcastsWeightMap::const_iterator it = m_AutobroadcastsWeights.begin(); it != m_AutobroadcastsWeights.end(); ++it)
2864 {
2865 if (it->second)
2866 {
2867 weight += it->second;
2868 selectionWeights[it->first] = it->second;
2869 }
2870 }
2871
2872 if (weight)
2873 {
2874 uint32 selectedWeight = std::rand() % (weight - 1);
2875 weight = 0;
2876 for (AutobroadcastsWeightMap::const_iterator it = selectionWeights.begin(); it != selectionWeights.end(); ++it)
2877 {
2878 weight += it->second;
2879 if (selectedWeight < weight)
2880 {
2881 msg = m_Autobroadcasts[it->first];
2882 break;
2883 }
2884 }
2885 }
2886 else
2887 msg = m_Autobroadcasts[std::rand() % m_Autobroadcasts.size()];
2888
2890
2891 if (abcenter == 0)
2892 sWorld->SendWorldText(LANG_AUTO_BROADCAST, msg.c_str());
2893 else if (abcenter == 1)
2894 {
2895 WorldPacket data(SMSG_NOTIFICATION, 2 + msg.length());
2896 data.WriteBits(msg.length(), 12);
2897 data.FlushBits();
2898 data.WriteString(msg);
2899 sWorld->SendGlobalMessage(&data);
2900 }
2901 else if (abcenter == 2)
2902 {
2903 sWorld->SendWorldText(LANG_AUTO_BROADCAST, msg.c_str());
2904
2905 WorldPacket data(SMSG_NOTIFICATION, 2 + msg.length());
2906 data.WriteBits(msg.length(), 12);
2907 data.FlushBits();
2908 data.WriteString(msg);
2909 sWorld->SendGlobalMessage(&data);
2910 }
2911
2912 SF_LOG_DEBUG("misc", "AutoBroadcast: '%s'", msg.c_str());
2913}
2914
2916{
2917 PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_COUNT);
2918 stmt->setUInt32(0, accountId);
2919 PreparedQueryResultFuture result = CharacterDatabase.AsyncQuery(stmt);
2920 m_realmCharCallbacks.push_back(result);
2921}
2922
2924{
2925 if (resultCharCount)
2926 {
2927 Field* fields = resultCharCount->Fetch();
2928 uint32 accountId = fields[0].GetUInt32();
2929 uint8 charCount = uint8(fields[1].GetUInt64());
2930
2931 for (std::map<uint32, std::string>::const_iterator itr = realmNameStore.begin(); itr != realmNameStore.end(); ++itr)
2932 {
2934 stmt->setUInt32(0, accountId);
2935 stmt->setUInt32(1, itr->first);
2936 LoginDatabase.Execute(stmt);
2937
2938 stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_REALM_CHARACTERS);
2939 stmt->setUInt8(0, charCount);
2940 stmt->setUInt32(1, accountId);
2941 stmt->setUInt32(2, itr->first);
2942 LoginDatabase.Execute(stmt);
2943 }
2944 }
2945}
2946
2948{
2949 time_t wstime = uint64(sWorld->getWorldState(WS_WEEKLY_QUEST_RESET_TIME));
2950 time_t curtime = time(NULL);
2951 m_NextWeeklyQuestReset = wstime < curtime ? curtime : time_t(wstime);
2952}
2953
2955{
2956 time_t mostRecentQuestTime;
2957
2958 QueryResult result = CharacterDatabase.Query("SELECT MAX(time) FROM character_queststatus_daily");
2959 if (result)
2960 {
2961 Field* fields = result->Fetch();
2962 mostRecentQuestTime = time_t(fields[0].GetUInt32());
2963 }
2964 else
2965 mostRecentQuestTime = 0;
2966
2967 // client built-in time for reset is 6:00 AM
2968 // FIX ME: client not show day start time
2969 time_t curTime = time(NULL);
2970 tm localTm;
2971 Skyfire::LocalTime(curTime, localTm);
2972 localTm.tm_hour = 6;
2973 localTm.tm_min = 0;
2974 localTm.tm_sec = 0;
2975
2976 // current day reset time
2977 time_t curDayResetTime = mktime(&localTm);
2978
2979 // last reset time before current moment
2980 time_t resetTime = (curTime < curDayResetTime) ? curDayResetTime - DAY : curDayResetTime;
2981
2982 // need reset (if we have quest time before last reset time (not processed by some reason)
2983 if (mostRecentQuestTime && mostRecentQuestTime <= resetTime)
2984 m_NextDailyQuestReset = mostRecentQuestTime;
2985 else // plan next reset time
2986 m_NextDailyQuestReset = (curTime >= curDayResetTime) ? curDayResetTime + DAY : curDayResetTime;
2987}
2988
2990{
2991 time_t wstime = uint64(sWorld->getWorldState(WS_MONTHLY_QUEST_RESET_TIME));
2992 time_t curtime = time(NULL);
2993 m_NextMonthlyQuestReset = wstime < curtime ? curtime : time_t(wstime);
2994}
2995
2997{
2998 time_t bgtime = uint64(sWorld->getWorldState(WS_BG_DAILY_RESET_TIME));
2999 if (!bgtime)
3000 m_NextRandomBGReset = time_t(time(NULL)); // game time not yet init
3001
3002 // generate time by config
3003 time_t curTime = time(NULL);
3004 tm localTm;
3005 Skyfire::LocalTime(curTime, localTm);
3007 localTm.tm_min = 0;
3008 localTm.tm_sec = 0;
3009
3010 // current day reset time
3011 time_t nextDayResetTime = mktime(&localTm);
3012
3013 // next reset time before current moment
3014 if (curTime >= nextDayResetTime)
3015 nextDayResetTime += DAY;
3016
3017 // normalize reset time
3018 m_NextRandomBGReset = bgtime < curTime ? nextDayResetTime - DAY : nextDayResetTime;
3019
3020 if (!bgtime)
3022}
3023
3025{
3027 if (!gtime)
3028 m_NextGuildReset = time_t(time(NULL)); // game time not yet init
3029
3030 // generate time by config
3031 time_t curTime = time(NULL);
3032 tm localTm;
3033 Skyfire::LocalTime(curTime, localTm);
3035 localTm.tm_min = 0;
3036 localTm.tm_sec = 0;
3037
3038 // current day reset time
3039 time_t nextDayResetTime = mktime(&localTm);
3040
3041 // next reset time before current moment
3042 if (curTime >= nextDayResetTime)
3043 nextDayResetTime += DAY;
3044
3045 // normalize reset time
3046 m_NextGuildReset = gtime < curTime ? nextDayResetTime - DAY : nextDayResetTime;
3047
3048 if (!gtime)
3050}
3051
3053{
3054 time_t currencytime = uint64(sWorld->getWorldState(WS_CURRENCY_RESET_TIME));
3055 if (!currencytime)
3056 m_NextCurrencyReset = time_t(time(NULL)); // game time not yet init
3057
3058 // generate time by config
3059 time_t curTime = time(NULL);
3060 tm localTm = *localtime(&curTime);
3061
3064 localTm.tm_min = 0;
3065 localTm.tm_sec = 0;
3066
3067 // current week reset time
3068 time_t nextWeekResetTime = mktime(&localTm);
3069
3070 // next reset time before current moment
3071 if (curTime >= nextWeekResetTime)
3073
3074 // normalize reset time
3075 m_NextCurrencyReset = currencytime < curTime ? nextWeekResetTime - getIntConfig(WorldIntConfigs::CONFIG_CURRENCY_RESET_INTERVAL) * DAY : nextWeekResetTime;
3076
3077 if (!currencytime)
3079}
3080
3082{
3083 SF_LOG_INFO("misc", "Daily quests reset for all characters.");
3084
3086 CharacterDatabase.Execute(stmt);
3087
3088 for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
3089 if (itr->second->GetPlayer())
3090 itr->second->GetPlayer()->ResetDailyQuestStatus();
3091
3092 // change available dailies
3093 sPoolMgr->ChangeDailyQuests();
3094}
3095
3097{
3098 CharacterDatabase.Execute("UPDATE `character_currency` SET `weekly_quantity` = 0");
3099
3100 for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
3101 if (itr->second->GetPlayer())
3102 itr->second->GetPlayer()->ResetCurrencyWeekCap();
3103
3106}
3107
3109{
3110 for (std::map<uint32, std::string>::const_iterator itr = realmNameStore.begin(); itr != realmNameStore.end(); ++itr)
3111 {
3113 stmt->setInt32(0, int32(itr->first));
3114 PreparedQueryResult result = LoginDatabase.Query(stmt);
3115
3116 if (result)
3117 SetPlayerSecurityLimit(AccountTypes(result->Fetch()->GetUInt8()));
3118 }
3119}
3120
3129
3131{
3132 SF_LOG_INFO("misc", "Weekly quests reset for all characters.");
3133
3135 CharacterDatabase.Execute(stmt);
3136
3137 for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
3138 if (itr->second->GetPlayer())
3139 itr->second->GetPlayer()->ResetWeeklyQuestStatus();
3140
3143
3144 // change available weeklies
3145 sPoolMgr->ChangeWeeklyQuests();
3146}
3147
3149{
3150 SF_LOG_INFO("misc", "Monthly quests reset for all characters.");
3151
3153 CharacterDatabase.Execute(stmt);
3154
3155 for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
3156 if (itr->second->GetPlayer())
3157 itr->second->GetPlayer()->ResetMonthlyQuestStatus();
3158
3159 // generate time
3160 time_t curTime = time(NULL);
3161 tm localTm;
3162 Skyfire::LocalTime(curTime, localTm);
3163
3164 int month = localTm.tm_mon;
3165 int year = localTm.tm_year;
3166
3167 ++month;
3168
3169 // month 11 is december, next is january (0)
3170 if (month > 11)
3171 {
3172 month = 0;
3173 year += 1;
3174 }
3175
3176 // reset time for next month
3177 localTm.tm_year = year;
3178 localTm.tm_mon = month;
3179 localTm.tm_mday = 1; // don't know if we really need config option for day / hour
3180 localTm.tm_hour = 0;
3181 localTm.tm_min = 0;
3182 localTm.tm_sec = 0;
3183
3184 time_t nextMonthResetTime = mktime(&localTm);
3185
3186 // plan next reset time
3187 m_NextMonthlyQuestReset = (curTime >= nextMonthResetTime) ? nextMonthResetTime + MONTH : nextMonthResetTime;
3188
3190}
3191
3193{
3195 stmt->setUInt16(0, event_id);
3196 CharacterDatabase.Execute(stmt);
3197
3198 for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
3199 if (itr->second->GetPlayer())
3200 itr->second->GetPlayer()->ResetSeasonalQuestStatus(event_id);
3201}
3202
3204{
3205 SF_LOG_INFO("misc", "Random BG status reset for all characters.");
3206
3208 CharacterDatabase.Execute(stmt);
3209
3210 for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
3211 if (itr->second->GetPlayer())
3212 itr->second->GetPlayer()->SetRandomWinner(false);
3213
3216}
3217
3219{
3223 week = week < 7 ? week + 1 : 1;
3224
3225 SF_LOG_INFO("misc", "Guild Daily Cap reset. Week: %u", week == 1);
3226 sWorld->setWorldState(WS_GUILD_WEEKLY_RESET_TIME, week);
3227 sGuildMgr->ResetTimes(week == 1);
3228}
3229
3235
3237{
3238 QueryResult result = WorldDatabase.Query("SELECT db_version, cache_id FROM version LIMIT 1");
3239 if (result)
3240 {
3241 Field* fields = result->Fetch();
3242
3243 m_DBVersion = fields[0].GetString();
3244 // will be overwrite by config values if different and non-0
3246 }
3247
3248 if (m_DBVersion.empty())
3249 m_DBVersion = "Unknown world database.";
3250}
3251
3253{
3254 isEventKillStart = true;
3255}
3256
3258{
3259 isEventKillStart = false;
3260}
3261
3263{
3264 SessionMap::const_iterator itr;
3265 for (itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
3266 if (itr->second && itr->second->GetPlayer() && itr->second->GetPlayer()->IsInWorld())
3267 {
3268 itr->second->GetPlayer()->UpdateAreaDependentAuras(itr->second->GetPlayer()->GetAreaId());
3269 itr->second->GetPlayer()->UpdateZoneDependentAuras(itr->second->GetPlayer()->GetZoneId());
3270 }
3271}
3272
3274{
3275 uint32 oldMSTime = getMSTime();
3276
3277 QueryResult result = CharacterDatabase.Query("SELECT entry, value FROM worldstates");
3278
3279 if (!result)
3280 {
3281 SF_LOG_INFO("server.loading", ">> Loaded 0 world states. DB table `worldstates` is empty!");
3282
3283 return;
3284 }
3285
3286 uint32 count = 0;
3287
3288 do
3289 {
3290 Field* fields = result->Fetch();
3291 m_worldstates[fields[0].GetUInt32()] = fields[1].GetUInt32();
3292 ++count;
3293 } while (result->NextRow());
3294
3295 SF_LOG_INFO("server.loading", ">> Loaded %u world states in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
3296}
3297
3298// Setting a worldstate will save it to DB
3300{
3301 WorldStatesMap::const_iterator it = m_worldstates.find(index);
3302 if (it != m_worldstates.end())
3303 {
3304 PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_WORLDSTATE);
3305
3306 stmt->setUInt32(0, uint32(value));
3307 stmt->setUInt32(1, index);
3308
3309 CharacterDatabase.Execute(stmt);
3310 }
3311 else
3312 {
3313 PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_WORLDSTATE);
3314
3315 stmt->setUInt32(0, index);
3316 stmt->setUInt32(1, uint32(value));
3317
3318 CharacterDatabase.Execute(stmt);
3319 }
3320 m_worldstates[index] = value;
3321}
3322
3324{
3325 WorldStatesMap::const_iterator it = m_worldstates.find(index);
3326 return it != m_worldstates.end() ? it->second : 0;
3327}
3328
3330{
3331 PreparedQueryResult result;
3332
3333 for (std::vector<PreparedQueryResultFuture>::iterator itr = m_realmCharCallbacks.begin(); itr != m_realmCharCallbacks.end();)
3334 {
3335 if (itr->ready())
3336 {
3337 itr->get(result);
3338 _UpdateRealmCharCount(result);
3339 itr = m_realmCharCallbacks.erase(itr);
3340 }
3341 else
3342 ++itr;
3343 }
3344}
3345
3366
3368{
3369 SF_LOG_INFO("server.loading", "Loading character name data");
3370
3371 QueryResult result = CharacterDatabase.Query("SELECT guid, name, race, gender, class, level, realm FROM characters WHERE deleteDate IS NULL");
3372 if (!result)
3373 {
3374 SF_LOG_INFO("server.loading", "No character name data loaded, empty query");
3375 return;
3376 }
3377
3378 uint32 count = 0;
3379
3380 do
3381 {
3382 Field* fields = result->Fetch();
3383 AddCharacterNameData(fields[0].GetUInt32(), fields[1].GetString(),
3384 fields[3].GetUInt8() /*gender*/, fields[2].GetUInt8() /*race*/, fields[4].GetUInt8() /*class*/, fields[5].GetUInt8() /*level*/, fields[6].GetUInt32());
3385 ++count;
3386 } while (result->NextRow());
3387
3388 SF_LOG_INFO("server.loading", "Loaded name data for %u characters", count);
3389}
3390
3391void World::AddCharacterNameData(uint32 guid, std::string const& name, uint8 gender, uint8 race, uint8 playerClass, uint8 level, uint32 realm)
3392{
3394 data.m_realm = realm;
3395 data.m_name = name;
3396 data.m_race = race;
3397 data.m_gender = gender;
3398 data.m_class = playerClass;
3399 data.m_level = level;
3400}
3401
3402void World::UpdateCharacterNameData(uint32 guid, std::string const& name, uint8 gender /*= GENDER_NONE*/, uint8 race /*= RACE_NONE*/, uint32 realm)
3403{
3404 std::map<uint32, CharacterNameData>::iterator itr = _characterNameDataMap.find(guid);
3405 if (itr == _characterNameDataMap.end())
3406 return;
3407
3408 itr->second.m_realm = realm;
3409 itr->second.m_name = name;
3410
3411 if (gender != GENDER_NONE)
3412 itr->second.m_gender = gender;
3413
3414 if (race != RACE_NONE)
3415 itr->second.m_race = race;
3416}
3417
3419{
3420 std::map<uint32, CharacterNameData>::iterator itr = _characterNameDataMap.find(guid);
3421 if (itr == _characterNameDataMap.end())
3422 return;
3423
3424 itr->second.m_level = level;
3425}
3426
3428{
3429 std::map<uint32, CharacterNameData>::const_iterator itr = _characterNameDataMap.find(guid);
3430 if (itr != _characterNameDataMap.end())
3431 return &itr->second;
3432 else
3433 return NULL;
3434}
3435
3437{
3438 // Passive reload, we mark the data as invalidated and next time a permission is checked it will be reloaded
3439 SF_LOG_INFO("rbac", "World::ReloadRBAC()");
3440 for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
3441 if (WorldSession* session = itr->second)
3442 session->InvalidateRBACData();
3443}
#define sAccountMgr
Definition AccountMgr.h:85
#define sAchievementMgr
#define sAuctionMgr
#define BATTLE_PET_MAX_LEVEL
Definition BattlePet.h:12
#define BATTLE_PET_MAX_LOADOUT_SLOTS
#define sBattlePetSpawnMgr
#define sBattlefieldMgr
#define WS_CURRENCY_RESET_TIME
#define sBattlegroundMgr
#define sBlackMarketMgr
#define sCalendarMgr
@ CHAR_INS_CHARACTER_BAN
@ CHAR_SEL_GUID_BY_NAME
@ CHAR_UPD_CHARACTER_BAN
@ CHAR_SEL_ACCOUNT_BY_NAME
@ CHAR_SEL_CHARACTER_COUNT
@ CHAR_DEL_QUEST_STATUS_WEEKLY
@ CHAR_DEL_QUEST_STATUS_SEASONAL
@ CHAR_INS_WORLDSTATE
@ CHAR_DEL_QUEST_STATUS_MONTHLY
@ CHAR_DEL_QUEST_STATUS_DAILY
@ CHAR_DEL_OLD_CORPSES
@ CHAR_UPD_WORLDSTATE
@ CHAR_DEL_BATTLEGROUND_RANDOM
#define sCinematicSequenceMgr
Singleton.
char const * localeNames[TOTAL_LOCALES]
Definition Common.cpp:8
#define vsnprintf
Definition Common.h:100
const uint8 TOTAL_LOCALES
Definition Common.h:153
LocaleConstant
Definition Common.h:138
@ LOCALE_enUS
Definition Common.h:139
@ IN_MILLISECONDS
Definition Common.h:125
@ MINUTE
Definition Common.h:119
@ HOUR
Definition Common.h:120
@ DAY
Definition Common.h:121
@ MONTH
Definition Common.h:123
@ WEEK
Definition Common.h:122
AccountTypes
Definition Common.h:129
@ SEC_ADMINISTRATOR
Definition Common.h:133
#define sConditionMgr
#define sConfigMgr
Definition Config.h:64
#define sFormationMgr
#define sCreatureTextMgr
void LoadDB2Stores(std::string const &dataPath)
@ DEFAULT_MAX_LEVEL
Definition DBCEnums.h:16
@ MAX_LEVEL
Definition DBCEnums.h:20
void LoadDBCStores(const std::string &dataPath)
std::int32_t int32
Definition Define.h:73
#define UI64FMTD
Definition Define.h:64
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
std::uint64_t uint64
Definition Define.h:76
std::uint16_t uint16
Definition Define.h:78
#define ASSERT
Definition Errors.h:29
#define sGameEventMgr
void LoadGameObjectModelList(std::string const &dataPath)
void StartEluna(bool restart)
Definition LuaEngine.cpp:41
#define MIN_GRID_DELAY
Definition GridDefines.h:31
#define MIN_MAP_UPDATE_DELAY
Definition GridDefines.h:32
#define sGroupMgr
Definition GroupMgr.h:44
#define sGuildFinderMgr
#define sGuildMgr
Definition GuildMgr.h:53
#define sInstanceSaveMgr
void LoadRandomEnchantmentsTable()
#define sLFGMgr
Definition LFGMgr.h:518
@ LANG_AUTO_BROADCAST
Definition Language.h:1236
#define SF_LOG_DEBUG(filterType__,...)
Definition Log.h:134
#define SF_LOG_WARN(filterType__,...)
Definition Log.h:140
#define SF_LOG_ERROR(filterType__,...)
Definition Log.h:143
#define SF_LOG_INFO(filterType__,...)
Definition Log.h:137
#define sLog
Definition Log.h:106
@ LOGIN_INS_ACCOUNT_BANNED
@ LOGIN_SEL_ACCOUNT_BY_IP
@ LOGIN_UPD_UPTIME_PLAYERS
@ LOGIN_DEL_IP_NOT_BANNED
@ LOGIN_INS_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_REALM_CHARACTERS_BY_REALM
@ LOGIN_DEL_OLD_LOGS
void LoadLootTables()
Definition LootMgr.h:406
#define sMapMgr
Definition MapManager.h:145
void dtCustomFree(void *ptr)
Definition Memory.h:17
void * dtCustomAlloc(int size, dtAllocHint)
Definition Memory.h:12
#define DEFAULT_VISIBILITY_NOTIFY_PERIOD
Definition NGrid.h:17
#define MAX_VISIBILITY_DISTANCE
Definition Object.h:23
#define DEFAULT_VISIBILITY_DISTANCE
Definition Object.h:25
#define CONTACT_DISTANCE
Definition Object.h:20
#define DEFAULT_VISIBILITY_BGARENAS
Definition Object.h:27
#define NOMINAL_MELEE_RANGE
Definition Object.h:32
#define DEFAULT_VISIBILITY_INSTANCE
Definition Object.h:26
#define sObjectAccessor
#define MAX_PLAYER_NAME
Definition ObjectMgr.h:620
#define MAX_CHARTER_NAME
Definition ObjectMgr.h:623
#define sObjectMgr
Definition ObjectMgr.h:1617
#define MAX_PET_NAME
Definition ObjectMgr.h:622
#define sOutdoorPvPMgr
#define MAX_MONEY_AMOUNT
Definition Player.h:927
#define sPoolMgr
Definition PoolMgr.h:154
Skyfire::Future< PreparedQueryResult > PreparedQueryResultFuture
Skyfire::AutoPtr< PreparedResultSet, Skyfire::Mutex > PreparedQueryResult
Definition QueryResult.h:94
Skyfire::AutoPtr< ResultSet, Skyfire::Mutex > QueryResult
Definition QueryResult.h:48
#define sScriptMgr
Definition ScriptMgr.h:764
@ GENDER_NONE
BanReturn
Ban function return codes.
@ BAN_SYNTAX_ERROR
@ BAN_NOTFOUND
@ BAN_SUCCESS
#define CHARACTER_BOOST_BONUS_TEXT2
@ CHARACTER_BOOST_ALLOW
@ CHARACTER_BOOST
@ CHARACTER_BOOST_TEXT_ID
@ GUILD_BANKLOG_MAX_RECORDS
@ GUILD_EVENTLOG_MAX_RECORDS
@ GUILD_NEWSLOG_MAX_RECORDS
@ RACE_NONE
BanMode
Ban function modes.
@ BAN_ACCOUNT
@ BAN_IP
@ BAN_CHARACTER
#define CHARACTER_BOOST_BONUS_TEXT
void LoadSkillDiscoveryTable()
void LoadSkillExtraItemTable()
#define sSmartWaypointMgr
#define sSmartScriptMgr
#define sSpellMgr
Definition SpellMgr.h:744
#define sTicketMgr
Definition TicketMgr.h:117
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition Timer.h:22
uint32 getMSTime()
Definition Timer.h:12
uint32 getMSTimeDiff(uint32 oldMSTime, uint32 newMSTime)
Definition Timer.h:17
Skyfire::AutoPtr< Transaction, Skyfire::Mutex > SQLTransaction
Definition Transaction.h:42
#define sTransportMgr
float baseMoveSpeed[MAX_MOVE_TYPE]
Definition Unit.cpp:56
float playerBaseMoveSpeed[MAX_MOVE_TYPE]
Definition Unit.cpp:69
#define MAX_MOVE_TYPE
Definition Unit.h:566
uint32 TimeStringToSecs(const std::string &timestring)
Definition Util.cpp:181
std::string secsToTimeString(uint64 timeInSecs, bool shortText, bool hoursOnly)
Definition Util.cpp:127
#define sWardenCheckMgr
#define sWaypointMgr
void LoadGameObjectModelList(std::string const &dataPath)
static uint32 GetId(std::string const &username)
void WriteString(std::string const &str)
Definition ByteBuffer.h:578
void WriteBits(T value, size_t bits)
Definition ByteBuffer.h:192
void FlushBits()
Definition ByteBuffer.h:154
static void CleanOldChannelsInDB()
Definition Channel.cpp:125
bool ParseCommands(const char *text)
Definition Chat.cpp:388
bool HasSentErrorMessage() const
Definition Chat.h:113
static size_t BuildChatPacket(WorldPacket &data, ChatMsg chatType, Language language, ObjectGuid senderGUID, ObjectGuid receiverGUID, std::string const &message, uint8 chatTag, std::string const &senderName="", std::string const &receiverName="", uint32 achievementId=0, bool gmMessage=false, std::string const &channelName="", std::string const &addonPrefix="")
Definition Chat.cpp:580
static char * LineFromMessage(char *&pos)
Definition Chat.h:56
Definition Field.h:16
uint8 GetUInt8() const
Definition Field.h:26
std::string GetString() const
Definition Field.h:228
uint32 GetUInt32() const
Definition Field.h:105
static void clear()
static bool ExistMapAndVMap(uint32 mapid, float x, float y)
bool IsInWorld() const
Definition Object.h:114
uint32 GetGUIDLow() const
Definition Object.h:120
uint32 GetTeam() const
Definition Player.h:2527
static void DeleteOldCharacters()
Definition Player.cpp:5113
WorldSession * GetSession() const
Definition Player.h:2417
void setString(const uint8 index, const std::string &value)
void setUInt16(const uint8 index, const uint16 value)
void setUInt32(const uint8 index, const uint32 value)
void setUInt8(const uint8 index, const uint8 value)
void setInt32(const uint8 index, const int32 value)
std::vector< WorldPacket * > WorldPacketList
Definition World.cpp:2361
char * lineFromMessage(char *&pos)
Definition World.cpp:2383
void operator()(WorldPacketList &data_list, LocaleConstant loc_idx)
Definition World.cpp:2363
void do_helper(WorldPacketList &data_list, char *text)
Definition World.cpp:2384
WorldWorldTextBuilder(int32 textId, va_list *args=NULL)
Definition World.cpp:2362
static Player * GetPlayer(WorldObject &object, uint64 guid)
Definition Unit.cpp:4900
void setEnableLineOfSightCalc(bool pVal)
void setEnableHeightCalc(bool pVal)
static IVMapManager * createOrGetVMapManager()
static void clear()
time_t m_NextWeeklyQuestReset
Definition World.h:876
void SetFloatConfig(WorldFloatConfigs index, float value)
Set a server configuration element (see WorldConfigs).
Definition World.h:704
void SendZoneText(uint32 zone, const char *text, WorldSession *self=0, uint32 team=0)
Send a System Message to all players in the zone (except self if mentioned).
Definition World.cpp:2483
bool RemoveBanCharacter(std::string const &name)
Remove a ban from a character.
Definition World.cpp:2664
void UpdateSessions(uint32 diff)
Definition World.cpp:2807
void InitCurrencyResetTime()
Definition World.cpp:3052
uint32 getIntConfig(WorldIntConfigs index) const
Get a server configuration element (see WorldConfigs).
Definition World.h:731
LocaleConstant m_defaultDbcLocale
Definition World.h:856
void ProcessStartEvent()
Definition World.cpp:3252
SessionMap m_sessions
Definition World.h:838
bool RemoveBanAccount(BanMode mode, std::string const &nameOrIP)
Remove a ban from an account or IP address.
Definition World.cpp:2594
void AddSession_(WorldSession *s)
Definition World.cpp:226
static float m_MaxVisibleDistanceInBGArenas
Definition World.h:865
void LoadCharacterNameData()
Loads several pieces of information on server startup with the low GUID There is no further database ...
Definition World.cpp:3367
AccountTypes m_allowedSecurityLevel
Definition World.h:855
time_t m_startTime
Definition World.h:829
void LoadConfigSettings(bool reload=false)
Initialize config values.
Definition World.cpp:402
void _UpdateGameTime()
Update the game time.
Definition World.cpp:2694
std::string m_dataPath
Definition World.h:860
void AddCharacterNameData(uint32 guid, std::string const &name, uint8 gender, uint8 race, uint8 playerClass, uint8 level, uint32 realm)
Definition World.cpp:3391
void KickAllLess(AccountTypes sec)
Kick (and save) all players with security level less sec.
Definition World.cpp:2501
void ShutdownMsg(bool show=false, Player *player=NULL)
Display a shutdown message to the user(s).
Definition World.cpp:2751
void ShutdownServ(uint32 time, uint32 options, uint8 exitcode)
Shutdown the server.
Definition World.cpp:2723
void SendZoneMessage(uint32 zone, WorldPacket *packet, WorldSession *self=0, uint32 team=0)
Send a packet to all players (or players selected team) in the zone (except self if mentioned).
Definition World.cpp:2465
void SetNewCharString(std::string const &str)
Set the string for new characters (first login).
Definition World.h:624
void SendWorldText(int32 string_id,...)
Send a System Message to all players (except self if mentioned).
Definition World.cpp:2402
uint32 m_updateTimeSum
Definition World.h:834
Queue m_QueuedPlayer
Definition World.h:883
void UpdateRealmCharCount(uint32 accid)
Definition World.cpp:2915
void LoadDBAllowedSecurityLevel()
Definition World.cpp:3108
uint32 m_updateTime
Definition World.h:834
Skyfire::LockedQueue< CliCommandHolder *, Skyfire::Mutex > cliCmdQueue
Definition World.h:872
void SendGMText(int32 string_id,...)
Send a System Message to all GMs (except self if mentioned).
Definition World.cpp:2421
void LoadDBVersion()
Definition World.cpp:3236
bool HasRecentlyDisconnected(WorldSession *)
Definition World.cpp:299
void AddQueuedPlayer(WorldSession *)
Definition World.cpp:332
void ResetCurrencyWeekCap()
Definition World.cpp:3096
uint32 GetQueuedSessionCount() const
Definition World.h:573
static float m_MaxVisibleDistanceInInstances
Definition World.h:864
void UpdateMaxSessionCounters()
Get the number of current active sessions.
Definition World.cpp:3230
void setRate(Rates rate, float value)
Set a server rate (see Rates).
Definition World.h:681
uint32 m_CleaningFlags
Definition World.h:825
uint32 m_maxActiveSessionCount
Definition World.h:841
void SetInitialWorldSettings()
Initialize the World.
Definition World.cpp:1370
void ResetMonthlyQuests()
Definition World.cpp:3148
static int32 m_visibility_notify_periodInBGArenas
Definition World.h:869
std::map< uint32, CharacterNameData > _characterNameDataMap
Definition World.h:898
time_t m_NextDailyQuestReset
Definition World.h:875
uint32 m_PlayerCount
Definition World.h:843
void InitDailyQuestResetTime()
Definition World.cpp:2954
void ShutdownCancel()
Cancel a planned server shutdown.
Definition World.cpp:2775
bool IsFFAPvPRealm() const
Definition World.h:745
Skyfire::LockedQueue< WorldSession *, Skyfire::Mutex > addSessQueue
Definition World.h:887
time_t m_NextCurrencyReset
Definition World.h:880
void ResetGuildCap()
Definition World.cpp:3218
bool RemoveSession(uint32 id)
Remove a given session.
Definition World.cpp:205
time_t m_NextRandomBGReset
Definition World.h:878
Player * FindPlayerInZone(uint32 zone)
Find a player in a specified zone.
Definition World.cpp:146
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:2623
float getRate(Rates rate) const
Get a server rate (see Rates).
Definition World.h:683
void SetBoolConfig(WorldBoolConfigs index, bool value)
Set a server configuration element (see WorldConfigs).
Definition World.h:686
void InitGuildResetTime()
Definition World.cpp:3024
std::string m_DBVersion
Definition World.h:890
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:2510
AutobroadcastsMap m_Autobroadcasts
Definition World.h:893
bool GetBoolConfig(WorldBoolConfigs index) const
Get a server configuration element (see WorldConfigs).
Definition World.h:695
time_t mail_timer_expires
Definition World.h:833
CharacterNameData const * GetCharacterNameData(uint32 guid) const
Definition World.cpp:3427
void InitRandomBGResetTime()
Definition World.cpp:2996
~World()
World destructor.
Definition World.cpp:125
void setWorldState(uint32 index, uint64 value)
Definition World.cpp:3299
void ResetWeeklyQuests()
Definition World.cpp:3130
void _UpdateRealmCharCount(PreparedQueryResult resultCharCount)
Definition World.cpp:2923
uint32 GetActiveSessionCount() const
Definition World.h:572
DisconnectMap m_disconnects
Definition World.h:840
static uint8 m_ExitCode
Definition World.h:821
void ReloadRBAC()
Definition World.cpp:3436
uint32 m_availableDbcLocaleMask
Definition World.h:857
void LoadWorldStates()
Definition World.cpp:3273
time_t mail_timer
Definition World.h:832
const char * GetMotd() const
Get the current Message of the Day.
Definition World.cpp:188
void UpdateCharacterNameData(uint32 guid, std::string const &name, uint8 gender=GENDER_NONE, uint8 race=RACE_NONE, uint32 realm=-1)
Definition World.cpp:3402
void ResetRandomBG()
Definition World.cpp:3203
uint32 m_ShutdownMask
Definition World.h:823
time_t m_NextGuildReset
Definition World.h:879
void SetPlayerSecurityLimit(AccountTypes sec)
Definition World.cpp:3121
std::vector< PreparedQueryResultFuture > m_realmCharCallbacks
Definition World.h:902
bool IsClosed() const
Deny clients?
Definition World.cpp:168
uint32 m_ShutdownTimer
Definition World.h:822
void RecordTimeDiff(const char *text,...)
Definition World.cpp:2026
void KickAll()
Kick (and save) all players.
Definition World.cpp:2491
uint32 GetPlayerAmountLimit() const
Definition World.h:603
void AddSession(WorldSession *s)
Definition World.cpp:221
time_t m_gameTime
Definition World.h:830
void InitWeeklyQuestResetTime()
Definition World.cpp:2947
void ResetEventSeasonalQuests(uint16 event_id)
Definition World.cpp:3192
void ForceGameEventUpdate()
Definition World.cpp:2310
bool isEventKillStart
Definition World.h:787
void ResetDailyQuests()
Definition World.cpp:3081
void ProcessQueryCallbacks()
Definition World.cpp:3329
uint64 getWorldState(uint32 index) const
Definition World.cpp:3323
void SendGlobalMessage(WorldPacket *packet, WorldSession *self=0, uint32 team=0)
Send a packet to all players (except self if mentioned).
Definition World.cpp:2319
uint32 m_MaxPlayerCount
Definition World.h:844
void setIntConfig(WorldIntConfigs index, uint32 value)
Set a server configuration element (see WorldConfigs).
Definition World.h:722
WorldStatesMap m_worldstates
Definition World.h:853
LocaleConstant GetDefaultDbcLocale() const
Definition World.h:628
static int32 m_visibility_notify_periodInInstances
Definition World.h:868
void SendGlobalGMMessage(WorldPacket *packet, WorldSession *self=0, uint32 team=0)
Send a packet to all GMs (except self if mentioned).
Definition World.cpp:2336
static std::atomic< bool > m_stopEvent
Definition World.h:820
uint32 GetActiveAndQueuedSessionCount() const
Definition World.h:571
WorldSession * FindSession(uint32 id) const
Find a session by its id.
Definition World.cpp:194
void SendServerMessage(ServerMessageType type, const char *text="", Player *player=NULL)
Send a server message to the user(s).
Definition World.cpp:2794
int32 GetQueuePos(WorldSession *)
Definition World.cpp:321
bool RemoveQueuedPlayer(WorldSession *session)
Definition World.cpp:341
void UpdateAreaDependentAuras()
Definition World.cpp:3262
bool m_isClosed
Definition World.h:827
void SetMotd(std::string const &motd)
Set a new Message of the Day.
Definition World.cpp:181
uint32 GetMaxPlayerCount() const
Definition World.h:579
void UpdateCharacterNameDataLevel(uint32 guid, uint8 level)
Definition World.cpp:3418
IntervalTimer m_timers[WUPDATE_COUNT]
Definition World.h:831
void SendGlobalText(const char *text, WorldSession *self)
DEPRECATED, only for debug purpose. Send a System Message to all players (except self if mentioned).
Definition World.cpp:2447
static bool IsStopped()
Definition World.h:675
time_t m_NextMonthlyQuestReset
Definition World.h:877
uint32 m_maxQueuedSessionCount
Definition World.h:842
static float m_MaxVisibleDistanceOnContinents
Definition World.h:863
void InitMonthlyQuestResetTime()
Definition World.cpp:2989
void SendAutoBroadcast()
Definition World.cpp:2854
void Update(uint32 diff)
Update the World !
Definition World.cpp:2090
uint32 m_currentTime
Definition World.h:836
uint32 m_playerLimit
Definition World.h:854
void LoadAutobroadcasts()
Definition World.cpp:2052
std::map< uint8, uint8 > AutobroadcastsWeightMap
Definition World.h:895
void SetPlayerAmountLimit(uint32 limit)
Active session server limit.
Definition World.h:602
void ProcessStopEvent()
Definition World.cpp:3257
bool m_allowMovement
Definition World.h:858
AutobroadcastsWeightMap m_AutobroadcastsWeights
Definition World.h:896
static std::atomic< uint32 > m_worldLoopCounter
Definition World.h:559
void ProcessCliCommands()
Definition World.cpp:2836
uint32 m_updateTimeCount
Definition World.h:835
void SetClosed(bool val)
Close world.
Definition World.cpp:173
World()
World constructor.
Definition World.cpp:96
static int32 m_visibility_notify_periodOnContinents
Definition World.h:867
std::string m_motd
Definition World.h:859
uint32 GetZoneId() const
Definition Object.cpp:1597
Player session in the World.
bool Update(uint32 diff, PacketFilter &updater)
Update the WorldSession (triggered by World update).
void KickPlayer()
Kick a player out of the World.
bool HasBoost() const
void SendClientCacheVersion(uint32 version)
void SendAuthWaitQue(uint32 position)
Handle the authentication waiting queue (to be completed).
Player * GetPlayer() const
void SendAddonsInfo()
void SetInQueue(bool state)
Session in auth.queue currently.
bool HasPermission(uint32 permissionId)
void SendTimezoneInformation()
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
uint32 GetAccountId() const
void SendAuthResponse(ResponseCodes code, bool queued, uint32 queuePos=0)
void SendTutorialsData()
void ResetTimeOutTime()
void SendAccountDataTimes(uint32 mask)
void SendBattlePayDistributionUpdate(uint64 playerGuid, int8 bonusId, int32 bonusFlag, int32 textId, std::string const &bonusText, std::string const &bonusText2)
void SendFeatureSystemStatusGlueScreen()
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition Main.cpp:41
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition Main.cpp:40
OpcodeTable clientOpcodeTable
Definition Opcodes.cpp:10
OpcodeTable serverOpcodeTable
Definition Opcodes.cpp:9
#define GLOBAL_CACHE_MASK
@ SMSG_NOTIFICATION
Definition Opcodes.h:835
@ SMSG_SERVER_MESSAGE
Definition Opcodes.h:949
#define sWorld
Definition World.h:910
ServerMessageType
Definition World.h:35
ShutdownMask
Definition World.h:57
ShutdownExitCode
Definition World.h:63
RealmNameMap realmNameStore
Definition Main.cpp:72
void Update(uint32 diff)
void LoadWeatherData()
@ SERVER_MSG_SHUTDOWN_TIME
Definition World.h:36
@ SERVER_MSG_STRING
Definition World.h:38
@ SERVER_MSG_SHUTDOWN_CANCELLED
Definition World.h:39
@ SERVER_MSG_RESTART_CANCELLED
Definition World.h:40
@ SERVER_MSG_RESTART_TIME
Definition World.h:37
@ WS_GUILD_DAILY_RESET_TIME
Definition World.h:516
@ WS_WEEKLY_QUEST_RESET_TIME
Definition World.h:513
@ WS_BG_DAILY_RESET_TIME
Definition World.h:514
@ WS_GUILD_WEEKLY_RESET_TIME
Definition World.h:519
@ WS_MONTHLY_QUEST_RESET_TIME
Definition World.h:517
@ SHUTDOWN_MASK_RESTART
Definition World.h:58
@ SHUTDOWN_MASK_IDLE
Definition World.h:59
@ CONFIG_WARDEN_CLIENT_FAIL_ACTION
Definition World.h:335
@ CONFIG_GUILD_RESET_HOUR
Definition World.h:320
@ CONFIG_CURRENCY_MAX_JUSTICE_POINTS
Definition World.h:231
@ CONFIG_BG_REWARD_WINNER_HONOR_FIRST
Definition World.h:355
@ CONFIG_CURRENCY_START_CONQUEST_POINTS
Definition World.h:234
@ CONFIG_AUCTION_LEVEL_REQ
Definition World.h:282
@ CONFIG_CHARDELETE_MIN_LEVEL
Definition World.h:323
@ CONFIG_INTERVAL_DISCONNECT_TOLERANCE
Definition World.h:204
@ CONFIG_INSTANCE_RESET_TIME_HOUR
Definition World.h:242
@ CONFIG_CHATFLOOD_MESSAGE_COUNT
Definition World.h:267
@ CONFIG_CHATFLOOD_MUTE_TIME
Definition World.h:269
@ CONFIG_CHARACTERS_PER_ACCOUNT
Definition World.h:219
@ CONFIG_CURRENCY_START_HONOR_POINTS
Definition World.h:232
@ CONFIG_INTERVAL_LOG_UPDATE
Definition World.h:307
@ CONFIG_ARENA_START_MATCHMAKER_RATING
Definition World.h:301
@ CONFIG_PVP_TOKEN_COUNT
Definition World.h:306
@ CONFIG_CORPSE_DECAY_NORMAL
Definition World.h:284
@ CONFIG_ARENA_START_RATING
Definition World.h:299
@ CONFIG_CHARACTER_CREATING_MIN_LEVEL_FOR_HEROIC_CHARACTER
Definition World.h:222
@ CONFIG_WARDEN_CLIENT_RESPONSE_DELAY
Definition World.h:333
@ CONFIG_CURRENCY_START_JUSTICE_POINTS
Definition World.h:230
@ CONFIG_SKILL_CHANCE_GREY
Definition World.h:260
@ CONFIG_DISABLE_BREATHING
Definition World.h:291
@ CONFIG_GUILD_WEEKLY_REP_CAP
Definition World.h:349
@ CONFIG_MIN_LEVEL_STAT_SAVE
Definition World.h:318
@ CONFIG_START_GM_LEVEL
Definition World.h:253
@ CONFIG_HONOR_AFTER_DUEL
Definition World.h:303
@ CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF
Definition World.h:273
@ CONFIG_CHATFLOOD_MESSAGE_DELAY
Definition World.h:268
@ CONFIG_ARENA_START_PERSONAL_RATING
Definition World.h:300
@ CONFIG_LFG_OPTIONSMASK
Definition World.h:331
@ CONFIG_CORPSE_DECAY_RARE
Definition World.h:285
@ CONFIG_CHARACTER_CREATING_DISABLED_RACEMASK
Definition World.h:217
@ CONFIG_CHARACTER_CREATING_DISABLED_CLASSMASK
Definition World.h:218
@ CONFIG_WINTERGRASP_RESTART_AFTER_CRASH
Definition World.h:344
@ CONFIG_LOGDB_CLEARINTERVAL
Definition World.h:312
@ CONFIG_CHARACTERS_PER_REALM
Definition World.h:220
@ CONFIG_GM_WHISPERING_TO
Definition World.h:250
@ CONFIG_WINTERGRASP_PLR_MIN_LVL
Definition World.h:341
@ CONFIG_MIN_DUALSPEC_LEVEL
Definition World.h:226
@ CONFIG_PRESERVE_CUSTOM_CHANNEL_DURATION
Definition World.h:329
@ CONFIG_CREATURE_FAMILY_ASSISTANCE_DELAY
Definition World.h:270
@ CONFIG_WARDEN_CLIENT_CHECK_HOLDOFF
Definition World.h:334
@ CONFIG_ARENA_RATED_UPDATE_TIMER
Definition World.h:297
@ CONFIG_SKILL_CHANCE_SKINNING_STEPS
Definition World.h:262
@ CONFIG_BOOST_START_MONEY
Definition World.h:367
@ CONFIG_GM_VISIBLE_STATE
Definition World.h:247
@ CONFIG_REALM_ZONE
Definition World.h:209
@ CONFIG_START_HEROIC_PLAYER_LEVEL
Definition World.h:228
@ CONFIG_BG_REWARD_WINNER_HONOR_LAST
Definition World.h:356
@ CONFIG_CHARDELETE_METHOD
Definition World.h:322
@ CONFIG_PACKET_SPOOF_BANDURATION
Definition World.h:352
@ CONFIG_PACKET_SPOOF_POLICY
Definition World.h:350
@ CONFIG_START_PLAYER_MONEY
Definition World.h:229
@ CONFIG_SKIP_CINEMATICS
Definition World.h:223
@ CONFIG_GROUP_VISIBILITY
Definition World.h:254
@ CONFIG_PERSISTENT_CHARACTER_CLEAN_FLAGS
Definition World.h:330
@ CONFIG_CHARDELETE_HEROIC_MIN_LEVEL
Definition World.h:324
@ CONFIG_CREATURE_FAMILY_FLEE_DELAY
Definition World.h:271
@ CONFIG_UPTIME_UPDATE
Definition World.h:256
@ CONFIG_CORPSE_DECAY_ELITE
Definition World.h:286
@ CONFIG_RBAC_FREE_PERMISSION_MODE
Definition World.h:354
@ CONFIG_WARDEN_NUM_MEM_CHECKS
Definition World.h:337
@ CONFIG_SKILL_GAIN_CRAFTING
Definition World.h:263
@ CONFIG_SKILL_CHANCE_YELLOW
Definition World.h:258
@ CONFIG_INTERVAL_MAPUPDATE
Definition World.h:202
@ CONFIG_CURRENCY_MAX_HONOR_POINTS
Definition World.h:233
@ CONFIG_MAX_OVERSPEED_PINGS
Definition World.h:265
@ CONFIG_MIN_PET_NAME
Definition World.h:215
@ CONFIG_START_PETBAR_LEVEL
Definition World.h:225
@ CONFIG_CURRENCY_CONQUEST_POINTS_ARENA_REWARD
Definition World.h:236
@ CONFIG_AUTOBROADCAST_INTERVAL
Definition World.h:326
@ CONFIG_BG_REWARD_WINNER_CONQUEST_LAST
Definition World.h:360
@ CONFIG_ARENA_RATING_DISCARD_TIMER
Definition World.h:296
@ CONFIG_CLIENTCACHE_VERSION
Definition World.h:314
@ CONFIG_CHARACTER_CREATING_DISABLED
Definition World.h:216
@ CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL
Definition World.h:240
@ CONFIG_BLACK_MARKET_AUCTION_DELAY_MOD
Definition World.h:366
@ CONFIG_BLACK_MARKET_MAX_AUCTIONS
Definition World.h:364
@ CONFIG_WINTERGRASP_BATTLETIME
Definition World.h:342
@ CONFIG_MIN_PETITION_SIGNS
Definition World.h:245
@ CONFIG_BOOST_START_LEVEL
Definition World.h:368
@ CONFIG_BG_REWARD_LOSER_HONOR_FIRST
Definition World.h:357
@ CONFIG_MAX_INSTANCES_PER_HOUR
Definition World.h:332
@ CONFIG_WORLD_BOSS_LEVEL_DIFF
Definition World.h:272
@ CONFIG_MAIL_DELIVERY_DELAY
Definition World.h:255
@ CONFIG_SKILL_CHANCE_ORANGE
Definition World.h:257
@ CONFIG_CORPSE_DECAY_RAREELITE
Definition World.h:287
@ CONFIG_DEATH_SICKNESS_LEVEL
Definition World.h:289
@ CONFIG_INSTANCE_UNLOAD_DELAY
Definition World.h:243
@ CONFIG_GUILD_EVENT_LOG_COUNT
Definition World.h:316
@ CONFIG_RANDOM_BG_RESET_HOUR
Definition World.h:319
@ CONFIG_MAX_PLAYER_LEVEL
Definition World.h:224
@ CONFIG_WARDEN_NUM_OTHER_CHECKS
Definition World.h:338
@ CONFIG_LOGDB_CLEARTIME
Definition World.h:313
@ CONFIG_SKILL_CHANCE_MINING_STEPS
Definition World.h:261
@ CONFIG_PVP_TOKEN_ID
Definition World.h:305
@ CONFIG_NUMTHREADS
Definition World.h:311
@ CONFIG_GUILD_NEWS_LOG_COUNT
Definition World.h:315
@ CONFIG_SKILL_CHANCE_GREEN
Definition World.h:259
@ CONFIG_BG_REWARD_LOSER_HONOR_LAST
Definition World.h:358
@ CONFIG_GM_LEVEL_IN_WHO_LIST
Definition World.h:252
@ CONFIG_INTERVAL_SAVE
Definition World.h:200
@ CONFIG_BATTLEGROUND_PREMADE_GROUP_WAIT_FOR_MATCH
Definition World.h:294
@ CONFIG_PACKET_SPOOF_BANMODE
Definition World.h:351
@ CONFIG_WINTERGRASP_PLR_MIN
Definition World.h:340
@ CONFIG_CHAT_CHANNEL_LEVEL_REQ
Definition World.h:277
@ CONFIG_ARENA_SEASON_ID
Definition World.h:298
@ CONFIG_GUILD_BANK_EVENT_LOG_COUNT
Definition World.h:317
@ CONFIG_BATTLE_PET_WILD_SPAWN_MIN_COUNT
Definition World.h:363
@ CONFIG_STRICT_PET_NAMES
Definition World.h:212
@ CONFIG_ACC_PASSCHANGESEC
Definition World.h:353
@ CONFIG_MIN_CHARTER_NAME
Definition World.h:214
@ CONFIG_GM_LOGIN_STATE
Definition World.h:246
@ CONFIG_STRICT_PLAYER_NAMES
Definition World.h:210
@ CONFIG_MAX_PRIMARY_TRADE_SKILL
Definition World.h:244
@ CONFIG_CHAT_SAY_LEVEL_REQ
Definition World.h:279
@ CONFIG_CURRENCY_RESET_DAY
Definition World.h:238
@ CONFIG_MIN_PLAYER_NAME
Definition World.h:213
@ CONFIG_GUILD_SAVE_INTERVAL
Definition World.h:345
@ CONFIG_GUILD_UNDELETABLE_LEVEL
Definition World.h:347
@ CONFIG_AUTOBROADCAST_CENTER
Definition World.h:325
@ CONFIG_BATTLE_PET_INITIAL_LEVEL
Definition World.h:362
@ CONFIG_INTERVAL_CHANGEWEATHER
Definition World.h:203
@ CONFIG_BLACK_MARKET_AUCTION_DELAY
Definition World.h:365
@ CONFIG_GUILD_DAILY_XP_CAP
Definition World.h:348
@ CONFIG_SESSION_ADD_DELAY
Definition World.h:207
@ CONFIG_BG_REWARD_WINNER_CONQUEST_FIRST
Definition World.h:359
@ CONFIG_CURRENCY_RESET_HOUR
Definition World.h:237
@ CONFIG_START_PLAYER_LEVEL
Definition World.h:227
@ CONFIG_GUILD_MAX_LEVEL
Definition World.h:346
@ CONFIG_COMPRESSION
Definition World.h:199
@ CONFIG_CORPSE_DECAY_WORLDBOSS
Definition World.h:288
@ CONFIG_SKILL_GAIN_GATHERING
Definition World.h:264
@ CONFIG_HEROIC_CHARACTERS_PER_REALM
Definition World.h:221
@ CONFIG_WINTERGRASP_PLR_MAX
Definition World.h:339
@ CONFIG_ENABLE_SINFO_LOGIN
Definition World.h:309
@ CONFIG_MAX_RESULTS_LOOKUP_COMMANDS
Definition World.h:327
@ CONFIG_WARDEN_CLIENT_BAN_DURATION
Definition World.h:336
@ CONFIG_BATTLEGROUND_INVITATION_TYPE
Definition World.h:292
@ CONFIG_WINTERGRASP_NOBATTLETIME
Definition World.h:343
@ CONFIG_TICKET_LEVEL_REQ
Definition World.h:281
@ CONFIG_BATTLEGROUND_PREMATURE_FINISH_TIMER
Definition World.h:293
@ CONFIG_GM_LEVEL_IN_GM_LIST
Definition World.h:251
@ CONFIG_QUEST_HIGH_LEVEL_HIDE_DIFF
Definition World.h:274
@ CONFIG_CURRENCY_RESET_INTERVAL
Definition World.h:239
@ CONFIG_ARENA_MAX_RATING_DIFFERENCE
Definition World.h:295
@ CONFIG_MAIL_LEVEL_REQ
Definition World.h:283
@ CONFIG_BATTLE_PET_LOADOUT_UNLOCK_COUNT
Definition World.h:361
@ CONFIG_SOCKET_TIMEOUTTIME
Definition World.h:206
@ CONFIG_MIN_LOG_UPDATE
Definition World.h:308
@ CONFIG_DB_PING_INTERVAL
Definition World.h:328
@ CONFIG_INTERVAL_GRIDCLEAN
Definition World.h:201
@ CONFIG_STRICT_CHARTER_NAMES
Definition World.h:211
@ CONFIG_CHARDELETE_KEEP_DAYS
Definition World.h:321
@ CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL_DIFFERENCE
Definition World.h:241
@ CONFIG_CHAT_WHISPER_LEVEL_REQ
Definition World.h:278
@ CONFIG_CHAT_STRICT_LINK_CHECKING_KICK
Definition World.h:276
@ CONFIG_PVP_TOKEN_MAP_TYPE
Definition World.h:304
@ CONFIG_TRADE_LEVEL_REQ
Definition World.h:280
@ CONFIG_CHAT_STRICT_LINK_CHECKING_SEVERITY
Definition World.h:275
@ CONFIG_PORT_WORLD
Definition World.h:205
@ CONFIG_TALENTS_INSPECTING
Definition World.h:116
@ CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE
Definition World.h:120
@ CONFIG_CHAT_GM_WHISPER_FILTER_BYPASS
Definition World.h:118
@ CONFIG_TICKETS_GM_ENABLED
Definition World.h:167
@ CONFIG_TICKETS_FEEDBACK_SYSTEM_ENABLED
Definition World.h:168
@ CONFIG_ENABLE_MMAPS
Definition World.h:159
@ CONFIG_INSTANCES_RESET_ANNOUNCE
Definition World.h:165
@ CONFIG_INSTANCE_IGNORE_RAID
Definition World.h:105
@ CONFIG_SKILL_MILLING
Definition World.h:110
@ CONFIG_BATTLEGROUND_CAST_DESERTER
Definition World.h:125
@ CONFIG_DETECT_POS_COLLISION
Definition World.h:114
@ CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY
Definition World.h:127
@ CONFIG_ALLOW_TWO_SIDE_TRADE
Definition World.h:101
@ CONFIG_WINTERGRASP_ENABLE
Definition World.h:160
@ CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION
Definition World.h:100
@ CONFIG_CAST_UNSTUCK
Definition World.h:106
@ CONFIG_CHATLOG_CHANNEL
Definition World.h:142
@ CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD
Definition World.h:99
@ CONFIG_ARENA_QUEUE_ANNOUNCER_ENABLE
Definition World.h:129
@ CONFIG_QUEST_IGNORE_RAID
Definition World.h:113
@ CONFIG_CHATLOG_GUILD
Definition World.h:147
@ CONFIG_ARENA_SEASON_IN_PROGRESS
Definition World.h:131
@ CONFIG_AUTOBROADCAST
Definition World.h:151
@ CONFIG_ALWAYS_MAXSKILL
Definition World.h:138
@ CONFIG_OFFHAND_CHECK_AT_SPELL_UNLEARN
Definition World.h:133
@ CONFIG_START_ALL_SPELLS
Definition World.h:135
@ CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY
Definition World.h:111
@ CONFIG_CLEAN_CHARACTER_DB
Definition World.h:93
@ CONFIG_DIE_COMMAND_MODE
Definition World.h:123
@ CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP
Definition World.h:119
@ CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL
Definition World.h:97
@ CONFIG_SKILL_PROSPECTING
Definition World.h:109
@ CONFIG_ALLOW_TWO_SIDE_INTERACTION_CALENDAR
Definition World.h:96
@ CONFIG_PDUMP_NO_OVERWRITE
Definition World.h:155
@ CONFIG_CHATLOG_ADDON
Definition World.h:149
@ CONFIG_CHATLOG_BGROUND
Definition World.h:150
@ CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE
Definition World.h:126
@ CONFIG_STATS_SAVE_ONLY_ON_LOGOUT
Definition World.h:95
@ CONFIG_UI_QUESTLEVELS_IN_DIALOGS
Definition World.h:162
@ CONFIG_GM_LOWER_SECURITY
Definition World.h:108
@ CONFIG_RESTRICTED_LFG_CHANNEL
Definition World.h:115
@ CONFIG_VMAP_INDOOR_CHECK
Definition World.h:134
@ CONFIG_BLACK_MARKET_OPEN
Definition World.h:166
@ CONFIG_START_ALL_EXPLORED
Definition World.h:136
@ CONFIG_QUEST_IGNORE_AUTO_ACCEPT
Definition World.h:156
@ CONFIG_ALL_TAXI_PATHS
Definition World.h:102
@ CONFIG_BG_XP_FOR_KILL
Definition World.h:128
@ CONFIG_PDUMP_NO_PATHS
Definition World.h:154
@ CONFIG_ARENA_QUEUE_ANNOUNCER_PLAYERONLY
Definition World.h:130
@ CONFIG_CHATLOG_WHISPER
Definition World.h:143
@ CONFIG_CHAT_FAKE_MESSAGE_PREVENTING
Definition World.h:117
@ CONFIG_DEATH_BONES_WORLD
Definition World.h:121
@ CONFIG_DURABILITY_LOSS_IN_PVP
Definition World.h:90
@ CONFIG_DECLINED_NAMES_USED
Definition World.h:124
@ CONFIG_STATS_LIMITS_ENABLE
Definition World.h:164
@ CONFIG_PRESERVE_CUSTOM_CHANNELS
Definition World.h:153
@ CONFIG_INSTANT_TAXI
Definition World.h:103
@ CONFIG_GRID_UNLOAD
Definition World.h:94
@ CONFIG_QUEST_IGNORE_AUTO_COMPLETE
Definition World.h:157
@ CONFIG_ARENA_LOG_EXTENDED_INFO
Definition World.h:132
@ CONFIG_ADDON_CHANNEL
Definition World.h:91
@ CONFIG_SHOW_KICK_IN_WORLD
Definition World.h:141
@ CONFIG_INSTANCE_IGNORE_LEVEL
Definition World.h:104
@ CONFIG_CHATLOG_RAID
Definition World.h:146
@ CONFIG_EVENT_ANNOUNCE
Definition World.h:163
@ CONFIG_CHATLOG_PUBLIC
Definition World.h:148
@ CONFIG_START_ALL_REP
Definition World.h:137
@ CONFIG_CHATLOG_SYSCHAN
Definition World.h:144
@ CONFIG_WARDEN_ENABLED
Definition World.h:158
@ CONFIG_BOOST_NEW_ACCOUNT
Definition World.h:169
@ CONFIG_DBC_ENFORCE_ITEM_ATTRIBUTES
Definition World.h:152
@ CONFIG_CHATLOG_PARTY
Definition World.h:145
@ CONFIG_NO_RESET_TALENT_COST
Definition World.h:140
@ CONFIG_ALLOW_GM_GROUP
Definition World.h:107
@ CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP
Definition World.h:98
@ CONFIG_GUILD_LEVELING_ENABLED
Definition World.h:161
@ CONFIG_PVP_TOKEN_ENABLE
Definition World.h:139
@ CONFIG_DEATH_BONES_BG_OR_ARENA
Definition World.h:122
@ REALM_ZONE_RUSSIAN
Definition World.h:483
@ REALM_ZONE_DEVELOPMENT
Definition World.h:472
@ SHUTDOWN_EXIT_CODE
Definition World.h:64
@ WUPDATE_DELETECHARS
Definition World.h:80
@ WUPDATE_GUILDSAVE
Definition World.h:82
@ WUPDATE_COUNT
Definition World.h:84
@ WUPDATE_CLEANDB
Definition World.h:77
@ WUPDATE_CORPSES
Definition World.h:75
@ WUPDATE_PINGDB
Definition World.h:81
@ WUPDATE_AUTOBROADCAST
Definition World.h:78
@ WUPDATE_UPTIME
Definition World.h:74
@ WUPDATE_WEATHERS
Definition World.h:73
@ WUPDATE_EVENTS
Definition World.h:76
@ WUPDATE_BLACK_MARKET
Definition World.h:83
@ WUPDATE_AUCTIONS
Definition World.h:72
@ RATE_REPUTATION_GAIN
Definition World.h:402
@ RATE_REPUTATION_RECRUIT_A_FRIEND_BONUS
Definition World.h:406
@ RATE_REPUTATION_LFG_BONUS
Definition World.h:403
@ RATE_REST_INGAME
Definition World.h:423
@ RATE_XP_QUEST
Definition World.h:398
@ RATE_POWER_RUNICPOWER_INCOME
Definition World.h:380
@ RATE_REPUTATION_LOWLEVEL_KILL
Definition World.h:404
@ RATE_POWER_RAGE_LOSS
Definition World.h:379
@ RATE_DROP_ITEM_ARTIFACT
Definition World.h:393
@ RATE_CREATURE_ELITE_RARE_SPELLDAMAGE
Definition World.h:421
@ RATE_DURABILITY_LOSS_DAMAGE
Definition World.h:435
@ RATE_CREATURE_ELITE_WORLDBOSS_HP
Definition World.h:410
@ RATE_XP_KILL
Definition World.h:397
@ RATE_POWER_MANA
Definition World.h:377
@ RATE_POWER_DEMONICFURY_LOSS
Definition World.h:382
@ RATE_MOVESPEED
Definition World.h:439
@ RATE_XP_GUILD_MODIFIER
Definition World.h:399
@ RATE_XP_EXPLORE
Definition World.h:400
@ RATE_AUCTION_CUT
Definition World.h:429
@ RATE_CREATURE_ELITE_RAREELITE_DAMAGE
Definition World.h:414
@ RATE_CREATURE_ELITE_RAREELITE_HP
Definition World.h:409
@ RATE_DROP_ITEM_NORMAL
Definition World.h:388
@ RATE_DURABILITY_LOSS_PARRY
Definition World.h:436
@ RATE_DURABILITY_LOSS_ABSORB
Definition World.h:437
@ RATE_CREATURE_NORMAL_SPELLDAMAGE
Definition World.h:417
@ RATE_DURABILITY_LOSS_BLOCK
Definition World.h:438
@ RATE_CREATURE_ELITE_ELITE_HP
Definition World.h:408
@ RATE_CREATURE_ELITE_WORLDBOSS_SPELLDAMAGE
Definition World.h:420
@ RATE_POWER_ENERGY
Definition World.h:384
@ RATE_CREATURE_NORMAL_DAMAGE
Definition World.h:412
@ RATE_AUCTION_DEPOSIT
Definition World.h:428
@ RATE_CREATURE_AGGRO
Definition World.h:422
@ RATE_CREATURE_NORMAL_HP
Definition World.h:407
@ RATE_CREATURE_ELITE_RARE_HP
Definition World.h:411
@ RATE_DROP_ITEM_REFERENCED
Definition World.h:394
@ RATE_DROP_ITEM_LEGENDARY
Definition World.h:392
@ RATE_CORPSE_DECAY_LOOTED
Definition World.h:431
@ RATE_POWER_RUNICPOWER_LOSS
Definition World.h:381
@ RATE_CREATURE_ELITE_ELITE_DAMAGE
Definition World.h:413
@ RATE_DROP_ITEM_REFERENCED_AMOUNT
Definition World.h:395
@ RATE_AUCTION_TIME
Definition World.h:427
@ RATE_REST_OFFLINE_IN_TAVERN_OR_CITY
Definition World.h:424
@ RATE_DROP_ITEM_POOR
Definition World.h:387
@ RATE_CREATURE_ELITE_RAREELITE_SPELLDAMAGE
Definition World.h:419
@ RATE_HEALTH
Definition World.h:376
@ RATE_HONOR
Definition World.h:430
@ RATE_REPAIRCOST
Definition World.h:401
@ RATE_DROP_ITEM_RARE
Definition World.h:390
@ RATE_INSTANCE_RESET_TIME
Definition World.h:432
@ RATE_CREATURE_ELITE_WORLDBOSS_DAMAGE
Definition World.h:415
@ RATE_SKILL_DISCOVERY
Definition World.h:386
@ RATE_DAMAGE_FALL
Definition World.h:426
@ RATE_REPUTATION_LOWLEVEL_QUEST
Definition World.h:405
@ RATE_POWER_CHI
Definition World.h:385
@ RATE_DROP_MONEY
Definition World.h:396
@ RATE_TARGET_POS_RECALCULATION_RANGE
Definition World.h:433
@ RATE_CREATURE_ELITE_RARE_DAMAGE
Definition World.h:416
@ RATE_DROP_ITEM_UNCOMMON
Definition World.h:389
@ RATE_DROP_ITEM_EPIC
Definition World.h:391
@ RATE_POWER_FOCUS
Definition World.h:383
@ RATE_REST_OFFLINE_IN_WILDERNESS
Definition World.h:425
@ RATE_DURABILITY_LOSS_ON_DEATH
Definition World.h:434
@ RATE_POWER_RAGE_INCOME
Definition World.h:378
@ RATE_CREATURE_ELITE_ELITE_SPELLDAMAGE
Definition World.h:418
@ CONFIG_STATS_LIMITS_PARRY
Definition World.h:191
@ CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS
Definition World.h:187
@ CONFIG_CREATURE_FAMILY_FLEE_ASSISTANCE_RADIUS
Definition World.h:186
@ CONFIG_LISTEN_RANGE_YELL
Definition World.h:185
@ CONFIG_STATS_LIMITS_DODGE
Definition World.h:190
@ CONFIG_LISTEN_RANGE_TEXTEMOTE
Definition World.h:184
@ CONFIG_CHANCE_OF_GM_SURVEY
Definition World.h:189
@ CONFIG_STATS_LIMITS_CRIT
Definition World.h:193
@ CONFIG_LISTEN_RANGE_SAY
Definition World.h:183
@ CONFIG_LOOT_AOE_RADIUS
Definition World.h:180
@ CONFIG_MAX_RECRUIT_A_FRIEND_DISTANCE
Definition World.h:179
@ CONFIG_GROUP_XP_DISTANCE
Definition World.h:178
@ CONFIG_STATS_LIMITS_BLOCK
Definition World.h:192
@ REALM_TYPE_PVP
Definition World.h:461
void LoadFromDB()
Definition AddonMgr.cpp:28
void CheckQuestDisables()
void LoadDisables()
RuntimeMetrics & GetRuntimeMetrics()
bool LocalTime(time_t const &time, tm &result)
Definition TimeUtils.h:57
@ RBAC_PERM_SKIP_QUEUE
Definition RBAC.h:42
@ RBAC_PERM_RECEIVE_GLOBAL_GM_TEXTMESSAGE
Definition RBAC.h:84
LoginDatabaseWorkerPool LoginDatabase
Definition Main.cpp:54
uint32 m_realm
Definition World.h:547
std::string m_name
Definition World.h:548
Storage class for commands issued for delayed execution.
Definition World.h:524
void Print(void *, const char *)
Definition World.h:525
void * m_callbackArg
Definition World.h:528
Print * m_print
Definition World.h:530
CommandFinished * m_commandFinished
Definition World.h:532
char * m_command
Definition World.h:529