aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities/Object
diff options
context:
space:
mode:
authorGiacomo Pozzoni <giacomopoz@gmail.com>2020-12-26 22:32:01 +0100
committerGitHub <noreply@github.com>2020-12-26 22:32:01 +0100
commit3b2c878dd067f49ee48ddfc27c62eb4e1fe619d9 (patch)
treeee44efef2fba97af61bed899c0ad29c5e35a017d /src/server/game/Entities/Object
parente8b78acbee35b63f4f19fdcfdf4915cf9d784b27 (diff)
Core/Spells: Implemented personal summons (#19231) (#25765)
* Core/Spells: Implemented personal summons (#19231) * By default determined by summon property flag SUMMON_PROP_FLAG_PERSONAL_SPAWN Closes #18254 (cherry picked from commit b7bb5e6a98119512702519adecf559ecedc20743) # 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
Diffstat (limited to 'src/server/game/Entities/Object')
-rw-r--r--src/server/game/Entities/Object/Object.cpp20
-rw-r--r--src/server/game/Entities/Object/Object.h4
2 files changed, 17 insertions, 7 deletions
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index a1bdca52d97..590b351d762 100644
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -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)
diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h
index 1fb239a1031..c30eadecb9a 100644
--- a/src/server/game/Entities/Object/Object.h
+++ b/src/server/game/Entities/Object/Object.h
@@ -404,8 +404,8 @@ class TC_GAME_API WorldObject : public Object, public WorldLocation
void ClearZoneScript();
ZoneScript* GetZoneScript() const { return m_zoneScript; }
- TempSummon* SummonCreature(uint32 entry, Position const& pos, TempSummonType despawnType = TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime = 0s, uint32 vehId = 0, uint32 spellId = 0);
- TempSummon* SummonCreature(uint32 entry, float x, float y, float z, float o = 0, TempSummonType despawnType = TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime = 0s);
+ TempSummon* SummonCreature(uint32 entry, Position const& pos, TempSummonType despawnType = TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime = 0s, uint32 vehId = 0, uint32 spellId = 0, bool visibleBySummonerOnly = false);
+ TempSummon* SummonCreature(uint32 entry, float x, float y, float z, float o = 0, TempSummonType despawnType = TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime = 0s, bool visibleBySummonerOnly = false);
GameObject* SummonGameObject(uint32 entry, Position const& pos, QuaternionData const& rot, Seconds respawnTime, GOSummonType summonType = GO_SUMMON_TIMED_OR_CORPSE_DESPAWN);
GameObject* SummonGameObject(uint32 entry, float x, float y, float z, float ang, QuaternionData const& rot, Seconds respawnTime, GOSummonType summonType = GO_SUMMON_TIMED_OR_CORPSE_DESPAWN);
Creature* SummonTrigger(float x, float y, float z, float ang, Milliseconds despawnTime, CreatureAI* (*GetAI)(Creature*) = nullptr);