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
This commit is contained in:
Giacomo Pozzoni
2019-05-23 21:08:29 +02:00
committed by GitHub
parent 457fc22473
commit 797fba98e9
64 changed files with 213 additions and 133 deletions

View File

@@ -2708,13 +2708,13 @@ void SmartScript::GetTargets(ObjectVector& targets, SmartScriptHolder const& e,
if (!charmerOrOwnerGuid)
if (TempSummon* tempSummon = me->ToTempSummon())
if (Unit* summoner = tempSummon->GetSummoner())
if (WorldObject* summoner = tempSummon->GetSummoner())
charmerOrOwnerGuid = summoner->GetGUID();
if (!charmerOrOwnerGuid)
charmerOrOwnerGuid = me->GetCreatorGUID();
if (Unit* owner = ObjectAccessor::GetUnit(*me, charmerOrOwnerGuid))
if (WorldObject* owner = ObjectAccessor::GetWorldObject(*me, charmerOrOwnerGuid))
targets.push_back(owner);
}
else if (go)
@@ -2726,7 +2726,7 @@ void SmartScript::GetTargets(ObjectVector& targets, SmartScriptHolder const& e,
// Get owner of owner
if (e.target.owner.useCharmerOrOwner && !targets.empty())
{
Unit* owner = targets.front()->ToUnit();
WorldObject* owner = targets.front();
targets.clear();
if (Unit* base = ObjectAccessor::GetUnit(*owner, owner->GetCharmerOrOwnerGUID()))