This commit is contained in:
Ovahlord
2018-04-09 07:29:47 +02:00
93 changed files with 2386 additions and 119 deletions

View File

@@ -50,10 +50,7 @@ struct EnumName
#define CREATE_NAMED_ENUM(VALUE) { VALUE, STRINGIZE(VALUE) }
#define NPCFLAG_COUNT 24
#define FLAGS_EXTRA_COUNT 21
EnumName<NPCFlags, int32> const npcFlagTexts[NPCFLAG_COUNT] =
EnumName<NPCFlags, int32> const npcFlagTexts[] =
{
{ UNIT_NPC_FLAG_AUCTIONEER, LANG_NPCINFO_AUCTIONEER },
{ UNIT_NPC_FLAG_BANKER, LANG_NPCINFO_BANKER },
@@ -81,6 +78,8 @@ EnumName<NPCFlags, int32> const npcFlagTexts[NPCFLAG_COUNT] =
{ UNIT_NPC_FLAG_VENDOR_REAGENT, LANG_NPCINFO_VENDOR_REAGENT }
};
uint32 const NPCFLAG_COUNT = std::extent<decltype(npcFlagTexts)>::value;
EnumName<Mechanics> const mechanicImmunes[MAX_MECHANIC] =
{
CREATE_NAMED_ENUM(MECHANIC_NONE),
@@ -154,7 +153,7 @@ EnumName<UnitFlags> const unitFlags[MAX_UNIT_FLAGS] =
CREATE_NAMED_ENUM(UNIT_FLAG_UNK_31)
};
EnumName<CreatureFlagsExtra> const flagsExtra[FLAGS_EXTRA_COUNT] =
EnumName<CreatureFlagsExtra> const flagsExtra[] =
{
CREATE_NAMED_ENUM(CREATURE_FLAG_EXTRA_INSTANCE_BIND),
CREATE_NAMED_ENUM(CREATURE_FLAG_EXTRA_CIVILIAN),
@@ -166,6 +165,7 @@ EnumName<CreatureFlagsExtra> const flagsExtra[FLAGS_EXTRA_COUNT] =
CREATE_NAMED_ENUM(CREATURE_FLAG_EXTRA_TRIGGER),
CREATE_NAMED_ENUM(CREATURE_FLAG_EXTRA_NO_TAUNT),
CREATE_NAMED_ENUM(CREATURE_FLAG_EXTRA_NO_MOVE_FLAGS_UPDATE),
CREATE_NAMED_ENUM(CREATURE_FLAG_EXTRA_NO_SELL_VENDOR),
CREATE_NAMED_ENUM(CREATURE_FLAG_EXTRA_WORLDEVENT),
CREATE_NAMED_ENUM(CREATURE_FLAG_EXTRA_GUARD),
CREATE_NAMED_ENUM(CREATURE_FLAG_EXTRA_NO_CRIT),
@@ -179,6 +179,8 @@ EnumName<CreatureFlagsExtra> const flagsExtra[FLAGS_EXTRA_COUNT] =
CREATE_NAMED_ENUM(CREATURE_FLAG_EXTRA_USE_OFFHAND_ATTACK)
};
uint32 const FLAGS_EXTRA_COUNT = std::extent<decltype(flagsExtra)>::value;
class npc_commandscript : public CommandScript
{
public:

View File

@@ -68,9 +68,9 @@ public:
void JustDied(Unit* killer) override
{
if (!killer)
return;
if (!killer)
return;
uint32 spawnCreatureID = 0;
switch (urand(0, 2))
@@ -265,10 +265,10 @@ public:
{
me->SetObjectScale(1.0f);
_events.Reset();
if (!killer)
return;
if (!killer)
return;
if (Creature* legoso = me->FindNearestCreature(NPC_LEGOSO, SIZE_OF_GRIDS))
{
Group* group = me->GetLootRecipientGroup();

View File

@@ -480,7 +480,7 @@ class npc_swarm_scarab : public CreatureScript
void JustDied(Unit* killer) override
{
if (killer)
if (killer)
DoCast(killer, SPELL_TRAITOR_KING);
}

View File

@@ -202,10 +202,10 @@ class boss_blood_queen_lana_thel : public CreatureScript
DoCastAOE(SPELL_BLOOD_INFUSION_CREDIT, true);
CleanAuras();
if (!killer)
return;
if (!killer)
return;
// Blah, credit the quest
if (_creditBloodQuickening)
{

View File

@@ -649,6 +649,14 @@ class npc_high_overlord_saurfang_icc : public CreatureScript
return false;
}
void GuardBroadcast(std::function<void(Creature*)>&& action) const
{
std::vector<Creature*> guardList;
GetCreatureListWithEntryInGrid(guardList, me, NPC_SE_KOR_KRON_REAVER, 100.0f);
for (Creature* guard : guardList)
action(guard);
}
void DoAction(int32 action) override
{
switch (action)
@@ -659,10 +667,11 @@ class npc_high_overlord_saurfang_icc : public CreatureScript
if (_events.IsInPhase(PHASE_INTRO_A) || _events.IsInPhase(PHASE_INTRO_H))
return;
GetCreatureListWithEntryInGrid(_guardList, me, NPC_SE_KOR_KRON_REAVER, 20.0f);
_guardList.sort(Trinity::ObjectDistanceOrderPred(me));
std::list<Creature*> guardList;
GetCreatureListWithEntryInGrid(guardList, me, NPC_SE_KOR_KRON_REAVER, 20.0f);
guardList.sort(Trinity::ObjectDistanceOrderPred(me));
uint32 x = 1;
for (std::list<Creature*>::iterator itr = _guardList.begin(); itr != _guardList.end(); ++x, ++itr)
for (auto itr = guardList.begin(); itr != guardList.end(); ++x, ++itr)
(*itr)->AI()->SetData(0, x);
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
@@ -684,15 +693,19 @@ class npc_high_overlord_saurfang_icc : public CreatureScript
_events.ScheduleEvent(EVENT_OUTRO_HORDE_5, 30000); // move
me->SetDisableGravity(false);
me->GetMotionMaster()->MoveFall();
for (std::list<Creature*>::iterator itr = _guardList.begin(); itr != _guardList.end(); ++itr)
(*itr)->AI()->DoAction(ACTION_DESPAWN);
GuardBroadcast([](Creature* guard)
{
guard->AI()->DoAction(ACTION_DESPAWN);
});
break;
}
case ACTION_INTERRUPT_INTRO:
{
_events.Reset();
for (std::list<Creature*>::iterator itr = _guardList.begin(); itr != _guardList.end(); ++itr)
(*itr)->AI()->DoAction(ACTION_DESPAWN);
GuardBroadcast([](Creature* guard)
{
guard->AI()->DoAction(ACTION_DESPAWN);
});
break;
}
default:
@@ -776,8 +789,10 @@ class npc_high_overlord_saurfang_icc : public CreatureScript
break;
case EVENT_INTRO_HORDE_8:
Talk(SAY_INTRO_HORDE_8);
for (std::list<Creature*>::iterator itr = _guardList.begin(); itr != _guardList.end(); ++itr)
(*itr)->AI()->DoAction(ACTION_CHARGE);
GuardBroadcast([](Creature* guard)
{
guard->AI()->DoAction(ACTION_CHARGE);
});
me->GetMotionMaster()->MoveCharge(chargePos[0].GetPositionX(), chargePos[0].GetPositionY(), chargePos[0].GetPositionZ(), 8.5f, POINT_CHARGE);
break;
case EVENT_OUTRO_HORDE_2: // say
@@ -810,7 +825,6 @@ class npc_high_overlord_saurfang_icc : public CreatureScript
private:
EventMap _events;
InstanceScript* _instance;
std::list<Creature*> _guardList;
};
CreatureAI* GetAI(Creature* creature) const override
@@ -846,6 +860,14 @@ class npc_muradin_bronzebeard_icc : public CreatureScript
return false;
}
void GuardBroadcast(std::function<void(Creature*)>&& action) const
{
std::vector<Creature*> guardList;
GetCreatureListWithEntryInGrid(guardList, me, NPC_SE_SKYBREAKER_MARINE, 100.0f);
for (Creature* guard : guardList)
action(guard);
}
void DoAction(int32 action) override
{
switch (action)
@@ -857,10 +879,11 @@ class npc_muradin_bronzebeard_icc : public CreatureScript
return;
_events.SetPhase(PHASE_INTRO_A);
GetCreatureListWithEntryInGrid(_guardList, me, NPC_SE_SKYBREAKER_MARINE, 20.0f);
_guardList.sort(Trinity::ObjectDistanceOrderPred(me));
std::list<Creature*> guardList;
GetCreatureListWithEntryInGrid(guardList, me, NPC_SE_SKYBREAKER_MARINE, 20.0f);
guardList.sort(Trinity::ObjectDistanceOrderPred(me));
uint32 x = 1;
for (std::list<Creature*>::iterator itr = _guardList.begin(); itr != _guardList.end(); ++x, ++itr)
for (auto itr = guardList.begin(); itr != guardList.end(); ++x, ++itr)
(*itr)->AI()->SetData(0, x);
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
@@ -877,8 +900,10 @@ class npc_muradin_bronzebeard_icc : public CreatureScript
Talk(SAY_OUTRO_ALLIANCE_1);
me->SetDisableGravity(false);
me->GetMotionMaster()->MoveFall();
for (std::list<Creature*>::iterator itr = _guardList.begin(); itr != _guardList.end(); ++itr)
(*itr)->AI()->DoAction(ACTION_DESPAWN);
GuardBroadcast([](Creature* guard)
{
guard->AI()->DoAction(ACTION_DESPAWN);
});
// temp until outro fully done - to put deathbringer on respawn timer (until next reset)
if (Creature* deathbringer = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_DEATHBRINGER_SAURFANG)))
@@ -887,8 +912,10 @@ class npc_muradin_bronzebeard_icc : public CreatureScript
}
case ACTION_INTERRUPT_INTRO:
_events.Reset();
for (std::list<Creature*>::iterator itr = _guardList.begin(); itr != _guardList.end(); ++itr)
(*itr)->AI()->DoAction(ACTION_DESPAWN);
GuardBroadcast([](Creature* guard)
{
guard->AI()->DoAction(ACTION_DESPAWN);
});
break;
}
}
@@ -935,8 +962,10 @@ class npc_muradin_bronzebeard_icc : public CreatureScript
break;
case EVENT_INTRO_ALLIANCE_5:
Talk(SAY_INTRO_ALLIANCE_5);
for (std::list<Creature*>::iterator itr = _guardList.begin(); itr != _guardList.end(); ++itr)
(*itr)->AI()->DoAction(ACTION_CHARGE);
GuardBroadcast([](Creature* guard)
{
guard->AI()->DoAction(ACTION_CHARGE);
});
me->GetMotionMaster()->MoveCharge(chargePos[0].GetPositionX(), chargePos[0].GetPositionY(), chargePos[0].GetPositionZ(), 8.5f, POINT_CHARGE);
break;
}
@@ -946,7 +975,6 @@ class npc_muradin_bronzebeard_icc : public CreatureScript
private:
EventMap _events;
InstanceScript* _instance;
std::list<Creature*> _guardList;
};
CreatureAI* GetAI(Creature* creature) const override

View File

@@ -67,7 +67,7 @@ class boss_cyanigosa : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
Talk(SAY_DEATH);
_JustDied();
_JustDied();
}
void MoveInLineOfSight(Unit* /*who*/) override { }

View File

@@ -96,7 +96,7 @@ class boss_erekem : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
Talk(SAY_DEATH);
_JustDied();
_JustDied();
}
bool CheckGuardAuras(Creature* guard) const

View File

@@ -167,7 +167,7 @@ class boss_ichoron : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
Talk(SAY_DEATH);
_JustDied();
_JustDied();
}
void JustSummoned(Creature* summon) override

View File

@@ -118,7 +118,7 @@ class boss_xevozz : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
Talk(SAY_DEATH);
_JustDied();
_JustDied();
}
void SpellHit(Unit* /*who*/, SpellInfo const* spell) override

View File

@@ -107,7 +107,7 @@ class boss_zuramat : public CreatureScript
void JustDied(Unit* /*killer*/) override
{
Talk(SAY_DEATH);
_JustDied();
_JustDied();
}
void KilledUnit(Unit* victim) override

View File

@@ -371,9 +371,9 @@ public:
void JustDied(Unit* killer) override
{
if (!killer || killer->GetTypeId() != TYPEID_PLAYER)
return;
if (!killer || killer->GetTypeId() != TYPEID_PLAYER)
return;
Player* player = killer->ToPlayer();
if (player->GetQuestStatus(QUEST_TAKEN_BY_THE_SCOURGE) == QUEST_STATUS_INCOMPLETE)
@@ -1240,26 +1240,29 @@ public:
{
DoCastVictim(SPELL_SHADOW_BOLT);
shadowBoltTimer = urand(5000, 12000);
} else shadowBoltTimer -= diff;
}
else shadowBoltTimer -= diff;
if (deflectionTimer <= diff)
{
DoCastVictim(SPELL_DEFLECTION);
deflectionTimer = urand(20000, 25000);
} else deflectionTimer -= diff;
}
else deflectionTimer -= diff;
if (soulBlastTimer <= diff)
{
DoCastVictim(SPELL_SOUL_BLAST);
soulBlastTimer = urand(12000, 18000);
} else soulBlastTimer -= diff;
}
else soulBlastTimer -= diff;
}
DoMeleeAttackIfReady();
}
}
void JustDied(Unit* killer) override
{
void JustDied(Unit* killer) override
{
if (!leryssaGUID || !arlosGUID)
return;
@@ -1276,8 +1279,8 @@ public:
leryssa->ClearUnitState(UNIT_STATE_STUNNED);
leryssa->SetWalk(false);
leryssa->GetMotionMaster()->MovePoint(0, 3722.114502f, 3564.201660f, 477.441437f);
if (killer && killer->GetTypeId() == TYPEID_PLAYER)
if (killer && killer->GetTypeId() == TYPEID_PLAYER)
killer->ToPlayer()->RewardPlayerAndGroupAtEvent(NPC_PRINCE_VALANAR, 0);
}
};