aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Globals/ObjectMgr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Globals/ObjectMgr.cpp')
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp55
1 files changed, 37 insertions, 18 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 01c3235805b..772e9b970a2 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -1050,8 +1050,8 @@ void ObjectMgr::LoadGameObjectAddons()
{
uint32 oldMSTime = getMSTime();
- // 0 1 2
- QueryResult result = WorldDatabase.Query("SELECT guid, invisibilityType, invisibilityValue FROM gameobject_addon");
+ // 0 1 2 3 4 5 6
+ QueryResult result = WorldDatabase.Query("SELECT guid, parent_rotation0, parent_rotation1, parent_rotation2, parent_rotation3, invisibilityType, invisibilityValue FROM gameobject_addon");
if (!result)
{
@@ -1066,7 +1066,7 @@ void ObjectMgr::LoadGameObjectAddons()
ObjectGuid::LowType guid = fields[0].GetUInt32();
- const GameObjectData* goData = GetGOData(guid);
+ GameObjectData const* goData = GetGOData(guid);
if (!goData)
{
TC_LOG_ERROR("sql.sql", "GameObject (GUID: %u) does not exist but has a record in `gameobject_addon`", guid);
@@ -1074,12 +1074,13 @@ void ObjectMgr::LoadGameObjectAddons()
}
GameObjectAddon& gameObjectAddon = _gameObjectAddonStore[guid];
- gameObjectAddon.invisibilityType = InvisibilityType(fields[1].GetUInt8());
- gameObjectAddon.InvisibilityValue = fields[2].GetUInt32();
+ gameObjectAddon.ParentRotation = G3D::Quat(fields[1].GetFloat(), fields[2].GetFloat(), fields[3].GetFloat(), fields[4].GetFloat());
+ gameObjectAddon.invisibilityType = InvisibilityType(fields[5].GetUInt8());
+ gameObjectAddon.InvisibilityValue = fields[6].GetUInt32();
if (gameObjectAddon.invisibilityType >= TOTAL_INVISIBILITY_TYPES)
{
- TC_LOG_ERROR("sql.sql", "GameObject (GUID: %u) has invalid InvisibilityType in `gameobject_addon`", guid);
+ TC_LOG_ERROR("sql.sql", "GameObject (GUID: %u) has invalid InvisibilityType in `gameobject_addon`, disabled invisibility", guid);
gameObjectAddon.invisibilityType = INVISIBILITY_GENERAL;
gameObjectAddon.InvisibilityValue = 0;
}
@@ -1090,6 +1091,12 @@ void ObjectMgr::LoadGameObjectAddons()
gameObjectAddon.InvisibilityValue = 1;
}
+ if (!gameObjectAddon.ParentRotation.isUnit())
+ {
+ TC_LOG_ERROR("sql.sql", "GameObject (GUID: %u) has invalid path rotation, set to default", guid);
+ gameObjectAddon.ParentRotation = G3D::Quat();
+ }
+
++count;
}
while (result->NextRow());
@@ -1883,10 +1890,10 @@ ObjectGuid::LowType ObjectMgr::AddGOData(uint32 entry, uint32 mapId, float x, fl
data.posY = y;
data.posZ = z;
data.orientation = o;
- data.rotation0 = rotation0;
- data.rotation1 = rotation1;
- data.rotation2 = rotation2;
- data.rotation3 = rotation3;
+ data.rotation.x = rotation0;
+ data.rotation.y = rotation1;
+ data.rotation.z = rotation2;
+ data.rotation.w = rotation3;
data.spawntimesecs = spawntimedelay;
data.animprogress = 100;
data.spawnMask = 1;
@@ -2036,10 +2043,10 @@ void ObjectMgr::LoadGameobjects()
data.posY = fields[4].GetFloat();
data.posZ = fields[5].GetFloat();
data.orientation = fields[6].GetFloat();
- data.rotation0 = fields[7].GetFloat();
- data.rotation1 = fields[8].GetFloat();
- data.rotation2 = fields[9].GetFloat();
- data.rotation3 = fields[10].GetFloat();
+ data.rotation.x = fields[7].GetFloat();
+ data.rotation.y = fields[8].GetFloat();
+ data.rotation.z = fields[9].GetFloat();
+ data.rotation.w = fields[10].GetFloat();
data.spawntimesecs = fields[11].GetInt32();
MapEntry const* mapEntry = sMapStore.LookupEntry(data.mapid);
@@ -2080,15 +2087,27 @@ void ObjectMgr::LoadGameobjects()
data.orientation = Position::NormalizeOrientation(data.orientation);
}
- if (data.rotation2 < -1.0f || data.rotation2 > 1.0f)
+ if (data.rotation.x < -1.0f || data.rotation.x > 1.0f)
+ {
+ TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid rotationX (%f) value, skip", guid, data.id, data.rotation.x);
+ continue;
+ }
+
+ if (data.rotation.y < -1.0f || data.rotation.y > 1.0f)
+ {
+ TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid rotationY (%f) value, skip", guid, data.id, data.rotation.y);
+ continue;
+ }
+
+ if (data.rotation.z < -1.0f || data.rotation.z > 1.0f)
{
- TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid rotation2 (%f) value, skip", guid, data.id, data.rotation2);
+ TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid rotationZ (%f) value, skip", guid, data.id, data.rotation.z);
continue;
}
- if (data.rotation3 < -1.0f || data.rotation3 > 1.0f)
+ if (data.rotation.w < -1.0f || data.rotation.w > 1.0f)
{
- TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid rotation3 (%f) value, skip", guid, data.id, data.rotation3);
+ TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid rotationW (%f) value, skip", guid, data.id, data.rotation.w);
continue;
}