diff --git a/src/game/Entities/Creature.cpp b/src/game/Entities/Creature.cpp index bee5e9166f..2f0c40197d 100644 --- a/src/game/Entities/Creature.cpp +++ b/src/game/Entities/Creature.cpp @@ -1604,9 +1604,6 @@ bool Creature::CreateFromProto(uint32 dbGuid, uint32 guidlow, CreatureInfo const Object::_Create(dbGuid, guidlow, newEntry, cinfo->GetHighGuid()); - if (uint32 entry = sObjectMgr.GetRandomCreatureEntry(GetDbGuid())) - newEntry = entry; - return UpdateEntry(newEntry, data, eventData, false); } @@ -1629,10 +1626,6 @@ bool Creature::LoadFromDB(uint32 dbGuid, Map* map, uint32 newGuid, uint32 forced uint32 entry = forcedEntry ? forcedEntry : data->id; - // get data for dual spawn instances - if (entry == 0) - entry = GetCreatureConditionalSpawnEntry(dbGuid, map); - SpawnGroupEntry* groupEntry = map->GetMapDataContainer().GetSpawnGroupByGuid(dbGuid, TYPEID_UNIT); // use dynguid by default \o/ CreatureGroup* group = nullptr; if (groupEntry) @@ -1642,6 +1635,13 @@ bool Creature::LoadFromDB(uint32 dbGuid, Map* map, uint32 newGuid, uint32 forced entry = group->GetGuidEntry(dbGuid); } + // get data for dual spawn instances - spawn group precedes it because + if (entry == 0) + entry = GetCreatureConditionalSpawnEntry(dbGuid, map); + + if (entry == 0) + entry = sObjectMgr.GetRandomCreatureEntry(GetDbGuid()); + GameEventCreatureData const* eventData = sGameEventMgr.GetCreatureUpdateDataForActiveEvent(dbGuid); if (!entry && eventData) entry = eventData->entry_id; diff --git a/src/game/Entities/GameObject.cpp b/src/game/Entities/GameObject.cpp index 8bb721875d..9550cd8f09 100644 --- a/src/game/Entities/GameObject.cpp +++ b/src/game/Entities/GameObject.cpp @@ -906,6 +906,9 @@ bool GameObject::LoadFromDB(uint32 dbGuid, Map* map, uint32 newGuid, uint32 forc entry = group->GetGuidEntry(dbGuid); } + if (uint32 randomEntry = sObjectMgr.GetRandomGameObjectEntry(dbGuid)) + entry = randomEntry; + bool dynguid = false; if (map->IsDynguidForced()) dynguid = true; @@ -919,9 +922,6 @@ bool GameObject::LoadFromDB(uint32 dbGuid, Map* map, uint32 newGuid, uint32 forc if (dynguid || newGuid == 0) newGuid = map->GenerateLocalLowGuid(HIGHGUID_GAMEOBJECT); - if (uint32 randomEntry = sObjectMgr.GetRandomGameObjectEntry(dbGuid)) - entry = randomEntry; - if (!Create(dbGuid, newGuid, entry, map, x, y, z, ang, rotation0, rotation1, rotation2, rotation3, animprogress, GO_STATE_READY)) return false;