Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
76dc1a3574
@ -11,6 +11,9 @@ import (
|
||||
|
||||
//参数校验
|
||||
func (this *apiComp) EquipCheck(session comm.IUserSession, req *pb.EquipmentEquipReq) (code pb.ErrorCode) {
|
||||
if len(req.EquipmentId) != 6 || req.HeroCardId == "" {
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@ -30,6 +33,9 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq)
|
||||
session.SendMsg(string(this.module.GetType()), "equip", &pb.EquipmentEquipResp{Equipments: equipments})
|
||||
}
|
||||
}()
|
||||
if code = this.EquipCheck(session, req); code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
//校验数据
|
||||
confs = make([]*cfg.Game_equipData, len(req.EquipmentId))
|
||||
equipments = make([]*pb.DB_Equipment, len(req.EquipmentId))
|
||||
@ -83,11 +89,12 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq)
|
||||
subsit := true
|
||||
for i, v := range equipments { //校验装备位置
|
||||
if v != nil {
|
||||
if i != int(confs[i].Pos) {
|
||||
if i+1 != int(confs[i].Pos) {
|
||||
log.Errorf("Equip conf:%v Target:%d Incorrect range!", confs[i], i)
|
||||
code = pb.ErrorCode_SystemError
|
||||
return
|
||||
}
|
||||
hero.EquipID[i] = v.Id
|
||||
} else {
|
||||
if i < 4 {
|
||||
msuit = false //主套装没有
|
||||
|
@ -78,11 +78,14 @@ func (this *Hero) GetHero(uid, heroId string) (*pb.DBHero, pb.ErrorCode) {
|
||||
|
||||
//佩戴装备
|
||||
func (this *Hero) UpdateEquipment(hero *pb.DBHero, equip []*pb.DB_Equipment) (code pb.ErrorCode) {
|
||||
equipIds := make([]string, 4)
|
||||
equipIds := make([]string, 6)
|
||||
property := make(map[string]int32) //主属性
|
||||
addProperty := make(map[string]int32) //副属性
|
||||
for _, v := range equip {
|
||||
equipIds = append(equipIds, v.Id)
|
||||
for i, v := range equip {
|
||||
if v == nil {
|
||||
continue
|
||||
}
|
||||
equipIds[i] = v.Id
|
||||
//主属性
|
||||
property[v.MainEntry.AttrName] = v.MainEntry.Value
|
||||
//附加属性
|
||||
|
@ -66,7 +66,6 @@ func (this *ConfigureComp) GetPackItemByType(itmes []*pb.DB_UserItemData, usetyp
|
||||
v interface{}
|
||||
table *cfg.Game_item
|
||||
item *cfg.Game_itemData
|
||||
id int32
|
||||
ok bool
|
||||
err error
|
||||
)
|
||||
@ -76,12 +75,12 @@ func (this *ConfigureComp) GetPackItemByType(itmes []*pb.DB_UserItemData, usetyp
|
||||
} else {
|
||||
table = v.(*cfg.Game_item)
|
||||
for _, v := range itmes {
|
||||
if item, ok = table.GetDataMap()[id]; ok {
|
||||
if item, ok = table.GetDataMap()[v.ItemId]; ok {
|
||||
if item.Usetype == usetype {
|
||||
result = append(result, v)
|
||||
}
|
||||
} else {
|
||||
log.Errorf("no found itemConfigure:%d", id)
|
||||
log.Errorf("no found itemConfigure:%d", v.ItemId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,10 @@ import (
|
||||
"go_dreamfactory/lego/base/rpcx"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/modules/equipment"
|
||||
"go_dreamfactory/modules/hero"
|
||||
"go_dreamfactory/modules/items"
|
||||
"go_dreamfactory/modules/user"
|
||||
"go_dreamfactory/pb"
|
||||
"go_dreamfactory/services"
|
||||
"go_dreamfactory/sys/cache"
|
||||
@ -68,6 +71,9 @@ func TestMain(m *testing.M) {
|
||||
go func() {
|
||||
lego.Run(service, //运行模块
|
||||
module,
|
||||
hero.NewModule(),
|
||||
user.NewModule(),
|
||||
equipment.NewModule(),
|
||||
)
|
||||
}()
|
||||
time.Sleep(time.Second * 3)
|
||||
@ -86,6 +92,6 @@ func Test_Modules_AddItems(t *testing.T) {
|
||||
Module: "Test",
|
||||
FuncName: "Test_Modules_AddItems",
|
||||
Describe: "测试模块接口",
|
||||
}, "0_62b16dda909b2f8faeff788d", map[int32]int32{10001: -1000})
|
||||
}, "0_62c259916d8cf3e4e06311a8", map[int32]int32{10001: 1000})
|
||||
log.Debugf("Test_Modules_AddItems:%v code:%v", code)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user