aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorariel- <ariel-@users.noreply.github.com>2017-03-08 11:19:00 -0300
committerShauren <shauren.trinity@gmail.com>2019-08-17 20:04:14 +0200
commitfe2602b772a0ce6017f5fa4398a9b1ba06e2f2f6 (patch)
treefa79f1ea4fde8a0cc6003468e0978c189dbc70f1 /src
parentdbf3225d452f94abd0908a9a9b16ca205a263063 (diff)
Core/Creature: remove some redundant code
- Display Ids are already initialized in InitEntry, no need to duplicate logic - ModelInfo is already checked too (cherrypicked from 253c0f3d07e05557daa3ffdd4e2a2af4256fb65e)
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Creature/Creature.cpp30
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 b1fa769ae99..e72702ff107 100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -448,7 +448,6 @@ bool Creature::InitEntry(uint32 entry, CreatureData const* data /*= nullptr*/)
SetDisplayId(model.CreatureDisplayID, model.DisplayScale);
SetNativeDisplayId(model.CreatureDisplayID, model.DisplayScale);
- SetGender(minfo->gender);
// Load creature equipment
if (!data || data->equipmentId == 0)
@@ -483,7 +482,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;
@@ -549,12 +548,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->Flags & FACTION_TEMPLATE_FLAG_PVP)
- SetPvP(true);
- else
- SetPvP(false);
- }
+ SetPvP((factionTemplate->Flags & 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())
@@ -1046,18 +1040,6 @@ bool Creature::Create(ObjectGuid::LowType guidlow, Map* map, uint32 entry, float
Relocate(x, y, z, ang);
}
- CreatureModel display(GetNativeDisplayId(), GetNativeDisplayScale(), 1.0f);
- CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelRandomGender(&display, cinfo);
- if (minfo && !IsTotem()) // Cancel load if no model defined or if totem
- {
- SetNativeDisplayId(display.CreatureDisplayID, display.DisplayScale);
-
- Unit::AuraEffectList const& transformAuras = GetAuraEffectsByType(SPELL_AURA_TRANSFORM);
- Unit::AuraEffectList const& shapeshiftAuras = GetAuraEffectsByType(SPELL_AURA_MOD_SHAPESHIFT);
- if (transformAuras.empty() && shapeshiftAuras.empty())
- SetDisplayId(display.CreatureDisplayID, display.DisplayScale);
- }
-
LastUsedScriptID = GetScriptId();
/// @todo Replace with spell, handle from DB
@@ -1976,13 +1958,7 @@ void Creature::Respawn(bool force)
setDeathState(JUST_RESPAWNED);
CreatureModel display(GetNativeDisplayId(), GetNativeDisplayScale(), 1.0f);
- CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelRandomGender(&display, GetCreatureTemplate());
- if (minfo) // Cancel load if no model defined
- {
- SetDisplayId(display.CreatureDisplayID, display.DisplayScale);
- SetNativeDisplayId(display.CreatureDisplayID, display.DisplayScale);
- SetGender(minfo->gender);
- }
+ SetDisplayId(display.CreatureDisplayID, display.DisplayScale);
GetMotionMaster()->InitDefault();
//Re-initialize reactstate that could be altered by movementgenerators