随机机器人皮肤
This commit is contained in:
parent
61b78ce88a
commit
33c3e14e8b
|
@ -824,3 +824,16 @@ const (
|
|||
SkillIdTask = 30005 // 每日任务金币奖励提升百分比
|
||||
SkillIdDiamondLottery = 30007 // 每次钻石抽奖幸运值提升百分比
|
||||
)
|
||||
|
||||
var (
|
||||
SkinRandom = []int32{300001, 300002, 300007, 300006, 300005, 300004, 300003}
|
||||
SkinWeightMap = map[int32]int{
|
||||
300001: 20,
|
||||
300002: 40,
|
||||
300007: 40,
|
||||
300006: 50,
|
||||
300005: 40,
|
||||
300004: 60,
|
||||
300003: 70,
|
||||
}
|
||||
)
|
||||
|
|
|
@ -3174,6 +3174,41 @@ func (this *Player) RobRandVip() {
|
|||
this.Head = rand.Int31n(common.HeadRange)
|
||||
//0:男 1:女
|
||||
this.Sex = (this.Head%2 + 1) % 2
|
||||
// 随机皮肤
|
||||
skinFunc := func(i int) {
|
||||
total := 0
|
||||
for _, v := range common.SkinRandom[:i] {
|
||||
total += common.SkinWeightMap[v]
|
||||
}
|
||||
r := common.RandInt(total)
|
||||
n := common.SkinWeightMap[common.SkinRandom[0]]
|
||||
for k, v := range common.SkinRandom[:i] {
|
||||
if r < n {
|
||||
this.Skin.ModId = v
|
||||
if this.Skin.ModUnlock[v] == 0 {
|
||||
this.Skin.ModUnlock[v] = 1
|
||||
if this.Skin.Mod[v] == nil {
|
||||
this.Skin.Mod[v] = &model.ModEx{}
|
||||
}
|
||||
this.Skin.Mod[v].Ts = time.Now().Unix()
|
||||
}
|
||||
break
|
||||
}
|
||||
if k+1 < len(common.SkinRandom) {
|
||||
n += common.SkinWeightMap[common.SkinRandom[k+1]]
|
||||
}
|
||||
}
|
||||
}
|
||||
switch {
|
||||
case this.VIP >= 1:
|
||||
skinFunc(5)
|
||||
case this.VIP >= 2:
|
||||
skinFunc(6)
|
||||
case this.VIP >= 5:
|
||||
skinFunc(7)
|
||||
default:
|
||||
skinFunc(4)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue