上传装备道具接口优化 移除调用源对象
This commit is contained in:
parent
b46952cebd
commit
929c00c967
@ -20,6 +20,12 @@
|
||||
10002,
|
||||
10003,
|
||||
10004
|
||||
],
|
||||
"probability": [
|
||||
10001,
|
||||
10002,
|
||||
10003,
|
||||
10004
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -43,6 +49,12 @@
|
||||
10002,
|
||||
10003,
|
||||
10004
|
||||
],
|
||||
"probability": [
|
||||
10001,
|
||||
10002,
|
||||
10003,
|
||||
10004
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -66,6 +78,12 @@
|
||||
10002,
|
||||
10003,
|
||||
10004
|
||||
],
|
||||
"probability": [
|
||||
10001,
|
||||
10002,
|
||||
10003,
|
||||
10004
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -89,6 +107,12 @@
|
||||
10002,
|
||||
10003,
|
||||
10004
|
||||
],
|
||||
"probability": [
|
||||
10001,
|
||||
10002,
|
||||
10003,
|
||||
10004
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -112,6 +136,12 @@
|
||||
10002,
|
||||
10003,
|
||||
10004
|
||||
],
|
||||
"probability": [
|
||||
10001,
|
||||
10002,
|
||||
10003,
|
||||
10004
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -135,6 +165,12 @@
|
||||
10002,
|
||||
10003,
|
||||
10004
|
||||
],
|
||||
"probability": [
|
||||
10001,
|
||||
10002,
|
||||
10003,
|
||||
10004
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -158,6 +194,12 @@
|
||||
10002,
|
||||
10003,
|
||||
10004
|
||||
],
|
||||
"probability": [
|
||||
10001,
|
||||
10002,
|
||||
10003,
|
||||
10004
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -181,6 +223,12 @@
|
||||
10002,
|
||||
10003,
|
||||
10004
|
||||
],
|
||||
"probability": [
|
||||
10001,
|
||||
10002,
|
||||
10003,
|
||||
10004
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -204,6 +252,12 @@
|
||||
10002,
|
||||
10003,
|
||||
10004
|
||||
],
|
||||
"probability": [
|
||||
10001,
|
||||
10002,
|
||||
10003,
|
||||
10004
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -227,6 +281,12 @@
|
||||
10002,
|
||||
10003,
|
||||
10004
|
||||
],
|
||||
"probability": [
|
||||
10001,
|
||||
10002,
|
||||
10003,
|
||||
10004
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -250,6 +310,12 @@
|
||||
10002,
|
||||
10003,
|
||||
10004
|
||||
],
|
||||
"probability": [
|
||||
10001,
|
||||
10002,
|
||||
10003,
|
||||
10004
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -273,6 +339,12 @@
|
||||
10002,
|
||||
10003,
|
||||
10004
|
||||
],
|
||||
"probability": [
|
||||
10001,
|
||||
10002,
|
||||
10003,
|
||||
10004
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -296,6 +368,12 @@
|
||||
10002,
|
||||
10003,
|
||||
10004
|
||||
],
|
||||
"probability": [
|
||||
10001,
|
||||
10002,
|
||||
10003,
|
||||
10004
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -319,6 +397,12 @@
|
||||
10002,
|
||||
10003,
|
||||
10004
|
||||
],
|
||||
"probability": [
|
||||
10001,
|
||||
10002,
|
||||
10003,
|
||||
10004
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -342,6 +426,12 @@
|
||||
10002,
|
||||
10003,
|
||||
10004
|
||||
],
|
||||
"probability": [
|
||||
10001,
|
||||
10002,
|
||||
10003,
|
||||
10004
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -365,6 +455,12 @@
|
||||
10002,
|
||||
10003,
|
||||
10004
|
||||
],
|
||||
"probability": [
|
||||
10001,
|
||||
10002,
|
||||
10003,
|
||||
10004
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -388,6 +484,12 @@
|
||||
10002,
|
||||
10003,
|
||||
10004
|
||||
],
|
||||
"probability": [
|
||||
10001,
|
||||
10002,
|
||||
10003,
|
||||
10004
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -411,6 +513,12 @@
|
||||
10002,
|
||||
10003,
|
||||
10004
|
||||
],
|
||||
"probability": [
|
||||
10001,
|
||||
10002,
|
||||
10003,
|
||||
10004
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -434,6 +542,12 @@
|
||||
10002,
|
||||
10003,
|
||||
10004
|
||||
],
|
||||
"probability": [
|
||||
10001,
|
||||
10002,
|
||||
10003,
|
||||
10004
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -457,6 +571,12 @@
|
||||
10002,
|
||||
10003,
|
||||
10004
|
||||
],
|
||||
"probability": [
|
||||
10001,
|
||||
10002,
|
||||
10003,
|
||||
10004
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -480,6 +600,12 @@
|
||||
10002,
|
||||
10003,
|
||||
10004
|
||||
],
|
||||
"probability": [
|
||||
10001,
|
||||
10002,
|
||||
10003,
|
||||
10004
|
||||
]
|
||||
}
|
||||
]
|
@ -9,12 +9,6 @@ import (
|
||||
*/
|
||||
|
||||
type (
|
||||
ModuleCallSource struct {
|
||||
Module string //来源模块
|
||||
FuncName string //来源方法
|
||||
Describe string //调用描述
|
||||
}
|
||||
|
||||
ISys interface {
|
||||
IsAccess(funcName string, userLv int32) bool
|
||||
}
|
||||
@ -26,13 +20,13 @@ type (
|
||||
//道具背包接口
|
||||
IItems interface {
|
||||
//查询用户背包物品数量
|
||||
QueryItemAmount(source *ModuleCallSource, uId string, itemid string) (amount uint32)
|
||||
QueryItemAmount(uId string, itemid string) (amount uint32)
|
||||
//查询用户背包多个物品数量
|
||||
QueryItemsAmount(source *ModuleCallSource, uId string, itemid ...string) (result map[string]uint32)
|
||||
QueryItemsAmount(uId string, itemid ...string) (result map[string]uint32)
|
||||
///添加单个物品到背包 (可以加物品和减物品)
|
||||
AddItem(source *ModuleCallSource, session IUserSession, itemid string, addnum int32, bPush bool) (code pb.ErrorCode)
|
||||
AddItem(session IUserSession, itemid string, addnum int32, bPush bool) (code pb.ErrorCode)
|
||||
///添加多个物品到背包 (可以加物品和减物品)
|
||||
AddItems(source *ModuleCallSource, session IUserSession, items map[string]int32, bPush bool) (code pb.ErrorCode)
|
||||
AddItems(session IUserSession, items map[string]int32, bPush bool) (code pb.ErrorCode)
|
||||
}
|
||||
|
||||
//英雄
|
||||
@ -103,11 +97,11 @@ type (
|
||||
//武器模块
|
||||
IEquipment interface {
|
||||
//查询服务资源数量 db id
|
||||
QueryEquipment(source *ModuleCallSource, uid string, Id string) (equipment *pb.DB_Equipment, code pb.ErrorCode)
|
||||
QueryEquipment(uid string, Id string) (equipment *pb.DB_Equipment, code pb.ErrorCode)
|
||||
//查询服务资源数量 参数武器配置id
|
||||
QueryEquipmentAmount(source *ModuleCallSource, uid string, equipmentId string) (amount uint32)
|
||||
QueryEquipmentAmount(uid string, equipmentId string) (amount uint32)
|
||||
//添加新武器
|
||||
AddNewEquipments(source *ModuleCallSource, session IUserSession, cIds map[string]uint32, bPush bool) (code pb.ErrorCode)
|
||||
AddNewEquipments(session IUserSession, cIds map[string]uint32, bPush bool) (code pb.ErrorCode)
|
||||
}
|
||||
IMainline interface {
|
||||
// 修改章节信息
|
||||
|
@ -19,9 +19,10 @@ func (this *apiComp) ForgCheck(session comm.IUserSession, req *pb.EquipmentForgR
|
||||
//锻造
|
||||
func (this *apiComp) Forg(session comm.IUserSession, req *pb.EquipmentForgReq) (code pb.ErrorCode, data proto.Message) {
|
||||
var (
|
||||
conf *cfg.GameEquipComposeData
|
||||
need []*cfg.Gameatn
|
||||
err error
|
||||
conf *cfg.GameEquipComposeData
|
||||
need []*cfg.Gameatn
|
||||
equis map[string]uint32
|
||||
err error
|
||||
)
|
||||
if code = this.ForgCheck(session, req); code != pb.ErrorCode_Success {
|
||||
return
|
||||
@ -31,6 +32,7 @@ func (this *apiComp) Forg(session comm.IUserSession, req *pb.EquipmentForgReq) (
|
||||
return
|
||||
}
|
||||
need = make([]*cfg.Gameatn, len(conf.Need))
|
||||
equis = map[string]uint32{}
|
||||
for n := int32(0); n < req.Num; n++ {
|
||||
for i, v := range conf.Need {
|
||||
if need[i] == nil {
|
||||
@ -43,11 +45,16 @@ func (this *apiComp) Forg(session comm.IUserSession, req *pb.EquipmentForgReq) (
|
||||
need[i].N += v.N
|
||||
}
|
||||
}
|
||||
index := comm.GetRandW(conf.Probability)
|
||||
equis[string(conf.Equip[index])]++
|
||||
}
|
||||
if code = this.module.ConsumeRes(session, need, true); code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
if code = this.module.AddNewEquipments(session, equis, true); code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
|
||||
session.SendMsg(string(this.module.GetType()), "forg", &pb.EquipmentForgResp{Issucc: true})
|
||||
return
|
||||
|
@ -70,7 +70,7 @@ func (this *Equipment) EventUserOffline(session comm.IUserSession) {
|
||||
|
||||
//IEquipment-------------------------------------------------------------------------------------------------------------------------------
|
||||
//查询武器信息
|
||||
func (this *Equipment) QueryEquipment(source *comm.ModuleCallSource, uid string, id string) (equipment *pb.DB_Equipment, code pb.ErrorCode) {
|
||||
func (this *Equipment) QueryEquipment(uid string, id string) (equipment *pb.DB_Equipment, code pb.ErrorCode) {
|
||||
var err error
|
||||
if uid == "" || id == "" {
|
||||
this.Errorf("请求参数错误 uid:%s Id:%s", uid, id)
|
||||
@ -88,13 +88,13 @@ func (this *Equipment) QueryEquipment(source *comm.ModuleCallSource, uid string,
|
||||
}
|
||||
|
||||
//查询卡片数量
|
||||
func (this *Equipment) QueryEquipmentAmount(source *comm.ModuleCallSource, uid string, equipmentId string) (amount uint32) {
|
||||
func (this *Equipment) QueryEquipmentAmount(uid string, equipmentId string) (amount uint32) {
|
||||
amount = this.modelEquipment.QueryEquipmentAmount(uid, equipmentId)
|
||||
return
|
||||
}
|
||||
|
||||
//添加武器
|
||||
func (this *Equipment) AddNewEquipments(source *comm.ModuleCallSource, session comm.IUserSession, cIds map[string]uint32, bPush bool) (code pb.ErrorCode) {
|
||||
func (this *Equipment) AddNewEquipments(session comm.IUserSession, cIds map[string]uint32, bPush bool) (code pb.ErrorCode) {
|
||||
var (
|
||||
err error
|
||||
change []*pb.DB_Equipment
|
||||
|
@ -102,10 +102,6 @@ func Test_Module_AddNewEquipments(t *testing.T) {
|
||||
|
||||
//查询武器信息
|
||||
func Test_Module_QueryEquipment(t *testing.T) {
|
||||
equipment, code := module.QueryEquipment(&comm.ModuleCallSource{
|
||||
Module: "Test",
|
||||
FuncName: "Test_Module",
|
||||
Describe: "摸底测试",
|
||||
}, "0_62b16dda909b2f8faeff788d", "62bd82860863ffbf2eb67f3a")
|
||||
equipment, code := module.QueryEquipment("0_62b16dda909b2f8faeff788d", "62bd82860863ffbf2eb67f3a")
|
||||
log.Debugf("Test_Module equipment:%v code:%d", equipment, code)
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ func (this *apiComp) SellItem(session comm.IUserSession, req *pb.ItemsSellItemRe
|
||||
return
|
||||
}
|
||||
item.Amount = item.Amount - req.Amount
|
||||
if code = this.module.AddItemforGrid(&comm.ModuleCallSource{}, session, req.GridId, -1*int32(req.Amount), true); code != pb.ErrorCode_Success {
|
||||
if code = this.module.AddItemforGrid(session, req.GridId, -1*int32(req.Amount), true); code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
// if item.Amount == 0 {
|
||||
|
@ -46,7 +46,7 @@ func (this *apiComp) Useitem(session comm.IUserSession, req *pb.ItemsUseItemReq)
|
||||
code = pb.ErrorCode_ItemsNoEnough
|
||||
return
|
||||
}
|
||||
if code = this.module.AddItemforGrid(&comm.ModuleCallSource{}, session, req.GridId, -1*itemcf.SynthetizeNum*int32(req.Amount), true); code != pb.ErrorCode_Success {
|
||||
if code = this.module.AddItemforGrid(session, req.GridId, -1*itemcf.SynthetizeNum*int32(req.Amount), true); code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
sale := RandomProps(prop)
|
||||
@ -61,7 +61,7 @@ func (this *apiComp) Useitem(session comm.IUserSession, req *pb.ItemsUseItemReq)
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return
|
||||
}
|
||||
if code = this.module.AddItemforGrid(&comm.ModuleCallSource{}, session, req.GridId, -1*int32(req.Amount), true); code != pb.ErrorCode_Success {
|
||||
if code = this.module.AddItemforGrid(session, req.GridId, -1*int32(req.Amount), true); code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
var sale []*cfg.Gameatn
|
||||
@ -94,7 +94,7 @@ func (this *apiComp) Useitem(session comm.IUserSession, req *pb.ItemsUseItemReq)
|
||||
for range sale {
|
||||
sale = append(sale, RandomProps(prop).Prize...)
|
||||
}
|
||||
if code = this.module.AddItemforGrid(&comm.ModuleCallSource{}, session, req.GridId, -1*int32(req.Amount), true); code != pb.ErrorCode_Success {
|
||||
if code = this.module.AddItemforGrid(session, req.GridId, -1*int32(req.Amount), true); code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
if code = this.module.DispenseRes(session, sale, true); code != pb.ErrorCode_Success {
|
||||
@ -115,7 +115,7 @@ func (this *apiComp) Useitem(session comm.IUserSession, req *pb.ItemsUseItemReq)
|
||||
})
|
||||
}
|
||||
}
|
||||
if code = this.module.AddItemforGrid(&comm.ModuleCallSource{}, session, req.GridId, -1*int32(req.Amount), true); code != pb.ErrorCode_Success {
|
||||
if code = this.module.AddItemforGrid(session, req.GridId, -1*int32(req.Amount), true); code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
if code = this.module.DispenseRes(session, sale, true); code != pb.ErrorCode_Success {
|
||||
@ -143,7 +143,7 @@ func (this *apiComp) Useitem(session comm.IUserSession, req *pb.ItemsUseItemReq)
|
||||
return
|
||||
}
|
||||
|
||||
if code = this.module.AddItemforGrid(&comm.ModuleCallSource{}, session, req.GridId, -1*itemcf.SynthetizeNum*int32(req.Amount), true); code != pb.ErrorCode_Success {
|
||||
if code = this.module.AddItemforGrid(session, req.GridId, -1*itemcf.SynthetizeNum*int32(req.Amount), true); code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
sale = make([]*cfg.Gameatn, 0, len(prop))
|
||||
|
@ -60,7 +60,7 @@ func (this *Items) EventUserOffline(session comm.IUserSession) {
|
||||
|
||||
//IItems-------------------------------------------------------------------------------------------------------------------------------
|
||||
///查询用户背包物品数量
|
||||
func (this *Items) QueryItemAmount(source *comm.ModuleCallSource, uId string, itemid string) (amount uint32) {
|
||||
func (this *Items) QueryItemAmount(uId string, itemid string) (amount uint32) {
|
||||
defer this.Debugf("获取物品 uId:%s itemid:%s addnum:%d ", uId, itemid, amount)
|
||||
amount = 0
|
||||
if result := this.modelItems.QueryUserPackItemsAmount(uId, itemid); result != nil && len(result) > 0 {
|
||||
@ -70,12 +70,12 @@ func (this *Items) QueryItemAmount(source *comm.ModuleCallSource, uId string, it
|
||||
}
|
||||
|
||||
///查询用户背包多个物品数量
|
||||
func (this *Items) QueryItemsAmount(source *comm.ModuleCallSource, uId string, itemid ...string) (result map[string]uint32) {
|
||||
func (this *Items) QueryItemsAmount(uId string, itemid ...string) (result map[string]uint32) {
|
||||
result = this.modelItems.QueryUserPackItemsAmount(uId, itemid...)
|
||||
return
|
||||
}
|
||||
|
||||
func (this *Items) AddItemforGrid(source *comm.ModuleCallSource, session comm.IUserSession, gridid string, addnum int32, bPush bool) (code pb.ErrorCode) {
|
||||
func (this *Items) AddItemforGrid(session comm.IUserSession, gridid string, addnum int32, bPush bool) (code pb.ErrorCode) {
|
||||
var (
|
||||
err error
|
||||
change []*pb.DB_UserItemData
|
||||
@ -100,7 +100,7 @@ func (this *Items) AddItemforGrid(source *comm.ModuleCallSource, session comm.IU
|
||||
}
|
||||
|
||||
///添加单个物品到背包 (可以加物品和减物品)
|
||||
func (this *Items) AddItem(source *comm.ModuleCallSource, session comm.IUserSession, itemid string, addnum int32, bPush bool) (code pb.ErrorCode) {
|
||||
func (this *Items) AddItem(session comm.IUserSession, itemid string, addnum int32, bPush bool) (code pb.ErrorCode) {
|
||||
var (
|
||||
err error
|
||||
change []*pb.DB_UserItemData
|
||||
@ -125,7 +125,7 @@ func (this *Items) AddItem(source *comm.ModuleCallSource, session comm.IUserSess
|
||||
}
|
||||
|
||||
///添加多个物品到背包 (可以加物品和减物品)
|
||||
func (this *Items) AddItems(source *comm.ModuleCallSource, session comm.IUserSession, items map[string]int32, bPush bool) (code pb.ErrorCode) {
|
||||
func (this *Items) AddItems(session comm.IUserSession, items map[string]int32, bPush bool) (code pb.ErrorCode) {
|
||||
var (
|
||||
err error
|
||||
change []*pb.DB_UserItemData
|
||||
|
@ -227,12 +227,6 @@ func (this *ModuleBase) SendMsgToCUsers(mainType, subType string, msg proto.Mess
|
||||
|
||||
// 只校验资源 参数 atn格式
|
||||
func (this *ModuleBase) CheckRes(session comm.IUserSession, res []*cfg.Gameatn) (code pb.ErrorCode) {
|
||||
|
||||
source := &comm.ModuleCallSource{
|
||||
Module: string(this.module.GetType()),
|
||||
FuncName: "CheckRes",
|
||||
Describe: "检查资源是否够",
|
||||
}
|
||||
//校验消费资源是否充足
|
||||
for _, v := range res {
|
||||
if v.A == comm.AttrType { //用户属性资源
|
||||
@ -246,7 +240,7 @@ func (this *ModuleBase) CheckRes(session comm.IUserSession, res []*cfg.Gameatn)
|
||||
// code = pb.ErrorCode_ConfigurationException
|
||||
// return
|
||||
// }
|
||||
if amount := this.ModuleItems.QueryItemAmount(source, session.GetUserId(), v.T); amount < uint32(v.N) {
|
||||
if amount := this.ModuleItems.QueryItemAmount(session.GetUserId(), v.T); amount < uint32(v.N) {
|
||||
code = pb.ErrorCode_ResNoEnough
|
||||
this.Errorf("道具不足:A:%s,T:%s,N:%d", v.A, v.T, v.N)
|
||||
return
|
||||
@ -275,11 +269,7 @@ func (this *ModuleBase) ConsumeRes(session comm.IUserSession, res []*cfg.Gameatn
|
||||
this.Errorf("not found res type") // 找不到资源类型
|
||||
}
|
||||
}
|
||||
source := &comm.ModuleCallSource{
|
||||
Module: string(this.module.GetType()),
|
||||
FuncName: "CheckConsumeRes",
|
||||
Describe: "消耗资源",
|
||||
}
|
||||
|
||||
// 校验数量
|
||||
for k, v := range attrs {
|
||||
if this.ModuleUser.QueryAttributeValue(session.GetUserId(), k) < -int64(v) { // -v 负负得正
|
||||
@ -289,7 +279,7 @@ func (this *ModuleBase) ConsumeRes(session comm.IUserSession, res []*cfg.Gameatn
|
||||
}
|
||||
}
|
||||
for k, v := range items {
|
||||
if int32(this.ModuleItems.QueryItemAmount(source, session.GetUserId(), k)) < -v {
|
||||
if int32(this.ModuleItems.QueryItemAmount(session.GetUserId(), k)) < -v {
|
||||
code = pb.ErrorCode_ResNoEnough
|
||||
this.Errorf("道具不足: A: item, T:%s, N:%d", k, v)
|
||||
return
|
||||
@ -304,7 +294,7 @@ func (this *ModuleBase) ConsumeRes(session comm.IUserSession, res []*cfg.Gameatn
|
||||
this.Debugf("消耗玩家资源: %v", attrs)
|
||||
}
|
||||
if len(items) > 0 {
|
||||
code = this.ModuleItems.AddItems(source, session, items, bPush)
|
||||
code = this.ModuleItems.AddItems(session, items, bPush)
|
||||
if code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
@ -327,11 +317,6 @@ func (this *ModuleBase) DispenseRes(session comm.IUserSession, res []*cfg.Gameat
|
||||
attrs = make(map[string]int32, 0)
|
||||
equips = make(map[string]uint32, 0)
|
||||
|
||||
source := &comm.ModuleCallSource{
|
||||
Module: string(this.module.GetType()),
|
||||
FuncName: "DispenseRes",
|
||||
Describe: "发放资源",
|
||||
}
|
||||
for _, v := range res {
|
||||
switch v.A {
|
||||
case comm.AttrType:
|
||||
@ -354,7 +339,7 @@ func (this *ModuleBase) DispenseRes(session comm.IUserSession, res []*cfg.Gameat
|
||||
this.Debugf("发放用户资源: %v [%v]", attrs, code)
|
||||
}
|
||||
if len(items) > 0 { //道具资源
|
||||
code = this.ModuleItems.AddItems(source, session, items, bPush)
|
||||
code = this.ModuleItems.AddItems(session, items, bPush)
|
||||
this.Debugf("发放道具资源: %v [%v]", items, code)
|
||||
}
|
||||
if len(heros) > 0 { //卡片资源
|
||||
@ -362,7 +347,7 @@ func (this *ModuleBase) DispenseRes(session comm.IUserSession, res []*cfg.Gameat
|
||||
this.Debugf("发放英雄资源: %v [%v]", heros, code)
|
||||
}
|
||||
if len(equips) > 0 {
|
||||
code = this.ModuleEquipment.AddNewEquipments(source, session, equips, bPush)
|
||||
code = this.ModuleEquipment.AddNewEquipments(session, equips, bPush)
|
||||
this.Debugf("发放装备资源: %v [%v]", equips, code)
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@ type GameEquipComposeData struct {
|
||||
Need []*Gameatn
|
||||
Ico string
|
||||
Equip []int32
|
||||
Probability []int32
|
||||
}
|
||||
|
||||
const TypeId_GameEquipComposeData = -210350968
|
||||
@ -60,6 +61,20 @@ func (_v *GameEquipComposeData)Deserialize(_buf map[string]interface{}) (err err
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
var _arr_ []interface{}
|
||||
var _ok_ bool
|
||||
if _arr_, _ok_ = _buf["probability"].([]interface{}); !_ok_ { err = errors.New("probability error"); return }
|
||||
|
||||
_v.Probability = make([]int32, 0, len(_arr_))
|
||||
|
||||
for _, _e_ := range _arr_ {
|
||||
var _list_v_ int32
|
||||
{ var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) }
|
||||
_v.Probability = append(_v.Probability, _list_v_)
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user