Wycademy/src/Wycademy/Commands/Services/DamageCalculatorService.cs
/// <summary>
/// Send a damage calculator message to the channel.
/// </summary>
/// <param name="context">The command context, used for constructing the message.</param>
/// <param name="raw">The raw damage of the weapon.</param>
/// <param name="element">The elemental or status damage of the weapon.</param>
/// <param name="affinity">The affinity of the weapon.</param>
/// <param name="sharpness">The sharpness of the weapon.</param>
/// <param name="weapon">The type of the weapon.</param>
/// <param name="cache">The optional CommandCacheService to add the message to.</param>
/// <returns>The sent message.</returns>
Send a damage calculator message to the channel.
Send a damage calculator message to the channel .
public async Task<IUserMessage> SendDamageCalculatorMessageAsync(ICommandContext context, float raw, float element, float affinity, SharpnessType sharpness, WeaponType weapon, CommandCacheService cache = null)
        {
            const string initialMessage = "Please confirm which game you'd like to calculate for by selecting a reaction below.";
            var calculatorMessage = new DamageCalculatorMessage(context.User, raw, element, affinity, sharpness, weapon);
            IUserMessage message;
            if (cache != null)
            {
                message = await context.Channel.SendCachedMessageAsync(context.Message.Id, cache, text: initialMessage, prependZWSP: true);
            }
            else
            {
                message = await context.Channel.SendMessageAsync($"\x200b{initialMessage}");
            }
            await message.AddReactionAsync(new Emoji(FOUR));
            await message.AddReactionAsync(new Emoji(G));
            _messages.Add(message.Id, calculatorMessage);
            return message;
        }
public async Task < IUserMessage > SendDamageCalculatorMessageAsync ( ICommandContext context , float raw , float element , float affinity , SharpnessType sharpness , WeaponType weapon , CommandCacheService cache = null ) { const string initialMessage = " " ; var calculatorMessage = new DamageCalculatorMessage ( context . User , raw , element , affinity , sharpness , weapon ) ; IUserMessage message ; if ( cache != null ) { message = await context . Channel . SendCachedMessageAsync ( context . Message . Id , cache , text : initialMessage , prependZWSP : true ) ; } else { message = await context . Channel . SendMessageAsync ( $" \x200b { initialMessage } " ) ; } await message . AddReactionAsync ( new Emoji ( FOUR ) ) ; await message . AddReactionAsync ( new Emoji ( G ) ) ; _messages . Add ( message . Id , calculatorMessage ) ; return message ; }
Send a damage calculator message to the channel.
Send a damage calculator message to the channel .
// Create the calculator message. // Send the message (optionally caching it) // Add reaction choices. // Add the message ID (and associated data) to the dictionary. // Finally, return the message.
The sent message.
The sent message .
context
ICommandContext
The command context, used for constructing the message.
The command context used for constructing the message .
raw
float
The raw damage of the weapon.
The raw damage of the weapon .
element
float
The elemental or status damage of the weapon.
The elemental or status damage of the weapon .
affinity
float
The affinity of the weapon.
The affinity of the weapon .
sharpness
SharpnessType
The sharpness of the weapon.
The sharpness of the weapon .
weapon
WeaponType
The type of the weapon.
The type of the weapon .
cache
CommandCacheService
The optional CommandCacheService to add the message to.
The optional CommandCacheService to add the message to .