Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
c97e2745ad
@ -1,6 +1,7 @@
|
|||||||
package equipment
|
package equipment
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"crypto/rand"
|
||||||
"fmt"
|
"fmt"
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
@ -10,8 +11,7 @@ import (
|
|||||||
cfg "go_dreamfactory/sys/configure/structs"
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
"go_dreamfactory/sys/db"
|
"go_dreamfactory/sys/db"
|
||||||
"math"
|
"math"
|
||||||
"math/rand"
|
"math/big"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/go-redis/redis/v8"
|
"github.com/go-redis/redis/v8"
|
||||||
)
|
)
|
||||||
@ -589,8 +589,8 @@ func (this *Equipment) GetForgeEquip(session comm.IUserSession, num int32, suite
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if pos == -1 {
|
if pos == -1 {
|
||||||
|
|
||||||
lvs = make([]*cfg.GameEquipData, 0)
|
lvs = make([]*cfg.GameEquipData, 0)
|
||||||
for _, v := range configures {
|
for _, v := range configures {
|
||||||
if v.Color == lv {
|
if v.Color == lv {
|
||||||
@ -622,22 +622,19 @@ func (this *Equipment) GetForgeEquip(session comm.IUserSession, num int32, suite
|
|||||||
eruips = make([]*pb.DB_Equipment, num)
|
eruips = make([]*pb.DB_Equipment, num)
|
||||||
for i := 0; i < int(num); i++ {
|
for i := 0; i < int(num); i++ {
|
||||||
if pos != -1 {
|
if pos != -1 {
|
||||||
for _, v := range configures {
|
if eruips[i], err = this.modelEquipment.newEquipment(session.GetUserId(), configure, dyweight, isepic); err != nil {
|
||||||
if v.Pos == pos && v.Color == lv {
|
this.Errorf("err%v", err)
|
||||||
if eruips[i], err = this.modelEquipment.newEquipment(session.GetUserId(), v, dyweight, isepic); err != nil {
|
errdata = &pb.ErrorData{
|
||||||
this.Errorf("err%v", err)
|
Code: pb.ErrorCode_SystemError,
|
||||||
errdata = &pb.ErrorData{
|
Title: pb.ErrorCode_SystemError.ToString(),
|
||||||
Code: pb.ErrorCode_SystemError,
|
Message: err.Error(),
|
||||||
Title: pb.ErrorCode_SystemError.ToString(),
|
|
||||||
Message: err.Error(),
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
r := rand.New(rand.NewSource(time.Now().Unix()))
|
n, _ := rand.Int(rand.Reader, big.NewInt(int64(len(lvs))))
|
||||||
index := r.Perm(len(lvs))[0]
|
index := n.Int64()
|
||||||
if eruips[i], err = this.modelEquipment.newEquipment(session.GetUserId(), lvs[index], dyweight, isepic); err != nil {
|
if eruips[i], err = this.modelEquipment.newEquipment(session.GetUserId(), lvs[index], dyweight, isepic); err != nil {
|
||||||
this.Errorf("err%v", err)
|
this.Errorf("err%v", err)
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
|
Loading…
Reference in New Issue
Block a user