*Do not allow two side emote.
--HG-- branch : trunk
This commit is contained in:
@@ -119,22 +119,24 @@ MessageDistDeliverer::Visit(PlayerMapType &m)
|
||||
{
|
||||
for (PlayerMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
|
||||
{
|
||||
if(!iter->getSource()->InSamePhase(i_phaseMask))
|
||||
Player *target = iter->getSource();
|
||||
if(!target->InSamePhase(i_phaseMask))
|
||||
continue;
|
||||
|
||||
if(iter->getSource()->GetDistanceSq(&i_source) > i_distSq)
|
||||
if(target->GetDistanceSq(i_source) > i_distSq)
|
||||
continue;
|
||||
|
||||
// Send packet to all who are sharing the player's vision
|
||||
if (!iter->getSource()->GetSharedVisionList().empty())
|
||||
if (!target->GetSharedVisionList().empty())
|
||||
{
|
||||
SharedVisionList::const_iterator i = iter->getSource()->GetSharedVisionList().begin();
|
||||
for ( ; i != iter->getSource()->GetSharedVisionList().end(); ++i)
|
||||
if((*i)->m_seer == iter->getSource())
|
||||
SharedVisionList::const_iterator i = target->GetSharedVisionList().begin();
|
||||
for ( ; i != target->GetSharedVisionList().end(); ++i)
|
||||
if((*i)->m_seer == target)
|
||||
SendPacket(*i);
|
||||
}
|
||||
|
||||
SendPacket(iter->getSource());
|
||||
if(target->m_seer == target)
|
||||
SendPacket(target);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,7 +148,7 @@ MessageDistDeliverer::Visit(CreatureMapType &m)
|
||||
if(!iter->getSource()->InSamePhase(i_phaseMask))
|
||||
continue;
|
||||
|
||||
if(iter->getSource()->GetDistanceSq(&i_source) > i_distSq)
|
||||
if(iter->getSource()->GetDistanceSq(i_source) > i_distSq)
|
||||
continue;
|
||||
|
||||
// Send packet to all who are sharing the creature's vision
|
||||
@@ -168,7 +170,7 @@ MessageDistDeliverer::Visit(DynamicObjectMapType &m)
|
||||
if(!iter->getSource()->InSamePhase(i_phaseMask))
|
||||
continue;
|
||||
|
||||
if(iter->getSource()->GetDistanceSq(&i_source) > i_distSq)
|
||||
if(iter->getSource()->GetDistanceSq(i_source) > i_distSq)
|
||||
continue;
|
||||
|
||||
if (IS_PLAYER_GUID(iter->getSource()->GetCasterGUID()))
|
||||
|
||||
@@ -104,16 +104,16 @@ namespace Trinity
|
||||
|
||||
struct TRINITY_DLL_DECL MessageDistDeliverer
|
||||
{
|
||||
WorldObject &i_source;
|
||||
WorldObject *i_source;
|
||||
WorldPacket *i_message;
|
||||
std::set<Player*> plr_list;
|
||||
uint32 i_phaseMask;
|
||||
float i_distSq;
|
||||
MessageDistDeliverer(WorldObject &src, WorldPacket *msg, bool to_self, float dist)
|
||||
: i_source(src), i_message(msg), i_distSq(dist * dist), i_phaseMask(src.GetPhaseMask())
|
||||
bool self;
|
||||
uint32 team;
|
||||
MessageDistDeliverer(WorldObject *src, WorldPacket *msg, float dist, bool to_self = true, bool own_team_only = false)
|
||||
: i_source(src), i_message(msg), i_distSq(dist * dist), i_phaseMask(src->GetPhaseMask())
|
||||
, self(to_self || src->GetTypeId() != TYPEID_PLAYER), team((own_team_only && src->GetTypeId() == TYPEID_PLAYER) ? ((Player*)src)->GetTeam() : 0)
|
||||
{
|
||||
if(!to_self)
|
||||
plr_list.insert((Player*)&i_source);
|
||||
}
|
||||
void Visit(PlayerMapType &m);
|
||||
void Visit(CreatureMapType &m);
|
||||
@@ -122,11 +122,18 @@ namespace Trinity
|
||||
|
||||
void SendPacket(Player* plr)
|
||||
{
|
||||
if (plr_list.find(plr) == plr_list.end())
|
||||
if(!self)
|
||||
{
|
||||
plr->GetSession()->SendPacket(i_message);
|
||||
plr_list.insert(plr);
|
||||
if(plr == i_source)
|
||||
return;
|
||||
}
|
||||
else if(team)
|
||||
{
|
||||
if(plr->GetTeam() != team)
|
||||
return;
|
||||
}
|
||||
|
||||
plr->GetSession()->SendPacket(i_message);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+4
-4
@@ -532,25 +532,25 @@ Map::Add(T *obj)
|
||||
|
||||
void Map::MessageBroadcast(Player *player, WorldPacket *msg, bool to_self)
|
||||
{
|
||||
Trinity::MessageDistDeliverer post_man(*player, msg, to_self, World::GetMaxVisibleDistance());
|
||||
Trinity::MessageDistDeliverer post_man(player, msg, World::GetMaxVisibleDistance(), to_self);
|
||||
VisitWorld(player->GetPositionX(), player->GetPositionY(), World::GetMaxVisibleDistance(), post_man);
|
||||
}
|
||||
|
||||
void Map::MessageBroadcast(WorldObject *obj, WorldPacket *msg)
|
||||
{
|
||||
Trinity::MessageDistDeliverer post_man(*obj, msg, true, World::GetMaxVisibleDistance());
|
||||
Trinity::MessageDistDeliverer post_man(obj, msg, World::GetMaxVisibleDistance());
|
||||
VisitWorld(obj->GetPositionX(), obj->GetPositionY(), World::GetMaxVisibleDistance(), post_man);
|
||||
}
|
||||
|
||||
void Map::MessageDistBroadcast(Player *player, WorldPacket *msg, float dist, bool to_self, bool own_team_only)
|
||||
{
|
||||
Trinity::MessageDistDeliverer post_man(*player, msg, to_self, dist/*, own_team_only*/);
|
||||
Trinity::MessageDistDeliverer post_man(player, msg, dist, to_self, own_team_only);
|
||||
VisitWorld(player->GetPositionX(), player->GetPositionY(), dist, post_man);
|
||||
}
|
||||
|
||||
void Map::MessageDistBroadcast(WorldObject *obj, WorldPacket *msg, float dist)
|
||||
{
|
||||
Trinity::MessageDistDeliverer post_man(*obj, msg, true, dist);
|
||||
Trinity::MessageDistDeliverer post_man(obj, msg, dist);
|
||||
VisitWorld(obj->GetPositionX(), obj->GetPositionY(), dist, post_man);
|
||||
}
|
||||
|
||||
|
||||
+2
-4
@@ -16779,10 +16779,8 @@ void Player::Yell(const std::string& text, const uint32 language)
|
||||
void Player::TextEmote(const std::string& text)
|
||||
{
|
||||
WorldPacket data(SMSG_MESSAGECHAT, 200);
|
||||
BuildPlayerChat(&data, CHAT_MSG_EMOTE, text,
|
||||
sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT) ? LANG_UNIVERSAL
|
||||
: GetTeam() == ALLIANCE ? LANG_COMMON : LANG_ORCISH);
|
||||
SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE),true);
|
||||
BuildPlayerChat(&data, CHAT_MSG_EMOTE, text, LANG_UNIVERSAL);
|
||||
SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE),true, !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT));
|
||||
|
||||
if(sWorld.getConfig(CONFIG_CHATLOG_PUBLIC))
|
||||
sLog.outChat("[TEXTEMOTE] Player %s emotes: %s",
|
||||
|
||||
Reference in New Issue
Block a user