moved PokemonMoves to their own json
This commit is contained in:
@ -37,10 +37,10 @@ namespace NadekoBot.Modules.Pokemon
|
||||
{
|
||||
|
||||
var db = DbHandler.Instance.GetAllRows<UserPokeTypes>();
|
||||
Dictionary<long, int> setTypes = db.ToDictionary(x => x.UserId, y => y.type);
|
||||
Dictionary<long, string> setTypes = db.ToDictionary(x => x.UserId, y => y.type);
|
||||
if (setTypes.ContainsKey((long)id))
|
||||
{
|
||||
return PokemonTypesMain.IntToPokeType(setTypes[(long)id]);
|
||||
return PokemonTypesMain.stringToPokeType(setTypes[(long)id])?? new PokemonTypes.NormalType();
|
||||
}
|
||||
|
||||
int remainder = Math.Abs((int)(id % 18));
|
||||
@ -116,7 +116,7 @@ namespace NadekoBot.Modules.Pokemon
|
||||
var enabledMoves = userType.GetMoves();
|
||||
if (!enabledMoves.Contains(move.ToLowerInvariant()))
|
||||
{
|
||||
await e.Channel.SendMessage($"{e.User.Mention} was not able to use **{move}**, use {Prefix}listmoves to see moves you can use");
|
||||
await e.Channel.SendMessage($"{e.User.Mention} was not able to use **{move}**, use `{Prefix}ml` to see moves you can use");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -177,7 +177,7 @@ namespace NadekoBot.Modules.Pokemon
|
||||
.Do(async e =>
|
||||
{
|
||||
var userType = GetPokeType(e.User.Id);
|
||||
List<string> movesList = userType.GetMoves();
|
||||
var movesList = userType.GetMoves();
|
||||
var str = $"**Moves for `{userType.Name}` type.**";
|
||||
foreach (string m in movesList)
|
||||
{
|
||||
@ -298,7 +298,7 @@ namespace NadekoBot.Modules.Pokemon
|
||||
DbHandler.Instance.InsertData(new UserPokeTypes
|
||||
{
|
||||
UserId = (long)e.User.Id,
|
||||
type = targetType.Num
|
||||
type = targetType.Name
|
||||
});
|
||||
|
||||
//Now for the response
|
||||
|
@ -1,5 +1,6 @@
|
||||
using NadekoBot.Classes;
|
||||
using NadekoBot.Classes._DataModels;
|
||||
using NadekoBot.Classes.JSONModels;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NadekoBot.Modules.Pokemon.PokeTypes.Extensions
|
||||
@ -8,15 +9,15 @@ namespace NadekoBot.Modules.Pokemon.PokeTypes.Extensions
|
||||
{
|
||||
public static List<string> GetMoves(this PokeType poketype)
|
||||
{
|
||||
var db = DbHandler.Instance.GetAllRows<PokeMoves>();
|
||||
var moveSet = NadekoBot.Config.PokemonMoves;
|
||||
List<string> moves = new List<string>();
|
||||
foreach (PokeMoves p in db)
|
||||
foreach (PokeMove p in moveSet)
|
||||
{
|
||||
if (p.type == poketype.Num)
|
||||
if (p.type == poketype.Name)
|
||||
{
|
||||
if (!moves.Contains(p.move))
|
||||
if (!moves.Contains(p.name))
|
||||
{
|
||||
moves.Add(p.move);
|
||||
moves.Add(p.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,12 +18,12 @@ namespace NadekoBot.Modules.Pokemon.PokeTypes
|
||||
|
||||
foreach (PokeType t in TypeList)
|
||||
{
|
||||
if (t.Name == newType)
|
||||
if (t.Name == newType.ToUpperInvariant())
|
||||
{
|
||||
return t;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return new NormalType();
|
||||
}
|
||||
|
||||
//These classes can use all methods (except getMoves)
|
||||
|
Reference in New Issue
Block a user