Core/Creatures: reworked tempoary summon creation

* all stats and values will now be set before summons are getting added to map
* cleaned up summon spell effect handler to reduce duplicade code
* summoner guids will no longer be set for every minion and correctly handle assigning creator guids instead. These values will serve as fallback guid if there is no summoner guid
* friendly tempsummons will now inherit the guild data of their player and pass them on to further allied summons. This fixes guild specific visuals for creatures such as Guild Battle Standards and Guild Heralds.

Todo: check for regressions
This commit is contained in:
Ovahlord
2020-04-21 15:28:17 +02:00
parent bc1a69caa3
commit d30c811d9e
19 changed files with 145 additions and 276 deletions

View File

@@ -549,7 +549,7 @@ public:
{
if (m_bIsDuelInProgress && pDoneBy->IsControlledByPlayer())
{
if (pDoneBy->GetGUID() != m_uiDuelerGUID && pDoneBy->GetOwnerGUID() != m_uiDuelerGUID) // other players cannot help
if (pDoneBy->GetGUID() != m_uiDuelerGUID && pDoneBy->GetOwnerOrCreatorGUID() != m_uiDuelerGUID) // other players cannot help
uiDamage = 0;
else if (uiDamage >= me->GetHealth())
{

View File

@@ -1672,7 +1672,7 @@ class spell_madness_of_deathwing_presence_of_the_aspects : public SpellScript
if (target->IsCreature())
if (TempSummon* summon = target->ToUnit()->ToTempSummon())
return !summon->GetOwnerGUID().IsPlayer();
return !summon->GetOwnerOrCreatorGUID().IsPlayer();
return true;
});

View File

@@ -48,7 +48,7 @@ class npc_pet_dk_ebon_gargoyle : public CreatureScript
void InitializeAI() override
{
CasterAI::InitializeAI();
ObjectGuid ownerGuid = me->GetOwnerGUID();
ObjectGuid ownerGuid = me->GetOwnerOrCreatorGUID();
if (!ownerGuid)
return;

View File

@@ -420,7 +420,7 @@ class spell_dk_death_pact : public SpellScript
for (Unit::ControlList::const_iterator itr = player->m_Controlled.begin(); itr != player->m_Controlled.end(); ++itr)
if (Creature* undeadPet = (*itr)->ToCreature())
if (undeadPet->IsAlive() &&
undeadPet->GetOwnerGUID() == player->GetGUID() &&
undeadPet->GetOwnerOrCreatorGUID() == player->GetGUID() &&
undeadPet->GetCreatureType() == CREATURE_TYPE_UNDEAD &&
undeadPet->IsWithinDist(player, 100.0f, false))
return SPELL_CAST_OK;
@@ -435,7 +435,7 @@ class spell_dk_death_pact : public SpellScript
{
if (Unit* unit = (*itr)->ToUnit())
{
if (unit->GetOwnerGUID() == GetCaster()->GetGUID() && unit->GetCreatureType() == CREATURE_TYPE_UNDEAD)
if (unit->GetOwnerOrCreatorGUID() == GetCaster()->GetGUID() && unit->GetCreatureType() == CREATURE_TYPE_UNDEAD)
{
target = unit;
break;

View File

@@ -5248,16 +5248,11 @@ class spell_gen_guild_battle_standard_buff : public SpellScript
void FilterTargets(std::list<WorldObject*>& targets)
{
TempSummon* summon = GetCaster()->ToTempSummon();
Unit* summoner = summon->GetSummoner();
if (Player* player = summoner->ToPlayer())
ObjectGuid guildGuid = GetCaster()->GetGuidValue(OBJECT_FIELD_DATA);
targets.remove_if([guildGuid](WorldObject* target)->bool
{
uint32 guildId = player->GetGuildId();
targets.remove_if([guildId](WorldObject* target)->bool
{
return !target->IsPlayer() || target->ToPlayer()->GetGuildId() != guildId;
});
}
return !target->IsPlayer() || target->ToPlayer()->GetGuidValue(OBJECT_FIELD_DATA) != guildGuid;
});
}
void Register() override