Merge branch 'master' into Playerbot

This commit is contained in:
Yunfan Li
2024-06-28 18:36:45 +08:00
57 changed files with 1524 additions and 1417 deletions

View File

@@ -653,7 +653,7 @@ void BossAI::_JustEngagedWith()
void BossAI::_EnterEvadeMode(EvadeReason why)
{
CreatureAI::EnterEvadeMode(why);
if (instance)
if (instance && instance->GetBossState(_bossId) != DONE)
{
instance->SetBossState(_bossId, NOT_STARTED);
instance->SaveToDB();

View File

@@ -800,7 +800,7 @@ void ObjectMgr::LoadCreatureTemplateModels()
CreatureModelInfo const* modelInfo = GetCreatureModelInfo(creatureDisplayId);
if (!modelInfo)
LOG_ERROR("sql.sql", "No model data exist for `CreatureDisplayID` = {} listed by creature (Entry: {%u}}).", creatureDisplayId, creatureId);
LOG_ERROR("sql.sql", "No model data exist for `CreatureDisplayID` = {} listed by creature (Entry: {}).", creatureDisplayId, creatureId);
if (displayScale <= 0.0f)
displayScale = 1.0f;

View File

@@ -61,6 +61,10 @@ void WaypointMovementGenerator<Creature>::DoFinalize(Creature* creature)
void WaypointMovementGenerator<Creature>::DoReset(Creature* creature)
{
if (stalled)
{
return;
}
creature->AddUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE);
StartMoveNow(creature);
}
@@ -209,6 +213,11 @@ bool WaypointMovementGenerator<Creature>::DoUpdate(Creature* creature, uint32 di
{
// Waypoint movement can be switched on/off
// This is quite handy for escort quests and other stuff
if (stalled)
{
Stop(1000);
return true;
}
if (creature->HasUnitState(UNIT_STATE_NOT_MOVE) || creature->IsMovementPreventedByCasting())
{
creature->StopMoving();
@@ -278,6 +287,17 @@ void WaypointMovementGenerator<Creature>::MovementInform(Creature* creature)
}
}
void WaypointMovementGenerator<Creature>::Pause(uint32 /*timer*/)
{
stalled = true;
i_nextMoveTime.Reset(1);
}
void WaypointMovementGenerator<Creature>::Resume(uint32 /*overrideTimer/*/)
{
stalled = false;
}
//----------------------------------------------------//
uint32 FlightPathMovementGenerator::GetPathAtMapEnd() const

View File

@@ -54,13 +54,15 @@ class WaypointMovementGenerator<Creature> : public MovementGeneratorMedium< Crea
public PathMovementBase<Creature, WaypointPath const*>
{
public:
WaypointMovementGenerator(uint32 _path_id = 0, bool _repeating = true)
: PathMovementBase((WaypointPath const*)nullptr), i_nextMoveTime(0), m_isArrivalDone(false), path_id(_path_id), repeating(_repeating) {}
WaypointMovementGenerator(uint32 _path_id = 0, bool _repeating = true, bool _stalled = false)
: PathMovementBase((WaypointPath const*)nullptr), i_nextMoveTime(0), m_isArrivalDone(false), path_id(_path_id), repeating(_repeating), stalled(_stalled) {}
~WaypointMovementGenerator() { i_path = nullptr; }
void DoInitialize(Creature*);
void DoFinalize(Creature*);
void DoReset(Creature*);
bool DoUpdate(Creature*, uint32 diff);
void Pause(uint32 timer/* = 0*/);
void Resume(uint32 overrideTimer/* = 0*/);
void MovementInform(Creature*);
@@ -93,6 +95,7 @@ private:
bool m_isArrivalDone;
uint32 path_id;
bool repeating;
bool stalled;
};
/** FlightPathMovementGenerator generates movement of the player for the paths

View File

@@ -4106,12 +4106,6 @@ void AuraEffect::HandleModStateImmunityMask(AuraApplication const* aurApp, uint8
// Patch 3.0.3 Bladestorm now breaks all snares and roots on the warrior when activated.
if (GetId() == 46924)
{
if (apply)
{
target->resetAttackTimer();
target->resetAttackTimer(OFF_ATTACK);
}
// Knockback and hex
target->ApplySpellImmune(GetId(), IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, apply);
}

View File

@@ -658,9 +658,7 @@ void Aura::UpdateTargetMap(Unit* caster, bool apply)
if ((itr->second & (1 << effIndex)) && itr->first->IsImmunedToSpellEffect(GetSpellInfo(), effIndex))
itr->second &= ~(1 << effIndex);
}
if (!itr->second
|| itr->first->IsImmunedToSpell(GetSpellInfo())
|| !CanBeAppliedOn(itr->first))
if (!itr->second || itr->first->IsImmunedToSpell(GetSpellInfo()) || !CanBeAppliedOn(itr->first))
addUnit = false;
if (addUnit)
@@ -671,21 +669,9 @@ void Aura::UpdateTargetMap(Unit* caster, bool apply)
if (itr->first->IsInFlight())
addUnit = false;
switch( GetId() )
{
case 62821: // Ulduar, Hodir, Toasty Fire
case 62807: // Ulduar, Hodir, Starlight
case 51103: // Oculus, Mage-Lord Urom, Frostbomb
case 69146:
case 70823:
case 70824:
case 70825: // Icecrown Citadel, Lord Marrowgar, Coldflame
{
if( itr->first->HasAura(GetId()) )
addUnit = false;
}
break;
}
// Allow only 1 persistent area aura to affect our targets if a custom flag is set.
if (itr->first->HasAura(GetId()) && GetSpellInfo()->HasAttribute(SPELL_ATTR0_CU_ONLY_ONE_AREA_AURA))
addUnit = false;
}
// unit auras can not stack with each other
else // (GetType() == UNIT_AURA_TYPE)

View File

@@ -5645,7 +5645,7 @@ SpellCastResult Spell::CheckCast(bool strict)
if (m_caster->GetTypeId() == TYPEID_PLAYER)
{
//can cast triggered (by aura only?) spells while have this flag
if (!HasTriggeredCastFlag(TRIGGERED_IGNORE_CASTER_AURASTATE) && m_caster->ToPlayer()->HasPlayerFlag(PLAYER_ALLOW_ONLY_ABILITY))
if (!HasTriggeredCastFlag(TRIGGERED_IGNORE_CASTER_AURASTATE) && m_caster->ToPlayer()->HasPlayerFlag(PLAYER_ALLOW_ONLY_ABILITY) && !IsNextMeleeSwingSpell())
return SPELL_FAILED_SPELL_IN_PROGRESS;
if (!HasTriggeredCastFlag(TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD) && m_caster->ToPlayer()->HasSpellCooldown(m_spellInfo->Id))

View File

@@ -195,7 +195,7 @@ enum SpellCustomAttributes
SPELL_ATTR0_CU_NEEDS_AMMO_DATA = 0x00080000,
SPELL_ATTR0_CU_BINARY_SPELL = 0x00100000,
SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS = 0x00200000,
SPELL_ATTR0_CU_SINGLE_AURA_STACK = 0x00400000, // pussywizard
SPELL_ATTR0_CU_SINGLE_AURA_STACK = 0x00400000,
SPELL_ATTR0_CU_SCHOOLMASK_NORMAL_WITH_MAGIC = 0x00800000,
SPELL_ATTR0_CU_AURA_CANNOT_BE_SAVED = 0x01000000,
SPELL_ATTR0_CU_POSITIVE_EFF0 = 0x02000000,
@@ -203,7 +203,8 @@ enum SpellCustomAttributes
SPELL_ATTR0_CU_POSITIVE_EFF2 = 0x08000000,
SPELL_ATTR0_CU_FORCE_SEND_CATEGORY_COOLDOWNS = 0x10000000,
SPELL_ATTR0_CU_FORCE_AURA_SAVING = 0x20000800,
SPELL_ATTR0_CU_ENCOUNTER_REWARD = 0x40000000, // pussywizard
SPELL_ATTR0_CU_ONLY_ONE_AREA_AURA = 0x20000000,
SPELL_ATTR0_CU_ENCOUNTER_REWARD = 0x40000000,
SPELL_ATTR0_CU_BYPASS_MECHANIC_IMMUNITY = 0x80000000,
SPELL_ATTR0_CU_NEGATIVE = SPELL_ATTR0_CU_NEGATIVE_EFF0 | SPELL_ATTR0_CU_NEGATIVE_EFF1 | SPELL_ATTR0_CU_NEGATIVE_EFF2,