mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-16 21:20:01 -04:00
* Core/Spells: Implemented personal summons (#19231)
* By default determined by summon property flag SUMMON_PROP_FLAG_PERSONAL_SPAWN
Closes #18254
(cherry picked from commit b7bb5e6a98)
# Conflicts:
# src/server/game/Combat/ThreatManager.cpp
# src/server/game/DataStores/DBCEnums.h
# src/server/game/Entities/Creature/TemporarySummon.cpp
# src/server/game/Entities/Creature/TemporarySummon.h
# src/server/game/Entities/GameObject/GameObject.cpp
# src/server/game/Entities/Object/Object.cpp
# src/server/game/Entities/Object/Object.h
# src/server/game/Maps/Map.h
# src/server/game/Spells/SpellEffects.cpp
* Build fix
* Implement feedback
* Fix parameters passed in wrong order
This commit is contained in:
@@ -1586,8 +1586,15 @@ bool WorldObject::CanSeeOrDetect(WorldObject const* obj, bool ignoreStealth, boo
|
||||
|
||||
WorldObject const* viewpoint = this;
|
||||
if (Player const* player = ToPlayer())
|
||||
{
|
||||
viewpoint = player->GetViewpoint();
|
||||
|
||||
if (Creature const* creature = obj->ToCreature())
|
||||
if (TempSummon const* tempSummon = creature->ToTempSummon())
|
||||
if (tempSummon->IsVisibleBySummonerOnly() && GetGUID() != tempSummon->GetSummonerGUID())
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!viewpoint)
|
||||
viewpoint = this;
|
||||
|
||||
@@ -1847,7 +1854,7 @@ void WorldObject::AddObjectToRemoveList()
|
||||
map->AddObjectToRemoveList(this);
|
||||
}
|
||||
|
||||
TempSummon* Map::SummonCreature(uint32 entry, Position const& pos, SummonPropertiesEntry const* properties /*= nullptr*/, uint32 duration /*= 0*/, WorldObject* summoner /*= nullptr*/, uint32 spellId /*= 0*/, uint32 vehId /*= 0*/)
|
||||
TempSummon* Map::SummonCreature(uint32 entry, Position const& pos, SummonPropertiesEntry const* properties /*= nullptr*/, uint32 duration /*= 0*/, WorldObject* summoner /*= nullptr*/, uint32 spellId /*= 0*/, uint32 vehId /*= 0*/, bool visibleBySummonerOnly /*= false*/)
|
||||
{
|
||||
uint32 mask = UNIT_MASK_SUMMON;
|
||||
if (properties)
|
||||
@@ -1934,6 +1941,9 @@ TempSummon* Map::SummonCreature(uint32 entry, Position const& pos, SummonPropert
|
||||
summon->SetHomePosition(pos);
|
||||
|
||||
summon->InitStats(duration);
|
||||
|
||||
summon->SetVisibleBySummonerOnly(visibleBySummonerOnly);
|
||||
|
||||
AddToMap(summon->ToCreature());
|
||||
summon->InitSummon();
|
||||
|
||||
@@ -1984,11 +1994,11 @@ void WorldObject::ClearZoneScript()
|
||||
m_zoneScript = nullptr;
|
||||
}
|
||||
|
||||
TempSummon* WorldObject::SummonCreature(uint32 entry, Position const& pos, TempSummonType despawnType /*= TEMPSUMMON_MANUAL_DESPAWN*/, Milliseconds despawnTime /*= 0s*/, uint32 /*vehId = 0*/, uint32 spellId /*= 0*/)
|
||||
TempSummon* WorldObject::SummonCreature(uint32 entry, Position const& pos, TempSummonType despawnType /*= TEMPSUMMON_MANUAL_DESPAWN*/, Milliseconds despawnTime /*= 0s*/, uint32 /*vehId = 0*/, uint32 spellId /*= 0*/, bool visibleBySummonerOnly /*= false*/)
|
||||
{
|
||||
if (Map* map = FindMap())
|
||||
{
|
||||
if (TempSummon* summon = map->SummonCreature(entry, pos, nullptr, despawnTime.count(), this, spellId))
|
||||
if (TempSummon* summon = map->SummonCreature(entry, pos, nullptr, despawnTime.count(), this, spellId, 0, visibleBySummonerOnly))
|
||||
{
|
||||
summon->SetTempSummonType(despawnType);
|
||||
return summon;
|
||||
@@ -1998,13 +2008,13 @@ TempSummon* WorldObject::SummonCreature(uint32 entry, Position const& pos, TempS
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
TempSummon* WorldObject::SummonCreature(uint32 id, float x, float y, float z, float o /*= 0*/, TempSummonType despawnType /*= TEMPSUMMON_MANUAL_DESPAWN*/, Milliseconds despawnTime /*= 0s*/)
|
||||
TempSummon* WorldObject::SummonCreature(uint32 id, float x, float y, float z, float o /*= 0*/, TempSummonType despawnType /*= TEMPSUMMON_MANUAL_DESPAWN*/, Milliseconds despawnTime /*= 0s*/, bool visibleBySummonerOnly /*= false*/)
|
||||
{
|
||||
if (!x && !y && !z)
|
||||
GetClosePoint(x, y, z, GetCombatReach());
|
||||
if (!o)
|
||||
o = GetOrientation();
|
||||
return SummonCreature(id, { x,y,z,o }, despawnType, despawnTime);
|
||||
return SummonCreature(id, { x,y,z,o }, despawnType, despawnTime, 0, 0, visibleBySummonerOnly);
|
||||
}
|
||||
|
||||
GameObject* WorldObject::SummonGameObject(uint32 entry, Position const& pos, QuaternionData const& rot, Seconds respawnTime, GOSummonType summonType)
|
||||
|
||||
Reference in New Issue
Block a user