上传代码
This commit is contained in:
parent
77d5c22b86
commit
a001631410
@ -21,6 +21,7 @@ func (this *apiComp) ChallengeFinish(session comm.IUserSession, req *pb.Uniongve
|
|||||||
score *cfg.GameGuildBossScoreData
|
score *cfg.GameGuildBossScoreData
|
||||||
info *pb.DBUnionGve
|
info *pb.DBUnionGve
|
||||||
prop []*cfg.Gameatn
|
prop []*cfg.Gameatn
|
||||||
|
award []*pb.UserAssets
|
||||||
ok bool
|
ok bool
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
@ -48,10 +49,6 @@ func (this *apiComp) ChallengeFinish(session comm.IUserSession, req *pb.Uniongve
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if errdata = this.module.DispenseRes(session, prop, true); errdata != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
lock, _ := this.module.modelUniongve.userlock(req.Unionid)
|
lock, _ := this.module.modelUniongve.userlock(req.Unionid)
|
||||||
err = lock.Lock()
|
err = lock.Lock()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -73,9 +70,21 @@ func (this *apiComp) ChallengeFinish(session comm.IUserSession, req *pb.Uniongve
|
|||||||
if v.Hp > 0 {
|
if v.Hp > 0 {
|
||||||
ok = true
|
ok = true
|
||||||
v.Hp -= score.Hp
|
v.Hp -= score.Hp
|
||||||
|
|
||||||
|
record := &pb.DBGveRecord{
|
||||||
|
Uid: session.GetUserId(),
|
||||||
|
Formation: make([]string, 0),
|
||||||
|
}
|
||||||
|
for i, v := range req.Report.Info.Redflist[0].Team {
|
||||||
|
record.Formation[i] = ""
|
||||||
|
if v != nil {
|
||||||
|
record.Formation[i] = v.HeroID
|
||||||
|
}
|
||||||
|
}
|
||||||
|
v.Record = append(v.Record)
|
||||||
if v.Hp < 0 {
|
if v.Hp < 0 {
|
||||||
v.Hp = 0
|
v.Hp = 0
|
||||||
this.module.modelUniongve.booskill(req.Unionid, req.Boosid, info)
|
go this.module.modelUniongve.booskill(req.Unionid, req.Boosid, info)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
@ -92,15 +101,33 @@ func (this *apiComp) ChallengeFinish(session comm.IUserSession, req *pb.Uniongve
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
if errdata = this.module.DispenseRes(session, prop, true); errdata != nil {
|
||||||
if err = this.module.modelUniongve.updateUnionGve(info); err != nil {
|
return
|
||||||
errdata = &pb.ErrorData{
|
}
|
||||||
Code: pb.ErrorCode_DBError,
|
award = make([]*pb.UserAssets, 0)
|
||||||
Title: pb.ErrorCode_DBError.ToString(),
|
for _, v := range prop {
|
||||||
Message: err.Error(),
|
award = append(award, &pb.UserAssets{
|
||||||
|
A: v.A,
|
||||||
|
T: v.T,
|
||||||
|
N: v.N,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if err = this.module.modelUniongve.updateUnionGve(info); err != nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_DBError,
|
||||||
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
return
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
session.SendMsg(string(this.module.GetType()), "challengefinish", &pb.UniongveChallengeFinishResp{})
|
|
||||||
|
session.SendMsg(string(this.module.GetType()), "challengefinish", &pb.UniongveChallengeFinishResp{
|
||||||
|
Unionid: req.Unionid,
|
||||||
|
Boosid: req.Boosid,
|
||||||
|
Efficient: ok,
|
||||||
|
Award: award,
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -162,5 +162,28 @@ func (this *ModelUniongve) userlock(id string) (result *redis.RedisMutex, err er
|
|||||||
|
|
||||||
// 击杀boos
|
// 击杀boos
|
||||||
func (this *ModelUniongve) booskill(unionid string, boosid int32, info *pb.DBUnionGve) {
|
func (this *ModelUniongve) booskill(unionid string, boosid int32, info *pb.DBUnionGve) {
|
||||||
|
var (
|
||||||
|
// conf *cfg.GameGuildBossData
|
||||||
|
members []*pb.SociatyMemberInfo
|
||||||
|
offlist []string = make([]string, 0)
|
||||||
|
onine []string = make([]string, 0)
|
||||||
|
// err error
|
||||||
|
)
|
||||||
|
// if conf, err = this.module.configure.getguildbossByid(boosid); err != nil {
|
||||||
|
// this.module.Errorln(err)
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
members = this.module.sociaty.MembersBySociatyId(unionid)
|
||||||
|
if members == nil || len(members) == 0 {
|
||||||
|
this.module.Error("MembersBySociatyId is nil !")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for _, v := range members {
|
||||||
|
if v.OfflineTime != 0 {
|
||||||
|
offlist = append(offlist, v.Uid)
|
||||||
|
} else {
|
||||||
|
onine = append(onine, v.Uid)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,8 @@ func NewModule() core.IModule {
|
|||||||
type UnionGve struct {
|
type UnionGve struct {
|
||||||
modules.ModuleBase
|
modules.ModuleBase
|
||||||
service core.IService
|
service core.IService
|
||||||
|
sociaty comm.ISociaty
|
||||||
|
mail comm.Imail
|
||||||
battle comm.IBattle
|
battle comm.IBattle
|
||||||
api *apiComp
|
api *apiComp
|
||||||
modelUniongve *ModelUniongve
|
modelUniongve *ModelUniongve
|
||||||
@ -34,6 +36,14 @@ func (this *UnionGve) Init(service core.IService, module core.IModule, options c
|
|||||||
func (this *UnionGve) Start() (err error) {
|
func (this *UnionGve) Start() (err error) {
|
||||||
err = this.ModuleBase.Start()
|
err = this.ModuleBase.Start()
|
||||||
var module core.IModule
|
var module core.IModule
|
||||||
|
if module, err = this.service.GetModule(comm.ModuleSociaty); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.sociaty = module.(comm.ISociaty)
|
||||||
|
if module, err = this.service.GetModule(comm.ModuleMail); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.mail = module.(comm.Imail)
|
||||||
if module, err = this.service.GetModule(comm.ModuleBattle); err != nil {
|
if module, err = this.service.GetModule(comm.ModuleBattle); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user