英雄合成功能配置类型修改

This commit is contained in:
meixiongfeng 2022-10-17 14:16:02 +08:00
parent 61b35955c8
commit 9875ed8a2f
3 changed files with 34 additions and 35 deletions

View File

@ -2,12 +2,12 @@
{ {
"id": 1, "id": 1,
"switch": 1, "switch": 1,
"hero": 14007, "hero": "14007",
"pointhero": [ "pointhero": [
35001, "35001",
35001, "35001",
35001, "35001",
35001 "35001"
], ],
"awaken": -1, "awaken": -1,
"start": -1 "start": -1
@ -15,12 +15,12 @@
{ {
"id": 2, "id": 2,
"switch": 1, "switch": 1,
"hero": 35001, "hero": "35001",
"pointhero": [ "pointhero": [
25001, "25001",
25001, "25001",
25001, "25001",
25001 "25001"
], ],
"awaken": -1, "awaken": -1,
"start": -1 "start": -1
@ -28,12 +28,12 @@
{ {
"id": 3, "id": 3,
"switch": 1, "switch": 1,
"hero": 25001, "hero": "25001",
"pointhero": [ "pointhero": [
25004, "25004",
25004, "25004",
25004, "25004",
25004 "25004"
], ],
"awaken": -1, "awaken": -1,
"start": -1 "start": -1
@ -41,12 +41,12 @@
{ {
"id": 4, "id": 4,
"switch": 1, "switch": 1,
"hero": 25004, "hero": "25004",
"pointhero": [ "pointhero": [
44005, "44005",
44005, "44005",
44005, "44005",
44005 "44005"
], ],
"awaken": -1, "awaken": -1,
"start": -1 "start": -1
@ -54,12 +54,12 @@
{ {
"id": 5, "id": 5,
"switch": 1, "switch": 1,
"hero": 45003, "hero": "45003",
"pointhero": [ "pointhero": [
44005, "44005",
44005, "44005",
44005, "44005",
44005 "44005"
], ],
"awaken": -1, "awaken": -1,
"start": -1 "start": -1

View File

@ -3,7 +3,6 @@ package hero
import ( import (
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/pb" "go_dreamfactory/pb"
"strconv"
"google.golang.org/protobuf/proto" "google.golang.org/protobuf/proto"
) )
@ -51,8 +50,8 @@ func (this *apiComp) Fusion(session comm.IUserSession, req *pb.HeroFusionReq) (c
_costMaphero[k] = _obj _costMaphero[k] = _obj
} }
for _, v := range conf.Pointhero { for _, v := range conf.Pointhero {
if v1, ok := mapHero[strconv.Itoa(int(v))]; !ok { if _, ok := mapHero[v]; !ok {
v1 -= v mapHero[v] -= 1
} else { } else {
code = pb.ErrorCode_ReqParameterError code = pb.ErrorCode_ReqParameterError
return return
@ -72,7 +71,7 @@ func (this *apiComp) Fusion(session comm.IUserSession, req *pb.HeroFusionReq) (c
ChangeList = append(ChangeList, _costMaphero[k]) ChangeList = append(ChangeList, _costMaphero[k])
} }
// 获得新卡 // 获得新卡
newHero, err := this.module.modelHero.createHeroOverlying(session.GetUserId(), strconv.Itoa(int(conf.Hero)), 1) newHero, err := this.module.modelHero.createHeroOverlying(session.GetUserId(), conf.Hero, 1)
if err != nil { if err != nil {
ChangeList = append(ChangeList, newHero) ChangeList = append(ChangeList, newHero)
} }

View File

@ -13,8 +13,8 @@ import "errors"
type GameHerofusionData struct { type GameHerofusionData struct {
Id int32 Id int32
Switch int32 Switch int32
Hero int32 Hero string
Pointhero []int32 Pointhero []string
Awaken int32 Awaken int32
Start int32 Start int32
} }
@ -28,17 +28,17 @@ func (*GameHerofusionData) GetTypeId() int32 {
func (_v *GameHerofusionData)Deserialize(_buf map[string]interface{}) (err error) { func (_v *GameHerofusionData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["switch"].(float64); !_ok_ { err = errors.New("switch error"); return }; _v.Switch = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["switch"].(float64); !_ok_ { err = errors.New("switch error"); return }; _v.Switch = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["hero"].(float64); !_ok_ { err = errors.New("hero error"); return }; _v.Hero = int32(_tempNum_) } { var _ok_ bool; if _v.Hero, _ok_ = _buf["hero"].(string); !_ok_ { err = errors.New("hero error"); return } }
{ {
var _arr_ []interface{} var _arr_ []interface{}
var _ok_ bool var _ok_ bool
if _arr_, _ok_ = _buf["pointhero"].([]interface{}); !_ok_ { err = errors.New("pointhero error"); return } if _arr_, _ok_ = _buf["pointhero"].([]interface{}); !_ok_ { err = errors.New("pointhero error"); return }
_v.Pointhero = make([]int32, 0, len(_arr_)) _v.Pointhero = make([]string, 0, len(_arr_))
for _, _e_ := range _arr_ { for _, _e_ := range _arr_ {
var _list_v_ int32 var _list_v_ string
{ var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) } { if _list_v_, _ok_ = _e_.(string); !_ok_ { err = errors.New("_list_v_ error"); return } }
_v.Pointhero = append(_v.Pointhero, _list_v_) _v.Pointhero = append(_v.Pointhero, _list_v_)
} }
} }