From fdfd3856adca9efb561d29c0c5ce3b3248fa8416 Mon Sep 17 00:00:00 2001 From: HeartWell Date: Sun, 20 Nov 2016 18:02:12 +0300 Subject: [PATCH] Core/Chat: Add config to mute player first login. (#234) --- .../rev_1478948588825091300.sql | 6 ++++++ src/game/Handlers/ChatHandler.cpp | 17 ++++++++++------- src/game/Miscellaneous/Language.h | 2 ++ src/game/World/World.cpp | 2 ++ src/game/World/World.h | 2 ++ src/worldserver/worldserver.conf.dist | 15 +++++++++++++++ 6 files changed, 37 insertions(+), 7 deletions(-) create mode 100644 data/sql/updates/pending_db_world/rev_1478948588825091300.sql diff --git a/data/sql/updates/pending_db_world/rev_1478948588825091300.sql b/data/sql/updates/pending_db_world/rev_1478948588825091300.sql new file mode 100644 index 000000000..3adccb555 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1478948588825091300.sql @@ -0,0 +1,6 @@ +INSERT INTO version_db_world(`sql_rev`) VALUES ('1478948588825091300'); + +-- Mute for player +DELETE FROM trinity_string WHERE entry = 30000; +INSERT INTO trinity_string(`entry`,`content_default`,`content_loc6`,`content_loc7`,`content_loc8`) VALUES +(30000, 'Speaking is allowed after playing for at least %d. You may use party and guild chat.','Podrás hablar cuando hayas jugado durante al menos %d. Puedes usar el chat de grupo y de hermandad.','Podrás hablar cuando hayas jugado durante al menos %d. Puedes usar el chat de grupo y de hermandad','Вы сможете говорить после %d проведенных минут в игре, но можете использовать чат гильдии и группы.'); diff --git a/src/game/Handlers/ChatHandler.cpp b/src/game/Handlers/ChatHandler.cpp index a9d8ea015..f2d1213d3 100644 --- a/src/game/Handlers/ChatHandler.cpp +++ b/src/game/Handlers/ChatHandler.cpp @@ -66,14 +66,17 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recvData) case CHAT_MSG_PARTY_LEADER: break; default: - /*[AC] we should enable it using a conf - if (sender->GetTotalPlayedTime() < 2*HOUR) + if (!sWorld->getBoolConfig(CONFIG_CHAT_MUTE_FIRST_LOGIN)) { - SendNotification("Speaking is allowed after playing for at least 2 hours. You may use party and guild chat."); - recvData.rfinish(); - return; - }*/ - break; + uint32 minutes = sWorld->getIntConfig(CONFIG_CHAT_TIME_MUTE_FIRST_LOGIN); + + if (sender->GetTotalPlayedTime() < minutes * MINUTE) + { + SendNotification(LANG_MUTED_PLAYER, minutes); + recvData.rfinish(); + return; + } + } } // pussywizard: diff --git a/src/game/Miscellaneous/Language.h b/src/game/Miscellaneous/Language.h index 2896ee17a..9a00adb1c 100644 --- a/src/game/Miscellaneous/Language.h +++ b/src/game/Miscellaneous/Language.h @@ -1297,5 +1297,7 @@ enum TrinityStrings LANG_INSTANCE_BIND_MISMATCH = 11014, LANG_CREATURE_NOT_AI_ENABLED = 11015, LANG_SELECT_PLAYER_OR_PET = 11016, + + LANG_MUTED_PLAYER = 30000, // Mute for player 2 hour }; #endif diff --git a/src/game/World/World.cpp b/src/game/World/World.cpp index ec6dc2151..c6eaee0ec 100644 --- a/src/game/World/World.cpp +++ b/src/game/World/World.cpp @@ -976,6 +976,8 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_CHATFLOOD_MESSAGE_COUNT] = sConfigMgr->GetIntDefault("ChatFlood.MessageCount", 10); m_int_configs[CONFIG_CHATFLOOD_MESSAGE_DELAY] = sConfigMgr->GetIntDefault("ChatFlood.MessageDelay", 1); m_int_configs[CONFIG_CHATFLOOD_MUTE_TIME] = sConfigMgr->GetIntDefault("ChatFlood.MuteTime", 10); + m_bool_configs[CONFIG_CHAT_MUTE_FIRST_LOGIN] = sConfigMgr->GetBoolDefault("Chat.MuteFirstLogin", false); + m_int_configs[CONFIG_CHAT_TIME_MUTE_FIRST_LOGIN] = sConfigMgr->GetIntDefault("Chat.MuteTimeFirstLogin", 120); m_int_configs[CONFIG_EVENT_ANNOUNCE] = sConfigMgr->GetIntDefault("Event.Announce", 0); diff --git a/src/game/World/World.h b/src/game/World/World.h index ddb2e1673..87ea63413 100644 --- a/src/game/World/World.h +++ b/src/game/World/World.h @@ -109,6 +109,7 @@ enum WorldBoolConfigs CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL, CONFIG_TALENTS_INSPECTING, CONFIG_CHAT_FAKE_MESSAGE_PREVENTING, + CONFIG_CHAT_MUTE_FIRST_LOGIN, CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP, CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE, CONFIG_DEATH_BONES_WORLD, @@ -257,6 +258,7 @@ enum WorldIntConfigs CONFIG_CHAT_CHANNEL_LEVEL_REQ, CONFIG_CHAT_WHISPER_LEVEL_REQ, CONFIG_CHAT_SAY_LEVEL_REQ, + CONFIG_CHAT_TIME_MUTE_FIRST_LOGIN, CONFIG_TRADE_LEVEL_REQ, CONFIG_TICKET_LEVEL_REQ, CONFIG_AUCTION_LEVEL_REQ, diff --git a/src/worldserver/worldserver.conf.dist b/src/worldserver/worldserver.conf.dist index 5c1d1a88b..6572a9d28 100644 --- a/src/worldserver/worldserver.conf.dist +++ b/src/worldserver/worldserver.conf.dist @@ -1859,6 +1859,21 @@ ChatFlood.MessageDelay = 1 ChatFlood.MuteTime = 10 +# +# Chat.MuteFirstLogin +# Description: Speaking is allowed after playing for Chat.MuteTimeFirstLogin minutes. You may use party and guild chat. +# Default: 0 - (Disabled) +# 1 - (Enabled) + +Chat.MuteFirstLogin = 0 + +# +# Chat.MuteTimeFirstLogin +# Description: The time after which the player will be able to speak. +# Default: 120 - (Minutes) + +Chat.MuteTimeFirstLogin = 120 + # # Channel.RestrictedLfg # Description: Restrict LookupForGroup channel to characters registered in the LFG tool.