Core/Creature: remove some redundant code

Port From (https://github.com/TrinityCore/TrinityCore/commit/fe2602b772a0ce6017f5fa4398a9b1ba06e2f2f6)
This commit is contained in:
hondacrx
2019-09-01 11:01:31 -04:00
parent b2c63392c5
commit 6080afea5b
+2 -26
View File
@@ -225,7 +225,6 @@ namespace Game.Entities
SetDisplayId(model.CreatureDisplayID, model.DisplayScale); SetDisplayId(model.CreatureDisplayID, model.DisplayScale);
SetNativeDisplayId(model.CreatureDisplayID, model.DisplayScale); SetNativeDisplayId(model.CreatureDisplayID, model.DisplayScale);
SetGender((Gender)minfo.gender);
// Load creature equipment // Load creature equipment
if (data == null || data.equipmentId == 0) if (data == null || data.equipmentId == 0)
@@ -326,12 +325,7 @@ namespace Game.Entities
// checked and error show at loading templates // checked and error show at loading templates
var factionTemplate = CliDB.FactionTemplateStorage.LookupByKey(cInfo.Faction); var factionTemplate = CliDB.FactionTemplateStorage.LookupByKey(cInfo.Faction);
if (factionTemplate != null) if (factionTemplate != null)
{ SetPvP(factionTemplate.Flags.HasAnyFlag((ushort)FactionTemplateFlags.PVP));
if (Convert.ToBoolean(factionTemplate.Flags & (uint)FactionTemplateFlags.PVP))
SetPvP(true);
else
SetPvP(false);
}
// updates spell bars for vehicles and set player's faction - should be called here, to overwrite faction that is set from the new template // 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()) if (IsVehicle())
@@ -816,18 +810,6 @@ namespace Game.Entities
Relocate(x, y, z, ang); Relocate(x, y, z, ang);
} }
CreatureModel display = new CreatureModel(GetNativeDisplayId(), GetNativeDisplayScale(), 1.0f);
CreatureModelInfo minfo = Global.ObjectMgr.GetCreatureModelRandomGender(ref display, cinfo);
if (minfo != null && !IsTotem()) // Cancel load if no model defined or if totem
{
SetNativeDisplayId(display.CreatureDisplayID, display.DisplayScale);
var transformAuras = GetAuraEffectsByType(AuraType.Transform);
var shapeshiftAuras = GetAuraEffectsByType(AuraType.ModShapeshift);
if (transformAuras.Empty() && shapeshiftAuras.Empty())
SetDisplayId(display.CreatureDisplayID, display.DisplayScale);
}
LastUsedScriptID = GetScriptId(); LastUsedScriptID = GetScriptId();
// TODO: Replace with spell, handle from DB // TODO: Replace with spell, handle from DB
@@ -1652,13 +1634,7 @@ namespace Game.Entities
setDeathState(DeathState.JustRespawned); setDeathState(DeathState.JustRespawned);
CreatureModel display = new CreatureModel(GetNativeDisplayId(), GetNativeDisplayScale(), 1.0f); CreatureModel display = new CreatureModel(GetNativeDisplayId(), GetNativeDisplayScale(), 1.0f);
CreatureModelInfo minfo = Global.ObjectMgr.GetCreatureModelRandomGender(ref display, GetCreatureTemplate()); SetDisplayId(display.CreatureDisplayID, display.DisplayScale);
if (minfo != null) // Cancel load if no model defined
{
SetDisplayId(display.CreatureDisplayID, display.DisplayScale);
SetNativeDisplayId(display.CreatureDisplayID, display.DisplayScale);
SetGender((Gender)minfo.gender);
}
GetMotionMaster().InitDefault(); GetMotionMaster().InitDefault();
//Re-initialize reactstate that could be altered by movementgenerators //Re-initialize reactstate that could be altered by movementgenerators