mirror of
https://github.com/pagefaultgames/rogueserver.git
synced 2025-04-28 23:26:17 +08:00
Make RetrievePlaytime pull time directly from save
This commit is contained in:
parent
857bdee976
commit
add5fbc326
@ -199,11 +199,11 @@ func FetchLastLoggedInDateByUsername(username string) (string, error) {
|
||||
}
|
||||
|
||||
type AdminSearchResponse struct {
|
||||
Username string `json:"username"`
|
||||
DiscordId string `json:"discordId"`
|
||||
GoogleId string `json:"googleId"`
|
||||
LastActivity string `json:"lastLoggedIn"` // TODO: this is currently lastLoggedIn to match server PR #54 with pokerogue PR #4198. We're hotfixing the server with this PR to return lastActivity, but we're not hotfixing the client, so are leaving this as lastLoggedIn so that it still talks to the client properly
|
||||
Registered string `json:"registered"`
|
||||
Username string `json:"username"`
|
||||
DiscordId string `json:"discordId"`
|
||||
GoogleId string `json:"googleId"`
|
||||
LastActivity string `json:"lastLoggedIn"` // TODO: this is currently lastLoggedIn to match server PR #54 with pokerogue PR #4198. We're hotfixing the server with this PR to return lastActivity, but we're not hotfixing the client, so are leaving this as lastLoggedIn so that it still talks to the client properly
|
||||
Registered string `json:"registered"`
|
||||
}
|
||||
|
||||
func FetchAdminDetailsByUsername(dbUsername string) (AdminSearchResponse, error) {
|
||||
@ -216,11 +216,11 @@ func FetchAdminDetailsByUsername(dbUsername string) (AdminSearchResponse, error)
|
||||
}
|
||||
|
||||
adminResponse = AdminSearchResponse{
|
||||
Username: username.String,
|
||||
DiscordId: discordId.String,
|
||||
GoogleId: googleId.String,
|
||||
LastActivity: lastActivity.String,
|
||||
Registered: registered.String,
|
||||
Username: username.String,
|
||||
DiscordId: discordId.String,
|
||||
GoogleId: googleId.String,
|
||||
LastActivity: lastActivity.String,
|
||||
Registered: registered.String,
|
||||
}
|
||||
|
||||
return adminResponse, nil
|
||||
|
@ -219,13 +219,12 @@ func DeleteSessionSaveData(uuid []byte, slot int) error {
|
||||
}
|
||||
|
||||
func RetrievePlaytime(uuid []byte) (int, error) {
|
||||
var playtime int
|
||||
err := handle.QueryRow("SELECT playTime FROM accountStats WHERE uuid = ?", uuid).Scan(&playtime)
|
||||
system, err := ReadSystemSaveData(uuid)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return playtime, nil
|
||||
return int(system.GameStats.(map[string]interface{})["playTime"].(float64)), nil
|
||||
}
|
||||
|
||||
func GetSystemSaveFromS3(uuid []byte) (defs.SystemSaveData, error) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user