Merge branch 'azerothcore:master' into Playerbot

This commit is contained in:
ZhengPeiRu21
2022-04-14 09:06:05 -06:00
committed by GitHub
6 changed files with 36694 additions and 19 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,31 @@
-- DB update 2022_04_11_04 -> 2022_04_13_00
DROP PROCEDURE IF EXISTS `updateDb`;
DELIMITER //
CREATE PROCEDURE updateDb ()
proc:BEGIN DECLARE OK VARCHAR(100) DEFAULT 'FALSE';
SELECT COUNT(*) INTO @COLEXISTS
FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'version_db_world' AND COLUMN_NAME = '2022_04_11_04';
IF @COLEXISTS = 0 THEN LEAVE proc; END IF;
START TRANSACTION;
ALTER TABLE version_db_world CHANGE COLUMN 2022_04_11_04 2022_04_13_00 bit;
SELECT sql_rev INTO OK FROM version_db_world WHERE sql_rev = '1649799370491572700'; IF OK <> 'FALSE' THEN LEAVE proc; END IF;
--
-- START UPDATING QUERIES
--
INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1649799370491572700');
DELETE FROM `areatrigger_scripts` WHERE `entry` = 3847;
INSERT INTO `areatrigger_scripts` (`entry`, `ScriptName`) VALUES
(3847, 'at_orb_of_command');
--
-- END UPDATING QUERIES
--
UPDATE version_db_world SET date = '2022_04_13_00' WHERE sql_rev = '1649799370491572700';
COMMIT;
END //
DELIMITER ;
CALL updateDb();
DROP PROCEDURE IF EXISTS `updateDb`;

View File

@@ -4242,6 +4242,12 @@ void SpellMgr::LoadSpellInfoCorrections()
spellInfo->AttributesEx2 |= SPELL_ATTR2_IGNORE_LINE_OF_SIGHT;
});
// Brood Power Bronze
ApplySpellFix({ 22291 }, [](SpellInfo* spellInfo)
{
spellInfo->MaxAffectedTargets = 1;
});
for (uint32 i = 0; i < GetSpellInfoStoreSize(); ++i)
{
SpellInfo* spellInfo = mSpellInfoMap[i];

View File

@@ -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)
{

View File

@@ -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();
}

View File

@@ -322,7 +322,7 @@ class spell_pet_dk_gargoyle_strike : public SpellScript
}
}
SetHitDamage(damage);
SetEffectValue(damage);
}
void Register() override