/// <summary> /// Sends a chat message to the <see cref="User"/>. This is provided purely for convenience since it can /// become quite redundant having to constantly create the <see cref="ServerPacket.Chat"/> calls. /// </summary> /// <param name="message">The message to send.</param> void UserChat(string message) { using (var pw = ServerPacket.Chat(message)) { User.Send(pw, ServerMessageType.GUIChat); } }
void RecvSelectAccountCharacter(IIPSocket conn, BitStream r) { ThreadAsserts.IsMainThread(); var index = r.ReadByte(); // Ensure the client is in a valid state to select an account character var userAccount = World.GetUserAccount(conn); if (userAccount == null) { return; } if (userAccount.User != null) { const string errmsg = "Account `{0}` tried to change characters while a character was already selected."; if (log.IsInfoEnabled) { log.InfoFormat(errmsg, userAccount); } return; } // Get the CharacterID CharacterID characterID; if (!userAccount.TryGetCharacterID(index, out characterID)) { const string errmsg = "Invalid account character index `{0}` given."; if (log.IsInfoEnabled) { log.InfoFormat(errmsg, characterID); } return; } // Load the user userAccount.SetUser(World, characterID); var user = userAccount.User; if (user != null) { // Send the MOTD if (!string.IsNullOrEmpty(ServerSettings.Default.MOTD)) { using (var pw = ServerPacket.Chat(ServerSettings.Default.MOTD)) { user.Send(pw, ServerMessageType.GUIChat); } } // Send a notification to the world that the user joined var param = new object[] { user.Name }; World.Send(GameMessage.UserJoinedWorld, ServerMessageType.GUIChat, param); } }
/// <summary> /// When overridden in the derived class, handles the output from a command. /// </summary> /// <param name="user">The user that the command came from.</param> /// <param name="text">The output text from the command. Will not be null or empty.</param> protected override void HandleCommandOutput(User user, string text) { ThreadAsserts.IsMainThread(); using (var pw = ServerPacket.Chat(text)) { user.Send(pw, ServerMessageType.GUIChat); } }
/// <summary> /// Sends a chat message to the <see cref="User"/>. This is provided purely for convenience since it can /// become quite redundant having to constantly create the <see cref="ServerPacket.Chat"/> calls. /// </summary> /// <param name="message">The message to send.</param> /// <param name="args">The string formatting arguments.</param> void UserChat(string message, params object[] args) { var msgFormatted = string.Format(message, args); using (var pw = ServerPacket.Chat(msgFormatted)) { User.Send(pw, ServerMessageType.GUIChat); } }