refactor(socket): 移除重复保存锁并优化panic错误处理 移除了ServerEvent.go中的sync.Once保存锁,因为可能存在重复保存问题, 同时将panic错误处理从fmt.Println改为使用cool.Logger.Error进行统一日志记录 feat(player): 优化踢人功能并添加超时机制 移除kick.go中的复杂异步超时逻辑
This commit is contained in:
@@ -54,26 +54,20 @@ func (s *PetFusionMaterialService) Data(Material1 [4]uint32) int32 {
|
||||
"is_enable": 1,
|
||||
}
|
||||
m.Where(condition).Scan(&effect)
|
||||
//这时候有可能效果是空的,那么这时候就再次查询默认的特性,保证每次必会生成一个数据库有的特性
|
||||
//也许这个时候的特性配方就是随机从数据库中查找一个特性
|
||||
if effect != nil {
|
||||
|
||||
// if effect == nil {
|
||||
// effect2s := service.NewDictInfoService().GetData("effect")
|
||||
// for _, v := range effect2s {
|
||||
// return gconv.Uint32(v.Value)
|
||||
// }
|
||||
|
||||
// }
|
||||
r := grand.Intn(4)
|
||||
switch r {
|
||||
case 0:
|
||||
return int32(effect.Trait1Idx)
|
||||
case 1:
|
||||
return int32(effect.Trait2Idx)
|
||||
case 2:
|
||||
return int32(effect.Trait3Idx)
|
||||
case 3:
|
||||
return int32(effect.Trait4Idx)
|
||||
r := grand.Intn(4)
|
||||
switch r {
|
||||
case 0:
|
||||
return int32(effect.Trait1Idx)
|
||||
case 1:
|
||||
return int32(effect.Trait2Idx)
|
||||
case 2:
|
||||
return int32(effect.Trait3Idx)
|
||||
case 3:
|
||||
return int32(effect.Trait4Idx)
|
||||
}
|
||||
}
|
||||
|
||||
return -1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user