Revert "Core/Hooks: Rewrite hook IsCustomBuildValuesUpdate"

This reverts commit 8fc0abd728.
This commit is contained in:
yehonal
2019-09-03 11:14:31 +02:00
parent 4e5be963f7
commit e51304e22d
3 changed files with 9 additions and 8 deletions

View File

@@ -19492,8 +19492,9 @@ void Unit::BuildValuesUpdate(uint8 updateType, ByteBuffer* data, Player* target)
else
fieldBuffer << (uint32)target->getFaction();
}
else if (sScriptMgr->CanCustomBuildValuesUpdate(this, updateType, fieldBuffer, target, index))
fieldBuffer << m_uint32Values[index];
else
if (!sScriptMgr->IsCustomBuildValuesUpdate(this, updateType, fieldBuffer, target, index))
fieldBuffer << m_uint32Values[index];
}
else
// send in current format (float as float, uint32 as uint32)

View File

@@ -2570,13 +2570,13 @@ bool ScriptMgr::CanSetPhaseMask(Unit const* unit, uint32 newPhaseMask, bool upda
return ret;
}
bool ScriptMgr::CanCustomBuildValuesUpdate(Unit const* unit, uint8 updateType, ByteBuffer& fieldBuffer, Player const* target, uint16 index)
bool ScriptMgr::IsCustomBuildValuesUpdate(Unit const* unit, uint8 updateType, ByteBuffer& fieldBuffer, Player const* target, uint16 index)
{
bool ret = true;
bool ret = false;
FOR_SCRIPTS_RET(UnitScript, itr, end, ret) // return true by default if not scripts
if (!itr->second->CanCustomBuildValuesUpdate(unit, updateType, fieldBuffer, target, index))
ret = false; // we change ret value only when scripts return true
if (itr->second->IsCustomBuildValuesUpdate(unit, updateType, fieldBuffer, target, index))
ret = true; // we change ret value only when scripts return true
return ret;
}

View File

@@ -485,7 +485,7 @@ public:
virtual bool CanSetPhaseMask(Unit const* /*unit*/, uint32 /*newPhaseMask*/, bool /*update*/) { return true; }
virtual bool CanCustomBuildValuesUpdate(Unit const* /*unit*/, uint8 /*updateType*/, ByteBuffer& /*fieldBuffer*/, Player const* /*target*/, uint16 /*index*/) { return false; }
virtual bool IsCustomBuildValuesUpdate(Unit const* /*unit*/, uint8 /*updateType*/, ByteBuffer& /*fieldBuffer*/, Player const* /*target*/, uint16 /*index*/) { return false; }
};
class MovementHandlerScript : public ScriptObject
@@ -1806,7 +1806,7 @@ class ScriptMgr
bool IsNeedModMeleeDamagePercent(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 CanCustomBuildValuesUpdate(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);
public: /* MovementHandlerScript */