playroom优化
This commit is contained in:
parent
97c2c06c9a
commit
eaa8a32b00
@ -300,3 +300,15 @@ func Rand6DigitNumber() string {
|
|||||||
n := rand.Intn(1000000)
|
n := rand.Intn(1000000)
|
||||||
return fmt.Sprintf("%06d", n)
|
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
|
||||||
|
}
|
||||||
|
|||||||
@ -3136,6 +3136,7 @@ func ReqPlayroomInfo(player *Player, buf []byte) error {
|
|||||||
RandList = append(RandList, v)
|
RandList = append(RandList, v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
RandList = GoUtil.UniqueInts(RandList)
|
||||||
if len(RandList) == 0 {
|
if len(RandList) == 0 {
|
||||||
PlayroomMod.SetGameReward(0, 0, Star)
|
PlayroomMod.SetGameReward(0, 0, Star)
|
||||||
} else if len(RandList) == 1 {
|
} else if len(RandList) == 1 {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user