mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-21 20:56:23 +00:00
fix(Core/Chat): Prevent Horde / Alliance chat via custom emotes (#2292)
* add new worldserver parameter "AllowTwoSide.Interaction.Emote" * use new broadcast text ID 91243 for strange gestures
This commit is contained in:
@@ -20948,9 +20948,30 @@ void Player::TextEmote(const std::string& text)
|
||||
if (!sEluna->OnChat(this, CHAT_MSG_EMOTE, LANG_UNIVERSAL, _text))
|
||||
return;
|
||||
#endif
|
||||
|
||||
WorldPacket data;
|
||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_EMOTE, LANG_UNIVERSAL, this, this, _text);
|
||||
SendMessageToSetInRange(&data, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), true, !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT));
|
||||
std::list<Player*> players;
|
||||
Trinity::AnyPlayerInObjectRangeCheck checker(this, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE));
|
||||
Trinity::PlayerListSearcher<Trinity::AnyPlayerInObjectRangeCheck> searcher(this, players, checker);
|
||||
this->VisitNearbyWorldObject(sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), searcher);
|
||||
|
||||
for (auto const& itr : players)
|
||||
{
|
||||
if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_EMOTE) && this->GetTeamId() != itr->GetTeamId())
|
||||
{
|
||||
LocaleConstant loc_idx = itr->GetSession()->GetSessionDbLocaleIndex();
|
||||
if (BroadcastText const* bct = sObjectMgr->GetBroadcastText(EMOTE_BROADCAST_TEXT_ID_STRANGE_GESTURES))
|
||||
{
|
||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_EMOTE, LANG_UNIVERSAL, this, this, bct->GetText(loc_idx, this->getGender()));
|
||||
itr->SendDirectMessage(&data);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_EMOTE, LANG_UNIVERSAL, this, this, _text);
|
||||
itr->SendDirectMessage(&data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Player::Whisper(const std::string& text, uint32 language, uint64 receiver)
|
||||
|
||||
@@ -914,6 +914,11 @@ enum InstantFlightGossipAction
|
||||
GOSSIP_ACTION_TOGGLE_INSTANT_FLIGHT = 500
|
||||
};
|
||||
|
||||
enum EmoteBroadcastTextID
|
||||
{
|
||||
EMOTE_BROADCAST_TEXT_ID_STRANGE_GESTURES = 91243
|
||||
};
|
||||
|
||||
class PlayerTaxi
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -736,6 +736,7 @@ void World::LoadConfigSettings(bool reload)
|
||||
m_bool_configs[CONFIG_ALLOW_TWO_SIDE_WHO_LIST] = sConfigMgr->GetBoolDefault("AllowTwoSide.WhoList", false);
|
||||
m_bool_configs[CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND] = sConfigMgr->GetBoolDefault("AllowTwoSide.AddFriend", false);
|
||||
m_bool_configs[CONFIG_ALLOW_TWO_SIDE_TRADE] = sConfigMgr->GetBoolDefault("AllowTwoSide.trade", false);
|
||||
m_bool_configs[CONFIG_ALLOW_TWO_SIDE_INTERACTION_EMOTE] = sConfigMgr->GetBoolDefault("AllowTwoSide.Interaction.Emote", false);
|
||||
|
||||
m_int_configs[CONFIG_MIN_PLAYER_NAME] = sConfigMgr->GetIntDefault ("MinPlayerName", 2);
|
||||
if (m_int_configs[CONFIG_MIN_PLAYER_NAME] < 1 || m_int_configs[CONFIG_MIN_PLAYER_NAME] > MAX_PLAYER_NAME)
|
||||
|
||||
@@ -170,6 +170,7 @@ enum WorldBoolConfigs
|
||||
CONFIG_CLOSE_IDLE_CONNECTIONS,
|
||||
CONFIG_LFG_LOCATION_ALL, // Player can join LFG anywhere
|
||||
CONFIG_PRELOAD_ALL_NON_INSTANCED_MAP_GRIDS,
|
||||
CONFIG_ALLOW_TWO_SIDE_INTERACTION_EMOTE,
|
||||
BOOL_CONFIG_VALUE_COUNT
|
||||
};
|
||||
|
||||
|
||||
@@ -1639,6 +1639,14 @@ AllowTwoSide.Interaction.Calendar = 0
|
||||
|
||||
AllowTwoSide.Interaction.Chat = 0
|
||||
|
||||
#
|
||||
# AllowTwoSide.Interaction.Emote
|
||||
# Description: Allow emote messages between factions (e.g. "/e looks into the sky")
|
||||
# Default: 0 - (Disabled)
|
||||
# 1 - (Enabled)
|
||||
|
||||
AllowTwoSide.Interaction.Emote = 0
|
||||
|
||||
#
|
||||
# AllowTwoSide.Interaction.Channel
|
||||
# Description: Allow channel chat between factions.
|
||||
|
||||
Reference in New Issue
Block a user