/top and /top_my functions
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user