Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
b11fb0b493
@ -184,7 +184,7 @@
|
|||||||
"main": [
|
"main": [
|
||||||
{
|
{
|
||||||
"key": 1,
|
"key": 1,
|
||||||
"param": 3
|
"param": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"optional": "",
|
"optional": "",
|
||||||
@ -844,7 +844,7 @@
|
|||||||
"main": [
|
"main": [
|
||||||
{
|
{
|
||||||
"key": 1,
|
"key": 1,
|
||||||
"param": 30
|
"param": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"optional": "",
|
"optional": "",
|
||||||
@ -976,7 +976,7 @@
|
|||||||
"main": [
|
"main": [
|
||||||
{
|
{
|
||||||
"key": 1,
|
"key": 1,
|
||||||
"param": 30
|
"param": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"optional": "",
|
"optional": "",
|
||||||
|
@ -77,7 +77,7 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
|
|||||||
defer this.hlock.Unlock()
|
defer this.hlock.Unlock()
|
||||||
if _configure, ok := v.(*cfg.GameHeroAwaken); ok {
|
if _configure, ok := v.(*cfg.GameHeroAwaken); ok {
|
||||||
for _, v := range _configure.GetDataList() {
|
for _, v := range _configure.GetDataList() {
|
||||||
this.awakenMap[utils.ToInt64(v.Hid)+int64(v.Phase<<31)] = v
|
this.awakenMap[utils.ToInt64(v.Hid)+int64(v.Phase)<<31] = v
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -94,7 +94,9 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
|
|||||||
this.hlock.Lock()
|
this.hlock.Lock()
|
||||||
defer this.hlock.Unlock()
|
defer this.hlock.Unlock()
|
||||||
for _, v := range _configure.GetDataList() {
|
for _, v := range _configure.GetDataList() {
|
||||||
this.starMap[utils.ToInt64(v.Id)+int64(v.Star<<31)] = v
|
key := utils.ToInt64(v.Id)
|
||||||
|
key += int64(v.Star) << 31
|
||||||
|
this.starMap[key] = v
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
@ -109,14 +111,15 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
|
|||||||
|
|
||||||
// 获取英雄升星相关配置数据
|
// 获取英雄升星相关配置数据
|
||||||
func (this *configureComp) GetHeroStarupConfig(hid string, star int32) *cfg.GameHeroStarupData {
|
func (this *configureComp) GetHeroStarupConfig(hid string, star int32) *cfg.GameHeroStarupData {
|
||||||
return this.starMap[utils.ToInt64(hid)+int64(star<<31)]
|
return this.starMap[utils.ToInt64(hid)+int64(star)<<31]
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取当前英雄最高星级
|
// 获取当前英雄最高星级
|
||||||
func (this *configureComp) GetHeroMaxStar(hid string, curStar int32) int32 {
|
func (this *configureComp) GetHeroMaxStar(hid string, curStar int32) int32 {
|
||||||
var star int32
|
var star int32
|
||||||
for star = curStar; star < 100; star++ {
|
for star = curStar; star < 100; star++ {
|
||||||
if _, ok := this.starMap[utils.ToInt64(hid)+int64((star+1)<<31)]; !ok {
|
if v, ok := this.starMap[utils.ToInt64(hid)+int64(star+1)<<31]; !ok {
|
||||||
|
this.module.Debugf("%v", v)
|
||||||
return star
|
return star
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -125,7 +128,7 @@ func (this *configureComp) GetHeroMaxStar(hid string, curStar int32) int32 {
|
|||||||
|
|
||||||
// 获取觉醒配置
|
// 获取觉醒配置
|
||||||
func (this *configureComp) GetHeroAwakenConfig(hid string, phase int32) *cfg.GameHeroAwakenData {
|
func (this *configureComp) GetHeroAwakenConfig(hid string, phase int32) *cfg.GameHeroAwakenData {
|
||||||
return this.awakenMap[utils.ToInt64(hid)+int64(phase<<31)]
|
return this.awakenMap[utils.ToInt64(hid)+int64(phase)<<31]
|
||||||
}
|
}
|
||||||
|
|
||||||
// 抽卡配置表
|
// 抽卡配置表
|
||||||
|
@ -58,7 +58,6 @@ func (this *apiComp) ForgeEquip(session comm.IUserSession, req *pb.SmithyForgeEq
|
|||||||
Value: 0,
|
Value: 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 是否是精益打造
|
// 是否是精益打造
|
||||||
if req.Quality > 0 {
|
if req.Quality > 0 {
|
||||||
costRes = append(costRes, reelcfg.RefineCos)
|
costRes = append(costRes, reelcfg.RefineCos)
|
||||||
@ -129,30 +128,36 @@ func (this *apiComp) ForgeEquip(session comm.IUserSession, req *pb.SmithyForgeEq
|
|||||||
v.N = 0
|
v.N = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if code = this.module.CheckRes(session, costRes); code != pb.ErrorCode_Success {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if code = this.module.ConsumeRes(session, costRes, true); code != pb.ErrorCode_Success {
|
if code = this.module.ConsumeRes(session, costRes, true); code != pb.ErrorCode_Success {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 装备资源分发
|
// 装备资源分发
|
||||||
if customLv > 0 { //
|
if customLv > 0 {
|
||||||
|
|
||||||
sz := make([]int32, 4) // 最高 4个品质
|
sz := make([]int32, 4) // 最高 4个品质
|
||||||
// 获得极品权重
|
// 获得极品权重
|
||||||
sz[3] = this.module.modelStove.StoveToolsQualityProbability(stove)
|
sz[3] = this.module.modelStove.StoveToolsQualityProbability(stove)
|
||||||
if equip, code1 := this.module.ModuleEquipment.GetForgeEquip(session, req.SuiteId, req.Position, customLv, sz); code1 == pb.ErrorCode_Success {
|
if equip, code1 := this.module.ModuleEquipment.GetForgeEquip(session, req.SuiteId, req.Position, customLv, sz); code1 != pb.ErrorCode_Success {
|
||||||
rsp.Equip = append(rsp.Equip, equip)
|
|
||||||
} else {
|
|
||||||
code = code1
|
code = code1
|
||||||
return
|
return
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
|
rsp.Equip = append(rsp.Equip, equip)
|
||||||
|
}
|
||||||
|
} else { // 普通打造
|
||||||
// 获取掉落id
|
// 获取掉落id
|
||||||
newdrop := this.module.modelStove.CheckUnlockSuid(req.ReelId, stove.Data[req.ReelId].Lv, reelcfg.BasicDrop)
|
newdrop := this.module.modelStove.CheckUnlockSuid(req.ReelId, stove.Data[req.ReelId].Lv, reelcfg.BasicDrop)
|
||||||
res := this.module.configure.GetDropReward(newdrop)
|
res := this.module.configure.GetDropReward(newdrop)
|
||||||
|
// 检查是否命中双倍打造
|
||||||
|
if ok := this.module.modelStove.CheckForgetwoEquip(req.ReelId, stove.Data[req.ReelId].Lv); ok {
|
||||||
|
if err, atno := this.module.DispenseAtno(session, res, true); err == pb.ErrorCode_Success {
|
||||||
|
for _, v := range atno {
|
||||||
|
if eq, err1 := this.module.ModuleEquipment.QueryEquipment(session.GetUserId(), v.O); err1 == pb.ErrorCode_Success {
|
||||||
|
rsp.Equip = append(rsp.Equip, eq)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if err, atno := this.module.DispenseAtno(session, res, true); err == pb.ErrorCode_Success {
|
if err, atno := this.module.DispenseAtno(session, res, true); err == pb.ErrorCode_Success {
|
||||||
for _, v := range atno {
|
for _, v := range atno {
|
||||||
if eq, err1 := this.module.ModuleEquipment.QueryEquipment(session.GetUserId(), v.O); err1 == pb.ErrorCode_Success {
|
if eq, err1 := this.module.ModuleEquipment.QueryEquipment(session.GetUserId(), v.O); err1 == pb.ErrorCode_Success {
|
||||||
@ -191,9 +196,10 @@ func (this *apiComp) ForgeEquip(session comm.IUserSession, req *pb.SmithyForgeEq
|
|||||||
if nextProficiency.Type == comm.SmithyReelType4 {
|
if nextProficiency.Type == comm.SmithyReelType4 {
|
||||||
if rst, err := this.module.ModuleUser.GetUserExpand(session.GetUserId()); err == nil {
|
if rst, err := this.module.ModuleUser.GetUserExpand(session.GetUserId()); err == nil {
|
||||||
rst.SuiteId = append(rst.SuiteId, nextProficiency.Value1)
|
rst.SuiteId = append(rst.SuiteId, nextProficiency.Value1)
|
||||||
update := make(map[string]interface{}, 0)
|
|
||||||
update["suiteId"] = rst.SuiteId
|
this.module.ModuleUser.ChangeUserExpand(session.GetUserId(), map[string]interface{}{
|
||||||
this.module.ModuleUser.ChangeUserExpand(session.GetUserId(), update)
|
"suiteId": rst.SuiteId,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,9 +15,7 @@ func (this *apiComp) GetListCheck(session comm.IUserSession, req *pb.SmithyGetLi
|
|||||||
|
|
||||||
///获取美食城基本信息
|
///获取美食城基本信息
|
||||||
func (this *apiComp) GetList(session comm.IUserSession, req *pb.SmithyGetListReq) (code pb.ErrorCode, data proto.Message) {
|
func (this *apiComp) GetList(session comm.IUserSession, req *pb.SmithyGetListReq) (code pb.ErrorCode, data proto.Message) {
|
||||||
// this.module.modelAtlas.CheckActivateAtlas(session.GetUserId(), "10110", 1, 1, 1)
|
|
||||||
|
|
||||||
// this.AtlasList(session, &pb.SmithyAtlasListReq{})
|
|
||||||
code = this.GetListCheck(session, req)
|
code = this.GetListCheck(session, req)
|
||||||
if code != pb.ErrorCode_Success {
|
if code != pb.ErrorCode_Success {
|
||||||
return // 参数校验失败直接返回
|
return // 参数校验失败直接返回
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
|
|
||||||
//参数校验
|
//参数校验
|
||||||
func (this *apiComp) RiseCheck(session comm.IUserSession, req *pb.SmithyRiseReq) (code pb.ErrorCode) {
|
func (this *apiComp) RiseCheck(session comm.IUserSession, req *pb.SmithyRiseReq) (code pb.ErrorCode) {
|
||||||
if req.ItemId != "" && req.Count < 0 {
|
if req.ItemId == "" || req.Count <= 0 {
|
||||||
code = pb.ErrorCode_ReqParameterError
|
code = pb.ErrorCode_ReqParameterError
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -9,7 +9,6 @@ import (
|
|||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
"go_dreamfactory/sys/configure"
|
"go_dreamfactory/sys/configure"
|
||||||
cfg "go_dreamfactory/sys/configure/structs"
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
"math"
|
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
||||||
"strconv"
|
"strconv"
|
||||||
@ -81,7 +80,7 @@ func (this *modelStove) CheckTemperature(reelId int32, lv int32) (t int32) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查额外概率制造两件装备
|
// 限定 普通打造的时候检查额外概率制造两件装备
|
||||||
func (this *modelStove) CheckForgetwoEquip(reelId int32, lv int32) (b bool) {
|
func (this *modelStove) CheckForgetwoEquip(reelId int32, lv int32) (b bool) {
|
||||||
var (
|
var (
|
||||||
index int32
|
index int32
|
||||||
@ -95,7 +94,7 @@ func (this *modelStove) CheckForgetwoEquip(reelId int32, lv int32) (b bool) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if value > 0 {
|
if value > 0 {
|
||||||
n, _ := rand.Int(rand.Reader, big.NewInt(100))
|
n, _ := rand.Int(rand.Reader, big.NewInt(1000)) // 千分比
|
||||||
|
|
||||||
if value < int32(n.Int64()) {
|
if value < int32(n.Int64()) {
|
||||||
return true
|
return true
|
||||||
@ -212,22 +211,19 @@ func (this *modelStove) GetRandEquipLv(sz []int32) int32 {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 解析掉落id
|
||||||
func (this *modelStove) CheckUnlockSuid(reelId, lv, dropid int32) int32 {
|
func (this *modelStove) CheckUnlockSuid(reelId, lv, dropid int32) int32 {
|
||||||
var index int32
|
var index int32
|
||||||
var szDrop []int32
|
|
||||||
var szLen int32
|
|
||||||
for index = 1; index <= lv; index++ {
|
for index = 1; index <= lv; index++ {
|
||||||
if conf := this.module.configure.GetSmithyProficileData(reelId, index); conf != nil {
|
if conf := this.module.configure.GetSmithyProficileData(reelId, index); conf != nil {
|
||||||
if conf.Type == comm.SmithyReelType4 && conf.Value1 != 0 {
|
if conf.Type == comm.SmithyReelType4 && conf.Value1 != 0 {
|
||||||
szDrop = append(szDrop, conf.Value1)
|
dropid *= 100
|
||||||
|
dropid += conf.Value1
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
szLen = int32(len(szDrop))
|
|
||||||
dropid *= int32(math.Pow(10, float64(szLen)))
|
|
||||||
for pos, v := range szDrop {
|
|
||||||
dropid += v * int32(math.Pow(10, float64(pos)))
|
|
||||||
}
|
|
||||||
return dropid
|
return dropid
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,9 +90,8 @@ func ToInt32(s string) int32 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ToInt64(s string) int64 {
|
func ToInt64(s string) int64 {
|
||||||
if j, err := strconv.ParseInt(s, 10, 32); err != nil {
|
if bint, err := strconv.ParseInt(s, 10, 32); err == nil {
|
||||||
|
return bint
|
||||||
|
}
|
||||||
return 0
|
return 0
|
||||||
} else {
|
|
||||||
return int64(j)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user