Skip to content

Commit

Permalink
Fixes some visibility issues, with rogue stealth, for example.. Fix #343
Browse files Browse the repository at this point in the history
  • Loading branch information
dfighter1985 committed Jan 30, 2013
1 parent 33b532b commit 91400ee
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions src/arcemu-world/Player.cpp
Expand Up @@ -12385,19 +12385,22 @@ void Player::SendMessageToSet(WorldPacket* data, bool bToSelf, bool myteam_only)
gminvis = m_isGmInvisible;
uint32 myphase = GetPhase();

//Zehamster: Splitting into if/else allows us to avoid testing "gminvis==true" at each loop...
// saving cpu cycles. Chat messages will be sent to everybody even if player is invisible.
if(myteam_only)
{
uint32 myteam = GetTeam();

if(gminvis && data->GetOpcode() != SMSG_MESSAGECHAT)
if( data->GetOpcode() != SMSG_MESSAGECHAT)
{
for(std::set< Object* >::iterator itr = m_inRangePlayers.begin(); itr != m_inRangePlayers.end(); ++itr)
{
Player* p = TO< Player* >(*itr);

if(p->GetSession() && p->GetSession()->GetPermissionCount() > 0 && p->GetTeam() == myteam && (p->GetPhase() & myphase) != 0)
if( gminvis && ( ( p->GetSession() == NULL ) || ( p->GetSession()->GetPermissionCount() <= 0 ) ) )
continue;

if( p->GetTeam() == myteam
&& (p->GetPhase() & myphase) != 0
&& p->IsVisible( GetGUID() ) )
p->SendPacket(data);
}
}
Expand All @@ -12410,21 +12413,24 @@ void Player::SendMessageToSet(WorldPacket* data, bool bToSelf, bool myteam_only)
if(p->GetSession()
&& p->GetTeam() == myteam
&& !p->Social_IsIgnoring(GetLowGUID())
&& (p->GetPhase() & myphase) != 0
&& p->m_invisible == (m_invisible || p->m_isGmInvisible))
&& (p->GetPhase() & myphase) != 0 )
p->SendPacket(data);
}
}
}
else
{
if(gminvis && data->GetOpcode() != SMSG_MESSAGECHAT)
if( data->GetOpcode() != SMSG_MESSAGECHAT)
{
for(std::set< Object* >::iterator itr = m_inRangePlayers.begin(); itr != m_inRangePlayers.end(); ++itr)
{
Player* p = TO< Player* >(*itr);

if(p->GetSession() && p->GetSession()->GetPermissionCount() > 0 && (p->GetPhase() & myphase) != 0)
if( gminvis && ( ( p->GetSession() == NULL ) || ( p->GetSession()->GetPermissionCount() <= 0 ) ) )
continue;

if( (p->GetPhase() & myphase) != 0
&& p->IsVisible( GetGUID() ) )
p->SendPacket(data);
}
}
Expand All @@ -12436,10 +12442,7 @@ void Player::SendMessageToSet(WorldPacket* data, bool bToSelf, bool myteam_only)

if(p->GetSession()
&& !p->Social_IsIgnoring(GetLowGUID())
&& (p->GetPhase() & myphase) != 0
//Not sure why are we checking p->m_invisible against m_invisible.
//If someone can clarify it, would be nice, for now let it be.
&& p->m_invisible == (m_invisible || p->m_isGmInvisible))
&& (p->GetPhase() & myphase) != 0 )
p->SendPacket(data);
}
}
Expand Down

0 comments on commit 91400ee

Please sign in to comment.