Core/Unit: Implement more helper methods

Port From (https://github.com/TrinityCore/TrinityCore/commit/104ec7a81a5bb782f81fd05b872bf664e4de1c89)
This commit is contained in:
hondacrx
2021-12-26 20:04:34 -05:00
parent 55189b9395
commit 08678c970e
4 changed files with 15 additions and 10 deletions
+4 -1
View File
@@ -535,13 +535,16 @@ namespace Game.Entities
//Powers
public PowerType GetPowerType() { return (PowerType)(byte)m_unitData.DisplayPower; }
public void SetPowerType(PowerType powerType)
public void SetPowerType(PowerType powerType, bool sendUpdate = true)
{
if (GetPowerType() == powerType)
return;
SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.DisplayPower), (byte)powerType);
if (!sendUpdate)
return;
Player thisPlayer = ToPlayer();
if (thisPlayer != null)
{