mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-26 07:06:23 +00:00
Merge branch 'azerothcore:master' into Playerbot
This commit is contained in:
@@ -199,6 +199,30 @@ std::unordered_map<uint32, uint32> spawnerSpells =
|
||||
{ NPC_RED_SPAWNER, SPELL_SPAWN_RED_DRAKONID }
|
||||
};
|
||||
|
||||
struct ClassCallSelector : public Acore::unary_function<Unit*, bool>
|
||||
{
|
||||
ClassCallSelector(Unit const* unit, uint8 targetClass) : _me(unit), _targetClass(targetClass) { }
|
||||
|
||||
bool operator()(Unit const* target) const
|
||||
{
|
||||
if (!_me || !target || target->GetTypeId() != TYPEID_PLAYER)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (target->getClass() != _targetClass)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
Unit const* _me;
|
||||
uint8 _targetClass;
|
||||
};
|
||||
|
||||
class boss_victor_nefarius : public CreatureScript
|
||||
{
|
||||
public:
|
||||
@@ -636,7 +660,17 @@ struct boss_nefarian : public BossAI
|
||||
events.ScheduleEvent(EVENT_TAILLASH, 10000);
|
||||
break;
|
||||
case EVENT_CLASSCALL:
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
|
||||
std::set<uint8> classesPresent;
|
||||
for (auto& ref : me->getThreatMgr().getThreatList())
|
||||
{
|
||||
if (ref->getTarget() && ref->getTarget()->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
classesPresent.insert(ref->getTarget()->getClass());
|
||||
}
|
||||
}
|
||||
uint8 targetClass = Acore::Containers::SelectRandomContainerElement(classesPresent);
|
||||
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, ClassCallSelector(me, targetClass)))
|
||||
{
|
||||
switch (target->getClass())
|
||||
{
|
||||
@@ -997,7 +1031,7 @@ class spell_class_call_handler : public SpellScript
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_class_call_handler::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_class_call_handler::FilterTargets, EFFECT_ALL, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
|
||||
if (m_scriptSpellId == SPELL_ROGUE)
|
||||
{
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
#include "TemporarySummon.h"
|
||||
#include "blackwing_lair.h"
|
||||
|
||||
#include <array>
|
||||
|
||||
DoorData const doorData[] =
|
||||
{
|
||||
{ GO_PORTCULLIS_RAZORGORE, DATA_RAZORGORE_THE_UNTAMED, DOOR_TYPE_PASSAGE, BOUNDARY_NONE}, // ID 175946 || GUID 7230
|
||||
@@ -83,6 +85,7 @@ public:
|
||||
EggEvent = 0;
|
||||
NefarianLeftTunnel = 0;
|
||||
NefarianRightTunnel = 0;
|
||||
addsCount.fill(0);
|
||||
}
|
||||
|
||||
void OnCreatureCreate(Creature* creature) override
|
||||
@@ -98,11 +101,25 @@ public:
|
||||
chromaggusGUID = creature->GetGUID();
|
||||
break;
|
||||
case NPC_BLACKWING_DRAGON:
|
||||
++addsCount[0];
|
||||
if (Creature* razor = instance->GetCreature(razorgoreGUID))
|
||||
{
|
||||
if (CreatureAI* razorAI = razor->AI())
|
||||
{
|
||||
razorAI->JustSummoned(creature);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case NPC_BLACKWING_LEGIONAIRE:
|
||||
case NPC_BLACKWING_MAGE:
|
||||
++addsCount[1];
|
||||
if (Creature* razor = instance->GetCreature(razorgoreGUID))
|
||||
{
|
||||
if (CreatureAI* razorAI = razor->AI())
|
||||
{
|
||||
razorAI->JustSummoned(creature);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case NPC_BLACKWING_GUARDSMAN:
|
||||
guardList.push_back(creature->GetGUID());
|
||||
@@ -286,15 +303,23 @@ public:
|
||||
{
|
||||
switch (data)
|
||||
{
|
||||
case DONE:
|
||||
EggEvent = data;
|
||||
break;
|
||||
case FAIL:
|
||||
_events.CancelEvent(EVENT_RAZOR_SPAWN);
|
||||
break;
|
||||
case IN_PROGRESS:
|
||||
_events.ScheduleEvent(EVENT_RAZOR_SPAWN, 45 * IN_MILLISECONDS);
|
||||
EggEvent = data;
|
||||
EggCount = 0;
|
||||
addsCount.fill(0);
|
||||
break;
|
||||
case NOT_STARTED:
|
||||
_events.CancelEvent(EVENT_RAZOR_SPAWN);
|
||||
EggEvent = data;
|
||||
EggCount = 0;
|
||||
addsCount.fill(0);
|
||||
|
||||
for (ObjectGuid const& guid : EggList)
|
||||
{
|
||||
@@ -373,20 +398,6 @@ public:
|
||||
{
|
||||
switch (unit->GetEntry())
|
||||
{
|
||||
case NPC_RAZORGORE:
|
||||
//! HACK, needed because of buggy CreatureAI after charm
|
||||
if (EggEvent == DONE)
|
||||
{
|
||||
if (unit->GetEntry() == NPC_RAZORGORE && GetBossState(DATA_RAZORGORE_THE_UNTAMED) != DONE)
|
||||
{
|
||||
SetBossState(DATA_RAZORGORE_THE_UNTAMED, DONE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_events.CancelEvent(EVENT_RAZOR_SPAWN);
|
||||
}
|
||||
break;
|
||||
case NPC_BLACK_DRAKONID:
|
||||
case NPC_BLUE_DRAKONID:
|
||||
case NPC_BRONZE_DRAKONID:
|
||||
@@ -423,6 +434,23 @@ public:
|
||||
}
|
||||
}
|
||||
break;
|
||||
case NPC_BLACKWING_DRAGON:
|
||||
--addsCount[0];
|
||||
if (EggEvent != DONE && _events.GetTimeUntilEvent(EVENT_RAZOR_SPAWN) == Milliseconds::max())
|
||||
{
|
||||
_events.ScheduleEvent(EVENT_RAZOR_SPAWN, 1s);
|
||||
}
|
||||
break;
|
||||
case NPC_BLACKWING_LEGIONAIRE:
|
||||
case NPC_BLACKWING_MAGE:
|
||||
--addsCount[1];
|
||||
if (EggEvent != DONE && _events.GetTimeUntilEvent(EVENT_RAZOR_SPAWN) == Milliseconds::max())
|
||||
{
|
||||
_events.ScheduleEvent(EVENT_RAZOR_SPAWN, 1s);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -440,15 +468,44 @@ public:
|
||||
case EVENT_RAZOR_SPAWN:
|
||||
if (EggEvent == IN_PROGRESS)
|
||||
{
|
||||
bool spawnMoreAdds = true;
|
||||
for (uint8 i = urand(2, 5); i > 0; --i)
|
||||
{
|
||||
if (Creature* summon = instance->SummonCreature(Entry[urand(0, 2)], SummonPosition[urand(0, 7)]))
|
||||
uint32 mobEntry = Entry[urand(0, 2)];
|
||||
uint32 dragonkinsCount = addsCount[0];
|
||||
uint32 orcsCount = addsCount[1];
|
||||
|
||||
// If more than 12 dragonkins...
|
||||
if (dragonkinsCount >= 12)
|
||||
{
|
||||
//... and more than 40 orcs - stop spawning more adds.
|
||||
if (orcsCount >= 40)
|
||||
{
|
||||
spawnMoreAdds = false;
|
||||
break;
|
||||
}
|
||||
//... - stop spawning them.
|
||||
else if (mobEntry == NPC_BLACKWING_DRAGON)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// If more than 40 orcs - stop spawning them.
|
||||
else if (orcsCount >= 40 && mobEntry != NPC_BLACKWING_DRAGON)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Creature* summon = instance->SummonCreature(mobEntry, SummonPosition[urand(0, 7)]))
|
||||
{
|
||||
summon->AI()->DoZoneInCombat();
|
||||
}
|
||||
}
|
||||
|
||||
_events.ScheduleEvent(EVENT_RAZOR_SPAWN, 15000);
|
||||
if (spawnMoreAdds)
|
||||
{
|
||||
_events.ScheduleEvent(EVENT_RAZOR_SPAWN, 15000);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case EVENT_RAZOR_PHASE_TWO:
|
||||
@@ -530,6 +587,7 @@ public:
|
||||
uint32 EggEvent;
|
||||
GuidList EggList;
|
||||
GuidList guardList;
|
||||
std::array<uint32, 2> addsCount;
|
||||
|
||||
// Nefarian
|
||||
uint32 NefarianLeftTunnel;
|
||||
@@ -586,8 +644,33 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
enum orb_of_command_misc
|
||||
{
|
||||
QUEST_BLACKHANDS_COMMAND = 7761,
|
||||
MAP_BWL = 469
|
||||
};
|
||||
|
||||
const Position orbOfCommandTP = { -7672.46f, -1107.19f, 396.65f, 0.59f };
|
||||
|
||||
class at_orb_of_command : public AreaTriggerScript
|
||||
{
|
||||
public:
|
||||
at_orb_of_command() : AreaTriggerScript("at_orb_of_command") { }
|
||||
|
||||
bool OnTrigger(Player* player, AreaTrigger const* /*trigger*/) override
|
||||
{
|
||||
if (!player->IsAlive() && player->GetQuestRewardStatus(QUEST_BLACKHANDS_COMMAND))
|
||||
{
|
||||
player->TeleportTo(MAP_BWL, orbOfCommandTP.m_positionX, orbOfCommandTP.m_positionY, orbOfCommandTP.m_positionZ, orbOfCommandTP.m_orientation);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_instance_blackwing_lair()
|
||||
{
|
||||
new instance_blackwing_lair();
|
||||
new spell_bwl_shadowflame();
|
||||
new at_orb_of_command();
|
||||
}
|
||||
|
||||
@@ -322,7 +322,7 @@ class spell_pet_dk_gargoyle_strike : public SpellScript
|
||||
}
|
||||
}
|
||||
|
||||
SetHitDamage(damage);
|
||||
SetEffectValue(damage);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
|
||||
Reference in New Issue
Block a user