Exemplo n.º 1
0
            public async Task ShowCharacterStoryAsync(IUser targetUser = null)
            {
                var userInfo  = Context.User;
                var character = targetUser == null
                    ? await _charService.GetCharacterAsync(userInfo.Id)
                    : await _charService.GetCharacterAsync(targetUser.Id);

                if (character == null)
                {
                    await ReplyAsync(string.Format(Messages.ERR_CHAR_NOT_FOUND, userInfo.Mention));

                    return;
                }

                if (character.Story == null || character.Story.Equals(""))
                {
                    await ReplyAsync(string.Format(Messages.ERR_STORY_NOT_FOUND, userInfo.Mention));

                    return;
                }

                var embed = EmbedHelper.BuildBasicEmbed("Command: $character story",
                                                        $"**Name:** {character.Name}\n" +
                                                        $"**Story:** {character.Story}");

                await ReplyAsync(userInfo.Mention, embed : embed);
            }
Exemplo n.º 2
0
            public async Task <RuntimeResult> ShowCharacterStoryAsync(IUser targetUser = null)
            {
                var userInfo  = Context.User;
                var character = targetUser == null
                    ? await _charService.GetCharacterAsync(userInfo.Id)
                    : await _charService.GetCharacterAsync(targetUser.Id);

                if (character == null)
                {
                    return(CharacterResult.CharacterNotFound());
                }

                if (character.Story == null || character.Story.Equals(""))
                {
                    return(GenericResult.FromError(Messages.ERR_STORY_NOT_FOUND));
                }

                var embed = EmbedHelper.BuildBasicEmbed("Command: $character story",
                                                        $"**Name:** {character.Name}\n" +
                                                        $"**Story:** {character.Story}");

                await ReplyAsync(userInfo.Mention, embed : embed);

                return(GenericResult.FromSilentSuccess());
            }
Exemplo n.º 3
0
        public async Task ShowCharacterAsync(IUser targetUser = null)
        {
            var userInfo  = Context.User;
            var character = targetUser == null
                ? await _charService.GetCharacterAsync(userInfo.Id)
                : await _charService.GetCharacterAsync(targetUser.Id);

            if (character == null)
            {
                await ReplyAsync(string.Format(Messages.ERR_CHAR_NOT_FOUND, userInfo.Mention));

                return;
            }

            var level          = _expService.CalculateLevelForExperience(character.Experience);
            var expToNextLevel = _expService.CalculateRemainingExperienceToNextLevel(character.Experience);

            var description = string.IsNullOrEmpty(character.Description) ? "No description." : character.Description;
            var story       = string.IsNullOrEmpty(character.Story) ? "No story." : character.Story;

            var embed = EmbedHelper.BuildBasicEmbed($"{character.Name}",
                                                    $"**Description:** {description}\n" +
                                                    $"**Story:** ($char story)\n" +
                                                    $"**Level:** {level}\n" +
                                                    $"**Experience:** {character.Experience}\n" +
                                                    $"**To Next Level:** {expToNextLevel}\n" +
                                                    $"**Caps:** {character.Money}");

            await ReplyAsync(userInfo.Mention, embed : embed);
        }
Exemplo n.º 4
0
        public async Task <RuntimeResult> ShowCharacterAsync(IUser targetUser = null)
        {
            var userInfo  = Context.User;
            var character = targetUser == null
                ? await _charService.GetCharacterAsync(userInfo.Id)
                : await _charService.GetCharacterAsync(targetUser.Id);

            if (character == null)
            {
                return(CharacterResult.CharacterNotFound());
            }

            var level          = _expService.CalculateLevelForExperience(character.Experience);
            var expToNextLevel = _expService.CalculateRemainingExperienceToNextLevel(character.Experience);

            if (!ExperienceService.UseOldProgression)
            {
                expToNextLevel = (level + 1) * 1000 - character.Experience;
            }

            var description = string.IsNullOrEmpty(character.Description) ? "No description." : character.Description;
            var story       = string.IsNullOrEmpty(character.Story) ? "No story." : character.Story;

            var embed = EmbedHelper.BuildBasicEmbed($"{character.Name}",
                                                    $"**Description:** {description}\n" +
                                                    $"**Story:** ($char story)\n" +
                                                    $"**Level:** {level}\n" +
                                                    $"**Experience:** {character.Experience}\n" +
                                                    $"**To Next Level:** {expToNextLevel}\n" +
                                                    $"**Caps:** {character.Money}");

            await ReplyAsync(userInfo.Mention, embed : embed);

            return(GenericResult.FromSilentSuccess());
        }
Exemplo n.º 5
0
            public async Task ShowSpecialAsync(IUser targetUser = null)
            {
                var userInfo  = Context.User;
                var character = targetUser == null
                    ? await _charService.GetCharacterAsync(userInfo.Id)
                    : await _charService.GetCharacterAsync(targetUser.Id);

                if (character == null)
                {
                    await ReplyAsync(
                        string.Format(Messages.ERR_CHAR_NOT_FOUND, userInfo.Mention));

                    return;
                }

                if (!_specService.IsSpecialSet(character))
                {
                    await ReplyAsync(
                        string.Format(Messages.ERR_SPECIAL_NOT_FOUND, userInfo.Mention));

                    return;
                }

                var embed = EmbedHelper.BuildBasicEmbed("Command: $character special",
                                                        $"**Name:** {character.Name}\n" +
                                                        $"**STR:** {character.Special.Strength}\n" +
                                                        $"**PER:** {character.Special.Perception}\n" +
                                                        $"**END:** {character.Special.Endurance}\n" +
                                                        $"**CHA:** {character.Special.Charisma}\n" +
                                                        $"**INT:** {character.Special.Intelligence}\n" +
                                                        $"**AGI:** {character.Special.Agility}\n" +
                                                        $"**LUC:** {character.Special.Luck}");

                await ReplyAsync(userInfo.Mention, embed : embed);
            }
Exemplo n.º 6
0
        public async Task <RuntimeResult> ViewEffectAsync([Remainder] string name)
        {
            var effect = await _effectsService.GetEffectAsync(name);

            if (effect == null)
            {
                return(GenericResult.FromError(Messages.ERR_EFFECT_NOT_FOUND));
            }

            await ReplyAsync(message : Context.User.Mention, embed : EmbedHelper.BuildBasicEmbed(null, _effectsService.GetEffectInfo(effect)));

            return(GenericResult.FromSilentSuccess());
        }
Exemplo n.º 7
0
        public async Task ShowSpecialHelpAsync(SocketCommandContext context, Special spec)
        {
            var    userInfo = context.User;
            string message  = String.Empty;

            message =
                $"**Description:** {(String.IsNullOrEmpty(spec.Description) ? "None" : spec.Description)}\n" +
                $"**Aliases:** {String.Join(", ", spec.AliasesArray)}\n" +
                $"**Acts as:** {spec.StatisticFlag.ToString()}\n";

            var embed = EmbedHelper.BuildBasicEmbed(spec.Name, message);

            await context.User.SendMessageAsync(userInfo.Mention, embed : embed);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Shows the skills help menu.
        /// </summary>
        public async Task ShowSpecialHelpAsync(SocketCommandContext context)
        {
            var userInfo = context.User;
            var message  = new StringBuilder();

            foreach (var spec in SpecialService.Specials.OrderBy(x => x.Id).Select(x => x.Name))
            {
                message.Append($"{spec}\n");
            }

            var embed = EmbedHelper.BuildBasicEmbed("Command: $help skills", message.ToString());

            await context.User.SendMessageAsync(userInfo.Mention, embed : embed);
        }
Exemplo n.º 9
0
        /// <summary>
        /// Shows the skills help menu.
        /// </summary>
        public async Task ShowSkillsHelpAsync(SocketCommandContext context)
        {
            var userInfo = context.User;
            var message  = new StringBuilder();

            foreach (var skill in Globals.SKILL_NAMES)
            {
                message.Append($"{skill}\n");
            }

            var embed = EmbedHelper.BuildBasicEmbed("Command: $help skills", message.ToString());

            await context.User.SendMessageAsync(userInfo.Mention, embed : embed);
        }
Exemplo n.º 10
0
        public async Task ShowSkillsHelpAsync(SocketCommandContext context, Skill skill)
        {
            var    userInfo = context.User;
            string message  = String.Empty;

            message =
                $"**Description:** {(String.IsNullOrEmpty(skill.Description) ? "None" : skill.Description)}\n" +
                $"**Aliases:** {String.Join(", ", skill.AliasesArray)}\n" +
                $"**S.P.E.C.I.A.L.:** {skill.Special.Name}\n" +
                $"**Acts as:** {skill.StatisticFlag.ToString()}\n" +
                $"**Minimum value to use:** {skill.MinimumValue}";

            var embed = EmbedHelper.BuildBasicEmbed(skill.Name, message);

            await context.User.SendMessageAsync(userInfo.Mention, embed : embed);
        }
Exemplo n.º 11
0
        public async Task <RuntimeResult> ShowCharacterEffectsAsync(string name)
        {
            var userInfo  = Context.User;
            var character = _npcService.FindNpc(name);

            if (character == null)
            {
                return(CharacterResult.NpcNotFound());
            }

            string info = _effectsService.GetCharacterEffects(character);

            await ReplyAsync(userInfo.Mention, embed : EmbedHelper.BuildBasicEmbed($"{character.Name}'s Effects:", info));

            return(GenericResult.FromSilentSuccess());
        }
Exemplo n.º 12
0
            public async Task ShowSkillsAsync(IUser targetUser = null)
            {
                var userInfo  = Context.User;
                var character = targetUser == null
                    ? await _charService.GetCharacterAsync(userInfo.Id)
                    : await _charService.GetCharacterAsync(targetUser.Id);

                if (character == null)
                {
                    await ReplyAsync(
                        string.Format(Messages.ERR_CHAR_NOT_FOUND, userInfo.Mention));

                    return;
                }

                if (!_skillsService.AreSkillsSet(character))
                {
                    await ReplyAsync(
                        string.Format(Messages.ERR_SKILLS_NOT_FOUND, userInfo.Mention));

                    return;
                }

                var embed = EmbedHelper.BuildBasicEmbed("Command: $character skills",
                                                        $"**Name:** {character.Name}\n" +
                                                        $"**Barter:** {character.Skills.Barter}\n" +
                                                        $"**Energy Weapons:** {character.Skills.EnergyWeapons}\n" +
                                                        $"**Explosives:** {character.Skills.Explosives}\n" +
                                                        $"**Guns:** {character.Skills.Guns}\n" +
                                                        $"**Lockpick:** {character.Skills.Lockpick}\n" +
                                                        $"**Medicine:** {character.Skills.Medicine}\n" +
                                                        $"**MeleeWeapons:** {character.Skills.MeleeWeapons}\n" +
                                                        $"**Repair:** {character.Skills.Repair}\n" +
                                                        $"**Science:** {character.Skills.Science}\n" +
                                                        $"**Sneak:** {character.Skills.Sneak}\n" +
                                                        $"**Speech:** {character.Skills.Speech}\n" +
                                                        $"**Survival:** {character.Skills.Survival}\n" +
                                                        $"**Unarmed:** {character.Skills.Unarmed}\n" +
                                                        $"*You have {character.SkillPoints} left to spend! ($char skills spend)*");

                await ReplyAsync(userInfo.Mention, embed : embed);
            }
Exemplo n.º 13
0
        /// <summary>
        /// Shows the skills help menu.
        /// </summary>
        public async Task ShowSkillsHelpAsync(SocketCommandContext context)
        {
            var userInfo = context.User;
            var message  = new StringBuilder();

            foreach (var special in SpecialService.Specials.OrderBy(x => x.Id))
            {
                message.Append($"**{special.Name}:**\n");
                foreach (var skill in SkillsService.Skills.Where(x => x.Special.Equals(special)))
                {
                    message.Append($"{skill.Name}\n");
                }

                message.Append($"\n");
            }

            var embed = EmbedHelper.BuildBasicEmbed("Command: $help skills", message.ToString());

            await context.User.SendMessageAsync(userInfo.Mention, embed : embed);
        }
Exemplo n.º 14
0
        public async Task ViewPresetInfo(string name)
        {
            var dmChannel = await Context.User.GetOrCreateDMChannelAsync();

            NpcPreset preset = await _presetService.GetNpcPreset(name);

            if (preset == null)
            {
                await dmChannel.SendMessageAsync(String.Format(Messages.ERR_NPC_PRESET_NOT_FOUND, name));
            }

            StringBuilder sb = new StringBuilder();

            foreach (var stat in preset.Statistics)
            {
                sb.Append($"{stat.Statistic.Name}: {stat.Value}\n");
            }

            await dmChannel.SendMessageAsync(Context.User.Mention, embed : EmbedHelper.BuildBasicEmbed($"Preset info for {preset.Name}:", sb.ToString()));
        }
Exemplo n.º 15
0
        public async Task <RuntimeResult> ListCharactersAsync()
        {
            var characters = await _charService.GetAllCharactersAsync(Context.User.Id);

            if (characters == null)
            {
                return(CharacterResult.CharacterNotFound());
            }

            var message = new StringBuilder();

            for (var i = 0; i < characters.Count; i++)
            {
                message.Append($"{i + 1}: {characters[i].Name}\n");
            }

            var embed = EmbedHelper.BuildBasicEmbed("Command: $character list", message.ToString());

            await ReplyAsync(Context.User.Mention, embed : embed);

            return(GenericResult.FromSilentSuccess());
        }
Exemplo n.º 16
0
        public async Task ListCharactersAsync()
        {
            var characters = await _charService.GetAllCharactersAsync(Context.User.Id);

            if (characters == null)
            {
                await ReplyAsync(String.Format(Messages.ERR_CHAR_NOT_FOUND, Context.User.Mention));

                return;
            }

            var message = new StringBuilder();

            for (var i = 0; i < characters.Count; i++)
            {
                message.Append($"{i + 1}: {characters[i].Name}\n");
            }

            var embed = EmbedHelper.BuildBasicEmbed("Command: $character list", message.ToString());

            await ReplyAsync(Context.User.Mention, embed : embed);
        }
Exemplo n.º 17
0
        public async Task <RuntimeResult> ListEffectsAsync()
        {
            var effects = await _effectsService.GetAllOwnedEffectsAsync(Context.User.Id);

            if (effects == null)
            {
                return(GenericResult.FromError(Messages.ERR_EFFECT_NOT_FOUND));
            }

            var message = new StringBuilder();

            for (var i = 0; i < effects.Count; i++)
            {
                message.Append($"{i + 1}: {effects[i].Name}\n");
            }

            var embed = EmbedHelper.BuildBasicEmbed("Command: $effect list", message.ToString());

            await ReplyAsync(Context.User.Mention, embed : embed);

            return(GenericResult.FromSilentSuccess());
        }
Exemplo n.º 18
0
            private async Task <RuntimeResult> ShowSpecialAsync(IUser targetUser = null, bool useEffects = false)
            {
                var userInfo  = Context.User;
                var character = targetUser == null
                    ? await _charService.GetCharacterAsync(userInfo.Id)
                    : await _charService.GetCharacterAsync(targetUser.Id);

                if (character == null)
                {
                    return(CharacterResult.CharacterNotFound());
                }

                var stats = character.Statistics;

                if (useEffects)
                {
                    stats = _effectsService.GetEffectiveStatistics(character);
                }

                StringBuilder message = new StringBuilder($"**Name:** {character.Name}\n");

                foreach (var special in stats.Where(x => x.Statistic is Special).OrderBy(x => x.Statistic.Id))
                {
                    message.Append($"**{special.Statistic.Name}:** {special.Value}\n");
                }

                if (!_specService.IsSpecialSet(character))
                {
                    message.Append($"*You have {character.SpecialPoints} S.P.E.C.I.A.L. points left to spend!*");
                }

                var embed = EmbedHelper.BuildBasicEmbed("Command: $special", message.ToString());

                await ReplyAsync(userInfo.Mention, embed : embed);

                return(GenericResult.FromSilentSuccess());
            }
Exemplo n.º 19
0
            private async Task <RuntimeResult> ShowSkillsAsync(IUser targetUser = null, bool useEffects = false)
            {
                var userInfo  = Context.User;
                var character = targetUser == null
                    ? await _charService.GetCharacterAsync(userInfo.Id)
                    : await _charService.GetCharacterAsync(targetUser.Id);

                if (character == null)
                {
                    return(CharacterResult.CharacterNotFound());
                }

                bool skillsSet = _skillsService.AreSkillsSet(character);
                var  stats     = character.Statistics;

                if (useEffects)
                {
                    stats = _effectsService.GetEffectiveStatistics(character);
                }

                StringBuilder message = new StringBuilder($"**Name:** {character.Name}\n");

                foreach (var special in SpecialService.Specials.OrderBy(x => x.Id))
                {
                    message.Append($"__**{special.Name}:**__\n");
                    foreach (var skill in stats.Where(x => x.Statistic is Skill sk && sk.Special.Equals(special)).OrderBy(x => x.Statistic.Name))
                    {
                        if (skillsSet || !_progOptions.UseOldProgression)
                        {
                            if (skill.Value == 0)
                            {
                                continue;
                            }

                            message.Append($"**{skill.Statistic.Name}:** {skill.Value}\n");
                        }
                        else
                        {
                            message.Append($"*{skill.Statistic.Name}*, ");
                        }
                    }

                    message.Append($"\n");
                }

                if (skillsSet)
                {
                    if (character.ExperiencePoints > 0)
                    {
                        message.Append($"*You have {character.ExperiencePoints}XP left to spend! ($char skills spend)*");
                    }
                }
                else
                {
                    if (!_progOptions.OldProgression.UseNewVegasRules)
                    {
                        message.Append($"*You have {character.TagPoints} Tag points left to spend!*");
                    }
                }

                var embed = EmbedHelper.BuildBasicEmbed("Command: $skills", message.ToString());

                await ReplyAsync(userInfo.Mention, embed : embed);

                return(GenericResult.FromSilentSuccess());
            }
Exemplo n.º 20
0
        public RuntimeResult RollVsStatistic(Character character1, Character character2, Statistic stat1, Statistic stat2, bool useEffects = false)
        {
            var stats1 = character1.Statistics;
            var stats2 = character2.Statistics;

            if (useEffects)
            {
                stats1 = _effectsService.GetEffectiveStatistics(character1);
                stats2 = _effectsService.GetEffectiveStatistics(character2);
            }

            if ((stat1 is Skill skill1 && _statService.GetStatistic(stats1, stat1) < skill1.MinimumValue) ||
                (stat2 is Skill skill2 && _statService.GetStatistic(stats2, stat2) < skill2.MinimumValue))
            {
                return(StatisticResult.SkillNotHighEnough());
            }

            string message = "";

            if (_roleplayOptions.UsePercentage)
            {
                var result1 = GetOldRollResult(stats1, stat1);
                var result2 = GetOldRollResult(stats2, stat2);

                message = $"*{character1.Name}* rolls `{stat1.Name}` against *{character2.Name}'s* `{stat2.Name}`!\n\n" +
                          $"{GetOldRollMessage(character1.Name, stat1.Name, result1)}\n" +
                          $"{GetOldRollMessage(character2.Name, stat2.Name, result2)}\n\n";

                if (result1 < 0 && result2 < 0)
                {
                    message += "Nobody wins!";
                }
                else
                {
                    if (result1 > result2)
                    {
                        message += $"{character1.Name} wins!";
                    }
                    else
                    {
                        message += $"{character2.Name} wins!";
                    }
                }

                if (useEffects)
                {
                    message = Messages.MUSCLE_EMOJI + message;
                }

                return(RollResult.PercentageRoll(message));
            }
            else
            {
                var result1 = GetRollResult(stats1, stat1);
                var result2 = GetRollResult(stats2, stat2);

                message = $"*{character1.Name}* rolls `{stat1.Name}` against *{character2.Name}'s* `{stat2.Name}`!\n\n" +
                          $"__{character1.Name}__: {GetRollMessage(character1.Name, stat1.Name, result1)}\n\n" +
                          $"__{character2.Name}__: {GetRollMessage(character2.Name, stat2.Name, result2)}";

                if (useEffects)
                {
                    return(RollResult.DiceRoll(EmbedHelper.BuildBasicEmbed($"{Messages.MUSCLE_EMOJI}{stat1.Name} Vs. {stat2.Name} Buffed Roll", message)));
                }

                return(RollResult.DiceRoll(EmbedHelper.BuildBasicEmbed($"{stat1.Name} Vs. {stat2.Name} Roll", message)));
            }
        }
Exemplo n.º 21
0
        public RuntimeResult RollStatistic(Character character, Statistic stat, bool useEffects = false)
        {
            var stats = character.Statistics;

            if (useEffects)
            {
                stats = _effectsService.GetEffectiveStatistics(character);
            }

            if (stat is Skill skill && _statService.GetStatistic(stats, stat) < skill.MinimumValue)
            {
                return(StatisticResult.SkillNotHighEnough());
            }

            string message = "";
            Color  color   = new Color(200, 45, 0);

            if (_roleplayOptions.UsePercentage)
            {
                var result = GetOldRollResult(stats, stat);

                message = GetOldRollMessage(character.Name, stat.Name, result);

                if (result >= 95)
                {
                    color = new Color(210, 170, 0);
                }
                else if (result >= 0)
                {
                    color = new Color(60, 210, 0);
                }

                if (useEffects)
                {
                    message = Messages.MUSCLE_EMOJI + message;
                }

                return(RollResult.PercentageRoll(message));
            }
            else
            {
                var result    = GetRollResult(stats, stat);
                var successes = result.Count(x => x >= SUCCESS_ROLL);

                message = $"*{character.Name}* rolls `{stat.Name}`!\n" + GetRollMessage(character.Name, stat.Name, result);

                if (successes > 7)
                {
                    color = new Color(210, 170, 0);
                }
                else if (successes > 0)
                {
                    color = new Color(60, 210, 0);
                }

                if (useEffects)
                {
                    return(RollResult.DiceRoll(EmbedHelper.BuildBasicEmbed($"{Messages.MUSCLE_EMOJI}{stat.Name} Buffed Roll", message, color)));
                }

                return(RollResult.DiceRoll(EmbedHelper.BuildBasicEmbed($"{stat.Name} Roll", message, color)));
            }
        }