playroom优化

This commit is contained in:
hahwu 2025-07-04 10:36:12 +08:00
parent 97c2c06c9a
commit eaa8a32b00
2 changed files with 13 additions and 0 deletions

View File

@ -300,3 +300,15 @@ func Rand6DigitNumber() string {
n := rand.Intn(1000000)
return fmt.Sprintf("%06d", n)
}
func UniqueInts(input []int) []int {
seen := make(map[int]struct{})
result := make([]int, 0, len(input))
for _, v := range input {
if _, ok := seen[v]; !ok {
seen[v] = struct{}{}
result = append(result, v)
}
}
return result
}

View File

@ -3136,6 +3136,7 @@ func ReqPlayroomInfo(player *Player, buf []byte) error {
RandList = append(RandList, v)
}
}
RandList = GoUtil.UniqueInts(RandList)
if len(RandList) == 0 {
PlayroomMod.SetGameReward(0, 0, Star)
} else if len(RandList) == 1 {