Merge branch 'master' into Playerbot

This commit is contained in:
Yunfan Li
2023-10-27 20:12:09 +08:00
64 changed files with 658 additions and 686 deletions

View File

@@ -327,6 +327,7 @@ public:
if (Creature* nefarian = me->SummonCreature(NPC_NEFARIAN, NefarianSpawn))
{
nefarian->setActive(true);
nefarian->SetFarVisible(true);
nefarian->SetCanFly(true);
nefarian->SetDisableGravity(true);
nefarian->GetMotionMaster()->MovePath(NEFARIAN_PATH, false);

View File

@@ -425,6 +425,7 @@ public:
{
nefarius->SetPhaseMask(1, true);
nefarius->setActive(true);
nefarius->SetFarVisible(true);
nefarius->Respawn();
nefarius->GetMotionMaster()->MoveTargetedHome();
}

View File

@@ -105,6 +105,7 @@ struct boss_nightbane : public BossAI
me->SetDisableGravity(_intro);
me->SetWalk(false);
me->setActive(true);
me->SetFarVisible(true);
if (instance)
{

View File

@@ -211,6 +211,38 @@ struct boss_shade_of_aran : public BossAI
}
}
void OnPowerUpdate(Powers /*power*/, int32 /*gain*/, int32 /*updateVal*/, uint32 currentPower) override
{
// Should drink at 10%, need 10% mana for mass polymorph
if (!_hasDrunk && me->GetMaxPower(POWER_MANA) && (currentPower * 100 / me->GetMaxPower(POWER_MANA)) < 13)
{
_drinking = true;
_hasDrunk = true;
me->InterruptNonMeleeSpells(true);
Talk(SAY_DRINK);
DoCastAOE(SPELL_MASS_POLY);
me->SetReactState(REACT_PASSIVE);
// Start drinking after conjuring drinks
_drinkScheduler.Schedule(2s, GROUP_DRINKING, [this](TaskContext)
{
DoCastSelf(SPELL_CONJURE);
}).Schedule(4s, GROUP_DRINKING, [this](TaskContext)
{
me->SetStandState(UNIT_STAND_STATE_SIT);
DoCastSelf(SPELL_DRINK);
}).Schedule(10s, GROUP_DRINKING, [this](TaskContext)
{
me->SetStandState(UNIT_STAND_STATE_STAND);
me->SetReactState(REACT_AGGRESSIVE);
me->SetPower(POWER_MANA, me->GetMaxPower(POWER_MANA) - 32000);
DoCastSelf(SPELL_AOE_PYROBLAST);
_drinkScheduler.CancelGroup(GROUP_DRINKING);
_drinking = false;
});
}
}
void JustEngagedWith(Unit* /*who*/) override
{
_JustEngagedWith();
@@ -226,8 +258,6 @@ struct boss_shade_of_aran : public BossAI
}
}).Schedule(1s, [this](TaskContext context)
{
context.Repeat(2s);
if (!_drinking)
{
if (me->IsNonMeleeSpellCast(false))
@@ -255,39 +285,6 @@ struct boss_shade_of_aran : public BossAI
++AvailableSpells;
}
// Should drink at 10%, need 10% mana for mass polymorph
if (!_hasDrunk && me->GetMaxPower(POWER_MANA) && (me->GetPower(POWER_MANA) * 100 / me->GetMaxPower(POWER_MANA)) < 13)
{
_drinking = true;
_hasDrunk = true;
me->InterruptNonMeleeSpells(true);
Talk(SAY_DRINK);
DoCastAOE(SPELL_MASS_POLY);
me->SetReactState(REACT_PASSIVE);
// Start drinking after conjuring drinks
_drinkScheduler.Schedule(2s, GROUP_DRINKING, [this](TaskContext)
{
DoCastSelf(SPELL_CONJURE);
}).Schedule(4s, GROUP_DRINKING, [this](TaskContext)
{
me->SetStandState(UNIT_STAND_STATE_SIT);
DoCastSelf(SPELL_DRINK);
});
_drinkScheduler.Schedule(10s, GROUP_DRINKING, [this](TaskContext)
{
me->SetStandState(UNIT_STAND_STATE_STAND);
me->SetReactState(REACT_AGGRESSIVE);
me->SetPower(POWER_MANA, me->GetMaxPower(POWER_MANA) - 32000);
DoCastSelf(SPELL_AOE_PYROBLAST);
_drinkScheduler.CancelGroup(GROUP_DRINKING);
_drinking = false;
});
return;
}
//If no available spells wait 1 second and try again
if (AvailableSpells)
{
@@ -318,6 +315,7 @@ struct boss_shade_of_aran : public BossAI
}
}
}
context.Repeat(2s);
}).Schedule(5s, [this](TaskContext context)
{
if (!_drinking)
@@ -505,12 +503,15 @@ class spell_flamewreath_aura : public AuraScript
{
if (Unit* target = GetTarget())
{
target->CastSpell(target, SPELL_FLAME_WREATH_RAN_THRU, true);
if (target->IsPlayer())
{
target->CastSpell(target, SPELL_FLAME_WREATH_RAN_THRU, true);
target->m_Events.AddEventAtOffset([target] {
target->RemoveAurasDueToSpell(SPELL_FLAME_WREATH_RAN_THRU);
target->CastSpell(target, SPELL_FLAME_WREATH_EXPLOSION, true);
}, 1s);
target->m_Events.AddEventAtOffset([target] {
target->RemoveAurasDueToSpell(SPELL_FLAME_WREATH_RAN_THRU);
target->CastSpell(target, SPELL_FLAME_WREATH_EXPLOSION, true);
}, 1s);
}
}
}
}

View File

@@ -55,6 +55,7 @@ public:
void Reset() override
{
me->setActive(true);
me->SetFarVisible(true);
me->SetVisible(false);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetCanFly(true);

View File

@@ -347,6 +347,7 @@ void hyjalAI::Reset()
{
IsDummy = false;
me->setActive(true);
me->SetFarVisible(true);
// GUIDs
PlayerGUID.Clear();
BossGUID[0].Clear();
@@ -493,6 +494,7 @@ void hyjalAI::SummonCreature(uint32 entry, float Base[4][3])
creature->SetWalk(false);
creature->setActive(true);
creature->SetFarVisible(true);
switch (entry)
{
case NECROMANCER:
@@ -1021,6 +1023,7 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff)
CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true;
CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i;
unit->setActive(true);
unit->SetFarVisible(true);
}
}
for (uint8 i = 0; i < 3; ++i)//summon 3 abominations
@@ -1033,6 +1036,7 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff)
CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true;
CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i;
unit->setActive(true);
unit->SetFarVisible(true);
}
}
for (uint8 i = 0; i < 5; ++i)//summon 5 gargoyles
@@ -1045,6 +1049,7 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff)
CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true;
CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i;
unit->setActive(true);
unit->SetFarVisible(true);
}
}
break;
@@ -1062,6 +1067,7 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff)
CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true;
CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i;
unit->setActive(true);
unit->SetFarVisible(true);
}
}
for (uint8 i = 0; i < 25; ++i)//summon 25 ghouls
@@ -1074,6 +1080,7 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff)
CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true;
CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i;
unit->setActive(true);
unit->SetFarVisible(true);
}
}
for (uint8 i = 0; i < 5; ++i)//summon 5 abominations
@@ -1086,6 +1093,7 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff)
CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true;
CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i;
unit->setActive(true);
unit->SetFarVisible(true);
}
}
break;

View File

@@ -874,7 +874,7 @@ struct boss_sartharion_dragonAI : public BossAI
Talk(SAY_TENEBRON_DEATH);
if (!isCalledBySartharion || instance->GetBossState(DATA_SARTHARION) != IN_PROGRESS)
{
instance->SetBossState(DATA_SHADRON, DONE);
instance->SetBossState(DATA_TENEBRON, DONE);
}
break;
}

View File

@@ -46,17 +46,6 @@ public:
LoadBossBoundaries(boundaries);
}
bool IsEncounterInProgress() const override
{
for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i)
{
if (GetBossState(i) == IN_PROGRESS)
return true;
}
return false;
}
void OnCreatureCreate(Creature* pCreature) override
{
switch(pCreature->GetEntry())
@@ -150,20 +139,6 @@ public:
return false;
}
bool SetBossState(uint32 type, EncounterState state) override
{
if (InstanceScript::SetBossState(type, state))
{
return false;
}
if (state == DONE)
{
SaveToDB();
}
return true;
}
void DoAction(int32 action) override
{
switch (action)

View File

@@ -389,6 +389,7 @@ public:
if (action == ACTION_BALTHARUS_DEATH)
{
me->setActive(true);
me->SetFarVisible(true);
_isIntro = false;
_events.ScheduleEvent(EVENT_XERESTRASZA_EVENT_0, 6s);

View File

@@ -339,6 +339,7 @@ public:
events.ScheduleEvent(EVENT_ICY_GRIP, 33s + 500ms, EVENT_GROUP_LAND_PHASE);
me->setActive(true);
me->SetFarVisible(true);
me->SetInCombatWithZone();
instance->SetBossState(DATA_SINDRAGOSA, IN_PROGRESS);
@@ -377,6 +378,7 @@ public:
return;
me->setActive(true);
me->SetFarVisible(true);
me->SetDisableGravity(true);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetSpeed(MOVE_RUN, 4.28571f);
@@ -1407,6 +1409,7 @@ public:
return;
me->setActive(true);
me->SetFarVisible(true);
me->SetImmuneToPC(true);
float moveTime = me->GetExactDist(&SpinestalkerFlyPos) / (me->GetSpeed(MOVE_RUN) * 0.001f);
me->m_Events.AddEvent(new FrostwyrmLandEvent(*me, SpinestalkerLandPos), me->m_Events.CalculateTime(uint64(moveTime) + 250));
@@ -1423,6 +1426,7 @@ public:
return;
me->setActive(false);
me->SetFarVisible(false);
me->SetDisableGravity(false);
me->SetHomePosition(SpinestalkerLandPos);
me->SetFacingTo(SpinestalkerLandPos.GetOrientation());
@@ -1538,6 +1542,7 @@ public:
return;
me->setActive(true);
me->SetFarVisible(true);
me->SetImmuneToPC(true);
float moveTime = me->GetExactDist(&RimefangFlyPos) / (me->GetSpeed(MOVE_RUN) * 0.001f);
me->m_Events.AddEvent(new FrostwyrmLandEvent(*me, RimefangLandPos), me->m_Events.CalculateTime(uint64(moveTime) + 250));
@@ -1556,6 +1561,8 @@ public:
if (point == POINT_FROSTWYRM_LAND)
{
me->setActive(false);
me->SetFarVisible(false);
me->SetFarVisible(false);
me->SetDisableGravity(false);
me->SetHomePosition(RimefangLandPos);
me->SetFacingTo(RimefangLandPos.GetOrientation());

View File

@@ -293,16 +293,12 @@ public:
_instance(creature->GetInstanceScript()), _portalCount(RAID_MODE<uint32>(3, 8, 3, 8))
{
me->SetReactState(REACT_PASSIVE);
_spawnHealth = 1; // just in case if not set below
if (CreatureData const* data = sObjectMgr->GetCreatureData(me->GetSpawnId()))
if (data->curhealth)
_spawnHealth = data->curhealth;
}
void Reset() override
{
_events.Reset();
me->SetHealth(_spawnHealth);
me->SetHealth(me->GetMaxHealth() * 0.5f); // starts at 50% health
me->LoadCreaturesAddon(true);
// immune to percent heals
me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_OBS_MOD_HEALTH, true);
@@ -440,8 +436,9 @@ public:
// does not enter combat
if (_instance->GetBossState(DATA_VALITHRIA_DREAMWALKER) == NOT_STARTED)
{
if (me->GetHealth() != _spawnHealth) // healing when boss cannot be engaged (lower spire not finished, cheating) doesn't start the fight, prevent winning this way
me->SetHealth(_spawnHealth);
uint32 startingHealth = me->GetMaxHealth() * 0.5f;
if (me->GetHealth() != startingHealth) // healing when boss cannot be engaged (lower spire not finished, cheating) doesn't start the fight, prevent winning this way
me->SetHealth(startingHealth);
return;
}
@@ -484,7 +481,6 @@ public:
private:
EventMap _events;
InstanceScript* _instance;
uint32 _spawnHealth;
uint32 const _portalCount;
uint32 _missedPortals;
bool _under25PercentTalkDone;
@@ -756,7 +752,7 @@ public:
if (!me->IsInCombat())
if (me->GetSpawnId())
if (!me->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
me->CastSpell(me, SPELL_CORRUPTION, false);
me->CastSpell(me, SPELL_CORRUPTION, true);
if (!UpdateVictim())
return;

View File

@@ -388,6 +388,11 @@ public:
_phaseTwo = false;
_heraldOfTheTitans = true;
if (m_pInstance->GetData(TYPE_ALGALON) == FAIL)
{
_firstPull = false;
}
if (m_pInstance)
m_pInstance->SetData(TYPE_ALGALON, NOT_STARTED);
}
@@ -479,6 +484,7 @@ public:
uint32 introDelay = 0;
me->setActive(true);
me->SetFarVisible(true);
me->SetInCombatWithZone();
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetImmuneToNPC(true);
@@ -1151,6 +1157,14 @@ public:
if (GameObject* sigil = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_DOODAD_UL_SIGILDOOR_02)))
sigil->SetGoState(GO_STATE_ACTIVE);
if (Map* map = player->GetMap())
{
if (InstanceMap* instanceMap = map->ToInstanceMap())
{
instanceMap->PermBindAllPlayers();
}
}
}
return false;

View File

@@ -175,6 +175,7 @@ public:
{
me->SetDisableGravity(true);
me->setActive(true);
me->SetFarVisible(true);
Reset();
}

View File

@@ -517,6 +517,7 @@ public:
if (m_pInstance && !_encounterFinished)
m_pInstance->SetData(TYPE_THORIM, IN_PROGRESS);
me->setActive(true);
me->SetFarVisible(true);
DisableThorim(true);
me->CastSpell(me, SPELL_SHEATH_OF_LIGHTNING, true);
//me->CastSpell(me, SPELL_TOUCH_OF_DOMINION, true);