mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Instance: add new method
This commit is contained in:
@@ -708,6 +708,34 @@ void InstanceScript::DoCastSpellOnPlayers(uint32 spell, bool includePets /*= fal
|
||||
}
|
||||
}
|
||||
|
||||
void InstanceScript::DoCastSpellOnPlayer(Player* player, uint32 spell, bool includePets /*= false*/, bool includeControlled /*= false*/)
|
||||
{
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
player->CastSpell(player, spell, true);
|
||||
|
||||
if (!includePets)
|
||||
return;
|
||||
|
||||
for (uint8 itr2 = 0; itr2 < MAX_SUMMON_SLOT; ++itr2)
|
||||
{
|
||||
if (ObjectGuid summonGUID = player->m_SummonSlot[itr2])
|
||||
if (Creature* summon = instance->GetCreature(summonGUID))
|
||||
summon->CastSpell(player, spell, true);
|
||||
}
|
||||
|
||||
if (!includeControlled)
|
||||
return;
|
||||
|
||||
for (auto itr2 = player->m_Controlled.begin(); itr2 != player->m_Controlled.end(); ++itr2)
|
||||
{
|
||||
if (Unit* controlled = *itr2)
|
||||
if (controlled->IsInWorld() && controlled->GetTypeId() == TYPEID_UNIT)
|
||||
controlled->CastSpell(player, spell, true);
|
||||
}
|
||||
}
|
||||
|
||||
bool InstanceScript::ServerAllowsTwoSideGroups()
|
||||
{
|
||||
return sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP);
|
||||
|
||||
@@ -232,6 +232,7 @@ class TC_GAME_API InstanceScript : public ZoneScript
|
||||
|
||||
// Cast spell on all players in instance
|
||||
void DoCastSpellOnPlayers(uint32 spell, bool includePets = false, bool includeControlled = false);
|
||||
void DoCastSpellOnPlayer(Player* player, uint32 spell, bool includePets = false, bool includeControlled = false);
|
||||
|
||||
// Return wether server allow two side groups or not
|
||||
static bool ServerAllowsTwoSideGroups();
|
||||
|
||||
Reference in New Issue
Block a user