铁匠铺图鉴获得重复英雄奖励自动转碎片

This commit is contained in:
meixiongfeng 2023-07-13 15:20:18 +08:00
parent 5d302312b2
commit 7836bd7531
2 changed files with 24 additions and 22 deletions

View File

@ -18,6 +18,8 @@ type Activity struct {
service core.IService
modelhdList *modelHdList
modelhdData *modelhdData
warorder comm.IWarorder // 战令
}
func NewModule() core.IModule {
@ -46,7 +48,15 @@ func (this *Activity) Init(service core.IService, module core.IModule, options c
}
func (this *Activity) Start() (err error) {
err = this.ModuleBase.Start()
//this.modelhdList.getHdInfoByHdId(10002)
if rst, err := this.modelhdList.getHdInfoByHdId(10002); err == nil {
// 服务启动 获取活动信息
var module core.IModule
if module, err = this.service.GetModule(comm.ModuleWarorder); err == nil {
this.warorder = module.(comm.IWarorder)
this.warorder.OpenWarorder(2, rst.Stime)
}
}
return
}
func (this *Activity) OnInstallComp() {

View File

@ -15,8 +15,9 @@ func (this *apiComp) AtlasAwardCheck(session comm.IUserSession, req *pb.SmithyAt
// 一键领取所有可以领取的奖励
func (this *apiComp) AtlasAward(session comm.IUserSession, req *pb.SmithyAtlasAwardReq) (errdata *pb.ErrorData) {
var (
res []*cfg.Gameatn
respRes []*pb.UserAssets
res []*cfg.Gameatn
atno []*pb.UserAtno
Res []*pb.UserAssets
)
if errdata = this.AtlasAwardCheck(session, req); errdata != nil {
return // 参数校验失败直接返回
@ -48,25 +49,16 @@ func (this *apiComp) AtlasAward(session comm.IUserSession, req *pb.SmithyAtlasAw
}
return
}
this.module.DispenseRes(session, res, true)
if errdata, atno = this.module.DispenseAtno(session, res, true); errdata != nil {
return
}
for _, v := range res {
bFind := false
for _, v1 := range respRes {
if v1.A == v.A && v1.T == v.T {
v1.N += v.N
bFind = true
}
}
if !bFind {
respRes = append(respRes, &pb.UserAssets{
A: v.A,
T: v.T,
N: v.N,
})
}
for _, v := range atno {
Res = append(Res, &pb.UserAssets{
A: v.A,
T: v.T,
N: v.N,
})
}
//修改数据
update := make(map[string]interface{}, 0)
@ -75,7 +67,7 @@ func (this *apiComp) AtlasAward(session comm.IUserSession, req *pb.SmithyAtlasAw
session.SendMsg(string(this.module.GetType()), "atlasaward", &pb.SmithyAtlasAwardResp{
Data: atlas,
Res: respRes,
Res: Res,
})
return
}