Archived
1

/top and /top_my functions

This commit is contained in:
2018-02-05 12:37:46 +04:00
parent 526304294c
commit 6dac398fd3
9 changed files with 259 additions and 88 deletions

View File

@@ -4,6 +4,7 @@
package dbmapping
import (
"math"
"time"
)
@@ -24,3 +25,15 @@ type Profile struct {
Crystalls int `db:"crystalls"`
CreatedAt time.Time `db:"created_at"`
}
// FullExp returns exp points in summary, gained after registration
func (p *Profile) FullExp() int {
fullExp := 0.00
for i := 1; i < p.LevelID+1; i++ {
fullExp = fullExp + (100 * math.Pow(2.0, float64(i)))
}
fullExp += float64(p.Exp)
return int(fullExp)
}