Example #1
0
        public static string AddPerk(SocketUser user, string perkToAdd)
        {
            var character = CharacterLoadService.LoadCharacter(user);
            int oldCount  = character.CharPerks.Count;

            if (character == null)
            {
                return("Couldn't find character!");
            }
            if (character.RemainingPerkPoints <= 0)
            {
                return("You don't have any skill points!");
            }

            foreach (var perk in CharacterUtilityService.GetAllPerks())
            {
                if (perk.Name.ToLower().Equals(perkToAdd.ToLower())) // parameter case insensitivity
                {
                    if (character.CharPerks.Contains(perk))          // add another rank to perk instead of adding it to list
                    {
                        var charPerk = character.CharPerks.Find(x => x.Name.Equals(perk.Name));
                        if (charPerk.CurrentPerkRanks < perk.PerkRanks)
                        {
                            charPerk.CurrentPerkRanks++;
                            CharacterUtilityService.OverwriteCharacter(character);
                            return("Added a rank to the given perk!");
                        }
                        else
                        {
                            return("You already have that stat at its max rank!");
                        }
                    }
                    else
                    {
                        // TODO: actually check Skill and S.P.E.C.I.A.L. requirements
                        if (character.CharSpecial.IsGreaterThanOrEqualTo(perk.SpecialRequirement) &&
                            character.CharSkills.IsGreaterThanOrEqualTo(perk.SkillRequirement))
                        {
                            character.CharPerks.Add(perk);
                            CharacterUtilityService.OverwriteCharacter(character);
                            return("Added perk!");
                        }
                    }
                }
            }
            if (oldCount == character.CharPerks.Count) // make sure we added a perk
            {
                return("Failed to add the given perk.  (Check spelling!)");
            }
            else
            {
                return("idk wtf happened bro tell someone how you got here");
            }
        }
Example #2
0
        public static async Task CharacterLevelUp(SocketUser user)
        {
            var dmChannel = await user.GetOrCreateDMChannelAsync();

            var character = CharacterLoadService.LoadCharacter(user);

            AddSkillPoints(character); // that doesn't seem right...I should probably move that to Character

            var cPre = CommandHandlerService.cmd_prefix;

            await dmChannel.SendMessageAsync("You're now level " + GetCharacterLevel(character) + ", and have " + character.RemainingSkillPoints + " skill points remaining to add. " +
                                             "You have " + character.RemainingPerkPoints + " remaining perk points.  " +
                                             "Use " + cPre + "addskill to add skill points, and " + cPre + "addperk to add perks.  Use " + cPre + "viewskills to look at skill names.");

            await Task.Delay(1000);

            CharacterUtilityService.OverwriteCharacter(character);
        }
Example #3
0
        public static void AwardExp(SocketUser user)
        {
            var character    = CharacterLoadService.LoadCharacter(user);
            int expOnMessage = int.Parse(Program._config["exp_on_message"]);

            int actualExp = (int)Math.Round(expOnMessage * (character.CharSpecial.Intelligence / 10.0 + 1));

            if (character != null)
            {
                character.ExpPoints += actualExp;
            }
            else
            {
                return;
            }

            CharacterUtilityService.OverwriteCharacter(character);
        }