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:
@@ -0,0 +1,12 @@
|
|||||||
|
INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1568889498159574820');
|
||||||
|
|
||||||
|
-- take over the translated texts from 16259, strip the "%s" at the beginning and create a new broadcast text ID 91243
|
||||||
|
DELETE FROM `broadcast_text_locale` WHERE `ID` = 91243;
|
||||||
|
INSERT INTO `broadcast_text_locale` (`ID`, `locale`, `MaleText`, `FemaleText`, `VerifiedBuild`)
|
||||||
|
SELECT 91243 AS `ID`, `locale`, TRIM(TRIM('%s' FROM `FemaleText`)) AS `MaleText`, TRIM(TRIM('%s' FROM `FemaleText`)) AS `FemaleText`, 0
|
||||||
|
FROM `broadcast_text_locale` WHERE `ID` = 16259;
|
||||||
|
|
||||||
|
DELETE FROM `broadcast_text` WHERE `ID` = 91243;
|
||||||
|
INSERT INTO `broadcast_text` (`ID`, `Language`, `MaleText`, `FemaleText`, `EmoteID0`, `EmoteID1`, `EmoteID2`, `EmoteDelay0`, `EmoteDelay1`, `EmoteDelay2`, `SoundId`, `Unk1`, `Unk2`, `VerifiedBuild`)
|
||||||
|
VALUES
|
||||||
|
(91243,0,'makes some strange gestures.','makes some strange gestures.',0,0,0,0,0,0,0,0,0,0);
|
||||||
@@ -20948,9 +20948,30 @@ void Player::TextEmote(const std::string& text)
|
|||||||
if (!sEluna->OnChat(this, CHAT_MSG_EMOTE, LANG_UNIVERSAL, _text))
|
if (!sEluna->OnChat(this, CHAT_MSG_EMOTE, LANG_UNIVERSAL, _text))
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_EMOTE, LANG_UNIVERSAL, this, this, _text);
|
std::list<Player*> players;
|
||||||
SendMessageToSetInRange(&data, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), true, !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT));
|
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)
|
void Player::Whisper(const std::string& text, uint32 language, uint64 receiver)
|
||||||
|
|||||||
@@ -914,6 +914,11 @@ enum InstantFlightGossipAction
|
|||||||
GOSSIP_ACTION_TOGGLE_INSTANT_FLIGHT = 500
|
GOSSIP_ACTION_TOGGLE_INSTANT_FLIGHT = 500
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum EmoteBroadcastTextID
|
||||||
|
{
|
||||||
|
EMOTE_BROADCAST_TEXT_ID_STRANGE_GESTURES = 91243
|
||||||
|
};
|
||||||
|
|
||||||
class PlayerTaxi
|
class PlayerTaxi
|
||||||
{
|
{
|
||||||
public:
|
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_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_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_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);
|
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)
|
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_CLOSE_IDLE_CONNECTIONS,
|
||||||
CONFIG_LFG_LOCATION_ALL, // Player can join LFG anywhere
|
CONFIG_LFG_LOCATION_ALL, // Player can join LFG anywhere
|
||||||
CONFIG_PRELOAD_ALL_NON_INSTANCED_MAP_GRIDS,
|
CONFIG_PRELOAD_ALL_NON_INSTANCED_MAP_GRIDS,
|
||||||
|
CONFIG_ALLOW_TWO_SIDE_INTERACTION_EMOTE,
|
||||||
BOOL_CONFIG_VALUE_COUNT
|
BOOL_CONFIG_VALUE_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1639,6 +1639,14 @@ AllowTwoSide.Interaction.Calendar = 0
|
|||||||
|
|
||||||
AllowTwoSide.Interaction.Chat = 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
|
# AllowTwoSide.Interaction.Channel
|
||||||
# Description: Allow channel chat between factions.
|
# Description: Allow channel chat between factions.
|
||||||
|
|||||||
Reference in New Issue
Block a user