mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Objects: Pass privateObjectOwner guid directly to SummonCreature functions
This commit is contained in:
@@ -1189,7 +1189,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
if (!summoner)
|
||||
break;
|
||||
|
||||
bool personalSpawn = flags.HasFlag(SmartActionSummonCreatureFlags::PersonalSpawn);
|
||||
ObjectGuid privateObjectOwner;
|
||||
if (flags.HasFlag(SmartActionSummonCreatureFlags::PersonalSpawn))
|
||||
privateObjectOwner = summoner->IsPrivateObject() ? summoner->GetPrivateObjectOwner() : summoner->GetGUID();
|
||||
|
||||
float x, y, z, o;
|
||||
for (WorldObject* target : targets)
|
||||
@@ -1199,7 +1201,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
y += e.target.y;
|
||||
z += e.target.z;
|
||||
o += e.target.o;
|
||||
if (Creature* summon = summoner->SummonCreature(e.action.summonCreature.creature, x, y, z, o, (TempSummonType)e.action.summonCreature.type, e.action.summonCreature.duration, personalSpawn))
|
||||
if (Creature* summon = summoner->SummonCreature(e.action.summonCreature.creature, x, y, z, o, (TempSummonType)e.action.summonCreature.type, e.action.summonCreature.duration, privateObjectOwner))
|
||||
if (e.action.summonCreature.attackInvoker)
|
||||
summon->AI()->AttackStart(target->ToUnit());
|
||||
}
|
||||
@@ -1207,7 +1209,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
if (e.GetTargetType() != SMART_TARGET_POSITION)
|
||||
break;
|
||||
|
||||
if (Creature* summon = summoner->SummonCreature(e.action.summonCreature.creature, e.target.x, e.target.y, e.target.z, e.target.o, (TempSummonType)e.action.summonCreature.type, e.action.summonCreature.duration, personalSpawn))
|
||||
if (Creature* summon = summoner->SummonCreature(e.action.summonCreature.creature, e.target.x, e.target.y, e.target.z, e.target.o, (TempSummonType)e.action.summonCreature.type, e.action.summonCreature.duration, privateObjectOwner))
|
||||
if (unit && e.action.summonCreature.attackInvoker)
|
||||
summon->AI()->AttackStart(unit);
|
||||
break;
|
||||
|
||||
@@ -1696,7 +1696,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*/, bool personalSpawn /*= false*/)
|
||||
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*/)
|
||||
{
|
||||
uint32 mask = UNIT_MASK_SUMMON;
|
||||
if (properties)
|
||||
@@ -1782,8 +1782,7 @@ TempSummon* Map::SummonCreature(uint32 entry, Position const& pos, SummonPropert
|
||||
|
||||
summon->InitStats(duration);
|
||||
|
||||
if (personalSpawn && summoner)
|
||||
summon->SetPrivateObjectOwner(summoner->IsPrivateObject() ? summoner->GetPrivateObjectOwner() : summoner->GetGUID());
|
||||
summon->SetPrivateObjectOwner(privateObjectOwner);
|
||||
|
||||
AddToMap(summon->ToCreature());
|
||||
summon->InitSummon();
|
||||
@@ -1839,11 +1838,11 @@ Scenario* WorldObject::GetScenario() const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
TempSummon* WorldObject::SummonCreature(uint32 entry, Position const& pos, TempSummonType despawnType /*= TEMPSUMMON_MANUAL_DESPAWN*/, uint32 despawnTime /*= 0*/, uint32 vehId /*= 0*/, bool personalSpawn /* = false */)
|
||||
TempSummon* WorldObject::SummonCreature(uint32 entry, Position const& pos, TempSummonType despawnType /*= TEMPSUMMON_MANUAL_DESPAWN*/, uint32 despawnTime /*= 0*/, uint32 vehId /*= 0*/, ObjectGuid privateObjectOwner /* = ObjectGuid::Empty */)
|
||||
{
|
||||
if (Map* map = FindMap())
|
||||
{
|
||||
if (TempSummon* summon = map->SummonCreature(entry, pos, nullptr, despawnTime, ToUnit(), 0, vehId, personalSpawn))
|
||||
if (TempSummon* summon = map->SummonCreature(entry, pos, nullptr, despawnTime, ToUnit(), 0, vehId, privateObjectOwner))
|
||||
{
|
||||
summon->SetTempSummonType(despawnType);
|
||||
return summon;
|
||||
@@ -1853,13 +1852,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*/, uint32 despawnTime /*= 0*/, bool personalSpawn /* = false */)
|
||||
TempSummon* WorldObject::SummonCreature(uint32 id, float x, float y, float z, float o /*= 0*/, TempSummonType despawnType /*= TEMPSUMMON_MANUAL_DESPAWN*/, uint32 despawnTime /*= 0*/, ObjectGuid privateObjectOwner /* = ObjectGuid::Empty */)
|
||||
{
|
||||
if (!x && !y && !z)
|
||||
GetClosePoint(x, y, z, GetCombatReach());
|
||||
if (!o)
|
||||
o = GetOrientation();
|
||||
return SummonCreature(id, { x,y,z,o }, despawnType, despawnTime, 0, personalSpawn);
|
||||
return SummonCreature(id, { x,y,z,o }, despawnType, despawnTime, 0, privateObjectOwner);
|
||||
}
|
||||
|
||||
GameObject* WorldObject::SummonGameObject(uint32 entry, Position const& pos, QuaternionData const& rot, uint32 respawnTime)
|
||||
|
||||
@@ -518,9 +518,9 @@ class TC_GAME_API WorldObject : public Object, public WorldLocation
|
||||
|
||||
Scenario* GetScenario() const;
|
||||
|
||||
TempSummon* SummonCreature(uint32 entry, Position const& pos, TempSummonType despawnType = TEMPSUMMON_MANUAL_DESPAWN, uint32 despawnTime = 0, uint32 vehId = 0, bool personalSpawn = false);
|
||||
TempSummon* SummonCreature(uint32 entry, Position const& pos, TempSummonType despawnType, Milliseconds const& despawnTime, uint32 vehId = 0, bool personalSpawn = false) { return SummonCreature(entry, pos, despawnType, uint32(despawnTime.count()), vehId, personalSpawn); }
|
||||
TempSummon* SummonCreature(uint32 entry, float x, float y, float z, float o = 0, TempSummonType despawnType = TEMPSUMMON_MANUAL_DESPAWN, uint32 despawnTime = 0, bool personalSpawn = false);
|
||||
TempSummon* SummonCreature(uint32 entry, Position const& pos, TempSummonType despawnType = TEMPSUMMON_MANUAL_DESPAWN, uint32 despawnTime = 0, uint32 vehId = 0, ObjectGuid privateObjectOwner = ObjectGuid::Empty);
|
||||
TempSummon* SummonCreature(uint32 entry, Position const& pos, TempSummonType despawnType, Milliseconds const& despawnTime, uint32 vehId = 0, ObjectGuid privateObjectOwner = ObjectGuid::Empty) { return SummonCreature(entry, pos, despawnType, uint32(despawnTime.count()), vehId, privateObjectOwner); }
|
||||
TempSummon* SummonCreature(uint32 entry, float x, float y, float z, float o = 0, TempSummonType despawnType = TEMPSUMMON_MANUAL_DESPAWN, uint32 despawnTime = 0, ObjectGuid privateObjectOwner = ObjectGuid::Empty);
|
||||
GameObject* SummonGameObject(uint32 entry, Position const& pos, QuaternionData const& rot, uint32 respawnTime /* s */);
|
||||
GameObject* SummonGameObject(uint32 entry, float x, float y, float z, float ang, QuaternionData const& rot, uint32 respawnTime /* s */);
|
||||
Creature* SummonTrigger(float x, float y, float z, float ang, uint32 dur, CreatureAI* (*GetAI)(Creature*) = nullptr);
|
||||
|
||||
@@ -512,7 +512,7 @@ class TC_GAME_API Map : public GridRefManager<NGridType>
|
||||
|
||||
void UpdateIteratorBack(Player* player);
|
||||
|
||||
TempSummon* SummonCreature(uint32 entry, Position const& pos, SummonPropertiesEntry const* properties = nullptr, uint32 duration = 0, Unit* summoner = nullptr, uint32 spellId = 0, uint32 vehId = 0, bool personalSpawn = false);
|
||||
TempSummon* 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);
|
||||
void SummonCreatureGroup(uint8 group, std::list<TempSummon*>* list = nullptr);
|
||||
AreaTrigger* GetAreaTrigger(ObjectGuid const& guid);
|
||||
Conversation* GetConversation(ObjectGuid const& guid);
|
||||
|
||||
@@ -1892,7 +1892,9 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
|
||||
if (!m_originalCaster)
|
||||
return;
|
||||
|
||||
bool personalSpawn = (properties->Flags & SUMMON_PROP_FLAG_PERSONAL_SPAWN) != 0;
|
||||
ObjectGuid privateObjectOwner;
|
||||
if (properties->Flags & SUMMON_PROP_FLAG_PERSONAL_SPAWN)
|
||||
privateObjectOwner = m_originalCaster->IsPrivateObject() ? m_originalCaster->GetPrivateObjectOwner() : m_originalCaster->GetGUID();
|
||||
|
||||
int32 duration = m_spellInfo->CalcDuration(m_originalCaster);
|
||||
|
||||
@@ -1955,7 +1957,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
|
||||
case SummonTitle::Lightwell:
|
||||
case SummonTitle::Totem:
|
||||
{
|
||||
summon = m_caster->GetMap()->SummonCreature(entry, *destTarget, properties, duration, m_originalCaster, m_spellInfo->Id, 0, personalSpawn);
|
||||
summon = m_caster->GetMap()->SummonCreature(entry, *destTarget, properties, duration, m_originalCaster, m_spellInfo->Id, 0, privateObjectOwner);
|
||||
if (!summon || !summon->IsTotem())
|
||||
return;
|
||||
|
||||
@@ -1968,7 +1970,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
|
||||
}
|
||||
case SummonTitle::Companion:
|
||||
{
|
||||
summon = m_caster->GetMap()->SummonCreature(entry, *destTarget, properties, duration, m_originalCaster, m_spellInfo->Id, 0, personalSpawn);
|
||||
summon = m_caster->GetMap()->SummonCreature(entry, *destTarget, properties, duration, m_originalCaster, m_spellInfo->Id, 0, privateObjectOwner);
|
||||
if (!summon || !summon->HasUnitTypeMask(UNIT_MASK_MINION))
|
||||
return;
|
||||
|
||||
@@ -1995,7 +1997,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
|
||||
// randomize position for multiple summons
|
||||
pos = m_caster->GetRandomPoint(*destTarget, radius);
|
||||
|
||||
summon = m_originalCaster->SummonCreature(entry, pos, summonType, duration, 0, personalSpawn);
|
||||
summon = m_originalCaster->SummonCreature(entry, pos, summonType, duration, 0, privateObjectOwner);
|
||||
if (!summon)
|
||||
continue;
|
||||
|
||||
@@ -2016,7 +2018,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
|
||||
SummonGuardian(effIndex, entry, properties, numSummons);
|
||||
break;
|
||||
case SUMMON_CATEGORY_PUPPET:
|
||||
summon = m_caster->GetMap()->SummonCreature(entry, *destTarget, properties, duration, m_originalCaster, m_spellInfo->Id, 0, personalSpawn);
|
||||
summon = m_caster->GetMap()->SummonCreature(entry, *destTarget, properties, duration, m_originalCaster, m_spellInfo->Id, 0, privateObjectOwner);
|
||||
break;
|
||||
case SUMMON_CATEGORY_VEHICLE:
|
||||
// Summoning spells (usually triggered by npc_spellclick) that spawn a vehicle and that cause the clicker
|
||||
|
||||
@@ -166,7 +166,7 @@ struct npc_danica_the_reclaimer : public ScriptedAI
|
||||
// Should be some other way to do this...
|
||||
void QuestAccept(Player* player, Quest const* /*quest*/) override
|
||||
{
|
||||
TempSummon* summon = player->SummonCreature(NPC_DANICA_THE_RECLAIMER, 1059.613f, 7224.605f, 100.4608f, 0.03462749f, TEMPSUMMON_MANUAL_DESPAWN, 0, true);
|
||||
TempSummon* summon = player->SummonCreature(NPC_DANICA_THE_RECLAIMER, 1059.613f, 7224.605f, 100.4608f, 0.03462749f, TEMPSUMMON_MANUAL_DESPAWN, 0, player->GetGUID());
|
||||
if (!summon)
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user