Merge branch 'master' into Playerbot

This commit is contained in:
Yunfan Li
2023-12-12 20:52:42 +08:00
1088 changed files with 35633 additions and 19812 deletions

View File

@@ -72,7 +72,6 @@ enum WorldBoolConfigs
CONFIG_ADDON_CHANNEL,
CONFIG_ALLOW_PLAYER_COMMANDS,
CONFIG_CLEAN_CHARACTER_DB,
CONFIG_GRID_UNLOAD,
CONFIG_STATS_SAVE_ONLY_ON_LOGOUT,
CONFIG_ALLOW_TWO_SIDE_ACCOUNTS,
CONFIG_ALLOW_TWO_SIDE_INTERACTION_CALENDAR,
@@ -209,7 +208,6 @@ enum WorldFloatConfigs
enum WorldIntConfigs
{
CONFIG_COMPRESSION = 0,
CONFIG_INTERVAL_GRIDCLEAN,
CONFIG_INTERVAL_MAPUPDATE,
CONFIG_INTERVAL_CHANGEWEATHER,
CONFIG_INTERVAL_DISCONNECT_TOLERANCE,
@@ -419,6 +417,7 @@ enum WorldIntConfigs
CONFIG_CHANGE_FACTION_MAX_MONEY,
CONFIG_WATER_BREATH_TIMER,
CONFIG_AUCTION_HOUSE_SEARCH_TIMEOUT,
CONFIG_DAILY_RBG_MIN_LEVEL_AP_REWARD,
INT_CONFIG_VALUE_COUNT
};
@@ -505,6 +504,7 @@ enum Rates
RATE_HONOR,
RATE_ARENA_POINTS,
RATE_TALENT,
RATE_TALENT_PET,
RATE_CORPSE_DECAY_LOOTED,
RATE_INSTANCE_RESET_TIME,
RATE_DURABILITY_LOSS_ON_DEATH,

View File

@@ -44,6 +44,7 @@
#include "DBCStores.h"
#include "DatabaseEnv.h"
#include "DisableMgr.h"
#include "DynamicVisibility.h"
#include "GameEventMgr.h"
#include "GameGraveyard.h"
#include "GameTime.h"
@@ -58,10 +59,11 @@
#include "Log.h"
#include "LootItemStorage.h"
#include "LootMgr.h"
#include "M2Stores.h"
#include "MMapFactory.h"
#include "MapMgr.h"
#include "Metric.h"
#include "M2Stores.h"
#include "MotdMgr.h"
#include "ObjectMgr.h"
#include "Opcodes.h"
#include "OutdoorPvPMgr.h"
@@ -72,7 +74,6 @@
#include "PoolMgr.h"
#include "Realm.h"
#include "ScriptMgr.h"
#include "MotdMgr.h"
#include "SkillDiscovery.h"
#include "SkillExtraItems.h"
#include "SmartAI.h"
@@ -109,10 +110,6 @@ float World::_maxVisibleDistanceOnContinents = DEFAULT_VISIBILITY_DISTANCE;
float World::_maxVisibleDistanceInInstances = DEFAULT_VISIBILITY_INSTANCE;
float World::_maxVisibleDistanceInBGArenas = DEFAULT_VISIBILITY_BGARENAS;
int32 World::m_visibility_notify_periodOnContinents = DEFAULT_VISIBILITY_NOTIFY_PERIOD;
int32 World::m_visibility_notify_periodInInstances = DEFAULT_VISIBILITY_NOTIFY_PERIOD;
int32 World::m_visibility_notify_periodInBGArenas = DEFAULT_VISIBILITY_NOTIFY_PERIOD;
Realm realm;
/// World constructor
@@ -577,6 +574,12 @@ void World::LoadConfigSettings(bool reload)
LOG_ERROR("server.loading", "Rate.Talent ({}) must be > 0. Using 1 instead.", _rate_values[RATE_TALENT]);
_rate_values[RATE_TALENT] = 1.0f;
}
_rate_values[RATE_TALENT_PET] = sConfigMgr->GetOption<float>("Rate.Talent.Pet", 1.0f);
if (_rate_values[RATE_TALENT_PET] < 0.0f)
{
LOG_ERROR("server.loading", "Rate.Talent.Pet ({}) must be > 0. Using 1 instead.", _rate_values[RATE_TALENT_PET]);
_rate_values[RATE_TALENT_PET] = 1.0f;
}
_rate_values[RATE_MOVESPEED] = sConfigMgr->GetOption<float>("Rate.MoveSpeed", 1.0f);
if (_rate_values[RATE_MOVESPEED] < 0)
{
@@ -658,14 +661,6 @@ void World::LoadConfigSettings(bool reload)
LOG_ERROR("server.loading", "PlayerSave.Stats.MinLevel ({}) must be in range 0..80. Using default, do not save character stats (0).", _int_configs[CONFIG_MIN_LEVEL_STAT_SAVE]);
_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE] = 0;
}
_int_configs[CONFIG_INTERVAL_GRIDCLEAN] = sConfigMgr->GetOption("GridCleanUpDelay", 5 * MINUTE * IN_MILLISECONDS);
if (_int_configs[CONFIG_INTERVAL_GRIDCLEAN] < MIN_GRID_DELAY)
{
LOG_ERROR("server.loading", "GridCleanUpDelay ({}) must be greater {}. Use this minimal value.", _int_configs[CONFIG_INTERVAL_GRIDCLEAN], MIN_GRID_DELAY);
_int_configs[CONFIG_INTERVAL_GRIDCLEAN] = MIN_GRID_DELAY;
}
if (reload)
sMapMgr->SetGridCleanUpDelay(_int_configs[CONFIG_INTERVAL_GRIDCLEAN]);
_int_configs[CONFIG_INTERVAL_MAPUPDATE] = sConfigMgr->GetOption<int32>("MapUpdateInterval", 10);
if (_int_configs[CONFIG_INTERVAL_MAPUPDATE] < MIN_MAP_UPDATE_DELAY)
@@ -1260,10 +1255,6 @@ void World::LoadConfigSettings(bool reload)
_maxVisibleDistanceInBGArenas = MAX_VISIBILITY_DISTANCE;
}
m_visibility_notify_periodOnContinents = sConfigMgr->GetOption<int32>("Visibility.Notify.Period.OnContinents", DEFAULT_VISIBILITY_NOTIFY_PERIOD);
m_visibility_notify_periodInInstances = sConfigMgr->GetOption<int32>("Visibility.Notify.Period.InInstances", DEFAULT_VISIBILITY_NOTIFY_PERIOD);
m_visibility_notify_periodInBGArenas = sConfigMgr->GetOption<int32>("Visibility.Notify.Period.InBGArenas", DEFAULT_VISIBILITY_NOTIFY_PERIOD);
///- Load the CharDelete related config options
_int_configs[CONFIG_CHARDELETE_METHOD] = sConfigMgr->GetOption<int32>("CharDelete.Method", 0);
_int_configs[CONFIG_CHARDELETE_MIN_LEVEL] = sConfigMgr->GetOption<int32>("CharDelete.MinLevel", 0);
@@ -1291,6 +1282,8 @@ void World::LoadConfigSettings(bool reload)
_bool_configs[CONFIG_ALLOWS_RANK_MOD_FOR_PET_HEALTH] = sConfigMgr->GetOption<bool>("Pet.RankMod.Health", true);
_int_configs[CONFIG_DAILY_RBG_MIN_LEVEL_AP_REWARD] = sConfigMgr->GetOption<uint32>("DailyRBGArenaPoints.MinLevel", 71);
_int_configs[CONFIG_AUCTION_HOUSE_SEARCH_TIMEOUT] = sConfigMgr->GetOption<uint32>("AuctionHouse.SearchTimeout", 1000);
///- Read the "Data" directory from the config file
@@ -1421,16 +1414,8 @@ void World::LoadConfigSettings(bool reload)
// Prevent players AFK from being logged out
_int_configs[CONFIG_AFK_PREVENT_LOGOUT] = sConfigMgr->GetOption<int32>("PreventAFKLogout", 0);
// Unload grids to save memory. Can be disabled if enough memory is available to speed up moving players to new grids.
_bool_configs[CONFIG_GRID_UNLOAD] = sConfigMgr->GetOption<bool>("GridUnload", true);
// Preload all grids of all non-instanced maps
_bool_configs[CONFIG_PRELOAD_ALL_NON_INSTANCED_MAP_GRIDS] = sConfigMgr->GetOption<bool>("PreloadAllNonInstancedMapGrids", false);
if (_bool_configs[CONFIG_PRELOAD_ALL_NON_INSTANCED_MAP_GRIDS] && _bool_configs[CONFIG_GRID_UNLOAD])
{
LOG_ERROR("server.loading", "PreloadAllNonInstancedMapGrids enabled, but GridUnload also enabled. GridUnload must be disabled to enable base map pre-loading. Base map pre-loading disabled");
_bool_configs[CONFIG_PRELOAD_ALL_NON_INSTANCED_MAP_GRIDS] = false;
}
// ICC buff override
_int_configs[CONFIG_ICC_BUFF_HORDE] = sConfigMgr->GetOption<int32>("ICC.Buff.Horde", 73822);
@@ -2173,14 +2158,21 @@ void World::SetInitialWorldSettings()
{
LOG_INFO("server.loading", "Loading All Grids For All Non-Instanced Maps...");
sMapMgr->DoForAllMaps([](Map* map)
for (uint32 i = 0; i < sMapStore.GetNumRows(); ++i)
{
MapEntry const* mapEntry = sMapStore.LookupEntry(i);
if (mapEntry && !mapEntry->Instanceable())
{
if (!map->Instanceable())
Map* map = sMapMgr->CreateBaseMap(mapEntry->MapID);
if (map)
{
LOG_INFO("server.loading", ">> Loading All Grids For Map {}", map->GetId());
map->LoadAllCells();
}
});
}
}
}
uint32 startupDuration = GetMSTimeDiffToNow(startupBegin);
@@ -2256,6 +2248,8 @@ void World::Update(uint32 diff)
// Record update if recording set in log and diff is greater then minimum set in log
sWorldUpdateTime.RecordUpdateTime(GameTime::GetGameTimeMS(), diff, GetActiveSessionCount());
DynamicVisibilityMgr::Update(GetActiveSessionCount());
///- Update the different timers
for (int i = 0; i < WUPDATE_COUNT; ++i)
{

View File

@@ -43,13 +43,13 @@ struct Realm;
AC_GAME_API extern Realm realm;
enum ShutdownMask
enum ShutdownMask : uint8
{
SHUTDOWN_MASK_RESTART = 1,
SHUTDOWN_MASK_IDLE = 2,
};
enum ShutdownExitCode
enum ShutdownExitCode : uint8
{
SHUTDOWN_EXIT_CODE = 0,
ERROR_EXIT_CODE = 1,
@@ -322,10 +322,6 @@ public:
static float GetMaxVisibleDistanceInInstances() { return _maxVisibleDistanceInInstances; }
static float GetMaxVisibleDistanceInBGArenas() { return _maxVisibleDistanceInBGArenas; }
static int32 GetVisibilityNotifyPeriodOnContinents() { return m_visibility_notify_periodOnContinents; }
static int32 GetVisibilityNotifyPeriodInInstances() { return m_visibility_notify_periodInInstances; }
static int32 GetVisibilityNotifyPeriodInBGArenas() { return m_visibility_notify_periodInBGArenas; }
// our: needed for arena spectator subscriptions
uint32 GetNextWhoListUpdateDelaySecs() override;
@@ -419,10 +415,6 @@ private:
static float _maxVisibleDistanceInInstances;
static float _maxVisibleDistanceInBGArenas;
static int32 m_visibility_notify_periodOnContinents;
static int32 m_visibility_notify_periodInInstances;
static int32 m_visibility_notify_periodInBGArenas;
std::string _realmName;
// CLI command holder to be thread safe