*Prevent entering in instances if zone in combat - by Iskander
--HG-- branch : trunk
This commit is contained in:
+3
-1
@@ -1389,7 +1389,9 @@ bool Group::InCombatToInstance(uint32 instanceId)
|
|||||||
for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
|
for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
|
||||||
{
|
{
|
||||||
Player *pPlayer = itr->getSource();
|
Player *pPlayer = itr->getSource();
|
||||||
if(pPlayer->getAttackers().size() && pPlayer->GetInstanceId() == instanceId)
|
if(pPlayer && pPlayer->getAttackers().size() && pPlayer->GetInstanceId() == instanceId && (pPlayer->GetMap()->IsRaid() || pPlayer->GetMap()->IsHeroic()))
|
||||||
|
for(std::set<Unit*>::const_iterator i = pPlayer->getAttackers().begin(); i!=pPlayer->getAttackers().end(); ++i)
|
||||||
|
if((*i) && (*i)->GetTypeId() == TYPEID_UNIT && ((Creature*)(*i))->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
+1
-1
@@ -1762,7 +1762,7 @@ bool InstanceMap::CanEnter(Player *player)
|
|||||||
|
|
||||||
// cannot enter while players in the instance are in combat
|
// cannot enter while players in the instance are in combat
|
||||||
Group *pGroup = player->GetGroup();
|
Group *pGroup = player->GetGroup();
|
||||||
if(!player->isGameMaster() && pGroup && pGroup->InCombatToInstance(GetInstanceId()) && player->isAlive() && player->GetMapId() != GetId())
|
if(!player->isGameMaster() && pGroup && pGroup->InCombatToInstance(GetInstanceId()) && player->GetMapId() != GetId())
|
||||||
{
|
{
|
||||||
player->SendTransferAborted(GetId(), TRANSFER_ABORT_ZONE_IN_COMBAT);
|
player->SendTransferAborted(GetId(), TRANSFER_ABORT_ZONE_IN_COMBAT);
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -266,3 +266,11 @@ void MapInstanced::DestroyInstance(InstancedMaps::iterator &itr)
|
|||||||
delete itr->second;
|
delete itr->second;
|
||||||
m_InstancedMaps.erase(itr++);
|
m_InstancedMaps.erase(itr++);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MapInstanced::CanEnter(Player *player)
|
||||||
|
{
|
||||||
|
if(Map* map = GetInstance(player))
|
||||||
|
return map->CanEnter(player);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ class TRINITY_DLL_DECL MapInstanced : public Map
|
|||||||
void RemoveAllObjectsInRemoveList();
|
void RemoveAllObjectsInRemoveList();
|
||||||
bool RemoveBones(uint64 guid, float x, float y);
|
bool RemoveBones(uint64 guid, float x, float y);
|
||||||
void UnloadAll(bool pForce);
|
void UnloadAll(bool pForce);
|
||||||
|
bool CanEnter(Player* player);
|
||||||
|
|
||||||
Map* GetInstance(const WorldObject* obj);
|
Map* GetInstance(const WorldObject* obj);
|
||||||
Map* FindMap(uint32 InstanceId) { return _FindMap(InstanceId); }
|
Map* FindMap(uint32 InstanceId) { return _FindMap(InstanceId); }
|
||||||
|
|||||||
Reference in New Issue
Block a user