|
|
@ -41,8 +41,8 @@ func UpdateAccountLastActivity(uuid []byte) error {
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func UpdateAccountStats(uuid []byte, stats defs.GameStats) error {
|
|
|
|
func UpdateAccountStats(uuid []byte, stats defs.GameStats, voucherCounts map[string]int) error {
|
|
|
|
var columns = []string{"playTime", "battles", "classicSessionsPlayed", "sessionsWon", "highestEndlessWave", "highestLevel", "pokemonSeen", "pokemonDefeated", "pokemonCaught", "pokemonHatched", "eggsPulled"}
|
|
|
|
var columns = []string{"playTime", "battles", "classicSessionsPlayed", "sessionsWon", "highestEndlessWave", "highestLevel", "pokemonSeen", "pokemonDefeated", "pokemonCaught", "pokemonHatched", "eggsPulled", "regularVouchers", "plusVouchers", "premiumVouchers", "goldenVouchers"}
|
|
|
|
|
|
|
|
|
|
|
|
var statCols []string
|
|
|
|
var statCols []string
|
|
|
|
var statValues []interface{}
|
|
|
|
var statValues []interface{}
|
|
|
@ -64,6 +64,24 @@ func UpdateAccountStats(uuid []byte, stats defs.GameStats) error {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for k, v := range voucherCounts {
|
|
|
|
|
|
|
|
var column string
|
|
|
|
|
|
|
|
switch k {
|
|
|
|
|
|
|
|
case "0":
|
|
|
|
|
|
|
|
column = "regularVouchers"
|
|
|
|
|
|
|
|
case "1":
|
|
|
|
|
|
|
|
column = "plusVouchers"
|
|
|
|
|
|
|
|
case "2":
|
|
|
|
|
|
|
|
column = "premiumVouchers"
|
|
|
|
|
|
|
|
case "3":
|
|
|
|
|
|
|
|
column = "goldenVouchers"
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
statCols = append(statCols, column)
|
|
|
|
|
|
|
|
statValues = append(statValues, v)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var statArgs []interface{}
|
|
|
|
var statArgs []interface{}
|
|
|
|
statArgs = append(statArgs, uuid)
|
|
|
|
statArgs = append(statArgs, uuid)
|
|
|
|
for range 2 {
|
|
|
|
for range 2 {
|
|
|
|