Core/Objects: Added check (error log) for possible invalid position for creatures / game objects
This commit is contained in:
@@ -46,6 +46,7 @@
|
||||
#include "Util.h"
|
||||
#include "Vehicle.h"
|
||||
#include "World.h"
|
||||
#include "VMapFactory.h"
|
||||
|
||||
ScriptMapMap sSpellScripts;
|
||||
ScriptMapMap sEventScripts;
|
||||
@@ -1834,6 +1835,22 @@ void ObjectMgr::LoadCreatures()
|
||||
continue;
|
||||
}
|
||||
|
||||
if (sWorld->getBoolConfig(CONFIG_CREATURE_CHECK_INVALID_POSITION))
|
||||
if (VMAP::IVMapManager* vmgr = VMAP::VMapFactory::createOrGetVMapManager())
|
||||
{
|
||||
if (vmgr->isMapLoadingEnabled() && !IsTransportMap(data.mapid))
|
||||
{
|
||||
GridCoord gridCoord = Trinity::ComputeGridCoord(data.posX, data.posY);
|
||||
int gx = (MAX_NUMBER_OF_GRIDS - 1) - gridCoord.x_coord;
|
||||
int gy = (MAX_NUMBER_OF_GRIDS - 1) - gridCoord.y_coord;
|
||||
|
||||
bool exists = vmgr->existsMap((sWorld->GetDataPath() + "vmaps").c_str(), data.mapid, gx, gy);
|
||||
if (!exists)
|
||||
TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: " UI64FMTD " Entry: %u MapID: %u) spawned on a possible invalid position (X: %f Y: %f Z: %f)",
|
||||
guid, data.id, data.mapid, data.posX, data.posY, data.posZ);
|
||||
}
|
||||
}
|
||||
|
||||
// Skip spawnMask check for transport maps
|
||||
if (!IsTransportMap(data.mapid) && data.spawnMask & ~spawnMasks[data.mapid])
|
||||
TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: " UI64FMTD ") that have wrong spawn mask %u including unsupported difficulty modes for map (Id: %u).", guid, data.spawnMask, data.mapid);
|
||||
@@ -2154,6 +2171,22 @@ void ObjectMgr::LoadGameobjects()
|
||||
continue;
|
||||
}
|
||||
|
||||
if (sWorld->getBoolConfig(CONFIG_GAME_OBJECT_CHECK_INVALID_POSITION))
|
||||
if (VMAP::IVMapManager* vmgr = VMAP::VMapFactory::createOrGetVMapManager())
|
||||
{
|
||||
if (vmgr->isMapLoadingEnabled() && !IsTransportMap(data.mapid))
|
||||
{
|
||||
GridCoord gridCoord = Trinity::ComputeGridCoord(data.posX, data.posY);
|
||||
int gx = (MAX_NUMBER_OF_GRIDS - 1) - gridCoord.x_coord;
|
||||
int gy = (MAX_NUMBER_OF_GRIDS - 1) - gridCoord.y_coord;
|
||||
|
||||
bool exists = vmgr->existsMap((sWorld->GetDataPath() + "vmaps").c_str(), data.mapid, gx, gy);
|
||||
if (!exists)
|
||||
TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: " UI64FMTD " Entry: %u MapID: %u) spawned on a possible invalid position (X: %f Y: %f Z: %f)",
|
||||
guid, data.id, data.mapid, data.posX, data.posY, data.posZ);
|
||||
}
|
||||
}
|
||||
|
||||
if (data.spawntimesecs == 0 && gInfo->IsDespawnAtAction())
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: " UI64FMTD " Entry: %u) with `spawntimesecs` (0) value, but the gameobejct is marked as despawnable at action.", guid, data.id);
|
||||
|
||||
@@ -1484,6 +1484,10 @@ void World::LoadConfigSettings(bool reload)
|
||||
m_bool_configs[CONFIG_HOTSWAP_INSTALL_ENABLED] = sConfigMgr->GetBoolDefault("HotSwap.EnableInstall", true);
|
||||
m_bool_configs[CONFIG_HOTSWAP_PREFIX_CORRECTION_ENABLED] = sConfigMgr->GetBoolDefault("HotSwap.EnablePrefixCorrection", true);
|
||||
|
||||
// Check Invalid Position
|
||||
m_bool_configs[CONFIG_CREATURE_CHECK_INVALID_POSITION] = sConfigMgr->GetBoolDefault("Creature.CheckInvalidPosition", false);
|
||||
m_bool_configs[CONFIG_GAME_OBJECT_CHECK_INVALID_POSITION] = sConfigMgr->GetBoolDefault("GameObject.CheckInvalidPosition", false);
|
||||
|
||||
// call ScriptMgr if we're reloading the configuration
|
||||
if (reload)
|
||||
sScriptMgr->OnConfigLoad(reload);
|
||||
|
||||
@@ -189,6 +189,8 @@ enum WorldBoolConfigs
|
||||
CONFIG_HOTSWAP_BUILD_FILE_RECREATION_ENABLED,
|
||||
CONFIG_HOTSWAP_INSTALL_ENABLED,
|
||||
CONFIG_HOTSWAP_PREFIX_CORRECTION_ENABLED,
|
||||
CONFIG_CREATURE_CHECK_INVALID_POSITION,
|
||||
CONFIG_GAME_OBJECT_CHECK_INVALID_POSITION,
|
||||
BOOL_CONFIG_VALUE_COUNT
|
||||
};
|
||||
|
||||
|
||||
@@ -3137,6 +3137,20 @@ Calculate.Gameoject.Zone.Area.Data = 0
|
||||
NoGrayAggro.Above = 0
|
||||
NoGrayAggro.Below = 0
|
||||
|
||||
#
|
||||
# Creature.CheckInvalidPosition
|
||||
# Description: Check possible invalid position for creatures at startup (WARNING: SLOW WORLD SERVER STARTUP)
|
||||
# Default: 0 - (Do not show)
|
||||
|
||||
Creature.CheckInvalidPosition = 0
|
||||
|
||||
#
|
||||
# GameObject.CheckInvalidPosition
|
||||
# Description: Check possible invalid position for game objects at startup (WARNING: SLOW WORLD SERVER STARTUP)
|
||||
# Default: 0 - (Do not show)
|
||||
|
||||
GameObject.CheckInvalidPosition = 0
|
||||
|
||||
#
|
||||
###################################################################################################
|
||||
|
||||
|
||||
Reference in New Issue
Block a user