/// <summary> /// Called when [posting]. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="ChannelPostingEventArgs" /> instance containing the event data.</param> /// <exception cref="NotImplementedException"></exception> private void OnPosting(object sender, ChannelPostingEventArgs e) { if (e.CharacterSpawn.Level.Current >= MinLevel) { return; } e.CharacterSpawn.Connection.SendTextMessage(TextMessageType.StatusSmall, "You need to be at least level 10 to speak into this channel."); e.Cancel = true; }
/// <inheritdoc /> /// <summary> /// Posts the specified message. /// </summary> /// <param name="characterSpawn">The character spawn.</param> /// <param name="text">The text.</param> /// <param name="type">The type.</param> public void Post(ICharacterSpawn characterSpawn, string text, SpeechType type) { ChannelPostingEventArgs channelPostingEventArgs = new ChannelPostingEventArgs(characterSpawn, type, text); Posting?.Invoke(this, channelPostingEventArgs); if (channelPostingEventArgs.Cancel) { return; } SendMessage(characterSpawn, channelPostingEventArgs.Text, channelPostingEventArgs.Type); ChannelPostedEventArgs channelPostedEventArgs = new ChannelPostedEventArgs(characterSpawn, channelPostingEventArgs.Type, channelPostingEventArgs.Text); Posted?.Invoke(this, channelPostedEventArgs); }
/// <summary> /// Called when [posting]. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="ChannelPostingEventArgs" /> instance containing the event data.</param> private void OnPosting(object sender, ChannelPostingEventArgs e) { if (_muteConditionByCharacterSpawnId[e.CharacterSpawn.Id] == null) { _muteConditionByCharacterSpawnId[e.CharacterSpawn.Id] = new Stopwatch(); } // TODO: Permissions to ignore channel constraints Stopwatch muteCondition = _muteConditionByCharacterSpawnId[e.CharacterSpawn.Id]; if (!muteCondition.IsRunning || muteCondition.Elapsed >= MuteSpan) { return; } e.CharacterSpawn.Connection.SendTextMessage(TextMessageType.StatusSmall, "You may place an offer every 2 minutes."); e.Cancel = true; }
/// <summary> /// Called when [posting]. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="ChannelPostingEventArgs" /> instance containing the event data.</param> private static void OnPosting(object sender, ChannelPostingEventArgs e) { e.Cancel = true; }