mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-02-02 15:17:27 +01:00
Core/Creatures: Don't require creature.modelid to be one of linked creature_template models
(cherry picked from commit 7cafeb46b3)
This commit is contained in:
@@ -1434,7 +1434,7 @@ void Creature::SaveToDB(uint32 mapid, std::vector<Difficulty> const& spawnDiffic
|
||||
CreatureTemplate const* cinfo = GetCreatureTemplate();
|
||||
if (cinfo)
|
||||
{
|
||||
for (CreatureModel model : cinfo->Models)
|
||||
for (CreatureModel const& model : cinfo->Models)
|
||||
if (displayId && displayId == model.CreatureDisplayID)
|
||||
displayId = 0;
|
||||
|
||||
@@ -1455,7 +1455,10 @@ void Creature::SaveToDB(uint32 mapid, std::vector<Difficulty> const& spawnDiffic
|
||||
data.spawnId = m_spawnId;
|
||||
ASSERT(data.spawnId == m_spawnId);
|
||||
data.id = GetEntry();
|
||||
data.displayid = displayId;
|
||||
if (displayId)
|
||||
data.display.emplace(displayId, DEFAULT_PLAYER_DISPLAY_SCALE, 1.0f);
|
||||
else
|
||||
data.display.reset();
|
||||
data.equipmentId = GetCurrentEquipmentId();
|
||||
if (!GetTransport())
|
||||
{
|
||||
|
||||
@@ -633,7 +633,7 @@ struct EquipmentInfo
|
||||
struct CreatureData : public SpawnData
|
||||
{
|
||||
CreatureData() : SpawnData(SPAWN_TYPE_CREATURE) { }
|
||||
uint32 displayid = 0;
|
||||
Optional<CreatureModel> display;
|
||||
int8 equipmentId = 0;
|
||||
float wander_distance = 0.0f;
|
||||
uint32 currentwaypoint = 0;
|
||||
|
||||
@@ -1364,14 +1364,20 @@ void GameEventMgr::ChangeEquipOrModel(int16 event_id, bool activate)
|
||||
CreatureData& data2 = sObjectMgr->NewOrExistCreatureData(itr->first);
|
||||
if (activate)
|
||||
{
|
||||
itr->second.modelid_prev = data2.displayid;
|
||||
itr->second.modelid_prev = data2.display ? data2.display->CreatureDisplayID : 0;
|
||||
itr->second.equipement_id_prev = data2.equipmentId;
|
||||
data2.displayid = itr->second.modelid;
|
||||
if (itr->second.modelid)
|
||||
data2.display.emplace(itr->second.modelid, DEFAULT_PLAYER_DISPLAY_SCALE, 1.0f);
|
||||
else
|
||||
data2.display.reset();
|
||||
data2.equipmentId = itr->second.equipment_id;
|
||||
}
|
||||
else
|
||||
{
|
||||
data2.displayid = itr->second.modelid_prev;
|
||||
if (itr->second.modelid_prev)
|
||||
data2.display.emplace(itr->second.modelid_prev, DEFAULT_PLAYER_DISPLAY_SCALE, 1.0f);
|
||||
else
|
||||
data2.display.reset();
|
||||
data2.equipmentId = itr->second.equipement_id_prev;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1647,9 +1647,8 @@ CreatureSummonedData const* ObjectMgr::GetCreatureSummonedData(uint32 entryId) c
|
||||
CreatureModel const* ObjectMgr::ChooseDisplayId(CreatureTemplate const* cinfo, CreatureData const* data /*= nullptr*/)
|
||||
{
|
||||
// Load creature model (display id)
|
||||
if (data && data->displayid)
|
||||
if (CreatureModel const* model = cinfo->GetModelWithDisplayId(data->displayid))
|
||||
return model;
|
||||
if (data && data->display)
|
||||
return &*data->display;
|
||||
|
||||
if (!(cinfo->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER))
|
||||
if (CreatureModel const* model = cinfo->GetRandomValidModel())
|
||||
@@ -2191,7 +2190,8 @@ void ObjectMgr::LoadCreatures()
|
||||
data.id = entry;
|
||||
data.mapId = fields[2].GetUInt16();
|
||||
data.spawnPoint.Relocate(fields[3].GetFloat(), fields[4].GetFloat(), fields[5].GetFloat(), fields[6].GetFloat());
|
||||
data.displayid = fields[7].GetUInt32();
|
||||
if (uint32 displayId = fields[7].GetUInt32())
|
||||
data.display.emplace(displayId, DEFAULT_PLAYER_DISPLAY_SCALE, 1.0f);
|
||||
data.equipmentId = fields[8].GetInt8();
|
||||
data.spawntimesecs = fields[9].GetUInt32();
|
||||
data.wander_distance = fields[10].GetFloat();
|
||||
|
||||
Reference in New Issue
Block a user