40 lines
1.0 KiB
Go
40 lines
1.0 KiB
Go
package atlas
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/pb"
|
|
|
|
"google.golang.org/protobuf/proto"
|
|
)
|
|
|
|
//参数校验
|
|
func (this *apiComp) AwardCheck(session comm.IUserSession, req *pb.AtlasAwardReq) (code pb.ErrorCode) {
|
|
|
|
return
|
|
}
|
|
|
|
// 获取铁匠铺图鉴信息
|
|
func (this *apiComp) Award(session comm.IUserSession, req *pb.AtlasAwardReq) (code pb.ErrorCode, data proto.Message) {
|
|
|
|
list, _ := this.module.modelPandaAtlas.getPandaAtlasList(session.GetUserId())
|
|
conf := this.module.configure.GetPandoAtlasAwardConf(list.Award + 1)
|
|
if conf == nil {
|
|
code = pb.ErrorCode_SmithyAtlasMaxLv
|
|
return
|
|
}
|
|
// 校验积分够不够
|
|
if list.Score < conf.AtlasScore {
|
|
code = pb.ErrorCode_SmithyAtlasLackLv
|
|
return
|
|
}
|
|
this.module.DispenseRes(session, conf.ItemId, true)
|
|
update := make(map[string]interface{})
|
|
list.Award += 1
|
|
update["award"] = list.Award
|
|
this.module.modelPandaAtlas.modifyPandaAtlasList(session.GetUserId(), update)
|
|
session.SendMsg(string(this.module.GetType()), "award", &pb.AtlasAwardResp{
|
|
Data: list,
|
|
})
|
|
return
|
|
}
|