Updated Help Command and code update

This commit is contained in:
Runebaas 2017-09-15 22:56:03 +02:00
parent c82d6ec666
commit 8911123b78
23 changed files with 248 additions and 238 deletions

View file

@ -5,9 +5,9 @@ namespace Geekbot.net.Lib
{
public class CheckEmImageProvider : ICheckEmImageProvider
{
private string[] checkEmImageArray;
private int totalCheckEmImages;
private Random rnd;
private readonly string[] checkEmImageArray;
private readonly Random rnd;
private readonly int totalCheckEmImages;
public CheckEmImageProvider()
{

View file

@ -1,23 +1,20 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
namespace Geekbot.net.Lib
{
class FortunesProvider : IFortunesProvider
internal class FortunesProvider : IFortunesProvider
{
private string[] fortuneArray;
private int totalFortunes;
private Random rnd;
private readonly string[] fortuneArray;
private readonly Random rnd;
private readonly int totalFortunes;
public FortunesProvider()
{
var path = Path.GetFullPath("./Storage/fortunes");
if (File.Exists(path))
{
var rawFortunes= File.ReadAllText(path);
var rawFortunes = File.ReadAllText(path);
fortuneArray = rawFortunes.Split("%");
totalFortunes = fortuneArray.Length;
rnd = new Random();
@ -46,4 +43,4 @@ namespace Geekbot.net.Lib
string GetRandomFortune();
string GetFortune(int id);
}
}
}

View file

@ -1,20 +1,16 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Geekbot.net.Lib
{
class LevelCalc
internal class LevelCalc
{
private static int GetExperienceAtLevel(int level)
{
double total = 0;
for (int i = 1; i < level; i++)
{
for (var i = 1; i < level; i++)
total += Math.Floor(i + 300 * Math.Pow(2, i / 7.0));
}
return (int)Math.Floor(total / 16);
return (int) Math.Floor(total / 16);
}
public static int GetLevelAtExperience(int experience)
@ -22,12 +18,10 @@ namespace Geekbot.net.Lib
int index;
for (index = 0; index < 120; index++)
{
if (GetExperienceAtLevel(index + 1) > experience)
break;
}
return index;
}
}
}
}

View file

@ -1,5 +1,4 @@
using System;
using System.Threading.Tasks;
using System.Threading.Tasks;
using Discord.WebSocket;
using StackExchange.Redis;
@ -7,7 +6,6 @@ namespace Geekbot.net.Lib
{
public class StatsRecorder
{
private readonly SocketMessage message;
private readonly IDatabase redis;