This commit is contained in:
liwei 2022-12-16 21:43:31 +08:00
parent a71bfecd2b
commit 73b894f1b0
8 changed files with 66 additions and 20 deletions

View File

@ -13,13 +13,7 @@ func (this *apiComp) ResonanceUseEnergyCheck(session comm.IUserSession, req *pb.
code = pb.ErrorCode_ReqParameterError
return
}
// for _, v := range req.Energy {
// if v.UseEnergy < 0 || (v.UseType != comm.ResonanceAtkPro && v.UseType != comm.ResonanceHpPro && v.UseType != comm.ResonanceDefPro) {
// code = pb.ErrorCode_ReqParameterError
// return
// }
// }
return
}

View File

@ -20,7 +20,7 @@ func (this *apiComp) TalentList(session comm.IUserSession, req *pb.HeroTalentLis
rsp := &pb.HeroTalentListResp{}
if rsp.Telnet, err = this.module.modelTalent.GetHerotalent(session.GetUserId()); err != nil {
fmt.Printf("GetHerotalenterr: %v\n", err)
code = pb.ErrorCode_DBError
//code = pb.ErrorCode_DBError
}
session.SendMsg(string(this.module.GetType()), HeroTalentListResp, rsp)
return

View File

@ -216,6 +216,36 @@ func (this *Hero) GetSpecifiedHero(session comm.IUserSession, heroConfId string,
if session.GetUserId() == "" || heroConfId == "" || star == 0 || lv == 0 || amount == 0 {
return pb.ErrorCode_ReqParameterError
}
// 等级校验
conf := this.configure.GetHeroConfig(heroConfId)
if conf == nil {
code = pb.ErrorCode_ReqParameterError
return
}
cid := heroConfId
maxStar := conf.Star
starConf := this.configure.GetHeroStarupConfig(cid, conf.Star)
if starConf == nil {
code = pb.ErrorCode_ReqParameterError
return
}
// 获取最大星级
for i := 1; ; i++ {
starConf := this.configure.GetHeroStarupConfig(cid, conf.Star+int32(i))
if starConf == nil {
break
}
if starConf != nil && starConf.Gold == 0 {
maxStar = star + int32(i)
break
}
}
maxLv := this.configure.GetHeroStargrowConfigByStar(maxStar) // 最大等级
if star > maxStar || lv > maxLv {
code = pb.ErrorCode_ReqParameterError
return
}
hero, err := this.modelHero.createOneHero(session.GetUserId(), heroConfId)
if err != nil {
return pb.ErrorCode_HeroCreate
@ -502,7 +532,6 @@ func (this *Hero) ContinuousRestriction(uid string, heroCid string, drawCount in
}
}
}
}
}
}
@ -687,7 +716,5 @@ func (this *Hero) GetAllMaxHero(session comm.IUserSession) (code pb.ErrorCode) {
if len(changeHero) > 0 {
session.SendMsg("hero", "change", &pb.HeroChangePush{List: changeHero})
}
return
}

View File

@ -99,7 +99,19 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal
} else {
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
}
userinfo := this.module.ModuleUser.GetUser(session.GetUserId())
newData := &pb.DBPagodaRecord{
Id: primitive.NewObjectID().Hex(),
Uid: session.GetUserId(),
PagodaId: pagoda.PagodaId,
Type: pagoda.Type,
Nickname: userinfo.Name,
Icon: "", // icon 暂无
Lv: userinfo.Lv,
CostTime: req.Report.Costtime,
}
costTime = newData.CostTime
this.module.modulerank.AddPagodaRecord(session.GetUserId(), newData)
//this.module.modulerank.SetNormalPagodaRankList("pagodaRank", pagoda.PagodaId<<16-costTime, session.GetUserId())
// 普通塔通关了

View File

@ -39,6 +39,12 @@ func (this *ModelRank) GetRankData() (data []*pb.DBPagodaRecord, err error) {
return
}
func (this *ModelRank) AddPagodaRecord(uid string, record *pb.DBPagodaRecord) (err error) {
err = this.AddList(uid, record.Id, record)
return
}
func (this *ModelRank) getPagodaRankList(uid string) []*pb.DBPagodaRecord {
pagodaRank := make([]*pb.DBPagodaRecord, 0)
err := this.GetList(uid, &pagodaRank)

View File

@ -15,10 +15,8 @@ func (this *apiComp) GetlistCheck(session comm.IUserSession, req *pb.PrivilegeGe
///获取特权列表
func (this *apiComp) Getlist(session comm.IUserSession, req *pb.PrivilegeGetListReq) (code pb.ErrorCode, data proto.Message) {
list, err := this.module.modelPrivilege.getPrivilegeList(session.GetUserId())
if err != nil {
this.module.Errorf("can't get privilege list :%v", err)
}
list, _ := this.module.modelPrivilege.getPrivilegeList(session.GetUserId())
session.SendMsg(string(this.module.GetType()), PrivilegeGetListResp, &pb.PrivilegeGetListResp{Data: list})
return
}

View File

@ -15,10 +15,8 @@ func (this *apiComp) VipListCheck(session comm.IUserSession, req *pb.PrivilegeVi
///获取特权列表
func (this *apiComp) VipList(session comm.IUserSession, req *pb.PrivilegeVipListReq) (code pb.ErrorCode, data proto.Message) {
list, err := this.module.modelVip.getVipList(session.GetUserId())
if err != nil {
this.module.Errorf("can't get privilege list :%v", err)
}
list, _ := this.module.modelVip.getVipList(session.GetUserId())
session.SendMsg(string(this.module.GetType()), PrivilegeVipListResp, &pb.PrivilegeVipListResp{Data: list})
return
}

View File

@ -337,7 +337,7 @@ func (this *Privilege) AddVipData(session comm.IUserSession, oldVip, newVip int3
Reward: map[int32]bool{},
Privilege: map[int32]*pb.PrivilegeList{},
CTime: configure.Now().Unix(),
RewardTime: 0,
RewardTime: configure.Now().Unix(),
}
if err = this.modelVip.addVipData(session.GetUserId(), vip); err != nil {
this.Errorf("err:%v", err)
@ -360,12 +360,23 @@ func (this *Privilege) AddVipData(session comm.IUserSession, oldVip, newVip int3
}
}
}
// 发放每日福利
var res []*pb.UserAssets
for _, v := range conf.Daygift {
res = append(res, &pb.UserAssets{
A: v.A,
T: v.T,
N: v.N,
})
}
this.mail.SendMailByCid(session, comm.VipDaily, res)
}
}
update["privilege"] = vip.Privilege
this.modelVip.modifyVipData(session.GetUserId(), update)
session.SendMsg(string(this.GetType()), PrivilegeGetListResp, &pb.PrivilegeVipListResp{Data: vip})
}
// 发送特权每日奖励