Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/development' into repacker
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Apr 30, 2024
2 parents bd871d4 + f94b3b4 commit c4809a5
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 27 deletions.
4 changes: 2 additions & 2 deletions sql/migrations/20240428090619_world.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ INSERT INTO `migrations` VALUES ('20240428090619');
-- Add your query below.


-- Add No Target flag to Grobbulus Cloud and Scourge Summoning Crystal.
UPDATE `creature_template` SET `flags_extra`=(`flags_extra` | 0x00020000) WHERE `entry`IN (11623, 16363);
-- Add No Threat List flag to Grobbulus Cloud and Scourge Summoning Crystal.
UPDATE `creature_template` SET `flags_extra`=(`flags_extra` | (0x00000800 | 0x00020000)) WHERE `entry`IN (11623, 16363);


-- End of migration.
Expand Down
17 changes: 13 additions & 4 deletions src/game/Handlers/PetHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,20 @@ void WorldSession::HandlePetAction(WorldPacket& recv_data)
}

pCharmedUnit->ClearUnitState(UNIT_STAT_MOVING);
auto result = pCharmedUnit->CastSpell(pUnitTarget, spellInfo, false);
if (result != SPELL_CAST_OK)
SpellCastResult result = pCharmedUnit->CastSpell(pUnitTarget, spellInfo, false);

if (result == SPELL_CAST_OK)
{
if (pCharmedUnit->IsPet())
((Pet*)pCharmedUnit)->CheckLearning(spellid);

if (pCharmedUnit->IsMoving() && pCharmedUnit->IsNoMovementSpellCasted())
pCharmedUnit->StopMoving();
}
else
pCharmedUnit->SendPetCastFail(spellid, result);
else if (((Creature*)pCharmedUnit)->IsPet())
((Pet*)pCharmedUnit)->CheckLearning(spellid);


break;
}
default:
Expand Down
4 changes: 2 additions & 2 deletions src/game/Objects/CreatureDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,13 @@ enum CreatureFlagsExtra
CREATURE_FLAG_EXTRA_GIGANTIC_AOI = 0x00000100, // 256 CREATURE_DIFFICULTYFLAGS_3_GIGANTIC_AOI (400 yards)
CREATURE_FLAG_EXTRA_INFINITE_AOI = 0x00000200, // 512 CREATURE_DIFFICULTYFLAGS_3_INFINITE_AOI
CREATURE_FLAG_EXTRA_GUARD = 0x00000400, // 1024 Creature is a guard
CREATURE_FLAG_EXTRA_NO_THREAT_LIST = 0x00000800, // 2048 Creature does not select targets based on threat (all enemies have 0 threat)
CREATURE_FLAG_EXTRA_NO_THREAT_LIST = 0x00000800, // 2048 Creature does not keep track of enemies in threat list, uses 5 second combat timer like players
CREATURE_FLAG_EXTRA_KEEP_POSITIVE_AURAS_ON_EVADE = 0x00001000, // 4096 Creature keeps positive auras at reset
CREATURE_FLAG_EXTRA_ALWAYS_CRUSH = 0x00002000, // 8192 Creature always roll a crushing melee outcome when not miss/crit/dodge/parry/block
CREATURE_FLAG_EXTRA_APPEAR_DEAD = 0x00004000, // 16384 Creature will have UNIT_DYNFLAG_DEAD applied
CREATURE_FLAG_EXTRA_CHASE_GEN_NO_BACKING = 0x00008000, // 32768 Creature does not move back when target is within bounding radius
CREATURE_FLAG_EXTRA_NO_ASSIST = 0x00010000, // 65536 Creature does not aggro when nearby creatures aggro
CREATURE_FLAG_EXTRA_NO_TARGET = 0x00020000, // 131072 Creature is passive and does not acquire targets, uses 5 second combat timer like players
CREATURE_FLAG_EXTRA_NO_TARGET = 0x00020000, // 131072 Creature is passive and does not acquire targets
CREATURE_FLAG_EXTRA_ONLY_VISIBLE_TO_FRIENDLY = 0x00040000, // 262144 Creature can only be seen by friendly units
CREATURE_FLAG_EXTRA_CAN_ASSIST = 0x00080000, // 524288 CREATURE_TYPEFLAGS_CAN_ASSIST from TBC
};
Expand Down
3 changes: 2 additions & 1 deletion src/game/Objects/SpellCaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1758,7 +1758,8 @@ bool SpellCaster::IsNoMovementSpellCasted() const
return (true);
else if (m_currentSpells[CURRENT_CHANNELED_SPELL] &&
m_currentSpells[CURRENT_CHANNELED_SPELL]->getState() != SPELL_STATE_FINISHED &&
m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo->HasSpellInterruptFlag(SPELL_INTERRUPT_FLAG_MOVEMENT))
(m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo->HasSpellInterruptFlag(SPELL_INTERRUPT_FLAG_MOVEMENT) ||
m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo->HasChannelInterruptFlag(AURA_INTERRUPT_MOVING_CANCELS)))
return (true);
// don't need to check for AUTOREPEAT_SPELL

Expand Down
15 changes: 11 additions & 4 deletions src/game/Objects/Unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ void Unit::Update(uint32 update_diff, uint32 p_time)
{
if (m_HostileRefManager.isEmpty())
{
if (!IsCharmerOrOwnerPlayerOrPlayerItself() && static_cast<Creature const*>(this)->HasExtraFlag(CREATURE_FLAG_EXTRA_NO_TARGET))
if (!IsCharmerOrOwnerPlayerOrPlayerItself() && static_cast<Creature const*>(this)->HasExtraFlag(CREATURE_FLAG_EXTRA_NO_THREAT_LIST))
OnLeaveCombat();
else
ClearInCombat();
Expand Down Expand Up @@ -346,7 +346,7 @@ bool Unit::UsesPvPCombatTimer() const
if (GetCharmerGuid().IsPlayer())
return true;

if (static_cast<Creature const*>(this)->HasExtraFlag(CREATURE_FLAG_EXTRA_NO_TARGET))
if (static_cast<Creature const*>(this)->HasExtraFlag(CREATURE_FLAG_EXTRA_NO_THREAT_LIST))
return true;

return false;
Expand Down Expand Up @@ -7454,6 +7454,9 @@ bool Unit::CanHaveThreatList() const
if (pCreature->GetCharmerGuid().IsPlayer())
return false;

if (pCreature->HasExtraFlag(CREATURE_FLAG_EXTRA_NO_THREAT_LIST))
return false;

return true;
}

Expand Down Expand Up @@ -7619,6 +7622,10 @@ bool Unit::SelectHostileTarget()
if (!target && !m_ThreatManager.isThreatListEmpty())
target = m_ThreatManager.getHostileTarget();

// stick to current target if no threat list
if (!target && ((Creature*)this)->HasExtraFlag(CREATURE_FLAG_EXTRA_NO_THREAT_LIST))
target = GetVictim();

if (target)
{
// Nostalrius : Correction bug sheep/fear
Expand All @@ -7630,8 +7637,8 @@ bool Unit::SelectHostileTarget()
return true;
}

// mobs that dont acquire targets use 5 second combat timer like players
if (((Creature*)this)->HasExtraFlag(CREATURE_FLAG_EXTRA_NO_TARGET))
// mobs that dont have threat list use 5 second combat timer like players
if (((Creature*)this)->HasExtraFlag(CREATURE_FLAG_EXTRA_NO_THREAT_LIST))
return false;

// no target but something prevent go to evade mode // Nostalrius - fix evade quand CM.
Expand Down
2 changes: 1 addition & 1 deletion src/game/Objects/Unit.h
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,7 @@ class Unit : public SpellCaster
float m_meleeZLimit;
float m_meleeZReach;
ThreatManager m_ThreatManager; // Manage all Units threatening us
HostileRefManager m_HostileRefManager; // Manage all Units that are threatened by us
HostileRefManager m_HostileRefManager; // Manage all Units that are threatened by us (has list of creatures that have us in their threat list)
std::vector<ObjectGuid> m_tauntGuids;
protected:
uint32 m_attackTimer[MAX_ATTACK];
Expand Down
19 changes: 6 additions & 13 deletions src/game/Threat/ThreatManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,21 +406,14 @@ void ThreatManager::addThreat(Unit* pVictim, float threat, bool crit, SpellSchoo

MANGOS_ASSERT(getOwner()->GetTypeId() == TYPEID_UNIT);

if (threat)
// don't add assist threat to targets under hard CC
// check for fear, blind, freezing trap, reckless charge, banish, etc.
if (isAssistThreat)
{
// mob does not count threat, just keeps list of enemies
if (static_cast<Creature*>(getOwner())->HasExtraFlag(CREATURE_FLAG_EXTRA_NO_THREAT_LIST))
threat = 0;

// don't add assist threat to targets under hard CC
// check for fear, blind, freezing trap, reckless charge, banish, etc.
else if (isAssistThreat)
if (getOwner()->HasUnitState(UNIT_STAT_CONFUSED | UNIT_STAT_FLEEING | UNIT_STAT_ISOLATED) ||
(getOwner()->HasUnitState(UNIT_STAT_STUNNED) && getOwner()->HasBreakableByDamageAuraType(SPELL_AURA_MOD_STUN, 0)))
{
if (getOwner()->HasUnitState(UNIT_STAT_CONFUSED | UNIT_STAT_FLEEING | UNIT_STAT_ISOLATED) ||
(getOwner()->HasUnitState(UNIT_STAT_STUNNED) && getOwner()->HasBreakableByDamageAuraType(SPELL_AURA_MOD_STUN, 0)))
{
threat = 0.0f;
}
threat = 0.0f;
}
}

Expand Down

0 comments on commit c4809a5

Please sign in to comment.