Core/Creatures: Updated power type handling

This commit is contained in:
hondacrx
2018-03-04 23:40:51 -05:00
parent 17d3836438
commit b067976678
7 changed files with 119 additions and 82 deletions
-4
View File
@@ -213,10 +213,6 @@ namespace Game.Entities
for (UnitMoveType i = 0; i < UnitMoveType.Max; ++i)
minion.SetSpeedRate(i, m_speed_rate[(int)i]);
// Ghoul pets have energy instead of mana (is anywhere better place for this code?)
if (minion.IsPetGhoul())
minion.SetPowerType(PowerType.Energy);
// Send infinity cooldown - client does that automatically but after relog cooldown needs to be set again
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(minion.GetUInt32Value(UnitFields.CreatedBySpell));
if (spellInfo != null && spellInfo.IsCooldownStartedOnEvent())
+24 -1
View File
@@ -1941,12 +1941,35 @@ namespace Game.Entities
AuraEffect powerTypeAura = powerTypeAuras.First();
displayPower = (PowerType)powerTypeAura.GetMiscValue();
}
else
else if (GetTypeId() == TypeId.Player)
{
ChrClassesRecord cEntry = CliDB.ChrClassesStorage.LookupByKey(GetClass());
if (cEntry != null && cEntry.PowerType < PowerType.Max)
displayPower = cEntry.PowerType;
}
else if (GetTypeId() == TypeId.Unit)
{
Vehicle vehicle = GetVehicle();
if (vehicle)
{
PowerDisplayRecord powerDisplay = CliDB.PowerDisplayStorage.LookupByKey(vehicle.GetVehicleInfo().PowerDisplayID[0]);
if (powerDisplay != null)
displayPower = (PowerType)powerDisplay.PowerType;
else if (GetClass() == Class.Rogue)
displayPower = PowerType.Energy;
}
else
{
Pet pet = ToPet();
if (pet)
{
if (pet.getPetType() == PetType.Hunter) // Hunter pets have focus
displayPower = PowerType.Focus;
else if (pet.IsPetGhoul() || pet.IsPetAbomination()) // DK pets have energy
displayPower = PowerType.Energy;
}
}
}
break;
}
}