[Patch] Interaction chat on specific area.

Hello. I created patch, which allows interact between 2 factions in chat on specific area. Area must be indicated in configuration file.


diff --git a/src/server/game/Handlers/ChatHandler.cpp b/src/server/game/Handlers/ChatHandler.cpp

index dad8a26..284db35 100755

--- a/src/server/game/Handlers/ChatHandler.cpp

+++ b/src/server/game/Handlers/ChatHandler.cpp

@@ -134,7 +134,8 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data)

	 else

	 {

		 // send in universal language if player in .gmon mode (ignore spell effects)

-	    if (sender->isGameMaster())

+	    // and allow players interact in chat on specific area

+	    if (sender->isGameMaster() || sender->GetAreaId() == sWorld->getIntConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT_AREA))

			 lang = LANG_UNIVERSAL;

		 else

		 {

diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp

index 53c71fe..f97ff93 100755

--- a/src/server/game/World/World.cpp

+++ b/src/server/game/World/World.cpp

@@ -581,6 +581,7 @@ void World::LoadConfigSettings(bool reload)

	 m_bool_configs[CONFIG_CLEAN_CHARACTER_DB] = ConfigMgr::GetBoolDefault("CleanCharacterDB", false);

	 m_int_configs[CONFIG_PERSISTENT_CHARACTER_CLEAN_FLAGS] = ConfigMgr::GetIntDefault("PersistentCharacterCleanFlags", 0);

	 m_int_configs[CONFIG_CHAT_CHANNEL_LEVEL_REQ] = ConfigMgr::GetIntDefault("ChatLevelReq.Channel", 1);

+    m_int_configs[CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT_AREA] = ConfigMgr::GetIntDefault("AllowTwoSide.Interaction.Chat.Area", -1);

	 m_int_configs[CONFIG_CHAT_WHISPER_LEVEL_REQ] = ConfigMgr::GetIntDefault("ChatLevelReq.Whisper", 1);

	 m_int_configs[CONFIG_CHAT_SAY_LEVEL_REQ] = ConfigMgr::GetIntDefault("ChatLevelReq.Say", 1);

	 m_int_configs[CONFIG_TRADE_LEVEL_REQ] = ConfigMgr::GetIntDefault("LevelReq.Trade", 1);

diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h

index 2938eed..6af015f 100755

--- a/src/server/game/World/World.h

+++ b/src/server/game/World/World.h

@@ -272,6 +275,7 @@ enum WorldIntConfigs

	 CONFIG_CHAT_CHANNEL_LEVEL_REQ,

	 CONFIG_CHAT_WHISPER_LEVEL_REQ,

	 CONFIG_CHAT_SAY_LEVEL_REQ,

+    CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT_AREA,

	 CONFIG_TRADE_LEVEL_REQ,

	 CONFIG_TICKET_LEVEL_REQ,

	 CONFIG_AUCTION_LEVEL_REQ,

diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist

index b74f5bf..f52f83e 100644

--- a/src/server/worldserver/worldserver.conf.dist

+++ b/src/server/worldserver/worldserver.conf.dist

@@ -1772,6 +1772,13 @@ AllowTwoSide.Accounts = 1

AllowTwoSide.Interaction.Chat = 0


#

+#    AllowTwoSide.Interaction.Chat.Area

+#	    Description: Allow say chat between factions on specific area.

+#	    Default:	 -1 - (Disabled)

+

+AllowTwoSide.Interaction.Chat.Area = -1

+

+#

#    AllowTwoSide.Interaction.Channel

#	    Description: Allow channel chat between factions.

#	    Default:	 0 - (Disabled)

P.S. Sorry for my little english.

Seems like an OK idea, except, it only allows one area in the present form, it could be written to allow a list of areas… Or, a bitmask of predetermined areas. Also, the config file description doesn’t really tell the user how to properly use it.

This^

IMHO better list of areas, i sugest you to look how ahbot disables items http://www.trinitycore.org/f/topic/10-ahbot-telenpc2-for-trinitycore-9bf7ee3-2012-06-22/ to know how to do it.

Maybe you can add it like AllowTwoSide.Interaction.Channel.Area and AllowTwoSide.Interaction.Channel.List (for example to enable at dalaran, shattrah the default blizzlike chanels) example:


#      AllowTwoSide.Interaction.Channel.Area

#              Description: Allow use channels between factions on specific area.

#              Default:         -1 - (Disabled)


AllowTwoSide.Interaction.Channel.Area = 3703,4395


#      AllowTwoSide.Interaction.Channel.List

#              Description: Channels use between factions on specific area.

#              Blizzlike means all built-in public channels (Trade, General, Say, Yell, Tell) 

#              Guilds means all guild channels (guild/officer)

#              Partys means party/raid/bg

#              You can write only specific channels for example: trade,say,party,raid

#              Default:         -1 - (Disabled)


AllowTwoSide.Interaction.Channel.Area.List = Blizzlike, Guilds, Partys, Custom1

Ok. Thank you very much. I will work on it.