Core/Misc: Reduce differences between branches

This commit is contained in:
Shauren
2025-07-25 16:55:15 +02:00
parent f536e1a266
commit 65715e7dd9
6 changed files with 29 additions and 26 deletions

View File

@@ -337,7 +337,7 @@ class TC_GAME_API BossAI : public ScriptedAI
void _JustEngagedWith(Unit* who);
void _JustDied();
void _JustReachedHome();
void _DespawnAtEvade(Seconds delayToRespawn = 30s, Creature* who = nullptr);
void _DespawnAtEvade(Seconds delayToRespawn = 30s, Creature* who = nullptr);
void TeleportCheaters();

View File

@@ -1716,6 +1716,25 @@ namespace Trinity
ObjectGuid _GUID;
};
class HeightDifferenceCheck
{
public:
HeightDifferenceCheck(WorldObject* go, float diff, bool reverse)
: _baseObject(go), _difference(diff), _reverse(reverse)
{
}
bool operator()(WorldObject* unit) const
{
return (unit->GetPositionZ() - _baseObject->GetPositionZ() > _difference) != _reverse;
}
private:
WorldObject* _baseObject;
float _difference;
bool _reverse;
};
class UnitAuraCheck
{
public:

View File

@@ -624,7 +624,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData)
if (_player->GetGuildId())
{
data.Initialize(SMSG_TURN_IN_PETITION_RESULTS, 4);
data << (uint32)PETITION_TURN_ALREADY_IN_GUILD;
data << uint32(PETITION_TURN_ALREADY_IN_GUILD);
_player->SendDirectMessage(&data);
return;
}

View File

@@ -904,13 +904,13 @@ uint64 Spell::CalculateDelayMomentForDst() const
{
float speed = m_targets.GetSpeedXY();
if (speed > 0.0f)
return (uint64)floor(m_targets.GetDist2d() / speed * 1000.0f);
return uint64(std::floor(m_targets.GetDist2d() / speed * 1000.0f));
}
else if (m_spellInfo->Speed > 0.0f)
{
// We should not subtract caster size from dist calculation (fixes execution time desync with animation on client, eg. Malleable Goo cast by PP)
float dist = m_caster->GetExactDist(*m_targets.GetDstPos());
return (uint64)std::floor(dist / m_spellInfo->Speed * 1000.0f);
return uint64(std::floor(dist / m_spellInfo->Speed * 1000.0f));
}
}
@@ -2185,6 +2185,7 @@ void Spell::AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid /*=
if (dist < 5.0f)
dist = 5.0f;
targetInfo.TimeDelay = uint64(std::floor(dist / m_spellInfo->Speed * 1000.0f));
// Calculate minimum incoming time
@@ -2269,7 +2270,9 @@ void Spell::AddGOTarget(GameObject* go, uint32 effectMask)
float dist = m_caster->GetDistance(go->GetPositionX(), go->GetPositionY(), go->GetPositionZ());
if (dist < 5.0f)
dist = 5.0f;
target.TimeDelay = uint64(std::floor(dist / m_spellInfo->Speed * 1000.0f));
if (!m_delayMoment || m_delayMoment > target.TimeDelay)
m_delayMoment = target.TimeDelay;
}

View File

@@ -393,25 +393,6 @@ class NecroticPlagueTargetCheck
uint32 _notAura2;
};
class HeightDifferenceCheck
{
public:
HeightDifferenceCheck(GameObject* go, float diff, bool reverse)
: _baseObject(go), _difference(diff), _reverse(reverse)
{
}
bool operator()(WorldObject* unit) const
{
return (unit->GetPositionZ() - _baseObject->GetPositionZ() > _difference) != _reverse;
}
private:
GameObject* _baseObject;
float _difference;
bool _reverse;
};
class FrozenThroneResetWorker
{
public:
@@ -1510,7 +1491,7 @@ struct npc_valkyr_shadowguard : public ScriptedAI
{
std::list<Creature*> triggers;
GetCreatureListWithEntryInGrid(triggers, me, NPC_WORLD_TRIGGER, 150.0f);
triggers.remove_if(HeightDifferenceCheck(platform, 5.0f, true));
triggers.remove_if(Trinity::HeightDifferenceCheck(platform, 5.0f, true));
if (triggers.empty())
return;
@@ -2196,7 +2177,7 @@ class spell_the_lich_king_quake : public SpellScript
void FilterTargets(std::list<WorldObject*>& targets)
{
if (GameObject* platform = ObjectAccessor::GetGameObject(*GetCaster(), GetCaster()->GetInstanceScript()->GetGuidData(DATA_ARTHAS_PLATFORM)))
targets.remove_if(HeightDifferenceCheck(platform, 5.0f, false));
targets.remove_if(Trinity::HeightDifferenceCheck(platform, 5.0f, false));
}
void HandleSendEvent(SpellEffIndex /*effIndex*/)

View File

@@ -712,7 +712,7 @@ class spell_warl_life_tap : public SpellScript
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
}
bool Validate(SpellInfo const* /*spell*/) override
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_WARLOCK_LIFE_TAP_ENERGIZE, SPELL_WARLOCK_LIFE_TAP_ENERGIZE_2 });
}