public static void ChatAction(NetState state, PacketReader pvSrc) { if (!m_Enabled) { return; } try { Mobile from = state.Mobile; ChatUser user = ChatUser.GetChatUser(from); if (user == null) { return; } string lang = pvSrc.ReadStringSafe(4); int actionID = pvSrc.ReadInt16(); string param = pvSrc.ReadUnicodeString(); ChatActionHandler handler = ChatActionHandlers.GetHandler(actionID); if (handler != null) { Channel channel = user.CurrentChannel; if (handler.RequireConference && channel == null) { user.SendMessage(31); /* You must be in a conference to do this. * To join a conference, select one from the Conference menu. */ } else if (handler.RequireModerator && !user.IsModerator) { user.SendMessage(29); // You must have operator status to do this. } else { handler.Callback(user, channel, param); } } else { Console.WriteLine("Client: {0}: Unknown chat action 0x{1:X}: {2}", state, actionID, param); } } catch (Exception e) { LogHelper.LogException(e); Console.WriteLine(e); } }
public static void ChatAction(NetState state, CircularBufferReader reader, int packetLength) { if (!ChatSystem.Enabled) { return; } try { var from = state.Mobile; var user = ChatUser.GetChatUser(from); if (user == null) { return; } var lang = reader.ReadAsciiSafe(4); int actionID = reader.ReadInt16(); var param = reader.ReadBigUniSafe(); var handler = ChatActionHandlers.GetHandler(actionID); if (handler == null) { state.LogInfo($"Unknown chat action 0x{actionID:X}: {param}"); return; } var channel = user.CurrentChannel; if (handler.RequireConference && channel == null) { // You must be in a conference to do this. // To join a conference, select one from the Conference menu. user.SendMessage(31); return; } if (handler.RequireModerator && !user.IsModerator) { user.SendMessage(29); // You must have operator status to do this. return; } handler.Callback(user, channel, param); } catch (Exception e) { Console.WriteLine(e); } }
public static void ChatAction(NetState state, PacketReader reader) { if (!Enabled) { return; } try { var from = state.Mobile; var user = ChatUser.GetChatUser(from); if (user == null) { return; } var lang = reader.ReadStringSafe(4); int actionID = reader.ReadInt16(); var param = reader.ReadUnicodeString(); var handler = ChatActionHandlers.GetHandler(actionID); if (handler == null) { Console.WriteLine("Client: {0}: Unknown chat action 0x{1:X}: {2}", state, actionID, param); return; } var channel = user.CurrentChannel; if (handler.RequireConference && channel == null) { // You must be in a conference to do this. // To join a conference, select one from the Conference menu. user.SendMessage(31); return; } if (handler.RequireModerator && !user.IsModerator) { user.SendMessage(29); // You must have operator status to do this. return; } handler.Callback(user, channel, param); } catch (Exception e) { Console.WriteLine(e); } }
public static void ChatAction(NetState state, PacketReader pvSrc) { if (!Enabled) { return; } try { Mobile from = state.Mobile; ChatUser user = ChatUser.GetChatUser(from); if (user == null) { return; } string lang = pvSrc.ReadStringSafe(4); short actionId = pvSrc.ReadInt16(); string param = pvSrc.ReadUnicodeString(); ChatActionHandler handler = ChatActionHandlers.GetHandler(actionId); if (handler != null) { Channel channel = user.CurrentChannel; if (handler.RequireConference && channel == null) { /* You must be in a conference to do this. * To join a conference, select one from the Conference menu. */ user.SendMessage(31); } else { handler.Callback(user, channel, param); } } else { Console.WriteLine("Client: {0}: Unknown chat action 0x{1:X}: {2}", state, actionId, param); } } catch (Exception e) { Diagnostics.ExceptionLogging.LogException(e); } }