Rebase resync

This commit is contained in:
Antz 2020-02-17 09:19:44 +00:00
parent a0797532e8
commit 1997c1e903
3106 changed files with 11118 additions and 627576 deletions

View file

@ -1,4 +1,4 @@
/*
/**
* This code is part of MaNGOS. Contributor & Copyright details are in AUTHORS/THANKS.
*
* This program is free software; you can redistribute it and/or modify
@ -43,13 +43,14 @@
#include "SpellMgr.h"
#include "Chat.h"
#include "DBCStores.h"
#include "DB2Stores.h"
#include "MassMailMgr.h"
#include "LootMgr.h"
#include "ItemEnchantmentMgr.h"
#include "MapManager.h"
#include "ScriptMgr.h"
#include "CreatureAIRegistry.h"
#include "Policies/SingletonImp.h"
#include "Policies/Singleton.h"
#include "BattleGround/BattleGroundMgr.h"
#include "OutdoorPvP/OutdoorPvP.h"
#include "TemporarySummon.h"
@ -67,9 +68,12 @@
#include "AuctionHouseBot/AuctionHouseBot.h"
#include "CharacterDatabaseCleaner.h"
#include "CreatureLinkingMgr.h"
#include "Calendar.h"
INSTANTIATE_SINGLETON_1(World);
extern void LoadGameObjectModelList();
volatile bool World::m_stopEvent = false;
uint8 World::m_ExitCode = SHUTDOWN_EXIT_CODE;
volatile uint32 World::m_worldLoopCounter = 0;
@ -257,12 +261,19 @@ World::AddSession_(WorldSession* s)
return;
}
WorldPacket packet(SMSG_AUTH_RESPONSE, 1 + 4 + 1 + 4 + 1);
packet << uint8(AUTH_OK);
WorldPacket packet(SMSG_AUTH_RESPONSE, 17);
packet.WriteBit(false); // has queue
packet.WriteBit(true); // has account info
packet << uint32(0); // Unknown - 4.3.2
packet << uint8(s->Expansion()); // 0 - normal, 1 - TBC, 2 - WotLK, 3 - CT. must be set in database manually for each account
packet << uint32(0); // BillingTimeRemaining
packet << uint8(0); // BillingPlanFlags
packet << uint8(s->Expansion()); // 0 - normal, 1 - TBC, 2 - WotLK, 3 - CT. Must be set in database manually for each account.
packet << uint32(0); // BillingTimeRested
packet << uint8(s->Expansion()); // 0 - normal, 1 - TBC, 2 - WotLK. Must be set in database manually for each account.
packet << uint8(0); // BillingPlanFlags
packet << uint8(AUTH_OK);
s->SendPacket(&packet);
s->SendAddonsInfo();
@ -305,17 +316,24 @@ int32 World::GetQueuedSessionPos(WorldSession* sess)
void World::AddQueuedSession(WorldSession* sess)
{
sess->SetInQueue(true);
m_QueuedSessions.push_back(sess);
m_QueuedSessions.push_back (sess);
// The 1st SMSG_AUTH_RESPONSE needs to contain other info too.
WorldPacket packet(SMSG_AUTH_RESPONSE, 1 + 4 + 1 + 4 + 1 + 4 + 1);
packet << uint8(AUTH_WAIT_QUEUE);
WorldPacket packet (SMSG_AUTH_RESPONSE, 21);
packet.WriteBit(true); // has queue
packet.WriteBit(false); // unk queue-related
packet.WriteBit(true); // has account data
packet << uint32(0); // Unknown - 4.3.2
packet << uint8(sess->Expansion()); // 0 - normal, 1 - TBC, 2 - WotLK, 3 - CT. must be set in database manually for each account
packet << uint32(0); // BillingTimeRemaining
packet << uint8(0); // BillingPlanFlags
packet << uint8(sess->Expansion()); // 0 - normal, 1 - TBC, 2 - WotLK, 3 - CT. Must be set in database manually for each account.
packet << uint32(0); // BillingTimeRested
packet << uint8(sess->Expansion()); // 0 - normal, 1 - TBC, must be set in database manually for each account
packet << uint8(0); // BillingPlanFlags
packet << uint8(AUTH_WAIT_QUEUE);
packet << uint32(GetQueuedSessionPos(sess)); // position in queue
packet << uint8(0); // unk 3.3.0
sess->SendPacket(&packet);
}
@ -568,6 +586,7 @@ void World::LoadConfigSettings(bool reload)
setConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GUILD, "AllowTwoSide.Interaction.Guild", false);
setConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_AUCTION, "AllowTwoSide.Interaction.Auction", false);
setConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_MAIL, "AllowTwoSide.Interaction.Mail", false);
setConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_CALENDAR,"AllowTwoSide.Interaction.Calendar", false);
setConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_WHO_LIST, "AllowTwoSide.WhoList", false);
setConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_ADD_FRIEND, "AllowTwoSide.AddFriend", false);
@ -627,7 +646,7 @@ void World::LoadConfigSettings(bool reload)
setConfigMinMax(CONFIG_UINT32_TRADE_SKILL_GMIGNORE_LEVEL, "TradeSkill.GMIgnore.Level", SEC_CONSOLE, SEC_PLAYER, SEC_CONSOLE);
setConfigMinMax(CONFIG_UINT32_TRADE_SKILL_GMIGNORE_SKILL, "TradeSkill.GMIgnore.Skill", SEC_CONSOLE, SEC_PLAYER, SEC_CONSOLE);
setConfigMinMax(CONFIG_UINT32_MIN_PETITION_SIGNS, "MinPetitionSigns", 9, 0, 9);
setConfigMinMax(CONFIG_UINT32_MIN_PETITION_SIGNS, "MinPetitionSigns", 4, 0, 4);
setConfig(CONFIG_UINT32_GM_LOGIN_STATE, "GM.LoginState", 2);
setConfig(CONFIG_UINT32_GM_VISIBLE_STATE, "GM.Visible", 2);
@ -786,6 +805,8 @@ void World::LoadConfigSettings(bool reload)
setConfigMin(CONFIG_UINT32_GUILD_EVENT_LOG_COUNT, "Guild.EventLogRecordsCount", GUILD_EVENTLOG_MAX_RECORDS, GUILD_EVENTLOG_MAX_RECORDS);
setConfigMin(CONFIG_UINT32_GUILD_BANK_EVENT_LOG_COUNT, "Guild.BankEventLogRecordsCount", GUILD_BANK_MAX_LOGS, GUILD_BANK_MAX_LOGS);
setConfig(CONGIG_UINT32_GUILD_UNDELETABLE_LEVEL, "Guild.UndeletableLevel", 4);
setConfig(CONFIG_BOOL_GUILD_LEVELING_ENABLED, "Guild.LevelingEnabled", true);
setConfig(CONFIG_UINT32_TIMERBAR_FATIGUE_GMLEVEL, "TimerBar.Fatigue.GMLevel", SEC_CONSOLE);
setConfig(CONFIG_UINT32_TIMERBAR_FATIGUE_MAX, "TimerBar.Fatigue.Max", 60);
@ -928,15 +949,17 @@ void World::SetInitialWorldSettings()
LoadConfigSettings();
///- Check the existence of the map files for all races start areas.
if (!MapManager::ExistMapAndVMap(0, -6240.32f, 331.033f) ||
!MapManager::ExistMapAndVMap(0, -8949.95f, -132.493f) ||
!MapManager::ExistMapAndVMap(0, -8949.95f, -132.493f) ||
!MapManager::ExistMapAndVMap(1, -618.518f, -4251.67f) ||
!MapManager::ExistMapAndVMap(0, 1676.35f, 1677.45f) ||
!MapManager::ExistMapAndVMap(1, 10311.3f, 832.463f) ||
!MapManager::ExistMapAndVMap(1, -2917.58f, -257.98f) ||
(m_configUint32Values[CONFIG_UINT32_EXPANSION] &&
(!MapManager::ExistMapAndVMap(530, 10349.6f, -6357.29f) || !MapManager::ExistMapAndVMap(530, -3961.64f, -13931.2f))))
if (!MapManager::ExistMapAndVMap(0, -6240.32f, 331.033f) || // Dwarf/ Gnome
!MapManager::ExistMapAndVMap(0, -8949.95f, -132.493f) || // Human
!MapManager::ExistMapAndVMap(1, -618.518f, -4251.67f) || // Orc
!MapManager::ExistMapAndVMap(0, 1676.35f, 1677.45f) || // Scourge
!MapManager::ExistMapAndVMap(1, 10311.3f, 832.463f) || // NightElf
!MapManager::ExistMapAndVMap(1, -2917.58f, -257.98f) || // Tauren
(m_configUint32Values[CONFIG_UINT32_EXPANSION] >= EXPANSION_TBC &&
(!MapManager::ExistMapAndVMap(530, 10349.6f, -6357.29f) || // BloodElf
!MapManager::ExistMapAndVMap(530, -3961.64f, -13931.2f))) || // Draenei
(m_configUint32Values[CONFIG_UINT32_EXPANSION] >= EXPANSION_WOTLK &&
!MapManager::ExistMapAndVMap(609, 2355.84f, -5664.77f))) // Death Knight
{
sLog.outError("Correct *.map files not found in path '%smaps' or *.vmtree/*.vmtile files in '%svmaps'. Please place *.map and vmap files in appropriate directories or correct the DataDir value in the mangosd.conf file.", m_dataPath.c_str(), m_dataPath.c_str());
Log::WaitBeforeContinueIfNeed();
@ -966,6 +989,7 @@ void World::SetInitialWorldSettings()
///- Load the DBC files
sLog.outString("Initialize data stores...");
LoadDBCStores(m_dataPath);
LoadDB2Stores(m_dataPath);
DetectDBCLang();
sObjectMgr.SetDBCLocaleIndex(GetDefaultDbcLocale()); // Get once for all the locale index of DBC language (console/broadcasts)
@ -1007,6 +1031,9 @@ void World::SetInitialWorldSettings()
sLog.outString("Loading Game Object Templates..."); // must be after LoadPageTexts
sObjectMgr.LoadGameobjectInfo();
sLog.outString("Loading GameObject models...");
LoadGameObjectModelList();
sLog.outString("Loading Spell Chain Data...");
sSpellMgr.LoadSpellChains();
@ -1055,12 +1082,18 @@ void World::SetInitialWorldSettings()
sLog.outString("Loading Creature templates...");
sObjectMgr.LoadCreatureTemplates();
sLog.outString("Loading Creature template spells...");
sObjectMgr.LoadCreatureTemplateSpells();
sLog.outString("Loading Creature Model for race..."); // must be after creature templates
sObjectMgr.LoadCreatureModelRace();
sLog.outString("Loading SpellsScriptTarget...");
sSpellMgr.LoadSpellScriptTarget(); // must be after LoadCreatureTemplates and LoadGameobjectInfo
sLog.outString("Loading Vehicle Accessory..."); // must be after creature templates
sObjectMgr.LoadVehicleAccessory();
sLog.outString("Loading ItemRequiredTarget...");
sObjectMgr.LoadItemRequiredTarget();
@ -1112,6 +1145,9 @@ void World::SetInitialWorldSettings()
sLog.outString("Loading Quest POI");
sObjectMgr.LoadQuestPOI();
sLog.outString("Loading Quest Phase Maps...");
sObjectMgr.LoadQuestPhaseMaps();
sLog.outString("Loading Quests Relations...");
sLog.outString();
sObjectMgr.LoadQuestRelations(); // must be after quest load
@ -1275,6 +1311,8 @@ void World::SetInitialWorldSettings()
sLog.outString("Loading Groups...");
sObjectMgr.LoadGroups();
sCalendarMgr.LoadCalendarsFromDB();
sLog.outString("Loading ReservedNames...");
sObjectMgr.LoadReservedPlayersNames();
@ -1306,6 +1344,7 @@ void World::SetInitialWorldSettings()
sScriptMgr.LoadGameObjectScripts(); // must be after load Creature/Gameobject(Template/Data)
sScriptMgr.LoadGameObjectTemplateScripts(); // must be after load Creature/Gameobject(Template/Data)
sScriptMgr.LoadEventScripts(); // must be after load Creature/Gameobject(Template/Data)
sScriptMgr.LoadCreatureDeathScripts(); // must be after load Creature/Gameobject(Template/Data)
sLog.outString(">>> Scripts loaded");
sLog.outString();
@ -1313,10 +1352,10 @@ void World::SetInitialWorldSettings()
sScriptMgr.LoadDbScriptStrings();
sLog.outString("Loading CreatureEventAI Texts...");
sEventAIMgr.LoadCreatureEventAI_Texts(false); // false, will checked in LoadCreatureEventAI_Scripts
sEventAIMgr.LoadCreatureEventAI_Texts(false); // false, will checked in LoadCreatureEventAI_Scripts
sLog.outString("Loading CreatureEventAI Summons...");
sEventAIMgr.LoadCreatureEventAI_Summons(false); // false, will checked in LoadCreatureEventAI_Scripts
sEventAIMgr.LoadCreatureEventAI_Summons(false); // false, will checked in LoadCreatureEventAI_Scripts
sLog.outString("Loading CreatureEventAI Scripts...");
sEventAIMgr.LoadCreatureEventAI_Scripts();
@ -1368,7 +1407,7 @@ void World::SetInitialWorldSettings()
// mailtimer is increased when updating auctions
// one second is 1000 -(tested on win system)
mail_timer = uint32((((localtime(&m_gameTime)->tm_hour + 20) % 24) * HOUR * IN_MILLISECONDS) / m_timers[WUPDATE_AUCTIONS].GetInterval());
//1440
// 1440
mail_timer_expires = uint32((DAY * IN_MILLISECONDS) / (m_timers[WUPDATE_AUCTIONS].GetInterval()));
DEBUG_LOG("Mail timer set to: %u, mail return is called every %u minutes", mail_timer, mail_timer_expires);