예제 #1
0
 public static void DeleteCharacter(SocketUser user, string charName)
 {
     if (CharacterLoadService.LoadCharacter(user).Name.Equals(charName))
     {
         File.Delete(Character.saveLoc + user.Id + Character.fileExtension);
     }
 }
예제 #2
0
 public static byte GetCharacterLevel(SocketUser user)
 {
     if (CharacterUtilityService.CharacterExists(user)) // fancy way
     {
         return(GetCharacterLevel(CharacterLoadService.LoadCharacter(user)));
     }
     else
     {
         return(0);
     }
 }
예제 #3
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");
            }
        }
예제 #4
0
 public static int GetCharacterExpPoints(SocketUser user)
 {
     if (CharacterUtilityService.CharacterExists(user))
     {
         return(GetCharacterExpPoints(CharacterLoadService.LoadCharacter(user)));
     }
     else
     {
         return(-1);
     }
 }
예제 #5
0
 public static List <CharacterStats.Trait> GetCharacterTraits(SocketUser user)
 {
     if (CharacterExists(user))
     {
         return(CharacterLoadService.LoadCharacter(user).CharTraits);
     }
     else
     {
         return(null);
     }
 }
예제 #6
0
 public static CharacterStats.Skills GetCharacterSkills(SocketUser user)
 {
     if (CharacterExists(user))
     {
         return(CharacterLoadService.LoadCharacter(user).CharSkills);
     }
     else
     {
         return(null);
     }
 }
예제 #7
0
 public static CharacterStats.SPECIAL GetCharacterSpecial(SocketUser user)
 {
     if (CharacterExists(user))
     {
         return(CharacterLoadService.LoadCharacter(user).CharSpecial);
     }
     else
     {
         return(null);
     }
 }
예제 #8
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);
        }
예제 #9
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);
        }