Skip to content

Instantly share code, notes, and snippets.

@irancore
Created September 7, 2013 19:47
Show Gist options
  • Save irancore/6478651 to your computer and use it in GitHub Desktop.
Save irancore/6478651 to your computer and use it in GitHub Desktop.
Debug Chat Minlevel For OregonCore
diff --git a/src/game/ChatHandler.cpp b/src/game/ChatHandler.cpp
index b0ce099..769f452 100644
--- a/src/game/ChatHandler.cpp
+++ b/src/game/ChatHandler.cpp
@@ -186,7 +186,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
return;
-
+
if (msg.empty())
break;
@@ -206,7 +206,11 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
return;
-
+ if (_player->getLevel() < sWorld.getConfig(CONFIG_CHAT_MINLEVEL)) //Chat minlevel
+ {
+ SendNotification("You must be at least level %d",sWorld.getConfig(CONFIG_CHAT_MINLEVEL));
+ return;
+ }
if (msg.empty())
break;
@@ -258,7 +262,11 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
return;
-
+ if (_player->getLevel() < sWorld.getConfig(CONFIG_CHAT_MINLEVEL)) //Chat minlevel
+ {
+ SendNotification("You must be at least level %d",sWorld.getConfig(CONFIG_CHAT_MINLEVEL));
+ return;
+ }
if (msg.empty())
break;
@@ -296,7 +304,11 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
return;
-
+ if (_player->getLevel() < sWorld.getConfig(CONFIG_CHAT_MINLEVEL)) //Chat minlevel
+ {
+ SendNotification("You must be at least level %d",sWorld.getConfig(CONFIG_CHAT_MINLEVEL));
+ return;
+ }
if (msg.empty())
break;
@@ -336,7 +348,11 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
return;
-
+ if (_player->getLevel() < sWorld.getConfig(CONFIG_CHAT_MINLEVEL)) //Chat minlevel
+ {
+ SendNotification("You must be at least level %d",sWorld.getConfig(CONFIG_CHAT_MINLEVEL));
+ return;
+ }
if (msg.empty())
break;
@@ -368,7 +384,11 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
return;
-
+ if (_player->getLevel() < sWorld.getConfig(CONFIG_CHAT_MINLEVEL)) //Chat minlevel
+ {
+ SendNotification("You must be at least level %d",sWorld.getConfig(CONFIG_CHAT_MINLEVEL));
+ return;
+ }
if (msg.empty())
break;
@@ -405,7 +425,11 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recv_data)
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
return;
-
+ if (_player->getLevel() < sWorld.getConfig(CONFIG_CHAT_MINLEVEL)) //Chat minlevel
+ {
+ SendNotification("You must be at least level %d",sWorld.getConfig(CONFIG_CHAT_MINLEVEL));
+ return;
+ }
if (msg.empty())
break;
diff --git a/src/game/World.cpp b/src/game/World.cpp
index 15dd86e..4b5105f 100644
--- a/src/game/World.cpp
+++ b/src/game/World.cpp
@@ -1068,6 +1068,7 @@ void World::LoadConfigSettings(bool reload)
m_configs[CONFIG_NUMTHREADS] = sConfig.GetIntDefault("MapUpdate.Threads",1);
m_configs[CONFIG_DUEL_MOD] = sConfig.GetBoolDefault("DuelMod.Enable", false);
m_configs[CONFIG_DUEL_CD_RESET] = sConfig.GetBoolDefault("DuelMod.Cooldowns", false);
+ m_configs[CONFIG_CHAT_MINLEVEL] = sConfig.GetIntDefault("Chat.Minlevel", 0);
m_configs[CONFIG_AUTOBROADCAST_TIMER] = sConfig.GetIntDefault("AutoBroadcast.Timer", 60000);
m_configs[CONFIG_AUTOBROADCAST_ENABLED] = sConfig.GetIntDefault("AutoBroadcast.On", 0);
m_configs[CONFIG_AUTOBROADCAST_CENTER] = sConfig.GetIntDefault("AutoBroadcast.Center", 0);
diff --git a/src/game/World.h b/src/game/World.h
index 39ecd07..e53bd73 100644
--- a/src/game/World.h
+++ b/src/game/World.h
@@ -234,6 +234,7 @@ enum WorldConfigs
CONFIG_VMAP_INDOOR_CHECK,
CONFIG_DUEL_MOD,
CONFIG_DUEL_CD_RESET,
+ CONFIG_CHAT_MINLEVEL,
CONFIG_CHARDELETE_KEEP_DAYS,
CONFIG_CHARDELETE_METHOD,
CONFIG_CHARDELETE_MIN_LEVEL,
diff --git a/src/worldserver/worldserver.conf.dist b/src/worldserver/worldserver.conf.dist
index 0b50566..f9b2ded 100644
--- a/src/worldserver/worldserver.conf.dist
+++ b/src/worldserver/worldserver.conf.dist
@@ -2008,6 +2008,16 @@ CharDelete.KeepDays = 30
# Default: 0 - (Disabled)
# 1 - (Enabled)
#
+#New Configs
+#
+# Chat.Minlevel
+# Set player level to speak in Channel Say Guild Raid or other Chat Channels
+# Default: 0 (Disabled)
+# +1 (Enabeled
+#
+# Chat.Minlevel= 0
+#
+#
# Die.Command.Mode
# Do not trigger things like loot from .die command.
# Default: 1 - (Enabled)
@@ -2038,6 +2048,7 @@ MinRecordUpdateTimeDiff = 100
PlayerStart.String = ""
DuelMod.Enable = 0
DuelMod.Cooldowns = 0
+Chat.Minlevel= 40
Die.Command.Mode = 1
Pet.React.Aggressive = 1
@Imorate
Copy link

Imorate commented Nov 13, 2013

ty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment