Refaction all files into component based folders

This commit is contained in:
runebaas 2018-05-03 00:56:06 +02:00
parent 55e152f4aa
commit e3adf55742
No known key found for this signature in database
GPG key ID: 2677AF508D0300D6
102 changed files with 816 additions and 709 deletions

View file

@ -0,0 +1,7 @@
namespace Geekbot.net.Lib.Levels
{
public interface ILevelCalc
{
int GetLevel(int experience);
}
}

View file

@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
namespace Geekbot.net.Lib.Levels
{
public class LevelCalc : ILevelCalc
{
private int[] _levels;
public LevelCalc()
{
var levels = new List<int>();
double total = 0;
for (var i = 1; i < 120; i++)
{
total += Math.Floor(i + 300 * Math.Pow(2, i / 7.0));
levels.Add((int) Math.Floor(total / 16));
}
_levels = levels.ToArray();
}
public int GetLevel(int messages)
{
var returnVal = 1;
foreach (var level in _levels)
{
if (level > messages) break;
returnVal++;
}
return returnVal;
}
}
}