Merge branch 'meixiongfeng' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
153ffd253f
@ -36,6 +36,6 @@ func (this *apiComp) ActivationFetter(session comm.IUserSession, req *pb.Library
|
|||||||
mapData := make(map[string]interface{}, 0)
|
mapData := make(map[string]interface{}, 0)
|
||||||
mapData["activation"] = fetter.Activation
|
mapData["activation"] = fetter.Activation
|
||||||
this.module.modelLibrary.modifyLibraryDataByObjId(session.GetUserId(), fetter.Id, mapData)
|
this.module.modelLibrary.modifyLibraryDataByObjId(session.GetUserId(), fetter.Id, mapData)
|
||||||
|
rsp.Data = fetter
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -22,13 +22,13 @@ func (this *apiComp) GetReward(session comm.IUserSession, req *pb.LibraryGetRewa
|
|||||||
return // 参数校验失败直接返回
|
return // 参数校验失败直接返回
|
||||||
}
|
}
|
||||||
rsp := &pb.LibraryGetListResp{}
|
rsp := &pb.LibraryGetListResp{}
|
||||||
defer session.SendMsg(string(this.module.GetType()), LibraryGetListResp, rsp)
|
defer session.SendMsg(string(this.module.GetType()), LibraryGetRewardResp, rsp)
|
||||||
fetter := this.module.getLibraryByObjID(session.GetUserId(), req.ObjId)
|
fetter := this.module.getLibraryByObjID(session.GetUserId(), req.ObjId)
|
||||||
if fetter == nil {
|
if fetter == nil {
|
||||||
code = pb.ErrorCode_LibraryNoData
|
code = pb.ErrorCode_LibraryNoData
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
conf := this.configure.GetLibraryFetter(fetter.Fid, req.Fetterlv)
|
conf := this.module.configure.GetLibraryFetter(fetter.Fid, req.Fetterlv)
|
||||||
if conf == nil {
|
if conf == nil {
|
||||||
code = pb.ErrorCode_ConfigNoFound
|
code = pb.ErrorCode_ConfigNoFound
|
||||||
return
|
return
|
||||||
|
@ -66,31 +66,29 @@ func (this *Library) GetLibraryListByFid(uid string, fid int32) *pb.DBLibrary {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//通过羁绊id 创建多个羁绊信息
|
//通过羁绊id 创建多个羁绊信息
|
||||||
func (this *Library) CreateLibrary(uid string, fids []int32, heroConfId string) (code pb.ErrorCode, objLibrary []*pb.DBLibrary) {
|
func (this *Library) CreateLibrary(uid string, fid int32, heroConfId string) (code pb.ErrorCode, objLibrary []*pb.DBLibrary) {
|
||||||
for _, fid := range fids {
|
obj := &pb.DBLibrary{
|
||||||
obj := &pb.DBLibrary{
|
Id: primitive.NewObjectID().Hex(),
|
||||||
Id: primitive.NewObjectID().Hex(),
|
Uid: uid,
|
||||||
Uid: uid,
|
Fid: fid,
|
||||||
Fid: fid,
|
Hero: map[string]int32{},
|
||||||
Hero: map[string]int32{},
|
Prize: map[int32]int32{},
|
||||||
Prize: map[int32]int32{},
|
Fetterlv: 0,
|
||||||
Fetterlv: 0,
|
}
|
||||||
}
|
|
||||||
|
|
||||||
conf := this.configure.GetLibraryFetter(fid, 1)
|
conf := this.configure.GetLibraryFetter(fid, 1)
|
||||||
if conf != nil {
|
if conf != nil {
|
||||||
for _, v := range conf.Hid {
|
for _, v := range conf.Hid {
|
||||||
obj.Hero[v] = 0 // 默认值
|
obj.Hero[v] = 0 // 默认值
|
||||||
if v == heroConfId {
|
if v == heroConfId {
|
||||||
obj.Hero[heroConfId] = 1 // 获得的英雄好感度等级为1级
|
obj.Hero[heroConfId] = 1 // 获得的英雄好感度等级为1级
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if err := this.modelLibrary.createLibrary(uid, obj); err != nil {
|
|
||||||
code = pb.ErrorCode_DBError
|
|
||||||
break
|
|
||||||
}
|
|
||||||
objLibrary = append(objLibrary, obj)
|
|
||||||
}
|
}
|
||||||
|
if err := this.modelLibrary.createLibrary(uid, obj); err != nil {
|
||||||
|
code = pb.ErrorCode_DBError
|
||||||
|
|
||||||
|
}
|
||||||
|
objLibrary = append(objLibrary, obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
@ -108,7 +106,7 @@ func (this *Library) GetHeroFetterList(uid string) []*pb.DBHeroFetter {
|
|||||||
|
|
||||||
// 创建一条英雄羁绊信息
|
// 创建一条英雄羁绊信息
|
||||||
func (this *Library) createHeroFetter(uid string, heroConfId string) (code pb.ErrorCode) {
|
func (this *Library) createHeroFetter(uid string, heroConfId string) (code pb.ErrorCode) {
|
||||||
|
this.modelFetter.getHeroFetterList(uid)
|
||||||
obj := &pb.DBHeroFetter{
|
obj := &pb.DBHeroFetter{
|
||||||
Id: primitive.NewObjectID().Hex(),
|
Id: primitive.NewObjectID().Hex(),
|
||||||
Uid: uid,
|
Uid: uid,
|
||||||
@ -149,12 +147,12 @@ func (this *Library) AddHeroFetterData(uid string, heroConfId string) {
|
|||||||
obj := this.GetLibraryListByFid(uid, fid)
|
obj := this.GetLibraryListByFid(uid, fid)
|
||||||
if obj == nil { // 没有羁绊信息
|
if obj == nil { // 没有羁绊信息
|
||||||
this.createHeroFetter(uid, heroConfId)
|
this.createHeroFetter(uid, heroConfId)
|
||||||
this.CreateLibrary(uid, []int32{fid}, heroConfId)
|
this.CreateLibrary(uid, fid, heroConfId)
|
||||||
|
|
||||||
} else { // 羁绊信息中没有这个heroid 也需要加进来
|
} else { // 羁绊信息中没有这个heroid 也需要加进来
|
||||||
for k, v := range obj.Hero {
|
for k, v := range obj.Hero {
|
||||||
if v == 0 && k == heroConfId {
|
if v == 0 && k == heroConfId {
|
||||||
v = 1
|
obj.Hero[k] = 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 重新计算最低等级
|
// 重新计算最低等级
|
||||||
|
@ -20,7 +20,7 @@ const (
|
|||||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
)
|
)
|
||||||
|
|
||||||
//获取装备列表请求
|
//获取秘境列表请求
|
||||||
type MoonfantasyGetListReq struct {
|
type MoonfantasyGetListReq struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
@ -59,7 +59,7 @@ func (*MoonfantasyGetListReq) Descriptor() ([]byte, []int) {
|
|||||||
return file_moonfantasy_moonfantasy_msg_proto_rawDescGZIP(), []int{0}
|
return file_moonfantasy_moonfantasy_msg_proto_rawDescGZIP(), []int{0}
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取装备列表请求 回应
|
//获取秘境列表请求 回应
|
||||||
type MoonfantasyGetListResp struct {
|
type MoonfantasyGetListResp struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
@ -123,7 +123,7 @@ func (x *MoonfantasyGetListResp) GetDfantasys() []*DBMoonFantasy {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
///触发秘境
|
///推送触发秘境
|
||||||
type MoonfantasyTriggerPush struct {
|
type MoonfantasyTriggerPush struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
|
Loading…
Reference in New Issue
Block a user