clean up db vars fix exp calc calls
This commit is contained in:
parent
c362475bae
commit
68ec8ce5ea
@ -33,11 +33,9 @@ func (b *Babble) Validate() error {
|
||||
|
||||
// Global store with singleton pattern
|
||||
var store *nigiri.BaseStore[Babble]
|
||||
var db *nigiri.Collection
|
||||
|
||||
// Init sets up the Nigiri store and indices
|
||||
func Init(collection *nigiri.Collection) {
|
||||
db = collection
|
||||
store = nigiri.NewBaseStore[Babble]()
|
||||
|
||||
// Register custom indices
|
||||
|
@ -9,7 +9,6 @@ import (
|
||||
|
||||
var (
|
||||
store *nigiri.BaseStore[Control]
|
||||
db *nigiri.Collection
|
||||
global *Control
|
||||
mu sync.RWMutex
|
||||
)
|
||||
@ -27,7 +26,6 @@ type Control struct {
|
||||
|
||||
// Init sets up the Nigiri store for control settings
|
||||
func Init(collection *nigiri.Collection) {
|
||||
db = collection
|
||||
store = nigiri.NewBaseStore[Control]()
|
||||
|
||||
// Load or create the singleton control instance
|
||||
|
@ -22,11 +22,9 @@ const (
|
||||
|
||||
// Global store
|
||||
var store *nigiri.BaseStore[Drop]
|
||||
var db *nigiri.Collection
|
||||
|
||||
// Init sets up the Nigiri store and indices
|
||||
func Init(collection *nigiri.Collection) {
|
||||
db = collection
|
||||
store = nigiri.NewBaseStore[Drop]()
|
||||
|
||||
// Register custom indices
|
||||
|
@ -32,11 +32,9 @@ type Fight struct {
|
||||
|
||||
// Global store
|
||||
var store *nigiri.BaseStore[Fight]
|
||||
var db *nigiri.Collection
|
||||
|
||||
// Init sets up the Nigiri store and indices
|
||||
func Init(collection *nigiri.Collection) {
|
||||
db = collection
|
||||
store = nigiri.NewBaseStore[Fight]()
|
||||
|
||||
// Register custom indices
|
||||
|
@ -23,11 +23,9 @@ type Forum struct {
|
||||
|
||||
// Global store
|
||||
var store *nigiri.BaseStore[Forum]
|
||||
var db *nigiri.Collection
|
||||
|
||||
// Init sets up the Nigiri store and indices
|
||||
func Init(collection *nigiri.Collection) {
|
||||
db = collection
|
||||
store = nigiri.NewBaseStore[Forum]()
|
||||
|
||||
// Register custom indices
|
||||
|
@ -25,11 +25,9 @@ const (
|
||||
|
||||
// Global store
|
||||
var store *nigiri.BaseStore[Item]
|
||||
var db *nigiri.Collection
|
||||
|
||||
// Init sets up the Nigiri store and indices
|
||||
func Init(collection *nigiri.Collection) {
|
||||
db = collection
|
||||
store = nigiri.NewBaseStore[Item]()
|
||||
|
||||
// Register custom indices
|
||||
|
@ -28,11 +28,9 @@ const (
|
||||
|
||||
// Global store
|
||||
var store *nigiri.BaseStore[Monster]
|
||||
var db *nigiri.Collection
|
||||
|
||||
// Init sets up the Nigiri store and indices
|
||||
func Init(collection *nigiri.Collection) {
|
||||
db = collection
|
||||
store = nigiri.NewBaseStore[Monster]()
|
||||
|
||||
// Register custom indices
|
||||
|
@ -18,11 +18,9 @@ type News struct {
|
||||
|
||||
// Global store
|
||||
var store *nigiri.BaseStore[News]
|
||||
var db *nigiri.Collection
|
||||
|
||||
// Init sets up the Nigiri store and indices
|
||||
func Init(collection *nigiri.Collection) {
|
||||
db = collection
|
||||
store = nigiri.NewBaseStore[News]()
|
||||
|
||||
// Register custom indices
|
||||
|
@ -27,11 +27,9 @@ const (
|
||||
|
||||
// Global store
|
||||
var store *nigiri.BaseStore[Spell]
|
||||
var db *nigiri.Collection
|
||||
|
||||
// Init sets up the Nigiri store and indices
|
||||
func Init(collection *nigiri.Collection) {
|
||||
db = collection
|
||||
store = nigiri.NewBaseStore[Spell]()
|
||||
|
||||
// Register custom indices
|
||||
|
@ -27,7 +27,6 @@ type Town struct {
|
||||
|
||||
// Global store
|
||||
var store *nigiri.BaseStore[Town]
|
||||
var db *nigiri.Collection
|
||||
|
||||
// coordsKey creates a key for coordinate-based lookup
|
||||
func coordsKey(x, y int) string {
|
||||
@ -36,7 +35,6 @@ func coordsKey(x, y int) string {
|
||||
|
||||
// Init sets up the Nigiri store and indices
|
||||
func Init(collection *nigiri.Collection) {
|
||||
db = collection
|
||||
store = nigiri.NewBaseStore[Town]()
|
||||
|
||||
// Register custom indices
|
||||
|
@ -8,6 +8,7 @@ import (
|
||||
"time"
|
||||
|
||||
"dk/internal/helpers"
|
||||
"dk/internal/helpers/exp"
|
||||
|
||||
nigiri "git.sharkk.net/Sharkk/Nigiri"
|
||||
)
|
||||
@ -61,11 +62,9 @@ type User struct {
|
||||
|
||||
// Global store
|
||||
var store *nigiri.BaseStore[User]
|
||||
var db *nigiri.Collection
|
||||
|
||||
// Init sets up the Nigiri store and indices
|
||||
func Init(collection *nigiri.Collection) {
|
||||
db = collection
|
||||
store = nigiri.NewBaseStore[User]()
|
||||
|
||||
// Register custom indices
|
||||
@ -348,8 +347,7 @@ func (u *User) SetPosition(x, y int) {
|
||||
}
|
||||
|
||||
func (u *User) ExpNeededForNextLevel() int {
|
||||
level := u.Level + 1
|
||||
return level * level * level
|
||||
return exp.Calc(u.Level + 1)
|
||||
}
|
||||
|
||||
func (u *User) GrantExp(expAmount int) {
|
||||
@ -382,7 +380,7 @@ func (u *User) ExpProgress() float64 {
|
||||
return float64(u.Exp) / float64(u.ExpNeededForNextLevel()) * 100
|
||||
}
|
||||
|
||||
currentLevelExp := u.Level * u.Level * u.Level
|
||||
currentLevelExp := exp.Calc(u.Level)
|
||||
nextLevelExp := u.ExpNeededForNextLevel()
|
||||
progressExp := u.Exp
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user