summaryrefslogtreecommitdiffstats
path: root/wat/db.go
diff options
context:
space:
mode:
authoralex2018-10-23 00:15:28 +0100
committeralex2018-10-23 00:15:28 +0100
commit9120ee3691856275086357d053f1d39ddaa8fa18 (patch)
treebaaa0885c0867df92dc5183c1d1e415868b6734c /wat/db.go
parent19716c3afbf5902e208a32215dd1c63ec7c5a9f6 (diff)
downloadwatbot-9120ee3691856275086357d053f1d39ddaa8fa18.tar.gz
watbot-9120ee3691856275086357d053f1d39ddaa8fa18.tar.bz2
watbot-9120ee3691856275086357d053f1d39ddaa8fa18.zip
fixed some bugs, fixed some debug behaviour, changed over to a command -> method map to avoid sending spurious messages
Diffstat (limited to 'wat/db.go')
-rw-r--r--wat/db.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/wat/db.go b/wat/db.go
index 81f111b..5784acb 100644
--- a/wat/db.go
+++ b/wat/db.go
@@ -14,14 +14,14 @@ type Player struct {
Watting int64
Anarchy int64
Trickery int64
- Coins int64
+ Coins int64 `gorm:"default:'100'"`
Health int64
LastMined int64
LastRested int64
}
func (p *Player) Conscious() bool {
- return true
+ return (p.Health > 0)
}
func (p *Player) Level(xp int64) int64 {
@@ -89,6 +89,6 @@ func (w *WatDb) Update(upd interface{}) {
func (w *WatDb) TopTen() []Player {
var user = make([]Player, 10)
- w.db.Limit(10).Find(&user)
+ w.db.Limit(10).Order("coins desc").Find(&user)
return user
}