锦标赛排行榜中机器人的头像框改成初始的
This commit is contained in:
parent
ce5c64f789
commit
a882a010d3
@ -1,6 +1,7 @@
|
||||
package avatarCfg
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
"server/gamedata"
|
||||
"server/pkg/github.com/name5566/leaf/log"
|
||||
"strconv"
|
||||
@ -31,6 +32,15 @@ func GetInitList() []int {
|
||||
return r
|
||||
}
|
||||
|
||||
func GetRandInitId() int {
|
||||
list := GetInitList()
|
||||
if len(list) == 0 {
|
||||
return 0
|
||||
}
|
||||
index := rand.Intn(len(list))
|
||||
return list[index]
|
||||
}
|
||||
|
||||
func CheckExist(Id int) bool {
|
||||
data, err := gamedata.GetData(CFG_AVATAR)
|
||||
if err != nil {
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package faceCfg
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
"server/gamedata"
|
||||
"server/pkg/github.com/name5566/leaf/log"
|
||||
"strconv"
|
||||
@ -35,6 +36,15 @@ func GetInitList() []int {
|
||||
return r
|
||||
}
|
||||
|
||||
func GetRandInitId() int {
|
||||
list := GetInitList()
|
||||
if len(list) == 0 {
|
||||
return 0
|
||||
}
|
||||
index := rand.Intn(len(list))
|
||||
return list[index]
|
||||
}
|
||||
|
||||
func CheckExist(Id int) bool {
|
||||
data, err := gamedata.GetData(CFG_FACE)
|
||||
if err != nil {
|
||||
|
||||
@ -3,7 +3,9 @@ package game
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
avatarCfg "server/conf/avatar"
|
||||
champshipCfg "server/conf/champship"
|
||||
faceCfg "server/conf/face"
|
||||
randnameCfg "server/conf/randname"
|
||||
"server/db"
|
||||
"server/game/mod/msg"
|
||||
@ -842,8 +844,8 @@ func CreateRobot(M float64, GroupId int) *ChampshipRobot {
|
||||
Max: M / 10,
|
||||
Type: Type,
|
||||
Name: randnameCfg.GetRandName(),
|
||||
Avatar: GoUtil.RandNum(1, 10),
|
||||
Face: GoUtil.RandNum(1, 10),
|
||||
Avatar: avatarCfg.GetRandInitId(),
|
||||
Face: faceCfg.GetRandInitId(),
|
||||
Level: GoUtil.RandNum(1, 10),
|
||||
GroupId: GroupId,
|
||||
Time: GoUtil.Now(),
|
||||
|
||||
@ -3,7 +3,9 @@ package test
|
||||
import (
|
||||
"fmt"
|
||||
"server/backend"
|
||||
avatarCfg "server/conf/avatar"
|
||||
decorateCfg "server/conf/decorate"
|
||||
faceCfg "server/conf/face"
|
||||
languageCfg "server/conf/language"
|
||||
notification_cfg "server/conf/notification"
|
||||
"server/db"
|
||||
@ -256,3 +258,9 @@ func TestMsgFormat(t *testing.T) {
|
||||
}
|
||||
fmt.Printf("Msg: %v\n", m)
|
||||
}
|
||||
|
||||
func TestRandFace(t *testing.T) {
|
||||
face := faceCfg.GetRandInitId()
|
||||
avatar := avatarCfg.GetRandInitId()
|
||||
fmt.Printf("Random Face ID: %d, Random Avatar ID: %d\n", face, avatar)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user