woopsy, commented out unneeded stuff
This commit is contained in:
parent
d5ea8f69c8
commit
4ff0c0cf34
@ -27,6 +27,7 @@ namespace NadekoBot.Classes
|
||||
conn.CreateTable<CurrencyTransaction>();
|
||||
conn.CreateTable<Donator>();
|
||||
conn.CreateTable<PokeMoves>();
|
||||
conn.CreateTable<UserPokeTypes>();
|
||||
conn.CreateTable<UserQuote>();
|
||||
conn.Execute(Queries.TransactionTriggerQuery);
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace NadekoBot.Classes._DataModels
|
||||
{
|
||||
class userPokeTypes : IDataModel
|
||||
class UserPokeTypes : IDataModel
|
||||
{
|
||||
public long UserId { get; set; }
|
||||
public int type { get; set; }
|
||||
|
@ -10,7 +10,6 @@ using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace NadekoBot.Modules.Pokemon
|
||||
{
|
||||
@ -34,7 +33,7 @@ namespace NadekoBot.Modules.Pokemon
|
||||
private PokeType GetPokeType(ulong id)
|
||||
{
|
||||
|
||||
var db = DbHandler.Instance.GetAllRows<userPokeTypes>();
|
||||
var db = DbHandler.Instance.GetAllRows<UserPokeTypes>();
|
||||
Dictionary<long, int> setTypes = db.ToDictionary(x => x.UserId, y => y.type);
|
||||
if (setTypes.ContainsKey((long)id))
|
||||
{
|
||||
@ -161,7 +160,8 @@ namespace NadekoBot.Modules.Pokemon
|
||||
await e.Channel.SendMessage(response);
|
||||
});
|
||||
|
||||
cgb.CreateCommand(Prefix + "listmoves")
|
||||
cgb.CreateCommand(Prefix + "ml")
|
||||
.Alias("movelist")
|
||||
.Description("Lists the moves you are able to use")
|
||||
.Do(async e =>
|
||||
{
|
||||
@ -175,39 +175,15 @@ namespace NadekoBot.Modules.Pokemon
|
||||
await e.Channel.SendMessage(str);
|
||||
});
|
||||
|
||||
cgb.CreateCommand(Prefix + "addmove")
|
||||
.Description($"Adds move given to database.\n**Usage**: {Prefix}addmove flame fire")
|
||||
.Parameter("movename", ParameterType.Required)
|
||||
.Parameter("movetype", ParameterType.Required)
|
||||
.Do(async e =>
|
||||
{
|
||||
//Implement NadekoFlowers????
|
||||
string newMove = e.GetArg("movename").ToLowerInvariant();
|
||||
var newType = PokemonTypesMain.stringToPokeType(e.GetArg("movetype").ToUpperInvariant());
|
||||
int typeNum = newType.Num;
|
||||
var db = DbHandler.Instance.GetAllRows<PokeMoves>().Select(x => x.move);
|
||||
if (db.Contains(newMove))
|
||||
{
|
||||
await e.Channel.SendMessage($"{newMove} already exists");
|
||||
return;
|
||||
}
|
||||
await Task.Run(() =>
|
||||
{
|
||||
DbHandler.Instance.InsertData(new Classes._DataModels.PokeMoves
|
||||
{
|
||||
move = newMove,
|
||||
type = typeNum
|
||||
});
|
||||
});
|
||||
await e.Channel.SendMessage($"Added {newType.Image}{newMove}");
|
||||
});
|
||||
|
||||
cgb.CreateCommand(Prefix + "heal")
|
||||
.Description($"Heals someone. Revives those that fainted. Costs a NadekoFlower \n**Usage**:{Prefix}revive @someone")
|
||||
.Parameter("target", ParameterType.Required)
|
||||
.Parameter("target", ParameterType.Unparsed)
|
||||
.Do(async e =>
|
||||
{
|
||||
var usr = e.Server.FindUsers(e.GetArg("target")).FirstOrDefault();
|
||||
var targetStr = e.GetArg("target");
|
||||
if (string.IsNullOrWhiteSpace(targetStr))
|
||||
return;
|
||||
var usr = e.Server.FindUsers(targetStr).FirstOrDefault();
|
||||
if (usr == null)
|
||||
{
|
||||
await e.Channel.SendMessage("No such person.");
|
||||
@ -253,10 +229,13 @@ namespace NadekoBot.Modules.Pokemon
|
||||
|
||||
cgb.CreateCommand(Prefix + "type")
|
||||
.Description($"Get the poketype of the target.\n**Usage**: {Prefix}type @someone")
|
||||
.Parameter("target", ParameterType.Required)
|
||||
.Parameter("target", ParameterType.Unparsed)
|
||||
.Do(async e =>
|
||||
{
|
||||
var usr = e.Server.FindUsers(e.GetArg("target")).FirstOrDefault();
|
||||
var usrStr = e.GetArg("target");
|
||||
if (string.IsNullOrWhiteSpace(usrStr))
|
||||
return;
|
||||
var usr = e.Server.FindUsers(usrStr).FirstOrDefault();
|
||||
if (usr == null)
|
||||
{
|
||||
await e.Channel.SendMessage("No such person.");
|
||||
@ -267,87 +246,116 @@ namespace NadekoBot.Modules.Pokemon
|
||||
|
||||
});
|
||||
|
||||
cgb.CreateCommand(Prefix + "setdefaultmoves")
|
||||
.Description($"Sets the moves DB to the default state and returns them all **OWNER ONLY**")
|
||||
.AddCheck(SimpleCheckers.OwnerOnly())
|
||||
.Do(async e =>
|
||||
{
|
||||
//clear DB
|
||||
var db = DbHandler.Instance.GetAllRows<PokeMoves>();
|
||||
foreach (PokeMoves p in db)
|
||||
{
|
||||
DbHandler.Instance.Delete<PokeMoves>(p.Id);
|
||||
}
|
||||
//cgb.CreateCommand(Prefix + "settype")
|
||||
// .Description($"Set your poketype. Costs a NadekoFlower.\n**Usage**: {Prefix}settype fire")
|
||||
// .Parameter("targetType", ParameterType.Unparsed)
|
||||
// .Do(async e =>
|
||||
// {
|
||||
// var targetTypeStr = e.GetArg("targetType")?.ToUpperInvariant();
|
||||
// if (string.IsNullOrWhiteSpace(targetTypeStr))
|
||||
// return;
|
||||
// var targetType = PokemonTypesMain.stringToPokeType(targetTypeStr);
|
||||
// if (targetType == null)
|
||||
// {
|
||||
// await e.Channel.SendMessage("Invalid type specified. Type must be one of:\nNORMAL, FIRE, WATER, ELECTRIC, GRASS, ICE, FIGHTING, POISON, GROUND, FLYING, PSYCHIC, BUG, ROCK, GHOST, DRAGON, DARK, STEEL");
|
||||
// return;
|
||||
// }
|
||||
// if (targetType == GetPokeType(e.User.Id))
|
||||
// {
|
||||
// await e.Channel.SendMessage($"Your type is already {targetType.Name.ToLowerInvariant()}{targetType.Image}");
|
||||
// return;
|
||||
// }
|
||||
|
||||
foreach (var entry in DefaultMoves.DefaultMovesList)
|
||||
{
|
||||
DbHandler.Instance.InsertData(new Classes._DataModels.PokeMoves
|
||||
{
|
||||
move = entry.Key,
|
||||
type = entry.Value
|
||||
});
|
||||
}
|
||||
// //Payment~
|
||||
// var amount = 1;
|
||||
// var pts = Classes.DbHandler.Instance.GetStateByUserId((long)e.User.Id)?.Value ?? 0;
|
||||
// if (pts < amount)
|
||||
// {
|
||||
// await e.Channel.SendMessage($"{e.User.Mention} you don't have enough NadekoFlowers! \nYou still need {amount - pts} to be able to do this!");
|
||||
// return;
|
||||
// }
|
||||
// await FlowersHandler.RemoveFlowersAsync(e.User, $"set usertype to {targetTypeStr}", amount);
|
||||
// //Actually changing the type here
|
||||
// var preTypes = DbHandler.Instance.GetAllRows<UserPokeTypes>();
|
||||
// Dictionary<long, int> Dict = preTypes.ToDictionary(x => x.UserId, y => y.Id);
|
||||
// if (Dict.ContainsKey((long)e.User.Id))
|
||||
// {
|
||||
// //delete previous type
|
||||
// DbHandler.Instance.Delete<UserPokeTypes>(Dict[(long)e.User.Id]);
|
||||
// }
|
||||
|
||||
var str = "**Reset moves to default**.\n**Moves:**";
|
||||
//could sort, but meh
|
||||
var dbMoves = DbHandler.Instance.GetAllRows<PokeMoves>();
|
||||
foreach (PokeMoves m in dbMoves)
|
||||
{
|
||||
var t = PokemonTypesMain.IntToPokeType(m.type);
|
||||
// DbHandler.Instance.InsertData(new Classes._DataModels.UserPokeTypes
|
||||
// {
|
||||
// UserId = (long)e.User.Id,
|
||||
// type = targetType.Num
|
||||
// });
|
||||
|
||||
str += $"\n{t.Image}{m.move}";
|
||||
}
|
||||
// //Now for the response
|
||||
|
||||
await e.Channel.SendMessage(str);
|
||||
// await e.Channel.SendMessage($"Set type of {e.User.Mention} to {targetTypeStr}{targetType.Image} for a 🌸");
|
||||
// });
|
||||
|
||||
});
|
||||
//cgb.CreateCommand(Prefix + "addmove")
|
||||
// .Description($"Adds move given to database.\n**Usage**: {Prefix}addmove flame fire")
|
||||
// .Parameter("movename", ParameterType.Required)
|
||||
// .Parameter("movetype", ParameterType.Required)
|
||||
// .Do(async e =>
|
||||
// {
|
||||
// //Implement NadekoFlowers????
|
||||
// string newMove = e.GetArg("movename").ToLowerInvariant();
|
||||
// var newType = PokemonTypesMain.stringToPokeType(e.GetArg("movetype").ToUpperInvariant());
|
||||
// int typeNum = newType.Num;
|
||||
// var db = DbHandler.Instance.GetAllRows<PokeMoves>().Select(x => x.move);
|
||||
// if (db.Contains(newMove))
|
||||
// {
|
||||
// await e.Channel.SendMessage($"{newMove} already exists");
|
||||
// return;
|
||||
// }
|
||||
// await Task.Run(() =>
|
||||
// {
|
||||
// DbHandler.Instance.InsertData(new Classes._DataModels.PokeMoves
|
||||
// {
|
||||
// move = newMove,
|
||||
// type = typeNum
|
||||
// });
|
||||
// });
|
||||
// await e.Channel.SendMessage($"Added {newType.Image}{newMove}");
|
||||
// });
|
||||
|
||||
cgb.CreateCommand(Prefix + "settype")
|
||||
.Description($"Set your poketype. Costs a NadekoFlower.\n**Usage**: {Prefix}settype fire")
|
||||
.Parameter("targetType", ParameterType.Required)
|
||||
.Do(async e =>
|
||||
{
|
||||
var targetTypeString = e.GetArg("targetType");
|
||||
var targetType = PokemonTypesMain.stringToPokeType(targetTypeString.ToUpperInvariant());
|
||||
if (targetType == null)
|
||||
{
|
||||
await e.Channel.SendMessage("Invalid type specified. Type must be one of:\nNORMAL, FIRE, WATER, ELECTRIC, GRASS, ICE, FIGHTING, POISON, GROUND, FLYING, PSYCHIC, BUG, ROCK, GHOST, DRAGON, DARK, STEEL");
|
||||
return;
|
||||
}
|
||||
if (targetType == GetPokeType(e.User.Id))
|
||||
{
|
||||
await e.Channel.SendMessage($"Your type is already {targetType.Name.ToLowerInvariant()}{targetType.Image}");
|
||||
return;
|
||||
}
|
||||
//cgb.CreateCommand(Prefix + "setdefaultmoves")
|
||||
// .Description($"Sets the moves DB to the default state and returns them all **OWNER ONLY**")
|
||||
// .AddCheck(SimpleCheckers.OwnerOnly())
|
||||
// .Do(async e =>
|
||||
// {
|
||||
// //clear DB
|
||||
// var db = DbHandler.Instance.GetAllRows<PokeMoves>();
|
||||
// foreach (PokeMoves p in db)
|
||||
// {
|
||||
// DbHandler.Instance.Delete<PokeMoves>(p.Id);
|
||||
// }
|
||||
|
||||
//Payment~
|
||||
var amount = 1;
|
||||
var pts = Classes.DbHandler.Instance.GetStateByUserId((long)e.User.Id)?.Value ?? 0;
|
||||
if (pts < amount)
|
||||
{
|
||||
await e.Channel.SendMessage($"{e.User.Mention} you don't have enough NadekoFlowers! \nYou still need {amount - pts} to be able to do this!");
|
||||
return;
|
||||
}
|
||||
await FlowersHandler.RemoveFlowersAsync(e.User, $"set usertype to {targetTypeString}", amount);
|
||||
//Actually changing the type here
|
||||
var preTypes = DbHandler.Instance.GetAllRows<userPokeTypes>();
|
||||
Dictionary<long, int> Dict = preTypes.ToDictionary(x => x.UserId, y => y.Id);
|
||||
if (Dict.ContainsKey((long)e.User.Id))
|
||||
{
|
||||
//delete previous type
|
||||
DbHandler.Instance.Delete<userPokeTypes>(Dict[(long)e.User.Id]);
|
||||
}
|
||||
// foreach (var entry in DefaultMoves.DefaultMovesList)
|
||||
// {
|
||||
// DbHandler.Instance.InsertData(new Classes._DataModels.PokeMoves
|
||||
// {
|
||||
// move = entry.Key,
|
||||
// type = entry.Value
|
||||
// });
|
||||
// }
|
||||
|
||||
DbHandler.Instance.InsertData(new Classes._DataModels.userPokeTypes
|
||||
{
|
||||
UserId = (long)e.User.Id,
|
||||
type = targetType.Num
|
||||
});
|
||||
// var str = "**Reset moves to default**.\n**Moves:**";
|
||||
// //could sort, but meh
|
||||
// var dbMoves = DbHandler.Instance.GetAllRows<PokeMoves>();
|
||||
// foreach (PokeMoves m in dbMoves)
|
||||
// {
|
||||
// var t = PokemonTypesMain.IntToPokeType(m.type);
|
||||
|
||||
//Now for the response
|
||||
// str += $"\n{t.Image}{m.move}";
|
||||
// }
|
||||
|
||||
await e.Channel.SendMessage($"Set type of {e.User.Mention} to {targetTypeString}{targetType.Image} for a 🌸");
|
||||
});
|
||||
// await e.Channel.SendMessage(str);
|
||||
|
||||
// });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user