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

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 service core.IService
modelhdList *modelHdList modelhdList *modelHdList
modelhdData *modelhdData modelhdData *modelhdData
warorder comm.IWarorder // 战令
} }
func NewModule() core.IModule { 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) { func (this *Activity) Start() (err error) {
err = this.ModuleBase.Start() 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 return
} }
func (this *Activity) OnInstallComp() { func (this *Activity) OnInstallComp() {

View File

@ -16,7 +16,8 @@ func (this *apiComp) AtlasAwardCheck(session comm.IUserSession, req *pb.SmithyAt
func (this *apiComp) AtlasAward(session comm.IUserSession, req *pb.SmithyAtlasAwardReq) (errdata *pb.ErrorData) { func (this *apiComp) AtlasAward(session comm.IUserSession, req *pb.SmithyAtlasAwardReq) (errdata *pb.ErrorData) {
var ( var (
res []*cfg.Gameatn res []*cfg.Gameatn
respRes []*pb.UserAssets atno []*pb.UserAtno
Res []*pb.UserAssets
) )
if errdata = this.AtlasAwardCheck(session, req); errdata != nil { if errdata = this.AtlasAwardCheck(session, req); errdata != nil {
return // 参数校验失败直接返回 return // 参数校验失败直接返回
@ -48,26 +49,17 @@ func (this *apiComp) AtlasAward(session comm.IUserSession, req *pb.SmithyAtlasAw
} }
return 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
} }
} for _, v := range atno {
if !bFind { Res = append(Res, &pb.UserAssets{
respRes = append(respRes, &pb.UserAssets{
A: v.A, A: v.A,
T: v.T, T: v.T,
N: v.N, N: v.N,
}) })
} }
}
//修改数据 //修改数据
update := make(map[string]interface{}, 0) update := make(map[string]interface{}, 0)
update["award"] = atlas.Award update["award"] = atlas.Award
@ -75,7 +67,7 @@ func (this *apiComp) AtlasAward(session comm.IUserSession, req *pb.SmithyAtlasAw
session.SendMsg(string(this.module.GetType()), "atlasaward", &pb.SmithyAtlasAwardResp{ session.SendMsg(string(this.module.GetType()), "atlasaward", &pb.SmithyAtlasAwardResp{
Data: atlas, Data: atlas,
Res: respRes, Res: Res,
}) })
return return
} }