diff options
author | ariel- <ariel-@users.noreply.github.com> | 2017-03-08 11:19:00 -0300 |
---|---|---|
committer | ariel- <ariel-@users.noreply.github.com> | 2017-03-08 11:55:09 -0300 |
commit | 253c0f3d07e05557daa3ffdd4e2a2af4256fb65e (patch) | |
tree | 2c261fb1a9e6d5c9ee6bad4b08ed28f5b250a575 /src | |
parent | bf5661e2fd05625411b184385412921b3f0fb8c5 (diff) |
Core/Creature: remove some redundant code
- Display Ids are already initialized in InitEntry, no need to duplicate logic
- ModelInfo is already checked too
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Entities/Creature/Creature.cpp | 30 |
1 files changed, 3 insertions, 27 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index dff185cebcf..5742404926f 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -436,7 +436,6 @@ bool Creature::InitEntry(uint32 entry, CreatureData const* data /*= nullptr*/) SetDisplayId(displayID); SetNativeDisplayId(displayID); - SetByteValue(UNIT_FIELD_BYTES_0, UNIT_BYTES_0_OFFSET_GENDER, minfo->gender); // Load creature equipment if (!data || data->equipmentId == 0) @@ -466,7 +465,7 @@ bool Creature::InitEntry(uint32 entry, CreatureData const* data /*= nullptr*/) if (!m_respawnradius && m_defaultMovementType == RANDOM_MOTION_TYPE) m_defaultMovementType = IDLE_MOTION_TYPE; - for (uint8 i=0; i < MAX_CREATURE_SPELLS; ++i) + for (uint8 i = 0; i < MAX_CREATURE_SPELLS; ++i) m_spells[i] = GetCreatureTemplate()->spells[i]; return true; @@ -527,12 +526,7 @@ bool Creature::UpdateEntry(uint32 entry, CreatureData const* data /*= nullptr*/, // checked and error show at loading templates if (FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(cInfo->faction)) - { - if (factionTemplate->factionFlags & FACTION_TEMPLATE_FLAG_PVP) - SetPvP(true); - else - SetPvP(false); - } + SetPvP((factionTemplate->factionFlags & FACTION_TEMPLATE_FLAG_PVP) != 0); // updates spell bars for vehicles and set player's faction - should be called here, to overwrite faction that is set from the new template if (IsVehicle()) @@ -1018,18 +1012,6 @@ bool Creature::Create(ObjectGuid::LowType guidlow, Map* map, uint32 phaseMask, u Relocate(x, y, z, ang); } - uint32 displayID = GetNativeDisplayId(); - CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelRandomGender(&displayID); - if (minfo && !IsTotem()) // Cancel load if no model defined or if totem - { - SetNativeDisplayId(displayID); - - Unit::AuraEffectList const& transformAuras = GetAuraEffectsByType(SPELL_AURA_TRANSFORM); - Unit::AuraEffectList const& shapeshiftAuras = GetAuraEffectsByType(SPELL_AURA_MOD_SHAPESHIFT); - if (transformAuras.empty() && shapeshiftAuras.empty()) - SetDisplayId(displayID); - } - LastUsedScriptID = GetCreatureTemplate()->ScriptID; /// @todo Replace with spell, handle from DB @@ -1864,13 +1846,7 @@ void Creature::Respawn(bool force) setDeathState(JUST_RESPAWNED); uint32 displayID = GetNativeDisplayId(); - CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelRandomGender(&displayID); - if (minfo) // Cancel load if no model defined - { - SetDisplayId(displayID); - SetNativeDisplayId(displayID); - SetByteValue(UNIT_FIELD_BYTES_0, UNIT_BYTES_0_OFFSET_GENDER, minfo->gender); - } + SetDisplayId(displayID); GetMotionMaster()->InitDefault(); //Re-initialize reactstate that could be altered by movementgenerators |