Merge branch 'azerothcore:master' into Playerbot

This commit is contained in:
ZhengPeiRu21
2022-04-25 08:58:13 -06:00
committed by GitHub
792 changed files with 88721 additions and 44310 deletions

View File

@@ -103,6 +103,7 @@ public:
events.ScheduleEvent(EVENT_CHECK_RESET, 5000);
_hasAura = false;
_attacked = false;
}
void JustRespawned() override
@@ -114,16 +115,21 @@ public:
{
ScriptedAI::AttackStart(victim);
// Boss should attack as well
if (BattlegroundMap* bgMap = me->GetMap()->ToBattlegroundMap())
if (!_attacked)
{
if (Battleground* bg = bgMap->GetBG())
_attacked = true;
// Boss should attack as well
if (BattlegroundMap* bgMap = me->GetMap()->ToBattlegroundMap())
{
if (Creature* mainBoss = bg->GetBGCreature((me->GetFaction() == FACTION_AV_ALLIANCE ? AV_CPLACE_A_BOSS : AV_CPLACE_H_BOSS)))
if (Battleground* bg = bgMap->GetBG())
{
if (mainBoss->IsAIEnabled && !mainBoss->GetVictim())
if (Creature* mainBoss = bg->GetBGCreature((me->GetFaction() == FACTION_AV_ALLIANCE ? AV_CPLACE_A_BOSS : AV_CPLACE_H_BOSS)))
{
mainBoss->AI()->AttackStart(victim);
if (mainBoss->IsAIEnabled && !mainBoss->GetVictim())
{
mainBoss->AI()->AttackStart(victim);
}
}
}
}
@@ -134,16 +140,21 @@ public:
{
ScriptedAI::EnterEvadeMode(why);
// Evade boss
if (BattlegroundMap* bgMap = me->GetMap()->ToBattlegroundMap())
if (_attacked)
{
if (Battleground* bg = bgMap->GetBG())
_attacked = false;
// Evade boss
if (BattlegroundMap* bgMap = me->GetMap()->ToBattlegroundMap())
{
if (Creature* mainBoss = bg->GetBGCreature((me->GetFaction() == FACTION_AV_ALLIANCE ? AV_CPLACE_A_BOSS : AV_CPLACE_H_BOSS)))
if (Battleground* bg = bgMap->GetBG())
{
if (mainBoss->IsAIEnabled && !mainBoss->IsInEvadeMode())
if (Creature* mainBoss = bg->GetBGCreature((me->GetFaction() == FACTION_AV_ALLIANCE ? AV_CPLACE_A_BOSS : AV_CPLACE_H_BOSS)))
{
mainBoss->AI()->EnterEvadeMode();
if (mainBoss->IsAIEnabled && !mainBoss->IsInEvadeMode())
{
mainBoss->AI()->EnterEvadeMode();
}
}
}
}
@@ -214,6 +225,7 @@ public:
private:
EventMap events;
bool _hasAura;
bool _attacked;
};
CreatureAI* GetAI(Creature* creature) const override

View File

@@ -54,15 +54,17 @@ public:
uint32 FrenzyTimer;
uint32 YellTimer;
uint32 ResetTimer;
bool Attacked;
void Reset() override
{
WhirlwindTimer = urand(1 * IN_MILLISECONDS, 20 * IN_MILLISECONDS);
Whirlwind2Timer = urand(1 * IN_MILLISECONDS, 20 * IN_MILLISECONDS);
KnockdownTimer = 12 * IN_MILLISECONDS;
FrenzyTimer = 6 * IN_MILLISECONDS;
ResetTimer = 5 * IN_MILLISECONDS;
YellTimer = urand(20 * IN_MILLISECONDS, 30 * IN_MILLISECONDS); //20 to 30 seconds
WhirlwindTimer = urand(1 * IN_MILLISECONDS, 20 * IN_MILLISECONDS);
Whirlwind2Timer = urand(1 * IN_MILLISECONDS, 20 * IN_MILLISECONDS);
KnockdownTimer = 12 * IN_MILLISECONDS;
FrenzyTimer = 6 * IN_MILLISECONDS;
ResetTimer = 5 * IN_MILLISECONDS;
YellTimer = urand(20 * IN_MILLISECONDS, 30 * IN_MILLISECONDS); //20 to 30 seconds
Attacked = false;
}
void EnterCombat(Unit* /*who*/) override
@@ -80,18 +82,23 @@ public:
{
ScriptedAI::AttackStart(victim);
// Mini bosses should attack as well
if (BattlegroundMap* bgMap = me->GetMap()->ToBattlegroundMap())
if (!Attacked)
{
if (Battleground* bg = bgMap->GetBG())
Attacked = true;
// Mini bosses should attack as well
if (BattlegroundMap* bgMap = me->GetMap()->ToBattlegroundMap())
{
for (uint8 i = AV_CPLACE_H_MARSHAL_ICE; i <= AV_CPLACE_H_MARSHAL_WTOWER; ++i)
if (Battleground* bg = bgMap->GetBG())
{
if (Creature* marshall = bg->GetBGCreature(i))
for (uint8 i = AV_CPLACE_H_MARSHAL_ICE; i <= AV_CPLACE_H_MARSHAL_WTOWER; ++i)
{
if (marshall->IsAIEnabled && !marshall->GetVictim())
if (Creature* marshall = bg->GetBGCreature(i))
{
marshall->AI()->AttackStart(victim);
if (marshall->IsAIEnabled && !marshall->GetVictim())
{
marshall->AI()->AttackStart(victim);
}
}
}
}
@@ -103,18 +110,23 @@ public:
{
ScriptedAI::EnterEvadeMode(why);
// Evade mini bosses
if (BattlegroundMap* bgMap = me->GetMap()->ToBattlegroundMap())
if (Attacked)
{
if (Battleground* bg = bgMap->GetBG())
Attacked = false;
// Evade mini bosses
if (BattlegroundMap* bgMap = me->GetMap()->ToBattlegroundMap())
{
for (uint8 i = AV_CPLACE_H_MARSHAL_ICE; i <= AV_CPLACE_H_MARSHAL_WTOWER; ++i)
if (Battleground* bg = bgMap->GetBG())
{
if (Creature* marshall = bg->GetBGCreature(i))
for (uint8 i = AV_CPLACE_H_MARSHAL_ICE; i <= AV_CPLACE_H_MARSHAL_WTOWER; ++i)
{
if (marshall->IsAIEnabled && !marshall->IsInEvadeMode())
if (Creature* marshall = bg->GetBGCreature(i))
{
marshall->AI()->EnterEvadeMode();
if (marshall->IsAIEnabled && !marshall->IsInEvadeMode())
{
marshall->AI()->EnterEvadeMode();
}
}
}
}

View File

@@ -50,14 +50,16 @@ public:
uint32 StormboltTimer;
uint32 ResetTimer;
uint32 YellTimer;
bool Attacked;
void Reset() override
{
AvatarTimer = 3 * IN_MILLISECONDS;
ThunderclapTimer = 4 * IN_MILLISECONDS;
StormboltTimer = 6 * IN_MILLISECONDS;
ResetTimer = 5 * IN_MILLISECONDS;
AvatarTimer = 3 * IN_MILLISECONDS;
ThunderclapTimer = 4 * IN_MILLISECONDS;
StormboltTimer = 6 * IN_MILLISECONDS;
ResetTimer = 5 * IN_MILLISECONDS;
YellTimer = urand(20 * IN_MILLISECONDS, 30 * IN_MILLISECONDS);
Attacked = false;
}
void EnterCombat(Unit* /*who*/) override
@@ -69,18 +71,23 @@ public:
{
ScriptedAI::AttackStart(victim);
// Mini bosses should attack as well
if (BattlegroundMap* bgMap = me->GetMap()->ToBattlegroundMap())
if (!Attacked)
{
if (Battleground* bg = bgMap->GetBG())
Attacked = true;
// Mini bosses should attack as well
if (BattlegroundMap* bgMap = me->GetMap()->ToBattlegroundMap())
{
for (uint8 i = AV_CPLACE_A_MARSHAL_SOUTH; i <= AV_CPLACE_A_MARSHAL_STONE; ++i)
if (Battleground* bg = bgMap->GetBG())
{
if (Creature* marshall = bg->GetBGCreature(i))
for (uint8 i = AV_CPLACE_A_MARSHAL_SOUTH; i <= AV_CPLACE_A_MARSHAL_STONE; ++i)
{
if (marshall->IsAIEnabled && !marshall->GetVictim())
if (Creature* marshall = bg->GetBGCreature(i))
{
marshall->AI()->AttackStart(victim);
if (marshall->IsAIEnabled && !marshall->GetVictim())
{
marshall->AI()->AttackStart(victim);
}
}
}
}
@@ -92,18 +99,23 @@ public:
{
ScriptedAI::EnterEvadeMode(why);
// Evade mini bosses
if (BattlegroundMap* bgMap = me->GetMap()->ToBattlegroundMap())
if (Attacked)
{
if (Battleground* bg = bgMap->GetBG())
Attacked = false;
// Evade mini bosses
if (BattlegroundMap* bgMap = me->GetMap()->ToBattlegroundMap())
{
for (uint8 i = AV_CPLACE_A_MARSHAL_SOUTH; i <= AV_CPLACE_A_MARSHAL_STONE; ++i)
if (Battleground* bg = bgMap->GetBG())
{
if (Creature* marshall = bg->GetBGCreature(i))
for (uint8 i = AV_CPLACE_A_MARSHAL_SOUTH; i <= AV_CPLACE_A_MARSHAL_STONE; ++i)
{
if (marshall->IsAIEnabled && !marshall->IsInEvadeMode())
if (Creature* marshall = bg->GetBGCreature(i))
{
marshall->AI()->EnterEvadeMode();
if (marshall->IsAIEnabled && !marshall->IsInEvadeMode())
{
marshall->AI()->EnterEvadeMode();
}
}
}
}

View File

@@ -56,19 +56,17 @@ enum Spells
enum Events
{
EVENT_SHIMMER = 1,
EVENT_BREATH_1 = 2,
EVENT_BREATH_2 = 3,
EVENT_AFFLICTION = 4,
EVENT_FRENZY = 5
EVENT_BREATH = 2,
EVENT_AFFLICTION = 3,
EVENT_FRENZY = 4
};
enum Misc
{
DATA_LEVER_USED = 0
GUID_LEVER_USER = 0
};
// not sniffed yet.
Position const homePos = { -7487.577148f, -1074.366943f, 476.555023f, 5.325001f };
Position const homePos = { -7491.1587f, -1069.718f, 476.59094, 476.59094f };
class boss_chromaggus : public CreatureScript
{
@@ -81,107 +79,10 @@ public:
{
Initialize();
Breath1_Spell = 0;
Breath2_Spell = 0;
// Select the 2 breaths that we are going to use until despawned so we don't end up casting 2 of the same breath.
_breathSpells = { SPELL_INCINERATE, SPELL_TIMELAPSE, SPELL_CORROSIVEACID, SPELL_IGNITEFLESH, SPELL_FROSTBURN };
// Select the 2 breaths that we are going to use until despawned
// 5 possiblities for the first breath, 4 for the second, 20 total possiblites
// This way we don't end up casting 2 of the same breath
// TL TL would be stupid
switch (urand(0, 19))
{
// B1 - Incin
case 0:
Breath1_Spell = SPELL_INCINERATE;
Breath2_Spell = SPELL_TIMELAPSE;
break;
case 1:
Breath1_Spell = SPELL_INCINERATE;
Breath2_Spell = SPELL_CORROSIVEACID;
break;
case 2:
Breath1_Spell = SPELL_INCINERATE;
Breath2_Spell = SPELL_IGNITEFLESH;
break;
case 3:
Breath1_Spell = SPELL_INCINERATE;
Breath2_Spell = SPELL_FROSTBURN;
break;
// B1 - TL
case 4:
Breath1_Spell = SPELL_TIMELAPSE;
Breath2_Spell = SPELL_INCINERATE;
break;
case 5:
Breath1_Spell = SPELL_TIMELAPSE;
Breath2_Spell = SPELL_CORROSIVEACID;
break;
case 6:
Breath1_Spell = SPELL_TIMELAPSE;
Breath2_Spell = SPELL_IGNITEFLESH;
break;
case 7:
Breath1_Spell = SPELL_TIMELAPSE;
Breath2_Spell = SPELL_FROSTBURN;
break;
//B1 - Acid
case 8:
Breath1_Spell = SPELL_CORROSIVEACID;
Breath2_Spell = SPELL_INCINERATE;
break;
case 9:
Breath1_Spell = SPELL_CORROSIVEACID;
Breath2_Spell = SPELL_TIMELAPSE;
break;
case 10:
Breath1_Spell = SPELL_CORROSIVEACID;
Breath2_Spell = SPELL_IGNITEFLESH;
break;
case 11:
Breath1_Spell = SPELL_CORROSIVEACID;
Breath2_Spell = SPELL_FROSTBURN;
break;
//B1 - Ignite
case 12:
Breath1_Spell = SPELL_IGNITEFLESH;
Breath2_Spell = SPELL_INCINERATE;
break;
case 13:
Breath1_Spell = SPELL_IGNITEFLESH;
Breath2_Spell = SPELL_CORROSIVEACID;
break;
case 14:
Breath1_Spell = SPELL_IGNITEFLESH;
Breath2_Spell = SPELL_TIMELAPSE;
break;
case 15:
Breath1_Spell = SPELL_IGNITEFLESH;
Breath2_Spell = SPELL_FROSTBURN;
break;
//B1 - Frost
case 16:
Breath1_Spell = SPELL_FROSTBURN;
Breath2_Spell = SPELL_INCINERATE;
break;
case 17:
Breath1_Spell = SPELL_FROSTBURN;
Breath2_Spell = SPELL_TIMELAPSE;
break;
case 18:
Breath1_Spell = SPELL_FROSTBURN;
Breath2_Spell = SPELL_CORROSIVEACID;
break;
case 19:
Breath1_Spell = SPELL_FROSTBURN;
Breath2_Spell = SPELL_IGNITEFLESH;
break;
};
EnterEvadeMode();
Acore::Containers::RandomResize(_breathSpells, 2);
}
void Initialize()
@@ -189,14 +90,6 @@ public:
Enraged = false;
}
void SetData(uint32 id, uint32 /*data*/) override
{
if (id == DATA_LEVER_USED)
{
me->SetHomePosition(homePos);
}
}
void Reset() override
{
_Reset();
@@ -209,8 +102,8 @@ public:
BossAI::EnterCombat(victim);
events.ScheduleEvent(EVENT_SHIMMER, 1000);
events.ScheduleEvent(EVENT_BREATH_1, 30000);
events.ScheduleEvent(EVENT_BREATH_2, 60000);
events.ScheduleEvent(EVENT_BREATH, 30000);
events.ScheduleEvent(EVENT_BREATH, 60000);
events.ScheduleEvent(EVENT_AFFLICTION, 10000);
events.ScheduleEvent(EVENT_FRENZY, 15000);
}
@@ -220,6 +113,22 @@ public:
return !victim->HasAura(SPELL_TIMELAPSE);
}
void SetGUID(ObjectGuid guid, int32 id) override
{
if (id == GUID_LEVER_USER)
{
_playerGUID = guid;
}
}
void PathEndReached(uint32 /*pathId*/) override
{
if (Unit* player = ObjectAccessor::GetUnit(*me, _playerGUID))
{
me->SetInCombatWith(player);
}
}
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
@@ -242,14 +151,11 @@ public:
events.ScheduleEvent(EVENT_SHIMMER, urand(17000, 25000));
break;
}
case EVENT_BREATH_1:
DoCastVictim(Breath1_Spell);
events.ScheduleEvent(EVENT_BREATH_1, 60000);
break;
case EVENT_BREATH_2:
DoCastVictim(Breath2_Spell);
events.ScheduleEvent(EVENT_BREATH_2, 60000);
break;
case EVENT_BREATH:
DoCastVictim(_breathSpells.front());
_breathSpells.reverse();
events.ScheduleEvent(EVENT_BREATH, 60000);
break;
case EVENT_AFFLICTION:
{
uint32 afflictionSpellID = RAND(SPELL_BROODAF_BLUE, SPELL_BROODAF_BLACK, SPELL_BROODAF_RED, SPELL_BROODAF_BRONZE, SPELL_BROODAF_GREEN);
@@ -305,9 +211,9 @@ public:
}
private:
uint32 Breath1_Spell;
uint32 Breath2_Spell;
std::list<uint32> _breathSpells;
bool Enraged;
ObjectGuid _playerGUID;
};
CreatureAI* GetAI(Creature* creature) const override
@@ -331,12 +237,11 @@ class go_chromaggus_lever : public GameObjectScript
{
if (_instance->GetBossState(DATA_CHROMAGGUS) != DONE && _instance->GetBossState(DATA_CHROMAGGUS) != IN_PROGRESS)
{
_instance->SetBossState(DATA_CHROMAGGUS, IN_PROGRESS);
if (Creature* creature = _instance->instance->GetCreature(_instance->GetGuidData(DATA_CHROMAGGUS)))
{
creature->AI()->AttackStart(player);
creature->AI()->SetData(DATA_LEVER_USED, 1);
creature->SetHomePosition(homePos);
creature->GetMotionMaster()->MovePath(creature->GetEntry() * 10, false);
creature->AI()->SetGUID(player->GetGUID(), GUID_LEVER_USER);
}
if (GameObject* go = _instance->instance->GetGameObject(_instance->GetGuidData(DATA_GO_CHROMAGGUS_DOOR)))

View File

@@ -304,7 +304,8 @@ public:
{
if (summon->GetEntry() == NPC_NEFARIAN)
{
summons.DespawnAll();
summons.DespawnEntry(_nefarianLeftTunnel);
summons.DespawnEntry(_nefarianRightTunnel);
Unit::Kill(me, me);
}
}
@@ -1014,49 +1015,42 @@ class spell_class_call_handler : public SpellScript
if (SpellInfo const* spellInfo = GetSpellInfo())
{
targets.remove_if([spellInfo](WorldObject const* target) -> bool
{
Player const* player = target->ToPlayer();
if (!player || player->getClass() == CLASS_DEATH_KNIGHT) // ignore all death knights from whatever spell, for some reason the condition below is not working x.x
{
Player const* player = target->ToPlayer();
if (!player || player->getClass() == CLASS_DEATH_KNIGHT) // ignore all death knights from whatever spell, for some reason the condition below is not working x.x
{
return true;
}
return true;
}
auto it = classCallSpells.find(spellInfo->Id);
if (it != classCallSpells.end()) // should never happen but only to be sure.
{
return target->ToPlayer()->getClass() != it->second;
}
auto it = classCallSpells.find(spellInfo->Id);
if (it != classCallSpells.end()) // should never happen but only to be sure.
{
return target->ToPlayer()->getClass() != it->second;
}
return false;
});
return false;
});
}
}
void HandleOnHitRogue()
void HandleOnHitRogue(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
Unit* target = GetHitUnit();
if (!caster || !target)
{
return;
}
float angle = rand_norm() * 2 * M_PI;
Position tp = caster->GetPosition();
tp.m_positionX += std::cos(angle) * 5.f;
tp.m_positionY += std::sin(angle) * 5.f;
float z = tp.m_positionZ + 0.5f;
caster->UpdateAllowedPositionZ(tp.GetPositionX(), tp.GetPositionY(), z);
target->NearTeleportTo(tp.GetPositionX(), tp.GetPositionY(), z, angle - M_PI);
target->UpdatePositionData();
Position tp = caster->GetFirstCollisionPosition(5.f, 0.f);
target->NearTeleportTo(tp.GetPositionX(), tp.GetPositionY(), tp.GetPositionZ(), tp.GetOrientation());
}
void HandleOnHitWarlock()
{
if (GetHitUnit())
if (Unit* target = GetHitUnit())
{
GetHitUnit()->CastSpell(GetHitUnit(), SPELL_SUMMON_INFERNALS, true);
target->CastSpell(target, SPELL_SUMMON_INFERNALS, true);
}
}
@@ -1066,7 +1060,7 @@ class spell_class_call_handler : public SpellScript
if (m_scriptSpellId == SPELL_ROGUE)
{
OnHit += SpellHitFn(spell_class_call_handler::HandleOnHitRogue);
OnEffectLaunchTarget += SpellEffectFn(spell_class_call_handler::HandleOnHitRogue, EFFECT_0, SPELL_EFFECT_APPLY_AURA);
}
else if (m_scriptSpellId == SPELL_WARLOCK)
{

View File

@@ -35,9 +35,6 @@ DoorData const doorData[] =
{ GO_PORTCULLIS_RAZORGORE_ROOM, DATA_RAZORGORE_THE_UNTAMED, DOOR_TYPE_ROOM, }, // ID 176964 || GUID 75158
{ GO_PORTCULLIS_VAELASTRASZ, DATA_VAELASTRAZ_THE_CORRUPT, DOOR_TYPE_PASSAGE }, // ID 175185 || GUID 7229
{ GO_PORTCULLIS_BROODLORD, DATA_BROODLORD_LASHLAYER, DOOR_TYPE_PASSAGE }, // ID 179365 || GUID 75159
{ GO_PORTCULLIS_THREEDRAGONS, DATA_FIREMAW, DOOR_TYPE_PASSAGE }, // ID 179115 || GUID 75165
{ GO_PORTCULLIS_THREEDRAGONS, DATA_EBONROC, DOOR_TYPE_PASSAGE }, // ID 179115 || GUID 75165
{ GO_PORTCULLIS_THREEDRAGONS, DATA_FLAMEGOR, DOOR_TYPE_PASSAGE }, // ID 179115 || GUID 75165
{ GO_PORTCULLIS_CHROMAGGUS, DATA_CHROMAGGUS, DOOR_TYPE_PASSAGE }, // ID 179116 || GUID 75161
{ GO_PORTCULLIS_NEFARIAN, DATA_NEFARIAN, DOOR_TYPE_ROOM }, // ID 179117 || GUID 75164
{ 0, 0, DOOR_TYPE_ROOM } // END
@@ -169,12 +166,6 @@ public:
EggList.push_back(go->GetGUID());
}
break;
case GO_PORTCULLIS_RAZORGORE:
case GO_PORTCULLIS_VAELASTRASZ:
case GO_PORTCULLIS_BROODLORD:
case GO_PORTCULLIS_THREEDRAGONS:
AddDoor(go, true);
break;
case GO_PORTCULLIS_NEFARIAN:
AddDoor(go, true);
nefarianDoorGUID = go->GetGUID();
@@ -199,20 +190,6 @@ public:
if (go->GetEntry() == GO_BLACK_DRAGON_EGG)
EggList.remove(go->GetGUID());
switch (go->GetEntry())
{
case GO_PORTCULLIS_RAZORGORE:
case GO_PORTCULLIS_VAELASTRASZ:
case GO_PORTCULLIS_BROODLORD:
case GO_PORTCULLIS_THREEDRAGONS:
case GO_PORTCULLIS_CHROMAGGUS:
case GO_PORTCULLIS_NEFARIAN:
AddDoor(go, false);
break;
default:
break;
}
}
uint32 GetData(uint32 data) const override
@@ -238,12 +215,6 @@ public:
if (GetBossState(DATA_VAELASTRAZ_THE_CORRUPT) != DONE)
return false;
break;
case DATA_CHROMAGGUS:
if (GetBossState(DATA_FIREMAW) != DONE
|| GetBossState(DATA_EBONROC) != DONE
|| GetBossState(DATA_FLAMEGOR) != DONE)
return false;
break;
default:
break;
}