Core/Spells: Attempts at summoning player to an instance will result in fail if the targeted player is saved to another instance instead of summoning him at summoner's position in a different instance

This commit is contained in:
Shauren
2011-03-09 23:07:50 +01:00
parent aaf377d983
commit 3ba47e529b
+11 -4
View File
@@ -5331,13 +5331,20 @@ SpellCastResult Spell::CheckCast(bool strict)
return SPELL_FAILED_BAD_TARGETS; return SPELL_FAILED_BAD_TARGETS;
// check if our map is dungeon // check if our map is dungeon
if (sMapStore.LookupEntry(m_caster->GetMapId())->IsDungeon()) MapEntry const* map = sMapStore.LookupEntry(m_caster->GetMapId());
if (map->IsDungeon())
{ {
Map const* pMap = m_caster->GetMap(); uint32 mapId = m_caster->GetMap()->GetId();
InstanceTemplate const* instance = ObjectMgr::GetInstanceTemplate(pMap->GetId()); Difficulty difficulty = m_caster->GetMap()->GetDifficulty();
if (map->IsRaid())
if (InstancePlayerBind* targetBind = target->GetBoundInstance(mapId, difficulty))
if (targetBind->perm && targetBind != m_caster->ToPlayer()->GetBoundInstance(mapId, difficulty))
return SPELL_FAILED_TARGET_LOCKED_TO_RAID_INSTANCE;
InstanceTemplate const* instance = ObjectMgr::GetInstanceTemplate(mapId);
if (!instance) if (!instance)
return SPELL_FAILED_TARGET_NOT_IN_INSTANCE; return SPELL_FAILED_TARGET_NOT_IN_INSTANCE;
if (!target->Satisfy(sObjectMgr->GetAccessRequirement(pMap->GetId(), pMap->GetDifficulty()), pMap->GetId())) if (!target->Satisfy(sObjectMgr->GetAccessRequirement(mapId, difficulty), mapId))
return SPELL_FAILED_BAD_TARGETS; return SPELL_FAILED_BAD_TARGETS;
} }
break; break;