aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities/Object
diff options
context:
space:
mode:
authorGiacomo Pozzoni <giacomopoz@gmail.com>2019-05-23 21:08:29 +0200
committerGitHub <noreply@github.com>2019-05-23 21:08:29 +0200
commit797fba98e95da1236465a15061ec4122d7ec33fe (patch)
tree2ebd1df31f8bd2573cdb65683e0966b4e3c97a43 /src/server/game/Entities/Object
parent457fc224733cc78cedc5e956442a9f5d7bd2f049 (diff)
3.3.5 gameobject summoner (#23289)
* Scripts/Misc: Change IsSummonedBy(Unit*) to IsSummonedBy(WorldObject*) * Scripts/Misc: Fix build * Core/TempSummons: Rename GetSummoner() to GetSummonerUnit() * Core/TempSummons: Add support to TempSummons::GetSummoner() to return GameObject too * Fix build * Core/TempSummons: Allow GameObject to be owner of TempSummon * Core/TempSummons: Add support to SAI for GameObject owner of TempSummon * Scripts/Misc: Fix no-pch build * Core/TempSummons: Implement PR comments
Diffstat (limited to 'src/server/game/Entities/Object')
-rw-r--r--src/server/game/Entities/Object/Object.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index afdd4dcdd25..3820e3e8523 100644
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -1830,7 +1830,7 @@ void WorldObject::AddObjectToRemoveList()
map->AddObjectToRemoveList(this);
}
-TempSummon* Map::SummonCreature(uint32 entry, Position const& pos, SummonPropertiesEntry const* properties /*= nullptr*/, uint32 duration /*= 0*/, Unit* 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*/)
{
uint32 mask = UNIT_MASK_SUMMON;
if (properties)
@@ -1884,6 +1884,8 @@ TempSummon* Map::SummonCreature(uint32 entry, Position const& pos, SummonPropert
if (summoner)
phase = summoner->GetPhaseMask();
+ Unit* summonerUnit = summoner ? summoner->ToUnit() : nullptr;
+
TempSummon* summon = nullptr;
switch (mask)
{
@@ -1891,16 +1893,16 @@ TempSummon* Map::SummonCreature(uint32 entry, Position const& pos, SummonPropert
summon = new TempSummon(properties, summoner, false);
break;
case UNIT_MASK_GUARDIAN:
- summon = new Guardian(properties, summoner, false);
+ summon = new Guardian(properties, summonerUnit, false);
break;
case UNIT_MASK_PUPPET:
- summon = new Puppet(properties, summoner);
+ summon = new Puppet(properties, summonerUnit);
break;
case UNIT_MASK_TOTEM:
- summon = new Totem(properties, summoner);
+ summon = new Totem(properties, summonerUnit);
break;
case UNIT_MASK_MINION:
- summon = new Minion(properties, summoner, false);
+ summon = new Minion(properties, summonerUnit, false);
break;
}
@@ -1969,7 +1971,7 @@ TempSummon* WorldObject::SummonCreature(uint32 entry, Position const& pos, TempS
{
if (Map* map = FindMap())
{
- if (TempSummon* summon = map->SummonCreature(entry, pos, nullptr, despawnTime, ToUnit(), spellId))
+ if (TempSummon* summon = map->SummonCreature(entry, pos, nullptr, despawnTime, this, spellId))
{
summon->SetTempSummonType(despawnType);
return summon;