Refaction all files into component based folders
This commit is contained in:
parent
55e152f4aa
commit
e3adf55742
102 changed files with 816 additions and 709 deletions
7
Geekbot.net/Lib/Levels/ILevelCalc.cs
Normal file
7
Geekbot.net/Lib/Levels/ILevelCalc.cs
Normal file
|
@ -0,0 +1,7 @@
|
|||
namespace Geekbot.net.Lib.Levels
|
||||
{
|
||||
public interface ILevelCalc
|
||||
{
|
||||
int GetLevel(int experience);
|
||||
}
|
||||
}
|
33
Geekbot.net/Lib/Levels/LevelCalc.cs
Normal file
33
Geekbot.net/Lib/Levels/LevelCalc.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue