[10298] Clear tavern rest when leaving building and prevent forced unmount when in GM mode.

This commit is contained in:
Lynx3d 2010-07-30 12:32:23 +02:00
parent af50d03f16
commit 28d1ac66c3
3 changed files with 19 additions and 17 deletions

View file

@ -6127,7 +6127,19 @@ void Player::CheckAreaExploreAndOutdoor()
bool isOutdoor; bool isOutdoor;
uint16 areaFlag = GetBaseMap()->GetAreaFlag(GetPositionX(),GetPositionY(),GetPositionZ(), &isOutdoor); uint16 areaFlag = GetBaseMap()->GetAreaFlag(GetPositionX(),GetPositionY(),GetPositionZ(), &isOutdoor);
if (sWorld.getConfig(CONFIG_BOOL_VMAP_INDOOR_CHECK) && !isOutdoor) if (isOutdoor)
{
if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) && GetRestType() == REST_TYPE_IN_TAVERN)
{
AreaTriggerEntry const* at = sAreaTriggerStore.LookupEntry(inn_trigger_id);
if (!at || !IsPointInAreaTriggerZone(at, GetMapId(), GetPositionX(), GetPositionY(), GetPositionZ()))
{
// Player left inn (REST_TYPE_IN_CITY overrides REST_TYPE_IN_TAVERN, so just clear rest)
SetRestType(REST_TYPE_NO);
}
}
}
else if (sWorld.getConfig(CONFIG_BOOL_VMAP_INDOOR_CHECK) && !isGameMaster())
RemoveAurasWithAttribute(SPELL_ATTR_OUTDOORS_ONLY); RemoveAurasWithAttribute(SPELL_ATTR_OUTDOORS_ONLY);
if (areaFlag==0xffff) if (areaFlag==0xffff)
@ -6738,20 +6750,9 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea)
if(zone->flags & AREA_FLAG_CAPITAL) // in capital city if(zone->flags & AREA_FLAG_CAPITAL) // in capital city
SetRestType(REST_TYPE_IN_CITY); SetRestType(REST_TYPE_IN_CITY);
else // anywhere else else if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) && GetRestType() != REST_TYPE_IN_TAVERN)
{ // resting and not in tavern (leave city then); tavern leave handled in CheckAreaExploreAndOutdoor
if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING)) // but resting (walk from city or maybe in tavern or leave tavern recently) SetRestType(REST_TYPE_NO);
{
if (GetRestType()==REST_TYPE_IN_TAVERN) // has been in tavern. Is still in?
{
AreaTriggerEntry const* at = sAreaTriggerStore.LookupEntry(inn_trigger_id);
if (!at || !IsPointInAreaTriggerZone(at, GetMapId(), GetPositionX(), GetPositionY(), GetPositionY()))
SetRestType(REST_TYPE_NO);
}
else // not in tavern (leave city then)
SetRestType(REST_TYPE_NO);
}
}
// remove items with area/map limitations (delete only for alive player to allow back in ghost mode) // remove items with area/map limitations (delete only for alive player to allow back in ghost mode)
// if player resurrected at teleport this will be applied in resurrect code // if player resurrected at teleport this will be applied in resurrect code

View file

@ -4212,7 +4212,8 @@ SpellCastResult Spell::CheckCast(bool strict)
if(bg->GetStatus() == STATUS_WAIT_LEAVE) if(bg->GetStatus() == STATUS_WAIT_LEAVE)
return SPELL_FAILED_DONT_REPORT; return SPELL_FAILED_DONT_REPORT;
if(m_caster->GetTypeId() == TYPEID_PLAYER && VMAP::VMapFactory::createOrGetVMapManager()->isLineOfSightCalcEnabled()) if(m_caster->GetTypeId() == TYPEID_PLAYER && !((Player*)m_caster)->isGameMaster() &&
VMAP::VMapFactory::createOrGetVMapManager()->isLineOfSightCalcEnabled())
{ {
if(m_spellInfo->Attributes & SPELL_ATTR_OUTDOORS_ONLY && if(m_spellInfo->Attributes & SPELL_ATTR_OUTDOORS_ONLY &&
!m_caster->GetMap()->IsOutdoors(m_caster->GetPositionX(), m_caster->GetPositionY(), m_caster->GetPositionZ())) !m_caster->GetMap()->IsOutdoors(m_caster->GetPositionX(), m_caster->GetPositionY(), m_caster->GetPositionZ()))

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "10297" #define REVISION_NR "10298"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__