trivia questions and pokemon data will be stored in redis, instead of per-shard
This commit is contained in:
		@@ -1,55 +0,0 @@
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Modules.Searches.Common
 | 
			
		||||
{
 | 
			
		||||
    public class SearchPokemon
 | 
			
		||||
    {
 | 
			
		||||
        public class GenderRatioClass
 | 
			
		||||
        {
 | 
			
		||||
            public float M { get; set; }
 | 
			
		||||
            public float F { get; set; }
 | 
			
		||||
        }
 | 
			
		||||
        public class BaseStatsClass
 | 
			
		||||
        {
 | 
			
		||||
            public int HP { get; set; }
 | 
			
		||||
            public int ATK { get; set; }
 | 
			
		||||
            public int DEF { get; set; }
 | 
			
		||||
            public int SPA { get; set; }
 | 
			
		||||
            public int SPD { get; set; }
 | 
			
		||||
            public int SPE { get; set; }
 | 
			
		||||
 | 
			
		||||
            public override string ToString() => $@"**HP:**  {HP,-4} **ATK:** {ATK,-4} **DEF:** {DEF,-4}
 | 
			
		||||
**SPA:** {SPA,-4} **SPD:** {SPD,-4} **SPE:** {SPE,-4}";
 | 
			
		||||
        }
 | 
			
		||||
        public int Id { get; set; }
 | 
			
		||||
        public string Species { get; set; }
 | 
			
		||||
        public string[] Types { get; set; }
 | 
			
		||||
        public GenderRatioClass GenderRatio { get; set; }
 | 
			
		||||
        public BaseStatsClass BaseStats { get; set; }
 | 
			
		||||
        public Dictionary<string, string> Abilities { get; set; }
 | 
			
		||||
        public float HeightM { get; set; }
 | 
			
		||||
        public float WeightKg { get; set; }
 | 
			
		||||
        public string Color { get; set; }
 | 
			
		||||
        public string[] Evos { get; set; }
 | 
			
		||||
        public string[] EggGroups { get; set; }
 | 
			
		||||
 | 
			
		||||
//        public override string ToString() => $@"`Name:` {Species}
 | 
			
		||||
//`Types:` {string.Join(", ", Types)}
 | 
			
		||||
//`Stats:` {BaseStats}
 | 
			
		||||
//`Height:` {HeightM,4}m `Weight:` {WeightKg}kg
 | 
			
		||||
//`Abilities:` {string.Join(", ", Abilities.Values)}";
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public class SearchPokemonAbility
 | 
			
		||||
    {
 | 
			
		||||
        public string Desc { get; set; }
 | 
			
		||||
        public string ShortDesc { get; set; }
 | 
			
		||||
        public string Name { get; set; }
 | 
			
		||||
        public float Rating { get; set; }
 | 
			
		||||
 | 
			
		||||
//        public override string ToString() => $@"`Name:` : {Name}
 | 
			
		||||
//`Rating:` {Rating}
 | 
			
		||||
//`Description:` {Desc}";
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -6,7 +6,8 @@ using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using NadekoBot.Common.Attributes;
 | 
			
		||||
using NadekoBot.Modules.Searches.Common;
 | 
			
		||||
using NadekoBot.Core.Common.Pokemon;
 | 
			
		||||
using NadekoBot.Core.Services;
 | 
			
		||||
 | 
			
		||||
namespace NadekoBot.Modules.Searches
 | 
			
		||||
{
 | 
			
		||||
@@ -15,8 +16,15 @@ namespace NadekoBot.Modules.Searches
 | 
			
		||||
        [Group]
 | 
			
		||||
        public class PokemonSearchCommands : NadekoSubmodule<SearchesService>
 | 
			
		||||
        {
 | 
			
		||||
            public Dictionary<string, SearchPokemon> Pokemons => _service.Pokemons;
 | 
			
		||||
            public Dictionary<string, SearchPokemonAbility> PokemonAbilities => _service.PokemonAbilities;
 | 
			
		||||
            private readonly IDataCache _cache;
 | 
			
		||||
 | 
			
		||||
            public IReadOnlyDictionary<string, SearchPokemon> Pokemons => _cache.LocalData.Pokemons;
 | 
			
		||||
            public IReadOnlyDictionary<string, SearchPokemonAbility> PokemonAbilities => _cache.LocalData.PokemonAbilities;
 | 
			
		||||
 | 
			
		||||
            public PokemonSearchCommands(IDataCache cache)
 | 
			
		||||
            {
 | 
			
		||||
                _cache = cache;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            [NadekoCommand, Usage, Description, Aliases]
 | 
			
		||||
            public async Task Pokemon([Remainder] string pokemon = null)
 | 
			
		||||
 
 | 
			
		||||
@@ -17,7 +17,6 @@ using System.Net.Http;
 | 
			
		||||
using Newtonsoft.Json.Linq;
 | 
			
		||||
using AngleSharp;
 | 
			
		||||
using System.Threading;
 | 
			
		||||
using NadekoBot.Modules.Searches.Exceptions;
 | 
			
		||||
using ImageSharp;
 | 
			
		||||
using Image = ImageSharp.Image;
 | 
			
		||||
using SixLabors.Primitives;
 | 
			
		||||
@@ -41,12 +40,6 @@ namespace NadekoBot.Modules.Searches.Services
 | 
			
		||||
 | 
			
		||||
        public ConcurrentDictionary<ulong, bool> TranslatedChannels { get; } = new ConcurrentDictionary<ulong, bool>();
 | 
			
		||||
        public ConcurrentDictionary<UserChannelPair, string> UserLanguages { get; } = new ConcurrentDictionary<UserChannelPair, string>();
 | 
			
		||||
        
 | 
			
		||||
        public readonly string PokemonAbilitiesFile = "data/pokemon/pokemon_abilities7.json";
 | 
			
		||||
 | 
			
		||||
        public readonly string PokemonListFile = "data/pokemon/pokemon_list7.json";
 | 
			
		||||
        public Dictionary<string, SearchPokemon> Pokemons { get; } = new Dictionary<string, SearchPokemon>();
 | 
			
		||||
        public Dictionary<string, SearchPokemonAbility> PokemonAbilities { get; } = new Dictionary<string, SearchPokemonAbility>();
 | 
			
		||||
 | 
			
		||||
        public List<WoWJoke> WowJokes { get; } = new List<WoWJoke>();
 | 
			
		||||
        public List<MagicItem> MagicItems { get; } = new List<MagicItem>();
 | 
			
		||||
@@ -113,17 +106,6 @@ namespace NadekoBot.Modules.Searches.Services
 | 
			
		||||
                return Task.CompletedTask;
 | 
			
		||||
            };
 | 
			
		||||
 | 
			
		||||
            //pokemon commands
 | 
			
		||||
            if (File.Exists(PokemonListFile))
 | 
			
		||||
            {
 | 
			
		||||
                Pokemons = JsonConvert.DeserializeObject<Dictionary<string, SearchPokemon>>(File.ReadAllText(PokemonListFile));
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
                _log.Warn(PokemonListFile + " is missing. Pokemon abilities not loaded.");
 | 
			
		||||
            if (File.Exists(PokemonAbilitiesFile))
 | 
			
		||||
                PokemonAbilities = JsonConvert.DeserializeObject<Dictionary<string, SearchPokemonAbility>>(File.ReadAllText(PokemonAbilitiesFile));
 | 
			
		||||
            else
 | 
			
		||||
                _log.Warn(PokemonAbilitiesFile + " is missing. Pokemon abilities not loaded.");
 | 
			
		||||
 | 
			
		||||
            //joke commands
 | 
			
		||||
            if (File.Exists("data/wowjokes.json"))
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user