From 5f545f540216d3b94c26e4aeda50c8bb8d5c3d74 Mon Sep 17 00:00:00 2001 From: Giacomo Pozzoni Date: Thu, 23 May 2019 21:08:29 +0200 Subject: 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 (cherry picked from commit 797fba98e95da1236465a15061ec4122d7ec33fe) --- src/server/game/Entities/Object/Object.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/server/game/Entities/Object') diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 4e9aedf271d..e2c6d6a224c 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -1690,7 +1690,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*/, ObjectGuid privateObjectOwner /*= ObjectGuid::Empty*/) +TempSummon* Map::SummonCreature(uint32 entry, Position const& pos, SummonPropertiesEntry const* properties /*= nullptr*/, uint32 duration /*= 0*/, WorldObject* summoner /*= nullptr*/, uint32 spellId /*= 0*/, uint32 vehId /*= 0*/, ObjectGuid privateObjectOwner /*= ObjectGuid::Empty*/) { uint32 mask = UNIT_MASK_SUMMON; if (properties) @@ -1740,6 +1740,8 @@ TempSummon* Map::SummonCreature(uint32 entry, Position const& pos, SummonPropert } } + Unit* summonerUnit = summoner ? summoner->ToUnit() : nullptr; + TempSummon* summon = nullptr; switch (mask) { @@ -1747,16 +1749,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; } @@ -1835,7 +1837,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, vehId, privateObjectOwner)) + if (TempSummon* summon = map->SummonCreature(entry, pos, nullptr, despawnTime, this, spellId, vehId, privateObjectOwner)) { summon->SetTempSummonType(despawnType); return summon; -- cgit v1.2.3