Browse Source

Support for SendMessage to send any Channel ID by number versus colors 'red' and 'yellow' hardcoded

image 3 years ago
parent
commit
f0699d2501
1 changed files with 6 additions and 0 deletions
  1. 6 0
      EQ2/source/WorldServer/LuaFunctions.cpp

+ 6 - 0
EQ2/source/WorldServer/LuaFunctions.cpp

@@ -3546,10 +3546,16 @@ int EQ2Emu_lua_SendMessage(lua_State* state) {
 		Client* client = spawn->GetZone()->GetClientBySpawn(spawn);
 		if (client) {
 			if (color_str.length() > 0) {
+				// leave for backwards compat, but all future should just use the number
 				if (strncasecmp(color_str.c_str(), "red", 3) == 0)
 					color = CHANNEL_COLOR_RED;
 				else if (strncasecmp(color_str.c_str(), "yellow", 6) == 0)
 					color = CHANNEL_COLOR_YELLOW;
+				else
+				{
+					// use a number to specify the channel as per Commands/Commands.h defines
+					color = (int8)atoul(color_str.c_str());
+				}
 			}
 			client->SimpleMessage(color, message.c_str());
 		}