mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-08 15:58:04 +00:00
feat(Core/Scripting): OnBuildValuesUpdate hook (#9961)
This commit is contained in:
@@ -20082,8 +20082,15 @@ void Unit::BuildValuesUpdate(uint8 updateType, ByteBuffer* data, Player* target)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (!sScriptMgr->OnBuildValuesUpdate(this, updateType, fieldBuffer, target, index))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// send in current format (float as float, uint32 as uint32)
|
// send in current format (float as float, uint32 as uint32)
|
||||||
fieldBuffer << m_uint32Values[index];
|
fieldBuffer << m_uint32Values[index];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -191,6 +191,18 @@ bool ScriptMgr::IsCustomBuildValuesUpdate(Unit const* unit, uint8 updateType, By
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ScriptMgr::OnBuildValuesUpdate(Unit const* unit, uint8 updateType, ByteBuffer& fieldBuffer, Player* target, uint16 index)
|
||||||
|
{
|
||||||
|
auto ret = IsValidBoolScript<UnitScript>([&](UnitScript* script) { return script->OnBuildValuesUpdate(unit, updateType, fieldBuffer, target, index); });
|
||||||
|
|
||||||
|
if (ret && *ret)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void ScriptMgr::OnUnitUpdate(Unit* unit, uint32 diff)
|
void ScriptMgr::OnUnitUpdate(Unit* unit, uint32 diff)
|
||||||
{
|
{
|
||||||
ExecuteScript<UnitScript>([&](UnitScript* script)
|
ExecuteScript<UnitScript>([&](UnitScript* script)
|
||||||
|
|||||||
@@ -445,6 +445,8 @@ public:
|
|||||||
|
|
||||||
[[nodiscard]] virtual bool IsCustomBuildValuesUpdate(Unit const* /*unit*/, uint8 /*updateType*/, ByteBuffer& /*fieldBuffer*/, Player const* /*target*/, uint16 /*index*/) { return false; }
|
[[nodiscard]] virtual bool IsCustomBuildValuesUpdate(Unit const* /*unit*/, uint8 /*updateType*/, ByteBuffer& /*fieldBuffer*/, Player const* /*target*/, uint16 /*index*/) { return false; }
|
||||||
|
|
||||||
|
[[nodiscard]] virtual bool OnBuildValuesUpdate(Unit const* /*unit*/, uint8 /*updateType*/, ByteBuffer& /*fieldBuffer*/, Player* /*target*/, uint16 /*index*/) { return false; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This hook runs in Unit::Update
|
* @brief This hook runs in Unit::Update
|
||||||
*
|
*
|
||||||
@@ -2361,6 +2363,7 @@ public: /* UnitScript */
|
|||||||
bool IsNeedModHealPercent(Unit const* unit, AuraEffect* auraEff, float& doneTotalMod, SpellInfo const* spellProto);
|
bool IsNeedModHealPercent(Unit const* unit, AuraEffect* auraEff, float& doneTotalMod, SpellInfo const* spellProto);
|
||||||
bool CanSetPhaseMask(Unit const* unit, uint32 newPhaseMask, bool update);
|
bool CanSetPhaseMask(Unit const* unit, uint32 newPhaseMask, bool update);
|
||||||
bool IsCustomBuildValuesUpdate(Unit const* unit, uint8 updateType, ByteBuffer& fieldBuffer, Player const* target, uint16 index);
|
bool IsCustomBuildValuesUpdate(Unit const* unit, uint8 updateType, ByteBuffer& fieldBuffer, Player const* target, uint16 index);
|
||||||
|
bool OnBuildValuesUpdate(Unit const* unit, uint8 updateType, ByteBuffer& fieldBuffer, Player* target, uint16 index);
|
||||||
void OnUnitUpdate(Unit* unit, uint32 diff);
|
void OnUnitUpdate(Unit* unit, uint32 diff);
|
||||||
|
|
||||||
public: /* MovementHandlerScript */
|
public: /* MovementHandlerScript */
|
||||||
|
|||||||
Reference in New Issue
Block a user