特惠礼包bug修复

This commit is contained in:
hahwu 2026-02-11 14:47:41 +08:00
parent c94e97dbe6
commit e4ba7fd004
2 changed files with 20 additions and 2 deletions

View File

@ -239,9 +239,14 @@ func GetSpecialShopGrade(Money float64, Type int) int {
if len(l) == 0 {
return 0
}
maxMoney := 0.0
for _, v := range l {
if Money <= v.money {
if Money >= v.money {
maxMoney = max(maxMoney, v.money)
}
}
for _, v := range l {
if v.money == maxMoney {
return v.id
}
}

View File

@ -0,0 +1,13 @@
package test
import (
"server/game"
"testing"
)
func TestSpecialCharge(t *testing.T) {
p1 := new(game.Player)
p1.InitPlayer("3625212")
ChargeMod := p1.GetChargeMod()
ChargeMod.ZeroUpdate(nil)
}