Core/Spells: Implemented SUMMON_PROP_FLAG_PERSONAL_GROUP_SPAWN

This commit is contained in:
Shauren
2021-03-28 20:22:05 +02:00
parent 46a81ea1f4
commit 2398c1e23c
5 changed files with 34 additions and 5 deletions
+2 -2
View File
@@ -1431,7 +1431,7 @@ enum SummonPropFlags
SUMMON_PROP_FLAG_UNK2 = 0x00000002, // 616 spells in 3.0.3, something friendly
SUMMON_PROP_FLAG_UNK3 = 0x00000004, // 22 spells in 3.0.3, no idea...
SUMMON_PROP_FLAG_UNK4 = 0x00000008, // 49 spells in 3.0.3, some mounts
SUMMON_PROP_FLAG_PERSONAL_SPAWN = 0x00000010, // Personal Spawn (creature visible only by summoner)
SUMMON_PROP_FLAG_PERSONAL_SPAWN = 0x00000010, // Only Visible to Summoner
SUMMON_PROP_FLAG_UNK6 = 0x00000020, // 0 spells in 3.3.5, unused
SUMMON_PROP_FLAG_UNK7 = 0x00000040, // 12 spells in 3.0.3, no idea
SUMMON_PROP_FLAG_UNK8 = 0x00000080, // 4 spells in 3.0.3, no idea
@@ -1443,7 +1443,7 @@ enum SummonPropFlags
SUMMON_PROP_FLAG_UNK14 = 0x00002000, // Guides, player follows
SUMMON_PROP_FLAG_UNK15 = 0x00004000, // Force of Nature, Shadowfiend, Feral Spirit, Summon Water Elemental
SUMMON_PROP_FLAG_UNK16 = 0x00008000, // Light/Dark Bullet, Soul/Fiery Consumption, Twisted Visage, Twilight Whelp. Phase related?
SUMMON_PROP_FLAG_UNK17 = 0x00010000,
SUMMON_PROP_FLAG_PERSONAL_GROUP_SPAWN = 0x00010000, // Only Visible to Summoner's Group
SUMMON_PROP_FLAG_UNK18 = 0x00020000,
SUMMON_PROP_FLAG_UNK19 = 0x00040000,
SUMMON_PROP_FLAG_UNK20 = 0x00080000,
@@ -1424,6 +1424,10 @@ bool WorldObject::CheckPrivateObjectOwnerVisibility(WorldObject const* seer) con
if (_privateObjectOwner == seer->GetPrivateObjectOwner())
return true;
if (Player const* playerSeer = seer->ToPlayer())
if (playerSeer->IsInGroup(_privateObjectOwner))
return true;
return false;
}
@@ -24403,6 +24403,19 @@ void Player::ClearComboPoints()
SetPower(POWER_COMBO_POINTS, 0);
}
bool Player::IsInGroup(ObjectGuid groupGuid) const
{
if (Group const* group = GetGroup())
if (group->GetGUID() == groupGuid)
return true;
if (Group const* group = GetOriginalGroup())
if (group->GetGUID() == groupGuid)
return true;
return false;
}
void Player::SetGroup(Group* group, int8 subgroup)
{
if (group == nullptr)
+1
View File
@@ -2334,6 +2334,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
/*** GROUP SYSTEM ***/
/*********************************************************/
bool IsInGroup(ObjectGuid groupGuid) const;
Group* GetGroupInvite() const { return m_groupInvite; }
void SetGroupInvite(Group* group) { m_groupInvite = group; }
Group* GetGroup() { return m_group.getTarget(); }
+14 -3
View File
@@ -1892,9 +1892,20 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
if (!m_originalCaster)
return;
ObjectGuid privateObjectOwner;
if (properties->Flags & SUMMON_PROP_FLAG_PERSONAL_SPAWN)
privateObjectOwner = m_originalCaster->IsPrivateObject() ? m_originalCaster->GetPrivateObjectOwner() : m_originalCaster->GetGUID();
ObjectGuid privateObjectOwner = [&]()
{
if (!(properties->Flags & (SUMMON_PROP_FLAG_PERSONAL_SPAWN | SUMMON_PROP_FLAG_PERSONAL_GROUP_SPAWN)))
return ObjectGuid::Empty;
if (m_originalCaster->IsPrivateObject())
return m_originalCaster->GetPrivateObjectOwner();
if (properties->Flags & SUMMON_PROP_FLAG_PERSONAL_GROUP_SPAWN)
if (m_originalCaster->IsPlayer() && m_originalCaster->ToPlayer()->GetGroup())
return m_originalCaster->ToPlayer()->GetGroup()->GetGUID();
return m_originalCaster->GetGUID();
}();
int32 duration = m_spellInfo->CalcDuration(m_originalCaster);